annotate ra144.h @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 6b1a63ea6e61
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
1 /*
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
2 * Real Audio 1.0 (14.4K)
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
3 * Copyright (c) 2003 the ffmpeg project
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
4 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
5 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
6 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
11 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
15 * Lesser General Public License for more details.
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
16 *
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3036
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
20 */
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
21
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 7129
diff changeset
22 #ifndef AVCODEC_RA144_H
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 7129
diff changeset
23 #define AVCODEC_RA144_H
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
24
7044
ab9533fb9335 Add missing #includes to fix 'make checkheaders'.
diego
parents: 6883
diff changeset
25 #include <stdint.h>
11870
6b1a63ea6e61 RealAudio 14.4k encoder.
vitor
parents: 11868
diff changeset
26 #include "dsputil.h"
7044
ab9533fb9335 Add missing #includes to fix 'make checkheaders'.
diego
parents: 6883
diff changeset
27
11865
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
28 #define NBLOCKS 4 ///< number of subblocks within a block
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
29 #define BLOCKSIZE 40 ///< subblock size in 16-bit words
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
30 #define BUFFERSIZE 146 ///< the size of the adaptive codebook
11870
6b1a63ea6e61 RealAudio 14.4k encoder.
vitor
parents: 11868
diff changeset
31 #define FIXED_CB_SIZE 128 ///< size of fixed codebooks
6b1a63ea6e61 RealAudio 14.4k encoder.
vitor
parents: 11868
diff changeset
32 #define FRAMESIZE 20 ///< size of encoded frame
6b1a63ea6e61 RealAudio 14.4k encoder.
vitor
parents: 11868
diff changeset
33 #define LPC_ORDER 10 ///< order of LPC filter
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
34
11865
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
35 typedef struct {
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
36 AVCodecContext *avctx;
11870
6b1a63ea6e61 RealAudio 14.4k encoder.
vitor
parents: 11868
diff changeset
37 DSPContext dsp;
11865
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
38
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
39 unsigned int old_energy; ///< previous frame energy
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
40
11865
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
41 unsigned int lpc_tables[2][10];
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
42
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
43 /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
44 * and lpc_coef[1] of the previous one. */
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
45 unsigned int *lpc_coef[2];
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
46
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
47 unsigned int lpc_refl_rms[2];
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
48
11870
6b1a63ea6e61 RealAudio 14.4k encoder.
vitor
parents: 11868
diff changeset
49 int16_t curr_block[NBLOCKS * BLOCKSIZE];
6b1a63ea6e61 RealAudio 14.4k encoder.
vitor
parents: 11868
diff changeset
50
11865
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
51 /** The current subblock padded by the last 10 values of the previous one. */
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
52 int16_t curr_sblock[50];
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
53
11865
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
54 /** Adaptive codebook, its size is two units bigger to avoid a
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
55 * buffer overflow. */
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
56 uint16_t adapt_cb[146+2];
6111134a3d94 Split ra144.c in common code (to be shared with the future encoder) and
vitor
parents: 7835
diff changeset
57 } RA144Context;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1335
diff changeset
58
11866
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
59 void ff_add_wav(int16_t *dest, int n, int skip_first, int *m, const int16_t *s1,
11867
ba4e21f7bd3a Cosmetics: indent
vitor
parents: 11866
diff changeset
60 const int8_t *s2, const int8_t *s3);
11866
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
61 void ff_copy_and_dup(int16_t *target, const int16_t *source, int offset);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
62 int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
63 void ff_eval_coefs(int *coefs, const int *refl);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
64 void ff_int_to_int16(int16_t *out, const int *inp);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
65 int ff_t_sqrt(unsigned int x);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
66 unsigned int ff_rms(const int *data);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
67 int ff_interp(RA144Context *ractx, int16_t *out, int a, int copyold,
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
68 int energy);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
69 unsigned int ff_rescale_rms(unsigned int rms, unsigned int energy);
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
70 int ff_irms(const int16_t *data);
11868
159554445343 Split do_output_subblock() into common code and decoder specific parts
vitor
parents: 11867
diff changeset
71 void ff_subblock_synthesis(RA144Context *ractx, const uint16_t *lpc_coefs,
159554445343 Split do_output_subblock() into common code and decoder specific parts
vitor
parents: 11867
diff changeset
72 int cba_idx, int cb1_idx, int cb2_idx,
159554445343 Split do_output_subblock() into common code and decoder specific parts
vitor
parents: 11867
diff changeset
73 int gval, int gain);
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
74
11866
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
75 extern const int16_t ff_gain_val_tab[256][3];
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
76 extern const uint8_t ff_gain_exp_tab[256];
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
77 extern const int8_t ff_cb1_vects[128][40];
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
78 extern const int8_t ff_cb2_vects[128][40];
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
79 extern const uint16_t ff_cb1_base[128];
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
80 extern const uint16_t ff_cb2_base[128];
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
81 extern const int16_t ff_energy_tab[32];
0d8f35836b20 Add ff_ prefix to non-static functions
vitor
parents: 11865
diff changeset
82 extern const int16_t * const ff_lpc_refl_cb[10];
1335
b4a72edb3a71 moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
diff changeset
83
7760
c4a4495715dd Globally rename the header inclusion guard names.
stefano
parents: 7129
diff changeset
84 #endif /* AVCODEC_RA144_H */