comparison g729dec.c @ 9853:ae38e13a63d6 libavcodec

G.729 decoder initialization routine (skeleton)
author voroshil
date Sun, 14 Jun 2009 02:31:06 +0000
parents af3cc583501e
children 498ceea90017
comparison
equal deleted inserted replaced
9852:af3cc583501e 9853:ae38e13a63d6
95 static inline int get_parity(uint8_t value) 95 static inline int get_parity(uint8_t value)
96 { 96 {
97 return (0x6996966996696996ULL >> (value >> 2)) & 1; 97 return (0x6996966996696996ULL >> (value >> 2)) & 1;
98 } 98 }
99 99
100 static av_cold int decoder_init(AVCodecContext * avctx)
101 {
100 if (avctx->channels != 1) { 102 if (avctx->channels != 1) {
101 av_log(avctx, AV_LOG_ERROR, "Only mono sound is supported (requested channels: %d).\n", avctx->channels); 103 av_log(avctx, AV_LOG_ERROR, "Only mono sound is supported (requested channels: %d).\n", avctx->channels);
102 return AVERROR_NOFMT; 104 return AVERROR_NOFMT;
103 } 105 }
106
107 /* Both 8kbit/s and 6.4kbit/s modes uses two subframes per frame. */
108 avctx->frame_size = SUBFRAME_SIZE << 1;
109
110 return 0;
111 }
104 112
105 ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i], 113 ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i],
106 fc + pitch_delay_int[i], 114 fc + pitch_delay_int[i],
107 fc, 1 << 14, 115 fc, 1 << 14,
108 av_clip(ctx->gain_pitch, SHARP_MIN, SHARP_MAX), 116 av_clip(ctx->gain_pitch, SHARP_MIN, SHARP_MAX),