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

Michael Niedermayer michaelni at gmx.at
Fri May 10 21:52:06 CEST 2013


On Fri, May 10, 2013 at 09:32:57AM +0000, Christophe Gisquet wrote:
> 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));

% 16 should be replaced by & 15, otherwise performance would
depend on the compiler making that optimization

and a av_assert could be added to ensure (order & 7) == 0

I also suggest to keep av_log_ask_for_sample() for the order & 8
case


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130510/5f7fe2f2/attachment.asc>


More information about the ffmpeg-devel mailing list