summaryrefslogtreecommitdiffstats
path: root/postproc
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-13 15:36:04 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-10-13 15:36:04 +0000
commit40dfa00c7db6634b86bf5a14d158808f18909a75 (patch)
treedd80146cc3dd8e48ccdcca160aa916e8d2e90194 /postproc
parent84bf387404abde1317457e3e6f9ded69f3e547ec (diff)
downloadmpv-40dfa00c7db6634b86bf5a14d158808f18909a75.tar.bz2
mpv-40dfa00c7db6634b86bf5a14d158808f18909a75.tar.xz
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) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2186 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'postproc')
-rw-r--r--postproc/postprocess.c63
-rw-r--r--postproc/postprocess_template.c63
2 files changed, 106 insertions, 20 deletions
diff --git a/postproc/postprocess.c b/postproc/postprocess.c
index 9835015566..8e317dc6ab 100644
--- a/postproc/postprocess.c
+++ b/postproc/postprocess.c
@@ -137,7 +137,7 @@ int maxAllowedY=255;
//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 @@ static inline long long rdtsc()
// 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 @@ static inline void prefetcht2(void *p)
: : "r" (p)
);
}
+#endif
//FIXME? |255-0| = 1 (shouldnt be a problem ...)
/**
@@ -1814,8 +1817,13 @@ FIND_MIN_MAX(%%ebx, %1, 2)
#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 @@ void postprocess(unsigned char * src[], int src_stride,
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 @@ void postprocess(unsigned char * src[], int src_stride,
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
- };
-
- return modes[ (quality*6) >>6 ];
+#endif
+ };
+
+#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 @@ SIMPLE_CPY
/**
* 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;
diff --git a/postproc/postprocess_template.c b/postproc/postprocess_template.c
index 9835015566..8e317dc6ab 100644
--- a/postproc/postprocess_template.c
+++ b/postproc/postprocess_template.c
@@ -137,7 +137,7 @@ int maxAllowedY=255;
//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 @@ static inline long long rdtsc()
// 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 @@ static inline void prefetcht2(void *p)
: : "r" (p)
);
}
+#endif
//FIXME? |255-0| = 1 (shouldnt be a problem ...)
/**
@@ -1814,8 +1817,13 @@ FIND_MIN_MAX(%%ebx, %1, 2)
#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 @@ void postprocess(unsigned char * src[], int src_stride,
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 @@ void postprocess(unsigned char * src[], int src_stride,
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
- };
-
- return modes[ (quality*6) >>6 ];
+#endif
+ };
+
+#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 @@ SIMPLE_CPY
/**
* 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;