]> git.sesse.net Git - x264/commitdiff
Fix normalization of colorspace when input is packed YUV 4:2:2
authorAnton Mitrofanov <BugMaster@narod.ru>
Sun, 22 Jan 2012 09:00:23 +0000 (13:00 +0400)
committerFiona Glaser <fiona@x264.com>
Sat, 4 Feb 2012 15:16:28 +0000 (07:16 -0800)
filters/video/resize.c

index c157ef7add10fae7e28c2c306aed34f0faa23873..fd16cfdaad69d61d05e9eea39a6a5683fd0ea4ec 100644 (file)
@@ -153,6 +153,8 @@ static int convert_csp_to_pix_fmt( int csp )
         case X264_CSP_BGRA: return csp&X264_CSP_HIGH_DEPTH ? PIX_FMT_BGRA64    : PIX_FMT_BGRA;
         /* the next csp has no equivalent 16bit depth in swscale */
         case X264_CSP_NV12: return csp&X264_CSP_HIGH_DEPTH ? PIX_FMT_NONE      : PIX_FMT_NV12;
+        /* the next csp is no supported by swscale at all */
+        case X264_CSP_NV16:
         default:            return PIX_FMT_NONE;
     }
 }
@@ -195,9 +197,9 @@ static int pick_closest_supported_csp( int csp )
         if( pix_desc->nb_components == 1 || pix_desc->nb_components == 2 ) // no chroma
             ret = X264_CSP_I420;
         else if( pix_desc->log2_chroma_w && pix_desc->log2_chroma_h ) // reduced chroma width & height
-            ret = (pix_desc->nb_components == pix_number_of_planes( pix_desc )) ? X264_CSP_I420 : X264_CSP_NV12;
+            ret = (pix_number_of_planes( pix_desc ) == 2) ? X264_CSP_NV12 : X264_CSP_I420;
         else if( pix_desc->log2_chroma_w ) // reduced chroma width only
-            ret = (pix_desc->nb_components == pix_number_of_planes( pix_desc )) ? X264_CSP_I422 : X264_CSP_NV16;
+            ret = X264_CSP_I422; // X264_CSP_NV16 is not supported by swscale so don't use it
         else
             ret = X264_CSP_I444;
     }