Commit 3a25dbd1 authored by fotopoulou's avatar fotopoulou
Browse files

New OSBA baseline with minimum ISM_MODE_NONE functionality - always render objects to SBA

parent 2c374d03
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@
    <ClCompile Include="..\lib_enc\ivas_lfe_enc.c" />
    <ClCompile Include="..\lib_enc\ivas_mc_paramupmix_enc.c" />
    <ClCompile Include="..\lib_enc\ivas_mc_param_enc.c" />
    <ClCompile Include="..\lib_enc\ivas_osba_enc.c" />
    <ClCompile Include="..\lib_enc\ivas_pca_enc.c" />
    <ClCompile Include="..\lib_enc\ivas_range_uni_enc.c" />
    <ClCompile Include="..\lib_enc\ivas_spar_encoder.c" />
+1 −0
Original line number Diff line number Diff line
@@ -590,6 +590,7 @@
    <ClCompile Include="..\lib_enc\ivas_mc_paramupmix_enc.c">
      <Filter>enc_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_enc\ivas_osba_enc.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_enc\ivas_stat_enc.h">
+128 −0
Original line number Diff line number Diff line
@@ -89,6 +89,16 @@ typedef union _EncInputFormatConfig
    /* MC details */
    IVAS_ENC_MC_LAYOUT mcLayout;

#ifdef SBA_AND_OBJECTS
    struct EncSbaIsmConfig
    {
        int16_t numObjects;
        const char *metadataFiles[IVAS_MAX_NUM_OBJECTS];
        IVAS_ENC_SBA_ORDER order;
        bool isPlanar;
    } sba_ism;
#endif

} EncInputFormatConfig;

/* Struct for storing cmdln arguments */
@@ -233,7 +243,11 @@ int main(
     * Print out file names
     *------------------------------------------------------------------------------------------*/

#ifdef SBA_AND_OBJECTS
    if ( arg.inputFormat == IVAS_ENC_INPUT_ISM || arg.inputFormat == IVAS_ENC_INPUT_SBA_ISM )
#else
    if ( arg.inputFormat == IVAS_ENC_INPUT_ISM )
#endif
    {
        for ( i = 0; i < arg.inputFormatConfig.ism.numObjects; i++ )
        {
@@ -427,6 +441,15 @@ int main(
                goto cleanup;
            }
            break;
#ifdef SBA_AND_OBJECTS
        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 )
            {
                fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) );
                exit( -1 );
            }
            break;
#endif
        default:
            fprintf( stderr, "\nInvalid input type\n\n" );
            goto cleanup;
@@ -511,7 +534,11 @@ int main(
        }
    }

#ifdef SBA_AND_OBJECTS
    const int16_t numIsmInputs = ( arg.inputFormat == IVAS_ENC_INPUT_ISM || arg.inputFormat == IVAS_ENC_INPUT_SBA_ISM ) ? arg.inputFormatConfig.ism.numObjects : 0;
#else
    const int16_t numIsmInputs = arg.inputFormat == IVAS_ENC_INPUT_ISM ? arg.inputFormatConfig.ism.numObjects : 0;
#endif

    for ( i = 0; i < numIsmInputs; ++i )
    {
@@ -1490,6 +1517,96 @@ static bool parseCmdlIVAS_enc(
                return false;
            }
        }
#ifdef SBA_AND_OBJECTS
        else if ( strcmp( to_upper( argv[i] ), "-ISM_SBA" ) == 0 )
        {
            arg->inputFormat = IVAS_ENC_INPUT_SBA_ISM;
            i++;

            if ( i < argc - 5 )
            {
                if ( sscanf( argv[i], "%d", &tmp ) > 0 )
                {
                    i++;
                }

                if ( tmp <= 0 )
                {
                    fprintf( stderr, "Error: Too low number of ISM channels specified!\n\n" );
                    usage_enc();
                }
                else
                {
                    if ( tmp <= IVAS_MAX_NUM_OBJECTS ) /* number of ISM channels */
                    {
                        arg->inputFormatConfig.sba_ism.numObjects = (int16_t) tmp;
                    }
                    else
                    {
                        fprintf( stderr, "Error: Too high number of ISM channels!\n\n" );
                        usage_enc();
                    }
                }
            }
            else
            {
                fprintf( stderr, "Error: Number of ISM channels not specified!\n\n" );
                usage_enc();
            }

            if ( i < argc - 4 )
            {
                if ( sscanf( argv[i], "%d", &tmp ) > 0 )
                {
                    i++;
                }

                arg->inputFormatConfig.sba_ism.isPlanar = ( tmp < 0 );

                tmp = abs( tmp );
                switch ( tmp )
                {
                    case 1:
                        arg->inputFormatConfig.sba_ism.order = IVAS_ENC_SBA_FOA;
                        break;
                    case 2:
                        arg->inputFormatConfig.sba_ism.order = IVAS_ENC_SBA_HOA2;
                        break;
                    case 3:
                        arg->inputFormatConfig.sba_ism.order = IVAS_ENC_SBA_HOA3;
                        break;
                    default:
                        fprintf( stderr, "Error: Wrong SBA order specified!\n\n" );
                        usage_enc();
                        return false;
                }
            }

            /* read input metadata files */
            for ( j = 0; j < arg->inputFormatConfig.sba_ism.numObjects; j++ )
            {
                if ( i < argc - 4 )
                {
                    if ( strcmp( argv[i], "NULL" ) == 0 || strcmp( argv[i], "null" ) == 0 )
                    {
                        /* no metadata input file -> encode only audio streams */
                        arg->inputFormatConfig.sba_ism.metadataFiles[j] = NULL;
                    }
                    else
                    {
                        arg->inputFormatConfig.sba_ism.metadataFiles[j] = argv[i];
                    }

                    i++;
                }
                else
                {
                    fprintf( stderr, "Error: not enough arguments\n\n" );
                    usage_enc();
                }
            }
        }
#endif
        else if ( strcmp( argv_to_upper, "-STEREO_DMX_EVS" ) == 0 )
        {
            arg->inputFormat = IVAS_ENC_INPUT_MONO;
@@ -1671,6 +1788,10 @@ static void usage_enc( void )
    fprintf( stdout, "                                                for 4 ISM also 512000 \n" );
    fprintf( stdout, "                      for IVAS SBA, MASA, MC R=(13200, 16400, 24400, 32000, 48000, 64000, 80000, \n" );
    fprintf( stdout, "                                                96000, 128000, 160000, 192000, 256000, 384000, 512000) \n" );
#ifdef SBA_AND_OBJECTS
    fprintf( stdout, "                      for IVAS objects-SBA R =(13200, 16400, 24400, 32000, 48000, 64000, 96000, 128000, \n" );
    fprintf( stdout, "                                                160000, 192000, 256000, 384000, 512000)\n" );
#endif
    fprintf( stdout, "                      Alternatively, R can be a bitrate switching file which consists of R values\n" );
    fprintf( stdout, "                      indicating the bitrate for each frame in bps. These values are stored in\n" );
    fprintf( stdout, "                      binary format using 4 bytes per value\n" );
@@ -1694,6 +1815,13 @@ static void usage_enc( void )
    fprintf( stdout, "-masa Ch File       : MASA format \n" );
    fprintf( stdout, "                      where Ch specifies the number of input/transport channels (1 or 2): \n" );
    fprintf( stdout, "                      and File specifies input file containing parametric MASA metadata \n" );
#ifdef SBA_AND_OBJECTS
    fprintf( stdout, "-ism_sba IsmChannels SBAChannels IsmFiles SBAFile : MASA and objects format \n" );
    fprintf( stdout, "                      where IsmChannels specifies the number of ISms (1-4)\n" );
    fprintf( stdout, "                      and SBAChannels specifies the SBA order (1 to 3) \n" );
    fprintf( stdout, "                      and IsmFiles specify input files containing metadata, one file per object \n" );
    fprintf( stdout, "                      and SBAFile specifies SBA input file \n" );
#endif
    fprintf( stdout, "-mc InputConf       : Multi-channel format\n" );
    fprintf( stdout, "                      where InputConf specifies the channel configuration: 5_1, 7_1, 5_1_2, 5_1_4, 7_1_4\n" );
    fprintf( stdout, "                      Loudspeaker positions are assumed to have azimuth and elevation as per \n" );
+28 −0
Original line number Diff line number Diff line
@@ -319,7 +319,11 @@ int16_t get_ivas_max_num_indices(
            return 1650;
        }
    }
#ifdef SBA_AND_OBJECTS
    else if ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT )
#else
    else if ( ivas_format == SBA_FORMAT )
#endif
    {
        if ( ivas_total_brate <= IVAS_16k4 )
        {
@@ -698,7 +702,11 @@ int16_t get_ivas_max_num_indices_metadata(
            return 80;
        }
    }
#ifdef SBA_AND_OBJECTS
    else if ( ivas_format == SBA_FORMAT || ivas_format == SBA_ISM_FORMAT )
#else
    else if ( ivas_format == SBA_FORMAT )
#endif
    {
        if ( ivas_total_brate <= IVAS_16k4 )
        {
@@ -2569,6 +2577,26 @@ ivas_error preview_indices(
                break;
            case 2:
                st_ivas->ivas_format = ISM_FORMAT;

                if ( total_brate >= IVAS_24k4 )
                {
                    if ( bit_stream[2] )
                    {
#ifdef SBA_AND_OBJECTS
                        if ( bit_stream[3] )
                        {
                            st_ivas->ivas_format = SBA_ISM_FORMAT;

                            /* Placeholder for SBA + objects */
                        }
                        else
                        {
                            /*st_ivas->ivas_format = MASA_ISM_FORMAT;*/
                        }
                        /* placeholder for combined format signaling */
#endif
                    }
                }
                break;
            case 3:
                if ( bit_stream[2] == 0 )
+3 −0
Original line number Diff line number Diff line
@@ -263,6 +263,9 @@ enum{
enum
{
    IND_IVAS_FORMAT,
#ifdef MASA_AND_OBJECTS
    IND_SMODE_OMASA,
#endif
    IND_SMODE,
    IND_SID_TYPE,
    IND_BWIDTH,
Loading