39 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
40 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
41 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
42 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
43 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
44 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
52 -1, -1, 2, 6, -1, -1, 2, 6
56 -1, -1, -1, -1, 1, 2, 4, 6, -1, -1, -1, -1, 1, 2, 4, 6
60 -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 2, 2, 4, 5, 6,
61 -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 2, 2, 4, 5, 6
65 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
66 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 5, 5, 6, 6,
67 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
68 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 5, 5, 6, 6
72 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
73 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
74 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
75 2, 2, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6,
76 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
77 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
78 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
79 2, 2, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6
96 for (start_pos = 0; start_pos < 64; start_pos++) {
97 unsigned int dest_pos, table_pos;
99 for (table_pos = 0, dest_pos = start_pos;
101 table_pos++, dest_pos += 64) {
102 int put = 0,
count, table_value;
106 if (start_pos &
count)
125 int8_t channel_hint[2];
136 if (samples == 0xffffffff) {
141 if (samples > pkt->
size * 2)
145 if (channel_hint[0] & 0x80) {
146 channel_hint[0] = ~channel_hint[0];
162 for (chan = 0; chan < channels; chan++) {
163 uint16_t *dest = (uint16_t *)frame->
data[0] + chan;
164 int step_index = channel_hint[chan];
165 int output = pcm_data[chan];
169 int lookup_size,
lookup, highbit, lowbits;
171 step_index = av_clip(step_index, 0, 88);
173 lookup =
get_bits(&gb, lookup_size);
174 highbit = 1 << (lookup_size - 1);
175 lowbits = highbit - 1;
177 if (lookup & highbit)
182 if (lookup == lowbits) {
185 int predict_index,
diff;
187 predict_index = (lookup << (7 - lookup_size)) | (step_index << 6);
188 predict_index = av_clip(predict_index, 0, 5785);
195 output = av_clip_int16(output + diff);
211 .
name =
"adpcm_vima",
220 #if FF_API_VIMA_DECODER
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void skip_bits_long(GetBitContext *s, int n)
static const int8_t *const step_index_tables[]
static const int8_t index_table3[]
#define AV_CH_LAYOUT_STEREO
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
static int predict_table_init
static int get_sbits(GetBitContext *s, int n)
enum AVSampleFormat sample_fmt
audio sample format
bitstream reader API header.
static const int8_t index_table2[]
static const uint8_t size_table[]
static const int8_t index_table6[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const int16_t ff_adpcm_step_table[89]
This is the step table.
const char * name
Name of the codec implementation.
Libavcodec external API header.
uint64_t channel_layout
Audio channel layout.
audio channel layout utility functions
static const int8_t index_table4[]
static const int8_t index_table5[]
static av_cold int decode_init(AVCodecContext *avctx)
#define FF_ARRAY_ELEMS(a)
static const int8_t index_table1[]
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
AVCodec ff_adpcm_vima_decoder
static av_always_inline int diff(const uint32_t a, const uint32_t b)
int channels
number of audio channels
static uint16_t predict_table[5786 *2]
#define AV_CH_LAYOUT_MONO
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.