Commit c9c13442 authored by vaclav's avatar vaclav
Browse files

- simplify SBA rendering conditions; under SIMPLIFY_SBA_RENDERING_LOGIC

- editorial changes
parent ec6e650e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@
/*#define FIX_IVAS_180_PLC_SIGNAL_LAST_OVLP_IN_TCX10*/  /* IVAS-180 write last overlap mode in TCX10 frames to allow for correct TCX10/TCX5 subframe decomposition in TCX10 frames after a lost frame */
/*#define FIX_I1_113*/                                  /* under review : MCT bit distribution optimization for SBA high bitrates*/

#define SIMPLIFY_SBA_RENDERING_LOGIC

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+22 −0
Original line number Diff line number Diff line
@@ -324,6 +324,27 @@ ivas_error ivas_dec(
        }

        /* Loudspeakers, Ambisonics or Binaural rendering */
#ifdef SIMPLIFY_SBA_RENDERING_LOGIC
        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
            ivas_dirac_dec_binaural( st_ivas, output, nchan_remapped );
        }
        else if( st_ivas->sba_mode == SBA_MODE_DIRAC || st_ivas->ivas_format == MASA_FORMAT )
        {
            if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC )
            {
                ivas_sba_linear_renderer( output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx );
            }
            else if ( st_ivas->renderer_type == RENDERER_DIRAC )
            {
                ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 );
            }
        }
        else /* st_ivas->sba_mode == SBA_MODE_SPAR */
        {
            ivas_sba_upmixer_renderer( st_ivas, output, nchan_remapped, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */
        }
#else
        if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode == SBA_MODE_DIRAC )
        {
            ivas_sba_linear_renderer( output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx );
@@ -342,6 +363,7 @@ ivas_error ivas_dec(
        {
            ivas_sba_upmixer_renderer( st_ivas, output, nchan_remapped, output_frame );
        }
#endif
    }
    else if ( st_ivas->ivas_format == MC_FORMAT )
    {
+7 −2
Original line number Diff line number Diff line
@@ -1826,7 +1826,7 @@ void ivas_dirac_dec(
            set_zero( onset_filter_subframe, hDirAC->num_freq_bands );
        }

        if ( ( st_ivas->hHeadTrackData ) )
        if ( st_ivas->hHeadTrackData )
        {
            QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat );

@@ -1895,6 +1895,7 @@ void ivas_dirac_dec(
                    set_zero( surCohRatio, hDirAC->num_freq_bands );
                }
            }

            if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 1 )
            {
                ivas_dirac_dec_compute_directional_responses( hDirAC,
@@ -1943,6 +1944,7 @@ void ivas_dirac_dec(
                                      st_ivas->cldfbAnaDec[ch] );
                }
            }

            /* CNG in DirAC, extra CLDFB ana for CNA*/
            if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR )
            {
@@ -1955,7 +1957,7 @@ void ivas_dirac_dec(
                                              Cldfb_ImagBuffer[1][0],
                                              index_slot,
                                              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_dirac_flag );
                                              ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && st->cng_type == FD_CNG && st->cng_dirac_flag );
            }

            /* LFE synthesis */
@@ -2053,6 +2055,7 @@ void ivas_dirac_dec(
            /*-----------------------------------------------------------------*
             * Compute DirAC parameters at decoder side
             *-----------------------------------------------------------------*/

            if ( hDirAC->hConfig->dec_param_estim == TRUE )
            {
                hDirAC->index_buffer_intensity = ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ) + 1; /* averaging_length = 32 */
@@ -2232,11 +2235,13 @@ void ivas_dirac_dec(
            {
                v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands );
            }

            if ( hDirAC->hConfig->dec_param_estim )
            {
                hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length;
            }
        }

        if ( hDirAC->hConfig->dec_param_estim == 0 )
        {
            hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length;
+3 −1
Original line number Diff line number Diff line
@@ -352,6 +352,7 @@ void ivas_renderer_select(
            {
                *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
            }

            if ( st_ivas->hDecoderConfig->Opt_Headrotation )
            {
                if ( st_ivas->nchan_transport == 2 )
@@ -437,7 +438,7 @@ void ivas_renderer_select(
                    {
                        *renderer_type = RENDERER_BINAURAL_FASTCONV_ROOM;
                    }
#if defined( DEBUGGING )
#ifdef DEBUGGING
                    if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND )
                    {
                        *renderer_type = RENDERER_BINAURAL_MIXER_CONV_ROOM;
@@ -542,6 +543,7 @@ void ivas_renderer_select(
            {
                nchan_max = ivas_sba_get_nchan( 3, st_ivas->sba_planar );
            }

            if ( st_ivas->nchan_transport >= nchan_max )
            {
                *renderer_type = RENDERER_SBA_LINEAR_DEC;
+16 −1
Original line number Diff line number Diff line
@@ -210,7 +210,11 @@ void ivas_sba_upmixer_renderer(
)
{
    int16_t i, ch, nchan_out;
#ifdef SIMPLIFY_SBA_RENDERING_LOGIC
    float temp;
#else
    float clip, temp;
#endif
    int16_t nchan_internal;

    wmops_sub_start( "ivas_sba_upmixer_renderer" );
@@ -249,35 +253,46 @@ void ivas_sba_upmixer_renderer(
        }
    }

#ifdef SIMPLIFY_SBA_RENDERING_LOGIC
    /* Upmixer + Renderer */
#else
    /* Upmixer */
#endif
    ivas_spar_foa_dec_upmixer( st_ivas, output, nchan_internal, output_frame );

#ifndef SIMPLIFY_SBA_RENDERING_LOGIC
    /* Renderer */
    if ( st_ivas->hDirAC != NULL && st_ivas->renderer_type == RENDERER_DIRAC )
    {
        nchan_out = st_ivas->hDirAC->hOutSetup.nchan_out_woLFE + st_ivas->hDirAC->hOutSetup.num_lfe;
    }

#endif
    if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC )
    {
        ivas_sba_linear_renderer( output, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx );
    }

#ifndef SIMPLIFY_SBA_RENDERING_LOGIC
    clip = 1.0f;
#endif
    for ( ch = 0; ch < nchan_out; ch++ )
    {
        for ( i = 0; i < output_frame; i++ )
        {
#ifndef SIMPLIFY_SBA_RENDERING_LOGIC
            clip = max( clip, fabsf( output[ch][i] ) );
#endif
            output[ch][i] = output[ch][i] * PCM16_TO_FLT_FAC;
        }
    }

#ifndef SIMPLIFY_SBA_RENDERING_LOGIC
#ifdef DEBUGGING
    if ( clip > 1.0f )
    {
        fprintf( stderr, "IVAS Crend Clipped: max gain = %f\n", clip );
    }
#endif
#endif

    wmops_sub_end();
Loading