[FFmpeg-devel] [PATCH] vc1dec: C need to be cleared if not valid

Michael Niedermayer michaelni at gmx.at
Fri Feb 1 00:55:37 CET 2013


On Wed, Jan 30, 2013 at 01:45:11AM +0100, Michael Niedermayer wrote:
> On Wed, Jan 30, 2013 at 12:36:55AM +0100, Michael Niedermayer wrote:
> > On Tue, Jan 29, 2013 at 11:59:47PM +0100, Sebastian Sandberg wrote:
> > > > do you have a a vc1 video or testcase for which this makes a
> > > > difference ?
> > > 
> > > Yes, I have a bluray copy of Torchwood (BBC interlaced vc-1) which I have
> > > tested against. I have found some other bugs and I also have a B frame path
> > > which seems to work. I'll return with some patches, I'd just need to to
> > > clean it up bit before I send it.
> > 
> > could you upload a small part of this. A part that decodes differently
> > with and without this patch ?
> 
> not needed anymore, carl found a sample that shows a difference.
> The difference is caused due to a incorrect blocks_off value that
> ends up corrupting motion_val[][]
> 
> C[0]/1 should be 0 IMHO at that place already
> 
> the change that fixes the corruption is below, comments about it are
> welcome
> 
> diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
> index 9c0c105..3370f54 100644
> --- a/libavcodec/vc1dec.c
> +++ b/libavcodec/vc1dec.c
> @@ -5674,7 +5674,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data,
>                      continue;
>                  }
>                  v->second_field = 1;
> -                v->blocks_off   = s->mb_width  * s->mb_height << 1;
> +                v->blocks_off   = s->b8_stride * (s->mb_height&~1);
>                  v->mb_off       = s->mb_stride * s->mb_height >> 1;
>              } else {
>                  v->second_field = 0;

patch applied

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130201/3ce05e5a/attachment.asc>


More information about the ffmpeg-devel mailing list