changeset 6708:8058078f1248

support for external pp by divx4. some fixes/cosmetics?
author alex
date Thu, 11 Jul 2002 19:16:30 +0000
parents 3f0c724dac75
children 3b20f07b2c16
files libmpcodecs/vd.h libmpcodecs/vd_divx4.c libmpcodecs/vf.c libmpcodecs/vf_format.c libmpcodecs/vf_scale.c
diffstat 5 files changed, 35 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd.h	Thu Jul 11 19:08:23 2002 +0000
+++ b/libmpcodecs/vd.h	Thu Jul 11 19:16:30 2002 +0000
@@ -26,3 +26,4 @@
 int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt);
 mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
 
+#define VDFLAGS_DROPFRAME 3
--- a/libmpcodecs/vd_divx4.c	Thu Jul 11 19:08:23 2002 +0000
+++ b/libmpcodecs/vd_divx4.c	Thu Jul 11 19:16:30 2002 +0000
@@ -33,9 +33,12 @@
 #include <decore.h>
 #endif
 
+#define USE_DIVX_BUILTIN_PP
+
 // to set/get/query special features/parameters
 static int control(sh_video_t *sh,int cmd,void* arg,...){
     switch(cmd){
+#ifdef USE_DIVX_BUILTIN_PP
     case VDCTRL_QUERY_MAX_PP_LEVEL:
 	return 9; // for divx4linux
     case VDCTRL_SET_PP_LEVEL: {
@@ -46,6 +49,7 @@
 	decore(0x123,DEC_OPT_SETPP,&dec_set,NULL);
 	return CONTROL_OK;
     }
+#endif
 #ifdef DECORE_VERSION
 #if DECORE_VERSION >= 20011010
     case VDCTRL_SET_EQUALIZER: {
@@ -127,8 +131,10 @@
     dec_param.y_dim = sh->disp_h;
     decore(0x123, DEC_OPT_INIT, &dec_param, NULL);
 
+#ifdef USE_DIVX_BUILTIN_PP
     dec_set.postproc_level = divx_quality;
     decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
+#endif
     
     mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: DivX4Linux video codec init OK!\n");
 
@@ -146,12 +152,15 @@
 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
     mp_image_t* mpi;
     DEC_FRAME dec_frame;
+#ifndef USE_DIVX_BUILTIN_PP
+    DEC_FRAME_INFO frameinfo;
+#endif
 
     if(len<=0) return NULL; // skipped frame
 
     dec_frame.length = len;
     dec_frame.bitstream = data;
-    dec_frame.render_flag = (flags&3)?0:1;
+    dec_frame.render_flag = (flags&VDFLAGS_DROPFRAME)?0:1;
 
     mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_PRESERVE | MP_IMGFLAG_ACCEPT_WIDTH,
 	sh->disp_w, sh->disp_h);
@@ -159,16 +168,27 @@
 
     dec_frame.bmp=mpi->planes[0];
     dec_frame.stride=mpi->width;
-    
+
+    decore(0x123,
 #ifndef DEC_OPT_FRAME_311
-    decore(0x123, DEC_OPT_FRAME, &dec_frame, NULL);
+        DEC_OPT_FRAME,
+#else
+	(sh->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME,
+#endif
+	&dec_frame,
+#ifndef USE_DIVX_BUILTIN_PP
+	&frameinfo
 #else
-    decore(0x123, (sh->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL);
+	NULL
+#endif
+    );
+
+#ifndef USE_DIVX_BUILTIN_PP
+    mpi->qscale = frameinfo.quant_store;
+    mpi->qstride = frameinfo.quant_stride;
 #endif
 
     return mpi;
 }
-
 #endif
 #endif
-
--- a/libmpcodecs/vf.c	Thu Jul 11 19:08:23 2002 +0000
+++ b/libmpcodecs/vf.c	Thu Jul 11 19:16:30 2002 +0000
@@ -200,7 +200,7 @@
 		  (mpi->type==MP_IMGTYPE_EXPORT)?"Exporting":
 	          ((mpi->flags&MP_IMGFLAG_DIRECT)?"Direct Rendering":"Allocating"),
 	          mpi->width,mpi->height,mpi->bpp,
-		  (mpi->flags&MP_IMGFLAG_YUV)?"YUV":"RGB",
+		  (mpi->flags&MP_IMGFLAG_YUV)?"YUV":((mpi->flags&MP_IMGFLAG_SWAPPED)?"BGR":"RGB"),
 		  (mpi->flags&MP_IMGFLAG_PLANAR)?"planar":"packed",
 	          mpi->bpp*mpi->width*mpi->height/8);
 	    mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"(imgfmt: %x, planes: %x,%x,%x strides: %d,%d,%d, chroma: %dx%d, shift: h:%d,v:%d)\n",
--- a/libmpcodecs/vf_format.c	Thu Jul 11 19:08:23 2002 +0000
+++ b/libmpcodecs/vf_format.c	Thu Jul 11 19:16:30 2002 +0000
@@ -40,6 +40,11 @@
 	if(!strcasecmp(args,"bgr16")) vf->priv->fmt=IMGFMT_BGR16; else
 	if(!strcasecmp(args,"bgr15")) vf->priv->fmt=IMGFMT_BGR15; else
 	if(!strcasecmp(args,"bgr8")) vf->priv->fmt=IMGFMT_BGR8; else
+	if(!strcasecmp(args,"rgb24")) vf->priv->fmt=IMGFMT_RGB24; else
+	if(!strcasecmp(args,"rgb32")) vf->priv->fmt=IMGFMT_RGB32; else
+	if(!strcasecmp(args,"rgb16")) vf->priv->fmt=IMGFMT_RGB16; else
+	if(!strcasecmp(args,"rgb15")) vf->priv->fmt=IMGFMT_RGB15; else
+	if(!strcasecmp(args,"rgb8")) vf->priv->fmt=IMGFMT_RGB8; else
 	{ printf("Unknown format name: '%s'\n",args);return 0;}
     } else
         vf->priv->fmt=IMGFMT_YUY2;
--- a/libmpcodecs/vf_scale.c	Thu Jul 11 19:08:23 2002 +0000
+++ b/libmpcodecs/vf_scale.c	Thu Jul 11 19:16:30 2002 +0000
@@ -58,8 +58,8 @@
     while(*p){
 	int ret=vf_next_query_format(vf,*p);
 	mp_msg(MSGT_VFILTER,MSGL_V,"scale: query(%s) -> %d\n",vo_format_name(*p),ret&3);
-	if(ret&2){ best=*p; break;} // no conversion -> bingo!
-	if(ret&1 && !best) best=*p; // best with conversion
+	if(ret&VFCAP_CSP_SUPPORTED_BY_HW){ best=*p; break;} // no conversion -> bingo!
+	if(ret&VFCAP_CSP_SUPPORTED && !best) best=*p; // best with conversion
 	++p;
     }
     return best;