[FFmpeg-devel] [PATCH] Common ACELP code & G.729 [3/7] - vectors operations

Vladimir Voroshilov voroshil
Mon May 19 03:26:27 CEST 2008


2008/5/19 Michael Niedermayer <michaelni at gmx.at>:
> On Mon, May 19, 2008 at 12:47:16AM +0700, Vladimir Voroshilov wrote:
>> 2008/5/18 Michael Niedermayer <michaelni at gmx.at>:
>> > On Sun, May 18, 2008 at 01:23:20PM +0700, Vladimir Voroshilov wrote:
>>
>> [...]
>>
>> >> What about such uniform routine?
>> >
>> > I think its a mess.
>> >
>> > tab, tab2, pulse_count, bits should be arguments to the function not some
>> > enum which sets them in a switch()
>> >
>>
>> like this?
> [...]
>> +const uint8_t fc_2pulses_9bits_track2[32] =
>> +{
>> +   0,  2,   4,
>> +   5,  7,   9,
>> +   10, 12, 14,
>> +   15, 17, 19,
>> +   20, 22, 24,
>> +   25, 27, 29,
>> +   30, 32, 34,
>> +   35, 37, 39,
>> +   1,
>> +   6,
>> +   11,
>> +   16,
>> +   21,
>> +   26,
>> +   31,
>> +   36
>> +};
>> +
>> +const uint8_t fc_2pulses_9bits_track1[16] =
>> +{
>> +    1,  3,
>> +    6,  8,
>> +    11, 13,
>> +    16, 18,
>> +    21, 23,
>> +    26, 28,
>> +    31, 33,
>> +    36, 38
>> +};
>> +
>> +const uint8_t fc_4pulses_8bits_tracks_13[16] =
>> +{
>> +  0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75,
>> +};
>> +
>> +const uint8_t fc_4pulses_8bits_track_4[32] =
>> +{
>> +    3,  4,
>> +    8,  9,
>> +    13, 14,
>> +    18, 19,
>> +    23, 24,
>> +    28, 29,
>> +    33, 34,
>> +    38, 39,
>> +    43, 44,
>> +    48, 49,
>> +    53, 54,
>> +    58, 59,
>> +    63, 64,
>> +    68, 69,
>> +    73, 74,
>> +    78, 79,
>> +};
>> +
>> +static uint8_t gray_decode[32] =
>> +{
>> +    0,  1,  3,  2,  7,  6,  4,  5,
>> +   15, 14, 12, 13,  8,  9, 11, 10,
>> +   31, 30, 28, 29, 24, 25, 27, 26,
>> +   16, 17, 19, 18, 23, 22, 20, 21
>> +};
>
> Are the tables which use gray_decode also used without it?
> If no merging gray_decode into them would reduce complexity.

Due to error in the second table, it is not used
anywhere except G.729D, first can be reused in AMR @5.9k
I'd applied gray coding to both and add _gray suffix.

*_track1 (without gray coding) is kept as copy.
Also kept gray_decoding table under #if 0

>> +
>> +void ff_acelp_fc_pulse_per_track(
>> +        int16_t* fc_v,
>> +        const uint8_t *tab1,
>> +        const uint8_t *tab2,
>> +        int fc_index,
>> +        int pulses_signs,
>> +        int gray,
>> +        int pulse_count,
>> +        int bits)
>> +{
>> +    int mask = (1 << bits) - 1;
>> +    int i, index;
>> +
>> +    for(i=0; i<pulse_count; i++)
>> +    {
>
>> +        if(gray)
>> +            index = i + tab1[gray_decode[fc_index & mask]];
>> +        else
>> +            index = i + tab1[fc_index & mask];
>> +        fc_v[ index ] += (pulses_signs & 1) ? 8191 : -8192; // +/-1 in (2.13)
>
>
> index= fc_index & mask;
> if(gray)
>    index= gray_decode[index];

Now unnecessary.

> fc_v[ i + tab1[index] ] += (pulses_signs & 1) ? 8191 : -8192; // +/-1 in (2.13)

fixed.


-- 
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03_acelp_vectors53.diff
Type: text/x-diff
Size: 10307 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080519/2500d02b/attachment.diff>



More information about the ffmpeg-devel mailing list