80      { -1, -1, -1, -1, 2, 4, 6, 8 },
 
   81      { -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 }
 
   95     unsigned int min_channels = 1;
 
   96     unsigned int max_channels = 2;
 
  188     step_index = av_clip(step_index, 0, 88);
 
  195     diff = ((2 * delta + 1) * step) >> 
shift;
 
  197     if (sign) predictor -= 
diff;
 
  198     else predictor += 
diff;
 
  208     int nibble, step_index, predictor, sign, 
delta, 
diff, step, 
shift;
 
  214     step_index = av_clip(step_index, 0, 88);
 
  216     sign = nibble & (1 << 
shift);
 
  217     delta = av_mod_uintp2(nibble, shift);
 
  218     diff = ((2 * delta + 1) * step) >> 
shift;
 
  220     if (sign) predictor -= 
diff;
 
  221     else predictor += 
diff;
 
  237     step_index = av_clip(step_index, 0, 88);
 
  240     if (nibble & 4) diff += step;
 
  241     if (nibble & 2) diff += step >> 1;
 
  242     if (nibble & 1) diff += step >> 2;
 
  260     predictor += ((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->
idelta;
 
  263     c->
sample1 = av_clip_int16(predictor);
 
  266     if (c->
idelta > INT_MAX/768) {
 
  276     int step_index, predictor, sign, 
delta, 
diff, step;
 
  280     step_index = av_clip(step_index, 0, 48);
 
  284     diff = ((2 * delta + 1) * step) >> 3;
 
  286     if (sign) predictor -= 
diff;
 
  287     else predictor += 
diff;
 
  289     c->
predictor = av_clip_intp2(predictor, 11);
 
  305     diff = ((2 * delta + 1) * c->
step) >> 3;
 
  311     c->
step = av_clip(new_step, 511, 32767);
 
  320     sign = nibble & (1<<(size-1));
 
  321     delta = nibble & ((1<<(size-1))-1);
 
  328     if (delta >= (2*size - 3) && c->
step < 3)
 
  330     else if (delta == 0 && c->
step > 0)
 
  346     c->
step = av_clip(c->
step, 127, 24576);
 
  355     c->
step = av_clip_uintp2(c->
step, 5);
 
  368     out0 += sample_offset;
 
  372         out1 += sample_offset;
 
  375         shift  = 12 - (in[4+i*2] & 15);
 
  376         filter = in[4+i*2] >> 4;
 
  391             s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
 
  393             s_1 = av_clip_int16(s);
 
  404         shift  = 12 - (in[5+i*2] & 15);
 
  405         filter = in[5+i*2] >> 4;
 
  418             s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
 
  420             s_1 = av_clip_int16(s);
 
  444     int k0, signmask, nb_bits, 
count;
 
  445     int size = buf_size*8;
 
  453     k0 = 1 << (nb_bits-2);
 
  454     signmask = 1 << (nb_bits-1);
 
  457         for (i = 0; i < avctx->
channels; i++) {
 
  465             for (i = 0; i < avctx->
channels; i++) {
 
  480                 if (delta & signmask)
 
  508                           int buf_size, 
int *coded_samples, 
int *approx_nb_samples)
 
  513     int has_coded_samples = 0;
 
  517     *approx_nb_samples = 0;
 
  525         if (buf_size < 76 * ch)
 
  530         if (buf_size < 34 * ch)
 
  542         nb_samples = buf_size * 2 / 
ch;
 
  558         return (buf_size - header_size) * 2 / 
ch;
 
  563         has_coded_samples = 1;
 
  564         *coded_samples  = bytestream2_get_le32(gb);
 
  565         *coded_samples -= *coded_samples % 28;
 
  566         nb_samples      = (buf_size - 12) / 30 * 28;
 
  569         has_coded_samples = 1;
 
  570         *coded_samples = bytestream2_get_le32(gb);
 
  571         nb_samples     = (buf_size - (4 + 8 * 
ch)) * 2 / 
ch;
 
  574         nb_samples = (buf_size - 
ch) / ch * 2;
 
  581         has_coded_samples = 1;
 
  584             header_size    = 4 + 9 * 
ch;
 
  585             *coded_samples = bytestream2_get_le32(gb);
 
  588             header_size    = 4 + 5 * 
ch;
 
  589             *coded_samples = bytestream2_get_le32(gb);
 
  592             header_size    = 4 + 5 * 
ch;
 
  593             *coded_samples = bytestream2_get_be32(gb);
 
  596         *coded_samples -= *coded_samples % 28;
 
  597         nb_samples      = (buf_size - header_size) * 2 / ch;
 
  598         nb_samples     -= nb_samples % 28;
 
  599         *approx_nb_samples = 1;
 
  604         nb_samples = ((buf_size - 16) * 2 / 3 * 4) / 
ch;
 
  609         if (buf_size < 4 * ch)
 
  611         nb_samples = 1 + (buf_size - 4 * 
ch) * 2 / ch;
 
  616         nb_samples = (buf_size - 4 * 
ch) * 2 / ch;
 
  624         if (buf_size < 4 * ch)
 
  626         nb_samples = 1 + (buf_size - 4 * 
ch) / (bsize * ch) * bsamples;
 
  632         nb_samples = (buf_size - 6 * 
ch) * 2 / ch;
 
  637         nb_samples = (buf_size - 16 * (ch / 2)) * 2 / 
ch;
 
  643         int samples_per_byte;
 
  655         nb_samples += buf_size * samples_per_byte / 
ch;
 
  660         int buf_bits       = buf_size * 8 - 2;
 
  661         int nbits          = (bytestream2_get_byte(gb) >> 6) + 2;
 
  662         int block_hdr_size = 22 * 
ch;
 
  663         int block_size     = block_hdr_size + nbits * ch * 4095;
 
  664         int nblocks        = buf_bits / block_size;
 
  665         int bits_left      = buf_bits - nblocks * block_size;
 
  666         nb_samples         = nblocks * 4096;
 
  667         if (bits_left >= block_hdr_size)
 
  668             nb_samples += 1 + (bits_left - block_hdr_size) / (nbits * ch);
 
  674             nb_samples = buf_size * 14 / (8 * 
ch);
 
  677         has_coded_samples = 1;
 
  680                           bytestream2_get_le32(gb) :
 
  681                           bytestream2_get_be32(gb);
 
  682         buf_size       -= 8 + 36 * 
ch;
 
  684         nb_samples      = buf_size / 8 * 14;
 
  685         if (buf_size % 8 > 1)
 
  686             nb_samples     += (buf_size % 8 - 1) * 2;
 
  687         *approx_nb_samples = 1;
 
  690         nb_samples = buf_size / (9 * 
ch) * 16;
 
  693         nb_samples = (buf_size / 128) * 224 / ch;
 
  697         nb_samples = buf_size / (16 * 
ch) * 28;
 
  702     if (has_coded_samples && (*coded_samples <= 0 || *coded_samples > nb_samples))
 
  709                               int *got_frame_ptr, 
AVPacket *avpkt)
 
  713     int buf_size = avpkt->
size;
 
  721     int nb_samples, coded_samples, approx_nb_samples, ret;
 
  725     nb_samples = 
get_nb_samples(avctx, &gb, buf_size, &coded_samples, &approx_nb_samples);
 
  726     if (nb_samples <= 0) {
 
  735     samples = (int16_t *)frame->
data[0];
 
  741         if (!approx_nb_samples && coded_samples != nb_samples)
 
  743         frame->
nb_samples = nb_samples = coded_samples;
 
  752         for (channel = 0; channel < avctx->
channels; channel++) {
 
  759             predictor = 
sign_extend(bytestream2_get_be16u(&gb), 16);
 
  760             step_index = predictor & 0x7F;
 
  783             for (m = 0; m < 64; m += 2) {
 
  784                 int byte = bytestream2_get_byteu(&gb);
 
  809             for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) {
 
  810                 for (i = 0; i < avctx->
channels; i++) {
 
  814                     samples = &samples_p[i][1 + n * samples_per_block];
 
  815                     for (j = 0; j < block_size; j++) {
 
  817                                         (j % 4) + (j / 4) * (avctx->
channels * 4) + i * 4];
 
  822                     for (m = 0; m < samples_per_block; m++) {
 
  830         for (n = 0; n < (nb_samples - 1) / 8; n++) {
 
  831             for (i = 0; i < avctx->
channels; i++) {
 
  833                 samples = &samples_p[i][1 + n * 8];
 
  834                 for (m = 0; m < 8; m += 2) {
 
  835                     int v = bytestream2_get_byteu(&gb);
 
  844         for (i = 0; i < avctx->
channels; i++)
 
  847         for (i = 0; i < avctx->
channels; i++) {
 
  856         for (i = 0; i < avctx->
channels; i++) {
 
  857             samples = (int16_t *)frame->
data[i];
 
  859             for (n = nb_samples >> 1; n > 0; n--) {
 
  860                 int v = bytestream2_get_byteu(&gb);
 
  870         block_predictor = bytestream2_get_byteu(&gb);
 
  871         if (block_predictor > 6) {
 
  879             block_predictor = bytestream2_get_byteu(&gb);
 
  880             if (block_predictor > 6) {
 
  902         for(n = (nb_samples - 2) >> (1 - st); n > 0; n--) {
 
  903             int byte = bytestream2_get_byteu(&gb);
 
  910         for (channel = 0; channel < avctx->
channels; channel+=2) {
 
  913             c->
status[channel + 1].
step      = bytestream2_get_le16u(&gb) & 0x1f;
 
  918             for (n = 0; n < nb_samples; n+=2) {
 
  919                 int v = bytestream2_get_byteu(&gb);
 
  923             for (n = 0; n < nb_samples; n+=2) {
 
  924                 int v = bytestream2_get_byteu(&gb);
 
  931         for (channel = 0; channel < avctx->
channels; channel++) {
 
  941         for (n = (nb_samples - 1) >> (1 - st); n > 0; n--) {
 
  942             int v = bytestream2_get_byteu(&gb);
 
  951         int decode_top_nibble_next = 0;
 
  953         const int16_t *samples_end = samples + avctx->
channels * nb_samples;
 
  969 #define DK3_GET_NEXT_NIBBLE() \ 
  970     if (decode_top_nibble_next) { \ 
  971         nibble = last_byte >> 4; \ 
  972         decode_top_nibble_next = 0; \ 
  974         last_byte = bytestream2_get_byteu(&gb); \ 
  975         nibble = last_byte & 0x0F; \ 
  976         decode_top_nibble_next = 1; \ 
  979         while (samples < samples_end) {
 
 1012         for (channel = 0; channel < avctx->
channels; channel++) {
 
 1023         for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1025             int v = bytestream2_get_byteu(&gb);
 
 1039         for (channel = 0; channel < avctx->
channels; channel++) {
 
 1043             for (n = 0; n < nb_samples; n += 2) {
 
 1044                 int v = bytestream2_get_byteu(&gb);
 
 1052             int v = bytestream2_get_byteu(&gb);
 
 1059             int v = bytestream2_get_byteu(&gb);
 
 1065         for (channel = 0; channel < avctx->
channels; channel++) {
 
 1075         for (n = 0; n < nb_samples / 2; n++) {
 
 1078             byte[0] = bytestream2_get_byteu(&gb);
 
 1080                 byte[1] = bytestream2_get_byteu(&gb);
 
 1081             for(channel = 0; channel < avctx->
channels; channel++) {
 
 1084             for(channel = 0; channel < avctx->
channels; channel++) {
 
 1091             for (channel = 0; channel < avctx->
channels; channel++) {
 
 1092                 int16_t *smp = samples_p[
channel];
 
 1094                 for (n = nb_samples / 2; n > 0; n--) {
 
 1095                     int v = bytestream2_get_byteu(&gb);
 
 1101             for (n = nb_samples / 2; n > 0; n--) {
 
 1102                 for (channel = 0; channel < avctx->
channels; channel++) {
 
 1103                     int v = bytestream2_get_byteu(&gb);
 
 1114         int16_t *out0 = samples_p[0];
 
 1115         int16_t *out1 = samples_p[1];
 
 1116         int samples_per_block = 28 * (3 - avctx->
channels) * 4;
 
 1117         int sample_offset = 0;
 
 1118         int bytes_remaining;
 
 1122                                  avctx->
channels, sample_offset)) < 0)
 
 1125             sample_offset += samples_per_block;
 
 1130         if (bytes_remaining > 0) {
 
 1136         for (i=0; i<=st; i++) {
 
 1144         for (i=0; i<=st; i++)
 
 1147         for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1148             int byte   = bytestream2_get_byteu(&gb);
 
 1154         for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1155             int byte = bytestream2_get_byteu(&gb);
 
 1162         int previous_left_sample, previous_right_sample;
 
 1163         int current_left_sample, current_right_sample;
 
 1164         int next_left_sample, next_right_sample;
 
 1165         int coeff1l, coeff2l, coeff1r, coeff2r;
 
 1166         int shift_left, shift_right;
 
 1174         current_left_sample   = 
sign_extend(bytestream2_get_le16u(&gb), 16);
 
 1175         previous_left_sample  = 
sign_extend(bytestream2_get_le16u(&gb), 16);
 
 1176         current_right_sample  = 
sign_extend(bytestream2_get_le16u(&gb), 16);
 
 1177         previous_right_sample = 
sign_extend(bytestream2_get_le16u(&gb), 16);
 
 1179         for (count1 = 0; count1 < nb_samples / 28; count1++) {
 
 1180             int byte = bytestream2_get_byteu(&gb);
 
 1186             byte = bytestream2_get_byteu(&gb);
 
 1187             shift_left  = 20 - (byte >> 4);
 
 1188             shift_right = 20 - (byte & 0x0F);
 
 1190             for (count2 = 0; count2 < 28; count2++) {
 
 1191                 byte = bytestream2_get_byteu(&gb);
 
 1192                 next_left_sample  = 
sign_extend(byte >> 4, 4) << shift_left;
 
 1193                 next_right_sample = 
sign_extend(byte,      4) << shift_right;
 
 1195                 next_left_sample = (next_left_sample +
 
 1196                     (current_left_sample * coeff1l) +
 
 1197                     (previous_left_sample * coeff2l) + 0x80) >> 8;
 
 1198                 next_right_sample = (next_right_sample +
 
 1199                     (current_right_sample * coeff1r) +
 
 1200                     (previous_right_sample * coeff2r) + 0x80) >> 8;
 
 1202                 previous_left_sample = current_left_sample;
 
 1203                 current_left_sample = av_clip_int16(next_left_sample);
 
 1204                 previous_right_sample = current_right_sample;
 
 1205                 current_right_sample = av_clip_int16(next_right_sample);
 
 1206                 *samples++ = current_left_sample;
 
 1207                 *samples++ = current_right_sample;
 
 1219         for(channel = 0; channel < avctx->
channels; channel++) {
 
 1220             int byte = bytestream2_get_byteu(&gb);
 
 1223             shift[
channel] = 20 - (byte & 0x0F);
 
 1225         for (count1 = 0; count1 < nb_samples / 2; count1++) {
 
 1228             byte[0] = bytestream2_get_byteu(&gb);
 
 1229             if (st) byte[1] = bytestream2_get_byteu(&gb);
 
 1230             for(i = 4; i >= 0; i-=4) { 
 
 1231                 for(channel = 0; channel < avctx->
channels; channel++) {
 
 1253         int previous_sample, current_sample, next_sample;
 
 1261         for (channel=0; channel<avctx->
channels; channel++)
 
 1262             offsets[channel] = (big_endian ? bytestream2_get_be32(&gb) :
 
 1263                                              bytestream2_get_le32(&gb)) +
 
 1266         for (channel=0; channel<avctx->
channels; channel++) {
 
 1268             samplesC = samples_p[
channel];
 
 1271                 current_sample  = 
sign_extend(bytestream2_get_le16(&gb), 16);
 
 1272                 previous_sample = 
sign_extend(bytestream2_get_le16(&gb), 16);
 
 1278             for (count1 = 0; count1 < nb_samples / 28; count1++) {
 
 1279                 int byte = bytestream2_get_byte(&gb);
 
 1281                     current_sample  = 
sign_extend(bytestream2_get_be16(&gb), 16);
 
 1282                     previous_sample = 
sign_extend(bytestream2_get_be16(&gb), 16);
 
 1284                     for (count2=0; count2<28; count2++)
 
 1285                         *samplesC++ = 
sign_extend(bytestream2_get_be16(&gb), 16);
 
 1289                     shift = 20 - (byte & 0x0F);
 
 1291                     for (count2=0; count2<28; count2++) {
 
 1295                             byte = bytestream2_get_byte(&gb);
 
 1299                         next_sample += (current_sample  * coeff1) +
 
 1300                                        (previous_sample * coeff2);
 
 1301                         next_sample = av_clip_int16(next_sample >> 8);
 
 1303                         previous_sample = current_sample;
 
 1304                         current_sample  = next_sample;
 
 1305                         *samplesC++ = current_sample;
 
 1311             } 
else if (count != count1) {
 
 1313                 count = 
FFMAX(count, count1);
 
 1327         for (channel=0; channel<avctx->
channels; channel++) {
 
 1330             for (n = 0; n < 4; n++, s += 32) {
 
 1336                 val = 
sign_extend(bytestream2_get_le16u(&gb), 16);
 
 1337                 shift[
n] = 20 - (val & 0x0F);
 
 1341             for (m=2; m<32; m+=2) {
 
 1343                 for (n = 0; n < 4; n++, s += 32) {
 
 1345                     int byte = bytestream2_get_byteu(&gb);
 
 1348                     pred  = s[-1] * coeff[0][
n] + s[-2] * coeff[1][
n];
 
 1349                     s[0]  = av_clip_int16((level + pred + 0x80) >> 8);
 
 1352                     pred  = s[0] * coeff[0][
n] + s[-1] * coeff[1][
n];
 
 1353                     s[1]  = av_clip_int16((level + pred + 0x80) >> 8);
 
 1368         for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1369             int v = bytestream2_get_byteu(&gb);
 
 1376         for (i = 0; i < avctx->
channels; i++) {
 
 1387         for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1388             int v = bytestream2_get_byteu(&gb);
 
 1395         for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1396             int v = bytestream2_get_byteu(&gb);
 
 1406             *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80);
 
 1408                 *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80);
 
 1413             for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1414                 int byte = bytestream2_get_byteu(&gb);
 
 1421             for (n = (nb_samples<<st) / 3; n > 0; n--) {
 
 1422                 int byte = bytestream2_get_byteu(&gb);
 
 1426                                                        (byte >> 2) & 0x07, 3, 0);
 
 1431             for (n = nb_samples >> (2 - st); n > 0; n--) {
 
 1432                 int byte = bytestream2_get_byteu(&gb);
 
 1436                                                        (byte >> 4) & 0x03, 2, 2);
 
 1438                                                        (byte >> 2) & 0x03, 2, 2);
 
 1449         for (n = nb_samples >> (1 - st); n > 0; n--) {
 
 1450             int v = bytestream2_get_byteu(&gb);
 
 1457             for (channel = 0; channel < avctx->
channels; channel++)
 
 1461         for (channel = 0; channel < avctx->
channels; channel++) {
 
 1463             for (n = nb_samples >> 1; n > 0; n--) {
 
 1464                 int v = bytestream2_get_byteu(&gb);
 
 1472         int samples_per_block;
 
 1476             samples_per_block = avctx->
extradata[0] / 16;
 
 1477             blocks = nb_samples / avctx->
extradata[0];
 
 1479             samples_per_block = nb_samples / 16;
 
 1483         for (m = 0; m < blocks; m++) {
 
 1484         for (channel = 0; channel < avctx->
channels; channel++) {
 
 1488             samples = samples_p[
channel] + m * 16;
 
 1490             for (i = 0; i < samples_per_block; i++) {
 
 1491                 int byte = bytestream2_get_byteu(&gb);
 
 1492                 int scale = 1 << (byte >> 4);
 
 1493                 int index = byte & 0xf;
 
 1498                 for (n = 0; n < 16; n++) {
 
 1504                         byte = bytestream2_get_byteu(&gb);
 
 1508                     sampledat = ((prev1 * factor1 + prev2 * factor2) +
 
 1509                                  ((sampledat * scale) << 11)) >> 11;
 
 1510                     *samples = av_clip_int16(sampledat);
 
 1529 #define THP_GET16(g) \ 
 1531         avctx->codec->id == AV_CODEC_ID_ADPCM_THP_LE ? \ 
 1532         bytestream2_get_le16u(&(g)) : \ 
 1533         bytestream2_get_be16u(&(g)), 16) 
 1543             for (i = 0; i < avctx->
channels; i++)
 
 1544                 for (n = 0; n < 16; n++)
 
 1547             for (i = 0; i < avctx->
channels; i++)
 
 1548                 for (n = 0; n < 16; n++)
 
 1553                 for (i = 0; i < avctx->
channels; i++) {
 
 1563         for (ch = 0; ch < avctx->
channels; ch++) {
 
 1564             samples = samples_p[
ch];
 
 1567             for (i = 0; i < (nb_samples + 13) / 14; i++) {
 
 1568                 int byte = bytestream2_get_byteu(&gb);
 
 1569                 int index = (byte >> 4) & 7;
 
 1570                 unsigned int exp = byte & 0x0F;
 
 1571                 int factor1 = table[
ch][index * 2];
 
 1572                 int factor2 = table[
ch][index * 2 + 1];
 
 1575                 for (n = 0; n < 14 && (i * 14 + n < nb_samples); n++) {
 
 1581                         byte = bytestream2_get_byteu(&gb);
 
 1587                     *samples = av_clip_int16(sampledat);
 
 1596         for (channel = 0; channel < avctx->
channels; channel++) {
 
 1600             for (i = 0; i < nb_samples / 28; i++) {
 
 1604                 header = bytestream2_get_byteu(&gb);
 
 1608                 for (n = 0; n < 28; n++) {
 
 1611                     switch (header >> 4) {
 
 1625                     prev = av_clip_intp2((prev + 0x20) >> 6, 21);
 
 1627                     byte = bytestream2_get_byteu(&gb);
 
 1633                     sampledat = (((sampledat << 12) >> (header & 0xf)) << 6) + prev;
 
 1634                     *samples++ = av_clip_int16(sampledat >> 6);
 
 1644         for (channel = 0; channel < avctx->
channels; channel++) {
 
 1648             for (i = 0; i < nb_samples / 28; i++) {
 
 1651                 filter = bytestream2_get_byteu(&gb);
 
 1652                 shift  = filter & 0xf;
 
 1653                 filter = filter >> 4;
 
 1656                 flag   = bytestream2_get_byteu(&gb);
 
 1659                 for (n = 0; n < 28; n++) {
 
 1666                             byte  = bytestream2_get_byteu(&gb);
 
 1670                         scale  = scale << 12;
 
 1673                     *samples++ = av_clip_int16(sample);
 
 1715 #define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_) \ 
 1716 AVCodec ff_ ## name_ ## _decoder = {                        \ 
 1718     .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \ 
 1719     .type           = AVMEDIA_TYPE_AUDIO,                   \ 
 1721     .priv_data_size = sizeof(ADPCMDecodeContext),           \ 
 1722     .init           = adpcm_decode_init,                    \ 
 1723     .decode         = adpcm_decode_frame,                   \ 
 1724     .flush          = adpcm_flush,                          \ 
 1725     .capabilities   = AV_CODEC_CAP_DR1,                     \ 
 1726     .sample_fmts    = sample_fmts_,                         \ 
const struct AVCodec * codec
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
static int shift(int a, int b)
This structure describes decoded (raw) audio or video data. 
static int16_t adpcm_mtaf_expand_nibble(ADPCMChannelStatus *c, uint8_t nibble)
ptrdiff_t const GLvoid * data
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits. 
#define AV_LOG_WARNING
Something somehow does not look correct. 
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static enum AVSampleFormat sample_fmts_s16[]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
static int get_sbits(GetBitContext *s, int n)
static int16_t adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature. 
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
const uint8_t ff_adpcm_AdaptCoeff1[]
Divided by 4 to fit in 8-bit integers. 
enum AVSampleFormat sample_fmt
audio sample format 
static av_cold int adpcm_decode_init(AVCodecContext *avctx)
static void adpcm_flush(AVCodecContext *avctx)
static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int16_t *samples)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables. 
#define u(width, name, range_min, range_max)
static const int xa_adpcm_table[5][2]
static int get_bits_count(const GetBitContext *s)
static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb, int buf_size, int *coded_samples, int *approx_nb_samples)
Get the number of samples that will be decoded from the packet. 
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
bitstream reader API header. 
static const uint8_t header[24]
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv). 
const uint16_t ff_adpcm_afc_coeffs[2][16]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
ADPCM encoder/decoder common header. 
static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, int is_silence, int current_sample, int64_t nb_samples_notify, AVRational time_base)
static const int ea_adpcm_table[]
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
const int8_t *const ff_adpcm_index_tables[4]
static const struct endianess table[]
const int16_t ff_adpcm_step_table[89]
This is the step table. 
static int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble, int shift)
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
static int16_t adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibble)
static int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitContext *gb, int bps)
const int8_t ff_adpcm_index_table[16]
const int16_t ff_adpcm_mtaf_stepsize[32][16]
static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1, const uint8_t *in, ADPCMChannelStatus *left, ADPCMChannelStatus *right, int channels, int sample_offset)
const int8_t ff_adpcm_AdaptCoeff2[]
Divided by 4 to fit in 8-bit integers. 
int vqa_version
VQA version. 
static const uint8_t ff_adpcm_ima_block_sizes[4]
static enum AVSampleFormat sample_fmts_s16p[]
const int16_t ff_adpcm_oki_step_table[49]
#define FF_ARRAY_ELEMS(a)
static const float pred[4]
static const int swf_index_tables[4][16]
static const uint8_t ff_adpcm_ima_block_samples[4]
static av_always_inline int bytestream2_tell(GetByteContext *g)
const int16_t ff_adpcm_AdaptationTable[]
Libavcodec external API header. 
AVSampleFormat
Audio sample formats. 
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext. 
main external API structure. 
static int16_t adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, uint8_t nibble)
#define DK3_GET_NEXT_NIBBLE()
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame. 
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
static int16_t adpcm_ima_expand_nibble(ADPCMChannelStatus *c, int8_t nibble, int shift)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext. 
ADPCMChannelStatus status[14]
static av_const int sign_extend(int val, unsigned bits)
static int16_t adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, int8_t nibble, int size, int shift)
static unsigned int get_bits_le(GetBitContext *s, int n)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
const int8_t ff_adpcm_yamaha_difflookup[]
common internal api header. 
const int16_t ff_adpcm_yamaha_indexscale[]
static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
channel
Use these values when setting the channel map with ebur128_set_channel(). 
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
static av_always_inline int diff(const uint32_t a, const uint32_t b)
int channels
number of audio channels 
static const double coeff[2][5]
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
static int16_t adpcm_ct_expand_nibble(ADPCMChannelStatus *c, int8_t nibble)
static enum AVSampleFormat sample_fmts_both[]
uint8_t ** extended_data
pointers to the data planes/channels. 
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data. 
int nb_samples
number of audio samples (per channel) described by this frame 
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
#define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_)