[FFmpeg-devel] [VA decode] [PATCH] calculation of next marker for MPEG-4 streams

anuj mittal am.devel at gmail.com
Tue Oct 9 15:43:16 CEST 2012


On Tue, Oct 9, 2012 at 5:21 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Oct 09, 2012 at 12:23:19PM +0530, anuj mittal wrote:
>> On Tue, Oct 9, 2012 at 3:19 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Mon, Oct 08, 2012 at 07:59:04PM +0530, anuj mittal wrote:
>>
>> ---
>>  lib/ffmpeg/libavcodec/ituh263dec.c |    5 +++--
>>  1 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/ffmpeg/libavcodec/ituh263dec.c b/lib/ffmpeg/libavcodec/ituh263dec.c
>> index 4678287..bb8ca56 100644
>
>> --- a/lib/ffmpeg/libavcodec/ituh263dec.c
>> +++ b/lib/ffmpeg/libavcodec/ituh263dec.c
>
> these patches dont apply cleanly with "git am"

Sorry about that. The attached ones should apply cleanly.

>
>> @@ -217,10 +217,11 @@ const uint8_t *ff_h263_find_resync_marker(MpegEncContext *s, const uint8_t *rest
>>      end-=2;
>>      p++;
>>      if(s->resync_marker){
>
>> +        int f_code = ff_mpeg4_get_video_packet_prefix_length(s);
>
> this is the prefix length and not the f code

Corrected.

>
>
>>          for(;p<end; p+=2){
>>              if(!*p){
>> -                if     (!p[-1] && p[1]) return p - 1;
>> -                else if(!p[ 1] && p[2]) return p;
>> +                if      (!p[-1] && ((p[1] >> (f_code-9)) == 1)) return p - 1;
>> +                else if (!p[ 1] && ((p[2] >> (f_code-9)) == 1)) return p;
>
> if the prefix length is > 16  this would do (byte >> 8) == 1 or rather
> 0 == 1
>
> also please make sure the code is tested with a file that does have
> resync markers
>

Thanks for pointing out the flaw in the logic. The prefix length
should be between 16 and 22. Checking for correct number of zeroes
now.

Change tested with a resync marker stream.

Thank you.

Anuj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Check-for-resync-marker-based-on-vop-coding-type.patch
Type: application/octet-stream
Size: 1098 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121009/0f3f131b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-resync-marker-only-when-enabled.patch
Type: application/octet-stream
Size: 2628 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121009/0f3f131b/attachment-0001.obj>


More information about the ffmpeg-devel mailing list