Commit a32d12c8 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

add rescaling

parent f7134a5e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@
#define FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE  /* VA: Precision improvement without increasing complexity, or complexity reduction that might be not BE on the LSB */
#define FIX_2252_LP_CNG_STARTS_SID                      /* VA: issues 2251 and 2252: fix LP CNG uninitialized value in bitstream that starts with an SID */
#define FIX_2283_ISM_MD_DELAY                           /* Dolby: Fix ISM metadata delay round-off */
//#define FIX_2283_Q_CLDFB                                /* FhG: Fix Q format issue in CLDFB */
#define FIX_2283_Q_CLDFB                                /* FhG: Fix Q format issue in CLDFB */

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

+22 −11
Original line number Diff line number Diff line
@@ -7009,7 +7009,6 @@ static ivas_error renderIsmToSba(
    return error;
}


static ivas_error renderIsmToSplitBinaural(
    input_ism *ismInput,
    const IVAS_REND_AudioBuffer outAudio )
@@ -7123,22 +7122,26 @@ static ivas_error renderIsmToSplitBinaural(
            {
                FOR( slot_idx = 0; slot_idx < IVAS_CLDFB_NO_COL_MAX; slot_idx++ )
                {
#ifdef FIX_2283_Q_CLDFB

                    cldfbAnalysis_ts_fx_fixed_q( &tmpProcessing[ch][num_bands * slot_idx],
                                                 &tmpBinaural_CldfbRe[BINAURAL_CHANNELS * pos_idx + ch][slot_idx][0],
                                                 &tmpBinaural_CldfbIm[BINAURAL_CHANNELS * pos_idx + ch][slot_idx][0],
                                                 num_bands,
                                                 ismInput->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna[pos_idx + ch],
                                                 &q_cldfb );
                    q_cldfb = exp;
#else
                    cldfbAnalysis_ts_fx( &tmpProcessing[ch][num_bands * slot_idx],
                                         &tmpBinaural_CldfbRe[BINAURAL_CHANNELS * pos_idx + ch][slot_idx][0],
                                         &tmpBinaural_CldfbIm[BINAURAL_CHANNELS * pos_idx + ch][slot_idx][0],
                                         num_bands,
                                         ismInput->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna[pos_idx + ch],
                                         &q_cldfb );
#ifdef FIX_2283_Q_CLDFB
                    /*scale re and im according to exp-q_cldfb*/
                    {
                        Word32 *realBuffer_fx = &tmpBinaural_CldfbRe[BINAURAL_CHANNELS * pos_idx + ch][slot_idx][0];
                        Word32 *imagBuffer_fx = &tmpBinaural_CldfbIm[BINAURAL_CHANNELS * pos_idx + ch][slot_idx][0];
                        Word16 noChannels = ismInput->base.ctx.pSplitRendWrapper->hCldfbHandles->cldfbAna[pos_idx + ch]->no_channels;

                        FOR( int i = 0; i < noChannels; i++ )
                        {
                            realBuffer_fx[i] = L_shl( realBuffer_fx[i], sub( exp, q_cldfb ) -1 ); /*Q(exp)*/
                            imagBuffer_fx[i] = L_shl( imagBuffer_fx[i], sub( exp, q_cldfb ) -1  ); /*Q(exp)*/
                        }
                        q_cldfb = exp;
                    }
#endif
                }
            }
@@ -7162,6 +7165,7 @@ static ivas_error renderIsmToSplitBinaural(
        Copy_Quat_fx( &originalHeadRot[i], &pCombinedOrientationData->Quaternions[i] );
    }

#ifndef FIX_2283_Q_CLDFB_
    if ( outAudio.config.is_cldfb )
    {
        accumulateCLDFBArrayToBuffer_fx( tmpBinaural_CldfbRe, tmpBinaural_CldfbIm, &outAudio );
@@ -7170,6 +7174,13 @@ static ivas_error renderIsmToSplitBinaural(
    {
        accumulate2dArrayToBuffer_fx( tmpBinaural, &outAudio );
    }
#else
    IF ( !outAudio.config.is_cldfb )
    {
        accumulate2dArrayToBuffer_fx( tmpBinaural, &outAudio );
    }
#endif

    pop_wmops();

    /* Encoding to split rendering bitstream done at a higher level */