Commit 0801089f authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

fix for 0DoF LCLD and fix compilation with inactive defines

parent 2e3b3225
Loading
Loading
Loading
Loading
Loading
+54 −11
Original line number Diff line number Diff line
@@ -2232,7 +2232,7 @@ static ivas_error decodeG192(
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
#if 0 //  defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
            int16_t enable5ms;
            IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
            arg.enable5ms = enable5ms;
@@ -2274,7 +2274,7 @@ static ivas_error decodeG192(
                goto cleanup;
            }

#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
#if 0 // defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
            int16_t enable5ms;
            IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
            arg.enable5ms = enable5ms;
@@ -2348,12 +2348,13 @@ static ivas_error decodeG192(
                }
            }

#ifdef SPLIT_REND_WITH_HEAD_ROT
#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT
            if ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED || arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM )
            {
                error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec,
                                                            (void *) ( pcmBuf + nOutChannels * nSamplesRendered ),
                                                            &splitRendBits,
                                                            nSamplesToRender,
                                                            &nSamplesRendered_loop,
                                                            &needNewFrame );
                nSamplesRendered += nSamplesRendered_loop;
@@ -2434,6 +2435,45 @@ static ivas_error decodeG192(
                {
                    goto cleanup;
                }
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
                int16_t enable5ms;
                IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
                /* we assumed 5ms but are really 20ms, we need to throw away some head and ext positions */
                if ( !enable5ms && arg.enable5ms )
                {
                    /* Skip over 3 following entries in file - they are given on 5ms grid */
                    if ( arg.enableExternalOrientation )
                    {
                        IVAS_QUATERNION Quaternion;
                        int8_t enableHeadRotation;
                        int8_t enableExternalOrientation;
                        int8_t enableRotationInterpolation;
                        int16_t numFramesToTargetOrientation;
                        for ( i = 0; i < 3; ++i )
                        {
                            if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternion, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK )
                            {
                                fprintf( stderr, "Error in External Orientation File Reading: %s\n", ivas_error_to_string( error ) );
                                exit( -1 );
                            }
                        }
                    }
                    if ( arg.enableHeadRotation )
                    {
                        IVAS_QUATERNION Quaternion;
                        /* Skip over 3 following head positions - they are given on 5ms grid */
                        for ( i = 0; i < 3; ++i )
                        {
                            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos ) ) != IVAS_ERR_OK )
                            {
                                fprintf( stderr, "Error in Head Rotation File Reading: %s\n", ivas_error_to_string( error ) );
                                exit( -1 );
                            }
                        }
                    }
                }
                arg.enable5ms = enable5ms;
#endif
            }
            else
            {
@@ -2446,6 +2486,8 @@ static ivas_error decodeG192(
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_CODED ) )
            {
                if ( splitRendBits.bits_written > 0 )
                {
                    if ( split_rend_write_bitstream_to_file( hSplitRendFileReadWrite, splitRendBits.bits_buf, &splitRendBits.bits_read, &splitRendBits.bits_written,
                                                             splitRendBits.codec, splitRendBits.pose_correction
@@ -2459,6 +2501,7 @@ static ivas_error decodeG192(
                        goto cleanup;
                    }
                }
            }
            else
            {
                if ( ( hSplitRendFileReadWrite != NULL ) && ( arg.outputFormat == IVAS_DEC_OUTPUT_SPLIT_BINAURAL_PCM ) )
+4 −2
Original line number Diff line number Diff line
@@ -812,7 +812,7 @@ int main(
#ifndef API_5MS
    IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME];
#endif
#ifdef API_5MS
#if defined( API_5MS ) && defined( SPLIT_REND_WITH_HEAD_ROT )
    bool splitBinNeedsNewAudioFrame = true;
    bool splitBinNeedsNewBitstreamFrame = true;
#endif
@@ -1499,6 +1499,7 @@ int main(
#ifdef API_5MS
        const bool isCurrentFrameMultipleOf20ms = !args.framing_5ms || frame % 4 == 0;

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args ) )
        {
            if ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
@@ -1512,6 +1513,7 @@ int main(
            }
        }
#endif
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
        numSamplesRead = 0;
@@ -1557,7 +1559,7 @@ int main(
#endif

        if ( numSamplesRead == 0
#ifdef API_5MS
#if defined( API_5MS ) && defined( SPLIT_REND_WITH_HEAD_ROT )
             && splitBinNeedsNewAudioFrame
#endif
        )
+3 −0
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@
#define IVAS_CLDFB_NO_CHANNELS_MAX  ( 60 )
#define IVAS_MAX_INPUT_LFE_CHANNELS 4

#ifdef API_5MS
#define RENDERER_SUBFRAMES_PER_FRAME      4
#endif
#ifndef API_5MS
#define RENDERER_HEAD_POSITIONS_PER_FRAME 4
#endif
+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@
#define LIB_REND_FIX_HRTFPARAMBIN_MEMLEAK
#define FIX_CQMFPREDDEC_FREE                            /* FhG: avoid double free / free of NULL in DeletePredictionDecoder() */
#define FIX_PLANAR_SBA_JBM_RS
#define FIX_RENDMC_LOCAL_ORIENTATION
/* ### API_5MS switches ### */


+5 −0
Original line number Diff line number Diff line
@@ -261,6 +261,10 @@ ivas_error ivas_dec_init_split_rend(
    {
        st_ivas->hDecoderConfig->Opt_5ms = true;
    }
    else
    {
        st_ivas->hDecoderConfig->Opt_5ms = false;
    }
#else
    ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, ( cldfb_in == 0 ), pcm_out );
#endif
@@ -2534,6 +2538,7 @@ void ivas_initialize_handles_dec(
#ifdef API_5MS
    st_ivas->splitBinRend.tdDataOut = NULL;
    st_ivas->splitBinRend.numTdSamplesPerChannelCached = 0;
    st_ivas->splitBinRend.numSamplesCollected = 0;
#endif
    ivas_init_split_rend_handles( &st_ivas->splitBinRend.splitrend );
#endif
Loading