Commit 2e4fd16f authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde

lavc/aacenc: use isfinite to simplify isnan/isinf logic

Reviewed-by: 's avatarClaudio Freire <klaussfreire@gmail.com>
Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanagadde@gmail.com>
parent c3a24006
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
* add sane pulse detection * add sane pulse detection
***********************************/ ***********************************/
#include "libavutil/libm.h"
#include "libavutil/thread.h" #include "libavutil/thread.h"
#include "libavutil/float_dsp.h" #include "libavutil/float_dsp.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
...@@ -606,14 +607,14 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, ...@@ -606,14 +607,14 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf); s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf);
} }
if (isnan(cpe->ch->coeffs[ 0]) || isinf(cpe->ch->coeffs[ 0]) || if (!(isfinite(cpe->ch->coeffs[ 0]) &&
isnan(cpe->ch->coeffs[ 128]) || isinf(cpe->ch->coeffs[ 128]) || isfinite(cpe->ch->coeffs[ 128]) &&
isnan(cpe->ch->coeffs[2*128]) || isinf(cpe->ch->coeffs[2*128]) || isfinite(cpe->ch->coeffs[2*128]) &&
isnan(cpe->ch->coeffs[3*128]) || isinf(cpe->ch->coeffs[3*128]) || isfinite(cpe->ch->coeffs[3*128]) &&
isnan(cpe->ch->coeffs[4*128]) || isinf(cpe->ch->coeffs[4*128]) || isfinite(cpe->ch->coeffs[4*128]) &&
isnan(cpe->ch->coeffs[5*128]) || isinf(cpe->ch->coeffs[5*128]) || isfinite(cpe->ch->coeffs[5*128]) &&
isnan(cpe->ch->coeffs[6*128]) || isinf(cpe->ch->coeffs[6*128]) || isfinite(cpe->ch->coeffs[6*128]) &&
isnan(cpe->ch->coeffs[7*128]) || isinf(cpe->ch->coeffs[7*128]) isfinite(cpe->ch->coeffs[7*128]))
) { ) {
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n"); av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment