[FFmpeg-devel] [PATCH]HE-AACv1 try 3 (all missing functionality added)

Måns Rullgård mans
Mon Feb 15 14:10:36 CET 2010


Alex Converse <alex.converse at gmail.com> writes:

>>> ?+static void vector_fadd_c(float *dst, const float *src, int len)
>>> +{
>>> + ? ?int i;
>>> + ? ?for (i = 0; i < len; i++)
>>> + ? ? ? ?dst[i] += src[i];
>>> +}
>>> +
>>> +static void vector_cmul_c(float (*dst)[2], const float (*src0)[2], const
>>> float (*src1)[2], int len)
>>> +{
>>> + ? ?int i;
>>> + ? ?for (i = 0; i < len; i++) {
>>> + ? ? ? ?dst[i][0] = src0[i][0] * src1[i][0] - src0[i][1] * src1[i][1];
>>> + ? ? ? ?dst[i][1] = src0[i][1] * src1[i][0] + src0[i][0] * src1[i][1];
>>> + ? ?}
>>> +}
>>> +
>>> ?static void vector_fmul_c(float *dst, const float *src, int len){
>>> ? ? int i;
>>> ? ? for(i=0; i<len; i++)
>>> @@ -4160,6 +4176,22 @@ static void vector_fmul_scalar_c(float *dst, const
>>> float *src, float mul,
>>> ? ? ? ? dst[i] = src[i] * mul;
>>> ?}
>>> ?+static void vector_fadd_scalar_fmul_scalar_c(float *dst, const float
>>> *src,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? float add, float mul, int
>>> len)
>>> +{
>>> + ? ?int i;
>>> + ? ?for (i = 0; i < len; i++)
>>> + ? ? ? ?dst[i] = (src[i] + add) * mul;
>>> +}
>>> +
>>> +static void vector_fmul_scalar_fadd_scalar_c(float *dst, const float
>>> *src,
>>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? float mul, float add, int
>>> len)
>>> +{
>>> + ? ?int i;
>>> + ? ?for (i = 0; i < len; i++)
>>> + ? ? ? ?dst[i] = src[i] * mul + add;
>>> +}
>>> +
>>
>> Did you benchmark if hand-unrolling these loops give any benefit? You know
>> that len is a multiple of four, but the compiler don't.
>>
>
> I'm going to let you, M?ns, and Michael decide this one. Let me know
> when you've reached a consensus.

I assume we'll be writing asm for these where it matters.  I'd leave
them like this for now.  Keeping the C versions easy to read is as
important as a few % speed.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list