Mercurial > mplayer.hg
changeset 14924:7f386d84805f
subtracting 8 from negative w and h rounds the dimension to the closest multiple of 16
author | nicodvb |
---|---|
date | Sun, 06 Mar 2005 21:15:24 +0000 |
parents | 658fc109eefc |
children | 5856882afdd6 |
files | libmpcodecs/vf_scale.c |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vf_scale.c Sun Mar 06 21:10:01 2005 +0000 +++ b/libmpcodecs/vf_scale.c Sun Mar 06 21:15:24 2005 +0000 @@ -112,6 +112,7 @@ unsigned int best=find_best_out(vf); int vo_flags; int int_sws_flags=0; + int round_w=0, round_h=0; SwsFilter *srcFilter, *dstFilter; if(!best){ @@ -143,6 +144,15 @@ } } + if (vf->priv->w < 0 && (-vf->priv->w & 8)) { + vf->priv->w = -(-vf->priv->w & ~8); + round_w = 1; + } + if (vf->priv->h < 0 && (-vf->priv->h & 8)) { + vf->priv->h = -(-vf->priv->h & ~8); + round_h = 1; + } + if (vf->priv->w < -3 || vf->priv->h < -3 || (vf->priv->w < -1 && vf->priv->h < -1)) { // TODO: establish a direct connection to the user's brain @@ -172,6 +182,11 @@ if (vf->priv->h == -2) vf->priv->h = vf->priv->w * d_height / d_width; + if (round_w) + vf->priv->w = ((vf->priv->w + 8) / 16) * 16; + if (round_h) + vf->priv->h = ((vf->priv->h + 8) / 16) * 16; + // calculate the missing parameters: switch(best) { case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */ @@ -579,8 +594,8 @@ #undef ST_OFF #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) static m_option_t vf_opts_fields[] = { - {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-3 ,0, NULL}, - {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-3 ,0, NULL}, + {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL}, + {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL}, {"interlaced", ST_OFF(interlaced), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL}, {"chr-drop", ST_OFF(v_chr_drop), CONF_TYPE_INT, M_OPT_RANGE, 0, 3, NULL}, {"param" , ST_OFF(param[0]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL},