Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th July 2008, 16:22   #1  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,923
Re-use of PPS id's legal?

I've come across a stream that uses FMO. It keeps using PPS id 0 even though the slice group data in the PPS changes. Is this legal? If so, it severely complicates random access, because I have to be much more careful about which PPS to inject.

Please tell me it is not legal.
Guest is offline   Reply With Quote
Old 26th July 2008, 17:50   #2  |  Link
Sergey A. Sablin
Registered User
 
Join Date: Dec 2004
Location: Tomsk, Russia
Posts: 366
Quote:
Originally Posted by neuron2 View Post
I've come across a stream that uses FMO. It keeps using PPS id 0 even though the slice group data in the PPS changes. Is this legal? If so, it severely complicates random access, because I have to be much more careful about which PPS to inject.

Please tell me it is not legal.
as said in 7.4.1.2.1:

Quote:
Any picture parameter set NAL unit containing the value of pic_parameter_set_id for the active picture parameter set RBSP shall have the same content as that of the active picture parameter set RBSP unless it follows the last VCL NAL unit of a coded picture and precedes the first VCL NAL unit of another coded picture.
where new sequence is obviously identified by NAL unit containing End Of Sequence RBSP.
Sergey A. Sablin is offline   Reply With Quote
Old 26th July 2008, 18:04   #3  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,923
Quote:
Originally Posted by Sergey A. Sablin View Post
where new sequence is obviously identified by NAL unit containing End Of Sequence RBSP.
That's relevant to SPS and I was talking about PPS. According to the quoted section, the PPS contents can change between pictures, so the scenario I gave is indeed legal, and I need to handle it properly.
Guest is offline   Reply With Quote
Old 27th July 2008, 10:51   #4  |  Link
Sergey A. Sablin
Registered User
 
Join Date: Dec 2004
Location: Tomsk, Russia
Posts: 366
Quote:
Originally Posted by neuron2 View Post
That's relevant to SPS and I was talking about PPS. According to the quoted section, the PPS contents can change between pictures, so the scenario I gave is indeed legal, and I need to handle it properly.
yeah, right. i've read both, than post pps related citation and ... comment on sps
strange anyway, I was though it's illegal inside one sequence.
Sergey A. Sablin is offline   Reply With Quote
Old 27th July 2008, 11:44   #5  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
What's the problem with random access, and why are you "injecting" a PPS?
If a stream has global headers, then forget semantic rules; there is no syntactic way to describe multiple meanings for the same PPS id.
If a stream doesn't have global headers, then it should re-send PPS at each keyframe in addition to whenever they change, so you just update your interpretation of the id whenever you reach each PPS.
akupenguin is offline   Reply With Quote
Old 27th July 2008, 13:12   #6  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,923
The streams I find in the wild do not always behave as they "should".

Try to implement frame accurate random access, and you'll soon see what the problems are. It's easy enough to jump randomly into a stream and start decoding and get the first decodable picture, but it might not be the one you want because you've jumped in just after the PPS you need, and you have to wait for the next one. For frame accuracy you need to start decoding exactly at an indexed frame, so you need to ensure that the required SPS's and PPS's have been injected. Consider, for example, that a stream can send these only once at the beginning of the stream. That's just one of the scenarios you need to deal with. (By "injecting" I mean feeding a NALU to the decoder.)

Another problem is the same as for MPEG2: you have to allow for open GOPs. If you want to navigate to the first frame of an open GOP, you've got a problem.

Last edited by Guest; 27th July 2008 at 13:41.
Guest is offline   Reply With Quote
Old 27th July 2008, 13:41   #7  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,393
Frame-accurate seeking requires starting to decode at the keyframe whose dts precedes the indexed frame's pts, and throwing away intermediate decoded frames. So you found a stream that has neither PPS at each keyframe nor global headers? Far be it from me to discourage you, but if I saw such a thing I'd just say "no, you can't seek".

Last edited by akupenguin; 27th July 2008 at 13:45.
akupenguin is offline   Reply With Quote
Old 27th July 2008, 13:46   #8  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,923
Quote:
Originally Posted by akupenguin View Post
Frame-accurate seeking requires starting to decode at the keyframe preceding the indexed frame, and throwing away intermediate decoded frames.
Of course. But even that won't work for open GOPs (you have to go back one more GOP to get the needed reference frames). But why are you telling me how to do this when I have been doing it for 5 years now with DGMPGDec and now DGAVCDec?

Quote:
So you found a stream that has neither PPS at each keyframe nor global headers? Far be it from me to discourage you, but if I saw such a thing I'd just say "no, you can't seek".
You can't discourage me because it is already working. My goal is to support all legal streams. The SPS/PPS's are available from the indexing operation, so it's just a matter of injecting the right ones when doing a frame accurate seek to a given frame. The code to implement that is simple.

Last edited by Guest; 27th July 2008 at 13:53.
Guest is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:00.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.