diff options
Diffstat (limited to 'encoder/ixheaace_basic_ops.c')
-rw-r--r-- | encoder/ixheaace_basic_ops.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/encoder/ixheaace_basic_ops.c b/encoder/ixheaace_basic_ops.c index c18b430..a49458e 100644 --- a/encoder/ixheaace_basic_ops.c +++ b/encoder/ixheaace_basic_ops.c @@ -18,6 +18,8 @@ * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore */ +#include <float.h> +#include <math.h> #include "ixheaac_type_def.h" #include "ixheaac_constants.h" #include "ixheaace_aac_constants.h" @@ -33,3 +35,31 @@ WORD ia_enhaacplus_enc_norm32_arr(const WORD32 *word32_arr, LOOPINDEX n) { } return (ixheaac_pnorm32(max_bits)); } + +FLOAT32 ixheaace_div32(FLOAT32 num, FLOAT32 den) { + if (fabs(den) < FLT_EPSILON) { + if (den < 0.0f) { + return -num; + } + else { + return num; + } + } + else { + return num / den; + } +} + +FLOAT64 ixheaace_div64(FLOAT64 num, FLOAT64 den) { + if (fabs(den) < FLT_EPSILON) { + if (den < 0.0) { + return -num; + } + else { + return num; + } + } + else { + return num / den; + } +} |