FFmpeg  1.2.12
acelp_vectors.h
Go to the documentation of this file.
1 /*
2  * adaptive and fixed codebook vector operations for ACELP-based codecs
3  *
4  * Copyright (c) 2008 Vladimir Voroshilov
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef AVCODEC_ACELP_VECTORS_H
24 #define AVCODEC_ACELP_VECTORS_H
25 
26 #include <stdint.h>
27 
28 typedef struct ACELPVContext {
40  void (*weighted_vector_sumf)(float *out, const float *in_a, const float *in_b,
41  float weight_coeff_a, float weight_coeff_b,
42  int length);
43 
45 
51 
53 typedef struct AMRFixed {
54  int n;
55  int x[10];
56  float y[10];
58  int pitch_lag;
59  float pitch_fac;
60 } AMRFixed;
61 
76 extern const uint8_t ff_fc_4pulses_8bits_tracks_13[16];
77 
89 extern const uint8_t ff_fc_4pulses_8bits_track_4[32];
90 
105 extern const uint8_t ff_fc_2pulses_9bits_track1[16];
107 
138 
142 extern const float ff_b60_sinc[61];
143 
147 extern const float ff_pow_0_7[10];
148 
152 extern const float ff_pow_0_75[10];
153 
157 extern const float ff_pow_0_55[10];
158 
173 void ff_acelp_fc_pulse_per_track(int16_t* fc_v,
174  const uint8_t *tab1,
175  const uint8_t *tab2,
176  int pulse_indexes,
177  int pulse_signs,
178  int pulse_count,
179  int bits);
180 
193 void ff_decode_10_pulses_35bits(const int16_t *fixed_index,
194  AMRFixed *fixed_sparse,
195  const uint8_t *gray_decode,
196  int half_pulse_count, int bits);
197 
198 
214 void ff_acelp_weighted_vector_sum(int16_t* out,
215  const int16_t *in_a,
216  const int16_t *in_b,
217  int16_t weight_coeff_a,
218  int16_t weight_coeff_b,
219  int16_t rounder,
220  int shift,
221  int length);
222 
234 void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b,
235  float weight_coeff_a, float weight_coeff_b,
236  int length);
237 
248 void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
249  int size, float alpha, float *gain_mem);
250 
266 void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in,
267  float sum_of_squares, const int n);
268 
277 void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size);
278 
286 void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size);
287 
288 #endif /* AVCODEC_ACELP_VECTORS_H */