Commit c1d1b61d authored by Mohammadreza Naghibzadeh's avatar Mohammadreza Naghibzadeh
Browse files

Merge remote-tracking branch 'origin/main' into 2084-fix-fp-leftovers-IVAS_ENC_FeedObjectMetadata

parents 6d23c67f 6f242bfb
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -992,6 +992,9 @@ int main(

    while ( 1 )
    {
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        int16_t bfi = 0;
#endif
        int16_t num_in_channels;
        num_in_channels = inBuffer.config.numChannels;

@@ -1000,7 +1003,11 @@ int main(
        {
            ivas_error error_tmp;
            numSamplesRead = (int16_t) inBufferSize;
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi );
#else
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten );
#endif
            if ( error_tmp != IVAS_ERR_OK )
            {
                if ( error_tmp == IVAS_ERR_END_OF_FILE )
@@ -1067,19 +1074,33 @@ int main(
        /* Read from split renderer bfi file if specified */
        if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame )
        {
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            int16_t bfi;
#endif
            if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
#endif
        }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        if ( splitBinNeedsNewFrame )
        {
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
        }
#endif

        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
+0 −8
Original line number Diff line number Diff line
@@ -1415,16 +1415,8 @@ typedef enum
#define LFE_CHANNEL                             3

#define MIN_LFE_NRG                             0.5f
#ifdef ADJUST_MCT_CHANNELS_MAX   
#define MCT_MAX_CHANNELS                        11                          /* == 7.1.4 LS channels without the LFE channel */
#define MCT_MAX_BLOCKS                          ( ( MCT_MAX_CHANNELS + 1 ) / CPE_CHANNELS )    /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/
#else
#define MCT_MAX_CHANNELS                        MAX_TRANSPORT_CHANNELS
#define MCT_MAX_BLOCKS                          ( MCT_MAX_CHANNELS / CPE_CHANNELS )    /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/

#define MAX_NUM_DATA                            max( MCT_MAX_CHANNELS, 4 )
#endif

#define NBBITS_MCT_RATIO                        4
#define BITRATE_MCT_RATIO_RANGE                 ( 1 << NBBITS_MCT_RATIO )   /* Range of the coded bitrate distribution ratio */

+13 −5
Original line number Diff line number Diff line
@@ -1005,12 +1005,20 @@ Word16 IGF_MapBitRateToIndex(
    const Word16 rf_mode       /* i  :  flag to signal the RF mode */
);

#ifdef NONBE_1303_REND_GRANULARITY
Word16 ivas_jbm_dec_get_render_granularity_fx(
    const RENDERER_TYPE renderer_type,                          /* i  : renderer type                                               */
    const RENDERER_TYPE renderer_type_sec,                      /* i  : secondary renderer type                                     */
    const int32_t output_Fs                                     /* i  : sampling rate                                               */
);
#else
Word16 ivas_jbm_dec_get_render_granularity(
    const RENDERER_TYPE rendererType, /* i  : renderer type     */
    const IVAS_FORMAT ivas_format,    /* i  : ivas format */
    const MC_MODE mc_mode,            /* i  : MC mode */
    const Word32 output_Fs            /* i  : sampling rate     */
); 
#endif

// ivas_stereo_dft_com.c
void stereo_dft_config_fx(
@@ -6252,7 +6260,7 @@ void ivas_renderer_select(

#ifdef FIX_CREND_SIMPLIFY_CODE
/*! r: secondary binaural renderer type */
RENDERER_TYPE ivas_renderer_secondary_select(
RENDERER_TYPE ivas_renderer_secondary_select_fx(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#endif
@@ -6275,15 +6283,15 @@ int16_t is_DTXrate(
 * JBM prototypes
 *----------------------------------------------------------------------------------*/

ivas_error ivas_jbm_dec_set_discard_samples(
ivas_error ivas_jbm_dec_set_discard_samples_fx(
    Decoder_Struct *st_ivas                                     /* i/o: main IVAS decoder structre                                  */
);

TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode(
TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode_fx(
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder handle                                         */
);

void ivas_jbm_dec_tc_buffer_close(
void ivas_jbm_dec_tc_buffer_close_fx(
    DECODER_TC_BUFFER_HANDLE *phTcBuffer                        /* i/o: TC buffer handle                                            */
);

+5 −1
Original line number Diff line number Diff line
@@ -141,7 +141,6 @@
#define NONBE_1377_REND_DIRATT_CONF                     /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */
#define FIX_1377_HANDLE_ERROR_CODE                      /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */
#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK       /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/
#define ADJUST_MCT_CHANNELS_MAX                         /* FhG: set correct max mct channels constant*/
#define FIX_1053_REVERB_RECONFIGURATION
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define FIX_1113_EXTREND_ISAR                           /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */
@@ -157,8 +156,13 @@
#define FIX_1349_TNS_CRASH                              /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING           /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms  in PhECU-PLC  */
#define FIX_1179_USAN_PHASEECU                          /* Eri: issue 1179:  better handling of 16 bit wrap around for very long(>200ms) FER-bursts   */
#define NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching */
#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH               /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */
#define NONBE_1293_CRASH_FIRST_FRAME_LOST               /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */
#define FIX_1384_MSAN_stereo_tcx_core_enc               /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */
#define NONBE_FIX_1297_SPAR_JBM_MEM_SAN                 /* Dolby: issue 1297, SPAR + JBM + BR switch memory sanitizer */
#define NONBE_1303_GRANULARITY_OSBA_REND                /* VA: issue 1303: Correctly set the granularity in OSBA, Disc mode, and BINAURAL_ROOM_REVERB output */
#define NONBE_1303_REND_GRANULARITY                     /* VA: issue 1303: Renderer granularity revision */

// object-editing feature porting
#define OBJ_EDITING_API                                 /* object editing changes related to the API */
+30 −5
Original line number Diff line number Diff line
@@ -690,7 +690,12 @@ ivas_error ivas_dec_setup(
                st_ivas->nchan_transport = 1;
                move16();
            }

            /* this should be non-zero if original input format was MASA_ISM_FORMAT */
#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
            st_ivas->ism_mode = ISM_MODE_NONE;
            move16();
#endif
            st_ivas->nchan_ism = add( st_ivas->bit_stream[sub( k, 3 )], shl( st_ivas->bit_stream[sub( k, 2 )], 1 ) );

            IF( GT_16( st_ivas->nchan_ism, 0 ) )
@@ -1008,6 +1013,17 @@ ivas_error ivas_dec_setup(
            }
        }

#ifdef NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH
        test();
        IF( GT_16( st_ivas->ini_frame, 0 ) && EQ_32( st_ivas->ivas_format, MASA_FORMAT ) )
        {
            st_ivas->nchan_ism = 0;
            move16();
            st_ivas->ism_mode = ISM_MODE_NONE;
            move16();
        }

#endif
        IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
        {
            ISM_MODE last_ism_mode = st_ivas->ism_mode;
@@ -2645,7 +2661,7 @@ ivas_error ivas_init_decoder_fx(
                return error;
            }
        }

#ifndef NONBE_1303_REND_GRANULARITY
        granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES );

        n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );
@@ -2655,6 +2671,7 @@ ivas_error ivas_init_decoder_fx(
        {
            return error;
        }
#endif
    }
    ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) )
    {
@@ -2704,7 +2721,7 @@ ivas_error ivas_init_decoder_fx(

        st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
        move32();

#ifndef NONBE_1303_REND_GRANULARITY
        test();
        IF( ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) && ( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) )
        {
@@ -2727,6 +2744,7 @@ ivas_error ivas_init_decoder_fx(
                return error;
            }
        }
#endif
    }

    IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
@@ -2765,7 +2783,7 @@ ivas_error ivas_init_decoder_fx(

            IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
            {
                IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, output_Fs ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -3013,9 +3031,16 @@ ivas_error ivas_init_decoder_fx(
    IF( st_ivas->hTcBuffer == NULL )
    {
        /* no module has yet open the TC buffer, open a default one */
#ifdef NONBE_1303_REND_GRANULARITY
        granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, ivas_renderer_secondary_select_fx( st_ivas ), output_Fs );
        n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );

        IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) )
        IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode_fx( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ), IVAS_ERR_OK ) )
#else
        n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );

        IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode_fx( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) )
#endif
        {
            return error;
        }
@@ -3535,7 +3560,7 @@ void ivas_destroy_dec_fx(
        st_ivas->hDecoderConfig = NULL;
    }

    ivas_jbm_dec_tc_buffer_close( &st_ivas->hTcBuffer );
    ivas_jbm_dec_tc_buffer_close_fx( &st_ivas->hTcBuffer );

    IF( st_ivas->hJbmMetadata != NULL )
    {
Loading