Fixes #8265
Unified · Split
| @@ -155,10 +155,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 154 unmodified lines | ||
| 155 | 155 | for (plane = 0; plane < rect->nb_planes; ++plane) { |
| 156 | 156 | int hsub = plane == 1 || plane == 2 ? rect->hsub : 0; |
| 157 | 157 | int vsub = plane == 1 || plane == 2 ? rect->vsub : 0; |
| 158 | − int hdiv = 1 << hsub; | |
| 159 | − int vdiv = 1 << vsub; | |
| 160 | − int w = rect->width / hdiv; | |
| 161 | − int h = rect->height / vdiv; | |
| 158 | + int w = AV_CEIL_RSHIFT(rect->width, hsub); | |
| 159 | + int h = AV_CEIL_RSHIFT(rect->height, vsub); | |
| 162 | 160 | int xcenter = rect->cx * w; |
| 163 | 161 | int ycenter = rect->cy * h; |
| 164 | 162 | int k1 = rect->k1 * (1<<24); |