1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec: add a new codec_id for CRYO APC IMA ADPCM.

The stereo layout and extradata is significantly different from that in
Westwood IMA ADPCM, so a separate codec_id is warranted.
This commit is contained in:
Justin Ruggles 2012-01-23 14:57:32 -05:00
parent 4340a6363e
commit 220506d23f
8 changed files with 12 additions and 5 deletions

View File

@ -509,6 +509,7 @@ OBJS-$(CONFIG_ADPCM_G722_ENCODER) += g722.o g722enc.o
OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o
OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o
OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o adpcm_data.o
OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER) += adpcm.o adpcm_data.o

View File

@ -120,8 +120,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
return -1;
}
break;
case CODEC_ID_ADPCM_IMA_WS:
if (avctx->extradata && avctx->extradata_size == 2 * 4) {
case CODEC_ID_ADPCM_IMA_APC:
if (avctx->extradata && avctx->extradata_size >= 8) {
c->status[0].predictor = AV_RL32(avctx->extradata);
c->status[1].predictor = AV_RL32(avctx->extradata + 4);
}
@ -359,6 +359,7 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
break;
/* simple 4-bit adpcm */
case CODEC_ID_ADPCM_CT:
case CODEC_ID_ADPCM_IMA_APC:
case CODEC_ID_ADPCM_IMA_EA_SEAD:
case CODEC_ID_ADPCM_IMA_WS:
case CODEC_ID_ADPCM_YAMAHA:
@ -774,6 +775,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
}
break;
case CODEC_ID_ADPCM_IMA_WS:
case CODEC_ID_ADPCM_IMA_APC:
while (src < buf + buf_size) {
uint8_t v = *src++;
*samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3);
@ -1220,6 +1222,7 @@ ADPCM_DECODER(CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2, "ADPCM Electronic Arts R2");
ADPCM_DECODER(CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3, "ADPCM Electronic Arts R3");
ADPCM_DECODER(CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas, "ADPCM Electronic Arts XAS");
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv, "ADPCM IMA AMV");
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_APC, adpcm_ima_apc, "ADPCM IMA CRYO APC");
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3, "ADPCM IMA Duck DK3");
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4, "ADPCM IMA Duck DK4");
ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS");

View File

@ -342,6 +342,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv);
REGISTER_DECODER (ADPCM_IMA_APC, adpcm_ima_apc);
REGISTER_DECODER (ADPCM_IMA_DK3, adpcm_ima_dk3);
REGISTER_DECODER (ADPCM_IMA_DK4, adpcm_ima_dk4);
REGISTER_DECODER (ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);

View File

@ -317,6 +317,7 @@ enum CodecID {
CODEC_ID_ADPCM_EA_MAXIS_XA,
CODEC_ID_ADPCM_IMA_ISS,
CODEC_ID_ADPCM_G722,
CODEC_ID_ADPCM_IMA_APC,
/* AMR */
CODEC_ID_AMR_NB = 0x12000,

View File

@ -1617,6 +1617,7 @@ int av_get_bits_per_sample(enum CodecID codec_id){
return 3;
case CODEC_ID_ADPCM_SBPRO_4:
case CODEC_ID_ADPCM_CT:
case CODEC_ID_ADPCM_IMA_APC:
case CODEC_ID_ADPCM_IMA_WAV:
case CODEC_ID_ADPCM_IMA_QT:
case CODEC_ID_ADPCM_SWF:

View File

@ -21,7 +21,7 @@
#define AVCODEC_VERSION_H
#define LIBAVCODEC_VERSION_MAJOR 53
#define LIBAVCODEC_VERSION_MINOR 35
#define LIBAVCODEC_VERSION_MINOR 36
#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

View File

@ -44,7 +44,7 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
st->codec->codec_id = CODEC_ID_ADPCM_IMA_APC;
avio_rl32(pb); /* number of samples */
st->codec->sample_rate = avio_rl32(pb);

View File

@ -72,7 +72,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
// Audio
audio_dec = audio_stream->codec;
audio_dec->codec_type = AVMEDIA_TYPE_AUDIO;
audio_dec->codec_id = CODEC_ID_ADPCM_IMA_WS;
audio_dec->codec_id = CODEC_ID_ADPCM_IMA_APC;
audio_dec->channels = 1;
audio_dec->sample_rate = 22050;