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 #include "audio_frame_queue.h"
00028
00029 #define NBLOCKS 4
00030 #define BLOCKSIZE 40
00031 #define BUFFERSIZE 146
00032 #define FIXED_CB_SIZE 128
00033 #define FRAMESIZE 20
00034 #define LPC_ORDER 10
00035
00036 typedef struct {
00037 AVCodecContext *avctx;
00038 AVFrame frame;
00039 LPCContext lpc_ctx;
00040 AudioFrameQueue afq;
00041 int last_frame;
00042
00043 unsigned int old_energy;
00044
00045 unsigned int lpc_tables[2][10];
00046
00049 unsigned int *lpc_coef[2];
00050
00051 unsigned int lpc_refl_rms[2];
00052
00053 int16_t curr_block[NBLOCKS * BLOCKSIZE];
00054
00056 int16_t curr_sblock[50];
00057
00060 uint16_t adapt_cb[146+2];
00061 } RA144Context;
00062
00063 void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset);
00064 int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
00065 void ff_eval_coefs(int *coefs, const int *refl);
00066 void ff_int_to_int16(int16_t *out, const int *inp);
00067 int ff_t_sqrt(unsigned int x);
00068 unsigned int ff_rms(const int *data);
00069 int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold,
00070 int energy);
00071 unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy);
00072 int ff_irms(const int16_t *data);
00073 void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs,
00074 int cba_idx, int cb1_idx, int cb2_idx,
00075 int gval, int gain);
00076
00077 extern const int16_t ff_gain_val_tab[256][3];
00078 extern const uint8_t ff_gain_exp_tab[256];
00079 extern const int8_t ff_cb1_vects[128][40];
00080 extern const int8_t ff_cb2_vects[128][40];
00081 extern const uint16_t ff_cb1_base[128];
00082 extern const uint16_t ff_cb2_base[128];
00083 extern const int16_t ff_energy_tab[32];
00084 extern const int16_t * const ff_lpc_refl_cb[10];
00085
00086 #endif