Loading apps/decoder.c +35 −1 Original line number Diff line number Diff line Loading @@ -2265,6 +2265,23 @@ static ivas_error decodeG192( } } #endif #ifdef FIX_HRTF_LOAD_API /* decode transport channels, do TSM and feed to renderer */ if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, isSplitRend, splitRendBits ) ) != IVAS_ERR_OK ) { return error; } #endif #ifdef OBJ_EDITING_API /* Do the final preparations needed for rendering */ if ( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not prepare the renderer: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif } if ( isSplitRend ) Loading Loading @@ -2714,6 +2731,9 @@ static ivas_error decodeVoIP( int16_t nOutSamples = 0; #ifdef FIX_CREND_SIMPLIFY_CODE bool bitstreamReadDone = false; #ifdef OBJ_EDITING_API bool parametersAvailableForEditing = false; #endif uint16_t nSamplesRendered; #endif Loading Loading @@ -3005,13 +3025,21 @@ static ivas_error decodeVoIP( #endif #ifdef SUPPORT_JBM_TRACEFILE #ifdef FIX_CREND_SIMPLIFY_CODE #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶metersAvailableForEditing ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered ) ) != IVAS_ERR_OK ) #endif #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK ) #endif #else #ifdef FIX_CREND_SIMPLIFY_CODE #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, &bitstreamReadDone, ¶metersAvailableForEditing ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, &bitstreamReadDone ) ) != IVAS_ERR_OK ) #endif #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms ) ) != IVAS_ERR_OK ) #endif Loading Loading @@ -3046,9 +3074,15 @@ static ivas_error decodeVoIP( } } #endif #ifdef FIX_HRTF_LOAD #ifdef OBJ_EDITING_API if ( parametersAvailableForEditing == true ) { /* do the object editing here */ } #endif #ifdef FIX_HRTF_LOAD } /* while ( nSamplesRendered < nOutSamples ) */ #endif /* write JBM Offset file entry */ if ( jbmOffsetWriter != NULL ) Loading lib_com/cnst.h +6 −2 Original line number Diff line number Diff line Loading @@ -799,8 +799,12 @@ enum #define CLDFB_NO_COL_MAX_SWITCH 6 /* CLDFB resampling - max number of CLDFB col. for switching */ #define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */ #define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */ #ifndef FIX_2085_FLOATING_POINT_LEFTOVERS #define INV_CLDFB_BANDWIDTH ( 1.f / 800.f ) #define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) #endif #define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) /* ( 1.f / 800.f ) Q31 */ #define INV_CLDFB_BANDWIDTH_MDFT_FAC_Q31 ( 10737418 ) #define CLDFB_BANDWIDTH 800 Loading lib_com/common_api_types.h +12 −0 Original line number Diff line number Diff line Loading @@ -137,9 +137,21 @@ typedef struct _IVAS_ISM_METADATA float yaw; float pitch; Word16 non_diegetic_flag; #ifdef OBJ_EDITING_API Word32 gain_fx; #endif } IVAS_ISM_METADATA; #ifdef OBJ_EDITING_API typedef struct _IVAS_EDITABLE_PARAMETERS { Word16 num_obj; IVAS_ISM_METADATA ism_metadata[IVAS_MAX_NUM_OBJECTS]; Word32 gain_bed_fx; } IVAS_EDITABLE_PARAMETERS; #endif typedef struct { // float w, x, y, z; Loading lib_com/hp50_fx.c +63 −68 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include "wmc_auto.h" #define HP20_COEFF_SCALE ( 2 ) #define HP20_FX_COEFF_SCALE ( 1 ) /* * hp20 * Loading Loading @@ -340,7 +341,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * #ifdef HP20_FIX32_RECODING void hp20_fx_32( void hp20_fx_32_opt( Word32 signal_fx[], const Word16 lg, Word32 mem_fx[], Loading @@ -348,54 +349,49 @@ void hp20_fx_32( { Word32 i; Word32 a1_fx, a2_fx, b1_fx, b2_fx; Word32 diff_pos, diff_neg; #ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; #endif Word16 prescale, prescaleOld, prescale_current_frame, diff; Word32 tmp_mem[4]; prescale = getScaleFactor32( signal_fx, lg ); prescale_current_frame = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); prescale = L_norm_arr( signal_fx, lg ); prescale_current_frame = sub( 1 + HP20_FX_COEFF_SCALE, prescale ); prescaleOld = extract_l( mem_fx[4] ); #ifdef ISSUE_1836_replace_overflow_libcom diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); #else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); #endif tmp_mem[0] = L_shl_sat( mem_fx[0], prescaleOld ); tmp_mem[1] = L_shl_sat( mem_fx[1], prescaleOld ); tmp_mem[2] = L_shl_sat( mem_fx[2], prescaleOld ); tmp_mem[3] = L_shl_sat( mem_fx[3], prescaleOld ); move32(); move32(); move32(); move32(); diff = L_norm_arr( tmp_mem, 4 ); prescale = s_min( prescale, diff ); diff = L_max( diff_pos, diff_neg ); prescale = sub( 1 + HP20_FX_COEFF_SCALE, prescale ); IF( NE_16( diff, 0 ) ) if ( EQ_16( prescale_current_frame, 1 + HP20_FX_COEFF_SCALE - 31 ) ) // signal_fx buffer contains only zeros, so use the mem_fx scale_factor instead { prescale = s_min( prescale, diff ); prescale_current_frame = prescale; } prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); diff = sub( prescale, prescaleOld ); #ifdef ISSUE_1836_replace_overflow_libcom mem_fx[0] = L_shr_sat( mem_fx[0], diff ); move32(); mem_fx[1] = L_shr_sat( mem_fx[1], diff ); move32(); mem_fx[2] = L_shr_sat( mem_fx[2], diff ); move32(); mem_fx[3] = L_shr_sat( mem_fx[3], diff ); #else mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); move32(); mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); move32(); mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); move32(); mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); #endif move32(); move32(); move32(); move32(); mem_fx[4] = L_deposit_l( prescale_current_frame ); move32(); Loading @@ -406,10 +402,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/4000.0, 'high'); b = [0.988954248067140 -1.977908496134280 0.988954248067140] a =[1.000000000000000 -1.977786483776764 0.978030508491796]*/ a1_fx = 1061816033l /* 1.977786483776764 Q29*/; a2_fx = -525076131l /*-0.978030508491796 Q29*/; b1_fx = -1061881538l /*-1.977908496134280 Q29*/; b2_fx = 530940769l /* 0.988954248067140 Q29*/; a1_fx = 2123632067 /* 1.977786483776764 Q30*/; a2_fx = -1050152262 /*-0.978030508491796 Q30*/; b1_fx = -2123763076 /*-1.977908496134280 Q30*/; b2_fx = 1061881538 /* 0.988954248067140 Q30*/; } ELSE IF( EQ_32( Fs, 16000 ) ) { Loading @@ -417,10 +413,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/8000.0, 'high'); b =[ 0.994461788958195 -1.988923577916390 0.994461788958195] a =[1.000000000000000 -1.988892905899653 0.988954249933127] */ a1_fx = 1067778748l /* 1.988892905899653 Q29*/; a2_fx = -530940770l /*-0.988954249933127 Q29*/; b1_fx = -1067795215l /*-1.988923577916390 Q29*/; b2_fx = 533897608l /* 0.994461788958195 Q29*/; a1_fx = 2135557497 /* 1.988892905899653 Q30*/; a2_fx = -1061881540 /*-0.988954249933127 Q30*/; b1_fx = -2135590430 /*-1.988923577916390 Q30*/; b2_fx = 1067795215 /* 0.994461788958195 Q30*/; } ELSE IF( EQ_32( Fs, 32000 ) ) { Loading @@ -428,10 +424,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/16000.0, 'high'); b =[0.997227049904470 -1.994454099808940 0.997227049904470] a =[1.000000000000000 -1.994446410541927 0.994461789075954]*/ a1_fx = 1070760263l /* 1.994446410541927 Q29*/; a2_fx = -533897608l /*-0.994461789075954 Q29*/; b1_fx = -1070764392l /*-1.994454099808940 Q29*/; b2_fx = 535382196l /* 0.997227049904470 Q29*/; a1_fx = 2141520527 /* 1.994446410541927 Q30*/; a2_fx = -1067795215 /*-0.994461789075954 Q30*/; b1_fx = -2141528783 /*-1.994454099808940 Q30*/; b2_fx = 1070764392 /* 0.997227049904470 Q30*/; } ELSE { Loading @@ -439,10 +435,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/24000.0, 'high'); b =[ 0.998150511190452 -1.996301022380904 0.998150511190452] a =[1.000000000000000 -1.996297601769122 0.996304442992686]*/ a1_fx = 1071754114l /* 1.996297601769122 Q29*/; a2_fx = -534886875l /*-0.996304442992686 Q29*/; b1_fx = -1071755951l /*-1.996301022380904 Q29*/; b2_fx = 535877975l /* 0.998150511190452 Q29*/; a1_fx = 2143508228 /* 1.996297601769122 Q30*/; a2_fx = -1069773750 /*-0.996304442992686 Q30*/; b1_fx = -2143511901 /*-1.996301022380904 Q30*/; b2_fx = 1071755951 /* 0.998150511190452 Q30*/; } move32(); move32(); Loading @@ -451,24 +447,24 @@ void hp20_fx_32( Word64 W_sum, W_y0, W_y1, W_y2; Word32 x0, x1, x2; W_sum = W_mult_32_32( b2_fx, mem_fx[2] ); /* b2*x2 */ W_sum = W_mac_32_32( W_sum, b1_fx, mem_fx[3] ); /* b1*x1 */ W_sum = W_mult0_32_32( b2_fx, mem_fx[2] ); /* b2*x2 */ W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, mem_fx[3] ) ); /* b1*x1 */ x2 = L_shr( signal_fx[0], prescale ); W_sum = W_mac_32_32( W_sum, b2_fx, x2 ); /* b2*x0 */ W_sum = W_mac_32_32( W_sum, mem_fx[0], a2_fx ); /* y2*a2 */ W_sum = W_mac_32_32( W_sum, mem_fx[1], a1_fx ); /* y1*a1 */ W_y2 = W_shl( W_sum, HP20_COEFF_SCALE ); signal_fx[0] = W_extract_h( W_shl( W_y2, prescale ) ); W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x2 ) ); /* b2*x0 */ W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[0], a2_fx ) ); /* y2*a2 */ W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[1], a1_fx ) ); /* y1*a1 */ W_y2 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE ); signal_fx[0] = W_round64_L( W_shl( W_y2, prescale ) ); move32(); W_sum = W_mult_32_32( b2_fx, mem_fx[3] ); /* b2*x2 */ W_sum = W_mac_32_32( W_sum, b1_fx, x2 ); /* b1*x1 */ W_sum = W_mult0_32_32( b2_fx, mem_fx[3] ); /* b2*x2 */ W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, x2 ) ); /* b1*x1 */ x1 = L_shr( signal_fx[1], prescale ); W_sum = W_mac_32_32( W_sum, b2_fx, x1 ); /* b2*x0 */ W_sum = W_mac_32_32( W_sum, mem_fx[1], a2_fx ); /* y2*a2 */ W_sum = W_mac_32_32( W_sum, W_extract_h( W_y2 ), a1_fx ); /* y1*a1 */ W_y1 = W_shl( W_sum, HP20_COEFF_SCALE ); signal_fx[1] = W_extract_h( W_shl( W_y1, prescale ) ); W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x1 ) ); /* b2*x0 */ W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[1], a2_fx ) ); /* y2*a2 */ W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y2 ), a1_fx ) ); /* y1*a1 */ W_y1 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE ); signal_fx[1] = W_round64_L( W_shl( W_y1, prescale ) ); move32(); diff = sub( prescale_current_frame, prescale ); Loading @@ -479,15 +475,15 @@ void hp20_fx_32( FOR( i = 2; i < lg; i++ ) { W_sum = W_mult_32_32( b2_fx, x2 ); /* b2*x2 */ W_sum = W_mac_32_32( W_sum, b1_fx, x1 ); /* b1*x1 */ W_sum = W_mult0_32_32( b2_fx, x2 ); /* b2*x2 */ W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, x1 ) ); /* b1*x1 */ x0 = L_shr( signal_fx[i], prescale_current_frame ); W_sum = W_mac_32_32( W_sum, b2_fx, x0 ); /* b2*x0 */ W_sum = W_mac_32_32( W_sum, W_extract_h( W_y2 ), a2_fx ); /* y2*a2 */ W_sum = W_mac_32_32( W_sum, W_extract_h( W_y1 ), a1_fx ); /* y1*a1 */ W_y0 = W_shl( W_sum, HP20_COEFF_SCALE ); W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x0 ) ); /* b2*x0 */ W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y2 ), a2_fx ) ); /* y2*a2 */ W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y1 ), a1_fx ) ); /* y1*a1 */ W_y0 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE ); signal_fx[i] = W_extract_h( W_shl( W_y0, prescale_current_frame ) ); signal_fx[i] = W_round64_L( W_shl( W_y0, prescale_current_frame ) ); move32(); x2 = x1; Loading @@ -501,8 +497,8 @@ void hp20_fx_32( move64(); } mem_fx[0] = W_extract_h( W_y2 ); mem_fx[1] = W_extract_h( W_y1 ); mem_fx[0] = W_round64_L( W_y2 ); mem_fx[1] = W_round64_L( W_y1 ); mem_fx[2] = x2; mem_fx[3] = x1; Loading @@ -513,7 +509,7 @@ void hp20_fx_32( return; } #else #endif void hp20_fx_32( Word32 signal_fx[], const Word16 lg, Loading Loading @@ -698,4 +694,3 @@ void hp20_fx_32( return; } #endif lib_com/ivas_dirac_com_fx.c +12 −0 Original line number Diff line number Diff line Loading @@ -218,6 +218,17 @@ ivas_error ivas_dirac_config_fx( } test(); #ifdef FIX_2085_FLOATING_POINT_LEFTOVERS IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { // 100861_dirac_dec ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft, 1 ); } ELSE { ivas_dirac_config_bands_fx( band_grouping, hConfig->nbands, extract_l( Mpy_32_32_r( Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), NULL, 0, 0, hFbMdft, 1 ); } #else IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { // 100861_dirac_dec Loading @@ -227,6 +238,7 @@ ivas_error ivas_dirac_config_fx( { ivas_dirac_config_bands_fx( band_grouping, hConfig->nbands, (Word16) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft, 1 ); } #endif return error; } Loading Loading
apps/decoder.c +35 −1 Original line number Diff line number Diff line Loading @@ -2265,6 +2265,23 @@ static ivas_error decodeG192( } } #endif #ifdef FIX_HRTF_LOAD_API /* decode transport channels, do TSM and feed to renderer */ if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, isSplitRend, splitRendBits ) ) != IVAS_ERR_OK ) { return error; } #endif #ifdef OBJ_EDITING_API /* Do the final preparations needed for rendering */ if ( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: could not prepare the renderer: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #endif } if ( isSplitRend ) Loading Loading @@ -2714,6 +2731,9 @@ static ivas_error decodeVoIP( int16_t nOutSamples = 0; #ifdef FIX_CREND_SIMPLIFY_CODE bool bitstreamReadDone = false; #ifdef OBJ_EDITING_API bool parametersAvailableForEditing = false; #endif uint16_t nSamplesRendered; #endif Loading Loading @@ -3005,13 +3025,21 @@ static ivas_error decodeVoIP( #endif #ifdef SUPPORT_JBM_TRACEFILE #ifdef FIX_CREND_SIMPLIFY_CODE #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, ¶metersAvailableForEditing ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered ) ) != IVAS_ERR_OK ) #endif #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK ) #endif #else #ifdef FIX_CREND_SIMPLIFY_CODE #ifdef OBJ_EDITING_API if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, &bitstreamReadDone, ¶metersAvailableForEditing ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, &bitstreamReadDone ) ) != IVAS_ERR_OK ) #endif #else if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms ) ) != IVAS_ERR_OK ) #endif Loading Loading @@ -3046,9 +3074,15 @@ static ivas_error decodeVoIP( } } #endif #ifdef FIX_HRTF_LOAD #ifdef OBJ_EDITING_API if ( parametersAvailableForEditing == true ) { /* do the object editing here */ } #endif #ifdef FIX_HRTF_LOAD } /* while ( nSamplesRendered < nOutSamples ) */ #endif /* write JBM Offset file entry */ if ( jbmOffsetWriter != NULL ) Loading
lib_com/cnst.h +6 −2 Original line number Diff line number Diff line Loading @@ -799,8 +799,12 @@ enum #define CLDFB_NO_COL_MAX_SWITCH 6 /* CLDFB resampling - max number of CLDFB col. for switching */ #define CLDFB_NO_COL_MAX_SWITCH_BFI 10 /* CLDFB resampling - max number of CLDFB col. for switching, BFI */ #define CLDFB_OVRLP_MIN_SLOTS 3 /* CLDFB resampling - minimize processing to minimum required for transition frame ACELP->TCX/HQ */ #ifndef FIX_2085_FLOATING_POINT_LEFTOVERS #define INV_CLDFB_BANDWIDTH ( 1.f / 800.f ) #define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) #endif #define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) /* ( 1.f / 800.f ) Q31 */ #define INV_CLDFB_BANDWIDTH_MDFT_FAC_Q31 ( 10737418 ) #define CLDFB_BANDWIDTH 800 Loading
lib_com/common_api_types.h +12 −0 Original line number Diff line number Diff line Loading @@ -137,9 +137,21 @@ typedef struct _IVAS_ISM_METADATA float yaw; float pitch; Word16 non_diegetic_flag; #ifdef OBJ_EDITING_API Word32 gain_fx; #endif } IVAS_ISM_METADATA; #ifdef OBJ_EDITING_API typedef struct _IVAS_EDITABLE_PARAMETERS { Word16 num_obj; IVAS_ISM_METADATA ism_metadata[IVAS_MAX_NUM_OBJECTS]; Word32 gain_bed_fx; } IVAS_EDITABLE_PARAMETERS; #endif typedef struct { // float w, x, y, z; Loading
lib_com/hp50_fx.c +63 −68 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include "wmc_auto.h" #define HP20_COEFF_SCALE ( 2 ) #define HP20_FX_COEFF_SCALE ( 1 ) /* * hp20 * Loading Loading @@ -340,7 +341,7 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * #ifdef HP20_FIX32_RECODING void hp20_fx_32( void hp20_fx_32_opt( Word32 signal_fx[], const Word16 lg, Word32 mem_fx[], Loading @@ -348,54 +349,49 @@ void hp20_fx_32( { Word32 i; Word32 a1_fx, a2_fx, b1_fx, b2_fx; Word32 diff_pos, diff_neg; #ifndef ISSUE_1836_replace_overflow_libcom Flag Overflow = 0; #endif Word16 prescale, prescaleOld, prescale_current_frame, diff; Word32 tmp_mem[4]; prescale = getScaleFactor32( signal_fx, lg ); prescale_current_frame = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); prescale = L_norm_arr( signal_fx, lg ); prescale_current_frame = sub( 1 + HP20_FX_COEFF_SCALE, prescale ); prescaleOld = extract_l( mem_fx[4] ); #ifdef ISSUE_1836_replace_overflow_libcom diff_pos = norm_l( L_shl_sat( L_max( mem_fx[2], mem_fx[3] ), prescaleOld ) ); diff_neg = norm_l( L_shl_sat( L_min( mem_fx[2], mem_fx[3] ), prescaleOld ) ); #else diff_pos = norm_l( L_shl_o( L_max( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); diff_neg = norm_l( L_shl_o( L_min( mem_fx[2], mem_fx[3] ), prescaleOld, &Overflow ) ); #endif tmp_mem[0] = L_shl_sat( mem_fx[0], prescaleOld ); tmp_mem[1] = L_shl_sat( mem_fx[1], prescaleOld ); tmp_mem[2] = L_shl_sat( mem_fx[2], prescaleOld ); tmp_mem[3] = L_shl_sat( mem_fx[3], prescaleOld ); move32(); move32(); move32(); move32(); diff = L_norm_arr( tmp_mem, 4 ); prescale = s_min( prescale, diff ); diff = L_max( diff_pos, diff_neg ); prescale = sub( 1 + HP20_FX_COEFF_SCALE, prescale ); IF( NE_16( diff, 0 ) ) if ( EQ_16( prescale_current_frame, 1 + HP20_FX_COEFF_SCALE - 31 ) ) // signal_fx buffer contains only zeros, so use the mem_fx scale_factor instead { prescale = s_min( prescale, diff ); prescale_current_frame = prescale; } prescale = s_min( 3, sub( 1 + HP20_COEFF_SCALE, prescale ) ); diff = sub( prescale, prescaleOld ); #ifdef ISSUE_1836_replace_overflow_libcom mem_fx[0] = L_shr_sat( mem_fx[0], diff ); move32(); mem_fx[1] = L_shr_sat( mem_fx[1], diff ); move32(); mem_fx[2] = L_shr_sat( mem_fx[2], diff ); move32(); mem_fx[3] = L_shr_sat( mem_fx[3], diff ); #else mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow ); move32(); mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow ); move32(); mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow ); move32(); mem_fx[3] = L_shr_o( mem_fx[3], diff, &Overflow ); #endif move32(); move32(); move32(); move32(); mem_fx[4] = L_deposit_l( prescale_current_frame ); move32(); Loading @@ -406,10 +402,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/4000.0, 'high'); b = [0.988954248067140 -1.977908496134280 0.988954248067140] a =[1.000000000000000 -1.977786483776764 0.978030508491796]*/ a1_fx = 1061816033l /* 1.977786483776764 Q29*/; a2_fx = -525076131l /*-0.978030508491796 Q29*/; b1_fx = -1061881538l /*-1.977908496134280 Q29*/; b2_fx = 530940769l /* 0.988954248067140 Q29*/; a1_fx = 2123632067 /* 1.977786483776764 Q30*/; a2_fx = -1050152262 /*-0.978030508491796 Q30*/; b1_fx = -2123763076 /*-1.977908496134280 Q30*/; b2_fx = 1061881538 /* 0.988954248067140 Q30*/; } ELSE IF( EQ_32( Fs, 16000 ) ) { Loading @@ -417,10 +413,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/8000.0, 'high'); b =[ 0.994461788958195 -1.988923577916390 0.994461788958195] a =[1.000000000000000 -1.988892905899653 0.988954249933127] */ a1_fx = 1067778748l /* 1.988892905899653 Q29*/; a2_fx = -530940770l /*-0.988954249933127 Q29*/; b1_fx = -1067795215l /*-1.988923577916390 Q29*/; b2_fx = 533897608l /* 0.994461788958195 Q29*/; a1_fx = 2135557497 /* 1.988892905899653 Q30*/; a2_fx = -1061881540 /*-0.988954249933127 Q30*/; b1_fx = -2135590430 /*-1.988923577916390 Q30*/; b2_fx = 1067795215 /* 0.994461788958195 Q30*/; } ELSE IF( EQ_32( Fs, 32000 ) ) { Loading @@ -428,10 +424,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/16000.0, 'high'); b =[0.997227049904470 -1.994454099808940 0.997227049904470] a =[1.000000000000000 -1.994446410541927 0.994461789075954]*/ a1_fx = 1070760263l /* 1.994446410541927 Q29*/; a2_fx = -533897608l /*-0.994461789075954 Q29*/; b1_fx = -1070764392l /*-1.994454099808940 Q29*/; b2_fx = 535382196l /* 0.997227049904470 Q29*/; a1_fx = 2141520527 /* 1.994446410541927 Q30*/; a2_fx = -1067795215 /*-0.994461789075954 Q30*/; b1_fx = -2141528783 /*-1.994454099808940 Q30*/; b2_fx = 1070764392 /* 0.997227049904470 Q30*/; } ELSE { Loading @@ -439,10 +435,10 @@ void hp20_fx_32( [b,a] = butter(2, 20.0/24000.0, 'high'); b =[ 0.998150511190452 -1.996301022380904 0.998150511190452] a =[1.000000000000000 -1.996297601769122 0.996304442992686]*/ a1_fx = 1071754114l /* 1.996297601769122 Q29*/; a2_fx = -534886875l /*-0.996304442992686 Q29*/; b1_fx = -1071755951l /*-1.996301022380904 Q29*/; b2_fx = 535877975l /* 0.998150511190452 Q29*/; a1_fx = 2143508228 /* 1.996297601769122 Q30*/; a2_fx = -1069773750 /*-0.996304442992686 Q30*/; b1_fx = -2143511901 /*-1.996301022380904 Q30*/; b2_fx = 1071755951 /* 0.998150511190452 Q30*/; } move32(); move32(); Loading @@ -451,24 +447,24 @@ void hp20_fx_32( Word64 W_sum, W_y0, W_y1, W_y2; Word32 x0, x1, x2; W_sum = W_mult_32_32( b2_fx, mem_fx[2] ); /* b2*x2 */ W_sum = W_mac_32_32( W_sum, b1_fx, mem_fx[3] ); /* b1*x1 */ W_sum = W_mult0_32_32( b2_fx, mem_fx[2] ); /* b2*x2 */ W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, mem_fx[3] ) ); /* b1*x1 */ x2 = L_shr( signal_fx[0], prescale ); W_sum = W_mac_32_32( W_sum, b2_fx, x2 ); /* b2*x0 */ W_sum = W_mac_32_32( W_sum, mem_fx[0], a2_fx ); /* y2*a2 */ W_sum = W_mac_32_32( W_sum, mem_fx[1], a1_fx ); /* y1*a1 */ W_y2 = W_shl( W_sum, HP20_COEFF_SCALE ); signal_fx[0] = W_extract_h( W_shl( W_y2, prescale ) ); W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x2 ) ); /* b2*x0 */ W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[0], a2_fx ) ); /* y2*a2 */ W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[1], a1_fx ) ); /* y1*a1 */ W_y2 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE ); signal_fx[0] = W_round64_L( W_shl( W_y2, prescale ) ); move32(); W_sum = W_mult_32_32( b2_fx, mem_fx[3] ); /* b2*x2 */ W_sum = W_mac_32_32( W_sum, b1_fx, x2 ); /* b1*x1 */ W_sum = W_mult0_32_32( b2_fx, mem_fx[3] ); /* b2*x2 */ W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, x2 ) ); /* b1*x1 */ x1 = L_shr( signal_fx[1], prescale ); W_sum = W_mac_32_32( W_sum, b2_fx, x1 ); /* b2*x0 */ W_sum = W_mac_32_32( W_sum, mem_fx[1], a2_fx ); /* y2*a2 */ W_sum = W_mac_32_32( W_sum, W_extract_h( W_y2 ), a1_fx ); /* y1*a1 */ W_y1 = W_shl( W_sum, HP20_COEFF_SCALE ); signal_fx[1] = W_extract_h( W_shl( W_y1, prescale ) ); W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x1 ) ); /* b2*x0 */ W_sum = W_add( W_sum, W_mult0_32_32( mem_fx[1], a2_fx ) ); /* y2*a2 */ W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y2 ), a1_fx ) ); /* y1*a1 */ W_y1 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE ); signal_fx[1] = W_round64_L( W_shl( W_y1, prescale ) ); move32(); diff = sub( prescale_current_frame, prescale ); Loading @@ -479,15 +475,15 @@ void hp20_fx_32( FOR( i = 2; i < lg; i++ ) { W_sum = W_mult_32_32( b2_fx, x2 ); /* b2*x2 */ W_sum = W_mac_32_32( W_sum, b1_fx, x1 ); /* b1*x1 */ W_sum = W_mult0_32_32( b2_fx, x2 ); /* b2*x2 */ W_sum = W_add( W_sum, W_mult0_32_32( b1_fx, x1 ) ); /* b1*x1 */ x0 = L_shr( signal_fx[i], prescale_current_frame ); W_sum = W_mac_32_32( W_sum, b2_fx, x0 ); /* b2*x0 */ W_sum = W_mac_32_32( W_sum, W_extract_h( W_y2 ), a2_fx ); /* y2*a2 */ W_sum = W_mac_32_32( W_sum, W_extract_h( W_y1 ), a1_fx ); /* y1*a1 */ W_y0 = W_shl( W_sum, HP20_COEFF_SCALE ); W_sum = W_add( W_sum, W_mult0_32_32( b2_fx, x0 ) ); /* b2*x0 */ W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y2 ), a2_fx ) ); /* y2*a2 */ W_sum = W_add( W_sum, W_mult0_32_32( W_round64_L( W_y1 ), a1_fx ) ); /* y1*a1 */ W_y0 = W_shl( W_sum, 1 + HP20_FX_COEFF_SCALE ); signal_fx[i] = W_extract_h( W_shl( W_y0, prescale_current_frame ) ); signal_fx[i] = W_round64_L( W_shl( W_y0, prescale_current_frame ) ); move32(); x2 = x1; Loading @@ -501,8 +497,8 @@ void hp20_fx_32( move64(); } mem_fx[0] = W_extract_h( W_y2 ); mem_fx[1] = W_extract_h( W_y1 ); mem_fx[0] = W_round64_L( W_y2 ); mem_fx[1] = W_round64_L( W_y1 ); mem_fx[2] = x2; mem_fx[3] = x1; Loading @@ -513,7 +509,7 @@ void hp20_fx_32( return; } #else #endif void hp20_fx_32( Word32 signal_fx[], const Word16 lg, Loading Loading @@ -698,4 +694,3 @@ void hp20_fx_32( return; } #endif
lib_com/ivas_dirac_com_fx.c +12 −0 Original line number Diff line number Diff line Loading @@ -218,6 +218,17 @@ ivas_error ivas_dirac_config_fx( } test(); #ifdef FIX_2085_FLOATING_POINT_LEFTOVERS IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { // 100861_dirac_dec ivas_dirac_config_bands_fx( band_grouping, IVAS_MAX_NUM_BANDS, extract_l( Mpy_32_32_r( Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft, 1 ); } ELSE { ivas_dirac_config_bands_fx( band_grouping, hConfig->nbands, extract_l( Mpy_32_32_r( Fs, INV_CLDFB_BANDWIDTH_Q31 ) ), NULL, 0, 0, hFbMdft, 1 ); } #else IF( EQ_32( ivas_format, SBA_FORMAT ) || EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { // 100861_dirac_dec Loading @@ -227,6 +238,7 @@ ivas_error ivas_dirac_config_fx( { ivas_dirac_config_bands_fx( band_grouping, hConfig->nbands, (Word16) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), NULL, 0, 0, hFbMdft, 1 ); } #endif return error; } Loading