[FFmpeg-devel] [PATCH] H.264/AVCHD interlaced fixes

Ivan Schreter schreter
Sun Feb 15 22:56:44 CET 2009

Michael Niedermayer wrote:
> On Tue, Feb 10, 2009 at 09:36:35PM +0100, Ivan Schreter wrote:
> [...]
>> +        ptr= ff_h264_decode_nal(h, buf, &dst_length, &consumed, buf_end - buf);
> this effectively reads through the whole bitstream
> obviously this is not ok and unneeded
I've studied the code a bit more. Unfortunately, I still believe it _is_ 
needed to call decode_nal, due to two reasons. First, we need to know 
_exact_ NAL unit size, otherwise it's impossible to decode NAL SEI 
correctly. Second, decode_nal also unescapes some sequences in data. 
Without that, the data cannot be read correctly as well.

Each decode_nal() only scans as much data as really needed to decode 
this NAL. If ff_find_start_code() should be used instead to find next 
NAL (ignoring the two aforementioned problems), it would also scan 
exactly as much data. So I don't see a problem with it.

(Of course, instead of hard-coded for-loop to find start code before 
decoding NAL, one can use ff_find_start_code(), which will also always 
terminate in the first iteration).

I hope I could change your mind on this. Or do you have a better idea 
how to address the two problems via something simpler than decode_nal() 
function? Please let me know.

I'll post updated patches possibly tomorrow, with separated bits for 
each handled part.



More information about the ffmpeg-devel mailing list