Skip to content

Should we do dred_compute_latents in DTX? #406

Open
@shuanzhu

Description

@shuanzhu

We found that the average cost time doubled in silence segment compared with in voiced segment when enable DRED.

After checking the code, dred_compute_latents will always on even in DTX opus would send empty packet, and minor input will cause a huge increase in GRU's calculations.
To resolve this problem, we tried to enable OPUS_FLOAT_APPROX, but it didn't work, and then we add _mm_setcsr(csr | 0x8040) when do encode in our code, it works.

To significantly save our CPU, We want to ask you experts should we still do dred_compute_latents in DTX? To be specific, could we change to:

#ifdef ENABLE_DRED
    opus_int32 in_dtx = 0;
    if ( st->dred_duration > 0 && st->dred_encoder.loaded && opus_encoder_ctl(st, OPUS_GET_IN_DTX_REQUEST(in_dtx)) == OPUS_OK && !in_dtx ) {
        int frame_size_400Hz;
        /* DRED Encoder */
        dred_compute_latents( &st->dred_encoder, &pcm_buf[total_buffer*st->channels], frame_size, total_buffer, st->arch );
        frame_size_400Hz = frame_size*400/st->Fs;
        OPUS_MOVE(&st->activity_mem[frame_size_400Hz], st->activity_mem, 4*DRED_MAX_FRAMES-frame_size_400Hz);
        for (i=0;i<frame_size_400Hz;i++)
           st->activity_mem[i] = activity;
    } else {
        st->dred_encoder.latents_buffer_fill = 0;
        OPUS_CLEAR(st->activity_mem, DRED_MAX_FRAMES);
    }
#endif

???

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions