Go to the documentation of this file.
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 },
67 c->band[0].scale_factor = 8;
68 c->band[1].scale_factor = 2;
69 c->prev_samples_pos = 22;
77 -35, -35, -2919, -2195, -1765, -1458, -1219, -1023,
78 -858, -714, -587, -473, -370, -276, -190, -110,
79 2919, 2195, 1765, 1458, 1219, 1023, 858, 714,
80 587, 473, 370, 276, 190, 110, 35, -35
93 const int skip = 8 -
c->bits_per_codeword;
107 for (j = 0; j < avpkt->
size; j++) {
108 int ilow, ihigh, rlow, rhigh, dhigh;
115 rlow =
av_clip_intp2((
c->band[0].scale_factor * quantizer_table[ilow] >> 10)
116 +
c->band[0].s_predictor, 14);
125 c->prev_samples[
c->prev_samples_pos++] = rlow + rhigh;
126 c->prev_samples[
c->prev_samples_pos++] = rlow - rhigh;
127 c->dsp.apply_qmf(
c->prev_samples +
c->prev_samples_pos - 24, xout);
131 memmove(
c->prev_samples,
c->prev_samples +
c->prev_samples_pos - 22,
132 22 *
sizeof(
c->prev_samples[0]));
133 c->prev_samples_pos = 22;
#define PREV_SAMPLES_BUF_SIZE
const int16_t ff_g722_low_inv_quant4[16]
This structure describes decoded (raw) audio or video data.
static av_cold int g722_decode_init(AVCodecContext *avctx)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
const int16_t ff_g722_low_inv_quant6[64]
static int g722_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
static const AVClass g722_decoder_class
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define FF_CODEC_DECODE_CB(func)
const int16_t ff_g722_high_inv_quant[4]
int(* init)(AVBSFContext *ctx)
#define CODEC_LONG_NAME(str)
static const int16_t low_inv_quant5[32]
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh, const int ihigh)
static const AVOption options[]
const char * av_default_item_name(void *ptr)
Return the context name.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
An AVChannelLayout holds information about the channel layout of audio data.
enum AVSampleFormat sample_fmt
audio sample format
static const int16_t *const low_inv_quants[3]
int nb_samples
number of audio samples (per channel) described by this frame
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Name of the codec implementation.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
const FFCodec ff_adpcm_g722_decoder
#define AV_CHANNEL_LAYOUT_MONO
This structure stores compressed data.
void ff_g722_update_low_predictor(struct G722Band *band, const int ilow)
av_cold void ff_g722dsp_init(G722DSPContext *c)
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.