Commit d8d8952b authored by norvell's avatar norvell
Browse files

Small fix for NONBE_1300_TDREND_JBM_SHORT_FRAMES

parent da879d57
Loading
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -467,16 +467,18 @@ ivas_error TDREND_GetMix(
                                                            Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p );
#ifdef NONBE_1300_TDREND_JBM_SHORT_FRAMES
            /* For short subframes triggered by JBM, ensure interpolation and ITD transition fits within subframe */
            intp_count = min( intp_count, subframe_length );
            currShift = abs( Src_p->itd );
            prevShift = abs( Src_p->previtd );
            if ( Src_p->itd * Src_p->previtd < 0 )
            {
                currShift = (int16_t) abs( Src_p->itd );
                prevShift = (int16_t) abs( Src_p->previtd );
                transition_len = subframe_length - max( 0, SFX_SPAT_BIN_SINC_M - currShift );
                length_in2 = transition_len - (int16_t) ( ( (float) ( transition_len * prevShift ) / ( (float) ( prevShift + currShift ) ) ) + 0.5f ) - currShift;
            if ( Src_p->itd * Src_p->previtd < 0 && length_in2 <= 0 )
                if ( length_in2 <= 0 )
                {
                    /* Subframe too short for ITD transition -- change to ITD=0 and push the rest of the transition to next subframe */
                    Src_p->itd = 0;
                }
            }
#endif
        }