Commit 19e1717b authored by vaclav's avatar vaclav
Browse files

Merge branch '1314-stereo-to-ext-sets-mc-renderer' into 'main'

Resolve "stereo to EXT sets MC renderer"

See merge request !2081
parents e57c3299 3f76035d
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define UNIFIED_DECODING_PATHS_LEFTOVERS                /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */

#define FIX_1314_STEREO_TO_EXT                          /* VA: issue 1314: set RENDERER_DISABLE for stereo to EXT output */

/* #################### End BE switches ################################## */

+31 −16
Original line number Diff line number Diff line
@@ -223,9 +223,6 @@ static ivas_error get_ls_conversion_matrix(
    int16_t index;
    float value;
    const LS_CONVERSION_MATRIX *conversion_matrix;
    ivas_error error;

    error = IVAS_ERR_OK;

    conversion_matrix = NULL;

@@ -260,7 +257,7 @@ static ivas_error get_ls_conversion_matrix(
                        }
                    }
                }
                return error;
                return IVAS_ERR_OK;
            }
            else
            {
@@ -273,7 +270,7 @@ static ivas_error get_ls_conversion_matrix(
                    {
                        hLsSetUpConversion->dmxMtx[k][k] = 1.0f;
                    }
                    return error;
                    return IVAS_ERR_OK;
                }
                else
                {
@@ -288,7 +285,7 @@ static ivas_error get_ls_conversion_matrix(
                        hLsSetUpConversion->dmxMtx[ch_in][ch_out] = value;
                    }
                }
                return error;
                return IVAS_ERR_OK;
            }
        }
    }
@@ -311,8 +308,10 @@ ivas_error ivas_ls_setup_conversion_open(
    int16_t chIdx, inChannels, outChannels;
    int16_t output_frame;
    int32_t output_Fs;
    int16_t nchan_out;
    int16_t paramUpmixMonoStereo;
#ifdef FIX_1314_STEREO_TO_EXT
    ivas_error error;
#endif

    if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_PARAMUPMIX && ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO ) )
    {
@@ -323,7 +322,7 @@ ivas_error ivas_ls_setup_conversion_open(
        paramUpmixMonoStereo = FALSE;
    }
    output_Fs = st_ivas->hDecoderConfig->output_Fs;
    nchan_out = st_ivas->hDecoderConfig->nchan_out;
    outChannels = st_ivas->hDecoderConfig->nchan_out;
    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );

    /* Allocate memory to the handle */
@@ -332,9 +331,8 @@ ivas_error ivas_ls_setup_conversion_open(
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LS configuration Conversion Handle \n" ) );
    }

    assert( nchan_out <= MAX_OUTPUT_CHANNELS );
    assert( outChannels <= MAX_OUTPUT_CHANNELS );

    outChannels = nchan_out;
    if ( st_ivas->renderer_type == RENDERER_MC_PARAMMC )
    {
        inChannels = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe;
@@ -423,16 +421,37 @@ ivas_error ivas_ls_setup_conversion_open(
        {
            if ( paramUpmixMonoStereo == TRUE )
            {
#ifdef FIX_1314_STEREO_TO_EXT
                if ( ( error = get_ls_conversion_matrix( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#else
                get_ls_conversion_matrix( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config );
#endif
            }
            else
            {
#ifdef FIX_1314_STEREO_TO_EXT
                if ( ( error = get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#else
                get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config );
#endif
            }
        }
        else
        {
#ifdef FIX_1314_STEREO_TO_EXT
            if ( ( error = get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#else
            get_ls_conversion_matrix( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config );
#endif
        }
    }

@@ -633,9 +652,7 @@ void ivas_ls_setup_conversion_process_mdct(
        {
            dmxCoeff = hLsSetUpConversion->dmxMtx[chInIdx][chOutIdx];

            if (
                chInIdx != LFE_CHANNEL &&
                mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE )
            if ( chInIdx != LFE_CHANNEL && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE )
            {
                /* Step 1: Compute the target energy and DMX signal (possible since we have all signals in TCX20 resolution) */
                if ( dmxCoeff )
@@ -728,9 +745,7 @@ void ivas_ls_setup_conversion_process_mdct(
    /* Step 4: Perform equalization */
    for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ )
    {
        if (
            chInIdx != LFE_CHANNEL &&
            mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE )
        if ( chInIdx != LFE_CHANNEL && mct_chan_mode[chInIdx] != MCT_CHAN_MODE_IGNORE )
        {
            if ( transform_type[chInIdx][0] == TCX_20 )
            {
+4 −0
Original line number Diff line number Diff line
@@ -262,7 +262,11 @@ void ivas_renderer_select(
    }
    else if ( st_ivas->ivas_format == STEREO_FORMAT )
    {
#ifdef FIX_1314_STEREO_TO_EXT
        if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO && output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
#else
        if ( output_config != IVAS_AUDIO_CONFIG_STEREO && output_config != IVAS_AUDIO_CONFIG_MONO )
#endif
        {
            *renderer_type = RENDERER_MC;
        }