Commit c096e49a authored by multrus's avatar multrus Committed by Arthur Tritthart
Browse files

fix issue 2257 (includes MR2695) using more fix and dynamic headroom for complex FFT10

parent 96ae0d1c
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1642,8 +1642,12 @@ int main(

    ObjectPositionBuffer mtdBuffer;
    outBuffer.pq_fact = &outBuffer.q_factor;
#ifdef FIX_2257_INCR_GUARD_BITS
    Word16 gd_bits = find_guard_bits( frameSize_smpls );
#else
    Word16 subframe_len = (Word16) ( args.sampleRate / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) );
    Word16 gd_bits = find_guard_bits( subframe_len );
#endif
    Word16 prev_q_fact = Q11;
    while ( 1 )
    {

lib_com/fft_cldfb_fx.c

100644 → 100755
+24 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
   contributions.

   This software is provided "AS IS", without any express or implied warranties. The software is in the
   development stage. It is intended exclusively for experts who have experience with such software and
   development stage. It is int exclusively for experts who have experience with such software and
   solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
   and fitness for a particular purpose are hereby disclaimed and excluded.

@@ -257,6 +257,17 @@ static void fft10_with_cmplx_data( cmplx *inp_data /*Qx*/ )
    cmplx x0, x1, x2, x3, x4, t;
    cmplx y[10];

#ifdef FIX_ISSUE_2257_ADD_HEADROOM_IN_FFT10
    Word16 headroom = L_norm_arr( (Word32 *) inp_data, 2 * 10 );
    Word16 headroom_fix = ( headroom < 5 /* SCALEFACTOR10 */ ) ? ( 5 /* SCALEFACTOR10 */ - headroom ) : 0;
    if ( headroom_fix != 0 )
    {
        for ( Word16 i = 0; i < 10; i++ )
        {
            inp_data[i] = CL_shr( inp_data[i], headroom_fix );
        }
    }
#endif
    /* FOR i=0 */
    {
        x0 = CL_shr( inp_data[0], SCALEFACTOR10 );
@@ -343,6 +354,17 @@ static void fft10_with_cmplx_data( cmplx *inp_data /*Qx*/ )
#ifdef WMOPS
    multiCounter[currCounter].CL_move += 10;
#endif

#ifdef FIX_ISSUE_2257_ADD_HEADROOM_IN_FFT10
    if ( headroom_fix != 0 )
    {
        for (Word16 i = 0; i < 10; i++)
        {
            /* We want to get assertion in case of overflow, no saturation */
            inp_data[i] = CL_shl(inp_data[i], headroom_fix);
        }
    }
#endif
}

/**
@@ -1004,6 +1026,7 @@ static void fft30_with_cmplx_data( cmplx *inp /*Qx*/ )
#ifdef WMOPS
    multiCounter[currCounter].CL_move += 30;
#endif

}

/*-------------------------------------------------------------------*
+3 −0
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@
#define FIX_1466_EXTREND                                /* FhG: float issue 1466: enable rendering of mono/stereo to other formats in the external renderer */
#define FIX_1381_BWD                                    /* VA: issue 1381: apply no hysteresis in BWD at higher bitrates also in mono MASA and OMASA */
#define FIX_2285_CODE_DECODER_INIT_BW                   /* VA: basop issue 2285: fix core-decoder initialization bandwidth */
#define FIX_2257_INCR_GUARD_BITS                        /* FhG: take correct rendering frame-size into account for guard-bits calculation */
#define FIX_ISSUE_2257_INCREASE_GUARD_BITS              /* FhG: (tri) adds +1 to result of find_guard_bits of len=320: 9 -> 10 */
#define FIX_ISSUE_2257_ADD_HEADROOM_IN_FFT10            /* FhG: (tri) optional scale-down at entry and scale-up at end of FFT10, if headroom too small */

/* ##################### End NON-BE switches ########################### */

lib_rend/lib_rend_fx.c

100644 → 100755
+5 −0
Original line number Diff line number Diff line
@@ -7216,7 +7216,12 @@ static void renderIsmToMasa(
        q_min = s_min( q_min, L_norm_arr( tmpRendBuffer_fx[i], ismInput->base.inputBuffer.config.numSamplesPerChannel ) );
    }

#ifdef FIX_ISSUE_2257_INCREASE_GUARD_BITS
    guard_bits = add( 1, find_guarded_bits_fx( ismInput->base.inputBuffer.config.numSamplesPerChannel ) );
#else
    guard_bits = find_guarded_bits_fx( ismInput->base.inputBuffer.config.numSamplesPerChannel );
#endif

    q_min = sub( add( q_min, *outAudio.pq_fact ), guard_bits );
    q_diff = sub( q_min, *outAudio.pq_fact );