Loading lib_com/ivas_masa_com.c +5 −5 Original line number Diff line number Diff line Loading @@ -68,9 +68,9 @@ void ivas_masa_set_elements( int16_t *nCPE /* o : number of CPEs */ #ifdef MASA_AND_OBJECTS , int16_t ivas_format, const ISM_MODE ism_mode, int32_t sce_brate const int16_t ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ const int32_t ism_total_brate /* i : initial ISM total bitrate */ #endif ) { Loading @@ -97,7 +97,7 @@ void ivas_masa_set_elements( if ( ivas_total_brate > MIN_BRATE_MDCT_STEREO ) { *element_mode = IVAS_CPE_MDCT; if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - sce_brate < MIN_BRATE_MDCT_STEREO ) ) if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_DFT; } Loading @@ -118,7 +118,7 @@ void ivas_masa_set_elements( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) { hQMetaData->bits_frame_nominal -= (int16_t) ( sce_brate / FRAMES_PER_SEC ); hQMetaData->bits_frame_nominal -= (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); } #endif } Loading lib_com/ivas_prot.h +16 −17 Original line number Diff line number Diff line Loading @@ -4528,9 +4528,9 @@ void ivas_masa_set_elements( int16_t *nCPE /* o : number of CPEs */ #ifdef MASA_AND_OBJECTS , int16_t ivas_format, /* i : IVAS format */ const int16_t ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ int32_t sce_brate /* i : bitrate of SCE */ const int32_t ism_total_brate /* i : initial ISM total bitrate */ #endif ); Loading Loading @@ -5145,11 +5145,10 @@ void ivas_omasa_enc( IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i : Input audio signals for parameter analysis */ float data_out_f[][L_FRAME48k], /* o : Transport audio signals */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ const int16_t input_frame, /* i : Input frame size */ const int16_t nchan_transport, /* i : Number of transport channels */ const int16_t nchan_inp, /* i : Number of objects for parameter analysis */ const int16_t nchan_ism, /* i : Number of objects for parameter analysis*/ const ISM_MODE ism_mode, /* i : ISM mode */ float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ int16_t* idx_separated_object /* o : Index of the separated object */ Loading lib_dec/ivas_dec.c +144 −143 Original line number Diff line number Diff line Loading @@ -355,6 +355,150 @@ ivas_error ivas_dec( ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } } #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { #ifndef OMASA_BRATE ism_total_brate = 0; #endif st = st_ivas->hCPE[0]->hCoreCoder[0]; #ifndef OMASA_BRATE if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { ism_total_brate += st_ivas->hSCE[n]->element_brate; } st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); } #endif nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ if ( st_ivas->hDirAC != NULL ) { if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; } else { st_ivas->hDirAC->numIsmDirections = 0; } } /* MASA decoding */ if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } #ifdef OMASA_BRATE /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate ); st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); #endif /* Audio signal decoding */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { if ( st_ivas->nSCE == 1 ) { ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); } else { #ifdef DEBUGGING assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); #endif } } else { /* decode ISM format */ ivas_ism_metadata_dec( ism_total_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); for ( n = 0; n < st_ivas->nSCE - 1; n++ ) { if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) { return error; } } if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) { return error; } for ( n = 0; n < st_ivas->nchan_ism; n++ ) { st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } } if ( st_ivas->nCPE == 1 ) { ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); } if ( st_ivas->hCPE[0]->nchan_out == 1 ) { mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ } /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } /* Set edited object positions, if editing enabled */ ivas_masa_ism_set_edited_objects( st_ivas ); /* Rendering */ 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, st_ivas->nchan_transport ); } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } else if ( st_ivas->hDirAC ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { mvr2r( output[2], data_separated_objects[0], output_frame ); } else { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { mvr2r( output[n + 2], data_separated_objects[n], output_frame ); } } ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); } else { ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); } } } #endif else if ( st_ivas->ivas_format == MC_FORMAT ) { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; Loading Loading @@ -547,150 +691,7 @@ ivas_error ivas_dec( } } } #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { #ifndef OMASA_BRATE ism_total_brate = 0; #endif st = st_ivas->hCPE[0]->hCoreCoder[0]; #ifndef OMASA_BRATE if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { ism_total_brate += st_ivas->hSCE[n]->element_brate; } st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); } #endif nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ if ( st_ivas->hDirAC != NULL ) { if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; } else { st_ivas->hDirAC->numIsmDirections = 0; } } /* MASA decoding */ if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } #ifdef OMASA_BRATE /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate ); st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); #endif /* Audio signal decoding */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { if ( st_ivas->nSCE == 1 ) { ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); } else { #ifdef DEBUGGING assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); #endif } } else { /* decode ISM format */ ivas_ism_metadata_dec( ism_total_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); for ( n = 0; n < st_ivas->nSCE - 1; n++ ) { if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) { return error; } } if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) { return error; } for ( n = 0; n < st_ivas->nchan_ism; n++ ) { st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } } if ( st_ivas->nCPE == 1 ) { ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); } if ( st_ivas->hCPE[0]->nchan_out == 1 ) { mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ } /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } /* Set edited object positions, if editing enabled */ ivas_masa_ism_set_edited_objects( st_ivas ); /* Rendering */ 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, st_ivas->nchan_transport ); } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } else if ( st_ivas->hDirAC ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { mvr2r( output[2], data_separated_objects[0], output_frame ); } else { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { mvr2r( output[n + 2], data_separated_objects[n], output_frame ); } } ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); } else { ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); } } } #endif /*----------------------------------------------------------------* * Write IVAS output channels Loading lib_dec/ivas_init_dec.c +6 −6 Original line number Diff line number Diff line Loading @@ -664,7 +664,7 @@ ivas_error ivas_init_decoder( DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; #ifdef MASA_AND_OBJECTS int32_t sce_brate; int32_t ism_total_brate; #endif error = IVAS_ERR_OK; Loading Loading @@ -968,7 +968,7 @@ ivas_error ivas_init_decoder( ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); k = 0; sce_brate = 0; ism_total_brate = 0; while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { k++; Loading @@ -978,8 +978,8 @@ ivas_error ivas_init_decoder( /* one separated object */ st_ivas->nSCE = 1; sce_brate = sep_object_brate[k - 2][0]; create_sce_dec( st_ivas, 0, sce_brate ); ism_total_brate = sep_object_brate[k - 2][0]; create_sce_dec( st_ivas, 0, ism_total_brate ); reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); Loading @@ -999,7 +999,7 @@ ivas_error ivas_init_decoder( { temp_brate[sce_id] = sep_object_brate[k - 2][st_ivas->nSCE - 1]; sce_brate += temp_brate[sce_id]; ism_total_brate += temp_brate[sce_id]; if ( ( error = create_sce_dec( st_ivas, sce_id, temp_brate[sce_id] ) ) != IVAS_ERR_OK ) { Loading @@ -1024,7 +1024,7 @@ ivas_error ivas_init_decoder( } st_ivas->nCPE = 1; create_cpe_dec( st_ivas, 0, ( ( ivas_total_brate - sce_brate ) / st_ivas->nchan_transport ) * CPE_CHANNELS ); // VE2Nokia: could be simplified - nchan_transport is always 2 here create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ); for ( n = 0; n < CPE_CHANNELS; n++ ) { Loading lib_dec/ivas_masa_dec.c +14 −13 Original line number Diff line number Diff line Loading @@ -497,26 +497,27 @@ ivas_error ivas_masa_dec_open( MASA_DECODER_HANDLE hMasa; #ifdef MASA_AND_OBJECTS int16_t i; int32_t sce_brate; int32_t ism_total_brate; #endif if ( ( hMasa = (MASA_DECODER_HANDLE) malloc( sizeof( MASA_DECODER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } #ifdef MASA_AND_OBJECTS sce_brate = 0; ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { sce_brate += st_ivas->hSCE[i]->element_brate; ism_total_brate += st_ivas->hSCE[i]->element_brate; } } #endif ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS , st_ivas->ivas_format, st_ivas->ism_mode, sce_brate st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); Loading Loading @@ -655,7 +656,7 @@ static ivas_error ivas_masa_dec_config( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t ivas_total_brate; int32_t sce_brate; int32_t ism_total_brate; #endif error = IVAS_ERR_OK; Loading @@ -664,16 +665,16 @@ static ivas_error ivas_masa_dec_config( #ifdef MASA_AND_OBJECTS ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; sce_brate = 0; ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { sce_brate += st_ivas->hSCE[i]->element_brate; ism_total_brate += st_ivas->hSCE[i]->element_brate; } } ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, sce_brate ); ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { Loading @@ -696,7 +697,6 @@ static ivas_error ivas_masa_dec_config( return error; } st_ivas->hQMetaData->numTwoDirBands = st_ivas->hMasa->config.numTwoDirBands; st_ivas->hQMetaData->useLowerRes = 0; Loading Loading @@ -1281,7 +1281,7 @@ ivas_error ivas_masa_dec_reconfigure( int32_t ivas_total_brate, last_ivas_total_brate; ivas_error error; #ifdef MASA_AND_OBJECTS int32_t sce_brate; int32_t ism_total_brate; #endif error = IVAS_ERR_OK; Loading Loading @@ -1346,19 +1346,20 @@ ivas_error ivas_masa_dec_reconfigure( } } #ifdef MASA_AND_OBJECTS sce_brate = 0; ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( n = 0; n < st_ivas->nSCE; n++ ) { sce_brate += st_ivas->hSCE[n]->element_brate; ism_total_brate += st_ivas->hSCE[n]->element_brate; } } #endif ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp #ifdef MASA_AND_OBJECTS , st_ivas->ivas_format, st_ivas->ism_mode, sce_brate st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); Loading Loading
lib_com/ivas_masa_com.c +5 −5 Original line number Diff line number Diff line Loading @@ -68,9 +68,9 @@ void ivas_masa_set_elements( int16_t *nCPE /* o : number of CPEs */ #ifdef MASA_AND_OBJECTS , int16_t ivas_format, const ISM_MODE ism_mode, int32_t sce_brate const int16_t ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ const int32_t ism_total_brate /* i : initial ISM total bitrate */ #endif ) { Loading @@ -97,7 +97,7 @@ void ivas_masa_set_elements( if ( ivas_total_brate > MIN_BRATE_MDCT_STEREO ) { *element_mode = IVAS_CPE_MDCT; if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - sce_brate < MIN_BRATE_MDCT_STEREO ) ) if ( ( ism_mode == ISM_MASA_MODE_DISC || ism_mode == ISM_MASA_MODE_ONE_OBJ ) && ( ivas_total_brate - ism_total_brate < MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_DFT; } Loading @@ -118,7 +118,7 @@ void ivas_masa_set_elements( #ifdef MASA_AND_OBJECTS if ( ivas_format == MASA_ISM_FORMAT && ( ism_mode == ISM_MASA_MODE_ONE_OBJ || ism_mode == ISM_MASA_MODE_DISC ) ) { hQMetaData->bits_frame_nominal -= (int16_t) ( sce_brate / FRAMES_PER_SEC ); hQMetaData->bits_frame_nominal -= (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); } #endif } Loading
lib_com/ivas_prot.h +16 −17 Original line number Diff line number Diff line Loading @@ -4528,9 +4528,9 @@ void ivas_masa_set_elements( int16_t *nCPE /* o : number of CPEs */ #ifdef MASA_AND_OBJECTS , int16_t ivas_format, /* i : IVAS format */ const int16_t ivas_format, /* i : IVAS format */ const ISM_MODE ism_mode, /* i : ISM mode */ int32_t sce_brate /* i : bitrate of SCE */ const int32_t ism_total_brate /* i : initial ISM total bitrate */ #endif ); Loading Loading @@ -5145,11 +5145,10 @@ void ivas_omasa_enc( IVAS_QMETADATA_HANDLE hQMeta, /* i/o: Qmetadata handle */ MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ float data_in_f[][L_FRAME48k], /* i : Input audio signals for parameter analysis */ float data_out_f[][L_FRAME48k], /* o : Transport audio signals */ float data_in_f[][L_FRAME48k], /* i/o: Input / transport audio signals */ const int16_t input_frame, /* i : Input frame size */ const int16_t nchan_transport, /* i : Number of transport channels */ const int16_t nchan_inp, /* i : Number of objects for parameter analysis */ const int16_t nchan_ism, /* i : Number of objects for parameter analysis*/ const ISM_MODE ism_mode, /* i : ISM mode */ float data_separated_object[L_FRAME48k], /* o : Separated object audio signal */ int16_t* idx_separated_object /* o : Index of the separated object */ Loading
lib_dec/ivas_dec.c +144 −143 Original line number Diff line number Diff line Loading @@ -355,6 +355,150 @@ ivas_error ivas_dec( ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } } #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { #ifndef OMASA_BRATE ism_total_brate = 0; #endif st = st_ivas->hCPE[0]->hCoreCoder[0]; #ifndef OMASA_BRATE if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { ism_total_brate += st_ivas->hSCE[n]->element_brate; } st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); } #endif nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ if ( st_ivas->hDirAC != NULL ) { if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; } else { st_ivas->hDirAC->numIsmDirections = 0; } } /* MASA decoding */ if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } #ifdef OMASA_BRATE /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate ); st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); #endif /* Audio signal decoding */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { if ( st_ivas->nSCE == 1 ) { ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); } else { #ifdef DEBUGGING assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); #endif } } else { /* decode ISM format */ ivas_ism_metadata_dec( ism_total_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); for ( n = 0; n < st_ivas->nSCE - 1; n++ ) { if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) { return error; } } if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) { return error; } for ( n = 0; n < st_ivas->nchan_ism; n++ ) { st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } } if ( st_ivas->nCPE == 1 ) { ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); } if ( st_ivas->hCPE[0]->nchan_out == 1 ) { mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ } /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } /* Set edited object positions, if editing enabled */ ivas_masa_ism_set_edited_objects( st_ivas ); /* Rendering */ 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, st_ivas->nchan_transport ); } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } else if ( st_ivas->hDirAC ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { mvr2r( output[2], data_separated_objects[0], output_frame ); } else { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { mvr2r( output[n + 2], data_separated_objects[n], output_frame ); } } ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); } else { ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); } } } #endif else if ( st_ivas->ivas_format == MC_FORMAT ) { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; Loading Loading @@ -547,150 +691,7 @@ ivas_error ivas_dec( } } } #ifdef MASA_AND_OBJECTS else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { #ifndef OMASA_BRATE ism_total_brate = 0; #endif st = st_ivas->hCPE[0]->hCoreCoder[0]; #ifndef OMASA_BRATE if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { st->bit_stream = &( st_ivas->bit_stream[( st_ivas->hSCE[0]->element_brate / FRAMES_PER_SEC )] ); } else if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { ism_total_brate += st_ivas->hSCE[n]->element_brate; } st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); } #endif nb_bits_metadata[0] = 0; set_s( nb_bits_metadata, 0, MAX_SCE + 1 ); /* Set the number of objects for the parametric rendering */ if ( st_ivas->hDirAC != NULL ) { if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { st_ivas->hDirAC->numIsmDirections = st_ivas->nchan_ism; } else { st_ivas->hDirAC->numIsmDirections = 0; } } /* MASA decoding */ if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { return error; } #ifdef OMASA_BRATE /* Configuration of combined-format bit-budget distribution */ ivas_set_surplus_brate_dec( st_ivas, &ism_total_brate ); st->bit_stream = &( st_ivas->bit_stream[( ism_total_brate / FRAMES_PER_SEC )] ); #endif /* Audio signal decoding */ if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC ) { if ( st_ivas->nSCE == 1 ) { ivas_sce_dec( st_ivas, 0, &output[2], output_frame, nb_bits_metadata[1] ); } else { #ifdef DEBUGGING assert( ( st_ivas->nSCE <= 1 ) && "nSCE should be 1 if not in ISM_MASA_MODE_DISC." ); #endif } } else { /* decode ISM format */ ivas_ism_metadata_dec( ism_total_brate, &( st_ivas->nSCE ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, &nb_bits_metadata[1], st_ivas->ism_mode, NULL ); for ( n = 0; n < st_ivas->nSCE - 1; n++ ) { if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, 0 ) ) != IVAS_ERR_OK ) { return error; } } if ( ( error = ivas_sce_dec( st_ivas, n, &output[2 * st_ivas->nCPE + n], output_frame, sum_s( &nb_bits_metadata[1], st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) { return error; } for ( n = 0; n < st_ivas->nchan_ism; n++ ) { st_ivas->hMasaIsmData->azimuth_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->azimuth + 0.5f ); st_ivas->hMasaIsmData->elevation_ism[n] = (int16_t) ( st_ivas->hIsmMetaData[n]->elevation + 0.5f ); } } if ( st_ivas->nCPE == 1 ) { ivas_cpe_dec( st_ivas, 0, output, output_frame, nb_bits_metadata[0] ); } if ( st_ivas->hCPE[0]->nchan_out == 1 ) { mvr2r( output[0], output[1], output_frame ); /* Copy mono signal to stereo output channels */ } /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } /* Set edited object positions, if editing enabled */ ivas_masa_ism_set_edited_objects( st_ivas ); /* Rendering */ 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, st_ivas->nchan_transport ); } else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { ivas_mono_downmix_render_passive( st_ivas, output, output_frame ); } else if ( st_ivas->hDirAC ) { if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; if ( st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) { mvr2r( output[2], data_separated_objects[0], output_frame ); } else { for ( n = 0; n < st_ivas->nchan_ism; n++ ) { mvr2r( output[n + 2], data_separated_objects[n], output_frame ); } } ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame ); } else { ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); } } } #endif /*----------------------------------------------------------------* * Write IVAS output channels Loading
lib_dec/ivas_init_dec.c +6 −6 Original line number Diff line number Diff line Loading @@ -664,7 +664,7 @@ ivas_error ivas_init_decoder( DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; #ifdef MASA_AND_OBJECTS int32_t sce_brate; int32_t ism_total_brate; #endif error = IVAS_ERR_OK; Loading Loading @@ -968,7 +968,7 @@ ivas_error ivas_init_decoder( ivas_qmetadata_open( &( st_ivas->hQMetaData ) ); k = 0; sce_brate = 0; ism_total_brate = 0; while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] ) { k++; Loading @@ -978,8 +978,8 @@ ivas_error ivas_init_decoder( /* one separated object */ st_ivas->nSCE = 1; sce_brate = sep_object_brate[k - 2][0]; create_sce_dec( st_ivas, 0, sce_brate ); ism_total_brate = sep_object_brate[k - 2][0]; create_sce_dec( st_ivas, 0, ism_total_brate ); reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); Loading @@ -999,7 +999,7 @@ ivas_error ivas_init_decoder( { temp_brate[sce_id] = sep_object_brate[k - 2][st_ivas->nSCE - 1]; sce_brate += temp_brate[sce_id]; ism_total_brate += temp_brate[sce_id]; if ( ( error = create_sce_dec( st_ivas, sce_id, temp_brate[sce_id] ) ) != IVAS_ERR_OK ) { Loading @@ -1024,7 +1024,7 @@ ivas_error ivas_init_decoder( } st_ivas->nCPE = 1; create_cpe_dec( st_ivas, 0, ( ( ivas_total_brate - sce_brate ) / st_ivas->nchan_transport ) * CPE_CHANNELS ); // VE2Nokia: could be simplified - nchan_transport is always 2 here create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ); for ( n = 0; n < CPE_CHANNELS; n++ ) { Loading
lib_dec/ivas_masa_dec.c +14 −13 Original line number Diff line number Diff line Loading @@ -497,26 +497,27 @@ ivas_error ivas_masa_dec_open( MASA_DECODER_HANDLE hMasa; #ifdef MASA_AND_OBJECTS int16_t i; int32_t sce_brate; int32_t ism_total_brate; #endif if ( ( hMasa = (MASA_DECODER_HANDLE) malloc( sizeof( MASA_DECODER ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA decoder\n" ) ); } #ifdef MASA_AND_OBJECTS sce_brate = 0; ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { sce_brate += st_ivas->hSCE[i]->element_brate; ism_total_brate += st_ivas->hSCE[i]->element_brate; } } #endif ivas_masa_set_elements( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE #ifdef MASA_AND_OBJECTS , st_ivas->ivas_format, st_ivas->ism_mode, sce_brate st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); Loading Loading @@ -655,7 +656,7 @@ static ivas_error ivas_masa_dec_config( ivas_error error; #ifdef MASA_AND_OBJECTS int32_t ivas_total_brate; int32_t sce_brate; int32_t ism_total_brate; #endif error = IVAS_ERR_OK; Loading @@ -664,16 +665,16 @@ static ivas_error ivas_masa_dec_config( #ifdef MASA_AND_OBJECTS ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; sce_brate = 0; ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( i = 0; i < st_ivas->nSCE; i++ ) { sce_brate += st_ivas->hSCE[i]->element_brate; ism_total_brate += st_ivas->hSCE[i]->element_brate; } } ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, sce_brate ); ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE, st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate ); if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) { Loading @@ -696,7 +697,6 @@ static ivas_error ivas_masa_dec_config( return error; } st_ivas->hQMetaData->numTwoDirBands = st_ivas->hMasa->config.numTwoDirBands; st_ivas->hQMetaData->useLowerRes = 0; Loading Loading @@ -1281,7 +1281,7 @@ ivas_error ivas_masa_dec_reconfigure( int32_t ivas_total_brate, last_ivas_total_brate; ivas_error error; #ifdef MASA_AND_OBJECTS int32_t sce_brate; int32_t ism_total_brate; #endif error = IVAS_ERR_OK; Loading Loading @@ -1346,19 +1346,20 @@ ivas_error ivas_masa_dec_reconfigure( } } #ifdef MASA_AND_OBJECTS sce_brate = 0; ism_total_brate = 0; if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->nSCE > 0 && ( st_ivas->ism_mode == ISM_MASA_MODE_DISC || st_ivas->ism_mode == ISM_MASA_MODE_ONE_OBJ ) ) { for ( n = 0; n < st_ivas->nSCE; n++ ) { sce_brate += st_ivas->hSCE[n]->element_brate; ism_total_brate += st_ivas->hSCE[n]->element_brate; } } #endif ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp #ifdef MASA_AND_OBJECTS , st_ivas->ivas_format, st_ivas->ism_mode, sce_brate st_ivas->ivas_format, st_ivas->ism_mode, ism_total_brate #endif ); Loading