Commit af3f793f authored by Paul B Mahol's avatar Paul B Mahol

avcodec: add ADPCM AICA decoder

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent e99321a3
......@@ -28,6 +28,7 @@ version <next>:
- SDX2 DPCM decoder
- vibrato filter
- innoHeim/Rsupport Screen Capture Codec decoder
- ADPCM AICA decoder
version 2.8:
......
......@@ -887,6 +887,7 @@ following image formats are supported:
@tab encoding supported through external library libfaac and libvo-aacenc
@item AC-3 @tab IX @tab IX
@item ADPCM 4X Movie @tab @tab X
@item APDCM Yamaha AICA @tab @tab X
@item ADPCM CDROM XA @tab @tab X
@item ADPCM Creative Technology @tab @tab X
@tab 16 -> 4, 8 -> 4, 8 -> 3, 8 -> 2
......
......@@ -662,6 +662,7 @@ OBJS-$(CONFIG_ADPCM_4XM_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_ADX_DECODER) += adxdec.o adx.o
OBJS-$(CONFIG_ADPCM_ADX_ENCODER) += adxenc.o adx.o
OBJS-$(CONFIG_ADPCM_AFC_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_AICA_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_CT_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_DTK_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_EA_DECODER) += adpcm.o adpcm_data.o
......
......@@ -143,6 +143,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
}
switch(avctx->codec->id) {
case AV_CODEC_ID_ADPCM_AICA:
case AV_CODEC_ID_ADPCM_IMA_QT:
case AV_CODEC_ID_ADPCM_IMA_WAV:
case AV_CODEC_ID_ADPCM_4XM:
......@@ -521,6 +522,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb,
case AV_CODEC_ID_ADPCM_IMA_OKI:
case AV_CODEC_ID_ADPCM_IMA_WS:
case AV_CODEC_ID_ADPCM_YAMAHA:
case AV_CODEC_ID_ADPCM_AICA:
nb_samples = buf_size * 2 / ch;
break;
}
......@@ -1380,6 +1382,21 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
*samples++ = adpcm_yamaha_expand_nibble(&c->status[st], v >> 4 );
}
break;
case AV_CODEC_ID_ADPCM_AICA:
if (!c->has_status) {
for (channel = 0; channel < avctx->channels; channel++)
c->status[channel].step = 0;
c->has_status = 1;
}
for (channel = 0; channel < avctx->channels; channel++) {
samples = samples_p[channel];
for (n = nb_samples >> 1; n > 0; n--) {
int v = bytestream2_get_byteu(&gb);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[channel], v & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[channel], v >> 4 );
}
}
break;
case AV_CODEC_ID_ADPCM_AFC:
{
int samples_per_block;
......@@ -1642,6 +1659,7 @@ AVCodec ff_ ## name_ ## _decoder = { \
/* Note: Do not forget to add new entries to the Makefile as well. */
ADPCM_DECODER(AV_CODEC_ID_ADPCM_4XM, sample_fmts_s16p, adpcm_4xm, "ADPCM 4X Movie");
ADPCM_DECODER(AV_CODEC_ID_ADPCM_AFC, sample_fmts_s16p, adpcm_afc, "ADPCM Nintendo Gamecube AFC");
ADPCM_DECODER(AV_CODEC_ID_ADPCM_AICA, sample_fmts_s16p, adpcm_aica, "ADPCM Yamaha AICA");
ADPCM_DECODER(AV_CODEC_ID_ADPCM_CT, sample_fmts_s16, adpcm_ct, "ADPCM Creative Technology");
ADPCM_DECODER(AV_CODEC_ID_ADPCM_DTK, sample_fmts_s16p, adpcm_dtk, "ADPCM Nintendo Gamecube DTK");
ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA, sample_fmts_s16, adpcm_ea, "ADPCM Electronic Arts");
......
......@@ -488,6 +488,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
REGISTER_DECODER(ADPCM_AFC, adpcm_afc);
REGISTER_DECODER(ADPCM_AICA, adpcm_aica);
REGISTER_DECODER(ADPCM_CT, adpcm_ct);
REGISTER_DECODER(ADPCM_DTK, adpcm_dtk);
REGISTER_DECODER(ADPCM_EA, adpcm_ea);
......
......@@ -396,6 +396,7 @@ enum AVCodecID {
AV_CODEC_ID_ADPCM_G726LE,
AV_CODEC_ID_ADPCM_THP_LE,
AV_CODEC_ID_ADPCM_PSX,
AV_CODEC_ID_ADPCM_AICA,
/* AMR */
AV_CODEC_ID_AMR_NB = 0x12000,
......
......@@ -1999,6 +1999,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("ADPCM Playstation"),
.props = AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_ADPCM_AICA,
.type = AVMEDIA_TYPE_AUDIO,
.name = "adpcm_aica",
.long_name = NULL_IF_CONFIG_SMALL("ADPCM Yamaha AICA"),
.props = AV_CODEC_PROP_LOSSY,
},
/* AMR */
{
......
......@@ -2901,6 +2901,7 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
case AV_CODEC_ID_ADPCM_IMA_WS:
case AV_CODEC_ID_ADPCM_G722:
case AV_CODEC_ID_ADPCM_YAMAHA:
case AV_CODEC_ID_ADPCM_AICA:
return 4;
case AV_CODEC_ID_DSD_LSBF:
case AV_CODEC_ID_DSD_MSBF:
......
......@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 12
#define LIBAVCODEC_VERSION_MINOR 13
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -90,6 +90,7 @@ static int genh_read_header(AVFormatContext *s)
return ret;
AV_WL16(st->codec->extradata, 3);
st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_WS; break;
case 10: st->codec->codec_id = AV_CODEC_ID_ADPCM_AICA; break;
case 12: st->codec->codec_id = AV_CODEC_ID_ADPCM_THP; break;
case 13: st->codec->codec_id = AV_CODEC_ID_PCM_U8; break;
case 17: st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_QT; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment