[FFmpeg-devel] [PATCH] swscale: Fix NV12/NV21 support

Ville Syrjälä syrjala
Wed May 20 21:03:05 CEST 2009


Hi,

NV12/NV21 support is currently broken due to the introduction of
planarCopy. The logic for selecting planarCopy assumes that all
planar YUV formats with the same subsampling factors are compatible.
That is not the case for NV12/NV21. The simple solution is to
never use planarCopy for NV12/NV21.

-- 
Ville Syrj?l?
syrjala at sci.fi
http://www.sci.fi/~syrjala/
-------------- next part --------------
Index: swscale.c
===================================================================
--- swscale.c	(revision 29317)
+++ swscale.c	(working copy)
@@ -2616,7 +2616,9 @@
             || (isGray(dstFormat) && isGray(srcFormat))
             || (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat)
                 && c->chrDstHSubSample == c->chrSrcHSubSample
-                && c->chrDstVSubSample == c->chrSrcVSubSample))
+                && c->chrDstVSubSample == c->chrSrcVSubSample
+                && srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21
+                && dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21))
         {
             if (isPacked(c->srcFormat))
                 c->swScale= packedCopy;



More information about the ffmpeg-devel mailing list