Mercurial > libavcodec.hg
annotate ra288.c @ 8240:d3d0d9cc0e50 libavcodec
Commit last ok'ed parts of QCELP decoder and enable it.
patch by Kenan Gillet, kenan.gillet gmail com
author | vitor |
---|---|
date | Tue, 02 Dec 2008 16:48:05 +0000 |
parents | 36671e6689c7 |
children | 19bbd1457372 |
rev | line source |
---|---|
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
1 /* |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
2 * RealAudio 2.0 (28.8K) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
3 * Copyright (c) 2003 the ffmpeg project |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
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 |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
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. |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
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, |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
16 * |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
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:
2979
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
20 */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
21 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
22 #include "avcodec.h" |
7171 | 23 #define ALT_BITSTREAM_READER_LE |
24 #include "bitstream.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:
1316
diff
changeset
|
25 #include "ra288.h" |
7788
ffd4b1364b62
Avoid duplicating compute_lpc_coefs() function in both the RA288 and AAC decoders.
vitor
parents:
7505
diff
changeset
|
26 #include "lpc.h" |
8094 | 27 #include "celp_math.h" |
2967 | 28 |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
29 typedef struct { |
7439 | 30 float sp_lpc[36]; ///< LPC coefficients for speech data (spec: A) |
7849 | 31 float gain_lpc[10]; ///< LPC coefficients for gain (spec: GB) |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
32 |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
33 /** speech data history (spec: SB). |
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
34 * Its first 70 coefficients are updated only at backward filtering. |
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
35 */ |
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
36 float sp_hist[111]; |
7418
83d005a098b5
Rename st{1,2}{a,b} context variables to more meaningful names: {sp,gain}_{rec,hist}
vitor
parents:
7416
diff
changeset
|
37 |
7849 | 38 /// speech part of the gain autocorrelation (spec: REXP) |
7418
83d005a098b5
Rename st{1,2}{a,b} context variables to more meaningful names: {sp,gain}_{rec,hist}
vitor
parents:
7416
diff
changeset
|
39 float sp_rec[37]; |
83d005a098b5
Rename st{1,2}{a,b} context variables to more meaningful names: {sp,gain}_{rec,hist}
vitor
parents:
7416
diff
changeset
|
40 |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
41 /** log-gain history (spec: SBLG). |
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
42 * Its first 28 coefficients are updated only at backward filtering. |
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
43 */ |
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
44 float gain_hist[38]; |
7418
83d005a098b5
Rename st{1,2}{a,b} context variables to more meaningful names: {sp,gain}_{rec,hist}
vitor
parents:
7416
diff
changeset
|
45 |
7849 | 46 /// recursive part of the gain autocorrelation (spec: REXPLG) |
7418
83d005a098b5
Rename st{1,2}{a,b} context variables to more meaningful names: {sp,gain}_{rec,hist}
vitor
parents:
7416
diff
changeset
|
47 float gain_rec[11]; |
7411
d41948bf80a1
Give the context structure of ra288 a better name: s/Real288_internal/RA288Context/
vitor
parents:
7375
diff
changeset
|
48 } RA288Context; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
49 |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7449
diff
changeset
|
50 static av_cold int ra288_decode_init(AVCodecContext *avctx) |
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7449
diff
changeset
|
51 { |
7874
29010c2697da
Use SAMPLE_FMT_FLT instead of doing the float->int conversion in the
vitor
parents:
7854
diff
changeset
|
52 avctx->sample_fmt = SAMPLE_FMT_FLT; |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7449
diff
changeset
|
53 return 0; |
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7449
diff
changeset
|
54 } |
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7449
diff
changeset
|
55 |
7848 | 56 static void apply_window(float *tgt, const float *m1, const float *m2, int n) |
7415
649496faa1d2
Move colmult() function to the beginning of file to group DSP-related functions.
vitor
parents:
7414
diff
changeset
|
57 { |
649496faa1d2
Move colmult() function to the beginning of file to group DSP-related functions.
vitor
parents:
7414
diff
changeset
|
58 while (n--) |
7416 | 59 *tgt++ = *m1++ * *m2++; |
7415
649496faa1d2
Move colmult() function to the beginning of file to group DSP-related functions.
vitor
parents:
7414
diff
changeset
|
60 } |
649496faa1d2
Move colmult() function to the beginning of file to group DSP-related functions.
vitor
parents:
7414
diff
changeset
|
61 |
7916
2a4c42e6aecb
Cosmetics: move convolve() together with the other DSP functions
vitor
parents:
7915
diff
changeset
|
62 static void convolve(float *tgt, const float *src, int len, int n) |
2a4c42e6aecb
Cosmetics: move convolve() together with the other DSP functions
vitor
parents:
7915
diff
changeset
|
63 { |
2a4c42e6aecb
Cosmetics: move convolve() together with the other DSP functions
vitor
parents:
7915
diff
changeset
|
64 for (; n >= 0; n--) |
8094 | 65 tgt[n] = ff_dot_productf(src, src - n, len); |
7916
2a4c42e6aecb
Cosmetics: move convolve() together with the other DSP functions
vitor
parents:
7915
diff
changeset
|
66 |
2a4c42e6aecb
Cosmetics: move convolve() together with the other DSP functions
vitor
parents:
7915
diff
changeset
|
67 } |
2a4c42e6aecb
Cosmetics: move convolve() together with the other DSP functions
vitor
parents:
7915
diff
changeset
|
68 |
7412
51da3d8200d0
Give the context variables of ra288 a better name: s/glob/ractx/
vitor
parents:
7411
diff
changeset
|
69 static void decode(RA288Context *ractx, float gain, int cb_coef) |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
70 { |
7448 | 71 int i, j; |
7268
7e51fc7805ac
Do not declare as double a var that only stores a float
vitor
parents:
7267
diff
changeset
|
72 double sumsum; |
7e51fc7805ac
Do not declare as double a var that only stores a float
vitor
parents:
7267
diff
changeset
|
73 float sum, buffer[5]; |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
74 float *block = ractx->sp_hist + 70 + 36; // current block |
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
75 float *gain_block = ractx->gain_hist + 28; |
7167 | 76 |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
77 memmove(ractx->sp_hist + 70, ractx->sp_hist + 75, 36*sizeof(*block)); |
7167 | 78 |
7431
da24b77f46f6
Add a few comments pointing to the G.728 specification
vitor
parents:
7430
diff
changeset
|
79 /* block 46 of G.728 spec */ |
7503
d85a0a151344
Flip (by making buf[i] -> buf[size-i-1]) two buffers: {sp,gain}_block. This
vitor
parents:
7492
diff
changeset
|
80 sum = 32.; |
d85a0a151344
Flip (by making buf[i] -> buf[size-i-1]) two buffers: {sp,gain}_block. This
vitor
parents:
7492
diff
changeset
|
81 for (i=0; i < 10; i++) |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
82 sum -= gain_block[9-i] * ractx->gain_lpc[i]; |
7167 | 83 |
7431
da24b77f46f6
Add a few comments pointing to the G.728 specification
vitor
parents:
7430
diff
changeset
|
84 /* block 47 of G.728 spec */ |
7269 | 85 sum = av_clipf(sum, 0, 60); |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
86 |
7431
da24b77f46f6
Add a few comments pointing to the G.728 specification
vitor
parents:
7430
diff
changeset
|
87 /* block 48 of G.728 spec */ |
7915 | 88 /* exp(sum * 0.1151292546497) == pow(10.0,sum/20) */ |
7925
9dc65bb3bd3f
Do instead of divising a float by a constant, multiply by its inverse
vitor
parents:
7917
diff
changeset
|
89 sumsum = exp(sum * 0.1151292546497) * gain * (1.0/(1<<23)); |
7167 | 90 |
7448 | 91 for (i=0; i < 5; i++) |
7915 | 92 buffer[i] = codetable[cb_coef][i] * sumsum; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
93 |
8094 | 94 sum = ff_dot_productf(buffer, buffer, 5) * ((1<<24)/5.); |
7275 | 95 |
96 sum = FFMAX(sum, 1); | |
7167 | 97 |
98 /* shift and store */ | |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
99 memmove(gain_block, gain_block + 1, 9 * sizeof(*gain_block)); |
7167 | 100 |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
101 gain_block[9] = 10 * log10(sum) - 32; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
102 |
7912 | 103 for (i=0; i < 5; i++) { |
7913 | 104 block[i] = buffer[i]; |
7912 | 105 for (j=0; j < 36; j++) |
106 block[i] -= block[i-1-j]*ractx->sp_lpc[j]; | |
107 } | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
108 |
7167 | 109 /* output */ |
7448 | 110 for (i=0; i < 5; i++) |
7917 | 111 block[i] = av_clipf(block[i], -4095./4096., 4095./4096.); |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
112 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
113 |
7367 | 114 /** |
7847 | 115 * Hybrid window filtering, see blocks 36 and 49 of the G.728 specification. |
7367 | 116 * |
7847 | 117 * @param order filter order |
118 * @param n input length | |
119 * @param non_rec number of non-recursive samples | |
120 * @param out filter output | |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
121 * @param hist pointer to the input history of the filter |
7375 | 122 * @param out pointer to the non-recursive part of the output |
7367 | 123 * @param out2 pointer to the recursive part of the output |
124 * @param window pointer to the windowing function table | |
125 */ | |
7854 | 126 static void do_hybrid_window(int order, int n, int non_rec, float *out, |
127 float *hist, float *out2, const float *window) | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
128 { |
7449
18fc253b4991
Do not declare a counter as unsigned when it is not needed
vitor
parents:
7448
diff
changeset
|
129 int i; |
7437
d36ec42eef9c
Declare temporary buffers to be only of the necessary size
vitor
parents:
7436
diff
changeset
|
130 float buffer1[order + 1]; |
d36ec42eef9c
Declare temporary buffers to be only of the necessary size
vitor
parents:
7436
diff
changeset
|
131 float buffer2[order + 1]; |
d36ec42eef9c
Declare temporary buffers to be only of the necessary size
vitor
parents:
7436
diff
changeset
|
132 float work[order + n + non_rec]; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
133 |
7848 | 134 apply_window(work, window, hist, order + n + non_rec); |
2967 | 135 |
7492 | 136 convolve(buffer1, work + order , n , order); |
137 convolve(buffer2, work + order + n, non_rec, order); | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
138 |
7448 | 139 for (i=0; i <= order; i++) { |
140 out2[i] = out2[i] * 0.5625 + buffer1[i]; | |
141 out [i] = out2[i] + buffer2[i]; | |
7167 | 142 } |
7365
031d4866b192
Rename co() function to the much more descriptive name of
vitor
parents:
7364
diff
changeset
|
143 |
7847 | 144 /* Multiply by the white noise correcting factor (WNCF). */ |
7365
031d4866b192
Rename co() function to the much more descriptive name of
vitor
parents:
7364
diff
changeset
|
145 *out *= 257./256.; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
146 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
147 |
7372
e97d0795ee70
Rename update() function to backward_filter() and add a doxy comment
vitor
parents:
7371
diff
changeset
|
148 /** |
7847 | 149 * Backward synthesis filter, find the LPC coefficients from past speech data. |
7372
e97d0795ee70
Rename update() function to backward_filter() and add a doxy comment
vitor
parents:
7371
diff
changeset
|
150 */ |
7929 | 151 static void backward_filter(float *hist, float *rec, const float *window, |
152 float *lpc, const float *tab, | |
153 int order, int n, int non_rec, int move_size) | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
154 { |
7929 | 155 float temp[order+1]; |
7169 | 156 |
7929 | 157 do_hybrid_window(order, n, non_rec, temp, hist, rec, window); |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
158 |
7929 | 159 if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1)) |
160 apply_window(lpc, lpc, tab, order); | |
7853
21ab545aed8b
Simplify: use a single history buffer for gain and a single one for
vitor
parents:
7849
diff
changeset
|
161 |
7929 | 162 memmove(hist, hist + n, move_size*sizeof(*hist)); |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
163 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
164 |
7174 | 165 static int ra288_decode_frame(AVCodecContext * avctx, void *data, |
166 int *data_size, const uint8_t * buf, | |
167 int buf_size) | |
1313 | 168 { |
7874
29010c2697da
Use SAMPLE_FMT_FLT instead of doing the float->int conversion in the
vitor
parents:
7854
diff
changeset
|
169 float *out = data; |
7448 | 170 int i, j; |
7412
51da3d8200d0
Give the context variables of ra288 a better name: s/glob/ractx/
vitor
parents:
7411
diff
changeset
|
171 RA288Context *ractx = avctx->priv_data; |
7173
bc2fd265f52b
Remove unpack() function, read the bitstream as needed
vitor
parents:
7172
diff
changeset
|
172 GetBitContext gb; |
7167 | 173 |
7174 | 174 if (buf_size < avctx->block_align) { |
175 av_log(avctx, AV_LOG_ERROR, | |
176 "Error! Input buffer is too small [%d<%d]\n", | |
177 buf_size, avctx->block_align); | |
178 return 0; | |
179 } | |
180 | |
7874
29010c2697da
Use SAMPLE_FMT_FLT instead of doing the float->int conversion in the
vitor
parents:
7854
diff
changeset
|
181 if (*data_size < 32*5*4) |
7505 | 182 return -1; |
183 | |
7174 | 184 init_get_bits(&gb, buf, avctx->block_align * 8); |
1313 | 185 |
7448 | 186 for (i=0; i < 32; i++) { |
7192 | 187 float gain = amptable[get_bits(&gb, 3)]; |
7448 | 188 int cb_coef = get_bits(&gb, 6 + (i&1)); |
7443 | 189 |
7412
51da3d8200d0
Give the context variables of ra288 a better name: s/glob/ractx/
vitor
parents:
7411
diff
changeset
|
190 decode(ractx, gain, cb_coef); |
7167 | 191 |
7448 | 192 for (j=0; j < 5; j++) |
7917 | 193 *(out++) = ractx->sp_hist[70 + 36 + j]; |
7167 | 194 |
7929 | 195 if ((i & 7) == 3) { |
196 backward_filter(ractx->sp_hist, ractx->sp_rec, syn_window, | |
197 ractx->sp_lpc, syn_bw_tab, 36, 40, 35, 70); | |
198 | |
199 backward_filter(ractx->gain_hist, ractx->gain_rec, gain_window, | |
200 ractx->gain_lpc, gain_bw_tab, 10, 8, 20, 28); | |
201 } | |
7167 | 202 } |
203 | |
7174 | 204 *data_size = (char *)out - (char *)data; |
2956
5f51b1e0bed6
Cook compatibe decoder, patch by Benjamin Larsson
rtognimp
parents:
2288
diff
changeset
|
205 return avctx->block_align; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
206 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
207 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
208 AVCodec ra_288_decoder = |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
209 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
210 "real_288", |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
211 CODEC_TYPE_AUDIO, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
212 CODEC_ID_RA_288, |
7411
d41948bf80a1
Give the context structure of ra288 a better name: s/Real288_internal/RA288Context/
vitor
parents:
7375
diff
changeset
|
213 sizeof(RA288Context), |
7451
85ab7655ad4d
Modify all codecs to report their supported input and output sample format(s).
pross
parents:
7449
diff
changeset
|
214 ra288_decode_init, |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
215 NULL, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
216 NULL, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
217 ra288_decode_frame, |
7040
e943e1409077
Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents:
6712
diff
changeset
|
218 .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"), |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
219 }; |