Commit a923f84b authored by Ripinder Singh's avatar Ripinder Singh
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 1b307622
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@
#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_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
@@ -641,7 +641,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;
        }
@@ -707,7 +711,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
@@ -771,7 +779,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 )
            {