Commit 09e18546 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] IVAS LC3plus unit test; add new helper function to translate integer...

[fix] IVAS LC3plus unit test; add new helper function to translate integer framesize to newly introduced enum
parent 28ef3528
Loading
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -57,6 +57,13 @@ ivas_error ISAR_LC3PLUS_LC3plusErrToIvasErr(
    return IVAS_ERR_INTERNAL;
}


/*-----------------------------------------------------------------------------------------*
 * Function IVAS_LC3PLUS_LC3plusRtpErrToIvasErr()
 *
 *
 *-----------------------------------------------------------------------------------------*/

ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr(
    const LC3PLUS_RTP_ERR lc3PlusRtpError )
{
@@ -85,3 +92,33 @@ ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr(

    return IVAS_ERR_UNKNOWN;
}

/*-----------------------------------------------------------------------------------------*
 * Function IVAS_LC3PLUS_UsToLC3plusFrameDuration()
 *
 *
 *-----------------------------------------------------------------------------------------*/

LC3PLUS_FrameDuration IVAS_LC3PLUS_UsToLC3plusFrameDuration(
    const int16_t lc3PlusFrameDurationUs )
{
    switch ( lc3PlusFrameDurationUs )
    {
#ifdef CR9_C_ADD_1p25MS /* TODO LC3plus: verify switch stripping on update */
        case 1250:
            return LC3PLUS_FRAME_DURATION_1p25MS;
#endif
        case 2500:
            return LC3PLUS_FRAME_DURATION_2p5MS;
        case 5000:
            return LC3PLUS_FRAME_DURATION_5MS;
        case 7500:
            return LC3PLUS_FRAME_DURATION_7p5MS;
        case 10000:
            return LC3PLUS_FRAME_DURATION_10MS;
        default:
            break;
    }

    return LC3PLUS_FRAME_DURATION_UNDEFINED;
}
+4 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ typedef struct LC3PLUS_CONFIG
{
    /*! frame duration in microseconds [10000, 5000, 2500] */
    int16_t lc3plus_frame_duration_us;
    /*! isar frame duration in microseconds [20000, 10000, 5000] */
    /*! ISAR frame duration in microseconds [20000, 10000, 5000] */
    int16_t isar_frame_duration_us;
    /*! sampling rate*/
    int32_t samplerate;
@@ -61,4 +61,7 @@ ivas_error ISAR_LC3PLUS_LC3plusErrToIvasErr( const LC3PLUS_Error lc3PlusError );
/*! utility function to convert LC3PLUS_Errors to the suitable ivas_error */
ivas_error IVAS_LC3PLUS_LC3plusRtpErrToIvasErr( const LC3PLUS_RTP_ERR lc3PlusRtpError );

/*! utility function to convert a value in microseconds to an LC3PLUS_FrameDuration */
LC3PLUS_FrameDuration IVAS_LC3PLUS_UsToLC3plusFrameDuration( const int16_t lc3PlusFrameDuration );

#endif /* ISAR_LC3PLUS_COM_H */
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ ivas_error ISAR_LC3PLUS_DEC_Open(
            return IVAS_ERROR( ISAR_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_dec_init failed\n" );
        }

        err = lc3plus_dec_set_frame_dms( ( *handle )->handles[iCh], config.lc3plus_frame_duration_us / 100 );
        err = lc3plus_dec_set_frame_dms( ( *handle )->handles[iCh], IVAS_LC3PLUS_UsToLC3plusFrameDuration( config.lc3plus_frame_duration_us ) );
        if ( LC3PLUS_OK != err )
        {
            ISAR_LC3PLUS_DEC_Close( handle );
+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ ivas_error ISAR_LC3PLUS_ENC_Open(
            return IVAS_ERROR( ISAR_LC3PLUS_LC3plusErrToIvasErr( err ), "lc3plus_enc_init failed\n" );
        }

        err = lc3plus_enc_set_frame_dms( ( *handle )->handles[iCh], config.lc3plus_frame_duration_us / 100 );
        err = lc3plus_enc_set_frame_dms( ( *handle )->handles[iCh], IVAS_LC3PLUS_UsToLC3plusFrameDuration( config.lc3plus_frame_duration_us ) );
        if ( err != LC3PLUS_OK )
        {
            ISAR_LC3PLUS_ENC_Close( handle );
+0 −10
Original line number Diff line number Diff line

DisableFormat: true
SortIncludes: Never

DisableFormat: true
SortIncludes: Never

DisableFormat: true
SortIncludes: Never

DisableFormat: true
SortIncludes: Never