From 9360eb290faf22f39aa531f2a30eb554dfe1c7fe Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 4 Dec 2025 15:00:18 +0100 Subject: [PATCH 1/9] set default OPTIM to 3 in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c9ae4493d..39c936f43 100644 --- a/Makefile +++ b/Makefile @@ -132,7 +132,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 0 +OPTIM ?= 3 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) -- GitLab From d4aa290bfaf106379e7cad9bfc45867cd7218cd7 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 4 Dec 2025 15:34:37 +0100 Subject: [PATCH 2/9] change to -O2 to avoid warnings --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 39c936f43..016b1aa19 100644 --- a/Makefile +++ b/Makefile @@ -132,7 +132,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 3 +OPTIM ?= 2 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) -- GitLab From 331f94925b81cbd32e0d5ae699fca9a3093fe447 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 4 Dec 2025 15:39:50 +0100 Subject: [PATCH 3/9] back to O3 and try to remove -Werror --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 016b1aa19..dbb3ba21e 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,6 @@ CFLAGS += -std=c99 -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \ -Werror-implicit-function-declaration \ -Wno-implicit-fallthrough -ffp-contract=off # to be uncommented in CI -# CFLAGS += -Werror CFLAGS += -Winit-self CFLAGS += -Wunused-but-set-variable @@ -132,7 +131,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 2 +OPTIM ?= 3 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) -- GitLab From 2f808acfab9878f8f74e97f9f89be663358f4c58 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 4 Dec 2025 16:17:19 +0100 Subject: [PATCH 4/9] change to O2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dbb3ba21e..f02c32c8f 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 3 +OPTIM ?= 2 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) -- GitLab From b9d749f0a6831255293ed86202dc4d83fe953037 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 4 Dec 2025 16:36:12 +0100 Subject: [PATCH 5/9] change to O1 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f02c32c8f..1770d85a2 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 2 +OPTIM ?= 1 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) -- GitLab From b685b6e186f61963dea89a160bd82270afb618d1 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 5 Dec 2025 10:55:29 +0100 Subject: [PATCH 6/9] try clang O0 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1770d85a2..f9ea17261 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ LIB_LC3PLUS ?= liblc3plus.a LIB_LIBUTIL ?= libivasutil.a # Default tool settings -CC ?= gcc +CC ?= clang RM ?= rm -f AR ?= ar @@ -131,7 +131,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 1 +OPTIM ?= 0 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) -- GitLab From d3b49e90ef1e6ca5eb221ee1c2365827fb82c28c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 5 Dec 2025 12:16:24 +0100 Subject: [PATCH 7/9] test clang -O1 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9ea17261..8be0183c6 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 0 +OPTIM ?= 1 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) -- GitLab From 39904d4b7198f5bea0bd45eae1078393cfcc9826 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Fri, 5 Dec 2025 15:33:20 +0100 Subject: [PATCH 8/9] back to O3 and try a fix --- Makefile | 2 +- lib_com/rom_basic_math.c | 54 ++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 8be0183c6..5dd0f600b 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,7 @@ LDFLAGS += -Wl,-dead_strip endif endif -OPTIM ?= 1 +OPTIM ?= 3 CFLAGS += -O$(OPTIM) CFLAGS += $(foreach DIR,$(SRC_DIRS),-I$(DIR)) diff --git a/lib_com/rom_basic_math.c b/lib_com/rom_basic_math.c index 589935254..61716f926 100644 --- a/lib_com/rom_basic_math.c +++ b/lib_com/rom_basic_math.c @@ -1,6 +1,33 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Decoder static structure */ #include "stl.h" +/* log2.c */ +const Word32 L_table_Log2_norm_lc[32] = { // Q31 + -32768L, 95322112L, 187793408L, 277577728L, + 364871680L, 449740800L, 532381696L, 612859904L, + 691306496L, 767787008L, 842432512L, 915308544L, + 986546176L, 1056210944L, 1124302848L, 1190887424L, + 1256095744L, 1319993344L, 1382580224L, 1443921920L, + 1504083968L, 1563131904L, 1621000192L, 1677885440L, + 1733722112L, 1788510208L, 1842380800L, 1895399424L, + 1947435008L, 1998618624L, 2049015808L, 2098626560L +}; + +const Word16 table_diff_Log2_norm_lc[32] = { // Q15 + 1455, 1411, 1370, 1332, 1295, 1261, 1228, 1197, + 1167, 1139, 1112, 1087, 1063, 1039, 1016, 995, + 975, 955, 936, 918, 901, 883, 868, 852, + 836, 822, 809, 794, 781, 769, 757, 744 +}; + +const Word16 log2_tab[33] = { // Q15 + 0x7800, 0x782D, 0x785A, 0x7884, 0x78AE, 0x78D6, 0x78FE, 0x7924, + 0x794A, 0x796E, 0x7992, 0x79B4, 0x79D6, 0x79F8, 0x7A18, 0x7A38, + 0x7A57, 0x7A75, 0x7A93, 0x7AB1, 0x7ACD, 0x7AE9, 0x7B05, 0x7B20, + 0x7B3B, 0x7B55, 0x7B6F, 0x7B88, 0x7BA1, 0x7BB9, 0x7BD1, 0x7BE9, + 0x7C00 +}; + /* math_op.c */ const Word32 L_table_isqrt[48] = { // Q31 2147418112L, 2083389440L, 2024669184L, 1970667520L, @@ -53,30 +80,3 @@ const Word16 sqrt_table[49] = { // Q15 29251, 29537, 29819, 30099, 30377, 30652, 30924, 31194, 31462, 31727, 31991, 32252, 32511, 32767 }; - -/* log2.c */ -const Word32 L_table_Log2_norm_lc[32] = { // Q31 - -32768L, 95322112L, 187793408L, 277577728L, - 364871680L, 449740800L, 532381696L, 612859904L, - 691306496L, 767787008L, 842432512L, 915308544L, - 986546176L, 1056210944L, 1124302848L, 1190887424L, - 1256095744L, 1319993344L, 1382580224L, 1443921920L, - 1504083968L, 1563131904L, 1621000192L, 1677885440L, - 1733722112L, 1788510208L, 1842380800L, 1895399424L, - 1947435008L, 1998618624L, 2049015808L, 2098626560L -}; - -const Word16 table_diff_Log2_norm_lc[32] = { // Q15 - 1455, 1411, 1370, 1332, 1295, 1261, 1228, 1197, - 1167, 1139, 1112, 1087, 1063, 1039, 1016, 995, - 975, 955, 936, 918, 901, 883, 868, 852, - 836, 822, 809, 794, 781, 769, 757, 744 -}; - -const Word16 log2_tab[33] = { // Q15 - 0x7800, 0x782D, 0x785A, 0x7884, 0x78AE, 0x78D6, 0x78FE, 0x7924, - 0x794A, 0x796E, 0x7992, 0x79B4, 0x79D6, 0x79F8, 0x7A18, 0x7A38, - 0x7A57, 0x7A75, 0x7A93, 0x7AB1, 0x7ACD, 0x7AE9, 0x7B05, 0x7B20, - 0x7B3B, 0x7B55, 0x7B6F, 0x7B88, 0x7BA1, 0x7BB9, 0x7BD1, 0x7BE9, - 0x7C00 -}; -- GitLab From a870287fd34e31e7a96d4705a2b41e06000c061d Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 15 Dec 2025 12:45:47 +0100 Subject: [PATCH 9/9] revert changes to rom_basic_math.c --- lib_com/rom_basic_math.c | 54 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/lib_com/rom_basic_math.c b/lib_com/rom_basic_math.c index 61716f926..589935254 100644 --- a/lib_com/rom_basic_math.c +++ b/lib_com/rom_basic_math.c @@ -1,33 +1,6 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Decoder static structure */ #include "stl.h" -/* log2.c */ -const Word32 L_table_Log2_norm_lc[32] = { // Q31 - -32768L, 95322112L, 187793408L, 277577728L, - 364871680L, 449740800L, 532381696L, 612859904L, - 691306496L, 767787008L, 842432512L, 915308544L, - 986546176L, 1056210944L, 1124302848L, 1190887424L, - 1256095744L, 1319993344L, 1382580224L, 1443921920L, - 1504083968L, 1563131904L, 1621000192L, 1677885440L, - 1733722112L, 1788510208L, 1842380800L, 1895399424L, - 1947435008L, 1998618624L, 2049015808L, 2098626560L -}; - -const Word16 table_diff_Log2_norm_lc[32] = { // Q15 - 1455, 1411, 1370, 1332, 1295, 1261, 1228, 1197, - 1167, 1139, 1112, 1087, 1063, 1039, 1016, 995, - 975, 955, 936, 918, 901, 883, 868, 852, - 836, 822, 809, 794, 781, 769, 757, 744 -}; - -const Word16 log2_tab[33] = { // Q15 - 0x7800, 0x782D, 0x785A, 0x7884, 0x78AE, 0x78D6, 0x78FE, 0x7924, - 0x794A, 0x796E, 0x7992, 0x79B4, 0x79D6, 0x79F8, 0x7A18, 0x7A38, - 0x7A57, 0x7A75, 0x7A93, 0x7AB1, 0x7ACD, 0x7AE9, 0x7B05, 0x7B20, - 0x7B3B, 0x7B55, 0x7B6F, 0x7B88, 0x7BA1, 0x7BB9, 0x7BD1, 0x7BE9, - 0x7C00 -}; - /* math_op.c */ const Word32 L_table_isqrt[48] = { // Q31 2147418112L, 2083389440L, 2024669184L, 1970667520L, @@ -80,3 +53,30 @@ const Word16 sqrt_table[49] = { // Q15 29251, 29537, 29819, 30099, 30377, 30652, 30924, 31194, 31462, 31727, 31991, 32252, 32511, 32767 }; + +/* log2.c */ +const Word32 L_table_Log2_norm_lc[32] = { // Q31 + -32768L, 95322112L, 187793408L, 277577728L, + 364871680L, 449740800L, 532381696L, 612859904L, + 691306496L, 767787008L, 842432512L, 915308544L, + 986546176L, 1056210944L, 1124302848L, 1190887424L, + 1256095744L, 1319993344L, 1382580224L, 1443921920L, + 1504083968L, 1563131904L, 1621000192L, 1677885440L, + 1733722112L, 1788510208L, 1842380800L, 1895399424L, + 1947435008L, 1998618624L, 2049015808L, 2098626560L +}; + +const Word16 table_diff_Log2_norm_lc[32] = { // Q15 + 1455, 1411, 1370, 1332, 1295, 1261, 1228, 1197, + 1167, 1139, 1112, 1087, 1063, 1039, 1016, 995, + 975, 955, 936, 918, 901, 883, 868, 852, + 836, 822, 809, 794, 781, 769, 757, 744 +}; + +const Word16 log2_tab[33] = { // Q15 + 0x7800, 0x782D, 0x785A, 0x7884, 0x78AE, 0x78D6, 0x78FE, 0x7924, + 0x794A, 0x796E, 0x7992, 0x79B4, 0x79D6, 0x79F8, 0x7A18, 0x7A38, + 0x7A57, 0x7A75, 0x7A93, 0x7AB1, 0x7ACD, 0x7AE9, 0x7B05, 0x7B20, + 0x7B3B, 0x7B55, 0x7B6F, 0x7B88, 0x7BA1, 0x7BB9, 0x7BD1, 0x7BE9, + 0x7C00 +}; -- GitLab