changeset 5003:88481d4b9e0e

divx_quality and equalizer support done
author arpi
date Sat, 09 Mar 2002 19:18:46 +0000
parents 70751bbd6404
children ce6b500c22ae
files libmpcodecs/TODO libmpcodecs/vd.h libmpcodecs/vd_divx4.c libmpcodecs/vd_dshow.c libmpcodecs/vd_internal.h libmpcodecs/vd_libmpeg2.c libmpcodecs/vd_odivx.c
diffstat 7 files changed, 53 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/TODO	Sat Mar 09 17:27:37 2002 +0000
+++ b/libmpcodecs/TODO	Sat Mar 09 19:18:46 2002 +0000
@@ -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
--- a/libmpcodecs/vd.h	Sat Mar 09 17:27:37 2002 +0000
+++ b/libmpcodecs/vd.h	Sat Mar 09 19:18:46 2002 +0000
@@ -37,6 +37,7 @@
 #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);
--- a/libmpcodecs/vd_divx4.c	Sat Mar 09 17:27:37 2002 +0000
+++ b/libmpcodecs/vd_divx4.c	Sat Mar 09 19:18:46 2002 +0000
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 #include <assert.h>
 
 #include "config.h"
@@ -41,6 +42,27 @@
 	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 @@
 // 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 @@
     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");
 
--- a/libmpcodecs/vd_dshow.c	Sat Mar 09 17:27:37 2002 +0000
+++ b/libmpcodecs/vd_dshow.c	Sat Mar 09 19:18:46 2002 +0000
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdarg.h>
 
 #include "config.h"
 #ifdef USE_DIRECTSHOW
@@ -32,9 +33,17 @@
 	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 @@
     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;
--- a/libmpcodecs/vd_internal.h	Sat Mar 09 17:27:37 2002 +0000
+++ b/libmpcodecs/vd_internal.h	Sat Mar 09 19:18:46 2002 +0000
@@ -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,...);
--- a/libmpcodecs/vd_libmpeg2.c	Sat Mar 09 17:27:37 2002 +0000
+++ b/libmpcodecs/vd_libmpeg2.c	Sat Mar 09 19:18:46 2002 +0000
@@ -34,7 +34,7 @@
 // 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);
--- a/libmpcodecs/vd_odivx.c	Sat Mar 09 17:27:37 2002 +0000
+++ b/libmpcodecs/vd_odivx.c	Sat Mar 09 19:18:46 2002 +0000
@@ -97,7 +97,7 @@
 // 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 @@
     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");