Commit 94924175 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fix for DirAC SPAR band mapping at encoder side

parent 1b190fcd
Loading
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -424,7 +424,6 @@ static void ivas_band_mixing(
            }
        }
    }

    return;
}

@@ -492,6 +491,9 @@ ivas_error ivas_spar_md_enc_process(
    int16_t md_indices_allocated;
    int16_t max_num_indices_tmp;
    float Wscale[IVAS_MAX_NUM_BANDS];
#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
    float P_quant_re_prior[SPAR_DIRAC_SPLIT_START_BAND / 2][FOA_CHANNELS - 1];
#endif

    /*extra 16 bits for arithmetic coder as overshoot check is after a symbol is written*/
    md_indices_allocated = hMdEnc->spar_md_cfg.max_bits_per_blk + IVAS_SPAR_ARITH_OVERSHOOT_BITS;
@@ -588,6 +590,16 @@ ivas_error ivas_spar_md_enc_process(
        }
    }

#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
    if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 )
    {
        for ( b = 0; b < num_bands; b++ )
        {
            mvr2r( hMdEnc->spar_md.band_coeffs[b].P_quant_re, P_quant_re_prior[b], FOA_CHANNELS - 1 );
        }
    }
#endif

    ivas_compute_spar_params( cov_real, dm_fv_re, 0, hMdEnc->mixer_mat, 0, nB, dtx_vad, num_ch, bands_bw, active_w, active_w_vlbr, &hMdEnc->spar_md_cfg, &hMdEnc->spar_md, Wscale, 0, dyn_active_w_flag );

    if ( dirac_mono_flag )
@@ -854,6 +866,18 @@ ivas_error ivas_spar_md_enc_process(
#endif

    /* Reuse mixer matrix values for unsent bands */
#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
    if ( hEncoderConfig->ivas_total_brate < IVAS_24k4 )
    {
        for ( k = num_bands - 1; k >= 0; k-- )
        {
            for ( b = bands_bw - 1; b >= 0; b-- )
            {
                mvr2r( hMdEnc->spar_md.band_coeffs[k].P_quant_re, hMdEnc->spar_md.band_coeffs[bands_bw * k + b].P_quant_re, FOA_CHANNELS - 1 );
            }
        }
    }
#endif
    if ( ( hEncoderConfig->ivas_total_brate < IVAS_24k4 ) && ( code_strat > 3 ) )
    {
        for ( b = 0; b < num_bands * bands_bw; b += 2 * bands_bw )
@@ -870,6 +894,10 @@ ivas_error ivas_spar_md_enc_process(
                    hMdEnc->mixer_mat[i][j][b + 1] = prior_mixer[i][j][b + 1];
                }
            }
#ifdef NONBE_FIX_VLBR_DIRAC_BAND_MAPPING
            mvr2r( P_quant_re_prior[b], hMdEnc->spar_md.band_coeffs[b].P_quant_re, FOA_CHANNELS - 1 );
            mvr2r( P_quant_re_prior[b + 1], hMdEnc->spar_md.band_coeffs[b + 1].P_quant_re, FOA_CHANNELS - 1 );
#endif
        }
    }
#ifdef DEBUG_LBR_SBA