Commit 9135dc9b authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fix for issue 727

parent 93521388
Loading
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -5315,6 +5315,18 @@ void ivas_mc2sba(
    const float gain_lfe                                        /* i  : gain for LFE, 0=ignore LFE                      */
);

#ifdef FIX_727_MC_PARAMUPMIX_HEADROTATION
void ivas_param_mc_mc2sba_cldfb(
    IVAS_OUTPUT_SETUP hTransSetup,                                                /* i  : transported MC Format                                       */
    float *hoa_encoder,                                                           /* i  : HOA3 encoder for the transported MC format                  */
    const int16_t slot_idx,                                                       /* i  : current slot in the subframe                                */
    float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */
    float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */
    const int16_t nBands,                                                         /* i  : number of synth CLDFB bands                                 */
    const float gain_lfe                                                          /* i  : gain applied to LFE                                        */
);
#endif

void ivas_ism2sba(
    float *buffer_td[],                                         /* i/o: TD signal buffers                               */
    ISM_RENDERER_HANDLE hIsmRendererData,                       /* i/o: renderer data                                   */
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@
#define FIX_718_JBM_MD_UDPATE                           /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */
#define FIX_719_CRASH_IN_CLEANUP                        /* VA: issue 719: fix Decoder crash after call to goto to cleanup */

#define FIX_727_MC_PARAMUPMIX_HEADROTATION              /*Dlb : issue 727 : headrotation in MC paramupmix mode*/

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

+6 −2
Original line number Diff line number Diff line
@@ -989,17 +989,21 @@ ivas_error ivas_dec(
                    }
                }
            }

#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
            if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) )
            {
                ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE );
            }

#endif
            /* Rendering */
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
            {
#ifdef FIX_727_MC_PARAMUPMIX_HEADROTATION
                if ( !( st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) )
#else
#ifdef SPLIT_REND_WITH_HEAD_ROT
                if ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_CODED && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#endif
#endif
                {
                    ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output );
+21 −4
Original line number Diff line number Diff line
@@ -97,9 +97,9 @@ static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresen
static void param_mc_set_num_synth_bands( const int32_t output_Fs, PARAM_MC_DEC_HANDLE hParamMC );

static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, const uint16_t nchan_transport, const uint16_t nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info );

#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
static void ivas_param_mc_mc2sba_cldfb( IVAS_OUTPUT_SETUP hTransSetup, float *hoa_encoder, const int16_t slot_idx, float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], const int16_t nBands, const float gain_lfe );

#endif
static void ivas_param_mc_get_param_band_mapping( const int16_t n_target_bands, const int16_t *target_band_grouping, const int16_t n_source_bands, const int16_t *source_band_grouping, PARAM_MC_PARAMETER_BAND_MAPPING *parameter_band_mapping );

static void ivas_param_mc_bs_decode_parameter_values( uint16_t bit_buffer[], int16_t *bit_pos, const int16_t max_bits, int16_t *BER_detect, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC, HANDLE_PARAM_MC_PARAMETER_CODING_INFO hParamCodingInfo, const int16_t map_size_wo_lfe, const int16_t map_size, const int16_t num_lfe_bands, const int16_t band_step, const int16_t num_param_bands, float *value_buffer );
@@ -1796,6 +1796,23 @@ void ivas_param_mc_dec_render(

        if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
        {
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
            {
                if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
                {
                    for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
                    {
                        for ( ch = 0; ch < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ); ch++ )
                        {
                            mvr2r( Cldfb_RealBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_RealBuffer[ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
                            mvr2r( Cldfb_ImagBuffer[ch][slot_idx], st_ivas->hSplitBinRend.hCldfbDataOut->Cldfb_ImagBuffer[ch][slot_idx_start + slot_idx], hParamMC->num_freq_bands );
                        }
                    }
                    st_ivas->hSplitBinRend.hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
                }
            }
#endif
            ivas_binRenderer( st_ivas->hBinRenderer,
#ifdef SPLIT_REND_WITH_HEAD_ROT
                              &st_ivas->hSplitBinRend.splitrend.multiBinPoseData,
@@ -3023,7 +3040,7 @@ static ivas_error param_mc_get_diff_proto_info(
    return IVAS_ERR_OK;
}


#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
/*-------------------------------------------------------------------------*
 * ivas_param_mc_mc2sba_cldfb()
 *
@@ -3098,7 +3115,7 @@ static void ivas_param_mc_mc2sba_cldfb(

    return;
}

#endif

/*-------------------------------------------------------------------------*
 * ivas_param_mc_bs_decode_parameter_values()
+47 −3
Original line number Diff line number Diff line
@@ -185,15 +185,23 @@ void ivas_mc_paramupmix_dec(
    int16_t noparamupmix_delay;
    AUDIO_CONFIG output_config;
    int16_t subframeIdx, idx_in, index_slot, maxBand;
#ifdef FIX_727_MC_PARAMUPMIX_HEADROTATION
    float Cldfb_RealBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    float Cldfb_ImagBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
    float Cldfb_RealBuffer_subfr[MC_PARAMUPMIX_MAX_INPUT_CHANS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    float Cldfb_ImagBuffer_subfr[MC_PARAMUPMIX_MAX_INPUT_CHANS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    int16_t idx_lfe;
#endif
    float Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    float Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    int16_t idx_lfe;
#else
#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
    float Cldfb_RealBuffer_subfr[3 + MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    float Cldfb_ImagBuffer_subfr[3 + MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
#endif
    float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
#endif
@@ -311,11 +319,21 @@ void ivas_mc_paramupmix_dec(
                    }
                    idx_in += 2;
                }

#ifdef FIX_727_MC_PARAMUPMIX_HEADROTATION
                if ( st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV )
                {
                    for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
                    {
                        ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hMCParamUpmix->hoa_encoder, slot_idx, Cldfb_RealBuffer_subfr, Cldfb_ImagBuffer_subfr, maxBand, GAIN_LFE );
                    }
                }
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
                /*LFE handling for split rendering cases*/
                if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
                {
#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
                    /*LFE is already handled in ivas_param_mc_mc2sba_cldfb()*/
                    for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ )
                    {
                        ch = st_ivas->hIntSetup.index_lfe[idx_lfe];
@@ -329,6 +347,7 @@ void ivas_mc_paramupmix_dec(
                        }
                        idx_in++;
                    }
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
                    if ( st_ivas->hSplitBinRend.hCldfbDataOut != NULL )
@@ -367,6 +386,7 @@ void ivas_mc_paramupmix_dec(
                if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
                {
                    int16_t pos_idx;
#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
                    for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ )
                    {
                        if ( st_ivas->hIntSetup.num_lfe > 0 )
@@ -375,12 +395,14 @@ void ivas_mc_paramupmix_dec(
                            v_multc( Cldfb_ImagBuffer_subfr[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], GAIN_LFE, Cldfb_ImagBuffer_subfr[st_ivas->hIntSetup.nchan_out_woLFE][slot_idx], maxBand );
                        }
                    }
#endif
                    for ( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
                    {
                        for ( slot_idx = 0; slot_idx < JBM_CLDFB_SLOTS_IN_SUBFRAME; slot_idx++ )
                        {
                            for ( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
                            {
#ifndef FIX_727_MC_PARAMUPMIX_HEADROTATION
                                if ( st_ivas->hIntSetup.num_lfe > 0 )
                                {
                                    v_add( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx],
@@ -393,6 +415,7 @@ void ivas_mc_paramupmix_dec(
                                           Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx],
                                           maxBand );
                                }
#endif
                                mvr2r( Cldfb_RealBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
                                mvr2r( Cldfb_ImagBuffer_Binaural[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend.hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[( pos_idx * BINAURAL_CHANNELS ) + ch][( subframeIdx * JBM_CLDFB_SLOTS_IN_SUBFRAME ) + slot_idx], maxBand );
                            }
@@ -638,7 +661,9 @@ ivas_error ivas_mc_paramupmix_dec_open(
            assert( 0 && "Number of TC not supported for MC ParamUpmix!" );
#endif
    }

#ifdef FIX_727_MC_PARAMUPMIX_HEADROTATION
    hMCParamUpmix->hoa_encoder = NULL;
#endif
    /*-----------------------------------------------------------------*
     * set input parameters
     *-----------------------------------------------------------------*/
@@ -659,6 +684,18 @@ ivas_error ivas_mc_paramupmix_dec_open(
        set_zero( hMCParamUpmix->pcm_delay[i], NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ) );
    }

#ifdef FIX_727_MC_PARAMUPMIX_HEADROTATION
    /* Head or external rotation */
    if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
    {
        if ( ( hMCParamUpmix->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) );
        }
        compute_hoa_encoder_mtx( st_ivas->hTransSetup.ls_azimuth, st_ivas->hTransSetup.ls_elevation, hMCParamUpmix->hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER );
    }
#endif

    /* allocate transport channels*/
    hMCParamUpmix->free_param_interpolator = 0;
    hMCParamUpmix->param_interpolator = NULL;
@@ -743,6 +780,13 @@ void ivas_mc_paramupmix_dec_close(
            free( ( *hMCParamUpmix )->param_interpolator );
        }
    }
#ifdef FIX_727_MC_PARAMUPMIX_HEADROTATION
    if ( ( *hMCParamUpmix )->hoa_encoder != NULL )
    {
        free( ( *hMCParamUpmix )->hoa_encoder );
        ( *hMCParamUpmix )->hoa_encoder = NULL;
    }
#endif
    free( *hMCParamUpmix );

    *hMCParamUpmix = NULL;
Loading