You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

648 lines
20KB

  1. /*
  2. * QCELP decoder
  3. * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet
  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. * @file qcelpdec.c
  23. * QCELP decoder
  24. * @author Reynaldo H. Verdejo Pinochet
  25. * @remark FFmpeg merging spearheaded by Kenan Gillet
  26. */
  27. #include <stddef.h>
  28. #include "avcodec.h"
  29. #include "bitstream.h"
  30. #include "qcelp.h"
  31. #include "qcelpdata.h"
  32. #include "celp_math.h"
  33. #include "celp_filters.h"
  34. #undef NDEBUG
  35. #include <assert.h>
  36. typedef struct {
  37. GetBitContext gb;
  38. qcelp_packet_rate bitrate;
  39. QCELPFrame frame; /*!< unpacked data frame */
  40. uint8_t erasure_count;
  41. uint8_t octave_count; /*!< count the consecutive RATE_OCTAVE frames */
  42. float prev_lspf[10];
  43. float predictor_lspf[10]; /*!< LSP predictor,
  44. only use for RATE_OCTAVE and I_F_Q */
  45. float formant_mem[170];
  46. float last_codebook_gain;
  47. int prev_g1[2];
  48. int prev_bitrate;
  49. float prev_pitch_gain[4];
  50. uint8_t prev_pitch_lag[4];
  51. uint16_t first16bits;
  52. } QCELPContext;
  53. static void weighted_vector_sumf(float *out, const float *in_a,
  54. const float *in_b, float weight_coeff_a,
  55. float weight_coeff_b, int length)
  56. {
  57. int i;
  58. for(i=0; i<length; i++)
  59. out[i] = weight_coeff_a * in_a[i]
  60. + weight_coeff_b * in_b[i];
  61. }
  62. /**
  63. * Initialize the speech codec according to the specification.
  64. *
  65. * TIA/EIA/IS-733 2.4.9
  66. */
  67. static av_cold int qcelp_decode_init(AVCodecContext *avctx)
  68. {
  69. QCELPContext *q = avctx->priv_data;
  70. int i;
  71. avctx->sample_fmt = SAMPLE_FMT_FLT;
  72. for (i = 0; i < 10; i++)
  73. q->prev_lspf[i] = (i + 1) / 11.;
  74. return 0;
  75. }
  76. /**
  77. * Decodes the 10 quantized LSP frequencies from the LSPV/LSP
  78. * transmission codes of any bitrate and checks for badly received packets.
  79. *
  80. * @param q the context
  81. * @param lspf line spectral pair frequencies
  82. *
  83. * @return 0 on success, -1 if the packet is badly received
  84. *
  85. * TIA/EIA/IS-733 2.4.3.2.6.2-2, 2.4.8.7.3
  86. */
  87. static int decode_lspf(QCELPContext *q, float *lspf)
  88. {
  89. int i;
  90. float tmp_lspf;
  91. if(q->bitrate == RATE_OCTAVE || q->bitrate == I_F_Q)
  92. {
  93. float smooth;
  94. const float *predictors = (q->prev_bitrate != RATE_OCTAVE &&
  95. q->prev_bitrate != I_F_Q ? q->prev_lspf
  96. : q->predictor_lspf);
  97. if(q->bitrate == RATE_OCTAVE)
  98. {
  99. q->octave_count++;
  100. for(i=0; i<10; i++)
  101. {
  102. q->predictor_lspf[i] =
  103. lspf[i] = (q->frame.lspv[i] ? QCELP_LSP_SPREAD_FACTOR
  104. : -QCELP_LSP_SPREAD_FACTOR)
  105. + predictors[i] * QCELP_LSP_OCTAVE_PREDICTOR
  106. + (i + 1) * ((1 - QCELP_LSP_OCTAVE_PREDICTOR)/11);
  107. }
  108. smooth = (q->octave_count < 10 ? .875 : 0.1);
  109. }else
  110. {
  111. float erasure_coeff = QCELP_LSP_OCTAVE_PREDICTOR;
  112. assert(q->bitrate == I_F_Q);
  113. if(q->erasure_count > 1)
  114. erasure_coeff *= (q->erasure_count < 4 ? 0.9 : 0.7);
  115. for(i=0; i<10; i++)
  116. {
  117. q->predictor_lspf[i] =
  118. lspf[i] = (i + 1) * ( 1 - erasure_coeff)/11
  119. + erasure_coeff * predictors[i];
  120. }
  121. smooth = 0.125;
  122. }
  123. // Check the stability of the LSP frequencies.
  124. lspf[0] = FFMAX(lspf[0], QCELP_LSP_SPREAD_FACTOR);
  125. for(i=1; i<10; i++)
  126. lspf[i] = FFMAX(lspf[i], (lspf[i-1] + QCELP_LSP_SPREAD_FACTOR));
  127. lspf[9] = FFMIN(lspf[9], (1.0 - QCELP_LSP_SPREAD_FACTOR));
  128. for(i=9; i>0; i--)
  129. lspf[i-1] = FFMIN(lspf[i-1], (lspf[i] - QCELP_LSP_SPREAD_FACTOR));
  130. // Low-pass filter the LSP frequencies.
  131. weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0-smooth, 10);
  132. }else
  133. {
  134. q->octave_count = 0;
  135. tmp_lspf = 0.;
  136. for(i=0; i<5 ; i++)
  137. {
  138. lspf[2*i+0] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][0] * 0.0001;
  139. lspf[2*i+1] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][1] * 0.0001;
  140. }
  141. // Check for badly received packets.
  142. if(q->bitrate == RATE_QUARTER)
  143. {
  144. if(lspf[9] <= .70 || lspf[9] >= .97)
  145. return -1;
  146. for(i=3; i<10; i++)
  147. if(fabs(lspf[i] - lspf[i-2]) < .08)
  148. return -1;
  149. }else
  150. {
  151. if(lspf[9] <= .66 || lspf[9] >= .985)
  152. return -1;
  153. for(i=4; i<10; i++)
  154. if (fabs(lspf[i] - lspf[i-4]) < .0931)
  155. return -1;
  156. }
  157. }
  158. return 0;
  159. }
  160. /**
  161. * Converts codebook transmission codes to GAIN and INDEX.
  162. *
  163. * @param q the context
  164. * @param gain array holding the decoded gain
  165. *
  166. * TIA/EIA/IS-733 2.4.6.2
  167. */
  168. static void decode_gain_and_index(QCELPContext *q,
  169. float *gain) {
  170. int i, subframes_count, g1[16];
  171. float slope;
  172. if (q->bitrate >= RATE_QUARTER) {
  173. switch (q->bitrate) {
  174. case RATE_FULL: subframes_count = 16; break;
  175. case RATE_HALF: subframes_count = 4; break;
  176. default: subframes_count = 5;
  177. }
  178. for (i = 0; i < subframes_count; i++) {
  179. g1[i] = 4 * q->frame.cbgain[i];
  180. if (q->bitrate == RATE_FULL && !((i+1) & 3)) {
  181. g1[i] += av_clip((g1[i-1] + g1[i-2] + g1[i-3]) / 3 - 6, 0, 32);
  182. }
  183. gain[i] = qcelp_g12ga[g1[i]];
  184. if (q->frame.cbsign[i]) {
  185. gain[i] = -gain[i];
  186. q->frame.cindex[i] = (q->frame.cindex[i]-89) & 127;
  187. }
  188. }
  189. q->prev_g1[0] = g1[i-2];
  190. q->prev_g1[1] = g1[i-1];
  191. q->last_codebook_gain = qcelp_g12ga[g1[i-1]];
  192. if (q->bitrate == RATE_QUARTER) {
  193. // Provide smoothing of the unvoiced excitation energy.
  194. gain[7] = gain[4];
  195. gain[6] = 0.4*gain[3] + 0.6*gain[4];
  196. gain[5] = gain[3];
  197. gain[4] = 0.8*gain[2] + 0.2*gain[3];
  198. gain[3] = 0.2*gain[1] + 0.8*gain[2];
  199. gain[2] = gain[1];
  200. gain[1] = 0.6*gain[0] + 0.4*gain[1];
  201. }
  202. } else {
  203. if (q->bitrate == RATE_OCTAVE) {
  204. g1[0] = 2 * q->frame.cbgain[0]
  205. + av_clip((q->prev_g1[0] + q->prev_g1[1]) / 2 - 5, 0, 54);
  206. subframes_count = 8;
  207. } else {
  208. assert(q->bitrate == I_F_Q);
  209. g1[0] = q->prev_g1[1];
  210. switch (q->erasure_count) {
  211. case 1 : break;
  212. case 2 : g1[0] -= 1; break;
  213. case 3 : g1[0] -= 2; break;
  214. default: g1[0] -= 6;
  215. }
  216. if (g1[0] < 0)
  217. g1[0] = 0;
  218. subframes_count = 4;
  219. }
  220. // This interpolation is done to produce smoother background noise.
  221. slope = 0.5*(qcelp_g12ga[g1[0]] - q->last_codebook_gain) / subframes_count;
  222. for (i = 1; i <= subframes_count; i++)
  223. gain[i-1] = q->last_codebook_gain + slope * i;
  224. q->last_codebook_gain = gain[i-2];
  225. q->prev_g1[0] = q->prev_g1[1];
  226. q->prev_g1[1] = g1[0];
  227. }
  228. }
  229. /**
  230. * If the received packet is Rate 1/4 a further sanity check is made of the
  231. * codebook gain.
  232. *
  233. * @param cbgain the unpacked cbgain array
  234. * @return -1 if the sanity check fails, 0 otherwise
  235. *
  236. * TIA/EIA/IS-733 2.4.8.7.3
  237. */
  238. static int codebook_sanity_check_for_rate_quarter(const uint8_t *cbgain)
  239. {
  240. int i, prev_diff=0;
  241. for(i=1; i<5; i++)
  242. {
  243. int diff = cbgain[i] - cbgain[i-1];
  244. if(FFABS(diff) > 10)
  245. return -1;
  246. else if(FFABS(diff - prev_diff) > 12)
  247. return -1;
  248. prev_diff = diff;
  249. }
  250. return 0;
  251. }
  252. /**
  253. * Computes the scaled codebook vector Cdn From INDEX and GAIN
  254. * for all rates.
  255. *
  256. * The specification lacks some information here.
  257. *
  258. * TIA/EIA/IS-733 has an omission on the codebook index determination
  259. * formula for RATE_FULL and RATE_HALF frames at section 2.4.8.1.1. It says
  260. * you have to subtract the decoded index parameter from the given scaled
  261. * codebook vector index 'n' to get the desired circular codebook index, but
  262. * it does not mention that you have to clamp 'n' to [0-9] in order to get
  263. * RI-compliant results.
  264. *
  265. * The reason for this mistake seems to be the fact they forgot to mention you
  266. * have to do these calculations per codebook subframe and adjust given
  267. * equation values accordingly.
  268. *
  269. * @param q the context
  270. * @param gain array holding the 4 pitch subframe gain values
  271. * @param cdn_vector array for the generated scaled codebook vector
  272. */
  273. static void compute_svector(const QCELPContext *q, const float *gain,
  274. float *cdn_vector)
  275. {
  276. int i, j, k;
  277. uint16_t cbseed, cindex;
  278. float *rnd, tmp_gain, fir_filter_value;
  279. switch(q->bitrate)
  280. {
  281. case RATE_FULL:
  282. for(i=0; i<16; i++)
  283. {
  284. tmp_gain = gain[i] * QCELP_RATE_FULL_CODEBOOK_RATIO;
  285. cindex = -q->frame.cindex[i];
  286. for(j=0; j<10; j++)
  287. *cdn_vector++ = tmp_gain * qcelp_rate_full_codebook[cindex++ & 127];
  288. }
  289. break;
  290. case RATE_HALF:
  291. for(i=0; i<4; i++)
  292. {
  293. tmp_gain = gain[i] * QCELP_RATE_HALF_CODEBOOK_RATIO;
  294. cindex = -q->frame.cindex[i];
  295. for (j = 0; j < 40; j++)
  296. *cdn_vector++ = tmp_gain * qcelp_rate_half_codebook[cindex++ & 127];
  297. }
  298. break;
  299. case RATE_QUARTER:
  300. cbseed = (0x0003 & q->frame.lspv[4])<<14 |
  301. (0x003F & q->frame.lspv[3])<< 8 |
  302. (0x0060 & q->frame.lspv[2])<< 1 |
  303. (0x0007 & q->frame.lspv[1])<< 3 |
  304. (0x0038 & q->frame.lspv[0])>> 3 ;
  305. rnd = q->rnd_fir_filter_mem + 20;
  306. for(i=0; i<8; i++)
  307. {
  308. tmp_gain = gain[i] * (QCELP_SQRT1887 / 32768.0);
  309. for(k=0; k<20; k++)
  310. {
  311. cbseed = 521 * cbseed + 259;
  312. *rnd = (int16_t)cbseed;
  313. // FIR filter
  314. fir_filter_value = 0.0;
  315. for(j=0; j<10; j++)
  316. fir_filter_value += qcelp_rnd_fir_coefs[j ]
  317. * (rnd[-j ] + rnd[-20+j]);
  318. fir_filter_value += qcelp_rnd_fir_coefs[10] * rnd[-10];
  319. *cdn_vector++ = tmp_gain * fir_filter_value;
  320. rnd++;
  321. }
  322. }
  323. memcpy(q->rnd_fir_filter_mem, q->rnd_fir_filter_mem + 160, 20 * sizeof(float));
  324. break;
  325. case RATE_OCTAVE:
  326. cbseed = q->first16bits;
  327. for(i=0; i<8; i++)
  328. {
  329. tmp_gain = gain[i] * (QCELP_SQRT1887 / 32768.0);
  330. for(j=0; j<20; j++)
  331. {
  332. cbseed = 521 * cbseed + 259;
  333. *cdn_vector++ = tmp_gain * (int16_t)cbseed;
  334. }
  335. }
  336. break;
  337. case I_F_Q:
  338. cbseed = -44; // random codebook index
  339. for(i=0; i<4; i++)
  340. {
  341. tmp_gain = gain[i] * QCELP_RATE_FULL_CODEBOOK_RATIO;
  342. for(j=0; j<40; j++)
  343. *cdn_vector++ = tmp_gain * qcelp_rate_full_codebook[cbseed++ & 127];
  344. }
  345. break;
  346. }
  347. }
  348. /**
  349. * Apply generic gain control.
  350. *
  351. * @param v_out output vector
  352. * @param v_in gain-controlled vector
  353. * @param v_ref vector to control gain of
  354. *
  355. * FIXME: If v_ref is a zero vector, it energy is zero
  356. * and the behavior of the gain control is
  357. * undefined in the specs.
  358. *
  359. * TIA/EIA/IS-733 2.4.8.3-2/3/4/5, 2.4.8.6
  360. */
  361. static void apply_gain_ctrl(float *v_out, const float *v_ref,
  362. const float *v_in)
  363. {
  364. int i, j, len;
  365. float scalefactor;
  366. for(i=0, j=0; i<4; i++)
  367. {
  368. scalefactor = ff_dot_productf(v_in + j, v_in + j, 40);
  369. if(scalefactor)
  370. scalefactor = sqrt(ff_dot_productf(v_ref + j, v_ref + j, 40)
  371. / scalefactor);
  372. else
  373. av_log_missing_feature(NULL, "Zero energy for gain control", 1);
  374. for(len=j+40; j<len; j++)
  375. v_out[j] = scalefactor * v_in[j];
  376. }
  377. }
  378. /**
  379. * Apply filter in pitch-subframe steps.
  380. *
  381. * @param memory buffer for the previous state of the filter
  382. * - must be able to contain 303 elements
  383. * - the 143 first elements are from the previous state
  384. * - the next 160 are for output
  385. * @param v_in input filter vector
  386. * @param gain per-subframe gain array, each element is between 0.0 and 2.0
  387. * @param lag per-subframe lag array, each element is
  388. * - between 16 and 143 if its corresponding pfrac is 0,
  389. * - between 16 and 139 otherwise
  390. * @param pfrac per-subframe boolean array, 1 if the lag is fractional, 0
  391. * otherwise
  392. *
  393. * @return filter output vector
  394. */
  395. static const float *do_pitchfilter(float memory[303], const float v_in[160],
  396. const float gain[4], const uint8_t *lag,
  397. const uint8_t pfrac[4])
  398. {
  399. int i, j;
  400. float *v_lag, *v_out;
  401. const float *v_len;
  402. v_out = memory + 143; // Output vector starts at memory[143].
  403. for(i=0; i<4; i++)
  404. {
  405. if(gain[i])
  406. {
  407. v_lag = memory + 143 + 40 * i - lag[i];
  408. for(v_len=v_in+40; v_in<v_len; v_in++)
  409. {
  410. if(pfrac[i]) // If it is a fractional lag...
  411. {
  412. for(j=0, *v_out=0.; j<4; j++)
  413. *v_out += qcelp_hammsinc_table[j] * (v_lag[j-4] + v_lag[3-j]);
  414. }else
  415. *v_out = *v_lag;
  416. *v_out = *v_in + gain[i] * *v_out;
  417. v_lag++;
  418. v_out++;
  419. }
  420. }else
  421. {
  422. memcpy(v_out, v_in, 40 * sizeof(float));
  423. v_in += 40;
  424. v_out += 40;
  425. }
  426. }
  427. memmove(memory, memory + 160, 143 * sizeof(float));
  428. return memory + 143;
  429. }
  430. /**
  431. * Interpolates LSP frequencies and computes LPC coefficients
  432. * for a given bitrate & pitch subframe.
  433. *
  434. * TIA/EIA/IS-733 2.4.3.3.4
  435. *
  436. * @param q the context
  437. * @param curr_lspf LSP frequencies vector of the current frame
  438. * @param lpc float vector for the resulting LPC
  439. * @param subframe_num frame number in decoded stream
  440. */
  441. void interpolate_lpc(QCELPContext *q, const float *curr_lspf, float *lpc,
  442. const int subframe_num)
  443. {
  444. float interpolated_lspf[10];
  445. float weight;
  446. if(q->bitrate >= RATE_QUARTER)
  447. weight = 0.25 * (subframe_num + 1);
  448. else if(q->bitrate == RATE_OCTAVE && !subframe_num)
  449. weight = 0.625;
  450. else
  451. weight = 1.0;
  452. if(weight != 1.0)
  453. {
  454. weighted_vector_sumf(interpolated_lspf, curr_lspf, q->prev_lspf,
  455. weight, 1.0 - weight, 10);
  456. qcelp_lspf2lpc(interpolated_lspf, lpc);
  457. }else if(q->bitrate >= RATE_QUARTER || (q->bitrate == I_F_Q && !subframe_num))
  458. qcelp_lspf2lpc(curr_lspf, lpc);
  459. }
  460. static int buf_size2bitrate(const int buf_size)
  461. {
  462. switch(buf_size)
  463. {
  464. case 35:
  465. return RATE_FULL;
  466. case 17:
  467. return RATE_HALF;
  468. case 8:
  469. return RATE_QUARTER;
  470. case 4:
  471. return RATE_OCTAVE;
  472. case 1:
  473. return SILENCE;
  474. }
  475. return -1;
  476. }
  477. static void warn_insufficient_frame_quality(AVCodecContext *avctx,
  478. const char *message)
  479. {
  480. av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n", avctx->frame_number,
  481. message);
  482. }
  483. static int qcelp_decode_frame(AVCodecContext *avctx,
  484. void *data,
  485. int *data_size,
  486. uint8_t *buf,
  487. const int buf_size) {
  488. QCELPContext *q = avctx->priv_data;
  489. float *outbuffer = data;
  490. int i;
  491. float quantized_lspf[10], lpc[10];
  492. float gain[16];
  493. float *formant_mem;
  494. if ((q->bitrate = determine_bitrate(avctx, buf_size, &buf)) == I_F_Q) {
  495. warn_insufficient_frame_quality(avctx, "bitrate cannot be determined.");
  496. goto erasure;
  497. }
  498. if (q->bitrate == RATE_OCTAVE &&
  499. (q->first16bits = AV_RB16(buf)) == 0xFFFF) {
  500. warn_insufficient_frame_quality(avctx, "Bitrate is 1/8 and first 16 bits are on.");
  501. goto erasure;
  502. }
  503. if (q->bitrate > SILENCE) {
  504. const QCELPBitmap *bitmaps = qcelp_unpacking_bitmaps_per_rate[q->bitrate];
  505. const QCELPBitmap *bitmaps_end = qcelp_unpacking_bitmaps_per_rate[q->bitrate]
  506. + qcelp_unpacking_bitmaps_lengths[q->bitrate];
  507. uint8_t *unpacked_data = (uint8_t *)&q->frame;
  508. init_get_bits(&q->gb, buf, 8*buf_size);
  509. memset(&q->frame, 0, sizeof(QCELPFrame));
  510. for (; bitmaps < bitmaps_end; bitmaps++)
  511. unpacked_data[bitmaps->index] |= get_bits(&q->gb, bitmaps->bitlen) << bitmaps->bitpos;
  512. // Check for erasures/blanks on rates 1, 1/4 and 1/8.
  513. if (q->frame.reserved) {
  514. warn_insufficient_frame_quality(avctx, "Wrong data in reserved frame area.");
  515. goto erasure;
  516. }
  517. if (q->bitrate == RATE_QUARTER && codebook_sanity_check_for_rate_quarter(q->frame.cbgain)) {
  518. warn_insufficient_frame_quality(avctx, "Codebook gain sanity check failed.");
  519. goto erasure;
  520. }
  521. if (q->bitrate >= RATE_HALF) {
  522. for (i = 0; i < 4; i++) {
  523. if (q->frame.pfrac[i] && q->frame.plag[i] >= 124) {
  524. warn_insufficient_frame_quality(avctx, "Cannot initialize pitch filter.");
  525. goto erasure;
  526. }
  527. }
  528. }
  529. }
  530. decode_gain_and_index(q, gain);
  531. compute_svector(q, gain, outbuffer);
  532. if (decode_lspf(q, quantized_lspf) < 0) {
  533. warn_insufficient_frame_quality(avctx, "Badly received packets in frame.");
  534. goto erasure;
  535. }
  536. apply_pitch_filters(q, outbuffer);
  537. if (q->bitrate == I_F_Q) {
  538. erasure:
  539. q->bitrate = I_F_Q;
  540. q->erasure_count++;
  541. decode_gain_and_index(q, gain);
  542. compute_svector(q, gain, outbuffer);
  543. decode_lspf(q, quantized_lspf);
  544. apply_pitch_filters(q, outbuffer);
  545. } else
  546. q->erasure_count = 0;
  547. formant_mem = q->formant_mem + 10;
  548. for (i = 0; i < 4; i++) {
  549. interpolate_lpc(q, quantized_lspf, lpc, i);
  550. ff_celp_lp_synthesis_filterf(formant_mem, lpc, outbuffer + i * 40, 40, 10);
  551. formant_mem += 40;
  552. }
  553. memcpy(q->formant_mem, q->formant_mem + 160, 10 * sizeof(float));
  554. // FIXME: postfilter and final gain control should be here.
  555. // TIA/EIA/IS-733 2.4.8.6
  556. formant_mem = q->formant_mem + 10;
  557. for (i = 0; i < 160; i++)
  558. *outbuffer++ = av_clipf(*formant_mem++, QCELP_CLIP_LOWER_BOUND, QCELP_CLIP_UPPER_BOUND);
  559. memcpy(q->prev_lspf, quantized_lspf, sizeof(q->prev_lspf));
  560. q->prev_bitrate = q->bitrate;
  561. *data_size = 160 * sizeof(*outbuffer);
  562. return *data_size;
  563. }
  564. AVCodec qcelp_decoder =
  565. {
  566. .name = "qcelp",
  567. .type = CODEC_TYPE_AUDIO,
  568. .id = CODEC_ID_QCELP,
  569. .init = qcelp_decode_init,
  570. .decode = qcelp_decode_frame,
  571. .priv_data_size = sizeof(QCELPContext),
  572. .long_name = NULL_IF_CONFIG_SMALL("QCELP / PureVoice"),
  573. };