From 154bbcd5b9fcb7bf8f0c96fd698e157b6d9c1106 Mon Sep 17 00:00:00 2001 From: arpi Date: Sat, 9 Mar 2002 19:18:46 +0000 Subject: divx_quality and equalizer support done git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5004 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/TODO | 9 ++++++--- libmpcodecs/vd.h | 1 + libmpcodecs/vd_divx4.c | 29 ++++++++++++++++++++++++++--- libmpcodecs/vd_dshow.c | 16 +++++++++++++--- libmpcodecs/vd_internal.h | 2 ++ libmpcodecs/vd_libmpeg2.c | 2 +- libmpcodecs/vd_odivx.c | 7 ++++--- 7 files changed, 53 insertions(+), 13 deletions(-) diff --git a/libmpcodecs/TODO b/libmpcodecs/TODO index 10cf12678a..a51c59dae5 100644 --- a/libmpcodecs/TODO +++ b/libmpcodecs/TODO @@ -1,15 +1,18 @@ +URGENT: +- add common postprocessing filter support (export qscale array) + TODO: -- equalizer support to divx4, dshow - vo_config callbacks to ffmpeg, cinepak - better mpi support to xanim (now it's EXPORT but could be better) -- fix initial postprocessing flags (divx_quality) -- add common postprocessing filter support (export qscale array) - IP buffering for NUV - finish MPNG (8bpp support) - IPB buffering to libmpeg2 - review authors DONE: +- equalizer support to divx4, dshow +- fix initial postprocessing flags (divx_quality) + #define VFM_CINEPAK 13 #define VFM_QTRPZA 20 #define VFM_FFMPEG 5 diff --git a/libmpcodecs/vd.h b/libmpcodecs/vd.h index cd65f9c1a3..c232751150 100644 --- a/libmpcodecs/vd.h +++ b/libmpcodecs/vd.h @@ -37,6 +37,7 @@ extern vd_functions_t* mpcodecs_vd_drivers[]; #define VDCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */ #define VDCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */ #define VDCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ +#define VDCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ // callbacks: int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt); diff --git a/libmpcodecs/vd_divx4.c b/libmpcodecs/vd_divx4.c index ef84765550..4ee365c852 100644 --- a/libmpcodecs/vd_divx4.c +++ b/libmpcodecs/vd_divx4.c @@ -1,5 +1,6 @@ #include #include +#include #include #include "config.h" @@ -41,6 +42,27 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ decore(0x123,DEC_OPT_SETPP,&dec_set,NULL); return CONTROL_OK; } +#ifdef DECORE_VERSION +#if DECORE_VERSION >= 20011010 + case VDCTRL_SET_EQUALIZER: { + va_list ap; + int value; + int option; + va_start(ap, arg); + value=va_arg(ap, int); + va_end(ap); + + if(!strcmp(arg,"Brightness")) option=DEC_GAMMA_BRIGHTNESS; + else if(!strcmp(arg, "Contrast")) option=DEC_GAMMA_CONTRAST; + else if(!strcmp(arg,"Saturation")) option=DEC_GAMMA_SATURATION; + else return CONTROL_FALSE; + + value = (value * 256) / 100 - 128; + decore(0x123, DEC_OPT_GAMMA, (void *)option, (void *) value); + return CONTROL_OK; + } +#endif +#endif } @@ -50,7 +72,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ // init driver static int init(sh_video_t *sh){ DEC_PARAM dec_param; -// DEC_SET dec_set; + DEC_SET dec_set; int bits=16; memset(&dec_param,0,sizeof(dec_param)); @@ -76,8 +98,9 @@ static int init(sh_video_t *sh){ dec_param.x_dim = sh->disp_w; dec_param.y_dim = sh->disp_h; decore(0x123, DEC_OPT_INIT, &dec_param, NULL); -// dec_set.postproc_level = divx_quality; -// decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); + + dec_set.postproc_level = divx_quality; + decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: DivX4Linux video codec init OK!\n"); diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c index 7b87db0125..b7fa7306b6 100644 --- a/libmpcodecs/vd_dshow.c +++ b/libmpcodecs/vd_dshow.c @@ -1,5 +1,6 @@ #include #include +#include #include "config.h" #ifdef USE_DIRECTSHOW @@ -32,9 +33,17 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ DS_VideoDecoder_SetValue(sh->context,"Quality",*((int*)arg)); return CONTROL_OK; -// TODO: query/set video options (brightness contrast etc) -// DS_VideoDecoder_SetValue(ds_vdec,item,value); - + case VDCTRL_SET_EQUALIZER: { + va_list ap; + int value; + va_start(ap, arg); + value=va_arg(ap, int); + va_end(ap); + if(DS_VideoDecoder_SetValue(sh->context,arg,value)==0) + return CONTROL_OK; + return CONTROL_FALSE; + } + } return CONTROL_UNKNOWN; } @@ -61,6 +70,7 @@ static int init(sh_video_t *sh){ default: DS_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR } + DS_SetAttr_DivX("Quality",divx_quality); DS_VideoDecoder_StartInternal(sh->context); mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n"); return 1; diff --git a/libmpcodecs/vd_internal.h b/libmpcodecs/vd_internal.h index fab858b004..780e2473d1 100644 --- a/libmpcodecs/vd_internal.h +++ b/libmpcodecs/vd_internal.h @@ -8,6 +8,8 @@ #include "vd.h" +extern int divx_quality; + // prototypes: //static vd_info_t info; static int control(sh_video_t *sh,int cmd,void* arg,...); diff --git a/libmpcodecs/vd_libmpeg2.c b/libmpcodecs/vd_libmpeg2.c index c2d5d4e6bd..33e98b43dd 100644 --- a/libmpcodecs/vd_libmpeg2.c +++ b/libmpcodecs/vd_libmpeg2.c @@ -34,7 +34,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ // init driver static int init(sh_video_t *sh){ mpeg2_init(); - picture->pp_options=0; //divx_quality; + picture->pp_options=divx_quality; // send seq header to the decoder: *** HACK *** mpeg2_decode_data(NULL,videobuffer,videobuffer+videobuf_len,0); mpeg2_allocate_image_buffers (picture); diff --git a/libmpcodecs/vd_odivx.c b/libmpcodecs/vd_odivx.c index ddffe95f4b..2a1370cda0 100644 --- a/libmpcodecs/vd_odivx.c +++ b/libmpcodecs/vd_odivx.c @@ -97,7 +97,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ // init driver static int init(sh_video_t *sh){ DEC_PARAM dec_param; -// DEC_SET dec_set; + DEC_SET dec_set; memset(&dec_param,0,sizeof(dec_param)); #ifdef NEW_DECORE dec_param.output_format=DEC_USER; @@ -111,8 +111,9 @@ static int init(sh_video_t *sh){ dec_param.x_dim = sh->disp_w; dec_param.y_dim = sh->disp_h; decore(0x123, DEC_OPT_INIT, &dec_param, NULL); -// dec_set.postproc_level = divx_quality; -// decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); + + dec_set.postproc_level = divx_quality; + decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); -- cgit v1.2.3