Commit d38e1e40 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] preserve BE: previous gains needed to be set on first frame

parent 8757e52e
Loading
Loading
Loading
Loading
+50 −18
Original line number Diff line number Diff line
@@ -6293,6 +6293,15 @@ static ivas_error renderIsmToBinauralRoom(
    position_changed = !ismInput->firstFrameRendered ||
                       checkObjectPositionChanged( &rotatedPos, &rotatedPosPrev );

    /* set previous gains if this is the first frame */
    if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper,
                                 rotatedPosPrev.azimuth,
                                 rotatedPosPrev.elevation,
                                 ismInput->prev_pan_gains ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    /* compute gains only if position changed */
    if ( position_changed )
    {
@@ -6483,15 +6492,26 @@ static ivas_error renderIsmToMc(
            }
#ifdef FIX_518_ISM_BRIR_EXTREND
        }
#else

        /* set previous gains if this is the first frame */
        if ( !ismInput->firstFrameRendered )
        {
#endif
            // TODO tmu review when #215 is resolved
            if ( ( error = getEfapGains( *ismInput->base.ctx.pEfapOutWrapper,
                                         (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ),
                                         (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ),
                                     previousPanGains ) ) != IVAS_ERR_OK )
#ifdef FIX_518_ISM_BRIR_EXTREND
                                         ismInput->prev_pan_gains
#else
                                     previousPanGains
#endif
                                         ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#ifdef FIX_518_ISM_BRIR_EXTREND
        }
#endif
    }

@@ -6552,12 +6572,30 @@ static ivas_error renderIsmToSba(
        return error;
    }

#ifndef FIX_518_ISM_BRIR_EXTREND
#ifdef FIX_518_ISM_BRIR_EXTREND
    position_changed = !ismInput->firstFrameRendered ||
                       checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos );

    /* set previous gains if this is the first frame */
    if ( !ismInput->firstFrameRendered )
    {
#endif
        // TODO tmu review when #215 is resolved
        ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->previousPos.azimuth + 0.5f ),
                                     (int16_t) floorf( ismInput->previousPos.elevation + 0.5f ),
#ifdef FIX_518_ISM_BRIR_EXTREND
                                     ismInput->prev_pan_gains,
#else
                                 previousPanGains,
#endif
                                     ambiOrderOut );
#ifdef FIX_518_ISM_BRIR_EXTREND
    }

    /* compute gains only if position changed */
    if ( position_changed )
    {
#else

    if ( ( ismInput->currentPos.azimuth == ismInput->previousPos.azimuth ) &&
         ( ismInput->currentPos.elevation == ismInput->previousPos.elevation ) )
@@ -6566,12 +6604,6 @@ static ivas_error renderIsmToSba(
    }
    else
    {
#else
    position_changed = !ismInput->firstFrameRendered ||
                       checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos );

    if ( position_changed )
    {
#endif
        // TODO tmu review when #215 is resolved
        ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ),