]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/imc.c
Merge commit 'c9a39cec70603f662f4c326b21b11c4f0112079a'
[ffmpeg] / libavcodec / imc.c
index 184c0c7263ef5a29705fdb60df4a0159d676eced..73f1de3ac73a9f912a400a3d61eb1899bfd7ef10 100644 (file)
@@ -40,6 +40,7 @@
 #include "dsputil.h"
 #include "fft.h"
 #include "libavutil/audioconvert.h"
+#include "libavutil/libm.h"
 #include "sinewin.h"
 
 #include "imcdata.h"
@@ -175,8 +176,8 @@ static av_cold int imc_decode_init(AVCodecContext *avctx)
     IMCContext *q = avctx->priv_data;
     double r1, r2;
 
-    if ((avctx->codec_id == CODEC_ID_IMC && avctx->channels != 1)
-        || (avctx->codec_id == CODEC_ID_IAC && avctx->channels > 2)) {
+    if ((avctx->codec_id == AV_CODEC_ID_IMC && avctx->channels != 1)
+        || (avctx->codec_id == AV_CODEC_ID_IAC && avctx->channels > 2)) {
         av_log_ask_for_sample(avctx, "Number of channels is not supported\n");
         return AVERROR_PATCHWELCOME;
     }
@@ -227,7 +228,7 @@ static av_cold int imc_decode_init(AVCodecContext *avctx)
         }
     }
 
-    if (avctx->codec_id == CODEC_ID_IAC) {
+    if (avctx->codec_id == AV_CODEC_ID_IAC) {
         iac_generate_tabs(q, avctx->sample_rate);
     } else {
         memcpy(q->cyclTab,  cyclTab,  sizeof(cyclTab));
@@ -341,8 +342,8 @@ static void imc_decode_level_coefficients(IMCContext *q, int *levlCoeffBuf,
     float tmp, tmp2;
     // maybe some frequency division thingy
 
-    flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
-    flcoeffs2[0] = log(flcoeffs1[0]) / log(2);
+    flcoeffs1[0] = 20000.0 / exp2 (levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
+    flcoeffs2[0] = log2f(flcoeffs1[0]);
     tmp  = flcoeffs1[0];
     tmp2 = flcoeffs2[0];
 
@@ -414,7 +415,7 @@ static int bit_allocation(IMCContext *q, IMCChannel *chctx,
         highest = FFMAX(highest, chctx->flcoeffs1[i]);
 
     for (i = 0; i < BANDS - 1; i++)
-        chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log(chctx->flcoeffs5[i]) / log(2);
+        chctx->flcoeffs4[i] = chctx->flcoeffs3[i] - log2f(chctx->flcoeffs5[i]);
     chctx->flcoeffs4[BANDS - 1] = limit;
 
     highest = highest * 0.25;
@@ -841,7 +842,7 @@ static int imc_decode_block(AVCodecContext *avctx, IMCContext *q, int ch)
             }
         }
     }
-    if (avctx->codec_id == CODEC_ID_IAC) {
+    if (avctx->codec_id == AV_CODEC_ID_IAC) {
         bitscount += !!chctx->bandWidthT[BANDS - 1];
         if (!(stream_format_code & 0x2))
             bitscount += 16;
@@ -990,7 +991,7 @@ static av_cold int imc_decode_close(AVCodecContext * avctx)
 AVCodec ff_imc_decoder = {
     .name           = "imc",
     .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_IMC,
+    .id             = AV_CODEC_ID_IMC,
     .priv_data_size = sizeof(IMCContext),
     .init           = imc_decode_init,
     .close          = imc_decode_close,
@@ -1003,7 +1004,7 @@ AVCodec ff_imc_decoder = {
 AVCodec ff_iac_decoder = {
     .name           = "iac",
     .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_IAC,
+    .id             = AV_CODEC_ID_IAC,
     .priv_data_size = sizeof(IMCContext),
     .init           = imc_decode_init,
     .close          = imc_decode_close,