summaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_pixdesctest.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2013-05-16 18:54:28 +0200
committerClément Bœsch <ubitux@gmail.com>2013-06-01 12:05:55 +0200
commit7ba04b3c4835085514580abf4e10136b77505f63 (patch)
tree1bb8856e21d5c6384a7725e97d3175c07167bbad /libavfilter/vf_pixdesctest.c
parent35cf069aeababf85da5b5b81f72e65268a4a1920 (diff)
downloadffmpeg-streaming-7ba04b3c4835085514580abf4e10136b77505f63.zip
ffmpeg-streaming-7ba04b3c4835085514580abf4e10136b77505f63.tar.gz
lavfi/pixdesctest: fix chroma subsampling with odd sizes.
Diffstat (limited to 'libavfilter/vf_pixdesctest.c')
-rw-r--r--libavfilter/vf_pixdesctest.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/libavfilter/vf_pixdesctest.c b/libavfilter/vf_pixdesctest.c
index 55e6e39..89ac7b2 100644
--- a/libavfilter/vf_pixdesctest.c
+++ b/libavfilter/vf_pixdesctest.c
@@ -59,6 +59,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out;
int i, c, w = inlink->w, h = inlink->h;
+ const int cw = FF_CEIL_RSHIFT(w, priv->pix_desc->log2_chroma_w);
+ const int ch = FF_CEIL_RSHIFT(h, priv->pix_desc->log2_chroma_h);
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
@@ -69,12 +71,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
av_frame_copy_props(out, in);
for (i = 0; i < 4; i++) {
- int h = outlink->h;
- h = i == 1 || i == 2 ? h>>priv->pix_desc->log2_chroma_h : h;
+ const int h1 = i == 1 || i == 2 ? ch : h;
if (out->data[i]) {
uint8_t *data = out->data[i] +
- (out->linesize[i] > 0 ? 0 : out->linesize[i] * (h-1));
- memset(data, 0, FFABS(out->linesize[i]) * h);
+ (out->linesize[i] > 0 ? 0 : out->linesize[i] * (h1-1));
+ memset(data, 0, FFABS(out->linesize[i]) * h1);
}
}
@@ -84,8 +85,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
memcpy(out->data[1], in->data[1], AVPALETTE_SIZE);
for (c = 0; c < priv->pix_desc->nb_components; c++) {
- int w1 = c == 1 || c == 2 ? w>>priv->pix_desc->log2_chroma_w : w;
- int h1 = c == 1 || c == 2 ? h>>priv->pix_desc->log2_chroma_h : h;
+ const int w1 = c == 1 || c == 2 ? cw : w;
+ const int h1 = c == 1 || c == 2 ? ch : h;
for (i = 0; i < h1; i++) {
av_read_image_line(priv->line,
OpenPOWER on IntegriCloud