Mercurial > mplayer.hg
changeset 2185:c5162871cf2b
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)
author | arpi |
---|---|
date | Sat, 13 Oct 2001 15:36:04 +0000 |
parents | 966ec115c87f |
children | 491d4fc9b6f2 |
files | postproc/postprocess.c postproc/postprocess_template.c |
diffstat | 2 files changed, 104 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/postproc/postprocess.c Sat Oct 13 15:33:13 2001 +0000 +++ b/postproc/postprocess.c Sat Oct 13 15:36:04 2001 +0000 @@ -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;
--- a/postproc/postprocess_template.c Sat Oct 13 15:33:13 2001 +0000 +++ b/postproc/postprocess_template.c Sat Oct 13 15:36:04 2001 +0000 @@ -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;