[FFmpeg-cvslog] lavfi/smptebars: fix output for subsampled yuv
Paul B Mahol
git at videolan.org
Thu Apr 4 16:35:36 CEST 2013
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Apr 4 12:55:41 2013 +0000| [6a08ccd61da040955ed24c0eb3d24ab4e860852a] | committer: Paul B Mahol
lavfi/smptebars: fix output for subsampled yuv
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a08ccd61da040955ed24c0eb3d24ab4e860852a
---
libavfilter/vsrc_testsrc.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index bc0d3d1..9317f82 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -704,12 +704,13 @@ static void smptebars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
{
TestSourceContext *test = ctx->priv;
FFDrawColor color;
- int r_w, r_h, w_h, p_w, p_h, i, x = 0;
+ int r_w, r_h, w_h, p_w, p_h, i, tmp, x = 0;
+ const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(picref->format);
- r_w = (test->w + 6) / 7;
- r_h = test->h * 2 / 3;
- w_h = test->h * 3 / 4 - r_h;
- p_w = r_w * 5 / 4;
+ r_w = FFALIGN((test->w + 6) / 7, 1 << pixdesc->log2_chroma_w);
+ r_h = FFALIGN(test->h * 2 / 3, 1 << pixdesc->log2_chroma_h);
+ w_h = FFALIGN(test->h * 3 / 4 - r_h, 1 << pixdesc->log2_chroma_h);
+ p_w = FFALIGN(r_w * 5 / 4, 1 << pixdesc->log2_chroma_w);
p_h = test->h - w_h - r_h;
#define DRAW_COLOR(rgba, x, y, w, h) \
@@ -729,14 +730,16 @@ static void smptebars_fill_picture(AVFilterContext *ctx, AVFrame *picref)
x += p_w;
DRAW_COLOR(q_pixel, x, r_h + w_h, p_w, p_h);
x += p_w;
- DRAW_COLOR(black, x, r_h + w_h, 5 * r_w - x, p_h);
- x += 5 * r_w - x;
- DRAW_COLOR(neg4ire, x, r_h + w_h, r_w / 3, p_h);
- x += r_w / 3;
- DRAW_COLOR(black, x, r_h + w_h, r_w / 3, p_h);
- x += r_w / 3;
- DRAW_COLOR(pos4ire, x, r_h + w_h, r_w / 3, p_h);
- x += r_w / 3;
+ tmp = FFALIGN(5 * r_w - x, 1 << pixdesc->log2_chroma_w);
+ DRAW_COLOR(black, x, r_h + w_h, tmp, p_h);
+ x += tmp;
+ tmp = FFALIGN(r_w / 3, 1 << pixdesc->log2_chroma_w);
+ DRAW_COLOR(neg4ire, x, r_h + w_h, tmp, p_h);
+ x += tmp;
+ DRAW_COLOR(black, x, r_h + w_h, tmp, p_h);
+ x += tmp;
+ DRAW_COLOR(pos4ire, x, r_h + w_h, tmp, p_h);
+ x += tmp;
DRAW_COLOR(black, x, r_h + w_h, test->w - x, p_h);
}
More information about the ffmpeg-cvslog
mailing list