[FFmpeg-devel] [PATCH] AAC decoder

Robert Swain robert.swain
Mon Jun 2 21:32:39 CEST 2008


On 2 Jun 2008, at 19:58, Michael Niedermayer wrote:
> On Mon, Jun 02, 2008 at 12:33:57PM +0100, Robert Swain wrote:
>>
>> How about the attached patch? Any further suggestions?
>
>> Index: aac.c
>> ===================================================================
>> --- aac.c	(revision 2326)
>> +++ aac.c	(working copy)
>> @@ -1214,23 +1214,20 @@
>>             }else if (cur_cb != INTENSITY_HCB2 && cur_cb !=  
>> INTENSITY_HCB) {
>>                 for (group = 0; group < ics->group_len[g]; group++) {
>>                     for (k = offsets[i]; k < offsets[i+1]; k +=  
>> dim) {
>> -                        int index = get_vlc2(gb, ac->books[cur_cb  
>> - 1].table, 6, 3);
>> +                        const int index = get_vlc2(gb, ac- 
>> >books[cur_cb - 1].table, 6, 3);
>> +                        const int idx1 = index * dim, idx2 =  
>> (group << 7) + k;
>>                         int j;
>> -                        int sign[4] = {1,1,1,1};
>> -                        int ptr[4];
>>                         if (index == -1) {
>>                             av_log(ac->avccontext, AV_LOG_ERROR,  
>> "Error in spectral data\n");
>>                             return -1;
>>                         }
>
>> -                        memcpy(ptr, &ac->vq[cur_cb - 1][index *  
>> dim], dim*sizeof(int));
>
> whatever *ptr= &ac->vq[cur_cb - 1][index * dim]
> might be cleaner thabn n the repeated use of ac->vq[cur_cb - 1] 
> [index * dim]

Agreed. I'll change that and apply, unless you have anything else to  
add.

You'll be happy to know that I'm working on flattening the channel  
element structs (sce_struct, cpe_struct, cc_struct) into one  
(che_struct). When I submit the patch, I expect it will take an  
iteration or two to be clean enough to commit but it has simplified a  
lot of the code so far. :) There will also be some considerations  
about whether to dynamically allocate some things if they're too large  
to be allocated with every channel element.

Rob





More information about the ffmpeg-devel mailing list