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

Michael Niedermayer michaelni
Thu Nov 19 17:51:30 CET 2009


On Thu, Nov 19, 2009 at 01:37:03AM +0100, Stefano Sabatini wrote:
> 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).

if no code uses NV12 it should be removed (i dont belive this though)
if any code uses NV12 your patch will break it.
either way your patch is wrong, unless by sheer luck the current
code is buggy and your patch fixes that bug. Theres no way both
values for linesize could be accepted by code using it.


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- 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/20091119/03eef404/attachment.pgp>



More information about the ffmpeg-devel mailing list