Hi, patch attached.
From 538f424defabd4ae55467ba216a678e0bb50c12c Mon Sep 17 00:00:00 2001 From: Paul B Mahol <one...@gmail.com> Date: Tue, 12 Apr 2016 22:41:51 +0200 Subject: [PATCH] avcodec/wmalosslessdec: real 24bit support
Signed-off-by: Paul B Mahol <one...@gmail.com> --- configure | 1 - libavcodec/wmalosslessdec.c | 48 +++++++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/configure b/configure index 94a66d8..10219f7 100755 --- a/configure +++ b/configure @@ -2485,7 +2485,6 @@ vp7_decoder_select="h264pred videodsp vp8dsp" vp8_decoder_select="h264pred videodsp vp8dsp" vp9_decoder_select="videodsp vp9_parser" webp_decoder_select="vp8_decoder exif" -wmalossless_decoder_select="llauddsp" wmapro_decoder_select="mdct sinewin wma_freqs" wmav1_decoder_select="mdct sinewin wma_freqs" wmav1_encoder_select="mdct sinewin wma_freqs" diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index c41eb6c..a3aa688 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -31,7 +31,6 @@ #include "internal.h" #include "get_bits.h" #include "put_bits.h" -#include "lossless_audiodsp.h" #include "wma.h" #include "wma_common.h" @@ -71,7 +70,6 @@ typedef struct WmallDecodeCtx { /* generic decoder variables */ AVCodecContext *avctx; AVFrame *frame; - LLAudDSPContext dsp; ///< accelerated DSP functions uint8_t frame_data[MAX_FRAMESIZE + AV_INPUT_BUFFER_PADDING_SIZE]; ///< compressed frame data PutBitContext pb; ///< context for filling the frame_data buffer @@ -134,8 +132,8 @@ typedef struct WmallDecodeCtx { int8_t mclms_scaling; int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32]; int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS]; - int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32]; - int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32]; + int mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32]; + int mclms_updates[WMALL_MAX_CHANNELS * 2 * 32]; int mclms_recent; int movave_scaling; @@ -146,9 +144,9 @@ typedef struct WmallDecodeCtx { int scaling; int coefsend; int bitsend; - DECLARE_ALIGNED(16, int16_t, coefs)[MAX_ORDER + WMALL_COEFF_PAD_SIZE/sizeof(int16_t)]; - DECLARE_ALIGNED(16, int16_t, lms_prevvalues)[MAX_ORDER * 2 + WMALL_COEFF_PAD_SIZE/sizeof(int16_t)]; - DECLARE_ALIGNED(16, int16_t, lms_updates)[MAX_ORDER * 2 + WMALL_COEFF_PAD_SIZE/sizeof(int16_t)]; + int coefs[MAX_ORDER + WMALL_COEFF_PAD_SIZE]; + int lms_prevvalues[MAX_ORDER * 2 + WMALL_COEFF_PAD_SIZE]; + int lms_updates[MAX_ORDER * 2 + WMALL_COEFF_PAD_SIZE]; int recent; } cdlms[WMALL_MAX_CHANNELS][9]; @@ -191,7 +189,6 @@ static av_cold int decode_init(AVCodecContext *avctx) } s->avctx = avctx; - ff_llauddsp_init(&s->dsp); init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); if (avctx->extradata_size >= 18) { @@ -651,10 +648,10 @@ static void mclms_update(WmallDecodeCtx *s, int icoef, int *pred) if (s->mclms_recent == 0) { memcpy(&s->mclms_prevvalues[order * num_channels], s->mclms_prevvalues, - sizeof(int16_t) * order * num_channels); + sizeof(int) * order * num_channels); memcpy(&s->mclms_updates[order * num_channels], s->mclms_updates, - sizeof(int16_t) * order * num_channels); + sizeof(int) * order * num_channels); s->mclms_recent = num_channels * order; } } @@ -713,7 +710,7 @@ static void lms_update(WmallDecodeCtx *s, int ich, int ilms, int input) s->cdlms[ich][ilms].lms_updates[recent + (order >> 3)] >>= 1; s->cdlms[ich][ilms].recent = recent; memset(s->cdlms[ich][ilms].lms_updates + recent + order, 0, - sizeof(s->cdlms[ich][ilms].lms_updates) - 2*(recent+order)); + sizeof(s->cdlms[ich][ilms].lms_updates) - 4*(recent+order)); } static void use_high_update_speed(WmallDecodeCtx *s, int ich) @@ -751,6 +748,20 @@ static void use_normal_update_speed(WmallDecodeCtx *s, int ich) s->update_speed[ich] = 8; } +static int scalarproduct_and_madd_int(int *v1, const int *v2, + const int *v3, + int order, int mul) +{ + int res = 0; + + av_assert0(order >= 0); + while (order--) { + res += *v1 * *v2++; + *v1++ += mul * *v3++; + } + return res; +} + static void revert_cdlms(WmallDecodeCtx *s, int ch, int coef_begin, int coef_end) { @@ -761,14 +772,13 @@ static void revert_cdlms(WmallDecodeCtx *s, int ch, for (icoef = coef_begin; icoef < coef_end; icoef++) { pred = 1 << (s->cdlms[ch][ilms].scaling - 1); residue = s->channel_residues[ch][icoef]; - pred += s->dsp.scalarproduct_and_madd_int16(s->cdlms[ch][ilms].coefs, - s->cdlms[ch][ilms].lms_prevvalues - + s->cdlms[ch][ilms].recent, - s->cdlms[ch][ilms].lms_updates - + s->cdlms[ch][ilms].recent, - FFALIGN(s->cdlms[ch][ilms].order, - WMALL_COEFF_PAD_SIZE), - WMASIGN(residue)); + pred += scalarproduct_and_madd_int(s->cdlms[ch][ilms].coefs, + s->cdlms[ch][ilms].lms_prevvalues + + s->cdlms[ch][ilms].recent, + s->cdlms[ch][ilms].lms_updates + + s->cdlms[ch][ilms].recent, + s->cdlms[ch][ilms].order, + WMASIGN(residue)); input = residue + (pred >> s->cdlms[ch][ilms].scaling); lms_update(s, ch, ilms, input); s->channel_residues[ch][icoef] = input; -- 2.5.0
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel