libavcodec/ra144.c File Reference

#include <stdint.h>
#include "avcodec.h"
#include "celp_filters.h"
#include "ra144.h"

Go to the source code of this file.

Functions

static void ff_add_wav (int16_t *dest, int n, int skip_first, int *m, const int16_t *s1, const int8_t *s2, const int8_t *s3)
void ff_copy_and_dup (int16_t *target, const int16_t *source, int offset)
 Copy the last offset values of *source to *target.
int ff_eval_refl (int *refl, const int16_t *coefs, AVCodecContext *avctx)
 Evaluate the reflection coefficients from the filter coefficients.
void ff_eval_coefs (int *coefs, const int *refl)
 Evaluate the LPC filter coefficients from the reflection coefficients.
void ff_int_to_int16 (int16_t *out, const int *inp)
int ff_t_sqrt (unsigned int x)
 Evaluate sqrt(x << 24).
unsigned int ff_rms (const int *data)
int ff_interp (RA144Context *ractx, int16_t *out, int a, int copyold, int energy)
unsigned int ff_rescale_rms (unsigned int rms, unsigned int energy)
int ff_irms (const int16_t *data)
 inverse root mean square
void ff_subblock_synthesis (RA144Context *ractx, const uint16_t *lpc_coefs, int cba_idx, int cb1_idx, int cb2_idx, int gval, int gain)

Variables

const int16_t ff_gain_val_tab [256][3]
const uint8_t ff_gain_exp_tab [256]
const int8_t ff_cb1_vects [128][40]
const int8_t ff_cb2_vects [128][40]
const uint16_t ff_cb1_base [128]
const uint16_t ff_cb2_base [128]
const int16_t ff_energy_tab [32]
static const int16_t lpc_refl_cb1 [64]
static const int16_t lpc_refl_cb2 [32]
static const int16_t lpc_refl_cb3 [32]
static const int16_t lpc_refl_cb4 [16]
static const int16_t lpc_refl_cb5 [16]
static const int16_t lpc_refl_cb6 [8]
static const int16_t lpc_refl_cb7 [8]
static const int16_t lpc_refl_cb8 [8]
static const int16_t lpc_refl_cb9 [8]
static const int16_t lpc_refl_cb10 [4]
const int16_t *const ff_lpc_refl_cb [10]


Function Documentation

static void ff_add_wav ( int16_t dest,
int  n,
int  skip_first,
int *  m,
const int16_t s1,
const int8_t *  s2,
const int8_t *  s3 
) [static]

Definition at line 1506 of file ra144.c.

Referenced by ff_subblock_synthesis().

void ff_copy_and_dup ( int16_t target,
const int16_t source,
int  offset 
)

Copy the last offset values of *source to *target.

If those values are not enough to fill the target buffer, fill it with another copy of those values.

Definition at line 1529 of file ra144.c.

Referenced by ff_subblock_synthesis(), and ra144_encode_subblock().

void ff_eval_coefs ( int *  coefs,
const int *  refl 
)

Evaluate the LPC filter coefficients from the reflection coefficients.

Does the inverse of the ff_eval_refl() function.

Definition at line 1585 of file ra144.c.

Referenced by ra144_decode_frame(), and ra144_encode_frame().

int ff_eval_refl ( int *  refl,
const int16_t coefs,
AVCodecContext avctx 
)

Evaluate the reflection coefficients from the filter coefficients.

Returns:
1 if one of the reflection coefficients is greater than 4095, 0 if not.

Definition at line 1544 of file ra144.c.

Referenced by ff_interp(), and ra144_encode_frame().

void ff_int_to_int16 ( int16_t out,
const int *  inp 
)

Definition at line 1605 of file ra144.c.

Referenced by ff_interp(), ra144_decode_frame(), and ra144_encode_frame().

int ff_interp ( RA144Context ractx,
int16_t out,
int  a,
int  copyold,
int  energy 
)

Definition at line 1649 of file ra144.c.

Referenced by ra144_decode_frame(), and ra144_encode_frame().

int ff_irms ( const int16_t data  ) 

inverse root mean square

Definition at line 1676 of file ra144.c.

Referenced by ff_subblock_synthesis(), and ra144_encode_subblock().

unsigned int ff_rescale_rms ( unsigned int  rms,
unsigned int  energy 
)

Definition at line 1670 of file ra144.c.

Referenced by ff_interp(), ra144_decode_frame(), and ra144_encode_frame().

unsigned int ff_rms ( const int *  data  ) 

Definition at line 1628 of file ra144.c.

Referenced by ff_interp(), ra144_decode_frame(), and ra144_encode_frame().

void ff_subblock_synthesis ( RA144Context ractx,
const uint16_t *  lpc_coefs,
int  cba_idx,
int  cb1_idx,
int  cb2_idx,
int  gval,
int  gain 
)

Definition at line 1689 of file ra144.c.

Referenced by do_output_subblock(), and ra144_encode_subblock().

int ff_t_sqrt ( unsigned int  x  ) 

Evaluate sqrt(x << 24).

x must fit in 20 bits. This value is evaluated in an odd way to make the output identical to the binary decoder.

Definition at line 1617 of file ra144.c.

Referenced by ff_irms(), ff_rms(), ra144_decode_frame(), and ra144_encode_frame().


Variable Documentation

const uint16_t ff_cb1_base[128]

Initial value:

{
    19657, 18474, 18365, 17520, 21048, 18231, 18584, 16671,
    20363, 19069, 19409, 18430, 21844, 18753, 19613, 17411,
    20389, 21772, 20129, 21702, 20978, 20472, 19627, 19387,
    21477, 23134, 21841, 23919, 22089, 21519, 21134, 20852,
    19675, 17821, 19044, 17477, 19986, 16955, 18446, 16086,
    21138, 18899, 20952, 18929, 21452, 17833, 20104, 17159,
    19770, 20056, 20336, 20866, 19329, 18217, 18908, 18004,
    21556, 21948, 23079, 23889, 20922, 19544, 20984, 19781,
    19781, 20984, 19544, 20922, 23889, 23079, 21948, 21556,
    18004, 18908, 18217, 19329, 20866, 20336, 20056, 19770,
    17159, 20104, 17833, 21452, 18929, 20952, 18899, 21138,
    16086, 18446, 16955, 19986, 17477, 19044, 17821, 19675,
    20852, 21134, 21519, 22089, 23919, 21841, 23134, 21477,
    19387, 19627, 20472, 20978, 21702, 20129, 21772, 20389,
    17411, 19613, 18753, 21844, 18430, 19409, 19069, 20363,
    16671, 18584, 18231, 21048, 17520, 18365, 18474, 19657,
}

Definition at line 1401 of file ra144.c.

Referenced by ff_subblock_synthesis(), and ra144_encode_subblock().

const int8_t ff_cb1_vects[128][40]

Definition at line 113 of file ra144.c.

Referenced by ff_subblock_synthesis(), fixed_cb_search(), and ra144_encode_subblock().

const uint16_t ff_cb2_base[128]

Initial value:

{
    12174, 13380, 13879, 13832, 13170, 13227, 13204, 12053,
    12410, 13988, 14348, 14631, 13100, 13415, 13224, 12268,
    11982, 13825, 13499, 14210, 13877, 14788, 13811, 13109,
    11449, 13275, 12833, 13717, 12728, 13696, 12759, 12405,
    10230, 12185, 11628, 13161, 11762, 13458, 12312, 12818,
    10443, 12773, 12011, 14020, 11818, 13825, 12453, 13226,
    10446, 13162, 11881, 14300, 12859, 16288, 13490, 15053,
    10155, 12820, 11519, 13973, 12041, 15081, 12635, 14198,
    14198, 12635, 15081, 12041, 13973, 11519, 12820, 10155,
    15053, 13490, 16288, 12859, 14300, 11881, 13162, 10446,
    13226, 12453, 13825, 11818, 14020, 12011, 12773, 10443,
    12818, 12312, 13458, 11762, 13161, 11628, 12185, 10230,
    12405, 12759, 13696, 12728, 13717, 12833, 13275, 11449,
    13109, 13811, 14788, 13877, 14210, 13499, 13825, 11982,
    12268, 13224, 13415, 13100, 14631, 14348, 13988, 12410,
    12053, 13204, 13227, 13170, 13832, 13879, 13380, 12174,
}

Definition at line 1420 of file ra144.c.

Referenced by ff_subblock_synthesis(), and ra144_encode_subblock().

const int8_t ff_cb2_vects[128][40]

Definition at line 757 of file ra144.c.

Referenced by ff_subblock_synthesis(), fixed_cb_search(), and ra144_encode_subblock().

Initial value:

{
        0,    16,    20,    25,    32,    41,    51,    65,
       81,   103,   129,   163,   205,   259,   326,   410,
      516,   650,   819,  1031,  1298,  1634,  2057,  2590,
     3261,  4105,  5168,  6507,  8192, 10313, 12983, 16345
}

Definition at line 1439 of file ra144.c.

Referenced by ra144_decode_frame(), and ra144_encode_frame().

Initial value:

 {
   15, 15, 15, 15, 15, 16, 14, 15, 14, 14, 14, 14, 14, 14, 14, 14,
   14, 13, 14, 14, 13, 14, 13, 14, 13, 13, 13, 14, 13, 13, 14, 13,
   13, 13, 13, 13, 14, 13, 12, 12, 13, 13, 13, 12, 13, 13, 13, 13,
   13, 12, 13, 13, 12, 12, 13, 13, 13, 13, 14, 14, 13, 13, 13, 13,
   13, 13, 13, 12, 12, 12, 13, 13, 12, 12, 12, 13, 12, 12, 12, 12,
   12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12,
   12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 13, 13, 13, 13,
   13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14,
   13, 12, 12, 11, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
   12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 11, 11, 11, 11,
   12, 12, 12, 12, 11, 11, 12, 12, 12, 12, 12, 13, 12, 12, 12, 13,
   12, 12, 13, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14,
   12, 12, 11, 11, 12, 12, 12, 12, 11, 12, 11, 12, 12, 12, 12, 12,
   13, 13, 12, 12, 13, 13, 13, 14, 12, 13, 13, 13, 13, 13, 13, 13,
   11, 10, 11, 10, 11, 11, 10, 10, 11, 11, 11, 11, 10,  9, 11, 10,
   12, 12, 11, 12, 12, 12, 12, 13, 11, 12, 12, 12, 13, 13, 12, 12
}

Definition at line 94 of file ra144.c.

Referenced by ff_add_wav(), and ra144_encode_subblock().

const int16_t ff_gain_val_tab[256][3]

Definition at line 27 of file ra144.c.

Referenced by ff_add_wav(), and ra144_encode_subblock().

const int16_t* const ff_lpc_refl_cb[10]

const int16_t lpc_refl_cb1[64] [static]

Initial value:

{
    -4041, -4018, -3998, -3977, -3954, -3930, -3906, -3879,
    -3852, -3825, -3795, -3764, -3731, -3699, -3666, -3631,
    -3594, -3555, -3513, -3468, -3420, -3372, -3321, -3268,
    -3212, -3153, -3090, -3021, -2944, -2863, -2772, -2676,
    -2565, -2445, -2328, -2202, -2072, -1941, -1808, -1660,
    -1508, -1348, -1185,  -994,  -798,  -600,  -374,  -110,
      152,   447,   720,   982,  1229,  1456,  1682,  1916,
     2130,  2353,  2595,  2853,  3118,  3363,  3588,  3814
}

Definition at line 1446 of file ra144.c.

const int16_t lpc_refl_cb10[4] [static]

Initial value:

{
     -617,   190,   802,  1483
}

Definition at line 1497 of file ra144.c.

const int16_t lpc_refl_cb2[32] [static]

Initial value:

{
    -3091, -2386, -1871, -1425, -1021,  -649,  -316,   -20,
      267,   544,   810,  1065,  1305,  1534,  1756,  1970,
     2171,  2359,  2536,  2700,  2854,  2996,  3133,  3263,
     3386,  3499,  3603,  3701,  3789,  3870,  3947,  4020
}

Definition at line 1457 of file ra144.c.

const int16_t lpc_refl_cb3[32] [static]

Initial value:

{
    -3525, -3295, -3081, -2890, -2696, -2511, -2328, -2149,
    -1979, -1817, -1658, -1498, -1341, -1188, -1032,  -876,
     -721,  -561,  -394,  -228,   -54,   119,   296,   484,
      683,   895,  1123,  1373,  1651,  1965,  2360,  2854
}

Definition at line 1464 of file ra144.c.

const int16_t lpc_refl_cb4[16] [static]

Initial value:

{
    -1845, -1057,  -522,   -77,   301,   647,   975,  1285,
     1582,  1873,  2163,  2452,  2735,  3017,  3299,  3569
}

Definition at line 1471 of file ra144.c.

const int16_t lpc_refl_cb5[16] [static]

Initial value:

{
    -2691, -2187, -1788, -1435, -1118,  -837,  -571,  -316,
      -59,   201,   470,   759,  1077,  1457,  1908,  2495
}

Definition at line 1476 of file ra144.c.

const int16_t lpc_refl_cb6[8] [static]

Initial value:

{
    -1372,  -474,   133,   632,  1100,  1571,  2075,  2672
}

Definition at line 1481 of file ra144.c.

const int16_t lpc_refl_cb7[8] [static]

Initial value:

{
    -2389, -1787, -1231,  -717,  -239,   234,   770,  1474
}

Definition at line 1485 of file ra144.c.

const int16_t lpc_refl_cb8[8] [static]

Initial value:

{
    -1569,  -864,  -296,   200,   670,  1151,  1709,  2385
}

Definition at line 1489 of file ra144.c.

const int16_t lpc_refl_cb9[8] [static]

Initial value:

{
    -2200, -1608, -1062,  -569,  -120,   338,   863,  1621
}

Definition at line 1493 of file ra144.c.


Generated on Fri Oct 26 02:47:58 2012 for FFmpeg by  doxygen 1.5.8