Commit b0712abe authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

implement encoder command line option to select SBA input convention

parent b64f5f62
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@
    </Midl>
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <AdditionalIncludeDirectories>..\lib_com;..\lib_util;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ExceptionHandling />
      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+41 −3
Original line number Diff line number Diff line
@@ -38,6 +38,9 @@
#include "ism_file_reader.h"
#include "jbm_file_reader.h"
#include "masa_file_reader.h"
#ifdef AMBISONICS_CONVENTIONS
#include "ambi_convert.h"
#endif
#ifdef DEBUGGING
#include "debug.h"
#endif
@@ -58,8 +61,7 @@ static
#define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */

/* Additional config info for each input format */
typedef union _EncInputFormatConfig
{
typedef union _EncInputFormatConfig {
    /* MONO details */
    bool stereoToMonoDownmix;

@@ -121,6 +123,9 @@ typedef struct
    bool max_bwidth_user;
    IVAS_ENC_BANDWIDTH maxBandwidth;
    const char *bandwithProfileFile;
#ifdef AMBISONICS_CONVENTIONS
    int16_t sba_input_fmt;
#endif
    IVAS_ENC_DTX_CONFIG dtxConfig;
    int32_t initBitrate;
    const char *bitrateProfileFile;
@@ -408,6 +413,10 @@ int main(
#ifdef DEBUG_SBA_AUDIO_DUMP
                                                            ,
                                                            &numTransportChannels
#endif
#ifdef AMBISONICS_CONVENTIONS
				                                            ,
															arg.sba_input_fmt
#endif
                                                            ) ) != IVAS_ERR_OK )
            {
@@ -431,7 +440,12 @@ int main(
            }
            break;
        case IVAS_ENC_INPUT_SBA_ISM:
            if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca 
#ifdef AMBISONICS_CONVENTIONS
					,
					arg.sba_input_fmt
#endif
			) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                exit( -1 );
@@ -1183,6 +1197,30 @@ static bool parseCmdlIVAS_enc(
            }
        }

        /* ----------------------------------------------------------------
		*  SBA input convention
		*------------------------------------------------------------------*/
#ifdef AMBISONICS_CONVENTIONS
        else if ( strcmp( argv_to_upper, "SBA_CONVENTION" ) == 0 )
        {
            i++;
            arg->inputFormat = AMBI_FMT_ACN_SN3D;

            /* SBA configuration */
            if ( i < argc - 4 && is_number( argv[i] ) && sscanf( argv[i], "%d", &tmp ) > 0 )
            {
                i++;
            }
            else
            {
                tmp = -1; /* this is to avoid a compilation warning */
                fprintf( stderr, "Error: SBA input convention must be specified, expecting a number!\n\n" );
                usage_enc();
                return false;
            }
        }
#endif

        /*-----------------------------------------------------------------*
         * MIME output file format
         *-----------------------------------------------------------------*/
+2 −0
Original line number Diff line number Diff line
@@ -158,6 +158,8 @@

#define FIX_1027_GSC_INT_OVERFLOW                       /* VA: issue 2207: overflow in GSC */

#define AMBISONICS_CONVENTIONS

/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
+300 −289
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "options.h"
#include "cnst.h"
#include "ivas_cnst.h"
#include "ambi_convert.h"
#include "rom_com.h"
#include "prot.h"
#include "ivas_prot.h"
@@ -126,6 +127,16 @@ ivas_error ivas_enc(
    dbgwrite( data_f[LFE_CHANNEL], sizeof( float ), n_samples_chan, 1, "./res/lfe_input" );
#endif

#ifdef AMBISONICS_CONVENTIONS
    if ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT )
    {
        if ( hEncoderConfig->sba_input_fmt != 0 )
        {
            convert_ambi_format( data_f, data_f, st_ivas->sba_analysis_order, hEncoderConfig->sba_input_fmt, AMBI_FMT_ACN_SN3D );
        }
	}
#endif

        if ( ivas_format == SBA_FORMAT )
        {
            if ( ( error = ivas_sba_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK )
+3 −0
Original line number Diff line number Diff line
@@ -1188,6 +1188,9 @@ typedef struct encoder_config_structure
    int16_t Opt_DTX_ON;                             /* flag indicating DTX operation */
    int16_t interval_SID;                           /* CNG and DTX - interval of SID update, default 8 */
    int16_t var_SID_rate_flag;                      /* CNG and DTX - flag for variable SID rate */
#ifdef AMBISONICS_CONVENTIONS
	int16_t sba_input_fmt;
#endif

    int16_t Opt_RF_ON;                              /* flag indicating RF (channel-aware) mode */
    int16_t rf_fec_offset;                          /* RF FEC offset */
Loading