Lines Matching defs:avctx

249 static void adpcm_flush(AVCodecContext *avctx);
251 static av_cold int adpcm_decode_init(AVCodecContext * avctx)
253 ADPCMDecodeContext *c = avctx->priv_data;
257 adpcm_flush(avctx);
259 switch(avctx->codec->id) {
278 if (avctx->ch_layout.nb_channels & 1) {
279 avpriv_request_sample(avctx, "channel count %d", avctx->ch_layout.nb_channels);
285 if (avctx->ch_layout.nb_channels <= 0 ||
286 avctx->block_align % (16 * avctx->ch_layout.nb_channels))
295 if (avctx->ch_layout.nb_channels < min_channels ||
296 avctx->ch_layout.nb_channels > max_channels) {
297 av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n");
301 switch(avctx->codec->id) {
303 if (avctx->bits_per_coded_sample < 2 || avctx->bits_per_coded_sample > 5)
307 if (avctx->bits_per_coded_sample != 4 ||
308 avctx->block_align != 17 * avctx->ch_layout.nb_channels)
312 if (avctx->bits_per_coded_sample != 8)
319 switch (avctx->codec->id) {
339 avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
342 avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P :
346 avctx->sample_fmt = avctx->ch_layout.nb_channels > 2 ? AV_SAMPLE_FMT_S16P :
350 avctx->sample_fmt = AV_SAMPLE_FMT_S16;
672 static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
691 avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
695 avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
724 avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter);
728 avpriv_request_sample(avctx, "unknown XA-ADPCM shift %d", shift);
760 static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int16_t *samples)
762 ADPCMDecodeContext *c = avctx->priv_data;
765 int channels = avctx->ch_layout.nb_channels;
846 static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
849 ADPCMDecodeContext *s = avctx->priv_data;
851 int ch = avctx->ch_layout.nb_channels;
861 switch (avctx->codec->id) {
894 switch (avctx->codec->id) {
907 switch (avctx->codec->id) {
935 switch (avctx->codec->id) {
955 if (avctx->block_align > 0)
956 buf_size = FFMIN(buf_size, avctx->block_align);
960 if (avctx->block_align > 0)
961 buf_size = FFMIN(buf_size, avctx->block_align);
967 if (avctx->block_align > 0)
968 buf_size = FFMIN(buf_size, avctx->block_align);
972 int bsize = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2];
973 int bsamples = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
974 if (avctx->block_align > 0)
975 buf_size = FFMIN(buf_size, avctx->block_align);
981 if (avctx->block_align > 0)
982 buf_size = FFMIN(buf_size, avctx->block_align);
986 if (avctx->block_align > 0)
987 buf_size = FFMIN(buf_size, avctx->block_align);
995 switch (avctx->codec->id) {
1024 if (avctx->extradata) {
1030 *coded_samples = (avctx->codec->id == AV_CODEC_ID_ADPCM_THP_LE) ?
1051 nb_samples = buf_size / avctx->block_align * 32;
1065 static int adpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
1070 ADPCMDecodeContext *c = avctx->priv_data;
1071 int channels = avctx->ch_layout.nb_channels;
1079 nb_samples = get_nb_samples(avctx, &gb, buf_size, &coded_samples, &approx_nb_samples);
1081 av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n");
1087 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
1096 av_log(avctx, AV_LOG_WARNING, "mismatch in coded sample count\n");
1102 switch(avctx->codec->id) {
1130 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1151 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1157 if (avctx->bits_per_coded_sample != 4) {
1158 int samples_per_block = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2];
1159 int block_size = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2];
1176 avctx->bits_per_coded_sample);
1180 bytestream2_skip(&gb, avctx->block_align - channels * 4);
1202 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1233 if (avctx->ch_layout.nb_channels > 2) {
1234 for (int channel = 0; channel < avctx->ch_layout.nb_channels; channel++) {
1238 av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[%d] = %d\n",
1258 av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[0] = %d\n",
1267 av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[1] = %d\n",
1322 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1357 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i/%i\n",
1401 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1428 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1514 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1563 if ((ret = xa_decode(avctx, out0, out1, buf + bytestream2_tell(&gb),
1581 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1693 const int big_endian = avctx->codec->id == AV_CODEC_ID_ADPCM_EA_R3;
1712 if (avctx->codec->id == AV_CODEC_ID_ADPCM_EA_R1) {
1754 av_log(avctx, AV_LOG_WARNING, "per-channel sample count mismatch\n");
1758 if (avctx->codec->id != AV_CODEC_ID_ADPCM_EA_R1) {
1807 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n",
1835 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n",
1853 av_log(avctx, AV_LOG_WARNING, "Last nibble set on packet with odd sample count.\n");
1854 av_log(avctx, AV_LOG_WARNING, "Sample will be skipped.\n");
1864 av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n",
1897 if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_4) {
1905 } else if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_3) {
1931 adpcm_swf_decode(avctx, buf, buf_size, samples);
1955 if (avctx->extradata && avctx->extradata_size == 1 && avctx->extradata[0]) {
1956 samples_per_block = avctx->extradata[0] / 16;
1957 blocks = nb_samples / avctx->extradata[0];
2010 avctx->codec->id == AV_CODEC_ID_ADPCM_THP_LE ? \
2014 if (avctx->extradata) {
2016 if (avctx->extradata_size < 32 * channels) {
2017 av_log(avctx, AV_LOG_ERROR, "Missing coeff table\n");
2021 bytestream2_init(&tb, avctx->extradata, avctx->extradata_size);
2124 for (int block = 0; block < avpkt->size / FFMAX(avctx->block_align, 16 * channels); block++) {
2125 int nb_samples_per_block = 28 * FFMAX(avctx->block_align, 16 * channels) / (16 * channels);
2182 for (int block = 0; block < avpkt->size / avctx->block_align; block++) {
2183 for (int channel = 0; channel < avctx->ch_layout.nb_channels; channel++) {
2222 av_log(avctx, AV_LOG_ERROR, "Nothing consumed\n");
2229 av_log(avctx, AV_LOG_ERROR, "Overread of %d < %d\n", avpkt->size, bytestream2_tell(&gb));
2236 static void adpcm_flush(AVCodecContext *avctx)
2238 ADPCMDecodeContext *c = avctx->priv_data;
2243 switch(avctx->codec_id) {
2249 if (avctx->extradata && avctx->extradata_size >= 8) {
2250 c->status[0].predictor = av_clip_intp2(AV_RL32(avctx->extradata ), 18);
2251 c->status[1].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 4), 18);
2256 if (avctx->extradata && avctx->extradata_size >= 28) {
2257 c->status[0].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 16), 18);
2258 c->status[0].step_index = av_clip(AV_RL32(avctx->extradata + 20), 0, 88);
2259 c->status[1].predictor = av_clip_intp2(AV_RL32(avctx->extradata + 4), 18);
2260 c->status[1].step_index = av_clip(AV_RL32(avctx->extradata + 8), 0, 88);
2265 if (avctx->extradata && avctx->extradata_size >= 2)
2266 c->vqa_version = AV_RL16(avctx->extradata);