diff 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
line wrap: on
line diff
--- a/libmpcodecs/vf_scale.c	Mon Jul 24 10:24:41 2006 +0000
+++ b/libmpcodecs/vf_scale.c	Mon Jul 24 10:36:06 2006 +0000
@@ -28,6 +28,7 @@
     unsigned char* palette;
     int interlaced;
     int noup;
+    int accurate_rnd;
     int query_format_cache[64];
 } vf_priv_dflt = {
   -1,-1,
@@ -219,6 +220,7 @@
     // new swscaler:
     sws_getFlagsAndFilterFromCmdLine(&int_sws_flags, &srcFilter, &dstFilter);
     int_sws_flags|= vf->priv->v_chr_drop << SWS_SRC_V_CHR_DROP_SHIFT;
+    int_sws_flags|= vf->priv->accurate_rnd * SWS_ACCURATE_RND;
     vf->priv->ctx=sws_getContext(width, height >> vf->priv->interlaced,
 	    outfmt,
 		  vf->priv->w, vf->priv->h >> vf->priv->interlaced,
@@ -470,6 +472,7 @@
     vf->priv->w=
     vf->priv->h=-1;
     vf->priv->v_chr_drop=0;
+    vf->priv->accurate_rnd=0;
     vf->priv->param[0]=
     vf->priv->param[1]=SWS_PARAM_DEFAULT;
     vf->priv->palette=NULL;
@@ -612,6 +615,7 @@
   // As we want this option to act on the option struct itself
   {"presize", 0, CONF_TYPE_OBJ_PRESETS, 0, 0, 0, &size_preset},
   {"noup", ST_OFF(noup), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL},
+  {"arnd", ST_OFF(accurate_rnd), CONF_TYPE_FLAG, 0, 0, 1, NULL},
   { NULL, NULL, 0, 0, 0, 0,  NULL }
 };