[FFmpeg-cvslog] avfilter/vf_waveform: optimize 16bit lowpass filter

Paul B Mahol git at videolan.org
Mon Mar 28 18:10:03 CEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Mar 28 12:28:03 2016 +0200| [c2bbcf16077b30ce1d8d004c9a7cd21b15d02a15] | committer: Paul B Mahol

avfilter/vf_waveform: optimize 16bit lowpass filter

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2bbcf16077b30ce1d8d004c9a7cd21b15d02a15
---

 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 5041f95..62fba6c 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:



More information about the ffmpeg-cvslog mailing list