Commit 40566c22 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[cleanup] validation fixes and some cleanup

parent 2cde9e6b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ static
#define MAX_NUM_OUTPUT_CHANNELS    16
#define MAX_OUTPUT_PCM_BUFFER_SIZE ( MAX_NUM_OUTPUT_CHANNELS * MAX_FRAME_SIZE )
#ifdef SPLIT_REND_WITH_HEAD_ROT
#define MAX_SPLIT_REND_BITRATE                   ( 1792000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ?*/
#define MAX_SPLIT_REND_BITRATE                   ( 768000 ) /* TODO tmu: unify with SPLIT_REND_MAX_BRATE ? */
#define MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES ( ( ( (int32_t) MAX_SPLIT_REND_BITRATE / NUM_FRAMES_PER_SEC ) + 7 ) >> 3 )
#endif
#define IVAS_PUBLIC_ORIENT_TRK_NONE        ( 0 )
+1 −1
Original line number Diff line number Diff line
@@ -1542,7 +1542,7 @@ typedef enum

#define SPLIT_REND_MAX_DOF                      (3)

#define MAX_HEAD_ROT_POSES                      (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES) /* TODO tmu : revisit for harmonization */
#define MAX_HEAD_ROT_POSES                      (2 + SPLIT_REND_MAX_YAW_ONLY_POSES + SPLIT_REND_MAX_PITCH_ONLY_POSES + SPLIT_REND_MAX_ROLL_ONLY_POSES)
#define MAX_SPLIT_REND_MD_BANDS                 (20)
#define MAX_SPLIT_MD_SUBFRAMES                  (1)
#define COMPLEX_MD_BAND_THRESH                  (MAX_SPLIT_REND_MD_BANDS)
+14 −11
Original line number Diff line number Diff line
@@ -844,7 +844,7 @@ ivas_error ivas_dec(
        max_band = (int16_t) ( ( BINAURAL_MAXBANDS * output_Fs ) / 48000 );
        pcm_out = ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;

        ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend,
        if ( ( error = ivas_renderMultiBinToSplitBinaural( &hSplitBinRend->splitrend,
                                                           st_ivas->hHeadTrackData->Quaternions,
                                                           st_ivas->hRenderConfig->split_rend_config.splitRendBitRate,
                                                           st_ivas->hRenderConfig->split_rend_config.codec,
@@ -857,7 +857,10 @@ ivas_error ivas_dec(
#else
                                                           st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV,
#endif
                                            pcm_out );
                                                           pcm_out ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        free( st_ivas->splitBinRend.hMultiBinCldfbData );
    }
+7 −7
Original line number Diff line number Diff line
@@ -1900,7 +1900,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,
{
    ivas_error error, ch, num_ch;
    CLDFB_TYPE cldfbMode;
    uint8_t useLc3plus;
    uint8_t isCldfbNeeded = 0;
    cldfbMode = CLDFB_ANALYSIS;

@@ -1909,7 +1908,6 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,
        return error;
    }

    useLc3plus = pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS; /* TODO(sgi): change "useLc3plus" to "splitCodec" */
    error = IVAS_ERR_OK;

    if ( is_cldfb_in == 0 )
@@ -1972,9 +1970,9 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,

    if ( is_pcm_out == 0 )
    {
        if ( !useLc3plus )
        if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS )
        {
            error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) );
            error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate );
            if ( error != IVAS_ERR_OK )
            {
                return error;
@@ -1982,7 +1980,7 @@ ivas_error ivas_split_renderer_open( SPLIT_REND_WRAPPER *hSplitRendWrapper,
        }
        else
        {
            error = split_renderer_open_lc3plus( hSplitRendWrapper, pSplitRendConfig, OutSampleRate );
            error = ivas_splitBinLCLDEncOpen( &hSplitRendWrapper->hSplitBinLCLDEnc, OutSampleRate, BINAURAL_CHANNELS, ivas_get_lcld_bitrate( pSplitRendConfig->splitRendBitRate, hSplitRendWrapper->multiBinPoseData.poseCorrectionMode ) );
            if ( error != IVAS_ERR_OK )
            {
                return error;
@@ -2193,7 +2191,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
    if ( pcm_out == 0 )
    {
        pBits->pose_correction = hSplitBin->multiBinPoseData.poseCorrectionMode;
        pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD; /* TODO(sgi): useLc3plus could be changed to splitCodec */
        pBits->codec = useLc3plus ? IVAS_SPLIT_REND_CODEC_LC3PLUS : IVAS_SPLIT_REND_CODEC_LCLD;
        if ( !useLc3plus )
        {
            // available_bits = ivas_get_lcld_bitrate( SplitRendBitRate ) * L_FRAME48k / 48000;
@@ -2312,7 +2310,9 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
        set_pose_types( hSplitBin->hBinHrSplitPreRend->pose_type, &hSplitBin->multiBinPoseData );
    }

    /*TODO : why should this be called during run time ?*/
    /* Needs to be done at runtime. If this was in another API function,
     * there would be no guarantee that the user did not change
     * the split rendering config before calling the main rendering function */
    ivas_split_rend_choose_default_codec( &splitCodec, td_input, pcm_out );

    if ( td_input )
+30 −7
Original line number Diff line number Diff line
@@ -539,7 +539,8 @@ int32_t ivas_get_lc3plus_size_from_id( const int8_t SplitRendBitRateId, IVAS_SPL
        }
        default:
        {
            return -1;
            bitrate = -1;
            break;
        }
    }

@@ -563,22 +564,44 @@ ivas_error ivas_split_rend_validate_config( const IVAS_SPLIT_REND_CONFIG_DATA *p
        return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Only CLDFB pose correction supports HQ mode" );
    }

    /* Split rendering with no pose correction - 0 DOF and pose correction NONE must only ever be set together */
    if ( ( pSplitRendConfig->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE && pSplitRendConfig->dof != 0 ) ||
         ( pSplitRendConfig->poseCorrectionMode != IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE && pSplitRendConfig->dof == 0 ) )
    {
        return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "0 DOF and pose correction NONE must only ever be set together" );
    }

    /* Validate bitrate */
    if ( is_pcm_out == 0 )
    {
        switch ( pSplitRendConfig->splitRendBitRate )
        {
            case SPLIT_REND_384k:
            case SPLIT_REND_512k:
            case SPLIT_REND_768k:
                /* Always valid */
                break;
            case SPLIT_REND_256k:
                if ( pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LCLD )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Unsupported bitrate for LCLD codec" );
                }

                if ( pSplitRendConfig->dof != 0 )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrates of 320 kbps and lower are only valid with 0 DOF" );
                }
                break;
            case SPLIT_REND_320k:
                /* Only valid with 0 DOF */
                if ( pSplitRendConfig->dof != 0 )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "bitrates below 320 kpbs are only valid with 0 DOF" );
                    return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrates of 320 kbps and lower are only valid with 0 DOF" );
                }
                break;
            case SPLIT_REND_384k:
            case SPLIT_REND_512k:
                /* Always valid */
                break;
            case SPLIT_REND_768k:
                if ( pSplitRendConfig->dof == 0 && pSplitRendConfig->codec == IVAS_SPLIT_REND_CODEC_LC3PLUS )
                {
                    return IVAS_ERROR( IVAS_ERR_INVALID_SPLIT_REND_CONFIG, "Bitrate is too high for LC3plus with 0 DOF" );
                }
                break;
            default:
Loading