[FFmpeg-cvslog] af_hdcd: support s16p (WavPack) directly

Burt P git at videolan.org
Wed Oct 5 20:57:52 EEST 2016


ffmpeg | branch: master | Burt P <pburt0 at gmail.com> | Wed Sep 28 06:18:19 2016 -0500| [80d89c19601fc1bee06e845e11e0115c01c15bb9] | committer: Burt P

af_hdcd: support s16p (WavPack) directly

The buffer is already being copied anyway, so interlace the planar
format during the copy and remove one use of auto-convert.

Signed-off-by: Burt P <pburt0 at gmail.com>

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

 libavfilter/af_hdcd.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index dd9ecc3..6f35c09 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1665,10 +1665,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     }
     out->format = outlink->format; // is this needed?
 
-    in_data  = (int16_t*)in->data[0];
     out_data = (int32_t*)out->data[0];
-    for (c = n = 0; n < in->nb_samples * in->channels; n++)
-        out_data[n] = in_data[n];
+    if (inlink->format == AV_SAMPLE_FMT_S16P) {
+        for (n = 0; n < in->nb_samples; n++)
+            for (c = 0; c < in->channels; c++) {
+                in_data = (int16_t*)in->extended_data[c];
+                out_data[(n * in->channels) + c] = in_data[n];
+            }
+    } else {
+        in_data  = (int16_t*)in->data[0];
+        for (n = 0; n < in->nb_samples * in->channels; n++)
+            out_data[n] = in_data[n];
+    }
 
     if (s->process_stereo) {
         hdcd_detect_start(&s->detect);
@@ -1707,6 +1715,7 @@ static int query_formats(AVFilterContext *ctx)
 
     static const enum AVSampleFormat sample_fmts_in[] = {
         AV_SAMPLE_FMT_S16,
+        AV_SAMPLE_FMT_S16P,
         AV_SAMPLE_FMT_NONE
     };
     static const enum AVSampleFormat sample_fmts_out[] = {



More information about the ffmpeg-cvslog mailing list