Re: [FFmpeg-devel] [PATCH 7/7] avcodec/adpcmenc: cleanup trellis checks

2020-06-10 Thread Andreas Rheinhardt
Zane van Iperen:
> Signed-off-by: Zane van Iperen 
> ---
>  libavcodec/adpcmenc.c | 29 ++---
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 
> diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
> index 242c92e61a..c18e67a94f 100644
> --- a/libavcodec/adpcmenc.c
> +++ b/libavcodec/adpcmenc.c
> @@ -72,23 +72,22 @@ static av_cold int adpcm_encode_init(AVCodecContext 
> *avctx)
>  return AVERROR(EINVAL);
>  }
>  
> -if (avctx->trellis && (unsigned)avctx->trellis > 16U) {
> -av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
> -return AVERROR(EINVAL);
> -}
> +if (avctx->trellis) {
> +if ((unsigned)avctx->trellis > 16U) {
> +av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
> +return AVERROR(EINVAL);
> +}
>  
> -if (avctx->trellis &&
> -   (avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_SSI ||
> -avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_APM)) {
> -/*
> - * The current trellis implementation doesn't work for extended
> - * runs of samples without periodic resets. Disallow it.
> - */
> -av_log(avctx, AV_LOG_ERROR, "trellis not supported\n");
> -return AVERROR_PATCHWELCOME;
> -}
> +if (avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_SSI ||
> +avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_APM) {
> +/*
> + * The current trellis implementation doesn't work for extended
> + * runs of samples without periodic resets. Disallow it.
> + */
> +av_log(avctx, AV_LOG_ERROR, "trellis not supported\n");
> +return AVERROR_PATCHWELCOME;
> +}
>  
> -if (avctx->trellis) {
>  int frontier  = 1 << avctx->trellis;>  int max_paths =  
> frontier * FREEZE_INTERVAL;

These declarations will be in the middle of the trellis block after this
patch, leading to new warnings.

>  FF_ALLOC_OR_GOTO(avctx, s->paths,
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 7/7] avcodec/adpcmenc: cleanup trellis checks

2020-06-08 Thread Zane van Iperen
Signed-off-by: Zane van Iperen 
---
 libavcodec/adpcmenc.c | 29 ++---
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index 242c92e61a..c18e67a94f 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -72,23 +72,22 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
 return AVERROR(EINVAL);
 }
 
-if (avctx->trellis && (unsigned)avctx->trellis > 16U) {
-av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
-return AVERROR(EINVAL);
-}
+if (avctx->trellis) {
+if ((unsigned)avctx->trellis > 16U) {
+av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
+return AVERROR(EINVAL);
+}
 
-if (avctx->trellis &&
-   (avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_SSI ||
-avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_APM)) {
-/*
- * The current trellis implementation doesn't work for extended
- * runs of samples without periodic resets. Disallow it.
- */
-av_log(avctx, AV_LOG_ERROR, "trellis not supported\n");
-return AVERROR_PATCHWELCOME;
-}
+if (avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_SSI ||
+avctx->codec->id == AV_CODEC_ID_ADPCM_IMA_APM) {
+/*
+ * The current trellis implementation doesn't work for extended
+ * runs of samples without periodic resets. Disallow it.
+ */
+av_log(avctx, AV_LOG_ERROR, "trellis not supported\n");
+return AVERROR_PATCHWELCOME;
+}
 
-if (avctx->trellis) {
 int frontier  = 1 << avctx->trellis;
 int max_paths =  frontier * FREEZE_INTERVAL;
 FF_ALLOC_OR_GOTO(avctx, s->paths,
-- 
2.25.1


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".