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

Michael Niedermayer michaelni
Thu Dec 18 23:42:01 CET 2008


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


> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081218/72a759cc/attachment.pgp>



More information about the ffmpeg-devel mailing list