Commit bf3291e9 authored by reutelhuber's avatar reutelhuber
Browse files

Merge branch '121-dynamic-ram-consumption-in-sba-mc-encoder' into 'main'

Resolve "Dynamic RAM consumption in SBA/MC encoder"

See merge request !167
parents eac23d58 61431a53
Loading
Loading
Loading
Loading
Loading

lib_com/options.h

100644 → 100755
+1 −0
Original line number Diff line number Diff line
@@ -153,6 +153,7 @@
#define FIX_DIRAC_CHANNELS                              /* Issue 71: lower number of DirAC analysis channels */
#define FIX_CREND_CHANNELS                              /* Issue 71: fix number of Crend channels */
#define HARMONIZE_SBA_NCHAN_TRANSPORT                   /* harmonize setting of number of transport channels in SBA */
#define DRAM_REDUCTION_MCT_IGF                          /* Issue 121: reduce dynamic RAM consumption in MCT IGF */


/* ################## End DEVELOPMENT switches ######################### */

lib_com/prot.h

100644 → 100755
+9 −1
Original line number Diff line number Diff line
@@ -7396,7 +7396,11 @@ void ProcessStereoIGF(
    Encoder_State *sts[CPE_CHANNELS],            /* i  : Encoder state                           */
    int16_t ms_mask[2][MAX_SFB],                 /* i  : bandwise MS mask                        */
    float *pITFMDCTSpectrum[CPE_CHANNELS][2],    /* i  : MDCT spectrum fir ITF                   */
#ifdef DRAM_REDUCTION_MCT_IGF
    float *pPowerSpectrum[CPE_CHANNELS],         /* i/o: MDCT^2 + MDST^2 spectrum, or estimate   */
#else
    float pPowerSpectrum[CPE_CHANNELS][N_MAX],   /* i  : MDCT^2 + MDST^2 spectrum, or estimate   */
#endif
    float *pPowerSpectrumMsInv[CPE_CHANNELS][2], /* i  : inverse power spectrum                  */
    float *inv_spectrum[CPE_CHANNELS][2],        /* i  : inverse spectrum                        */
    const int16_t frameno,                       /* i  : flag indicating index of current subframe*/
@@ -9794,7 +9798,11 @@ void IGFEncApplyStereo(
    const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i  : instance handle of IGF Encoder              */
    const int16_t igfGridIdx,                            /* i  : IGF grid index                              */
    Encoder_State *sts[CPE_CHANNELS],                    /* i  : Encoder state                               */
#ifdef DRAM_REDUCTION_MCT_IGF
    float *pPowerSpectrum[CPE_CHANNELS],                 /* i/o: MDCT^2 + MDST^2 spectrum, or estimate       */
#else
    float pPowerSpectrum[CPE_CHANNELS][N_MAX],           /* i/o: MDCT^2 + MDST^2 spectrum, or estimate       */
#endif
    float *pPowerSpectrumMsInv[CPE_CHANNELS][2],         /* i/o: inverse power spectrum                      */
    float *inv_spectrum[CPE_CHANNELS][2],                /* i  : inverse spectrum                            */
    const int16_t frameno,                               /* i  : flag indicating index of current subframe   */

lib_enc/igf_enc.c

100644 → 100755
+5 −1
Original line number Diff line number Diff line
@@ -1852,7 +1852,11 @@ void IGFEncApplyStereo(
    const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i  : instance handle of IGF Encoder          */
    const int16_t igfGridIdx,                            /* i  : IGF grid index                          */
    Encoder_State *sts[CPE_CHANNELS],                    /* i  : Encoder state                           */
#ifdef DRAM_REDUCTION_MCT_IGF
    float *pPowerSpectrum[CPE_CHANNELS],                 /* i/o: MDCT^2 + MDST^2 spectrum, or estimate   */
#else
    float pPowerSpectrum[CPE_CHANNELS][N_MAX],           /* i/o: MDCT^2 + MDST^2 spectrum, or estimate   */
#endif
    float *pPowerSpectrumMsInv[CPE_CHANNELS][2],         /* i/o: inverse power spectrum                  */
    float *inv_spectrum[CPE_CHANNELS][2],                /* i  : inverse spectrum                        */
    const int16_t frameno,                               /* i  : flag indicating index of current subfr. */

lib_enc/ivas_mct_enc_mct.c

100644 → 100755
+9 −0
Original line number Diff line number Diff line
@@ -834,7 +834,11 @@ void mctStereoIGF_enc(
    float *p_powerSpecMsInv[CPE_CHANNELS][NB_DIV];
    float *p_inv_spectrum[CPE_CHANNELS][NB_DIV];
    float *p_orig_spectrum[CPE_CHANNELS][NB_DIV];
#ifdef DRAM_REDUCTION_MCT_IGF
    float *p_powerSpec[NB_DIV];
#else
    float p_powerSpec[NB_DIV][N_MAX];
#endif
    int16_t singleChEle[MCT_MAX_CHANNELS];

    L_subframeTCX = 0; /* to avoid compilation warning */
@@ -855,10 +859,15 @@ void mctStereoIGF_enc(
        p_st[0] = sts[ch1];
        p_st[1] = sts[ch2];

#ifdef DRAM_REDUCTION_MCT_IGF
        p_powerSpec[0] = powerSpec[ch1];
        p_powerSpec[1] = powerSpec[ch2];
#else
        mvr2r( powerSpec[ch1], p_powerSpec[0], L_FRAME48k );
        set_f( &p_powerSpec[0][L_FRAME48k], 0.f, N_MAX - L_FRAME48k );
        mvr2r( powerSpec[ch2], p_powerSpec[1], L_FRAME48k );
        set_f( &p_powerSpec[1][L_FRAME48k], 0.f, N_MAX - L_FRAME48k );
#endif

        /* Band-wise M/S for MDST */
        nSubframes = p_st[0]->hTcxEnc->tcxMode == TCX_20 ? 1 : NB_DIV;
+9 −0
Original line number Diff line number Diff line
@@ -129,6 +129,9 @@ void stereo_mdct_core_enc(
    float *p_orig_spectrum_long[CPE_CHANNELS], orig_spectrum_long[CPE_CHANNELS][N_MAX]; /* MDCT output (L/R). */
    float *orig_spectrum[CPE_CHANNELS][2];                                              /* Pointers to MDCT output for a short block (L/R) */
    float powerSpec[CPE_CHANNELS][N_MAX];
#ifdef DRAM_REDUCTION_MCT_IGF
    float *p_powerSpec[CPE_CHANNELS];
#endif
    float powerSpecMsInv_long[CPE_CHANNELS][N_MAX]; /* MS inv power spectrum, also inverse MDST spectrum */
    float *powerSpecMsInv[CPE_CHANNELS][2];
    float quantized_spectrum_long[CPE_CHANNELS][N_MAX]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */
@@ -351,7 +354,13 @@ void stereo_mdct_core_enc(
                       hStereoMdct->mdct_stereo_mode[n] == SMDCT_BW_MS ) &&
                     !hStereoMdct->isSBAStereoMode )
                {
#ifdef DRAM_REDUCTION_MCT_IGF
                    p_powerSpec[0] = powerSpec[0];
                    p_powerSpec[1] = powerSpec[1];
                    ProcessStereoIGF( hStereoMdct, sts, ms_mask, orig_spectrum, p_powerSpec, powerSpecMsInv, inv_spectrum, n, hCPE->hCoreCoder[0]->sp_aud_decision0, hCPE->hCoreCoder[0]->element_brate, 0 );
#else
                    ProcessStereoIGF( hStereoMdct, sts, ms_mask, orig_spectrum, powerSpec, powerSpecMsInv, inv_spectrum, n, hCPE->hCoreCoder[0]->sp_aud_decision0, hCPE->hCoreCoder[0]->element_brate, 0 );
#endif
                }
                else
                {
Loading