[MPlayer-dev-eng] [PATCH] altivec_yuv2packedX vs. dstFormat

Alan Curry pacman at theworld.com
Wed Feb 15 22:37:38 CET 2006


Since the last set of patches, altivec_yuv2packedX now supports 6 output
formats rather than just 1, but it still doesn't support as many formats as
yuv2packedXinC. This patch avoids calling altivec_yuv2packedX with a format
that it can't produce, falling back on yuv2packedXinC. To see the difference,
use for example -vf scale=199:-2 -bpp 16 or
-vf scale=199:-2,format=bgr16,scale on an altivec-enabled mplayer.

The patch is in 2 parts to ease readability. The first part is the
substantive change. The second part adjusts the indentation so that it makes
sense again.

-------------- next part --------------
diff -u swscale_template.c swscale_template.c
--- swscale_template.c	15 Feb 2006 06:29:29 -0000
+++ swscale_template.c	15 Feb 2006 05:51:18 -0000
@@ -972,14 +972,14 @@
 		if(c->dstFormat==IMGFMT_ABGR  || c->dstFormat==IMGFMT_BGRA  ||
 		   c->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 ||
 		   c->dstFormat==IMGFMT_RGBA  || c->dstFormat==IMGFMT_ARGB)
-		altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize,
-			    chrFilter, chrSrc, chrFilterSize,
-			    dest, dstW, dstY);
+			altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize,
+				    chrFilter, chrSrc, chrFilterSize,
+				    dest, dstW, dstY);
 		else
 #endif
-		yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
-			    chrFilter, chrSrc, chrFilterSize,
-			    dest, dstW, dstY);
+			yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
+				    chrFilter, chrSrc, chrFilterSize,
+				    dest, dstW, dstY);
 		break;
 	}
 }
-------------- next part --------------
Index: swscale_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_template.c,v
retrieving revision 1.122
diff -u -r1.122 swscale_template.c
--- swscale_template.c	13 Jan 2006 00:23:32 -0000	1.122
+++ swscale_template.c	15 Feb 2006 06:29:29 -0000
@@ -967,14 +967,19 @@
 #endif
 	default:
 #ifdef HAVE_ALTIVEC
+		/* The following list of supported dstFormat values should
+		   match what's found in the body of altivec_yuv2packedX() */
+		if(c->dstFormat==IMGFMT_ABGR  || c->dstFormat==IMGFMT_BGRA  ||
+		   c->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 ||
+		   c->dstFormat==IMGFMT_RGBA  || c->dstFormat==IMGFMT_ARGB)
 		altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize,
 			    chrFilter, chrSrc, chrFilterSize,
 			    dest, dstW, dstY);
-#else
+		else
+#endif
 		yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
 			    chrFilter, chrSrc, chrFilterSize,
 			    dest, dstW, dstY);
-#endif
 		break;
 	}
 }


More information about the MPlayer-dev-eng mailing list