summaryrefslogtreecommitdiff
path: root/libavfilter/vf_waveform.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-03-14 13:02:02 +0100
committerPaul B Mahol <onemda@gmail.com>2016-03-14 13:25:10 +0100
commit29d106e751bea16a8b311d4a05cd32ebdaab8a60 (patch)
tree3fa81808ce1a9b469b1853c814b0132bdaac7b7c /libavfilter/vf_waveform.c
parent9f6e63f6f2f289e429c9354c80c21a9dbcd21d1a (diff)
downloadffmpeg-29d106e751bea16a8b311d4a05cd32ebdaab8a60.tar.gz
avfilter/vf_waveform: remove mirroring from chroma filter
It is not really useful. Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter/vf_waveform.c')
-rw-r--r--libavfilter/vf_waveform.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index 501bda200a..01f0d336a4 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -1132,12 +1132,10 @@ static void chroma16(WaveformContext *s, AVFrame *in, AVFrame *out,
uint16_t *dst = dst_line;
for (y = 0; y < src_h; y++) {
- const int sum = FFMIN(FFABS(c0_data[x] - mid) + FFABS(c1_data[x] - mid), limit);
+ const int sum = FFMIN(FFABS(c0_data[x] - mid) + FFABS(c1_data[x] - mid - 1), limit);
uint16_t *target;
- target = dst + x + dst_signed_linesize * (s->max - sum);
- update16(target, max, intensity, limit);
- target = dst + x + dst_signed_linesize * (s->max + sum);
+ target = dst + x + dst_signed_linesize * sum;
update16(target, max, intensity, limit);
c0_data += c0_linesize;
@@ -1154,18 +1152,14 @@ static void chroma16(WaveformContext *s, AVFrame *in, AVFrame *out,
dst_data += s->size - 1;
for (y = 0; y < src_h; y++) {
for (x = 0; x < src_w; x++) {
- const int sum = FFMIN(FFABS(c0_data[x] - mid) + FFABS(c1_data[x] - mid), limit);
+ const int sum = FFMIN(FFABS(c0_data[x] - mid) + FFABS(c1_data[x] - mid - 1), limit);
uint16_t *target;
if (mirror) {
- target = dst_data - (s->max - sum);
- update16(target, max, intensity, limit);
- target = dst_data - (s->max + sum);
+ target = dst_data - sum;
update16(target, max, intensity, limit);
} else {
- target = dst_data + (s->max - sum);
- update16(target, max, intensity, limit);
- target = dst_data + (s->max + sum);
+ target = dst_data + sum;
update16(target, max, intensity, limit);
}
}
@@ -1204,12 +1198,10 @@ static void chroma(WaveformContext *s, AVFrame *in, AVFrame *out,
uint8_t *dst = dst_line;
for (y = 0; y < src_h; y++) {
- const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 128);
+ const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 127);
uint8_t *target;
- target = dst + x + dst_signed_linesize * (256 - sum);
- update(target, max, intensity);
- target = dst + x + dst_signed_linesize * (255 + sum);
+ target = dst + x + dst_signed_linesize * sum;
update(target, max, intensity);
c0_data += c0_linesize;
@@ -1226,18 +1218,14 @@ static void chroma(WaveformContext *s, AVFrame *in, AVFrame *out,
dst_data += s->size - 1;
for (y = 0; y < src_h; y++) {
for (x = 0; x < src_w; x++) {
- const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 128);
+ const int sum = FFABS(c0_data[x] - 128) + FFABS(c1_data[x] - 127);
uint8_t *target;
if (mirror) {
- target = dst_data - (256 - sum);
- update(target, max, intensity);
- target = dst_data - (255 + sum);
+ target = dst_data - sum;
update(target, max, intensity);
} else {
- target = dst_data + (256 - sum);
- update(target, max, intensity);
- target = dst_data + (255 + sum);
+ target = dst_data + sum;
update(target, max, intensity);
}
}
@@ -2220,7 +2208,7 @@ static int config_input(AVFilterLink *inlink)
s->waveform = s->bits > 8 ? aflat16 : aflat;
break;
case CHROMA:
- s->size = 256 * 2;
+ s->size = 256;
s->waveform = s->bits > 8 ? chroma16 : chroma;
break;
case ACHROMA: