]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/opus_pvq.h
Merge commit '0c0b87f12d48d4e7f0d3d13f9345e828a3a5ea32'
[ffmpeg] / libavcodec / opus_pvq.h
index 045015406bae60dc0814225b7ac41266bf3efbde..92463373603bb7e8ff9582a96560161ad2e484d7 100644 (file)
 #ifndef AVCODEC_OPUS_PVQ_H
 #define AVCODEC_OPUS_PVQ_H
 
-#include "opus.h"
 #include "opus_celt.h"
 
-/* Decodes a band using PVQ */
-uint32_t ff_celt_decode_band(CeltFrame *f, OpusRangeCoder *rc, const int band,
-                             float *X, float *Y, int N, int b, uint32_t blocks,
-                             float *lowband, int duration, float *lowband_out, int level,
-                             float gain, float *lowband_scratch, int fill);
+#define QUANT_FN(name) uint32_t (name)(struct CeltPVQ *pvq, CeltFrame *f,            \
+                                       OpusRangeCoder *rc, const int band, float *X, \
+                                       float *Y, int N, int b, uint32_t blocks,      \
+                                       float *lowband, int duration,                 \
+                                       float *lowband_out, int level, float gain,    \
+                                       float *lowband_scratch, int fill)
 
-/* Encodes a band using PVQ */
-uint32_t ff_celt_encode_band(CeltFrame *f, OpusRangeCoder *rc, const int band,
-                             float *X, float *Y, int N, int b, uint32_t blocks,
-                             float *lowband, int duration, float *lowband_out, int level,
-                             float gain, float *lowband_scratch, int fill);
+struct CeltPVQ {
+    DECLARE_ALIGNED(32, int,   qcoeff      )[256];
+    DECLARE_ALIGNED(32, float, hadamard_tmp)[256];
 
-float ff_celt_quant_band_cost(CeltFrame *f, OpusRangeCoder *rc, int band,
-                              float *bits, float lambda);
+    float (*pvq_search)(float *X, int *y, int K, int N);
+
+    QUANT_FN(*decode_band);
+    QUANT_FN(*encode_band);
+    float (*band_cost)(struct CeltPVQ *pvq, CeltFrame *f, OpusRangeCoder *rc,
+                       int band, float *bits, float lambda);
+};
+
+int  ff_celt_pvq_init  (struct CeltPVQ **pvq);
+void ff_opus_dsp_init_x86(struct CeltPVQ *s);
+void ff_celt_pvq_uninit(struct CeltPVQ **pvq);
 
 #endif /* AVCODEC_OPUS_PVQ_H */