Skip to content

memory optimization: Unused memory in ISM renderer handle

There is an unused part of memory in the ISM renderer handle:

ivas_ism_renderer_open() 77 malloc sizeof( ISM_RENDERER_DATA ) 1928 bytes 27%

which is related to the definition of the handle members:

typedef struct renderer_struct
{
    float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS];
    float *interpolator;
    int16_t interpolator_length;
    float gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS];

} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE;

First, it seems that MAX_CICP_CHANNELS - 1 could be replaced by the number of decoded objects. Then, the number of output channels might be (?) made dependent on the actual number of output channels used.

When doing a minimalistic fix that replaces MAX_CICP_CHANNELS - 1 by MAX_NUM_OBJECTS, a saving of 1,408 bytes is achieved.

Edited by vaclav