subtracting 8 from negative w and h rounds the dimension to the closest multiple of 16

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14925 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb 2005-03-06 21:15:24 +00:00
parent c596f03a8a
commit 0cde424897
1 changed files with 17 additions and 2 deletions

View File

@ -112,6 +112,7 @@ static int config(struct vf_instance_s* vf,
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 @@ static int config(struct vf_instance_s* vf,
}
}
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 @@ static int config(struct vf_instance_s* vf,
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 @@ static m_obj_presets_t size_preset = {
#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},