[FFmpeg-cvslog] lavc/aacenc: use isfinite to simplify isnan/isinf logic

Ganesh Ajjanagadde git at videolan.org
Fri Jan 15 00:30:20 CET 2016


ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Thu Jan 14 17:55:56 2016 -0500| [2e4fd16f5b9084b86e6872fddc365d0528383259] | committer: Ganesh Ajjanagadde

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

Reviewed-by: Claudio Freire <klaussfreire at gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e4fd16f5b9084b86e6872fddc365d0528383259
---

 libavcodec/aacenc.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 9a7d3a8..2e0db7d 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -29,6 +29,7 @@
  * add sane pulse detection
  ***********************************/
 
+#include "libavutil/libm.h"
 #include "libavutil/thread.h"
 #include "libavutil/float_dsp.h"
 #include "libavutil/opt.h"
@@ -606,14 +607,14 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
                 s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf);
             }
 
-            if (isnan(cpe->ch->coeffs[    0]) || isinf(cpe->ch->coeffs[    0]) ||
-                isnan(cpe->ch->coeffs[  128]) || isinf(cpe->ch->coeffs[  128]) ||
-                isnan(cpe->ch->coeffs[2*128]) || isinf(cpe->ch->coeffs[2*128]) ||
-                isnan(cpe->ch->coeffs[3*128]) || isinf(cpe->ch->coeffs[3*128]) ||
-                isnan(cpe->ch->coeffs[4*128]) || isinf(cpe->ch->coeffs[4*128]) ||
-                isnan(cpe->ch->coeffs[5*128]) || isinf(cpe->ch->coeffs[5*128]) ||
-                isnan(cpe->ch->coeffs[6*128]) || isinf(cpe->ch->coeffs[6*128]) ||
-                isnan(cpe->ch->coeffs[7*128]) || isinf(cpe->ch->coeffs[7*128])
+            if (!(isfinite(cpe->ch->coeffs[    0]) &&
+                  isfinite(cpe->ch->coeffs[  128]) &&
+                  isfinite(cpe->ch->coeffs[2*128]) &&
+                  isfinite(cpe->ch->coeffs[3*128]) &&
+                  isfinite(cpe->ch->coeffs[4*128]) &&
+                  isfinite(cpe->ch->coeffs[5*128]) &&
+                  isfinite(cpe->ch->coeffs[6*128]) &&
+                  isfinite(cpe->ch->coeffs[7*128]))
             ) {
                 av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
                 return AVERROR(EINVAL);



More information about the ffmpeg-cvslog mailing list