From a4628b43288b7e64f324255377797cf477036ebd Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 9 Jan 2024 09:55:01 +0530 Subject: [PATCH] fft_fx failure fix and float build fix [x] Fixes the fft_fx - failure due to assert observed with the version where CL_Basops were added. The issue was due to continuity in the usage of stride parameter even after introducing CL_Basops at few places. [x] Fix for build issue when IVAS_FLOAT_FIXED is disabled. --- lib_com/fft_fx.c | 85 +++++++++++++++++++-------------------- lib_dec/ivas_agc_dec_fx.c | 3 ++ 2 files changed, 45 insertions(+), 43 deletions(-) diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 32551b685..55611f0b1 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -4794,7 +4794,6 @@ static void fft_lenN( const Word16 len, const Word16 dim1, const Word16 dim2, - const Word16 sx, const Word16 sc, const Word16 Woff ) { @@ -4805,8 +4804,8 @@ static void fft_lenN( { FOR ( j = 0; j < dim1; j++ ) { - xx[i * dim1 + j].re = x[sx * i + sx * j * dim2].re; - xx[i * dim1 + j].im = x[sx * i + sx * j * dim2].im; + xx[i * dim1 + j].re = x[i + j * dim2].re; + xx[i * dim1 + j].im = x[i + j * dim2].im; } } @@ -4963,14 +4962,14 @@ static void fft_lenN( s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); s[7] = CL_conjugate( s[7] ); - x[sx * i + sx * 0 * dim1] = CL_add( s[0], s[1] ); - x[sx * i + sx * 1 * dim1] = CL_add( s[5], s[6] ); - x[sx * i + sx * 2 * dim1] = CL_sub( s[2], s[3] ); - x[sx * i + sx * 3 * dim1] = CL_add( s[4], s[7] ); - x[sx * i + sx * 4 * dim1] = CL_sub( s[0], s[1] ); - x[sx * i + sx * 5 * dim1] = CL_sub( s[5], s[6] ); - x[sx * i + sx * 6 * dim1] = CL_add( s[2], s[3] ); - x[sx * i + sx * 7 * dim1] = CL_sub( s[4], s[7] ); + x[i + 0 * dim1] = CL_add( s[0], s[1] ); + x[i + 1 * dim1] = CL_add( s[5], s[6] ); + x[i + 2 * dim1] = CL_sub( s[2], s[3] ); + x[i + 3 * dim1] = CL_add( s[4], s[7] ); + x[i + 4 * dim1] = CL_sub( s[0], s[1] ); + x[i + 5 * dim1] = CL_sub( s[5], s[6] ); + x[i + 6 * dim1] = CL_add( s[2], s[3] ); + x[i + 7 * dim1] = CL_sub( s[4], s[7] ); } } ELSE @@ -5059,14 +5058,14 @@ static void fft_lenN( s[7] = CL_scale( CL_sub( t[0], CL_conjugate( t[1] ) ), FFT_C81 ); s[7] = CL_conjugate( s[7] ); - x[sx * i + sx * 0 * dim1] = CL_add( s[0], s[1] ); - x[sx * i + sx * 1 * dim1] = CL_add( s[5], s[6] ); - x[sx * i + sx * 2 * dim1] = CL_sub( s[2], s[3] ); - x[sx * i + sx * 3 * dim1] = CL_add( s[4], s[7] ); - x[sx * i + sx * 4 * dim1] = CL_sub( s[0], s[1] ); - x[sx * i + sx * 5 * dim1] = CL_sub( s[5], s[6] ); - x[sx * i + sx * 6 * dim1] = CL_add( s[2], s[3] ); - x[sx * i + sx * 7 * dim1] = CL_sub( s[4], s[7] ); + x[i + 0 * dim1] = CL_add( s[0], s[1] ); + x[i + 1 * dim1] = CL_add( s[5], s[6] ); + x[i + 2 * dim1] = CL_sub( s[2], s[3] ); + x[i + 3 * dim1] = CL_add( s[4], s[7] ); + x[i + 4 * dim1] = CL_sub( s[0], s[1] ); + x[i + 5 * dim1] = CL_sub( s[5], s[6] ); + x[i + 6 * dim1] = CL_add( s[2], s[3] ); + x[i + 7 * dim1] = CL_sub( s[4], s[7] ); } } BREAK; @@ -5084,7 +5083,7 @@ static void fft_lenN( fft_len10( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * 0 + sx * j * dim1] = y[j]; + x[0 + j * dim1] = y[j]; } FOR ( i = 1; i < dim1; i++ ) @@ -5103,7 +5102,7 @@ static void fft_lenN( fft_len10( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * i + sx * j * dim1] = y[j]; + x[i + j * dim1] = y[j]; } } BREAK; @@ -5121,7 +5120,7 @@ static void fft_lenN( fft_len16( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * 0 + sx * j * dim1] = y[j]; + x[0 + j * dim1] = y[j]; } FOR ( i = 1; i < dim1; i++ ) @@ -5140,7 +5139,7 @@ static void fft_lenN( fft_len16( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * i + sx * j * dim1] = y[j]; + x[i + j * dim1] = y[j]; } } BREAK; @@ -5158,7 +5157,7 @@ static void fft_lenN( fft_len20_fx( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * 0 + sx * j * dim1] = y[j]; + x[0 + j * dim1] = y[j]; } FOR ( i = 1; i < dim1; i++ ) @@ -5185,7 +5184,7 @@ static void fft_lenN( fft_len20_fx( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * i + sx * j * dim1] = y[j]; + x[i + j * dim1] = y[j]; } } BREAK; @@ -5203,7 +5202,7 @@ static void fft_lenN( fft_len32( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * 0 + sx * j * dim1] = y[j]; + x[0 + j * dim1] = y[j]; } FOR ( i = 1; i < dim1; i++ ) @@ -5230,7 +5229,7 @@ static void fft_lenN( fft_len32( &y[0] ); FOR ( j = 0; j < dim2; j++ ) { - x[sx * i + sx * j * dim1] = y[j]; + x[i + j * dim1] = y[j]; } } BREAK; @@ -5266,52 +5265,52 @@ void fft_fx( fft_len20_fx( x ); BREAK; case 40: - fft_lenN( x, FFT_RotVector_640_fx, 640, 5, 8, s, 8, 40 ); + fft_lenN( x, FFT_RotVector_640_fx, 640, 5, 8, 8, 40 ); BREAK; case 64: - fft_lenN( x, FFT_RotVector_256_fx, 256, 8, 8, s, 8, 64 ); + fft_lenN( x, FFT_RotVector_256_fx, 256, 8, 8, 8, 64 ); BREAK; case 80: - fft_lenN( x, FFT_RotVector_640_fx, 640, 10, 8, s, 4, 40 ); + fft_lenN( x, FFT_RotVector_640_fx, 640, 10, 8, 4, 40 ); BREAK; case 100: - fft_lenN( x, FFT_RotVector_400_fx, 400, 10, 10, s, 4, 40 ); + fft_lenN( x, FFT_RotVector_400_fx, 400, 10, 10, 4, 40 ); BREAK; case 120: - fft_lenN( x, FFT_RotVector_960_fx, 960, 15, 8, s, 4, 60 ); + fft_lenN( x, FFT_RotVector_960_fx, 960, 15, 8, 4, 60 ); BREAK; case 128: - fft_lenN( x, FFT_RotVector_256_fx, 256, 16, 8, s, 4, 64 ); + fft_lenN( x, FFT_RotVector_256_fx, 256, 16, 8, 4, 64 ); BREAK; case 160: - fft_lenN( x, FFT_RotVector_640_fx, 640, 20, 8, s, 2, 40 ); + fft_lenN( x, FFT_RotVector_640_fx, 640, 20, 8, 2, 40 ); BREAK; case 200: - fft_lenN( x, FFT_RotVector_400_fx, 400, 20, 10, s, 2, 40 ); + fft_lenN( x, FFT_RotVector_400_fx, 400, 20, 10, 2, 40 ); BREAK; case 240: - fft_lenN( x, FFT_RotVector_960_fx, 960, 30, 8, s, 2, 60 ); + fft_lenN( x, FFT_RotVector_960_fx, 960, 30, 8, 2, 60 ); BREAK; case 256: - fft_lenN( x, FFT_RotVector_256_fx, 256, 32, 8, s, 2, 64 ); + fft_lenN( x, FFT_RotVector_256_fx, 256, 32, 8, 2, 64 ); BREAK; case 320: - fft_lenN( x, FFT_RotVector_640_fx, 640, 20, 16, s, 2, 40 ); + fft_lenN( x, FFT_RotVector_640_fx, 640, 20, 16, 2, 40 ); BREAK; case 400: - fft_lenN( x, FFT_RotVector_400_fx, 400, 20, 20, s, 2, 40 ); + fft_lenN( x, FFT_RotVector_400_fx, 400, 20, 20, 2, 40 ); BREAK; case 480: - fft_lenN( x, FFT_RotVector_960_fx, 960, 30, 16, s, 2, 60 ); + fft_lenN( x, FFT_RotVector_960_fx, 960, 30, 16, 2, 60 ); BREAK; case 600: - fft_lenN( x, FFT_RotVector_600_fx, 600, 30, 20, s, 2, 60 ); + fft_lenN( x, FFT_RotVector_600_fx, 600, 30, 20, 2, 60 ); BREAK; case 640: - fft_lenN( x, FFT_RotVector_640_fx, 640, 20, 32, s, 2, 40 ); + fft_lenN( x, FFT_RotVector_640_fx, 640, 20, 32, 2, 40 ); BREAK; case 960: - fft_lenN( x, FFT_RotVector_960_fx, 960, 30, 32, s, 2, 60 ); + fft_lenN( x, FFT_RotVector_960_fx, 960, 30, 32, 2, 60 ); BREAK; default: assert( !"fft length is not supported!" ); diff --git a/lib_dec/ivas_agc_dec_fx.c b/lib_dec/ivas_agc_dec_fx.c index 10dbe1589..6c292af64 100644 --- a/lib_dec/ivas_agc_dec_fx.c +++ b/lib_dec/ivas_agc_dec_fx.c @@ -32,6 +32,8 @@ #include #include "options.h" +#ifdef IVAS_FLOAT_FIXED + #include "prot.h" #include "prot_fx2.h" #include "ivas_prot.h" @@ -346,3 +348,4 @@ void ivas_agc_read_bits_fx( return; } +#endif -- GitLab