#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mathops.h"
#include "os_support.h"
#include "opus_private.h"
#include "opus_defines.h"
#include "opus_projection.h"
#include "opus_multistream.h"
#include "stack_alloc.h"
#include "mapping_matrix.h"
struct OpusProjectionEncoder
{ … };
#if !defined(DISABLE_FLOAT_API)
static void opus_projection_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_projection_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
)
{ … }
static int get_order_plus_one_from_channels(int channels, int *order_plus_one)
{ … }
static int get_streams_from_channels(int channels, int mapping_family,
int *streams, int *coupled_streams,
int *order_plus_one)
{ … }
static MappingMatrix *get_mixing_matrix(OpusProjectionEncoder *st)
{ … }
static MappingMatrix *get_enc_demixing_matrix(OpusProjectionEncoder *st)
{ … }
static OpusMSEncoder *get_multistream_encoder(OpusProjectionEncoder *st)
{ … }
opus_int32 opus_projection_ambisonics_encoder_get_size(int channels,
int mapping_family)
{ … }
int opus_projection_ambisonics_encoder_init(OpusProjectionEncoder *st, opus_int32 Fs,
int channels, int mapping_family,
int *streams, int *coupled_streams,
int application)
{ … }
OpusProjectionEncoder *opus_projection_ambisonics_encoder_create(
opus_int32 Fs, int channels, int mapping_family, int *streams,
int *coupled_streams, int application, int *error)
{ … }
int opus_projection_encode(OpusProjectionEncoder *st, const opus_int16 *pcm,
int frame_size, unsigned char *data,
opus_int32 max_data_bytes)
{ … }
#ifndef DISABLE_FLOAT_API
#ifdef FIXED_POINT
int opus_projection_encode_float(OpusProjectionEncoder *st, const float *pcm,
int frame_size, unsigned char *data,
opus_int32 max_data_bytes)
{
return opus_multistream_encode_native(get_multistream_encoder(st),
opus_projection_copy_channel_in_float, pcm, frame_size, data,
max_data_bytes, 16, downmix_float, 1, get_mixing_matrix(st));
}
#else
int opus_projection_encode_float(OpusProjectionEncoder *st, const float *pcm,
int frame_size, unsigned char *data,
opus_int32 max_data_bytes)
{ … }
#endif
#endif
void opus_projection_encoder_destroy(OpusProjectionEncoder *st)
{ … }
int opus_projection_encoder_ctl(OpusProjectionEncoder *st, int request, ...)
{ … }