ra144.h
Go to the documentation of this file.
1 /*
2  * Real Audio 1.0 (14.4K)
3  * Copyright (c) 2003 the ffmpeg project
4  *
5  * This file is part of Libav.
6  *
7  * Libav 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  * Libav 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 Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVCODEC_RA144_H
23 #define AVCODEC_RA144_H
24 
25 #include <stdint.h>
26 #include "lpc.h"
27 
28 #define NBLOCKS 4
29 #define BLOCKSIZE 40
30 #define BUFFERSIZE 146
31 #define FIXED_CB_SIZE 128
32 #define FRAMESIZE 20
33 #define LPC_ORDER 10
34 
35 typedef struct {
39 
40  unsigned int old_energy;
41 
42  unsigned int lpc_tables[2][10];
43 
46  unsigned int *lpc_coef[2];
47 
48  unsigned int lpc_refl_rms[2];
49 
50  int16_t curr_block[NBLOCKS * BLOCKSIZE];
51 
53  int16_t curr_sblock[50];
54 
57  uint16_t adapt_cb[146+2];
58 } RA144Context;
59 
60 void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset);
61 int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
62 void ff_eval_coefs(int *coefs, const int *refl);
63 void ff_int_to_int16(int16_t *out, const int *inp);
64 int ff_t_sqrt(unsigned int x);
65 unsigned int ff_rms(const int *data);
66 int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold,
67  int energy);
68 unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy);
69 int ff_irms(const int16_t *data);
70 void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs,
71  int cba_idx, int cb1_idx, int cb2_idx,
72  int gval, int gain);
73 
74 extern const int16_t ff_gain_val_tab[256][3];
75 extern const uint8_t ff_gain_exp_tab[256];
76 extern const int8_t ff_cb1_vects[128][40];
77 extern const int8_t ff_cb2_vects[128][40];
78 extern const uint16_t ff_cb1_base[128];
79 extern const uint16_t ff_cb2_base[128];
80 extern const int16_t ff_energy_tab[32];
81 extern const int16_t * const ff_lpc_refl_cb[10];
82 
83 #endif /* AVCODEC_RA144_H */
unsigned int ff_rms(const int *data)
Definition: ra144.c:1628
Audio Video Frame.
Definition: avcodec.h:985
Definition: lpc.h:50
const uint16_t ff_cb1_base[128]
Definition: ra144.c:1401
#define NBLOCKS
number of subblocks within a block
Definition: ra144.h:28
const int16_t ff_energy_tab[32]
Definition: ra144.c:1439
const char data[16]
Definition: mxf.c:60
int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
Evaluate the reflection coefficients from the filter coefficients.
Definition: ra144.c:1544
AVCodecContext * avctx
Definition: ra144.h:36
void ff_int_to_int16(int16_t *out, const int *inp)
Definition: ra144.c:1605
int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold, int energy)
Definition: ra144.c:1649
const int8_t ff_cb2_vects[128][40]
Definition: ra144.c:757
unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy)
Definition: ra144.c:1670
AVFrame frame
Definition: ra144.h:37
int ff_irms(const int16_t *data)
inverse root mean square
Definition: ra144.c:1676
#define BLOCKSIZE
subblock size in 16-bit words
Definition: ra144.h:29
const int8_t ff_cb1_vects[128][40]
Definition: ra144.c:113
const int16_t ff_gain_val_tab[256][3]
Definition: ra144.c:27
main external API structure.
Definition: avcodec.h:1329
void ff_eval_coefs(int *coefs, const int *refl)
Evaluate the LPC filter coefficients from the reflection coefficients.
Definition: ra144.c:1585
void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset)
Copy the last offset values of *source to *target.
Definition: ra144.c:1529
LPCContext lpc_ctx
Definition: ra144.h:38
const uint16_t ff_cb2_base[128]
Definition: ra144.c:1420
unsigned int old_energy
previous frame energy
Definition: ra144.h:40
int ff_t_sqrt(unsigned int x)
Evaluate sqrt(x << 24).
Definition: ra144.c:1617
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: ra144.c:1689
const uint8_t ff_gain_exp_tab[256]
Definition: ra144.c:94
const int16_t *const ff_lpc_refl_cb[10]
Definition: ra144.c:1501