]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/opus_celt.c
aarch64: vp9itxfm: Restructure the idct32 store macros
[ffmpeg] / libavcodec / opus_celt.c
index 6757136a9c357f880394d226d692210b28fc1f0d..07a4f775f98e284b5b58f8b4a8a9c7c57b57f155 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "libavutil/float_dsp.h"
 
+#include "imdct15.h"
 #include "opus.h"
 
 enum CeltSpread {
@@ -60,7 +61,7 @@ typedef struct CeltFrame {
 struct CeltContext {
     // constant values that do not change during context lifetime
     AVCodecContext    *avctx;
-    CeltIMDCTContext  *imdct[4];
+    IMDCT15Context    *imdct[4];
     AVFloatDSPContext  dsp;
     int output_channels;
 
@@ -1607,7 +1608,7 @@ static unsigned int celt_decode_band(CeltContext *s, OpusRangeCoder *rc,
                 for (j = 0; j < N; j++)
                     X[j] = 0.0f;
             } else {
-                if (lowband == NULL) {
+                if (!lowband) {
                     /* Noise */
                     for (j = 0; j < N; j++)
                         X[j] = (((int32_t)celt_rng(s)) >> 20);
@@ -1908,7 +1909,7 @@ static void celt_decode_bands(CeltContext *s, OpusRangeCoder *rc)
         s->remaining2 = totalbits - consumed - 1;
         if (i <= s->codedbands - 1) {
             int curr_balance = s->remaining / FFMIN(3, s->codedbands-i);
-            b = av_clip(FFMIN(s->remaining2 + 1, s->pulses[i] + curr_balance), 0, 16383);
+            b = av_clip_uintp2(FFMIN(s->remaining2 + 1, s->pulses[i] + curr_balance), 14);
         } else
             b = 0;
 
@@ -1982,7 +1983,7 @@ int ff_celt_decode_frame(CeltContext *s, OpusRangeCoder *rc,
     int silence = 0;
     int transient = 0;
     int anticollapse = 0;
-    CeltIMDCTContext *imdct;
+    IMDCT15Context *imdct;
     float imdct_scale = 1.0;
 
     if (coded_channels != 1 && coded_channels != 2) {
@@ -2095,8 +2096,8 @@ int ff_celt_decode_frame(CeltContext *s, OpusRangeCoder *rc,
         for (j = 0; j < s->blocks; j++) {
             float *dst  = frame->buf + 1024 + j * s->blocksize;
 
-            ff_celt_imdct_half(imdct, dst + CELT_OVERLAP / 2, s->coeffs[i] + j,
-                               s->blocks, imdct_scale);
+            imdct->imdct_half(imdct, dst + CELT_OVERLAP / 2, s->coeffs[i] + j,
+                              s->blocks, imdct_scale);
             s->dsp.vector_fmul_window(dst, dst, dst + CELT_OVERLAP / 2,
                                       celt_window, CELT_OVERLAP / 2);
         }
@@ -2178,7 +2179,7 @@ void ff_celt_free(CeltContext **ps)
         return;
 
     for (i = 0; i < FF_ARRAY_ELEMS(s->imdct); i++)
-        ff_celt_imdct_uninit(&s->imdct[i]);
+        ff_imdct15_uninit(&s->imdct[i]);
 
     av_freep(ps);
 }
@@ -2202,12 +2203,12 @@ int ff_celt_init(AVCodecContext *avctx, CeltContext **ps, int output_channels)
     s->output_channels = output_channels;
 
     for (i = 0; i < FF_ARRAY_ELEMS(s->imdct); i++) {
-        ret = ff_celt_imdct_init(&s->imdct[i], i + 3);
+        ret = ff_imdct15_init(&s->imdct[i], i + 3);
         if (ret < 0)
             goto fail;
     }
 
-    avpriv_float_dsp_init(&s->dsp, avctx->flags & CODEC_FLAG_BITEXACT);
+    avpriv_float_dsp_init(&s->dsp, avctx->flags & AV_CODEC_FLAG_BITEXACT);
 
     ff_celt_flush(s);