]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/opus.h
aarch64: vp9dsp: Fix vertical alignment in the init file
[ffmpeg] / libavcodec / opus.h
index ab2975fa2273a58c3f939516f78f83ec0110b214..fbf67c9b9f698b443b8a46c045c9e2a6af2c3587 100644 (file)
@@ -32,7 +32,7 @@
 #include "libavresample/avresample.h"
 
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 
 #define MAX_FRAME_SIZE               1275
 #define MAX_FRAMES                   48
 #define ROUND_MUL16(a,b)  ((MUL16(a, b) + 16384) >> 15)
 #define opus_ilog(i) (av_log2(i) + !!(i))
 
+#define OPUS_TS_HEADER     0x7FE0        // 0x3ff (11 bits)
+#define OPUS_TS_MASK       0xFFE0        // top 11 bits
+
+static const uint8_t opus_default_extradata[30] = {
+    'O', 'p', 'u', 's', 'H', 'e', 'a', 'd',
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
 enum OpusMode {
     OPUS_MODE_SILK,
     OPUS_MODE_HYBRID,
@@ -83,7 +92,7 @@ typedef struct RawBitsContext {
 } RawBitsContext;
 
 typedef struct OpusRangeCoder {
-    GetBitContext gb;
+    BitstreamContext bc;
     RawBitsContext rb;
     unsigned int range;
     unsigned int value;
@@ -92,8 +101,6 @@ typedef struct OpusRangeCoder {
 
 typedef struct SilkContext SilkContext;
 
-typedef struct CeltIMDCTContext CeltIMDCTContext;
-
 typedef struct CeltContext CeltContext;
 
 typedef struct OpusPacket {
@@ -166,6 +173,16 @@ typedef struct ChannelMap {
 
 typedef struct OpusContext {
     OpusStreamContext *streams;
+
+    /* current output buffers for each streams */
+    float **out;
+    int   *out_size;
+    /* Buffers for synchronizing the streams when they have different
+     * resampling delays */
+    AVAudioFifo **sync_buffers;
+    /* number of decoded samples for each stream */
+    int         *decoded_samples;
+
     int             nb_streams;
     int      nb_stereo_streams;
 
@@ -179,7 +196,7 @@ typedef struct OpusContext {
 static av_always_inline void opus_rc_normalize(OpusRangeCoder *rc)
 {
     while (rc->range <= 1<<23) {
-        rc->value = ((rc->value << 8) | (get_bits(&rc->gb, 8) ^ 0xFF)) & ((1u << 31) - 1);
+        rc->value = ((rc->value << 8) | (bitstream_read(&rc->bc, 8) ^ 0xFF)) & ((1u << 31) - 1);
         rc->range          <<= 8;
         rc->total_read_bits += 8;
     }
@@ -398,22 +415,6 @@ int ff_silk_decode_superframe(SilkContext *s, OpusRangeCoder *rc,
                               enum OpusBandwidth bandwidth, int coded_channels,
                               int duration_ms);
 
-/**
- * Init an iMDCT of the length 2 * 15 * (2^N)
- */
-int ff_celt_imdct_init(CeltIMDCTContext **s, int N);
-
-/**
- * Free an iMDCT.
- */
-void ff_celt_imdct_uninit(CeltIMDCTContext **s);
-
-/**
- * Calculate the middle half of the iMDCT
- */
-void ff_celt_imdct_half(CeltIMDCTContext *s, float *dst, const float *src,
-                        int src_stride, float scale);
-
 int ff_celt_init(AVCodecContext *avctx, CeltContext **s, int output_channels);
 
 void ff_celt_free(CeltContext **s);