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)
00337 {
00338 int res = 0;
00339
00340 while (order--)
00341 res += *v1++ * *v2++;
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 ctx->pitch_delay_int_prev = PITCH_DELAY_MIN;
00375
00376
00377 ctx->rand_value = 21845;
00378
00379
00380 for(i=0; i<4; i++)
00381 ctx->quant_energy[i] = -14336;
00382
00383 ff_dsputil_init(&ctx->dsp, avctx);
00384 ctx->dsp.scalarproduct_int16 = scalarproduct_int16_c;
00385
00386 avcodec_get_frame_defaults(&ctx->frame);
00387 avctx->coded_frame = &ctx->frame;
00388
00389 return 0;
00390 }
00391
00392 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
00393 AVPacket *avpkt)
00394 {
00395 const uint8_t *buf = avpkt->data;
00396 int buf_size = avpkt->size;
00397 int16_t *out_frame;
00398 GetBitContext gb;
00399 const G729FormatDescription *format;
00400 int frame_erasure = 0;
00401 int bad_pitch = 0;
00402 int i;
00403 int16_t *tmp;
00404 G729Formats packet_type;
00405 G729Context *ctx = avctx->priv_data;
00406 int16_t lp[2][11];
00407 uint8_t ma_predictor;
00408 uint8_t quantizer_1st;
00409 uint8_t quantizer_2nd_lo;
00410 uint8_t quantizer_2nd_hi;
00411
00412 int pitch_delay_int[2];
00413 int pitch_delay_3x;
00414 int16_t fc[SUBFRAME_SIZE];
00415 int16_t synth[SUBFRAME_SIZE+10];
00416 int j, ret;
00417 int gain_before, gain_after;
00418 int is_periodic = 0;
00419
00420 ctx->frame.nb_samples = SUBFRAME_SIZE<<1;
00421 if ((ret = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
00422 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
00423 return ret;
00424 }
00425 out_frame = (int16_t*) ctx->frame.data[0];
00426
00427 if (buf_size == 10) {
00428 packet_type = FORMAT_G729_8K;
00429 format = &format_g729_8k;
00430
00431 ctx->onset = 0;
00432 ctx->voice_decision = DECISION_VOICE;
00433 av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729 @ 8kbit/s");
00434 } else if (buf_size == 8) {
00435 packet_type = FORMAT_G729D_6K4;
00436 format = &format_g729d_6k4;
00437 av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729D @ 6.4kbit/s");
00438 } else {
00439 av_log(avctx, AV_LOG_ERROR, "Packet size %d is unknown.\n", buf_size);
00440 return AVERROR_INVALIDDATA;
00441 }
00442
00443 for (i=0; i < buf_size; i++)
00444 frame_erasure |= buf[i];
00445 frame_erasure = !frame_erasure;
00446
00447 init_get_bits(&gb, buf, 8*buf_size);
00448
00449 ma_predictor = get_bits(&gb, 1);
00450 quantizer_1st = get_bits(&gb, VQ_1ST_BITS);
00451 quantizer_2nd_lo = get_bits(&gb, VQ_2ND_BITS);
00452 quantizer_2nd_hi = get_bits(&gb, VQ_2ND_BITS);
00453
00454 if(frame_erasure)
00455 lsf_restore_from_previous(ctx->lsfq, ctx->past_quantizer_outputs,
00456 ctx->ma_predictor_prev);
00457 else {
00458 lsf_decode(ctx->lsfq, ctx->past_quantizer_outputs,
00459 ma_predictor,
00460 quantizer_1st, quantizer_2nd_lo, quantizer_2nd_hi);
00461 ctx->ma_predictor_prev = ma_predictor;
00462 }
00463
00464 tmp = ctx->past_quantizer_outputs[MA_NP];
00465 memmove(ctx->past_quantizer_outputs + 1, ctx->past_quantizer_outputs,
00466 MA_NP * sizeof(int16_t*));
00467 ctx->past_quantizer_outputs[0] = tmp;
00468
00469 ff_acelp_lsf2lsp(ctx->lsp[1], ctx->lsfq, 10);
00470
00471 ff_acelp_lp_decode(&lp[0][0], &lp[1][0], ctx->lsp[1], ctx->lsp[0], 10);
00472
00473 FFSWAP(int16_t*, ctx->lsp[1], ctx->lsp[0]);
00474
00475 for (i = 0; i < 2; i++) {
00476 int gain_corr_factor;
00477
00478 uint8_t ac_index;
00479 uint8_t pulses_signs;
00480 int fc_indexes;
00481 uint8_t gc_1st_index;
00482 uint8_t gc_2nd_index;
00483
00484 ac_index = get_bits(&gb, format->ac_index_bits[i]);
00485 if(!i && format->parity_bit)
00486 bad_pitch = get_parity(ac_index) == get_bits1(&gb);
00487 fc_indexes = get_bits(&gb, format->fc_indexes_bits);
00488 pulses_signs = get_bits(&gb, format->fc_signs_bits);
00489 gc_1st_index = get_bits(&gb, format->gc_1st_index_bits);
00490 gc_2nd_index = get_bits(&gb, format->gc_2nd_index_bits);
00491
00492 if (frame_erasure)
00493 pitch_delay_3x = 3 * ctx->pitch_delay_int_prev;
00494 else if(!i) {
00495 if (bad_pitch)
00496 pitch_delay_3x = 3 * ctx->pitch_delay_int_prev;
00497 else
00498 pitch_delay_3x = ff_acelp_decode_8bit_to_1st_delay3(ac_index);
00499 } else {
00500 int pitch_delay_min = av_clip(ctx->pitch_delay_int_prev - 5,
00501 PITCH_DELAY_MIN, PITCH_DELAY_MAX - 9);
00502
00503 if(packet_type == FORMAT_G729D_6K4)
00504 pitch_delay_3x = ff_acelp_decode_4bit_to_2nd_delay3(ac_index, pitch_delay_min);
00505 else
00506 pitch_delay_3x = ff_acelp_decode_5_6_bit_to_2nd_delay3(ac_index, pitch_delay_min);
00507 }
00508
00509
00510 pitch_delay_int[i] = (pitch_delay_3x + 1) / 3;
00511
00512 if (frame_erasure) {
00513 ctx->rand_value = g729_prng(ctx->rand_value);
00514 fc_indexes = ctx->rand_value & ((1 << format->fc_indexes_bits) - 1);
00515
00516 ctx->rand_value = g729_prng(ctx->rand_value);
00517 pulses_signs = ctx->rand_value;
00518 }
00519
00520
00521 memset(fc, 0, sizeof(int16_t) * SUBFRAME_SIZE);
00522 switch (packet_type) {
00523 case FORMAT_G729_8K:
00524 ff_acelp_fc_pulse_per_track(fc, ff_fc_4pulses_8bits_tracks_13,
00525 ff_fc_4pulses_8bits_track_4,
00526 fc_indexes, pulses_signs, 3, 3);
00527 break;
00528 case FORMAT_G729D_6K4:
00529 ff_acelp_fc_pulse_per_track(fc, ff_fc_2pulses_9bits_track1_gray,
00530 ff_fc_2pulses_9bits_track2_gray,
00531 fc_indexes, pulses_signs, 1, 4);
00532 break;
00533 }
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543 ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i],
00544 fc + pitch_delay_int[i],
00545 fc, 1 << 14,
00546 av_clip(ctx->past_gain_pitch[0], SHARP_MIN, SHARP_MAX),
00547 0, 14,
00548 SUBFRAME_SIZE - pitch_delay_int[i]);
00549
00550 memmove(ctx->past_gain_pitch+1, ctx->past_gain_pitch, 5 * sizeof(int16_t));
00551 ctx->past_gain_code[1] = ctx->past_gain_code[0];
00552
00553 if (frame_erasure) {
00554 ctx->past_gain_pitch[0] = (29491 * ctx->past_gain_pitch[0]) >> 15;
00555 ctx->past_gain_code[0] = ( 2007 * ctx->past_gain_code[0] ) >> 11;
00556
00557 gain_corr_factor = 0;
00558 } else {
00559 if (packet_type == FORMAT_G729D_6K4) {
00560 ctx->past_gain_pitch[0] = cb_gain_1st_6k4[gc_1st_index][0] +
00561 cb_gain_2nd_6k4[gc_2nd_index][0];
00562 gain_corr_factor = cb_gain_1st_6k4[gc_1st_index][1] +
00563 cb_gain_2nd_6k4[gc_2nd_index][1];
00564
00565
00566
00567
00568 gain_corr_factor = FFMAX(gain_corr_factor, 1024);
00569 #ifndef G729_BITEXACT
00570 gain_corr_factor >>= 1;
00571 #endif
00572 } else {
00573 ctx->past_gain_pitch[0] = cb_gain_1st_8k[gc_1st_index][0] +
00574 cb_gain_2nd_8k[gc_2nd_index][0];
00575 gain_corr_factor = cb_gain_1st_8k[gc_1st_index][1] +
00576 cb_gain_2nd_8k[gc_2nd_index][1];
00577 }
00578
00579
00580 ctx->past_gain_code[0] = ff_acelp_decode_gain_code(&ctx->dsp, gain_corr_factor,
00581 fc, MR_ENERGY,
00582 ctx->quant_energy,
00583 ma_prediction_coeff,
00584 SUBFRAME_SIZE, 4);
00585 #ifdef G729_BITEXACT
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595 if (packet_type == FORMAT_G729D_6K4) {
00596 gain_corr_factor >>= 1;
00597 ctx->past_gain_code[0] >>= 1;
00598 }
00599 #endif
00600 }
00601 ff_acelp_update_past_gain(ctx->quant_energy, gain_corr_factor, 2, frame_erasure);
00602
00603
00604 ff_acelp_interpolate(ctx->exc + i * SUBFRAME_SIZE,
00605 ctx->exc + i * SUBFRAME_SIZE - pitch_delay_3x / 3,
00606 ff_acelp_interp_filter, 6,
00607 (pitch_delay_3x % 3) << 1,
00608 10, SUBFRAME_SIZE);
00609
00610 ff_acelp_weighted_vector_sum(ctx->exc + i * SUBFRAME_SIZE,
00611 ctx->exc + i * SUBFRAME_SIZE, fc,
00612 (!ctx->was_periodic && frame_erasure) ? 0 : ctx->past_gain_pitch[0],
00613 ( ctx->was_periodic && frame_erasure) ? 0 : ctx->past_gain_code[0],
00614 1 << 13, 14, SUBFRAME_SIZE);
00615
00616 memcpy(synth, ctx->syn_filter_data, 10 * sizeof(int16_t));
00617
00618 if (ff_celp_lp_synthesis_filter(
00619 synth+10,
00620 &lp[i][1],
00621 ctx->exc + i * SUBFRAME_SIZE,
00622 SUBFRAME_SIZE,
00623 10,
00624 1,
00625 0,
00626 0x800))
00627
00628 for (j = 0; j < 2 * SUBFRAME_SIZE + PITCH_DELAY_MAX + INTERPOL_LEN; j++)
00629 ctx->exc_base[j] >>= 2;
00630
00631
00632 if (packet_type == FORMAT_G729D_6K4) {
00633 int16_t exc_new[SUBFRAME_SIZE];
00634
00635 ctx->onset = g729d_onset_decision(ctx->onset, ctx->past_gain_code);
00636 ctx->voice_decision = g729d_voice_decision(ctx->onset, ctx->voice_decision, ctx->past_gain_pitch);
00637
00638 g729d_get_new_exc(exc_new, ctx->exc + i * SUBFRAME_SIZE, fc, ctx->voice_decision, ctx->past_gain_code[0], SUBFRAME_SIZE);
00639
00640 ff_celp_lp_synthesis_filter(
00641 synth+10,
00642 &lp[i][1],
00643 exc_new,
00644 SUBFRAME_SIZE,
00645 10,
00646 0,
00647 0,
00648 0x800);
00649 } else {
00650 ff_celp_lp_synthesis_filter(
00651 synth+10,
00652 &lp[i][1],
00653 ctx->exc + i * SUBFRAME_SIZE,
00654 SUBFRAME_SIZE,
00655 10,
00656 0,
00657 0,
00658 0x800);
00659 }
00660
00661 memcpy(ctx->syn_filter_data, synth+SUBFRAME_SIZE, 10 * sizeof(int16_t));
00662
00663
00664 gain_before = 0;
00665 for (j = 0; j < SUBFRAME_SIZE; j++)
00666 gain_before += FFABS(synth[j+10]);
00667
00668
00669 ff_g729_postfilter(
00670 &ctx->dsp,
00671 &ctx->ht_prev_data,
00672 &is_periodic,
00673 &lp[i][0],
00674 pitch_delay_int[0],
00675 ctx->residual,
00676 ctx->res_filter_data,
00677 ctx->pos_filter_data,
00678 synth+10,
00679 SUBFRAME_SIZE);
00680
00681
00682 gain_after = 0;
00683 for(j=0; j<SUBFRAME_SIZE; j++)
00684 gain_after += FFABS(synth[j+10]);
00685
00686 ctx->gain_coeff = ff_g729_adaptive_gain_control(
00687 gain_before,
00688 gain_after,
00689 synth+10,
00690 SUBFRAME_SIZE,
00691 ctx->gain_coeff);
00692
00693 if (frame_erasure)
00694 ctx->pitch_delay_int_prev = FFMIN(ctx->pitch_delay_int_prev + 1, PITCH_DELAY_MAX);
00695 else
00696 ctx->pitch_delay_int_prev = pitch_delay_int[i];
00697
00698 memcpy(synth+8, ctx->hpf_z, 2*sizeof(int16_t));
00699 ff_acelp_high_pass_filter(
00700 out_frame + i*SUBFRAME_SIZE,
00701 ctx->hpf_f,
00702 synth+10,
00703 SUBFRAME_SIZE);
00704 memcpy(ctx->hpf_z, synth+8+SUBFRAME_SIZE, 2*sizeof(int16_t));
00705 }
00706
00707 ctx->was_periodic = is_periodic;
00708
00709
00710 memmove(ctx->exc_base, ctx->exc_base + 2 * SUBFRAME_SIZE, (PITCH_DELAY_MAX+INTERPOL_LEN)*sizeof(int16_t));
00711
00712 *got_frame_ptr = 1;
00713 *(AVFrame*)data = ctx->frame;
00714 return buf_size;
00715 }
00716
00717 AVCodec ff_g729_decoder = {
00718 .name = "g729",
00719 .type = AVMEDIA_TYPE_AUDIO,
00720 .id = AV_CODEC_ID_G729,
00721 .priv_data_size = sizeof(G729Context),
00722 .init = decoder_init,
00723 .decode = decode_frame,
00724 .capabilities = CODEC_CAP_DR1,
00725 .long_name = NULL_IF_CONFIG_SMALL("G.729"),
00726 };