From 00b6d88ebf6f7ab22335a578e608311eadfac979 Mon Sep 17 00:00:00 2001 From: nicodvb Date: Fri, 17 Dec 2004 07:34:23 +0000 Subject: conditional lowres: activate lowres if frame width >= threshold git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14170 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_ffmpeg.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 730f3ae8e3..5a7ddfbe9a 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -105,6 +105,7 @@ static int lavc_param_skip_top=0; 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 @@ m_option_t lavc_decode_opts_conf[]={ #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 @@ static int init(sh_video_t *sh){ 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 @@ static int init(sh_video_t *sh){ 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 */ -- cgit v1.2.3