Commit 83ee1ffb authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch '1490_basop_cleanup' into 'main-pc'

Port 1490 to BASOP

See merge request !1426
parents 87e6dadf 83927371
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -93,9 +93,6 @@
#define FIX_1372_ISAR_POST_REND
#endif
#define NONBE_FIX_1058_DECODER_ERROR_WITH_REVERB_ROOM   /* FhG: issue 1058: do not initialize EFAP when IntSetup is HOA3 */
#define NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW           /* FhG: issue 943: fix crash in BW switchin from WB in MDCT-Stereo core encoder */
#define FIX_911_REMOVE_CREND_DUPLICATION                /* VA: issue 911: resolve duplication of CRend binaural external renderer function */
#define FIX_938_GCC_12_WARNINGS                         /* VA: issue #938: remove set_f(.,.,0) call in which length is always 0 to remove GCC 12.0 warning */
#define NONBE_FIX_944_FEC_OMASA_1SEP_OBJ_MASA                 /* Nokia: issue 944: fix FEC error in OMASA */

/* #################### End BASOP porting switches ############################ */
+0 −6
Original line number Diff line number Diff line
@@ -290,9 +290,6 @@ void transf_cdbk_enc_fx(
        x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow );
        move16();
    }
#ifndef FIX_938_GCC_12_WARNINGS
    set16_fx( x_tran + Nsv * WIDTH_BAND, 0, sub( L_SUBFR, i_mult2( WIDTH_BAND, Nsv ) ) );
#endif

    test();
    test();
@@ -645,9 +642,6 @@ void transf_cdbk_enc_ivas_fx(
        x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow );
        move16();
    }
#ifndef FIX_938_GCC_12_WARNINGS
    set16_fx( x_tran + Nsv * WIDTH_BAND, 0, sub( L_SUBFR, i_mult2( WIDTH_BAND, Nsv ) ) );
#endif

    test();
    test();
+0 −23
Original line number Diff line number Diff line
@@ -976,27 +976,6 @@ ivas_error ivas_cpe_enc_fx(
    /*----------------------------------------------------------------*
     * Core codec configuration
     *----------------------------------------------------------------*/
#ifndef NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW
    /* IGF reconfiguration */
    FOR( n = 0; n < n_CoreChannels; n++ )
    {
        test();
        test();
        test();
        test();
        test();
        test();
        IF( ( NE_32( hCPE->last_element_brate, hCPE->element_brate ) || NE_16( hCPE->element_mode, hCPE->last_element_mode ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( sts[0]->bits_frame_nominal, last_bits_frame_nominal ) ) || NE_16( sts[n]->last_bwidth, sts[n]->bwidth ) ) && ( n == 0 || EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) )
        {
            Word16 igf;
            igf = getIgfPresent_fx( sts[n]->element_mode, L_mult0( sts[n]->bits_frame_nominal, FRAMES_PER_SEC ), sts[n]->max_bwidth, sts[n]->rf_mode ); /* Q0 */
            IF( ( error = IGF_Reconfig_fx( &sts[n]->hIGFEnc, igf, 0, L_mult0( sts[n]->bits_frame_nominal, FRAMES_PER_SEC ), sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
    }
#endif

    test();
    IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && st_ivas->hMCT == NULL )
@@ -1028,7 +1007,6 @@ ivas_error ivas_cpe_enc_fx(
        }
    }

#ifdef NONBE_FIX_943_RECONFIG_IGF_AFTER_SETTING_BW
    /* IGF reconfiguration */
    FOR( n = 0; n < n_CoreChannels; n++ )
    {
@@ -1048,7 +1026,6 @@ ivas_error ivas_cpe_enc_fx(
            }
        }
    }
#endif

    /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */
    FOR( n = 0; n < n_CoreChannels; n++ )
+0 −189
Original line number Diff line number Diff line
@@ -1426,11 +1426,9 @@ ivas_error ivas_rend_initCrendWrapper(
    ( *pCrend )->binaural_latency_ns = 0;
    move32();
    ( *pCrend )->hHrtfCrend = NULL;
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
    ( *pCrend )->io_qfactor = 0;
    move16();
    ( *pCrend )->p_io_qfactor = &( *pCrend )->io_qfactor;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
    FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
@@ -2054,177 +2052,6 @@ static ivas_error ivas_rend_crendConvolver(
    return IVAS_ERR_OK;
}

#ifndef FIX_911_REMOVE_CREND_DUPLICATION
/*-----------------------------------------------------------------------------------------*
 * Function ivas_rend_crend_Process()
 *
 * Process call for IVAS Crend renderer
 *-----------------------------------------------------------------------------------------*/

ivas_error ivas_rend_crendProcess(
    const CREND_WRAPPER *pCrend,
    const AUDIO_CONFIG inConfig,
    const AUDIO_CONFIG outConfig,
    DECODER_CONFIG_HANDLE hDecoderConfig,
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
    IVAS_OUTPUT_SETUP_HANDLE hIntSetup,
    EFAP_HANDLE hEFAPdata,
    Word32 *output_fx[], /* i/o: input/output audio channels   Qx  */
    const Word32 output_Fs,
#ifdef SPLIT_REND_WITH_HEAD_ROT
    const Word16 num_subframes /* i  : number of subframes to render */,
    const Word16 pos_idx
#else
    const Word16 num_subframes /* i  : number of subframes to render */
#endif
)
{
    Word16 i, subframe_idx, subframe_len;
    Word16 nchan_out;
    Word32 pcm_tmp_fx[BINAURAL_CHANNELS][L_FRAME48k];
    Word32 *p_pcm_tmp_fx[BINAURAL_CHANNELS];
    IVAS_REND_AudioConfigType inConfigType;
    Word8 combinedOrientationEnabled;
    ivas_error error;
    CREND_HANDLE hCrend;

#ifdef SPLIT_REND_WITH_HEAD_ROT
    hCrend = pCrend->hCrend[pos_idx];
#else
    hCrend = pCrend->hCrend;
#endif

    combinedOrientationEnabled = 0;
    move16();
    IF( hCombinedOrientationData != NULL )
    {
        FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ )
        {
            IF( hCombinedOrientationData->enableCombinedOrientation[subframe_idx] != 0 )
            {
                combinedOrientationEnabled = 1;
                move16();
                BREAK;
            }
        }
    }

    push_wmops( "ivas_rend_crendProcess" );
    inConfigType = getAudioConfigType( inConfig );

    IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) )
    {
        return error;
    }
    subframe_len = L_SUBFRAME_48k;
    move16();
    SWITCH( output_Fs )
    {
        case 48000:
            subframe_len = L_SUBFRAME_48k;
            move16();
            BREAK;
        case 32000:
            subframe_len = L_SUBFRAME_32k;
            move16();
            BREAK;
        case 16000:
            subframe_len = L_SUBFRAME_16k;
            move16();
            BREAK;
        case 8000:
            subframe_len = L_SUBFRAME_8k;
            move16();
            BREAK;
        default:
            BREAK;
    }

    FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
    {
        p_pcm_tmp_fx[i] = pcm_tmp_fx[i];
        move32();
    }

    FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ )
    {
        /* Early Reflections */
        IF( hCrend->reflections != NULL )
        {
            test();
            IF( EQ_16( hCrend->reflections->use_er, 1 ) && EQ_16( hCrend->reflections->is_ready, 1 ) )
            {
                IF( NE_32( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
            }
        }

        test();
        IF( hDecoderConfig && combinedOrientationEnabled )
        {
            /* Orientation tracking */

            /* Rotation in SHD for:
                MC with elevation (5_1_2 / 5_1_4 / 7_1_4) -> BINAURAL
                SBA SPAR -> BINAURAL or BINAURAL_ROOM
            */
            test();
            test();
            test();
            IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA3 ) )
            {
                rotateFrame_shd( hCombinedOrientationData, output_fx, subframe_len, *hIntSetup, subframe_idx );
            }
            /* Rotation in SD for MC -> BINAURAL_ROOM */
            ELSE IF( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup )
            {
                rotateFrame_sd( hCombinedOrientationData, output_fx, subframe_len, *hIntSetup, hEFAPdata, subframe_idx );
            }
        }
        test();
        IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) )
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            IF( NE_32( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx, pos_idx ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx ) ), IVAS_ERR_OK ) )
#endif
            {
                return error;
            }

            IF( hCrend->hReverb != NULL )
            {
#ifdef SPLIT_REND_WITH_HEAD_ROT
                IF( NE_32( ( error = ivas_reverb_process_fx( pCrend->hCrend[pos_idx]->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ), IVAS_ERR_OK ) )
#else
                IF( NE_32( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ), IVAS_ERR_OK ) )
#endif
                {
                    return error;
                }
            }

            /* update combined orientation access index */
            ivas_combined_orientation_update_index( hCombinedOrientationData, subframe_len );
        }
        ELSE
        {
            return IVAS_ERR_INVALID_INPUT_FORMAT;
        }
    }
    /* move to output */
    FOR( i = 0; i < nchan_out; i++ )
    {
        MVR2R_WORD32( pcm_tmp_fx[i], output_fx[i], imult1616( num_subframes, subframe_len ) );
    }

    pop_wmops();
    return IVAS_ERR_OK;
}
#endif

/*-----------------------------------------------------------------------------------------*
 * Function ivas_rend_crendProcessSubframe()
@@ -2299,10 +2126,8 @@ ivas_error ivas_rend_crendProcessSubframe(
        p_pcm_tmp_fx[ch] = pcm_tmp_fx[ch];
    }

#ifdef FIX_911_REMOVE_CREND_DUPLICATION
    IF( hTcBuffer != NULL )
    {
#endif
        slot_size = hTcBuffer->n_samples_granularity;
        move16();

@@ -2319,7 +2144,6 @@ ivas_error ivas_rend_crendProcessSubframe(
            last_sf = add( last_sf, 1 );
        }

#ifdef FIX_911_REMOVE_CREND_DUPLICATION
        subframe_len = -1; /* will be set later */
        move16();
    }
@@ -2353,18 +2177,13 @@ ivas_error ivas_rend_crendProcessSubframe(
        last_sf_tmp = div_s( n_samples_to_render, den );
        last_sf = shr( last_sf_tmp, sub( 15, n_den ) );
    }
#endif

    FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ )
    {
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
        if ( hTcBuffer != NULL )
        {
#endif
            subframe_len = imult1616( hTcBuffer->subframe_nbslots[subframe_idx], hTcBuffer->n_samples_granularity );
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
        }
#endif

        /* Early Reflections */
        IF( hCrend->reflections != NULL )
@@ -2439,15 +2258,11 @@ ivas_error ivas_rend_crendProcessSubframe(
                p_pcm_tmp_fx[ch] += subframe_len;
            }

#ifdef FIX_911_REMOVE_CREND_DUPLICATION
            if ( hTcBuffer != NULL )
            {
#endif
                hTcBuffer->slots_rendered = add( hTcBuffer->subframe_nbslots[subframe_idx], hTcBuffer->slots_rendered );
                move16();
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
            }
#endif
        }
        ELSE
        {
@@ -2482,15 +2297,11 @@ ivas_error ivas_rend_crendProcessSubframe(
        MVR2R_WORD32( pcm_tmp_fx[ch], output[ch], n_samples_to_render ); // Qx
    }

#ifdef FIX_911_REMOVE_CREND_DUPLICATION
    if ( hTcBuffer != NULL )
    {
#endif
        hTcBuffer->subframes_rendered = last_sf;
        move16();
#ifdef FIX_911_REMOVE_CREND_DUPLICATION
    }
#endif

    pop_wmops();

+0 −19
Original line number Diff line number Diff line
@@ -895,25 +895,6 @@ ivas_error ivas_rend_initCrendWrapper(
#endif
);

#ifndef FIX_911_REMOVE_CREND_DUPLICATION
ivas_error ivas_rend_crendProcess(
    const CREND_WRAPPER *pCrend,
    const AUDIO_CONFIG inConfig,
    const AUDIO_CONFIG outConfig,
    DECODER_CONFIG_HANDLE hDecoderConfig,
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
    IVAS_OUTPUT_SETUP_HANDLE hIntSetup,
    EFAP_HANDLE hEFAPdata,
    Word32 *output[],                                            /* i/o: input/output audio channels             */
    const Word32 output_Fs,   
#ifdef SPLIT_REND_WITH_HEAD_ROT
    const Word16 num_subframes,                                /* i  : number of subframes to render           */
    const Word16 pos_idx                                       /* i  : pose index                              */
#else
    const Word16 num_subframes                                 /* i  : number of subframes to render */
#endif
);
#endif
ivas_error ivas_rend_crendProcessSubframe(
    const CREND_WRAPPER *pCrend,                                /* i/o: Crend wrapper handle                    */
    const AUDIO_CONFIG inConfig,                                /* i  : input audio configuration               */
Loading