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 Libav.
7  *
8  * Libav 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  * Libav 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 Libav; 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 
29 typedef struct {
30  int n;
31  int x[10];
32  float y[10];
34  int pitch_lag;
35  float pitch_fac;
36 } AMRFixed;
37 
52 extern const uint8_t ff_fc_4pulses_8bits_tracks_13[16];
53 
65 extern const uint8_t ff_fc_4pulses_8bits_track_4[32];
66 
81 extern const uint8_t ff_fc_2pulses_9bits_track1[16];
82 extern const uint8_t ff_fc_2pulses_9bits_track1_gray[16];
83 
87 extern const float ff_b60_sinc[61];
88 
92 extern const float ff_pow_0_7[10];
93 
97 extern const float ff_pow_0_75[10];
98 
102 extern const float ff_pow_0_55[10];
103 
118 void ff_acelp_fc_pulse_per_track(int16_t* fc_v,
119  const uint8_t *tab1,
120  const uint8_t *tab2,
121  int pulse_indexes,
122  int pulse_signs,
123  int pulse_count,
124  int bits);
125 
138 void ff_decode_10_pulses_35bits(const int16_t *fixed_index,
139  AMRFixed *fixed_sparse,
140  const uint8_t *gray_decode,
141  int half_pulse_count, int bits);
142 
143 
159 void ff_acelp_weighted_vector_sum(int16_t* out,
160  const int16_t *in_a,
161  const int16_t *in_b,
162  int16_t weight_coeff_a,
163  int16_t weight_coeff_b,
164  int16_t rounder,
165  int shift,
166  int length);
167 
179 void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b,
180  float weight_coeff_a, float weight_coeff_b,
181  int length);
182 
193 void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
194  int size, float alpha, float *gain_mem);
195 
211 void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in,
212  float sum_of_squares, const int n);
213 
222 void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size);
223 
231 void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size);
232 
233 #endif /* AVCODEC_ACELP_VECTORS_H */