Mercurial > mplayer.hg
comparison libmpcodecs/vf_scale.c @ 19172:bae6c99a99cc
vertical scaler with accurate rounding, some people on doom9 can see +-1 errors
the +-1 issue is limited to >2tap vertical filters, so bilinear upscale was unaffected
the new code is sometime faster sometimes slower but the difference is significant (~20%) so its optional and enabled with arnd=1
author | michael |
---|---|
date | Mon, 24 Jul 2006 10:36:06 +0000 |
parents | 8579acff875e |
children | 46fa785e9026 |
comparison
equal
deleted
inserted
replaced
19171:c525ee7bc300 | 19172:bae6c99a99cc |
---|---|
26 struct SwsContext *ctx; | 26 struct SwsContext *ctx; |
27 struct SwsContext *ctx2; //for interlaced slices only | 27 struct SwsContext *ctx2; //for interlaced slices only |
28 unsigned char* palette; | 28 unsigned char* palette; |
29 int interlaced; | 29 int interlaced; |
30 int noup; | 30 int noup; |
31 int accurate_rnd; | |
31 int query_format_cache[64]; | 32 int query_format_cache[64]; |
32 } vf_priv_dflt = { | 33 } vf_priv_dflt = { |
33 -1,-1, | 34 -1,-1, |
34 0, | 35 0, |
35 {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT}, | 36 {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT}, |
217 if(vf->priv->ctx2)sws_freeContext(vf->priv->ctx2); | 218 if(vf->priv->ctx2)sws_freeContext(vf->priv->ctx2); |
218 | 219 |
219 // new swscaler: | 220 // new swscaler: |
220 sws_getFlagsAndFilterFromCmdLine(&int_sws_flags, &srcFilter, &dstFilter); | 221 sws_getFlagsAndFilterFromCmdLine(&int_sws_flags, &srcFilter, &dstFilter); |
221 int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT; | 222 int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT; |
223 int_sws_flags|= vf->priv->accurate_rnd * SWS_ACCURATE_RND; | |
222 vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced, | 224 vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced, |
223 outfmt, | 225 outfmt, |
224 vf->priv->w, vf->priv->h >> vf->priv->interlaced, | 226 vf->priv->w, vf->priv->h >> vf->priv->interlaced, |
225 best, | 227 best, |
226 int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); | 228 int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); |
468 vf->priv->ctx=NULL; | 470 vf->priv->ctx=NULL; |
469 vf->priv->ctx2=NULL; | 471 vf->priv->ctx2=NULL; |
470 vf->priv->w= | 472 vf->priv->w= |
471 vf->priv->h=-1; | 473 vf->priv->h=-1; |
472 vf->priv->v_chr_drop=0; | 474 vf->priv->v_chr_drop=0; |
475 vf->priv->accurate_rnd=0; | |
473 vf->priv->param[0]= | 476 vf->priv->param[0]= |
474 vf->priv->param[1]=SWS_PARAM_DEFAULT; | 477 vf->priv->param[1]=SWS_PARAM_DEFAULT; |
475 vf->priv->palette=NULL; | 478 vf->priv->palette=NULL; |
476 } // if(!vf->priv) | 479 } // if(!vf->priv) |
477 if(args) sscanf(args, "%d:%d:%d:%lf:%lf", | 480 if(args) sscanf(args, "%d:%d:%d:%lf:%lf", |
610 {"param2", ST_OFF(param[1]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL}, | 613 {"param2", ST_OFF(param[1]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL}, |
611 // Note that here the 2 field is NULL (ie 0) | 614 // Note that here the 2 field is NULL (ie 0) |
612 // As we want this option to act on the option struct itself | 615 // As we want this option to act on the option struct itself |
613 {"presize", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, &size_preset}, | 616 {"presize", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, &size_preset}, |
614 {"noup", ST_OFF(noup), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL}, | 617 {"noup", ST_OFF(noup), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL}, |
618 {"arnd", ST_OFF(accurate_rnd), CONF_TYPE_FLAG, 0, 0, 1, NULL}, | |
615 { NULL, NULL, 0, 0, 0, 0, NULL } | 619 { NULL, NULL, 0, 0, 0, 0, NULL } |
616 }; | 620 }; |
617 | 621 |
618 static m_struct_t vf_opts = { | 622 static m_struct_t vf_opts = { |
619 "scale", | 623 "scale", |