Commit be2b9677 authored by Serdar Buyuksarac's avatar Serdar Buyuksarac
Browse files

Merge branch 'main' into 814-replace-double-precision-arithmetic-with-single

parents 498404e4 c5b383d5
Loading
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -150,7 +150,6 @@
    <ClCompile Include="..\lib_rend\ivas_lcld_rom_tables.c" />
    <ClCompile Include="..\lib_rend\ivas_sba_rendering.c" />
    <ClCompile Include="..\lib_rend\ivas_allrad_dec.c" />
    <ClCompile Include="..\lib_rend\ivas_cldfb_codec_bitstream.c" />
    <ClCompile Include="..\lib_rend\ivas_MSPred.c" />
    <ClCompile Include="..\lib_rend\ivas_NoiseGen.c" />
    <ClCompile Include="..\lib_rend\ivas_PerceptualModel.c" />
@@ -195,7 +194,6 @@
    <ClCompile Include="..\lib_rend\lib_rend.c" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_rend\ivas_cldfb_codec_bitstream.h" />
    <ClInclude Include="..\lib_rend\ivas_lcld_prot.h" />
    <ClInclude Include="..\lib_rend\ivas_lcld_rom_tables.h" />
    <ClInclude Include="..\lib_rend\ivas_prot_rend.h" />
+0 −6
Original line number Diff line number Diff line
@@ -5,9 +5,6 @@
    <ClCompile Include="..\lib_rend\ivas_allrad_dec.c">
      <Filter>rend_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_rend\ivas_cldfb_codec_bitstream.c">
      <Filter>rend_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_rend\ivas_crend.c">
      <Filter>rend_c</Filter>
    </ClCompile>
@@ -206,9 +203,6 @@
    <ClInclude Include="..\lib_rend\ivas_lcld_rom_tables.h">
      <Filter>rend_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_rend\ivas_cldfb_codec_bitstream.h">
      <Filter>rend_h</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <Filter Include="rend_h">
+329 −89

File changed.

Preview size limit exceeded, changes collapsed.

+2 −16
Original line number Diff line number Diff line
@@ -131,7 +131,6 @@ typedef struct
    const char *ca_config_file;
    bool mimeOutput;
    IVAS_ENC_COMPLEXITY_LEVEL complexityLevel;

#ifdef DEBUGGING
    IVAS_ENC_FORCED_MODE forcedMode;
    const char *forcedModeFile;
@@ -178,7 +177,7 @@ int main(
{
    bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */
    EncArguments arg;
    int16_t i = 0;
    int16_t i;
    ivas_error error = IVAS_ERR_UNKNOWN;

    /* Any handles that require cleanup must be declared here and initialized to NULL */
@@ -189,11 +188,7 @@ int main(
    FILE *f_bwProfile = NULL;
    JbmFileReader *jbmReader = NULL;
    MasaFileReader *masaReader = NULL;
    IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS];
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
        ismReaders[i] = NULL;
    }
    IsmFileReader *ismReaders[IVAS_MAX_NUM_OBJECTS] = { NULL, NULL, NULL, NULL };
    int16_t *pcmBuf = NULL;
#ifdef DEBUGGING
    FILE *f_forcedModeProfile = NULL;
@@ -234,7 +229,6 @@ int main(
        goto cleanup;
    }


    /*------------------------------------------------------------------------------------------*
     * Open output bitstream file
     *------------------------------------------------------------------------------------------*/
@@ -492,7 +486,6 @@ int main(
            goto cleanup;
    }


    /* Validate number of channels */
    int16_t encInNumChannels = 0;
    if ( ( error = IVAS_ENC_GetNumInChannels( hIvasEnc, &encInNumChannels ) ) != IVAS_ERR_OK )
@@ -603,7 +596,6 @@ int main(
    int16_t numSamplesRead = 0;
    uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME];
    uint16_t numBits = 0;

#ifdef DEBUG_SBA
#ifdef DEBUG_AGC
    ivas_open_agc_debug_files( (int16_t) arg.agc );
@@ -725,7 +717,6 @@ int main(
            }
        }
#endif

        /* Read ISM input metadata */
        for ( i = 0; i < numIsmInputs; ++i )
        {
@@ -803,7 +794,6 @@ int main(
#ifdef DEBUGGING
    print_snr();
#endif

    /*------------------------------------------------------------------------------------------*
     * Close files and deallocate resources
     *------------------------------------------------------------------------------------------*/
@@ -856,7 +846,6 @@ cleanup:
    print_wmops();
    print_mem( NULL );
#endif

#ifdef DEBUGGING
    dbgclose();

@@ -1606,7 +1595,6 @@ static bool parseCmdlIVAS_enc(
                usage_enc();
            }
        }

        else if ( strcmp( to_upper( argv[i] ), "-ISM_SBA" ) == 0 )
        {
            arg->inputFormat = IVAS_ENC_INPUT_SBA_ISM;
@@ -1695,7 +1683,6 @@ static bool parseCmdlIVAS_enc(
                }
            }
        }

        else if ( strcmp( argv_to_upper, "-STEREO_DMX_EVS" ) == 0 )
        {
            arg->inputFormat = IVAS_ENC_INPUT_MONO;
@@ -1932,7 +1919,6 @@ static void usage_enc( void )
    fprintf( stdout, "-mime               : Mime output bitstream file format\n" );
    fprintf( stdout, "                      The encoder produces TS26.445 Annex.2.6 Mime Storage Format, (not RFC4867 Mime Format).\n" );
    fprintf( stdout, "                      default output bitstream file format is G.192\n" );

    fprintf( stdout, "-bypass mode        : SBA PCA by-pass, mode = (1, 2), 1 = PCA off, 2 = signal adaptive, default is 1\n" );
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
+101 −13
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@
#define RENDERER_MAX_METADATA_LINE_LENGTH 1024

#ifdef SPLIT_REND_WITH_HEAD_ROT
#define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) SPLIT_REND_MAX_BRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) + SPLIT_REND_ADDITIONAL_BYTES_TO_READ )
#define SPLIT_REND_BITS_BUFF_SIZE ( ( ( ( (int32_t) IVAS_MAX_SPLIT_REND_BITRATE / IVAS_NUM_FRAMES_PER_SEC ) + 7 ) >> 3 ) + IVAS_SPLIT_REND_ADDITIONAL_BYTES_TO_READ )
#endif

#define IVAS_MAX16B_FLT 32767.0f
@@ -187,7 +187,11 @@ typedef struct
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
    float syncMdDelay;
#ifdef NONBE_UNIFIED_DECODING_PATHS
    IVAS_RENDER_FRAMESIZE render_framesize;
#else
    bool framing_5ms;
#endif
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    uint16_t acousticEnvironmentId;
} CmdlnArgs;
@@ -219,6 +223,9 @@ typedef enum
#endif
    CmdLnOptionId_referenceVectorFile,
    CmdLnOptionId_exteriorOrientationFile,
#ifdef NONBE_UNIFIED_DECODING_PATHS
    CmdLnOptionId_framing,
#endif
    CmdLnOptionId_framing5ms,
    CmdLnOptionId_syncMdDelay,
    CmdLnOptionId_directivityPatternId,
@@ -368,6 +375,14 @@ static const CmdLnParser_Option cliOptions[] = {
        .matchShort = "exof",
        .description = "External orientation trajectory file for simulation of external orientations",
    },
#ifdef NONBE_UNIFIED_DECODING_PATHS
    {
        .id = CmdLnOptionId_framing,
        .match = "framing",
        .matchShort = "fr",
        .description = "Set Render audio framing.",
    },
#endif
    {
        .id = CmdLnOptionId_framing5ms,
        .match = "framing_5ms",
@@ -478,10 +493,11 @@ static int16_t getTotalNumInChannels(
    IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS],
    IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS],
    IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS],
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS]
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ,
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS],
    IVAS_REND_InputId splitBinIds[RENDERER_MAX_BIN_INPUTS]
#else
    IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS]
#endif
)
{
@@ -586,10 +602,11 @@ static void setupWithSingleFormatInput(
    CmdlnArgs args,
    char *audioFilePath,
    IsmPositionProvider *positionProvider,
    MasaFileReader **masaReaders
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ,
    MasaFileReader **masaReaders,
    SplitFileReadWrite **hhSplitRendFileReadWrite
#else
    MasaFileReader **masaReaders
#endif
)
{
@@ -605,7 +622,7 @@ static void setupWithSingleFormatInput(
            exit( -1 );
        }

        for ( int32_t i = 0; i < args.numInMetadataFiles; ++i )
        for ( int16_t i = 0; i < args.numInMetadataFiles; ++i )
        {
            masaReaders[i] = MasaFileReader_open( args.inMetadataFilePaths[i] );
            if ( masaReaders[i] == NULL )
@@ -997,9 +1014,17 @@ int main(
#ifdef SPLIT_REND_WITH_HEAD_ROT
    }
#endif
#ifdef NONBE_UNIFIED_DECODING_PATHS
    const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );
#else
    const int16_t frameSize_smpls = (int16_t) ( ( args.framing_5ms ? 5 : 20 ) * args.sampleRate / 1000 );
#endif

#ifdef NONBE_UNIFIED_DECODING_PATHS
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, ( args.framing_5ms ) ? 1 : 4 ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "Error opening renderer handle: %s\n", ivas_error_to_string( error ) );
        exit( -1 );
@@ -1494,7 +1519,11 @@ int main(
    {
        int16_t num_in_channels;
        num_in_channels = inBuffer.config.numChannels;
#ifdef NONBE_UNIFIED_DECODING_PATHS
        const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0;
#else
        const bool isCurrentFrameMultipleOf20ms = !args.framing_5ms || frame % 4 == 0;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
        numSamplesRead = 0;
@@ -1546,7 +1575,11 @@ int main(
#endif

        int16_t num_subframes, sf_idx;
#ifdef NONBE_UNIFIED_DECODING_PATHS
        num_subframes = (int16_t) args.render_framesize;
#else
        num_subframes = ( args.framing_5ms ) ? 1 : IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
#endif

        if ( isCurrentFrameMultipleOf20ms )
        {
@@ -1847,11 +1880,11 @@ int main(

        if ( delayNumSamples == -1 )
        {
            if ( args.delayCompensationEnabled
#ifdef SPLIT_REND_WITH_HEAD_ROT
                 && !is_split_pre_rend_mode( &args )
            if ( args.delayCompensationEnabled && !is_split_pre_rend_mode( &args ) )
#else
            if ( args.delayCompensationEnabled )
#endif
            )
            {
                if ( IVAS_REND_GetDelay( hIvasRend, &delayNumSamples, &delayTimeScale ) != IVAS_ERR_OK )
                {
@@ -2334,6 +2367,39 @@ static bool parseDiegeticPan(
    return true;
}


#ifdef NONBE_UNIFIED_DECODING_PATHS
static bool parseRenderFramesize(
    char *value,
    IVAS_RENDER_FRAMESIZE *render_framesize )
{
    int32_t tmp;

    *render_framesize = IVAS_RENDER_FRAMESIZE_UNKNOWN;
    if ( !is_digits_only( value ) )
    {
        return false;
    }
    tmp = (int32_t) strtol( value, NULL, 0 );
    switch ( (int16_t) tmp )
    {
        case 5:
            *render_framesize = IVAS_RENDER_FRAMESIZE_5MS;
            break;
        case 10:
            *render_framesize = IVAS_RENDER_FRAMESIZE_10MS;
            break;
        case 20:
            *render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
            break;
        default:
            return false;
    }

    return true;
}
#endif

static bool parseOrientationTracking(
    char *value,
    int8_t *orientation_tracking )
@@ -2631,7 +2697,11 @@ static CmdlnArgs defaultArgs(

    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );
#ifdef NONBE_UNIFIED_DECODING_PATHS
    args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
#else
    args.framing_5ms = false;
#endif
    args.syncMdDelay = 0;

    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
@@ -2793,9 +2863,24 @@ static void parseOption(
                exit( -1 );
            }
            break;
#ifdef NONBE_UNIFIED_DECODING_PATHS
        case CmdLnOptionId_framing:
            assert( numOptionValues == 1 );
            if ( !parseRenderFramesize( optionValues[0], &args->render_framesize ) )
            {
                fprintf( stderr, "Unknown or invalid option for LFE position: %s\n", optionValues[0] );
                exit( -1 );
            }

            break;
#endif
        case CmdLnOptionId_framing5ms:
            assert( numOptionValues == 0 );
#ifdef NONBE_UNIFIED_DECODING_PATHS
            args->render_framesize = IVAS_RENDER_FRAMESIZE_5MS;
#else
            args->framing_5ms = true;
#endif
            fprintf( stderr, "Warning: this is a placeholder for 5ms framing.\n" );
            break;
        case CmdLnOptionId_directivityPatternId:
@@ -3290,6 +3375,7 @@ static void parseObjectPosition(
    int16_t read_values;
    float meta_prm[8] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f };


    readNextMetadataChunk( line, "," );
    *positionDuration = (uint16_t) strtol( line, &endptr, 10 );
    readNextMetadataChunk( line, "\n" );
@@ -3808,11 +3894,12 @@ static void convertInputBuffer(
    const int16_t numIntSamplesPerChannel,
    const int16_t numFloatSamplesPerChannel,
    const int16_t numChannels,
    float *floatBuffer
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ,
    float *floatBuffer,
    const int16_t cldfb_in_flag,
    IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbAna
#else
    float *floatBuffer
#endif
)
{
@@ -3896,11 +3983,12 @@ static void convertOutputBuffer(
    const float *floatBuffer,
    const int16_t numSamplesPerChannel,
    const int16_t numChannels,
    int16_t *intBuffer
#ifdef SPLIT_REND_WITH_HEAD_ROT
    ,
    int16_t *intBuffer,
    const int16_t cldfb_in_flag,
    IVAS_CLDFB_FILTER_BANK_HANDLE *cldfbSyn
#else
    int16_t *intBuffer
#endif
)
{
Loading