#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "opus_multistream.h"
#include "opus.h"
#include "opus_private.h"
#include "stack_alloc.h"
#include <stdarg.h>
#include "float_cast.h"
#include "os_support.h"
#include "mathops.h"
#include "mdct.h"
#include "modes.h"
#include "bands.h"
#include "quant_bands.h"
#include "pitch.h"
VorbisLayout;
static const VorbisLayout vorbis_mappings[8] = …;
static opus_val32 *ms_get_preemph_mem(OpusMSEncoder *st)
{ … }
static opus_val32 *ms_get_window_mem(OpusMSEncoder *st)
{ … }
static int validate_ambisonics(int nb_channels, int *nb_streams, int *nb_coupled_streams)
{ … }
static int validate_encoder_layout(const ChannelLayout *layout)
{ … }
static void channel_pos(int channels, int pos[8])
{ … }
#if 1
static opus_val16 logSum(opus_val16 a, opus_val16 b)
{ … }
#else
opus_val16 logSum(opus_val16 a, opus_val16 b)
{
return log2(pow(4, a)+ pow(4, b))/2;
}
#endif
void surround_analysis(const CELTMode *celt_mode, const void *pcm, opus_val16 *bandLogE, opus_val32 *mem, opus_val32 *preemph_mem,
int len, int overlap, int channels, int rate, opus_copy_channel_in_func copy_channel_in, int arch
)
{ … }
opus_int32 opus_multistream_encoder_get_size(int nb_streams, int nb_coupled_streams)
{ … }
opus_int32 opus_multistream_surround_encoder_get_size(int channels, int mapping_family)
{ … }
static int opus_multistream_encoder_init_impl(
OpusMSEncoder *st,
opus_int32 Fs,
int channels,
int streams,
int coupled_streams,
const unsigned char *mapping,
int application,
MappingType mapping_type
)
{ … }
int opus_multistream_encoder_init(
OpusMSEncoder *st,
opus_int32 Fs,
int channels,
int streams,
int coupled_streams,
const unsigned char *mapping,
int application
)
{ … }
int opus_multistream_surround_encoder_init(
OpusMSEncoder *st,
opus_int32 Fs,
int channels,
int mapping_family,
int *streams,
int *coupled_streams,
unsigned char *mapping,
int application
)
{ … }
OpusMSEncoder *opus_multistream_encoder_create(
opus_int32 Fs,
int channels,
int streams,
int coupled_streams,
const unsigned char *mapping,
int application,
int *error
)
{ … }
OpusMSEncoder *opus_multistream_surround_encoder_create(
opus_int32 Fs,
int channels,
int mapping_family,
int *streams,
int *coupled_streams,
unsigned char *mapping,
int application,
int *error
)
{ … }
static void surround_rate_allocation(
OpusMSEncoder *st,
opus_int32 *rate,
int frame_size,
opus_int32 Fs
)
{ … }
static void ambisonics_rate_allocation(
OpusMSEncoder *st,
opus_int32 *rate,
int frame_size,
opus_int32 Fs
)
{ … }
static opus_int32 rate_allocation(
OpusMSEncoder *st,
opus_int32 *rate,
int frame_size
)
{ … }
#define MS_FRAME_TMP …
int opus_multistream_encode_native
(
OpusMSEncoder *st,
opus_copy_channel_in_func copy_channel_in,
const void *pcm,
int analysis_frame_size,
unsigned char *data,
opus_int32 max_data_bytes,
int lsb_depth,
downmix_func downmix,
int float_api,
void *user_data
)
{ … }
#if !defined(DISABLE_FLOAT_API)
static void opus_copy_channel_in_float(
opus_val16 *dst,
int dst_stride,
const void *src,
int src_stride,
int src_channel,
int frame_size,
void *user_data
)
{ … }
#endif
static void opus_copy_channel_in_short(
opus_val16 *dst,
int dst_stride,
const void *src,
int src_stride,
int src_channel,
int frame_size,
void *user_data
)
{ … }
#ifdef FIXED_POINT
int opus_multistream_encode(
OpusMSEncoder *st,
const opus_val16 *pcm,
int frame_size,
unsigned char *data,
opus_int32 max_data_bytes
)
{
return opus_multistream_encode_native(st, opus_copy_channel_in_short,
pcm, frame_size, data, max_data_bytes, 16, downmix_int, 0, NULL);
}
#ifndef DISABLE_FLOAT_API
int opus_multistream_encode_float(
OpusMSEncoder *st,
const float *pcm,
int frame_size,
unsigned char *data,
opus_int32 max_data_bytes
)
{
return opus_multistream_encode_native(st, opus_copy_channel_in_float,
pcm, frame_size, data, max_data_bytes, 16, downmix_float, 1, NULL);
}
#endif
#else
int opus_multistream_encode_float
(
OpusMSEncoder *st,
const opus_val16 *pcm,
int frame_size,
unsigned char *data,
opus_int32 max_data_bytes
)
{ … }
int opus_multistream_encode(
OpusMSEncoder *st,
const opus_int16 *pcm,
int frame_size,
unsigned char *data,
opus_int32 max_data_bytes
)
{ … }
#endif
int opus_multistream_encoder_ctl_va_list(OpusMSEncoder *st, int request,
va_list ap)
{ … }
int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...)
{ … }
void opus_multistream_encoder_destroy(OpusMSEncoder *st)
{ … }