Commit 8528dc65 authored by vaclav's avatar vaclav
Browse files

Merge branch '1852-basop-PortFlpMr1606' into 'main'

Port MR1606 from float to BASOP

Closes #1852

See merge request !1995
parents 0f671b92 9ba5bed4
Loading
Loading
Loading
Loading
+2 −72
Original line number Diff line number Diff line
@@ -2828,6 +2828,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    }
                    *st_ivas->hCrendWrapper->p_io_qfactor = 11;
                    move16();

#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
                    IF( NE_32( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
                                                                       hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ),
@@ -3548,11 +3549,7 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx(
    const Word16 n_samples_granularity     /* i  : granularity of the renderer/buffer  */
)
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
    Word32 nsamp_to_allocate;
#else
    Word16 nsamp_to_allocate;
#endif
    DECODER_TC_BUFFER_HANDLE hTcBuffer;
    Word16 nMaxSlotsPerSubframe;
    Word16 nchan_residual;
@@ -3597,11 +3594,7 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx(
    hTcBuffer->nb_subframes = MAX_PARAM_SPATIAL_SUBFRAMES;
    move16();
    nsamp_to_allocate = 0;
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
    move32();
#else
    move16();
#endif

    tmp32 = L_mult0( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, hTcBuffer->n_samples_granularity ); // Q0
    tmp = BASOP_Util_Divide3232_Scale( st_ivas->hDecoderConfig->output_Fs, tmp32, &tmp_e );
@@ -3639,13 +3632,8 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx(
            move16();
        }

#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
        nsamp_to_allocate = L_mult0( hTcBuffer->nchan_buffer_full, n_samp_full );
        nsamp_to_allocate = L_add( nsamp_to_allocate, L_mult0( nchan_residual, n_samp_residual ) );
#else
        nsamp_to_allocate = mult0( hTcBuffer->nchan_buffer_full, n_samp_full );
        nsamp_to_allocate = add( nsamp_to_allocate, mult0( nchan_residual, n_samp_residual ) );
#endif

        IF( nsamp_to_allocate == 0 )
        {
@@ -3660,15 +3648,12 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx(
        {
            IF( st_ivas->hDecoderConfig->Opt_tsm )
            {
                /* note: the maximum buffer length is for OSBA DISC mode with ISMs -> 15*(1920+239)=32385 samples */
                IF( ( hTcBuffer->tc_buffer_fx = (Word32 *) malloc( nsamp_to_allocate * sizeof( Word32 ) ) ) == NULL )
                {
                    return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) );
                }
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
                set_zero2_fx( hTcBuffer->tc_buffer_fx, nsamp_to_allocate );
#else
                set32_fx( hTcBuffer->tc_buffer_fx, 0, nsamp_to_allocate );
#endif

                offset = 0;
                move16();
@@ -3706,7 +3691,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx(
 * open and initialize JBM transport channel buffer
 *--------------------------------------------------------------------------*/


ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
    Decoder_Struct *st_ivas,               /* i/o: IVAS decoder structure                  */
    const TC_BUFFER_MODE tc_buffer_mode,   /* i  : new buffer mode                         */
@@ -3716,19 +3700,13 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
    const Word16 n_samples_granularity     /* i  : new granularity of the renderer/buffer  */
)
{
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
    Word32 nsamp_to_allocate, offset;
    Word16 n_samp_full, n_samp_residual, nchan_residual;
#else
    Word16 nsamp_to_allocate, n_samp_full, n_samp_residual, offset, nchan_residual;
#endif
    Word16 ch_idx;
    DECODER_TC_BUFFER_HANDLE hTcBuffer;

    hTcBuffer = st_ivas->hTcBuffer;
    move16();


    /* if granularity changes, adapt subframe_nb_slots */
    IF( NE_16( n_samples_granularity, hTcBuffer->n_samples_granularity ) )
    {
@@ -3782,13 +3760,8 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
        move16();
    }

#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
    nsamp_to_allocate = L_mult0( hTcBuffer->nchan_buffer_full, n_samp_full );
    nsamp_to_allocate = L_add( nsamp_to_allocate, L_mult0( nchan_residual, n_samp_residual ) );
#else
    nsamp_to_allocate = imult1616( hTcBuffer->nchan_buffer_full, n_samp_full );
    nsamp_to_allocate = add( nsamp_to_allocate, imult1616( nchan_residual, n_samp_residual ) );
#endif

    IF( nsamp_to_allocate == 0 )
    {
@@ -3802,71 +3775,28 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
    {
        IF( st_ivas->hDecoderConfig->Opt_tsm )
        {

            IF( ( hTcBuffer->tc_buffer_fx = (Word32 *) malloc( nsamp_to_allocate * sizeof( Word32 ) ) ) == NULL )
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR JBM TC Buffer\n" ) );
            }
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
            set_zero2_fx( hTcBuffer->tc_buffer_fx, nsamp_to_allocate );
#else
            set32_fx( hTcBuffer->tc_buffer_fx, 0, nsamp_to_allocate );
#endif

            offset = 0;
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
            move32();
#else
            move16();
#endif
            FOR( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ )
            {
                hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset];
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
                offset = L_add( offset, n_samp_full );
#else
                offset = add( offset, n_samp_full );
#endif
            }
            FOR( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ )
            {
                hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset];
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
                offset = L_add( offset, n_samp_residual );
#else
                offset = add( offset, n_samp_residual );
#endif
            }
            FOR( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ )
            {
                hTcBuffer->tc_fx[ch_idx] = NULL;
            }

            hTcBuffer->tc_buff_len = nsamp_to_allocate;
            move16();

            offset = 0;
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
            move32();
#else
            move16();
#endif
            FOR( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ )
            {
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
                offset = L_add( offset, n_samp_full );
#else
                offset = add( offset, n_samp_full );
#endif
            }
            FOR( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ )
            {
#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
                offset = L_add( offset, n_samp_residual );
#else
                offset = add( offset, n_samp_residual );
#endif
            }
        }
        ELSE
        {
+1 −2
Original line number Diff line number Diff line
@@ -986,8 +986,7 @@ typedef struct ivas_masa_ism_data_structure

typedef struct decoder_tc_buffer_structure
{
    Word32 *tc_buffer_fx;                                                                                                               /* the buffer itself                                                        */
    Word16 tc_buff_len;                                                                                                                 /*stores memory length of tc buffer*/
    Word32 *tc_buffer_fx; /* the buffer itself                                                        */                                /*stores memory length of tc buffer*/
    Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc  Q11 for ivas      */ // VE2SB: TBV
    Word16 no_channels;                                                                                                                 /*Stores no of channels in tc_fx with values*/
    Word16 q_tc_fx;