Loading lib_com/ivas_dirac_com.c +3 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,9 @@ ivas_error ivas_dirac_config( } hConfig->enc_param_start_band = 0; hConfig->dec_param_estim = FALSE; #ifdef FIX_391_SBA hConfig->dec_param_estim_old = hConfig->dec_param_estim; #endif if ( ivas_format == SBA_FORMAT ) /* skip for MASA decoder */ { if ( ( error = ivas_dirac_sba_config( hQMetaData, nchan_transport, nSCE, nCPE, element_mode, ivas_total_brate, sba_order, sba_mode, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK ) Loading lib_com/ivas_stat_com.h +3 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,9 @@ typedef struct ivas_dirac_config_data_struct { int16_t enc_param_start_band; int16_t dec_param_estim; #ifdef FIX_391_SBA int16_t dec_param_estim_old; #endif int16_t nbands; } DIRAC_CONFIG_DATA, *DIRAC_CONFIG_DATA_HANDLE; Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ /*#define LBR_SBA_PLANAR*/ /* Converting low bitrate SBA modes to Planar */ #define LBR_ADAP_SMOOTHING #endif #define FIX_391_SBA /* Dlb: Fix for issue 391 for SBA */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif lib_dec/ivas_dirac_dec.c +162 −1 Original line number Diff line number Diff line Loading @@ -813,7 +813,12 @@ ivas_error ivas_dirac_dec_config( } mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); #ifdef FIX_391_SBA if ( flag_config == DIRAC_OPEN ) { hDirAC->hConfig->dec_param_estim_old = hDirAC->hConfig->dec_param_estim; } #endif if ( flag_config == DIRAC_OPEN ) { hDirAC->dirac_md_buffer_length = 0; Loading Loading @@ -984,7 +989,163 @@ ivas_error ivas_dirac_dec_config( hDirAC->dithering_seed = DIRAC_DITH_SEED; st_ivas->hDirAC = hDirAC; } #ifdef FIX_391_SBA else if ( ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) && ( st_ivas->hHeadTrackData ) ) { int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { if ( ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->azimuth[i] != NULL ) { free( hDirAC->azimuth[i] ); hDirAC->azimuth[i] = NULL; } if ( hDirAC->elevation[i] != NULL ) { free( hDirAC->elevation[i] ); hDirAC->elevation[i] = NULL; } if ( hDirAC->diffuseness_vector[i] != NULL ) { free( hDirAC->diffuseness_vector[i] ); hDirAC->diffuseness_vector[i] = NULL; } } if ( hDirAC->azimuth != NULL ) { free( hDirAC->azimuth ); hDirAC->azimuth = NULL; } if ( hDirAC->elevation != NULL ) { free( hDirAC->elevation ); hDirAC->elevation = NULL; } if ( hDirAC->diffuseness_vector != NULL ) { free( hDirAC->diffuseness_vector ); hDirAC->diffuseness_vector = NULL; } if ( hDirAC->energy_ratio1 != NULL ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->energy_ratio1[i] != NULL ) { free( hDirAC->energy_ratio1[i] ); hDirAC->energy_ratio1[i] = NULL; } } free( hDirAC->energy_ratio1 ); hDirAC->energy_ratio1 = NULL; } if ( hDirAC->spreadCoherence != NULL ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->spreadCoherence[i] != NULL ) { free( hDirAC->spreadCoherence[i] ); hDirAC->spreadCoherence[i] = NULL; } } free( hDirAC->spreadCoherence ); hDirAC->spreadCoherence = NULL; } if ( hDirAC->surroundingCoherence != NULL ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->surroundingCoherence[i] != NULL ) { free( hDirAC->surroundingCoherence[i] ); hDirAC->surroundingCoherence[i] = NULL; } } free( hDirAC->surroundingCoherence ); hDirAC->surroundingCoherence = NULL; } } hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ) * num_slots_in_subfr; hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); if ( ( hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); } } } #endif return error; } Loading Loading
lib_com/ivas_dirac_com.c +3 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,9 @@ ivas_error ivas_dirac_config( } hConfig->enc_param_start_band = 0; hConfig->dec_param_estim = FALSE; #ifdef FIX_391_SBA hConfig->dec_param_estim_old = hConfig->dec_param_estim; #endif if ( ivas_format == SBA_FORMAT ) /* skip for MASA decoder */ { if ( ( error = ivas_dirac_sba_config( hQMetaData, nchan_transport, nSCE, nCPE, element_mode, ivas_total_brate, sba_order, sba_mode, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK ) Loading
lib_com/ivas_stat_com.h +3 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,9 @@ typedef struct ivas_dirac_config_data_struct { int16_t enc_param_start_band; int16_t dec_param_estim; #ifdef FIX_391_SBA int16_t dec_param_estim_old; #endif int16_t nbands; } DIRAC_CONFIG_DATA, *DIRAC_CONFIG_DATA_HANDLE; Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ /*#define LBR_SBA_PLANAR*/ /* Converting low bitrate SBA modes to Planar */ #define LBR_ADAP_SMOOTHING #endif #define FIX_391_SBA /* Dlb: Fix for issue 391 for SBA */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif
lib_dec/ivas_dirac_dec.c +162 −1 Original line number Diff line number Diff line Loading @@ -813,7 +813,12 @@ ivas_error ivas_dirac_dec_config( } mvs2s( DirAC_block_grouping, hDirAC->block_grouping, MAX_PARAM_SPATIAL_SUBFRAMES + 1 ); #ifdef FIX_391_SBA if ( flag_config == DIRAC_OPEN ) { hDirAC->hConfig->dec_param_estim_old = hDirAC->hConfig->dec_param_estim; } #endif if ( flag_config == DIRAC_OPEN ) { hDirAC->dirac_md_buffer_length = 0; Loading Loading @@ -984,7 +989,163 @@ ivas_error ivas_dirac_dec_config( hDirAC->dithering_seed = DIRAC_DITH_SEED; st_ivas->hDirAC = hDirAC; } #ifdef FIX_391_SBA else if ( ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) && ( st_ivas->hHeadTrackData ) ) { int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { if ( ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->azimuth[i] != NULL ) { free( hDirAC->azimuth[i] ); hDirAC->azimuth[i] = NULL; } if ( hDirAC->elevation[i] != NULL ) { free( hDirAC->elevation[i] ); hDirAC->elevation[i] = NULL; } if ( hDirAC->diffuseness_vector[i] != NULL ) { free( hDirAC->diffuseness_vector[i] ); hDirAC->diffuseness_vector[i] = NULL; } } if ( hDirAC->azimuth != NULL ) { free( hDirAC->azimuth ); hDirAC->azimuth = NULL; } if ( hDirAC->elevation != NULL ) { free( hDirAC->elevation ); hDirAC->elevation = NULL; } if ( hDirAC->diffuseness_vector != NULL ) { free( hDirAC->diffuseness_vector ); hDirAC->diffuseness_vector = NULL; } if ( hDirAC->energy_ratio1 != NULL ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->energy_ratio1[i] != NULL ) { free( hDirAC->energy_ratio1[i] ); hDirAC->energy_ratio1[i] = NULL; } } free( hDirAC->energy_ratio1 ); hDirAC->energy_ratio1 = NULL; } if ( hDirAC->spreadCoherence != NULL ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->spreadCoherence[i] != NULL ) { free( hDirAC->spreadCoherence[i] ); hDirAC->spreadCoherence[i] = NULL; } } free( hDirAC->spreadCoherence ); hDirAC->spreadCoherence = NULL; } if ( hDirAC->surroundingCoherence != NULL ) { for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( hDirAC->surroundingCoherence[i] != NULL ) { free( hDirAC->surroundingCoherence[i] ); hDirAC->surroundingCoherence[i] = NULL; } } free( hDirAC->surroundingCoherence ); hDirAC->surroundingCoherence = NULL; } } hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ) * num_slots_in_subfr; hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; if ( ( hDirAC->azimuth = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->elevation = (int16_t **) malloc( hDirAC->dirac_md_buffer_length * sizeof( int16_t * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->diffuseness_vector = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->energy_ratio1 = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->spreadCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } if ( ( hDirAC->surroundingCoherence = (float **) malloc( hDirAC->dirac_md_buffer_length * sizeof( float * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } for ( i = 0; i < hDirAC->dirac_md_buffer_length; i++ ) { if ( ( hDirAC->azimuth[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_s( hDirAC->azimuth[i], 0, hDirAC->num_freq_bands ); if ( ( hDirAC->elevation[i] = (int16_t *) malloc( hDirAC->num_freq_bands * sizeof( int16_t ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_s( hDirAC->elevation[i], 0, hDirAC->num_freq_bands ); if ( ( hDirAC->diffuseness_vector[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->diffuseness_vector[i], 1.0f, hDirAC->num_freq_bands ); if ( ( hDirAC->energy_ratio1[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->energy_ratio1[i], 0.0f, hDirAC->num_freq_bands ); if ( ( hDirAC->spreadCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->spreadCoherence[i], 0.0f, hDirAC->num_freq_bands ); if ( ( hDirAC->surroundingCoherence[i] = (float *) malloc( hDirAC->num_freq_bands * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); } set_f( hDirAC->surroundingCoherence[i], 0.0f, hDirAC->num_freq_bands ); } } } #endif return error; } Loading