[FFmpeg-devel] [PATCH 2/2] ac3enc: add SIMD-optimized shifting functions for use with the fixed-point AC3 encoder.
Ivan Kalvachev
ikalvachev
Sat Mar 12 10:56:33 CET 2011
On 3/12/11, M?ns Rullg?rd <mans at mansr.com> wrote:
> Justin Ruggles <justin.ruggles at gmail.com> writes:
>
>> ---
>> libavcodec/ac3dsp.c | 24 +++++++++++++++++++++
>> libavcodec/ac3dsp.h | 22 +++++++++++++++++++
>> libavcodec/ac3enc_fixed.c | 40 ++---------------------------------
>> libavcodec/x86/ac3dsp.asm | 48
>> +++++++++++++++++++++++++++++++++++++++++++
>> libavcodec/x86/ac3dsp_mmx.c | 12 ++++++++++
>> 5 files changed, 109 insertions(+), 37 deletions(-)
>>
>>
>> diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
>> index da3a123..83f48a6 100644
>> --- a/libavcodec/ac3dsp.c
>> +++ b/libavcodec/ac3dsp.c
>> @@ -50,10 +50,34 @@ static int ac3_max_msb_abs_int16_c(const int16_t *src,
>> int len)
>> return v;
>> }
>>
>> +static void ac3_lshift_int16_c(int16_t *src, unsigned int len,
>> + unsigned int shift)
>> +{
>> + int i;
>> +
>> + if (shift > 0) {
>> + for (i = 0; i < len; i++)
>> + src[i] <<= shift;
>> + }
>> +}
You can shift 2 values at once if you read them as int32_t, shift and
then mask (masking could even be skipped if you are sure they will
never overflow).
More information about the ffmpeg-devel
mailing list