Commit 902c4f33 authored by vaclav's avatar vaclav
Browse files

fix crashes in native MASA decoder; changes are within OMASA_BRATE_SW

parent 26a34518
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -900,6 +900,10 @@ ivas_error ivas_dec(
        st_ivas->ini_active_frame++;
    }

#ifdef OMASA_BRATE_SW
    st_ivas->last_ivas_format = st_ivas->ivas_format;
#endif

#ifdef DEBUG_MODE_INFO
    dbgwrite( &st_ivas->bfi, sizeof( int16_t ), 1, output_frame, "res/bfi" );
    dbgwrite( &st_ivas->BER_detect, sizeof( int16_t ), 1, output_frame, "res/BER_detect" );
+15 −8
Original line number Diff line number Diff line
@@ -181,11 +181,9 @@ ivas_error ivas_dec_setup(
                if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) )
                {
#ifdef OMASA_BRATE_SW
                    if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK )
                    if ( st_ivas->last_ivas_format == MASA_FORMAT )
                    {
                        return error;
                    }
#else
#endif
                        if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 )
                        {
                            st_ivas->hCPE[0]->nchan_out = 1;
@@ -197,6 +195,15 @@ ivas_error ivas_dec_setup(
                                return error;
                            }
                        }
#ifdef OMASA_BRATE_SW
                    }
                    else
                    {
                        if ( ( error = ivas_omasa_dec_config( st_ivas ) ) != IVAS_ERR_OK )
                        {
                            return error;
                        }
                    }
#endif
                }
            }
+8 −0
Original line number Diff line number Diff line
@@ -1478,6 +1478,14 @@ ivas_error ivas_masa_dec_reconfigure(
#endif
    );

#ifdef OMASA_BRATE_SW
    if ( st_ivas->ivas_format == MASA_FORMAT )
    {
        st_ivas->nchan_ism = 0;
        st_ivas->ism_mode = ISM_MODE_NONE;
    }
#endif

    return error;
}

+10 −38
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ ivas_error ivas_omasa_dec_config(
{
    int16_t k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD;
    int32_t ivas_total_brate, ism_total_brate, cpe_brate;
    IVAS_FORMAT ivas_format_old;
    ISM_MODE ism_mode_old;
    ivas_error error;

@@ -157,26 +156,10 @@ ivas_error ivas_omasa_dec_config(
    ism_mode_old = ivas_omasa_ism_mode_select( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism );
    st_ivas->ism_mode = ism_mode_old;

    ivas_format_old = st_ivas->ivas_format;
#ifdef OMASA_UPDATES
    if ( ism_mode_old == ISM_MASA_MODE_MASA_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC )
#else
    if ( ism_mode_old == ISM_MASA_MODE_PARAM || ism_mode_old == ISM_MASA_MODE_PARAM_ONE_OBJ || ism_mode_old == ISM_MASA_MODE_DISC )
#endif
    {
        st_ivas->ivas_format = MASA_ISM_FORMAT;
    }
    ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    nSCE_old = st_ivas->nSCE;
    nchan_hp20_old = getNumChanSynthesis( st_ivas );

    /* reconstruct parameters */
    st_ivas->ivas_format = ivas_format_old;
    if ( st_ivas->ivas_format == MASA_FORMAT )
    {
        st_ivas->nchan_ism = 0;
    }

    /* set ism_mode of current frame */
    st_ivas->ism_mode = ivas_omasa_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism );

@@ -191,7 +174,6 @@ ivas_error ivas_omasa_dec_config(
        return error;
    }

    // VE!!!!!: verification needed, see comment "/* Todo: Nokia make for MASA_ISM*/" in ivas_masa_dec_reconfigure()
    if ( cpe_brate < MASA_STEREO_MIN_BITRATE )
    {
        st_ivas->hCPE[0]->nchan_out = 1;
@@ -219,15 +201,6 @@ ivas_error ivas_omasa_dec_config(
    }

    /* reconfigure core-coders for ISMs */
    if ( st_ivas->ivas_format == MASA_FORMAT )
    {
        if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, 1, 2, 0, -1, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK )
        {
            return error;
        }
    }
    else
    {
    k = 0;
    while ( k < SIZE_IVAS_BRATE_TBL && ivas_total_brate != ivas_brate_tbl[k] )
    {
@@ -243,7 +216,6 @@ ivas_error ivas_omasa_dec_config(
    {
        return error;
    }
    }

    if ( ism_mode_old != st_ivas->ism_mode )
    {
+3 −0
Original line number Diff line number Diff line
@@ -1218,6 +1218,9 @@ typedef struct Decoder_Struct
    DECODER_CONFIG_HANDLE hDecoderConfig;                   /* Decoder configuration structure */

    IVAS_FORMAT ivas_format;                                /* IVAS format */
#ifdef OMASA_BRATE_SW
    IVAS_FORMAT last_ivas_format;                           /* last frame IVAS format */
#endif
    int16_t sid_format;                                     /* IVAS format indicator from SID frame */
    int16_t nchan_transport;                                /* number of transport channels */
    IVAS_OUTPUT_SETUP hOutSetup;                            /* output setup structure */