changeset 14169:95dd81b8b9de

conditional lowres: activate lowres if frame width >= threshold
author nicodvb
date Fri, 17 Dec 2004 07:34:23 +0000
parents 2487e4cd67dd
children 36247dd04782
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Fri Dec 17 07:02:28 2004 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Fri Dec 17 07:34:23 2004 +0000
@@ -105,6 +105,7 @@
 static int lavc_param_skip_bottom=0;
 static int lavc_param_fast=0;
 static int lavc_param_lowres=0;
+static char *lavc_param_lowres_str=NULL;
 
 m_option_t lavc_decode_opts_conf[]={
 	{"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 999999, NULL},
@@ -120,7 +121,7 @@
 #ifdef CODEC_FLAG2_FAST
         {"fast", &lavc_param_fast, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG2_FAST, NULL},
 #endif
-	{"lowres", &lavc_param_lowres, CONF_TYPE_INT, CONF_RANGE, 0, 16, NULL},
+	{"lowres", &lavc_param_lowres_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 
@@ -163,6 +164,9 @@
     AVCodecContext *avctx;
     vd_ffmpeg_ctx *ctx;
     AVCodec *lavc_codec;
+#if LIBAVCODEC_BUILD >= 4722
+    int lowres_w=0;
+#endif
     int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
 
     if(!avcodec_inited){
@@ -259,7 +263,13 @@
     avctx->skip_bottom= lavc_param_skip_bottom;
 #endif    
 #if LIBAVCODEC_BUILD >= 4722
-    avctx->lowres= lavc_param_lowres;
+    if(lavc_param_lowres_str != NULL)
+    {
+        sscanf(lavc_param_lowres_str, "%d,%d", &lavc_param_lowres, &lowres_w);
+        if(lavc_param_lowres < 1 || lavc_param_lowres > 16 || (lowres_w > 0 && avctx->width < lowres_w))
+            lavc_param_lowres = 0;
+        avctx->lowres = lavc_param_lowres;
+    }
 #endif    
     mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height);
     /* AVRn stores huffman table in AVI header */