[Mplayer-cvslog] CVS: main/postproc postprocess.c,1.7,1.8

Arpi of Ize arpi at mplayer.dev.hu
Sat Oct 13 17:37:08 CEST 2001


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

Modified Files:
	postprocess.c 
Log Message:
small changes for mplayer integration:
- getModeForQuality -> getPpModeForQuality renamed
- #define POSTPROCESS_H -> NEWPOSTPROCESS_H  (to avoid conflicts)
- added #ifdef'ed code for calling old postprocess (for testing/comparison)
- #ifdef'ed some asm code to allow compilation on non-x86 platforms (untested)



Index: postprocess.c
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/postprocess.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- postprocess.c	13 Oct 2001 11:58:41 -0000	1.7
+++ postprocess.c	13 Oct 2001 15:36:04 -0000	1.8
@@ -137,7 +137,7 @@
 //FIXME can never make a movie´s black brighter (anyone needs that?)
 int minAllowedY=0;
 
-
+#ifdef TIMEING
 static inline long long rdtsc()
 {
 	long long l;
@@ -147,7 +147,9 @@
 //	printf("%d\n", int(l/1000));
 	return l;
 }
+#endif
 
+#ifdef HAVE_MMX2
 static inline void prefetchnta(void *p)
 {
 	asm volatile(	"prefetchnta (%0)\n\t"
@@ -175,6 +177,7 @@
 		: : "r" (p)
 	);
 }
+#endif
 
 //FIXME? |255-0| = 1 (shouldnt be a problem ...)
 /**
@@ -1814,8 +1817,13 @@
 #endif
 }
 
+#ifdef HAVE_ODIVX_POSTPROCESS
+#include "../opendivx/postprocess.h"
+int use_old_pp=0;
+#endif
 
-
+static void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
+	QP_STORE_T QPs[], int QPStride, int isColor, int mode);
 
 /**
  * ...
@@ -1830,7 +1838,17 @@
 					  int mode)
 {
 
-	if(mode<0) mode= getModeForQuality(-mode);
+#ifdef HAVE_ODIVX_POSTPROCESS
+// Note: I could make this shit outside of this file, but it would mean one
+// more function call...
+	if(use_old_pp){
+	    odivx_postprocess(src,src_stride,dst,dst_stride,horizontal_size,vertical_size,QP_store,QP_stride,mode);
+	    return;
+	}
+#endif
+
+	// I'm calling this from dec_video.c:video_set_postprocess()
+	// if(mode<0) mode= getModeForQuality(-mode);
 
 /*
 	long long T= rdtsc();
@@ -1869,21 +1887,46 @@
 		memcpy(dst[2], src[2], src_stride*horizontal_size);
 	}
 }
+
 /**
  * gets the mode flags for a given quality (larger values mean slower but better postprocessing)
- * 0 <= quality < 64
+ * 0 <= quality <= 6
  */
-int getModeForQuality(int quality){
-	int modes[6]= {
+int getPpModeForQuality(int quality){
+	int modes[1+GET_PP_QUALITY_MAX]= {
+		0,
+#if 1
+		// horizontal filters first
+		LUM_H_DEBLOCK,
+		LUM_H_DEBLOCK | LUM_V_DEBLOCK,
+		LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK,
+		LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK,
+		LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK | LUM_DERING,
+		LUM_H_DEBLOCK | LUM_V_DEBLOCK | CHROM_H_DEBLOCK | CHROM_V_DEBLOCK | LUM_DERING | CHROM_DERING
+#else
+		// vertical filters first
 		LUM_V_DEBLOCK,
 		LUM_V_DEBLOCK | LUM_H_DEBLOCK,
 		LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK,
 		LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK,
 		LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK | LUM_DERING,
 		LUM_V_DEBLOCK | LUM_H_DEBLOCK | CHROM_V_DEBLOCK | CHROM_H_DEBLOCK | LUM_DERING | CHROM_DERING
-		};
+#endif
+	};
 
-	return modes[ (quality*6) >>6 ];
+#ifdef HAVE_ODIVX_POSTPROCESS
+	int odivx_modes[1+GET_PP_QUALITY_MAX]= {
+		0,
+		PP_DEBLOCK_Y_H,
+		PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V,
+		PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H,
+		PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V,
+		PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V|PP_DERING_Y,
+		PP_DEBLOCK_Y_H|PP_DEBLOCK_Y_V|PP_DEBLOCK_C_H|PP_DEBLOCK_C_V|PP_DERING_Y|PP_DERING_C
+	};
+	if(use_old_pp) return odivx_modes[quality];
+#endif
+	return modes[quality];
 }
 
 //} // extern "C"
@@ -2010,7 +2053,7 @@
 /**
  * Filters array of bytes (Y or U or V values)
  */
-void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
+static void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
 	QP_STORE_T QPs[], int QPStride, int isColor, int mode)
 {
 	int x,y;




More information about the MPlayer-cvslog mailing list