aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-03-06 12:01:20 +0100
committerPaul B Mahol <onemda@gmail.com>2016-03-06 16:48:05 +0100
commit5451be50a89d4aaa0b46229ea80ab22bf12e1e96 (patch)
treeb95a1cb1fcdc213992253c1bc6a654e2bd535967
parent247fe3e494ca0f31c8ea56f54b11cf947acc4089 (diff)
downloadffmpeg-5451be50a89d4aaa0b46229ea80ab22bf12e1e96.tar.gz
avfilter/vf_waveform: use nonsubsampled yuv output format for lowpass filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavfilter/vf_waveform.c258
-rw-r--r--tests/ref/fate/filter-waveform_column100
-rw-r--r--tests/ref/fate/filter-waveform_envelope100
-rw-r--r--tests/ref/fate/filter-waveform_row100
-rw-r--r--tests/ref/fate/filter-waveform_uv100
5 files changed, 370 insertions, 288 deletions
diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index c5a7ae9f11..92d6edd655 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -109,7 +109,7 @@ static const AVOption waveform_options[] = {
AVFILTER_DEFINE_CLASS(waveform);
-static const enum AVPixelFormat lowpass_pix_fmts[] = {
+static const enum AVPixelFormat in_lowpass_pix_fmts[] = {
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12,
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
@@ -127,6 +127,51 @@ static const enum AVPixelFormat lowpass_pix_fmts[] = {
AV_PIX_FMT_NONE
};
+static const enum AVPixelFormat out_rgb8_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_rgb9_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_GBRP9,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_rgb10_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_GBRP10,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_rgb12_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_GBRP12,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_yuv8_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVA444P,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_yuv9_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_YUV444P9, AV_PIX_FMT_YUVA444P9,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_yuv10_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUVA444P10,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_yuv12_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_YUV444P12,
+ AV_PIX_FMT_NONE
+};
+
+static const enum AVPixelFormat out_gray8_lowpass_pix_fmts[] = {
+ AV_PIX_FMT_GRAY8,
+ AV_PIX_FMT_NONE
+};
+
static const enum AVPixelFormat flat_pix_fmts[] = {
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE
};
@@ -144,21 +189,73 @@ static int query_formats(AVFilterContext *ctx)
{
WaveformContext *s = ctx->priv;
AVFilterFormats *fmts_list;
+ const enum AVPixelFormat *out_pix_fmts;
const enum AVPixelFormat *pix_fmts;
+ const AVPixFmtDescriptor *desc;
+ AVFilterFormats *avff;
+ int depth, rgb, i, ret, ncomp;
+
+ if (s->filter != LOWPASS) {
+ switch (s->filter) {
+ case FLAT:
+ case AFLAT:
+ case CHROMA:
+ case ACHROMA: pix_fmts = flat_pix_fmts; break;
+ case COLOR: pix_fmts = color_pix_fmts; break;
+ }
- switch (s->filter) {
- case LOWPASS: pix_fmts = lowpass_pix_fmts; break;
- case FLAT:
- case AFLAT:
- case CHROMA:
- case ACHROMA: pix_fmts = flat_pix_fmts; break;
- case COLOR: pix_fmts = color_pix_fmts; break;
+ fmts_list = ff_make_format_list(pix_fmts);
+ if (!fmts_list)
+ return AVERROR(ENOMEM);
+ return ff_set_common_formats(ctx, fmts_list);
}
- fmts_list = ff_make_format_list(pix_fmts);
- if (!fmts_list)
- return AVERROR(ENOMEM);
- return ff_set_common_formats(ctx, fmts_list);
+ if (!ctx->inputs[0]->in_formats ||
+ !ctx->inputs[0]->in_formats->nb_formats) {
+ return AVERROR(EAGAIN);
+ }
+
+ if (!ctx->inputs[0]->out_formats) {
+ if ((ret = ff_formats_ref(ff_make_format_list(in_lowpass_pix_fmts), &ctx->inputs[0]->out_formats)) < 0)
+ return ret;
+ }
+
+ avff = ctx->inputs[0]->in_formats;
+ desc = av_pix_fmt_desc_get(avff->formats[0]);
+ ncomp = desc->nb_components;
+ rgb = desc->flags & AV_PIX_FMT_FLAG_RGB;
+ depth = desc->comp[0].depth;
+ for (i = 1; i < avff->nb_formats; i++) {
+ desc = av_pix_fmt_desc_get(avff->formats[i]);
+ if (rgb != (desc->flags & AV_PIX_FMT_FLAG_RGB) ||
+ depth != desc->comp[0].depth)
+ return AVERROR(EAGAIN);
+ }
+
+ if (ncomp == 1 && depth == 8)
+ out_pix_fmts = out_gray8_lowpass_pix_fmts;
+ else if (rgb && depth == 8 && ncomp > 2)
+ out_pix_fmts = out_rgb8_lowpass_pix_fmts;
+ else if (rgb && depth == 9 && ncomp > 2)
+ out_pix_fmts = out_rgb9_lowpass_pix_fmts;
+ else if (rgb && depth == 10 && ncomp > 2)
+ out_pix_fmts = out_rgb10_lowpass_pix_fmts;
+ else if (rgb && depth == 12 && ncomp > 2)
+ out_pix_fmts = out_rgb12_lowpass_pix_fmts;
+ else if (depth == 8 && ncomp > 2)
+ out_pix_fmts = out_yuv8_lowpass_pix_fmts;
+ else if (depth == 9 && ncomp > 2)
+ out_pix_fmts = out_yuv9_lowpass_pix_fmts;
+ else if (depth == 10 && ncomp > 2)
+ out_pix_fmts = out_yuv10_lowpass_pix_fmts;
+ else if (depth == 12 && ncomp > 2)
+ out_pix_fmts = out_yuv12_lowpass_pix_fmts;
+ else
+ return AVERROR(EAGAIN);
+ if ((ret = ff_formats_ref(ff_make_format_list(out_pix_fmts), &ctx->outputs[0]->in_formats)) < 0)
+ return ret;
+
+ return 0;
}
static void envelope_instant16(WaveformContext *s, AVFrame *out, int plane, int component)
@@ -166,11 +263,8 @@ static void envelope_instant16(WaveformContext *s, AVFrame *out, int plane, int
const int dst_linesize = out->linesize[component] / 2;
const int bg = s->bg_color[component] * (s->max / 256);
const int limit = s->max - 1;
- const int is_chroma = (component == 1 || component == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
- const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
- const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
+ const int dst_h = out->height;
+ const int dst_w = out->width;
const int start = s->estart[plane];
const int end = s->eend[plane];
uint16_t *dst;
@@ -216,11 +310,8 @@ static void envelope_instant(WaveformContext *s, AVFrame *out, int plane, int co
{
const int dst_linesize = out->linesize[component];
const uint8_t bg = s->bg_color[component];
- const int is_chroma = (component == 1 || component == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
- const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
- const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
+ const int dst_h = out->height;
+ const int dst_w = out->width;
const int start = s->estart[plane];
const int end = s->eend[plane];
uint8_t *dst;
@@ -267,11 +358,8 @@ static void envelope_peak16(WaveformContext *s, AVFrame *out, int plane, int com
const int dst_linesize = out->linesize[component] / 2;
const int bg = s->bg_color[component] * (s->max / 256);
const int limit = s->max - 1;
- const int is_chroma = (component == 1 || component == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
- const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
- const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
+ const int dst_h = out->height;
+ const int dst_w = out->width;
const int start = s->estart[plane];
const int end = s->eend[plane];
int *emax = s->emax[plane][component];
@@ -339,11 +427,8 @@ static void envelope_peak(WaveformContext *s, AVFrame *out, int plane, int compo
{
const int dst_linesize = out->linesize[component];
const int bg = s->bg_color[component];
- const int is_chroma = (component == 1 || component == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
- const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
- const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
+ const int dst_h = out->height;
+ const int dst_w = out->width;
const int start = s->estart[plane];
const int end = s->eend[plane];
int *emax = s->emax[plane][component];
@@ -461,14 +546,15 @@ static void lowpass16(WaveformContext *s, AVFrame *in, AVFrame *out,
const int src_h = AV_CEIL_RSHIFT(in->height, shift_h);
const int src_w = AV_CEIL_RSHIFT(in->width, shift_w);
const uint16_t *src_data = (const uint16_t *)in->data[plane];
- uint16_t *dst_data = (uint16_t *)out->data[plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
- uint16_t * const dst_bottom_line = dst_data + dst_linesize * ((s->size >> shift_h) - 1);
+ uint16_t *dst_data = (uint16_t *)out->data[plane] + (column ? offset * dst_linesize : offset);
+ uint16_t * const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
uint16_t * const dst_line = (mirror ? dst_bottom_line : dst_data);
+ const int step = column ? 1 << shift_w : 1 << shift_h;
const uint16_t *p;
int y;
if (!column && mirror)
- dst_data += s->size >> shift_w;
+ dst_data += s->size;
for (y = 0; y < src_h; y++) {
const uint16_t *src_data_end = src_data + src_w;
@@ -476,20 +562,27 @@ static void lowpass16(WaveformContext *s, AVFrame *in, AVFrame *out,
for (p = src_data; p < src_data_end; p++) {
uint16_t *target;
- int v = FFMIN(*p, limit);
+ int i = 0, v = FFMIN(*p, limit);
if (column) {
- target = dst++ + dst_signed_linesize * (v >> shift_h);
+ do {
+ target = dst++ + dst_signed_linesize * v;
+ update16(target, max, intensity, limit);
+ } while (++i < step);
} else {
- if (mirror)
- target = dst_data - (v >> shift_w) - 1;
- else
- target = dst_data + (v >> shift_w);
+ uint16_t *row = dst_data;
+ do {
+ if (mirror)
+ target = row - v - 1;
+ else
+ target = row + v;
+ update16(target, max, intensity, limit);
+ row += dst_linesize;
+ } while (++i < step);
}
- update16(target, max, intensity, limit);
}
src_data += src_linesize;
- dst_data += dst_linesize;
+ dst_data += dst_linesize * step;
}
envelope16(s, out, plane, plane);
@@ -510,33 +603,42 @@ static void lowpass(WaveformContext *s, AVFrame *in, AVFrame *out,
const int src_h = AV_CEIL_RSHIFT(in->height, shift_h);
const int src_w = AV_CEIL_RSHIFT(in->width, shift_w);
const uint8_t *src_data = in->data[plane];
- uint8_t *dst_data = out->data[plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
- uint8_t * const dst_bottom_line = dst_data + dst_linesize * ((s->size >> shift_h) - 1);
+ uint8_t *dst_data = out->data[plane] + (column ? offset * dst_linesize : offset);
+ uint8_t * const dst_bottom_line = dst_data + dst_linesize * (s->size - 1);
uint8_t * const dst_line = (mirror ? dst_bottom_line : dst_data);
+ const int step = column ? 1 << shift_w : 1 << shift_h;
const uint8_t *p;
int y;
if (!column && mirror)
- dst_data += s->size >> shift_w;
+ dst_data += s->size;
for (y = 0; y < src_h; y++) {
const uint8_t *src_data_end = src_data + src_w;
uint8_t *dst = dst_line;
for (p = src_data; p < src_data_end; p++) {
+ int i = 0;
uint8_t *target;
if (column) {
- target = dst++ + dst_signed_linesize * (*p >> shift_h);
+ do {
+ target = dst++ + dst_signed_linesize * *p;
+ update(target, max, intensity);
+ } while (++i < step);
} else {
- if (mirror)
- target = dst_data - (*p >> shift_w) - 1;
- else
- target = dst_data + (*p >> shift_w);
+ uint8_t *row = dst_data;
+ do {
+ if (mirror)
+ target = row - *p - 1;
+ else
+ target = row + *p;
+ update(target, max, intensity);
+ row += dst_linesize;
+ } while (++i < step);
}
- update(target, max, intensity);
}
src_data += src_linesize;
- dst_data += dst_linesize;
+ dst_data += dst_linesize * step;
}
envelope(s, out, plane, plane);
@@ -1149,15 +1251,12 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
continue;
for (p = 0; p < s->ncomp; p++) {
- const int is_chroma = (p == 1 || p == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
const int v = green_yuva_color[p];
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]); l++) {
int x = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]);
- uint8_t *dst = out->data[p] + (x >> shift_w);
+ uint8_t *dst = out->data[p] + x;
- blend_vline(dst, out->height >> shift_h, out->linesize[p], o1, o2, v);
+ blend_vline(dst, out->height, out->linesize[p], o1, o2, v);
}
}
@@ -1177,15 +1276,12 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
continue;
for (p = 0; p < s->ncomp; p++) {
- const int is_chroma = (p == 1 || p == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
const int v = green_yuva_color[p] * mult;
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]); l++) {
int x = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]) * mult;
- uint16_t *dst = (uint16_t *)(out->data[p]) + (x >> shift_w);
+ uint16_t *dst = (uint16_t *)(out->data[p]) + x;
- blend_vline16(dst, out->height >> shift_h, out->linesize[p], o1, o2, v);
+ blend_vline16(dst, out->height, out->linesize[p], o1, o2, v);
}
}
@@ -1204,15 +1300,12 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
continue;
for (p = 0; p < s->ncomp; p++) {
- const int is_chroma = (p == 1 || p == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
const int v = green_yuva_color[p];
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]); l++) {
int y = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]);
- uint8_t *dst = out->data[p] + (y >> shift_h) * out->linesize[p];
+ uint8_t *dst = out->data[p] + y * out->linesize[p];
- blend_hline(dst, out->width >> shift_w, o1, o2, v);
+ blend_hline(dst, out->width, o1, o2, v);
}
}
@@ -1232,15 +1325,12 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
continue;
for (p = 0; p < s->ncomp; p++) {
- const int is_chroma = (p == 1 || p == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
const int v = green_yuva_color[p] * mult;
for (l = 0; l < FF_ARRAY_ELEMS(lines[0]); l++) {
int y = offset + (s->mirror ? 255 - lines[c][l] : lines[c][l]) * mult;
- uint16_t *dst = (uint16_t *)(out->data[p] + (y >> shift_h) * out->linesize[p]);
+ uint16_t *dst = (uint16_t *)(out->data[p] + y * out->linesize[p]);
- blend_hline16(dst, out->width >> shift_w, o1, o2, v);
+ blend_hline16(dst, out->width, o1, o2, v);
}
}
@@ -1309,7 +1399,7 @@ static int config_output(AVFilterLink *outlink)
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = ctx->inputs[0];
WaveformContext *s = ctx->priv;
- int comp = 0, i, j = 0, k, p, size, shift;
+ int comp = 0, i, j = 0, k, p, size;
for (i = 0; i < s->ncomp; i++) {
if ((1 << i) & s->pcomp)
@@ -1331,25 +1421,20 @@ static int config_output(AVFilterLink *outlink)
return AVERROR(ENOMEM);
for (p = 0; p < s->ncomp; p++) {
- const int is_chroma = (p == 1 || p == 2);
- const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
- const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
const int plane = s->desc->comp[p].plane;
int offset;
if (!((1 << p) & s->pcomp))
continue;
- shift = s->mode ? shift_h : shift_w;
-
for (k = 0; k < 4; k++) {
s->emax[plane][k] = s->peak + size * (plane * 4 + k + 0);
s->emin[plane][k] = s->peak + size * (plane * 4 + k + 16);
}
offset = j++ * s->size * s->display;
- s->estart[plane] = offset >> shift;
- s->eend[plane] = (offset + s->size - 1) >> shift;
+ s->estart[plane] = offset;
+ s->eend[plane] = (offset + s->size - 1);
for (i = 0; i < size; i++) {
for (k = 0; k < 4; k++) {
s->emax[plane][k][i] = s->estart[plane];
@@ -1379,20 +1464,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out->pts = in->pts;
for (k = 0; k < s->ncomp; k++) {
- const int is_chroma = (k == 1 || k == 2);
- const int dst_h = AV_CEIL_RSHIFT(outlink->h, (is_chroma ? s->desc->log2_chroma_h : 0));
- const int dst_w = AV_CEIL_RSHIFT(outlink->w, (is_chroma ? s->desc->log2_chroma_w : 0));
if (s->bits <= 8) {
- for (i = 0; i < dst_h ; i++)
+ for (i = 0; i < outlink->h ; i++)
memset(out->data[s->desc->comp[k].plane] +
i * out->linesize[s->desc->comp[k].plane],
- s->bg_color[k], dst_w);
+ s->bg_color[k], outlink->w);
} else {
const int mult = s->size / 256;
uint16_t *dst = (uint16_t *)out->data[s->desc->comp[k].plane];
- for (i = 0; i < dst_h ; i++) {
- for (j = 0; j < dst_w; j++)
+ for (i = 0; i < outlink->h ; i++) {
+ for (j = 0; j < outlink->w; j++)
dst[j] = s->bg_color[k] * mult;
dst += out->linesize[s->desc->comp[k].plane] / 2;
}
diff --git a/tests/ref/fate/filter-waveform_column b/tests/ref/fate/filter-waveform_column
index 0222f33afe..5e66db89aa 100644
--- a/tests/ref/fate/filter-waveform_column
+++ b/tests/ref/fate/filter-waveform_column
@@ -1,51 +1,51 @@
#tb 0: 1/25
-0, 0, 0, 1, 135168, 0xef68cdfa
-0, 1, 1, 1, 135168, 0x3db0cdfa
-0, 2, 2, 1, 135168, 0xd5e6cdfa
-0, 3, 3, 1, 135168, 0x7f71cdfa
-0, 4, 4, 1, 135168, 0x9df7cdfa
-0, 5, 5, 1, 135168, 0xff48cdfa
-0, 6, 6, 1, 135168, 0xb46acdfa
-0, 7, 7, 1, 135168, 0x485acdfa
-0, 8, 8, 1, 135168, 0x8be2cdfa
-0, 9, 9, 1, 135168, 0x86dbcdfa
-0, 10, 10, 1, 135168, 0xdecacdfa
-0, 11, 11, 1, 135168, 0x29a3cdfa
-0, 12, 12, 1, 135168, 0x04c5cdfa
-0, 13, 13, 1, 135168, 0x5f2ccdfa
-0, 14, 14, 1, 135168, 0x9680cdfa
-0, 15, 15, 1, 135168, 0xe397cdfa
-0, 16, 16, 1, 135168, 0xa40ecdfa
-0, 17, 17, 1, 135168, 0x5f35cdfa
-0, 18, 18, 1, 135168, 0x32fbcdfa
-0, 19, 19, 1, 135168, 0x983dcdfa
-0, 20, 20, 1, 135168, 0xb67dcdfa
-0, 21, 21, 1, 135168, 0x5d41cdfa
-0, 22, 22, 1, 135168, 0x35cecdfa
-0, 23, 23, 1, 135168, 0xee17cdfa
-0, 24, 24, 1, 135168, 0x6599cdfa
-0, 25, 25, 1, 135168, 0x918bcdfa
-0, 26, 26, 1, 135168, 0xbd30cdfa
-0, 27, 27, 1, 135168, 0xc2a6cdfa
-0, 28, 28, 1, 135168, 0x688fcdfa
-0, 29, 29, 1, 135168, 0xb11bcdfa
-0, 30, 30, 1, 135168, 0x8316cdfa
-0, 31, 31, 1, 135168, 0x8073cdfa
-0, 32, 32, 1, 135168, 0x3bc1cdfa
-0, 33, 33, 1, 135168, 0xb581cdfa
-0, 34, 34, 1, 135168, 0xdf90cdfa
-0, 35, 35, 1, 135168, 0x6297cdfa
-0, 36, 36, 1, 135168, 0xe8e8cdfa
-0, 37, 37, 1, 135168, 0xa238cdfa
-0, 38, 38, 1, 135168, 0xdc68cdfa
-0, 39, 39, 1, 135168, 0x7545cdfa
-0, 40, 40, 1, 135168, 0xa29dcdfa
-0, 41, 41, 1, 135168, 0x874bcdfa
-0, 42, 42, 1, 135168, 0x7dfacdfa
-0, 43, 43, 1, 135168, 0x7fdfcdfa
-0, 44, 44, 1, 135168, 0xebb4cdfa
-0, 45, 45, 1, 135168, 0x7295cdfa
-0, 46, 46, 1, 135168, 0x54eecdfa
-0, 47, 47, 1, 135168, 0x18c4cdfa
-0, 48, 48, 1, 135168, 0xaa8fcdfa
-0, 49, 49, 1, 135168, 0x99edcdfa
+0, 0, 0, 1, 270336, 0x3af3cd54
+0, 1, 1, 1, 270336, 0x892ccd54
+0, 2, 2, 1, 270336, 0x2171cd54
+0, 3, 3, 1, 270336, 0xcaedcd54
+0, 4, 4, 1, 270336, 0xe973cd54
+0, 5, 5, 1, 270336, 0x4ad3cd54
+0, 6, 6, 1, 270336, 0xffe6cd54
+0, 7, 7, 1, 270336, 0x93d6cd54
+0, 8, 8, 1, 270336, 0xd75ecd54
+0, 9, 9, 1, 270336, 0xd257cd54
+0, 10, 10, 1, 270336, 0x2a55cd54
+0, 11, 11, 1, 270336, 0x751fcd54
+0, 12, 12, 1, 270336, 0x5041cd54
+0, 13, 13, 1, 270336, 0xaaa8cd54
+0, 14, 14, 1, 270336, 0xe1fccd54
+0, 15, 15, 1, 270336, 0x2f22cd54
+0, 16, 16, 1, 270336, 0xef8acd54
+0, 17, 17, 1, 270336, 0xaab1cd54
+0, 18, 18, 1, 270336, 0x7e77cd54
+0, 19, 19, 1, 270336, 0xe3b9cd54
+0, 20, 20, 1, 270336, 0x0208cd54
+0, 21, 21, 1, 270336, 0xa8bdcd54
+0, 22, 22, 1, 270336, 0x814acd54
+0, 23, 23, 1, 270336, 0x39a2cd54
+0, 24, 24, 1, 270336, 0xb115cd54
+0, 25, 25, 1, 270336, 0xdd07cd54
+0, 26, 26, 1, 270336, 0x08bbcd54
+0, 27, 27, 1, 270336, 0x0e31cd54
+0, 28, 28, 1, 270336, 0xb40bcd54
+0, 29, 29, 1, 270336, 0xfc97cd54
+0, 30, 30, 1, 270336, 0xce92cd54
+0, 31, 31, 1, 270336, 0xcbefcd54
+0, 32, 32, 1, 270336, 0x873dcd54
+0, 33, 33, 1, 270336, 0x010ccd54
+0, 34, 34, 1, 270336, 0x2b1bcd54
+0, 35, 35, 1, 270336, 0xae13cd54
+0, 36, 36, 1, 270336, 0x3473cd54
+0, 37, 37, 1, 270336, 0xedb4cd54
+0, 38, 38, 1, 270336, 0x27f3cd54
+0, 39, 39, 1, 270336, 0xc0c1cd54
+0, 40, 40, 1, 270336, 0xee19cd54
+0, 41, 41, 1, 270336, 0xd2c7cd54
+0, 42, 42, 1, 270336, 0xc976cd54
+0, 43, 43, 1, 270336, 0xcb5bcd54
+0, 44, 44, 1, 270336, 0x373fcd54
+0, 45, 45, 1, 270336, 0xbe11cd54
+0, 46, 46, 1, 270336, 0xa06acd54
+0, 47, 47, 1, 270336, 0x6440cd54
+0, 48, 48, 1, 270336, 0xf60bcd54
+0, 49, 49, 1, 270336, 0xe569cd54
diff --git a/tests/ref/fate/filter-waveform_envelope b/tests/ref/fate/filter-waveform_envelope
index a0d1f30e0d..44384ebeec 100644
--- a/tests/ref/fate/filter-waveform_envelope
+++ b/tests/ref/fate/filter-waveform_envelope
@@ -1,51 +1,51 @@
#tb 0: 1/25
-0, 0, 0, 1, 135168, 0x60746d0d
-0, 1, 1, 1, 135168, 0x3a19788d
-0, 2, 2, 1, 135168, 0x18e0d247
-0, 3, 3, 1, 135168, 0x8b4c177f
-0, 4, 4, 1, 135168, 0xc4b34d26
-0, 5, 5, 1, 135168, 0xba364556
-0, 6, 6, 1, 135168, 0xfcab7319
-0, 7, 7, 1, 135168, 0x363d77ce
-0, 8, 8, 1, 135168, 0x04367b07
-0, 9, 9, 1, 135168, 0x6e5b55a0
-0, 10, 10, 1, 135168, 0x33918421
-0, 11, 11, 1, 135168, 0x05ba7ff3
-0, 12, 12, 1, 135168, 0xcae09d62
-0, 13, 13, 1, 135168, 0xca78c5cb
-0, 14, 14, 1, 135168, 0x1542db51
-0, 15, 15, 1, 135168, 0xe013f307
-0, 16, 16, 1, 135168, 0x064008dd
-0, 17, 17, 1, 135168, 0xeb7010d5
-0, 18, 18, 1, 135168, 0x0cd313e1
-0, 19, 19, 1, 135168, 0xaf1b135f
-0, 20, 20, 1, 135168, 0x1b3c02c0
-0, 21, 21, 1, 135168, 0x50940658
-0, 22, 22, 1, 135168, 0x83a2046e
-0, 23, 23, 1, 135168, 0x1edf0a54
-0, 24, 24, 1, 135168, 0x37141206
-0, 25, 25, 1, 135168, 0x7832163e
-0, 26, 26, 1, 135168, 0xd4ba13dc
-0, 27, 27, 1, 135168, 0x9ba710a3
-0, 28, 28, 1, 135168, 0x434a108f
-0, 29, 29, 1, 135168, 0x86b01071
-0, 30, 30, 1, 135168, 0x7bd91c8d
-0, 31, 31, 1, 135168, 0x7a4c179c
-0, 32, 32, 1, 135168, 0x023f15b2
-0, 33, 33, 1, 135168, 0xe8901b20
-0, 34, 34, 1, 135168, 0x49d3157b
-0, 35, 35, 1, 135168, 0xdc990af9
-0, 36, 36, 1, 135168, 0x1ff707a2
-0, 37, 37, 1, 135168, 0xe6610022
-0, 38, 38, 1, 135168, 0x6fc3f168
-0, 39, 39, 1, 135168, 0x719809ff
-0, 40, 40, 1, 135168, 0xd1d9144f
-0, 41, 41, 1, 135168, 0x2f801797
-0, 42, 42, 1, 135168, 0x111c1eae
-0, 43, 43, 1, 135168, 0x23c11c4c
-0, 44, 44, 1, 135168, 0x07351d23
-0, 45, 45, 1, 135168, 0x04f1173d
-0, 46, 46, 1, 135168, 0xb2b71c10
-0, 47, 47, 1, 135168, 0x58c01a53
-0, 48, 48, 1, 135168, 0xadd11b7a
-0, 49, 49, 1, 135168, 0x924123c2
+0, 0, 0, 1, 270336, 0x24a46c67
+0, 1, 1, 1, 270336, 0x622077e7
+0, 2, 2, 1, 270336, 0xb96dd1a1
+0, 3, 3, 1, 270336, 0x180b16d9
+0, 4, 4, 1, 270336, 0x3db34c80
+0, 5, 5, 1, 270336, 0x417444b0
+0, 6, 6, 1, 270336, 0x3c017273
+0, 7, 7, 1, 270336, 0x572e7728
+0, 8, 8, 1, 270336, 0x18e17a61
+0, 9, 9, 1, 270336, 0x8d9f54fa
+0, 10, 10, 1, 270336, 0x01e5837b
+0, 11, 11, 1, 270336, 0x72ae7f4d
+0, 12, 12, 1, 270336, 0xb6ab9cbc
+0, 13, 13, 1, 270336, 0x28c5c525
+0, 14, 14, 1, 270336, 0x6d89daab
+0, 15, 15, 1, 270336, 0x761ff261
+0, 16, 16, 1, 270336, 0xae200837
+0, 17, 17, 1, 270336, 0x09fe102f
+0, 18, 18, 1, 270336, 0x4999133b
+0, 19, 19, 1, 270336, 0xbc2d12b9
+0, 20, 20, 1, 270336, 0x35f8021a
+0, 21, 21, 1, 270336, 0x5a8605b2
+0, 22, 22, 1, 270336, 0xb25703c8
+0, 23, 23, 1, 270336, 0x641909ae
+0, 24, 24, 1, 270336, 0x8a6e1160
+0, 25, 25, 1, 270336, 0xce181598
+0, 26, 26, 1, 270336, 0xc0ea1336
+0, 27, 27, 1, 270336, 0x941d0ffd
+0, 28, 28, 1, 270336, 0xf94a0fe9
+0, 29, 29, 1, 270336, 0x591d0fcb
+0, 30, 30, 1, 270336, 0x84fb1be7
+0, 31, 31, 1, 270336, 0xda8016f6
+0, 32, 32, 1, 270336, 0x8736150c
+0, 33, 33, 1, 270336, 0xf5931a7a
+0, 34, 34, 1, 270336, 0x582b14d5
+0, 35, 35, 1, 270336, 0x85ce0a53
+0, 36, 36, 1, 270336, 0xf1c106fc
+0, 37, 37, 1, 270336, 0xd023ff6d
+0, 38, 38, 1, 270336, 0xe398f0c2
+0, 39, 39, 1, 270336, 0x5c910959
+0, 40, 40, 1, 270336, 0xfbec13a9
+0, 41, 41, 1, 270336, 0x3f1e16f1
+0, 42, 42, 1, 270336, 0x6c1a1e08
+0, 43, 43, 1, 270336, 0x15091ba6
+0, 44, 44, 1, 270336, 0x82721c7d
+0, 45, 45, 1, 270336, 0x69a91697
+0, 46, 46, 1, 270336, 0xdcbb1b6a
+0, 47, 47, 1, 270336, 0x7cfa19ad
+0, 48, 48, 1, 270336, 0x65ba1ad4
+0, 49, 49, 1, 270336, 0xca65231c
diff --git a/tests/ref/fate/filter-waveform_row b/tests/ref/fate/filter-waveform_row
index 8bc7f36a06..95eaa45430 100644
--- a/tests/ref/fate/filter-waveform_row
+++ b/tests/ref/fate/filter-waveform_row
@@ -1,51 +1,51 @@
#tb 0: 1/25
-0, 0, 0, 1, 110592, 0xa6deed0a
-0, 1, 1, 1, 110592, 0xe659ed0a
-0, 2, 2, 1, 110592, 0x1ca5ed0a
-0, 3, 3, 1, 110592, 0xc2e8ed0a
-0, 4, 4, 1, 110592, 0x78d4ed0a
-0, 5, 5, 1, 110592, 0xbe2eed0a
-0, 6, 6, 1, 110592, 0x482ded0a
-0, 7, 7, 1, 110592, 0x994eed0a
-0, 8, 8, 1, 110592, 0x93aeed0a
-0, 9, 9, 1, 110592, 0xbba8ed0a
-0, 10, 10, 1, 110592, 0xeb2bed0a
-0, 11, 11, 1, 110592, 0xe41ced0a
-0, 12, 12, 1, 110592, 0xb404ed0a
-0, 13, 13, 1, 110592, 0xbad1ed0a
-0, 14, 14, 1, 110592, 0x952aed0a
-0, 15, 15, 1, 110592, 0xbed4ed0a
-0, 16, 16, 1, 110592, 0x5c7ded0a
-0, 17, 17, 1, 110592, 0xbfe8ed0a
-0, 18, 18, 1, 110592, 0xbb6bed0a
-0, 19, 19, 1, 110592, 0x7473ed0a
-0, 20, 20, 1, 110592, 0x7489ed0a
-0, 21, 21, 1, 110592, 0x88a4ed0a
-0, 22, 22, 1, 110592, 0xff0ced0a
-0, 23, 23, 1, 110592, 0x04b8ed0a
-0, 24, 24, 1, 110592, 0xeb8ded0a
-0, 25, 25, 1, 110592, 0xc752ed0a
-0, 26, 26, 1, 110592, 0x5b1bed0a
-0, 27, 27, 1, 110592, 0x1c97ed0a
-0, 28, 28, 1, 110592, 0x0a28ed0a
-0, 29, 29, 1, 110592, 0x302ced0a
-0, 30, 30, 1, 110592, 0x280bed0a
-0, 31, 31, 1, 110592, 0xaa30ed0a
-0, 32, 32, 1, 110592, 0xce59ed0a
-0, 33, 33, 1, 110592, 0xe5f6ed0a
-0, 34, 34, 1, 110592, 0x5b34ed0a
-0, 35, 35, 1, 110592, 0x1b97ed0a
-0, 36, 36, 1, 110592, 0x3283ed0a
-0, 37, 37, 1, 110592, 0xe0d1ed0a
-0, 38, 38, 1, 110592, 0x03f1ed0a
-0, 39, 39, 1, 110592, 0x5744ed0a
-0, 40, 40, 1, 110592, 0x8bbfed0a
-0, 41, 41, 1, 110592, 0xde8fed0a
-0, 42, 42, 1, 110592, 0x9975ed0a
-0, 43, 43, 1, 110592, 0x72eded0a
-0, 44, 44, 1, 110592, 0xe3efed0a
-0, 45, 45, 1, 110592, 0xee7fed0a
-0, 46, 46, 1, 110592, 0x44ffed0a
-0, 47, 47, 1, 110592, 0x91e6ed0a
-0, 48, 48, 1, 110592, 0x0a58ed0a
-0, 49, 49, 1, 110592, 0x68d2ed0a
+0, 0, 0, 1, 221184, 0x2a1149a3
+0, 1, 1, 1, 221184, 0x698c49a3
+0, 2, 2, 1, 221184, 0x9fc949a3
+0, 3, 3, 1, 221184, 0x461b49a3
+0, 4, 4, 1, 221184, 0xfbf849a3
+0, 5, 5, 1, 221184, 0x416149a3
+0, 6, 6, 1, 221184, 0xcb5149a3
+0, 7, 7, 1, 221184, 0x1c8149a3
+0, 8, 8, 1, 221184, 0x16e149a3
+0, 9, 9, 1, 221184, 0x3edb49a3
+0, 10, 10, 1, 221184, 0x6e5e49a3
+0, 11, 11, 1, 221184, 0x674f49a3
+0, 12, 12, 1, 221184, 0x373749a3
+0, 13, 13, 1, 221184, 0x3e0449a3
+0, 14, 14, 1, 221184, 0x185d49a3
+0, 15, 15, 1, 221184, 0x420749a3
+0, 16, 16, 1, 221184, 0xdfa149a3
+0, 17, 17, 1, 221184, 0x431b49a3
+0, 18, 18, 1, 221184, 0x3e9e49a3
+0, 19, 19, 1, 221184, 0xf79749a3
+0, 20, 20, 1, 221184, 0xf7ad49a3
+0, 21, 21, 1, 221184, 0x0bd749a3
+0, 22, 22, 1, 221184, 0x823f49a3
+0, 23, 23, 1, 221184, 0x87dc49a3
+0, 24, 24, 1, 221184, 0x6ec049a3
+0, 25, 25, 1, 221184, 0x4a8549a3
+0, 26, 26, 1, 221184, 0xde3f49a3
+0, 27, 27, 1, 221184, 0x9fbb49a3
+0, 28, 28, 1, 221184, 0x8d4c49a3
+0, 29, 29, 1, 221184, 0xb35049a3
+0, 30, 30, 1, 221184, 0xab2f49a3
+0, 31, 31, 1, 221184, 0x2d6349a3
+0, 32, 32, 1, 221184, 0x518c49a3
+0, 33, 33, 1, 221184, 0x692949a3
+0, 34, 34, 1, 221184, 0xde5849a3
+0, 35, 35, 1, 221184, 0x9ebb49a3
+0, 36, 36, 1, 221184, 0xb5a749a3
+0, 37, 37, 1, 221184, 0x640449a3
+0, 38, 38, 1, 221184, 0x871549a3
+0, 39, 39, 1, 221184, 0xda6849a3
+0, 40, 40, 1, 221184, 0x0ef249a3
+0, 41, 41, 1, 221184, 0x61c249a3
+0, 42, 42, 1, 221184, 0x1ca849a3
+0, 43, 43, 1, 221184, 0xf61149a3
+0, 44, 44, 1, 221184, 0x672249a3
+0, 45, 45, 1, 221184, 0x71b249a3
+0, 46, 46, 1, 221184, 0xc82349a3
+0, 47, 47, 1, 221184, 0x151949a3
+0, 48, 48, 1, 221184, 0x8d7c49a3
+0, 49, 49, 1, 221184, 0xebf649a3
diff --git a/tests/ref/fate/filter-waveform_uv b/tests/ref/fate/filter-waveform_uv
index 8c3fc70e8e..6eb363c6f2 100644
--- a/tests/ref/fate/filter-waveform_uv
+++ b/tests/ref/fate/filter-waveform_uv
@@ -1,51 +1,51 @@
#tb 0: 1/25
-0, 0, 0, 1, 270336, 0x7be065a8
-0, 1, 1, 1, 270336, 0xa4e56622
-0, 2, 2, 1, 270336, 0xae4a662a
-0, 3, 3, 1, 270336, 0x367e6678
-0, 4, 4, 1, 270336, 0x970f667c
-0, 5, 5, 1, 270336, 0xdf7565f6
-0, 6, 6, 1, 270336, 0xc4a36652
-0, 7, 7, 1, 270336, 0x2f426630
-0, 8, 8, 1, 270336, 0xc095662c
-0, 9, 9, 1, 270336, 0x75fa6626
-0, 10, 10, 1, 270336, 0x95616592
-0, 11, 11, 1, 270336, 0x78916608
-0, 12, 12, 1, 270336, 0x118c65bc
-0, 13, 13, 1, 270336, 0x75446604
-0, 14, 14, 1, 270336, 0xe5fb6612
-0, 15, 15, 1, 270336, 0x3b8f6618
-0, 16, 16, 1, 270336, 0xdeee6646
-0, 17, 17, 1, 270336, 0xede46606
-0, 18, 18, 1, 270336, 0x64336606
-0, 19, 19, 1, 270336, 0xfc50663a
-0, 20, 20, 1, 270336, 0xe5fc660a
-0, 21, 21, 1, 270336, 0x6ecb6612
-0, 22, 22, 1, 270336, 0x06a4662a
-0, 23, 23, 1, 270336, 0xc7b66656
-0, 24, 24, 1, 270336, 0x033e6636
-0, 25, 25, 1, 270336, 0xc14f6650
-0, 26, 26, 1, 270336, 0x7462662c
-0, 27, 27, 1, 270336, 0xf8cb65e4
-0, 28, 28, 1, 270336, 0x6351665e
-0, 29, 29, 1, 270336, 0x44e6666e
-0, 30, 30, 1, 270336, 0x1d5f660e
-0, 31, 31, 1, 270336, 0xc248662e
-0, 32, 32, 1, 270336, 0x36256642
-0, 33, 33, 1, 270336, 0xe4426598
-0, 34, 34, 1, 270336, 0xde81665a
-0, 35, 35, 1, 270336, 0xaeab6622
-0, 36, 36, 1, 270336, 0x134e6668
-0, 37, 37, 1, 270336, 0x6c6e665e
-0, 38, 38, 1, 270336, 0x500b6670
-0, 39, 39, 1, 270336, 0x2c4c6648
-0, 40, 40, 1, 270336, 0xe4ae664c
-0, 41, 41, 1, 270336, 0x9b7e664c
-0, 42, 42, 1, 270336, 0xfefb6570
-0, 43, 43, 1, 270336, 0x04e96600
-0, 44, 44, 1, 270336, 0xcbba6670
-0, 45, 45, 1, 270336, 0x9f9666a6
-0, 46, 46, 1, 270336, 0x85b76642
-0, 47, 47, 1, 270336, 0x1a0e667c
-0, 48, 48, 1, 270336, 0x92c9662a
-0, 49, 49, 1, 270336, 0x9ed76682
+0, 0, 0, 1, 540672, 0x8a2521d6
+0, 1, 1, 1, 540672, 0xb9a321d6
+0, 2, 2, 1, 540672, 0x325421d6
+0, 3, 3, 1, 540672, 0xafee21d2
+0, 4, 4, 1, 540672, 0x172121d6
+0, 5, 5, 1, 540672, 0x24d121d6
+0, 6, 6, 1, 540672, 0x7fec21d6
+0, 7, 7, 1, 540672, 0xa8a021d6
+0, 8, 8, 1, 540672, 0x29fd21d6
+0, 9, 9, 1, 540672, 0x6dfe21d6
+0, 10, 10, 1, 540672, 0xe39821d6
+0, 11, 11, 1, 540672, 0x83f521d6
+0, 12, 12, 1, 540672, 0x57aa21d6
+0, 13, 13, 1, 540672, 0x67b221d6
+0, 14, 14, 1, 540672, 0x535821d6
+0, 15, 15, 1, 540672, 0xb8ac21d6
+0, 16, 16, 1, 540672, 0x27f621d6
+0, 17, 17, 1, 540672, 0x775221d6
+0, 18, 18, 1, 540672, 0x8e6621d6
+0, 19, 19, 1, 540672, 0x74c921d6
+0, 20, 20, 1, 540672, 0x04cd21d6
+0, 21, 21, 1, 540672, 0xccd421d6
+0, 22, 22, 1, 540672, 0x317221d6
+0, 23, 23, 1, 540672, 0xd79321d6
+0, 24, 24, 1, 540672, 0xa2ac21d6
+0, 25, 25, 1, 540672, 0x7f0a21d6
+0, 26, 26, 1, 540672, 0x483521d6
+0, 27, 27, 1, 540672, 0xb65721d6
+0, 28, 28, 1, 540672, 0xb77021d6
+0, 29, 29, 1, 540672, 0x9fd521d6
+0, 30, 30, 1, 540672, 0xb72121d6
+0, 31, 31, 1, 540672, 0x540221d6
+0, 32, 32, 1, 540672, 0xa34121d6
+0, 33, 33, 1, 540672, 0xe01421d6
+0, 34, 34, 1, 540672, 0x6fc721d6
+0, 35, 35, 1, 540672, 0x7fa621d6
+0, 36, 36, 1, 540672, 0xc48c21d6
+0, 37, 37, 1, 540672, 0x40f021d6
+0, 38, 38, 1, 540672, 0xdf3f21d6
+0, 39, 39, 1, 540672, 0xb04321d6
+0, 40, 40, 1, 540672, 0x222821d6
+0, 41, 41, 1, 540672, 0x2a5521d6
+0, 42, 42, 1, 540672, 0x6a4621be
+0, 43, 43, 1, 540672, 0xed7f21d6
+0, 44, 44, 1, 540672, 0xb16521d6
+0, 45, 45, 1, 540672, 0x9f5621d6
+0, 46, 46, 1, 540672, 0x204321d6
+0, 47, 47, 1, 540672, 0xc26e21d6
+0, 48, 48, 1, 540672, 0x3e8321d6
+0, 49, 49, 1, 540672, 0xaaee21d6