comparison libmpcodecs/vd_ffmpeg.c @ 14169:95dd81b8b9de

conditional lowres: activate lowres if frame width >= threshold
author nicodvb
date Fri, 17 Dec 2004 07:34:23 +0000
parents a7a4c4af4d83
children 0c10f923746e
comparison
equal deleted inserted replaced
14168:2487e4cd67dd 14169:95dd81b8b9de
103 static int lavc_param_vismv=0; 103 static int lavc_param_vismv=0;
104 static int lavc_param_skip_top=0; 104 static int lavc_param_skip_top=0;
105 static int lavc_param_skip_bottom=0; 105 static int lavc_param_skip_bottom=0;
106 static int lavc_param_fast=0; 106 static int lavc_param_fast=0;
107 static int lavc_param_lowres=0; 107 static int lavc_param_lowres=0;
108 static char *lavc_param_lowres_str=NULL;
108 109
109 m_option_t lavc_decode_opts_conf[]={ 110 m_option_t lavc_decode_opts_conf[]={
110 {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 999999, NULL}, 111 {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 999999, NULL},
111 {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, 112 {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
112 {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL}, 113 {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL},
118 {"st", &lavc_param_skip_top, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL}, 119 {"st", &lavc_param_skip_top, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
119 {"sb", &lavc_param_skip_bottom, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL}, 120 {"sb", &lavc_param_skip_bottom, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
120 #ifdef CODEC_FLAG2_FAST 121 #ifdef CODEC_FLAG2_FAST
121 {"fast", &lavc_param_fast, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG2_FAST, NULL}, 122 {"fast", &lavc_param_fast, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG2_FAST, NULL},
122 #endif 123 #endif
123 {"lowres", &lavc_param_lowres, CONF_TYPE_INT, CONF_RANGE, 0, 16, NULL}, 124 {"lowres", &lavc_param_lowres_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
124 {NULL, NULL, 0, 0, 0, 0, NULL} 125 {NULL, NULL, 0, 0, 0, 0, NULL}
125 }; 126 };
126 127
127 // to set/get/query special features/parameters 128 // to set/get/query special features/parameters
128 static int control(sh_video_t *sh,int cmd,void* arg,...){ 129 static int control(sh_video_t *sh,int cmd,void* arg,...){
161 // init driver 162 // init driver
162 static int init(sh_video_t *sh){ 163 static int init(sh_video_t *sh){
163 AVCodecContext *avctx; 164 AVCodecContext *avctx;
164 vd_ffmpeg_ctx *ctx; 165 vd_ffmpeg_ctx *ctx;
165 AVCodec *lavc_codec; 166 AVCodec *lavc_codec;
167 #if LIBAVCODEC_BUILD >= 4722
168 int lowres_w=0;
169 #endif
166 int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP)); 170 int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
167 171
168 if(!avcodec_inited){ 172 if(!avcodec_inited){
169 avcodec_init(); 173 avcodec_init();
170 avcodec_register_all(); 174 avcodec_register_all();
257 #if LIBAVCODEC_BUILD >= 4717 261 #if LIBAVCODEC_BUILD >= 4717
258 avctx->skip_top = lavc_param_skip_top; 262 avctx->skip_top = lavc_param_skip_top;
259 avctx->skip_bottom= lavc_param_skip_bottom; 263 avctx->skip_bottom= lavc_param_skip_bottom;
260 #endif 264 #endif
261 #if LIBAVCODEC_BUILD >= 4722 265 #if LIBAVCODEC_BUILD >= 4722
262 avctx->lowres= lavc_param_lowres; 266 if(lavc_param_lowres_str != NULL)
267 {
268 sscanf(lavc_param_lowres_str, "%d,%d", &lavc_param_lowres, &lowres_w);
269 if(lavc_param_lowres < 1 || lavc_param_lowres > 16 || (lowres_w > 0 && avctx->width < lowres_w))
270 lavc_param_lowres = 0;
271 avctx->lowres = lavc_param_lowres;
272 }
263 #endif 273 #endif
264 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); 274 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height);
265 /* AVRn stores huffman table in AVI header */ 275 /* AVRn stores huffman table in AVI header */
266 /* Pegasus MJPEG stores it also in AVI header, but it uses the common 276 /* Pegasus MJPEG stores it also in AVI header, but it uses the common
267 MJPG fourcc :( */ 277 MJPG fourcc :( */