mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/adpcmenc: cleanup trellis checks
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
This commit is contained in:
parent
932edaaa60
commit
e35a0f8f3f
|
@ -69,14 +69,16 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->trellis && (unsigned)avctx->trellis > 16U) {
|
if (avctx->trellis) {
|
||||||
|
int frontier, max_paths;
|
||||||
|
|
||||||
|
if ((unsigned)avctx->trellis > 16U) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
|
av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->trellis &&
|
if (avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_SSI ||
|
||||||
(avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_SSI ||
|
avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_APM) {
|
||||||
avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_APM)) {
|
|
||||||
/*
|
/*
|
||||||
* The current trellis implementation doesn't work for extended
|
* The current trellis implementation doesn't work for extended
|
||||||
* runs of samples without periodic resets. Disallow it.
|
* runs of samples without periodic resets. Disallow it.
|
||||||
|
@ -85,9 +87,8 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
|
||||||
return AVERROR_PATCHWELCOME;
|
return AVERROR_PATCHWELCOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->trellis) {
|
frontier = 1 << avctx->trellis;
|
||||||
int frontier = 1 << avctx->trellis;
|
max_paths = frontier * FREEZE_INTERVAL;
|
||||||
int max_paths = frontier * FREEZE_INTERVAL;
|
|
||||||
if (!FF_ALLOC_TYPED_ARRAY(s->paths, max_paths) ||
|
if (!FF_ALLOC_TYPED_ARRAY(s->paths, max_paths) ||
|
||||||
!FF_ALLOC_TYPED_ARRAY(s->node_buf, 2 * frontier) ||
|
!FF_ALLOC_TYPED_ARRAY(s->node_buf, 2 * frontier) ||
|
||||||
!FF_ALLOC_TYPED_ARRAY(s->nodep_buf, 2 * frontier) ||
|
!FF_ALLOC_TYPED_ARRAY(s->nodep_buf, 2 * frontier) ||
|
||||||
|
|
Loading…
Reference in New Issue