From 80f5e00d594d452d3e4583d4e33df442d97149ce Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 26 Sep 2025 13:38:35 +0200 Subject: [PATCH 1/9] The ambi_converter application is reading the correct amount of samples now. --- apps/ambi_converter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index affd3cf5a8..d4fa974d81 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -78,7 +78,7 @@ int main( int argc, char *argv[] ) printf( "Ambisonics converter program\n" ); printf( "----------------------------------------------------------------------------------\n" ); printf( "Usage:\n" ); - printf( "./ambi_conveter input_file output_file input_convention output_convention\n" ); + printf( "./ambi_converter input_file output_file input_convention output_convention\n" ); printf( "\n" ); printf( "input_convention and output convention must be an integer number in [0,5]\n" ); printf( "the following conventions are supported:\n" ); @@ -117,6 +117,7 @@ int main( int argc, char *argv[] ) order = (int16_t) sqrtf( numChannels ) - 1; assert( order > 0 && order <= 3 ); + samples = L_FRAME48k * numChannels; while ( ReadWavShort( wavFile_in, samples, numSamples, &numSamplesRead32 ) == __TWI_SUCCESS ) { int32_t err = 0; @@ -126,7 +127,7 @@ int main( int argc, char *argv[] ) break; } - for ( uint16_t i = 0; i < numSamplesRead32; i++ ) + for ( uint16_t i = 0; i < numSamplesRead32 / numChannels; i++ ) { for ( int16_t j = 0; j < numChannels; j++ ) { @@ -141,7 +142,7 @@ int main( int argc, char *argv[] ) } - for ( uint16_t i = 0; i < numSamplesRead32; i++ ) + for ( uint16_t i = 0; i < numSamplesRead32 / numChannels; i++ ) { for ( int16_t j = 0; j < numChannels; j++ ) { -- GitLab From b83ac90a4e341ce0d7476997c29791b0ee82217d Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 26 Sep 2025 14:03:37 +0200 Subject: [PATCH 2/9] removed a warning where a 32 bit value was compared against a 16 bit value in main() of the ambi_converter.c application. --- apps/ambi_converter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index d4fa974d81..40091f613b 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -127,7 +127,7 @@ int main( int argc, char *argv[] ) break; } - for ( uint16_t i = 0; i < numSamplesRead32 / numChannels; i++ ) + for ( uint16_t i = 0; i < (uint16_t)numSamplesRead32 / numChannels; i++ ) { for ( int16_t j = 0; j < numChannels; j++ ) { @@ -142,7 +142,7 @@ int main( int argc, char *argv[] ) } - for ( uint16_t i = 0; i < numSamplesRead32 / numChannels; i++ ) + for ( uint16_t i = 0; i < (uint16_t)numSamplesRead32 / numChannels; i++ ) { for ( int16_t j = 0; j < numChannels; j++ ) { -- GitLab From f1134c0c8180b8f1b55ce880bc1b3b57ebf80e83 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 26 Sep 2025 14:09:35 +0200 Subject: [PATCH 3/9] typo in main() of ambi_converter.c --- apps/ambi_converter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index 40091f613b..fd7cd249ab 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -117,7 +117,7 @@ int main( int argc, char *argv[] ) order = (int16_t) sqrtf( numChannels ) - 1; assert( order > 0 && order <= 3 ); - samples = L_FRAME48k * numChannels; + numSamples = L_FRAME48k * numChannels; while ( ReadWavShort( wavFile_in, samples, numSamples, &numSamplesRead32 ) == __TWI_SUCCESS ) { int32_t err = 0; -- GitLab From a39f8e812cf4846210b75d84d10a703f57c44f68 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 26 Sep 2025 14:30:49 +0200 Subject: [PATCH 4/9] changed the output of the ambi_converter application. --- apps/ambi_converter.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index fd7cd249ab..1686fb2ad9 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -60,6 +60,7 @@ int main( int argc, char *argv[] ) int16_t samples[L_FRAME48k * AMBI_MAX_CHANNELS]; int16_t order = 0; int16_t numChannels; + const char *name_conventions[6]= { "ACN-SN3D", "ACN-N3D", "FuMa-MaxN", "FuMa-FuMa", "SID-SN3D", "SID-N3D" }; AMBI_FMT in_format, out_format; @@ -73,9 +74,9 @@ int main( int argc, char *argv[] ) out[j] = &samples_f_out[j * L_FRAME48k]; } + printf( "Ambisonics converter program\n" ); if ( argc != 5 ) { - printf( "Ambisonics converter program\n" ); printf( "----------------------------------------------------------------------------------\n" ); printf( "Usage:\n" ); printf( "./ambi_converter input_file output_file input_convention output_convention\n" ); @@ -97,8 +98,12 @@ int main( int argc, char *argv[] ) fileName_out = argv[2]; in_format = atoi( argv[3] ); out_format = atoi( argv[4] ); - - printf( "In %d, Out: %d\n", in_format, out_format ); + if ( in_format < 0 || out_format < 0 || in_format > 5 || out_format > 5 ) + { + printf( "input_convention and output convention must be an integer number in [0,5]\n" ); + return -1; + } + printf( "In: [%s], Out: [%s]\n",name_conventions[in_format], name_conventions[out_format] ); wavFile_in = OpenWav( fileName_in, &samplingRate, &numChannels, &samplesInFile, &bps ); if ( !wavFile_in ) -- GitLab From 0618df3da8c083a513e118c61e3136ff84067dfe Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Fri, 26 Sep 2025 14:43:58 +0200 Subject: [PATCH 5/9] applied the clang patch. --- apps/ambi_converter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index 1686fb2ad9..673d4a63f4 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -60,7 +60,7 @@ int main( int argc, char *argv[] ) int16_t samples[L_FRAME48k * AMBI_MAX_CHANNELS]; int16_t order = 0; int16_t numChannels; - const char *name_conventions[6]= { "ACN-SN3D", "ACN-N3D", "FuMa-MaxN", "FuMa-FuMa", "SID-SN3D", "SID-N3D" }; + const char *name_conventions[6] = { "ACN-SN3D", "ACN-N3D", "FuMa-MaxN", "FuMa-FuMa", "SID-SN3D", "SID-N3D" }; AMBI_FMT in_format, out_format; @@ -103,7 +103,7 @@ int main( int argc, char *argv[] ) printf( "input_convention and output convention must be an integer number in [0,5]\n" ); return -1; } - printf( "In: [%s], Out: [%s]\n",name_conventions[in_format], name_conventions[out_format] ); + printf( "In: [%s], Out: [%s]\n", name_conventions[in_format], name_conventions[out_format] ); wavFile_in = OpenWav( fileName_in, &samplingRate, &numChannels, &samplesInFile, &bps ); if ( !wavFile_in ) @@ -132,7 +132,7 @@ int main( int argc, char *argv[] ) break; } - for ( uint16_t i = 0; i < (uint16_t)numSamplesRead32 / numChannels; i++ ) + for ( uint16_t i = 0; i < (uint16_t) numSamplesRead32 / numChannels; i++ ) { for ( int16_t j = 0; j < numChannels; j++ ) { @@ -147,7 +147,7 @@ int main( int argc, char *argv[] ) } - for ( uint16_t i = 0; i < (uint16_t)numSamplesRead32 / numChannels; i++ ) + for ( uint16_t i = 0; i < (uint16_t) numSamplesRead32 / numChannels; i++ ) { for ( int16_t j = 0; j < numChannels; j++ ) { -- GitLab From 2f1d83406d9f9d81587204791c9a3ccf6132d01d Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 29 Sep 2025 11:00:53 +0200 Subject: [PATCH 6/9] ambi_convert() can handle samplerates other than 48k now. --- apps/ambi_converter.c | 16 +++++------ lib_util/ambi_convert.c | 64 +++++++++++++++++++++++------------------ lib_util/ambi_convert.h | 40 ++++++++++++++------------ 3 files changed, 66 insertions(+), 54 deletions(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index 673d4a63f4..928def1dc3 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -52,26 +52,26 @@ int main( int argc, char *argv[] ) uint32_t samplingRate; uint32_t samplesInFile; - uint32_t numSamples = L_FRAME48k; + uint32_t numSamples = AMBI_MAX_FRAME_LENGTH; uint32_t numSamplesRead32 = 0; uint32_t numSamplesClipped = 0; int16_t bps; - int16_t samples[L_FRAME48k * AMBI_MAX_CHANNELS]; + int16_t samples[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS]; int16_t order = 0; int16_t numChannels; const char *name_conventions[6] = { "ACN-SN3D", "ACN-N3D", "FuMa-MaxN", "FuMa-FuMa", "SID-SN3D", "SID-N3D" }; AMBI_FMT in_format, out_format; - float samples_f_in[L_FRAME48k * AMBI_MAX_CHANNELS]; - float samples_f_out[L_FRAME48k * AMBI_MAX_CHANNELS]; + float samples_f_in[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS]; + float samples_f_out[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS]; float *in[AMBI_MAX_CHANNELS], *out[AMBI_MAX_CHANNELS]; for ( int16_t j = 0; j < AMBI_MAX_CHANNELS; j++ ) { - in[j] = &samples_f_in[j * L_FRAME48k]; - out[j] = &samples_f_out[j * L_FRAME48k]; + in[j] = &samples_f_in[j * AMBI_MAX_FRAME_LENGTH]; + out[j] = &samples_f_out[j * AMBI_MAX_FRAME_LENGTH]; } printf( "Ambisonics converter program\n" ); @@ -122,7 +122,7 @@ int main( int argc, char *argv[] ) order = (int16_t) sqrtf( numChannels ) - 1; assert( order > 0 && order <= 3 ); - numSamples = L_FRAME48k * numChannels; + numSamples = ( samplingRate * 20 * numChannels ) / 1000; /* 20ms worth of samples */ while ( ReadWavShort( wavFile_in, samples, numSamples, &numSamplesRead32 ) == __TWI_SUCCESS ) { int32_t err = 0; @@ -140,7 +140,7 @@ int main( int argc, char *argv[] ) } } - if ( ( err = convert_ambi_format( in, out, order, in_format, out_format ) ) != 0 ) + if ( ( err = convert_ambi_format( in, out, order, in_format, out_format, numSamples / numChannels ) ) != 0 ) { printf( "Error converting the input signal!\n" ); return err; diff --git a/lib_util/ambi_convert.c b/lib_util/ambi_convert.c index 282f4a0872..4c6a46d7c8 100644 --- a/lib_util/ambi_convert.c +++ b/lib_util/ambi_convert.c @@ -124,15 +124,16 @@ static const int16_t REORDER_ACN_SID[AMBI_MAX_CHANNELS] = { 0, --------------------------------------------------------------------------*/ AMBI_CONVERT_ERROR convert_ambi_format( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_FMT in_format, /* i: input ambisonics format */ - AMBI_FMT out_format /* i: output ambisonics format */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ + int16_t order, /* i: ambisonics order */ + AMBI_FMT in_format, /* i: input ambisonics format */ + AMBI_FMT out_format, /* i: output ambisonics format */ + const int16_t frame_length /* i: input/output frame length */ ) { - float tmp[AMBI_MAX_CHANNELS * L_FRAME48k]; + float tmp[AMBI_MAX_CHANNELS * AMBI_MAX_FRAME_LENGTH]; float *p_tmp[AMBI_MAX_CHANNELS]; AMBI_CONVERT_ERROR err = AMBI_CONVERT_OK; @@ -144,6 +145,11 @@ AMBI_CONVERT_ERROR convert_ambi_format( assert( order <= 3 ); + if ( frame_length > AMBI_MAX_FRAME_LENGTH ) + { + return AMBI_CONVERT_UNSUPPORTED_FRAME_LENGTH; + } + if ( in_format != AMBI_FMT_ACN_SN3D && out_format != AMBI_FMT_ACN_SN3D ) { assert( 0 && "Conversion only supported to and from ACN-SN3D" ); @@ -151,7 +157,7 @@ AMBI_CONVERT_ERROR convert_ambi_format( for ( int16_t j = 0; j < AMBI_MAX_CHANNELS; j++ ) { - p_tmp[j] = &tmp[j * L_FRAME48k]; + p_tmp[j] = &tmp[j * frame_length]; } switch ( in_format ) @@ -218,18 +224,18 @@ AMBI_CONVERT_ERROR convert_ambi_format( { if ( ch_ord_in != ch_ord_out ) { - if ( ( err = renormalize_channels( in, p_tmp, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = renormalize_channels( in, p_tmp, order, ch_norm_in, ch_norm_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } - if ( ( err = reorder_channels( p_tmp, out, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = reorder_channels( p_tmp, out, order, ch_ord_in, ch_ord_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } } else { - if ( ( err = renormalize_channels( in, out, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = renormalize_channels( in, out, order, ch_norm_in, ch_norm_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } @@ -237,7 +243,7 @@ AMBI_CONVERT_ERROR convert_ambi_format( } else if ( in_format == AMBI_FMT_ACN_SN3D && ch_ord_in != ch_ord_out ) { - if ( ( err = reorder_channels( in, out, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = reorder_channels( in, out, order, ch_ord_in, ch_ord_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } @@ -246,18 +252,18 @@ AMBI_CONVERT_ERROR convert_ambi_format( { if ( ch_ord_in != ch_ord_out ) { - if ( ( err = reorder_channels( in, p_tmp, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = reorder_channels( in, p_tmp, order, ch_ord_in, ch_ord_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } - if ( ( err = renormalize_channels( p_tmp, out, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = renormalize_channels( p_tmp, out, order, ch_norm_in, ch_norm_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } } else { - if ( ( err = renormalize_channels( in, out, order, ch_norm_in, ch_norm_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = renormalize_channels( in, out, order, ch_norm_in, ch_norm_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } @@ -265,7 +271,7 @@ AMBI_CONVERT_ERROR convert_ambi_format( } else if ( out_format == AMBI_FMT_ACN_SN3D && ch_ord_in != ch_ord_out ) { - if ( ( err = reorder_channels( in, out, order, ch_ord_in, ch_ord_out ) ) != AMBI_CONVERT_OK ) + if ( ( err = reorder_channels( in, out, order, ch_ord_in, ch_ord_out, frame_length ) ) != AMBI_CONVERT_OK ) { return err; } @@ -278,7 +284,7 @@ AMBI_CONVERT_ERROR convert_ambi_format( for ( i_chan = 0; i_chan < n_chan; i_chan++ ) { int16_t i = 0; - for ( i = 0; i < L_FRAME48k; i++ ) + for ( i = 0; i < frame_length; i++ ) { out[i_chan][i] = in[i_chan][i]; } @@ -299,11 +305,12 @@ AMBI_CONVERT_ERROR convert_ambi_format( --------------------------------------------------------------------------*/ AMBI_CONVERT_ERROR renormalize_channels( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_NORM out_format /* i: output ambisonics format */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ + int16_t order, /* i: ambisonics order */ + AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ + AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ + const int16_t frame_length /* i: input/output frame length */ ) { int16_t n_chan = ( order + 1 ) * ( order + 1 ); @@ -358,7 +365,7 @@ AMBI_CONVERT_ERROR renormalize_channels( for ( i_chan = 0; i_chan < n_chan; i_chan++ ) { float conversion_factor = conversion_table[i_chan]; - for ( i = 0; i < L_FRAME48k; i++ ) + for ( i = 0; i < frame_length; i++ ) { out[i_chan][i] = in[i_chan][i] * conversion_factor; } @@ -374,11 +381,12 @@ AMBI_CONVERT_ERROR renormalize_channels( --------------------------------------------------------------------------*/ AMBI_CONVERT_ERROR reorder_channels( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_ORDER out_format /* i: output ambisonics format */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ + int16_t order, /* i: ambisonics order */ + AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ + AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ + const int16_t frame_length /* i: input/output frame length */ ) { int16_t n_chan = ( order + 1 ) * ( order + 1 ); @@ -421,7 +429,7 @@ AMBI_CONVERT_ERROR reorder_channels( return AMBI_CONVERT_UNSUPPORTED_CONVERSION; } - for ( i = 0; i < L_FRAME48k; i++ ) + for ( i = 0; i < frame_length; i++ ) { for ( i_chan = 0; i_chan < n_chan; i_chan++ ) { diff --git a/lib_util/ambi_convert.h b/lib_util/ambi_convert.h index 825d65127c..c680a7ff55 100644 --- a/lib_util/ambi_convert.h +++ b/lib_util/ambi_convert.h @@ -35,8 +35,8 @@ #include -#define L_FRAME48k 960 -#define AMBI_MAX_CHANNELS 16 +#define AMBI_MAX_FRAME_LENGTH 960 /* 20ms at 48 kHz Sampling rate */ +#define AMBI_MAX_CHANNELS 16 typedef enum { @@ -66,30 +66,34 @@ typedef enum typedef enum { AMBI_CONVERT_OK = 0, - AMBI_CONVERT_UNSUPPORTED_CONVERSION + AMBI_CONVERT_UNSUPPORTED_CONVERSION, + AMBI_CONVERT_UNSUPPORTED_FRAME_LENGTH } AMBI_CONVERT_ERROR; AMBI_CONVERT_ERROR convert_ambi_format( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_FMT in_format, /* i: input ambisonics format */ - AMBI_FMT out_format /* i: output ambisonics format */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ + int16_t order, /* i: ambisonics order */ + AMBI_FMT in_format, /* i: input ambisonics format */ + AMBI_FMT out_format, /* i: output ambisonics format */ + const int16_t frame_length /* i: input/output frame length */ ); AMBI_CONVERT_ERROR renormalize_channels( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_NORM out_format /* i: output ambisonics format */ -); - -AMBI_CONVERT_ERROR reorder_channels( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_ORDER out_format /* i: output ambisonics format */ + AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ + AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ + const int16_t frame_length /* i: input/output frame length */ +); + +AMBI_CONVERT_ERROR reorder_channels( + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ + int16_t order, /* i: ambisonics order */ + AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ + AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ + const int16_t frame_length /* i: input/output frame length */ ); #endif -- GitLab From 5c813befd3e879afe87ab232dfc6b972ffb945fe Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 29 Sep 2025 12:14:52 +0200 Subject: [PATCH 7/9] make ambisonics-converter function arguments const --- lib_util/ambi_convert.c | 18 +++++++++--------- lib_util/ambi_convert.h | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib_util/ambi_convert.c b/lib_util/ambi_convert.c index 4c6a46d7c8..cd4722d994 100644 --- a/lib_util/ambi_convert.c +++ b/lib_util/ambi_convert.c @@ -126,9 +126,9 @@ static const int16_t REORDER_ACN_SID[AMBI_MAX_CHANNELS] = { 0, AMBI_CONVERT_ERROR convert_ambi_format( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_FMT in_format, /* i: input ambisonics format */ - AMBI_FMT out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_FMT in_format, /* i: input ambisonics format */ + const AMBI_FMT out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ) { @@ -307,9 +307,9 @@ AMBI_CONVERT_ERROR convert_ambi_format( AMBI_CONVERT_ERROR renormalize_channels( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ + const AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ) { @@ -383,9 +383,9 @@ AMBI_CONVERT_ERROR renormalize_channels( AMBI_CONVERT_ERROR reorder_channels( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ + const AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ) { diff --git a/lib_util/ambi_convert.h b/lib_util/ambi_convert.h index c680a7ff55..6d833481ad 100644 --- a/lib_util/ambi_convert.h +++ b/lib_util/ambi_convert.h @@ -73,27 +73,27 @@ typedef enum AMBI_CONVERT_ERROR convert_ambi_format( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_FMT in_format, /* i: input ambisonics format */ - AMBI_FMT out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_FMT in_format, /* i: input ambisonics format */ + const AMBI_FMT out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ); AMBI_CONVERT_ERROR renormalize_channels( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ + const AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ); AMBI_CONVERT_ERROR reorder_channels( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - int16_t order, /* i: ambisonics order */ - AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ - AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ + const AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ); #endif -- GitLab From 5f91263cad329aa4ae93eca4c2725fc8e180bcb6 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 29 Sep 2025 12:33:18 +0200 Subject: [PATCH 8/9] Missing cast in ambi_converter.c caused a Compiler Warning on MSVC. --- apps/ambi_converter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index 928def1dc3..4341925886 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -140,7 +140,7 @@ int main( int argc, char *argv[] ) } } - if ( ( err = convert_ambi_format( in, out, order, in_format, out_format, numSamples / numChannels ) ) != 0 ) + if ( ( err = convert_ambi_format( in, out, order, in_format, out_format, (const uint16_t) ( numSamples / numChannels ) ) ) != 0 ) { printf( "Error converting the input signal!\n" ); return err; -- GitLab From b622f8bac027d54c0525fd2bf8de03243d63bd56 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Mon, 29 Sep 2025 13:23:09 +0200 Subject: [PATCH 9/9] applied the clang patch --- apps/ambi_converter.c | 2 +- lib_util/ambi_convert.c | 18 +++++++++--------- lib_util/ambi_convert.h | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c index 4341925886..ea880d26a9 100644 --- a/apps/ambi_converter.c +++ b/apps/ambi_converter.c @@ -140,7 +140,7 @@ int main( int argc, char *argv[] ) } } - if ( ( err = convert_ambi_format( in, out, order, in_format, out_format, (const uint16_t) ( numSamples / numChannels ) ) ) != 0 ) + if ( ( err = convert_ambi_format( in, out, order, in_format, out_format, ( const uint16_t )( numSamples / numChannels ) ) ) != 0 ) { printf( "Error converting the input signal!\n" ); return err; diff --git a/lib_util/ambi_convert.c b/lib_util/ambi_convert.c index cd4722d994..e91dd0f989 100644 --- a/lib_util/ambi_convert.c +++ b/lib_util/ambi_convert.c @@ -126,9 +126,9 @@ static const int16_t REORDER_ACN_SID[AMBI_MAX_CHANNELS] = { 0, AMBI_CONVERT_ERROR convert_ambi_format( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - const int16_t order, /* i: ambisonics order */ - const AMBI_FMT in_format, /* i: input ambisonics format */ - const AMBI_FMT out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_FMT in_format, /* i: input ambisonics format */ + const AMBI_FMT out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ) { @@ -305,12 +305,12 @@ AMBI_CONVERT_ERROR convert_ambi_format( --------------------------------------------------------------------------*/ AMBI_CONVERT_ERROR renormalize_channels( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ const int16_t order, /* i: ambisonics order */ const AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ const AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ - const int16_t frame_length /* i: input/output frame length */ + const int16_t frame_length /* i: input/output frame length */ ) { int16_t n_chan = ( order + 1 ) * ( order + 1 ); @@ -381,12 +381,12 @@ AMBI_CONVERT_ERROR renormalize_channels( --------------------------------------------------------------------------*/ AMBI_CONVERT_ERROR reorder_channels( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ const int16_t order, /* i: ambisonics order */ const AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ const AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ - const int16_t frame_length /* i: input/output frame length */ + const int16_t frame_length /* i: input/output frame length */ ) { int16_t n_chan = ( order + 1 ) * ( order + 1 ); diff --git a/lib_util/ambi_convert.h b/lib_util/ambi_convert.h index 6d833481ad..1b2ffb8c60 100644 --- a/lib_util/ambi_convert.h +++ b/lib_util/ambi_convert.h @@ -73,27 +73,27 @@ typedef enum AMBI_CONVERT_ERROR convert_ambi_format( float *in[], /* i: input ambisonics channels */ float *out[], /* o: output ambisonics channels */ - const int16_t order, /* i: ambisonics order */ - const AMBI_FMT in_format, /* i: input ambisonics format */ - const AMBI_FMT out_format, /* i: output ambisonics format */ + const int16_t order, /* i: ambisonics order */ + const AMBI_FMT in_format, /* i: input ambisonics format */ + const AMBI_FMT out_format, /* i: output ambisonics format */ const int16_t frame_length /* i: input/output frame length */ ); AMBI_CONVERT_ERROR renormalize_channels( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ const int16_t order, /* i: ambisonics order */ const AMBI_CHANNEL_NORM in_format, /* i: input ambisonics format */ const AMBI_CHANNEL_NORM out_format, /* i: output ambisonics format */ - const int16_t frame_length /* i: input/output frame length */ + const int16_t frame_length /* i: input/output frame length */ ); AMBI_CONVERT_ERROR reorder_channels( - float *in[], /* i: input ambisonics channels */ - float *out[], /* o: output ambisonics channels */ + float *in[], /* i: input ambisonics channels */ + float *out[], /* o: output ambisonics channels */ const int16_t order, /* i: ambisonics order */ const AMBI_CHANNEL_ORDER in_format, /* i: input ambisonics format */ const AMBI_CHANNEL_ORDER out_format, /* i: output ambisonics format */ - const int16_t frame_length /* i: input/output frame length */ + const int16_t frame_length /* i: input/output frame length */ ); #endif -- GitLab