Mercurial > mplayer.hg
comparison libmpcodecs/vf_scale.c @ 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 | 1fab95e4513c |
children | 7e9403eec2f6 |
comparison
equal
deleted
inserted
replaced
14923:658fc109eefc | 14924:7f386d84805f |
---|---|
110 int width, int height, int d_width, int d_height, | 110 int width, int height, int d_width, int d_height, |
111 unsigned int flags, unsigned int outfmt){ | 111 unsigned int flags, unsigned int outfmt){ |
112 unsigned int best=find_best_out(vf); | 112 unsigned int best=find_best_out(vf); |
113 int vo_flags; | 113 int vo_flags; |
114 int int_sws_flags=0; | 114 int int_sws_flags=0; |
115 int round_w=0, round_h=0; | |
115 SwsFilter *srcFilter, *dstFilter; | 116 SwsFilter *srcFilter, *dstFilter; |
116 | 117 |
117 if(!best){ | 118 if(!best){ |
118 mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n"); | 119 mp_msg(MSGT_VFILTER,MSGL_WARN,"SwScale: no supported outfmt found :(\n"); |
119 return 0; | 120 return 0; |
141 vf->priv->w=d_width; | 142 vf->priv->w=d_width; |
142 vf->priv->h=d_height; | 143 vf->priv->h=d_height; |
143 } | 144 } |
144 } | 145 } |
145 | 146 |
147 if (vf->priv->w < 0 && (-vf->priv->w & 8)) { | |
148 vf->priv->w = -(-vf->priv->w & ~8); | |
149 round_w = 1; | |
150 } | |
151 if (vf->priv->h < 0 && (-vf->priv->h & 8)) { | |
152 vf->priv->h = -(-vf->priv->h & ~8); | |
153 round_h = 1; | |
154 } | |
155 | |
146 if (vf->priv->w < -3 || vf->priv->h < -3 || | 156 if (vf->priv->w < -3 || vf->priv->h < -3 || |
147 (vf->priv->w < -1 && vf->priv->h < -1)) { | 157 (vf->priv->w < -1 && vf->priv->h < -1)) { |
148 // TODO: establish a direct connection to the user's brain | 158 // TODO: establish a direct connection to the user's brain |
149 // and find out what the heck he thinks MPlayer should do | 159 // and find out what the heck he thinks MPlayer should do |
150 // with this nonsense. | 160 // with this nonsense. |
169 | 179 |
170 if (vf->priv->h == -3) | 180 if (vf->priv->h == -3) |
171 vf->priv->h = vf->priv->w * height / width; | 181 vf->priv->h = vf->priv->w * height / width; |
172 if (vf->priv->h == -2) | 182 if (vf->priv->h == -2) |
173 vf->priv->h = vf->priv->w * d_height / d_width; | 183 vf->priv->h = vf->priv->w * d_height / d_width; |
184 | |
185 if (round_w) | |
186 vf->priv->w = ((vf->priv->w + 8) / 16) * 16; | |
187 if (round_h) | |
188 vf->priv->h = ((vf->priv->h + 8) / 16) * 16; | |
174 | 189 |
175 // calculate the missing parameters: | 190 // calculate the missing parameters: |
176 switch(best) { | 191 switch(best) { |
177 case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */ | 192 case IMGFMT_YV12: /* YV12 needs w & h rounded to 2 */ |
178 case IMGFMT_I420: | 193 case IMGFMT_I420: |
577 | 592 |
578 /// Now the options | 593 /// Now the options |
579 #undef ST_OFF | 594 #undef ST_OFF |
580 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) | 595 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) |
581 static m_option_t vf_opts_fields[] = { | 596 static m_option_t vf_opts_fields[] = { |
582 {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-3 ,0, NULL}, | 597 {"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL}, |
583 {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-3 ,0, NULL}, | 598 {"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL}, |
584 {"interlaced", ST_OFF(interlaced), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL}, | 599 {"interlaced", ST_OFF(interlaced), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL}, |
585 {"chr-drop", ST_OFF(v_chr_drop), CONF_TYPE_INT, M_OPT_RANGE, 0, 3, NULL}, | 600 {"chr-drop", ST_OFF(v_chr_drop), CONF_TYPE_INT, M_OPT_RANGE, 0, 3, NULL}, |
586 {"param" , ST_OFF(param[0]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL}, | 601 {"param" , ST_OFF(param[0]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL}, |
587 {"param2", ST_OFF(param[1]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL}, | 602 {"param2", ST_OFF(param[1]), CONF_TYPE_DOUBLE, M_OPT_RANGE, 0.0, 100.0, NULL}, |
588 // Note that here the 2 field is NULL (ie 0) | 603 // Note that here the 2 field is NULL (ie 0) |