Commit 214ddc70 authored by vaclav's avatar vaclav
Browse files

introduce function ivas_omasa_rend() in order to safe stack memory

parent 1d5d629e
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -5216,6 +5216,14 @@ void ivas_merge_masa_transports(
    const int16_t num_transport_channels                        /* i  : Number of transport audio signals       */
);

ivas_error ivas_masa_ism_data_open(
    Decoder_Struct* st_ivas                                     /* i/o: IVAS decoder handle                     */
);

void ivas_masa_ism_data_close(
    MASA_ISM_DATA_HANDLE *hMasaIsmData                          /* i/o: MASA_ISM rendering handle               */
);

ivas_error ivas_omasa_ism_metadata_dec(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    const int32_t ism_total_brate,                              /* i  : ISM total bitrate                       */
@@ -5225,12 +5233,10 @@ ivas_error ivas_omasa_ism_metadata_dec(
    int16_t nb_bits_metadata[]                                  /* o  : number of ISM metadata bits             */
);

ivas_error ivas_masa_ism_data_open(
    Decoder_Struct* st_ivas                                     /* i/o: IVAS decoder handle                     */
);

void ivas_masa_ism_data_close(
    MASA_ISM_DATA_HANDLE *hMasaIsmData                          /* i/o: MASA_ISM rendering handle               */
void ivas_omasa_rend(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                  */
    float output[][L_FRAME48k],                                 /* o  : output synthesis signal                 */
    const int16_t output_frame                                  /* i  : output frame length per channel         */
);

void preProcessStereoTransportsForMovedObjects(
+3 −25
Original line number Diff line number Diff line
@@ -509,37 +509,15 @@ ivas_error ivas_dec(
        {
            ivas_mono_downmix_render_passive( st_ivas, output, output_frame );
        }
        else if ( st_ivas->hDirAC )
        else if ( st_ivas->renderer_type == RENDERER_DIRAC ) // VE2TP: please verify, it was "else if (st_ivas->hDirAC)"
        {
            if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC )
            {
                //ivas_omasa_rend( st_ivas, output );


                float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];

                if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
                {
                    //     mvr2r( output[2], data_separated_objects[0], output_frame );
                }
                else
                {
                    for ( n = 0; n < st_ivas->nchan_ism; n++ )
                    {
                        //       mvr2r( output[n + 2], data_separated_objects[n], output_frame );
                    }
                }

                dirac_read_idx = st_ivas->hDirAC->dirac_read_idx;

                ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 );

                st_ivas->hDirAC->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */

                ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame );
                ivas_omasa_rend( st_ivas, output, output_frame );
            }
            else
            {
                // VE2TP: this should never happen (ISM_MODE_NONE is renderered via ivas_format==MASA_FORMAT if branch)
                ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 );
            }
        }
+38 −0
Original line number Diff line number Diff line
@@ -468,4 +468,42 @@ ivas_error ivas_omasa_ism_metadata_dec(
    return IVAS_ERR_OK;
}


/*--------------------------------------------------------------------------*
 * ivas_omasa_rend()
 *
 * Rendering in OMASA format
 *--------------------------------------------------------------------------*/

void ivas_omasa_rend(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder structure          */
    float output[][L_FRAME48k], /* o  : output synthesis signal         */
    const int16_t output_frame  /* i  : output frame length per channel */
)
{
    int16_t n, dirac_read_idx;
    float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];

    if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
    {
        mvr2r( output[2], data_separated_objects[0], output_frame );
    }
    else
    {
        for ( n = 0; n < st_ivas->nchan_ism; n++ )
        {
            mvr2r( output[n + 2], data_separated_objects[n], output_frame );
        }
    }

    dirac_read_idx = st_ivas->hDirAC->dirac_read_idx;

    ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 );

    st_ivas->hDirAC->dirac_read_idx = dirac_read_idx; /* Original read index is needed for the next function which will update it again */

    ivas_masa_ism_separate_object_render( st_ivas, data_separated_objects, output, output_frame );

    return;
}
#endif