From c2bbcf16077b30ce1d8d004c9a7cd21b15d02a15 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Mon, 28 Mar 2016 12:28:03 +0200 Subject: [PATCH] avfilter/vf_waveform: optimize 16bit lowpass filter Signed-off-by: Paul B Mahol --- libavfilter/vf_waveform.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c index 5041f955a6..62fba6c7b3 100644 --- a/libavfilter/vf_waveform.c +++ b/libavfilter/vf_waveform.c @@ -651,6 +651,22 @@ static av_always_inline void lowpass16(WaveformContext *s, envelope16(s, out, plane, plane, column ? offset_x : offset_y); } +#define LOWPASS16_FUNC(name, column, mirror) \ +static void lowpass16_##name(WaveformContext *s, \ + AVFrame *in, AVFrame *out, \ + int component, int intensity, \ + int offset_y, int offset_x, \ + int unused1, int unused2) \ +{ \ + lowpass16(s, in, out, component, intensity, \ + offset_y, offset_x, column, mirror); \ +} + +LOWPASS16_FUNC(column_mirror, 1, 1) +LOWPASS16_FUNC(column, 1, 0) +LOWPASS16_FUNC(row_mirror, 0, 1) +LOWPASS16_FUNC(row, 0, 0) + static av_always_inline void lowpass(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, @@ -2424,10 +2440,10 @@ static int config_input(AVFilterLink *inlink) case 0x1000: s->waveform = lowpass_row_mirror; break; case 0x0100: s->waveform = lowpass_column; break; case 0x0000: s->waveform = lowpass_row; break; - case 0x1110: - case 0x1010: - case 0x0110: - case 0x0010: s->waveform = lowpass16; break; + case 0x1110: s->waveform = lowpass16_column_mirror; break; + case 0x1010: s->waveform = lowpass16_row_mirror; break; + case 0x0110: s->waveform = lowpass16_column; break; + case 0x0010: s->waveform = lowpass16_row; break; case 0x1101: case 0x1001: case 0x0101: