Commit 0c78e1a6 authored by Ripinder Singh's avatar Ripinder Singh Committed by emerit
Browse files

1527: Fix for incorrect bitrate idx reported in CMR requests



* The size tables for CMR should be restricted to allowed selection range

Signed-off-by: default avatarRipinder Singh <ripinder.singh@dolby.com>
parent 1cca5416
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -161,11 +161,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_BASOP_2469_OBJ_EDIT_TD_REND_GAIN            /* Eri: Basop issue 2469: TD renderer gain has wrong Q. In float this is just a synch of the cleanup done in BASOP */
#define FIX_ISSUE_1546_DEAD_CODE                        /* FhG: remove dead code reported in the issue*/
#define FIX_FLOAT_1544_SBA_META_IMPRECISION_UNSAFE_MATH /* FhG: float issue 1544: imprecision in ivas_get_dirac_sba_max_md_bits() with -funsafe-math-optimizations */
#define FIX_FLOAT_1544_ITD_IMPRECISION_UNSAFE_MATH      /* FhG: float issue 1544: Avoid assert() with -funsafe-math-optimizations in stereo_td_itd() */
#define FIX_FLOAT_1539_G192_FORMAT_SWITCH               /* Nokia: reintroduce format switching for g192 bitstreams */
#define FIX_1527_CMR_BITRATE_IDX                        /* Fix for incorrect bitrate idx packed in rtp CMR E-byte */

/* #################### End BE switches ################################## */

+12 −0
Original line number Diff line number Diff line
@@ -658,7 +658,11 @@ static uint32_t getBitrateIdx( const uint32_t *table, uint32_t tableLen, uint32_

    for ( n = 0; n < tableLen; n++ )
    {
#ifdef FIX_1527_CMR_BITRATE_IDX
        if ( bitrate >= ( table[n] * IVAS_NUM_FRAMES_PER_SEC ) )
#else
        if ( bitrate > ( table[n] * IVAS_NUM_FRAMES_PER_SEC ) )
#endif
        {
            idx = n;
        }
@@ -724,7 +728,11 @@ static void packEBytes(
            /* EVS Modes */
            bitrate = ( bitrate > 128000 ) ? 128000 : bitrate;
            bitrate = ( bitrate < 5900 ) ? 5900 : bitrate;
#ifdef FIX_1527_CMR_BITRATE_IDX
            bitrateIdx = getBitrateIdx( evsFrameSizeInBits, ( sizeof( evsFrameSizeInBits ) / sizeof( evsFrameSizeInBits[0] ) ) - 1, bitrate );
#else
            bitrateIdx = getBitrateIdx( evsFrameSizeInBits, sizeof( evsFrameSizeInBits ) / sizeof( evsFrameSizeInBits[0] ), bitrate );
#endif
            BR = (uint8_t) bitrateIdx & MASK_4BIT;

            /* If a bandwidth choice cannot be signalled for a given bitrate
@@ -788,7 +796,11 @@ static void packEBytes(
            /* Initial E-Byte */
            bitrate = ( bitrate > 512000 ) ? 512000 : bitrate;
            bitrate = ( bitrate < 13200 ) ? 13200 : bitrate;
#ifdef FIX_1527_CMR_BITRATE_IDX
            bitrateIdx = getBitrateIdx( ivasFrameSizeInBits, ( sizeof( ivasFrameSizeInBits ) / sizeof( ivasFrameSizeInBits[0] ) ) - 2, bitrate );
#else
            bitrateIdx = getBitrateIdx( ivasFrameSizeInBits, sizeof( ivasFrameSizeInBits ) / sizeof( ivasFrameSizeInBits[0] ), bitrate );
#endif
            BR = (uint8_t) bitrateIdx & MASK_4BIT;
            if ( nByte < maxNumEBytes )
            {