[FFmpeg-devel] [PATCHv2] avcodec/dcaenc: avoid wasteful cos calls

Ganesh Ajjanagadde gajjanag at mit.edu
Fri Dec 11 16:37:41 CET 2015


On Fri, Dec 11, 2015 at 3:29 AM, Paul B Mahol <onemda at gmail.com> wrote:
> On 12/10/15, Ganesh Ajjanagadde <gajjanagadde at gmail.com> wrote:
>> cos has symmetry; use this.
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  libavcodec/dcaenc.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
>> index 5a6bdac..6fcfb1a 100644
>> --- a/libavcodec/dcaenc.c
>> +++ b/libavcodec/dcaenc.c
>> @@ -169,8 +169,16 @@ static int encode_init(AVCodecContext *avctx)
>>      if (!cos_table[0]) {
>>          int j, k;
>>
>> -        for (i = 0; i < 2048; i++) {
>> +        cos_table[0] = 0x7fffffff;
>> +        cos_table[512] = 0;
>> +        cos_table[1024] = -cos_table[0];
>> +        for (i = 1; i < 512; i++) {
>>              cos_table[i]   = (int32_t)(0x7fffffff * cos(M_PI * i / 1024));
>> +            cos_table[1024-i] = -cos_table[i];
>> +            cos_table[1024+i] = -cos_table[i];
>> +            cos_table[2048-i] = cos_table[i];
>> +        }
>> +        for (i = 0; i < 2048; i++) {
>>              cb_to_level[i] = (int32_t)(0x7fffffff * pow(10, -0.005 * i));
>>          }
>>
>> --
>> 2.6.3
>
> Ok, if produced table is same.

checked, they are the same. Pushed, thanks

>
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list