@@ -32,18 +32,9 @@
#define MAX_FRAMES 48
#define MAX_PACKET_DUR 5760
-#define CELT_SHORT_BLOCKSIZE 120
-#define CELT_OVERLAP CELT_SHORT_BLOCKSIZE
-#define CELT_MAX_LOG_BLOCKS 3
-#define CELT_MAX_FRAME_SIZE (CELT_SHORT_BLOCKSIZE * (1 << CELT_MAX_LOG_BLOCKS))
-#define CELT_MAX_BANDS 21
-
#define SILK_HISTORY 322
#define SILK_MAX_LPC 16
-#define ROUND_MULL(a,b,s) (((MUL64(a, b) >> ((s) - 1)) + 1) >> 1)
-#define ROUND_MUL16(a,b) ((MUL16(a, b) + 16384) >> 15)
-
#define OPUS_TS_HEADER 0x7FE0 // 0x3ff (11 bits)
#define OPUS_TS_MASK 0xFFE0 // top 11 bits
@@ -25,6 +25,8 @@
* Opus CELT decoder
*/
+#include <float.h>
+
#include "opus_celt.h"
#include "opustab.h"
#include "opus_pvq.h"
@@ -24,9 +24,9 @@
#ifndef AVCODEC_OPUS_CELT_H
#define AVCODEC_OPUS_CELT_H
-#include <float.h>
+#include <stdint.h>
-#include "opus.h"
+#include "avcodec.h"
#include "opusdsp.h"
#include "opus_rc.h"
@@ -35,6 +35,12 @@
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
+#define CELT_SHORT_BLOCKSIZE 120
+#define CELT_OVERLAP CELT_SHORT_BLOCKSIZE
+#define CELT_MAX_LOG_BLOCKS 3
+#define CELT_MAX_FRAME_SIZE (CELT_SHORT_BLOCKSIZE * (1 << CELT_MAX_LOG_BLOCKS))
+#define CELT_MAX_BANDS 21
+
#define CELT_VECTORS 11
#define CELT_ALLOC_STEPS 6
#define CELT_FINE_OFFSET 21
@@ -23,11 +23,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <float.h>
+
#include "config_components.h"
+#include "mathops.h"
#include "opustab.h"
#include "opus_pvq.h"
+#define ROUND_MUL16(a,b) ((MUL16(a, b) + 16384) >> 15)
+
#define CELT_PVQ_U(n, k) (ff_celt_pvq_u_row[FFMIN(n, k)][FFMAX(n, k)])
#define CELT_PVQ_V(n, k) (CELT_PVQ_U(n, k) + CELT_PVQ_U(n, (k) + 1))
@@ -26,9 +26,12 @@
#include <stdint.h>
+#include "mathops.h"
#include "opus.h"
#include "opustab.h"
+#define ROUND_MULL(a,b,s) (((MUL64(a, b) >> ((s) - 1)) + 1) >> 1)
+
typedef struct SilkFrame {
int coded;
int log_gain;
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <float.h>
+
#include "encode.h"
#include "opusenc.h"
#include "opus_pvq.h"
@@ -22,7 +22,8 @@
#ifndef AVCODEC_OPUSENC_H
#define AVCODEC_OPUSENC_H
-#include "opus_celt.h"
+#include "libavutil/intmath.h"
+#include "opus.h"
/* Determines the maximum delay the psychoacoustic system will use for lookahead */
#define FF_BUFQUEUE_SIZE 145
@@ -19,10 +19,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <float.h>
+
#include "opusenc_psy.h"
+#include "opus_celt.h"
#include "opus_pvq.h"
#include "opustab.h"
-#include "libavutil/qsort.h"
+#include "libavfilter/window_func.h"
static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, OpusRangeCoder *rc, int band,
float *bits, float lambda)
@@ -26,8 +26,8 @@
#include "libavutil/mem_internal.h"
#include "opusenc.h"
+#include "opus_celt.h"
#include "opusenc_utils.h"
-#include "libavfilter/window_func.h"
/* Each step is 2.5ms */
typedef struct OpusPsyStep {
Move ROUND_MUL* macros to their only users and the Celt macros to opus_celt.h. Also improve the other headers a bit while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/opus.h | 9 --------- libavcodec/opus_celt.c | 2 ++ libavcodec/opus_celt.h | 10 ++++++++-- libavcodec/opus_pvq.c | 5 +++++ libavcodec/opus_silk.c | 3 +++ libavcodec/opusenc.c | 2 ++ libavcodec/opusenc.h | 3 ++- libavcodec/opusenc_psy.c | 5 ++++- libavcodec/opusenc_psy.h | 2 +- 9 files changed, 27 insertions(+), 14 deletions(-)