Commit b15a5701 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch '640-split-rendering-remove-dev-lc3plus-defines' into 'main'

Resolve "Formal issues in split rendering" -  remove LC3plus dev defines

See merge request !1137
parents 6fbbc600 5161b851
Loading
Loading
Loading
Loading
Loading
+44 −125
Original line number Diff line number Diff line
@@ -49,9 +49,6 @@

ivas_error IVAS_LC3PLUS_DEC_Open(
    const LC3PLUS_CONFIG config,    /* i  : LC3plus decoder configuration                        */
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    const int16_t enableCaching, /* i  : if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */
#endif
    IVAS_LC3PLUS_DEC_HANDLE *handle /* o  : decoder handle                                   */
)
{
@@ -70,18 +67,8 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
    {
        return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Invalid lc3plus_frame_duration_us (0)\n" );
    }
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    ( *handle )->cachingEnabled = enableCaching;
#endif
    numLC3plusFramesPerIvasFrame = (int16_t) ( config.ivas_frame_duration_us / config.lc3plus_frame_duration_us );

#ifdef LC3PLUS_DEC_COLLECT_STATS
    ( *handle )->stats.action_histogram[DEC_ACTION_DECODE_AND_DROP] = 0;
    ( *handle )->stats.action_histogram[DEC_ACTION_DECODE_AND_USE] = 0;
    ( *handle )->stats.action_histogram[DEC_ACTION_SKIP] = 0;
    ( *handle )->stats.action_histogram[DEC_ACTION_CACHE] = 0;
    ( *handle )->stats.num_cached_frames_decoded_and_dropped = 0;
#endif

    ( *handle )->num_decs = 0;
    ( *handle )->pcm_conversion_buffer = NULL;
@@ -107,10 +94,6 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
        ( *handle )->selective_decoding_states[i] = NULL;
    }

#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    if ( enableCaching )
    {
#endif
    if ( ( ( *handle )->bitstream_caches = malloc( config.channels * sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE * ) ) ) == NULL )
    {
        IVAS_LC3PLUS_DEC_Close( handle );
@@ -120,9 +103,6 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
    {
        ( *handle )->bitstream_caches[i] = NULL;
    }
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    }
#endif

    ( *handle )->num_decs = config.channels;
    for ( int32_t iCh = 0; iCh < config.channels; iCh++ )
@@ -180,10 +160,6 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
            ( *handle )->selective_decoding_states[iCh]->frame_actions[lc3plusFrameIdx] = DEC_ACTION_DECODE_AND_USE;
        }

#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
        if ( enableCaching )
        {
#endif
        /* allocate and configure per LC3plus decoder bitstream cache */
        if ( ( ( *handle )->bitstream_caches[iCh] = malloc( sizeof( IVAS_LC3PLUS_DEC_BITSTREAM_CACHE ) ) ) == NULL )
        {
@@ -197,9 +173,6 @@ ivas_error IVAS_LC3PLUS_DEC_Open(
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LC3plus decoder\n" );
        }
        ( *handle )->bitstream_caches[iCh]->bitstream_cache_size = 0;
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
        }
#endif
    }

    ( *handle )->config = config;
@@ -330,9 +303,6 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(

                /* subframe not needed by the user, but might be required to re-initialize a decoder after inactivity */
                if (
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
                    handle->cachingEnabled &&
#endif
                    ( ivasSubframeIdx != actual_num_spatial_subframes - 1 ) && 1 == subframeChannelMatrix[ivasSubframeIdx + 1][decIdx] )
                {
                    /* ... but if the following subframe is required, it needs to be decoded and dropped */
@@ -346,10 +316,6 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
        }
    }

#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    if ( handle->cachingEnabled )
    {
#endif
    /* if a decoder was paused before, it needs to either:
     *      - Decode the cached frame (if available) and the first required frame OR
     *      - Decode the previous LC3plus subframe, even if it isn't needed by the user */
@@ -390,9 +356,6 @@ ivas_error IVAS_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
            }
        }
    }
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    }
#endif

    return IVAS_ERR_OK;
}
@@ -456,9 +419,6 @@ void IVAS_LC3PLUS_DEC_Close(
    {
        return;
    }
#ifdef LC3PLUS_DEC_COLLECT_STATS
    printLC3plusDecStats( &( *handle )->stats );
#endif
    for ( uint32_t iDec = 0; iDec < ( *handle )->num_decs; iDec++ )
    {
        if ( NULL != ( *handle )->handles && NULL != ( *handle )->handles[iDec] )
@@ -604,9 +564,6 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal(
                }
                handle->selective_decoding_states[iDec]->shall_decode_cached_frame = 0;
                handle->selective_decoding_states[iDec]->has_skipped_a_frame = 0;
#ifdef LC3PLUS_DEC_COLLECT_STATS
                handle->stats.num_cached_frames_decoded_and_dropped++;
#endif
            }

            /* reset cache if caching is enabled - it has either been decoded or is not needed */
@@ -614,9 +571,6 @@ static ivas_error IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal(
            {
                handle->bitstream_caches[iDec]->bitstream_cache_size = 0;
            }
#ifdef LC3PLUS_DEC_COLLECT_STATS
            handle->stats.action_histogram[handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame]]++;
#endif
            switch ( handle->selective_decoding_states[iDec]->frame_actions[iLc3plusFrame] )
            {
                case DEC_ACTION_DECODE_AND_DROP:
@@ -745,38 +699,3 @@ ivas_error IVAS_LC3PLUS_DEC_Conceal(

    return IVAS_LC3PLUS_DEC_Decode_or_Conceal_internal( handle, bitstream_in, 0, badFrameIndicator, pcm_out );
}


#ifdef LC3PLUS_DEC_COLLECT_STATS
void printLC3plusDecStats( const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats )
{
    int32_t sum_pushed_frames = 0;
    int32_t sum_decoded_and_dropped_frames, sum_skipped_frames;

    sum_pushed_frames = stats->action_histogram[DEC_ACTION_DECODE_AND_USE] + stats->action_histogram[DEC_ACTION_SKIP] + stats->action_histogram[DEC_ACTION_CACHE];

    sum_decoded_and_dropped_frames =
        stats->action_histogram[DEC_ACTION_DECODE_AND_DROP] + stats->num_cached_frames_decoded_and_dropped;

    sum_skipped_frames = stats->action_histogram[DEC_ACTION_SKIP] + stats->action_histogram[DEC_ACTION_CACHE];

    if ( sum_pushed_frames == 0 )
    {
        printf( "\n Dec didn't run" );
        return;
    }

    printf( "\nsum_pushed_frames: %i\n", sum_pushed_frames );
    printf( "  DECODE_AND_USE count: %i \n", stats->action_histogram[DEC_ACTION_DECODE_AND_USE] );
    printf( "  SKIP count: %i\n", stats->action_histogram[DEC_ACTION_SKIP] );
    printf( "  CACHE count: %i\n", stats->action_histogram[DEC_ACTION_CACHE] );
    printf( "Decoded-and-Dropped:\n" );
    printf( "  DECODE_AND_DROP count: %i \n", stats->action_histogram[DEC_ACTION_DECODE_AND_DROP] );
    printf( "  DEC_CACHE count: %i\n", stats->num_cached_frames_decoded_and_dropped );
    printf( "  perc of req : %f\n", 100.f * (float) sum_decoded_and_dropped_frames / sum_pushed_frames );
    printf( "Workload saved: \n" );
    printf( "   Skipped perc. of req %f\n", 100.f * (float) sum_skipped_frames / sum_pushed_frames );

    return;
}
#endif
+1 −26
Original line number Diff line number Diff line
@@ -40,13 +40,6 @@
#include "ivas_lc3plus_common.h"
#include "ivas_cnst.h"

#ifdef DEBUGGING
/* if defined, collects runtime stats and prints them in the DTOR */
// #define LC3PLUS_DEC_COLLECT_STATS
/* if defined, caching can be disabled, otherwise it's always active */
// #define LC3PLUS_DEC_ALLOW_DISABLE_CACHING
#endif

typedef enum
{
    DEC_ACTION_DECODE_AND_DROP = 0,
@@ -56,15 +49,6 @@ typedef enum
    DEC_ACTION_NUM_ENUMS
} SelectiveDecAction;

#ifdef LC3PLUS_DEC_COLLECT_STATS
typedef struct IVAS_LC3PLUS_DEC_COLLECT_STATS
{
    int32_t action_histogram[DEC_ACTION_NUM_ENUMS];
    int32_t num_cached_frames_decoded_and_dropped;
} IVAS_LC3PLUS_DEC_COLLECT_STATS;

void printLC3plusDecStats( const IVAS_LC3PLUS_DEC_COLLECT_STATS *stats );
#endif

typedef struct IVAS_LC3PLUS_DEC_SELECTIVE_DECODING_STATE
{
@@ -92,19 +76,10 @@ typedef struct IVAS_LC3PLUS_DEC_HANDLE
    uint32_t num_decs;
    int16_t *pcm_conversion_buffer;
    LC3PLUS_CONFIG config;
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    int16_t cachingEnabled;
#endif
#ifdef LC3PLUS_DEC_COLLECT_STATS
    IVAS_LC3PLUS_DEC_COLLECT_STATS stats;
#endif
} * IVAS_LC3PLUS_DEC_HANDLE;

ivas_error IVAS_LC3PLUS_DEC_Open(
    const LC3PLUS_CONFIG config,    /* i  : decoder configuration                              */
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
    const int16_t enableCaching, /* i  : if set to 0, the decoder will NOT use cached frame to flush algorithmic delay after skipped frames */
#endif
    IVAS_LC3PLUS_DEC_HANDLE *handle /* o  : decoder handle                                  */
);

+0 −3
Original line number Diff line number Diff line
@@ -7374,9 +7374,6 @@ static ivas_error renderSplitBinauralWithPostRot(
        config.samplerate = *splitBinInput->base.ctx.pOutSampleRate;

        if ( ( error = IVAS_LC3PLUS_DEC_Open( config,
#ifdef LC3PLUS_DEC_ALLOW_DISABLE_CACHING
                                              0 /* caching disabled */,
#endif
                                              &splitBinInput->splitPostRendWrapper.hLc3plusDec ) ) != IVAS_ERR_OK )
        {
            return error;