45#define OFFSET(x) offsetof(G722Context, x)
46#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
48 {
"bits_per_codeword",
"Bits per G722 codeword",
OFFSET(bits_per_codeword),
AV_OPT_TYPE_INT, { .i64 = 8 }, 6, 8,
AD },
53 .class_name =
"g722 decoder",
69 c->band[0].scale_factor = 8;
70 c->band[1].scale_factor = 2;
71 c->prev_samples_pos = 22;
79 -35, -35, -2919, -2195, -1765, -1458, -1219, -1023,
80 -858, -714, -587, -473, -370, -276, -190, -110,
81 2919, 2195, 1765, 1458, 1219, 1023, 858, 714,
82 587, 473, 370, 276, 190, 110, 35, -35
95 const int skip = 8 -
c->bits_per_codeword;
103 out_buf = (int16_t *)
frame->data[0];
109 for (j = 0; j < avpkt->
size; j++) {
110 int ilow, ihigh, rlow, rhigh, dhigh;
117 rlow =
av_clip_intp2((
c->band[0].scale_factor * quantizer_table[ilow] >> 10)
118 +
c->band[0].s_predictor, 14);
127 c->prev_samples[
c->prev_samples_pos++] = rlow + rhigh;
128 c->prev_samples[
c->prev_samples_pos++] = rlow - rhigh;
129 c->dsp.apply_qmf(
c->prev_samples +
c->prev_samples_pos - 24, xout);
133 memmove(
c->prev_samples,
c->prev_samples +
c->prev_samples_pos - 22,
134 22 *
sizeof(
c->prev_samples[0]));
135 c->prev_samples_pos = 22;
const FFCodec ff_adpcm_g722_decoder
Libavcodec external API header.
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
Public libavutil channel layout APIs header.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#define PREV_SAMPLES_BUF_SIZE
static const AVClass g722_decoder_class
static const int16_t *const low_inv_quants[3]
static const int16_t low_inv_quant5[32]
static int g722_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static av_cold int g722_decode_init(AVCodecContext *avctx)
bitstream reader API header.
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AV_CHANNEL_LAYOUT_MONO
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_SAMPLE_FMT_S16
signed 16 bits
#define LIBAVUTIL_VERSION_INT
const int16_t ff_g722_low_inv_quant6[64]
const int16_t ff_g722_low_inv_quant4[16]
void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh, const int ihigh)
const int16_t ff_g722_high_inv_quant[4]
void ff_g722_update_low_predictor(struct G722Band *band, const int ilow)
av_cold void ff_g722dsp_init(G722DSPContext *c)
An AVChannelLayout holds information about the channel layout of audio data.
Describe the class of an AVClass context structure.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
int sample_rate
samples per second
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.