[FFmpeg-devel] [PATCH] Add missing input buffer padding to h264/mkv

Alexander Strange astrange
Fri Dec 19 02:26:09 CET 2008


On Dec 18, 2008, at 5:42 PM, Michael Niedermayer wrote:

> On Thu, Dec 18, 2008 at 05:21:40PM -0500, Alexander Strange wrote:
>> This fixes the large number of valgrind warnings I get printed  
>> decoding
>> h264+mkv, by adding input buffer padding where the bitstream  
>> readers need
>> it. No speed change.
>
> [...]
>> Index: libavcodec/h264.c
>> ===================================================================
>> --- libavcodec/h264.c	(revision 16074)
>> +++ libavcodec/h264.c	(working copy)
>> @@ -1406,7 +1406,7 @@
>>     }
>>
>>     bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second  
>> escape buffer for inter data
>> -    h->rbsp_buffer[bufidx]= av_fast_realloc(h- 
>> >rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length);
>> +    h->rbsp_buffer[bufidx]= av_fast_realloc(h- 
>> >rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length 
>> +FF_INPUT_BUFFER_PADDING_SIZE);
>>     dst= h->rbsp_buffer[bufidx];
>>
>>     if (dst == NULL){
>> @@ -1430,6 +1430,8 @@
>>         dst[di++]= src[si++];
>>     }
>>
>> +    memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
>> +
>>     *dst_length= di;
>>     *consumed= si + 1;//+1 for the header
>> //FIXME store exact number of bits in the getbitcontext (it is  
>> needed for decoding)
>
> looks ok

Split and applied.


>> Index: libavformat/matroskadec.c
>> ===================================================================
>> --- libavformat/matroskadec.c	(revision 16074)
>> +++ libavformat/matroskadec.c	(working copy)
>
> i dont maintain that
>
> [...]
> -- 
> Michael     GnuPG fingerprint:  
> 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Breaking DRM is a little like attempting to break through a door even
> though the window is wide open and the only thing in the house is a  
> bunch
> of things you dont want and which you would get tomorrow for free  
> anyway
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel





More information about the ffmpeg-devel mailing list