Loading lib_com/gs_bitallocation.c +77 −33 Original line number Diff line number Diff line Loading @@ -46,14 +46,12 @@ #include "ivas_prot.h" #include "wmc_auto.h" #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /*-------------------------------------------------------------------* * Local function prototypes * Local constants *-------------------------------------------------------------------*/ 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 #define Q15_0_33 10922 /* 0.33 */ #define Q18_0_1 26214 /* 0.1 */ #define Q18_0_50 131072 /* 0.50 */ Loading @@ -72,9 +70,24 @@ static void reajust_bits( float *bits_per_bands, const int16_t st_band, const in #define Q31_0_02 42949673 /* 0.02 */ #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ #endif /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ 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 /*-------------------------------------------------------------------* Loading Loading @@ -398,7 +411,7 @@ void bands_and_bit_alloc( } } #else nb_tot_bands = Find_bit_alloc_IVAS_int( core_brate, GSC_IVAS_mode, Diff_len, nb_tot_bands, L_frame, bit, max_ener_band, ener_vec, bits_per_bands ); 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 } Loading Loading @@ -962,9 +975,17 @@ static float Find_bit_frac( return ( var_out ); } #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING static Word16 Find_bit_alloc_IVAS_int( /*o: Number of band to encode */ /*-------------------------------------------------------------------* * Find_bit_alloc_IVAS_int() * * *-------------------------------------------------------------------*/ /*! r: Number of bands to encode */ static Word16 Find_bit_alloc_IVAS_int( const Word32 core_brate, /* i : core bit rate */ const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ const Word16 Diff_len, /* i : Length of the difference signal (before pure spectral)*/ Loading @@ -978,27 +999,26 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number { Word32 mp, mb, nb_bands_adj, bit_adj; Word16 nb_pulse_per_band[MBANDS_GN_BITALLOC16k]; Word32 SWB_bit_budget; // Q0 -> Q18 Word32 SWB_bit_budget; /* Q0 -> Q18 */ Word16 i, j, nb_bands_max, st_band, nb_tot_bands_loc, etmp; Word32 sum_bit /*Q18*/, bit_fracf /*Q18*/; Word16 d_tmp, e_div, tmp16, ener_vec[MBANDS_GN_BITALLOC16k]; Word32 Ltmp, etmp_32fx, bits_per_bands[MBANDS_GN_BITALLOC16k]; SWB_bit_budget = *bit; // Q0 SWB_bit_budget = *bit; /* Q0 */ st_band = 5; nb_bands_max = nb_tot_bands_in; for ( i = 0; i < MBANDS_GN; i++ ) { ener_vec[i] = (short) ( ener_vec_io[i] ); /* Q12 -> Q12 */ ener_vec[i] = (Word16) ( ener_vec_io[i] ); /* Q12 -> Q12 */ } if ( L_frame == L_FRAME16k ) { for ( i = MBANDS_GN; i < MBANDS_GN_BITALLOC16k; i++ ) { ener_vec[i] = (short) ( ener_vec_io[i] * 4096.0 + 0.5f ); /* Q0 -> Q12 */ ener_vec[i] = (Word16) ( ener_vec_io[i] * 4096.0 + 0.5f ); /* Q0 -> Q12 */ } } Loading @@ -1020,12 +1040,14 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number { nb_bands_max -= 6; } if ( GSC_IVAS_mode == 2 ) { /* bit_fracf += 0.1f; */ bit_fracf += Q18_0_1; /* Q18*/ nb_bands_max -= 1; } if ( GSC_IVAS_mode == 3 ) { /* bit_fracf -= 0.1f; */ Loading @@ -1041,12 +1063,12 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number if ( GSC_IVAS_mode == 1 && core_brate < GSC_L_RATE_STG ) { /* nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f;*/ nb_bands_adj = L_sub( Mpy_32_32( Q31_0_0125, L_shl( SWB_bit_budget, 18 ) ), Q18_0_75 ); // Q18 nb_bands_adj = L_sub( Mpy_32_32( Q31_0_0125, L_shl( SWB_bit_budget, 18 ) ), Q18_0_75 ); /* Q18 */ } else if ( GSC_IVAS_mode != 2 && core_brate > GSC_H_RATE_STG ) { /*nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f;*/ nb_bands_adj = L_sub( Mpy_32_32( Q31_0_02, L_shl( SWB_bit_budget, 18 ) ), Q18_1_2 ); // Q18 nb_bands_adj = L_sub( Mpy_32_32( Q31_0_02, L_shl( SWB_bit_budget, 18 ) ), Q18_1_2 ); /* Q18 */ } /*nb_bands_max = (int16_t)(nb_bands_max * nb_bands_adj + 0.5f);*/ Loading Loading @@ -1135,10 +1157,10 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number max_ener_band[j] = i; ener_vec[i] = MIN16B; } /* Recompute the final bit distribution for HF */ IF( nb_tot_bands_loc > st_band ) { /* This is not bit exact because of the precision lost */ /* 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 ); mb = L_sub( L_shr( Mpy_32_16_1( L_shl( SWB_bit_budget, 1 ), d_tmp ), e_div ), mp ); /* Q18 */ Loading @@ -1155,9 +1177,10 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number bits_per_bands[max_ener_band[j]] = mb; } mb -= bit_fracf; SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; // Q18 SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; /* Q18 */ } } /* Series of verification in case bit allocated != the budget */ if ( SWB_bit_budget > 0 ) { Loading Loading @@ -1191,7 +1214,6 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number bits_per_bands[i] = Q18_112; j = add( j, add( i, 1 ) ); } /* safety check for overage bit reallocation */ /* else if (bits_per_bands[i] + sum_bit / 3 > 112) */ else if ( L_add( bits_per_bands[i], Mpy_32_16_1( sum_bit, Q15_0_33 ) ) > Q18_112 ) Loading @@ -1210,24 +1232,46 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number bits_per_bands[i] = L_add( bits_per_bands[i], sum_bit ); } } for ( i = 0; i < MBANDS_GN_BITALLOC16k; i++ ) { bits_per_bands_o[i] = (float) bits_per_bands[i] / 262144.0f; /* Q18 -> float */ } return nb_tot_bands_loc; } static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ) /* Find normalized 1 / ToDivide */ /*-------------------------------------------------------------------* * Find_norm_inv() * * Find normalized 1 / ToDivide *-------------------------------------------------------------------*/ static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ) { Word16 d_tmp, e_tmp; e_tmp = norm_l( ToDivide ); d_tmp = round_fx( L_shl( ToDivide, e_tmp ) ); d_tmp = div_s( 16384, d_tmp ); /* 1.0 in Q14, dividend is normalize so >= 16384 as required for the division */ *e_div = sub( 14, e_tmp ); move16(); return d_tmp; } static Word16 maximum_fx( /* o : index of the maximum value in the input vector */ /*-------------------------------------------------------------------* * maximum_fx() * * *-------------------------------------------------------------------*/ /*! r: index of the maximum value in the input vector */ static Word16 maximum_fx( const Word16 *vec_fx, /* i : input vector */ const Word16 lvec_fx, /* i : length of input vector */ Word16 *max_fx /* o : maximum value in the input vector */ Loading @@ -1235,8 +1279,8 @@ static Word16 maximum_fx( /* o : index of the maximum val { Word16 j, ind; Word16 tmp; ind = 0; ind = 0; tmp = vec_fx[0]; for ( j = 1; j < lvec_fx; j++ ) Loading lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,8 @@ #define FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT /* Orange issue 1031 : new fix point hrtf binary file format */ #define FIX_CREND_SIMPLIFY_CODE /* Ora : simplify line code in crend */ #define FLOAT_FIX_POINT_HRTF_FILE_FORMAT /* allows reading floation or fix point hrtf binary file format */ #define FIX_1138_SBA_EXT_ERROR_PRINTOUT /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */ #define FIX_1117_ISAR_MALLOC /* VA: issue 1117: call ISAR malloc() only at the initialization. */ #define FIX_1123_CREND_16BIT_ROM #define FIX_1123_FASTCONV_16BIT_ROM /* FhG: issue 1123: update FastConv ROM tables and scripts to generate 16 bit tables instead of float */ Loading lib_dec/lib_dec.c +36 −11 Original line number Diff line number Diff line Loading @@ -268,11 +268,13 @@ static ivas_error isar_set_split_rend_setup( splitRendBits->isar_frame_size_ms = 0; splitRendBits->lc3plus_highres = 0; #ifndef FIX_1117_ISAR_MALLOC if ( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } #endif ISAR_PRE_REND_GetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->sr_pose_pred_axis : DEFAULT_AXIS ); if ( hCombinedOrientationData != NULL ) Loading Loading @@ -550,13 +552,14 @@ ivas_error IVAS_DEC_EnableSplitRendering( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * get_render_framesize_ms( ) * * Get the 5ms flag *---------------------------------------------------------------------*/ int16_t get_render_frame_size_ms( static int16_t get_render_frame_size_ms( const IVAS_RENDER_FRAMESIZE render_framesize ) { return (int16_t) ( render_framesize * ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); Loading Loading @@ -593,6 +596,7 @@ ivas_error IVAS_DEC_SetRenderFramesize( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesize( ) * Loading Loading @@ -1236,8 +1240,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( ivas_syn_output( pOutput, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out ); } #ifndef FIX_1117_ISAR_MALLOC free( st_ivas->hSplitBinRend->hMultiBinCldfbData ); #endif return error; } Loading Loading @@ -2508,10 +2514,20 @@ ivas_error IVAS_DEC_VoIP_SetScale( return error; } /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * IVAS_DEC_TSM_SetQuality( ) * * set the quality theshold for the time scale modiciation that is used * to determine if the TSM yielded a signal that satisfies the minimum * quality requirements. * quality is lower limit for minimum quality * Range is [-2;2] - where positive values allow * only pasting with same phase information * Negative values would yield cross phased pasting * When not setting the minimum quality with this function the default * value used is 1.0f * * Set the TSM scale *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_TSM_SetQuality( Loading @@ -2519,11 +2535,7 @@ ivas_error IVAS_DEC_TSM_SetQuality( const float quality /* i : target TSM quality */ ) { ivas_error error; error = IVAS_ERR_OK; if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false ) if ( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { return IVAS_ERR_TSM_NOT_ENABLED; } Loading @@ -2532,7 +2544,7 @@ ivas_error IVAS_DEC_TSM_SetQuality( hIvasDec->tsm_quality = quality; } return error; return IVAS_ERR_OK; } Loading Loading @@ -3919,6 +3931,11 @@ static void ivas_destroy_handle_isar( { if ( *hSplitBinRend != NULL ) { #ifdef FIX_1117_ISAR_MALLOC free( ( *hSplitBinRend )->hMultiBinCldfbData ); ( *hSplitBinRend )->hMultiBinCldfbData = NULL; #endif ISAR_PRE_REND_close( &( *hSplitBinRend )->splitrend, NULL ); if ( ( *hSplitBinRend )->hCldfbDataOut != NULL ) Loading Loading @@ -4114,6 +4131,14 @@ static ivas_error ivas_dec_init_split_rend( cldfb_in_flag = 1; } #ifdef FIX_1117_ISAR_MALLOC /* note: this is intra-frame heap memory */ if ( ( st_ivas->hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } #endif ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS ); if ( cldfb_in_flag == 1 && ( st_ivas->hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) Loading lib_dec/lib_dec.h +3 −2 Original line number Diff line number Diff line Loading @@ -266,6 +266,7 @@ ivas_error IVAS_DEC_VoIP_SetScale( const int16_t scale /* i : TSM scale to set */ ); /*! r: error code */ ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const float quality /* i : target TSM quality */ Loading lib_rend/ivas_output_init.c +4 −0 Original line number Diff line number Diff line Loading @@ -304,7 +304,11 @@ int16_t ivas_get_nchan_buffers_dec( { nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); } #ifdef FIX_1138_SBA_EXT_ERROR_PRINTOUT else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) #else else #endif { nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); Loading Loading
lib_com/gs_bitallocation.c +77 −33 Original line number Diff line number Diff line Loading @@ -46,14 +46,12 @@ #include "ivas_prot.h" #include "wmc_auto.h" #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /*-------------------------------------------------------------------* * Local function prototypes * Local constants *-------------------------------------------------------------------*/ 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 #define Q15_0_33 10922 /* 0.33 */ #define Q18_0_1 26214 /* 0.1 */ #define Q18_0_50 131072 /* 0.50 */ Loading @@ -72,9 +70,24 @@ static void reajust_bits( float *bits_per_bands, const int16_t st_band, const in #define Q31_0_02 42949673 /* 0.02 */ #define Q31_0_17 365072220 /* 0.17 */ #define Q31_0_23 493921239 /* 0.23 */ #endif /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ 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 /*-------------------------------------------------------------------* Loading Loading @@ -398,7 +411,7 @@ void bands_and_bit_alloc( } } #else nb_tot_bands = Find_bit_alloc_IVAS_int( core_brate, GSC_IVAS_mode, Diff_len, nb_tot_bands, L_frame, bit, max_ener_band, ener_vec, bits_per_bands ); 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 } Loading Loading @@ -962,9 +975,17 @@ static float Find_bit_frac( return ( var_out ); } #ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING static Word16 Find_bit_alloc_IVAS_int( /*o: Number of band to encode */ /*-------------------------------------------------------------------* * Find_bit_alloc_IVAS_int() * * *-------------------------------------------------------------------*/ /*! r: Number of bands to encode */ static Word16 Find_bit_alloc_IVAS_int( const Word32 core_brate, /* i : core bit rate */ const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ const Word16 Diff_len, /* i : Length of the difference signal (before pure spectral)*/ Loading @@ -978,27 +999,26 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number { Word32 mp, mb, nb_bands_adj, bit_adj; Word16 nb_pulse_per_band[MBANDS_GN_BITALLOC16k]; Word32 SWB_bit_budget; // Q0 -> Q18 Word32 SWB_bit_budget; /* Q0 -> Q18 */ Word16 i, j, nb_bands_max, st_band, nb_tot_bands_loc, etmp; Word32 sum_bit /*Q18*/, bit_fracf /*Q18*/; Word16 d_tmp, e_div, tmp16, ener_vec[MBANDS_GN_BITALLOC16k]; Word32 Ltmp, etmp_32fx, bits_per_bands[MBANDS_GN_BITALLOC16k]; SWB_bit_budget = *bit; // Q0 SWB_bit_budget = *bit; /* Q0 */ st_band = 5; nb_bands_max = nb_tot_bands_in; for ( i = 0; i < MBANDS_GN; i++ ) { ener_vec[i] = (short) ( ener_vec_io[i] ); /* Q12 -> Q12 */ ener_vec[i] = (Word16) ( ener_vec_io[i] ); /* Q12 -> Q12 */ } if ( L_frame == L_FRAME16k ) { for ( i = MBANDS_GN; i < MBANDS_GN_BITALLOC16k; i++ ) { ener_vec[i] = (short) ( ener_vec_io[i] * 4096.0 + 0.5f ); /* Q0 -> Q12 */ ener_vec[i] = (Word16) ( ener_vec_io[i] * 4096.0 + 0.5f ); /* Q0 -> Q12 */ } } Loading @@ -1020,12 +1040,14 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number { nb_bands_max -= 6; } if ( GSC_IVAS_mode == 2 ) { /* bit_fracf += 0.1f; */ bit_fracf += Q18_0_1; /* Q18*/ nb_bands_max -= 1; } if ( GSC_IVAS_mode == 3 ) { /* bit_fracf -= 0.1f; */ Loading @@ -1041,12 +1063,12 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number if ( GSC_IVAS_mode == 1 && core_brate < GSC_L_RATE_STG ) { /* nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f;*/ nb_bands_adj = L_sub( Mpy_32_32( Q31_0_0125, L_shl( SWB_bit_budget, 18 ) ), Q18_0_75 ); // Q18 nb_bands_adj = L_sub( Mpy_32_32( Q31_0_0125, L_shl( SWB_bit_budget, 18 ) ), Q18_0_75 ); /* Q18 */ } else if ( GSC_IVAS_mode != 2 && core_brate > GSC_H_RATE_STG ) { /*nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f;*/ nb_bands_adj = L_sub( Mpy_32_32( Q31_0_02, L_shl( SWB_bit_budget, 18 ) ), Q18_1_2 ); // Q18 nb_bands_adj = L_sub( Mpy_32_32( Q31_0_02, L_shl( SWB_bit_budget, 18 ) ), Q18_1_2 ); /* Q18 */ } /*nb_bands_max = (int16_t)(nb_bands_max * nb_bands_adj + 0.5f);*/ Loading Loading @@ -1135,10 +1157,10 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number max_ener_band[j] = i; ener_vec[i] = MIN16B; } /* Recompute the final bit distribution for HF */ IF( nb_tot_bands_loc > st_band ) { /* This is not bit exact because of the precision lost */ /* 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 ); mb = L_sub( L_shr( Mpy_32_16_1( L_shl( SWB_bit_budget, 1 ), d_tmp ), e_div ), mp ); /* Q18 */ Loading @@ -1155,9 +1177,10 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number bits_per_bands[max_ener_band[j]] = mb; } mb -= bit_fracf; SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; // Q18 SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; /* Q18 */ } } /* Series of verification in case bit allocated != the budget */ if ( SWB_bit_budget > 0 ) { Loading Loading @@ -1191,7 +1214,6 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number bits_per_bands[i] = Q18_112; j = add( j, add( i, 1 ) ); } /* safety check for overage bit reallocation */ /* else if (bits_per_bands[i] + sum_bit / 3 > 112) */ else if ( L_add( bits_per_bands[i], Mpy_32_16_1( sum_bit, Q15_0_33 ) ) > Q18_112 ) Loading @@ -1210,24 +1232,46 @@ static Word16 Find_bit_alloc_IVAS_int( /*o: Number bits_per_bands[i] = L_add( bits_per_bands[i], sum_bit ); } } for ( i = 0; i < MBANDS_GN_BITALLOC16k; i++ ) { bits_per_bands_o[i] = (float) bits_per_bands[i] / 262144.0f; /* Q18 -> float */ } return nb_tot_bands_loc; } static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ) /* Find normalized 1 / ToDivide */ /*-------------------------------------------------------------------* * Find_norm_inv() * * Find normalized 1 / ToDivide *-------------------------------------------------------------------*/ static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ) { Word16 d_tmp, e_tmp; e_tmp = norm_l( ToDivide ); d_tmp = round_fx( L_shl( ToDivide, e_tmp ) ); d_tmp = div_s( 16384, d_tmp ); /* 1.0 in Q14, dividend is normalize so >= 16384 as required for the division */ *e_div = sub( 14, e_tmp ); move16(); return d_tmp; } static Word16 maximum_fx( /* o : index of the maximum value in the input vector */ /*-------------------------------------------------------------------* * maximum_fx() * * *-------------------------------------------------------------------*/ /*! r: index of the maximum value in the input vector */ static Word16 maximum_fx( const Word16 *vec_fx, /* i : input vector */ const Word16 lvec_fx, /* i : length of input vector */ Word16 *max_fx /* o : maximum value in the input vector */ Loading @@ -1235,8 +1279,8 @@ static Word16 maximum_fx( /* o : index of the maximum val { Word16 j, ind; Word16 tmp; ind = 0; ind = 0; tmp = vec_fx[0]; for ( j = 1; j < lvec_fx; j++ ) Loading
lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,8 @@ #define FIX_CREND_FIX_POINT_HRTF_FILE_FORMAT /* Orange issue 1031 : new fix point hrtf binary file format */ #define FIX_CREND_SIMPLIFY_CODE /* Ora : simplify line code in crend */ #define FLOAT_FIX_POINT_HRTF_FILE_FORMAT /* allows reading floation or fix point hrtf binary file format */ #define FIX_1138_SBA_EXT_ERROR_PRINTOUT /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */ #define FIX_1117_ISAR_MALLOC /* VA: issue 1117: call ISAR malloc() only at the initialization. */ #define FIX_1123_CREND_16BIT_ROM #define FIX_1123_FASTCONV_16BIT_ROM /* FhG: issue 1123: update FastConv ROM tables and scripts to generate 16 bit tables instead of float */ Loading
lib_dec/lib_dec.c +36 −11 Original line number Diff line number Diff line Loading @@ -268,11 +268,13 @@ static ivas_error isar_set_split_rend_setup( splitRendBits->isar_frame_size_ms = 0; splitRendBits->lc3plus_highres = 0; #ifndef FIX_1117_ISAR_MALLOC if ( ( hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } #endif ISAR_PRE_REND_GetMultiBinPoseData( hSplitBinConfig, &hSplitBinRend->splitrend.multiBinPoseData, ( hCombinedOrientationData != NULL ) ? hCombinedOrientationData->sr_pose_pred_axis : DEFAULT_AXIS ); if ( hCombinedOrientationData != NULL ) Loading Loading @@ -550,13 +552,14 @@ ivas_error IVAS_DEC_EnableSplitRendering( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * get_render_framesize_ms( ) * * Get the 5ms flag *---------------------------------------------------------------------*/ int16_t get_render_frame_size_ms( static int16_t get_render_frame_size_ms( const IVAS_RENDER_FRAMESIZE render_framesize ) { return (int16_t) ( render_framesize * ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); Loading Loading @@ -593,6 +596,7 @@ ivas_error IVAS_DEC_SetRenderFramesize( return IVAS_ERR_OK; } /*---------------------------------------------------------------------* * IVAS_DEC_GetGetRenderFramesize( ) * Loading Loading @@ -1236,8 +1240,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( ivas_syn_output( pOutput, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out ); } #ifndef FIX_1117_ISAR_MALLOC free( st_ivas->hSplitBinRend->hMultiBinCldfbData ); #endif return error; } Loading Loading @@ -2508,10 +2514,20 @@ ivas_error IVAS_DEC_VoIP_SetScale( return error; } /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_SetScale( ) * IVAS_DEC_TSM_SetQuality( ) * * set the quality theshold for the time scale modiciation that is used * to determine if the TSM yielded a signal that satisfies the minimum * quality requirements. * quality is lower limit for minimum quality * Range is [-2;2] - where positive values allow * only pasting with same phase information * Negative values would yield cross phased pasting * When not setting the minimum quality with this function the default * value used is 1.0f * * Set the TSM scale *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_TSM_SetQuality( Loading @@ -2519,11 +2535,7 @@ ivas_error IVAS_DEC_TSM_SetQuality( const float quality /* i : target TSM quality */ ) { ivas_error error; error = IVAS_ERR_OK; if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false ) if ( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm ) { return IVAS_ERR_TSM_NOT_ENABLED; } Loading @@ -2532,7 +2544,7 @@ ivas_error IVAS_DEC_TSM_SetQuality( hIvasDec->tsm_quality = quality; } return error; return IVAS_ERR_OK; } Loading Loading @@ -3919,6 +3931,11 @@ static void ivas_destroy_handle_isar( { if ( *hSplitBinRend != NULL ) { #ifdef FIX_1117_ISAR_MALLOC free( ( *hSplitBinRend )->hMultiBinCldfbData ); ( *hSplitBinRend )->hMultiBinCldfbData = NULL; #endif ISAR_PRE_REND_close( &( *hSplitBinRend )->splitrend, NULL ); if ( ( *hSplitBinRend )->hCldfbDataOut != NULL ) Loading Loading @@ -4114,6 +4131,14 @@ static ivas_error ivas_dec_init_split_rend( cldfb_in_flag = 1; } #ifdef FIX_1117_ISAR_MALLOC /* note: this is intra-frame heap memory */ if ( ( st_ivas->hSplitBinRend->hMultiBinCldfbData = (ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_MULTI_BIN_CLDFB_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for split rendering structure" ); } #endif ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &st_ivas->hSplitBinRend->splitrend.multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS ); if ( cldfb_in_flag == 1 && ( st_ivas->hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) Loading
lib_dec/lib_dec.h +3 −2 Original line number Diff line number Diff line Loading @@ -266,6 +266,7 @@ ivas_error IVAS_DEC_VoIP_SetScale( const int16_t scale /* i : TSM scale to set */ ); /*! r: error code */ ivas_error IVAS_DEC_TSM_SetQuality( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const float quality /* i : target TSM quality */ Loading
lib_rend/ivas_output_init.c +4 −0 Original line number Diff line number Diff line Loading @@ -304,7 +304,11 @@ int16_t ivas_get_nchan_buffers_dec( { nchan_out_buff = max( nchan_out_buff, st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe ); } #ifdef FIX_1138_SBA_EXT_ERROR_PRINTOUT else if ( output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) #else else #endif { nchan_out_buff = max( audioCfg2channels( st_ivas->transport_config ), audioCfg2channels( st_ivas->intern_config ) ); nchan_out_buff = max( nchan_out_buff, audioCfg2channels( output_config ) ); Loading