00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <inttypes.h>
00023 #include <string.h>
00024
00025 #include "avcodec.h"
00026 #include "libavutil/avutil.h"
00027 #include "get_bits.h"
00028 #include "dsputil.h"
00029
00030 #include "g729.h"
00031 #include "lsp.h"
00032 #include "celp_math.h"
00033 #include "celp_filters.h"
00034 #include "acelp_filters.h"
00035 #include "acelp_pitch_delay.h"
00036 #include "acelp_vectors.h"
00037 #include "g729data.h"
00038 #include "g729postfilter.h"
00039
00044 #define LSFQ_MIN 40
00045
00050 #define LSFQ_MAX 25681
00051
00056 #define LSFQ_DIFF_MIN 321
00057
00059 #define INTERPOL_LEN 11
00060
00065 #define SHARP_MIN 3277
00066
00074 #define SHARP_MAX 13017
00075
00079 #define MR_ENERGY 1018156
00080
00081 #define DECISION_NOISE 0
00082 #define DECISION_INTERMEDIATE 1
00083 #define DECISION_VOICE 2
00084
00085 typedef enum {
00086 FORMAT_G729_8K = 0,
00087 FORMAT_G729D_6K4,
00088 FORMAT_COUNT,
00089 } G729Formats;
00090
00091 typedef struct {
00092 uint8_t ac_index_bits[2];
00093 uint8_t parity_bit;
00094 uint8_t gc_1st_index_bits;
00095 uint8_t gc_2nd_index_bits;
00096 uint8_t fc_signs_bits;
00097 uint8_t fc_indexes_bits;
00098 } G729FormatDescription;
00099
00100 typedef struct {
00101 DSPContext dsp;
00102 AVFrame frame;
00103
00105 int16_t exc_base[2*SUBFRAME_SIZE+PITCH_DELAY_MAX+INTERPOL_LEN];
00106
00107 int16_t* exc;
00108 int pitch_delay_int_prev;
00109
00111 int16_t past_quantizer_output_buf[MA_NP + 1][10];
00112 int16_t* past_quantizer_outputs[MA_NP + 1];
00113
00114 int16_t lsfq[10];
00115 int16_t lsp_buf[2][10];
00116 int16_t *lsp[2];
00117
00118 int16_t quant_energy[4];
00119
00121 int16_t syn_filter_data[10];
00122
00123
00125 int16_t residual[SUBFRAME_SIZE + RES_PREV_DATA_SIZE];
00126
00128 int16_t res_filter_data[SUBFRAME_SIZE+10];
00129
00131 int16_t pos_filter_data[SUBFRAME_SIZE+10];
00132
00134 int16_t past_gain_pitch[6];
00135
00137 int16_t past_gain_code[2];
00138
00140 int16_t voice_decision;
00141
00142 int16_t onset;
00143 int16_t was_periodic;
00144 int16_t ht_prev_data;
00145 int gain_coeff;
00146 uint16_t rand_value;
00147 int ma_predictor_prev;
00148
00150 int hpf_f[2];
00151
00153 int16_t hpf_z[2];
00154 } G729Context;
00155
00156 static const G729FormatDescription format_g729_8k = {
00157 .ac_index_bits = {8,5},
00158 .parity_bit = 1,
00159 .gc_1st_index_bits = GC_1ST_IDX_BITS_8K,
00160 .gc_2nd_index_bits = GC_2ND_IDX_BITS_8K,
00161 .fc_signs_bits = 4,
00162 .fc_indexes_bits = 13,
00163 };
00164
00165 static const G729FormatDescription format_g729d_6k4 = {
00166 .ac_index_bits = {8,4},
00167 .parity_bit = 0,
00168 .gc_1st_index_bits = GC_1ST_IDX_BITS_6K4,
00169 .gc_2nd_index_bits = GC_2ND_IDX_BITS_6K4,
00170 .fc_signs_bits = 2,
00171 .fc_indexes_bits = 9,
00172 };
00173
00177 static inline uint16_t g729_prng(uint16_t value)
00178 {
00179 return 31821 * value + 13849;
00180 }
00181
00185 static inline int get_parity(uint8_t value)
00186 {
00187 return (0x6996966996696996ULL >> (value >> 2)) & 1;
00188 }
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 static void lsf_decode(int16_t* lsfq, int16_t* past_quantizer_outputs[MA_NP + 1],
00200 int16_t ma_predictor,
00201 int16_t vq_1st, int16_t vq_2nd_low, int16_t vq_2nd_high)
00202 {
00203 int i,j;
00204 static const uint8_t min_distance[2]={10, 5};
00205 int16_t* quantizer_output = past_quantizer_outputs[MA_NP];
00206
00207 for (i = 0; i < 5; i++) {
00208 quantizer_output[i] = cb_lsp_1st[vq_1st][i ] + cb_lsp_2nd[vq_2nd_low ][i ];
00209 quantizer_output[i + 5] = cb_lsp_1st[vq_1st][i + 5] + cb_lsp_2nd[vq_2nd_high][i + 5];
00210 }
00211
00212 for (j = 0; j < 2; j++) {
00213 for (i = 1; i < 10; i++) {
00214 int diff = (quantizer_output[i - 1] - quantizer_output[i] + min_distance[j]) >> 1;
00215 if (diff > 0) {
00216 quantizer_output[i - 1] -= diff;
00217 quantizer_output[i ] += diff;
00218 }
00219 }
00220 }
00221
00222 for (i = 0; i < 10; i++) {
00223 int sum = quantizer_output[i] * cb_ma_predictor_sum[ma_predictor][i];
00224 for (j = 0; j < MA_NP; j++)
00225 sum += past_quantizer_outputs[j][i] * cb_ma_predictor[ma_predictor][j][i];
00226
00227 lsfq[i] = sum >> 15;
00228 }
00229
00230 ff_acelp_reorder_lsf(lsfq, LSFQ_DIFF_MIN, LSFQ_MIN, LSFQ_MAX, 10);
00231 }
00232
00240 static void lsf_restore_from_previous(int16_t* lsfq,
00241 int16_t* past_quantizer_outputs[MA_NP + 1],
00242 int ma_predictor_prev)
00243 {
00244 int16_t* quantizer_output = past_quantizer_outputs[MA_NP];
00245 int i,k;
00246
00247 for (i = 0; i < 10; i++) {
00248 int tmp = lsfq[i] << 15;
00249
00250 for (k = 0; k < MA_NP; k++)
00251 tmp -= past_quantizer_outputs[k][i] * cb_ma_predictor[ma_predictor_prev][k][i];
00252
00253 quantizer_output[i] = ((tmp >> 15) * cb_ma_predictor_sum_inv[ma_predictor_prev][i]) >> 12;
00254 }
00255 }
00256
00265 static void g729d_get_new_exc(
00266 int16_t* out,
00267 const int16_t* in,
00268 const int16_t* fc_cur,
00269 int dstate,
00270 int gain_code,
00271 int subframe_size)
00272 {
00273 int i;
00274 int16_t fc_new[SUBFRAME_SIZE];
00275
00276 ff_celp_convolve_circ(fc_new, fc_cur, phase_filter[dstate], subframe_size);
00277
00278 for(i=0; i<subframe_size; i++)
00279 {
00280 out[i] = in[i];
00281 out[i] -= (gain_code * fc_cur[i] + 0x2000) >> 14;
00282 out[i] += (gain_code * fc_new[i] + 0x2000) >> 14;
00283 }
00284 }
00285
00293 static int g729d_onset_decision(int past_onset, const int16_t* past_gain_code)
00294 {
00295 if((past_gain_code[0] >> 1) > past_gain_code[1])
00296 return 2;
00297 else
00298 return FFMAX(past_onset-1, 0);
00299 }
00300
00309 static int16_t g729d_voice_decision(int onset, int prev_voice_decision, const int16_t* past_gain_pitch)
00310 {
00311 int i, low_gain_pitch_cnt, voice_decision;
00312
00313 if(past_gain_pitch[0] >= 14745)
00314 voice_decision = DECISION_VOICE;
00315 else if (past_gain_pitch[0] <= 9830)
00316 voice_decision = DECISION_NOISE;
00317 else
00318 voice_decision = DECISION_INTERMEDIATE;
00319
00320 for(i=0, low_gain_pitch_cnt=0; i<6; i++)
00321 if(past_gain_pitch[i] < 9830)
00322 low_gain_pitch_cnt++;
00323
00324 if(low_gain_pitch_cnt > 2 && !onset)
00325 voice_decision = DECISION_NOISE;
00326
00327 if(!onset && voice_decision > prev_voice_decision + 1)
00328 voice_decision--;
00329
00330 if(onset && voice_decision < DECISION_VOICE)
00331 voice_decision++;
00332
00333 return voice_decision;
00334 }
00335
00336 static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order, int shift)
00337 {
00338 int res = 0;
00339
00340 while (order--)
00341 res += (*v1++ * *v2++) >> shift;
00342
00343 return res;
00344 }
00345
00346 static av_cold int decoder_init(AVCodecContext * avctx)
00347 {
00348 G729Context* ctx = avctx->priv_data;
00349 int i,k;
00350
00351 if (avctx->channels != 1) {
00352 av_log(avctx, AV_LOG_ERROR, "Only mono sound is supported (requested channels: %d).\n", avctx->channels);
00353 return AVERROR(EINVAL);
00354 }
00355 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
00356
00357
00358 avctx->frame_size = SUBFRAME_SIZE << 1;
00359
00360 ctx->gain_coeff = 16384;
00361
00362 for (k = 0; k < MA_NP + 1; k++) {
00363 ctx->past_quantizer_outputs[k] = ctx->past_quantizer_output_buf[k];
00364 for (i = 1; i < 11; i++)
00365 ctx->past_quantizer_outputs[k][i - 1] = (18717 * i) >> 3;
00366 }
00367
00368 ctx->lsp[0] = ctx->lsp_buf[0];
00369 ctx->lsp[1] = ctx->lsp_buf[1];
00370 memcpy(ctx->lsp[0], lsp_init, 10 * sizeof(int16_t));
00371
00372 ctx->exc = &ctx->exc_base[PITCH_DELAY_MAX+INTERPOL_LEN];
00373
00374
00375 ctx->rand_value = 21845;
00376
00377
00378 for(i=0; i<4; i++)
00379 ctx->quant_energy[i] = -14336;
00380
00381 dsputil_init(&ctx->dsp, avctx);
00382 ctx->dsp.scalarproduct_int16 = scalarproduct_int16_c;
00383
00384 avcodec_get_frame_defaults(&ctx->frame);
00385 avctx->coded_frame = &ctx->frame;
00386
00387 return 0;
00388 }
00389
00390 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
00391 AVPacket *avpkt)
00392 {
00393 const uint8_t *buf = avpkt->data;
00394 int buf_size = avpkt->size;
00395 int16_t *out_frame;
00396 GetBitContext gb;
00397 const G729FormatDescription *format;
00398 int frame_erasure = 0;
00399 int bad_pitch = 0;
00400 int i;
00401 int16_t *tmp;
00402 G729Formats packet_type;
00403 G729Context *ctx = avctx->priv_data;
00404 int16_t lp[2][11];
00405 uint8_t ma_predictor;
00406 uint8_t quantizer_1st;
00407 uint8_t quantizer_2nd_lo;
00408 uint8_t quantizer_2nd_hi;
00409
00410 int pitch_delay_int[2];
00411 int pitch_delay_3x;
00412 int16_t fc[SUBFRAME_SIZE];
00413 int16_t synth[SUBFRAME_SIZE+10];
00414 int j, ret;
00415 int gain_before, gain_after;
00416 int is_periodic = 0;
00417
00418 ctx->frame.nb_samples = SUBFRAME_SIZE<<1;
00419 if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
00420 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
00421 return ret;
00422 }
00423 out_frame= ctx->frame.data[0];
00424
00425 if (buf_size == 10) {
00426 packet_type = FORMAT_G729_8K;
00427 format = &format_g729_8k;
00428
00429 ctx->onset = 0;
00430 ctx->voice_decision = DECISION_VOICE;
00431 av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729 @ 8kbit/s");
00432 } else if (buf_size == 8) {
00433 packet_type = FORMAT_G729D_6K4;
00434 format = &format_g729d_6k4;
00435 av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729D @ 6.4kbit/s");
00436 } else {
00437 av_log(avctx, AV_LOG_ERROR, "Packet size %d is unknown.\n", buf_size);
00438 return AVERROR_INVALIDDATA;
00439 }
00440
00441 for (i=0; i < buf_size; i++)
00442 frame_erasure |= buf[i];
00443 frame_erasure = !frame_erasure;
00444
00445 init_get_bits(&gb, buf, 8*buf_size);
00446
00447 ma_predictor = get_bits(&gb, 1);
00448 quantizer_1st = get_bits(&gb, VQ_1ST_BITS);
00449 quantizer_2nd_lo = get_bits(&gb, VQ_2ND_BITS);
00450 quantizer_2nd_hi = get_bits(&gb, VQ_2ND_BITS);
00451
00452 if(frame_erasure)
00453 lsf_restore_from_previous(ctx->lsfq, ctx->past_quantizer_outputs,
00454 ctx->ma_predictor_prev);
00455 else {
00456 lsf_decode(ctx->lsfq, ctx->past_quantizer_outputs,
00457 ma_predictor,
00458 quantizer_1st, quantizer_2nd_lo, quantizer_2nd_hi);
00459 ctx->ma_predictor_prev = ma_predictor;
00460 }
00461
00462 tmp = ctx->past_quantizer_outputs[MA_NP];
00463 memmove(ctx->past_quantizer_outputs + 1, ctx->past_quantizer_outputs,
00464 MA_NP * sizeof(int16_t*));
00465 ctx->past_quantizer_outputs[0] = tmp;
00466
00467 ff_acelp_lsf2lsp(ctx->lsp[1], ctx->lsfq, 10);
00468
00469 ff_acelp_lp_decode(&lp[0][0], &lp[1][0], ctx->lsp[1], ctx->lsp[0], 10);
00470
00471 FFSWAP(int16_t*, ctx->lsp[1], ctx->lsp[0]);
00472
00473 for (i = 0; i < 2; i++) {
00474 int gain_corr_factor;
00475
00476 uint8_t ac_index;
00477 uint8_t pulses_signs;
00478 int fc_indexes;
00479 uint8_t gc_1st_index;
00480 uint8_t gc_2nd_index;
00481
00482 ac_index = get_bits(&gb, format->ac_index_bits[i]);
00483 if(!i && format->parity_bit)
00484 bad_pitch = get_parity(ac_index) == get_bits1(&gb);
00485 fc_indexes = get_bits(&gb, format->fc_indexes_bits);
00486 pulses_signs = get_bits(&gb, format->fc_signs_bits);
00487 gc_1st_index = get_bits(&gb, format->gc_1st_index_bits);
00488 gc_2nd_index = get_bits(&gb, format->gc_2nd_index_bits);
00489
00490 if (frame_erasure)
00491 pitch_delay_3x = 3 * ctx->pitch_delay_int_prev;
00492 else if(!i) {
00493 if (bad_pitch)
00494 pitch_delay_3x = 3 * ctx->pitch_delay_int_prev;
00495 else
00496 pitch_delay_3x = ff_acelp_decode_8bit_to_1st_delay3(ac_index);
00497 } else {
00498 int pitch_delay_min = av_clip(ctx->pitch_delay_int_prev - 5,
00499 PITCH_DELAY_MIN, PITCH_DELAY_MAX - 9);
00500
00501 if(packet_type == FORMAT_G729D_6K4)
00502 pitch_delay_3x = ff_acelp_decode_4bit_to_2nd_delay3(ac_index, pitch_delay_min);
00503 else
00504 pitch_delay_3x = ff_acelp_decode_5_6_bit_to_2nd_delay3(ac_index, pitch_delay_min);
00505 }
00506
00507
00508 pitch_delay_int[i] = (pitch_delay_3x + 1) / 3;
00509
00510 if (frame_erasure) {
00511 ctx->rand_value = g729_prng(ctx->rand_value);
00512 fc_indexes = ctx->rand_value & ((1 << format->fc_indexes_bits) - 1);
00513
00514 ctx->rand_value = g729_prng(ctx->rand_value);
00515 pulses_signs = ctx->rand_value;
00516 }
00517
00518
00519 memset(fc, 0, sizeof(int16_t) * SUBFRAME_SIZE);
00520 switch (packet_type) {
00521 case FORMAT_G729_8K:
00522 ff_acelp_fc_pulse_per_track(fc, ff_fc_4pulses_8bits_tracks_13,
00523 ff_fc_4pulses_8bits_track_4,
00524 fc_indexes, pulses_signs, 3, 3);
00525 break;
00526 case FORMAT_G729D_6K4:
00527 ff_acelp_fc_pulse_per_track(fc, ff_fc_2pulses_9bits_track1_gray,
00528 ff_fc_2pulses_9bits_track2_gray,
00529 fc_indexes, pulses_signs, 1, 4);
00530 break;
00531 }
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541 ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i],
00542 fc + pitch_delay_int[i],
00543 fc, 1 << 14,
00544 av_clip(ctx->past_gain_pitch[0], SHARP_MIN, SHARP_MAX),
00545 0, 14,
00546 SUBFRAME_SIZE - pitch_delay_int[i]);
00547
00548 memmove(ctx->past_gain_pitch+1, ctx->past_gain_pitch, 5 * sizeof(int16_t));
00549 ctx->past_gain_code[1] = ctx->past_gain_code[0];
00550
00551 if (frame_erasure) {
00552 ctx->past_gain_pitch[0] = (29491 * ctx->past_gain_pitch[0]) >> 15;
00553 ctx->past_gain_code[0] = ( 2007 * ctx->past_gain_code[0] ) >> 11;
00554
00555 gain_corr_factor = 0;
00556 } else {
00557 if (packet_type == FORMAT_G729D_6K4) {
00558 ctx->past_gain_pitch[0] = cb_gain_1st_6k4[gc_1st_index][0] +
00559 cb_gain_2nd_6k4[gc_2nd_index][0];
00560 gain_corr_factor = cb_gain_1st_6k4[gc_1st_index][1] +
00561 cb_gain_2nd_6k4[gc_2nd_index][1];
00562
00563
00564
00565
00566 gain_corr_factor = FFMAX(gain_corr_factor, 1024);
00567 #ifndef G729_BITEXACT
00568 gain_corr_factor >>= 1;
00569 #endif
00570 } else {
00571 ctx->past_gain_pitch[0] = cb_gain_1st_8k[gc_1st_index][0] +
00572 cb_gain_2nd_8k[gc_2nd_index][0];
00573 gain_corr_factor = cb_gain_1st_8k[gc_1st_index][1] +
00574 cb_gain_2nd_8k[gc_2nd_index][1];
00575 }
00576
00577
00578 ctx->past_gain_code[0] = ff_acelp_decode_gain_code(&ctx->dsp, gain_corr_factor,
00579 fc, MR_ENERGY,
00580 ctx->quant_energy,
00581 ma_prediction_coeff,
00582 SUBFRAME_SIZE, 4);
00583 #ifdef G729_BITEXACT
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593 if (packet_type == FORMAT_G729D_6K4) {
00594 gain_corr_factor >>= 1;
00595 ctx->past_gain_code[0] >>= 1;
00596 }
00597 #endif
00598 }
00599 ff_acelp_update_past_gain(ctx->quant_energy, gain_corr_factor, 2, frame_erasure);
00600
00601
00602 ff_acelp_interpolate(ctx->exc + i * SUBFRAME_SIZE,
00603 ctx->exc + i * SUBFRAME_SIZE - pitch_delay_3x / 3,
00604 ff_acelp_interp_filter, 6,
00605 (pitch_delay_3x % 3) << 1,
00606 10, SUBFRAME_SIZE);
00607
00608 ff_acelp_weighted_vector_sum(ctx->exc + i * SUBFRAME_SIZE,
00609 ctx->exc + i * SUBFRAME_SIZE, fc,
00610 (!ctx->was_periodic && frame_erasure) ? 0 : ctx->past_gain_pitch[0],
00611 ( ctx->was_periodic && frame_erasure) ? 0 : ctx->past_gain_code[0],
00612 1 << 13, 14, SUBFRAME_SIZE);
00613
00614 memcpy(synth, ctx->syn_filter_data, 10 * sizeof(int16_t));
00615
00616 if (ff_celp_lp_synthesis_filter(
00617 synth+10,
00618 &lp[i][1],
00619 ctx->exc + i * SUBFRAME_SIZE,
00620 SUBFRAME_SIZE,
00621 10,
00622 1,
00623 0,
00624 0x800))
00625
00626 for (j = 0; j < 2 * SUBFRAME_SIZE + PITCH_DELAY_MAX + INTERPOL_LEN; j++)
00627 ctx->exc_base[j] >>= 2;
00628
00629
00630 if (packet_type == FORMAT_G729D_6K4) {
00631 int16_t exc_new[SUBFRAME_SIZE];
00632
00633 ctx->onset = g729d_onset_decision(ctx->onset, ctx->past_gain_code);
00634 ctx->voice_decision = g729d_voice_decision(ctx->onset, ctx->voice_decision, ctx->past_gain_pitch);
00635
00636 g729d_get_new_exc(exc_new, ctx->exc + i * SUBFRAME_SIZE, fc, ctx->voice_decision, ctx->past_gain_code[0], SUBFRAME_SIZE);
00637
00638 ff_celp_lp_synthesis_filter(
00639 synth+10,
00640 &lp[i][1],
00641 exc_new,
00642 SUBFRAME_SIZE,
00643 10,
00644 0,
00645 0,
00646 0x800);
00647 } else {
00648 ff_celp_lp_synthesis_filter(
00649 synth+10,
00650 &lp[i][1],
00651 ctx->exc + i * SUBFRAME_SIZE,
00652 SUBFRAME_SIZE,
00653 10,
00654 0,
00655 0,
00656 0x800);
00657 }
00658
00659 memcpy(ctx->syn_filter_data, synth+SUBFRAME_SIZE, 10 * sizeof(int16_t));
00660
00661
00662 gain_before = 0;
00663 for (j = 0; j < SUBFRAME_SIZE; j++)
00664 gain_before += FFABS(synth[j+10]);
00665
00666
00667 ff_g729_postfilter(
00668 &ctx->dsp,
00669 &ctx->ht_prev_data,
00670 &is_periodic,
00671 &lp[i][0],
00672 pitch_delay_int[0],
00673 ctx->residual,
00674 ctx->res_filter_data,
00675 ctx->pos_filter_data,
00676 synth+10,
00677 SUBFRAME_SIZE);
00678
00679
00680 gain_after = 0;
00681 for(j=0; j<SUBFRAME_SIZE; j++)
00682 gain_after += FFABS(synth[j+10]);
00683
00684 ctx->gain_coeff = ff_g729_adaptive_gain_control(
00685 gain_before,
00686 gain_after,
00687 synth+10,
00688 SUBFRAME_SIZE,
00689 ctx->gain_coeff);
00690
00691 if (frame_erasure)
00692 ctx->pitch_delay_int_prev = FFMIN(ctx->pitch_delay_int_prev + 1, PITCH_DELAY_MAX);
00693 else
00694 ctx->pitch_delay_int_prev = pitch_delay_int[i];
00695
00696 memcpy(synth+8, ctx->hpf_z, 2*sizeof(int16_t));
00697 ff_acelp_high_pass_filter(
00698 out_frame + i*SUBFRAME_SIZE,
00699 ctx->hpf_f,
00700 synth+10,
00701 SUBFRAME_SIZE);
00702 memcpy(ctx->hpf_z, synth+8+SUBFRAME_SIZE, 2*sizeof(int16_t));
00703 }
00704
00705 ctx->was_periodic = is_periodic;
00706
00707
00708 memmove(ctx->exc_base, ctx->exc_base + 2 * SUBFRAME_SIZE, (PITCH_DELAY_MAX+INTERPOL_LEN)*sizeof(int16_t));
00709
00710 *got_frame_ptr = 1;
00711 *(AVFrame*)data = ctx->frame;
00712 return buf_size;
00713 }
00714
00715 AVCodec ff_g729_decoder =
00716 {
00717 "g729",
00718 AVMEDIA_TYPE_AUDIO,
00719 CODEC_ID_G729,
00720 sizeof(G729Context),
00721 decoder_init,
00722 NULL,
00723 NULL,
00724 decode_frame,
00725 .capabilities = CODEC_CAP_DR1,
00726 .long_name = NULL_IF_CONFIG_SMALL("G.729"),
00727 };