[Mplayer-cvslog] CVS: main/libmpcodecs ve_lavc.c,1.37,1.38 vd_ffmpeg.c,1.68,1.69

Michael Niedermayer CVS michael at mplayerhq.hu
Thu Nov 14 20:27:59 CET 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv6405/libmpcodecs

Modified Files:
	ve_lavc.c vd_ffmpeg.c 
Log Message:
ffhuffyuv


Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- ve_lavc.c	2 Nov 2002 04:56:48 -0000	1.37
+++ ve_lavc.c	14 Nov 2002 19:27:51 -0000	1.38
@@ -92,6 +92,8 @@
 static float lavc_param_p_masking= 0.0;
 static int lavc_param_normalize_aqp= 0;
 static int lavc_param_interlaced_dct= 0;
+static int lavc_param_prediction_method= FF_PRED_LEFT;
+static char *lavc_param_format="YV12";
 
 #include "cfgparser.h"
 
@@ -167,6 +169,10 @@
 #if LIBAVCODEC_BUILD >= 4629
         {"idct", &lavc_param_idct, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
 #endif
+#if LIBAVCODEC_BUILD >= 4639
+        {"pred", &lavc_param_prediction_method, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
+        {"format", &lavc_param_format, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#endif
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 #endif
@@ -341,7 +347,17 @@
 #if LIBAVCODEC_BUILD >= 4627
     if(lavc_param_interlaced_dct) lavc_venc_context->flags|= CODEC_FLAG_INTERLACED_DCT;
 #endif
-
+#if LIBAVCODEC_BUILD >= 4639
+    lavc_venc_context->prediction_method= lavc_param_prediction_method;
+    if(!strcasecmp(lavc_param_format, "YV12"))
+        lavc_venc_context->pix_fmt= PIX_FMT_YUV420P;
+    else if(!strcasecmp(lavc_param_format, "422P"))
+        lavc_venc_context->pix_fmt= PIX_FMT_YUV422P;
+    else{
+        mp_msg(MSGT_MENCODER,MSGL_ERR,"%s is not a supported format\n", lavc_param_format);
+        return 0;
+    }
+#endif
     /* lavc internal 2pass bitrate control */
     switch(lavc_param_vpass){
     case 1: 
@@ -407,6 +423,14 @@
     if(lavc_venc_context->stats_in) free(lavc_venc_context->stats_in);
     lavc_venc_context->stats_in= NULL;
 #endif
+#if LIBAVCODEC_BUILD >= 4639
+    if(lavc_venc_context->bits_per_sample)
+        mux_v->bih->biBitCount= lavc_venc_context->bits_per_sample;
+    if(lavc_venc_context->extradata_size){
+        memcpy(mux_v->bih + 1, lavc_venc_context->extradata, lavc_venc_context->extradata_size);
+        mux_v->bih->biSize= sizeof(BITMAPINFOHEADER) + lavc_venc_context->extradata_size;
+    }
+#endif
     
     return 1;
 }
@@ -421,7 +445,13 @@
     case IMGFMT_YV12:
     case IMGFMT_IYUV:
     case IMGFMT_I420:
-      return VFCAP_CSP_SUPPORTED | VFCAP_ACCEPT_STRIDE;
+        if(!strcasecmp(lavc_param_format, "YV12"))
+            return VFCAP_CSP_SUPPORTED | VFCAP_ACCEPT_STRIDE;
+        break;
+    case IMGFMT_422P:
+        if(!strcasecmp(lavc_param_format, "422P"))
+            return VFCAP_CSP_SUPPORTED | VFCAP_ACCEPT_STRIDE;
+        break;
     }
     return 0;
 }
@@ -486,6 +516,13 @@
 	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+28);
 	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+28;
     }
+    else if (lavc_param_vcodec && !strcasecmp(lavc_param_vcodec, "huffyuv"))
+    {
+    /* XXX: hack: huffyuv needs to store huffman tables (allthough we dunno the size yet ...) */
+	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)+1000);
+	memset(mux_v->bih, 0, sizeof(BITMAPINFOHEADER)+1000);
+	mux_v->bih->biSize=sizeof(BITMAPINFOHEADER)+1000;
+    }
     else
     {
 	mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
@@ -518,6 +555,8 @@
 	mux_v->bih->biCompression = mmioFOURCC('M', 'P', '4', '2');
     else if (!strcasecmp(lavc_param_vcodec, "wmv1"))
 	mux_v->bih->biCompression = mmioFOURCC('W', 'M', 'V', '1');
+    else if (!strcasecmp(lavc_param_vcodec, "huffyuv"))
+	mux_v->bih->biCompression = mmioFOURCC('H', 'F', 'Y', 'U');
     else
 	mux_v->bih->biCompression = mmioFOURCC(lavc_param_vcodec[0],
 		lavc_param_vcodec[1], lavc_param_vcodec[2], lavc_param_vcodec[3]); /* FIXME!!! */

Index: vd_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- vd_ffmpeg.c	8 Nov 2002 18:40:39 -0000	1.68
+++ vd_ffmpeg.c	14 Nov 2002 19:27:51 -0000	1.69
@@ -236,6 +236,7 @@
     if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) &&
 	(sh->format == mmioFOURCC('M','4','S','2') ||
 	 sh->format == mmioFOURCC('M','P','4','S') ||
+	 sh->format == mmioFOURCC('H','F','Y','U') ||
 	 sh->format == mmioFOURCC('W','M','V','2')
          ))
     {
@@ -243,6 +244,10 @@
 	avctx->extradata = malloc(avctx->extradata_size);
 	memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size);
     }
+    
+#if LIBAVCODEC_BUILD >= 4639
+    avctx->bits_per_sample= sh->bih->biBitCount;
+#endif    
 
     /* open it */
     if (avcodec_open(avctx, lavc_codec) < 0) {
@@ -361,12 +366,14 @@
 	case PIX_FMT_YUV410P: ctx->best_csp=IMGFMT_YVU9;break; //svq1
 #endif
 	case PIX_FMT_YUV420P: ctx->best_csp=IMGFMT_YV12;break; //mpegs
-	case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg
+	case PIX_FMT_YUV422P: ctx->best_csp=IMGFMT_422P;break; //mjpeg / huffyuv
 	case PIX_FMT_YUV444P: ctx->best_csp=IMGFMT_444P;break; //???
 #if LIBAVCODEC_BUILD >= 4631
 	case PIX_FMT_YUV411P: ctx->best_csp=IMGFMT_411P;break; //dv ntsc
 #endif
-	case PIX_FMT_YUV422:  ctx->best_csp=IMGFMT_YUY2;break; //???
+	case PIX_FMT_YUV422:  ctx->best_csp=IMGFMT_YUY2;break; //huffyuv perhaps in the future
+	case PIX_FMT_BGR24 :  ctx->best_csp=IMGFMT_BGR24;break; //huffyuv
+	case PIX_FMT_BGRA32:  ctx->best_csp=IMGFMT_BGR32;break; //huffyuv
 	default:
 	    ctx->best_csp=0;
 	}




More information about the MPlayer-cvslog mailing list