ref: 722a66b84becd0907f0bb4f6f80d17dbc04eb5e6
parent: ac044500cc3ad39f9b0795cec08106124d705564
author: Jean-Marc Valin <[email protected]>
date: Thu Jul 26 08:06:35 EDT 2018
Remove ambisonics experimental flag
--- a/configure.ac
+++ b/configure.ac
@@ -784,14 +784,6 @@
AC_DEFINE([OPUS_CHECK_ASM], [1], [Run bit-exactness checks between optimized and c implementations])
])
-AC_ARG_ENABLE([ambisonics],
- [AS_HELP_STRING([--enable-ambisonics],[enable experimental ambisonic encoding and decoding support])],,
- [enable_ambisonics=yes])
-
-AS_IF([test "$enable_ambisonics" = "yes"], [
- AC_DEFINE([ENABLE_EXPERIMENTAL_AMBISONICS], [1], [Ambisonics Support])
-])
-
AC_ARG_ENABLE([doc],
[AS_HELP_STRING([--disable-doc], [Do not build API documentation])],,
[enable_doc=yes])
@@ -930,7 +922,6 @@
Hardening: ..................... ${enable_hardening}
Fuzzing: ....................... ${enable_fuzzing}
Check ASM: ..................... ${enable_check_asm}
- Ambisonics support: ............ ${enable_ambisonics}
API documentation: ............. ${enable_doc}
Extra programs: ................ ${enable_extra_programs}
--- a/src/mapping_matrix.c
+++ b/src/mapping_matrix.c
@@ -35,8 +35,6 @@
#include "opus_defines.h"
#include "mapping_matrix.h"
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
-
#define MATRIX_INDEX(nb_rows, row, col) (nb_rows * col + row)
opus_int32 mapping_matrix_get_size(int rows, int cols)
@@ -378,4 +376,3 @@
0, 0, 0, 32767
};
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
--- a/src/mapping_matrix.h
+++ b/src/mapping_matrix.h
@@ -33,8 +33,6 @@
#ifndef MAPPING_MATRIX_H
#define MAPPING_MATRIX_H
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
-
#include "opus_types.h"
#include "opus_projection.h"
@@ -131,7 +129,5 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
#endif /* MAPPING_MATRIX_H */
--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -101,7 +101,6 @@
return (opus_val32*)(void*)ptr;
}
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
static int validate_ambisonics(int nb_channels, int *nb_streams, int *nb_coupled_streams)
{
int order_plus_one;
@@ -124,7 +123,6 @@
*nb_coupled_streams = nondiegetic_channels != 0;
return 1;
}
-#endif
static int validate_encoder_layout(const ChannelLayout *layout)
{
@@ -414,12 +412,10 @@
{
nb_streams=channels;
nb_coupled_streams=0;
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
} else if (mapping_family==2)
{
if (!validate_ambisonics(channels, &nb_streams, &nb_coupled_streams))
return 0;
-#endif
} else
return 0;
size = opus_multistream_encoder_get_size(nb_streams, nb_coupled_streams);
@@ -466,11 +462,9 @@
if (mapping_type == MAPPING_TYPE_SURROUND &&
!validate_encoder_layout(&st->layout))
return OPUS_BAD_ARG;
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
if (mapping_type == MAPPING_TYPE_AMBISONICS &&
!validate_ambisonics(st->layout.nb_channels, NULL, NULL))
return OPUS_BAD_ARG;
-#endif
ptr = (char*)st + align(sizeof(OpusMSEncoder));
coupled_size = opus_encoder_get_size(2);
mono_size = opus_encoder_get_size(1);
@@ -562,7 +556,6 @@
*coupled_streams=0;
for(i=0;i<channels;i++)
mapping[i] = i;
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
} else if (mapping_family==2)
{
int i;
@@ -572,17 +565,14 @@
mapping[i] = i + (*coupled_streams * 2);
for(i = 0; i < *coupled_streams * 2; i++)
mapping[i + (*streams - *coupled_streams)] = i;
-#endif
} else
return OPUS_UNIMPLEMENTED;
if (channels>2 && mapping_family==1) {
mapping_type = MAPPING_TYPE_SURROUND;
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
} else if (mapping_family==2)
{
mapping_type = MAPPING_TYPE_AMBISONICS;
-#endif
} else
{
mapping_type = MAPPING_TYPE_NONE;
@@ -743,7 +733,6 @@
}
}
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
static void ambisonics_rate_allocation(
OpusMSEncoder *st,
opus_int32 *rate,
@@ -820,7 +809,6 @@
}
}
}
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
static opus_int32 rate_allocation(
OpusMSEncoder *st,
@@ -836,11 +824,9 @@
ptr = (char*)st + align(sizeof(OpusMSEncoder));
opus_encoder_ctl((OpusEncoder*)ptr, OPUS_GET_SAMPLE_RATE(&Fs));
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
if (st->mapping_type == MAPPING_TYPE_AMBISONICS) {
ambisonics_rate_allocation(st, rate, frame_size, Fs);
} else
-#endif
{
surround_rate_allocation(st, rate, frame_size, Fs);
}
@@ -973,11 +959,9 @@
opus_encoder_ctl(enc, OPUS_SET_FORCE_CHANNELS(2));
}
}
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
else if (st->mapping_type == MAPPING_TYPE_AMBISONICS) {
opus_encoder_ctl(enc, OPUS_SET_FORCE_MODE(MODE_CELT_ONLY));
}
-#endif
}
ptr = (char*)st + align(sizeof(OpusMSEncoder));
--- a/src/opus_private.h
+++ b/src/opus_private.h
@@ -53,11 +53,8 @@
typedef enum {
MAPPING_TYPE_NONE,
- MAPPING_TYPE_SURROUND
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
- , /* Do not include comma at end of enumerator list */
+ MAPPING_TYPE_SURROUND,
MAPPING_TYPE_AMBISONICS
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
} MappingType;
struct OpusMSEncoder {
--- a/src/opus_projection_decoder.c
+++ b/src/opus_projection_decoder.c
@@ -38,8 +38,6 @@
#include "mapping_matrix.h"
#include "stack_alloc.h"
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
-
struct OpusProjectionDecoder
{
opus_int32 demixing_matrix_size_in_bytes;
@@ -258,105 +256,3 @@
opus_free(st);
}
-#else /* ENABLE_EXPERIMENTAL_AMBISONICS */
-
-opus_int32 opus_projection_decoder_get_size(
- int channels,
- int streams,
- int coupled_streams)
-{
- (void)channels;
- (void)streams;
- (void)coupled_streams;
- return OPUS_UNIMPLEMENTED;
-}
-
-OpusProjectionDecoder *opus_projection_decoder_create(
- opus_int32 Fs,
- int channels,
- int streams,
- int coupled_streams,
- unsigned char *demixing_matrix,
- opus_int32 demixing_matrix_size,
- int *error)
-{
- (void)Fs;
- (void)channels;
- (void)streams;
- (void)coupled_streams;
- (void)demixing_matrix;
- (void)demixing_matrix_size;
- if (error) *error = OPUS_UNIMPLEMENTED;
- return NULL;
-}
-
-int opus_projection_decoder_init(
- OpusProjectionDecoder *st,
- opus_int32 Fs,
- int channels,
- int streams,
- int coupled_streams,
- unsigned char *demixing_matrix,
- opus_int32 demixing_matrix_size)
-{
- (void)st;
- (void)Fs;
- (void)channels;
- (void)streams;
- (void)coupled_streams;
- (void)demixing_matrix;
- (void)demixing_matrix_size;
- return OPUS_UNIMPLEMENTED;
-}
-
-int opus_projection_decode(
- OpusProjectionDecoder *st,
- const unsigned char *data,
- opus_int32 len,
- opus_int16 *pcm,
- int frame_size,
- int decode_fec)
-{
- (void)st;
- (void)data;
- (void)len;
- (void)pcm;
- (void)frame_size;
- (void)decode_fec;
- return OPUS_UNIMPLEMENTED;
-}
-
-int opus_projection_decode_float(
- OpusProjectionDecoder *st,
- const unsigned char *data,
- opus_int32 len,
- float *pcm,
- int frame_size,
- int decode_fec)
-{
- (void)st;
- (void)data;
- (void)len;
- (void)pcm;
- (void)frame_size;
- (void)decode_fec;
- return OPUS_UNIMPLEMENTED;
-}
-
-int opus_projection_decoder_ctl(
- OpusProjectionDecoder *st,
- int request,
- ...)
-{
- (void)st;
- (void)request;
- return OPUS_UNIMPLEMENTED;
-}
-
-void opus_projection_decoder_destroy(
- OpusProjectionDecoder *st)
-{
- (void)st;
-}
-
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
--- a/src/opus_projection_encoder.c
+++ b/src/opus_projection_encoder.c
@@ -38,8 +38,6 @@
#include "stack_alloc.h"
#include "mapping_matrix.h"
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
-
struct OpusProjectionEncoder
{
opus_int32 mixing_matrix_size_in_bytes;
@@ -468,93 +466,3 @@
return OPUS_BAD_ARG;
}
-#else /* ENABLE_EXPERIMENTAL_AMBISONICS */
-
-opus_int32 opus_projection_ambisonics_encoder_get_size(
- int channels, int mapping_family)
-{
- (void)channels;
- (void)mapping_family;
- return OPUS_UNIMPLEMENTED;
-}
-
-OpusProjectionEncoder *opus_projection_ambisonics_encoder_create(
- opus_int32 Fs, int channels, int mapping_family, int *streams,
- int *coupled_streams, int application, int *error)
-{
- (void)Fs;
- (void)channels;
- (void)mapping_family;
- (void)streams;
- (void)coupled_streams;
- (void)application;
- if (error) *error = OPUS_UNIMPLEMENTED;
- return NULL;
-}
-
-int opus_projection_ambisonics_encoder_init(
- OpusProjectionEncoder *st,
- opus_int32 Fs,
- int channels,
- int mapping_family,
- int *streams,
- int *coupled_streams,
- int application)
-{
- (void)st;
- (void)Fs;
- (void)channels;
- (void)mapping_family;
- (void)streams;
- (void)coupled_streams;
- (void)application;
- return OPUS_UNIMPLEMENTED;
-}
-
-int opus_projection_encode(
- OpusProjectionEncoder *st,
- const opus_int16 *pcm,
- int frame_size,
- unsigned char *data,
- opus_int32 max_data_bytes)
-{
- (void)st;
- (void)pcm;
- (void)frame_size;
- (void)data;
- (void)max_data_bytes;
- return OPUS_UNIMPLEMENTED;
-}
-
-int opus_projection_encode_float(
- OpusProjectionEncoder *st,
- const float *pcm,
- int frame_size,
- unsigned char *data,
- opus_int32 max_data_bytes)
-{
- (void)st;
- (void)pcm;
- (void)frame_size;
- (void)data;
- (void)max_data_bytes;
- return OPUS_UNIMPLEMENTED;
-}
-
-void opus_projection_encoder_destroy(
- OpusProjectionEncoder *st)
-{
- (void)st;
-}
-
-int opus_projection_encoder_ctl(
- OpusProjectionEncoder *st,
- int request,
- ...)
-{
- (void)st;
- (void)request;
- return OPUS_UNIMPLEMENTED;
-}
-
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
--- a/tests/test_opus_projection.c
+++ b/tests/test_opus_projection.c
@@ -42,8 +42,6 @@
#include "../src/mapping_matrix.h"
#include "mathops.h"
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
-
#define BUFFER_SIZE 960
#define MAX_DATA_BYTES 32768
#define MAX_FRAME_SAMPLES 5760
@@ -392,15 +390,3 @@
return 0;
}
-#else
-
-int main(int _argc, char **_argv)
-{
- (void)_argc;
- (void)_argv;
- fprintf(stderr, "Projection tests are disabled. "
- "Configure with --enable-ambisonics for support.\n");
- return 0;
-}
-
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */