Commit b8f6a84d authored by vaclav's avatar vaclav
Browse files

port CR

parent 872d8f9c
Loading
Loading
Loading
Loading
Loading
+2 −56
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();
@@ -3716,12 +3701,7 @@ 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;

@@ -3782,13 +3762,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,40 +3777,23 @@ 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++ )
            {
@@ -3846,26 +3804,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx(
            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