Only used there. Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/aacsbr.c | 39 +++++++++++++++++++++++++++++---------- libavcodec/internal.h | 22 ---------------------- 2 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 683c079b91..da9e160a57 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -31,10 +31,10 @@ #include "sbr.h" #include "aacsbr.h" #include "aacsbrdata.h" -#include "internal.h" #include "aacps.h" #include "sbrdsp.h" #include "libavutil/internal.h" +#include "libavutil/intfloat.h" #include "libavutil/libm.h" #include "libavutil/avassert.h" #include "libavutil/mem_internal.h" @@ -47,6 +47,25 @@ #include "mips/aacsbr_mips.h" #endif /* ARCH_MIPS */ +/** + * 2^(x) for integer x + * @return correctly rounded float + */ +static av_always_inline float exp2fi(int x) { + /* Normal range */ + if (-126 <= x && x <= 128) + return av_int2float((x+127) << 23); + /* Too large */ + else if (x > 128) + return INFINITY; + /* Subnormal numbers */ + else if (x > -150) + return av_int2float(1 << (x+149)); + /* Negligibly small */ + else + return 0; +} + static void aacsbr_func_ptr_init(AACSBRContext *c); static void make_bands(int16_t* bands, int start, int stop, int num_bands) @@ -79,13 +98,13 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) { float temp1, temp2, fac; if (sbr->data[0].bs_amp_res) { - temp1 = ff_exp2fi(sbr->data[0].env_facs_q[e][k] + 7); - temp2 = ff_exp2fi(pan_offset - sbr->data[1].env_facs_q[e][k]); + temp1 = exp2fi(sbr->data[0].env_facs_q[e][k] + 7); + temp2 = exp2fi(pan_offset - sbr->data[1].env_facs_q[e][k]); } else { - temp1 = ff_exp2fi((sbr->data[0].env_facs_q[e][k]>>1) + 7) * + temp1 = exp2fi((sbr->data[0].env_facs_q[e][k]>>1) + 7) * exp2_tab[sbr->data[0].env_facs_q[e][k] & 1]; - temp2 = ff_exp2fi((pan_offset - sbr->data[1].env_facs_q[e][k])>>1) * + temp2 = exp2fi((pan_offset - sbr->data[1].env_facs_q[e][k])>>1) * exp2_tab[(pan_offset - sbr->data[1].env_facs_q[e][k]) & 1]; } if (temp1 > 1E20) { @@ -99,8 +118,8 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) } for (e = 1; e <= sbr->data[0].bs_num_noise; e++) { for (k = 0; k < sbr->n_q; k++) { - float temp1 = ff_exp2fi(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs_q[e][k] + 1); - float temp2 = ff_exp2fi(12 - sbr->data[1].noise_facs_q[e][k]); + float temp1 = exp2fi(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs_q[e][k] + 1); + float temp2 = exp2fi(12 - sbr->data[1].noise_facs_q[e][k]); float fac; av_assert0(temp1 <= 1E20); fac = temp1 / (1.0f + temp2); @@ -113,9 +132,9 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (e = 1; e <= sbr->data[ch].bs_num_env; e++) for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){ if (sbr->data[ch].bs_amp_res) - sbr->data[ch].env_facs[e][k] = ff_exp2fi(sbr->data[ch].env_facs_q[e][k] + 6); + sbr->data[ch].env_facs[e][k] = exp2fi(sbr->data[ch].env_facs_q[e][k] + 6); else - sbr->data[ch].env_facs[e][k] = ff_exp2fi((sbr->data[ch].env_facs_q[e][k]>>1) + 6) + sbr->data[ch].env_facs[e][k] = exp2fi((sbr->data[ch].env_facs_q[e][k]>>1) + 6) * exp2_tab[sbr->data[ch].env_facs_q[e][k] & 1]; if (sbr->data[ch].env_facs[e][k] > 1E20) { av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); @@ -126,7 +145,7 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (k = 0; k < sbr->n_q; k++) sbr->data[ch].noise_facs[e][k] = - ff_exp2fi(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs_q[e][k]); + exp2fi(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs_q[e][k]); } } } diff --git a/libavcodec/internal.h b/libavcodec/internal.h index eb9e0d707c..04f7cebdcb 100644 --- a/libavcodec/internal.h +++ b/libavcodec/internal.h @@ -26,10 +26,7 @@ #include <stdint.h> -#include "libavutil/buffer.h" #include "libavutil/channel_layout.h" -#include "libavutil/mathematics.h" -#include "libavutil/pixfmt.h" #include "avcodec.h" #include "config.h" @@ -157,25 +154,6 @@ int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b); unsigned int ff_toupper4(unsigned int x); -/** - * 2^(x) for integer x - * @return correctly rounded float - */ -static av_always_inline float ff_exp2fi(int x) { - /* Normal range */ - if (-126 <= x && x <= 128) - return av_int2float((x+127) << 23); - /* Too large */ - else if (x > 128) - return INFINITY; - /* Subnormal numbers */ - else if (x > -150) - return av_int2float(1 << (x+149)); - /* Negligibly small */ - else - return 0; -} - int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx); int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec); -- 2.34.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".