[FFmpeg-devel] [PATCH] add MTAF demuxer and decoder

Paul B Mahol onemda at gmail.com
Mon May 16 10:23:17 CEST 2016


On 5/16/16, James Almer <jamrial at gmail.com> wrote:
> On 5/15/2016 6:33 PM, Paul B Mahol wrote:
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index 3f0ffd1..3a9dd95 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -707,6 +707,7 @@ OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER)      +=
>> adpcmenc.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER)       += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_MS_DECODER)           += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_MS_ENCODER)           += adpcmenc.o adpcm_data.o
>> +OBJS-$(CONFIG_ADPCM_MTAF_DECODER)         += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_PSX_DECODER)          += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_SBPRO_2_DECODER)      += adpcm.o adpcm_data.o
>>  OBJS-$(CONFIG_ADPCM_SBPRO_3_DECODER)      += adpcm.o adpcm_data.o
>> diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
>> index 0b6b92e..e624b85 100644
>> --- a/libavcodec/adpcm.c
>> +++ b/libavcodec/adpcm.c
>> @@ -107,6 +107,10 @@ static av_cold int adpcm_decode_init(AVCodecContext *
>> avctx)
>>      case AV_CODEC_ID_ADPCM_EA_XAS:
>>          max_channels = 6;
>>          break;
>> +    case AV_CODEC_ID_ADPCM_MTAF:
>> +        min_channels = 2;
>> +        max_channels = 8;
>> +        break;
>>      case AV_CODEC_ID_ADPCM_PSX:
>>          max_channels = 8;
>>          break;
>> @@ -159,6 +163,7 @@ static av_cold int adpcm_decode_init(AVCodecContext *
>> avctx)
>>          case AV_CODEC_ID_ADPCM_AFC:
>>          case AV_CODEC_ID_ADPCM_DTK:
>>          case AV_CODEC_ID_ADPCM_PSX:
>> +        case AV_CODEC_ID_ADPCM_MTAF:
>>              avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
>>              break;
>>          case AV_CODEC_ID_ADPCM_IMA_WS:
>> @@ -342,6 +347,15 @@ static inline int16_t
>> adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, uint8_t
>>      return c->predictor;
>>  }
>>
>> +static inline int16_t adpcm_mtaf_expand_nibble(ADPCMChannelStatus *c,
>> uint8_t nibble)
>> +{
>
> You should use local variables here, like in other expand_nibbble()
> functions.

I don't see point of that.

>
>> +    c->predictor += ff_adpcm_mtaf_stepsize[c->step][nibble];
>> +    c->predictor = av_clip_int16(c->predictor);
>> +    c->step += ff_adpcm_index_table[nibble];
>> +    c->step = av_clip(c->step, 0, 31);
>
> av_clip_uintp2(step, 5);

Done.


More information about the ffmpeg-devel mailing list