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

Michael Niedermayer michaelni
Sun May 18 20:25:15 CEST 2008


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.


> +
> +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];
fc_v[ i + tab1[index] ] += (pulses_signs & 1) ? 8191 : -8192; // +/-1 in (2.13)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080518/65359083/attachment.pgp>



More information about the ffmpeg-devel mailing list