00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVCODEC_RA144_H
00023 #define AVCODEC_RA144_H
00024
00025 #include <stdint.h>
00026 #include "lpc.h"
00027
00028 #define NBLOCKS 4
00029 #define BLOCKSIZE 40
00030 #define BUFFERSIZE 146
00031 #define FIXED_CB_SIZE 128
00032 #define FRAMESIZE 20
00033 #define LPC_ORDER 10
00034
00035 typedef struct {
00036 AVCodecContext *avctx;
00037 AVFrame frame;
00038 LPCContext lpc_ctx;
00039
00040 unsigned int old_energy;
00041
00042 unsigned int lpc_tables[2][10];
00043
00046 unsigned int *lpc_coef[2];
00047
00048 unsigned int lpc_refl_rms[2];
00049
00050 int16_t curr_block[NBLOCKS * BLOCKSIZE];
00051
00053 int16_t curr_sblock[50];
00054
00057 uint16_t adapt_cb[146+2];
00058 } RA144Context;
00059
00060 void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset);
00061 int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
00062 void ff_eval_coefs(int *coefs, const int *refl);
00063 void ff_int_to_int16(int16_t *out, const int *inp);
00064 int ff_t_sqrt(unsigned int x);
00065 unsigned int ff_rms(const int *data);
00066 int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold,
00067 int energy);
00068 unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy);
00069 int ff_irms(const int16_t *data);
00070 void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs,
00071 int cba_idx, int cb1_idx, int cb2_idx,
00072 int gval, int gain);
00073
00074 extern const int16_t ff_gain_val_tab[256][3];
00075 extern const uint8_t ff_gain_exp_tab[256];
00076 extern const int8_t ff_cb1_vects[128][40];
00077 extern const int8_t ff_cb2_vects[128][40];
00078 extern const uint16_t ff_cb1_base[128];
00079 extern const uint16_t ff_cb2_base[128];
00080 extern const int16_t ff_energy_tab[32];
00081 extern const int16_t * const ff_lpc_refl_cb[10];
00082
00083 #endif