ffmpeg / libavcodec / ra144.h @ 756e3467
History  View  Annotate  Download (2.87 KB)
1 
/*


2 
* Real Audio 1.0 (14.4K)

3 
* Copyright (c) 2003 the ffmpeg project

4 
*

5 
* This file is part of FFmpeg.

6 
*

7 
* FFmpeg is free software; you can redistribute it and/or

8 
* modify it under the terms of the GNU Lesser General Public

9 
* License as published by the Free Software Foundation; either

10 
* version 2.1 of the License, or (at your option) any later version.

11 
*

12 
* FFmpeg is distributed in the hope that it will be useful,

13 
* but WITHOUT ANY WARRANTY; without even the implied warranty of

14 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU

15 
* Lesser General Public License for more details.

16 
*

17 
* You should have received a copy of the GNU Lesser General Public

18 
* License along with FFmpeg; if not, write to the Free Software

19 
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 021101301 USA

20 
*/

21  
22 
#ifndef AVCODEC_RA144_H

23 
#define AVCODEC_RA144_H

24  
25 
#include <stdint.h> 
26  
27 
#define NBLOCKS 4 ///< number of subblocks within a block 
28 
#define BLOCKSIZE 40 ///< subblock size in 16bit words 
29 
#define BUFFERSIZE 146 ///< the size of the adaptive codebook 
30  
31 
typedef struct { 
32 
AVCodecContext *avctx; 
33  
34 
unsigned int old_energy; ///< previous frame energy 
35  
36 
unsigned int lpc_tables[2][10]; 
37  
38 
/** LPC coefficients: lpc_coef[0] is the coefficients of the current frame

39 
* and lpc_coef[1] of the previous one. */

40 
unsigned int *lpc_coef[2]; 
41  
42 
unsigned int lpc_refl_rms[2]; 
43  
44 
/** The current subblock padded by the last 10 values of the previous one. */

45 
int16_t curr_sblock[50];

46  
47 
/** Adaptive codebook, its size is two units bigger to avoid a

48 
* buffer overflow. */

49 
uint16_t adapt_cb[146+2]; 
50 
} RA144Context; 
51  
52 
void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1, 
53 
const int8_t *s2, const int8_t *s3); 
54 
void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset); 
55 
int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx); 
56 
void ff_eval_coefs(int *coefs, const int *refl); 
57 
void ff_int_to_int16(int16_t *out, const int *inp); 
58 
int ff_t_sqrt(unsigned int x); 
59 
unsigned int ff_rms(const int *data); 
60 
int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold, 
61 
int energy);

62 
unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy); 
63 
int ff_irms(const int16_t *data); 
64 
void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs, 
65 
int cba_idx, int cb1_idx, int cb2_idx, 
66 
int gval, int gain); 
67  
68 
extern const int16_t ff_gain_val_tab[256][3]; 
69 
extern const uint8_t ff_gain_exp_tab[256]; 
70 
extern const int8_t ff_cb1_vects[128][40]; 
71 
extern const int8_t ff_cb2_vects[128][40]; 
72 
extern const uint16_t ff_cb1_base[128]; 
73 
extern const uint16_t ff_cb2_base[128]; 
74 
extern const int16_t ff_energy_tab[32]; 
75 
extern const int16_t * const ff_lpc_refl_cb[10]; 
76  
77 
#endif /* AVCODEC_RA144_H */ 