From 1fb52bf9207689f35b2b5ba58b9938d25df9c82e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= <ubitux@gmail.com>
Date: Thu, 16 May 2013 18:58:35 +0200
Subject: [PATCH] lavfi/mptestsrc: fix chroma subsampling with odd sizes.

This makes no difference in practice since w & h are hardcoded to 512.
---
 libavfilter/vsrc_mptestsrc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index e931c768428..fe071402ab4 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -301,7 +301,8 @@ static int request_frame(AVFilterLink *outlink)
 {
     MPTestContext *test = outlink->src->priv;
     AVFrame *picref;
-    int w = WIDTH, h = HEIGHT, cw = w>>test->hsub, ch = h>>test->vsub;
+    int w = WIDTH, h = HEIGHT,
+        cw = FF_CEIL_RSHIFT(w, test->hsub), ch = FF_CEIL_RSHIFT(h, test->vsub);
     unsigned int frame = test->frame_nb;
     enum test_type tt = test->test;
     int i;
-- 
GitLab