Skip to content

iDiv_and_mod_32() used with constant denominator

Basic info

Basic info

Bug description

At various places, the integer division is called with a constant denominator (e.g. FRAMES_PER_SEC). At many places this could be easily replaced by a multiplication with 1/denominator.

Occurences:

  • ./lib_com/ivas_fb_mixer_fx.c:940: iDiv_and_mod_32( sampling_rate, FRAMES_PER_SEC, &res_dec1, &res_frac, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:268: iDiv_and_mod_32( L_shr( hCPE->element_brate, 1 ), FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:315: iDiv_and_mod_32( cpe_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:319: iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:324: iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:330: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:360: iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:394: iDiv_and_mod_32( hCPE->element_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:399: iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:404: iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:424: iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:429: iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:462: iDiv_and_mod_32( sts[n]->total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:464: iDiv_and_mod_32( hCPE->element_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:476: iDiv_and_mod_32( L_abs( brate_surplus[n] ), FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:481: iDiv_and_mod_32( brate_surplus[n], FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_cpe_dec_fx.c:587: iDiv_and_mod_32( sts[0]->total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_dirac_dec_fx.c:1265: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_dirac_dec_fx.c:1361: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_init_dec_fx.c:178: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_init_dec_fx.c:243: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_init_dec_fx.c:339: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_init_dec_fx.c:362: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_init_dec_fx.c:510: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_init_dec_fx.c:599: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_init_dec_fx.c:854: iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_ism_metadata_dec_fx.c:211: iDiv_and_mod_32( ism_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_ism_metadata_dec_fx.c:1311: iDiv_and_mod_32( IVAS_SID_5k2 - SID_2k40, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_ism_param_dec_fx.c:935: iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_ism_renderer_fx.c:100: iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_ism_renderer_fx.c:107: iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
  • ./lib_dec/ivas_ism_renderer_fx.c:438: iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec1, &res_frac1, 0 );
  • ./lib_dec/ivas_ism_renderer_fx.c:439: iDiv_and_mod_32( res_dec1, MAX_PARAM_SPATIAL_SUBFRAMES, &res_dec2, &res_frac2, 0 );
  • ./lib_dec/ivas_spar_decoder_fx.c:302: iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &quo, &rem, 0 );
  • ./lib_dec/ivas_spar_decoder_fx.c:405: iDiv_and_mod_32( hDecoderConfig->ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_spar_decoder_fx.c:428: iDiv_and_mod_32( hDecoderConfig->ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_spar_decoder_fx.c:433: iDiv_and_mod_32( hDecoderConfig->ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_spar_decoder_fx.c:1637: iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &quo, &rem, 0 );
  • ./lib_dec/ivas_tcx_core_dec_fx.c:265: iDiv_and_mod_32( st->total_brate, FRAMES_PER_SEC, &L_tmp, &mod, 0 );
  • ./lib_enc/ivas_spar_encoder_fx.c:719: iDiv_and_mod_32( input_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
Edited by vaclav