[FFmpeg-devel] [PATCH] Fix linesize computation for NV formats

Stefano Sabatini stefano.sabatini-lala
Thu Nov 19 01:37:03 CET 2009


On date Monday 2009-11-16 01:09:15 +0100, Stefano Sabatini encoded:
> On date Monday 2009-11-16 00:57:25 +0100, Michael Niedermayer encoded:
> > On Sun, Nov 15, 2009 at 11:23:27PM +0100, Stefano Sabatini wrote:
> > > On date Sunday 2009-11-15 17:13:22 +0100, Stefano Sabatini encoded:
> > > > Hi,
> > > > 
> > > > for NV12 and NV21 data[1] contains both the U and V components, so
> > > > its size needs to be multiplied by 2.
> > > > Alternatively we could have:
> > > > linesize[1] = width
> > > > 
> > > > which is equivalent.
> > > > 
> > > > I couldn't find any NV12 samples and libswscale cannot issue that in
> > > > output, so I didn't tested it.
> > > 
> > > That change also requires a corresponding change in ff_fill_pointer(),
> > > so patch updated.
> > > 
> > > I wonder if there is some reason if it has been done like that, it is
> > > done that way since the initial inclusion of NV formats support in
> > > r6115.
> > 
> > ill defer review of this until you claim that you confirmed a bug in
> > a test and that this patch fixes it.
> 
> I don't think this is strictly a bug, but this makes more harder to
> deal with NV12 formats, as linesize[1] has a special value (half the
> size of the data[1] plane linesize) which has to be considered when
> dealing with the format, for example when filling the pointers in
> ff_fill_pointer().
> 
> But I agree that we should at least test the change, has anyone an
> NV12 sample or can suggest how/where to get it?

I can issue NV12 as output using ffmpeg, but then there is no way to
read it since nv12 is not supported as input.

So basically all the code affected by the change is indeed code which
is never used, my patch simply makes the linesize params semantics for
NV formats consistent with that of all the other formats (thus
simplifying the code if we choose to use pixdesc for ff_fill_XXX).

Bonus patch attached.

Regards.
-- 
FFmpeg = Free Fiendish Magical Picky Elegant Gargoyle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-nv-name.patch
Type: text/x-diff
Size: 510 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091119/bf4b3b02/attachment.patch>



More information about the ffmpeg-devel mailing list