Browse Source

avfilter/vf_waveform: remove mirroring from chroma filter

It is not really useful.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
tags/n3.1
Paul B Mahol 9 years ago
parent
commit
29d106e751
1 changed files with 11 additions and 23 deletions
  1. +11
    -23
      libavfilter/vf_waveform.c

+ 11
- 23
libavfilter/vf_waveform.c View File

@@ -1132,12 +1132,10 @@ static void chroma16(WaveformContext *s, AVFrame *in, AVFrame *out,
uint16_t *dst = dst_line; uint16_t *dst = dst_line;


for (y = 0; y < src_h; y++) { 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; 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); update16(target, max, intensity, limit);


c0_data += c0_linesize; c0_data += c0_linesize;
@@ -1154,18 +1152,14 @@ static void chroma16(WaveformContext *s, AVFrame *in, AVFrame *out,
dst_data += s->size - 1; dst_data += s->size - 1;
for (y = 0; y < src_h; y++) { for (y = 0; y < src_h; y++) {
for (x = 0; x < src_w; x++) { 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; uint16_t *target;


if (mirror) { 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); update16(target, max, intensity, limit);
} else { } 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); update16(target, max, intensity, limit);
} }
} }
@@ -1204,12 +1198,10 @@ static void chroma(WaveformContext *s, AVFrame *in, AVFrame *out,
uint8_t *dst = dst_line; uint8_t *dst = dst_line;


for (y = 0; y < src_h; y++) { 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; 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); update(target, max, intensity);


c0_data += c0_linesize; c0_data += c0_linesize;
@@ -1226,18 +1218,14 @@ static void chroma(WaveformContext *s, AVFrame *in, AVFrame *out,
dst_data += s->size - 1; dst_data += s->size - 1;
for (y = 0; y < src_h; y++) { for (y = 0; y < src_h; y++) {
for (x = 0; x < src_w; x++) { 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; uint8_t *target;


if (mirror) { if (mirror) {
target = dst_data - (256 - sum);
update(target, max, intensity);
target = dst_data - (255 + sum);
target = dst_data - sum;
update(target, max, intensity); update(target, max, intensity);
} else { } else {
target = dst_data + (256 - sum);
update(target, max, intensity);
target = dst_data + (255 + sum);
target = dst_data + sum;
update(target, max, intensity); update(target, max, intensity);
} }
} }
@@ -2220,7 +2208,7 @@ static int config_input(AVFilterLink *inlink)
s->waveform = s->bits > 8 ? aflat16 : aflat; s->waveform = s->bits > 8 ? aflat16 : aflat;
break; break;
case CHROMA: case CHROMA:
s->size = 256 * 2;
s->size = 256;
s->waveform = s->bits > 8 ? chroma16 : chroma; s->waveform = s->bits > 8 ? chroma16 : chroma;
break; break;
case ACHROMA: case ACHROMA:


Loading…
Cancel
Save