Commit ebf36894 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

review comment 4-24-2024

parent febce4cc
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -829,7 +829,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
            {
                cldfbAnalysis_ts( &( p_rend_obj[n][num_cldfb_bands * slot_idx] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, num_cldfb_bands, st_ivas->hSplitBinRend.splitrend.hCldfbHandles->cldfbAna[n] );

                /* this differs from OSBA by: no scaling by 0.5 */
                /* note: this intentionally differs from OSBA by: no scaling by 0.5 */
                v_add( st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx], Cldfb_RealBuffer, st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx], num_cldfb_bands );
                v_add( st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx], Cldfb_ImagBuffer, st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx], num_cldfb_bands );
            }
+2 −2
Original line number Diff line number Diff line
@@ -72,12 +72,12 @@ int32_t quantPhase(


/*-------------------------------------------------------------------*
 * Function cplxmult_isar()
 * Function cplxmult_lcld()
 *
 *
 *-------------------------------------------------------------------*/

void cplxmult_isar(
void cplxmult_lcld(
    float *pr1,
    float *pi1,
    const float r2,
+0 −2
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@

*******************************************************************************************************/

/* Double check cost function calculation */

#include <stdlib.h>
#include "options.h"
#ifdef SPLIT_REND_WITH_HEAD_ROT
+0 −149
Original line number Diff line number Diff line
@@ -213,155 +213,6 @@ ivas_error ISAR_LC3PLUS_DEC_Open(
}


/*-------------------------------------------------------------------------
 * ISAR_LC3PLUS_DEC_AllocateSubframeDecodingMatrix()
 *
 *
 *------------------------------------------------------------------------*/

ivas_error ISAR_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(
    int16_t ***subframeChannelMatrix,
    const uint32_t num_decs )
{
    int16_t i;

    if ( ( *subframeChannelMatrix = malloc( MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( int16_t * ) ) ) == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" );
    }

    for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
    {
        ( *subframeChannelMatrix )[i] = NULL;
    }

    for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
    {
        if ( ( ( *subframeChannelMatrix )[i] = malloc( num_decs * sizeof( int16_t ) ) ) == NULL )
        {
            isar_LC3PLUS_DEC_FreeSubframeDecodingMatrix( *subframeChannelMatrix );
            return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "subframeChannelMatrix allocation failed\n" );
        }
    }

    return IVAS_ERR_OK;
}


/*-------------------------------------------------------------------------
 * ISAR_LC3PLUS_DEC_SetSelectiveDecodingMatrix()
 *
 *
 *------------------------------------------------------------------------*/

ivas_error ISAR_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
    ISAR_LC3PLUS_DEC_HANDLE handle, /* i  : LC3plus decoder handle     */
    int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] )
{
    int16_t numIvasSubFramesPerLC3frame;
    uint32_t decIdx;
    int16_t ivasSubframeIdx;
    int16_t effectiveIvasSubframeDuration;
    int16_t actual_num_spatial_subframes;

    if ( NULL == handle )
    {
        return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "ISAR_LC3PLUS_DEC_HANDLE is NULL\n" );
    }

    if ( NULL == subframeChannelMatrix )
    {
        return IVAS_ERROR( IVAS_ERR_UNEXPECTED_NULL_POINTER, "subframeChannelMatrix is NULL\n" );
    }

    if ( handle->config.lc3plus_frame_duration_us == 0 || handle->config.ivas_frame_duration_us % handle->config.lc3plus_frame_duration_us != 0 )
    {
        return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "invalid ivas_frame_duration_us/lc3plus_frame_duration_us values\n" );
    }

    effectiveIvasSubframeDuration = (int16_t) ( handle->config.ivas_frame_duration_us == 20000 ? handle->config.ivas_frame_duration_us / MAX_PARAM_SPATIAL_SUBFRAMES : handle->config.ivas_frame_duration_us );
    numIvasSubFramesPerLC3frame = (int16_t) handle->config.lc3plus_frame_duration_us / effectiveIvasSubframeDuration;
    actual_num_spatial_subframes = (int16_t) handle->config.ivas_frame_duration_us / effectiveIvasSubframeDuration;
    /* 0.5(0) = 10ms lc3plus, 5ms subframe */
    if ( numIvasSubFramesPerLC3frame != 1 )
    {
        return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Selective decoding is only implemented for aligned IVAS-Subframes & LC3plus \n" );
    }

    /* map subframeChannelMatrix to lc3plus skip states */
    /* 1st pass: Flag the required frames */
    for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ )
    {
        for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ )
        {
            if ( 1 == subframeChannelMatrix[ivasSubframeIdx][decIdx] )
            {
                /* subframe needed by the user, definitely decode */
                handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_USE;
            }
            else
            {

                /* subframe not needed by the user, but might be required to re-initialize a decoder after inactivity */
                if (
                    ( 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 */
                    handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_DECODE_AND_DROP;
                }
                else
                {
                    handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] = DEC_ACTION_SKIP;
                }
            }
        }
    }

    /* 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 */
    for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ )
    {
        if ( handle->selective_decoding_states[decIdx]->has_skipped_a_frame )
        {
            /* find the first frame required by the user */
            for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ )
            {
                if ( DEC_ACTION_DECODE_AND_USE == handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] )
                {
                    /* The first required frame is the first subframe. To flush the decoder, the cached frame must be decoded and dropped */
                    if ( 0 == ivasSubframeIdx )
                    {
                        handle->selective_decoding_states[decIdx]->shall_decode_cached_frame = 1;
                        break;
                    }
                    /* The first required frame is not the first frame, so the cache is useless. Instead we decode & drop the previous frame*/
                    else
                    {
                        handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx - 1] = DEC_ACTION_DECODE_AND_DROP;
                        break;
                    }
                }
            }
        }
    }

    /* if a dec gets paused & caching is activated we need to flag the last useful LC3plus frame for caching */
    for ( decIdx = 0; decIdx < handle->num_decs; decIdx++ )
    {
        for ( ivasSubframeIdx = 0; ivasSubframeIdx < actual_num_spatial_subframes; ivasSubframeIdx++ )
        {
            if ( handle->selective_decoding_states[decIdx]->frame_actions[ivasSubframeIdx] == DEC_ACTION_SKIP && handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] != DEC_ACTION_DECODE_AND_USE )
            {
                handle->selective_decoding_states[decIdx]->frame_actions[actual_num_spatial_subframes - 1] = DEC_ACTION_CACHE;
            }
        }
    }

    return IVAS_ERR_OK;
}


/*-------------------------------------------------------------------------
 * ISAR_LC3PLUS_DEC_GetDelay()
 *
+0 −9
Original line number Diff line number Diff line
@@ -94,11 +94,6 @@ void ISAR_LC3PLUS_DEC_Close(
    ISAR_LC3PLUS_DEC_HANDLE *handle /* i/o: pointer to decoder handle                       */
);

/*! Sets a matrix[MAX_PARAM_SPATIAL_SUBFRAMES][numLC3plusDecoders] where all require subframes must be flagged with 1, frames that are not required with 0 */
ivas_error ISAR_LC3PLUS_DEC_SetSelectiveDecodingMatrix(
    ISAR_LC3PLUS_DEC_HANDLE handle,                             /* i  : decoder handle                                   */
    int16_t *subframeChannelMatrix[MAX_PARAM_SPATIAL_SUBFRAMES] /* i  : */
);

ivas_error ISAR_LC3PLUS_DEC_Decode(
    ISAR_LC3PLUS_DEC_HANDLE handle,  /* i  : decoder handle                                 */
@@ -112,10 +107,6 @@ ivas_error ISAR_LC3PLUS_DEC_Conceal(
    float **pcm_out                 /* o  : concealed samples                               */
);

ivas_error ISAR_LC3PLUS_DEC_AllocateSubframeDecodingMatrix(
    int16_t ***subframeChannelMatrix,
    const uint32_t num_decs );

#endif

#endif /* IVAS_LC3PLUS_DEC_H */
Loading