[FFmpeg-devel] [PATCH 4/5] wma lossless: pad coeff buffer with 0

Christophe Gisquet christophe.gisquet at gmail.com
Fri May 10 11:32:57 CEST 2013


This allows using unmodified SIMD functions requiring batches of 16 elements.
---
 libavcodec/wmalosslessdec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index ae366ef..f95a0f7 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -45,6 +45,7 @@
 #define WMALL_BLOCK_MAX_SIZE (1 << WMALL_BLOCK_MAX_BITS)    ///< maximum block size
 #define WMALL_BLOCK_SIZES    (WMALL_BLOCK_MAX_BITS - WMALL_BLOCK_MIN_BITS + 1) ///< possible block sizes
 
+#define WMALL_COEFF_PAD_SIZE   16                       ///< pad coef buffers with 0 for use with SIMD functions
 
 /**
  * @brief frame-specific decoder context for a single channel
@@ -486,6 +487,12 @@ static int decode_cdlms(WmallDecodeCtx *s)
                         (get_bits(&s->gb, s->cdlms[c][i].bitsend) << shift_l) >> shift_r;
             }
         }
+
+        for (i = 0; i < s->cdlms_ttl[c]; i++) {
+            memset(s->cdlms[c][i].coefs + s->cdlms[c][i].order, 0,
+                   (s->cdlms[c][i].order % WMALL_COEFF_PAD_SIZE)
+                   * sizeof(s->cdlms[c][i].coefs));
+        }
     }
 
     return 0;
-- 
1.8.0.msysgit.0



More information about the ffmpeg-devel mailing list