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 }
94 unsigned int min_channels = 1;
95 unsigned int max_channels = 2;
171 step_index = av_clip(step_index, 0, 88);
178 diff = ((2 * delta + 1) * step) >>
shift;
180 if (sign) predictor -=
diff;
181 else predictor +=
diff;
197 step_index = av_clip(step_index, 0, 88);
199 sign = nibble & (1 <<
shift);
200 delta = nibble & ((1 <<
shift) - 1);
201 diff = ((2 * delta + 1) * step) >>
shift;
203 if (sign) predictor -=
diff;
204 else predictor +=
diff;
220 step_index = av_clip(step_index, 0, 88);
223 if (nibble & 4) diff += step;
224 if (nibble & 2) diff += step >> 1;
225 if (nibble & 1) diff += step >> 2;
243 predictor += ((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->
idelta;
246 c->
sample1 = av_clip_int16(predictor);
249 if (c->
idelta > INT_MAX/768) {
263 step_index = av_clip(step_index, 0, 48);
267 diff = ((2 * delta + 1) * step) >> 3;
269 if (sign) predictor -=
diff;
270 else predictor +=
diff;
272 c->
predictor = av_clip_intp2(predictor, 11);
288 diff = ((2 * delta + 1) * c->
step) >> 3;
294 c->
step = av_clip(new_step, 511, 32767);
303 sign = nibble & (1<<(size-1));
304 delta = nibble & ((1<<(size-1))-1);
311 if (delta >= (2*size - 3) && c->
step < 3)
313 else if (delta == 0 && c->
step > 0)
329 c->
step = av_clip(c->
step, 127, 24567);
342 out0 += sample_offset;
346 out1 += sample_offset;
349 shift = 12 - (in[4+i*2] & 15);
350 filter = in[4+i*2] >> 4;
365 s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
367 s_1 = av_clip_int16(s);
378 shift = 12 - (in[5+i*2] & 15);
379 filter = in[5+i*2] >> 4;
392 s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
394 s_1 = av_clip_int16(s);
406 out0 += 28 * (3 - channels);
407 out1 += 28 * (3 - channels);
418 int k0, signmask, nb_bits,
count;
419 int size = buf_size*8;
427 k0 = 1 << (nb_bits-2);
428 signmask = 1 << (nb_bits-1);
431 for (i = 0; i < avctx->
channels; i++) {
439 for (i = 0; i < avctx->
channels; i++) {
454 if (delta & signmask)
482 int buf_size,
int *coded_samples,
int *approx_nb_samples)
487 int has_coded_samples = 0;
491 *approx_nb_samples = 0;
499 if (buf_size < 76 * ch)
504 if (buf_size < 34 * ch)
515 nb_samples = buf_size * 2 / ch;
530 return (buf_size - header_size) * 2 / ch;
535 has_coded_samples = 1;
536 *coded_samples = bytestream2_get_le32(gb);
537 *coded_samples -= *coded_samples % 28;
538 nb_samples = (buf_size - 12) / 30 * 28;
541 has_coded_samples = 1;
542 *coded_samples = bytestream2_get_le32(gb);
543 nb_samples = (buf_size - (4 + 8 * ch)) * 2 / ch;
546 nb_samples = (buf_size - ch) / ch * 2;
553 has_coded_samples = 1;
556 header_size = 4 + 9 * ch;
557 *coded_samples = bytestream2_get_le32(gb);
560 header_size = 4 + 5 * ch;
561 *coded_samples = bytestream2_get_le32(gb);
564 header_size = 4 + 5 * ch;
565 *coded_samples = bytestream2_get_be32(gb);
568 *coded_samples -= *coded_samples % 28;
569 nb_samples = (buf_size - header_size) * 2 / ch;
570 nb_samples -= nb_samples % 28;
571 *approx_nb_samples = 1;
576 nb_samples = ((buf_size - 16) * 2 / 3 * 4) / ch;
581 nb_samples = 1 + (buf_size - 4 * ch) * 2 / ch;
586 nb_samples = (buf_size - 4 * ch) * 2 / ch;
594 nb_samples = 1 + (buf_size - 4 * ch) / (bsize * ch) * bsamples;
600 nb_samples = 2 + (buf_size - 7 * ch) * 2 / ch;
606 int samples_per_byte;
616 nb_samples += buf_size * samples_per_byte / ch;
621 int buf_bits = buf_size * 8 - 2;
622 int nbits = (bytestream2_get_byte(gb) >> 6) + 2;
623 int block_hdr_size = 22 * ch;
624 int block_size = block_hdr_size + nbits * ch * 4095;
625 int nblocks = buf_bits / block_size;
626 int bits_left = buf_bits - nblocks * block_size;
627 nb_samples = nblocks * 4096;
628 if (bits_left >= block_hdr_size)
629 nb_samples += 1 + (bits_left - block_hdr_size) / (nbits * ch);
634 nb_samples = buf_size / (8 * ch) * 14;
637 has_coded_samples = 1;
639 *coded_samples = bytestream2_get_be32(gb);
640 *coded_samples -= *coded_samples % 14;
641 nb_samples = (buf_size - (8 + 36 * ch)) / (8 * ch) * 14;
644 nb_samples = buf_size / (9 * ch) * 16;
647 nb_samples = (buf_size / 128) * 224 / ch;
650 nb_samples = buf_size / (16 * ch) * 28;
655 if (has_coded_samples && (*coded_samples <= 0 || *coded_samples > nb_samples))
662 int *got_frame_ptr,
AVPacket *avpkt)
666 int buf_size = avpkt->
size;
669 int n,
m, channel, i;
674 int nb_samples, coded_samples, approx_nb_samples,
ret;
678 nb_samples =
get_nb_samples(avctx, &gb, buf_size, &coded_samples, &approx_nb_samples);
679 if (nb_samples <= 0) {
688 samples = (
short *)frame->
data[0];
694 if (!approx_nb_samples && coded_samples != nb_samples)
696 frame->
nb_samples = nb_samples = coded_samples;
705 for (channel = 0; channel < avctx->
channels; channel++) {
708 cs = &(c->
status[channel]);
712 predictor =
sign_extend(bytestream2_get_be16u(&gb), 16);
713 step_index = predictor & 0x7F;
734 samples = samples_p[channel];
736 for (m = 0; m < 64; m += 2) {
737 int byte = bytestream2_get_byteu(&gb);
761 for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) {
762 for (i = 0; i < avctx->
channels; i++) {
764 samples = &samples_p[i][1 + n * samples_per_block];
765 for (m = 0; m < samples_per_block; m++) {
773 for (n = 0; n < (nb_samples - 1) / 8; n++) {
774 for (i = 0; i < avctx->
channels; i++) {
776 samples = &samples_p[i][1 + n * 8];
777 for (m = 0; m < 8; m += 2) {
778 int v = bytestream2_get_byteu(&gb);
787 for (i = 0; i < avctx->
channels; i++)
790 for (i = 0; i < avctx->
channels; i++) {
799 for (i = 0; i < avctx->
channels; i++) {
800 samples = (int16_t *)frame->
data[i];
802 for (n = nb_samples >> 1; n > 0; n--) {
803 int v = bytestream2_get_byteu(&gb);
813 block_predictor = bytestream2_get_byteu(&gb);
814 if (block_predictor > 6) {
822 block_predictor = bytestream2_get_byteu(&gb);
823 if (block_predictor > 6) {
845 for(n = (nb_samples - 2) >> (1 - st); n > 0; n--) {
846 int byte = bytestream2_get_byteu(&gb);
853 for (channel = 0; channel < avctx->
channels; channel++) {
863 for (n = (nb_samples - 1) >> (1 - st); n > 0; n--) {
864 int v = bytestream2_get_byteu(&gb);
873 int decode_top_nibble_next = 0;
875 const int16_t *samples_end = samples + avctx->
channels * nb_samples;
891 #define DK3_GET_NEXT_NIBBLE() \
892 if (decode_top_nibble_next) { \
893 nibble = last_byte >> 4; \
894 decode_top_nibble_next = 0; \
896 last_byte = bytestream2_get_byteu(&gb); \
897 nibble = last_byte & 0x0F; \
898 decode_top_nibble_next = 1; \
901 while (samples < samples_end) {
934 for (channel = 0; channel < avctx->
channels; channel++) {
945 for (n = nb_samples >> (1 - st); n > 0; n--) {
947 int v = bytestream2_get_byteu(&gb);
962 int v = bytestream2_get_byteu(&gb);
969 int v = bytestream2_get_byteu(&gb);
975 for (channel = 0; channel < avctx->
channels; channel++) {
985 for (n = 0; n < nb_samples / 2; n++) {
988 byte[0] = bytestream2_get_byteu(&gb);
990 byte[1] = bytestream2_get_byteu(&gb);
991 for(channel = 0; channel < avctx->
channels; channel++) {
994 for(channel = 0; channel < avctx->
channels; channel++) {
1001 for (channel = 0; channel < avctx->
channels; channel++) {
1002 int16_t *smp = samples_p[channel];
1004 for (n = nb_samples / 2; n > 0; n--) {
1005 int v = bytestream2_get_byteu(&gb);
1011 for (n = nb_samples / 2; n > 0; n--) {
1012 for (channel = 0; channel < avctx->
channels; channel++) {
1013 int v = bytestream2_get_byteu(&gb);
1024 int16_t *out0 = samples_p[0];
1025 int16_t *out1 = samples_p[1];
1026 int samples_per_block = 28 * (3 - avctx->
channels) * 4;
1027 int sample_offset = 0;
1031 avctx->
channels, sample_offset)) < 0)
1034 sample_offset += samples_per_block;
1039 for (i=0; i<=st; i++) {
1047 for (i=0; i<=st; i++)
1050 for (n = nb_samples >> (1 - st); n > 0; n--) {
1051 int byte = bytestream2_get_byteu(&gb);
1057 for (n = nb_samples >> (1 - st); n > 0; n--) {
1058 int byte = bytestream2_get_byteu(&gb);
1065 int previous_left_sample, previous_right_sample;
1066 int current_left_sample, current_right_sample;
1067 int next_left_sample, next_right_sample;
1068 int coeff1l, coeff2l, coeff1r, coeff2r;
1069 int shift_left, shift_right;
1077 current_left_sample =
sign_extend(bytestream2_get_le16u(&gb), 16);
1078 previous_left_sample =
sign_extend(bytestream2_get_le16u(&gb), 16);
1079 current_right_sample =
sign_extend(bytestream2_get_le16u(&gb), 16);
1080 previous_right_sample =
sign_extend(bytestream2_get_le16u(&gb), 16);
1082 for (count1 = 0; count1 < nb_samples / 28; count1++) {
1083 int byte = bytestream2_get_byteu(&gb);
1089 byte = bytestream2_get_byteu(&gb);
1090 shift_left = 20 - (byte >> 4);
1091 shift_right = 20 - (byte & 0x0F);
1093 for (count2 = 0; count2 < 28; count2++) {
1094 byte = bytestream2_get_byteu(&gb);
1095 next_left_sample =
sign_extend(byte >> 4, 4) << shift_left;
1096 next_right_sample =
sign_extend(byte, 4) << shift_right;
1098 next_left_sample = (next_left_sample +
1099 (current_left_sample * coeff1l) +
1100 (previous_left_sample * coeff2l) + 0x80) >> 8;
1101 next_right_sample = (next_right_sample +
1102 (current_right_sample * coeff1r) +
1103 (previous_right_sample * coeff2r) + 0x80) >> 8;
1105 previous_left_sample = current_left_sample;
1106 current_left_sample = av_clip_int16(next_left_sample);
1107 previous_right_sample = current_right_sample;
1108 current_right_sample = av_clip_int16(next_right_sample);
1109 *samples++ = current_left_sample;
1110 *samples++ = current_right_sample;
1122 for(channel = 0; channel < avctx->
channels; channel++) {
1123 int byte = bytestream2_get_byteu(&gb);
1126 shift[channel] = 20 - (byte & 0x0F);
1128 for (count1 = 0; count1 < nb_samples / 2; count1++) {
1131 byte[0] = bytestream2_get_byteu(&gb);
1132 if (st) byte[1] = bytestream2_get_byteu(&gb);
1133 for(i = 4; i >= 0; i-=4) {
1134 for(channel = 0; channel < avctx->
channels; channel++) {
1138 c->
status[channel].
sample2 * coeff[channel][1] + 0x80) >> 8;
1156 int previous_sample, current_sample, next_sample;
1159 unsigned int channel;
1164 for (channel=0; channel<avctx->
channels; channel++)
1165 offsets[channel] = (big_endian ? bytestream2_get_be32(&gb) :
1166 bytestream2_get_le32(&gb)) +
1169 for (channel=0; channel<avctx->
channels; channel++) {
1171 samplesC = samples_p[channel];
1174 current_sample =
sign_extend(bytestream2_get_le16(&gb), 16);
1175 previous_sample =
sign_extend(bytestream2_get_le16(&gb), 16);
1181 for (count1 = 0; count1 < nb_samples / 28; count1++) {
1182 int byte = bytestream2_get_byte(&gb);
1184 current_sample =
sign_extend(bytestream2_get_be16(&gb), 16);
1185 previous_sample =
sign_extend(bytestream2_get_be16(&gb), 16);
1187 for (count2=0; count2<28; count2++)
1188 *samplesC++ =
sign_extend(bytestream2_get_be16(&gb), 16);
1192 shift = 20 - (byte & 0x0F);
1194 for (count2=0; count2<28; count2++) {
1198 byte = bytestream2_get_byte(&gb);
1202 next_sample += (current_sample * coeff1) +
1203 (previous_sample * coeff2);
1204 next_sample = av_clip_int16(next_sample >> 8);
1206 previous_sample = current_sample;
1207 current_sample = next_sample;
1208 *samplesC++ = current_sample;
1214 }
else if (count != count1) {
1216 count =
FFMAX(count, count1);
1230 for (channel=0; channel<avctx->
channels; channel++) {
1232 int16_t *
s = samples_p[channel];
1233 for (n = 0; n < 4; n++, s += 32) {
1239 val =
sign_extend(bytestream2_get_le16u(&gb), 16);
1240 shift[
n] = 20 - (val & 0x0F);
1244 for (m=2; m<32; m+=2) {
1245 s = &samples_p[channel][
m];
1246 for (n = 0; n < 4; n++, s += 32) {
1248 int byte = bytestream2_get_byteu(&gb);
1251 pred = s[-1] * coeff[0][
n] + s[-2] * coeff[1][
n];
1252 s[0] = av_clip_int16((level + pred + 0x80) >> 8);
1255 pred = s[0] * coeff[0][
n] + s[-1] * coeff[1][
n];
1256 s[1] = av_clip_int16((level + pred + 0x80) >> 8);
1271 for (n = nb_samples >> (1 - st); n > 0; n--) {
1272 int v = bytestream2_get_byteu(&gb);
1279 for (i = 0; i < avctx->
channels; i++) {
1290 for (n = nb_samples >> (1 - st); n > 0; n--) {
1291 int v = bytestream2_get_byteu(&gb);
1298 for (n = nb_samples >> (1 - st); n > 0; n--) {
1299 int v = bytestream2_get_byteu(&gb);
1309 *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80);
1311 *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80);
1316 for (n = nb_samples >> (1 - st); n > 0; n--) {
1317 int byte = bytestream2_get_byteu(&gb);
1324 for (n = (nb_samples<<st) / 3; n > 0; n--) {
1325 int byte = bytestream2_get_byteu(&gb);
1329 (byte >> 2) & 0x07, 3, 0);
1334 for (n = nb_samples >> (2 - st); n > 0; n--) {
1335 int byte = bytestream2_get_byteu(&gb);
1339 (byte >> 4) & 0x03, 2, 2);
1341 (byte >> 2) & 0x03, 2, 2);
1352 for (n = nb_samples >> (1 - st); n > 0; n--) {
1353 int v = bytestream2_get_byteu(&gb);
1360 int samples_per_block;
1364 samples_per_block = avctx->
extradata[0] / 16;
1365 blocks = nb_samples / avctx->
extradata[0];
1367 samples_per_block = nb_samples / 16;
1371 for (m = 0; m < blocks; m++) {
1372 for (channel = 0; channel < avctx->
channels; channel++) {
1376 samples = samples_p[channel] + m * 16;
1378 for (i = 0; i < samples_per_block; i++) {
1379 int byte = bytestream2_get_byteu(&gb);
1380 int scale = 1 << (byte >> 4);
1381 int index = byte & 0xf;
1386 for (n = 0; n < 16; n++) {
1392 byte = bytestream2_get_byteu(&gb);
1396 sampledat = ((prev1 * factor1 + prev2 * factor2) +
1397 ((sampledat * scale) << 11)) >> 11;
1398 *samples = av_clip_int16(sampledat);
1424 for (i = 0; i < avctx->
channels; i++)
1425 for (n = 0; n < 16; n++)
1426 table[i][n] =
sign_extend(bytestream2_get_be16u(&tb), 16);
1428 for (i = 0; i < avctx->
channels; i++)
1429 for (n = 0; n < 16; n++)
1430 table[i][n] =
sign_extend(bytestream2_get_be16u(&gb), 16);
1433 for (i = 0; i < avctx->
channels; i++) {
1439 for (ch = 0; ch < avctx->
channels; ch++) {
1440 samples = samples_p[ch];
1443 for (i = 0; i < nb_samples / 14; i++) {
1444 int byte = bytestream2_get_byteu(&gb);
1445 int index = (byte >> 4) & 7;
1446 unsigned int exp = byte & 0x0F;
1447 int factor1 = table[ch][index * 2];
1448 int factor2 = table[ch][index * 2 + 1];
1451 for (n = 0; n < 14; n++) {
1457 byte = bytestream2_get_byteu(&gb);
1462 + c->
status[ch].
sample2 * factor2) >> 11) + (sampledat << exp);
1463 *samples = av_clip_int16(sampledat);
1472 for (channel = 0; channel < avctx->
channels; channel++) {
1473 samples = samples_p[channel];
1476 for (i = 0; i < nb_samples / 28; i++) {
1480 header = bytestream2_get_byteu(&gb);
1484 for (n = 0; n < 28; n++) {
1487 switch (header >> 4) {
1501 prev = av_clip((prev + 0x20) >> 6, -0x200000, 0x1fffff);
1503 byte = bytestream2_get_byteu(&gb);
1509 sampledat = (((sampledat << 12) >> (header & 0xf)) << 6) + prev;
1510 *samples++ = av_clip_int16(sampledat >> 6);
1543 #define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_) \
1544 AVCodec ff_ ## name_ ## _decoder = { \
1546 .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
1547 .type = AVMEDIA_TYPE_AUDIO, \
1549 .priv_data_size = sizeof(ADPCMDecodeContext), \
1550 .init = adpcm_decode_init, \
1551 .decode = adpcm_decode_frame, \
1552 .capabilities = CODEC_CAP_DR1, \
1553 .sample_fmts = sample_fmts_, \
const struct AVCodec * codec
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static short adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, char nibble, int size, int shift)
static int shift(int a, int b)
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
const int16_t ff_adpcm_afc_coeffs[2][16]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
static short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
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_dlog(ac->avr,"%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 av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static enum AVSampleFormat sample_fmts_s16[]
#define FF_ARRAY_ELEMS(a)
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)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
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_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.
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).
static void predictor(uint8_t *src, int size)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
ADPCM encoder/decoder common header.
static short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned char nibble)
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)
Libavcodec external API header.
static int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitContext *gb, int bps)
ADPCMChannelStatus status[6]
const int8_t ff_adpcm_index_table[16]
static av_always_inline void update(SilenceDetectContext *s, AVFrame *insamples, int is_silence, int64_t nb_samples_notify, AVRational time_base)
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]
static short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble, int shift)
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[]
AVSampleFormat
Audio sample formats.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble)
main external API structure.
#define DK3_GET_NEXT_NIBBLE()
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static short adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibble)
static av_const int sign_extend(int val, unsigned bits)
static unsigned int get_bits_le(GetBitContext *s, int n)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
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)
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 enum AVSampleFormat sample_fmts_both[]
uint8_t ** extended_data
pointers to the data planes/channels.
This structure stores compressed data.
int nb_samples
number of audio samples (per channel) described by this frame
#define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_)