aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_histogram.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2013-10-02 22:23:54 +0200
committerPaul B Mahol <onemda@gmail.com>2013-10-02 21:02:54 +0000
commit5b5bb0d81c5353f64e142a52ade18db4a6c2f512 (patch)
tree25824d326d80af5165a8a77c95eafd94a159da35 /libavfilter/vf_histogram.c
parent4c292d5c34c9636364bcfb5f2e950c48196d9e9e (diff)
downloadffmpeg-5b5bb0d81c5353f64e142a52ade18db4a6c2f512.tar.gz
avfilter/vf_histogram: fix segfault in parade waveform mode for subsampled formats
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavfilter/vf_histogram.c')
-rw-r--r--libavfilter/vf_histogram.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c
index 273d03b7e1..4bd309f2b2 100644
--- a/libavfilter/vf_histogram.c
+++ b/libavfilter/vf_histogram.c
@@ -183,15 +183,15 @@ static void gen_waveform(HistogramContext *h, AVFrame *inpicref, AVFrame *outpic
int component, int intensity, int offset, int col_mode)
{
const int plane = h->desc->comp[component].plane;
+ const int is_chroma = (component == 1 || component == 2);
+ const int shift_w = (is_chroma ? h->desc->log2_chroma_w : 0);
+ const int shift_h = (is_chroma ? h->desc->log2_chroma_h : 0);
const int src_linesize = inpicref->linesize[plane];
const int dst_linesize = outpicref->linesize[plane];
uint8_t *src_data = inpicref->data[plane];
- uint8_t *dst_data = outpicref->data[plane] + (col_mode ? offset * dst_linesize : offset);
+ uint8_t *dst_data = outpicref->data[plane] + (col_mode ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
uint8_t * const dst_line = dst_data;
const uint8_t max = 255 - intensity;
- const int is_chroma = (component == 1 || component == 2);
- const int shift_w = (is_chroma ? h->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? h->desc->log2_chroma_h : 0);
const int src_h = FF_CEIL_RSHIFT(inpicref->height, shift_h);
const int src_w = FF_CEIL_RSHIFT(inpicref->width, shift_w);
uint8_t *dst, *p;