Hi,

On Tue, Jul 5, 2011 at 7:14 AM, Clément Bœsch <[email protected]> wrote:
> On Mon, Jul 04, 2011 at 09:46:12AM -0700, Ronald S. Bultje wrote:
> [...]
>> >
>> > ---
>> >  libavcodec/dv.c |    4 ++--
>> >  1 files changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/libavcodec/dv.c b/libavcodec/dv.c
>> > index d6c49c8..f426d73 100644
>> > --- a/libavcodec/dv.c
>> > +++ b/libavcodec/dv.c
>> > @@ -476,8 +476,8 @@ static int dv_decode_video_segment(AVCodecContext 
>> > *avctx, void *arg)
>> >     GetBitContext gb;
>> >     BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
>> >     LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
>> > -    LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + 4]); /* allow some 
>> > slack */
>> > -    LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5 * 80 + 4]); /* allow some 
>> > slack */
>> > +    LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + 4])     = {0}; /* 
>> > allow some slack */
>> > +    LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5 * 80 + 4]) = {0}; /* 
>> > allow some slack */
>>
>> This is a little redundant, but it's true that each input buffer needs
>> zero padding and this one doesn't. The easiest solution, I think, is
>> to add zero padding (plus add the put_flush_bits()?) at the end after
>> the written bytes (FF_INPUT_BUFFER_PADDING_SIZE or so), s/4/that/ also
>> above) in bit_copy().
>>
>
> Thanks, see attached version, slightly modified from patch proposed by
> Reimar. I confirmed it works here. Also, it's pointless to do it in
> bit_copy, just padding at that moment (when {mb,vs}_bit_buffer are
> completely filled and will start being read) is enough.

That looks pretty good. I think ideally you'd want to zero
FF_INPUT_BUFFER_PADDING_SIZE bytes, but I don't think it matters for
DV in particular because it never overreads by as much. So patch is
OK.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to