summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-06 21:15:24 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-03-06 21:15:24 +0000
commit0cde42489742cd277e64847950c7de854579a1fd (patch)
tree138c194efe08b6395d81388d9584cdebe70f5fd9 /libmpcodecs
parentc596f03a8ab95586e7cdf939fe0f2e82453c5ae2 (diff)
downloadmpv-0cde42489742cd277e64847950c7de854579a1fd.tar.bz2
mpv-0cde42489742cd277e64847950c7de854579a1fd.tar.xz
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
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vf_scale.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index 98d1ba89f7..64ac58d0f8 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -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},