Remove ambisonics experimental flag
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 26 Jul 2018 16:06:35 +0000 (12:06 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 26 Jul 2018 23:49:35 +0000 (19:49 -0400)
configure.ac
src/mapping_matrix.c
src/mapping_matrix.h
src/opus_multistream_encoder.c
src/opus_private.h
src/opus_projection_decoder.c
src/opus_projection_encoder.c
tests/test_opus_projection.c

index e6352a7..834132e 100644 (file)
@@ -784,14 +784,6 @@ AS_IF([test "$enable_check_asm" = "yes"], [
   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 @@ AC_MSG_NOTICE([
       Hardening: ..................... ${enable_hardening}
       Fuzzing: ....................... ${enable_fuzzing}
       Check ASM: ..................... ${enable_check_asm}
-      Ambisonics support: ............ ${enable_ambisonics}
 
       API documentation: ............. ${enable_doc}
       Extra programs: ................ ${enable_extra_programs}
index f9821f7..31298af 100644 (file)
@@ -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 @@ const opus_int16 mapping_matrix_toa_demixing_data[324] = {
          0,      0,      0,  32767
 };
 
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
index 8645168..9c20483 100644 (file)
@@ -33,8 +33,6 @@
 #ifndef MAPPING_MATRIX_H
 #define MAPPING_MATRIX_H
 
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
-
 #include "opus_types.h"
 #include "opus_projection.h"
 
@@ -132,6 +130,4 @@ extern const opus_int16 mapping_matrix_toa_demixing_data[324];
 }
 #endif
 
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
-
 #endif /* MAPPING_MATRIX_H */
index 09a84b2..52fd27e 100644 (file)
@@ -101,7 +101,6 @@ static opus_val32 *ms_get_window_mem(OpusMSEncoder *st)
    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 @@ static int validate_ambisonics(int nb_channels, int *nb_streams, int *nb_coupled
       *nb_coupled_streams = nondiegetic_channels != 0;
    return 1;
 }
-#endif
 
 static int validate_encoder_layout(const ChannelLayout *layout)
 {
@@ -414,12 +412,10 @@ opus_int32 opus_multistream_surround_encoder_get_size(int channels, int mapping_
    {
       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 @@ static int opus_multistream_encoder_init_impl(
    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 @@ int opus_multistream_surround_encoder_init(
       *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 @@ int opus_multistream_surround_encoder_init(
          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 @@ static void surround_rate_allocation(
    }
 }
 
-#ifdef ENABLE_EXPERIMENTAL_AMBISONICS
 static void ambisonics_rate_allocation(
       OpusMSEncoder *st,
       opus_int32 *rate,
@@ -820,7 +809,6 @@ static void ambisonics_rate_allocation(
       }
    }
 }
-#endif /* ENABLE_EXPERIMENTAL_AMBISONICS */
 
 static opus_int32 rate_allocation(
       OpusMSEncoder *st,
@@ -836,11 +824,9 @@ static opus_int32 rate_allocation(
    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 @@ int opus_multistream_encode_native
             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));
index 193ff93..09783ce 100644 (file)
@@ -53,11 +53,8 @@ typedef struct ChannelLayout {
 
 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 {
index 1ccd8b7..3538b78 100644 (file)
@@ -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 @@ void opus_projection_decoder_destroy(OpusProjectionDecoder *st)
   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 */
index 5dfb4cf..1c2d002 100644 (file)
@@ -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 @@ bad_arg:
   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 */
index b00ff1e..4d622e8 100644 (file)
@@ -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 @@ int main(int _argc, char **_argv)
   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 */