[MPlayer-cvslog] r19993 - trunk/libswscale/swscale.c

lucabe subversion at mplayerhq.hu
Wed Sep 27 13:41:36 CEST 2006


Author: lucabe
Date: Wed Sep 27 13:41:36 2006
New Revision: 19993

Modified:
   trunk/libswscale/swscale.c

Log:
Add support for YUVJ formats


Modified: trunk/libswscale/swscale.c
==============================================================================
--- trunk/libswscale/swscale.c	(original)
+++ trunk/libswscale/swscale.c	Wed Sep 27 13:41:36 2006
@@ -1841,6 +1841,23 @@
 	return 0;	
 }
 
+static int handle_jpeg(int *format)
+{
+	switch (*format) {
+		case PIX_FMT_YUVJ420P:
+			*format = PIX_FMT_YUV420P;
+			return 1;
+		case PIX_FMT_YUVJ422P:
+			*format = PIX_FMT_YUV422P;
+			return 1;
+		case PIX_FMT_YUVJ444P:
+			*format = PIX_FMT_YUV444P;
+			return 1;
+		default:
+			return 0;
+	}
+}
+
 SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
                          SwsFilter *srcFilter, SwsFilter *dstFilter, double *param){
 
@@ -1848,6 +1865,7 @@
 	int i;
 	int usesVFilter, usesHFilter;
 	int unscaled, needsDither;
+	int srcRange, dstRange;
 	SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
 #if defined(ARCH_X86) || defined(ARCH_X86_64)
 	if(flags & SWS_CPU_CAPS_MMX)
@@ -1874,6 +1892,9 @@
 		     && (fmt_depth(dstFormat))<24
 		     && ((fmt_depth(dstFormat))<(fmt_depth(srcFormat)) || (!(isRGB(srcFormat) || isBGR(srcFormat))));
 
+	srcRange = handle_jpeg(&srcFormat);
+	dstRange = handle_jpeg(&dstFormat);
+
 	if(!isSupportedIn(srcFormat)) 
 	{
 		MSG_ERR("swScaler: %s is not supported as input format\n", sws_format_name(srcFormat));
@@ -1951,7 +1972,7 @@
 	c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
 	c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
 
-	sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], 0, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, 0, 0, 1<<16, 1<<16); 
+	sws_setColorspaceDetails(c, Inverse_Table_6_9[SWS_CS_DEFAULT], srcRange, Inverse_Table_6_9[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16); 
 
 	/* unscaled special Cases */
 	if(unscaled && !usesHFilter && !usesVFilter)



More information about the MPlayer-cvslog mailing list