Skip to content

Overcomplicated DTX sanity check

In function configureEncoder(), there is the following DTX sanity check:

    if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT &&
         !( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate <= IVAS_128k ) &&
         hEncoderConfig->ivas_format != SBA_FORMAT &&
         ( hEncoderConfig->element_mode_init != IVAS_CPE_DFT && hEncoderConfig->element_mode_init != IVAS_CPE_TD ) && 
        !( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 1 ) &&
         hEncoderConfig->element_mode_init != IVAS_CPE_MDCT )
    {
        return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." );
    }

Obviously, due to the checks against element_mode_init, the condition is always false in STEREO, MC, and SBA and thus it seems that it can be cleaned out as follows:

    if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT &&
         !( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate <= IVAS_128k ) &&
         !( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 1 ) )
    {
        return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." );
    }

Please let me know if I overlooked anything.

Edited by vaclav