Commit b99e0981 authored by bayers's avatar bayers
Browse files

amend fix for 808, fix DirAC CNA/CNG with unified channel mem

parent aa81c4b9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3695,6 +3695,9 @@ void generate_masking_noise_lb_dirac(
    HANDLE_FD_CNG_COM hFdCngCom,                                /* i/o: FD_CNG structure containing all buffers and variables */
    float *tdBuffer,                                            /* i/o: time-domain signal, if NULL no LB-CNA                 */
    const int16_t nCldfbTs,                                     /* i  : number of CLDFB slots that will be rendered           */
#ifdef UNIFY_CHANNEL_MEM_HEAP
    const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom,
#endif
    const int16_t cna_flag                                      /* i  : CNA flag for LB and HB                                */
);

+29 −1
Original line number Diff line number Diff line
@@ -1804,6 +1804,9 @@ void generate_masking_noise_lb_dirac(
    HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */
    float *tdBuffer,             /* i/o: time-domain signal, if NULL no LB-CNA                 */
    const int16_t nCldfbTs,      /* i  : number of CLDFB slots that will be rendered           */
#ifdef UNIFY_CHANNEL_MEM_HEAP
    const SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i  : common spatial parameter rendering handle */
#endif
    const int16_t cna_flag /* i  : CNA flag for LB and HB                                */
)
{
@@ -1940,6 +1943,31 @@ void generate_masking_noise_lb_dirac(
            n_samples_start += hFdCngCom->frameSize;
        }
    }
#ifdef UNIFY_CHANNEL_MEM_HEAP
    /* move to the real subframe start to avoid overwriting the LB signal */
    {
        int16_t slot_size_lb, slot_size_fb, move_size;
        int16_t n_samples_out_start_fb;
        int16_t n_samples_out_start_lb;
        slot_size_lb = hFdCngCom->frameSize / DEFAULT_JBM_CLDFB_TIMESLOTS;
        slot_size_fb = hSpatParamRendCom->slot_size;
        /* move from last to first subframe */
        n_samples_out_start_lb = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->subframe_nbslots[hSpatParamRendCom->nb_subframes - 1] ) * slot_size_lb;
        n_samples_out_start_fb = ( hSpatParamRendCom->num_slots - hSpatParamRendCom->subframe_nbslots[hSpatParamRendCom->nb_subframes - 1] ) * slot_size_fb;

        for ( i = hSpatParamRendCom->nb_subframes - 1; i > 0; i-- )
        {
            move_size = hSpatParamRendCom->subframe_nbslots[i] * slot_size_lb;
            mvr2r( &tdBuffer[n_samples_out_start_lb], &tdBuffer[n_samples_out_start_fb], move_size );
            n_samples_out_start_lb -= hSpatParamRendCom->subframe_nbslots[i] * slot_size_lb;
            n_samples_out_start_fb -= hSpatParamRendCom->subframe_nbslots[i] * slot_size_fb;
        }
#ifdef DEBUGGING
        assert( n_samples_out_start_fb == 0 );
        assert( n_samples_out_start_lb == 0 );
#endif
    }
#endif

    pop_wmops();

+12 −0
Original line number Diff line number Diff line
@@ -1630,7 +1630,11 @@ void ivas_dirac_dec(
    {
        Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0];
        st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0];
#ifdef UNIFY_CHANNEL_MEM_HEAP
        generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], DEFAULT_JBM_CLDFB_TIMESLOTS, st_ivas->hSpatParamRendCom, st->cna_dirac_flag && st->flag_cna );
#else
        generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna );
#endif
    }

    ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS );
@@ -2060,10 +2064,18 @@ void ivas_dirac_dec_render_sf(

            generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom,
                                          st_ivas->cldfbAnaDec[1],
#ifdef UNIFY_CHANNEL_MEM_HEAP
                                          &st_ivas->hTcBuffer->tc[1][slot_idx_start * hSpatParamRendCom->num_freq_bands],
#else
                                          st_ivas->hTcBuffer->tc[1],
#endif
                                          Cldfb_RealBuffer[1][0],
                                          Cldfb_ImagBuffer[1][0],
#ifndef UNIFY_CHANNEL_MEM_HEAP
                                          index_slot,
#else
                                          slot_idx,
#endif
                                          st->cna_dirac_flag && st->flag_cna,
                                          ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_sba_flag );
        }
+1 −0
Original line number Diff line number Diff line
@@ -1368,6 +1368,7 @@ static ivas_error ivas_mc_dec_reconfig(
        else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX )
        {
            tc_nchan_allocate_new = MC_PARAMUPMIX_MAX_INPUT_CHANS;
            tc_buffer_mode_new = TC_BUFFER_MODE_RENDERER;
            if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO )
            {
                tc_buffer_mode_new = TC_BUFFER_MODE_BUFFER;
+4 −0
Original line number Diff line number Diff line
@@ -878,7 +878,11 @@ ivas_error ivas_sba_dec_digest_tc(
#endif
    {
        Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0];
#ifdef UNIFY_CHANNEL_MEM_HEAP
        generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st_ivas->hSpatParamRendCom, st->cna_dirac_flag && st->flag_cna );
#else
        generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st->cna_dirac_flag && st->flag_cna );
#endif
    }

    return error;
Loading