Loading ci/get_id_of_last_job_occurence.py +5 −2 Original line number Diff line number Diff line Loading @@ -65,9 +65,12 @@ def get_job_id(branch_name, job_name, project_id, success_only): if job_name not in resp_jobs.text: continue # find actual job by name # find actual job by name, exclude timed out or stuck jobs for job in resp_jobs.json(): if job["name"] == job_name: name_matches = job["name"] == job_name is_success = job["status"] == "success" has_timed_out = job.get("failure_reason", "") == "stuck_or_timeout_failure" if name_matches and (is_success or not has_timed_out): job_id = job["id"] break if job_id >= 0: Loading ci/index-pages.html +1 −8 Original line number Diff line number Diff line Loading @@ -7,14 +7,7 @@ <h2>Complexity Reports</h2> <ul> <li><a href="complexity-stereo-in-stereo-out-public/index.html">Stereo</a></li> <li><a href="complexity-ism-in-binaural-out-public/index.html">ISM</a></li> <li><a href="complexity-sba-hoa3-in-hoa3-out-public/index.html">SBA</a></li> <li><a href="complexity-mc-in-7_1_4-out-public/index.html">Multichannel</a></li> <li><a href="complexity-masa-in-7_1_4-out-public/index.html">Masa</a></li> <li><a href="complexity-StereoDmxEVS-stereo-in-mono-out-public/index.html">StereoDmxEVS</a></li> </ul> {} <h2>Test Coverage</h2> Loading ci/setup_pages.py +49 −25 Original line number Diff line number Diff line Loading @@ -11,30 +11,30 @@ from get_id_of_last_job_occurence import get_job_id PROJECT_ID_FLOAT_REPO = 49 PROJECT_ID_BASOP_REPO = 77 JOBS_FLOAT_REPO = [ # job names -> hyperlink strings forthe landing page JOBS_FLOAT_REPO = { # old ones no longer running -> replaced by "ext" jobs, remove after some time "complexity-stereo-in-stereo-out", "complexity-ism-in-binaural-out", "complexity-sba-hoa3-in-hoa3-out", "complexity-mc-in-7_1_4-out", "complexity-masa-in-7_1_4-out", "coverage-test-on-main-scheduled", "complexity-stereo-in-stereo-out": "[OLD] Stereo in, stereo out", "complexity-ism-in-binaural-out": "[OLD] ISM in, BINAURAL out", "complexity-sba-hoa3-in-hoa3-out": "[OLD] HOA3 in, HOA3 out", "complexity-mc-in-7_1_4-out": "[OLD] MC in, 7_1_4 out", "complexity-masa-in-7_1_4-out": "[OLD] Masa in, 7_1_4 out", # current ones "complexity-stereo-in-ext-out", "complexity-ism-in-binaural_room_ir-out", "complexity-ism-in-ext-out", "complexity-sba-hoa3-in-ext-out", "complexity-sba-hoa3-in-binaural_room_ir-out", "complexity-mc-in-ext-out", "complexity-mc-in-binaural_room_ir-out", "complexity-masa-in-ext-out", "complexity-masa-in-binaural-out", "complexity-omasa-in-ext-out", "complexity-omasa-in-binaural-out", # "timeless" jobs (survivors from the old jobs) "complexity-StereoDmxEVS-stereo-in-mono-out", ] "complexity-stereo-in-ext-out": "Stereo in, EXT out", "complexity-ism-in-binaural_room_ir-out": "ISM in, BINAURAL_ROOM_IR out", "complexity-ism-in-ext-out": "ISM in, EXT out", "complexity-sba-hoa3-in-ext-out": "HOA3 in, EXT out", "complexity-sba-hoa3-in-binaural_room_ir-out": "HOA3 in, BINAURAL_ROOM_IR out", "complexity-mc-in-ext-out": "MC in, EXT out", "complexity-mc-in-binaural_room_ir-out": "MC in, BINAURAL_ROOM_IR out", "complexity-masa-in-ext-out": "MASA in, EXT out", "complexity-masa-in-binaural-out": "MASA in, BINAURAL out", "complexity-omasa-in-ext-out": "OMASA in, EXT out", "complexity-omasa-in-binaural-out": "OMASA in, BINAURAL out", # "timeless" jobs (survivors from the old jobs or not complexity) "complexity-StereoDmxEVS-stereo-in-mono-out": "StereoDmxEVS, Stereo in, Mono out", "coverage-test-on-main-scheduled": "Coverage", } JOBS_BASOP_REPO = [ "ivas-pytest-mld-long-dec", "ivas-pytest-mld-long-dec-lev+10", Loading Loading @@ -67,8 +67,7 @@ def main(): index_html = PUBLIC_FOLDER.joinpath("index.html") if project_id == PROJECT_ID_FLOAT_REPO: src = pathlib.Path("ci/index-pages.html").absolute() shutil.move(src, index_html) create_landing_page_float_repo(jobs, index_html) elif project_id == PROJECT_ID_BASOP_REPO: src = pathlib.Path("ci/basop-pages/basop_index.html").absolute() shutil.move(src, index_html) Loading @@ -76,6 +75,29 @@ def main(): sys.exit(0) def create_landing_page_float_repo(jobs, index_html): # dynamically create the complexity links on the landing page link_html = list() link_html = ["<ul>"] for job, link_text in jobs.items(): if job.startswith("complexity"): line = f'<li><a href="{job}-public/index.html">{link_text}</a></li>' link_html.append(line) link_html.append("</ul>") link_html_text = "\n".join(link_html) index_pages_tmpl_path = ( pathlib.Path(__file__).parent.joinpath("index-pages.html").absolute() ) with open(index_pages_tmpl_path) as f: index_pages_tmpl = f.read() print(index_pages_tmpl) index_pages_tmpl = index_pages_tmpl.format(link_html_text) with open(index_html, "w") as f: f.write(index_pages_tmpl) def get_artifacts_for_jobs_and_return_num_failed( jobs: list, project_id: int, success_only: bool ) -> int: Loading @@ -89,7 +111,9 @@ def get_artifacts_for_jobs_and_return_num_failed( failed_count = 0 for job in jobs: job_id = get_job_id( os.environ["CI_DEFAULT_BRANCH"], job, project_id, success_only) job_id = get_job_id( os.environ["CI_DEFAULT_BRANCH"], job, project_id, success_only ) print(f"{job_id} - {job}") try: Loading lib_com/gs_bitallocation.c +2 −193 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ #include "wmc_auto.h" #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ Loading @@ -71,7 +70,6 @@ #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ #endif /*-------------------------------------------------------------------* * Local function prototypes Loading @@ -81,14 +79,12 @@ static float Find_bit_frac( const int16_t nb_band, const int16_t remaining_bits static void reajust_bits( float *bits_per_bands, const int16_t st_band, const int16_t end_band, const int16_t sum_bit_in, const int16_t bit_bdgt_in ); #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ); static Word16 Find_bit_alloc_IVAS_int( const Word32 core_brate, const Word16 GSC_IVAS_mode, const Word16 Diff_len, const Word16 nb_tot_bands, const Word16 L_frame, Word16 *bit, Word16 *max_ener_band, float *ener_vec, float *bits_per_bands ); static Word16 maximum_fx( const Word16 *vec_fx, const Word16 lvec_fx, Word16 *max_fx ); #endif /*-------------------------------------------------------------------* * bands_and_bit_alloc() Loading Loading @@ -127,12 +123,8 @@ void bands_and_bit_alloc( int16_t pos, band; float SWB_bit_budget; float bits_per_bands[MBANDS_GN_BITALLOC16k]; #ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING float fzero_val, mp, mb, nb_bands_adj, bit_adj; int16_t nb_pulse_per_band[MBANDS_GN_BITALLOC16k]; #else float fzero_val; #endif /* initializations */ nb_tot_bands = 16; set_f( bits_per_bands, 0.0f, MBANDS_GN_BITALLOC16k ); Loading Loading @@ -231,189 +223,8 @@ void bands_and_bit_alloc( { if ( GSC_IVAS_mode > 0 ) { #ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING SWB_bit_budget = *bit; st_band = 5; set_f( bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* 2- Decide the pourcentage of bits allocated to LF (between 50-75%) depending of the temporal contribution in GSC */ bit_fracf = ( -0.125f * Diff_len + 76.0f ) / 100; bit_fracf = check_bounds( bit_fracf, 0.50f, 0.75f ); /* Adjusment of the bitrate between LF and HF base on the content type */ /* 1 = new GSC bit alloc 2 = GSC bit alloc for tc frame 3 = more music like (should not happen often given music is coded with dft) */ if ( GSC_IVAS_mode <= 3 ) { nb_bands_max -= 6; } if ( GSC_IVAS_mode == 2 ) { bit_fracf += 0.1f; nb_bands_max--; } if ( GSC_IVAS_mode == 3 ) { bit_fracf -= 0.1f; nb_bands_max += 3; } /* First find how much we want to share between LF and HF, at low bitrate, a miminum of bits is needed in LF by limitating the number of bands*/ /* Adjust the number of band based on the content type and bitrate */ nb_bands_adj = 1.0f; if ( GSC_IVAS_mode == 1 && core_brate < GSC_L_RATE_STG ) { nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f; } else if ( GSC_IVAS_mode != 2 && core_brate > GSC_H_RATE_STG ) { nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f; } nb_bands_max = (int16_t) ( nb_bands_max * nb_bands_adj + 0.5f ); nb_bands_max = check_bounds_s( nb_bands_max, 5, nb_tot_bands ); bit_fracf *= SWB_bit_budget; /* Estimation of the number of bit used in HF */ /* with only the first weigthing The number of bits in max_ener_band[st_band-1] = 17% of bit_fracf */ mb = .17f * bit_fracf; mp = ( 2.0f * DSR_NB_PULSE ); if ( core_brate < GSC_L_RATE_STG && GSC_IVAS_mode == 3 ) { mp = 1.5f * DSR_NB_PULSE; } else if ( core_brate < GSC_L_RATE_STG ) { mp = DSR_NB_PULSE; } /* We want max_ener_band[st_band] <= max_ener_band[st_band-1] and max_ener_band[nb_bands_max-1] <= max_ener_band[st_band]*/ /* We will estimate the number of bits to allocate of HF and put the remaining bits, if any, back on LF */ /* compute the total possible number of band to be coded */ nb_tot_bands = (int16_t) ( ( SWB_bit_budget - bit_fracf ) / ( mp + ( mb - mp ) / 2.0f ) ); mp = min( mp, mb ); if ( nb_tot_bands + st_band > nb_bands_max ) { bit_adj = ( ( mb + mp ) / 2 ) * ( nb_tot_bands + st_band - nb_bands_max ); bit_adj = max( 0, bit_adj ); nb_tot_bands = nb_bands_max - st_band; bit_fracf += bit_adj; } nb_tot_bands += st_band; /* Allocate bits to LF */ etmp = 0.23f; for ( j = 0; j < st_band; j++ ) { i = j; max_ener_band[j] = i; ener_vec[i] = MIN16B; bits_per_bands[j] = etmp * bit_fracf; etmp -= 0.015f; } SWB_bit_budget -= bit_fracf; /* Find low energy band in HF */ set_s( nb_pulse_per_band, 2, MBANDS_GN_BITALLOC16k ); for ( i = st_band + 2; i < nb_tot_bands - 1; i++ ) { if ( ener_vec[i] < ener_vec[i - 1] && ener_vec[i] < ener_vec[i + 1] ) { nb_pulse_per_band[i] = 1; } } for ( j = st_band; j < nb_tot_bands; j++ ) { if ( j > 6 ) { i = maximum( ener_vec, nb_tot_bands, &etmp ); } else { i = j; } max_ener_band[j] = i; ener_vec[i] = MIN16B; } /* Recompute the final bit distribution for HF */ if ( nb_tot_bands > st_band ) { bit_fracf = DSR_NB_PULSE; mb = ( SWB_bit_budget * 2 / ( nb_tot_bands - st_band ) ) - mp; bit_fracf = ( mb - mp ) / ( nb_tot_bands - st_band ); mb -= bit_fracf; /* Do the distribution */ for ( j = st_band; j < nb_tot_bands; j++ ) { if ( nb_pulse_per_band[max_ener_band[j]] > 1 ) { bits_per_bands[max_ener_band[j]] = mb; } else { bits_per_bands[max_ener_band[j]] = 4.5f; } mb -= bit_fracf; SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; } } /* Series of verification in case bit allocated != the budget */ if ( SWB_bit_budget > 0 ) { i = st_band - 1; while ( SWB_bit_budget > 0 ) { bits_per_bands[i]++; SWB_bit_budget--; i--; if ( i == -1 ) { i = st_band - 1; } } } nb_bands = nb_tot_bands; sum_bit = 0; j = 0; for ( i = 0; i < nb_bands; i++ ) { if ( bits_per_bands[i] > 112 ) { sum_bit += bits_per_bands[i] - 112; bits_per_bands[i] = 112; j = i + 1; } /* safety check for overage bit reallocation */ else if ( bits_per_bands[i] + sum_bit / 3 > 112 ) { j = i + 1; } } if ( sum_bit != 0 ) { sum_bit /= ( nb_bands - j ); for ( i = j; i < nb_bands; i++ ) { bits_per_bands[i] += sum_bit; } } #else nb_tot_bands = (int16_t) Find_bit_alloc_IVAS_int( (Word32) core_brate, (Word16) GSC_IVAS_mode, (Word16) Diff_len, (Word16) nb_tot_bands, (Word16) L_frame, (Word16 *) bit, (Word16 *) max_ener_band, ener_vec, bits_per_bands ); nb_bands = nb_tot_bands; #endif } else if ( GSC_noisy_speech ) { Loading Loading @@ -976,7 +787,6 @@ static float Find_bit_frac( return ( var_out ); } #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /*-------------------------------------------------------------------* * Find_bit_alloc_IVAS_int() Loading Loading @@ -1159,7 +969,7 @@ static Word16 Find_bit_alloc_IVAS_int( } /* Recompute the final bit distribution for HF */ IF( nb_tot_bands_loc > st_band ) if ( nb_tot_bands_loc > st_band ) { /* mb = ( SWB_bit_budget * 2 / ( nb_tot_bands_loc - st_band ) ) - mp; */ d_tmp = Find_norm_inv( L_deposit_h( sub( nb_tot_bands_loc, st_band ) ), &e_div ); Loading Loading @@ -1295,4 +1105,3 @@ static Word16 maximum_fx( return ind; } #endif lib_com/ivas_prot.h +4 −1 Original line number Diff line number Diff line Loading @@ -5130,8 +5130,11 @@ ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ const AUDIO_CONFIG input_config, /* i : input audio configuration */ const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ const RENDERER_TYPE renderer_type, /* i : renderer type */ const RENDERER_TYPE renderer_type /* i : renderer type */ #ifndef FIX_1123_FASTCONV_16BIT_ROM , const int16_t allocate_init_flag /* i : Memory allocation flag */ #endif ); #ifdef DEBUGGING Loading Loading
ci/get_id_of_last_job_occurence.py +5 −2 Original line number Diff line number Diff line Loading @@ -65,9 +65,12 @@ def get_job_id(branch_name, job_name, project_id, success_only): if job_name not in resp_jobs.text: continue # find actual job by name # find actual job by name, exclude timed out or stuck jobs for job in resp_jobs.json(): if job["name"] == job_name: name_matches = job["name"] == job_name is_success = job["status"] == "success" has_timed_out = job.get("failure_reason", "") == "stuck_or_timeout_failure" if name_matches and (is_success or not has_timed_out): job_id = job["id"] break if job_id >= 0: Loading
ci/index-pages.html +1 −8 Original line number Diff line number Diff line Loading @@ -7,14 +7,7 @@ <h2>Complexity Reports</h2> <ul> <li><a href="complexity-stereo-in-stereo-out-public/index.html">Stereo</a></li> <li><a href="complexity-ism-in-binaural-out-public/index.html">ISM</a></li> <li><a href="complexity-sba-hoa3-in-hoa3-out-public/index.html">SBA</a></li> <li><a href="complexity-mc-in-7_1_4-out-public/index.html">Multichannel</a></li> <li><a href="complexity-masa-in-7_1_4-out-public/index.html">Masa</a></li> <li><a href="complexity-StereoDmxEVS-stereo-in-mono-out-public/index.html">StereoDmxEVS</a></li> </ul> {} <h2>Test Coverage</h2> Loading
ci/setup_pages.py +49 −25 Original line number Diff line number Diff line Loading @@ -11,30 +11,30 @@ from get_id_of_last_job_occurence import get_job_id PROJECT_ID_FLOAT_REPO = 49 PROJECT_ID_BASOP_REPO = 77 JOBS_FLOAT_REPO = [ # job names -> hyperlink strings forthe landing page JOBS_FLOAT_REPO = { # old ones no longer running -> replaced by "ext" jobs, remove after some time "complexity-stereo-in-stereo-out", "complexity-ism-in-binaural-out", "complexity-sba-hoa3-in-hoa3-out", "complexity-mc-in-7_1_4-out", "complexity-masa-in-7_1_4-out", "coverage-test-on-main-scheduled", "complexity-stereo-in-stereo-out": "[OLD] Stereo in, stereo out", "complexity-ism-in-binaural-out": "[OLD] ISM in, BINAURAL out", "complexity-sba-hoa3-in-hoa3-out": "[OLD] HOA3 in, HOA3 out", "complexity-mc-in-7_1_4-out": "[OLD] MC in, 7_1_4 out", "complexity-masa-in-7_1_4-out": "[OLD] Masa in, 7_1_4 out", # current ones "complexity-stereo-in-ext-out", "complexity-ism-in-binaural_room_ir-out", "complexity-ism-in-ext-out", "complexity-sba-hoa3-in-ext-out", "complexity-sba-hoa3-in-binaural_room_ir-out", "complexity-mc-in-ext-out", "complexity-mc-in-binaural_room_ir-out", "complexity-masa-in-ext-out", "complexity-masa-in-binaural-out", "complexity-omasa-in-ext-out", "complexity-omasa-in-binaural-out", # "timeless" jobs (survivors from the old jobs) "complexity-StereoDmxEVS-stereo-in-mono-out", ] "complexity-stereo-in-ext-out": "Stereo in, EXT out", "complexity-ism-in-binaural_room_ir-out": "ISM in, BINAURAL_ROOM_IR out", "complexity-ism-in-ext-out": "ISM in, EXT out", "complexity-sba-hoa3-in-ext-out": "HOA3 in, EXT out", "complexity-sba-hoa3-in-binaural_room_ir-out": "HOA3 in, BINAURAL_ROOM_IR out", "complexity-mc-in-ext-out": "MC in, EXT out", "complexity-mc-in-binaural_room_ir-out": "MC in, BINAURAL_ROOM_IR out", "complexity-masa-in-ext-out": "MASA in, EXT out", "complexity-masa-in-binaural-out": "MASA in, BINAURAL out", "complexity-omasa-in-ext-out": "OMASA in, EXT out", "complexity-omasa-in-binaural-out": "OMASA in, BINAURAL out", # "timeless" jobs (survivors from the old jobs or not complexity) "complexity-StereoDmxEVS-stereo-in-mono-out": "StereoDmxEVS, Stereo in, Mono out", "coverage-test-on-main-scheduled": "Coverage", } JOBS_BASOP_REPO = [ "ivas-pytest-mld-long-dec", "ivas-pytest-mld-long-dec-lev+10", Loading Loading @@ -67,8 +67,7 @@ def main(): index_html = PUBLIC_FOLDER.joinpath("index.html") if project_id == PROJECT_ID_FLOAT_REPO: src = pathlib.Path("ci/index-pages.html").absolute() shutil.move(src, index_html) create_landing_page_float_repo(jobs, index_html) elif project_id == PROJECT_ID_BASOP_REPO: src = pathlib.Path("ci/basop-pages/basop_index.html").absolute() shutil.move(src, index_html) Loading @@ -76,6 +75,29 @@ def main(): sys.exit(0) def create_landing_page_float_repo(jobs, index_html): # dynamically create the complexity links on the landing page link_html = list() link_html = ["<ul>"] for job, link_text in jobs.items(): if job.startswith("complexity"): line = f'<li><a href="{job}-public/index.html">{link_text}</a></li>' link_html.append(line) link_html.append("</ul>") link_html_text = "\n".join(link_html) index_pages_tmpl_path = ( pathlib.Path(__file__).parent.joinpath("index-pages.html").absolute() ) with open(index_pages_tmpl_path) as f: index_pages_tmpl = f.read() print(index_pages_tmpl) index_pages_tmpl = index_pages_tmpl.format(link_html_text) with open(index_html, "w") as f: f.write(index_pages_tmpl) def get_artifacts_for_jobs_and_return_num_failed( jobs: list, project_id: int, success_only: bool ) -> int: Loading @@ -89,7 +111,9 @@ def get_artifacts_for_jobs_and_return_num_failed( failed_count = 0 for job in jobs: job_id = get_job_id( os.environ["CI_DEFAULT_BRANCH"], job, project_id, success_only) job_id = get_job_id( os.environ["CI_DEFAULT_BRANCH"], job, project_id, success_only ) print(f"{job_id} - {job}") try: Loading
lib_com/gs_bitallocation.c +2 −193 Original line number Diff line number Diff line Loading @@ -47,7 +47,6 @@ #include "wmc_auto.h" #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ Loading @@ -71,7 +70,6 @@ #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ #endif /*-------------------------------------------------------------------* * Local function prototypes Loading @@ -81,14 +79,12 @@ static float Find_bit_frac( const int16_t nb_band, const int16_t remaining_bits static void reajust_bits( float *bits_per_bands, const int16_t st_band, const int16_t end_band, const int16_t sum_bit_in, const int16_t bit_bdgt_in ); #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ); static Word16 Find_bit_alloc_IVAS_int( const Word32 core_brate, const Word16 GSC_IVAS_mode, const Word16 Diff_len, const Word16 nb_tot_bands, const Word16 L_frame, Word16 *bit, Word16 *max_ener_band, float *ener_vec, float *bits_per_bands ); static Word16 maximum_fx( const Word16 *vec_fx, const Word16 lvec_fx, Word16 *max_fx ); #endif /*-------------------------------------------------------------------* * bands_and_bit_alloc() Loading Loading @@ -127,12 +123,8 @@ void bands_and_bit_alloc( int16_t pos, band; float SWB_bit_budget; float bits_per_bands[MBANDS_GN_BITALLOC16k]; #ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING float fzero_val, mp, mb, nb_bands_adj, bit_adj; int16_t nb_pulse_per_band[MBANDS_GN_BITALLOC16k]; #else float fzero_val; #endif /* initializations */ nb_tot_bands = 16; set_f( bits_per_bands, 0.0f, MBANDS_GN_BITALLOC16k ); Loading Loading @@ -231,189 +223,8 @@ void bands_and_bit_alloc( { if ( GSC_IVAS_mode > 0 ) { #ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING SWB_bit_budget = *bit; st_band = 5; set_f( bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); /* 2- Decide the pourcentage of bits allocated to LF (between 50-75%) depending of the temporal contribution in GSC */ bit_fracf = ( -0.125f * Diff_len + 76.0f ) / 100; bit_fracf = check_bounds( bit_fracf, 0.50f, 0.75f ); /* Adjusment of the bitrate between LF and HF base on the content type */ /* 1 = new GSC bit alloc 2 = GSC bit alloc for tc frame 3 = more music like (should not happen often given music is coded with dft) */ if ( GSC_IVAS_mode <= 3 ) { nb_bands_max -= 6; } if ( GSC_IVAS_mode == 2 ) { bit_fracf += 0.1f; nb_bands_max--; } if ( GSC_IVAS_mode == 3 ) { bit_fracf -= 0.1f; nb_bands_max += 3; } /* First find how much we want to share between LF and HF, at low bitrate, a miminum of bits is needed in LF by limitating the number of bands*/ /* Adjust the number of band based on the content type and bitrate */ nb_bands_adj = 1.0f; if ( GSC_IVAS_mode == 1 && core_brate < GSC_L_RATE_STG ) { nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f; } else if ( GSC_IVAS_mode != 2 && core_brate > GSC_H_RATE_STG ) { nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f; } nb_bands_max = (int16_t) ( nb_bands_max * nb_bands_adj + 0.5f ); nb_bands_max = check_bounds_s( nb_bands_max, 5, nb_tot_bands ); bit_fracf *= SWB_bit_budget; /* Estimation of the number of bit used in HF */ /* with only the first weigthing The number of bits in max_ener_band[st_band-1] = 17% of bit_fracf */ mb = .17f * bit_fracf; mp = ( 2.0f * DSR_NB_PULSE ); if ( core_brate < GSC_L_RATE_STG && GSC_IVAS_mode == 3 ) { mp = 1.5f * DSR_NB_PULSE; } else if ( core_brate < GSC_L_RATE_STG ) { mp = DSR_NB_PULSE; } /* We want max_ener_band[st_band] <= max_ener_band[st_band-1] and max_ener_band[nb_bands_max-1] <= max_ener_band[st_band]*/ /* We will estimate the number of bits to allocate of HF and put the remaining bits, if any, back on LF */ /* compute the total possible number of band to be coded */ nb_tot_bands = (int16_t) ( ( SWB_bit_budget - bit_fracf ) / ( mp + ( mb - mp ) / 2.0f ) ); mp = min( mp, mb ); if ( nb_tot_bands + st_band > nb_bands_max ) { bit_adj = ( ( mb + mp ) / 2 ) * ( nb_tot_bands + st_band - nb_bands_max ); bit_adj = max( 0, bit_adj ); nb_tot_bands = nb_bands_max - st_band; bit_fracf += bit_adj; } nb_tot_bands += st_band; /* Allocate bits to LF */ etmp = 0.23f; for ( j = 0; j < st_band; j++ ) { i = j; max_ener_band[j] = i; ener_vec[i] = MIN16B; bits_per_bands[j] = etmp * bit_fracf; etmp -= 0.015f; } SWB_bit_budget -= bit_fracf; /* Find low energy band in HF */ set_s( nb_pulse_per_band, 2, MBANDS_GN_BITALLOC16k ); for ( i = st_band + 2; i < nb_tot_bands - 1; i++ ) { if ( ener_vec[i] < ener_vec[i - 1] && ener_vec[i] < ener_vec[i + 1] ) { nb_pulse_per_band[i] = 1; } } for ( j = st_band; j < nb_tot_bands; j++ ) { if ( j > 6 ) { i = maximum( ener_vec, nb_tot_bands, &etmp ); } else { i = j; } max_ener_band[j] = i; ener_vec[i] = MIN16B; } /* Recompute the final bit distribution for HF */ if ( nb_tot_bands > st_band ) { bit_fracf = DSR_NB_PULSE; mb = ( SWB_bit_budget * 2 / ( nb_tot_bands - st_band ) ) - mp; bit_fracf = ( mb - mp ) / ( nb_tot_bands - st_band ); mb -= bit_fracf; /* Do the distribution */ for ( j = st_band; j < nb_tot_bands; j++ ) { if ( nb_pulse_per_band[max_ener_band[j]] > 1 ) { bits_per_bands[max_ener_band[j]] = mb; } else { bits_per_bands[max_ener_band[j]] = 4.5f; } mb -= bit_fracf; SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; } } /* Series of verification in case bit allocated != the budget */ if ( SWB_bit_budget > 0 ) { i = st_band - 1; while ( SWB_bit_budget > 0 ) { bits_per_bands[i]++; SWB_bit_budget--; i--; if ( i == -1 ) { i = st_band - 1; } } } nb_bands = nb_tot_bands; sum_bit = 0; j = 0; for ( i = 0; i < nb_bands; i++ ) { if ( bits_per_bands[i] > 112 ) { sum_bit += bits_per_bands[i] - 112; bits_per_bands[i] = 112; j = i + 1; } /* safety check for overage bit reallocation */ else if ( bits_per_bands[i] + sum_bit / 3 > 112 ) { j = i + 1; } } if ( sum_bit != 0 ) { sum_bit /= ( nb_bands - j ); for ( i = j; i < nb_bands; i++ ) { bits_per_bands[i] += sum_bit; } } #else nb_tot_bands = (int16_t) Find_bit_alloc_IVAS_int( (Word32) core_brate, (Word16) GSC_IVAS_mode, (Word16) Diff_len, (Word16) nb_tot_bands, (Word16) L_frame, (Word16 *) bit, (Word16 *) max_ener_band, ener_vec, bits_per_bands ); nb_bands = nb_tot_bands; #endif } else if ( GSC_noisy_speech ) { Loading Loading @@ -976,7 +787,6 @@ static float Find_bit_frac( return ( var_out ); } #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /*-------------------------------------------------------------------* * Find_bit_alloc_IVAS_int() Loading Loading @@ -1159,7 +969,7 @@ static Word16 Find_bit_alloc_IVAS_int( } /* Recompute the final bit distribution for HF */ IF( nb_tot_bands_loc > st_band ) if ( nb_tot_bands_loc > st_band ) { /* mb = ( SWB_bit_budget * 2 / ( nb_tot_bands_loc - st_band ) ) - mp; */ d_tmp = Find_norm_inv( L_deposit_h( sub( nb_tot_bands_loc, st_band ) ), &e_div ); Loading Loading @@ -1295,4 +1105,3 @@ static Word16 maximum_fx( return ind; } #endif
lib_com/ivas_prot.h +4 −1 Original line number Diff line number Diff line Loading @@ -5130,8 +5130,11 @@ ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ const AUDIO_CONFIG input_config, /* i : input audio configuration */ const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ const RENDERER_TYPE renderer_type, /* i : renderer type */ const RENDERER_TYPE renderer_type /* i : renderer type */ #ifndef FIX_1123_FASTCONV_16BIT_ROM , const int16_t allocate_init_flag /* i : Memory allocation flag */ #endif ); #ifdef DEBUGGING Loading