[FFmpeg-devel] [BUG] Theora decoder displays green line

Aurelien Jacobs aurel
Sun May 6 18:54:53 CEST 2007


On Sun, 6 May 2007 17:45:10 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:

> On Sun, May 06, 2007 at 05:23:25PM +0200, Aurelien Jacobs wrote:
> > On Sun, 6 May 2007 17:12:21 +0200
> > Michael Niedermayer <michaelni at gmx.at> wrote:
> > 
> > > Hi
> > > 
> > > On Sun, May 06, 2007 at 02:26:36PM +0200, Diego Biurrun wrote:
> > > > Try the following sample:
> > > > 
> > > > http://mirrors.creativecommons.org/getcreative/Creative_Commons_-_Get_Creative.ogg
> > > > 
> > > > ffplay displays a green line at the bottom (as does MPlayer with lavc
> > > > decoder and lavf demuxer), while MPlayer with native demuxer and
> > > > libtheora decoder works fine.
> > > 
> > > ffmpeg -i output could be usefull
> > 
> > coded size is 400x304, display size should be 400x300.
> > Attached patch fixes this issue.
> > 
> > Aurel
> 
> > Index: libavcodec/vp3.c
> > ===================================================================
> > --- libavcodec/vp3.c	(revision 8918)
> > +++ libavcodec/vp3.c	(working copy)
> > @@ -1950,8 +1950,8 @@
> >          s->version = 1;
> >  
> >      s->avctx = avctx;
> > -    s->width = (avctx->width + 15) & 0xFFFFFFF0;
> > -    s->height = (avctx->height + 15) & 0xFFFFFFF0;
> > +    s->width = (avctx->coded_width + 15) & 0xFFFFFFF0;
> > +    s->height = (avctx->coded_height + 15) & 0xFFFFFFF0;
> >      avctx->pix_fmt = PIX_FMT_YUV420P;
> >      if(avctx->idct_algo==FF_IDCT_AUTO)
> >          avctx->idct_algo=FF_IDCT_VP3;
> > @@ -2385,6 +2385,8 @@
> >  
> >      s->width = get_bits(gb, 16) << 4;
> >      s->height = get_bits(gb, 16) << 4;
> > +    avctx->width = get_bits_long(gb, 24);
> > +    avctx->height = get_bits_long(gb, 24);
> 
> is there anything which ensures that the allocated buffer will
> be large enough for the picture which gets decoded?
> 
> also, avcodec_set_dimensions() should be used
> 
> 
> [...]
> > Index: libavformat/oggparsetheora.c
> > ===================================================================
> > --- libavformat/oggparsetheora.c	(revision 8918)
> > +++ libavformat/oggparsetheora.c	(working copy)
> > @@ -70,13 +70,15 @@
> >              return -1;
> >          }
> >  
> > -        st->codec->width = get_bits(&gb, 16) << 4;
> > -        st->codec->height = get_bits(&gb, 16) << 4;
> > +        st->codec->coded_width = get_bits(&gb, 16) << 4;
> > +        st->codec->coded_height = get_bits(&gb, 16) << 4;
> > +        st->codec->width = get_bits_long(&gb, 24);
> > +        st->codec->height = get_bits_long(&gb, 24);
> 
> coded_width=width unless lowres or other decoder side tricks
> are used
> 
> the allocated buffer always has its w/h rounded up to the next multiple
> of 16 with yv12
> that is coded_width is not the allocated width (see avcodec_align_dimensions)

Ok. It seems my usage of coded_width is wrong.
Now what should be used when the displayed picture is smaller than the
encoded picture ?
I could write a hack setting avctx->width and height to display size and
ensuring that the encoded width/height is equal to the display size rounded
to the next multiple of 16. This would solve current issue, but this don't
look very nice and isn't very versatile.

Aurel




More information about the ffmpeg-devel mailing list