[FFmpeg-devel] [PATCH 2/2] ac3enc: add SIMD-optimized shifting functions for use with the fixed-point AC3 encoder.
Måns Rullgård
mans
Sat Mar 12 12:40:04 CET 2011
Ivan Kalvachev <ikalvachev at gmail.com> writes:
> 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).
There's no point optimising the C version beyond comprehension. We have
the asm hooks for that.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list