comparison acelp_vectors.h @ 10676:8ee37f5571dc libavcodec

Commit functions used by both AMRNB and SIPR
author vitor
date Sat, 12 Dec 2009 13:58:07 +0000
parents 5f2ced30548b
children 608d19b30fa3
comparison
equal deleted inserted replaced
10675:03d02e21b432 10676:8ee37f5571dc
22 22
23 #ifndef AVCODEC_ACELP_VECTORS_H 23 #ifndef AVCODEC_ACELP_VECTORS_H
24 #define AVCODEC_ACELP_VECTORS_H 24 #define AVCODEC_ACELP_VECTORS_H
25 25
26 #include <stdint.h> 26 #include <stdint.h>
27
28 /** Sparse representation for the algebraic codebook (fixed) vector */
29 typedef struct {
30 int n;
31 int x[10];
32 float y[10];
33 int pitch_lag;
34 float pitch_fac;
35 } AMRFixed;
27 36
28 /** 37 /**
29 * Track|Pulse| Positions 38 * Track|Pulse| Positions
30 * ------------------------------------------------------------------------- 39 * -------------------------------------------------------------------------
31 * 1 | 0 | 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75 40 * 1 | 0 | 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75
124 int pulse_signs, 133 int pulse_signs,
125 int pulse_count, 134 int pulse_count,
126 int bits); 135 int bits);
127 136
128 /** 137 /**
138 * Decode the algebraic codebook index to pulse positions and signs and
139 * construct the algebraic codebook vector for MODE_12k2.
140 *
141 * @note: The positions and signs are explicitly coded in MODE_12k2.
142 *
143 * @param fixed_index positions of the ten pulses
144 * @param fixed_sparse pointer to the algebraic codebook vector
145 * @param gray_decode gray decoding table
146 * @param half_pulse_count number of couples of pulses
147 * @param bits length of one pulse index in bits
148 */
149 void ff_decode_10_pulses_35bits(const int16_t *fixed_index,
150 AMRFixed *fixed_sparse,
151 const uint8_t *gray_decode,
152 int half_pulse_count, int bits);
153
154
155 /**
129 * weighted sum of two vectors with rounding. 156 * weighted sum of two vectors with rounding.
130 * @param out [out] result of addition 157 * @param out [out] result of addition
131 * @param in_a first vector 158 * @param in_a first vector
132 * @param in_b second vector 159 * @param in_b second vector
133 * @param weight_coeff_a first vector weight coefficient 160 * @param weight_coeff_a first vector weight coefficient
192 * 3GPP TS 26.090 6.1 (6) 219 * 3GPP TS 26.090 6.1 (6)
193 */ 220 */
194 void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in, 221 void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in,
195 float sum_of_squares, const int n); 222 float sum_of_squares, const int n);
196 223
224 /**
225 * Add fixed vector to an array from a sparse representation
226 *
227 * @param out fixed vector with pitch sharpening
228 * @param in sparse fixed vector
229 * @param scale number to multiply the fixed vector by
230 * @param size the output vector size
231 */
232 void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size);
233
234 /**
235 * Clear array values set by set_fixed_vector
236 *
237 * @param out fixed vector to be cleared
238 * @param in sparse fixed vector
239 * @param size the output vector size
240 */
241 void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size);
242
197 #endif /* AVCODEC_ACELP_VECTORS_H */ 243 #endif /* AVCODEC_ACELP_VECTORS_H */