1 /*
2 * Enhanced Variable Rate Codec, Service Option 3 decoder
3 * Copyright (c) 2013 Paul B Mahol
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * Enhanced Variable Rate Codec, Service Option 3 decoder
25 * @author Paul B Mahol
26 */
27
36
37 #define MIN_LSP_SEP (0.05 / (2.0 * M_PI))
40 #define NB_SUBFRAMES 3
41 #define SUBFRAME_SIZE 54
42 #define FILTER_ORDER 10
44
53
54 /**
55 * EVRC-A unpacked data frame
56 */
59 uint16_t
lsp[4];
///< index into LSP codebook
68
71
73
78
95
100
101 /**
102 * Frame unpacking for RATE_FULL, RATE_HALF and RATE_QUANT
103 *
104 * @param e the context
105 *
106 * TIA/IS-127 Table 4.21-1
107 */
109 {
112
141 break;
156 break;
161 break;
162 }
163 }
164
166 {
167 switch (buf_size) {
173 }
174
176 }
177
178 /**
179 * Determine the bitrate from the frame size and/or the first byte of the frame.
180 *
181 * @param avctx the AV codec context
182 * @param buf_size length of the buffer
183 * @param buf the bufffer
184 *
185 * @return the bitrate on success,
186 * RATE_ERRS if the bitrate cannot be satisfactorily determined
187 */
189 int *buf_size,
191 {
193
195 if (bitrate > **buf) {
199 "Claimed bitrate and buffer size mismatch.\n");
201 }
203 } else if (bitrate < **buf) {
205 "Buffer is too small for the claimed bitrate.\n");
207 }
208 (*buf)++;
209 *buf_size -= 1;
212 "Bitrate byte is missing, guessing the bitrate from packet size.\n");
213 } else
215
216 return bitrate;
217 }
218
221 {
224 }
225
226 /**
227 * Initialize the speech codec according to the specification.
228 *
229 * TIA/IS-127 5.2
230 */
232 {
235 float denom = 2.0 / (2.0 * 8.0 + 1.0);
236
240
244 }
245
248
254
255 for (i = 0; i < 8; i++) {
256 float tt = ((float)i - 8.0 / 2.0) / 8.0;
257
258 for (n = -8; n <= 8; n++, idx++) {
259 float arg1 =
M_PI * 0.9 * (tt -
n);
260 float arg2 =
M_PI * (tt -
n);
261
263 if (arg1)
265 sin(arg1) / arg1;
266 }
267 }
268
269 return 0;
270 }
271
272 /**
273 * Decode the 10 vector quantized line spectral pair frequencies from the LSP
274 * transmission codes of any bitrate and check for badly received packets.
275 *
276 * @param e the context
277 *
278 * @return 0 on success, -1 if the packet is badly received
279 *
280 * TIA/IS-127 5.2.1, 5.7.1
281 */
283 {
285 int i, j, k = 0;
286
289 const float *codebook = codebooks[i];
290
292 e->
lspf[k++] = codebook[e->
frame.
lsp[i] * row_size + j];
293 }
294
295 // check for monotonic LSPs
298 return -1;
299
300 // check for minimum separation of LSPs at the splits
301 for (i = 0, k = 0; i < evrc_lspq_nb_codebooks[e->
bitrate] - 1; i++) {
304 return -1;
305 }
306
307 return 0;
308 }
309
310 /*
311 * Interpolation of LSP parameters.
312 *
313 * TIA/IS-127 5.2.3.1, 5.7.3.2
314 */
316 const float *prev,
int index)
317 {
318 static const float lsp_interpolation_factors[] = { 0.1667, 0.5, 0.8333 };
320 1.0 - lsp_interpolation_factors[index],
322 }
323
324 /*
325 * Reconstruction of the delay contour.
326 *
327 * TIA/IS-127 5.2.2.3.2
328 */
330 {
331 static const float d_interpolation_factors[] = { 0, 0.3313, 0.6625, 1, 1 };
332 dst[0] = (1.0 - d_interpolation_factors[
index ]) * prev
333 + d_interpolation_factors[index ] * current;
334 dst[1] = (1.0 - d_interpolation_factors[index + 1]) * prev
335 + d_interpolation_factors[index + 1] * current;
336 dst[2] = (1.0 - d_interpolation_factors[index + 2]) * prev
337 + d_interpolation_factors[index + 2] * current;
338 }
339
340 /*
341 * Convert the quantized, interpolated line spectral frequencies,
342 * to prediction coefficients.
343 *
344 * TIA/IS-127 5.2.3.2, 4.7.2.2
345 */
347 {
354 int i, k;
355
357
359 a[0] = k < 2 ? 0.25 : 0;
360 b[0] = k < 2 ? k < 1 ? 0.25 : -0.25 : 0;
361
363 a[i + 1] = a[i] - 2 * lsp[i * 2 ] * a1[i] + a2[i];
364 b[i + 1] = b[i] - 2 * lsp[i * 2 + 1] * b1[i] + b2[i];
365 a2[i] = a1[i];
366 a1[i] = a[i];
367 b2[i] = b1[i];
368 b1[i] = b[i];
369 }
370
371 if (k)
373 }
374 }
375
377 {
378 float *f;
380 int16_t t;
381
383
384 t = (offset - delay + 0.5) * 8.0 + 0.5;
385 if (t == 8) {
386 t = 0;
387 offset--;
388 }
389
390 f = ex - offset - 8;
391
392 coef_idx = t * (2 * 8 + 1);
393
394 ex[0] = 0.0;
395 for (i = 0; i < 2 * 8 + 1; i++)
397 }
398
399 /*
400 * Adaptive codebook excitation.
401 *
402 * TIA/IS-127 5.2.2.3.3, 4.12.5.2
403 */
405 const float delay[3],
int length)
406 {
407 float denom, locdelay, dpr, invl;
408 int i;
409
410 invl = 1.0 / ((float) length);
412
413 /* first at-most extra samples */
414 denom = (delay[1] - delay[0]) * invl;
415 for (i = 0; i < dpr; i++) {
416 locdelay = delay[0] + i * denom;
417 bl_intrp(e, excitation + i, locdelay);
418 }
419
420 denom = (delay[2] - delay[1]) * invl;
421 /* interpolation */
422 for (i = dpr; i < dpr + 10; i++) {
423 locdelay = delay[1] + (i - dpr) * denom;
424 bl_intrp(e, excitation + i, locdelay);
425 }
426
427 for (i = 0; i <
length; i++)
428 excitation[i] *= gain;
429 }
430
432 {
433 int i, pos1, pos2,
offset;
434
435 offset = (fixed_index[3] >> 9) & 3;
436
437 for (i = 0; i < 3; i++) {
438 pos1 = ((fixed_index[i] & 0x7f) / 11) * 5 + ((i +
offset) % 5);
439 pos2 = ((fixed_index[i] & 0x7f) % 11) * 5 + ((i +
offset) % 5);
440
441 cod[pos1] = (fixed_index[i] & 0x80) ? -1.0 : 1.0;
442
443 if (pos2 < pos1)
444 cod[pos2] = -cod[pos1];
445 else
446 cod[pos2] += cod[pos1];
447 }
448
449 pos1 = ((fixed_index[3] & 0x7f) / 11) * 5 + ((3 +
offset) % 5);
450 pos2 = ((fixed_index[3] & 0x7f) % 11) * 5 + ((4 +
offset) % 5);
451
452 cod[pos1] = (fixed_index[3] & 0x100) ? -1.0 : 1.0;
453 cod[pos2] = (fixed_index[3] & 0x80 ) ? -1.0 : 1.0;
454 }
455
457 {
458 float sign;
459 int pos;
460
461 sign = (fixed_index & 0x200) ? -1.0 : 1.0;
462
463 pos = ((fixed_index & 0x7) * 7) + 4;
464 cod[pos] += sign;
465 pos = (((fixed_index >> 3) & 0x7) * 7) + 2;
466 cod[pos] -= sign;
467 pos = (((fixed_index >> 6) & 0x7) * 7);
468 cod[pos] += sign;
469 }
470
471 /*
472 * Reconstruction of ACELP fixed codebook excitation for full and half rate.
473 *
474 * TIA/IS-127 5.2.3.7
475 */
477 float *excitation, float pitch_gain,
478 int pitch_lag, int subframe_size)
479 {
480 int i;
481
484 else
486
487 pitch_gain = av_clipf(pitch_gain, 0.2, 0.9);
488
489 for (i = pitch_lag; i < subframe_size; i++)
490 excitation[i] += pitch_gain * excitation[i - pitch_lag];
491 }
492
493 /**
494 * Synthesis of the decoder output signal.
495 *
496 * param[in] in input signal
497 * param[in] filter_coeffs LPC coefficients
498 * param[in/out] memory synthesis filter memory
499 * param buffer_length amount of data to process
500 * param[out] samples output samples
501 *
502 * TIA/IS-127 5.2.3.15, 5.7.3.4
503 */
505 float *memory, int buffer_length, float *samples)
506 {
507 int i, j;
508
509 for (i = 0; i < buffer_length; i++) {
510 samples[i] = in[i];
512 samples[i] -= filter_coeffs[j] * memory[j];
513 memory[j] = memory[j - 1];
514 }
515 samples[i] -= filter_coeffs[0] * memory[0];
516 memory[0] = samples[i];
517 }
518 }
519
521 {
522 double fac = gamma;
523 int i;
524
526 coeff[i] = inbuf[i] * fac;
527 fac *= gamma;
528 }
529 }
530
532 const float *coef,
float *memory,
int length)
533 {
534 float sum;
535 int i, j;
536
537 for (i = 0; i <
length; i++) {
538 sum = input[i];
539
541 sum += coef[j] * memory[j];
542 memory[j] = memory[j - 1];
543 }
544 sum += coef[0] * memory[0];
545 memory[0] = input[i];
546 output[i] = sum;
547 }
548 }
549
550 /*
551 * TIA/IS-127 Table 5.9.1-1.
552 */
559 { 0.0 , 0.0 , 0.0 , 0.0 },
560 { 0.0 , 0.0 , 0.57, 0.57 },
561 { 0.0 , 0.0 , 0.0 , 0.0 },
562 { 0.35, 0.50, 0.50, 0.75 },
563 { 0.20, 0.50, 0.57, 0.75 },
564 };
565
566 /*
567 * Adaptive postfilter.
568 *
569 * TIA/IS-127 5.9
570 */
572 float *
out,
int idx,
const struct PfCoeff *pfc,
574 {
578 float sum1 = 0.0, sum2 = 0.0, gamma, gain;
579 float tilt = pfc->
tilt;
581
584
585 /* Tilt compensation filter, TIA/IS-127 5.9.1 */
586 for (i = 0; i < length - 1; i++)
587 sum2 += in[i] * in[i + 1];
588 if (sum2 < 0.0)
589 tilt = 0.0;
590
591 for (i = 0; i <
length; i++) {
592 scratch[i] = in[i] - tilt * e->
last;
594 }
595
596 /* Short term residual filter, TIA/IS-127 5.9.2 */
598
599 /* Long term postfilter */
600 best = idx;
605 sum1 = sum2;
606 best = i;
607 }
608 }
609
614
617 } else {
618 gamma = sum2 / sum1;
619 if (gamma < 0.5)
621 else {
622 gamma =
FFMIN(gamma, 1.0);
623
624 for (i = 0; i <
length; i++) {
627 }
628 }
629 }
630
631 memcpy(scratch, temp, length * sizeof(float));
634
635 /* Gain computation, TIA/IS-127 5.9.4-2 */
636 for (i = 0, sum1 = 0, sum2 = 0; i <
length; i++) {
637 sum1 += in[i] * in[i];
638 sum2 += scratch[i] * scratch[i];
639 }
640 gain = sum2 ? sqrt(sum1 / sum2) : 1.0;
641
642 for (i = 0; i <
length; i++)
643 temp[i] *= gain;
644
645 /* Short term postfilter */
647
650 }
651
653 {
656 int i, j;
657
660 e->
lspf[i] = e->
prev_lspf[i] * 0.875 + 0.125 * (i + 1) * 0.048;
661 else
663 }
664
671 else
673
676 } else {
677 float sum = 0;
678
679 idelay[0] = idelay[1] = idelay[2] =
MIN_DELAY;
680
684 sum = pow(10, sum);
687 }
688
691
694 int pitch_lag;
695
697
703 } else {
705 }
706 }
707
708 pitch_lag =
lrintf((idelay[1] + idelay[0]) / 2.0);
710
714 for (j = 0; j < subframe_size; j++)
717 } else {
718 for (j = 0; j < subframe_size; j++)
720 }
721
723
726 for (j = 0; j < subframe_size; j++)
729 for (j = 0; j < subframe_size; j++)
731 }
732
737
738 samples += subframe_size;
739 }
740 }
741
743 int *got_frame_ptr,
AVPacket *avpkt)
744 {
748 int buf_size = avpkt->
size;
750 float *samples;
751 int i, j, ret, error_flag = 0;
752
755 return ret;
756 samples = (
float *)frame->
data[0];
757
760 goto erasure;
761 }
763 goto erasure;
766 goto erasure;
767
769 return ret;
771
773
777 if (p[i])
778 break;
779 }
781 goto erasure;
782 }
else if (e->
frame.
lsp[0] == 0xf &&
785 goto erasure;
786 }
787
789 goto erasure;
790
792 /* Pitch delay parameter checking as per TIA/IS-127 5.1.5.1 */
794 goto erasure;
795
797
798 /* Delay diff parameter checking as per TIA/IS-127 5.1.5.2 */
802 goto erasure;
803 }
804
805 /* Delay contour reconstruction as per TIA/IS-127 5.2.2.2 */
808 float delay;
809
811
814
817
820
824 }
825 }
826
827 /* Smoothing of the decoded delay as per TIA/IS-127 5.2.2.5 */
830
832 } else {
833 idelay[0] = idelay[1] = idelay[2] =
MIN_DELAY;
834
835 /* Decode frame energy vectors as per TIA/IS-127 5.7.2 */
839 }
840
844 int pitch_lag;
845
847
850
851 pitch_lag =
lrintf((idelay[1] + idelay[0]) / 2.0);
853
854 /* Bandwidth expansion as per TIA/IS-127 5.2.3.3 */
857
859 float acb_sum, f;
860
866
868 acb_sum, idelay, subframe_size);
870 acb_sum, pitch_lag, subframe_size);
871
872 /* Total excitation generation as per TIA/IS-127 5.2.3.9 */
873 for (j = 0; j < subframe_size; j++)
876 } else {
877 for (j = 0; j < subframe_size; j++)
879 }
880
882
889
890 samples += subframe_size;
891 }
892
893 if (error_flag) {
894 erasure:
895 error_flag = 1;
898 }
899
903
906
907 samples = (
float *)frame->
data[0];
908 for (i = 0; i < 160; i++)
909 samples[i] /= 32768;
910
911 *got_frame_ptr = 1;
912
914 }
915
916 #define OFFSET(x) offsetof(EVRCContext, x)
917 #define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
918
922 };
923
929 };
930
940 .priv_class = &evrcdec_class,
941 };
Data tables for the EVRC decoder.
This structure describes decoded (raw) audio or video data.
BYTE int const BYTE int int row_size
static const AVClass evrcdec_class
uint8_t fcb_gain[3]
fixed codebook gain index
uint16_t lsp[4]
index into LSP codebook
ptrdiff_t const GLvoid * data
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
static evrc_packet_rate determine_bitrate(AVCodecContext *avctx, int *buf_size, const uint8_t **buf)
Determine the bitrate from the frame size and/or the first byte of the frame.
void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b, float weight_coeff_a, float weight_coeff_b, int length)
float implementation of weighted sum of two vectors.
static const float *const *const evrc_lspq_codebooks[]
static void fcb_excitation(EVRCContext *e, const uint16_t *codebook, float *excitation, float pitch_gain, int pitch_lag, int subframe_size)
float energy_vector[NB_SUBFRAMES]
static av_cold int evrc_decode_init(AVCodecContext *avctx)
Initialize the speech codec according to the specification.
float avg_fcb_gain
average fixed codebook gain
uint8_t warned_buf_mismatch_bitrate
uint8_t tty
tty baud rate bit
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static evrc_packet_rate buf_size2bitrate(const int buf_size)
enum AVSampleFormat sample_fmt
audio sample format
static void interpolate_lsp(float *ilsp, const float *lsp, const float *prev, int index)
uint8_t lpc_flag
spectral change indicator
static void bl_intrp(EVRCContext *e, float *ex, float delay)
uint16_t fcb_shape[3][4]
fixed codebook shape
static const uint8_t *const evrc_lspq_codebooks_row_sizes[]
static const float evrc_energy_quant[][3]
Rate 1/8 frame energy quantization.
bitstream reader API header.
static const uint8_t subframe_sizes[]
float pitch[ACB_SIZE+FILTER_ORDER+SUBFRAME_SIZE]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint8_t evrc_lspq_nb_codebooks[]
static void acb_excitation(EVRCContext *e, float *excitation, float gain, const float delay[3], int length)
float interpolation_coeffs[136]
float postfilter_residual[ACB_SIZE+SUBFRAME_SIZE]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static void unpack_frame(EVRCContext *e)
Frame unpacking for RATE_FULL, RATE_HALF and RATE_QUANT.
const char * name
Name of the codec implementation.
static int evrc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
static const uint8_t offset[127][2]
uint8_t acb_gain[3]
adaptive codebook gain
static const float pitch_gain_vq[]
uint64_t channel_layout
Audio channel layout.
float avg_acb_gain
average adaptive codebook gain
float pitch_back[ACB_SIZE]
float prev_lspf[FILTER_ORDER]
static void postfilter(EVRCContext *e, float *in, const float *coeff, float *out, int idx, const struct PfCoeff *pfc, int length)
float postfilter_fir[FILTER_ORDER]
static void bandwidth_expansion(float *coeff, const float *inbuf, float gamma)
uint8_t pitch_delay
pitch delay for entire frame
static void decode_8_pulses_35bits(const uint16_t *fixed_index, float *cod)
uint8_t delay_diff
delay difference for entire frame
Libavcodec external API header.
static const float estimation_delay[]
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static const struct PfCoeff postfilter_coeffs[5]
main external API structure.
static void decode_3_pulses_10bits(uint16_t fixed_index, float *cod)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static unsigned int get_bits1(GetBitContext *s)
Describe the class of an AVClass context structure.
float synthesis[FILTER_ORDER]
static const AVOption options[]
void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order)
Floating point version of ff_acelp_lsf2lsp()
static void synthesis_filter(const float *in, const float *filter_coeffs, float *memory, int buffer_length, float *samples)
Synthesis of the decoder output signal.
static void decode_predictor_coeffs(const float *ilspf, float *ilpc)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
evrc_packet_rate last_valid_bitrate
static void warn_insufficient_frame_quality(AVCodecContext *avctx, const char *message)
common internal api header.
int channels
number of audio channels
static int decode_lspf(EVRCContext *e)
Decode the 10 vector quantized line spectral pair frequencies from the LSP transmission codes of any ...
static const double coeff[2][5]
static void frame_erasure(EVRCContext *e, float *samples)
uint8_t energy_gain
frame energy gain index
int frame_number
Frame counter, set by libavcodec.
static void residual_filter(float *output, const float *input, const float *coef, float *memory, int length)
float postfilter_iir[FILTER_ORDER]
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
static void interpolate_delay(float *dst, float current, float prev, int index)
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
EVRC-A unpacked data frame.