From 206b4c95262e0294162f4724c08ad6cad3b6b395 Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Fri, 13 Feb 2026 09:27:09 +0530 Subject: [PATCH] Revert moving of declarations from local blocks. --- apps/decoder.c | 12 ++++++------ lib_dec/ivas_init_dec.c | 18 +++++++++++++----- lib_dec/ivas_ism_param_dec.c | 16 ++++++++-------- lib_enc/ivas_init_enc.c | 14 ++++++++------ lib_enc/ivas_osba_enc.c | 3 +-- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 98b240852c..44af4ba1e2 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1901,7 +1901,7 @@ static ivas_error initOnFirstGoodFrame( IVAS_RTP *srRtp, /* o : */ SplitFileReadWrite **splitRendWriter ) { - int16_t i, j, isSplitRend, isSplitCoded; + int16_t isSplitRend, isSplitCoded; ivas_error error = IVAS_ERR_UNKNOWN; /* Now delay, number of output channels and frame size are known */ @@ -2050,7 +2050,7 @@ static ivas_error initOnFirstGoodFrame( return IVAS_ERR_FAILED_ALLOC; } - for ( i = 0; i < numInitialBadFrames; ++i ) + for ( int16_t i = 0; i < numInitialBadFrames; ++i ) { if ( isSplitRend ) { @@ -2110,7 +2110,7 @@ static ivas_error initOnFirstGoodFrame( return error; } - for ( i = 0; i < *pNumObj; ++i ) + for ( int16_t i = 0; i < *pNumObj; ++i ) { if ( ( error = IsmFileWriter_open( arg.outputWavFilename, i, &ismWriters[i] ) ) != IVAS_ERR_OK ) { @@ -2119,10 +2119,10 @@ static ivas_error initOnFirstGoodFrame( } } - for ( j = 0; j < numInitialBadFrames; ++j ) + for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { /* write zero metadata */ - for ( i = 0; i < *pNumObj; ++i ) + for ( int16_t i = 0; i < *pNumObj; ++i ) { IVAS_ISM_METADATA IsmMetadata; @@ -2172,7 +2172,7 @@ static ivas_error initOnFirstGoodFrame( return error; } - for ( j = 0; j < numInitialBadFrames; ++j ) + for ( int16_t j = 0; j < numInitialBadFrames; ++j ) { if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index ed50770248..38e8225dbf 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -573,7 +573,7 @@ ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t k, n, idx, num_bits_read; + int16_t k, idx, num_bits_read; int16_t nchan_ism, element_mode_flag; Decoder_State *st; int32_t ivas_total_brate; @@ -784,8 +784,12 @@ ivas_error ivas_dec_setup( /*correct number of CPEs for discrete ISM coding*/ if ( st_ivas->ini_frame > 0 && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { - n = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n + 1 ) >> 1; + { + int16_t n; + + n = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n + 1 ) >> 1; + } } } @@ -1865,8 +1869,12 @@ ivas_error ivas_init_decoder( if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { - n = st_ivas->nchan_transport + st_ivas->nchan_ism; - st_ivas->nCPE = ( n + 1 ) >> 1; + { + int16_t n_all; + + n_all = st_ivas->nchan_transport + st_ivas->nchan_ism; + st_ivas->nCPE = ( n_all + 1 ) >> 1; + } st_ivas->element_mode_init = IVAS_CPE_MDCT; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index b49fb1f6b2..723451aec0 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -697,11 +697,6 @@ void ivas_ism_dec_digest_tc( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { - int16_t azimuth, elevation; - float elevation_f; - int16_t i; - int16_t interpolator_length; - ivas_dec_td_renderers_adapt_subframes( st_ivas ); if ( st_ivas->renderer_type == RENDERER_TD_PANNING || @@ -713,11 +708,14 @@ void ivas_ism_dec_digest_tc( st_ivas->renderer_type == RENDERER_OSBA_STEREO || ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->hDecoderConfig->Opt_Headrotation == 0 ) ) { + int16_t i; /* we have a full frame interpolator, adapt it */ /* for BE testing */ if ( ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) == st_ivas->hTcBuffer->n_samples_available ) { + int16_t interpolator_length; + interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || @@ -761,17 +759,17 @@ void ivas_ism_dec_digest_tc( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ) && st_ivas->hCombinedOrientationData == NULL ) { - elevation_f = st_ivas->hIsmMetaData[i]->edited_elevation; + float elevation = st_ivas->hIsmMetaData[i]->edited_elevation; if ( st_ivas->hIntSetup.is_planar_setup ) { /* If no elevation support in output format, then rendering should be done with zero elevation */ - elevation_f = 0.f; + elevation = 0.f; } if ( st_ivas->hEFAPdata != NULL ) { - efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], st_ivas->hIsmMetaData[i]->edited_azimuth, elevation_f, EFAP_MODE_EFAP ); + efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], st_ivas->hIsmMetaData[i]->edited_azimuth, elevation, EFAP_MODE_EFAP ); v_multc( st_ivas->hIsmRendererData->gains[i], st_ivas->hIsmMetaData[i]->edited_gain, st_ivas->hIsmRendererData->gains[i], st_ivas->hEFAPdata->numSpk ); } } @@ -780,6 +778,8 @@ void ivas_ism_dec_digest_tc( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { // TODO tmu review when #215 is resolved + int16_t azimuth, elevation; + azimuth = (int16_t) floorf( st_ivas->hIsmMetaData[i]->edited_azimuth + 0.5f ); elevation = (int16_t) floorf( st_ivas->hIsmMetaData[i]->edited_elevation + 0.5f ); diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index b270e8dbc1..c47124cb39 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -390,10 +390,6 @@ ivas_error ivas_init_encoder( int32_t element_brate_tmp[MAX_NUM_OBJECTS]; ENCODER_CONFIG_HANDLE hEncoderConfig; ivas_error error; - int32_t ism_total_brate; - int16_t k; - int16_t n_all; - int32_t brate_sce, brate_cpe; error = IVAS_ERR_OK; @@ -639,6 +635,8 @@ ivas_error ivas_init_encoder( } else if ( ivas_format == MASA_ISM_FORMAT ) { + int32_t ism_total_brate; + int16_t k; st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, hEncoderConfig->nchan_ism ); st_ivas->nchan_transport = 2; @@ -754,9 +752,12 @@ ivas_error ivas_init_encoder( else { /* allocate and initialize MCT core coder */ - n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; - st_ivas->nCPE = ( n_all + 1 ) >> 1; + { + int16_t n_all; + n_all = st_ivas->nchan_transport + st_ivas->hEncoderConfig->nchan_ism; + st_ivas->nCPE = ( n_all + 1 ) >> 1; + } for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) @@ -864,6 +865,7 @@ ivas_error ivas_init_encoder( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { + int32_t brate_sce, brate_cpe; ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( hEncoderConfig->element_mode_init ), ivas_total_brate ); diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index d12cd4b124..c7bf6ceb16 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -386,7 +386,6 @@ void ivas_osba_enc( { float data_out_f[MAX_INPUT_CHANNELS][L_FRAME48k]; int16_t n, delay_s; - int16_t azimuth, elevation; delay_s = NS2SA( input_Fs, IVAS_FB_ENC_DELAY_NS ); if ( ism_mode == ISM_MODE_NONE ) @@ -410,7 +409,7 @@ void ivas_osba_enc( } else { - + int16_t azimuth, elevation; /* delay ISM input channels to match the SBA encoder delay */ for ( n = 0; n < nchan_ism; n++ ) { -- GitLab