[Mplayer-cvslog] CVS: main/postproc swscale.c,1.118,1.119 swscale_template.c,1.99,1.100 swscale_internal.h,1.2,1.3 yuv2rgb.c,1.18,1.19 yuv2rgb_mlib.c,1.6,1.7yuv2rgb_template.c,1.14,1.15

Michael Niedermayer CVS michael at mplayerhq.hu
Mon Feb 24 01:12:50 CET 2003


Update of /cvsroot/mplayer/main/postproc
In directory mail:/var/tmp.root/cvs-serv21815

Modified Files:
	swscale.c swscale_template.c swscale_internal.h yuv2rgb.c 
	yuv2rgb_mlib.c yuv2rgb_template.c 
Log Message:
cleanup


Index: swscale.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- swscale.c	23 Feb 2003 22:05:53 -0000	1.118
+++ swscale.c	24 Feb 2003 00:12:30 -0000	1.119
@@ -1764,7 +1764,7 @@
 /**
  * bring pointers in YUV order instead of YVU
  */
-inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
+inline static void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]){
 	if(format == IMGFMT_YV12 || format == IMGFMT_YVU9 
            || format == IMGFMT_444P || format == IMGFMT_422P || format == IMGFMT_411P){
 		sortedP[0]= p[0];
@@ -1797,16 +1797,8 @@
 }
 
 /* unscaled copy like stuff (assumes nearly identical formats) */
-static int simpleCopy(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
-             int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
-
-	int srcStride[3];
-	int dstStride[3];
-	uint8_t *src[3];
-	uint8_t *dst[3];
-
-	sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
-	sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
+static int simpleCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+             int srcSliceH, uint8_t* dst[], int dstStride[]){
 
 	if(isPacked(c->srcFormat))
 	{
@@ -2382,11 +2374,18 @@
 /**
  * swscale warper, so we dont need to export the SwsContext
  */
-int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                           int srcSliceH, uint8_t* dst[], int dstStride[]){
+int sws_scale(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+                           int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
+	int srcStride[3];
+	int dstStride[3];
+	uint8_t *src[3];
+	uint8_t *dst[3];
+
+	sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
+	sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
+//printf("sws: slice %d %d\n", srcSliceY, srcSliceH);
 	return c->swScale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
 }
-//FIXME order YV12/I420 here
 
 /**
  * returns a normalized gaussian curve used to filter stuff

Index: swscale_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_template.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- swscale_template.c	23 Feb 2003 22:05:53 -0000	1.99
+++ swscale_template.c	24 Feb 2003 00:12:30 -0000	1.100
@@ -1585,7 +1585,7 @@
 	{
 		int b=  ((uint32_t*)src)[i]&0xFF;
 		int g= (((uint32_t*)src)[i]>>8)&0xFF;
-		int r=  ((uint32_t*)src)[i]>>16;
+		int r= (((uint32_t*)src)[i]>>16)&0xFF;
 
 		dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
 	}
@@ -1946,7 +1946,7 @@
 	{
 		int r=  ((uint32_t*)src)[i]&0xFF;
 		int g= (((uint32_t*)src)[i]>>8)&0xFF;
-		int b=  ((uint32_t*)src)[i]>>16;
+		int b= (((uint32_t*)src)[i]>>16)&0xFF;
 
 		dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
 	}
@@ -2502,8 +2502,8 @@
    }
 }
 
-static int RENAME(swScale)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
-             int srcSliceH, uint8_t* dstParam[], int dstStrideParam[]){
+static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+             int srcSliceH, uint8_t* dst[], int dstStride[]){
 
 	/* load a few things into local vars to make the code more readable? and faster */
 	const int srcW= c->srcW;
@@ -2548,21 +2548,14 @@
 	int chrBufIndex= c->chrBufIndex;
 	int lastInLumBuf= c->lastInLumBuf;
 	int lastInChrBuf= c->lastInChrBuf;
-	int srcStride[3];
-	int dstStride[3];
-	uint8_t *src[3];
-	uint8_t *dst[3];
 	
-	sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
-	sws_orderYUV(c->dstFormat, dst, dstStride, dstParam, dstStrideParam);
-
 	if(isPacked(c->srcFormat)){
 		src[0]=
 		src[1]=
-		src[2]= srcParam[0];
+		src[2]= src[0];
 		srcStride[0]=
 		srcStride[1]=
-		srcStride[2]= srcStrideParam[0];
+		srcStride[2]= srcStride[0];
 	}
 	srcStride[1]<<= c->vChrDrop;
 	srcStride[2]<<= c->vChrDrop;

Index: swscale_internal.h
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/swscale_internal.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- swscale_internal.h	23 Feb 2003 22:05:53 -0000	1.2
+++ swscale_internal.h	24 Feb 2003 00:12:30 -0000	1.3
@@ -26,6 +26,10 @@
 
 /* this struct should be aligned on at least 32-byte boundary */
 typedef struct SwsContext{
+	/**
+	 *
+	 * Note the src,dst,srcStride,dstStride will be copied, in the sws_scale() warper so they can freely be modified here
+	 */
 	SwsFunc swScale;
 	int srcW, srcH, dstH;
 	int chrSrcW, chrSrcH, chrDstW, chrDstH;
@@ -119,7 +123,6 @@
 } SwsContext;
 //FIXME check init (where 0)
 
-inline void sws_orderYUV(int format, uint8_t * sortedP[], int sortedStride[], uint8_t * p[], int stride[]);
 SwsFunc yuv2rgb_get_func_ptr (SwsContext *c);
 int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation);
 

Index: yuv2rgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/yuv2rgb.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- yuv2rgb.c	23 Feb 2003 22:05:53 -0000	1.18
+++ yuv2rgb.c	24 Feb 2003 00:12:30 -0000	1.19
@@ -262,13 +262,10 @@
 	dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y];
 
 #define PROLOG(func_name, dst_type) \
-static int func_name(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, \
+static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \
              int srcSliceH, uint8_t* dst[], int dstStride[]){\
-    uint8_t *src[3];\
-    int srcStride[3];\
     int y;\
 \
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);\
     if(c->srcFormat == IMGFMT_422P){\
 	srcStride[1] *= 2;\
 	srcStride[2] *= 2;\

Index: yuv2rgb_mlib.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/yuv2rgb_mlib.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- yuv2rgb_mlib.c	23 Feb 2003 22:05:53 -0000	1.6
+++ yuv2rgb_mlib.c	24 Feb 2003 00:12:30 -0000	1.7
@@ -33,12 +33,8 @@
 #include "../libvo/img_format.h" //FIXME try to reduce dependency of such stuff
 #include "swscale.h"
 
-static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, 
+static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 
              int srcSliceH, uint8_t* dst[], int dstStride[]){
-    uint8_t *src[3];
-    int srcStride[3];
-
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
     if(c->srcFormat == IMGFMT_422P){
 	srcStride[1] *= 2;
 	srcStride[2] *= 2;
@@ -51,12 +47,8 @@
     return srcSliceH;
 }
 
-static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, 
+static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 
              int srcSliceH, uint8_t* dst[], int dstStride[]){
-    uint8_t *src[3];
-    int srcStride[3];
-
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
     if(c->srcFormat == IMGFMT_422P){
 	srcStride[1] *= 2;
 	srcStride[2] *= 2;
@@ -69,12 +61,8 @@
     return srcSliceH;
 }
 
-static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY, 
+static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 
              int srcSliceH, uint8_t* dst[], int dstStride[]){
-    uint8_t *src[3];
-    int srcStride[3];
-
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
     if(c->srcFormat == IMGFMT_422P){
 	srcStride[1] *= 2;
 	srcStride[2] *= 2;

Index: yuv2rgb_template.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/yuv2rgb_template.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- yuv2rgb_template.c	23 Feb 2003 22:05:53 -0000	1.14
+++ yuv2rgb_template.c	24 Feb 2003 00:12:30 -0000	1.15
@@ -123,13 +123,10 @@
 		     "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\
 
 
-static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
              int srcSliceH, uint8_t* dst[], int dstStride[]){
-    int srcStride[3];
-    uint8_t *src[3];
     int y, h_size;
 
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
     if(c->srcFormat == IMGFMT_422P){
 	srcStride[1] *= 2;
 	srcStride[2] *= 2;
@@ -221,13 +218,10 @@
     return srcSliceH;
 }
 
-static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
              int srcSliceH, uint8_t* dst[], int dstStride[]){
-    int srcStride[3];
-    uint8_t *src[3];
     int y, h_size;
 
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
     if(c->srcFormat == IMGFMT_422P){
 	srcStride[1] *= 2;
 	srcStride[2] *= 2;
@@ -313,13 +307,10 @@
     return srcSliceH;
 }
 
-static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
              int srcSliceH, uint8_t* dst[], int dstStride[]){
-    int srcStride[3];
-    uint8_t *src[3];
     int y, h_size;
 
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
     if(c->srcFormat == IMGFMT_422P){
 	srcStride[1] *= 2;
 	srcStride[2] *= 2;
@@ -462,13 +453,10 @@
     return srcSliceH;
 }
 
-static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* srcParam[], int srcStrideParam[], int srcSliceY,
+static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
              int srcSliceH, uint8_t* dst[], int dstStride[]){
-    int srcStride[3];
-    uint8_t *src[3];
     int y, h_size;
 
-    sws_orderYUV(c->srcFormat, src, srcStride, srcParam, srcStrideParam);
     if(c->srcFormat == IMGFMT_422P){
 	srcStride[1] *= 2;
 	srcStride[2] *= 2;



More information about the MPlayer-cvslog mailing list