From 5d038a86d69c9024e0fe6a434af7b73793b1d492 Mon Sep 17 00:00:00 2001 From: Zane van Iperen Date: Thu, 6 Feb 2020 06:58:10 +0000 Subject: avcodec: add decoder for Simon & Schuster Interactive's ADPCM variant Adds support for the ADPCM variant used by some Simon & Schuster Interactive games such as Real War, and Real War: Rogue States. Signed-off-by: Zane van Iperen Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer --- libavcodec/adpcm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libavcodec/adpcm.c') diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 9a42353351..0cd28431d7 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -13,6 +13,7 @@ * MAXIS EA ADPCM decoder by Robert Marston (rmarston@gmail.com) * THP ADPCM decoder by Marco Gerards (mgerards@xs4all.nl) * Argonaut Games ADPCM decoder by Zane van Iperen (zane@zanevaniperen.com) + * Simon & Schuster Interactive ADPCM decoder by Zane van Iperen (zane@zanevaniperen.com) * * This file is part of FFmpeg. * @@ -620,6 +621,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb, case AV_CODEC_ID_ADPCM_IMA_WS: case AV_CODEC_ID_ADPCM_YAMAHA: case AV_CODEC_ID_ADPCM_AICA: + case AV_CODEC_ID_ADPCM_IMA_SSI: nb_samples = buf_size * 2 / ch; break; } @@ -1172,6 +1174,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); } break; + case AV_CODEC_ID_ADPCM_IMA_SSI: + while (bytestream2_get_bytes_left(&gb) > 0) { + int v = bytestream2_get_byteu(&gb); + *samples++ = adpcm_ima_qt_expand_nibble(&c->status[0], v >> 4 , 3); + *samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0x0F, 3); + } + break; case AV_CODEC_ID_ADPCM_IMA_OKI: while (bytestream2_get_bytes_left(&gb) > 0) { int v = bytestream2_get_byteu(&gb); @@ -1906,6 +1915,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, sample_fmts_s16, adpcm_ima_iss, ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_OKI, sample_fmts_s16, adpcm_ima_oki, "ADPCM IMA Dialogic OKI"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT, sample_fmts_s16p, adpcm_ima_qt, "ADPCM IMA QuickTime"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_RAD, sample_fmts_s16, adpcm_ima_rad, "ADPCM IMA Radical"); +ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SSI, sample_fmts_s16, adpcm_ima_ssi, "ADPCM IMA Simon & Schuster Interactive"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG, sample_fmts_s16, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV, sample_fmts_s16p, adpcm_ima_wav, "ADPCM IMA WAV"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS, sample_fmts_both, adpcm_ima_ws, "ADPCM IMA Westwood"); -- cgit v1.2.3