Libav 0.7.1
|
00001 /* 00002 * Real Audio 1.0 (14.4K) 00003 * Copyright (c) 2003 the ffmpeg project 00004 * 00005 * This file is part of Libav. 00006 * 00007 * Libav is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * Libav is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with Libav; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 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 ///< number of subblocks within a block 00029 #define BLOCKSIZE 40 ///< subblock size in 16-bit words 00030 #define BUFFERSIZE 146 ///< the size of the adaptive codebook 00031 #define FIXED_CB_SIZE 128 ///< size of fixed codebooks 00032 #define FRAMESIZE 20 ///< size of encoded frame 00033 #define LPC_ORDER 10 ///< order of LPC filter 00034 00035 typedef struct { 00036 AVCodecContext *avctx; 00037 LPCContext lpc_ctx; 00038 00039 unsigned int old_energy; 00040 00041 unsigned int lpc_tables[2][10]; 00042 00045 unsigned int *lpc_coef[2]; 00046 00047 unsigned int lpc_refl_rms[2]; 00048 00049 int16_t curr_block[NBLOCKS * BLOCKSIZE]; 00050 00052 int16_t curr_sblock[50]; 00053 00056 uint16_t adapt_cb[146+2]; 00057 } RA144Context; 00058 00059 void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset); 00060 int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx); 00061 void ff_eval_coefs(int *coefs, const int *refl); 00062 void ff_int_to_int16(int16_t *out, const int *inp); 00063 int ff_t_sqrt(unsigned int x); 00064 unsigned int ff_rms(const int *data); 00065 int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold, 00066 int energy); 00067 unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy); 00068 int ff_irms(const int16_t *data); 00069 void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs, 00070 int cba_idx, int cb1_idx, int cb2_idx, 00071 int gval, int gain); 00072 00073 extern const int16_t ff_gain_val_tab[256][3]; 00074 extern const uint8_t ff_gain_exp_tab[256]; 00075 extern const int8_t ff_cb1_vects[128][40]; 00076 extern const int8_t ff_cb2_vects[128][40]; 00077 extern const uint16_t ff_cb1_base[128]; 00078 extern const uint16_t ff_cb2_base[128]; 00079 extern const int16_t ff_energy_tab[32]; 00080 extern const int16_t * const ff_lpc_refl_cb[10]; 00081 00082 #endif /* AVCODEC_RA144_H */