/* The modulated lapped transform, this takes transform coefficients and transforms them into timedomain samples. Apply transform window, overlap buffers, apply gain profile and buffer management. */
static void imlt_gain(COOKContext *q, float *inbuffer, cook_gains *gains_ptr, float *previous_buffer)
/* The modulated lapped transform, this takes transform coefficients and transforms them into timedomain samples. Apply transform window, overlap buffers, apply gain profile and buffer management. */
static void imlt_gain(COOKContext *q, float *inbuffer, cook_gains *gains_ptr, float *previous_buffer)
{
    float *buffer0 = q->mono_mdct_output;
    float *buffer1 = q->mono_mdct_output + q->samples_per_channel;
    int i;
    ff_imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
    q->imlt_window (q, buffer1, gains_ptr, previous_buffer);
    for (i = 0; i < 8; i++) {
        if (gains_ptr->now[i] || gains_ptr->now[i + 1])
            q->interpolate(q, &buffer1[q->gain_size_factor * i],
                           gains_ptr->now[i], gains_ptr->now[i + 1]);
    }
    memcpy(previous_buffer, buffer0, sizeof(float)*q->samples_per_channel);
}