diff --git a/.gitlab-ci/variables.yml b/.gitlab-ci/variables.yml
index 31d69a64357683a54c801f9da2a2f04ecb10125c..817be6f79192020444bed06f80489de19fdd3cf1 100644
--- a/.gitlab-ci/variables.yml
+++ b/.gitlab-ci/variables.yml
@@ -81,6 +81,8 @@ variables:
RUNNER_TAG: "ivas-basop-linux"
LOGS_BACKUP_SOURCE_DIR: ""
LOGS_BACKUP_TARGET_DIR: ""
+ # set this to true to skip the external HRTF testcases in pytest calls
+ DISABLE_HRTF: "false"
MANUAL_PIPELINE_TYPE:
description: "Type for the manual pipeline run. Use 'pytest-compare' to run comparison test against reference float codec."
value: 'default'
@@ -102,3 +104,4 @@ variables:
- 'peaq-enc-passthrough'
- 'long-term-logs'
- 'backup-long-term-logs'
+ - 'test-long-self-test'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ecd8f11c5a38519a46fbc71a558563dac45b782f..ab640932fcce12b79873b76a1c519d1cd4c8c9ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,65 +125,74 @@ project(stereo-evs LANGUAGES C)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) # make Visual Studio projects look nicer
include(CTest)
+file(GLOB libBasopSrcs "lib_basop/*.c")
+file(GLOB libBasopHeaders "lib_basop/*.h")
+add_library(lib_basop ${libBasopSrcs} ${libBasopHeaders})
+if(UNIX)
+ target_link_libraries(lib_basop PRIVATE m)
+endif()
+target_include_directories(lib_basop PUBLIC lib_basop PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug lib_isar)
+target_include_directories(lib_basop PRIVATE lib_lc3plus)
+
file(GLOB libComSrcs "lib_com/*.c")
file(GLOB libComHeaders "lib_com/*.h")
add_library(lib_com ${libComSrcs} ${libComHeaders})
if(UNIX)
target_link_libraries(lib_com PRIVATE m)
endif()
-target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_enc lib_dec lib_rend lib_debug lib_isar)
+target_include_directories(lib_com PUBLIC lib_com PRIVATE lib_basop lib_enc lib_dec lib_rend lib_debug lib_isar)
target_include_directories(lib_com PRIVATE lib_lc3plus)
file(GLOB libDebugSrcs "lib_debug/*.c")
file(GLOB libDebugHeaders "lib_debug/*.h")
add_library(lib_debug ${libDebugSrcs} ${libDebugHeaders})
-target_link_libraries(lib_debug lib_com)
-target_include_directories(lib_debug PUBLIC lib_debug PRIVATE lib_enc lib_dec lib_rend lib_isar)
+target_link_libraries(lib_debug lib_basop lib_com)
+target_include_directories(lib_debug PUBLIC lib_debug PRIVATE lib_basop lib_enc lib_dec lib_rend lib_isar)
file(GLOB libEncSrcs "lib_enc/*.c")
file(GLOB libEncHeaders "lib_enc/*.h")
add_library(lib_enc ${libEncSrcs} ${libEncHeaders})
-target_link_libraries(lib_enc lib_com lib_debug)
-target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_dec lib_rend lib_isar)
+target_link_libraries(lib_enc lib_basop lib_com lib_debug)
+target_include_directories(lib_enc PUBLIC lib_enc PRIVATE lib_basop lib_dec lib_rend lib_isar)
target_include_directories(lib_enc PRIVATE lib_lc3plus)
file(GLOB libLC3plusSrcs "lib_lc3plus/*.c")
file(GLOB libLC3plusHeaders "lib_lc3plus/*.h")
add_library(lib_lc3plus ${libLC3plusSrcs} ${libLC3plusHeaders})
-target_include_directories(lib_lc3plus PUBLIC lib_lc3plus PRIVATE lib_com lib_debug)
+target_include_directories(lib_lc3plus PUBLIC lib_lc3plus PRIVATE lib_basop lib_com lib_debug)
file(GLOB libRendSrcs "lib_rend/*.c")
file(GLOB libRendHeaders "lib_rend/*.h")
add_library(lib_rend ${libRendSrcs} ${libRendHeaders})
-target_link_libraries(lib_rend lib_dec lib_com lib_debug) # Todo refactor: This dependency on lib_dec should be removed.
+target_link_libraries(lib_rend lib_dec lib_basop lib_com lib_debug) # Todo refactor: This dependency on lib_dec should be removed.
target_link_libraries(lib_rend lib_lc3plus lib_isar)
-target_include_directories(lib_rend PUBLIC lib_rend PRIVATE lib_enc lib_isar)
+target_include_directories(lib_rend PUBLIC lib_rend PRIVATE lib_basop lib_enc lib_isar)
file(GLOB libDecSrcs "lib_dec/*.c")
file(GLOB libDecHeaders "lib_dec/*.h")
add_library(lib_dec ${libDecSrcs} ${libDecHeaders})
-target_link_libraries(lib_dec lib_com lib_rend lib_debug lib_isar)
-target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc lib_isar)
+target_link_libraries(lib_dec lib_com lib_basop lib_rend lib_debug lib_isar)
+target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_basop lib_enc lib_isar)
file(GLOB libUtilSrcs "lib_util/*.c")
file(GLOB libUtilHeaders "lib_util/*.h")
add_library(lib_util ${libUtilSrcs} ${libUtilHeaders})
-target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_com lib_enc lib_dec lib_rend lib_debug)
+target_include_directories(lib_util PUBLIC lib_util PRIVATE lib_basop lib_com lib_enc lib_dec lib_rend lib_debug)
target_include_directories(lib_util PRIVATE lib_lc3plus lib_isar)
if(NOT WMOPS)
add_executable(ivas_lc3plus_unit_test ${CMAKE_SOURCE_DIR}/scripts/split_rendering/lc3plus_basop/ivas_lc3plus_unit_test.c)
- target_link_libraries(ivas_lc3plus_unit_test lib_rend lib_dec lib_util lib_com lib_debug lib_isar)
+ target_link_libraries(ivas_lc3plus_unit_test lib_rend lib_dec lib_util lib_basop lib_com lib_debug lib_isar)
endif()
file(GLOB libISARSrcs "lib_isar/*.c")
file(GLOB libISARHeaders "lib_isar/*.h")
add_library(lib_isar ${libISARSrcs} ${libISARHeaders})
-target_link_libraries(lib_isar lib_com lib_debug lib_lc3plus) # Todo refactor: This dependency on lib_dec should be removed.
-target_include_directories(lib_isar PUBLIC lib_isar PRIVATE lib_enc lib_dec lib_rend)
+target_link_libraries(lib_isar lib_basop lib_com lib_debug lib_lc3plus) # Todo refactor: This dependency on lib_dec should be removed.
+target_include_directories(lib_isar PUBLIC lib_isar PRIVATE lib_basop lib_enc lib_dec lib_rend)
add_executable(IVAS_cod apps/encoder.c)
@@ -199,12 +208,19 @@ if(WIN32)
endif()
add_executable(IVAS_rend apps/renderer.c)
-target_link_libraries(IVAS_rend lib_rend lib_util lib_isar)
+target_link_libraries(IVAS_rend lib_rend lib_util lib_isar lib_com)
target_include_directories(IVAS_rend PRIVATE lib_enc)
add_executable(ISAR_post_rend apps/isar_post_rend.c)
-target_link_libraries(ISAR_post_rend lib_isar lib_util)
-target_include_directories(ISAR_post_rend PRIVATE lib_isar)
+target_link_libraries(ISAR_post_rend lib_basop lib_isar lib_util lib_com)
+target_include_directories(ISAR_post_rend PRIVATE lib_basop lib_isar)
+
+add_executable(ambi_converter apps/ambi_converter.c)
+target_link_libraries(ambi_converter lib_util lib_com lib_basop)
+if(UNIX)
+ target_link_libraries(ambi_converter m)
+endif()
+target_include_directories(ambi_converter PRIVATE lib_basop lib_util lib_com lib_debug)
if(COPY_EXECUTABLES_FROM_BUILD_DIR)
# Optionally copy executables to the same place where Make puts them (useful for tests that expect executables in specific places)
@@ -218,4 +234,4 @@ if(COPY_EXECUTABLES_FROM_BUILD_DIR)
endif()
# Allow creating packages for CMake install
-install(TARGETS lib_enc lib_dec lib_rend lib_com lib_util ARCHIVE DESTINATION lib)
+install(TARGETS lib_enc lib_dec lib_rend lib_basop lib_com lib_util ARCHIVE DESTINATION lib)
diff --git a/Makefile b/Makefile
index 62306b6749442b18f2a15e583a3702028876336a..4febdc988d1832014ecec97f84297363936c42f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-
# GNU Makefile
# Paths
+SRC_LIBBASOP = lib_basop
SRC_LIBCOM = lib_com
SRC_LIBDEBUG = lib_debug
SRC_LIBDEC = lib_dec
@@ -14,15 +14,15 @@ SRC_APP = apps
BUILD = build
OBJDIR = obj
-INCLUDE_SPLIT = 1
-
-SRC_DIRS = $(sort -u $(SRC_LIBCOM) $(SRC_LIBDEBUG) $(SRC_LIBDEC) $(SRC_LIBENC) $(SRC_LIBREND) $(SRC_LIBISAR) $(SRC_LC3PLUS) $(SRC_LIBUTIL) $(SRC_APP))
+SRC_DIRS = $(sort -u $(SRC_LIBBASOP) $(SRC_LIBCOM) $(SRC_LIBDEBUG) $(SRC_LIBDEC) $(SRC_LIBENC) $(SRC_LIBREND) $(SRC_LIBISAR) $(SRC_LC3PLUS) $(SRC_LIBUTIL) $(SRC_APP))
# Name of CLI binaries
CLI_APIDEC ?= IVAS_dec
CLI_APIENC ?= IVAS_cod
CLI_APIREND ?= IVAS_rend
CLI_APIPOSTREND ?= ISAR_post_rend
+CLI_AMBICONVERT ?= ambi_converter
+LIB_LIBBASOP ?= libivasbasop.a
LIB_LIBCOM ?= libivascom.a
LIB_LIBDEBUG ?= libivasdebug.a
LIB_LIBDEC ?= libivasdec.a
@@ -32,7 +32,6 @@ LIB_LIBISAR ?= libisar.a
LIB_LC3PLUS ?= liblc3plus.a
LIB_LIBUTIL ?= libivasutil.a
-
# Default tool settings
CC ?= gcc
RM ?= rm -f
@@ -148,6 +147,7 @@ SRCS_SPLIT_REND = ivas_CQMFDecoder.c ivas_CQMFEncoder.c ivas_PerceptualModel.c i
###############################################################################
+SRCS_LIBBASOP = $(foreach DIR,$(SRC_LIBBASOP),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBCOM = $(foreach DIR,$(SRC_LIBCOM),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBDEBUG = $(foreach DIR,$(SRC_LIBDEBUG),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBDEC = $(foreach DIR,$(SRC_LIBDEC),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
@@ -155,13 +155,9 @@ SRCS_LIBENC = $(foreach DIR,$(SRC_LIBENC),$(patsubst $(DIR)/%,%,$(wildcard $(D
SRCS_LIBREND = $(foreach DIR,$(SRC_LIBREND),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBUTIL = $(foreach DIR,$(SRC_LIBUTIL),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
SRCS_LIBISAR = $(foreach DIR,$(SRC_LIBISAR),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
-ifeq "$(INCLUDE_SPLIT)" "1"
SRCS_LC3PLUS = $(foreach DIR,$(SRC_LC3PLUS),$(patsubst $(DIR)/%,%,$(wildcard $(DIR)/*.c)))
-else
-# SRCS_LIBREND := $(filter-out $(SRCS_SPLIT_REND),$(SRCS_LIBREND))
-# SRCS_LIBUTIL := $(filter-out $(SRCS_SPLIT_REND),$(SRCS_LIBUTIL))
-endif
+OBJS_LIBBASOP = $(addprefix $(OBJDIR)/,$(SRCS_LIBBASOP:.c=.o))
OBJS_LIBCOM = $(addprefix $(OBJDIR)/,$(SRCS_LIBCOM:.c=.o))
OBJS_LIBDEBUG = $(addprefix $(OBJDIR)/,$(SRCS_LIBDEBUG:.c=.o))
OBJS_LIBDEC = $(addprefix $(OBJDIR)/,$(SRCS_LIBDEC:.c=.o))
@@ -170,12 +166,14 @@ OBJS_LIBREND = $(addprefix $(OBJDIR)/,$(SRCS_LIBREND:.c=.o))
OBJS_LIBISAR = $(addprefix $(OBJDIR)/,$(SRCS_LIBISAR:.c=.o))
OBJS_LC3PLUS = $(addprefix $(OBJDIR)/,$(SRCS_LC3PLUS:.c=.o))
OBJS_LIBUTIL = $(addprefix $(OBJDIR)/,$(SRCS_LIBUTIL:.c=.o))
+OBJS_AMBICONVERT = $(OBJDIR)/ambi_convert.o
OBJS_CLI_APIDEC = $(OBJDIR)/decoder.o
OBJS_CLI_APIENC = $(OBJDIR)/encoder.o
OBJS_CLI_APPREND = $(OBJDIR)/renderer.o
OBJS_CLI_APPPOSTREND = $(OBJDIR)/isar_post_rend.o
+OBJS_CLI_AMBICONVERT = $(OBJDIR)/ambi_converter.o
-DEPS = $(addprefix $(OBJDIR)/,$(SRCS_LIBCOM:.c=.P) $(SRCS_LIBDEBUG:.c=.P) $(SRCS_LIBDEC:.c=.P) \
+DEPS = $(addprefix $(OBJDIR)/,$(SRCS_LIBBASOP:.c=.P) $(SRCS_LIBCOM:.c=.P) $(SRCS_LIBDEBUG:.c=.P) $(SRCS_LIBDEC:.c=.P) \
$(SRCS_LIBENC:.c=.P) $(SRCS_LIBUTIL:.c=.P) $(SRCS_LIBREND:.c=.P) $(SRCS_LIBISAR:.c=.P) \
$(SRCS_LC3PLUS:.c=.P))
@@ -188,6 +186,9 @@ all: $(CLI_APIENC) $(CLI_APIDEC) $(CLI_APIREND) $(CLI_APIPOSTREND)
$(OBJDIR):
$(QUIET)mkdir -p $(OBJDIR)
+$(LIB_LIBBASOP): $(OBJS_LIBBASOP)
+ $(QUIET_AR)$(AR) rcs $@ $^
+
$(LIB_LIBCOM): $(OBJS_LIBCOM)
$(QUIET_AR)$(AR) rcs $@ $^
@@ -207,44 +208,34 @@ $(LIB_LIBREND): $(OBJS_LIBREND) $(OBJS_LIBISAR)
$(QUIET_AR)$(AR) rcs $@ $^
$(LIB_LC3PLUS): $(OBJS_LC3PLUS)
-ifeq "$(INCLUDE_SPLIT)" "1"
$(QUIET_AR)$(AR) rcs $@ $^
-else
-endif
# Dependency on OBJS_LIBCOM added temporarily for unit-test to work
-$(LIB_LIBUTIL): $(OBJS_LIBUTIL) $(OBJS_LIBCOM)
+$(LIB_LIBUTIL): $(OBJS_LIBUTIL) $(OBJS_LIBBASOP) $(OBJS_LIBCOM)
$(QUIET_AR)$(AR) rcs $@ $^
-$(CLI_APIENC): $(OBJS_CLI_APIENC) $(LIB_LIBENC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS)
- $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIENC) -L. -livasenc -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIENC)
+$(CLI_APIENC): $(OBJS_CLI_APIENC) $(LIB_LIBBASOP) $(LIB_LIBENC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIENC) -L. -livasbasop -livasenc -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIENC)
-$(CLI_APIDEC): $(OBJS_CLI_APIDEC) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS) $(LIB_LIBISAR)
-ifeq "$(INCLUDE_SPLIT)" "1"
- $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasdec -livascom -livasutil -livasdebug -llc3plus $(LDLIBS) -o $(CLI_APIDEC)
-else
- $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasdec -livascom -livasutil -livasdebug $(LDLIBS) -o $(CLI_APIDEC)
-endif
+$(CLI_APIDEC): $(OBJS_CLI_APIDEC) $(LIB_LIBBASOP) $(LIB_LIBDEC) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS) $(LIB_LIBISAR)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APIDEC) -L. -livasbasop -livasdec -livascom -livasutil -livasdebug -llc3plus $(LDLIBS) -o $(CLI_APIDEC)
-$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LIBDEC) $(LIB_LC3PLUS) $(LIB_LIBISAR)
-ifeq "$(INCLUDE_SPLIT)" "1"
- $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -lisar -livasdec -livasutil -livasdebug -livascom -llc3plus $(LDLIBS) -o $(CLI_APIREND)
-else
- $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasrend -livasdec -livasutil -livasdebug -livascom $(LDLIBS) -o $(CLI_APIREND)
-endif
+$(CLI_APIREND): $(OBJS_CLI_APPREND) $(LIB_LIBBASOP) $(LIB_LIBREND) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LIBDEC) $(LIB_LC3PLUS) $(LIB_LIBISAR)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPREND) -L. -livasbasop -livasrend -lisar -livasdec -livasutil -livasdebug -livascom -llc3plus $(LDLIBS) -o $(CLI_APIREND)
-$(CLI_APIPOSTREND): $(OBJS_CLI_APPPOSTREND) $(LIB_LIBISAR) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS)
-ifeq "$(INCLUDE_SPLIT)" "1"
- $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPPOSTREND) -L. -lisar -livasutil -livasdebug -livascom -llc3plus $(LDLIBS) -o $(CLI_APIPOSTREND)
-endif
+$(CLI_APIPOSTREND): $(OBJS_CLI_APPPOSTREND) $(LIB_LIBBASOP) $(LIB_LIBISAR) $(LIB_LIBCOM) $(LIB_LIBUTIL) $(LIB_LIBDEBUG) $(LIB_LC3PLUS)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_APPPOSTREND) -L. -livasbasop -lisar -livasutil -livasdebug -livascom -llc3plus $(LDLIBS) -o $(CLI_APIPOSTREND)
+
+$(CLI_AMBICONVERT): $(OBJS_CLI_AMBICONVERT) $(OBJS_AMBICONVERT) $(LIB_LIBBASOP) $(LIB_LIBCOM)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) $(OBJS_CLI_AMBICONVERT) $(OBJS_AMBICONVERT) -L. -livascom -livasbasop $(LDLIBS) -o $(CLI_AMBICONVERT)
-libs: $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBREND) $(LIB_LIBISAR) $(LIB_LC3PLUS) $(LIB_LIBUTIL)
+libs: $(LIB_LIBBASOP) $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBREND) $(LIB_LIBISAR) $(LIB_LC3PLUS) $(LIB_LIBUTIL)
clean:
$(QUIET)$(RM) $(OBJS_LIBENC) $(OBJS_LIBDEC) $(DEPS)
$(QUIET)$(RM) $(DEPS:.P=.d)
$(QUIET)test ! -d $(OBJDIR) || rm -rf $(OBJDIR)
- $(QUIET)$(RM) $(CLI_APIENC) $(CLI_APIDEC) $(CLI_APIREND) $(CLI_APIPOSTREND) $(LIB_LIBENC) $(LIB_LIBDEBUG) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBUTIL) $(LIB_LIBREND) $(LIB_LIBISAR) $(LIB_LC3PLUS)
+ $(QUIET)$(RM) $(CLI_APIENC) $(CLI_APIDEC) $(CLI_APIREND) $(CLI_APIPOSTREND) $(CLI_AMBICONVERT) $(LIB_LIBENC) $(LIB_LIBDEBUG) $(OBJS_LIBBASOP) $(LIB_LIBCOM) $(LIB_LIBDEC) $(LIB_LIBUTIL) $(LIB_LIBREND) $(LIB_LIBISAR) $(LIB_LC3PLUS)
$(OBJDIR)/%.o : %.c | $(OBJDIR)
$(QUIET_CC)$(CC) $(CFLAGS) -c -MD -o $@ $<
diff --git a/Workspace_msvc/Workspace_msvc.sln b/Workspace_msvc/Workspace_msvc.sln
index ac2e76b52f0224eefb2fb6c56cbd2a41be66812c..abb9650fc7d5dda70bc0f21d8faaa5ae3b27526a 100644
--- a/Workspace_msvc/Workspace_msvc.sln
+++ b/Workspace_msvc/Workspace_msvc.sln
@@ -15,10 +15,19 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_debug", "lib_debug.vcxproj", "{54509728-928B-44D9-A118-A6F92F08B34F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decoder", "decoder.vcxproj", "{E3DCBC31-7FC9-D127-E000-529F8460D5FD}"
+ ProjectSection(ProjectDependencies) = postProject
+ {63747FE7-94BA-410C-8D7F-EB47555DD994} = {63747FE7-94BA-410C-8D7F-EB47555DD994}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "encoder", "encoder.vcxproj", "{B3FC9DFC-7268-8660-7C0D-B60BAF02C554}"
+ ProjectSection(ProjectDependencies) = postProject
+ {63747FE7-94BA-410C-8D7F-EB47555DD994} = {63747FE7-94BA-410C-8D7F-EB47555DD994}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "renderer", "renderer.vcxproj", "{12B4C8A5-1E06-4E30-B443-D1F916F52B47}"
+ ProjectSection(ProjectDependencies) = postProject
+ {63747FE7-94BA-410C-8D7F-EB47555DD994} = {63747FE7-94BA-410C-8D7F-EB47555DD994}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_lc3plus", "lib_lc3plus.vcxproj", "{95030B82-70CD-4C6B-84D4-61096035BEA2}"
EndProject
@@ -30,6 +39,16 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_isar", "lib_isar.vcxproj", "{869A305E-D99E-4C3A-BDB3-AA57ABCCE619}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "isar_post_rend", "isar_post_rend.vcxproj", "{12374ADC-0E5C-4FDD-B903-71D572413831}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B3FC9DFC-7268-8660-7C0D-B60BAF02C554} = {B3FC9DFC-7268-8660-7C0D-B60BAF02C554}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_basop", "lib_basop.vcxproj", "{63747FE7-94BA-410C-8D7F-EB47555DD994}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ambi_converter", "ambi_converter.vcxproj", "{2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}"
+ ProjectSection(ProjectDependencies) = postProject
+ {39EC200D-7795-4FF8-B214-B24EDA5526AE} = {39EC200D-7795-4FF8-B214-B24EDA5526AE}
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -111,6 +130,18 @@ Global
{12374ADC-0E5C-4FDD-B903-71D572413831}.Release|Win32.ActiveCfg = Release|Win32
{12374ADC-0E5C-4FDD-B903-71D572413831}.Release|Win32.Build.0 = Release|Win32
{12374ADC-0E5C-4FDD-B903-71D572413831}.Release|x64.ActiveCfg = Release|Win32
+ {63747FE7-94BA-410C-8D7F-EB47555DD994}.Debug|Win32.ActiveCfg = Debug|Win32
+ {63747FE7-94BA-410C-8D7F-EB47555DD994}.Debug|Win32.Build.0 = Debug|Win32
+ {63747FE7-94BA-410C-8D7F-EB47555DD994}.Debug|x64.ActiveCfg = Debug|Win32
+ {63747FE7-94BA-410C-8D7F-EB47555DD994}.Release|Win32.ActiveCfg = Release|Win32
+ {63747FE7-94BA-410C-8D7F-EB47555DD994}.Release|Win32.Build.0 = Release|Win32
+ {63747FE7-94BA-410C-8D7F-EB47555DD994}.Release|x64.ActiveCfg = Release|Win32
+ {2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}.Debug|Win32.Build.0 = Debug|Win32
+ {2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}.Debug|x64.ActiveCfg = Debug|Win32
+ {2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}.Release|Win32.ActiveCfg = Release|Win32
+ {2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}.Release|Win32.Build.0 = Release|Win32
+ {2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Workspace_msvc/ambi_converter.vcxproj b/Workspace_msvc/ambi_converter.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..caedd2c6f13a4a58e7155a70d7658086e95a7351
--- /dev/null
+++ b/Workspace_msvc/ambi_converter.vcxproj
@@ -0,0 +1,172 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ ambi_converter
+ {2074FFD6-8056-4C5F-8A08-0B2607D1FEFF}
+ renderer
+ 10.0.17763.0
+
+
+
+ Application
+ v141
+ false
+ MultiByte
+
+
+ Application
+ v141
+ false
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>15.0.27428.2015
+
+
+ ..\
+ .\Debug_$(ProjectName)\
+ false
+ false
+ ambi_converter
+
+
+ ..\
+ .\Release_$(ProjectName)\
+ false
+ false
+ ambi_converter
+
+
+
+ $(IntDir)$(ProjectName).tlb
+
+
+
+ Disabled
+ ..\lib_basop;..\lib_enc;..\lib_dec;..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)
+ _CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions)
+
+ EnableFastChecks
+ MultiThreadedDebug
+ false
+
+
+ $(IntDir)$(ProjectName).pdb
+ Level4
+ true
+ OldStyle
+ Default
+ %(DisableSpecificWarnings)
+ false
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0c0c
+
+
+
+ $(OutDir)$(TargetName).exe
+ true
+
+ true
+ $(IntDir)$(ProjectName).pdb
+ Console
+ false
+
+ MachineX86
+
+
+
+
+ $(IntDir)$(ProjectName).tlb
+
+
+
+ MaxSpeed
+ AnySuitable
+ false
+ Neither
+ false
+ false
+ ..\lib_basop;..\lib_enc;..\lib_dec;..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)
+ _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
+ true
+
+ Default
+ MultiThreaded
+ true
+ Precise
+ false
+
+
+ $(IntDir)$(ProjectName).pdb
+ Level4
+ true
+
+ Default
+ %(DisableSpecificWarnings)
+ false
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0c0c
+
+
+ $(OutDir)$(TargetName).exe
+ true
+
+ false
+ $(IntDir)$(ProjectName).pdb
+ Console
+ false
+
+ MachineX86
+ libcmtd.lib
+
+
+
+
+
+
+
+ {63747fe7-94ba-410c-8d7f-eb47555dd994}
+
+
+ {39ec200d-7795-4ff8-b214-b24eda5526ae}
+
+
+ {2FA8F384-0775-F3B7-F8C3-85209222FC70}
+ false
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace_msvc/decoder.vcxproj b/Workspace_msvc/decoder.vcxproj
index 3ab058c291b49c84e5424a0ba5371318187dfd3a..160d4f7df7972204f12dd6a414e480e0a48b6a22 100644
--- a/Workspace_msvc/decoder.vcxproj
+++ b/Workspace_msvc/decoder.vcxproj
@@ -68,7 +68,7 @@
Disabled
- ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions)
EnableFastChecks
@@ -82,6 +82,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
_DEBUG;%(PreprocessorDefinitions)
@@ -112,7 +113,7 @@
Neither
false
false
- ..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_dec;..\lib_com;..\lib_util;..\lib_debug;..\lib_isar;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
true
@@ -129,6 +130,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
@@ -153,13 +155,16 @@
+
+ {63747fe7-94ba-410c-8d7f-eb47555dd994}
+
{e822ddaf-0f5f-4cd0-a694-38ae69de74d3}
false
{869a305e-d99e-4c3a-bdb3-aa57abcce619}
-
+
{2fa8f384-0775-f3b7-f8c3-85209222fc70}
false
diff --git a/Workspace_msvc/encoder.vcxproj b/Workspace_msvc/encoder.vcxproj
index 9578e488dcee1c036524b8520471e228f6cb409f..1dae36d47534d57b9ab13d410a7e9e08985ba322 100644
--- a/Workspace_msvc/encoder.vcxproj
+++ b/Workspace_msvc/encoder.vcxproj
@@ -68,7 +68,7 @@
Disabled
- ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions)
EnableFastChecks
@@ -82,6 +82,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
_DEBUG;%(PreprocessorDefinitions)
@@ -120,7 +121,7 @@
Neither
false
false
- ..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_enc;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
true
@@ -137,6 +138,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
@@ -158,6 +160,9 @@
+
+ {63747fe7-94ba-410c-8d7f-eb47555dd994}
+
{824da4cf-06f0-45c9-929a-8792f0e19c3e}
false
diff --git a/Workspace_msvc/isar_post_rend.vcxproj b/Workspace_msvc/isar_post_rend.vcxproj
index 19cb1aff7bc1584679d57f085677019b478a016d..0f2063d852538fcc352bb27d389837faeb87c13c 100644
--- a/Workspace_msvc/isar_post_rend.vcxproj
+++ b/Workspace_msvc/isar_post_rend.vcxproj
@@ -65,7 +65,7 @@
Disabled
- ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions)
EnableFastChecks
@@ -110,7 +110,7 @@
Neither
false
false
- ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_lc3plus;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
true
@@ -148,10 +148,11 @@
-
-
+
+ {63747fe7-94ba-410c-8d7f-eb47555dd994}
+
{54509728-928B-44D9-A118-A6F92F08B34F}
false
diff --git a/Workspace_msvc/lib_basop.vcxproj b/Workspace_msvc/lib_basop.vcxproj
new file mode 100644
index 0000000000000000000000000000000000000000..8d4f252b5b42ecff0e5c3ae82a622af937ca043c
--- /dev/null
+++ b/Workspace_msvc/lib_basop.vcxproj
@@ -0,0 +1,155 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {63747FE7-94BA-410C-8D7F-EB47555DD994}
+ common
+ 10.0.17763.0
+
+
+
+ StaticLibrary
+ v141
+ false
+ MultiByte
+
+
+ StaticLibrary
+ v141
+ false
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>15.0.27428.2015
+
+
+ .\Debug_$(ProjectName)\
+ .\Debug_$(ProjectName)\
+ libivascom
+
+
+ .\Release_$(ProjectName)\
+ .\Release_$(ProjectName)\
+ libivascom
+
+
+
+
+
+
+ Disabled
+ ..\lib_isar;..\lib_lc3plus;..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories)
+ _CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions);
+
+ EnableFastChecks
+ MultiThreadedDebug
+
+
+ $(IntDir)$(ProjectName).pdb
+ Level4
+ true
+ OldStyle
+ Default
+ %(DisableSpecificWarnings)
+ false
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0c0c
+
+
+ WS2_32.lib; %(AdditionalDependencies)
+ $(OutDir)$(TargetName).lib
+ true
+
+
+
+
+
+
+
+ MaxSpeed
+ AnySuitable
+ false
+ Neither
+ false
+ false
+ ..\lib_isar;..\lib_lc3plus;..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories)
+ _CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
+ true
+
+ Default
+ MultiThreaded
+ true
+
+
+ $(IntDir)$(ProjectName).pdb
+ Level4
+ true
+
+ Default
+ %(DisableSpecificWarnings)
+ false
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0c0c
+
+
+ WS2_32.lib; %(AdditionalDependencies)
+ $(OutDir)$(TargetName).lib
+ true
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj
index 8e37844b9a69e8b386dcd0cd8576f99396bf96fd..ee67280d0dd1f64ad9424857fd969cdaebef2b63 100644
--- a/Workspace_msvc/lib_com.vcxproj
+++ b/Workspace_msvc/lib_com.vcxproj
@@ -59,7 +59,7 @@
Disabled
- ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories)
+ ..\lib_isar;..\lib_lc3plus;..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions);
EnableFastChecks
@@ -72,6 +72,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
_DEBUG;%(PreprocessorDefinitions)
@@ -94,7 +95,7 @@
Neither
false
false
- ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories)
+ ..\lib_isar;..\lib_lc3plus;..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
true
@@ -109,6 +110,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
@@ -125,14 +127,12 @@
-
-
@@ -140,19 +140,13 @@
-
-
-
-
-
-
@@ -216,9 +210,8 @@
-
-
+
@@ -264,7 +257,6 @@
-
@@ -282,7 +274,6 @@
-
@@ -314,7 +305,6 @@
-
@@ -327,12 +317,9 @@
-
-
-
diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters
index f247d199eba36b4b9c2e75593421e64bfdf9a25a..e8bbb17e9b0e6ab35342975185aa9d5a4fdfdeb8 100644
--- a/Workspace_msvc/lib_com.vcxproj.filters
+++ b/Workspace_msvc/lib_com.vcxproj.filters
@@ -1,646 +1,605 @@
-
+
-
- common_all_c
-
-
- common_all_c
-
-
- common_all_c
-
-
- common_all_c
-
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_evs_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_ivas_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
- common_all_c
+
+ common_evs_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
common_all_c
-
- common_all_c
-
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
- common_ivas_c
-
-
- common_ivas_c
-
-
- common_ivas_c
-
-
- common_ivas_c
-
-
- common_ivas_c
-
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
- common_ivas_c
+
+ common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
- common_ivas_c
+
+ common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_all_c
-
+
common_ivas_c
-
-
- common_ivas_c
+
+ common_all_c
-
- common_h
-
-
- common_h
-
-
- common_h
-
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
-
+
common_h
-
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
-
+
common_h
+
+
-
- {890c2f45-9385-4fce-859b-6a65469e8dc0}
-
-
- {201ea764-9626-4dca-9cc4-5b4106f8b8b2}
-
- {fbb860e2-79d0-45b1-ada1-c3a0a369ce2c}
+ {89daa9bf-9e90-4fec-af56-38675e291f6f}
+
+
+ {15426721-e65c-4514-bf00-f87bc1208a28}
- {b95b7bed-a666-4a00-9332-2b528638503e}
+ {0d9238b7-8879-4767-9288-b5e65692cfa8}
+
+
+ {5bdbb305-b9db-4187-b825-04449615f37b}
\ No newline at end of file
diff --git a/Workspace_msvc/lib_debug.vcxproj b/Workspace_msvc/lib_debug.vcxproj
index 929dd72a802ca74c5499929d2c93f073df9f91eb..ef9c58a89b4c4818ed2eef065e2e642903b850c4 100644
--- a/Workspace_msvc/lib_debug.vcxproj
+++ b/Workspace_msvc/lib_debug.vcxproj
@@ -56,7 +56,7 @@
Disabled
- ..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_util;..\lib_debug;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;DBG_WAV_WRITER;$(Macros);%(PreprocessorDefinitions)
false
@@ -68,6 +68,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
$(OutDir)$(TargetName).lib
@@ -82,7 +83,7 @@
AnySuitable
false
false
- ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
true
@@ -94,6 +95,7 @@
Default
%(DisableSpecificWarnings)
+ false
$(OutDir)$(TargetName).lib
diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj
index e5998e672c249fb5f71b255d7a62af567e98fe35..9d98513e8525267717e9437c90abc1522d0129f1 100644
--- a/Workspace_msvc/lib_dec.vcxproj
+++ b/Workspace_msvc/lib_dec.vcxproj
@@ -68,7 +68,7 @@
Disabled
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)
EnableFastChecks
@@ -82,6 +82,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
_DEBUG;%(PreprocessorDefinitions)
@@ -108,7 +109,7 @@
Neither
false
false
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)
true
@@ -124,6 +125,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
diff --git a/Workspace_msvc/lib_enc.vcxproj b/Workspace_msvc/lib_enc.vcxproj
index 1237541427184d6fe8470e1a0c0ab6fa04eccf03..93a2a85486561bebdb5cba3e8dec8989a68afb61 100644
--- a/Workspace_msvc/lib_enc.vcxproj
+++ b/Workspace_msvc/lib_enc.vcxproj
@@ -68,7 +68,7 @@
Disabled
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)
EnableFastChecks
@@ -82,6 +82,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
_DEBUG;%(PreprocessorDefinitions)
@@ -111,7 +112,7 @@
Neither
false
false
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
true
@@ -128,6 +129,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
@@ -240,7 +242,6 @@
-
diff --git a/Workspace_msvc/lib_enc.vcxproj.filters b/Workspace_msvc/lib_enc.vcxproj.filters
index e8f429f4914dace1f3d9efa63afe65a713d5bf25..4194dbc5a1b9602c6f126b86d3a64735badd9a31 100644
--- a/Workspace_msvc/lib_enc.vcxproj.filters
+++ b/Workspace_msvc/lib_enc.vcxproj.filters
@@ -253,9 +253,6 @@
encoder_all_c
-
- encoder_all_c
-
encoder_all_c
diff --git a/Workspace_msvc/lib_isar.vcxproj b/Workspace_msvc/lib_isar.vcxproj
index cdc0979a0f0783398685043ac3ab9934acc70bb9..0271901c88b4c9ad236ff5e34d925f4d7c107e4c 100644
--- a/Workspace_msvc/lib_isar.vcxproj
+++ b/Workspace_msvc/lib_isar.vcxproj
@@ -60,7 +60,7 @@
Disabled
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions);
EnableFastChecks
@@ -95,7 +95,7 @@
Neither
false
false
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_isar;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)
true
@@ -110,6 +110,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
diff --git a/Workspace_msvc/lib_lc3plus.vcxproj b/Workspace_msvc/lib_lc3plus.vcxproj
index 22b5cddd3c55c39f43af6dfa39ec652305880ff2..71bb8e2a1f8e5301dc9c4eb265b25c53f244daca 100644
--- a/Workspace_msvc/lib_lc3plus.vcxproj
+++ b/Workspace_msvc/lib_lc3plus.vcxproj
@@ -65,7 +65,7 @@
Level3
- ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories)
Disabled
MultiThreadedDebug
WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
@@ -84,7 +84,7 @@
Level3
- ..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;%(AdditionalIncludeDirectories)
MaxSpeed
MultiThreaded
true
diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj
index f93b5f26d1673c005e7dca6083f5e794f4612ccf..c39806d47edcb1f3165b7ddbdcd9643b9e71c6ec 100644
--- a/Workspace_msvc/lib_rend.vcxproj
+++ b/Workspace_msvc/lib_rend.vcxproj
@@ -68,7 +68,7 @@
Disabled
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)
EnableFastChecks
@@ -82,6 +82,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
_DEBUG;%(PreprocessorDefinitions)
@@ -108,7 +109,7 @@
Neither
false
false
- ..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)
true
@@ -124,6 +125,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
@@ -197,7 +199,7 @@
{95030B82-70CD-4C6B-84D4-61096035BEA2}
false
-
+
@@ -207,4 +209,4 @@
-
+
\ No newline at end of file
diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters
index 820a5c044354c8b35ceabc1855256052b4915b24..2494e2ee2e8a44233535a78999c15448adf0ce04 100644
--- a/Workspace_msvc/lib_rend.vcxproj.filters
+++ b/Workspace_msvc/lib_rend.vcxproj.filters
@@ -31,9 +31,6 @@
rend_c
-
- rend_c
-
rend_c
diff --git a/Workspace_msvc/lib_util.vcxproj b/Workspace_msvc/lib_util.vcxproj
index ceb342b2157dff283b4c00bde8d5070b8ee0a340..73a48f23e8967698270fd835193b8da1b580b7bb 100644
--- a/Workspace_msvc/lib_util.vcxproj
+++ b/Workspace_msvc/lib_util.vcxproj
@@ -55,7 +55,7 @@
Disabled
- ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions)
false
@@ -67,6 +67,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
$(OutDir)$(TargetName).lib
@@ -78,7 +79,7 @@
AnySuitable
false
false
- ..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_isar;..\lib_lc3plus;..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_rend;..\lib_util;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);ZLIB_WINAPI;%(PreprocessorDefinitions)
true
@@ -90,6 +91,7 @@
Default
%(DisableSpecificWarnings)
+ false
$(OutDir)$(TargetName).lib
@@ -98,6 +100,8 @@
+
+
@@ -121,9 +125,10 @@
-
+
+
@@ -148,7 +153,7 @@
-
+
@@ -158,4 +163,4 @@
-
\ No newline at end of file
+
diff --git a/Workspace_msvc/renderer.vcxproj b/Workspace_msvc/renderer.vcxproj
index 1bc5b5568ccdf19549678c5ebd9f777af41b8fa0..d6abf6aa31f8d2214eb354d83acc07bacdef91ae 100644
--- a/Workspace_msvc/renderer.vcxproj
+++ b/Workspace_msvc/renderer.vcxproj
@@ -65,7 +65,7 @@
Disabled
- ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;WIN32;$(Macros);%(PreprocessorDefinitions)
EnableFastChecks
@@ -79,6 +79,7 @@
OldStyle
Default
%(DisableSpecificWarnings)
+ false
_DEBUG;%(PreprocessorDefinitions)
@@ -109,7 +110,7 @@
Neither
false
false
- ..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
+ ..\lib_basop;..\lib_com;..\lib_debug;..\lib_util;..\lib_isar;..\lib_rend;..\lib_lc3plus;.%(AdditionalIncludeDirectories)
_CRT_SECURE_NO_WARNINGS;$(Macros);%(PreprocessorDefinitions)
true
@@ -126,6 +127,7 @@
Default
%(DisableSpecificWarnings)
+ false
NDEBUG;%(PreprocessorDefinitions)
@@ -148,6 +150,9 @@
+
+ {63747fe7-94ba-410c-8d7f-eb47555dd994}
+
{54509728-928B-44D9-A118-A6F92F08B34F}
false
@@ -158,7 +163,7 @@
{869a305e-d99e-4c3a-bdb3-aa57abcce619}
-
+
{2FA8F384-0775-F3B7-F8C3-85209222FC70}
false
diff --git a/apps/ambi_converter.c b/apps/ambi_converter.c
new file mode 100644
index 0000000000000000000000000000000000000000..76619c904887b59c7a312b051ce40b2ab5f4c691
--- /dev/null
+++ b/apps/ambi_converter.c
@@ -0,0 +1,198 @@
+/******************************************************************************************************
+
+ (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
+
+ This software is protected by copyright law and by international treaties.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
+
+*******************************************************************************************************/
+#include
+#include
+#include
+#include "../lib_util/tinywavein_c.h"
+#include "../lib_util/tinywaveout_c.h"
+#include "ambi_convert.h"
+
+/*-------------------------------------------------------------------------------------*
+ * Ambisonics converter program
+ *
+ * gcc ambi_converter.c ../lib_util/ambi_convert.c -I../lib_util/ -lm -o ambi_converter
+ *--------------------------------------------------------------------------------------*/
+
+int main( int argc, char *argv[] )
+{
+
+ WAVEFILEIN *wavFile_in;
+ WAVEFILEOUT *wavFile_out;
+ char *fileName_in, *fileName_out;
+
+ uint32_t samplingRate;
+ uint32_t samplesInFile;
+ uint32_t numSamples = AMBI_MAX_FRAME_LENGTH;
+ uint32_t numSamplesRead32 = 0;
+ // uint32_t numSamplesClipped = 0;
+ uint32_t numFramesClipped = 0;
+
+ int16_t bps;
+ int16_t samples[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS];
+ int16_t order = 0;
+ int16_t numChannels;
+ const char *name_conventions[6] = { "ACN-SN3D", "ACN-N3D", "FuMa-MaxN", "FuMa-FuMa", "SID-SN3D", "SID-N3D" };
+
+ AMBI_FMT in_format, out_format;
+
+ Word16 samples_f_in[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS];
+ Word16 samples_f_out[AMBI_MAX_FRAME_LENGTH * AMBI_MAX_CHANNELS];
+ Word16 *in[AMBI_MAX_CHANNELS], *out[AMBI_MAX_CHANNELS];
+
+ for ( int16_t j = 0; j < AMBI_MAX_CHANNELS; j++ )
+ {
+ in[j] = &samples_f_in[j * AMBI_MAX_FRAME_LENGTH];
+ out[j] = &samples_f_out[j * AMBI_MAX_FRAME_LENGTH];
+ }
+
+ printf( "Ambisonics converter program\n" );
+ if ( argc != 5 )
+ {
+ printf( "----------------------------------------------------------------------------------\n" );
+ printf( "Usage:\n" );
+ printf( "./ambi_converter input_file output_file input_convention output_convention\n" );
+ printf( "\n" );
+ printf( "input_convention and output convention must be an integer number in [0,5]\n" );
+ printf( "the following conventions are supported:\n" );
+ printf( "0 : ACN-SN3D\n" );
+ printf( "1 : ACN-N3D\n" );
+ printf( "2 : FuMa-MaxN\n" );
+ printf( "3 : FuMa-FuMa\n" );
+ printf( "4 : SID-SN3D\n" );
+ printf( "5 : SID-N3D\n" );
+ printf( "\n" );
+ printf( "Either the input or the output convention must always be ACN-SN3D!\n" );
+ return -1;
+ }
+
+ fileName_in = argv[1];
+ fileName_out = argv[2];
+ in_format = atoi( argv[3] );
+ out_format = atoi( argv[4] );
+ if ( in_format < 0 || out_format < 0 || in_format > 5 || out_format > 5 )
+ {
+ printf( "input_convention and output convention must be an integer number in [0,5]\n" );
+ return -1;
+ }
+ printf( "In: [%s], Out: [%s]\n", name_conventions[in_format], name_conventions[out_format] );
+
+ wavFile_in = OpenWav( fileName_in, &samplingRate, &numChannels, &samplesInFile, &bps );
+ if ( !wavFile_in )
+ {
+ fprintf( stderr, "Failed to open input wav file: %s\n", fileName_in );
+ return -1;
+ }
+
+ wavFile_out = CreateWav( fileName_out, samplingRate, numChannels, 16 );
+ if ( !wavFile_out )
+ {
+ fprintf( stderr, "Failed to open output wav file: %s\n", fileName_out );
+ return -1;
+ }
+
+ order = (int16_t) sqrtf( numChannels ) - 1;
+ assert( order > 0 && order <= 3 );
+
+ numSamples = ( samplingRate * 20 * numChannels ) / 1000; /* 20ms worth of samples */
+ while ( ReadWavShort( wavFile_in, samples, numSamples, &numSamplesRead32 ) == __TWI_SUCCESS )
+ {
+ int32_t err = 0;
+
+ if ( !numSamplesRead32 )
+ {
+ break;
+ }
+
+ for ( uint16_t i = 0; i < (uint16_t) numSamplesRead32 / numChannels; i++ )
+ {
+ for ( int16_t j = 0; j < numChannels; j++ )
+ {
+ in[j][i] = (Word16) samples[i * numChannels + j];
+ }
+ }
+
+ err = convert_ambi_format( in, out, order, in_format, out_format, ( const uint16_t )( numSamples / numChannels ) );
+ if ( err == AMBI_CONVERT_CLIPPING_DETECTED )
+ {
+ numFramesClipped++;
+ }
+ else if ( err != 0 )
+ {
+ printf( "Error converting the input signal!\n" );
+ return err;
+ }
+
+
+ for ( uint16_t i = 0; i < (uint16_t) numSamplesRead32 / numChannels; i++ )
+ {
+ for ( int16_t j = 0; j < numChannels; j++ )
+ {
+ // int s1_i;
+ // Word16 s1 = out[j][i];
+ // if ( s1 < INT16_MIN )
+ //{
+ // s1_i = INT16_MIN;
+ // numSamplesClipped++;
+ // }
+ // else if ( s1 > INT16_MAX )
+ //{
+ // s1_i = INT16_MAX;
+ // numSamplesClipped++;
+ // }
+ // else
+ //{
+ // s1_i = (int16_t) s1;
+ // }
+ // samples[i * numChannels + j] = s1_i;
+ samples[i * numChannels + j] = out[j][i];
+ }
+ }
+
+ if ( ( err = WriteWavShort( wavFile_out, samples, numSamplesRead32 ) ) != __TWO_SUCCESS )
+ {
+ printf( "Error writing output wave file!\n" );
+ return err;
+ }
+
+ numSamplesRead32 = 0;
+ }
+
+ CloseWav( wavFile_out );
+ CloseWavIn( wavFile_in );
+
+ if ( numFramesClipped )
+ {
+ printf( "Warning: %d frames have clipped!\n", numFramesClipped );
+ }
+
+ return 0;
+}
diff --git a/apps/decoder.c b/apps/decoder.c
index 179ad3273e02f32a719aa64438decea2df40fe4b..36ed7a94a92b9bbc77e66edc6d6a323d9a111f86 100644
--- a/apps/decoder.c
+++ b/apps/decoder.c
@@ -43,6 +43,9 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
+#ifdef FIX_1053_REVERB_RECONFIGURATION
+#include "aeid_file_reader.h"
+#endif
#include "split_render_file_read_write.h"
#include "vector3_pair_file_reader.h"
#include "wmc_auto.h"
@@ -80,7 +83,6 @@ static
* Local structure for storing cmdln arguments
*------------------------------------------------------------------------------------------*/
-#ifdef FIX_1053_REVERB_RECONFIGURATION
typedef struct
{
uint16_t *pID;
@@ -89,7 +91,6 @@ typedef struct
uint16_t selected;
uint16_t frameCounter;
} AcousticEnvironmentSequence;
-#endif
typedef struct
@@ -122,7 +123,7 @@ typedef struct
bool customLsOutputEnabled;
char *customLsSetupFilename;
int16_t orientation_tracking;
- int16_t Opt_non_diegetic_pan;
+ bool non_diegetic_pan_enabled;
float non_diegetic_pan_gain;
Word16 non_diegetic_pan_gain_fx; /* Q15 */
bool renderConfigEnabled;
@@ -131,16 +132,31 @@ typedef struct
IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
bool tsmEnabled;
IVAS_RENDER_FRAMESIZE renderFramesize;
-#ifdef FIX_1053_REVERB_RECONFIGURATION
AcousticEnvironmentSequence aeSequence;
-#else
- uint16_t acousticEnvironmentId;
-#endif
- int16_t Opt_dpid_on;
+ bool dpidEnabled;
uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
} DecArguments;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+typedef struct
+{
+ hrtfFileReader *hrtfReader;
+ char *hrtfFileName;
+
+ IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD;
+
+ IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics;
+
+ IVAS_BIN_RENDERER_TYPE binaural_renderer;
+ IVAS_BIN_RENDERER_TYPE binaural_renderer_old;
+ IVAS_BIN_RENDERER_TYPE binaural_renderer_sec;
+ IVAS_BIN_RENDERER_TYPE binaural_renderer_sec_old;
+
+ IVAS_AUDIO_CONFIG hrtf_set_audio_cfg;
+
+} IVAS_DEC_HRTF_BINARY_WRAPPER;
+#endif
/*------------------------------------------------------------------------------------------*
* Local functions prototypes
@@ -148,8 +164,14 @@ typedef struct
static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg );
static void usage_dec( void );
+#ifdef FIX_CREND_SIMPLIFY_CODE
+static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
+static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
+static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
+#else
static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec );
+#endif
/*------------------------------------------------------------------------------------------*
@@ -180,15 +202,24 @@ int main(
RenderConfigReader *renderConfigReader = NULL;
int16_t *pcmBuf = NULL;
IVAS_RENDER_FRAMESIZE asked_frame_size;
- IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IVAS_DEC_HRTF_BINARY_WRAPPER hHrtfBinary;
+#else
+ IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD = NULL;
IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
+#endif
#ifdef WMOPS
reset_wmops();
reset_mem( USE_BYTES );
#endif
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ hHrtfBinary.hHrtfTD = NULL; /* just to avoid compilation warning */
+ hHrtfBinary.hHrtfStatistics = NULL; /* just to avoid compilation warning */
+#endif
+
splitRendBits.bits_buf = splitRendBitsBuf;
/*------------------------------------------------------------------------------------------*
@@ -258,7 +289,7 @@ int main(
if ( arg.hrtfReaderEnabled )
{
/* sanity check */
- if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
+ if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
arg.hrtfReaderEnabled = false;
fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
@@ -373,40 +404,15 @@ int main(
}
}
- /*------------------------------------------------------------------------------------------*
- * Open renderer configuration reader file
- *------------------------------------------------------------------------------------------*/
-
- if ( arg.renderConfigEnabled )
- {
- /* sanity check */
- if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
- arg.Opt_non_diegetic_pan == 0 )
- {
- fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
- goto cleanup;
- }
-
- if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
- {
- fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename );
- goto cleanup;
- }
- }
/*------------------------------------------------------------------------------------------*
* Configure the decoder
*------------------------------------------------------------------------------------------*/
asked_frame_size = arg.renderFramesize;
-#ifdef FIX_1053_REVERB_RECONFIGURATION
uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;
- if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx,
- arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx,
- arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
-#endif
+ if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx,
+ arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
@@ -431,7 +437,7 @@ int main(
{
if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
{
- fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
@@ -457,7 +463,15 @@ int main(
}
}
- IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode );
+ /*-----------------------------------------------------------------*
+ * Print config information
+ *-----------------------------------------------------------------*/
+
+ if ( ( error = IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ goto cleanup;
+ }
/*-------------------------------------------------------------------*
* Load renderer configuration from file
@@ -470,7 +484,7 @@ int main(
/* sanity check */
if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB &&
arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
- arg.Opt_non_diegetic_pan == 0 )
+ arg.non_diegetic_pan_enabled == false )
{
fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" );
goto cleanup;
@@ -482,38 +496,29 @@ int main(
goto cleanup;
}
+ if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename );
+ goto cleanup;
+ }
+
if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK )
{
fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
goto cleanup;
}
-#ifdef CONF_DISTATT
if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
-#endif
{
fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
goto cleanup;
}
-#ifndef CONF_DISTATT
- FOR( Word16 i = 0; i < 4; i++ )
- {
- renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) );
- renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) );
- renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( ( 1u << 15 ) - 1 ) );
- }
-#endif
-#ifdef CONF_DISTATT
if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt_fx ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "Failed to get Distance Attenuation \n\n" );
goto cleanup;
}
-#endif
- if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
- arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS &&
( renderConfig.split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
@@ -528,7 +533,7 @@ int main(
if ( ( error = IVAS_DEC_SetRenderFramesize( hIvasDec, arg.renderFramesize ) ) != IVAS_ERR_OK )
{
- fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ fprintf( stderr, "\nIVAS_DEC_SetRenderFramesize failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
@@ -540,11 +545,7 @@ int main(
if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{
-#ifdef FIX_1053_REVERB_RECONFIGURATION
if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
-#else
- if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
-#endif
{
if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
{
@@ -554,15 +555,11 @@ int main(
}
else
{
-#ifdef FIX_1053_REVERB_RECONFIGURATION
fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
-#else
- fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId );
-#endif
goto cleanup;
}
- renderConfig.roomAcoustics.override = true;
}
+
/* ISAR frame size is set from command line, not renderer config file.
* This will be ignored if output format is not split rendering. */
renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.renderFramesize /* given in number of 5ms subframes */ * 5;
@@ -601,18 +598,29 @@ int main(
}
/*------------------------------------------------------------------------------------------*
- * Load HRTF binary file data
+ * Initialize HRTF binary file data
*------------------------------------------------------------------------------------------*/
if ( arg.hrtfReaderEnabled )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ hHrtfBinary.hrtfReader = hrtfReader;
+ hHrtfBinary.hrtfFileName = arg.hrtfFileName;
+ hHrtfBinary.binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE;
+ hHrtfBinary.binaural_renderer_sec = IVAS_BIN_RENDERER_TYPE_NONE;
+ hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
+#else
if ( ( error = IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_DEC_GetHrtfHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
+#ifdef FIX_989_TD_REND_ROM
+ if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, arg.output_Fs, hrtfReader ) ) != IVAS_ERR_OK )
+#else
if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfReader ) ) != IVAS_ERR_OK )
+#endif
{
if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
{
@@ -700,6 +708,7 @@ int main(
destroy_hrtf_statistics( hHrtfStatistics );
}
}
+#endif
}
/*------------------------------------------------------------------------------------------*
@@ -714,6 +723,13 @@ int main(
}
pcmBuf = malloc( pcmBufSize * sizeof( int16_t ) );
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ if ( pcmBuf == NULL )
+ {
+ fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" );
+ goto cleanup;
+ }
+#endif
/*-----------------------------------------------------------------*
* Decoding
@@ -721,11 +737,19 @@ int main(
if ( arg.voipMode )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
+#else
error = decodeVoIP( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, hIvasDec );
+#endif
}
else
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
+#else
error = decodeG192( arg, hBsReader, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, &splitRendBits, hIvasDec, pcmBuf );
+#endif
}
if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE )
@@ -741,7 +765,11 @@ int main(
}
else
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ fprintf( stderr, "\nDecoding finished prematurely: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+#else
fprintf( stdout, "Decoding finished prematurely\n\n" );
+#endif
goto cleanup;
}
@@ -756,16 +784,18 @@ cleanup:
free( pcmBuf );
-#ifdef FIX_1053_REVERB_RECONFIGURATION
if ( arg.aeSequence.count > 0 )
{
free( arg.aeSequence.pID );
free( arg.aeSequence.pValidity );
}
-#endif
if ( arg.hrtfReaderEnabled )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ destroy_td_hrtf( hHrtfBinary.hHrtfTD );
+ destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
+#else
IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD );
if ( hHrtfTD != NULL )
{
@@ -776,7 +806,23 @@ cleanup:
{
destroy_SetOfHRTF( hSetOfHRTF );
}
+ IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
+ destroy_hrtf_statistics( hHrtfStatistics );
+#endif
}
+#ifdef FIX_1990_SANITIZER_IN_REVERB_LOAD
+ // TODO:
+ /* This free differs from float version.
+ This is needed as HRTF statistics from ROM are currently converted from Word16 values to scaled Word32 values. */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
+ IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
+ destroy_hrtf_statistics( hHrtfStatistics );
+#else
+ IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics );
+ destroy_hrtf_statistics( hHrtfStatistics );
+#endif
+#endif
IVAS_DEC_Close( &hIvasDec );
CustomLsReader_close( &hLsCustomReader );
@@ -944,24 +990,20 @@ static bool parseCmdlIVAS_dec(
arg->renderConfigEnabled = false;
arg->renderConfigFilename = NULL;
- arg->Opt_dpid_on = 0;
+ arg->dpidEnabled = false;
arg->outputMdFilename = NULL;
arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192;
- arg->Opt_non_diegetic_pan = 0;
+ arg->non_diegetic_pan_enabled = false;
arg->non_diegetic_pan_gain = 0.f;
arg->tsmEnabled = false;
arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
-#ifdef FIX_1053_REVERB_RECONFIGURATION
arg->aeSequence.count = 0;
arg->aeSequence.pID = NULL;
arg->aeSequence.pValidity = NULL;
arg->aeSequence.selected = 0;
arg->aeSequence.frameCounter = 0;
-#else
- arg->acousticEnvironmentId = 65535;
-#endif
for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
{
arg->directivityPatternId[i] = 65535;
@@ -1207,7 +1249,7 @@ static bool parseCmdlIVAS_dec(
arg->outputMdFilename = argv[i + 1];
if ( arg->outputMdFilename[0] == '\0' )
{
- fprintf( stderr, "Error: output metadata file path not specified\n\n" );
+ fprintf( stderr, "Error: Split rendering output metadata file path not specified\n\n" );
usage_dec();
return false;
}
@@ -1216,7 +1258,7 @@ static bool parseCmdlIVAS_dec(
else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
{
i++;
- arg->Opt_non_diegetic_pan = 1;
+ arg->non_diegetic_pan_enabled = true;
strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
to_upper( argv_to_upper );
@@ -1284,6 +1326,22 @@ static bool parseCmdlIVAS_dec(
if ( !is_digits_only( argv[i] ) )
{
#ifdef FIX_1053_REVERB_RECONFIGURATION
+ aeidFileReader *aeidReader = NULL;
+ if ( aeidFileReader_open( argv[i], &aeidReader ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError: Can't open aeid file %s \n", argv[i] );
+ usage_dec();
+ return false;
+ }
+ if ( aeidFileReading( aeidReader, &arg->aeSequence.count, &arg->aeSequence.pID, &arg->aeSequence.pValidity ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError while reading aeid from %s\n", argv[i] );
+ usage_dec();
+ return false;
+ }
+ aeidFileReader_close( &aeidReader );
+ i++;
+#else
uint16_t k;
char *s = argv[i];
char *token = argv[i];
@@ -1343,13 +1401,8 @@ static bool parseCmdlIVAS_dec(
usage_dec();
return false;
}
-#else
- fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] );
- usage_dec();
- return false;
#endif
}
-#ifdef FIX_1053_REVERB_RECONFIGURATION
else
{
/* A single acoustic environment */
@@ -1364,15 +1417,12 @@ static bool parseCmdlIVAS_dec(
arg->aeSequence.pID[0] = (int16_t) atoi( argv[i++] );
arg->aeSequence.pValidity[0] = 0;
}
-#else
- arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] );
-#endif
}
else if ( strcmp( argv_to_upper, "-DPID" ) == 0 )
{
int16_t id, tmp;
- arg->Opt_dpid_on = 1;
+ arg->dpidEnabled = true;
++i;
tmp = 0;
while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS )
@@ -1452,7 +1502,8 @@ static bool parseCmdlIVAS_dec(
arg->customLsSetupFilename = argv[i];
}
i++;
- if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) )
+
+ if ( arg->non_diegetic_pan_enabled && arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO )
{
fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" );
usage_dec();
@@ -1469,7 +1520,8 @@ static bool parseCmdlIVAS_dec(
{
arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
arg->decMode = IVAS_DEC_MODE_EVS;
- if ( ( arg->Opt_non_diegetic_pan ) )
+
+ if ( arg->non_diegetic_pan_enabled )
{
arg->outputConfig = IVAS_AUDIO_CONFIG_STEREO;
}
@@ -1590,15 +1642,11 @@ static void usage_dec( void )
fprintf( stdout, " output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" );
fprintf( stdout, " ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" );
fprintf( stdout, " otherwise a default directivity pattern is used.\n" );
-#ifdef FIX_1053_REVERB_RECONFIGURATION
fprintf( stdout, "-aeid ID : Acoustic environment ID (number > 0) or\n" );
fprintf( stdout, " a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" );
fprintf( stdout, " without braces and spaces, with ':' character separating ID from duration and ',' separating\n" );
fprintf( stdout, " ID and duration pairs, where duration is specified in frames\n" );
fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration.\n" );
-#else
- fprintf( stdout, "-aeid ID : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
-#endif
fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" );
fprintf( stdout, "-q : Quiet mode, no frame counter\n" );
@@ -1632,6 +1680,7 @@ static ivas_error initOnFirstGoodFrame(
uint16_t *pNumObj, /* o : */
SplitFileReadWrite **splitRendWriter )
{
+ int16_t isSplitRend, isSplitCoded;
ivas_error error = IVAS_ERR_UNKNOWN;
/* Now delay, number of output channels and frame size are known */
@@ -1641,7 +1690,19 @@ static ivas_error initOnFirstGoodFrame(
return error;
}
- if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
+ if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_enabled, code: %d\n", error );
+ return error;
+ }
+
+ if ( ( error = IVAS_DEC_is_split_rendering_coded_out( hIvasDec, &isSplitCoded ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_coded_out, code: %d\n", error );
+ return error;
+ }
+
+ if ( isSplitRend )
{
pFullDelayNumSamples[0] = 0;
}
@@ -1666,7 +1727,7 @@ static ivas_error initOnFirstGoodFrame(
return error;
}
- if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
+ if ( isSplitRend )
{
/* Open split rendering metadata writer */
int16_t delayNumSamples_temp[3];
@@ -1683,29 +1744,15 @@ static ivas_error initOnFirstGoodFrame(
return error;
}
- if ( ( error = IVAS_DEC_GetSplitRendBitstreamHeader( hIvasDec,
- &splitRendCodec,
- &poseCorrection,
- &splitRendIsarFrameSizeMs,
- &splitRendCodecFrameSizeMs,
- &lc3plusHighRes ) ) != IVAS_ERR_OK )
+ if ( ( error = IVAS_DEC_GetSplitRendBitstreamHeader( hIvasDec, &splitRendCodec, &poseCorrection, &splitRendIsarFrameSizeMs, &splitRendCodecFrameSizeMs, &lc3plusHighRes ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nUnable to get split renderer bitstream header: %s\n", ivas_error_to_string( error ) );
return error;
}
- if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) )
+ if ( isSplitCoded )
{
- if ( ( error = split_rend_writer_open( splitRendWriter,
- arg.outputWavFilename,
- delayNumSamples_temp[0],
- delayTimeScale_temp,
- splitRendCodec,
- poseCorrection,
- splitRendCodecFrameSizeMs,
- splitRendIsarFrameSizeMs,
- arg.output_Fs,
- lc3plusHighRes ) ) != IVAS_ERR_OK )
+ if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, lc3plusHighRes ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
return error;
@@ -1719,16 +1766,7 @@ static ivas_error initOnFirstGoodFrame(
return IVAS_ERR_INVALID_SPLIT_REND_CONFIG;
}
- if ( ( error = split_rend_writer_open( splitRendWriter,
- arg.outputMdFilename,
- delayNumSamples_temp[0],
- delayTimeScale_temp,
- splitRendCodec,
- poseCorrection,
- splitRendCodecFrameSizeMs,
- splitRendIsarFrameSizeMs,
- arg.output_Fs,
- lc3plusHighRes ) ) != IVAS_ERR_OK )
+ if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, lc3plusHighRes ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
return error;
@@ -1736,7 +1774,7 @@ static ivas_error initOnFirstGoodFrame(
}
}
- if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 )
+ if ( !isSplitCoded )
{
/* Open audio writer and write all previously skipped bad frames now that frame size is known */
if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK )
@@ -1771,7 +1809,6 @@ static ivas_error initOnFirstGoodFrame(
}
else
{
-
if ( *pRemainingDelayNumSamples < *numOutSamples )
{
if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
@@ -1851,7 +1888,22 @@ static ivas_error initOnFirstGoodFrame(
if ( numInitialBadFrames > 0 )
{
/* Duplicate good first frame metadata to fill the beginning of stream. */
+#ifdef NONBE_FIX_1261_MASA_EXT_META_JBM
+ int16_t fullDelayNumSamplesLocal[3];
+ int32_t delayTimeScaleLocal;
+ float delayMs;
+ IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
+ hMasaExtOutMeta = NULL;
+
+ /* fullDelayNumSamples is zeroed so need to re-fetch delay info */
+ if ( ( error = IVAS_DEC_GetDelay( hIvasDec, fullDelayNumSamplesLocal, &delayTimeScaleLocal ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
+ }
+ delayMs = (float) ( fullDelayNumSamplesLocal[0] ) / (float) ( delayTimeScaleLocal );
+#else
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta = NULL;
+#endif
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
{
@@ -1861,12 +1913,10 @@ static ivas_error initOnFirstGoodFrame(
for ( int16_t j = 0; j < numInitialBadFrames; ++j )
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+#ifndef NONBE_FIX_1261_MASA_EXT_META_JBM
float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale );
- if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
+ if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
return error;
@@ -1909,6 +1959,9 @@ static ivas_error initOnFirstGoodFrame(
static ivas_error decodeG192(
DecArguments arg,
BS_READER_HANDLE hBsReader,
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary,
+#endif
RotFileReader *headRotReader,
RotFileReader *externalOrientationFileReader,
RotFileReader *refRotReader,
@@ -1941,11 +1994,22 @@ static ivas_error decodeG192(
IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } };
int16_t vec_pos_update, vec_pos_len;
SplitFileReadWrite *splitRendWriter = NULL;
-
-#ifdef FIX_1053_REVERB_RECONFIGURATION
+ int16_t isSplitRend, isSplitCoded;
IVAS_RENDER_CONFIG_DATA renderConfig;
RenderConfigReader *renderConfigReader = NULL;
+ if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_enabled, code: %d\n", error );
+ return error;
+ }
+
+ if ( ( error = IVAS_DEC_is_split_rendering_coded_out( hIvasDec, &isSplitCoded ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_coded_out, code: %d\n", error );
+ return error;
+ }
+
if ( arg.renderConfigEnabled )
{
if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
@@ -1966,7 +2030,6 @@ static ivas_error decodeG192(
goto cleanup;
}
}
-#endif
for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
{
@@ -1976,7 +2039,6 @@ static ivas_error decodeG192(
/* we always start with needing a new frame */
needNewFrame = true;
-
if ( !arg.quietModeEnabled )
{
fprintf( stdout, "\n------ Running the decoder ------\n\n" );
@@ -2008,13 +2070,13 @@ static ivas_error decodeG192(
return error;
}
-
/*------------------------------------------------------------------------------------------*
* Loop for every packet (frame) of bitstream data
* - Read the bitstream packet
* - Run the decoder
* - Write the synthesized signal into output file
*------------------------------------------------------------------------------------------*/
+
while ( 1 )
{
/* Read next frame if not enough samples availble */
@@ -2134,7 +2196,6 @@ static ivas_error decodeG192(
{
if ( needNewFrame )
{
-#ifdef FIX_1053_REVERB_RECONFIGURATION
if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL &&
arg.aeSequence.count > 0 && arg.aeSequence.pValidity[arg.aeSequence.selected] != 0 )
{
@@ -2165,7 +2226,6 @@ static ivas_error decodeG192(
}
}
}
-#endif
if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK )
{
if ( error == IVAS_ERR_END_OF_FILE )
@@ -2182,9 +2242,49 @@ static ivas_error decodeG192(
fprintf( stderr, "\nError: could not feed frame to decoder: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ /* Read main parameters from the bitstream to set-up the decoder */
+ hHrtfBinary->binaural_renderer_old = hHrtfBinary->binaural_renderer;
+ hHrtfBinary->binaural_renderer_sec_old = hHrtfBinary->binaural_renderer_sec;
+ if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtfBinary->binaural_renderer, &hHrtfBinary->binaural_renderer_sec, &hHrtfBinary->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ /* Placeholder for memory reallocation */
+ /* ... */
+
+ /* Load HRTF binary file data */
+ if ( arg.hrtfReaderEnabled )
+ {
+ if ( ( error = load_hrtf_from_file( hHrtfBinary, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nload_hrtf_from_file failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ goto cleanup;
+ }
+ }
+#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 ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
+ if ( isSplitRend )
{
if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (Word16 *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBits, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
{
@@ -2249,7 +2349,7 @@ static ivas_error decodeG192(
/* Write current frame */
if ( decodedGoodFrame )
{
- if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
+ if ( isSplitRend )
{
if ( split_rend_write_bitstream_to_file( splitRendWriter, splitRendBits->bits_buf, &splitRendBits->bits_read, &splitRendBits->bits_written ) != IVAS_ERR_OK )
{
@@ -2258,7 +2358,7 @@ static ivas_error decodeG192(
}
}
- if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 )
+ if ( !isSplitCoded )
{
if ( delayNumSamples < nOutSamples )
{
@@ -2308,7 +2408,6 @@ static ivas_error decodeG192(
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
int16_t fullDelayNumSamples[3];
float delayMs;
@@ -2317,19 +2416,14 @@ static ivas_error decodeG192(
{
fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
}
-#endif
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
-#endif
{
fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
goto cleanup;
@@ -2455,7 +2549,6 @@ static ivas_error decodeG192(
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
int16_t fullDelayNumSamples[3];
float delayMs;
@@ -2463,19 +2556,14 @@ static ivas_error decodeG192(
{
fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
}
-#endif
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
-#endif
{
fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
goto cleanup;
@@ -2553,9 +2641,7 @@ static ivas_error decodeG192(
cleanup:
-#ifdef FIX_1053_REVERB_RECONFIGURATION
RenderConfigReader_close( &renderConfigReader );
-#endif
split_rend_reader_writer_close( &splitRendWriter );
AudioFileWriter_close( &afWriter );
@@ -2591,6 +2677,9 @@ static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer
static ivas_error decodeVoIP(
DecArguments arg,
BS_READER_HANDLE hBsReader,
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf,
+#endif
RotFileReader *headRotReader,
RotFileReader *externalOrientationFileReader,
RotFileReader *refRotReader,
@@ -2640,6 +2729,13 @@ static ivas_error decodeVoIP(
IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } };
int16_t vec_pos_update, vec_pos_len;
int16_t nOutSamples = 0;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ bool bitstreamReadDone = false;
+#ifdef OBJ_EDITING_API
+ bool parametersAvailableForEditing = false;
+#endif
+ uint16_t nSamplesRendered;
+#endif
vec_pos_update = 0;
if ( ( error = IVAS_DEC_GetRenderFramesizeMs( hIvasDec, &systemTimeInc_ms ) ) != IVAS_ERR_OK )
@@ -2757,6 +2853,9 @@ static ivas_error decodeVoIP(
while ( 1 )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ nSamplesRendered = 0;
+#endif
/* reference vector */
if ( arg.enableReferenceVectorTracking && vec_pos_update == 0 )
@@ -2825,8 +2924,7 @@ static ivas_error decodeVoIP(
{
if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
{
- fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
- RotationFileReader_getFilePath( headRotReader ) );
+ fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
goto cleanup;
}
}
@@ -2834,8 +2932,7 @@ static ivas_error decodeVoIP(
for ( i = 0; i < num_subframes; i++ )
{
- if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i,
- DEFAULT_AXIS ) ) != IVAS_ERR_OK )
+ if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
@@ -2922,15 +3019,70 @@ static ivas_error decodeVoIP(
/* decode and get samples */
+#ifdef FIX_HRTF_LOAD
+ while ( nSamplesRendered < nOutSamples )
+ {
+#endif
#ifdef SUPPORT_JBM_TRACEFILE
- if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK )
+#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
- {
- fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
- goto cleanup;
- }
+#endif
+ {
+ fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
+ goto cleanup;
+ }
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ if ( bitstreamReadDone == true )
+ {
+ /* Read main parameters from the bitstream to set-up the decoder */
+ hHrtf->binaural_renderer_old = hHrtf->binaural_renderer;
+ hHrtf->binaural_renderer_sec_old = hHrtf->binaural_renderer_sec;
+ if ( ( error = IVAS_DEC_ReadFormat( hIvasDec, &hHrtf->binaural_renderer, &hHrtf->binaural_renderer_sec, &hHrtf->hrtf_set_audio_cfg ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ /* Placeholder for memory reallocation */
+ /* ... */
+
+ /* Load HRTF binary file data */
+ if ( arg.hrtfReaderEnabled )
+ {
+ if ( ( error = load_hrtf_from_file( hHrtf, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nload_hrtf_from_file failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ goto cleanup;
+ }
+ }
+ }
+#endif
+#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 )
@@ -3025,7 +3177,6 @@ static ivas_error decodeVoIP(
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
int16_t fullDelayNumSamples[3];
float delayMs;
@@ -3034,19 +3185,14 @@ static ivas_error decodeVoIP(
{
fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
}
-#endif
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
-#endif
{
fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
goto cleanup;
@@ -3062,14 +3208,10 @@ static ivas_error decodeVoIP(
}
vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
frame++;
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
if ( vec_pos_update == 0 )
{
systemTime_ms += vec_pos_len * systemTimeInc_ms;
}
-#else
- systemTime_ms += systemTimeInc_ms;
-#endif
#ifdef WMOPS
update_mem();
@@ -3078,7 +3220,6 @@ static ivas_error decodeVoIP(
}
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
int16_t nSamplesFlushed = 0;
/* decode and get samples */
@@ -3129,7 +3270,6 @@ static ivas_error decodeVoIP(
if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
{
IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
int16_t fullDelayNumSamples[3];
float delayMs;
@@ -3138,19 +3278,14 @@ static ivas_error decodeVoIP(
{
fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
}
-#endif
if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
-#endif
{
fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
goto cleanup;
@@ -3158,7 +3293,6 @@ static ivas_error decodeVoIP(
}
}
}
-#endif
/*------------------------------------------------------------------------------------------*
@@ -3234,4 +3368,178 @@ cleanup:
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+/*---------------------------------------------------------------------*
+ * load_hrtf_from_file()
+ *
+ * Load HRTF coefficients from external binary file
+ *---------------------------------------------------------------------*/
+
+static ivas_error load_hrtf_from_file(
+ IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, /* i/o: HRTF binary wrapper handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_AUDIO_CONFIG OutputConfig, /* i : output audio configuration */
+ const int32_t output_Fs /* i : output sampling rate */
+)
+{
+ ivas_error error;
+ IVAS_BIN_RENDERER_TYPE binaural_renderer, binaural_renderer_sec;
+
+ if ( hHrtfBinary == NULL || hIvasDec == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ binaural_renderer = hHrtfBinary->binaural_renderer;
+ binaural_renderer_sec = hHrtfBinary->binaural_renderer_sec;
+
+ if ( ( binaural_renderer != hHrtfBinary->binaural_renderer_old ) ||
+ ( binaural_renderer_sec != hHrtfBinary->binaural_renderer_sec_old ) ||
+ ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
+ {
+ /*------------------------------------------------------------------------------------------*
+ * Release HRTF binary data
+ *------------------------------------------------------------------------------------------*/
+
+ if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && binaural_renderer_sec != IVAS_BIN_RENDERER_TYPE_TDREND && hHrtfBinary->hHrtfTD != NULL )
+ {
+ destroy_td_hrtf( hHrtfBinary->hHrtfTD );
+ }
+
+ if ( ( error = IVAS_DEC_HRTF_binary_close( hIvasDec, hHrtfBinary->binaural_renderer_old ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ /*------------------------------------------------------------------------------------------*
+ * Load HRTF binary data
+ *------------------------------------------------------------------------------------------*/
+
+ if ( ( error = IVAS_DEC_HRTF_binary_open( hIvasDec, binaural_renderer ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ if ( ( error = IVAS_DEC_HRTF_binary_open( hIvasDec, binaural_renderer_sec ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_sec == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
+ {
+ if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfBinary->hHrtfTD ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_DEC_GetHrtfTDrendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ return error;
+ }
+
+ if ( ( error = load_TDrend_HRTF_binary( *hHrtfBinary->hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
+ {
+ if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
+ {
+ fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName );
+ return error;
+ }
+ else
+ {
+ destroy_td_hrtf( hHrtfBinary->hHrtfTD );
+ }
+ }
+ }
+
+ if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
+ {
+ IVAS_DEC_HRTF_CREND_HANDLE *hHrtfCrend = NULL;
+ if ( ( error = IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hHrtfCrend ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_DEC_GetHrtfCRendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ return error;
+ }
+
+ if ( ( error = load_Crend_HRTF_from_binary( *hHrtfCrend, hHrtfBinary->hrtfReader, OutputConfig, hHrtfBinary->hrtf_set_audio_cfg, output_Fs ) ) != IVAS_ERR_OK )
+ {
+ if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
+ {
+ fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName );
+ return error;
+ }
+ else
+ {
+ destroy_crend_hrtf( hHrtfCrend );
+ }
+ }
+ }
+
+ if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
+ {
+ IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
+ if ( ( error = IVAS_DEC_GetHrtfFastConvHandle( hIvasDec, &hHrtfFastConv ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_DEC_GetHrtfFastConvHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ return error;
+ }
+
+ if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, OutputConfig, hHrtfBinary->hrtf_set_audio_cfg, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
+ {
+ if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
+ {
+ fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName );
+ return error;
+ }
+ else
+ {
+ destroy_fastconv_hrtf( hHrtfFastConv );
+ }
+ }
+ }
+
+ if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_PARAMBIN || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
+ {
+ IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
+ if ( ( error = IVAS_DEC_GetHrtfParamBinHandle( hIvasDec, &hHrtfParambin ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_DEC_GetHrtfParamBinHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ return error;
+ }
+
+ if ( ( error = load_parambin_HRTF_from_binary( *hHrtfParambin, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
+ {
+ if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
+ {
+ fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName );
+ return error;
+ }
+ else
+ {
+ destroy_parambin_hrtf( hHrtfParambin );
+ }
+ }
+ }
+ }
+
+ if ( hHrtfBinary->hHrtfStatistics == NULL && ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
+ {
+ if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary->hHrtfStatistics ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_DEC_GetHrtfStatisticsHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
+ return error;
+ }
+
+ if ( ( error = load_reverb_binary( *hHrtfBinary->hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
+ {
+ if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
+ {
+ fprintf( stderr, "\nError in loading HRTF binary file %s \n\n", hHrtfBinary->hrtfFileName );
+ return error;
+ }
+ else
+ {
+ destroy_hrtf_statistics( hHrtfBinary->hHrtfStatistics );
+ }
+ }
+ }
+
+ return IVAS_ERR_OK;
+}
+#endif
#undef WMC_TOOL_SKIP
diff --git a/apps/encoder.c b/apps/encoder.c
index 1f871381b9229ddde7e54d57a7005145e3aebddd..d0ad408f2f8a77c83875e217e1f7ca71d439c9d4 100644
--- a/apps/encoder.c
+++ b/apps/encoder.c
@@ -1486,6 +1486,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: Too low number of ISM channels specified!\n\n" );
usage_enc();
+ return false;
}
else
{
@@ -1497,6 +1498,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: Too high number of ISM channels!\n\n" );
usage_enc();
+ return false;
}
}
}
@@ -1504,6 +1506,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: Number of ISM channels not specified!\n\n" );
usage_enc();
+ return false;
}
if ( i < argc - 4 )
{
@@ -1523,7 +1526,7 @@ static bool parseCmdlIVAS_enc(
default:
fprintf( stderr, "Error: MASA channels must be 1 or 2.\n\n" );
usage_enc();
- break;
+ return false;
}
}
@@ -1548,6 +1551,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: not enough arguments\n\n" );
usage_enc();
+ return false;
}
}
@@ -1560,6 +1564,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: not enough MASA arguments\n\n" );
usage_enc();
+ return false;
}
}
else if ( strcmp( to_upper( argv[i] ), "-ISM_SBA" ) == 0 )
@@ -1578,6 +1583,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: Too low number of ISM channels specified!\n\n" );
usage_enc();
+ return false;
}
else
{
@@ -1589,6 +1595,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: Too high number of ISM channels!\n\n" );
usage_enc();
+ return false;
}
}
}
@@ -1596,6 +1603,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: Number of ISM channels not specified!\n\n" );
usage_enc();
+ return false;
}
if ( i < argc - 4 )
@@ -1647,6 +1655,7 @@ static bool parseCmdlIVAS_enc(
{
fprintf( stderr, "Error: not enough arguments\n\n" );
usage_enc();
+ return false;
}
}
}
diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c
index b4ff098ba1bffe58873a9ff0ebdf456f8acd29fe..bbda6949d59ddaf6be613c5edab4589919a79afd 100644
--- a/apps/isar_post_rend.c
+++ b/apps/isar_post_rend.c
@@ -31,9 +31,6 @@
*******************************************************************************************************/
#include "lib_isar_post_rend.h"
-//#undef IVAS_FLOAT_FIXED
-
-
#include
#include
#include
@@ -268,9 +265,6 @@ static int16_t getTotalNumInChannels(
return totalNumInChannels;
}
-/*------------------------------------------------------------------------------------------*
- * Local functions
- *------------------------------------------------------------------------------------------*/
static const CmdLnParser_Option *findOptionById(
const int32_t id )
@@ -433,6 +427,7 @@ static bool checkRequiredArgs(
return !missingRequiredArg;
}
+
static CmdlnArgs defaultArgs(
const char *executableName )
{
@@ -463,6 +458,7 @@ static CmdlnArgs defaultArgs(
return args;
}
+
static void parseOption(
const int32_t optionId,
char **optionValues,
@@ -555,6 +551,7 @@ static void parseOption(
return;
}
+
static CmdlnArgs parseCmdlnArgs(
const int argc,
char **argv )
@@ -631,6 +628,7 @@ static void convertInputBuffer(
return;
}
+
/*--------------------------------------------------------------------------*
* convertOutputBuffer()
*
@@ -672,6 +670,7 @@ static void convertOutputBuffer(
return;
}
+
/*------------------------------------------------------------------------------------------*
* main()
*
@@ -731,12 +730,20 @@ int main(
bitsBuffer.config.isar_frame_size_ms = 20;
bitsBuffer.config.lc3plusHighRes = 0;
+ /*------------------------------------------------------------------------------------------*
+ * Parse command-line arguments
+ *------------------------------------------------------------------------------------------*/
+
CmdlnArgs args = parseCmdlnArgs( argc, argv );
convert_backslash( args.inputFilePath );
convert_backslash( args.outputFilePath );
convert_backslash( args.headRotationFilePath );
+ /*------------------------------------------------------------------------------------------*
+ * Open head-rotation file
+ *------------------------------------------------------------------------------------------*/
+
if ( !isEmptyString( args.headRotationFilePath ) )
{
if ( RotationFileReader_open( args.headRotationFilePath, &headRotReader ) != IVAS_ERR_OK )
@@ -746,6 +753,10 @@ int main(
}
}
+ /*------------------------------------------------------------------------------------------*
+ * Open BFI file
+ *------------------------------------------------------------------------------------------*/
+
if ( !isEmptyString( args.splitRendBFIFilePath ) )
{
convert_backslash( args.splitRendBFIFilePath );
@@ -844,6 +855,10 @@ int main(
}
}
+ /*------------------------------------------------------------------------------------------*
+ * Open ISAR handle
+ *------------------------------------------------------------------------------------------*/
+
const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) );
args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_BINAURAL;
if ( ( error = ISAR_POST_REND_open( &hIsarPostRend, args.sampleRate, args.outConfig.audioConfig, true, 0, 0, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
@@ -852,7 +867,10 @@ int main(
goto cleanup;
}
- /* === Configure === */
+ /*------------------------------------------------------------------------------------------*
+ * Configuration
+ *------------------------------------------------------------------------------------------*/
+
if ( ( error = ISAR_POST_REND_InitConfig( hIsarPostRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) );
@@ -906,6 +924,10 @@ int main(
goto cleanup;
}
+ /*------------------------------------------------------------------------------------------*
+ * Allocate processing buffers
+ *------------------------------------------------------------------------------------------*/
+
inBufferSize = frameSize_smpls * totalNumInChannels;
outBufferSize = frameSize_smpls * numOutChannels;
inpInt16Buffer = malloc( inBufferSize * sizeof( int16_t ) );
@@ -961,6 +983,13 @@ int main(
fprintf( stdout, "\n\n-- Start the ISAR post renderer (quiet mode) --\n\n" );
}
+ /*------------------------------------------------------------------------------------------*
+ * Loop for every frame of data
+ * - Read the input data
+ * - Run the post-rendering
+ * - Write the data into output file
+ *------------------------------------------------------------------------------------------*/
+
while ( 1 )
{
int16_t num_in_channels;
diff --git a/apps/renderer.c b/apps/renderer.c
index 5917e4d29a89aa14e3ce6f240e3a3a4134bdb634..c411720a536a0704ef5c2d44cfc4915c92b6efbb 100644
--- a/apps/renderer.c
+++ b/apps/renderer.c
@@ -45,6 +45,9 @@
#include "masa_file_writer.h"
#include "render_config_reader.h"
#include "rotation_file_reader.h"
+#ifdef FIX_1053_REVERB_RECONFIGURATION
+#include "aeid_file_reader.h"
+#endif
#include "split_render_file_read_write.h"
#include "split_rend_bfi_file_reader.h"
#include "vector3_pair_file_reader.h"
@@ -144,7 +147,6 @@ typedef struct
IVAS_CUSTOM_LS_DATA outSetupCustom;
} OutputConfig;
-#ifdef FIX_1053_REVERB_RECONFIGURATION
typedef struct
{
uint16_t *pID;
@@ -153,7 +155,6 @@ typedef struct
uint16_t selected;
uint16_t frameCounter;
} AcousticEnvironmentSequence;
-#endif
typedef struct
{
@@ -174,6 +175,8 @@ typedef struct
char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH];
int8_t orientation_tracking;
+ int16_t Opt_Headrotation;
+ int16_t Opt_ExternalOrientation;
int16_t nonDiegeticPan;
float nonDiegeticPanGain;
IVAS_REND_COMPLEXITY_LEVEL complexityLevel;
@@ -190,11 +193,7 @@ typedef struct
float syncMdDelay;
IVAS_RENDER_FRAMESIZE render_framesize;
uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
-#ifdef FIX_1053_REVERB_RECONFIGURATION
AcousticEnvironmentSequence aeSequence;
-#else
- uint16_t acousticEnvironmentId;
-#endif
} CmdlnArgs;
typedef enum
@@ -390,9 +389,9 @@ static const CmdLnParser_Option cliOptions[] = {
.match = "acoustic_environment_id",
.matchShort = "aeid",
#ifdef FIX_1053_REVERB_RECONFIGURATION
- .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.",
+ .description = "Acoustic environment ID (number > 0) alternatively, it can be a text file where each line contains \"ID duration\" for BINAURAL_ROOM_REVERB output configuration.",
#else
- .description = "Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration",
+ .description = "Acoustic environment ID( number > 0 ) or a sequence thereof in the format [ID1:duration1,ID2:duration2...] without braces and spaces, with ':' character separating ID from duration and ',' separating ID and duration pairs, where duration is specified in frames for BINAURAL_ROOM_REVERB output configuration.",
#endif
},
};
@@ -644,12 +643,27 @@ static void setupWithSingleFormatInput(
positionProvider->numObjects = args.inConfig.numAudioObjects;
for ( int16_t i = 0; i < positionProvider->numObjects; ++i )
{
+#ifdef FIX_1376_MISSING_ISM_METADATA
+ /* Check if path to metadata file was given */
+ if ( isEmptyString( args.inMetadataFilePaths[i] ) )
+ {
+ fprintf( stderr, "No metadata file was given for ISM input %d\n", i );
+ exit( -1 );
+ }
+
+ /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string contains "NULL" */
+#else
/* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */
+#endif
char charBuf[FILENAME_MAX];
strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 );
charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0';
to_upper( charBuf );
+#ifdef FIX_1376_MISSING_ISM_METADATA
+ if ( strncmp( charBuf, "NULL", 4 ) == 0 )
+#else
if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 )
+#endif
{
continue;
}
@@ -701,7 +715,11 @@ static int16_t get_cldfb_in_flag(
int16_t cldfb_in_flag;
cldfb_in_flag = 0;
+#ifdef FIX_HRTF_LOAD
+ if ( renderConfig->split_rend_config.rendererSelection == IVAS_BIN_RENDERER_TYPE_FASTCONV )
+#else
if ( renderConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
+#endif
{
#ifdef DEBUGGING
cldfb_in_flag = 1;
@@ -715,6 +733,7 @@ static int16_t get_cldfb_in_flag(
return cldfb_in_flag;
}
+
static int16_t is_split_pre_rend_mode(
CmdlnArgs *args )
{
@@ -751,10 +770,14 @@ int main(
SplitRendBFIFileReader *splitRendBFIReader = NULL;
Vector3PairFileReader *referenceVectorReader = NULL;
hrtfFileReader *hrtfFileReader = NULL;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IVAS_DEC_HRTF_CREND_HANDLE *hHrtfCrend = NULL;
+#else
IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF = NULL;
+#endif
IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv = NULL;
IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin = NULL;
- IVAS_DEC_HRTF_HANDLE *hHrtfTD = NULL;
+ IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD = NULL;
IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
IsmPositionProvider *positionProvider = NULL;
LfeRoutingConfig *lfeRoutingConfigs[RENDERER_MAX_MC_INPUTS];
@@ -789,8 +812,9 @@ int main(
int16_t zeroPadToWrite = 0;
int32_t delayTimeScale = 0;
int16_t i, numChannels;
-#ifdef FIX_1053_REVERB_RECONFIGURATION
uint16_t aeID;
+#ifdef FIX_1053_REVERB_RECONFIGURATION
+ IVAS_RENDER_CONFIG_DATA renderConfig;
#endif
ivas_error error = IVAS_ERR_OK;
@@ -978,7 +1002,8 @@ int main(
Word32 nonDiegeticPanGain_fx = ( args.nonDiegeticPanGain == 1.0f ) ? ONE_IN_Q31 : ( args.nonDiegeticPanGain == -1.0f ) ? L_negate( ONE_IN_Q31 )
: (Word32) ( args.nonDiegeticPanGain * ( 1LL << Q31 ) );
- IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
+
+ IF( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, !isEmptyString( args.customHrtfFilePath ), args.nonDiegeticPan, nonDiegeticPanGain_fx, args.Opt_Headrotation, args.Opt_ExternalOrientation, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError opening renderer handle: %s\n", ivas_error_to_string( error ) );
goto cleanup;
@@ -994,13 +1019,17 @@ int main(
if ( hrtfFileReader != NULL )
{
- if ( ( error = IVAS_REND_GetHrtfHandle( hIvasRend, &hHrtfTD ) ) != IVAS_ERR_OK )
+ if ( ( error = IVAS_REND_GetHrtfTdHandle( hIvasRend, &hHrtfTD ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_REND_GetHrtfHandle failed: %s\n\n", ivas_error_to_string( error ) );
goto cleanup;
}
+#ifdef FIX_989_TD_REND_ROM
+ if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, args.sampleRate, hrtfFileReader ) ) != IVAS_ERR_OK )
+#else
if ( ( error = load_HRTF_binary( *hHrtfTD, hrtfFileReader ) ) != IVAS_ERR_OK )
+#endif
{
if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
{
@@ -1013,7 +1042,21 @@ int main(
}
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hHrtfCrend ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_Rend_GetHrtfCRendHandle failed: %s\n\n", ivas_error_to_string( error ) );
+ goto cleanup;
+ }
+ IVAS_AUDIO_CONFIG hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
+ if ( args.inConfig.ambisonicsBuses->audioConfig != IVAS_AUDIO_CONFIG_INVALID && args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
+ {
+ hrtf_set_audio_cfg = args.inConfig.ambisonicsBuses->audioConfig;
+ }
+
+ if ( ( error = load_Crend_HRTF_from_binary( *hHrtfCrend, hrtfFileReader, args.outConfig.audioConfig, hrtf_set_audio_cfg, args.sampleRate ) ) != IVAS_ERR_OK )
+#else
if ( ( error = IVAS_REND_GetHrtfCRendHandle( hIvasRend, &hSetOfHRTF ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_Rend_GetHrtfCRendHandle failed: %s\n\n", ivas_error_to_string( error ) );
@@ -1021,6 +1064,7 @@ int main(
}
if ( ( error = create_SetOfHRTF_from_binary( *hSetOfHRTF, hrtfFileReader, args.sampleRate ) ) != IVAS_ERR_OK )
+#endif
{
if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
{
@@ -1029,7 +1073,11 @@ int main(
}
else
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ destroy_crend_hrtf( hHrtfCrend );
+#else
destroy_SetOfHRTF( hSetOfHRTF );
+#endif
}
}
@@ -1039,7 +1087,11 @@ int main(
goto cleanup;
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, args.outConfig.audioConfig, args.inConfig.ambisonicsBuses->audioConfig, hrtfFileReader ) ) != IVAS_ERR_OK )
+#else
if ( ( error = load_fastconv_HRTF_from_binary( *hHrtfFastConv, hrtfFileReader ) ) != IVAS_ERR_OK )
+#endif
{
if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
{
@@ -1145,7 +1197,10 @@ int main(
if ( args.renderConfigFilePath[0] != '\0' )
{
+
+#ifndef FIX_1053_REVERB_RECONFIGURATION
IVAS_RENDER_CONFIG_DATA renderConfig;
+#endif
/* sanity check */
if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) && !is_split_pre_rend_mode( &args ) )
@@ -1166,15 +1221,20 @@ int main(
fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath );
goto cleanup;
}
-
+ if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] );
+ goto cleanup;
+ }
+ if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt_fx ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "Failed to get Distance Attenuation \n\n" );
+ goto cleanup;
+ }
if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{
-#ifdef FIX_1053_REVERB_RECONFIGURATION
aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535;
if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
-#else
- if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
-#endif
{
if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
{
@@ -1184,14 +1244,9 @@ int main(
}
else
{
-#ifdef FIX_1053_REVERB_RECONFIGURATION
fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
-#else
- fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", args.acousticEnvironmentId );
-#endif
goto cleanup;
}
- renderConfig.roomAcoustics.override = 1;
}
/* ISAR frame size is set from command line, not renderer config file.
@@ -1286,6 +1341,17 @@ int main(
{
masaIds[i] = 0u;
}
+#ifdef NONBE_1377_REND_DIRATT_CONF
+#ifdef FIX_1377_HANDLE_ERROR_CODE
+ if ( ( error = IVAS_REND_SetObjectIDs( hIvasRend ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nIVAS_REND_SetObjectIDs: %s\n", ivas_error_to_string( error ) );
+ goto cleanup;
+ }
+#else
+ IVAS_REND_SetObjectIDs( hIvasRend );
+#endif
+#endif
for ( i = 0; i < args.inConfig.numMultiChannelBuses; ++i )
{
@@ -1471,12 +1537,11 @@ int main(
if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
{
-
- IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend,
- &bitsBuffer.config.codec,
- &bitsBuffer.config.poseCorrection,
- &bitsBuffer.config.codec_frame_size_ms,
- &bitsBuffer.config.isar_frame_size_ms );
+ if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader(): %s!\n", ivas_error_to_string( error ) );
+ goto cleanup;
+ }
if ( IVAS_REND_GetDelay_fx( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK )
{
@@ -1484,16 +1549,7 @@ int main(
goto cleanup;
}
- if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite,
- args.outputFilePath,
- delayNumSamples_temp,
- delayTimeScale_temp,
- bitsBuffer.config.codec,
- bitsBuffer.config.poseCorrection,
- bitsBuffer.config.codec_frame_size_ms,
- bitsBuffer.config.isar_frame_size_ms,
- args.sampleRate,
- bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK )
+ if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outputFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.outputFilePath );
goto cleanup;
@@ -1504,12 +1560,11 @@ int main(
{
if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
-
- IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend,
- &bitsBuffer.config.codec,
- &bitsBuffer.config.poseCorrection,
- &bitsBuffer.config.codec_frame_size_ms,
- &bitsBuffer.config.isar_frame_size_ms );
+ if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms ) ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader(): %s!\n", ivas_error_to_string( error ) );
+ goto cleanup;
+ }
if ( IVAS_REND_GetDelay_fx( hIvasRend, &delayNumSamples_temp, &delayTimeScale_temp ) != IVAS_ERR_OK )
{
@@ -1517,16 +1572,7 @@ int main(
goto cleanup;
}
- if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite,
- args.outMetadataFilePath,
- delayNumSamples_temp,
- delayTimeScale_temp,
- bitsBuffer.config.codec,
- bitsBuffer.config.poseCorrection,
- bitsBuffer.config.codec_frame_size_ms,
- bitsBuffer.config.isar_frame_size_ms,
- args.sampleRate,
- bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK )
+ if ( ( error = split_rend_writer_open( &hSplitRendFileReadWrite, args.outMetadataFilePath, delayNumSamples_temp, delayTimeScale_temp, bitsBuffer.config.codec, bitsBuffer.config.poseCorrection, bitsBuffer.config.codec_frame_size_ms, bitsBuffer.config.isar_frame_size_ms, args.sampleRate, bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nCould not open split rend metadata file %s\n", args.outMetadataFilePath );
goto cleanup;
@@ -1631,14 +1677,14 @@ int main(
num_in_channels = inBuffer.config.numChannels;
const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0;
-#ifdef FIX_1053_REVERB_RECONFIGURATION
if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL &&
args.aeSequence.count > 0 && args.aeSequence.pValidity[args.aeSequence.selected] != 0 )
{
if ( ++args.aeSequence.frameCounter >= args.aeSequence.pValidity[args.aeSequence.selected] )
{
+#ifndef FIX_1053_REVERB_RECONFIGURATION
IVAS_RENDER_CONFIG_DATA renderConfig;
-
+#endif
if ( ++args.aeSequence.selected >= args.aeSequence.count )
{
args.aeSequence.selected = 0;
@@ -1648,7 +1694,7 @@ int main(
{
if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
{
- fprintf( stderr, "Invalid acoustic environment configuratoin parameters\n\n" );
+ fprintf( stderr, "Invalid acoustic environment configuration parameters\n\n" );
goto cleanup;
}
}
@@ -1664,7 +1710,6 @@ int main(
}
}
}
-#endif
numSamplesRead = 0;
@@ -1769,7 +1814,7 @@ int main(
int16_t numFramesToTargetOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
for ( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
{
- if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quatBuffer[i], &enableHeadRotation[i], &enableExternalOrientation[i], &enableRotationInterpolation[i], &numFramesToTargetOrientation[i] ) ) != IVAS_ERR_OK )
+ if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &quatBuffer[sf_idx], &enableHeadRotation[sf_idx], &enableExternalOrientation[sf_idx], &enableRotationInterpolation[sf_idx], &numFramesToTargetOrientation[sf_idx] ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nError in External Orientation File Reading: %s\n", ivas_error_to_string( error ) );
goto cleanup;
@@ -2054,11 +2099,7 @@ int main(
}
}
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMetaOutput, NULL ) ) != IVAS_ERR_OK ) /* NULL -> use default metadata delay settings */
-#else
- if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMetaOutput ) ) != IVAS_ERR_OK )
-#endif
{
fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
}
@@ -2132,13 +2173,11 @@ cleanup:
free( bitsBufferData );
}
-#ifdef FIX_1053_REVERB_RECONFIGURATION
if ( args.aeSequence.count > 0 )
{
free( args.aeSequence.pID );
free( args.aeSequence.pValidity );
}
-#endif
for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
{
@@ -2164,6 +2203,9 @@ cleanup:
RotationFileReader_close( &externalOrientationFileReader );
RotationFileReader_close( &referenceRotReader );
Vector3PairFileReader_close( &referenceVectorReader );
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ destroy_td_hrtf( hHrtfTD );
+#else
if ( hSetOfHRTF != NULL && *hSetOfHRTF != NULL )
{
destroy_SetOfHRTF( hSetOfHRTF );
@@ -2172,6 +2214,7 @@ cleanup:
{
destroy_td_hrtf( hHrtfTD );
}
+#endif
destroy_hrtf_statistics( hHrtfStatistics );
IVAS_REND_Close( &hIvasRend );
IsmPositionProvider_close( positionProvider );
@@ -2606,11 +2649,29 @@ static bool parseLfePositionConfig(
return true;
}
-#ifdef FIX_1053_REVERB_RECONFIGURATION
static bool parseAcousticEnvironmentIds(
const char *value,
AcousticEnvironmentSequence *aeSequence )
{
+#ifdef FIX_1053_REVERB_RECONFIGURATION
+ char config_string[RENDERER_MAX_METADATA_LINE_LENGTH];
+ strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH );
+ if ( !is_digits_only( config_string ) )
+ {
+ aeidFileReader *aeidReader = NULL;
+ if ( aeidFileReader_open( config_string, &aeidReader ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError: Can't open aeid file %s \n", config_string );
+ return false;
+ }
+ if ( aeidFileReading( aeidReader, &aeSequence->count, &aeSequence->pID, &aeSequence->pValidity ) != IVAS_ERR_OK )
+ {
+ fprintf( stderr, "\nError while reading aeid from %s\n", config_string );
+ return false;
+ }
+ aeidFileReader_close( &aeidReader );
+ }
+#else
uint16_t k;
char config_string[RENDERER_MAX_METADATA_LINE_LENGTH];
char *s;
@@ -2675,6 +2736,7 @@ static bool parseAcousticEnvironmentIds(
return false;
}
}
+#endif
else
{
/* A single acoustic environment */
@@ -2691,7 +2753,6 @@ static bool parseAcousticEnvironmentIds(
return true;
}
-#endif
static bool checkRequiredArgs(
@@ -2744,6 +2805,9 @@ static CmdlnArgs defaultArgs(
const char *executableName )
{
CmdlnArgs args;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ int16_t i;
+#endif
strncpy( args.executableName, executableName, RENDERER_MAX_CLI_ARG_LENGTH );
clearString( args.inputFilePath );
@@ -2760,8 +2824,16 @@ static CmdlnArgs defaultArgs(
args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID;
args.outConfig.outSetupCustom.num_spk = 0;
args.outConfig.outSetupCustom.num_lfe = 0;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i )
+ {
+ args.inConfig.ambisonicsBuses[i].audioConfig = IVAS_AUDIO_CONFIG_INVALID;
+ }
+ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS + RENDERER_MAX_MASA_INPUTS; ++i )
+#else
for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
+#endif
{
clearString( args.inMetadataFilePaths[i] );
}
@@ -2776,7 +2848,11 @@ static CmdlnArgs defaultArgs(
clearString( args.renderConfigFilePath );
clearString( args.externalOrientationFilePath );
+ args.Opt_Headrotation = 0;
+ args.Opt_ExternalOrientation = 0;
+
args.orientation_tracking = IVAS_HEAD_ORIENT_TRK_NONE;
+
args.nonDiegeticPan = 0;
args.nonDiegeticPanGain = 0.f;
@@ -2794,21 +2870,20 @@ static CmdlnArgs defaultArgs(
clearString( args.inLfePanningMatrixFile );
args.render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
args.syncMdDelay = 0;
-
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
+#else
for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
+#endif
{
args.directivityPatternId[i] = 65535;
}
-#ifdef FIX_1053_REVERB_RECONFIGURATION
args.aeSequence.count = 0;
args.aeSequence.pID = NULL;
args.aeSequence.pValidity = NULL;
args.aeSequence.selected = 0;
args.aeSequence.frameCounter = 0;
-#else
- args.acousticEnvironmentId = 65535;
-#endif
return args;
}
@@ -2868,6 +2943,7 @@ static void parseOption(
break;
case CmdLnOptionId_trajFile:
assert( numOptionValues == 1 );
+ args->Opt_Headrotation = 1;
strncpy( args->headRotationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
break;
case CmdLnOptionId_outputMetadata:
@@ -2888,6 +2964,7 @@ static void parseOption(
break;
case CmdLnOptionId_exteriorOrientationFile:
assert( numOptionValues == 1 );
+ args->Opt_ExternalOrientation = 1;
strncpy( args->externalOrientationFilePath, optionValues[0], RENDERER_MAX_CLI_ARG_LENGTH - 1 );
break;
case CmdLnOptionId_customHrtfFile:
@@ -2978,19 +3055,10 @@ static void parseOption(
break;
case CmdLnOptionId_acousticEnvironmentId:
assert( numOptionValues == 1 );
-#ifdef FIX_1053_REVERB_RECONFIGURATION
if ( !parseAcousticEnvironmentIds( optionValues[0], &args->aeSequence ) )
{
fprintf( stderr, "Invalid acoustic environment ID specified: %s\n", optionValues[0] );
}
-#else
- if ( !is_digits_only( optionValues[0] ) )
- {
- fprintf( stderr, "Invalid acousting environment ID specified: %s\n", optionValues[0] );
- exit( -1 );
- }
- args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 );
-#endif
break;
case CmdLnOptionId_syncMdDelay:
assert( numOptionValues == 1 );
@@ -3021,6 +3089,11 @@ static CmdlnArgs parseCmdlnArgs(
exit( -1 ); /* Error printout handled by failing function */
}
+ if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
+ {
+ args.Opt_Headrotation = 1;
+ }
+
return args;
}
@@ -3698,14 +3771,20 @@ static void parseCombinedFormatInput(
inConfig->numAmbisonicsBuses = 1;
inConfig->ambisonicsBuses[0].audioConfig = audioConfig;
inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects;
+#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS
+ inConfig->ambisonicsBuses[0].gain_dB = 0.f;
+#else
inConfig->ambisonicsBuses[0].gain_dB = -6.f;
+#endif
*configString += 4;
/* Modify input gain for objects too */
+#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS
for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i )
{
inConfig->audioObjects[i].gain_dB = -6.f;
}
+#endif
}
else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 )
{
diff --git a/lib_com/basop32.c b/lib_basop/basop32.c
similarity index 100%
rename from lib_com/basop32.c
rename to lib_basop/basop32.c
diff --git a/lib_com/basop32.h b/lib_basop/basop32.h
similarity index 100%
rename from lib_com/basop32.h
rename to lib_basop/basop32.h
diff --git a/lib_com/complex_basop.c b/lib_basop/complex_basop.c
similarity index 100%
rename from lib_com/complex_basop.c
rename to lib_basop/complex_basop.c
diff --git a/lib_com/complex_basop.h b/lib_basop/complex_basop.h
similarity index 100%
rename from lib_com/complex_basop.h
rename to lib_basop/complex_basop.h
diff --git a/lib_com/enh1632.c b/lib_basop/enh1632.c
similarity index 100%
rename from lib_com/enh1632.c
rename to lib_basop/enh1632.c
diff --git a/lib_com/enh1632.h b/lib_basop/enh1632.h
similarity index 100%
rename from lib_com/enh1632.h
rename to lib_basop/enh1632.h
diff --git a/lib_com/enh32.c b/lib_basop/enh32.c
similarity index 100%
rename from lib_com/enh32.c
rename to lib_basop/enh32.c
diff --git a/lib_com/enh32.h b/lib_basop/enh32.h
similarity index 100%
rename from lib_com/enh32.h
rename to lib_basop/enh32.h
diff --git a/lib_com/enh40.c b/lib_basop/enh40.c
similarity index 100%
rename from lib_com/enh40.c
rename to lib_basop/enh40.c
diff --git a/lib_com/enh40.h b/lib_basop/enh40.h
similarity index 100%
rename from lib_com/enh40.h
rename to lib_basop/enh40.h
diff --git a/lib_com/enh64.c b/lib_basop/enh64.c
similarity index 100%
rename from lib_com/enh64.c
rename to lib_basop/enh64.c
diff --git a/lib_com/enh64.h b/lib_basop/enh64.h
similarity index 100%
rename from lib_com/enh64.h
rename to lib_basop/enh64.h
diff --git a/lib_com/enhUL32.c b/lib_basop/enhUL32.c
similarity index 100%
rename from lib_com/enhUL32.c
rename to lib_basop/enhUL32.c
diff --git a/lib_com/enhUL32.h b/lib_basop/enhUL32.h
similarity index 100%
rename from lib_com/enhUL32.h
rename to lib_basop/enhUL32.h
diff --git a/lib_com/move.h b/lib_basop/move.h
similarity index 97%
rename from lib_com/move.h
rename to lib_basop/move.h
index 7762ec79a10ad01297c253311190f95af13d647b..8f97ad49ec895c1f8425dc8f53ab79eded6c45c3 100644
--- a/lib_com/move.h
+++ b/lib_basop/move.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef _MOVE_H
diff --git a/lib_com/stl.h b/lib_basop/stl.h
similarity index 97%
rename from lib_com/stl.h
rename to lib_basop/stl.h
index 0de974226623ff746492cf57aea4be1210dfbd37..f27c6892a65f6380f6c53fd86ba80a6638d5590b 100644
--- a/lib_com/stl.h
+++ b/lib_basop/stl.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*
===========================================================================
diff --git a/lib_com/typedef.h b/lib_basop/typedef.h
similarity index 98%
rename from lib_com/typedef.h
rename to lib_basop/typedef.h
index 4dfd372240e39b54d0b84092257a09a144a85a8e..867ed71ca77cf51afff82dccb5fdeb671c6085bb 100644
--- a/lib_com/typedef.h
+++ b/lib_basop/typedef.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*
diff --git a/lib_com/typedefs.h b/lib_basop/typedefs.h
similarity index 100%
rename from lib_com/typedefs.h
rename to lib_basop/typedefs.h
diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c
index 7551bd41afff208bfcf26f1e5fc8787c63a736e4..55d7a3ec545c9e624da69913fcdb7cb382b42e7a 100644
--- a/lib_com/arith_coder_fx.c
+++ b/lib_com/arith_coder_fx.c
@@ -194,10 +194,12 @@ void tcx_arith_scale_envelope(
Word16 statesi, bits;
Word32 mean, a, s, L_tmp;
Word16 mean_e, tmp, tmp2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
lob_bits = 0;
@@ -223,8 +225,12 @@ void tcx_arith_scale_envelope(
tmp = norm_l( env[k] );
tmp2 = sub( 15, tmp );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = Inv16( round_fx_sat( L_shl( env[k], tmp ) ), &tmp2 ); /* exp(tmp2) */
+#else
tmp = Inv16( round_fx_o( L_shl_o( env[k], tmp, &Overflow ), &Overflow ), &tmp2 ); /* exp(tmp2) */
- ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */
+#endif
+ ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) ); /* Q16 */
move32();
mean = L_add( mean, ienv[k] ); /* Q16 */
}
@@ -256,7 +262,11 @@ void tcx_arith_scale_envelope(
b_e = add( b_e, mean_e );
/* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ) );
+#else
tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ), &Overflow );
+#endif
IF( tmp <= 0 )
{
@@ -271,7 +281,7 @@ void tcx_arith_scale_envelope(
tmp2 = BASOP_Util_Add_MantExp( negate( b ), b_e, tmp, tmp2, &scale ); /* exp(scale) */
scale = BASOP_Util_Divide1616_Scale( scale, round_fx( a ), &tmp );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
scale = shl_sat( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ) ); /* Q15 */
#else
scale = shl_o( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ), &Overflow ); /* Q15 */
@@ -324,7 +334,11 @@ void tcx_arith_scale_envelope(
L_tmp = L_add( L_tmp, L_shl( Mpy_32_16_1( env[k], mult_r( 1147 /*0.035f Q15*/, iscale ) ), iscale_e ) ); /* Q16 */
tmp = norm_l( L_tmp );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ statesi = mult_r( statesi, round_fx_sat( L_shl( L_tmp, tmp ) ) );
+#else
statesi = mult_r( statesi, round_fx_o( L_shl_o( L_tmp, tmp, &Overflow ), &Overflow ) );
+#endif
bits = add( bits, sub( 15, tmp ) );
tmp = norm_s( statesi );
@@ -411,7 +425,11 @@ void tcx_arith_scale_envelope(
*s_env_e = sub( add( 15, iscale_e ), tmp );
move16();
BASOP_SATURATE_WARNING_OFF_EVS;
+#ifdef ISSUE_1836_replace_overflow_libcom
+ a = L_shl_sat( 1265000, sub( 15, *s_env_e ) );
+#else
a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow );
+#endif
BASOP_SATURATE_WARNING_ON_EVS;
FOR( k = 0; k < L_frame; k++ )
diff --git a/lib_com/basop_com_lpc.c b/lib_com/basop_com_lpc.c
index 5cfb3bed0e55fdee2e46202c92dab4b503f14ad9..0c6754371ae8eae03fe70b1ed256835b2977e6e0 100644
--- a/lib_com/basop_com_lpc.c
+++ b/lib_com/basop_com_lpc.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/basop_lsf_tools.c b/lib_com/basop_lsf_tools.c
index 2c49ad4cf4d22a50ff63d8cc6e85330fe54aba98..74f35bb0a1a37921398f37b099e518f18fe02902 100644
--- a/lib_com/basop_lsf_tools.c
+++ b/lib_com/basop_lsf_tools.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/basop_proto_func.h b/lib_com/basop_proto_func.h
index 29db9c9c19e27f3b121780349c4b254cbee18307..0e2fc5ad757ee775ed1de3a0ebe9cf2b2dfdbeb0 100644
--- a/lib_com/basop_proto_func.h
+++ b/lib_com/basop_proto_func.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef BASOP_PROTO_FUNC_H
diff --git a/lib_com/basop_settings.h b/lib_com/basop_settings.h
index 9a344afc4b4ac449e9585a0f8a935a6d829ec5f2..a23491a2635dbf9792836a176efe1ba432c19bdf 100644
--- a/lib_com/basop_settings.h
+++ b/lib_com/basop_settings.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef __BASOP_SETTINGS_H
diff --git a/lib_com/basop_tcx_utils.c b/lib_com/basop_tcx_utils.c
index 8038c4f91e44fa3d4f3be746e03c2e3f1a7816ce..7c3ec835625dd45cd3f4a188c1c3623bfb9a37ad 100644
--- a/lib_com/basop_tcx_utils.c
+++ b/lib_com/basop_tcx_utils.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c
index bb92e286f399aa6f44d24ccab9abc17adb05ae18..fe2b7e871a0ebe2aca06094cb879427b4593ef71 100644
--- a/lib_com/basop_util.c
+++ b/lib_com/basop_util.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -267,9 +267,11 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a
Word16 preShift, postShift;
Word16 m;
Word32 m32;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
assert( b_m != 0 );
@@ -303,7 +305,11 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a
/* normalize result */
postShift = norm_l( m32 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ m = round_fx_sat( L_shl( m32, postShift ) );
+#else
m = round_fx_o( L_shl( m32, postShift ), &Overflow );
+#endif
/* exponent */
*ptrResult_e = sub( add( add( a_e, sub( 1, b_e ) ), preShift ), postShift );
@@ -319,7 +325,9 @@ static Word16 Sqrt16_common( Word16 m,
Word16 e )
{
Word16 index, frac;
+#ifndef ISSUE_1836_replace_overflow_libcom
Flag Overflow;
+#endif
assert( ( m >= 0x4000 ) || ( m == 0 ) );
@@ -334,9 +342,13 @@ static Word16 Sqrt16_common( Word16 m,
/* interpolate */
if ( m != 0 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ m = mac_r_sat( SqrtTable[index], SqrtDiffTable[index], frac );
+#else
BASOP_SATURATE_WARNING_OFF_EVS;
m = mac_ro( SqrtTable[index], SqrtDiffTable[index], frac, &Overflow );
BASOP_SATURATE_WARNING_ON_EVS;
+#endif
}
/* handle odd exponents */
@@ -352,13 +364,19 @@ static Word32 Sqrt32_common( Word32 m,
Word16 e )
{
Word16 m16, index, frac;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
assert( ( m >= 0x40000000 ) || ( m == 0 ) );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ m16 = round_fx_sat( m );
+#else
m16 = round_fx_o( m, &Overflow );
+#endif
/* get table index (upper 6 bits minus 32) */
/* index = (m16 >> 9) - 32; */
@@ -414,16 +432,23 @@ static Word32 ISqrt32_common( Word32 m,
Word16 e )
{
Word16 m16, index, frac;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
assert( m >= 0x40000000 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ m16 = round_fx_sat( m );
+#else
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
m16 = round_fx_o( m, &Overflow );
#else
m16 = round_fx( m );
#endif
+#endif
+
/* get table index (upper 6 bits minus 32) */
/* index = (m16 >> 25) - 32; */
@@ -890,9 +915,11 @@ Word16 divide3232( Word32 L_num, Word32 L_denom )
{
Word16 z;
Word32 sign;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
sign = L_and( L_xor( L_num, L_denom ), (Word32) 0x80000000 );
@@ -906,7 +933,11 @@ Word16 divide3232( Word32 L_num, Word32 L_denom )
L_denom = L_shl( L_denom, z );
/* round_fx instead of extract_h improves spectral distortion in E_UTIL_lev_dur (schur version). */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ z = div_l( L_num, round_fx_sat( L_denom ) );
+#else
z = div_l( L_num, round_fx_o( L_denom, &Overflow ) );
+#endif
if ( 0 != sign )
{
z = negate( z );
@@ -2041,23 +2072,36 @@ Word16 idiv1616_1( Word16 x, Word16 y )
}
}
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 norm_llQ31( /* o : normalized result Q31 */
Word32 L_c, /* i : upper bits of accu Q-1 */
Word32 L_sum, /* i : lower bits of accu, unsigned Q31 */
Word16 *exp /* o : exponent of result in [-32,31] Q0 */
)
{
+#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ move32(); /* compensate missing instrumentation */
+ move32(); /* compensate missing instrumentation */
+ return w_norm_llQ31( ( (Word64) L_c << 32 ) | (UWord32) L_sum, exp );
+#else
Word16 i;
Word32 L_tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef ISSUE_1836_replace_overflow_libcom
Flag Overflow = 0;
+#endif
Flag Carry = 0;
#endif /* BASOP_NOGLOB */
/* Move MSBit of L_sum into L_c */
+#ifdef ISSUE_1836_replace_overflow_libcom
Carry = 0;
+ L_tmp = L_add_c( L_sum, L_sum, &Carry ); /* L_tmp = L_sum << 1 */
+ L_c = L_add_c( L_c, L_c, &Carry );
+#else
L_tmp = L_add_co( L_sum, L_sum, &Carry, &Overflow ); /* L_tmp = L_sum << 1 */
L_c = L_add_co( L_c, L_c, &Carry, &Overflow );
+#endif
L_add( 0, 0 );
test();
IF( ( L_c != (Word32) 0L ) && ( L_c != (Word32) 0xFFFFFFFFL ) )
@@ -2083,37 +2127,10 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
*exp = i;
move16();
return L_sum;
+#endif /* #ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW */
}
+#endif /* #ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW */
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
-/* note: now available in basop_util.h */
-Word32 w_norm_llQ31( Word64 L_sum, Word16 *exp );
-Word32 w_norm_llQ31( /* o : normalized result Q31 */
- Word64 L_sum, /* i : upper and lower bits of accu, unsigned Q31 */
- Word16 *exp /* o : exponent of result in [-32,31] Q0 */
-)
-{
- Word32 L_tmp;
- Word16 exp_val;
- Word64 L64_inp64 = L_sum;
- move64();
-
- L64_inp64 = W_shl( L64_inp64, 1 );
- exp_val = W_norm( L64_inp64 );
- L64_inp64 = W_shl( L64_inp64, exp_val );
- exp_val = sub( 31, exp_val );
- if ( EQ_64( L_sum, 0 ) )
- {
- exp_val = -32;
- move16();
- }
- *exp = exp_val;
- move16();
-
- L_tmp = W_extract_h( L64_inp64 );
- return L_tmp;
-}
-#endif
Word32 Dot_product16HQ( /* o : normalized result Q31 */
const Word32 L_off, /* i : initial sum value Qn */
diff --git a/lib_com/basop_util.h b/lib_com/basop_util.h
index 0a82d112d46338b3259f53939c4f40407ff980f3..e6db321da23b9caa126676f83ea2ad6f8c3b8ae3 100644
--- a/lib_com/basop_util.h
+++ b/lib_com/basop_util.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef __BASOP_UTIL_H__
@@ -641,14 +641,16 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
Word16 *exp /* o : exponent of result in [-32,31] Q0 */
);
-#ifdef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
/*------------------------------------------------------------------*
* w_norm_llQ31:
*
* \brief Compute normalized Q31 Values out of overflowed Q31 value
* using 64-bit operators
*------------------------------------------------------------------*/
-static inline Word32 w_norm_llQ31( Word64 L64_var1, Word16 *S_var2 ) /*Q31 - L_tmp_exp*/
+static inline Word32 w_norm_llQ31( /* o : normalized result Q31 - *S_var2 */
+ Word64 L64_var1, /* i : 64-bit accu Q63 */
+ Word16 *S_var2 /* o : exponent of result in [-32,31] Q0 */
+)
{
Word32 L_result;
Word16 sh = W_norm( L64_var1 );
@@ -656,7 +658,6 @@ static inline Word32 w_norm_llQ31( Word64 L64_var1, Word16 *S_var2 ) /*Q31 - L_t
*S_var2 = ( L_result == 0 ) ? -32 : 32 - sh;
return L_result;
}
-#endif
/**
* \brief Compute dot product of 1 32 bit vectors with itself
diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c
index 3bb0cbd7294ce06710644dca1137a6b614730abe..2b630cf214185b387d08ef0c830e15e5b5c643db 100644
--- a/lib_com/bitalloc_fx.c
+++ b/lib_com/bitalloc_fx.c
@@ -23,9 +23,11 @@ void bitalloc_fx(
Word16 diff, temp;
Word16 fac;
Word16 ii;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Word16 SFM_thr = SFM_G1G2;
move16();
@@ -54,7 +56,11 @@ void bitalloc_fx(
move16();
FOR( m = 1; m < im; m++ )
{
- v = sub_o( temp, y[m], &Overflow ); /* Q0 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ v = sub_sat( temp, y[m] ); /* Q0 */
+#else
+ v = sub_o( temp, y[m], &Overflow ); /* Q0 */
+#endif
temp = s_max( temp, y[m] );
if ( v < 0 )
{
@@ -245,7 +251,7 @@ Word16 BitAllocF_fx(
Word16 tmp, exp1, exp2;
Word32 Rsubband_w32_fx[NB_SFM]; /* Q15 */
Word16 B_w16_fx;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -444,7 +450,7 @@ Word16 BitAllocF_fx(
exp1 = sub( norm_l( L_tmp2 ), 1 );
exp2 = norm_s( n );
tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/
#else
m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow ); /*Q14*/
diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c
index 5a5f881c643250bde289a77c0bca7164f4392ad1..9909f413da13f5b33d3d7ba6306817a812e1c5f5 100644
--- a/lib_com/bits_alloc_fx.c
+++ b/lib_com/bits_alloc_fx.c
@@ -623,12 +623,9 @@ ivas_error config_acelp1_fx(
const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */
const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */
const Word16 idchan, /* i : stereo channel ID */
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- const Word16 active_cnt, /* i : Active frame counter */
-#endif
- const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/
- const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
- const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/
+ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
+ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
)
{
Word16 i, bits, nb_subfr;
@@ -808,9 +805,6 @@ ivas_error config_acelp1_fx(
test();
test();
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- test();
-#endif
IF( !tdm_lp_reuse_flag || idchan == 0 )
{
/* LSF Q bit-budget */
@@ -887,11 +881,7 @@ ivas_error config_acelp1_fx(
bits = sub( bits, acelp_cfg->mid_lsf_bits );
}
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) )
-#else
- ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) && NE_16( active_cnt, 1 ) )
-#endif
{
bits = sub( bits, TDM_IC_LSF_PRED_BITS );
}
diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c
deleted file mode 100644
index 5b11e8d263f1a6e7aadbc35d95a7e33f6c173ccf..0000000000000000000000000000000000000000
--- a/lib_com/bitstream.c
+++ /dev/null
@@ -1,4052 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
- ====================================================================================*/
-
-#include
-#include
-#include "options.h"
-#include "cnst.h"
-#include "prot_fx.h"
-#include "stat_enc.h"
-#include "stat_dec.h"
-#include "rom_com.h"
-#include "mime.h"
-#include "ivas_cnst.h"
-#include "ivas_rom_com.h"
-#include "wmc_auto.h"
-#include "ivas_prot_fx.h"
-#include "prot_fx_enc.h"
-#ifdef DEBUGGING
-#include "debug.h"
-#ifdef DBG_BITSTREAM_ANALYSIS
-#include
-#endif
-#endif
-
-#define STEP_MAX_NUM_INDICES 100 /* increase the maximum number of allowed indices in the list by this amount */
-
-
-/*-------------------------------------------------------------------*
- * rate2AMRWB_IOmode()
- *
- * lookup AMRWB IO mode
- *-------------------------------------------------------------------*/
-
-static Word16 rate2AMRWB_IOmode(
- Word32 brate /* i : bitrate */
-)
-{
- switch ( brate )
- {
- /* EVS AMR-WB IO modes */
- case SID_1k75:
- return AMRWB_IO_SID;
- case ACELP_6k60:
- return AMRWB_IO_6600;
- case ACELP_8k85:
- return AMRWB_IO_8850;
- case ACELP_12k65:
- return AMRWB_IO_1265;
- case ACELP_14k25:
- return AMRWB_IO_1425;
- case ACELP_15k85:
- return AMRWB_IO_1585;
- case ACELP_18k25:
- return AMRWB_IO_1825;
- case ACELP_19k85:
- return AMRWB_IO_1985;
- case ACELP_23k05:
- return AMRWB_IO_2305;
- case ACELP_23k85:
- return AMRWB_IO_2385;
- default:
- break;
- }
-
- return -1;
-}
-
-/*-------------------------------------------------------------------*
- * rate2EVSmode()
- *
- * lookup EVS mode
- *-------------------------------------------------------------------*/
-Word16 rate2EVSmode_float(
- const Word32 brate, /* i : bitrate */
- Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
-)
-{
- if ( is_amr_wb != NULL )
- {
- *is_amr_wb = 0;
- }
-
- switch ( brate )
- {
- /* EVS Primary modes */
- case FRAME_NO_DATA:
- return NO_DATA_TYPE;
- case SID_2k40:
- return PRIMARY_SID;
- case PPP_NELP_2k80:
- return PRIMARY_2800;
- case ACELP_7k20:
- return PRIMARY_7200;
- case ACELP_8k00:
- return PRIMARY_8000;
- case ACELP_9k60:
- return PRIMARY_9600;
- case ACELP_13k20:
- return PRIMARY_13200;
- case ACELP_16k40:
- return PRIMARY_16400;
- case ACELP_24k40:
- return PRIMARY_24400;
- case ACELP_32k:
- return PRIMARY_32000;
- case ACELP_48k:
- return PRIMARY_48000;
- case ACELP_64k:
- return PRIMARY_64000;
- case HQ_96k:
- return PRIMARY_96000;
- case HQ_128k:
- return PRIMARY_128000;
- default:
- break;
- }
-
- if ( is_amr_wb != NULL )
- {
- *is_amr_wb = 1;
- }
-
- return rate2AMRWB_IOmode( brate );
-}
-
-/*-------------------------------------------------------------------*
- * ind_list_realloc()
- *
- * Re-allocate the list of indices
- *-------------------------------------------------------------------*/
-
-ivas_error ind_list_realloc(
- INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */
- const Word16 max_num_indices, /* i : new maximum number of allowed indices in the list */
- Encoder_Struct *st_ivas /* i : IVAS encoder structure */
-)
-{
- Word16 i, n, ch, n_channels, ind_list_pos, is_metadata, ivas_max_num_indices;
- INDICE_HANDLE new_ind_list;
- BSTR_ENC_HANDLE hBstr;
-
- IF( st_ivas == NULL )
- {
- return IVAS_ERR_OK;
- }
-
- /* get the pointer to the beginning of the old buffer of indices (either metadata or core coders) */
- IF( old_ind_list == st_ivas->ind_list_metadata )
- {
- is_metadata = 1;
- ivas_max_num_indices = st_ivas->ivas_max_num_indices_metadata;
- }
- ELSE
- {
- is_metadata = 0;
- ivas_max_num_indices = st_ivas->ivas_max_num_indices;
- }
- move16();
- move16();
-
- /* allocate new buffer of indices */
- IF( ( new_ind_list = (INDICE_HANDLE) malloc( max_num_indices * sizeof( Indice ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for buffer of indices!\n" ) );
- }
-
- /* move indices from the old list to the new list */
- FOR( i = 0; i < s_min( max_num_indices, ivas_max_num_indices ); i++ )
- {
- IF( GT_16( old_ind_list[i].nb_bits, -1 ) )
- {
- new_ind_list[i].id = old_ind_list[i].id;
- new_ind_list[i].value = old_ind_list[i].value;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 );
-#endif
- move16();
- move16();
- }
- new_ind_list[i].nb_bits = old_ind_list[i].nb_bits;
- move16();
- }
-
- /* reset nb_bits of all other indices to -1 */
- FOR( ; i < max_num_indices; i++ )
- {
- new_ind_list[i].nb_bits = -1;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- sprintf( new_ind_list[i].function_name, "RESET in ind_list_realloc" );
-#endif
- move16();
- }
-
- /* update parameters in all SCE elements */
- FOR( n = 0; n < st_ivas->nSCE; n++ )
- {
- /* get the pointer to hBstr */
- IF( is_metadata )
- {
- hBstr = st_ivas->hSCE[n]->hMetaData;
- }
- ELSE
- {
- hBstr = st_ivas->hSCE[n]->hCoreCoder[0]->hBstr;
- }
-
- IF( hBstr != NULL )
- {
- /* get the current position inside the old list */
- ind_list_pos = (Word16) ( hBstr->ind_list - old_ind_list );
-
- /* set pointers in the new list */
- *( hBstr->ivas_ind_list_zero ) = new_ind_list;
- hBstr->ind_list = &new_ind_list[ind_list_pos];
-
- /* set the new maximum number of indices */
- *( hBstr->ivas_max_num_indices ) = max_num_indices;
- move16();
- }
- }
-
- /* update parameters in all CPE elements */
- FOR( n = 0; n < st_ivas->nCPE; n++ )
- {
- /* get the pointer to hBstr */
- IF( is_metadata )
- {
- n_channels = 1;
- }
- ELSE
- {
- n_channels = CPE_CHANNELS;
- }
- move16();
-
- FOR( ch = 0; ch < n_channels; ch++ )
- {
- IF( is_metadata )
- {
- hBstr = st_ivas->hCPE[n]->hMetaData;
- }
- ELSE
- {
- hBstr = st_ivas->hCPE[n]->hCoreCoder[ch]->hBstr;
- }
-
- IF( hBstr != NULL )
- {
- /* get the current position inside the old list */
- ind_list_pos = (Word16) ( hBstr->ind_list - old_ind_list );
-
- /* set pointers in the new list */
- *( hBstr->ivas_ind_list_zero ) = new_ind_list;
- hBstr->ind_list = &new_ind_list[ind_list_pos];
-
- /* set the new maximum number of indices */
- *( hBstr->ivas_max_num_indices ) = max_num_indices;
- move16();
- }
- }
- }
-
- /* free the old list */
- free( old_ind_list );
-
- return IVAS_ERR_OK;
-}
-
-
-/*-----------------------------------------------------------------------*
- * get_ivas_max_num_indices()
- *
- * Get the maximum allowed number of indices in the encoder
- *-----------------------------------------------------------------------*/
-
-/*! r: maximum number of indices */
-Word16 get_ivas_max_num_indices_fx(
- const IVAS_FORMAT ivas_format, /* i : IVAS format */
- const Word32 ivas_total_brate /* i : IVAS total bitrate */
-)
-{
- test();
- test();
- IF( EQ_16( ivas_format, STEREO_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 300;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
- {
- return 400;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 450;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 650;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
- {
- return 750;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
- {
- return 850;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 950;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 1350;
- }
- ELSE
- {
- return 1650;
- }
- }
- ELSE IF( EQ_16( ivas_format, ISM_FORMAT ) || EQ_16( ivas_format, MONO_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 250;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
- {
- return 350;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 450;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 550;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_64k ) )
- {
- return 620;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
- {
- return 670;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
- {
- return 780;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
- {
- return 880;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 950;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 1100;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 1300;
- }
- ELSE
- {
- return 1650;
- }
- }
- ELSE IF( EQ_16( ivas_format, SBA_FORMAT ) || EQ_16( ivas_format, SBA_ISM_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 250;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
- {
- return 350;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 400;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 650;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
- {
- return 750;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
- {
- return 1020;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
- {
- return 1160;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 1220;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 1300;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 1720;
- }
- ELSE
- {
- return 2000;
- }
- }
- ELSE IF( EQ_16( ivas_format, MASA_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 300;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 400;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 650;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
- {
- return 750;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
- {
- return 850;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 950;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 1150;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 1450;
- }
- ELSE
- {
- return 1650;
- }
- }
- ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 300;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 400;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 650;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
- {
- return 750;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
- {
- return 1150;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 1250;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 1400;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 1650;
- }
- ELSE
- {
- return 1850;
- }
- }
- ELSE IF( EQ_16( ivas_format, MC_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 250;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
- {
- return 350;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 400;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 650;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_64k ) )
- {
- return 750;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
- {
- return 850;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
- {
- return 1150;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
- {
- return 1420;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 2120;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 2250;
- }
- ELSE
- {
- return 2450;
- }
- }
-
- return 2450;
-}
-/*-----------------------------------------------------------------------*
- * get_BWE_max_num_indices()
- *
- * Get the maximum number of indices in the BWE
- *-----------------------------------------------------------------------*/
-
-/*! r: maximum number of indices */
-Word16 get_BWE_max_num_indices(
- const Word32 extl_brate /* i : extensiona layer bitrate */
-)
-{
- /* set the maximum number of indices in the BWE */
- if ( extl_brate < SWB_BWE_16k )
- {
- return 30;
- }
- else
- {
- return 150;
- }
-}
-
-
-/*-----------------------------------------------------------------------*
- * get_ivas_max_num_indices_metadata()
- *
- * Set the maximum allowed number of metadata indices in the list
- *-----------------------------------------------------------------------*/
-
-/*! r: maximum number of indices */
-Word16 get_ivas_max_num_indices_metadata_fx(
- const IVAS_FORMAT ivas_format, /* i : IVAS format */
- const Word32 ivas_total_brate /* i : IVAS total bitrate */
-)
-{
- /* set the maximum required number of metadata indices */
- test();
- IF( EQ_16( ivas_format, MONO_FORMAT ) )
- {
- return 0;
- }
- ELSE IF( EQ_16( ivas_format, STEREO_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 60;
- }
- ELSE
- {
- return 80;
- }
- }
- ELSE IF( EQ_16( ivas_format, ISM_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 20;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 65;
- }
- ELSE
- {
- return 80;
- }
- }
- ELSE IF( EQ_16( ivas_format, SBA_FORMAT ) || EQ_16( ivas_format, SBA_ISM_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 100;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
- {
- return 200;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 300;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 500;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 1050;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 2000;
- }
- ELSE
- {
- return 2500;
- }
- }
- ELSE IF( EQ_16( ivas_format, MASA_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 80;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 125;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 205;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
- {
- return 240;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
- {
- return 305;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
- {
- return 425;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 630;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 850;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 1000;
- }
- ELSE
- {
- return 1750;
- }
- }
- ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
- {
- return 80;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
- {
- return 125 + 100;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
- {
- return 205 + 100;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
- {
- return 240 + 150;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
- {
- return 305 + 30;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
- {
- return 425 + 30;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
- {
- return 630 + 30;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
- {
- return 850 + 30;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
- {
- return 1000 + 30;
- }
- ELSE
- {
- return 1750 + 30;
- }
- }
- ELSE IF( EQ_16( ivas_format, MC_FORMAT ) )
- {
- IF( LE_32( ivas_total_brate, IVAS_13k2 ) )
- {
- return 80;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
- {
- return 100;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_64k ) )
- {
- return 210;
- }
- ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
- {
- return 220;
- }
- ELSE
- {
- return 300;
- }
- }
-
- return 50;
-}
-/*-------------------------------------------------------------------*
- * move_indices()
- *
- * Move indices inside the buffer or among two buffers
- *-------------------------------------------------------------------*/
-
-void move_indices(
- INDICE_HANDLE old_ind_list, /* i/o: old location of indices */
- INDICE_HANDLE new_ind_list, /* i/o: new location of indices */
- const Word16 nb_indices /* i : number of moved indices */
-)
-{
- Word16 i;
-
- if ( new_ind_list < old_ind_list )
- {
- for ( i = 0; i < nb_indices; i++ )
- {
- new_ind_list[i].id = old_ind_list[i].id;
- new_ind_list[i].value = old_ind_list[i].value;
- new_ind_list[i].nb_bits = old_ind_list[i].nb_bits;
-
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 );
-#endif
- old_ind_list[i].nb_bits = -1;
- }
- }
- else if ( new_ind_list > old_ind_list )
- {
- for ( i = nb_indices - 1; i >= 0; i-- )
- {
- new_ind_list[i].id = old_ind_list[i].id;
- new_ind_list[i].value = old_ind_list[i].value;
- new_ind_list[i].nb_bits = old_ind_list[i].nb_bits;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 );
-#endif
-
- old_ind_list[i].nb_bits = -1;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- sprintf( old_ind_list[i].function_name, "RESET in move_indices" );
-#endif
- }
- }
-
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * check_ind_list_limits()
- *
- * Check, if the maximum number of indices has been reached -> reallocate
- * Check, if we will not overwrite an existing indice -> adjust the location
- *-------------------------------------------------------------------*/
-
-ivas_error check_ind_list_limits(
- BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
-)
-{
- Indice *ivas_ind_list_zero, *ivas_ind_list_last;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
- ivas_ind_list_zero = *( hBstr->ivas_ind_list_zero );
-
- /* check, if the maximum number of indices has been reached and re-allocate the buffer */
- /* the re-allocation can be avoided by increasing the limits in get_ivas_max_num_indices() or get_ivas_max_num_indices_metadata() */
- IF( GE_16( (Word16) ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ), *( hBstr->ivas_max_num_indices ) ) )
- {
-
- /* reallocate the buffer of indices with increased limit */
- IF( NE_32( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
-
- /* check, if we will not overwrite an existing indice */
- IF( hBstr->ind_list[hBstr->nb_ind_tot].nb_bits > 0 )
- {
- IF( hBstr->nb_ind_tot == 0 )
- {
- /* move the pointer to the next available empty slot */
- ivas_ind_list_last = &ivas_ind_list_zero[*( hBstr->ivas_max_num_indices )];
- WHILE( hBstr->ind_list[0].nb_bits > 0 && hBstr->ind_list < ivas_ind_list_last )
- {
- hBstr->ind_list++;
- }
-
- IF( hBstr->ind_list >= ivas_ind_list_last )
- {
-
- /* no available empty slot -> need to re-allocate the buffer */
- IF( NE_32( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
- }
- ELSE
- {
-#ifdef DEBUGGING
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted in frame %d! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", frame, hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits );
-#else
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits );
-#endif
- }
- }
-
- return error;
-}
-
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
-const char *named_indices_table[] = {
- "IND_IVAS_FORMAT",
- "IND_SMODE_OMASA",
- "IND_SMODE",
- "IND_SID_TYPE",
- "IND_BWIDTH",
- "IND_CORE",
- "IND_PPP_NELP_MODE",
- "IND_ACELP_16KHZ",
- "IND_ACELP_SIGNALLING",
- "IND_SHARP_FLAG",
- "IND_MDCT_CORE",
- "IND_TCX_CORE",
- "IND_BWE_FLAG",
- "IND_HQ_SWITCHING_FLG",
- "IND_LAST_L_FRAME",
- "IND_VAD_FLAG",
- "IND_HQ_BWIDTH",
- "IND_TC_SUBFR",
- "IND_TC_SUBFR",
- "IND_TC_SUBFR",
- "IND_TC_SUBFR",
- "IND_GSC_IVAS_SP",
- "IND_LSF_PREDICTOR_SELECT_BIT",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_LSF",
- "IND_MID_FRAME_LSF_INDEX",
- "IND_ISF_0_0",
- "IND_ISF_0_1",
- "IND_ISF_0_2",
- "IND_ISF_0_3",
- "IND_ISF_0_4",
- "IND_ISF_1_0",
- "IND_ISF_1_1",
- "IND_ISF_1_2",
- "IND_ISF_1_3",
- "IND_ISF_1_4",
- "IND_IC_LSF_PRED",
- "IND_GSC_ATTACK",
- "IND_GSC_SWB_SPEECH",
- "IND_NOISE_LEVEL",
- "IND_HF_NOISE",
- "IND_PIT_CONTR_IDX",
- "IND_FEC_CLAS",
- "IND_FEC_ENR",
- "IND_FEC_POS",
- "IND_ES_PRED",
- "IND_HARM_FLAG_ACELP",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "IND_ALG_CDBK_4T64_2_24KBIT",
- "TAG_ALG_CDBK_4T64_24KBIT_END",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "IND_HF_GAIN_MODIFICATION",
- "TAG_ACELP_SUBFR_LOOP_END",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_MEAN_GAIN2",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_TMP",
- "IND_Y_GAIN_HF",
- "IND_HQ_VOICING_FLAG",
- "IND_HQ_SWB_CLAS",
- "IND_NF_IDX",
- "IND_LC_MODE",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_YNRM",
- "IND_SWB_FENV_HQ",
- "IND_SWB_FENV_HQ",
- "IND_SWB_FENV_HQ",
- "IND_SWB_FENV_HQ",
- "IND_SWB_FENV_HQ",
- "IND_FB_FENV_HQ",
- "IND_FB_FENV_HQ",
- "IND_FB_FENV_HQ",
- "IND_FB_FENV_HQ",
- "IND_FB_FENV_HQ",
- "IND_DELTA_ENV_HQ",
- "IND_HVQ_BWE_NL",
- "IND_HVQ_BWE_NL",
- "IND_NUM_PEAKS",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_POS_IDX",
- "IND_FLAGN",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_PG_IDX",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_PEAKS",
- "IND_HVQ_NF_GAIN",
- "IND_HVQ_NF_GAIN",
- "IND_HQ2_SWB_CLAS",
- "IND_HQ2_DENG_MODE",
- "IND_HQ2_DENG_8SMODE",
- "IND_HQ2_DENG_8SMODE_N0",
- "IND_HQ2_DENG_8SMODE_N1",
- "IND_HQ2_DENG_8SPOS",
- "IND_HQ2_DENG_8SDEPTH",
- "IND_HQ2_DENG_HMODE",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_DIFF_ENERGY",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_P2A_FLAGS",
- "IND_HQ2_LAST_BA_MAX_BAND",
- "IND_HQ2_LAST_BA_MAX_BAND",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_START",
- "IND_RC_END",
- "IND_HVQ_PVQ_GAIN",
- "IND_HVQ_PVQ_GAIN",
- "IND_HVQ_PVQ_GAIN",
- "IND_HVQ_PVQ_GAIN",
- "IND_HVQ_PVQ_GAIN",
- "IND_HVQ_PVQ_GAIN",
- "IND_HVQ_PVQ_GAIN",
- "IND_HVQ_PVQ_GAIN",
- "IND_NOISINESS",
- "IND_ENERGY",
- "IND_CNG_HO",
- "IND_SID_BW",
- "IND_CNG_ENV1",
- "IND_WB_FENV",
- "IND_WB_CLASS",
- "IND_IG1",
- "IND_IG2A",
- "IND_IG2B",
- "IND_NELP_FID",
- "IND_DELTALAG",
- "IND_POWER",
- "IND_AMP0",
- "IND_AMP1",
- "IND_GLOBAL_ALIGNMENT",
- "IND_PVQ_FINE_GAIN",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_UV_FLAG",
- "IND_SHB_SUBGAIN",
- "IND_SHB_FRAMEGAIN",
- "IND_STEREO_ICBWE_MSFLAG",
- "IND_SHB_ENER_SF",
- "IND_SHB_RES_GS",
- "IND_SHB_RES_GS",
- "IND_SHB_RES_GS",
- "IND_SHB_RES_GS",
- "IND_SHB_RES_GS",
- "IND_SHB_VF",
- "IND_SHB_LSF",
- "IND_SHB_LSF",
- "IND_SHB_LSF",
- "IND_SHB_LSF",
- "IND_SHB_LSF",
- "IND_SHB_MIRROR",
- "IND_SHB_GRID",
- "IND_SWB_CLASS",
- "IND_SWB_TENV",
- "IND_SWB_TENV",
- "IND_SWB_TENV",
- "IND_SWB_TENV",
- "IND_SWB_FENV",
- "IND_SWB_FENV",
- "IND_SWB_FENV",
- "IND_SWB_FENV",
- "IND_SHB_CNG_GAIN",
- "IND_DITHERING",
- "IND_FB_SLOPE",
- "IND_HQ2_SPT_SHORTEN",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_TCQ",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_SUBBAND_GAIN",
- "IND_HQ2_DUMMY",
- "IND_LAGINDICES",
- "IND_NOISEG",
- "IND_AUDIO_GAIN",
- "IND_AUDIO_DELAY",
- "IND_AUDIO_DELAY",
- "IND_AUDIO_DELAY",
- "IND_AUDIO_DELAY",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "IND_NQ2",
- "TAG_HR_BWE_LOOP_END",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_CELP_SUBFRAME",
- "IND_CORE_SWITCHING_AUDIO_DELAY",
- "IND_CORE_SWITCHING_AUDIO_GAIN",
- "IND_STEREO_ICBWE_REF",
- "IND_STEREO_ICBWE_SP",
- "IND_STEREO_ICBWE_GS",
- "IND_STEREO_REFCHAN",
- "IND_STEREO_CORRSTATS",
- "IND_STEREO_GD",
- "IND_STEREO_LRTD_FLAG",
- "IND_STEREO_LPC_REUSE",
- "IND_STEREO_TD_ALPHA",
- "IND_STEREO_2ND_CODER_T",
- "IND_UNUSED"
-};
-#endif
-
-
-/*-------------------------------------------------------------------*
- * push_indice()
- *
- * Push a new indice into the buffer
- *-------------------------------------------------------------------*/
-
-ivas_error push_indice(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 id, /* i : ID of the indice */
- UWord16 value, /* i : value of the quantized indice */
- Word16 nb_bits /* i : number of bits used to quantize the indice */
-)
-{
- Word16 i;
- Word16 j;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
- /* check the limits of the list of indices */
- IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
- {
-#ifdef DEBUGGING
- return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices (frame %d) !\n", frame );
-#else
- return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices!\n" );
-#endif
- }
-
- /* find the location in the list of indices based on ID */
- i = hBstr->nb_ind_tot;
- move16();
- test();
- WHILE( i > 0 && ( id < hBstr->ind_list[i - 1].id ) )
- {
- test();
- i = sub( i, 1 );
- }
-
- /* shift indices, if the new ID is to be written somewhere inside the list */
- IF( i < hBstr->nb_ind_tot )
- {
- FOR( j = hBstr->nb_ind_tot; j > i; j-- )
- {
- hBstr->ind_list[j].id = hBstr->ind_list[j - 1].id;
- hBstr->ind_list[j].nb_bits = hBstr->ind_list[j - 1].nb_bits;
- hBstr->ind_list[j].value = hBstr->ind_list[j - 1].value;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( hBstr->ind_list[j].function_name, hBstr->ind_list[j - 1].function_name, 100 );
-#endif
- move16();
- move16();
- move16();
- }
- }
-
-
- /* store the new indice in the list */
- hBstr->ind_list[i].id = id;
- hBstr->ind_list[i].value = value;
- hBstr->ind_list[i].nb_bits = nb_bits;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( hBstr->ind_list[i].function_name, named_indices_table[id], 100 );
-#endif
- move16();
- move16();
- move16();
-
- /* updates */
- hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
- hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits );
- move16();
- move16();
-
- return error;
-}
-
-/*-------------------------------------------------------------------*
- * push_next_indice()
- *
- * Push a new indice into the buffer at the next position
- *-------------------------------------------------------------------*/
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
-ivas_error push_next_indice_(
- const char *caller,
-#else
-ivas_error push_next_indice(
-#endif
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- UWord16 value, /* i : value of the quantized indice */
- Word16 nb_bits /* i : number of bits used to quantize the indice */
-)
-{
- Word16 prev_id;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
-
- /* check the limits of the list of indices */
- IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
-
- /* get the id of the previous indice -> it will be re-used */
- IF( hBstr->nb_ind_tot > 0 )
- {
- prev_id = hBstr->ind_list[hBstr->nb_ind_tot - 1].id;
- }
- ELSE
- {
- prev_id = 0;
- }
- move16();
-
- /* store the values in the list */
- hBstr->ind_list[hBstr->nb_ind_tot].id = prev_id;
- hBstr->ind_list[hBstr->nb_ind_tot].value = value;
- hBstr->ind_list[hBstr->nb_ind_tot].nb_bits = nb_bits;
- move16();
- move16();
- move16();
-
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( hBstr->ind_list[hBstr->nb_ind_tot].function_name, caller, 100 );
-#endif
-
- /* updates */
- hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
- hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits );
- move16();
- move16();
-
- return error;
-}
-
-/*-------------------------------------------------------------------*
- * push_next_bits()
- * Push a bit buffer into the buffer at the next position
- *-------------------------------------------------------------------*/
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
-ivas_error push_next_bits_(
- const char *caller,
-#else
-ivas_error push_next_bits(
-#endif
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const UWord16 bits[], /* i : bit buffer to pack, sequence of single bits */
- const Word16 nb_bits /* i : number of bits to pack */
-)
-{
- UWord16 code;
- Word16 i, nb_bits_m15;
- Indice *ptr;
- Word16 prev_id;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
- ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
-
- /* get the id of the previous indice -> will be re-used */
- IF( hBstr->nb_ind_tot > 0 )
- {
- prev_id = hBstr->ind_list[hBstr->nb_ind_tot - 1].id;
- move16();
- }
- ELSE
- {
- prev_id = 0;
- move16();
- }
- nb_bits_m15 = sub( nb_bits, 15 );
-
- FOR( i = 0; i < nb_bits_m15; i += 16 )
- {
- code = (UWord16) L_or( L_shl( bits[i], 15 ), L_or( L_shl( bits[i + 1], 14 ), L_or( L_shl( bits[i + 2], 13 ), L_or( L_shl( bits[i + 3], 12 ), L_or( L_shl( bits[i + 4], 11 ), L_or( L_shl( bits[i + 5], 10 ), L_or( L_shl( bits[i + 6], 9 ), L_or( L_shl( bits[i + 7], 8 ), L_or( L_shl( bits[i + 8], 7 ), L_or( L_shl( bits[i + 9], 6 ), L_or( L_shl( bits[i + 10], 5 ), L_or( L_shl( bits[i + 11], 4 ), L_or( L_shl( bits[i + 12], 3 ), L_or( L_shl( bits[i + 13], 2 ), L_or( L_shl( bits[i + 14], 1 ), bits[i + 15] ) ) ) ) ) ) ) ) ) ) ) ) ) ) );
-
- /* check the limits of the list of indices */
- IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
- {
-#ifdef DEBUGGING
- return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
-#else
- return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" );
-#endif
- }
- ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
-
- ptr->value = code;
- ptr->nb_bits = 16;
- ptr->id = prev_id;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( ptr->function_name, caller, 100 );
-#endif
- hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
- move16();
- move16();
- move16();
- move16();
-
- ++ptr;
- }
-
- FOR( ; i < nb_bits; ++i )
- {
- /* check the limits of the list of indices */
- IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
- {
-#ifdef DEBUGGING
- return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
-#else
- return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" );
-#endif
- }
- ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
-
- ptr->value = bits[i];
- ptr->nb_bits = 1;
- ptr->id = prev_id;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( ptr->function_name, caller, 100 );
-#endif
- hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
- move16();
- move16();
- move16();
- move16();
-
- ++ptr;
- }
-
- hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits );
- move16();
-
- return error;
-}
-
-/*-------------------------------------------------------------------*
- * find_indice()
- *
- * Find indice based on its id
- *-------------------------------------------------------------------*/
-
-/*! r: result: index of the indice in the list, -1 if not found */
-Word16 find_indice(
- BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */
- const Word16 id, /* i : ID of the indice */
- UWord16 *value, /* o : value of the quantized indice */
- Word16 *nb_bits /* o : number of bits used to quantize the indice */
-)
-{
- Word16 i;
-
- for ( i = 0; i < hBstr->nb_ind_tot; i++ )
- {
- if ( hBstr->ind_list[i].id == id && hBstr->ind_list[i].nb_bits > 0 )
- {
- *value = hBstr->ind_list[i].value;
- *nb_bits = hBstr->ind_list[i].nb_bits;
- return i;
- }
- }
-
- return -1;
-}
-
-
-/*-------------------------------------------------------------------*
- * delete_indice()
- *
- * Delete indice based on its id (note, that nb_ind_tot and nb_bits_tot are updated)
- *-------------------------------------------------------------------*/
-
-/*! r: number of deleted indices */
-UWord16 delete_indice(
- BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */
- const Word16 id /* i : ID of the indice */
-)
-{
- Word16 i, j;
-
- j = 0;
- for ( i = 0; i < hBstr->nb_ind_tot; i++ )
- {
- if ( hBstr->ind_list[i].id == id )
- {
- hBstr->nb_bits_tot -= hBstr->ind_list[i].nb_bits;
- continue;
- }
-
- if ( j < i )
- {
- /* shift the indice left */
- hBstr->ind_list[j].id = hBstr->ind_list[i].id;
- hBstr->ind_list[j].value = hBstr->ind_list[i].value;
- hBstr->ind_list[j].nb_bits = hBstr->ind_list[i].nb_bits;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- strncpy( hBstr->ind_list[j].function_name, hBstr->ind_list[i].function_name, 100 );
-#endif
- }
-
- j++;
- }
-
- hBstr->nb_ind_tot = j;
-
- for ( ; j < i; j++ )
- {
- /* reset the shifted indices at the end of the list */
- hBstr->ind_list[j].nb_bits = -1;
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- sprintf( hBstr->ind_list[j].function_name, "RESET in delete_indice" );
-#endif
- }
-
- return i - j;
-}
-
-
-/*-------------------------------------------------------------------*
- * get_next_indice()
- *
- * Get the next indice from the buffer
- *-------------------------------------------------------------------*/
-
-/*! r: value of the indice */
-UWord16 get_next_indice(
- Decoder_State *st, /* i/o: decoder state structure */
- Word16 nb_bits /* i : number of bits that were used to quantize the indice */
-)
-{
- UWord16 value;
- Word16 i;
- Word32 nbits_total;
-
- assert( nb_bits <= 16 );
-
- nbits_total = st->total_brate / FRAMES_PER_SEC;
- /* detect corrupted bitstream */
- if ( st->next_bit_pos + nb_bits > nbits_total )
- {
- st->BER_detect = 1;
- return ( 0 );
- }
-
- value = 0;
- for ( i = 0; i < nb_bits; i++ )
- {
- value <<= 1;
- value += st->bit_stream[st->next_bit_pos + i];
- }
-
- /* update the position in the bitstream */
- st->next_bit_pos += nb_bits;
-
- return value;
-}
-
-/*-------------------------------------------------------------------*
- * get_next_indice_tmp()
- *
- * update the total number of bits and the position in the bitstream
- *-------------------------------------------------------------------*/
-
-void get_next_indice_tmp(
- Decoder_State *st, /* o : decoder state structure */
- Word16 nb_bits /* i : number of bits that were used to quantize the indice */
-)
-{
- /* update the position in the bitstream */
- st->next_bit_pos += nb_bits;
-
- return;
-}
-
-/*-------------------------------------------------------------------*
- * get_indice()
- *
- * Get indice at specific position in the buffer
- *-------------------------------------------------------------------*/
-
-/*! r: value of the indice */
-UWord16 get_indice(
- Decoder_State *st, /* i/o: decoder state structure */
- Word16 pos, /* i : absolute position in the bitstream (update after the read) */
- Word16 nb_bits /* i : number of bits that were used to quantize the indice */
-)
-{
- UWord16 value;
- Word16 i;
- Word32 nbits_total;
-
- assert( nb_bits <= 16 );
-
- nbits_total = st->total_brate / FRAMES_PER_SEC;
-
- /* detect corrupted bitstream */
- if ( pos + nb_bits > nbits_total )
- {
- st->BER_detect = 1;
- return ( 0 );
- }
-
- value = 0;
- for ( i = 0; i < nb_bits; i++ )
- {
- value <<= 1;
- value += st->bit_stream[pos + i];
- }
- return value;
-}
-
-/*-------------------------------------------------------------------*
- * get_indice_st()
- *
- * Get indice at specific position in the buffer
- *-------------------------------------------------------------------*/
-
-/*! r: value of the indice */
-UWord16 get_indice_st(
- Decoder_State *st, /* i/o: decoder state structure */
- const Word32 element_brate, /* i : element bitrate */
- const Word16 pos, /* i : absolute position in the bitstream */
- const Word16 nb_bits /* i : number of bits to quantize the indice */
-)
-{
- UWord16 value;
- Word16 i;
-
- assert( nb_bits <= 16 );
-
- /* detect corrupted bitstream */
- IF( GT_32( L_deposit_l( add( pos, nb_bits ) ), Mpy_32_32( element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ) )
- {
- st->BER_detect = 1;
- move16();
- return ( 0 );
- }
-
- value = 0;
- move16();
- FOR( i = 0; i < nb_bits; i++ )
- {
- value = shl( value, 1 );
- value = add( value, st->bit_stream[pos + i] );
- }
-
- return value;
-}
-#define WMC_TOOL_SKIP
-
-/*-------------------------------------------------------------------*
- * reset_indices_dec()
- *
- * Reset the buffer of decoder indices
- *-------------------------------------------------------------------*/
-void reset_indices_dec(
- Decoder_State *st )
-{
- st->next_bit_pos = 0;
- move16();
-
- return;
-}
-/*-------------------------------------------------------------------*
- * write_indices_to_stream()
- *
- * writing forward or backward to a serial stream
- *-------------------------------------------------------------------*/
-static Word16 write_indices_to_stream_fx(
- Indice *ind_list,
- UWord16 **pt_stream,
- const Word16 inc,
- const Word16 num_indices )
-{
- Word16 i, k;
- Word16 value, nb_bits;
- UWord16 mask;
-
- FOR( i = 0; i < num_indices; i++ )
- {
- value = ind_list[i].value;
- nb_bits = ind_list[i].nb_bits;
- move16();
- move16();
-
- IF( nb_bits > 0 )
- {
- /* mask from MSB to LSB */
- mask = (UWord16) L_shl( 1, sub( nb_bits, 1 ) );
-
- /* write bit by bit */
- FOR( k = 0; k < nb_bits; k++ )
- {
- IF( L_and( value, mask ) )
- {
- **pt_stream = 1;
- move16();
- *pt_stream += inc;
- }
- ELSE
- {
- **pt_stream = 0;
- move16();
- *pt_stream += inc;
- }
-
- mask = (UWord16) L_shr( mask, 1 );
- }
- }
- }
- return 0;
-}
-
-/*-------------------------------------------------------------------*
- * write_indices_element()
- *
- * Bitstream writing function of one element (one SCE or one CPE)
- *-------------------------------------------------------------------*/
-static ivas_error write_indices_element_fx(
- Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
- UWord16 **pt_stream, /* i : pointer to bitstream buffer */
- const Word16 is_SCE, /* i : flag to distingusih SCE and CPE */
- const Word16 element_id /* i : id of the SCE or CPE */
-)
-{
- Word16 ch;
- Encoder_State **sts = NULL;
- UWord16 *pt_stream_loc;
- UWord16 *pt_stream_backup;
- UWord16 *pt_stream_end;
- Word16 nb_bits_tot_metadata;
- Word16 nb_ind_tot_metadata;
-
- Indice *ind_list_metadata;
- Word16 n, n_channels;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
- ind_list_metadata = NULL;
- nb_ind_tot_metadata = 0;
- move16();
-
- IF( EQ_32( st_ivas->hEncoderConfig->ivas_format, MONO_FORMAT ) )
- {
- sts = st_ivas->hSCE[0]->hCoreCoder;
- nb_bits_tot_metadata = 0;
- move16();
- }
- ELSE
- {
- nb_bits_tot_metadata = 0;
- move16();
- test();
- test();
- IF( is_SCE && st_ivas->hSCE[element_id] != NULL )
- {
- sts = st_ivas->hSCE[element_id]->hCoreCoder;
-
- IF( st_ivas->hSCE[element_id]->hMetaData != NULL )
- {
- nb_bits_tot_metadata = st_ivas->hSCE[element_id]->hMetaData->nb_bits_tot;
- ind_list_metadata = st_ivas->hSCE[element_id]->hMetaData->ind_list;
- nb_ind_tot_metadata = st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot;
- move16();
- move16();
- }
- }
- ELSE IF( !is_SCE && st_ivas->hCPE[element_id] != NULL )
- {
- sts = st_ivas->hCPE[element_id]->hCoreCoder;
-
- IF( st_ivas->hCPE[element_id]->hMetaData != NULL )
- {
- nb_bits_tot_metadata = st_ivas->hCPE[element_id]->hMetaData->nb_bits_tot;
- ind_list_metadata = st_ivas->hCPE[element_id]->hMetaData->ind_list;
- nb_ind_tot_metadata = st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot;
- move16();
- move16();
- }
- }
- }
-
- n_channels = 1;
- move16();
- if ( GT_16( sts[0]->element_mode, IVAS_CPE_DFT ) )
- {
- n_channels = CPE_CHANNELS;
- move16();
- }
-
- /*----------------------------------------------------------------*
- * Bitstream packing (conversion of individual indices into a serial stream)
- *----------------------------------------------------------------*/
-
- pt_stream_loc = *pt_stream;
- pt_stream_end = pt_stream_loc;
-
- FOR( n = 0; n < n_channels; n++ )
- {
- /* write the metadata buffer */
- test();
- IF( n == 0 && nb_bits_tot_metadata != 0 )
- {
- pt_stream_backup = pt_stream_loc;
-
- FOR( ch = 0; ch < n_channels; ch++ )
- {
- pt_stream_loc += sts[ch]->hBstr->nb_bits_tot;
- }
- pt_stream_loc += nb_bits_tot_metadata - 1;
- pt_stream_end = pt_stream_loc + 1;
-
- write_indices_to_stream_fx( ind_list_metadata, &pt_stream_loc, -1,
- nb_ind_tot_metadata );
-
- /* restore previous pointer position */
- pt_stream_loc = pt_stream_backup;
- }
- write_indices_to_stream_fx( sts[n]->hBstr->ind_list, &pt_stream_loc, 1,
- sts[n]->hBstr->nb_ind_tot );
-
- if ( pt_stream_loc > pt_stream_end )
- {
- pt_stream_end = pt_stream_loc;
- }
- }
-
-#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
- if ( is_SCE ) /* EVS and SCE */
- {
- static FILE *f1 = 0;
-
- if ( f1 == 0 )
- f1 = fopen( "bitstream_text", "w" );
-
- for ( int16_t i = 0; i < sts[0]->hBstr->nb_ind_tot; i++ )
- {
- Indice *ind_list = sts[0]->hBstr->ind_list;
- int16_t value = ind_list[i].value;
- int16_t nb_bits = ind_list[i].nb_bits;
- char *function_name = ind_list[i].function_name;
-
- fprintf( f1, "%d %d %d %s %d %d\n", frame, element_id, i, function_name, nb_bits, value );
- }
-
- if ( st_ivas->hSCE[element_id]->hMetaData != NULL )
- {
- for ( int16_t i = 0; i < st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot; i++ )
- {
- Indice *ind_list = st_ivas->hSCE[element_id]->hMetaData->ind_list;
- int16_t value = ind_list[i].value;
- int16_t nb_bits = ind_list[i].nb_bits;
- char *function_name = ind_list[i].function_name;
-
- fprintf( f1, "%d %d %d %s %d %d\n", frame, element_id, i, function_name, nb_bits, value );
- }
- }
- }
- else
- {
- static FILE *f1 = 0;
-
- if ( f1 == 0 )
- f1 = fopen( "bitstream_text", "w" );
-
-
- for ( n = 0; n < n_channels; n++ )
- {
- for ( int16_t i = 0; i < sts[n]->hBstr->nb_ind_tot; i++ )
- {
- Indice *ind_list = sts[n]->hBstr->ind_list;
- int16_t value = ind_list[i].value;
- int16_t nb_bits = ind_list[i].nb_bits;
- char *function_name = ind_list[i].function_name;
-
- fprintf( f1, "%d %d %d %d %s %d %d\n", frame, element_id, n, i, function_name, nb_bits, value );
- }
- }
-
- if ( st_ivas->hCPE[element_id]->hMetaData != NULL )
- {
- for ( int16_t i = 0; i < st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot; i++ )
- {
- Indice *ind_list = st_ivas->hCPE[element_id]->hMetaData->ind_list;
- int16_t value = ind_list[i].value;
- int16_t nb_bits = ind_list[i].nb_bits;
- char *function_name = ind_list[i].function_name;
-
- fprintf( f1, "%d %d %d %d %s %d %d\n", frame, element_id, -1, i, function_name, nb_bits, value );
- }
- }
- }
-#endif
-
- /*----------------------------------------------------------------*
- * Clearing of indices
- * Reset index pointers
- *----------------------------------------------------------------*/
-
- IF( is_SCE ) /* EVS and SCE */
- {
- IF( st_ivas->hSCE[element_id]->hMetaData != NULL )
- {
- reset_indices_enc_fx( st_ivas->hSCE[element_id]->hMetaData, st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot );
- }
-
- reset_indices_enc_fx( sts[0]->hBstr, sts[0]->hBstr->nb_ind_tot );
- }
- ELSE
- {
- IF( st_ivas->hCPE[element_id]->hMetaData != NULL )
- {
- reset_indices_enc_fx( st_ivas->hCPE[element_id]->hMetaData, st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot );
- }
-
- FOR( n = 0; n < n_channels; n++ )
- {
- reset_indices_enc_fx( sts[n]->hBstr, sts[n]->hBstr->nb_ind_tot );
- }
- }
-
- /* update pointer */
- *pt_stream = pt_stream_end;
-
- return error;
-}
-
-/*-------------------------------------------------------------------*
- * write_indices_ivas()
- *
- * Write the buffer of indices to a serial bitstream buffer,
- * each bit represented as a uint16_t of value 0 or 1
- *-------------------------------------------------------------------*/
-ivas_error write_indices_ivas_fx(
- Encoder_Struct *st_ivas, /* i/o: encoder state structure */
- UWord16 *bit_stream, /* i/o: output bitstream */
- UWord16 *num_bits /* i : number of indices written to output */
-)
-{
- Word16 i, n;
- UWord16 *pt_stream;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
- pt_stream = bit_stream;
- FOR( i = 0; i < MAX_BITS_PER_FRAME; ++i )
- {
- bit_stream[i] = 0;
- move16();
- }
-
-
- /*-----------------------------------------------------------------*
- * Encode Payload
- *-----------------------------------------------------------------*/
-
- FOR( n = 0; n < st_ivas->nSCE; n++ )
- {
- write_indices_element_fx( st_ivas, &pt_stream, 1, n );
- }
-
- FOR( n = 0; n < st_ivas->nCPE; n++ )
- {
- write_indices_element_fx( st_ivas, &pt_stream, 0, n );
- }
-
- *num_bits = (UWord16) ( pt_stream - bit_stream );
- move16();
-
- return error;
-}
-
-/*-------------------------------------------------------------------*
- * decoder_selectCodec()
- *
- *
- *-------------------------------------------------------------------*/
-
-static void decoder_selectCodec(
- Decoder_State *st, /* i/o: decoder state structure */
- const Word32 total_brate, /* i : total bitrate */
- const Word16 bit0 /* i : first bit */
-)
-{
- /* set the AMR-WB IO flag */
- if ( rate2AMRWB_IOmode( total_brate ) != -1 )
- {
- st->Opt_AMR_WB = 1;
- }
- else if ( total_brate != FRAME_NO_DATA )
- {
- st->Opt_AMR_WB = 0;
- }
-
- if ( st->Opt_AMR_WB )
- {
- st->codec_mode = MODE1;
- }
- else
- {
- st->codec_mode = get_codec_mode( total_brate );
-
- if ( st->codec_mode == -1 )
- {
- switch ( total_brate )
- {
- case 0:
- st->codec_mode = st->last_codec_mode;
- break;
- case 2400:
- st->codec_mode = st->last_codec_mode;
- break;
- case 2800:
- st->codec_mode = MODE1;
- break;
- default: /* validate that total_brate (derived from RTP packet or a file header) is one of the defined bitrates */
- st->codec_mode = st->last_codec_mode;
- st->bfi = 1;
- break;
- }
- }
- }
-
- if ( st->ini_frame == 0 )
- {
- if ( st->codec_mode == -1 )
- {
- st->codec_mode = MODE1;
- }
- st->last_codec_mode = st->codec_mode;
- }
-
- /* set SID/CNG type */
- if ( total_brate == SID_2k40 )
- {
- if ( bit0 == 0 )
- {
- st->cng_type = LP_CNG;
-
- /* force MODE1 when selecting LP_CNG */
- st->codec_mode = MODE1;
- }
- else if ( bit0 == 1 )
- {
- st->cng_type = FD_CNG;
- if ( st->last_codec_mode == MODE2 && st->last_total_brate == ACELP_13k20 )
- {
- st->codec_mode = MODE1;
- }
- }
- }
-
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * reset_elements()
- *
- * Simulate packet losses by reading FEC pattern from external file
- *-------------------------------------------------------------------*/
-
-Decoder_State **reset_elements(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
-)
-{
- Word16 k, n;
- Decoder_State **sts = NULL; /* to avoid compilation warning */
-
- FOR( k = 0; k < st_ivas->nSCE; k++ )
- {
- sts = st_ivas->hSCE[k]->hCoreCoder;
-
- sts[0]->bfi = 0;
- sts[0]->BER_detect = 0;
- sts[0]->mdct_sw_enable = 0;
- sts[0]->mdct_sw = 0;
-
- move16();
- move16();
- move16();
- move16();
-
- reset_indices_dec( sts[0] );
- }
-
- FOR( k = 0; k < st_ivas->nCPE; k++ )
- {
- sts = st_ivas->hCPE[k]->hCoreCoder;
-
- FOR( n = 0; n < CPE_CHANNELS; n++ )
- {
- sts[n]->bfi = 0;
- sts[n]->BER_detect = 0;
- sts[n]->mdct_sw_enable = 0;
- sts[n]->mdct_sw = 0;
-
- move16();
- move16();
- move16();
- move16();
-
- reset_indices_dec( sts[n] );
- }
- }
-
- return sts; /* return last decoder state */
-}
-
-/*-------------------------------------------------------------------*
- * ivas_set_bitstream_pointers()
- *
- * Set bitstream pointers for every SCE/CPE Core-Decoder
- *-------------------------------------------------------------------*/
-
-void ivas_set_bitstream_pointers(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
-)
-{
- Word16 k, num_bits;
- Decoder_State **sts;
-
- num_bits = 0;
-
- /* set bitstream pointers for SCEs */
- for ( k = 0; k < st_ivas->nSCE; k++ )
- {
- sts = st_ivas->hSCE[k]->hCoreCoder;
- sts[0]->bit_stream = st_ivas->bit_stream + num_bits;
- num_bits += (Word16) ( st_ivas->hSCE[k]->element_brate / FRAMES_PER_SEC );
- }
-
- /* set bitstream pointers for CPEs */
- for ( k = 0; k < st_ivas->nCPE; k++ )
- {
- sts = st_ivas->hCPE[k]->hCoreCoder;
- sts[0]->bit_stream = st_ivas->bit_stream + num_bits;
- num_bits += (Word16) ( st_ivas->hCPE[k]->element_brate / FRAMES_PER_SEC );
- }
-
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * read_indices()
- *
- * Read indices from an ITU-T G.192 bitstream to the buffer
- * Simulate packet losses by inserting frame erasures
- *-------------------------------------------------------------------*/
-
-/*! r: 1 = reading OK, 0 = problem */
-ivas_error read_indices_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- UWord16 bit_stream[], /* i : bitstream buffer */
- UWord16 num_bits, /* i : number of bits in bitstream */
- Word16 *prev_ft_speech,
- Word16 *CNG,
- Word16 bfi /* i : bad frame indicator */
-)
-{
- Word16 k;
- Decoder_State **sts;
- Word32 total_brate = 0;
- move32();
- Word16 curr_ft_good_sp, curr_ft_bad_sp;
- Word16 g192_sid_first, sid_upd_bad, sid_update;
- Word16 speech_bad, speech_lost;
- Word16 n;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
- st_ivas->BER_detect = 0;
- move16();
- st_ivas->num_bits = num_bits;
- move16();
- sts = reset_elements( st_ivas );
-
- st_ivas->bfi = bfi;
- move16();
-
- /* convert the frame length to total bitrate */
- total_brate = imult3216( num_bits, FRAMES_PER_SEC );
- move32();
-
- /* verify that a valid num bits value is present in the G.192 file */
- /* only AMRWB, EVS or IVAS bitrates or 0(NO DATA) are allowed in G.192 file frame reading */
- IF( NE_32( st_ivas->ivas_format, MONO_FORMAT ) )
- {
- k = 0;
- move16();
-
- test();
- WHILE( LT_16( k, SIZE_IVAS_BRATE_TBL ) && NE_32( total_brate, ivas_brate_tbl[k] ) )
- {
- k = add( k, 1 );
- }
-
- test();
- test();
- test();
- test();
- IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) && ( LT_16( k, SIZE_IVAS_BRATE_TBL ) || LE_32( total_brate, SID_2k40 ) ) )
- {
- st_ivas->element_mode_init = IVAS_SCE;
- move16();
- }
- ELSE IF( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) && LE_32( total_brate, SID_2k40 ) )
- {
- st_ivas->element_mode_init = IVAS_SCE;
- move16();
- }
- ELSE IF( EQ_16( k, SIZE_IVAS_BRATE_TBL ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate );
- }
- ELSE
- {
- st_ivas->element_mode_init = -1;
- move16();
- }
- }
- ELSE /* AMRWB or EVS */
- {
- st_ivas->element_mode_init = EVS_MONO;
- move16();
-
- IF( rate2EVSmode_float( total_brate, NULL ) < 0 ) /* negative value means that a valid rate was not found */
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate );
- }
- }
-
- /* G.192 RX DTX handler*/
- /* handle SID_FIRST, SID_BAD, SPEECH_LOST, NO_DATA as properly as possible for the ITU-T G.192 format */
- /* (total_brate, bfi , st_CNG) = rx_handler(received frame type, [previous frame type], past CNG state, past core) */
- curr_ft_good_sp = 0;
- move16();
- curr_ft_bad_sp = 0;
- move16();
-
- IF( is_DTXrate( total_brate ) == 0 )
- {
- IF( st_ivas->bfi == 0 )
- {
- curr_ft_good_sp = 1;
- move16();
- }
- ELSE
- {
- curr_ft_bad_sp = 1;
- move16();
- }
- }
-
- sid_update = 0;
- move16();
- sid_upd_bad = 0;
- move16();
- IF( EQ_16( is_SIDrate( total_brate ), 1 ) )
- {
- IF( st_ivas->bfi == 0 )
- {
- sid_update = 1;
- move16();
- }
- ELSE
- {
- sid_upd_bad = 1; /* this frame type may happen in ETSI/3GPP CS cases, a corrupt SID frames */
- move16();
- }
- }
-
- /* all zero indices/bits iSP AMRWB SID_update results in a valid LP filter with extremely high LP-filter-gain */
- /* all zero indices/bits may be a result of CS bit errors and/or erroneously injected by gateways or by a bad dejitter handlers */
- test();
- IF( EQ_32( total_brate, SID_1k75 ) && EQ_16( sid_update, 1 ) )
- {
- /* valid sid_update received, check for very risky but formally valid content */
- Word16 sum = 0;
- move16();
- FOR( k = 0; k < num_bits; ++k )
- {
- sum = add( sum, extract_l( EQ_32( bit_stream[k], 1 ) ) ); /* check of 35 zeroes */
- }
- if ( sum == 0 )
- { /* all zeros */
- sid_upd_bad = 1; /* initial signal as corrupt (BER likely) */
- move16();
- }
- }
-
- /* AMRWB 26.173 G.192 file reader (read_serial) does not declare/use SID_BAD ft,
- it declares every bad synch marked frame initially as a lost_speech frame,
- and then the RXDTX handler CNG state decides the decoding mode CNG/SPEECH.
- While In the AMRWB ETSI/3GPP format eid a CRC error in a detected SID_UPDATE frames triggers SID_BAD.
-
- Here we inhibit use of the SID-length info, even though it is available in the G.192 file format after STL/EID-XOR .
- */
- IF( sid_upd_bad )
- {
- sid_upd_bad = 0;
- move16();
- total_brate = FRAME_NO_DATA; /* treat SID_BAD as a stolen signaling frame --> SPEECH LOST */
- move32();
- }
-
- g192_sid_first = 0;
- move16();
-
- test();
- test();
- test();
- test();
- if ( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) && EQ_16( sts[0]->core, AMR_WB_CORE ) && *prev_ft_speech && total_brate == FRAME_NO_DATA && st_ivas->bfi == 0 )
- {
- g192_sid_first = 1; /* SID_FIRST detected for previous AMRWB/AMRWBIO active frames only */
- /* It is not possible to perfectly simulate rate switching conditions EVS->AMRWBIO where:
- the very first SID_FIRST detection is based on a past EVS active frame
- and a good length 0 "SID_FIRST"(NO_DATA) frame is sent in AMRWBIO,
- due to the one frame state memory in the AMRWB legacy G.192 SID_FIRST encoding
- */
- move16();
- }
-
- speech_bad = 0;
- move16();
-
- test();
- if ( st_ivas->bfi != 0 && ( is_DTXrate( total_brate ) == 0 ) )
- {
- speech_bad = 1; /* initial ft assumption, CNG_state decides what to do */
- move16();
- }
-
- speech_lost = 0;
- move16();
-
- test();
- if ( total_brate == FRAME_NO_DATA && st_ivas->bfi != 0 ) /* unsent NO_DATA or stolen NO_DATA/signaling frame */
- {
- speech_lost = 1; /* initial ft assumption, CNG_state decides what to do */
- move16();
- }
-
- /* Do not allow decoder to enter CNG-synthesis for any instantly received GOOD+LENGTH==0 frame
- as this frame was never transmitted, one can not know it is good and has a a length of zero ) */
- IF( *CNG != 0 )
- {
- /* We were in CNG synthesis */
- if ( curr_ft_good_sp != 0 )
- {
- /* only a good speech frame makes you leave CNG synthesis */
- *CNG = 0;
- move16();
- }
- }
- ELSE
- {
- /* We were in SPEECH synthesis */
- /* only a received/detected SID frame can make the decoder enter into CNG synthsis */
- test();
- test();
- if ( g192_sid_first || sid_update || sid_upd_bad )
- {
- *CNG = 1;
- move16();
- }
- }
-
- /* set bfi, total_brate pair for proper decoding */
- /* handle the G.192 _simulated_ untransmitted NO_DATA frame, setting for decoder SPEECH synthesis */
- test();
- test();
- if ( *CNG == 0 && total_brate == FRAME_NO_DATA && st_ivas->bfi == 0 )
- {
- st_ivas->bfi = 1; /* SPEECH PLC code will now become active as in a real system */
- /* total_brate= 0 */
- move16();
- }
-
- /* handle bad/lost speech frame(and CS bad SID frame) in the decoders CNG synthesis settings pair (total_brate, bfi) */
- test();
- test();
- test();
- test();
- IF( (
- NE_16( bfi, FRAMEMODE_FUTURE ) &&
- ( *CNG != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST) --> stay in CNG */
- ( sid_upd_bad != 0 ) ) /* SID_UPD_BAD --> start CNG */
- {
- st_ivas->bfi = 0; /* bfi=0 needed to activate CNG code */
- move16();
- total_brate = FRAME_NO_DATA;
- move32();
- }
-
- /* update for next frame's G.192 file format's odd SID_FIRST detection (primarily for AMRWBIO) */
- test();
- *prev_ft_speech = ( ( curr_ft_good_sp != 0 ) || ( curr_ft_bad_sp != 0 ) );
- move16();
-
- /* st->total brate= total_brate; updated in a good frame below */
-
- FOR( k = 0; k < st_ivas->nCPE; k++ )
- {
- sts = st_ivas->hCPE[k]->hCoreCoder;
- FOR( n = 0; n < CPE_CHANNELS; n++ )
- {
- sts[n]->bfi = st_ivas->bfi;
- move16();
- }
- }
-
- FOR( k = 0; k < st_ivas->nSCE; k++ )
- {
- sts = st_ivas->hSCE[k]->hCoreCoder;
- sts[0]->bfi = st_ivas->bfi;
- move16();
- }
-
- IF( st_ivas->bfi == 0 )
- {
- /* select Mode 1 or Mode 2 */
- IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) /* EVS mono */
- {
- decoder_selectCodec( sts[0], total_brate, bit_stream[0] );
- st_ivas->hDecoderConfig->Opt_AMR_WB = sts[0]->Opt_AMR_WB;
- move16();
- }
- ELSE /* IVAS */
- {
- st_ivas->codec_mode = MODE1;
- move16();
- st_ivas->hDecoderConfig->Opt_AMR_WB = 0;
- move16();
- }
- }
-
- /* GOOD frame */
- test();
- if ( st_ivas->bfi == 0 || EQ_16( st_ivas->bfi, FRAMEMODE_FUTURE ) )
- {
- /* GOOD frame - convert ITU-T G.192 words to short values */
- st_ivas->hDecoderConfig->ivas_total_brate = total_brate;
- move32();
- }
-
- st_ivas->bit_stream = bit_stream;
-
- IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) )
- {
- ivas_set_bitstream_pointers( st_ivas );
- }
-
- return error;
-}
-#undef WMC_TOOL_SKIP
diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c
index ce8d9018e020c3f0aa0e9864fbe5092c9d0caee1..b1c7a2efd07b91b3507671caf6a2b54ed18c92af 100644
--- a/lib_com/bitstream_fx.c
+++ b/lib_com/bitstream_fx.c
@@ -31,114 +31,180 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
#include
-#include
+#include
#include "options.h"
-#include "ivas_cnst.h" /* Common constants */
-#include "prot_fx.h" /* Function prototypes */
-#include "ivas_prot_fx.h"
-#include "basop_util.h"
+#include "cnst.h"
+#include "prot_fx.h"
+#include "stat_enc.h"
+#include "stat_dec.h"
#include "rom_com.h"
#include "mime.h"
+#include "ivas_cnst.h"
+#include "ivas_rom_com.h"
+#include "wmc_auto.h"
+#include "ivas_prot_fx.h"
+#include "prot_fx_enc.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#ifdef DBG_BITSTREAM_ANALYSIS
+#include
+#endif
+#endif
#ifdef DEBUGGING
+
+#define FEC_SEED 12558
+
/*-------------------------------------------------------------------*
* Global variables
*--------------------------------------------------------------------*/
-int16_t FEC_seed = 12558; /* Seed for random FEC generator */
FILE *FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */
-float FEC_random = 0; /* FEC rate in percent (for simulation of FEC) */
+#endif
+
+#define STEP_MAX_NUM_INDICES 100 /* increase the maximum number of allowed indices in the list by this amount */
+
/*-------------------------------------------------------------------*
- * file_read_FECpattern()
+ * BRATE2IDX_fx()
*
- * Simulate packet losses by reading FEC pattern from external file
+ * Convert Bitrate to Index Value
*-------------------------------------------------------------------*/
-static int16_t file_read_FECpattern( void )
+Word16 BRATE2IDX_fx(
+ const Word32 brate )
{
- int16_t bfi = 0;
- /* FEC pattern file provided */
- if ( FEC_pattern != NULL )
- {
- int16_t tmp = 0;
- if ( fread( &tmp, sizeof( int16_t ), 1, FEC_pattern ) != 1 )
- {
- if ( feof( FEC_pattern ) != 0 )
- {
- tmp = 0;
- fseek( FEC_pattern, 0L, SEEK_SET );
- }
- else
- {
- fprintf( stderr, "\nError reading the FEC pattern file !" );
- exit( -1 );
- }
- }
-
- if ( tmp == 2609 || tmp == 1 || tmp == SYNC_BAD_FRAME )
- {
- bfi = 1;
- }
- else
- {
- bfi = 0;
- }
- }
+ Word32 L_temp;
+ Word32 L_idx;
+#define START 9
+ extern const Word16 bit_rates_div50[];
- /* random FEC simulation requested */
- else if ( FEC_random > 0 )
- {
- float ftmp = (float) /*own_random*/ Random( &FEC_seed ) + 32768.0f;
- if ( ftmp <= FEC_random / 100.0f * 65535.0f )
- {
- bfi = 1;
- }
- else
- {
- bfi = 0;
- }
- }
+ /* This is a Fast Bit Rate Value to Index Value Binary Search */
+ L_temp = L_msu0( brate, bit_rates_div50[START], 50 );
+ L_temp = L_min( 6, L_max( -6, L_temp ) );
+ L_idx = L_add( L_temp, START );
+ L_temp = L_msu0( brate, bit_rates_div50[L_idx], 50 );
+ L_temp = L_min( 3, L_max( -3, L_temp ) );
+ L_idx = L_add( L_temp, L_idx );
+ L_temp = L_msu0( brate, bit_rates_div50[L_idx], 50 );
+ L_temp = L_min( 1, L_max( -2, L_temp ) );
+ L_idx = L_add( L_temp, L_idx );
+ L_temp = L_msu0( brate, bit_rates_div50[L_idx], 50 );
+ if ( L_temp != 0 )
+ L_idx = L_add( L_idx, 1 );
- return bfi;
+ return (Word16) L_idx;
}
-#endif
+
+
/*-------------------------------------------------------------------*
- * pack_bit()
+ * BRATE2IDX16k_fx()
*
- * insert a bit into packed octet
+ * Convert Bitrate to Index Value
*-------------------------------------------------------------------*/
-void pack_bit(
- const Word16 bit, /* i: bit to be packed */
- UWord8 **pt, /* i/o: pointer to octet array into which bit will be placed */
- UWord8 *omask /* i/o: output mask to indicate where in the octet the bit is to be written */
-)
+
+Word16 BRATE2IDX16k_fx(
+ Word32 brate )
{
- if ( EQ_16( *omask, 0x80 ) )
- {
- **pt = 0;
- move16();
- }
- IF( bit != 0 )
+ Word32 L_temp, L_idx;
+#define START_16K 5
+ extern const Word16 bit_rates_16k_div50[];
+
+ if ( EQ_32( brate, ACELP_16k40 ) )
{
- **pt = (UWord8) s_or( **pt, *omask );
+ brate = ACELP_14k80;
move16();
}
- *omask = (UWord8) shr( *omask, 1 );
+
+ /* This is a Fast Bit Rate Value to Index Value Binary Search */
+ L_temp = L_msu0( brate, bit_rates_16k_div50[START_16K], 50 );
+ L_temp = L_min( 3, L_max( -3, L_temp ) );
+ L_idx = L_add( L_temp, START_16K );
+ L_temp = L_msu0( brate, bit_rates_16k_div50[L_idx], 50 );
+ L_temp = L_min( 2, L_max( -2, L_temp ) );
+ L_idx = L_add( L_temp, L_idx );
+ L_temp = L_msu0( brate, bit_rates_16k_div50[L_idx], 50 );
+ L_temp = L_min( 1, L_max( -1, L_temp ) );
+ L_idx = L_add( L_temp, L_idx );
+
+ return (Word16) L_idx;
+}
+
+
+/*-------------------------------------------------------------------*
+ * BIT_ALLOC_IDX_fx()
+ *-------------------------------------------------------------------*/
+
+Word32 BIT_ALLOC_IDX_fx(
+ const Word32 brate,
+ Word16 ctype,
+ const Word16 sfrm,
+ const Word16 tc )
+{
+ Word32 L_temp;
+ Word16 temp;
+
+ if ( ctype == INACTIVE ) /* no sub(ctype, INACTIVE) because it is '0' */
+ ctype = GENERIC;
move16();
- IF( *omask == 0 )
+ L_temp = L_mac0( -1l * 256, 1 * 256, ctype );
+
+ temp = BRATE2IDX_fx( brate );
+ L_temp = L_mac0( L_temp, 4 * 256, temp );
+ IF( tc >= 0 )
+ L_temp = L_mac0( L_temp, ( 10 - 4 ) * 256, temp );
+ /* So either 'temp' x 4 when 'tc < 0', 'temp' x 10 otherwise */
+
+ L_temp = L_mac0( L_temp, 1 * 256, s_max( 0, tc ) );
+
+ L_temp = L_mac0( L_temp, s_max( 0, sfrm ), 1 );
+ if ( sfrm < 0 )
+ L_temp = L_shr( L_temp, 2 );
+ L_temp = L_shr( L_temp, 6 );
+
+ return L_temp;
+}
+
+
+/*-------------------------------------------------------------------*
+ * BIT_ALLOC_IDX_16KHZ_fx()
+ *-------------------------------------------------------------------*/
+
+Word32 BIT_ALLOC_IDX_16KHZ_fx(
+ const Word32 brate,
+ const Word16 ctype,
+ const Word16 sfrm,
+ const Word16 tc )
+{
+ Word32 L_temp;
+ Word16 temp;
+ /* 'ctype' =
+ TRANSITION => 2
+ GENERIC => 1
+ ALL Other => 0
+ */
+ L_temp = L_and( shr( 0x0240l, shl( ctype, 1 ) ), 3 );
+
+ temp = BRATE2IDX16k_fx( brate );
+ L_temp = L_mac0( L_temp, 3, temp );
+ IF( tc >= 0 )
+ L_temp = L_mac0( L_temp, ( 7 - 3 ), temp );
+ /* So either 'temp' x 3 when 'tc < 0', 'temp' x 7 otherwise */
+
+ L_temp = L_mac0( L_temp, 1, s_max( 0, tc ) );
+
+ IF( sfrm >= 0 )
{
- *omask = 0x80;
- move16();
- ( *pt )++;
+ /* Mult by 5 */
+ L_temp = L_add( L_temp, L_shl( L_temp, 2 ) );
+ L_temp = L_mac0( L_temp, shr( sfrm, 6 ), 1 );
}
- return;
+ return L_temp;
}
@@ -147,13 +213,14 @@ void pack_bit(
*
* lookup AMRWB IO mode
*-------------------------------------------------------------------*/
+
static Word16 rate2AMRWB_IOmode(
- Word32 brate /* i: bitrate */
+ Word32 brate /* i : bitrate */
)
{
SWITCH( brate )
{
- /* EVS AMR-WB IO modes */
+ /* EVS AMR-WB IO modes */
case SID_1k75:
return AMRWB_IO_SID;
case ACELP_6k60:
@@ -177,16 +244,19 @@ static Word16 rate2AMRWB_IOmode(
default:
break;
}
+
return -1;
}
+
/*-------------------------------------------------------------------*
* rate2EVSmode()
*
* lookup EVS mode
*-------------------------------------------------------------------*/
+
Word16 rate2EVSmode(
- const Word32 brate, /* i: bitrate */
+ const Word32 brate, /* i : bitrate */
Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
)
{
@@ -195,9 +265,10 @@ Word16 rate2EVSmode(
*is_amr_wb = 0;
move16();
}
+
SWITCH( brate )
{
- /* EVS Primary modes */
+ /* EVS Primary modes */
case FRAME_NO_DATA:
return NO_DATA_TYPE;
case SID_2k40:
@@ -227,157 +298,3655 @@ Word16 rate2EVSmode(
case HQ_128k:
return PRIMARY_128000;
default:
- BREAK;
+ break;
}
+
if ( is_amr_wb != NULL )
{
*is_amr_wb = 1;
move16();
}
+
return rate2AMRWB_IOmode( brate );
}
-/*-------------------------------------------------------------------*
- * push_indice( )
- *
- * Push a new indice into the buffer
- *-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*
- * get_next_indice_fx( )
+ * ind_list_realloc()
*
- * Get the next indice from the buffer
+ * Re-allocate the list of indices
*-------------------------------------------------------------------*/
-UWord16 get_next_indice_fx( /* o : value of the indice */
- Decoder_State *st_fx, /* i/o: decoder state structure */
- Word16 nb_bits /* i : number of bits that were used to quantize the indice */
+ivas_error ind_list_realloc(
+ INDICE_HANDLE old_ind_list, /* i : pointer to the beginning of the old buffer of indices */
+ const Word16 max_num_indices, /* i : new maximum number of allowed indices in the list */
+ Encoder_Struct *st_ivas /* i : IVAS encoder structure */
)
{
- UWord16 value;
- Word16 i;
- Word16 nbits_total;
+ Word16 i, n, ch, n_channels, ind_list_pos, is_metadata, ivas_max_num_indices;
+ INDICE_HANDLE new_ind_list;
+ BSTR_ENC_HANDLE hBstr;
- assert( nb_bits <= 16 );
- value = 0;
+ IF( st_ivas == NULL )
+ {
+ return IVAS_ERR_OK;
+ }
+
+ /* get the pointer to the beginning of the old buffer of indices (either metadata or core coders) */
+ IF( old_ind_list == st_ivas->ind_list_metadata )
+ {
+ is_metadata = 1;
+ ivas_max_num_indices = st_ivas->ivas_max_num_indices_metadata;
+ }
+ ELSE
+ {
+ is_metadata = 0;
+ ivas_max_num_indices = st_ivas->ivas_max_num_indices;
+ }
+ move16();
move16();
- nbits_total = extract_l( Mpy_32_32( st_fx->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
- /* detect corrupted bitstream */
- IF( GT_16( add( st_fx->next_bit_pos, nb_bits ), nbits_total ) )
+ /* allocate new buffer of indices */
+ IF( ( new_ind_list = (INDICE_HANDLE) malloc( max_num_indices * sizeof( Indice ) ) ) == NULL )
{
- st_fx->BER_detect = 1;
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for buffer of indices!\n" ) );
+ }
+
+ /* move indices from the old list to the new list */
+ FOR( i = 0; i < s_min( max_num_indices, ivas_max_num_indices ); i++ )
+ {
+ IF( GT_16( old_ind_list[i].nb_bits, -1 ) )
+ {
+ new_ind_list[i].id = old_ind_list[i].id;
+ new_ind_list[i].value = old_ind_list[i].value;
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 );
+#endif
+ move16();
+ move16();
+ }
+ new_ind_list[i].nb_bits = old_ind_list[i].nb_bits;
move16();
- return ( 0 );
}
- FOR( i = 0; i < nb_bits; i++ )
+ /* reset nb_bits of all other indices to -1 */
+ FOR( ; i < max_num_indices; i++ )
{
- value = (UWord16) L_shl( value, 1 );
- value = (UWord16) L_add( value, st_fx->bit_stream[add( st_fx->next_bit_pos, i )] );
+ new_ind_list[i].nb_bits = -1;
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ sprintf( new_ind_list[i].function_name, "RESET in ind_list_realloc" );
+#endif
+ move16();
}
- /* update the position in the bitstream */
- st_fx->next_bit_pos = add( st_fx->next_bit_pos, nb_bits );
- move16();
- return value;
-}
+ /* update parameters in all SCE elements */
+ FOR( n = 0; n < st_ivas->nSCE; n++ )
+ {
+ /* get the pointer to hBstr */
+ IF( is_metadata )
+ {
+ hBstr = st_ivas->hSCE[n]->hMetaData;
+ }
+ ELSE
+ {
+ hBstr = st_ivas->hSCE[n]->hCoreCoder[0]->hBstr;
+ }
-/*-------------------------------------------------------------------*
- * get_next_indice_1_fx( )
- *
- * Get the next 1-bit indice from the buffer
- *-------------------------------------------------------------------*/
+ IF( hBstr != NULL )
+ {
+ /* get the current position inside the old list */
+ ind_list_pos = (Word16) ( hBstr->ind_list - old_ind_list );
-UWord16 get_next_indice_1_fx( /* o : value of the indice */
- Decoder_State *st_fx /* i/o: decoder state structure */
-)
-{
- Word16 nbits_total;
- nbits_total = extract_l( Mpy_32_32( st_fx->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
- /* detect corrupted bitstream */
- test();
- test();
- test();
- IF( ( GT_16( add( st_fx->next_bit_pos, 1 ), nbits_total ) && EQ_16( st_fx->codec_mode, MODE1 ) ) ||
- ( GT_16( add( st_fx->next_bit_pos, 1 ), add( nbits_total, 2 * 8 ) ) && EQ_16( st_fx->codec_mode, MODE2 ) ) /* add two zero bytes for arithmetic coder flush */
- )
+ /* set pointers in the new list */
+ *( hBstr->ivas_ind_list_zero ) = new_ind_list;
+ hBstr->ind_list = &new_ind_list[ind_list_pos];
+
+ /* set the new maximum number of indices */
+ *( hBstr->ivas_max_num_indices ) = max_num_indices;
+ move16();
+ }
+ }
+
+ /* update parameters in all CPE elements */
+ FOR( n = 0; n < st_ivas->nCPE; n++ )
{
- st_fx->BER_detect = 1;
+ /* get the pointer to hBstr */
+ IF( is_metadata )
+ {
+ n_channels = 1;
+ }
+ ELSE
+ {
+ n_channels = CPE_CHANNELS;
+ }
move16();
- return ( 0 );
+
+ FOR( ch = 0; ch < n_channels; ch++ )
+ {
+ IF( is_metadata )
+ {
+ hBstr = st_ivas->hCPE[n]->hMetaData;
+ }
+ ELSE
+ {
+ hBstr = st_ivas->hCPE[n]->hCoreCoder[ch]->hBstr;
+ }
+
+ IF( hBstr != NULL )
+ {
+ /* get the current position inside the old list */
+ ind_list_pos = (Word16) ( hBstr->ind_list - old_ind_list );
+
+ /* set pointers in the new list */
+ *( hBstr->ivas_ind_list_zero ) = new_ind_list;
+ hBstr->ind_list = &new_ind_list[ind_list_pos];
+
+ /* set the new maximum number of indices */
+ *( hBstr->ivas_max_num_indices ) = max_num_indices;
+ move16();
+ }
+ }
}
- return st_fx->bit_stream[st_fx->next_bit_pos++];
+ /* free the old list */
+ free( old_ind_list );
+
+ return IVAS_ERR_OK;
}
-/*-------------------------------------------------------------------*
- * get_next_indice_tmp()
+
+/*-----------------------------------------------------------------------*
+ * get_ivas_max_num_indices()
*
- * update the total number of bits and the position in the bitstream
+ * Get the maximum allowed number of indices in the encoder
+ *-----------------------------------------------------------------------*/
+
+/*! r: maximum number of indices */
+Word16 get_ivas_max_num_indices_fx(
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ const Word32 ivas_total_brate /* i : IVAS total bitrate */
+)
+{
+ test();
+ test();
+ IF( EQ_16( ivas_format, STEREO_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 300;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
+ {
+ return 400;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 450;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 650;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
+ {
+ return 750;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
+ {
+ return 850;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 950;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 1350;
+ }
+ ELSE
+ {
+ return 1650;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, ISM_FORMAT ) || EQ_16( ivas_format, MONO_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 250;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
+ {
+ return 350;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 450;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 550;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_64k ) )
+ {
+ return 620;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
+ {
+ return 670;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
+ {
+ return 780;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
+ {
+ return 880;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 950;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 1100;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 1300;
+ }
+ ELSE
+ {
+ return 1650;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, SBA_FORMAT ) || EQ_16( ivas_format, SBA_ISM_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 250;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
+ {
+ return 350;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 400;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 650;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
+ {
+ return 750;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
+ {
+ return 1020;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
+ {
+ return 1160;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 1220;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 1300;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 1720;
+ }
+ ELSE
+ {
+ return 2000;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, MASA_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 300;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 400;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 650;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
+ {
+ return 750;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
+ {
+ return 850;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 950;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 1150;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 1450;
+ }
+ ELSE
+ {
+ return 1650;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 300;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 400;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 650;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
+ {
+ return 750;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
+ {
+ return 1150;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 1250;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 1400;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 1650;
+ }
+ ELSE
+ {
+ return 1850;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, MC_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 250;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
+ {
+ return 350;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 400;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 650;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_64k ) )
+ {
+ return 750;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_80k ) )
+ {
+ return 850;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
+ {
+ return 1150;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
+ {
+ return 1420;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 2120;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 2250;
+ }
+ ELSE
+ {
+ return 2450;
+ }
+ }
+
+ return 2450;
+}
+/*-----------------------------------------------------------------------*
+ * get_BWE_max_num_indices()
+ *
+ * Get the maximum number of indices in the BWE
+ *-----------------------------------------------------------------------*/
+
+/*! r: maximum number of indices */
+Word16 get_BWE_max_num_indices(
+ const Word32 extl_brate /* i : extensiona layer bitrate */
+)
+{
+ /* set the maximum number of indices in the BWE */
+ if ( extl_brate < SWB_BWE_16k )
+ {
+ return 30;
+ }
+ else
+ {
+ return 150;
+ }
+}
+
+
+/*-----------------------------------------------------------------------*
+ * get_ivas_max_num_indices_metadata()
+ *
+ * Set the maximum allowed number of metadata indices in the list
+ *-----------------------------------------------------------------------*/
+
+/*! r: maximum number of indices */
+Word16 get_ivas_max_num_indices_metadata_fx(
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ const Word32 ivas_total_brate /* i : IVAS total bitrate */
+)
+{
+ /* set the maximum required number of metadata indices */
+ test();
+ IF( EQ_16( ivas_format, MONO_FORMAT ) )
+ {
+ return 0;
+ }
+ ELSE IF( EQ_16( ivas_format, STEREO_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 60;
+ }
+ ELSE
+ {
+ return 80;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, ISM_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 20;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 65;
+ }
+ ELSE
+ {
+ return 80;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, SBA_FORMAT ) || EQ_16( ivas_format, SBA_ISM_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 100;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
+ {
+ return 200;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 300;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 500;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 1050;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 2000;
+ }
+ ELSE
+ {
+ return 2500;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, MASA_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 80;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 125;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 205;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
+ {
+ return 240;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
+ {
+ return 305;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
+ {
+ return 425;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 630;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 850;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 1000;
+ }
+ ELSE
+ {
+ return 1750;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_16k4 ) )
+ {
+ return 80;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_32k ) )
+ {
+ return 125 + 100;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_48k ) )
+ {
+ return 205 + 100;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
+ {
+ return 240 + 150;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_128k ) )
+ {
+ return 305 + 30;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_160k ) )
+ {
+ return 425 + 30;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_192k ) )
+ {
+ return 630 + 30;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_256k ) )
+ {
+ return 850 + 30;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_384k ) )
+ {
+ return 1000 + 30;
+ }
+ ELSE
+ {
+ return 1750 + 30;
+ }
+ }
+ ELSE IF( EQ_16( ivas_format, MC_FORMAT ) )
+ {
+ IF( LE_32( ivas_total_brate, IVAS_13k2 ) )
+ {
+ return 80;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
+ {
+ return 100;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_64k ) )
+ {
+ return 210;
+ }
+ ELSE IF( LE_32( ivas_total_brate, IVAS_96k ) )
+ {
+ return 220;
+ }
+ ELSE
+ {
+ return 300;
+ }
+ }
+
+ return 50;
+}
+
+
+/*-------------------------------------------------------------------*
+ * move_indices()
+ *
+ * Move indices inside the buffer or among two buffers
+ *-------------------------------------------------------------------*/
+
+void move_indices(
+ INDICE_HANDLE old_ind_list, /* i/o: old location of indices */
+ INDICE_HANDLE new_ind_list, /* i/o: new location of indices */
+ const Word16 nb_indices /* i : number of moved indices */
+)
+{
+ Word16 i;
+
+ IF( new_ind_list < old_ind_list )
+ {
+ FOR( i = 0; i < nb_indices; i++ )
+ {
+ new_ind_list[i].id = old_ind_list[i].id;
+ new_ind_list[i].value = old_ind_list[i].value;
+ new_ind_list[i].nb_bits = old_ind_list[i].nb_bits;
+ move16();
+ move16();
+ move16();
+
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 );
+#endif
+ old_ind_list[i].nb_bits = -1;
+ move16();
+ }
+ }
+ ELSE IF( new_ind_list > old_ind_list )
+ {
+ FOR( i = nb_indices - 1; i >= 0; i-- )
+ {
+ new_ind_list[i].id = old_ind_list[i].id;
+ new_ind_list[i].value = old_ind_list[i].value;
+ new_ind_list[i].nb_bits = old_ind_list[i].nb_bits;
+ move16();
+ move16();
+ move16();
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( new_ind_list[i].function_name, old_ind_list[i].function_name, 100 );
+#endif
+
+ old_ind_list[i].nb_bits = -1;
+ move16();
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ sprintf( old_ind_list[i].function_name, "RESET in move_indices" );
+#endif
+ }
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * check_ind_list_limits()
+ *
+ * Check, if the maximum number of indices has been reached -> reallocate
+ * Check, if we will not overwrite an existing indice -> adjust the location
+ *-------------------------------------------------------------------*/
+
+ivas_error check_ind_list_limits(
+ BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
+)
+{
+ Indice *ivas_ind_list_zero, *ivas_ind_list_last;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+ ivas_ind_list_zero = *( hBstr->ivas_ind_list_zero );
+
+ /* check, if the maximum number of indices has been reached and re-allocate the buffer */
+ /* the re-allocation can be avoided by increasing the limits in get_ivas_max_num_indices() or get_ivas_max_num_indices_metadata() */
+ IF( GE_16( (Word16) ( &hBstr->ind_list[hBstr->nb_ind_tot] - ivas_ind_list_zero ), *( hBstr->ivas_max_num_indices ) ) )
+ {
+
+ /* reallocate the buffer of indices with increased limit */
+ IF( NE_32( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+ }
+
+ /* check, if we will not overwrite an existing indice */
+ IF( hBstr->ind_list[hBstr->nb_ind_tot].nb_bits > 0 )
+ {
+ IF( hBstr->nb_ind_tot == 0 )
+ {
+ /* move the pointer to the next available empty slot */
+ ivas_ind_list_last = &ivas_ind_list_zero[*( hBstr->ivas_max_num_indices )];
+ WHILE( hBstr->ind_list[0].nb_bits > 0 && hBstr->ind_list < ivas_ind_list_last )
+ {
+ hBstr->ind_list++;
+ }
+
+ IF( hBstr->ind_list >= ivas_ind_list_last )
+ {
+
+ /* no available empty slot -> need to re-allocate the buffer */
+ IF( NE_32( ( error = ind_list_realloc( *hBstr->ivas_ind_list_zero, *( hBstr->ivas_max_num_indices ) + STEP_MAX_NUM_INDICES, hBstr->st_ivas ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+ }
+ }
+ ELSE
+ {
+#ifdef DEBUGGING
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted in frame %d! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", frame, hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits );
+#else
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Buffer of indices corrupted! Attempt to overwrite indice ID = %d (value: %d, bits: %d)!\n", hBstr->ind_list[hBstr->nb_ind_tot].id, hBstr->ind_list[hBstr->nb_ind_tot].value, hBstr->ind_list[hBstr->nb_ind_tot].nb_bits );
+#endif
+ }
+ }
+
+ return error;
+}
+
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+const char *named_indices_table[] = {
+ "IND_IVAS_FORMAT",
+ "IND_SMODE_OMASA",
+ "IND_SMODE",
+ "IND_SID_TYPE",
+ "IND_BWIDTH",
+ "IND_CORE",
+ "IND_PPP_NELP_MODE",
+ "IND_ACELP_16KHZ",
+ "IND_ACELP_SIGNALLING",
+ "IND_SHARP_FLAG",
+ "IND_MDCT_CORE",
+ "IND_TCX_CORE",
+ "IND_BWE_FLAG",
+ "IND_HQ_SWITCHING_FLG",
+ "IND_LAST_L_FRAME",
+ "IND_VAD_FLAG",
+ "IND_HQ_BWIDTH",
+ "IND_TC_SUBFR",
+ "IND_TC_SUBFR",
+ "IND_TC_SUBFR",
+ "IND_TC_SUBFR",
+ "IND_GSC_IVAS_SP",
+ "IND_LSF_PREDICTOR_SELECT_BIT",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_LSF",
+ "IND_MID_FRAME_LSF_INDEX",
+ "IND_ISF_0_0",
+ "IND_ISF_0_1",
+ "IND_ISF_0_2",
+ "IND_ISF_0_3",
+ "IND_ISF_0_4",
+ "IND_ISF_1_0",
+ "IND_ISF_1_1",
+ "IND_ISF_1_2",
+ "IND_ISF_1_3",
+ "IND_ISF_1_4",
+ "IND_IC_LSF_PRED",
+ "IND_GSC_ATTACK",
+ "IND_GSC_SWB_SPEECH",
+ "IND_NOISE_LEVEL",
+ "IND_HF_NOISE",
+ "IND_PIT_CONTR_IDX",
+ "IND_FEC_CLAS",
+ "IND_FEC_ENR",
+ "IND_FEC_POS",
+ "IND_ES_PRED",
+ "IND_HARM_FLAG_ACELP",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "IND_ALG_CDBK_4T64_2_24KBIT",
+ "TAG_ALG_CDBK_4T64_24KBIT_END",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "IND_HF_GAIN_MODIFICATION",
+ "TAG_ACELP_SUBFR_LOOP_END",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_MEAN_GAIN2",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_TMP",
+ "IND_Y_GAIN_HF",
+ "IND_HQ_VOICING_FLAG",
+ "IND_HQ_SWB_CLAS",
+ "IND_NF_IDX",
+ "IND_LC_MODE",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_YNRM",
+ "IND_SWB_FENV_HQ",
+ "IND_SWB_FENV_HQ",
+ "IND_SWB_FENV_HQ",
+ "IND_SWB_FENV_HQ",
+ "IND_SWB_FENV_HQ",
+ "IND_FB_FENV_HQ",
+ "IND_FB_FENV_HQ",
+ "IND_FB_FENV_HQ",
+ "IND_FB_FENV_HQ",
+ "IND_FB_FENV_HQ",
+ "IND_DELTA_ENV_HQ",
+ "IND_HVQ_BWE_NL",
+ "IND_HVQ_BWE_NL",
+ "IND_NUM_PEAKS",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_POS_IDX",
+ "IND_FLAGN",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_PG_IDX",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_PEAKS",
+ "IND_HVQ_NF_GAIN",
+ "IND_HVQ_NF_GAIN",
+ "IND_HQ2_SWB_CLAS",
+ "IND_HQ2_DENG_MODE",
+ "IND_HQ2_DENG_8SMODE",
+ "IND_HQ2_DENG_8SMODE_N0",
+ "IND_HQ2_DENG_8SMODE_N1",
+ "IND_HQ2_DENG_8SPOS",
+ "IND_HQ2_DENG_8SDEPTH",
+ "IND_HQ2_DENG_HMODE",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_DIFF_ENERGY",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_P2A_FLAGS",
+ "IND_HQ2_LAST_BA_MAX_BAND",
+ "IND_HQ2_LAST_BA_MAX_BAND",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_START",
+ "IND_RC_END",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_HVQ_PVQ_GAIN",
+ "IND_NOISINESS",
+ "IND_ENERGY",
+ "IND_CNG_HO",
+ "IND_SID_BW",
+ "IND_CNG_ENV1",
+ "IND_WB_FENV",
+ "IND_WB_CLASS",
+ "IND_IG1",
+ "IND_IG2A",
+ "IND_IG2B",
+ "IND_NELP_FID",
+ "IND_DELTALAG",
+ "IND_POWER",
+ "IND_AMP0",
+ "IND_AMP1",
+ "IND_GLOBAL_ALIGNMENT",
+ "IND_PVQ_FINE_GAIN",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_UV_FLAG",
+ "IND_SHB_SUBGAIN",
+ "IND_SHB_FRAMEGAIN",
+ "IND_STEREO_ICBWE_MSFLAG",
+ "IND_SHB_ENER_SF",
+ "IND_SHB_RES_GS",
+ "IND_SHB_RES_GS",
+ "IND_SHB_RES_GS",
+ "IND_SHB_RES_GS",
+ "IND_SHB_RES_GS",
+ "IND_SHB_VF",
+ "IND_SHB_LSF",
+ "IND_SHB_LSF",
+ "IND_SHB_LSF",
+ "IND_SHB_LSF",
+ "IND_SHB_LSF",
+ "IND_SHB_MIRROR",
+ "IND_SHB_GRID",
+ "IND_SWB_CLASS",
+ "IND_SWB_TENV",
+ "IND_SWB_TENV",
+ "IND_SWB_TENV",
+ "IND_SWB_TENV",
+ "IND_SWB_FENV",
+ "IND_SWB_FENV",
+ "IND_SWB_FENV",
+ "IND_SWB_FENV",
+ "IND_SHB_CNG_GAIN",
+ "IND_DITHERING",
+ "IND_FB_SLOPE",
+ "IND_HQ2_SPT_SHORTEN",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_TCQ",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_SUBBAND_GAIN",
+ "IND_HQ2_DUMMY",
+ "IND_LAGINDICES",
+ "IND_NOISEG",
+ "IND_AUDIO_GAIN",
+ "IND_AUDIO_DELAY",
+ "IND_AUDIO_DELAY",
+ "IND_AUDIO_DELAY",
+ "IND_AUDIO_DELAY",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "IND_NQ2",
+ "TAG_HR_BWE_LOOP_END",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_CELP_SUBFRAME",
+ "IND_CORE_SWITCHING_AUDIO_DELAY",
+ "IND_CORE_SWITCHING_AUDIO_GAIN",
+ "IND_STEREO_ICBWE_REF",
+ "IND_STEREO_ICBWE_SP",
+ "IND_STEREO_ICBWE_GS",
+ "IND_STEREO_REFCHAN",
+ "IND_STEREO_CORRSTATS",
+ "IND_STEREO_GD",
+ "IND_STEREO_LRTD_FLAG",
+ "IND_STEREO_LPC_REUSE",
+ "IND_STEREO_TD_ALPHA",
+ "IND_STEREO_2ND_CODER_T",
+ "IND_UNUSED"
+};
+#endif
+
+
+/*-------------------------------------------------------------------*
+ * push_indice()
+ *
+ * Push a new indice into the buffer
+ *-------------------------------------------------------------------*/
+
+ivas_error push_indice(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 id, /* i : ID of the indice */
+ UWord16 value, /* i : value of the quantized indice */
+ Word16 nb_bits /* i : number of bits used to quantize the indice */
+)
+{
+ Word16 i;
+ Word16 j;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+
+ /* check the limits of the list of indices */
+ IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
+ {
+#ifdef DEBUGGING
+ return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices (frame %d) !\n", frame );
+#else
+ return IVAS_ERROR( error, "Error occured in push_indice() while re-allocating the list of indices!\n" );
+#endif
+ }
+
+ /* find the location in the list of indices based on ID */
+ i = hBstr->nb_ind_tot;
+ move16();
+ test();
+ WHILE( i > 0 && ( id < hBstr->ind_list[i - 1].id ) )
+ {
+ test();
+ i = sub( i, 1 );
+ }
+
+ /* shift indices, if the new ID is to be written somewhere inside the list */
+ IF( i < hBstr->nb_ind_tot )
+ {
+ FOR( j = hBstr->nb_ind_tot; j > i; j-- )
+ {
+ hBstr->ind_list[j].id = hBstr->ind_list[j - 1].id;
+ hBstr->ind_list[j].nb_bits = hBstr->ind_list[j - 1].nb_bits;
+ hBstr->ind_list[j].value = hBstr->ind_list[j - 1].value;
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( hBstr->ind_list[j].function_name, hBstr->ind_list[j - 1].function_name, 100 );
+#endif
+ move16();
+ move16();
+ move16();
+ }
+ }
+
+
+ /* store the new indice in the list */
+ hBstr->ind_list[i].id = id;
+ hBstr->ind_list[i].value = value;
+ hBstr->ind_list[i].nb_bits = nb_bits;
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( hBstr->ind_list[i].function_name, named_indices_table[id], 100 );
+#endif
+ move16();
+ move16();
+ move16();
+
+ /* updates */
+ hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
+ hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits );
+ move16();
+ move16();
+
+ return error;
+}
+
+/*-------------------------------------------------------------------*
+ * push_next_indice()
+ *
+ * Push a new indice into the buffer at the next position
+ *-------------------------------------------------------------------*/
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ivas_error push_next_indice_(
+ const char *caller,
+#else
+ivas_error push_next_indice(
+#endif
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ UWord16 value, /* i : value of the quantized indice */
+ Word16 nb_bits /* i : number of bits used to quantize the indice */
+)
+{
+ Word16 prev_id;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+
+
+ /* check the limits of the list of indices */
+ IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+
+ /* get the id of the previous indice -> it will be re-used */
+ IF( hBstr->nb_ind_tot > 0 )
+ {
+ prev_id = hBstr->ind_list[hBstr->nb_ind_tot - 1].id;
+ }
+ ELSE
+ {
+ prev_id = 0;
+ }
+ move16();
+
+ /* store the values in the list */
+ hBstr->ind_list[hBstr->nb_ind_tot].id = prev_id;
+ hBstr->ind_list[hBstr->nb_ind_tot].value = value;
+ hBstr->ind_list[hBstr->nb_ind_tot].nb_bits = nb_bits;
+ move16();
+ move16();
+ move16();
+
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( hBstr->ind_list[hBstr->nb_ind_tot].function_name, caller, 100 );
+#endif
+
+ /* updates */
+ hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
+ hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits );
+ move16();
+ move16();
+
+ return error;
+}
+
+
+/*-------------------------------------------------------------------*
+ * push_next_bits()
+ * Push a bit buffer into the buffer at the next position
+ *-------------------------------------------------------------------*/
+
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ivas_error push_next_bits_(
+ const char *caller,
+#else
+ivas_error push_next_bits(
+#endif
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const UWord16 bits[], /* i : bit buffer to pack, sequence of single bits */
+ const Word16 nb_bits /* i : number of bits to pack */
+)
+{
+ UWord16 code;
+ Word16 i, nb_bits_m15;
+ Indice *ptr;
+ Word16 prev_id;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+
+ ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
+
+ /* get the id of the previous indice -> will be re-used */
+ IF( hBstr->nb_ind_tot > 0 )
+ {
+ prev_id = hBstr->ind_list[hBstr->nb_ind_tot - 1].id;
+ move16();
+ }
+ ELSE
+ {
+ prev_id = 0;
+ move16();
+ }
+ nb_bits_m15 = sub( nb_bits, 15 );
+
+ FOR( i = 0; i < nb_bits_m15; i += 16 )
+ {
+ code = (UWord16) L_or( L_shl( bits[i], 15 ), L_or( L_shl( bits[i + 1], 14 ), L_or( L_shl( bits[i + 2], 13 ), L_or( L_shl( bits[i + 3], 12 ), L_or( L_shl( bits[i + 4], 11 ), L_or( L_shl( bits[i + 5], 10 ), L_or( L_shl( bits[i + 6], 9 ), L_or( L_shl( bits[i + 7], 8 ), L_or( L_shl( bits[i + 8], 7 ), L_or( L_shl( bits[i + 9], 6 ), L_or( L_shl( bits[i + 10], 5 ), L_or( L_shl( bits[i + 11], 4 ), L_or( L_shl( bits[i + 12], 3 ), L_or( L_shl( bits[i + 13], 2 ), L_or( L_shl( bits[i + 14], 1 ), bits[i + 15] ) ) ) ) ) ) ) ) ) ) ) ) ) ) );
+
+ /* check the limits of the list of indices */
+ IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
+ {
+#ifdef DEBUGGING
+ return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
+#else
+ return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" );
+#endif
+ }
+ ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
+
+ ptr->value = code;
+ ptr->nb_bits = 16;
+ ptr->id = prev_id;
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( ptr->function_name, caller, 100 );
+#endif
+ hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
+ move16();
+ move16();
+ move16();
+ move16();
+
+ ++ptr;
+ }
+
+ FOR( ; i < nb_bits; ++i )
+ {
+ /* check the limits of the list of indices */
+ IF( NE_32( ( error = check_ind_list_limits( hBstr ) ), IVAS_ERR_OK ) )
+ {
+#ifdef DEBUGGING
+ return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices (frame %d) !\n", frame );
+#else
+ return IVAS_ERROR( error, "Error occured in push_next_bits() while re-allocating the list of indices!\n" );
+#endif
+ }
+ ptr = &hBstr->ind_list[hBstr->nb_ind_tot];
+
+ ptr->value = bits[i];
+ ptr->nb_bits = 1;
+ ptr->id = prev_id;
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( ptr->function_name, caller, 100 );
+#endif
+ hBstr->nb_ind_tot = add( hBstr->nb_ind_tot, 1 );
+ move16();
+ move16();
+ move16();
+ move16();
+
+ ++ptr;
+ }
+
+ hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits );
+ move16();
+
+ return error;
+}
+
+
+/*-------------------------------------------------------------------*
+ * find_indice()
+ *
+ * Find indice based on its id
+ *-------------------------------------------------------------------*/
+
+/*! r: result: index of the indice in the list, -1 if not found */
+Word16 find_indice(
+ BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */
+ const Word16 id, /* i : ID of the indice */
+ UWord16 *value, /* o : value of the quantized indice */
+ Word16 *nb_bits /* o : number of bits used to quantize the indice */
+)
+{
+ Word16 i;
+
+ for ( i = 0; i < hBstr->nb_ind_tot; i++ )
+ {
+ if ( hBstr->ind_list[i].id == id && hBstr->ind_list[i].nb_bits > 0 )
+ {
+ *value = hBstr->ind_list[i].value;
+ *nb_bits = hBstr->ind_list[i].nb_bits;
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------*
+ * delete_indice()
+ *
+ * Delete indice based on its id (note, that nb_ind_tot and nb_bits_tot are updated)
+ *-------------------------------------------------------------------*/
+
+/*! r: number of deleted indices */
+UWord16 delete_indice(
+ BSTR_ENC_HANDLE hBstr, /* i : encoder bitstream handle */
+ const Word16 id /* i : ID of the indice */
+)
+{
+ Word16 i, j;
+
+ j = 0;
+ FOR( i = 0; i < hBstr->nb_ind_tot; i++ )
+ {
+ IF( EQ_16( hBstr->ind_list[i].id, id ) )
+ {
+ hBstr->nb_bits_tot -= hBstr->ind_list[i].nb_bits;
+ move16();
+ continue;
+ }
+
+ IF( LT_16( j, i ) )
+ {
+ /* shift the indice left */
+ hBstr->ind_list[j].id = hBstr->ind_list[i].id;
+ hBstr->ind_list[j].value = hBstr->ind_list[i].value;
+ hBstr->ind_list[j].nb_bits = hBstr->ind_list[i].nb_bits;
+ move16();
+ move16();
+ move16();
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ strncpy( hBstr->ind_list[j].function_name, hBstr->ind_list[i].function_name, 100 );
+#endif
+ }
+
+ j++;
+ }
+
+ hBstr->nb_ind_tot = j;
+
+ FOR( ; j < i; j++ )
+ {
+ /* reset the shifted indices at the end of the list */
+ hBstr->ind_list[j].nb_bits = -1;
+ move16();
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ sprintf( hBstr->ind_list[j].function_name, "RESET in delete_indice" );
+#endif
+ }
+
+ return i - j;
+}
+
+
+/*-------------------------------------------------------------------*
+ * get_next_indice()
+ *
+ * Get the next indice from the buffer
+ *-------------------------------------------------------------------*/
+
+/*! r: value of the indice */
+UWord16 get_next_indice_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ Word16 nb_bits /* i : number of bits that were used to quantize the indice */
+)
+{
+ UWord16 value;
+ Word16 i;
+ Word16 nbits_total;
+
+ assert( nb_bits <= 16 );
+ value = 0;
+ move16();
+
+ nbits_total = extract_l( Mpy_32_32( st_fx->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+
+ /* detect corrupted bitstream */
+ IF( GT_16( add( st_fx->next_bit_pos, nb_bits ), nbits_total ) )
+ {
+ st_fx->BER_detect = 1;
+ move16();
+ return ( 0 );
+ }
+
+ FOR( i = 0; i < nb_bits; i++ )
+ {
+ value = (UWord16) L_shl( value, 1 );
+ value = (UWord16) L_add( value, st_fx->bit_stream[add( st_fx->next_bit_pos, i )] );
+ }
+
+ /* update the position in the bitstream */
+ st_fx->next_bit_pos = add( st_fx->next_bit_pos, nb_bits );
+ move16();
+
+ return value;
+}
+
+
+/*-------------------------------------------------------------------*
+ * get_next_indice_1()
+ *
+ * Get the next 1-bit indice from the buffer
+ *-------------------------------------------------------------------*/
+
+/*! r: value of the indice */
+UWord16 get_next_indice_1_fx(
+ Decoder_State *st_fx /* i/o: decoder state structure */
+)
+{
+ Word16 nbits_total;
+ nbits_total = extract_l( Mpy_32_32( st_fx->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+
+ /* detect corrupted bitstream */
+ test();
+ test();
+ test();
+ IF( ( GT_16( add( st_fx->next_bit_pos, 1 ), nbits_total ) && EQ_16( st_fx->codec_mode, MODE1 ) ) ||
+ ( GT_16( add( st_fx->next_bit_pos, 1 ), add( nbits_total, 2 * 8 ) ) && EQ_16( st_fx->codec_mode, MODE2 ) ) /* add two zero bytes for arithmetic coder flush */
+ )
+ {
+ st_fx->BER_detect = 1;
+ move16();
+ return ( 0 );
+ }
+
+ return st_fx->bit_stream[st_fx->next_bit_pos++];
+}
+
+
+/*-------------------------------------------------------------------*
+ * get_next_indice_tmp()
+ *
+ * update the total number of bits and the position in the bitstream
+ *-------------------------------------------------------------------*/
+
+void get_next_indice_tmp_fx(
+ Decoder_State *st_fx, /* o : decoder state structure */
+ Word16 nb_bits /* i : number of bits that were used to quantize the indice */
+)
+{
+ /* update the position in the bitstream */
+ st_fx->next_bit_pos = add( st_fx->next_bit_pos, nb_bits );
+ move16();
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * get_indice()
+ *
+ * Get indice at specific position in the buffer
*-------------------------------------------------------------------*/
-void get_next_indice_tmp_fx(
- Decoder_State *st_fx, /* o : decoder state structure */
- Word16 nb_bits /* i : number of bits that were used to quantize the indice */
+/*! r: value of the indice */
+UWord16 get_indice_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ Word16 pos, /* i : absolute position in the bitstream (update after the read) */
+ Word16 nb_bits /* i : number of bits that were used to quantize the indice */
)
{
- /* update the position in the bitstream */
- st_fx->next_bit_pos = add( st_fx->next_bit_pos, nb_bits );
+ UWord16 value;
+ Word16 i;
+ Word32 nbits_total;
+
+ assert( nb_bits <= 16 );
+
+ nbits_total = extract_l( Mpy_32_32( st_fx->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+
+ /* detect corrupted bitstream */
+ IF( GT_32( L_deposit_l( add( pos, nb_bits ) ), nbits_total ) )
+ {
+ st_fx->BER_detect = 1;
+ move16();
+ return ( 0 );
+ }
+
+ value = 0;
+ move16();
+ FOR( i = 0; i < nb_bits; i++ )
+ {
+ value = lshl( value, 1 );
+ value = add( value, st_fx->bit_stream[pos + i] );
+ }
+
+ return value;
+}
+
+
+/*-------------------------------------------------------------------*
+ * get_indice_st()
+ *
+ * Get indice at specific position in the buffer
+ *-------------------------------------------------------------------*/
+
+/*! r: value of the indice */
+UWord16 get_indice_st(
+ Decoder_State *st, /* i/o: decoder state structure */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word16 pos, /* i : absolute position in the bitstream */
+ const Word16 nb_bits /* i : number of bits to quantize the indice */
+)
+{
+ UWord16 value;
+ Word16 i;
+
+ assert( nb_bits <= 16 );
+
+ /* detect corrupted bitstream */
+ IF( GT_32( L_deposit_l( add( pos, nb_bits ) ), Mpy_32_32( element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ) )
+ {
+ st->BER_detect = 1;
+ move16();
+ return ( 0 );
+ }
+
+ value = 0;
move16();
+ FOR( i = 0; i < nb_bits; i++ )
+ {
+ value = shl( value, 1 );
+ value = add( value, st->bit_stream[pos + i] );
+ }
+
+ return value;
}
+
/*-------------------------------------------------------------------*
* get_indice_1_fx( )
*
* Get a 1-bit indice at specific position in the buffer
*-------------------------------------------------------------------*/
-UWord16 get_indice_1_fx( /* o : value of the indice */
- Decoder_State *st_fx, /* i/o: decoder state structure */
- Word16 pos /* i : absolute position in the bitstream (update after the read) */
+/*! r: value of the indice */
+UWord16 get_indice_1_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ Word16 pos /* i : absolute position in the bitstream (update after the read) */
)
{
Word16 nbits_total;
+
nbits_total = extract_l( Mpy_32_32( st_fx->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+
/* detect corrupted bitstream */
IF( GT_16( add( pos, 1 ), nbits_total ) )
{
- st_fx->BER_detect = 1;
- move16();
- return ( 0 );
+ st_fx->BER_detect = 1;
+ move16();
+ return ( 0 );
+ }
+
+ return st_fx->bit_stream[pos];
+}
+
+
+/*-------------------------------------------------------------------*
+ * reset_indices_enc_fx()
+ *
+ * Reset the buffer of indices
+ *-------------------------------------------------------------------*/
+
+void reset_indices_enc_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
+ const Word16 max_num_indices /* i : max number of indices */
+)
+{
+ Word16 i;
+
+ hBstr->nb_ind_tot = 0;
+ move16();
+ hBstr->nb_bits_tot = 0;
+ move16();
+ FOR( i = 0; i < max_num_indices; i++ )
+ {
+ hBstr->ind_list[i].nb_bits = -1;
+ move16();
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * reset_indices_dec()
+ *
+ * Reset the buffer of decoder indices
+ *-------------------------------------------------------------------*/
+
+void reset_indices_dec(
+ Decoder_State *st )
+{
+ st->next_bit_pos = 0;
+ move16();
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * write_indices_to_stream()
+ *
+ * writing forward or backward to a serial stream
+ *-------------------------------------------------------------------*/
+
+static Word16 write_indices_to_stream_fx(
+ Indice *ind_list,
+ UWord16 **pt_stream,
+ const Word16 inc,
+ const Word16 num_indices )
+{
+ Word16 i, k;
+ Word16 value, nb_bits;
+ UWord16 mask;
+
+ FOR( i = 0; i < num_indices; i++ )
+ {
+ value = ind_list[i].value;
+ nb_bits = ind_list[i].nb_bits;
+ move16();
+ move16();
+
+ IF( nb_bits > 0 )
+ {
+ /* mask from MSB to LSB */
+ mask = (UWord16) L_shl( 1, sub( nb_bits, 1 ) );
+
+ /* write bit by bit */
+ FOR( k = 0; k < nb_bits; k++ )
+ {
+ IF( L_and( value, mask ) )
+ {
+ **pt_stream = 1;
+ move16();
+ *pt_stream += inc;
+ }
+ ELSE
+ {
+ **pt_stream = 0;
+ move16();
+ *pt_stream += inc;
+ }
+
+ mask = (UWord16) L_shr( mask, 1 );
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+/*-------------------------------------------------------------------*
+ * write_indices_element()
+ *
+ * Bitstream writing function of one element (one SCE or one CPE)
+ *-------------------------------------------------------------------*/
+
+static ivas_error write_indices_element_fx(
+ Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
+ UWord16 **pt_stream, /* i : pointer to bitstream buffer */
+ const Word16 is_SCE, /* i : flag to distingusih SCE and CPE */
+ const Word16 element_id /* i : id of the SCE or CPE */
+)
+{
+ Word16 ch;
+ Encoder_State **sts = NULL;
+ UWord16 *pt_stream_loc;
+ UWord16 *pt_stream_backup;
+ UWord16 *pt_stream_end;
+ Word16 nb_bits_tot_metadata;
+ Word16 nb_ind_tot_metadata;
+
+ Indice *ind_list_metadata;
+ Word16 n, n_channels;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+
+ ind_list_metadata = NULL;
+ nb_ind_tot_metadata = 0;
+ move16();
+
+ IF( EQ_32( st_ivas->hEncoderConfig->ivas_format, MONO_FORMAT ) )
+ {
+ sts = st_ivas->hSCE[0]->hCoreCoder;
+ nb_bits_tot_metadata = 0;
+ move16();
+ }
+ ELSE
+ {
+ nb_bits_tot_metadata = 0;
+ move16();
+ test();
+ test();
+ IF( is_SCE && st_ivas->hSCE[element_id] != NULL )
+ {
+ sts = st_ivas->hSCE[element_id]->hCoreCoder;
+
+ IF( st_ivas->hSCE[element_id]->hMetaData != NULL )
+ {
+ nb_bits_tot_metadata = st_ivas->hSCE[element_id]->hMetaData->nb_bits_tot;
+ ind_list_metadata = st_ivas->hSCE[element_id]->hMetaData->ind_list;
+ nb_ind_tot_metadata = st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot;
+ move16();
+ move16();
+ }
+ }
+ ELSE IF( !is_SCE && st_ivas->hCPE[element_id] != NULL )
+ {
+ sts = st_ivas->hCPE[element_id]->hCoreCoder;
+
+ IF( st_ivas->hCPE[element_id]->hMetaData != NULL )
+ {
+ nb_bits_tot_metadata = st_ivas->hCPE[element_id]->hMetaData->nb_bits_tot;
+ ind_list_metadata = st_ivas->hCPE[element_id]->hMetaData->ind_list;
+ nb_ind_tot_metadata = st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot;
+ move16();
+ move16();
+ }
+ }
+ }
+
+ n_channels = 1;
+ move16();
+ if ( GT_16( sts[0]->element_mode, IVAS_CPE_DFT ) )
+ {
+ n_channels = CPE_CHANNELS;
+ move16();
+ }
+
+ /*----------------------------------------------------------------*
+ * Bitstream packing (conversion of individual indices into a serial stream)
+ *----------------------------------------------------------------*/
+
+ pt_stream_loc = *pt_stream;
+ pt_stream_end = pt_stream_loc;
+
+ FOR( n = 0; n < n_channels; n++ )
+ {
+ /* write the metadata buffer */
+ test();
+ IF( n == 0 && nb_bits_tot_metadata != 0 )
+ {
+ pt_stream_backup = pt_stream_loc;
+
+ FOR( ch = 0; ch < n_channels; ch++ )
+ {
+ pt_stream_loc += sts[ch]->hBstr->nb_bits_tot;
+ }
+ pt_stream_loc += nb_bits_tot_metadata - 1;
+ pt_stream_end = pt_stream_loc + 1;
+
+ write_indices_to_stream_fx( ind_list_metadata, &pt_stream_loc, -1,
+ nb_ind_tot_metadata );
+
+ /* restore previous pointer position */
+ pt_stream_loc = pt_stream_backup;
+ }
+ write_indices_to_stream_fx( sts[n]->hBstr->ind_list, &pt_stream_loc, 1,
+ sts[n]->hBstr->nb_ind_tot );
+
+ if ( pt_stream_loc > pt_stream_end )
+ {
+ pt_stream_end = pt_stream_loc;
+ }
+ }
+
+#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
+ if ( is_SCE ) /* EVS and SCE */
+ {
+ static FILE *f1 = 0;
+
+ if ( f1 == 0 )
+ f1 = fopen( "bitstream_text", "w" );
+
+ for ( int16_t i = 0; i < sts[0]->hBstr->nb_ind_tot; i++ )
+ {
+ Indice *ind_list = sts[0]->hBstr->ind_list;
+ int16_t value = ind_list[i].value;
+ int16_t nb_bits = ind_list[i].nb_bits;
+ char *function_name = ind_list[i].function_name;
+
+ fprintf( f1, "%d %d %d %s %d %d\n", frame, element_id, i, function_name, nb_bits, value );
+ }
+
+ if ( st_ivas->hSCE[element_id]->hMetaData != NULL )
+ {
+ for ( int16_t i = 0; i < st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot; i++ )
+ {
+ Indice *ind_list = st_ivas->hSCE[element_id]->hMetaData->ind_list;
+ int16_t value = ind_list[i].value;
+ int16_t nb_bits = ind_list[i].nb_bits;
+ char *function_name = ind_list[i].function_name;
+
+ fprintf( f1, "%d %d %d %s %d %d\n", frame, element_id, i, function_name, nb_bits, value );
+ }
+ }
+ }
+ else
+ {
+ static FILE *f1 = 0;
+
+ if ( f1 == 0 )
+ f1 = fopen( "bitstream_text", "w" );
+
+
+ for ( n = 0; n < n_channels; n++ )
+ {
+ for ( int16_t i = 0; i < sts[n]->hBstr->nb_ind_tot; i++ )
+ {
+ Indice *ind_list = sts[n]->hBstr->ind_list;
+ int16_t value = ind_list[i].value;
+ int16_t nb_bits = ind_list[i].nb_bits;
+ char *function_name = ind_list[i].function_name;
+
+ fprintf( f1, "%d %d %d %d %s %d %d\n", frame, element_id, n, i, function_name, nb_bits, value );
+ }
+ }
+
+ if ( st_ivas->hCPE[element_id]->hMetaData != NULL )
+ {
+ for ( int16_t i = 0; i < st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot; i++ )
+ {
+ Indice *ind_list = st_ivas->hCPE[element_id]->hMetaData->ind_list;
+ int16_t value = ind_list[i].value;
+ int16_t nb_bits = ind_list[i].nb_bits;
+ char *function_name = ind_list[i].function_name;
+
+ fprintf( f1, "%d %d %d %d %s %d %d\n", frame, element_id, -1, i, function_name, nb_bits, value );
+ }
+ }
+ }
+#endif
+
+ /*----------------------------------------------------------------*
+ * Clearing of indices
+ * Reset index pointers
+ *----------------------------------------------------------------*/
+
+ IF( is_SCE ) /* EVS and SCE */
+ {
+ IF( st_ivas->hSCE[element_id]->hMetaData != NULL )
+ {
+ reset_indices_enc_fx( st_ivas->hSCE[element_id]->hMetaData, st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot );
+ }
+
+ reset_indices_enc_fx( sts[0]->hBstr, sts[0]->hBstr->nb_ind_tot );
+ }
+ ELSE
+ {
+ IF( st_ivas->hCPE[element_id]->hMetaData != NULL )
+ {
+ reset_indices_enc_fx( st_ivas->hCPE[element_id]->hMetaData, st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot );
+ }
+
+ FOR( n = 0; n < n_channels; n++ )
+ {
+ reset_indices_enc_fx( sts[n]->hBstr, sts[n]->hBstr->nb_ind_tot );
+ }
+ }
+
+ /* update pointer */
+ *pt_stream = pt_stream_end;
+
+ return error;
+}
+
+
+/*-------------------------------------------------------------------*
+ * write_indices_ivas()
+ *
+ * Write the buffer of indices to a serial bitstream buffer,
+ * each bit represented as a uint16_t of value 0 or 1
+ *-------------------------------------------------------------------*/
+
+ivas_error write_indices_ivas_fx(
+ Encoder_Struct *st_ivas, /* i/o: encoder state structure */
+ UWord16 *bit_stream, /* i/o: output bitstream */
+ UWord16 *num_bits /* i : number of indices written to output */
+)
+{
+ Word16 i, n;
+ UWord16 *pt_stream;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+
+ pt_stream = bit_stream;
+ FOR( i = 0; i < MAX_BITS_PER_FRAME; ++i )
+ {
+ bit_stream[i] = 0;
+ move16();
+ }
+
+ /*-----------------------------------------------------------------*
+ * Encode Payload
+ *-----------------------------------------------------------------*/
+
+ FOR( n = 0; n < st_ivas->nSCE; n++ )
+ {
+ write_indices_element_fx( st_ivas, &pt_stream, 1, n );
}
- return st_fx->bit_stream[pos];
+ FOR( n = 0; n < st_ivas->nCPE; n++ )
+ {
+ write_indices_element_fx( st_ivas, &pt_stream, 0, n );
+ }
+
+ *num_bits = (UWord16) ( pt_stream - bit_stream );
+ move16();
+
+ return error;
}
+
/*-------------------------------------------------------------------*
- * reset_indices_enc_fx()
+ * decoder_selectCodec()
+ *
*
- * Reset the buffer of indices
*-------------------------------------------------------------------*/
-void reset_indices_enc_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
- const Word16 max_num_indices /* i : max number of indices */
+static void decoder_selectCodec(
+ Decoder_State *st, /* i/o: decoder state structure */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bit0 /* i : first bit */
)
{
- Word16 i;
+ /* set the AMR-WB IO flag */
+ IF( rate2AMRWB_IOmode( total_brate ) != -1 )
+ {
+ st->Opt_AMR_WB = 1;
+ move16();
+ }
+ ELSE IF( total_brate != FRAME_NO_DATA )
+ {
+ st->Opt_AMR_WB = 0;
+ move16();
+ }
- hBstr->nb_ind_tot = 0;
- move16();
- hBstr->nb_bits_tot = 0;
- move16();
- FOR( i = 0; i < max_num_indices; i++ )
+ IF( st->Opt_AMR_WB )
{
- hBstr->ind_list[i].nb_bits = -1;
+ st->codec_mode = MODE1;
+ move16();
+ }
+ else
+ {
+ st->codec_mode = get_codec_mode( total_brate );
+
+ IF( st->codec_mode == -1 )
+ {
+ SWITCH( total_brate )
+ {
+ case 0:
+ st->codec_mode = st->last_codec_mode;
+ move16();
+ BREAK;
+ case 2400:
+ st->codec_mode = st->last_codec_mode;
+ move16();
+ BREAK;
+ case 2800:
+ st->codec_mode = MODE1;
+ move16();
+ break;
+ default: /* validate that total_brate (derived from RTP packet or a file header) is one of the defined bitrates */
+ st->codec_mode = st->last_codec_mode;
+ move16();
+ st->bfi = 1;
+ move16();
+ break;
+ }
+ }
+ }
+
+ IF( st->ini_frame == 0 )
+ {
+ if ( st->codec_mode == -1 )
+ {
+ st->codec_mode = MODE1;
+ move16();
+ }
+ st->last_codec_mode = st->codec_mode;
move16();
}
+ /* set SID/CNG type */
+ IF( total_brate == SID_2k40 )
+ {
+ IF( bit0 == 0 )
+ {
+ st->cng_type = LP_CNG;
+ move16();
+
+ /* force MODE1 when selecting LP_CNG */
+ st->codec_mode = MODE1;
+ move16();
+ }
+ ELSE IF( bit0 == 1 )
+ {
+ st->cng_type = FD_CNG;
+ move16();
+
+ test();
+ if ( st->last_codec_mode == MODE2 && st->last_total_brate == ACELP_13k20 )
+ {
+ st->codec_mode = MODE1;
+ move16();
+ }
+ }
+ }
+
return;
}
+/*-------------------------------------------------------------------*
+ * dec_prm_core()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
static void dec_prm_core( Decoder_State *st )
{
Word16 n, frame_size_index, num_bits;
@@ -459,8 +4028,11 @@ static void dec_prm_core( Decoder_State *st )
move16();
}
}
+
+ return;
}
+
/*-----------------------------------------------------------------*
* decision_matrix_core_dec()
*
@@ -599,6 +4171,7 @@ static void decision_matrix_core_dec(
return;
}
+
/*-------------------------------------------------------------------*
* mdct_switching_dec()
*
@@ -671,172 +4244,515 @@ void mdct_switching_dec_fx(
}
ELSE IF( EQ_16( st->codec_mode, MODE2 ) && EQ_16( st->mdct_sw_enable, MODE2 ) )
{
- /* Read ahead core mode signaling */
- Word16 next_bit_pos_save;
- Word16 core_save;
- Word16 bwidth_save;
+ /* Read ahead core mode signaling */
+ Word16 next_bit_pos_save;
+ Word16 core_save;
+ Word16 bwidth_save;
+
+ next_bit_pos_save = st->next_bit_pos;
+ move16();
+ core_save = st->core;
+ move16();
+ bwidth_save = st->bwidth;
+ move16();
+
+ dec_prm_core( st ); /* sets st->core */
+
+ IF( EQ_16( st->core, HQ_CORE ) )
+ {
+ /* Trigger HQ_CORE */
+ st->codec_mode = MODE1;
+ move16();
+ st->mdct_sw = MODE2;
+ move16();
+ }
+ ELSE
+ {
+ /* Rewind bitstream */
+ st->next_bit_pos = next_bit_pos_save;
+ move16();
+ if ( st->bfi != 0 )
+ {
+ st->core = core_save;
+ move16();
+ }
+ /* always reset bwidth, to not interfere with BER logic */
+ st->bwidth = bwidth_save;
+ move16();
+ }
+ }
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * reset_elements()
+ *
+ * Simulate packet losses by reading FEC pattern from external file
+ *-------------------------------------------------------------------*/
+
+Decoder_State **reset_elements(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+)
+{
+ Word16 k, n;
+ Decoder_State **sts = NULL; /* to avoid compilation warning */
+
+ FOR( k = 0; k < st_ivas->nSCE; k++ )
+ {
+ sts = st_ivas->hSCE[k]->hCoreCoder;
+
+ sts[0]->bfi = 0;
+ sts[0]->BER_detect = 0;
+ sts[0]->mdct_sw_enable = 0;
+ sts[0]->mdct_sw = 0;
+
+ move16();
+ move16();
+ move16();
+ move16();
+
+ reset_indices_dec( sts[0] );
+ }
+
+ FOR( k = 0; k < st_ivas->nCPE; k++ )
+ {
+ sts = st_ivas->hCPE[k]->hCoreCoder;
+
+ FOR( n = 0; n < CPE_CHANNELS; n++ )
+ {
+ sts[n]->bfi = 0;
+ sts[n]->BER_detect = 0;
+ sts[n]->mdct_sw_enable = 0;
+ sts[n]->mdct_sw = 0;
+
+ move16();
+ move16();
+ move16();
+ move16();
+
+ reset_indices_dec( sts[n] );
+ }
+ }
+
+ return sts; /* return last decoder state */
+}
+
+
+/*-------------------------------------------------------------------*
+ * ivas_set_bitstream_pointers()
+ *
+ * Set bitstream pointers for every SCE/CPE Core-Decoder
+ *-------------------------------------------------------------------*/
+
+void ivas_set_bitstream_pointers(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+)
+{
+ Word16 k, num_bits;
+ Decoder_State **sts;
+
+ num_bits = 0;
+
+ /* set bitstream pointers for SCEs */
+ for ( k = 0; k < st_ivas->nSCE; k++ )
+ {
+ sts = st_ivas->hSCE[k]->hCoreCoder;
+ sts[0]->bit_stream = st_ivas->bit_stream + num_bits;
+ num_bits += (Word16) ( st_ivas->hSCE[k]->element_brate / FRAMES_PER_SEC );
+ }
+
+ /* set bitstream pointers for CPEs */
+ for ( k = 0; k < st_ivas->nCPE; k++ )
+ {
+ sts = st_ivas->hCPE[k]->hCoreCoder;
+ sts[0]->bit_stream = st_ivas->bit_stream + num_bits;
+ num_bits += (Word16) ( st_ivas->hCPE[k]->element_brate / FRAMES_PER_SEC );
+ }
+
+ return;
+}
+
+#ifdef DEBUGGING
+
+/*-------------------------------------------------------------------*
+ * file_read_FECpattern()
+ *
+ * Simulate packet losses by reading FEC pattern from external file
+ *-------------------------------------------------------------------*/
+
+static ivas_error file_read_FECpattern(
+ Word16 *bfi )
+{
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ *bfi = 0;
+
+ /* FEC pattern file provided */
+ if ( FEC_pattern != NULL )
+ {
+ Word16 tmp = 0;
+ if ( fread( &tmp, sizeof( Word16 ), 1, FEC_pattern ) != 1 )
+ {
+ if ( feof( FEC_pattern ) != 0 )
+ {
+#ifdef WRAP_AS_EIDXOR
+ fseek( FEC_pattern, 0L, SEEK_SET );
+ fread( &tmp, sizeof( Word16 ), 1, FEC_pattern );
+#else
+ tmp = 0;
+ fseek( FEC_pattern, 0L, SEEK_SET );
+#endif
+ }
+ else
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error reading the FEC pattern file !" );
+ }
+ }
+
+ if ( tmp == 2609 || tmp == 1 || tmp == (UWord16) 0x6B20 /* == G192_SYNC_BAD_FRAME */ )
+ {
+ *bfi = 1;
+ }
+ else
+ {
+ *bfi = 0;
+ }
+ }
+
+ return error;
+}
+
+#endif
+
+/*-------------------------------------------------------------------*
+ * read_indices()
+ *
+ * Detect SID, NO_DATA, BFI, etc. and set bitstream pointers
+ * Set ivas_total_brate
+ * Note: each bit is represented in bitsream buffer as a uint16_t of value 0 or 1
+ *-------------------------------------------------------------------*/
+
+/*! r: 1 = reading OK, 0 = problem */
+ivas_error read_indices_fx(
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ UWord16 bit_stream[], /* i : bitstream buffer */
+ UWord16 num_bits, /* i : number of bits in bitstream */
+ Word16 *prev_ft_speech,
+ Word16 *CNG,
+ Word16 bfi /* i : bad frame indicator */
+)
+{
+ Word16 k;
+ Decoder_State **sts;
+ Word32 total_brate = 0;
+ move32();
+ Word16 curr_ft_good_sp, curr_ft_bad_sp;
+ Word16 g192_sid_first, sid_upd_bad, sid_update;
+ Word16 speech_bad, speech_lost;
+ Word16 n;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+
+ st_ivas->BER_detect = 0;
+ move16();
+ sts = reset_elements( st_ivas );
+
+#ifdef DEBUGGING
+ file_read_FECpattern( &st_ivas->bfi );
+ st_ivas->bfi |= bfi;
+
+ if ( bfi == FRAMEMODE_MISSING )
+ {
+ for ( k = 0; k < num_bits; k++ )
+ {
+ bit_stream[k] = 0;
+ }
+ }
+#else
+ st_ivas->bfi = bfi;
+ move16();
+#endif
+
+ /* convert the frame length to total bitrate */
+ total_brate = imult3216( num_bits, FRAMES_PER_SEC );
+ move32();
+
+ /* verify that a valid num bits value is present */
+ /* only AMRWB, EVS or IVAS bitrates or 0 (NO DATA) are allowed */
+ IF( NE_32( st_ivas->ivas_format, MONO_FORMAT ) )
+ {
+ k = 0;
+ move16();
+
+ test();
+ WHILE( LT_16( k, SIZE_IVAS_BRATE_TBL ) && NE_32( total_brate, ivas_brate_tbl[k] ) )
+ {
+ k = add( k, 1 );
+ }
+
+ test();
+ test();
+ test();
+ test();
+ IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) && ( LT_16( k, SIZE_IVAS_BRATE_TBL ) || LE_32( total_brate, SID_2k40 ) ) )
+ {
+ st_ivas->element_mode_init = IVAS_SCE;
+ move16();
+ }
+ ELSE IF( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) && LE_32( total_brate, SID_2k40 ) )
+ {
+ st_ivas->element_mode_init = IVAS_SCE;
+ move16();
+ }
+ ELSE IF( EQ_16( k, SIZE_IVAS_BRATE_TBL ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) detected! Exiting ! \n", total_brate );
+ }
+ ELSE
+ {
+ st_ivas->element_mode_init = -1;
+ move16();
+ }
+ }
+ ELSE /* AMRWB or EVS */
+ {
+ st_ivas->element_mode_init = EVS_MONO;
+ move16();
+
+ IF( rate2EVSmode( total_brate, NULL ) < 0 ) /* negative value means that a valid rate was not found */
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) detected! Exiting ! \n", total_brate );
+ }
+ }
- next_bit_pos_save = st->next_bit_pos;
- move16();
- core_save = st->core;
+ /* G.RX DTX handler*/
+ /* handle SID_FIRST, SID_BAD, SPEECH_LOST, NO_DATA */
+ /* (total_brate, bfi , st_CNG) = rx_handler(received frame type, [previous frame type], past CNG state, past core) */
+ curr_ft_good_sp = 0;
+ move16();
+ curr_ft_bad_sp = 0;
+ move16();
+
+ IF( is_DTXrate( total_brate ) == 0 )
+ {
+ IF( st_ivas->bfi == 0 )
+ {
+ curr_ft_good_sp = 1;
move16();
- bwidth_save = st->bwidth;
+ }
+ ELSE
+ {
+ curr_ft_bad_sp = 1;
move16();
-
- dec_prm_core( st ); /* sets st->core */
-
- IF( EQ_16( st->core, HQ_CORE ) )
- {
- /* Trigger HQ_CORE */
- st->codec_mode = MODE1;
- move16();
- st->mdct_sw = MODE2;
- move16();
- }
- ELSE
- {
- /* Rewind bitstream */
- st->next_bit_pos = next_bit_pos_save;
- move16();
- if ( st->bfi != 0 )
- {
- st->core = core_save;
- move16();
- }
- /* always reset bwidth, to not interfere with BER logic */
- st->bwidth = bwidth_save;
- move16();
- }
}
}
- return;
-}
-
+ sid_update = 0;
+ move16();
+ sid_upd_bad = 0;
+ move16();
+ IF( EQ_16( is_SIDrate( total_brate ), 1 ) )
+ {
+ IF( st_ivas->bfi == 0 )
+ {
+ sid_update = 1;
+ move16();
+ }
+ ELSE
+ {
+ sid_upd_bad = 1; /* this frame type may happen in ETSI/3GPP CS cases, a corrupt SID frames */
+ move16();
+ }
+ }
-/*-------------------------------------------------------------------*
- * BRATE2IDX_fx()
- *
- * Convert Bitrate to Index Value
- *-------------------------------------------------------------------*/
+ /* all zero indices/bits iSP AMRWB SID_update results in a valid LP filter with extremely high LP-filter-gain */
+ /* all zero indices/bits may be a result of CS bit errors and/or erroneously injected by gateways or by a bad dejitter handlers */
+ test();
+ IF( EQ_32( total_brate, SID_1k75 ) && EQ_16( sid_update, 1 ) )
+ {
+ /* valid sid_update received, check for very risky but formally valid content */
+ Word16 sum = 0;
+ move16();
+ FOR( k = 0; k < num_bits; ++k )
+ {
+ sum = add( sum, extract_l( EQ_32( bit_stream[k], 1 ) ) ); /* check of 35 zeroes */
+ }
+ if ( sum == 0 )
+ { /* all zeros */
+ sid_upd_bad = 1; /* initial signal as corrupt (BER likely) */
+ move16();
+ }
+ }
-Word16 BRATE2IDX_fx( Word32 brate )
-{
+ /* AMRWB 26.173 G.192 file reader (read_serial) does not declare/use SID_BAD ft,
+ it declares every bad synch marked frame initially as a lost_speech frame,
+ and then the RXDTX handler CNG state decides the decoding mode CNG/SPEECH.
+ While In the AMRWB ETSI/3GPP format eid a CRC error in a detected SID_UPDATE frames triggers SID_BAD.
+ Here we inhibit use of the SID-length info, even though it is available in the G.192 file format after STL/EID-XOR .
+ */
+ IF( sid_upd_bad )
+ {
+ sid_upd_bad = 0;
+ move16();
+ total_brate = FRAME_NO_DATA; /* treat SID_BAD as a stolen signaling frame --> SPEECH LOST */
+ move32();
+ }
- Word32 L_temp;
- Word32 L_idx;
-#define START 9
- extern const Word16 bit_rates_div50[];
+ g192_sid_first = 0;
+ move16();
- /* This is a Fast Bit Rate Value to Index Value Binary Search */
- L_temp = L_msu0( brate, bit_rates_div50[START], 50 );
- L_temp = L_min( 6, L_max( -6, L_temp ) );
- L_idx = L_add( L_temp, START );
- L_temp = L_msu0( brate, bit_rates_div50[L_idx], 50 );
- L_temp = L_min( 3, L_max( -3, L_temp ) );
- L_idx = L_add( L_temp, L_idx );
- L_temp = L_msu0( brate, bit_rates_div50[L_idx], 50 );
- L_temp = L_min( 1, L_max( -2, L_temp ) );
- L_idx = L_add( L_temp, L_idx );
- L_temp = L_msu0( brate, bit_rates_div50[L_idx], 50 );
- if ( L_temp != 0 )
- L_idx = L_add( L_idx, 1 );
- return (Word16) L_idx;
-}
+ test();
+ test();
+ test();
+ test();
+ if ( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) && EQ_16( sts[0]->core, AMR_WB_CORE ) && *prev_ft_speech && total_brate == FRAME_NO_DATA && st_ivas->bfi == 0 )
+ {
+ g192_sid_first = 1; /* SID_FIRST detected for previous AMRWB/AMRWBIO active frames only */
+ /* It is not possible to perfectly simulate rate switching conditions EVS->AMRWBIO where:
+ the very first SID_FIRST detection is based on a past EVS active frame
+ and a good length 0 "SID_FIRST"(NO_DATA) frame is sent in AMRWBIO,
+ due to the one frame state memory in the AMRWB legacy G.192 SID_FIRST encoding
+ */
+ move16();
+ }
+ speech_bad = 0;
+ move16();
-/*-------------------------------------------------------------------*
- * BRATE2IDX16k_fx()
- *
- * Convert Bitrate to Index Value
- *-------------------------------------------------------------------*/
+ test();
+ if ( st_ivas->bfi != 0 && ( is_DTXrate( total_brate ) == 0 ) )
+ {
+ speech_bad = 1; /* initial ft assumption, CNG_state decides what to do */
+ move16();
+ }
-Word16 BRATE2IDX16k_fx( Word32 brate )
-{
- Word32 L_temp, L_idx;
-#define START_16K 5
- extern const Word16 bit_rates_16k_div50[];
+ speech_lost = 0;
+ move16();
- if ( EQ_32( brate, ACELP_16k40 ) )
+ test();
+ if ( total_brate == FRAME_NO_DATA && st_ivas->bfi != 0 ) /* unsent NO_DATA or stolen NO_DATA/signaling frame */
{
- brate = ACELP_14k80;
+ speech_lost = 1; /* initial ft assumption, CNG_state decides what to do */
move16();
}
- /* This is a Fast Bit Rate Value to Index Value Binary Search */
- L_temp = L_msu0( brate, bit_rates_16k_div50[START_16K], 50 );
- L_temp = L_min( 3, L_max( -3, L_temp ) );
- L_idx = L_add( L_temp, START_16K );
- L_temp = L_msu0( brate, bit_rates_16k_div50[L_idx], 50 );
- L_temp = L_min( 2, L_max( -2, L_temp ) );
- L_idx = L_add( L_temp, L_idx );
- L_temp = L_msu0( brate, bit_rates_16k_div50[L_idx], 50 );
- L_temp = L_min( 1, L_max( -1, L_temp ) );
- L_idx = L_add( L_temp, L_idx );
+ /* Do not allow decoder to enter CNG-synthesis for any instantly received GOOD+LENGTH==0 frame
+ as this frame was never transmitted, one can not know it is good and has a a length of zero ) */
+ IF( *CNG != 0 )
+ {
+ /* We were in CNG synthesis */
+ if ( curr_ft_good_sp != 0 )
+ {
+ /* only a good speech frame makes you leave CNG synthesis */
+ *CNG = 0;
+ move16();
+ }
+ }
+ ELSE
+ {
+ /* We were in SPEECH synthesis */
+ /* only a received/detected SID frame can make the decoder enter into CNG synthsis */
+ test();
+ test();
+ if ( g192_sid_first || sid_update || sid_upd_bad )
+ {
+ *CNG = 1;
+ move16();
+ }
+ }
- return (Word16) L_idx;
-}
+ /* set bfi, total_brate pair for proper decoding */
+ /* handle the G.192 _simulated_ untransmitted NO_DATA frame, setting for decoder SPEECH synthesis */
+ test();
+ test();
+ if ( *CNG == 0 && total_brate == FRAME_NO_DATA && st_ivas->bfi == 0 )
+ {
+ st_ivas->bfi = 1; /* SPEECH PLC code will now become active as in a real system */
+ /* total_brate= 0 */
+ move16();
+ }
-/*-------------------------------------------------------------------*
- * BIT_ALLOC_IDX_fx()
- *-------------------------------------------------------------------*/
+ /* handle bad/lost speech frame(and CS bad SID frame) in the decoders CNG synthesis settings pair (total_brate, bfi) */
+ test();
+ test();
+ test();
+ test();
+ IF( (
+ NE_16( bfi, FRAMEMODE_FUTURE ) &&
+ ( *CNG != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST) --> stay in CNG */
+ ( sid_upd_bad != 0 ) ) /* SID_UPD_BAD --> start CNG */
+ {
+ st_ivas->bfi = 0; /* bfi=0 needed to activate CNG code */
+ move16();
+ total_brate = FRAME_NO_DATA;
+ move32();
+ }
-Word32 BIT_ALLOC_IDX_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc )
-{
- Word32 L_temp;
- Word16 temp;
- if ( ctype == INACTIVE ) /* no sub(ctype, INACTIVE) because it is '0' */
- ctype = GENERIC;
+ /* update for next frame's G.192 file format's odd SID_FIRST detection (primarily for AMRWBIO) */
+ test();
+ *prev_ft_speech = ( ( curr_ft_good_sp != 0 ) || ( curr_ft_bad_sp != 0 ) );
move16();
- L_temp = L_mac0( -1l * 256, 1 * 256, ctype );
-
- temp = BRATE2IDX_fx( brate );
- L_temp = L_mac0( L_temp, 4 * 256, temp );
- IF( tc >= 0 )
- L_temp = L_mac0( L_temp, ( 10 - 4 ) * 256, temp );
- /* So either 'temp' x 4 when 'tc < 0', 'temp' x 10 otherwise */
-
- L_temp = L_mac0( L_temp, 1 * 256, s_max( 0, tc ) );
- L_temp = L_mac0( L_temp, s_max( 0, sfrm ), 1 );
- if ( sfrm < 0 )
- L_temp = L_shr( L_temp, 2 );
- L_temp = L_shr( L_temp, 6 );
+ /* st->total brate= total_brate; updated in a good frame below */
- return L_temp;
-}
+ FOR( k = 0; k < st_ivas->nCPE; k++ )
+ {
+ sts = st_ivas->hCPE[k]->hCoreCoder;
+ FOR( n = 0; n < CPE_CHANNELS; n++ )
+ {
+ sts[n]->bfi = st_ivas->bfi;
+ move16();
+ }
+ }
-/*-------------------------------------------------------------------*
- * BIT_ALLOC_IDX_16KHZ_fx()
- *-------------------------------------------------------------------*/
+ FOR( k = 0; k < st_ivas->nSCE; k++ )
+ {
+ sts = st_ivas->hSCE[k]->hCoreCoder;
+ sts[0]->bfi = st_ivas->bfi;
+ move16();
+ }
-Word32 BIT_ALLOC_IDX_16KHZ_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc )
-{
- Word32 L_temp;
- Word16 temp;
- /* 'ctype' =
- TRANSITION => 2
- GENERIC => 1
- ALL Other => 0
- */
- L_temp = L_and( shr( 0x0240l, shl( ctype, 1 ) ), 3 );
+ IF( st_ivas->bfi == 0 )
+ {
+ /* select Mode 1 or Mode 2 */
+ IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) /* EVS mono */
+ {
+ decoder_selectCodec( sts[0], total_brate, bit_stream[0] );
+ st_ivas->hDecoderConfig->Opt_AMR_WB = sts[0]->Opt_AMR_WB;
+ move16();
+ }
+ ELSE /* IVAS */
+ {
+ st_ivas->codec_mode = MODE1;
+ move16();
+ st_ivas->hDecoderConfig->Opt_AMR_WB = 0;
+ move16();
+ }
+ }
- temp = BRATE2IDX16k_fx( brate );
- L_temp = L_mac0( L_temp, 3, temp );
- IF( tc >= 0 )
- L_temp = L_mac0( L_temp, ( 7 - 3 ), temp );
- /* So either 'temp' x 3 when 'tc < 0', 'temp' x 7 otherwise */
+ /* GOOD frame */
+ test();
+ if ( st_ivas->bfi == 0 || EQ_16( st_ivas->bfi, FRAMEMODE_FUTURE ) )
+ {
+ /* GOOD frame - convert ITU-T G.192 words to short values */
+ st_ivas->hDecoderConfig->ivas_total_brate = total_brate;
+ move32();
+ }
- L_temp = L_mac0( L_temp, 1, s_max( 0, tc ) );
+ st_ivas->bit_stream = bit_stream;
- IF( sfrm >= 0 )
+ IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) )
{
- /* Mult by 5 */
- L_temp = L_add( L_temp, L_shl( L_temp, 2 ) );
- L_temp = L_mac0( L_temp, shr( sfrm, 6 ), 1 );
+ ivas_set_bitstream_pointers( st_ivas );
}
- return L_temp;
+ return error;
}
@@ -875,6 +4791,7 @@ static void berCheck(
return;
}
+
/*-------------------------------------------------------------------*
* getPartialCopyInfo()
*
@@ -940,8 +4857,11 @@ void getPartialCopyInfo(
get_next_indice_tmp_fx( st, nBits );
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* get_rfFlag()
*
@@ -950,7 +4870,7 @@ void getPartialCopyInfo(
void get_rfFlag(
Decoder_State *st, /* i: decoder state structure */
- Word16 *rf_flag, /* o : check for the RF flag */
+ Word16 *rf_flag, /* o : check for the RF flag */
Word16 *nBits,
Word16 *ind )
{
@@ -983,7 +4903,7 @@ void get_rfFlag(
move16();
/* retrieve the signalling indice */
- ind_tmp = (Word16) acelp_sig_tbl[add( start_idx, get_indice( st, 0, nBits_tmp ) )];
+ ind_tmp = (Word16) acelp_sig_tbl[add( start_idx, get_indice_fx( st, 0, nBits_tmp ) )];
move16();
/* convert signalling indice into RF flag. */
@@ -1002,8 +4922,11 @@ void get_rfFlag(
move16();
}
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* get_rfFrameType()
*
@@ -1035,7 +4958,7 @@ void get_rfFrameType(
}
/* the last three bits in a packet is the RF frame type */
- *rf_frame_type = get_indice( st, sub( num_bits, 3 ), 3 );
+ *rf_frame_type = get_indice_fx( st, sub( num_bits, 3 ), 3 );
move16();
}
ELSE
@@ -1043,8 +4966,11 @@ void get_rfFrameType(
*rf_frame_type = 0;
move16();
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* get_rf_fec_offset()
*
@@ -1075,7 +5001,7 @@ void get_rf_fec_offset(
}
/* the two bits before the rf frame type contain the fec offset */
- tmp = get_indice( st, sub( num_bits, 5 ), 2 );
+ tmp = get_indice_fx( st, sub( num_bits, 5 ), 2 );
IF( tmp == 0 )
{
@@ -1093,8 +5019,11 @@ void get_rf_fec_offset(
*rf_fec_offset = 0;
move16();
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* get_rfTargetBits()
*
@@ -1106,9 +5035,7 @@ void get_rfTargetBits(
Word16 *rf_target_bits /* o : Number of RF target bits */
)
{
-
/* Number of RF bits for different RF coder types */
-
SWITCH( rf_frame_type )
{
case RF_NO_DATA:
@@ -1148,6 +5075,8 @@ void get_rfTargetBits(
move16();
BREAK;
}
+
+ return;
}
@@ -1168,7 +5097,6 @@ void get_NextCoderType_fx(
Word8 bit_stream[ACELP_13k20 / 50];
UWord16 tmp;
-
FOR( k = 0; k < ACELP_13k20 / 50; k++ )
{
bit_stream[k] = (UWord8) s_and( shr( bitsteam[k / 8], sub( 7, s_and( k, 7 ) ) ), 0x1 );
@@ -1194,16 +5122,21 @@ void get_NextCoderType_fx(
tmp = lshl( tmp, 1 );
tmp = add( tmp, bit_stream[k] );
}
+
/* retrieve the signalling indice */
*next_coder_type = s_and( extract_l( acelp_sig_tbl[start_idx + tmp] ), 0x7 );
move16();
+
+ return;
}
+
/*-------------------------------------------------------------------*
* get_indice_preview()
*
* Indices preview to parse for the presence of partial copy
*-------------------------------------------------------------------*/
+
static UWord16 get_indice_preview(
UWord8 *bitstream,
Word16 bitstreamSize,
@@ -1231,14 +5164,17 @@ static UWord16 get_indice_preview(
value = shl( value, 1 );
value = add( value, bitstreamShort[pos + i] );
}
+
return value;
}
+
/*-------------------------------------------------------------------*
* evs_dec_previewFrame()
*
* Signalling index preview
*-------------------------------------------------------------------*/
+
void evs_dec_previewFrame(
UWord8 *bitstream,
Word16 bitstreamSize,
@@ -1295,8 +5231,11 @@ void evs_dec_previewFrame(
move16();
}
}
+
+ return;
}
+
void dtx_read_padding_bits_fx(
DEC_CORE_HANDLE st,
const Word16 num_bits )
diff --git a/lib_com/cldfb_evs_fx.c b/lib_com/cldfb_evs_fx.c
index 710ecf121251dfda9e387da641d629d451268a6d..153f95cf99aeabd50ca6eec2eaab3d0e39e30d8b 100644
--- a/lib_com/cldfb_evs_fx.c
+++ b/lib_com/cldfb_evs_fx.c
@@ -1240,9 +1240,11 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead)
Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX];
// Word16 freqTable[2] = {20, 40};
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
FOR( k = 0; k < numberCols; k++ )
@@ -1329,8 +1331,8 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead)
{
FOR( j = 20; j < numberBandsM; j++ )
{
-#ifdef ISSUE_1799_replace_L_shr_o
- nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
@@ -1356,8 +1358,8 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead)
{
FOR( j = 20; j < numberBandsM; j++ )
{
-#ifdef ISSUE_1799_replace_L_shr_o
- nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
diff --git a/lib_com/cldfb_fx.c b/lib_com/cldfb_fx.c
index 43e94a068c21733308ee22a9fb93f83efe4ec201..8c3331a3115886baed6f1c7dea632cac932eeb1a 100644
--- a/lib_com/cldfb_fx.c
+++ b/lib_com/cldfb_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -41,7 +41,6 @@
#include "stat_dec.h"
#include "prot_fx.h"
#include "rom_com.h"
-#include "rom_com_fx.h"
#include "wmc_auto.h"
#if __STDC_VERSION__ >= 199901L
#if defined __ICL
@@ -51,7 +50,6 @@
#define restrict
#endif
-
/*-------------------------------------------------------------------*
* Local prototypes
*--------------------------------------------------------------------*/
@@ -1501,9 +1499,11 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e
Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX];
// Word16 freqTable[2] = {20, 40};
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
FOR( k = 0; k < numberCols; k++ )
@@ -1590,8 +1590,8 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e
{
FOR( j = 20; j < numberBandsM; j++ )
{
-#ifdef ISSUE_1799_replace_L_shr_o
- nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
@@ -1617,8 +1617,8 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e
{
FOR( j = 20; j < numberBandsM; j++ )
{
-#ifdef ISSUE_1799_replace_L_shr_o
- nrg = L_add_o( nrg, L_shr_sat( energyValues[k][j], s ), &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c
index 00ce93218f4d3a5682d13d549729e3a5cb9e7445..56701bf6162428e0d1ca71b9c2664eebf78217c3 100644
--- a/lib_com/cng_exc_fx.c
+++ b/lib_com/cng_exc_fx.c
@@ -1,20 +1,26 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com.h"
-#include "ivas_rom_com_fx.h"
+#include "ivas_rom_com.h"
+
/*---------------------------------------------------------------------*
* Local constants
*---------------------------------------------------------------------*/
+
#define A2 6554
#define OmA2 ( 32768 - A2 )
#define GAIN_VAR 11811 /* in Q31 divided by 2 (Q30) */
+
const Word16 att_pow_tbl[SIZE_SCALE_TABLE_STEREO + 1] = { 9234, 10361, 13044, 16422, 22669, 31292, 32767, 26634, 28212, 20674, 16422, 27254, 30934, 32767 };
+
+
/*-------------------------------------------------------*
* CNG_exc()
*
@@ -22,22 +28,22 @@ const Word16 att_pow_tbl[SIZE_SCALE_TABLE_STEREO + 1] = { 9234, 10361, 13044, 16
*-------------------------------------------------------*/
void CNG_exc_fx(
- const Word32 core_brate, /* i : core bitrate */
+ const Word32 core_brate, /* i : core bitrate */
const Word16 L_frame, /* i : length of the frame */
Word32 *Enew, /* i/o: decoded SID energy Q6 */
Word16 *seed, /* i/o: random generator seed */
Word16 exc[], /* o : current non-enhanced excitation Q_new */
Word16 exc2[], /* o : current enhanced excitation Q_new */
- Word32 *lp_ener, /* i/o: LP filtered E Q6 */
+ Word32 *lp_ener, /* i/o: LP filtered E Q6 */
const Word32 last_core_brate, /* i : previous frame core bitrate */
Word16 *first_CNG, /* i/o: first CNG frame flag for energy init. */
Word16 *cng_ener_seed, /* i/o: random generator seed for CNG energy */
- Word16 bwe_exc[], /* o : excitation for SWB TBE Q_syn */
+ Word16 bwe_exc[], /* o : excitation for SWB TBE Q_syn */
const Word16 allow_cn_step, /* i : allow CN step */
- Word16 *last_allow_cn_step, /* i/o: last allow step */
- const Word16 OldQ_exc, /* i : Old excitation scaling */
- const Word16 Q_exc, /* i : excitation scaling */
- const Word16 num_ho, /* i : number of selected hangover frames */
+ Word16 *last_allow_cn_step, /* i/o: last allow step */
+ const Word16 OldQ_exc, /* i : Old excitation scaling */
+ const Word16 Q_exc, /* i : excitation scaling */
+ const Word16 num_ho, /* i : number of selected hangover frames */
Word32 q_env[], /*Q6*/
Word32 *lp_env, /*Q6*/
Word32 *old_env, /*Q6*/
@@ -615,9 +621,11 @@ void cng_params_postupd_fx(
Word16 CNG_mode;
Word16 ptr;
Word32 last_active_brate;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 );
@@ -644,10 +652,16 @@ void cng_params_postupd_fx(
FOR( i = 0; i < NUM_ENV_CNG; i++ )
{
/* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */
+#else
L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */
L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */
L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */
- L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
+#endif
+ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
tmp = add( add( Q_exc, Q_exc ), 1 );
sp[i] = L_shr( L_tmp, sub( tmp, 6 ) );
move32(); /* Q6 */
@@ -725,9 +739,11 @@ void cng_params_postupd_ivas_fx(
Word16 CNG_mode;
Word16 ptr;
Word32 last_active_brate;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
ptr = add( sub( ho_circ_ptr, *cng_buf_cnt ), 1 );
@@ -754,10 +770,16 @@ void cng_params_postupd_ivas_fx(
FOR( i = 0; i < NUM_ENV_CNG; i++ )
{
/* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */
+#else
L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */
L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */
L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */
- L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
+#endif
+ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
tmp = add( add( Q_exc, Q_exc ), 1 );
// To do : Saturation to be re-validated.
sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) );
@@ -861,10 +883,12 @@ void cng_params_upd_fx(
Word16 tmp;
Word16 temp_lo_fx, temp_hi_fx;
Word16 exp_pow;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
/* update the pointer to circular buffer of old LSP vectors */
@@ -902,12 +926,14 @@ void cng_params_upd_fx(
L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */
pt_exc2++;
tmpv = shl( *pt_exc2, scale );
- L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv );
pt_exc2++;
-#ifdef ISSUE_1799_replace_L_shr_o
- L_ener = L_add_o( L_ener, L_shr_sat( L_tmp, 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
+ L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
#else
- L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
+ L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+ pt_exc2++;
+ L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
#endif
}
}
@@ -919,16 +945,18 @@ void cng_params_upd_fx(
L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */
pt_exc2++;
tmpv = shl( *pt_exc2, scale );
- L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv );
pt_exc2++;
-#ifdef ISSUE_1799_replace_L_shr_o
- L_ener = L_add_o( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */
+ L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */
#else
+ L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+ pt_exc2++;
L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */
#endif
}
}
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */
#else
L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */
@@ -966,10 +994,16 @@ void cng_params_upd_fx(
FOR( i = 0; i < NUM_ENV_CNG; i++ )
{
/* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */
- L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */
- L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */
- L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */
- L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */
+#else
+ L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */
+ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */
+ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */
+#endif
+ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
tmp = add( add( Q_exc, Q_exc ), 1 );
sp[i] = L_shr( L_tmp, sub( tmp, 6 ) );
move32(); /* Q6 */
@@ -1052,9 +1086,11 @@ void cng_params_upd_ivas_fx(
move16();
Word16 temp_lo_fx, temp_hi_fx;
Word16 exp_pow;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* update the pointer to circular buffer of old LSP vectors */
@@ -1092,12 +1128,14 @@ void cng_params_upd_ivas_fx(
L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */
pt_exc2++;
tmpv = shl( *pt_exc2, scale );
- L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv );
pt_exc2++;
-#ifdef ISSUE_1799_replace_L_shr_o
- L_ener = L_add_o( L_ener, L_shr_sat( L_tmp, 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
+ L_ener = L_add_sat( L_ener, L_shr_sat( L_tmp, 7 ) ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
#else
- L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
+ L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+ pt_exc2++;
+ L_ener = L_add_o( L_ener, L_shr_o( L_tmp, 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+1) ,division by L_frame done here */
#endif
}
}
@@ -1109,16 +1147,18 @@ void cng_params_upd_ivas_fx(
L_tmp = L_mult0( tmpv, tmpv ); /* 2*(Q_exc+scale) */
pt_exc2++;
tmpv = shl( *pt_exc2, scale );
- L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mac0_sat( L_tmp, tmpv, tmpv );
pt_exc2++;
-#ifdef ISSUE_1799_replace_L_shr_o
- L_ener = L_add_o( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */
+ L_ener = L_add_sat( L_ener, L_shr_sat( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7 ) ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */
#else
+ L_tmp = L_mac0_o( L_tmp, tmpv, tmpv, &Overflow );
+ pt_exc2++;
L_ener = L_add_o( L_ener, L_shr_o( Mult_32_16( L_tmp, 26214 /* 256/320, Q15 */ ), 7, &Overflow ), &Overflow ); /* Q(2*(Q_exc+scale)+15+1-16+1) ,division by L_frame done here */
#endif
}
}
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
L_ener = L_shr_sat( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ) ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */
#else
L_ener = L_shr_o( L_ener, sub( shl( add( Q_exc, scale ), 1 ), 5 ), &Overflow ); /* Q6 (2*(Q_exc+scale)+1-2*(Q_exc+scale)+5) */
@@ -1156,14 +1196,19 @@ void cng_params_upd_ivas_fx(
FOR( i = 0; i < NUM_ENV_CNG; i++ )
{
/* sp[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */
- L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */
- L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */
- L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */
- L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_exc+1 */
+ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_exc+1 */
+ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
tmp = add( add( Q_exc, Q_exc ), 1 );
-#ifdef ISSUE_1799_replace_L_shr_o
sp[i] = L_shr_sat( L_tmp, sub( tmp, 6 ) );
#else
+ L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_exc+1 */
+ L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_exc+1 */
+ L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_exc+1 */
+ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_exc+1 */
+ tmp = add( add( Q_exc, Q_exc ), 1 );
sp[i] = L_shr_o( L_tmp, sub( tmp, 6 ), &Overflow );
#endif
move32(); /* Q6 */
diff --git a/lib_com/cnst.h b/lib_com/cnst.h
index 59e9e89f1de83fcd52ecd8f0ba7aaa9daf286655..4157d878f42522b2978d23b942c2d46a4c2420c1 100644
--- a/lib_com/cnst.h
+++ b/lib_com/cnst.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef CNST_H
@@ -49,7 +49,7 @@
#define NUM_SAMPLES_320 (320)
#define NUM_SAMPLES_160 (160)
#define L_SUBFRAME_48k (240)
-#define L_SUBFRAME_32k (180)
+#define L_SUBFRAME_32k (160)
#define L_SUBFRAME_16k (80)
#define L_SUBFRAME_8k (40)
#define Q31_BY_NUM_SAMPLES_960 ( 2239294 ) /* 1/959 in Q31 */
@@ -668,6 +668,9 @@ enum
#define ACELP_TCX_TRANS_NS 1250000 /* Duration of the ACELP->TCX overlap - 1.25 ms */
#define L_FRAME_MAX L_FRAME48k /* Max 20ms frame size @48kHz */
#define L_FRAME_PLUS 1200 /* Max frame size (long TCX frame) */
+#ifdef FIX_1320_STACK_CPE_DECODER
+#define L_FRAME_PLUS_INTERNAL 800 /* Max frame size (long TCX frame) at maximum internal sampling rate */
+#endif
#define L_MDCT_OVLP_MAX NS2SA( 48000, ACELP_LOOK_NS ) /* = Max mdct overlap */
#define N_TCX10_MAX 480 /* Max size of TCX10 MDCT spectrum */
#define BITS_TEC 1 /* number of bits for TEC */
@@ -796,9 +799,13 @@ 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 )
-#define INV_CLDFB_BANDWIDTH_MDFT_FAC_Q31 ( 10737418 )
+#endif
+
+#define INV_CLDFB_BANDWIDTH_Q31 ( 2684355l ) /* ( 1.f / 800.f ) Q31 */
+#define INV_CLDFB_BANDWIDTH_MDFT_FAC_Q31 ( 10737418 )
#define CLDFB_BANDWIDTH 800
#define L_FILT_2OVER3 12
@@ -2072,11 +2079,11 @@ typedef enum _DCTTYPE
#define INV_PREECHO_SMOOTH_LENP1 ( 1 / ( PREECHO_SMOOTH_LEN + 1.0 ) );
#define EPSILON 0.000000000000001f
-#define EPSILON_FX_SMALL 1
-#define EPSILON_FIX (1)
-#define EPSILON_FX (Word32)1
-#define EPSILON_FX_M 1208925819
-#define EPSILON_FX_E -49
+#define EPSILON_FX_SMALL 1
+#define EPSILON_FIX (1)
+#define EPSILON_FX (Word32)1
+#define EPSILON_FX_M 1208925819
+#define EPSILON_FX_E -49
#define MAX_SEGMENT_LENGTH 480
diff --git a/lib_com/codec_tcx_common_fx.c b/lib_com/codec_tcx_common_fx.c
index 683e1e8d4ce0eac9b7dac17d6706afcda75c25bf..010590ad176ff7f53348a5bd3a763d4b0d9fc55b 100644
--- a/lib_com/codec_tcx_common_fx.c
+++ b/lib_com/codec_tcx_common_fx.c
@@ -61,7 +61,7 @@ void tcxFormantEnhancement(
Word16 i, j, k, l, n;
Word16 fac, fac0, fac1, fac_e, d, tmp;
Word16 xn_buf_e, xn_one, m, e;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -141,7 +141,7 @@ void tcxFormantEnhancement(
{
fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) );
BASOP_SATURATE_WARNING_OFF_EVS;
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) );
#else
xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) );
@@ -233,7 +233,7 @@ void tcxFormantEnhancement_with_shift(
Word16 i, j, k, l, n;
Word16 fac, fac0, fac1, fac_e, d, tmp;
Word16 xn_buf_e, xn_one, m, e;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -317,7 +317,7 @@ void tcxFormantEnhancement_with_shift(
{
fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) );
BASOP_SATURATE_WARNING_OFF_EVS;
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) );
#else
xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) );
@@ -366,7 +366,7 @@ void tcxFormantEnhancement_with_shift(
{
fac = add( fac0, mult( d, extract_l( L_mult0( j, inv_int[n] ) ) ) );
BASOP_SATURATE_WARNING_OFF_EVS;
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
xn_buf[l + j] = s_min( xn_one, shl_sat( mult( xn_buf[l + j], fac ), fac_e ) );
#else
xn_buf[l + j] = s_min( xn_one, shl_o( mult( xn_buf[l + j], fac ), fac_e, &Overflow ) );
diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h
index 81c6137a5845222067b712fd3dc2565cc3604567..d8ccd49d97dadd7c535501dd5871fafb91757f07 100644
--- a/lib_com/common_api_types.h
+++ b/lib_com/common_api_types.h
@@ -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;
@@ -178,11 +190,19 @@ typedef enum
typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE;
typedef struct ivas_masa_decoder_ext_out_meta_struct *IVAS_MASA_DECODER_EXT_OUT_META_HANDLE;
-typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_HANDLE;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+typedef struct ivas_hrtf_TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_TD_HANDLE;
+typedef struct ivas_hrtf_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
+typedef struct ivas_hrtf_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE;
+typedef struct ivas_hrtf_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE;
+typedef struct ivas_hrtf_statistics_struct *IVAS_DEC_HRTF_STATISTICS_HANDLE;
+#else
+typedef struct TDREND_HRFILT_FiltSet_struct *IVAS_DEC_HRTF_TD_HANDLE;
typedef struct ivas_hrtfs_crend_structure *IVAS_DEC_HRTF_CREND_HANDLE;
typedef struct ivas_hrtfs_fastconv_struct *IVAS_DEC_HRTF_FASTCONV_HANDLE;
typedef struct ivas_hrtfs_parambin_struct *IVAS_DEC_HRTF_PARAMBIN_HANDLE;
typedef struct ivas_hrtfs_statistics_struct *IVAS_DEC_HRTF_STATISTICS_HANDLE;
+#endif
typedef struct cldfb_filter_bank_struct *IVAS_CLDFB_FILTER_BANK_HANDLE;
typedef struct ivas_LS_setup_custom *IVAS_LSSETUP_CUSTOM_HANDLE;
@@ -216,6 +236,18 @@ typedef struct _IVAS_JBM_TRACE_DATA
} IVAS_JBM_TRACE_DATA;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+typedef enum _ivas_binaural_renderer_type
+{
+ IVAS_BIN_RENDERER_TYPE_NONE,
+ IVAS_BIN_RENDERER_TYPE_CREND,
+ IVAS_BIN_RENDERER_TYPE_FASTCONV,
+ IVAS_BIN_RENDERER_TYPE_PARAMBIN,
+ IVAS_BIN_RENDERER_TYPE_TDREND,
+ IVAS_BIN_RENDERER_TYPE_DEFAULT,
+
+} IVAS_BIN_RENDERER_TYPE;
+#endif
/*----------------------------------------------------------------------------------*
* Split rendering API constants, structures, and enums
@@ -254,6 +286,7 @@ typedef enum
} ISAR_SPLIT_REND_CODEC;
+#ifndef FIX_HRTF_LOAD
typedef enum
{
ISAR_SPLIT_REND_RENDERER_SELECTION_CREND,
@@ -263,7 +296,7 @@ typedef enum
ISAR_SPLIT_REND_RENDERER_SELECTION_DEFAULT,
} ISAR_SPLIT_REND_RENDERER_SELECTION;
-
+#endif
typedef struct _ISAR_SPLIT_REND_BITS_DATA
{
uint8_t *bits_buf;
@@ -289,12 +322,16 @@ typedef struct _ISAR_SPLIT_REND_CONFIG
2 - (2dof correction. By default YAW and PITCH correction)
3 - (3dof correction. By default YAW, PITCH and ROLL correction)
*/
- int16_t codec_delay_ms; /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/
+ int16_t codec_delay_ms; /* look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/
int16_t isar_frame_size_ms; /* ISAR bit stream frame size in milliseconds */
int16_t codec_frame_size_ms; /* Codec frame size in milliseconds, only relevant with LC3plus */
ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
ISAR_SPLIT_REND_CODEC codec;
+#ifdef FIX_HRTF_LOAD
+ IVAS_BIN_RENDERER_TYPE rendererSelection;
+#else
ISAR_SPLIT_REND_RENDERER_SELECTION rendererSelection;
+#endif
int16_t lc3plus_highres;
} ISAR_SPLIT_REND_CONFIG_DATA, *ISAR_SPLIT_REND_CONFIG_HANDLE;
@@ -315,13 +352,7 @@ typedef enum
typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
{
- Word16 override;
Word16 nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */
- float pFc_input[IVAS_CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */
- float pAcoustic_rt60[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */
- float pAcoustic_dsr[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */
- float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */
- float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */
Word32 pFc_input_fx[IVAS_CLDFB_NO_CHANNELS_MAX]; /*Q16 Center frequencies for which following values are provided: */
Word32 pAcoustic_rt60_fx[IVAS_CLDFB_NO_CHANNELS_MAX]; /*Q26 - The room's T60 per center frequency */
Word32 pAcoustic_dsr_fx[IVAS_CLDFB_NO_CHANNELS_MAX]; /*Q30 - The room's Diffuse to Source Ratio per center frequency */
@@ -347,10 +378,8 @@ typedef struct _IVAS_RENDER_CONFIG
ISAR_SPLIT_REND_CONFIG_DATA split_rend_config;
float directivity[IVAS_MAX_NUM_OBJECTS * 3];
Word16 directivity_fx[IVAS_MAX_NUM_OBJECTS * 3]; // has the following q-factor pattern: {6, 6, 15, 6, 6, 15, 6, 6, 15, 6, 6, 15}
-#ifdef CONF_DISTATT
float distAtt[3];
Word32 distAtt_fx[3]; /* {Q27, Q30, Q30} */
-#endif
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;
typedef struct
@@ -358,6 +387,7 @@ typedef struct
int16_t numSamplesPerChannel;
int16_t numChannels;
int16_t is_cldfb;
+
} IVAS_REND_AudioBufferConfig;
typedef struct
@@ -367,6 +397,7 @@ typedef struct
Word16 *pq_fact;
Word32 *data_fx;
// Word16 Q_data;
+
} IVAS_REND_AudioBuffer;
#endif /* COMMON_API_TYPES_H */
diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c
index 152870be74c567dab70a0d331ddc6401f123d394..744dafa695a6c70e26ea12d3f03cef9794ed77ac 100644
--- a/lib_com/core_com_config_fx.c
+++ b/lib_com/core_com_config_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c
index 9516202c15d3e7bf264a578ae8a48b74fe755a4c..230dcec6ac10c3f1ad33f030c3ea1e54dccef0e3 100644
--- a/lib_com/deemph_fx.c
+++ b/lib_com/deemph_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -39,7 +39,6 @@
#include "prot_fx.h"
#include "wmc_auto.h"
-
void deemph_fx_32(
Word32 *signal, /* i/o: signal Qx*/
const Word16 mu, /* i : deemphasis factor Q15*/
@@ -93,22 +92,34 @@ void deemph_fx(
{
Word16 i;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow;
Overflow = 0;
move32();
#endif
-
L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/
L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/
signal[0] = round_fx_o( L_tmp, &Overflow ); /*Qx*/
+#else
+ L_tmp = L_deposit_h( signal[0] ); /*Qx+16*/
+ L_tmp = L_mac_sat( L_tmp, *mem, mu ); /*Qx+16*/
+ signal[0] = round_fx_sat( L_tmp ); /*Qx*/
+#endif
+
+
move16();
FOR( i = 1; i < L; i++ )
{
- L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/
- L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/
- signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/
+ L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/
+ signal[i] = round_fx_sat( L_tmp ); /*Qx*/
+#else
+ L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow ); /*Qx+16*/
+ signal[i] = round_fx_o( L_tmp, &Overflow ); /*Qx*/
+#endif
move16();
}
@@ -131,10 +142,12 @@ void Deemph2(
{
Word16 i;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow;
Overflow = 0;
move32();
+#endif
#endif
/* saturation can occur in L_mac() */
@@ -144,8 +157,12 @@ void Deemph2(
FOR( i = 1; i < L; i++ )
{
- L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/
- x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/
+ L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/
+#else
+ x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow ); /*Qx-1*/
+#endif
move16();
}
@@ -175,10 +192,12 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W
{
Word16 i;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow;
Overflow = 0;
move32();
+#endif
#endif
/* signal[0] = signal[0] + mu * (*mem); */
@@ -188,8 +207,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W
shift = shr( -32768, shift ); /*Q15 - shift*/
FOR( i = 0; i < L; i++ )
{
- L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/
- x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/
+ x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/
+#else
+ L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow ); /*Qx-shift+16*/
+ x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/
+#endif
move16();
}
}
@@ -197,8 +221,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W
{
FOR( i = 0; i < L; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/
+ x[i] = round_fx_sat( L_tmp ); /*Qx-shift*/
+#else
L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/
x[i] = round_fx_o( L_tmp, &Overflow ); /*Qx-shift*/
+#endif
move16();
}
}
diff --git a/lib_com/delay_comp_fx.c b/lib_com/delay_comp_fx.c
index 7bc574c3c846ed36d8d88c4a14872456095219b7..aff51ac2d9e68c6f017eb902a5abc929894849eb 100644
--- a/lib_com/delay_comp_fx.c
+++ b/lib_com/delay_comp_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -47,13 +47,12 @@
*--------------------------------------------------------------------------*/
/*! r: delay value in ns */
-Word32 get_delay_fx( /* o : delay value in ms */
- const Word16 what_delay, /* i : what delay? (ENC or DEC) Q0*/
- const Word32 io_fs, /* i : input/output sampling frequency Q0*/
- const IVAS_FORMAT ivas_format, /* i : IVAS format */
- HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */
- ,
- const AUDIO_CONFIG output_config /* i : decoder output config */
+Word32 get_delay_fx(
+ const Word16 what_delay, /* i : what delay? (ENC or DEC) Q0*/
+ const Word32 io_fs, /* i : input/output sampling frequency Q0*/
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ HANDLE_CLDFB_FILTER_BANK hCldfb, /* i : Handle of Cldfb analysis */
+ const Word16 flag_binaural_split_coded /* i : split rendering on/off flag */
)
{
Word32 delay; /*Q0*/
@@ -78,6 +77,7 @@ Word32 get_delay_fx( /* o : delay value in ms
move32();
}
}
+
test();
if ( EQ_16( ivas_format, SBA_FORMAT ) || EQ_16( ivas_format, SBA_ISM_FORMAT ) )
{
@@ -105,8 +105,7 @@ Word32 get_delay_fx( /* o : delay value in ms
delay = IVAS_DEC_DELAY_NS; /*Q0*/
move32();
-
- IF( NE_16( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
+ IF( !flag_binaural_split_coded )
{
if ( hCldfb != NULL )
{
@@ -114,6 +113,7 @@ Word32 get_delay_fx( /* o : delay value in ms
delay = L_add( delay, IVAS_FB_DEC_DELAY_NS ); /*Q0*/
}
}
+
test();
if ( EQ_16( ivas_format, MASA_FORMAT ) || EQ_16( ivas_format, MASA_ISM_FORMAT ) )
{
diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c
index 0f4c3ef65d74e4d2c270de9b45d99c2be949d871..f98245cda6a3dbada76013f29d1e72bc76db25d0 100644
--- a/lib_com/disclaimer.c
+++ b/lib_com/disclaimer.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -46,8 +46,8 @@ int16_t print_disclaimer( FILE *fPtr )
fprintf( fPtr, "\n==================================================================================================\n" );
fprintf( fPtr, " IVAS Codec BASOP Baseline\n" );
fprintf( fPtr, " \n" );
- fprintf( fPtr, " Based on EVS Codec (BASOP) 3GPP TS26.442 Aug 12, 2021,\n" );
- fprintf( fPtr, " Version 12.15.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.4.0\n" );
+ fprintf( fPtr, " Based on EVS Codec (Alternative Fixed Point) 3GPP TS26.452 Aug 12, 2021,\n" );
+ fprintf( fPtr, " Version 16.3.0\n" );
fprintf( fPtr, "==================================================================================================\n\n" );
return 0;
diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c
index c30ed4a57c1bdfd74e2a6ea43449b5e8bddcd4aa..244d693819fab6a1a3d9c4e2d9087abfaa733a70 100644
--- a/lib_com/edct_fx.c
+++ b/lib_com/edct_fx.c
@@ -13,7 +13,6 @@
#include "math_32.h"
-
static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */
{
Word16 factor; /*Q15*/
@@ -396,10 +395,12 @@ void edct_16fx(
const Word16 *px, *pt;
Word16 *py;
(void) element_mode;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow;
Overflow = 0;
move32();
+#endif
#endif
/*COMPLETE: some eDCT sub function are missing */
@@ -455,13 +456,22 @@ void edct_16fx(
{
i2 = shl( i, 1 );
- L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */
+ L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( L_tmp, *px, *pt ); /*Q(Qx+16) */
+ re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */
+ move16();
+ L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */
+ Lacc = L_msu_sat( L_tmp, x[i2], *pt ); /*Q(Qx+16) */
+ im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */
+#else
Lacc = L_mac_o( L_tmp, *px, *pt, &Overflow ); /*Q(Qx+16) */
re2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */
move16();
L_tmp = L_mult( *px, edct_table[i] ); /*Q(Qx+16) */
Lacc = L_msu_o( L_tmp, x[i2], *pt, &Overflow ); /*Q(Qx+16) */
im2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */
+#endif
move16();
px -= 2;
pt--;
@@ -486,12 +496,20 @@ void edct_16fx(
fact = round_fx( L_shl( L_tmp, 2 ) ); /*Q15 */
FOR( i = 0; i < shr( length, 1 ); i++ )
{
- tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */
- re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */
+ tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */
+#else
+ re[i] = sub_o( re2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */
+#endif
move16();
- tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */
- im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */
+ tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */
+#else
+ im[i] = add_o( im2[i], tmp, &Overflow ); /*Q(Qx+Q_edct) */
+#endif
move16();
}
@@ -502,21 +520,23 @@ void edct_16fx(
{
i2 = shl( i, 1 );
- L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */
- Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */
-#ifdef ISSUE_1799_replace_L_shr_o
- y[i2] = round_fx_o( L_shr_sat( Lacc, Q_edct ), &Overflow ); /* Q(Qx) */
-#else
- y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */
-#endif
+ L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( L_tmp, im[i], *pt ); /*Q(Qx+Q_edct+16) */
+ y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */
move16();
L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */
Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */
-#ifdef ISSUE_1799_replace_L_shr_o
- *py = round_fx_o( L_shr_sat( Lacc, Q_edct ), &Overflow ); /* Q(Qx) */
+ *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */
#else
- *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */
+ Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow ); /*Q(Qx+Q_edct+16) */
+ y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */
+ move16();
+
+ L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */
+ Lacc = L_msu( L_tmp, im[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */
+ *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx) */
#endif
move16();
diff --git a/lib_com/enr_1_az_fx.c b/lib_com/enr_1_az_fx.c
index 5c99cdfa5e27692d9373f9e5bec6e1b046f8b380..5e840df8bd61f89b30b90134db37f4686c8cae65 100644
--- a/lib_com/enr_1_az_fx.c
+++ b/lib_com/enr_1_az_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/env_adj_fx.c b/lib_com/env_adj_fx.c
index 5a83dbe5fa8af935aa151a8fdb7d87738100c789..07cddb0cd1022770cf1dafda2f74cd81513de013 100644
--- a/lib_com/env_adj_fx.c
+++ b/lib_com/env_adj_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c
index a3140b4e498beb79ffa011af6baa60bbeb0a2bad..c988076951bf3ea1eb202f21f92a801d1dac72fe 100644
--- a/lib_com/env_stab_fx.c
+++ b/lib_com/env_stab_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
@@ -43,6 +43,7 @@
#include "rom_com.h"
#include "wmc_auto.h"
#include "stl.h"
+
/*--------------------------------------------------------------------------*
* Local constants
*--------------------------------------------------------------------------*/
@@ -187,9 +188,11 @@ Word16 env_stab_smo_fx( /* Q0 */
Word16 maxval, pp[NUM_ENV_STAB_PLC_STATES], pa[NUM_ENV_STAB_PLC_STATES];
Word16 i;
Word16 tmp, sum, exp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* get previous state */
prev_state = maximum_fx( env_stab_state_p, NUM_ENV_STAB_PLC_STATES, &maxval );
@@ -226,7 +229,11 @@ Word16 env_stab_smo_fx( /* Q0 */
/*tmp = shl(tmp, add(exp, 1));*/ /* Q15 */
FOR( i = 0; i < NUM_ENV_STAB_PLC_STATES; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ env_stab_state_p[i] = round_fx_sat( L_shl_sat( L_mult_sat( env_stab_state_p[i], tmp ), add( exp, 1 ) ) ); /* Q15 */
+#else
env_stab_state_p[i] = round_fx_o( L_shl_o( L_mult_o( env_stab_state_p[i], tmp, &Overflow ), add( exp, 1 ), &Overflow ), &Overflow ); /* Q15 */
+#endif
move16();
}
diff --git a/lib_com/env_stab_trans_fx.c b/lib_com/env_stab_trans_fx.c
index 829bef5f40f99a7245b65102c1f3aad4f685aa7d..0e4d5496200524e334ed49b0f5890c880afdd1b9 100644
--- a/lib_com/env_stab_trans_fx.c
+++ b/lib_com/env_stab_trans_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c
index 7420a4457750209c4fca63cd8fcab712dcc819f7..6666f90914e42399d122a720c02380831add9e2c 100644
--- a/lib_com/fd_cng_com_fx.c
+++ b/lib_com/fd_cng_com_fx.c
@@ -21,6 +21,7 @@
#define CNG_HS 4 /* 4 bit headroom for dot product */
#define CNG_S 6 /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */
+
/*-------------------------------------------------------------------
* Local function prototypes
*-------------------------------------------------------------------*/
@@ -647,11 +648,12 @@ void minimum_statistics(
Word16 msAlphaCorAlpha2;
Word16 msPeriodogSum16;
Word16 msNoiseFloor16;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
-
+#endif
len2 = i_mult( MSNUMSUBFR, len );
@@ -750,7 +752,11 @@ void minimum_statistics(
/* use absolute value to avoid -1.0 x -1.0 multiplications */
s2 = norm_l( scalar2 );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ scalar216 = round_fx_sat( L_shl( scalar2, s2 ) );
+#else
scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow );
+#endif
scalar2 = L_mult( scalar216, scalar216 );
/* find common exponent */
@@ -900,7 +906,11 @@ void minimum_statistics(
s2 = s_min( s2, WORD32_BITS - 1 );
/* beta: scaled by s2 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp16 = round_fx_sat( L_shl( tmp, s1 ) );
+#else
tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow );
+#endif
beta = mult_r( tmp16, tmp16 );
/* scalar3: scaled by s3 */
@@ -988,8 +998,13 @@ void minimum_statistics(
move32();
/* exponent msCurrentMinSubWindow[j]: CNG_S */
BASOP_SATURATE_WARNING_OFF_EVS;
+#ifdef ISSUE_1836_replace_overflow_libcom
+ msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 );
+ move32();
+#else
msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow );
move32();
+#endif
BASOP_SATURATE_WARNING_ON_EVS;
}
}
@@ -1246,10 +1261,12 @@ void minimum_statistics_fx(
Word16 msAlphaCorAlpha2;
Word16 msPeriodogSum16;
Word16 msNoiseFloor16;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
len2 = i_mult( MSNUMSUBFR, len );
@@ -1349,7 +1366,11 @@ void minimum_statistics_fx(
/* use absolute value to avoid -1.0 x -1.0 multiplications */
s2 = norm_l( scalar2 );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ scalar216 = round_fx_sat( L_shl( scalar2, s2 ) );
+#else
scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow );
+#endif
scalar2 = L_mult( scalar216, scalar216 );
/* find common exponent */
@@ -1506,7 +1527,11 @@ void minimum_statistics_fx(
s2 = s_min( s2, WORD32_BITS - 1 );
/* beta: scaled by s2 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp16 = round_fx_sat( L_shl( tmp, s1 ) );
+#else
tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow );
+#endif
beta = mult_r( tmp16, tmp16 );
/* scalar3: scaled by s3 */
@@ -1594,7 +1619,11 @@ void minimum_statistics_fx(
move32();
/* exponent msCurrentMinSubWindow[j]: CNG_S */
BASOP_SATURATE_WARNING_OFF_EVS;
+#ifdef ISSUE_1836_replace_overflow_libcom
+ msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 );
+#else
msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow );
+#endif
move32();
BASOP_SATURATE_WARNING_ON_EVS;
}
@@ -2279,7 +2308,7 @@ static void getmidbands(
)
{
Word16 j, max_psize, shift;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -2318,7 +2347,7 @@ static void getmidbands(
move16();
FOR( j = 0; j < npart; j++ )
{
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
psize_norm[j] = shl_sat( psize[j], shift ); // Q(15 - psize_norm_exp)
#else
psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp)
diff --git a/lib_com/fft_cldfb_fx.c b/lib_com/fft_cldfb_fx.c
index b26b1bc9f43782686e744fef2c90db2d70157cc9..d522751fe8b2b8d6ceecfc19b384b515c636bc2d 100644
--- a/lib_com/fft_cldfb_fx.c
+++ b/lib_com/fft_cldfb_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c
index b1323e1561fb770e3c82f94bda56b3ee5f696fba..018020cbed36c64ca5bc85d21147afdd3f4a6de2 100644
--- a/lib_com/fft_fx.c
+++ b/lib_com/fft_fx.c
@@ -30,13 +30,8 @@
*******************************************************************************************************/
-
-/*====================================================================================
- 3GPP TS26.258 Aug 24, 2023. IVAS Codec Version IVAS-FL-1.0
- ====================================================================================*/
-
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -46,7 +41,6 @@
#include "cnst.h"
#include "prot_fx.h"
#include "rom_com.h"
-#include "rom_com_fx.h"
#include "wmc_auto.h"
#include "complex_basop.h"
@@ -7174,7 +7168,6 @@ void rfft_fx(
#define WMC_TOOL_SKIP
-#define SHC( x ) ( (Word16) x )
#define FFTC( x ) WORD322WORD16( (Word32) x )
#define C81_FX ( FFTC( 0x5a82799a ) ) /* FL2WORD32( 7.071067811865475e-1) */
diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c
index b6f2bb2acee04e556e60e2a0cd36c85d7c81763d..221bdc533ad0a147d04d3109bbf49bf2e77debbe 100644
--- a/lib_com/fft_fx_evs.c
+++ b/lib_com/fft_fx_evs.c
@@ -1186,9 +1186,11 @@ static void fft5_32_16fx(
Word16 T1, To, T8, Tt, T9, Ts, Te, Tp, Th, Tn, T2, T3, T4, T5, T6, T7;
Word16 i0, i1, i2, i3, i4;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
i0 = Idx[0];
move16();
@@ -1216,9 +1218,15 @@ static void fft5_32_16fx(
move16();
T6 = zRe[i3];
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ T7 = add_sat( T5, T6 );
+ T8 = add_sat( T4, T7 );
+ Tt = sub_sat( T5, T6 );
+#else
T7 = add_o( T5, T6, &Overflow );
T8 = add_o( T4, T7, &Overflow );
Tt = sub_o( T5, T6, &Overflow );
+#endif
/* T9 = KP559016994 * (T4 - T7); */
L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x)
T9 = round_fx_sat( L_tmp ); // Qx
@@ -1240,11 +1248,17 @@ static void fft5_32_16fx(
L_tmp = Mult_32_16( KP559016994_16FX, sub_sat( T4, T7 ) ); // Q(16 +x)
Tn = round_fx_sat( L_tmp ); // Qx
-
+#ifdef ISSUE_1836_replace_overflow_libcom
+ zRe[i0] = add_sat( T1, T8 );
+ move16();
+ zIm[i0] = add_sat( To, Tp );
+ move32();
+#else
zRe[i0] = add_o( T1, T8, &Overflow );
move16();
zIm[i0] = add_o( To, Tp, &Overflow );
move32();
+#endif
/*T2 = KP951056516*Te + KP587785252*Th; */
L_tmp = Mult_32_16( KP951056516_16FX, Te ); // Q(16 +x)
@@ -1261,6 +1275,16 @@ static void fft5_32_16fx(
T4 = add_sat( T9, T6 );
T5 = sub_sat( T6, T9 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ zRe[i3] = sub_sat( T4, T2 );
+ move32();
+ zRe[i1] = add_sat( T5, T3 );
+ move32();
+ zRe[i2] = add_sat( T4, T2 );
+ move32();
+ zRe[i4] = sub_sat( T5, T3 );
+ move32();
+#else
zRe[i3] = sub_o( T4, T2, &Overflow );
move32();
zRe[i1] = add_o( T5, T3, &Overflow );
@@ -1269,6 +1293,7 @@ static void fft5_32_16fx(
move32();
zRe[i4] = sub_o( T5, T3, &Overflow );
move32();
+#endif
/* T2 = KP951056516 * Ts + KP587785252 * Tt; */
L_tmp = Mult_32_16( KP951056516_16FX, Ts ); // Q(16 +x)
@@ -1675,9 +1700,11 @@ static void cftfsub_16fx(
{
Word16 j, j1, j2, j3, l;
Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
l = 2;
@@ -1731,6 +1758,15 @@ static void cftfsub_16fx(
{
FOR( j = 0; j < l; j += 2 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ j1 = add_sat( j, l );
+ x0r = sub_sat( a[j], a[j1] );
+ x0i = sub_sat( a[j + 1], a[j1 + 1] );
+ a[j] = add_sat( a[j], a[j1] );
+ move16();
+ a[j + 1] = add_sat( a[j + 1], a[j1 + 1] );
+ move16();
+#else
j1 = add_o( j, l, &Overflow );
x0r = sub_o( a[j], a[j1], &Overflow );
x0i = sub_o( a[j + 1], a[j1 + 1], &Overflow );
@@ -1738,6 +1774,7 @@ static void cftfsub_16fx(
move16();
a[j + 1] = add_o( a[j + 1], a[j1 + 1], &Overflow );
move16();
+#endif
a[j1] = x0r;
move16();
a[j1 + 1] = x0i;
@@ -1762,11 +1799,84 @@ static void cft1st_16fx(
Word16 x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
Word16 tmp;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
+
+#ifdef ISSUE_1836_replace_overflow_libcom
+ x0r = add_sat( a[0], a[2] );
+ x0i = add_sat( a[1], a[3] );
+ x1r = sub_sat( a[0], a[2] );
+ x1i = sub_sat( a[1], a[3] );
+ x2r = add_sat( a[4], a[6] );
+ x2i = add_sat( a[5], a[7] );
+ x3r = sub_sat( a[4], a[6] );
+ x3i = sub_sat( a[5], a[7] );
+ a[0] = add_sat( x0r, x2r );
+ move16();
+ a[1] = add_sat( x0i, x2i );
+ move16();
+ a[4] = sub_sat( x0r, x2r );
+ move16();
+ a[5] = sub_sat( x0i, x2i );
+ move16();
+ a[2] = sub_sat( x1r, x3i );
+ move16();
+ a[3] = add_sat( x1i, x3r );
+ move16();
+ a[6] = add_sat( x1r, x3i );
+ move16();
+ a[7] = sub_sat( x1i, x3r );
+ wk1r = w[2];
+ move32();
+
+ x0r = add_sat( a[8], a[10] );
+ x0i = add_sat( a[9], a[11] );
+ x1r = sub_sat( a[8], a[10] );
+ x1i = sub_sat( a[9], a[11] );
+ x2r = add_sat( a[12], a[14] );
+ x2i = add_sat( a[13], a[15] );
+ x3r = sub_sat( a[12], a[14] );
+ x3i = sub_sat( a[13], a[15] );
+ a[8] = add_sat( x0r, x2r );
+ move16();
+ a[9] = add_sat( x0i, x2i );
+ move16();
+ a[12] = sub_sat( x2i, x0i );
+ move16();
+ a[13] = sub_sat( x0r, x2r );
+ move16();
+
+ x0r = sub_sat( x1r, x3i );
+ x0i = add_sat( x1i, x3r );
+ tmp = sub_sat( x0r, x0i );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+
+ a[10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+ tmp = add_sat( x0r, x0i );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+ a[11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /* Q(Qx+Q_edct)*/
+ move16();
+
+ x0r = add_sat( x3i, x1r );
+ x0i = sub_sat( x3r, x1i );
+ tmp = sub_sat( x0i, x0r );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+ a[14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ tmp = add_sat( x0i, x0r );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+ a[15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+ k1 = 0;
+ move16();
+#else
x0r = add_o( a[0], a[2], &Overflow );
x0i = add_o( a[1], a[3], &Overflow );
x1r = sub_o( a[0], a[2], &Overflow );
@@ -1836,6 +1946,7 @@ static void cft1st_16fx(
move16();
k1 = 0;
move16();
+#endif
FOR( j = 16; j < n; j += 16 )
{
@@ -1856,6 +1967,118 @@ static void cft1st_16fx(
L_tmp = L_shl( Mult_32_32( wk2i, wk1r ), 1 ); /*Q29 */
wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ x0r = add_sat( a[j], a[j + 2] );
+ x0i = add_sat( a[j + 1], a[j + 3] );
+ x1r = sub_sat( a[j], a[j + 2] );
+ x1i = sub_sat( a[j + 1], a[j + 3] );
+ x2r = add_sat( a[j + 4], a[j + 6] );
+ x2i = add_sat( a[j + 5], a[j + 7] );
+ x3r = sub_sat( a[j + 4], a[j + 6] );
+ x3i = sub_sat( a[j + 5], a[j + 7] );
+ a[j] = add_sat( x0r, x2r );
+ move16();
+ a[j + 1] = add_sat( x0i, x2i );
+ move16();
+
+ x0r = sub_sat( x0r, x2r );
+ x0i = sub_sat( x0i, x2i );
+ L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j + 4] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j + 5] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = sub_sat( x1r, x3i );
+ x0i = add_sat( x1i, x3r );
+ L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j + 2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j + 3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = add_sat( x1r, x3i );
+ x0i = sub_sat( x1i, x3r );
+ L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j + 6] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j + 7] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ wk1r = w[k2 + 2];
+ move32();
+ wk1i = w[k2 + 3];
+ move32();
+ L_tmp = L_shl( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */
+ wk3r = L_sub( wk1r, L_shl( L_tmp, 1 ) ); /*Q30 */
+
+ L_tmp = L_shl( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */
+ wk3i = L_sub( L_shl( L_tmp, 1 ), wk1i ); /*Q30 */
+
+ x0r = add_sat( a[j + 8], a[j + 10] );
+ x0i = add_sat( a[j + 9], a[j + 11] );
+ x1r = sub_sat( a[j + 8], a[j + 10] );
+ x1i = sub_sat( a[j + 9], a[j + 11] );
+ x2r = add_sat( a[j + 12], a[j + 14] );
+ x2i = add_sat( a[j + 13], a[j + 15] );
+ x3r = sub_sat( a[j + 12], a[j + 14] );
+ x3i = sub_sat( a[j + 13], a[j + 15] );
+ a[j + 8] = add_sat( x0r, x2r );
+ move16();
+ a[j + 9] = add_sat( x0i, x2i );
+ move16();
+
+ x0r = sub_sat( x0r, x2r );
+ x0i = sub_sat( x0i, x2i );
+ tmp = negate( x0r );
+ L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j + 12] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ tmp = negate( x0i );
+ L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j + 13] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = sub_sat( x1r, x3i );
+ x0i = add_sat( x1i, x3r );
+ L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j + 10] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j + 11] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = add_sat( x1r, x3i );
+ x0i = sub_sat( x1i, x3r );
+
+ L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j + 14] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j + 15] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+#else
x0r = add_o( a[j], a[j + 2], &Overflow );
x0i = add_o( a[j + 1], a[j + 3], &Overflow );
x1r = sub_o( a[j], a[j + 2], &Overflow );
@@ -1966,6 +2189,7 @@ static void cft1st_16fx(
L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */
a[j + 15] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */
move16();
+#endif
}
return;
@@ -1988,13 +2212,44 @@ static void cftmdl_16fx(
Word16 tmp, tmp2;
Word32 L_tmp;
Word32 L_x0r, L_x0i;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
m = shl( l, 2 );
FOR( j = 0; j < l; j += 2 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ j1 = add_sat( j, l );
+ j2 = add_sat( j1, l );
+ j3 = add_sat( j2, l );
+ x0r = add_sat( a[j], a[j1] );
+ x0i = add_sat( a[j + 1], a[j1 + 1] );
+ x1r = sub_sat( a[j], a[j1] );
+ x1i = sub_sat( a[j + 1], a[j1 + 1] );
+ x2r = add_sat( a[j2], a[j3] );
+ x2i = add_sat( a[j2 + 1], a[j3 + 1] );
+ x3r = sub_sat( a[j2], a[j3] );
+ x3i = sub_sat( a[j2 + 1], a[j3 + 1] );
+ a[j] = add_sat( x0r, x2r );
+ move16();
+ a[j + 1] = add_sat( x0i, x2i );
+ move16();
+ a[j2] = sub_sat( x0r, x2r );
+ move16();
+ a[j2 + 1] = sub_sat( x0i, x2i );
+ move16();
+ a[j1] = sub_sat( x1r, x3i );
+ move16();
+ a[j1 + 1] = add_sat( x1i, x3r );
+ move16();
+ a[j3] = add_sat( x1r, x3i );
+ move16();
+ a[j3 + 1] = sub_sat( x1i, x3r );
+ move16();
+#else
j1 = add_o( j, l, &Overflow );
j2 = add_o( j1, l, &Overflow );
j3 = add_o( j2, l, &Overflow );
@@ -2022,6 +2277,7 @@ static void cftmdl_16fx(
move16();
a[j3 + 1] = sub_o( x1i, x3r, &Overflow );
move16();
+#endif
}
wk1r = w[2];
@@ -2029,6 +2285,51 @@ static void cftmdl_16fx(
tmp2 = add( l, m );
FOR( j = m; j < tmp2; j += 2 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ j1 = add_sat( j, l );
+ j2 = add_sat( j1, l );
+ j3 = add_sat( j2, l );
+ x0r = add_sat( a[j], a[j1] );
+ x0i = add_sat( a[j + 1], a[j1 + 1] );
+ x1r = sub_sat( a[j], a[j1] );
+ x1i = sub_sat( a[j + 1], a[j1 + 1] );
+ x2r = add_sat( a[j2], a[j3] );
+ x2i = add_sat( a[j2 + 1], a[j3 + 1] );
+ x3r = sub_sat( a[j2], a[j3] );
+ x3i = sub_sat( a[j2 + 1], a[j3 + 1] );
+ a[j] = add_sat( x0r, x2r );
+ move16();
+ a[j + 1] = add_sat( x0i, x2i );
+ move16();
+ a[j2] = sub_sat( x2i, x0i );
+ move16();
+ a[j2 + 1] = sub_sat( x0r, x2r );
+ move16();
+
+ x0r = sub_sat( x1r, x3i );
+ x0i = add_sat( x1i, x3r );
+ tmp = sub_sat( x0r, x0i );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+ a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ tmp = add_sat( x0r, x0i );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+ a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = add_sat( x3i, x1r );
+ x0i = sub_sat( x3r, x1i );
+ tmp = sub_sat( x0i, x0r );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+ a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ tmp = add_sat( x0i, x0r );
+ L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
+ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+#else
j1 = add_o( j, l, &Overflow );
j2 = add_o( j1, l, &Overflow );
j3 = add_o( j2, l, &Overflow );
@@ -2072,6 +2373,7 @@ static void cftmdl_16fx(
L_tmp = Mult_32_16( wk1r, tmp ); /*Q(15+Qx+Q_edct) */
a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */
move16();
+#endif
}
k1 = 0;
@@ -2098,6 +2400,63 @@ static void cftmdl_16fx(
tmp2 = add( l, k );
FOR( j = k; j < tmp2; j += 2 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ j1 = add_sat( j, l );
+ j2 = add_sat( j1, l );
+ j3 = add_sat( j2, l );
+ x0r = add_sat( a[j], a[j1] );
+ x0i = add_sat( a[j + 1], a[j1 + 1] );
+ x1r = sub_sat( a[j], a[j1] );
+ x1i = sub_sat( a[j + 1], a[j1 + 1] );
+ x2r = add_sat( a[j2], a[j3] );
+ x2i = add_sat( a[j2 + 1], a[j3 + 1] );
+ x3r = sub_sat( a[j2], a[j3] );
+ x3i = sub_sat( a[j2 + 1], a[j3 + 1] );
+ a[j] = add_sat( x0r, x2r );
+ move16();
+ a[j + 1] = add_sat( x0i, x2i );
+ move16();
+
+ x0r = sub_sat( x0r, x2r );
+ x0i = sub_sat( x0i, x2i );
+
+ L_tmp = Mult_32_16( wk2r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk2i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk2r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk2i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = sub_sat( x1r, x3i );
+ x0i = add_sat( x1i, x3r );
+
+ L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_x0r = L_add( (Word32) x1r, (Word32) x3i );
+ L_x0i = L_sub( (Word32) x1i, (Word32) x3r );
+ x0r = extract_l( L_x0r );
+ x0i = extract_l( L_x0i );
+ L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+#else
j1 = add_o( j, l, &Overflow );
j2 = add_o( j1, l, &Overflow );
j3 = add_o( j2, l, &Overflow );
@@ -2153,20 +2512,88 @@ static void cftmdl_16fx(
L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */
a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */
move16();
+#endif
}
wk1r = w[k2 + 2];
move32();
wk1i = w[k2 + 3];
move32();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1i ), 1 ); /*Q29 */
+ wk3r = L_sub_sat( wk1r, L_shl_sat( L_tmp, 1 ) ); /*Q30 */
+
+ L_tmp = L_shl_sat( Mult_32_32( wk2r, wk1r ), 1 ); /*Q29 */
+ wk3i = L_sub_sat( L_shl_sat( L_tmp, 1 ), wk1i ); /*Q30 */
+ tmp2 = add( l, add( k, m ) );
+#else
L_tmp = L_shl_o( Mult_32_32( wk2r, wk1i ), 1, &Overflow ); /*Q29 */
wk3r = L_sub_o( wk1r, L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q30 */
L_tmp = L_shl_o( Mult_32_32( wk2r, wk1r ), 1, &Overflow ); /*Q29 */
wk3i = L_sub_o( L_shl_o( L_tmp, 1, &Overflow ), wk1i, &Overflow ); /*Q30 */
tmp2 = add( l, add( k, m ) );
+#endif
FOR( j = add( k, m ); j < tmp2; j += 2 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ j1 = add_sat( j, l );
+ j2 = add_sat( j1, l );
+ j3 = add_sat( j2, l );
+ x0r = add_sat( a[j], a[j1] );
+ x0i = add_sat( a[j + 1], a[j1 + 1] );
+ x1r = sub_sat( a[j], a[j1] );
+ x1i = sub_sat( a[j + 1], a[j1 + 1] );
+ x2r = add_sat( a[j2], a[j3] );
+ x2i = add_sat( a[j2 + 1], a[j3 + 1] );
+ x3r = sub_sat( a[j2], a[j3] );
+ x3i = sub_sat( a[j2 + 1], a[j3 + 1] );
+ a[j] = add_sat( x0r, x2r );
+ move16();
+ a[j + 1] = add_sat( x0i, x2i );
+ move16();
+
+ x0r = sub_sat( x0r, x2r );
+ x0i = sub_sat( x0i, x2i );
+
+ tmp = negate( x0r );
+ L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk2r, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j2] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ tmp = negate( x0i );
+ L_tmp = Mult_32_16( wk2i, tmp ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk2r, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j2 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = sub_sat( x1r, x3i );
+ x0i = add_sat( x1i, x3r );
+
+ L_tmp = Mult_32_16( wk1r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk1i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk1r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk1i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j1 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ x0r = add_sat( x1r, x3i );
+ x0i = sub_sat( x1i, x3r );
+
+ L_tmp = Mult_32_16( wk3r, x0r ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Msub_32_16( L_tmp, wk3i, x0i ); /*Q(15+Qx+Q_edct) */
+ a[j3] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+
+ L_tmp = Mult_32_16( wk3r, x0i ); /*Q(15+Qx+Q_edct) */
+ L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */
+ a[j3 + 1] = round_fx_sat( L_shl_sat( L_tmp, 1 ) ); /*Q(Qx+Q_edct) */
+ move16();
+#else
j1 = add_o( j, l, &Overflow );
j2 = add_o( j1, l, &Overflow );
j3 = add_o( j2, l, &Overflow );
@@ -2223,6 +2650,7 @@ static void cftmdl_16fx(
L_tmp = Madd_32_16( L_tmp, wk3i, x0r ); /*Q(15+Qx+Q_edct) */
a[j3 + 1] = round_fx_o( L_shl_o( L_tmp, 1, &Overflow ), &Overflow ); /*Q(Qx+Q_edct) */
move16();
+#endif
}
}
diff --git a/lib_com/fft_rel_fx.c b/lib_com/fft_rel_fx.c
index a0905cc1689e11358c49e235afd5c5c498cbdd96..9f8f0355684746df6a60744a31bcb3cbdbe1c6fa 100644
--- a/lib_com/fft_rel_fx.c
+++ b/lib_com/fft_rel_fx.c
@@ -468,231 +468,6 @@ void r_fft_fx_lc(
* ..., re[n/2], im[n/2-1], ..., im[1].
*---------------------------------------------------------------------*/
-void fft_rel(
- float x[], /* i/o: input/output vector */
- const int16_t n, /* i : vector length */
- const int16_t m /* i : log2 of vector length */
-)
-{
- int16_t i, j, k, n1, n2, n4;
- int16_t step;
- float xt, t1, t2;
- float *x0, *x1, *x2;
- float *xi2, *xi3, *xi4, *xi1;
- const float *s, *c;
- const int16_t *idx;
-
- /* !!!! NMAX = 256 is hardcoded here (similar optimizations should be done for NMAX > 256) !!! */
-
- float *x2even, *x2odd;
- float temp[512];
-
- if ( n == 128 || n == 256 || n == 512 )
- {
- idx = fft256_read_indexes;
-
- /* Combined Digit reverse counter & Length two butterflies */
- if ( n == 128 )
- {
- x2 = temp;
- for ( i = 0; i < 64; i++ )
- {
- j = *idx++;
- k = *idx++;
-
- *x2++ = x[j >> 1] + x[k >> 1];
- *x2++ = x[j >> 1] - x[k >> 1];
- }
- }
- else if ( n == 256 )
- {
- x2 = temp;
- for ( i = 0; i < 128; i++ )
- {
- j = *idx++;
- k = *idx++;
-
- *x2++ = x[j] + x[k];
- *x2++ = x[j] - x[k];
- }
- }
- else if ( n == 512 )
- {
- x2even = temp;
- x2odd = temp + 256;
-
- for ( i = 0; i < 128; i++ )
- {
- j = 2 * *idx++;
- k = 2 * *idx++;
-
- *x2even++ = x[j] + x[k];
- *x2even++ = x[j] - x[k];
- *x2odd++ = x[++j] + x[++k];
- *x2odd++ = x[j] - x[k];
- }
- }
-
- /*-----------------------------------------------------------------*
- * 1st Stage Loop has been Unrolled because n4 is '1' and that
- * allows the elimination of the 'for_ (j = 1; j < n4; j++)' loop
- * and the associated pointers initialization.
- * Also, it allows to Put the Data from 'temp' back into 'x' due
- * to the previous Combined Digit Reverse and Length two butterflies
- *-----------------------------------------------------------------*/
-
- /*for_ (k = 2; k < 3; k++)*/
- {
- x0 = temp;
- x1 = x0 + 2;
- x2 = x;
-
- for ( i = 0; i < n; i += 4 )
- {
- *x2++ = *x0++ + *x1; /* x[i] = xt + x[i+n2]; */
- *x2++ = *x0;
- *x2++ = *--x0 - *x1++; /* x[i+n2] = xt - x[i+n2]; */
- *x2++ = -*x1; /* x[i+n2+n4] = -x[i+n2+n4]; */
-
- x0 += 4;
- x1 += 3; /* x1 has already advanced */
- }
- }
- }
- else
- {
- /*-----------------------------------------------------------------*
- * Digit reverse counter
- *-----------------------------------------------------------------*/
-
- j = 0;
- x0 = &x[0];
- for ( i = 0; i < n - 1; i++ )
- {
- if ( i < j )
- {
- xt = x[j];
- x[j] = *x0;
- *x0 = xt;
- }
- x0++;
- k = n / 2;
- while ( k <= j )
- {
- j -= k;
- k = k >> 1;
- }
- j += k;
- }
-
- /*-----------------------------------------------------------------*
- * Length two butterflies
- *-----------------------------------------------------------------*/
-
- x0 = &x[0];
- x1 = &x[1];
- for ( i = 0; i < n / 2; i++ )
- {
- *x1 = *x0 - *x1;
- *x0 = *x0 * 2 - *x1;
-
- x0++;
- x0++;
- x1++;
- x1++;
- }
-
- /*-----------------------------------------------------------------*
- * 1st Stage Loop has been Unrolled because n4 is '1' and that
- * allows the elimination of the 'for_ (j = 1; j < n4; j++)' loop
- * and the associated pointers initialization.
- *-----------------------------------------------------------------*/
-
- /* for_ (k = 2; k < 3; k++) */
- {
- x0 = x;
- x1 = x0 + 2;
-
- for ( i = 0; i < n; i += 4 )
- {
- *x1 = *x0 - *x1; /* x[i+n2] = xt - x[i+n2]; */
- *x0 = *x0 * 2 - *x1++; /* x[i] = xt + x[i+n2]; */
- *x1 = -*x1; /* x[i+n2+n4] = -x[i+n2+n4]; */
-
- x0 += 4;
- x1 += 3; /* x1 has already advanced */
- }
- }
- }
-
- /*-----------------------------------------------------------------*
- * Other butterflies
- *
- * The implementation described in [1] has been changed by using
- * table lookup for evaluating sine and cosine functions. The
- * variable ind and its increment step are needed to access table
- * entries. Note that this implementation assumes n4 to be so
- * small that ind will never exceed the table. Thus the input
- * argument n and the constant N_MAX_FFT must be set properly.
- *-----------------------------------------------------------------*/
-
- n4 = 1;
- n2 = 2;
- n1 = 4;
-
- step = N_MAX_DIV4;
-
- for ( k = 3; k <= m; k++ )
- {
- step >>= 1;
- n4 <<= 1;
- n2 <<= 1;
- n1 <<= 1;
-
- x0 = x;
- x1 = x0 + n2;
- x2 = x1 + n4;
-
- for ( i = 0; i < n; i += n1 )
- {
- *x1 = *x0 - *x1; /* x[i+n2] = xt - x[i+n2]; */
- *x0 = *x0 * 2 - *x1; /* x[i] = xt + x[i+n2]; */
- *x2 = -*x2; /* x[i+n2+n4] = -x[i+n2+n4]; */
-
- s = sincos_t_ext;
- c = s + N_MAX_FFT / 4; /* 1024/4 = 256, 256/4=64 */
- xi1 = x0;
- xi3 = xi1 + n2;
- xi2 = xi3;
- x0 += n1;
- xi4 = x0;
-
- for ( j = 1; j < n4; j++ )
- {
- xi3++;
- xi1++;
- xi4--;
- xi2--;
- c += step;
- s += step; /* autoincrement by ar0 */
-
- t1 = *xi3 * *c + *xi4 * *s; /* t1 = *xi3**(pt_c+ind) + *xi4**(pt_s+ind); */
- t2 = *xi3 * *s - *xi4 * *c; /* t2 = *xi3**(pt_s+ind) - *xi4**(pt_c+ind); */
-
- *xi4 = *xi2 - t2;
- *xi2 = *xi1 - t1;
- *xi1 = *xi1 * 2 - *xi2;
- *xi3 = -2 * t2 - *xi4;
- }
-
- x1 += n1;
- x2 += n1;
- }
- }
-
- return;
-}
-
void fft_rel_16_32fx(
Word16 x[], /* i/o: input/output vector Qx */
Word16 *q_x, /* extra scaling added on speech buffer*/
diff --git a/lib_com/fill_spectrum_fx.c b/lib_com/fill_spectrum_fx.c
index bd9080a7bd41747ba25f9a5cecce507c5ac55e63..84d3127077201edd0c41ec9daacdf25850a91254 100644
--- a/lib_com/fill_spectrum_fx.c
+++ b/lib_com/fill_spectrum_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/findpulse_fx.c b/lib_com/findpulse_fx.c
index 68853e06142c91523103ce2ae595215b69bbe61c..7e0f535b37e9262d84da0a8592f3dd87401a306f 100644
--- a/lib_com/findpulse_fx.c
+++ b/lib_com/findpulse_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c
index f3dbe52bda5e7738bdd04a41f8d2902e9abcc027..1e58dafac01444883e6be23556c91bed98984fe1 100644
--- a/lib_com/frame_ener_fx.c
+++ b/lib_com/frame_ener_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -40,6 +40,7 @@
#include "cnst.h"
#include "prot_fx.h"
#include "wmc_auto.h"
+
/*----------------------------------------------------------------------------------*
* fer_energy()
*
@@ -239,14 +240,20 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8
const Word16 *pt1;
Word16 tmp16, exp1, exp2, tmp1, tmp2;
Word16 len, enern;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
/* len = (0.5f * (pitch[2]/64.0 + pitch[3]/64.0) + 0.5f) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ len = mult_r( add_sat( pitch[2], pitch[3] ), 256 );
+#else
len = mult_r( add_o( pitch[2], pitch[3], &Overflow ), 256 );
+#endif
if ( LT_16( len, L_SUBFR ) )
{
@@ -277,19 +284,28 @@ Word16 frame_energy_fx( /* o : Frame energy in Q8
/*add ld(2^exp1)=exp1 but check format, first*/
tmp16 = sub( sub( 15, norm_s( exp1 ) ), 5 ); /*factor to shift Ltmp and exp1 with (shr) to avoid overflows when adding*/
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
Ltmp = L_shr_sat( Ltmp, tmp16 ); /*Q25, tmp16*/
#else
- Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/
+ Ltmp = L_shr_o( Ltmp, tmp16, &Overflow ); /*Q25, tmp16*/
+#endif
+ exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Ltmp = L_add_sat( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ) ); /*Q25, tmp16, normalized*/
+#else
+ Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/
#endif
- exp2 = shr( exp1, tmp16 ); /*Q0 , tmp16*/
- Ltmp = L_add_o( Ltmp, L_shl( L_deposit_l( exp2 ), 25 ), &Overflow ); /*Q25, tmp16, normalized*/
/*make 10*log10 out of log2*/
- Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/
+ Ltmp = Mpy_32_16_1( Ltmp, LG10 ); /*Q25,tmp16 * Q13 = Q23, tmp16*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ *frame_ener = extract_h( L_shl_sat( Ltmp, add( tmp16, 1 ) ) ); /*Q8*/
+ move16();
+ enern = sub_sat( *frame_ener, lp_speech ); /*Q8*/
+#else
*frame_ener = extract_h( L_shl_o( Ltmp, add( tmp16, 1 ), &Overflow ) ); /*Q8*/
move16();
enern = sub_o( *frame_ener, lp_speech, &Overflow ); /*Q8*/
-
+#endif
return enern;
}
diff --git a/lib_com/get_gain_fx.c b/lib_com/get_gain_fx.c
index 8ec4f5a40314afa27263cb7a4a77d8a31dd8d53c..187339bf14b453c4115ef803c3622a271da8a4f5 100644
--- a/lib_com/get_gain_fx.c
+++ b/lib_com/get_gain_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -53,10 +53,12 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed)
{
Word32 tcorr, tener, Lgain;
Word16 exp_c, exp_e, exp, tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
tcorr = L_deposit_l( 0 );
@@ -70,8 +72,13 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed)
tcorr = Dot_product16HQ( 0, x, y, n, &exp_c );
tener = Dot_productSq16HQ( 0, y, n, &exp_e );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ BASOP_Util_Divide_MantExp( round_fx_sat( tcorr ), exp_c, s_max( round_fx_sat( tener ), 1 ), exp_e, &tmp, &exp );
+ Lgain = L_shl_sat( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ) ) /*Q16*/; //?sat
+#else
BASOP_Util_Divide_MantExp( round_fx_o( tcorr, &Overflow ), exp_c, s_max( round_fx_o( tener, &Overflow ), 1 ), exp_e, &tmp, &exp );
Lgain = L_shl_o( L_deposit_l( tmp ) /*Q15*/, add( 1, exp ), &Overflow ) /*Q16*/;
+#endif
return Lgain;
}
@@ -84,9 +91,11 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed)
{
Word32 tcorr, tener, Lgain;
Word16 m_corr, m_ener, negative, Q_corr, Q_ener;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
negative = 0;
@@ -130,7 +139,11 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed)
Q_corr = sub( Q_corr, Q_ener );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lgain = L_shl_sat( L_deposit_l( m_corr ), add( Q_corr, 1 ) ); /* Lgain in Q16 */
+#else
Lgain = L_shl_o( L_deposit_l( m_corr ), add( Q_corr, 1 ), &Overflow ); /* Lgain in Q16 */
+#endif
if ( negative != 0 )
{
diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c
index 0ce59482f1f0a3de6ed59c06bf4b5065ccda3166..59917f42cd3f464c94c1e40828518ba8b2b08440 100644
--- a/lib_com/gs_bitallocation_fx.c
+++ b/lib_com/gs_bitallocation_fx.c
@@ -77,8 +77,10 @@ void bands_and_bit_alloc_fx(
Word16 w_sum_bit;
(void) GSC_IVAS_mode;
(void) element_mode;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
nb_tot_bands = MBANDS_GN;
move16();
@@ -93,8 +95,12 @@ void bands_and_bit_alloc_fx(
set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k );
/* To adapt current energy band to PVQ freq band for sorting*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */
+#else
ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */
- Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */
+#endif
+ Copy( Ener_per_bd_iQ_tmp + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */
ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2];
move16();
IF( EQ_16( L_frame, L_FRAME16k ) )
diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c
index 9243f640e890348f577688a0dc77aff03e10a148..828d7933d88c0bd83373a22b1a85f50dc954664e 100644
--- a/lib_com/gs_bitallocation_ivas_fx.c
+++ b/lib_com/gs_bitallocation_ivas_fx.c
@@ -33,6 +33,7 @@ static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const
#define Q31_0_02 42949673 /* 0.02 */
#define Q31_0_17 365072220 /* 0.17 */
#define Q31_0_23 493921239 /* 0.23 */
+
/*-----------------------------------------------------------------*
* Local functions
*-----------------------------------------------------------------*/
@@ -105,8 +106,10 @@ void bands_and_bit_alloc_ivas_fx(
Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; /* Q18 */
Word16 w_sum_bit;
Word16 fzero_val;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
nb_tot_bands = MBANDS_GN;
move16();
@@ -120,7 +123,11 @@ void bands_and_bit_alloc_ivas_fx(
set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k );
/* To adapt current energy band to PVQ freq band for sorting*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ ener_vec[0] = add_sat( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1] ); /*Q12 */
+#else
ener_vec[0] = add_o( Ener_per_bd_iQ[0], Ener_per_bd_iQ[1], &Overflow ); /*Q12 */
+#endif
move16();
Copy( Ener_per_bd_iQ + 1, ener_vec, MBANDS_GN - 1 ); /*Q12 */
ener_vec[MBANDS_GN - 1] = ener_vec[MBANDS_GN - 2];
diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c
index d49a786f253e10c6f3e235d8bdc712d7bb96e78d..7f2cb7e63041dacfa43e2e7d95306083f7bcbbc0 100644
--- a/lib_com/gs_gains_fx.c
+++ b/lib_com/gs_gains_fx.c
@@ -84,9 +84,11 @@ void Comp_and_apply_gain_fx(
Word16 y_gain;
Word16 L16, frac, exp1, tmp_exp;
Word32 L32;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Recreate excitation for local synthesis and decoder */
@@ -108,9 +110,15 @@ void Comp_and_apply_gain_fx(
FOR( i = StartBin; i < NB_Qbins + StartBin; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L32 = L_shl_sat( L_mult( exc_diffQ[i], y_gain ), tmp_exp ); /*Q_exc+16 */
+ exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc */
+ move16();
+#else
L32 = L_shl_o( L_mult( exc_diffQ[i], y_gain ), tmp_exp, &Overflow ); /*Q_exc+16 */
exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc */
move16();
+#endif
}
}
ELSE
@@ -126,7 +134,7 @@ void Comp_and_apply_gain_fx(
y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
/* output of Pow2() will be: */
/* 16384 < Pow2() <= 32767 */
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) );
#else
Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow );
@@ -136,8 +144,12 @@ void Comp_and_apply_gain_fx(
FOR( i = StartBin; i < NB_Qbins + StartBin; i++ )
{
- L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */
+ L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc_diffQ[i] = round_fx_sat( L_shl_sat( L32, tmp_exp ) ); /*Q_exc */
+#else
exc_diffQ[i] = round_fx_o( L_shl_o( L32, tmp_exp, &Overflow ), &Overflow ); /*Q_exc */
+#endif
move16();
}
}
@@ -161,9 +173,11 @@ void Comp_and_apply_gain_ivas_fx(
Word16 L16, frac, exp1, tmp_exp;
Word32 L32;
Word16 Q_exc_diffQ[L_FRAME16k];
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Recreate excitation for local synthesis and decoder */
@@ -185,8 +199,12 @@ void Comp_and_apply_gain_ivas_fx(
FOR( i = StartBin; i < NB_Qbins + StartBin; i++ )
{
- L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */
- exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */
+ L32 = L_mult( exc_diffQ[i], y_gain ); /*Q_exc+16-tmp_exp */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */
+#else
+ exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */
+#endif
move16();
IF( exc_diffQ[i] )
{
@@ -212,18 +230,22 @@ void Comp_and_apply_gain_ivas_fx(
y_gain = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
/* output of Pow2() will be: */
/* 16384 < Pow2() <= 32767 */
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) ); /*Q13*/
#else
- Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/
+ Ener_per_bd_yQ[i_band] = shl_o( y_gain, sub( exp1, 13 ), &Overflow ); /*Q13*/
#endif
move16(); /*Q1 */
tmp_exp = add( add( exp1, 1 ), sub( *Q_exc, Qexc_diff ) );
FOR( i = StartBin; i < NB_Qbins + StartBin; i++ )
{
- L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */
- exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */
+ L32 = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc_diffQ[i] = round_fx_sat( L32 ); /*Q_exc-tmp_exp */
+#else
+ exc_diffQ[i] = round_fx_o( L32, &Overflow ); /*Q_exc-tmp_exp */
+#endif
move16();
IF( exc_diffQ[i] )
{
diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c
index 53fb676016460d2c8dac74880b4f5da6eb608564..5b8c545410e71759371c36ee4bca56fdfdd0a689 100644
--- a/lib_com/gs_noisefill_fx.c
+++ b/lib_com/gs_noisefill_fx.c
@@ -411,9 +411,11 @@ static void Decreas_freqPeak_fx(
Word16 lsf_new_diff[M];
Word16 tmp, tmp1, exp;
Word16 tmp2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
move16(); /*ptr init*/
lsf_new_diff[0] = 0; /* prevent unitialized value */
@@ -470,11 +472,15 @@ static void Decreas_freqPeak_fx(
{
tmp = abs_s( *src );
exp = norm_s( max_val );
- tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */
- L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */
+ tmp1 = div_s( shl( 1, sub( 14, exp ) ), max_val ); /*Q(29 - exp - Q_exc) */
+ L_tmp = L_mult( tmp, tmp1 ); /*Q(30 - exp) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q14 */
+#else
tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q14 */
- tmp = sub( 32767, tmp ); /*Q14 */
- L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */
+#endif
+ tmp = sub( 32767, tmp ); /*Q14 */
+ L_tmp = L_mult( avrg, tmp ); /*Q_exc +15 */
tmp = round_fx( L_shl( L_tmp, 1 ) );
tmp1 = negate( tmp );
@@ -528,9 +534,11 @@ static void envelop_modify_fx(
Word16 weight_fx;
Word32 L_exc_diffQ_fx[L_FRAME16k], exc_diffQ_max;
Word16 Q_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
start_band = i_mult( last_bin, 16 );
@@ -565,10 +573,10 @@ static void envelop_modify_fx(
/* output of Pow2() will be: */
/* 16384 < Pow2() <= 32767 */
exp = sub( exp, 14 );
-#ifdef ISSUE_1796_replace_shl_o
- Ener1_fx = mult_ro( 13107, shl_sat( tmp, exp ), &Overflow ); /*Q0 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */
#else
- Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */
+ Ener1_fx = mult_ro( 13107, shl_o( tmp, exp, &Overflow ), &Overflow ); /*Q0 */
#endif
FOR( j = 0; j < 16; j++ )
@@ -595,10 +603,10 @@ static void envelop_modify_fx(
/* output of Pow2() will be: */
/* 16384 < Pow2() <= 32767 */
exp = sub( exp, 14 );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
Ener1_fx = mult_r( 13107, shl_sat( tmp, exp ) ); /*Q0 */
#else
- Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */
+ Ener1_fx = mult_r( 13107, shl_o( tmp, exp, &Overflow ) ); /*Q0 */
#endif
src_fx = &exc_diffQ_fx[224];
@@ -698,9 +706,11 @@ void highband_exc_dct_in_fx(
Word16 frac, exp, tmp1;
Word16 tmp2;
Word16 *end, Q_hb_exc;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
FOR( j = 10; j < MBANDS_GN; j++ )
@@ -716,13 +726,15 @@ void highband_exc_dct_in_fx(
/* output of Pow2() will be: */
/* 16384 < Pow2() <= 32767 */
exp = sub( exp, 14 );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp1 = shl_sat( tmp, exp );
+ move16();
+ ener = add_sat( tmp1, ener ); /*Q0 */
#else
tmp1 = shl_o( tmp, exp, &Overflow );
-#endif
move16();
- ener = add_o( tmp1, ener, &Overflow ); /*Q0 */
+ ener = add_o( tmp1, ener, &Overflow ); /*Q0 */
+#endif
}
test();
@@ -951,10 +963,14 @@ void highband_exc_dct_in_fx(
FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ )
{
/*exc_dct_in[i] *= (0.067f*i-15.f); */
- tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */
- tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */
- L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */
- exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */
+ tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */
+ tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */
+ L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */
+#else
+ exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */
+#endif
}
}
@@ -989,9 +1005,15 @@ void highband_exc_dct_in_fx(
IF( GT_16( tmp, abs_s( *dst ) ) )
{
tmp2 = *src;
+#ifdef ISSUE_1836_replace_overflow_libcom
+ *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */
+ move16();
+ tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */
+#else
*src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */
move16();
tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */
+#endif
if ( tmp2 > 0 )
{
*src = tmp;
@@ -1080,9 +1102,11 @@ void highband_exc_dct_in_ivas_fx(
Word16 frac, exp, tmp1;
Word16 tmp2;
Word16 *end, Q_hb_exc;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
FOR( j = 10; j < MBANDS_GN; j++ )
@@ -1098,13 +1122,15 @@ void highband_exc_dct_in_ivas_fx(
/* output of Pow2() will be: */
/* 16384 < Pow2() <= 32767 */
exp = sub( exp, 14 );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp1 = shl_sat( tmp, exp );
+ move16();
+ ener = add_sat( tmp1, ener ); /*Q0 */
#else
tmp1 = shl_o( tmp, exp, &Overflow );
-#endif
move16();
- ener = add_o( tmp1, ener, &Overflow ); /*Q0 */
+ ener = add_o( tmp1, ener, &Overflow ); /*Q0 */
+#endif
}
test();
@@ -1448,10 +1474,14 @@ void highband_exc_dct_in_ivas_fx(
FOR( i = sub( L_FRAME, 16 ); i < L_FRAME; i++ )
{
/*exc_dct_in[i] *= (0.067f*i-15.f); */
- tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */
- tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */
- L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */
- exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */
+ tmp = mult_r( 17564, shl( i, 6 ) ); /*0.067 in Q18 and i in Q6= Q9 */
+ tmp = sub( tmp, 7680 ); /*15 in Q9 = Q9 */
+ L_tmp = L_mult( exc_dct_in[i], tmp ); /*Q(Q_exc+10) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc_dct_in[i] = round_fx_sat( L_shl_sat( L_tmp, 6 ) ); /*Q_exc */
+#else
+ exc_dct_in[i] = round_fx_o( L_shl_o( L_tmp, 6, &Overflow ), &Overflow ); /*Q_exc */
+#endif
}
}
@@ -1486,9 +1516,15 @@ void highband_exc_dct_in_ivas_fx(
IF( GT_16( tmp, abs_s( *dst ) ) )
{
tmp2 = *src;
+#ifdef ISSUE_1836_replace_overflow_libcom
+ *src = mult_r( 16384, sub_sat( *src, abs_s( *dst ) ) ); /*Q_exc */
+ move16();
+ tmp = mult_r( 16384, add_sat( tmp2, abs_s( *dst ) ) ); /*Q_exc */
+#else
*src = mult_r( 16384, sub_o( *src, abs_s( *dst ), &Overflow ) ); /*Q_exc */
move16();
tmp = mult_r( 16384, add_o( tmp2, abs_s( *dst ), &Overflow ) ); /*Q_exc */
+#endif
IF( tmp2 > 0 )
{
*src = tmp;
diff --git a/lib_com/gs_preech_fx.c b/lib_com/gs_preech_fx.c
index 16d3ce0e51bc79ee06acccdeaac96b3c6a8b737d..e607d66c50a2dc636e3b16714b8b953a0f781391 100644
--- a/lib_com/gs_preech_fx.c
+++ b/lib_com/gs_preech_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/hp50_fx.c b/lib_com/hp50_fx.c
index 0e412f70d6e618f6ea2154250a2a92640c7deadb..9d6f10ed2533a1b6c8028e3851235b18ae91e63f 100644
--- a/lib_com/hp50_fx.c
+++ b/lib_com/hp50_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -40,8 +40,8 @@
#include "prot_fx.h"
#include "wmc_auto.h"
-
-#define HP20_COEFF_SCALE ( 2 )
+#define HP20_COEFF_SCALE ( 2 )
+#define HP20_FX_COEFF_SCALE ( 1 )
/*
* hp20
*
@@ -86,9 +86,11 @@ static void filter_2nd_order(
Word16 i;
Word16 x2, x1;
Word32 L_sum, L_y1, L_y2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
/*
@@ -107,10 +109,18 @@ static void filter_2nd_order(
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[0], a2 ) ); /* y2*a2 */
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a1 ) ); /* y1*a1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE );
+ BASOP_SATURATE_ERROR_OFF_EVS
+ BASOP_SATURATE_WARNING_OFF_EVS
+ signal[0] = round_fx_sat( L_shl_sat( L_y2, prescale ) );
+#else
L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow );
BASOP_SATURATE_ERROR_OFF_EVS
BASOP_SATURATE_WARNING_OFF_EVS
signal[0] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow );
+#endif
+
BASOP_SATURATE_WARNING_ON_EVS
BASOP_SATURATE_ERROR_ON_EVS
@@ -121,10 +131,17 @@ static void filter_2nd_order(
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( mem[1], a2 ) ); /* y2*a2 */
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) ); /* y1*a1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE );
+ BASOP_SATURATE_ERROR_OFF_EVS
+ BASOP_SATURATE_WARNING_OFF_EVS
+ signal[stride] = round_fx_sat( L_shl_sat( L_y1, prescale ) );
+#else
L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow );
BASOP_SATURATE_ERROR_OFF_EVS
BASOP_SATURATE_WARNING_OFF_EVS
signal[stride] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow );
+#endif
BASOP_SATURATE_WARNING_ON_EVS
move16();
@@ -140,10 +157,17 @@ static void filter_2nd_order(
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a2 ) );
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a1 ) );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_y2 = L_shl_sat( L_sum, HP20_COEFF_SCALE );
+ BASOP_SATURATE_ERROR_OFF_EVS
+ BASOP_SATURATE_WARNING_OFF_EVS
+ signal[i_mult( i, stride )] = round_fx_sat( L_shl_sat( L_y2, prescale ) );
+#else
L_y2 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow );
BASOP_SATURATE_ERROR_OFF_EVS
BASOP_SATURATE_WARNING_OFF_EVS
signal[i_mult( i, stride )] = round_fx_o( L_shl_o( L_y2, prescale, &Overflow ), &Overflow );
+#endif
BASOP_SATURATE_WARNING_ON_EVS
/* y[i+1] = b2*x[i-1] + b1*x[i-0] + b2*x[i+1] + a2*y[i-1] + a1*y[i+0]; */
BASOP_SATURATE_ERROR_ON_EVS
@@ -154,10 +178,17 @@ static void filter_2nd_order(
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y1, a2 ) );
L_sum = L_add( L_sum, HP50_Mpy_32_32_fix( L_y2, a1 ) );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_y1 = L_shl_sat( L_sum, HP20_COEFF_SCALE );
+ BASOP_SATURATE_ERROR_OFF_EVS
+ BASOP_SATURATE_WARNING_OFF_EVS
+ signal[i_mult( add( i, 1 ), stride )] = round_fx_sat( L_shl_sat( L_y1, prescale ) );
+#else
L_y1 = L_shl_o( L_sum, HP20_COEFF_SCALE, &Overflow );
BASOP_SATURATE_ERROR_OFF_EVS
BASOP_SATURATE_WARNING_OFF_EVS
signal[i_mult( add( i, 1 ), stride )] = round_fx_o( L_shl_o( L_y1, prescale, &Overflow ), &Overflow );
+#endif
BASOP_SATURATE_WARNING_ON_EVS
move16();
}
@@ -190,9 +221,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any *
{
Word32 a1, b1, a2, b2;
Word16 prescale, prescaleOld, diff;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
prescale = getScaleFactor16( signal, lg );
@@ -202,7 +235,11 @@ void hp20( Word16 signal[], /* i/o: signal to filter any *
{
prescale = s_min( prescale, diff );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ diff = norm_l( L_shl_sat( mem[3], prescaleOld ) );
+#else
diff = norm_l( L_shl_o( mem[3], prescaleOld, &Overflow ) );
+#endif
if ( mem[3] != 0 )
{
prescale = s_min( prescale, diff );
@@ -212,27 +249,21 @@ void hp20( Word16 signal[], /* i/o: signal to filter any *
IF( prescale != prescaleOld )
{
diff = sub( prescale, prescaleOld );
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
mem[0] = L_shr_sat( mem[0], diff );
-#else
- mem[0] = L_shr_o( mem[0], diff, &Overflow );
-#endif
move32();
-#ifdef ISSUE_1799_replace_L_shr_o
mem[1] = L_shr_sat( mem[1], diff );
-#else
- mem[1] = L_shr_o( mem[1], diff, &Overflow );
-#endif
move32();
-#ifdef ISSUE_1799_replace_L_shr_o
mem[2] = L_shr_sat( mem[2], diff );
+ move32();
+ mem[3] = L_shr_sat( mem[3], diff ); //?sat
#else
+ mem[0] = L_shr_o( mem[0], diff, &Overflow );
+ move32();
+ mem[1] = L_shr_o( mem[1], diff, &Overflow );
+ move32();
mem[2] = L_shr_o( mem[2], diff, &Overflow );
-#endif
move32();
-#ifdef ISSUE_1799_replace_L_shr_o
- mem[3] = L_shr_sat( mem[3], diff );
-#else
mem[3] = L_shr_o( mem[3], diff, &Overflow );
#endif
move32();
@@ -310,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[],
@@ -318,52 +349,49 @@ void hp20_fx_32(
{
Word32 i;
Word32 a1_fx, a2_fx, b1_fx, b2_fx;
- Word32 diff_pos, diff_neg;
- Flag Overflow = 0;
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] );
- 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 ) );
+ 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_max( diff_pos, diff_neg );
+ diff = L_norm_arr( tmp_mem, 4 );
- IF( NE_16( diff, 0 ) )
+ prescale = s_min( prescale, diff );
+
+ prescale = sub( 1 + HP20_FX_COEFF_SCALE, prescale );
+
+ 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_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
mem_fx[0] = L_shr_sat( mem_fx[0], diff );
-#else
- mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow );
-#endif
- move32();
-#ifdef ISSUE_1799_replace_L_shr_o
mem_fx[1] = L_shr_sat( mem_fx[1], diff );
-#else
- mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow );
-#endif
- move32();
-#ifdef ISSUE_1799_replace_L_shr_o
mem_fx[2] = L_shr_sat( mem_fx[2], diff );
-#else
- mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow );
-#endif
- move32();
-#ifdef ISSUE_1799_replace_L_shr_o
mem_fx[3] = L_shr_sat( mem_fx[3], diff );
#else
+ mem_fx[0] = L_shr_o( mem_fx[0], diff, &Overflow );
+ mem_fx[1] = L_shr_o( mem_fx[1], diff, &Overflow );
+ mem_fx[2] = L_shr_o( mem_fx[2], diff, &Overflow );
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();
@@ -374,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 ) )
{
@@ -385,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 ) )
{
@@ -396,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
{
@@ -407,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();
@@ -419,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 );
@@ -447,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;
@@ -469,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;
@@ -481,7 +509,7 @@ void hp20_fx_32(
return;
}
-#else
+#endif
void hp20_fx_32(
Word32 signal_fx[],
const Word16 lg,
@@ -666,4 +694,3 @@ void hp20_fx_32(
return;
}
-#endif
diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c
index 61d00ce987958b6092975f5464c0108192b6ea7b..868617b84d4ec48060a84489d7e8083584a7d995 100644
--- a/lib_com/hq2_bit_alloc_fx.c
+++ b/lib_com/hq2_bit_alloc_fx.c
@@ -312,9 +312,11 @@ void hq2_bit_alloc_har_fx(
Word16 exp_shift;
+#ifndef ISSUE_1836_replace_overflow_libcom
Flag Overflow;
Overflow = 0;
move32();
+#endif
L_THR1 = L_shl( L_deposit_l( THR1 ), SWB_BWE_LR_QRk );
L_THR2 = L_shl( L_deposit_l( THR2 ), SWB_BWE_LR_QRk );
@@ -570,9 +572,13 @@ void hq2_bit_alloc_har_fx(
L_temp = Mult_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */
L_temp = Mult_32_16( L_temp, Inv_norm_sum_fx ); /* Qbe+1+QIpb+1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ lf_hf_ge_r_fx = round_fx_sat( L_shl_sat( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) );
+#else
lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow );
Overflow = 0; /* reset BASOP Overflow */
move32();
+#endif
exp_normn = norm_s( norm_sum_fx );
exp_normn = sub( exp_normn, 1 );
diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c
index 9017903c831ba270f320458e50d37c1056a91bd7..d6606178d4ab0a6e2351f70f98e1e6f25feb6cf0 100644
--- a/lib_com/hq2_core_com_fx.c
+++ b/lib_com/hq2_core_com_fx.c
@@ -88,9 +88,11 @@ void mdct_spectrum_denorm_fx(
Word16 cond_fx;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16(); /* allow overflow happen. */
+#endif
#endif
exp_safe = 4; /* safe bit for overflow */
@@ -163,12 +165,12 @@ void mdct_spectrum_denorm_fx(
pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_norm - exp_normd) */
Qpd = add( sub( exp_normn, exp_normd ), 15 );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */
#else
cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */
-#endif
Overflow = 0;
+#endif
move16(); /* allow overflow happen. */
IF( cond_fx < 0 )
{
@@ -200,7 +202,11 @@ void mdct_spectrum_denorm_fx(
/*gamma *= gain_tweak; */
L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */
exp_norm = norm_l( L_tmp );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) );
+#else
gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow );
+#endif
Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */
}
@@ -264,9 +270,11 @@ void mdct_spectrum_denorm_ivas_fx(
Word16 cond_fx;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16(); /* allow overflow happen. */
+#endif
#endif
exp_safe = 4; /* safe bit for overflow */
@@ -339,12 +347,12 @@ void mdct_spectrum_denorm_ivas_fx(
pd_fx = div_s( shl( npulses[k], exp_normn ), shl( band_width[k], exp_normd ) ); /* 15 + (exp_normn + exp_normd) */
Qpd = add( sub( exp_normn, exp_normd ), 15 );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
cond_fx = sub( shl_sat( pd_fx, sub( 15, Qpd ) ), pd_thresh_fx /*Q15*/ ); /* Q15 */
#else
cond_fx = sub( shl_o( pd_fx, sub( 15, Qpd ), &Overflow ), pd_thresh_fx /*Q15*/ ); /* Q15 */
-#endif
Overflow = 0;
+#endif
move16(); /* allow overflow happen. */
IF( cond_fx < 0 )
{
@@ -376,7 +384,11 @@ void mdct_spectrum_denorm_ivas_fx(
/*gamma *= gain_tweak; */
L_tmp = L_mult( gamma_fx, gain_tweak_fx ); /* Qgamma+Qtweak+1 */
exp_norm = norm_l( L_tmp );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gamma_fx = round_fx_sat( L_shl( L_tmp, exp_norm ) );
+#else
gamma_fx = round_fx_o( L_shl_o( L_tmp, exp_norm, &Overflow ), &Overflow );
+#endif
Qgamma = sub( add( add( Qgamma, Qtweak ), exp_norm ), 15 ); /*Qgamma+Qtweak+1+exp_norm-16; */
}
diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c
index db1099809b92786326e95362ef54bbdcbc7c9341..9f013a3b0df3c7101f8ff8db272e84ad1338dc29 100644
--- a/lib_com/hq2_noise_inject_fx.c
+++ b/lib_com/hq2_noise_inject_fx.c
@@ -80,9 +80,11 @@ void hq2_noise_inject_fx(
Word16 i, j, k, ni_end_band, satur, count[BANDS_MAX], max_pos_pulse, pos;
Word16 sb = bands;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
satur = 0;
@@ -90,7 +92,11 @@ void hq2_noise_inject_fx(
FOR( i = 0; i < bands; i++ )
{
- Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Ep_fx[i] = L_shl_sat( Ep_fx[i], 6 ); /* Q-6 -> Q0 */
+#else
+ Ep_fx[i] = L_shl_o( Ep_fx[i], 6, &Overflow ); /* Q-6 -> Q0 */
+#endif
move32();
}
@@ -155,7 +161,11 @@ void hq2_noise_inject_fx(
Q_env_fx[k] = sub( 31, exp2 );
move16();
tmp = sub( 17, Q_env_fx[k] );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ env_fx2[k] = extract_h( L_shl_sat( env_fx[k], tmp ) ); /*Q1 */
+#else
env_fx2[k] = extract_h( L_shl_o( env_fx[k], tmp, &Overflow ) ); /*Q1 */
+#endif
peak_fx[k] = 0;
move16();
count[k] = 0;
@@ -166,7 +176,11 @@ void hq2_noise_inject_fx(
FOR( i = band_start[k]; i <= band_end[k]; i++ )
{
L_tmp = L_mult0( y2hat_fx[i], y2hat_fx[i] ); /* Q0 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Ep_fx[k] = L_sub_sat( Ep_fx[k], L_tmp );
+#else
Ep_fx[k] = L_sub_o( Ep_fx[k], L_tmp, &Overflow );
+#endif
move32(); /* Q0 */
IF( GT_16( abs_s( y2hat_fx[i] ), peak_fx[k] ) )
{
@@ -386,8 +400,12 @@ void hq2_noise_inject_fx(
}
ELSE IF( count[k - 1] == 0 && tmp4 > 0 )
{
- L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */
+ L_tmp = L_mult( env_fx2[k - 1], tmp ); /* Q(1+Q_speech+1 = Q_speech+2) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ fac_fx = extract_h( L_shl_sat( L_tmp, sub( 26, Q_speech ) ) ); /*Q12 */
+#else
fac_fx = extract_h( L_shl_o( L_tmp, sub( 26, Q_speech ), &Overflow ) ); /*Q12 */
+#endif
}
}
@@ -467,7 +485,7 @@ void hq2_noise_inject_fx(
}
L_tmp = Mult_32_16( Ep_fx[k], fac_fx ); /*Q(Q_Ep_fx[k]+12-15 = Q_Ep_fx[k]-3) */
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
ni_gain_fx[k] = L_shr_sat( L_tmp, sub( Q_Ep_fx[k], 20 ) );
#else
ni_gain_fx[k] = L_shr_o( L_tmp, sub( Q_Ep_fx[k], 20 ), &Overflow );
@@ -593,14 +611,22 @@ void hq2_noise_inject_fx(
L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+28-Q_speech-15 = Q_Ep_fx[k]+13-Q_speech) */
tmp = sub( Q_Ep_fx[k], Q_speech );
tmp = sub( 15, tmp );
- tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */
+#else
+ tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */
+#endif
}
ELSE
{
tmp = 0x7fff; /*Q0 */
L_tmp = Mult_32_16( Ep_fx[k], tmp ); /*Q(Q_Ep_fx[k]+0-15 = Q_Ep_fx[k]-15) */
tmp = sub( 43, Q_Ep_fx[k] );
- tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = extract_h( L_shl_sat( L_tmp, tmp ) ); /*Q12 */
+#else
+ tmp = extract_h( L_shl_o( L_tmp, tmp, &Overflow ) ); /*Q12 */
+#endif
}
fac_fx = s_max( tmp, 4096 /* 1 in Q12 */ ); /*Q12 */
@@ -612,10 +638,10 @@ void hq2_noise_inject_fx(
IF( band_width[k] != 0 )
{
Q_speech = norm_s( band_width[k] );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp = shl_sat( band_width[k], Q_speech ); /*Q(Q_speech) */
#else
- tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */
+ tmp = shl_o( band_width[k], Q_speech, &Overflow ); /*Q(Q_speech) */
#endif
tmp = div_s( 16384 /* 0.5 in Q15 */, tmp ); /*Q(15+14-Q_speech) */
}
@@ -626,12 +652,16 @@ void hq2_noise_inject_fx(
move16();
move16();
}
- tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */
- L_tmp = L_mult( tmp1, j ); /*Q13 */
- L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */
+ tmp1 = sub( fac_fx, 4096 /* 1 in Q12 */ ); /*Q12 */
+ L_tmp = L_mult( tmp1, j ); /*Q13 */
+ L_tmp = Mult_32_16( L_tmp, tmp ); /*Q(13+29-Q_speech-15 = 27-Q_speech) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = extract_h( L_shl_sat( L_tmp, add( 1, Q_speech ) ) ); /*Q12 */
+#else
tmp = extract_h( L_shl_o( L_tmp, add( 1, Q_speech ), &Overflow ) ); /*Q12 */
- tmp = sub( fac_fx, tmp ); /*Q12 */
- L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */
+#endif
+ tmp = sub( fac_fx, tmp ); /*Q12 */
+ L_tmp = Mult_32_16( ni_gain_fx[k], tmp ); /*Q(17+12-15=14) */
L_y2[i] = L_add( L_y2[i], L_shr( Mult_32_16( L_tmp, rand_fx ), 2 ) );
move32(); /*Q12 */
}
diff --git a/lib_com/ifft_rel_fx.c b/lib_com/ifft_rel_fx.c
index b372e15f3afc5251577a044e3b8fc8f532fd1dd0..2cc96b0c9eec70660930265cb76e1219b32d493b 100644
--- a/lib_com/ifft_rel_fx.c
+++ b/lib_com/ifft_rel_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -39,6 +39,7 @@
#include "prot_fx.h"
#include "rom_com.h"
#include "wmc_auto.h"
+
/*-----------------------------------------------------------------*
* Local constants
*-----------------------------------------------------------------*/
@@ -77,10 +78,12 @@ void ifft_rel_fx(
Word16 cc1, cc3, ss1, ss3;
Word16 tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
#endif
+#endif
/*-----------------------------------------------------------------*
@@ -108,30 +111,43 @@ void ifft_rel_fx(
FOR( i = is; i < n; i += id )
{
- t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/
- *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t1 = sub_sat( *xi1, *xi3 ); /*Qx*/
+ *xi1 = add_sat( *xi1, *xi3 ); /*Qx*/
move16();
-#ifdef ISSUE_1796_replace_shl_o
*xi2 = shl_sat( *xi2, 1 ); /*Qx*/
-#else
- *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/
-#endif
move16();
-#ifdef ISSUE_1796_replace_shl_o
- *xi3 = sub_o( t1, shl_sat( *xi4, 1 ), &Overflow ); /*Qx*/
-#else
- *xi3 = sub_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/
-#endif
+ *xi3 = sub_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/
+ move16();
+ *xi4 = add_sat( t1, shl_sat( *xi4, 1 ) ); /*Qx*/
move16();
-#ifdef ISSUE_1796_replace_shl_o
- *xi4 = add_o( t1, shl_sat( *xi4, 1 ), &Overflow ); /*Qx*/
#else
- *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/
-#endif
+ t1 = sub_o( *xi1, *xi3, &Overflow ); /*Qx*/
+ *xi1 = add_o( *xi1, *xi3, &Overflow ); /*Qx*/
+ move16();
+ *xi2 = shl_o( *xi2, 1, &Overflow ); /*Qx*/
+ move16();
+ *xi3 = sub_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/
move16();
+ *xi4 = add_o( t1, shl_o( *xi4, 1, &Overflow ), &Overflow ); /*Qx*/
+ move16();
+#endif
IF( NE_16( n4, 1 ) )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t1 = mult_r( sub_sat( *( xi2 + n8 ), *( xi1 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/
+ t2 = mult_r( add_sat( *( xi4 + n8 ), *( xi3 + n8 ) ), INV_SQR2_FX /*Q15*/ ); /*Qx*/
+
+ *( xi1 + n8 ) = add_sat( *( xi1 + n8 ), *( xi2 + n8 ) ); /*Qx*/
+ move16();
+ *( xi2 + n8 ) = sub_sat( *( xi4 + n8 ), *( xi3 + n8 ) ); /*Qx*/
+ move16();
+ *( xi3 + n8 ) = negate( shl_sat( add_sat( t2, t1 ), 1 ) ); /*Qx*/
+ move16();
+ *( xi4 + n8 ) = shl_sat( sub_sat( t1, t2 ), 1 ); /*Qx*/
+ move16();
+#else
t1 = mult_r( sub_o( *( xi2 + n8 ), *( xi1 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/
t2 = mult_r( add_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ), INV_SQR2_FX /*Q15*/ ); /*Qx*/
@@ -139,18 +155,11 @@ void ifft_rel_fx(
move16();
*( xi2 + n8 ) = sub_o( *( xi4 + n8 ), *( xi3 + n8 ), &Overflow ); /*Qx*/
move16();
-#ifdef ISSUE_1796_replace_shl_o
- *( xi3 + n8 ) = negate( shl_sat( add_o( t2, t1, &Overflow ), 1 ) ); /*Qx*/
-#else
*( xi3 + n8 ) = negate( shl_o( add_o( t2, t1, &Overflow ), 1, &Overflow ) ); /*Qx*/
-#endif
move16();
-#ifdef ISSUE_1796_replace_shl_o
- *( xi4 + n8 ) = shl_sat( sub_o( t1, t2, &Overflow ), 1 ); /*Qx*/
-#else
- *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/
-#endif
+ *( xi4 + n8 ) = shl_o( sub_o( t1, t2, &Overflow ), 1, &Overflow ); /*Qx*/
move16();
+#endif
}
xi1 += id;
xi2 += id;
@@ -198,6 +207,45 @@ void ifft_rel_fx(
FOR( i = is; i < n; i += id )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t1 = sub_sat( *xup1, *xdn6 ); /*Qx*/
+ *xup1 = add_sat( *xup1, *xdn6 ); /*Qx*/
+ move16();
+ xup1 += n4;
+ xdn6 -= n4;
+
+ t2 = sub_sat( *xdn6, *xup1 ); /*Qx*/
+ *xdn6 = add_sat( *xup1, *xdn6 ); /*Qx*/
+ move16();
+
+ xdn6 += n4;
+ t3 = add_sat( *xdn8, *xup3 ); /*Qx*/
+ *xdn6 = sub_sat( *xdn8, *xup3 ); /*Qx*/
+ move16();
+
+ xup3 += n4;
+ xdn8 -= n4;
+
+ t4 = add_sat( *xup3, *xdn8 ); /*Qx*/
+ *xup1 = sub_sat( *xup3, *xdn8 ); /*Qx*/
+ move16();
+
+ t5 = sub_sat( t1, t4 ); /*Qx*/
+ t1 = add_sat( t1, t4 ); /*Qx*/
+ t4 = sub_sat( t2, t3 ); /*Qx*/
+ t2 = add_sat( t2, t3 ); /*Qx*/
+ *xup3 = sub_sat( mult_r( t1, cc3 ), mult_r( t2, ss3 ) ); /*Qx*/
+ move16();
+ xup3 -= n4;
+ *xup3 = add_sat( mult_r( t5, cc1 ), mult_r( t4, ss1 ) ); /*Qx*/
+ move16();
+ *xdn8 = sub_sat( mult_r( t5, ss1 ), mult_r( t4, cc1 ) ); /*Qx*/
+ move16();
+
+ xdn8 += n4;
+ *xdn8 = add_sat( mult_r( t2, cc3 ), mult_r( t1, ss3 ) ); /*Qx*/
+ move16();
+#else
t1 = sub_o( *xup1, *xdn6, &Overflow ); /*Qx*/
*xup1 = add_o( *xup1, *xdn6, &Overflow ); /*Qx*/
move16();
@@ -235,6 +283,7 @@ void ifft_rel_fx(
xdn8 += n4;
*xdn8 = add_o( mult_r( t2, cc3 ), mult_r( t1, ss3 ), &Overflow ); /*Qx*/
move16();
+#endif
xup1 -= n4;
xup1 += id;
@@ -265,10 +314,17 @@ void ifft_rel_fx(
{
r1 = *xi0;
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ *xi0 = add_sat( r1, *xi1 ); /*Qx*/
+ move16();
+ *xi1 = sub_sat( r1, *xi1 ); /*Qx*/
+ move16();
+#else
*xi0 = add_o( r1, *xi1, &Overflow ); /*Qx*/
move16();
*xi1 = sub_o( r1, *xi1, &Overflow ); /*Qx*/
move16();
+#endif
xi0 += id;
xi1 += id;
}
diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c
index 44cf27c5f3da77010f5d13489439a0dc2bc507c7..68853974cd23a96ce03f4d71bd977c1677deaadc 100644
--- a/lib_com/igf_base_fx.c
+++ b/lib_com/igf_base_fx.c
@@ -1115,28 +1115,42 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
)
{
Word16 /*Q0*/ sfb;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word16 /*Q0*/ line;
Word32 L_c;
+#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
move16();
move16();
#endif
+#endif
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
{
sfbEnergy[sfb] = L_deposit_l( 0 );
move32();
}
+#endif
IF( NULL == pPowerSpectrum )
{
+#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
+ {
+ sfbEnergy[sfb] = L_deposit_l( 0 );
+ move32();
+ }
+#endif
return;
}
FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
{
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_c = L_deposit_l( 0 );
FOR( line = swb_offset[sfb]; line < swb_offset[sfb + 1]; line++ )
{
@@ -1150,6 +1164,12 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
}
sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) );
move32();
+#else
+ sfbEnergy[sfb] = sum_array_norm( pPowerSpectrum + swb_offset[sfb],
+ swb_offset[sfb + 1] - swb_offset[sfb],
+ &( sfbEnergy_exp[sfb] ) );
+ move32();
+#endif
sfbEnergy_exp[sfb] = add( sfbEnergy_exp[sfb], *pPowerSpectrum_exp );
move16();
}
@@ -1230,26 +1250,6 @@ void IGFCommonFuncsMDCTSquareSpec_ivas( const Word16 sqrtBgn, /**< in
}
-/**********************************************************************/ /*
-write bits to stream
-**************************************************************************/
-void IGFCommonFuncsWriteSerialBit(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /**< out: Q0 | bit offset */
- Word16 bit /**< in: Q0 | value of bit */
-)
-{
-
- IF( hBstr )
- {
- push_next_indice( hBstr, bit, 1 );
- }
- *pBitOffset = add( *pBitOffset, 1 );
- move16();
-
- return;
-}
-
/**********************************************************************/ /*
changes the IGF configuration
**************************************************************************/
diff --git a/lib_com/int_lsp_fx.c b/lib_com/int_lsp_fx.c
index 570e9ebd987527155d240e94341b7224aa876224..f40b11cfa90c0221936e10c533c073e374c6c352 100644
--- a/lib_com/int_lsp_fx.c
+++ b/lib_com/int_lsp_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/interleave_spectrum_fx.c b/lib_com/interleave_spectrum_fx.c
index e8bb728ff891278b5eb24adb7f15f4d6ba001ed3..3dc1672ec86a746cd74d1f2d8ee3fe59fe4ab094 100644
--- a/lib_com/interleave_spectrum_fx.c
+++ b/lib_com/interleave_spectrum_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c
index abcc6092f5a0d9dfa00b03ed34d5c84235665229..f299c1d61b7485b4afb4e22ef8abcbe7eb57023f 100644
--- a/lib_com/interpol_fx.c
+++ b/lib_com/interpol_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
@@ -41,7 +41,6 @@
#include "rom_com.h"
#include "prot_fx_enc.h"
-
Word32 Interpol_lc_fx( /* o : interpolated value Q15 */
const Word16 *x, /* i : input vector Q0 */
const Word16 *win, /* i : interpolation window Q14 */
@@ -83,8 +82,10 @@ Word16 Interpol_4( /* Qx o : interpolated value */
{
Word16 i;
Word32 L_sum;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
x = x - L_INTERPOL1 + 1;
@@ -102,7 +103,13 @@ Word16 Interpol_4( /* Qx o : interpolated value */
}
BASOP_SATURATE_WARNING_OFF_EVS
/* Here, saturation might occur by intention */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_sum = L_shl_sat( L_sum, 1 ); /*Qx+14+2*/
+ BASOP_SATURATE_WARNING_ON_EVS
+ return round_fx_sat( L_sum ); /*Qx*/
+#else
L_sum = L_shl_o( L_sum, 1, &Overflow ); /*Qx+14+2*/
BASOP_SATURATE_WARNING_ON_EVS
return round_fx_o( L_sum, &Overflow ); /*Qx*/
+#endif
}
diff --git a/lib_com/ivas_arith_fx.c b/lib_com/ivas_arith_fx.c
index 311bccff8e206cbdb862bba20cd4f6e89d62ecc2..c708976dac8552562abb21fd47637ec18a9eb61f 100644
--- a/lib_com/ivas_arith_fx.c
+++ b/lib_com/ivas_arith_fx.c
@@ -191,7 +191,7 @@ void ivas_ari_done_decoding_14bits_ext_1_lfe(
Decoder_State *st,
const Word16 extra_bits_read )
{
- get_next_indice_tmp( st, negate( sub( cbitsnew - 2, extra_bits_read ) ) );
+ get_next_indice_tmp_fx( st, negate( sub( cbitsnew - 2, extra_bits_read ) ) );
return;
}
diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h
index b5c0a74941ca8ff268cdcd5a5790dc2dc1b37c6e..69822b590c9f8492575213d00b803365948642e7 100644
--- a/lib_com/ivas_cnst.h
+++ b/lib_com/ivas_cnst.h
@@ -147,13 +147,10 @@ typedef enum
RENDERER_NON_DIEGETIC_DOWNMIX,
RENDERER_OSBA_STEREO,
RENDERER_OSBA_AMBI,
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
RENDERER_OSBA_LS,
RENDERER_OMASA_OBJECT_EXT,
RENDERER_OMASA_MIX_EXT
-#else
- RENDERER_OSBA_LS
-#endif
+
} RENDERER_TYPE;
#define MAX_FREQUENCY_BANDS 64
@@ -215,7 +212,6 @@ typedef enum
typedef enum
{
- TC_BUFFER_MODE_NONE = 0,
TC_BUFFER_MODE_RENDERER,
TC_BUFFER_MODE_BUFFER
} TC_BUFFER_MODE;
@@ -270,7 +266,7 @@ typedef enum
#define SID_MDCT_STEREO 0x1 /* 1| 0| 0 */
#define SID_ISM 0x2 /* 0| 1| 0 */
#define SID_MASA_1TC 0x3 /* 1| 1| 0 */
-#define SID_MULTICHANNEL 0x4 /* 0| 0| 1 */
+/*reserved*/ /*0x4*/ /* 0| 0| 1 */
#define SID_SBA_1TC 0x5 /* 1| 0| 1 */
#define SID_SBA_2TC 0x6 /* 0| 1| 1 */
#define SID_MASA_2TC 0x7 /* 1| 1| 1 */
@@ -1419,10 +1415,15 @@ typedef enum
#define LFE_CHANNEL 3
#define MIN_LFE_NRG 0.5f
+#ifdef ADJUST_MCT_CHANNELS_MAX
+#define MCT_MAX_CHANNELS 11 /* == 7.1.4 LS channels without the LFE channel */
+#define MCT_MAX_BLOCKS ( ( MCT_MAX_CHANNELS + 1 ) / CPE_CHANNELS ) /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/
+#else
#define MCT_MAX_CHANNELS MAX_TRANSPORT_CHANNELS
#define MCT_MAX_BLOCKS ( MCT_MAX_CHANNELS / CPE_CHANNELS ) /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/
#define MAX_NUM_DATA max( MCT_MAX_CHANNELS, 4 )
+#endif
#define NBBITS_MCT_RATIO 4
#define BITRATE_MCT_RATIO_RANGE ( 1 << NBBITS_MCT_RATIO ) /* Range of the coded bitrate distribution ratio */
@@ -1562,9 +1563,6 @@ typedef enum
typedef enum
{
IVAS_FILTER_ORDER_1 = 1,
-#ifndef NONBE_FIX_MC_LFE_LPF
- IVAS_FILTER_ORDER_2 = 2,
-#endif
IVAS_FILTER_ORDER_4 = 4,
} ivas_filter_order;
@@ -1611,11 +1609,8 @@ typedef enum
* Amplitude Panning (EFAP, VBAP) constants
*----------------------------------------------------------------------------------*/
-#define PANNING_AZI_RESOLUTION 2
-#define PANNING_ELE_RESOLUTION 5
-
#define EFAP_MAX_CHAN_NUM 5 /* Maximum number of channels that constitute a polygon, 4 or 5 */
-#define EFAP_MAX_POLY_SET 50 /* Upper bound on number of polygons; with a Speaker setup of 16.0, we obtain 44 polygons/triangles in the matlab implementation. */
+#define EFAP_MAX_POLY_SET 54 /* Upper bound on number of polygons; found to be 54 in the worst case for a speaker setup of 16.0 */
#define EFAP_MODE_EFAP 0 /* EFAP Panning */
#define EFAP_MODE_EFIP 1 /* EFIP Panning */
@@ -1657,6 +1652,7 @@ typedef enum
#define BINAURAL_COHERENCE_DIFFERENCE_BINS 9 /* Number of bins for direction-dependent diffuse-field binaural coherence */
+#ifndef FIX_CREND_SIMPLIFY_CODE
typedef enum
{
BINAURAL_INPUT_AUDIO_CONFIG_INVALID,
@@ -1667,14 +1663,12 @@ typedef enum
BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED /* Not used */
} BINAURAL_INPUT_AUDIO_CONFIG;
-
+#endif
#define HEADROT_ORDER 3
#define HEADROT_SHMAT_DIM ( ( HEADROT_ORDER + 1 ) * ( HEADROT_ORDER + 1 ) )
#define HEADROT_SHMAT_DIM2 ( HEADROT_SHMAT_DIM * HEADROT_SHMAT_DIM )
-
-
/*----------------------------------------------------------------------------------*
* TD Binaural Object renderer
*----------------------------------------------------------------------------------*/
@@ -1705,6 +1699,11 @@ typedef enum
#define ONE_BY_360_Q15 ( 91 ) // Q15
#define ONE_BY_180_Q31 ( 11930465 ) // Q31
+#ifdef FIX_989_TD_REND_ROM
+#define RESAMPLE_FACTOR_16_48_FX ( 5461 ) // Q14
+#define RESAMPLE_FACTOR_32_48_FX ( 10922 ) // Q14
+#endif
+
/* ----- Enums - TD Renderer ----- */
typedef enum
diff --git a/lib_com/ivas_dirac_com_fx.c b/lib_com/ivas_dirac_com_fx.c
index 26d58936f8d3083fb7fbdff6470c91443f576edc..7be68453542323370cee38ad5e44df2db8db3a6d 100644
--- a/lib_com/ivas_dirac_com_fx.c
+++ b/lib_com/ivas_dirac_com_fx.c
@@ -40,15 +40,15 @@
#include "cnst.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+
/*-----------------------------------------------------------------------*
* Local function prototypes
*-----------------------------------------------------------------------*/
-
static UWord16 deindex_sph_idx_general_fx( const Word16 idx_sph, const Word16 no_bits, Word32 *theta_dec_fx, Word32 *phi_dec_fx, UWord16 *p_id_phi, const MC_LS_SETUP mc_format );
+
/*-------------------------------------------------------------------------
* ivas_get_hodirac_flag()
*
@@ -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
@@ -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;
}
diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h
index e46f901c6f7fbf681d26b15cb19a38c9619ca0e0..484faa90fbfc939e28e56c280aa0703a3c146ec4 100644
--- a/lib_com/ivas_error.h
+++ b/lib_com/ivas_error.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/* options.h needed for debugging/development features
@@ -78,6 +78,9 @@ typedef enum
IVAS_ERR_DIRECTIVITY_NOT_SUPPORTED,
IVAS_ERR_ACOUSTIC_ENVIRONMENT_NOT_SUPPORTED,
IVAS_ERR_INVALID_HRTF,
+#ifdef FIX_989_TD_REND_ROM
+ IVAS_ERR_INVALID_HRTF_SAMPLING_RATE,
+#endif
IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA,
IVAS_ERR_INVALID_INPUT_FORMAT,
IVAS_ERR_INVALID_INDEX,
@@ -250,6 +253,10 @@ static inline const char *ivas_error_to_string( ivas_error error_code )
return "Acoustic environment not supported";
case IVAS_ERR_INVALID_HRTF:
return "Unsupported HRTF filter set";
+#ifdef FIX_989_TD_REND_ROM
+ case IVAS_ERR_INVALID_HRTF_SAMPLING_RATE:
+ return "Wrong sampling rate in HRTF binary file";
+#endif
case IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA:
return "Renderer data missing in HRTF binary file";
case IVAS_ERR_INVALID_INPUT_FORMAT:
diff --git a/lib_com/ivas_fb_mixer_fx.c b/lib_com/ivas_fb_mixer_fx.c
index b55e069d7deb8c63ba5af5f69170ddf2dfcf3057..c860b354e27a271e5a6384bde2e3e15f9512408e 100644
--- a/lib_com/ivas_fb_mixer_fx.c
+++ b/lib_com/ivas_fb_mixer_fx.c
@@ -39,7 +39,6 @@
#include "ivas_rom_com.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*------------------------------------------------------------------------------------------*
@@ -199,14 +198,13 @@ ivas_error ivas_FB_mixer_open_fx(
{
IVAS_FB_MIXER_HANDLE hFbMixer;
Word16 i, j, frame_len, num_bands;
- Word16 num_chs_alloc, exp;
+ Word16 num_chs_alloc;
ivas_error error;
error = IVAS_ERR_OK;
move32();
- frame_len = BASOP_Util_Divide3232_Scale( sampling_rate, FRAMES_PER_SEC, &exp );
- frame_len = shr( frame_len, sub( 15, exp ) );
+ frame_len = extract_l( Mpy_32_32_r( sampling_rate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
hFbMixer = *hFbMixer_out;
@@ -936,8 +934,9 @@ static Word16 ivas_calculate_abs_fr_fx(
move64();
Word16 short_stride = pFb->fb_bin_to_band.short_stride;
move16();
+
Word32 res_dec1, res_frac, res_dec2;
- iDiv_and_mod_32( sampling_rate, FRAMES_PER_SEC, &res_dec1, &res_frac, 0 );
+ res_dec1 = Mpy_32_32_r( sampling_rate, ONE_BY_FRAMES_PER_SEC_Q31 );
iDiv_and_mod_32( res_dec1, short_stride, &res_dec2, &res_frac, 0 );
const Word16 num_bins_per_short_stride_bin = extract_l( res_dec2 );
iDiv_and_mod_32( res_dec1, pFb->fb_bin_to_band.num_cldfb_bands, &res_dec2, &res_frac, 0 );
@@ -1259,7 +1258,7 @@ static ivas_error ivas_filterbank_setup_fx(
const Word32 sampling_rate,
Word16 *index )
{
- Word16 i, j, exp, tmp;
+ Word16 i, j, tmp;
const Word32 *pAll_fb_fr_fx[2];
const Word16 *pAll_bins_start_offset = NULL;
const Word16 *pAll_bins_per_band = NULL;
@@ -1342,9 +1341,8 @@ static ivas_error ivas_filterbank_setup_fx(
/*pFb->fb_bin_to_band.cldfb_stride = ( int16_t )( ( sampling_rate / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX );*/ /* equals num_cldfb_bands*/
// pFb->fb_bin_to_band.short_stride = extract_l( ( sampling_rate / FRAMES_PER_SEC ) / 4 );
- tmp = BASOP_Util_Divide3232_Scale( sampling_rate, FRAMES_PER_SEC, &exp );
- pFb->fb_bin_to_band.short_stride = shr( tmp, add( sub( 15, exp ), 2 ) );
-
+ tmp = extract_l( Mpy_32_32_r( sampling_rate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ pFb->fb_bin_to_band.short_stride = shr( tmp, 2 );
move16();
set32_fx( pFb->fb_bin_to_band.p_short_stride_bin_to_band_fx, 0, 2 * MDFT_FB_BANDS_240 );
diff --git a/lib_com/ivas_filters_fx.c b/lib_com/ivas_filters_fx.c
index fca802cb06af63e0d161c2718138babf609b5c7f..eca54cc55e99e883982da5403341ac6e7f511c67 100644
--- a/lib_com/ivas_filters_fx.c
+++ b/lib_com/ivas_filters_fx.c
@@ -64,11 +64,7 @@ void ivas_filters_init_fx(
test();
-#ifdef NONBE_FIX_MC_LFE_LPF
IF( EQ_16( order, IVAS_FILTER_ORDER_1 ) )
-#else
- IF( EQ_16( order, IVAS_FILTER_ORDER_2 ) || EQ_16( order, IVAS_FILTER_ORDER_1 ) )
-#endif
{
filter_state->filt_len = add( order, 1 );
move16();
@@ -170,9 +166,6 @@ void ivas_filter_process_fx(
SWITCH( filter_state->order )
{
case IVAS_FILTER_ORDER_1:
-#ifndef NONBE_FIX_MC_LFE_LPF
- case IVAS_FILTER_ORDER_2:
-#endif
set_val_Word16( pIn_Out_e, sub( Q31, q_factor ), length );
ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e );
/* Scale pIn_Out_fx back to input Q */
@@ -211,9 +204,6 @@ void ivas_filter_process_exp_fx(
SWITCH( filter_state->order )
{
case IVAS_FILTER_ORDER_1:
-#ifndef NONBE_FIX_MC_LFE_LPF
- case IVAS_FILTER_ORDER_2:
-#endif
ivas_iir_2_filter_fx( filter_state, pIn_Out_fx, length, IVAS_FILTER_STAGE_0, pIn_Out_e );
/* Scale pIn_Out_fx back to input Q */
BREAK;
diff --git a/lib_com/ivas_ism_com_fx.c b/lib_com/ivas_ism_com_fx.c
index 5f1a13afb7ca1a431d823a6d5461813e136c34a0..30cd2f29e095ddb08699ac2b5a0e5ca2de9fccbc 100644
--- a/lib_com/ivas_ism_com_fx.c
+++ b/lib_com/ivas_ism_com_fx.c
@@ -144,9 +144,9 @@ ivas_error ivas_ism_config_fx(
{
/* combined format: decision about bitrates per channel - variable during the session (at one ivas_total_brate) */
// bits_ism = (Word16) ( ism_total_brate / FRAMES_PER_SEC );
- bits_ism = extract_l( Mpy_32_32( 42949673, ism_total_brate ) ); // 42949673 is 1/FRAMES_PER_SEC in Q31
- tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); // Q15 - exp
- set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms );
+ bits_ism = extract_l( Mpy_32_32_r( ONE_BY_FRAMES_PER_SEC_Q31, ism_total_brate ) ); // Q0
+ tmp1 = extract_h( Mpy_32_16_r( one_by_q_level[n_ISms], bits_ism ) );
+ set16_fx( bits_element, tmp1, n_ISms );
bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); // Q0
move16();
@@ -156,11 +156,9 @@ ivas_error ivas_ism_config_fx(
{
/* ISM format: decision about bitrates per channel - constant during the session (at one ivas_total_brate) */
// bits_ism = (Word16) ( ism_total_brate / FRAMES_PER_SEC );
- // 1 / 50 * 2 ^ 31 -- > 42949673, --> Q31,
- //(Q31 +Q0) - Q31 --> Q0
- bits_ism = extract_l( Mpy_32_32( 42949673, ism_total_brate ) ); // 42949673 is 1/FRAMES_PER_SEC in Q31
- tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); // Q15 - exp
- set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms );
+ bits_ism = extract_l( Mpy_32_32_r( ONE_BY_FRAMES_PER_SEC_Q31, ism_total_brate ) ); // Q0
+ tmp1 = extract_h( Mpy_32_16_r( one_by_q_level[n_ISms], bits_ism ) );
+ set16_fx( bits_element, tmp1, n_ISms );
bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); // Q0
move16();
bitbudget_to_brate( bits_element, element_brate, n_ISms );
@@ -472,6 +470,17 @@ void ivas_ism_reset_metadata(
hIsmMeta->non_diegetic_flag = 0;
move16();
+#ifdef OBJ_EDITING_API
+ hIsmMeta->edited_gain_fx = ONE_IN_Q31;
+ hIsmMeta->edited_azimuth_fx = 0;
+ hIsmMeta->edited_elevation_fx = 0;
+ hIsmMeta->edited_pitch_fx = 0;
+ hIsmMeta->edited_yaw_fx = 0;
+ hIsmMeta->edited_radius_fx = ONE_IN_Q9;
+ hIsmMeta->gain_fx = ONE_IN_Q31;
+ hIsmMeta->non_diegetic_flag = 0;
+#endif
+
return;
}
diff --git a/lib_com/ivas_lfe_com_fx.c b/lib_com/ivas_lfe_com_fx.c
index ba64b517f012fafc043a56b66099a6958b1bbaa3..d515cc5fbc77ce306b43d6d8607a430a74c3f5b7 100644
--- a/lib_com/ivas_lfe_com_fx.c
+++ b/lib_com/ivas_lfe_com_fx.c
@@ -41,7 +41,6 @@
#include
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-----------------------------------------------------------------------------------------*
@@ -49,34 +48,17 @@
*
* Selects LFE filter coeff based on config.
*-----------------------------------------------------------------------------------------*/
+
void ivas_lfe_lpf_select_filt_coeff_fx(
- const Word32 sampling_rate, /* i : sampling rate */
- const Word16 order, /* i : filter order */
- const Word32 **ppFilt_coeff_fx, /* o : filter coefficients */
- const Word16 **ppFilt_coeff_e /* o : exponents of filter coefficients */
+ const Word32 sampling_rate, /* i : sampling rate */
+ const Word16 order, /* i : filter order */
+ const Word32 **ppFilt_coeff_fx, /* o : filter coefficients */
+ const Word16 **ppFilt_coeff_e /* o : exponents of filter coefficients */
)
{
SWITCH( order )
{
-#ifndef NONBE_FIX_MC_LFE_LPF
- case IVAS_FILTER_ORDER_2:
- SWITCH( sampling_rate )
- {
- case 16000:
- *ppFilt_coeff_fx = ivas_lpf_2_butter_16k_fx; // Q30
- BREAK;
- case 32000:
- *ppFilt_coeff_fx = ivas_lpf_2_butter_32k_fx; // Q30
- BREAK;
- case 48000:
- *ppFilt_coeff_fx = ivas_lpf_2_butter_48k_fx; // Q30
- BREAK;
- default:
- BREAK;
- }
- BREAK;
-#endif
case IVAS_FILTER_ORDER_4:
SWITCH( sampling_rate )
{
diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c
index 60982f3f2e3ad0bf854aba398859e416e89afc44..4250d7a7a46db4ebc5500b6754d015d1f25a601d 100644
--- a/lib_com/ivas_limiter_fx.c
+++ b/lib_com/ivas_limiter_fx.c
@@ -36,7 +36,7 @@
#include "prot_fx.h"
#include "ivas_prot_rend_fx.h"
#include "ivas_rom_rend.h"
-#include "ivas_rom_com_fx.h"
+#include "ivas_rom_com.h"
#include "wmc_auto.h"
#include
#include "ivas_prot_fx.h"
diff --git a/lib_com/ivas_masa_com_fx.c b/lib_com/ivas_masa_com_fx.c
index f4c8fab10d09d20b5591e2796305ac79a888ea38..9c706bc74a1dc6bfdeefea66b3835ef25fe0f2bd 100644
--- a/lib_com/ivas_masa_com_fx.c
+++ b/lib_com/ivas_masa_com_fx.c
@@ -39,7 +39,6 @@
#include "ivas_rom_com.h"
#include "ivas_stat_dec.h"
#include "wmc_auto.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
diff --git a/lib_com/ivas_mc_param_com_fx.c b/lib_com/ivas_mc_param_com_fx.c
index 4469e7f93d82856a3e2db90e362e3e02265108be..e3827c5685d146777de8975f73bd52b7b5791873 100644
--- a/lib_com/ivas_mc_param_com_fx.c
+++ b/lib_com/ivas_mc_param_com_fx.c
@@ -39,7 +39,6 @@
#include "ivas_stat_com.h"
#include "ivas_rom_com.h"
#include "wmc_auto.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
@@ -47,9 +46,9 @@
* Local function prototypes
*------------------------------------------------------------------------*/
-
static void ivas_param_mc_set_coding_scheme_fx( const MC_LS_SETUP mc_ls_setup, const Word32 ivas_total_brate, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC );
+
/*-------------------------------------------------------------------------
* ivas_param_mc_get_configuration_index()
*
diff --git a/lib_com/ivas_mdct_imdct_fx.c b/lib_com/ivas_mdct_imdct_fx.c
index 542f5ca745df2f4a678581ab9c1968ba2966137e..960b823ae605a2c890c6b77a3e305039fe0af208 100644
--- a/lib_com/ivas_mdct_imdct_fx.c
+++ b/lib_com/ivas_mdct_imdct_fx.c
@@ -34,7 +34,7 @@
#include "options.h"
#include "prot_fx.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+#include "ivas_rom_com.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
diff --git a/lib_com/ivas_mdft_imdft_fx.c b/lib_com/ivas_mdft_imdft_fx.c
index 5d7bee1a6929347ac19968f7d8996878878f8897..1d07ab13356e8b5b418e841bd302a6dd002df1dd 100644
--- a/lib_com/ivas_mdft_imdft_fx.c
+++ b/lib_com/ivas_mdft_imdft_fx.c
@@ -40,7 +40,6 @@
#include
#include
#include "debug.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
/*-----------------------------------------------------------------------------------------*
diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h
index 83cf758b11806c8bebb43c918fe96bb6a951b614..f226e5d95f6be98e4bb9bdb429f6d3c1c1cc8200 100644
--- a/lib_com/ivas_prot_fx.h
+++ b/lib_com/ivas_prot_fx.h
@@ -114,9 +114,12 @@ void ivas_masa_prerender_fx(
);
ivas_error ivas_masa_dec_reconfigure_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
Word16 *data /* o : output synthesis signal */
+#endif
);
void reconstruct_ism_ratios_fx(
@@ -156,7 +159,6 @@ void ivas_omasa_rearrange_channels_fx(
const Word16 output_frame /* i : output frame length per channel */
);
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
@@ -165,38 +167,43 @@ void ivas_omasa_combine_separate_ism_with_masa_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
Word32 *output[], /* o : output synthesis signal */
Word16 *output_q, /* i/o: output Q value */
- const int16_t nchan_ism, /* i : number of ISMs */
- const int16_t output_frame /* i : output frame length per channel */
+ const Word16 nchan_ism, /* i : number of ISMs */
+ const Word16 output_frame /* i : output frame length per channel */
);
-ivas_error ivas_omasa_render_objects_from_mix_open_fx(
+ivas_error ivas_omasa_objects_delay_open_fx(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
void ivas_omasa_render_objects_from_mix_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
Word32 *output[], /* o : output synthesis signal */
- const int16_t nchan_ism, /* i : number of ISMs */
- const int16_t output_frame, /* i : output frame length per channel */
+ const Word16 nchan_ism, /* i : number of ISMs */
+ const Word16 output_frame, /* i : output frame length per channel */
Word16 *output_q /* i/o: output Q value */
);
-#endif
ivas_error ivas_omasa_ism_metadata_dec_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const Word32 ism_total_brate, /* i : ISM total bitrate */
- Word16 *nchan_ism, /* o : number of ISM separated channels */
- Word16 *nchan_transport_ism, /* o : number of ISM TCs */
- const Word16 dirac_bs_md_write_idx, /* i : DirAC bitstream write index */
- Word16 nb_bits_metadata[] /* o : number of ISM metadata bits */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const Word32 ism_total_brate, /* i : ISM total bitrate */
+ Word16 *nchan_ism, /* o : number of ISM separated channels */
+ Word16 *nchan_transport_ism, /* o : number of ISM TCs */
+ const Word16 dirac_bs_md_write_idx, /* i : DirAC bitstream write index */
+ Word16 nb_bits_metadata[] /* o : number of ISM metadata bits */
);
+
ivas_error ivas_omasa_dec_config_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+#ifdef FIX_HRTF_LOAD
+ Word16 *num_src,
+ Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]
+#else
+ UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
Word16 *num_src,
Word16 SrcInd[MAX_NUM_TDREND_CHANNELS],
- Word16 *data /* o : output synthesis signal */
+ Word16 *data /* o : output synthesis signal */
+#endif
);
void ivas_omasa_modify_masa_energy_ratios_fx(
@@ -205,9 +212,9 @@ void ivas_omasa_modify_masa_energy_ratios_fx(
);
Word32 calculate_cpe_brate_MASA_ISM_fx(
- const ISM_MODE ism_mode, /* i : ism mode */
- const Word32 ivas_total_brate, /* i : IVAS total bitrate */
- const Word16 nchan_ism /* i : number of objects */
+ const ISM_MODE ism_mode, /* i : ism mode */
+ const Word32 ivas_total_brate, /* i : IVAS total bitrate */
+ const Word16 nchan_ism /* i : number of objects */
);
Word16 ivas_jbm_dec_get_num_tc_channels_fx(
@@ -770,6 +777,12 @@ ivas_error ivas_ism_metadata_dec_fx(
DEC_CORE_HANDLE st0 /* i : core-coder handle */
);
+#ifdef OBJ_EDITING_API
+void ivas_ism_renderer_update_md(
+ Decoder_Struct *st_ivas /* i/o: main IVAS decoder handle */
+);
+#endif
+
void ivas_get_ism_sid_quan_bitbudget_fx(
const Word16 nchan_ism, /* i : number of objects */
Word16 *nBits_azimuth, /* o : number of Q bits for azimuth */
@@ -858,11 +871,7 @@ void ivas_lfe_dec_close_fx(
ivas_error ivas_create_lfe_dec_fx(
LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */
const Word32 output_Fs, /* i : output sampling rate */
-#ifdef NONBE_FIX_MC_LFE_LPF
const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */
-#else
- const Word32 binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */
-#endif
);
void ivas_lfe_dec_fx(
@@ -888,9 +897,6 @@ void td_stereo_param_updt_fx(
const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */
const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */
const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- Word16 tdm_lspQ_PCh_fx[], /* o : Q LSPs for primary channel Q15 */
-#endif
Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qlog2(2.56) */
Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */
const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
@@ -1612,12 +1618,8 @@ void decoder_tcx_imdct_fx(
Word32 x_fx[N_MAX],
Word16 q_x,
Word16 xn_buf_fx[],
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 *q_win,
Word16 *q_winFB,
-#else
- Word16 q_win,
-#endif
const UWord16 kernelType, /* i : TCX transform kernel type */
const Word16 fUseTns, /* i : flag that is set if TNS data is present */
Word16 synth_fx[], /* i/o: synth[-M..L_frame] */
@@ -2174,7 +2176,8 @@ ivas_error only_reduce_bits_direction_fx(
Word16 reduce_bits,
const Word16 coding_subbands,
const Word16 no_subframes,
- Word16 *ind_order );
+ Word16 *ind_order
+);
void ivas_qmetadata_azimuth_elevation_to_direction_vector_fx(
const Word32 az, /* i : azimuth Q22 */
@@ -2263,89 +2266,92 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem_fx(
);
void ivas_mct_side_bits_fx(
- MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */
- CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */
- const Word16 nCPE, /* i : number of CPEs */
- Decoder_State *st0, /* i : decoder handle for Bstr */
- const Word16 bfi, /* i : BFI flag */
- UWord16 *bitstream, /* o : bitstream indices */
- const Word32 ivas_total_brate, /* i : IVAS total bitrate */
- const Word16 nb_bits_metadata /* i : number of metadata bits */
+ MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */
+ CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */
+ const Word16 nCPE, /* i : number of CPEs */
+ Decoder_State *st0, /* i : decoder handle for Bstr */
+ const Word16 bfi, /* i : BFI flag */
+ UWord16 *bitstream, /* o : bitstream indices */
+ const Word32 ivas_total_brate, /* i : IVAS total bitrate */
+ const Word16 nb_bits_metadata /* i : number of metadata bits */
);
Flag conv_fx_32(
- const Word16 x[], /* i : i vector Q_new*/
- const Word16 h[], /* i : impulse response (or second i vector) Q(15)*/
- Word32 y[], /* o : output vetor (result of convolution) 12 bits*/
- const Word16 L /* i : vector size */
+ const Word16 x[], /* i : i vector Q_new*/
+ const Word16 h[], /* i : impulse response (or second i vector) Q(15)*/
+ Word32 y[], /* o : output vetor (result of convolution) 12 bits*/
+ const Word16 L /* i : vector size */
);
void stereo_dtf_cng_fx(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
- const Word32 ivas_total_brate, /* i : IVAS total bitrate */
- Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */
- const Word16 output_frame, /* i : output frame size */
- Word16 q_dft /* i : Q factor of the DFT data */
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ const Word32 ivas_total_brate, /* i : IVAS total bitrate */
+ Word32 DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* i/o: DFT buffers */
+ const Word16 output_frame, /* i : output frame size */
+ Word16 q_dft /* i : Q factor of the DFT data */
);
-
void ivas_spar_update_md_hist_fx(
- ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */
+ ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */
);
void ivas_spar_smooth_md_dtx_fx(
- ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
- const Word16 num_bands_out, /* i : number of output bands */
- const Word16 num_md_sub_frames /* i : number of metadata subframes */
+ ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
+ const Word16 num_bands_out, /* i : number of output bands */
+ const Word16 num_md_sub_frames /* i : number of metadata subframes */
);
void ivas_spar_setup_md_smoothing_fx(
- ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
- const Word16 num_bands_out, /* i : number of output bands */
- const Word16 num_md_sub_frames /* i : number of metadata subframes */
+ ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
+ const Word16 num_bands_out, /* i : number of output bands */
+ const Word16 num_md_sub_frames /* i : number of metadata subframes */
);
ivas_error ivas_mct_dec_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- Word32 *output_fx[], /* o : output synthesis signal */
- const Word16 output_frame, /* i : output frame length per channel */
- const Word16 nb_bits_metadata /* i : number of metadata bits */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Word32 *output_fx[], /* o : output synthesis signal */
+ const Word16 output_frame, /* i : output frame length per channel */
+ const Word16 nb_bits_metadata /* i : number of metadata bits */
);
void ivas_dirac_dec_render_sf_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- Word32 *output_fx[], /* i/o: synthesized core-coder transport channels/DirAC output */
- const Word16 nchan_transport, /* i : number of transport channels */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Word32 *output_fx[], /* i/o: synthesized core-coder transport channels/DirAC output */
+ const Word16 nchan_transport, /* i : number of transport channels */
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Word32 *pppQMfFrame_ts_re_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX],
+ Word32 *pppQMfFrame_ts_im_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX]
+#else
Word32 *pppQMfFrame_ts_re_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX],
- Word32 *pppQMfFrame_ts_im_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] );
+ Word32 *pppQMfFrame_ts_im_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX]
+#endif
+);
void ivas_dirac_dec_render_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
- const Word16 nchan_transport, /* i : number of transport channels */
- const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */
- UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */
- UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */
- Word32 *output_f[] /* o : rendered time signal */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const Word16 nchan_transport, /* i : number of transport channels */
+ const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */
+ UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */
+ UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */
+ Word32 *output_f[] /* o : rendered time signal */
);
void ivas_dirac_dec_read_BS_fx(
- const Word32 ivas_total_brate, /* i : IVAS total bitrate */
- Decoder_State *st, /* i/o: decoder Core state structure */
- DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */
- SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial rendering data handle */
- IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q metadata */
- Word16 *nb_bits, /* o : number of bits read */
- const Word16 last_bit_pos, /* i : last read bitstream position */
- const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */
-#ifdef NONBE_FIX_1052_SBA_EXT
- const Word16 nchan_transport, /* i : number of transport channels */
-#endif
- Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */
+ const Word32 ivas_total_brate, /* i : IVAS total bitrate */
+ Decoder_State *st, /* i/o: decoder Core state structure */
+ DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */
+ SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial rendering data handle */
+ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q metadata */
+ Word16 *nb_bits, /* o : number of bits read */
+ const Word16 last_bit_pos, /* i : last read bitstream position */
+ const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */
+ const Word16 nchan_transport, /* i : number of transport channels */
+ Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */
);
ivas_error ivas_dirac_dec_config_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const DIRAC_CONFIG_FLAG flag_configopen /* i/ : Flag determining if we open or reconfigure the DirAC decoder */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const DIRAC_CONFIG_FLAG flag_configopen /* i/ : Flag determining if we open or reconfigure the DirAC decoder */
);
void ivas_dirac_dec_output_synthesis_cov_close_fx(
@@ -2354,121 +2360,132 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx(
);
ivas_error ivas_init_decoder_front_fx(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
ivas_error ivas_init_decoder_fx(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
void destroy_core_dec_fx(
- DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */
+ DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */
);
void ivas_destroy_dec_fx(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
ivas_error ivas_ism_dec_config_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const ISM_MODE last_ism_mode, /* i/o: last ISM mode */
- UWord16 *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */
- Word16 *data /* o : output synthesis signal */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const ISM_MODE last_ism_mode /* i/o: last ISM mode */
+#ifndef FIX_HRTF_LOAD
+ ,
+ UWord16 *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */
+ Word16 *data /* o : output synthesis signal */
+#endif
);
ivas_error ivas_ism_metadata_dec_create_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const Word16 n_ISms, /* i : number of separately coded objects */
- Word32 element_brate_tmp[] /* o : element bitrate per object */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const Word16 n_ISms, /* i : number of separately coded objects */
+ Word32 element_brate_tmp[] /* o : element bitrate per object */
);
void ivas_ism_reset_metadata_handle_dec_fx(
- ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */
+ ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */
);
ivas_error ivas_sba_dec_reconfigure_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- UWord16 *nSamplesFlushed, /* o : number of samples flushed */
- Word16 *data /* o : output synthesis signal */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+#ifndef FIX_HRTF_LOAD
+ ,
+ UWord16 *nSamplesFlushed, /* o : number of samples flushed */
+ Word16 *data /* o : output synthesis signal */
+#endif
);
ivas_error ivas_spar_md_dec_matrix_open_fx(
- ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
- const Word16 num_channels, /* i : number of internal channels */
- const Word16 num_md_sub_frames /* i : number of MD subframes */
+ ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */
+ const Word16 num_channels, /* i : number of internal channels */
+ const Word16 num_md_sub_frames /* i : number of MD subframes */
);
+
void ivas_spar_md_dec_matrix_close_fx(
- ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */
- const Word16 num_channels /* i : number of internal channels */
+ ivas_spar_md_dec_state_t *hMdDecoder, /* i/o: SPAR MD decoder handle */
+ const Word16 num_channels /* i : number of internal channels */
);
ivas_error ivas_spar_dec_open_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
- const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */
);
void ivas_param_mc_dec_read_BS_fx(
- const Word32 ivas_total_brate, /* i : IVAS total bitrate */
- Decoder_State *st, /* i/o: decoder state structure */
- PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder ParamMC handle */
- Word16 *nb_bits /* o : number of bits written */
+ const Word32 ivas_total_brate, /* i : IVAS total bitrate */
+ Decoder_State *st, /* i/o: decoder state structure */
+ PARAM_MC_DEC_HANDLE hParamMC, /* i/o: decoder ParamMC handle */
+ Word16 *nb_bits /* o : number of bits written */
);
ivas_error ivas_omasa_data_open_fx(
- Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */
);
void ivas_omasa_data_close_fx(
- MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */
+ MASA_ISM_DATA_HANDLE *hMasaIsmData /* i/o: MASA_ISM rendering handle */
);
ivas_error ivas_mc_dec_config_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const Word16 idx, /* i : LS config. index */
- UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */
- Word16 *data /* o : output synthesis signal */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const Word16 idx /* i : LS config. index */
+#ifndef FIX_HRTF_LOAD
+ ,
+ UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */
+ Word16 *data /* o : output synthesis signal */
+#endif
);
void ivas_lfe_window_init_fx(
- LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */
- const Word32 sampling_rate, /* i : sampling rate */
- const Word16 frame_len /* i : frame length in samples */
+ LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */
+ const Word32 sampling_rate, /* i : sampling rate */
+ const Word16 frame_len /* i : frame length in samples */
);
Word16 param_mc_get_num_cldfb_syntheses_fx(
- Decoder_Struct *st_ivas /* i : Parametric MC handle */
+ Decoder_Struct *st_ivas /* i : Parametric MC handle */
);
void InitPsychLPC_fx(
- const Word32 sr_core, /* i : sampling rate of core-coder */
- const Word16 L_frame, /* i : frame length */
- const TCX_CONFIG_HANDLE hTcxCfg /* i : TCX configuration handle */
+ const Word32 sr_core, /* i : sampling rate of core-coder */
+ const Word16 L_frame, /* i : frame length */
+ const TCX_CONFIG_HANDLE hTcxCfg /* i : TCX configuration handle */
);
ivas_error PsychoacousticParameters_Init_fx(
- const Word32 sr_core, /* i : sampling rate of core-coder */
- const Word16 nBins, /* i : Number of bins (spectral lines) */
- const Word8 nBands, /* i : Number of spectrum subbands */
- const Word16 isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */
- const Word16 isWarped, /* i : Flag indicating if the scale is linear or warped */
- PsychoacousticParameters *pPsychParams );
+ const Word32 sr_core, /* i : sampling rate of core-coder */
+ const Word16 nBins, /* i : Number of bins (spectral lines) */
+ const Word8 nBands, /* i : Number of spectrum subbands */
+ const Word16 isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */
+ const Word16 isWarped, /* i : Flag indicating if the scale is linear or warped */
+ PsychoacousticParameters *pPsychParams
+);
ivas_error ivas_FB_mixer_open_fx(
- IVAS_FB_MIXER_HANDLE *hFbMixer_out, /* i/o: FB mixer handle */
- const Word32 sampling_rate, /* i : sampling rate */
- IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */
- const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */
+ IVAS_FB_MIXER_HANDLE *hFbMixer_out, /* i/o: FB mixer handle */
+ const Word32 sampling_rate, /* i : sampling rate */
+ IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */
+ const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */
);
void ivas_FB_mixer_close_fx(
- IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */
- const Word32 sampling_rate, /* i : sampling rate in Hz */
- const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */
+ IVAS_FB_MIXER_HANDLE *hFbMixer_in, /* i/o: FB mixer handle */
+ const Word32 sampling_rate, /* i : sampling rate in Hz */
+ const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */
);
void ivas_fb_mixer_get_in_out_mapping_fx(
- const IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */
- Word16 in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */
+ const IVAS_FB_CFG *fb_cfg, /* i : FB config. handle */
+ Word16 in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */
);
void ivas_fb_mixer_cross_fading_fx(
@@ -2478,7 +2495,8 @@ void ivas_fb_mixer_cross_fading_fx(
Word32 *pMdft_out_new_fx,
const Word16 ch,
const Word16 frame_len,
- const Word16 cf_offset );
+ const Word16 cf_offset
+);
// ivas_omasa_dec.c
ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
@@ -2500,23 +2518,23 @@ Word16 ivas_sba_get_nchan_metadata_fx(
const Word32 ivas_total_brate /* i : IVAS total bitrate */
);
-#ifdef NONBE_FIX_1052_SBA_EXT
-/*! r: number of bits in SPAR SID frame */
+/*! r: number of bits in SBQ SID frame */
Word16 ivas_sba_spar_sid_bitlen_fx(
const Word16 nchan_transport /* i : number of transport channels */
);
-#endif
void ivas_sba_get_spar_hoa_ch_ind_fx(
const Word16 num_md_chs, /* i : number of MD channels */
const Word32 ivas_total_brate, /* i : IVAS total bitrate */
- Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] );
+ Word16 HOA_md_ind[IVAS_SPAR_MAX_CH]
+);
void ivas_sba_get_spar_hoa_md_flag_fx(
const Word16 sba_order, /* i : Ambisonic (SBA) order */
const Word32 ivas_total_brate, /* i : IVAS total bitrate */
Word16 *spar_hoa_md_flag,
- Word16 *spar_hoa_dirac2spar_md_flag );
+ Word16 *spar_hoa_dirac2spar_md_flag
+);
void ivas_omasa_dirac_rend_jbm_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
@@ -2653,28 +2671,15 @@ Word16 getNumChanAnalysis_fx(
Encoder_Struct *st_ivas /* i : IVAS encoder structure */
);
+
/*----------------------------------------------------------------------------------*
* Limiter prototypes
*----------------------------------------------------------------------------------*/
-
-ivas_error ivas_limiter_open(
- IVAS_LIMITER_HANDLE *hLimiter_out, /* o : limiter struct handle */
- const int16_t num_channels, /* i : number of I/O channels */
- const int32_t sampling_rate /* i : sampling rate for processing */
-);
-
void ivas_limiter_close(
IVAS_LIMITER_HANDLE *phLimiter /* i/o: pointer to limiter handle, can be NULL */
);
-void ivas_limiter_dec(
- IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */
- float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */
- const int16_t num_channels, /* i : number of channels to be processed */
- const int16_t output_frame, /* i : number of samples per channel in the buffer */
- const int16_t BER_detect /* i : BER detect flag */
-);
void ivas_limiter_dec_fx(
IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */
Word32 *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */
@@ -2683,13 +2688,7 @@ void ivas_limiter_dec_fx(
const Word16 BER_detect, /* i : BER detect flag */
Word16 q_factor /* i : Q factor of the output samples */
);
-void limiter_process(
- IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */
- const int16_t output_frame, /* i : number of samples to be processed per channel in the I/O buffer */
- const float threshold, /* i : signal amplitude above which limiting starts to be applied */
- const int16_t BER_detect, /* i : BER detect flag */
- int16_t *strong_saturation_cnt /* i/o: counter of strong saturations (can be NULL) */
-);
+
void limiter_process_fx(
IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */
const Word16 output_frame, /* i : number of samples to be processed per channel in the I/O buffer */
@@ -2738,13 +2737,15 @@ void ivas_lfe_lpf_enc_apply_fx(
// ivas_arith.c
void ivas_ari_done_encoding_14bits_fx(
BSTR_ENC_HANDLE hBstr,
- Tastat *s );
+ Tastat *s
+);
void ivas_ari_encode_14bits_ext_fx(
BSTR_ENC_HANDLE hBstr,
Tastat *s,
Word32 symbol,
- const UWord16 *cum_freq );
+ const UWord16 *cum_freq
+);
void ms_inv_mask_processing_fx(
STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT encoder structure */
@@ -2855,6 +2856,7 @@ void ivas_spar_bitrate_dist_fx(
const Word16 sba_order, /* i : Ambisonic (SBA) order */
const Word16 bwidth /* i : audio bandwidth */
);
+
ivas_error ivas_corecoder_enc_reconfig_fx(
Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
const Word16 nSCE_old, /* i : number of SCEs in previous frame */
@@ -2871,6 +2873,7 @@ void ivas_sba_zero_vert_comp_fx(
const Word16 sba_planar, /* i : SBA planar flag */
const Word16 input_frame /* i : frame length */
);
+
void tdm_configure_dec_fx(
const Word16 ivas_format, /* i : IVAS format */
const Word16 ism_mode, /* i : ISM mode in combined format */
@@ -2893,6 +2896,7 @@ Word16 mdct_classifier_ivas_fx(
const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */
);
+
/*----------------------------------------------------------------------------------*
* Range Coder prototypes
*----------------------------------------------------------------------------------*/
@@ -3166,15 +3170,15 @@ void stereo_tcx_core_enc(
Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */
const Word16 last_element_mode, /* i : last element mode, Q0 */
const Word16 vad_hover_flag, /* i : VAD hangover flag, Q0 */
- Word16 Q_new );
-
+ Word16 Q_new
+);
Word16 transient_analysis_ivas_fx(
TRAN_DET_HANDLE hTranDet, /* i : handle transient detection */
const Word16 cor_map_LT[], /* i : LT correlation map Q_cor_map = Qx */
- Word16 Q_cor_map,
+ const Word16 Q_cor_map,
const Word16 multi_harm_limit, /* i : multi harmonic threshold Q_multi_harm_limit = Qx */
- Word16 Q_multi_harm_limit );
+ const Word16 Q_multi_harm_limit );
void set_transient_stereo_fx(
CPE_ENC_HANDLE hCPE, /* i : CPE structure */
@@ -3293,20 +3297,24 @@ void ivas_fb_mixer_get_windowed_fr_fx(
const Word16 length, /* i : number of new samples in time slot */
const Word16 mdft_len, /* i : MDFT frame length */
const Word16 nchan_fb_in, /* i : number of analysis channels */
- Word16 gb );
+ Word16 gb
+);
+
void ivas_omasa_set_config_fx(
OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */
MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */
const Word32 input_Fs, /* i : Input sample rate */
const ISM_MODE ism_mode /* i : ISM mode */
);
+
Word16 ivas_omasa_ener_brate_fx(
const Word16 nchan_ism, /* i : number of ISMs */
const Word32 ivas_total_brate, /* i : IVAS total bitrate */
Word32 *data_f[], /* i : Input / transport audio signals */
const Word16 input_frame, /* i : Input frame size */
- Word16 data_e /*i:exponent for data_f */
+ const Word16 data_e /* i : exponent for data_f */
);
+
void computeDiffuseness_mdft_fx(
Word32 **buffer_intensity[DIRAC_NUM_DIMS],
const Word32 *buffer_energy,
@@ -3345,6 +3353,7 @@ UWord8 ivas_masa_surrcoh_signicant_fx(
ivas_error ivas_mcmasa_enc_open_fx(
Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */
);
+
void ivas_mcmasa_enc_close_fx(
MCMASA_ENC_HANDLE *hMcMasa, /* i/o: encoder McMASA handle */
const Word32 input_Fs /* i : input sampling rate */
@@ -3426,7 +3435,7 @@ void mctStereoIGF_enc_fx(
Encoder_State **sts, /* i/o: encoder state structure */
Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */
Word16 q_origSpec, /* i : Q for MDCT spectrum */
- Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */
+ Word32 *powerSpec[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */
Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */
Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/
Word16 *q_powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : Q for powSpecMsInv_fx */
@@ -3500,7 +3509,9 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512_fx(
BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */
IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */
const Word16 bits_sph_idx,
- const Word16 bits_sp_coh );
+ const Word16 bits_sp_coh
+);
+
void ivas_merge_masa_metadata_fx(
MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */
OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */
@@ -3511,9 +3522,7 @@ void ivas_qmetadata_enc_sid_encode_fx(
BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */
IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */
const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure*/
-#ifdef NONBE_FIX_1052_SBA_EXT
- const Word16 nchan_transport, /* i : number of transport channels */
-#endif
+ const Word16 nchan_transport, /* i : number of transport channels */
const Word16 ivas_format /* i : ivas format */
);
void ivas_param_mc_enc_fx(
@@ -3522,12 +3531,14 @@ void ivas_param_mc_enc_fx(
Word32 *data_f_fx[], /* i/o: input/transport MC data Q11 */
const Word16 input_frame /* i : input frame length */
);
+
void ivas_merge_masa_transports_fx(
Word32 data_in_f1_fx[][L_FRAME48k], // Qx
Word32 *data_in_f2_fx[], // Qx
Word32 *data_out_f_fx[], // Qx
const Word16 input_frame,
- const Word16 num_transport_channels );
+ const Word16 num_transport_channels
+);
void ivas_param_mc_enc_close_fx(
PARAM_MC_ENC_HANDLE *hParamMC, /* i/o: Parametric MC encoder handle */
@@ -3624,24 +3635,27 @@ ivas_error ivas_masa_encode_fx(
);
void ivas_write_format_sid_fx(
- const IVAS_FORMAT ivas_format, /* i : IVAS format */
- const Word16 element_mode, /* i : element bitrate */
- BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ const Word16 element_mode, /* i : element bitrate */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 sba_order, /* i : Ambisonic (SBA) order */
+ const Word16 sba_planar /* i : SBA planar flag */
);
-void ivas_write_format_fx( /* i/o: IVAS encoder structure */
- Encoder_Struct *st_ivas );
+void ivas_write_format_fx(
+ Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
+);
ivas_error create_sce_enc_fx(
- Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
- const Word16 sce_id, /* i : SCE # identifier */
- const Word32 element_brate /* i : element bitrate */
+ Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
+ const Word16 sce_id, /* i : SCE # identifier */
+ const Word32 element_brate /* i : element bitrate */
);
ivas_error create_cpe_enc_fx(
- Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
- const Word16 cpe_id, /* i : CPE # identifier */
- const Word32 element_brate /* i : element bitrate */
+ Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
+ const Word16 cpe_id, /* i : CPE # identifier */
+ const Word32 element_brate /* i : element bitrate */
);
void ivas_quantise_real_values_fx(
@@ -3737,18 +3751,22 @@ void ivas_init_binaural_hrtf_fx(
);
ivas_error ivas_allocate_binaural_hrtf_fx(
- 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 Word16 allocate_init_flag /* i : Memory allocation flag */
+ HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ const int16_t n_channels, /* i : number of input channels */
+#else
+ 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 */
+#endif
+ const int16_t allocate_init_flag /* i : Memory allocation flag */
);
void ivas_binRenderer_fx(
- BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */
- const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
- COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/
- const Word16 numTimeSlots, /* i : number of time slots to render */
+ BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */
+ const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData, /* i/o: pose correction data handle */
+ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/
+ const Word16 numTimeSlots, /* i : number of time slots to render */
Word32 Cldfb_RealBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */
Word32 Cldfb_ImagBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */
Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */
@@ -3893,16 +3911,23 @@ ivas_error ivas_osba_render_sf_fx(
Word32 *p_output[] /* o : rendered time signal */
);
+void ivas_osba_stereo_add_channels_fx(
+ Word32 *tc_fx[], /* i : transport channels */
+ Word32 *output_fx[], /* i/o: output channels */
+ const Word16 gain, /* i : gain bed value Q11 */
+ const Word16 nchan_out, /* i : number of output channels */
+ const Word16 nchan_ism, /* i : number of ISM channels */
+ const UWord16 n_samples_to_render /* i : output frame length per channel */
+);
+
void ivas_osba_data_close_fx(
SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */
);
-#ifdef NONBE_FIX_ISM_XOVER_BR
ISM_MODE ivas_osba_ism_mode_select(
const Word32 ivas_total_brate, /* i : IVAS total bitrate */
const Word16 nchan_ism /* i : number of input ISM's */
);
-#endif
void ivas_set_ism_importance_interformat_fx(
const Word32 ism_total_brate, /* i/o: ISms total bitrate */
@@ -3995,12 +4020,14 @@ void sns_avq_dec_stereo_fx(
Word32 *SNS_Ql, /* o : Quantized SNS vectors (left channel) */
Word16 *q_l,
Word32 *SNS_Qr, /* o : Quantized SNS vectors (right channe) */
- Word16 *q_r );
+ Word16 *q_r
+);
void dequantize_sns_fx(
Word16 indices[CPE_CHANNELS][NPRM_LPC_NEW],
Word32 snsQ_out[CPE_CHANNELS][NB_DIV][M],
- Decoder_State **sts );
+ Decoder_State **sts
+);
void inverseMS_fx(
const Word16 L_frame, /* i : frame length Q0*/
@@ -4016,7 +4043,6 @@ void ivas_syn_output_f_fx(
Word32 *synth_out /* o : integer 16 bits synthesis signal */
);
-
ivas_error ivas_init_encoder_fx(
Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
);
@@ -4027,10 +4053,17 @@ ivas_error ivas_output_buff_dec_fx(
const Word16 nchan_out_buff /* i : number of output channels */
);
+ivas_error ivas_dec_get_format_fx(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+);
+
ivas_error ivas_dec_setup(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
Word16 *data /* o : output synthesis signal */
+#endif
);
ivas_error create_mct_dec_fx(
@@ -4106,7 +4139,8 @@ Word16 ivas_smc_gmm_fx(
const Word16 flag_spitch, /* i : flag to indicate very short stable pitch */
Word16 Qfact_PS,
Word16 Q_esp,
- Word16 Qfact_PS_past );
+ Word16 Qfact_PS_past
+);
void ivas_signaling_enc_fx(
Encoder_State *st, /* i/o: encoder state structure */
@@ -4152,12 +4186,13 @@ void TonalMdctConceal_create_concealment_noise_ivas_fx(
const Word16 subframe_idx,
const Word16 core,
const Word16 crossfade_gain,
- const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode );
-
+ const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode
+);
Word16 rand_triangular_signed_fx(
Word16 *seed,
- Word16 *exp_fac );
+ Word16 *exp_fac
+);
Word64 var_32_fx(
const Word32 *x, /* i : input vector */
@@ -4167,7 +4202,8 @@ Word64 var_32_fx(
ivas_error ivas_jbm_dec_tc_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- Word32 *data_fx );
+ Word32 *data_fx
+);
ivas_error ivas_jbm_dec_flush_renderer_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
@@ -4195,6 +4231,12 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
Word32 *data /* i/o: transport channels/output synthesis signal */
);
+#ifdef OBJ_EDITING_API
+void ivas_jbm_dec_prepare_renderer(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+);
+#endif
+
void ivas_jbm_dec_get_adapted_subframes(
const Word16 nCldfbTs, /* i : number of time slots in the current frame */
Word16 *subframe_nbslots, /* i/o: subframe grid */
@@ -4262,9 +4304,12 @@ ivas_error ivas_ism_metadata_enc_fx(
ivas_error ivas_ism_dec_config(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const ISM_MODE last_ism_mode, /* i/o: last ISM mode */
+ const ISM_MODE last_ism_mode /* i/o: last ISM mode */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */
Word16 *data /* o : output synthesis signal */
+#endif
);
ivas_error ivas_param_ism_dec_open_fx(
@@ -4287,6 +4332,18 @@ void ivas_param_ism_dec_digest_tc_fx(
Word32 *transport_channels[], /* i : synthesized core-coder transport channels/DirAC output */
Word16 q_tc_in );
+
+#ifdef OBJ_EDITING_API
+void ivas_param_ism_dec_dequant_md_fx(
+ Decoder_Struct *st_ivas
+);
+
+void ivas_param_ism_dec_prepare_renderer_fx(
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const Word16 nCldfbSlots /* i : number of CLFBS slots in the transport channels */
+);
+#endif
+
void ivas_param_ism_dec_render_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */
@@ -5130,6 +5187,13 @@ void ivas_param_mc_dec_digest_tc_fx(
Word32 *transport_channels_f_fx[],
Word16 transport_f_e );
+#ifdef OBJ_EDITING_API
+void ivas_param_mc_dec_prepare_renderer(
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const UWord8 nCldfbSlots /* i : number of CLFBS slots in the transport channels */
+);
+#endif
+
void ivas_param_mc_dec_render_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */
@@ -5847,11 +5911,10 @@ ivas_error ivas_dirac_enc_fx(
const Word16 input_frame, /* i : input frame length */
const Word16 dtx_vad, /* i : DTX vad flag */
const IVAS_FORMAT ivas_format, /* i : ivas format */
-#ifdef NONBE_FIX_1052_SBA_EXT
- const Word16 nchan_transport, /* i : number of transport channels */
-#endif
+ const Word16 nchan_transport, /* i : number of transport channels */
const Word16 hodirac_flag, /* i : hodirac flag */
- const Word16 shift );
+ const Word16 shift
+);
ivas_error ivas_spar_md_enc_init_fx(
ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */
@@ -6151,49 +6214,56 @@ void ivas_initialize_handles_dec(
);
ivas_error ivas_core_enc_fx(
- SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */
- CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
- MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
- const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/
- Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/
- Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/
- Word16 Q_new[],
- Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/
- Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/
- Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquantized for subframes Q12*/
- Word32 epsP_fx[][M + 1], /* i : LP prediction errors epsP_fx_q*/
- Word16 epsP_fx_q[], /* i : LP prediction errors */
- Word16 lsp_new_fx[][M], /* i : LSPs at the end of the frame Q15*/
- Word16 lsp_mid_fx[][M], /* i : LSPs in the middle of the frame Q15*/
- const Word16 vad_hover_flag[], /* i : VAD hanglover flag Q0*/
- Word16 attack_flag[], /* i : attack flag (GSC or TC) Q0*/
- Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer q_re_im_buf*/
- Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer q_re_im_buf*/
- Word16 *q_re_im_buf,
- Word16 old_wsp_fx[][L_WSP], /* i : weighted input signal buffer e_old_wsp*/
- Word16 e_old_wsp[],
- const Word16 loc_harm[], /* i : harmonicity flag Q0*/
- const Word16 cor_map_sum_fx[], /* i : speech/music clasif. parameter Q8*/
- const Word16 vad_flag_dtx[], /* i : HE-SAD flag with additional DTX HO Q0*/
- Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/
- Word16 enerBuffer_fx_exp[], /* o : energy buffer */
- Word16 fft_buff_fx[][2 * L_FFT], /* i : FFT buffer Qx*/
- const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag Q0*/
- const Word16 ivas_format, /* i : IVAS format Q0*/
- const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/
+ SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */
+ CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
+ MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
+ const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/
+ Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/
+ Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/
+ Word16 Q_new[], /* i : Q factor of speech buffers */
+ Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/
+ Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/
+ Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquantized for subframes Q12*/
+ Word32 epsP_fx[][M + 1], /* i : LP prediction errors epsP_fx_q*/
+ Word16 epsP_fx_q[], /* i : LP prediction errors */
+ Word16 lsp_new_fx[][M], /* i : LSPs at the end of the frame Q15*/
+ Word16 lsp_mid_fx[][M], /* i : LSPs in the middle of the frame Q15*/
+ const Word16 vad_hover_flag[], /* i : VAD hanglover flag Q0*/
+ Word16 attack_flag[], /* i : attack flag (GSC or TC) Q0*/
+ Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer q_re_im_buf*/
+ Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer q_re_im_buf*/
+ Word16 *q_re_im_buf, /* i : Q factor of re/in CLDFB buffers */
+ Word16 old_wsp_fx[][L_WSP], /* i : weighted input signal buffer e_old_wsp*/
+ Word16 e_old_wsp[], /* i : Q factor of old_wsp buffer */
+ const Word16 loc_harm[], /* i : harmonicity flag Q0*/
+ const Word16 cor_map_sum_fx[], /* i : speech/music clasif. parameter Q8*/
+ const Word16 vad_flag_dtx[], /* i : HE-SAD flag with additional DTX HO Q0*/
+ Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/
+ Word16 enerBuffer_fx_exp[], /* o : energy buffer */
+ Word16 fft_buff_fx[][2 * L_FFT], /* i : FFT buffer Qx*/
+ const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag Q0*/
+ const Word16 ivas_format, /* i : IVAS format Q0*/
+ const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/
);
void ivas_renderer_select(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
+#ifdef FIX_CREND_SIMPLIFY_CODE
+/*! r: secondary binaural renderer type */
+RENDERER_TYPE ivas_renderer_secondary_select(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+);
+#endif
+
ivas_error ivas_mc_enc_config_fx(
Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
);
/*! r: flag indicating a valid bitrate */
Word16 is_IVAS_bitrate_fx(
- const Word32 ivas_total_brate /* i : IVAS total bitrate */
+ const Word32 ivas_total_brate /* i : IVAS total bitrate */
);
int16_t is_DTXrate(
@@ -6235,9 +6305,9 @@ void ivas_jbm_masa_sf_to_sf_map(
*----------------------------------------------------------------------------------*/
void bitbudget_to_brate(
- const Word16 x[], /* i : bitbudgets Q0 */
- Word32 y[], /* o : bitrates Q0 */
- const Word16 N /* i : number of entries to be converted */
+ const Word16 x[], /* i : bitbudgets Q0 */
+ Word32 y[], /* o : bitrates Q0 */
+ const Word16 N /* i : number of entries to be converted */
);
void ivas_ism_reset_metadata(
@@ -6245,7 +6315,7 @@ void ivas_ism_reset_metadata(
);
void ivas_ism_reset_metadata_enc(
- ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */
+ ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handle */
);
void ivas_ism_reset_metadata_API(
ISM_METADATA_HANDLE hIsmMeta /* i/o: ISM metadata handles */
@@ -6253,45 +6323,44 @@ void ivas_ism_reset_metadata_API(
/*! r: index of the winning codeword */
Word16 ism_quant_meta_fx(
- const Word32 val, /* i : scalar value to quantize Q22 */
- Word32 *valQ, /* o : quantized value Q22 */
- const Word32 borders_fx[], /* i : level borders Q22 */
- const Word32 q_step_fx, /* i : quantization step Q22 */
- const Word32 q_step_border_fx, /* i : quantization step at the border Q22 */
- const Word16 cbsize /* i : codebook size */
+ const Word32 val, /* i : scalar value to quantize Q22 */
+ Word32 *valQ, /* o : quantized value Q22 */
+ const Word32 borders_fx[], /* i : level borders Q22 */
+ const Word32 q_step_fx, /* i : quantization step Q22 */
+ const Word32 q_step_border_fx, /* i : quantization step at the border Q22 */
+ const Word16 cbsize /* i : codebook size */
);
ivas_error ivas_ism_metadata_enc_create_fx(
Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
- const Word16 n_ISms, /* i : number of objects */
- Word32 element_brate_tmp[] /* o : element bitrate per object */
+ const Word16 n_ISms, /* i : number of objects */
+ Word32 element_brate_tmp[] /* o : element bitrate per object */
);
+
/*----------------------------------------------------------------------------------*
* Parametric ISM prototypes
*----------------------------------------------------------------------------------*/
-/*! r: ISM format mode */
-
ivas_error ivas_param_ism_enc_open_fx(
Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
);
void ivas_param_ism_enc_close_fx(
PARAM_ISM_CONFIG_HANDLE *hParamIsm, /* i/o: ParamISM handle */
- const Word32 input_Fs /* i : input sampling_rate */
+ const Word32 input_Fs /* i : input sampling_rate */
);
void ivas_ism_metadata_close(
- ISM_METADATA_HANDLE hIsmMetaData[], /* i/o : object metadata handles */
- const Word16 first_idx /* i : index of first handle to deallocate */
+ ISM_METADATA_HANDLE hIsmMetaData[], /* i/o: object metadata handles */
+ const Word16 first_idx /* i : index of first handle to deallocate */
);
-
ivas_error ivas_ism_enc_config(
Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
);
+
/*----------------------------------------------------------------------------------*
* ISM DTX prototypes
*----------------------------------------------------------------------------------*/
@@ -6373,41 +6442,43 @@ void tdm_bit_alloc(
const Word16 tdm_inst_ratio_idx /* i : instantaneous correlation ratio index */
);
-
/*! r: value of the indice */
uint16_t get_indice_st(
Decoder_State *st, /* i/o: decoder state structure */
- const Word32 element_brate, /* i : element bitrate */
- const Word16 pos, /* i : absolute position in the bitstream */
- const Word16 nb_bits /* i : number of bits to quantize the indice */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word16 pos, /* i : absolute position in the bitstream */
+ const Word16 nb_bits /* i : number of bits to quantize the indice */
);
+
/*----------------------------------------------------------------------------------*
* MDCT Stereo prototypes
*----------------------------------------------------------------------------------*/
void stereo_mdct_core_enc_fx(
CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
- Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Q0*/
- Word16 old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/
- Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k] /* o : floating pitch for each subframe Q6*/
+ Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Q0*/
+ Word16 old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/
+ Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k] /* o : floating pitch for each subframe Q6*/
);
Word16 write_stereo_to_bitstream_fx
(
STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */
Encoder_State **sts, /* i/o: Encoder state structure */
- Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask Q0*/
- const Word16 mct_on, /* i : flag mct block (1) or stereo (0) Q0*/
+ Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask Q0*/
+ const Word16 mct_on, /* i : flag mct block (1) or stereo (0) Q0*/
BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */
);
+
/*----------------------------------------------------------------------------------*
* Stereo CNG prototypes
*----------------------------------------------------------------------------------*/
+
void stereo_cng_dec_update(
CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
- const Word32 ivas_total_brate /* i : IVAS total bitrate Q0*/
+ const Word32 ivas_total_brate /* i : IVAS total bitrate Q0*/
);
@@ -6673,8 +6744,7 @@ void ivas_set_qmetadata_maxbit_req_fx(
* Binaural FastConv Renderer Prototypes
*-----------------------------------------------------------------------------------*/
-
-void ivas_binaural_hrtf_close(
+void ivas_binaural_hrtf_close_fx(
HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */
);
diff --git a/lib_com/ivas_qmetadata_com_fx.c b/lib_com/ivas_qmetadata_com_fx.c
index a5fbf9e83c6d8c0c3b21f77d0a96f8d889f4543a..906277f54294d732a576187b64c798e8e375c836 100644
--- a/lib_com/ivas_qmetadata_com_fx.c
+++ b/lib_com/ivas_qmetadata_com_fx.c
@@ -40,9 +40,7 @@
#include "cnst.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
-// #include "debug.h"
/*-----------------------------------------------------------------------*
* Local constants
diff --git a/lib_com/ivas_qspherical_com_fx.c b/lib_com/ivas_qspherical_com_fx.c
index 844c3ecdef2cdd60899fb73e3e549a35e4ee9e1b..7d7c159b365ed4e89520a51b472381c25d7b7c8a 100644
--- a/lib_com/ivas_qspherical_com_fx.c
+++ b/lib_com/ivas_qspherical_com_fx.c
@@ -40,7 +40,6 @@
#include "cnst.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-------------------------------------------------------------------------
diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c
deleted file mode 100644
index 183e61ca120743853245ef73bb52b253713fc5a2..0000000000000000000000000000000000000000
--- a/lib_com/ivas_rom_com.c
+++ /dev/null
@@ -1,2907 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#include
-#include "options.h"
-#include
-#include "cnst.h"
-#include "ivas_cnst.h"
-#include "ivas_rom_com.h"
-#include "wmc_auto.h"
-
-/* clang-format off */
-
-/*----------------------------------------------------------------------------------*
- * Table of IVAS bitrates
- *----------------------------------------------------------------------------------*/
-
-const Word32 ivas_brate_tbl[SIZE_IVAS_BRATE_TBL] =
-{
- FRAME_NO_DATA, IVAS_SID_5k2,
- IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k,
- IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k,
- IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k
-};
-
-/*-------------------------------------------------------------------------
- * DFT Stereo ROM tables
- *------------------------------------------------------------------------*/
-
-/*4xERB scale: max of 14 bands*/
-const Word16 dft_band_limits_erb4[STEREO_DFT_ERB4_BANDS] =
-{
- 1, 3, 5, 10, 18, 26, 41, 56, 84, 132, 214, 342, 470, 601
-};
-
-/*8xERB scale: max of 8 bands*/
-const Word16 dft_band_limits_erb8[STEREO_DFT_ERB8_BANDS] =
-{
- 1, 5, 18, 41, 84, 214, 470, 601
-};
-
-
-const Word16 dft_band_ipd[3][4] =
-{
- {0,8,10,13},
- {0,5,6,8},
- {0,2,3,4}
-};
-
-const Word16 dft_band_res_cod[3][4] =
-{
- {0,8,10,11},
- {0,5,6,7},
- {0,5,6,7}
-};
-
-// Q31
-const Word32 dft_res_gains_q_Q31[][2] =
-{
- /* quantization points for joint quantization of prediction gain and residual energy */
-
- /* column 1 (|ILD| = 0): */
- {0, 0 },
- {0, 251216928 },
- {0, 487459456 },
- {0, 731632640 },
- {0, 997611392 },
- {0, 1299397248 },
- {0, 1666984192 },
- {0, 2147483647 },
-
- /* column 2 (|ILD| = 2): */
- {246151024, 0 },
- {249475328, 247871152 },
- {258660112, 480729248 },
- {274304544, 720918848 },
- {298427200, 981720000 },
- {334663840, 1276185088 },
- {391374592, 1632160640 },
- {485919712, 2091786496 },
-
- /* column 3 (|ILD| = 4): */
- {485919712, 0 },
- {492224736, 238188144 },
- {509610752, 461283776 },
- {539117184, 690072384 },
- {584326016, 936189056 },
- {651608832, 1210182144 },
- {755411712, 1534299776 },
- {924504576, 1938292992 },
-
- /* column 4 (|ILD| = 6): */
- {713563712, 0 },
- {722237376, 223142880 },
- {746085184, 431184640 },
- {786311872, 642617280 },
- {847364864, 866812416 },
- {936938496, 1111020032 },
- {1072199936, 1390431232 },
- {1285225984, 1720430720 },
-
- /* column 5 (|ILD| = 8): */
- {924504576, 0 },
- {934784576, 204139792 },
- {962942400, 393358880 },
- {1010083968, 583482048 },
- {1080789888, 781462848 },
- {1182728704, 991308544 },
- {1332741248, 1221608960 },
- {1559902080, 1475937536 },
-
- /* column 6 (|ILD| = 10): */
- {1115604864, 0 },
- {1126709504, 182744416 },
- {1156997632, 351025536 },
- {1207276672, 517958016 },
- {1281710592, 688294272 },
- {1387005952, 863412992 },
- {1537761536, 1046870336 },
- {1757032448, 1234717184 },
-
- /* column 7 (|ILD| = 13): */
- {1361843968, 0 },
- {1372924928, 149366080 },
- {1402942464, 285507936 },
- {1452130560, 417893888 },
- {1523515136, 548787328 },
- {1621670144, 677135936 },
- {1756740352, 802203264 },
- {1942499840, 915633344 },
-
- /* column 8 (|ILD| = 16): */
- {1559902080, 0 },
- {1569913600, 117815248 },
- {1596862336, 224162928 },
- {1640492800, 325650848 },
- {1702660352, 423060736 },
- {1785997696, 514412544 },
- {1896788608, 597466432 },
- {2042241920, 664027712 },
-
- /* column 9 (|ILD| = 19): */
- {1714196608, 0 },
- {1722634112, 90359672 },
- {1745223424, 171238192 },
- {1781415040, 247171072 },
- {1832190080, 318199104 },
- {1898830848, 382271424 },
- {1984989952, 437025792 },
- {2094086528, 475912448 },
-
- /* column 10 (|ILD| = 22): */
- {1831427712, 0 },
- {1838194432, 67828272 },
- {1856228992, 128123168 },
- {1884882944, 183977072 },
- {1924581248, 235132272 },
- {1975822336, 279821408 },
- {2040659200, 316058048 },
- {2120554240, 339023232 },
-
- /* column 11 (|ILD| = 25): */
- {1918819584, 0 },
- {1924055168, 50102940 },
- {1937964416, 94399088 },
- {1959916032, 135003712 },
- {1990038784, 171579648 },
- {2028424960, 202728896 },
- {2076217216, 226931040 },
- {2133943808, 240762976 },
-
- /* column 12 (|ILD| = 30): */
- {2015827840, 0 },
- {2019068416, 29502130 },
- {2027636864, 55420112 },
- {2041056512, 78889960 },
- {2059271424, 99626064 },
- {2082150784, 116769424 },
- {2110128128, 129415952 },
- {2143192960, 135682304 },
-
- /* column 13 (|ILD| = 35): */
- {2072441984, 0 },
- {2074364032, 17033840 },
- {2079438464, 31939524 },
- {2087347712, 45337676 },
- {2098012032, 57039312 },
- {2111296384, 66537632 },
- {2127368192, 73321536 },
- {2146126464, 76351632 },
-
- /* column 14 (|ILD| = 40): */
- {2104959232, 0 },
- {2106073728, 9723806 },
- {2109011456, 18212808 },
- {2113579136, 25810606 },
- {2119712384, 32401234 },
- {2127314432, 37692632 },
- {2136458496, 41399188 },
- {2147054208, 42945376 },
-
- /* column 15 (|ILD| = 45): */
- {2123466240, 0 },
- {2124103936, 5514738 },
- {2125783296, 10322954 },
- {2128390400, 14615774 },
- {2131882240, 18322330 },
- {2136200832, 21283710 },
- {2141376256, 23332410 },
- {2147348352, 24150602 },
-
- /* column 16 (|ILD| = 50): */
- {2133943808, 0 },
- {2134306688, 3115998 },
- {2135260160, 5830418 },
- {2136737664, 8250632 },
- {2138715520, 10335839 },
- {2141157120, 11995844 },
- {2144077696, 13136157 },
- {2147440640, 13580687 }
-};
-
-
-/* tables for adaptive Golomb-Rice coding of DFT stereo parameters */
-const Word16 dft_code_itd[] =
-{
- 0, 3, 4, 13, 8, 9, 12, 5, 10, 44, 23, 60, 45, 31, 235, 59, 28, 61, 234, 116
-};
-
-const Word16 dft_len_itd[] =
-{
- 2, 3, 4, 4, 4, 4, 4, 4, 4, 6, 5, 6, 6, 5, 8, 6, 5, 6, 8, 7
-};
-
-const Word16 dft_maps_rpg[] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7,
- 2, 0, 1, 3, 4, 5, 6, 7,
- 6, 2, 0, 1, 3, 4, 5, 7,
- 7, 5, 2, 0, 1, 3, 4, 6,
- 7, 6, 4, 3, 1, 0, 2, 5,
- 7, 6, 5, 3, 2, 1, 0, 4,
- 7, 6, 5, 4, 3, 2, 0, 1,
- 7, 6, 5, 4, 3, 2, 0, 1,
- 6, 5, 4, 3, 1, 0, 2, 7,
-};
-
-const Word16 dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 15, 4, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 12, 9, 4, 1, 0, 2, 3, 5, 6, 7, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 16, 14, 8, 4, 2, 0, 1, 3, 5, 6, 7, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 18, 16, 14, 10, 5, 0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 21, 19, 17, 15, 8, 4, 2, 0, 1, 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 21, 19, 17, 15, 12, 8, 4, 0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 21, 19, 17, 15, 13, 11, 9, 3, 0, 1, 2, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 24, 22, 20, 18, 16, 14, 12, 9, 6, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 15, 17, 19, 21, 23, 25, 26, 27, 28, 29, 30,
- 25, 23, 21, 19, 17, 15, 13, 11, 9, 6, 0, 1, 2, 3, 4, 5, 7, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 27, 28, 29, 30,
- 27, 25, 23, 21, 19, 17, 15, 13, 11, 8, 5, 0, 1, 2, 3, 4, 6, 7, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 29, 30,
- 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 28, 29, 30,
- 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30,
- 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
- 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
- 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29,
- 30, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28,
- 30, 29, 28, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26,
- 30, 29, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 9, 7, 6, 4, 3, 2, 1, 0, 5, 8, 11, 13, 15, 17, 19, 21, 23, 25, 27,
- 30, 29, 28, 27, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 7, 5, 4, 3, 2, 1, 0, 6, 9, 11, 13, 15, 17, 19, 21, 23, 25,
- 30, 29, 28, 27, 26, 25, 23, 21, 19, 17, 15, 13, 11, 10, 8, 7, 5, 4, 3, 2, 1, 0, 6, 9, 12, 14, 16, 18, 20, 22, 24,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 12, 10, 8, 7, 6, 5, 4, 2, 1, 0, 3, 9, 11, 13, 15, 17, 19, 21,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 0, 4, 8, 12, 15, 17, 19, 21,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 13, 12, 11, 10, 9, 7, 6, 5, 3, 1, 0, 2, 4, 8, 15, 17, 19, 21,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 17, 15, 13, 12, 11, 9, 8, 7, 6, 4, 3, 2, 1, 0, 5, 10, 14, 16, 18,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 15, 13, 12, 11, 10, 9, 7, 6, 5, 3, 1, 0, 2, 4, 8, 14, 16,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 11, 10, 8, 7, 6, 5, 3, 2, 0, 1, 4, 9, 12,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 3, 2, 1, 0, 4, 15,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1,
- 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
-};
-
-
-/*-------------------------------------------------------------------------
- * Range Coder ROM tables
- *------------------------------------------------------------------------*/
-
-/* Create separate tables for cumulative frequency and symbol frequency */
-const UWord16 cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS] =
-{
- { 0,16,47,153,241,269,325,468,591,674,798,912,1017,1082,1183,1277,1364,16384 },
- { 0,7401,7844,7886,7899,12065,12718,12790,12805,14099,14476,14533,14549,15058,15264,15299,15310,16384 },
- { 0,4362,6345,6864,7038,9037,11049,11736,12002,12569,13301,13656,13822,14021,14334,14515,14607,16384 },
- { 0,2955,5183,5822,6013,8153,10671,11614,11943,12586,13540,14025,14232,14437,14770,14978,15080,16384 },
- { 0,3155,4981,5615,5855,7969,9953,10739,11073,11936,12837,13208,13383,13767,14203,14400,14498,16384 },
- { 0,1216,2630,3264,3558,4831,6679,7661,8157,8709,9622,10204,10542,10799,11243,11568,11777,16384 },
- { 0,1759,3641,4350,4612,6325,8678,9732,10161,10790,11790,12361,12642,12883,13295,13566,13720,16384 },
- { 0,1109,2705,3433,3732,5226,7532,8732,9263,9978,11142,11842,12188,12490,12986,13321,13520,16384 },
- { 0,11524,13046,13170,13191,14956,15708,15813,15837,16028,16162,16195,16204,16245,16282,16295,16300,16384 },
- { 0,8027,10586,10909,10974,13291,14861,15157,15232,15535,15824,15914,15943,16014,16090,16123,16136,16384 },
- { 0,834,2034,2674,2997,4087,5843,6891,7455,8030,9013,9688,10085,10376,10893,11277,11528,16384 },
- { 0,6038,9086,9451,9519,12332,14521,14913,15003,15329,15711,15848,15893,15955,16045,16091,16111,16384 },
- { 0,4732,7685,8354,8545,10717,12924,13618,13852,14291,14842,15083,15181,15314,15491,15582,15625,16384 },
- { 0,745,1783,2347,2655,3537,4963,5864,6406,6863,7664,8248,8634,8891,9351,9708,9958,16384 },
- { 0,3957,6794,7669,7998,9743,11676,12498,12869,13313,13894,14186,14332,14498,14714,14835,14906,16384 },
- { 0,2779,5388,6021,6201,8582,11352,12260,12544,13117,13981,14408,14580,14751,15039,15213,15298,16384 },
- { 0,448,1160,1625,1920,2576,3706,4518,5053,5474,6234,6835,7262,7531,8032,8446,8758,16384 },
- { 0,1,2,1555,2246,2247,2248,3489,4112,5449,6596,7302,7710,8311,8876,9266,9517,16384 },
- { 0,2496,4910,5544,5722,8049,10799,11689,11973,12583,13467,13878,14047,14234,14537,14712,14803,16384 },
- { 0,921,2222,2880,3188,4407,6321,7406,7955,8573,9616,10296,10679,10978,11502,11880,12118,16384 },
- { 0,2620,4443,5017,5233,7072,9213,10083,10441,11049,11954,12442,12676,12918,13310,13565,13705,16384 },
- { 0,11205,13084,13178,13187,15164,16010,16081,16091,16213,16303,16321,16325,16340,16355,16360,16362,16384 },
- { 0,358,916,1288,1542,2055,2937,3594,4062,4399,5017,5524,5907,6136,6573,6941,7236,16384 },
- { 0,3575,5093,5536,5735,7408,9185,9878,10188,10727,11497,11933,12165,12410,12794,13019,13166,16384 },
- { 0,1,2,640,1036,1037,1038,1670,2096,2696,3287,3732,4056,4417,4800,5106,5339,16384 },
- { 0,969,1397,1518,1578,2633,3338,3566,3675,4197,4664,4857,4957,5288,5625,5783,5874,16384 },
- { 0,10458,12104,12294,12331,14246,15264,15437,15481,15752,15971,16031,16050,16120,16186,16210,16218,16384 },
- { 0,7178,9744,10039,10093,12701,14612,14961,15042,15360,15732,15869,15917,15978,16070,16117,16139,16384 },
- { 0,1298,2418,2879,3113,4146,5509,6227,6621,7053,7755,8229,8539,8776,9186,9492,9714,16384 },
- { 0,4957,7785,8252,8357,10978,13372,13955,14114,14561,15140,15378,15464,15570,15730,15820,15860,16384 },
- { 0,4823,8164,8570,8647,11604,14169,14653,14763,15105,15554,15727,15785,15852,15960,16018,16045,16384 },
- { 0,4735,7010,7517,7660,9986,12230,12914,13131,13666,14374,14689,14814,14972,15212,15342,15404,16384 },
- { 0,3363,5881,6658,6941,8864,11113,12015,12368,12889,13643,14019,14203,14394,14665,14823,14906,16384 },
- { 0,2569,4996,5779,6068,7917,10251,11209,11602,12129,12918,13321,13520,13696,13976,14155,14259,16384 },
- { 0,209,577,848,1046,1378,1982,2465,2835,3072,3513,3893,4202,4374,4703,4994,5241,16384 },
- { 0,2074,4337,5048,5274,7319,10003,11066,11446,12105,13112,13652,13885,14100,14464,14691,14810,16384 },
- { 0,1619,3560,4288,4550,6381,8955,10102,10543,11239,12362,12982,13261,13516,13958,14234,14381,16384 },
- { 0,89,257,441,582,734,1024,1325,1568,1716,1983,2222,2430,2545,2750,2941,3109,16384 },
- { 0,2202,3563,4044,4264,5686,7344,8100,8476,9006,9835,10331,10612,10864,11304,11599,11787,16384 },
- { 0,1220,2801,3492,3784,5223,7387,8496,8998,9640,10711,11369,11711,11993,12486,12829,13035,16384 },
- { 0,12626,13813,13903,13917,15396,15906,15972,15987,16139,16230,16251,16257,16289,16315,16323,16326,16384 },
- { 0,1579,3191,3831,4099,5678,7788,8761,9206,9842,10821,11388,11681,11958,12417,12722,12902,16384 },
- { 0,597,1514,2064,2379,3237,4679,5637,6213,6733,7649,8316,8755,9052,9599,10023,10323,16384 },
- { 0,9273,11762,12080,12151,14038,15210,15446,15514,15725,15929,15995,16019,16068,16124,16148,16158,16384 },
- { 0,9238,11681,11852,11872,14306,15644,15801,15828,16013,16183,16231,16243,16266,16297,16312,16318,16384 },
- { 0,6791,9200,9531,9594,12240,14178,14552,14639,15064,15506,15643,15687,15785,15908,15960,15983,16384 },
- { 0,7175,10415,10905,11033,13038,14621,15002,15123,15367,15651,15762,15806,15864,15938,15974,15992,16384 },
- { 0,5060,7703,8132,8225,10934,13270,13778,13911,14397,14972,15173,15242,15367,15537,15619,15654,16384 },
- { 0,3721,6311,6857,6992,9557,12180,12895,13098,13671,14418,14718,14830,14984,15212,15333,15390,16384 },
- { 0,5971,9288,10044,10269,11991,13680,14228,14437,14750,15130,15293,15374,15459,15579,15642,15677,16384 },
- { 0,3047,5311,5907,6078,8339,10850,11679,11946,12580,13442,13854,14024,14220,14534,14716,14810,16384 },
- { 0,2061,4280,4993,5228,7201,9735,10735,11097,11708,12606,13082,13295,13498,13836,14043,14161,16384 },
- { 0,4738,7949,8880,9234,10781,12502,13214,13531,13897,14355,14593,14718,14835,14998,15096,15153,16384 },
- { 0,3237,5045,5632,5860,7609,9702,10608,10986,11571,12476,12978,13230,13451,13830,14074,14208,16384 },
- { 0,1833,3889,4677,5028,6422,8379,9378,9884,10350,11086,11545,11809,12003,12327,12559,12711,16384 },
- { 0,3989,6858,7352,7459,10254,12936,13571,13735,14240,14895,15153,15242,15364,15548,15646,15690,16384 },
- { 0,1463,3197,3909,4220,5626,7609,8632,9127,9657,10520,11078,11380,11607,11991,12265,12442,16384 },
- { 0,14233,15083,15108,15110,16069,16300,16314,16316,16352,16370,16373,16374,16377,16380,16381,16382,16384 },
- { 0,1,2,2610,3293,3294,3295,5097,5671,8467,10332,11119,11437,12223,12850,13185,13345,16384 },
- { 0,2010,4053,4696,4910,6879,9391,10386,10750,11393,12376,12886,13119,13348,13726,13967,14099,16384 },
- { 0,7586,10517,10758,10791,13543,15346,15577,15619,15846,16082,16150,16169,16202,16245,16265,16273,16384 },
- { 0,3059,5772,6369,6524,9041,11801,12582,12813,13361,14115,14439,14567,14714,14944,15075,15141,16384 },
- { 0,8643,10594,10813,10856,13274,14686,14920,14975,15350,15680,15771,15799,15897,16003,16042,16057,16384 },
- { 0,6720,8878,9325,9467,11564,13248,13744,13929,14384,14880,15087,15167,15311,15488,15569,15607,16384 },
-};
-
-const UWord16 sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] =
-{
- { 16,31,106,88,28,56,143,123,83,124,114,105,65,101,94,87,15020 },
- { 7401,443,42,13,4166,653,72,15,1294,377,57,16,509,206,35,11,1074 },
- { 4362,1983,519,174,1999,2012,687,266,567,732,355,166,199,313,181,92,1777 },
- { 2955,2228,639,191,2140,2518,943,329,643,954,485,207,205,333,208,102,1304 },
- { 3155,1826,634,240,2114,1984,786,334,863,901,371,175,384,436,197,98,1886 },
- { 1216,1414,634,294,1273,1848,982,496,552,913,582,338,257,444,325,209,4607 },
- { 1759,1882,709,262,1713,2353,1054,429,629,1000,571,281,241,412,271,154,2664 },
- { 1109,1596,728,299,1494,2306,1200,531,715,1164,700,346,302,496,335,199,2864 },
- { 11524,1522,124,21,1765,752,105,24,191,134,33,9,41,37,13,5,84 },
- { 8027,2559,323,65,2317,1570,296,75,303,289,90,29,71,76,33,13,248 },
- { 834,1200,640,323,1090,1756,1048,564,575,983,675,397,291,517,384,251,4856 },
- { 6038,3048,365,68,2813,2189,392,90,326,382,137,45,62,90,46,20,273 },
- { 4732,2953,669,191,2172,2207,694,234,439,551,241,98,133,177,91,43,759 },
- { 745,1038,564,308,882,1426,901,542,457,801,584,386,257,460,357,250,6426 },
- { 3957,2837,875,329,1745,1933,822,371,444,581,292,146,166,216,121,71,1478 },
- { 2779,2609,633,180,2381,2770,908,284,573,864,427,172,171,288,174,85,1086 },
- { 448,712,465,295,656,1130,812,535,421,760,601,427,269,501,414,312,7626 },
- { 1,1,1553,691,1,1,1241,623,1337,1147,706,408,601,565,390,251,6867 },
- { 2496,2414,634,178,2327,2750,890,284,610,884,411,169,187,303,175,91,1581 },
- { 921,1301,658,308,1219,1914,1085,549,618,1043,680,383,299,524,378,238,4266 },
- { 2620,1823,574,216,1839,2141,870,358,608,905,488,234,242,392,255,140,2679 },
- { 11205,1879,94,9,1977,846,71,10,122,90,18,4,15,15,5,2,22 },
- { 358,558,372,254,513,882,657,468,337,618,507,383,229,437,368,295,9148 },
- { 3575,1518,443,199,1673,1777,693,310,539,770,436,232,245,384,225,147,3218 },
- { 1,1,638,396,1,1,632,426,600,591,445,324,361,383,306,233,11045 },
- { 969,428,121,60,1055,705,228,109,522,467,193,100,331,337,158,91,10510 },
- { 10458,1646,190,37,1915,1018,173,44,271,219,60,19,70,66,24,8,166 },
- { 7178,2566,295,54,2608,1911,349,81,318,372,137,48,61,92,47,22,245 },
- { 1298,1120,461,234,1033,1363,718,394,432,702,474,310,237,410,306,222,6670 },
- { 4957,2828,467,105,2621,2394,583,159,447,579,238,86,106,160,90,40,524 },
- { 4823,3341,406,77,2957,2565,484,110,342,449,173,58,67,108,58,27,339 },
- { 4735,2275,507,143,2326,2244,684,217,535,708,315,125,158,240,130,62,980 },
- { 3363,2518,777,283,1923,2249,902,353,521,754,376,184,191,271,158,83,1478 },
- { 2569,2427,783,289,1849,2334,958,393,527,789,403,199,176,280,179,104,2125 },
- { 209,368,271,198,332,604,483,370,237,441,380,309,172,329,291,247,11143 },
- { 2074,2263,711,226,2045,2684,1063,380,659,1007,540,233,215,364,227,119,1574 },
- { 1619,1941,728,262,1831,2574,1147,441,696,1123,620,279,255,442,276,147,2003 },
- { 89,168,184,141,152,290,301,243,148,267,239,208,115,205,191,168,13275 },
- { 2202,1361,481,220,1422,1658,756,376,530,829,496,281,252,440,295,188,4597 },
- { 1220,1581,691,292,1439,2164,1109,502,642,1071,658,342,282,493,343,206,3349 },
- { 12626,1187,90,14,1479,510,66,15,152,91,21,6,32,26,8,3,58 },
- { 1579,1612,640,268,1579,2110,973,445,636,979,567,293,277,459,305,180,3482 },
- { 597,917,550,315,858,1442,958,576,520,916,667,439,297,547,424,300,6061 },
- { 9273,2489,318,71,1887,1172,236,68,211,204,66,24,49,56,24,10,226 },
- { 9238,2443,171,20,2434,1338,157,27,185,170,48,12,23,31,15,6,66 },
- { 6791,2409,331,63,2646,1938,374,87,425,442,137,44,98,123,52,23,401 },
- { 7175,3240,490,128,2005,1583,381,121,244,284,111,44,58,74,36,18,392 },
- { 5060,2643,429,93,2709,2336,508,133,486,575,201,69,125,170,82,35,730 },
- { 3721,2590,546,135,2565,2623,715,203,573,747,300,112,154,228,121,57,994 },
- { 5971,3317,756,225,1722,1689,548,209,313,380,163,81,85,120,63,35,707 },
- { 3047,2264,596,171,2261,2511,829,267,634,862,412,170,196,314,182,94,1574 },
- { 2061,2219,713,235,1973,2534,1000,362,611,898,476,213,203,338,207,118,2223 },
- { 4738,3211,931,354,1547,1721,712,317,366,458,238,125,117,163,98,57,1231 },
- { 3237,1808,587,228,1749,2093,906,378,585,905,502,252,221,379,244,134,2176 },
- { 1833,2056,788,351,1394,1957,999,506,466,736,459,264,194,324,232,152,3673 },
- { 3989,2869,494,107,2795,2682,635,164,505,655,258,89,122,184,98,44,694 },
- { 1463,1734,712,311,1406,1983,1023,495,530,863,558,302,227,384,274,177,3942 },
- { 14233,850,25,2,959,231,14,2,36,18,3,1,3,3,1,1,2 },
- { 1,1,2608,683,1,1,1802,574,2796,1865,787,318,786,627,335,160,3039 },
- { 2010,2043,643,214,1969,2512,995,364,643,983,510,233,229,378,241,132,2285 },
- { 7586,2931,241,33,2752,1803,231,42,227,236,68,19,33,43,20,8,111 },
- { 3059,2713,597,155,2517,2760,781,231,548,754,324,128,147,230,131,66,1243 },
- { 8643,1951,219,43,2418,1412,234,55,375,330,91,28,98,106,39,15,327 },
- { 6720,2158,447,142,2097,1684,496,185,455,496,207,80,144,177,81,38,777 },
-};
-
-
-/*-------------------------------------------------------------------------
- * ECLVQ Stereo ROM tables
- *------------------------------------------------------------------------*/
-
-/* table with round(ECSQ_PROB_TOTAL / index) for entropy coding, with i in {1, .., ECSQ_SEGMENT_SIZE} */
-const UWord16 ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE] =
-{
- 0, 16384, 8192, 5461, 4096, 3277, 2731, 2341, 2048
-};
-
-
-const Word16 tdm_bit_allc_tbl[5][6] =
-{
- /* IC -- UC -- GC -- TM --AC */
- { 1650, 3500, 0, 4400, 0, 5000 }, /* IVAS_13k2 */
- { 1650, 3500, 0, 5000, 0, 5000 }, /* IVAS_16k4 */
- { 1650, 3500, 0, 6000, 0, 5000 }, /* IVAS_24k4 */
- { 1650, 6050, 0, 10000, 0, 10000 }, /* IVAS_32k */
- { 1650, 6050, 0, 13000, 0, 14000 } /* IVAS_48k */
-};
-
-
-const Word16 fast_FCB_bits_2sfr[] = {8, 14, 18, 20, 24, 128/*stop value*/};
-
-const Word16 fast_FCB_rates_2sfr[] = {/*16*50,*/ (8+14)*50, 28*50, 32*50, 34*50, 36*50, 38*50, 40*50, 42*50, 44*50, 48*50};
-
-
-/*----------------------------------------------------------------------------------*
- * MDCT Stereo ROM tables
- *----------------------------------------------------------------------------------*/
-
- /* PsychLPC */
-
-const SpectrumWarping sw32000Hz[] =
-{{
- {
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6,
- 6, 8, 8, 8, 8, 8, 10, 10, 10, 10, 12, 12, 12, 12, 14, 14,
- 14, 16, 18, 18, 18, 20, 22, 22, 22, 24, 26, 26, 26, 28, 30, 32
- },
- {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5,
- 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10
- },
-}};
-
-const SpectrumWarping sw25600Hz[] =
-{{
- {
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6,
- 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 10, 12, 12, 12, 12,
- 12, 12, 14, 14, 14, 14, 14, 16, 16, 18, 18, 18, 18, 18, 20, 20
- },
- {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7
- },
-}};
-
-const SpectrumWarping sw16000Hz[] =
-{{
- {
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
- },
- {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
- },
-}};
-
-const MDCTStereoBands_config mdctStereoBands_32000_640[] =
-{{
- /*TCX 20*/
- { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 8, 8, 8, 8, 8, 8, 8, 12, 12, 12,
- 12, 20, 20, 20, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 42,
- 64, 64, 96, 160},
- {44, 41,38, 29},/*number of bands for frame lengths 960, 640, 512, 320 respectively*/
-
- /*TCX 10*/
- {
- 4, 4, 4, 4, 4, 8, 8, 8, 8, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 20, 32, 32,
- 32, 48, 80
- },
- {33, 29, 26, 18}/*number of bands for frame lengths 480, 320, 256, 160 respectively*/
-}};
-
-
-const Word16 dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */
-
-const Word16 dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */
-
-const Word16 dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 };
-
-
-const Word16 DirAC_band_grouping_12[12 + 1] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 11, 17, 25, 40, 60
-};
-
-
-const Word16 DirAC_band_grouping_6[6 + 1] =
-{
- 0, 1, 4, 8, 20, 30, 60
-};
-
-const Word16 DirAC_band_grouping_5[5 + 1] =
-{
- 0, 1, 3, 7, 15, 60
-};
-
-const Word16 DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1] =
-{
- 0, 4, 8, 12, 16
-};
-
-const Word16 DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] =
-{
- 0, 1, 2, 3, 4
-};
-
-const Word32 c_weights_fx[DIRAC_NO_FB_BANDS_MAX] /* Q30 */ = { 106970960, 1033798336, 1065867776, 1071704704, 1073381888, 1073741824, 1073494016, 1072883072, 1072012032, 1070930560, 1069665600, 1068232640, 1066641792, 1064899968, 1063012224, 1060982464, 1058814144, 1056510016, 1054072832, 1051505280, 1048809664, 1045988480, 1043044160, 1039979072, 1036795776, 1033496576, 1030084096, 1026560960, 1022929600, 1019192512, 1015352576, 1011412416, 1007374720, 1003242112, 999017472, 994703488, 990302976, 985818688, 981253568, 976610304, 971891712, 967100672, 962240064, 957312576, 952321088, 947268224, 942156992, 936990080, 931770048, 926499840, 921182016, 915819200, 910414208, 904969344, 899487488, 893970944, 888422272, 882843840, 877238144, 871607552, 865954432, 860280896, 854589184, 848881728, 843160384, 837427328, 831684672, 825934208, 820178240, 814418240, 808656320, 802894208, 797133568, 791376192, 785623744, 779877568, 774139520, 768410880, 762693184, 756987904, 751296064, 745619328, 739958784, 734315584, 728691008, 723086208, 717502016, 711939712, 706400064, 700884096, 695392768, 689926912, 684487232, 679074688, 673689856, 668333504, 663006464, 657709056, 652442176, 647206144, 642001600, 636828992, 631688896, 626581696, 621507776, 616467520, 611461184, 606489344, 601552064, 596649792, 591782528, 586950784, 582154560, 577394112, 572669696, 567981312, 563329088, 558713152, 554133568, 549590464, 545083840, 540613760, 536180160, 531783104, 527422528, 523098464, 518810784, 514559520, 510344672, 506165856, 502023360, 497916832, 493846304, 489811488, 485812448, 481848832, 477920672, 474027808, 470169952, 466347008, 462558848, 458805152, 455085920, 451400736, 447749600, 444132160, 440548320, 436997792, 433480416, 429995904, 426544032, 423124608, 419737376, 416382144, 413058720, 409766720, 406505984, 403276288, 400077280, 396908768, 393770656, 390662496, 387584064, 384535200, 381515616, 378525024, 375563200, 372629952, 369724864, 366847872, 363998592, 361176672, 358382176, 355614592, 352873760, 350159456, 347471328, 344809216, 342172864, 339562048, 336976384, 334415808, 331879840, 329368576, 326881472, 324418432, 321979104, 319563392, 317170976, 314801664, 312455232, 310131328, 307829856, 305550528, 303293088, 301057440, 298843168, 296650176, 294478304, 292327168, 290196672, 288086432, 285996512, 283926432, 281876224, 279845472, 277834016, 275841792, 273868480, 271913856, 269977792, 268059968, 266160304, 264278672, 262414768, 260568368, 258739360, 256927520, 255132768, 253354752, 251593392, 249848448, 248119936, 246407424, 244710816, 243030080, 241364928, 239715120, 238080672, 236461248, 234856752, 233267088, 231692016, 230131440, 228585136, 227053024, 225534848, 224030544, 222539872, 221062832 };
-
-/*----------------------------------------------------------------------*
-* SPAR ROM tables
-*-----------------------------------------------------------------------*/
-
-const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] =
-{
-/* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel
- so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */
- { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 10000, 8150, 13150 } },
- { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
-
- { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 13200, 11350, 16350 } },
- { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
-
- { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 16400, 14850, 24350 } },
- { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
-
- { 32000, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 24000, 20450, 31950 } },
- { { 21, 1, 5, 1 },{ 15, 1, 5, 1 },{ 15, 1, 3, 1 } }, 0, 0, 0 },
-
- { 48000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 24000, 21000, 31950 },{ 16000, 15000, 20400 } },
- { { 15, 7, 5, 1 },{ 15, 7, 3, 1 },{ 7, 7, 3, 1 } }, 1, 0, 0 },
-
- { 64000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 38000, 34050, 56000 },{ 16000, 15600, 20400 } },{ { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 1, 0 },
-
- { 80000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 46000, 43000, 56000 },{ 24000, 23000, 31950 } },
- { { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 0, 0 },
-
- { 96000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 47000, 42600, 56000 },{ 23000, 22600, 31950 },{ 16000, 15600, 20400 } },
- { { 21, 9, 9, 1 },{ 21, 7, 5, 1 },{ 21, 7, 5, 1 } }, 1, 0, 0 },
-
- { 128000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 55000, 50000, 56000 },{ 36000, 36000, 56000 },{ 27000, 27000, 31950 } },
- { { 21, 11, 9, 1 },{ 21, 9, 7, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
-
- { 160000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 74000, 70900, 112000 },{ 41000, 40050, 56000 },{ 35000, 34050, 56000 } },
- { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
-
- { 192000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 90000, 87900, 112000 },{ 50000, 48050, 56000 },{ 42000, 41050, 56000 } },
- { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
-
- { 256000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 90000, 85000, 112000 },{ 70000, 69000, 112000 },{ 50000, 48950, 56000 },{ 36400, 35600, 56000 } },
- { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 256000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 84650, 83000, 112000 },{ 65850, 64550, 56000 },{ 47000, 46100, 48000 },{ 28200, 27650, 40000 } },
- { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } },
- { { 31, 11, 11, 1 },{ 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } },
- { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 384000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } },
- { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 384000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } },
- { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } },
- { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124000, 124000, 128000 },{ 124000, 124000, 128000 },{ 125200, 118450, 128000 },{ 76300, 73000, 128000 } },
- { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-
- { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 118000, 118000, 128000 },{ 118000, 118000, 128000 },{ 117200, 109250, 128000 },{ 72300, 69000, 128000 } },
- { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
-};
-
-const ivas_spar_br_table_t ivas_spar_br_table_consts_fx[IVAS_SPAR_BR_TABLE_LEN] = /*ceilf(log2f)*/
-{
- /* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel
- so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */
- { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 10000, 8150, 13150 } },
- { { 4, 0, 3, 0 },{ 4, 0, 2, 0 },{ 3, 0, 2, 0 } }, 0, 0, 0 },
-
- { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 13200, 11350, 16350 } },
- { { 4, 0, 3, 0 },{ 4, 0, 2, 0 },{ 3, 0, 2, 0 } }, 0, 0, 0 },
-
- { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 16400, 14850, 24350 } },
- { { 4, 0, 3, 0 },{ 4, 0, 2, 0 },{ 3, 0, 2, 0 } }, 0, 0, 0 },
-
- { 32000, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 24000, 20450, 31950 } },
- { { 5, 0, 3, 0 },{ 4, 0, 3, 0 },{ 4, 0, 2, 0 } }, 0, 0, 0 },
-
- { 48000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 24000, 21000, 31950 },{ 16000, 15000, 20400 } },
- { { 4, 3, 3, 0 },{ 4, 3, 2, 0 },{ 3, 3, 2, 0 } }, 1, 0, 0 },
-
- { 64000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 38000, 34050, 56000 },{ 16000, 15600, 20400 } },{ { 5, 3, 3, 0 },{ 4, 3, 3, 0 },{ 4, 3, 2, 0 } }, 1, 1, 0 },
-
- { 80000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 46000, 43000, 56000 },{ 24000, 23000, 31950 } },
- { { 5, 3, 3, 0 },{ 4, 3, 3, 0 },{ 4, 3, 2, 0 } }, 1, 0, 0 },
-
- { 96000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 47000, 42600, 56000 },{ 23000, 22600, 31950 },{ 16000, 15600, 20400 } },
- { { 5, 4, 4, 0 },{ 5, 3, 3, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
-
- { 128000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 55000, 50000, 56000 },{ 36000, 36000, 56000 },{ 27000, 27000, 31950 } },
- { { 5, 4, 4, 0 },{ 5, 4, 3, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
-
- { 160000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 74000, 70900, 112000 },{ 41000, 40050, 56000 },{ 35000, 34050, 56000 } },
- { { 5, 4, 4, 0 },{ 5, 4, 4, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
-
- { 192000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 90000, 87900, 112000 },{ 50000, 48050, 56000 },{ 42000, 41050, 56000 } },
- { { 5, 4, 4, 0 },{ 5, 4, 4, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
-
- { 256000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 90000, 85000, 112000 },{ 70000, 69000, 112000 },{ 50000, 48950, 56000 },{ 36400, 35600, 56000 } },
- { { 5, 0, 0, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 256000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 84650, 83000, 112000 },{ 65850, 64550, 56000 },{ 47000, 46100, 48000 },{ 28200, 27650, 40000 } },
- { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } },
- { { 5, 4, 4, 0 },{ 0, 0, 0, 0 }, { 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } },
- { { 5, 0, 0, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 384000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } },
- { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 384000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } },
- { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } },
- { { 5, 0, 0, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124000, 124000, 128000 },{ 124000, 124000, 128000 },{ 125200, 118450, 128000 },{ 76300, 73000, 128000 } },
- { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-
- { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 118000, 118000, 128000 },{ 118000, 118000, 128000 },{ 117200, 109250, 128000 },{ 72300, 69000, 128000 } },
- { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
-};
-const ivas_freq_models_t ivas_arith_pred_r_consts[TOTAL_PRED_QUANT_STRATS_ARITH] =
-{
- /* entry for 1 quantization points */
- {
- /* pred_R real */
- {
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- },
- /* pred_R real differential */
- {
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- },
- /* pred_R real : values for general and differential */
- { 0 },{ 0 },
- /* pred_R real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 7 quantization points for br_table_idx >= 2 */
- {
- /* pred_R real */
- {
- { 0,546,1092,2184,8740,2184,1092,546, },
- { 0,1779,2116,2516,3562,2516,2116,1779, },
- { 0,1848,2614,5229,2614,1848,1307,924, },
- { 0,924,1307,1848,2614,5229,2614,1848, },
- },
- /* pred_R real differential */
- {
- { 0,125,399,1269,12798,1269,399,125, },
- { 0,744,1327,2365,7512,2365,1327,744, },
- { 0,1354,2413,7664,2413,1354,760,426, },
- { 0,426,760,1354,2413,7664,2413,1354, },
- },
- /* pred_R real : values for general and differential */
- { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
- /* pred_R real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 15 quantization points for br_table_idx >= 2 */
- {
- /* pred_R real */
- {
- { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
- { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
- { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
- { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
- },
- /* pred_R real differential */
- {
- { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
- { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
- { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
- { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
- },
- /* pred_R real : values for general and differential */
- { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
- { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
- /* pred_R real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 21 quantization points for br_table_idx >= 2 */
- {
- /* pred_R real */
- {
- { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
- { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
- { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
- { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
- },
- /* pred_R real differential */
- {
- { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
- { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
- { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
- { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
- },
- /* pred_R real : values for general and differential */
- { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
- { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
- /* pred_R real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 31 quantization points */
- {
- /* pred real */
- {
- { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
- { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
- { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
- { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, }
- },
- /* pred real differential */
- {
- { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
- { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
- { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
- { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, }
- },
- /* pred real : values for general and differential */
- { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
- { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
- /* pred real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 7 quantization points for br_table_idx < 2 */
- {
- /* pred_R real */
- {
- { 0,327,778,1851,10472,1851,778,327, },
- { 0,1057,1630,2514,5982,2514,1630,1057, },
- { 0,1668,2572,6122,2572,1668,1081,701, },
- { 0,701,1081,1668,2572,6122,2572,1668, },
- },
- /* pred_R real differential */
- {
- { 0,125,399,1269,12798,1269,399,125, },
- { 0,744,1327,2365,7512,2365,1327,744, },
- { 0,1354,2413,7664,2413,1354,760,426, },
- { 0,426,760,1354,2413,7664,2413,1354, },
- },
- /* pred_R real : values for general and differential */
- { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
- /* pred_R real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 15 quantization points for br_table_idx < 2 */
- {
- /* pred real */
- {
- { 0,9,23,56,133,318,757,1800,10192,1800,757,318,133,56,23,9, },
- { 0,156,240,371,573,883,1363,2102,5008,2102,1363,883,573,371,240,156, },
- { 0,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241,156,101, },
- { 0,101,156,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241, }
- },
- /* pred real differential */
- {
- { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
- { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
- { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
- { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, }
- },
- /* pred real : values for general and differential */
- {-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7},
- { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
- /* pred real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 21 quantization points for br_table_idx < 2 */
- {
- /* pred_R real */
- {
- { 0,1,1,4,9,23,56,133,318,756,1799,10184,1799,756,318,133,56,23,9,4,1,1, },
- { 0,41,64,98,152,234,362,558,861,1329,2049,4888,2049,1329,861,558,362,234,152,98,64,41, },
- { 0,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64,41,26, },
- { 0,26,41,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64, },
- },
- /* pred_R real differential */
- {
- { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
- { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
- { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
- { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
- },
- /* pred_R real : values for general and differential */
- { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
- { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
- /* pred_R real : num dyn models for general and differential */
- 4, 4
- }
-};
-
-const ivas_freq_models_t ivas_arith_drct_r_consts[TOTAL_DRCT_QUANT_STRATS] =
-{
- /* entry for 1 quantization points */
- {
- /* drct real */
- {
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- },
- /* drct real differential */
- {
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- },
- /* drct real : values for general and differential */
- {0},{ 0 },
- /* drct real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 7 quantization points */
- { /* drct real */
- {
- { 0,125,399,1269,12798,1269,399,125, },
- { 0,744,1327,2365,7512,2365,1327,744, },
- { 0,988,1244,1568,1976,2489,3136,4983, },
- { 0,2111,2262,2425,2788,2425,2262,2111, },
- },
- /* drct real differential */
- {
- { 0,125,399,1269,12798,1269,399,125, },
- { 0,744,1327,2365,7512,2365,1327,744, },
- { 0,1354,2413,7664,2413,1354,760,426, },
- { 0,426,760,1354,2413,7664,2413,1354, },
- },
- /* drct real : values for general and differential */
- { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
- /* drct real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 9 quantization points */
- {
- /* drct real */
- {
- { 0,39,125,397,1263,12736,1263,397,125,39, },
- { 0,397,708,1262,2250,7150,2250,1262,708,397, },
- { 0,573,722,909,1146,1444,1819,2292,2888,4591, },
- { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
- },
- /* drct real differential */
- {
- { 0,39,125,397,1263,12736,1263,397,125,39, },
- { 0,397,708,1262,2250,7150,2250,1262,708,397, },
- { 0,716,1276,2274,7225,2274,1276,716,402,225, },
- { 0,225,402,716,1276,2274,7225,2274,1276,716, }
- },
- /* drct real : values for general and differential */
- { -4,-3,-2,-1,0,1,2,3,4 },{ -4,-3,-2,-1,0,1,2,3,4 },
- /* drct real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 11 quantization points */
- {
- /* drct real */
- {
- { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
- { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
- { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
- { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
- },
- /* drct real differential */
- {
- { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
- { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
- { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
- { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
- },
- /* drct real : values for general and differential */
- { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
- /* drct real : num dyn models for general and differential */
- 4, 4
- }
-};
-
-const ivas_freq_models_t ivas_arith_decd_r_consts[TOTAL_DECD_QUANT_STRATS] =
-{
- /* entry for 1 quantization points */
- {
- /* decd real */
- {
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- },
- /* decd real differential */
- {
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- { 0,16384, },
- },
- /* decd real : values for general and differential */
- { 0 },{ 0 },
- /* decd real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 3 quantization points */
- {
- /* decd real */
- {
- { 0,11917,2978,1489, },
- { 0,8840,4419,3125, },
- { 0,4567,7250,4567, },
- { 0,5203,5978,5203, },
- },
- /* decd real differential */
- {
- { 0,1356,13672,1356, },
- { 0,3166,10052,3166, },
- { 0,10984,3459,1941, },
- { 0,1941,3459,10984, },
- },
- /* decd real : values for general and differential */
- { 0,1,2 },{-1,0,1},
- /* decd real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 5 quantization points */
- {
- /* decd real */
- {
- { 0,11157,2788,1394,697,348, },
- { 0,7186,3592,2540,1796,1270, },
- { 0,2512,3166,5028,3166,2512, },
- { 0,3048,3267,3754,3267,3048, },
- },
- /* decd real differential */
- {
- { 0,406,1289,12994,1289,406, },
- { 0,1460,2601,8262,2601,1460, },
- { 0,2707,8599,2707,1519,852, },
- { 0,852,1519,2707,8599,2707, },
- },
- /* decd real : values for general and differential */
- { 0,1,2,3,4 },{ -2,-1,0,1,2 },
- /* decd real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 7 quantization points */
- {
- /* decd real */
- {
- { 0,10983,2744,1372,686,343,171,85, },
- { 0,6573,3285,2322,1642,1161,821,580, },
- { 0,1603,2020,2546,4046,2546,2020,1603, },
- { 0,2111,2262,2425,2788,2425,2262,2111, },
- },
- /* decd real differential */
- {
- { 0,125,399,1269,12798,1269,399,125, },
- { 0,744,1327,2365,7512,2365,1327,744, },
- { 0,1354,2413,7664,2413,1354,760,426, },
- { 0,426,760,1354,2413,7664,2413,1354, }
- },
- /* decd real : values for general and differential */
- { 0,1,2,3,4,5,6 },{ -3,-2,-1,0,1,2,3 },
- /* decd real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 9 quantization points */
- { /* decd real */
- {
- { 0,10941,2734,1367,683,341,170,85,42,21, },
- { 0,6305,3150,2227,1575,1113,787,556,393,278, },
- { 0,1101,1388,1749,2203,3502,2203,1749,1388,1101, },
- { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
- },
- /* decd real differential */
- {
- { 0,39,125,397,1263,12736,1263,397,125,39, },
- { 0,397,708,1262,2250,7150,2250,1262,708,397, },
- { 0,716,1276,2274,7225,2274,1276,716,402,225, },
- { 0,225,402,716,1276,2274,7225,2274,1276,716, }
- },
- /* decd real : values for general and differential */
- { 0,1,2,3,4,5,6,7,8 },{ -4,-3,-2,-1,0,1,2,3,4 },
- /* decd real : num dyn models for general and differential */
- 4, 4
- },
- /* entry for 11 quantization points */
- {
- /* decd real */
- {
- { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
- { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
- { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
- { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
- },
- /* decd real differential */
- {
- { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
- { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
- { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
- { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
- },
- /* decd real : values for general and differential */
- { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
- /* decd real : num dyn models for general and differential */
- 4, 4
- }
-};
-
-const ivas_huff_models_t ivas_huff_pred_r_consts[TOTAL_PRED_QUANT_STRATS_HUFF] =
-{
- /* entry for 1 quantization points for br_table_idx */
- {{{ 0 }}, {{ 0 }}},
- /* entry for 7 quantization points for br_table_idx */
- {
- /* pred_R codebook */
- { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
- /* pred_R differential codebook */
- { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
- },
- /* entry for 15 quantization points for br_table_idx */
- {
- /* pred_r codebook */
- { { -7,4,2 },{ -6,4,3 },{ -5, 4, 4 },{ -4, 4, 5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },
- { 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 } },
- /* pred_r differential codebook */
- { { -7,4,2 },{ -6,4,3 },{ -5, 4, 4 },{ -4, 4, 5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },
- { 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 } },
- },
- /* entry for 21 quantization points for br_table_idx=0 */
- {
- /* pred_r codebook */
- { {-10,5,22},{-9,5,23},{-8,5,24},{-7,5,25},{-6,5,26}, { -5, 4, 0 },{ -4, 4, 1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },
- { 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{6,5,27},{7,5,28},{8,5,29},{9,5,30},{10,5,31} },
- /* pred_r differential codebook */
- { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5, 4, 0 },{ -4, 4, 1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },
- { 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 } },
- },
-
- /* entry for 31 quantization points for br_table_idx>0 */
- {
- /* pred_r codebook */
- { {-15,5,2},{-14,5,3},{-13,5,4},{-12,5,5},{-11,5,6}, { -10,5,7 },{ -9,5,8 },{ -8,5,9 },
- { -7,5,10 },{ -6,5,11 },{ -5, 5, 12 },{ -4, 5, 13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },
- { 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },
- { 8,5,24 },{ 9,5,25 },{ 10,5,26 },{11,5,27},{12,5,28},{13,5,29},{14,5,30},{15,5,31} },
- /* pred_r differential codebook */
- { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },
- { -7,5,10 },{ -6,5,11 },{ -5, 5, 12 },{ -4, 5, 13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },
- { 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },
- { 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 } },
- },
- };
-
- const ivas_huff_models_t ivas_huff_drct_r_consts[TOTAL_DRCT_QUANT_STRATS] =
-{
- /* entry for 1 quantization points */
- {{{ 0 }}, {{ 0 }}},
- /* entry for 7 quantization points */
- {
- /* drct_r codebook */
- { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
- /* drct_r differential codebook */
- { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
- },
- /* entry for 9 quantization points */
- {
- /* drct_r codebook */
- { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
- /* drct_r differential codebook */
- { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
- },
- /* entry for 11 quantization points */
- {
- /* drct_r codebook */
- { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
- /* drct_r differential codebook */
- { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
- },
-};
-
-const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS] =
-{
- /* entry for 1 quantization points */
- {{{ 0 }}, {{ 0 }}},
- /* entry for 3 quantization points */
- {
- /* decd_r codebook */
- { { 0, 2, 2 },{ 1, 1, 0 },{ 2,2,3 } },
- /* decd_r differential codebook */
- { { -1, 2, 2 },{ 0, 1, 0 },{ 1,2,3 } },
- },
- /* entry for 5 quantization points */
- {
- /* decd_r codebook */
- { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 } },
- /* decd_r differential codebook */
- { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 } },
- },
- /* entry for 7 quantization points */
- {
- /* decd_r */
- { { 0, 3, 2 },{ 1, 3, 3 },{ 2,3,4 },{ 3,3,0 },{ 4,3,5 },{ 5,3,6 },{ 6,3,7 } },
- /* decd_r codebook differential codebook */
- { { -3, 3, 2 },{ -2, 3, 3 },{ -1,3,4 },{ 0,3,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
- },
- /* entry for 9 quantization points */
- {
- /* decd_r codebook */
- { { 0, 4, 14 },{ 1,3,0 },{ 2,3,1 },{ 3,3,2 },{ 4,3,3 },{ 5,3,4 },{ 6,3,5 },{ 7,3,6 },{ 8,4,15 } },
- /* decd_r differential codebook */
- { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
- },
- /* entry for 11 quantization points */
- {
- /* decd_r codebook */
- { { 0, 4, 10 },{ 1, 4, 11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 } },
- /* decd_r differential codebook */
- { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
- },
-};
-
-/* DTX quantization and bitstream constants */
-
-const Word16 dtx_pd_real_q_levels[3][3] = { { 7,7,7 },{ 7,7,0 },{ 3,0,0 } };
-const Word16 dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } };
-const Word16 pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } };
-const Word16 pr_pd_idx_pairs[3][3][2] = { { { 1, 1 },{ 2, 2 },{ 3, 3 } },{ { 1, 1 },{ 3, 2 },{ 2, 0 } },{ { 2, 1 },{ 0, 0 },{ 0, 0 } } };
-
-const Word16 remix_order_set[1][DIRAC_MAX_ANA_CHANS] = { /* WYZX --> WYXZ... */
- { 0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }
-};
-
-const Word16 HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15};
-const Word16 HOA_keep_ind_spar[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 10, 10, 10, 10};
-const Word16 HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-
-
-/*----------------------------------------------------------------------*
-* PCA ROM tables
-*-----------------------------------------------------------------------*/
-
-const Word32 ivas_pca_offset_index1[IVAS_PCA_N1 + 1] =
-{
- 0, 1, 9, 61, 163, 359, 685, 1125, 1747,
- 2519, 3521, 4713, 6183, 7883, 9809, 12093, 14633, 17575,
- 20807, 24343, 28181, 32487, 37121, 42097, 47405, 53057, 59061,
- 65421, 72137, 79205, 86625, 94415, 102345, 110629, 119263, 128017,
- 137097, 146515, 156043, 165637, 175551, 185515, 195535, 205837, 216183,
- 226545, 236911, 247273, 257619, 267921, 277941, 287905, 297819, 307413,
- 316941, 326359, 335439, 344193, 352827, 361111, 369041, 376831, 384251,
- 391319, 398035, 404395, 410399, 416051, 421359, 426335, 430969, 435275,
- 439113, 442649, 445881, 448823, 451363, 453647, 455573, 457273, 458743,
- 459935, 460937, 461709, 462331, 462771, 463097, 463293, 463395, 463447,
- 463455, 463456
-};
-
-const Word16 ivas_pca_offset_index2[2692] =
-{
- 0, 1, 0, 1, 7, 8, 0, 1, 7, 19,
- 33, 45, 51, 52, 0, 1, 9, 23, 41, 61,
- 79, 93, 101, 102, 0, 1, 7, 21, 39, 61,
- 85, 111, 135, 157, 175, 189, 195, 196, 0, 1,
- 7, 19, 37, 59, 85, 115, 147, 179, 211, 241,
- 267, 289, 307, 319, 325, 326, 0, 1, 7, 21,
- 41, 65, 95, 127, 163, 201, 239, 277, 313, 345,
- 375, 399, 419, 433, 439, 440, 0, 1, 7, 19,
- 37, 61, 91, 125, 163, 203, 245, 289, 333, 377,
- 419, 459, 497, 531, 561, 585, 603, 615, 621, 622,
- 0, 1, 7, 21, 41, 67, 97, 133, 173, 217,
- 263, 311, 361, 411, 461, 509, 555, 599, 639, 675,
- 705, 731, 751, 765, 771, 772, 0, 1, 7, 19,
- 37, 61, 91, 127, 167, 211, 259, 309, 363, 417,
- 473, 529, 585, 639, 693, 743, 791, 835, 875, 911,
- 941, 965, 983, 995, 1001, 1002, 0, 1, 7, 21,
- 41, 67, 99, 135, 177, 223, 273, 327, 383, 443,
- 503, 565, 627, 689, 749, 809, 865, 919, 969, 1015,
- 1057, 1093, 1125, 1151, 1171, 1185, 1191, 1192, 0, 1,
- 7, 19, 37, 61, 91, 127, 169, 215, 265, 319,
- 377, 437, 501, 567, 633, 701, 769, 837, 903, 969,
- 1033, 1093, 1151, 1205, 1255, 1301, 1343, 1379, 1409, 1433,
- 1451, 1463, 1469, 1470, 0, 1, 7, 21, 41, 67,
- 99, 137, 179, 227, 279, 335, 395, 459, 525, 595,
- 667, 739, 813, 887, 961, 1033, 1105, 1175, 1241, 1305,
- 1365, 1421, 1473, 1521, 1563, 1601, 1633, 1659, 1679, 1693,
- 1699, 1700, 0, 1, 9, 23, 43, 69, 101, 139,
- 183, 231, 285, 343, 405, 471, 541, 613, 689, 765,
- 843, 923, 1003, 1083, 1161, 1237, 1313, 1385, 1455, 1521,
- 1583, 1641, 1695, 1743, 1787, 1825, 1857, 1883, 1903, 1917,
- 1925, 1926, 0, 1, 7, 21, 41, 67, 99, 137,
- 179, 227, 281, 339, 401, 467, 537, 611, 687, 767,
- 849, 931, 1015, 1099, 1185, 1269, 1353, 1435, 1517, 1597,
- 1673, 1747, 1817, 1883, 1945, 2003, 2057, 2105, 2147, 2185,
- 2217, 2243, 2263, 2277, 2283, 2284, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 285, 345, 409, 477,
- 549, 625, 705, 787, 871, 957, 1045, 1135, 1225, 1315,
- 1405, 1495, 1583, 1669, 1753, 1835, 1915, 1991, 2063, 2131,
- 2195, 2255, 2309, 2359, 2403, 2441, 2473, 2499, 2519, 2533,
- 2539, 2540, 0, 1, 7, 19, 39, 65, 97, 135,
- 177, 225, 279, 337, 401, 469, 541, 617, 697, 781,
- 867, 955, 1045, 1137, 1231, 1327, 1423, 1519, 1615, 1711,
- 1805, 1897, 1987, 2075, 2161, 2245, 2325, 2401, 2473, 2541,
- 2605, 2663, 2717, 2765, 2807, 2845, 2877, 2903, 2923, 2935,
- 2941, 2942, 0, 1, 7, 21, 41, 67, 99, 137,
- 181, 229, 283, 343, 407, 477, 551, 629, 711, 797,
- 885, 977, 1071, 1167, 1265, 1365, 1465, 1565, 1667, 1767,
- 1867, 1967, 2065, 2161, 2255, 2347, 2435, 2521, 2603, 2681,
- 2755, 2825, 2889, 2949, 3003, 3051, 3095, 3133, 3165, 3191,
- 3211, 3225, 3231, 3232, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 347, 413, 483, 559, 639,
- 723, 811, 903, 997, 1093, 1193, 1295, 1399, 1503, 1609,
- 1715, 1821, 1927, 2033, 2137, 2241, 2343, 2443, 2539, 2633,
- 2725, 2813, 2897, 2977, 3053, 3123, 3189, 3249, 3305, 3355,
- 3399, 3437, 3469, 3495, 3515, 3529, 3535, 3536, 0, 1,
- 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
- 415, 487, 563, 645, 731, 821, 915, 1011, 1111, 1213,
- 1317, 1423, 1531, 1641, 1751, 1863, 1975, 2087, 2197, 2307,
- 2415, 2521, 2625, 2727, 2827, 2923, 3017, 3107, 3193, 3275,
- 3351, 3423, 3489, 3551, 3607, 3657, 3701, 3739, 3771, 3797,
- 3817, 3831, 3837, 3838, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 285, 345, 411, 481, 557, 637,
- 721, 809, 901, 997, 1097, 1199, 1305, 1413, 1523, 1635,
- 1749, 1863, 1979, 2095, 2211, 2327, 2443, 2557, 2671, 2783,
- 2893, 3001, 3107, 3209, 3309, 3405, 3497, 3585, 3669, 3749,
- 3825, 3895, 3961, 4021, 4075, 4125, 4169, 4207, 4239, 4265,
- 4285, 4299, 4305, 4306, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 347, 413, 485, 561, 643,
- 729, 819, 913, 1011, 1113, 1217, 1325, 1435, 1547, 1663,
- 1779, 1897, 2017, 2137, 2257, 2377, 2497, 2617, 2737, 2855,
- 2971, 3087, 3199, 3309, 3417, 3521, 3623, 3721, 3815, 3905,
- 3991, 4073, 4149, 4221, 4287, 4347, 4403, 4453, 4497, 4535,
- 4567, 4593, 4613, 4627, 4633, 4634, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 287, 349, 415, 487,
- 565, 647, 733, 825, 921, 1021, 1125, 1231, 1341, 1453,
- 1569, 1687, 1807, 1929, 2051, 2175, 2299, 2425, 2551, 2677,
- 2801, 2925, 3047, 3169, 3289, 3407, 3523, 3635, 3745, 3851,
- 3955, 4055, 4151, 4243, 4329, 4411, 4489, 4561, 4627, 4689,
- 4745, 4795, 4839, 4877, 4909, 4935, 4955, 4969, 4975, 4976,
- 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
- 287, 349, 417, 489, 567, 649, 737, 829, 925, 1025,
- 1129, 1237, 1349, 1463, 1581, 1701, 1823, 1947, 2073, 2201,
- 2329, 2459, 2589, 2719, 2849, 2979, 3107, 3235, 3361, 3485,
- 3607, 3727, 3845, 3959, 4071, 4179, 4283, 4383, 4479, 4571,
- 4659, 4741, 4819, 4891, 4959, 5021, 5077, 5127, 5171, 5209,
- 5241, 5267, 5287, 5301, 5307, 5308, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 287, 349, 417, 489,
- 567, 651, 739, 831, 929, 1031, 1137, 1247, 1361, 1477,
- 1597, 1719, 1843, 1969, 2097, 2227, 2359, 2491, 2625, 2759,
- 2893, 3027, 3161, 3293, 3425, 3555, 3683, 3809, 3933, 4055,
- 4175, 4291, 4405, 4515, 4621, 4723, 4821, 4913, 5001, 5085,
- 5163, 5235, 5303, 5365, 5421, 5471, 5515, 5553, 5585, 5611,
- 5631, 5645, 5651, 5652, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 569, 653,
- 741, 835, 933, 1035, 1141, 1251, 1365, 1483, 1603, 1727,
- 1853, 1983, 2115, 2249, 2383, 2519, 2657, 2795, 2933, 3071,
- 3209, 3347, 3485, 3621, 3755, 3889, 4021, 4151, 4277, 4401,
- 4521, 4639, 4753, 4863, 4969, 5071, 5169, 5263, 5351, 5435,
- 5513, 5587, 5655, 5717, 5773, 5823, 5867, 5905, 5937, 5963,
- 5983, 5997, 6003, 6004, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 569, 653,
- 741, 835, 933, 1037, 1145, 1257, 1373, 1491, 1613, 1739,
- 1867, 1997, 2131, 2267, 2405, 2543, 2683, 2825, 2967, 3109,
- 3251, 3393, 3535, 3677, 3817, 3955, 4093, 4229, 4363, 4493,
- 4621, 4747, 4869, 4987, 5103, 5215, 5323, 5427, 5525, 5619,
- 5707, 5791, 5869, 5943, 6011, 6073, 6129, 6179, 6223, 6261,
- 6293, 6319, 6339, 6353, 6359, 6360, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
- 569, 653, 743, 837, 935, 1039, 1147, 1259, 1375, 1495,
- 1619, 1745, 1875, 2007, 2143, 2281, 2421, 2563, 2705, 2849,
- 2993, 3139, 3285, 3431, 3577, 3723, 3867, 4011, 4153, 4295,
- 4435, 4573, 4709, 4841, 4971, 5097, 5221, 5341, 5457, 5569,
- 5677, 5781, 5879, 5973, 6063, 6147, 6225, 6299, 6367, 6429,
- 6485, 6535, 6579, 6617, 6649, 6675, 6695, 6709, 6715, 6716,
- 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
- 287, 349, 417, 491, 569, 653, 743, 837, 937, 1041,
- 1149, 1261, 1377, 1497, 1621, 1749, 1879, 2013, 2149, 2287,
- 2429, 2573, 2717, 2863, 3011, 3159, 3309, 3459, 3609, 3759,
- 3909, 4057, 4205, 4351, 4495, 4639, 4781, 4919, 5055, 5189,
- 5319, 5447, 5571, 5691, 5807, 5919, 6027, 6131, 6231, 6325,
- 6415, 6499, 6577, 6651, 6719, 6781, 6837, 6887, 6931, 6969,
- 7001, 7027, 7047, 7061, 7067, 7068, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
- 569, 653, 743, 837, 937, 1041, 1149, 1261, 1377, 1497,
- 1621, 1749, 1881, 2015, 2153, 2293, 2435, 2579, 2725, 2873,
- 3023, 3175, 3327, 3479, 3633, 3787, 3941, 4093, 4245, 4397,
- 4547, 4695, 4841, 4985, 5127, 5267, 5405, 5539, 5671, 5799,
- 5923, 6043, 6159, 6271, 6379, 6483, 6583, 6677, 6767, 6851,
- 6929, 7003, 7071, 7133, 7189, 7239, 7283, 7321, 7353, 7379,
- 7399, 7413, 7419, 7420, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 489, 567, 651,
- 741, 835, 935, 1039, 1147, 1259, 1377, 1499, 1625, 1753,
- 1885, 2021, 2159, 2301, 2445, 2591, 2739, 2889, 3041, 3195,
- 3349, 3505, 3661, 3817, 3973, 4129, 4285, 4441, 4595, 4749,
- 4901, 5051, 5199, 5345, 5489, 5631, 5769, 5905, 6037, 6165,
- 6291, 6413, 6531, 6643, 6751, 6855, 6955, 7049, 7139, 7223,
- 7301, 7373, 7441, 7503, 7559, 7609, 7653, 7691, 7723, 7749,
- 7769, 7783, 7789, 7790, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
- 747, 843, 945, 1051, 1161, 1277, 1397, 1521, 1649, 1781,
- 1915, 2053, 2195, 2339, 2485, 2635, 2787, 2941, 3095, 3251,
- 3409, 3567, 3725, 3885, 4045, 4205, 4363, 4521, 4679, 4835,
- 4989, 5143, 5295, 5445, 5591, 5735, 5877, 6015, 6149, 6281,
- 6409, 6533, 6653, 6769, 6879, 6985, 7087, 7183, 7273, 7359,
- 7439, 7513, 7581, 7643, 7699, 7749, 7793, 7831, 7863, 7889,
- 7909, 7923, 7929, 7930, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
- 747, 843, 943, 1049, 1159, 1273, 1393, 1517, 1645, 1777,
- 1913, 2051, 2193, 2337, 2485, 2635, 2787, 2941, 3097, 3255,
- 3415, 3575, 3737, 3899, 4061, 4223, 4385, 4547, 4709, 4869,
- 5029, 5187, 5343, 5497, 5649, 5799, 5947, 6091, 6233, 6371,
- 6507, 6639, 6767, 6891, 7011, 7125, 7235, 7341, 7441, 7537,
- 7627, 7713, 7793, 7867, 7935, 7997, 8053, 8103, 8147, 8185,
- 8217, 8243, 8263, 8277, 8283, 8284, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
- 571, 655, 745, 841, 941, 1047, 1157, 1271, 1389, 1513,
- 1641, 1773, 1907, 2045, 2187, 2331, 2479, 2629, 2783, 2939,
- 3097, 3257, 3417, 3579, 3743, 3907, 4071, 4235, 4399, 4563,
- 4727, 4891, 5055, 5217, 5377, 5537, 5695, 5851, 6005, 6155,
- 6303, 6447, 6589, 6727, 6861, 6993, 7121, 7245, 7363, 7477,
- 7587, 7693, 7793, 7889, 7979, 8063, 8143, 8217, 8285, 8347,
- 8403, 8453, 8497, 8535, 8567, 8593, 8613, 8627, 8633, 8634,
- 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
- 287, 349, 417, 491, 571, 657, 749, 845, 947, 1053,
- 1165, 1281, 1401, 1527, 1657, 1791, 1929, 2069, 2213, 2361,
- 2511, 2663, 2819, 2977, 3137, 3299, 3463, 3627, 3793, 3959,
- 4125, 4293, 4461, 4629, 4795, 4961, 5127, 5291, 5455, 5617,
- 5777, 5935, 6091, 6243, 6393, 6541, 6685, 6825, 6963, 7097,
- 7227, 7353, 7473, 7589, 7701, 7807, 7909, 8005, 8097, 8183,
- 8263, 8337, 8405, 8467, 8523, 8573, 8617, 8655, 8687, 8713,
- 8733, 8747, 8753, 8754, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
- 747, 843, 943, 1049, 1159, 1275, 1395, 1519, 1647, 1779,
- 1915, 2055, 2199, 2345, 2495, 2647, 2803, 2961, 3121, 3283,
- 3447, 3613, 3779, 3947, 4115, 4285, 4455, 4625, 4795, 4965,
- 5133, 5301, 5467, 5633, 5797, 5959, 6119, 6277, 6433, 6585,
- 6735, 6881, 7025, 7165, 7301, 7433, 7561, 7685, 7805, 7921,
- 8031, 8137, 8237, 8333, 8423, 8509, 8589, 8663, 8731, 8793,
- 8849, 8899, 8943, 8981, 9013, 9039, 9059, 9073, 9079, 9080,
- 0, 1, 7, 19, 39, 65, 97, 135, 179, 229,
- 285, 347, 415, 489, 567, 651, 741, 835, 935, 1041,
- 1151, 1265, 1385, 1509, 1637, 1769, 1905, 2045, 2189, 2335,
- 2485, 2637, 2793, 2951, 3111, 3273, 3437, 3603, 3771, 3939,
- 4109, 4279, 4451, 4623, 4795, 4967, 5139, 5309, 5479, 5647,
- 5815, 5981, 6145, 6307, 6467, 6625, 6781, 6933, 7083, 7229,
- 7373, 7513, 7649, 7781, 7909, 8033, 8153, 8267, 8377, 8483,
- 8583, 8677, 8767, 8851, 8929, 9003, 9071, 9133, 9189, 9239,
- 9283, 9321, 9353, 9379, 9399, 9411, 9417, 9418, 0, 1,
- 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
- 417, 491, 571, 657, 747, 843, 945, 1051, 1163, 1279,
- 1399, 1525, 1655, 1789, 1927, 2069, 2213, 2361, 2513, 2667,
- 2825, 2985, 3147, 3311, 3477, 3645, 3815, 3985, 4157, 4329,
- 4503, 4677, 4851, 5025, 5199, 5371, 5543, 5713, 5883, 6051,
- 6217, 6381, 6543, 6703, 6861, 7015, 7167, 7315, 7459, 7601,
- 7739, 7873, 8003, 8129, 8249, 8365, 8477, 8583, 8685, 8781,
- 8871, 8957, 9037, 9111, 9179, 9241, 9297, 9347, 9391, 9429,
- 9461, 9487, 9507, 9521, 9527, 9528, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
- 571, 657, 749, 845, 947, 1055, 1167, 1285, 1407, 1533,
- 1663, 1797, 1935, 2077, 2223, 2373, 2525, 2681, 2839, 3001,
- 3165, 3331, 3499, 3669, 3839, 4011, 4185, 4359, 4533, 4709,
- 4885, 5061, 5235, 5409, 5583, 5755, 5925, 6095, 6263, 6429,
- 6593, 6755, 6913, 7069, 7221, 7371, 7517, 7659, 7797, 7931,
- 8061, 8187, 8309, 8427, 8539, 8647, 8749, 8845, 8937, 9023,
- 9103, 9177, 9245, 9307, 9363, 9413, 9457, 9495, 9527, 9553,
- 9573, 9587, 9593, 9594, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 571, 655,
- 745, 841, 941, 1047, 1157, 1273, 1393, 1517, 1647, 1781,
- 1919, 2061, 2207, 2355, 2507, 2663, 2821, 2981, 3145, 3311,
- 3479, 3649, 3821, 3993, 4167, 4341, 4517, 4693, 4869, 5045,
- 5221, 5397, 5573, 5747, 5921, 6093, 6265, 6435, 6603, 6769,
- 6933, 7093, 7251, 7407, 7559, 7707, 7853, 7995, 8133, 8267,
- 8397, 8521, 8641, 8757, 8867, 8973, 9073, 9169, 9259, 9343,
- 9423, 9497, 9565, 9627, 9683, 9733, 9777, 9815, 9847, 9873,
- 9893, 9907, 9913, 9914, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
- 747, 843, 945, 1051, 1163, 1279, 1401, 1527, 1657, 1791,
- 1929, 2071, 2217, 2367, 2519, 2675, 2835, 2997, 3161, 3327,
- 3495, 3665, 3837, 4011, 4185, 4361, 4537, 4715, 4893, 5071,
- 5249, 5427, 5603, 5779, 5953, 6127, 6299, 6469, 6637, 6803,
- 6967, 7129, 7289, 7445, 7597, 7747, 7893, 8035, 8173, 8307,
- 8437, 8563, 8685, 8801, 8913, 9019, 9121, 9217, 9307, 9393,
- 9473, 9547, 9615, 9677, 9733, 9783, 9827, 9865, 9897, 9923,
- 9943, 9957, 9963, 9964, 0, 1, 7, 21, 41, 67,
- 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
- 749, 845, 947, 1055, 1167, 1285, 1407, 1533, 1663, 1799,
- 1939, 2083, 2229, 2379, 2533, 2689, 2849, 3011, 3177, 3345,
- 3515, 3687, 3861, 4035, 4211, 4387, 4565, 4743, 4921, 5099,
- 5277, 5455, 5633, 5809, 5985, 6159, 6333, 6505, 6675, 6843,
- 7009, 7171, 7331, 7487, 7641, 7791, 7937, 8081, 8221, 8357,
- 8487, 8613, 8735, 8853, 8965, 9073, 9175, 9271, 9363, 9449,
- 9529, 9603, 9671, 9733, 9789, 9839, 9883, 9921, 9953, 9979,
- 9999, 10013, 10019, 10020, 0, 1, 7, 19, 39, 65,
- 97, 135, 179, 229, 285, 347, 415, 489, 567, 651,
- 741, 837, 937, 1043, 1153, 1269, 1389, 1513, 1643, 1777,
- 1915, 2057, 2203, 2351, 2503, 2659, 2817, 2979, 3143, 3309,
- 3477, 3647, 3819, 3993, 4169, 4345, 4523, 4701, 4881, 5061,
- 5241, 5421, 5601, 5779, 5957, 6133, 6309, 6483, 6655, 6825,
- 6993, 7159, 7323, 7485, 7643, 7799, 7951, 8099, 8245, 8387,
- 8525, 8659, 8789, 8913, 9033, 9149, 9259, 9365, 9465, 9561,
- 9651, 9735, 9813, 9887, 9955, 10017, 10073, 10123, 10167, 10205,
- 10237, 10263, 10283, 10295, 10301, 10302, 0, 1, 7, 21,
- 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
- 571, 655, 745, 841, 941, 1047, 1159, 1275, 1395, 1521,
- 1651, 1785, 1923, 2065, 2211, 2361, 2513, 2669, 2829, 2991,
- 3155, 3321, 3491, 3663, 3837, 4011, 4187, 4365, 4543, 4723,
- 4903, 5083, 5263, 5443, 5623, 5803, 5981, 6159, 6335, 6509,
- 6683, 6855, 7025, 7191, 7355, 7517, 7677, 7833, 7985, 8135,
- 8281, 8423, 8561, 8695, 8825, 8951, 9071, 9187, 9299, 9405,
- 9505, 9601, 9691, 9775, 9855, 9929, 9997, 10059, 10115, 10165,
- 10209, 10247, 10279, 10305, 10325, 10339, 10345, 10346, 0, 1,
- 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
- 417, 491, 571, 655, 745, 841, 943, 1049, 1161, 1277,
- 1397, 1523, 1653, 1787, 1925, 2067, 2213, 2363, 2517, 2673,
- 2833, 2995, 3159, 3327, 3497, 3669, 3843, 4019, 4195, 4373,
- 4551, 4731, 4911, 5091, 5271, 5451, 5631, 5811, 5989, 6167,
- 6343, 6519, 6693, 6865, 7035, 7203, 7367, 7529, 7689, 7845,
- 7999, 8149, 8295, 8437, 8575, 8709, 8839, 8965, 9085, 9201,
- 9313, 9419, 9521, 9617, 9707, 9791, 9871, 9945, 10013, 10075,
- 10131, 10181, 10225, 10263, 10295, 10321, 10341, 10355, 10361, 10362,
- 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
- 287, 349, 417, 491, 571, 657, 747, 843, 945, 1051,
- 1163, 1279, 1399, 1525, 1655, 1789, 1927, 2069, 2215, 2365,
- 2519, 2675, 2835, 2997, 3161, 3329, 3499, 3671, 3845, 4021,
- 4197, 4375, 4553, 4733, 4913, 5093, 5273, 5453, 5633, 5813,
- 5991, 6169, 6345, 6521, 6695, 6867, 7037, 7205, 7369, 7531,
- 7691, 7847, 8001, 8151, 8297, 8439, 8577, 8711, 8841, 8967,
- 9087, 9203, 9315, 9421, 9523, 9619, 9709, 9795, 9875, 9949,
- 10017, 10079, 10135, 10185, 10229, 10267, 10299, 10325, 10345, 10359,
- 10365, 10366
-};
-
-const Word16 ivas_pca_offset_n2[IVAS_PCA_N1] =
-{
- 0, 2, 6, 14, 24, 38, 56, 76, 100, 126, 156, 188,
- 224, 262, 302, 346, 392, 442, 494, 548, 604, 664, 726, 790,
- 856, 924, 994, 1066, 1140, 1216, 1294, 1374, 1454, 1536, 1620, 1704,
- 1790, 1878, 1966, 2054, 2144, 2234, 2324, 2416, 2508, 2600, 2692, 2784,
- 2876, 2968, 3058, 3148, 3238, 3326, 3414, 3502, 3588, 3672, 3756, 3838,
- 3918, 3998, 4076, 4152, 4226, 4298, 4368, 4436, 4502, 4566, 4628, 4688,
- 4744, 4798, 4850, 4900, 4946, 4990, 5030, 5068, 5104, 5136, 5166, 5192,
- 5216, 5236, 5254, 5268, 5278, 5286, 5290
-};
-
-const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2] = { /* ph1_q : Q13, n2 : Q0 */
- { 0, 1 },
- { 286, 3 },
- { 572, 7 },
- { 858, 9 },
- { 1144, 13 },
- { 1430, 17 },
- { 1716, 19 },
- { 2002, 23 },
- { 2288, 25 },
- { 2574, 29 },
- { 2860, 31 },
- { 3146, 35 },
- { 3431, 37 },
- { 3717, 39 },
- { 4003, 43 },
- { 4289, 45 },
- { 4575, 49 },
- { 4861, 51 },
- { 5147, 53 },
- { 5433, 55 },
- { 5719, 59 },
- { 6005, 61 },
- { 6291, 63 },
- { 6577, 65 },
- { 6863, 67 },
- { 7149, 69 },
- { 7435, 71 },
- { 7721, 73 },
- { 8007, 75 },
- { 8293, 77 },
- { 8579, 79 },
- { 8865, 79 },
- { 9151, 81 },
- { 9437, 83 },
- { 9722, 83 },
- { 10008, 85 },
- { 10294, 87 },
- { 10580, 87 },
- { 10866, 87 },
- { 11152, 89 },
- { 11438, 89 },
- { 11724, 89 },
- { 12010, 91 },
- { 12296, 91 },
- { 12582, 91 },
- { 12868, 91 },
- { 13154, 91 },
- { 13440, 91 },
- { 13726, 91 },
- { 14012, 89 },
- { 14298, 89 },
- { 14584, 89 },
- { 14870, 87 },
- { 15156, 87 },
- { 15442, 87 },
- { 15728, 85 },
- { 16013, 83 },
- { 16299, 83 },
- { 16585, 81 },
- { 16871, 79 },
- { 17157, 79 },
- { 17443, 77 },
- { 17729, 75 },
- { 18015, 73 },
- { 18301, 71 },
- { 18587, 69 },
- { 18873, 67 },
- { 19159, 65 },
- { 19445, 63 },
- { 19731, 61 },
- { 20017, 59 },
- { 20303, 55 },
- { 20589, 53 },
- { 20875, 51 },
- { 21161, 49 },
- { 21447, 45 },
- { 21733, 43 },
- { 22019, 39 },
- { 22304, 37 },
- { 22590, 35 },
- { 22876, 31 },
- { 23162, 29 },
- { 23448, 25 },
- { 23734, 23 },
- { 24020, 19 },
- { 24306, 17 },
- { 24592, 13 },
- { 24878, 9 },
- { 25164, 7 },
- { 25450, 3 },
- { 25736, 1 }
-};
-
-
-/*----------------------------------------------------------------------------------*
- * Parametric MC ROM tables
- *----------------------------------------------------------------------------------*/
-
-const Word16 param_mc_band_grouping_20[20 + 1] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 23, 27, 33, 40, 52, 60
-};
-
-const Word16 param_mc_coding_band_mapping_20[20] =
-{
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-const Word16 param_mc_bands_coded_20[4] =
-{
- 10, 14, 18, 20
-};
-
-const Word16 param_mc_band_grouping_14[14 + 1] =
-{
- 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 28, 40, 60
-};
-
-const Word16 param_mc_coding_band_mapping_14[14] =
-{
- 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
-};
-
-const Word16 param_mc_bands_coded_14[4] =
-{
- 8, 11, 13, 14
-};
-
-const Word16 param_mc_band_grouping_10[10 + 1] =
-{
- 0, 1, 2, 3, 5, 7, 10, 14, 20, 40, 60
-};
-
-
-const Word16 param_mc_bands_coded_10[4] =
-{
- 6, 8, 9, 10
-};
-
-const Word16 param_mc_coding_band_mapping_10[10] =
-{
- 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
-};
-
-const Word16 Param_MC_index[MAX_CICP_CHANNELS] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
-};
-
-
-const Word32 ivas_param_mc_dmx_fac_CICP6_2tc_fx[12] =
-{
- 2147483647,0,1518500224,1518500224,2147483647,0, /*Lt*/
- 0,2147483647,1518500224,1518500224,0,2147483647 /*Rt*/
-};
-
-const Word32 ivas_param_mc_dmx_fac_CICP12_2tc_fx[16] =
-{
- 2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0, /*Lt*/
- 0,2147483647,1518500224,1518500224,0,2147483647,0,2147483647 /*Rt*/
-};
-
-const Word32 ivas_param_mc_dmx_fac_CICP12_3tc_fx[24] =
-{
- 2147483647,0,0,0,2147483647,0,2147483647,0, /*Lt*/
- 0,2147483647,0,0,0,2147483647,0,2147483647, /*Rt*/
- 0,0,2147483647,2147483647,0,0,0,0 /*Ct*/
-};
-
-const Word32 ivas_param_mc_dmx_fac_CICP14_2tc_fx[16] =
-{
- 2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0, /*Lt*/
- 0,2147483647,1518500224,1518500224,0,2147483647,0,2147483647 /*Rt*/
-};
-const Word32 ivas_param_mc_dmx_fac_CICP14_3tc_fx[24] =
-{
- 2147483647,0,0,0,2147483647,0,2147483647,0, /*Lt*/
- 0,2147483647,0,0,0,2147483647,0,2147483647, /*Rt*/
- 0,0,2147483647,2147483647,0,0,0,0 /*Ct*/
-};
-
-const Word32 ivas_param_mc_dmx_fac_CICP16_3tc_fx[30] =
-{
- 2147483647,0,0,0,2147483647,0,2147483647,0,2147483647,0, /*Lt*/
- 0,2147483647,0,0,0,2147483647,0,2147483647,0,2147483647, /*Rt*/
- 0,0,2147483647,2147483647,0,0,0,0,0,0 /*Ct*/
-};
-
-const Word32 ivas_param_mc_dmx_fac_CICP19_3tc_fx[36] =
-{
- 2147483647,0,0,0,2147483647,0,2147483647,0,2147483647,0,2147483647,0, /*Lt*/
- 0,2147483647,0,0,0,2147483647,0,2147483647,0,2147483647,0,2147483647, /*Rt*/
- 0,0,2147483647,2147483647,0,0,0,0,0,0,0,0 /*Ct*/
-};
-
-const Word32 ivas_param_mc_dmx_fac_CICP19_4tc_fx[48] =
-{
- 2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0,0,0,0,0, /*Lht*/
- 0,2147483647,1518500224,1518500224,0,2147483647,0,2147483647,0,0,0,0, /*Rht*/
- 0,0,0,0,0,0,0,0,2147483647,0,2147483647,0, /*Lut*/
- 0,0,0,0,0,0,0,0,0,2147483647,0,2147483647 /*Rut*/
-};
-
-
-//Q15
-const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] =
-{
- 12832,
- 12832,
- 6820,
- 10607,
- 10607,
- 6820
-};
-
-//Q15
-const Word16 ivas_param_mc_ild_fac_CICP12_2tc_fx[8] =
-{
- 11965,
- 11965,
- 6816,
- 6877,
- 6877,
- 5619,
- 5619,
- 6816
-};
-
-//Q15
-const Word16 ivas_param_mc_ild_fac_CICP12_3tc_fx[8] =
-{
- 16384,
- 16384,
- 9502,
- 9502,
- 6553,
- 6553,
- 32767,
- 8192
-};
-//Q15
-const Word16 ivas_param_mc_ild_fac_CICP14_2tc_fx[8] =
-{
- 11936,
- 11936,
- 5993,
- 6945,
- 6945,
- 8049,
- 8049,
- 6816
-};
-
-//Q15
-const Word16 ivas_param_mc_ild_fac_CICP14_3tc_fx[8] =
-{
- 16291,
- 16291,
- 8257,
- 8257,
- 9666,
- 9666,
- 32767,
- 8192
-};
-
-//Q15
-const Word16 ivas_param_mc_ild_fac_CICP16_3tc_fx[10] =
-{
- 11141,
- 11141,
- 7209,
- 7209,
- 6553,
- 6553,
- 5898,
- 5898,
- 32767,
- 8192
-};
-
-//Q15
-const Word16 ivas_param_mc_ild_fac_CICP19_3tc_fx[12] =
-{
- 9830,
- 9830,
- 5570,
- 5570,
- 3932,
- 3932,
- 6226,
- 6226,
- 6226,
- 6226,
- 32767,
- 16384
-};
-
-const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc =
-{
- 5,
- 6,
- {0,1,2,4,5,3},
- {1,1,2,1,1,2},
- {{0},{1},{0,1},{0},{1},{0,1}}
-};
-
-const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP12_2tc =
-{
- 7,
- 8,
- {0,1,2,4,5,6,7,3},
- {1,1,2,1,1,1,1,2},
- {{0},{1},{0,1},{0},{1},{0},{1},{0,1}}
-};
-
-const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP12_3tc =
-{
- 6,
- 8,
- {0,1,4,5,6,7,2,3},
- {1,1,1,1,1,1,1,1},
- {{0},{1},{0},{1},{0},{1},{2},{2}}
-};
-
-const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP14_2tc =
-{
- 7,
- 8,
- {0,1,2,4,5,6,7,3},
- {1,1,2,1,1,1,1,2},
- {{0},{1},{0,1},{0},{1},{0},{1},{0,1}}
-};
-
-const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP14_3tc =
-{
- 6,
- 8,
- {0,1,4,5,6,7,2,3},
- {1,1,1,1,1,1,1,1},
- {{0},{1},{0},{1},{0},{1},{2},{2}}
-};
-
-const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP16_3tc =
-{
- 8,
- 10,
- {0,1,4,5,6,7,8,9,2,3},
- {1,1,1,1,1,1,1,1,1,1},
- {{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}}
-};
-
-const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_3tc =
-{
- 10,
- 12,
- {0,1,4,5,6,7,8,9,10,11,2,3},
- {1,1,1,1,1,1,1,1,1,1,1,1},
- {{0},{1},{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}}
-};
-
-const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP6_2tc =
-{
- 4,
- 5,
- { { 0, 4 }, /* L/LS */
- { 1, 5 }, /* R/RS */
- { 0, 2 }, /* L/C */
- { 1, 2 }, /* R/C */
- { 2, 3 }} /* C/LFE */
-};
-
-const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP12_2tc =
-{
- 6,
- 7,
- { { 0, 4 }, /* L/LS */
- { 1, 5 }, /* R/RS */
- { 0, 2 }, /* L/C */
- { 1, 2 }, /* R/C */
- { 2, 6 }, /* C/BLS */
- { 2, 7 }, /* C/BRS */
- { 2, 3 } /* C/LFE */
- }
-};
-
-const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP12_3tc =
-{
- 6,
- 7,
- { { 0, 4 }, /* L/LS */
- { 1, 5 }, /* R/RS */
- { 0, 2 }, /* L/C */
- { 1, 2 }, /* R/C */
- { 0, 6 }, /* L/BLS */
- { 1, 7 }, /* R/BRS */
- { 2, 3 } /* C/LFE */
- }
-};
-
-const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP14_2tc =
-{
- 6,
- 7,
- { { 0, 4 }, /* L/LS */
- { 1, 5 }, /* R/RS */
- { 0, 2 }, /* L/C */
- { 1, 2 }, /* R/C */
- { 2, 6 }, /* C/UFL */
- { 2, 7 }, /* C/UFR */
- { 2, 3 } /* C/LFE */
- }
-};
-const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP14_3tc =
-{
- 6,
- 7,
- { { 0, 4 }, /* L/LS */
- { 1, 5 }, /* R/RS */
- { 0, 2 }, /* L/C */
- { 1, 2 }, /* R/C */
- { 0, 6 }, /* L/UFL */
- { 1, 7 }, /* R/UFR */
- { 2, 3 } /* C/LFE */
- }
-};
-
-const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP16_3tc =
-{
- 8,
- 9,
- { { 0, 4 }, /* L/LS */
- { 1, 5 }, /* R/RS */
- { 0, 2 }, /* L/C */
- { 1, 2 }, /* R/C */
- { 0, 6 }, /* L/UFL */
- { 1, 7 }, /* R/UFR */
- { 4, 8 }, /* LS/UBL */
- { 5, 9 }, /* RS/UBR */
- { 2, 3 } /* C/LFE */
- }
-};
-
-const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_3tc =
-{
- 10,
- 11,
- { { 0, 4 }, /* L/LS */
- { 1, 5 }, /* R/RS */
- { 0, 2 }, /* L/C */
- { 1, 2 }, /* R/C */
- { 0, 6 }, /* L/LBS */
- { 1, 7 }, /* R/RBS */
- { 0, 8 }, /* L/UFL */
- { 1, 9 }, /* R/UFR */
- { 6, 10 }, /* LBS/UBL */
- { 7, 11 }, /* RBS/UBR */
- { 2, 3 } /* C/LFE */
- }
-};
-
-const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
-{
- /* CICP6 48000 */
- {
- MC_LS_SETUP_5_1,
- 6,
- 2,
- IVAS_48k,
- &ivas_param_mc_ild_mapping_CICP6_2tc,
- &ivas_param_mc_icc_mapping_CICP6_2tc,
- &ivas_param_mc_ild_fac_CICP6_2tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP6_2tc_fx[0]
- },
- /* CICP6 64000 */
- {
- MC_LS_SETUP_5_1,
- 6,
- 2,
- IVAS_64k,
- &ivas_param_mc_ild_mapping_CICP6_2tc,
- &ivas_param_mc_icc_mapping_CICP6_2tc,
- &ivas_param_mc_ild_fac_CICP6_2tc_fx[0],
- & ivas_param_mc_dmx_fac_CICP6_2tc_fx[0]
- },
- /* CICP6 80000 */
- {
- MC_LS_SETUP_5_1,
- 6,
- 2,
- IVAS_80k,
- &ivas_param_mc_ild_mapping_CICP6_2tc,
- &ivas_param_mc_icc_mapping_CICP6_2tc,
- &ivas_param_mc_ild_fac_CICP6_2tc_fx[0],
- & ivas_param_mc_dmx_fac_CICP6_2tc_fx[0]
- },
- /* CICP12 48000 */
- {
- MC_LS_SETUP_7_1,
- 8,
- 2,
- IVAS_48k,
- &ivas_param_mc_ild_mapping_CICP12_2tc,
- &ivas_param_mc_icc_mapping_CICP12_2tc,
- &ivas_param_mc_ild_fac_CICP12_2tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP12_2tc_fx[0]
- },
- /* CICP12 64000 */
- {
- MC_LS_SETUP_7_1,
- 8,
- 2,
- IVAS_64k,
- &ivas_param_mc_ild_mapping_CICP12_2tc,
- &ivas_param_mc_icc_mapping_CICP12_2tc,
- &ivas_param_mc_ild_fac_CICP12_2tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP12_2tc_fx[0]
- },
- /* CICP12 80000 */
- {
- MC_LS_SETUP_7_1,
- 8,
- 2,
- IVAS_80k,
- &ivas_param_mc_ild_mapping_CICP12_2tc,
- &ivas_param_mc_icc_mapping_CICP12_2tc,
- &ivas_param_mc_ild_fac_CICP12_2tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP12_2tc_fx[0],
- },
- /* CICP12 96000 */
- {
- MC_LS_SETUP_7_1,
- 8,
- 3,
- IVAS_96k,
- &ivas_param_mc_ild_mapping_CICP12_3tc,
- &ivas_param_mc_icc_mapping_CICP12_3tc,
- &ivas_param_mc_ild_fac_CICP12_3tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP12_3tc_fx[0]
- },
- /* CICP14 48000 */
- {
- MC_LS_SETUP_5_1_2,
- 8,
- 2,
- IVAS_48k,
- &ivas_param_mc_ild_mapping_CICP14_2tc,
- &ivas_param_mc_icc_mapping_CICP14_2tc,
- &ivas_param_mc_ild_fac_CICP14_2tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP14_2tc_fx[0]
- },
- /* CICP14 64000 */
- {
- MC_LS_SETUP_5_1_2,
- 8,
- 2,
- IVAS_64k,
- &ivas_param_mc_ild_mapping_CICP14_2tc,
- &ivas_param_mc_icc_mapping_CICP14_2tc,
- &ivas_param_mc_ild_fac_CICP14_2tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP14_2tc_fx[0]
- },
- /* CICP14 80000 */
- {
- MC_LS_SETUP_5_1_2,
- 8,
- 2,
- IVAS_80k,
- &ivas_param_mc_ild_mapping_CICP14_2tc,
- &ivas_param_mc_icc_mapping_CICP14_2tc,
- &ivas_param_mc_ild_fac_CICP14_2tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP14_2tc_fx[0]
- },
- /* CICP14 96000 */
- {
- MC_LS_SETUP_5_1_2,
- 8,
- 3,
- IVAS_96k,
- &ivas_param_mc_ild_mapping_CICP14_3tc,
- &ivas_param_mc_icc_mapping_CICP14_3tc,
- &ivas_param_mc_ild_fac_CICP14_3tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP14_3tc_fx[0]
- },
- /* CICP16 96000 */
- {
- MC_LS_SETUP_5_1_4,
- 10,
- 3,
- IVAS_96k,
- &ivas_param_mc_ild_mapping_CICP16_3tc,
- &ivas_param_mc_icc_mapping_CICP16_3tc,
- &ivas_param_mc_ild_fac_CICP16_3tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP16_3tc_fx[0]
- },
- /* CICP16 128000 */
- {
- MC_LS_SETUP_5_1_4,
- 10,
- 3,
- IVAS_128k,
- &ivas_param_mc_ild_mapping_CICP16_3tc,
- &ivas_param_mc_icc_mapping_CICP16_3tc,
- &ivas_param_mc_ild_fac_CICP16_3tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP16_3tc_fx[0]
- },
- /* CICP19 128000 */
- {
- MC_LS_SETUP_7_1_4,
- 12,
- 3,
- IVAS_128k,
- &ivas_param_mc_ild_mapping_CICP19_3tc,
- &ivas_param_mc_icc_mapping_CICP19_3tc,
- &ivas_param_mc_ild_fac_CICP19_3tc_fx[0],
- &ivas_param_mc_dmx_fac_CICP19_3tc_fx[0]
- }
-};
-
-
-/* Alphabet for delta coding for the ICCs in Parametric MC processing */
-const UWord16 ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
-{
- 0, 24, 224, 20873, 42384, 51699, 57122, 60572, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
-{
- 24, 200, 20649, 21511, 9315, 5423, 3450, 4963
-};
-
-const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
-{
- 0, 4, 9, 124, 447, 1311, 4453, 18116, 48636, 60573, 63692, 64746, 65327, 65531, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
-{
- 4, 5, 115, 323, 864, 3142, 13663, 30520, 11937, 3119, 1054, 581, 204, 3, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
-{
- 0, 30, 848, 26611, 47846, 57358, 61679, 63237, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
-{
- 30, 818, 25763, 21235, 9512, 4321, 1558, 2298
-};
-
-const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
-{
- 0, 2, 7, 53, 243, 979, 3994, 16732, 49642, 61343, 64331, 65158, 65438, 65532, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
-{
- 2, 5, 46, 190, 736, 3015, 12738, 32910, 11701, 2988, 827, 280, 94, 2, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
-{
- 0, 46, 826, 27798, 49552, 58447, 62046, 63284, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER ]={
- 46, 780, 26972, 21754, 8895, 3599, 1238, 2251
-};
-
-const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
-{
- 0, 3, 8, 36, 172, 763, 3436, 15845, 50168, 62005, 64676, 65298, 65481, 65533, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2* PARAM_MC_SZ_ICC_QUANTIZER - 1] =
-{
- 3, 5, 28, 136, 591, 2673, 12409, 34323, 11837, 2671, 622, 183, 52, 1, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
-{
- 0, 34, 552, 24717, 45819, 54772, 59054, 61166, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
-{
- 34, 518, 24165, 21102, 8953, 4282, 2112, 4369
-};
-
-const UWord16 ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
-{
- 0, 3, 7, 74, 304, 1009, 3870, 16502, 49834, 61384, 64217, 65020, 65369, 65531, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
-{
- 3, 4, 67, 230, 705, 2861, 12632, 33332, 11550, 2833, 803, 349, 162, 3, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
-{
- 0, 1092, 5574, 8315, 10652, 13875, 19656, 27664, 36284, 47058, 56251, 62579, 65118, 65462, 65513, 65532, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 1092, 4482, 2741, 2337, 3223, 5781, 8008, 8620, 10774, 9193, 6328, 2539, 344, 51, 19, 3
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 0, 1, 2, 3, 5, 38, 146, 352, 638, 997, 1559, 2323, 3570, 5859, 10556, 21075, 44682, 55617, 60408, 62739, 63833, 64443, 64809, 65074, 65279, 65400, 65484, 65531, 65532, 65533, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
-{
- 1, 1, 1, 2, 33, 108, 206, 286, 359, 562, 764, 1247, 2289, 4697, 10519, 23607, 10935, 4791, 2331, 1094, 610, 366, 265, 205, 121, 84, 47, 1, 1, 1, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
-{
- 0, 967, 6335, 9941, 12837, 16652, 22416, 29814, 38807, 48497, 57184, 62661, 64916, 65466, 65514, 65530, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 967, 5368, 3606, 2896, 3815, 5764, 7398, 8993, 9690, 8687, 5477, 2255, 550, 48, 16, 5
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 0, 1, 2, 3, 5, 18, 61, 149, 320, 592, 1083, 1793, 2974, 5257, 10133, 21274, 44342, 55891, 60895, 63174, 64244, 64793, 65100, 65287, 65406, 65477, 65517, 65531, 65532, 65533, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
-{
- 1, 1, 1, 2, 13, 43, 88, 171, 272, 491, 710, 1181, 2283, 4876, 11141, 23068, 11549, 5004, 2279, 1070, 549, 307, 187, 119, 71, 40, 14, 1, 1, 1, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
-{
- 0, 229, 7068, 10910, 13856, 17467, 22629, 29174, 36906, 46558, 55579, 61802, 65222, 65505, 65527, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 229, 6839, 3842, 2946, 3611, 5162, 6545, 7732, 9652, 9021, 6223, 3420, 283, 22, 7, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 0, 1, 2, 3, 4, 12, 56, 153, 278, 475, 856, 1430, 2489, 4723, 9580, 20685, 45423, 56274, 60948, 63097, 64128, 64679, 65002, 65208, 65348, 65445, 65517, 65531, 65532, 65533, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
-{
- 1, 1, 1, 1, 8, 44, 97, 125, 197, 381, 574, 1059, 2234, 4857, 11105, 24738, 10851, 4674, 2149, 1031, 551, 323, 206, 140, 97, 72, 14, 1, 1, 1, 1
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS+1] =
-{
- 0, 1453, 8326, 12221, 15164, 18764, 24177, 31297, 39520, 49154, 57135, 62460, 64821, 65468, 65514, 65530, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 1453, 6873, 3895, 2943, 3600, 5413, 7120, 8223, 9634, 7981, 5325, 2361, 647, 46, 16, 5
-};
-
-const UWord16 ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
-{
- 0, 1, 2, 3, 5, 29, 98, 220, 414, 699, 1186, 1876, 3049, 5304, 10013, 20612, 45247, 56109, 60818, 63022, 64081, 64647, 64977, 65198, 65348, 65443, 65502, 65530, 65532, 65533, 65534, 65535
-};
-
-const UWord16 ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
-{
- 1, 1, 1, 2, 24, 69, 122, 194, 285, 487, 690, 1173, 2255, 4709, 10599, 24635, 10862, 4709, 2204, 1059, 566, 330, 221, 150, 95, 59, 28, 2, 1, 1, 1
-};
-
-
-/*----------------------------------------------------------------------------------*
- * MASA ROM tables
- *----------------------------------------------------------------------------------*/
-
-const Word64 diffuseness_reconstructions_hr_fx[HR_MASA_ER_LEVELS] = { /* Q62 */
- 0,
- 65865144550293504,
- 138485688541642752,
- 239816680157478912,
- 355502895585558528,
- 485544334825881600,
- 667940119734386688,
- 902690250311073792,
- 1225260573621485568,
- 1635651089665622016,
- 2011983133527769088,
- 2354256705207926784,
- 2741003323208368128,
- 3172222987529093120,
- 3693796119373938688,
- 4305722718742904832,
-};
-
-const Word32 diffuseness_thresholds_hr_fx[HR_MASA_ER_LEVELS + 1] = { /* Q30 */
- 0,
- 10223616,
- 20447232,
- 44040192,
- 67633152,
- 97910784,
- 128188416,
- 182845440,
- 237502464,
- 333053952,
- 428605440,
- 508297216,
- 587988992,
- 688390144,
- 788791296,
- 931266560,
- MAX_32 /* out-of-range large value to make searching easier */
-};
-
-const Word16 bits_direction_masa[DIRAC_DIFFUSE_LEVELS] =
-{
- 11,
- 11,
- 10,
- 9,
- 7,
- 6,
- 5,
- 3
-};
-
-
-const Word16 len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS] = { 7, 6, 5, 4, 4, 4, 3, 2 };
-
-const UWord8 sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] =
-{
- 16, 99, 0, 0, 0, 0, 0, 0,
- 12, 64, 167, 0, 0, 0, 0, 0,
- 10, 45, 100, 218, 0, 0, 0, 0,
- 8, 34, 70, 124, 235, 0, 0, 0,
- 7, 27, 55, 90, 141, 242, 0, 0,
- 7, 23, 45, 71, 105, 153, 247, 0,
- 6, 20, 38, 60, 86, 119, 165, 249
-};
-
-const Word16 idx_cb_sur_coh_masa[MASA_MAX_NO_CV_SUR_COH] = { 0, 1, 2, 3, 4, 5, 5, 6 };
-
-const Word16 len_huf_masa[MASA_NO_CV_COH1] = { 4, 2, 1, 3, 4 };
-
-const Word16 huff_code_av_masa[MASA_NO_CV_COH1] = { 15, 2, 0, 6, 14 };
-
-const Word16 no_theta_masa[NO_SPHERICAL_GRIDS-2] = /* from 1 to 11 bits */
-{ /*1, 1,*/ 2 ,2 , 4, 5, 6, 7, 10, 14, 19
- /*0, 2, 8, 6, 7, 12, 14, 16*/
-};
-
-const Word16 no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = /* from 1 to 11 bits*/
-{
- { 2 },
- { 4 },
- { 4, 2 },
- { 8, 4 }, /* 8, 4*/
- { 12, 7, 2, 1 }, /* 12, */
- { 14, 13, 9, 2, 1 },
- { 22, 21, 17, 11, 3, 1 },
- { 33, 32, 29, 23, 17, 9, 1 },
- { 48, 47, 45, 41, 35, 28, 20, 12, 2, 1 },
- { 60, 60, 58, 56, 54, 50, 46, 41, 36, 30, 23, 17, 10, 1 },
- { 89, 89, 88, 86, 84, 81, 77, 73, 68, 63, 57, 51, 44, 38, 30, 23, 15, 8, 1 }
-};
-
-const Word16 MASA_band_grouping_24[24 + 1] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 40, 60
-};
-
-const Word16 MASA_band_mapping_24_to_18[18 + 1] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 21, 22, 23, 24
-};
-
-const Word16 MASA_band_mapping_24_to_12[12 + 1] =
-{
- 0, 1, 2, 3, 4, 5, 7, 9, 12, 15, 20, 22, 24
-};
-
-const Word16 MASA_band_mapping_24_to_8[8 + 1] =
-{
- 0, 1, 2, 3, 5, 8, 12, 20, 24
-};
-
-const Word16 MASA_band_mapping_24_to_5[5 + 1] =
-{
- 0, 1, 3, 7, 15, 24
-};
-
-const Word16 MASA_grouping_8_to_5[8] =
-{
- 0, 1, 1, 2, 3, 3, 4, 4
-};
-
-const Word16 MASA_grouping_12_to_5[12] =
-{
- 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4
-};
-
-const Word16 MASA_grouping_18_to_5[18] =
-{
- 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4
-};
-
-const Word16 MASA_grouping_24_to_5[24] =
-{
- 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4
-};
-
-/* IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k, IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k, IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k */
-const Word16 masa_bits[IVAS_NUM_ACTIVE_BRATES] =
-{
- 50, 60, 70, 85, 140, 180, 220, 256, 350, 432, 528, 832, 1024, MASA_MAX_BITS
-};
-
-const Word16 masa_bits_LR_stereo[4] =
-{
- 50, 50, 60, 70
-};
-
-const Word16 mcmasa_bits[IVAS_NUM_ACTIVE_BRATES] =
-{
- 50, 70, 80, 120, 140, 160, 220, 256, 288, 432, 528, 832, 1024, MASA_MAX_BITS
-};
-
-const UWord8 masa_nbands[IVAS_NUM_ACTIVE_BRATES] =
-{
- 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 18, 24, 24, 24
-};
-
-const UWord8 masa_joined_nbands[IVAS_NUM_ACTIVE_BRATES] =
-{
- 5, 5, 5, 8, 12, 12, 12, 18, 18, 18, 18, 24, 24, 24
-};
-
-const UWord8 masa_twodir_bands[IVAS_NUM_ACTIVE_BRATES] =
-{
- 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 24
-};
-
-const UWord8 masa_twodir_bands_joined[IVAS_NUM_ACTIVE_BRATES] =
-{
- 0, 0, 0, 0, 0, 2, 2, 3, 4, 6, 8, 9, 12, MASA_MAXIMUM_TWO_DIR_BANDS
-};
-
-
-/*----------------------------------------------------------------------------------*
- * OMASA ROM tables
- *----------------------------------------------------------------------------------*/
-
-const Word32 sep_object_brate[][MAX_NUM_OBJECTS] =
-{
- {0, 0, 0, 0}, /* 13k2 */
- {0, 0, 0, 0}, /* 16k4 */
- {9600, 0, 0, 0}, /* 24k4 */
- {IVAS_13k2, 0, 0, 0}, /* 32k */
- {16000, 11000, 0, 0}, /* 48k */
- {16000, 11700, 0, 0}, /* 64k */
- {20000, 16000, 0, 0}, /* 80k */
- {IVAS_32k, 20000, 20000, 0}, /* 96k */
- {IVAS_32k, IVAS_24k4, 24000, 24000}, /* 128k */
- {IVAS_48k, IVAS_32k, IVAS_24k4, 24000}, /* 160k */
- {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */
- {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */
- {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */
- {IVAS_128k, IVAS_96k, IVAS_80k, IVAS_64k} /* 512k */
-};
-
-/* column wise DCT matrices for 4 5, and 8 dim */
-/*----------------------------------------------------------------------------------*
- * Param ISM ROM tables
- *----------------------------------------------------------------------------------*/
-
-const Word16 Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1] =
-{
- 0, 1, 2, 3, 4, 6, 8, 11, 15, 21, 31, 60
-};
-
-/*----------------------------------------------------------------------------------*
- * LFE coding ROM tables
- *----------------------------------------------------------------------------------*/
-
-const ivas_lfe_freq_models ivas_str_lfe_freq_models =
-{
- { 16384, 14924, 13463, 12003, 10542, 9082, 7622, 6161,
- 4701, 4336, 3970, 3605, 3240, 2875, 2510, 2145,
- 1780, 1689, 1597, 1506, 1415, 1323, 1232, 1141,
- 1050, 1004, 958, 913, 867, 821, 776, 730,
- 685, 639, 593, 548, 502, 456, 411, 365,
- 319, 297, 274, 251, 228, 205, 183, 160,
- 137, 126, 114, 103, 91, 80, 68, 57,
- 46, 40, 34, 29, 23, 17, 11, 6, 0 },
-
- { 16384, 13463, 10542, 7622, 4701, 3970, 3240, 2510,
- 1780, 1597, 1415, 1232, 1050, 958, 867, 776,
- 685, 593, 502, 411, 319, 274, 228, 183,
- 137, 114, 91, 68, 46, 34, 23, 11, 0 },
-
- { 16384, 4701, 1780, 1050, 685, 319, 137, 46,
- 0, },
-
- { 16384, 3277, 0 },
-
- { 16384, 13463, 10542, 7622, 4701, 3970, 3240, 2510,
- 1780, 1597, 1415, 1232, 1050, 958, 867, 776,
- 685, 593, 502, 411, 319, 274, 228, 183,
- 137, 114, 91, 68, 46, 34, 23, 11,
- 0 },
-
- { 16384, 10542, 4701, 3240, 1780, 1415, 1050, 867,
- 685, 502, 319, 228, 137, 91, 46, 23,
- 0 },
-
- { 16384, 4468, 1489, 745, 0 }, 0,
-};
-
-const Word16 ivas_lfe_num_ele_in_coder_models[2][4] =
-{
- { 63, 31, 7, 1 },{ 31, 15, 3, 0 }
-};
-
-const Word16 ivas_lfe_log2_num_ele_in_coder_models_fx[2][4] =
-{
- { 6, 5, 3, 1 },{ 5, 4, 2, 0 }
-};
-
-const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8, 6 };
-
-const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 };
-
-const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 };
-#ifdef NONBE_FIX_MC_LFE_LPF
-const Word32 ivas_lfe_lpf_delay_ns[2] = { 1750000, 3500000 };
-#endif
-
-const Word16 dirac_gains_P_idx[16] =
-{
- -1, 1, 0, 1, 4, 3, 2, 3, 4, 8, 7, 6, 5, 6, 7, 8
-};
-
-/*----------------------------------------------------------------------------------*
- * FB ROM tables
- *----------------------------------------------------------------------------------*/
-
-const Word32 ivas_fb_fcs_12band_1ms_fx[IVAS_FB_BANDS_12] =
-{
- 17895696, 53687092, 89478488, 125269880,
- 161061280, 196852672, 232644064, 304226848,
- 465288128, 715827904, 1091637520, 1735882615
-};/*Q31*/
-
-const Word16 ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
-{
- { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 291, 367 },
- { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 260, 47 },
- { 24, 30, 30, 30, 30, 30, 42, 75, 122, 73, 0, 0 }
-};
-
-const Word16 ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
-{
- {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 },
- {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 },
- {0, 9, 25, 41, 57, 73, 88, 110, 159, 247, 0, 0 }
-};
-
-const Word16 ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
-{
- {
- IVAS_FB_12_1MS_48K_END_BINS_BAND_0 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_1 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_2 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_3 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_4 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_5 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_6 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_7 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_8 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_9 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_10 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10,
- IVAS_FB_12_1MS_48K_END_BINS_BAND_11 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11
- },
- {
- IVAS_FB_12_1MS_32K_END_BINS_BAND_0 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_0,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_1 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_1,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_2 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_2,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_3 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_3,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_4 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_4,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_5 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_5,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_6 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_6,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_7 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_7,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_8 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_8,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_9 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_9,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_10 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_10,
- IVAS_FB_12_1MS_32K_END_BINS_BAND_11 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_11
- },
- {
- IVAS_FB_12_1MS_16K_END_BINS_BAND_0 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_0,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_1 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_1,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_2 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_2,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_3 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_3,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_4 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_4,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_5 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_5,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_6 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_6,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_7 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_7,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_8 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_8,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_9 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_9,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_10 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_10,
- IVAS_FB_12_1MS_16K_END_BINS_BAND_11 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_11
- },
-};
-
-const Word16 ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
-{
- {
- IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1,
- IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3,
- IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5,
- IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7,
- IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9,
- IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11
- },
- {
- IVAS_FB_12_1MS_32K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_1,
- IVAS_FB_12_1MS_32K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_3,
- IVAS_FB_12_1MS_32K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_5,
- IVAS_FB_12_1MS_32K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_7,
- IVAS_FB_12_1MS_32K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_9,
- IVAS_FB_12_1MS_32K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_11
- },
- {
- IVAS_FB_12_1MS_16K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_1,
- IVAS_FB_12_1MS_16K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_3,
- IVAS_FB_12_1MS_16K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_5,
- IVAS_FB_12_1MS_16K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_7,
- IVAS_FB_12_1MS_16K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_9,
- IVAS_FB_12_1MS_16K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_11
- },
-};
-
-
-const Word16 ivas_num_active_bands[FB - WB + 1] =
-{
- IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12
-};
-
-/*------------------------------------------------------------------------------------------*
- * SNS MSVQ codebooks and means
- *------------------------------------------------------------------------------------------*/
-
-const Word16 ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32, 32 };
-
-const Word16 ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 };
-
-/* pre-rounded codebook vectors for singed Q4.12 represantation */
-
-const Word16 ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 };
-
-const Word16 ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 };
-
-
-const Word16 ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 };
-const Word16 ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 };
-const Word16 ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 };
-const Word16 ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 };
-
-
-const Word16 sns_1st_cdbk[2][2][8 * 32] =
-{
- { /* split 1 */
- { /* TCX 20 */
- -10900, -11064, -10637, -10471, -9051, -6381, -4688, -2438,
- -2119, -5087, -6702, -8118, -7586, -6343, -4828, -3406,
- 2004, -3443, -4289, -3757, -3234, -2952, -2313, -1781,
- 1749, 5598, 3916, 732, -1472, -2964, -3275, -2332,
- -11978, -14369, -5600, -545, 981, -929, -57, 1903,
- 1745, 391, 202, 115, 256, -291, -862, -1637,
- -4052, 2059, 4709, 6768, 5595, 1975, -1723, -1218,
- 2093, 7263, 8679, 7576, 3701, -2438, -4389, -2686,
- -7120, -6279, -5715, -5520, -4752, -3125, -1856, -438,
- 8131, -2543, -6285, -6723, -5588, -4321, -3264, -2164,
- -653, -1301, -660, 608, 1598, 1805, 1698, 760,
- 4882, 9309, 6333, 1734, 284, 364, 560, 1015,
- -7686, -5737, -3443, -1642, 245, 1531, 1827, 1769,
- -1468, 3782, 144, -5130, -6883, -5165, -1497, 2072,
- -12937, -8429, -2619, 2894, 5004, 4710, 4627, 3740,
- 3198, 3928, 4358, 4554, 3887, 2844, 1299, 129,
- -13828, -12296, -9364, -7918, -5571, -1909, 307, 2047,
- -4314, -1211, -559, -1061, -1928, -2228, -2359, -1902,
- -309, -3224, -3404, -1895, -743, -59, 757, 908,
- 10914, 5865, 1599, -386, -1392, -2285, -2236, -2042,
- -11825, -16241, -11402, -3627, 6556, 8953, 6421, 1546,
- 6102, 777, -301, 536, 902, 541, 210, -429,
- -3052, 3997, 5389, 1842, -344, 1556, 2667, 2428,
- 11788, 10894, 7448, 5423, 2372, -677, -2385, -3839,
- -45, -7602, -8923, -7179, -3273, 65, 4500, 6726,
- 5895, 626, -1610, -2598, -3240, -3540, -2930, -2156,
- -971, 461, 1494, 4907, 5859, 5199, 3678, 2502,
- 10766, 5297, 1844, 1236, 2498, 3503, 2846, 838,
- -7816, -1212, 891, 2387, 1317, 2225, 1859, 1602,
- 2376, 5357, 2088, -2719, -3419, -420, 2431, 2943,
- -8383, -795, 4351, 7026, 7460, 7191, 5262, 3796,
- 1522, 6283, 8714, 8222, 7434, 5768, 3586, 1499,
- },
- { /* TCX 10 */
- -15596, -16321, -10264, -1002, 5955, 5543, -29, -1688,
- 17, -3794, -6207, -7356, -6998, -6081, -4453, -2448,
- -12543, -11530, -10186, -8817, -7083, -4440, -1946, 892,
- 5198, 2751, -274, -2574, -4561, -6087, -5944, -4600,
- -683, -2640, -2753, -1195, -239, -217, -286, 90,
- -1400, -1146, -1853, -2845, -3456, -3788, -3171, -1969,
- -1835, 392, 1725, 1209, -392, -1640, -2001, -1608,
- 5770, 7707, 5210, 2112, -382, -2088, -2634, -3007,
- -10766, -8101, -5137, -3754, -1881, 331, 2339, 3679,
- -2637, -4640, -5811, -5651, -3790, -1359, 913, 1893,
- -7793, -4768, -1762, -545, -717, -837, -441, -75,
- 4030, 1770, 467, 379, 10, -1330, -2398, -2290,
- -9395, -6952, -2494, 2022, 4753, 5614, 4443, 2642,
- -1486, 1748, 859, -2586, -3368, -638, 2761, 3269,
- -2408, 306, 3633, 6567, 5950, 2474, -621, -1421,
- 5478, 7986, 9498, 8165, 5477, 1244, -523, -1586,
- -13564, -14673, -10597, -5504, 1575, 8248, 7662, 4025,
- 4978, -682, -3586, -4305, -3703, -3001, -2227, -1278,
- -8002, -6831, -5558, -4868, -4243, -3393, -2486, -1110,
- 11485, 5472, 1645, -533, -1792, -2814, -3169, -2706,
- 1617, 421, 232, 1382, 2162, 2017, 1318, 744,
- 3677, 5212, 1990, -1514, -2894, -2441, -451, 592,
- 731, 4295, 5860, 3756, 1991, 1437, 869, 127,
- 12736, 11722, 7768, 4682, 1574, -744, -1989, -3131,
- -3490, -4269, -3681, -1531, 1111, 3327, 4138, 3815,
- 7344, 1400, -1302, -1502, -1015, 57, 1212, 1498,
- -4836, -1881, 1071, 2055, 2114, 2465, 2093, 1458,
- 8569, 5879, 3654, 2879, 2530, 1703, 781, -233,
- -3709, -990, 2338, 6227, 7083, 7102, 5657, 3401,
- 3389, 6392, 5267, 1011, 275, 3519, 5236, 4339,
- 599, 3752, 6943, 9211, 8152, 5568, 3337, 1838,
- 9885, 9591, 7905, 8068, 7929, 7421, 4234, 757,
- }
- },
- { /* split 2 */
- { /* TCX 20 */
- -178, -3476, -5982, -7081, -7548, -7440, -6859, -5798,
- -3596, -3670, -1501, 770, 812, -286, -2001, -3377,
- -3998, -5191, -4988, -4421, -3889, -3571, -2738, -1969,
- -2981, -2687, -1501, -83, 1136, 2377, 3248, 4105,
- 1842, -41, -1972, -4282, -6779, -8405, -8674, -7835,
- -259, 571, 2124, 3344, 2959, 1407, -750, -2523,
- -524, -1956, -2855, -3202, -3939, -4666, -4907, -4782,
- -5110, -4768, -3017, -663, 4188, 9210, 16602, 21081,
- 4373, 4846, -603, -6495, -7289, -5540, -4749, -5527,
- -1448, -1043, -619, -105, 356, 362, 542, 857,
- 1373, -752, -5334, -6244, -3001, -932, -1040, -3125,
- -2403, -1397, 612, 2449, 3920, 5231, 6819, 8581,
- 2183, 1211, -111, -1084, -2836, -4977, -6701, -7284,
- -751, 1255, 3408, 6474, 7503, 7026, 5413, 4464,
- 935, 850, 589, 353, 160, -434, -939, -931,
- 268, 2284, 3884, 5423, 6680, 7996, 9244, 9472,
- 1075, 113, -1289, -4457, -7512, -5930, -1799, -571,
- -3689, -4254, -3755, -2995, -1581, -135, 1049, 1589,
- -1166, -1752, -1790, -1897, -1927, -1831, -1359, -805,
- -1494, -735, 635, 1993, 2909, 3546, 4226, 4956,
- 4435, 4299, 4269, 1328, -3731, -7621, -9319, -9170,
- 1358, 2227, 3873, 4469, 4692, 4057, 2601, 1608,
- 813, 398, -499, -666, -1286, -2271, -3316, -4025,
- -3300, -1255, 2181, 6431, 10002, 12760, 13549, 12584,
- 3714, 4180, 484, -2905, -2864, -1359, -1256, -2477,
- 308, 868, 1373, 1629, 1793, 1834, 1814, 1746,
- 1472, 798, -282, -1935, -1818, 320, 2221, 2914,
- 2281, 3240, 2988, 1400, 2383, 4072, 5667, 6675,
- 2672, 2678, 2874, 2096, -226, -2301, -3861, -4534,
- 4988, 7231, 7641, 7731, 7061, 6447, 5411, 3513,
- 3978, 4156, 4126, 2896, 1469, 759, 368, -68,
- -264, 4210, 8534, 11008, 11606, 11888, 11072, 8949,
- },
- { /* TCX 10 */
- -2852, -6158, -7231, -7830, -8012, -7922, -7556, -6706,
- -3911, -5340, -5053, -4741, -4805, -4484, -3727, -3037,
- -966, -1461, -1694, -2427, -3081, -3037, -2547, -2230,
- -3455, -3315, -2451, -836, 1383, 3196, 3720, 3379,
- 3052, 281, -3351, -6866, -9051, -9586, -8983, -8236,
- -748, -4465, -4314, -2251, 29, -40, -3963, -6195,
- 200, 1293, 2535, 2803, 1603, -186, -1397, -1697,
- -1707, -265, 2196, 5295, 5894, 4216, 3440, 3826,
- -237, -2133, -2279, -3149, -4377, -5638, -6520, -6764,
- -2407, -2049, -1246, -664, -521, -430, -349, -211,
- 3874, 1335, -1501, -2055, -1268, -990, -1852, -2871,
- -1883, -1845, -1681, -484, 384, 2035, 5839, 9597,
- 275, 380, 1048, 424, -1146, -3012, -4431, -5104,
- -1699, -484, 756, 1261, 1279, 1377, 1975, 2590,
- 2139, 4502, 3645, 4975, 6491, 5972, 5012, 4346,
- -3821, -2581, -433, 2667, 6436, 10038, 11311, 8783,
- 2359, -2689, -6604, -7039, -5992, -4268, -3711, -4840,
- -2776, -4251, -4539, -3672, -2494, -1055, 280, 695,
- 491, 866, 822, -44, -1009, -1165, -831, -538,
- -1024, 91, 786, 1295, 2433, 3910, 4975, 5403,
- 3117, 2590, 2337, -667, -4580, -8147, -9400, -9523,
- -103, -630, -831, 669, 3062, 3398, 549, -1690,
- 2113, 3467, 4279, 5047, 5344, 3361, 127, -2313,
- -1199, 1153, 2914, 3688, 4260, 5421, 7471, 8831,
- 2815, 2184, 316, -3058, -5596, -5564, -4343, -3793,
- 922, 126, -1414, -1731, -1007, 359, 2029, 3088,
- 4889, 4619, 2537, 1114, 950, 946, 799, 419,
- -4271, -3750, -3359, -484, 1448, 4106, 10487, 20479,
- 3818, 4687, 4064, 2212, -172, -2287, -3535, -4041,
- 884, 2456, 3394, 2925, 2182, 2323, 2583, 2507,
- 4767, 8057, 8263, 6461, 5003, 4055, 2923, 1845,
- 19, 3813, 6926, 8432, 10141, 10850, 9692, 8383,
- }
- }
-};
-
-const Word16 sns_1st_means_16k[2][16] =
-{
- { /* TCX 20 */
- 14210, 19017, 14362, 9309, 5385, 2674, 1055, -211, -1407, -3059, -4393, -8597, -11180, -11756, -12131, -13281,
- },
- { /* TCX 10*/
- 12018, 15915, 11089, 6015, 847, -705, -539, -1548, -893, -2163, -1806, -4189, -7017, -8670, -8874, -9480,
- }
-};
-
-const Word16 sns_1st_means_25k6[2][16] =
-{
- { /* TCX 20 */
- 14973, 20323, 16461, 9554, 4017, 3103, 1602, 1694, -221, -1401, -6817, -10071, -11503, -11805, -13158, -16749,
- },
- { /* TCX 10 */
- 15560, 19489, 14623, 5595, 2084, 1699, 775, -1312, -2195, -6101, -9078, -9465, -7825, -6603, -7281, -9960,
- }
-};
-
-const Word16 sns_1st_means_32k[2][16] =
-{
- { /* TCX 20 */
- 15041, 20603, 16969, 10289, 4973, 4283, 3003, 3316, 1684, -259, -6614, -9535, -10363, -11834, -16625, -24930,
- },
- { /* TCX 10 */
- 16510, 20660, 16025, 7224, 3921, 3868, 2623, 742, -1316, -6269, -8284, -7288, -6380, -8410, -13351, -20277,
- }
-};
-
-
-/*----------------------------------------------------------------------*
- * MC ParamUpmix ROM tables
- *-----------------------------------------------------------------------*/
-
-const Word16 ivas_param_upmx_mx_qmap[33] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0
-};
-
-/* clang-format on */
diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h
index 4a227befb250beb6a852c09ec2df9c850b507cde..3c24b682315d2f2f108f56482978e7c6a0efcccf 100644
--- a/lib_com/ivas_rom_com.h
+++ b/lib_com/ivas_rom_com.h
@@ -78,6 +78,29 @@ extern const UWord16 ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE];
/*----------------------------------------------------------------------------------*
* Stereo ICA ROM tables
*----------------------------------------------------------------------------------*/
+
+extern const Word32 ica_sincInterp2_fx[]; // Q31
+extern const Word32 ica_sincInterp4_fx[]; // Q31
+extern const Word32 ica_sincInterp6_fx[]; // Q31
+
+/*----------------------------------------------------------------------------------*
+ * Stereo IC-BWE ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const Word16 pow_10_icbwe_gsMapping_tbl_fx[];
+extern const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[];
+
+extern const Word16 icbwe_gsMapping_tbl_fx[];
+extern const Word16 icbwe_gsMappingDFT_tbl_fx[];
+
+/*----------------------------------------------------------------------------------*
+ * TD Stereo ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1];
+extern const Word32 tdm_ratio_tabl_fx_Q30[TDM_NQ + 1];
+extern const Word32 tdm_ratio_tabl_fx_Q24[TDM_NQ + 1];
+extern const UWord32 tdm_den_ratio_tabl_fx[];
extern const Word16 tdm_bit_allc_tbl[5][6];
/* LSFs Intra-frame prediction tables */
@@ -97,7 +120,6 @@ extern const Word16 tdm_LSF_MEAN_PRED_QNT_IN_fx[M];
extern const Word16 tdm_LSF_MEAN_PRED_QNT_fx[M];
extern const Word16 tdm_PRED_QNT_fixed_beta_prd_diag_3_fx[15 + 16 + 15];
-
extern const Word16 fast_FCB_bits_2sfr[];
extern const Word16 fast_FCB_rates_2sfr[];
@@ -114,6 +136,7 @@ extern const MDCTStereoBands_config mdctStereoBands_32000_640[];
/*----------------------------------------------------------------------------------*
* Stereo DTX ROM tables
*----------------------------------------------------------------------------------*/
+
extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS];
extern const Word16 dft_cng_coh_u2i[9];
extern const Word16 dft_cng_coh_i2u[9];
@@ -123,6 +146,10 @@ extern const Word16 dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1];
/*----------------------------------------------------------------------------------*
* DirAC ROM tables
*----------------------------------------------------------------------------------*/
+
+extern const Word32 diffuseness_reconstructions_fx[DIRAC_DIFFUSE_LEVELS];
+extern const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1];
+extern const Masa_Diffuseness_Ratios masa_diffuse_ratios[DIRAC_DIFFUSE_LEVELS][DIRAC_DIFFUSE_LEVELS];
extern const Word16 DirAC_band_grouping_12[12 + 1];
extern const Word16 DirAC_band_grouping_6[6 + 1];
extern const Word16 DirAC_band_grouping_5[5 + 1];
@@ -131,6 +158,8 @@ extern const Word16 DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES +
extern const Word32 c_weights_fx[DIRAC_NO_FB_BANDS_MAX]; // Q30
+extern const Word16 ivas_divde_255[256];
+
/*------------------------------------------------------------------------------------------*
* SPAR ROM tables
*------------------------------------------------------------------------------------------*/
@@ -153,6 +182,9 @@ extern const Word16 dtx_pr_real_q_levels[3][3];
extern const Word16 pr_pr_idx_pairs[3][3][2];
extern const Word16 pr_pd_idx_pairs[3][3][2];
+extern const Word32 dtx_pd_real_min_max_fx[2];
+extern const Word32 one_by_q_level[64];
+
/*----------------------------------------------------------------------*
* PCA ROM tables
*-----------------------------------------------------------------------*/
@@ -162,7 +194,6 @@ extern const Word16 ivas_pca_offset_index2[2692];
extern const Word16 ivas_pca_offset_n2[IVAS_PCA_N1];
extern const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2];
-
/*----------------------------------------------------------------------------------*
* Parametric MC ROM tables
*----------------------------------------------------------------------------------*/
@@ -220,11 +251,15 @@ extern const UWord16 ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_I
extern const UWord16 ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER];
extern const UWord16 ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1];
+extern const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER];
/*----------------------------------------------------------------------------------*
* MASA ROM tables
*----------------------------------------------------------------------------------*/
+extern const UWord8 ivasmasaFormatDescriptor[8]; /* "IVASMASA" */
+
extern const Word16 bits_direction_masa[DIRAC_DIFFUSE_LEVELS];
extern const Word16 no_theta_masa[NO_SPHERICAL_GRIDS - 2];
extern const Word16 no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA];
@@ -256,35 +291,128 @@ extern const UWord8 masa_twodir_bands_joined[];
extern const Word64 diffuseness_reconstructions_hr_fx[HR_MASA_ER_LEVELS];
extern const Word32 diffuseness_thresholds_hr_fx[HR_MASA_ER_LEVELS + 1];
+extern const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA];
+extern const Word32 azimuth_cb_fx[8];
+extern const Word32 delta_theta_masa_fx[NO_SPHERICAL_GRIDS - 2];
+extern const Word16 coherence_cb0_masa_Q14[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH];
+extern const Word32 coherence_cb0_masa_fx[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH];
+extern const Word16 coherence_cb1_masa_Q15[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */
+extern const Word32 coherence_cb1_masa_fx[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */
+
+/* Multi-channel input and output setups */
+extern const Word16 ls_azimuth_CICP2_idx[2];
+extern const Word16 ls_elevation_CICP2_idx[2];
+extern const Word16 ls_azimuth_CICP6_idx[5];
+extern const Word16 ls_elevation_CICP6_idx[5];
+extern const Word16 ls_azimuth_CICP12_idx[7];
+extern const Word16 ls_elevation_CICP12_idx[7];
+extern const Word16 ls_azimuth_CICP14_idx[7];
+extern const Word16 ls_elevation_CICP14_idx[7];
+extern const Word16 ls_azimuth_CICP16_idx[9];
+extern const Word16 ls_elevation_CICP16_idx[9];
+extern const Word16 ls_azimuth_CICP19_idx[11];
+extern const Word16 ls_elevation_CICP19_idx[11];
+
+extern const Word32 shoebox_sin_cos_tbl_fx[11][2];
+
+extern const Word32 delta_phi_val[90];
+extern const Word32 inv_delta_phi_val[90];
+extern const Word32 dd_val[90];
+extern const Word32 cb_azi_chan_fx[]; // Q22
+extern const Word16 cb_azi_chan_16fx[]; // Q0
+
+/* Multi-channel input and output setups */
+extern const Word32 ls_azimuth_CICP1_fx[1];
+extern const Word32 ls_elevation_CICP1_fx[1];
+extern const Word32 ls_azimuth_CICP2_fx[2];
+extern const Word32 ls_elevation_CICP2_fx[2];
+extern const Word32 ls_azimuth_CICP6_fx[5];
+extern const Word32 ls_elevation_CICP6_fx[5];
+extern const Word32 ls_azimuth_CICP12_fx[7];
+extern const Word32 ls_elevation_CICP12_fx[7];
+extern const Word32 ls_azimuth_CICP14_fx[7];
+extern const Word32 ls_elevation_CICP14_fx[7];
+extern const Word32 ls_azimuth_CICP16_fx[9];
+extern const Word32 ls_elevation_CICP16_fx[9];
+extern const Word32 ls_azimuth_CICP19_fx[11];
+extern const Word32 ls_elevation_CICP19_fx[11];
+extern const Word16 pow_10_q11[128];
+extern const Word32 pow_10_q23[14];
+extern const Word16 ivas_sin_az_fx[361];
+extern const Word16 ivas_sine_panning_tbl_fx[601];
+extern const Word16 ivas_tan_panning_gain_dirac_tbl_fx[601];
+
+extern const UWord16 cum_n_for_id_th[122];
+
+extern const Word16 gridEq_Table[NO_THETA16_MAX];
+extern const Word32 McMASA_LFEGain_vectors_fx[64]; /* Q25 */
+
/*----------------------------------------------------------------------------------*
* MASA and ISM (OMASA) combined format ROM tables
*----------------------------------------------------------------------------------*/
extern const Word32 sep_object_brate[][MAX_NUM_OBJECTS];
+extern const Word32 dct4_fx[];
+extern const Word32 dct5_fx[];
+extern const Word32 dct8_fx[];
+extern const Word32 dct12_fx[];
+
/*----------------------------------------------------------------------------------*
* Param ISM ROM tables
*----------------------------------------------------------------------------------*/
+extern const Word32 ism_azimuth_borders_fx[4];
+extern const Word32 ism_elevation_borders_fx[4];
+
extern const Word16 Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1];
/*----------------------------------------------------------------------------------*
* LFE coding ROM tables
*----------------------------------------------------------------------------------*/
-
extern const Word16 ivas_lfe_num_ele_in_coder_models[2][4];
extern const Word16 ivas_lfe_log2_num_ele_in_coder_models_fx[2][4];
extern const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP];
extern const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP];
extern const ivas_lfe_freq_models ivas_str_lfe_freq_models;
extern const Word16 ivas_lfe_lpf_delay_Q15[2];
-#ifdef NONBE_FIX_MC_LFE_LPF
extern const Word32 ivas_lfe_lpf_delay_ns[2];
-#endif
extern const Word16 dirac_gains_P_idx[16];
+extern const Word32 ivas_lpf_4_butter_16k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2];
+extern const Word16 ivas_lpf_4_butter_16k_sos_e[IVAS_BIQUAD_FILT_LEN << 2];
+extern const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2];
+extern const Word16 ivas_lpf_4_butter_32k_sos_e[IVAS_BIQUAD_FILT_LEN << 2];
+extern const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2];
+extern const Word16 ivas_lpf_4_butter_48k_sos_e[IVAS_BIQUAD_FILT_LEN << 2];
+#ifndef NONBE_FIX_MC_LFE_LPF
+extern const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1];
+extern const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1];
+extern const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1];
+#endif
+
+extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; // Q31
+extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; // Q31
+extern const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K]; // Q31
+
+extern const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2];
+
+/*------------------------------------------------------------------------------------------*
+ * MDFT/iMDFT ROM tables
+ *------------------------------------------------------------------------------------------*/
+
+extern const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1];
+extern const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1];
+extern const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1];
+extern const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1];
+extern const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1];
+extern const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1];
+extern const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1];
+extern const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1];
+extern const Word32 dirac_gains_trg_term_fx[181][2];
+
/*------------------------------------------------------------------------------------------*
* FB ROM tables
*------------------------------------------------------------------------------------------*/
@@ -296,9 +424,18 @@ extern const Word16 ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][
extern const Word16 ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12];
extern const Word16 ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12];
-
extern const Word16 ivas_num_active_bands[FB - WB + 1];
+extern const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP];
+extern const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP];
+extern const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP];
+extern const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP];
+extern const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP];
+extern const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP];
+
+extern const Word32 ivas_fb_resp_cheby_ramp_32del_fx[IVAS_FB_1MS_32K_SAMP + 1];
+extern const Word32 ivas_fb_resp_cheby_ramp_16del_fx[IVAS_FB_1MS_16K_SAMP + 1];
+
/*------------------------------------------------------------------------------------------*
* SNS MSVQ codebooks and means
*------------------------------------------------------------------------------------------*/
@@ -309,19 +446,22 @@ extern const Word16 ivas_sns_cdbks_tcx20_bits[];
extern const Word16 ivas_sns_cdbks_tcx10_levels[];
extern const Word16 ivas_sns_cdbks_tcx10_bits[];
-
extern const Word16 ivas_sns_cdbks_side_tcx20_levels[];
extern const Word16 ivas_sns_cdbks_side_tcx20_bits[];
extern const Word16 ivas_sns_cdbks_side_tcx10_levels[];
extern const Word16 ivas_sns_cdbks_side_tcx10_bits[];
-
/* means and codebooks for the split VQ in the 2-stage SNS VQ */
extern const Word16 sns_1st_cdbk[2][2][8 * 32];
extern const Word16 sns_1st_means_16k[2][16];
extern const Word16 sns_1st_means_25k6[2][16];
extern const Word16 sns_1st_means_32k[2][16];
+extern const Word16 *const ivas_sns_cdbks_tcx20_fx[];
+extern const Word16 *const ivas_sns_cdbks_tcx10_fx[];
+
+extern const Word16 *const ivas_sns_cdbks_side_tcx20_fx[];
+extern const Word16 *const ivas_sns_cdbks_side_tcx10_fx[];
/*----------------------------------------------------------------------*
* MC ParamUpmix ROM tables
@@ -329,6 +469,45 @@ extern const Word16 sns_1st_means_32k[2][16];
extern const Word16 ivas_param_upmx_mx_qmap[33];
+extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx;
+extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9];
+
+extern const Word32 ivas_han_win_48k_fx[L_FRAME32k];
+extern const Word32 ivas_han_win_32k_fx[L_FRAME32k];
+extern const Word32 ivas_han_win_16k_fx[L_FRAME32k];
+
+extern const Word32 ivas_sine_delay_32_fx[32];
+
+extern const Word32 ivas_sine_frame_len_640_del_32_fx[577];
+extern const Word32 ivas_sine_frame_len_640_del_16_fx[289];
+
+extern const Word32 ivas_fb_fr_12band_1ms_re_fx[IVAS_FB_12_1MS_LEN];
+extern const Word32 ivas_fb_fr_12band_1ms_im_fx[IVAS_FB_12_1MS_LEN];
+
+/*----------------------------------------------------------------------*
+ * Limiter tables
+ *-----------------------------------------------------------------------*/
+
+extern const Word32 release_cnst_table[4][201]; // Q31
+
+/*----------------------------------------------------------------------*
+ * MDCT/IMDCT tables
+ *-----------------------------------------------------------------------*/
+
+extern const Word16 ivas_sin_twiddle_480_fx[IVAS_480_PT_LEN >> 1];
+extern const Word16 ivas_cos_twiddle_480_fx[IVAS_480_PT_LEN >> 1];
+extern const Word16 ivas_sin_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
+extern const Word16 ivas_cos_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
+extern const Word16 ivas_sin_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
+extern const Word16 ivas_cos_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
+extern const Word16 ivas_sin_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
+extern const Word16 ivas_cos_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
+extern const Word16 nf_tw_smoothing_coeffs_fx[N_LTP_GAIN_MEMS];
+extern const Word32 dft_res_gains_q_fx[][2];
+extern const Word16 dft_res_cod_alpha_fx[STEREO_DFT_BAND_MAX];
+extern const Word16 dft_trigo_12k8_fx[STEREO_DFT_N_12k8_ENC / 4 + 1];
+extern const Word16 dft_trigo_32k_fx[STEREO_DFT_N_32k_ENC / 4 + 1];
+extern const Word16 dft_trigo_48k_fx[STEREO_DFT_N_MAX_ENC / 4 + 1];
/* IVAS_ROM_COM_H */
#endif
diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c
index 1f51c6a6ba51995f7f0ad3c95a7c355f7df0769e..395a3c08f49c990f899bcab877a20a60ff2f5bf6 100644
--- a/lib_com/ivas_rom_com_fx.c
+++ b/lib_com/ivas_rom_com_fx.c
@@ -35,12 +35,2869 @@
#include
#include "cnst.h"
#include "ivas_cnst.h"
-#include "ivas_rom_com_fx.h"
+#include "ivas_rom_com.h"
#include "wmc_auto.h"
+/* clang-format off */
+
+/*----------------------------------------------------------------------------------*
+ * Table of IVAS bitrates
+ *----------------------------------------------------------------------------------*/
+
+const Word32 ivas_brate_tbl[SIZE_IVAS_BRATE_TBL] =
+{
+ FRAME_NO_DATA, IVAS_SID_5k2,
+ IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k,
+ IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k,
+ IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k
+};
+
+
+/*-------------------------------------------------------------------------
+ * DFT Stereo ROM tables
+ *------------------------------------------------------------------------*/
+
+/*4xERB scale: max of 14 bands*/
+const Word16 dft_band_limits_erb4[STEREO_DFT_ERB4_BANDS] =
+{
+ 1, 3, 5, 10, 18, 26, 41, 56, 84, 132, 214, 342, 470, 601
+};
+
+/*8xERB scale: max of 8 bands*/
+const Word16 dft_band_limits_erb8[STEREO_DFT_ERB8_BANDS] =
+{
+ 1, 5, 18, 41, 84, 214, 470, 601
+};
+
+const Word16 dft_band_ipd[3][4] =
+{
+ {0,8,10,13},
+ {0,5,6,8},
+ {0,2,3,4}
+};
+
+const Word16 dft_band_res_cod[3][4] =
+{
+ {0,8,10,11},
+ {0,5,6,7},
+ {0,5,6,7}
+};
+
+// Q31
+const Word32 dft_res_gains_q_Q31[][2] =
+{
+ /* quantization points for joint quantization of prediction gain and residual energy */
+
+ /* column 1 (|ILD| = 0): */
+ {0, 0 },
+ {0, 251216928 },
+ {0, 487459456 },
+ {0, 731632640 },
+ {0, 997611392 },
+ {0, 1299397248 },
+ {0, 1666984192 },
+ {0, 2147483647 },
+
+ /* column 2 (|ILD| = 2): */
+ {246151024, 0 },
+ {249475328, 247871152 },
+ {258660112, 480729248 },
+ {274304544, 720918848 },
+ {298427200, 981720000 },
+ {334663840, 1276185088 },
+ {391374592, 1632160640 },
+ {485919712, 2091786496 },
+
+ /* column 3 (|ILD| = 4): */
+ {485919712, 0 },
+ {492224736, 238188144 },
+ {509610752, 461283776 },
+ {539117184, 690072384 },
+ {584326016, 936189056 },
+ {651608832, 1210182144 },
+ {755411712, 1534299776 },
+ {924504576, 1938292992 },
+
+ /* column 4 (|ILD| = 6): */
+ {713563712, 0 },
+ {722237376, 223142880 },
+ {746085184, 431184640 },
+ {786311872, 642617280 },
+ {847364864, 866812416 },
+ {936938496, 1111020032 },
+ {1072199936, 1390431232 },
+ {1285225984, 1720430720 },
+
+ /* column 5 (|ILD| = 8): */
+ {924504576, 0 },
+ {934784576, 204139792 },
+ {962942400, 393358880 },
+ {1010083968, 583482048 },
+ {1080789888, 781462848 },
+ {1182728704, 991308544 },
+ {1332741248, 1221608960 },
+ {1559902080, 1475937536 },
+
+ /* column 6 (|ILD| = 10): */
+ {1115604864, 0 },
+ {1126709504, 182744416 },
+ {1156997632, 351025536 },
+ {1207276672, 517958016 },
+ {1281710592, 688294272 },
+ {1387005952, 863412992 },
+ {1537761536, 1046870336 },
+ {1757032448, 1234717184 },
+
+ /* column 7 (|ILD| = 13): */
+ {1361843968, 0 },
+ {1372924928, 149366080 },
+ {1402942464, 285507936 },
+ {1452130560, 417893888 },
+ {1523515136, 548787328 },
+ {1621670144, 677135936 },
+ {1756740352, 802203264 },
+ {1942499840, 915633344 },
+
+ /* column 8 (|ILD| = 16): */
+ {1559902080, 0 },
+ {1569913600, 117815248 },
+ {1596862336, 224162928 },
+ {1640492800, 325650848 },
+ {1702660352, 423060736 },
+ {1785997696, 514412544 },
+ {1896788608, 597466432 },
+ {2042241920, 664027712 },
+
+ /* column 9 (|ILD| = 19): */
+ {1714196608, 0 },
+ {1722634112, 90359672 },
+ {1745223424, 171238192 },
+ {1781415040, 247171072 },
+ {1832190080, 318199104 },
+ {1898830848, 382271424 },
+ {1984989952, 437025792 },
+ {2094086528, 475912448 },
+
+ /* column 10 (|ILD| = 22): */
+ {1831427712, 0 },
+ {1838194432, 67828272 },
+ {1856228992, 128123168 },
+ {1884882944, 183977072 },
+ {1924581248, 235132272 },
+ {1975822336, 279821408 },
+ {2040659200, 316058048 },
+ {2120554240, 339023232 },
+
+ /* column 11 (|ILD| = 25): */
+ {1918819584, 0 },
+ {1924055168, 50102940 },
+ {1937964416, 94399088 },
+ {1959916032, 135003712 },
+ {1990038784, 171579648 },
+ {2028424960, 202728896 },
+ {2076217216, 226931040 },
+ {2133943808, 240762976 },
+
+ /* column 12 (|ILD| = 30): */
+ {2015827840, 0 },
+ {2019068416, 29502130 },
+ {2027636864, 55420112 },
+ {2041056512, 78889960 },
+ {2059271424, 99626064 },
+ {2082150784, 116769424 },
+ {2110128128, 129415952 },
+ {2143192960, 135682304 },
+
+ /* column 13 (|ILD| = 35): */
+ {2072441984, 0 },
+ {2074364032, 17033840 },
+ {2079438464, 31939524 },
+ {2087347712, 45337676 },
+ {2098012032, 57039312 },
+ {2111296384, 66537632 },
+ {2127368192, 73321536 },
+ {2146126464, 76351632 },
+
+ /* column 14 (|ILD| = 40): */
+ {2104959232, 0 },
+ {2106073728, 9723806 },
+ {2109011456, 18212808 },
+ {2113579136, 25810606 },
+ {2119712384, 32401234 },
+ {2127314432, 37692632 },
+ {2136458496, 41399188 },
+ {2147054208, 42945376 },
+
+ /* column 15 (|ILD| = 45): */
+ {2123466240, 0 },
+ {2124103936, 5514738 },
+ {2125783296, 10322954 },
+ {2128390400, 14615774 },
+ {2131882240, 18322330 },
+ {2136200832, 21283710 },
+ {2141376256, 23332410 },
+ {2147348352, 24150602 },
+
+ /* column 16 (|ILD| = 50): */
+ {2133943808, 0 },
+ {2134306688, 3115998 },
+ {2135260160, 5830418 },
+ {2136737664, 8250632 },
+ {2138715520, 10335839 },
+ {2141157120, 11995844 },
+ {2144077696, 13136157 },
+ {2147440640, 13580687 }
+};
+
+
+/* tables for adaptive Golomb-Rice coding of DFT stereo parameters */
+const Word16 dft_code_itd[] =
+{
+ 0, 3, 4, 13, 8, 9, 12, 5, 10, 44, 23, 60, 45, 31, 235, 59, 28, 61, 234, 116
+};
+
+const Word16 dft_len_itd[] =
+{
+ 2, 3, 4, 4, 4, 4, 4, 4, 4, 6, 5, 6, 6, 5, 8, 6, 5, 6, 8, 7
+};
+
+const Word16 dft_maps_rpg[] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 2, 0, 1, 3, 4, 5, 6, 7,
+ 6, 2, 0, 1, 3, 4, 5, 7,
+ 7, 5, 2, 0, 1, 3, 4, 6,
+ 7, 6, 4, 3, 1, 0, 2, 5,
+ 7, 6, 5, 3, 2, 1, 0, 4,
+ 7, 6, 5, 4, 3, 2, 0, 1,
+ 7, 6, 5, 4, 3, 2, 0, 1,
+ 6, 5, 4, 3, 1, 0, 2, 7,
+};
+
+const Word16 dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 15, 4, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 12, 9, 4, 1, 0, 2, 3, 5, 6, 7, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 16, 14, 8, 4, 2, 0, 1, 3, 5, 6, 7, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 18, 16, 14, 10, 5, 0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 21, 19, 17, 15, 8, 4, 2, 0, 1, 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 21, 19, 17, 15, 12, 8, 4, 0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 21, 19, 17, 15, 13, 11, 9, 3, 0, 1, 2, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 24, 22, 20, 18, 16, 14, 12, 9, 6, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 15, 17, 19, 21, 23, 25, 26, 27, 28, 29, 30,
+ 25, 23, 21, 19, 17, 15, 13, 11, 9, 6, 0, 1, 2, 3, 4, 5, 7, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 27, 28, 29, 30,
+ 27, 25, 23, 21, 19, 17, 15, 13, 11, 8, 5, 0, 1, 2, 3, 4, 6, 7, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 29, 30,
+ 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 28, 29, 30,
+ 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30,
+ 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
+ 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
+ 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29,
+ 30, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28,
+ 30, 29, 28, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26,
+ 30, 29, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 9, 7, 6, 4, 3, 2, 1, 0, 5, 8, 11, 13, 15, 17, 19, 21, 23, 25, 27,
+ 30, 29, 28, 27, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 7, 5, 4, 3, 2, 1, 0, 6, 9, 11, 13, 15, 17, 19, 21, 23, 25,
+ 30, 29, 28, 27, 26, 25, 23, 21, 19, 17, 15, 13, 11, 10, 8, 7, 5, 4, 3, 2, 1, 0, 6, 9, 12, 14, 16, 18, 20, 22, 24,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 12, 10, 8, 7, 6, 5, 4, 2, 1, 0, 3, 9, 11, 13, 15, 17, 19, 21,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 0, 4, 8, 12, 15, 17, 19, 21,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 13, 12, 11, 10, 9, 7, 6, 5, 3, 1, 0, 2, 4, 8, 15, 17, 19, 21,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 17, 15, 13, 12, 11, 9, 8, 7, 6, 4, 3, 2, 1, 0, 5, 10, 14, 16, 18,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 15, 13, 12, 11, 10, 9, 7, 6, 5, 3, 1, 0, 2, 4, 8, 14, 16,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 11, 10, 8, 7, 6, 5, 3, 2, 0, 1, 4, 9, 12,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 3, 2, 1, 0, 4, 15,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+
+
+/*-------------------------------------------------------------------------
+ * Range Coder ROM tables
+ *------------------------------------------------------------------------*/
+
+/* Create separate tables for cumulative frequency and symbol frequency */
+const UWord16 cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS] =
+{
+ { 0,16,47,153,241,269,325,468,591,674,798,912,1017,1082,1183,1277,1364,16384 },
+ { 0,7401,7844,7886,7899,12065,12718,12790,12805,14099,14476,14533,14549,15058,15264,15299,15310,16384 },
+ { 0,4362,6345,6864,7038,9037,11049,11736,12002,12569,13301,13656,13822,14021,14334,14515,14607,16384 },
+ { 0,2955,5183,5822,6013,8153,10671,11614,11943,12586,13540,14025,14232,14437,14770,14978,15080,16384 },
+ { 0,3155,4981,5615,5855,7969,9953,10739,11073,11936,12837,13208,13383,13767,14203,14400,14498,16384 },
+ { 0,1216,2630,3264,3558,4831,6679,7661,8157,8709,9622,10204,10542,10799,11243,11568,11777,16384 },
+ { 0,1759,3641,4350,4612,6325,8678,9732,10161,10790,11790,12361,12642,12883,13295,13566,13720,16384 },
+ { 0,1109,2705,3433,3732,5226,7532,8732,9263,9978,11142,11842,12188,12490,12986,13321,13520,16384 },
+ { 0,11524,13046,13170,13191,14956,15708,15813,15837,16028,16162,16195,16204,16245,16282,16295,16300,16384 },
+ { 0,8027,10586,10909,10974,13291,14861,15157,15232,15535,15824,15914,15943,16014,16090,16123,16136,16384 },
+ { 0,834,2034,2674,2997,4087,5843,6891,7455,8030,9013,9688,10085,10376,10893,11277,11528,16384 },
+ { 0,6038,9086,9451,9519,12332,14521,14913,15003,15329,15711,15848,15893,15955,16045,16091,16111,16384 },
+ { 0,4732,7685,8354,8545,10717,12924,13618,13852,14291,14842,15083,15181,15314,15491,15582,15625,16384 },
+ { 0,745,1783,2347,2655,3537,4963,5864,6406,6863,7664,8248,8634,8891,9351,9708,9958,16384 },
+ { 0,3957,6794,7669,7998,9743,11676,12498,12869,13313,13894,14186,14332,14498,14714,14835,14906,16384 },
+ { 0,2779,5388,6021,6201,8582,11352,12260,12544,13117,13981,14408,14580,14751,15039,15213,15298,16384 },
+ { 0,448,1160,1625,1920,2576,3706,4518,5053,5474,6234,6835,7262,7531,8032,8446,8758,16384 },
+ { 0,1,2,1555,2246,2247,2248,3489,4112,5449,6596,7302,7710,8311,8876,9266,9517,16384 },
+ { 0,2496,4910,5544,5722,8049,10799,11689,11973,12583,13467,13878,14047,14234,14537,14712,14803,16384 },
+ { 0,921,2222,2880,3188,4407,6321,7406,7955,8573,9616,10296,10679,10978,11502,11880,12118,16384 },
+ { 0,2620,4443,5017,5233,7072,9213,10083,10441,11049,11954,12442,12676,12918,13310,13565,13705,16384 },
+ { 0,11205,13084,13178,13187,15164,16010,16081,16091,16213,16303,16321,16325,16340,16355,16360,16362,16384 },
+ { 0,358,916,1288,1542,2055,2937,3594,4062,4399,5017,5524,5907,6136,6573,6941,7236,16384 },
+ { 0,3575,5093,5536,5735,7408,9185,9878,10188,10727,11497,11933,12165,12410,12794,13019,13166,16384 },
+ { 0,1,2,640,1036,1037,1038,1670,2096,2696,3287,3732,4056,4417,4800,5106,5339,16384 },
+ { 0,969,1397,1518,1578,2633,3338,3566,3675,4197,4664,4857,4957,5288,5625,5783,5874,16384 },
+ { 0,10458,12104,12294,12331,14246,15264,15437,15481,15752,15971,16031,16050,16120,16186,16210,16218,16384 },
+ { 0,7178,9744,10039,10093,12701,14612,14961,15042,15360,15732,15869,15917,15978,16070,16117,16139,16384 },
+ { 0,1298,2418,2879,3113,4146,5509,6227,6621,7053,7755,8229,8539,8776,9186,9492,9714,16384 },
+ { 0,4957,7785,8252,8357,10978,13372,13955,14114,14561,15140,15378,15464,15570,15730,15820,15860,16384 },
+ { 0,4823,8164,8570,8647,11604,14169,14653,14763,15105,15554,15727,15785,15852,15960,16018,16045,16384 },
+ { 0,4735,7010,7517,7660,9986,12230,12914,13131,13666,14374,14689,14814,14972,15212,15342,15404,16384 },
+ { 0,3363,5881,6658,6941,8864,11113,12015,12368,12889,13643,14019,14203,14394,14665,14823,14906,16384 },
+ { 0,2569,4996,5779,6068,7917,10251,11209,11602,12129,12918,13321,13520,13696,13976,14155,14259,16384 },
+ { 0,209,577,848,1046,1378,1982,2465,2835,3072,3513,3893,4202,4374,4703,4994,5241,16384 },
+ { 0,2074,4337,5048,5274,7319,10003,11066,11446,12105,13112,13652,13885,14100,14464,14691,14810,16384 },
+ { 0,1619,3560,4288,4550,6381,8955,10102,10543,11239,12362,12982,13261,13516,13958,14234,14381,16384 },
+ { 0,89,257,441,582,734,1024,1325,1568,1716,1983,2222,2430,2545,2750,2941,3109,16384 },
+ { 0,2202,3563,4044,4264,5686,7344,8100,8476,9006,9835,10331,10612,10864,11304,11599,11787,16384 },
+ { 0,1220,2801,3492,3784,5223,7387,8496,8998,9640,10711,11369,11711,11993,12486,12829,13035,16384 },
+ { 0,12626,13813,13903,13917,15396,15906,15972,15987,16139,16230,16251,16257,16289,16315,16323,16326,16384 },
+ { 0,1579,3191,3831,4099,5678,7788,8761,9206,9842,10821,11388,11681,11958,12417,12722,12902,16384 },
+ { 0,597,1514,2064,2379,3237,4679,5637,6213,6733,7649,8316,8755,9052,9599,10023,10323,16384 },
+ { 0,9273,11762,12080,12151,14038,15210,15446,15514,15725,15929,15995,16019,16068,16124,16148,16158,16384 },
+ { 0,9238,11681,11852,11872,14306,15644,15801,15828,16013,16183,16231,16243,16266,16297,16312,16318,16384 },
+ { 0,6791,9200,9531,9594,12240,14178,14552,14639,15064,15506,15643,15687,15785,15908,15960,15983,16384 },
+ { 0,7175,10415,10905,11033,13038,14621,15002,15123,15367,15651,15762,15806,15864,15938,15974,15992,16384 },
+ { 0,5060,7703,8132,8225,10934,13270,13778,13911,14397,14972,15173,15242,15367,15537,15619,15654,16384 },
+ { 0,3721,6311,6857,6992,9557,12180,12895,13098,13671,14418,14718,14830,14984,15212,15333,15390,16384 },
+ { 0,5971,9288,10044,10269,11991,13680,14228,14437,14750,15130,15293,15374,15459,15579,15642,15677,16384 },
+ { 0,3047,5311,5907,6078,8339,10850,11679,11946,12580,13442,13854,14024,14220,14534,14716,14810,16384 },
+ { 0,2061,4280,4993,5228,7201,9735,10735,11097,11708,12606,13082,13295,13498,13836,14043,14161,16384 },
+ { 0,4738,7949,8880,9234,10781,12502,13214,13531,13897,14355,14593,14718,14835,14998,15096,15153,16384 },
+ { 0,3237,5045,5632,5860,7609,9702,10608,10986,11571,12476,12978,13230,13451,13830,14074,14208,16384 },
+ { 0,1833,3889,4677,5028,6422,8379,9378,9884,10350,11086,11545,11809,12003,12327,12559,12711,16384 },
+ { 0,3989,6858,7352,7459,10254,12936,13571,13735,14240,14895,15153,15242,15364,15548,15646,15690,16384 },
+ { 0,1463,3197,3909,4220,5626,7609,8632,9127,9657,10520,11078,11380,11607,11991,12265,12442,16384 },
+ { 0,14233,15083,15108,15110,16069,16300,16314,16316,16352,16370,16373,16374,16377,16380,16381,16382,16384 },
+ { 0,1,2,2610,3293,3294,3295,5097,5671,8467,10332,11119,11437,12223,12850,13185,13345,16384 },
+ { 0,2010,4053,4696,4910,6879,9391,10386,10750,11393,12376,12886,13119,13348,13726,13967,14099,16384 },
+ { 0,7586,10517,10758,10791,13543,15346,15577,15619,15846,16082,16150,16169,16202,16245,16265,16273,16384 },
+ { 0,3059,5772,6369,6524,9041,11801,12582,12813,13361,14115,14439,14567,14714,14944,15075,15141,16384 },
+ { 0,8643,10594,10813,10856,13274,14686,14920,14975,15350,15680,15771,15799,15897,16003,16042,16057,16384 },
+ { 0,6720,8878,9325,9467,11564,13248,13744,13929,14384,14880,15087,15167,15311,15488,15569,15607,16384 },
+};
+
+const UWord16 sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] =
+{
+ { 16,31,106,88,28,56,143,123,83,124,114,105,65,101,94,87,15020 },
+ { 7401,443,42,13,4166,653,72,15,1294,377,57,16,509,206,35,11,1074 },
+ { 4362,1983,519,174,1999,2012,687,266,567,732,355,166,199,313,181,92,1777 },
+ { 2955,2228,639,191,2140,2518,943,329,643,954,485,207,205,333,208,102,1304 },
+ { 3155,1826,634,240,2114,1984,786,334,863,901,371,175,384,436,197,98,1886 },
+ { 1216,1414,634,294,1273,1848,982,496,552,913,582,338,257,444,325,209,4607 },
+ { 1759,1882,709,262,1713,2353,1054,429,629,1000,571,281,241,412,271,154,2664 },
+ { 1109,1596,728,299,1494,2306,1200,531,715,1164,700,346,302,496,335,199,2864 },
+ { 11524,1522,124,21,1765,752,105,24,191,134,33,9,41,37,13,5,84 },
+ { 8027,2559,323,65,2317,1570,296,75,303,289,90,29,71,76,33,13,248 },
+ { 834,1200,640,323,1090,1756,1048,564,575,983,675,397,291,517,384,251,4856 },
+ { 6038,3048,365,68,2813,2189,392,90,326,382,137,45,62,90,46,20,273 },
+ { 4732,2953,669,191,2172,2207,694,234,439,551,241,98,133,177,91,43,759 },
+ { 745,1038,564,308,882,1426,901,542,457,801,584,386,257,460,357,250,6426 },
+ { 3957,2837,875,329,1745,1933,822,371,444,581,292,146,166,216,121,71,1478 },
+ { 2779,2609,633,180,2381,2770,908,284,573,864,427,172,171,288,174,85,1086 },
+ { 448,712,465,295,656,1130,812,535,421,760,601,427,269,501,414,312,7626 },
+ { 1,1,1553,691,1,1,1241,623,1337,1147,706,408,601,565,390,251,6867 },
+ { 2496,2414,634,178,2327,2750,890,284,610,884,411,169,187,303,175,91,1581 },
+ { 921,1301,658,308,1219,1914,1085,549,618,1043,680,383,299,524,378,238,4266 },
+ { 2620,1823,574,216,1839,2141,870,358,608,905,488,234,242,392,255,140,2679 },
+ { 11205,1879,94,9,1977,846,71,10,122,90,18,4,15,15,5,2,22 },
+ { 358,558,372,254,513,882,657,468,337,618,507,383,229,437,368,295,9148 },
+ { 3575,1518,443,199,1673,1777,693,310,539,770,436,232,245,384,225,147,3218 },
+ { 1,1,638,396,1,1,632,426,600,591,445,324,361,383,306,233,11045 },
+ { 969,428,121,60,1055,705,228,109,522,467,193,100,331,337,158,91,10510 },
+ { 10458,1646,190,37,1915,1018,173,44,271,219,60,19,70,66,24,8,166 },
+ { 7178,2566,295,54,2608,1911,349,81,318,372,137,48,61,92,47,22,245 },
+ { 1298,1120,461,234,1033,1363,718,394,432,702,474,310,237,410,306,222,6670 },
+ { 4957,2828,467,105,2621,2394,583,159,447,579,238,86,106,160,90,40,524 },
+ { 4823,3341,406,77,2957,2565,484,110,342,449,173,58,67,108,58,27,339 },
+ { 4735,2275,507,143,2326,2244,684,217,535,708,315,125,158,240,130,62,980 },
+ { 3363,2518,777,283,1923,2249,902,353,521,754,376,184,191,271,158,83,1478 },
+ { 2569,2427,783,289,1849,2334,958,393,527,789,403,199,176,280,179,104,2125 },
+ { 209,368,271,198,332,604,483,370,237,441,380,309,172,329,291,247,11143 },
+ { 2074,2263,711,226,2045,2684,1063,380,659,1007,540,233,215,364,227,119,1574 },
+ { 1619,1941,728,262,1831,2574,1147,441,696,1123,620,279,255,442,276,147,2003 },
+ { 89,168,184,141,152,290,301,243,148,267,239,208,115,205,191,168,13275 },
+ { 2202,1361,481,220,1422,1658,756,376,530,829,496,281,252,440,295,188,4597 },
+ { 1220,1581,691,292,1439,2164,1109,502,642,1071,658,342,282,493,343,206,3349 },
+ { 12626,1187,90,14,1479,510,66,15,152,91,21,6,32,26,8,3,58 },
+ { 1579,1612,640,268,1579,2110,973,445,636,979,567,293,277,459,305,180,3482 },
+ { 597,917,550,315,858,1442,958,576,520,916,667,439,297,547,424,300,6061 },
+ { 9273,2489,318,71,1887,1172,236,68,211,204,66,24,49,56,24,10,226 },
+ { 9238,2443,171,20,2434,1338,157,27,185,170,48,12,23,31,15,6,66 },
+ { 6791,2409,331,63,2646,1938,374,87,425,442,137,44,98,123,52,23,401 },
+ { 7175,3240,490,128,2005,1583,381,121,244,284,111,44,58,74,36,18,392 },
+ { 5060,2643,429,93,2709,2336,508,133,486,575,201,69,125,170,82,35,730 },
+ { 3721,2590,546,135,2565,2623,715,203,573,747,300,112,154,228,121,57,994 },
+ { 5971,3317,756,225,1722,1689,548,209,313,380,163,81,85,120,63,35,707 },
+ { 3047,2264,596,171,2261,2511,829,267,634,862,412,170,196,314,182,94,1574 },
+ { 2061,2219,713,235,1973,2534,1000,362,611,898,476,213,203,338,207,118,2223 },
+ { 4738,3211,931,354,1547,1721,712,317,366,458,238,125,117,163,98,57,1231 },
+ { 3237,1808,587,228,1749,2093,906,378,585,905,502,252,221,379,244,134,2176 },
+ { 1833,2056,788,351,1394,1957,999,506,466,736,459,264,194,324,232,152,3673 },
+ { 3989,2869,494,107,2795,2682,635,164,505,655,258,89,122,184,98,44,694 },
+ { 1463,1734,712,311,1406,1983,1023,495,530,863,558,302,227,384,274,177,3942 },
+ { 14233,850,25,2,959,231,14,2,36,18,3,1,3,3,1,1,2 },
+ { 1,1,2608,683,1,1,1802,574,2796,1865,787,318,786,627,335,160,3039 },
+ { 2010,2043,643,214,1969,2512,995,364,643,983,510,233,229,378,241,132,2285 },
+ { 7586,2931,241,33,2752,1803,231,42,227,236,68,19,33,43,20,8,111 },
+ { 3059,2713,597,155,2517,2760,781,231,548,754,324,128,147,230,131,66,1243 },
+ { 8643,1951,219,43,2418,1412,234,55,375,330,91,28,98,106,39,15,327 },
+ { 6720,2158,447,142,2097,1684,496,185,455,496,207,80,144,177,81,38,777 },
+};
+
+
+/*-------------------------------------------------------------------------
+ * ECLVQ Stereo ROM tables
+ *------------------------------------------------------------------------*/
+
+/* table with round(ECSQ_PROB_TOTAL / index) for entropy coding, with i in {1, .., ECSQ_SEGMENT_SIZE} */
+const UWord16 ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE] =
+{
+ 0, 16384, 8192, 5461, 4096, 3277, 2731, 2341, 2048
+};
+
+const Word16 tdm_bit_allc_tbl[5][6] =
+{
+ /* IC -- UC -- GC -- TM --AC */
+ { 1650, 3500, 0, 4400, 0, 5000 }, /* IVAS_13k2 */
+ { 1650, 3500, 0, 5000, 0, 5000 }, /* IVAS_16k4 */
+ { 1650, 3500, 0, 6000, 0, 5000 }, /* IVAS_24k4 */
+ { 1650, 6050, 0, 10000, 0, 10000 }, /* IVAS_32k */
+ { 1650, 6050, 0, 13000, 0, 14000 } /* IVAS_48k */
+};
+
+
+const Word16 fast_FCB_bits_2sfr[] = {8, 14, 18, 20, 24, 128/*stop value*/};
+
+const Word16 fast_FCB_rates_2sfr[] = {/*16*50,*/ (8+14)*50, 28*50, 32*50, 34*50, 36*50, 38*50, 40*50, 42*50, 44*50, 48*50};
+
+
+/*----------------------------------------------------------------------------------*
+ * MDCT Stereo ROM tables
+ *----------------------------------------------------------------------------------*/
+
+ /* PsychLPC */
+
+const SpectrumWarping sw32000Hz[] =
+{{
+ {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6,
+ 6, 8, 8, 8, 8, 8, 10, 10, 10, 10, 12, 12, 12, 12, 14, 14,
+ 14, 16, 18, 18, 18, 20, 22, 22, 22, 24, 26, 26, 26, 28, 30, 32
+ },
+ {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5,
+ 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10
+ },
+}};
+
+const SpectrumWarping sw25600Hz[] =
+{{
+ {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6,
+ 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 10, 12, 12, 12, 12,
+ 12, 12, 14, 14, 14, 14, 14, 16, 16, 18, 18, 18, 18, 18, 20, 20
+ },
+ {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7
+ },
+}};
+
+const SpectrumWarping sw16000Hz[] =
+{{
+ {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
+ },
+ {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+ },
+}};
+
+const MDCTStereoBands_config mdctStereoBands_32000_640[] =
+{{
+ /*TCX 20*/
+ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 8, 8, 8, 8, 8, 8, 8, 12, 12, 12,
+ 12, 20, 20, 20, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 42,
+ 64, 64, 96, 160},
+ {44, 41,38, 29},/*number of bands for frame lengths 960, 640, 512, 320 respectively*/
+
+ /*TCX 10*/
+ {
+ 4, 4, 4, 4, 4, 8, 8, 8, 8, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 20, 32, 32,
+ 32, 48, 80
+ },
+ {33, 29, 26, 18}/*number of bands for frame lengths 480, 320, 256, 160 respectively*/
+}};
+
+const Word16 dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */
+
+const Word16 dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */
+
+const Word16 dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 };
+
+const Word16 DirAC_band_grouping_12[12 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 11, 17, 25, 40, 60
+};
+
+const Word16 DirAC_band_grouping_6[6 + 1] =
+{
+ 0, 1, 4, 8, 20, 30, 60
+};
+
+const Word16 DirAC_band_grouping_5[5 + 1] =
+{
+ 0, 1, 3, 7, 15, 60
+};
+
+const Word16 DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1] =
+{
+ 0, 4, 8, 12, 16
+};
+
+const Word16 DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] =
+{
+ 0, 1, 2, 3, 4
+};
+
+const Word32 c_weights_fx[DIRAC_NO_FB_BANDS_MAX] /* Q30 */ = { 106970960, 1033798336, 1065867776, 1071704704, 1073381888, 1073741824, 1073494016, 1072883072, 1072012032, 1070930560, 1069665600, 1068232640, 1066641792, 1064899968, 1063012224, 1060982464, 1058814144, 1056510016, 1054072832, 1051505280, 1048809664, 1045988480, 1043044160, 1039979072, 1036795776, 1033496576, 1030084096, 1026560960, 1022929600, 1019192512, 1015352576, 1011412416, 1007374720, 1003242112, 999017472, 994703488, 990302976, 985818688, 981253568, 976610304, 971891712, 967100672, 962240064, 957312576, 952321088, 947268224, 942156992, 936990080, 931770048, 926499840, 921182016, 915819200, 910414208, 904969344, 899487488, 893970944, 888422272, 882843840, 877238144, 871607552, 865954432, 860280896, 854589184, 848881728, 843160384, 837427328, 831684672, 825934208, 820178240, 814418240, 808656320, 802894208, 797133568, 791376192, 785623744, 779877568, 774139520, 768410880, 762693184, 756987904, 751296064, 745619328, 739958784, 734315584, 728691008, 723086208, 717502016, 711939712, 706400064, 700884096, 695392768, 689926912, 684487232, 679074688, 673689856, 668333504, 663006464, 657709056, 652442176, 647206144, 642001600, 636828992, 631688896, 626581696, 621507776, 616467520, 611461184, 606489344, 601552064, 596649792, 591782528, 586950784, 582154560, 577394112, 572669696, 567981312, 563329088, 558713152, 554133568, 549590464, 545083840, 540613760, 536180160, 531783104, 527422528, 523098464, 518810784, 514559520, 510344672, 506165856, 502023360, 497916832, 493846304, 489811488, 485812448, 481848832, 477920672, 474027808, 470169952, 466347008, 462558848, 458805152, 455085920, 451400736, 447749600, 444132160, 440548320, 436997792, 433480416, 429995904, 426544032, 423124608, 419737376, 416382144, 413058720, 409766720, 406505984, 403276288, 400077280, 396908768, 393770656, 390662496, 387584064, 384535200, 381515616, 378525024, 375563200, 372629952, 369724864, 366847872, 363998592, 361176672, 358382176, 355614592, 352873760, 350159456, 347471328, 344809216, 342172864, 339562048, 336976384, 334415808, 331879840, 329368576, 326881472, 324418432, 321979104, 319563392, 317170976, 314801664, 312455232, 310131328, 307829856, 305550528, 303293088, 301057440, 298843168, 296650176, 294478304, 292327168, 290196672, 288086432, 285996512, 283926432, 281876224, 279845472, 277834016, 275841792, 273868480, 271913856, 269977792, 268059968, 266160304, 264278672, 262414768, 260568368, 258739360, 256927520, 255132768, 253354752, 251593392, 249848448, 248119936, 246407424, 244710816, 243030080, 241364928, 239715120, 238080672, 236461248, 234856752, 233267088, 231692016, 230131440, 228585136, 227053024, 225534848, 224030544, 222539872, 221062832 };
+
+
+/*----------------------------------------------------------------------*
+* SPAR ROM tables
+*-----------------------------------------------------------------------*/
+
+const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] =
+{
+/* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel
+ so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */
+ { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 10000, 8150, 13150 } },
+ { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
+
+ { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 13200, 11350, 16350 } },
+ { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
+
+ { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 16400, 14850, 24350 } },
+ { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
+
+ { 32000, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 24000, 20450, 31950 } },
+ { { 21, 1, 5, 1 },{ 15, 1, 5, 1 },{ 15, 1, 3, 1 } }, 0, 0, 0 },
+
+ { 48000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 24000, 21000, 31950 },{ 16000, 15000, 20400 } },
+ { { 15, 7, 5, 1 },{ 15, 7, 3, 1 },{ 7, 7, 3, 1 } }, 1, 0, 0 },
+
+ { 64000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 38000, 34050, 56000 },{ 16000, 15600, 20400 } },{ { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 1, 0 },
+
+ { 80000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 46000, 43000, 56000 },{ 24000, 23000, 31950 } },
+ { { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 0, 0 },
+
+ { 96000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 47000, 42600, 56000 },{ 23000, 22600, 31950 },{ 16000, 15600, 20400 } },
+ { { 21, 9, 9, 1 },{ 21, 7, 5, 1 },{ 21, 7, 5, 1 } }, 1, 0, 0 },
+
+ { 128000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 55000, 50000, 56000 },{ 36000, 36000, 56000 },{ 27000, 27000, 31950 } },
+ { { 21, 11, 9, 1 },{ 21, 9, 7, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
+
+ { 160000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 74000, 70900, 112000 },{ 41000, 40050, 56000 },{ 35000, 34050, 56000 } },
+ { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
+
+ { 192000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 90000, 87900, 112000 },{ 50000, 48050, 56000 },{ 42000, 41050, 56000 } },
+ { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
+
+ { 256000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 90000, 85000, 112000 },{ 70000, 69000, 112000 },{ 50000, 48950, 56000 },{ 36400, 35600, 56000 } },
+ { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 256000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 84650, 83000, 112000 },{ 65850, 64550, 56000 },{ 47000, 46100, 48000 },{ 28200, 27650, 40000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } },
+ { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 384000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 384000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } },
+ { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124000, 124000, 128000 },{ 124000, 124000, 128000 },{ 125200, 118450, 128000 },{ 76300, 73000, 128000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 118000, 118000, 128000 },{ 118000, 118000, 128000 },{ 117200, 109250, 128000 },{ 72300, 69000, 128000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+};
+
+const ivas_spar_br_table_t ivas_spar_br_table_consts_fx[IVAS_SPAR_BR_TABLE_LEN] = /*ceilf(log2f)*/
+{
+ /* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel
+ so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */
+ { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 10000, 8150, 13150 } },
+ { { 4, 0, 3, 0 },{ 4, 0, 2, 0 },{ 3, 0, 2, 0 } }, 0, 0, 0 },
+
+ { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 13200, 11350, 16350 } },
+ { { 4, 0, 3, 0 },{ 4, 0, 2, 0 },{ 3, 0, 2, 0 } }, 0, 0, 0 },
+
+ { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 16400, 14850, 24350 } },
+ { { 4, 0, 3, 0 },{ 4, 0, 2, 0 },{ 3, 0, 2, 0 } }, 0, 0, 0 },
+
+ { 32000, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, { { 24000, 20450, 31950 } },
+ { { 5, 0, 3, 0 },{ 4, 0, 3, 0 },{ 4, 0, 2, 0 } }, 0, 0, 0 },
+
+ { 48000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 24000, 21000, 31950 },{ 16000, 15000, 20400 } },
+ { { 4, 3, 3, 0 },{ 4, 3, 2, 0 },{ 3, 3, 2, 0 } }, 1, 0, 0 },
+
+ { 64000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 38000, 34050, 56000 },{ 16000, 15600, 20400 } },{ { 5, 3, 3, 0 },{ 4, 3, 3, 0 },{ 4, 3, 2, 0 } }, 1, 1, 0 },
+
+ { 80000, 0, SBA_FOA_ORDER, FB, 24000, 2, WYXZ, 0, 0, { { 46000, 43000, 56000 },{ 24000, 23000, 31950 } },
+ { { 5, 3, 3, 0 },{ 4, 3, 3, 0 },{ 4, 3, 2, 0 } }, 1, 0, 0 },
+
+ { 96000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 47000, 42600, 56000 },{ 23000, 22600, 31950 },{ 16000, 15600, 20400 } },
+ { { 5, 4, 4, 0 },{ 5, 3, 3, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
+
+ { 128000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 55000, 50000, 56000 },{ 36000, 36000, 56000 },{ 27000, 27000, 31950 } },
+ { { 5, 4, 4, 0 },{ 5, 4, 3, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
+
+ { 160000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 74000, 70900, 112000 },{ 41000, 40050, 56000 },{ 35000, 34050, 56000 } },
+ { { 5, 4, 4, 0 },{ 5, 4, 4, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
+
+ { 192000, 0, SBA_FOA_ORDER, FB, 24000, 3, WYXZ, 0, 0, { { 90000, 87900, 112000 },{ 50000, 48050, 56000 },{ 42000, 41050, 56000 } },
+ { { 5, 4, 4, 0 },{ 5, 4, 4, 0 },{ 5, 3, 3, 0 } }, 1, 0, 0 },
+
+ { 256000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 90000, 85000, 112000 },{ 70000, 69000, 112000 },{ 50000, 48950, 56000 },{ 36400, 35600, 56000 } },
+ { { 5, 0, 0, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 256000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 84650, 83000, 112000 },{ 65850, 64550, 56000 },{ 47000, 46100, 48000 },{ 28200, 27650, 40000 } },
+ { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } },
+ { { 5, 4, 4, 0 },{ 0, 0, 0, 0 }, { 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } },
+ { { 5, 0, 0, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 384000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } },
+ { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 384000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } },
+ { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 512000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } },
+ { { 5, 0, 0, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 512000, 0, SBA_HOA2_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 124000, 124000, 128000 },{ 124000, 124000, 128000 },{ 125200, 118450, 128000 },{ 76300, 73000, 128000 } },
+ { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+
+ { 512000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0, { { 118000, 118000, 128000 },{ 118000, 118000, 128000 },{ 117200, 109250, 128000 },{ 72300, 69000, 128000 } },
+ { { 5, 4, 4, 0 },{ 0, 0, 0, 0 },{ 0, 0, 0, 0 } }, 1, 2, 0 },
+};
+
+const ivas_freq_models_t ivas_arith_pred_r_consts[TOTAL_PRED_QUANT_STRATS_ARITH] =
+{
+ /* entry for 1 quantization points */
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points for br_table_idx >= 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,546,1092,2184,8740,2184,1092,546, },
+ { 0,1779,2116,2516,3562,2516,2116,1779, },
+ { 0,1848,2614,5229,2614,1848,1307,924, },
+ { 0,924,1307,1848,2614,5229,2614,1848, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* pred_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 15 quantization points for br_table_idx >= 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 21 quantization points for br_table_idx >= 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 31 quantization points */
+ {
+ /* pred real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, }
+ },
+ /* pred real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, }
+ },
+ /* pred real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points for br_table_idx < 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,327,778,1851,10472,1851,778,327, },
+ { 0,1057,1630,2514,5982,2514,1630,1057, },
+ { 0,1668,2572,6122,2572,1668,1081,701, },
+ { 0,701,1081,1668,2572,6122,2572,1668, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* pred_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 15 quantization points for br_table_idx < 2 */
+ {
+ /* pred real */
+ {
+ { 0,9,23,56,133,318,757,1800,10192,1800,757,318,133,56,23,9, },
+ { 0,156,240,371,573,883,1363,2102,5008,2102,1363,883,573,371,240,156, },
+ { 0,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241,156,101, },
+ { 0,101,156,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241, }
+ },
+ /* pred real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, }
+ },
+ /* pred real : values for general and differential */
+ {-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7},
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 21 quantization points for br_table_idx < 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,4,9,23,56,133,318,756,1799,10184,1799,756,318,133,56,23,9,4,1,1, },
+ { 0,41,64,98,152,234,362,558,861,1329,2049,4888,2049,1329,861,558,362,234,152,98,64,41, },
+ { 0,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64,41,26, },
+ { 0,26,41,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ }
+};
+
+const ivas_freq_models_t ivas_arith_drct_r_consts[TOTAL_DRCT_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {
+ /* drct real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct real : values for general and differential */
+ {0},{ 0 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points */
+ { /* drct real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 9 quantization points */
+ {
+ /* drct real */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,573,722,909,1146,1444,1819,2292,2888,4591, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* drct real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, }
+ },
+ /* drct real : values for general and differential */
+ { -4,-3,-2,-1,0,1,2,3,4 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 11 quantization points */
+ {
+ /* drct real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ }
+};
+
+const ivas_freq_models_t ivas_arith_decd_r_consts[TOTAL_DECD_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 3 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2 },{-1,0,1},
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 5 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,10983,2744,1372,686,343,171,85, },
+ { 0,6573,3285,2322,1642,1161,821,580, },
+ { 0,1603,2020,2546,4046,2546,2020,1603, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* decd real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, }
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4,5,6 },{ -3,-2,-1,0,1,2,3 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 9 quantization points */
+ { /* decd real */
+ {
+ { 0,10941,2734,1367,683,341,170,85,42,21, },
+ { 0,6305,3150,2227,1575,1113,787,556,393,278, },
+ { 0,1101,1388,1749,2203,3502,2203,1749,1388,1101, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* decd real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, }
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 11 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ }
+};
+
+const ivas_huff_models_t ivas_huff_pred_r_consts[TOTAL_PRED_QUANT_STRATS_HUFF] =
+{
+ /* entry for 1 quantization points for br_table_idx */
+ {{{ 0 }}, {{ 0 }}},
+ /* entry for 7 quantization points for br_table_idx */
+ {
+ /* pred_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* pred_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ /* entry for 15 quantization points for br_table_idx */
+ {
+ /* pred_r codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5, 4, 4 },{ -4, 4, 5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },
+ { 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 } },
+ /* pred_r differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5, 4, 4 },{ -4, 4, 5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },
+ { 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 } },
+ },
+ /* entry for 21 quantization points for br_table_idx=0 */
+ {
+ /* pred_r codebook */
+ { {-10,5,22},{-9,5,23},{-8,5,24},{-7,5,25},{-6,5,26}, { -5, 4, 0 },{ -4, 4, 1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },
+ { 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{6,5,27},{7,5,28},{8,5,29},{9,5,30},{10,5,31} },
+ /* pred_r differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5, 4, 0 },{ -4, 4, 1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },
+ { 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 } },
+ },
+
+ /* entry for 31 quantization points for br_table_idx>0 */
+ {
+ /* pred_r codebook */
+ { {-15,5,2},{-14,5,3},{-13,5,4},{-12,5,5},{-11,5,6}, { -10,5,7 },{ -9,5,8 },{ -8,5,9 },
+ { -7,5,10 },{ -6,5,11 },{ -5, 5, 12 },{ -4, 5, 13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },
+ { 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },
+ { 8,5,24 },{ 9,5,25 },{ 10,5,26 },{11,5,27},{12,5,28},{13,5,29},{14,5,30},{15,5,31} },
+ /* pred_r differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },
+ { -7,5,10 },{ -6,5,11 },{ -5, 5, 12 },{ -4, 5, 13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },
+ { 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },
+ { 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 } },
+ },
+ };
+
+const ivas_huff_models_t ivas_huff_drct_r_consts[TOTAL_DRCT_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {{{ 0 }}, {{ 0 }}},
+ /* entry for 7 quantization points */
+ {
+ /* drct_r codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
+ /* drct_r differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
+ },
+ /* entry for 9 quantization points */
+ {
+ /* drct_r codebook */
+ { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
+ /* drct_r differential codebook */
+ { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
+ },
+ /* entry for 11 quantization points */
+ {
+ /* drct_r codebook */
+ { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
+ /* drct_r differential codebook */
+ { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
+ },
+};
+
+const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {{{ 0 }}, {{ 0 }}},
+ /* entry for 3 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0, 2, 2 },{ 1, 1, 0 },{ 2,2,3 } },
+ /* decd_r differential codebook */
+ { { -1, 2, 2 },{ 0, 1, 0 },{ 1,2,3 } },
+ },
+ /* entry for 5 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 } },
+ /* decd_r differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 } },
+ },
+ /* entry for 7 quantization points */
+ {
+ /* decd_r */
+ { { 0, 3, 2 },{ 1, 3, 3 },{ 2,3,4 },{ 3,3,0 },{ 4,3,5 },{ 5,3,6 },{ 6,3,7 } },
+ /* decd_r codebook differential codebook */
+ { { -3, 3, 2 },{ -2, 3, 3 },{ -1,3,4 },{ 0,3,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
+ },
+ /* entry for 9 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0, 4, 14 },{ 1,3,0 },{ 2,3,1 },{ 3,3,2 },{ 4,3,3 },{ 5,3,4 },{ 6,3,5 },{ 7,3,6 },{ 8,4,15 } },
+ /* decd_r differential codebook */
+ { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
+ },
+ /* entry for 11 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0, 4, 10 },{ 1, 4, 11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 } },
+ /* decd_r differential codebook */
+ { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
+ },
+};
+
+/* DTX quantization and bitstream constants */
+const Word16 dtx_pd_real_q_levels[3][3] = { { 7,7,7 },{ 7,7,0 },{ 3,0,0 } };
+const Word16 dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } };
+const Word16 pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } };
+const Word16 pr_pd_idx_pairs[3][3][2] = { { { 1, 1 },{ 2, 2 },{ 3, 3 } },{ { 1, 1 },{ 3, 2 },{ 2, 0 } },{ { 2, 1 },{ 0, 0 },{ 0, 0 } } };
+
+const Word16 remix_order_set[1][DIRAC_MAX_ANA_CHANS] = { /* WYZX --> WYXZ... */
+ { 0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 }
+};
+
+const Word16 HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15};
+const Word16 HOA_keep_ind_spar[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 10, 10, 10, 10};
+const Word16 HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
+
+
+/*----------------------------------------------------------------------*
+* PCA ROM tables
+*-----------------------------------------------------------------------*/
+
+const Word32 ivas_pca_offset_index1[IVAS_PCA_N1 + 1] =
+{
+ 0, 1, 9, 61, 163, 359, 685, 1125, 1747,
+ 2519, 3521, 4713, 6183, 7883, 9809, 12093, 14633, 17575,
+ 20807, 24343, 28181, 32487, 37121, 42097, 47405, 53057, 59061,
+ 65421, 72137, 79205, 86625, 94415, 102345, 110629, 119263, 128017,
+ 137097, 146515, 156043, 165637, 175551, 185515, 195535, 205837, 216183,
+ 226545, 236911, 247273, 257619, 267921, 277941, 287905, 297819, 307413,
+ 316941, 326359, 335439, 344193, 352827, 361111, 369041, 376831, 384251,
+ 391319, 398035, 404395, 410399, 416051, 421359, 426335, 430969, 435275,
+ 439113, 442649, 445881, 448823, 451363, 453647, 455573, 457273, 458743,
+ 459935, 460937, 461709, 462331, 462771, 463097, 463293, 463395, 463447,
+ 463455, 463456
+};
+
+const Word16 ivas_pca_offset_index2[2692] =
+{
+ 0, 1, 0, 1, 7, 8, 0, 1, 7, 19,
+ 33, 45, 51, 52, 0, 1, 9, 23, 41, 61,
+ 79, 93, 101, 102, 0, 1, 7, 21, 39, 61,
+ 85, 111, 135, 157, 175, 189, 195, 196, 0, 1,
+ 7, 19, 37, 59, 85, 115, 147, 179, 211, 241,
+ 267, 289, 307, 319, 325, 326, 0, 1, 7, 21,
+ 41, 65, 95, 127, 163, 201, 239, 277, 313, 345,
+ 375, 399, 419, 433, 439, 440, 0, 1, 7, 19,
+ 37, 61, 91, 125, 163, 203, 245, 289, 333, 377,
+ 419, 459, 497, 531, 561, 585, 603, 615, 621, 622,
+ 0, 1, 7, 21, 41, 67, 97, 133, 173, 217,
+ 263, 311, 361, 411, 461, 509, 555, 599, 639, 675,
+ 705, 731, 751, 765, 771, 772, 0, 1, 7, 19,
+ 37, 61, 91, 127, 167, 211, 259, 309, 363, 417,
+ 473, 529, 585, 639, 693, 743, 791, 835, 875, 911,
+ 941, 965, 983, 995, 1001, 1002, 0, 1, 7, 21,
+ 41, 67, 99, 135, 177, 223, 273, 327, 383, 443,
+ 503, 565, 627, 689, 749, 809, 865, 919, 969, 1015,
+ 1057, 1093, 1125, 1151, 1171, 1185, 1191, 1192, 0, 1,
+ 7, 19, 37, 61, 91, 127, 169, 215, 265, 319,
+ 377, 437, 501, 567, 633, 701, 769, 837, 903, 969,
+ 1033, 1093, 1151, 1205, 1255, 1301, 1343, 1379, 1409, 1433,
+ 1451, 1463, 1469, 1470, 0, 1, 7, 21, 41, 67,
+ 99, 137, 179, 227, 279, 335, 395, 459, 525, 595,
+ 667, 739, 813, 887, 961, 1033, 1105, 1175, 1241, 1305,
+ 1365, 1421, 1473, 1521, 1563, 1601, 1633, 1659, 1679, 1693,
+ 1699, 1700, 0, 1, 9, 23, 43, 69, 101, 139,
+ 183, 231, 285, 343, 405, 471, 541, 613, 689, 765,
+ 843, 923, 1003, 1083, 1161, 1237, 1313, 1385, 1455, 1521,
+ 1583, 1641, 1695, 1743, 1787, 1825, 1857, 1883, 1903, 1917,
+ 1925, 1926, 0, 1, 7, 21, 41, 67, 99, 137,
+ 179, 227, 281, 339, 401, 467, 537, 611, 687, 767,
+ 849, 931, 1015, 1099, 1185, 1269, 1353, 1435, 1517, 1597,
+ 1673, 1747, 1817, 1883, 1945, 2003, 2057, 2105, 2147, 2185,
+ 2217, 2243, 2263, 2277, 2283, 2284, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 285, 345, 409, 477,
+ 549, 625, 705, 787, 871, 957, 1045, 1135, 1225, 1315,
+ 1405, 1495, 1583, 1669, 1753, 1835, 1915, 1991, 2063, 2131,
+ 2195, 2255, 2309, 2359, 2403, 2441, 2473, 2499, 2519, 2533,
+ 2539, 2540, 0, 1, 7, 19, 39, 65, 97, 135,
+ 177, 225, 279, 337, 401, 469, 541, 617, 697, 781,
+ 867, 955, 1045, 1137, 1231, 1327, 1423, 1519, 1615, 1711,
+ 1805, 1897, 1987, 2075, 2161, 2245, 2325, 2401, 2473, 2541,
+ 2605, 2663, 2717, 2765, 2807, 2845, 2877, 2903, 2923, 2935,
+ 2941, 2942, 0, 1, 7, 21, 41, 67, 99, 137,
+ 181, 229, 283, 343, 407, 477, 551, 629, 711, 797,
+ 885, 977, 1071, 1167, 1265, 1365, 1465, 1565, 1667, 1767,
+ 1867, 1967, 2065, 2161, 2255, 2347, 2435, 2521, 2603, 2681,
+ 2755, 2825, 2889, 2949, 3003, 3051, 3095, 3133, 3165, 3191,
+ 3211, 3225, 3231, 3232, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 347, 413, 483, 559, 639,
+ 723, 811, 903, 997, 1093, 1193, 1295, 1399, 1503, 1609,
+ 1715, 1821, 1927, 2033, 2137, 2241, 2343, 2443, 2539, 2633,
+ 2725, 2813, 2897, 2977, 3053, 3123, 3189, 3249, 3305, 3355,
+ 3399, 3437, 3469, 3495, 3515, 3529, 3535, 3536, 0, 1,
+ 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
+ 415, 487, 563, 645, 731, 821, 915, 1011, 1111, 1213,
+ 1317, 1423, 1531, 1641, 1751, 1863, 1975, 2087, 2197, 2307,
+ 2415, 2521, 2625, 2727, 2827, 2923, 3017, 3107, 3193, 3275,
+ 3351, 3423, 3489, 3551, 3607, 3657, 3701, 3739, 3771, 3797,
+ 3817, 3831, 3837, 3838, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 285, 345, 411, 481, 557, 637,
+ 721, 809, 901, 997, 1097, 1199, 1305, 1413, 1523, 1635,
+ 1749, 1863, 1979, 2095, 2211, 2327, 2443, 2557, 2671, 2783,
+ 2893, 3001, 3107, 3209, 3309, 3405, 3497, 3585, 3669, 3749,
+ 3825, 3895, 3961, 4021, 4075, 4125, 4169, 4207, 4239, 4265,
+ 4285, 4299, 4305, 4306, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 347, 413, 485, 561, 643,
+ 729, 819, 913, 1011, 1113, 1217, 1325, 1435, 1547, 1663,
+ 1779, 1897, 2017, 2137, 2257, 2377, 2497, 2617, 2737, 2855,
+ 2971, 3087, 3199, 3309, 3417, 3521, 3623, 3721, 3815, 3905,
+ 3991, 4073, 4149, 4221, 4287, 4347, 4403, 4453, 4497, 4535,
+ 4567, 4593, 4613, 4627, 4633, 4634, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 415, 487,
+ 565, 647, 733, 825, 921, 1021, 1125, 1231, 1341, 1453,
+ 1569, 1687, 1807, 1929, 2051, 2175, 2299, 2425, 2551, 2677,
+ 2801, 2925, 3047, 3169, 3289, 3407, 3523, 3635, 3745, 3851,
+ 3955, 4055, 4151, 4243, 4329, 4411, 4489, 4561, 4627, 4689,
+ 4745, 4795, 4839, 4877, 4909, 4935, 4955, 4969, 4975, 4976,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 489, 567, 649, 737, 829, 925, 1025,
+ 1129, 1237, 1349, 1463, 1581, 1701, 1823, 1947, 2073, 2201,
+ 2329, 2459, 2589, 2719, 2849, 2979, 3107, 3235, 3361, 3485,
+ 3607, 3727, 3845, 3959, 4071, 4179, 4283, 4383, 4479, 4571,
+ 4659, 4741, 4819, 4891, 4959, 5021, 5077, 5127, 5171, 5209,
+ 5241, 5267, 5287, 5301, 5307, 5308, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 489,
+ 567, 651, 739, 831, 929, 1031, 1137, 1247, 1361, 1477,
+ 1597, 1719, 1843, 1969, 2097, 2227, 2359, 2491, 2625, 2759,
+ 2893, 3027, 3161, 3293, 3425, 3555, 3683, 3809, 3933, 4055,
+ 4175, 4291, 4405, 4515, 4621, 4723, 4821, 4913, 5001, 5085,
+ 5163, 5235, 5303, 5365, 5421, 5471, 5515, 5553, 5585, 5611,
+ 5631, 5645, 5651, 5652, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 569, 653,
+ 741, 835, 933, 1035, 1141, 1251, 1365, 1483, 1603, 1727,
+ 1853, 1983, 2115, 2249, 2383, 2519, 2657, 2795, 2933, 3071,
+ 3209, 3347, 3485, 3621, 3755, 3889, 4021, 4151, 4277, 4401,
+ 4521, 4639, 4753, 4863, 4969, 5071, 5169, 5263, 5351, 5435,
+ 5513, 5587, 5655, 5717, 5773, 5823, 5867, 5905, 5937, 5963,
+ 5983, 5997, 6003, 6004, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 569, 653,
+ 741, 835, 933, 1037, 1145, 1257, 1373, 1491, 1613, 1739,
+ 1867, 1997, 2131, 2267, 2405, 2543, 2683, 2825, 2967, 3109,
+ 3251, 3393, 3535, 3677, 3817, 3955, 4093, 4229, 4363, 4493,
+ 4621, 4747, 4869, 4987, 5103, 5215, 5323, 5427, 5525, 5619,
+ 5707, 5791, 5869, 5943, 6011, 6073, 6129, 6179, 6223, 6261,
+ 6293, 6319, 6339, 6353, 6359, 6360, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 569, 653, 743, 837, 935, 1039, 1147, 1259, 1375, 1495,
+ 1619, 1745, 1875, 2007, 2143, 2281, 2421, 2563, 2705, 2849,
+ 2993, 3139, 3285, 3431, 3577, 3723, 3867, 4011, 4153, 4295,
+ 4435, 4573, 4709, 4841, 4971, 5097, 5221, 5341, 5457, 5569,
+ 5677, 5781, 5879, 5973, 6063, 6147, 6225, 6299, 6367, 6429,
+ 6485, 6535, 6579, 6617, 6649, 6675, 6695, 6709, 6715, 6716,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 491, 569, 653, 743, 837, 937, 1041,
+ 1149, 1261, 1377, 1497, 1621, 1749, 1879, 2013, 2149, 2287,
+ 2429, 2573, 2717, 2863, 3011, 3159, 3309, 3459, 3609, 3759,
+ 3909, 4057, 4205, 4351, 4495, 4639, 4781, 4919, 5055, 5189,
+ 5319, 5447, 5571, 5691, 5807, 5919, 6027, 6131, 6231, 6325,
+ 6415, 6499, 6577, 6651, 6719, 6781, 6837, 6887, 6931, 6969,
+ 7001, 7027, 7047, 7061, 7067, 7068, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 569, 653, 743, 837, 937, 1041, 1149, 1261, 1377, 1497,
+ 1621, 1749, 1881, 2015, 2153, 2293, 2435, 2579, 2725, 2873,
+ 3023, 3175, 3327, 3479, 3633, 3787, 3941, 4093, 4245, 4397,
+ 4547, 4695, 4841, 4985, 5127, 5267, 5405, 5539, 5671, 5799,
+ 5923, 6043, 6159, 6271, 6379, 6483, 6583, 6677, 6767, 6851,
+ 6929, 7003, 7071, 7133, 7189, 7239, 7283, 7321, 7353, 7379,
+ 7399, 7413, 7419, 7420, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 489, 567, 651,
+ 741, 835, 935, 1039, 1147, 1259, 1377, 1499, 1625, 1753,
+ 1885, 2021, 2159, 2301, 2445, 2591, 2739, 2889, 3041, 3195,
+ 3349, 3505, 3661, 3817, 3973, 4129, 4285, 4441, 4595, 4749,
+ 4901, 5051, 5199, 5345, 5489, 5631, 5769, 5905, 6037, 6165,
+ 6291, 6413, 6531, 6643, 6751, 6855, 6955, 7049, 7139, 7223,
+ 7301, 7373, 7441, 7503, 7559, 7609, 7653, 7691, 7723, 7749,
+ 7769, 7783, 7789, 7790, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 945, 1051, 1161, 1277, 1397, 1521, 1649, 1781,
+ 1915, 2053, 2195, 2339, 2485, 2635, 2787, 2941, 3095, 3251,
+ 3409, 3567, 3725, 3885, 4045, 4205, 4363, 4521, 4679, 4835,
+ 4989, 5143, 5295, 5445, 5591, 5735, 5877, 6015, 6149, 6281,
+ 6409, 6533, 6653, 6769, 6879, 6985, 7087, 7183, 7273, 7359,
+ 7439, 7513, 7581, 7643, 7699, 7749, 7793, 7831, 7863, 7889,
+ 7909, 7923, 7929, 7930, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 943, 1049, 1159, 1273, 1393, 1517, 1645, 1777,
+ 1913, 2051, 2193, 2337, 2485, 2635, 2787, 2941, 3097, 3255,
+ 3415, 3575, 3737, 3899, 4061, 4223, 4385, 4547, 4709, 4869,
+ 5029, 5187, 5343, 5497, 5649, 5799, 5947, 6091, 6233, 6371,
+ 6507, 6639, 6767, 6891, 7011, 7125, 7235, 7341, 7441, 7537,
+ 7627, 7713, 7793, 7867, 7935, 7997, 8053, 8103, 8147, 8185,
+ 8217, 8243, 8263, 8277, 8283, 8284, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 571, 655, 745, 841, 941, 1047, 1157, 1271, 1389, 1513,
+ 1641, 1773, 1907, 2045, 2187, 2331, 2479, 2629, 2783, 2939,
+ 3097, 3257, 3417, 3579, 3743, 3907, 4071, 4235, 4399, 4563,
+ 4727, 4891, 5055, 5217, 5377, 5537, 5695, 5851, 6005, 6155,
+ 6303, 6447, 6589, 6727, 6861, 6993, 7121, 7245, 7363, 7477,
+ 7587, 7693, 7793, 7889, 7979, 8063, 8143, 8217, 8285, 8347,
+ 8403, 8453, 8497, 8535, 8567, 8593, 8613, 8627, 8633, 8634,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 491, 571, 657, 749, 845, 947, 1053,
+ 1165, 1281, 1401, 1527, 1657, 1791, 1929, 2069, 2213, 2361,
+ 2511, 2663, 2819, 2977, 3137, 3299, 3463, 3627, 3793, 3959,
+ 4125, 4293, 4461, 4629, 4795, 4961, 5127, 5291, 5455, 5617,
+ 5777, 5935, 6091, 6243, 6393, 6541, 6685, 6825, 6963, 7097,
+ 7227, 7353, 7473, 7589, 7701, 7807, 7909, 8005, 8097, 8183,
+ 8263, 8337, 8405, 8467, 8523, 8573, 8617, 8655, 8687, 8713,
+ 8733, 8747, 8753, 8754, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 943, 1049, 1159, 1275, 1395, 1519, 1647, 1779,
+ 1915, 2055, 2199, 2345, 2495, 2647, 2803, 2961, 3121, 3283,
+ 3447, 3613, 3779, 3947, 4115, 4285, 4455, 4625, 4795, 4965,
+ 5133, 5301, 5467, 5633, 5797, 5959, 6119, 6277, 6433, 6585,
+ 6735, 6881, 7025, 7165, 7301, 7433, 7561, 7685, 7805, 7921,
+ 8031, 8137, 8237, 8333, 8423, 8509, 8589, 8663, 8731, 8793,
+ 8849, 8899, 8943, 8981, 9013, 9039, 9059, 9073, 9079, 9080,
+ 0, 1, 7, 19, 39, 65, 97, 135, 179, 229,
+ 285, 347, 415, 489, 567, 651, 741, 835, 935, 1041,
+ 1151, 1265, 1385, 1509, 1637, 1769, 1905, 2045, 2189, 2335,
+ 2485, 2637, 2793, 2951, 3111, 3273, 3437, 3603, 3771, 3939,
+ 4109, 4279, 4451, 4623, 4795, 4967, 5139, 5309, 5479, 5647,
+ 5815, 5981, 6145, 6307, 6467, 6625, 6781, 6933, 7083, 7229,
+ 7373, 7513, 7649, 7781, 7909, 8033, 8153, 8267, 8377, 8483,
+ 8583, 8677, 8767, 8851, 8929, 9003, 9071, 9133, 9189, 9239,
+ 9283, 9321, 9353, 9379, 9399, 9411, 9417, 9418, 0, 1,
+ 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
+ 417, 491, 571, 657, 747, 843, 945, 1051, 1163, 1279,
+ 1399, 1525, 1655, 1789, 1927, 2069, 2213, 2361, 2513, 2667,
+ 2825, 2985, 3147, 3311, 3477, 3645, 3815, 3985, 4157, 4329,
+ 4503, 4677, 4851, 5025, 5199, 5371, 5543, 5713, 5883, 6051,
+ 6217, 6381, 6543, 6703, 6861, 7015, 7167, 7315, 7459, 7601,
+ 7739, 7873, 8003, 8129, 8249, 8365, 8477, 8583, 8685, 8781,
+ 8871, 8957, 9037, 9111, 9179, 9241, 9297, 9347, 9391, 9429,
+ 9461, 9487, 9507, 9521, 9527, 9528, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 571, 657, 749, 845, 947, 1055, 1167, 1285, 1407, 1533,
+ 1663, 1797, 1935, 2077, 2223, 2373, 2525, 2681, 2839, 3001,
+ 3165, 3331, 3499, 3669, 3839, 4011, 4185, 4359, 4533, 4709,
+ 4885, 5061, 5235, 5409, 5583, 5755, 5925, 6095, 6263, 6429,
+ 6593, 6755, 6913, 7069, 7221, 7371, 7517, 7659, 7797, 7931,
+ 8061, 8187, 8309, 8427, 8539, 8647, 8749, 8845, 8937, 9023,
+ 9103, 9177, 9245, 9307, 9363, 9413, 9457, 9495, 9527, 9553,
+ 9573, 9587, 9593, 9594, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 655,
+ 745, 841, 941, 1047, 1157, 1273, 1393, 1517, 1647, 1781,
+ 1919, 2061, 2207, 2355, 2507, 2663, 2821, 2981, 3145, 3311,
+ 3479, 3649, 3821, 3993, 4167, 4341, 4517, 4693, 4869, 5045,
+ 5221, 5397, 5573, 5747, 5921, 6093, 6265, 6435, 6603, 6769,
+ 6933, 7093, 7251, 7407, 7559, 7707, 7853, 7995, 8133, 8267,
+ 8397, 8521, 8641, 8757, 8867, 8973, 9073, 9169, 9259, 9343,
+ 9423, 9497, 9565, 9627, 9683, 9733, 9777, 9815, 9847, 9873,
+ 9893, 9907, 9913, 9914, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 945, 1051, 1163, 1279, 1401, 1527, 1657, 1791,
+ 1929, 2071, 2217, 2367, 2519, 2675, 2835, 2997, 3161, 3327,
+ 3495, 3665, 3837, 4011, 4185, 4361, 4537, 4715, 4893, 5071,
+ 5249, 5427, 5603, 5779, 5953, 6127, 6299, 6469, 6637, 6803,
+ 6967, 7129, 7289, 7445, 7597, 7747, 7893, 8035, 8173, 8307,
+ 8437, 8563, 8685, 8801, 8913, 9019, 9121, 9217, 9307, 9393,
+ 9473, 9547, 9615, 9677, 9733, 9783, 9827, 9865, 9897, 9923,
+ 9943, 9957, 9963, 9964, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 749, 845, 947, 1055, 1167, 1285, 1407, 1533, 1663, 1799,
+ 1939, 2083, 2229, 2379, 2533, 2689, 2849, 3011, 3177, 3345,
+ 3515, 3687, 3861, 4035, 4211, 4387, 4565, 4743, 4921, 5099,
+ 5277, 5455, 5633, 5809, 5985, 6159, 6333, 6505, 6675, 6843,
+ 7009, 7171, 7331, 7487, 7641, 7791, 7937, 8081, 8221, 8357,
+ 8487, 8613, 8735, 8853, 8965, 9073, 9175, 9271, 9363, 9449,
+ 9529, 9603, 9671, 9733, 9789, 9839, 9883, 9921, 9953, 9979,
+ 9999, 10013, 10019, 10020, 0, 1, 7, 19, 39, 65,
+ 97, 135, 179, 229, 285, 347, 415, 489, 567, 651,
+ 741, 837, 937, 1043, 1153, 1269, 1389, 1513, 1643, 1777,
+ 1915, 2057, 2203, 2351, 2503, 2659, 2817, 2979, 3143, 3309,
+ 3477, 3647, 3819, 3993, 4169, 4345, 4523, 4701, 4881, 5061,
+ 5241, 5421, 5601, 5779, 5957, 6133, 6309, 6483, 6655, 6825,
+ 6993, 7159, 7323, 7485, 7643, 7799, 7951, 8099, 8245, 8387,
+ 8525, 8659, 8789, 8913, 9033, 9149, 9259, 9365, 9465, 9561,
+ 9651, 9735, 9813, 9887, 9955, 10017, 10073, 10123, 10167, 10205,
+ 10237, 10263, 10283, 10295, 10301, 10302, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 571, 655, 745, 841, 941, 1047, 1159, 1275, 1395, 1521,
+ 1651, 1785, 1923, 2065, 2211, 2361, 2513, 2669, 2829, 2991,
+ 3155, 3321, 3491, 3663, 3837, 4011, 4187, 4365, 4543, 4723,
+ 4903, 5083, 5263, 5443, 5623, 5803, 5981, 6159, 6335, 6509,
+ 6683, 6855, 7025, 7191, 7355, 7517, 7677, 7833, 7985, 8135,
+ 8281, 8423, 8561, 8695, 8825, 8951, 9071, 9187, 9299, 9405,
+ 9505, 9601, 9691, 9775, 9855, 9929, 9997, 10059, 10115, 10165,
+ 10209, 10247, 10279, 10305, 10325, 10339, 10345, 10346, 0, 1,
+ 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
+ 417, 491, 571, 655, 745, 841, 943, 1049, 1161, 1277,
+ 1397, 1523, 1653, 1787, 1925, 2067, 2213, 2363, 2517, 2673,
+ 2833, 2995, 3159, 3327, 3497, 3669, 3843, 4019, 4195, 4373,
+ 4551, 4731, 4911, 5091, 5271, 5451, 5631, 5811, 5989, 6167,
+ 6343, 6519, 6693, 6865, 7035, 7203, 7367, 7529, 7689, 7845,
+ 7999, 8149, 8295, 8437, 8575, 8709, 8839, 8965, 9085, 9201,
+ 9313, 9419, 9521, 9617, 9707, 9791, 9871, 9945, 10013, 10075,
+ 10131, 10181, 10225, 10263, 10295, 10321, 10341, 10355, 10361, 10362,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 491, 571, 657, 747, 843, 945, 1051,
+ 1163, 1279, 1399, 1525, 1655, 1789, 1927, 2069, 2215, 2365,
+ 2519, 2675, 2835, 2997, 3161, 3329, 3499, 3671, 3845, 4021,
+ 4197, 4375, 4553, 4733, 4913, 5093, 5273, 5453, 5633, 5813,
+ 5991, 6169, 6345, 6521, 6695, 6867, 7037, 7205, 7369, 7531,
+ 7691, 7847, 8001, 8151, 8297, 8439, 8577, 8711, 8841, 8967,
+ 9087, 9203, 9315, 9421, 9523, 9619, 9709, 9795, 9875, 9949,
+ 10017, 10079, 10135, 10185, 10229, 10267, 10299, 10325, 10345, 10359,
+ 10365, 10366
+};
+
+const Word16 ivas_pca_offset_n2[IVAS_PCA_N1] =
+{
+ 0, 2, 6, 14, 24, 38, 56, 76, 100, 126, 156, 188,
+ 224, 262, 302, 346, 392, 442, 494, 548, 604, 664, 726, 790,
+ 856, 924, 994, 1066, 1140, 1216, 1294, 1374, 1454, 1536, 1620, 1704,
+ 1790, 1878, 1966, 2054, 2144, 2234, 2324, 2416, 2508, 2600, 2692, 2784,
+ 2876, 2968, 3058, 3148, 3238, 3326, 3414, 3502, 3588, 3672, 3756, 3838,
+ 3918, 3998, 4076, 4152, 4226, 4298, 4368, 4436, 4502, 4566, 4628, 4688,
+ 4744, 4798, 4850, 4900, 4946, 4990, 5030, 5068, 5104, 5136, 5166, 5192,
+ 5216, 5236, 5254, 5268, 5278, 5286, 5290
+};
+
+const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2] = { /* ph1_q : Q13, n2 : Q0 */
+ { 0, 1 },
+ { 286, 3 },
+ { 572, 7 },
+ { 858, 9 },
+ { 1144, 13 },
+ { 1430, 17 },
+ { 1716, 19 },
+ { 2002, 23 },
+ { 2288, 25 },
+ { 2574, 29 },
+ { 2860, 31 },
+ { 3146, 35 },
+ { 3431, 37 },
+ { 3717, 39 },
+ { 4003, 43 },
+ { 4289, 45 },
+ { 4575, 49 },
+ { 4861, 51 },
+ { 5147, 53 },
+ { 5433, 55 },
+ { 5719, 59 },
+ { 6005, 61 },
+ { 6291, 63 },
+ { 6577, 65 },
+ { 6863, 67 },
+ { 7149, 69 },
+ { 7435, 71 },
+ { 7721, 73 },
+ { 8007, 75 },
+ { 8293, 77 },
+ { 8579, 79 },
+ { 8865, 79 },
+ { 9151, 81 },
+ { 9437, 83 },
+ { 9722, 83 },
+ { 10008, 85 },
+ { 10294, 87 },
+ { 10580, 87 },
+ { 10866, 87 },
+ { 11152, 89 },
+ { 11438, 89 },
+ { 11724, 89 },
+ { 12010, 91 },
+ { 12296, 91 },
+ { 12582, 91 },
+ { 12868, 91 },
+ { 13154, 91 },
+ { 13440, 91 },
+ { 13726, 91 },
+ { 14012, 89 },
+ { 14298, 89 },
+ { 14584, 89 },
+ { 14870, 87 },
+ { 15156, 87 },
+ { 15442, 87 },
+ { 15728, 85 },
+ { 16013, 83 },
+ { 16299, 83 },
+ { 16585, 81 },
+ { 16871, 79 },
+ { 17157, 79 },
+ { 17443, 77 },
+ { 17729, 75 },
+ { 18015, 73 },
+ { 18301, 71 },
+ { 18587, 69 },
+ { 18873, 67 },
+ { 19159, 65 },
+ { 19445, 63 },
+ { 19731, 61 },
+ { 20017, 59 },
+ { 20303, 55 },
+ { 20589, 53 },
+ { 20875, 51 },
+ { 21161, 49 },
+ { 21447, 45 },
+ { 21733, 43 },
+ { 22019, 39 },
+ { 22304, 37 },
+ { 22590, 35 },
+ { 22876, 31 },
+ { 23162, 29 },
+ { 23448, 25 },
+ { 23734, 23 },
+ { 24020, 19 },
+ { 24306, 17 },
+ { 24592, 13 },
+ { 24878, 9 },
+ { 25164, 7 },
+ { 25450, 3 },
+ { 25736, 1 }
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Parametric MC ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const Word16 param_mc_band_grouping_20[20 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 23, 27, 33, 40, 52, 60
+};
+
+const Word16 param_mc_coding_band_mapping_20[20] =
+{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+const Word16 param_mc_bands_coded_20[4] =
+{
+ 10, 14, 18, 20
+};
+
+const Word16 param_mc_band_grouping_14[14 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 28, 40, 60
+};
+
+const Word16 param_mc_coding_band_mapping_14[14] =
+{
+ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
+};
+
+const Word16 param_mc_bands_coded_14[4] =
+{
+ 8, 11, 13, 14
+};
+
+const Word16 param_mc_band_grouping_10[10 + 1] =
+{
+ 0, 1, 2, 3, 5, 7, 10, 14, 20, 40, 60
+};
+
+
+const Word16 param_mc_bands_coded_10[4] =
+{
+ 6, 8, 9, 10
+};
+
+const Word16 param_mc_coding_band_mapping_10[10] =
+{
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
+};
+
+const Word16 Param_MC_index[MAX_CICP_CHANNELS] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+};
+
+const Word32 ivas_param_mc_dmx_fac_CICP6_2tc_fx[12] =
+{
+ 2147483647,0,1518500224,1518500224,2147483647,0, /*Lt*/
+ 0,2147483647,1518500224,1518500224,0,2147483647 /*Rt*/
+};
+
+const Word32 ivas_param_mc_dmx_fac_CICP12_2tc_fx[16] =
+{
+ 2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0, /*Lt*/
+ 0,2147483647,1518500224,1518500224,0,2147483647,0,2147483647 /*Rt*/
+};
+
+const Word32 ivas_param_mc_dmx_fac_CICP12_3tc_fx[24] =
+{
+ 2147483647,0,0,0,2147483647,0,2147483647,0, /*Lt*/
+ 0,2147483647,0,0,0,2147483647,0,2147483647, /*Rt*/
+ 0,0,2147483647,2147483647,0,0,0,0 /*Ct*/
+};
+
+const Word32 ivas_param_mc_dmx_fac_CICP14_2tc_fx[16] =
+{
+ 2147483647,0,1518500224,1518500224,2147483647,0,2147483647,0, /*Lt*/
+ 0,2147483647,1518500224,1518500224,0,2147483647,0,2147483647 /*Rt*/
+};
+const Word32 ivas_param_mc_dmx_fac_CICP14_3tc_fx[24] =
+{
+ 2147483647,0,0,0,2147483647,0,2147483647,0, /*Lt*/
+ 0,2147483647,0,0,0,2147483647,0,2147483647, /*Rt*/
+ 0,0,2147483647,2147483647,0,0,0,0 /*Ct*/
+};
+
+const Word32 ivas_param_mc_dmx_fac_CICP16_3tc_fx[30] =
+{
+ 2147483647,0,0,0,2147483647,0,2147483647,0,2147483647,0, /*Lt*/
+ 0,2147483647,0,0,0,2147483647,0,2147483647,0,2147483647, /*Rt*/
+ 0,0,2147483647,2147483647,0,0,0,0,0,0 /*Ct*/
+};
+
+const Word32 ivas_param_mc_dmx_fac_CICP19_3tc_fx[36] =
+{
+ 2147483647,0,0,0,2147483647,0,2147483647,0,2147483647,0,2147483647,0, /*Lt*/
+ 0,2147483647,0,0,0,2147483647,0,2147483647,0,2147483647,0,2147483647, /*Rt*/
+ 0,0,2147483647,2147483647,0,0,0,0,0,0,0,0 /*Ct*/
+};
+
+//Q15
+const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] =
+{
+ 12832,
+ 12832,
+ 6820,
+ 10607,
+ 10607,
+ 6820
+};
+
+//Q15
+const Word16 ivas_param_mc_ild_fac_CICP12_2tc_fx[8] =
+{
+ 11965,
+ 11965,
+ 6816,
+ 6877,
+ 6877,
+ 5619,
+ 5619,
+ 6816
+};
+
+//Q15
+const Word16 ivas_param_mc_ild_fac_CICP12_3tc_fx[8] =
+{
+ 16384,
+ 16384,
+ 9502,
+ 9502,
+ 6553,
+ 6553,
+ 32767,
+ 8192
+};
+
+//Q15
+const Word16 ivas_param_mc_ild_fac_CICP14_2tc_fx[8] =
+{
+ 11936,
+ 11936,
+ 5993,
+ 6945,
+ 6945,
+ 8049,
+ 8049,
+ 6816
+};
+
+//Q15
+const Word16 ivas_param_mc_ild_fac_CICP14_3tc_fx[8] =
+{
+ 16291,
+ 16291,
+ 8257,
+ 8257,
+ 9666,
+ 9666,
+ 32767,
+ 8192
+};
+
+//Q15
+const Word16 ivas_param_mc_ild_fac_CICP16_3tc_fx[10] =
+{
+ 11141,
+ 11141,
+ 7209,
+ 7209,
+ 6553,
+ 6553,
+ 5898,
+ 5898,
+ 32767,
+ 8192
+};
+
+//Q15
+const Word16 ivas_param_mc_ild_fac_CICP19_3tc_fx[12] =
+{
+ 9830,
+ 9830,
+ 5570,
+ 5570,
+ 3932,
+ 3932,
+ 6226,
+ 6226,
+ 6226,
+ 6226,
+ 32767,
+ 16384
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc =
+{
+ 5,
+ 6,
+ {0,1,2,4,5,3},
+ {1,1,2,1,1,2},
+ {{0},{1},{0,1},{0},{1},{0,1}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP12_2tc =
+{
+ 7,
+ 8,
+ {0,1,2,4,5,6,7,3},
+ {1,1,2,1,1,1,1,2},
+ {{0},{1},{0,1},{0},{1},{0},{1},{0,1}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP12_3tc =
+{
+ 6,
+ 8,
+ {0,1,4,5,6,7,2,3},
+ {1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP14_2tc =
+{
+ 7,
+ 8,
+ {0,1,2,4,5,6,7,3},
+ {1,1,2,1,1,1,1,2},
+ {{0},{1},{0,1},{0},{1},{0},{1},{0,1}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP14_3tc =
+{
+ 6,
+ 8,
+ {0,1,4,5,6,7,2,3},
+ {1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP16_3tc =
+{
+ 8,
+ 10,
+ {0,1,4,5,6,7,8,9,2,3},
+ {1,1,1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_3tc =
+{
+ 10,
+ 12,
+ {0,1,4,5,6,7,8,9,10,11,2,3},
+ {1,1,1,1,1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP6_2tc =
+{
+ 4,
+ 5,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 2, 3 }} /* C/LFE */
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP12_2tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 2, 6 }, /* C/BLS */
+ { 2, 7 }, /* C/BRS */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP12_3tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/BLS */
+ { 1, 7 }, /* R/BRS */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP14_2tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 2, 6 }, /* C/UFL */
+ { 2, 7 }, /* C/UFR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP14_3tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/UFL */
+ { 1, 7 }, /* R/UFR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP16_3tc =
+{
+ 8,
+ 9,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/UFL */
+ { 1, 7 }, /* R/UFR */
+ { 4, 8 }, /* LS/UBL */
+ { 5, 9 }, /* RS/UBR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_3tc =
+{
+ 10,
+ 11,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/LBS */
+ { 1, 7 }, /* R/RBS */
+ { 0, 8 }, /* L/UFL */
+ { 1, 9 }, /* R/UFR */
+ { 6, 10 }, /* LBS/UBL */
+ { 7, 11 }, /* RBS/UBR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
+{
+ /* CICP6 48000 */
+ {
+ MC_LS_SETUP_5_1,
+ 6,
+ 2,
+ IVAS_48k,
+ &ivas_param_mc_ild_mapping_CICP6_2tc,
+ &ivas_param_mc_icc_mapping_CICP6_2tc,
+ &ivas_param_mc_ild_fac_CICP6_2tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP6_2tc_fx[0]
+ },
+ /* CICP6 64000 */
+ {
+ MC_LS_SETUP_5_1,
+ 6,
+ 2,
+ IVAS_64k,
+ &ivas_param_mc_ild_mapping_CICP6_2tc,
+ &ivas_param_mc_icc_mapping_CICP6_2tc,
+ &ivas_param_mc_ild_fac_CICP6_2tc_fx[0],
+ & ivas_param_mc_dmx_fac_CICP6_2tc_fx[0]
+ },
+ /* CICP6 80000 */
+ {
+ MC_LS_SETUP_5_1,
+ 6,
+ 2,
+ IVAS_80k,
+ &ivas_param_mc_ild_mapping_CICP6_2tc,
+ &ivas_param_mc_icc_mapping_CICP6_2tc,
+ &ivas_param_mc_ild_fac_CICP6_2tc_fx[0],
+ & ivas_param_mc_dmx_fac_CICP6_2tc_fx[0]
+ },
+ /* CICP12 48000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 2,
+ IVAS_48k,
+ &ivas_param_mc_ild_mapping_CICP12_2tc,
+ &ivas_param_mc_icc_mapping_CICP12_2tc,
+ &ivas_param_mc_ild_fac_CICP12_2tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP12_2tc_fx[0]
+ },
+ /* CICP12 64000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 2,
+ IVAS_64k,
+ &ivas_param_mc_ild_mapping_CICP12_2tc,
+ &ivas_param_mc_icc_mapping_CICP12_2tc,
+ &ivas_param_mc_ild_fac_CICP12_2tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP12_2tc_fx[0]
+ },
+ /* CICP12 80000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 2,
+ IVAS_80k,
+ &ivas_param_mc_ild_mapping_CICP12_2tc,
+ &ivas_param_mc_icc_mapping_CICP12_2tc,
+ &ivas_param_mc_ild_fac_CICP12_2tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP12_2tc_fx[0],
+ },
+ /* CICP12 96000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 3,
+ IVAS_96k,
+ &ivas_param_mc_ild_mapping_CICP12_3tc,
+ &ivas_param_mc_icc_mapping_CICP12_3tc,
+ &ivas_param_mc_ild_fac_CICP12_3tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP12_3tc_fx[0]
+ },
+ /* CICP14 48000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 2,
+ IVAS_48k,
+ &ivas_param_mc_ild_mapping_CICP14_2tc,
+ &ivas_param_mc_icc_mapping_CICP14_2tc,
+ &ivas_param_mc_ild_fac_CICP14_2tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP14_2tc_fx[0]
+ },
+ /* CICP14 64000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 2,
+ IVAS_64k,
+ &ivas_param_mc_ild_mapping_CICP14_2tc,
+ &ivas_param_mc_icc_mapping_CICP14_2tc,
+ &ivas_param_mc_ild_fac_CICP14_2tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP14_2tc_fx[0]
+ },
+ /* CICP14 80000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 2,
+ IVAS_80k,
+ &ivas_param_mc_ild_mapping_CICP14_2tc,
+ &ivas_param_mc_icc_mapping_CICP14_2tc,
+ &ivas_param_mc_ild_fac_CICP14_2tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP14_2tc_fx[0]
+ },
+ /* CICP14 96000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 3,
+ IVAS_96k,
+ &ivas_param_mc_ild_mapping_CICP14_3tc,
+ &ivas_param_mc_icc_mapping_CICP14_3tc,
+ &ivas_param_mc_ild_fac_CICP14_3tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP14_3tc_fx[0]
+ },
+ /* CICP16 96000 */
+ {
+ MC_LS_SETUP_5_1_4,
+ 10,
+ 3,
+ IVAS_96k,
+ &ivas_param_mc_ild_mapping_CICP16_3tc,
+ &ivas_param_mc_icc_mapping_CICP16_3tc,
+ &ivas_param_mc_ild_fac_CICP16_3tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP16_3tc_fx[0]
+ },
+ /* CICP16 128000 */
+ {
+ MC_LS_SETUP_5_1_4,
+ 10,
+ 3,
+ IVAS_128k,
+ &ivas_param_mc_ild_mapping_CICP16_3tc,
+ &ivas_param_mc_icc_mapping_CICP16_3tc,
+ &ivas_param_mc_ild_fac_CICP16_3tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP16_3tc_fx[0]
+ },
+ /* CICP19 128000 */
+ {
+ MC_LS_SETUP_7_1_4,
+ 12,
+ 3,
+ IVAS_128k,
+ &ivas_param_mc_ild_mapping_CICP19_3tc,
+ &ivas_param_mc_icc_mapping_CICP19_3tc,
+ &ivas_param_mc_ild_fac_CICP19_3tc_fx[0],
+ &ivas_param_mc_dmx_fac_CICP19_3tc_fx[0]
+ }
+};
+
+
+/* Alphabet for delta coding for the ICCs in Parametric MC processing */
+const UWord16 ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 24, 224, 20873, 42384, 51699, 57122, 60572, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 24, 200, 20649, 21511, 9315, 5423, 3450, 4963
+};
+
+const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 4, 9, 124, 447, 1311, 4453, 18116, 48636, 60573, 63692, 64746, 65327, 65531, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 4, 5, 115, 323, 864, 3142, 13663, 30520, 11937, 3119, 1054, 581, 204, 3, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 30, 848, 26611, 47846, 57358, 61679, 63237, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 30, 818, 25763, 21235, 9512, 4321, 1558, 2298
+};
+
+const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 2, 7, 53, 243, 979, 3994, 16732, 49642, 61343, 64331, 65158, 65438, 65532, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 2, 5, 46, 190, 736, 3015, 12738, 32910, 11701, 2988, 827, 280, 94, 2, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 46, 826, 27798, 49552, 58447, 62046, 63284, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER ]={
+ 46, 780, 26972, 21754, 8895, 3599, 1238, 2251
+};
+
+const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 3, 8, 36, 172, 763, 3436, 15845, 50168, 62005, 64676, 65298, 65481, 65533, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2* PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 3, 5, 28, 136, 591, 2673, 12409, 34323, 11837, 2671, 622, 183, 52, 1, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 34, 552, 24717, 45819, 54772, 59054, 61166, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 34, 518, 24165, 21102, 8953, 4282, 2112, 4369
+};
+
+const UWord16 ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 3, 7, 74, 304, 1009, 3870, 16502, 49834, 61384, 64217, 65020, 65369, 65531, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 3, 4, 67, 230, 705, 2861, 12632, 33332, 11550, 2833, 803, 349, 162, 3, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
+{
+ 0, 1092, 5574, 8315, 10652, 13875, 19656, 27664, 36284, 47058, 56251, 62579, 65118, 65462, 65513, 65532, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 1092, 4482, 2741, 2337, 3223, 5781, 8008, 8620, 10774, 9193, 6328, 2539, 344, 51, 19, 3
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 5, 38, 146, 352, 638, 997, 1559, 2323, 3570, 5859, 10556, 21075, 44682, 55617, 60408, 62739, 63833, 64443, 64809, 65074, 65279, 65400, 65484, 65531, 65532, 65533, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 2, 33, 108, 206, 286, 359, 562, 764, 1247, 2289, 4697, 10519, 23607, 10935, 4791, 2331, 1094, 610, 366, 265, 205, 121, 84, 47, 1, 1, 1, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
+{
+ 0, 967, 6335, 9941, 12837, 16652, 22416, 29814, 38807, 48497, 57184, 62661, 64916, 65466, 65514, 65530, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 967, 5368, 3606, 2896, 3815, 5764, 7398, 8993, 9690, 8687, 5477, 2255, 550, 48, 16, 5
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 5, 18, 61, 149, 320, 592, 1083, 1793, 2974, 5257, 10133, 21274, 44342, 55891, 60895, 63174, 64244, 64793, 65100, 65287, 65406, 65477, 65517, 65531, 65532, 65533, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 2, 13, 43, 88, 171, 272, 491, 710, 1181, 2283, 4876, 11141, 23068, 11549, 5004, 2279, 1070, 549, 307, 187, 119, 71, 40, 14, 1, 1, 1, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
+{
+ 0, 229, 7068, 10910, 13856, 17467, 22629, 29174, 36906, 46558, 55579, 61802, 65222, 65505, 65527, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 229, 6839, 3842, 2946, 3611, 5162, 6545, 7732, 9652, 9021, 6223, 3420, 283, 22, 7, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 4, 12, 56, 153, 278, 475, 856, 1430, 2489, 4723, 9580, 20685, 45423, 56274, 60948, 63097, 64128, 64679, 65002, 65208, 65348, 65445, 65517, 65531, 65532, 65533, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 1, 8, 44, 97, 125, 197, 381, 574, 1059, 2234, 4857, 11105, 24738, 10851, 4674, 2149, 1031, 551, 323, 206, 140, 97, 72, 14, 1, 1, 1, 1
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS+1] =
+{
+ 0, 1453, 8326, 12221, 15164, 18764, 24177, 31297, 39520, 49154, 57135, 62460, 64821, 65468, 65514, 65530, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 1453, 6873, 3895, 2943, 3600, 5413, 7120, 8223, 9634, 7981, 5325, 2361, 647, 46, 16, 5
+};
+
+const UWord16 ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 5, 29, 98, 220, 414, 699, 1186, 1876, 3049, 5304, 10013, 20612, 45247, 56109, 60818, 63022, 64081, 64647, 64977, 65198, 65348, 65443, 65502, 65530, 65532, 65533, 65534, 65535
+};
+
+const UWord16 ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 2, 24, 69, 122, 194, 285, 487, 690, 1173, 2255, 4709, 10599, 24635, 10862, 4709, 2204, 1059, 566, 330, 221, 150, 95, 59, 28, 2, 1, 1, 1
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * MASA ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const UWord8 ivasmasaFormatDescriptor[8] =
+{
+ 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 /* "IVASMASA" */
+};
+
+const Word64 diffuseness_reconstructions_hr_fx[HR_MASA_ER_LEVELS] = { /* Q62 */
+ 0,
+ 65865144550293504,
+ 138485688541642752,
+ 239816680157478912,
+ 355502895585558528,
+ 485544334825881600,
+ 667940119734386688,
+ 902690250311073792,
+ 1225260573621485568,
+ 1635651089665622016,
+ 2011983133527769088,
+ 2354256705207926784,
+ 2741003323208368128,
+ 3172222987529093120,
+ 3693796119373938688,
+ 4305722718742904832,
+};
+
+const Word32 diffuseness_thresholds_hr_fx[HR_MASA_ER_LEVELS + 1] = { /* Q30 */
+ 0,
+ 10223616,
+ 20447232,
+ 44040192,
+ 67633152,
+ 97910784,
+ 128188416,
+ 182845440,
+ 237502464,
+ 333053952,
+ 428605440,
+ 508297216,
+ 587988992,
+ 688390144,
+ 788791296,
+ 931266560,
+ MAX_32 /* out-of-range large value to make searching easier */
+};
+
+const Word16 bits_direction_masa[DIRAC_DIFFUSE_LEVELS] =
+{
+ 11,
+ 11,
+ 10,
+ 9,
+ 7,
+ 6,
+ 5,
+ 3
+};
+
+const Word16 len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS] = { 7, 6, 5, 4, 4, 4, 3, 2 };
+
+const UWord8 sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] =
+{
+ 16, 99, 0, 0, 0, 0, 0, 0,
+ 12, 64, 167, 0, 0, 0, 0, 0,
+ 10, 45, 100, 218, 0, 0, 0, 0,
+ 8, 34, 70, 124, 235, 0, 0, 0,
+ 7, 27, 55, 90, 141, 242, 0, 0,
+ 7, 23, 45, 71, 105, 153, 247, 0,
+ 6, 20, 38, 60, 86, 119, 165, 249
+};
+
+const Word16 idx_cb_sur_coh_masa[MASA_MAX_NO_CV_SUR_COH] = { 0, 1, 2, 3, 4, 5, 5, 6 };
+
+const Word16 len_huf_masa[MASA_NO_CV_COH1] = { 4, 2, 1, 3, 4 };
+
+const Word16 huff_code_av_masa[MASA_NO_CV_COH1] = { 15, 2, 0, 6, 14 };
+
+const Word16 no_theta_masa[NO_SPHERICAL_GRIDS-2] = /* from 1 to 11 bits */
+{ /*1, 1,*/ 2 ,2 , 4, 5, 6, 7, 10, 14, 19
+ /*0, 2, 8, 6, 7, 12, 14, 16*/
+};
+
+const Word16 no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = /* from 1 to 11 bits*/
+{
+ { 2 },
+ { 4 },
+ { 4, 2 },
+ { 8, 4 }, /* 8, 4*/
+ { 12, 7, 2, 1 }, /* 12, */
+ { 14, 13, 9, 2, 1 },
+ { 22, 21, 17, 11, 3, 1 },
+ { 33, 32, 29, 23, 17, 9, 1 },
+ { 48, 47, 45, 41, 35, 28, 20, 12, 2, 1 },
+ { 60, 60, 58, 56, 54, 50, 46, 41, 36, 30, 23, 17, 10, 1 },
+ { 89, 89, 88, 86, 84, 81, 77, 73, 68, 63, 57, 51, 44, 38, 30, 23, 15, 8, 1 }
+};
+
+const Word16 MASA_band_grouping_24[24 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 40, 60
+};
+
+const Word16 MASA_band_mapping_24_to_18[18 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 21, 22, 23, 24
+};
+
+const Word16 MASA_band_mapping_24_to_12[12 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 7, 9, 12, 15, 20, 22, 24
+};
+
+const Word16 MASA_band_mapping_24_to_8[8 + 1] =
+{
+ 0, 1, 2, 3, 5, 8, 12, 20, 24
+};
+
+const Word16 MASA_band_mapping_24_to_5[5 + 1] =
+{
+ 0, 1, 3, 7, 15, 24
+};
+
+const Word16 MASA_grouping_8_to_5[8] =
+{
+ 0, 1, 1, 2, 3, 3, 4, 4
+};
+
+const Word16 MASA_grouping_12_to_5[12] =
+{
+ 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4
+};
+
+const Word16 MASA_grouping_18_to_5[18] =
+{
+ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4
+};
+
+const Word16 MASA_grouping_24_to_5[24] =
+{
+ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4
+};
+
+/* IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k, IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k, IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k */
+const Word16 masa_bits[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 50, 60, 70, 85, 140, 180, 220, 256, 350, 432, 528, 832, 1024, MASA_MAX_BITS
+};
+
+const Word16 masa_bits_LR_stereo[4] =
+{
+ 50, 50, 60, 70
+};
+
+const Word16 mcmasa_bits[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 50, 70, 80, 120, 140, 160, 220, 256, 288, 432, 528, 832, 1024, MASA_MAX_BITS
+};
+
+const UWord8 masa_nbands[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 18, 24, 24, 24
+};
+
+const UWord8 masa_joined_nbands[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 5, 5, 5, 8, 12, 12, 12, 18, 18, 18, 18, 24, 24, 24
+};
+
+const UWord8 masa_twodir_bands[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 24
+};
+
+const UWord8 masa_twodir_bands_joined[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 0, 0, 0, 0, 0, 2, 2, 3, 4, 6, 8, 9, 12, MASA_MAXIMUM_TWO_DIR_BANDS
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * OMASA ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const Word32 sep_object_brate[][MAX_NUM_OBJECTS] =
+{
+ {0, 0, 0, 0}, /* 13k2 */
+ {0, 0, 0, 0}, /* 16k4 */
+ {9600, 0, 0, 0}, /* 24k4 */
+ {IVAS_13k2, 0, 0, 0}, /* 32k */
+ {16000, 11000, 0, 0}, /* 48k */
+ {16000, 11700, 0, 0}, /* 64k */
+ {20000, 16000, 0, 0}, /* 80k */
+ {IVAS_32k, 20000, 20000, 0}, /* 96k */
+ {IVAS_32k, IVAS_24k4, 24000, 24000}, /* 128k */
+ {IVAS_48k, IVAS_32k, IVAS_24k4, 24000}, /* 160k */
+ {IVAS_64k, IVAS_48k, IVAS_32k, IVAS_24k4}, /* 192k */
+ {IVAS_96k, IVAS_64k, IVAS_48k, IVAS_32k}, /* 256k */
+ {IVAS_128k, IVAS_80k, IVAS_64k, IVAS_48k}, /* 384k */
+ {IVAS_128k, IVAS_96k, IVAS_80k, IVAS_64k} /* 512k */
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Param ISM ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const Word16 Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1] =
+{
+ 0, 1, 2, 3, 4, 6, 8, 11, 15, 21, 31, 60
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * LFE coding ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const ivas_lfe_freq_models ivas_str_lfe_freq_models =
+{
+ { 16384, 14924, 13463, 12003, 10542, 9082, 7622, 6161,
+ 4701, 4336, 3970, 3605, 3240, 2875, 2510, 2145,
+ 1780, 1689, 1597, 1506, 1415, 1323, 1232, 1141,
+ 1050, 1004, 958, 913, 867, 821, 776, 730,
+ 685, 639, 593, 548, 502, 456, 411, 365,
+ 319, 297, 274, 251, 228, 205, 183, 160,
+ 137, 126, 114, 103, 91, 80, 68, 57,
+ 46, 40, 34, 29, 23, 17, 11, 6, 0 },
+
+ { 16384, 13463, 10542, 7622, 4701, 3970, 3240, 2510,
+ 1780, 1597, 1415, 1232, 1050, 958, 867, 776,
+ 685, 593, 502, 411, 319, 274, 228, 183,
+ 137, 114, 91, 68, 46, 34, 23, 11, 0 },
+
+ { 16384, 4701, 1780, 1050, 685, 319, 137, 46,
+ 0, },
+
+ { 16384, 3277, 0 },
+
+ { 16384, 13463, 10542, 7622, 4701, 3970, 3240, 2510,
+ 1780, 1597, 1415, 1232, 1050, 958, 867, 776,
+ 685, 593, 502, 411, 319, 274, 228, 183,
+ 137, 114, 91, 68, 46, 34, 23, 11,
+ 0 },
+
+ { 16384, 10542, 4701, 3240, 1780, 1415, 1050, 867,
+ 685, 502, 319, 228, 137, 91, 46, 23,
+ 0 },
+
+ { 16384, 4468, 1489, 745, 0 }, 0,
+};
+
+const Word16 ivas_lfe_num_ele_in_coder_models[2][4] =
+{
+ { 63, 31, 7, 1 },{ 31, 15, 3, 0 }
+};
+
+const Word16 ivas_lfe_log2_num_ele_in_coder_models_fx[2][4] =
+{
+ { 6, 5, 3, 1 },{ 5, 4, 2, 0 }
+};
+
+const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8, 6 };
+
+const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 };
+
+const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 };
+
+const Word32 ivas_lfe_lpf_delay_ns[2] = { 1750000, 3500000 };
+
+const Word16 dirac_gains_P_idx[16] =
+{
+ -1, 1, 0, 1, 4, 3, 2, 3, 4, 8, 7, 6, 5, 6, 7, 8
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * FB ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const Word32 ivas_fb_fcs_12band_1ms_fx[IVAS_FB_BANDS_12] =
+{
+ 17895696, 53687092, 89478488, 125269880,
+ 161061280, 196852672, 232644064, 304226848,
+ 465288128, 715827904, 1091637520, 1735882615
+};/*Q31*/
+
+const Word16 ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 291, 367 },
+ { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 260, 47 },
+ { 24, 30, 30, 30, 30, 30, 42, 75, 122, 73, 0, 0 }
+};
+
+const Word16 ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 },
+ {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 },
+ {0, 9, 25, 41, 57, 73, 88, 110, 159, 247, 0, 0 }
+};
+
+const Word16 ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ {
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_0 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_1 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_2 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_3 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_4 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_5 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_6 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_7 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_8 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_9 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_10 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_11 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_0 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_0,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_1 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_2 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_2,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_3 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_4 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_4,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_5 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_6 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_6,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_7 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_8 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_8,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_9 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_10 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_10,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_11 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_0 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_0,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_1 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_2 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_2,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_3 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_4 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_4,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_5 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_6 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_6,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_7 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_8 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_8,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_9 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_10 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_10,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_11 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_11
+ },
+};
+
+const Word16 ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ {
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_11
+ },
+};
+
+const Word16 ivas_num_active_bands[FB - WB + 1] =
+{
+ IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12
+};
+
+
+/*------------------------------------------------------------------------------------------*
+ * SNS MSVQ codebooks and means
+ *------------------------------------------------------------------------------------------*/
+
+const Word16 ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32, 32 };
+const Word16 ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 };
+const Word16 ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 };
+const Word16 ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 };
+
+const Word16 ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 };
+const Word16 ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 };
+const Word16 ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 };
+const Word16 ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 };
+
+const Word16 sns_1st_cdbk[2][2][8 * 32] =
+{
+ { /* split 1 */
+ { /* TCX 20 */
+ -10900, -11064, -10637, -10471, -9051, -6381, -4688, -2438,
+ -2119, -5087, -6702, -8118, -7586, -6343, -4828, -3406,
+ 2004, -3443, -4289, -3757, -3234, -2952, -2313, -1781,
+ 1749, 5598, 3916, 732, -1472, -2964, -3275, -2332,
+ -11978, -14369, -5600, -545, 981, -929, -57, 1903,
+ 1745, 391, 202, 115, 256, -291, -862, -1637,
+ -4052, 2059, 4709, 6768, 5595, 1975, -1723, -1218,
+ 2093, 7263, 8679, 7576, 3701, -2438, -4389, -2686,
+ -7120, -6279, -5715, -5520, -4752, -3125, -1856, -438,
+ 8131, -2543, -6285, -6723, -5588, -4321, -3264, -2164,
+ -653, -1301, -660, 608, 1598, 1805, 1698, 760,
+ 4882, 9309, 6333, 1734, 284, 364, 560, 1015,
+ -7686, -5737, -3443, -1642, 245, 1531, 1827, 1769,
+ -1468, 3782, 144, -5130, -6883, -5165, -1497, 2072,
+ -12937, -8429, -2619, 2894, 5004, 4710, 4627, 3740,
+ 3198, 3928, 4358, 4554, 3887, 2844, 1299, 129,
+ -13828, -12296, -9364, -7918, -5571, -1909, 307, 2047,
+ -4314, -1211, -559, -1061, -1928, -2228, -2359, -1902,
+ -309, -3224, -3404, -1895, -743, -59, 757, 908,
+ 10914, 5865, 1599, -386, -1392, -2285, -2236, -2042,
+ -11825, -16241, -11402, -3627, 6556, 8953, 6421, 1546,
+ 6102, 777, -301, 536, 902, 541, 210, -429,
+ -3052, 3997, 5389, 1842, -344, 1556, 2667, 2428,
+ 11788, 10894, 7448, 5423, 2372, -677, -2385, -3839,
+ -45, -7602, -8923, -7179, -3273, 65, 4500, 6726,
+ 5895, 626, -1610, -2598, -3240, -3540, -2930, -2156,
+ -971, 461, 1494, 4907, 5859, 5199, 3678, 2502,
+ 10766, 5297, 1844, 1236, 2498, 3503, 2846, 838,
+ -7816, -1212, 891, 2387, 1317, 2225, 1859, 1602,
+ 2376, 5357, 2088, -2719, -3419, -420, 2431, 2943,
+ -8383, -795, 4351, 7026, 7460, 7191, 5262, 3796,
+ 1522, 6283, 8714, 8222, 7434, 5768, 3586, 1499,
+ },
+ { /* TCX 10 */
+ -15596, -16321, -10264, -1002, 5955, 5543, -29, -1688,
+ 17, -3794, -6207, -7356, -6998, -6081, -4453, -2448,
+ -12543, -11530, -10186, -8817, -7083, -4440, -1946, 892,
+ 5198, 2751, -274, -2574, -4561, -6087, -5944, -4600,
+ -683, -2640, -2753, -1195, -239, -217, -286, 90,
+ -1400, -1146, -1853, -2845, -3456, -3788, -3171, -1969,
+ -1835, 392, 1725, 1209, -392, -1640, -2001, -1608,
+ 5770, 7707, 5210, 2112, -382, -2088, -2634, -3007,
+ -10766, -8101, -5137, -3754, -1881, 331, 2339, 3679,
+ -2637, -4640, -5811, -5651, -3790, -1359, 913, 1893,
+ -7793, -4768, -1762, -545, -717, -837, -441, -75,
+ 4030, 1770, 467, 379, 10, -1330, -2398, -2290,
+ -9395, -6952, -2494, 2022, 4753, 5614, 4443, 2642,
+ -1486, 1748, 859, -2586, -3368, -638, 2761, 3269,
+ -2408, 306, 3633, 6567, 5950, 2474, -621, -1421,
+ 5478, 7986, 9498, 8165, 5477, 1244, -523, -1586,
+ -13564, -14673, -10597, -5504, 1575, 8248, 7662, 4025,
+ 4978, -682, -3586, -4305, -3703, -3001, -2227, -1278,
+ -8002, -6831, -5558, -4868, -4243, -3393, -2486, -1110,
+ 11485, 5472, 1645, -533, -1792, -2814, -3169, -2706,
+ 1617, 421, 232, 1382, 2162, 2017, 1318, 744,
+ 3677, 5212, 1990, -1514, -2894, -2441, -451, 592,
+ 731, 4295, 5860, 3756, 1991, 1437, 869, 127,
+ 12736, 11722, 7768, 4682, 1574, -744, -1989, -3131,
+ -3490, -4269, -3681, -1531, 1111, 3327, 4138, 3815,
+ 7344, 1400, -1302, -1502, -1015, 57, 1212, 1498,
+ -4836, -1881, 1071, 2055, 2114, 2465, 2093, 1458,
+ 8569, 5879, 3654, 2879, 2530, 1703, 781, -233,
+ -3709, -990, 2338, 6227, 7083, 7102, 5657, 3401,
+ 3389, 6392, 5267, 1011, 275, 3519, 5236, 4339,
+ 599, 3752, 6943, 9211, 8152, 5568, 3337, 1838,
+ 9885, 9591, 7905, 8068, 7929, 7421, 4234, 757,
+ }
+ },
+ { /* split 2 */
+ { /* TCX 20 */
+ -178, -3476, -5982, -7081, -7548, -7440, -6859, -5798,
+ -3596, -3670, -1501, 770, 812, -286, -2001, -3377,
+ -3998, -5191, -4988, -4421, -3889, -3571, -2738, -1969,
+ -2981, -2687, -1501, -83, 1136, 2377, 3248, 4105,
+ 1842, -41, -1972, -4282, -6779, -8405, -8674, -7835,
+ -259, 571, 2124, 3344, 2959, 1407, -750, -2523,
+ -524, -1956, -2855, -3202, -3939, -4666, -4907, -4782,
+ -5110, -4768, -3017, -663, 4188, 9210, 16602, 21081,
+ 4373, 4846, -603, -6495, -7289, -5540, -4749, -5527,
+ -1448, -1043, -619, -105, 356, 362, 542, 857,
+ 1373, -752, -5334, -6244, -3001, -932, -1040, -3125,
+ -2403, -1397, 612, 2449, 3920, 5231, 6819, 8581,
+ 2183, 1211, -111, -1084, -2836, -4977, -6701, -7284,
+ -751, 1255, 3408, 6474, 7503, 7026, 5413, 4464,
+ 935, 850, 589, 353, 160, -434, -939, -931,
+ 268, 2284, 3884, 5423, 6680, 7996, 9244, 9472,
+ 1075, 113, -1289, -4457, -7512, -5930, -1799, -571,
+ -3689, -4254, -3755, -2995, -1581, -135, 1049, 1589,
+ -1166, -1752, -1790, -1897, -1927, -1831, -1359, -805,
+ -1494, -735, 635, 1993, 2909, 3546, 4226, 4956,
+ 4435, 4299, 4269, 1328, -3731, -7621, -9319, -9170,
+ 1358, 2227, 3873, 4469, 4692, 4057, 2601, 1608,
+ 813, 398, -499, -666, -1286, -2271, -3316, -4025,
+ -3300, -1255, 2181, 6431, 10002, 12760, 13549, 12584,
+ 3714, 4180, 484, -2905, -2864, -1359, -1256, -2477,
+ 308, 868, 1373, 1629, 1793, 1834, 1814, 1746,
+ 1472, 798, -282, -1935, -1818, 320, 2221, 2914,
+ 2281, 3240, 2988, 1400, 2383, 4072, 5667, 6675,
+ 2672, 2678, 2874, 2096, -226, -2301, -3861, -4534,
+ 4988, 7231, 7641, 7731, 7061, 6447, 5411, 3513,
+ 3978, 4156, 4126, 2896, 1469, 759, 368, -68,
+ -264, 4210, 8534, 11008, 11606, 11888, 11072, 8949,
+ },
+ { /* TCX 10 */
+ -2852, -6158, -7231, -7830, -8012, -7922, -7556, -6706,
+ -3911, -5340, -5053, -4741, -4805, -4484, -3727, -3037,
+ -966, -1461, -1694, -2427, -3081, -3037, -2547, -2230,
+ -3455, -3315, -2451, -836, 1383, 3196, 3720, 3379,
+ 3052, 281, -3351, -6866, -9051, -9586, -8983, -8236,
+ -748, -4465, -4314, -2251, 29, -40, -3963, -6195,
+ 200, 1293, 2535, 2803, 1603, -186, -1397, -1697,
+ -1707, -265, 2196, 5295, 5894, 4216, 3440, 3826,
+ -237, -2133, -2279, -3149, -4377, -5638, -6520, -6764,
+ -2407, -2049, -1246, -664, -521, -430, -349, -211,
+ 3874, 1335, -1501, -2055, -1268, -990, -1852, -2871,
+ -1883, -1845, -1681, -484, 384, 2035, 5839, 9597,
+ 275, 380, 1048, 424, -1146, -3012, -4431, -5104,
+ -1699, -484, 756, 1261, 1279, 1377, 1975, 2590,
+ 2139, 4502, 3645, 4975, 6491, 5972, 5012, 4346,
+ -3821, -2581, -433, 2667, 6436, 10038, 11311, 8783,
+ 2359, -2689, -6604, -7039, -5992, -4268, -3711, -4840,
+ -2776, -4251, -4539, -3672, -2494, -1055, 280, 695,
+ 491, 866, 822, -44, -1009, -1165, -831, -538,
+ -1024, 91, 786, 1295, 2433, 3910, 4975, 5403,
+ 3117, 2590, 2337, -667, -4580, -8147, -9400, -9523,
+ -103, -630, -831, 669, 3062, 3398, 549, -1690,
+ 2113, 3467, 4279, 5047, 5344, 3361, 127, -2313,
+ -1199, 1153, 2914, 3688, 4260, 5421, 7471, 8831,
+ 2815, 2184, 316, -3058, -5596, -5564, -4343, -3793,
+ 922, 126, -1414, -1731, -1007, 359, 2029, 3088,
+ 4889, 4619, 2537, 1114, 950, 946, 799, 419,
+ -4271, -3750, -3359, -484, 1448, 4106, 10487, 20479,
+ 3818, 4687, 4064, 2212, -172, -2287, -3535, -4041,
+ 884, 2456, 3394, 2925, 2182, 2323, 2583, 2507,
+ 4767, 8057, 8263, 6461, 5003, 4055, 2923, 1845,
+ 19, 3813, 6926, 8432, 10141, 10850, 9692, 8383,
+ }
+ }
+};
+
+const Word16 sns_1st_means_16k[2][16] =
+{
+ { /* TCX 20 */
+ 14210, 19017, 14362, 9309, 5385, 2674, 1055, -211, -1407, -3059, -4393, -8597, -11180, -11756, -12131, -13281,
+ },
+ { /* TCX 10*/
+ 12018, 15915, 11089, 6015, 847, -705, -539, -1548, -893, -2163, -1806, -4189, -7017, -8670, -8874, -9480,
+ }
+};
+
+const Word16 sns_1st_means_25k6[2][16] =
+{
+ { /* TCX 20 */
+ 14973, 20323, 16461, 9554, 4017, 3103, 1602, 1694, -221, -1401, -6817, -10071, -11503, -11805, -13158, -16749,
+ },
+ { /* TCX 10 */
+ 15560, 19489, 14623, 5595, 2084, 1699, 775, -1312, -2195, -6101, -9078, -9465, -7825, -6603, -7281, -9960,
+ }
+};
+
+const Word16 sns_1st_means_32k[2][16] =
+{
+ { /* TCX 20 */
+ 15041, 20603, 16969, 10289, 4973, 4283, 3003, 3316, 1684, -259, -6614, -9535, -10363, -11834, -16625, -24930,
+ },
+ { /* TCX 10 */
+ 16510, 20660, 16025, 7224, 3921, 3868, 2623, 742, -1316, -6269, -8284, -7288, -6380, -8410, -13351, -20277,
+ }
+};
+
+
+/*----------------------------------------------------------------------*
+ * MC ParamUpmix ROM tables
+ *-----------------------------------------------------------------------*/
+
+const Word16 ivas_param_upmx_mx_qmap[33] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+
+
+/*----------------------------------------------------------------------*
+ * MDCT/IMDCT tables
+ *-----------------------------------------------------------------------*/
+
#define SHC( x ) ( (Word16) x )
-/* clang-format off */
const Word16 ivas_sin_twiddle_480_fx[ IVAS_480_PT_LEN >> 1 ] = {
SHC( 0xffe6 ), SHC( 0xff0f ), SHC( 0xfe39 ), SHC( 0xfd62 ), SHC( 0xfc8c ), SHC( 0xfbb6 ), SHC( 0xfadf ), SHC( 0xfa09 ),
SHC( 0xf933 ), SHC( 0xf85d ), SHC( 0xf787 ), SHC( 0xf6b1 ), SHC( 0xf5db ), SHC( 0xf505 ), SHC( 0xf42f ), SHC( 0xf35a ),
@@ -327,7 +3184,6 @@ const Word32 dft_res_gains_q_fx[][2] = {
{ (Word32)( 0x00000000 ), (Word32)( 0x635c2900 ) },
{ (Word32)( 0x00000000 ), (Word32)( 0x7fffffff ) },
-
/* column 2 (|ILD| = 2): */
{ (Word32)( 0x0eabf770 ), (Word32)( 0x00000000 ) },
{ (Word32)( 0x0edeb100 ), (Word32)( 0x0ec636b0 ) },
@@ -378,7 +3234,6 @@ const Word32 dft_res_gains_q_fx[][2] = {
{ (Word32)( 0x5ba86100 ), (Word32)( 0x3e65f940 ) },
{ (Word32)( 0x68ba3000 ), (Word32)( 0x49984a00 ) },
-
/* column 7 (|ILD| = 13): */
{ (Word32)( 0x512c1700 ), (Word32)( 0x00000000 ) },
{ (Word32)( 0x51d52c00 ), (Word32)( 0x08e72540 ) },
@@ -399,7 +3254,6 @@ const Word32 dft_res_gains_q_fx[][2] = {
{ (Word32)( 0x710eb280 ), (Word32)( 0x239c9d40 ) },
{ (Word32)( 0x79ba2380 ), (Word32)( 0x27944240 ) },
-
/* column 9 (|ILD| = 19): */
{ (Word32)( 0x662c9080 ), (Word32)( 0x00000000 ) },
{ (Word32)( 0x66ad4f80 ), (Word32)( 0x0562c778 ) },
@@ -420,7 +3274,6 @@ const Word32 dft_res_gains_q_fx[][2] = {
{ (Word32)( 0x79a1fd00 ), (Word32)( 0x12d6a9c0 ) },
{ (Word32)( 0x7e651700 ), (Word32)( 0x14351580 ) },
-
/* column 11 (|ILD| = 25): */
{ (Word32)( 0x725edd00 ), (Word32)( 0x00000000 ) },
{ (Word32)( 0x72aec080 ), (Word32)( 0x02fc829c ) },
@@ -480,7 +3333,6 @@ const Word32 dft_res_gains_q_fx[][2] = {
{ (Word32)( 0x7f9f7700 ), (Word32)( 0x00b70ac4 ) },
{ (Word32)( 0x7fcc0780 ), (Word32)( 0x00c8711d ) },
{ (Word32)( 0x7fff5800 ), (Word32)( 0x00cf398f ) },
-
};
// Q25
@@ -503,13 +3355,6 @@ const Word32 McMASA_LFEGain_vectors_fx[64] = {
-71806484, 8724152, 28185723, 34225521
};
-/*
- This lookup table is calculated from, and therefore
- depends on the following macros:
- - MASA_NTOT2_FAC
- - MASA_ASIN_OFFSET
- - MASA_ANGLE_AT_EQUATOR
-*/
const UWord16 cum_n_for_id_th[122] = {
0, 846, 1690, 2534, 3378, 4222, 5064, 5906, 6746, 7586, 8424, 9260, 10094,
10928, 11760, 12588, 13416, 14240, 15064, 15882, 16700, 17514, 18326, 19134,
@@ -573,9 +3418,10 @@ const Word16 pow_10_q11[128] = {
13540, 13786, 14036, 14291, 14550, 14815, 15084, 15357, 15636, 15920, 16209, 16503, 16803, 17108, 17418, 17734, 18056, 18384, 18718, 19058, 19404, 19756, 20114
};
-
// Q12
-const Word16 icbwe_gsMapping_tbl_fx[16] = { -8192, -5527, -3935, -2907, -2289, -1824, -1404, -1035, -692, -404, -286, -204, -81, 0, 163, 327 };
+const Word16 icbwe_gsMapping_tbl_fx[16] = {
+ -8192, -5527, -3935, -2907, -2289, -1824, -1404, -1035, -692, -404, -286, -204, -81, 0, 163, 327
+};
// Q12
const Word16 icbwe_gsMappingDFT_tbl_fx[128] = {
@@ -590,7 +3436,6 @@ const Word32 pow_10_q23[14] = {
2364231, 2652711, 3339565, 4204263, 5803499, 8011059, 8388608, 6818517, 7222539, 5292854, 4204263, 6977341, 7919357, 8388608
};
-/* clang-format on */
// Q15
const Word16 ivas_tan_panning_gain_dirac_tbl_fx[601] = {
SHC( 0x8000 ),
@@ -1306,6 +4151,7 @@ const Word32 ica_sincInterp6_fx[2 * SINC_ORDER1 + 1] = {
0, -7481833, -15444702, -22462678, -25151328, -18893562, 0, 31359704, 68816112, 99516536, 106796512, 75709536, 0, -111862424, -234090752, -326303712, -341870816, -240232560, 0, 371151744, 833251584, 1319259392, 1748116096, 2042624128, 2147483647, 2042624128, 1748116096, 1319259392, 833251584, 371151744, 0, -240232560, -341870816, -326303712, -234090752, -111862424, 0, 75709536, 106796512, 99516536, 68816112, 31359704, 0, -18893562, -25151328, -22462678, -15444702, -7481833, 0
};
+
/*----------------------------------------------------------------------------------*
* Stereo IC-BWE ROM tables
*----------------------------------------------------------------------------------*/
@@ -1330,6 +4176,7 @@ const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[128] = {
19072, 19631
};
+
/*----------------------------------------------------------------------------------*
* TD Stereo ROM tables
*----------------------------------------------------------------------------------*/
@@ -1465,6 +4312,7 @@ const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_CO
{ 6554 /*0.2f*/, 29491 /*0.9f*/ }
};
+
/*----------------------------------------------------------------------------------*
* DirAC ROM tables
*----------------------------------------------------------------------------------*/
@@ -1487,6 +4335,7 @@ const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1] = {
MAX_32 /* out-of-range large value to make searching easier */
};
+
/*------------------------------------------------------------------------------------------*
* SPAR ROM tables
*------------------------------------------------------------------------------------------*/
@@ -1513,6 +4362,7 @@ const Word32 one_by_q_level[64] = {
35204648, 34636832, 34087044
};
+
/*----------------------------------------------------------------------------------*
* Parametric MC ROM tables
*----------------------------------------------------------------------------------*/
@@ -1527,6 +4377,7 @@ const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER] = {
-32440, -19300, 0, 12046, 19690, 27563, 30703, 32767
};
+
/*----------------------------------------------------------------------------------*
* MASA ROM tables
*----------------------------------------------------------------------------------*/
@@ -1546,7 +4397,6 @@ const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = {
{ 24129030, 24129030, 24403223, 24970740, 25565282, 26512144, 27889398, 29417584, 31580642, 34087042, 37675152, 42107523, 48806447, 56512728, 71582788, 93368854, 143165577, 268435456, 2147483647 },
};
-
const Word32 azimuth_cb_fx[8] = {
0, -754974720, -377487360, 377487360, -188743680, 188743680, -566231040, 566231040
};
@@ -1633,17 +4483,19 @@ const Word16 ls_elevation_CICP16_idx[9] = { 0, 0, 0, 0, 0, 3, 3, 3, 3 };
const Word16 ls_azimuth_CICP19_idx[11] = { 1, 2, 0, 9, 10, 5, 6, 1, 2, 9, 10 };
const Word16 ls_elevation_CICP19_idx[11] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3 };
-const Word32 shoebox_sin_cos_tbl_fx[11][2] = { { 0, 1073741824 }, // 0
- { 536870912, 929887680 },
- { -536870912, 929887680 }, // 30, -30
- { 615873024, 879557824 },
- { -615873024, 879557824 }, // 35, -35
- { 1073741824, 0 },
- { -1073741824, 0 }, // 90, -90
- { 1008987264, -367241312 },
- { -1008987264, -367241312 }, // 110,-110
- { 759250112, -759250112 },
- { -759250112, -759250112 } }; // 135, -135 //Q.30
+const Word32 shoebox_sin_cos_tbl_fx[11][2] = {
+ { 0, 1073741824 }, // 0
+ { 536870912, 929887680 },
+ { -536870912, 929887680 }, // 30, -30
+ { 615873024, 879557824 },
+ { -615873024, 879557824 }, // 35, -35
+ { 1073741824, 0 },
+ { -1073741824, 0 }, // 90, -90
+ { 1008987264, -367241312 },
+ { -1008987264, -367241312 }, // 110,-110
+ { 759250112, -759250112 },
+ { -759250112, -759250112 } // 135, -135 //Q.30
+};
// Q22
const Word32 delta_phi_val[90] = {
@@ -1714,6 +4566,7 @@ const Word32 dd_val[90] = {
const Word32 cb_azi_chan_fx[] = { 0, 125829120, 461373440, 566231040 }; // Q22
const Word16 cb_azi_chan_16fx[] = { 0, 1920, 7040, 8640 }; // Q6
+
/*----------------------------------------------------------------------------------*
* MASA and ISM (OMASA) combined format ROM tables
*----------------------------------------------------------------------------------*/
@@ -1759,6 +4612,7 @@ const Word32 dct12_fx[12 * 12] = { // Q31
-810030848, 759350208, -695569984, 619978560, -533649696, 438301408, -335436960, 226989024, -114460880
};
+
/*----------------------------------------------------------------------------------*
* ISM ROM tables
*----------------------------------------------------------------------------------*/
@@ -1773,6 +4627,7 @@ const Word32 ism_elevation_borders_fx[4] = {
ISM_ELEVATION_MIN_FX, ISM_ELEVATION_LOW_BORDER_FX, ISM_ELEVATION_HIGH_BORDER_FX, ISM_ELEVATION_MAX_FX
};
+
/*----------------------------------------------------------------------------------*
* LFE coding ROM tables
*----------------------------------------------------------------------------------*/
@@ -1793,6 +4648,7 @@ const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = {
0x82fd4b80, 0x3d0d2280, 0x40000000, 0x7fffffff,
0x40000000, 0x40000000, 0x81478600, 0x3ec30c00
};
+
const Word16 ivas_lpf_4_butter_32k_sos_e[IVAS_BIQUAD_FILT_LEN << 2] = {
-24, -23, -24, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
@@ -1803,25 +4659,11 @@ const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2] = {
-2113939767, 1040504054, 1073741824, 2147483480,
1073741829, 1073741824, -2133281237, 1059848324
};
+
const Word16 ivas_lpf_4_butter_48k_sos_e[IVAS_BIQUAD_FILT_LEN << 2] = {
-27, -26, -27, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
-#ifndef NONBE_FIX_MC_LFE_LPF
-const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */
- 0xa4d0c, 0x149a17, 0xa4d0c, 0x40000000, 0x849e6300, 0x3b8ad140
-};
-
-const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */
- // 0x53e1a, 0x29f0d, 0x40000000, 0x824f6000, 0x3dbb1c80, 0x29f0d
- 0x29F0D, 0x53E1A, 0x29F0D, 0x40000000, 0x824F5FC3, 0x3DBB1C71
-};
-
-const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */
- 0x12c07, 0x2580d, 0x12c07, 0x40000000, 0x818a4580, 0x3e7a6a80
-};
-#endif
-
const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K] = { // Q31
0x0003a373, 0x000608f6, 0x000888a7, 0x000b3e1b, 0x000e34f1, 0x001174a2, 0x00150328, 0x0018e5e1, 0x001d21eb, 0x0021bc4d, 0x0026ba09, 0x002c202f, 0x0031f3dc, 0x00383a43, 0x003ef8ad, 0x0046347b, 0x004df325, 0x00563a3f, 0x005f0f74, 0x00687888, 0x00727b59, 0x007d1ddb, 0x0088661c, 0x00945a41, 0x00a10087, 0x00ae5f3d, 0x00bc7ccd, 0x00cb5fb3, 0x00db0e7d, 0x00eb8fd0, 0x00fcea61, 0x010f24f8, 0x0122466a, 0x013655a0, 0x014b598e, 0x01615936, 0x01785ba8, 0x01906800, 0x01a9855e, 0x01c3baf0, 0x01df0fee, 0x01fb8b90, 0x02193514, 0x023813c4, 0x02582ee4, 0x02798db8, 0x029c378c, 0x02c033a4, 0x02e58944, 0x030c3fa8, 0x03345e0c, 0x035deba0, 0x0388ef8c, 0x03b570f0, 0x03e376dc, 0x04130858, 0x04442c58, 0x0476e9b8, 0x04ab4760, 0x04e14c00, 0x0518fe48, 0x055264c8, 0x058d8600, 0x05ca6850, 0x06091200, 0x06498930, 0x068bd3f0, 0x06cff830, 0x0715fba8, 0x075de408, 0x07a7b6c8, 0x07f37940, 0x084130a0, 0x0890e200, 0x08e29220, 0x093645c0, 0x098c0150, 0x09e3c940, 0x0a3da180, 0x0a998e30, 0x0af792e0, 0x0b57b320, 0x0bb9f240, 0x0c1e5360, 0x0c84d940, 0x0ced8690, 0x0d585dc0, 0x0dc560f0, 0x0e349200, 0x0ea5f2b0, 0x0f198450, 0x0f8f4820, 0x10073f00, 0x10816980, 0x10fdc840, 0x117c5b00, 0x11fd21e0, 0x12801c60, 0x130549a0, 0x138ca8c0, 0x14163880, 0x14a1f740, 0x152fe320, 0x15bffa00, 0x16523980, 0x16e69ee0, 0x177d2700, 0x1815cec0, 0x18b09260, 0x194d6e00, 0x19ec5d60, 0x1a8d5c20, 0x1b306580, 0x1bd57440, 0x1c7c8300, 0x1d258c40, 0x1dd08a00, 0x1e7d7600, 0x1f2c49a0, 0x1fdcfe20, 0x208f8c40, 0x2143ed00, 0x21fa1840, 0x22b20680, 0x236baf40, 0x24270a00, 0x24e40e00, 0x25a2b280, 0x2662ee00, 0x2724b700, 0x27e80400, 0x28acca80, 0x297300c0, 0x2a3a9c00, 0x2b039180, 0x2bcdd680, 0x2c995fc0, 0x2d6621c0, 0x2e341140, 0x2f032240, 0x2fd34900, 0x30a47900, 0x3176a640, 0x3249c440, 0x331dc600, 0x33f29f40, 0x34c842c0, 0x359ea340, 0x3675b3c0, 0x374d66c0, 0x3825af00, 0x38fe7ec0, 0x39d7c880, 0x3ab17e40, 0x3b8b9240, 0x3c65f6c0, 0x3d409d80, 0x3e1b7880, 0x3ef679c0, 0x3fd19340, 0x40acb680, 0x4187d580, 0x4262e280, 0x433dce80, 0x44188c00, 0x44f30c80, 0x45cd4180, 0x46a71e00, 0x47809300, 0x48599300, 0x49320f80, 0x4a09fb80, 0x4ae14880, 0x4bb7e900, 0x4c8dcf80, 0x4d62ee80, 0x4e373880, 0x4f0aa080, 0x4fdd1900, 0x50ae9600, 0x517f0980, 0x524e6780, 0x531ca380, 0x53e9b100, 0x54b58400, 0x55801080, 0x56494b00, 0x57112800, 0x57d79c00, 0x589c9c00, 0x59601d00, 0x5a221480, 0x5ae27880, 0x5ba13e00, 0x5c5e5c00, 0x5d19c880, 0x5dd37a80, 0x5e8b6800, 0x5f418980, 0x5ff5d580, 0x60a84480, 0x6158ce00, 0x62076a80, 0x62b41280, 0x635ebf80, 0x64076a80, 0x64ae0d00, 0x6552a100, 0x65f52080, 0x66958680, 0x6733cd00, 0x67cff000, 0x6869ea80, 0x6901b880, 0x69975600, 0x6a2abf80, 0x6abbf200, 0x6b4aea80, 0x6bd7a680, 0x6c622300, 0x6cea5f80, 0x6d705900, 0x6df40f00, 0x6e758080, 0x6ef4ac80, 0x6f719300, 0x6fec3380, 0x70648f00, 0x70daa580, 0x714e7880, 0x71c00880, 0x722f5780, 0x729c6700, 0x73073980, 0x736fd100, 0x73d62f80, 0x743a5900, 0x749c5080, 0x74fc1880, 0x7559b600, 0x75b52b80, 0x760e7e80, 0x7665b280, 0x76bacc80, 0x770dd180, 0x775ec600, 0x77adb000, 0x77fa9480, 0x78457900, 0x788e6400, 0x78d55b80, 0x791a6500, 0x795d8780, 0x799ec900, 0x79de3100, 0x7a1bc580, 0x7a578d80, 0x7a919100, 0x7ac9d600, 0x7b006500, 0x7b354400, 0x7b687b80, 0x7b9a1300, 0x7bca1180, 0x7bf87f80, 0x7c256400, 0x7c50c780, 0x7c7ab180, 0x7ca32a00, 0x7cca3900, 0x7cefe600, 0x7d143900, 0x7d373a80, 0x7d58f280, 0x7d796800, 0x7d98a380, 0x7db6ad00, 0x7dd38c80, 0x7def4900, 0x7e09eb00, 0x7e237a00, 0x7e3bfd80, 0x7e537d80, 0x7e6a0180, 0x7e7f9080, 0x7e943200, 0x7ea7ed80, 0x7ebaca00, 0x7ecccf00, 0x7ede0300, 0x7eee6d00, 0x7efe1400, 0x7f0cfe80, 0x7f1b3380, 0x7f28b900, 0x7f359500, 0x7f41ce80, 0x7f4d6b80, 0x7f587180, 0x7f62e680, 0x7f6cd000, 0x7f763400, 0x7f7f1780, 0x7f878080, 0x7f8f7380, 0x7f96f580, 0x7f9e0b80, 0x7fa4bb00, 0x7fab0780, 0x7fb0f600, 0x7fb68b00, 0x7fbbca00, 0x7fc0b800, 0x7fc55880, 0x7fc9af80, 0x7fcdc080, 0x7fd18f00, 0x7fd51e80, 0x7fd87280, 0x7fdb8d80, 0x7fde7380, 0x7fe12700, 0x7fe3aa80, 0x7fe60100, 0x7fe82d00, 0x7fea3180, 0x7fec1000, 0x7fedcb00, 0x7fef6500, 0x7ff0e000, 0x7ff23e00, 0x7ff38080, 0x7ff4a980, 0x7ff5ba80, 0x7ff6b580, 0x7ff79c00, 0x7ff86e80, 0x7ff92f80, 0x7ff9e000, 0x7ffa8100, 0x7ffb1380, 0x7ffb9880, 0x7ffc1180, 0x7ffc7f80, 0x7ffce300, 0x7ffd3c80, 0x7ffd8d80, 0x7ffdd680, 0x7ffe1880, 0x7ffe5300, 0x7ffe8800, 0x7ffeb700, 0x7ffee100, 0x7fff0600, 0x7fff2700, 0x7fff4480, 0x7fff5e80, 0x7fff7500, 0x7fff8900, 0x7fff9a80, 0x7fffaa00, 0x7fffb780, 0x7fffc300, 0x7fffcd00, 0x7fffd580, 0x7fffdc80, 0x7fffe300, 0x7fffe880, 0x7fffec80, 0x7ffff080, 0x7ffff380, 0x7ffff680, 0x7ffff880, 0x7ffffa00, 0x7ffffb80, 0x7ffffc80, 0x7ffffd80, 0x7ffffe80, 0x7fffff00, 0x7fffff00, 0x7fffff80, 0x7fffff80, 0x7fffffff, 0x7fffffff
};
@@ -1835,11 +4677,15 @@ const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K] = { // Q31
};
// Q31
-const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2] = { 171798688, 172140032, 173163840, 174869408, 177255536, 180320592, 184062448, 188478528, 193565776, 199320672, 205739248, 212817056, 220549216, 228930368, 237954752, 247616096, 257907744, 268822560, 280353056, 292491200, 305228608, 318556544, 332465728, 346946560, 361989056, 377582784, 393717024, 410380576,
- 427561952, 445249248, 463430240, 482092416, 501222848, 520808288, 540835200, 561289856, 582157952, 603425152, 625076800, 647097792, 669473088, 692187136, 715224192, 738568384, 762203584, 786113472, 810281536, 834691008, 859324992, 884166592, 909198592, 934403584, 959764288, 985263168, 1010882496, 1036604672,
- 1062411840, 1088286208, 1114209920, 1140164992, 1166133632, 1192097664, 1218039296, 1243940608, 1269783552, 1295550464, 1321223424, 1346784768, 1372216704, 1397501824, 1422622464, 1447561344, 1472301312, 1496825216, 1521116032, 1545157120, 1568931712, 1592423424, 1615616128, 1638493568, 1661040256,
- 1683240320, 1705078528, 1726539776, 1747609216, 1768272384, 1788514944, 1808322816, 1827682432, 1846580352, 1865003520, 1882939264, 1900375040, 1917298944, 1933699328, 1949564672, 1964884096, 1979647104, 1993843328, 2007463040, 2020496768, 2032935680, 2044770944, 2055994624, 2066598784, 2076576128,
- 2085919744, 2094623360, 2102680704, 2110086272, 2116835072, 2122922368, 2128343936, 2133095936, 2137175296, 2140579072, 2143304832, 2145350912, 2146715648, 2147398272 };
+const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2] = {
+ 171798688, 172140032, 173163840, 174869408, 177255536, 180320592, 184062448, 188478528, 193565776, 199320672, 205739248, 212817056, 220549216, 228930368, 237954752, 247616096, 257907744, 268822560, 280353056, 292491200, 305228608, 318556544, 332465728, 346946560, 361989056, 377582784, 393717024, 410380576,
+ 427561952, 445249248, 463430240, 482092416, 501222848, 520808288, 540835200, 561289856, 582157952, 603425152, 625076800, 647097792, 669473088, 692187136, 715224192, 738568384, 762203584, 786113472, 810281536, 834691008, 859324992, 884166592, 909198592, 934403584, 959764288, 985263168, 1010882496, 1036604672,
+ 1062411840, 1088286208, 1114209920, 1140164992, 1166133632, 1192097664, 1218039296, 1243940608, 1269783552, 1295550464, 1321223424, 1346784768, 1372216704, 1397501824, 1422622464, 1447561344, 1472301312, 1496825216, 1521116032, 1545157120, 1568931712, 1592423424, 1615616128, 1638493568, 1661040256,
+ 1683240320, 1705078528, 1726539776, 1747609216, 1768272384, 1788514944, 1808322816, 1827682432, 1846580352, 1865003520, 1882939264, 1900375040, 1917298944, 1933699328, 1949564672, 1964884096, 1979647104, 1993843328, 2007463040, 2020496768, 2032935680, 2044770944, 2055994624, 2066598784, 2076576128,
+ 2085919744, 2094623360, 2102680704, 2110086272, 2116835072, 2122922368, 2128343936, 2133095936, 2137175296, 2140579072, 2143304832, 2145350912, 2146715648, 2147398272
+};
+
+
/*------------------------------------------------------------------------------------------*
* MDFT/iMDFT ROM tables
*------------------------------------------------------------------------------------------*/
@@ -2524,297 +5370,6 @@ const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1] = {
252409632, 168489632, 84309816, 0
};
-// Q30
-const Word32 dirac_gains_norm_term_int[9] = {
- 1073741824, 759250176, 1073741824, 438353280, 219176688, 1073741824, 309962528, 98018768,
- 40015996
-};
-
-// Q31
-const Word32 dirac_gains_norm_term_fx[9] = {
- 2147483647, 1518500352, 2147483647, 876706560, 438353376, 2147483647, 619925056, 196037536, 80031992
-};
-
-// Q27
-const Word32 dirac_gains_Pnm_int[91][9] = {
- { -134217728, 0, 134217728, 0, 0, -134217728, 0, 0, 0 },
- { -134197288, 2342396, 134156400, -7026119, 122639, -134095104, 14049026, -613106, 10701 },
- { -134135976, 4684105, 133972536, -14043751, 490416, -133727536, 28061840, -2450586, 85575 },
- { -134033784, 7024438, 133666264, -21044428, 1102895, -133115936, 42002312, -5506921, 288606 },
- { -133890784, 9362478, 133238096, -28019012, 1959264, -132262040, 55833192, -9772457, 683351 },
- { -133706992, 11697809, 132688440, -34959892, 3058584, -131167848, 69520408, -15234719, 1332861 },
- { -133482480, 14029564, 132017976, -41858120, 4399464, -129836328, 83027720, -21876818, 2299344 },
- { -133217280, 16357047, 131227600, -48705360, 5980272, -128270864, 96320208, -29678480, 3644062 },
- { -132911536, 18679510, 130318176, -55493180, 7799064, -126475552, 109363520, -38615824, 5427104 },
- { -132565296, 20996256, 129290928, -62213284, 9853607, -124455056, 122123976, -48661468, 7707213 },
- { -132178656, 23306694, 128146968, -68857816, 12141505, -122214432, 134569248, -59785232, 10541761 },
- { -131751776, 25609964, 126887800, -75418320, 14659851, -119759704, 146666688, -71952528, 13986158 },
- { -131284736, 27905410, 125514928, -81886824, 17405570, -117097048, 158385376, -85126080, 18094094 },
- { -130777744, 30192412, 124030024, -88255768, 20375446, -114233392, 169695776, -99266128, 22917396 },
- { -130230888, 32470208, 122434848, -94517128, 23565774, -111176104, 180568608, -114328832, 28505376 },
- { -129644368, 34738112, 120731408, -100663320, 26972664, -107933048, 190976128, -130267952, 34905200 },
- { -129018344, 36995424, 118921736, -106686840, 30591964, -104512608, 200891728, -147034448, 42161440 },
- { -128353056, 39241452, 117008088, -112580368, 34419264, -100923608, 210290720, -164576576, 50316080 },
- { -127648640, 41475572, 114992728, -118336848, 38449984, -97175216, 219149232, -182840512, 59408524 },
- { -126905360, 43697012, 112878208, -123949000, 42679048, -93277184, 227444688, -201769248, 69474696 },
- { -126123408, 45905176, 110666976, -129410248, 47101484, -89239304, 235156848, -221304640, 80548296 },
- { -125303040, 48099312, 108361848, -134713792, 51711740, -85072152, 242266352, -241385344, 92659128 },
- { -124444528, 50278820, 105965584, -139853120, 56504308, -80786280, 248755776, -261949392, 105834368 },
- { -123548080, 52443040, 103481048, -144822272, 61473384, -76392608, 254609280, -282932704, 120097808 },
- { -122614016, 54591264, 100911328, -149614784, 66612780, -71902504, 259812912, -304269024, 135469312 },
- { -121642584, 56722880, 98259536, -154225168, 71916384, -67327280, 264354304, -325891904, 151965872 },
- { -120634104, 58837188, 95528944, -158647504, 77377552, -62678672, 268222720, -347732352, 169600480 },
- { -119588872, 60933588, 92722800, -162876704, 82989840, -57968464, 271409984, -369722464, 188383040 },
- { -118507224, 63011412, 89844624, -166907264, 88746208, -53208660, 273908992, -391791360, 208319200 },
- { -117389480, 65070028, 86897888, -170734608, 94639696, -48411356, 275714624, -413868832, 229411120 },
- { -116235952, 67108864, 83886096, -174353936, 100663296, -43588484, 276824064, -435884832, 251658240 },
- { -115047032, 69127240, 80812992, -177760784, 106809472, -38752388, 277236128, -457767936, 275054816 },
- { -113823072, 71124576, 77682296, -180951136, 113070880, -33915128, 276951296, -479447744, 299592224 },
- { -112564464, 73100224, 74497888, -183920976, 119439696, -29088994, 275972448, -500852768, 325257600 },
- { -111271560, 75053584, 71263600, -186666800, 125908272, -24285974, 274304128, -521913568, 352034976 },
- { -109944736, 76984136, 67983320, -189185120, 132468856, -19517968, 271952224, -542560640, 379905024 },
- { -108584440, 78891192, 64661120, -191472992, 139113184, -14796968, 268925472, -562724864, 408843424 },
- { -107191040, 80774240, 61300996, -193527600, 145833472, -10134552, 265233552, -582338944, 438823936 },
- { -105765016, 82632672, 57907084, -195346384, 152621264, -5542341, 260888528, -601335936, 469815200 },
- { -104306760, 84465968, 54483472, -196927072, 159468512, -1031517, 255903808, -619651456, 501783968 },
- { -102816736, 86273488, 51034412, -198267904, 166366624, 3386773, 250294992, -637221056, 534692032 },
- { -101295408, 88054736, 47564080, -199367280, 173307296, 7701825, 244078832, -653983232, 568498944 },
- { -99743224, 89809192, 44076620, -200223728, 180282192, 11903295, 237274256, -669879040, 603161856 },
- { -98160648, 91536272, 40576356, -200836160, 187282720, 15980983, 229901280, -684849728, 638632640 },
- { -96548144, 93235488, 37067500, -201203920, 194300432, 19925212, 221981760, -698840192, 674862144 },
- { -94906272, 94906272, 33554432, -201326592, 201326592, 23726568, 213539056, -711796992, 711796992 },
- { -93235488, 96548144, 30041364, -201203920, 208352752, 27376188, 204597888, -723670016, 749382016 },
- { -91536272, 98160648, 26532496, -200836160, 215370464, 30865648, 195183856, -734411520, 787559936 },
- { -89809200, 99743208, 23032272, -200223728, 222370864, 34186800, 185324752, -743976000, 826268864 },
- { -88054736, 101295408, 19544786, -199367280, 229345888, 37332284, 175048640, -752322176, 865447872 },
- { -86273488, 102816736, 16074439, -198268032, 236286560, 40294912, 164385440, -759410496, 905030144 },
- { -84465944, 104306784, 12625336, -196927072, 243184800, 43068320, 153365504, -765205632, 944950528 },
- { -82632672, 105765016, 9201773, -195346384, 250031920, 45646496, 142020480, -769675200, 985139200 },
- { -80774256, 107191032, 5807891, -193527600, 256819584, 48024044, 130382952, -772789696, 1025526400 },
- { -78891192, 108584440, 2447739, -191472992, 263540000, 50196224, 118485736, -774524480, 1066041600 },
- { -76984120, 109944720, -874438, -189185120, 270184320, 52158672, 106363224, -774856768, 1106610176 },
- { -75053584, 111271544, -4154720, -186666800, 276744864, 53907864, 94049432, -773768704, 1147159552 },
- { -73100224, 112564464, -7389016, -183920976, 283213504, 55440728, 81579720, -771245696, 1187614080 },
- { -71124568, 113823072, -10573435, -180951136, 289582400, 56754824, 68989160, -767276288, 1227898496 },
- { -69127232, 115047064, -13704140, -177760784, 295843776, 57848416, 56313356, -761853888, 1267938048 },
- { -67108880, 116235952, -16777203, -174353936, 301989888, 58720256, 43588536, -754974720, 1307654528 },
- { -65070028, 117389472, -19788994, -170734608, 308013440, 59369844, 30850226, -746639232, 1346972928 },
- { -63011400, 118507224, -22735772, -166907264, 313906944, 59797272, 18134762, -736851968, 1385816832 },
- { -60933588, 119588872, -25613950, -162876704, 319663424, 60003204, 5477891, -725620736, 1424110464 },
- { -58837172, 120634088, -28420080, -158647504, 325275584, 59989016, -7084927, -712957184, 1461778688 },
- { -56722868, 121642576, -31150674, -154225168, 330736768, 59756660, -19517928, -698877184, 1498746240 },
- { -54591276, 122613992, -33802452, -149614784, 336040384, 59308680, -31786382, -683399744, 1534940800 },
- { -52443040, 123548064, -36372160, -144822272, 341179712, 58648260, -43855684, -666547776, 1570288384 },
- { -50278848, 124444520, -38856688, -139853264, 346148864, 57779188, -55691916, -648348160, 1604717952 },
- { -48099324, 125303040, -41252988, -134713792, 350941376, 56705796, -67261816, -628830848, 1638160896 },
- { -45905160, 126123416, -43558124, -129410240, 355551744, 55433036, -78532848, -608029120, 1670546304 },
- { -43697012, 126905360, -45769332, -123949000, 359974080, 53966400, -89473440, -585980480, 1701810944 },
- { -41475560, 127648632, -47883864, -118336808, 364203168, 52311936, -100052728, -562724992, 1731889152 },
- { -39241464, 128353048, -49899212, -112580408, 368233856, 50476188, -110241232, -538305984, 1760719104 },
- { -36995424, 129018360, -51812888, -106686856, 372061216, 48466224, -120010336, -512769824, 1788240512 },
- { -34738100, 129644368, -53622532, -100663280, 375680512, 46289628, -129332608, -486166400, 1814398208 },
- { -32470208, 130230888, -55325984, -94517088, 379087360, 43954400, -138181984, -458547616, 1839134464 },
- { -30192412, 130777744, -56921148, -88255752, 382277728, 41469052, -146533552, -429968768, 1862399872 },
- { -27905450, 131284752, -58406064, -81886920, 385247552, 38842476, -154363936, -400487584, 1884144384 },
- { -25609950, 131751776, -59778952, -75418272, 387993376, 36083912, -161651424, -370163232, 1904324096 },
- { -23306666, 132178656, -61038128, -68857760, 390511712, 33203050, -168375472, -339058272, 1922894464 },
- { -20996270, 132565280, -62182040, -62213328, 392799456, 30209874, -174517136, -307236864, 1939817984 },
- { -18679498, 132911536, -63209344, -55493124, 394854208, 27114732, -180059392, -274765312, 1955057024 },
- { -16357021, 133217280, -64118736, -48705292, 396672992, 23928188, -184986656, -241711232, 1968580864 },
- { -14029578, 133482472, -64909128, -41858176, 398253664, 20661142, -189285248, -208144320, 1980359808 },
- { -11697849, 133706992, -65579560, -34960012, 399594624, 17324636, -192943088, -174134880, 1990369664 },
- { -9362556, 133890784, -66129224, -28019252, 400693888, 13929935, -195949824, -139755008, 1998589184 },
- { -7024411, 134033784, -66557432, -21044346, 401550304, 10488515, -198297168, -105077560, 2004999424 },
- { -4684126, 134135976, -66863648, -14043818, 402162752, 7011926, -199978640, -70176320, 2009588352 },
- { -2342414, 134197304, -67047540, -7026174, 402530496, 3511839, -200989440, -35125516, 2012346496 },
- { -5, 134217728, -67108864, -17, 402653184, 8, -201326592, -88, 2013265920 }
-};
-
-// Q30
-const Word32 dirac_gains_trg_term_int[181][2] = {
- { -1073741824, 93 },
- { -1073578304, -18739436 },
- { -1073087680, -37473000 },
- { -1072270272, -56195404 },
- { -1071126272, -74900440 },
- { -1069655936, -93582656 },
- { -1067859776, -112236624 },
- { -1065738240, -130856168 },
- { -1063292288, -149436080 },
- { -1060522368, -167970160 },
- { -1057429248, -186453440 },
- { -1054014208, -204879600 },
- { -1050278016, -223243376 },
- { -1046221952, -241539408 },
- { -1041847104, -259761664 },
- { -1037154944, -277904896 },
- { -1032146880, -295963392 },
- { -1026824448, -313931616 },
- { -1021189120, -331804480 },
- { -1015242880, -349576096 },
- { -1008987264, -367241408 },
- { -1002424448, -384794592 },
- { -995556160, -402230656 },
- { -988384640, -419544416 },
- { -980912000, -436730112 },
- { -973140608, -453782944 },
- { -965072832, -470697376 },
- { -956710976, -487468704 },
- { -948057792, -504091296 },
- { -939115840, -520560224 },
- { -929887680, -536871040 },
- { -920376384, -553017856 },
- { -910584576, -568996544 },
- { -900515712, -584801664 },
- { -890172480, -600428672 },
- { -879557888, -615873088 },
- { -868675520, -631129536 },
- { -857528320, -646194048 },
- { -846120128, -661061376 },
- { -834454080, -675727744 },
- { -822533888, -690187904 },
- { -810363392, -704438016 },
- { -797945664, -718473536 },
- { -785285056, -732290112 },
- { -772385152, -745883904 },
- { -759250176, -759250176 },
- { -745883904, -772385152 },
- { -732290112, -785285056 },
- { -718473600, -797945664 },
- { -704438016, -810363392 },
- { -690187904, -822533888 },
- { -675727552, -834454144 },
- { -661061376, -846120128 },
- { -646194048, -857528320 },
- { -631129536, -868675392 },
- { -615873088, -879557760 },
- { -600428672, -890172352 },
- { -584801792, -900515712 },
- { -568996544, -910584576 },
- { -553017856, -920376384 },
- { -536871040, -929887680 },
- { -520560224, -939115776 },
- { -504091296, -948057792 },
- { -487468704, -956710976 },
- { -470697376, -965072832 },
- { -453782944, -973140608 },
- { -436730208, -980911936 },
- { -419544416, -988384640 },
- { -402230784, -995556160 },
- { -384794592, -1002424448 },
- { -367241280, -1008987264 },
- { -349576096, -1015242880 },
- { -331804480, -1021189120 },
- { -313931712, -1026824384 },
- { -295963392, -1032146880 },
- { -277904800, -1037154944 },
- { -259761664, -1041847104 },
- { -241539296, -1046221952 },
- { -223243488, -1050278016 },
- { -204879600, -1054014208 },
- { -186453328, -1057429248 },
- { -167970160, -1060522368 },
- { -149435984, -1063292288 },
- { -130856168, -1065738240 },
- { -112236624, -1067859776 },
- { -93582792, -1069655936 },
- { -74900448, -1071126272 },
- { -56195288, -1072270272 },
- { -37473008, -1073087680 },
- { -18739318, -1073578304 },
- { -46, -1073741824 },
- { 18739350, -1073578304 },
- { 37473052, -1073087680 },
- { 56195320, -1072270272 },
- { 74900480, -1071126272 },
- { 93582824, -1069655936 },
- { 112236512, -1067859776 },
- { 130856168, -1065738240 },
- { 149435984, -1063292288 },
- { 167970272, -1060522368 },
- { 186453328, -1057429248 },
- { 204879504, -1054014208 },
- { 223243488, -1050278016 },
- { 241539296, -1046221952 },
- { 259761664, -1041847104 },
- { 277904896, -1037154944 },
- { 295963392, -1032146880 },
- { 313931712, -1026824448 },
- { 331804480, -1021189120 },
- { 349576096, -1015242880 },
- { 367241408, -1008987264 },
- { 384794720, -1002424320 },
- { 402230784, -995556160 },
- { 419544320, -988384640 },
- { 436730112, -980912000 },
- { 453782848, -973140608 },
- { 470697504, -965072832 },
- { 487468576, -956710976 },
- { 504091296, -948057792 },
- { 520560352, -939115776 },
- { 536870912, -929887680 },
- { 553017920, -920376384 },
- { 568996544, -910584704 },
- { 584801664, -900515712 },
- { 600428800, -890172224 },
- { 615873088, -879557888 },
- { 631129536, -868675392 },
- { 646193920, -857528320 },
- { 661061504, -846120064 },
- { 675727616, -834454144 },
- { 690187904, -822533888 },
- { 704438016, -810363136 },
- { 718473536, -797945792 },
- { 732290176, -785285056 },
- { 745883776, -772385216 },
- { 759250176, -759250176 },
- { 772385216, -745883776 },
- { 785285056, -732290112 },
- { 797945664, -718473536 },
- { 810363264, -704438016 },
- { 822533888, -690187904 },
- { 834454144, -675727616 },
- { 846120128, -661061504 },
- { 857528320, -646193920 },
- { 868675392, -631129536 },
- { 879557888, -615873088 },
- { 890172352, -600428800 },
- { 900515712, -584801792 },
- { 910584704, -568996544 },
- { 920376384, -553017920 },
- { 929887680, -536870912 },
- { 939115776, -520560352 },
- { 948057792, -504091296 },
- { 956710976, -487468576 },
- { 965072832, -470697504 },
- { 973140608, -453782944 },
- { 980911936, -436730112 },
- { 988384640, -419544320 },
- { 995556160, -402230784 },
- { 1002424320, -384794592 },
- { 1008987264, -367241280 },
- { 1015242880, -349576096 },
- { 1021189120, -331804480 },
- { 1026824448, -313931712 },
- { 1032146880, -295963392 },
- { 1037154944, -277904800 },
- { 1041847104, -259761664 },
- { 1046221952, -241539296 },
- { 1050278016, -223243488 },
- { 1054014208, -204879600 },
- { 1057429248, -186453328 },
- { 1060522368, -167970272 },
- { 1063292288, -149435984 },
- { 1065738240, -130856168 },
- { 1067859776, -112236624 },
- { 1069655936, -93582760 },
- { 1071126272, -74900440 },
- { 1072270272, -56195308 },
- { 1073087680, -37473052 },
- { 1073578304, -18739382 },
- { 1073741824, 0 }
-};
-
// Q31
const Word32 dirac_gains_trg_term_fx[181][2] = {
{ ( -2147483647 - 1 ), 187 },
@@ -3000,6 +5555,7 @@ const Word32 dirac_gains_trg_term_fx[181][2] = {
{ 2147483647, 0 }
};
+
/*------------------------------------------------------------------------------------------*
* FB ROM tables
*------------------------------------------------------------------------------------------*/
@@ -3048,6 +5604,7 @@ const Word32 ivas_fb_resp_cheby_ramp_16del_fx[IVAS_FB_1MS_16K_SAMP + 1] = {
377921280, 458893152, 547769792, 643727232, 745668672, 852315136, 962208832, 1073741824
};
+
/*------------------------------------------------------------------------------------------*
* SNS MSVQ codebooks and means
*------------------------------------------------------------------------------------------*/
@@ -3508,7 +6065,6 @@ const Word16 ivas_sns_cdbk_tcx10_stage3_fx[8 * 16] = {
-746, 246, 1015, 1707, 1184, -603, -843, -344, -247, -816, -723, -368, 46, 537, 328, -373
};
-
const Word16 *const ivas_sns_cdbks_tcx10_fx[SNS_MSVQ_NSTAGES_TCX10] = {
ivas_sns_cdbk_tcx10_stage1_fx, ivas_sns_cdbk_tcx10_stage2_fx, ivas_sns_cdbk_tcx10_stage3_fx
};
@@ -3643,9 +6199,11 @@ const Word16 *const ivas_sns_cdbks_side_tcx10_fx[SNS_MSVQ_NSTAGES_SIDE] = {
ivas_sns_cdbks_side_tcx10_stage1_fx, ivas_sns_cdbks_side_tcx10_stage2_fx
};
+
/*----------------------------------------------------------------------*
* MC ParamUpmix ROM tables
*-----------------------------------------------------------------------*/
+
const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx = {
33, /* nquant */
16, /* offset */
@@ -5100,7 +7658,6 @@ const Word32 ivas_fb_fr_12band_1ms_im_fx[IVAS_FB_12_1MS_LEN] = {
410948576, 250687680, 84254088
};
-
const Word32 release_cnst_table[4][201] = // Q31
{
{
@@ -5915,8 +8472,6 @@ const Word32 release_cnst_table[4][201] = // Q31
2147272064,
2147277568,
},
-
-
};
/* clang-format on */
diff --git a/lib_com/ivas_rom_com_fx.h b/lib_com/ivas_rom_com_fx.h
deleted file mode 100644
index 4b3b36dfafeba1df2b87ef99c1725a4174c89864..0000000000000000000000000000000000000000
--- a/lib_com/ivas_rom_com_fx.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-#ifndef IVAS_ROM_COM_FX_H
-#define IVAS_ROM_COM_FX_H
-
-#include
-#include "options.h"
-#include "cnst.h"
-#include "ivas_cnst.h"
-#include "stat_com.h"
-#include "ivas_stat_com.h"
-
-
-extern const Word16 ivas_sin_twiddle_480_fx[IVAS_480_PT_LEN >> 1];
-extern const Word16 ivas_cos_twiddle_480_fx[IVAS_480_PT_LEN >> 1];
-extern const Word16 ivas_sin_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
-extern const Word16 ivas_cos_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
-extern const Word16 ivas_sin_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
-extern const Word16 ivas_cos_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
-extern const Word16 ivas_sin_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
-extern const Word16 ivas_cos_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
-extern const Word16 nf_tw_smoothing_coeffs_fx[N_LTP_GAIN_MEMS];
-extern const Word32 dft_res_gains_q_fx[][2];
-extern const Word16 dft_res_cod_alpha_fx[STEREO_DFT_BAND_MAX];
-extern const Word16 dft_trigo_12k8_fx[STEREO_DFT_N_12k8_ENC / 4 + 1];
-extern const Word16 dft_trigo_32k_fx[STEREO_DFT_N_32k_ENC / 4 + 1];
-extern const Word16 dft_trigo_48k_fx[STEREO_DFT_N_MAX_ENC / 4 + 1];
-extern const Word16 gridEq_Table[NO_THETA16_MAX];
-extern const Word32 McMASA_LFEGain_vectors_fx[64]; /* Q25 */
-
-extern const Word16 ivas_divde_255[256];
-
-extern const Word32 ism_azimuth_borders_fx[4];
-extern const Word32 ism_elevation_borders_fx[4];
-
-extern const UWord16 cum_n_for_id_th[122];
-
-/* Multi-channel input and output setups */
-
-extern const Word32 ls_azimuth_CICP1_fx[1];
-extern const Word32 ls_elevation_CICP1_fx[1];
-extern const Word32 ls_azimuth_CICP2_fx[2];
-extern const Word32 ls_elevation_CICP2_fx[2];
-extern const Word32 ls_azimuth_CICP6_fx[5];
-extern const Word32 ls_elevation_CICP6_fx[5];
-extern const Word32 ls_azimuth_CICP12_fx[7];
-extern const Word32 ls_elevation_CICP12_fx[7];
-extern const Word32 ls_azimuth_CICP14_fx[7];
-extern const Word32 ls_elevation_CICP14_fx[7];
-extern const Word32 ls_azimuth_CICP16_fx[9];
-extern const Word32 ls_elevation_CICP16_fx[9];
-extern const Word32 ls_azimuth_CICP19_fx[11];
-extern const Word32 ls_elevation_CICP19_fx[11];
-extern const Word16 pow_10_q11[128];
-extern const Word32 pow_10_q23[14];
-extern const Word16 ivas_sin_az_fx[361];
-extern const Word16 ivas_sine_panning_tbl_fx[601];
-extern const Word16 ivas_tan_panning_gain_dirac_tbl_fx[601];
-
-/*----------------------------------------------------------------------------------*
- * Stereo ICA ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word32 ica_sincInterp2_fx[]; // Q31
-extern const Word32 ica_sincInterp4_fx[]; // Q31
-extern const Word32 ica_sincInterp6_fx[]; // Q31
-
-/*----------------------------------------------------------------------------------*
- * Stereo IC-BWE ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word16 pow_10_icbwe_gsMapping_tbl_fx[];
-extern const Word16 pow_10_icbwe_gsMappingDFT_tbl_fx[];
-
-/*----------------------------------------------------------------------------------*
- * TD Stereo ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const UWord32 tdm_ratio_tabl_fx[TDM_NQ + 1];
-extern const Word32 tdm_ratio_tabl_fx_Q30[TDM_NQ + 1];
-extern const Word32 tdm_ratio_tabl_fx_Q24[TDM_NQ + 1];
-extern const UWord32 tdm_den_ratio_tabl_fx[];
-extern const Word16 icbwe_gsMapping_tbl_fx[]; // Q12
-extern const Word16 icbwe_gsMappingDFT_tbl_fx[]; // Q12
-
-/* LSFs Intra-frame prediction tables */
-extern const Word16 tdm_LSF_MEAN_RE_USE_OUT_fx[M];
-extern const Word16 tdm_LSF_MEAN_RE_USE_IN_fx[M];
-extern const Word16 tdm_LSF_MEAN_RE_USE_fx[M];
-
-extern const Word16 tdm_Beta_Q1bit_re_use_13k2_fx[2];
-extern const Word16 tdm_Beta_Q1bit_re_use_16k4_fx[2];
-extern const Word16 tdm_Beta_Q1bit_re_use_24k4_32k_fx[2];
-extern const Word16 tdm_Beta_Q1bit_re_use_48k_fx[2];
-
-extern const Word16 tdm_RE_USE_adaptive_beta_prd_diag_3_fx[15 + 16 + 15];
-
-extern const Word16 tdm_LSF_MEAN_PRED_QNT_OUT_fx[M];
-extern const Word16 tdm_LSF_MEAN_PRED_QNT_IN_fx[M];
-extern const Word16 tdm_LSF_MEAN_PRED_QNT_fx[M];
-extern const Word16 tdm_PRED_QNT_fixed_beta_prd_diag_3_fx[15 + 16 + 15];
-
-/*----------------------------------------------------------------------------------*
- * Stereo DTX ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS];
-extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS];
-
-/*----------------------------------------------------------------------------------*
- * DirAC ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word32 diffuseness_reconstructions_fx[DIRAC_DIFFUSE_LEVELS];
-extern const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1];
-extern const Masa_Diffuseness_Ratios masa_diffuse_ratios[DIRAC_DIFFUSE_LEVELS][DIRAC_DIFFUSE_LEVELS];
-
-/*------------------------------------------------------------------------------------------*
- * SPAR ROM tables
- *------------------------------------------------------------------------------------------*/
-
-extern const Word32 dtx_pd_real_min_max_fx[2];
-extern const Word32 one_by_q_level[64];
-
-/*----------------------------------------------------------------------------------*
- * Parametric MC ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word16 ivas_param_mc_quant_ild_5d1_48_fx[PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
-extern const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER];
-
-/*----------------------------------------------------------------------------------*
- * MASA ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA];
-extern const Word32 azimuth_cb_fx[8];
-extern const Word32 delta_theta_masa_fx[NO_SPHERICAL_GRIDS - 2];
-extern const Word16 coherence_cb0_masa_Q14[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH];
-extern const Word32 coherence_cb0_masa_fx[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH];
-extern const Word16 coherence_cb1_masa_Q15[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */
-extern const Word32 coherence_cb1_masa_fx[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */
-
-/* Multi-channel input and output setups */
-extern const Word16 ls_azimuth_CICP2_idx[2];
-extern const Word16 ls_elevation_CICP2_idx[2];
-extern const Word16 ls_azimuth_CICP6_idx[5];
-extern const Word16 ls_elevation_CICP6_idx[5];
-extern const Word16 ls_azimuth_CICP12_idx[7];
-extern const Word16 ls_elevation_CICP12_idx[7];
-extern const Word16 ls_azimuth_CICP14_idx[7];
-extern const Word16 ls_elevation_CICP14_idx[7];
-extern const Word16 ls_azimuth_CICP16_idx[9];
-extern const Word16 ls_elevation_CICP16_idx[9];
-extern const Word16 ls_azimuth_CICP19_idx[11];
-extern const Word16 ls_elevation_CICP19_idx[11];
-
-extern const Word32 shoebox_sin_cos_tbl_fx[11][2];
-
-extern const Word32 delta_phi_val[90];
-extern const Word32 inv_delta_phi_val[90];
-extern const Word32 dd_val[90];
-extern const Word32 cb_azi_chan_fx[]; // Q22
-extern const Word16 cb_azi_chan_16fx[]; // Q0
-
-/*----------------------------------------------------------------------------------*
- * MASA and ISM (OMASA) combined format ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word32 dct4_fx[];
-extern const Word32 dct5_fx[];
-extern const Word32 dct8_fx[];
-extern const Word32 dct12_fx[];
-
-/*----------------------------------------------------------------------------------*
- * ISM ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word32 ism_azimuth_borders_fx[4];
-extern const Word32 ism_elevation_borders_fx[4];
-
-/*----------------------------------------------------------------------------------*
- * LFE coding ROM tables
- *----------------------------------------------------------------------------------*/
-
-extern const Word32 ivas_lpf_4_butter_16k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2];
-extern const Word16 ivas_lpf_4_butter_16k_sos_e[IVAS_BIQUAD_FILT_LEN << 2];
-extern const Word32 ivas_lpf_4_butter_32k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2];
-extern const Word16 ivas_lpf_4_butter_32k_sos_e[IVAS_BIQUAD_FILT_LEN << 2];
-extern const Word32 ivas_lpf_4_butter_48k_sos_fx[IVAS_BIQUAD_FILT_LEN << 2];
-extern const Word16 ivas_lpf_4_butter_48k_sos_e[IVAS_BIQUAD_FILT_LEN << 2];
-#ifndef NONBE_FIX_MC_LFE_LPF
-extern const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1];
-extern const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1];
-extern const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1];
-#endif
-
-extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; // Q31
-extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; // Q31
-extern const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K]; // Q31
-
-extern const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2];
-
-/*------------------------------------------------------------------------------------------*
- * MDFT/iMDFT ROM tables
- *------------------------------------------------------------------------------------------*/
-
-extern const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1];
-extern const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1];
-extern const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1];
-extern const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1];
-extern const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1];
-extern const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1];
-extern const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1];
-extern const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1];
-extern const Word32 dirac_gains_norm_term_int[9];
-extern const Word32 dirac_gains_norm_term_fx[9];
-extern const Word32 dirac_gains_Pnm_int[91][9];
-extern const Word32 dirac_gains_trg_term_int[181][2];
-extern const Word32 dirac_gains_trg_term_fx[181][2];
-
-/*------------------------------------------------------------------------------------------*
- * FB ROM tables
- *------------------------------------------------------------------------------------------*/
-
-extern const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP];
-extern const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP];
-extern const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP];
-extern const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP];
-extern const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP];
-extern const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP];
-
-extern const Word32 ivas_fb_resp_cheby_ramp_32del_fx[IVAS_FB_1MS_32K_SAMP + 1];
-extern const Word32 ivas_fb_resp_cheby_ramp_16del_fx[IVAS_FB_1MS_16K_SAMP + 1];
-
-/*------------------------------------------------------------------------------------------*
- * SNS MSVQ codebooks and means
- *------------------------------------------------------------------------------------------*/
-
-extern const Word16 *const ivas_sns_cdbks_tcx20_fx[];
-extern const Word16 *const ivas_sns_cdbks_tcx10_fx[];
-
-extern const Word16 *const ivas_sns_cdbks_side_tcx20_fx[];
-extern const Word16 *const ivas_sns_cdbks_side_tcx10_fx[];
-
-/*----------------------------------------------------------------------*
- * MC ParamUpmix ROM tables
- *-----------------------------------------------------------------------*/
-
-extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx;
-extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9];
-
-extern const Word32 ivas_han_win_48k_fx[L_FRAME32k];
-extern const Word32 ivas_han_win_32k_fx[L_FRAME32k];
-extern const Word32 ivas_han_win_16k_fx[L_FRAME32k];
-
-extern const Word32 ivas_sine_delay_32_fx[32];
-
-extern const Word32 ivas_sine_frame_len_640_del_32_fx[577];
-extern const Word32 ivas_sine_frame_len_640_del_16_fx[289];
-
-extern const Word32 ivas_fb_fr_12band_1ms_re_fx[IVAS_FB_12_1MS_LEN];
-extern const Word32 ivas_fb_fr_12band_1ms_im_fx[IVAS_FB_12_1MS_LEN];
-
-
-/*----------------------------------------------------------------------*
- * Limiter tables
- *-----------------------------------------------------------------------*/
-
-extern const Word32 release_cnst_table[4][201]; // Q31
-
-#endif
diff --git a/lib_com/ivas_rotation_com.c b/lib_com/ivas_rotation_com_fx.c
similarity index 99%
rename from lib_com/ivas_rotation_com.c
rename to lib_com/ivas_rotation_com_fx.c
index 78a0837ab41197d83544338508a5575c5876201d..a922082f7242efab7483136bb97b39b77346eec8 100644
--- a/lib_com/ivas_rotation_com.c
+++ b/lib_com/ivas_rotation_com_fx.c
@@ -44,6 +44,8 @@
#include "wmc_auto.h"
#include "basop_util.h"
#include "enh64.h"
+
+
/*-------------------------------------------------------------------------
* Euler2Quat()
*
diff --git a/lib_com/ivas_sba_config_fx.c b/lib_com/ivas_sba_config_fx.c
index 999caf3cc11e27012bd7624b6afa75236c2cc897..4caa22da2a0b258d80f3dcc3068db56af2c80911 100644
--- a/lib_com/ivas_sba_config_fx.c
+++ b/lib_com/ivas_sba_config_fx.c
@@ -167,14 +167,13 @@ Word16 ivas_sba_get_nchan_fx(
}
-#ifdef NONBE_FIX_1052_SBA_EXT
/*-------------------------------------------------------------------*
* ivas_sba_spar_sid_bitlen_fx()
*
- * Get number of bits in SPAR SID frame
+ * Get number of bits in SBA SID frame
*-------------------------------------------------------------------*/
-/*! r: number of bits in SPAR SID frame */
+/*! r: number of bits in SBA SID frame */
Word16 ivas_sba_spar_sid_bitlen_fx(
const Word16 nchan_transport /* i : number of transport channels */
)
@@ -189,7 +188,7 @@ Word16 ivas_sba_spar_sid_bitlen_fx(
return num_bits;
}
-#endif
+
/*-------------------------------------------------------------------*
* ivas_sba_get_nchan_metadata()
diff --git a/lib_com/ivas_spar_com_fx.c b/lib_com/ivas_spar_com_fx.c
index 69922637d969092d0bf7b5073d0a665570147d47..685d8de54245ba5dc3b79f32e24167c8d77ecb91 100644
--- a/lib_com/ivas_spar_com_fx.c
+++ b/lib_com/ivas_spar_com_fx.c
@@ -44,7 +44,6 @@
#include "basop_util.h"
#include "basop32.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*------------------------------------------------------------------------------------------*
@@ -802,7 +801,7 @@ static void ivas_get_pred_coeffs_enc_fx(
tmp64 = W_mult0_32_32( w_norm_fac, dm_w ); // Q=q_tmp
IF( LT_16( q_tmp, q_cov_real[0][0][b] ) )
{
- tmp64 = W_shr( tmp64, sub( q_cov_real[0][0][b], q_tmp ) ); // Q=q_tmp
+ tmp64 = W_shr( tmp64, s_min( 63, sub( q_cov_real[0][0][b], q_tmp ) ) ); // Q=q_tmp
}
ELSE
{
@@ -2370,6 +2369,37 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
}
ELSE IF( EQ_16( num_dmx, 3 ) )
{
+#ifdef FIX_1970_SBA_CRASH
+ Word64 re64[2];
+ Word32 re32[2], re32_2;
+ Word16 qtmp2;
+ set64_fx( re64, 0, 2 );
+ q_tmp = 63;
+ FOR( j = 0; j < 2; j++ )
+ {
+ FOR( k = 0; k < 2; k++ )
+ {
+ W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][k], cov_dd_re[k][j] ); // q_C_re+q_cov_dd_re
+ re64[j] = W_add( re64[j], W_tmp );
+ move64();
+ }
+ q_tmp = s_min( q_tmp, sub( W_norm( re64[j] ), 33 ) );
+ }
+ FOR( j = 0; j < 2; j++ )
+ {
+ re32[j] = W_shl_sat_l( re64[j], q_tmp ); // q_C_re+q_cov_dd_re+q_tmp
+ move32();
+ }
+ qtmp2 = add( add( q_C_re, q_tmp ), q_cov_dd_re );
+ W_tmp = W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][0], re32[0] ); // q_C_re+qtmp2
+ W_tmp = W_add( W_tmp, W_mult0_32_32( pSparMd->band_coeffs[b_ts_idx].C_re_fx[0][1], re32[1] ) ); // q_C_re+qtmp2
+ q_tmp = sub( W_norm( W_tmp ), 33 );
+ re32_2 = W_shl_sat_l( W_tmp, q_tmp ); // q_C_re+qtmp2+q_tmp
+ qtmp2 = add( add( q_C_re, q_tmp ), qtmp2 );
+ q_tmp = s_min( 63, qtmp2 );
+ recon_uu_re[0][0] = L_max( 0, re32_2 );
+ move32();
+#else
Word32 re1[2], re2;
Word16 q_re1[2];
set32_fx( re1, 0, 2 );
@@ -2442,6 +2472,7 @@ static void ivas_calc_p_coeffs_per_band_enc_fx(
recon_uu_re[0][0] = L_add( recon_uu_re[0][0], re2 ); // q_tmp
move32();
+#endif
IF( LT_16( q_cov_uu_re, q_tmp ) )
{
diff --git a/lib_com/ivas_spar_com_quant_util_fx.c b/lib_com/ivas_spar_com_quant_util_fx.c
index cfd03a3b3e68d51d66045229266e9f412a564231..8e84e4e374273d2b97988a01283fac18405d859d 100644
--- a/lib_com/ivas_spar_com_quant_util_fx.c
+++ b/lib_com/ivas_spar_com_quant_util_fx.c
@@ -37,7 +37,6 @@
#include "ivas_rom_com.h"
#include
#include "wmc_auto.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
@@ -215,19 +214,17 @@ void ivas_quantise_real_values_enc_fx(
move32();
}
}
+
return;
}
+
/*-----------------------------------------------------------------------------------------*
* Function ivas_spar_get_uniform_quant_strat()
*
* Sets the quant strat values
*-----------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------*
- * Function ivas_spar_get_uniform_quant_strat_fx()
- *
- * Sets the quant strat values
- *-----------------------------------------------------------------------------------------*/
+
void ivas_spar_get_uniform_quant_strat_fx(
ivas_spar_md_com_cfg *pSpar_md_com_cfg,
const Word16 table_idx )
diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h
index 847442c35ec12dfcc6ef295995e71a5fde700668..1f7ea778d06534d594480c2be3ad04c0278fed6d 100644
--- a/lib_com/ivas_stat_com.h
+++ b/lib_com/ivas_stat_com.h
@@ -65,6 +65,18 @@ typedef struct
Word32 yaw_fx; /* yaw value read from the input metadata file */ /* Q22 */
Word32 pitch_fx; /* pitch value read from the input metadata file */ /* Q22 */
+#ifdef OBJ_EDITING_API
+ Word32 gain_fx; /* Q31 */
+
+ Word32 edited_azimuth_fx; /* Q22 */
+ Word32 edited_elevation_fx; /* Q22 */
+ Word16 edited_radius_fx; /* Q9 */
+
+ Word32 edited_yaw_fx; /* Q22 */
+ Word32 edited_pitch_fx; /* Q22 */
+ Word32 edited_gain_fx; /* Q31 */
+#endif
+
Word16 non_diegetic_flag; /* Non-diegetic (non-headtracked) object flag */
ISM_METADATA_ANGLE position_angle; /* Angle structs for azimuth and elevation */
diff --git a/lib_com/ivas_stereo_ica_com_fx.c b/lib_com/ivas_stereo_ica_com_fx.c
index 8548797a4134d1805618080459a0f8ec38631269..11f16d0a5fde3f8b3f14e48230b90860028650ce 100644
--- a/lib_com/ivas_stereo_ica_com_fx.c
+++ b/lib_com/ivas_stereo_ica_com_fx.c
@@ -41,7 +41,6 @@
#include "rom_com.h"
#include "ivas_rom_com.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*---------------------------------------------------------------
* interpTargetChannel_fx()
@@ -51,69 +50,89 @@
* ---------------------------------------------------------------*/
#define SPREAD_FACTOR1 ( 1.0f / INTERP_FACTOR1 )
-Word32 table_596[N_MAX_SHIFT_CHANGE + 1] = {
+
+static Word32 table_596[N_MAX_SHIFT_CHANGE + 1] = {
0, 2441216, 1220608, 813738, 610304, 488243, 406869, 348745,
305152, 271246, 244121, 221928, 203434, 187785, 174372, 162747,
152576, 143600, 135623, 128485, 122060
}; // Q12
-Word32 inv_table_596[N_MAX_SHIFT_CHANGE + 1] = {
+static Word32 inv_table_596[N_MAX_SHIFT_CHANGE + 1] = {
0, 7206320, 14412641, 21618962, 28825283, 36031605, 43237924, 50444244,
57650567, 64856889, 72063211, 79269528, 86475849, 93682173, 100888489, 108094813,
115301135, 122507459, 129713778, 136920096, 144126422
}; // Q31
-Word32 tableD1_596[N_MAX_SHIFT_CHANGE + 1] = {
+
+static Word32 tableD1_596[N_MAX_SHIFT_CHANGE + 1] = {
0, 216, 1731, 5842, 13849, 27049, 46741, 74223,
110794, 157752, 216396, 288023, 373932, 475422, 593791, 730337,
886359, 1063155, 1262023, 1484262, 1731170
}; // Q35
-Word32 table_298[N_MAX_SHIFT_CHANGE + 1] = {
+static Word32 table_298[N_MAX_SHIFT_CHANGE + 1] = {
0, 1220608, 610304, 406869, 305152, 244121, 203434, 174372,
152576, 135623, 122060, 110964, 101717, 93892, 87186, 81373,
76288, 71800, 67811, 64242, 61030
}; // Q12
-Word32 inv_table_298[N_MAX_SHIFT_CHANGE + 1] = {
+
+static Word32 inv_table_298[N_MAX_SHIFT_CHANGE + 1] = {
0, 14412641, 28825283, 43237924, 57650567, 72063211, 86475849, 100888489,
115301135, 129713778, 144126422, 158539056, 172951698, 187364347, 201776979, 216189627,
230602270, 245014919, 259427557, 273840192, 288252845
}; // Q31
-Word32 tableD1_298[N_MAX_SHIFT_CHANGE + 1] = {
+
+static Word32 tableD1_298[N_MAX_SHIFT_CHANGE + 1] = {
0, 1731, 13849, 46741, 110794, 216396, 373932, 593791,
886359, 1262023, 1731170, 2304187, 2991462, 3803381, 4750330, 5842699,
7090873, 8505240, 10096185, 11874096, 13849363
}; // Q35
-Word32 table_290[N_MAX_SHIFT_CHANGE + 1] = {
+static Word32 table_290[N_MAX_SHIFT_CHANGE + 1] = {
0, 1187840, 593920, 395946, 296960, 237568, 197973, 169691,
148480, 131982, 118784, 107985, 98986, 91372, 84845, 79189,
74240, 69872, 65991, 62517, 59392
}; // Q12
-Word32 inv_table_290[N_MAX_SHIFT_CHANGE + 1] = {
+
+static Word32 inv_table_290[N_MAX_SHIFT_CHANGE + 1] = {
0, 14810232, 29620464, 44430697, 59240928, 74051160, 88861394, 103671628,
118481856, 133292091, 148102320, 162912554, 177722789, 192533022, 207343256, 222153473,
236963712, 251773958, 266584183, 281394409, 296204640
}; // Q31
-Word32 tableD1_290[N_MAX_SHIFT_CHANGE + 1] = { 0, 1878, 15027, 50717, 120219, 234803, 405740, 644300,
- 961755, 1369374, 1878428, 2500187, 3245924, 4126907, 5154407, 6339694,
- 7694041, 9228719, 10954993, 12884138, 15027425 }; // Q35
+static Word32 tableD1_290[N_MAX_SHIFT_CHANGE + 1] = {
+ 0, 1878, 15027, 50717, 120219, 234803, 405740, 644300,
+ 961755, 1369374, 1878428, 2500187, 3245924, 4126907, 5154407, 6339694,
+ 7694041, 9228719, 10954993, 12884138, 15027425
+}; // Q35
-Word32 table_145[N_MAX_SHIFT_CHANGE + 1] = {
+
+static Word32 table_145[N_MAX_SHIFT_CHANGE + 1] = {
0, 593920, 296960, 197973, 148480, 118784, 98986, 84845,
74240, 65991, 59392, 53992, 49493, 45686, 42422, 39594,
37120, 34936, 32995, 31258, 29696
}; // Q12
-Word32 inv_table_145[N_MAX_SHIFT_CHANGE + 1] = {
+
+static Word32 inv_table_145[N_MAX_SHIFT_CHANGE + 1] = {
0, 29620464, 59240928, 88861394, 118481856, 148102320, 177722789, 207343256,
236963712, 266584183, 296204640, 325825109, 355445578, 385066045, 414686513, 444306946,
473927425, 503547916, 533168367, 562788819, 592409281
}; // Q31
-Word32 tableD1_145[N_MAX_SHIFT_CHANGE + 1] = { 0, 15027, 120219, 405740, 961755, 1878428, 3245924, 5154407,
- 7694041, 10954993, 15027425, 20001503, 25967392, 33015256, 41235259, 50717555,
- 61552334, 73829752, 87639951, 103073111, 120219402 }; // Q35
+
+static Word32 tableD1_145[N_MAX_SHIFT_CHANGE + 1] = {
+ 0, 15027, 120219, 405740, 961755, 1878428, 3245924, 5154407,
+ 7694041, 10954993, 15027425, 20001503, 25967392, 33015256, 41235259, 50717555,
+ 61552334, 73829752, 87639951, 103073111, 120219402
+}; // Q35
+
+
+/*---------------------------------------------------------------
+ * Function interpTargetChannel_fx()
+ *
+ *
+ *---------------------------------------------------------------*/
+
static void interpTargetChannel_fx(
Word32 *target_fx, // qsynth
const Word16 prevShift, // Q0
@@ -269,7 +288,6 @@ static void interpTargetChannel_fx(
x_fx[3] = L_add( x_fx[2], interp_factor2_fx ); // Q12
move32();
-
res_a1 = L_sub( tempF1_fx, x_fx[0] ); // Q12
res_a2 = L_sub( tempF1_fx, x_fx[1] ); // Q12
res_a3 = L_sub( tempF1_fx, x_fx[2] ); // Q12
@@ -320,11 +338,13 @@ static void interpTargetChannel_fx(
return;
}
+
/*---------------------------------------------------------------
* Function targetCh_AlignStereoDFT()
*
* Align target channel in DFT stereo to correct FOR shift variations
* ---------------------------------------------------------------*/
+
static void targetCh_AlignStereoDFT_fx(
Word32 *target_fx, // qsynth
const Word16 prevShift, // Q0
@@ -385,11 +405,13 @@ static void targetCh_AlignStereoDFT_fx(
return;
}
+
/*---------------------------------------------------------------
* adjustTargetSignal()
*
* Target signal correction FOR shift variations.
* ---------------------------------------------------------------*/
+
void adjustTargetSignal_fx(
Word32 *target_fx, // qsynth
const Word16 prevShift, // Q0
diff --git a/lib_com/ivas_stereo_td_bit_alloc_fx.c b/lib_com/ivas_stereo_td_bit_alloc_fx.c
index 27732e3a2fa8d111443feed4caef58c48b5b979f..fe18e7bad6caea89ed7c019b09a57943b5499eeb 100644
--- a/lib_com/ivas_stereo_td_bit_alloc_fx.c
+++ b/lib_com/ivas_stereo_td_bit_alloc_fx.c
@@ -40,7 +40,6 @@
#include "prot_fx.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-------------------------------------------------------------------*
@@ -555,12 +554,9 @@ return;
*-------------------------------------------------------------------*/
void td_stereo_param_updt_fx(
- const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */
- const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */
- const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- Word16 tdm_lspQ_PCh_fx[], /* o : Q LSPs for primary channel Q15 */
-#endif
+ const Word16 lsp_old_PCh_fx[], /* i : primary channel old LSPs Q15 */
+ const Word16 lsf_old_PCh_fx[], /* i : primary channel old LSFs Qlog2(2.56) */
+ const Word16 pitch_buf_PCh_fx[], /* i : primary channel pitch buffer Q6 */
Word16 tdm_lsfQ_PCh_fx[], /* o : Q LSFs for primary channel Qlog2(2.56) */
Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */
const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag Q0*/
@@ -574,56 +570,16 @@ void td_stereo_param_updt_fx(
{
/*not being assert*/
Copy( IAWB_Ave_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
-
-#ifdef FIX_1111_TDM_LSP_BUFFER
- IF( tdm_lspQ_PCh_fx != NULL )
- {
- lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
- }
-#else
- lsf2lsp_fx( tdm_lsfQ_PCh_fx, tdm_lspQ_PCh_fx, M, INT_FS_12k8 );
-#endif
-#endif
}
ELSE IF( EQ_16( flag_ACELP16k, 1 ) )
{
-#ifdef FIX_1111_TDM_LSP_BUFFER
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- IF( tdm_lspQ_PCh_fx != NULL )
- {
- Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
- lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
- lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
- }
- ELSE
- {
-#endif
- Word16 lsp_temp[M];
- Copy( lsp_old_PCh_fx, lsp_temp, M ); /*Q15*/
- lsp_convert_poly_fx( lsp_temp, L_FRAME, 0 );
- lsp2lsf_fx( lsp_temp, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- }
-#endif
-#else
- Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
- lsp_convert_poly_fx( tdm_lspQ_PCh_fx, L_FRAME, 0 );
- lsp2lsf_fx( tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
-#endif
+ Word16 lsp_temp[M];
+ Copy( lsp_old_PCh_fx, lsp_temp, M ); /*Q15*/
+ lsp_convert_poly_fx( lsp_temp, L_FRAME, 0 );
+ lsp2lsf_fx( lsp_temp, tdm_lsfQ_PCh_fx, M, INT_FS_12k8 );
}
ELSE
{
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
-#ifdef FIX_1111_TDM_LSP_BUFFER
- IF( tdm_lspQ_PCh_fx != NULL )
- {
- Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
- }
-#else
- Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/
-#endif
-#endif
Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/
}
diff --git a/lib_com/ivas_tools_fx.c b/lib_com/ivas_tools_fx.c
index fad7c0549f851b388860792efe12da9516a66a6d..9001276bf722b5119aeb3458377a247a80ed0add 100644
--- a/lib_com/ivas_tools_fx.c
+++ b/lib_com/ivas_tools_fx.c
@@ -606,9 +606,6 @@ Word64 dot_product_cholesky_fixed(
{
Word16 i, j;
Word64 suma, tmp_sum;
-#ifndef OPT_MCT_ENC_V3_BE
- Word32 mul;
-#endif
Word32 tmp;
const Word32 *pt_x, *pt_A;
pt_A = A;
@@ -623,20 +620,10 @@ Word64 dot_product_cholesky_fixed(
FOR( j = 0; j <= i; j++ )
{
-#ifdef OPT_MCT_ENC_V3_BE
tmp_sum = W_add( tmp_sum, Mpy_32_32( *pt_x++, *pt_A++ ) );
-#else
- mul = Mpy_32_32( *pt_x++, *pt_A++ );
- tmp_sum = W_add( tmp_sum, W_deposit32_l( mul ) );
-#endif
}
-#ifdef OPT_MCT_ENC_V3_BE
tmp = W_shl_sat_l( tmp_sum, -4 ); // to make sure that the tmp_sum will not overflow
-#else
- tmp_sum = W_shr( tmp_sum, 4 ); // to make sure that the tmp_sum will not overflow
- tmp = W_extract_l( tmp_sum );
-#endif
suma = W_mac_32_32( suma, tmp, tmp );
}
diff --git a/lib_com/lag_wind_fx.c b/lib_com/lag_wind_fx.c
index 9fb2872711d553565e75f883d9ddeafaef19cd40..fd203805baabbe835078cf1125729b97e1ee6e04 100644
--- a/lib_com/lag_wind_fx.c
+++ b/lib_com/lag_wind_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/lerp_fx.c b/lib_com/lerp_fx.c
index 6f148057faa5dba000aa064e5e4ba169de6781ec..88492ecdb11e61a9c65645076a111ef749dda374 100644
--- a/lib_com/lerp_fx.c
+++ b/lib_com/lerp_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/longarith.c b/lib_com/longarith.c
index c5ace652c336a07802482ef76ace28690b51b749..5983c11f8a7730be0ecb9eb469831d04f8fff361 100644
--- a/lib_com/longarith.c
+++ b/lib_com/longarith.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c
index 8ffaf0bfb68f0d065cd35092b06a26f14c8c63de..8b323e96aba8615f793409f2753ad7e006cfcadc 100644
--- a/lib_com/low_rate_band_att_fx.c
+++ b/lib_com/low_rate_band_att_fx.c
@@ -39,9 +39,11 @@ void ivas_fine_gain_pred_fx(
Word16 tmp, exp, exp2;
Word32 L_tmp;
UWord16 lsb;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
FOR( band = 0; band < num_sfm; band++ )
@@ -81,7 +83,11 @@ void ivas_fine_gain_pred_fx(
tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) );
Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */
+#else
gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */
+#endif
test();
test();
IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */
@@ -96,8 +102,12 @@ void ivas_fine_gain_pred_fx(
exp = add( exp, exp2 );
/*gp *= 1.0f - 0.05f / accuracy; */
- tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */
+ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
+#else
+ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
+#endif
tmp = sub( 32767, tmp );
tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
gp = mult_r( tmp, gp ); /*15+12+1-16=12 */
@@ -154,9 +164,11 @@ void fine_gain_pred_fx(
Word16 tmp, exp, exp2;
Word32 L_tmp;
UWord16 lsb;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
FOR( band = 0; band < num_sfm; band++ )
@@ -187,9 +199,13 @@ void fine_gain_pred_fx(
exp = norm_l( xx );
L_tmp = L_shl( xx, exp ); /*2*(15-shift)+exp */
exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) );
- L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */
- Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */
+ L_tmp = Isqrt_lc( L_tmp, &exp ); /*31 - exp */
+ Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb ); /*31-exp+11-15=27-exp */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */
+#else
gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */
+#endif
test();
test();
IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */
@@ -204,8 +220,12 @@ void fine_gain_pred_fx(
exp = add( exp, exp2 );
/*gp *= 1.0f - 0.05f / accuracy; */
- tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */
+ tmp = div_s( 13107, accuracy ); /* 0.05 in Q18 */
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
+#else
+ tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
+#endif
tmp = sub( 32767, tmp );
tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
gp = mult_r( tmp, gp ); /*15+12+1-16=12 */
diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c
index 1035f017a5b95b59efef409b5dead1f1e95ea326..c8cc09e7308abd312616ee304c2aae9a9b9e1fe1 100644
--- a/lib_com/lpc_tools_fx.c
+++ b/lib_com/lpc_tools_fx.c
@@ -409,8 +409,10 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word
{
Word16 approx /*, hi, lo, n_hi , n_lo*/;
Word32 L_32;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/* First approximation: 1 / L_denom = 1/denom_hi */
@@ -427,7 +429,11 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word
L_32 = Mpy_32_32( L_num, L_32 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_32 = L_shl_sat( L_32, 2 );
+#else
L_32 = L_shl_o( L_32, 2, &Overflow );
+#endif
return ( L_32 );
}
@@ -463,9 +469,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
Word32 t0, t1, t2; /* temporary variables */
Word16 flag;
Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
BASOP_SATURATE_WARNING_OFF_EVS
@@ -526,12 +534,21 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */
+#else
t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */
- /* No overflow possible */
+#endif
+ /* No overflow possible */
/* Compose and add R[i] in Q3 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_mac_sat( t0, Rl[i], 1 );
+ t0 = L_msu_sat( t0, Rh[i], -32768 );
+#else
t0 = L_mac_o( t0, Rl[i], 1, &Overflow );
t0 = L_msu_o( t0, Rh[i], -32768, &Overflow );
+#endif
/* K = -t0 / Alpha */
t1 = L_abs( t0 );
@@ -546,7 +563,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
{
t2 = L_negate( t2 ); /* K =-t0/Alpha */
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */
+#else
t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */
+#endif
test();
if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) )
{
@@ -585,7 +606,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */
/* Alpha = Alpha * (1-K**2) */
- t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */
+#else
+ t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */
+#endif
t0 = L_mac( t1, mult( Kh, Kl ), 2 );
t0 = L_abs( t0 ); /* Some case <0 !! */
t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */
@@ -621,7 +646,11 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
FOR( i = 1; i <= order; i++ )
{
t0 = L_Comp( Ah[i], Al[i] );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ A[i] = round_fx_sat( L_shl_sat( t0, k ) );
+#else
A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow );
+#endif
move16();
}
@@ -657,9 +686,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
Word32 t0, t1, t2; /* temporary variables */
Word16 flag;
Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
BASOP_SATURATE_WARNING_OFF_EVS
@@ -720,12 +751,21 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */
+#else
t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */
- /* No overflow possible */
+#endif
+ /* No overflow possible */
/* Compose and add R[i] in Q3 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_mac_sat( t0, Rl[i], 1 );
+ t0 = L_msu_sat( t0, Rh[i], -32768 );
+#else
t0 = L_mac_o( t0, Rl[i], 1, &Overflow );
t0 = L_msu_o( t0, Rh[i], -32768, &Overflow );
+#endif
/* K = -t0 / Alpha */
t1 = L_abs( t0 );
@@ -740,7 +780,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
{
t2 = L_negate( t2 ); /* K =-t0/Alpha */
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */
+#else
t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */
+#endif
test();
if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) )
{
@@ -779,7 +823,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */
/* Alpha = Alpha * (1-K**2) */
- t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */
+#else
+ t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */
+#endif
t0 = L_mac( t1, mult( Kh, Kl ), 2 );
t0 = L_abs( t0 ); /* Some case <0 !! */
t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */
@@ -815,7 +863,11 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
FOR( i = 1; i <= order; i++ )
{
t0 = L_Comp( Ah[i], Al[i] );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ A[i] = round_fx_sat( L_shl_sat( t0, k ) );
+#else
A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow );
+#endif
move16();
}
@@ -851,10 +903,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
Word32 t0, t1, t2; /* temporary variables */
Word16 flag;
Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
BASOP_SATURATE_WARNING_OFF_EVS
@@ -915,12 +969,21 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_shl_sat( t0, 4 ); /* result in Q27 -> convert to Q31 */
+#else
t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */
- /* No overflow possible */
+#endif
+ /* No overflow possible */
/* Compose and add R[i] in Q3 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_mac_sat( t0, Rl[i], 1 );
+ t0 = L_msu_sat( t0, Rh[i], -32768 );
+#else
t0 = L_mac_o( t0, Rl[i], 1, &Overflow );
t0 = L_msu_o( t0, Rh[i], -32768, &Overflow );
+#endif
/* K = -t0 / Alpha */
t1 = L_abs( t0 );
@@ -935,7 +998,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
{
t2 = L_negate( t2 ); /* K =-t0/Alpha */
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha */
+#else
t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha */
+#endif
test();
if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) )
{
@@ -974,7 +1041,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27 */
/* Alpha = Alpha * (1-K**2) */
- t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t1 = L_mult_sat( Kh, Kh ); /* K*K in Q31 */
+#else
+ t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K in Q31 */
+#endif
t0 = L_mac( t1, mult( Kh, Kl ), 2 );
t0 = L_abs( t0 ); /* Some case <0 !! */
t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K in Q31 */
@@ -1010,7 +1081,11 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
FOR( i = 1; i <= order; i++ )
{
t0 = L_Comp( Ah[i], Al[i] );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ A[i] = L_shl_sat( t0, k );
+#else
A[i] = L_shl_o( t0, k, &Overflow );
+#endif
move16();
}
@@ -1478,9 +1553,11 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
Word16 lpc[19];
move16();
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* half length FFT */
@@ -1656,6 +1733,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) );
Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) );
BASOP_SATURATE_WARNING_OFF_EVS
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im );
+ move16();
+ tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re );
+ move16();
+ BASOP_SATURATE_WARNING_ON_EVS
+ RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re );
+ move16();
+ ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im );
+ move16();
+ BASOP_SATURATE_WARNING_OFF_EVS
+ tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re );
+ move16();
+ tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re );
+ move16();
+#else
tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow );
move16();
tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow );
@@ -1670,6 +1763,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
move16();
tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow );
move16();
+#endif
BASOP_SATURATE_WARNING_ON_EVS
RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im );
move16();
@@ -1690,6 +1784,22 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) );
Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) );
BASOP_SATURATE_WARNING_OFF_EVS
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im );
+ move16();
+ tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re );
+ move16();
+ BASOP_SATURATE_WARNING_ON_EVS
+ RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re );
+ move16();
+ ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im );
+ move16();
+ BASOP_SATURATE_WARNING_OFF_EVS
+ tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re );
+ move16();
+ tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re );
+ move16();
+#else
tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow );
move16();
tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow );
@@ -1704,6 +1814,7 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
move16();
tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow );
move16();
+#endif
BASOP_SATURATE_WARNING_ON_EVS
RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im );
move16();
diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c
index ea5e51cefa7b2eea7aef7f8fcf7f36c3ba244d26..80e597e1a07643a50a49c3ab2572ba08989a3cea 100644
--- a/lib_com/lsf_tools_fx.c
+++ b/lib_com/lsf_tools_fx.c
@@ -69,8 +69,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift
Word16 cheb;
Word32 t0, b1, b2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
cheb = norm_s( x );
@@ -108,16 +110,26 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift
b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */
/* i = 5 */
t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ if ( !cheb )
+ t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */
+#else
if ( !cheb )
t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */
- t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */
- b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */
+#endif
+ t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */
+ b1 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */
/* i = 6 */
t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ if ( !cheb )
+ t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */
+#else
if ( !cheb )
t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */
- t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */
+#endif
+ t0 = L_sub( t0, b2 ); /* t0 = 2*x*b1 - b2 */
}
/* IF (sub(n,8) == 0) */
IF( n == 8 )
@@ -125,10 +137,15 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift
b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i] */
/* i = 7 */
t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ if ( !cheb )
+ t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1 */
+#else
if ( !cheb )
t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1 */
- t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */
- /*b1 = L_add(b2,0);*/
+#endif
+ t0 = L_sub( t0, b1 ); /* t0 = 2*x*b1 - b2 */
+ /*b1 = L_add(b2,0);*/
}
ELSE
{
@@ -146,9 +163,14 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift
BASOP_SATURATE_WARNING_OFF_EVS
- t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */
- cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */
- cheb = s_max( -32767, cheb ); /* to avoid saturation */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */
+ cheb = round_fx_sat( t0 ); /* Result in Q14 */
+#else
+ t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */
+ cheb = round_fx_o( t0, &Overflow ); /* Result in Q14 */
+#endif
+ cheb = s_max( -32767, cheb ); /* to avoid saturation */
BASOP_SATURATE_WARNING_ON_EVS
return ( cheb );
}
@@ -162,8 +184,10 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is
Word32 t0, t1;
Word16 scale = 1024;
move16();
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/*-------------------------------------------------------------*
@@ -286,7 +310,11 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is
* xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow)
*--------------------------------------------------------*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y = sub_sat( yhigh, ylow );
+#else
y = sub_o( yhigh, ylow, &Overflow );
+#endif
IF( y != 0 )
{
x = sub( xhigh, xlow );
@@ -1222,9 +1250,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
Word16 nc;
Word32 t0;
Word16 Ovf, Ovf2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
/*-----------------------------------------------------*
@@ -1255,7 +1285,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
{
f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] );
move32();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] );
+#else
f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow );
+#endif
move32();
}
@@ -1265,11 +1299,19 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
*-----------------------------------------------------*/
t0 = L_deposit_l( 0 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ FOR( i = 1; i <= nc; i++ )
+ {
+ t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) );
+ t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) );
+ }
+#else
FOR( i = 1; i <= nc; i++ )
{
t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) );
t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) );
}
+#endif
k = s_min( norm_l( t0 ), 6 );
a[0] = shl( 256, k );
move16();
@@ -1283,6 +1325,16 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
FOR( i = 1; i <= nc; i++ )
{
/* a[i] = 0.5*(f1[i] + f2[i]) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ t0 = L_add_sat( f1[i], f2[i] );
+ t0 = L_shl( t0, k );
+ a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */
+
+ /* a[j] = 0.5*(f1[i] - f2[i]) */
+ t0 = L_sub_sat( f1[i], f2[i] );
+ t0 = L_shl( t0, k );
+ a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */
+#else
t0 = L_add_o( f1[i], f2[i], &Overflow );
t0 = L_shl( t0, k );
a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */
@@ -1290,7 +1342,8 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
/* a[j] = 0.5*(f1[i] - f2[i]) */
t0 = L_sub_o( f1[i], f2[i], &Overflow );
t0 = L_shl( t0, k );
- a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */
+ a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */
+#endif
j--;
}
@@ -1734,8 +1787,10 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */
Word16 m, j, n;
Word16 q, q_a, q_a2, One_Qx;
Word32 One_Qx2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
q = add( norm_s( a[-1] ), 1 );
q_a = sub( 15, q );
@@ -1796,32 +1851,40 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */
FOR( j = 0; j < m / 2; j++ )
{
n = sub( sub( m, (Word16) 1 ), j );
- L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */
+ L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */
+ L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */
+ L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */
+ L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
+ L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */
+ f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */
+ f_fx[n] = round_fx_sat( L_tmp2 ); /* extracting in q_a */
+#else
L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */
L_tmp2 = L_mult( denom_mant, f_fx[n] ); /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */
L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */
-#ifdef ISSUE_1799_replace_L_shr_o
- L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
- L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */
-#else
- L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
- L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */
+ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
+ L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */
+ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
+ f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */
#endif
- f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
- f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */
}
IF( m & 1 )
{
- L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */
- L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */
-#ifdef ISSUE_1799_replace_L_shr_o
- L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
+ L_tmp1 = L_mult( denom_mant, f_fx[j] ); /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */
+ L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
+ f_fx[j] = round_fx_sat( L_tmp1 ); /* extracting in q_a */
+ move16();
#else
- L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
-#endif
- f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
+ L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */
+ L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
+ f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
move16();
+#endif
}
}
@@ -2273,8 +2336,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
Word16 i, m;
Word32 L_tmp;
Word16 tmp, e;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/*-------------------------------------------------------------------*
@@ -2320,13 +2385,17 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
}
e = sub( 30 - 21 - 1, e );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/
+#else
tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/
+#endif
tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14 */
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */
#else
- tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */
+ tmp = shl_o( tmp, 1, &Overflow ); /* Q14 -> Q15 with saturation */
#endif
tmp = s_max( tmp, 0 );
@@ -2364,8 +2433,10 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability
Word16 i, m;
Word32 L_tmp;
Word16 tmp, e;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/*-------------------------------------------------------------------*
@@ -2417,7 +2488,11 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability
}
e = sub( 30 - 21 - 1, e );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/
+#else
tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/
+#endif
// tmp = sub(20480, tmp); /* 1.25 - tmp in Q14 */
tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12 */
@@ -3776,8 +3851,10 @@ Word16 root_search_fx( Word16 low,
Word32 v_high, vh;
Word32 Ltemp, L_tmp1, L_tmp, Ltmp;
Word16 exp1, tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
v_high = polynomial_eval_fx( high, coef, order ); /* v_high has the value at high index */
@@ -3845,9 +3922,13 @@ Word16 root_search_fx( Word16 low,
L_tmp1 = L_shl( L_tmp, exp1 );
tmp = extract_h( L_tmp1 );
exp1 = sub( 30 - 25, exp1 );
- tmp = div_s( 16384, tmp ); /* 15+exp1 */
- Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */
- Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */
+ tmp = div_s( 16384, tmp ); /* 15+exp1 */
+ Ltmp = Mult_32_16( *v_low, tmp ); /* 15+exp1+25-15 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) ); /* Q31 */
+#else
+ Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */
+#endif
if ( LT_32( *v_low, vh ) )
{
Ltemp = L_negate( Ltemp );
diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c
index 2e989cfbf5b9d819257cd086c85f48fc955c21d6..e9d5413b3bbb9c30f0616b1a225bb6ebe7b986a3 100644
--- a/lib_com/lsp_conv_poly_fx.c
+++ b/lib_com/lsp_conv_poly_fx.c
@@ -9,7 +9,6 @@
#include "prot_fx.h"
#include "wmc_auto.h"
-
/*-------------------------------------------------------------------*
* Local constants
*-------------------------------------------------------------------*/
@@ -336,8 +335,10 @@ static Word32 b_inv_sq(
Word16 m_den, exp_den;
Word16 div_out;
Word32 Ltmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
exp_den = norm_l( in32 );
@@ -345,14 +346,17 @@ static Word32 b_inv_sq(
exp_den = add( sub( 30, exp_den ), sub( 16, exp_in ) );
m_den = mult_r( m_den, m_den );
-#ifdef ISSUE_1796_replace_shl_o
- exp_den = shl_sat( exp_den, 1 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exp_den = shl( exp_den, 1 );
+
+ div_out = div_s( 8192, m_den );
+ Ltmp = L_shl_sat( div_out, add( sub( 30 - 13, exp_den ), 15 ) ); /*Q15*/
#else
exp_den = shl_o( exp_den, 1, &Overflow );
-#endif
div_out = div_s( 8192, m_den );
Ltmp = L_shl_o( div_out, add( sub( 30 - 13, exp_den ), 15 ), &Overflow ); /*Q15*/
+#endif
return Ltmp;
}
@@ -368,8 +372,10 @@ static Word32 inv_pow(
Word32 mh;
UWord16 ml;
Word32 r0, s0;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
IF( re == 0 )
@@ -382,7 +388,11 @@ static Word32 inv_pow(
{
exp1 = norm_l( re );
tmp = extract_h( L_shl( re, exp1 ) );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 );
+#else
L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 );
+#endif
Mpy_32_16_ss( L_tmp, x, &mh, &ml );
r0 = L_add( L_tmp, mh );
}
@@ -397,7 +407,11 @@ static Word32 inv_pow(
{
exp2 = norm_l( se );
tmp = extract_h( L_shl( se, exp2 ) );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shr( L_mult_sat( tmp, tmp ), 1 );
+#else
L_tmp = L_shr( L_mult_o( tmp, tmp, &Overflow ), 1 );
+#endif
Mpy_32_16_ss( L_tmp, x, &mh, &ml );
s0 = L_sub( L_tmp, mh );
}
@@ -427,7 +441,7 @@ static Word32 inv_pow(
}
tmp = div_s( (Word16) ( ( 1 << 14 ) - 1 ), tmp );
exp1 = add( exp1, exp2 );
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
L_tmp = L_shr_sat( tmp, sub( 31, exp1 ) ); /* result in Q15 */
#else
L_tmp = L_shr_o( tmp, sub( 31, exp1 ), &Overflow ); /* result in Q15 */
@@ -509,8 +523,10 @@ static void spectautocorr_fx(
UWord16 ml;
Word32 r[M + 1];
Word16 exp0;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/*---------------------------------------------------------------------*
@@ -533,7 +549,11 @@ static void spectautocorr_fx(
move32();
FOR( i = 2; i < N - 1; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ r[0] = L_add_sat( r[0], G[i] );
+#else
r[0] = L_add_o( r[0], G[i], &Overflow );
+#endif
move32();
}
@@ -567,18 +587,47 @@ static void spectautocorr_fx(
move16(); /* 1.0 in Q15 */
FOR( i = 1; i < imid; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gp = L_add_sat( G[i], G[N - i - 1] );
+#else
gp = L_add_o( G[i], G[N - i - 1], &Overflow );
+#endif
gn = L_sub( G[i], G[N - i - 1] );
/*r[1] = L_mac(r[1], x[i-1], gn);*/
Mpy_32_16_ss( gn, x[i - 1], &mh, &ml );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ r[1] = L_add_sat( r[1], mh );
+#else
r[1] = L_add_o( r[1], mh, &Overflow );
+#endif
move32();
c[1] = x[i - 1];
move16();
FOR( j = 2; j < M; j += 2 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ c[j] = mult_r( c[j - 1], x[i - 1] );
+ move16();
+ c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) );
+ move16();
+
+ /*r[j] = L_mac(r[j], c[j], gp);*/
+ Mpy_32_16_ss( gp, c[j], &mh, &ml );
+ r[j] = L_add_sat( r[j], mh );
+ move32();
+
+ c[j + 1] = mult_r( c[j], x[i - 1] );
+ move16();
+ c[j + 1] = add_sat( c[j + 1], sub_sat( c[j + 1], c[j - 1] ) );
+ move16();
+
+ /*r[j+1] = L_mac(r[j+1], c[j+1], gn);*/
+ Mpy_32_16_ss( gn, c[j + 1], &mh, &ml );
+ r[j + 1] = L_add_sat( r[j + 1], mh );
+ move32();
+#else
c[j] = mult_r( c[j - 1], x[i - 1] );
move16();
c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow );
@@ -598,33 +647,55 @@ static void spectautocorr_fx(
Mpy_32_16_ss( gn, c[j + 1], &mh, &ml );
r[j + 1] = L_add_o( r[j + 1], mh, &Overflow );
move32();
+#endif
}
c[j] = mult_r( c[j - 1], x[i - 1] );
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ c[j] = add_sat( c[j], sub_sat( c[j], c[j - 2] ) );
+ move16();
+
+ Mpy_32_16_ss( gp, c[j], &mh, &ml );
+ r[j] = L_add_sat( r[j], mh );
+ move32();
+#else
c[j] = add_o( c[j], sub_o( c[j], c[j - 2], &Overflow ), &Overflow );
move16();
Mpy_32_16_ss( gp, c[j], &mh, &ml );
r[j] = L_add_o( r[j], mh, &Overflow );
move32();
+#endif
}
/*---------------------------------------------------------------------*
* Add the endpoints x = cos(0) = 1 and x = cos(pi) = -1 as
* well as the lower half of the unit circle.
*---------------------------------------------------------------------*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gp = L_shr( L_add_sat( G[0], G[N - 1] ), 1 );
+ gn = L_shr( L_sub( G[0], G[N - 1] ), 1 );
+
+ r[0] = L_add_sat( r[0], gp );
+#else
gp = L_shr( L_add_o( G[0], G[N - 1], &Overflow ), 1 );
gn = L_shr( L_sub( G[0], G[N - 1] ), 1 );
r[0] = L_add_o( r[0], gp, &Overflow );
+#endif
move32();
exp0 = norm_l( r[0] );
L_Extract( L_shl( r[0], exp0 ), &rh[0], &rl[0] );
FOR( j = 1; j < M; j += 2 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_Extract( L_shl( L_add_sat( r[j], gn ), exp0 ), &rh[j], &rl[j] );
+ L_Extract( L_shl( L_add_sat( r[j + 1], gp ), exp0 ), &rh[j + 1], &rl[j + 1] );
+#else
L_Extract( L_shl( L_add_o( r[j], gn, &Overflow ), exp0 ), &rh[j], &rl[j] );
L_Extract( L_shl( L_add_o( r[j + 1], gp, &Overflow ), exp0 ), &rh[j + 1], &rl[j + 1] );
+#endif
}
return;
diff --git a/lib_com/math_op.c b/lib_com/math_op.c
index 74143b8ed40d03dd8eff19bf7ca2c39cff1b3d54..ac92eec20ec7091e9f5da4e3394e4b13395dbdb8 100644
--- a/lib_com/math_op.c
+++ b/lib_com/math_op.c
@@ -228,20 +228,30 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val
{
Word16 i, sft, tmp;
Word32 L_sum;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
L_sum = 0; /* just to avoid superflous compiler warning about uninitialized use of L_sum */
IF( expi == 0 )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_sum = L_mac_sat( 1, x[0], x[0] );
+ FOR( i = 1; i < lg; i++ )
+ {
+ L_sum = L_mac_sat( L_sum, x[i], x[i] );
+ }
+#else
L_sum = L_mac_o( 1, x[0], x[0], &Overflow );
FOR( i = 1; i < lg; i++ )
{
L_sum = L_mac_o( L_sum, x[i], x[i], &Overflow );
}
+#endif
}
IF( expi < 0 )
{
@@ -251,26 +261,32 @@ Word32 Energy_scale( /* (o) : Q31: normalized result (1 < val
FOR( i = 1; i < lg; i++ )
{
tmp = mult_r( x[i], sft );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_sum = L_mac_sat( L_sum, tmp, tmp );
+#else
L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow );
+#endif
}
}
IF( expi > 0 )
{
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp = shl_sat( x[0], expi );
+ L_sum = L_mac_sat( 1, tmp, tmp );
+ FOR( i = 1; i < lg; i++ )
+ {
+ tmp = shl_sat( x[i], expi );
+ L_sum = L_mac_sat( L_sum, tmp, tmp );
+ }
#else
tmp = shl_o( x[0], expi, &Overflow );
-#endif
L_sum = L_mac_o( 1, tmp, tmp, &Overflow );
FOR( i = 1; i < lg; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
- tmp = shl_sat( x[i], expi );
-#else
tmp = shl_o( x[i], expi, &Overflow );
-#endif
L_sum = L_mac_o( L_sum, tmp, tmp, &Overflow );
}
+#endif
}
/* Normalize acc in Q31 */
diff --git a/lib_com/mime.h b/lib_com/mime.h
index 6e9e5fc87f48c20b650b2872fcf0401ec05bcbfa..5a6eb8fee6fa6d13cc0b0d558ad994cc63542ccf 100644
--- a/lib_com/mime.h
+++ b/lib_com/mime.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef MIME_H
#define MIME_H
diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c
index fae2a43c2f5c1330d63dc06c1e3e21886d58fb7d..b54efcea8f15dcb60e1ddc3e8d62432d40016aff 100644
--- a/lib_com/modif_fs_fx.c
+++ b/lib_com/modif_fs_fx.c
@@ -75,7 +75,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
Word16 flag_low_order = 0;
move16();
Word16 filt_len_tmp;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -279,7 +279,7 @@ Word16 modify_Fs_ivas_fx( /* o : length of output Q
test();
IF( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
{
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
num_den = shl_sat( num_den, 1 );
#else
num_den = shl_o( num_den, 1, &Overflow );
@@ -364,7 +364,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
Word16 flag_low_order = 0;
move16();
Word16 filt_len_tmp;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -565,7 +565,7 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
if ( GT_32( fin, 16000 ) && ( EQ_16( lg_out, L_FRAME ) || EQ_16( lg_out, L_FRAME16k ) || EQ_16( lg_out, 512 ) ) )
{
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
num_den = shl_sat( num_den, 1 );
#else
num_den = shl_o( num_den, 1, &Overflow );
@@ -941,9 +941,11 @@ void Decimate_allpass_steep_fx(
Word32 Lacc, Lacc1;
Word16 temp1, temp2;
Word16 sum = 0;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
move16();
@@ -953,60 +955,103 @@ void Decimate_allpass_steep_fx(
FOR( k = 0; k < N / 2; k++ )
{
- Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[2 * k] ); /* Q(16+x) */
+ Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */
+ temp1 = extract_h( Lacc ); /* Qx */
+ Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */
+#else
Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[2 * k], &Overflow ); /* Q(16+x) */
Lacc1 = L_deposit_h( in_fx[2 * k] ); /* Q16+Qx */
temp1 = extract_h( Lacc ); /* Qx */
Lacc1 = L_msu_o( Lacc1, AP1_STEEP_FX[0], temp1, &Overflow ); /* Q16+Qx */
- mem[0] = extract_h( Lacc1 ); /* Qx */
+#endif
+ mem[0] = extract_h( Lacc1 ); /* Qx */
temp[0] = temp1;
move16();
move16();
- Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */
- Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */
+ Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc1 = ( L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ) ); /* Q16+Qx */
- temp2 = extract_h( Lacc1 ); /* Qx */
- Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */
- mem[1] = extract_h( Lacc ); /* Qx */
+ temp2 = extract_h( Lacc1 ); /* Qx */
+ Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */
+#else
+ Lacc1 = ( L_mac_o( Lacc1, AP1_STEEP_FX[1], temp1, &Overflow ) ); /* Q16+Qx */
+
+ temp2 = extract_h( Lacc1 ); /* Qx */
+ Lacc = L_msu_o( Lacc, AP1_STEEP_FX[1], temp2, &Overflow ); /* Q16+Qx */
+#endif
+ mem[1] = extract_h( Lacc ); /* Qx */
temp[1] = temp2;
move16();
move16();
- Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ out_fx[k] = extract_h( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */
+ move16();
+ mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k] ) ); /* Qx */
+ move16();
+#else
out_fx[k] = extract_h( L_mac_o( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ) ); /* Qx format */
move16();
mem[ALLPASSSECTIONS_STEEP - 1] = extract_h( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[k], &Overflow ) ); /* Qx */
move16();
+#endif
}
/* lower allpass filter chain */
- Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+ Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+ temp1 = extract_h( Lacc ); /* Qx */
+ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */
+#else
Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], mem[2 * ALLPASSSECTIONS_STEEP], &Overflow ); /*Q(16+x) */
Lacc1 = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
temp1 = extract_h( Lacc ); /* Qx */
Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */
+#endif
mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 );
temp[0] = temp1;
move16();
- Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */
- Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */
- temp2 = extract_h( Lacc1 ); /* Qx */
+ Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */
+ temp2 = extract_h( Lacc1 ); /* Qx */
temp[1] = temp2;
move16();
- Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */
- mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */
+ Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */
+#else
+ Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */
+ temp2 = extract_h( Lacc1 ); /* Qx */
+ temp[1] = temp2;
+ move16();
+ Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */
+#endif
+ mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */
move16();
- Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
+ temp[2] = extract_h( Lacc ); /* temp[2] in Qx */
+ move16();
+ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */
+#else
Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2, &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
temp[2] = extract_h( Lacc ); /* temp[2] in Qx */
move16();
Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */
- mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */
+#endif
+ mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */
move16();
sum = mult_r( out_fx[0], 16384 ); /* Qx */
out_fx[0] = add_sat( sum, mult_r( temp[ALLPASSSECTIONS_STEEP - 1], 16384 ) ); /* Qx */
@@ -1017,11 +1062,18 @@ void Decimate_allpass_steep_fx(
{
- Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
- Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */
- Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */
- temp1 = extract_h( Lacc ); /* Qx */
- Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1] ); /* Q(16+x):temp[0] */
+ Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */
+ temp1 = extract_h( Lacc ); /* Qx */
+ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */
+#else
+ Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[2 * k - 1], &Overflow ); /* Q(16+x):temp[0] */
+ Lacc1 = L_deposit_h( in_fx[2 * k - 1] ); /* Q(16+x) */
+ temp1 = extract_h( Lacc ); /* Qx */
+ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */
+#endif
mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */
move16();
@@ -1029,9 +1081,23 @@ void Decimate_allpass_steep_fx(
move16();
- Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */
- Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */
- temp2 = extract_h( Lacc1 ); /* Qx */
+ Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc1 = L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */
+ temp2 = extract_h( Lacc1 ); /* Qx */
+ temp[1] = temp2;
+ move16();
+ Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */
+ mem[ALLPASSSECTIONS_STEEP + 1] = extract_h( Lacc ); /* Qx */
+
+
+ Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
+ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1] ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
+ temp[2] = extract_h( Lacc ); /*temp[2] in Qx */
+ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2] ); /* Q(16+x) */
+#else
+ Lacc1 = L_mac_o( Lacc1, AP2_STEEP_FX[1], temp1, &Overflow ); /* Q(16+x) */
+ temp2 = extract_h( Lacc1 ); /* Qx */
temp[1] = temp2;
move16();
Lacc = L_msu_o( Lacc, AP2_STEEP_FX[1], temp2, &Overflow ); /* Q(16+x) */
@@ -1042,7 +1108,8 @@ void Decimate_allpass_steep_fx(
Lacc = L_mac_o( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[1], &Overflow ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
temp[2] = extract_h( Lacc ); /*temp[2] in Qx */
Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp[2], &Overflow ); /* Q(16+x) */
- mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */
+#endif
+ mem[2 * ALLPASSSECTIONS_STEEP - 1] = extract_h( Lacc1 ); /* Qx */
sum = mult_r( out_fx[k], 16384 ); /* Qx */
@@ -1158,9 +1225,11 @@ void Interpolate_allpass_steep_fx(
Word16 k;
Word32 Lacc = 0, Lacc1 = 0;
Word16 temp1, temp2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*** State in Q0,in_fx Q0, AP1_STEEP in Q15 AP2_STEEP in Q15 OP in Q0 ************/
/*upper allpass filter chain */
@@ -1168,11 +1237,34 @@ void Interpolate_allpass_steep_fx(
FOR( k = 0; k < N; k++ )
{
- Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */
- Lacc = L_mac_o( Lacc, AP2_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */
- Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */
- temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */
- Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( Lacc, AP2_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */
+ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */
+ temp1 = round_fx_sat( Lacc ); /* Qx */
+ Lacc1 = L_msu_sat( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */
+
+ mem[0] = round_fx_sat( Lacc1 );
+ move16();
+ Lacc1 = L_deposit_h( mem[1] ); /* Q(16+x) */
+ Lacc1 = ( L_mac_sat( Lacc1, AP2_STEEP_FX[1], temp1 ) ); /* Q(16+x):temp[1] */
+ Lacc = L_deposit_h( temp1 );
+
+ temp2 = round_fx_sat( Lacc1 ); /* Qx */
+ Lacc = L_msu_sat( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */
+ mem[1] = round_fx_sat( Lacc ); /* Qx */
+ move16();
+
+ Lacc1 = L_deposit_h( temp2 );
+ Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
+ out_fx[2 * k + 1] = round_fx_sat( L_mac_sat( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */
+ move16();
+ mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1] ) ); /* Qx */
+ move16();
+#else
+ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */
+ temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */
+ Lacc1 = L_msu_o( Lacc1, AP2_STEEP_FX[0], temp1, &Overflow ); /* Q(16+x) */
mem[0] = round_fx_o( Lacc1, &Overflow );
move16();
@@ -1191,13 +1283,36 @@ void Interpolate_allpass_steep_fx(
move16();
mem[ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k + 1], &Overflow ), &Overflow ); /* Qx */
move16();
+#endif
}
/* lower allpass filter chain */
FOR( k = 0; k < N; k++ )
{
- Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Lacc = L_mac_sat( Lacc, AP1_STEEP_FX[0], in_fx[k] ); /* Q(16+x):temp[0] */
+ Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */
+ temp1 = round_fx_sat( Lacc ); /* Qx */
+ Lacc1 = L_msu_sat( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q(16+x) */
+
+ mem[ALLPASSSECTIONS_STEEP] = round_fx_sat( Lacc1 );
+ Lacc1 = L_deposit_h( mem[ALLPASSSECTIONS_STEEP + 1] ); /* Q(16+x) */
+ Lacc1 = L_mac_sat( Lacc1, AP1_STEEP_FX[1], temp1 ); /* Q(16+x):temp[1] */
+
+ temp2 = round_fx_sat( Lacc1 ); /* Qx */
+ Lacc = L_deposit_h( temp1 );
+ Lacc = L_msu_sat( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q(16+x) */
+ mem[ALLPASSSECTIONS_STEEP + 1] = round_fx_sat( Lacc ); /* Qx */
+
+ Lacc = L_deposit_h( mem[2 * ALLPASSSECTIONS_STEEP - 1] ); /* Q(16+x) */
+ Lacc1 = L_deposit_h( temp2 );
+ out_fx[2 * k] = round_fx_sat( L_mac_sat( Lacc, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], temp2 ) ); /* Qx format */
+ move16();
+ mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_sat( L_msu_sat( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k] ) ); /* Qx */
+ move16();
+#else
Lacc = L_mac_o( Lacc, AP1_STEEP_FX[0], in_fx[k], &Overflow ); /* Q(16+x):temp[0] */
Lacc1 = L_deposit_h( in_fx[k] ); /* Q(16+x) */
temp1 = round_fx_o( Lacc, &Overflow ); /* Qx */
@@ -1218,6 +1333,7 @@ void Interpolate_allpass_steep_fx(
move16();
mem[2 * ALLPASSSECTIONS_STEEP - 1] = round_fx_o( L_msu_o( Lacc1, AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1], out_fx[2 * k], &Overflow ), &Overflow ); /* Qx */
move16();
+#endif
}
return;
diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c
index be34a12481f96713597bce743c203af7811e3719..d8966dbab9914381ca5466a2d2772b34f3665c18 100644
--- a/lib_com/oper_32b.c
+++ b/lib_com/oper_32b.c
@@ -124,13 +124,20 @@ Word32 L_Comp( Word16 hi, Word16 lo )
Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 )
{
Word32 L_32;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
L_32 = L_mult( hi1, hi2 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 );
+ L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 );
+#else
L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow );
L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow );
+#endif
return ( L_32 );
}
@@ -159,13 +166,21 @@ Word32 Mpy_32( Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 )
Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 )
{
Word32 L_32;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_32 = L_mac_sat( L_num, hi1, hi2 );
+ L_32 = L_mac_sat( L_32, mult( hi1, lo2 ), 1 );
+ L_32 = L_mac_sat( L_32, mult( lo1, hi2 ), 1 );
+#else
L_32 = L_mac_o( L_num, hi1, hi2, &Overflow );
L_32 = L_mac_o( L_32, mult( hi1, lo2 ), 1, &Overflow );
L_32 = L_mac_o( L_32, mult( lo1, hi2 ), 1, &Overflow );
+#endif
return ( L_32 );
}
@@ -193,12 +208,19 @@ Word32 Mac_32( Word32 L_num, Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2 )
Word32 Sqr_32( Word16 hi, Word16 lo )
{
Word32 L_32;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_32 = L_mult_sat( hi, hi );
+ L_32 = L_mac_sat( L_32, mult( hi, lo ), 2 );
+#else
L_32 = L_mult_o( hi, hi, &Overflow );
L_32 = L_mac_o( L_32, mult( hi, lo ), 2, &Overflow );
+#endif
return ( L_32 );
}
diff --git a/lib_com/options.h b/lib_com/options.h
index b475b76230cd6e6e927e330756d9bedf7c187838..f4cd6568be2930ff8b47fe820d0d0466d338b041 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef OPTIONS_H
@@ -72,65 +72,101 @@
#endif
/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
-#define OPT_MCT_ENC_V3_BE
-#define OPT_BIN_REND_V2_NBE
-
-#define FIX_1348_BIT_PRECISION_IMPROVEMENT
-#define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
-#define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
-
-#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */
-
-#define FIX_1762_COMPILER_ISSUE_NEW /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */
-#define ISSUE_1796_replace_shl_o /* FhG: replace shl_ro by overflow-free alternatives - BE*/
-#define ISSUE_1799_replace_L_shr_o /* FhG: replace by non-overflow-alternative - BE */
-
-#define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */
-
-#define FIX_1824
-#define FIX_1822
-
-#define FIX_ISSUE_1764 /* NTT: update renorm and use abs */
-#define FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 1931 */
-#define FIX_1844_MISSING_FREE /* FhG: add missing free in ivas_binRenderer_convModuleClose_fx() */
+#define FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 2166 */
+#define ISSUE_1836_replace_overflow_libcom /* FhG: BE - replace overflow operators by non-overflow-alternatives in lib_com */
+#define ISSUE_1867_replace_overflow_libenc /* FhG: BE - replace overflow operators by non-overflow-alternatives all over the lib_enc module */
+#define FIX_1942_ASSERTION_LOWSHELF /* FhG: Modified the target_gains_db_fx calculation in compute_t60_coeffs_fx() */
+#define FIX_1944_CRASH_FOR_STEREO /* FhG: improve TonalMDCTConceal_InsertNoise calculation precision */
+#define FIX_1970_SBA_CRASH /* Dlb: Fix for issue 1970, SBA crash */
+
+#define FIX_1978_SAT_MISSING_IN_GAIN_ENC /* VA: Fix add saturation missing that lead to a crash in P800-10 */
+#define FIX_1981_MAXIMUM_EXP_FX /* FhG: Fix bug in function to find maximum value in vector */
+#define FIX_1981_MAXIMUM_EXP_FX_ZEROMANTISSA /* FhG: Fix bug in function to find maximum value in vector:zero-mantissa fix*/
+
+#define FIX_1979_SAT_MISSING_IN_LSF_ENC /* VA: Proposal to fix 1979, saturation in lsf_enc, NOkia to review */
+#define FIX_1946_CRASH_JBM_PROCESSING /* FhG: Increased guard bits of DFT_fx */
+#define FIX_1980_CRASH_FDCNG_ENCODESID /* FhG: Add one bit of headroom in e_fx calculation in FdCng_encodeSID_ivas_fx() */
+#define FIX_1987_CRASH_OMASA_ENERGY /* FhG: Replace cldfbAnalysis_ts_fx_fix_q() with cldfbAnalysis_ts_fx_var_q() to avoid assertion error */
+#define FIX_1985_SBA_714_HF_LOSS /* Dlb: Fix for issue 1985, improved dirac ref pow precision*/
+#define FIX_1819_EIGENVALUE_ERROR /* FhG: Workaround for zero eigenvalue: replace with epsilon if det != 0*/
+#define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure. */
+#define FIX_1995_REVERB_INIT /* VA/Nokia: issue 1995: Fix use-of-uninitialized-value in ivas_binaural_reverb_init() */
+#define FIX_1996_MASKING_NOISE /* Dlb: Heavy precision loss in ola buffers causing discontinuity*/
+#define FIX1998_APA_EXEC_SCALING /* FhG: fix scaling of apa_exec_ivas_fx(); avoid continuously worse scaling with previous data */
+#define FIX2007_BASSPSFILTER_OVERFLOW /* FhG: use saturing operator, to avoid overflow in bass_psfilter_fx() */
+#define FIX_ISSUE_2004_LPC_SHB_SAT /* Dolby: Issue 2004: prevent saturation of the LPC SHB filter */
+
+#define FIX_2009_HIGH_NOISE_FLOOR_FOR_FX_DEC /* FhG: Corrected the q_input in the input of generate_masking_noise_dirac_ivas_fx() */
+#define FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES /* Eri/FhG: Issue 2013 fix for dtx discontinuities */
+#define FIX_ISSUE_2013_MDCT_STEREO_FER_DISCONTINUITIES /* Eri/FhG: Issue 2013 fix for FER discontinuities */
+#define FIX_2000_NON_LINEARITY_OVERSHOOT /* Eri: Issue 2000: SWB TBE energy overshoot in non-linearity. Aligns with float */
+#define FIX_2010_PREP_TBE_EXC /* FhG: fix issues with varying Q-values for code_preQ_fx[] */
+#define FIX_2025_FDCNG_MULT /* Nokia, FhG: Fix LB FDCNG noise introduced by changing mult to i_mult */
+
+#define FIX_1962_FORMAT_CONV_SPECTRAL_DIFF /* FhG: Improved precision of targetEnergy in ivas_ls_setup_conversion_process_mdct_fx() */
+#define FIX_2003_CON_TCX_OVERFLOW /* FhG: Use a dynamic scaling factor for the synth buffer at the output of con_tcx_ivas_fx() */
+#define HP20_FIX32_RECODING /* FhG: optimized hp20_fx_32 calculation and applied it as hp20_fx_32_opt in decoder */
+#define OPT_TCXLTP_FILTER_LOOP /* FhG: optimize loop in tcx_ltp_synth_filter */
+#define FIX_2049_DIFF_IN_DECORR_TAIL /* FhG: correct scale values in ivas_dirac_dec_binaural_process_output_fx() */
+#define FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE /* Dolby/FhG: fix for issue 2026: Saturation in SWB TBE re-scaling function preventing StereoDownmix complexity job to complete */
+#define FIX_2021_BANDWIDTH_EXTENSION_PROBLEM /* FhG: increase cldfb buffer precision*/
+
+#define FIX_2083_FLOATING_POINT_LEFTOVERS /* FhG: convert floating-point leftovers in makeCustomLsSetup()*/
+#define FIX_2085_FLOATING_POINT_LEFTOVERS /* FhG: convert floating-point leftovers in ivas_dirac_config_fx() */
/* #################### Start BASOP porting switches ############################ */
-#define FIX_1372_ISAR_POST_REND
-#define NONBE_FIX_984_OMASA_EXT_OUTPUT /* Nokia: issue #984: complete the OMASA EXT output implementation */
-#define USE_NEW_HRTF_BINARY_FILE_FORMAT /* Orange: to activate when decided to change the hrtf binary file format */
-#define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */
-
-#define FIX_1052_EXT_OUTPUT /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */
-#define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */
-
-#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */
-#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */
-
-#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/
-
-#define FIX_1741_REVERB_TIMES_Q_FORMAT /* Philips: reverberation times in Q26 format instead of Q31 */
-#define FIX_1831_REVERB_REGRESSION /* Philips: fixes reverb regression issues */
-#define FIX_1835_REVERB_ACTIVATION /* FhG: Modified reverberation activation logic and corrected factEQ calculation */
-#define LC3PLUS_LEA_COMPAT_BITRATES_48_6 /* FhG: treat split-rendering 256kbps lc3plus 10ms 0dof bitrate as sentinel value for LEA compatible 48_6 bitrate (124 kbps per channel) */
-#define NONBE_FIX_ISM_XOVER_BR /* FhG: issue 1072: select OSBA coding method depending on number of object and bitrate */
-#define FIX_1053_REVERB_RECONFIGURATION /* Philips: issue 1053: fix for dynamic switching of acoustic environment */
-#define CONF_DISTATT /* Eri: Make distance attenuation configurable */
-#define FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR /* issue 1068 : Memory leak in MC to BINAURAL_ROOM decoding with bitrate switching*/
-#define NONBE_FIX_1052_SBA_EXT /* Dlb: SBA external output support */
-#define NONBE_FIX_MC_LFE_LPF /* Dlb: Adding the LFE LPF filter back for MC content. */
-#define NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR /* Nok: issue 1074 fixing number of objects signaling in OMASA low rate */
-#define FIX_1222_OMASA_DEC_CHANNEL_BUFFERS /* VA: issue 1222: Reduction of the number of channel buffers in OMASA decoder */
-#define NONBE_FIX_1130_DIV_ZERO_LEV_DUR /* VA: issue 1130: avoid div by zero in L-D by thresholding R[0] to a min value of 100.0 */
-
-#define FIX_1111_TDM_LSP_BUFFER /* VA: issue 1111: remove unused buffer `tdm_lspQ_PCh[]' */
-#define NONBE_1325_TD_STEREO_QUANT_LSF_SEC /* Nokia: issue 1325: fix for usage of active_cnt variable in TD stereo LSFQ */
-#define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/
-#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER /* FhG: issue 1128: set output ambisonics order to input order for EXT output */
-#define NONBE_FIX_1297_SPAR_JBM_MEM_SAN /*Dolby: issue 1297, SPAR + JBM + BR switch memory sanitizer*/
+#define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
+#define FIX_1129_EXT_REND_OUTPUT_HIGH /* Philips: issue 1129: External renderer BINAURAL_ROOM_REVERB format output level too high compared to internal rendering output */
+#define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */
+#define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328 */
+#define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */
+#define FIX_1320_STACK_CPE_DECODER /* VA: issue 1320: Optimize the stack memory consumption in the CPE decoder */
+#define FIX_1984_SAT_IN_PSYCHAD /* VA: Issue 1984: proposal to fix an assert */
+#define NONBE_FIX_1261_MASA_EXT_META_JBM /* Nokia: issue #1261: MASA metadata EXT output delay buffer init in JBM */
+#define NONBE_FIX_1143_MASA_BRSW /* Nok: Fix for issue 1143: MSAN use of uninitialized value in masa decoding to binaural with dtx bitrate switching and 5 % FER */
+#define NONBE_FIX_1220_OMASA_JBM_EXT_USAN /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */
+#define NONBE_FIX_1376_MDCT_CONCEALMENT /* FhG: fix concealment artifact in MDCT Stereo with DTX, in case transition frame gets lost */
+#define FIX_989_TD_REND_ROM /* Eri: Clean-up for TD renderer and completion of ROM generation tool */
+#define FIX_CREND_SIMPLIFY_CODE
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#define FIX_989_TD_REND_ROM /* Eri: Clean-up for TD renderer and completion of ROM generation tool */
+#define USE_REVERB_16BIT_ROM /* if desactivated old rom hrtf tables is used */
+#define USE_TDREND_16BIT_ROM /* if desactivated old rom hrtf tables is used. when active some tests case with 4 ISM fail due to owerflow in round_fixed function */
+#define USE_FASTCONV_PARAMBIN_16BIT_ROM /* if desactivated old rom hrtf tables is used */
+#define FIX_HRTF_LOAD /* VA: issue 1187: fix memory issue when HRTFs are loaded from a binary file */
+#endif
+#define NONBE_1377_REND_DIRATT_CONF /* Eri: Issue 1377: Error in directivity attenuation configuration for both IVAS_dec and IVAS_rend */
+#define FIX_1377_HANDLE_ERROR_CODE /* Eri: Add missing error code handling from IVAS_REND_SetObjectIDs */
+#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/
+#define ADJUST_MCT_CHANNELS_MAX /* FhG: set correct max mct channels constant*/
+#define FIX_1053_REVERB_RECONFIGURATION
+#define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
+#define FIX_1113_EXTREND_ISAR /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */
+#define FIX_1166_TDREND_DIV0 /* FhG,Eri: issue 1166: potential divide by zero in TD Renderer */
+#define NONBE_1203_MDCT2DFT_SWITCHING /* VA: issue 1203: fix severe artifacts during MDCT to DFT stereo switching when MDCT ITD is not used */
+#define NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX /* FhG: Avoid JBM ignoring safety margin and setting playout delay to 0 during DTX */
+#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */
+#define FIX_938_COMPILER_WARNING /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */
+#define FIX_1376_MISSING_ISM_METADATA /* FhG: IVAS_rend: throw error if there exists an ISM input without a corresponding metadata file path */
+#define FIX_1385_INIT_IGF_STOP_FREQ /* FhG: Initialize infoIGFStopFreq in init_igf_dec() */
+#define FIX_1387_INIT_PRM_SQQ /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */
+#define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */
+#define FIX_1349_TNS_CRASH /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
+#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */
+#define FIX_1179_USAN_PHASEECU /* Eri: issue 1179: better handling of 16 bit wrap around for very long(>200ms) FER-bursts */
+#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */
+#define FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */
+#define NONBE_FIX_1297_SPAR_JBM_MEM_SAN /* Dolby: issue 1297, SPAR + JBM + BR switch memory sanitizer */
+
+// object-editing feature porting
+#define OBJ_EDITING_API /* object editing changes related to the API */
+#ifdef OBJ_EDITING_API
+#define FIX_HRTF_LOAD_API // solves API conflicts between HRTF and object-editing features
+#define TMP_FIX_SPLIT_REND // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions)
+#define TMP_FIX_OMASA_SR_BE // temporary fix to keep OMASA split-rendering BE
+#endif
/* #################### End BASOP porting switches ############################ */
-#define FIX_1766_TCX2ACELP_BWE_ISSUE /* VA : Fix rare BWE issue when switching from TCX to ACELP */
-
#endif
diff --git a/lib_com/options_warnings.h b/lib_com/options_warnings.h
deleted file mode 100644
index eaa66e36eea643403623998cfecda8384e5f95c7..0000000000000000000000000000000000000000
--- a/lib_com/options_warnings.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/*Temporary file*/
-
-#define UNUSED_PARAM( ... ) (void) ( __VA_ARGS__ )
diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c
index 3103723becabab50ac704ec5634594e73531e5b3..055513dd1ff8bcd4dbf070240a342bd33a669d4a 100644
--- a/lib_com/phase_dispersion_fx.c
+++ b/lib_com/phase_dispersion_fx.c
@@ -8,6 +8,7 @@
#include "basop_util.h"
#include "rom_com.h"
+
/*-----------------------------------------------------------------------*
* phase_dispersion:
*
@@ -30,9 +31,11 @@ void phase_dispersion(
Word32 x32[2 * L_SUBFR];
Word16 *code_real, *code_imag;
const Word16 *h_real, *h_imag;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
move16();
@@ -57,7 +60,11 @@ void phase_dispersion(
move16();
prev_gain_pit[0] = gain_pit;
+#ifdef ISSUE_1836_replace_overflow_libcom
+ IF( GT_32( gain_code, L_add_sat( *prev_gain_code, L_shl_sat( *prev_gain_code, 1 ) ) ) )
+#else
IF( GT_32( gain_code, L_add_o( *prev_gain_code, L_shl_o( *prev_gain_code, 1, &Overflow ), &Overflow ) ) )
+#endif
{
IF( LT_16( state, 2 ) )
{
@@ -165,7 +172,11 @@ void phase_dispersion(
scale2 = getScaleFactor32( x32, L_subfr );
FOR( i = 0; i < L_subfr; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ code[i] = round_fx_sat( L_shl_sat( x32[i], scale2 ) );
+#else
code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow );
+#endif
move16();
}
j = sub( j, scale2 );
diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c
index cc6b59bdba01a0428f477f792a6a8809e5594d80..fd8b0acef8d9adf42572deb5e57bf2ba49a0be7f 100644
--- a/lib_com/ppp_fx.c
+++ b/lib_com/ppp_fx.c
@@ -97,9 +97,11 @@ void deemph_lpc_fx(
Word16 k, temp;
Word16 b_fx[M + 2]; /* Q12 */
Word16 a_fx[2] = { -22282, 32767 }; /* Q15 {-PREEMPH_FAC,1.0} */
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
b_fx[0] = 4096;
move16(); /* 1 in Q12 */
@@ -115,7 +117,11 @@ void deemph_lpc_fx(
{
/* LPC_de_curr[k] = a[0]*b[k] + a[1]*b[k+1]; */
temp = mult( a_fx[0], b_fx[k] ); /* Q12 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ LPC_de_curr_fx[k] = add_sat( temp, b_fx[k + 1] );
+#else
LPC_de_curr_fx[k] = add_o( temp, b_fx[k + 1], &Overflow );
+#endif
move16(); /* Q12 */
}
@@ -137,7 +143,11 @@ void deemph_lpc_fx(
{
/* LPC_de_old[k] = a[0]*b[k] + a[1]*b[k+1]; */
temp = mult( a_fx[0], b_fx[k] ); /* Q12 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ LPC_de_old_fx[k] = add_sat( temp, b_fx[k + 1] );
+#else
LPC_de_old_fx[k] = add_o( temp, b_fx[k + 1], &Overflow );
+#endif
move16(); /* Q12 */
}
}
diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c
index 465138bde1fd083c8ed2a0beade5da3fa290ea2f..146ecc2cea79fc2a4aa7c562aad4d59a1cbeab11 100644
--- a/lib_com/pred_lt4_fx.c
+++ b/lib_com/pred_lt4_fx.c
@@ -8,7 +8,6 @@
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-
/*-------------------------------------------------------------------*
* Function pred_lt4: *
* ~~~~~~~~~ *
@@ -35,9 +34,11 @@ void pred_lt4_ivas_fx(
Word32 s;
const Word16 *x0, *x1, *x2;
const Word32 *c1, *c2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
x0 = &excI[-T0];
@@ -71,7 +72,11 @@ void pred_lt4_ivas_fx(
s = W_sat_l( W_shr( s64, 16 ) ); /* Q_exc + Q16 */
}
- excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ excO[j] = round_fx_sat( s ); /* Q_exc */
+#else
+ excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */
+#endif
move16();
}
return;
@@ -91,9 +96,11 @@ void pred_lt4(
Word16 i, j;
Word32 s;
const Word16 *x0, *x1, *x2, *c1, *c2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
x0 = &excI[-T0];
@@ -127,12 +134,21 @@ void pred_lt4(
}
s = W_sat_l( s64 ); /* Q_exc + Q14 */
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+#if ( INTERP_EXP != -1 )
+ s = L_shl_sat( s, INTERP_EXP + 1 ); /* Q_exc + Q15 */
+#endif
+
+ excO[j] = round_fx_sat( s ); /* Q_exc */
+ move16();
+#else
#if ( INTERP_EXP != -1 )
s = L_shl_o( s, INTERP_EXP + 1, &Overflow ); /* Q_exc + Q15 */
#endif
excO[j] = round_fx_o( s, &Overflow ); /* Q_exc */
move16();
+#endif
}
return;
}
@@ -177,9 +193,11 @@ void pred_lt4_tc_fx(
Word16 excO[L_SUBFR + 1];
Word32 L_sum;
Word16 excI[2 * L_SUBFR];
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Copy( exc + sub( i_subfr, L_SUBFR ), excI, L_SUBFR * 2 ); /* Q0 */
@@ -212,15 +230,25 @@ void pred_lt4_tc_fx(
k += UP_SAMP;
L_sum = L_mac( L_sum, x0[i], win[k] ); /* Q15 */
}
- L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */
- excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_sum = L_shl_sat( L_sum, 1 ); /* Q16 */
+ excO[j] = round_fx_sat( L_sum ); /* Q0 */
+#else
+ L_sum = L_shl_o( L_sum, 1, &Overflow ); /* Q16 */
+ excO[j] = round_fx_o( L_sum, &Overflow ); /* Q0 */
+#endif
+
move16();
x0++;
}
FOR( i = T0; i < L_SUBFR; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc[i + i_subfr] = add_sat( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ) ); /* Q0 */
+#else
exc[i + i_subfr] = add_o( exc[i + i_subfr], mult_r( PIT_SHARP_fx, excO[i] ), &Overflow ); /* Q0 */
+#endif
move16();
}
}
diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c
index b7886cb65324d5bfb77d84fe104b24ff7abb7e33..db3949bca986349d860738d79c765d9386422616 100644
--- a/lib_com/preemph_fx.c
+++ b/lib_com/preemph_fx.c
@@ -22,12 +22,23 @@ void preemph_copy_fx(
)
{
Word16 i, temp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
temp = x[lg - 1]; /* Qx */
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ FOR( i = lg - 1; i > 0; i-- )
+ {
+ y[i] = msu_r_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx */
+ move16();
+ }
+ y[0] = msu_r_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx */
+ move16();
+#else
FOR( i = lg - 1; i > 0; i-- )
{
y[i] = msu_ro( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx */
@@ -35,6 +46,8 @@ void preemph_copy_fx(
}
y[0] = msu_ro( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx */
move16();
+#endif
+
*mem = temp; /* Qx */
move16();
@@ -49,12 +62,23 @@ void preemph_copy_32fx(
)
{
Word16 i, temp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
temp = x[lg - 1]; /* Qx */
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ FOR( i = lg - 1; i > 0; i-- )
+ {
+ y[i] = L_msu_sat( L_deposit_h( x[i] ), x[i - 1], mu ); /* Qx+16 */
+ move16();
+ }
+ y[0] = L_msu_sat( L_deposit_h( x[0] ), *mem, mu ); /* Qx+16 */
+ move16();
+#else
FOR( i = lg - 1; i > 0; i-- )
{
y[i] = L_msu_o( L_deposit_h( x[i] ), x[i - 1], mu, &Overflow ); /* Qx+16 */
@@ -62,6 +86,7 @@ void preemph_copy_32fx(
}
y[0] = L_msu_o( L_deposit_h( x[0] ), *mem, mu, &Overflow ); /* Qx+16 */
move16();
+#endif
*mem = temp; /* Qx */
move16();
@@ -125,13 +150,31 @@ void E_UTIL_f_preemph2(
{
Word16 i, temp;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
temp = signal[lg - 1]; /* Qx */
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ FOR( i = lg - 1; i > 0; i-- )
+ {
+ L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */
+ L_tmp = L_msu0_sat( L_tmp, signal[i - 1], mu ); /* Qx + 15 */
+ L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */
+ signal[i] = round_fx_sat( L_tmp ); /* Qx + shift */
+ move16();
+ }
+
+ L_tmp = L_mult( signal[0], 16384 ); /* Qx + 15 */
+ L_tmp = L_msu0_sat( L_tmp, *mem, mu ); /* Qx + 15 */
+ L_tmp = L_shl_sat( L_tmp, add( shift, 1 ) ); /* Qx + shift + 16 */
+ signal[0] = round_fx_sat( L_tmp ); /* Qx + shift */
+ move16();
+#else
FOR( i = lg - 1; i > 0; i-- )
{
L_tmp = L_mult( signal[i], 16384 ); /* Qx + 15 */
@@ -146,6 +189,7 @@ void E_UTIL_f_preemph2(
L_tmp = L_shl_o( L_tmp, add( shift, 1 ), &Overflow ); /* Qx + shift + 16 */
signal[0] = round_fx_o( L_tmp, &Overflow ); /* Qx + shift */
move16();
+#endif
*mem = temp; /* Qx */
move16();
diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h
index fbeff95b8944a50b4f53e13b03cdcddec6179bff..d5583074029523cae0e89ed9c6f22ee087d32e2e 100644
--- a/lib_com/prot_fx.h
+++ b/lib_com/prot_fx.h
@@ -391,10 +391,11 @@ Word16 WB_BWE_gain_pred_fx(
Word16 last_extl_fx,
Word16 tilt_wb_fx );
-Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 */
- const Word16 *sp0, /* i : i signal */
- const Word16 exp, /* i : Exp of inp signal */
- const Word16 N /* i : signal length */
+/* o : Tilt in Q24 */
+Word32 calc_tilt_bwe_fx(
+ const Word16 *sp0, /* i : i signal */
+ const Word16 exp, /* i : Exp of inp signal */
+ const Word16 N /* i : signal length */
);
void calc_norm_envelop_fx(
@@ -556,16 +557,17 @@ void hq_swb_harmonic_calc_norm_envelop_fx(
const Word16 SWB_flength /* i : length of i signal */
);
-Word16 build_nf_codebook_fx( /* o : Number of coefficients in nf codebook */
- const Word16 flag_32K_env_ho, /* i : Envelope attenuation hangover flag */
- const Word16 *coeff, /* i : Coded spectral coefficients */
- const Word16 *sfm_start, /* i : Subband start indices */
- const Word16 *sfmsize, /* i : Subband widths */
- const Word16 *sfm_end, /* i : Subband end indices */
- const Word16 last_sfm, /* i : Last coded band */
- const Word16 *R, /* i : Per-band bit allocation */
- Word16 *CodeBook, /* o : Noise-fill codebook */
- Word16 *CodeBook_mod /* o : Densified noise-fill codebook */
+/* o : Number of coefficients in nf codebook */
+Word16 build_nf_codebook_fx(
+ const Word16 flag_32K_env_ho, /* i : Envelope attenuation hangover flag */
+ const Word16 *coeff, /* i : Coded spectral coefficients */
+ const Word16 *sfm_start, /* i : Subband start indices */
+ const Word16 *sfmsize, /* i : Subband widths */
+ const Word16 *sfm_end, /* i : Subband end indices */
+ const Word16 last_sfm, /* i : Last coded band */
+ const Word16 *R, /* i : Per-band bit allocation */
+ Word16 *CodeBook, /* o : Noise-fill codebook */
+ Word16 *CodeBook_mod /* o : Densified noise-fill codebook */
);
void limit_band_noise_level_calc_fx(
@@ -575,9 +577,10 @@ void limit_band_noise_level_calc_fx(
Word16 *noise_level /* o : noise level Q15 */
);
-Word16 find_last_band_fx( /* o : index of last band */
- const Word16 *bitalloc, /* i : bit allocation */
- const Word16 nb_sfm /* i : number of possibly coded bands */
+/* o : index of last band */
+Word16 find_last_band_fx(
+ const Word16 *bitalloc, /* i : bit allocation */
+ const Word16 nb_sfm /* i : number of possibly coded bands */
);
void apply_noisefill_HQ_fx(
@@ -734,6 +737,7 @@ Word16 calc_nor_delta_hf_fx(
const Word16 *sfm_start, /* i : Start index of bands */
const Word16 core_sfm /* i : index of the end band for core */
);
+
Word16 calc_nor_delta_hf_ivas_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word32 *t_audio, /* i : transform-domain coefficients Qx*/
@@ -745,6 +749,7 @@ Word16 calc_nor_delta_hf_ivas_fx(
const Word16 *sfm_start, /* i : Start index of bands */
const Word16 core_sfm /* i : index of the end band for core */
);
+
void hq_bwe_fx(
const Word16 HQ_mode, /* i : HQ mode */
Word32 *coeff_out1, /* i/o: BWE i & temporary buffer */
@@ -799,6 +804,7 @@ void enforce_zero_for_min_envelope_fx(
const Word16 *sfm_start, /* i : Sub band start indices Q0 */
const Word16 *sfm_end /* i : Sub band end indices Q0 */
);
+
void apply_envelope_enc_ivas_fx(
const Word16 *coeff, /* i/o: Coded/noisefilled normalized spectrum Q12 */
const Word16 *norm, /* i : Envelope Q0 */
@@ -807,6 +813,7 @@ void apply_envelope_enc_ivas_fx(
const Word16 *sfm_end, /* i : Sub band end indices Q0 */
Word32 *coeff_out /* o : coded/noisefilled spectrum Q12 */
);
+
void apply_envelope_fx(
const Word16 *coeff, /* i : Coded/noisefilled normalized spectrum Q12 */
const Word16 *norm, /* i : Envelope */
@@ -827,7 +834,10 @@ void apply_envelope_fx(
lsf_tools_fx.c
/========================================================================================================*/
-void compute_poly_product_fx( Word16 *coef, Word32 *p, Word16 order );
+void compute_poly_product_fx(
+ Word16 *coef,
+ Word32 *p,
+ Word16 order );
Word16 xsp_to_xsf(
Word16 lsp );
@@ -836,8 +846,14 @@ Word16 xsf_to_xsp(
Word16 lsf /* Q2.56 */
);
-void lsp_convolve_fx( Word32 x, Word32 *p1, Word32 *p2, Word16 len );
-Word32 poscos_fx( Word16 w );
+void lsp_convolve_fx(
+ Word32 x,
+ Word32 *p1,
+ Word32 *p2,
+ Word16 len );
+
+Word32 poscos_fx(
+ Word16 w );
Word32 sub_lsp2lsf_fx(
const Word16 lsp_i /* i : lsp[m] (range: -1<=val<1) Q15*/
@@ -854,16 +870,32 @@ void E_LPC_lsf_lsp_conversion(
const Word16 m /* i : LPC order */
);
-void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m );
+void E_LPC_f_lsp_a_conversion(
+ const Word16 *lsp,
+ Word16 *a,
+ const Word16 m );
+
void E_LPC_a_isp_conversion(
const Word16 *a, /* i : LP filter coefficients */
Word16 *isp, /* o : Line spectral pairs (in the cosine domain) */
const Word16 *old_isp, /* i : LSP vector from past frame */
const Word16 m /* i : LPC order */
);
-void E_LPC_isp_isf_conversion( const Word16 isp[], Word16 isf[], const Word16 m );
-void E_LPC_isf_isp_conversion( const Word16 isf[], Word16 isp[], const Word16 m );
-void E_LPC_f_isp_a_conversion( const Word16 *isp, Word16 *a, const Word16 m );
+
+void E_LPC_isp_isf_conversion(
+ const Word16 isp[],
+ Word16 isf[],
+ const Word16 m );
+
+void E_LPC_isf_isp_conversion(
+ const Word16 isf[],
+ Word16 isp[],
+ const Word16 m );
+
+void E_LPC_f_isp_a_conversion(
+ const Word16 *isp,
+ Word16 *a,
+ const Word16 m );
void E_LPC_a_lsp_conversion(
const Word16 *a, /* i : LP filter coefficients */
@@ -897,14 +929,21 @@ void E_LPC_a_lsp_conversion(
const Word16 m /* i : LPC order */
);
-void v_sort( Word16 *r, const Word16 lo, const Word16 up );
+void v_sort(
+ Word16 *r,
+ const Word16 lo,
+ const Word16 up );
-void compute_poly_product_fx( Word16 *coef, Word32 *p, Word16 order );
+void compute_poly_product_fx(
+ Word16 *coef,
+ Word32 *p,
+ Word16 order );
void dec_prm_hm_fx(
Decoder_State *st,
Word16 *prm_hm, /* Q0 */
const Word16 L_frame );
+
void msvq_dec(
const Word16 *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) (0Q15) */
const Word16 dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */
@@ -926,23 +965,22 @@ void lsf_syn_mem_restore_fx(
Word32 gc_threshold_fx, /* i: Q16 */
Word16 *clip_var_bck_fx, /* i: Q(2.56), Q14, Q7, Q0, Q14, Q14 */
Word16 next_force_sf_bck_fx, /* i: */
-
- Word16 *lsp_new, /* o: LSP vector to quantize Q15 */
- Word16 *lsf_new, /* o: quantized LSF vector Q15 */
- Word16 *lsp_mid, /* o: mid-frame LSP vector Q15 */
- Word16 clip_var, /* i: pitch clipping state var Q(2.56) */
- Word16 *mem_AR, /* i: quantizer memory for AR model Q15 */
- Word16 *mem_MA, /* i: quantizer memory for MA model Q15 */
- Word16 *lsp_new_bck, /* i: LSP vector to quantize- backup Q15 */
- Word16 *lsf_new_bck, /* i: quantized LSF vector - backup Q15 */
- Word16 *lsp_mid_bck, /* i: mid-frame LSP vector - backup Q15 */
- Word16 mCb1, /* i: counter for stationary frame after a transition frame */
- Word32 *Bin_E, /* i: FFT Bin energy 128 *2 sets Q_new + Q_SCALE - 2 */
- Word32 *Bin_E_old, /* i: FFT Bin energy 128 sets Q_new + Q_SCALE - 2 */
- Word16 *mem_syn_bck, /* i: synthesis filter memory ( 15 - st_fx->hLPDmem->e_mem_syn ) */
- Word16 mem_w0_bck, /* i: memory of the weighting filter ( 15 - st_fx->hLPDmem->e_mem_syn ) */
- Word16 streaklimit, /* i:LSF quantizer Q15 */
- Word16 pstreaklen /* i:LSF quantizer */
+ Word16 *lsp_new, /* o: LSP vector to quantize Q15 */
+ Word16 *lsf_new, /* o: quantized LSF vector Q15 */
+ Word16 *lsp_mid, /* o: mid-frame LSP vector Q15 */
+ Word16 clip_var, /* i: pitch clipping state var Q(2.56) */
+ Word16 *mem_AR, /* i: quantizer memory for AR model Q15 */
+ Word16 *mem_MA, /* i: quantizer memory for MA model Q15 */
+ Word16 *lsp_new_bck, /* i: LSP vector to quantize- backup Q15 */
+ Word16 *lsf_new_bck, /* i: quantized LSF vector - backup Q15 */
+ Word16 *lsp_mid_bck, /* i: mid-frame LSP vector - backup Q15 */
+ Word16 mCb1, /* i: counter for stationary frame after a transition frame */
+ Word32 *Bin_E, /* i: FFT Bin energy 128 *2 sets Q_new + Q_SCALE - 2 */
+ Word32 *Bin_E_old, /* i: FFT Bin energy 128 sets Q_new + Q_SCALE - 2 */
+ Word16 *mem_syn_bck, /* i: synthesis filter memory ( 15 - st_fx->hLPDmem->e_mem_syn ) */
+ Word16 mem_w0_bck, /* i: memory of the weighting filter ( 15 - st_fx->hLPDmem->e_mem_syn ) */
+ Word16 streaklimit, /* i:LSF quantizer Q15 */
+ Word16 pstreaklen /* i:LSF quantizer */
);
void lsf_syn_mem_restore_ivas_fx(
@@ -1049,25 +1087,28 @@ void lsp2isp_fx(
const Word16 m /* i : order of LP analysis */
);
-Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
- const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
- const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame /* i : frame length */
+/* o : LP filter stability Q15*/
+Word16 lsf_stab_fx(
+ const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
+ const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame /* i : frame length */
);
-Word16 lsf_stab_ivas_fx( /* o : LP filter stability Q15*/
- const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
- const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame /* i : frame length */
+/* o : LP filter stability Q15*/
+Word16 lsf_stab_ivas_fx(
+ const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
+ const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame /* i : frame length */
);
-Word16 lsf_stab_ivas_fx( /* o : LP filter stability Q15*/
- const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
- const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame /* i : frame length */
+/* o : LP filter stability Q15*/
+Word16 lsf_stab_ivas_fx(
+ const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
+ const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame /* i : frame length */
);
void reorder_isf_fx(
@@ -1135,7 +1176,10 @@ Word16 vq_dec_lvq_ivas_fx(
Word16 no_bits /* (i): no. bits for lattice */
);
-void a2rc_fx( const Word16 *a, Word16 *refl, Word16 lpcorder );
+void a2rc_fx(
+ const Word16 *a,
+ Word16 *refl,
+ Word16 lpcorder );
void lsp_weights_fx(
Word16 lsp_nq_fx[],
@@ -1202,14 +1246,56 @@ void autocorr_fx_32(
const Word16 sym_flag /* i : symmetric window flag */
);
-Word16 E_LPC_lev_dur( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *parcorr );
-Word16 E_LPC_lev_dur_stab( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *parcorr, Word16 k_max );
-
-Word16 E_LPC_lev_dur_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *parcorr );
-Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16 A[], Word32 epsP[], const Word16 order, Word16 *parcorr, Word16 k_max );
-
-Word16 E_LPC_lev_dur_fx( const Word16 Rh[], const Word16 Rl[], Word32 A[], Word32 epsP[], const Word16 order, Word32 *mem );
-Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[], const Word16 Rl[], Word32 A[], Word32 epsP[], const Word16 order, Word32 *mem, Word16 k_max );
+Word16 E_LPC_lev_dur(
+ const Word16 Rh[],
+ const Word16 Rl[],
+ Word16 A[],
+ Word32 epsP[],
+ const Word16 order,
+ Word16 *parcorr );
+
+Word16 E_LPC_lev_dur_stab(
+ const Word16 Rh[],
+ const Word16 Rl[],
+ Word16 A[],
+ Word32 epsP[],
+ const Word16 order,
+ Word16 *parcorr,
+ Word16 k_max );
+
+Word16 E_LPC_lev_dur_ivas_fx(
+ const Word16 Rh[],
+ const Word16 Rl[],
+ Word16 A[],
+ Word32 epsP[],
+ const Word16 order,
+ Word16 *parcorr );
+
+Word16 E_LPC_lev_dur_stab_ivas_fx(
+ const Word16 Rh[],
+ const Word16 Rl[],
+ Word16 A[],
+ Word32 epsP[],
+ const Word16 order,
+ Word16 *parcorr,
+ Word16 k_max );
+
+Word16 E_LPC_lev_dur_fx(
+ const Word16 Rh[],
+ const Word16 Rl[],
+ Word32 A[],
+ Word32 epsP[],
+ const Word16 order,
+ Word32 *mem );
+
+Word16 E_LPC_lev_dur_stab_fx(
+ const Word16 Rh[],
+ const Word16 Rl[],
+ Word32 A[],
+ Word32 epsP[],
+ const Word16 order,
+ Word32 *mem,
+ Word16 k_max );
Word16 lev_dur_fx(
Word32 *a_fx, /* o : LP coefficients (a[0] = 1.0) Q(q_a)*/
@@ -1219,10 +1305,16 @@ Word16 lev_dur_fx(
Word16 q_a,
Word16 q_r );
-void E_LPC_a_add_tilt( const Word16 *a /*Qa*/, Word16 *ap /*Qa*/, Word16 gamma /*Q15*/, Word16 m );
-void E_LPC_int_lpc_tcx( const Word16 lsp_old[], /* i : LSPs from past frame (1Q14) */
- const Word16 lsp_new[], /* i : LSPs from present frame (1Q14) */
- Word16 a[] /* o : interpolated LP coefficients (4Q11) */
+void E_LPC_a_add_tilt(
+ const Word16 *a /*Qa*/,
+ Word16 *ap /*Qa*/,
+ Word16 gamma /*Q15*/,
+ Word16 m );
+
+void E_LPC_int_lpc_tcx(
+ const Word16 lsp_old[], /* i : LSPs from past frame (1Q14) */
+ const Word16 lsp_new[], /* i : LSPs from present frame (1Q14) */
+ Word16 a[] /* o : interpolated LP coefficients (4Q11) */
);
Word16 E_LPC_lsp_unweight(
@@ -1233,9 +1325,23 @@ Word16 E_LPC_lsp_unweight(
Word16 lpcorder /* (I): prediction order Q0 */
);
-Word32 E_LPC_schur( Word32 r[] /*Qr*/, Word16 reflCoeff[] /*Q15*/, Word32 epsP[] /*Qr*/, const Word16 m );
-Word32 E_LPC_schur_ivas( Word32 r[] /*Qr*/, Word16 reflCoeff[] /*Q15*/, const Word16 m );
-void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/, const Word16 *old_lsf /*15Q16*/, Word16 lpcOrder, Word8 lpcRep /*Q0*/ );
+Word32 E_LPC_schur(
+ Word32 r[] /*Qr*/,
+ Word16 reflCoeff[] /*Q15*/,
+ Word32 epsP[] /*Qr*/,
+ const Word16 m );
+
+Word32 E_LPC_schur_ivas(
+ Word32 r[] /*Qr*/,
+ Word16 reflCoeff[] /*Q15*/,
+ const Word16 m );
+
+void E_LPC_a_lsf_isf_conversion(
+ Word16 *lpcCoeffs /*Qx*/,
+ Word16 *lsf /*15Q16*/,
+ const Word16 *old_lsf /*15Q16*/,
+ Word16 lpcOrder,
+ Word8 lpcRep /*Q0*/ );
/*========================================================================================================/
@@ -1248,11 +1354,6 @@ UWord16 get_next_indice_fx(
Word16 nb_bits /* i : number of bits that were used to quantize the indice */
);
-Word16 rate2EVSmode(
- const Word32 brate, /* i : bitrate */
- Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
-);
-
/* o : value of the indice */
UWord16 get_next_indice_1_fx(
Decoder_State *st_fx /* i/o: decoder state structure */
@@ -1274,11 +1375,23 @@ void reset_indices_enc_fx(
const Word16 max_num_indices /* i : max number of indices */
);
-Word16 BRATE2IDX_fx( Word32 brate );
-Word16 BRATE2IDX16k_fx( Word32 brate );
+Word16 BRATE2IDX_fx(
+ const Word32 brate );
+
+Word16 BRATE2IDX16k_fx(
+ Word32 brate );
-Word32 BIT_ALLOC_IDX_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc );
-Word32 BIT_ALLOC_IDX_16KHZ_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc );
+Word32 BIT_ALLOC_IDX_fx(
+ const Word32 brate,
+ Word16 ctype,
+ const Word16 sfrm,
+ const Word16 tc );
+
+Word32 BIT_ALLOC_IDX_16KHZ_fx(
+ const Word32 brate,
+ const Word16 ctype,
+ const Word16 sfrm,
+ const Word16 tc );
void getPartialCopyInfo(
Decoder_State *st, /* i : decoder state structure */
@@ -1412,29 +1525,31 @@ void hq_configure_evs_fx(
);
// hp50.c
-void hp20( Word16 signal[], /* i/o: signal to filter any */
- const Word16 stride, /* i : stride to be applied accessing signal */
- const Word16 lg, /* i : length of signal (integer) Q0 */
- Word32 mem[5], /* i/o: static filter memory with this layout: */
- /* mem[0]: y[-2] (32-bit) */
- /* mem[1]; y[-1] (32-bit) */
- /* mem[2]: x[-2] << 16 */
- /* mem[3]: x[-1] << 16 */
- /* Note: mem[0..3] need to be scaled per frame */
- /* mem[4]: states scale */
- const Word32 sFreq );
-
-// get_gain.c
-Word32 get_gain( /* encoder side; enc = 0 -> decoder side */
- Word16 *sign /* i/o: sign of the maximum */
+
+/* o : impulse response energy Q3 */
+Word16 findpulse_fx(
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 res[], /* i : Residual signal <12 bits */
+ const Word16 T0, /* i : Pitch estimation Q0 */
+ const Word16 enc, /* i : enc = 1 -> encoder side; enc = 0 -> decoder side */
+ Word16 *sign /* i/o: sign of the maximum */
);
-// env_stab_trans.c
void env_stab_transient_detect_fx(
const Word16 is_transient, /* i: Transient flag */
const Word16 length, /* i : Length of spectrum (32 or 48 kHz) */
@@ -1643,8 +1766,6 @@ void env_stab_transient_detect_fx(
const Word16 Qcoeff /* i : Q of coded spectral coefficients */
);
-
-// env_adj.c
void env_adj_fx(
const Word16 *pulses, /* i : number of pulses per band Q0 */
const Word16 length, /* i : length of spectrum Q0 */
@@ -1654,32 +1775,33 @@ void env_adj_fx(
const Word16 *sfmsize /* i : subband sizes Q0 */
);
-
-// env_stab.c
-
-Word16 env_stability_fx( /* in Q15 */
- const Word16 *ynrm, /*i: Norm vector for current frame */
- const Word16 nb_sfm, /*i: Number of sub-bands */
- Word16 *mem_norm, /*i/o: Norm vector memory from past frame */
- Word16 *mem_env_delta, /*i/o: Envelope stability memory for smoothing in Q11 */
- const Word16 core_switching_flag /* i : Core switching flag */
+/* in Q15 */
+Word16 env_stability_fx(
+ const Word16 *ynrm, /*i: Norm vector for current frame */
+ const Word16 nb_sfm, /*i: Number of sub-bands */
+ Word16 *mem_norm, /*i/o: Norm vector memory from past frame */
+ Word16 *mem_env_delta, /*i/o: Envelope stability memory for smoothing in Q11 */
+ const Word16 core_switching_flag /* i : Core switching flag */
);
-Word16 env_stab_smo_fx( /* Q0 */
- Word16 env_stab, /*i : env_stab value Q15 */
- Word16 *env_stab_state_p, /*i/o: env_stab state probabilities Q15 */
- Word16 *ho_cnt /*i/o: hangover counter for speech state */
+/* Q0 */
+Word16 env_stab_smo_fx(
+ Word16 env_stab, /*i : env_stab value Q15 */
+ Word16 *env_stab_state_p, /*i/o: env_stab state probabilities Q15 */
+ Word16 *ho_cnt /*i/o: hangover counter for speech state */
);
-// enr_1_az.c
-Word16 Enr_1_Az_fx( /* o : impulse response energy Q3 */
- const Word16 Aq[], /* i : LP filter coefs Qx based on the fact that Aq[0] == 1.0 */
- const Word16 len /* i : impulse response length Q0 */
+/* o : impulse response energy Q3 */
+Word16 Enr_1_Az_fx(
+ const Word16 Aq[], /* i : LP filter coefs Qx based on the fact that Aq[0] == 1.0 */
+ const Word16 len /* i : impulse response length Q0 */
);
-Word16 Enr_1_Az_fx_o( /* o : impulse response energy Q3 */
- const Word16 Aq[], /* i : LP filter coefs Qx based on the fact that Aq[0] == 1.0 */
- const Word16 len, /* i : impulse response length Q0 */
- Flag *Overflow_out /* o : propagating the Overflow flag to upper level */
+
+/* o : impulse response energy Q3 */
+Word16 Enr_1_Az_fx_o(
+ const Word16 Aq[], /* i : LP filter coefs Qx based on the fact that Aq[0] == 1.0 */
+ const Word16 len, /* i : impulse response length Q0 */
+ Flag *Overflow_out /* o : propagating the Overflow flag to upper level */
);
// gs_gains_fx.c
@@ -1689,6 +1811,7 @@ void Ener_per_band_comp_fx(
const Word16 Q_exc_diff,
const Word16 Mband, /* i : Max band */
const Word16 Eflag );
+
void Ener_per_band_comp_ivas_fx(
const Word16 exc_diff_fx[], /* i : target signal Q_exc_diff */
Word16 y_gain4_fx[], /* o : Energy per band to quantize Q12 */
@@ -1716,7 +1839,6 @@ void Comp_and_apply_gain_ivas_fx(
Word16 Qexc_diff,
Word16 *Q_exc );
-// gs_preech.c
void pre_echo_att_fx(
Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/
Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/
@@ -1724,7 +1846,6 @@ void pre_echo_att_fx(
const Word16 Q_new,
const Word16 last_coder_type, /* i : Last coding mode Q0*/
const Word16 L_frame /* i : Frame length Q0*/
-
);
void pre_echo_att_ivas_fx(
@@ -1735,7 +1856,7 @@ void pre_echo_att_ivas_fx(
const Word16 last_coder_type, /* i : Last coding mode Q0*/
const Word16 L_frame /* i : Frame length Q0*/
);
-// wtda_fx.c
+
void tcx_get_windows_mode1(
const Word16 left_mode, /* i: overlap mode of left window half */
const Word16 right_mode, /* i: overlap mode of right window half */
@@ -1879,15 +2000,16 @@ void noise_extr_corcod_fx(
);
void sqrt_32n_16_fx(
- Word32 L_in, /* i : i vector (Word32) */
+ Word32 L_in, /* i : i vector (Word32) */
Word16 Qin, /* i : Q value for L_in */
- Word16 *out_fx, /* o : sqrt i vector (Word16) */
+ Word16 *out_fx, /* o : sqrt i vector (Word16) */
Word16 *Qout /* o : Q value for out_fx */
);
-Word16 div_s_ss( /* o: result of division (Word16 Q0) */
- const Word16 n, /* i: numerator (Word16 Q0 */
- const Word16 d /* i: denominator (Word16 Q0) */
+/* o: result of division (Word16 Q0) */
+Word16 div_s_ss(
+ const Word16 n, /* i: numerator (Word16 Q0 */
+ const Word16 d /* i: denominator (Word16 Q0) */
);
void noiseinj_hf_fx(
@@ -1938,16 +2060,17 @@ void return_bits_normal2_fx(
const Word16 bits_lagIndices_fx[] /* i : bits for lagIndices */
);
-Word16 spectrumsmooth_noiseton_fx( /* o : Qss ss_min */
- Word32 L_spectra[], /* i : Qs core coder */
- /*Word16 Qs,*/ /* i : Q0 Q value for spectra, spectra_ni */
- const Word32 L_spectra_ni[], /* i : Qs core coder with sparse filling */
- Word16 sspectra_fx[], /* o : Qss Smoothed tonal information from core coder */
- Word16 sspectra_diff_fx[], /* o : Qss non tonal infomration for gap filling */
- Word16 sspectra_ni_fx[], /* o : Qss smoothed core coder */
- Word16 *Qss, /* o : Q0 Q value for sspectra* */
- const Word16 fLenLow_fx, /* i : Q0 low frequency boundaries */
- Word16 *ni_seed_fx /* io : Q0 random seed */
+/* o : Qss ss_min */
+Word16 spectrumsmooth_noiseton_fx(
+ Word32 L_spectra[], /* i : Qs core coder */
+ /*Word16 Qs,*/ /* i : Q0 Q value for spectra, spectra_ni */
+ const Word32 L_spectra_ni[], /* i : Qs core coder with sparse filling */
+ Word16 sspectra_fx[], /* o : Qss Smoothed tonal information from core coder */
+ Word16 sspectra_diff_fx[], /* o : Qss non tonal infomration for gap filling */
+ Word16 sspectra_ni_fx[], /* o : Qss smoothed core coder */
+ Word16 *Qss, /* o : Q0 Q value for sspectra* */
+ const Word16 fLenLow_fx, /* i : Q0 low frequency boundaries */
+ Word16 *ni_seed_fx /* io : Q0 random seed */
);
void ton_ene_est_fx(
@@ -2016,26 +2139,23 @@ void get_sigma_fx_har(
);
void genhf_noise_fx(
- const Word16 noise_flr_fx[],
- /* i : Qss smoothed non tonal */ /* sspectra_diff_fx:Qss */
- const Word16 Qss, /* i : Q0 Q value */
- Word32 L_xSynth_har[],
- /* o : QsL hf non tonal components */ /* xSynth_har:QsL */
- const Word16 QsL, /* i : Q0 Q value */
- const Word16 *predBuf_fx,
- /* i : Qss smoothed tonal compone */ /* sspectra:Qss */
- const Word16 bands, /* i : Q0 total number of subbands in a frame */
- const Word16 harmonic_band, /* i : Q0 Number of LF harmonic frames */
- const Word16 har_freq_est2, /* i : Q0 harmonic signal parameter */
- const Word16 pos_max_hfe2, /* i : Q0 last pulse in core coder */
- Word16 *pul_res, /* o : Q0 pulse resolution */
- GainItem_fx pk_sf_fx[], /* o : representative region */
- const Word16 fLenLow, /* i : Q0 low frequency length */
- const Word16 fLenHigh, /* i : Q0 high frequency length */
- const Word16 sbWidth[], /* i : Q0 bandwidth for high bands */
- const Word16 lagIndices[], /* i : Q0 correlation indices for most representative */
- const Word16 subband_offsets[], /* i : Q0 band offsets for HF reconstruction */
- const Word16 subband_search_offset[] /* i : Q0 most representative regions offsets in LF */
+ const Word16 noise_flr_fx[], /* i : Qss smoothed non tonal sspectra_diff_fx:Qss */
+ const Word16 Qss, /* i : Q0 Q value */
+ Word32 L_xSynth_har[], /* o : QsL hf non tonal components xSynth_har:QsL */
+ const Word16 QsL, /* i : Q0 Q value */
+ const Word16 *predBuf_fx, /* i : Qss smoothed tonal compone sspectra:Qss */
+ const Word16 bands, /* i : Q0 total number of subbands in a frame */
+ const Word16 harmonic_band, /* i : Q0 Number of LF harmonic frames */
+ const Word16 har_freq_est2, /* i : Q0 harmonic signal parameter */
+ const Word16 pos_max_hfe2, /* i : Q0 last pulse in core coder */
+ Word16 *pul_res, /* o : Q0 pulse resolution */
+ GainItem_fx pk_sf_fx[], /* o : representative region */
+ const Word16 fLenLow, /* i : Q0 low frequency length */
+ const Word16 fLenHigh, /* i : Q0 high frequency length */
+ const Word16 sbWidth[], /* i : Q0 bandwidth for high bands */
+ const Word16 lagIndices[], /* i : Q0 correlation indices for most representative */
+ const Word16 subband_offsets[], /* i : Q0 band offsets for HF reconstruction */
+ const Word16 subband_search_offset[] /* i : Q0 most representative regions offsets in LF */
);
Word16 har_est_fx(
@@ -2061,23 +2181,19 @@ void FindNBiggest2_simple_fx_har(
Word16 get_usebit_npswb_fx(
Word16 hqswb_clas_fx );
-/*========================================================================================================/
-isf_dec_amr_wb_fx.c
-/========================================================================================================*/
-
void disf_2s_36b_fx(
Word16 *indice, /* i : quantized indices (use indice[0] = -1 in the decoder) */
- Word16 *isf_q, /* (Qx2.56) o : quantized ISFs in the cosine domain */
- Word16 *mem_AR, /* (Qx2.56) i/o: quantizer memory for AR model */
- Word16 *mem_MA, /* (Qx2.56) i/o: quantizer memory for MA model */
+ Word16 *isf_q, /* (Qx2.56) o : quantized ISFs in the cosine domain */
+ Word16 *mem_AR, /* (Qx2.56) i/o: quantizer memory for AR model */
+ Word16 *mem_MA, /* (Qx2.56) i/o: quantizer memory for MA model */
const Word16 enc_dec /* i : encoder (0), decoder (1) G722.2 FER */
);
void disf_2s_46b_fx(
Word16 *indice, /* i : quantized indices (use indice[0] = -1 in the decoder) */
- Word16 *isf_q, /* (Qx2.56) o : quantized ISFs in the cosine domain */
- Word16 *mem_AR, /* (Qx2.56) o : quantizer memory for AR model */
- Word16 *mem_MA, /* (Qx2.56) i/o: quantizer memory for MA model */
+ Word16 *isf_q, /* (Qx2.56) o : quantized ISFs in the cosine domain */
+ Word16 *mem_AR, /* (Qx2.56) o : quantizer memory for AR model */
+ Word16 *mem_MA, /* (Qx2.56) i/o: quantizer memory for MA model */
const Word16 enc_dec /* i : encoder (0), decoder (1) G722.2 FER */
);
@@ -2086,16 +2202,12 @@ void disf_ns_28b_fx(
Word16 *isf_q );
void isf_dec_amr_wb_fx(
- Decoder_State *st, /* i/o: State structure */
- Word16 *Aq, /* Q12 o : quantized A(z) for 4 subframes */
- Word16 *isf_new, /* Qlog2(2.56) o : de-quantized ISF vector */
- Word16 *isp_new /* Q15 o : de-quantized ISP vector */
+ Decoder_State *st, /* i/o: State structure */
+ Word16 *Aq, /* Q12 o : quantized A(z) for 4 subframes */
+ Word16 *isf_new, /* Qlog2(2.56) o : de-quantized ISF vector */
+ Word16 *isp_new /* Q15 o : de-quantized ISP vector */
);
-/*========================================================================================================/
-hq2_noise_inject.c fix part
-/========================================================================================================*/
-
void hq2_noise_inject_fx(
Word32 L_y2[], /* Q12 */
const Word16 band_start[], /* Q0 */
@@ -2121,10 +2233,6 @@ void hq2_noise_inject_fx(
const Word32 bwe_br /* Q0 */
);
-/*========================================================================================================/
-hq2_bit_alloc_fx.c
-/========================================================================================================*/
-
void Bits2indvsb_fx(
const Word32 *L_be, /* i : Qbe Band Energy of sub-band */
const Word16 start_band, /* i : Q0 start band indices */
@@ -2166,10 +2274,6 @@ void reordvct_fx(
Word16 *idx /* o : reordered vector index */
);
-/*========================================================================================================/
-nelp_fx.c
-/========================================================================================================*/
-
Word16 dequantize_uvg_fx(
const Word16 iG1, /* i: gain 1 index */
const Word16 *iG2, /* i: gain 2 index */
@@ -2184,10 +2288,6 @@ void generate_nelp_excitation_fx(
const Word16 gain_fac /* i : gain factor */
);
-/*========================================================================================================/
-ppp_fx.c
-/========================================================================================================*/
-
void Interpol_delay_fx(
Word16 *out_fx, /* Q4 */
Word16 last_fx, /* Q0 */
@@ -2204,9 +2304,6 @@ void deemph_lpc_fx(
const Word16 deemph_old /* Q0 */
);
-/*========================================================================================================/
-hq2_core_com_fx.c
-/========================================================================================================*/
void mdct_spectrum_denorm_fx(
const Word16 inp_vector[], /* i : Q0 : */
Word32 L_y2[], /* i/o : Qs : decoded spectrum */
@@ -2311,7 +2408,6 @@ void bit_allocation_second_fx(
const Word16 *last_bitalloc, /* Q0 */
const Word16 input_frame /* Q0 */
);
-// synth_filt_fix.c
Word32 syn_kern_16(
Word32 L_tmp,
@@ -2362,9 +2458,25 @@ void syn_filt_fx32(
const Word16 update_m /* i : update memory flag Q0 : 0 --> no memory update */
);
-void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], Word16 y[], const Word16 lg, Word16 mem[], const Word16 update, const Word16 m );
+void E_UTIL_synthesis(
+ const Word16 shift,
+ const Word16 a[],
+ const Word16 x[],
+ Word16 y[],
+ const Word16 lg,
+ Word16 mem[],
+ const Word16 update,
+ const Word16 m );
-void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[], Word32 y[], const Word16 lg, Word32 mem[], const Word16 update, const Word16 m );
+void E_UTIL_synthesis_fx(
+ const Word16 shift,
+ const Word32 a[],
+ const Word32 x[],
+ Word32 y[],
+ const Word16 lg,
+ Word32 mem[],
+ const Word16 update,
+ const Word16 m );
void synth_mem_updt2(
const Word16 L_frame, /* i : frame length */
@@ -2375,6 +2487,7 @@ void synth_mem_updt2(
Word16 mem_syn[], /* o : synthesis filter memory for find_target */
const Word16 dec /* i : flag for decoder indication */
);
+
void ivas_synth_mem_updt2_fx(
const Word16 L_frame, /* i : frame length */
const Word16 last_L_frame, /* i : frame length */
@@ -2384,31 +2497,45 @@ void ivas_synth_mem_updt2_fx(
Word16 mem_syn[], /* o : synthesis filter memory for find_target */
const Word16 dec );
+void lerp(
+ const Word16 *f,
+ Word16 *f_out,
+ Word16 bufferNewSize,
+ Word16 bufferOldSize );
-// lerp.c
-void lerp( const Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize );
-
-void L_lerp_fx_q11( Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 bufferOldSize );
+void L_lerp_fx_q11(
+ Word32 *f,
+ Word32 *f_out,
+ Word16 bufferNewSize,
+ Word16 bufferOldSize );
-void L_lerp_fx( Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 bufferOldSize, Word16 *q );
+void L_lerp_fx(
+ Word32 *f,
+ Word32 *f_out,
+ Word16 bufferNewSize,
+ Word16 bufferOldSize,
+ Word16 *q );
-// index_pvq_opt.c
-PvqEntry mpvq_encode_vec_fx( /* o : leading_sign_index, index, size, k_val */
- const Word16 *vec_in, /* i : signed pulse train */
- Word16 dim_in, /* i : dimension */
- Word16 k_val_local /* i : nb unit pulses */
+/* o : leading_sign_index, index, size, k_val */
+PvqEntry mpvq_encode_vec_fx(
+ const Word16 *vec_in, /* i : signed pulse train */
+ Word16 dim_in, /* i : dimension */
+ Word16 k_val_local /* i : nb unit pulses */
);
-PvqEntry get_size_mpvq_calc_offset_fx( /* o : size, dim, k_val */
- Word16 dim_in, /* i : dimension */
- Word16 k_val_in, /* i : nb unit pulses */
- UWord32 *h_mem /* o : offsets */
+
+/* o : size, dim, k_val */
+PvqEntry get_size_mpvq_calc_offset_fx(
+ Word16 dim_in, /* i : dimension */
+ Word16 k_val_in, /* i : nb unit pulses */
+ UWord32 *h_mem /* o : offsets */
);
-void mpvq_decode_vec_fx( /* o : void */
- const PvqEntry *entry, /* i : sign_ind, index, dim, k_val */
- UWord32 *h_mem, /* i : A/U offsets */
- Word16 *vec_out /* o : pulse train */
+
+void mpvq_decode_vec_fx(
+ const PvqEntry *entry, /* i : sign_ind, index, dim, k_val */
+ UWord32 *h_mem, /* i : A/U offsets */
+ Word16 *vec_out /* o : pulse train */
);
-// weight_a_fx.c
+
void weight_a_subfr_fx(
const Word16 nb_subfr, /* i : number of subframes Q0 */
const Word16 *A, /* i : LP filter coefficients Q12 */
@@ -2430,6 +2557,7 @@ void weight_a_fx(
const Word16 gamma, /* i: weighting factor Q15 */
const Word16 m /* i: order of LP filter Q0 */
);
+
void E_LPC_a_weight_inv(
const Word16 *a, /* Q12 */
Word16 *ap, /* Q12 */
@@ -2437,7 +2565,6 @@ void E_LPC_a_weight_inv(
const Word16 m /* Q0 */
);
-// residu_fx.c
void Residu3_lc_fx(
const Word16 a[], /* i : prediction coefficients Q12 */
const Word16 m, /* i : order of LP filter Q0 */
@@ -2468,44 +2595,48 @@ void calc_residu_fx(
Word16 *res, /* o : residual signal Qx+1*/
const Word16 *p_Aq /* i : quantized LP filter coefficients Q12*/
);
-// inerpol_lc.c
-Word32 Interpol_lc_fx( /* o : interpolated value Q15 */
- const Word16 *x, /* i : input vector Q0 */
- const Word16 *win, /* i : interpolation window Q14 */
- const Word16 frac, /* i : fraction (0..up_samp) Q0 */
- const Word16 up_samp, /* i : upsampling factor Q0 */
- const Word16 nb_coef /* i : number of coefficients Q0 */
-);
-
-Word16 modify_Fs_ivas_fx( /* o : length of output Q0 */
- const Word16 sigIn_fx[], /* i : signal to decimate Q0 */
- Word16 lg, /* i : length of input Q0 */
- const Word32 fin, /* i : frequency of input Q0 */
- Word16 sigOut_fx[], /* o : decimated signal Q0 */
- const Word32 fout, /* i : frequency of output Q0 */
- Word16 mem_fx[], /* i/o: filter memory Q0 */
- const Word16 nblp, /* i : flag indicating if NB low-pass is applied */
- Word16 *Q_new_inp, /*scaling added on sigOut_fx */
- Word16 *mem_decim_size /*i: size modified for mem_fx*/
-);
-// modif_fs_fx.c
-Word16 modify_Fs_fx( /* o : length of output Q0 */
- const Word16 sigIn_fx[], /* i : signal to decimate Q0 */
- Word16 lg, /* i : length of i Q0 */
- const Word32 fin, /* i : frequency of i Q0 */
- Word16 sigOut_fx[], /* o : decimated signal Q0 */
- const Word32 fout, /* i : frequency of output Q0 */
- Word16 mem_fx[], /* i/o: filter memory Q0 */
- const Word16 nblp /* i : flag indicating if NB low-pass is applied */
-);
-
-Word16 modify_Fs_intcub3m_sup_fx( /* o : length of output */
- const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */
- const Word16 lg, /* i : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */
- const Word32 fin, /* i : frequency of input */
- Word16 sigOut[], /* o : decimated signal */
- const Word32 fout, /* i : frequency of output */
- Word16 *delayout /* o : delay of output */
+
+/* o : interpolated value Q15 */
+Word32 Interpol_lc_fx(
+ const Word16 *x, /* i : input vector Q0 */
+ const Word16 *win, /* i : interpolation window Q14 */
+ const Word16 frac, /* i : fraction (0..up_samp) Q0 */
+ const Word16 up_samp, /* i : upsampling factor Q0 */
+ const Word16 nb_coef /* i : number of coefficients Q0 */
+);
+
+/* o : length of output Q0 */
+Word16 modify_Fs_ivas_fx(
+ const Word16 sigIn_fx[], /* i : signal to decimate Q0 */
+ Word16 lg, /* i : length of input Q0 */
+ const Word32 fin, /* i : frequency of input Q0 */
+ Word16 sigOut_fx[], /* o : decimated signal Q0 */
+ const Word32 fout, /* i : frequency of output Q0 */
+ Word16 mem_fx[], /* i/o: filter memory Q0 */
+ const Word16 nblp, /* i : flag indicating if NB low-pass is applied */
+ Word16 *Q_new_inp, /*scaling added on sigOut_fx */
+ Word16 *mem_decim_size /*i: size modified for mem_fx*/
+);
+
+/* o : length of output Q0 */
+Word16 modify_Fs_fx(
+ const Word16 sigIn_fx[], /* i : signal to decimate Q0 */
+ Word16 lg, /* i : length of i Q0 */
+ const Word32 fin, /* i : frequency of i Q0 */
+ Word16 sigOut_fx[], /* o : decimated signal Q0 */
+ const Word32 fout, /* i : frequency of output Q0 */
+ Word16 mem_fx[], /* i/o: filter memory Q0 */
+ const Word16 nblp /* i : flag indicating if NB low-pass is applied */
+);
+
+/* o : length of output */
+Word16 modify_Fs_intcub3m_sup_fx(
+ const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */
+ const Word16 lg, /* i : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */
+ const Word32 fin, /* i : frequency of input */
+ Word16 sigOut[], /* o : decimated signal */
+ const Word32 fout, /* i : frequency of output */
+ Word16 *delayout /* o : delay of output */
);
void Decimate_allpass_steep_fx(
@@ -2583,8 +2714,6 @@ void retro_interp4_5_fx(
void retro_interp5_4_fx(
Word16 *pst_old_syn_fx );
-// lag_wind.c
-
void adapt_lag_wind(
Word16 r_h[], /* in/out: autocorrelations */
Word16 r_l[], /* in/out: autocorrelations */
@@ -2651,7 +2780,7 @@ Word16 E_UTIL_f_preemph3_ivas_fx(
Word16 *mem, /* Qx */
Word16 bits /* Q0 */
);
-// swb_bwe_com_fx.c
+
Word16 WB_BWE_gain_pred_fx(
Word16 *WB_fenv, /* o : WB frequency envelopes */
const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */
@@ -2675,10 +2804,11 @@ void calc_normal_length_fx(
Word16 *prev_L_swb_norm, /*i/o : last normalize length */
Word16 Q_syn );
-Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 */
- const Word32 *sp, /* i : i signal */
- const Word16 exp_sp, /* i : Exp of inp signal */
- const Word16 N /* i : signal length */
+/* o : Tilt in Q24 */
+Word16 ivas_calc_tilt_bwe_fx(
+ const Word32 *sp, /* i : i signal */
+ const Word16 exp_sp, /* i : Exp of inp signal */
+ const Word16 N /* i : signal length */
);
void calc_norm_envelop_fx(
@@ -3094,22 +3224,18 @@ void ScaleShapedWB_fx(
const Word16 *win, /* i : window */
const Word16 *subwin, /* i : subframes window */
const Word16 Q_bwe_exc,
- Word16 L_frame /* i : Frame length - determines whether 12.8 or 16kHz core in-use */
- ,
- Word16 dynQ /* i : indicate whether output is dynamic Q, or Q0 */
- ,
- Word16 *Qx /* o : newly computed Q factor for synSHB */
- ,
- Word16 prev_Qx /* i : prev_Qx for memory scaling */
- ,
+ Word16 L_frame, /* i : Frame length - determines whether 12.8 or 16kHz core in-use */
+ Word16 dynQ, /* i : indicate whether output is dynamic Q, or Q0 */
+ Word16 *Qx, /* o : newly computed Q factor for synSHB */
+ Word16 prev_Qx, /* i : prev_Qx for memory scaling */
Word32 *Hilbert_Mem /* i : Hilbert memory used for computing Qx */
);
void non_linearity_fx(
const Word16 i[], /* i : i signal Q_inp */
- Word32 output[], /* o : output signal 2*Q_inp */
+ Word32 output[], /* o : output signal 2*Q_inp */
const Word16 length, /* i : i length */
- Word32 *prev_scale, /* i/o: memory Q30 */
+ Word32 *prev_scale, /* i/o: memory Q30 */
Word16 Q_inp,
Word16 coder_type, /* i : Coder Type */
Word16 *voice_factors, /* i : Voice Factors */
@@ -3118,9 +3244,9 @@ void non_linearity_fx(
void non_linearity_ivas_fx(
const Word16 i[], /* i : i signal Q_inp */
- Word32 output[], /* o : output signal 2*Q_inp */
+ Word32 output[], /* o : output signal 2*Q_inp */
const Word16 length, /* i : i length */
- Word32 *prev_scale, /* i/o: memory Q30 */
+ Word32 *prev_scale, /* i/o: memory Q30 */
Word16 Q_inp,
Word16 coder_type, /* i : Coder Type */
Word16 *voice_factors, /* i : Voice Factors */
@@ -3129,17 +3255,21 @@ void non_linearity_ivas_fx(
void interp_code_5over2_fx(
const Word16 inp_code[], /* i : i vector */
- Word16 interp_code[], /* o : output vector */
+ Word16 interp_code[], /* o : output vector */
const Word16 inp_length /* i : length of i vector */
);
void interp_code_4over2_fx(
const Word16 inp_code_fx[], /* i : i vector Qx */
- Word16 interp_code_fx[], /* o : output vector Qx */
+ Word16 interp_code_fx[], /* o : output vector Qx */
const Word16 inp_length /* i : length of i vector */
);
-void wb_tbe_extras_reset_synth_fx( Word16 state_lsyn_filt_shb[], Word16 state_lsyn_filt_dwn_shb[], Word16 state_32and48k_WB_upsample[], Word16 state_resamp_HB[] );
+void wb_tbe_extras_reset_synth_fx(
+ Word16 state_lsyn_filt_shb[],
+ Word16 state_lsyn_filt_dwn_shb[],
+ Word16 state_32and48k_WB_upsample[],
+ Word16 state_resamp_HB[] );
void elliptic_bpf_48k_generic_fx(
const Word16 element_mode,
@@ -3178,15 +3308,18 @@ void prep_tbe_exc_fx(
Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/
const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */
const Word16 code_preQ_fx[], /* i : prequantizer excitation */
- const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
- const Word16 T0, /* i : integer pitch variables Q0 */
- const Word16 T0_frac, /* i : Fractional pitch variables Q0*/
- const Word16 coder_type, /* i : coding type */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 element_mode, /* i : element mode */
- const Word16 idchan, /* i : channel ID */
- const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
- const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
+#ifdef FIX_2010_PREP_TBE_EXC
+ const Word16 Q_code_preQ, /* i : Q, prequantizer excitation */
+#endif
+ const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
+ const Word16 T0, /* i : integer pitch variables Q0 */
+ const Word16 T0_frac, /* i : Fractional pitch variables Q0*/
+ const Word16 coder_type, /* i : coding type */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 idchan, /* i : channel ID */
+ const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
+ const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
);
/*! r: Formant filter strength [0,1] */
@@ -3205,8 +3338,6 @@ Word16 get_tbe_bits_fx(
const Word16 rf_mode /* i : bandwidht mode */
);
-// pvq_com_fx
-
UWord32 intLimCDivPos_fx(
UWord32 NUM, /* Qx */
Word16 DEN /* Q0 */
@@ -3330,15 +3461,16 @@ void srt_vec_ind16_fx(
Word16 length /* Q0 */
);
-Word16 atan2_fx( /* o: Angle between 0 and PI/2 radian (Q14) */
- const Word32 y, /* i : near side (Argument must be positive) (Q15) */
- const Word32 x /* i : opposite side (Q15) */
+/* o: Angle between 0 and PI/2 radian (Q14) */
+Word16 atan2_fx(
+ const Word32 y, /* i : near side (Argument must be positive) (Q15) */
+ const Word32 x /* i : opposite side (Q15) */
);
-// rang_com_fx.c
-Word16 rc_get_bits2_fx( /* o: Number of bits needed Q0*/
- const Word16 N, /* i: Number of bits currently used Q0*/
- const UWord32 range /* i: Range of range coder Q0*/
+/* o: Number of bits needed Q0*/
+Word16 rc_get_bits2_fx(
+ const Word16 N, /* i: Number of bits currently used Q0*/
+ const UWord32 range /* i: Range of range coder Q0*/
);
void rangeCoderFinalizationFBits_fx(
@@ -3347,10 +3479,8 @@ void rangeCoderFinalizationFBits_fx(
Word16 *FBits /* i : Fractional finalization bits Q0*/
);
-// wi_fx.c
-
-ivas_error DTFS_new_fx( DTFS_STRUCTURE **dtfs_out );
-
+ivas_error DTFS_new_fx(
+ DTFS_STRUCTURE **dtfs_out );
void DTFS_copy_fx(
DTFS_STRUCTURE *Xout_fx, /* o: DTFS structure */
@@ -3371,11 +3501,23 @@ Word16 DTFS_alignment_full_fx(
Word16 *C_fx,
Word16 FR_flag );
-void DTFS_phaseShift_fx( DTFS_STRUCTURE *X_fx, Word16 ph, Word16 Lag, Word16 *S_fx, Word16 *C_fx );
+void DTFS_phaseShift_fx(
+ DTFS_STRUCTURE *X_fx,
+ Word16 ph,
+ Word16 Lag,
+ Word16 *S_fx,
+ Word16 *C_fx );
-void Q2phaseShift_fx( DTFS_STRUCTURE *X_fx, Word16 ph, Word16 Lag, Word16 *S_fx, Word16 *C_fx );
+void Q2phaseShift_fx(
+ DTFS_STRUCTURE *X_fx,
+ Word16 ph,
+ Word16 Lag,
+ Word16 *S_fx,
+ Word16 *C_fx );
-void DTFS_zeroPadd_fx( Word16 N_fx, DTFS_STRUCTURE *X_fx );
+void DTFS_zeroPadd_fx(
+ Word16 N_fx,
+ DTFS_STRUCTURE *X_fx );
void DTFS_to_fs_fx(
const Word16 *x, /* i : time domain signal */
@@ -3393,39 +3535,46 @@ void DTFS_zeroFilter_fx(
Word16 *S_fx,
Word16 *C_fx );
-void DTFS_poleFilter_fx_9( DTFS_STRUCTURE *X_fx, Word16 *pf_temp1, Word16 *pf_temp2, Word16 *pf_temp, Word16 *pf_n2_temp1 );
+void DTFS_poleFilter_fx_9(
+ DTFS_STRUCTURE *X_fx,
+ Word16 *pf_temp1,
+ Word16 *pf_temp2,
+ Word16 *pf_temp,
+ Word16 *pf_n2_temp1 );
void DTFS_adjustLag_fx(
DTFS_STRUCTURE *X_DTFS_FX, /* i/o : DTFS to adjust lag for */
Word16 N_fx /* i : Target lag */
);
-Word32 DTFS_getEngy_fx( DTFS_STRUCTURE *X_fx );
+Word32 DTFS_getEngy_fx(
+ DTFS_STRUCTURE *X_fx );
-Word32 DTFS_getEngy_P2A_fx( DTFS_STRUCTURE *X_fx );
+Word32 DTFS_getEngy_P2A_fx(
+ DTFS_STRUCTURE *X_fx );
void DTFS_car2pol_fx(
DTFS_STRUCTURE *X_fx /* i/o : DTFS structure a, b, lag */
);
Word32 DTFS_setEngyHarm_fx(
- Word16 f1_fx, /* i : lower band freq of i to control energy */
- Word16 f2_fx, /* i : upper band freq of i to control energy */
+ Word16 f1_fx, /* i : lower band freq of i to control energy */
+ Word16 f2_fx, /* i : upper band freq of i to control energy */
Word16 g1_fx, /* i : lower band freq of output to control energy */
Word16 g2_fx, /* i : upper band freq of output to control energy */
Word32 en2_fx, /* i : Target Energy to set the DTFS to */
- Word16 Qen2_fx, /* i : Input Q format for en2 */
- Word16 *Qa_fx, /* i : Output Q format for x->a */
+ Word16 Qen2_fx, /* i : Input Q format for en2 */
+ Word16 *Qa_fx, /* i : Output Q format for x->a */
DTFS_STRUCTURE *X_fx /* i/o: DTFS to adjust the energy of */
);
void DTFS_to_erb_fx(
- const DTFS_STRUCTURE X_fx, /* i : DTFS i */
- Word16 *out_fx /* o : ERB output */
+ const DTFS_STRUCTURE X_fx, /* i : DTFS i */
+ Word16 *out_fx /* o : ERB output */
);
void erb_slot_fx(
- Word16 lag_fx, /* i : i lag */
+ Word16 lag_fx, /* i : i lag */
Word16 *out_fx, /* o : ERB slots */
Word16 *mfreq_fx, /* i : ERB frequencies */
Word16 num_erb_fx /* i : number of ERBs */
@@ -3435,8 +3584,8 @@ void DTFS_erb_inv_fx(
Word16 *in_fx, /* i : ERB inpt */
Word16 *slot_fx, /* i : ERB slots filled based on lag */
Word16 *mfreq_fx, /* i : erb frequence edges */
- DTFS_STRUCTURE *X_fx, /* o : DTFS after erb-inv */
- Word16 num_erb_fx /* i : Number of ERB bands */
+ DTFS_STRUCTURE *X_fx, /* o : DTFS after erb-inv */
+ Word16 num_erb_fx /* i : Number of ERB bands */
);
void erb_add_fx(
@@ -3448,7 +3597,13 @@ void erb_add_fx(
Word16 num_erb_fx /* i : number of ERBs */
);
-void quant_target_fx( DTFS_STRUCTURE *X_fx, const Word16 *curr_lpc, Word16 *w, Word16 *target, Word16 *sin_tab, Word16 *cos_tab );
+void quant_target_fx(
+ DTFS_STRUCTURE *X_fx,
+ const Word16 *curr_lpc,
+ Word16 *w,
+ Word16 *target,
+ Word16 *sin_tab,
+ Word16 *cos_tab );
ivas_error WIsyn_fx(
DTFS_STRUCTURE PREVCW_FX, /* i : Prev frame DTFS */
@@ -3482,19 +3637,53 @@ void DTFS_peaktoaverage_fx(
Word16 *Qneg /* o : negative peak to ave Q format */
);
-void rshiftHarmBand_fx( DTFS_STRUCTURE *X_fx, Word16 lband_fx, Word16 hband_fx, Word16 shift_fx );
+void rshiftHarmBand_fx(
+ DTFS_STRUCTURE *X_fx,
+ Word16 lband_fx,
+ Word16 hband_fx,
+ Word16 shift_fx );
-void GetSinCosTab_fx( Word16 L, Word16 *sinTab, Word16 *cosTab );
+void GetSinCosTab_fx(
+ Word16 L,
+ Word16 *sinTab,
+ Word16 *cosTab );
-void r_fft_4_fx( Word16 *farray_ptr_fx, Word16 size, Word16 stage, Word16 isign );
+void r_fft_4_fx(
+ Word16 *farray_ptr_fx,
+ Word16 size,
+ Word16 stage,
+ Word16 isign );
-void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE *retX_fx );
+void copy_phase_fx(
+ DTFS_STRUCTURE *X1_fx,
+ DTFS_STRUCTURE X2_fx,
+ DTFS_STRUCTURE *retX_fx );
-Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband, const Word16 *curr_lpc, Word16 *sin_tab, Word16 *cos_tab );
+Word32 getSpEngyFromResAmp_fx(
+ DTFS_STRUCTURE *X_fx,
+ Word16 lband,
+ Word16 hband,
+ const Word16 *curr_lpc,
+ Word16 *sin_tab,
+ Word16 *cos_tab );
-void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_fx, Word16 *C_fx );
+void DTFS_poleFilter_fx(
+ DTFS_STRUCTURE *X_fx,
+ Word16 *LPC,
+ Word16 N,
+ Word16 *S_fx,
+ Word16 *C_fx );
-void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word16 *S_fx, Word16 *C_fx, Word16 *pf_temp1, Word16 *pf_temp2, Word16 *pf_temp, Word16 *pf_n2_temp1 );
+void poleFilter_setup_fx(
+ const Word16 *LPC,
+ Word16 N,
+ DTFS_STRUCTURE X_fx,
+ Word16 *S_fx,
+ Word16 *C_fx,
+ Word16 *pf_temp1,
+ Word16 *pf_temp2,
+ Word16 *pf_temp,
+ Word16 *pf_n2_temp1 );
Word32 DTFS_getEngy_band_wb_fx(
DTFS_STRUCTURE X_fx,
@@ -3546,32 +3735,35 @@ void ApplyTnsFilter(
Word32 spectrum[],
const Word8 fIsAnalysis );
-Word16 ITF_Detect_fx( Word32 const pSpectrum[],
- const Word16 startLine,
- const Word16 stopLine,
- const Word16 maxOrder,
- Word16 *A,
- Word16 *Q_A,
- Word16 *predictionGain,
- Word16 *curr_order,
- Word16 Q );
-
-Word16 ITF_Detect_ivas_fx( Word32 const pSpectrum[],
- const Word16 startLine,
- const Word16 stopLine,
- const Word16 maxOrder,
- Word16 *A,
- Word16 *Q_A,
- Word16 *predictionGain,
- Word16 *curr_order,
- Word16 Q );
-
-void ITF_Apply_fx( Word32 spectrum[],
- Word16 startLine,
- Word16 stopLine,
- const Word16 *A,
- Word16 Q_A,
- Word16 curr_order );
+Word16 ITF_Detect_fx(
+ Word32 const pSpectrum[],
+ const Word16 startLine,
+ const Word16 stopLine,
+ const Word16 maxOrder,
+ Word16 *A,
+ Word16 *Q_A,
+ Word16 *predictionGain,
+ Word16 *curr_order,
+ Word16 Q );
+
+Word16 ITF_Detect_ivas_fx(
+ Word32 const pSpectrum[],
+ const Word16 startLine,
+ const Word16 stopLine,
+ const Word16 maxOrder,
+ Word16 *A,
+ Word16 *Q_A,
+ Word16 *predictionGain,
+ Word16 *curr_order,
+ Word16 Q );
+
+void ITF_Apply_fx(
+ Word32 spectrum[],
+ Word16 startLine,
+ Word16 stopLine,
+ const Word16 *A,
+ Word16 Q_A,
+ Word16 curr_order );
void const *GetTnsFilterCoeff( void const *p, const Word16 index, Word16 *pValue );
@@ -3735,10 +3927,6 @@ void nelp_encoder_ivas_fx(
Word16 *qIn1,
Word16 reduce_gains );
-/*========================================================================================================/
-swb_bwe_enc_lr_fx.c
-/========================================================================================================*/
-
void swb_bwe_enc_lr_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
const Word32 L_m_core[], /* i : lowband synthesis */
@@ -3789,10 +3977,6 @@ void swb_bwe_enc_lr_ivas_fx(
Word16 *ni_seed_fx /* i/o: random seed for search buffer NI */
);
-/*========================================================================================================/
-isf_enc_amr_wb_fx.c
-/========================================================================================================*/
-
void isf_enc_amr_wb_fx(
Encoder_State *st, /* i/o: state structure */
Word16 *isf_new, /* i/o: quantized ISF vector */
@@ -3800,20 +3984,12 @@ void isf_enc_amr_wb_fx(
Word16 *Aq /* o : quantized A(z) for 4 subframes */
);
-/*========================================================================================================/
-detect_transient_fx.c
-/========================================================================================================*/
-
Word16 detect_transient_fx(
const Word16 *in_fx, /*Q_new */
const Word16 L, /*Q0*/
Word16 Q_new,
Encoder_State *st_fx );
-/*========================================================================================================/
-codec_tcx_common.c
-/========================================================================================================*/
-
Word16 tcxGetNoiseFillingTilt(
const Word16 A[],
const Word16 lpcorder,
@@ -3851,7 +4027,6 @@ void tcxInvertWindowGrouping(
const Word16 frame_cnt,
const Word16 bfi );
-// mslvq_com
void permute_fx(
Word16 *pTmp1, /* i/o: vector whose components are to be permuted */
const Word16 *perm /* i : permutation info (indexes that should be interchanged), max two perms */
@@ -3899,15 +4074,12 @@ Word16 deindex_lvq_cng_ivas_fx(
Word16 no_bits /* i: number of bits for lattice */
);
-// lsp_convert_poly_fx.c
Word16 lsp_convert_poly_fx(
Word16 w[], /* i/o: LSP or ISP parameters */
const Word16 L_frame, /* i : flag for up or down conversion */
const Word16 Opt_AMRWB /* i : flag for the AMR-WB IO mode */
);
-
-// cng_exe.c
void CNG_exc_fx(
const Word32 core_brate, /* i : core bitrate */
const Word16 L_frame, /* i : length of the frame */
@@ -3976,30 +4148,29 @@ void cng_params_upd_fx(
);
void cng_params_upd_ivas_fx(
- const Word16 lsp_new[], /* i : LSP aprameters Q15 */
- const Word16 exc2[], /* i : current enhanced excitation Q_exc */
- const Word16 L_frame, /* i : frame length Q0 */
- Word16 *ho_circ_ptr, /* i/o: pointer for CNG averaging buffers Q0 */
- Word32 ho_ener_circ[], /* o : energy buffer for CNG averaging Q6 */
- Word16 *ho_circ_size, /* i/o: size of DTX hangover history buffer for averaging Q0 */
- Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */
- const Word16 Q_exc, /* i : Q value of excitation */
- const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */
- Word32 ho_env_circ[], /* i/o: Envelope buffer */
- Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */
- Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */
- Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */
- Word32 cng_brate_buf[], /* i/o: last_active_brate buffer Q0 */
- const Word32 last_active_brate /* i : Last active bit rate Q0 */
- ,
- const Word16 element_mode, /* i : Element mode */
- const Word16 bwidth /* i : Audio bandwidth */
+ const Word16 lsp_new[], /* i : LSP aprameters Q15 */
+ const Word16 exc2[], /* i : current enhanced excitation Q_exc */
+ const Word16 L_frame, /* i : frame length Q0 */
+ Word16 *ho_circ_ptr, /* i/o: pointer for CNG averaging buffers Q0 */
+ Word32 ho_ener_circ[], /* o : energy buffer for CNG averaging Q6 */
+ Word16 *ho_circ_size, /* i/o: size of DTX hangover history buffer for averaging Q0 */
+ Word16 ho_lsp_circ[], /* o : old LSP buffer for CNG averaging Q15 */
+ const Word16 Q_exc, /* i : Q value of excitation */
+ const Word16 enc_dec_flag, /* i : Flag indicating encoder or decoder (ENC,DEC) */
+ Word32 ho_env_circ[], /* i/o: Envelope buffer */
+ Word16 *cng_buf_cnt, /* i/o: Counter of postponed FFT-processing instances */
+ Word16 cng_exc2_buf[], /* i/o: Excitation buffer Q_exc */
+ Word16 cng_Qexc_buf[], /* i/o: Q_exc buffer Q0 */
+ Word32 cng_brate_buf[], /* i/o: last_active_brate buffer Q0 */
+ const Word32 last_active_brate, /* i : Last active bit rate Q0 */
+ const Word16 element_mode, /* i : Element mode */
+ const Word16 bwidth /* i : Audio bandwidth */
);
+
Word16 get_cng_mode(
const Word32 last_active_brate /* i : last active bitrate */
);
-// core_com_config.c
/*! r: codec mode */
Word16 get_codec_mode(
const Word32 total_brate /* i : total bitrate */
@@ -4015,13 +4186,13 @@ Word16 getTcxonly_fx(
const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
const Word16 is_ism_format /* i : flag indicating ISM format */
);
+
Word16 getCtxHm(
const Word16 element_mode, /* i : IVAS element mode */
const Word32 total_brate, /* i : total bitrate */
const Word16 rf_flag /* i : flag to signal the RF mode */
);
-
Word16 getResq(
const Word32 total_brate /* i : total bitrate */
);
@@ -4054,7 +4225,8 @@ Word32 getCoreSamplerateMode2(
const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */
);
-Word16 getTcxBandwidth( const Word16 bandwidth );
+Word16 getTcxBandwidth(
+ const Word16 bandwidth );
Word16 getIgfPresent_fx(
const Word16 element_mode, /* i : IVAS element mode */
@@ -4082,7 +4254,8 @@ Word16 initPitchLagParameters(
Word16 *pit_fr2,
Word16 *pit_max );
-Word16 getNumTcxCodedLines( const Word16 bwidth );
+Word16 getNumTcxCodedLines(
+ const Word16 bwidth );
Word16 getTcxLpcShapedAri(
const Word32 total_brate, /* i : total bitrate */
@@ -4111,8 +4284,8 @@ void mdct_window_aldo(
Word16 n /* Q0 */
);
-// tcx_utils.c
-Word16 getInvFrameLen( const Word16 L_frame ); /* returns 1/L_frame in Q21 format */
+Word16 getInvFrameLen(
+ const Word16 L_frame ); /* returns 1/L_frame in Q21 format */
void tcx_get_windows(
TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration */
@@ -4218,12 +4391,20 @@ void mdct_noiseShaping_interp(
Word16 gains[],
Word16 gains_exp[] );
-void PsychAdaptLowFreqDeemph( Word32 x[],
- const Word16 lpcGains[],
- const Word16 lpcGains_e[],
- Word16 lf_deemph_factors[] );
+void PsychAdaptLowFreqDeemph(
+ Word32 x[],
+ const Word16 lpcGains[],
+ const Word16 lpcGains_e[],
+ Word16 lf_deemph_factors[] );
-void AdaptLowFreqDeemph( Word32 x[], Word16 x_e, Word16 tcx_lpc_shaped_ari, Word16 lpcGains[], Word16 lpcGains_e[], const Word16 lg, Word16 lf_deemph_factors[] );
+void AdaptLowFreqDeemph(
+ Word32 x[],
+ Word16 x_e,
+ Word16 tcx_lpc_shaped_ari,
+ Word16 lpcGains[],
+ Word16 lpcGains_e[],
+ const Word16 lg,
+ Word16 lf_deemph_factors[] );
void tcx_noise_filling(
Word32 *Q,
@@ -4284,15 +4465,16 @@ void SetTnsConfig(
const Word16 isTCX20,
const Word16 isAfterACELP );
-void tcx_get_gain( Word32 *x, /* i: spectrum 1 */
- Word16 x_e, /* i: spectrum 1 exponent */
- Word32 *y, /* i: spectrum 2 */
- Word16 y_e, /* i: spectrum 2 exponent */
- Word16 n, /* i: length */
- Word16 *gain, /* o: gain */
- Word16 *gain_e, /* o: gain exponent */
- Word32 *en_y, /* o: energy of y (optional) */
- Word16 *en_y_e /* o: energy of y exponent (optional) */
+void tcx_get_gain(
+ Word32 *x, /* i: spectrum 1 */
+ Word16 x_e, /* i: spectrum 1 exponent */
+ Word32 *y, /* i: spectrum 2 */
+ Word16 y_e, /* i: spectrum 2 exponent */
+ Word16 n, /* i: length */
+ Word16 *gain, /* o: gain */
+ Word16 *gain_e, /* o: gain exponent */
+ Word32 *en_y, /* o: energy of y (optional) */
+ Word16 *en_y_e /* o: energy of y exponent (optional) */
);
void init_TCX_config(
@@ -4306,7 +4488,6 @@ void init_TCX_config(
void resetTecDec_Fx(
TEC_DEC_HANDLE hTecDec );
-
void resetTecEnc_Fx(
TEC_ENC_HANDLE hTECEnc,
Word16 flag );
@@ -4357,7 +4538,10 @@ void tecEnc_TBE_fx(
const Word16 *voicing,
const Word16 coder_type );
-void set_TEC_TFA_code_fx( const Word16 corrFlag, Word16 *tec_flag, Word16 *tfa_flag );
+void set_TEC_TFA_code_fx(
+ const Word16 corrFlag,
+ Word16 *tec_flag,
+ Word16 *tfa_flag );
// tcx_mdct_fx.c
void TCX_MDCT(
@@ -4413,8 +4597,8 @@ void TCX_MDXT_Inverse_fx(
#define EDCT_FACTOR_SCALE 2
void edct_fx(
const Word32 *x, /* i : i signal Qq */
- Word32 *y, /* o : output transform Qq */
- Word16 length, /* i : length */
+ Word32 *y, /* o : output transform Qq */
+ Word16 length, /* i : length */
Word16 *q /* i : Q value of i signal */
);
@@ -4427,23 +4611,23 @@ void edct_ivas_fx(
void edst_fx(
const Word32 *x, /* i : i signal Qq */
- Word32 *y, /* o : output transform Qq */
- Word16 length, /* i : length */
+ Word32 *y, /* o : output transform Qq */
+ Word16 length, /* i : length */
Word16 *q /* i : Q value of i signal */
);
void edct_16fx(
const Word16 *x, /* i : i signal Qx */
Word16 *y, /* o : output transform Qx */
- Word16 length, /* i : length */
- Word16 bh, /* bit-headroom */
+ Word16 length, /* i : length */
+ Word16 bh, /* bit-headroom */
const Word16 element_mode );
void iedct_short_fx(
const Word32 *in, /* i : i vector */
Word16 *Q, /* i/o: Q value of i */
- Word32 *out, /* o : output vector */
- const Word16 segment_length /* i : length */
+ Word32 *out, /* o : output vector */
+ const Word16 segment_length /* i : length */
);
void edxt_fx(
@@ -4625,28 +4809,32 @@ void cldfbSynthesis_fx(
Word32 *pWorkBuffer /*!< pointer to temporal working buffer */
);
-void configureCldfb( HANDLE_CLDFB_FILTER_BANK h_cldfb, /*!< CLDFB Handle */
- const Word16 no_channels, /*!< Number of critically sampled bands */
- const Word16 frameSize /*!< FrameSize */
+void configureCldfb(
+ HANDLE_CLDFB_FILTER_BANK h_cldfb, /*!< CLDFB Handle */
+ const Word16 no_channels, /*!< Number of critically sampled bands */
+ const Word16 frameSize /*!< FrameSize */
);
-ivas_error openCldfb( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /*!< CLDFB Handle */
- const Word16 type, /*!< analysis or synthesis */
- const Word16 maxCldfbBands, /*!< number of cldfb bands */
- const Word16 frameSize /*!< FrameSize */
+ivas_error openCldfb(
+ HANDLE_CLDFB_FILTER_BANK *h_cldfb, /*!< CLDFB Handle */
+ const Word16 type, /*!< analysis or synthesis */
+ const Word16 maxCldfbBands, /*!< number of cldfb bands */
+ const Word16 frameSize /*!< FrameSize */
);
+
void resampleCldfb(
HANDLE_CLDFB_FILTER_BANK hs, /*!< CLDFB Handle */
const Word16 newCldfbBands, /*!< number of cldfb bands */
const Word16 frameSize, /*!< FrameSize */
const Word8 firstFrame );
-Word16
-AnalysisPostSpectrumScaling_Fx( HANDLE_CLDFB_FILTER_BANK cldfbBank,
- Word32 **rSubband32,
- Word32 **iSubband32,
- Word16 **rSubband16,
- Word16 **iSubband16,
- Word16 *cldfbScale );
+
+Word16 AnalysisPostSpectrumScaling_Fx(
+ HANDLE_CLDFB_FILTER_BANK cldfbBank,
+ Word32 **rSubband32,
+ Word32 **iSubband32,
+ Word16 **rSubband16,
+ Word16 **iSubband16,
+ Word16 *cldfbScale );
void analysisCldfbEncoder_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
@@ -4659,30 +4847,36 @@ void analysisCldfbEncoder_fx(
Word16 *enerBuffSum_exp,
CLDFB_SCALE_FACTOR *scale );
-void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q31 | pointer to the result in the core look-ahead slot */
- Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot - apply as negative exponent*/
- const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */
- Word16 **realValues, /*!< i: Q15 | the real part of the CLDFB subsamples */
- Word16 **imagValues, /*!< i: Q15 | the imaginary part of the CLDFB subsamples */
- Word16 sf_Values, /*!< i: scalefactor of the CLDFB subcamples - apply as a negated Exponent */
- Word16 numberBands, /*!< i: Q0 | number of CLDFB bands */
- Word16 numberCols, /*!< i: Q0 | number of CLDFB subsamples */
- Word32 *energyHF, /*!< o: Q31 | pointer to HF energy */
- Word16 *energyHF_Exp, /*!< o: pointer to exponent of HF energy */
- Word32 *energyValuesSum, /*!< o: Q31 | pointer to sum array of energy values, not initialized*/
- Word16 *energyValuesSum_Exp, /*!< o: pointer to exponents of energyValuesSum, not initialized */
- TEC_ENC_HANDLE hTECEnc );
-
-Word16
-CLDFB_getNumChannels( Word32 sampleRate );
-
-void deleteCldfb( HANDLE_CLDFB_FILTER_BANK *h_cldfb ); /*!< CLDFB Handle */
-
-ivas_error cldfb_save_memory( HANDLE_CLDFB_FILTER_BANK hs ); /* i/o: cldfb handle */
-void cldfb_restore_memory( HANDLE_CLDFB_FILTER_BANK hs ); /* i/o: cldfb handle */
-void cldfb_reset_memory( HANDLE_CLDFB_FILTER_BANK hs ); /* i/o: cldfb handle */
-
-// bits_alloc.c from IVAS
+void GetEnergyCldfb(
+ Word32 *energyLookahead, /*!< o: Q31 | pointer to the result in the core look-ahead slot */
+ Word16 *sf_energyLookahead, /*!< o: pointer to the scalefactor of the result in the core look-ahead slot - apply as negative exponent*/
+ const Word16 numLookahead, /*!< i: Q0 the number of look-ahead time-slots */
+ Word16 **realValues, /*!< i: Q15 | the real part of the CLDFB subsamples */
+ Word16 **imagValues, /*!< i: Q15 | the imaginary part of the CLDFB subsamples */
+ Word16 sf_Values, /*!< i: scalefactor of the CLDFB subcamples - apply as a negated Exponent */
+ Word16 numberBands, /*!< i: Q0 | number of CLDFB bands */
+ Word16 numberCols, /*!< i: Q0 | number of CLDFB subsamples */
+ Word32 *energyHF, /*!< o: Q31 | pointer to HF energy */
+ Word16 *energyHF_Exp, /*!< o: pointer to exponent of HF energy */
+ Word32 *energyValuesSum, /*!< o: Q31 | pointer to sum array of energy values, not initialized*/
+ Word16 *energyValuesSum_Exp, /*!< o: pointer to exponents of energyValuesSum, not initialized */
+ TEC_ENC_HANDLE hTECEnc );
+
+Word16 CLDFB_getNumChannels(
+ Word32 sampleRate );
+
+void deleteCldfb(
+ HANDLE_CLDFB_FILTER_BANK *h_cldfb ); /*!< CLDFB Handle */
+
+ivas_error cldfb_save_memory(
+ HANDLE_CLDFB_FILTER_BANK hs ); /* i/o: cldfb handle */
+
+void cldfb_restore_memory(
+ HANDLE_CLDFB_FILTER_BANK hs ); /* i/o: cldfb handle */
+
+void cldfb_reset_memory(
+ HANDLE_CLDFB_FILTER_BANK hs ); /* i/o: cldfb handle */
+
void BITS_ALLOC_init_config_acelp(
const Word32 bit_rate,
const Word16 narrowBand,
@@ -4706,7 +4900,7 @@ Word16 set_ACELP_flag(
const Word16 bwidth, /* i : audio bandwidth */
const Word16 cng_type /* i : CNG type */
);
-// syn_128_fx.c
+
void syn_12k8_fx(
Word16 L_frame,
const Word16 *Aq, /* i : LP filter coefficients Q12 */
@@ -4718,14 +4912,15 @@ void syn_12k8_fx(
const Word16 Q_exc, /* i : Excitation scaling Q0 */
const Word16 Q_syn /* i : Synthesis scaling Q0 */
);
-// est_tilt_fx.c
-Word16 est_tilt_fx( /* o : tilt of the code Q15 */
- const Word16 *exc, /* i : adaptive excitation vector Qx */
- const Word16 gain_pit, /* i : adaptive gain Q14 */
- const Word16 *code, /* i : algebraic exctitation vector Q9 */
- const Word32 gain_code, /* i : algebraic code gain Q16 */
- Word16 *voice_fac, /* o : voicing factor Q15 */
- const Word16 Q_exc /* i : Scaling factor of excitation Q0 */
+
+/* o : tilt of the code Q15 */
+Word16 est_tilt_fx(
+ const Word16 *exc, /* i : adaptive excitation vector Qx */
+ const Word16 gain_pit, /* i : adaptive gain Q14 */
+ const Word16 *code, /* i : algebraic exctitation vector Q9 */
+ const Word32 gain_code, /* i : algebraic code gain Q16 */
+ Word16 *voice_fac, /* o : voicing factor Q15 */
+ const Word16 Q_exc /* i : Scaling factor of excitation Q0 */
);
/* o : tilt of the code Q15 */
@@ -4740,26 +4935,28 @@ Word16 est_tilt_ivas_fx(
const Word16 flag_tilt /* i : flag for special tilt */
);
-Word16 Est_tilt2( /* o : tilt of the code */
- const Word16 *exc, /* i : adaptive excitation vector Qx */
- const Word16 gain_pit, /* i : adaptive gain Q14 */
- const Word16 *code, /* i : algebraic exctitation vector Q9 */
- const Word32 gain_code, /* i : algebraic code gain Q16 */
- Word16 *voice_fac, /* o : voicing factor Q15 */
- const Word16 Q_exc /* i : Scaling factor of excitation Q0 */
+/* o : tilt of the code */
+Word16 Est_tilt2(
+ const Word16 *exc, /* i : adaptive excitation vector Qx */
+ const Word16 gain_pit, /* i : adaptive gain Q14 */
+ const Word16 *code, /* i : algebraic exctitation vector Q9 */
+ const Word32 gain_code, /* i : algebraic code gain Q16 */
+ Word16 *voice_fac, /* o : voicing factor Q15 */
+ const Word16 Q_exc /* i : Scaling factor of excitation Q0 */
);
-void E_UTIL_voice_factor( Word16 *exc, /* i : pointer to the excitation frame Q_new */
- Word16 i_subfr, /* i : subframe index */
- Word16 *code, /* i : innovative codebook Q9 */
- Word16 gain_pit, /* i : adaptive codebook gain 1Q14 */
- Word32 gain_code, /* i : innovative cb. gain 15Q16 */
- Word16 *voice_fac, /* o : subframe voicing estimation Q15 */
- Word16 *tilt_code, /* o : tilt factor Q15 */
- Word16 L_subfr, /* i : subframe length */
- Word16 flag_tilt, /* i : Flag for triggering new voice factor tilt*/
- Word16 Q_new, /* i : excitation buffer format */
- Word16 shift /* i : scaling to get 12bit */
+void E_UTIL_voice_factor(
+ Word16 *exc, /* i : pointer to the excitation frame Q_new */
+ Word16 i_subfr, /* i : subframe index */
+ Word16 *code, /* i : innovative codebook Q9 */
+ Word16 gain_pit, /* i : adaptive codebook gain 1Q14 */
+ Word32 gain_code, /* i : innovative cb. gain 15Q16 */
+ Word16 *voice_fac, /* o : subframe voicing estimation Q15 */
+ Word16 *tilt_code, /* o : tilt factor Q15 */
+ Word16 L_subfr, /* i : subframe length */
+ Word16 flag_tilt, /* i : Flag for triggering new voice factor tilt*/
+ Word16 Q_new, /* i : excitation buffer format */
+ Word16 shift /* i : scaling to get 12bit */
);
// window_ola_fx.c
@@ -4805,7 +5002,6 @@ void window_ola_ext_fx(
const UWord16 kernel_type /* i : transform kernel type */
);
-// cb_shape_fx.c
void cb_shape_fx(
const Word16 preemphFlag, /* i : flag for pre-emphasis */
const Word16 pitchFlag, /* i : flag for pitch sharpening */
@@ -4822,7 +5018,6 @@ void cb_shape_fx(
const Word16 L_subfr /* i : subframe lenght */
);
-// longarith.c
void longadd(
UWord16 a[], /* i/o: vector of the length lena */
const UWord16 b[], /* i/o: vector of the length lenb */
@@ -4850,7 +5045,6 @@ void longshr(
Word16 bits,
Word16 len );
-// gs_bitallocation.c
void bands_and_bit_alloc_fx(
const Word16 cor_strong_limit, /* i : HF correlation */
const Word16 noise_lev, /* i : dwn scaling factor */
@@ -4873,7 +5067,6 @@ void bands_and_bit_alloc_fx(
const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
);
-// low_rate_band_att_fx.c
void fine_gain_pred_fx(
const Word16 *sfm_start, /* i : Sub band start indices */
const Word16 *sfm_end, /* i : Sub band end indices */
@@ -4907,6 +5100,7 @@ void get_max_pulses_fx(
Word16 *inp_vector, /* i/o: Encoded shape vectors (int)Q0*/
Word16 *maxpulse /* o : Maximum pulse height per band Q0*/
);
+
void fine_gain_dec_fx(
Decoder_State *st,
const Word16 *ord, /* i : Indices for energy order */
@@ -4915,17 +5109,16 @@ void fine_gain_dec_fx(
Word16 *fg_pred /* i/o: Predicted gains / Corrected gains Q12*/
);
-// fine_gain_bits_fx.c
-Word16 assign_gain_bits_fx( /* o : Number of assigned gain bits */
- const Word16 core, /* i : HQ core */
- const Word16 BANDS, /* i : Number of bands */
- const Word16 *band_width, /* i : Sub band bandwidth */
- Word16 *Rk, /* i/o: Bit allocation/Adjusted bit alloc. Q3 */
- Word16 *gain_bits_array, /* o : Assigned gain bits */
- Word16 *Rcalc /* o : Bit budget for shape quantizer Q3 */
+/* o : Number of assigned gain bits */
+Word16 assign_gain_bits_fx(
+ const Word16 core, /* i : HQ core */
+ const Word16 BANDS, /* i : Number of bands */
+ const Word16 *band_width, /* i : Sub band bandwidth */
+ Word16 *Rk, /* i/o: Bit allocation/Adjusted bit alloc. Q3 */
+ Word16 *gain_bits_array, /* o : Assigned gain bits */
+ Word16 *Rcalc /* o : Bit budget for shape quantizer Q3 */
);
-// gs_noisefill.c
void freq_dnw_scaling_fx(
const Word16 cor_strong_limit, /* i : HF correlation */
const Word16 coder_type, /* i : coder type */
@@ -5000,7 +5193,6 @@ void highband_exc_dct_in_ivas_fx(
const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
);
-// lsf_dec_bfi_fx.c
void lsf_dec_bfi(
const Word16 codec_mode, /* i: : codec mode: MODE1 | MODE2 */
Word16 *lsf, /*!< o : 14Q1*1.28 quantized ISFs */
@@ -5024,18 +5216,22 @@ void lsf_dec_bfi(
const short bwidth /* i: coded bandwidth */
);
-Word16 const *PlcGetLsfBase( Word16 const lpcQuantization,
- Word16 const narrowBand,
- Word32 const sr_core );
+Word16 const *PlcGetLsfBase(
+ Word16 const lpcQuantization,
+ Word16 const narrowBand,
+ Word32 const sr_core );
-// fd_cng_com.c
/* Create an instance of type FD_CNG */
-ivas_error createFdCngCom_fx( HANDLE_FD_CNG_COM *hFdCngCom );
+ivas_error createFdCngCom_fx(
+ HANDLE_FD_CNG_COM *hFdCngCom );
-void initFdCngCom( HANDLE_FD_CNG_COM hFdCngCom, Word16 scale );
+void initFdCngCom(
+ HANDLE_FD_CNG_COM hFdCngCom,
+ Word16 scale );
/* Delete the instance of type FD_CNG */
-void deleteFdCngCom_fx( HANDLE_FD_CNG_COM *hFdCngCom );
+void deleteFdCngCom_fx(
+ HANDLE_FD_CNG_COM *hFdCngCom );
/* Initialize the spectral partitioning */
void initPartitions(
@@ -5078,27 +5274,28 @@ void expand_range_var_exp(
Word16 *out_exp,
const Word16 len );
-void minimum_statistics( Word16 len, /* i : Total number of partitions (CLDFB or FFT) */
- Word16 lenFFT, /* i : Number of FFT partitions */
- Word16 *psize, /* i : Partition sizes, fractional */
- Word16 *msPeriodog, /* i : Periodogram (energies) */
- Word16 *msNoiseFloor, /* i/o: Noise floors (energies) */
- Word16 *msNoiseEst, /* i/o: Noise estimates (energies) */
- Word32 *msAlpha, /* i/o: Forgetting factors */
- Word16 *msPsd, /* i/o: Power Spectral Density (smoothed periodogram => energies) */
- Word16 *msPsdFirstMoment, /* i/o: PSD statistics of 1st order (energy means) */
- Word32 *msPsdSecondMoment, /* i/o: PSD statistics of 2nd order (energy variances) */
- Word32 *msMinBuf, /* i/o: Buffer of minima (energies) */
- Word32 *msBminWin, /* o : Bias correction factors */
- Word32 *msBminSubWin, /* o : Bias correction factors */
- Word32 *msCurrentMin, /* i/o: Local minima (energies) */
- Word32 *msCurrentMinOut, /* i/o: Local minima (energies) */
- Word32 *msCurrentMinSubWindow, /* i/o: Local minima (energies) */
- Word16 *msLocalMinFlag, /* i : Binary flag */
- Word16 *msNewMinFlag, /* i : Binary flag */
- Word16 *msPeriodogBuf, /* i/o: Buffer of periodograms (energies) */
- Word16 *msPeriodogBufPtr, /* i/o: Counter */
- HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing buffers and variables */
+void minimum_statistics(
+ Word16 len, /* i : Total number of partitions (CLDFB or FFT) */
+ Word16 lenFFT, /* i : Number of FFT partitions */
+ Word16 *psize, /* i : Partition sizes, fractional */
+ Word16 *msPeriodog, /* i : Periodogram (energies) */
+ Word16 *msNoiseFloor, /* i/o: Noise floors (energies) */
+ Word16 *msNoiseEst, /* i/o: Noise estimates (energies) */
+ Word32 *msAlpha, /* i/o: Forgetting factors */
+ Word16 *msPsd, /* i/o: Power Spectral Density (smoothed periodogram => energies) */
+ Word16 *msPsdFirstMoment, /* i/o: PSD statistics of 1st order (energy means) */
+ Word32 *msPsdSecondMoment, /* i/o: PSD statistics of 2nd order (energy variances) */
+ Word32 *msMinBuf, /* i/o: Buffer of minima (energies) */
+ Word32 *msBminWin, /* o : Bias correction factors */
+ Word32 *msBminSubWin, /* o : Bias correction factors */
+ Word32 *msCurrentMin, /* i/o: Local minima (energies) */
+ Word32 *msCurrentMinOut, /* i/o: Local minima (energies) */
+ Word32 *msCurrentMinSubWindow, /* i/o: Local minima (energies) */
+ Word16 *msLocalMinFlag, /* i : Binary flag */
+ Word16 *msNewMinFlag, /* i : Binary flag */
+ Word16 *msPeriodogBuf, /* i/o: Buffer of periodograms (energies) */
+ Word16 *msPeriodogBufPtr, /* i/o: Counter */
+ HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing buffers and variables */
);
void minimum_statistics_fx(
@@ -5246,9 +5443,12 @@ void ivas_updt_dec_common_fx(
);
/* Random generator with Gaussian distribution with mean 0 and std 1 */
-Word32 rand_gauss( Word16 *seed );
+Word32 rand_gauss(
+ Word16 *seed );
-Word16 rand_gauss_fix( Word16 *x, Word16 *seed );
+Word16 rand_gauss_fix(
+ Word16 *x,
+ Word16 *seed );
void lpc_from_spectrum(
HANDLE_FD_CNG_COM hFdCngCom,
@@ -5281,7 +5481,6 @@ void FdCng_exc(
Word16 *bwe_exc /* o: LP excitation for BWE */
);
-// trans_direct
void direct_transform_fx(
const Word32 in32_fx[],
Word32 out32_fx[],
@@ -5290,7 +5489,6 @@ void direct_transform_fx(
Word16 *Q,
const Word16 element_mode );
-// trans_inv_fx.c
void preecho_sb_fx(
const Word32 brate, /* i Q0 : core bit-rate */
Word32 *wtda_audio_fx, /* i q_sig32 : imdct signal */
@@ -5319,7 +5517,6 @@ void Inverse_Transform(
const Word16 element_mode /* i : IVAS element mode */
);
-// recovernorm
void recovernorm_fx(
const Word16 *idxbuf, /* i : reordered quantization indices Q0*/
Word16 *ynrm, /* o : recovered quantization indices Q0*/
@@ -5327,7 +5524,6 @@ void recovernorm_fx(
const Word16 nb_sfm /* i : number of SFMs Q0*/
);
-// tcq_poition_qeith.c
Word32 ar_div( Word32 num, Word32 denum );
void ar_encoder_start_fx( PARCODEC arInst, TCQ_PBITSTREAM bsInst, const Word32 max_bits );
@@ -5384,11 +5580,17 @@ void decode_magnitude_usq_fx( ARCODEC *pardec, Word16 size, Word16 npulses, Word
void decode_mangitude_tcq_fx( ARCODEC *pardec, Word16 size, Word16 npulses, Word16 nzpos, Word16 *positions, Word16 *out, Word32 *surplus_fx );
void decode_signs_fx( ARCODEC *pardec, Word16 size, Word16 *out );
-Word16 GetScale_fx( Word16 blen, Word32 bits_fx, Word32 *surplus_fx );
+Word16 GetScale_fx(
+ Word16 blen,
+ Word32 bits_fx,
+ Word32 *surplus_fx );
-void srt_vec_ind_fx( const Word32 *linear, Word32 *srt, Word16 *I, Word16 length );
+void srt_vec_ind_fx(
+ const Word32 *linear,
+ Word32 *srt,
+ Word16 *I,
+ Word16 length );
-// fill_spectrum
void fill_spectrum_fx(
Word16 *coeff, /* i/o: normalized MLT spectrum / nf spectrum Q12 */
Word32 *L_coeff_out, /* i/o: Noisefilled MLT spectrum Q12 */
@@ -5428,7 +5630,6 @@ void fill_spectrum_fx(
const Word16 num_env_bands,
const Word16 element_mode );
-// hq_bit_allocation_fx.c"
void hq_bit_allocation_fx(
const Word32 core_brate, /* i : Core bit-rate Q0 */
const Word16 length, /* i : Frame length Q0 */
@@ -5445,14 +5646,12 @@ void hq_bit_allocation_fx(
const Word16 num_env_bands /* i : Number sub bands to be encoded for HQ_SWB_BWE Q0 */
);
-// weight_fx.c
void map_quant_weight_fx(
const Word16 normqlg2[], /* i : quantized norms Q0*/
Word16 wnorm[], /* o : weighted norm Q0*/
const Word16 is_transient /* i : transient flag Q0*/
);
-// bitalloc_fx.c
void bitalloc_fx(
Word16 *y, /* i : reordered norm of sub-vectors Q0 */
Word16 *idx, /* i : reordered sub-vector indices Q0 */
@@ -5463,6 +5662,7 @@ void bitalloc_fx(
const Word16 *sfmsize, /* i : band length Q0 */
const Word16 hqswb_clas /* i : signal classification flag Q0 */
);
+
Word16 BitAllocF_fx(
Word16 *y, /* i : norm of sub-vectors :Q0 */
Word32 bit_rate, /* i : bitrate :Q0 */
@@ -5473,14 +5673,15 @@ Word16 BitAllocF_fx(
const Word16 hqswb_clas, /* i : hq swb class */
const Word16 num_env_bands /* i : Number sub bands to be encoded for HQ_SWB_BWE */
);
-Word16 BitAllocWB_fx( /* o : t Q0*/
- Word16 *y, /* i : norm of sub-vectors Q0*/
- Word16 B, /* i : number of available bits Q0*/
- Word16 N, /* i : number of sub-vectors Q0*/
- Word16 *R, /* o : bit-allocation indicator Q0*/
- Word16 *Rsubband_fx /* o : sub-band bit-allocation vector Q3*/
+
+Word16 BitAllocWB_fx(
+ Word16 *y, /* i : norm of sub-vectors Q0*/
+ Word16 B, /* i : number of available bits Q0*/
+ Word16 N, /* i : number of sub-vectors Q0*/
+ Word16 *R, /* o : bit-allocation indicator Q0*/
+ Word16 *Rsubband_fx /* o : sub-band bit-allocation vector Q3*/
);
-// bitallocsum_fx.c
+
void bitallocsum_fx(
Word16 *R, /* i : bit-allocation vector Q0 */
const Word16 nb_sfm, /* i : number of sub-vectors Q0 */
@@ -5491,8 +5692,6 @@ void bitallocsum_fx(
const Word16 *sfmsize /* i : band length Q0 */
);
-
-// stab_est_fx.c
Word16 stab_est_fx(
Word16 etot, /* i : Total energy of the current frame Q8*/
Word16 *lt_diff_etot, /* i/o : Long term total energy variation Q8*/
@@ -5504,7 +5703,6 @@ Word16 stab_est_fx(
const Word16 vad_flag /* i : VAD flag */
);
-// enhancer_fx.c
void enhancer_fx(
const Word32 core_brate, /* i : decoder bitrate */
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
@@ -5561,8 +5759,6 @@ Word16 E_UTIL_enhancer(
Word16 L_frame, /* i : frame size */
Word16 Q_new );
-
-// phase_dispersion_fx.c
void phase_dispersion(
const Word32 gain_code, /* i : gain of code 15Q16 */
const Word16 gain_pit, /* i : gain of pitch Q14 */
@@ -5575,7 +5771,6 @@ void phase_dispersion(
Word16 L_subfr /* i : subframe length [40,64] */
);
-// tcx_ltp_fx.c
void tcx_ltp_get_lpc(
Word16 *x, /* Qx */
const Word16 L, /* Q0 */
@@ -5646,10 +5841,10 @@ void Inac_switch_ematch_fx(
const Word16 element_mode /* i : element mode */
);
-// igf_base_fx.c
-Word16 IGF_ApplyTransFac( /**< out: Q0 | multiplication factor */
- const Word16 val, /**< in: Q15 | input value for multiplication, Q15 */
- const Word16 transFac /**< in: Q14 | multiplicator for variable val, Q14: 1.25f=0x5000, 1.0f=0x4000, 0.5f=0x2000 */
+/**< out: Q0 | multiplication factor */
+Word16 IGF_ApplyTransFac(
+ const Word16 val, /**< in: Q15 | input value for multiplication, Q15 */
+ const Word16 transFac /**< in: Q14 | multiplicator for variable val, Q14: 1.25f=0x5000, 1.0f=0x4000, 0.5f=0x2000 */
);
Word16 IGF_MapBitRateToIndex(
@@ -5659,22 +5854,24 @@ Word16 IGF_MapBitRateToIndex(
const Word16 rf_mode /* i : flag to signal the RF mode */
);
-void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in: Q0 | start sfb index */
- const Word16 stopSfb, /**< in: Q0 | stop sfb index */
- const Word16 *swb_offset, /**< in: Q0 | IGF swb offset table */
- Word32 *pPowerSpectrum, /**< in: Q31 | power spectrum */
- Word16 *pPowerSpectrum_exp, /**< in: | Exponent of PowerSpectrum */
- Word32 *sfbEnergy, /**< out:Q31 | SFB energies , will be initialized inside this function */
- Word16 *sfbEnergy_exp /**< out: | Exponent of PowerSpectrum */
+void IGFCommonFuncsCalcSfbEnergyPowerSpec(
+ const Word16 startSfb, /**< in: Q0 | start sfb index */
+ const Word16 stopSfb, /**< in: Q0 | stop sfb index */
+ const Word16 *swb_offset, /**< in: Q0 | IGF swb offset table */
+ Word32 *pPowerSpectrum, /**< in: Q31 | power spectrum */
+ Word16 *pPowerSpectrum_exp, /**< in: | Exponent of PowerSpectrum */
+ Word32 *sfbEnergy, /**< out:Q31 | SFB energies , will be initialized inside this function */
+ Word16 *sfbEnergy_exp /**< out: | Exponent of PowerSpectrum */
);
-void IGFCommonFuncsMDCTSquareSpec( const Word16 sqrtBgn, /**< in: Q0 | start MDCT subband index */
- const Word16 sqrtEnd, /**< in: Q0 | stop MDCT subband index */
- const Word32 *mdctSpec, /**< in: | MDCT spectrum to square */
- const Word16 mdctSpec_e, /**< in: | exponent of mdctSpectrum */
- Word32 *mdctSquareSpec, /**< out: | MDCT square spectrum */
- Word16 *mdctSquareSpec_e, /**< out: | exponent of mdctSquareSpec */
- Word16 indexOffset /**< in: Q0 | index offset */
+void IGFCommonFuncsMDCTSquareSpec(
+ const Word16 sqrtBgn, /**< in: Q0 | start MDCT subband index */
+ const Word16 sqrtEnd, /**< in: Q0 | stop MDCT subband index */
+ const Word32 *mdctSpec, /**< in: | MDCT spectrum to square */
+ const Word16 mdctSpec_e, /**< in: | exponent of mdctSpectrum */
+ Word32 *mdctSquareSpec, /**< out: | MDCT square spectrum */
+ Word16 *mdctSquareSpec_e, /**< out: | exponent of mdctSquareSpec */
+ Word16 indexOffset /**< in: Q0 | index offset */
);
void IGFCommonFuncsMDCTSquareSpec_ivas(
@@ -5687,12 +5884,6 @@ void IGFCommonFuncsMDCTSquareSpec_ivas(
Word16 indexOffset /**< in: Q0 | index offset */
);
-void IGFCommonFuncsWriteSerialBit(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /**< out: Q0 | bit offset */
- Word16 bit /**< in: Q0 | value of bit */
-);
-
Word16 IGFCommonFuncsIGFConfiguration(
const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
const Word16 bwidth, /* i : audio bandwidth */
@@ -5724,22 +5915,31 @@ Word16 IGFCommonFuncsIGFGetCFTables_fx(
const UWord16 **cf_se11, /* o : CF tables for t == 1 and f >= 1 */
const Word16 **cf_off_se11 /* o : offsets for CF tables above */
);
-// ari_fx.c
-Word32 L_multi31x16_X2( Word16 xh, Word16 xl, Word16 y );
+
+Word32 L_multi31x16_X2(
+ Word16 xh,
+ Word16 xl,
+ Word16 y );
+
Word32 mul_sbc_14bits(
Word32 r, /* Q0 */
Word16 c /* Q0 */
);
-// window.c
-void ham_cos_window( Word16 *fh, const Word16 n1, const Word16 n2 );
+void ham_cos_window(
+ Word16 *fh,
+ const Word16 n1,
+ const Word16 n2 );
-void ham_cos_window_ivas( Word16 *fh, const Word16 n1, const Word16 n2 );
+void ham_cos_window_ivas(
+ Word16 *fh,
+ const Word16 n1,
+ const Word16 n2 );
-// arith_coder_fx.c
-Word32 expfp( /* o: Q31 */
- const Word16 x, /* i: mantissa Q-e */
- const Word16 x_e ); /* i: exponent Q0 */
+/* o: Q31 */
+Word32 expfp(
+ const Word16 x, /* i: mantissa Q-e */
+ const Word16 x_e ); /* i: exponent Q0 */
void powfp_odd2(
const Word16 base, /* Q15 */
@@ -5768,21 +5968,23 @@ void tcx_arith_render_envelope(
);
-// gain_inov_fx.c
-Word32 calc_gain_inov( /* returns innovation gain Q16 */
- const Word16 *code, /* i : algebraic excitation Q9 */
- const Word16 lcode, /* i : Subframe size Q0 */
- Word32 *dotp, /* o : intermediate result Q31-e */
- Word16 *dotp_e /* o : intermediate result exponent Q0 */
+/* returns innovation gain Q16 */
+Word32 calc_gain_inov(
+ const Word16 *code, /* i : algebraic excitation Q9 */
+ const Word16 lcode, /* i : Subframe size Q0 */
+ Word32 *dotp, /* o : intermediate result Q31-e */
+ Word16 *dotp_e /* o : intermediate result exponent Q0 */
);
+
///////////////////////////////////
/* Lib_dec */
//////////////////////////////////
-// swb_tbe_dec.c
+
void ResetSHBbuffer_Dec_fx(
TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */
const Word16 extl /* i : BWE extension layer */
);
+
void wb_tbe_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 coder_type, /* i : coding type */
@@ -5908,6 +6110,7 @@ void v_multc_fixed(
Word32 y[], /* o : Output vector that contains c*x */
const Word16 N /* i : Vector length */
);
+
void v_multc_fixed_16(
const Word32 x[], /* i : Input vector */
const Word16 c, /* i : Constant */
@@ -6032,8 +6235,7 @@ void lsf_end_dec_fx(
Word16 *qlsf, /* o : quantized LSFs in the cosine domain Qx2.56*/
Word16 *lpc_param, /* i : LPC parameters Q0*/
Word16 *LSF_Q_prediction, /* o : LSF prediction mode Q0*/
- Word16 *nb_indices /* o : number of indices Q0*/
- ,
+ Word16 *nb_indices, /* o : number of indices Q0*/
const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/
);
@@ -6074,7 +6276,6 @@ void td_cng_dec_init_fx(
DEC_CORE_HANDLE st /* i/o: decoder state structure */
);
-// wavadjust_fec_dec_fx.c
void set_state(
Word16 *state,
Word16 num,
@@ -6272,7 +6473,6 @@ ivas_error PsychoacousticParameters_Init(
const Word16 isWarped, /* i : Flag indicating if the scale is linear or warped */
PsychoacousticParameters *pPsychParams );
-// TonalIMDCTconcealment_fx.c
ivas_error TonalMDCTConceal_Init(
TonalMDCTConcealPtr self,
const Word16 nSamples,
@@ -6280,6 +6480,7 @@ ivas_error TonalMDCTConceal_Init(
const Word16 nScaleFactors,
TCX_CONFIG_HANDLE hTcxCfg /* TCX config */
);
+
ivas_error TonalMDCTConceal_Init_ivas_fx(
TonalMDCTConcealPtr hTonalMDCTConc,
const UWord16 nSamples,
@@ -6371,7 +6572,6 @@ void TonalMDCTConceal_SaveTimeSignal_ivas_fx(
Word16 q_timeSignal,
Word16 nNewSamples );
-// decision_matrix_dec_fx.c
void decision_matrix_dec_fx(
Decoder_State *st, /* i/o: decoder state structure */
Word16 *sharpFlag, /* o : formant sharpening flag Q0 */
@@ -6379,10 +6579,10 @@ void decision_matrix_dec_fx(
Word16 *core_switching_flag /* o : ACELP->HQ switching frame flag Q0 */
);
-// hf_synth_fx.c
void hf_synth_init_fx(
ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */
);
+
void hf_synth_reset_fx(
ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */
);
@@ -6440,12 +6640,10 @@ void hf_synth_amr_wb_fx(
const Word16 Q_out /* i : Q_syn2-1 */
);
-// dec_post_fx
void Init_post_filter_fx(
PFSTAT_HANDLE hPFstat /* i : core decoder parameters */
); /* i : core decoder parameters */
-
void nb_post_filt_fx(
const Word16 L_frame, /* i : frame length */
PFSTAT_HANDLE hPFstat, /* i : core decoder parameters */
@@ -6469,6 +6667,7 @@ void formant_post_filt_fx(
const Word32 brate, /* (i) : bit-rate */
const Word16 off_flag /* i : off flag */
);
+
void Filt_mu_fx(
Word16 *sig_in, /* i : signal (beginning at sample -1) */
Word16 *sig_out, /* o : signal with tilt */
@@ -6482,6 +6681,7 @@ void Filt_mu_ivas_fx(
Word16 parcor0, /* i : parcor0 (mu = parcor0 * gamma3) */
Word16 L_subfr, /* i : the length of subframe */
const Word16 extl );
+
void scale_st_fx(
const Word16 *sig_in, /* i : postfilter i signal */
Word16 *sig_out, /* i/o: postfilter o signal */
@@ -6493,6 +6693,7 @@ void blend_subfr2_fx(
Word16 *sigIn2, /* i : i signal for fade-in */
Word16 *sigOut /* o : output signal */
);
+
void init_tcx_window_cfg_fx(
TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX Config handle */
const Word32 sr_core, /* i : SR core */
@@ -6523,8 +6724,6 @@ void init_tcx_cfg_fx(
const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */,
const Word16 fscaleFB );
-// syn_outp_fx.c
-
void syn_output_fx(
const Word16 codec_mode, /* i : MODE1 or MODE2 */
Word16 *synth, /* i/o: fixed point synthesis signal Q_syn2 */
@@ -6541,7 +6740,6 @@ void unscale_AGC(
const Word16 n /* i: vector size */
);
-// bass_psfilter_fx.c
void bass_psfilter_init_fx(
BPF_DEC_HANDLE hBPF /* o : BPF data handle */
);
@@ -6559,6 +6757,7 @@ void bass_psfilter_fx(
Word16 Q_syn,
Word16 bpf_noise_buf[] /* o : BPF error signal (at int_fs) Qx*/
);
+
void addBassPostFilter_fx(
const Word16 *harm_timeIn_Fx, /* timeIn_e */
Word32 **rAnalysis_Fx, /* Qx - 5 */
@@ -6571,7 +6770,6 @@ void addBassPostFilter_fx(
const Word16 nBandsTotal, /* Q0 */
CLDFB_SCALE_FACTOR *cldfb_scale );
-// FEC_fx.c
void FEC_exc_estim_fx(
Decoder_State *st_fx, /* i/o: Decoder static memory */
const Word16 L_frame, /* i : length of the frame */
@@ -6587,50 +6785,35 @@ void FEC_exc_estim_fx(
Word16 *tmp_noise /* o : long-term noise energy Q0 */
);
-// pitch_extr_fx.c
void pitch_pred_linear_fit(
- const Word16 /*short*/ bfi_cnt,
- /* i: bfi counter */ /*Q0 */
- const Word16 /*short*/ last_good,
- /* i: last classification type */ /*Q0 */
- Word32 /*float*/ *old_pitch_buf,
- /* i: pitch lag buffer */ /*Q16*/
- Word32 /*float*/ *old_fpitch,
- /* i: */ /*Q16*/
- Word32 /*float*/ *T0_out,
- /* o: estimated close loop pitch */ /*Q16*/
- Word16 /* int*/ pit_min,
- /* i: Minimum pitch lag */ /*Q0 */
- Word16 /* int*/ pit_max,
- /* i: Maximum pitch lag */ /*Q0 */
- Word16 /*float*/ *mem_pitch_gain,
- /* i: pitch gain [0] is the most recent subfr gain */ /*Q0*/
- Word16 /* int*/ limitation,
- Word16 /*short*/ plc_use_future_lag,
- /* i: */ /*Q0 */
- Word16 /*short*/ *extrapolationFailed,
- /* o: flag if extrap decides not to change the pitch */ /*Q0 */
- Word16 nb_subfr /* i: number of ACELP subframes */
+ const Word16 bfi_cnt, /* i: bfi counter Q0 */
+ const Word16 last_good, /* i: last classification type Q0 */
+ Word32 *old_pitch_buf, /* i: pitch lag buffer Q16*/
+ Word32 *old_fpitch, /* i: Q16*/
+ Word32 *T0_out, /* o: estimated close loop pitch Q16*/
+ Word16 pit_min, /* i: Minimum pitch lag Q0 */
+ Word16 pit_max, /* i: Maximum pitch lag Q0 */
+ Word16 *mem_pitch_gain, /* i: pitch gain [0] is the most recent subfr gain Q0*/
+ Word16 limitation,
+ Word16 plc_use_future_lag, /* i: Q0 */
+ Word16 *extrapolationFailed, /* o: flag if extrap decides not to change the pitch Q0 */
+ Word16 nb_subfr /* i: number of ACELP subframes */
);
void get_subframe_pitch(
- Word16 nSubframes,
- /* i: number of subframes */ /* Q0 */
- Word32 pitchStart,
- /* i: starting pitch lag (in subframe -1) */ /*15Q16*/
- Word32 pitchEnd,
- /* i: ending pitch lag (in subframe nSubframes-1) */ /*15Q16*/
- Word32 *pitchBuf /* o: interpolated pitch lag per subframe */ /*15Q16*/
+ Word16 nSubframes, /* i: number of subframes Q0 */
+ Word32 pitchStart, /* i: starting pitch lag (in subframe -1) 15Q16*/
+ Word32 pitchEnd, /* i: ending pitch lag (in subframe nSubframes-1) 15Q16*/
+ Word32 *pitchBuf /* o: interpolated pitch lag per subframe 15Q16*/
);
-// er_sync_exc_fx.c
void PulseResynchronization_fx(
- Word16 /*float*/ const *const src_exc, /*i Q15*/
- Word16 /*float*/ *const dst_exc, /*o Q15*/
- Word16 /*int*/ const nFrameLength, /*i Q0 */
- Word16 /*int*/ const nSubframes, /*i Q0 */
- Word32 /*float*/ const pitchStart, /*i Q16*/
- Word32 /*float*/ const pitchEnd /*i Q16*/
+ Word16 const *const src_exc, /*i Q15*/
+ Word16 *const dst_exc, /*o Q15*/
+ Word16 const nFrameLength, /*i Q0 */
+ Word16 const nSubframes, /*i Q0 */
+ Word32 const pitchStart, /*i Q16*/
+ Word32 const pitchEnd /*i Q16*/
);
void decod_audio_fx(
@@ -6778,7 +6961,6 @@ void gain_dec_amr_wb_fx(
Word32 *norm_gain_code /* o : norm. gain of the codebook excitation */
);
-// dec_higher_acelp_fx.c
void transf_cdbk_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 harm_flag_acelp, /* i : harmonic flag for higher rates ACELP */
@@ -6790,14 +6972,14 @@ void transf_cdbk_dec_fx(
Word16 code_preQ[], /* o : prequantizer excitation (Q8) */
Word16 *unbits /* o : number of AVQ unused bits */
);
-Word16 gain_dequant_fx( /* o: decoded gain */
- Word16 index, /* i: quantization index */
- const Word16 min, /* i: value of lower limit */
- const Word16 max, /* i: value of upper limit */
- const Word16 bits, /* i: number of bits to dequantize */
- Word16 *expg );
-// avq_dec_fx.c
+/* o: decoded gain */
+Word16 gain_dequant_fx(
+ Word16 index, /* i: quantization index */
+ const Word16 min, /* i: value of lower limit */
+ const Word16 max, /* i: value of upper limit */
+ const Word16 bits, /* i: number of bits to dequantize */
+ Word16 *expg );
void AVQ_demuxdec_fx(
Decoder_State *st, /* i/o: decoder state structure */
@@ -6814,8 +6996,6 @@ void AVQ_dec_lpc(
Word16 *nvecq, /* output: vector quantized Q0*/
Word16 Nsv ); /* input: number of subvectors (lg=Nsv*8) Q0*/
-
-// re8_dec_fx.c
void re8_dec_fx(
Word16 n, /* i : codebook number (*n is an integer defined in {0,2,3,4,..,n_max}) */
const UWord16 I, /* i : index of c (pointer to unsigned 16-bit word) */
@@ -6823,10 +7003,11 @@ void re8_dec_fx(
Word16 y[] /* o : point in RE8 (8-dimensional integer vector) */
);
-// lead_deindexing_fx.c
-void re8_decode_base_index_fx( const Word16 n, UWord16 I, Word16 *x );
+void re8_decode_base_index_fx(
+ const Word16 n,
+ UWord16 I,
+ Word16 *x );
-// re8_utils_fx.c
void re8_k2y_fx(
const Word16 *k, /* i : Voronoi index k[0..7] Q0*/
const Word16 m, /* i : Voronoi modulo (m = 2^r = 1<=2) Q0*/
@@ -6841,7 +7022,6 @@ void re8_vor_fx(
Word16 *ka /* o : identifier of absolute leader (to index c) Q0*/
);
-// re8_PPV_fx.c
void re8_PPV_fx(
const Word32 x[], /* i : point in R^8 Q15 */
Word16 y[] /* o : point in RE8 (8-dimensional integer vector) Q0 */
@@ -6862,25 +7042,25 @@ void dec_pit_exc_fx(
const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
);
-// pit_dec_fx.c
-Word32 Mode2_pit_decode( /* o: pitch value Q16 */
- const Word16 coder_type, /* i: coding model */
- Word16 i_subfr, /* i: subframe index */
- Word16 L_subfr,
- Word16 **pt_indice, /* i/o: quantization indices pointer */
- Word16 *T0, /* i/o: close loop integer pitch Q0 */
- Word16 *T0_frac, /* o: close loop fractional part of the pitch Q0 */
- Word16 *T0_res, /* i/o: pitch resolution Q0 */
- Word16 *T0_min, /* i/o: lower limit for close-loop search Q0 */
- Word16 *T0_min_frac, /* i/o: lower limit for close-loop search Q0 */
- Word16 *T0_max, /* i/o: higher limit for close-loop search Q0 */
- Word16 *T0_max_frac, /* i/o: higher limit for close-loop search Q0 */
- Word16 pit_min,
- Word16 pit_fr1,
- Word16 pit_fr1b,
- Word16 pit_fr2,
- Word16 pit_max,
- Word16 pit_res_max );
+/* o: pitch value Q16 */
+Word32 Mode2_pit_decode(
+ const Word16 coder_type, /* i: coding model */
+ Word16 i_subfr, /* i: subframe index */
+ Word16 L_subfr,
+ Word16 **pt_indice, /* i/o: quantization indices pointer */
+ Word16 *T0, /* i/o: close loop integer pitch Q0 */
+ Word16 *T0_frac, /* o: close loop fractional part of the pitch Q0 */
+ Word16 *T0_res, /* i/o: pitch resolution Q0 */
+ Word16 *T0_min, /* i/o: lower limit for close-loop search Q0 */
+ Word16 *T0_min_frac, /* i/o: lower limit for close-loop search Q0 */
+ Word16 *T0_max, /* i/o: higher limit for close-loop search Q0 */
+ Word16 *T0_max_frac, /* i/o: higher limit for close-loop search Q0 */
+ Word16 pit_min,
+ Word16 pit_fr1,
+ Word16 pit_fr1b,
+ Word16 pit_fr2,
+ Word16 pit_max,
+ Word16 pit_res_max );
void Mode2_abs_pit_dec(
Word16 *T0, /* o: integer pitch lag Q0 */
@@ -6929,9 +7109,8 @@ void pit_Q_dec_fx(
Word16 *T0, /* o : integer pitch lag */
Word16 *T0_frac, /* o : pitch fraction */
Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* i/o: delta search max */
- ,
- Word16 *BER_detect /* o : BER detect flag */
+ Word16 *T0_max, /* i/o: delta search max */
+ Word16 *BER_detect /* o : BER detect flag */
);
void pit16k_Q_dec_fx(
@@ -6941,9 +7120,8 @@ void pit16k_Q_dec_fx(
Word16 *T0, /* o : integer pitch lag */
Word16 *T0_frac, /* o : pitch fraction */
Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* i/o: delta search max */
- ,
- Word16 *BER_detect /* o : BER detect flag */
+ Word16 *T0_max, /* i/o: delta search max */
+ Word16 *BER_detect /* o : BER detect flag */
);
void abs_pit_dec_fx(
@@ -6962,7 +7140,6 @@ void delta_pit_dec_fx(
const Word16 T0_min /* i : delta search min */
);
-// limit_t0_fx.c
void limit_T0_fx(
const Word16 L_frame, /* i : length of the frame */
const Word16 delta, /* i : Half the close-loop searched interval */
@@ -6988,7 +7165,6 @@ void limit_T0_voiced(
const Word16 pit_max /* i : Maximum pitch lag */
);
-// inov_dec.c
void inov_decode_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word32 core_brate, /* i : core bitrate Q0 */
@@ -7016,15 +7192,18 @@ void inov_decode_ivas_fx(
Word16 *code, /* o : algebraic excitation Q12 */
const Word16 L_subfr /* i : subframe length Q0 */
);
-// dec4t64_fx.c
+
void dec_acelp_4t64_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 nbbits, /* i : number of bits per codebook */
Word16 code[], /* o : algebraic (fixed) codebook excitation Q9*/
const Word16 Opt_AMR_WB );
-void D_ACELP_decode_43bit_fx( UWord16 idxs[], Word16 code[], Word16 *pulsestrack );
-// dec_acelp_fx.c
+void D_ACELP_decode_43bit_fx(
+ UWord16 idxs[],
+ Word16 code[],
+ Word16 *pulsestrack );
+
void D_ACELP_indexing_fx(
Word16 code[],
PulseConfig config,
@@ -7032,9 +7211,13 @@ void D_ACELP_indexing_fx(
Word16 index[],
Word16 *BER_detect );
-void fcb_pulse_track_joint_decode_fx( UWord16 *idxs, Word16 wordcnt, UWord32 *index_n, Word16 *pulse_num, Word16 track_num );
+void fcb_pulse_track_joint_decode_fx(
+ UWord16 *idxs,
+ Word16 wordcnt,
+ UWord32 *index_n,
+ Word16 *pulse_num,
+ Word16 track_num );
-// dec2t32_fx.c
void dec_acelp_2t32_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 code[] /* o: algebraic (fixed) codebook excitation */
@@ -7042,12 +7225,10 @@ void dec_acelp_2t32_fx(
void dec_acelp_1t64_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
- Word16 code[] /* o: algebraic (fixed) codebook excitation Q12*/
- ,
- const Word16 L_subfr /* i : sub frame lenght*/
+ Word16 code[], /* o: algebraic (fixed) codebook excitation Q12*/
+ const Word16 L_subfr /* i : sub frame lenght*/
);
-// acelp_core_switch)dec_fx.c
ivas_error acelp_core_switch_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 *synth_subfr_out, /* o : synthesized ACELP subframe Q_syn*/
@@ -7069,7 +7250,6 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx(
const Word16 coder_type /* i : coder type */
);
-// pred_lt4_fx.c
void pred_lt4(
const Word16 excI[], /* in : excitation buffer Q_exc*/
Word16 excO[], /* out: excitation buffer Q_exc*/
@@ -7101,7 +7281,6 @@ void pred_lt4_tc_fx(
const Word16 i_subfr /* i : subframe index Q0*/
);
-// pvq_cored_dec
void pvq_decode_frame_fx(
Decoder_State *st_fx,
Word16 *coefs_quant, /* o : quantized coefficients */
@@ -7131,7 +7310,6 @@ Word16 pvq_core_dec_fx(
Word16 *maxpulse,
const Word16 core );
-
Word16 ivas_pvq_core_dec_fx(
Decoder_State *st_fx,
const Word16 *sfm_start,
@@ -7159,18 +7337,19 @@ void decode_energies_fx(
Word16 dim,
const Word16 strict_bits );
-// range_drc_fx.c
void rc_dec_init_fx(
Decoder_State *st_fx, /* i/o: Decoder State */
PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
Word16 tot_bits /* i : Total bit budget */
);
-UWord32 rc_decode_fx( /* o : Decoded cumulative frequency */
- Word16 *BER_detect, /* o : Bit error detection flag */
- PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
- UWord32 tot /* i : Total cumulative frequency */
+/* o : Decoded cumulative frequency */
+UWord32 rc_decode_fx(
+ Word16 *BER_detect, /* o : Bit error detection flag */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
+ UWord32 tot /* i : Total cumulative frequency */
);
+
void rc_dec_update_fx(
Decoder_State *st_fx, /* i/o: Decoder State */
PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
@@ -7179,17 +7358,18 @@ void rc_dec_update_fx(
UWord32 sym_freq /* i : Symbol frequency */
);
-Word32 rc_dec_bits_fx( /* i : Decoded value */
- Decoder_State *st_fx, /* i/o: Decoder State */
- PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
- Word16 bits /* i : Number of bits */
+/* i : Decoded value */
+Word32 rc_dec_bits_fx(
+ Decoder_State *st_fx, /* i/o: Decoder State */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
+ Word16 bits /* i : Number of bits */
);
-UWord32 rc_dec_uniform_fx( /* i : Decoded value */
- Decoder_State *st_fx, /* i/o: Decoder State */
- PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
-
- UWord32 tot /* i : Maximum value */
+/* i : Decoded value */
+UWord32 rc_dec_uniform_fx(
+ Decoder_State *st_fx, /* i/o: Decoder State */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
+ UWord32 tot /* i : Maximum value */
);
void rc_dec_finish_fx(
@@ -7197,7 +7377,6 @@ void rc_dec_finish_fx(
PVQ_DEC_HANDLE hPVQ /* i/o: PVQ decoder handle */
);
-// pvq_decode_fx.c
void pvq_decode_fx(
Decoder_State *st_fx,
PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
@@ -7207,8 +7386,6 @@ void pvq_decode_fx(
const Word16 dim, /* i: Length of vector */
const Word16 neg_gain /* i: Gain (negated to fit 1.0 in Q15 as -1.0) */
);
-
-// nelp_dec_fx.c
void nelp_decoder_fx(
Decoder_State *st_fx, /* i/o: decoder static memory */
Word16 *exc_nelp, /* o : adapt. excitation/total exc Q0 */
@@ -7218,8 +7395,6 @@ void nelp_decoder_fx(
const Word16 coder_type, /* i : coding type Q0 */
Word16 *gain_buf /* Q14 */
);
-
-// dec_nelp_fx.c
void decod_nelp_fx(
Decoder_State *st_fx, /* i/o: decoder static memory */
Word16 *tmp_noise_fx, /* o : long term temporary noise energy */
@@ -7229,12 +7404,10 @@ void decod_nelp_fx(
Word16 *voice_factors, /* o : Voice factor */
Word16 *bwe_exc,
Word16 *Q_exc,
- Word16 bfi /* i : frame error rate */
- ,
+ Word16 bfi, /* i : frame error rate */
Word16 *gain_buf /*Q14*/
);
-// lp_filt_exc_dec_fx
void lp_filt_exc_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 codec_mode, /* i : coder mode */
@@ -7244,7 +7417,6 @@ void lp_filt_exc_dec_fx(
Word16 lp_flag, /* i : operation mode signalling */
Word16 *exc );
-// FEC_lsf_estim_fx.c
void FEC_lsf2lsp_interp(
Decoder_State *st, /* i/o: Decoder static memory */
const Word16 L_frame, /* i : length of the frame */
@@ -7253,16 +7425,16 @@ void FEC_lsf2lsp_interp(
Word16 *lsp /* o : estimated LSP vector */
);
-
-// fd_cng_dec_fx.c
-ivas_error createFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec );
+ivas_error createFdCngDec_fx(
+ HANDLE_FD_CNG_DEC *hFdCngDec );
void initFdCngDec_fx(
DEC_CORE_HANDLE st, /* i/o: decoder state structure */
Word16 scale );
/* Delete the instance of type FD_CNG */
-void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec );
+void deleteFdCngDec_fx(
+ HANDLE_FD_CNG_DEC *hFdCngDec );
/* Configure CLDFB-CNG */
void configureFdCngDec_fx(
@@ -7307,8 +7479,9 @@ void perform_noise_estimation_dec_ivas_fx(
);
/* Decode the CLDFB-CNG bitstream */
-void FdCng_decodeSID_fx( HANDLE_FD_CNG_COM st, /* i/o: FD_CNG structure containing all buffers and variables */
- Decoder_State *corest ); /* i/o: decoder state structure */
+void FdCng_decodeSID_fx(
+ HANDLE_FD_CNG_COM st, /* i/o: FD_CNG structure containing all buffers and variables */
+ Decoder_State *corest ); /* i/o: decoder state structure */
void noisy_speech_detection_fx(
HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */
@@ -7336,10 +7509,11 @@ void generate_comfort_noise_dec_ivas_fx(
const Word16 nchan_out /* i : number of output channels */
);
-void generate_comfort_noise_dec_hf_fx( Word32 **bufferReal, /* o : matrix to real part of i bands */
- Word32 **bufferImag, /* o : matrix to imaginary part of i bands */
- Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of i bands */
- Decoder_State *stdec );
+void generate_comfort_noise_dec_hf_fx(
+ Word32 **bufferReal, /* o : matrix to real part of i bands */
+ Word32 **bufferImag, /* o : matrix to imaginary part of i bands */
+ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of i bands */
+ Decoder_State *stdec );
void generate_comfort_noise_dec_hf_ivas_fx(
Word32 **bufferReal, /* o : matrix to real part of input bands */
@@ -7350,28 +7524,28 @@ void generate_comfort_noise_dec_hf_ivas_fx(
);
/* Generate the comfort noise based on the target noise level */
-void generate_masking_noise_fx( Word16 *timeDomainBuffer, /* i/o: time-domain signal */
- Word16 Q,
- HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */
- ,
- Word16 length,
- Word16 core );
+void generate_masking_noise_fx(
+ Word16 *timeDomainBuffer, /* i/o: time-domain signal */
+ Word16 Q,
+ HANDLE_FD_CNG_COM st, /* i/o: FD_CNG structure containing all buffers and variables */
+ Word16 length,
+ Word16 core );
void generate_masking_noise_update_seed_fx(
HANDLE_FD_CNG_COM st /* i/o : pointer to FD_CNG_COM structure */
);
-void generate_masking_noise_mdct_fx( Word32 *mdctBuffer, /* i/o: time-domain signal */
- Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */
- HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */
- ,
- Word16 L_frame );
+void generate_masking_noise_mdct_fx(
+ Word32 *mdctBuffer, /* i/o: time-domain signal */
+ Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */
+ HANDLE_FD_CNG_COM st, /* i/o: FD_CNG structure containing all buffers and variables */
+ Word16 L_frame );
-void generate_masking_noise_mdct_ivas_fx( Word32 *mdctBuffer, /* i/o: time-domain signal */
- Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */
- HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */ );
+void generate_masking_noise_mdct_ivas_fx(
+ Word32 *mdctBuffer, /* i/o: time-domain signal */
+ Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */
+ HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */ );
-// init_dec_fx.c
ivas_error init_decoder_fx(
Decoder_State *st_fx, /* o: Decoder static variables structure */
const Word16 idchan /* i : channel ID */
@@ -7410,21 +7584,23 @@ Word16 wb_bwe_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 *Qpost );
-Word16 swb_bwe_gain_deq_fx( /* o : BWE class */
- Decoder_State *st_fx, /* i/o: decoder state structure */
- const Word16 core, /* i : core */
- Word16 *SWB_tenv, /* o : Q0, time-domain BWE envelope */
- Word16 *SWB_fenv, /* o : Q1, frequency-domain BWE envelope */
- const Word16 hr_flag, /* i : high rate flag */
- const Word16 hqswb_clas /* i : HQ BWE class */
-);
-
-Word16 swb_bwe_dec_fx( /*o :Q_syn_hb*/
- Decoder_State *st_fx, /* i/o: decoder state structure */
- Word16 *synth_fx, /* i/o: ACELP core synthesis/final synthesis (might be rescaled inside wtda() ) Q0/Qpost */
- Word16 *hb_synth_fx, /* o : SHB synthesis/final synthesis Q_syn_hb */
- const Word16 output_frame, /* i : frame length */
- Word16 *Qpost );
+/* o : BWE class */
+Word16 swb_bwe_gain_deq_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ const Word16 core, /* i : core */
+ Word16 *SWB_tenv, /* o : Q0, time-domain BWE envelope */
+ Word16 *SWB_fenv, /* o : Q1, frequency-domain BWE envelope */
+ const Word16 hr_flag, /* i : high rate flag */
+ const Word16 hqswb_clas /* i : HQ BWE class */
+);
+
+/*o :Q_syn_hb*/
+Word16 swb_bwe_dec_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ Word16 *synth_fx, /* i/o: ACELP core synthesis/final synthesis (might be rescaled inside wtda() ) Q0/Qpost */
+ Word16 *hb_synth_fx, /* o : SHB synthesis/final synthesis Q_syn_hb */
+ const Word16 output_frame, /* i : frame length */
+ Word16 *Qpost );
void fd_bwe_dec_init(
Decoder_State *st_fx, /* i/o: decoder state structure */
@@ -7440,7 +7616,6 @@ void hq_core_enc_ivas_fx(
const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/
);
-// hq_core_dec_fx.c
void hq_core_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure fx */
Word16 synth[], /* o : output synthesis Q_synth*/
@@ -7456,9 +7631,15 @@ void HQ_nbfec_init_fx(
HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */
);
-void GetAttackForTCXDecision_fx( Word32 const *pSubblockNrg, Word32 const *pAccSubblockNrg, Word16 nSubblocks, Word16 nPastSubblocks, Word16 attackRatioThreshold, Word16 *pbIsAttackPresent, Word16 *pAttackIndex );
+void GetAttackForTCXDecision_fx(
+ Word32 const *pSubblockNrg,
+ Word32 const *pAccSubblockNrg,
+ Word16 nSubblocks,
+ Word16 nPastSubblocks,
+ Word16 attackRatioThreshold,
+ Word16 *pbIsAttackPresent,
+ Word16 *pAttackIndex );
-// FEC_HQ_phase_ecu_fx.c
void hq_ecu_fx(
const Word16 *prevsynth, /* i : buffer of previously synthesized signal */
Word32 *ecu_rec, /* o : reconstructed frame in tda domain */
@@ -7473,17 +7654,15 @@ void hq_ecu_fx(
const Word16 ph_ecu_HqVoicing,
Word16 *ph_ecu_active, /* i : Phase ECU active flag */
Word16 *gapsynth,
- const Word16 prev_bfi, /* i : indicating burst frame error */
- const Word16 old_is_transient[2], /* i : flags indicating previous transient frames */
- Word16 *mag_chg_1st, /* i/o: per band magnitude modifier for transients*/
- Word16 *Xavg, /* i/o: Frequency group average gain to fade to */
- Word16 *beta_mute, /* o : Factor for long-term mute */
- const Word16 output_frame, /* i : frame length */
- Decoder_State *st_fx /* i/o: decoder state structure */
+ const Word16 prev_bfi, /* i : indicating burst frame error */
+ const Word16 old_is_transient[2], /* i : flags indicating previous transient frames */
+ Word16 *mag_chg_1st, /* i/o: per band magnitude modifier for transients */
+ Word16 *Xavg, /* i/o: Frequency group average gain to fade to */
+ Word16 *beta_mute, /* o : Factor for long-term mute */
+ const Word16 output_frame, /* i : frame length */
+ Decoder_State *st_fx /* i/o: decoder state structure */
);
-
-// hq_lr_dec_fx.c
void hq_lr_dec_fx(
Decoder_State *st_fx, /* i/o: : decoder state structure */
Word32 L_yout[], /* o : Q12 : transform-domain output coefs. */
@@ -7492,16 +7671,15 @@ void hq_lr_dec_fx(
Word16 *is_transient_fx /* o : Q0 : transient flag */
);
-// gq_env_dec_fx.c
-Word16 decode_envelope_indices_fx( /* o : Number of bits Q0*/
- Decoder_State *st_fx, /* i/o: decoder state structure */
- const Word16 start_norm, /* i : starting band index Q0*/
- const Word16 num_sfm, /* i : Number of subbands Q0*/
- const Word16 numnrmibits, /* i : Bitrate of fall-back coding mode Q0*/
- Word16 *difidx, /* o : Diff indices/encoded diff indices Q0*/
- const Word16 flag_HQ2 /* i : indicator of HQ2 core Q0*/
- ,
- const Word16 is_transient /* i : indicator of HQ_TRANSIENT Q0*/
+/* o : Number of bits Q0*/
+Word16 decode_envelope_indices_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ const Word16 start_norm, /* i : starting band index Q0*/
+ const Word16 num_sfm, /* i : Number of subbands Q0*/
+ const Word16 numnrmibits, /* i : Bitrate of fall-back coding mode Q0*/
+ Word16 *difidx, /* o : Diff indices/encoded diff indices Q0*/
+ const Word16 flag_HQ2, /* i : indicator of HQ2 core Q0*/
+ const Word16 is_transient /* i : indicator of HQ_TRANSIENT Q0*/
);
void dequantize_norms_fx(
@@ -7513,13 +7691,11 @@ void dequantize_norms_fx(
Word16 *normqlg2 /* o : Log2 of decoded norms Q0*/
);
-// hdecnrm_fx.c
void hdecnrm_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 numNorms, /* (i) number of norms Q0*/
Word16 *index ); /* (o) indices of quantized norms Q0*/
-
Word16 decode_huff_context_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 *hufftab,
@@ -7555,7 +7731,6 @@ void hdecnrm_tran_fx(
Word16 *index /* o : indices of quantized norms Q0*/
);
-// tcq_core_dec_fx.c
void tcq_core_LR_dec_fx(
Decoder_State *st_fx,
Word16 *inp_vector_fx, /*x5 */
@@ -7574,7 +7749,6 @@ void tcq_core_LR_dec_fx(
const Word16 *is_transient /*Q0 */
);
-// FEC_HQ_core_fx.c
void HQ_FEC_processing_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
Word32 *t_audio_q_fx, /* o : MDCT coeffs. (for synthesis) Q12 */
@@ -7606,13 +7780,12 @@ void HQ_FEC_Mem_update_fx(
void time_domain_FEC_HQ_fx(
Decoder_State *st_fx, /* i : Decoder State */
- Word32 *wtda_audio_fx, /* i : i */
+ Word32 *wtda_audio_fx, /* i : i */
Word16 *out_fx, /* o : output audio */
Word16 mean_en_high_fx, /* i : transient flag */
const Word16 output_frame,
Word16 *Q_synth );
-// hq_hr_dec_fx.c
void hq_pred_hb_bws_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 *ynrm, /* i : norm quantization index vector Q0*/
@@ -7633,16 +7806,15 @@ void hq_hr_dec_fx(
const Word16 core_switching_flag /* i : Core switching flag Q1 */
);
-// hq_classifier_dec_fx.c
-Word16 hq_classifier_dec_fx( /* o : Consumed bits Q0 */
- Decoder_State *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate, /* i : Core bit rate Q0 */
- const Word16 length, /* i : Frame length Q0 */
- Word16 *is_transient, /* o : Transient flag Q0 */
- Word16 *hqswb_clas /* o : HQ class Q0 */
+/* o : Consumed bits */
+Word16 hq_classifier_dec_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ const Word32 core_brate, /* i : Core bit rate Q0 */
+ const Word16 length, /* i : Frame length Q0 */
+ Word16 *is_transient, /* o : Transient flag Q0 */
+ Word16 *hqswb_clas /* o : HQ class Q0 */
);
-// peak_vq_dec_fx.c
void hvq_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 num_bits, /* i : Number of available bits */
@@ -7669,7 +7841,6 @@ Word16 hvq_pvq_bitalloc_fx(
Word16 *n_sel_bands /* Q0 o : No. of selected bands for encoding */
);
-// hq_conf_fec_fx.c
void hq_configure_bfi_fx(
Word16 *nb_sfm, /* o : Number of sub bands Q0*/
Word16 *num_Sb, /* o : Number of FEC sub bands ? Q0*/
@@ -7679,7 +7850,6 @@ void hq_configure_bfi_fx(
const Word16 **sfm_end /* o : Subband end coefficients Q0*/
);
-// core_switching_dec_fx.c
void bandwidth_switching_detect_fx(
Decoder_State *st_fx /* i/o: encoder state structure */
);
@@ -7727,7 +7897,6 @@ void core_switching_hq_prepare_dec_fx(
const Word16 output_frame /* i : output frame length Q0*/
);
-// amr_wb_dec_fx.c
ivas_error amr_wb_dec_fx(
Word16 output_sp[], /* o : synthesis output */
Decoder_State *st_fx /* o : Decoder static variables structure */
@@ -7737,7 +7906,6 @@ void amr_wb_dec_init_fx(
AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */
);
-// updt_dec_fx.c
void updt_dec_fx(
Decoder_State *st_fx, /* i/o: state structure */
const Word16 *old_exc_fx, /* i : buffer of excitation */
@@ -7747,9 +7915,8 @@ void updt_dec_fx(
const Word16 *lsf_new_fx, /* i : current frame LSF vector */
const Word16 *lsp_new_fx, /* i : current frame LSP vector */
const Word16 voice_factors[], /* i : voicing factors */
- const Word16 *old_bwe_exc_fx /* i : buffer of excitation */
- ,
- const Word16 *gain_buf /*Q14*/
+ const Word16 *old_bwe_exc_fx, /* i : buffer of excitation */
+ const Word16 *gain_buf /*Q14*/
);
void updt_IO_switch_dec_fx(
@@ -7777,45 +7944,31 @@ void update_decoder_LPD_cng(
Word16 *A,
Word16 *bpf_noise_buf );
-// FEC_clas_estim_fx
void FEC_clas_estim_fx(
- Decoder_State *st_fx, /* i/o: decoder state handle */
- const Word16 Opt_AMR_WB,
- /* i : flag indicating AMR-WB IO mode */ /*A*/
- const Word16 L_frame, /* i : length of the frame */
- Word16 *clas, /* i/o: frame classification */
- const Word16 coder_type, /* i : coder type */
- const Word16 *pitch, /* i : pitch values for each subframe (Q6) */
- Word16 *syn, /* i : synthesis buffer */
- Word16 *lp_speech, /* i/o: long term active speech energy average Q8 */
- Word16 *decision_hyst,
- /* i/o: hysteresis of the music/speech decision */ /*A*/
- Word16 *UV_cnt,
- /* i/o: number of consecutives frames classified as UV */ /*A*/
- Word16 *LT_UV_cnt,
- /* i/o: long term consecutives frames classified as UV */ /*A*/
- Word16 *Last_ener,
- /* i/o: last_energy frame */ /*A*/
- Word16 *locattack,
- /* i/o: detection of attack (mainly to localized speech burst) */ /*A*/
- Word16 *lt_diff_etot,
- /* i/o: long-term total energy variation */ /*A*/
- Word16 *amr_io_class,
- /* i/o: classification for AMR-WB IO mode */ /*A*/
- Word16 Q_syn, /* i : Synthesis scaling */
- Word16 *class_para,
- /* o : classification para. fmerit1 */ /*A*/
- Word16 *mem_syn_clas_estim, /* i/o: memory of the synthesis signal for frame class estimation */
- Word16 *Q_mem_syn,
- /*i/o : exponent for memory of synthesis signal for frame class estimation */ /*B*/
- Word16 LTP_Gain,
- /* i : LTP gain is 0..0.6 or negative Q15*/ /*B*/
- Word16 mode,
- /* i : signal classifier mode */ /*B*/
- Word16 bfi,
- /* i : bad frame indicator */ /*B*/
- Word32 last_core_brate, /* i : bitrate of previous frame */
- const Word16 FEC_mode /* i : ACELP FEC mode */
+ Decoder_State *st_fx, /* i/o: decoder state handle */
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode A*/
+ const Word16 L_frame, /* i : length of the frame */
+ Word16 *clas, /* i/o: frame classification */
+ const Word16 coder_type, /* i : coder type */
+ const Word16 *pitch, /* i : pitch values for each subframe (Q6) */
+ Word16 *syn, /* i : synthesis buffer */
+ Word16 *lp_speech, /* i/o: long term active speech energy average Q8 */
+ Word16 *decision_hyst, /* i/o: hysteresis of the music/speech decision A*/
+ Word16 *UV_cnt, /* i/o: number of consecutives frames classified as UV A*/
+ Word16 *LT_UV_cnt, /* i/o: long term consecutives frames classified as UV A*/
+ Word16 *Last_ener, /* i/o: last_energy frame A*/
+ Word16 *locattack, /* i/o: detection of attack (mainly to localized speech burst) A*/
+ Word16 *lt_diff_etot, /* i/o: long-term total energy variation A*/
+ Word16 *amr_io_class, /* i/o: classification for AMR-WB IO mode A*/
+ Word16 Q_syn, /* i : Synthesis scaling */
+ Word16 *class_para, /* o : classification para. fmerit1 A*/
+ Word16 *mem_syn_clas_estim, /* i/o: memory of the synthesis signal for frame class estimation */
+ Word16 *Q_mem_syn, /*i/o : exponent for memory of synthesis signal for frame class estimation B*/
+ Word16 LTP_Gain, /* i : LTP gain is 0..0.6 or negative Q15B*/
+ Word16 mode, /* i : signal classifier mode B*/
+ Word16 bfi, /* i : bad frame indicator B*/
+ Word32 last_core_brate, /* i : bitrate of previous frame */
+ const Word16 FEC_mode /* i : ACELP FEC mode */
);
Word16 FEC_pos_dec_fx(
@@ -7825,7 +7978,6 @@ Word16 FEC_pos_dec_fx(
const Word16 nBits_es_Pred /* i : number of bits for Es_pred Q */
);
-// post_dec.h
void post_decoder(
Decoder_State *st,
Word16 synth_buf[], /* Q0 */
@@ -7851,7 +8003,6 @@ void cldfb_synth_set_bandsToZero(
const Word16 nTimeSlots,
const CLDFB_SCALE_FACTOR scaleFactor );
-// FEC_pitch_estim_fx.c
void FEC_pitch_estim_fx(
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
const Word16 last_core, /* i : last core */
@@ -7898,7 +8049,6 @@ void FEC_scale_syn_fx(
const Word16 force_scaling /* i : force scaling */
);
-// LD_music_post_filter_fx.c
void LD_music_post_filter_fx(
MUSIC_POSTFILT_HANDLE hMusicPF, /* i/o: LD music postfilter handle */
const Word16 dtc_in[], /* i : i synthesis Qdct */
@@ -7947,7 +8097,6 @@ void music_postfilt_init(
MUSIC_POSTFILT_HANDLE hMusicPF /* i/o: LD music postfilter handle */
);
-// gs_dec_amr_wb.c
void improv_amr_wb_gs_fx(
const Word16 clas, /* i : signal frame class Q0*/
const Word16 coder_type, /* i : coder type Q0*/
@@ -7969,7 +8118,6 @@ void improv_amr_wb_gs_fx(
const Word16 last_coder_type /* i : Last coder_type Q0*/
);
-// dec_amr_wb_fx.c
void decod_amr_wb_fx(
Decoder_State *st_fx, /* i/o: decoder static memory */
const Word16 *Aq_fx, /* i : LP filter coefficients */
@@ -7981,14 +8129,12 @@ void decod_amr_wb_fx(
Word16 *gain_buf /* o : floating pitch gain for each subframe Q14 */
);
-// rst_dec_fx.c
void CNG_reset_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
Word16 *pitch_buf, /* o : floating pitch for each subframe Q6*/
Word16 *voice_factors /* o : voicing factors Q15*/
);
-// voiced_dec_fx.c
ivas_error ppp_voiced_decoder_fx(
Decoder_State *st_fx, /* i/o: state structure */
Word16 *out_fx, /* o : residual signal */
@@ -7997,11 +8143,11 @@ ivas_error ppp_voiced_decoder_fx(
Word16 *pitch, /* o : floating pitch values for each subframe */
Word16 bfi /* i : Frame error rate */
);
+
void sc_vbr_dec_init(
SC_VBR_DEC_HANDLE hSC_VBR /* i/o: SC-VBR decoder handle */
);
-// ppp_dec_fx.c
ivas_error ppp_quarter_decoder_fx(
DTFS_STRUCTURE *CURRCW_Q_DTFS_FX, /* i/o: Current CW DTFS */
Word16 prevCW_lag_fx, /* i : Previous lag */
@@ -8014,12 +8160,12 @@ ivas_error ppp_quarter_decoder_fx(
DTFS_STRUCTURE PREV_CW_D_FX, /* i : Previous DTFS */
Decoder_State *st_fx );
-// core_dec_init_fx.c
void open_decoder_LPD_fx(
Decoder_State *st,
const Word32 total_brate, /* Q0 */
const Word16 bwidth /* Q0 */
);
+
void open_decoder_LPD_ivas_fx(
Decoder_State *st, /* i/o: decoder state structure */
const Word32 total_brate, /* i : total bitrate Q0*/
@@ -8040,11 +8186,14 @@ void open_decoder_LPD_ivas_fx(
void reset_tcx_overl_buf_fx(
TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */
);
+
void acelp_plc_mdct_transition_fx(
Decoder_State *st /* i/o: Decoder state */
);
+
void cldfb_reset_memory_fx(
HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ );
+
void tcxltp_dec_init_fx(
TCX_LTP_DEC_HANDLE hTcxLtpDec, /* Q0 */
const Word16 ini_frame, /* Q0 */
@@ -8052,23 +8201,22 @@ void tcxltp_dec_init_fx(
const Word16 element_mode, /* Q0 */
const Word16 pit_max, /* Q0 */
const Word32 sr_core ); /* Q0 */
-// swb_bwe_dec_hr_fx.c
-Word16 swb_bwe_dec_hr_fx( /* o : Exponent of SHB synthesis */
- Decoder_State *st_fx, /* i/o: decoder state structure */
- const Word16 *syn_12k8_16k_fx, /* i : ACELP core synthesis @16kHz : Q(15 - exp) */
- const Word16 exp, /* i : Exponent of core synthesis */
- Word16 *hb_synth_fx, /* o : SHB synthesis : Q(15 - hb_synth_fx_exp)*/
- const Word16 output_frame, /* i : frame length */
- const Word16 unbits, /* i : number of core unused bits */
- const Word16 pitch_buf[] /* i : pitch buffer : Q6 */
+/* o : Exponent of SHB synthesis */
+Word16 swb_bwe_dec_hr_fx(
+ Decoder_State *st_fx, /* i/o: decoder state structure */
+ const Word16 *syn_12k8_16k_fx, /* i : ACELP core synthesis @16kHz : Q(15 - exp) */
+ const Word16 exp, /* i : Exponent of core synthesis */
+ Word16 *hb_synth_fx, /* o : SHB synthesis : Q(15 - hb_synth_fx_exp)*/
+ const Word16 output_frame, /* i : frame length */
+ const Word16 unbits, /* i : number of core unused bits */
+ const Word16 pitch_buf[] /* i : pitch buffer : Q6 */
);
void hr_bwe_dec_init(
HR_BWE_DEC_HANDLE hBWE_FD_HR /* i/o: HR BWE data handle */
);
-// swb_bwe_com_hr_fx.c
void swb_hr_noise_fill_fx(
const Word16 is_transient, /* i : transient flag */
const Word16 spect_start, /* i : spectrum start point */
@@ -8081,7 +8229,6 @@ void swb_hr_noise_fill_fx(
Word16 *t_audio, /* i/o: mdct spectrum Q_audio */
Word16 Q_audio );
-// stat_noise_uv_dec_fx.c
void stat_noise_uv_dec_fx(
Decoder_State *st_fx, /* i/o: Decoder static memory */
Word16 *lsp_new, /* i : end-frame LSP vector Q15 */
@@ -8091,7 +8238,6 @@ void stat_noise_uv_dec_fx(
const Word16 uc_two_stage_flag /* i : flag indicating two-stage UC */
);
-// stat_noise_uv_mod_fx.c
void stat_noise_uv_mod_fx(
const Word16 coder_type, /* i : Coder type */
Word16 noisiness, /* i : noisiness parameter Q0 */
@@ -8138,15 +8284,13 @@ void stat_noise_uv_mod_ivas_fx(
Word16 *Q_stat_noise_ge /* i/o: noise scaling */
);
-// FEC_adao_codebook_fx.c
Word16 FEC_SinOnset_fx(
- Word16 *exc, /* i/o : exc vector to modify */
- Word16 puls_pos, /* i : last pulse position desired */
- const Word16 T0, /* i : Pitch information of the 1 subfr */
- Word32 enr_q, /* i : energy provide by the encoder */
- Word16 *Aq, /* i : A(z) filter Q12 */
- const Word16 L_frame /* i : frame length */
- ,
+ Word16 *exc, /* i/o : exc vector to modify */
+ Word16 puls_pos, /* i : last pulse position desired */
+ const Word16 T0, /* i : Pitch information of the 1 subfr */
+ Word32 enr_q, /* i : energy provide by the encoder */
+ Word16 *Aq, /* i : A(z) filter Q12 */
+ const Word16 L_frame, /* i : frame length */
const Word16 Qold );
Word16 FEC_enhACB_fx(
@@ -8158,7 +8302,7 @@ Word16 FEC_enhACB_fx(
const Word16 bfi_pitch /* i : Q6 pitch used for concealment */
);
-/*! r: do_WI flag */
+/*! r: do_WI flag */
Word16 FEC_synchro_exc_fx(
const Word16 L_frame, /* i : length of the frame */
Word16 *exc, /* i/o: exc vector to modify */
@@ -8181,7 +8325,6 @@ void decod_unvoiced_fx(
Word16 *bwe_exc_fx, /* Q_X i/o: excitation for SWB TBE */
Word16 *gain_buf );
-// gaus_dec_fx.c
void gaus_dec_fx(
Decoder_State *st_fx, /* i/o: decoder static memory */
const Word16 i_subfr, /* i : subframe index */
@@ -8228,7 +8371,6 @@ ivas_error decod_gen_voic_fx(
const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
);
-// dec_tran_fx.c
void decod_tran_fx(
Decoder_State *st_fx, /* i/o: decoder static memory */
const Word16 L_frame_fx, /* i : length of the frame */
@@ -8245,7 +8387,6 @@ void decod_tran_fx(
Word16 *gain_buf /*Q14*/
);
-// transition_dec_fx.c
void transition_dec_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
@@ -8266,25 +8407,21 @@ void transition_dec_fx(
Word16 tc_classif_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
- const Word16 L_frame /* i : length of the frame */
+ const Word16 L_frame /* i : length of the frame */
);
-// dec_ppp_fx.c
ivas_error decod_ppp_fx(
- Decoder_State *st_fx, /* i/o: state structure */
- const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
- Word16 *pitch_buf_fx, /* i/o: fixed pitch values for each subframe */
- Word16 *exc_fx, /* i/o: current non-enhanced excitation */
- Word16 *exc2_fx, /* i/o: current enhanced excitation */
- Word16 bfi /* i : bad frame indicator */
- ,
- Word16 *gain_buf /*Q14*/
- ,
+ Decoder_State *st_fx, /* i/o: state structure */
+ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
+ Word16 *pitch_buf_fx, /* i/o: fixed pitch values for each subframe */
+ Word16 *exc_fx, /* i/o: current non-enhanced excitation */
+ Word16 *exc2_fx, /* i/o: current enhanced excitation */
+ Word16 bfi, /* i : bad frame indicator */
+ Word16 *gain_buf, /*Q14*/
Word16 *voice_factors, /* o : voicing factors */
Word16 *bwe_exc_fx /* o : excitation for SWB TBE */
);
-// swb_bwe_dec_lr_fx.c
void swb_bwe_dec_lr_fx(
Decoder_State *st_fx, /* i/o: decoder state structure */
const Word32 L_m_core[], /* i : lowband synthesis : QsL */
@@ -8308,7 +8445,6 @@ void swb_bwe_dec_lr_fx(
Word16 *ni_seed_fx /* i/o: random seed : QsL */
);
-// dec_acelp_tck_main_fx.c
Word16 dec_acelp_tcx_frame_fx(
Decoder_State *st, /* i/o: decoder state structure */
Word16 *concealWholeFrame, /* i/o: concealment flag */
@@ -8320,7 +8456,6 @@ Word16 dec_acelp_tcx_frame_fx(
Word16 pitch_buf[] /* o : floating pitch for each subframe */
);
-// dec_LPD_fx.c
void decoder_LPD_fx(
Word16 signal_out[], /* o : signal with LPD delay (7 subfrs) */
Word16 signal_outFB[], /* o : synthesis @output_FS */
@@ -8335,7 +8470,6 @@ void decoder_LPD_fx(
Word16 *ptr_bwe_exc /* o : excitation for SWB TBE */
);
-// core_dec_switch_fx.c
void mode_switch_decoder_LPD_fx(
Decoder_State *st, /* Q0 */
Word16 bandwidth_in, /* Q0 */
@@ -8360,17 +8494,16 @@ void mode_switch_decoder_LPD_ivas_fx(
Word16 *Q_old_outLB,
Word16 *Q_old_Aq_12_8 );
-// ari_hm_dec.c
-
Word16 DecodeIndex(
Decoder_State *st,
const Word16 Bandwidth, /* o : NB, 1: (S)WB */
Word16 *PeriodicityIndex );
-Word16
-DecodeIndex_fx(
+
+Word16 DecodeIndex_fx(
Decoder_State *st,
const Word16 Bandwidth,
Word16 *PeriodicityIndex );
+
void tcx_hm_decode(
const Word16 L_frame, /* i : number of spectral lines */
Word32 env[], /* i/o: envelope shape (Q16) */
@@ -8381,7 +8514,6 @@ void tcx_hm_decode(
Word16 *hm_bits /* o : bit consumption */
);
-// lsf_msvq_ma_dec_fx.c
Word16 lsf_msvq_ma_decprm(
Decoder_State *st,
Word16 *param_lpc /* Q0 */
@@ -8390,8 +8522,8 @@ Word16 lsf_msvq_ma_decprm(
Word16 lsf_bctcvq_decprm(
Decoder_State *st,
Word16 *param_lpc /* Q0 */
-
);
+
Word16 D_lsf_tcxlpc(
const Word16 indices[], /* i : VQ indices Q0*/
Word16 lsf_q[], /* o : quantized LSF Q1*/
@@ -8408,7 +8540,6 @@ Word16 dec_lsf_tcxlpc(
Word16 cdk /* i : codebook selector Q0*/
);
-// lsf_msvq_ma_fx.c
void midlsf_dec(
const Word16 qlsf0[], /* i: quantized lsf coefficients (3Q12) */
const Word16 qlsf1[], /* i: quantized lsf coefficients (3Q12) */
@@ -8425,8 +8556,6 @@ Word16 lsf_ind_is_active(
const Word16 narrowband,
const Word16 cdk );
-
-// IGFSCFDecoder.c
void IGFSCFDecoderOpen(
IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i : handle to public data */
H_IGF_INFO hIgfInfo, /* i : IGF info handle */
@@ -8448,14 +8577,17 @@ void IGFSCFDecoderDecode(
if 0 on input the decoder will be forced to encode without a reset */
);
-// ari_dec_fx.c
-Word32 ari_decode_overflow_fx( Tastat *s );
+Word32 ari_decode_overflow_fx(
+ Tastat *s );
void ari_start_decoding_14bits_fx(
Decoder_State *st,
Tastat *s );
-Word16 ari_start_decoding_14bits_prm_fx( const Word16 *ptr, Word16 bp, Tastat *s );
+Word16 ari_start_decoding_14bits_prm_fx(
+ const Word16 *ptr,
+ Word16 bp,
+ Tastat *s );
Word16 ari_decode_14bits_s17_ext_fx(
Decoder_State *st,
@@ -8471,11 +8603,21 @@ Word16 ari_decode_14bits_bit_ext_fx(
Decoder_State *st,
Tastat *s );
-Word16 ari_decode_14bits_pow_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base );
+Word16 ari_decode_14bits_pow_fx(
+ Word16 *ptr,
+ Word16 bp,
+ Word16 bits,
+ Word16 *res,
+ Tastat *s,
+ Word16 base );
-Word16 ari_decode_14bits_sign_fx( Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s );
+Word16 ari_decode_14bits_sign_fx(
+ Word16 *ptr,
+ Word16 bp,
+ Word16 bits,
+ Word16 *res,
+ Tastat *s );
-// dec_prm_fx.c
void getTCXparam_fx(
Decoder_State *st, /* i/o: Decoder State handle */
Decoder_State *st0, /* i : bitstream */
@@ -8487,6 +8629,7 @@ void getTCXparam_fx(
Word16 p_param[2], /* o : pointer to parameters for next round of bs reading Q0 */
Word16 nTnsBitsTCX10[2], /*Q0*/
const Word16 pre_past_flag /*Q0*/ );
+
void dec_prm_fx(
Word16 *coder_type,
Word16 param[], /* (o) : decoded parameters */
@@ -8503,7 +8646,6 @@ void getLPCparam_fx(
const Word16 ch, /* i : channel Q0 */
const Word16 sns_low_br_mode /* i : SNS low-bitrate mode Q0 */
);
-// ari_hm_fx.c
void UnmapIndex(
const Word16 PeriodicityIndex, /* Q0 */
@@ -8542,24 +8684,25 @@ void tcx_hm_modify_envelope(
Word16 L_frame /* i: number of spectral lines Q0 */
);
-// tns_base_dec_fx.c
-Word16
-ReadTnsData( STnsConfig const *pTnsConfig,
- Decoder_State *st,
- Word16 *pnBits,
- Word16 *stream,
- Word16 *pnSize );
+Word16 ReadTnsData(
+ STnsConfig const *pTnsConfig,
+ Decoder_State *st,
+ Word16 *pnBits,
+ Word16 *stream,
+ Word16 *pnSize );
-void ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig,
- Decoder_State *st,
- Word16 *pnBits,
- Word16 *stream,
- Word16 *pnSize );
+void ReadTnsData_ivas_fx(
+ STnsConfig const *pTnsConfig,
+ Decoder_State *st,
+ Word16 *pnBits,
+ Word16 *stream,
+ Word16 *pnSize );
-Word16 DecodeTnsData( STnsConfig const *pTnsConfig,
- Word16 const *stream,
- Word16 *pnSize,
- STnsData *pTnsData );
+Word16 DecodeTnsData(
+ STnsConfig const *pTnsConfig,
+ Word16 const *stream,
+ Word16 *pnSize,
+ STnsData *pTnsData );
Word16 DecodeTnsData_ivas_fx(
STnsConfig const *pTnsConfig,
@@ -8567,7 +8710,6 @@ Word16 DecodeTnsData_ivas_fx(
Word16 *pnSize,
STnsData *pTnsData );
-// parametr_bitmapping.c using ivas
void GetParameters(
ParamsBitMap const *paramsBitMap,
const Word16 nParams,
@@ -8627,25 +8769,27 @@ void ReadFromBitstream_fx(
Decoder_State *st,
Word16 **pStream,
Word16 *pnSize );
-// igf_dec_fx.c
-void IGFDecReadData( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Deccoder */
- Decoder_State *st, /**< in: | decoder state */
- const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */
- const Word16 isIndepFrame /**< in: Q0 | if 1: arith dec force reset, if 0: no reset */
-);
-void IGFDecReadLevel( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Deccoder */
- Decoder_State *st, /**< in: | decoder state */
- const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */
- const Word16 isIndepFrame /**< in: Q0 | if 1: arith dec force reset, if 0: no reset */
+void IGFDecReadData(
+ const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Deccoder */
+ Decoder_State *st, /**< in: | decoder state */
+ const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */
+ const Word16 isIndepFrame /**< in: Q0 | if 1: arith dec force reset, if 0: no reset */
);
-void IGFDecApplyMono( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
- Word32 *spectrum, /**< in/out: | MDCT spectrum */
- Word16 *spectrum_e, /**< in/out: | exponent of spectrum */
- const Word16 igfGridIdx, /**< in: | in case of CELP->TCX switching, use 1.25 framelength */
- Word16 bfi /**< in: | frame loss == 1, frame good == 0 */
+void IGFDecReadLevel(
+ const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Deccoder */
+ Decoder_State *st, /**< in: | decoder state */
+ const Word16 igfGridIdx, /**< in: Q0 | in case of CELP->TCX switching, use 1.25 framelength */
+ const Word16 isIndepFrame /**< in: Q0 | if 1: arith dec force reset, if 0: no reset */
+);
+void IGFDecApplyMono(
+ const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
+ Word32 *spectrum, /**< in/out: | MDCT spectrum */
+ Word16 *spectrum_e, /**< in/out: | exponent of spectrum */
+ const Word16 igfGridIdx, /**< in: | in case of CELP->TCX switching, use 1.25 framelength */
+ Word16 bfi /**< in: | frame loss == 1, frame good == 0 */
);
void IGFDecApplyMono_ivas(
@@ -8679,6 +8823,7 @@ void IGFDecSetMode(
const Word16 defaultStopLine, /* i : default stop subband index */
const Word16 rf_mode /* i : flag to signal the RF mode */
);
+
void IGFDecSetMode_ivas_fx(
const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* i : instance handle of IGF Decoder */
const Word32 total_brate, /* i : bitrate */
@@ -8689,8 +8834,9 @@ void IGFDecSetMode_ivas_fx(
const Word16 rf_mode /* i : flag to signal the RF mode */
);
-void IGFDecUpdateInfo( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
- const Word16 igfGridIdx /**< in: | IGF grid index */
+void IGFDecUpdateInfo(
+ const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
+ const Word16 igfGridIdx /**< in: | IGF grid index */
);
void IGFDecUpdateInfo_ivas_fx(
@@ -8699,10 +8845,11 @@ void IGFDecUpdateInfo_ivas_fx(
const Word16 igfGridIdx /* i : IGF grid index */
);
-void IGFDecCopyLPCFlatSpectrum( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
- const Word32 *pSpectrumFlat, /**< in: Q31 | LPC flattend spectrum from TCX dec */
- const Word16 pSpectrumFlat_exp, /**< in: | exponent of pSpectrumFlat */
- const Word16 igfGridIdx /**< in: Q0 | IGF grid index */
+void IGFDecCopyLPCFlatSpectrum(
+ const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
+ const Word32 *pSpectrumFlat, /**< in: Q31 | LPC flattend spectrum from TCX dec */
+ const Word16 pSpectrumFlat_exp, /**< in: | exponent of pSpectrumFlat */
+ const Word16 igfGridIdx /**< in: Q0 | IGF grid index */
);
void IGFDecCopyLPCFlatSpectrum_fx(
@@ -8712,12 +8859,14 @@ void IGFDecCopyLPCFlatSpectrum_fx(
const Word16 igfGridIdx /**< in: Q0 | IGF grid index */
);
-void IGFDecStoreTCX10SubFrameData( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
- const Word16 subFrameIdx /**< in: Q0 | index of subframe */
+void IGFDecStoreTCX10SubFrameData(
+ const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
+ const Word16 subFrameIdx /**< in: Q0 | index of subframe */
);
-void IGFDecRestoreTCX10SubFrameData( const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
- const Word16 subFrameIdx /**< in: Q0 | index of subframe */
+void IGFDecRestoreTCX10SubFrameData(
+ const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
+ const Word16 subFrameIdx /**< in: Q0 | index of subframe */
);
void IGFDecRestoreTCX10SubFrameData_fx(
@@ -8725,17 +8874,16 @@ void IGFDecRestoreTCX10SubFrameData_fx(
const Word16 subFrameIdx /* i : index of subframe */
);
-
void init_igf_dec(
IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */
);
-// dlpc_avq_fx.c
Word16 dlpc_avq_fx(
Word16 *index, /* (i) Quantization indices */
Word16 *LSF_Q, /* (o) Quantized LSF vectors */
Word16 numlpc, /* (i) Number of sets of lpc */
Word32 sr_core );
+
Word16 decode_lpc_avq_fx(
Decoder_State *st, /* i/o: decoder state structure */
const Word16 numlpc, /* i : Number of sets of lpc */
@@ -8743,35 +8891,30 @@ Word16 decode_lpc_avq_fx(
);
Word16 decode_lpc_avq_ivas_fx(
- Decoder_State *st, /* i/o: decoder state structure */
- const Word16 numlpc, /* i : Number of sets of lpc */
- Word16 *param_lpc /* o : lpc parameters */
- ,
+ Decoder_State *st, /* i/o: decoder state structure */
+ const Word16 numlpc, /* i : Number of sets of lpc */
+ Word16 *param_lpc, /* o : lpc parameters */
const Word16 ch, /* i : channel */
const Word16 element_mode, /* i : element mode */
const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */
);
-// vlpc_1st_dec_fx.c
+
void vlpc_1st_dec(
- Word16 index, /* i : codebook index */
+ Word16 index, /* i : codebook index */
Word16 *lsfq ); /* i/o: i:prediction o:quantized lsf */
-
-// vlpc_2st_dec_fx.c
void vlpc_2st_dec(
- Word16 *lsfq, /* i/o: i:1st stage o:1st+2nd stage */
+ Word16 *lsfq, /* i/o: i:1st stage o:1st+2nd stage */
Word16 *indx, /* i : index[] (4 bits per words) */
Word16 mode, /* i : 0=abs, >0=rel */
Word32 sr_core );
-// vlpc_2st_com_fx.c
-void lsf_weight_2st( const Word16 *lsfq, /* input: quantized lsf coefficients (14Q1*1.28) */
- Word16 *w, /* output: weighting function (0Q15*1.28) */
- const Word16 mode /* input: operational mode Q0 */
+void lsf_weight_2st(
+ const Word16 *lsfq, /* input: quantized lsf coefficients (14Q1*1.28) */
+ Word16 *w, /* output: weighting function (0Q15*1.28) */
+ const Word16 mode /* input: operational mode Q0 */
);
-// ACcontextMapping_fx.c
-
/* Returns: index of next coefficient */
Word16 get_next_coeff_mapped(
Word16 ii[2], /* i/o: coefficient indexes Q0*/
@@ -8798,9 +8941,6 @@ Word32 update_mixed_context_ivas_fx(
Word16 a /* Q0 */
);
-
-// ACcontextMapping_dec_fx.c
-
typedef Word16 ( *get_next_coeff_function )(
Word16 ii[2], /* i/o: coefficient indexes */
Word16 *pp, /* o : peak(1)/hole(0) indicator */
@@ -8816,6 +8956,7 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC(
Word16 resQMaxBits, /* i: residual coding maximum bits*/
CONTEXT_HM_CONFIG *hm_cfg /* i: context-based harmonic model configuration */
);
+
Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
Decoder_State *st, /* i/o: decoder state */
Word16 *x, /* o : decoded spectrum */
@@ -8825,7 +8966,6 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx(
CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration*/
);
-// core_dec_reconf_fx.c
void reconfig_decoder_LPD_fx(
Decoder_State *st, /* i/o: decoder state structure */
Word16 bits_frame, /* i : bit budget Q0*/
@@ -8833,6 +8973,7 @@ void reconfig_decoder_LPD_fx(
Word32 total_brate, /* i : total bitrate Q0*/
Word16 L_frame_old /* i : frame length Q0*/
);
+
void reconfig_decoder_LPD_ivas_fx(
Decoder_State *st, /* i/o: decoder state structure */
const Word16 bits_frame, /* i : bit budget Q0*/
@@ -8841,34 +8982,28 @@ void reconfig_decoder_LPD_ivas_fx(
const Word16 L_frame_old /* i : frame length Q0*/
);
-// er_utils_fx.c
-void minimumStatistics_fx( Word16 *noiseLevelMemory, /* Q15, internal state */
- Word16 *noiseLevelIndex, /* Q0, internal state */
- Word16 *currLevelIndex, /* Q0, internal state (circular buffer) */
- Word16 *noiseEstimate, /* Q15, previous estimate of background noise */
- Word16 *lastFrameLevel, /* Q15, level of the last frame */
- Word16 currentFrameLevel, /* Q15, level of the current frame */
- Word16 *noiseLevelMemory_e, /* scaling factor for noiseLevelMemory */
- Word16 const noiseEstimate_e, /* exponent of noiseEstimate */
- Word16 *new_noiseEstimate_e, /* new exponent of noise Estimate*/
- Word16 *const lastFrameLevel_e, /* exponent of lastFrameLevel */
- Word16 currentFrameLevel_e ); /* exponent of currentFrameLevel */
-
-
-Word16 getLevelSynDeemph_fx( /*10Q5*/
- Word16 h1Init[],
- /* i: i value or vector to be processed */ /* Q15 */
- Word16 const A[],
- /* i: LPC coefficients */ /* Qx */
- Word16 const lpcorder,
- /* i: LPC order */ /* Q0 */
- Word16 const lenLpcExc,
- /* i: length of the LPC excitation buffer */ /* Q0 */
- Word16 const preemph_fac,
- /* i: preemphasis factor */ /* Q15 */
- Word16 const numLoops,
- /* i: number of loops */ /* Q0 */
- Word16 *Exp /* o: exponent of return value Q15 */
+void minimumStatistics_fx(
+ Word16 *noiseLevelMemory, /* Q15, internal state */
+ Word16 *noiseLevelIndex, /* Q0, internal state */
+ Word16 *currLevelIndex, /* Q0, internal state (circular buffer) */
+ Word16 *noiseEstimate, /* Q15, previous estimate of background noise */
+ Word16 *lastFrameLevel, /* Q15, level of the last frame */
+ Word16 currentFrameLevel, /* Q15, level of the current frame */
+ Word16 *noiseLevelMemory_e, /* scaling factor for noiseLevelMemory */
+ Word16 const noiseEstimate_e, /* exponent of noiseEstimate */
+ Word16 *new_noiseEstimate_e, /* new exponent of noise Estimate*/
+ Word16 *const lastFrameLevel_e, /* exponent of lastFrameLevel */
+ Word16 currentFrameLevel_e ); /* exponent of currentFrameLevel */
+
+/*10Q5*/
+Word16 getLevelSynDeemph_fx(
+ Word16 h1Init[], /* i: i value or vector to be processed Q15 */
+ Word16 const A[], /* i: LPC coefficients Qx */
+ Word16 const lpcorder, /* i: LPC order Q0 */
+ Word16 const lenLpcExc, /* i: length of the LPC excitation buffer Q0 */
+ Word16 const preemph_fac, /* i: preemphasis factor Q15 */
+ Word16 const numLoops, /* i: number of loops Q0 */
+ Word16 *Exp /* o: exponent of return value Q15 */
);
void genPlcFiltBWAdap_fx(
@@ -8886,9 +9021,9 @@ void highPassFiltering_fx(
const Word16 l_fir_fer ); /* i: high pass filter length */
-Word16 GetPLCModeDecision_fx( Decoder_State *st );
+Word16 GetPLCModeDecision_fx(
+ Decoder_State *st );
-// dlpc_stoch_fx.c
void lpc_unquantize_fx(
Decoder_State *st,
Word16 *lsf,
@@ -8901,7 +9036,6 @@ void lpc_unquantize_fx(
Word16 *LSF_Q_prediction /* o : LSF prediction mode */
);
-// dlpc_bfi_fx.c
void dlpc_bfi(
const Word16 L_frame,
Word16 *lsf_q, /* o : quantized LSFs */
@@ -8920,7 +9054,6 @@ void dlpc_bfi(
const Word16 *lsfBase, /* i : base for differential LSF coding */
Word8 tcxonly );
-// guided_plc_util_fx.c
void getLookAheadResSig(
Word16 *speechLookAhead, /* Qx */
Word16 *A_3Q12, /* 3Q12 */
@@ -8928,10 +9061,12 @@ void getLookAheadResSig(
const Word16 L_frame, /* Q0 */
const Word16 numSubFrame /* Q0 */
);
+
void updateLSFForConcealment(
PLC_ENC_EVS_HANDLE decState,
Word16 *lsf_14Q1 /* 14Q1 */
);
+
void getConcealedLP(
PLC_ENC_EVS_HANDLE memDecState,
Word16 *AqCon, /* 14Q1 */
@@ -8939,6 +9074,7 @@ void getConcealedLP(
const Word16 last_good, /* Q0 */
const Word16 L_frame /* Q0 */
);
+
void getConcealedLSF(
PLC_ENC_EVS_HANDLE memDecState,
const Word16 lsfBase[], /* Q1 * 1.28 */
@@ -8961,25 +9097,21 @@ void modify_lsf(
const Word16 reset_q /* Q0 */
);
-// er_dec_tcx_fx.c
void con_tcx_fx(
- Decoder_State *st, /* i/o: coder memory state */
- Word16 synth[] /* i/o: synth[] */ /*Q0 */
+ Decoder_State *st, /* i/o: coder memory state */
+ Word16 synth[] /* i/o: synth[] Q0 */
);
-// er_scale_sync.c
-Word16 Damping_fact_fx( /* o : damping factor */ /*Q14*/
- const Word16 coder_type, /* i : coding type in last good received frame */
- const Word16 nbLostCmpt, /* i : counter of consecutive bfi frames */
- const Word16 last_good, /* i : last good frame class */
- const Word16 stab_fac,
- /* i : ISF stability factor */ /*Q15*/
- Word32 *lp_gainp,
- /*i/o: damped pitch gain */ /*Q16 Word32!*/
- const Word16 core /* i : current coding mode */
+/* o : damping factor Q14*/
+Word16 Damping_fact_fx(
+ const Word16 coder_type, /* i : coding type in last good received frame */
+ const Word16 nbLostCmpt, /* i : counter of consecutive bfi frames */
+ const Word16 last_good, /* i : last good frame class */
+ const Word16 stab_fac, /* i : ISF stability factor Q15*/
+ Word32 *lp_gainp, /*i/o: damped pitch gain Q16 Word32!*/
+ const Word16 core /* i : current coding mode */
);
-// dec_tcx_fx.c
void decoder_tcx_fx(
TCX_CONFIG_HANDLE hTcxCfg,
Word16 prm[], /* i : parameters */
@@ -9008,13 +9140,13 @@ void decoder_tcx_ivas_fx(
const Word16 frame_cnt,
const Word16 sba_dirac_stereo_flag );
-void decoder_tcx_post_fx( Decoder_State *st_fx,
- Word16 *synth,
- Word16 *synthFB,
- Word16 *A,
- Word16 bfi );
+void decoder_tcx_post_fx(
+ Decoder_State *st_fx,
+ Word16 *synth,
+ Word16 *synthFB,
+ Word16 *A,
+ Word16 bfi );
-// arith_coder_dec_fx.c
void tcx_arith_decode_envelope_fx(
Word32 q_spectrum[], /* o: quantised MDCT coefficients Q31-e */
Word16 *q_spectrum_e, /* o: MDCT exponent Q0 */
@@ -9029,13 +9161,10 @@ void tcx_arith_decode_envelope_fx(
Word16 tcxltp_pitch, /* i: TCX LTP pitch in FD, -1 if n/a*/
Word16 *arith_bits, /* o: bits used for ari. coding */
Word16 *signaling_bits, /* o: bits used for signaling */
- Word16 *nf_seed /* o: noise filling seed Q0 */
- ,
- Word16 low_complexity /* i: low-complexity flag Q0 */
-
+ Word16 *nf_seed, /* o: noise filling seed Q0 */
+ Word16 low_complexity /* i: low-complexity flag Q0 */
);
-// tcx_utils_dec_fx.c
void tcx_decoder_memory_update(
Word16 *xn_buf, /* i/o: mdct output buffer used also as temporary buffer : Q0 */
Word16 *synthout, /* o: synth : Q0 */
@@ -9072,7 +9201,6 @@ Word16 tcx_res_invQ_spec(
const Word16 lf_deemph_factors[] /*i : LF deemphasis factors Q14*/
);
-// er_dec_acelp_fx.c
void con_acelp_fx(
const Word16 A[], /*mem_syn >rescaling done */
- ,
+ Word16 *Qf_mem_syn, /*mem_syn >rescaling done */
Word16 *pitch_buffer,
Word16 *voice_factors,
Word16 *bwe_exc );
-// dec_ace_fx.c
void decoder_acelp_fx(
Decoder_State *st,
Word16 prm[], /* i : parameters */
@@ -9104,7 +9230,6 @@ void decoder_acelp_fx(
Word16 *bwe_exc /* out: excitation for SWB TBE */
);
-// d_gain2p.c
void decode_acelp_gains_fx(
Word16 *code,
Word16 gains_mode,
@@ -9125,7 +9250,6 @@ void d_gain_pred_fx(
Word16 **pt_indice /* i/o: pointer to the buffer of indices */
);
-// evs_dec_fx.c
ivas_error evs_dec_fx(
Decoder_State *st_fx, /* i/o : Decoder state structure */
Word16 output_sp[], /* o : output synthesis signal */
@@ -9184,14 +9308,14 @@ void v_add_fx(
void v_shr_16(
const Word16 x[], /* i : Input vector */
const Word16 shift, /* i : Constant */
- Word16 y[], /* o : Output vector that contains x >> shift */
+ Word16 y[], /* o : Output vector that contains x >> shift */
const Word16 N /* i : Vector length */
);
void v_shr(
const Word32 x[], /* i : Input vector */
const Word16 shift, /* i : Constant */
- Word32 y[], /* o : Output vector that contains x >> shift */
+ Word32 y[], /* o : Output vector that contains x >> shift */
const Word16 N /* i : Vector length */
);
@@ -9202,42 +9326,38 @@ void cldfbAnalysis_ts_fx(
const Word16 samplesToProcess, /* i : samples to process */
HANDLE_CLDFB_FILTER_BANK h_cldfb,
Word16 *q_cldfb );
-Word16 floor_log_2( Word32 num );
+
+Word16 floor_log_2(
+ Word32 num );
void cldfbAnalysis_ts_fx_var_q(
- const Word32 *timeIn_fx,
- /* i : time buffer */ // q
- Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX],
- /* o : real value buffer */ // q_cldfb - 5
- Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX],
- /* o : imag value buffer */ // q_cldfb - 5
- const Word16 samplesToProcess, /* i : samples to process */
- HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */
+ const Word32 *timeIn_fx, /* i : time buffer q */
+ Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : real value buffer q_cldfb - 5 */
+ Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : imag value buffer q_cldfb - 5 */
+ const Word16 samplesToProcess, /* i : samples to process */
+ HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */
Word16 *q_cldfb );
void cldfbAnalysis_ts_fx_fixed_q(
- const Word32 *timeIn_fx,
- /* i : time buffer */ // q
- Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX],
- /* o : real value buffer */ // q - 5
- Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX],
- /* o : imag value buffer */ // q - 5
- const Word16 samplesToProcess, /* i : samples to process */
- HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */
+ const Word32 *timeIn_fx, /* i : time buffer q */
+ Word32 realBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : real value buffer q - 5 */
+ Word32 imagBuffer_fx[CLDFB_NO_CHANNELS_MAX], /* o : imag value buffer q - 5 */
+ const Word16 samplesToProcess, /* i : samples to process */
+ HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */
Word16 *q_cldfb );
void configureCldfb_ivas_fx(
HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i/o: filter bank handle */
const Word32 sampling_rate /* i : sampling rate */
);
-// dec4t64.c
+
void dec_acelp_fast_fx(
Decoder_State *st, /* i/o: decoder state structure */
const Word16 cdk_index, /* i : codebook index */
Word16 code[], /* o : algebraic (fixed) codebook excitation */
const Word16 L_subfr /* i : subframe length */
);
-// codec_tcx_common.c
+
void tcx5SpectrumInterleaving_fx(
const Word16 tcx5Size,
Word32 *spectrum );
@@ -9257,7 +9377,6 @@ void tcx5TnsUngrouping_fx(
Word32 *spectrum,
const Word16 enc_dec );
-// bass_psfilter.c
void bpf_pitch_coherence_ivas_fx(
Decoder_State *st, /* i/o: decoder state structure */
const Word32 pitch_buf[] /* i : pitch for each subframe [0,1,2,3] */
@@ -9282,8 +9401,8 @@ void cldfbSynthesis_ivas_fx(
Word32 **imagBuffer_fx, /* i : imag values Qx*/
Word32 *timeOut_fx, /* o : output time domain samples Qx - 1*/
const Word16 samplesToProcess, /* i : number of processed samples */
- const Word16 shift, /* i : scale for state buffer */
- const Word16 out_shift, /* i : scale for output buffer */
+ const Word16 shift, /* i : scale for state buffer */
+ const Word16 out_shift, /* i : scale for output buffer */
HANDLE_CLDFB_FILTER_BANK h_cldfb /* i : filter bank state */
);
@@ -9295,7 +9414,7 @@ void addBassPostFilter_ivas_fx(
Word32 **iAnalysis_fx,
HANDLE_CLDFB_FILTER_BANK cldfb );
-/* o : Q22*/
+/* o : Q22*/
Word32 ism_dequant_meta_fx(
const Word16 idx, /* i : quantizer index */
const Word32 borders_fx[], /* i : level borders Q22*/
@@ -9355,26 +9474,46 @@ void generate_masking_noise_dirac_ivas_fx(
const Word16 fd_cng_flag, /* i : FD-CNG flag for HB */
Word16 q_input,
Word16 *q_cldfb );
-// modif_fs/c
-void IMDCT_fx( Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_TDAC, Word16 *xn_buf, const Word16 *tcx_aldo_window_1, const PWord16 *tcx_aldo_window_1_trunc, const PWord16 *tcx_aldo_window_2, const PWord16 *tcx_mdct_window_half, const PWord16 *tcx_mdct_window_minimum, const PWord16 *tcx_mdct_window_trans, Word16 tcx_mdct_window_half_length, Word16 tcx_mdct_window_min_length, Word16 index, Word16 left_rect, Word16 tcx_offset, Word16 overlap, Word16 L_frame, Word16 L_frameTCX, Word16 L_spec_TCX5, Word16 L_frame_glob, Word16 frame_cnt, Word16 bfi, Word16 *old_out, Word16 *Q_old_wtda, Decoder_State *st, Word16 fullbandScale, Word16 *acelp_zir );
+void IMDCT_fx(
+ Word32 *x,
+ Word16 x_e,
+ Word16 *old_syn_overl,
+ Word16 *syn_Overl_TDAC,
+ Word16 *xn_buf,
+ const Word16 *tcx_aldo_window_1,
+ const PWord16 *tcx_aldo_window_1_trunc,
+ const PWord16 *tcx_aldo_window_2,
+ const PWord16 *tcx_mdct_window_half,
+ const PWord16 *tcx_mdct_window_minimum,
+ const PWord16 *tcx_mdct_window_trans,
+ Word16 tcx_mdct_window_half_length,
+ Word16 tcx_mdct_window_min_length,
+ Word16 index,
+ Word16 left_rect,
+ Word16 tcx_offset,
+ Word16 overlap,
+ Word16 L_frame,
+ Word16 L_frameTCX,
+ Word16 L_spec_TCX5,
+ Word16 L_frame_glob,
+ Word16 frame_cnt,
+ Word16 bfi,
+ Word16 *old_out,
+ Word16 *Q_old_wtda,
+ Decoder_State *st,
+ Word16 fullbandScale,
+ Word16 *acelp_zir );
void IMDCT_ivas_fx(
Word32 *x_fx,
Word16 q_x,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 *old_syn_overl_fx,
Word16 *Q_old_syn_overl_fx,
Word16 *syn_Overl_TDAC_fx,
Word16 *Q_syn_Overl_TDAC_fx,
-#else
- Word16 *old_syn_overl_fx,
- Word16 *syn_Overl_TDAC_fx,
-#endif
Word16 *xn_buf_fx,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 q_xn_buf_fx,
-#endif
const Word16 *tcx_aldo_window_1_fx,
const PWord16 *tcx_aldo_window_1_trunc_fx,
const PWord16 *tcx_aldo_window_2_fx,
@@ -9395,19 +9534,13 @@ void IMDCT_ivas_fx(
const Word16 frame_cnt,
const Word16 bfi,
Word16 *old_out_fx,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
Word16 *q_old_out_fx,
-#endif
const Word16 FB_flag,
Decoder_State *st,
const Word16 fullbandScale,
Word16 *acelp_zir_fx,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 *q_acelp_zir_fx,
Word16 *pq_win );
-#else
- Word16 q_win );
-#endif
void v_mult16_fixed(
const Word16 x1[], /* i : Input vector 1 */
@@ -9424,7 +9557,6 @@ void configureFdCngDec_fx(
const Word16 last_L_frame,
const Word16 element_mode );
-
Word32 sum2_f_16_fx(
const Word16 *vec, /* i : input vector */
const Word16 lvec /* i : length of input vector */
@@ -9445,8 +9577,8 @@ Word16 vq_dec_lvq_ivas_fx(
Word16 indices[], /* i : Indices */
Word16 stages, /* i : Number of stages */
Word16 N, /* i : Vector dimension */
- Word16 mode, /* (i): mode_lvq, or mode_lvq_p */
- Word16 no_bits /* (i): no. bits for lattice */
+ Word16 mode, /* (i): mode_lvq, or mode_lvq_p */
+ Word16 no_bits /* (i): no. bits for lattice */
);
Word16 deindex_lvq_ivas_fx(
@@ -9457,7 +9589,6 @@ Word16 deindex_lvq_ivas_fx(
Word16 no_bits /* i : number of bits for lattice */
);
-
void deleteCldfb_ivas_fx(
HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */
);
@@ -9475,7 +9606,7 @@ void stereo_dft_dec_open(
void ivas_bw_switching_pre_proc_fx(
Decoder_State *st, /* i/o: decoder state structure */
const Word32 last_element_brate, /* i : last element bitrate */
- const Word16 nchan_out /* i : number of output channels */,
+ const Word16 nchan_out, /* i : number of output channels */
Word32 *old_syn_12k8_16k_fx,
Word16 Q,
Word16 Q_audio );
@@ -9487,32 +9618,30 @@ UWord32 mvl2s_r(
const Word16 n /* i : vector size */
);
-void decoder_tcx_post_ivas_fx( Decoder_State *st_fx,
- Word16 *synth,
- Word16 *synthFB,
- Word16 Q_syn,
- Word16 *A,
- Word16 bfi,
- Word16 MCT_flag );
+void decoder_tcx_post_ivas_fx(
+ Decoder_State *st_fx,
+ Word16 *synth,
+ Word16 *synthFB,
+ Word16 Q_syn,
+ Word16 *A,
+ Word16 bfi,
+ Word16 MCT_flag );
void con_tcx_ivas_fx(
- Decoder_State *st, /* i/o: coder memory state */
- Word16 synth[],
- /* i/o: synth[] */ /*Q0 */
- const Word16 coh, /* i : coherence of stereo signal */
- Word16 *noise_seed, /* i/o: noise seed for stereo */
- const Word16 only_left, /* i : TD-PLC only in left channel */
- const Word16 *A_cng /* i : CNG LP filter coefficients */
+ Decoder_State *st, /* i/o: coder memory state */
+ Word16 synth[], /* i/o: synth[] Q0 */
+ const Word16 coh, /* i : coherence of stereo signal */
+ Word16 *noise_seed, /* i/o: noise seed for stereo */
+ const Word16 only_left, /* i : TD-PLC only in left channel */
+ const Word16 *A_cng /* i : CNG LP filter coefficients */
);
void ivas_mdct_core_reconstruct_fx(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
- Word32 *x_fx[][NB_DIV],
- /* i/o: synthesis @internal_FS */ // Q(q_x)
- Word16 signal_outFB_fx[CPE_CHANNELS][L_FRAME_PLUS],
- /* o : synthesis @output_FS */ // e_sig
- Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */
- const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ Word32 *x_fx[][NB_DIV], /* i/o: synthesis @internal_FS Q(q_x) */
+ Word16 signal_outFB_fx[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS e_sig */
+ Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */
+ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
Word16 q_x,
Word16 e_sig[CPE_CHANNELS] );
@@ -9541,42 +9670,48 @@ Word16 RCcontextMapping_encode2_estimate_no_mem_s17_LCS_fx(
CONTEXT_HM_CONFIG *hm_cfg /* context-based harmonic model configuration */
);
-Word16 usdequant_fx( /* Qx*/
- const Word16 idx, /* i: quantizer index Q0*/
- const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
- const Word16 delta /* i: quantization step Qy*/
+/* Qx*/
+Word16 usdequant_fx(
+ const Word16 idx, /* i: quantizer index Q0*/
+ const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
+ const Word16 delta /* i: quantization step Qy*/
);
-Word32 usdequant32_fx( /* Qx*/
- const Word16 idx, /* i: quantizer index Q0*/
- const Word32 qlow, /* i: lowest codebook entry (index 0) Qx*/
- const Word32 delta /* i: quantization step Qy*/
+/* Qx*/
+Word32 usdequant32_fx(
+ const Word16 idx, /* i: quantizer index Q0*/
+ const Word32 qlow, /* i: lowest codebook entry (index 0) Qx*/
+ const Word32 delta /* i: quantization step Qy*/
);
-Word16 usquant_fx( /* o: index of the winning codeword */
- const Word16 x, /* i: scalar value to quantize Qx*/
- Word16 *xq, /* o: quantized value Qx*/
- const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
- const Word16 delta, /* i: quantization step Qx-1*/
- const Word16 cbsize /* i: codebook size */
+/* o: index of the winning codeword */
+Word16 usquant_fx(
+ const Word16 x, /* i: scalar value to quantize Qx*/
+ Word16 *xq, /* o: quantized value Qx*/
+ const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
+ const Word16 delta, /* i: quantization step Qx-1*/
+ const Word16 cbsize /* i: codebook size */
);
-Word32 Dot_product( /* o : Sum */
- const Word16 x[], /* i : 12bits: x vector */
- const Word16 y[], /* i : 12bits: y vector */
- const Word16 lg /* i : vector length */
+/* o : Sum */
+Word32 Dot_product(
+ const Word16 x[], /* i : 12bits: x vector */
+ const Word16 y[], /* i : 12bits: y vector */
+ const Word16 lg /* i : vector length */
);
-Word32 dotp_fx( /* o : dot product of x[] and y[] */
- const Word16 x[], /* i : vector x[] */
- const Word16 y[], /* i : vector y[] */
- const Word16 n, /* i : vector length */
- Word16 *exp /* (o) : exponent of result (0..+30) */
+/* o : dot product of x[] and y[] */
+Word32 dotp_fx(
+ const Word16 x[], /* i : vector x[] */
+ const Word16 y[], /* i : vector y[] */
+ const Word16 n, /* i : vector length */
+ Word16 *exp /* (o) : exponent of result (0..+30) */
);
-Word32 sum2_fx_mod( /* o : sum of all squared vector elements Q(2x+1)*/
- const Word16 *vec, /* i : i vector Qx*/
- const Word16 lvec /* i : length of i vector */
+/* o : sum of all squared vector elements Q(2x+1)*/
+Word32 sum2_fx_mod(
+ const Word16 *vec, /* i : i vector Qx*/
+ const Word16 lvec /* i : length of i vector */
);
void Copy_Scale_sig(
@@ -9599,6 +9734,15 @@ void Copy_Scale_sig_16_32_DEPREC(
const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
);
+#ifdef FIX_CREND_SIMPLIFY_CODE
+void Copy_Scale_sig_16_32_r(
+ const Word16 x[], /* i : signal to scale input Qx */
+ Word32 y[], /* o : scaled signal output Qx */
+ const Word16 lg, /* i : size of x[] Q0 */
+ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
+);
+#endif
+
void Copy_Scale_sig_16_32_no_sat(
const Word16 x[], /* i : signal to scale input Qx */
Word32 y[], /* o : scaled signal output Qx */
@@ -9620,19 +9764,23 @@ void Random_Fill(
Word16 scaling /* i : scaling of values */
);
-Word16 mean_fx( /* o : mean of vector */
- const Word16 *vec_fx, /* i : i vector */
- const Word16 lvec_fx /* i : length of i vector */
+/* o : mean of vector */
+Word16 mean_fx(
+ const Word16 *vec_fx, /* i : i vector */
+ const Word16 lvec_fx /* i : length of i vector */
);
-Word16 mean_no_sat_fx( /* o : mean of vector Qx */
- const Word16 *vec_fx, /* i : input vector Qx */
- const Word16 lvec_fx /* i : length of input vector */
+/* o : mean of vector Qx */
+Word16 mean_no_sat_fx(
+ const Word16 *vec_fx, /* i : input vector Qx */
+ const Word16 lvec_fx /* i : length of input vector */
);
-Word32 mean_no_sat_Word32_fx( /* o : mean of vector Qx */
- const Word32 *vec_fx, /* i : input vector Qx */
- const Word16 lvec_fx, /* i : length of input vector */
- const Word16 gb );
+
+/* o : mean of vector Qx */
+Word32 mean_no_sat_Word32_fx(
+ const Word32 *vec_fx, /* i : input vector Qx */
+ const Word16 lvec_fx, /* i : length of input vector */
+ const Word16 gb );
void sort(
UWord16 *x, /* i/o: Vector to be sorted */
UWord16 len /* i/o: vector length */
@@ -9650,52 +9798,60 @@ void sort_32_fx(
const Word16 up /* I : High limit of sorting range */
);
-Word16 minimum_fx( /* o : index of the minimum value in the input vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word16 *min_fx /* o : minimum value in the input vector */
+/* o : index of the minimum value in the input vector */
+Word16 minimum_fx(
+ const Word16 *vec_fx, /* i : input vector */
+ const Word16 lvec_fx, /* i : length of input vector */
+ Word16 *min_fx /* o : minimum value in the input vector */
);
-Word16 maximum_fx( /* o : index of the maximum value in the input vector */
- 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 */
+/* o : index of the maximum value in the input vector */
+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 */
);
-Word16 maximum_exp_fx( /* o : index of the maximum value in the input vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 *exp_vec, /* i : exponents of input vector */
- const Word16 lvec_fx /* i : length of input vector */
+/* o : index of the maximum value in the input vector */
+Word16 maximum_exp_fx(
+ const Word16 *vec_fx, /* i : input vector */
+ const Word16 *exp_vec, /* i : exponents of input vector */
+ const Word16 lvec_fx /* i : length of input vector */
);
-Word16 maximum_abs_16_fx( /* o : index of the maximum abs value in the input vector */
- const Word16 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word16 *max_val /* o : maximum value in the input vector */
+/* o : index of the maximum abs value in the input vector */
+Word16 maximum_abs_16_fx(
+ const Word16 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 *max_val /* o : maximum value in the input vector */
);
-Word16 minimum_abs32_fx( /* o : index of the minimum value in the input vector */
- const Word32 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word32 *min_fx /* o : minimum value in the input vector */
+/* o : index of the minimum value in the input vector */
+Word16 minimum_abs32_fx(
+ const Word32 *vec_fx, /* i : input vector */
+ const Word16 lvec_fx, /* i : length of input vector */
+ Word32 *min_fx /* o : minimum value in the input vector */
);
-Word16 minimum_32_fx( /* o : index of the minimum value in the input vector */
- const Word32 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word32 *min_fx /* o : minimum value in the input vector */
+/* o : index of the minimum value in the input vector */
+Word16 minimum_32_fx(
+ const Word32 *vec_fx, /* i : input vector */
+ const Word16 lvec_fx, /* i : length of input vector */
+ Word32 *min_fx /* o : minimum value in the input vector */
);
-Word16 maximum_32_fx( /* o : index of the maximum value in the input vector */
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word32 *max_val /* o : maximum value in the input vector */
+/* o : index of the maximum value in the input vector */
+Word16 maximum_32_fx(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word32 *max_val /* o : maximum value in the input vector */
);
-Word16 maximum_abs_32_fx( /* o : index of the maximum value in the input vector */
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word32 *max_val /* o : maximum value in the input vector */
+/* o : index of the maximum value in the input vector */
+Word16 maximum_abs_32_fx(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word32 *max_val /* o : maximum value in the input vector */
);
/*! r: index of the maximum value in the input vector */
@@ -9722,41 +9878,50 @@ Word16 Exp32Array(
const Word32 *sx /* (i): Data array */
);
-Word32 sum16_32_fx( /* o : sum of all vector elements Qx*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+/* o : sum of all vector elements Qx*/
+Word32 sum16_32_fx(
+ const Word16 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
);
-Word32 sum32_sat( /* o : sum of all vector elements Qx*/
- const Word32 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+/* o : sum of all vector elements Qx*/
+Word32 sum32_sat(
+ const Word32 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
);
-Word32 var_fx_32( /* o: variance of vector Qx+16*/
- const Word16 *x, /* i: input vector Qx*/
- const Word16 Qx,
- const Word16 len /* i: length of inputvector */
+/* o: variance of vector Qx+16*/
+Word32 var_fx_32(
+ const Word16 *x, /* i: input vector Qx*/
+ const Word16 Qx,
+ const Word16 len /* i: length of inputvector */
);
-Word32 var_fx_32in_32out( /* o: variance of vector Qx+16*/
- const Word32 *x, /* i: input vector Qx*/
- Word16 *Qx,
- const Word16 len, /* i: length of inputvector */
- const Word16 gb );
-Word16 var_fx( /* o: variance of vector Qx*/
- const Word16 *x, /* i: input vector Qx*/
- const Word16 Qx,
- const Word16 len /* i: length of inputvector */
+
+/* o: variance of vector Qx+16*/
+Word32 var_fx_32in_32out(
+ const Word32 *x, /* i: input vector Qx*/
+ Word16 *Qx,
+ const Word16 len, /* i: length of inputvector */
+ const Word16 gb );
+
+/* o: variance of vector Qx*/
+Word16 var_fx(
+ const Word16 *x, /* i: input vector Qx*/
+ const Word16 Qx,
+ const Word16 len /* i: length of inputvector */
);
-Word16 std_fx( /* o: standard deviation */
- const Word16 x[], /* i: input vector */
- const Word16 len /* i: length of the input vector */
+/* o: variance of vector Qx*/
+Word16 std_fx(
+ const Word16 x[], /* i: input vector */
+ const Word16 len /* i: length of the input vector */
);
-Word32 dot_product_mat_fx( /* o : the dot product x'*A*x */
- const Word16 *x, /* i : vector x Q15 */
- const Word32 *A, /* i : matrix A Q0*/
- const Word16 m /* i : vector & matrix size */
+/* o : the dot product x'*A*x */
+Word32 dot_product_mat_fx(
+ const Word16 *x, /* i : vector x Q15 */
+ const Word32 *A, /* i : matrix A Q0*/
+ const Word16 m /* i : vector & matrix size */
);
@@ -9767,22 +9932,24 @@ void Vr_subt(
Word16 N /* i : Vector lenght */
);
-Word16 vquant_ivas_fx( /* o: index of the winning codevector */
- Word32 x[], /* i: vector to quantize Q25 */
- const Word32 x_mean[], /* i: vector mean to subtract (0 if none) Q25 */
- Word32 xq[], /* o: quantized vector Q25 */
- const Word32 cb[], /* i: codebook Q25 */
- const Word16 dim, /* i: dimension of codebook vectors */
- const Word16 cbsize /* i: codebook size */
+/* o: index of the winning codevector */
+Word16 vquant_ivas_fx(
+ Word32 x[], /* i: vector to quantize Q25 */
+ const Word32 x_mean[], /* i: vector mean to subtract (0 if none) Q25 */
+ Word32 xq[], /* o: quantized vector Q25 */
+ const Word32 cb[], /* i: codebook Q25 */
+ const Word16 dim, /* i: dimension of codebook vectors */
+ const Word16 cbsize /* i: codebook size */
);
-Word16 vquant_fx( /* o: index of the winning codevector */
- Word16 x[], /* i: vector to quantize Q13 */
- const Word16 x_mean[], /* i: vector mean to subtract (0 if none)Q13*/
- Word16 xq[], /* o: quantized vector Q13 */
- const Word16 cb[], /* i: codebook Q13 */
- const Word16 dim, /* i: dimension of codebook vectors */
- const Word16 cbsize /* i: codebook size */
+/* o: index of the winning codevector */
+Word16 vquant_fx(
+ Word16 x[], /* i: vector to quantize Q13 */
+ const Word16 x_mean[], /* i: vector mean to subtract (0 if none)Q13*/
+ Word16 xq[], /* o: quantized vector Q13 */
+ const Word16 cb[], /* i: codebook Q13 */
+ const Word16 dim, /* i: dimension of codebook vectors */
+ const Word16 cbsize /* i: codebook size */
);
Word16 w_vquant_fx(
@@ -9795,36 +9962,42 @@ Word16 w_vquant_fx(
const Word16 rev_vect /* i: reverse codebook vectors */
);
-Word16 emaximum_fx( /* o : return index with max energy value in vector Q0 */
- const Word16 Qvec, /* i : Q of input vector Q0 */
- const Word16 *vec, /* i : input vector Qx */
- const Word16 lvec, /* i : length of input vector Q0 */
- Word32 *ener_max /* o : maximum energy value Q0 */
+/* o : return index with max energy value in vector Q0 */
+Word16 emaximum_fx(
+ const Word16 Qvec, /* i : Q of input vector Q0 */
+ const Word16 *vec, /* i : input vector Qx */
+ const Word16 lvec, /* i : length of input vector Q0 */
+ Word32 *ener_max /* o : maximum energy value Q0 */
);
-Word16 emaximum_32fx( /* o : return index with max energy value in vector Q0 */
- const Word16 Qvec, /* i : Q of input vector Q0 */
- const Word32 *vec, /* i : input vector Qx */
- const Word16 lvec, /* i : length of input vector Q0 */
- Word32 *ener_max /* o : maximum energy value Q0 */
+/* o : return index with max energy value in vector Q0 */
+Word16 emaximum_32fx(
+ const Word16 Qvec, /* i : Q of input vector Q0 */
+ const Word32 *vec, /* i : input vector Qx */
+ const Word16 lvec, /* i : length of input vector Q0 */
+ Word32 *ener_max /* o : maximum energy value Q0 */
);
-Word32 Mean32( /* o : mean of the elements of the vector */
- const Word32 in[], /* i : input vector */
- const Word16 L /* i : length of input vector */
+/* o : mean of the elements of the vector */
+Word32 Mean32(
+ const Word32 in[], /* i : input vector */
+ const Word16 L /* i : length of input vector */
);
-Word32 sum32_fx( /* o : sum of all vector elements Qx*/
- const Word32 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+/* o : sum of all vector elements Qx*/
+Word32 sum32_fx(
+ const Word32 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
);
-Word16 sum16_fx( /* o : sum of all vector elements Qx*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+/* o : sum of all vector elements Qx*/
+Word16 sum16_fx(
+ const Word16 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
);
-Word16 own_random2_fx( Word16 seed );
+Word16 own_random2_fx(
+ Word16 seed );
void iDiv_and_mod_32(
const Word32 Numer, /* i : 32 bits numerator */
@@ -9864,16 +10037,17 @@ Word32 root_a_over_b_ivas_fx(
Word16 Q_b,
Word16 *exp_out );
-void fir_fx( const Word16 x[], /* i : input vector Qx*/
- const Word16 h[], /* i : impulse response of the FIR filter Q12*/
- Word16 y[], /* o : output vector (result of filtering) Qx*/
- Word16 mem[], /* i/o: memory of the input signal (L samples) Qx*/
- const Word16 L, /* i : input vector size */
- const Word16 K, /* i : order of the FIR filter (K+1 coefs.) */
- const Word16 upd /* i : 1 = update the memory, 0 = not */
- ,
- Word16 shift /* i : difference between Q15 and scaling of h[] */
+void fir_fx(
+ const Word16 x[], /* i : input vector Qx*/
+ const Word16 h[], /* i : impulse response of the FIR filter Q12*/
+ Word16 y[], /* o : output vector (result of filtering) Qx*/
+ Word16 mem[], /* i/o: memory of the input signal (L samples) Qx*/
+ const Word16 L, /* i : input vector size */
+ const Word16 K, /* i : order of the FIR filter (K+1 coefs.) */
+ const Word16 upd, /* i : 1 = update the memory, 0 = not */
+ Word16 shift /* i : difference between Q15 and scaling of h[] */
);
+
void v_add_32(
const Word32 x1[], /* i : Input vector 1 */
const Word32 x2[], /* i : Input vector 2 */
@@ -9895,7 +10069,6 @@ void v_sub_32(
const Word16 N /* i : Vector length */
);
-
void v_add_16(
const Word16 x1[], /* i : Input vector 1 */
const Word16 x2[], /* i : Input vector 2 */
@@ -9910,12 +10083,12 @@ void v_sub_16(
const Word16 N /* i : Vector length */
);
-
-Word16 squant_fx( /* o: index of the winning codeword */
- const Word16 x, /* i: scalar value to quantize */
- Word16 *xq, /* o: quantized value */
- const Word16 cb[], /* i: codebook */
- const Word16 cbsize /* i: codebook size */
+/* o: index of the winning codeword */
+Word16 squant_fx(
+ const Word16 x, /* i: scalar value to quantize */
+ Word16 *xq, /* o: quantized value */
+ const Word16 cb[], /* i: codebook */
+ const Word16 cbsize /* i: codebook size */
);
Word16 squant_int_fx(
@@ -9987,60 +10160,84 @@ void add_vec_fx(
const Word16 N /* i : Vector lenght */
);
-Word32 Add_flt32_flt32( /* o: Result (Normalized) */
- Word32 a, /* i: 1st Value */
- Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
- Word32 b, /* i: 2nd Value */
- Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
- Word16 *exp_out /* o: Exponent of Result */
+/* o: Result (Normalized) */
+Word32 Add_flt32_flt32(
+ Word32 a, /* i: 1st Value */
+ Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
+ Word32 b, /* i: 2nd Value */
+ Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
+ Word16 *exp_out /* o: Exponent of Result */
);
-Word32 Mul_flt32_Q15( /* o: Result (Normalized) */
- Word32 value, /* i: Pseudo_float Value */
- Word16 *exp_v, /*i/o: Exponent of Value (Q of Value) */
- Word16 frac /* i: Q15 value */
+/* o: Result (Normalized) */
+Word32 Mul_flt32_Q15(
+ Word32 value, /* i: Pseudo_float Value */
+ Word16 *exp_v, /*i/o: Exponent of Value (Q of Value) */
+ Word16 frac /* i: Q15 value */
);
-Word32 Div_flt32_flt32( /* o: Result (Normalized) */
- Word32 a, /* i: 1st Value */
- Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
- Word32 b, /* i: 2nd Value */
- Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
- Word16 *exp_out /* o: Exponent of Result */
+/* o: Result (Normalized) */
+Word32 Div_flt32_flt32(
+ Word32 a, /* i: 1st Value */
+ Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
+ Word32 b, /* i: 2nd Value */
+ Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
+ Word16 *exp_out /* o: Exponent of Result */
);
-Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) */
- const Word16 *signal, /* i: Signal */
- Word16 signal_exp, /* i: Exponent of Signal (Q of Signal) */
- Word16 len, /* i: Frame Length */
- Word16 *energy_exp /* o: Exponent of Energy (Q of Energy) */
+/* o: Result (Normalized) */
+Word32 Calc_Energy_Autoscaled(
+ const Word16 *signal, /* i: Signal */
+ Word16 signal_exp, /* i: Exponent of Signal (Q of Signal) */
+ Word16 len, /* i: Frame Length */
+ Word16 *energy_exp /* o: Exponent of Energy (Q of Energy) */
);
-Word16 Find_Max_Norm16( const Word16 *src, Word16 len );
+Word16 Find_Max_Norm16(
+ const Word16 *src,
+ Word16 len );
-Word16 Find_Max_Norm32( const Word32 *src, Word16 len );
+Word16 Find_Max_Norm32(
+ const Word32 *src,
+ Word16 len );
-Word32 Sqrt_Ratio32( /* o: Result in Q31 */
- Word32 L_val1, /* i: Mantisa of Val1 */
- Word16 exp1, /* i: Exp of Val1 (>0: Val was Left Shifted, <0:Right Shifted) */
- Word32 L_val2, /* i: Mantisa of Val2 */
- Word16 exp2, /* i: Exp of Val2 (same as exp1) */
- Word16 *exp /* o: Exp of Result (# of 'L_shl' Req to get to Final Value) */
+/* o: Result in Q31 */
+Word32 Sqrt_Ratio32(
+ Word32 L_val1, /* i: Mantisa of Val1 */
+ Word16 exp1, /* i: Exp of Val1 (>0: Val was Left Shifted, <0:Right Shifted) */
+ Word32 L_val2, /* i: Mantisa of Val2 */
+ Word16 exp2, /* i: Exp of Val2 (same as exp1) */
+ Word16 *exp /* o: Exp of Result (# of 'L_shl' Req to get to Final Value) */
);
-Word16 Invert16( /* result in Q'15 + 'exp' */
- Word16 val,
- Word16 *exp );
+/* result in Q'15 + 'exp' */
+Word16 Invert16(
+ Word16 val,
+ Word16 *exp );
-Word16 find_rem( Word16 n, Word16 m, Word16 *r );
+Word16 find_rem(
+ Word16 n,
+ Word16 m,
+ Word16 *r );
-Word32 find_remd( Word32 n, Word32 m, Word32 *r );
+Word32 find_remd(
+ Word32 n,
+ Word32 m,
+ Word32 *r );
Word16 rint_new_fx(
Word32 x /*Q16 */
);
-Word16 erb_diff_search_fx( Word16 *prev_erb, const Word16 *curr_erb, Word16 *dif_erb, Word16 *pow_spec, const Word16 *cb_fx, Word16 cb_size, Word16 cb_dim, Word16 offset );
+Word16 erb_diff_search_fx(
+ Word16 *prev_erb,
+ const Word16 *curr_erb,
+ Word16 *dif_erb,
+ Word16 *pow_spec,
+ const Word16 *cb_fx,
+ Word16 cb_size,
+ Word16 cb_dim,
+ Word16 offset );
void Acelp_dec_total_exc(
Word16 *exc_fx, /* i/o: adapt. excitation exc */
@@ -10052,11 +10249,18 @@ void Acelp_dec_total_exc(
const Word16 L_subfr /* i : Subframne lenght */
);
-UWord32 UL_inverse( const UWord32 UL_val, Word16 *exp );
+UWord32 UL_inverse(
+ const UWord32 UL_val,
+ Word16 *exp );
-UWord32 UL_div( const UWord32 UL_num, const UWord32 UL_den );
+UWord32 UL_div(
+ const UWord32 UL_num,
+ const UWord32 UL_den );
-Word16 ratio( const Word32 numer, const Word32 denom, Word16 *expo );
+Word16 ratio(
+ const Word32 numer,
+ const Word32 denom,
+ Word16 *expo );
void hp400_12k8_fx(
Word16 signal[], /* i/o: input signal / output is divided by 16 */
@@ -10070,9 +10274,19 @@ void hp400_12k8_ivas_fx(
Word16 mem[] /* i/o: filter memory [6] */
);
-Word16 dot_prod_satcontr( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy, Word16 *qo, Word16 len );
+Word16 dot_prod_satcontr(
+ const Word16 *x,
+ const Word16 *y,
+ Word16 qx,
+ Word16 qy,
+ Word16 *qo,
+ Word16 len );
-void E_UTIL_f_convolve( const Word16 x[], const Word16 h[], Word16 y[], const Word16 size );
+void E_UTIL_f_convolve(
+ const Word16 x[],
+ const Word16 h[],
+ Word16 y[],
+ const Word16 size );
void floating_point_add(
Word32 *mx, /* io: mantissa of the addend Q31 */
@@ -10113,7 +10327,8 @@ Word16 lin_interp_fx(
const Word16 flag_sat /* i : flag to indicate whether to apply saturation */
);
-Word16 ceil_log_2( UWord64 val );
+Word16 ceil_log_2(
+ UWord64 val );
Word32 imax_pos_fx(
const Word32 *y /* i : Input vector for peak interpolation Qx*/
@@ -10235,17 +10450,14 @@ ivas_error acelp_core_dec_fx(
Word16 *unbits, /* o : number of unused bits */
Word16 *sid_bw, /* o : 0-NB/WB, 1-SWB SID */
STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- const Word16 tdm_lspQ_PCh_fx[M], /* i : Q LSPs for primary channel */
-#endif
- const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */
- const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
- const Word16 last_element_mode, /* i : last element mode */
- const Word32 last_element_brate, /* i : last element bitrate */
- const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */
- const Word16 nchan_out, /* i : number of output channels */
- STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */
- const Word16 read_sid_info /* i : read SID info flag */
+ const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */
+ const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
+ const Word16 last_element_mode, /* i : last element mode */
+ const Word32 last_element_brate, /* i : last element bitrate */
+ const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */
+ const Word16 nchan_out, /* i : number of output channels */
+ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */
+ const Word16 read_sid_info /* i : read SID info flag */
);
void destroy_cldfb_decoder_ivas_fx(
@@ -10278,6 +10490,14 @@ void hp20_fx_32(
Word32 mem_fx[],
const Word32 Fs );
+#ifdef HP20_FIX32_RECODING
+void hp20_fx_32_opt(
+ Word32 signal_fx[],
+ const Word16 lg,
+ Word32 mem_fx[],
+ const Word32 Fs );
+#endif
+
void getTCXMode_ivas_fx(
Decoder_State *st, /* i/o: decoder memory state */
Decoder_State *st0, /* i : bitstream */
@@ -10364,9 +10584,6 @@ Word16 sr2fscale(
const Word32 sr_core /* i : internal sampling rate */
);
-// pre_proc functions
-/*full implementation pending*/
-
void Copy_Scale_sig32(
const Word32 x[], /* i : signal to scale input Qx */
Word32 y[], /* o : scaled signal output Qx */
@@ -10395,11 +10612,11 @@ void updt_enc_common_ivas_fx(
const Word16 Q_new /* i : CUrrent frame scaling */
);
-// tools.c
-Word32 sum2_f_32_fx( /* o : Q(2x - 31 - gb) */
- const Word32 *vec, /* i : input vector, Qx */
- const Word16 lvec, /* i : length of input vector */
- Word16 gb /* i : guard bits */
+/* o : Q(2x - 31 - gb) */
+Word32 sum2_f_32_fx(
+ const Word32 *vec, /* i : input vector, Qx */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 gb /* i : guard bits */
);
Word32 sum2_16_exp_fx(
@@ -10420,6 +10637,7 @@ Word32 sum2_32_fx(
const Word32 *vec, /* i : input vector */
const Word16 lvec, /* i : length of input vector */
Word16 *e );
+
void ProcessStereoIGF_fx(
STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct,
Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */
@@ -10437,7 +10655,7 @@ void ProcessStereoIGF_fx(
const Word16 sp_aud_decision0, /* i : sp_aud_decision0 */
const Word32 element_brate, /* i : element bitrate */
const Word16 mct_on );
-/*igf_enc.c*/
+
void IGFEncApplyStereo_fx(
STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo encoder structure */
Word16 ms_mask[2][MAX_SFB], /* i : bandwise MS mask */
@@ -10460,6 +10678,7 @@ void IGFSaveSpectrumForITF_ivas_fx(
const Word16 igfGridIdx, /* i : IGF grid index */
const Word32 *pITFSpectrum, /* i : MDCT spectrum */
Word16 exp_pITFSpectrum );
+
Word16 IGFEncWriteBitstream_ivas_fx(
const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
@@ -10467,7 +10686,7 @@ Word16 IGFEncWriteBitstream_ivas_fx(
const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
const Word16 isIndepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */
);
-/*igf_scf_enc.c*/
+
Word16 IGFSCFEncoderEncode_ivas_fx(
IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data or NULL in case there was no instance created */
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
@@ -10476,7 +10695,7 @@ Word16 IGFSCFEncoderEncode_ivas_fx(
const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
const Word16 indepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */
);
-/*ari_enc.c*/
+
Word16 ari_encode_14bits_ext_ivas_fx(
Word16 *ptr, /* Q0 */
Word16 bp, /* Q0 */
@@ -10484,6 +10703,7 @@ Word16 ari_encode_14bits_ext_ivas_fx(
Word32 symbol, /* Q0 */
UWord16 const *cum_freq /* Q0 */
);
+
Word16 ari_encode_14bits_sign_ivas_fx(
Word16 *ptr, /* Q0 */
Word16 bp, /* Q0 */
@@ -10491,22 +10711,18 @@ Word16 ari_encode_14bits_sign_ivas_fx(
Tastat *s,
Word16 sign /* Q0 */
);
+
Word16 ari_done_encoding_14bits_ivas_fx(
Word16 *ptr, /* Q0 */
Word16 bp, /* Q0 */
Tastat *s );
-void pack_bit(
- const Word16 bit, /* i: bit to be packed */
- UWord8 **pt, /* i/o: pointer to octet array into which bit will be placed */
- UWord8 *omask /* i/o: output mask to indicate where in the octet the bit is to be written */
-);
+
void IGFEncConcatenateBitstream(
const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
const Word16 bsBits, /* i : number of IGF bits written to list of indices */
BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */
);
-
void hq_generic_hf_encoding_fx(
const Word32 *coefs_fx, /* i : MDCT coefficients of weighted original */
Word16 *hq_generic_fenv_fx, /* i/o: energy of SWB envelope */
@@ -10514,6 +10730,7 @@ void hq_generic_hf_encoding_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
Word16 *hq_generic_exc_clas, /* o : bwe excitation class */
Word16 length );
+
Word16 ari_decode_14bits_pow_ivas(
Word16 *ptr,
Word16 bp,
@@ -10571,12 +10788,9 @@ ivas_error config_acelp1_fx(
const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */
const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */
const Word16 idchan, /* i : stereo channel ID */
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- const Word16 active_cnt, /* i : Active frame counter */
-#endif
- const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/
- const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
- const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/
+ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
+ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
);
#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
@@ -10639,13 +10853,13 @@ void writeTCXparam_fx(
void calculate_hangover_attenuation_gain_ivas_fx(
Encoder_State *st, /* i : encoder state structure */
Word16 *att, /* o : attenuation factor */
- const Word16 vad_hover_flag /* i : VAD hangover flag */
+ const Word16 vad_hover_flag /* i : VAD hangover flag */
);
void init_coder_ace_plus_ivas_fx(
Encoder_State *st, /* i : Encoder state */
const Word32 last_total_brate, /* i : last total bitrate */
- const Word32 igf_brate, /* i : IGF configuration bitrate */
+ const Word32 igf_brate, /* i : IGF configuration bitrate */
const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */
);
@@ -10672,7 +10886,6 @@ Word16 getTcxonly_ivas_fx(
const Word16 is_ism_format /* i : flag indicating ISM format */
);
-
void SetModeIndex_ivas_fx(
Encoder_State *st, /* i : Encoder state */
const Word32 last_total_brate, /* i : last total bitrate Q0*/
@@ -10753,7 +10966,7 @@ void FEC_encode_ivas_fx(
Word16 *last_pulse_pos, /* i/o: Position of the last pulse Q0*/
const Word16 L_frame, /* i : Frame length Q0*/
const Word32 total_brate, /* i : total codec bitrate Q0*/
- const Word16 Q_synth /* i : input scaling */
+ const Word16 Q_synth /* i : input scaling */
);
ivas_error IGF_Reconfig_fx(
@@ -10778,7 +10991,6 @@ void core_switching_post_enc_ivas_fx(
Word16 A_fx[], /* i : unquant. LP filter coefs. */
Word16 Q_new );
-
void residu_ivas_fx(
const Word16 *a, /* i : LP filter coefficients Q31-a_exp*/
const Word16 a_exp,
@@ -10846,10 +11058,12 @@ void set_zero_fx(
Word32 *vec, /* o : input vector */
const Word16 lvec /* i : length of the vector */
);
+
void set_zero2_fx(
Word32 *vec, /* o : input vector */
const Word32 lvec /* i : length of the vector */
);
+
void set16_zero_fx(
Word16 *vec, /* o : input vector */
const Word16 lvec /* i : length of the vector */
@@ -10908,7 +11122,6 @@ void sort_l(
Word16 len /* i/o: vector length */
);
-
ivas_error push_indice(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
Word16 id, /* i : ID of the indice */
@@ -10981,18 +11194,7 @@ UWord16 delete_indice(
);
/*! r: value of the indice */
-UWord16 get_next_indice(
- Decoder_State *st, /* i/o: decoder state structure */
- Word16 nb_bits /* i : number of bits that were used to quantize the indice */
-);
-
-void get_next_indice_tmp(
- Decoder_State *st, /* o : decoder state structure */
- Word16 nb_bits /* i : number of bits that were used to quantize the indice */
-);
-
-/*! r: value of the indice */
-UWord16 get_indice(
+UWord16 get_indice_fx(
Decoder_State *st, /* i/o: decoder state structure */
Word16 pos, /* i : absolute position in the bitstream */
Word16 nb_bits /* i : number of bits that were used to quantize the indice */
@@ -11002,12 +11204,11 @@ void reset_indices_dec(
Decoder_State *st /* i/o: decoder state structure */
);
-Word16 rate2EVSmode_float(
+Word16 rate2EVSmode(
const Word32 brate, /* i : bitrate */
Word16 *is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
);
-
/*! r: 1 = OK, 0 = something wrong */
ivas_error read_indices_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
@@ -11018,7 +11219,6 @@ ivas_error read_indices_fx(
Word16 bfi /* i : bad frame indicator */
);
-
void ivas_set_bitstream_pointers(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
@@ -11034,12 +11234,6 @@ void mdct_switching_dec_fx(
Word16 print_disclaimer(
FILE *fPtr );
-void fft_rel(
- float x[], /* i/o: input/output vector */
- const Word16 n, /* i : vector length */
- const Word16 m /* i : log2 of vector length */
-);
-
void preemph_ivas_fx(
Word32 *signal, /* i/o: signal Qx*/
const Word16 mu, /* i : preemphasis factor Q15*/
@@ -11121,10 +11315,11 @@ void flip_and_downmix_generic_fx32(
Word16 *phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */
);
-Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */
- const Word16 pos1, /* i: position of the pulse 1 */
- const Word16 pos2, /* i: position of the pulse 2 */
- const Word16 N /* i: number of bits FOR position */
+/* o : Q(2x - 31 - gb) */
+Word16 quant_2p_2N1_fx(
+ const Word16 pos1, /* i: position of the pulse 1 */
+ const Word16 pos2, /* i: position of the pulse 2 */
+ const Word16 N /* i: number of bits FOR position */
);
void bands_and_bit_alloc_ivas_fx(
@@ -11150,24 +11345,17 @@ void bands_and_bit_alloc_ivas_fx(
);
void ivas_find_wsp_fx(
- const Word16 L_frame, /* i : length of the frame Q0*/
- const Word16 L_subfr, /* i : length of subframe Q0*/
- const Word16 nb_subfr, /* i : number of subframes Q0*/
- const Word16 *A_fx,
- /* i : A(z) filter coefficients */ // Q12
- Word16 *Aw_fx,
- /* o : weighted A(z) filter coefficients */ // Q12
- const Word16 *speech_fx,
- /* i : pointer to the denoised speech frame */ // Q_new
- const Word16 tilt_fact,
- /* i : tilt factor */ // Q15
- Word16 *wsp_fx,
- /* o : poitnter to the weighted speech frame */ // Q_new
- Word16 *mem_wsp_fx,
- /* i/o: W(Z) denominator memory */ // Q_new
- const Word16 gamma,
- /* i : weighting factor */ // Q15
- const Word16 L_look /* i : look-ahead Q0*/
+ const Word16 L_frame, /* i : length of the frame Q0*/
+ const Word16 L_subfr, /* i : length of subframe Q0*/
+ const Word16 nb_subfr, /* i : number of subframes Q0*/
+ const Word16 *A_fx, /* i : A(z) filter coefficients Q12 */
+ Word16 *Aw_fx, /* o : weighted A(z) filter coefficients Q12 */
+ const Word16 *speech_fx, /* i : pointer to the denoised speech frame Q_new */
+ const Word16 tilt_fact, /* i : tilt factor Q15 */
+ Word16 *wsp_fx, /* o : poitnter to the weighted speech frame Q_new */
+ Word16 *mem_wsp_fx, /* i/o: W(Z) denominator memory Q_new */
+ const Word16 gamma, /* i : weighting factor Q15 */
+ const Word16 L_look /* i : look-ahead Q0*/
);
Word16 RCcontextMapping_encode2_estimate_bandWise_start_fx(
@@ -11183,14 +11371,12 @@ Word16 RCcontextMapping_encode2_estimate_bandWise_fx(
HANDLE_RC_CONTEXT_MEM hContextMem /* Q0 */
);
-
/*! r: Q15 */
Word16 expfp_evs_fx(
const Word16 x, /* i : mantissa Q15-e */
const Word16 x_e /* i : exponent Q0 */
);
-
void tcx_arith_render_envelope_ivas_fx(
const Word16 A_ind[], /* i : LPC coefficients of signal envelope Q12*/
const Word16 L_frame, /* i : number of spectral lines Q0*/
@@ -11218,7 +11404,6 @@ void tcx_arith_decode_envelope_ivas_fx(
const Word16 low_complexity /* i : low-complexity flag */
);
-
void UnmapIndex_fx(
const Word16 PeriodicityIndex, /* Q0 */
const Word16 Bandwidth, /* Q0 */
@@ -11238,7 +11423,6 @@ Word32 tcx_hm_render_fx(
Word16 p[] /* o: harmonic model Q13 */
);
-
void tcx_hm_modify_envelope_fx(
const Word16 gain, /* i: HM gain Q11 */
const Word32 lag, /* i: pitch lag Q0 */
@@ -11259,8 +11443,8 @@ void tcx_hm_decode(
);
void writeTCXMode_fx(
- Encoder_State *st, /* i/o: encoder state structure */
- BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
+ Encoder_State *st, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/
Word16 *nbits_start /* o : nbits start Q0*/
);
@@ -11367,10 +11551,6 @@ Word16 is_EVS_bitrate(
Word16 *Opt_AMR_WB /* i : AMR-WB IO flag */
);
-void IGFEncResetTCX10BitCounter_ivas_fx(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc /* i : instance handle of IGF Encoder */
-);
-
ivas_error IGF_Reconfig(
IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */
const Word16 igf, /* i : IGF on/off */
diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c
index 1adcdb7ae6074f3f2b89dbd4883a144f48883b55..9e2f58ed02467a79c769d9a0e27b205884e1a85a 100644
--- a/lib_com/pvq_com_fx.c
+++ b/lib_com/pvq_com_fx.c
@@ -427,9 +427,11 @@ void NearOppSplitAdjustment_fx(
Word16 qac, qboth, qskew, qavg, qmin, Midx;
Word32 L_QIb, L_qnum;
Word16 QIb, QIa;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
rangeCoderFinalizationFBits_fx( Qac, INTac, &qac );
@@ -456,7 +458,11 @@ void NearOppSplitAdjustment_fx(
}
*qnear = qboth; /* Q3 */
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ QIb = extract_h( L_shl_sat( L_QIb, 16 ) ); /* may saturate Q0*/
+#else
QIb = extract_h( L_shl_o( L_QIb, 16, &Overflow ) ); /* may saturate Q0*/
+#endif
if ( LE_16( QIb, qboth ) )
{
*qnear = QIb; /* Q0 */
@@ -527,9 +533,11 @@ void fine_gain_quant_fx(
Word16 tmp1, tmp2, exp1, exp2;
Word32 L_tmp;
UWord16 lsb;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
FOR( band = 0; band < num_sfm; band++ )
@@ -552,7 +560,11 @@ void fine_gain_quant_fx(
tmp1 = sub( tmp1, exp1 );
L_tmp = L_Comp( tmp1, exp2 );
Mpy_32_16_ss( L_tmp, 24660, &L_tmp, &lsb ); /* 24660 = 20*log10(2) in Q12 */ /*16+12-15=13 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gain_db = round_fx_sat( L_shl_sat( L_tmp, 17 ) );
+#else
gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) );
+#endif
idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] );
push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits );
diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c
index 0ed9c9ac844e12d16ec61679379fbf4fd3577b95..d338e316356ce908ed95ae7621921ab588eed2b5 100644
--- a/lib_com/residu_fx.c
+++ b/lib_com/residu_fx.c
@@ -62,9 +62,11 @@ void Residu3_lc_fx(
Word16 i, j;
Word32 s;
Word16 q;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
q = add( norm_s( a[0] ), 1 );
@@ -72,11 +74,37 @@ void Residu3_lc_fx(
{
q = add( q, shift );
}
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
*y++ = shl_sat( x[0], shift );
+ move16();
+
+ FOR( i = 1; i < m; i++ )
+ {
+ s = L_mult_sat( x[i], a[0] );
+ /* Stop at i to Avoid Mults with Zeros */
+ FOR( j = 1; j <= i; j++ )
+ {
+ s = L_mac_sat( s, x[i - j], a[j] );
+ }
+
+ s = L_shl_sat( s, q );
+ *y++ = round_fx_sat( s );
+ }
+
+ FOR( ; i < lg; i++ )
+ {
+ s = L_mult_sat( x[i], a[0] );
+ FOR( j = 1; j <= m; j++ )
+ {
+ s = L_mac_sat( s, x[i - j], a[j] );
+ }
+
+ s = L_shl_sat( s, q );
+ *y++ = round_fx_sat( s );
+ }
+
#else
*y++ = shl_o( x[0], shift, &Overflow );
-#endif
move16();
FOR( i = 1; i < m; i++ )
@@ -103,6 +131,8 @@ void Residu3_lc_fx(
s = L_shl_o( s, q, &Overflow );
*y++ = round_fx_o( s, &Overflow );
}
+
+#endif
}
/*--------------------------------------------------------------------*
@@ -155,9 +185,11 @@ void Residu3_fx(
Word64 s64;
Word32 s32;
Word16 q;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
q = add( norm_s( a[0] ), 1 );
if ( shift != 0 )
@@ -174,7 +206,11 @@ void Residu3_fx(
}
s64 = W_mac_16_16( s64, x[i - 16], a[16] );
s32 = W_shl_sat_l( s64, q );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[i] = round_fx_sat( s32 );
+#else
y[i] = round_fx_o( s32, &Overflow );
+#endif
move16();
}
}
diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c
deleted file mode 100644
index 0044134699e755b2fc4a031519282c68d0c4c0c1..0000000000000000000000000000000000000000
--- a/lib_com/rom_com.c
+++ /dev/null
@@ -1,31256 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
- ====================================================================================*/
-
-#include
-#include "options.h"
-#include "cnst.h"
-#include "rom_com.h"
-#include "prot_fx.h"
-#include "basop_util.h"
-#include "wmc_auto.h"
-
-/* clang-format off */
-
-/*----------------------------------------------------------------------------------*
- * Table of bitrates
- *----------------------------------------------------------------------------------*/
-#define W16(x) ((Word16)x)
-
-const Word32 brate_tbl[SIZE_BRATE_TBL] = // Q0
-{
- ACELP_7k20, ACELP_8k00, ACELP_9k60, ACELP_13k20, ACELP_16k40, ACELP_24k40,
- ACELP_32k, ACELP_48k, ACELP_64k, HQ_96k, HQ_128k
-};
-
-const Word32 brate_intermed_tbl[SIZE_BRATE_INTERMED_TBL] = // Q0
-{
- ACELP_5k00, ACELP_6k15, ACELP_7k20, ACELP_8k00, ACELP_9k60, ACELP_11k60, ACELP_12k15, ACELP_12k85, ACELP_13k20,
- ACELP_14k80, ACELP_16k40, ACELP_22k60, ACELP_24k40, ACELP_29k00, ACELP_29k20, ACELP_30k20,
- ACELP_30k40, ACELP_32k, ACELP_48k, ACELP_64k, HQ_96k, HQ_128k
-};
-
-const Word16 bit_rates_div50[] = /* bit rate values / 50 to Fit in a Word16 */
-{
- ACELP_5k00 / 50, ACELP_6k15 / 50, ACELP_7k20 / 50, ACELP_8k00 / 50, ACELP_9k60 / 50, ACELP_11k60 / 50, ACELP_12k15 / 50,
- ACELP_12k85 / 50, ACELP_13k20 / 50, ACELP_14k80 / 50, ACELP_16k40 / 50, ACELP_22k60 / 50,
- ACELP_24k40 / 50, ACELP_29k00 / 50, ACELP_29k20 / 50, ACELP_30k20 / 50, ACELP_30k40 / 50,
- ACELP_32k / 50, ACELP_48k / 50, ACELP_64k / 50, HQ_96k / 50, HQ_128k / 50
-};
-
-const Word16 bit_rates_16k_div50[] = /* bit rate values / 50 to Fit in a Word16 */
-{
- ACELP_8k00 / 50, ACELP_14k80 / 50, ACELP_22k60 / 50, ACELP_24k40 / 50, ACELP_29k00 / 50,
- ACELP_29k20 / 50, ACELP_30k20 / 50, ACELP_30k40 / 50, ACELP_32k / 50, ACELP_48k / 50, ACELP_64k / 50
-};
-
-/*----------------------------------------------------------------------------------*
- * Frame size and mode configuration tables
- *----------------------------------------------------------------------------------*/
-
-const FrameSizeParams FrameSizeConfig[FRAME_SIZE_NB] =
-{
- /* bits, net bits, trans_bits, trans_mode, band_bits, band_mode_min, band_mode_max, reserved_bits */
- { FRAME_0, FRAME_0, 0, {0,0}, 0, 0, 0, 0}, /* 0 kbps ZERO_FRAME*/
- { FRAME_2_4, FRAME_2_4-2, 1, {1,1}, 1, NB, WB, 0}, /* 2.4kbps VBR(SID)*/
- { FRAME_7_2, FRAME_7_2-1, 0, {0,1}, 1, NB, WB, 0}, /* 7.2kbps VBR/CBR*/
- { FRAME_8, FRAME_8-1, 0, {0,1}, 1, NB, WB, 0}, /* 8 kbps VBR/CBR*/
- { FRAME_9_6, FRAME_9_6-2, 0, {0,1}, 2, NB, SWB, 0}, /* 9.6kbps CBR*/
- { FRAME_13_2, FRAME_13_2-2, 0, {0,1}, 2, NB, SWB, 0}, /* 13.2kbps CBR*/
- { FRAME_16_4, FRAME_16_4-3, 0, {0,1}, 2, NB, FB, 1}, /* 16.4kbps CBR*/
- { FRAME_24_4, FRAME_24_4-3, 0, {0,1}, 2, NB, FB, 1}, /* 24.4kbps CBR*/
- { FRAME_32, FRAME_32-3, 0, {0,1}, 2, WB, FB, 1}, /* 32 kbps CBR*/
- { FRAME_48, FRAME_48-3, 0, {0,1}, 2, WB, FB, 1}, /* 48 kbps CBR*/
- { FRAME_64, FRAME_64-3, 0, {0,1}, 2, WB, FB, 1}, /* 64 kbps CBR*/
- { FRAME_96, FRAME_96-3, 0, {0,1}, 2, WB, FB, 1}, /* 96 kbps CBR*/
- { FRAME_128, FRAME_128-3, 0, {0,1}, 2, WB, FB, 1} /*128 kbps CBR*/
-};
-
-
-/*----------------------------------------------------------------------------------*
- * Conversion of ACELP signaling parameters (ACELP internal Fs, coder type, bandwidth, sharpening flag) to index
- * (to be consulted with the decision matrix)
- *
- * - in order to retrieve the index, each section in this table starts with the bitrate
- * - the second value in each section corresponds to the number of bits
- * - the other values represent indices created by combining different parameters into a single value through the macro SIG2IND()
- *----------------------------------------------------------------------------------*/
-
-const Word32 acelp_sig_tbl[MAX_ACELP_SIG] = // Q0
-{
- /* GENERIC UNVOICED VOICED TRANSITION AUDIO INACTIVE */
- ACELP_7k20, 4,
- SIG2IND(GENERIC, NB, 1, 0), SIG2IND(UNVOICED, NB, 0, 0), SIG2IND(VOICED, NB, 1, 0), SIG2IND(TRANSITION, NB, 1, 0), SIG2IND(AUDIO, NB, 0, 0), SIG2IND(INACTIVE, NB, 0, 0),
- SIG2IND(GENERIC, WB, 1, 0), SIG2IND(UNVOICED, WB, 0, 0), SIG2IND(VOICED, WB, 1, 0), SIG2IND(TRANSITION, WB, 1, 0), SIG2IND(AUDIO, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
- SIG2IND(GENERIC, NB, 0, 0),
- SIG2IND(GENERIC, WB, 0, 0),
- SIG2IND(LR_MDCT, NB, 0, 0),
-
- ACELP_8k00, 4,
- SIG2IND(GENERIC, NB, 1, 0), SIG2IND(UNVOICED, NB, 0, 0), SIG2IND(VOICED, NB, 1, 0), SIG2IND(TRANSITION, NB, 1, 0), SIG2IND(AUDIO, NB, 0, 0), SIG2IND(INACTIVE, NB, 0, 0),
- SIG2IND(GENERIC, WB, 1, 0), SIG2IND(UNVOICED, WB, 0, 0), SIG2IND(VOICED, WB, 1, 0), SIG2IND(TRANSITION, WB, 1, 0), SIG2IND(AUDIO, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
- SIG2IND(GENERIC, NB, 0, 0),
- SIG2IND(GENERIC, WB, 0, 0),
- SIG2IND(LR_MDCT, NB, 0, 0),
-
- ACELP_13k20, 5,
- SIG2IND(GENERIC, NB, 1, 0), SIG2IND(VOICED, NB, 1, 0), SIG2IND(TRANSITION, NB, 0, 0), SIG2IND(AUDIO, NB, 0, 0), SIG2IND(INACTIVE, NB, 0, 0),
- SIG2IND(GENERIC, WB, 1, 0), SIG2IND(VOICED, WB, 1, 0), SIG2IND(TRANSITION, WB, 0, 0), SIG2IND(AUDIO, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
- SIG2IND(GENERIC, SWB, 1, 0), SIG2IND(VOICED, SWB, 1, 0), SIG2IND(TRANSITION, SWB, 0, 0), SIG2IND(AUDIO, SWB, 0, 0), SIG2IND(INACTIVE, SWB, 0, 0),
- SIG2IND(GENERIC, NB, 0, 0), SIG2IND(VOICED, NB, 0, 0),
- SIG2IND(GENERIC, WB, 0, 0), SIG2IND(VOICED, WB, 0, 0),
- SIG2IND(GENERIC, SWB, 0, 0), SIG2IND(VOICED, SWB, 0, 0),
- SIG2IND(GENERIC, WB, 1, 1), SIG2IND(UNVOICED, WB, 0, 1), SIG2IND(VOICED, WB, 1, 1), SIG2IND(INACTIVE, WB, 0, 1),
- SIG2IND(GENERIC, SWB, 1, 1), SIG2IND(UNVOICED, SWB, 0, 1), SIG2IND(VOICED, SWB, 1, 1), SIG2IND(INACTIVE, SWB, 0, 1),
- SIG2IND(LR_MDCT, NB, 0, 0),
- SIG2IND(LR_MDCT, WB, 0, 0),
- SIG2IND(LR_MDCT, SWB, 0, 0),
-
- ACELP_32k, 4,
- SIG2IND(GENERIC, WB, 1, 0), SIG2IND(TRANSITION, WB, 1, 0), SIG2IND(INACTIVE, WB, 0, 0),
- SIG2IND(GENERIC, SWB, 1, 0), SIG2IND(TRANSITION, SWB, 1, 0), SIG2IND(INACTIVE, SWB, 0, 0),
- SIG2IND(GENERIC, FB, 1, 0), SIG2IND(TRANSITION, FB, 1, 0), SIG2IND(INACTIVE, FB, 0, 0),
- SIG2IND(GENERIC, WB, 0, 0), SIG2IND(TRANSITION, WB, 0, 0),
- SIG2IND(GENERIC, SWB, 0, 0), SIG2IND(TRANSITION, SWB, 0, 0),
- SIG2IND(GENERIC, FB, 0, 0), SIG2IND(TRANSITION, FB, 0, 0),
-
- ACELP_64k, 4,
- SIG2IND(GENERIC, WB, 0, 0), SIG2IND(TRANSITION, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
- SIG2IND(GENERIC, SWB, 1, 0), SIG2IND(TRANSITION, SWB, 1, 0), SIG2IND(INACTIVE, SWB, 0, 0),
- SIG2IND(GENERIC, FB, 1, 0), SIG2IND(TRANSITION, FB, 1, 0), SIG2IND(INACTIVE, FB, 0, 0),
- SIG2IND(GENERIC, SWB, 0, 0), SIG2IND(TRANSITION, SWB, 0, 0),
- SIG2IND(GENERIC, FB, 0, 0), SIG2IND(TRANSITION, FB, 0, 0),
-};
-
-/*----------------------------------------------------------------------------------*
- * ACELP bit allocation tables
- *----------------------------------------------------------------------------------*/
-
-/* bit allocation table for end-frame LSF quantizer */
-const Word16 LSF_bits_tbl[] = // Q0
-{
- /* IC UC VC GC TC AC */
- 22, 31, 24, 29, 24, 22, /* ACELP_5k00 */
- 22, 31, 24, 29, 24, 22, /* ACELP_6k15 */
- 22, 37, 31, 29, 31, 22, /* ACELP_7k20 */
- 22, 40, 36, 33, 34, 22, /* ACELP_8k00 */
- 27, 40, 34, 35, 37, 27, /* ACELP_9k60 */
- 31, 0, 37, 37, 40, 31, /* ACELP_11k60 */
- 31, 0, 39, 39, 41, 31, /* ACELP_12k15 */
- 31, 0, 38, 38, 40, 31, /* ACELP_12k85 */
- 31, 0, 38, 38, 40, 31, /* ACELP_13k20 */
- 31, 0, 37, 42, 42, 31, /* ACELP_14k80 */
- 31, 0, 43, 40, 40, 31, /* ACELP_16k40 */
- 31, 0, 42, 40, 40, 31, /* ACELP_22k60 */
- 31, 0, 46, 41, 41, 31, /* ACELP_24k40 */
- 41, 0, 0, 41, 41, 0, /* ACELP_29k00 */
- 41, 0, 0, 41, 41, 0, /* ACELP_29k20 */
- 41, 0, 0, 41, 41, 0, /* ACELP_30k20 */
- 41, 0, 0, 41, 41, 0, /* ACELP_30k40 */
- 41, 0, 0, 41, 41, 0, /* ACELP_32k */
- 41, 0, 0, 41, 41, 0, /* ACELP_48k */
- 41, 0, 0, 41, 41, 0, /* ACELP_64k */
-};
-
-/* bit allocation table for mid-frame LSF quantizer */
-const Word16 mid_LSF_bits_tbl[] = // Q0
-{
- /* IC UC VC GC TC AC */
- 2, 5, 1, 2, 2, 2, /* ACELP_5k00 */
- 2, 5, 1, 2, 2, 2, /* ACELP_6k15 */
- 2, 5, 4, 5, 5, 2, /* ACELP_7k20 */
- 2, 5, 4, 5, 5, 2, /* ACELP_8k00 */
- 2, 5, 4, 5, 5, 2, /* ACELP_9k60 */
- 2, 5, 4, 5, 5, 2, /* ACELP_11k60 */
- 2, 5, 5, 5, 5, 2, /* ACELP_12k15 */
- 2, 5, 5, 5, 5, 2, /* ACELP_12k85 */
- 2, 5, 5, 5, 5, 2, /* ACELP_13k20 */
- 4, 0, 5, 5, 5, 4, /* ACELP_14k80 */
- 4, 0, 5, 5, 5, 4, /* ACELP_16k40 */
- 5, 0, 5, 5, 5, 5, /* ACELP_22k60 */
- 5, 0, 5, 5, 5, 5, /* ACELP_24k40 */
- 5, 0, 0, 5, 5, 5, /* ACELP_29k00 */
- 5, 0, 0, 5, 5, 5, /* ACELP_29k20 */
- 5, 0, 0, 5, 5, 5, /* ACELP_30k20 */
- 5, 0, 0, 5, 5, 5, /* ACELP_30k40 */
- 5, 0, 0, 5, 5, 5, /* ACELP_32k */
- 5, 0, 0, 5, 5, 5, /* ACELP_48k */
- 5, 0, 0, 5, 5, 5, /* ACELP_64k */
-};
-
-
-/* bit allocation table for scaled innovation energy prediction */
-const Word16 Es_pred_bits_tbl[] = // Q0
-{
-/* UC VC GC TC */
- 0, 0, 0, 4, /* ACELP_5k00 */
- 0, 0, 0, 4, /* ACELP_6k15 */
- 0, 0, 0, 4, /* ACELP_7k20 */
- 0, 0, 0, 4, /* ACELP_8k00 */
- 0, 5, 5, 5, /* ACELP_9k60 */
- 0, 5, 4, 4, /* ACELP_11k60 */
- 0, 5, 5, 5, /* ACELP_12k15 */
- 0, 5, 4, 5, /* ACELP_12k85 */
- 0, 5, 4, 4, /* ACELP_13k20 */
- 0, 5, 5, 5, /* ACELP_14k80 */
- 0, 5, 5, 5, /* ACELP_16k40 */
- 0, 5, 5, 5, /* ACELP_22k60 */
- 0, 5, 5, 5, /* ACELP_24k40 */
- 0, 0, 5, 5, /* ACELP_29k00 */
- 0, 0, 5, 5, /* ACELP_29k20 */
- 0, 0, 5, 5, /* ACELP_30k20 */
- 0, 0, 5, 5, /* ACELP_30k40 */
- 0, 0, 5, 5, /* ACELP_32k */
- 0, 0, 5, 5, /* ACELP_48k */
- 0, 0, 5, 5, /* ACELP_64k */
-};
-
-/* bit allocation table for gain quantizer (ACELP@12.8kHz) */
-/* the 4 values allocated correspond to 4 subframes */
-const Word16 gain_bits_tbl[] = // Q0
-{
-/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
- 6,6,6,6, 7,6,6,6, 7,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_5k00 */
- 6,6,6,6, 7,6,6,6, 7,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_6k15 */
- 7,7,7,7, 7,6,6,6, 6,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_7k20 */
- 7,7,7,7, 8,7,6,6, 8,7,6,6, 5,5,5,5, 5,6,5,5, 5,3,6,6, 5,3,3,6, 3,5,5,5, 3,3,6,6, 3,3,3,14, /* ACELP_8k00 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_9k60 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,13, /* ACELP_11k60 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,14, /* ACELP_12k15 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,5, 3,3,3,14, /* ACELP_12k85 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_13k20 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_14k80 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_16k40 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,14, /* ACELP_22k60 */
- 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_24k40 */
-};
-
-
-/* bit allocation table for gain gain quantizer (ACELP@16kHz) */
-/* the 5 values allocated correspond to 5 subframes */
-const Word16 gain_bits_16kHz_tbl[] = // Q0
-{
- /* IC GC TC0 TC64 TC128 TC192 TC256 */
- 0,0,0,0,0, 6,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0, 0, /* ACELP_8k00 */
- 0,0,0,0,0, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,15, /* ACELP_14k80 */
- 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,15, /* ACELP_22k60 */
- 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,16, /* ACELP_24k40 */
- 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_29k00 */
- 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_29k20 */
- 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_30k20 */
- 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_30k40 */
- 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_32k */
- 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12, 6,12,12,12,12, 6,6,12,12,12, 6,6,6,12,12, 6,6,6,6,12, /* ACELP_48k */
- 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12, 6,12,12,12,12, 6,6,12,12,12, 6,6,6,12,12, 6,6,6,6,12 /* ACELP_64k */
-};
-
-/* bit allocation table for adaptive codebook (pitch) (ACELP@12.8kHz) */
-/* the 4 values correspond to 4 subframes */
-const Word16 ACB_bits_tbl[] = // Q0
-{
-/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
- 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_5k00 */
- 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_6k15 */
- 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_7k20 */
- 0,0,0,0, 10,5,5,5, 9,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,5, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_8k00 */
- 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_9k60 */
- 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_11k60 */
- 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_12k15 */
- 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_12k85 */
- 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_13k20 */
- 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_14k80 */
- 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_16k40 */
- 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_22k60 */
- 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_24k40 */
-};
-
-/* bit allocation table for adaptive codebook (pitch) (ACELP@16kHz) */
-/* the 5 values correspond to 5 subframes */
-const Word16 ACB_bits_16kHz_tbl[] = // Q0
-{
- /* IC GC TC0 TC64 TC128 TC192 TC256 */
- 0,0, 0,0,0, 9,0, 0,0,0, 0,0, 0,0,0, 0,0, 0,0,0, 0,0, 0,0,0, 0,0,0, 0,0, 0,0,0,0, 0, /* ACELP_8k00 */
- 0,0, 0,0,0, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_14k80 */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_22k60 */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_24k40 */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_29k00 */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_29k20 */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_30k20 */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_30k40 */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_32k */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_48k */
- 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10 /* ACELP_64k */
-};
-
-/* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@12.8kHz) */
-/* the 4 values correspond to 4 subframes */
-const Word16 FCB_bits_tbl[] = // Q0
-{
-/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
- 8,8,8,8, 12,12,12,20, 7, 7, 0, 7, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_5k00 */
- 10,10,10,10, 12,12,12,20, 12, 7,12, 7, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_6k15 */
- 13,13,13,13, 12,12,12,20, 12,12,12,20, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_7k20 */
- 13,13,13,13, 12,20,12,20, 12,20,12,20, 20,12,12,12, 20,12,12,12, 20,12,20,12, 20,12,20,20, 20,12,12,20, 20,12,20,12, 12,20,12,20, /* ACELP_8k00 */
- 13,13,13,13, 20,28,20,28, 20,20,20,28, 20,20,20,20, 20,20,20,20, 20,20,28,20, 20,28,20,28, 20,28,20,20, 20,20,20,28, 20,28,20,28, /* ACELP_9k60 */
- 0, 0, 0, 0, 28,36,28,36, 28,28,28,36, 28,28,28,28, 28,28,28,28, 28,28,36,28, 28,36,28,36, 28,36,28,28, 28,28,28,36, 28,36,28,36, /* ACELP_11k60 */
- 0, 0, 0, 0, 28,36,36,36, 28,36,28,36, 36,28,28,28, 36,28,28,28, 36,28,36,28, 36,36,28,43, 28,36,28,36, 28,36,28,36, 28,36,36,36, /* ACELP_12k15 */
- 0, 0, 0, 0, 36,36,36,43, 36,36,36,36, 36,36,28,36, 36,28,36,36, 36,36,36,36, 36,36,43,43, 36,36,36,36, 36,36,36,43, 36,36,36,43, /* ACELP_12k85 */
- 0, 0, 0, 0, 36,43,36,43, 36,36,36,43, 36,36,36,36, 36,36,36,36, 36,36,43,36, 36,43,43,43, 36,43,36,36, 43,36,43,36, 36,43,36,43, /* ACELP_13k20 */
- 0, 0, 0, 0, 43,50,43,50, 43,43,43,43, 43,43,43,43, 43,43,43,43, 43,43,50,43, 43,50,50,50, 43,43,43,50, 50,43,50,43, 43,50,43,50, /* ACELP_14k80 */
- 0, 0, 0, 0, 50,56,50,56, 50,50,50,56, 56,50,50,50, 56,50,50,50, 56,50,56,56, 56,56,56,56, 50,56,50,56, 50,56,56,56, 50,56,56,56, /* ACELP_16k40 */
- 0, 0, 0, 0, 83,83,83,87, 78,83,83,83, 83,78,83,83, 83,78,83,87, 83,87,83,87, 83,87,87,92, 87,83,87,83, 87,83,87,87, 83,87,87,87, /* ACELP_22k60 */
- 0, 0, 0, 0, 92,92,92,92, 87,92,92,92, 92,87,92,92, 92,87,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, /* ACELP_24k40 */
-};
-
-/* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@16kHz) */
-/* the 5 values correspond to 5 subframes */
-const Word16 FCB_bits_16kHz_tbl[] = // Q0
-{
- /* IC GC TC0 TC64 TC128 TC192 TC256 */
- 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_8k00 */
- 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_14k80 */
- 0, 0, 0, 0, 0, 62,56,56,56,62, 62,56,56,56,56, 56,56,56,56,73, 62,56,62,62,62, 56,62,62,62,73, 62,62,62,62,68, /* ACELP_22k60 */
- 0, 0, 0, 0, 0, 68,68,68,73,73, 68,68,68,68,73, 68,73,68,73,73, 73,73,73,73,73, 73,78,73,73,78, 73,78,73,73,78, /* ACELP_24k40 */
- 12,12,12,12,12, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, /* ACELP_29k00 */
- 12,12,12,12,12, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, /* ACELP_29k20 */
- 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_30k20 */
- 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_30k40 */
- 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_32k */
- 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_48k */
- 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36 /* ACELP_64k */
-};
-
-/* bit allocation table for AVQ bits in active segments (ACELP@16kHz) */
-const Word16 AVQ_bits_16kHz_tbl[] = // Q0
-{
- /* IC GC TC0 TC64 TC128 TC192 TC256 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_8k00 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_14k80 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_22k60 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_24k40 */
- 78, 78, 78, 78, 78, 48, 48, 48, 48, 49, 48, 49, 49, 48, 49, 50, 50, 51, 52, 52, 50, 54, 53, 54, 54, 55, 55, 55, 55, 54, 52, 56, 56, 56, 56, /* ACELP_29k00 */
- 79, 79, 79, 79, 78, 49, 49, 49, 49, 49, 50, 49, 49, 50, 49, 52, 52, 51, 52, 52, 54, 54, 53, 54, 54, 56, 55, 55, 56, 56, 56, 56, 56, 56, 56, /* ACELP_29k20 */
- 78, 78, 78, 78, 78, 50, 50, 50, 50, 49, 51, 50, 50, 50, 50, 53, 53, 53, 52, 52, 55, 55, 55, 54, 54, 57, 57, 56, 56, 56, 57, 57, 57, 57, 56, /* ACELP_30k20 */
- 79, 79, 79, 79, 78, 51, 51, 51, 50, 50, 51, 51, 51, 51, 51, 54, 54, 53, 53, 53, 56, 56, 56, 55, 54, 58, 57, 57, 57, 57, 58, 58, 58, 57, 57, /* ACELP_30k40 */
- 86, 85, 85, 85, 85, 57, 57, 57, 57, 57, 58, 58, 57, 57, 57, 60, 60, 60, 60, 59, 62, 62, 62, 62, 61, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, /* ACELP_32k */
- 143,142,142,142,142, 116,115,115,115,115, 116,116,115,115,115, 119,119,118,118,118, 121,121,121,121,121, 124,124,123,123,123, 126,126,126,126,126, /* ACELP_48k */
- 207,206,206,206,206, 180,179,179,179,179, 180,180,179,179,179, 183,183,182,182,182, 185,185,185,185,185, 188,188,187,187,187, 190,190,190,190,190 /* ACELP_64k */
-};
-
-/* bit allocation table for reserved bits (ACELP@12.8kHz) */
-const Word16 reserved_bits_tbl[] = // Q0
-{
-/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_5k00 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_6k15 */
- 1, 0, 0, 0, 0, 2, 4, 0, 3, 0, /* ACELP_7k20 */
- 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, /* ACELP_8k00 */
- 46, 0, 0, 0, 1, 2, 4, 1, 4, 0, /* ACELP_9k60 */
- 0, 0, 0, 0, 1, 3, 6, 2, 6, 0, /* ACELP_11k60 */
- 0, 0, 0, 0, 2, 4, 0, 3, 7, 0, /* ACELP_12k15 */
- 0, 0, 0, 0, 1, 3, 0, 2, 0, 0, /* ACELP_12k85 */
- 0, 0, 0, 0, 1, 4, 1, 3, 0, 0, /* ACELP_13k20 */
- 0, 0, 0, 0, 2, 5, 2, 4, 1, 1, /* ACELP_14k80 */
- 0, 0, 0, 0, 2, 0, 5, 5, 3, 3, /* ACELP_16k40 */
- 0, 0, 2, 2, 0, 1, 3, 0, 0, 1, /* ACELP_22k60 */
- 0, 0, 1, 1, 3, 8, 19, 7, 11, 11, /* ACELP_24k40 */
-};
-
-/* NRG mode */
-const UWord8 ACELP_NRG_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
-{
- {{0,0,1,1,0,0,0,0},{2,2,1,1,0,0,0,0}},
- {{1,1,1,1,0,0,0,0},{1,1,1,1,1,1,1,0}},
-};
-
-/* NRG bits : (0/2/3 bits) */
-const UWord8 ACELP_NRG_BITS[3] = { 0, 3, 4 }; // Q0
-
-/* LTP MODE*/
-const UWord8 ACELP_LTP_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
-{
- {{0,0,1,2,0,0,0,0},{0,0,1,2,0,0,0,0}},
- {{4,4,3,4,0,0,0,0},{4,4,3,4,8,0,9,0}},
-};
-
-/* LTP bits */
-const UWord8 ACELP_LTP_BITS_SFR[8+RF_MODE_MAX][5] = // Q0
-{
- {0,0,0,0,0},
- {8,4,4,4,4},
- {8,5,8,5,5},
- {9,6,6,6,6},
- {9,6,9,6,6},
- {8,5,5,5,5},
- {8,5,8,5,5},
- {8,0,0,0,0},
- {8,5,5,5,5}, /* All-pred mode in RF, rf_frame_type = 0 */
- {8,4,4,4,0}, /* Gen-pred mode in RF, rf_frame_type = 2 */
-};
-
-/* LTF modes (0 - LOW_PASS (LP filtering), 1 - FULL_BAND (no filtering), 2 - NORMAL_OPERATION (adaptive)) */
-/* Mode 2 ACELP: INACTIVE,UNVOICED,VOICED,GENERIC */
-const UWord8 ACELP_LTF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
-{
- {{1,1,1,0,0,0,0,0},{1,1,1,0,0,0,0,0}},
- {{0,0,2,0,0,0,0,0},{0,0,2,0,1,1,1,0}},
-};
-
-/* LTF bits */
-const UWord8 ACELP_LTF_BITS[4] = { 0, 0, 4, 0 }; // Q0
-
-/* GAINS ELEMENT */
-/* 5 modes: (EVS: 5b/subframe), (AMRWB: 7b/subframe),(AMRWB: 6b/subframe),(UC: 5b/subframe) */
-const UWord8 ACELP_GAINS_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
-{
- {{6,6,1,1,0,0,0,0},{7,7,1,1,0,0,0,0}},
- {{2,2,3,3,0,0,0,0},{2,2,3,3,3,2,1,0}},
-};
-
-/* gains bits */
-const UWord8 ACELP_GAINS_BITS[10] = // Q0
-{
- 0, /* skip sub-frame wise gain coding*/
- 5,
- 6,
- 7,
- 6,
- 7,
- 6, /* UC */
- 7, /* GUNVOICED UV (5b ICB/2b Gaussian) */
- 4, /* GNELP UV */
- 5 /* GNELP UV */
-};
-
-/* BPF modes (0 - no filtering, 1 - filtering, 2 - adaptive) */
-const UWord8 ACELP_BPF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
-{
- {{1,1,1,1,0,0,0,0},{1,1,1,1,0,0,0,0}},
- {{1,1,2,2,0,0,0,0},{1,1,2,2,1,1,1,1}},
-};
-
-/* BPF bits */
-const UWord8 ACELP_BPF_BITS[3] = { 0, 0, 2 }; // Q0
-const Word16 ACELP_CDK_BITS[ACELP_FIXED_CDK_NB] =
-{
- 7, 10, 12, 15, 17, 20, 24, 26, 28, 30, 32, 34, 36, 40, 43, 46,
- 47, 49, 50, 53, 55, 56, 58, 59, 61, 62, 65, 68, 70, 73, 75, 78, 80, 83,
- 85, 87, 89, 92, 94, 96, 98
-};
-
-/*----------------------------------------------------------------------------------*
- * Perceptual critical bands
- *----------------------------------------------------------------------------------*/
-
-const Word32 crit_bands_fx[] =//Q0
-{
- 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480,
- 1720, 2000, 2320, 2700, 3150, 3700, 4400, 5300, 6350, 7700,
- 9500, 12000, 15500, 40000
-};
-
-
-const Word16 crit_bins_corr_fx[CRIT_NOIS_BAND] =
-{//Q15
- /*.9f, .9f, .85f, .8f, .775f, .75f, .725f , .7f , .675f, .65f, .625f , .60f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f*/
- 29491, 29491, 27853, 26214, 25395, 24576, 23577 , 22938, 22118, 21299, 20480,
- 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661
-};
-const Word16 crit_bins[CRIT_NOIS_BAND] = // Q0
-{
- 4, 4, 4, 4, 4, 5, 6, 6, 6, 8, 8, 10, 11, 13, 15, 18, 22, 16, 16, 20, 20, 20, 16
-};
-
-
-const Word16 crit_bands_loc_fx[CRIT_NOIS_BAND] =
-{//Q0
- 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720,
- 2000, 2320, 2700, 3150, 3700, 4100, 4500, 5000, 5500, 6000, 6375
-};
-
-const Word16 inv_tbl_fx[146] =//Q15
-{
- 0, 32767, 16384, 10923, 8192, 6554, 5462, 4681,
- 4096, 3641, 3277, 2979, 2731, 2521, 2341, 2185,
- 2048, 1928, 1820, 1725, 1638, 1560, 1489, 1425,
- 1365, 1311, 1260, 1214, 1170, 1130, 1092, 1057,
- 1024, 993, 964, 936, 910, 886, 862, 840,
- 819, 799, 780, 762, 745, 728, 712, 697,
- 683, 669, 655, 643, 630, 618, 607, 596,
- 585, 575, 565, 555, 546, 537, 529, 520,
- 512, 504, 496, 489, 482, 475, 468, 462,
- 455, 449, 443, 437, 431, 426, 420, 415,
- 410, 405, 400, 395, 390, 386, 381, 377,
- 372, 368, 364, 360, 356, 352, 349, 345,
- 341, 338, 334, 331, 328, 324, 321, 318,
- 315, 312, 309, 306, 303, 301, 298, 295,
- 293, 290, 287, 285, 282, 280, 278, 275,
- 273, 271, 269, 266, 264, 262, 260, 258,
- 256, 254, 252, 250, 248, 246, 245, 243,
- 241, 239, 237, 236, 234, 232, 231, 229,
- 228, 226
-};
-
-
-const Word16 hvq_bwe_fac_fx[16] = /* Q15 */
-{
- 16384, 17408, 18432, 19456,
- 20480, 21504, 22528, 23552,
- 24576, 25600, 26624, 27648,
- 28672, 29696, 30720, 31744
-};
-
-const Word16 sqac_headroom_fx[146] = /* Q0 */
-{
- 0 /*not used */, 0, 0, 1, 1, 1, 1, 1, 1, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 4,
- 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4
-};
-
-const Word16 inv_N_fx[32] = /* Q15 */
-{
- 0, 1056, 2113, 3170,
- 4227, 5284, 6341, 7398,
- 8455, 9512, 10569, 11626,
- 12683, 13740, 14797, 15854,
- 16912, 17969, 19026, 20083,
- 21140, 22197, 23254, 24311,
- 25368, 26425, 27482, 28539,
- 29596, 30653, 31710, 32767
-};
-
-const Word16 band_len_harm[SFM_N_HARM_FB] =
-{
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 16, 16, 16, 16, 16, 16, 32, 32, 32, 48, 48, 48, 48, 64, 64, 64, 96
-};
-
-const Word32 thren_fx[39] = /* Q8 */
-{
- 28215802, 19951584, 14107901,
- 9975792, 7053951, 4987896,
- 3526975, 2493948, 1763488,
- 1246974, 881744, 623487,
- 440872, 311744, 220436,
- 155872, 110218, 77936,
- 55109, 38968, 27554,
- 19484, 13777, 9742,
- 6889, 4871, 3444,
- 2435, 1722, 1218,
- 861, 609, 431,
- 304, 215, 152,
- 108, 76, 54
-};
-
-const Word16 dicnlg2[40] = // Q0
-{
- 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,
- 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
- 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,
- 4, 3, 2, 1, 0, -1, -2, -3, -4, -5
-};
-
-/*----------------------------------------------------------------------------------*
- * LD music post-filter
- *----------------------------------------------------------------------------------*/
-
-const Word16 mfreq_loc_LD_fx[] = { 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480,//Q0
- 1720, 2000, 2320, 2700, 3150, 3700, 4400, 5300, (6400 - BIN_16kdct_fx)
-};
-
-const Word16 mfreq_bindiv_LD[] = {10, 10, 10, 10, 11, 12, 14, 15, 16, 19, 21, 24, 28, 32, 38, 45, 55, 70, 90, 110}; // Q0
-const Word16 sc_qnoise_fx[] = { 3277, 3277, 3277, 3277, 3277, 3277, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2185, 2185, 2185, 2185, 2185 };//Q15
-const Word16 inv_mfreq_bindiv_LD_fx[] = { 3277, 3277, 3277, 3277, 2979, 2731, 2341, 2185, 2048, 1725, 1560, 1365, 1170, 1024, 862, 728, 596, 468, 364, 298 }; /*Q15 */
-
-const Word16 inv_mfreq_bindiv_LD_M1_fx[] = { 3641, 3641, 3641, 3641, 3277, 2979, 2521, 2341, 2185, 1820, 1638, 1425, 1214, 1057, 886, 745, 607, 475, 368, 301 }; /*Q15 */
-
-const Word16 post_dct_wind_fx[OFFSET2] = /*Q15 */
-{
- 32767, 32766, 32759, 32748, 32733, 32713, 32689, 32660,
- 32627, 32590, 32548, 32502, 32452, 32397, 32338, 32274,
- 32207, 32135, 32059, 31979, 31894, 31805, 31712, 31615,
- 31514, 31409, 31300, 31187, 31070, 30949, 30823, 30695,
- 30562, 30425, 30285, 30141, 29993, 29841, 29686, 29527,
- 29365, 29200, 29030, 28858, 28682, 28503, 28320, 28134,
- 27945, 27753, 27558, 27360, 27159, 26955, 26749, 26539,
- 26327, 26112, 25894, 25674, 25452, 25226, 24999, 24769,
- 24537, 24303, 24067, 23828, 23588, 23345, 23101, 22855,
- 22607, 22358, 22107, 21854, 21600, 21345, 21088, 20830,
- 20570, 20310, 20049, 19786, 19523, 19258, 18993, 18728,
- 18461, 18195, 17927, 17659, 17391, 17123, 16854, 16586,
- 16317, 16048, 15779, 15511, 15243, 14975, 14707, 14440,
- 14173, 13907, 13642, 13377, 13114, 12851, 12589, 12328,
- 12068, 11809, 11552, 11296, 11041, 10787, 10536, 10285,
- 10037, 9790, 9545, 9301, 9060, 8820, 8583, 8348,
- 8115, 7884, 7655, 7429, 7205, 6983, 6765, 6548,
- 6335, 6124, 5916, 5710, 5508, 5308, 5112, 4918,
- 4728, 4540, 4356, 4175, 3998, 3824, 3653, 3485,
- 3321, 3161, 3004, 2851, 2701, 2555, 2413, 2274,
- 2139, 2009, 1882, 1758, 1639, 1524, 1413, 1306,
- 1203, 1104, 1009, 918, 831, 749, 671, 597,
- 527, 461, 400, 343, 291, 242, 199, 159,
- 124, 93, 67, 45, 27, 14, 5, 1
-};
-
-const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD] = { 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 17096, 17096, 17096, 17096 };//Q14
-
-const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD] = { 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 1425, 1425, 1425, 1425 };//Q15
-
-const Word16 wind_sss_fx[LEN_WIN_SSS] = /*window for subsampling*/
-{//Q15
- 2621, 2627, 2645, 2675, 2717, 2771, 2836, 2914,
- 3003, 3103, 3216, 3340, 3475, 3621, 3779, 3948,
- 4127, 4318, 4519, 4730, 4952, 5184, 5426, 5677,
- 5938, 6209, 6488, 6777, 7074, 7379, 7693, 8015,
- 8344, 8681, 9025, 9375, 9733, 10097, 10466, 10842,
- 11223, 11609, 12000, 12395, 12795, 13198, 13605, 14016,
- 14429, 14845, 15263, 15683, 16105, 16527, 16951, 17376,
- 17800, 18225, 18649, 19072, 19495, 19916, 20335, 20752,
- 21166, 21578, 21987, 22392, 22794, 23191, 23585, 23973,
- 24357, 24735, 25108, 25474, 25835, 26189, 26537, 26877,
- 27210, 27536, 27853, 28163, 28464, 28757, 29041, 29316,
- 29582, 29838, 30085, 30322, 30549, 30765, 30972, 31167,
- 31352, 31526, 31690, 31842, 31983, 32112, 32230, 32337,
- 32432, 32515, 32586, 32646, 32694, 32730, 32754, 32766,
- 32767, 32096, 30111, 26894, 22575, 17333, 11380, 4962
-};
-/*----------------------------------------------------------------------------------*
- * Low-pass FIR filter for low-frequency post-filtering @ 8kHz
- * fir1(240,(3900/32000),hanning(241))*5
- *----------------------------------------------------------------------------------*/
-
-const Word16 filter5_39s320_120_fx[121] = /* Q15 */
-{
- 19968, 19480, 18061, 15834, 12993, 9779, 6458, 3290,
- 506, -1713, -3253, -4075, -4212, -3762, -2873, -1720,
- -488, 654, 1568, 2160, 2389, 2263, 1838, 1201,
- 460, -275, -903, -1348, -1566, -1546, -1312, -914,
- -422, 90, 547, 891, 1083, 1108, 975, 716,
- 376, 9, -331, -599, -762, -805, -732, -562,
- -325, -61, 192, 399, 533, 582, 546, 435,
- 272, 83, -103, -259, -366, -413, -398, -328,
- -218, -86, 46, 161, 243, 283, 280, 238,
- 166, 77, -14, -94, -153, -185, -188, -163,
- -119, -62, -3, 50, 90, 113, 117, 104,
- 78, 44, 9, -23, -47, -62, -65, -58,
- -45, -27, -8, 9, 21, 28, 30, 27,
- 20, 13, 5, -2, -7, -9, -9, -8,
- -6, -3, -1, 0, 1, 1, 1, 0,
- 0
-
-};
-
-
-/*----------------------------------------------------------------------------------*
- * LP analysis windows
- *----------------------------------------------------------------------------------*/
-const Word16 Assym_window_W16fx[L_LP] = /*Q15*/
-{
- 2621, 2624, 2630, 2640, 2655, 2674, 2698, 2725,
- 2757, 2792, 2833, 2877, 2925, 2978, 3034, 3095,
- 3160, 3229, 3302, 3379, 3460, 3545, 3634, 3727,
- 3824, 3925, 4029, 4138, 4250, 4366, 4486, 4609,
- 4737, 4867, 5002, 5140, 5281, 5426, 5575, 5727,
- 5882, 6040, 6202, 6367, 6535, 6707, 6881, 7059,
- 7239, 7422, 7609, 7798, 7990, 8184, 8382, 8581,
- 8784, 8989, 9196, 9406, 9618, 9832, 10049, 10268,
- 10489, 10711, 10936, 11163, 11391, 11622, 11854, 12087,
- 12322, 12559, 12797, 13037, 13278, 13520, 13763, 14007,
- 14253, 14499, 14746, 14994, 15243, 15493, 15743, 15994,
- 16245, 16496, 16748, 17000, 17253, 17505, 17758, 18010,
- 18263, 18515, 18767, 19019, 19270, 19521, 19772, 20022,
- 20271, 20519, 20767, 21014, 21260, 21504, 21748, 21991,
- 22232, 22473, 22711, 22949, 23185, 23419, 23652, 23883,
- 24113, 24340, 24566, 24790, 25012, 25231, 25449, 25664,
- 25878, 26089, 26297, 26503, 26707, 26908, 27107, 27303,
- 27496, 27687, 27874, 28059, 28241, 28420, 28596, 28769,
- 28939, 29105, 29269, 29429, 29586, 29739, 29889, 30036,
- 30179, 30319, 30455, 30588, 30717, 30842, 30964, 31082,
- 31196, 31306, 31413, 31516, 31615, 31709, 31800, 31888,
- 31971, 32050, 32125, 32196, 32263, 32325, 32384, 32439,
- 32489, 32535, 32577, 32615, 32649, 32679, 32704, 32725,
- 32742, 32755, 32763, 32767, 32767, 32758, 32741, 32715,
- 32681, 32638, 32587, 32527, 32458, 32381, 32296, 32203,
- 32101, 31991, 31873, 31746, 31612, 31470, 31320, 31162,
- 30996, 30823, 30642, 30454, 30259, 30056, 29847, 29630,
- 29407, 29177, 28940, 28697, 28448, 28193, 27931, 27664,
- 27391, 27113, 26829, 26540, 26246, 25947, 25643, 25335,
- 25022, 24706, 24385, 24060, 23732, 23401, 23066, 22728,
- 22387, 22043, 21697, 21349, 20999, 20646, 20292, 19937,
- 19580, 19223, 18864, 18505, 18145, 17785, 17425, 17065,
- 16705, 16346, 15988, 15631, 15275, 14920, 14567, 14215,
- 13866, 13519, 13174, 12832, 12492, 12156, 11823, 11493,
- 11166, 10844, 10525, 10210, 9900, 9594, 9292, 8996,
- 8704, 8418, 8137, 7861, 7591, 7327, 7068, 6816,
- 6570, 6330, 6097, 5870, 5650, 5437, 5231, 5032,
- 4840, 4656, 4479, 4310, 4148, 3994, 3848, 3709,
- 3579, 3457, 3343, 3237, 3139, 3050, 2969, 2896,
- 2832, 2776, 2729, 2690, 2660, 2639, 2626, 2621
-};
-
-const Word16 assym_window_16k_fx[L_LP_16k] = /*Q15*/
-{
- 2621, 2623, 2627, 2634, 2643, 2655, 2670, 2688,
- 2708, 2731, 2757, 2785, 2816, 2849, 2886, 2925,
- 2966, 3011, 3058, 3107, 3159, 3214, 3271, 3331,
- 3394, 3459, 3527, 3597, 3670, 3745, 3823, 3903,
- 3985, 4071, 4158, 4248, 4341, 4436, 4533, 4632,
- 4734, 4839, 4945, 5054, 5165, 5279, 5394, 5512,
- 5632, 5754, 5879, 6005, 6134, 6264, 6397, 6531,
- 6668, 6807, 6947, 7090, 7234, 7381, 7529, 7679,
- 7831, 7984, 8140, 8297, 8455, 8616, 8778, 8941,
- 9107, 9273, 9442, 9611, 9782, 9955, 10129, 10304,
- 10481, 10659, 10838, 11019, 11200, 11383, 11567, 11752,
- 11938, 12125, 12313, 12502, 12693, 12883, 13075, 13268,
- 13461, 13655, 13850, 14046, 14242, 14439, 14637, 14835,
- 15033, 15232, 15432, 15631, 15832, 16032, 16233, 16434,
- 16635, 16837, 17039, 17240, 17442, 17644, 17846, 18048,
- 18250, 18452, 18653, 18855, 19056, 19257, 19458, 19658,
- 19858, 20058, 20257, 20456, 20654, 20852, 21049, 21245,
- 21441, 21637, 21831, 22025, 22218, 22410, 22602, 22792,
- 22982, 23170, 23358, 23545, 23730, 23915, 24098, 24280,
- 24461, 24641, 24820, 24997, 25173, 25348, 25521, 25693,
- 25863, 26032, 26200, 26366, 26530, 26693, 26854, 27014,
- 27171, 27328, 27482, 27635, 27786, 27935, 28082, 28227,
- 28371, 28513, 28652, 28790, 28926, 29059, 29191, 29320,
- 29448, 29573, 29697, 29818, 29937, 30053, 30168, 30280,
- 30390, 30498, 30603, 30706, 30807, 30905, 31002, 31095,
- 31186, 31275, 31362, 31446, 31527, 31606, 31683, 31757,
- 31828, 31897, 31963, 32027, 32088, 32147, 32203, 32257,
- 32307, 32356, 32401, 32444, 32484, 32522, 32557, 32589,
- 32619, 32646, 32670, 32692, 32711, 32727, 32741, 32751,
- 32760, 32765, 32767, 32767, 32762, 32751, 32734, 32712,
- 32685, 32652, 32614, 32570, 32521, 32466, 32406, 32341,
- 32270, 32194, 32112, 32026, 31934, 31837, 31735, 31627,
- 31515, 31398, 31275, 31148, 31016, 30878, 30737, 30590,
- 30438, 30282, 30122, 29957, 29787, 29613, 29434, 29252,
- 29065, 28874, 28679, 28480, 28277, 28070, 27859, 27644,
- 27426, 27205, 26980, 26751, 26520, 26285, 26047, 25805,
- 25561, 25314, 25065, 24812, 24557, 24300, 24040, 23777,
- 23513, 23246, 22978, 22707, 22435, 22161, 21885, 21608,
- 21329, 21049, 20768, 20485, 20202, 19918, 19632, 19347,
- 19060, 18773, 18486, 18198, 17911, 17623, 17335, 17047,
- 16760, 16473, 16186, 15900, 15614, 15330, 15046, 14763,
- 14481, 14200, 13921, 13643, 13367, 13092, 12818, 12547,
- 12277, 12010, 11744, 11481, 11220, 10961, 10705, 10451,
- 10200, 9951, 9706, 9463, 9223, 8987, 8754, 8523,
- 8297, 8073, 7854, 7637, 7425, 7216, 7011, 6810,
- 6613, 6420, 6231, 6046, 5865, 5689, 5517, 5350,
- 5187, 5028, 4875, 4726, 4581, 4442, 4307, 4177,
- 4052, 3932, 3818, 3708, 3603, 3503, 3409, 3320,
- 3236, 3157, 3084, 3016, 2953, 2895, 2844, 2797,
- 2756, 2720, 2690, 2665, 2646, 2632, 2624, 2621
-};
-
-const Word16 lag_window_8k[2][16] = /* LAGW_STRONG Q15*/
-{
- /* h */ { 32728, 32619, 32438, 32187, 31867, 31480, 31029, 30517, 29946, 29321, 28645, 27923, 27158, 26356, 25521, 24658 },
- /* l */ { 11904, 17280, 30720, 25856, 24192, 28992, 24384, 7360, 19456, 14720, 22080, 12928, 31040, 27328, 22080, 5184 }
-};
-const Word16 lag_window_12k8[NUM_LAGW_STRENGTHS][2][16] =
-{//Q15
- /* LAGW_WEAK */
- {
- /* h */ { 32763, 32758, 32750, 32739, 32725, 32707, 32687, 32663, 32637, 32607, 32574, 32538, 32498, 32456, 32411, 32362 },
- /* l */ { 4736, 13312, 16896, 15360, 8896, 30464, 14528, 27008, 2496, 6720, 7296, 4480, 31424, 22976, 12160, 32384 }
-},
-/* LAGW_MEDIUM */
-{
- /* h */ { 32758, 32739, 32707, 32663, 32607, 32538, 32456, 32362, 32257, 32139, 32009, 31867, 31714, 31549, 31374, 31187 },
- /* l */ { 13312, 15360, 30464, 27008, 6720, 4480, 22976, 32384, 3520, 5888, 11200, 24192, 17472, 29376, 576, 3136 }
-},
-/* LAGW_STRONG */
-{
- /* h */ { 32750, 32707, 32637, 32538, 32411, 32257, 32075, 31867, 31633, 31374, 31089, 30780, 30449, 30094, 29718, 29321 },
- /* l */ { 16896, 30464, 2496, 4480, 12160, 3520, 24256, 24192, 20736, 576, 18240, 31488, 128, 16704, 11520, 14720 }
-}
-};
-const Word16 lag_window_16k[NUM_LAGW_STRENGTHS][2][16] =
-{//Q15
- /* LAGW_WEAK */
- {
- /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 },
- /* l */ { 23360, 22272, 20672, 18304, 15360, 11904, 8000, 3648, 31808, 27008, 22080, 17280, 12608, 8256, 4480, 1344 }
-},
-/* LAGW_MEDIUM */
-{
- /* h */ { 32760, 32748, 32728, 32700, 32663, 32619, 32567, 32507, 32438, 32362, 32279, 32187, 32088, 31981, 31867, 31746 },
- /* l */ { 22272, 18304, 11904, 3648, 27008, 17280, 8256, 1344, 30720, 32384, 8256, 25856, 21824, 31360, 24192, 3072 }
-},
-/* LAGW_STRONG */
-{
- /* h */ { 32755, 32728, 32682, 32619, 32538, 32438, 32322, 32187, 32036, 31867, 31682, 31480, 31263, 31029, 30780, 30517 },
- /* l */ { 20672, 11904, 31808, 17280, 4480, 30720, 2944, 25856, 8320, 24192, 16896, 28992, 5824, 24384, 31488, 7360 }
-}
-};
-const Word16 lag_window_25k6[NUM_LAGW_STRENGTHS][2][16] =
-{//Q15
- /* LAGW_WEAK */
- {
- /* h */ { 32764, 32763, 32761, 32758, 32754, 32750, 32745, 32739, 32732, 32725, 32716, 32707, 32698, 32687, 32676, 32663 },
- /* l */ { 10752, 4736, 5568, 13312, 28096, 16896, 12672, 15360, 25024, 8896, 32576, 30464, 2624, 14528, 832, 27008 }
-},
-/* LAGW_MEDIUM */
-{
- /* h */ { 32763, 32758, 32750, 32739, 32725, 32707, 32687, 32663, 32637, 32607, 32574, 32538, 32498, 32456, 32411, 32362 },
- /* l */ { 4736, 13312, 16896, 15360, 8896, 30464, 14528, 27008, 2496, 6720, 7296, 4480, 31424, 22976, 12160, 32384 }
-},
-/* LAGW_STRONG */
-{
- /* h */ { 32761, 32750, 32732, 32707, 32676, 32637, 32591, 32538, 32478, 32411, 32337, 32257, 32169, 32075, 31975, 31867 },
- /* l */ { 5568, 16896, 25024, 30464, 832, 2496, 3328, 4480, 7040, 12160, 21440, 3520, 25728, 24256, 1216, 24192 }
-}
-};
-const Word16 lag_window_32k[NUM_LAGW_STRENGTHS][2][16] =
-{//Q15
- /* LAGW_WEAK */
- {
- /* h */ { 32764, 32763, 32762, 32760, 32758, 32755, 32752, 32748, 32744, 32739, 32734, 32728, 32722, 32715, 32707, 32700 },
- /* l */ { 15424, 23360, 14720, 22272, 13312, 20672, 11328, 18304, 8704, 15360, 5504, 11904, 1792, 8000, 30464, 3648 }
-},
-/* LAGW_MEDIUM */
-{
- /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 },
- /* l */ { 23360, 22272, 20672, 18304, 15360, 11904, 8000, 3648, 31808, 27008, 22080, 17280, 12608, 8256, 4480, 1344 }
-},
-/* LAGW_STRONG */
-{
- /* h */ { 32762, 32755, 32744, 32728, 32707, 32682, 32653, 32619, 32581, 32538, 32490, 32438, 32382, 32322, 32257, 32187 },
- /* l */ { 14720, 20672, 8704, 11904, 30464, 31808, 16384, 17280, 2240, 4480, 24704, 30720, 23168, 2944, 3520, 25856 }
-}
-};
-const Word16 lag_window_48k[2][16] = /* LAGW_STRONG */
-{//Q15
- /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 },
- /* l */ { 23360, 22272, 20672, 18304, 15360, 11904, 8000, 3648, 31808, 27008, 22080, 17280, 12608, 8256, 4480, 1344 }
-};
-
-/* 32 bit declarations */
-const Word32 lag_window_8k_32[16] = /* LAGW_STRONG */
-{//Q31
- 2144886016, 2137753344, 2125918208, 2109458944, 2088484096, 2063131264, 2033565312, 1999976832, 1962579968, 1921610496, 1877322880, 1829987584, 1779888768, 1727321472, 1672588416, 1615997056
-};
-
-const Word32 lag_window_12k8_32[NUM_LAGW_STRENGTHS][16] =
-{//Q31
- /* LAGW_WEAK */
- {
- 2147165440, 2146854912, 2146337792, 2145613824, 2144683392, 2143546880, 2142204288, 2140656384, 2138903424, 2136945792, 2134784256, 2132419328, 2129851776, 2127082368, 2124111616, 2120940800
-},
-/* LAGW_MEDIUM */
-{
- 2146854912, 2145613824, 2143546880, 2140656384, 2136945792, 2132419328, 2127082368, 2120940800, 2114001792, 2106273280, 2097764224, 2088484096, 2078443648, 2067654016, 2056127616, 2043877504
-},
-/* LAGW_STRONG */
-{
- 2146337792, 2143546880, 2138903424, 2132419328, 2124111616, 2114001792, 2102115712, 2088484096, 2073141760, 2056127616, 2037485184, 2017261056, 1995505920, 1972273792, 1947621888, 1921610496
-}
-};
-
-const Word32 lag_window_16k_32[NUM_LAGW_STRENGTHS][16] =
-{//Q31
- /* LAGW_WEAK */
- {
- 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440
-},
-/* LAGW_MEDIUM */
-{
- 2147003904, 2146209536, 2144886016, 2143034496, 2140656384, 2137753344, 2134327424, 2130381440, 2125918208, 2120940800, 2115453056, 2109458944, 2102962816, 2095969536, 2088484096, 2080512000
-},
-/* LAGW_STRONG */
-{
- 2146673024, 2144886016, 2141911168, 2137753344, 2132419328, 2125918208, 2118260480, 2109458944, 2099527936, 2088484096, 2076345344, 2063131264, 2048863616, 2033565312, 2017261056, 1999976832
-}
-};
-const Word32 lag_window_25k6_32[NUM_LAGW_STRENGTHS][16] =
-{//Q31
- /* LAGW_WEAK */
- {
- 2147243008, 2147165440, 2147036032, 2146854912, 2146622336, 2146337792, 2146001664, 2145613824, 2145174400, 2144683392, 2144140928, 2143546880, 2142901376, 2142204288, 2141456000, 2140656384
-},
-/* LAGW_MEDIUM */
-{
- 2147165440, 2146854912, 2146337792, 2145613824, 2144683392, 2143546880, 2142204288, 2140656384, 2138903424, 2136945792, 2134784256, 2132419328, 2129851776, 2127082368, 2124111616, 2120940800
-},
-/* LAGW_STRONG */
-{
- 2147036032, 2146337792, 2145174400, 2143546880, 2141456000, 2138903424, 2135890432, 2132419328, 2128492288, 2124111616, 2119280512, 2114001792, 2108279040, 2102115712, 2095516032, 2088484096
-}
-};
-const Word32 lag_window_32k_32[NUM_LAGW_STRENGTHS][16] =
-{//Q31
- /* LAGW_WEAK */
- {
- 2147252352, 2147202688, 2147119872, 2147003904, 2146854912, 2146673024, 2146457728, 2146209536, 2145928192, 2145613824, 2145266432, 2144886016, 2144472576, 2144026240, 2143546880, 2143034496
-},
-/* LAGW_MEDIUM */
-{
- 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440
-},
-/* LAGW_STRONG */
-{
- 2147119872, 2146673024, 2145928192, 2144886016, 2143546880, 2141911168, 2139979776, 2137753344, 2135232896, 2132419328, 2129314048, 2125918208, 2122233088, 2118260480, 2114001792, 2109458944
-}
-};
-const Word32 lag_window_48k_32[16] = /* LAGW_STRONG */
-{//Q31
- 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440
-};
-/*----------------------------------------------------------------------------------*
- * LP analysis - grid of points for evaluating Chebyshev polynomials
- *----------------------------------------------------------------------------------*/
-
-const Word16 grid50_fx[(GRID50_POINTS - 1) / 2 - 1] =
-{//Q15
- 32703, 32510, 32188, 31739, 31164, 30467,
- 29649, 28715, 27667, 26510, 25248, 23887,
- 22431, 20887, 19261, 17558, 15786, 13952,
- 12063, 10126, 8149, 6140, 4107, 2058
-};
-
-const Word16 grid40_fx[(GRID40_POINTS - 1) / 2 - 1] =
-{//Q15
- 32667, 32365, 31863, 31164, 30274, 29197,
- 27939, 26510, 24917, 23170, 21281, 19261,
- 17121, 14876, 12540, 10126, 7650, 5126,
- 2571
-};
-
-/*----------------------------------------------------------------------------------*
- * Sinus & Cosinus - table for the FFT and IFFT of 256 points,
- * dimension of the table = 161
- *----------------------------------------------------------------------------------*/
-const Word16 sincos_t_fx[161] =
-{
- /*Q15 */
- 0,
- 804, 1607, 2410, 3211, 4011,
- 4808, 5602, 6392, 7179, 7961,
- 8739, 9512, 10278, 11039, 11793,
- 12539, 13278, 14010, 14732, 15446,
- 16151, 16846, 17530, 18204, 18868,
- 19519, 20159, 20787, 21403, 22005,
- 22594, 23170, 23732, 24279, 24812,
- 25330, 25832, 26319, 26790, 27245,
- 27684, 28106, 28511, 28898, 29269,
- 29621, 29956, 30273, 30572, 30852,
- 31114, 31357, 31581, 31785, 31971,
- 32138, 32285, 32413, 32521, 32610,
- 32679, 32728, 32758, 32767, 32758,
- 32728, 32679, 32610, 32521, 32413,
- 32285, 32138, 31971, 31785, 31581,
- 31357, 31114, 30852, 30572, 30273,
- 29956, 29621, 29269, 28898, 28511,
- 28106, 27684, 27245, 26790, 26319,
- 25832, 25330, 24812, 24279, 23732,
- 23170, 22594, 22005, 21403, 20787,
- 20159, 19519, 18868, 18204, 17530,
- 16846, 16151, 15446, 14732, 14010,
- 13278, 12539, 11793, 11039, 10278,
- 9512, 8739, 7961, 7179, 6392,
- 5602, 4808, 4011, 3211, 2410,
- 1607, 804, 0, -804, -1607,
- -2410, -3211, -4011, -4808, -5602,
- -6392, -7179, -7961, -8739, -9512,
- -10278, -11039, -11793, -12539, -13278,
- -14010, -14732, -15446, -16151, -16846,
- -17530, -18204, -18868, -19519, -20159,
- -20787, -21403, -22005, -22594, -23170,
-};
-
-
-/*----------------------------------------------------------------------------------*
- * Sinus & Cosinus - table for the FFT and IFFT of 1024 points, value range [0 ... sin(-5pi/4)]
- * dimension of the table = 641=4*256*(5/8)+1
- *----------------------------------------------------------------------------------*/
-
-/* every 4th value is identical to sincos_t above but as sincos_t is also used in SWB TBE a separate table has been defined here */
-const float sincos_t_ext[641] =
-{
- 0.0f,
- 0.006135884649154f, 0.012271538285720f, 0.018406729905805f, 0.024541228522912f, 0.030674803176637f, 0.036807222941359f, 0.042938256934941f, 0.049067674327418f,
- 0.055195244349690f, 0.061320736302209f, 0.067443919563664f, 0.073564563599667f, 0.079682437971430f, 0.085797312344440f, 0.091908956497133f, 0.098017140329561f,
- 0.104121633872055f, 0.110222207293883f, 0.116318630911905f, 0.122410675199216f, 0.128498110793793f, 0.134580708507126f, 0.140658239332849f, 0.146730474455362f,
- 0.152797185258443f, 0.158858143333861f, 0.164913120489970f, 0.170961888760301f, 0.177004220412149f, 0.183039887955141f, 0.189068664149806f, 0.195090322016128f,
- 0.201104634842092f, 0.207111376192219f, 0.213110319916091f, 0.219101240156870f, 0.225083911359793f, 0.231058108280671f, 0.237023605994367f, 0.242980179903264f,
- 0.248927605745720f, 0.254865659604515f, 0.260794117915276f, 0.266712757474898f, 0.272621355449949f, 0.278519689385053f, 0.284407537211272f, 0.290284677254462f,
- 0.296150888243624f, 0.302005949319228f, 0.307849640041535f, 0.313681740398892f, 0.319502030816016f, 0.325310292162263f, 0.331106305759876f, 0.336889853392220f,
- 0.342660717311994f, 0.348418680249435f, 0.354163525420490f, 0.359895036534988f, 0.365612997804774f, 0.371317193951837f, 0.377007410216418f, 0.382683432365090f,
- 0.388345046698826f, 0.393992040061048f, 0.399624199845647f, 0.405241314004990f, 0.410843171057904f, 0.416429560097637f, 0.422000270799800f, 0.427555093430282f,
- 0.433093818853152f, 0.438616238538528f, 0.444122144570429f, 0.449611329654607f, 0.455083587126344f, 0.460538710958240f, 0.465976495767966f, 0.471396736825998f,
- 0.476799230063322f, 0.482183772079123f, 0.487550160148436f, 0.492898192229784f, 0.498227666972782f, 0.503538383725718f, 0.508830142543107f, 0.514102744193222f,
- 0.519355990165590f, 0.524589682678469f, 0.529803624686295f, 0.534997619887097f, 0.540171472729893f, 0.545324988422046f, 0.550457972936605f, 0.555570233019602f,
- 0.560661576197336f, 0.565731810783613f, 0.570780745886967f, 0.575808191417845f, 0.580813958095765f, 0.585797857456439f, 0.590759701858874f, 0.595699304492433f,
- 0.600616479383869f, 0.605511041404326f, 0.610382806276309f, 0.615231590580627f, 0.620057211763289f, 0.624859488142386f, 0.629638238914927f, 0.634393284163645f,
- 0.639124444863776f, 0.643831542889791f, 0.648514401022112f, 0.653172842953777f, 0.657806693297079f, 0.662415777590172f, 0.666999922303637f, 0.671558954847018f,
- 0.676092703575316f, 0.680600997795453f, 0.685083667772700f, 0.689540544737067f, 0.693971460889654f, 0.698376249408973f, 0.702754744457225f, 0.707106781186547f,
- 0.711432195745216f, 0.715730825283819f, 0.720002507961382f, 0.724247082951467f, 0.728464390448225f, 0.732654271672413f, 0.736816568877370f, 0.740951125354959f,
- 0.745057785441466f, 0.749136394523459f, 0.753186799043613f, 0.757208846506485f, 0.761202385484262f, 0.765167265622459f, 0.769103337645580f, 0.773010453362737f,
- 0.776888465673232f, 0.780737228572094f, 0.784556597155575f, 0.788346427626606f, 0.792106577300212f, 0.795836904608884f, 0.799537269107905f, 0.803207531480645f,
- 0.806847553543799f, 0.810457198252595f, 0.814036329705948f, 0.817584813151584f, 0.821102514991105f, 0.824589302785025f, 0.828045045257756f, 0.831469612302545f,
- 0.834862874986380f, 0.838224705554838f, 0.841554977436898f, 0.844853565249707f, 0.848120344803297f, 0.851355193105265f, 0.854557988365401f, 0.857728610000272f,
- 0.860866938637767f, 0.863972856121587f, 0.867046245515693f, 0.870086991108711f, 0.873094978418290f, 0.876070094195407f, 0.879012226428633f, 0.881921264348355f,
- 0.884797098430938f, 0.887639620402854f, 0.890448723244758f, 0.893224301195515f, 0.895966249756185f, 0.898674465693954f, 0.901348847046022f, 0.903989293123443f,
- 0.906595704514915f, 0.909167983090522f, 0.911706032005430f, 0.914209755703531f, 0.916679059921043f, 0.919113851690058f, 0.921514039342042f, 0.923879532511287f,
- 0.926210242138311f, 0.928506080473216f, 0.930766961078984f, 0.932992798834739f, 0.935183509938948f, 0.937339011912575f, 0.939459223602190f, 0.941544065183021f,
- 0.943593458161960f, 0.945607325380521f, 0.947585591017741f, 0.949528180593037f, 0.951435020969008f, 0.953306040354194f, 0.955141168305771f, 0.956940335732209f,
- 0.958703474895872f, 0.960430519415566f, 0.962121404269042f, 0.963776065795440f, 0.965394441697689f, 0.966976471044852f, 0.968522094274417f, 0.970031253194544f,
- 0.971503890986252f, 0.972939952205560f, 0.974339382785576f, 0.975702130038529f, 0.977028142657754f, 0.978317370719628f, 0.979569765685441f, 0.980785280403230f,
- 0.981963869109555f, 0.983105487431216f, 0.984210092386929f, 0.985277642388941f, 0.986308097244599f, 0.987301418157858f, 0.988257567730749f, 0.989176509964781f,
- 0.990058210262297f, 0.990902635427780f, 0.991709753669100f, 0.992479534598710f, 0.993211949234795f, 0.993906970002356f, 0.994564570734255f, 0.995184726672197f,
- 0.995767414467660f, 0.996312612182778f, 0.996820299291166f, 0.997290456678690f, 0.997723066644192f, 0.998118112900149f, 0.998475580573295f, 0.998795456205172f,
- 0.999077727752645f, 0.999322384588350f, 0.999529417501093f, 0.999698818696204f, 0.999830581795823f, 0.999924701839145f, 0.999981175282601f, 1.000000000000000f,
- 0.999981175282601f, 0.999924701839145f, 0.999830581795823f, 0.999698818696204f, 0.999529417501093f, 0.999322384588350f, 0.999077727752645f, 0.998795456205172f,
- 0.998475580573295f, 0.998118112900149f, 0.997723066644192f, 0.997290456678690f, 0.996820299291166f, 0.996312612182778f, 0.995767414467660f, 0.995184726672197f,
- 0.994564570734255f, 0.993906970002356f, 0.993211949234795f, 0.992479534598710f, 0.991709753669100f, 0.990902635427780f, 0.990058210262297f, 0.989176509964781f,
- 0.988257567730749f, 0.987301418157858f, 0.986308097244599f, 0.985277642388941f, 0.984210092386929f, 0.983105487431216f, 0.981963869109555f, 0.980785280403230f,
- 0.979569765685441f, 0.978317370719628f, 0.977028142657754f, 0.975702130038529f, 0.974339382785576f, 0.972939952205560f, 0.971503890986252f, 0.970031253194544f,
- 0.968522094274417f, 0.966976471044852f, 0.965394441697689f, 0.963776065795440f, 0.962121404269042f, 0.960430519415566f, 0.958703474895872f, 0.956940335732209f,
- 0.955141168305771f, 0.953306040354194f, 0.951435020969008f, 0.949528180593037f, 0.947585591017741f, 0.945607325380521f, 0.943593458161960f, 0.941544065183021f,
- 0.939459223602190f, 0.937339011912575f, 0.935183509938948f, 0.932992798834739f, 0.930766961078984f, 0.928506080473216f, 0.926210242138311f, 0.923879532511287f,
- 0.921514039342042f, 0.919113851690058f, 0.916679059921043f, 0.914209755703531f, 0.911706032005430f, 0.909167983090522f, 0.906595704514915f, 0.903989293123443f,
- 0.901348847046022f, 0.898674465693954f, 0.895966249756185f, 0.893224301195515f, 0.890448723244758f, 0.887639620402854f, 0.884797098430938f, 0.881921264348355f,
- 0.879012226428634f, 0.876070094195407f, 0.873094978418290f, 0.870086991108711f, 0.867046245515693f, 0.863972856121587f, 0.860866938637767f, 0.857728610000272f,
- 0.854557988365401f, 0.851355193105265f, 0.848120344803297f, 0.844853565249707f, 0.841554977436898f, 0.838224705554838f, 0.834862874986380f, 0.831469612302545f,
- 0.828045045257756f, 0.824589302785025f, 0.821102514991105f, 0.817584813151584f, 0.814036329705949f, 0.810457198252595f, 0.806847553543799f, 0.803207531480645f,
- 0.799537269107905f, 0.795836904608884f, 0.792106577300212f, 0.788346427626606f, 0.784556597155575f, 0.780737228572095f, 0.776888465673232f, 0.773010453362737f,
- 0.769103337645580f, 0.765167265622459f, 0.761202385484262f, 0.757208846506485f, 0.753186799043613f, 0.749136394523459f, 0.745057785441466f, 0.740951125354959f,
- 0.736816568877370f, 0.732654271672413f, 0.728464390448225f, 0.724247082951467f, 0.720002507961382f, 0.715730825283819f, 0.711432195745217f, 0.707106781186548f,
- 0.702754744457225f, 0.698376249408973f, 0.693971460889654f, 0.689540544737067f, 0.685083667772700f, 0.680600997795453f, 0.676092703575316f, 0.671558954847019f,
- 0.666999922303638f, 0.662415777590172f, 0.657806693297079f, 0.653172842953777f, 0.648514401022113f, 0.643831542889791f, 0.639124444863776f, 0.634393284163645f,
- 0.629638238914927f, 0.624859488142386f, 0.620057211763289f, 0.615231590580627f, 0.610382806276310f, 0.605511041404326f, 0.600616479383869f, 0.595699304492433f,
- 0.590759701858874f, 0.585797857456439f, 0.580813958095765f, 0.575808191417845f, 0.570780745886967f, 0.565731810783613f, 0.560661576197336f, 0.555570233019602f,
- 0.550457972936605f, 0.545324988422046f, 0.540171472729893f, 0.534997619887097f, 0.529803624686295f, 0.524589682678469f, 0.519355990165590f, 0.514102744193222f,
- 0.508830142543107f, 0.503538383725718f, 0.498227666972782f, 0.492898192229784f, 0.487550160148436f, 0.482183772079123f, 0.476799230063322f, 0.471396736825998f,
- 0.465976495767966f, 0.460538710958240f, 0.455083587126344f, 0.449611329654607f, 0.444122144570429f, 0.438616238538528f, 0.433093818853152f, 0.427555093430282f,
- 0.422000270799800f, 0.416429560097637f, 0.410843171057904f, 0.405241314004990f, 0.399624199845647f, 0.393992040061048f, 0.388345046698827f, 0.382683432365090f,
- 0.377007410216418f, 0.371317193951838f, 0.365612997804774f, 0.359895036534988f, 0.354163525420490f, 0.348418680249435f, 0.342660717311994f, 0.336889853392220f,
- 0.331106305759876f, 0.325310292162263f, 0.319502030816016f, 0.313681740398891f, 0.307849640041535f, 0.302005949319228f, 0.296150888243624f, 0.290284677254462f,
- 0.284407537211272f, 0.278519689385053f, 0.272621355449949f, 0.266712757474898f, 0.260794117915276f, 0.254865659604515f, 0.248927605745720f, 0.242980179903264f,
- 0.237023605994367f, 0.231058108280671f, 0.225083911359793f, 0.219101240156870f, 0.213110319916091f, 0.207111376192219f, 0.201104634842092f, 0.195090322016129f,
- 0.189068664149806f, 0.183039887955141f, 0.177004220412149f, 0.170961888760301f, 0.164913120489970f, 0.158858143333861f, 0.152797185258444f, 0.146730474455362f,
- 0.140658239332850f, 0.134580708507126f, 0.128498110793793f, 0.122410675199216f, 0.116318630911905f, 0.110222207293883f, 0.104121633872055f, 0.098017140329561f,
- 0.091908956497133f, 0.085797312344440f, 0.079682437971430f, 0.073564563599668f, 0.067443919563664f, 0.061320736302208f, 0.055195244349690f, 0.049067674327418f,
- 0.042938256934941f, 0.036807222941359f, 0.030674803176637f, 0.024541228522912f, 0.018406729905805f, 0.012271538285720f, 0.006135884649155f, 0.000000000000000f,
- -0.006135884649155f, -0.012271538285720f, -0.018406729905805f, -0.024541228522912f, -0.030674803176637f, -0.036807222941359f, -0.042938256934941f, -0.049067674327418f,
- -0.055195244349690f, -0.061320736302208f, -0.067443919563664f, -0.073564563599667f, -0.079682437971430f, -0.085797312344440f, -0.091908956497133f, -0.098017140329561f,
- -0.104121633872054f, -0.110222207293883f, -0.116318630911904f, -0.122410675199216f, -0.128498110793793f, -0.134580708507126f, -0.140658239332849f, -0.146730474455362f,
- -0.152797185258443f, -0.158858143333861f, -0.164913120489970f, -0.170961888760301f, -0.177004220412149f, -0.183039887955141f, -0.189068664149806f, -0.195090322016128f,
- -0.201104634842092f, -0.207111376192219f, -0.213110319916091f, -0.219101240156870f, -0.225083911359793f, -0.231058108280671f, -0.237023605994367f, -0.242980179903264f,
- -0.248927605745720f, -0.254865659604514f, -0.260794117915276f, -0.266712757474898f, -0.272621355449949f, -0.278519689385053f, -0.284407537211272f, -0.290284677254462f,
- -0.296150888243624f, -0.302005949319228f, -0.307849640041535f, -0.313681740398891f, -0.319502030816016f, -0.325310292162263f, -0.331106305759876f, -0.336889853392220f,
- -0.342660717311994f, -0.348418680249435f, -0.354163525420490f, -0.359895036534988f, -0.365612997804774f, -0.371317193951837f, -0.377007410216418f, -0.382683432365090f,
- -0.388345046698826f, -0.393992040061048f, -0.399624199845647f, -0.405241314004990f, -0.410843171057904f, -0.416429560097637f, -0.422000270799800f, -0.427555093430282f,
- -0.433093818853152f, -0.438616238538527f, -0.444122144570429f, -0.449611329654607f, -0.455083587126344f, -0.460538710958240f, -0.465976495767966f, -0.471396736825998f,
- -0.476799230063322f, -0.482183772079123f, -0.487550160148436f, -0.492898192229784f, -0.498227666972782f, -0.503538383725717f, -0.508830142543107f, -0.514102744193222f,
- -0.519355990165590f, -0.524589682678469f, -0.529803624686295f, -0.534997619887097f, -0.540171472729893f, -0.545324988422046f, -0.550457972936605f, -0.555570233019602f,
- -0.560661576197336f, -0.565731810783613f, -0.570780745886967f, -0.575808191417845f, -0.580813958095764f, -0.585797857456439f, -0.590759701858874f, -0.595699304492433f,
- -0.600616479383869f, -0.605511041404325f, -0.610382806276309f, -0.615231590580627f, -0.620057211763289f, -0.624859488142386f, -0.629638238914927f, -0.634393284163645f,
- -0.639124444863776f, -0.643831542889791f, -0.648514401022112f, -0.653172842953777f, -0.657806693297079f, -0.662415777590172f, -0.666999922303637f, -0.671558954847018f,
- -0.676092703575316f, -0.680600997795453f, -0.685083667772700f, -0.689540544737067f, -0.693971460889654f, -0.698376249408973f, -0.702754744457225f, -0.707106781186547f
-};
-
-const Word16 sincos_t_ext_fx[641] =
-{//Q15
- 0, 201, 402, 603, 804, 1005, 1206, 1407,
- 1608, 1809, 2009, 2210, 2411, 2611, 2811, 3012,
- 3212, 3412, 3612, 3812, 4011, 4211, 4410, 4609,
- 4808, 5007, 5205, 5404, 5602, 5800, 5998, 6195,
- 6393, 6590, 6787, 6983, 7180, 7376, 7571, 7767,
- 7962, 8157, 8351, 8546, 8740, 8933, 9127, 9319,
- 9512, 9704, 9896, 10088, 10279, 10469, 10660, 10850,
- 11039, 11228, 11417, 11605, 11793, 11980, 12167, 12354,
- 12540, 12725, 12910, 13095, 13279, 13463, 13646, 13828,
- 14010, 14192, 14373, 14553, 14733, 14912, 15091, 15269,
- 15447, 15624, 15800, 15976, 16151, 16326, 16500, 16673,
- 16846, 17018, 17190, 17361, 17531, 17700, 17869, 18037,
- 18205, 18372, 18538, 18703, 18868, 19032, 19195, 19358,
- 19520, 19681, 19841, 20001, 20160, 20318, 20475, 20632,
- 20788, 20943, 21097, 21251, 21403, 21555, 21706, 21856,
- 22006, 22154, 22302, 22449, 22595, 22740, 22884, 23028,
- 23170, 23312, 23453, 23593, 23732, 23870, 24008, 24144,
- 24279, 24414, 24548, 24680, 24812, 24943, 25073, 25202,
- 25330, 25457, 25583, 25708, 25833, 25956, 26078, 26199,
- 26320, 26439, 26557, 26674, 26791, 26906, 27020, 27133,
- 27246, 27357, 27467, 27576, 27684, 27791, 27897, 28002,
- 28106, 28209, 28311, 28411, 28511, 28610, 28707, 28803,
- 28899, 28993, 29086, 29178, 29269, 29359, 29448, 29535,
- 29622, 29707, 29792, 29875, 29957, 30038, 30118, 30196,
- 30274, 30350, 30425, 30499, 30572, 30644, 30715, 30784,
- 30853, 30920, 30986, 31050, 31114, 31177, 31238, 31298,
- 31357, 31415, 31471, 31527, 31581, 31634, 31686, 31737,
- 31786, 31834, 31881, 31927, 31972, 32015, 32058, 32099,
- 32138, 32177, 32214, 32251, 32286, 32319, 32352, 32383,
- 32413, 32442, 32470, 32496, 32522, 32546, 32568, 32590,
- 32610, 32629, 32647, 32664, 32679, 32693, 32706, 32718,
- 32729, 32738, 32746, 32753, 32758, 32762, 32766, 32767,
- 32767, 32767, 32766, 32762, 32758, 32753, 32746, 32738,
- 32729, 32718, 32706, 32693, 32679, 32664, 32647, 32629,
- 32610, 32590, 32568, 32546, 32522, 32496, 32470, 32442,
- 32413, 32383, 32352, 32319, 32286, 32251, 32214, 32177,
- 32138, 32099, 32058, 32015, 31972, 31927, 31881, 31834,
- 31786, 31737, 31686, 31634, 31581, 31527, 31471, 31415,
- 31357, 31298, 31238, 31177, 31114, 31050, 30986, 30920,
- 30853, 30784, 30715, 30644, 30572, 30499, 30425, 30350,
- 30274, 30196, 30118, 30038, 29957, 29875, 29792, 29707,
- 29622, 29535, 29448, 29359, 29269, 29178, 29086, 28993,
- 28899, 28803, 28707, 28610, 28511, 28411, 28311, 28209,
- 28106, 28002, 27897, 27791, 27684, 27576, 27467, 27357,
- 27246, 27133, 27020, 26906, 26791, 26674, 26557, 26439,
- 26320, 26199, 26078, 25956, 25833, 25708, 25583, 25457,
- 25330, 25202, 25073, 24943, 24812, 24680, 24548, 24414,
- 24279, 24144, 24008, 23870, 23732, 23593, 23453, 23312,
- 23170, 23028, 22884, 22740, 22595, 22449, 22302, 22154,
- 22006, 21856, 21706, 21555, 21403, 21251, 21097, 20943,
- 20788, 20632, 20475, 20318, 20160, 20001, 19841, 19681,
- 19520, 19358, 19195, 19032, 18868, 18703, 18538, 18372,
- 18205, 18037, 17869, 17700, 17531, 17361, 17190, 17018,
- 16846, 16673, 16500, 16326, 16151, 15976, 15800, 15624,
- 15447, 15269, 15091, 14912, 14733, 14553, 14373, 14192,
- 14010, 13828, 13646, 13463, 13279, 13095, 12910, 12725,
- 12540, 12354, 12167, 11980, 11793, 11605, 11417, 11228,
- 11039, 10850, 10660, 10469, 10279, 10088, 9896, 9704,
- 9512, 9319, 9127, 8933, 8740, 8546, 8351, 8157,
- 7962, 7767, 7571, 7376, 7180, 6983, 6787, 6590,
- 6393, 6195, 5998, 5800, 5602, 5404, 5205, 5007,
- 4808, 4609, 4410, 4211, 4011, 3812, 3612, 3412,
- 3212, 3012, 2811, 2611, 2411, 2210, 2009, 1809,
- 1608, 1407, 1206, 1005, 804, 603, 402, 201,
- 0, -201, -402, -603, -804, -1005, -1206, -1407,
- -1608, -1809, -2009, -2210, -2411, -2611, -2811, -3012,
- -3212, -3412, -3612, -3812, -4011, -4211, -4410, -4609,
- -4808, -5007, -5205, -5404, -5602, -5800, -5998, -6195,
- -6393, -6590, -6787, -6983, -7180, -7376, -7571, -7767,
- -7962, -8157, -8351, -8546, -8740, -8933, -9127, -9319,
- -9512, -9704, -9896, -10088, -10279, -10469, -10660, -10850,
- -11039, -11228, -11417, -11605, -11793, -11980, -12167, -12354,
- -12540, -12725, -12910, -13095, -13279, -13463, -13646, -13828,
- -14010, -14192, -14373, -14553, -14733, -14912, -15091, -15269,
- -15447, -15624, -15800, -15976, -16151, -16326, -16500, -16673,
- -16846, -17018, -17190, -17361, -17531, -17700, -17869, -18037,
- -18205, -18372, -18538, -18703, -18868, -19032, -19195, -19358,
- -19520, -19681, -19841, -20001, -20160, -20318, -20475, -20632,
- -20788, -20943, -21097, -21251, -21403, -21555, -21706, -21856,
- -22006, -22154, -22302, -22449, -22595, -22740, -22884, -23028,
- -23028
-};/*Q15*/
-
-
-const Word16 Asr_LP16_fx[21] =
-{
- /*Q15 */
- 0, 110, 0, -428, 0, 1153, 0, -2832,
- 0, 10199, 16384, 10199, 0, -2832, 0, 1153,
- 0, -428, 0, 110, 0
-};
-
-const Word16 Asr_LP32_fx[41] =
-{
- /*Q15 */
- 0, 24, 55, 58, 0, -113, -214, -198,
- 0, 323, 576, 510, 0, -795, -1416, -1280,
- 0, 2337, 5099, 7334, 8192, 7334, 5099, 2337,
- 0, -1280, -1416, -795, 0, 510, 576, 323,
- 0, -198, -214, -113, 0, 58, 55, 24,
- 0
-};
-
-const Word16 Asr_LP48_fx[61] =
-{
- /*Q17 */
- 0, 38, 93, 146, 167, 123, 0, -192,
- -408, -571, -592, -407, 0, 564, 1143, 1537,
- 1546, 1035, 0, -1391, -2801, -3776, -3843, -2635,
- 0, 3919, 8679, 13599, 17887, 20809, 21845, 20809,
- 17887, 13599, 8679, 3919, 0, -2635, -3843, -3776,
- -2801, -1391, 0, 1035, 1546, 1537, 1143, 564,
- 0, -407, -592, -571, -408, -192, 0, 123,
- 167, 146, 93, 38, 0
-};
-
-const Word16 fft256_read_indexes[]= // Q0
-{
- 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
- 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
- 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
- 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
- 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
- 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
- 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,
- 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,
- 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
- 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,
- 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,
- 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
- 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
- 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,
- 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
- 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255
-};
-
-
-/*----------------------------------------------------------------------------------*
- * Sinus & Cosinus - table for the DCT-IV based 2
- *----------------------------------------------------------------------------------*/
-
-const Word16 sin_table256_fx[] =
-{//Q15
- 101, 302, 503, 704, 905, 1106, 1307, 1507, 1708,
- 1909, 2110, 2310, 2511, 2711, 2912, 3112, 3312, 3512,
- 3712, 3911, 4111, 4310, 4510, 4709, 4907, 5106, 5305,
- 5503, 5701, 5899, 6097, 6294, 6491, 6688, 6885, 7081,
- 7278, 7473, 7669, 7864, 8059, 8254, 8449, 8643, 8836,
- 9030, 9223, 9416, 9608, 9800, 9992, 10183, 10374, 10565,
- 10755, 10945, 11134, 11323, 11511, 11699, 11887, 12074, 12261,
- 12447, 12633, 12818, 13003, 13187, 13371, 13554, 13737, 13919,
- 14101, 14282, 14463, 14643, 14823, 15002, 15180, 15358, 15535,
- 15712, 15888, 16064, 16239, 16413, 16587, 16760, 16932, 17104,
- 17275, 17446, 17616, 17785, 17953, 18121, 18288, 18455, 18621,
- 18786, 18950, 19114, 19277, 19439, 19601, 19761, 19921, 20081,
- 20239, 20397, 20554, 20710, 20865, 21020, 21174, 21327, 21479,
- 21631, 21781, 21931, 22080, 22228, 22375, 22522, 22668, 22812,
- 22956, 23099, 23241, 23383, 23523, 23663, 23801, 23939, 24076,
- 24212, 24347, 24481, 24614, 24746, 24878, 25008, 25138, 25266,
- 25394, 25520, 25646, 25771, 25894, 26017, 26139, 26259, 26379,
- 26498, 26616, 26733, 26848, 26963, 27077, 27190, 27301, 27412,
- 27522, 27630, 27738, 27844, 27950, 28054, 28158, 28260, 28361,
- 28461, 28560, 28658, 28755, 28851, 28946, 29040, 29132, 29224,
- 29314, 29404, 29492, 29579, 29665, 29750, 29833, 29916, 29997,
- 30078, 30157, 30235, 30312, 30388, 30462, 30536, 30608, 30680,
- 30750, 30819, 30886, 30953, 31018, 31082, 31146, 31207, 31268,
- 31328, 31386, 31443, 31499, 31554, 31608, 31660, 31711, 31761,
- 31810, 31858, 31904, 31950, 31994, 32037, 32078, 32119, 32158,
- 32196, 32233, 32268, 32303, 32336, 32368, 32398, 32428, 32456,
- 32483, 32509, 32534, 32557, 32579, 32600, 32620, 32638, 32656,
- 32672, 32686, 32700, 32712, 32723, 32733, 32742, 32749, 32756,
- 32760, 32764, 32767, 32767
-};
-/*----------------------------------------------------------------------------------*
- * 1/4 resolution interpolation filter (-3 dB at 0.913*fs/2)
- *----------------------------------------------------------------------------------*/
-
-const Word16 inter4_2_fx[] =
-{//evs table , some mismatch in values compared to float is observed
- 0, 1, 2, 1,
- -2, -7, -10, -7,
- 4, 19, 28, 22,
- -2, -33, -55, -49,
- -10, 47, 91, 92,
- 38, -52, -133, -153,
- -88, 43, 175, 231,
- 165, -9, -209, -325,
- -275, -60, 226, 431,
- 424, 175, -213, -544,
- -619, -355, 153, 656,
- 871, 626, -16, -762,
- -1207, -1044, -249, 853,
- 1699, 1749, 780, -923,
- -2598, -3267, -2147, 968,
- 5531, 10359, 14031, 15401,
- 14031, 10359, 5531, 968,
- -2147, -3267, -2598, -923,
- 780, 1749, 1699, 853,
- -249, -1044, -1207, -762,
- -16, 626, 871, 656,
- 153, -355, -619, -544,
- -213, 175, 424, 431,
- 226, -60, -275, -325,
- -209, -9, 165, 231,
- 175, 43, -88, -153,
- -133, -52, 38, 92,
- 91, 47, -10, -49,
- -55, -33, -2, 22,
- 28, 19, 4, -7,
- -10, -7, -2, 1,
- 2, 1, 0, 0
-};
-
-/* 1/4 resolution interpolation filter (-3 dB at 0.856*fs/2) */
-const Word32 L_pitch_inter4_2[PIT_FIR_SIZE2] = { /* Q31 */
- 2018634624, 1839083520, 1357785216, 724904576, 126856152, -281447072,
- -428193216, -340524320, -121030032, 102233104, 229241728, 222704784,
- 111802296, -32603096, -136805440, -158183648, -99851544, -2110976,
- 82091856, 114123720, 86026048, 19988778, -46544560, -81104016,
- -71266392, -27977416, 22982370, 55621972, 56517476, 29680372,
- -7827578, -36105644, -42638288, -27414776, -1138166, 21646636,
- 30326764, 22885734, 5570572, -11516955, -20066088, -17396766,
- -6833293, 5003637, 12101070, 11944304, 6107443, -1346472, -6427418,
- -7219840, -4389456, -249108, 2823941, 3633542, 2471753, 556198,
- -895500, -1327144, -932007, -285615, 135291, 210453, 103079, 15032, 0
-};
-const Word16 pitch_inter4_2[PIT_FIR_SIZE2] =
-{
- /* cut-off frequency at 0.94*fs/2 */
- 30802/*0.940000f Q15*/,
- 28062/*0.856390f Q15*/, 20718/*0.632268f Q15*/, 11061/*0.337560f Q15*/, 1936/*0.059072f Q15*/,
- -4295/*-0.131059f Q15*/, -6534/*-0.199393f Q15*/, -5196/*-0.158569f Q15*/, -1847/*-0.056359f Q15*/,
- 1560/*0.047606f Q15*/, 3498/*0.106749f Q15*/, 3398/*0.1037059f Q15*/, 1706/*0.052062f Q15*/,
- -497/*-0.015182f Q15*/, -2087/*-0.063705f Q15*/, -2414/*-0.073660f Q15*/, -1524/*-0.046497f Q15*/,
- -32/*-0.000983f Q15*/, 1253/*0.038227f Q15*/, 1741/*0.053143f Q15*/, 1313/*0.040059f Q15*/,
- 305/*0.009308f Q15*/, -710/*-0.021674f Q15*/, -1238/*-0.037767f Q15*/, -1087/*-0.033186f Q15*/,
- -427/*-0.013028f Q15*/, 351/*0.010702f Q15*/, 849/*0.025901f Q15*/, 862/*0.026318f Q15*/,
- 453/*0.013821f Q15*/, -119/*-0.003645f Q15*/, -551/*-0.016813f Q15*/, -651/*-0.019855f Q15*/,
- -418/*-0.012766f Q15*/, -17/*-0.000530f Q15*/, 330/*0.010080f Q15*/, 463/*0.014122f Q15*/,
- 349/*0.010657f Q15*/, 85/*0.002594f Q15*/, -176/*-0.005363f Q15*/, -306/*-0.009344f Q15*/,
- -265/*-0.008101f Q15*/, -104/*-0.003182f Q15*/, 76/*0.002330f Q15*/, 185/*0.005635f Q15*/,
- 182/*0.005562f Q15*/, 93/*0.002844f Q15*/, -21/*-0.000627f Q15*/, -98/*-0.002993f Q15*/,
- -110/*-0.003362f Q15*/, -67/*-0.002044f Q15*/, -4/*-0.000116f Q15*/, 43/*0.001315f Q15*/,
- 55/*0.001692f Q15*/, 38/*0.001151f Q15*/, 8/*0.000259f Q15*/, -14/*-0.000417f Q15*/,
- -20/*-0.000618f Q15*/, -14/*-0.000434f Q15*/, -4/*-0.000133f Q15*/, 2/*0.000063f Q15*/,
- 3/*0.000098f Q15*/, 2/*0.000048f Q15*/, 0/*0.000007f Q15*/, 0/*0.000000f Q15*/
-};
-/* 1/4 resolution interpolation filter (-3 dB at 0.791*fs/2) */
-const Word32 L_pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1] = /* Q31 */
-{
- 1932735283, 1758701061, 1298905484, 711630983, 180298432, -162768528,
- -280712608, -226956816, -100446400, 9592809, 59676424, 55065776,
- 26996016, 4138201, -3373696, -1617055, 0
-};
-/* 1/4 resolution interpolation filter (-3 dB at 0.791*fs/2) */
-const Word16 pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1] =
-{
- 29491/*0.900000F Q15*/,
- 26836/*0.818959F Q15*/, 19820/* 0.604850F Q15*/, 10859/* 0.331379F Q15*/, 2751/* 0.083958F Q15*/,
- -2484/*-0.075795F Q15*/, -4283/* -0.130717F Q15*/, -3463/*-0.105685F Q15*/, -1533/*-0.046774F Q15*/,
- 146/*0.004467F Q15*/, 911/* 0.027789F Q15*/, 840/* 0.025642F Q15*/, 412/* 0.012571F Q15*/,
- 63/*0.001927F Q15*/, -51/* -0.001571F Q15*/, -25/*-0.000753F Q15*/, 0/* 0.000000f Q15*/
-};
-
-/*----------------------------------------------------------------------------------*
- * 1/6 resolution interpolation filter (-3 dB at 0.95*fs/2)
- *----------------------------------------------------------------------------------*/
-
-/* 1/6 resolution interpolation filter (-3 dB at 0.95*fs/2) */
-const Word16 pitch_inter6_2[PIT_FIR_SIZE6_2] =
-{
- 31129/*0.949986374119862f Q15*/,
- 29854/*0.911081104469830f Q15*/,
- 26218/*0.800115099292852f Q15*/,
- 20753/*0.633320673120883f Q15*/,
- 14240/*0.434558462154083f Q15*/,
- 7575/*0.231177017786780f Q15*/,
- 1618/*0.049378173063717f Q15*/,
- -2950/*-0.090039611811170f Q15*/,
- -5727/*-0.174782560924477f Q15*/,
- -6635/*-0.202477516286360f Q15*/,
- -5905/*-0.180218293244902f Q15*/,
- -4012/*-0.122429229978978f Q15*/,
- -1558/*-0.047552067127379f Q15*/,
- 843/*0.025733669494145f Q15*/,
- 2687/*0.081995376731897f Q15*/,
- 3656/*0.111581381838187f Q15*/,
- 3663/*0.111781798292302f Q15*/,
- 2834/*0.086499988914996f Q15*/,
- 1462/*0.044629684447068f Q15*/,
- -79/*-0.002416435594242f Q15*/,
- -1423/*-0.043440027386915f Q15*/,
- -2289/*-0.069857782812169f Q15*/,
- -2533/*-0.077293683967992f Q15*/,
- -2166/*-0.066098268486336f Q15*/,
- -1336/*-0.040782649068098f Q15*/,
- -282/*-0.008590773415008f Q15*/,
- 734/*0.022397654632128f Q15*/,
- 1480/*0.045171360007974f Q15*/,
- 1811/*0.055274128677739f Q15*/,
- 1690/*0.051578034020076f Q15*/,
- 1187/*0.036232016917169f Q15*/,
- 454/*0.013869500422767f Q15*/,
- -317/*-0.009680698856947f Q15*/,
- -945/*-0.028843394410080f Q15*/,
- -1296/*-0.039560663181280f Q15*/,
- -1314/*-0.040095747151623f Q15*/,
- -1023/*-0.031231107680685f Q15*/,
- -520/*-0.015866154815425f Q15*/,
- 60/*0.001841532922707f Q15*/,
- 575/*0.017553701334759f Q15*/,
- 910/*0.027778555138199f Q15*/,
- 1003/*0.030612329573745f Q15*/,
- 853/*0.026046143652186f Q15*/,
- 518/*0.015803012695681f Q15*/,
- 91/*0.002782973481834f Q15*/,
- -319/*-0.009720124055079f Q15*/,
- -617/*-0.018826488463900f Q15*/,
- -744/*-0.022710487805852f Q15*/,
- -686/*-0.020936374578238f Q15*/,
- -473/*-0.014436620433404f Q15*/,
- -169/*-0.005169079181373f Q15*/,
- 145/*0.004437651243491f Q15*/,
- 397/*0.012100372954920f Q15*/,
- 531/*0.016207075406240f Q15*/,
- 529/*0.016135389123271f Q15*/,
- 403/*0.012306629559665f Q15*/,
- 196/*0.005986734945567f Q15*/,
- -36/*-0.001094950878591f Q15*/,
- -236/*-0.007200842219958f Q15*/,
- -360/*-0.010998212848124f Q15*/,
- -388/*-0.011835179448280f Q15*/,
- -322/*-0.009826566540474f Q15*/,
- -188/*-0.005747665080695f Q15*/,
- -26/*-0.000780600030751f Q15*/,
- 125/*0.003810613287985f Q15*/,
- 229/*0.006990479233404f Q15*/,
- 268/*0.008174249796791f Q15*/,
- 240/*0.007317375965949f Q15*/,
- 159/*0.004864690818765f Q15*/,
- 52/*0.001587005259212f Q15*/,
- -54/*-0.001642504305841f Q15*/,
- -133/*-0.004070609517416f Q15*/,
- -171/*-0.005230670504649f Q15*/,
- -164/*-0.005019147682711f Q15*/,
- -120/*-0.003673879223241f Q15*/,
- -55/*-0.001671460853812f Q15*/,
- 14/*0.000420750005150f Q15*/,
- 69/*0.002095384947391f Q15*/,
- 99/*0.003020513665060f Q15*/,
- 101/*0.003095468528243f Q15*/,
- 80/*0.002441025550729f Q15*/,
- 44/*0.001335514431569f Q15*/,
- 4/*0.000120805384516f Q15*/,
- -29/*-0.000893340757369f Q15*/,
- -49/*-0.001501610712267f Q15*/,
- -54/*-0.001636887611783f Q15*/,
- -45/*-0.001362571776250f Q15*/,
- -27/*-0.000832126175863f Q15*/,
- -8/*-0.000232033375863f Q15*/,
- 9/*0.000273627139471f Q15*/,
- 19/*0.000582092683087f Q15*/,
- 22/*0.000666445711949f Q15*/,
- 19/*0.000566088888178f Q15*/,
- 12/*0.000360374058147f Q15*/,
- 4/*0.000136306914913f Q15*/,
- -1/*-0.000038864994777f Q15*/,
- -4/*-0.000132755824518f Q15*/,
- -5/*-0.000148377158880f Q15*/,
- -4/*-0.000112937171810f Q15*/,
- -2/*-0.000061132514471f Q15*/,
- -1/*-0.000019974224468f Q15*/,
- 0/*-0.000000460344975f Q15*/,
- 0/*0.000001976848453f Q15*/
-};
-
-
-/*----------------------------------------------------------------------------------*
- * Low-pass FIR filter for low-frequency post-filtering @ 16kHz
- * response : -6dB @ 50Hz, -3dB @ 500Hz, -6dB @ 6.4kHz)
- * L_FILT=15 @ 16kHz (1+4x15=61 coef)
- * L_FILT=12 @ 12.8kHz (1+5x12=61 coef)
- * filter parameters: fs/2=32000, fc=6400, gain=5.0, n=61
- *----------------------------------------------------------------------------------*/
-
-const Word16 filter_LP12_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )' */
-{//Q14
- 16384, 16196, 15641, 14741, 13533, 12067,
- 10402, 8604, 6742, 4887, 3105, 1459,
- 0, -1230, -2202, -2900, -3322, -3478,
- -3392, -3095, -2628, -2037, -1371, -676,
- 0, 618, 1143, 1550, 1822, 1954,
- 1946, 1811, 1565, 1233, 842, 421,
- 0, -394, -736, -1008, -1196, -1294,
- -1299, -1217, -1059, -839, -576, -290,
- 0, 274, 514, 707, 842, 913,
- 920, 865, 755, 600, 413, 208,
- 0, -197, -371, -511, -609, -662,
- -667, -627, -548, -436, -300, -151,
- 0, 143, 270, 371, 443, 481,
- 485, 456, 398, 316, 217, 109,
- 0, -104, -195, -268, -319, -346,
- -348, -326, -284, -225, -155, -78,
- 0, 73, 137, 189, 224, 242,
- 243, 227, 198, 156, 107, 54,
- 0, -50, -94, -128, -151, -163,
- -163, -152, -131, -103, -70, -35,
- 0, 32, 60, 82, 96, 103,
- 102, 95, 81, 64, 43, 21,
- 0, -19, -36, -48, -56, -59,
- -58, -53, -45, -35, -23, -11,
- 0, 10, 18, 24, 28, 29,
- 28, 25, 21, 16, 10, 5,
- 0, -4, -7, -9, -10, -10,
- -9, -8, -6, -5, -3, -1,
- 0, 1, 1, 2, 2, 1,
- 1, 1, 0, 0, 0, 0,
- 0
-};
-const Word16 filter_LP12_180H_13b_fx[] = /*Q13 Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )*/
-{//Q13
- 8192, 8098, 7820, 7370, 6766, 6033,
- 5201, 4302, 3371, 2443, 1553, 729,
- 0, -615, -1101, -1450, -1661, -1739,
- -1696, -1547, -1314, -1019, -685, -338,
- 0, 309, 571, 775, 911, 977,
- 973, 905, 783, 616, 421, 210,
- 0, -197, -368, -504, -598, -647,
- -649, -608, -529, -420, -288, -145,
- 0, 137, 257, 353, 421, 457,
- 460, 432, 377, 300, 206, 104,
- 0, -99, -185, -255, -305, -331,
- -333, -314, -274, -218, -150, -76,
- 0, 72, 135, 186, 221, 240,
- 242, 228, 199, 158, 109, 55,
- 0, -52, -97, -134, -159, -173,
- -174, -163, -142, -113, -77, -39,
- 0, 37, 69, 94, 112, 121,
- 121, 114, 99, 78, 53, 27,
- 0, -25, -47, -64, -76, -81,
- -81, -76, -66, -52, -35, -18,
- 0, 16, 30, 41, 48, 52,
- 51, 47, 41, 32, 21, 11,
- 0, -10, -18, -24, -28, -30,
- -29, -27, -23, -17, -12, -6,
- 0, 5, 9, 12, 14, 14,
- 14, 13, 10, 8, 5, 2,
- 0, -2, -4, -5, -5, -5,
- -5, -4, -3, -2, -1, -1,
- 0, 0, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0,
- 0
-};
-
-const Word16 filter_LP15_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */
-{//Q14
- 16384, 16263, 15904, 15317, 14516, 13524,
- 12366, 11073, 9678, 8216, 6723, 5236,
- 3790, 2416, 1144, 0, -997, -1831,
- -2492, -2976, -3285, -3425, -3408, -3248,
- -2966, -2583, -2123, -1610, -1070, -526,
- 0, 487, 919, 1281, 1564, 1761,
- 1869, 1891, 1830, 1695, 1496, 1244,
- 954, 641, 318, 0, -300, -569,
- -799, -982, -1113, -1188, -1209, -1176,
- -1094, -969, -809, -623, -420, -209,
- 0, 198, 377, 531, 653, 741,
- 793, 807, 786, 732, 649, 543,
- 418, 282, 140, 0, -133, -253,
- -356, -438, -497, -531, -540, -526,
- -489, -433, -362, -278, -187, -93,
- 0, 88, 167, 234, 288, 325,
- 347, 352, 342, 317, 280, 233,
- 179, 120, 59, 0, -56, -105,
- -147, -180, -203, -215, -217, -210,
- -194, -170, -141, -107, -72, -35,
- 0, 33, 61, 85, 103, 116,
- 122, 122, 117, 107, 93, 76,
- 58, 38, 19, 0, -17, -31,
- -43, -51, -57, -59, -58, -55,
- -49, -42, -34, -25, -16, -8,
- 0, 7, 12, 16, 19, 20,
- 21, 20, 18, 16, 13, 10,
- 7, 4, 2, 0, -1, -2,
- -3, -3, -3, -3, -2, -2,
- -1, -1, 0, 0, 0, 0,
- 0
-};
-
-const Word16 filter_LP15_180H_13b_fx[6 * 31] = /*Q13 Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )'*/
-{//Q13
- 8192, 8132, 7952, 7658, 7258, 6762,
- 6183, 5536, 4839, 4108, 3362, 2618,
- 1895, 1208, 572, 0, -498, -915,
- -1246, -1488, -1643, -1713, -1704, -1624,
- -1483, -1291, -1061, -805, -535, -263,
- 0, 244, 459, 640, 782, 880,
- 935, 945, 915, 848, 748, 622,
- 477, 320, 159, 0, -150, -285,
- -400, -491, -556, -594, -604, -588,
- -547, -485, -405, -312, -210, -104,
- 0, 99, 189, 265, 327, 371,
- 396, 404, 393, 366, 325, 271,
- 209, 141, 70, 0, -66, -127,
- -178, -219, -248, -266, -270, -263,
- -245, -217, -181, -139, -94, -46,
- 0, 44, 83, 117, 144, 163,
- 173, 176, 171, 158, 140, 116,
- 89, 60, 30, 0, -28, -53,
- -74, -90, -101, -108, -109, -105,
- -97, -85, -70, -54, -36, -18,
- 0, 16, 31, 43, 52, 58,
- 61, 61, 58, 53, 47, 38,
- 29, 19, 9, 0, -8, -16,
- -21, -26, -28, -29, -29, -27,
- -25, -21, -17, -13, -8, -4,
- 0, 3, 6, 8, 10, 10,
- 10, 10, 9, 8, 6, 5,
- 3, 2, 1, 0, -1, -1,
- -1, -2, -2, -1, -1, -1,
- -1, 0, 0, 0, 0, 0,
- 0
-};
-
-const Word16 filter_LP24_90H_fx[] =
-{//Q14
-
- 10240, 10208, 10111, 9951, 9731,
- 9452, 9119, 8734, 8304, 7834,
- 7328, 6794, 6237, 5664, 5081,
- 4495, 3913, 3339, 2780, 2241,
- 1727, 1242, 791, 376, 0,
- -335, -629, -880, -1089, -1256,
- -1383, -1471, -1523, -1540, -1527,
- -1487, -1422, -1337, -1235, -1119,
- -994, -862, -727, -592, -460,
- -333, -212, -101, 0, 90,
- 167, 232, 285, 325, 354,
- 371, 378, 376, 366, 349,
- 326, 299, 269, 236, 203,
- 171, 139, 109, 81, 56,
- 34, 15, 0, -12, -21,
- -27, -30, -31, -31, -29,
- -26, -22, -18, -14, -10,
- -7, -4, -2, -1, 0,
- 0, 0, 0, 0, 0,
- 0,
- 0
-
-};
-
-const Word16 filter_LP24_90H_13b_fx[] =
-{//Q13
-
- 5120, 5104, 5056, 4976, 4865,
- 4726, 4559, 4367, 4152, 3917,
- 3664, 3397, 3119, 2832, 2541,
- 2248, 1956, 1669, 1390, 1120,
- 863, 621, 396, 188, 0,
- -168, -315, -440, -545, -628,
- -691, -735, -761, -770, -764,
- -743, -711, -668, -617, -560,
- -497, -431, -364, -296, -230,
- -166, -106, -51, 0, 45,
- 84, 116, 143, 163, 177,
- 186, 189, 188, 183, 174,
- 163, 149, 134, 118, 102,
- 85, 69, 54, 40, 28,
- 17, 8, 0, -6, -10,
- -13, -15, -16, -15, -14,
- -13, -11, -9, -7, -5,
- -3, -2, -1, 0, 0,
- 0, 0, 0, 0, 0,
- 0,
- 0
-};
-
-const Word16 filter_LP3_90H_fx[] = /* Sincfilt.m: N=90*2+1, Fmin=0, Fmax=1/3, hann( N )' */
-{//Q14
- 16384, 13545, 6766, 0, -3371, -2689,
- 0, 1907, 1661, 0, -1314, -1187,
- 0, 990, 911, 0, -783, -729,
- 0, 638, 598, 0, -529, -499,
- 0, 445, 421, 0, -377, -357,
- 0, 321, 305, 0, -274, -260,
- 0, 234, 221, 0, -199, -188,
- 0, 169, 159, 0, -142, -134,
- 0, 119, 112, 0, -99, -93,
- 0, 81, 76, 0, -66, -61,
- 0, 52, 48, 0, -41, -37,
- 0, 31, 28, 0, -23, -20,
- 0, 16, 14, 0, -10, -9,
- 0, 6, 5, 0, -3, -2,
- 0, 1, 1, 0, 0, 0,
- 0
-};
-
-const Word16 filter_LP15_360H_13b_fx[] = /* Sincfilt.m: N=360*2+1, Fmin=0, Fmax=1/15, hann( N )' */
-{//Q13
-
- 8192, 8132, 7954, 7662, 7265, 6772, 6196, 5552,
- 4857, 4127, 3381, 2636, 1911, 1220, 579, 0,
- -506, -931, -1269, -1519, -1681, -1757, -1752, -1674,
- -1533, -1339, -1104, -840, -560, -276, 0, 258,
- 488, 682, 836, 946, 1008, 1024, 996, 927,
- 821, 687, 529, 357, 178, 0, -170, -325,
- -458, -567, -646, -694, -710, -696, -652, -581,
- -489, -379, -257, -129, 0, 124, 238, 338,
- 420, 481, 518, 533, 523, 492, 440, 372,
- 289, 197, 99, 0, -96, -184, -262, -326,
- -374, -405, -417, -410, -386, -346, -293, -228,
- -156, -78, 0, 76, 147, 209, 260, 299,
- 324, 334, 329, 310, 279, 236, 184, 125,
- 63, 0, -62, -119, -169, -211, -243, -263,
- -271, -268, -252, -227, -192, -150, -102, -52,
- 0, 50, 97, 138, 173, 198, 215, 222,
- 219, 207, 186, 157, 123, 84, 42, 0,
- -41, -80, -113, -142, -163, -176, -182, -180,
- -170, -152, -129, -101, -69, -35, 0, 34,
- 65, 93, 116, 133, 144, 149, 147, 139,
- 125, 106, 82, 56, 28, 0, -28, -53,
- -76, -95, -109, -118, -121, -120, -113, -101,
- -86, -67, -46, -23, 0, 22, 43, 61,
- 77, 88, 95, 98, 97, 91, 82, 69,
- 54, 37, 19, 0, -18, -35, -49, -61,
- -70, -76, -78, -77, -73, -65, -55, -43,
- -29, -15, 0, 14, 27, 39, 48, 55,
- 60, 62, 61, 57, 51, 43, 33, 23,
- 11, 0, -11, -21, -30, -37, -43, -46,
- -48, -47, -44, -39, -33, -26, -17, -9,
- 0, 8, 16, 23, 28, 32, 35, 36,
- 35, 33, 29, 25, 19, 13, 6, 0,
- -6, -12, -17, -21, -24, -25, -26, -25,
- -24, -21, -18, -14, -9, -5, 0, 4,
- 8, 12, 14, 16, 18, 18, 17, 16,
- 14, 12, 9, 6, 3, 0, -3, -6,
- -8, -10, -11, -11, -12, -11, -10, -9,
- -8, -6, -4, -2, 0, 2, 3, 5,
- 6, 6, 7, 7, 7, 6, 5, 4,
- 3, 2, 1, 0, -1, -2, -3, -3,
- -3, -3, -3, -3, -3, -3, -2, -2,
- -1, 0, 0, 0, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0
-
-};
-
-static const Word16 filter_LP30_300K_fx[LFE_PLC_FDEL + 1] =
-{//Q14
-16395,16364,16273,16123,15913,15646,15323,14947,14520,14045,13524,12963,12363,11730,11067,10379,9669,
-8943,8205,7460,6712,5965,5225,4495,3779,3082,2408,1759,1140,552,0,-515,-991,-1426,-1819,-2169,-2475,
--2736,-2953,-3126,-3257,-3345,-3392,-3400,-3371,-3307,-3210,-3083,-2928,-2749,-2547,-2327,-2091,-1842,
--1584,-1319,-1051,-782,-515,-254,0,244,476,695,897,1083,1249,1397,1523,1628,1712,1774,1815,1834,1833,
-1811,1771,1712,1637,1546,1442,1325,1197,1060,916,767,614,459,304,150,0,-145,-285,-417,-541,-655,-758,
--850,-930,-997,-1051,-1092,-1119,-1134,-1136,-1125,-1102,-1068,-1023,-968,-904,-832,-753,-668,-578,
--484,-388,-290,-192,-95,0,92,181,266,345,418,484,543,594,638,672,699,717,727,728,721,707,685,656,621,580,
-534,483,428,371,311,249,186,123,61,0,-59,-116,-170,-220,-267,-309,-347,-379,-407,-429,-445,-456,-462,-463,
--458,-448,-434,-416,-393,-367,-337,-305,-270,-233,-195,-156,-117,-77,-38,0,37,72,106,137,166,192,215,234,251,
-264,274,280,283,283,280,274,264,253,238,222,204,184,162,140,117,93,69,46,22,0,-21,-42,-62,-80,-97,-112,-125,-136,
--146,-153,-158,-161,-163,-162,-160,-156,-150,-143,-135,-125,-114,-103,-91,-78,-65,-51,-38,-25,-12,0,11,23,33,43,
-52,59,66,72,76,80,82,84,84,83,82,79,76,72,67,62,57,51,44,38,31,25,18,12,5,0,-5,-10,-15,-19,-23,-27,-29,-32,-34,
--35,-36,-36,-36,-35,-34,-33,-31,-29,-27,-24,-22,-19,-17,-14,-11,-9,-6,-4,-2,0
-
-};
-
-const Resampling_cfg resampling_cfg_tbl[] =
-{
- /* fin fout up.fact. den.fac. len.out filter coefs. filter length/2 filter mem./2 flags */
- { 8000, 12800, 8, 5, 256, /*filter5_39s320_120,*/ filter5_39s320_120_fx, 15, RS_INV_FAC },
- { 12800, 8000, 5, 8, 160, /*filter5_39s320_120,*/ filter5_39s320_120_fx, L_FILT_UP8k, RS_INV_FAC },
- { 16000, 8000, 6, 12, 160, /*filter_LP12_180H,*/ filter_LP12_180H_fx, 180 / 6, 0 },
- { 12800, 16000, 15, 12, 320, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT_UP16k, 0 },
- { 12800, 32000, 15, 6, 640, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT_UP32k, 0 },
- { 12800, 48000, 15, 4, 960, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT_UP48k, 0 },
-
- { 16000, 12800, 12, 15, 256, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT16k, 0, },
- { 16000, 32000, 12, 6, 640, /*filter_LP12_180H, */ filter_LP12_180H_fx, L_FILT16k, 0, },
- { 16000, 48000, 12, 4, 960, /*filter_LP12_180H,*/ filter_LP12_180H_fx, L_FILT16k, 0, },
-
- { 32000, 12800, 6, 15, 256, /*filter_LP15_180H,*/ filter_LP15_180H_13b_fx, L_FILT32k, 0, },
- { 32000, 16000, 6, 12, 320, /*filter_LP12_180H,*/ filter_LP12_180H_13b_fx, L_FILT32k, 0, },
- { 32000, 25600, 12, 15, 512, /*filter_LP15_360H,*/ filter_LP15_360H_13b_fx, L_FILT32k, 0, },
- { 32000, 48000, 3, 2, 960, /*filter_LP3_90H,*/ filter_LP3_90H_fx, L_FILT32k, 0, },
-
- { 48000, 12800, 4, 15, 256, /*filter_LP15_180H,*/ filter_LP15_180H_13b_fx, L_FILT48k, 0, },
- { 48000, 16000, 4, 12, 320, /*filter_LP12_180H,*/ filter_LP12_180H_13b_fx, L_FILT48k, 0, },
- { 48000, 25600, 8, 15, 512, /*filter_LP15_360H,*/ filter_LP15_360H_13b_fx, L_FILT48k, 0, },
- { 48000, 32000, 2, 3, 640, /*filter_LP3_90H,*/ filter_LP3_90H_fx, L_FILT48k, 0, },
-
- /* configs with NB 4kHz low-pass */
- { 16000, 12800, 12, 15, 256, /*filter_LP24_90H,*/ filter_LP24_90H_fx, L_FILT16k, 0, },
- { 32000, 12800, 6, 15, 256, /*filter_LP24_90H,*/ filter_LP24_90H_13b_fx, L_FILT32k, 0, },
- { 48000, 12800, 4, 15, 256, /*filter_LP24_90H,*/ filter_LP24_90H_13b_fx, L_FILT48k, 0, },
-
- /* entry for LFE PLC */
- { 1600, 48000, 30, 1, 960, /*filter_LP30_300K,*/ filter_LP30_300K_fx, LFE_PLC_FDEL / 30, 0, },
- { 0, 0, 0, 0, 0, /* 0, */ 0, 0, 0, } /* trailing entry (just to calculate the length of this table) */
-};
-
-//den fac value for last entry is calculated as den.fac = (num.fac*fin)/fout
-//lg_out value for last entry is calculated as = fout/50 = ((fin/50)*num.fac)/den.fac
-//filter_LP30_300K_fx has been calculated with Q14
-
-/*----------------------------------------------------------------------------------*
- * LSP interpolation coefficients
- *----------------------------------------------------------------------------------*/
-
-
-const Word16 interpol_frac2_fx[NB_SUBFR] = {//Q15
- 16384, 16384, 32767, 32767
-};
-
-const Word16 interpol_frac2_mid_fx[NB_SUBFR * 3] = {//Q15
- 8191, 24575, 0,
- 8191, 24575, 0,
- 0, 8191, 24575,
- 0, 8191, 24575
-};/*Q15*/
-
-
-const Word16 interpol_frac_12k8_fx[NB_SUBFR] = {//Q15
- 8191, 16383, 24575, 32767
-};
-
-const Word16 interpol_frac_fx[NB_SUBFR] = { 8192, 16384, 24576,32767 };/*Q15*/
-
-const Word16 interpol_isp_amr_wb_fx[] = { 14746, 26214, 31457, 32767 };/*Q15*/
-
-const Word16 interpol_frac_16k_fx[NB_SUBFR16k] = { 6554, 13107, 19661, 26214, 32767 };//Q15
-
-const Word16 interpol_frac_mid_fx[NB_SUBFR * 3] = { 16384, 16384, 0,//Q15
- 0, 32767, 0,
- 0, 16384, 16384,
- 0, 0, 32767
-};/*Q15*/
-
-const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3] = { 18022, 14746, 0,//Q15
- 4915, 27853, 0,
- 0, 24576, 8192,
- 0, 11469, 21299,
- 0, 0, 32767
-};
-
-const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3] = { 0, 22938, 9830,//Q15
- 0, 0, 32767,
- 0, 0, 32767,
- 0, 0, 32767
-};/*Q15*/
-
-const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3] = { 8192, 18022, 6554,//Q15
- 0, 22938, 9830,
- 0, 14746, 18022,
- 0, 0, 32767
-};/*Q15*/
-
-const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3] = { 4915, 22938, 4915,//Q15
- 1638, 21299, 9830,
- 0, 16384, 16384,
- 0, 0, 32767
-};
-
-const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3] = { 0, 22938, 9830,//Q15
- 0, 0, 32767,
- 0, 0, 32767,
- 0, 0, 32767,
- 0, 0, 32767
-};/*Q15*/
-
-const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3] = { 13107, 13107, 6554,//Q15
- 0, 26214, 6554,
- 0, 21299, 11469,
- 0, 4915, 27853,
- 0, 0, 32767
-};/*Q15*/
-
-const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3] = { 4915, 22938, 4915,//Q15
- 1638, 21299, 9830,
- 0, 16384, 16384,
- 0, 4915, 27853,
- 0, 0, 32767
-};/*Q15*/
-
-/*----------------------------------------------------------------------------------*
- * Innovative codebook
- *----------------------------------------------------------------------------------*/
-
-/* Innovative codebook config */
-const PulseConfig PulseConfTable[] =
-{
- /* Design rules:
- * ---> "fixed" + "tried-pair-pos"*2 = pulses & 0xfe
- * ---> tracks with pulses % 3 == 0, have always TRACKPOS_FIXED_FIRST */
- /* bits,iter,alp,pulses,fixed,tried-pair-pos,codetrack */
- { 7, 4, 16384/*2.0f Q13*/, 1, 0, {8}, TRACKPOS_FREE_ONE }, /* 7 bits, 1 pulses, 4 tracks, 1000 free track */
- { 10, 4, 16384/*2.0f Q13*/, 2, 0, {8}, TRACKPOS_FIXED_EVEN }, /* 10 bits, 2 pulses, 4 tracks 1010 (used only even tracks designed for NB) */
- { 12, 4, 16384/*2.0f Q13*/, 2, 0, {8}, TRACKPOS_FIXED_TWO }, /* 12 bits, 2 pulses, 2 tracks 11 used all tracks ala AMR-WB 6.6 */
- { 15, 4, 16384/*2.0f Q13*/, 3, 0, {8}, TRACKPOS_FIXED_FIRST }, /* 15 bits, 3 pulses, 4 tracks 1110 fixed track to first ? */
- { 17, 6, 16384/*2.0f Q13*/, 3, 0, {8}, TRACKPOS_FREE_THREE }, /* 17 bits, 3 pulses, 4 tracks (used all tracks) - 1110, 1101, 1011, 0111 */
- { 20, 4, 16384/*2.0f Q13*/, 4, 0, {4, 8}, TRACKPOS_FIXED_FIRST }, /* 20 bits, 4 pulses, 4 tracks 1111 */
- { 24, 4, 16384/*2.0f Q13*/, 5, 0, {4, 8}, TRACKPOS_FIXED_FIRST }, /* 24 bits, 5 pulses, 4 tracks 2111 fixed track to first */
- { 26, 4, 16384/*2.0f Q13*/, 5, 0, {4, 8}, TRACKPOS_FREE_ONE }, /* 26 bits, 5 pulses, 4 tracks 2111 one free track ? */
- { 28, 4, 12288/*1.5f Q13*/, 6, 0, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 28 bits, 6 pulses, 4 tracks 2211 */
- { 30, 4, 12288/*1.5f Q13*/, 6, 0, {4, 8, 8}, TRACKPOS_FIXED_TWO }, /* 30 bits, 6 pulses, 4 tracks 2211 free consecutive track positions ? */
- { 32, 4, 12288/*1.5f Q13*/, 7, 0, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 32 bits, 6 pulses, 4 tracks 2221 fixed ?*/
- { 34, 4, 12288/*1.5f Q13*/, 7, 0, {4, 8, 8}, TRACKPOS_FREE_THREE }, /* 34 bits, 6 pulses, 4 tracks 2221 free track positions ? */
- { 36, 4, 8192/*1.0f Q13*/, 8, 2, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 36 bits, 8 pulses, 4 tracks 2222 */
- { 40, 4, 8192/*1.0f Q13*/, 9, 2, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 40 bits, 9 pulses, 4 tracks 3222 fixed ?*/
- { 43, 4, 8192/*1.0f Q13*/, 10, 2, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 44 bits, 10 pulses, 4 tracks 3322 */
- { 46, 4, 8192/*1.0f Q13*/, 10, 2, {4, 6, 8, 8}, TRACKPOS_FIXED_TWO }, /* 46 bits, 10 pulses, 4 tracks 3322 free consecutive tracks ? */
- { 47, 4, 8192/*1.0f Q13*/, 11, 2, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 47 bits, 10 pulses, 4 tracks 3332 fixed ? */
- { 49, 4, 8192/*1.0f Q13*/, 11, 2, {4, 6, 8, 8}, TRACKPOS_FREE_THREE }, /* 49 bits, 10 pulses, 4 tracks 3332 free three track positions ? */
- { 50, 4, 8192/*1.0f Q13*/, 12, 4, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 50 bits, 12 pulses, 4 tracks 3333 */
- { 53, 4, 8192/*1.0f Q13*/, 13, 4, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 53 bits, 13 pulses, 4 tracks 4333 fixed ? */
- { 55, 4, 8192/*1.0f Q13*/, 13, 4, {4, 6, 8, 8}, TRACKPOS_FREE_ONE }, /* 55 bits, 13 pulses, 4 tracks 4333 free one ? */
- { 56, 4, 8192/*1.0f Q13*/, 14, 4, {4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 56 bits, 14 pulses, 4 tracks 4433 fixed ?!?! */
- { 58, 4, 8192/*1.0f Q13*/, 14, 4, {4, 6, 6, 8, 8}, TRACKPOS_FIXED_TWO }, /* 58 bits, 14 pulses, 4 tracks 4433 free consecutive ? */
- { 59, 4, 8192/*1.0f Q13*/, 15, 4, {4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 59 bits, 15 pulses, 4 tracks 4443 fixed ? */
- { 61, 4, 8192/*1.0f Q13*/, 15, 4, {4, 6, 6, 8, 8}, TRACKPOS_FREE_THREE }, /* 61 bits, 15 pulses, 4 tracks 4443 free ? */
- { 62, 3, 6554/*0.8f Q13*/, 16, 4, {4, 4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 62 bits, 16 pulses, 4 tracks 4444 */
- { 65, 3, 6554/*0.8f Q13*/, 17, 4, {4, 4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 65 bits, 17 pulses, 4 tracks 5444 fixed ?*/
- { 68, 3, 6144/*0.75f Q13*/, 18, 4, {2, 3, 4, 5, 6, 7, 8}, TRACKPOS_FIXED_FIRST }, /* 68 bits, 18 pulses, 4 tracks 5544 */
- { 70, 3, 6144/*0.75f Q13*/, 19, 4, {2, 3, 4, 5, 6, 7, 8}, TRACKPOS_FIXED_FIRST }, /* 70 bits, 19 pulses, 4 tracks 5554 fixed ? */
- { 73, 3, 6144/*0.75f Q13*/, 20, 4, {2, 3, 4, 5, 6, 7, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 73 bits, 20 pulses, 4 tracks 5555 fixed ? */
- { 75, 3, 6144/*0.75f Q13*/, 21, 4, {2, 3, 4, 5, 6, 7, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 75 bits, 21 pulses, 4 tracks 6555 fixed ? */
- { 78, 3, 6144/*0.75f Q13*/, 22, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 78 bits, 22 pulses, 4 tracks 6655 fixed ? */
- { 80, 3, 6144/*0.75f Q13*/, 23, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 80 bits, 23 pulses, 4 tracks 6665 fixed ? */
- { 83, 2, 2458/*0.30f Q13*/, 24, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 83 bits, 24 pulses, 4 tracks 6666 */
- { 85, 2, 2458/*0.30f Q13*/, 25, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 85 bits, 25 pulses, 4 tracks 7666 */
- { 87, 2, 2048/*0.25f Q13*/, 26, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 87 bits, 26 pulses, 4 tracks 7766 */
- { 89, 2, 2048/*0.25f Q13*/, 27, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 89 bits, 27 pulses, 4 tracks 7776 */
- { 92, 2, 2048/*0.25f Q13*/, 28, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 92 bits, 28 pulses, 4 tracks 7777 */
- { 94, 2, 2048/*0.25f Q13*/, 29, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 94 bits, 29 pulses, 4 tracks 8777 */
- { 96, 1, 1638/*0.20f Q13*/, 30, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 96 bits, 30 pulses, 4 tracks 8877 */
- { 98, 1, 1638/*0.20f Q13*/, 31, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 98 bits, 31 pulses, 4 tracks 8887 */
-};
-
-
-/* Number of pulses & positions to the number of unique states that can be achieved with those pulses */
-const UWord32 pulsestostates[17][9] =
-{
- { 0, 0, 0, 0, 0, 0, 0, 0, 0},
- { 2, 2, 2, 2, 2, 2, 2, 2, 2},
- { 4, 8, 12, 16, 20, 24, 28, 32, 36},
- { 6, 18, 38, 66, 102, 146, 198, 258, 326},
- { 8, 32, 88, 192, 360, 608, 952, 1408, 1992},
- { 10, 50, 170, 450, 1002, 1970, 3530, 5890, 9290},
- { 12, 72, 292, 912, 2364, 5336, 10836, 20256, 35436},
- { 14, 98, 462, 1666, 4942, 12642, 28814, 59906, 115598},
- { 16, 128, 688, 2816, 9424, 27008, 68464, 157184, 332688},
- { 18, 162, 978, 4482, 16722, 53154, 148626, 374274, 864146},
- { 20, 200, 1340, 6800, 28004, 97880, 299660, 822560, 2060980},
- { 22, 242, 1782, 9922, 44726, 170610, 568150, 1690370, 4573910},
- { 24, 288, 2312, 14016, 68664, 284000, 1022760, 3281280, 9545560},
- { 26, 338, 2938, 19266, 101946, 454610, 1761370, 6065410, 18892250},
- { 28, 392, 3668, 25872, 147084, 703640, 2919620, 10746400, 35704060},
- { 30, 450, 4510, 34050, 207006, 1057730, 4680990, 18347010, 64797470},
- { 32, 512, 5472, 44032, 285088, 1549824, 7288544, 30316544, 113461024},
-};
-
-/*----------------------------------------------------------------------------------*
- * Gain quantization table for memory-less gain quantizer
- *----------------------------------------------------------------------------------*/
-
-const Word16 gain_qua_mless_7b_fx[128*2] =
-{//Q14
- 419, 28,
- 1499, 607,
- 1586, 322,
- 1632, 144,
- 1686, 229,
- 1745, 495,
- 2182, 409,
- 2515, 716,
- 2772, 824,
- 3069, 1069,
- 3211, 936,
- 3218, 89,
- 3477, 1244,
- 3755, 272,
- 3865, 549,
- 3881, 348,
- 4171, 181,
- 4414, 627,
- 4419, 472,
- 4909, 1429,
- 5238, 404,
- 5241, 1651,
- 5721, 85,
- 5833, 250,
- 5846, 693,
- 5897, 325,
- 6036, 544,
- 6088, 779,
- 6459, 1889,
- 6650, 157,
- 6678, 462,
- 6798, 879,
- 6922, 993,
- 6929, 1130,
- 7352, 620,
- 7461, 386,
- 7864, 232,
- 7999, 314,
- 8136, 536,
- 8398, 712,
- 8680, 459,
- 8797, 1276,
- 9046, 806,
- 9198, 86,
- 9434, 398,
- 9730, 587,
- 9735, 267,
- 9742, 175,
- 9917, 917,
- 10042, 509,
- 10053, 655,
- 10132, 1030,
- 10238, 339,
- 10694, 1560,
- 10817, 447,
- 10964, 723,
- 11405, 1149,
- 11526, 549,
- 11582, 386,
- 11602, 791,
- 11618, 286,
- 11883, 862,
- 11954, 607,
- 12057, 214,
- 12104, 496,
- 12170, 1397,
- 12437, 668,
- 12616, 335,
- 12668, 952,
- 12684, 435,
- 12983, 112,
- 13235, 742,
- 13399, 549,
- 13525, 380,
- 13527, 270,
- 13625, 1044,
- 13733, 482,
- 13820, 617,
- 14036, 817,
- 14041, 1257,
- 14295, 425,
- 14346, 684,
- 14367, 319,
- 14416, 199,
- 14644, 898,
- 14944, 518,
- 15090, 364,
- 15154, 578,
- 15309, 462,
- 15360, 1933,
- 15362, 756,
- 15381, 262,
- 15566, 1127,
- 15699, 639,
- 15804, 410,
- 16081, 316,
- 16161, 993,
- 16359, 701,
- 16451, 828,
- 16500, 543,
- 16540, 491,
- 16617, 1729,
- 16630, 196,
- 16749, 369,
- 16959, 1530,
- 17028, 442,
- 17139, 603,
- 17369, 898,
- 17393, 268,
- 17972, 763,
- 17985, 1361,
- 18016, 333,
- 18032, 667,
- 18234, 406,
- 18270, 105,
- 18299, 554,
- 18342, 488,
- 18747, 1207,
- 19027, 1073,
- 19530, 216,
- 19566, 963,
- 19751, 835,
- 19794, 615,
- 19810, 298,
- 19988, 710,
- 19990, 449,
- 20005, 374,
- 20149, 531,
-};
-
-const Word16 gain_qua_mless_6b_stereo_fx[64 * 2] =
-{//Q14
- 570, 695,
- 932, 535,
- 972, 913,
- 1305, 165,
- 1503, 343,
- 1942, 2102,
- 2763, 440,
- 2957, 1204,
- 3163, 621,
- 3232, 760,
- 4215, 255,
- 4415, 533,
- 4884, 873,
- 5395, 429,
- 5601, 664,
- 5724, 1615,
- 6847, 1057,
- 6849, 535,
- 6889, 3303,
- 7086, 335,
- 7135, 766,
- 8267, 616,
- 8601, 907,
- 8690, 442,
- 9501, 1264,
- 9517, 728,
- 10050, 73,
- 10243, 514,
- 10723, 861,
- 10884, 641,
- 11005, 339,
- 11919, 1623,
- 11976, 1037,
- 12219, 564,
- 12286, 770,
- 12858, 413,
- 12944, 8191,
- 13347, 684,
- 13751, 502,
- 13802, 873,
- 13812, 1207,
- 14417, 615,
- 14633, 392,
- 15119, 732,
- 15214, 521,
- 15247, 976,
- 15509, 290,
- 15936, 1440,
- 16101, 603,
- 16157, 448,
- 16277, 799,
- 16358, 2544,
- 16863, 4652,
- 17010, 1093,
- 17073, 350,
- 17348, 659,
- 17583, 509,
- 17853, 854,
- 19087, 1756,
- 19109, 405,
- 19348, 727,
- 19553, 566,
- 19553, 1240,
- 19659, 953
-};
-
-const Word16 gain_qua_mless_6b_fx[64 * 2] =
-{//Q14
- 1676, 71,
- 2128, 198,
- 2318, 491,
- 2348, 339,
- 2798, 625,
- 2893, 785,
- 3911, 1099,
- 4779, 244,
- 4781, 427,
- 5115, 935,
- 5294, 1509,
- 5767, 114,
- 6018, 543,
- 6152, 335,
- 6205, 675,
- 6234, 1822,
- 6740, 1251,
- 7034, 802,
- 7782, 434,
- 8005, 230,
- 9232, 622,
- 9337, 336,
- 9388, 520,
- 9770, 1038,
- 9865, 734,
- 10224, 879,
- 10617, 118,
- 10776, 426,
- 11518, 249,
- 11708, 1399,
- 12044, 587,
- 12270, 501,
- 12277, 348,
- 12498, 684,
- 13020, 786,
- 13097, 1196,
- 13530, 422,
- 13818, 917,
- 14123, 290,
- 14500, 1039,
- 14538, 636,
- 14636, 556,
- 14667, 484,
- 14931, 362,
- 15055, 210,
- 15653, 1594,
- 15830, 1874,
- 15868, 717,
- 15897, 828,
- 16153, 434,
- 16540, 294,
- 16874, 608,
- 16936, 513,
- 17182, 373,
- 17644, 1337,
- 17696, 126,
- 18342, 1122,
- 18461, 944,
- 18991, 242,
- 19114, 795,
- 19187, 674,
- 19256, 449,
- 19485, 557,
- 19515, 344,
-};
-
-const Word16 gain_qua_mless_5b_fx[32 * 2] =
-{//Q14
- 2695, 109,
- 3444, 271,
- 3529, 433,
- 4284, 801,
- 4365, 607,
- 4935, 1089,
- 6896, 1407,
- 7722, 324,
- 7913, 146,
- 8090, 468,
- 9049, 913,
- 9499, 600,
- 9894, 741,
- 9942, 1840,
- 11906, 382,
- 12008, 1103,
- 12349, 243,
- 12429, 501,
- 13687, 630,
- 13974, 896,
- 14510, 748,
- 15160, 322,
- 15424, 428,
- 15679, 541,
- 15832, 1574,
- 15999, 1281,
- 17223, 211,
- 17719, 1029,
- 18185, 649,
- 18432, 818,
- 18638, 353,
- 18889, 493,
-};
-
-const Word16 E_ROM_qua_gain5b_const[NB_QUA_GAIN5B * 2]=
-{//Q0
- 1774,577,
- 2090,1805,
- 2103,3371,
- 3908,1116,
- 4834,2500,
- 6030,4763,
- 6838,1334,
- 7490,2033,
- 8585,3036,
- 9845,1575,
- 10437,2320,
- 10649,3739,
- 11298,945,
- 12108,1920,
- 12310,5108,
- 12391,2758,
- 12659,1237,
- 13729,1557,
- 13798,2201,
- 13972,3275,
- 14881,993,
- 15175,1776,
- 15409,16190,
- 15551,2395,
- 15879,4048,
- 16341,1335,
- 16988,2918,
- 18317,7449,
- 18368,2026,
- 19114,1364,
- 19991,4472,
- 20644,2790,
-};
-
-const Word16 E_ROM_qua_gain6b_const[NB_QUA_GAIN6B * 2] =
-{//Q0
- 0,2758,
- 143,3562,
- 397,2146,
- 544,4306,
- 952,1726,
- 1236,724,
- 1779,3158,
- 1820,5448,
- 1975,2473,
- 2121,1343,
- 3049,3912,
- 3081,1885,
- 3289,8261,
- 3416,2843,
- 3495,2204,
- 3831,3386,
- 4295,4590,
- 4300,2476,
- 4345,1545,
- 4913,1122,
- 5198,2080,
- 5200,3079,
- 5448,3714,
- 5482,2689,
- 5546,1817,
- 5783,17318,
- 5934,6236,
- 6156,2320,
- 6481,4225,
- 6828,3351,
- 6832,5045,
- 6888,2895,
- 7186,2559,
- 7214,1663,
- 7373,2052,
- 7906,3819,
- 8192,1372,
- 8452,3063,
- 8464,2354,
- 9021,4468,
- 9037,2715,
- 9175,1874,
- 9219,3463,
- 9831,2155,
- 10523,5383,
- 10557,9061,
- 10618,3093,
- 10633,3949,
- 10890,2465,
- 11141,1654,
- 12132,2790,
- 12180,3477,
- 12376,2079,
- 12494,4560,
- 14430,2468,
- 14573,3914,
- 14576,3111,
- 15043,1827,
- 15207,1329,
- 16073,6155,
- 17519,4719,
- 18345,2148,
- 18554,2784,
- 18576,3563,
-};
-
-const Word16 E_ROM_qua_gain7b_const[NB_QUA_GAIN7B * 2] =
-{//Q0
- 123,2777,
- 369,2102,
- 404,4368,
- 693,3486,
- 1107,719,
- 1222,1679,
- 1657,1293,
- 1667,5547,
- 1805,2425,
- 2369,3075,
- 2489,12063,
- 2681,1901,
- 2693,3984,
- 3031,7547,
- 3248,990,
- 3466,2672,
- 3674,2165,
- 3718,1513,
- 3844,3456,
- 4120,4656,
- 4748,2967,
- 4821,19622,
- 4855,2400,
- 4912,1776,
- 5245,3860,
- 5312,6282,
- 5500,1176,
- 5713,2056,
- 5872,3287,
- 5960,2662,
- 6170,9756,
- 6364,5021,
- 6545,1476,
- 6788,2283,
- 6796,4163,
- 7038,2949,
- 7216,1831,
- 7274,3516,
- 7707,2510,
- 8123,5762,
- 8361,4485,
- 8376,2110,
- 8594,3135,
- 8611,3755,
- 8634,1570,
- 8636,2748,
- 8683,8222,
- 9274,335,
- 9512,2404,
- 9640,5020,
- 9690,1893,
- 9778,3361,
- 9808,15435,
- 9936,4029,
- 10194,2767,
- 10306,6510,
- 10325,1252,
- 10686,2186,
- 10844,32767,
- 10913,4453,
- 10968,3078,
- 11044,1666,
- 11076,3609,
- 11398,2509,
- 11423,5160,
- 11848,1994,
- 11997,2823,
- 12002,3880,
- 12084,7573,
- 12129,3325,
- 12214,5867,
- 12331,1496,
- 12450,4245,
- 12458,2283,
- 12768,901,
- 12896,4741,
- 12898,1811,
- 12902,2569,
- 12983,2959,
- 13173,3331,
- 13413,2059,
- 13416,3734,
- 13429,10641,
- 13448,1148,
- 13615,5340,
- 13674,1425,
- 13779,2332,
- 13847,4264,
- 13909,2657,
- 13958,6488,
- 14047,3085,
- 14130,1648,
- 14547,1915,
- 14554,3684,
- 14749,2739,
- 14868,5017,
- 14875,2216,
- 14898,3197,
- 14988,1085,
- 15026,4246,
- 15375,7971,
- 15421,1446,
- 15548,2462,
- 15722,5920,
- 15882,3449,
- 15960,1782,
- 15994,2863,
- 16365,3977,
- 16419,4754,
- 16472,2162,
- 17378,3101,
- 17410,2550,
- 17743,1339,
- 17856,5485,
- 17979,1982,
- 17996,3628,
- 18041,7110,
- 18242,4381,
- 18602,22207,
- 19373,12827,
- 19533,2777,
- 19640,1678,
- 19728,2272,
- 19795,8861,
- 20065,3275,
- 20133,4881,
- 20198,3947,
- 20290,6128,
-};
-
-/*----------------------------------------------------------------------------------*
- * MA predicition coefficients for gain quantizer
- *----------------------------------------------------------------------------------*/
-
-const Word16 pred_gain_fx[GAIN_PRED_ORDER] = { 8192, 6554, 4915, 3277 };//Q14
-
-/*----------------------------------------------------------------------------------*
- * 6-bit gain quantization table (only for AMR-WB IO mode)
- *----------------------------------------------------------------------------------*/
-
-const Word16 t_qua_gain6b_fx[64 * 2] =
-{//Q14
- 1566, 1332,
- 1577, 3557,
- 3071, 6490,
- 4193, 10163,
- 4496, 2534,
- 5019, 4488,
- 5586, 15614,
- 5725, 1422,
- 6453, 580,
- 6724, 6831,
- 7657, 3527,
- 8072, 2099,
- 8232, 5319,
- 8827, 8775,
- 9740, 2868,
- 9856, 1465,
- 10087, 12488,
- 10241, 4453,
- 10859, 6618,
- 11321, 3587,
- 11417, 1800,
- 11643, 2428,
- 11718, 988,
- 12312, 5093,
- 12523, 8413,
- 12574, 26214,
- 12601, 3396,
- 13172, 1623,
- 13285, 2423,
- 13418, 6087,
- 13459, 12810,
- 13656, 3607,
- 14111, 4521,
- 14144, 1229,
- 14425, 1871,
- 14431, 7234,
- 14445, 2834,
- 14628, 10036,
- 14860, 17496,
- 15161, 3629,
- 15209, 5819,
- 15299, 2256,
- 15518, 4722,
- 15663, 1060,
- 15759, 7972,
- 15939, 11964,
- 16020, 2996,
- 16086, 1707,
- 16521, 4254,
- 16576, 6224,
- 16894, 2380,
- 16906, 681,
- 17213, 8406,
- 17610, 3418,
- 17895, 5269,
- 18168, 11748,
- 18230, 1575,
- 18607, 32767,
- 18728, 21684,
- 19137, 2543,
- 19422, 6577,
- 19446, 4097,
- 19450, 9056,
- 20371, 14885
-};
-
-
-/*----------------------------------------------------------------------------------*
- * 7-bit gain quantization table (only for AMR-WB IO mode)
- *----------------------------------------------------------------------------------*/
-
-const Word16 t_qua_gain7b_fx[128 * 2] =
-{//Q14
- 204, 441,
- 464, 1977,
- 869, 1077,
- 1072, 3062,
- 1281, 4759,
- 1647, 1539,
- 1845, 7020,
- 1853, 634,
- 1995, 2336,
- 2351, 15400,
- 2661, 1165,
- 2702, 3900,
- 2710, 10133,
- 3195, 1752,
- 3498, 2624,
- 3663, 849,
- 3984, 5697,
- 4214, 3399,
- 4415, 1304,
- 4695, 2056,
- 5376, 4558,
- 5386, 676,
- 5518, 23554,
- 5567, 7794,
- 5644, 3061,
- 5672, 1513,
- 5957, 2338,
- 6533, 1060,
- 6804, 5998,
- 6820, 1767,
- 6937, 3837,
- 7277, 414,
- 7305, 2665,
- 7466, 11304,
- 7942, 794,
- 8007, 1982,
- 8007, 1366,
- 8326, 3105,
- 8336, 4810,
- 8708, 7954,
- 8989, 2279,
- 9031, 1055,
- 9247, 3568,
- 9283, 1631,
- 9654, 6311,
- 9811, 2605,
- 10120, 683,
- 10143, 4179,
- 10245, 1946,
- 10335, 1218,
- 10468, 9960,
- 10651, 3000,
- 10951, 1530,
- 10969, 5290,
- 11203, 2305,
- 11325, 3562,
- 11771, 6754,
- 11839, 1849,
- 11941, 4495,
- 11954, 1298,
- 11975, 15223,
- 11977, 883,
- 11986, 2842,
- 12438, 2141,
- 12593, 3665,
- 12636, 8367,
- 12658, 1594,
- 12886, 2628,
- 12984, 4942,
- 13146, 1115,
- 13224, 524,
- 13341, 3163,
- 13399, 1923,
- 13549, 5961,
- 13606, 1401,
- 13655, 2399,
- 13782, 3909,
- 13868, 10923,
- 14226, 1723,
- 14232, 2939,
- 14278, 7528,
- 14439, 4598,
- 14451, 984,
- 14458, 2265,
- 14792, 1403,
- 14818, 3445,
- 14899, 5709,
- 15017, 15362,
- 15048, 1946,
- 15069, 2655,
- 15405, 9591,
- 15405, 4079,
- 15570, 7183,
- 15687, 2286,
- 15691, 1624,
- 15699, 3068,
- 15772, 5149,
- 15868, 1205,
- 15970, 696,
- 16249, 3584,
- 16338, 1917,
- 16424, 2560,
- 16483, 4438,
- 16529, 6410,
- 16620, 11966,
- 16839, 8780,
- 17030, 3050,
- 17033, 18325,
- 17092, 1568,
- 17123, 5197,
- 17351, 2113,
- 17374, 980,
- 17566, 26214,
- 17609, 3912,
- 17639, 32767,
- 18151, 7871,
- 18197, 2516,
- 18202, 5649,
- 18679, 3283,
- 18930, 1370,
- 19271, 13757,
- 19317, 4120,
- 19460, 1973,
- 19654, 10018,
- 19764, 6792,
- 19912, 5135,
- 20040, 2841,
- 21234, 19833
-};
-
-/*----------------------------------------------------------------------------------*
- * Quantization table for scaled innovation energy prediciton
- *----------------------------------------------------------------------------------*/
-
-const Word16 Es_pred_qua_5b_fx[32] =
-{//Q8
- -2048,
- -525,
- 642,
- 1688,
- 2547,
- 3326,
- 4026,
- 4647,
- 5211,
- 5740,
- 6221,
- 6661,
- 7067,
- 7447,
- 7815,
- 8170,
- 8518,
- 8865,
- 9204,
- 9551,
- 9912,
- 10284,
- 10669,
- 11077,
- 11509,
- 11976,
- 12486,
- 13049,
- 13695,
- 14434,
- 15354,
- 16640,
-};
-
-const Word16 Es_pred_qua_4b_fx[16] =
-{//Q8
- -2048,
- -36,
- 1828,
- 3284,
- 4584,
- 5742,
- 6821,
- 7834,
- /*8779, */
- 8778,
- 9701,
- 10610,
- 11524,
- 12487,
- 13560,
- 14862,
- 16640
-};
-
-const Word16 Es_pred_qua_3b_fx[8] =
-{
- 1521/* 5.9422f Q8*/,
- 3909/*15.2711f Q8*/,
- 5987/*23.3857f Q8*/,
- 7816/*30.5310f Q8*/,
- 9477/*37.0190f Q8*/,
- 11124/*43.4539f Q8*/,
- 12863/*50.2442f Q8*/,
- 15031/*58.7164f Q8*/
-};
-
-const Word16 Es_pred_qua_4b_no_ltp_fx[16] =
-{
- -1280/*-5.f Q8*/,
- 0/* 0.f Q8*/,
- 1280/* 5.f Q8*/,
- 2560/*10.f Q8*/,
- 3840/*15.f Q8*/,
- 5120/*20.f Q8*/,
- 6400/*25.f Q8*/,
- 7680/*30.f Q8*/,
- 8960/*35.f Q8*/,
- 10240/*40.f Q8*/,
- 11520/*45.f Q8*/,
- 12800/*50.f Q8*/,
- 14080/*55.f Q8*/,
- 15360/*60.f Q8*/,
- 16640/*65.f Q8*/,
- 17920/*70.f Q8*/
-};
-/*----------------------------------------------------------------------------------*
- * Gain estimation constants (for gain quantizer at 7.2 and 8.0 kbps)
- *----------------------------------------------------------------------------------*/
-
-const Word16 b_1sfr_fx[2] = /*Q12 */
-{
- 9697, -920
-};
-
-const Word16 b_2sfr_fx[4] = /*Q12 */
-{
- -1, 70, 3763, 542
-};
-
-const Word16 b_3sfr_fx[6] =//Q12
-{
- -478, 110, 553, 3264, 92, 730
-};
-
-const Word16 b_4sfr_fx[8] =//Q12
-{
- -381, 65, -271, 836, 3246, 34, 143, 650
-};
-
-/*----------------------------------------------------------------------------------*
- * Gain codebooks (for gain quantizer at 7.2 and 8.0 kbps)
- *----------------------------------------------------------------------------------*/
-
-const Word16 gp_gamma_3sfr_7b_fx[2 * 128] = //Q14/Q9
-{
- 141, 207,
- 268, 836,
- 355, 385,
- 470, 124,
- 944, 265,
- 1202, 503,
- 1308, 640,
- 1384, 150,
- 1399, 75,
- 1534, 323,
- 1835, 1252,
- 1872, 216,
- 2297, 443,
- 2495, 122,
- 2697, 358,
- 2849, 181,
- 2920, 274,
- 2937, 552,
- 3353, 2982,
- 3666, 394,
- 3759, 1755,
- 3790, 972,
- 3838, 225,
- 3929, 758,
- 3973, 143,
- 4075, 313,
- 4329, 471,
- 4689, 625,
- 4938, 178,
- 5073, 266,
- 5216, 379,
- 5519, 520,
- 6089, 321,
- 6149, 221,
- 6247, 432,
- 6254, 1083,
- 6556, 131,
- 6751, 733,
- 6773, 587,
- 7140, 17402,
- 7257, 366,
- 7295, 269,
- 7314, 483,
- 8121, 204,
- 8214, 1515,
- 8332, 538,
- 8386, 842,
- 8483, 314,
- 8484, 660,
- 8503, 395,
- 9079, 455,
- 9543, 249,
- 9687, 1056,
- 9724, 11493,
- 9727, 336,
- 9862, 603,
- 10141, 158,
- 10278, 498,
- 10347, 393,
- 10380, 751,
- 10899, 287,
- 11239, 564,
- 11377, 210,
- 11389, 437,
- 11531, 926,
- 11565, 339,
- 11594, 684,
- 11635, 7228,
- 12176, 509,
- 12240, 1235,
- 12467, 381,
- 12631, 254,
- 12758, 809,
- 12877, 458,
- 12881, 620,
- 13160, 313,
- 13243, 1692,
- 13441, 533,
- 13620, 420,
- 13855, 718,
- 13895, 998,
- 14047, 354,
- 14150, 199,
- 14170, 586,
- 14358, 477,
- 14770, 280,
- 14777, 143,
- 14810, 397,
- 14965, 857,
- 14984, 655,
- 15112, 524,
- 15406, 330,
- 15535, 442,
- 15599, 1120,
- 15635, 4946,
- 15823, 582,
- 15891, 736,
- 16161, 374,
- 16216, 229,
- 16265, 493,
- 16607, 638,
- 16610, 2511,
- 16905, 803,
- 16906, 433,
- 16911, 310,
- 16924, 1415,
- 17161, 543,
- 17656, 951,
- 17694, 680,
- 17736, 375,
- 17982, 479,
- 18345, 287,
- 18372, 586,
- 18469, 3627,
- 18649, 183,
- 18898, 2002,
- 18925, 403,
- 18959, 712,
- 19244, 857,
- 19306, 245,
- 19447, 1203,
- 19455, 334,
- 19458, 526,
- 19600, 455,
- 19699, 623,
- 19724, 1583,
- 19788, 1001,
- 20031, 749,
-};
-
-const Word16 gp_gamma_4sfr_7b_fx[2 * 128] = /*Q14/Q9 */
-{
- 101, 174,
- 228, 542,
- 400, 269,
- 735, 418,
- 799, 111,
- 1146, 802,
- 1250, 345,
- 1291, 1138,
- 1327, 224,
- 1478, 1705,
- 1557, 491,
- 1947, 295,
- 1988, 639,
- 2343, 386,
- 2386, 213,
- 2541, 133,
- 2904, 2881,
- 3198, 455,
- 3204, 736,
- 3219, 276,
- 3463, 549,
- 3709, 343,
- 3741, 177,
- 4431, 226,
- 4480, 927,
- 4516, 396,
- 4547, 622,
- 4900, 290,
- 5011, 503,
- 5601, 742,
- 5616, 173,
- 5688, 428,
- 5975, 337,
- 6196, 5865,
- 6293, 253,
- 6294, 580,
- 6305, 1053,
- 6792, 480,
- 6951, 391,
- 7151, 212,
- 7298, 671,
- 7475, 317,
- 7757, 534,
- 7917, 856,
- 8195, 1449,
- 8198, 437,
- 8228, 261,
- 8434, 154,
- 8493, 622,
- 8552, 358,
- 9324, 493,
- 9373, 744,
- 9391, 217,
- 9410, 296,
- 9711, 14146,
- 9711, 405,
- 9724, 598,
- 10128, 1140,
- 10248, 8800,
- 10391, 344,
- 10530, 883,
- 10541, 542,
- 10559, 257,
- 10772, 441,
- 11075, 664,
- 11463, 304,
- 11510, 196,
- 11551, 2230,
- 11574, 501,
- 11611, 391,
- 12154, 784,
- 12205, 576,
- 12304, 133,
- 12413, 343,
- 12457, 84,
- 12468, 445,
- 12734, 247,
- 12970, 639,
- 13072, 1411,
- 13142, 983,
- 13159, 499,
- 13356, 386,
- 13460, 298,
- 13838, 710,
- 13850, 550,
- 13930, 429,
- 14446, 343,
- 14449, 170,
- 14511, 467,
- 14530, 857,
- 14697, 623,
- 14770, 4569,
- 14833, 229,
- 15086, 512,
- 15112, 387,
- 15527, 574,
- 15552, 1126,
- 15573, 764,
- 15662, 291,
- 15677, 442,
- 16056, 648,
- 16200, 508,
- 16322, 369,
- 16719, 586,
- 16832, 936,
- 16835, 450,
- 16969, 702,
- 17188, 315,
- 17425, 538,
- 17680, 395,
- 17808, 209,
- 17855, 791,
- 18054, 1861,
- 18122, 471,
- 18273, 632,
- 18425, 3478,
- 18630, 1239,
- 18947, 143,
- 18948, 2576,
- 19051, 264,
- 19068, 349,
- 19112, 502,
- 19303, 1530,
- 19502, 836,
- 19558, 422,
- 19571, 692,
- 19667, 1014,
- 19685, 569
-};
-
-const Word16 gp_gamma_1sfr_8b_fx[2 * 256] = /*Q14/Q9 */
-{
- 305, 152,
- 333, 37,
- 352, 556,
- 573, 82,
- 652, 12,
- 694, 207,
- 808, 389,
- 915, 776,
- 986, 1089,
- 987, 1583,
- 1055, 60,
- 1202, 2779,
- 1205, 20,
- 1346, 127,
- 1432, 332,
- 1689, 6554,
- 1715, 261,
- 1820, 49,
- 2041, 698,
- 2179, 4032,
- 2199, 100,
- 2272, 1303,
- 2317, 461,
- 2340, 175,
- 2562, 26,
- 2574, 14814,
- 2657, 2101,
- 2732, 66,
- 2818, 9,
- 2836, 296,
- 2929, 938,
- 3479, 130,
- 3510, 220,
- 3651, 3154,
- 3667, 717,
- 3720, 384,
- 3783, 530,
- 3811, 10744,
- 3883, 5385,
- 3941, 1609,
- 3964, 46,
- 4120, 80,
- 4402, 15,
- 4440, 1181,
- 4485, 173,
- 4740, 311,
- 4848, 31,
- 5125, 7642,
- 5147, 110,
- 5167, 908,
- 5237, 252,
- 5323, 623,
- 5376, 2514,
- 5590, 7,
- 5595, 4475,
- 5634, 64,
- 5654, 461,
- 5822, 22,
- 5893, 140,
- 5905, 1810,
- 6177, 367,
- 6268, 201,
- 6352, 1092,
- 6567, 752,
- 6626, 50,
- 6734, 95,
- 6758, 295,
- 6882, 3085,
- 6962, 1363,
- 7274, 540,
- 7413, 166,
- 7635, 2120,
- 7642, 38,
- 7671, 393,
- 7730, 227,
- 7860, 75,
- 7980, 115,
- 8011, 955,
- 8092, 3687,
- 8120, 17,
- 8146, 5902,
- 8453, 672,
- 8524, 1602,
- 8583, 58,
- 8679, 275,
- 8873, 332,
- 8920, 454,
- 8969, 9712,
- 9129, 2566,
- 9159, 196,
- 9193, 1127,
- 9219, 142,
- 9300, 9,
- 9302, 828,
- 9409, 91,
- 9736, 26,
- 9872, 574,
- 10066, 246,
- 10131, 1352,
- 10154, 1971,
- 10196, 399,
- 10238, 15785,
- 10255, 4254,
- 10401, 67,
- 10439, 43,
- 10511, 116,
- 10531, 7399,
- 10706, 998,
- 10798, 722,
- 10845, 171,
- 10848, 304,
- 10876, 2981,
- 11069, 28204,
- 11139, 507,
- 11280, 12,
- 11427, 388,
- 11459, 214,
- 11647, 1174,
- 11710, 5061,
- 11742, 1614,
- 11793, 806,
- 11816, 82,
- 11890, 132,
- 11996, 2301,
- 12000, 603,
- 12060, 55,
- 12232, 256,
- 12299, 33,
- 12438, 338,
- 12452, 458,
- 12627, 3563,
- 12646, 9489,
- 12665, 934,
- 12801, 1329,
- 12802, 190,
- 12877, 683,
- 12941, 103,
- 13038, 1890,
- 13209, 6209,
- 13222, 12674,
- 13318, 21,
- 13374, 283,
- 13385, 149,
- 13391, 383,
- 13453, 545,
- 13564, 1064,
- 13596, 2561,
- 13771, 810,
- 13834, 1481,
- 13874, 69,
- 14027, 226,
- 14093, 4429,
- 14147, 7,
- 14171, 609,
- 14185, 47,
- 14223, 3051,
- 14273, 434,
- 14321, 314,
- 14415, 120,
- 14443, 1252,
- 14500, 173,
- 14557, 933,
- 14616, 1696,
- 14639, 8229,
- 14724, 89,
- 14837, 703,
- 14902, 2072,
- 14917, 366,
- 15000, 487,
- 15009, 30,
- 15095, 256,
- 15138, 1119,
- 15228, 3580,
- 15371, 1386,
- 15387, 5525,
- 15398, 17932,
- 15462, 149,
- 15471, 791,
- 15551, 569,
- 15554, 2467,
- 15559, 201,
- 15616, 14,
- 15664, 319,
- 15798, 401,
- 15811, 974,
- 15874, 41,
- 15929, 1649,
- 15945, 79,
- 16046, 111,
- 16225, 647,
- 16230, 1240,
- 16297, 4110,
- 16328, 10499,
- 16331, 278,
- 16355, 3003,
- 16383, 455,
- 16404, 169,
- 16435, 2172,
- 16438, 850,
- 16745, 7090,
- 16776, 354,
- 16801, 1063,
- 16803, 62,
- 16812, 223,
- 16927, 530,
- 16951, 721,
- 17039, 1447,
- 17208, 1837,
- 17233, 135,
- 17371, 4642,
- 17570, 406,
- 17608, 267,
- 17696, 906,
- 17702, 2529,
- 17705, 23239,
- 17709, 1209,
- 17745, 592,
- 17800, 92,
- 17858, 35,
- 17860, 3360,
- 17866, 9,
- 17978, 184,
- 18035, 321,
- 18255, 754,
- 18274, 480,
- 18320, 18,
- 18406, 55,
- 18582, 13017,
- 18677, 1516,
- 18726, 1998,
- 18904, 25,
- 18914, 6103,
- 19020, 8567,
- 19022, 1116,
- 19025, 349,
- 19147, 239,
- 19224, 604,
- 19251, 160,
- 19270, 4870,
- 19358, 3789,
- 19394, 126,
- 19394, 103,
- 19433, 72,
- 19444, 46,
- 19448, 2842,
- 19489, 430,
- 19575, 815,
- 19628, 1306,
- 19631, 972,
- 19637, 202,
- 19642, 289,
- 19660, 527,
- 19717, 1697,
- 19731, 2263,
- 19754, 676,
- 19854, 382,
-};
-
-const Word16 gp_gamma_1sfr_7b_fx[2 * 128] = /*Q14/Q9 */
-{
- 350, 85,
- 428, 24,
- 438, 681,
- 642, 195,
- 1071, 2012,
- 1080, 402,
- 1148, 1236,
- 1159, 62,
- 1424, 12,
- 1662, 134,
- 1985, 299,
- 2100, 34,
- 2163, 3168,
- 2219, 538,
- 2393, 6580,
- 2499, 967,
- 2882, 221,
- 2974, 12743,
- 3251, 98,
- 3294, 51,
- 3586, 1560,
- 3711, 411,
- 3721, 700,
- 3862, 21,
- 3947, 169,
- 4001, 2249,
- 4198, 4632,
- 4372, 8,
- 4993, 70,
- 5022, 265,
- 5568, 1194,
- 5664, 495,
- 5698, 115,
- 5885, 854,
- 6115, 2990,
- 6266, 153,
- 6376, 39,
- 6432, 16,
- 6601, 345,
- 7108, 1957,
- 7231, 660,
- 7491, 202,
- 7687, 93,
- 8054, 3882,
- 8108, 9624,
- 8186, 1424,
- 8243, 59,
- 8354, 935,
- 8358, 6401,
- 8383, 439,
- 8794, 285,
- 8940, 124,
- 9643, 25,
- 9643, 581,
- 9670, 2709,
- 10065, 160,
- 10218, 9,
- 10240, 1728,
- 10249, 80,
- 10418, 1113,
- 10497, 373,
- 10650, 236,
- 11095, 44,
- 11095, 756,
- 11284, 4978,
- 11290, 16722,
- 11815, 2299,
- 11882, 482,
- 12059, 114,
- 12332, 8550,
- 12363, 1394,
- 12392, 186,
- 12517, 336,
- 12549, 3413,
- 12694, 953,
- 13096, 614,
- 13185, 71,
- 13247, 262,
- 13479, 1914,
- 13791, 14,
- 13805, 30,
- 14064, 138,
- 14182, 420,
- 14212, 1175,
- 14477, 765,
- 14605, 2745,
- 14612, 6324,
- 14730, 4199,
- 14833, 301,
- 14842, 203,
- 14910, 12790,
- 15171, 100,
- 15191, 1625,
- 15289, 532,
- 15405, 52,
- 15550, 985,
- 16096, 357,
- 16175, 2113,
- 16284, 232,
- 16333, 669,
- 16363, 22999,
- 16396, 156,
- 16443, 1270,
- 16455, 3482,
- 16543, 8,
- 16650, 5425,
- 16878, 452,
- 16989, 84,
- 17024, 9676,
- 17194, 876,
- 17730, 20,
- 17780, 1442,
- 17864, 38,
- 17874, 254,
- 17929, 526,
- 18011, 2403,
- 18751, 7153,
- 18786, 117,
- 18820, 4420,
- 19002, 63,
- 19099, 401,
- 19111, 183,
- 19197, 776,
- 19202, 2953,
- 19236, 1052,
- 19255, 301,
- 19354, 1760,
- 19432, 593,
-};
-
-const Word16 gp_gamma_1sfr_6b_fx[2 * 64] = /*Q14/Q9 */
-{
- 436, 182,
- 473, 63,
- 962, 16,
- 992, 647,
- 1258, 1582,
- 1447, 351,
- 1711, 125,
- 1809, 46,
- 2569, 4173,
- 2607, 957,
- 2826, 251,
- 2904, 12481,
- 3248, 26,
- 3594, 2254,
- 3664, 78,
- 3715, 483,
- 4232, 8,
- 4681, 188,
- 5066, 6623,
- 5232, 1273,
- 6232, 695,
- 6234, 49,
- 6238, 113,
- 6312, 318,
- 7012, 17,
- 7327, 3183,
- 8008, 1739,
- 8692, 446,
- 8769, 163,
- 8923, 1019,
- 9094, 81,
- 10358, 286,
- 10491, 28,
- 10612, 9788,
- 10715, 760,
- 11045, 4822,
- 11319, 2403,
- 11684, 56,
- 12314, 108,
- 12460, 556,
- 12580, 9,
- 12716, 213,
- 12821, 1336,
- 14202, 374,
- 14325, 16971,
- 14612, 838,
- 14625, 3285,
- 14668, 6231,
- 14919, 39,
- 15131, 137,
- 15476, 1847,
- 16056, 255,
- 16277, 494,
- 16290, 66,
- 16582, 1048,
- 16859, 17,
- 17220, 8723,
- 17443, 4295,
- 18069, 2499,
- 18212, 176,
- 18499, 91,
- 18517, 1445,
- 18522, 332,
- 18596, 663,
-};
-
-const Word16 gp_gamma_2sfr_7b_fx[2 * 128] = /*Q14/Q9 */
-{
- 99, 1224,
- 156, 243,
- 168, 579,
- 290, 355,
- 437, 441,
- 475, 187,
- 734, 738,
- 930, 93,
- 1133, 153,
- 1136, 298,
- 1490, 508,
- 1946, 401,
- 1978, 16790,
- 2098, 224,
- 2117, 962,
- 2407, 119,
- 2686, 339,
- 2929, 555,
- 3404, 271,
- 3465, 171,
- 3469, 422,
- 3714, 663,
- 4436, 494,
- 4494, 332,
- 4571, 220,
- 4583, 2182,
- 4997, 848,
- 5346, 380,
- 5419, 108,
- 5570, 579,
- 5758, 266,
- 5875, 442,
- 5927, 170,
- 6204, 3338,
- 6394, 6435,
- 6515, 328,
- 6638, 730,
- 6687, 1472,
- 7045, 1056,
- 7101, 498,
- 7123, 210,
- 7163, 9668,
- 7345, 386,
- 7598, 280,
- 7853, 627,
- 8462, 442,
- 8648, 331,
- 8822, 236,
- 8887, 551,
- 8953, 906,
- 9317, 136,
- 9587, 386,
- 9651, 691,
- 9796, 286,
- 9852, 489,
- 10005, 1215,
- 10041, 192,
- 10623, 576,
- 10758, 329,
- 10840, 425,
- 10944, 792,
- 11038, 257,
- 11190, 1870,
- 11541, 501,
- 11729, 642,
- 11873, 367,
- 12064, 163,
- 12332, 216,
- 12339, 1100,
- 12339, 295,
- 12478, 444,
- 12561, 568,
- 12665, 845,
- 13257, 396,
- 13317, 677,
- 13411, 511,
- 13709, 324,
- 13710, 1547,
- 13711, 246,
- 14054, 991,
- 14112, 447,
- 14246, 580,
- 14355, 748,
- 14394, 175,
- 14453, 99,
- 14604, 363,
- 14887, 491,
- 15074, 282,
- 15110, 637,
- 15242, 1292,
- 15351, 413,
- 15430, 843,
- 15700, 541,
- 15776, 204,
- 15964, 335,
- 15992, 688,
- 16077, 453,
- 16315, 4617,
- 16406, 1032,
- 16549, 595,
- 16666, 384,
- 16850, 776,
- 16851, 482,
- 16916, 253,
- 17234, 309,
- 17307, 2128,
- 17469, 546,
- 17666, 643,
- 17699, 421,
- 17852, 882,
- 17870, 146,
- 18146, 1244,
- 18457, 489,
- 18478, 346,
- 18588, 723,
- 18826, 208,
- 19011, 1731,
- 19042, 586,
- 19286, 281,
- 19428, 944,
- 19446, 382,
- 19555, 444,
- 19689, 792,
- 19755, 1111,
- 19762, 527,
- 19769, 1405,
- 19774, 657,
- 19780, 2675,
-};
-
-const Word16 gp_gamma_2sfr_6b_fx[2 * 64] = /*Q14/Q9 */
-{
- 185, 306,
- 435, 519,
- 458, 145,
- 1000, 211,
- 1217, 394,
- 1241, 751,
- 1788, 93,
- 2026, 1234,
- 2162, 265,
- 2397, 158,
- 2617, 472,
- 3324, 340,
- 3391, 623,
- 3835, 207,
- 4503, 17210,
- 4628, 407,
- 4939, 897,
- 5102, 275,
- 5300, 120,
- 5560, 511,
- 6309, 1909,
- 6571, 335,
- 6770, 205,
- 6990, 642,
- 7085, 5087,
- 7500, 428,
- 8357, 827,
- 8452, 261,
- 9079, 537,
- 9289, 354,
- 9854, 1176,
- 9864, 165,
- 10436, 8580,
- 10549, 437,
- 10615, 677,
- 11010, 282,
- 11940, 530,
- 12183, 367,
- 12475, 920,
- 12865, 225,
- 13359, 618,
- 13431, 441,
- 13521, 1623,
- 14177, 341,
- 14299, 130,
- 14452, 775,
- 14799, 508,
- 15250, 276,
- 15715, 1130,
- 15757, 660,
- 15879, 422,
- 16355, 3256,
- 16439, 187,
- 16751, 562,
- 16906, 331,
- 17178, 827,
- 17889, 471,
- 18219, 2175,
- 18786, 248,
- 18985, 1354,
- 19067, 703,
- 19220, 384,
- 19349, 954,
- 19422, 553,
-};
-const Word16 gp_gamma_3sfr_6b_fx[2 * 64] = /*Q14/Q9 */
-{
- 195, 150,
- 817, 288,
- 1152, 616,
- 1366, 188,
- 1377, 410,
- 1526, 902,
- 1570, 98,
- 2258, 238,
- 2489, 518,
- 2935, 338,
- 3142, 161,
- 3456, 1705,
- 3990, 432,
- 4159, 709,
- 4187, 270,
- 4374, 1236,
- 5283, 526,
- 5431, 131,
- 5507, 356,
- 5762, 211,
- 6792, 620,
- 6842, 446,
- 6969, 304,
- 7671, 807,
- 8362, 245,
- 8448, 530,
- 8610, 380,
- 9314, 1088,
- 9828, 170,
- 9921, 7010,
- 10026, 459,
- 10193, 312,
- 10261, 658,
- 11554, 394,
- 11739, 882,
- 11791, 542,
- 11985, 4329,
- 11996, 246,
- 12762, 13441,
- 12844, 1512,
- 13131, 465,
- 13135, 339,
- 13215, 740,
- 14138, 608,
- 14524, 417,
- 14780, 1030,
- 14823, 283,
- 15016, 171,
- 15264, 527,
- 15823, 2706,
- 15943, 699,
- 15959, 360,
- 16350, 473,
- 17211, 573,
- 17366, 901,
- 17517, 238,
- 17799, 414,
- 18069, 1415,
- 18630, 1920,
- 18887, 634,
- 19018, 318,
- 19304, 495,
- 19400, 1114,
- 19413, 767,
-};
-
-
-const Word16 gp_gamma_4sfr_6b_fx[2 * 64] = /*Q14/Q9 */
-{
- 153, 141,
- 282, 501,
- 399, 239,
- 783, 369,
- 1110, 744,
- 1430, 183,
- 1440, 1748,
- 1524, 1091,
- 1602, 296,
- 1828, 99,
- 2000, 439,
- 2678, 228,
- 2815, 600,
- 3084, 347,
- 3861, 477,
- 4154, 163,
- 4214, 285,
- 4428, 733,
- 4976, 384,
- 5482, 566,
- 5552, 234,
- 6158, 929,
- 6536, 470,
- 6560, 326,
- 7288, 173,
- 7429, 663,
- 7447, 10616,
- 7871, 407,
- 8457, 266,
- 8559, 550,
- 8679, 1421,
- 9457, 356,
- 9533, 785,
- 9854, 471,
- 10584, 5781,
- 10792, 3815,
- 10813, 206,
- 10829, 302,
- 10986, 606,
- 11380, 433,
- 11468, 1073,
- 12485, 356,
- 12726, 520,
- 12783, 721,
- 13554, 259,
- 13763, 139,
- 13884, 430,
- 14060, 2592,
- 14266, 599,
- 14332, 925,
- 14997, 337,
- 15355, 485,
- 15526, 712,
- 16440, 587,
- 16504, 395,
- 16626, 204,
- 17228, 1287,
- 17563, 805,
- 17629, 517,
- 18159, 1814,
- 18320, 303,
- 19228, 437,
- 19263, 636,
- 19417, 989,
-};
-
-
-
-/*----------------------------------------------------------------------------------*
- * Transition coding - gain quantization table
- *----------------------------------------------------------------------------------*/
-const Word16 tbl_gain_code_tc_fx[N_GAIN_CODE_TC] = /*q13 */
-{
- 2966,
- 5930,
- 7924,
- 9712,
- 11566,
- 13754,
- 16993,
- 27280
-};
-const Word16 tbl_gain_code_tc_quant_mean[N_GAIN_CODE_TC - 1] =
-{
- 4448, 6927, 8818, 10639,
- 12660, 15374, 22136
-}; /* Q13 */
-/*-----------------------------------------------------------------*
- * Transition coding - gain quantization table for g_trans
- *-----------------------------------------------------------------*/
-const Word16 tbl_gain_trans_tc_fx[N_GAIN_TC] =
-{
- 4588, 11109, 19212, 29862,/*<- Q7
-Q4 ->*/ 5536, 8184, 13115, 24000
-};
-/*-----------------------------------------------------------------*
- * Transition coding - table of prototype glottal impulses
- *-----------------------------------------------------------------*/
-
-const Word16 Glottal_cdbk_fx[L_IMPULSE*NUM_IMPULSE] = /*Q13*/
-{
- /* impulse 0 */
- -715, -1690, -2903, -1742, -1295, -4266,
- -4893, 1725, 8192, 5812, -628, -1956,
- 581, 936, -81, 831, 1517,
-
- /* impulse 1 */
- -2168, -1356, -404, -2715, -4469, -2164,
- -2180, -8058, -9140, 1163, 10343, 6677,
- -1758, -2839, 377, 326, -490,
-
- /* impulse 2 */
- 360, 561, 4184, 2533, -3326, -2549,
- 2059, -2112, -9542, -6134, 1307, 124,
- -3421, -1465, 475, -886, -1262,
-
- /* impulse 3 */
- -1294, -715, -184, -1544, -1638, -219,
- -3503, -9409, -7955, -1407, -285, -2494,
- 305, 4658, 3289, 116, 1488,
-
- /* impulse 4 */
- 837, 2523, 2444, 2679, 5962, 6935,
- -924, -9907, -7565, 643, 1350, -2577,
- -2100, -277, -1546, -2279, -882,
-
- /* impulse 5 */
- -418, -886, -48, -494, -2368, -2060,
- -1233, -5271,-10430, -6955, 3301, 7578,
- 2599, -1665, -461, 735, -181,
-
- /* impulse 6 */
- -467, -1865, -1455, -127, -1881, -3776,
- 822, 8335, 8192, 863, -2762, -375,
- 757, -558, -285, 653, 150,
-
- /* impulse 7 */
- 1087, 471, -618, 706, 1546, -1605,
- -3256, 2396, 8060, 5189, -99, -37,
- 1105, -668, -1434, -59, -81
-};
-
-/*----------------------------------------------------------------------------------*
- * AMR-WB IO WB BWE - deemphasis
- *----------------------------------------------------------------------------------*/
-const Word16 deem_tab_fx[56] =
-{//Q15
- 20668, 20625, 20583, 20541, 20501, 20462, 20423, 20385,
- 20348, 20313, 20277, 20243, 20210, 20177, 20146, 20115,
- 20085, 20055, 20027, 19999, 19972, 19946, 19921, 19896,
- 19873, 19850, 19827, 19806, 19785, 19766, 19746, 19728,
- 19710, 19693, 19677, 19662, 19647, 19633, 19620, 19607,
- 19596, 19585, 19574, 19565, 19556, 19548, 19540, 19533,
- 19527, 19522, 19518, 19514, 19510, 19508, 19506, 19505
-};
-
-
-const Word16 filt_hp_fx[56] =
-{//Q15
- 53, 153, 274, 415, 578, 765, 978, 1217, 1483, 1778, 2102,
- 2457, 2843, 3261, 3710, 4192, 4706, 5252, 5829, 6438, 7077,
- 7746, 8443, 9168, 9918, 10693, 11489, 12306, 13141, 13992,
- 14856, 15732, 16615, 17504, 18395, 19287, 20174, 21056, 21928,
- 22787, 23631, 24456, 25260, 26039, 26791, 27512, 28201, 28853,
- 29468, 30043, 30574, 31061, 31502, 31894, 32237, 32529
-};
-
-/* table of values exp(-j*w*i) */
-
-const Word16 exp_tab_q_fx[34] = /*Q14 */
-{
- 16384, -16068, 15137, -13622,
- 11585, -9101, 6270, -3195,
- 0, 3196, -6269, 9102,
- -11584, 13623, -15136, 16069,
- -16383, 0, -3195, 6270,
- -9101, 11585, -13622, 15137,
- -16068, 16384, -16068, 15137,
- -13622, 11585, -9101, 6270,
- -3195, 0
-};
-
-
-const Word16 exp_tab_p_fx[34] = /*Q14 */
-{
- 16384, -11584, 0, 11585,
- -16383, 11585, 0, -11584,
- 16384, -11584, 0, 11585,
- -16383, 11585, 0, -11584,
- 16384, 0, -11584, 16384,
- -11584, 0, 11585, -16383,
- 11585, 0, -11584, 16384,
- -11584, 0, 11585, -16383,
- 11585, 0
-};
-/* gains for 23k85 mode */
-
-const Word16 HP_gain_fx[16] =
-{//Q15
- 3624, 4673, 5597, 6479, 7425, 8378, 9324, 10264,
- 11210, 12206, 13391, 14844, 16770, 19655, 24289, 32728
-};
-/* band-pass 6-8kHz filter */
-
-const Word16 fir_6k_7k_fx[31] =
-{//Q15
- -32, 47, 32, -27, -369,
- 1122, -1421, 0, 3798, -8880,
- 12349, -10984, 3548, 7766, -18001,
- 22118, -18001, 7766, 3548, -10984,
- 12349, -8880, 3798, 0, -1421,
- 1122, -369, -27, 32, 47,
- -32
-};
-const Word16 no_lead_fx[][MAX_NO_SCALES * 2] =
-{//Q0
- { 1, 0, 0, 1, 0, 0, }, /* 14 */
- { 2, 0, 0, 1, 0, 0, }, /* 15 */
- { 4, 2, 0, 1, 0, 0, }, /* 18 */
- { 4, 2, 0, 2, 0, 0, }, /* 19 */
- { 7, 5, 2, 5, 4, 2, }, /* 25 */
- { 8, 8, 3, 8, 6, 2, }, /* 28 */ /* mode UV WB*/
- { 4, 2, 0, 1, 0, 0, }, /* 18 */
- { 4, 0, 0, 2, 1, 0, }, /* 19 */
- { 9, 8, 8, 2, 2, 1, }, /* 24 */
- { 8, 5, 2, 5, 2, 1, }, /* 25 */
- { 18, 16, 8, 5, 5, 1, }, /* 29 */
- { 24, 21, 10, 8, 8, 2, }, /* 32 */ /* mode UV NB*/
-
- { 2, 0, 0, 2, 0, 0, }, /* 17 */
- { 4, 2, 0, 1, 0, 0, }, /* 18 */
- { 7, 5, 2, 2, 0, 0, }, /* 21 */
- { 5, 2, 1, 4, 1, 0, }, /* 22 */
- { 8, 5, 2, 5, 2, 0, }, /* 25 */
- { 8, 7, 4, 5, 3, 2, },
- { 8, 8, 4, 6, 5, 2, },
- { 13, 8, 5, 6, 5, 2, },
- { 13, 8, 5, 8, 6, 2, },
- { 13, 8, 5, 11, 8, 2, }, /* 30 */
- { 24, 21, 8, 9, 8, 2, }, /* 32 */
- { 23, 18, 8, 13, 11, 3, },
- { 23, 21, 8, 17, 13, 4, }, /* 34 */
- { 31, 31, 17, 26, 25, 9, }, /* 37 */ /* mode V WB*/
- { 2, 0, 0, 2, 2, 0, }, /* 17 */
- { 4, 2, 0, 1, 0, 0, }, /* 18 */
- { 7, 5, 2, 2, 2, 0, }, /* 22 */
- { 8, 7, 2, 2, 2, 0, }, /* 23 */
- { 11, 8, 2, 2, 2, 0, }, /* 24 */
- { 13, 13, 9, 2, 2, 0, }, /* 25 */
- { 13, 11, 7, 5, 2, 0, }, /* 27 */
- { 18, 14, 9, 5, 5, 2, }, /* 29 */
- { 31, 31, 14, 11, 11, 5, }, /* 34 */
- { 31, 31, 27, 24, 21, 14, }, /* 37 */ /* mode V NB */
- { 5, 4, 0, 0, 0, 0, }, /* 12 (11.883) */
- { 2, 0, 0, 2, 0, 0, }, /* 16 (15.826) */
- { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
- { 5, 4, 0, 2, 0, 0, }, /* 20 (19.796) */
- { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
- { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
- { 5, 5, 2, 4, 2, 0, }, /* 23 (22.959) */
- { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
- { 8, 8, 7, 5, 2, 0, }, /* 26 (25.904) */
- { 13, 9, 8, 5, 2, 0, }, /* 27 (26.829) */
- { 13, 11, 8, 5, 5, 1, }, /* 28 (27.989) */
- { 13, 9, 8, 8, 5, 2, }, /* 29 (28.984) */
- { 22, 16, 10, 6, 5, 2, }, /* 30 (29.980) */
- { 21, 14, 10, 8, 7, 2, }, /* 31 (30.966) */
- { 24, 21, 10, 8, 8, 2, }, /* 32 (31.995) */ /* G WB*/
-
- { 5, 4, 1, 0, 0, 0, }, /* 12 (11.925) */
- { 2, 0, 0, 2, 0, 0, }, /* 16 (15.826) */
- { 5, 4, 1, 1, 0, 0, }, /* 19 (18.745) */
- { 5, 4, 1, 2, 0, 0, }, /* 20 (19.838) */
- { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
- { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
- { 9, 8, 5, 2, 1, 0, }, /* 23 (22.815) */
- { 14, 13, 8, 2, 2, 0, }, /* 25 (24.996) */
- { 13, 8, 7, 4, 2, 0, }, /* 26 (25.993) */
- { 13, 9, 8, 5, 2, 2, }, /* 27 (26.954) */
- { 18, 13, 8, 5, 2, 2, }, /* 28 (27.992) */
- { 21, 13, 11, 5, 3, 2, }, /* 29 (28.996) */
- { 22, 21, 13, 5, 5, 2, }, /* 30 (29.988) */
- { 23, 21, 17, 7, 5, 2, }, /* 31 (30.962) */
- { 27, 23, 21, 8, 5, 2, }, /* 32 (31.987) */ /* G NB*/
- { 2, 0, 0, 2, 0, 0, }, /* 17 */
- { 4, 2, 0, 1, 0, 0, }, /* 18 */
- { 4, 1, 0, 4, 0, 0, }, /* 21 */
- { 5, 2, 0, 4, 1, 0, }, /* 22 */
- { 8, 5, 2, 4, 0, 0, }, /* 24 */
- { 8, 5, 2, 5, 2, 0, }, /* 25 */
- { 14, 10, 5, 5, 5, 1, }, /* 28 */
- { 14, 10, 5, 8, 8, 4, }, /* 30 */
- { 13, 10, 5, 13, 8, 8, },
- { 23, 21, 8, 8, 8, 4, },
- { 23, 18, 5, 13, 8, 8, }, /* 33 */
- /* mode T WB */
- { 2, 0, 0, 2, 2, 0, }, /* 17 */
- { 4, 2, 0, 1, 0, 0, }, /* 18 */
- { 7, 5, 2, 2, 2, 0, }, /* 22 */
- { 8, 7, 4, 2, 2, 0, }, /* 23 */
- { 11, 8, 5, 2, 2, 0, }, /* 24 */
- { 18, 8, 5, 2, 2, 0, }, /* 25 */
- { 16, 8, 5, 5, 5, 2, }, /* 28 */
- { 28, 23, 8, 5, 5, 5, }, /* 31 */
- { 31, 31, 8, 5, 5, 7, }, /* 32 */ /* mode T NB */
-
- { 18, 18, 11, 9, 6, 5, }, /* 31 */
- { 24, 23, 13, 9, 6, 5, }, /* 32 */ /* mode G 16k */
-
- { 24, 23, 13, 9, 6, 5, }, /* 32 (31.998) */
- { 36, 31, 18, 9, 6, 5, }, /* 33 (32.983) */ /* T 16k */
-
- { 2, 0, 0, 2, 2, 0, }, /* 17 */
- { 7, 5, 2, 2, 0, 0, }, /* 21 */
- { 7, 5, 2, 2, 2, 0, }, /* 22 */
- { 9, 8, 3, 4, 2, 0, }, /* 25 */
- { 11, 9, 8, 4, 2, 0, }, /* 26 */
- { 48, 48, 34, 13, 11, 9 }, /* 36 */ /* mode AUDIO_WB 36 + 4 + 1 */
-
- { 22, 10, 3, 0, 0, 0 }, /* 17 */
- { 6, 6, 2, 2, 0, 0 }, /* 21 */
- { 6, 6, 2, 2, 2, 0 }, /* 22 */
- { 23, 10, 3, 2, 2, 0 }, /* 26 */
- { 32, 16, 3, 2, 2, 0 }, /* 27 */ /* AUDIO_NB */
- { 39, 30, 12, 2, 2, 0 }, /* 28 */ /* AUDIO_NB */
- { 11, 9, 8, 4, 2, 0, }, /* 26 */
- { 48, 48, 48, 13, 9, 8 }, /* 36 */ /* mode AUDIO_WB 16k 15-36 + 4 + 1*/
- { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
- { 13, 13, 5, 5, 5, 0, }, /* 28 (27.994) */
- { 18, 17, 5, 5, 5, 1, }, /* 29 (28.996) */
- { 17, 13, 5, 8, 6, 2, }, /* 30 (29.991) */
- { 23, 21, 8, 9, 8, 3, }, /* 32 (31.992) */
- { 31, 29, 16, 8, 8, 3, }, /* 33 (32.993) */
- { 31, 25, 16, 12, 8, 8, }, /* 34 (33.968) */
- { 46, 48, 18, 18, 18, 12, }, /* 37 (36.995) */ /* VOICED 16k */
- { 14, 12, 9, 2, 2, 0, }, /* 25 (24.980) */
- { 15, 13, 3, 2, 2, 0, }, /* 25 (24.974) */
- { 17, 3, 0, 2, 2, 1, }, /* 25 (24.852) */
- { 13, 10, 3, 2, 2, 2, }, /* 25 (24.994) */
- { 14, 13, 8, 2, 2, 0, }, /* 25 (24.996) */
- { 7, 3, 0, 5, 3, 1, }, /* 25 (24.671) */
- { 4, 3, 2, 6, 6, 5, }, /* 25 (24.936) */
- { 4, 2, 0, 9, 9, 3, }, /* 25 (24.955) */
- { 4, 2, 0, 9, 8, 2, }, /* 25 (24.853) */
- { 4, 2, 0, 9, 7, 6, }, /* 25 (24.881) */
- { 6, 3, 0, 6, 3, 2, }, /* 25 (24.939) */
- { 3, 2, 0, 9, 8, 5, }, /* 25 (24.996) */
- { 2, 2, 0, 15, 3, 3, }, /* 25 (24.310) */
- { 4, 2, 0, 9, 9, 3, }, /* 25 (24.955) */
- { 4, 4, 2, 7, 6, 3, }, /* 25 (24.984) */
- { 3, 2, 0, 9, 7, 6, }, /* 25 (24.866) */
-
-};
-
-const Word16 no_lead_p_fx[][MAX_NO_SCALES * 2] = // Q0
-{
-
- { 2, 1, 0, 0, 0, 0, }, /* 9 (8.464) */
- { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
- { 5, 5, 2, 4, 2, 0, }, /* 23 (22.959) */
- { 8, 5, 2, 4, 0, 0, }, /* 24 (23.949) */
- { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
- { 13, 11, 5, 5, 2, 0, }, /* 27 (26.902) */
- { 11, 10, 5, 6, 5, 2, }, /* 28 (27.996) */
- { 14, 13, 5, 7, 5, 2, }, /* 29 (28.937) */
- { 16, 13, 5, 8, 7, 2, }, /* 30 (29.954) */
- { 21, 21, 5, 8, 5, 2, }, /* 31 (30.978) */
- { 24, 21, 5, 8, 8, 4, }, /* 32 (31.978) */
- { 32, 23, 5, 13, 11, 5, }, /* 34 (33.975) */
- { 36, 31, 8, 16, 13, 5, }, /* 35 (34.975) */
- { 45, 35, 16, 18, 13, 5, }, /* 36 (35.889) */
- { 45, 35, 16, 38, 31, 8, }, /* 39 (38.488) */ /* V WB*/ /* 14 */
-
- { 2, 0, 0, 0, 0, 0, }, /* 8 (7.913) */
- { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
- { 8, 7, 2, 2, 2, 0, }, /* 23 (22.773) */
- { 13, 11, 5, 2, 1, 0, }, /* 24 (23.999) */
- { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
- { 13, 11, 5, 5, 2, 1, }, /* 27 (26.962) */
- { 13, 11, 5, 5, 5, 2, }, /* 28 (27.835) */
- { 14, 13, 5, 7, 5, 2, }, /* 29 (28.937) */
- { 23, 21, 5, 5, 5, 2, }, /* 30 (29.969) */
- { 23, 18, 5, 8, 5, 2, }, /* 31 (30.952) */
- { 24, 21, 5, 8, 8, 4, }, /* 32 (31.978) */
- { 43, 41, 13, 9, 8, 5, }, /* 34 (33.992) */
- { 43, 36, 13, 13, 10, 5, }, /* 35 (35.000) */
- { 43, 40, 13, 17, 13, 9, }, /* 36 (35.980) */
- { 43, 42, 13, 31, 30, 18, }, /* 39 (38.512) */ /* V NB*/ /* 29 */
-
- { 2, 0, 0, 1, 0, 0, }, /* 15 (14.733) */
- { 5, 4, 1, 1, 0, 0, }, /* 19 (18.745) */
- { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
- { 10, 9, 5, 2, 0, 0, }, /* 23 (22.791) */
- { 14, 13, 8, 2, 0, 0, }, /* 24 (23.999) */
- { 14, 13, 8, 2, 2, 0, }, /* 25 (24.996) */
- { 18, 17, 13, 2, 2, 0, }, /* 26 (25.934) */
- { 14, 13, 8, 5, 4, 0, }, /* 28 (27.969) */
- { 18, 17, 13, 5, 4, 2, }, /* 29 (28.996) */
- { 22, 21, 13, 5, 5, 2, }, /* 30 (29.988) */
- { 31, 23, 21, 5, 5, 2, }, /* 31 (30.931) */
- { 27, 23, 21, 8, 5, 2, }, /* 32 (31.987) */
- { 31, 23, 21, 9, 8, 5, }, /* 33 (32.982) */
- { 32, 31, 24, 11, 8, 5, }, /* 34 (33.967) */
- { 32, 32, 28, 13, 11, 8, }, /* 35 (34.994) */ /* G WB*/ /* 44 */
-
- { 2, 0, 0, 1, 0, 0, }, /* 15 (14.733) */
- { 5, 4, 2, 1, 0, 0, }, /* 19 (18.792) */
- { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
- { 8, 7, 2, 2, 2, 0, }, /* 23 (22.773) */
- { 13, 11, 2, 2, 1, 0, }, /* 24 (23.932) */
- { 16, 13, 2, 2, 2, 0, }, /* 25 (24.955) */
- { 21, 17, 2, 2, 2, 0, }, /* 26 (25.991) */
- { 13, 12, 2, 5, 5, 2, }, /* 28 (27.979) */
- { 18, 16, 2, 5, 5, 2, }, /* 29 (28.878) */
- { 23, 21, 2, 5, 5, 2, }, /* 30 (29.954) */
- { 32, 28, 2, 5, 5, 2, }, /* 31 (30.893) */
- { 38, 31, 2, 7, 5, 2, }, /* 32 (31.963) */
- { 33, 31, 2, 8, 8, 4, }, /* 33 (32.997) */
- { 42, 31, 2, 9, 9, 8, }, /* 34 (33.986) */
- { 42, 31, 2, 13, 11, 9, }, /* 35 (34.952) */ /* G NB*/ /* 59 */
-
- { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
- { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
- { 13, 8, 5, 4, 2, 0, }, /* 26 */
- { 13, 8, 5, 8, 6, 2, }, /* 29 */
- { 13, 8, 5, 9, 8, 5, }, /* 30 */
- { 48, 48, 48, 36, 36, 28 }, /* 40 */ /* mode 7 AUDIO_WB */ /* 65*/
-
- { 7, 5, 2, 2, 0, 0 }, /* 21 */
- { 13, 13, 9, 2, 2, 0 }, /* 25 */
- { 18, 18, 9, 2, 2, 0 }, /* 26 */
- { 24, 23, 10, 5, 4, 2 }, /* 30 */
- { 31, 31, 12, 5, 5, 2 }, /* 31 */ /*AUDIO_NB */ /* 70 */
- { 43, 34, 12, 5, 5, 4 }, /* 32 */ /*AUDIO_NB */ /* 71 */
- { 13, 8, 5, 9, 8, 5, }, /* 30 */
- { 48, 48, 45, 45, 31, 25 }, /* 40 */ /* mode AUDIO_WB 16k */ /* 73*/
-
- { 2, 0, 0, 2, 2, 0, }, /* 17 (16.823) */
- { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
- { 7, 5, 2, 2, 2, 0, }, /* 22 (21.907) */
- { 13, 11, 10, 2, 2, 0, }, /* 25 (24.863) */
- { 18, 18, 10, 2, 2, 0, }, /* 26 (25.921) */
- { 13, 9, 9, 5, 2, 0, }, /* 27 (26.837) */
- { 40, 28, 25, 18, 17, 2, }, /* 36 (35.998) */ /* INACTIVE NB*/ /* 80*/
-
- { 18, 17, 11, 0, 0, 0, }, /* 17 (16.932) */
- { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
- { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
- { 13, 13, 9, 2, 2, 0, }, /* 25 (24.845) */
- { 18, 18, 12, 2, 2, 0, }, /* 26 (25.999) */
- { 23, 23, 16, 2, 2, 0, }, /* 27 (26.981) */
- { 36, 32, 24, 17, 13, 13, }, /* 36 (35.929) */ /* INACTIVE WB */ /* 87 */
-
- { 2, 2, 0, 2, 0, 0, }, /* 17 (16.823) */
- { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
- { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
- { 13, 13, 9, 2, 2, 0, }, /* 25 (24.845) */
- { 18, 17, 13, 2, 2, 0, }, /* 26 (25.934) */
- { 23, 22, 17, 2, 2, 0, }, /* 27 (26.914) */
- { 34, 32, 24, 16, 16, 13, }, /* 36 (35.915) */ /* INACTIVE WB 16k*/ /* 94 */
-
- { 4, 2, 0, 1, 0, 0, }, /* 18 (17.479) */
- { 5, 4, 0, 1, 0, 0, }, /* 19 (18.703) */
- { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
- { 10, 9, 5, 2, 0, 0, }, /* 23 (22.791) */
- { 15, 13, 5, 2, 0, 0, }, /* 24 (23.999) */
- { 18, 16, 8, 5, 5, 1, }, /* 29 (28.966) */
- { 42, 32, 31, 5, 5, 2, }, /* 32 (31.990) */ /* UNVOICED NB*/ /* 100 */
-
- { 1, 0, 0, 1, 0, 0, }, /* 14 (13.640) */
- { 2, 0, 0, 1, 0, 0, }, /* 15 (14.733) */
- { 4, 2, 0, 1, 0, 0, }, /* 18 (17.479) */
- { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
- { 5, 4, 0, 2, 0, 0, }, /* 20 (19.796) */
- { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
- { 11, 10, 5, 6, 5, 2, }, /* 28 (27.996) */ /* UNVOICED WB */ /* 106 */
- { 9, 3, 0, 4, 0, 0, }, /* 24 (23.818) */
- { 18, 13, 10, 8, 3, 0, }, /* 30 (29.992) */
- { 24, 18, 10, 9, 3, 0, }, /* 31 (30.998) */
- { 32, 25, 10, 9, 3, 0, }, /* 32 (31.987) */
- { 42, 31, 10, 12, 3, 2, }, /* 34 (33.994) */
- { 44, 32, 27, 15, 3, 2, }, /* 35 (35.000) */
- { 44, 32, 25, 19, 3, 2, }, /* 36 (35.994) */
- { 48, 39, 32, 35, 15, 3, }, /* 39 (38.301) */ /* VOICED 16k */
- { 11, 10, 5, 4, 2, 0, }, /* 26 (25.917) */ /* 107 */
- { 23, 23, 17, 8, 7, 2, }, /* 32 (31.980) */
- { 32, 31, 18, 9, 7, 5, }, /* 33 (32.990) */
- { 31, 31, 18, 11, 9, 8, }, /* 34 (33.974) */
- { 32, 32, 20, 13, 12, 8, }, /* 35 (34.989) */
- { 32, 32, 23, 18, 17, 8, }, /* 36 (35.988) */
- { 32, 32, 23, 23, 22, 10, }, /* 37 (36.989) */ /* GENERIC 16k*/ /* 113 */
-
- { 2, 0, 0, 2, 0, 0, }, /* 16 (15.826) */ /* 114 */
- { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
- { 14, 13, 8, 2, 0, 0, }, /* 24 (23.999) */
- { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
- { 11, 10, 5, 4, 2, 0, }, /* 26 (25.917) */
- { 16, 13, 8, 4, 2, 0, }, /* 27 (26.883) */
- { 13, 13, 8, 5, 4, 2, }, /* 28 (27.901) */
- { 23, 18, 13, 5, 5, 2, }, /* 30 (29.916) */
- { 23, 23, 13, 7, 5, 2, }, /* 31 (30.993) */
- { 23, 23, 17, 8, 7, 2, }, /* 32 (31.980) */
- { 32, 31, 24, 8, 7, 2, }, /* 33 (32.958) */
- { 42, 32, 31, 9, 9, 4, }, /* 34 (33.987) */
- { 40, 32, 29, 12, 9, 9, }, /* 35 (34.994) */
- { 40, 32, 31, 17, 11, 11, }, /* 36 (35.968) */
- { 41, 32, 31, 20, 18, 13, }, /* 37 (36.971) */ /* GENERIC 12.8k MA*/ /* 128 */
-
- { 11, 10, 5, 4, 2, 0, }, /* 26 (25.917) */ /* 129 */
- { 23, 23, 17, 8, 7, 2, }, /* 32 (31.980) */
- { 31, 31, 18, 9, 8, 2, }, /* 33 (32.995) */
- { 48, 32, 24, 9, 8, 3, }, /* 34 (33.993) */
- { 48, 32, 28, 11, 10, 3, }, /* 35 (34.992) */
- { 48, 37, 32, 16, 12, 4, }, /* 36 (35.997) */
- { 48, 37, 32, 18, 17, 12, }, /* 37 (36.961) */ /* AUDIO 16k */
-};
-
-/*----------------------------------------------------------------------------------*
- * Enhacer - 2.0 - 6.4 kHz impulse response with phase dispersion in freq. domain
- *----------------------------------------------------------------------------------*/
-const Word16 low_H[64] = /* (1Q14) */
-{
- 16388, 16380, 16386, 16381, 16382, 16382, 16381, 16383, 16385, 10265,
- 10154, 9894, 14051, 16342, -531, 13216, 16372, 15509, 9406, 15948,
- 4726, 14593, 10404, 9795, -16337, -1815, -10624, 12646, 14555, -12684,
- 11388, 8175, 16382, -14198, 11781, 10378, 7515, 10423, -12473, 16284,
- -1200, -13137, 12658, -7446, 15683, -3764, -13419, -5281, 521, -9686,
- -16375, -1219, 8435, -13059, -12862, -12775, -1, 2, 0, -3,
- -1, -1, -2, 1
-};
-
-const Word16 low_H16k[80] = /* (1Q14) */
-{
- 16388, 16380, 16386, 16381, 16382, 16382, 16381, 16383, 16385, 10265,
- 10154, 9894, 14051, 16342, -531, 13216, 16372, 15509, 9406, 15948,
- 4726, 14593, 10404, 9795, -16337, -1815, -10624, 12646, 14555, -12684,
- 11388, 8175, -4121, -13408, 10605, -12308, 16358, 4699, 7640, -7360,
- 16382, -14639, -14494, 15695, -907, -10815, -12489, 9416, 15857,
- -14198, 11781, 10378, 7515, 10423, -12473, 16284, -1200, -13137, 12658,
- -7446, 15683, -3764, -13419, -5281, 521, -9686, -16375, -1219, 8435,
- -13059, -12862, -12775, -1, 2, 0, -3, -1, -1, -2, 1
-};
-/*----------------------------------------------------------------------------------*
- * Enhancer - 3.2 - 6.4 kHz impulse response with phase dispersion in freq. domain
- *----------------------------------------------------------------------------------*/
-
-const Word16 mid_H[64] = /* (1Q14) */
-{
- 16382, 16381, 16384, 16384, 16385, 16387, 16386, 16382, 16387, 16382,
- 16385, 16385, 16385, 16384, 16382, 16388, 14847, 9629, 13248, 14486,
- 10995, 642, 13817, 13779, 6468, 8664, 11634, 9780, -14636, -982,
- 11746, -722, 16385, -16366, -11423, 16354, 7362, 13147, -11538, -13904,
- -15052, -8862, 8811, -16371, -12146, 7660, -9638, -13254, -6923, 3,
- -5, -2, -6, 1, 6, 5, -8, -2, 3, -5,
- 0, -2, -4, 3
-};
-
-const Word16 mid_H16k[80] = /* (1Q14) */
-{
- 16382, 16381, 16384, 16384, 16385, 16387, 16386, 16382, 16387, 16382,
- 16385, 16385, 16385, 16384, 16382, 16388, 14847, 9629, 13248, 14486,
- 10995, 642, 13817, 13779, 6468, 8664, 11634, 9780, -14636, -982,
- 11746, -722, 108, -16195, -13199, -13289, 5114, 12941, 7110, 8873,
- 16385, -13774, -14761, 10047, -15566, -9584, 9707, 2483, 16383,
- -16366, -11423, 16354, 7362, 13147, -11538, -13904, -15052, -8862,
- 8811, -16371, -12146, 7660, -9638, -13254, -6923, 3, -5, -2, -6,
- 1, 6, 5, -8, -2, 3, -5, 0, -2, -4, 3
-};
-
-/*-------------------------------------------------------------------*
- * Low-pass FIR filter for low-freq post-filtering
- * response : 0dB @ 50Hz, -6dB @ 500Hz, -45dB @ 1kHz)
- * filter parameters: fs/2=8000, fc=500, gain=1.0, n=16
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * Bass post-filter
- *-------------------------------------------------------------------*/
-
-/* For bass post filter */
-const Word16 filt_lp_fx[1 + L_FILT] =
-{
- 2892/*0.088250f Q15*/, 2831/*0.086410f Q15*/, 2657/*0.081074f Q15*/, 2384/*0.072768f Q15*/,
- 2041/*0.062294f Q15*/, 1659/*0.050623f Q15*/, 1271/*0.038774f Q15*/, 907/*0.027692f Q15*/,
- 594/*0.018130f Q15*/, 347/*0.010578f Q15*/, 171/*0.005221f Q15*/, 64/*0.001946f Q15*/,
- 13/*0.000385f Q15*/
-};
-
-const Word16 filt_lp_16kHz_fx[1 + L_FILT16k] =
-{
- 2340/*0.071410f Q15*/, 2308/*0.070433f Q15*/, 2214/*0.067568f Q15*/, 2064/*0.062999f Q15*/,
- 1868/*0.057020f Q15*/, 1639/*0.050005f Q15*/, 1389/*0.042378f Q15*/, 1133/*0.034577f Q15*/,
- 885/*0.027022f Q15*/, 658/*0.020078f Q15*/, 460/*0.014031f Q15*/, 297/*0.009070f Q15*/,
- 173/*0.005276f Q15*/, 86/*0.002625f Q15*/, 33/*0.000999f Q15*/, 7/*0.000205f Q15*/
-};
-
-/*-------------------------------------------------------------------*
- * Pulse indexing tables for ACELP innovation coding
- *-------------------------------------------------------------------*/
-
-const Word32 PI_select_table[23][8] = // Q0
-{
- {1, 0, 0, 0, 0, 0, 0, 0},
- {1, 1, 0, 0, 0, 0, 0, 0},
- {1, 2, 1, 0, 0, 0, 0, 0},
- {1, 3, 3, 1, 0, 0, 0, 0},
- {1, 4, 6, 4, 1, 0, 0, 0},
- {1, 5, 10, 10, 5, 1, 0, 0},
- {1, 6, 15, 20, 15, 6, 1, 0},
- {1, 7, 21, 35, 35, 21, 7, 1},
- {1, 8, 28, 56, 70, 56, 28, 8},
- {1, 9, 36, 84, 126, 126, 84, 36},
- {1, 10, 45, 120, 210, 252, 210, 120},
- {1, 11, 55, 165, 330, 462, 462, 330},
- {1, 12, 66, 220, 495, 792, 924, 792},
- {1, 13, 78, 286, 715, 1287, 1716, 1716},
- {1, 14, 91, 364, 1001, 2002, 3003, 3432},
- {1, 15, 105, 455, 1365, 3003, 5005, 6435},
- {1, 16, 120, 560, 1820, 4368, 8008, 11440},
- {1, 17, 136, 680, 2380, 6188, 12376, 19448},
- {1, 18, 153, 816, 3060, 8568, 18564, 31824},
- {1, 19, 171, 969, 3876, 11628, 27132, 50388},
- {1, 20, 190, 1140, 4845, 15504, 38760, 77520},
- {1, 21, 210, 1330, 5985, 20349, 54264, 116280},
- {1, 22, 231, 1540, 7315, 26334, 74613, 1705444}
-};
-
-const Word32 PI_offset[8][8] = // Q0
-{
- /* for 0p(0). */
- {0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000},
- /* for 1p(1). */
- {0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000},
- /* for 2p(2,1). */
- {0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000},
- /* for 3p(3,2,1). */
- {0x00000,0x00000,0x01180,0x01540,0x00000,0x00000,0x00000,0x00000},
- /* for 4p(4,3,2,1). */
- {0x00000,0x00000,0x071C0,0x0A640,0x0ABE0,0x00000,0x00000,0x00000},
- /* for 5p(5,4,3,2,1). */
- {0x00000,0x00000,0x22200,0x3E900,0x45200,0x45980,0x00000,0x00000},
- /* for 6p(6,5,4,3,2,1). */
- {0x00000,0x00000,0x07d200,0x127c00,0x16ed80,0x179c80,0x17a5e0,0x00000},
- /* for 7p(7,6,5,4,3,2,1). */
- {0x00000,0x00000,0x165800,0x454400,0x654200,0x6E2500,0x6F2B80,0x6F36C0}
-};
-
-const Word16 PI_factor[7] = {0,0,120,560,1820,4368,8008}; // Q0
-
-/* ACELP pulse coding */
-const Word16 hi_to_low_tmpl[10] = { 0, 0, 0, 3, 9, 5, 3, 1, 8, 8 }; // Q0
-const UWord16 low_len[10] = { 0, 0, 8, 5, 7,11,13,15,16,16 }; // Q0
-const UWord16 low_mask[10] = { 0, 0, 255,31,127,2047,8191,32767,65535,65535 }; // Q0
-const UWord16 indx_fact[10] = { 0, 0,2,172,345,140,190,223,463,1732 }; // Q0
-const Word16 index_len[3] = { 0, 5, 9 }; // Q0
-const Word16 index_mask_ACELP[3] = { 0, 31, 511 }; // Q0
-
-
-/*------------------------------------------------------------------------------*
- * EDCT tables
- *------------------------------------------------------------------------------*/
-
-//Fix
-const Word16 edct_table_80_fx[80] = /*Q16 */
-{
- 21911, 21903, 21886, 21860, 21827, 21784, 21734, 21675,
- 21608, 21532, 21448, 21356, 21255, 21147, 21030, 20905,
- 20772, 20631, 20482, 20325, 20161, 19988, 19808, 19621,
- 19425, 19222, 19012, 18795, 18570, 18338, 18099, 17853,
- 17600, 17340, 17074, 16801, 16522, 16236, 15944, 15646,
- 15341, 15031, 14715, 14394, 14067, 13734, 13396, 13053,
- 12705, 12352, 11994, 11632, 11265, 10894, 10519, 10139,
- 9756, 9369, 8978, 8584, 8186, 7786, 7382, 6975,
- 6566, 6155, 5741, 5324, 4906, 4486, 4064, 3640,
- 3215, 2789, 2362, 1934, 1505, 1075, 645, 215
-};
-
-const Word16 edct_table_100_fx[] =
-{/*Q16 */
- 20723, 20718, 20708, 20692, 20672, 20646, 20616, 20580,
- 20539, 20493, 20442, 20386, 20325, 20259, 20188, 20112,
- 20031, 19946, 19855, 19759, 19658, 19553, 19443, 19328,
- 19208, 19083, 18954, 18820, 18681, 18538, 18390, 18238,
- 18081, 17920, 17754, 17584, 17410, 17231, 17048, 16861,
- 16670, 16474, 16275, 16071, 15864, 15652, 15437, 15218,
- 14995, 14768, 14538, 14304, 14067, 13826, 13582, 13335,
- 13084, 12830, 12573, 12312, 12049, 11783, 11513, 11241,
- 10966, 10689, 10409, 10126, 9841, 9553, 9263, 8971,
- 8676, 8379, 8081, 7780, 7477, 7173, 6867, 6559,
- 6249, 5938, 5625, 5311, 4996, 4679, 4362, 4043,
- 3723, 3403, 3081, 2759, 2436, 2112, 1788, 1464,
- 1139, 814, 488, 163
-};
-
-const Word16 edct_table_120_fx[120] = /*Q16 */
-{
- 19800, 19797, 19790, 19780, 19766, 19749, 19729, 19705,
- 19678, 19648, 19614, 19576, 19536, 19492, 19445, 19394,
- 19340, 19283, 19223, 19159, 19092, 19021, 18948, 18871,
- 18791, 18708, 18621, 18531, 18438, 18342, 18243, 18141,
- 18035, 17927, 17815, 17701, 17583, 17462, 17339, 17212,
- 17082, 16950, 16815, 16676, 16535, 16391, 16244, 16095,
- 15942, 15787, 15629, 15469, 15306, 15140, 14972, 14801,
- 14628, 14452, 14273, 14092, 13909, 13723, 13535, 13345,
- 13152, 12958, 12761, 12561, 12360, 12156, 11951, 11743,
- 11533, 11322, 11108, 10893, 10675, 10456, 10235, 10012,
- 9788, 9562, 9334, 9104, 8874, 8641, 8407, 8172,
- 7935, 7697, 7457, 7217, 6975, 6732, 6487, 6242,
- 5995, 5748, 5499, 5250, 4999, 4748, 4496, 4243,
- 3990, 3736, 3481, 3225, 2969, 2713, 2456, 2199,
- 1941, 1683, 1424, 1166, 907, 648, 389, 130
-};
-
-const Word16 edct_table_320_fx[320] = /*Q16 */
-{
- 15495, 15495, 15494, 15493, 15491, 15489, 15487, 15484,
- 15481, 15478, 15474, 15470, 15466, 15461, 15456, 15450,
- 15444, 15438, 15431, 15424, 15417, 15409, 15401, 15392,
- 15383, 15374, 15364, 15354, 15344, 15333, 15322, 15310,
- 15298, 15286, 15273, 15260, 15247, 15233, 15219, 15205,
- 15190, 15175, 15159, 15143, 15127, 15110, 15093, 15076,
- 15058, 15040, 15021, 15002, 14983, 14964, 14944, 14924,
- 14903, 14882, 14860, 14839, 14817, 14794, 14771, 14748,
- 14725, 14701, 14677, 14652, 14627, 14602, 14576, 14550,
- 14524, 14497, 14470, 14443, 14415, 14387, 14359, 14330,
- 14301, 14271, 14242, 14212, 14181, 14150, 14119, 14088,
- 14056, 14024, 13991, 13958, 13925, 13891, 13858, 13823,
- 13789, 13754, 13719, 13683, 13647, 13611, 13575, 13538,
- 13501, 13463, 13425, 13387, 13349, 13310, 13271, 13231,
- 13192, 13152, 13111, 13071, 13030, 12988, 12947, 12905,
- 12862, 12820, 12777, 12734, 12690, 12647, 12602, 12558,
- 12513, 12468, 12423, 12377, 12331, 12285, 12239, 12192,
- 12145, 12098, 12050, 12002, 11954, 11905, 11856, 11807,
- 11758, 11708, 11658, 11608, 11557, 11507, 11455, 11404,
- 11352, 11301, 11248, 11196, 11143, 11090, 11037, 10983,
- 10930, 10876, 10821, 10767, 10712, 10657, 10601, 10546,
- 10490, 10434, 10378, 10321, 10264, 10207, 10150, 10092,
- 10034, 9976, 9918, 9859, 9800, 9741, 9682, 9623,
- 9563, 9503, 9443, 9382, 9322, 9261, 9200, 9138,
- 9077, 9015, 8953, 8891, 8829, 8766, 8703, 8640,
- 8577, 8513, 8450, 8386, 8322, 8258, 8193, 8129,
- 8064, 7999, 7933, 7868, 7802, 7737, 7671, 7604,
- 7538, 7471, 7405, 7338, 7271, 7203, 7136, 7068,
- 7001, 6933, 6865, 6796, 6728, 6659, 6591, 6522,
- 6453, 6383, 6314, 6244, 6175, 6105, 6035, 5965,
- 5895, 5824, 5754, 5683, 5612, 5541, 5470, 5399,
- 5327, 5256, 5184, 5113, 5041, 4969, 4897, 4824,
- 4752, 4680, 4607, 4534, 4462, 4389, 4316, 4243,
- 4169, 4096, 4023, 3949, 3876, 3802, 3728, 3654,
- 3580, 3506, 3432, 3358, 3284, 3209, 3135, 3060,
- 2986, 2911, 2836, 2761, 2687, 2612, 2537, 2462,
- 2386, 2311, 2236, 2161, 2085, 2010, 1934, 1859,
- 1783, 1708, 1632, 1557, 1481, 1405, 1329, 1254,
- 1178, 1102, 1026, 950, 874, 798, 722, 646,
- 570, 494, 418, 342, 266, 190, 114, 38
-};
-
-const Word16 edct_table_480_fx[480] = /*Q16 */
-{
- 14001, 14001, 14001, 14000, 14000, 13999, 13998, 13997,
- 13996, 13995, 13993, 13991, 13990, 13988, 13986, 13983,
- 13981, 13978, 13976, 13973, 13970, 13967, 13963, 13960,
- 13956, 13953, 13949, 13945, 13940, 13936, 13932, 13927,
- 13922, 13917, 13912, 13907, 13902, 13896, 13890, 13885,
- 13879, 13872, 13866, 13860, 13853, 13846, 13840, 13833,
- 13825, 13818, 13811, 13803, 13795, 13787, 13779, 13771,
- 13763, 13754, 13746, 13737, 13728, 13719, 13709, 13700,
- 13691, 13681, 13671, 13661, 13651, 13641, 13630, 13620,
- 13609, 13598, 13587, 13576, 13565, 13553, 13542, 13530,
- 13518, 13506, 13494, 13482, 13469, 13457, 13444, 13431,
- 13418, 13405, 13392, 13378, 13365, 13351, 13337, 13323,
- 13309, 13295, 13280, 13266, 13251, 13236, 13221, 13206,
- 13191, 13175, 13160, 13144, 13128, 13112, 13096, 13080,
- 13063, 13047, 13030, 13013, 12996, 12979, 12962, 12944,
- 12927, 12909, 12891, 12873, 12855, 12837, 12819, 12800,
- 12782, 12763, 12744, 12725, 12706, 12686, 12667, 12647,
- 12628, 12608, 12588, 12568, 12547, 12527, 12506, 12486,
- 12465, 12444, 12423, 12402, 12380, 12359, 12337, 12316,
- 12294, 12272, 12250, 12227, 12205, 12182, 12160, 12137,
- 12114, 12091, 12068, 12045, 12021, 11998, 11974, 11950,
- 11926, 11902, 11878, 11854, 11829, 11804, 11780, 11755,
- 11730, 11705, 11680, 11654, 11629, 11603, 11578, 11552,
- 11526, 11500, 11474, 11447, 11421, 11394, 11368, 11341,
- 11314, 11287, 11260, 11232, 11205, 11177, 11150, 11122,
- 11094, 11066, 11038, 11010, 10981, 10953, 10924, 10895,
- 10867, 10838, 10809, 10779, 10750, 10721, 10691, 10662,
- 10632, 10602, 10572, 10542, 10512, 10481, 10451, 10420,
- 10390, 10359, 10328, 10297, 10266, 10235, 10203, 10172,
- 10140, 10109, 10077, 10045, 10013, 9981, 9949, 9917,
- 9884, 9852, 9819, 9786, 9754, 9721, 9688, 9654,
- 9621, 9588, 9554, 9521, 9487, 9454, 9420, 9386,
- 9352, 9318, 9283, 9249, 9214, 9180, 9145, 9111,
- 9076, 9041, 9006, 8971, 8935, 8900, 8865, 8829,
- 8794, 8758, 8722, 8686, 8650, 8614, 8578, 8542,
- 8505, 8469, 8432, 8396, 8359, 8322, 8285, 8248,
- 8211, 8174, 8137, 8099, 8062, 8025, 7987, 7949,
- 7912, 7874, 7836, 7798, 7760, 7721, 7683, 7645,
- 7606, 7568, 7529, 7491, 7452, 7413, 7374, 7335,
- 7296, 7257, 7218, 7178, 7139, 7100, 7060, 7020,
- 6981, 6941, 6901, 6861, 6821, 6781, 6741, 6701,
- 6661, 6620, 6580, 6539, 6499, 6458, 6418, 6377,
- 6336, 6295, 6254, 6213, 6172, 6131, 6090, 6048,
- 6007, 5966, 5924, 5883, 5841, 5799, 5758, 5716,
- 5674, 5632, 5590, 5548, 5506, 5464, 5422, 5379,
- 5337, 5295, 5252, 5210, 5167, 5124, 5082, 5039,
- 4996, 4953, 4911, 4868, 4825, 4782, 4738, 4695,
- 4652, 4609, 4566, 4522, 4479, 4435, 4392, 4348,
- 4305, 4261, 4218, 4174, 4130, 4086, 4042, 3999,
- 3955, 3911, 3867, 3823, 3778, 3734, 3690, 3646,
- 3602, 3557, 3513, 3469, 3424, 3380, 3335, 3291,
- 3246, 3202, 3157, 3112, 3068, 3023, 2978, 2933,
- 2889, 2844, 2799, 2754, 2709, 2664, 2619, 2574,
- 2529, 2484, 2439, 2394, 2349, 2303, 2258, 2213,
- 2168, 2122, 2077, 2032, 1986, 1941, 1896, 1850,
- 1805, 1759, 1714, 1668, 1623, 1577, 1532, 1486,
- 1441, 1395, 1350, 1304, 1258, 1213, 1167, 1121,
- 1076, 1030, 984, 939, 893, 847, 801, 756,
- 710, 664, 618, 573, 527, 481, 435, 389,
- 344, 298, 252, 206, 160, 115, 69, 23
-};
-
-const Word16 edct_table_600_fx[] =/*Q16 */
-{
- 26483, 26483, 26483, 26482, 26481, 26481, 26479, 26478,
- 26477, 26475, 26473, 26471, 26469, 26467, 26464, 26461,
- 26459, 26455, 26452, 26449, 26445, 26441, 26437, 26433,
- 26429, 26424, 26420, 26415, 26410, 26404, 26399, 26393,
- 26387, 26381, 26375, 26369, 26362, 26356, 26349, 26342,
- 26335, 26327, 26320, 26312, 26304, 26296, 26287, 26279,
- 26270, 26261, 26252, 26243, 26234, 26224, 26214, 26204,
- 26194, 26184, 26173, 26163, 26152, 26141, 26130, 26118,
- 26107, 26095, 26083, 26071, 26059, 26046, 26033, 26021,
- 26008, 25994, 25981, 25968, 25954, 25940, 25926, 25912,
- 25897, 25883, 25868, 25853, 25838, 25823, 25807, 25791,
- 25776, 25760, 25743, 25727, 25711, 25694, 25677, 25660,
- 25643, 25625, 25608, 25590, 25572, 25554, 25535, 25517,
- 25498, 25480, 25461, 25441, 25422, 25403, 25383, 25363,
- 25343, 25323, 25302, 25282, 25261, 25240, 25219, 25198,
- 25176, 25155, 25133, 25111, 25089, 25067, 25044, 25022,
- 24999, 24976, 24953, 24929, 24906, 24882, 24858, 24834,
- 24810, 24786, 24761, 24737, 24712, 24687, 24662, 24636,
- 24611, 24585, 24559, 24533, 24507, 24481, 24454, 24427,
- 24401, 24373, 24346, 24319, 24291, 24264, 24236, 24208,
- 24180, 24151, 24123, 24094, 24065, 24036, 24007, 23978,
- 23948, 23918, 23888, 23858, 23828, 23798, 23767, 23737,
- 23706, 23675, 23644, 23612, 23581, 23549, 23518, 23486,
- 23453, 23421, 23389, 23356, 23323, 23290, 23257, 23224,
- 23191, 23157, 23123, 23090, 23056, 23021, 22987, 22953,
- 22918, 22883, 22848, 22813, 22778, 22742, 22707, 22671,
- 22635, 22599, 22563, 22526, 22490, 22453, 22416, 22379,
- 22342, 22305, 22267, 22230, 22192, 22154, 22116, 22078,
- 22039, 22001, 21962, 21923, 21884, 21845, 21806, 21766,
- 21727, 21687, 21647, 21607, 21567, 21527, 21486, 21446,
- 21405, 21364, 21323, 21282, 21241, 21199, 21157, 21116,
- 21074, 21032, 20989, 20947, 20905, 20862, 20819, 20776,
- 20733, 20690, 20647, 20603, 20560, 20516, 20472, 20428,
- 20384, 20339, 20295, 20250, 20205, 20161, 20116, 20070,
- 20025, 19980, 19934, 19888, 19842, 19796, 19750, 19704,
- 19658, 19611, 19565, 19518, 19471, 19424, 19377, 19329,
- 19282, 19234, 19186, 19139, 19091, 19042, 18994, 18946,
- 18897, 18849, 18800, 18751, 18702, 18653, 18604, 18554,
- 18505, 18455, 18405, 18355, 18305, 18255, 18205, 18154,
- 18104, 18053, 18002, 17951, 17900, 17849, 17798, 17747,
- 17695, 17643, 17592, 17540, 17488, 17436, 17383, 17331,
- 17278, 17226, 17173, 17120, 17067, 17014, 16961, 16908,
- 16854, 16801, 16747, 16693, 16640, 16586, 16531, 16477,
- 16423, 16368, 16314, 16259, 16204, 16149, 16094, 16039,
- 15984, 15929, 15873, 15818, 15762, 15706, 15650, 15595,
- 15538, 15482, 15426, 15370, 15313, 15256, 15200, 15143,
- 15086, 15029, 14972, 14914, 14857, 14800, 14742, 14684,
- 14627, 14569, 14511, 14453, 14395, 14336, 14278, 14220,
- 14161, 14103, 14044, 13985, 13926, 13867, 13808, 13749,
- 13689, 13630, 13570, 13511, 13451, 13391, 13332, 13272,
- 13212, 13151, 13091, 13031, 12971, 12910, 12849, 12789,
- 12728, 12667, 12606, 12545, 12484, 12423, 12362, 12300,
- 12239, 12177, 12116, 12054, 11992, 11930, 11868, 11806,
- 11744, 11682, 11620, 11558, 11495, 11433, 11370, 11307,
- 11245, 11182, 11119, 11056, 10993, 10930, 10867, 10803,
- 10740, 10677, 10613, 10550, 10486, 10422, 10358, 10295,
- 10231, 10167, 10103, 10039, 9974, 9910, 9846, 9781,
- 9717, 9652, 9588, 9523, 9458, 9394, 9329, 9264,
- 9199, 9134, 9069, 9003, 8938, 8873, 8808, 8742,
- 8677, 8611, 8546, 8480, 8414, 8348, 8283, 8217,
- 8151, 8085, 8019, 7953, 7886, 7820, 7754, 7688,
- 7621, 7555, 7488, 7422, 7355, 7289, 7222, 7155,
- 7088, 7022, 6955, 6888, 6821, 6754, 6687, 6620,
- 6553, 6485, 6418, 6351, 6283, 6216, 6149, 6081,
- 6014, 5946, 5879, 5811, 5743, 5676, 5608, 5540,
- 5472, 5404, 5337, 5269, 5201, 5133, 5065, 4997,
- 4928, 4860, 4792, 4724, 4656, 4587, 4519, 4451,
- 4382, 4314, 4246, 4177, 4109, 4040, 3972, 3903,
- 3834, 3766, 3697, 3629, 3560, 3491, 3422, 3354,
- 3285, 3216, 3147, 3078, 3009, 2941, 2872, 2803,
- 2734, 2665, 2596, 2527, 2458, 2389, 2320, 2251,
- 2182, 2112, 2043, 1974, 1905, 1836, 1767, 1697,
- 1628, 1559, 1490, 1421, 1351, 1282, 1213, 1144,
- 1074, 1005, 936, 867, 797, 728, 659, 589,
- 520, 451, 381, 312, 243, 173, 104, 35
-};
-
-const Word16 edct_table_128_fx[128] = /*Q16 */
-{
- 19483, 19480, 19474, 19466, 19454, 19439, 19422, 19401,
- 19378, 19351, 19322, 19290, 19255, 19217, 19176, 19132,
- 19086, 19036, 18984, 18928, 18870, 18809, 18746, 18679,
- 18610, 18537, 18462, 18385, 18304, 18221, 18135, 18046,
- 17954, 17860, 17763, 17664, 17561, 17457, 17349, 17239,
- 17126, 17011, 16893, 16773, 16650, 16524, 16396, 16266,
- 16133, 15998, 15860, 15720, 15578, 15433, 15286, 15137,
- 14985, 14831, 14675, 14516, 14356, 14193, 14028, 13861,
- 13692, 13521, 13348, 13173, 12996, 12816, 12635, 12452,
- 12268, 12081, 11892, 11702, 11510, 11316, 11121, 10924,
- 10725, 10524, 10322, 10119, 9914, 9707, 9499, 9290,
- 9079, 8867, 8653, 8438, 8222, 8005, 7786, 7566,
- 7345, 7123, 6900, 6676, 6451, 6225, 5998, 5770,
- 5541, 5312, 5081, 4850, 4618, 4385, 4152, 3918,
- 3684, 3449, 3213, 2977, 2741, 2504, 2266, 2029,
- 1791, 1552, 1314, 1075, 837, 598, 359, 120
-};
-
-const Word16 edct_table_160_fx[160] = /*Q16 */
-{
- 18426, 18425, 18421, 18416, 18409, 18400, 18389, 18377,
- 18362, 18346, 18329, 18309, 18288, 18265, 18240, 18214,
- 18185, 18155, 18123, 18090, 18055, 18018, 17979, 17938,
- 17896, 17852, 17806, 17759, 17710, 17659, 17607, 17552,
- 17497, 17439, 17380, 17319, 17256, 17192, 17126, 17058,
- 16989, 16918, 16846, 16772, 16696, 16619, 16540, 16459,
- 16377, 16293, 16208, 16121, 16033, 15943, 15851, 15758,
- 15664, 15568, 15470, 15371, 15271, 15169, 15065, 14960,
- 14854, 14746, 14637, 14527, 14415, 14301, 14186, 14070,
- 13953, 13834, 13714, 13592, 13469, 13345, 13220, 13093,
- 12965, 12836, 12706, 12574, 12441, 12307, 12172, 12036,
- 11898, 11759, 11620, 11479, 11337, 11193, 11049, 10904,
- 10758, 10610, 10462, 10312, 10162, 10011, 9858, 9705,
- 9551, 9395, 9239, 9082, 8925, 8766, 8606, 8446,
- 8285, 8123, 7960, 7797, 7632, 7467, 7301, 7135,
- 6968, 6800, 6632, 6463, 6293, 6122, 5952, 5780,
- 5608, 5435, 5262, 5089, 4915, 4740, 4565, 4389,
- 4214, 4037, 3861, 3684, 3506, 3328, 3150, 2972,
- 2793, 2614, 2435, 2256, 2076, 1896, 1716, 1536,
- 1356, 1175, 994, 814, 633, 452, 271, 90
-};
-
-const Word16 edct_table_40_fx[40] = /*Q16 */
-{
- 26049, 26009, 25928, 25808, 25648, 25448, 25210, 24932,
- 24616, 24262, 23870, 23442, 22977, 22477, 21943, 21375,
- 20773, 20140, 19475, 18781, 18058, 17306, 16528, 15725,
- 14897, 14047, 13174, 12282, 11370, 10441, 9496, 8536,
- 7563, 6578, 5584, 4580, 3570, 2554, 1534, 512
-};
-
-const Word16 edct_table_20_fx[20] = /*Q16 */
-{
- 30939, 30749, 30368, 29801, 29049, 28119, 27015, 25745,
- 24316, 22737, 21018, 19169, 17202, 15129, 12963, 10717,
- 8405, 6041, 3639, 1216
-};
-
-
-const Word16 edct_table_64_fx[] =/*Q16 */
-{
- 23167, 23153, 23125, 23083, 23027, 22958, 22874, 22777,
- 22666, 22542, 22403, 22252, 22087, 21908, 21717, 21512,
- 21295, 21064, 20821, 20565, 20297, 20017, 19725, 19420,
- 19105, 18777, 18438, 18089, 17728, 17356, 16975, 16582,
- 16180, 15769, 15347, 14917, 14477, 14029, 13572, 13107,
- 12634, 12154, 11666, 11171, 10670, 10162, 9648, 9128,
- 8603, 8072, 7537, 6997, 6453, 5905, 5353, 4798,
- 4241, 3681, 3118, 2554, 1988, 1421, 853, 284
-};
-
-
-const Word16 edct_table_200_fx[] =/*Q16 */
-{
- 17427, 17426, 17423, 17420, 17416, 17411, 17404, 17397,
- 17388, 17378, 17368, 17356, 17343, 17329, 17314, 17298,
- 17281, 17262, 17243, 17223, 17201, 17179, 17155, 17131,
- 17105, 17079, 17051, 17022, 16992, 16961, 16929, 16896,
- 16862, 16827, 16791, 16754, 16716, 16676, 16636, 16595,
- 16553, 16509, 16465, 16420, 16373, 16326, 16278, 16228,
- 16178, 16126, 16074, 16021, 15966, 15911, 15855, 15797,
- 15739, 15680, 15620, 15558, 15496, 15433, 15369, 15304,
- 15238, 15171, 15103, 15035, 14965, 14894, 14823, 14751,
- 14677, 14603, 14528, 14452, 14375, 14297, 14218, 14139,
- 14058, 13977, 13895, 13812, 13728, 13643, 13558, 13471,
- 13384, 13296, 13207, 13117, 13027, 12935, 12843, 12750,
- 12657, 12562, 12467, 12371, 12274, 12177, 12078, 11979,
- 11880, 11779, 11678, 11576, 11473, 11370, 11266, 11161,
- 11055, 10949, 10843, 10735, 10627, 10518, 10409, 10299,
- 10188, 10076, 9964, 9852, 9739, 9625, 9510, 9395,
- 9280, 9164, 9047, 8930, 8812, 8694, 8575, 8455,
- 8335, 8215, 8094, 7973, 7851, 7728, 7605, 7482,
- 7358, 7234, 7109, 6984, 6858, 6732, 6606, 6479,
- 6352, 6224, 6096, 5967, 5839, 5710, 5580, 5450,
- 5320, 5190, 5059, 4928, 4796, 4664, 4532, 4400,
- 4268, 4135, 4002, 3868, 3735, 3601, 3467, 3333,
- 3198, 3064, 2929, 2794, 2659, 2523, 2388, 2252,
- 2116, 1980, 1844, 1708, 1572, 1436, 1299, 1163,
- 1026, 889, 753, 616, 479, 342, 205, 68
-};
-
-const Word16 edct_table_240_fx[] =/*Q16 */
-{
- 16650, 16650, 16648, 16646, 16643, 16640, 16635, 16630,
- 16625, 16618, 16611, 16603, 16595, 16585, 16575, 16565,
- 16553, 16541, 16528, 16515, 16501, 16486, 16470, 16454,
- 16437, 16419, 16401, 16381, 16362, 16341, 16320, 16298,
- 16275, 16252, 16228, 16203, 16178, 16151, 16125, 16097,
- 16069, 16040, 16010, 15980, 15949, 15918, 15885, 15852,
- 15819, 15784, 15749, 15713, 15677, 15640, 15602, 15564,
- 15525, 15485, 15445, 15404, 15362, 15320, 15277, 15233,
- 15189, 15144, 15098, 15052, 15005, 14957, 14909, 14860,
- 14811, 14761, 14710, 14659, 14607, 14554, 14501, 14447,
- 14392, 14337, 14282, 14225, 14168, 14111, 14053, 13994,
- 13934, 13874, 13814, 13753, 13691, 13629, 13566, 13502,
- 13438, 13374, 13309, 13243, 13176, 13109, 13042, 12974,
- 12905, 12836, 12767, 12696, 12626, 12554, 12482, 12410,
- 12337, 12264, 12190, 12115, 12040, 11965, 11889, 11812,
- 11735, 11657, 11579, 11501, 11422, 11342, 11262, 11182,
- 11101, 11019, 10937, 10855, 10772, 10689, 10605, 10521,
- 10436, 10351, 10265, 10179, 10093, 10006, 9919, 9831,
- 9743, 9654, 9565, 9476, 9386, 9296, 9205, 9114,
- 9023, 8931, 8839, 8746, 8653, 8560, 8466, 8372,
- 8278, 8183, 8088, 7993, 7897, 7801, 7704, 7608,
- 7511, 7413, 7315, 7217, 7119, 7020, 6921, 6822,
- 6723, 6623, 6523, 6422, 6321, 6221, 6119, 6018,
- 5916, 5814, 5712, 5609, 5507, 5404, 5300, 5197,
- 5093, 4990, 4885, 4781, 4677, 4572, 4467, 4362,
- 4257, 4151, 4046, 3940, 3834, 3728, 3622, 3515,
- 3408, 3302, 3195, 3088, 2981, 2873, 2766, 2658,
- 2551, 2443, 2335, 2227, 2119, 2011, 1903, 1795,
- 1686, 1578, 1469, 1361, 1252, 1143, 1035, 926,
- 817, 708, 599, 490, 381, 272, 163, 54
-};
-
-const Word16 edct_table_256_fx[] =/*Q16 */
-{
- 16384, 16383, 16382, 16380, 16378, 16375, 16371, 16367,
- 16362, 16356, 16350, 16343, 16336, 16328, 16319, 16310,
- 16300, 16290, 16278, 16267, 16254, 16242, 16228, 16214,
- 16199, 16184, 16168, 16151, 16134, 16116, 16098, 16079,
- 16059, 16039, 16018, 15997, 15975, 15952, 15929, 15905,
- 15881, 15856, 15830, 15804, 15777, 15750, 15722, 15693,
- 15664, 15634, 15604, 15573, 15541, 15509, 15476, 15443,
- 15409, 15375, 15340, 15304, 15268, 15231, 15194, 15156,
- 15117, 15078, 15039, 14999, 14958, 14917, 14875, 14832,
- 14789, 14746, 14702, 14657, 14612, 14566, 14520, 14473,
- 14426, 14378, 14329, 14280, 14231, 14181, 14130, 14079,
- 14027, 13975, 13922, 13869, 13815, 13761, 13706, 13651,
- 13595, 13538, 13481, 13424, 13366, 13308, 13249, 13190,
- 13130, 13069, 13008, 12947, 12885, 12823, 12760, 12697,
- 12633, 12569, 12504, 12439, 12373, 12307, 12240, 12173,
- 12106, 12038, 11969, 11901, 11831, 11762, 11691, 11621,
- 11550, 11478, 11406, 11334, 11261, 11188, 11114, 11040,
- 10965, 10891, 10815, 10740, 10663, 10587, 10510, 10433,
- 10355, 10277, 10198, 10119, 10040, 9961, 9881, 9800,
- 9719, 9638, 9557, 9475, 9393, 9310, 9227, 9144,
- 9061, 8977, 8892, 8808, 8723, 8638, 8552, 8466,
- 8380, 8293, 8206, 8119, 8032, 7944, 7856, 7768,
- 7679, 7590, 7501, 7411, 7321, 7231, 7141, 7050,
- 6960, 6868, 6777, 6685, 6593, 6501, 6409, 6316,
- 6223, 6130, 6037, 5943, 5850, 5756, 5661, 5567,
- 5472, 5377, 5282, 5187, 5092, 4996, 4900, 4804,
- 4708, 4611, 4515, 4418, 4321, 4224, 4127, 4030,
- 3932, 3835, 3737, 3639, 3541, 3442, 3344, 3246,
- 3147, 3048, 2949, 2851, 2751, 2652, 2553, 2454,
- 2354, 2255, 2155, 2055, 1956, 1856, 1756, 1656,
- 1556, 1456, 1356, 1255, 1155, 1055, 954, 854,
- 754, 653, 553, 452, 352, 251, 151, 50
-};
-
-const Word16 edct_table_400_fx[] =/*Q16 */
-{
- 29308, 29308, 29307, 29306, 29304, 29302, 29299, 29296,
- 29292, 29288, 29284, 29279, 29273, 29267, 29261, 29254,
- 29247, 29239, 29231, 29223, 29214, 29204, 29194, 29184,
- 29173, 29162, 29150, 29138, 29125, 29112, 29099, 29085,
- 29070, 29055, 29040, 29024, 29008, 28991, 28974, 28957,
- 28939, 28920, 28901, 28882, 28862, 28842, 28821, 28800,
- 28779, 28757, 28734, 28711, 28688, 28664, 28640, 28615,
- 28590, 28565, 28539, 28512, 28485, 28458, 28430, 28402,
- 28373, 28344, 28315, 28285, 28255, 28224, 28192, 28161,
- 28129, 28096, 28063, 28030, 27996, 27962, 27927, 27892,
- 27856, 27820, 27784, 27747, 27710, 27672, 27634, 27595,
- 27556, 27517, 27477, 27437, 27396, 27355, 27313, 27272,
- 27229, 27186, 27143, 27100, 27055, 27011, 26966, 26921,
- 26875, 26829, 26782, 26736, 26688, 26640, 26592, 26544,
- 26495, 26445, 26395, 26345, 26294, 26243, 26192, 26140,
- 26088, 26035, 25982, 25929, 25875, 25821, 25766, 25711,
- 25655, 25600, 25543, 25487, 25430, 25372, 25315, 25256,
- 25198, 25139, 25079, 25020, 24960, 24899, 24838, 24777,
- 24715, 24653, 24591, 24528, 24465, 24401, 24337, 24273,
- 24208, 24143, 24078, 24012, 23946, 23879, 23812, 23745,
- 23677, 23609, 23541, 23472, 23403, 23334, 23264, 23194,
- 23123, 23052, 22981, 22909, 22837, 22765, 22692, 22619,
- 22546, 22472, 22398, 22324, 22249, 22174, 22098, 22023,
- 21947, 21870, 21793, 21716, 21639, 21561, 21483, 21404,
- 21326, 21246, 21167, 21087, 21007, 20927, 20846, 20765,
- 20684, 20602, 20520, 20437, 20355, 20272, 20189, 20105,
- 20021, 19937, 19852, 19768, 19682, 19597, 19511, 19425,
- 19339, 19252, 19165, 19078, 18991, 18903, 18815, 18726,
- 18638, 18549, 18459, 18370, 18280, 18190, 18100, 18009,
- 17918, 17827, 17735, 17643, 17551, 17459, 17366, 17274,
- 17181, 17087, 16994, 16900, 16805, 16711, 16616, 16521,
- 16426, 16331, 16235, 16139, 16043, 15946, 15850, 15753,
- 15656, 15558, 15461, 15363, 15265, 15166, 15068, 14969,
- 14870, 14770, 14671, 14571, 14471, 14371, 14271, 14170,
- 14069, 13968, 13867, 13765, 13663, 13562, 13459, 13357,
- 13254, 13152, 13049, 12946, 12842, 12739, 12635, 12531,
- 12427, 12323, 12218, 12113, 12008, 11903, 11798, 11693,
- 11587, 11481, 11375, 11269, 11163, 11056, 10950, 10843,
- 10736, 10628, 10521, 10414, 10306, 10198, 10090, 9982,
- 9874, 9765, 9657, 9548, 9439, 9330, 9221, 9112,
- 9002, 8892, 8783, 8673, 8563, 8453, 8342, 8232,
- 8122, 8011, 7900, 7789, 7678, 7567, 7456, 7344,
- 7233, 7121, 7010, 6898, 6786, 6674, 6562, 6450,
- 6337, 6225, 6112, 6000, 5887, 5774, 5661, 5548,
- 5435, 5322, 5209, 5096, 4982, 4869, 4755, 4642,
- 4528, 4414, 4300, 4187, 4073, 3959, 3845, 3730,
- 3616, 3502, 3388, 3273, 3159, 3044, 2930, 2815,
- 2701, 2586, 2472, 2357, 2242, 2127, 2013, 1898,
- 1783, 1668, 1553, 1438, 1323, 1208, 1093, 978,
- 863, 748, 633, 518, 403, 288, 173, 58
-};
-
-const Word16 edct_table_320_16fx[320] =/*Q16 */
-{
- 7747, 7747, 7747, 7746, 7746, 7745, 7744, 7742,
- 7741, 7739, 7737, 7735, 7733, 7730, 7728, 7725,
- 7722, 7719, 7716, 7712, 7708, 7704, 7700, 7696,
- 7692, 7687, 7682, 7677, 7672, 7666, 7661, 7655,
- 7649, 7643, 7637, 7630, 7623, 7617, 7610, 7602,
- 7595, 7587, 7580, 7572, 7563, 7555, 7547, 7538,
- 7529, 7520, 7511, 7501, 7492, 7482, 7472, 7462,
- 7451, 7441, 7430, 7419, 7408, 7397, 7386, 7374,
- 7362, 7350, 7338, 7326, 7314, 7301, 7288, 7275,
- 7262, 7249, 7235, 7221, 7208, 7194, 7179, 7165,
- 7150, 7136, 7121, 7106, 7091, 7075, 7060, 7044,
- 7028, 7012, 6995, 6979, 6962, 6946, 6929, 6912,
- 6894, 6877, 6859, 6842, 6824, 6806, 6787, 6769,
- 6750, 6732, 6713, 6694, 6674, 6655, 6635, 6616,
- 6596, 6576, 6556, 6535, 6515, 6494, 6473, 6452,
- 6431, 6410, 6388, 6367, 6345, 6323, 6301, 6279,
- 6257, 6234, 6211, 6189, 6166, 6143, 6119, 6096,
- 6072, 6049, 6025, 6001, 5977, 5953, 5928, 5904,
- 5879, 5854, 5829, 5804, 5779, 5753, 5728, 5702,
- 5676, 5650, 5624, 5598, 5572, 5545, 5518, 5492,
- 5465, 5438, 5411, 5383, 5356, 5328, 5301, 5273,
- 5245, 5217, 5189, 5160, 5132, 5104, 5075, 5046,
- 5017, 4988, 4959, 4930, 4900, 4871, 4841, 4811,
- 4781, 4751, 4721, 4691, 4661, 4630, 4600, 4569,
- 4538, 4508, 4477, 4446, 4414, 4383, 4352, 4320,
- 4288, 4257, 4225, 4193, 4161, 4129, 4097, 4064,
- 4032, 3999, 3967, 3934, 3901, 3868, 3835, 3802,
- 3769, 3736, 3702, 3669, 3635, 3602, 3568, 3534,
- 3500, 3466, 3432, 3398, 3364, 3330, 3295, 3261,
- 3226, 3192, 3157, 3122, 3087, 3052, 3017, 2982,
- 2947, 2912, 2877, 2841, 2806, 2771, 2735, 2699,
- 2664, 2628, 2592, 2556, 2520, 2484, 2448, 2412,
- 2376, 2340, 2304, 2267, 2231, 2194, 2158, 2121,
- 2085, 2048, 2011, 1975, 1938, 1901, 1864, 1827,
- 1790, 1753, 1716, 1679, 1642, 1605, 1567, 1530,
- 1493, 1455, 1418, 1381, 1343, 1306, 1268, 1231,
- 1193, 1156, 1118, 1080, 1043, 1005, 967, 930,
- 892, 854, 816, 778, 740, 703, 665, 627,
- 589, 551, 513, 475, 437, 399, 361, 323,
- 285, 247, 209, 171, 133, 95, 57, 19
-};
-const Word16 edct_table_128_16fx[128] = /*Q15 */
-{
- 9742, 9740, 9737, 9733, 9727, 9720, 9711, 9701,
- 9689, 9676, 9661, 9645, 9627, 9608, 9588, 9566,
- 9543, 9518, 9492, 9464, 9435, 9405, 9373, 9339,
- 9305, 9269, 9231, 9192, 9152, 9110, 9067, 9023,
- 8977, 8930, 8882, 8832, 8781, 8728, 8675, 8619,
- 8563, 8505, 8447, 8386, 8325, 8262, 8198, 8133,
- 8067, 7999, 7930, 7860, 7789, 7717, 7643, 7568,
- 7492, 7415, 7337, 7258, 7178, 7097, 7014, 6931,
- 6846, 6761, 6674, 6586, 6498, 6408, 6318, 6226,
- 6134, 6040, 5946, 5851, 5755, 5658, 5560, 5462,
- 5362, 5262, 5161, 5059, 4957, 4854, 4750, 4645,
- 4539, 4433, 4327, 4219, 4111, 4002, 3893, 3783,
- 3673, 3562, 3450, 3338, 3226, 3113, 2999, 2885,
- 2771, 2656, 2541, 2425, 2309, 2193, 2076, 1959,
- 1842, 1724, 1607, 1489, 1370, 1252, 1133, 1014,
- 895, 776, 657, 538, 418, 299, 179, 60
-};
-const Word16 edct_table_160_16fx[160] =//Q15
-{
- 9213, 9212, 9211, 9208, 9204, 9200, 9195, 9188,
- 9181, 9173, 9164, 9155, 9144, 9132, 9120, 9107,
- 9093, 9078, 9062, 9045, 9027, 9009, 8989, 8969,
- 8948, 8926, 8903, 8880, 8855, 8830, 8803, 8776,
- 8748, 8719, 8690, 8659, 8628, 8596, 8563, 8529,
- 8495, 8459, 8423, 8386, 8348, 8309, 8270, 8230,
- 8188, 8147, 8104, 8061, 8016, 7971, 7926, 7879,
- 7832, 7784, 7735, 7686, 7635, 7584, 7533, 7480,
- 7427, 7373, 7319, 7263, 7207, 7151, 7093, 7035,
- 6976, 6917, 6857, 6796, 6735, 6673, 6610, 6547,
- 6483, 6418, 6353, 6287, 6221, 6154, 6086, 6018,
- 5949, 5880, 5810, 5739, 5668, 5597, 5525, 5452,
- 5379, 5305, 5231, 5156, 5081, 5005, 4929, 4852,
- 4775, 4698, 4620, 4541, 4462, 4383, 4303, 4223,
- 4142, 4061, 3980, 3898, 3816, 3734, 3651, 3568,
- 3484, 3400, 3316, 3231, 3146, 3061, 2976, 2890,
- 2804, 2718, 2631, 2544, 2457, 2370, 2282, 2195,
- 2107, 2019, 1930, 1842, 1753, 1664, 1575, 1486,
- 1397, 1307, 1218, 1128, 1038, 948, 858, 768,
- 678, 588, 497, 407, 317, 226, 136, 45
-};
-
-
-/*----------------------------------------------------------------------------------*
- * Mean ISF vector for active signal (only for AMR-WB IO mode)
- *----------------------------------------------------------------------------------*/
-
-const Word16 mean_isf_amr_wb_fx[M] =/*Qlog2(2.56)*/
-{
- 738, 1326, 2336, 3578, 4596, 5662, 6711, 7730,
- 8750, 9753,10705, 11728, 12833, 13971,15043, 4037
-};/*1.28f Q1*/
-
-/*----------------------------------------------------------------------------------*
- * Mean ISF vector for SID frames (only in AMR-WB IO mode)
- *----------------------------------------------------------------------------------*/
-
-const Word16 mean_isf_noise_amr_wb_fx[M] =/*Qlog2(2.56)*/
-{
- 478, 1100, 2213, 3267, 4219, 5222, 6198, 7240,
- 8229, 9153,10098, 11108, 12144, 13184,14165, 3803
-};/*14Q1*1.28*/
-
-/* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) */
-/*------------------------------------------------------*
- * Indirection for 1st stage 1st split of 46 bit cb. :
- The transmitted_index = indirect_dico1[found_index];
- *------------------------------------------------------*/
-const Word16 Indirect_dico1[SIZE_BK1] = // Q0
-{
- 2, 6, 18, 22, 34, 35, 38, 50,
- 66, 67, 70, 82, 98, 99, 102, 130,
- 131, 134, 146, 150, 162, 178, 194, 198,
- 210, 226, 230, 242, 0, 1, 3, 4,
- 5, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 19, 20, 21, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 36, 37, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 51,
- 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 68, 69,
- 71, 72, 73, 74, 75, 76, 77, 78,
- 79, 80, 81, 83, 84, 85, 86, 87,
- 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 100, 101, 103, 104, 105, 106,
- 107, 108, 109, 110, 111, 112, 113, 114,
- 115, 116, 117, 118, 119, 120, 121, 122,
- 123, 124, 125, 126, 127, 128, 129, 132,
- 133, 135, 136, 137, 138, 139, 140, 141,
- 142, 143, 144, 145, 147, 148, 149, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 163, 164, 165, 166, 167, 168,
- 169, 170, 171, 172, 173, 174, 175, 176,
- 177, 179, 180, 181, 182, 183, 184, 185,
- 186, 187, 188, 189, 190, 191, 192, 193,
- 195, 196, 197, 199, 200, 201, 202, 203,
- 204, 205, 206, 207, 208, 209, 211, 212,
- 213, 214, 215, 216, 217, 218, 219, 220,
- 221, 222, 223, 224, 225, 227, 228, 229,
- 231, 232, 233, 234, 235, 236, 237, 238,
- 239, 240, 241, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 253, 254, 255
-};
-
-/*----------------------------------------------------------------------------------*
- * Initial LSF memory
- *----------------------------------------------------------------------------------*/
-
-const Word16 lsf_init_fx[16] = /*14Q1*1.28*/
-{
- 960, 1920, 2880, 3840, 4800, 5760, 6720, 7680, 8640, 9600, 10560, 11520, 12480, 13440, 14400, 15360
-};
-
-/*----------------------------------------------------------------------------------*
- * Gaussian codebook
- *----------------------------------------------------------------------------------*/
-
-/*table in Q12*/
-const Word16 gaus_dico_fx[190] =
-{
- -399, -125, 523, -466, 305, -658, -809, 47,
- -141, -171, -583, -259, 296, 1334, -285, -401,
- -478, -418, 140, -540, 177, -1089, 130, -292,
- 143, 492, -310, -862, -320, 388, 546, 84,
- -1202, 107, 108, 340, 239, -130, 930, 342,
- 153, -264, -763, -113, 387, -535, 83, -856,
- -361, -421, 120, 396, -367, 640, 817, 222,
- -1017, -82, -120, 890, 340, -384, 47, 339,
- -505, -430, 161, 979, 890, -267, 104, 508,
- -150, -194, 442, 193, 413, -24, 395, -43,
- -217, 69, -398, 167, 116, -936, -95, 1466,
- -435, 461, 862, -136, -94, 1311, -371, 68,
- 134, -296, -156, -564, -48, -487, 647, 315,
- 513, -101, -685, -318, -344, -644, -66, 851,
- 414, -29, 509, 414, 502, 399, 557, 649,
- -299, 750, 546, -756, -12, -365, 593, -707,
- 394, -131, -375, -62, -914, -256, -424, 64,
- 464, -1140, 280, 91, -83, -288, -550, 389,
- 52, -1228, 6, -430, 74, 205, -478, -148,
- -592, 282, -73, 1212, 42, 580, -334, 484,
- -765, 443, 649, 271, -739, 375, 613, -460,
- -208, 235, -120, -49, -311, 605, 875, 521,
- 202, -506, -548, -1088, -43, -221, 673, -245,
- -27, 469, 353, 53, 744, 275
-};
-
-const Word16 gaus_dico_swb_fx[256] =
-{
- /*Q15 */
- 709, 11759, -5333, -2701, 2397, -18, -4286, 2368,
- -4576, -1584, -900, -940, 3676, 5441, -44, 2234,
- -5698, 3082, -2671, 1666, -640, -3343, -1005, -1689,
- 2048, 281, -3935, -3723, 5628, 385, -746, -3243,
- -3332, -7228, -1748, -206, -5474, 2554, 2861, 3168,
- 5039, 588, -508, -8167, 6549, -3433, 2187, -3666,
- -5874, 2767, 8370, 1038, 6434, 6279, 625, 4030,
- -1031, 1823, 9896, -1395, 2712, -1110, -742, 6142,
- -4456, -10487, -144, -5104, 1968, -312, 6176, 2173,
- 2334, -240, 2712, 7460, 2219, -3116, -56, 2770,
- 5577, -1225, 770, 3557, 2246, 2322, 3077, 41,
- 992, -4971, 441, -5039, 4913, 3811, 1142, -1283,
- -6578, 4171, -1473, -3793, -5008, 1984, -1138, -1185,
- 5646, 1014, -5118, 7141, 2656, -7241, -3538, 2337,
- 7239, -504, -943, -10129, 702, -3811, -302, 2435,
- 5090, 3744, 2335, -3904, -1401, -1662, -7256, 6484,
- -6864, -5428, 1954, -7316, -1420, -1542, 5442, 311,
- 3698, -1343, -2974, 8756, 324, -1903, 2580, 2635,
- 4236, -1851, 3147, -772, -708, -3830, 2601, -1889,
- -3444, -762, 3939, 3206, -7406, -837, -1167, -438,
- 3707, -1015, -7472, 1849, 4277, 1459, -3047, -3760,
- 740, -7134, -3753, -3092, 209, -12121, 1398, 2266,
- 2505, -7974, -1121, -3481, -5644, 1329, 4532, 958,
- 5311, -4258, -3195, -1769, -3055, 4399, -15, 10182,
- 4503, 1912, -1574, 5054, -3163, 4881, -5364, 1925,
- -1205, -6432, 2305, -8917, -1422, 514, -3001, 3928,
- 2321, 360, -355, 1477, -3492, -4570, 1913, 2772,
- -1380, -5161, 3812, 2614, 2204, -3135, 1244, -3066,
- -4446, -6389, 4899, -5250, 1372, 1999, 1122, 5312,
- 1310, -1189, -3310, 6403, 3818, 7734, 1620, -8533,
- 706, 7498, -4472, 1272, -949, 3203, -4427, -2855,
- 4419, 2283, 6410, 2584, -3397, -3382, -2976, -48,
-};
-
-
-/*----------------------------------------------------------------------------------*
- * CLDFB tables
- *----------------------------------------------------------------------------------*/
-
-const Word16 freqTable[2] = {20, 40}; // Q0
-
-/* SNR: 109.44, PHASE: 3.500000000000000 */
-
-/* SNR: 109.44, PHASE: 3.500000000000000 */
-
-const Word32 CLDFB80_10_fx[100] = // q = 30
-{
- 3584, -2501, -707, 157, -1170, -1038,
--11, -1944, -1380, 1837, 14727, -9096,
--1691, -267, 3897, -4705, 419, 4651,
-5275, -6639, -243747, -72521, -17071, 14831,
--23632, -38285, 18452, -20885, -6245, -281515,
--1070487, -153329, -20195, -4338, -209848, 194011,
-24972, -5106, -34468, 1151402, -2164680, -832327,
-376720, 1686598, 1844777, 1697325, 2356308, 3037447,
-3248821, 1779296, -1533240, -1713947, 833816, 2751563,
-2421812, 284255, -3540922, -6991555, -10248264, -14642952,
-20031906, 26043234, 34417552, 45928496, 60756732, 78698864,
-98151832, 116245496, 129823136, 136344976, 134601568, 122059576,
-95304000, 53433792, -3371365, -74987256, -160511088, -258343120,
--366360320, -481533344, 599091264, 714631872, 823505600, 920768896,
-1001735168, 1062249792, 1100603392, 1116473216, 1114030976, 1091249536,
-1031959808, 939413760, 835792512, 727712064, 614651648, 499141824,
-382288320, 266885408, 148867680, 44714176
-};
-
-
-/* SNR: 292.49, PHASE: 2.000000000000000 */
-const Word32 CLDFB80_16_fx[160] = // q = 30
-{ 592, -824, -251, 104, 64, -2,
--19, 2357, 3222, -18, -2, 75,
-37, -82, -596, 808, 2242, -3035,
--755, 254, 126, -435, 107, -19350,
-26445, -100, 482, -149, -91, 247,
-2196, -3062, -344117, -158537, -67240, -47926,
--21715, 16231, 6227, 48320, 46494, 5449,
-17932, -33783, -26258, -13467, -97911, -469416,
--1317171, -563405, -199456, -118497, -43264, 11679,
--61886, 64706, -248886, 55869, 3768, 67211,
-64791, 39611, 345778, 1796799, -2314105, -1658358,
--815220, -115680, 761413, 1616443, 1931089, 1230669,
-1712206, 1949652, 2418775, 2970521, 3179526, 3272216,
-2739046, 1383591, -1186345, -2091284, -1594461, -20541,
-1561481, 2685864, 2822045, 2243697, 1007270, -1321111,
--3774214, -5979353, -7970747, -10025660, -12576468, -15588057,
-19092548, 22464968, 26489252, 31480652, 37681832, 45115060,
-53868456, 63884792, 75139712, 87185504, 99355152, 110921760,
-121117896, 129158840, 134480400, 136595408, 135565040, 130704096,
-120827352, 105296200, 83827480, 56486836, 23319760, -15680647,
--60454808, -110775264, -166285472, -226570624, -291114656, -359358976,
--430528992, -503583200, 577127680, 650096768, 721690560, 790528896,
-855345280, 915113088, 968648896, 1014713216, 1052549440, 1081848192,
-1102232576, 1113723648, 1117499392, 1114694144, 1104247168, 1084392960,
-1047294336, 993703296, 933123072, 868665920, 802559168, 734628416,
-664562240, 593135168, 520952544, 448011680, 375024864, 302909728,
-230463232, 156264608, 85568040, 29877076
-};
-
-
-/* SNR: 89.77, PHASE: 1.500000000000000 */
-const Word32 CLDFB80_20_fx[200] = // q = 30
-{ 1767, -5032, -88, -196, 26, 203,
--254, -755, -8, 5224, 7569, 3,
-161, -101, 462, -85, -115, 1651,
--2694, 4755, 4946, -22236, -524, -658,
-65, 469, -402, -1021, 719, -9362,
-12273, -828, -312, 170, -1089, 201,
-407, -7058, 12038, -3893, -327043, -222151,
--35479, -70712, -44739, -22286, -4950, 10391,
--6975, 55398, 27635, -7373, 3144, -22481,
--20586, -25326, -30793, 63871, -118589, -531211,
--1262671, -706692, -140675, -191397, -107627, -49946,
--20212, 30609, -145958, 302172, -516943, 139838,
--27637, 62099, 52144, 58317, 81974, -160536,
-375017, 1963206, -2140127, -2009648, -925313, -652848,
--36271, 664400, 1339893, 1799274, 1945125, 831665,
-1777056, 1828829, 2078398, 2585601, 2993432, 3154609,
-3289693, 3034094, 2356141, 1146722, -993260, -1911082,
--2021484, -1182252, 157141, 1427332, 2466905, 2979250,
-2692828, 2193128, 1283653, -616499, -2589952, -4472529,
--6187298, -7776617, -9380603, -11192438, -13438549, -15899665,
-18725886, 21392202, 24336266, 27874318, 32044188, 37006492,
-42749912, 49318540, 56747120, 64938688, 73960840, 83528888,
-93302528, 102923904, 112017456, 120184144, 127010856, 132191136,
-135478896, 136610544, 135791440, 132663544, 126439184, 116783968,
-103416816, 86239880, 65299188, 40633116, 12229525, -19893306,
--55715672, -95119752, -137902624, -183892768, -232841840, -284483936,
--338536576, -394642624, -452297696, -510956224, 569805312, 628294144,
-686151296, 742695360, 797209408, 849073920, 897777728, 942743488,
-983299712, 1018874944, 1049145600, 1073975296, 1093176448, 1106582656,
-1114420736, 1117424512, 1116238848, 1110577792, 1099271424, 1081958528,
-1052270720, 1010577920, 964128448, 914037760, 862118336, 809238464,
-755241024, 699830528, 643231744, 585949312, 528205504, 469954944,
-411440896, 353300032, 295721536, 237791168, 178588864, 119772248,
-66882256, 25081918
-};
-
-
-/* SNR: 89.29, PHASE: 0.833333333333333 */
-const Word32 CLDFB80_30_fx[300] = // q = 30
-{ -298, 3584, 1941, -855, -2501, -18,
-108, -707, 31, 15, 157, 303,
-46, -1170, 5206, 7621, -1038, 39,
-476, -11, -29, -11, -1944, 58,
--3, -1380, -660, 1053, 1837, -2898,
--12992, 14727, 8112, -3476, -9096, -22,
-265, -1691, 46, -32, -267, 593,
-210, 3897, 9064, -12976, -4705, -177,
--1102, 419, 158, 60, 4651, -142,
--11, 5275, 2753, -4425, -6639, 19639,
--341195, -243747, -157895, -76329, -72521, -65719,
--49275, -17071, -21325, -4817, 14831, 27866,
--1522, -23632, 5019, -51348, -38285, -878,
-59536, 18452, -11251, -36822, -20885, -26546,
--28596, -6245, -16613, -92408, -281515, -679650,
--1089989, -1070487, -687312, -252030, -153329, -178007,
--122647, -20195, -41359, -29533, -4338, 53191,
--112253, -209848, 617831, -803951, 194011, 106901,
--106999, 24972, 64775, 70954, -5106, 66493,
-77725, -34468, 24005, 399486, 1151402, 2091330,
--1945866, -2164680, -1871142, -1133490, -832327, -560635,
--144700, 376720, 793103, 1258629, 1686598, 1843272,
-1942367, 1844777, 286874, 1790714, 1697325, 1882734,
-2048236, 2356308, 2670961, 2960784, 3037447, 3187788,
-3282834, 3248821, 2972461, 2561469, 1779296, 779690,
--670109, -1533240, -2023874, -2068454, -1713947, -979306,
--79112, 833816, 1606493, 2311180, 2751563, 2948543,
-2758276, 2421812, 2144318, 1669907, 284255, -925661,
--2240403, -3540922, -4767759, -5909822, -6991555, -8035796,
--9103931, -10248264, -11549851, -13052389, -14642952, -16334399,
-18220558, 20031906, 21872604, 23814234, 26043234, 28516756,
-31295850, 34417552, 37909524, 41736344, 45928496, 50500180,
-55453996, 60756732, 66352956, 72392624, 78698864, 85151696,
-91671536, 98151832, 104484224, 110553528, 116245496, 121424144,
-125981624, 129823136, 132872256, 135069696, 136344976, 136548112,
-135995744, 134601568, 131846392, 127706624, 122059576, 114818808,
-105909512, 95304000, 83010216, 69049472, 53433792, 36159948,
-17222988, -3371365, -25594396, -49478012, -74987256, -102019216,
--130543792, -160511088, -191851984, -224489536, -258343120, -293333280,
--329374368, -366360320, -404158112, -442603456, -481533344, -520813312,
-560055680, 599091264, 637996480, 676579264, 714631872, 751940864,
-788293056, 823505600, 857424640, 889902848, 920768896, 949826944,
-976873792, 1001735168, 1024295104, 1044475456, 1062249792, 1077572608,
-1090377088, 1100603392, 1108260608, 1113474048, 1116473216, 1117510400,
-1116725248, 1114030976, 1109119488, 1101598848, 1091249536, 1078932736,
-1059134272, 1031959808, 1003169408, 972174976, 939413760, 905472960,
-870845632, 835792512, 800328576, 764335744, 727712064, 690466496,
-652724672, 614651648, 576357376, 537862912, 499141824, 460206112,
-421184800, 382288320, 343676096, 305305440, 266885408, 228014720,
-188521408, 148867680, 110353960, 74971128, 44714176, 18455688
-};
-
-
-const Word32 CLDFB80_32_fx[320] = // q = 30
-{
- -1093, 2020, -1500, 75, -3259, -200,
-2, 86, -307, -6, -372, -406,
-686, 39, -1685, 4713, 6814, -1488,
-47, 778, -40, -130, 24, -872,
-225, -5, -116, -556, -123, -751,
-1334, -5815, -17696, 8208, -6989, 239,
--11912, -669, 1, 206, -738, 0,
--579, -811, 1617, 569, 3828, 10109,
--14335, -4601, -628, -1935, 180, 186,
--69, 2086, -538, 14, 408, 1524,
-585, 3601, -4502, 26170, -348871, -274413,
--191283, -101650, -55023, -71745, -57839, -39470,
--16489, -17154, -4618, 1542, 27531, -4838,
--24078, -6041, -61576, -45939, -4350, 52992,
--21467, -30551, -47624, -16879, -16327, -28526,
--30774, 45781, -47861, -103961, -321282, -704888,
--1065517, -1123685, -707166, -371532, -86309, -196314,
--147630, -95796, -26567, -30201, -12085, -23646,
-30175, -133297, -186726, 644643, -823106, 165914,
-127129, -77847, 76139, 59764, 84597, 13696,
-44921, 72597, 82827, -180230, 163871, 385660,
-1272552, 2097220, -1940583, -2216918, -1963534, -1312195,
--811283, -684818, -332127, 81208, 566324, 995811,
-1374732, 1743252, 1885233, 1944746, 1791356, 230889,
-1776037, 1693755, 1848743, 2021967, 2237951, 2554532,
-2866858, 3010232, 3111818, 3235821, 3289505, 3179984,
-2912034, 2438977, 1724392, 733947, -625866, -1486531,
--1958890, -2094028, -1863598, -1255187, -454123, 425746,
-1212702, 1901282, 2517750, 2869908, 2908450, 2719155,
-2384774, 2140992, 1717492, 398307, -731735, -1939480,
--3196994, -4359654, -5453402, -6492968, -7485701, -8462297,
--9485345, -10586349, -11872517, -13293064, -14799378, -16391634,
-18159074, 19878216, 21572990, 23372214, 25384474, 27638258,
-30127980, 32911950, 36012916, 39421380, 43135868, 47172528,
-51552328, 56259572, 61272356, 66530936, 72196904, 78102488,
-84136944, 90243120, 96340328, 102334376, 108124720, 113633800,
-118743656, 123354504, 127384760, 130768192, 133428752, 135331936,
-136411184, 136532064, 136012736, 134791376, 132367184, 128735088,
-123803096, 117494272, 109734136, 100486232, 89749032, 77539936,
-63866580, 48743548, 32160198, 14114131, -5387419, -26313940,
--48704924, -72531920, -97696000, -124178280, -151940320, -180929216,
--211078752, -242327632, -274608448, -307853568, -341987136, -376916512,
--412518528, -448658976, -485200704, -522047808, 558838528, 595432000,
-631934592, 668176768, 703995904, 739213504, 773652800, 807151808,
-839574912, 870801792, 900704320, 929133248, 955922048, 980906240,
-1003949120, 1024962240, 1043881152, 1060686784, 1075342592, 1087794688,
-1097989248, 1105913344, 1111637504, 1115325568, 1117191552, 1117410816,
-1116024960, 1112890624, 1107711872, 1100166016, 1090143104, 1078585600,
-1060024128, 1034545088, 1007817280, 979127552, 948772416, 917237312,
-884973248, 852271488, 819225472, 785777536, 751820160, 717295872,
-682246976, 646793792, 611070144, 575157504, 539069056, 502781984,
-466300064, 429718016, 393203360, 356913536, 320878656, 284927936,
-248740064, 212036736, 174863904, 137843808, 102263632, 69872776,
-42173520, 17586372
-};
-
-
-/* SNR: 81.55, PHASE: 0.500000000000000 */
-const Word32 CLDFB80_40_fx[400] = // q = 30
-{
--4459, -419, -3627, 1424, -337, -2077,
-303, 18, 81, 159, -711, 9,
-12, -289, -782, 599, -26, 261,
--439, 2799, 3758, -185, 230, -43,
-682, -21, -75, -29, -55, -1950,
-416, 56, 16, 233, 887, -479,
-680, -2718, -569, -16448, -33103, -1653,
--16424, 6275, -1401, -7536, 1256, 82,
-202, 378, -1703, -5, -27, -665,
--1194, 1295, -18, 118, -11445, 11396,
--15922, 16043, 175, 78, -1655, 102,
-374, 132, 161, 4663, -995, -137,
--67, -970, -4393, 2058, -3082, 11739,
--993, 52507, -372470, -339964, -238020, -154668,
--91227, -39704, -68193, -63466, -52270, -36721,
--12972, -20431, -6925, 7426, -2361, 29241,
-920, -11369, 13936, -42084, -90219, 4460,
--7456, 295, 60570, -36066, -9836, -23630,
--40550, -22839, -11573, -27317, -28142, -21799,
-74247, -37443, -94761, -175261, -418504, -781461,
--995765, -1274142, -822204, -644197, -320592, -79371,
--211045, -170432, -131251, -90676, -8615, -38865,
--25806, 10490, -21115, 43834, -93771, -212052,
--80067, 687824, -841077, -28319, 196054, 89800,
--98757, 81413, 22561, 71310, 76947, -1234,
-38817, 69237, 75947, 74313, -220677, 108139,
-388007, 614410, 1602908, 2104013, -1945962, -2345233,
--2073811, -1788974, -1237042, -801097, -773094, -511061,
--205272, 126459, 548962, 854332, 1215260, 1516757,
-1754373, 1867886, 1938796, 1938332, 1525725, 104199,
-1696967, 1687208, 1745905, 1910502, 2033618, 2194668,
-2472078, 2712787, 2937869, 3012596, 3095693, 3204093,
-3274808, 3283756, 3148592, 2939051, 2641685, 2031332,
-1549503, 597843, -490013, -1328870, -1713436, -2059616,
--2084878, -1903964, -1464478, -873102, -195311, 513856,
-1135793, 1697317, 2228107, 2629045, 2909611, 2926214,
-2785543, 2569874, 2293850, 2134485, 1852516, 752397,
--164140, -1082527, -2067571, -3082101, -4010647, -4913513,
--5770452, -6592737, -7388101, -8166445, -8966356, -9806266,
--10700961, -11733450, -12861255, -14030459, -15273330, -16566203,
-17977196, 19420796, 20683474, 22109952, 23560036, 25167814,
-26942868, 28845886, 30930688, 33206692, 35686848, 38368864,
-41237952, 44313740, 47594052, 51099240, 54815852, 58726668,
-62834600, 67067844, 71610536, 76321632, 81103048, 85964624,
-90855304, 95735248, 100552568, 105257896, 109812680, 114164760,
-118253480, 122029112, 125449296, 128468360, 131068744, 133194984,
-134844544, 135983552, 136548480, 136476080, 136056288, 135290432,
-133727152, 131405624, 128303264, 124356992, 119537688, 113797504,
-107116320, 99479544, 90889712, 81356080, 70886368, 59482072,
-47150368, 33884192, 19681098, 4546190, -11521655, -28482206,
--46395036, -65246120, -84945856, -105504280, -126897840, -149107856,
--172107808, -195862240, -220341504, -245510512, -271335616, -297782912,
--324814976, -352387008, -380449280, -408931776, -437767552, -466890752,
--496221408, -525752320, 555187200, 584450368, 613710272, 642840512,
-671780800, 700438528, 728721728, 756541312, 783807872, 810444608,
-836384512, 861566464, 885927424, 909395008, 931888896, 953321728,
-973609216, 992677120, 1010468928, 1026949632, 1042084096, 1055868544,
-1068286464, 1079312512, 1088916480, 1097072128, 1103772032, 1109042176,
-1112948608, 1115590912, 1117080960, 1117511680, 1116923264, 1115280512,
-1112471040, 1108330880, 1102691712, 1095455872, 1086748672, 1077537920,
-1062688064, 1042243712, 1021432192, 999408768, 976158720, 951869952,
-926793472, 901173760, 875200384, 848982208, 822546624, 795860992,
-768868224, 741522368, 713812928, 685772416, 657463808, 628958848,
-600314432, 571556608, 542686272, 513690592, 484561600, 455329056,
-426060320, 396846880, 367771776, 338869952, 310096864, 281325184,
-252379520, 223109248, 193485184, 163693120, 134192648, 105710896,
-79151352, 55383672, 34725716, 14899882
-};
-
-
-/* SNR: 85.15, PHASE: 0.166666666666667 */
-const Word32 CLDFB80_60_fx[600] = // q = 30
-{ -11638, 1767, -122, 1628, -5032, -196,
-161, -88, -3545, 137, -196, 21,
-36, 26, 132, -1128, 203, 12,
--29, -254, -97, -286, -755, 689,
--55, -8, 215, -1583, 5224, -169,
--595, 7569, -1361, 190, 3, -67,
-788, 161, -43, -20, -101, -32,
--10, 462, -3064, 321, -85, 24,
-12, -115, 151, -968, 1651, -22,
--258, -2694, -28, 68, 4755, -32803,
--51846, 4946, -596, 6086, -22236, -388,
-578, -524, -12974, 673, -658, 65,
-91, 65, 314, -2699, 469, 12,
--69, -402, -518, -689, -1021, 1669,
--23, 719, 449, -2322, -9362, 9537,
--13566, 12273, 3730, -157, -828, 61,
--1978, -312, 206, 462, 170, 84,
-41, -1089, 7330, -768, 201, -60,
--41, 407, -660, 3231, -7058, 161,
-771, 12038, 198, -1291, -3893, 106546,
--387363, -327043, -319712, -213953, -222151, -158504,
--105319, -35479, -59682, -66733, -70712, -61610,
--55171, -44739, -31711, -9900, -22286, -19252,
--9917, -4950, 14172, 3111, 10391, 26566,
-4086, -6975, -13332, -9892, 55398, -89244,
--120822, 27635, -30751, -9363, -7373, 2810,
-49557, 3144, -15960, 10651, -22481, -39335,
--43081, -20586, -29742, -8098, -25326, -28071,
--28128, -30793, -15878, 36414, 63871, -51035,
--98423, -118589, -196780, -380753, -531211, -867079,
--924260, -1262671, -1211187, -909700, -706692, -590140,
--387713, -140675, -90592, -207147, -191397, -163116,
--139419, -107627, -77449, 8620, -49946, -36329,
--21446, -20212, 13295, -23389, 30609, 24765,
--73159, -145958, -228347, -136170, 302172, 622362,
--742756, -516943, 79533, 208728, 139838, 68780,
--69177, -27637, 72365, 6204, 62099, 78720,
-81230, 52144, -15436, 27781, 58317, 71170,
-74613, 81974, 55368, -164496, -160536, 180918,
-362005, 375017, 795458, 1461875, 1963206, 2095155,
--1983049, -2140127, -2301661, -2078197, -2009648, -1702455,
--1336746, -925313, -815553, -803613, -652848, -461551,
--265137, -36271, 196856, 518314, 664400, 915382,
-1166217, 1339893, 1585569, 1738976, 1799274, 1890535,
-1933937, 1945125, 1923994, 1665861, 831665, 77564,
-1488037, 1777056, 1688417, 1721975, 1828829, 1937199,
-2017937, 2078398, 2252451, 2437196, 2585601, 2754365,
-2909842, 2993432, 3016599, 3074266, 3154609, 3219375,
-3265044, 3289693, 3277126, 3189837, 3034094, 2902602,
-2709099, 2356141, 1938986, 1632226, 1146722, 418214,
--305018, -993260, -1403823, -1653092, -1911082, -2083225,
--2096449, -2021484, -1849083, -1552144, -1182252, -764155,
--310625, 157141, 627282, 1032601, 1427332, 1788414,
-2142931, 2466905, 2666629, 2856089, 2979250, 2902477,
-2810289, 2692828, 2523008, 2330296, 2193128, 2132550,
-2001086, 1283653, 592123, -15236, -616499, -1241115,
--1897102, -2589952, -3235046, -3852858, -4472529, -5058432,
--5630304, -6187298, -6725206, -7257095, -7776617, -8297675,
--8829816, -9380603, -9952123, -10548511, -11192438, -11919065,
--12671172, -13438549, -14232061, -15062200, -15899665, -16802572,
-17739412, 18725886, 19625418, 20458448, 21392202, 22346532,
-23310144, 24336266, 25457146, 26639572, 27874318, 29180440,
-30570936, 32044188, 33604364, 35257056, 37006492, 38833420,
-40745368, 42749912, 44846596, 47032812, 49318540, 51704112,
-54183000, 56747120, 59397304, 62137772, 64938688, 67793344,
-70831448, 73960840, 77111768, 80298224, 83528888, 86778376,
-90039080, 93302528, 96541856, 99755032, 102923904, 106027616,
-109066040, 112017456, 114866184, 117592440, 120184144, 122624224,
-124905544, 127010856, 128931552, 130666344, 132191136, 133505016,
-134605360, 135478896, 136120576, 136498544, 136610544, 136390896,
-136106368, 135791440, 135081680, 134039064, 132663544, 130943336,
-128876128, 126439184, 123615464, 120403880, 116783968, 112750168,
-108296544, 103416816, 98114136, 92387688, 86239880, 79676032,
-72697184, 65299188, 57491652, 49271324, 40633116, 31582262,
-22113356, 12229525, 1933215, -8779568, -19893306, -31396530,
--43338216, -55715672, -68469528, -81601800, -95119752, -109012544,
--123274624, -137902624, -152887216, -168220960, -183892768, -199892672,
--216212560, -232841840, -249770272, -266987040, -284483936, -302248800,
--320270592, -338536576, -357031680, -375740448, -394642624, -413715328,
--432939744, -452297696, -471766976, -491319872, -510956224, -530689568,
-550314688, 569805312, 589331520, 608841280, 628294144, 647679424,
-666974528, 686151296, 705180416, 724037376, 742695360, 761126400,
-779305216, 797209408, 814818048, 832112192, 849073920, 865685504,
-881927232, 897777728, 913213888, 928211072, 942743488, 956784768,
-970310720, 983299712, 995732352, 1007593856, 1018874944, 1029566592,
-1039655360, 1049145600, 1058033856, 1066312576, 1073975296, 1081012992,
-1087415680, 1093176448, 1098289920, 1102755712, 1106582656, 1109785856,
-1112388096, 1114420736, 1115916544, 1116907776, 1117424512, 1117484800,
-1117091968, 1116238848, 1114897920, 1113026048, 1110577792, 1107500160,
-1103739520, 1099271424, 1094099328, 1088271360, 1081958528, 1076012800,
-1066112832, 1052270720, 1038832960, 1024980800, 1010577920, 995613248,
-980113280, 964128448, 947737280, 931017344, 914037760, 896864896,
-879548544, 862118336, 844591360, 826968768, 809238464, 791384896,
-773390848, 755241024, 736928896, 718455680, 699830528, 681070912,
-662197568, 643231744, 624193216, 605096768, 585949312, 566752640,
-547506176, 528205504, 508844544, 489425088, 469954944, 450450944,
-430937408, 411440896, 391989376, 372605984, 353300032, 334067616,
-314888448, 295721536, 276517248, 257224080, 237791168, 218193616,
-198443888, 178588864, 158737840, 139063920, 119772248, 101121944,
-83411368, 66882256, 51724928, 38009000, 25081918, 11097560
-};
-
-
-/* 5ms delay prototype */
-const Word32 LDQMF_10_fx[] = // q = 30
-{
- 136778, 68195, -70890, -226890, -352352, -420072,
--436802, -444543, -506661, -672815, -980068, -1367880,
--1747442, -2041059, -2171766, -2084001, -1756846, -1205000,
--470033, 391658, -1352314, -2311012, -3225024, -4068760,
--4825637, -5483931, -6033975, -6472204, -6808585, -7075060,
--7325812, -7636335, -8074047, -8676456, -9424478, -10219283,
--10865228, -11073811, -10475044, -8652076, 5180201, -339904,
--8224782, -18673422, -31726070, -47229416, -64809980, -83846512,
--103451368, -122477480, -139540384, -153063904, -161342016, -162639632,
--155309920, -137908720, -109304704, -68777832, -16099735, 48410956,
--123867744, -208812656, -301278944, -398795360, -498505440, -597277184,
--691834048, -778907776, -855407232, -918606592, -966152640, -996390080,
--1008509056, -1002265344, -978191040, -937540800, -882190336, -814525888,
--737309056, -653527872, 566225280, 478344672, 392910464, 312395584,
-238918544, 174094816, 118926376, 73749168, 38239292, 11438051,
--6809585, -17473586, -23179288, -24893300, -23497172, -19904868,
--15070633, -9938406, -5364481, -2000462
-};
-
-
-const Word32 LDQMF_16_fx[] = // q = 30
-{
-135840, 119105, 61025, -23300, -120396, -217572,
--303688, -369787, -411986, -431913, -436960, -439365,
--455121, -500073, -585815, -716339, -910646, -1146410,
--1392576, -1634245, -1852285, -2026746, -2138911, -2173116,
--2118583, -1970211, -1728614, -1399460, -992562, -520340,
-3268, 562389, -1169900, -1774888, -2369781, -2945925,
--3497147, -4018445, -4506032, -4956920, -5368526, -5738270,
--6064626, -6347064, -6587229, -6790047, -6964112, -7121373,
--7276728, -7449880, -7659373, -7920485, -8244154, -8633965,
--9083566, -9574508, -10074442, -10534940, -10894573, -11076715,
--10992408, -10543848, -9627864, -8139161, 5976364, 3037887,
--760649, -5491840, -11209240, -17943616, -25700144, -34454400,
--44150032, -54695840, -65964980, -77789648, -89960896, -102229872,
--114308392, -125871952, -136561440, -145990880, -153753088, -159424128,
--162577504, -162794960, -159676832, -152853360, -141995744, -126825840,
--107126032, -82747424, -53617472, -19744928, 18775524, 61761592,
--108947912, -159965984, -214394832, -271716064, -331337920, -392605120,
--454808224, -517194272, -578978880, -639359104, -697528768, -752693376,
--804086912, -850989824, -892747136, -928791232, -958536704, -981563328,
--997684800, -1006698432, -1008520640, -1003187328, -990852800, -971782976,
--946346880, -915003328, -878295040, -836832960, -791284544, -742359104,
--690793664, -637338560, 582754624, 527645440, 472906400, 419190784,
-367113152, 317241312, 270082016, 226065808, 185534960, 148735312,
-115810224, 86800312, 61646000, 40190228, 22181636, 7245162,
--4169367, -12156084, -17964338, -21866804, -24101958, -24886370,
--24433336, -22962478, -20701850, -17885954, -14749119, -11519968,
--8412224, -5619924, -3298610, -1524161
-};
-
-
-const Word32 LDQMF_20_fx[] = // q = 30
-{
-132095, 130054, 94118, 37811, -32619, -110471,
--188997, -262715, -325880, -375095, -408842, -427924,
--435582, -437285, -440062, -452482, -482692, -537287,
--620381, -731564, -887814, -1074239, -1268925, -1466394,
--1657422, -1832122, -1980124, -2091724, -2157946, -2171782,
--2128230, -2024638, -1860817, -1638685, -1362085, -1036418,
--668022, -263994, 167952, 619489, -1109006, -1594302,
--2074063, -2544892, -3002259, -3443307, -3865450, -4266665,
--4645248, -4999899, -5329217, -5631869, -5906959, -6153951,
--6372928, -6565001, -6732690, -6880012, -7012401, -7136777,
--7260809, -7394870, -7549043, -7731644, -7949919, -8208793,
--8510223, -8852171, -9227619, -9624792, -10025312, -10404401,
--10731825, -10971712, -11081824, -11015548, -10722771, -10150872,
--9246198, -7954792, 6226194, 4006049, 1251053, -2079213,
--6018496, -10592059, -15815707, -21694928, -28223572, -35382820,
--43140436, -51449560, -60249600, -69462792, -78994976, -88734976,
--98555328, -108312432, -117847120, -126986608, -135542896, -143318016,
--150106768, -155693424, -159859744, -162387488, -163062224, -161676800,
--158034768, -151954128, -143271408, -131843832, -117553208, -100308496,
--80048728, -56744644, -30400730, -1056328, 31212950, 66296312,
--104051416, -144280880, -186784688, -231313168, -277585056, -325290400,
--374093504, -423635840, -473540064, -523412928, -572850304, -621440576,
--668770368, -714429248, -758014656, -799138176, -837430848, -872549376,
--904183040, -932063424, -955866112, -975368256, -990502784, -1001141248,
--1007204608, -1008661952, -1005531712, -997881088, -985824192, -969518976,
--949164608, -924995776, -897283008, -866326016, -832450624, -796003264,
--757347840, -716859456, -674920448, -631918336, 588261568, 544170240,
-500187776, 456655456, 413899520, 372230592, 331939808, 293293792,
-256529792, 221851008, 189423392, 159373024, 131783696, 106697088,
-84113256, 63991576, 46252108, 30775584, 17400960, 5897692,
--3242832, -10003035, -15315395, -19324048, -22161874, -23947232,
--24790774, -24801182, -24088950, -22768174, -20956786, -18774960,
--16343248, -13780261, -11200397, -8711802, -6413878, -4393110,
--2713518, -1364255
-};
-
-
-const Word32 LDQMF_30_fx[] = // q = 30
-{
- 121571, 136778, 125655, 101704, 68195, 26875,
--20212, -70890, -123705, -176138, -226890, -274106,
--316253, -352352, -381787, -404297, -420072, -429892,
--434876, -436802, -437431, -439163, -444543, -456066,
--476087, -506661, -549091, -604538, -672815, -752814,
--858037, -980068, -1106184, -1235998, -1367880, -1498945,
--1626464, -1747442, -1858910, -1957741, -2041059, -2106142,
--2150372, -2171766, -2168618, -2139643, -2084001, -2001495,
--1892255, -1756846, -1596236, -1411745, -1205000, -977797,
--732072, -470033, -193708, 94399, 391658, 694989,
--1028102, -1352314, -1674661, -1994503, -2311012, -2622127,
--2927093, -3225024, -3515027, -3796480, -4068760, -4331384,
--4583784, -4825637, -5056603, -5276176, -5483931, -5679645,
--5863044, -6033975, -6192384, -6338348, -6472204, -6594554,
--6706284, -6808585, -6902959, -6991107, -7075060, -7157331,
--7239857, -7325812, -7418951, -7521577, -7636335, -7765375,
--7910813, -8074047, -8256089, -8457071, -8676456, -8912695,
--9163169, -9424478, -9691922, -9959316, -10219283, -10463412,
--10682245, -10865228, -11000298, -11074417, -11073811, -10983892,
--10789539, -10475044, -10024687, -9422374, -8652076, -7698111,
-6547450, 5180201, 3585185, 1749124, -339904, -2692689,
--5318487, -8224782, -11417230, -14899579, -18673422, -22738288,
--27091010, -31726070, -36635292, -41807760, -47229416, -52884028,
--58751904, -64809980, -71032152, -77388632, -83846512, -90369776,
--96918936, -103451368, -109921528, -116280640, -122477480, -128458624,
--134165992, -139540384, -144523760, -149052944, -153063904, -156492352,
--159273296, -161342016, -162634320, -163087360, -162639632, -161231616,
--158806368, -155309920, -150691824, -144905568, -137908720, -129663752,
--120138088, -109304704, -97142448, -83636416, -68777832, -52564528,
--35001268, -16099735, 4121304, 25635912, 48410956, 72407360,
--97584200, -123867744, -151213264, -179552912, -208812656, -238912112,
--269764832, -301278944, -333357440, -365898336, -398795360, -431938528,
--465214080, -498505440, -531693760, -564658432, -597277184, -629427584,
--660987072, -691834048, -721848128, -750911168, -778907776, -805726528,
--831260224, -855407232, -878071616, -899164800, -918606592, -936328128,
--952202112, -966152640, -978197888, -988289792, -996390080, -1002471040,
--1006513664, -1008509056, -1008457600, -1006369728, -1002265344, -996173888,
--988133504, -978191040, -966401920, -952828672, -937540800, -920615360,
--902135488, -882190336, -860873664, -838284672, -814525888, -789704064,
--763927872, -737309056, -709960000, -681994880, -653527872, -624673024,
-595607552, 566225280, 536822976, 507495872, 478344672, 449466912,
-420958208, 392910464, 365412224, 338547584, 312395584, 287029856,
-262517344, 238918544, 216286160, 194665808, 174094816, 154602160,
-136208672, 118926376, 102759984, 87704592, 73749168, 60872400,
-49048000, 38239292, 28404982, 19492542, 11438051, 4150853,
--1959299, -6809585, -10983833, -14524688, -17473586, -19875174,
--21764768, -23179288, -24150308, -24711158, -24893300, -24729546,
--24252922, -23497172, -22497182, -21287720, -19904868, -18383770,
--16760795, -15070633, -13348427, -11626766, -9938406, -8313092,
--6779951, -5364481, -4088471, -2966834, -2000462, -1134160
-};
-
-
-const Word32 LDQMF_32_fx[] = // q = 30
-{
-119697, 137151, 128520, 107723, 78400, 41836,
--442, -46740, -95597, -145201, -193804, -240598,
--283800, -322316, -355411, -382593, -403699, -418862,
--428699, -434120, -436480, -437237, -438149, -441391,
--449045, -463039, -485346, -517326, -560092, -614348,
--679872, -755580, -854379, -968457, -1086190, -1207329,
--1330799, -1454135, -1575271, -1691704, -1801098, -1900763,
--1988263, -2061316, -2117677, -2155275, -2172543, -2168111,
--2140952, -2090356, -2016155, -1918414, -1797519, -1654212,
--1489464, -1304576, -1100939, -880095, -643755, -393648,
--131597, 140303, 419876, 704520, -1017921, -1322020,
--1624457, -1924758, -2222508, -2515835, -2804014, -3086295,
--3361992, -3630425, -3891163, -4143616, -4387487, -4622276,
--4847761, -5063642, -5269495, -5464963, -5649876, -5823971,
--5987172, -6139337, -6280537, -6410931, -6530943, -6641149,
--6742439, -6835855, -6922708, -7004445, -7082802, -7159902,
--7237256, -7317480, -7403834, -7498178, -7602711, -7719257,
--7849652, -7995245, -8157013, -8335469, -8530447, -8741283,
--8966383, -9203373, -9449370, -9700315, -9951033, -10195449,
--10426707, -10637019, -10818085, -10960053, -11052529, -11084311,
--11043675, -10918394, -10695736, -10362793, -9906464, -9313511,
--8570674, -7665161, 6586647, 5317833, 3849979, 2171972,
-273875, -1853535, -4218327, -6827112, -9685347, -12796811,
--16163952, -19787344, -23665996, -27796800, -32174812, -36793016,
--41642268, -46710992, -51985904, -57451192, -63088408, -68876552,
--74792144, -80808992, -86898528, -93029584, -99168576, -105279432,
--111323816, -117260928, -123048216, -128641440, -133992400, -139052160,
--143773440, -148104208, -151991888, -155383600, -158225792, -160465072,
--162048320, -162923104, -163038096, -162343200, -160789920, -158332016,
--154925376, -150528912, -145104496, -138617152, -131035664, -122332640,
--112485024, -101474136, -89286032, -75911456, -61346324, -45591780,
--28653996, -10544916, 8718141, 29112362, 50609392, 73176464,
--96780680, -121357544, -146873168, -173272304, -200494976, -228475968,
--257145792, -286430368, -316251616, -346527296, -377172096, -408096800,
--439210240, -470417824, -501623072, -532727936, -563632832, -594237184,
--624439872, -654140096, -683237312, -711632192, -739226496, -765924288,
--791632320, -816260416, -839722176, -861935360, -882823040, -902313408,
--920341952, -936853184, -951735680, -964924736, -976443584, -986251200,
--994314944, -1000609792, -1005117952, -1007828864, -1008739392, -1007854080,
--1005185024, -1000751488, -994580096, -986704064, -977163328, -966004416,
--953279168, -939044864, -923364608, -906306368, -887942656, -868349888,
--847608448, -825801792, -803016512, -779341120, -754867072, -729686080,
--703891520, -677576896, -650837184, -623766656, 596524928, 568982144,
-541414592, 513899552, 486520032, 459356832, 432489472, 405994688,
-379947008, 354417408, 329473600, 305178976, 281592608, 258768368,
-236754960, 215594992, 195325728, 175977920, 157575920, 140137536,
-123674336, 108191456, 93687496, 80154992, 67580128, 55943780,
-45219876, 35377480, 26377892, 18179138, 10724362, 3937154,
--1793747, -6383129, -10375463, -13802420, -16701194, -19108980,
--21056298, -22573612, -23687536, -24425978, -24814642, -24880884,
--24650790, -24152456, -23413234, -22462376, -21328340, -20040900,
--18629038, -17122794, -15550818, -13942058, -12323783, -10723672,
--9166937, -7678115, -6278687, -4990172, -3829056, -2807491,
--1918388, -1103400
-};
-
-
-const Word32 LDQMF_40_fx[] = // q = 30
-{
-113206, 137254, 134425, 123146, 105211, 81666,
-53560, 21302, -14069, -51499, -90644, -130324,
--169687, -208133, -245093, -279677, -311296, -339564,
--364227, -384972, -401866, -414904, -424383, -430758,
--434462, -436342, -437086, -437526, -438798, -441921,
--448029, -458055, -473038, -493889, -521096, -555299,
--596905, -645667, -701531, -764070, -843495, -933719,
--1026835, -1122239, -1219597, -1318430, -1417239, -1515133,
--1610824, -1702996, -1790556, -1872015, -1946188, -2011806,
--2067738, -2112859, -2146050, -2166539, -2173557, -2166437,
--2144725, -2108000, -2056211, -1989295, -1907357, -1810628,
--1699503, -1574446, -1436054, -1285028, -1122103, -948052,
--763730, -570121, -367947, -158284, 57837, 279329,
-505114, 733496, -987128, -1230885, -1473412, -1714779,
--1954662, -2192913, -2428356, -2660607, -2889345, -3114179,
--3334742, -3550687, -3761781, -3967793, -4168400, -4363503,
--4552806, -4736194, -4913551, -5084693, -5249383, -5407420,
--5558753, -5703241, -5840790, -5971350, -6094838, -6211308,
--6320774, -6423390, -6519396, -6609079, -6692852, -6771222,
--6844809, -6914280, -6980363, -7043921, -7105964, -7167616,
--7229469, -7292854, -7359781, -7431209, -7508135, -7591745,
--7682927, -7782628, -7891680, -8010673, -8140087, -8280182,
--8430924, -8592083, -8763179, -8943293, -9131195, -9325472,
--9524332, -9725493, -9926142, -10123188, -10313198, -10492333,
--10656603, -10801577, -10922158, -11013175, -11068951, -11083709,
--11051345, -10965628, -10820070, -10607987, -10322919, -9958035,
--9506509, -8961670, -8316717, -7565184, 6702942, 5718827,
-4609517, 3369113, 1992225, 473872, -1190731, -3005819,
--4975066, -7101637, -9388180, -11836610, -14448347, -17224060,
--20163764, -23266722, -26531342, -29955288, -33535422, -37267720,
--41147260, -45168140, -49323552, -53606284, -58007508, -62517548,
--67125584, -71820016, -76587808, -81415152, -86287160, -91187832,
--96100320, -101006496, -105887512, -110723520, -115493552, -120176040,
--124748632, -129188288, -133469680, -137567456, -141458352, -145116032,
--148513808, -151624560, -154421360, -156876704, -158963328, -160653808,
--161921024, -162738128, -163078752, -162916896, -162227280, -160985216,
--159167008, -156749920, -153712208, -150033328, -145694224, -140676912,
--134964928, -128543672, -121399776, -113521832, -104900488, -95527920,
--85398544, -74508560, -62856444, -50442808, -37270156, -23343566,
--8670189, 6740502, 22876916, 39724980, 57268860, 75490816,
--94376496, -113883272, -134001320, -154702832, -175958544, -197737504,
--220006032, -242729312, -265870144, -289389664, -313247648, -337401888,
--361809024, -386424256, -411201216, -436093120, -461051360, -486026816,
--510969600, -535829088, -560554240, -585093440, -609395008, -633407296,
--657078592, -680357568, -703193408, -725535424, -747334272, -768541184,
--789108672, -808990656, -828142272, -846520832, -864084928, -880795968,
--896616960, -911514304, -925457216, -938417536, -950324992, -961141376,
--970896128, -979566976, -987136576, -993587776, -998908288, -1003088128,
--1006120192, -1008000960, -1008729280, -1008307648, -1006741504, -1004039168,
--1000212096, -995274560, -989243584, -982139008, -973983296, -964801472,
--954620608, -943470016, -931381312, -918388608, -904527488, -889835648,
--874352128, -858117568, -841174400, -823565824, -805336512, -786531904,
--767198144, -747382720, -727132672, -706495808, -685520512, -664254656,
--642746560, -621047616, 599273536, 577248256, 555196416, 533150944,
-511154144, 489249568, 467478368, 445881248, 424498464, 403368608,
-382529632, 362017792, 341868224, 322114240, 302787552, 283917824,
-265532592, 247657504, 230315568, 213527440, 197311648, 181683920,
-166657488, 152242496, 138447232, 125276624, 112733328, 100817520,
-89526080, 78854768, 68795096, 59337532, 50469688, 42175888,
-34440516, 27241264, 20558124, 14361678, 8619497, 3303077,
--1288525, -5070930, -8454926, -11459781, -14115485, -16433949,
--18436136, -20138626, -21555150, -22702724, -23593500, -24242222,
--24662498, -24867088, -24870766, -24686354, -24328404, -23811232,
--23148884, -22356736, -21449164, -20441404, -19348716, -18185774,
--16968062, -15710186, -14426756, -13132428, -11840736, -10565599,
--9320040, -8115962, -6965903, -5879984, -4867950, -3939393,
--3097321, -2346408, -1680052, -1007771
-};
-
-
-const Word32 LDQMF_60_fx[] = // q = 30
-{
- 102336, 132095, 137435, 135349, 130054, 120487,
-108540, 94118, 77297, 58570, 37811, 15643,
--7974, -32619, -57897, -84046, -110471, -136942,
--163210, -188997, -214438, -239091, -262715, -285164,
--306247, -325880, -343923, -360378, -375095, -388054,
--399325, -408842, -416725, -423037, -427924, -431547,
--434000, -435582, -436522, -437005, -437285, -437644,
--438481, -440062, -442703, -446767, -452482, -460182,
--470154, -482692, -497967, -516093, -537287, -561715,
--589463, -620381, -654511, -691825, -731564, -775911,
--829205, -887814, -949148, -1011179, -1074239, -1138341,
--1203246, -1268925, -1334921, -1400802, -1466394, -1531260,
--1595082, -1657422, -1717943, -1776350, -1832122, -1884921,
--1934396, -1980124, -2021834, -2059138, -2091724, -2119241,
--2141378, -2157946, -2168655, -2173353, -2171782, -2163852,
--2149388, -2128230, -2100421, -2065896, -2024638, -1976676,
--1922048, -1860817, -1793099, -1719008, -1638685, -1552286,
--1460012, -1362085, -1258676, -1150050, -1036418, -918024,
--795131, -668022, -536993, -402188, -263994, -122679,
-21420, 167952, 316690, 467104, 619489, 773430,
--945239, -1109006, -1271451, -1433050, -1594302, -1754861,
--1914784, -2074063, -2232363, -2389328, -2544892, -2698989,
--2851488, -3002259, -3151251, -3298296, -3443307, -3586211,
--3726943, -3865450, -4001599, -4135335, -4266665, -4395461,
--4521664, -4645248, -4766175, -4884420, -4999899, -5112604,
--5222404, -5329217, -5433113, -5533999, -5631869, -5726641,
--5818340, -5906959, -5992421, -6074745, -6153951, -6230036,
--6303010, -6372928, -6439843, -6503845, -6565001, -6623435,
--6679269, -6732690, -6783804, -6832855, -6880012, -6925506,
--6969547, -7012401, -7054336, -7095680, -7136777, -7177903,
--7219120, -7260809, -7303731, -7348340, -7394870, -7443617,
--7494881, -7549043, -7606393, -7667166, -7731644, -7800142,
--7872827, -7949919, -8031501, -8117779, -8208793, -8304570,
--8405066, -8510223, -8619935, -8734017, -8852171, -8974106,
--9099397, -9227619, -9358364, -9490965, -9624792, -9759051,
--9892867, -10025312, -10155439, -10282162, -10404401, -10520844,
--10630426, -10731825, -10823502, -10903968, -10971712, -11025073,
--11062346, -11081824, -11081759, -11060277, -11015548, -10945697,
--10848751, -10722771, -10565739, -10375810, -10150872, -9888970,
--9588053, -9246198, -8861297, -8431401, -7954792, -7429283,
-6854949, 6226194, 5542800, 4803353, 4006049, 3149248,
-2231398, 1251053, 206700, -902968, -2079213, -3323232,
--4636016, -6018496, -7471561, -8995894, -10592059, -12260527,
--14001671, -15815707, -17702624, -19662438, -21694928, -23799650,
--25976100, -28223572, -30541232, -32928052, -35382820, -37904240,
--40490688, -43140436, -45851544, -48621904, -51449560, -54331840,
--57266136, -60249600, -63279032, -66351236, -69462792, -72609920,
--75788648, -78994976, -82224448, -85472704, -88734976, -92006232,
--95281520, -98555328, -101822272, -105076584, -108312432, -111523680,
--114704032, -117847120, -120946376, -123995120, -126986608, -129913560,
--132768248, -135542896, -138230992, -140825344, -143318016, -145701104,
--147966688, -150106768, -152113232, -153978192, -155693424, -157250816,
--158642336, -159859744, -160895152, -161740352, -162387488, -162828688,
--163056176, -163062224, -162839296, -162379936, -161676800, -160722816,
--159511024, -158034768, -156287280, -154262480, -151954128, -149356496,
--146464032, -143271408, -139773568, -135965808, -131843832, -127403488,
--122641048, -117553208, -112136840, -106389392, -100308496, -93892368,
--87139520, -80048728, -72619504, -64851416, -56744644, -48299972,
--39518100, -30400730, -20949652, -11167261, -1056328, 9379870,
-20137698, 31212950, 42601076, 54297248, 66296312, 78593112,
--91185600, -104051416, -117194704, -130607064, -144280880, -158207776,
--172378736, -186784688, -201415824, -216262032, -231313168, -246558128,
--261985952, -277585056, -293343616, -309249600, -325290400, -341453376,
--357725472, -374093504, -390543744, -407062432, -423635840, -440249504,
--456889088, -473540064, -490187584, -506816896, -523412928, -539960640,
--556444864, -572850304, -589161600, -605363456, -621440576, -637377600,
--653159232, -668770368, -684195712, -699420352, -714429248, -729207616,
--743740992, -758014656, -772014784, -785727168, -799138176, -812234496,
--825002880, -837430848, -849505856, -861215872, -872549376, -883495616,
--894043456, -904183040, -913905152, -923200640, -932063424, -940477696,
--948417216, -955866112, -962841216, -969345024, -975368256, -980905536,
--985952256, -990502784, -994553344, -998100544, -1001141248, -1003673344,
--1005694720, -1007204608, -1008202304, -1008687808, -1008661952, -1008125952,
--1007081664, -1005531712, -1003479040, -1000927424, -997881088, -994344832,
--990323904, -985824192, -980852096, -975414528, -969518976, -963173312,
--956385600, -949164608, -941519424, -933459776, -924995776, -916137728,
--906896448, -897283008, -887308928, -876985984, -866326016, -855341824,
--844045696, -832450624, -820569472, -808415936, -796003264, -783345088,
--770455104, -757347840, -744036608, -730535808, -716859456, -703022272,
--689038016, -674920448, -660685696, -646345600, -631918336, -617424704,
-602927232, 588261568, 573575488, 558872576, 544170240, 529480224,
-514815008, 500187776, 485610624, 471095904, 456655456, 442301536,
-428045760, 413899520, 399874240, 385981024, 372230592, 358633472,
-345199872, 331939808, 318862624, 305977728, 293293792, 280819232,
-268562016, 256529792, 244729552, 233167968, 221851008, 210784624,
-199973840, 189423392, 179137440, 169119664, 159373024, 149900064,
-140703152, 131783696, 123142424, 114780232, 106697088, 98892400,
-91364808, 84113256, 77135992, 70429688, 63991576, 57819020,
-51907328, 46252108, 40848248, 35691672, 30775584, 26091894,
-21637068, 17400960, 13374445, 9548629, 5897692, 2475272,
--592184, -3242832, -5659970, -7917455, -10003035, -11926348,
--13696880, -15315395, -16789184, -18123694, -19324048, -20394110,
--21338122, -22161874, -22868630, -23462238, -23947232, -24327810,
--24607834, -24790774, -24881324, -24883598, -24801182, -24638338,
--24399474, -24088950, -23710470, -23268668, -22768174, -22213084,
--21607820, -20956786, -20264828, -19536176, -18774960, -17986262,
--17174228, -16343248, -15497611, -14641749, -13780261, -12916498,
--12055168, -11200397, -10355588, -9525147, -8711802, -7920384,
--7153632, -6413878, -5706099, -5031208, -4393110, -3792571,
--3230785, -2713518, -2227977, -1784736, -1364255, -871387
-};
-
-const Word32 rot_vec_delay_re_LDQMF_fx[60] = // q = 31
-{
- -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224,
- 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224,
- -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224,
- 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224,
- -1518500224, 1518500224, 1518500224, -1518500224
-};
-
-const Word32 rot_vec_delay_im_LDQMF_fx[60] = // q = 31
-{
- -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224,
- 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224,
- -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224,
- 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224,
- -1518500224, -1518500224, 1518500224, 1518500224
-};
-
-const Word32 rot_vec_ana_re_L10_fx[5] = // q = 29
-{
- 1517329536, 1424643840, 1192503936, 843633536, 412182400
-};
-
-const Word32 rot_vec_ana_im_L10_fx[5] = // q = 29
-{
- -59616040, -525578848, -940094336, -1262586752, -1461488512
-};
-
-const Word32 rot_vec_ana_re_L16_fx[8] = // q = 29
-{
- 1200118272, 1171310720, 1097490432, 981494080, 827779520, 642253888, 432046752, 205236304
-};
-
-const Word32 rot_vec_ana_im_L16_fx[8] = // q = 29
-{
- -29461250, -263026624, -486484032, -691246144, -869444032, -1014229696, -1120039040, -1182806016
-};
-
-const Word32 rot_vec_ana_re_L20_fx[10] = // q = 29
-{
- 1073534848, 1057019968, 1014477760, 946955776, 856116544, 744196864, 613952640, 468590848, 311690784, 147115888
-};
-
-const Word32 rot_vec_ana_im_L20_fx[10] = // q = 29
-{
- -21081516, -188759824, -351790240, -506158400, -648063232, -774010624, -880899328, -966097344, -1027506880, -1063615744
-};
-
-const Word32 rot_vec_ana_re_L30_fx[15] = // q = 29
-{
- 876631424, 870629568, 855088960, 830179840, 796175040, 753447232, 702464448, 643785344, 578052800, 505986944, 428377440, 346074528, 259979936, 171036960, 80220064
-};
-
-const Word32 rot_vec_ana_im_L30_fx[15] = // q = 29
-{
- -11475734, -103045800, -193486880, -281808064, -367041728, -448253984, -524555072, -595109056, -659142848, -715955008, -764922944, -805510272, -837272192, -859860864, -873028672
-};
-
-const Word32 rot_vec_ana_re_L32_fx[16] = // q = 29
-{
- 848803520, 843695296, 830461760, 809230464, 780205824, 743667392, 699967040, 649525568, 592828864, 530422880, 462908640, 390936320, 315199072, 236426304, 155376608, 72830544
-};
-
-const Word32 rot_vec_ana_im_L32_fx[16] = // q = 29
-{
- -10416909, -93564040, -175810112, -256363024, -334447008, -409310112, -480231328, -546527616, -607560576, -662742400, -711541696, -753488384, -788178560, -815278208, -834526272, -845737344
-};
-
-const Word32 rot_vec_ana_re_L40_fx[20] = // q = 29
-{
- 759213504, 756288320, 748700352, 736496320, 719751616, 698569408, 673080256, 643441344, 609835392, 572469632, 531574400, 487401824, 440224256, 390332576, 338034336,
- 283652032, 227520896, 169987024, 111405128, 52136384
-};
-
-const Word32 rot_vec_ana_im_L40_fx[20] = // q = 29
-{
- -7453801, -66998032, -126129192, -184482736, -241698864, -297424864, -351317120, -403043392, -452284768, -498737664, -542115648, -582151360, -618597888, -651230528,
- -679848192, -704274304, -724358336, -739976448, -751032384, -757457984
-};
-
-const Word32 rot_vec_ana_re_L60_fx[30] = // q = 29
-{
- 619911872, 618849920, 616091776, 611644992, 605521728, 597738752, 588317440, 577283520, 564667392, 550503488, 534830720, 517692032, 499134368, 479208608, 457969376, 435474880, 411786784,
- 386970016, 361092576, 334225408, 306442144, 277818944, 248434272, 218368656, 187704512, 156525872, 124918216, 92968160, 60763288, 28391868
-};
-
-const Word32 rot_vec_ana_im_L60_fx[30] = // q = 29
-{
- -4057371, -36495492, -68833576, -100983000, -132855632, -164364112, -195422080, -225944416, -255847456, -285049248, -313469728, -341030976, -367657536, -393276352, -417817216, -441212864,
- -463399200, -484315392, -503904096, -522111616, -538888128, -554187520, -567967936, -580191616, -590825024, -599838976, -607208896, -612914432, -616940032, -619274624
-};
-
-
-/*!
- * \brief CLDFB prototype filter
- *
- * cldfb bands: 10
- * delay[ms]: 1.00
- * abs. max Val: 1.04
- * scale: 0.50
- */
-const Word16 CLDFB80_10[] =//Q.5
-{
- W16(0x0000), W16(0xfffc), W16(0xffdf), W16(0x0132), W16(0x23b5),
- W16(0x0000), W16(0xffff), W16(0xfff3), W16(0x018d), W16(0x2a98),
- W16(0x0000), W16(0x0000), W16(0x0006), W16(0x020d), W16(0x3116),
- W16(0x0000), W16(0x0000), W16(0x001a), W16(0x02bd), W16(0x36e2),
- W16(0x0000), W16(0x0000), W16(0x001c), W16(0x039f), W16(0x3bb5),
- W16(0x0000), W16(0xffff), W16(0x001a), W16(0x04b1), W16(0x3f51),
- W16(0x0000), W16(0x0000), W16(0x0024), W16(0x05da), W16(0x419a),
- W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ee), W16(0x428c),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07bd), W16(0x4267),
- W16(0x0000), W16(0xfffc), W16(0x001b), W16(0x0820), W16(0x410b),
- W16(0x0000), W16(0xfff0), W16(0xffe9), W16(0x0806), W16(0x3d82),
- W16(0x0000), W16(0xfffe), W16(0xffe6), W16(0x0746), W16(0x37fe),
- W16(0x0000), W16(0x0000), W16(0x000d), W16(0x05ae), W16(0x31d1),
- W16(0x0000), W16(0x0000), W16(0x002a), W16(0x032f), W16(0x2b60),
- W16(0x0000), W16(0xfffd), W16(0x0025), W16(0xffcd), W16(0x24a3),
- W16(0x0000), W16(0x0003), W16(0x0004), W16(0xfb88), W16(0x1dc0),
- W16(0x0000), W16(0x0000), W16(0xffca), W16(0xf66f), W16(0x16c9),
- W16(0x0000), W16(0x0000), W16(0xff95), W16(0xf09a), W16(0x0fe8),
- W16(0x0000), W16(0xffff), W16(0xff64), W16(0xea2a), W16(0x08e0),
- W16(0x0000), W16(0x0012), W16(0xff21), W16(0xe34c), W16(0x02aa)
-};
-
-/*!
- * \brief CLDFB prototype filter
- *
- * cldfb bands: 16
- * delay[ms]: 1.00
- * abs. max Val: 1.04
- * scale: 0.50
- */
-const Word16 CLDFB80_16[] =//Q.5
-{
- W16(0x0000), W16(0xfffb), W16(0xffdd), W16(0x0123), W16(0x2266),
- W16(0x0000), W16(0xfffe), W16(0xffe7), W16(0x0157), W16(0x26c0),
- W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0194), W16(0x2b04),
- W16(0x0000), W16(0xffff), W16(0xfffe), W16(0x01e0), W16(0x2f1f),
- W16(0x0000), W16(0x0000), W16(0x000c), W16(0x023f), W16(0x32fc),
- W16(0x0000), W16(0x0000), W16(0x0019), W16(0x02b0), W16(0x368c),
- W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0336), W16(0x39bc),
- W16(0x0000), W16(0x0001), W16(0x0013), W16(0x03cf), W16(0x3c7b),
- W16(0x0000), W16(0x0001), W16(0x001a), W16(0x047b), W16(0x3ebd),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0532), W16(0x407c),
- W16(0x0000), W16(0x0000), W16(0x0025), W16(0x05ec), W16(0x41b3),
- W16(0x0000), W16(0xffff), W16(0x002d), W16(0x069d), W16(0x4262),
- W16(0x0000), W16(0x0000), W16(0x0031), W16(0x0738), W16(0x429c),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07b3), W16(0x4271),
- W16(0x0000), W16(0xffff), W16(0x002a), W16(0x0804), W16(0x41d1),
- W16(0x0000), W16(0xfff9), W16(0x0015), W16(0x0824), W16(0x40a3),
- W16(0x0000), W16(0xffec), W16(0xffee), W16(0x0815), W16(0x3e6c),
- W16(0x0000), W16(0xfff7), W16(0xffe0), W16(0x07ca), W16(0x3b3b),
- W16(0x0000), W16(0xfffd), W16(0xffe8), W16(0x0734), W16(0x379e),
- W16(0x0000), W16(0xfffe), W16(0x0000), W16(0x0647), W16(0x33c7),
- W16(0x0000), W16(0xffff), W16(0x0018), W16(0x04ff), W16(0x2fd6),
- W16(0x0000), W16(0x0000), W16(0x0029), W16(0x035e), W16(0x2bca),
- W16(0x0000), W16(0xffff), W16(0x002b), W16(0x0164), W16(0x279c),
- W16(0x0000), W16(0x0001), W16(0x0022), W16(0xff11), W16(0x235b),
- W16(0x0000), W16(0xfffc), W16(0x000f), W16(0xfc66), W16(0x1f0d),
- W16(0x0000), W16(0x0001), W16(0xffec), W16(0xf966), W16(0x1ab4),
- W16(0x0000), W16(0x0000), W16(0xffc6), W16(0xf617), W16(0x165a),
- W16(0x0000), W16(0x0001), W16(0xffa5), W16(0xf27f), W16(0x120e),
- W16(0x0000), W16(0x0001), W16(0xff86), W16(0xeea6), W16(0x0dbd),
- W16(0x0000), W16(0x0001), W16(0xff67), W16(0xea95), W16(0x0950),
- W16(0x0000), W16(0x0005), W16(0xff40), W16(0xe657), W16(0x051a),
- W16(0x0000), W16(0x001b), W16(0xff12), W16(0xe1fc), W16(0x01c8)
-};
-
-/*!
- * \brief CLDFB prototype filter
- *
- * cldfb bands: 20
- * delay[ms]: 1.00
- * abs. max Val: 1.04
- * scale: 0.50
- */
-const Word16 CLDFB80_20[] =//Q.5
-{
- W16(0x0000), W16(0xfffb), W16(0xffdf), W16(0x011e), W16(0x21f7),
- W16(0x0000), W16(0xfffd), W16(0xffe1), W16(0x0146), W16(0x2573),
- W16(0x0000), W16(0xffff), W16(0xfff2), W16(0x0173), W16(0x28e6),
- W16(0x0000), W16(0xffff), W16(0xfff6), W16(0x01a9), W16(0x2c45),
- W16(0x0000), W16(0xffff), W16(0xffff), W16(0x01e9), W16(0x2f84),
- W16(0x0000), W16(0x0000), W16(0x000a), W16(0x0235), W16(0x329c),
- W16(0x0000), W16(0x0000), W16(0x0014), W16(0x028c), W16(0x3583),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02f1), W16(0x3831),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0362), W16(0x3a9c),
- W16(0x0000), W16(0x0001), W16(0x000d), W16(0x03df), W16(0x3cbb),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x0469), W16(0x3e89),
- W16(0x0000), W16(0x0000), W16(0x001c), W16(0x04fb), W16(0x4004),
- W16(0x0000), W16(0x0000), W16(0x0020), W16(0x0590), W16(0x4129),
- W16(0x0000), W16(0x0000), W16(0x0027), W16(0x0622), W16(0x41f5),
- W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ad), W16(0x426d),
- W16(0x0000), W16(0x0000), W16(0x0030), W16(0x072a), W16(0x429b),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0792), W16(0x4288),
- W16(0x0000), W16(0x0001), W16(0x002e), W16(0x07e1), W16(0x4232),
- W16(0x0000), W16(0xfffe), W16(0x0024), W16(0x0813), W16(0x4186),
- W16(0x0000), W16(0xfff8), W16(0x0011), W16(0x0825), W16(0x407d),
- W16(0x0000), W16(0xffed), W16(0xfff1), W16(0x0818), W16(0x3eb8),
- W16(0x0000), W16(0xfff5), W16(0xffe3), W16(0x07e8), W16(0x3c3c),
- W16(0x0000), W16(0xfffe), W16(0xffe1), W16(0x0789), W16(0x3977),
- W16(0x0000), W16(0xfffd), W16(0xffee), W16(0x06f6), W16(0x367b),
- W16(0x0000), W16(0xfffe), W16(0x0002), W16(0x062a), W16(0x3363),
- W16(0x0000), W16(0xffff), W16(0x0016), W16(0x0524), W16(0x303c),
- W16(0x0000), W16(0x0000), W16(0x0026), W16(0x03e4), W16(0x2d04),
- W16(0x0000), W16(0x0000), W16(0x002d), W16(0x026c), W16(0x29b7),
- W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x00bb), W16(0x2657),
- W16(0x0000), W16(0x0005), W16(0x0021), W16(0xfed0), W16(0x22ed),
- W16(0x0000), W16(0xfff8), W16(0x0014), W16(0xfcae), W16(0x1f7c),
- W16(0x0000), W16(0x0002), W16(0xfff7), W16(0xfa55), W16(0x1c03),
- W16(0x0000), W16(0x0000), W16(0xffd8), W16(0xf7c8), W16(0x1886),
- W16(0x0000), W16(0x0001), W16(0xffbc), W16(0xf50a), W16(0x150f),
- W16(0x0000), W16(0x0001), W16(0xffa2), W16(0xf21f), W16(0x11a0),
- W16(0x0000), W16(0x0001), W16(0xff89), W16(0xef0b), W16(0x0e2c),
- W16(0x0000), W16(0x0001), W16(0xff71), W16(0xebd2), W16(0x0aa5),
- W16(0x0000), W16(0xfffe), W16(0xff55), W16(0xe87a), W16(0x0724),
- W16(0x0000), W16(0x0006), W16(0xff33), W16(0xe50a), W16(0x03fd),
- W16(0x0000), W16(0x001e), W16(0xff0d), W16(0xe18b), W16(0x017f)
-};
-
-/*!
- * \brief CLDFB prototype filter
- *
- * cldfb bands: 32
- * delay[ms]: 1.00
- * abs. max Val: 1.04
- * scale: 0.50
- */
-const Word16 CLDFB80_32[] =//Q.5
-{
- W16(0x0000), W16(0xfffb), W16(0xffe2), W16(0x0115), W16(0x214f),
- W16(0x0000), W16(0xfffc), W16(0xffde), W16(0x012f), W16(0x237e),
- W16(0x0000), W16(0xfffd), W16(0xffe2), W16(0x0149), W16(0x25ab),
- W16(0x0000), W16(0xfffe), W16(0xffec), W16(0x0165), W16(0x27d4),
- W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0183), W16(0x29f6),
- W16(0x0000), W16(0xffff), W16(0xfff6), W16(0x01a6), W16(0x2c10),
- W16(0x0000), W16(0xffff), W16(0xfffb), W16(0x01cc), W16(0x2e1d),
- W16(0x0000), W16(0xffff), W16(0x0001), W16(0x01f6), W16(0x301c),
- W16(0x0000), W16(0x0000), W16(0x0009), W16(0x0226), W16(0x320b),
- W16(0x0000), W16(0x0000), W16(0x000f), W16(0x025a), W16(0x33e7),
- W16(0x0000), W16(0x0000), W16(0x0015), W16(0x0292), W16(0x35b0),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02d0), W16(0x3761),
- W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0313), W16(0x38fa),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x035a), W16(0x3a77),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x03a7), W16(0x3bd7),
- W16(0x0000), W16(0x0000), W16(0x0004), W16(0x03f7), W16(0x3d18),
- W16(0x0000), W16(0xffff), W16(0x001b), W16(0x044e), W16(0x3e38),
- W16(0x0000), W16(0xffff), W16(0x001a), W16(0x04a8), W16(0x3f39),
- W16(0x0000), W16(0x0000), W16(0x001c), W16(0x0504), W16(0x4018),
- W16(0x0000), W16(0x0001), W16(0x001f), W16(0x0561), W16(0x40d6),
- W16(0x0000), W16(0x0000), W16(0x0022), W16(0x05be), W16(0x4172),
- W16(0x0000), W16(0x0000), W16(0x0027), W16(0x0619), W16(0x41eb),
- W16(0x0000), W16(0xffff), W16(0x002c), W16(0x0672), W16(0x4242),
- W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06c6), W16(0x427b),
- W16(0x0000), W16(0x0000), W16(0x002f), W16(0x0714), W16(0x4297),
- W16(0x0000), W16(0x0000), W16(0x0031), W16(0x075a), W16(0x429a),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0798), W16(0x4285),
- W16(0x0000), W16(0x0001), W16(0x0031), W16(0x07cb), W16(0x4255),
- W16(0x0000), W16(0xffff), W16(0x002c), W16(0x07f4), W16(0x4206),
- W16(0x0000), W16(0xfffe), W16(0x0025), W16(0x0811), W16(0x4193),
- W16(0x0000), W16(0xfffb), W16(0x001a), W16(0x0821), W16(0x40fa),
- W16(0x0000), W16(0xfff5), W16(0x000b), W16(0x0823), W16(0x404a),
- W16(0x0000), W16(0xfff0), W16(0xfff6), W16(0x081b), W16(0x3f2f),
- W16(0x0000), W16(0xffef), W16(0xffe9), W16(0x0809), W16(0x3daa),
- W16(0x0000), W16(0xfff5), W16(0xffe2), W16(0x07e4), W16(0x3c12),
- W16(0x0000), W16(0xfffa), W16(0xffe0), W16(0x07ac), W16(0x3a5c),
- W16(0x0000), W16(0xffff), W16(0xffe4), W16(0x0761), W16(0x388d),
- W16(0x0000), W16(0xfffd), W16(0xffed), W16(0x0701), W16(0x36ac),
- W16(0x0000), W16(0xfffe), W16(0xfff9), W16(0x068a), W16(0x34c0),
- W16(0x0000), W16(0xffff), W16(0x0006), W16(0x05fd), W16(0x32cd),
- W16(0x0000), W16(0x0000), W16(0x0013), W16(0x0559), W16(0x30d4),
- W16(0x0000), W16(0x0000), W16(0x001d), W16(0x049f), W16(0x2ed6),
- W16(0x0000), W16(0x0000), W16(0x0026), W16(0x03cf), W16(0x2cd0),
- W16(0x0000), W16(0x0000), W16(0x002c), W16(0x02e8), W16(0x2ac1),
- W16(0x0000), W16(0x0000), W16(0x002c), W16(0x01eb), W16(0x28aa),
- W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x00d7), W16(0x268d),
- W16(0x0000), W16(0xfffd), W16(0x0024), W16(0xffae), W16(0x246c),
- W16(0x0000), W16(0x000a), W16(0x0021), W16(0xfe6e), W16(0x2248),
- W16(0x0000), W16(0xfff3), W16(0x001a), W16(0xfd19), W16(0x2022),
- W16(0x0000), W16(0x0003), W16(0x0006), W16(0xfbad), W16(0x1df8),
- W16(0x0000), W16(0x0002), W16(0xfff5), W16(0xfa2d), W16(0x1bcb),
- W16(0x0000), W16(0xffff), W16(0xffe2), W16(0xf899), W16(0x199d),
- W16(0x0000), W16(0x0001), W16(0xffcf), W16(0xf6f2), W16(0x1770),
- W16(0x0000), W16(0x0001), W16(0xffbd), W16(0xf537), W16(0x1546),
- W16(0x0000), W16(0x0001), W16(0xffad), W16(0xf36b), W16(0x1320),
- W16(0x0000), W16(0x0000), W16(0xff9d), W16(0xf18e), W16(0x10fc),
- W16(0x0000), W16(0x0001), W16(0xff8e), W16(0xefa2), W16(0x0ed3),
- W16(0x0000), W16(0x0001), W16(0xff7f), W16(0xeda7), W16(0x0ca3),
- W16(0x0000), W16(0x0001), W16(0xff6f), W16(0xeb9e), W16(0x0a6c),
- W16(0x0000), W16(0xfffd), W16(0xff5e), W16(0xe989), W16(0x0837),
- W16(0x0000), W16(0x0003), W16(0xff4b), W16(0xe769), W16(0x0618),
- W16(0x0000), W16(0x0006), W16(0xff35), W16(0xe542), W16(0x042a),
- W16(0x0000), W16(0x0013), W16(0xff1e), W16(0xe314), W16(0x0284),
- W16(0x0000), W16(0x0020), W16(0xff06), W16(0xe0e2), W16(0x010c)
-};
-
-/*!
- * \brief CLDFB prototype filter
- *
- * cldfb bands: 40
- * delay[ms]: 1.00
- * abs. max Val: 1.04
- * scale: 0.50
- */
-const Word16 CLDFB80_40[] =//Q.5
-{
- W16(0x0000), W16(0xfffa), W16(0xffe2), W16(0x0112), W16(0x2117),
- W16(0x0000), W16(0xfffb), W16(0xffdc), W16(0x0128), W16(0x22d6),
- W16(0x0000), W16(0xfffc), W16(0xffe0), W16(0x013c), W16(0x2494),
- W16(0x0000), W16(0xfffe), W16(0xffe5), W16(0x0151), W16(0x2651),
- W16(0x0000), W16(0xffff), W16(0xffed), W16(0x0167), W16(0x280b),
- W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0180), W16(0x29c0),
- W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x019b), W16(0x2b6f),
- W16(0x0000), W16(0xffff), W16(0xfff8), W16(0x01b8), W16(0x2d18),
- W16(0x0000), W16(0xffff), W16(0xfffd), W16(0x01d8), W16(0x2eb8),
- W16(0x0000), W16(0xffff), W16(0x0002), W16(0x01fb), W16(0x304e),
- W16(0x0000), W16(0x0000), W16(0x0008), W16(0x0221), W16(0x31da),
- W16(0x0000), W16(0x0000), W16(0x000d), W16(0x0249), W16(0x335a),
- W16(0x0000), W16(0x0000), W16(0x0013), W16(0x0275), W16(0x34ce),
- W16(0x0000), W16(0x0000), W16(0x0017), W16(0x02a4), W16(0x3634),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02d6), W16(0x378b),
- W16(0x0000), W16(0x0000), W16(0x001d), W16(0x030c), W16(0x38d3),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0344), W16(0x3a08),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0380), W16(0x3b2b),
- W16(0x0000), W16(0x0000), W16(0x0017), W16(0x03bf), W16(0x3c3b),
- W16(0x0000), W16(0xffff), W16(0x0002), W16(0x03ff), W16(0x3d36),
- W16(0x0000), W16(0xffff), W16(0x001a), W16(0x0445), W16(0x3e1d),
- W16(0x0000), W16(0x0000), W16(0x001a), W16(0x048d), W16(0x3eef),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x04d6), W16(0x3fad),
- W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0520), W16(0x4055),
- W16(0x0000), W16(0x0001), W16(0x001f), W16(0x056a), W16(0x40e8),
- W16(0x0000), W16(0xffff), W16(0x0021), W16(0x05b5), W16(0x4164),
- W16(0x0000), W16(0x0000), W16(0x0026), W16(0x05fe), W16(0x41ca),
- W16(0x0000), W16(0x0000), W16(0x0029), W16(0x0646), W16(0x421b),
- W16(0x0000), W16(0xffff), W16(0x002d), W16(0x068c), W16(0x4256),
- W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ce), W16(0x427f),
- W16(0x0000), W16(0x0000), W16(0x002f), W16(0x070c), W16(0x4295),
- W16(0x0000), W16(0x0000), W16(0x0031), W16(0x0746), W16(0x429c),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x077a), W16(0x4293),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07a8), W16(0x427a),
- W16(0x0000), W16(0x0001), W16(0x0030), W16(0x07d0), W16(0x424f),
- W16(0x0000), W16(0xffff), W16(0x002d), W16(0x07f0), W16(0x4210),
- W16(0x0000), W16(0xffff), W16(0x0028), W16(0x080a), W16(0x41ba),
- W16(0x0000), W16(0xfffd), W16(0x001f), W16(0x081b), W16(0x414b),
- W16(0x0000), W16(0xfffa), W16(0x0018), W16(0x0824), W16(0x40c6),
- W16(0x0000), W16(0xfff4), W16(0x0009), W16(0x0822), W16(0x403a),
- W16(0xffff), W16(0xfff1), W16(0xfff9), W16(0x081c), W16(0x3f57),
- W16(0x0000), W16(0xffed), W16(0xffec), W16(0x0810), W16(0x3e1f),
- W16(0x0000), W16(0xfff3), W16(0xffe6), W16(0x07f9), W16(0x3ce2),
- W16(0x0000), W16(0xfff6), W16(0xffe1), W16(0x07d5), W16(0x3b92),
- W16(0x0000), W16(0xfffb), W16(0xffe0), W16(0x07a6), W16(0x3a2f),
- W16(0x0000), W16(0xffff), W16(0xffe3), W16(0x076a), W16(0x38bc),
- W16(0x0000), W16(0xfffd), W16(0xffea), W16(0x0720), W16(0x373e),
- W16(0x0000), W16(0xfffd), W16(0xfff3), W16(0x06c8), W16(0x35b7),
- W16(0x0000), W16(0xfffe), W16(0xfffd), W16(0x0662), W16(0x342a),
- W16(0x0000), W16(0xffff), W16(0x0008), W16(0x05ee), W16(0x329a),
- W16(0x0000), W16(0x0000), W16(0x0011), W16(0x056b), W16(0x3107),
- W16(0x0000), W16(0xffff), W16(0x001a), W16(0x04d9), W16(0x2f70),
- W16(0x0000), W16(0x0000), W16(0x0022), W16(0x043a), W16(0x2dd4),
- W16(0x0000), W16(0x0000), W16(0x0028), W16(0x038c), W16(0x2c33),
- W16(0x0000), W16(0x0000), W16(0x002c), W16(0x02cf), W16(0x2a8c),
- W16(0x0000), W16(0x0001), W16(0x002d), W16(0x0205), W16(0x28e0),
- W16(0x0000), W16(0xffff), W16(0x002b), W16(0x012c), W16(0x2730),
- W16(0x0000), W16(0xfffd), W16(0x0027), W16(0x0045), W16(0x257d),
- W16(0x0000), W16(0xffff), W16(0x0023), W16(0xff50), W16(0x23c8),
- W16(0x0000), W16(0x000a), W16(0x0021), W16(0xfe4d), W16(0x2211),
- W16(0x0000), W16(0xfff3), W16(0x001c), W16(0xfd3c), W16(0x2059),
- W16(0x0000), W16(0x0000), W16(0x000b), W16(0xfc1c), W16(0x1e9e),
- W16(0x0000), W16(0x0003), W16(0xfffd), W16(0xfaf0), W16(0x1ce2),
- W16(0x0000), W16(0x0001), W16(0xffef), W16(0xf9b6), W16(0x1b24),
- W16(0x0000), W16(0xfffe), W16(0xffe0), W16(0xf870), W16(0x1965),
- W16(0x0000), W16(0x0001), W16(0xffd1), W16(0xf71d), W16(0x17a7),
- W16(0x0000), W16(0x0000), W16(0xffc3), W16(0xf5be), W16(0x15ec),
- W16(0x0000), W16(0x0001), W16(0xffb5), W16(0xf453), W16(0x1433),
- W16(0x0000), W16(0x0001), W16(0xffa8), W16(0xf2de), W16(0x127c),
- W16(0x0000), W16(0x0000), W16(0xff9b), W16(0xf15e), W16(0x10c5),
- W16(0x0000), W16(0x0001), W16(0xff8f), W16(0xefd4), W16(0x0f0b),
- W16(0x0000), W16(0x0001), W16(0xff83), W16(0xee40), W16(0x0d4c),
- W16(0x0000), W16(0x0001), W16(0xff77), W16(0xeca4), W16(0x0b88),
- W16(0x0000), W16(0x0001), W16(0xff6a), W16(0xeaff), W16(0x09c2),
- W16(0x0000), W16(0xfffd), W16(0xff5d), W16(0xe953), W16(0x0800),
- W16(0x0000), W16(0x0002), W16(0xff4d), W16(0xe7a0), W16(0x064d),
- W16(0x0000), W16(0x0006), W16(0xff3c), W16(0xe5e8), W16(0x04b8),
- W16(0x0000), W16(0x0009), W16(0xff2a), W16(0xe42c), W16(0x034d),
- W16(0x0000), W16(0x0018), W16(0xff17), W16(0xe26c), W16(0x0212),
- W16(0x0001), W16(0x0020), W16(0xff03), W16(0xe0aa), W16(0x00e3)
-};
-
-/*!
- * \brief CLDFB prototype filter
- *
- * cldfb bands: 60
- * delay[ms]: 1.00
- * abs. max Val: 1.04
- * scale: 0.50
- */
-const Word16 CLDFB80_60[] =//Q.5
-{
- W16(0x0000), W16(0xfffa), W16(0xffe2), W16(0x010f), W16(0x20cd),
- W16(0x0000), W16(0xfffb), W16(0xffdf), W16(0x011e), W16(0x21f7),
- W16(0x0000), W16(0xfffb), W16(0xffdd), W16(0x012b), W16(0x2320),
- W16(0x0000), W16(0xfffd), W16(0xffe0), W16(0x0138), W16(0x244a),
- W16(0x0000), W16(0xfffd), W16(0xffe1), W16(0x0146), W16(0x2573),
- W16(0x0000), W16(0xfffe), W16(0xffe6), W16(0x0155), W16(0x269b),
- W16(0x0000), W16(0xfffe), W16(0xffec), W16(0x0164), W16(0x27c1),
- W16(0x0000), W16(0xffff), W16(0xfff2), W16(0x0173), W16(0x28e6),
- W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0184), W16(0x2a08),
- W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0196), W16(0x2b28),
- W16(0x0000), W16(0xffff), W16(0xfff6), W16(0x01a9), W16(0x2c45),
- W16(0x0000), W16(0xffff), W16(0xfff9), W16(0x01bd), W16(0x2d5e),
- W16(0x0000), W16(0xffff), W16(0xfffc), W16(0x01d2), W16(0x2e73),
- W16(0x0000), W16(0xffff), W16(0xffff), W16(0x01e9), W16(0x2f84),
- W16(0x0000), W16(0x0000), W16(0x0003), W16(0x0201), W16(0x3091),
- W16(0x0000), W16(0x0000), W16(0x0008), W16(0x021a), W16(0x3199),
- W16(0x0000), W16(0x0000), W16(0x000a), W16(0x0235), W16(0x329c),
- W16(0x0000), W16(0x0000), W16(0x000e), W16(0x0251), W16(0x3399),
- W16(0x0000), W16(0x0000), W16(0x0012), W16(0x026e), W16(0x3491),
- W16(0x0000), W16(0x0000), W16(0x0014), W16(0x028c), W16(0x3583),
- W16(0x0000), W16(0x0000), W16(0x0018), W16(0x02ac), W16(0x366f),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02ce), W16(0x3753),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02f1), W16(0x3831),
- W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0315), W16(0x3907),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x033b), W16(0x39d6),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0362), W16(0x3a9c),
- W16(0x0000), W16(0x0000), W16(0x001d), W16(0x038a), W16(0x3b5a),
- W16(0x0000), W16(0x0000), W16(0x0019), W16(0x03b4), W16(0x3c0f),
- W16(0x0000), W16(0x0001), W16(0x000d), W16(0x03df), W16(0x3cbb),
- W16(0x0000), W16(0xffff), W16(0x0001), W16(0x040a), W16(0x3d5e),
- W16(0x0000), W16(0xfffe), W16(0x0017), W16(0x0439), W16(0x3df8),
- W16(0x0000), W16(0x0000), W16(0x001b), W16(0x0469), W16(0x3e89),
- W16(0x0000), W16(0x0000), W16(0x001a), W16(0x0499), W16(0x3f10),
- W16(0x0000), W16(0x0000), W16(0x001a), W16(0x04c9), W16(0x3f8f),
- W16(0x0000), W16(0x0000), W16(0x001c), W16(0x04fb), W16(0x4004),
- W16(0x0000), W16(0x0000), W16(0x001e), W16(0x052c), W16(0x406f),
- W16(0x0000), W16(0x0001), W16(0x001f), W16(0x055e), W16(0x40d1),
- W16(0x0000), W16(0x0000), W16(0x0020), W16(0x0590), W16(0x4129),
- W16(0x0000), W16(0x0000), W16(0x0022), W16(0x05c1), W16(0x4177),
- W16(0x0000), W16(0x0000), W16(0x0025), W16(0x05f2), W16(0x41bb),
- W16(0x0000), W16(0x0000), W16(0x0027), W16(0x0622), W16(0x41f5),
- W16(0x0000), W16(0xffff), W16(0x002a), W16(0x0652), W16(0x4226),
- W16(0x0000), W16(0xffff), W16(0x002c), W16(0x0680), W16(0x424e),
- W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ad), W16(0x426d),
- W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06d9), W16(0x4284),
- W16(0x0000), W16(0x0000), W16(0x002f), W16(0x0702), W16(0x4293),
- W16(0x0000), W16(0x0000), W16(0x0030), W16(0x072a), W16(0x429b),
- W16(0x0000), W16(0x0000), W16(0x0031), W16(0x074f), W16(0x429b),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0772), W16(0x4295),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0792), W16(0x4288),
- W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07af), W16(0x4274),
- W16(0x0000), W16(0x0001), W16(0x0031), W16(0x07ca), W16(0x4257),
- W16(0x0000), W16(0x0001), W16(0x002e), W16(0x07e1), W16(0x4232),
- W16(0x0000), W16(0xffff), W16(0x002c), W16(0x07f5), W16(0x4203),
- W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x0806), W16(0x41ca),
- W16(0x0000), W16(0xfffe), W16(0x0024), W16(0x0813), W16(0x4186),
- W16(0x0000), W16(0xfffd), W16(0x001e), W16(0x081d), W16(0x4137),
- W16(0x0000), W16(0xfffa), W16(0x0019), W16(0x0823), W16(0x40de),
- W16(0x0000), W16(0xfff8), W16(0x0011), W16(0x0825), W16(0x407d),
- W16(0xffff), W16(0xfff3), W16(0x0006), W16(0x0821), W16(0x4023),
- W16(0xffff), W16(0xfff2), W16(0xfffb), W16(0x081d), W16(0x3f8c),
- W16(0x0000), W16(0xffed), W16(0xfff1), W16(0x0818), W16(0x3eb8),
- W16(0x0000), W16(0xffee), W16(0xffeb), W16(0x080d), W16(0x3deb),
- W16(0x0000), W16(0xfff2), W16(0xffe7), W16(0x07fd), W16(0x3d18),
- W16(0x0000), W16(0xfff5), W16(0xffe3), W16(0x07e8), W16(0x3c3c),
- W16(0x0000), W16(0xfff7), W16(0xffe0), W16(0x07ce), W16(0x3b58),
- W16(0x0000), W16(0xfffa), W16(0xffe0), W16(0x07ae), W16(0x3a6b),
- W16(0x0000), W16(0xfffe), W16(0xffe1), W16(0x0789), W16(0x3977),
- W16(0x0000), W16(0xffff), W16(0xffe4), W16(0x075e), W16(0x387d),
- W16(0x0000), W16(0xfffd), W16(0xffe8), W16(0x072d), W16(0x377e),
- W16(0x0000), W16(0xfffd), W16(0xffee), W16(0x06f6), W16(0x367b),
- W16(0x0000), W16(0xfffe), W16(0xfff4), W16(0x06b8), W16(0x3575),
- W16(0x0000), W16(0xfffe), W16(0xfffb), W16(0x0674), W16(0x346d),
- W16(0x0000), W16(0xfffe), W16(0x0002), W16(0x062a), W16(0x3363),
- W16(0x0000), W16(0xffff), W16(0x000a), W16(0x05d9), W16(0x3257),
- W16(0x0000), W16(0x0000), W16(0x0010), W16(0x0582), W16(0x314b),
- W16(0x0000), W16(0xffff), W16(0x0016), W16(0x0524), W16(0x303c),
- W16(0x0000), W16(0xffff), W16(0x001b), W16(0x04c0), W16(0x2f2c),
- W16(0x0000), W16(0x0000), W16(0x0021), W16(0x0455), W16(0x2e19),
- W16(0x0000), W16(0x0000), W16(0x0026), W16(0x03e4), W16(0x2d04),
- W16(0x0000), W16(0x0000), W16(0x0029), W16(0x036d), W16(0x2bed),
- W16(0x0000), W16(0x0000), W16(0x002c), W16(0x02f0), W16(0x2ad3),
- W16(0x0000), W16(0x0000), W16(0x002d), W16(0x026c), W16(0x29b7),
- W16(0x0000), W16(0x0000), W16(0x002c), W16(0x01e2), W16(0x2898),
- W16(0x0000), W16(0xffff), W16(0x002b), W16(0x0151), W16(0x2778),
- W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x00bb), W16(0x2657),
- W16(0x0000), W16(0xfffd), W16(0x0026), W16(0x001d), W16(0x2534),
- W16(0x0000), W16(0xfffe), W16(0x0024), W16(0xff7a), W16(0x2411),
- W16(0x0000), W16(0x0005), W16(0x0021), W16(0xfed0), W16(0x22ed),
- W16(0x0000), W16(0x0009), W16(0x0021), W16(0xfe21), W16(0x21c8),
- W16(0x0000), W16(0xfff5), W16(0x001f), W16(0xfd6b), W16(0x20a2),
- W16(0x0000), W16(0xfff8), W16(0x0014), W16(0xfcae), W16(0x1f7c),
- W16(0x0000), W16(0x0001), W16(0x0009), W16(0xfbeb), W16(0x1e54),
- W16(0x0000), W16(0x0003), W16(0x0000), W16(0xfb23), W16(0x1d2c),
- W16(0x0000), W16(0x0002), W16(0xfff7), W16(0xfa55), W16(0x1c03),
- W16(0x0000), W16(0x0001), W16(0xffed), W16(0xf981), W16(0x1ad9),
- W16(0x0000), W16(0xffff), W16(0xffe3), W16(0xf8a7), W16(0x19b0),
- W16(0x0000), W16(0x0000), W16(0xffd8), W16(0xf7c8), W16(0x1886),
- W16(0x0000), W16(0x0001), W16(0xffcf), W16(0xf6e3), W16(0x175d),
- W16(0x0000), W16(0x0000), W16(0xffc5), W16(0xf5f9), W16(0x1636),
- W16(0x0000), W16(0x0001), W16(0xffbc), W16(0xf50a), W16(0x150f),
- W16(0x0000), W16(0x0001), W16(0xffb3), W16(0xf416), W16(0x13e9),
- W16(0x0000), W16(0x0001), W16(0xffaa), W16(0xf31d), W16(0x12c5),
- W16(0x0000), W16(0x0001), W16(0xffa2), W16(0xf21f), W16(0x11a0),
- W16(0x0000), W16(0x0000), W16(0xff99), W16(0xf11d), W16(0x107b),
- W16(0x0000), W16(0x0000), W16(0xff91), W16(0xf016), W16(0x0f55),
- W16(0x0000), W16(0x0001), W16(0xff89), W16(0xef0b), W16(0x0e2c),
- W16(0x0000), W16(0x0001), W16(0xff81), W16(0xedfc), W16(0x0d01),
- W16(0x0000), W16(0x0001), W16(0xff79), W16(0xece9), W16(0x0bd4),
- W16(0x0000), W16(0x0001), W16(0xff71), W16(0xebd2), W16(0x0aa5),
- W16(0x0000), W16(0x0001), W16(0xff68), W16(0xeab8), W16(0x0976),
- W16(0x0000), W16(0xfffd), W16(0xff5f), W16(0xe99b), W16(0x084a),
- W16(0x0000), W16(0xfffe), W16(0xff55), W16(0xe87a), W16(0x0724),
- W16(0x0000), W16(0x0003), W16(0xff4a), W16(0xe757), W16(0x0607),
- W16(0x0000), W16(0x0006), W16(0xff3f), W16(0xe632), W16(0x04f9),
- W16(0x0000), W16(0x0006), W16(0xff33), W16(0xe50a), W16(0x03fd),
- W16(0x0000), W16(0x000c), W16(0xff27), W16(0xe3e1), W16(0x0315),
- W16(0x0000), W16(0x0016), W16(0xff1a), W16(0xe2b7), W16(0x0244),
- W16(0x0000), W16(0x001e), W16(0xff0d), W16(0xe18b), W16(0x017f),
- W16(0x0002), W16(0x0020), W16(0xff00), W16(0xe05e), W16(0x00a9)
-};
-
-const Word16 CLDFB80_30[] =//Q.5
-{
- 0, -5, -30, 278, 8546,
- 0, -4, -33, 306, 9141,
- 0, -2, -29, 334, 9735,
- 0, -1, -17, 363, 10324,
- 0, -1, -13, 397, 10904,
- 0, -1, -9, 435, 11474,
- 0, -1, -2, 478, 12028,
- 0, 0, 6, 525, 12566,
- 0, 0, 12, 578, 13083,
- 0, 0, 19, 637, 13579,
- 0, 0, 26, 701, 14050,
- 0, 0, 28, 771, 14493,
- 0, 0, 30, 846, 14906,
- 0, 0, 28, 927, 15285,
- 0, 0, 4, 1012, 15630,
- 0, -1, 27, 1105, 15937,
- 0, -1, 26, 1201, 16209,
- 0, 0, 29, 1299, 16442,
- 0, 1, 31, 1399, 16638,
- 0, 0, 36, 1498, 16794,
- 0, 0, 41, 1594, 16911,
- 0, -1, 45, 1687, 16990,
- 0, 0, 46, 1774, 17036,
- 0, 0, 49, 1853, 17052,
- 0, 0, 50, 1922, 17040,
- 0, 0, 50, 1981, 16999,
- 0, 0, 45, 2027, 16924,
- 0, -1, 39, 2061, 16809,
- 0, -4, 27, 2080, 16651,
- 0, -10, 12, 2084, 16463,
- 0, -17, -10, 2075, 16161,
- 0, -16, -23, 2054, 15746,
- 0, -10, -31, 2012, 15307,
- 0, -4, -32, 1949, 14834,
- 0, -2, -26, 1862, 14334,
- 0, -3, -15, 1752, 13816,
- 0, -2, -1, 1616, 13288,
- 0, 0, 13, 1454, 12753,
- 0, -1, 25, 1267, 12212,
- 0, 0, 35, 1054, 11663,
- 0, 0, 42, 815, 11104,
- 0, 1, 45, 552, 10536,
- 0, -2, 42, 263, 9960,
- 0, -3, 37, -51, 9379,
- 0, 9, 33, -391, 8795,
- 0, -12, 25, -755, 8207,
- 0, 3, 4, -1144, 7616,
- 0, 2, -14, -1557, 7022,
- 0, -2, -34, -1992, 6427,
- 0, 0, -54, -2449, 5833,
- 0, 1, -73, -2927, 5244,
- 0, 1, -90, -3425, 4659,
- 0, 0, -107, -3942, 4072,
- 0, 1, -123, -4476, 3479,
- 0, 1, -139, -5026, 2877,
- 0, -1, -156, -5590, 2272,
- 0, 0, -176, -6167, 1684,
- 0, 6, -199, -6754, 1144,
- 0, 18, -223, -7348, 682,
- 0, 32, -249, -7947, 282
-};
-
-/*!
- * \brief CLDFB rRotVectr
- *
- * cldfb bands: 10
- * global gain: 8.00
- * scale: sqrt(1.0/16.00)
- */
-const Word16 rRotVectr_10[] =//Q(sqrt(1.0/16.00))
-{
- W16(0x5a71), W16(0x54ea), W16(0x4714), W16(0x3249), W16(0x1891)
-};
-
-/*!
- * \brief CLDFB iRotVectr
- *
- * cldfb bands: 10
- * global gain: 8.00
- * scale: sqrt(1.0/16.00)
- */
-const Word16 iRotVectr_10[] =//Q(sqrt(1.0/16.00))
-{
- W16(0xfc72), W16(0xe0ac), W16(0xc7f7), W16(0xb4be), W16(0xa8e3)
-};
-
-/*!
- * \brief CLDFB rRotVectr
- *
- * cldfb bands: 16
- * global gain: 5.00
- * scale: sqrt(1.0/8.00)
- */
-const Word16 rRotVectr_16[] =//Q(sqrt(1.0/8.00))
-{
- W16(0x652a), W16(0x62bc), W16(0x5c83), W16(0x52bc), W16(0x45c7),
- W16(0x3623), W16(0x246b), W16(0x114d)
-};
-
-/*!
- * \brief CLDFB iRotVectr
- *
- * cldfb bands: 16
- * global gain: 5.00
- * scale: sqrt(1.0/8.00)
- */
-const Word16 iRotVectr_16[] =//Q(sqrt(1.0/8.00))
-{
- W16(0xfd84), W16(0xe9d4), W16(0xd6fe), W16(0xc5bb), W16(0xb6b6),
- W16(0xaa82), W16(0xa196), W16(0x9c4c)
-};
-
-/*!
- * \brief CLDFB rRotVectr
- *
- * cldfb bands: 20
- * global gain: 4.00
- * scale: sqrt(1.0/8.00)
- */
-const Word16 rRotVectr_20[] =//Q(sqrt(1.0/8.00))
-{
- W16(0x5a7e), W16(0x591a), W16(0x5584), W16(0x4fd3), W16(0x482a),
- W16(0x3ebb), W16(0x33c1), W16(0x2780), W16(0x1a46), W16(0x0c67)
-};
-
-/*!
- * \brief CLDFB iRotVectr
- *
- * cldfb bands: 20
- * global gain: 4.00
- * scale: sqrt(1.0/8.00)
- */
-const Word16 iRotVectr_20[] =//Q(sqrt(1.0/8.00)
-{
- W16(0xfe39), W16(0xf017), W16(0xe259), W16(0xd556), W16(0xc95f),
- W16(0xbec1), W16(0xb5bf), W16(0xae90), W16(0xa963), W16(0xa658)
-};
-
-/*!
- * \brief CLDFB rRotVectr
- *
- * cldfb bands: 30
- * global gain: 2.50
- * scale: sqrt(1.0/4.00)
- */
-const Word16 rRotVectr_30[] =//Q(sqrt(1.0/4.00))
-{
- 25902, 25725, 25265, 24529, 23525, 22262, 20756, 19022, 17080, 14950, 12657, 10226, 7682, 5054, 2370
-};
-
-/*!
- * \brief CLDFB iRotVectr
- *
- * cldfb bands: 30
- * global gain: 2.50
- * scale: sqrt(1.0/4.00)
- */
-const Word16 iRotVectr_30[] =//Q(sqrt(1.0/4.00))
-{
- -339, -3045, -5717, -8327, -10845, -13245, -15499, -17584, -19476, -21154, -22601, -23801, -24739, -25406, -25796
-};
-/*!
- * \brief CLDFB rRotVectr
- *
- * cldfb bands: 32
- * global gain: 2.50
- * scale: sqrt(1.0/4.00)
- */
-const Word16 rRotVectr_32[] =//Q(sqrt(1.0/4.00))
-{
- W16(0x652f), W16(0x6494), W16(0x6300), W16(0x6078), W16(0x5d02),
- W16(0x58a7), W16(0x5371), W16(0x4d6e), W16(0x46ac), W16(0x3f3b),
- W16(0x372f), W16(0x2e9a), W16(0x2593), W16(0x1c2f), W16(0x1286),
- W16(0x08af)
-};
-
-/*!
- * \brief CLDFB iRotVectr
- *
- * cldfb bands: 32
- * global gain: 2.50
- * scale: sqrt(1.0/4.00)
- */
-const Word16 iRotVectr_32[] =//Q(sqrt(1.0/4.00))
-{
- W16(0xfec2), W16(0xf4d9), W16(0xeb0b), W16(0xe170), W16(0xd821),
- W16(0xcf35), W16(0xc6c1), W16(0xbed9), W16(0xb793), W16(0xb0ff),
- W16(0xab2d), W16(0xa62d), W16(0xa20b), W16(0x9ed0), W16(0x9c84),
- W16(0x9b2e)
-};
-
-/*!
- * \brief CLDFB rRotVectr
- *
- * cldfb bands: 40
- * global gain: 2.00
- * scale: sqrt(1.0/4.00)
- */
-const Word16 rRotVectr_40[] =//Q(sqrt(1.0/4.00))
-{
- W16(0x5a81), W16(0x5a28), W16(0x5941), W16(0x57cc), W16(0x55cd),
- W16(0x5347), W16(0x503d), W16(0x4cb4), W16(0x48b3), W16(0x443e),
- W16(0x3f5e), W16(0x3a1a), W16(0x347b), W16(0x2e88), W16(0x284c),
- W16(0x21d0), W16(0x1b1f), W16(0x1444), W16(0x0d48), W16(0x0637)
-};
-
-/*!
- * \brief CLDFB iRotVectr
- *
- * cldfb bands: 40
- * global gain: 2.00
- * scale: sqrt(1.0/4.00)
- */
-const Word16 iRotVectr_40[] =//Q(sqrt(1.0/4.00))
-{
- W16(0xff1d), W16(0xf803), W16(0xf0f7), W16(0xea02), W16(0xe330),
- W16(0xdc8b), W16(0xd61f), W16(0xcff4), W16(0xca15), W16(0xc48c),
- W16(0xbf60), W16(0xba9a), W16(0xb642), W16(0xb25e), W16(0xaef5),
- W16(0xac0b), W16(0xa9a6), W16(0xa7ca), W16(0xa678), W16(0xa5b4)
-};
-
-/*!
- * \brief CLDFB rRotVectr
- *
- * cldfb bands: 60
- * global gain: 1.33
- * scale: sqrt(1.0/2.00)
- */
-const Word16 rRotVectr_60[] =//Q(sqrt(1.0/2.00))
-{
- W16(0x6882), W16(0x6855), W16(0x67de), W16(0x671e), W16(0x6615),
- W16(0x64c5), W16(0x632f), W16(0x6153), W16(0x5f32), W16(0x5ccf),
- W16(0x5a2a), W16(0x5747), W16(0x5426), W16(0x50ca), W16(0x4d35),
- W16(0x496a), W16(0x456c), W16(0x413d), W16(0x3ce0), W16(0x3859),
- W16(0x33aa), W16(0x2ed6), W16(0x29e2), W16(0x24d0), W16(0x1fa5),
- W16(0x1a63), W16(0x150f), W16(0x0fac), W16(0x0a3e), W16(0x04c9)
-};
-
-/*!
- * \brief CLDFB iRotVectr
- *
- * cldfb bands: 60
- * global gain: 1.33
- * scale: sqrt(1.0/2.00)
- */
-const Word16 iRotVectr_60[] =//Q(sqrt(1.0/2.00))
-{
- W16(0xff51), W16(0xf9d9), W16(0xf465), W16(0xeefa), W16(0xe99a),
- W16(0xe44a), W16(0xdf0e), W16(0xd9e9), W16(0xd4de), W16(0xcff2),
- W16(0xcb27), W16(0xc682), W16(0xc204), W16(0xbdb3), W16(0xb990),
- W16(0xb59e), W16(0xb1e0), W16(0xae5a), W16(0xab0c), W16(0xa7fb),
- W16(0xa526), W16(0xa292), W16(0xa03f), W16(0x9e30), W16(0x9c65),
- W16(0x9ae0), W16(0x99a2), W16(0x98ac), W16(0x97fe), W16(0x9799)
-};
-
-const Word16 cldfb_anaScale[] = // Q0
-{
- SCALE_CLDFB_ANA_10, SCALE_CLDFB_ANA_16, SCALE_CLDFB_ANA_20, SCALE_CLDFB_ANA_32, SCALE_CLDFB_ANA_40, SCALE_CLDFB_ANA_60, SCALE_CLDFB_ANA_30
-};
-const Word16 cldfb_synScale[] = // Q0
-{
- SCALE_CLDFB_SYN_10, SCALE_CLDFB_SYN_16, SCALE_CLDFB_SYN_20, SCALE_CLDFB_SYN_32, SCALE_CLDFB_SYN_40, SCALE_CLDFB_SYN_60, SCALE_CLDFB_SYN_30
-};
-const Word16 cldfb_synGain[] =//Q0
-{
- 0x6666, /* 10 bands */
- 0x51EC, /* 16 bands */
- 0x6666, /* 20 bands */
- 0x51EC, /* 32 bands */
- 0x6666, /* 40 bands */
- 0x4CCD /* 60 bands */
-};
-
-const Word16 *cldfb_protoFilter_2_5ms[] =
-{
- CLDFB80_10, CLDFB80_16, CLDFB80_20, CLDFB80_32, CLDFB80_40, CLDFB80_60, CLDFB80_30
-};
-
-const Word16 cldfb_scale_2_5ms[7] =
-{
- 22603/*88.293854 Q8*/, /* 10 bands */
- 22605/*88.299622 Q8*/, /* 16 bands */
- 22605/*88.300926 Q8*/, /* 20 bands */
- 22606/*88.303848 Q8*/, /* 32 bands */
- 22606/*88.304718 Q8*/, /* 40 bands */
- 22535/*88.028412 Q8*/, /* 60 bands */
- 22588/*88.234489 Q8*/ /* 30 bands */
-};
-
-const Word16 cldfb_scale_5_0ms[7] =
-{
- 21649/*88.293854 Q8*/, /* 10 bands */
- 21649/*88.299622 Q8*/, /* 16 bands */
- 21649/*88.300926 Q8*/, /* 20 bands */
- 21649/*88.303848 Q8*/, /* 32 bands */
- 21649/*88.304718 Q8*/, /* 40 bands */
- 22535/*88.028412 Q8*/, /* 60 bands */
- 21581/*88.028412 Q8*/ /* 30 bands */
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_re_L10_fx[5] =
-{
- 239910864 ,225255952 ,188551424 ,133390176 ,65171760 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_im_L10_fx[5] =
-{
- -9426123 ,-83101312 ,-148641968 ,-199632496 ,-231081632 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_re_L16_fx[8] =
-{
- 240023664 ,234262144 ,219498080 ,196298816 ,165555904 ,128450776 ,86409352 ,41047260 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_im_L16_fx[8] =
-{
- -5892250 ,-52605324 ,-97296808 ,-138249232 ,-173888800 ,-202845936 ,-224007808 ,-236561200 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_re_L20_fx[10] =
-{
- 240049696 ,236356848 ,226844128 ,211745744 ,191433472 ,166407488 ,137283984 ,104780104 ,69696184 ,32896112 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_im_L20_fx[10] =
-{
- -4713971 ,-42207980 ,-78662688 ,-113180456 ,-144911344 ,-173074048 ,-196975088 ,-216025936 ,-229757520 ,-237831712 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_re_L30_fx[15] =
-{
- 240075408 ,238431728 ,234175760 ,227354112 ,218041520 ,206340016 ,192377808 ,176307872 ,
- 158306272 ,138570240 ,117315992 ,94776408 ,71198440 ,46840400 ,21969170 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_im_L30_fx[15] =
-{
- -3142759 ,-28220256 ,-52988564 ,-77176320 ,-100518520 ,-122759408 ,-143655328 ,-162977328 ,
- -180513712 ,-196072352 ,-209482768 ,-220598064 ,-229296448 ,-235482592 ,-239088752 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_re_L32_fx[16] =
-{
- 240077888 ,238633056 ,234890064 ,228884944 ,220675536 ,210340896 ,197980576 ,183713584 ,
- 167677328 ,150026240 ,130930336 ,110573488 ,89151760 ,66871456 ,43947140 ,20599588 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_im_L32_fx[16] =
-{
- -2946347 ,-26463908 ,-49726608 ,-72510408 ,-94595904 ,-115770384 ,-135829936 ,-154581360 ,
- -171844080 ,-187451856 ,-201254368 ,-213118704 ,-222930576 ,-230595504 ,-236039664 ,-239210640 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_re_L40_fx[20] =
-{
- 240084400 ,239159360 ,236759824 ,232900592 ,227605456 ,220907040 ,212846672 ,203474016 ,
- 192846896 ,181030800 ,168098592 ,154130000 ,139211136 ,123434000 ,106895848 ,89698648 ,
- 71948424 ,53754620 ,35229396 ,16486972 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_im_L40_fx[20] =
-{
- -2357099 ,-21186638 ,-39885552 ,-58338564 ,-76431896 ,-94054000 ,-111096224 ,-127453512 ,
- -143025008 ,-157714704 ,-171432032 ,-184092416 ,-195617824 ,-205937184 ,-214986864 ,-222711088 ,
- -229062224 ,-234001104 ,-237497296 ,-239529232 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_re_L60_fx[30] =
-{
- 240090832 ,239679552 ,238611328 ,236889088 ,234517552 ,231503216 ,227854352 ,223580960 ,218694736 ,
- 213209088 ,207139056 ,200501264 ,193313904 ,185596688 ,177370784 ,168658704 ,159484336 ,149872832 ,
- 139850544 ,129444936 ,118684528 ,107598816 ,96218184 ,84573816 ,72697640 ,60622212 ,48380616 ,
- 36006412 ,23533520 ,10996123 ,
-};
-
-
-/*Q31*/
-const Word32 rot_vec_syn_im_L60_fx[30] =
-{
- -1571413 ,-14134643 ,-26659130 ,-39110548 ,-51454764 ,-63657948 ,-75686648 ,-87507896 ,-99089296 ,
- -110399096 ,-121406296 ,-132080736 ,-142393152 ,-152315264 ,-161819904 ,-170881008 ,-179473744 ,
- -187574544 ,-195161216 ,-202212960 ,-208710464 ,-214635904 ,-219973040 ,-224707248 ,-228825536 ,
- -232316640 ,-235170976 ,-237380736 ,-238939840 ,-239844032 ,
-};
-
-
-const Word16 bpf_weights_16_Fx[16] =
-{
- 16385/*0.500020f Q15*/, 23022/*0.702561f Q15*/, 6843/*0.208838f Q15*/, 51/*0.001553f Q15*/,
- 58/*0.001777f Q15*/, 45/*0.001370f Q15*/, 30/*0.000926f Q15*/, 18/*0.000554f Q15*/,
- 9/*0.000270f Q15*/, 3/*0.000080f Q15*/, 1/*0.000030f Q15*/, 3/*0.000082f Q15*/,
- 3/*0.000081f Q15*/, 2/*0.000052f Q15*/, 1/*0.000017f Q15*/, 1/*0.000016f Q15*/
-};
-
-const Word16 bpf_weights_16_ivas_fx[16] =
-{
- 32767/*0.999969f Q15*/, 23022/*0.702561f Q15*/, 6843/*0.208838f Q15*/, 51/*0.001553f Q15*/,
- 58/*0.001777f Q15*/, 45/*0.001370f Q15*/, 30/*0.000926f Q15*/, 18/*0.000554f Q15*/,
- 9/*0.000270f Q15*/, 3/*0.000080f Q15*/, 1/*0.000030f Q15*/, 3/*0.000082f Q15*/,
- 3/*0.000081f Q15*/, 2/*0.000052f Q15*/, 1/*0.000017f Q15*/, 1/*0.000016f Q15*/
-};
-const Word32 bpf_weights_16_ivas_fx_32[16] =
-{
- 1073784774/*1.000040f Q30*/, 754369130/*0.702561f Q30*/, 224238095/*0.208838f Q30*/, 1667521/*0.001553f Q30*/,
- 1908039/*0.001777f Q30*/, 1435593/*0.001370f Q30*/, 994285/*0.000926f Q30*/, 594853/*0.000554f Q30*/,
- 289910/*0.000270f Q30*/, 85899/*0.000080f Q30*/, 32212/*0.000030f Q30*/, 88047/*0.000082f Q30*/,
- 86973/*0.000081f Q30*/, 55835/*0.000052f Q30*/, 18254/*0.000017f Q30*/, 17179/*0.000016f Q30*/
-};
-
-
-/*-------------------------------------------------------------------*
- * LP CNG excitation details code book
- *-------------------------------------------------------------------*/
-
-const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG] = /* Q6 */
-{
- {443,547,613,547,510,471,540,479,586,535,565,611,532,500,462,551,498,463,446,484},
- {600,499,472,537,633,654,641,646,674,677,687,693,693,690,688,700,693,696,640,571},
- {529,537,501,582,537,474,505,491,521,545,561,591,566,609,570,608,636,655,649,524},
- {648,690,689,684,693,599,668,714,663,675,524,519,726,658,673,696,654,715,708,668},
- {623,630,660,656,686,688,637,666,630,555,470,468,464,445,502,583,615,545,605,592},
- {659,668,669,625,662,700,700,693,702,702,688,677,654,584,525,492,446,477,634,615},
- {634,648,656,552,520,557,662,659,572,617,691,683,684,666,673,695,682,698,680,623},
- {756,743,734,709,730,757,746,722,484,552,779,688,686,610,616,749,758,694,745,729},
- {549,568,556,625,683,619,609,667,663,684,709,649,691,668,594,511,525,617,542,684},
- {550,467,533,760,739,692,773,756,743,770,765,791,779,784,775,792,759,577,642,553},
- {658,674,656,651,670,582,593,520,467,470,522,589,600,596,587,631,652,679,645,669},
- {788,765,787,797,785,799,787,786,780,692,641,550,501,513,726,747,670,687,734,773},
- {641,654,668,673,665,682,689,684,697,665,664,593,544,494,458,537,622,650,635,635},
- {706,753,762,716,748,762,788,792,785,788,799,777,782,766,760,710,704,503,519,735},
- {748,775,784,635,717,504,539,640,764,778,681,721,791,786,787,780,780,770,774,781},
- {752,516,624,780,713,753,569,548,770,784,749,740,690,755,776,748,744,730,767,698},
- {453,471,516,517,561,653,659,616,629,608,682,698,679,681,645,587,594,522,499,469},
- {617,534,506,615,782,792,754,771,740,787,791,776,782,787,793,788,775,778,651,736},
- {661,593,490,495,491,495,554,656,658,611,628,660,680,677,698,678,673,699,687,679},
- {798,793,786,795,799,772,771,696,624,557,507,545,724,757,747,770,780,785,793,784},
- {703,695,703,714,697,701,697,631,598,498,475,451,503,611,648,664,664,683,679,688},
- {744,672,659,762,785,745,757,761,761,767,722,757,761,737,699,471,582,770,724,756},
- {775,746,535,680,541,513,697,723,743,744,769,741,741,738,769,772,779,743,714,724},
- {767,771,697,756,766,752,710,477,602,783,746,766,692,708,783,782,761,778,787,785},
- {483,588,700,665,665,640,650,717,699,707,692,698,700,692,668,650,609,610,540,484},
- {507,618,788,766,754,692,709,785,788,770,793,785,799,784,767,776,789,759,761,495},
- {709,712,706,678,661,604,503,480,653,664,664,639,621,675,695,689,704,681,711,709},
- {788,740,770,768,771,776,732,749,739,764,714,492,544,783,714,708,717,559,739,768},
- {758,771,789,779,777,799,791,785,779,779,752,675,718,510,501,600,727,750,752,758},
- {759,765,676,658,774,767,737,749,769,784,778,738,755,769,788,756,473,530,777,725},
- {669,665,721,653,499,774,780,781,767,561,690,747,722,779,757,727,764,745,770,736},
- {731,768,745,775,783,782,715,741,786,673,766,777,764,730,773,769,774,781,778,764},
- {557,505,545,604,660,672,604,596,580,612,587,556,546,597,530,494,437,480,546,555},
- {560,588,510,495,606,720,718,742,756,755,767,774,776,778,772,772,776,776,754,592},
- {680,644,620,612,516,477,471,499,502,598,664,588,656,682,689,671,668,672,682,692},
- {757,778,781,799,775,750,799,758,789,774,489,579,799,739,774,723,686,788,787,778},
- {705,685,654,680,672,680,657,579,574,619,639,518,482,545,665,587,540,599,606,651},
- {729,767,767,773,783,778,793,773,784,779,757,768,686,654,679,564,483,549,490,522},
- {725,693,715,588,522,629,721,647,697,684,614,725,708,674,715,729,717,725,689,738},
- {797,783,795,797,782,757,636,624,508,517,703,750,746,757,772,771,774,790,779,799},
- {556,591,652,692,728,712,698,688,704,718,728,717,713,693,716,558,490,540,620,678},
- {532,617,777,775,763,789,768,785,778,791,792,792,793,777,781,724,551,665,540,509},
- {710,697,706,717,673,679,620,581,546,474,562,684,680,675,660,656,702,680,701,708},
- {771,793,788,787,794,791,792,783,791,792,733,770,532,525,692,761,777,753,734,728},
- {724,695,678,652,695,735,697,712,714,721,696,710,569,581,570,522,642,704,748,726},
- {796,754,785,782,732,814,803,794,799,790,810,806,794,797,756,745,749,506,741,779},
- {793,767,785,780,724,648,488,747,784,771,793,740,759,805,794,796,795,795,801,806},
- {787,508,640,775,722,792,774,705,781,801,774,800,786,806,808,783,795,797,784,782},
- {654,649,601,597,594,667,646,662,615,623,651,671,669,674,682,653,624,484,473,665},
- {790,765,479,527,746,728,770,753,721,774,794,802,789,782,803,795,764,804,779,776},
- {738,699,642,509,515,501,466,614,702,612,683,720,687,717,704,739,714,733,721,718},
- {778,795,791,786,758,783,783,743,744,527,554,789,762,767,722,722,777,788,776,782},
- {694,696,700,696,709,710,696,689,674,662,581,538,496,637,644,681,679,671,689,704},
- {776,788,742,796,779,756,788,789,782,798,795,804,771,753,571,611,504,545,593,779},
- {799,717,747,682,487,573,766,774,775,762,711,802,799,796,790,787,802,789,773,786},
- {795,797,790,804,788,791,774,706,532,770,786,743,789,708,755,785,804,803,807,770},
- {568,722,738,680,713,703,693,749,703,705,740,720,712,631,621,727,730,722,574,612},
- {626,762,734,770,759,750,792,775,790,792,788,786,791,767,782,778,794,745,504,544},
- {774,784,779,753,654,560,530,532,555,699,742,695,716,767,770,772,778,780,779,782},
- {781,781,790,783,792,798,787,792,765,740,701,537,564,773,767,756,786,797,789,801},
- {738,717,799,794,772,784,774,790,788,748,789,769,768,763,504,587,783,751,784,732},
- {776,789,763,772,800,786,802,787,805,799,776,773,792,761,750,702,532,745,807,735},
- {765,778,764,484,607,791,757,760,700,687,789,777,779,783,768,791,778,757,784,770},
- {800,825,775,782,821,679,805,824,752,824,796,785,829,817,824,803,814,807,762,779}
-};
-/*-------------------------------------------------------------------*
- * FD CNG
- *-------------------------------------------------------------------*/
-
-const Word16 d_array[SIZE_SCALE_TABLE_CN] = { 1, 2, 5, 8, 10, 15, 20, 30, 40, 60, 80, 120, 140, 160, 180, 220, 260, 300 };
-const Word16 m_array[SIZE_SCALE_TABLE_CN] = { 0/*0.000f Q15*/, 8520/*0.260f Q15*/, 15729/*0.480f Q15*/, 19005/*0.580f Q15*/, 19988/*0.610f Q15*/, 21889/*0.668f Q15*/, 23101/*0.705f Q15*/, 24969/*0.762f Q15*/, 26214/*0.800f Q15*/, 27558/*0.841f Q15*/, 28344/*0.865f Q15*/, 29164/*0.890f Q15*/, 29491/*0.900f Q15*/, 29819/*0.910f Q15*/, 30147/*0.920f Q15*/, 30474/*0.930f Q15*/, 30638/*0.935f Q15*/, 30802/*0.940f Q15*/ };
-const Word16 msQeqInvAv_thresh[3] = { 328/*0.01f Q15*/, 983/*0.03f Q15*/, 1638/*0.05f Q15*/ };
-const Word16 msNoiseSlopeMax[4] = { 32767/*2.f Q14*/, 26214/*1.6f Q14*/, 21299/*1.3f Q14*/, 18022/*1.1f Q14*/ };
-
-
-const SCALE_SETUP scaleTableStereo[SIZE_SCALE_TABLE_STEREO] =
-{
- { 1, 0, 8000, /* -5.5f,*/ -704/*-5.5f Q7*/, -704 },
- { 1, 8000, 9600, /* -5.0f,*/ -640/*-5.0f Q7*/, -640 },
- { 1, 9600, 13200, /* -4.0f,*/ -512/*-4.0f Q7*/, -512 },
- { 1, 13200, 16400, /* -3.0f,*/ -384/*-3.0f Q7*/, -384 },
- { 1, 16400, 24400, /* -1.6f,*/ -204/*-1.6f Q7*/, -204 },
- { 1, 24400, 32000, /* -0.2f,*/ -26/*-1.6f Q7*/, -26 },
- { 1, 32000,512001, /* 0.0f,*/ 0 /*0.0f Q7*/, 0 },
-
- { 2, 0, 8000, /*-0.9f ,*/ -115/*-0.9f Q7*/, -115 },
- { 2, 8000, 9600, /*-0.65f,*/ -83/*-0.65f Q7*/, -83 },
- { 2, 9600, 13200, /*-2.0f ,*/ -256/*-2.0f Q7*/, -256 },
- { 2, 13200, 16400, /*-3.0f ,*/ -384/*-3.0f Q7*/, -384 },
- { 2, 16400, 24400, /*-0.8f ,*/ -102/*-0.8f Q7*/, -102 },
- { 2, 24400, 32000, /*-0.25f,*/ -32/*-0.25f Q7*/, -32 },
- { 2, 32000,512001, /* 0.0f ,*/ 0/* 0.0f Q7*/, 0 }
-};
-const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO] =
-{
- { 0, 0, 8000, /* -5.5f,*/ -704/*-5.5f Q7*/, -704 },
- { 0, 8000, 9600, /* -5.0f,*/ -640/*-5.0f Q7*/, -640 },
- { 0, 9600, 13200, /* -4.0f,*/ -512/*-4.0f Q7*/, -512 },
- { 0, 13200, 16400, /* -3.0f,*/ -384/*-3.0f Q7*/, -384 },
- { 0, 16400, 24400, /* -1.5f,*/ -192/*-1.5f Q7*/, -192 },
- { 0, 24400,128001, /* -0.5f,*/ -64/*-0.5f Q7*/, -64 },
-
- { 1, 0, 8000, /*-5.5f ,*/ -704/*-5.5f Q7*/, -704 },
- { 1, 8000, 9600, /*-5.0f ,*/ -640/*-5.0f Q7*/, -640 },
- { 1, 9600, 13200, /*-1.55f,*/ -198/*-1.55f Q7*/, -198 },
- { 1, 13200, 16400, /*-3.0f ,*/ -384/*-3.0f Q7*/,-384 },
- { 1, 16400, 24400, /*-0.6f ,*/ -77/*-0.6f Q7*/, -77 },
- { 1, 24400, 32000, /*-0.2f ,*/ -26/*-0.2f Q7*/, -26 },
- { 1, 32000,128001, /* 0.0f ,*/ 0/* 0.0f Q7*/, 0 },
-
- { 2, 0, 8000, /*-0.9f ,*/ -115/*-0.9f Q7*/, -115 },
- { 2, 8000, 9600, /*-0.65f,*/ -83/*-0.65f Q7*/, -83 },
- { 2, 9600, 13200, /*-2.0f ,*/ -256/*-2.0f Q7*/, -256 },
- { 2, 13200, 16400, /*-3.0f ,*/ -384/*-3.0f Q7*/, -384 },
- { 2, 16400, 24400, /*-0.8f ,*/ -102/*-0.8f Q7*/, -102 },
- { 2, 24400, 32000, /*-0.25f,*/ -32/*-0.25f Q7*/, -32 },
- { 2, 32000,128001, /* 0.0f ,*/ 0/* 0.0f Q7*/,0 }
-};
-
-const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN] =
-{
- { 0, 0, 8000, /*-3.5f,*/ 20295/*1.2387211385 Q14*/ /*-3.5f*/, 20295 },
- { 0, 8000, 9600, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
- { 0, 9600, 13200, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 0, 13200, 16400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
- { 0, 16400,128001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
-
- { 1, 0, 8000, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
- { 1, 8000, 9600, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 1, 9600, 13200, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
- { 1, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 1, 16400, 24400, /*-0.5f,*/ 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 },
- { 1, 24400,128001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
-
- { 2, 0, 8000, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 2, 8000, 9600, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 2, 9600, 13200, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
- { 2, 13200, 16400, /*-1.0f,*/ 4242/*0.2589254379 Q14*/ /*-1.0f*/, 4242 },
-
- { 2, 16400, 24400, /*-0.5f,*/ 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 },
- { 2, 24400, 32000, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
- { 2, 32000,128001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }
-};
-
-const SCALE_SETUP scaleTable_cn_dirac[15] =
-{
- { 0, 0, 13200, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
- { 0, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 0, 16400, 24400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
- { 0, 24400, 32000, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
- { 0, 32000,512001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
-
- { 1, 0, 13200, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
- { 1, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 1, 16400, 24400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
- { 1, 24400, 32000, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
- { 1, 32000,512001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
-
- { 2, 0, 13200, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
- { 2, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
- { 2, 16400, 24400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
- { 2, 24400, 32000, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
- { 2, 32000,512001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }
-};
-const Word16 scaleTable_cn_only_amrwbio[3][2] =
-{
- { ACELP_6k60, 24771/*1.5118864315 Q14*/ },
- { ACELP_8k85, 16306/*0.9952622652 Q14*/ },
- { ACELP_12k65, 9583/*0.5848932266 Q14*/ },
-};
-const Word32 scaleTable_cn_only_amrwbio_fx_by_10f[SIZE_SCALE_TABLE_CN_AMRWB][2] =//Q29
-{
- { ACELP_6k60, 858993459 },
- { ACELP_8k85, 644245094 },
- { ACELP_12k65, 429496729 }
-};
-
-const Word16 sidparts_encoder_noise_est[SIZE_SIDPARTS_ENC_NOISE_EST] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 279 }; // Q0
-
-const Word16 sidPartitions_nb[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 159 }; // Q0
-const Word16 sidPartitions_wb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255 }; // Q0
-const Word16 sidPartitions_wb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259 }; // Q0
-const Word16 sidPartitions_wb3[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319 }; // Q0
-const Word16 sidPartitions_swb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 274 }; // Q0
-const Word16 sidPartitions_swb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319, 324, 329, 339 }; // Q0
-
-const Word16 shapingPartitions_nb[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 159 }; // Q0
-const Word16 shapingPartitions_wb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0
-const Word16 shapingPartitions_wb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0
-const Word16 shapingPartitions_wb3[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; // Q0
-const Word16 shapingPartitions_swb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0
-const Word16 shapingPartitions_swb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; // Q0
-
-const FD_CNG_SETUP FdCngSetup_nb = { 512, 160, sizeof(sidPartitions_nb)/sizeof(Word16), sidPartitions_nb, sizeof(shapingPartitions_nb)/sizeof(Word16), shapingPartitions_nb };
-const FD_CNG_SETUP FdCngSetup_wb1 = { 512, 256, sizeof(sidPartitions_wb1)/sizeof(Word16), sidPartitions_wb1, sizeof(shapingPartitions_wb1)/sizeof(Word16), shapingPartitions_wb1 };
-const FD_CNG_SETUP FdCngSetup_wb2 = { 512, 256, sizeof(sidPartitions_wb2)/sizeof(Word16), sidPartitions_wb2, sizeof(shapingPartitions_wb2)/sizeof(Word16), shapingPartitions_wb2 };
-const FD_CNG_SETUP FdCngSetup_wb3 = { 640, 320, sizeof(sidPartitions_wb3)/sizeof(Word16), sidPartitions_wb3, sizeof(shapingPartitions_wb3)/sizeof(Word16), shapingPartitions_wb3 };
-const FD_CNG_SETUP FdCngSetup_swb1 = { 512, 256, sizeof(sidPartitions_swb1)/sizeof(Word16), sidPartitions_swb1, sizeof(shapingPartitions_swb1)/sizeof(Word16), shapingPartitions_swb1 };
-const FD_CNG_SETUP FdCngSetup_swb2 = { 640, 320, sizeof(sidPartitions_swb2)/sizeof(Word16), sidPartitions_swb2, sizeof(shapingPartitions_swb2)/sizeof(Word16), shapingPartitions_swb2 };
-
-
-const Word16 levels_37bits[FD_CNG_stages_37bits] = { 128, 64, 64, 64, 64, 64 }; // Q0
-const Word16 bits_37bits[FD_CNG_stages_37bits] = { 7, 6, 6, 6, 6, 6 }; // Q0
-
-/* IDCT_MATRIX_ROM: 18*24 Word16 = 432 Word16 */
-/* or compressed IDCT_MATRIX_ROM: 18*24 Word8 + 25 = 230 Word16 + WMOPS (INDIRECT(432) and STORE(432) ) */
-
-/* Stage1 Word8 tables 16x8+ 17*10+ 17*16 + 78*18 = = 1974 Word8 -> 987 Word16 */
-
-/* ROM storeSizeW8 = W8reduction (3072- (987+230) )/3072 = 1207/3072 --> 39.3 % */
-/* ROM with DCTII-24 in PROM = W8reduction (3072- (987) )/3072 = /3072 --> 31.8 % */
-
-/* additional minor Table ROM ( dct_mid points 18 Word16, dct_col_upshifts 52, scaleFactors 2*2 = ~= 74 Word16s */
-
-
-const Word16 cdk1_ivas_entries_per_segment[FDCNG_VQ_DCT_NSEGM] = { 16, 17, 17, 78 }; // Q0
-const Word16 cdk1_ivas_cum_entries_per_segment[FDCNG_VQ_DCT_NSEGM + 1] = { 0, 16 ,33, 50, 128 }; // Q0
-const Word16 /* DCT trunc_len */ cdk1_ivas_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MINTRUNC, 10, 16, FDCNG_VQ_DCT_MAXTRUNC }; /* 8, 10, 16, 18 */
-const Word16 /* segment inner DCT trunc_len */ cdk1_ivas_trunc_dct_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MAXTRUNC - FDCNG_VQ_DCT_MINTRUNC, FDCNG_VQ_DCT_MAXTRUNC - 10 , FDCNG_VQ_DCT_MAXTRUNC - 16 , 0 };
-
-/* to get back to FDCNG VQ domain for segment S use : idct as follows */
-/* cdk1r_vec[col, row] = cdk1r_tr_midQ_truncQ(col 1:24 ) + invScaleFQ * idctMat( cdk1_ivas_dct_sS_W8[1:col]<fftlen/2+1; j++) hs->fftSineTab[j] = (float)sin(2.0*EVS_PI*j/hs->fftlen); */
-
-
-const Word32 olapWinAna512_fx[512] = { /* Q30 */
- 4658693, 13975905, 23292590, 32608396, 41922980, 51235980, 60547056, 69855848,
- 79162008, 88465192, 97765048, 107061216, 116353360, 125641120, 134924144, 144202096,
- 153474624, 162741360, 172001968, 181256112, 190503440, 199743568, 208976192, 218200960,
- 227417488, 236625472, 245824528, 255014368, 264194560, 273364832, 282524800, 291674144,
- 300812512, 309939520, 319054880, 328158240, 337249248, 346327520, 355392768, 364444672,
- 373482816, 382506912, 391516576, 400511584, 409491456, 418455904, 427404576, 436337216,
- 445253408, 454152800, 463035104, 471900032, 480747136, 489576160, 498386752, 507178592,
- 515951328, 524704608, 533438144, 542151616, 550844672, 559516992, 568168256, 576798144,
- 585406272, 593992320, 602556096, 611097152, 619615168, 628109888, 636580992, 645028096,
- 653450880, 661849088, 670222400, 678570432, 686892992, 695189632, 703460096, 711704128,
- 719921344, 728111424, 736274112, 744409088, 752515968, 760594560, 768644608, 776665664,
- 784657408, 792619584, 800552064, 808454272, 816326144, 824167232, 831977280, 839756032,
- 847503104, 855218368, 862901376, 870551936, 878169728, 885754432, 893305728, 900823488,
- 908307264, 915756864, 923171904, 930552256, 937897664, 945207680, 952482048, 959720640,
- 966923136, 974089152, 981218496, 988310912, 995366080, 1002383808, 1009363840, 1016305856,
- 1023209536, 1030074688, 1036901120, 1043688512, 1050436672, 1057145152, 1063813888, 1070442688,
- 1077031040, 1083578880, 1090085888, 1096551936, 1102976640, 1109359872, 1115701248, 1122000640,
- 1128257792, 1134472576, 1140644480, 1146773504, 1152859392, 1158901888, 1164900608, 1170855680,
- 1176766592, 1182633088, 1188455168, 1194232448, 1199964800, 1205651968, 1211293824, 1216889984,
- 1222440320, 1227944704, 1233402752, 1238814464, 1244179456, 1249497600, 1254768768, 1259992704,
- 1265169152, 1270297984, 1275378944, 1280411904, 1285396736, 1290333056, 1295220992, 1300060032,
- 1304850048, 1309591040, 1314282624, 1318924928, 1323517440, 1328060032, 1332552832, 1336995328,
- 1341387520, 1345729152, 1350020224, 1354260352, 1358449536, 1362587648, 1366674432, 1370709632,
- 1374693376, 1378625408, 1382505344, 1386333312, 1390109184, 1393832576, 1397503616, 1401121920,
- 1404687488, 1408200320, 1411659904, 1415066496, 1418419840, 1421719680, 1424966016, 1428158720,
- 1431297664, 1434382720, 1437413760, 1440390656, 1443313408, 1446181632, 1448995584, 1451755008,
- 1454459648, 1457109632, 1459704704, 1462244864, 1464729856, 1467159808, 1469534464, 1471853824,
- 1474117760, 1476326272, 1478479104, 1480576256, 1482617728, 1484603264, 1486533120, 1488406912,
- 1490224640, 1491986176, 1493691648, 1495340800, 1496933760, 1498470400, 1499950464, 1501374080,
- 1502741248, 1504051840, 1505305856, 1506503168, 1507643648, 1508727424, 1509754368, 1510724480,
- 1511637888, 1512494208, 1513293568, 1514035968, 1514721408, 1515349760, 1515921152, 1516435456,
- 1516892672, 1517292672, 1517635584, 1517921408, 1518150144, 1518321664, 1518435968, 1518493184,
- 1518493184, 1518435968, 1518321664, 1518150144, 1517921408, 1517635584, 1517292672, 1516892672,
- 1516435456, 1515921152, 1515349760, 1514721408, 1514035968, 1513293568, 1512494208, 1511637888,
- 1510724480, 1509754368, 1508727424, 1507643648, 1506503040, 1505305728, 1504051840, 1502741248,
- 1501374080, 1499950464, 1498470272, 1496933760, 1495340800, 1493691648, 1491986176, 1490224640,
- 1488406784, 1486533120, 1484603264, 1482617728, 1480576256, 1478479104, 1476326272, 1474117760,
- 1471853824, 1469534464, 1467159808, 1464729856, 1462244864, 1459704704, 1457109504, 1454459648,
- 1451754880, 1448995584, 1446181632, 1443313408, 1440390656, 1437413760, 1434382720, 1431297664,
- 1428158720, 1424966016, 1421719680, 1418419712, 1415066496, 1411659904, 1408200192, 1404687488,
- 1401121920, 1397503488, 1393832576, 1390109056, 1386333312, 1382505344, 1378625280, 1374693376,
- 1370709632, 1366674432, 1362587648, 1358449536, 1354260352, 1350020096, 1345729024, 1341387392,
- 1336995200, 1332552704, 1328060032, 1323517440, 1318924800, 1314282624, 1309590912, 1304850048,
- 1300059904, 1295220864, 1290333056, 1285396736, 1280411904, 1275378944, 1270297856, 1265169024,
- 1259992576, 1254768640, 1249497600, 1244179456, 1238814336, 1233402752, 1227944576, 1222440192,
- 1216889984, 1211293696, 1205651840, 1199964672, 1194232320, 1188455040, 1182632960, 1176766464,
- 1170855552, 1164900608, 1158901760, 1152859264, 1146773504, 1140644352, 1134472448, 1128257664,
- 1122000640, 1115701120, 1109359744, 1102976512, 1096551808, 1090085760, 1083578752, 1077030912,
- 1070442560, 1063813824, 1057145088, 1050436608, 1043688448, 1036901056, 1030074624, 1023209472,
- 1016305728, 1009363776, 1002383744, 995365952, 988310848, 981218432, 974089024, 966922944,
- 959720576, 952481920, 945207488, 937897472, 930552192, 923171840, 915756736, 908307072,
- 900823296, 893305664, 885754240, 878169600, 870551808, 862901248, 855218240, 847503040,
- 839755968, 831977216, 824167104, 816326016, 808454208, 800551936, 792619520, 784657280,
- 776665472, 768644480, 760594496, 752515904, 744408960, 736273984, 728111296, 719921216,
- 711704000, 703460032, 695189504, 686892864, 678570368, 670222272, 661848960, 653450752,
- 645027968, 636580864, 628109760, 619615104, 611097024, 602555968, 593992256, 585406144,
- 576798016, 568168128, 559516864, 550844544, 542151488, 533438016, 524704480, 515951200,
- 507178432, 498386592, 489576032, 480747008, 471899904, 463035040, 454152672, 445253280,
- 436337056, 427404480, 418455744, 409491328, 400511456, 391516512, 382506816, 373482688,
- 364444544, 355392672, 346327392, 337249088, 328158112, 319054752, 309939392, 300812384,
- 291674016, 282524672, 273364704, 264194448, 255014224, 245824400, 236625328, 227417360,
- 218200832, 208976064, 199743440, 190503312, 181255984, 172001856, 162741232, 153474480,
- 144201968, 134924016, 125640984, 116353224, 107061080, 97764912, 88465064, 79161880,
- 69855712, 60546920, 51235848, 41922844, 32608264, 23292456, 13975772, 4658560
-};
-
-const Word32 olapWinAna640_fx[640] = { /* Q30 */
- 3726956, 11180779, 18634332, 26087438, 33539914, 40991584, 48442264, 55891776,
- 63339940, 70786584, 78231520, 85674560, 93115552, 100554288, 107990608, 115424328,
- 122855256, 130283240, 137708080, 145129584, 152547616, 159961952, 167372448, 174778896,
- 182181152, 189579008, 196972288, 204360832, 211744464, 219122960, 226496192, 233863984,
- 241226128, 248582448, 255932784, 263276976, 270614784, 277946112, 285270720, 292588448,
- 299899136, 307202592, 314498688, 321787136, 329067872, 336340672, 343605344, 350861792,
- 358109728, 365349088, 372579616, 379801184, 387013568, 394216640, 401410208, 408594112,
- 415768160, 422932192, 430086016, 437229536, 444362464, 451484736, 458596064, 465696416,
- 472785504, 479863168, 486929344, 493983712, 501026240, 508056672, 515074880, 522080640,
- 529073824, 536054304, 543021824, 549976256, 556917440, 563845248, 570759424, 577659840,
- 584546368, 591418816, 598276992, 605120768, 611949952, 618764352, 625563904, 632348352,
- 639117568, 645871424, 652609664, 659332224, 666038848, 672729472, 679403776, 686061824,
- 692703360, 699328128, 705936064, 712526976, 719100736, 725657216, 732196160, 738717440,
- 745220992, 751706496, 758173952, 764623104, 771053888, 777466048, 783859456, 790234048,
- 796589568, 802925888, 809242816, 815540288, 821818048, 828076096, 834314176, 840532096,
- 846729856, 852907136, 859063872, 865199872, 871315072, 877409344, 883482368, 889534144,
- 895564480, 901573248, 907560320, 913525504, 919468672, 925389632, 931288320, 937164672,
- 943018240, 948849280, 954657344, 960442432, 966204416, 971943104, 977658304, 983350016,
- 989017984, 994662144, 1000282368, 1005878464, 1011450368, 1016997760, 1022520768, 1028019136,
- 1033492736, 1038941376, 1044364992, 1049763520, 1055136768, 1060484416, 1065806656, 1071103168,
- 1076373888, 1081618688, 1086837376, 1092029952, 1097196160, 1102335872, 1107449088, 1112535680,
- 1117595392, 1122628224, 1127633920, 1132612480, 1137563776, 1142487680, 1147383936, 1152252672,
- 1157093632, 1161906688, 1166691712, 1171448576, 1176177280, 1180877696, 1185549568, 1190193024,
- 1194807680, 1199393536, 1203950464, 1208478464, 1212977408, 1217447040, 1221887232, 1226298112,
- 1230679424, 1235031040, 1239352960, 1243644928, 1247907072, 1252139008, 1256340864, 1260512384,
- 1264653440, 1268764288, 1272844288, 1276893824, 1280912512, 1284900352, 1288857216, 1292782976,
- 1296677760, 1300541056, 1304373120, 1308173824, 1311942912, 1315680512, 1319386240, 1323060224,
- 1326702336, 1330312576, 1333890688, 1337436672, 1340950400, 1344431872, 1347880960, 1351297536,
- 1354681472, 1358032896, 1361351424, 1364637312, 1367890304, 1371110272, 1374297216, 1377451008,
- 1380571776, 1383659136, 1386713216, 1389733760, 1392720896, 1395674496, 1398594432, 1401480704,
- 1404333312, 1407151872, 1409936640, 1412687360, 1415404160, 1418086784, 1420735232, 1423349376,
- 1425929344, 1428475008, 1430986112, 1433462784, 1435904896, 1438312448, 1440685312, 1443023360,
- 1445326848, 1447595392, 1449828992, 1452027776, 1454191616, 1456320256, 1458413824, 1460472448,
- 1462495616, 1464483712, 1466436480, 1468353920, 1470235904, 1472082688, 1473893760, 1475669376,
- 1477409536, 1479113984, 1480782720, 1482416000, 1484013440, 1485575040, 1487100928, 1488591104,
- 1490045184, 1491463424, 1492845824, 1494192256, 1495502592, 1496776960, 1498015232, 1499217280,
- 1500383360, 1501513344, 1502606976, 1503664512, 1504685824, 1505670912, 1506619520, 1507532032,
- 1508408192, 1509247872, 1510051200, 1510818304, 1511548928, 1512243072, 1512900864, 1513522176,
- 1514107008, 1514655360, 1515167104, 1515642496, 1516081408, 1516483584, 1516849280, 1517178496,
- 1517471232, 1517727232, 1517946752, 1518129664, 1518276096, 1518385792, 1518459008, 1518495488,
- 1518495488, 1518459008, 1518385792, 1518276096, 1518129664, 1517946752, 1517727232, 1517471104,
- 1517178496, 1516849280, 1516483584, 1516081280, 1515642496, 1515167104, 1514655360, 1514107008,
- 1513522176, 1512900864, 1512243072, 1511548928, 1510818304, 1510051200, 1509247872, 1508408192,
- 1507532032, 1506619520, 1505670912, 1504685696, 1503664512, 1502606976, 1501513344, 1500383360,
- 1499217280, 1498015232, 1496776960, 1495502592, 1494192128, 1492845824, 1491463424, 1490045184,
- 1488590976, 1487100928, 1485575040, 1484013312, 1482416000, 1480782720, 1479113984, 1477409536,
- 1475669376, 1473893760, 1472082560, 1470235904, 1468353920, 1466436480, 1464483712, 1462495616,
- 1460472320, 1458413824, 1456320256, 1454191488, 1452027776, 1449828992, 1447595392, 1445326848,
- 1443023360, 1440685312, 1438312448, 1435904768, 1433462656, 1430986112, 1428474880, 1425929344,
- 1423349376, 1420735104, 1418086784, 1415404160, 1412687360, 1409936640, 1407151872, 1404333184,
- 1401480704, 1398594432, 1395674496, 1392720896, 1389733760, 1386713088, 1383659008, 1380571648,
- 1377451008, 1374297216, 1371110272, 1367890304, 1364637312, 1361351424, 1358032768, 1354681472,
- 1351297408, 1347880832, 1344431744, 1340950272, 1337436672, 1333890688, 1330312576, 1326702336,
- 1323060224, 1319386240, 1315680384, 1311942912, 1308173696, 1304373120, 1300541056, 1296677632,
- 1292782848, 1288857088, 1284900224, 1280912512, 1276893696, 1272844288, 1268764160, 1264653440,
- 1260512256, 1256340736, 1252138880, 1247906944, 1243644800, 1239352832, 1235030912, 1230679296,
- 1226297984, 1221887104, 1217446912, 1212977280, 1208478336, 1203950464, 1199393408, 1194807552,
- 1190192896, 1185549440, 1180877696, 1176177280, 1171448576, 1166691584, 1161906560, 1157093504,
- 1152252544, 1147383808, 1142487552, 1137563648, 1132612352, 1127633792, 1122628096, 1117595264,
- 1112535552, 1107448960, 1102335872, 1097196032, 1092029824, 1086837248, 1081618560, 1076373888,
- 1071103104, 1065806592, 1060484352, 1055136576, 1049763456, 1044364928, 1038941312, 1033492608,
- 1028019072, 1022520704, 1016997696, 1011450240, 1005878400, 1000282304, 994662080, 989017920,
- 983349888, 977658240, 971942976, 966204288, 960442368, 954657280, 948849152, 943018176,
- 937164480, 931288192, 925389504, 919468544, 913525312, 907560192, 901573184, 895564416,
- 889534016, 883482304, 877409152, 871314944, 865199808, 859063744, 852907008, 846729728,
- 840532032, 834314112, 828075968, 821817984, 815540096, 809242752, 802925696, 796589376,
- 790233856, 783859392, 777465984, 771053824, 764622976, 758173824, 751706432, 745220864,
- 738717312, 732196032, 725657088, 719100608, 712526848, 705935936, 699328000, 692703232,
- 686061760, 679403712, 672729280, 666038720, 659332096, 652609536, 645871296, 639117440,
- 632348224, 625563776, 618764224, 611949824, 605120640, 598276864, 591418688, 584546240,
- 577659712, 570759296, 563845120, 556917312, 549976128, 543021696, 536054144, 529073696,
- 522080512, 515074752, 508056512, 501026112, 493983648, 486929216, 479863072, 472785376,
- 465696288, 458596000, 451484608, 444362336, 437229408, 430085952, 422932064, 415768032,
- 408593952, 401410080, 394216512, 387013440, 379801024, 372579456, 365348960, 358109632,
- 350861664, 343605248, 336340544, 329067744, 321787008, 314498528, 307202464, 299899008,
- 292588320, 285270592, 277945984, 270614656, 263276832, 255932656, 248582320, 241225984,
- 233863840, 226496064, 219122832, 211744320, 204360704, 196972144, 189578864, 182181008,
- 174778768, 167372304, 159961824, 152547472, 145129456, 137707936, 130283104, 122855136,
- 115424192, 107990472, 100554160, 93115416, 85674432, 78231384, 70786448, 63339808,
- 55891640, 48442128, 40991448, 33539780, 26087306, 18634200, 11180647, 3726823
-};
-
-/* Synthesis windows for overlap-add */
-/* for (j=0; jfftlen; j++) hs->olapWinSyn[j] = (float)sin(EVS_PI*((float)j+0.5f)/(float)(hs->fftlen); */
-
-const Word16 olapWinSyn256_fx[256] =
-{//Q15
- 201, 603, 1005, 1407, 1808, 2210, 2611, 3011, 3411, 3811, 4210, 4609, 5006, 5403, 5800, 6195,
- 6589, 6983, 7375, 7766, 8156, 8545, 8933, 9319, 9704, 10087, 10469, 10849, 11228, 11605, 11980, 12353,
- 12725, 13094, 13462, 13828, 14191, 14552, 14912, 15269, 15623, 15976, 16325, 16673, 17018, 17360, 17700, 18037,
- 18371, 18703, 19032, 19358, 19681, 20001, 20318, 20631, 20942, 21250, 21555, 21856, 22154, 22448, 22740, 23027,
- 23312, 23593, 23870, 24144, 24414, 24680, 24943, 25201, 25457, 25708, 25955, 26199, 26438, 26674, 26905, 27133,
- 27356, 27576, 27791, 28002, 28208, 28411, 28609, 28803, 28993, 29178, 29359, 29535, 29707, 29874, 30037, 30196,
- 30350, 30499, 30644, 30784, 30919, 31050, 31176, 31298, 31414, 31526, 31634, 31736, 31834, 31927, 32015, 32098,
- 32176, 32250, 32319, 32383, 32442, 32496, 32545, 32589, 32629, 32663, 32693, 32718, 32737, 32752, 32762, 32767,
- 32767, 32762, 32752, 32737, 32718, 32693, 32663, 32629, 32589, 32545, 32496, 32442, 32383, 32319, 32250, 32176,
- 32098, 32015, 31927, 31834, 31736, 31634, 31526, 31414, 31298, 31176, 31050, 30919, 30784, 30644, 30499, 30350,
- 30196, 30037, 29874, 29707, 29535, 29359, 29178, 28993, 28803, 28609, 28411, 28208, 28002, 27791, 27576, 27356,
- 27133, 26905, 26674, 26438, 26199, 25955, 25708, 25457, 25201, 24943, 24680, 24414, 24144, 23870, 23593, 23312,
- 23027, 22740, 22448, 22154, 21856, 21555, 21250, 20942, 20631, 20318, 20001, 19681, 19358, 19032, 18703, 18371,
- 18037, 17700, 17360, 17018, 16673, 16325, 15976, 15623, 15269, 14912, 14552, 14191, 13828, 13462, 13094, 12725,
- 12353, 11980, 11605, 11228, 10849, 10469, 10087, 9704, 9319, 8933, 8545, 8156, 7766, 7375, 6983, 6589,
- 6195, 5800, 5403, 5006, 4609, 4210, 3811, 3411, 3011, 2611, 2210, 1808, 1407, 1005, 603, 201
-};
-
-
-const Word16 olapWinSyn320_fx[320] =
-{//Q15
- 160, 482, 804, 1125, 1447, 1768, 2089, 2410, 2731, 3051,
- 3371, 3691, 4011, 4330, 4648, 4967, 5284, 5602, 5918, 6234,
- 6550, 6865, 7179, 7493, 7805, 8117, 8429, 8739, 9049, 9358,
- 9665, 9972, 10278, 10583, 10887, 11190, 11492, 11793, 12092, 12391,
- 12688, 12984, 13278, 13572, 13864, 14155, 14444, 14732, 15019, 15304,
- 15588, 15870, 16151, 16430, 16707, 16983, 17258, 17530, 17801, 18070,
- 18338, 18604, 18868, 19130, 19390, 19648, 19905, 20159, 20412, 20663,
- 20911, 21158, 21403, 21645, 21886, 22124, 22360, 22594, 22826, 23056,
- 23283, 23509, 23732, 23952, 24171, 24387, 24600, 24812, 25021, 25227,
- 25431, 25633, 25832, 26029, 26223, 26415, 26604, 26790, 26974, 27155,
- 27334, 27510, 27684, 27854, 28023, 28188, 28351, 28511, 28668, 28822,
- 28974, 29123, 29269, 29412, 29552, 29690, 29825, 29956, 30085, 30211,
- 30334, 30455, 30572, 30686, 30797, 30906, 31011, 31114, 31213, 31309,
- 31403, 31493, 31581, 31665, 31746, 31824, 31899, 31971, 32040, 32106,
- 32169, 32229, 32285, 32339, 32389, 32436, 32480, 32521, 32559, 32594,
- 32625, 32653, 32679, 32701, 32720, 32736, 32748, 32758, 32764, 32767,
- 32767, 32764, 32758, 32748, 32736, 32720, 32701, 32679, 32653, 32625,
- 32594, 32559, 32521, 32480, 32436, 32389, 32339, 32285, 32229, 32169,
- 32106, 32040, 31971, 31899, 31824, 31746, 31665, 31581, 31493, 31403,
- 31309, 31213, 31114, 31011, 30906, 30797, 30686, 30572, 30455, 30334,
- 30211, 30085, 29956, 29825, 29690, 29552, 29412, 29269, 29123, 28974,
- 28822, 28668, 28511, 28351, 28188, 28023, 27854, 27684, 27510, 27334,
- 27155, 26974, 26790, 26604, 26415, 26223, 26029, 25832, 25633, 25431,
- 25227, 25021, 24812, 24600, 24387, 24171, 23952, 23732, 23509, 23283,
- 23056, 22826, 22594, 22360, 22124, 21886, 21645, 21403, 21158, 20911,
- 20663, 20412, 20159, 19905, 19648, 19390, 19130, 18868, 18604, 18338,
- 18070, 17801, 17530, 17258, 16983, 16707, 16430, 16151, 15870, 15588,
- 15304, 15019, 14732, 14444, 14155, 13864, 13572, 13278, 12984, 12688,
- 12391, 12092, 11793, 11492, 11190, 10887, 10583, 10278, 9972, 9665,
- 9358, 9049, 8739, 8429, 8117, 7805, 7493, 7179, 6865, 6550,
- 6234, 5918, 5602, 5284, 4967, 4648, 4330, 4011, 3691, 3371,
- 3051, 2731, 2410, 2089, 1768, 1447, 1125, 804, 482, 160
-};
-
-/*-------------------------------------------------------------------*
- * AMR-WB ISF codebook - common 1st stage for 46bit and 36bit codebooks,
- * 2 splits
- *
- * codebook vector dimension number of vectors
- * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
- * 1_1 9 256
- * 1_2 7 256
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * 1nd stage, 1st split: ISF0 to ISF8
- *-------------------------------------------------------------------*/
-
-const Word16 dico1_isf_fx[] =
-{/*Qlog2(2.56)*/
- 740, 1263, 1292, 1006, 997, 1019, 1017, 976, 923,
- 557, 946, 1049, 867, 846, 990, 1112, 1262, 1241,
- 633, 898, 996, 756, 662, 683, 783, 909, 996,
- 830, 736, 278, 820, 1254, 686, 712, 1039, 473,
- 503, 885, 1508, 1307, 1282, 1172, 1119, 1209, 1061,
- 416, 719, 989, 1227, 1001, 1052, 954, 741, 1044,
- 585, 1132, 1233, 1091, 1247, 1433, 1512, 1448, 1314,
- -31, 469, 803, 659, 619, 658, 843, 987, 1113,
- 842, 1678, 1841, 1549, 1474, 1256, 1082, 905, 742,
- 370, 1216, 1768, 1633, 1212, 636, 22, -330, 71,
- 73, 738, 893, 968, 993, 1768, 2273, 1840, 1391,
- 1513, 1714, 1238, 534, 276, 315, 461, 459, 508,
- 421, 1293, 1640, 1623, 1742, 1617, 1499, 1284, 1006,
- -95, 752, 1680, 1569, 1618, 1436, 1200, 980, 712,
- -78, 831, 1194, 1110, 1378, 1481, 1492, 1365, 1217,
- 670, 1208, 1168, 860, 742, 601, 528, 403, 309,
- 397, 621, 966, 752, 579, 398, 400, 329, 252,
- 510, 864, 1108, 807, 939, 902, 925, 717, 481,
- 539, 835, 913, 719, 617, 544, 591, 565, 642,
- 162, 889, 654, 108, -34, 244, 488, 561, 532,
- -62, 1033, 1308, 1035, 1127, 1098, 1029, 961, 823,
- -14, 945, 990, 801, 755, 815, 847, 913, 892,
- 394, 1765, 1666, 1339, 1117, 806, 642, 479, 380,
- 529, 1851, 2003, 1228, 622, -41, -416, 344, 819,
- 635, 1058, 883, 492, 372, 312, 317, 274, 241,
- 279, 966, 1642, 1478, 1463, 1123, 795, 525, 339,
- 457, 955, 1177, 1214, 1427, 1457, 1345, 917, 539,
- 148, 751, 1515, 1105, 867, 606, 474, 448, 399,
- 579, 1081, 1035, 390, 3, -263, -198, -82, 38,
- 18, -68, -12, 313, 761, 405, 249, 111, -76,
- -91, 827, 948, 648, 613, 535, 522, 490, 421,
- 41, -44, -281, -472, 652, 534, 193, 135, -90,
- 41, -121, -356, -60, 663, 307, 61, -48, -344,
- -118, -204, 328, 512, 870, 793, 610, 402, 186,
- 156, 293, 74, -338, -475, -897, -594, -161, -497,
- 226, 131, -138, 307, 169, -271, -164, -387, -624,
- 62, -32, -61, -252, -541, -828, -1027, -523, -662,
- 102, -61, 141, 112, -270, -251, -541, 25, -150,
- 6, -132, -356, -686, -96, -322, -522, -31, -326,
- -36, -209, -521, -229, 307, -132, -5, -99, -384,
- 60, -51, -237, -668, -973, -407, -708, -75, -172,
- 26, -138, -266, 111, -302, 43, -278, -356, -359,
- 570, 822, 496, -154, -312, -92, 137, 279, 371,
- -146, 368, 409, 68, 6, 77, 167, 202, 162,
- -103, 294, 607, 415, 483, 462, 480, 431, 408,
- -120, -338, -612, -524, 584, 331, 92, 433, 276,
- -178, -293, -154, -41, 269, 100, -9, 213, 160,
- -218, -304, 463, 454, 397, 273, 202, 286, 273,
- -232, 7, 6, -388, -472, -427, -378, -167, -100,
- -294, -183, 134, -47, 101, -88, -84, -117, -3,
- 57, 17, -202, -634, -989, -1119, -533, 176, -36,
- 120, -28, 23, 111, -319, 318, -22, -77, 266,
- -271, -464, -434, -658, -640, -385, -385, -99, -69,
- -198, -259, -266, -44, -39, -139, -137, 171, 66,
- 9, -145, -377, -846, -1000, -111, -325, 342, 135,
- -81, -286, -380, 192, -57, 307, 76, -24, -140,
- 677, 702, 247, 56, 249, 141, -105, -236, -99,
- 36, -39, -69, 348, 198, -93, 322, 91, -72,
- -127, -376, -657, 139, 623, 223, 501, 306, 220,
- -113, -384, -796, 504, 438, 85, 213, -83, -194,
- -174, -422, 7, 1155, 1089, 1182, 1003, 945, 806,
- 8, -126, -317, -103, -351, -695, -98, -268, -537,
- 33, -103, -290, 167, -39, -407, 44, -208, -375,
- 104, -23, -64, -291, -637, -851, -1084, -61, -112,
- -75, -306, -434, 218, -148, -354, -680, -133, -216,
- -121, -377, -718, -97, -130, -361, -156, -379, -599,
- -56, -254, -586, 235, 157, -214, 11, -260, -149,
- -124, -267, -397, -580, -593, -527, -805, -385, 346,
- -193, -440, -708, -351, -141, -255, -499, -147, -185,
- 448, 660, 494, 208, 509, 461, 338, 291, 149,
- -223, 88, 335, 159, 212, 191, 286, 308, 205,
- -171, -242, 514, 362, 295, 524, 552, 694, 585,
- -64, -308, -448, -21, 284, 786, 446, 289, 92,
- -218, -390, -7, 169, 206, 330, 352, 408, 358,
- -36, 702, 959, 859, 861, 1115, 1269, 1357, 1305,
- -133, -341, -65, 678, 417, 440, 486, 518, 780,
- 33, -44, -191, -344, -461, -755, -201, 217, -31,
- -353, -547, -44, 123, -61, -68, -79, 29, 60,
- 73, -57, -406, -766, -1243, -1203, 240, 400, 165,
- -73, -282, -601, -213, -171, -375, 332, 35, -103,
- -29, -207, -553, -476, -638, -908, 172, -22, -135,
- -192, -239, -164, -103, -111, -47, 153, 125, 110,
- -1, -203, -570, -1030, -1424, -535, 155, 1, 147,
- -333, -653, -865, -197, -158, -21, -44, 95, 108,
- 389, 588, 490, 33, -237, -524, -628, -136, -260,
- 40, -177, -462, 453, 862, 380, 131, -130, -405,
- -76, -281, -741, -742, 898, 619, 277, 71, -222,
- -32, -265, -556, -25, 994, 682, 305, 126, -165,
- -69, -349, -585, 234, 1158, 903, 626, 510, 251,
- -1, -99, -272, -210, -603, -351, -540, -811, -383,
- -16, -230, -504, 410, 149, -205, -343, -651, -639,
- 103, -9, -227, -205, -562, -781, -1079, -1208, -156,
- 143, 63, -135, -67, -317, -602, -784, -1154, -640,
- -144, -391, -674, -622, -200, -254, -660, -947, -395,
- -40, -250, -625, 27, 543, 94, -131, -386, -673,
- -123, -371, -757, -451, -564, -614, -415, -711, -35,
- -116, -309, -593, -268, 239, -33, -338, -650, -135,
- 94, 251, 554, 57, -312, -423, -154, -57, 235,
- -268, -71, 381, 114, -44, -87, 125, 173, 133,
- -131, -19, 1149, 670, 486, 356, 309, 369, 296,
- -223, -501, -899, -722, -70, 6, 131, 310, 394,
- -99, -303, -517, 249, 64, -53, 135, -11, 453,
- -147, -399, -730, -401, 817, 738, 802, 749, 575,
- -154, -435, -739, 800, 593, 366, 529, 318, 326,
- -224, 45, -39, -387, -515, -518, -608, -384, -321,
- -315, -377, 143, -101, -113, -377, -177, -144, -12,
- 117, 40, -239, -651, -1051, -581, -737, -990, -328,
- 26, -50, -157, -23, -453, -283, -531, -546, 192,
- -252, -501, -743, -589, -627, -499, -328, -118, -72,
- -324, -494, -244, -306, -144, -177, -262, -135, -78,
- -36, -234, -519, -961, -1290, -314, -479, -371, -45,
- -95, -292, -535, -8, -300, 112, -164, -277, 198,
- -99, -128, 880, 836, 579, 351, 23, -95, -217,
- -27, -258, 124, 1011, 597, 425, 144, 7, -73,
- -69, -300, -683, -435, 1132, 899, 504, 332, 109,
- -74, -323, -637, 563, 1074, 608, 371, 105, -49,
- -259, -121, 1440, 1334, 1628, 1490, 1438, 1223, 933,
- -82, -306, -613, -222, -378, -675, -545, -671, -845,
- 53, -124, -347, 422, 52, -125, -270, -529, 9,
- 79, -89, -320, -662, -999, -1199, -1243, -676, -297,
- -68, -273, -611, 137, -146, -397, -627, -845, -220,
- -112, -346, -797, -826, 234, -132, -188, -278, -522,
- -159, -405, -734, -419, 293, 74, -167, -167, 184,
- -153, -437, -833, -1080, -336, -472, -561, -340, -253,
- -169, -423, -820, -904, -131, -19, -346, -604, 31,
- 33, -31, 312, 62, -148, 49, -59, 564, 486,
- -306, -333, 194, -44, 67, 72, 147, 205, 243,
- -207, -49, 1360, 983, 969, 991, 1014, 1110, 973,
- -211, -172, 883, 627, 711, 674, 705, 798, 746,
- -88, -325, -763, -974, 687, 908, 514, 382, 172,
- -292, -612, -805, 63, 131, 270, 259, 352, 348,
- -235, -84, 955, 818, 1120, 1289, 1559, 1480, 1285,
- -180, -461, -614, 657, 691, 745, 854, 783, 713,
- -97, -309, -477, -614, -777, -734, -768, -526, -472,
- -344, -476, -35, -169, 49, -77, -150, -240, -141,
- -52, -268, -639, -919, -1278, -1113, -342, -333, -151,
- -68, -242, -585, -73, -209, -478, -159, -429, 133,
- -197, -499, -1005, -1268, -272, -224, -105, -67, 17,
- -363, -618, -414, -116, -62, 20, 10, 116, 108,
- -195, -475, -906, -1260, -891, -441, -277, -142, -28,
- -226, -519, -950, -700, -275, -266, -116, -105, 82,
- 404, 511, 520, 327, 17, -194, -333, -536, -586,
- -114, -130, 276, 237, 204, 342, 135, -16, -111,
- 191, 180, -137, -467, 272, 106, -95, 17, -192,
- -80, -290, -626, 194, 598, 196, 21, -281, 77,
- 137, 367, 534, 764, 670, 382, 296, 153, 84,
- 303, 497, 144, -85, -125, -539, -482, -464, -764,
- 233, 347, 68, -147, 169, -210, -242, -226, -482,
- 307, 422, 154, -175, -386, -722, -724, -904, -1015,
- 309, 308, 160, -60, -470, -420, -598, -791, -219,
- 68, 121, -137, -560, -146, -446, -515, -494, -729,
- 130, 53, -227, 46, 474, 32, -161, -192, -490,
- 213, 164, -71, -465, -876, -161, -456, -587, -48,
- 218, 117, 39, 177, -194, -88, -226, -418, 50,
- 210, 547, 569, 279, 121, -44, -50, 10, -84,
- 58, 140, 182, -5, 267, 117, 106, 211, 198,
- 153, 559, 872, 460, 222, 108, 188, 180, 183,
- 158, 119, 284, -153, -271, 229, 87, 110, -57,
- -183, 82, 118, 21, 13, 40, 118, 191, 185,
- 163, 56, 609, 341, 50, 329, 68, 266, 218,
- 100, 206, 18, -304, -107, -436, -487, -65, -306,
- -86, 154, 134, -30, -45, -73, -104, -80, -96,
- 245, 330, 10, -440, -849, -1082, 79, 40, -265,
- 196, 372, 272, -181, -493, -389, 275, 80, -59,
- 2, -12, -246, -505, -100, -436, 21, -187, -431,
- -221, -48, 36, -271, -186, -147, -109, 26, 71,
- 213, 140, 72, -351, -620, -84, -363, 69, 46,
- 91, 167, -3, -95, -99, -105, -48, 114, 147,
- 259, 249, 172, 607, 406, 52, 59, -189, -320,
- 115, -85, -54, 574, 128, 226, -59, -253, 130,
- 39, 364, 757, 940, 728, 660, 659, 583, 770,
- -115, -338, -760, -471, 394, 37, 441, 178, 6,
- -57, -305, -525, 796, 453, 188, -4, -114, 248,
- 71, 444, 797, 731, 1096, 1157, 1222, 1029, 811,
- 135, 359, 551, 425, 749, 815, 874, 704, 502,
- 132, 247, 0, -206, -449, -750, -258, -514, -633,
- 248, 249, 91, 121, -195, -499, -90, -282, -435,
- 78, 20, -277, -623, -983, -1224, -415, -458, -639,
- 347, 509, 208, -179, -464, -728, -76, -237, -486,
- -103, -343, -756, -713, -265, -609, -191, -398, -636,
- -121, -383, -749, 567, 252, -36, -354, -417, -50,
- 204, 100, -149, -650, -1081, -47, -7, -263, 111,
- -46, -180, -267, -324, -562, -394, -692, 398, 292,
- 482, 670, 683, 624, 442, 165, 116, 36, -149,
- 108, 247, 291, 247, 355, 122, 109, 224, 296,
- 292, 349, 725, 482, 388, 329, 429, 620, 667,
- -34, 197, 213, -127, 84, 494, 620, 575, 375,
- 126, 207, 172, 167, 362, 202, 296, 395, 455,
- -6, 250, 539, 467, 636, 801, 1149, 1287, 1118,
- 27, 240, 369, 280, 440, 411, 634, 892, 953,
- 159, 170, -58, -395, -797, -690, 77, -211, -334,
- -5, -28, -13, -74, -335, -603, 300, 88, -205,
- 82, -33, -364, -698, -1203, -1153, 110, -146, -289,
- 113, 1, -243, -588, -994, -496, 414, 160, 42,
- -56, -247, -440, -693, -996, -479, 11, -178, -357,
- -151, -353, -327, -211, -340, 141, 65, 425, 453,
- 34, -169, -455, -932, -1215, 138, 499, 256, 324,
- 68, 139, -15, -547, -478, 17, 306, 502, 481,
- -32, -134, 445, 129, -143, -244, -503, -507, -599,
- 61, -140, -345, 496, 458, -2, 20, -227, -514,
- 215, 519, 920, 1053, 1090, 791, 528, 290, 155,
- -54, -233, -647, -602, 639, 294, -2, -167, -442,
- -78, -315, -791, -113, 820, 403, 158, -116, -356,
- -105, -379, -236, 1224, 893, 749, 568, 356, 214,
- -17, -199, -144, 50, -283, -247, -578, -846, -1087,
- 69, -11, -381, -206, 209, -284, -387, -416, -716,
- 39, -5, -145, -374, -682, -909, -1074, -1169, -1066,
- 287, 226, 67, -221, -662, -171, -421, -642, -707,
- -132, -348, -538, -448, -20, -4, -354, -748, -933,
- 4, -75, -289, -598, 317, 52, -208, -297, -559,
- -88, -264, -358, -589, -631, -248, -523, -822, -1071,
- 70, -8, 54, -314, -515, 92, -146, -274, -493,
- 199, 62, 391, 158, -141, 71, -219, -203, -207,
- 152, 40, 329, 162, -29, 48, -149, 108, 127,
- 267, 722, 1256, 882, 625, 248, 8, -81, -60,
- -58, -138, -291, -600, -12, -2, -39, 147, 117,
- -107, -345, -513, 459, 76, 92, -272, 388, 262,
- 362, 516, 203, -409, -716, -831, -331, 185, 209,
- -117, -391, -298, 671, 292, 538, 257, 166, -38,
- -102, -319, -194, -283, -573, -262, -579, -219, -444,
- -235, 78, 11, -168, -101, -229, -263, -321, -123,
- 70, 50, -170, -599, -996, -588, -263, -516, -455,
- 394, 363, 229, -136, -538, 21, -183, -348, -201,
- -124, -368, -640, -879, -847, -209, -409, -494, -515,
- -127, -341, -541, -425, -510, -10, -252, -473, -291,
- 84, -69, -201, -676, -868, 103, -311, -132, -320,
- 5, -173, -188, -297, -628, 197, -57, 7, -11,
- 49, -160, 56, 558, 111, 33, -311, -440, -463,
- -1, -246, -307, 862, 453, 139, -170, -355, -232,
- -197, -38, 1702, 1331, 1252, 950, 692, 504, 426,
- -108, -344, -861, -1172, 444, 354, 88, -46, -220,
- -53, -321, -494, 1113, 744, 364, 198, -34, -75,
- -69, 199, 897, 1140, 1343, 1183, 977, 742, 522,
- 122, 44, -269, 27, -155, -562, -307, -590, -773,
- 154, 42, -160, 252, -129, -305, -471, -733, -371,
- 135, 185, -82, -416, -722, -913, -504, -743, -880,
- 149, 214, -84, -329, -680, -835, -426, -661, -81,
- -128, -380, -735, -998, -337, 17, -182, -467, -697,
- -84, -290, -510, -592, 13, 440, 154, -38, -279,
- 70, -61, -246, -727, -1047, -80, -381, -535, -704,
- 178, -2, -146, -670, -938, 482, 138, 63, 65,
- -11, 15, 772, 443, 142, -20, -209, -126, -161,
- -32, -249, 95, 552, 124, 30, -343, 82, -86,
- -163, -257, 899, 1097, 906, 751, 502, 390, 294,
- -51, -258, -447, -806, -368, 763, 464, 364, 183,
- -166, -374, -367, 87, 35, 399, 418, 856, 833,
- -205, -310, 588, 778, 785, 1065, 1118, 1245, 1157,
- -173, -312, 107, 345, 400, 790, 870, 1113, 1001,
- -7, -120, -387, -410, -614, -943, -226, -384, -491,
- -203, -288, -51, -331, -90, -178, -408, -573, -338,
- 56, -29, -273, -627, -1041, -798, -247, -467, 148,
- 66, -2, -205, -205, -575, -349, -57, -352, -58,
- -45, -225, -471, -924, -497, 77, -32, 44, -135,
- -277, -491, -497, -502, -424, -202, -137, 77, 96,
- 26, -179, -469, -1008, -1260, 262, -35, -132, -259,
- -66, -232, -447, -533, -789, -191, -100, -267, 364,
- 111, 43, -287, -423, -608, -987, -922, -799, -827,
- 77, 76, -101, -260, -549, -850, -88, -231, -329,
- 75, 24, -66, -269, -427, -528, -773, 201, -5,
- 67, 7, -61, -320, -487, 12, -200, -242, -94,
- 27, -54, -149, -354, -661, -594, -450, -481, 560,
- 31, -69, -246, -549, -1141, -178, -232, -275, -288,
- 16, -84, -176, 7, -83, -210, -246, -424, -589,
- 63, -60, -201, -90, -269, -400, -685, -1218, -258,
- 169, 217, 142, -71, -243, -433, -504, -511, -537,
- 6, -105, -234, -321, -188, -131, -307, -521, -1319,
- -34, -151, -369, 11, 44, -95, -280, -500, 160,
- 31, -37, -163, -334, 288, 89, -150, -86, -299,
- -35, -161, -362, -74, -74, -263, 240, 9, -153,
- -45, -208, -529, -896, 89, 24, -130, -313, -373,
- 234, 276, 197, -10, -236, -162, -134, -85, -112,
- 42, -73, 133, 392, 98, 72, -153, -162, -99,
- -3, -145, -338, 408, 401, 133, -52, -296, -501,
- 3, -109, -152, -85, -56, 42, -145, 703, 205,
- -49, -149, -281, -134, -121, -41, -21, 16, 958,
- 30, -107, -196, -463, -523, 490, 236, 70, -128,
- -33, -161, -364, -148, 757, 516, 250, 43, -65,
- -34, -193, -244, 750, 527, 349, 234, 172, 134,
- -64, -223, -379, 55, 28, 248, 793, 442, 320,
- 29, -85, -298, -622, -888, 127, 206, 387, 460,
- -48, -170, -477, -876, 573, 635, 440, 375, 311,
- 42, 3, -212, -441, -718, -821, 388, 373, 211,
- -106, -155, 1092, 459, 570, 561, 506, 604, 514,
- -144, -264, 0, 460, 619, 877, 916, 1273, 921
-};
-
-/*-------------------------------------------------------------------*
- * 1nd stage, 2nd split: ISF9 to ISF15
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) */
-const Word16 dico2_isf_fx[] =
-{/*Qlog2(2.56)*/
- 1357, 1313, 1136, 784, 438, 181, 145,
- 636, 648, 667, 568, 442, 217, 362,
- 427, 440, 674, 524, 332, 117, -417,
- 121, 295, 468, 465, 230, 44, -221,
- -147, -240, 149, 80, 390, 278, 106,
- -418, -556, 552, 511, 235, 144, -95,
- 43, 193, 274, 150, 67, 34, -273,
- -43, -126, 171, 416, 282, 63, -354,
- -372, -86, -344, -108, -94, -182, -89,
- -600, -840, -200, 465, 258, -11, -253,
- -48, 329, 97, -290, -543, -795, -354,
- -570, -117, 187, 10, -133, -416, -76,
- -618, -129, -247, -371, 45, -76, 277,
- -1022, -1079, 126, 474, 254, 127, 52,
- -281, 76, -167, -361, -283, -551, -283,
- -119, -52, -1, 134, -32, -204, -415,
- 1064, 827, 637, 684, 464, 209, 12,
- 482, 416, 449, 371, 335, 294, 194,
- 719, 576, 365, 135, 113, 91, -199,
- 298, 176, 493, 366, 194, 163, 36,
- -35, -236, -259, -36, -4, 99, 152,
- -98, -306, -27, 228, 90, 111, -86,
- 91, 13, -211, -258, -106, 86, -64,
- 73, -35, -57, -31, 162, 35, -192,
- -109, -335, -629, -66, -61, -128, 322,
- -495, -669, -728, 193, 31, -220, 122,
- 324, 95, -89, -91, -409, -710, -154,
- 0, -234, 92, 33, -343, -609, -220,
- -343, -408, -476, -655, -153, 82, 222,
- -490, -745, -255, 49, -48, 135, -127,
- 119, -67, -328, -390, -272, -545, -56,
- -57, -130, -10, -7, -164, -47, -22,
- 984, 1064, 961, 568, 210, -27, 16,
- 811, 691, 754, 514, 224, -35, 166,
- 662, 704, 618, 386, 57, -211, -257,
- 510, 359, 418, 393, 91, -144, -18,
- -193, -31, -27, 223, 89, -143, 24,
- -112, -98, 471, 319, 185, 3, 175,
- 252, 146, -47, 272, 48, -211, -234,
- 146, 69, 203, 364, 68, -52, 51,
- -259, -478, -697, -349, -758, -501, 63,
- -501, -769, -289, 79, -311, -497, -106,
- 251, 53, -235, -469, -895, -884, 145,
- -416, -551, 140, -133, -523, -775, 44,
- -326, -423, -713, -497, -86, -431, 99,
- -757, -772, -160, -76, -46, -32, 379,
- 85, -35, -200, -401, -663, -1040, -247,
- -180, -330, -92, -376, 27, -183, -110,
- 1279, 1086, 781, 502, 324, 164, 157,
- 682, 466, 449, 277, 146, 28, 409,
- 635, 472, 390, 107, -232, -538, -139,
- 196, 396, 332, 213, 209, -29, -81,
- 150, -95, -312, 76, -77, -320, -50,
- 46, 9, 47, 175, 139, 30, 384,
- 218, 206, -24, -250, -96, -276, -183,
- 26, 119, 38, 14, -4, -133, -52,
- -477, -614, -987, -715, -631, -813, 200,
- -744, -1009, -1065, -745, -631, -171, 18,
- -137, -251, -483, -613, -980, -1203, 12,
- -605, -767, -562, -686, -1088, -515, 58,
- -202, -428, -782, -1072, -96, -234, -179,
- -480, -709, -1070, -897, -131, -92, 321,
- -145, -193, -512, -729, -572, -765, -210,
- -331, -585, -525, -631, -281, -208, -303,
- 1165, 1104, 939, 828, 716, 426, 155,
- 6, -109, 820, 778, 415, 113, -27,
- 381, 339, 314, 265, 121, -9, -474,
- -373, 47, 584, 442, 99, -231, -113,
- -496, -38, -285, 262, 305, 170, 4,
- -587, -556, 69, 66, 471, 354, 13,
- -138, 70, -18, 106, 67, 167, -302,
- -445, -141, 185, 191, 151, 83, -133,
- -257, -521, -720, -198, 134, -46, -182,
- -819, -1168, -777, 512, 359, 95, -113,
- 137, -2, -74, -138, -401, -114, -371,
- -242, -466, 204, 223, -31, -212, -192,
- -532, -637, -466, -686, 256, 277, -139,
- -1141, -1244, -381, -75, -54, 14, 88,
- -311, 115, -143, -499, -343, 124, -416,
- -616, -147, -135, 43, -4, 121, -369,
- 835, 783, 641, 390, 355, 350, 64,
- 72, 194, 443, 467, 436, 219, 372,
- 464, 369, 192, 4, -156, -72, -226,
- 57, 206, 303, 205, 188, 101, 265,
- -40, -205, -488, -184, 276, 64, -26,
- -217, -433, -297, 137, 328, 308, -289,
- 378, 81, -308, -465, 57, -37, 227,
- -100, 24, -36, -151, 199, 8, 143,
- -426, -697, -1059, -133, 388, 161, 321,
- -644, -1023, -1271, 39, 66, -123, 70,
- 372, 177, -173, -556, -553, -304, -189,
- -117, -369, -425, -122, -462, -152, -73,
- -649, -850, -1189, -767, 497, 360, 222,
- -798, -1139, -1455, -190, 430, 234, 179,
- 42, -94, -405, -692, 38, -202, -246,
- -169, -366, -290, -88, -64, 32, -292,
- 1010, 923, 938, 710, 465, 230, 342,
- 217, 300, 1054, 675, 68, -458, -179,
- 78, 453, 316, 18, -237, -496, -243,
- 167, 21, 424, 215, -91, -303, -170,
- -290, -81, -70, -67, 40, 54, -59,
- -353, -427, -90, 53, 94, 9, 54,
- -28, 318, 283, 15, -240, -58, 79,
- -75, -121, 229, 35, 58, 6, -133,
- -351, -514, -744, -834, -705, -137, 164,
- -1124, -1388, -1055, -230, -73, 40, 36,
- -163, -233, -532, -785, -1170, -697, 96,
- -788, -959, -246, -430, -624, -165, -8,
- -856, -540, -630, -907, -337, -70, 76,
- -937, -1042, -659, -733, -208, 199, -26,
- -523, 78, -98, -501, -869, -890, -81,
- -624, -703, -45, -348, -25, 87, -186,
- 1005, 823, 546, 249, 90, -22, 207,
- 298, 397, 381, 319, 200, 62, 303,
- 473, 379, 133, -247, -632, -441, 75,
- 284, 208, 391, 115, -25, 44, 95,
- -72, 79, -95, -63, -129, -293, 203,
- -164, -349, 115, 122, 69, -1, 378,
- 348, 170, 99, 58, -179, -302, 188,
- -190, -2, 150, 23, -51, -11, 216,
- -615, -863, -1090, -1427, -802, -48, -6,
- -961, -1276, -1548, -727, -58, 56, 223,
- -124, -255, -561, -988, -1277, -148, -82,
- -480, -660, -891, -1191, -1339, -325, 20,
- -621, -917, -1296, -1350, 264, 289, 50,
- -844, -1022, -1345, -1329, -293, 46, 278,
- -260, -468, -829, -1176, -533, -560, -78,
- -215, -484, -822, -1233, -791, 15, -138,
- 1301, 1317, 1262, 1048, 716, 357, -64,
- 578, 824, 925, 802, 630, 362, 102,
- 470, 925, 767, 514, 327, 190, -112,
- 225, 492, 495, 437, 598, 384, -45,
- 43, 82, -42, 175, 519, 342, -64,
- -304, -154, 159, 576, 403, 221, 327,
- 214, 244, 122, -62, 312, 92, -160,
- 218, 208, 310, 268, 306, 323, -199,
- -285, -269, -79, -124, -143, -153, 236,
- -205, -384, -426, 344, 59, -185, -184,
- -272, 247, 126, -210, -518, -468, 78,
- -99, -120, 502, 160, -280, -557, 304,
- -423, -17, -283, -443, 215, 212, -140,
- -564, -684, -228, 510, 361, 130, 323,
- -428, 335, 98, -65, 36, -215, -246,
- -362, 51, 364, -16, -234, 150, -165,
- 914, 883, 751, 653, 676, 464, -153,
- 631, 545, 535, 720, 596, 360, -81,
- 783, 712, 512, 439, 341, 251, -391,
- 497, 417, 249, 372, 295, 173, -193,
- 128, -110, -385, 93, 39, 173, -231,
- 216, -59, -253, 462, 389, 154, 69,
- 455, 270, -4, -337, -49, 233, -322,
- 307, 143, 53, 218, 128, 236, -156,
- -37, -186, -240, -411, -110, 9, 399,
- -140, -365, -628, 258, 380, 214, 277,
- 131, 454, 177, -285, -520, 108, -214,
- 77, -141, 201, -123, -490, -131, 60,
- -14, -194, -521, -741, 273, 362, -33,
- -362, -566, -287, -228, 161, 237, 317,
- -269, 195, -75, -375, -204, 11, 77,
- -128, -264, -156, -223, -475, 265, 27,
- 1238, 1147, 916, 689, 432, 210, -280,
- 800, 664, 879, 726, 411, 160, -164,
- 454, 686, 536, 275, 147, 46, 111,
- 303, 486, 512, 355, 241, 181, -69,
- 79, 92, 29, 147, 233, 52, 17,
- -171, 289, 131, 439, 271, 3, -10,
- 413, 241, 144, 174, 155, -2, 14,
- 58, 217, 247, 219, 149, 175, -18,
- 228, -8, -240, -206, -513, -191, 202,
- -96, -272, -454, 33, -300, -575, 46,
- -10, -108, -246, -347, -770, -535, 9,
- -326, -430, -61, -321, -704, -299, 201,
- -1, -280, -603, -419, -185, 18, -36,
- -516, -522, -379, -291, -181, -97, 27,
- -159, -313, -525, -224, -510, -831, -197,
- -292, -459, -59, -310, -562, -143, -351,
- 1066, 912, 631, 389, 207, 86, -224,
- 596, 512, 596, 505, 314, 122, -48,
- 787, 861, 441, -93, -303, 33, -190,
- 257, 469, 337, 51, 15, 298, -93,
- 295, 73, -119, 25, 36, 23, 108,
- -28, -3, -32, 114, 21, 185, 107,
- 482, 305, 15, -279, -319, 52, 96,
- 226, 46, 115, 72, -136, 133, -125,
- 18, -207, -559, -590, -503, -482, 321,
- -571, -789, -951, -172, -441, -538, 113,
- 181, 14, -310, -641, -1001, -202, 159,
- -136, -393, -433, -513, -911, -144, -22,
- 72, -265, -706, -954, -159, 53, 332,
- -338, -591, -852, -383, -395, 56, 44,
- 43, -158, -464, -897, -631, -157, -294,
- -161, -128, -328, -573, -483, -125, 11,
- 1017, 906, 1051, 1005, 679, 341, -102,
- 359, 334, 1567, 1314, 723, 105, 10,
- -65, 726, 529, 301, 220, 43, -273,
- -510, 436, 719, 566, 358, 179, 114,
- -560, 298, 133, -120, 342, 225, 14,
- -899, -101, 217, 617, 400, 146, -58,
- -41, 352, 82, -196, 39, 121, -167,
- -212, 59, 447, 284, 423, 250, -169,
- -371, -484, -596, 30, -41, 249, 22,
- -372, -650, -794, 477, 445, 216, -79,
- -352, 275, 17, -443, -929, 92, 19,
- -699, -696, 431, 264, -49, -310, 182,
- -978, -217, -430, -400, 101, 261, 72,
- -929, -889, -357, -13, 463, 378, 236,
- -826, 56, 30, -299, -360, -128, -51,
- -878, -299, -111, 75, 65, 36, 3,
- 817, 368, -25, 354, 697, 591, -173,
- 309, 212, 222, 751, 484, 140, -56,
- 593, 379, 70, -8, 258, 180, 110,
- 165, -46, 255, 297, 219, 273, 105,
- 160, -70, -358, -181, 379, 330, 319,
- -238, -369, -198, 740, 580, 319, -143,
- 201, 109, -202, -456, 328, 276, -141,
- 203, 170, 111, 42, 207, 360, 188,
- -345, -399, -513, -233, 650, 422, 81,
- -635, -961, -1220, 463, 539, 204, 209,
- 202, -25, -194, -498, -787, 193, -143,
- -449, -538, 195, -106, -331, 68, 62,
- -228, -477, -840, -576, 317, 128, 283,
- -671, -937, -807, -114, 391, 335, -62,
- 246, 2, -314, -679, -303, 180, -88,
- -107, -272, 90, -198, -28, 290, -112,
- 885, 1149, 1021, 712, 496, 281, -83,
- 269, 492, 787, 643, 347, 70, 124,
- 336, 636, 499, 92, -229, -179, 191,
- 26, 402, 564, 340, 149, -11, 135,
- -440, 561, 470, 204, -72, -186, 140,
- -720, 14, 355, 229, 68, -133, 465,
- 110, 310, 103, 12, 106, 29, 158,
- -178, 113, 161, 142, 121, 115, 27,
- -651, -414, -645, -152, -164, -13, -429,
- -639, -944, -681, -104, -81, 52, -189,
- -663, -164, -316, -683, -954, -205, -83,
- -609, -669, -172, -517, -694, 283, -80,
- -646, -152, -383, -678, -246, -40, -143,
- -747, -796, -745, -390, -98, 43, 275,
- -599, -199, -398, -433, -436, -538, 31,
- -1107, -568, -376, -265, -126, -21, 1,
- 847, 573, 308, 392, 305, 101, 55,
- 273, 293, 201, 267, 346, 201, 123,
- 727, 480, 226, 2, -65, -138, 164,
- 273, 208, 173, 292, 12, 253, 174,
- 340, 207, 180, 88, 116, 46, 475,
- -460, -166, -30, 13, 110, 173, 396,
- 137, 88, 43, -137, -94, 34, 284,
- 96, -14, 226, 40, 63, 70, 130,
- -467, -735, -1012, -1174, -307, 305, -67,
- -612, -920, -1146, -567, -8, 92, -25,
- -182, -271, -492, -754, -857, 287, -75,
- -494, -787, -689, -683, -709, 137, -326,
- -288, -550, -903, -1105, 334, 321, -62,
- -354, -653, -834, -445, 1, 377, -152,
- -162, -306, -608, -937, -297, 247, -192,
- -234, -477, -244, -488, -266, 342, -332
-};
-
-/*-------------------------------------------------------------------*
- * AMR-WB ISF codebook - 46bits, 2 stages, 1st stage common with the
- * 36bit codebook,5 splits in the 2nd stage
- *
- * codebook vector dimension number of vectors
- * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
- * 2_1 3 64
- * 2_2 3 128
- * 2_3 3 128
- * 2_4 3 32
- * 2_5 4 32
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 1st split: ISF0 to ISF2
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) */
-const Word16 dico21_isf_46b_fx[] =
-{/*Qlog2(2.56)*/
- 329, 409, 249,
- -33, 505, 160,
- -29, -14, 582,
- -262, 127, 354,
- 145, 237, 175,
- -152, 245, 122,
- 27, 42, 340,
- -84, -93, 311,
- 285, 222, -156,
- 47, -43, -504,
- 234, 121, 385,
- 104, -317, 45,
- 176, 195, 8,
- 104, -59, -94,
- 177, 53, 192,
- -34, -127, 152,
- 570, 277, -34,
- -67, -329, -639,
- -157, -272, 462,
- -177, -462, 198,
- 322, 179, 115,
- -386, 171, 19,
- 19, -12, 195,
- -120, -252, 201,
- 304, 36, -336,
- -128, -221, -380,
- 171, -185, 296,
- -242, -312, 23,
- 198, 39, 16,
- -3, -177, -111,
- 111, -93, 76,
- -92, -223, 4,
- 177, 406, -44,
- -168, 380, -149,
- -4, 273, 331,
- -420, 513, 277,
- 21, 247, 47,
- -58, 131, -2,
- -3, 134, 180,
- -145, 40, 175,
- 189, 74, -145,
- -27, -45, -325,
- 370, -114, -21,
- -83, -415, -173,
- 77, 95, -51,
- -40, -30, -67,
- 71, 88, 86,
- -35, -98, 14,
- 69, 197, -334,
- -196, 79, -231,
- -348, -137, 218,
- -352, -89, -85,
- 47, 201, -130,
- -165, 37, -15,
- -43, 3, 86,
- -161, -108, 79,
- 83, 21, -237,
- -81, -149, -238,
- 150, -186, -251,
- -186, -249, -162,
- -19, 66, -139,
- -26, -50, -181,
- 24, 11, 0,
- -130, -105, -98
-};
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 2nd split: ISF3 to ISF5
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 46b, 2nd stage, 2st split (only in AMR-WB IO mode) */
-const Word16 dico22_isf_46b_fx[] =
-{/*Qlog2(2.56)*/
- -127, 310, 42,
- -242, 197, 5,
- -151, 84, -17,
- -214, 127, -149,
- -247, -131, 159,
- -268, -267, -95,
- -217, 1, -79,
- -271, -80, -185,
- -45, 436, 159,
- 165, 199, 391,
- -33, 81, 187,
- -66, -42, 355,
- -298, -57, 343,
- -108, -537, 226,
- -144, -23, 193,
- 176, -402, 87,
- 53, 296, 25,
- -84, 253, -104,
- -58, 105, -126,
- -169, 174, -314,
- -48, 44, -294,
- -164, -417, -242,
- -139, 3, -194,
- -155, -207, -211,
- 119, 322, 213,
- 333, 50, 380,
- 237, 247, -2,
- 466, -16, 201,
- 238, -255, -107,
- 67, -440, -149,
- 122, -88, -139,
- 88, -247, -73,
- -41, 231, 167,
- -62, 155, 16,
- -65, 16, 77,
- -68, -2, -63,
- -151, -300, 160,
- -18, -333, 54,
- -56, -94, 5,
- 2, -190, 14,
- 92, 148, 209,
- 108, 9, 272,
- 108, 35, 110,
- 142, -85, 145,
- 47, -157, 279,
- 3, -320, 246,
- 43, -72, 68,
- 86, -217, 135,
- 36, 140, 79,
- 56, 175, -49,
- 26, 45, 3,
- 73, 55, -101,
- 109, -183, -242,
- -4, -283, -242,
- 48, -68, -48,
- -6, -153, -122,
- 161, 196, 96,
- 232, 80, 190,
- 165, 97, 11,
- 258, -31, 71,
- 267, -77, -91,
- 311, -209, 87,
- 152, -14, -22,
- 150, -149, 9,
- -324, 557, 187,
- -384, 307, 46,
- -251, 27, 77,
- -365, 77, -52,
- -482, -84, 160,
- -424, -515, -64,
- -294, -120, -4,
- -476, -116, -109,
- -97, 318, 365,
- 106, 627, 445,
- -190, 120, 287,
- -146, 65, 619,
- -427, 242, 363,
- -361, -371, 432,
- -347, 102, 168,
- -629, 195, -14,
- -65, 476, -47,
- -297, 320, -168,
- -55, 356, -264,
- -391, 82, -286,
- -51, -31, -556,
- -178, -399, -586,
- -205, -49, -360,
- -343, -238, -337,
- 220, 457, 58,
- 561, 467, 259,
- 340, 270, -168,
- 450, 77, -280,
- 60, 167, -413,
- 133, -252, -492,
- 216, 157, -290,
- 282, 0, -495,
- -226, 293, 183,
- -157, 135, 122,
- -158, -59, 39,
- -133, -118, -97,
- -332, -309, 113,
- -160, -425, -6,
- -149, -211, 24,
- -80, -277, -90,
- -11, 125, 338,
- 130, -71, 465,
- 5, -45, 184,
- 237, -95, 253,
- -139, -197, 297,
- -19, -300, 511,
- -63, -152, 139,
- 250, -289, 336,
- 124, 339, -150,
- 34, 176, -208,
- 171, 166, -116,
- 94, 38, -229,
- 75, -65, -339,
- -78, -205, -385,
- 0, -30, -163,
- -56, -110, -242,
- 321, 244, 194,
- 505, 238, -1,
- 317, 116, 65,
- 309, 88, -74,
- 452, -51, -50,
- 334, -217, -290,
- 211, 41, -152,
- 238, -55, -260
-};
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 3rd split: ISF6 to ISF8
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 46b, 2nd stage, 3rd split (only in AMR-WB IO mode) */
-const Word16 dico23_isf_46b_fx[] =
-{/*Qlog2(2.56)*/
- -10, 151, 359,
- 136, 298, 223,
- 255, -104, 290,
- 423, 6, 183,
- -270, -269, -98,
- -52, -82, 13,
- -82, -274, -97,
- 90, -246, -72,
- -299, -70, 421,
- -88, 365, 430,
- 187, -318, 381,
- 380, 37, 488,
- -373, -316, 79,
- -308, -101, 5,
- -135, -451, 8,
- 72, -421, -154,
- 180, 170, -121,
- 62, 177, -40,
- 326, 80, -105,
- 248, 263, -5,
- -168, -181, -221,
- -2, -23, -158,
- -14, -149, -121,
- 119, -91, -147,
- 119, 332, -153,
- 49, 303, 34,
- 442, -55, -69,
- 217, 454, 58,
- -359, -187, -375,
- -42, 50, -274,
- -8, -267, -249,
- 85, -86, -346,
- -77, -40, 345,
- 89, 134, 219,
- 156, -80, 160,
- 108, 40, 116,
- -158, -206, 29,
- 5, -32, 175,
- -65, -158, 146,
- 55, -78, 73,
- -114, -222, 353,
- -47, 81, 211,
- 49, -151, 268,
- 105, 4, 302,
- -263, -132, 183,
- -151, -28, 201,
- -177, -307, 166,
- 101, -221, 130,
- 74, 58, -98,
- 32, 44, 13,
- 194, 30, -142,
- 170, 96, 8,
- -136, -119, -91,
- -65, 8, -55,
- 3, -188, 12,
- 45, -63, -49,
- 149, -21, -19,
- 24, 144, 95,
- 254, -22, 60,
- 161, 196, 96,
- -158, -61, 48,
- -70, 33, 82,
- -23, -321, 58,
- 155, -147, 5,
- -364, 328, 77,
- -21, 453, 173,
- -108, 82, 630,
- 367, 263, 208,
- -300, -62, -176,
- -205, 143, -158,
- -169, -410, -264,
- 257, -269, -100,
- -636, 289, -2,
- -292, 627, 173,
- -382, -363, 387,
- 248, 524, 447,
- -521, -111, -107,
- -395, 118, -274,
- -343, -680, -125,
- -172, -447, -663,
- 75, 148, -367,
- -79, 263, -94,
- 249, 148, -286,
- 380, 271, -162,
- -142, -4, -186,
- -57, 111, -125,
- -35, -108, -254,
- 100, 29, -242,
- -80, 303, -264,
- -78, 464, -57,
- 248, -22, -494,
- 661, 662, 44,
- -193, -40, -330,
- -178, 145, -337,
- -90, -199, -400,
- -40, -23, -498,
- -192, 114, 315,
- -41, 244, 190,
- 88, -97, 485,
- 241, 80, 212,
- -246, 40, 87,
- -156, 147, 134,
- -2, -334, 239,
- 308, -203, 110,
- -459, 251, 422,
- -218, 310, 228,
- -86, -346, 654,
- 184, 175, 425,
- -481, -63, 169,
- -349, 117, 188,
- -125, -560, 310,
- 158, -416, 94,
- 46, 171, -192,
- -63, 157, 14,
- 256, -35, -271,
- 322, 123, 53,
- -214, 4, -76,
- -156, 86, -18,
- 128, -197, -232,
- 265, -90, -98,
- -308, 332, -145,
- -131, 308, 58,
- 509, 59, -339,
- 562, 196, -14,
- -378, 100, -47,
- -234, 202, 1,
- 104, -270, -493,
- 319, -210, -325
-};
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 4th split: ISF9 to ISF11
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 46b, 2nd stage, 4th split (only in AMR-WB IO mode) */
-const Word16 dico24_isf_46b_fx[] =
-{/*Qlog2(2.56)*/
- -79, -89, -4,
- -171, 77, -211,
- 160, -193, 98,
- 120, -103, 323,
- 32, -22, -129,
- 72, 78, -268,
- 182, -76, -66,
- 309, 99, -145,
- -229, -157, -84,
- -383, 98, -71,
- -90, -352, 12,
- -284, -178, 178,
- -65, -125, -166,
- -87, -175, -351,
- 42, -198, -48,
- 154, -140, -243,
- -77, 18, 108,
- -39, 355, 91,
- 87, 8, 155,
- -4, 158, 239,
- 128, 95, -54,
- 7, 246, -124,
- 258, 15, 89,
- 206, 216, 98,
- -201, 9, 18,
- -312, 233, 204,
- -39, -174, 155,
- -144, -9, 284,
- -57, 70, -69,
- -157, 187, 18,
- 54, -30, 23,
- 24, 135, 55
-};
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 1st split: ISF12 to ISF15
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) */
-const Word16 dico25_isf_46b_fx[] =
-{/*Qlog2(2.56)*/
- 169, 142, -119, 115,
- 206, -20, 94, 226,
- -106, 313, -21, 16,
- -62, 161, 71, 255,
- -89, 101, -185, 125,
- 72, -30, -201, 344,
- -258, 33, -8, 81,
- -104, -154, 72, 296,
- 144, -68, -268, -25,
- 81, -78, -87, 106,
- 22, 155, -186, -119,
- -46, -28, 27, 91,
- -114, -37, -175, -33,
- -94, -222, -189, 122,
- -132, -119, -191, -270,
- -172, -173, 18, -43,
- 279, 135, -42, -128,
- 187, -86, 229, -138,
- 159, 240, 140, 46,
- 69, 25, 227, 77,
- 21, 115, 13, 8,
- 68, -248, 126, 81,
- -150, 137, 207, -9,
- -154, -133, 289, 67,
- 143, -37, -86, -326,
- 180, -32, 19, -23,
- 26, 168, 116, -233,
- -32, -26, 118, -78,
- 3, -8, -45, -115,
- 57, -215, -54, -83,
- -209, 112, -22, -167,
- -91, -151, 168, -262
-};
-
-
-/*-------------------------------------------------------------------*
- * AMR-WB ISF codebook - 36bits, 2 stages, 1st stage common with the
- * 46bit codebook,3 splits in the 2nd stage
- *
- * codebook vector dimension number of vectors
- * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
- * 2_1 5 128
- * 2_2 4 128
- * 2_3 7 64
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 1st split: ISF0 to ISF4
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) */
-const Word16 dico21_isf_36b_fx[] =
-{/*Qlog2(2.56)*/
- -52, -96, 212, 315, -73,
- 82, -204, 363, 136, -197,
- -126, -331, 183, 218, 143,
- -49, -41, 557, 230, 72,
- 2, -73, 163, 377, 221,
- 133, 111, 278, 215, -110,
- -102, -20, 284, 113, 273,
- 84, 319, 290, 18, 85,
- -25, -5, 125, 132, -204,
- -38, -5, 286, -9, -356,
- -140, -256, 92, 117, -189,
- -144, 191, 313, 51, -98,
- 167, -10, 44, 247, 36,
- 381, 197, 238, 74, 6,
- 38, -408, 29, -3, -85,
- 92, 266, 157, -25, -200,
- 161, -121, 70, 84, -140,
- -16, -86, 112, -94, -189,
- -269, -270, 351, 107, -24,
- -68, -67, 492, -103, -155,
- -53, -131, 62, 122, 10,
- 135, 84, 283, -55, -120,
- -12, -219, 331, -81, 167,
- 220, -136, 147, -172, -42,
- 140, -95, -109, -88, -194,
- 0, -2, -4, -33, -381,
- -66, -217, 152, -186, -402,
- 244, 108, 156, -140, -395,
- 113, -136, -196, 110, -24,
- 214, 118, 11, -64, -131,
- -110, -286, -6, -332, 16,
- 94, 97, 79, -291, -205,
- -5, -39, -20, 252, -96,
- 76, 174, 101, 163, 61,
- -69, -239, -55, 399, 6,
- -115, 319, 164, 275, 196,
- -15, 36, -47, 331, 121,
- 226, 209, 271, 325, 184,
- 13, -80, -218, 471, 353,
- 288, 378, 16, -51, 251,
- 174, 116, 52, 149, -279,
- 235, 276, 39, 120, -48,
- 0, -108, -108, 241, -339,
- -93, 534, 45, 33, -87,
- 194, 149, -71, 405, -44,
- 409, 370, 81, -186, -154,
- 25, -102, -448, 124, -173,
- 22, 408, -110, -310, -214,
- -26, 23, -83, 114, 14,
- -110, 164, 52, 223, -82,
- 37, -25, -263, 306, -15,
- -466, 415, 292, 165, -18,
- 29, -19, -171, 155, 182,
- 179, 144, -27, 231, 258,
- -103, -247, -396, 238, 113,
- 375, -154, -109, -4, 156,
- 98, 85, -292, -5, -124,
- 116, 139, -116, -98, -294,
- -14, -83, -278, -117, -378,
- 106, 33, -106, -344, -484,
- 119, 17, -412, 138, 166,
- 384, 101, -204, 88, -156,
- -121, -284, -300, -1, -166,
- 280, 33, -152, -313, -81,
- -37, 22, 229, 153, 37,
- -60, -83, 236, -8, -41,
- -169, -228, 126, -20, 363,
- -235, 17, 364, -156, 156,
- -25, -30, 72, 144, 156,
- 153, -26, 256, 97, 144,
- -21, -37, 48, -65, 250,
- 63, 77, 273, -128, 124,
- -129, -26, 40, 9, -115,
- -6, 82, 38, -90, -182,
- -336, -13, 28, 158, 91,
- -30, 241, 137, -170, -17,
- 146, 14, -11, 33, 61,
- 192, 197, 54, -84, 85,
- 23, -200, -78, -29, 140,
- 122, 237, 106, -341, 136,
- -57, -142, -85, -16, -74,
- -59, -90, -8, -187, -20,
- -211, -267, 216, -179, -110,
- -50, -7, 220, -267, -70,
- -57, -42, -17, -15, 71,
- 32, 21, 63, -137, 33,
- -137, -175, 104, -68, 97,
- -67, -43, 133, -301, 221,
- -116, -200, -81, -92, -272,
- -64, -41, -54, -244, -220,
- -287, -242, -50, -87, -89,
- -245, 236, 102, -166, -295,
- 66, 24, -162, -71, 95,
- 66, 136, -90, -220, -36,
- -98, -161, -222, -188, 29,
- -18, 18, -19, -415, 9,
- 49, 61, 100, 39, -56,
- -111, 82, 135, -31, 52,
- -90, -153, -93, 189, 182,
- -214, 295, 119, -74, 284,
- 2, 137, 37, 47, 182,
- 92, 117, 184, -53, 373,
- -21, -14, -35, 136, 391,
- 146, 129, -164, -28, 333,
- 92, 80, -84, 100, -134,
- -8, 217, -32, 3, -47,
- -151, 251, -215, 142, 92,
- -224, 310, -172, -275, 98,
- 159, 155, -177, 112, 53,
- 205, 27, 8, -240, 192,
- 169, 120, -319, -201, 106,
- 11, 36, -86, -237, 455,
- -109, -154, -163, 174, -55,
- -38, 32, -101, -78, -59,
- -205, -321, -97, 69, 79,
- -310, 44, 18, -185, 34,
- -115, -20, -148, -39, 203,
- -29, 154, -30, -158, 166,
- -45, -131, -317, -24, 363,
- -165, -205, -112, -222, 265,
- -32, -44, -150, 54, -193,
- -6, -38, -255, -169, -115,
- -266, 87, -189, -36, -169,
- -60, -87, -266, -436, -170,
- -68, -81, -278, 24, 38,
- -23, -19, -155, -256, 141,
- -61, -226, -565, -175, 71,
- 9, -29, -237, -515, 263
-};
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 2nd split: ISF5 to ISF8
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) */
-
-const Word16 dico22_isf_36b_fx[] =
-{/*Qlog2(2.56)*/
- -298, -6, 95, 31,
- -213, -87, -122, 261,
- 4, -49, 208, 14,
- -129, -110, 30, 118,
- -214, 258, 110, -235,
- -41, -18, -126, 120,
- 103, 65, 127, -37,
- 126, -36, -24, 25,
- -138, -67, -278, -186,
- -164, -194, -201, 78,
- -211, -87, -51, -221,
- -174, -79, -94, -39,
- 23, -6, -157, -240,
- 22, -110, -153, -68,
- 148, -5, -2, -149,
- -1, -135, -39, -179,
- 68, 360, -117, -15,
- 137, 47, -278, 146,
- 136, 260, 135, 65,
- 61, 116, -45, 97,
- 231, 379, 87, -120,
- 338, 177, -272, 3,
- 266, 156, 28, -69,
- 260, 84, -85, 86,
- -266, 154, -256, -182,
- -17, -65, -304, -6,
- -40, 175, -151, -180,
- -27, 27, -87, -63,
- 121, 114, -166, -469,
- 159, -66, -323, -231,
- 214, 152, -141, -212,
- 137, 36, -184, -51,
- -282, -237, 40, 10,
- -48, -235, -37, 251,
- -54, -323, 136, 29,
- -88, -174, 213, 198,
- -390, 99, -63, -375,
- 107, -169, -164, 424,
- 69, -111, 141, -167,
- 74, -129, 65, 144,
- -353, -207, -205, -109,
- -160, -386, -355, 98,
- -176, -493, -20, -143,
- -252, -432, -2, 216,
- -90, -174, -168, -411,
- 13, -284, -229, -160,
- -87, -279, 34, -251,
- -75, -263, -58, -42,
- 420, 53, -211, -358,
- 384, -35, -374, 396,
- 68, -228, 323, -2,
- 167, -307, 192, 194,
- 459, 329, -5, -332,
- 375, 79, -7, 313,
- 282, -124, 200, -92,
- 271, -162, -70, 180,
- -157, -298, -514, -309,
- 58, -163, -546, 18,
- 124, -364, 167, -238,
- 83, -411, -117, 96,
- 140, -112, -388, -624,
- 259, -133, -317, 41,
- 163, -130, -64, -334,
- 226, -165, -124, -110,
- -466, -61, 6, 229,
- -153, 205, -145, 242,
- -159, 48, 195, 148,
- -58, 28, 31, 279,
- -303, 185, 279, -4,
- -61, 197, 59, 86,
- -114, 123, 168, -52,
- 35, 36, 100, 126,
- -407, 102, -77, -40,
- -338, -1, -342, 156,
- -179, 105, -34, -97,
- -185, 84, -35, 108,
- -133, 107, -91, -357,
- -180, 54, -229, 24,
- -44, 47, 47, -182,
- -66, 13, 45, 4,
- -339, 251, 64, 226,
- -42, 101, -350, 275,
- -99, 398, 142, 121,
- 111, 12, -102, 260,
- 0, 505, 260, -94,
- 161, 285, -96, 224,
- -4, 206, 314, 33,
- 167, 139, 88, 204,
- -235, 316, -60, -25,
- -8, -150, -312, 201,
- -36, 292, 61, -104,
- -40, 174, -162, 42,
- -21, 402, -29, -351,
- 21, 152, -360, -93,
- 57, 191, 212, -196,
- 76, 158, -21, -69,
- -328, -185, 331, 119,
- -53, 285, 56, 337,
- -107, -24, 405, 29,
- -18, 137, 272, 277,
- -255, 22, 173, -191,
- 295, 322, 325, 302,
- 21, -27, 332, -178,
- 119, 13, 271, 129,
- -455, -180, 116, -191,
- -227, 62, -148, 524,
- -176, -287, 282, -157,
- -243, 13, 199, 430,
- -59, -49, 115, -365,
- 72, -172, -137, 93,
- -138, -126, 141, -84,
- 5, -124, 38, -20,
- -258, 311, 601, 213,
- 94, 130, -61, 502,
- -1, -157, 485, 313,
- 146, -74, 158, 345,
- 276, 135, 280, -57,
- 490, 252, 99, 43,
- 267, -74, 429, 105,
- 278, -23, 119, 94,
- -542, 488, 257, -115,
- -84, -244, -438, 478,
- -113, -545, 387, 101,
- -95, -306, 111, 498,
- 95, 166, 22, -301,
- 420, -15, -58, -78,
- 270, 29, 122, -282,
- 160, -240, 50, -38
-};
-
-/*-------------------------------------------------------------------*
- * 2nd stage, 3rd split: ISF9 to ISF15
- *-------------------------------------------------------------------*/
-
-/* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) */
-const Word16 dico23_isf_36b_fx[] =
-{/*Qlog2(2.56)*/
- 81, -18, 68, -27, -122, -280, -4,
- 45, -177, 209, -30, -136, -74, 131,
- -44, 101, -75, -88, -48, -137, -54,
- -245, -28, 63, -18, -112, -103, 58,
- -79, -6, 220, -65, 114, -35, -50,
- 109, -65, 143, -114, 129, 76, 125,
- 166, 90, -61, -242, 186, -74, -43,
- -46, -92, 49, -227, 24, -155, 39,
- 67, 85, 99, -42, 53, -184, -281,
- 142, -122, 0, 21, -142, -15, -17,
- 223, 92, -21, -48, -82, -14, -167,
- 51, -37, -243, -30, -90, 18, -56,
- 54, 105, 74, 86, 69, 13, -101,
- 196, 72, -89, 43, 65, 19, 39,
- 121, 34, 131, -82, 25, 213, -156,
- 101, -102, -136, -21, 57, 214, 22,
- 36, -124, 205, 204, 58, -156, -83,
- 83, -117, 137, 137, 85, 116, 44,
- -92, -148, -68, 11, -102, -197, -220,
- -76, -185, -58, 132, -26, -183, 85,
- -7, -31, -2, 23, 205, -151, 10,
- -27, -37, -5, -18, 292, 131, 1,
- 117, -168, 9, -93, 80, -59, -125,
- -182, -244, 98, -24, 135, -22, 94,
- 221, 97, 106, 42, 43, -160, 83,
- 25, -64, -21, 6, 14, -15, 154,
- 126, 15, -140, 150, -10, -207, -114,
- 79, -63, -211, -70, -28, -217, 165,
- 46, 38, -22, 281, 132, -62, 109,
- 112, 54, -112, -93, 208, 27, 296,
- 115, 10, -147, 41, 216, 42, -276,
- 50, -115, -254, 167, 117, -2, 61,
- 17, 144, 34, -72, -186, -150, 272,
- -29, -66, -89, -95, -149, 129, 251,
- 122, 0, -50, -234, -91, 36, 26,
- -105, -102, -88, -121, -236, -7, -11,
- -204, 109, 5, -191, 105, -15, 163,
- -80, 32, -24, -209, 41, 294, 70,
- -106, -94, -204, -118, 120, -50, -37,
- -82, -241, 46, -131, -29, 150, -55,
- 33, 155, 120, -89, -8, 7, 62,
- 213, 82, 61, 18, -161, 144, 152,
- 30, 131, 65, -87, -255, -17, -107,
- -8, 85, -64, 51, -162, 223, -53,
- -134, 261, 69, -56, 218, 72, -111,
- 2, 155, -113, -87, 49, 85, -28,
- -163, 42, -1, -196, 7, 39, -245,
- 14, -137, -79, 11, -160, 202, -293,
- -94, 33, 208, 100, 56, -44, 326,
- -78, -41, 232, 13, -142, 227, 80,
- -16, -87, 201, 33, -133, 15, -183,
- -58, -192, -47, 184, -128, 133, 99,
- -205, 11, -155, 78, 52, 72, 141,
- -246, 26, 99, 151, 59, 115, -64,
- -79, -47, -16, -14, 6, 47, -43,
- -72, -178, -27, 162, 112, 43, -174,
- -175, 238, 186, 71, -54, -188, -76,
- -225, 233, 39, -39, -158, 122, 44,
- -26, 43, 84, 130, -93, -51, 22,
- 3, 92, -150, 136, -182, -57, 97,
- -131, 179, -78, 80, 91, -165, 90,
- -2, 148, 15, 130, 65, 175, 117,
- -138, 114, -137, 132, 3, -10, -186,
- 140, -4, -37, 254, -62, 92, -109
-};
-
-/*-------------------------------------------------------------------*
- * AMR-WB ISF codebook for SID - 28bits, 1 stage, 5 splits
- *
- * codebook vector dimension number of vectors
- * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
- * 1 2 64
- * 2 3 64
- * 3 3 64
- * 4 4 32
- * 5 4 32
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * 1st stage, 1st split: ISF0 to ISF1
- *-------------------------------------------------------------------*/
-
-/* ISF codebook for SID frames - 28b, 1st split */
-const Word16 dico1_ns_28b_fx[] =
-{/*Qlog2(2.56)*/
- -269, -673,
- -222, -537,
- -233, -430,
- -138, -451,
- -212, -331,
- -192, -241,
- -87, -231,
- -191, -128,
- -70, -106,
- -164, -6,
- 74, -179,
- 27, -33,
- -102, 74,
- -162, 115,
- -94, 172,
- -6, 130,
- -143, 234,
- 14, 218,
- -65, 270,
- 88, 182,
- -124, 341,
- -44, 381,
- 38, 335,
- 117, 274,
- -112, 454,
- 74, 431,
- -5, 488,
- 175, 384,
- -83, 561,
- 122, 529,
- 21, 601,
- 229, 481,
- 231, 303,
- 226, 608,
- 300, 372,
- 210, 187,
- 306, 265,
- 328, 473,
- 382, 331,
- 371, 132,
- 139, 58,
- 365, 21,
- 250, -82,
- 443, 218,
- 483, 110,
- 426, 415,
- 579, 222,
- 518, 333,
- 573, 448,
- 455, 529,
- 685, 329,
- 332, 580,
- 595, 593,
- 468, 645,
- 762, 517,
- 326, 709,
- 485, 793,
- 130, 684,
- 671, 737,
- 354, 876,
- 88, 806,
- -65, 706,
- -35, 1016,
- 266, 1123
-};
-
-/*-------------------------------------------------------------------*
- * 1st stage, 2ndt split: ISF2 to ISF4
- *-------------------------------------------------------------------*/
-
-/* ISF codebook for SID frames - 28b, 2nd spilt */
-const Word16 dico2_ns_28b_fx[] =
-{/*Qlog2(2.56)*/
- -824, -884, -949,
- -805, -456, -418,
- -442, -438, -541,
- -217, -578, -793,
- -168, -444, -582,
- -287, -492, -274,
- -552, -297, -300,
- -163, -333, -358,
- -370, -232, -232,
- -175, -358, -159,
- -381, -21, -357,
- -184, -159, -162,
- -53, -191, -280,
- 18, -267, -215,
- -138, 61, -283,
- 71, -95, -294,
- 13, -156, -546,
- 0, -83, -79,
- 44, 97, -316,
- 178, -52, -213,
- 222, -261, -422,
- 237, -118, -44,
- 141, 145, -132,
- 363, 81, -287,
- 213, 65, 34,
- -107, 94, -5,
- 91, -29, 126,
- -355, 51, -41,
- -219, -76, 145,
- -63, 100, 244,
- -719, 44, 27,
- -572, -124, 155,
- -423, 133, 315,
- -917, 71, 224,
- -268, 318, 131,
- -93, -190, 420,
- -97, 122, 491,
- -79, 317, 355,
- 130, 100, 325,
- 86, -293, 210,
- 133, 258, 161,
- 176, -73, 465,
- 195, 300, 384,
- 348, 22, 221,
- 376, 183, 409,
- 377, 286, 202,
- 242, 213, 659,
- 257, 565, 248,
- 344, 408, -76,
- 405, 440, 509,
- 612, 385, 379,
- 536, 607, 216,
- -56, 582, 192,
- 100, 517, 567,
- -365, 448, 445,
- 728, 347, 10,
- 505, 357, 759,
- 636, 582, 658,
- 335, 517, 852,
- 378, 809, 572,
- -195, 878, 829,
- 529, 707, 987,
- 918, 726, 392,
- 1250, 997, 1063
-};
-
-/*-------------------------------------------------------------------*
- * 1st stage, 3rd split: ISF5 to ISF7
- *-------------------------------------------------------------------*/
-
-/* ISF codebook for SID frames - 28b, 3rd spilt */
-const Word16 dico3_ns_28b_fx[] =
-{/*Qlog2(2.56)*/
- -805, -838, -774,
- -522, -627, -828,
- -477, -486, -603,
- -295, -481, -634,
- -366, -384, -393,
- -186, -414, -396,
- -237, -394, -106,
- -252, -202, -275,
- -61, -177, -442,
- -84, -198, -199,
- -179, -125, -31,
- -72, -47, -163,
- -298, -220, 215,
- -64, -168, 251,
- -133, 156, -59,
- -30, -2, 127,
- 54, 66, -61,
- -233, 21, 251,
- 209, -50, 32,
- 33, 194, 136,
- -117, -18, 475,
- 202, 46, 309,
- 256, 185, 53,
- 35, 200, 390,
- 200, 263, 242,
- -216, 302, 294,
- 128, 358, 0,
- 19, 431, 287,
- 224, 447, 280,
- 367, 165, 213,
- 397, 314, 319,
- 383, 379, 75,
- 277, 325, 462,
- 394, 505, 334,
- 251, 98, -213,
- 450, 153, 448,
- 565, 226, 76,
- 470, 383, 502,
- 635, 390, 278,
- 237, 135, 620,
- 342, 401, 649,
- 331, 551, 518,
- 130, 418, 592,
- 531, 306, 737,
- 729, 389, 580,
- 497, 557, 699,
- 296, 383, 874,
- 283, 624, 759,
- 126, 622, 476,
- 559, 595, 472,
- 382, 770, 616,
- 719, 613, 745,
- 540, 639, 928,
- 517, 826, 801,
- 684, 811, 604,
- 752, 786, 857,
- 933, 661, 350,
- 694, 450, 1061,
- 562, 911, 1051,
- 824, 813, 1104,
- 758, 1047, 882,
- 1140, 917, 889,
- 1039, 1246, 1426,
- 1483, 1666, 1876
-};
-
-/*-------------------------------------------------------------------*
- * 1st stage, 4th split: ISF8 to ISF11
- *-------------------------------------------------------------------*/
-
-/* ISF codebook for SID frames - 28b, 4th spilt */
-const Word16 dico4_ns_28b_fx[] =
-{/*Qlog2(2.56)*/
- -776, -854, -891, -920,
- -552, -610, -663, -741,
- -321, -370, -476, -565,
- 274, -160, -456, 201,
- 265, 67, -160, -306,
- -8, -210, 79, 272,
- 163, 236, 307, 308,
- 578, 317, 64, 298,
- -9, 197, 342, 620,
- 343, 232, 314, 622,
- 173, 149, 548, 527,
- 356, 370, 481, 376,
- 135, 444, 488, 556,
- 391, 471, 487, 653,
- 228, 424, 576, 835,
- 422, 372, 722, 682,
- 295, 673, 693, 635,
- 539, 596, 590, 449,
- 475, 618, 659, 818,
- 735, 517, 491, 673,
- 602, 346, 257, 877,
- 625, 635, 849, 720,
- 727, 818, 698, 595,
- 653, 481, 690, 1139,
- 814, 762, 704, 908,
- 507, 747, 898, 936,
- 848, 855, 924, 785,
- 646, 1037, 882, 795,
- 772, 845, 1024, 1151,
- 1133, 983, 818, 921,
- 940, 1068, 1252, 1302,
- 1588, 1767, 1718, 1513
-};
-
-/*-------------------------------------------------------------------*
- * 1st stage, 5th split: ISF12 to ISF15
- *-------------------------------------------------------------------*/
-
-/* ISF codebook for SID frames - 28b, 5th spilt */
-const Word16 dico5_ns_28b_fx[] =
-{/*Qlog2(2.56)*/
- -810, -879, -945, -254,
- 248, 184, 671, 128,
- 288, 703, 918, 99,
- 658, 558, 662, 219,
- 552, 585, 910, 208,
- 559, 804, 759, 119,
- 606, 774, 921, -139,
- 782, 761, 748, 208,
- 756, 708, 983, 56,
- 544, 864, 1010, 152,
- 737, 698, 987, 299,
- 771, 924, 879, 103,
- 536, 785, 961, 405,
- 667, 916, 801, 328,
- 738, 705, 773, 439,
- 823, 871, 992, 355,
- 640, 1004, 1052, 369,
- 724, 822, 949, 597,
- 415, 655, 729, 482,
- 1009, 896, 793, 363,
- 908, 803, 687, -25,
- 1016, 838, 1011, 189,
- 947, 1112, 942, 222,
- 914, 1049, 981, 527,
- 956, 987, 1011, -120,
- 781, 1049, 1121, 92,
- 1178, 1053, 884, 47,
- 1123, 1059, 1182, 118,
- 933, 972, 1277, 357,
- 1109, 918, 1101, 503,
- 1039, 1286, 1220, 317,
- 1351, 1207, 1010, 326
-}; /*1.28f Q1*/
-
-const Word16 means_nb_31bits_ma_lsf[16] = { 861 /*336.3281f*1.28f Q1*/, 1360 /*531.2500f*1.28f Q1*/, 2270 /*886.7188f*1.28f Q1*/, 3243 /*1266.7969f*1.28f Q1*/, 4171 /*1629.2969f*1.28f Q1*/, 5052 /*1973.4375f*1.28f Q1*/, 6012 /*2348.4375f*1.28f Q1*/, 6776 /*2646.8750f*1.28f Q1*/, 7676 /*2998.4375f*1.28f Q1*/, 8428 /*3292.1875f*1.28f Q1*/, 9194 /*3591.4062f*1.28f Q1*/, 9744 /*3806.2500f*1.28f Q1*/, 10580 /*4132.8125f*1.28f Q1*/, 11911 /*4652.7344f*1.28f Q1*/, 13440 /*5250.0000f*1.28f Q1*/, 15061 /*5883.2031f*1.28f Q1*/ };
-const Word16 means_wb_31bits_ma_lsf[16] = { 818 /*319.5312f*1.28f Q1*/, 1403 /*548.0469f*1.28f Q1*/, 2392 /*934.3750f*1.28f Q1*/, 3465 /*1353.5156f*1.28f Q1*/, 4429 /*1730.0781f*1.28f Q1*/, 5428 /*2120.3125f*1.28f Q1*/, 6414 /*2505.4688f*1.28f Q1*/, 7323 /*2860.5469f*1.28f Q1*/, 8304 /*3243.7500f*1.28f Q1*/, 9221 /*3601.9531f*1.28f Q1*/, 10162 /*3969.5312f*1.28f Q1*/, 11091 /*4332.4219f*1.28f Q1*/, 12125 /*4736.3281f*1.28f Q1*/, 13153 /*5137.8906f*1.28f Q1*/, 14241 /*5562.8906f*1.28f Q1*/, 15266 /*5963.2812f*1.28f Q1*/ };
-
-
-const Word16 *lsf_means[2] = { means_wb_31bits_ma_lsf, means_nb_31bits_ma_lsf };
-
-const lsp_unw_triplet p16_gamma0_92to1[16] = /* Q14 */
-{
- { 0, 19622, -9695 },
- { -14938, 29357, -13258 },
- { -8483, 23708, -13414 },
- { -7350, 22410, -12305 },
- { -7397, 21417, -12160 },
- { -7071, 19878, -11229 },
- { -7144, 19877, -11326 },
- { -6423, 17194, -9613 },
- { -7407, 18024, -9695 },
- { -6972, 16339, -8191 },
- { -8220, 17625, -8422 },
- { -8159, 17459, -8289 },
- { -8700, 19066, -9508 },
- { -7986, 17629, -8607 },
- { -8503, 17203, -8109 },
- { -7820, 14903, 0 }
-};
-
-const lsp_unw_triplet p16_gamma0_94to1[16] = /* Q14 */
-{
- { 0, 12931, -6314 },
- { -9364, 19577, -8870 },
- { -5512, 16236, -9305 },
- { -4892, 15366, -8398 },
- { -4869, 14631, -8275 },
- { -4631, 13358, -7540 },
- { -4575, 13271, -7599 },
- { -4151, 11403, -6385 },
- { -4859, 11947, -6371 },
- { -4504, 10805, -5407 },
- { -5346, 11618, -5515 },
- { -5418, 11578, -5424 },
- { -5806, 12711, -6226 },
- { -5205, 11592, -5606 },
- { -5745, 11498, -5188 },
- { -5473, 10245, 0 }
-};
-
-
-const Word16 dico_lsf_abs_8b[256 * M] = /*14Q1*1.28*/
-{
- 966, 1761, 2937, 3740, 4574, 5488, 6457, 7398, 8355, 9289, 10254, 11211, 12247, 13202, 14221, 15172,
- 1540, 2731, 3544, 4232, 5065, 5917, 6846, 7707, 8602, 9538, 10479, 11445, 12439, 13339, 14332, 15243,
- 1414, 2201, 3469, 4160, 4832, 5563, 6504, 7493, 8507, 9423, 10261, 11087, 12014, 12887, 13935, 15041,
- 1176, 2031, 3312, 4141, 4915, 5612, 6368, 7097, 7965, 8861, 9900, 10956, 12137, 13161, 14215, 15190,
- 840, 1102, 1853, 3913, 4514, 5155, 5976, 6577, 7726, 8469, 9195, 9896, 12016, 13534, 14458, 15327,
- 1165, 1552, 2467, 3520, 3933, 4902, 6085, 6607, 7652, 8343, 8922, 9577, 11002, 13331, 14521, 15310,
- 1113, 1431, 2280, 3471, 3975, 4853, 5690, 6407, 7275, 8032, 8621, 9884, 12276, 13033, 13880, 15039,
- 719, 1036, 1867, 2553, 4352, 5021, 5775, 6505, 7179, 7826, 9601, 11113, 12075, 12807, 14022, 15272,
- 953, 1294, 1952, 2553, 3007, 5085, 6062, 6718, 8178, 8712, 9927, 11330, 12351, 13205, 14164, 15087,
- 940, 1283, 2111, 2792, 3256, 3911, 6096, 6898, 7589, 9317, 10103, 10891, 11893, 12886, 13757, 15049,
- 587, 903, 1795, 3140, 4297, 4853, 5479, 6468, 7886, 8442, 9844, 11336, 12043, 12793, 13911, 15151,
- 861, 1323, 2258, 3258, 3853, 4815, 5824, 6684, 8004, 9358, 10709, 11951, 12810, 13582, 14465, 15216,
- 758, 1202, 2449, 3134, 3694, 4423, 5673, 6885, 7835, 9014, 10027, 11120, 12196, 13199, 14218, 15199,
- 1042, 1478, 2150, 3726, 4263, 4954, 6139, 6790, 7965, 8974, 9643, 10764, 12030, 12725, 13557, 14581,
- 719, 926, 2434, 3748, 4185, 5032, 5661, 6815, 7286, 9180, 10365, 11159, 11991, 12918, 13824, 15248,
- 715, 1008, 2245, 3846, 4283, 5859, 6516, 7754, 9005, 9791, 10611, 11473, 12342, 13216, 14190, 15177,
- 972, 1282, 1856, 2557, 3020, 4536, 7105, 8030, 8649, 9405, 10103, 10712, 11575, 12633, 13608, 14745,
- 813, 1132, 1994, 2990, 3472, 4041, 4711, 7349, 8285, 8967, 9924, 10497, 11905, 13402, 14503, 15358,
- 897, 1260, 1953, 3238, 3878, 4495, 6373, 7420, 8046, 9326, 10330, 10893, 11883, 13155, 14226, 15156,
- 772, 1190, 1952, 2591, 4617, 5613, 6788, 7715, 8323, 9061, 10103, 11442, 12520, 13313, 14105, 15130,
- 648, 914, 1614, 2978, 3913, 5180, 6371, 7029, 7510, 8288, 10181, 11303, 12262, 13298, 14629, 15443,
- 679, 934, 1510, 2061, 4006, 5506, 6056, 6653, 7326, 8996, 10254, 11800, 12686, 13410, 14130, 15080,
- 536, 802, 1288, 2431, 4428, 4896, 5421, 6396, 8409, 9756, 10509, 11135, 12212, 13338, 14298, 15284,
- 774, 1064, 1751, 2361, 3813, 5723, 6272, 7170, 7837, 9027, 9999, 10677, 11383, 12564, 14005, 15142,
- 678, 938, 1492, 2025, 4146, 5207, 5984, 6738, 7509, 8781, 9766, 10948, 12156, 13220, 14217, 15296,
- 639, 927, 1490, 2153, 4243, 5592, 6466, 7219, 7989, 9277, 10369, 11353, 12295, 13240, 14272, 15267,
- 743, 1035, 1700, 2248, 3167, 5728, 6394, 7572, 8421, 9284, 10729, 11762, 12753, 13526, 14380, 15202,
- 468, 692, 1255, 2740, 4287, 5357, 6462, 7499, 8537, 9503, 10499, 11458, 12457, 13393, 14352, 15260,
- 734, 989, 1478, 1957, 2947, 5157, 6144, 7370, 8090, 8834, 9907, 11183, 12331, 13280, 14246, 15263,
- 461, 681, 1659, 3534, 4547, 5654, 6632, 7664, 8623, 9608, 10561, 11542, 12490, 13438, 14368, 15271,
- 792, 1113, 1855, 2398, 3238, 5817, 6524, 7434, 8483, 9164, 10021, 11002, 12178, 13218, 14316, 15216,
- 658, 1008, 1970, 3074, 4543, 5908, 7154, 8105, 8980, 9832, 10606, 11401, 12264, 13165, 14158, 15163,
- 1009, 1541, 2392, 3464, 4644, 5562, 6666, 7588, 8538, 9554, 10547, 11489, 12487, 13412, 14326, 15206,
- 955, 1704, 3142, 3903, 4985, 6046, 7112, 8024, 8864, 9606, 10417, 11275, 12242, 13171, 14188, 15188,
- 1152, 2084, 3441, 4308, 5341, 6367, 7465, 8361, 9258, 10034, 10799, 11569, 12435, 13295, 14269, 15192,
- 1361, 2472, 3734, 4540, 5724, 6786, 7934, 8876, 9753, 10482, 11209, 11930, 12704, 13494, 14411, 15293,
- 1448, 2793, 3997, 5078, 6382, 7418, 8278, 9062, 9827, 10479, 11193, 11976, 12798, 13632, 14523, 15357,
- 1488, 2499, 3704, 4557, 5499, 6512, 7628, 8636, 9720, 10662, 11547, 12425, 13250, 13991, 14754, 15490,
- 1099, 2055, 3146, 3872, 4700, 5675, 6721, 7670, 8652, 9638, 10640, 11603, 12561, 13473, 14404, 15285,
- 575, 841, 1577, 3091, 3894, 4777, 5587, 6225, 8293, 8937, 9666, 10986, 12135, 13292, 14164, 15178,
- 799, 1086, 1834, 2360, 3186, 5166, 5756, 7271, 8036, 8703, 9532, 10239, 11731, 13180, 14418, 15362,
- 956, 1297, 2021, 2413, 4341, 5175, 5948, 6783, 7304, 8114, 9024, 9853, 10910, 12746, 14094, 15167,
- 1288, 1856, 2407, 3125, 3686, 4421, 5672, 6339, 7288, 8274, 9315, 10205, 11191, 12856, 14483, 15463,
- 1020, 1359, 2139, 2709, 3398, 4646, 5412, 6441, 7053, 7923, 9213, 10192, 11791, 13084, 14208, 15242,
- 839, 1165, 2114, 2625, 3382, 3972, 5064, 7268, 7966, 8749, 9833, 12022, 13123, 13848, 14622, 15279,
- 837, 1104, 1848, 2230, 3860, 4731, 5491, 6377, 6917, 8917, 10029, 10891, 12043, 12753, 13952, 15201,
- 1136, 1564, 2097, 2558, 3026, 4824, 5743, 6459, 7664, 8183, 9819, 10837, 11538, 12762, 14193, 15309,
- 1013, 1492, 2105, 2593, 3135, 5090, 6278, 6877, 7559, 8026, 9120, 10257, 11268, 12899, 14253, 15324,
- 677, 952, 1578, 2156, 3456, 4665, 5545, 6815, 7822, 8967, 10044, 11143, 12218, 13205, 14269, 15290,
- 560, 833, 1626, 2825, 4189, 5300, 5822, 6280, 7858, 9256, 10189, 11481, 12413, 13040, 14138, 15123,
- 666, 1181, 2686, 3416, 4169, 5158, 6179, 7282, 8275, 9372, 10419, 11434, 12436, 13400, 14358, 15244,
- 773, 1040, 1809, 3551, 4049, 5132, 5867, 6525, 7877, 8558, 9275, 10956, 12231, 13016, 14012, 15032,
- 881, 1209, 1988, 3725, 4126, 5152, 6189, 6712, 8497, 9495, 10097, 11006, 12228, 13271, 14197, 15140,
- 850, 1109, 2540, 3212, 3836, 4671, 5423, 6258, 6873, 7502, 9107, 10990, 12254, 13154, 14378, 15352,
- 721, 954, 2751, 3694, 4320, 5071, 5825, 6738, 7291, 7984, 9289, 11579, 12483, 13254, 14338, 15260,
- 1055, 1371, 1968, 3743, 4580, 4986, 5695, 6267, 7257, 8890, 9548, 10261, 11586, 12347, 13324, 15091,
- 676, 972, 2112, 2850, 3753, 4728, 5494, 6367, 7285, 8675, 9943, 11368, 12460, 13350, 14172, 15122,
- 1049, 1494, 2200, 3000, 3527, 5081, 6046, 6884, 8291, 9069, 10097, 11369, 12496, 13375, 14347, 15128,
- 814, 1123, 2183, 2717, 3304, 3975, 5256, 6076, 7491, 8840, 10493, 11738, 12716, 13494, 14450, 15263,
- 948, 1271, 2388, 3106, 3719, 4616, 5356, 6675, 7383, 7967, 9440, 11584, 12408, 13133, 13866, 14860,
- 635, 881, 1924, 3907, 4384, 5217, 5950, 6984, 7695, 8650, 9877, 11108, 12074, 13120, 14245, 15282,
- 762, 1028, 2283, 3533, 3943, 4563, 5144, 6692, 7423, 8653, 9739, 10969, 12023, 13103, 14147, 15192,
- 579, 854, 1748, 3347, 3979, 4734, 5418, 7056, 8203, 9063, 10246, 11271, 12279, 13293, 14338, 15258,
- 503, 768, 1465, 3077, 4620, 5151, 5798, 7143, 8378, 9391, 10401, 11373, 12315, 13200, 14113, 15106,
- 717, 1002, 1807, 3675, 4066, 5418, 6034, 6837, 8445, 8980, 10353, 11755, 12753, 13520, 14476, 15232,
- 672, 949, 1676, 3274, 4729, 5344, 6538, 7393, 8330, 9755, 10902, 11594, 12475, 13327, 14247, 15152,
- 496, 912, 2757, 3804, 4833, 5819, 6853, 7814, 8753, 9709, 10654, 11604, 12540, 13471, 14395, 15300,
- 775, 1049, 2302, 3012, 3920, 4950, 5709, 7219, 7761, 9746, 10544, 11297, 12044, 12831, 13700, 15084,
- 1078, 1504, 2140, 3195, 3778, 4555, 5966, 6673, 7747, 8995, 9612, 10447, 11613, 12329, 13101, 14856,
- 968, 1849, 3399, 4265, 5004, 5732, 6679, 7575, 8554, 9526, 10485, 11412, 12400, 13344, 14309, 15220,
- 1199, 2464, 3945, 4913, 6009, 6786, 7495, 8106, 8835, 9620, 10520, 11438, 12438, 13342, 14319, 15235,
- 1081, 2165, 3828, 4637, 5448, 6070, 6800, 7534, 8434, 9349, 10320, 11262, 12293, 13218, 14232, 15192,
- 1083, 1694, 2537, 3083, 3771, 5128, 6256, 7141, 8587, 9530, 10324, 11062, 11832, 12707, 13900, 15104,
- 925, 1244, 2121, 3433, 3834, 5306, 6241, 6848, 8344, 9060, 9700, 10464, 11277, 12214, 14081, 15400,
- 773, 1006, 1754, 4566, 5209, 5778, 6451, 7124, 8069, 8706, 9253, 10001, 10837, 12064, 14326, 15356,
- 620, 950, 1866, 3048, 4740, 5460, 5977, 6457, 7915, 9271, 9868, 10687, 11496, 12237, 13203, 15016,
- 1104, 1439, 2275, 2648, 3695, 5401, 5983, 7243, 7860, 8327, 8987, 11178, 12399, 13141, 14208, 14977,
- 1076, 1712, 2332, 3118, 4625, 5250, 6130, 7069, 7734, 8740, 10166, 11116, 12011, 12960, 13959, 14830,
- 659, 949, 1548, 2807, 4382, 4952, 5938, 7089, 7729, 8587, 10547, 11148, 11668, 12528, 13953, 15131,
- 618, 891, 1593, 3197, 3993, 4733, 5928, 6583, 7372, 9278, 10158, 10852, 12066, 13201, 14256, 15298,
- 1226, 1611, 2351, 3438, 3930, 4616, 6358, 6975, 7675, 9306, 10025, 10545, 11077, 12750, 14164, 15269,
- 680, 957, 1852, 3036, 3864, 5284, 5883, 6570, 7132, 8763, 9943, 10590, 11425, 12827, 14180, 15184,
- 567, 890, 1811, 3039, 4034, 4670, 5067, 5886, 7597, 8889, 10127, 10989, 12275, 13126, 14471, 15240,
- 1017, 1306, 1912, 4065, 5098, 5506, 6244, 6943, 7610, 8963, 10029, 10608, 11375, 12363, 14054, 15433,
- 718, 949, 1640, 4407, 4989, 5504, 6145, 6846, 8055, 8755, 9764, 11309, 12335, 13157, 13991, 15052,
- 833, 1104, 2582, 3256, 3910, 5291, 5740, 7382, 8142, 8582, 9618, 11230, 12436, 13284, 14118, 14993,
- 1157, 1491, 2370, 3490, 3848, 5022, 5800, 6591, 7995, 8564, 9304, 10921, 12495, 13372, 14254, 15054,
- 1052, 1417, 2072, 2620, 3044, 4572, 5432, 6284, 7546, 8244, 9800, 10798, 12368, 13625, 14662, 15445,
- 795, 1132, 1902, 2810, 3433, 4747, 5790, 6745, 8443, 9315, 10050, 10836, 11673, 12528, 13832, 15149,
- 967, 1250, 2420, 3159, 3625, 4266, 4948, 7030, 7674, 8235, 9112, 9840, 11161, 12837, 14235, 15341,
- 730, 997, 2113, 3171, 3737, 4764, 5577, 6449, 7240, 8394, 9116, 10604, 12009, 13102, 14231, 15244,
- 1192, 1617, 2341, 3430, 4000, 4721, 5596, 6358, 7429, 8167, 8895, 9916, 10855, 12188, 13896, 15254,
- 872, 1150, 2032, 3553, 3983, 4963, 5636, 6604, 7462, 8064, 9470, 10203, 11089, 12799, 14118, 15282,
- 1013, 1444, 1984, 3267, 4408, 4772, 5805, 7143, 7690, 8647, 10029, 10669, 11431, 12636, 13988, 15117,
- 830, 1134, 1866, 3581, 4056, 4925, 6011, 6558, 8076, 8830, 9656, 10706, 12639, 13726, 14663, 15367,
- 684, 957, 1801, 3005, 3559, 4879, 5574, 6920, 7739, 8471, 9724, 10719, 12040, 13148, 14262, 15275,
- 699, 1022, 2042, 3021, 3652, 5369, 6030, 7152, 8031, 8854, 9968, 10869, 11910, 13073, 14255, 15228,
- 831, 1105, 1945, 3827, 4272, 5403, 6214, 6843, 8117, 8827, 9516, 10328, 11201, 12905, 14507, 15398,
- 785, 1036, 2037, 4291, 4698, 5531, 6223, 7000, 8372, 9181, 9784, 10501, 11195, 12592, 13855, 15023,
- 1079, 1556, 2081, 3294, 4678, 5189, 5975, 6991, 7650, 8458, 9624, 10387, 11370, 12518, 13343, 14521,
- 1085, 1535, 2122, 2772, 3190, 4157, 6280, 7310, 8119, 8898, 9511, 10169, 11313, 12529, 13732, 15153,
- 1130, 1625, 2359, 3044, 3504, 5151, 6102, 6755, 7616, 8099, 8791, 9828, 10718, 12434, 14231, 15302,
- 894, 1194, 1854, 2315, 3048, 5073, 5700, 6637, 7336, 8181, 9563, 10924, 12316, 13331, 14349, 15237,
- 1274, 1843, 2368, 2935, 3396, 4031, 5905, 6950, 7597, 8704, 9554, 10193, 11657, 13031, 13891, 14934,
- 1208, 1660, 2310, 3189, 3644, 4355, 5442, 6162, 7602, 8433, 9505, 10600, 12310, 13625, 14495, 15234,
- 884, 1244, 2154, 2652, 3187, 3810, 5991, 6674, 7284, 8251, 9106, 10547, 11947, 13173, 14248, 15300,
- 851, 1095, 2125, 2913, 3429, 4068, 4931, 6228, 6911, 8477, 9513, 10932, 12187, 13333, 14385, 15286,
- 637, 976, 2370, 3892, 4718, 6063, 7126, 8378, 9405, 10359, 11188, 12001, 12807, 13610, 14465, 15303,
- 674, 1156, 3206, 3848, 4574, 5332, 6275, 7180, 7979, 8944, 9945, 11135, 12211, 13166, 14189, 15185,
- 648, 874, 1620, 4523, 5335, 5818, 6480, 7079, 8024, 8654, 9320, 10068, 11602, 13428, 14329, 15293,
- 602, 831, 3174, 4258, 4758, 5558, 6154, 6862, 7261, 8173, 9894, 11228, 12406, 13185, 14416, 15390,
- 728, 1050, 2523, 3324, 4581, 5112, 6274, 7249, 7665, 8228, 9024, 9779, 11962, 13886, 14569, 15310,
- 625, 1064, 2658, 3373, 4317, 5328, 6341, 7576, 8230, 9137, 10072, 11030, 12105, 13071, 14050, 15127,
- 860, 1199, 2569, 3264, 3928, 5082, 6012, 7023, 7568, 8726, 9899, 10975, 11665, 12602, 13465, 14849,
- 994, 1326, 2131, 3392, 3914, 4629, 5507, 6365, 7208, 8086, 9307, 10139, 11960, 13752, 14791, 15505,
- 1297, 1723, 2304, 2955, 3528, 4575, 5330, 6141, 7321, 7873, 9079, 11066, 12114, 12781, 13485, 14866,
- 1247, 1673, 2480, 3557, 4100, 4892, 5843, 6678, 7764, 8607, 9292, 10007, 11055, 11895, 12912, 14829,
- 1108, 1515, 2302, 3815, 4582, 5275, 6233, 7271, 7993, 8890, 9807, 10489, 11145, 11905, 12753, 14036,
- 969, 1302, 2055, 2425, 3922, 5219, 6014, 6785, 7331, 9195, 10032, 10897, 11788, 12542, 13408, 14826,
- 1042, 1398, 2217, 2813, 3449, 4242, 5032, 6957, 7766, 8985, 9916, 10576, 11237, 12222, 13952, 15302,
- 1099, 1456, 2313, 2814, 3532, 5651, 6349, 7119, 8208, 8769, 9427, 10112, 11070, 12005, 12975, 14815,
- 952, 1343, 2279, 4277, 5014, 5588, 6550, 7259, 8172, 9304, 10112, 10905, 11848, 12798, 13734, 14852,
- 827, 1155, 2015, 2590, 3389, 5575, 6147, 7237, 8788, 9352, 9943, 10452, 11166, 11866, 13017, 14908,
- 965, 1342, 1904, 3530, 4756, 5265, 6282, 7430, 8006, 8866, 10189, 10858, 11593, 12497, 13413, 14286,
- 791, 1033, 1807, 4669, 5445, 6065, 6777, 7311, 8217, 8955, 9594, 10171, 10891, 11711, 13024, 15079,
- 703, 982, 1468, 2926, 5508, 6551, 7045, 7648, 8280, 9027, 10043, 10724, 11477, 12486, 13816, 15160,
- 636, 1084, 3228, 4342, 5051, 5884, 6638, 7545, 8362, 9253, 10190, 11160, 12212, 13207, 14220, 15198,
- 821, 1100, 1682, 3559, 5618, 6419, 6944, 7630, 8233, 9075, 10130, 10822, 11427, 12149, 13027, 14146,
- 629, 1332, 3013, 3722, 4532, 5532, 6531, 7553, 8517, 9499, 10507, 11474, 12457, 13390, 14358, 15272,
- 1317, 2450, 3297, 3892, 4613, 5418, 6425, 7337, 8291, 9245, 10282, 11346, 12442, 13393, 14373, 15268,
- 1375, 2387, 3533, 4376, 5325, 6263, 7320, 8268, 9276, 10272, 11197, 12094, 13000, 13818, 14648, 15432,
- 1158, 2044, 2814, 3372, 4231, 5273, 6326, 7190, 8055, 8945, 9909, 11036, 12230, 13264, 14271, 15192,
- 871, 1102, 2233, 4189, 4539, 5309, 5875, 6894, 8135, 8683, 9397, 10814, 12535, 13312, 14286, 15134,
- 814, 1062, 2256, 4246, 4741, 5468, 6095, 6832, 7800, 8445, 9019, 9623, 10539, 12957, 14398, 15333,
- 958, 1249, 1879, 3625, 4221, 4743, 5374, 6010, 7564, 8370, 9054, 10537, 11472, 12580, 13996, 15129,
- 871, 1148, 2666, 3651, 4193, 5040, 5660, 6778, 7459, 8017, 8780, 9530, 10508, 12721, 14270, 15304,
- 651, 1057, 2426, 3096, 4328, 5224, 6148, 6984, 7722, 9038, 10150, 11248, 12299, 13281, 14301, 15245,
- 617, 889, 2138, 4101, 4573, 5464, 6134, 7293, 8294, 9277, 10316, 11265, 12281, 13301, 14327, 15273,
- 792, 1161, 2081, 2883, 3644, 5502, 6438, 7760, 8867, 9704, 10404, 11003, 11913, 13286, 14647, 15445,
- 1202, 1869, 2491, 2996, 4025, 5336, 6574, 7586, 8415, 9166, 9940, 11099, 12441, 13461, 14408, 15252,
- 1164, 2036, 2762, 3315, 4510, 5722, 6901, 7925, 8892, 9813, 10715, 11594, 12526, 13416, 14359, 15235,
- 1442, 2242, 2916, 3528, 4751, 5836, 6787, 7599, 8395, 9235, 10177, 11157, 12208, 13147, 14145, 15115,
- 1182, 2189, 3501, 4359, 5481, 6402, 7306, 7997, 8719, 9457, 10314, 11195, 12207, 13152, 14186, 15159,
- 1123, 1928, 3249, 4174, 5190, 6018, 6841, 7570, 8320, 9079, 9969, 10880, 11946, 12957, 14056, 15116,
- 1391, 2121, 3172, 3766, 4449, 5215, 6232, 7171, 8096, 8981, 9854, 10664, 11746, 12851, 14017, 15116,
- 1330, 2144, 2998, 3489, 4141, 5059, 6328, 7427, 8552, 9564, 10505, 11379, 12290, 13173, 14193, 15189,
- 1109, 1492, 2303, 2946, 3382, 4987, 6548, 6997, 8296, 9305, 9871, 10389, 11172, 13047, 14487, 15395,
- 1088, 1547, 2223, 3092, 3620, 4386, 6452, 7580, 8220, 9176, 10021, 10624, 11535, 12511, 13349, 14330,
- 888, 1265, 1930, 3715, 4354, 4929, 6671, 7348, 8125, 9622, 10527, 11265, 12457, 13225, 13909, 14800,
- 815, 1189, 2006, 3817, 4374, 5838, 6485, 7386, 8816, 9395, 10242, 10930, 11702, 12358, 13510, 14977,
- 990, 1329, 1856, 2513, 2960, 3841, 6200, 7584, 8128, 9084, 9884, 10615, 11927, 13026, 14162, 15236,
- 809, 1891, 3000, 3978, 4992, 5938, 6931, 7857, 8818, 9757, 10695, 11637, 12557, 13495, 14394, 15295,
- 554, 1531, 2712, 3754, 4813, 5795, 6805, 7758, 8739, 9677, 10642, 11569, 12527, 13426, 14344, 15173,
- 961, 1247, 2162, 4030, 4594, 5392, 6191, 6804, 7979, 8852, 9449, 10061, 10905, 11757, 12852, 14951,
- 1214, 1854, 2494, 3286, 3894, 4471, 5973, 7358, 7967, 8807, 9608, 10178, 10994, 12344, 13316, 14487,
- 1024, 1446, 2069, 2773, 3329, 5327, 6627, 7318, 8209, 8780, 9592, 11114, 12066, 12765, 13662, 14618,
- 907, 1229, 2135, 2657, 3456, 4585, 5614, 6412, 7107, 8072, 10517, 11769, 12447, 13038, 14011, 15186,
- 608, 888, 1729, 3791, 4395, 4825, 5374, 6977, 7738, 8387, 9316, 10715, 12651, 13548, 14546, 15311,
- 941, 1202, 2101, 3123, 3503, 4159, 4619, 6676, 7402, 8223, 9627, 10280, 11822, 13131, 14470, 15468,
- 800, 1065, 1726, 2186, 4630, 5715, 6394, 7256, 7782, 8452, 9368, 11407, 12394, 13086, 14086, 15167,
- 875, 1208, 1941, 2508, 3296, 4447, 5532, 6821, 7582, 8862, 9556, 10519, 11696, 12896, 14109, 15273,
- 900, 1183, 1959, 2423, 3386, 5868, 6409, 7218, 7883, 8442, 9143, 9913, 11104, 13003, 14241, 15213,
- 1115, 1573, 2286, 3113, 3574, 4645, 5519, 6311, 8196, 8937, 9864, 11290, 12252, 13043, 13810, 14631,
- 754, 1068, 2679, 3694, 4190, 5008, 5606, 7347, 8013, 8864, 9972, 10786, 11627, 12824, 14010, 15316,
- 825, 1144, 1765, 3426, 4206, 4874, 6385, 7180, 7946, 9319, 10153, 10682, 11276, 11957, 13415, 15087,
- 537, 862, 1866, 3116, 4349, 4842, 5496, 7245, 7958, 8822, 9611, 10099, 11455, 13291, 14370, 15284,
- 887, 1205, 1698, 3243, 5173, 5813, 6470, 7237, 7881, 8707, 9739, 10497, 11284, 12115, 13185, 14869,
- 726, 1002, 2984, 3728, 4334, 5142, 5946, 7127, 7676, 8367, 9085, 10668, 11889, 13054, 14011, 15180,
- 771, 981, 1772, 4221, 4795, 5401, 6003, 6690, 7480, 8115, 8717, 9938, 12232, 13037, 13941, 15157,
- 1303, 1922, 2468, 3316, 4185, 4656, 5507, 6631, 7341, 8291, 9593, 10378, 11412, 12616, 13556, 14820,
- 1080, 1403, 2477, 2954, 3741, 4642, 5517, 6582, 7111, 7805, 8786, 9547, 11253, 12874, 14045, 15236,
- 872, 1141, 2386, 3209, 3896, 5042, 5805, 7002, 7549, 8285, 9036, 9939, 12031, 13030, 13767, 15055,
- 728, 1046, 2013, 4276, 5230, 5799, 6889, 7772, 8535, 9890, 10949, 11702, 12791, 13661, 14459, 15218,
- 768, 1578, 3171, 4134, 5114, 6061, 7128, 8112, 9139, 10152, 11101, 12005, 12913, 13736, 14586, 15387,
- 622, 1221, 3202, 4279, 5529, 6753, 7808, 8631, 9408, 10115, 10830, 11631, 12512, 13365, 14324, 15263,
- 621, 848, 1626, 4612, 5335, 5797, 6416, 7167, 8286, 8933, 9880, 11327, 12709, 13565, 14439, 15329,
- 650, 861, 3115, 4397, 4828, 5572, 6159, 7071, 7513, 8108, 8667, 9739, 12413, 13532, 14414, 15581,
- 756, 1091, 1615, 2958, 4679, 5429, 6304, 7065, 7657, 8329, 10012, 10763, 11425, 12569, 14285, 15324,
- 765, 1051, 2074, 3446, 3838, 5659, 6318, 7149, 8407, 8942, 9688, 11058, 12443, 13347, 14361, 15231,
- 1121, 1473, 2217, 2827, 3347, 5017, 5872, 6668, 7595, 8264, 9085, 10487, 12210, 13022, 13866, 14985,
- 1056, 1457, 2212, 2861, 3453, 5060, 5976, 6759, 7697, 8519, 9461, 10348, 11169, 12000, 13798, 15274,
- 1042, 1388, 2220, 3677, 4297, 5120, 6037, 6788, 7788, 8549, 9262, 10069, 10878, 11755, 14085, 15413,
- 961, 1331, 1957, 3111, 3796, 4344, 5010, 5553, 7612, 9441, 10155, 10903, 11982, 12664, 13391, 14959,
- 1135, 1470, 2082, 3284, 3937, 4423, 5140, 5618, 7055, 8860, 9355, 10318, 11706, 12556, 13826, 15192,
- 1084, 1383, 2209, 3550, 4038, 4636, 5240, 5911, 8011, 9044, 9570, 10294, 11155, 11865, 13587, 15219,
- 737, 1028, 1858, 2434, 3038, 3815, 5414, 6560, 7753, 9010, 10088, 11109, 12200, 13241, 14292, 15286,
- 979, 1377, 2142, 3511, 4042, 4787, 5869, 6505, 7764, 8710, 9567, 10378, 11383, 13445, 14620, 15417,
- 802, 1063, 1768, 3997, 4648, 5273, 6005, 6694, 7698, 8427, 9191, 10230, 11176, 12425, 13991, 15244,
- 926, 1148, 2359, 3438, 3811, 4446, 4994, 6492, 7088, 7840, 8921, 9955, 11823, 13037, 14140, 15275,
- 639, 939, 1753, 3080, 4204, 5022, 5702, 6198, 6811, 8268, 9786, 10836, 12243, 13126, 14260, 15306,
- 736, 1079, 1802, 3276, 4001, 5415, 6381, 7119, 8492, 9232, 10308, 11105, 12031, 12793, 13904, 15114,
- 1249, 1897, 2616, 3398, 4149, 4840, 5809, 6616, 7453, 8768, 9869, 10767, 12051, 13177, 14339, 15241,
- 1026, 1314, 2014, 3249, 3690, 4344, 4892, 5691, 7289, 7970, 9397, 10615, 11663, 13015, 14272, 15328,
- 970, 1249, 2342, 2895, 3661, 4685, 5348, 6691, 7176, 8850, 10323, 11025, 11936, 12697, 13429, 14816,
- 872, 1155, 1680, 2334, 2880, 4439, 6448, 7088, 8221, 9517, 10060, 10691, 11577, 12830, 14274, 15377,
- 874, 1131, 2067, 2714, 3203, 3786, 4480, 6643, 7487, 8708, 9861, 10989, 12079, 13208, 14240, 15290,
- 804, 1079, 1708, 2236, 2842, 5275, 6096, 7030, 7886, 8704, 9978, 11354, 12923, 13800, 14706, 15380,
- 646, 907, 1724, 3428, 3981, 5158, 5889, 7244, 8226, 8728, 9227, 10055, 11833, 13065, 14232, 15287,
- 986, 1315, 1948, 2518, 3010, 5465, 6638, 7224, 8275, 8820, 9602, 10482, 11268, 12169, 14206, 15449,
- 565, 805, 1593, 3458, 4571, 5319, 6411, 7828, 8796, 9460, 10121, 10926, 11931, 12989, 14085, 15181,
- 532, 795, 1654, 3253, 3949, 5323, 6246, 7279, 8378, 9364, 10397, 11379, 12395, 13375, 14390, 15290,
- 835, 1169, 1895, 2461, 3233, 5608, 6358, 7353, 8521, 9756, 10632, 11371, 12291, 12967, 13777, 14575,
- 528, 840, 1585, 2511, 4342, 5075, 5825, 7183, 8370, 8938, 9529, 10614, 12398, 13483, 14482, 15340,
- 789, 1044, 2065, 2677, 3589, 5397, 5969, 7559, 8126, 8638, 9332, 10989, 12645, 13441, 14355, 15188,
- 685, 970, 1644, 2232, 4331, 5344, 6203, 6877, 7736, 9534, 10331, 11186, 11981, 12778, 13629, 14878,
- 800, 1120, 1829, 2303, 4180, 4963, 5877, 6722, 7425, 8436, 9106, 10138, 12113, 13163, 14087, 15242,
- 851, 1150, 2243, 3088, 3642, 5370, 6027, 6953, 7919, 8562, 9276, 9957, 10896, 12786, 14320, 15324,
- 735, 1113, 2000, 3196, 4699, 5471, 6589, 7347, 8003, 8855, 9650, 10594, 12001, 13017, 13918, 15089,
- 837, 1098, 1699, 2175, 3008, 6101, 6902, 7529, 8229, 8790, 9674, 10585, 11532, 12971, 14334, 15323,
- 626, 1278, 3315, 4325, 5436, 6586, 7790, 8824, 9821, 10690, 11482, 12268, 13043, 13789, 14591, 15381,
- 1439, 2612, 3825, 4715, 5881, 7098, 8204, 9129, 10075, 10889, 11673, 12416, 13159, 13897, 14672, 15420,
- 1489, 2697, 3785, 4568, 5440, 6284, 7191, 8043, 8936, 9852, 10756, 11696, 12662, 13539, 14458, 15314,
- 663, 932, 1850, 4514, 5042, 5800, 6482, 7381, 8674, 9537, 10447, 11239, 12074, 12975, 13958, 14969,
- 695, 1028, 1781, 2195, 4548, 5142, 6539, 7282, 7728, 8259, 8915, 9755, 11646, 13482, 14373, 15221,
- 846, 1138, 1713, 2239, 2823, 5254, 6237, 6940, 7777, 8443, 9981, 10858, 11793, 13022, 14259, 15331,
- 595, 882, 1481, 3108, 4815, 5391, 5979, 6529, 8058, 8939, 9706, 10649, 11884, 13065, 14350, 15334,
- 887, 1139, 1829, 2276, 3102, 5552, 6221, 7067, 7712, 8368, 9127, 10682, 12241, 13127, 14112, 15133,
- 1019, 1418, 2165, 2865, 3353, 4937, 6019, 6784, 7810, 8440, 9197, 10025, 12092, 13614, 14602, 15352,
- 951, 1206, 2295, 3066, 3586, 4125, 4780, 7215, 7687, 8320, 9079, 10918, 12519, 13503, 14488, 15224,
- 847, 1149, 2069, 2504, 4231, 5041, 6034, 6862, 7321, 7882, 8765, 10837, 12433, 13022, 13809, 15203,
- 829, 1111, 2677, 3505, 3999, 5080, 5694, 7033, 7667, 8302, 8963, 10297, 12410, 13340, 14485, 15373,
- 908, 1284, 2182, 2613, 3944, 5116, 5768, 7284, 7825, 8461, 10123, 11755, 12583, 13368, 14195, 15053,
- 930, 1215, 2323, 2834, 3500, 4216, 5200, 5956, 6576, 7757, 9998, 10921, 12073, 12844, 14003, 15254,
- 973, 1343, 2164, 3265, 3733, 4538, 5294, 6469, 7850, 8468, 9747, 10750, 11398, 12428, 13990, 15226,
- 952, 1239, 1992, 3093, 3498, 4156, 4605, 5695, 7946, 8668, 9684, 11027, 12029, 13102, 14093, 15158,
- 558, 828, 1638, 2628, 3361, 4827, 6046, 7182, 8226, 9297, 10326, 11331, 12343, 13333, 14312, 15248,
- 543, 797, 1292, 2197, 4031, 4954, 6096, 7133, 8292, 9244, 10253, 11267, 12293, 13293, 14303, 15272,
- 562, 818, 1546, 2854, 3792, 5212, 5897, 6697, 8329, 9105, 10103, 11572, 13033, 13866, 14716, 15223,
- 897, 1320, 1937, 2717, 3205, 4412, 6880, 7773, 8381, 9585, 10492, 11242, 12589, 13425, 14212, 15053,
- 798, 1174, 2038, 2482, 3869, 4999, 5820, 7157, 7807, 9160, 10013, 11078, 12122, 13113, 14028, 14997,
- 686, 1000, 2269, 3020, 3755, 5347, 5960, 7664, 8406, 9199, 10485, 11521, 12512, 13361, 14217, 15144,
- 715, 1058, 1660, 3282, 4591, 4997, 6361, 7315, 7878, 9084, 10356, 11033, 12186, 13333, 14390, 15279,
- 784, 1087, 1584, 3299, 5404, 6007, 6611, 7254, 7870, 8870, 10201, 10911, 11780, 12799, 14077, 15156,
- 664, 905, 1952, 4880, 5346, 5934, 6519, 7374, 8530, 9311, 10103, 10819, 11525, 12818, 14071, 15168,
- 626, 914, 2854, 4227, 4737, 5634, 6361, 7354, 7918, 8636, 9491, 10701, 11785, 13139, 14220, 15292,
- 1793, 3491, 4468, 5330, 6092, 6716, 7382, 8023, 8852, 9777, 10729, 11640, 12576, 13418, 14323, 15182,
- 688, 949, 1560, 3990, 5022, 5519, 6194, 6798, 8071, 8773, 9515, 10514, 12712, 13784, 14609, 15400,
- 783, 1014, 2824, 3542, 4129, 4903, 5606, 6542, 6965, 7778, 10053, 10913, 11995, 12759, 13498, 15320,
- 753, 1093, 2085, 2706, 4391, 5134, 5930, 6777, 7408, 8184, 9523, 10719, 12392, 13543, 14552, 15277,
- 920, 1325, 2067, 2928, 3400, 4646, 5913, 6704, 8091, 8819, 9941, 10843, 12080, 13740, 14761, 15449,
- 618, 961, 2096, 3325, 4242, 5555, 6567, 7721, 8801, 9891, 10891, 11871, 12871, 13717, 14555, 15310,
- 826, 1165, 2466, 3876, 4364, 5723, 6461, 7667, 8417, 9095, 9913, 10755, 11704, 12971, 14239, 15196,
- 1056, 1577, 2885, 3726, 4232, 5031, 5736, 6842, 8006, 8903, 10198, 11414, 12536, 13409, 14359, 15205,
- 876, 1205, 2453, 3059, 3652, 4312, 5617, 6518, 7542, 8743, 9363, 11286, 13049, 13835, 14643, 15303,
- 763, 990, 2805, 3723, 4228, 4936, 5628, 6613, 7058, 7705, 8476, 10130, 11974, 13113, 14180, 15342,
- 857, 1152, 1913, 3994, 4629, 5137, 6183, 6861, 7722, 9347, 10177, 10777, 11599, 13112, 14298, 15264,
- 656, 1269, 3434, 4621, 5637, 6438, 7220, 7942, 8741, 9612, 10517, 11433, 12435, 13354, 14316, 15237,
- 1359, 2605, 3748, 4758, 6042, 7092, 7952, 8651, 9338, 9974, 10723, 11579, 12528, 13418, 14397, 15297,
- 1529, 3067, 4410, 5449, 6449, 7233, 7901, 8525, 9237, 10002, 10859, 11784, 12730, 13589, 14467, 15300,
- 1790, 3311, 4192, 4897, 5538, 6210, 6922, 7697, 8597, 9590, 10560, 11494, 12426, 13283, 14229, 15138,
- 1252, 2359, 3404, 4211, 5155, 6055, 7030, 7899, 8850, 9793, 10761, 11714, 12674, 13565, 14489, 15352,
- 590, 998, 2402, 3314, 4528, 5604, 6649, 7644, 8508, 9487, 10408, 11383, 12335, 13276, 14293, 15243,
- 727, 1025, 1614, 3818, 5876, 6391, 6980, 7606, 8211, 9304, 10696, 11324, 12381, 13241, 13988, 14791,
- 621, 899, 2068, 4152, 5232, 6483, 7323, 8193, 8960, 9627, 10417, 11291, 12234, 13192, 14216, 15187,
- 582, 828, 1926, 4025, 4942, 6029, 6957, 7599, 8278, 9093, 10032, 11126, 12233, 13209, 14256, 15311,
- 788, 1126, 1690, 3183, 3923, 4599, 6240, 6890, 7758, 9022, 9656, 10453, 11779, 12706, 13913, 15214
-};
-
-
-const Word16 lsf_cdk_nb_gc_stg1[] = /* 14Q1*1.28 */
-{
- -2046, -827, -3490, -8984, -9331, -8562, -2854, 112, 2194, 13294, 11592, 7952,
- -294, 2271, 1647, -1260, -2029, -3649, -4081, -3432, -3649, 333, 5042, 4720,
- -1209, 984, -241, -3413, -4476, -4817, -2910, -2016, -2016, 2900, 6868, 5408,
- -1900, 896, 688, -197, -33, -993, -1470, -1283, -2145, -665, 2161, 4064,
- -1998, -351, -1985, -4742, -4879, -5329, -3500, -2023, -1264, 8507, 9766, 6640,
- 245, 3962, 3664, 1935, 1601, 144, -1054, -1236, -2225, -2647, -3746, 1695,
- -3051, -1382, -1825, 828, 2537, 1872, 957, 689, -592, 1675, 5507, 5216,
- -2178, -281, 2097, 5417, 4372, 1648, -802, -1304, -2817, -754, 3345, 4224,
- -3400, -2402, -4098, -3148, -2066, -1985, -558, 466, 705, 11042, 11096, 7424,
- 776, 4355, 3200, -1139, -2922, -3985, -2990, -2405, -2881, -661, 2897, 4176,
- -1818, 394, -385, -1504, -1545, -2913, -3062, -2451, -2609, 2093, 6387, 5248,
- -1081, 2069, 1952, 1345, 1649, 64, -1394, -1526, -2577, -2051, -1025, 2863,
- 276, 2780, 1567, -3228, -4881, -5970, -4363, -3523, -3089, 3447, 7300, 5456,
- 1917, 6445, 5552, 2069, 684, -1233, -2371, -2377, -3409, -1635, 1616, 3648,
- -2734, -1049, -2001, -1927, -1908, -2273, -1294, -652, -944, 4451, 7893, 5888,
- -1193, 2108, 5153, 7875, 8214, 6145, 2891, 2001, 208, -1312, -2273, 1599,
- -3697, -3538, -6739, -7238, -4524, -2464, 2424, 4591, 6098, 15691, 13066, 8912,
- -352, 2108, 847, -247, 1179, -769, -2757, -2873, -3713, 203, 4994, 4688,
- -1185, 1565, 703, -1788, -2372, -2721, -1951, -1554, -2129, -374, 2529, 4192,
- -2094, 401, 352, 1118, 2376, 1632, 582, 351, -1009, -1389, -784, 3056,
- -367, 1637, -145, -5132, -6888, -8178, -5371, -3397, -1776, 9469, 9894, 6752,
- 953, 5894, 6785, 5196, 4663, 2400, 31, -598, -2065, -2581, -2786, 1743,
- -2637, -1222, -560, 5363, 6867, 5329, 2192, 1264, -544, -508, 1345, 3664,
- -1112, 1918, 2976, 3989, 4508, 3104, 1245, 606, -897, -2381, -4258, 1119,
- -1983, -328, -2930, -6112, -1802, 144, 486, 194, -960, 4066, 7797, 5872,
- 648, 3526, 3104, 562, -200, -2177, -3380, -3162, -3857, -1516, 2433, 3920,
- -2908, -722, -417, -181, 290, -352, -352, -175, -1088, 1689, 5603, 5184,
- -536, 2771, 2064, 10, -643, -1793, -1733, -1523, -2193, -1813, -1585, 2831,
- 2239, 5541, 4400, -637, -2370, -4802, -5148, -3901, -2912, 7328, 9222, 6320,
- 8159, 12344, 9921, 5311, 4611, 2480, -1461, -1819, -2032, 5438, 7396, 5968,
- -3908, -2998, -3105, 1031, 2171, 1952, 2012, 1982, 1280, 8825, 10343, 7056,
- -80, 5935, 10546, 12414, 12351, 9601, 4823, 3380, 1152, -840, -2161, 1967
-};
-const Word16 lsf_cdk_nb_gc_stg2[] = /* 14Q1*1.28 */
-{
- -476, -1387, -3185, 464, 1104, 0,
- -1029, -675, 63, -1664, -1168, 0,
- -691, -1002, -1697, -1968, -704, 0,
- -957, -724, -945, 816, 928, 0,
- -1131, -2087, -1296, 2704, 1376, 0,
- -1167, -1003, 512, 592, 192, 0,
- 492, 517, -721, -3600, -1888, 0,
- 489, -147, -1153, -688, -864, 0,
- 865, 179, -608, 2000, 1008, 0,
- -1286, -1953, -1633, -304, -368, 0,
- 2033, 1593, -369, -576, 272, 0,
- -718, 685, 751, -192, 192, 0,
- 1394, 1172, 1520, -480, -576, 0,
- -1455, -466, 2896, 2176, 896, 0,
- -1171, 324, 2512, -272, -496, 0,
- 4950, 5112, 3536, 1040, 80, 0
-};
-const Word16 lsf_cdk_nb_gc_stg3[] = /* 14Q1*1.28 */
-{
- 1, 6, -801, -3701, -3408, -1712, 2661, 2257, 768,
- 4, 11, -481, -1886, -2409, -2353, -652, 1216, 256,
- 14, 6, -1713, -1706, -1012, -817, -1158, -369, -97,
- 8, 15, 127, -780, -1241, -1617, -2819, -1474, -577,
- 13, 6, 2320, 103, -1175, -1681, 297, 1536, 384,
- 4, 14, -529, -319, -161, -129, -2113, -4131, -1281,
- 0, 5, -2001, -1650, -185, 1040, 2146, 1713, 736,
- 12, 4, 320, 1615, 1634, 1376, -1700, -4675, -1697,
- 15, 13, -401, -348, -511, -320, 2570, 2865, 944,
- 7, 14, 335, -1107, -768, -112, -338, -65, 15,
- 13, 15, -1025, 563, -38, -865, -1105, 383, 31,
- 4, 6, 1056, 1034, 443, -289, -2357, -1986, -689,
- 7, 6, 1008, 1608, 1329, 816, 730, 1312, 432,
- 4, 12, -1281, 789, 1794, 1328, -517, -561, -113,
- 12, 4, 704, 1656, 2289, 3153, 5215, 3682, 1680,
- 11, 15, 2528, 4255, 3539, 2320, -669, -1585, -641
-};
-const Word16 lsf_cdk_nb_vc_stg1[] = /* 14Q1*1.28 */
-{
- -1950, -1358, -4562, -8912, -8626, -8050, -2211, 1051, 4226, 15749, 13194, 8800,
- 224, 2532, 175, -5316, -6930, -5601, 381, 515, -416, 3224, 6964, 5584,
- -2481, -1570, -3746, -3444, -3066, -3665, -2328, -929, -256, 10781, 10903, 7280,
- -164, 2676, 1952, 1170, 1362, 32, -809, -978, -1793, -2288, -3137, 2287,
- -1649, -589, -3746, -9056, -6586, -2160, 1693, 1869, 1072, 8982, 10375, 7056,
- -1442, 731, -465, -352, 881, 0, -1397, -1476, -2273, -792, 2209, 4048,
- -570, 1125, -577, -4067, -5011, -6130, -4457, -3228, -2464, 7796, 9414, 6432,
- 314, 2780, 1599, -2442, -4050, -5762, -4680, -3747, -3169, 3706, 7556, 5568,
- -3306, -3212, -6178, -5257, -2978, -2209, 33, 2038, 3490, 15396, 13130, 8704,
- -303, 2334, 927, -1025, -1877, -2753, -1964, -1602, -2145, -943, 1457, 3872,
- -1437, 228, -1633, -3020, -3188, -2833, -1579, -942, -1184, 2482, 6532, 5408,
- 2622, 6487, 4448, 511, -1383, -2769, -2495, -2230, -2977, -107, 4082, 4480,
- -1897, -706, -2994, -2432, 566, 704, 220, 99, -608, 3533, 7300, 5744,
- -2605, -1419, -1376, 1700, 1217, 112, -957, -849, -1633, 1902, 6131, 5296,
- 2177, 3621, 751, -6700, -10534, -11698, -2205, 713, 3954, 15329, 12986, 8656,
- 7156, 9030, 4704, 653, -2345, -6178, -4996, -1616, 1762, 14213, 12329, 8272,
- -997, 238, -2066, -5868, -6868, -7474, -4302, -2171, -623, 12371, 11336, 7600,
- 2585, 4011, 959, -298, 477, -353, -2457, -2786, -3233, 5865, 8693, 6064,
- -2145, -680, -1553, -1961, -2011, -3249, -3184, -2317, -1968, 5674, 8613, 6080,
- 675, 4202, 4128, 2060, 1483, -865, -2647, -2552, -3377, -2094, 64, 3184,
- -3084, -2915, -5698, -905, 1626, 2176, 1517, 1566, 1024, 9339, 10663, 7232,
- -741, 1377, 1168, 206, 185, -1601, -3079, -2936, -3553, -265, 4402, 4528,
- 872, 3048, 799, -4039, -5660, -7890, -7222, -4564, -1792, 10306, 10311, 6992,
- 2766, 6132, 4848, -1357, -2881, -4914, -4864, -3528, -2608, 9503, 10134, 6832,
- -1649, -1598, -6691, -10943, -5664, -3632, 2663, 6788, 11044, 19895, 15933, 10416,
- 530, 3138, 2560, -401, -1453, -3425, -4047, -3463, -3713, 252, 4914, 4672,
- -879, 1210, 47, -2253, -2732, -3777, -3689, -2947, -2833, 2110, 6499, 5232,
- 5749, 8736, 6865, 3519, 2447, 383, -1446, -1459, -2385, 970, 4146, 4560,
- -2556, -1914, -3969, 3390, 7938, 6305, 1777, 560, -928, 1091, 4563, 4928,
- -1808, -411, 1313, 6469, 6395, 3680, 398, -149, -1713, -1588, 832, 3360,
- 3630, 5517, 2479, -2938, -6552, -10675, -4951, -545, 1441, 13744, 12041, 8080,
- 10956, 13776, 9201, 4285, 3873, -801, -5835, -2466, 1233, 13746, 12105, 8192
-};
-const Word16 lsf_cdk_nb_vc_stg2[] = /* 14Q1*1.28 */
-{
- -377, -729, -1793, 400, 1312, 0,
- -1197, -1432, -2033, -1936, -1520, 0,
- -403, -100, 127, -3232, -3456, 0,
- 555, 364, -865, -592, -1264, 0,
- -1136, -1968, -2640, 4448, 3824, 0,
- -1539, 94, 591, 1600, 1376, 0,
- -1564, -393, 2528, -304, -688, 0,
- 1075, 823, 1648, -96, -704, 0,
- -770, -404, 527, -1648, 64, 0,
- -1320, -1678, -1072, 48, -688, 0,
- 145, 83, -1089, -3632, -448, 0,
- 1994, 1756, 159, 1120, 1504, 0,
- 282, -236, -800, 2080, 624, 0,
- -1357, -1537, 1008, 2624, 1360, 0,
- 2002, 2046, 1215, -2336, -1808, 0,
- 3757, 3480, 2592, 1472, 512, 0
-};
-const Word16 lsf_cdk_nb_vc_stg3[] = /* 14Q1*1.28 */
-{
- 3, 5, -657, -4633, -3805, -736, 1304, 1024, 368,
- 6, 12, -305, -1836, -2507, -2625, -1818, -241, -305,
- 6, 4, -2577, -1854, -1236, -1073, -594, 207, -1,
- 2, 2, -80, 643, 38, -993, -3719, -1602, -769,
- 13, 10, -625, -1825, -2422, -2449, 2887, 2625, 784,
- 6, 0, -336, 315, 466, 560, -2183, -4867, -1345,
- 10, 7, -2625, 1255, 2305, 1296, 181, 544, 208,
- 0, 7, 912, 1998, 1662, 623, -416, 256, 32,
- 10, 6, -1713, -1720, -311, 1408, 2066, 1585, 672,
- 7, 11, 15, -1217, -99, -33, -851, -33, -81,
- 12, 0, -1680, 556, -499, -897, 454, 896, 256,
- 2, 8, 2608, 425, -938, -1937, -1205, 15, -177,
- 6, 2, 1504, -796, -939, 80, 2179, 1777, 672,
- 3, 13, 1984, 3517, 3171, 2320, -2605, -5651, -1857,
- 14, 2, -160, 1660, 2380, 2832, 2924, 2097, 992,
- 10, 0, 3857, 3623, 2853, 1728, 1554, 1441, 656
-};
-const Word16 lsf_cdk_wb_gc_stg1[] = /* 14Q1*1.28 */
-{
- -854, -266, -3202, -8408, -10604, -11763, -10826, -9448, -7970, -4784, -3493, -2593,
- -2727, -1241, -1489, -1469, -1977, -2529, -2344, -2279, -2273, -1750, -1365, -1505,
- -728, 1001, -113, -1594, -2256, -3553, -4619, -4591, -4497, -3300, -2327, -2129,
- -590, 1699, 1264, 1187, 300, -865, -1554, -1669, -1649, -1202, -837, -1169,
- -1612, -578, -2546, -5013, -6155, -6834, -6779, -6002, -5506, -3988, -2968, -2625,
- -1725, 1072, 1280, 74, 277, 672, 1385, 2172, 2688, 2643, 2065, 848,
- -86, 3639, 3824, 1931, 2115, 1120, 338, 500, 496, 751, 718, -65,
- -1024, 1647, 5377, 9202, 8763, 7665, 5376, 4447, 3824, 2803, 2000, 608,
- -2585, -2600, -6211, -11489, -11790, -10322, -5788, -3684, -2289, -465, -33, -289,
- -3165, -2478, -3521, -1181, 298, 1632, 2160, 2107, 2272, 2075, 1407, 319,
- 1275, 3587, 2848, 570, -26, -1489, -4034, -4818, -5202, -3732, -2550, -2049,
- -2614, -1530, -848, 4992, 6996, 8002, 9185, 9172, 9106, 7739, 5862, 3408,
- 440, 2263, 751, -3627, -4674, -4978, -4938, -5078, -5554, -5428, -4266, -3361,
- -2308, -80, 176, 2603, 3871, 3792, 3219, 2667, 2480, 2189, 1405, 95,
- 2569, 6546, 6257, 3885, 2438, 1504, 1431, 1319, 1392, 1337, 942, -65,
- -712, 3328, 6290, 10673, 12635, 13827, 14544, 13939, 13619, 10691, 8026, 4768,
- 842, 2338, 159, -5945, -8498, -9619, -8197, -7076, -6066, -4502, -3722, -3409,
- -1628, 617, -129, -1907, -2194, -1505, -95, 486, 928, 1268, 1071, 175,
- 538, 3277, 2111, -1606, -3194, -3553, -2105, -1604, -1393, -974, -740, -1009,
- -1279, 456, 2593, 6823, 5435, 3536, 1502, 544, -96, -521, -548, -1105,
- -983, 675, -865, -4388, -5936, -5697, -3245, -2211, -1633, -519, -276, -849,
- -102, 3506, 2480, 332, -670, -448, 859, 1384, 1776, 1846, 1568, 448,
- 270, 5022, 5136, 4435, 4546, 4305, 4185, 4385, 4337, 3659, 2785, 1152,
- 216, 5449, 10098, 11459, 11060, 9922, 8139, 7175, 6289, 4794, 3394, 1600,
- -3137, -3309, -5826, -6310, -5500, -4385, -2187, -1054, -288, 502, 527, -129,
- -2997, -2031, -1344, 2452, 2535, 1856, 912, 451, 272, -124, -515, -993,
- 3808, 7001, 5536, 908, -807, -1665, -2041, -2232, -2449, -2206, -1782, -1905,
- -1117, 2493, 3616, 4843, 5755, 6273, 6815, 6906, 6769, 5801, 4580, 2528,
- 2509, 4911, 3439, -2294, -4945, -7203, -9006, -7957, -6818, -4297, -3321, -3009,
- -1110, 1877, 1776, 2112, 2398, 2704, 3465, 3938, 4257, 4039, 3202, 1568,
- 7131, 11568, 10626, 7755, 6467, 5073, 4839, 4543, 4128, 3206, 2160, 912,
- 2457, 10049, 15204, 18687, 18433, 17364, 14947, 13353, 11682, 8277, 6182, 3232
-};
-const Word16 lsf_cdk_wb_gc_stg2[] = /* 14Q1*1.28 */
-{
- -1224, -2316, -3425, -928, 128, 0,
- -1874, -2354, -1025, -624, -448, 0,
- -1026, -888, -481, -2352, -1024, 0,
- 838, 174, -2306, -4048, -960, 0,
- -1336, -2679, -1776, 2464, 1200, 0,
- 497, 2649, 3536, 1344, 320, 0,
- -1099, 4, 2448, -544, -752, 0,
- 993, 486, 592, 64, -480, 0,
- 288, -551, -2385, 1824, 2016, 0,
- -1090, -815, 128, 1008, 704, 0,
- 279, -579, -1729, -560, -832, 0,
- 60, 1211, 543, -288, 272, 0,
- 480, 1062, 560, 3152, 1680, 0,
- -1276, -672, 2961, 2704, 1200, 0,
- 1357, 1787, 767, -3424, -2768, 0,
- 4229, 3682, 1696, 192, -256, 0
-};
-const Word16 lsf_cdk_wb_gc_stg3[] = /* 14Q1*1.28 */
-{
- 15, 1, -1665, -4778, -4630, -3105, -554, -304, -112,
- 13, 10, -753, -1579, -1817, -1953, -2415, -2148, -1697,
- 8, 15, 1135, -1716, -3415, -5154, -4958, -3443, -1905,
- 4, 1, -32, 570, 443, -65, -2187, -2759, -2561,
- 4, 14, 399, -979, -269, 816, 385, -194, -673,
- 2, 5, -2161, -1600, -401, -97, -412, -433, -321,
- 0, 15, 2128, 3449, 1993, 175, -2815, -2580, -1729,
- 3, 2, 400, 714, 1209, 1904, 2711, 2436, 1840,
- 9, 13, 143, -1925, -2694, -2545, 358, 930, 960,
- 10, 0, -960, 868, 173, -513, -97, 577, 896,
- 0, 5, 1824, 11, -1080, -1761, -1565, -1058, -705,
- 7, 1, -880, 2304, 2790, 2384, 573, -18, -273,
- 5, 8, 1840, 1467, 978, 768, 598, 351, -17,
- 6, 7, -1473, -2052, -711, 992, 3166, 2788, 2080,
- 7, 12, 1856, 3557, 3483, 3184, 2417, 1923, 1408,
- 3, 13, -1649, 1850, 4068, 5073, 4907, 4086, 2976
-};
-const Word16 lsf_cdk_wb_vc_stg1[] = /* 14Q1*1.28 */
-{
- -1159, -1161, -5395, -12785, -14024, -12291, -8572, -6523, -4593, -1979, -1169, -897,
- -1903, -921, -2065, -1931, -2752, -3825, -4238, -4174, -4145, -3108, -2167, -2081,
- 522, 1696, -513, -6103, -8611, -9571, -9024, -8617, -7826, -5631, -4489, -3761,
- -1839, -544, -1280, 1080, 564, 752, 844, 1110, 1344, 1185, 1039, 63,
- -2685, -2538, -5074, -6161, -6745, -6738, -5709, -4457, -3377, -1830, -1188, -1185,
- -3059, -3565, -6706, -3405, -1183, -272, -112, 33, 160, -5, 13, -721,
- 4464, 5425, 1535, -8151, -13242, -15171, -5882, -2159, -288, 176, 739, 1440,
- 1431, 2210, -769, -2539, -889, -721, -4378, -6019, -8099, -8147, -6215, -3873,
- -1779, -2663, -8548, -12911, -8955, -5265, -1796, -700, 240, 746, 528, -160,
- -847, 1228, 735, -1117, -1191, -1857, -2236, -2407, -2321, -1779, -1542, -1665,
- -11, 1561, 591, -2764, -3940, -4994, -5679, -5652, -5586, -4852, -3930, -3297,
- -783, 2500, 2912, 1480, 864, -64, -492, -833, -769, -353, -452, -1009,
- -1207, 305, -1169, -3978, -4167, -3249, -1227, -606, -48, 233, -51, -545,
- -2442, -2531, -3873, 5622, 7990, 7025, 4210, 3337, 2576, 1042, 237, -673,
- 7644, 9215, 4703, -2206, -6625, -10676, -11281, -8039, -4321, -386, 15, -113,
- 5397, 7494, 5296, -39, -1846, -2017, -1875, -1846, -1697, -2156, -2072, -1969,
- -279, 230, -3010, -8280, -10317, -11859, -10729, -9576, -7922, -4867, -3862, -2865,
- -899, -234, -2897, 3569, 4566, 799, -5740, -7153, -6546, -3276, -2048, -960,
- 954, 3319, 1295, -3334, -5133, -5137, -2866, -2245, -1793, -1073, -934, -1281,
- -1098, 1538, 1024, 1919, 2978, 3729, 4709, 5431, 5521, 4962, 3843, 1920,
- -772, 429, -1810, -5319, -6411, -7074, -6828, -6001, -5266, -3901, -3160, -2833,
- -140, 1442, -1153, -2496, -631, 1264, 2033, 3167, 3840, 3225, 2577, 1232,
- 2263, 4102, 1167, -4671, -6812, -9651, -10507, -2400, 272, 1823, 1124, -2641,
- 3904, 5709, 4800, 1435, -1797, -3682, -7176, -9009, -11812, -10666, -5157, -2353,
- 122, 738, -2898, -9698, -11180, -8161, -1527, -926, -352, 476, -116, -705,
- 1615, 3938, 3296, -117, -1405, -2593, -4075, -4383, -4273, -3528, -3017, -2881,
- 3319, 4999, 2191, -4352, -6684, -7394, -7503, -7494, -6914, -5038, -4138, -3841,
- 1933, 5658, 4544, 2619, 2149, 1456, 812, 401, 240, 207, 12, -673,
- 1747, 3791, 1295, -236, -1712, -1232, 632, 903, 1488, 1527, 1184, 368,
- -1030, 922, 4017, 7665, 6754, 5073, 3236, 1989, 1056, 426, 45, -609,
- 12487, 14522, 8896, 2687, 1057, -3810, -10425, -9171, -6482, -2948, -2321, -1169,
- 7344, 9906, 7921, 4454, 3289, 2320, 1483, 513, 192, 491, 493, 79
-};
-const Word16 lsf_cdk_wb_vc_stg2[] = /* 14Q1*1.28 */
-{
- -182, -1035, -2593, -176, 528, 0,
- -2110, -2904, -2881, -1696, -864, 0,
- -160, -876, -1777, -4160, -2112, 0,
- 1601, 651, -1393, 208, -896, 0,
- -1109, -1806, -2112, 2592, 1360, 0,
- -1723, -1575, 1104, 912, 288, 0,
- -700, 1343, 687, 1408, 144, 0,
- 863, 454, 864, 464, -160, 0,
- -1234, -1141, -289, -832, 832, 0,
- -230, -608, -480, -1520, -2352, 0,
- 1268, 2126, 1919, -3440, -3072, 0,
- 1298, 1365, -65, -2832, 672, 0,
- 1095, 493, -849, 3184, 3056, 0,
- -469, -479, 1617, 3728, 2112, 0,
- -675, 1400, 3984, 240, -592, 0,
- 2580, 2697, 2432, 1920, 1040, 0
-};
-const Word16 lsf_cdk_wb_vc_stg3[] = /* 14Q1*1.28 */
-{
- 7, 3, -1329, -4391, -3913, -3041, -859, -255, 176,
- 13, 7, -2257, -960, -1287, -1649, -1313, -770, -433,
- 3, 13, -33, -1650, -2302, -2721, -4039, -3798, -2609,
- 10, 4, 0, 1123, 279, -1057, -2271, -1039, 160,
- 7, 12, 15, -748, 384, 848, -1029, -1992, -2385,
- 4, 1, -2417, -2753, -316, 912, 1240, 993, 704,
- 0, 0, 2497, 3043, 1347, -849, -5667, -5913, -4193,
- 5, 2, 848, 519, 1737, 2560, 1763, 1506, 912,
- 12, 12, 271, -2734, -3306, -736, 1294, 383, -209,
- 10, 14, -577, -71, -129, -449, 1561, 2068, 1920,
- 14, 1, 1408, -1285, -2943, -4177, -1355, 306, 752,
- 15, 8, -2529, 2194, 2953, 2368, 1761, 1377, 816,
- 14, 10, 3024, 1322, 224, -304, 514, 511, -81,
- 1, 12, -849, -709, 112, 2417, 5221, 4664, 3648,
- 1, 9, 160, 3607, 3314, 2016, -333, -884, -1233,
- 13, 12, 1888, 3621, 3935, 4000, 3607, 2932, 2128
-};
-
-const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES] = /* 14Q1*1.28 */
-{
- {
- { lsf_cdk_wb_gc_stg1, lsf_cdk_wb_gc_stg2, lsf_cdk_wb_gc_stg3 },
- { lsf_cdk_wb_vc_stg1, lsf_cdk_wb_vc_stg2, lsf_cdk_wb_vc_stg3 }
- },
- {
- { lsf_cdk_nb_gc_stg1, lsf_cdk_nb_gc_stg2, lsf_cdk_nb_gc_stg3 },
- { lsf_cdk_nb_vc_stg1, lsf_cdk_nb_vc_stg2, lsf_cdk_nb_vc_stg3 }
- }
-};
-
-const Word16 lsf_numbits[TCXLPC_NUMSTAGES] = { 5, 4, 4 }; // Q0
-
-const Word16 lsf_dims_ivas[TCXLPC_NUMSTAGES] = { 16, 6, 10 }; // Q0
-const Word16 lsf_offs_ivas[TCXLPC_NUMSTAGES] = { 0, 0, 6 }; // Q0
-const Word16 lsf_dims[TCXLPC_NUMSTAGES] = { 16, 8, 12 }; // Q0
-const Word16 lsf_offs[TCXLPC_NUMSTAGES] = { 0, 0, 4 }; // Q0
-
-
-const Word16 lsf_ind_cdk_nb_gc_stg4[] = /* 14Q1*1.28 */
-{
- -1360, -704, 0,
- 80, 256, 0,
- -896, 1008, 0,
- 960, 2016, 0
-};
-const Word16 lsf_ind_cdk_nb_vc_stg4[] = /* 14Q1*1.28 */
-{
- -1360, -944, 0,
- 624, 1408, 0,
- -368, 240, 0,
- 2480, 3216, 0
-};
-const Word16 lsf_ind_cdk_wb_gc_stg4[] = /* 14Q1*1.28 */
-{
- -1280, -816, 0,
- 368, 272, 0,
- -704, 1136, 0,
- 1296, 2448, 0
-};
-const Word16 lsf_ind_cdk_wb_vc_stg4[] = /* 14Q1*1.28 */
-{
- -1040, -848, 0,
- 688, 400, 0,
- -560, 1520, 0,
- 2256, 2704, 0
-};
-
-const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES] = /* 14Q1*1.28 */
-{
- { { lsf_ind_cdk_wb_gc_stg4 }, { lsf_ind_cdk_wb_vc_stg4 } },
- { { lsf_ind_cdk_nb_gc_stg4 }, { lsf_ind_cdk_nb_vc_stg4 } }
-};
-
-const Word16 lsf_ind_numbits[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0
-
-const Word16 lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0
-const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES] = { 4 }; // Q0
-const Word16 lsf_ind_offs[TCXLPC_IND_NUMSTAGES] = { 0 }; // Q0
-
-const Word16 min_distance_thr[2][2] = /* 14Q1*1.28 */
-{
- /* GC, VC */
- /* WB */ { 580, 580 },
- /* NB */ {1000, 580 }
-};
-const Word16 lsf_q_diff_cb_8b_rf[256 * 16] = /* Q6 */
-{
- -3145, 863, -1389, 4087, 1110, 3193, 290, -3160, 824, 212, -2936, -5827, -10181, -15650, -13373, -3849,
- -4602, -3228, -8398, -1649, -5788, -8971, -2025, -2971, -1476, -2748, -2458, 966, -4, -1802, -1360, 654,
- -8629, -7702, 6280, 3296, -1205, 365, -5964, 3125, 2443, 1442, 1149, -3835, -9867, -4238, -1977, -1955,
- -2629, -759, -2056, -2297, -1839, 1678, -2412, -7539, -13208, -9624, -1688, -2171, 943, -454, 536, 2644,
- -2840, -1391, -10500, 2516, 907, 146, -2762, -6750, 2949, -2282, -4614, -5663, -7773, -5510, -5947, -3727,
- -4006, -939, -2500, -771, -3414, -4521, -6417, -4064, 3698, 3969, 4300, 4177, -3195, -10419, -13072, -6695,
- -4284, -1172, -4415, -1601, -6029, 66, -4338, -2300, -3402, -5614, -7181, -7288, 7154, 6538, 64, -3263,
- -6470, -4503, -9698, -5885, 235, 5049, 2698, -3656, -3600, -6261, -4270, 766, 1037, -1511, -1274, 1800,
- 669, 2937, -3464, -1034, -4098, -11296, -382, -4610, -9613, -2081, 3947, 2832, 2962, -332, -9039, -10702,
- -11109, -5950, -7200, -6525, -4260, -5060, -8936, -91, -672, 4557, 3192, -147, -2247, 1566, -734, -3007,
- -2411, 1587, -2575, 2172, -3270, 10648, 7093, 1517, 1512, -392, 49, -9117, -16895, -908, -8443, -9923,
- -1934, -603, -6588, 5335, -1565, -11521, 5944, -5092, -615, -2221, -7703, -1903, -5195, 2323, 3958, 3050,
- -7094, 5361, -7885, -3299, -3282, -3125, -1888, -406, 1522, -23, -1506, -6075, -8517, -7605, -3450, -3362,
- -3573, -2421, 1385, -181, -11027, 4778, -4014, -4956, 7316, 3138, 2351, 3406, -1998, -968, -2375, -3262,
- -141, 6652, 11944, -4131, -2073, -2592, -1562, 1521, -1804, -2585, -2685, -5798, -10850, -11629, -4300, -4287,
- -1569, 2229, 2330, 3147, -1026, -7010, 265, -1320, -3648, 1942, -5375, 73, 10348, 3913, -5535, -5938,
- -5642, -3433, -8423, 1178, -540, -4790, -1976, 4686, 1701, -1323, -2009, -5997, -5693, -3852, -7604, -5361,
- -1784, -325, -8561, -17592, 1663, 1377, 2347, -245, -2426, 141, -137, 985, -4926, -7898, -3559, 895,
- -2548, -1563, -5007, 7311, 4409, 3177, 3920, 1546, -725, -5252, -9754, -9267, -5701, -6900, -961, 1772,
- -1676, 889, -4798, 8060, 3460, -1911, 415, -4044, -6146, -12074, -10588, 13056, 2765, 1396, -4737, -4905,
- 943, 3342, -8515, 4676, -774, -3963, -5503, -1625, 3909, -3614, 12347, 2835, -9710, 5877, 297, -918,
- -5317, -2799, -3708, -4084, -8175, -6155, 1752, 6801, 7493, 6271, 4083, 3132, -809, -4200, -5389, -5982,
- -5060, -5285, -1533, -2751, 2259, -3893, -3473, -108, -4711, -2627, -2069, -2320, -172, 1547, 770, 309,
- -4485, -2618, -7238, 1767, -2965, 6693, 5256, 18, -1789, -5076, 7167, 3204, -1242, 1628, 4519, 1796,
- -114, 1225, -3083, 321, -4002, 4834, -3014, -741, -4189, -5946, 6871, -2068, -13016, -9772, -3235, 2044,
- 559, 10477, -9704, -7733, -8989, -10787, -10342, -8585, -2844, 1474, 5638, 9798, 10986, 9105, 4619, 2186,
- 1576, 9039, 4354, 2073, 1861, -1492, -715, 1840, -6736, -10798, 994, -2921, -6369, 779, 2668, -443,
- -2067, -1020, 1, 14571, 2253, -2163, 5255, 973, -1722, 4173, 102, -3633, -1430, -1720, 1243, 1749,
- -6589, -1601, -9469, -5581, 3018, 1186, -11, 1252, 5708, 3338, 187, -3950, -6035, -3294, -106, -1130,
- -2490, 445, -2543, -3283, -3432, -6963, 9950, 4072, 2294, 4517, 2736, 8173, 4270, -8347, -9374, 4776,
- -66, 3476, 537, 2659, -677, 1552, 1974, -1703, -2139, -634, -1988, 694, 1921, -12938, -16525, 5848,
- -9849, 7389, 4653, -1158, 1340, -2250, -2460, -2201, -3122, -90, 3974, 5105, 9127, 8701, 6184, 3770,
- -5086, -3159, -3197, -9944, -7474, 961, 1158, -3536, 1050, 5572, -1480, -11120, -9276, -1841, -2086, -24,
- -1019, -346, -6765, -8343, -6302, -3019, -5606, 2728, -3994, -6909, 10146, 6321, -230, -393, -846, -1536,
- -1598, 3610, 3330, -233, -1215, -1953, -1330, 19, -4839, -10681, -11699, -1104, 1146, -6143, -6849, 422,
- 892, 7937, -5005, -5547, 1756, -4020, -3420, -6811, -6304, -7812, -6019, 5109, 5503, 5568, 4600, 6472,
- -3296, -2230, -6010, 3497, 5502, -2291, -2342, -6544, -12576, 2192, -1004, -5205, -500, -6764, -6200, 1816,
- 5114, 4922, 6498, 6613, 4909, 2318, -5626, -11915, 3072, 11570, 1766, 4361, 552, -8139, -14006, -17228,
- -3321, -1514, -473, 3295, -1028, -4536, -12374, 12452, 7396, -2269, -5052, 554, 1053, -4370, -5859, 97,
- -2532, 2546, -4920, -13800, 8116, 2425, 1695, -2088, -5105, -346, -2869, -2457, 9336, 13166, 6150, 5166,
- -2329, 72, 11513, -3075, -7745, -5492, -8015, -5108, -16, 3261, 876, -357, -3241, -2956, -4265, -2320,
- -7869, -6495, -16668, -1339, -3678, 975, -2740, -2776, 3755, 141, -190, 1026, 5972, 3232, -924, -3212,
- -1077, 568, -5606, 1478, -243, 2479, 10198, 3667, 682, -2873, -9164, -9042, 2186, 4347, -750, 5303,
- 556, 5098, -6825, -2564, -3946, -5752, 1977, -6171, -5627, 4580, -835, -6362, 10132, 9511, 6475, 2861,
- 3320, 11074, -483, 2698, -20, -4084, -4213, -3931, -231, -17, -1826, -2737, -5920, -1539, -1897, -3347,
- -1346, 2075, -1230, -5248, 10906, 9461, 5046, 3485, -267, -948, 4273, 1889, 81, -488, -4763, -5532,
- -1237, 6446, 3974, 5166, -723, -10033, 8338, 4102, 683, 1474, 624, -5287, -8628, -7519, -6290, 1767,
- 207, 2676, 870, 13754, 7087, 2357, -922, -1734, -4651, 352, 14028, 10050, 8916, 2725, -5722, -9415,
- 364, 3660, -813, 4370, -2151, -2115, 5570, -2545, -8167, -1978, -8301, -10715, 959, -5127, -11250, -7721,
- -1668, -1437, -5508, -11155, -15130, 6829, 6070, -1555, -3048, -314, -528, 1714, 1474, -42, -541, 3361,
- -15356, -12047, -4659, -1598, 4105, 3069, 2375, 3647, 1217, 140, -2518, -4195, -3080, 2155, 66, -570,
- 84, 1523, -742, 13326, 5544, -2653, -5484, -3816, -9239, -10794, 6967, 2095, -4231, -2102, 4368, 8737,
- 2959, 3968, -2430, 4601, 317, 5804, -3547, -11099, 5849, 273, -5513, 767, -9421, -11095, 3029, 8472,
- -518, 2355, 2733, 53, -1439, -2709, -394, 5355, -2408, -3122, 8729, 5660, 7771, 4999, -7588, -15134,
- -2240, 2281, 6677, -5155, 5663, 266, -4355, -7052, -3825, -2235, -2745, -3212, -2018, 1828, 1971, 2086,
- -1241, 699, -2126, 3835, 1147, 4456, -3810, -23, 1284, -4878, 3807, 14029, 2820, -6773, 9556, 6600,
- -1716, 315, -3259, -3282, -2859, -2219, 3508, -3452, -7850, 623, -5558, -2168, 1842, -8228, -885, 15388,
- -8177, -7705, -14377, -6808, -7099, -7676, -4141, -5548, 3677, 5846, 6160, 10031, 11318, 8141, 3326, 904,
- -3072, 1139, 1875, 4811, 3767, 7294, 4507, 1476, -1622, -6385, 384, 3318, -3867, -10447, -6387, -4252,
- -19, 1102, -6317, 3433, -1856, -5732, 7225, -2107, -6977, 9620, 7964, 3013, 7152, 4986, -2184, 2136,
- -524, 1479, -923, 3729, -259, 227, 6477, 2660, 4208, 1017, -423, -6090, -13677, 5309, 702, 2721,
- -822, 2175, 1717, 3580, 1133, 3835, 980, 13265, 6367, 2741, 7462, 6211, -2347, -7635, 4781, 4132,
- -8168, 13481, 5777, -963, 643, -2853, -2086, -1593, -2092, 2348, 3867, 413, 461, 1644, -259, -1656,
- -846, 1615, -2805, 935, 3206, 1907, 7862, 3901, -975, 4507, 3151, 1433, 15449, 4412, -1221, 1001,
- -3952, 1411, -2148, -1025, -2553, -4164, -4725, -3465, -2654, -3828, -6151, -7679, -5881, -2007, -581, -2499,
- -1744, 4546, -8725, -6274, -1364, -1087, -2198, -4504, -3542, -1966, -516, -802, 448, -162, -1277, -2081,
- -12133, -10923, 10206, 4436, 611, -2300, -4926, -4708, -5138, -3373, 2358, 295, -370, 4406, 2947, 351,
- 1477, 3584, 3776, 4714, -1508, 2029, 426, -5245, -2805, -5852, -8752, 199, -3945, 10358, 10127, 4852,
- -1894, 528, -776, 2698, -1298, -7579, -12457, -12545, 2483, 2421, -140, 723, -395, -292, -4196, -1766,
- -3071, 1449, -3716, 3712, -3017, 543, -391, -1984, 3301, 375, 1107, -2635, 4730, 870, -19666, -12653,
- -2823, 3165, 5399, -10321, -6087, -2824, -329, -1699, -268, -1995, -2254, 2744, 319, 51, 2834, 452,
- -2837, -240, -1298, 2244, 1977, 3061, 3676, -1207, -3774, -2607, -3405, 9701, 12102, -3052, -10263, 1164,
- -1548, -515, -3862, 1117, 3329, 4105, -804, -4141, -9321, -3136, 1792, 3484, 2025, -6747, -11991, -10905,
- -3361, -2922, -3472, 1165, -3055, -1620, -4751, -8940, -477, 1932, 1054, 4687, 5735, 5566, 2447, -778,
- 1791, 3768, 602, -2421, -6876, 9505, 7350, 2428, -3175, -6252, -707, -3720, -7723, -42, 4292, -1141,
- -2469, 269, -1028, 1057, -890, 383, -128, 821, -2854, -5548, -2437, -3349, 3935, 1474, 14267, 13393,
- -3416, 14072, 1196, -3166, -4252, -711, 521, 2462, 5346, 1483, -4287, -7676, -5805, -321, 867, 475,
- -1674, 1391, 539, -471, -5201, -25, 6911, -2142, 10454, 10963, 1353, -2831, -3219, -131, -3005, -4468,
- 3476, 4986, 6318, -2959, -9204, -87, 3906, -833, -247, 5687, 451, 716, -2970, -5788, -6743, -9436,
- 4831, 6767, 3852, 2164, -1362, -1404, -3260, -4807, 2809, -2699, -4693, 21984, 10803, 4063, 2353, 6177,
- -2813, -890, -5363, -165, -5755, -20361, 3639, 4639, -2073, 1798, -1097, -6169, 30, -1827, -4590, -2586,
- -5855, -6418, -10115, -6038, 2674, 3620, 1206, 1379, -520, 5333, 5334, 3618, 439, -1048, 439, 777,
- -7871, 2657, -3649, 7671, 10875, 5285, 423, 1869, -2283, -6081, -2750, -3935, -1815, 2851, 754, -2545,
- -2253, -245, 87, 3432, 4323, 803, -3981, -8416, -12174, 6263, 9281, 7472, 2558, 327, -3198, -1436,
- -1398, -211, -6595, 4670, 63, 2041, -4372, 967, 2444, -9123, -11355, 1727, -4221, -3144, 6411, 4338,
- -4409, -3256, -6504, 6064, 4055, -2268, 5638, 5466, 82, -516, 6974, 5206, 1235, -364, -4919, -6016,
- 2, 7, -5, 5, 1, 2, -8, 4, 4, 2, 4, 5, 0, -1, -3, 1,
- -1139, 1101, -1501, -3122, 2059, 9130, 5593, -2976, -5845, -8198, 10800, 771, -4815, 20594, 5385, 9434,
- -497, 877, -5365, -1190, -2940, -6216, 4700, 872, -2276, 9901, 5530, 417, -4381, -9743, -1935, -1025,
- -3555, -643, -5254, -6674, -6586, -4879, -3791, -2733, 1046, 2275, 3157, 3643, 8384, 10607, 11929, 9237,
- 1573, 3323, 130, 12128, 9521, 6522, 4035, -1444, -7190, 565, 2160, -2808, -3716, -9398, -1115, 4631,
- -1938, -2034, -5142, 6407, 5972, 302, -3078, -7362, -12229, 6591, 5640, 1240, 2727, 3243, 9738, 7334,
- -8793, 935, -4176, 103, 2398, 1724, 1579, 7649, 5685, 2791, 1754, -453, -5030, -4870, -3871, -3139,
- -243, 3111, -2068, 3022, -4587, -11340, 14571, 7771, 3558, 5750, 1203, 4665, -1981, -109, 4442, 1369,
- -2041, 3713, 1013, 1345, 4716, 129, 3062, 1444, -3639, -6184, 7457, 7819, 958, -8391, -8799, 9312,
- 235, 3895, 12172, 2716, -1347, -1094, -4869, -880, 7519, 9011, 9914, 5683, 5909, 7805, 4428, 2129,
- -1538, -36, -678, 1486, -649, 1517, -5121, 8530, 5048, -1844, -4781, -9145, -11353, -8076, -4133, -307,
- -2707, 80, -5905, -4315, -4389, -6758, -6105, -9003, -10744, -1701, 3765, 6091, 10523, 7504, 4350, 4312,
- 786, 3663, 9280, 6578, 391, 1514, -7019, 5089, 3483, -6871, -8172, -180, -7469, 1419, -121, 838,
- 2692, 6995, 1431, -1074, 1394, -268, -1170, -3367, -7586, -5698, 7587, 7378, 5733, 8353, 10152, 10834,
- -8158, -6271, -9914, 9985, 5364, -2601, -1959, -6260, -4097, 3235, 2097, -196, 2968, 3371, 2095, -1207,
- -2269, 648, -1910, 7766, 5356, 3667, 981, 2825, 4288, 6668, 696, -661, 4042, -5356, -12858, -3646,
- -4703, -3239, 10100, -2312, -256, -2120, -2612, 4835, -1675, 1068, 5746, -140, -869, 3620, 3505, 1703,
- -3250, -2423, -1423, -674, -4843, 10905, 4109, 635, -1606, -6241, -2449, 3295, 6275, 14389, 8002, 4352,
- -842, 3170, 1430, 1513, -4583, -12820, 1470, -4220, -8952, 6987, 4718, 532, -2136, -3700, -1727, 4512,
- -3663, -2257, -8998, 5471, 843, -2858, -4142, 5134, 7250, 525, 3002, 118, 423, 6929, 5389, -1003,
- -3457, -2564, 4399, 5758, -1462, 9992, 2582, 885, 6350, -670, -4446, -5882, -1814, -1178, -3073, 1157,
- 2529, 7505, 5440, 202, -5746, -976, 8235, 1049, -181, -142, -6919, -6675, 18283, 16554, 8385, 3001,
- 2266, 12753, -3253, -3832, -7200, -5627, -4778, -925, 239, 539, 2225, 324, 3182, 1914, -309, -507,
- 5074, 4381, 9167, 1915, -3908, 1754, -5997, 2537, 17796, 13293, 7314, 12286, 1815, -4329, -8064, -20774,
- -2484, 4942, 14515, 5406, -2595, -1380, 8417, 5956, 1651, 1559, -1389, 24, -6421, -4047, 2557, -1331,
- -3164, 848, 15096, 9663, 6043, 3180, 595, 2733, 830, 1861, 9051, 8435, 8904, 6571, 2208, -762,
- -135, 870, -2484, -3227, -9497, -586, 14177, 5880, -3708, 505, -1483, -415, 2507, -1973, -13853, -8468,
- -3854, -2420, -9258, -4766, -3435, -2360, 10467, 7572, 598, -4099, 3457, 402, -195, 4193, 2023, 1851,
- -4359, -3760, -1315, -585, 11411, 2958, 5446, 1608, 228, 4691, 1446, -1971, -3898, -3822, -1651, -1697,
- 5112, 1738, -12375, 11069, 8416, -139, -721, 740, -8678, -7527, 10378, 4791, 5388, 2724, 4652, 1931,
- -1419, 520, -6325, 10393, 8379, 2544, -2104, -11110, 7461, 2884, -1766, 548, -217, -2709, -1287, -2598,
- 1996, 4969, 3862, 5813, -629, -7138, 7107, 9009, 5157, 1564, 5244, 1326, 78, 263, -4389, -5858,
- -5423, -34, 1648, 2316, -3981, -5525, -1762, -996, 2075, 878, 718, 1458, 613, 3914, 3912, 2074,
- -1176, 643, -3222, -444, 779, 9634, 14238, 11755, 3727, 1970, -1421, 3653, 1795, -2315, 10947, 8623,
- 19, 6095, 3277, 2648, 2148, 509, 3577, 978, 1862, 5842, 1302, -3853, -10993, -12406, 858, 7763,
- -4944, -1993, -5563, 833, -1365, -2240, -25, 2546, 10150, 10369, 10670, 10551, 9322, 5582, 881, -1029,
- -763, 4474, 9314, 8818, 2703, 4844, 7776, 1684, 1, -3980, -9739, 5565, 2667, 1185, 2203, 1611,
- -635, 724, -4112, 8414, 3049, 1437, 2314, -2611, -5835, 5541, -3027, 1017, 14246, 10165, 9910, 14393,
- 2201, 3204, -295, 2519, -855, 5303, -2184, -12725, 10839, 1337, 154, -5290, -7908, 9490, 4292, 5533,
- 544, 3574, 602, -783, -3121, 21721, 8166, -1137, 4729, -2399, 2504, 3721, -2704, -10309, 4957, 8028,
- 2782, 11109, 5440, 2691, -3942, 3286, 2848, -532, -186, -2661, 7318, 6015, -1200, 2174, 5498, -379,
- 4440, 6050, 3576, -819, -3697, 13144, 9664, -2178, 2966, 3302, -623, 10572, 15713, 9000, 2137, -5160,
- -1593, 613, 3985, -7128, -5989, 2429, 721, -5488, -11848, 981, -3054, -4499, -4102, -7743, -7416, -340,
- -2759, -2449, -4426, -6796, -13804, -7472, -1409, -1103, 181, 3071, 434, -741, 1045, 1976, 1407, 1365,
- -2578, -1275, 5323, 9313, 4798, -1130, -6220, -2101, -3402, -868, -1959, -4365, -4536, -1626, -3701, -5011,
- -3479, -3407, -9706, 4812, -812, -4014, 2558, -5416, -10543, -5186, -3840, 1189, 3804, 5839, 4744, 1003,
- -3585, -2339, -4745, 3869, -2763, 1306, -6059, -8604, -1377, -5116, -730, -1693, -3321, 888, -685, 876,
- -3492, 910, -7012, -2555, -5147, -1372, -1910, -8518, 2661, 7652, 6967, 7296, 4514, -4741, -9827, 873,
- -1258, 4649, 3654, 653, -5264, -5509, -4222, 1703, 3992, -5102, -4342, -6447, 6603, 2642, -923, 6242,
- -992, 647, 1228, -3124, -3463, 15067, 838, -6186, -3433, 872, 97, 2876, 3686, -2643, -6780, 356,
- -1727, 2555, 2552, -1938, -8798, -773, -757, -3588, -7005, -6121, 4601, 235, -4446, 2984, 1353, -776,
- -15055, -12154, -6273, 84, 390, -3286, -4758, -3713, -2185, -1512, 1403, 3479, 7578, 6327, 5045, 3075,
- 2469, 8960, 6679, 3813, 1059, 9183, 2971, 4300, -1040, -927, -2376, -6240, -5131, -6030, -7385, -7560,
- 933, 4512, -899, -1226, -7230, -10649, 11249, 4655, -7924, -5423, -5107, 993, 588, 2896, 4305, 1369,
- -1938, 11282, -2696, -7285, 1163, -6289, -344, -2329, 3632, 2191, -1017, -1404, -2305, -6223, -2822, -1369,
- -3688, -918, -3118, 256, -5446, 8638, 6195, 2855, 7432, 6937, 8638, 4020, -3296, -4260, 21, -3914,
- 3006, 5845, 16377, 17059, 3579, 103, 204, -563, 1735, 6204, -405, -2618, -7929, -14028, -9415, -5277,
- 303, 934, -305, 3211, -2970, 2963, 10231, 2833, 1656, 1162, -4439, 6346, 9314, 7062, -5015, -15980,
- -320, 499, -14803, 4610, 2112, -4049, 7242, -245, -3115, 1323, -1276, -4286, -1951, 100, -1389, -1612,
- -4391, -2691, -5202, -11000, 373, -2423, 4221, 4146, 1045, 503, -4063, -2244, 2311, 1646, -1779, -3188,
- -3374, 346, -3243, -3662, 5971, 5519, 3022, 516, -4538, -6550, -5227, -6165, -4919, -1105, 30, 721,
- 2935, 3922, -1041, 4217, 2528, 1985, 661, -824, -10133, -13715, 8714, 2218, 3769, 3384, 1193, -6246,
- -5357, -2959, -8106, 5394, 1542, -4964, -7749, -4183, 877, 1146, 8307, 2891, -4905, -5775, 1888, 1442,
- -2472, -850, 1278, 1397, -4545, -3625, -11722, 9811, 7790, 7832, 12234, 6079, -2436, -890, -1820, -234,
- -3905, -1081, -7818, 2577, -299, 5742, 4982, -1421, 3506, -604, -4944, 2130, 544, 1545, -2399, -3202,
- -895, -203, 783, -203, -2734, 10200, 7718, 3943, -6098, 9859, 9374, 6777, 2263, -2089, 866, 3381,
- -3828, 1991, -2866, -1612, 747, -3896, 6041, 2875, -5838, -6829, -2319, -1146, -8845, -10612, 3630, 2942,
- -509, 5457, 1119, -3222, -3623, -6421, -9746, -8661, 5658, 8283, 8062, 6310, 1787, 454, 1766, 2750,
- -1632, 7787, 5349, 243, -1526, 3143, 5218, 10290, 1446, -6324, -3035, -1055, 2974, -7871, 39, 3664,
- -769, -9, -8896, 9699, 4546, -1295, 6107, -4534, 3367, 1450, -3607, 8816, 3219, -5601, 1298, 12366,
- -7130, -4420, -6848, 3453, 3599, 4371, 609, -6059, 8057, 9067, 2408, -3523, -6908, -6822, -6636, -2017,
- -477, 5145, -1462, -475, -2003, -3769, 7781, 4563, 4437, 2134, -2726, 15777, 2839, -1929, 2913, 2174,
- 841, 2396, 754, 14163, 4130, -1807, -177, -3884, -6782, 9287, 1864, -599, 5913, -2587, -10749, 5856,
- 1304, 7980, -2237, -2092, -4384, -828, 552, -6108, 2193, 10107, 6057, 9885, 13003, 8977, 4006, -926,
- -1523, 1282, -1805, -2709, -6024, -7618, -10251, 832, -689, -1488, 1528, -1635, -4512, -3974, 3366, 5884,
- -2891, -646, -4227, -16787, 4586, 2689, -48, 1956, -5398, -5693, 4030, 1138, 2292, 2634, 6453, 3271,
- -3526, 9059, 2896, 8101, 3313, -270, -1336, -3002, 826, -1572, -3793, -2235, -1597, 272, 910, -778,
- -1195, 3634, 1576, 2036, -3675, -10512, -6414, -3268, -9714, -6636, 3287, -947, 6643, 7755, 4317, 2928,
- -592, -46, -6118, -3775, 11750, 5301, -2878, -7240, -4674, 1543, -626, -1300, -608, -1661, -4053, -3154,
- -2514, -545, 771, 7292, 3641, 749, -1664, -1652, 2686, 8715, 10176, 4547, -6065, -7417, -6454, -4928,
- -576, 940, 681, 2977, -2947, -1968, -6468, 10093, 7720, -2235, -3869, -8057, -4152, 7399, 8617, 5658,
- -1043, 1637, -3699, -5968, 13092, 1526, 1185, -3128, -2234, 3343, 5773, 9935, 7870, 6240, 3284, 3932,
- 377, 5872, 3528, 3824, -852, -1575, -3799, -8401, -5628, -3612, -2451, 1396, 1471, -1669, -579, -384,
- -6978, -4522, -6731, -1881, 1485, -73, -38, -3990, 11379, 4104, 1154, 5492, 3709, -645, -641, -750,
- -97, 2556, 1619, 3351, 1996, 10845, 8411, 2751, 3099, -165, -6582, -11822, 8128, 7722, 4495, 3322,
- 950, 2744, -2039, -3959, -6098, -2113, 4512, -1699, -758, 3243, -4760, 7788, 11837, 5336, 7626, 5509,
- -4876, 13906, -3059, 1351, 4037, 2283, 614, -5014, 2149, 613, 744, -4239, -5981, -4296, -1799, -3121,
- -2111, 3530, -1221, 1654, 9442, 10361, 6422, 7826, 7510, 7790, 3836, -323, -761, 1652, 330, -386,
- -3239, 3070, 7009, -1209, 6710, 213, 5225, 3105, 1173, 842, -1774, -5027, -3901, -1359, -2786, -3513,
- 1481, 1904, 7402, 23443, 5946, -3615, -1528, -4317, -2629, 11277, 7171, 5620, 7938, 4715, 3575, -3794,
- 2315, 5200, 63, 4010, -400, -2074, 6624, -516, -731, -2133, -10088, 6969, -3380, -7450, -7347, -6915,
- -3407, -3447, -1422, -4020, -11809, 3562, 3865, 570, 7656, 6367, 5964, 802, -2306, 5862, 7700, 6476,
- -17049, -2577, 3748, -1004, 990, 2569, 4487, 2137, -3540, -3508, 608, -2102, 90, 4634, 3115, 1273,
- -1960, -1414, 1516, 9460, 6833, 2088, -3598, -3590, -2554, -1783, 2680, 2127, 939, 8562, 4170, 1914,
- 3335, 6241, -2988, 1816, 3233, -951, 587, -5590, -3415, -926, -7987, 8897, 3700, -12712, 5722, 4683,
- -756, 1823, 2804, 3392, -2019, 801, -2923, 43, 5720, 2302, 3604, 14791, 4960, -425, -7298, -6606,
- 205, 5909, 8599, 4641, -4600, -1580, -4536, -5178, 2346, 6910, 3641, -2630, -6079, 351, 5478, 5524,
- 151, 1252, -2569, 6834, 5377, 4284, 450, -1607, 7257, 4429, -2568, 9851, 9183, 2197, 20053, 9155,
- -1462, 924, -3196, -3257, -8953, 6147, 6251, -3186, 3285, 3198, 2326, 1225, -8446, -11295, 5393, 10785,
- -2381, -2014, -9329, 4719, -880, -2308, -4714, 4429, 3675, -1874, 3253, 9686, 12557, 9338, 4719, 3836,
- -3103, 7031, 11258, 6883, 11690, 8131, 3644, -307, -2590, -274, 1004, -1314, -166, 3063, 695, -1815,
- -2455, 811, -1161, 2731, 5931, 2352, 3361, -363, -7371, 2805, 4053, 3586, 7364, 242, -1692, 17531,
- -4497, -535, 286, 214, 3804, 11412, 4562, -1157, 550, 4841, 1657, -4984, -6307, 1482, 5745, 3540,
- -2763, -1313, -1385, 3735, -2423, 5601, 14635, 10815, 9726, 6141, 4010, 3556, -104, -3353, -7143, 7077,
- -245, 8209, 15457, 5234, 1860, -2195, -4620, -4895, -4263, -759, 2016, 2664, 3153, 2966, 1601, 30,
- -4764, -1351, 3227, 2660, 1556, 198, 5379, 11277, 8580, 6978, 2506, 3310, 13165, 9623, 7120, 1665,
- -59, 558, 3194, 1299, -2918, -2455, 3754, -3394, -3634, -2782, -7987, -7903, -7058, -2214, -1060, 2183,
- -1954, -186, -11418, -2859, -1110, -2027, -932, -2040, 1282, 174, -161, -2628, -3341, 2675, 4169, 2475,
- -5934, -5196, 10580, 9382, 1417, -1362, -2572, -4391, 7418, 4314, 148, 31, -82, 461, -2595, -570,
- -3639, -2081, -1014, 4355, 5943, 6217, 2491, -4106, -6520, -4050, -5030, -2053, 6821, 6135, 2456, 1015,
- -3447, -1303, -5380, -6759, -3272, -129, -4989, -11231, 5106, 1264, -3433, -3327, -3139, -1282, 1031, 1558,
- 4180, 1592, -3435, 2252, -4803, -6443, 8937, 1696, -5599, 9240, 5481, -328, 3197, -4392, -12452, -16482,
- -4613, 5693, 11596, -9035, 1399, 1388, 5182, 4750, 958, 310, -866, 829, 5122, 1203, -115, -759,
- -3551, -1843, -3272, -1753, -195, 17324, 8182, -502, -2987, -146, -2640, 6865, 6979, -3675, -6047, 12865,
- 3739, 8307, 5634, -2783, 96, 1167, -274, -636, -5808, -8880, 835, 6363, 5092, -700, -8229, -7634,
- -6799, -5871, 4391, 1265, -1493, 440, -7322, 2387, 1763, -1406, 4030, 8075, 8810, 5655, 1375, 2309,
- 3191, 6527, 2671, -128, -5345, 14221, 13006, 1792, -548, -2974, -7549, -3471, 1835, -1490, -3556, -4240,
- -3368, -1748, -3945, 8349, 2444, -5349, 5825, 4222, -1891, -3570, -10832, 8764, 2791, 5495, 9332, 5366,
- 1020, 5766, -8313, 522, -568, -20, -2169, 3981, 6641, 4235, 1781, -4362, -7143, -3864, -2205, -3217,
- -3300, -1346, -1200, 5950, -1315, -285, 2642, -180, 12986, 11560, 5996, 6755, -2578, -1417, 1848, 5560,
- 10662, 13080, 11225, 419, -4335, -128, 6716, 1638, -4903, 154, -2404, -4228, 5262, -364, -5170, -12310,
- 360, 1588, 2173, 8939, 4304, 7241, 367, -2361, 6569, 837, -4801, 8650, 7208, 5996, 3566, 1112,
- -5017, 4300, 2649, 3064, -6110, -14292, 2204, 13008, 5245, 1594, -6536, -11045, 5146, -211, -4067, -11435,
- -530, 1840, 187, -12175, 1984, -1576, 3659, 4293, -1971, 8025, 8287, 4420, 3935, 358, -1691, -2707,
- -3429, 252, 1235, 3895, 13024, 5900, 317, 1720, 3724, 1510, -3576, -6091, -8218, -3620, -844, -406,
- 2105, 7096, 3064, 3952, 2071, -2774, 8459, 1501, -10913, 1387, -405, 12863, 2328, 4475, 3498, -1584,
- -3085, -920, -7032, 8494, 2146, 1346, 1867, -404, 1886, -1042, -378, -2121, -10433, -7336, 15525, 9808,
- -15685, -7623, 1925, 2963, 4001, -105, 3843, 5498, 4039, 6151, 6044, 3867, 1730, 2971, 1484, -319,
- 3080, 9412, -1223, -3973, 4734, 2248, 3127, 1119, -1738, -1669, -1477, -1472, 1412, 1213, 773, 1674,
- -730, 2282, 495, 1849, 753, 4313, 2052, 11060, 2638, -4153, 12967, 4232, 1600, 8305, 6247, 4101,
- 1078, -516, -6160, -2738, -3949, 549, 2665, 313, -11805, 5780, 13753, 4964, -3343, -3825, 7392, 657,
- -3356, -672, 2091, 1930, -1942, -6931, -7983, -7306, 1452, 3417, 9758, 12537, 14305, 11570, 5653, 1593,
- 2820, 8229, 5573, 6212, 5169, 4568, 4877, 1219, -5520, -3569, -4997, 3799, -1152, -6233, 13054, 8210,
- -1905, -1112, -1728, 19102, 8663, -331, 3226, 1066, -1807, 8189, 5678, 1987, 4661, 3278, 7947, 11458,
- -4574, -517, -5124, 4711, -740, 416, 4847, 4427, 11056, 3251, -1915, -3528, -2529, -2213, 1857, 1203,
- 316, 3731, 4619, -1294, -3138, -336, 8691, 7311, 3124, 9892, 5880, 614, 1873, 1916, 3856, 3588,
- 1323, 8284, 7332, 4197, 626, 4877, 9117, 4163, 1998, 4387, 5489, 4184, 2124, -5170, -10914, 3921,
- -1504, 12727, 938, 3478, 1876, -1017, 389, 3233, 8278, 8027, 8392, 12663, 13264, 9858, 5767, 4287,
- -4008, 49, -1854, -5454, -9369, 5309, -1597, 6002, 6031, -2543, -4793, -2340, -2559, 229, -983, -2068,
- -3514, 815, -7510, -3824, -931, -1573, -1337, -1189, -2019, 245, 4084, 4416, 6165, 7239, 3899, 2461,
- -4781, -2173, 17577, 2751, -894, 2264, 1789, -623, 992, -322, -3113, -1854, -1553, 2213, 731, 850,
- 2054, 3456, 3747, 3842, 980, -940, -5065, -5905, 423, -2009, 74, 3933, 13511, 12742, 8908, 5783,
- 894, 6872, -2742, 7127, 5497, -660, -2361, -3114, -5552, -884, -1825, -8536, 4278, 4047, 3263, 2117,
- 46, 3829, 3392, 7000, 5004, 11640, 7090, 2661, 2072, 3834, 6408, 9453, 4328, -5807, -11811, -6081,
- 1119, 3292, 8329, 5549, -1361, -4414, -15806, 7144, 6824, -4515, -1143, 4774, 1451, 5261, 4830, 5562,
- -1393, 5662, 4446, 1807, 8826, 6248, 6415, 4547, -1665, 1181, 6405, 5864, 8293, 10387, 7545, 4688,
- 1312, 7883, 6317, -3965, -8535, -2725, 1117, -5447, -7012, 3655, 3196, 4576, 6822, -341, -646, 6098,
- -6332, -4527, -5839, 4942, 2805, 6652, 925, -1187, 3859, 4466, 5194, 4814, 7489, 8532, 2922, 2874,
- -1137, 1068, 2253, 3741, -2505, 9887, 10247, 3472, 9158, 1176, -2976, 1937, -2064, 7351, 6057, 2696,
- 532, 4702, 4601, 502, -1350, -5364, 9112, 2103, -4340, 18, -1329, -2532, 2939, 15707, 4071, -2154,
- -628, 13794, -2239, -2982, -3391, -2332, -1483, 5699, 7418, 5487, 5469, 3426, 2471, 2248, -610, -2978,
- 4520, 7035, 8360, 8190, 4367, 11231, 9045, 6518, 5468, 6414, -626, -2179, -2327, -6601, -11740, -18010,
- 872, 6597, 9823, 6115, 5121, 3028, -3065, 9266, 9664, 2144, 2461, -758, -3373, -348, -421, -2786,
- -2998, -2310, 5826, 14327, 10399, 10344, 5906, 4646, 4013, 7488, 6656, 3601, 212, 2499, 812, -4251,
- -3455, -259, -2801, -3743, -3930, 4402, 11531, 8368, 3812, 2663, -1885, -3062, -3413, -12432, -6348, -1832,
- -2574, 1227, -6578, -7396, -131, 1139, 3464, 2303, 6848, 4302, 422, 1994, 4840, 6023, 4369, 1222,
- -5186, -3043, -5221, 9413, 9009, 6329, 6302, 7712, 4428, -1745, -1711, 1216, 1855, 1215, 1003, 58,
- 3844, 4380, -2452, 17587, 5229, 106, 3809, 5238, 2909, -6280, 6367, 4649, 3777, 2815, 4377, 9833,
- -3469, 6722, -2982, 1867, 2944, 3428, -115, -6063, 4740, 2369, 3681, 2580, 319, 76, 4169, 1079,
- 5357, 7937, 8749, 6732, 3237, 475, 10599, 7708, 2300, 9384, 6872, 6516, 11437, 2109, -2788, -10922,
- -2925, 1420, 3109, 500, 6953, 1289, -522, 1064, 2885, 6445, 3595, 2000, 2669, 2797, 2174, 873,
- 1980, 6159, 1331, 1321, -1922, 6722, 11666, 3321, -1515, 1233, -1664, 9262, 9668, 2502, 13862, 9666,
- 3582, 10575, 2715, -603, 596, -1567, 4182, 49, 2208, 1795, 10525, 9472, -2866, -8439, 7591, 11197,
- -2356, 153, -10244, -4768, -2178, -2408, 1367, 708, 4615, 9681, 13007, 14875, 15382, 12708, 8355, 5074,
- -358, 1803, 1987, 7888, 9168, 16089, 2288, -2716, -1669, 1078, 1165, 5324, 4412, -4354, 298, 6519,
- 4826, 9355, 6507, 12087, 4177, -6, 2865, -2898, -5149, 6100, -1829, 80, 12459, 4967, 591, 7846,
- -3452, 13887, -142, 4052, 5842, 3702, 4535, 2718, 4976, 3690, 1377, -72, -1938, -836, 961, -1944,
- 4315, 5391, 6496, 1795, -2279, 20485, 16142, 9768, 8889, 6390, 1789, 3149, 4186, 487, -922, -2249,
- -1225, 14246, 10277, 980, 2427, 180, 5713, 4730, -901, 590, 3351, 1871, 4389, 4760, 8650, 3433,
- 1760, 3580, 5798, 6813, 4246, 17695, 7227, 4364, 2222, 13912, 11731, 10965, 14919, 7273, -6023, 6474,
-};
-
-/*----------------------------------------------------------------------------------*
- * LSF quantization - Scaling factors
- *----------------------------------------------------------------------------------*/
-
-/* Stable ISP vector in Q15 */
-const Word16 stable_ISP_fx[16] = { 32139, 30274, 27247, 23170, 18206, 12540, 6393, 0, -6390, -12537, -18203, -23170, -27243, -30271, -32139, 1475 };
-/* Stable LSP vector in Q15 */
-/* This LSP corresponds to GEWB_Ave_fx Q15*/
-const Word16 stable_LSP_fx[16] = { 32437, 31676, 29486, 25681, 21564, 16413, 10838, 5385, -735, -6405, -11986, -17040, -22052, -26346, -29678, -31784 };
-
-/* stable ISF vector */
-const Word16 stable_ISF_fx[M] =/*15Q16*/
-{ 1023, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13311, 14335, 15361, 3978 };
-
-/*----------------------------------------------------------------------------------*
- * LSF quantization - Mean LSF vectors
- *----------------------------------------------------------------------------------*/
-/* These are not used anywhere */
-/* Length 16 vector in Scale = 2.56f */
-const Word16 means_wb_cleanspeech_lsf16k0[16] = { 727, 1426, 2582, 3554, 4548, 5481, 6397, 7293, 8170, 9010, 9972, 11003, 12072, 13034, 14097, 14956 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 means_swb_cleanspeech_lsf25k6[16] = { 786, 1840, 2892, 3833, 4778, 5658, 6641, 7662, 8692, 9630, 10603, 11534, 12489, 13387, 14349, 15217 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 means_swb_cleanspeech_lsf32k0[16] = { 757, 1855, 2862, 3798, 4705, 5661, 6742, 7692, 8658, 9577, 10513, 11401, 12358, 13269, 14275, 15149 };
-
-
-/* An 16-by-1 matrix */
-const Word16 SVWB2_Ave_fx[16] = { 998, 1488, 2682, 3823, 5084, 6305, 7485, 8686, 9861, 11004, 12339, 13664, 15088, 16330, 17663, 18754 }; // Q2.56
-/* An 16-by-1 matrix */
-const Word16 IANB_Ave_fx[16] =
-{
- 726, 1433, 2493, 3408, 4340, 5215, 6103, 6947, 7772, 8536, 9252, 10012, 10909, 12427, 13997, 15193
-}; // Q2.56
-/* An 16-by-1 matrix */
-const Word16 IAWB_Ave_fx[16] =
-{
- 577, 1350, 2526, 3535, 4539, 5504, 6497, 7460, 8445, 9396, 10371, 11319, 12307, 13268, 14249, 15207
-}; // Q2.56
-/* An 16-by-1 matrix */
-const Word16 IAWB2_Ave_fx[16] =
-{
- 731, 1777, 3194, 4386, 5629, 6806, 8012, 9164, 10329, 11469, 12731, 14037, 15326, 16538, 17801, 18927
-}; // Q2.56
-/* Length 16 vector in Scale = 2.56f */
-const Word16 UVNB_Ave_fx[16] = { 1018, 1764, 2856, 3751, 4611, 5410, 6233, 6961, 7685, 8304, 8859, 9325, 9977, 11741, 13699, 15074 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 UVWB_Ave_fx[16] = { 898, 1900, 3172, 4190, 5181, 6161, 7134, 8066, 8995, 9888, 10784, 11636, 12527, 13396, 14301, 15183 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 SVNB_Ave_fx[16] = { 890, 1268, 1930, 2902, 3938, 4823, 5832, 6644, 7487, 8202, 8906, 9545, 10788, 12565, 13959, 15183 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 SVWB_Ave_fx[16] = { 832, 1248, 1949, 3083, 4131, 5117, 6179, 7067, 8008, 8922, 9875, 10741, 11785, 12860, 13968, 15048 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 GEWB_Ave_fx[16] = { 742, 1350, 2354, 3495, 4446, 5456, 6434, 7331, 8309, 9218, 10145, 11044, 12042, 13063, 14101, 15103 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 GEWB2_Ave_fx[16] = { 909, 1783, 3227, 4443, 5685, 6851, 7996, 9116, 10213, 11263, 12465, 13754, 15090, 16293, 17621, 18695 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 GENB_Ave_fx[16] = { 836, 1344, 2257, 3263, 4173, 5031, 5950, 6707, 7514, 8234, 8881, 9439, 10393, 12226, 13855, 15135 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 TRNB_Ave_fx[16] = { 919, 1335, 2106, 3142, 4092, 4938, 5905, 6670, 7490, 8199, 8868, 9444, 10544, 12383, 13900, 15156 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 TRWB_Ave_fx[16] = { 834, 1326, 2151, 3341, 4305, 5299, 6318, 7198, 8167, 9071, 10001, 10867, 11871, 12912, 13986, 15046 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 TRWB2_Ave_fx[16] = { 945, 1546, 2866, 4150, 5342, 6568, 7660, 8809, 9894, 10934, 12170, 13577, 14981, 16280, 17614, 18778 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 AUNB_Ave_fx[16] = { 887, 1443, 2356, 3194, 4105, 4949, 5841, 6635, 7437, 8181, 8867, 9478, 10385, 12182, 13858, 15131 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 AUWB_Ave_fx[16] = { 810, 1468, 2476, 3417, 4396, 5342, 6311, 7215, 8171, 9078, 10030, 10969, 12014, 13075, 14146, 15133 };
-/* Length 16 vector in Scale = 2.56f */
-const Word16 AUWB2_Ave_fx[16] = { 933, 1745, 3040, 4157, 5379, 6490, 7646, 8725, 9852, 10930, 12214, 13647, 15062, 16297, 17636, 18768 };
-
-
-
-
-
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor0_fx[16] = { 27361, 27361, 27361, 27197, 27197, 27197, 26378, 26460, 26214, 25985, 26460, 26460, 25985, 25723, 25723, 24740 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor1_fx[16] = { 27034, 27034, 27034, 26640, 26313, 26640, 26640, 26132, 26214, 26214, 26460, 26870, 26870, 26706, 27034, 26640 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor2_fx[16] = { 24248, 23593, 24510, 24248, 24510, 24019, 24019, 23757, 23757, 24019, 24248, 24248, 23593, 23101, 23593, 23101 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor3_fx[16] = { 24248, 24248, 24740, 24248, 24510, 23757, 23429, 23101, 22610, 23101, 23593, 24740, 25002, 24740, 25002, 24838 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor4_fx[16] = { 19005, 18350, 19268, 19005, 19268, 18776, 18776, 18514, 18514, 18776, 19005, 19005, 18350, 17859, 17695, 17203 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor5_fx[16] = { 23839, 23593, 23593, 23839, 23839, 23593, 23593, 23593, 23839, 24084, 24347, 24576, 24576, 23364, 23364, 23364 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor6_fx[16] = { 24084, 23839, 24084, 23593, 23593, 22938, 22381, 21791, 21135, 21955, 22381, 24347, 24576, 23593, 24576, 24347 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor7_fx[16] = { 24347, 24084, 24347, 24347, 24347, 24084, 24347, 24576, 24576, 24740, 25068, 24347, 24084, 23839, 23364, 24740 };
-/* Length 16 vector in Q = 15 */
-const Word16 Predictor8_fx[16] = { 24740, 24740, 24740, 24576, 24576, 24576, 24084, 23839, 23593, 23364, 23839, 23839, 23364, 23101, 23101, 22118 };
-
-/* An 16-by-16 matrix */
-const Word16 CNG_SN1_fx[256] =
-{//Qlog2(2.56)
- 600, 1640, 3039, 4257, 5512, 6740, 7989, 9169, 10393, 11612, 12880, 14100, 15378, 16554, 17816, 18918,
- 1188, 2487, 3746, 4903, 6103, 7261, 8437, 9587, 10776, 11954, 13172, 14355, 15564, 16712, 17913, 19012,
- 346, 799, 2259, 3555, 4876, 6175, 7516, 8803, 10073, 11323, 12631, 13938, 15282, 16553, 17817, 19039,
- 439, 1616, 3446, 4743, 6073, 7288, 8553, 9726, 10947, 12106, 13312, 14474, 15650, 16773, 17894, 18977,
- 921, 1800, 2976, 4007, 5105, 6137, 7178, 8150, 9057, 9914, 11009, 12545, 13671, 15502, 17428, 18927,
- 896, 1899, 3035, 4128, 5301, 6429, 7604, 8719, 9886, 11059, 12417, 13621, 14962, 16135, 17475, 18460,
- 722, 1507, 2537, 3437, 4328, 5190, 6018, 6841, 7587, 8343, 8925, 9511, 9919, 11075, 13613, 15021,
- 315, 612, 1671, 2910, 3990, 5083, 6120, 7170, 8188, 9173, 10148, 11186, 12250, 13262, 14290, 15284,
- 885, 1928, 3010, 3973, 4952, 5900, 6848, 7769, 8701, 9609, 10581, 11540, 12508, 13450, 14412, 15349,
- 338, 1020, 2657, 3736, 4839, 5791, 6806, 7760, 8738, 9659, 10627, 11567, 12534, 13468, 14416, 15334,
- 1126, 1964, 2999, 3855, 4764, 5608, 6482, 7286, 8109, 8827, 9570, 10649, 11999, 13125, 14223, 15252,
- 385, 815, 2000, 2939, 3906, 4879, 5793, 6734, 7661, 8526, 9309, 10146, 11597, 12955, 14106, 15241,
- 633, 1445, 2400, 3293, 4235, 5171, 6143, 7084, 8057, 8980, 9924, 10924, 11987, 12998, 14016, 15058,
- 584, 1248, 2250, 3131, 4050, 4920, 5811, 6652, 7471, 8244, 8913, 9480, 10188, 12225, 13871, 15123,
- 1157, 1820, 2745, 3505, 4354, 5097, 5932, 6648, 7408, 8034, 8635, 9083, 9977, 12228, 13819, 15108,
- 572, 1401, 2514, 3501, 4503, 5465, 6469, 7435, 8416, 9328, 10306, 11309, 12328, 13303, 14306, 15261,
-};
-
-const Word16 SVWB2_SN1_fx[256] = {//Qlog2(2.56)
- -257, -385, -673, 926, 1408, 874, 735, 512, 624, 587, 493, 688, 845, 521, 428, 95,
- -32, -90, 1046, 666, 329, -59, -324, -282, -712, -783, -229, 28, -354, -434, -497, -351,
- 182, 111, 512, 746, 365, 91, -214, -477, -401, -496, -931, -1180, -1422, -1085, -456, -9,
- -286, -387, -325, 317, 172, 274, 238, 550, 555, 574, 618, 717, 751, 611, 441, 233,
- 96, 178, 203, -112, -464, -591, -212, 124, 32, 192, 244, 94, -41, -293, -507, -649,
- -94, -164, 1011, 926, 688, 461, 593, 587, 398, 400, 351, 486, 482, 424, 294, 219,
- -260, -356, -458, -252, -162, -350, -394, -255, 30, 173, 90, 64, 93, 157, 66, 2,
- 43, 100, -48, -596, -852, -787, -569, -536, -780, -607, -169, -125, -75, 96, 98, 154,
- 240, 203, 404, 79, -202, -555, -718, -1023, -1158, -1390, -1537, -774, -478, -173, -63, 272,
- -164, -291, -405, 1049, 779, 349, 224, 12, 265, 37, -182, -446, -396, -81, -16, -146,
- 75, 45, -248, -832, 729, 416, 499, 178, -115, 16, 79, 243, 265, 77, -69, -43,
- 639, 705, 482, -40, -529, -198, -109, -399, -242, -433, -713, -811, -934, -777, -332, 26,
- 110, 166, -54, -792, -974, 386, 190, 192, 67, -172, -141, -298, -539, -400, -139, 80,
- 147, 307, 168, 52, -285, -270, -212, -179, 138, 200, 194, 64, 476, 673, 636, 500,
- 5, 38, -176, 212, 752, 433, 322, 500, 560, 276, 107, -245, -358, -768, -817, -1065,
- -233, -294, -581, -1147, -869, 77, 144, 335, 269, 501, 638, 719, 614, 376, 219, 172
-};
-
-/* An 16-by-16 matrix */
-const Word16 SVWB2_SN2_fx[256] = {//Qlog2(2.56)
- -100, -130, -545, -834, 489, 501, 523, 297, 137, 198, 270, 172, 17, -50, -147, -63,
- 333, 351, 143, 142, 47, -137, -131, -323, -216, -32, 105, 264, 541, 425, 342, 153,
- -93, -168, 184, 605, 372, 237, 186, 175, 307, 321, 448, 205, -128, -481, -477, -512,
- -24, -30, 26, -47, -159, -88, -344, -130, -88, -280, -742, -901, -264, 176, 38, -26,
- 258, 250, 114, -75, -186, -326, -360, -237, 268, 532, 236, -341, -556, -334, -181, -30,
- 123, 241, 118, 205, 441, 172, 49, -158, -273, -214, -428, -729, -758, -532, -289, -112,
- -160, -224, -512, 393, 460, 216, 179, -94, -78, -320, -473, 13, 224, 196, 127, 37,
- -35, -65, 360, 164, -185, -563, -683, -357, -634, -61, 400, 133, -232, -264, -174, 32,
- -140, -196, -470, -355, -532, -323, -268, -76, 260, 258, 218, 161, 206, 266, 234, 168,
- 99, 109, -60, -368, -564, -49, 75, -60, -160, -654, -847, 162, 278, 76, -24, 42,
- 12, 88, 124, -54, -91, 197, 289, 211, 240, 184, 10, 16, 560, 677, 619, 350,
- -37, -91, 771, 654, 291, 165, 104, 43, -224, -365, -411, -78, -90, -20, 85, 168,
- 45, 1, 58, 80, 293, 411, 443, 655, 604, 642, 624, 529, 373, 227, 166, 128,
- -176, -124, -182, -131, -260, -127, 350, 460, 425, 260, -76, -400, -605, -506, -121, -49,
- -96, -92, -274, -176, -220, -323, -399, -505, -610, -530, 124, 268, 235, 272, 128, 160,
- -6, 80, 145, -198, -197, 38, -15, 100, 45, 58, 542, 524, 197, -128, -324, -448
-};
-
-/* SVWB2_AR1 * 2.56f */
-const Word16 SVWB2_AR1_fx[128] = {//Qlog2(2.56)
- -28, -38, -122, 74, 296, 148, 146, 120, 148, 36, -11, -163, -223, -299, -290, -320,
- -22, -30, -138, -319, -385, 159, 124, 51, 32, -44, -15, -78, -96, -53, 40, 64,
- -96, -144, -205, -96, 80, 96, 152, 246, 206, 193, 265, 333, 320, 232, 131, 32,
- 108, 106, 102, 37, -14, -17, -61, -144, -161, -160, -257, -404, -540, -316, -124, 18,
- 22, 12, 34, -14, -52, -106, -144, -266, -346, -472, -401, -30, -4, -43, -88, -10,
- -52, -117, -203, 415, 324, 171, 121, -31, 48, -31, -60, -65, 128, 193, 141, 67,
- -47, -86, 430, 334, 193, 136, 85, 82, 1, -34, 47, 84, 2, -30, -77, -45,
- -4, -14, -9, -38, -136, -242, -217, -54, -38, 179, 191, 61, 42, -3, 5, -37
-};
-
-/* SVWB2_AR2 * 2.56f */
-const Word16 SVWB2_AR2_fx[128] = {//Qlog2(2.56)
- 12, 16, -46, -156, -329, -293, 43, 141, 61, 15, -9, 29, -74, -41, -37, 16,
- -47, -81, -136, 82, -33, -111, -268, -293, 109, 136, 53, -58, -51, 62, 64, 14,
- -15, -19, -171, -347, 258, 161, 88, 13, -57, -26, -59, 24, 10, 14, -41, -8,
- 33, 38, 139, 157, 31, 65, -14, 52, 63, 30, -8, -1, -182, -341, -344, -258,
- 14, 16, 46, 6, -54, -64, -136, -132, -318, -303, 261, 146, -19, -57, -30, 30,
- -34, -34, 21, 93, 163, 201, 290, 257, 225, 296, 209, 197, 72, 26, 57, 1,
- 33, 66, 73, -8, -104, 44, 31, -13, 70, 72, -17, -48, 430, 373, 218, 92,
- 1, -2, 74, 172, 67, -3, -34, -25, -156, -219, -432, -288, -181, -35, 113, 112
-};
-
-/*----------------------------------------------------------------------------------*
- * LSF quantization - LSF mode/codebook selection tables
- *----------------------------------------------------------------------------------*/
-const Word16 CB_lsf[] =
-{
- -1, /* Mode 0 : INACTIVE NB, Safety net */
- -1, /* Mode 1 : UNVOICED NB, Safety net */
- 0, /* Mode 2 : VOICED NB, Safety net */
- 2, /* Mode 3 : GENERIC NB, Safety net */
- 2, /* Mode 4 : TRANSITION NB, Safety net */
- 4, /* Mode 5 : AUDIO NB, Safety net */
- -1, /* Mode 6 : INACTIVE WB, Safety net */
- -1, /* Mode 7 : UNVOICED WB, Safety net */
- 5, /* Mode 8 : VOICED WB, Safety net */
- 7, /* Mode 9 : GENERIC WB, Safety net */
- 7, /* Mode 10 : TRANSITION WB, Safety net */
- 9, /* Mode 11 : AUDIO WB, Safety net */
- -1, /* Mode 12 : INACTIVE WB16k, Safety net */
- -1, /* Mode 13 : UNVOICED WB16k, Safety net */
- 14, /* Mode 14 : VOICED WB16k, Safety net */
- -1, /* Mode 15 : GENERIC WB 16k, Safety net */
- 10, /* Mode 16 : TRANSITION WB16k, Safety net */
- -1, /* Mode 17 : AUDIO WB16k, Safety net */
- 13 /* Mode 18 : CNG, Safety net */
-}; // Q0
-
-const Word16 CB_p_lsf[] =
-{
- 0, /* Mode 0 : INACTIVE NB, Predictive */
- 1, /* Mode 1 : UNVOICED NB, Predictive */
- 4, /* Mode 2 : VOICED NB, Predictive */
- 4, /* Mode 3 : GENERIC NB, Predictive */
- -1, /* Mode 4 : TRANSITION NB, Predictive */
- -1, /* Mode 5 : AUDIO NB, Predictive */
- 0, /* Mode 6 : INACTIVE WB, Predictive */
- 1, /* Mode 7 : UNVOICED WB, Predictive */
- 6, /* Mode 8 : VOICED WB, Predictive */
- 6, /* Mode 9 : GENERIC WB, Predictive */
- -1, /* Mode 10 : TRANSITION WB, Predictive */
- -1, /* Mode 11 : AUDIO WB, Predictive */
- 0, /* Mode 12 : INACTIVE WB16k, Predictive */
- -1, /* Mode 13 : UNVOICED WB16k, Predictive */
- 11, /* Mode 14 : VOICED WB16k, Predictive */
- 8, /* Mode 15 : GENERIC WB16k, Predictive */
- -1, /* Mode 16 : TRANSITION WB16k, Predictive */
- 10, /* Mode 17 : AUDIO WB16k, Predictive */
- 9, /* Mode 18 : GENERIC WB, MA Predictive */
-}; // Q0
-
-
-const Word16 *const ModeMeans_fx[] = { IANB_Ave_fx, UVNB_Ave_fx, SVNB_Ave_fx, GENB_Ave_fx, TRNB_Ave_fx, AUNB_Ave_fx, IAWB_Ave_fx, UVWB_Ave_fx,
- SVWB_Ave_fx, GEWB_Ave_fx, TRWB_Ave_fx, AUWB_Ave_fx, IAWB2_Ave_fx, NULL, SVWB2_Ave_fx, GEWB2_Ave_fx, TRWB2_Ave_fx, AUWB2_Ave_fx
-}; //Qlog2(2.56)
-const Word16 * const Predictors_fx[] = { Predictor6_fx, NULL, Predictor1_fx, Predictor3_fx, NULL, Predictor6_fx,Predictor5_fx, NULL, Predictor0_fx,
- Predictor2_fx, NULL, Predictor5_fx, Predictor7_fx, NULL, Predictor8_fx, Predictor4_fx, NULL, Predictor7_fx
-}; // Q15
-
-const Word16 CBsizes[] =
-{
- 1,2,4,8,16,32,64
-}; // Q0
-
-
-const Word16 CBbits[] =
-{
- -1, /* Mode 0 : INACTIVE NB, Safety net */
- -1, /* Mode 1 : UNVOICED NB, Safety net */
- 4, /* Mode 2 : VOICED NB, Safety net */
- 5, /* Mode 3 : GENERIC NB, Safety net */
- 5, /* Mode 4 : TRANSITION NB, Safety net */
- 4, /* Mode 5 : AUDIO NB, Safety net */
- -1, /* Mode 6 : INACTIVE WB, Safety net */
- -1, /* Mode 7 : UNVOICED WB, Safety net */
- 4, /* Mode 8 : VOICED WB, Safety net */
- 5, /* Mode 9 : GENERIC WB, Safety net */
- 5, /* Mode 10 : TRANSITION WB, Safety net */
- 4, /* Mode 11 : AUDIO WB, Safety net */
- -1, /* Mode 12 : INACTIVE WB16k, Safety net */
- -1, /* Mode 13 : UNVOICED WB16k, Safety net */
- 4, /* Mode 14 : VOICED WB16k, Safety net */
- -1, /* Mode 15 : GENERIC WB16k, Safety net */
- 4, /* Mode 16 : TRANSITION WB16k, Safety net */
- -1, /* Mode 17 : AUDIO WB16k, Safety net */
- 4, /* Mode 18: CNG, Safety net */
-}; // Q0
-
-
-const Word16 CBbits_p[] =
-{
- 5, /* Mode 0 : INACTIVE NB, Predictive */
- 4, /* Mode 1 : UNVOICED NB, Predictive */
- 3, /* Mode 2 : VOICED NB, Predictive */
- 3, /* Mode 3 : GENERIC NB, Predictive */
- -1, /* Mode 4 : TRANSITION NB, Predictive */
- 0, /* Mode 5 : AUDIO NB, Predictive */
- 5, /* Mode 6 : INACTIVE WB, Predictive */
- 4, /* Mode 7 : UNVOICED WB, Predictive */
- 3, /* Mode 8 : VOICED WB, Predictive */
- 3, /* Mode 9 : GENERIC WB, Predictive */
- -1, /* Mode 10 : TRANSITION WB, Predictive */
- 0, /* Mode 11 : AUDIO WB, Predictive */
- 5, /* Mode 12 : INACTIVE WB16k, Predictive */
- -1, /* Mode 13 : UNVOICED WB16k, Predictive */
- 3, /* Mode 14 : VOICED WB16k, Predictive */
- 5, /* Mode 15 : GENERIC WB16k, Predictive */
- -1, /* Mode 16 : TRANSITION WB16k, Predictive */
- 5, /* Mode 17 : AUDIO WB16k, Predictive */
- 5, /* Mode 9 : GENERIC WB, Predictive */
-}; // Q0
-
-
-
-const Word16 BitsVQ[]=
-{
- -1, /* Mode 0 : INACTIVE NB, Safety net */
- -1, /* Mode 1 : UNVOICED NB, Safety net */
- 8, /* Mode 2 : VOICED NB, Safety net */
- 9, /* Mode 3 : GENERIC NB, Safety net */
- 9, /* Mode 4 : TRANSITION NB, Safety net */
- 4, /* Mode 5 : AUDIO NB, Safety net */
- -1, /* Mode 6 : INACTIVE WB, Safety net */
- -1, /* Mode 7 : UNVOICED WB, Safety net */
- 8, /* Mode 8 : VOICED WB, Safety net */
- 9, /* Mode 9 : GENERIC WB, Safety net */
- 9, /* Mode 10 : TRANSITION WB, Safety net */
- 4, /* Mode 11 : AUDIO WB, Safety net */
- -1, /* Mode 12 : INACTIVE WB16k, Safety net */
- -1, /* Mode 13 : UNVOICED WB16k, Safety net */
- 8, /* Mode 14 : VOICED WB16k, Safety net */
- -1, /* Mode 15 : GENERIC WB16k, Safety net */
- 8, /* Mode 16 : TRANSITION WB16k, Safety net */
- -1, /* Mode 17 : AUDIO WB16k, Safety net */
- 4, /* Mode 18: CNG, Safety net */
-}; // Q0
-
-
-const Word16 BitsVQ_p[]=
-{
- 5, /* Mode 0 : INACTIVE NB, Predictive */
- 8, /* Mode 1 : UNVOICED NB, Predictive */
- 6, /* Mode 2 : VOICED NB, Predictive */
- 6, /* Mode 3 : GENERIC NB, Predictive */
- -1, /* Mode 4 : TRANSITION NB, Predictive */
- 0, /* Mode 5 : AUDIO NB, Predictive */
- 5, /* Mode 6 : INACTIVE WB, Predictive */
- 12, /* Mode 7 : UNVOICED WB, Predictive */
- 6, /* Mode 8 : VOICED WB, Predictive */
- 6, /* Mode 9 : GENERIC WB, Predictive */
- -1, /* Mode 10 : TRANSITION WB, Predictive */
- 0, /* Mode 11 : AUDIO WB, Predictive */
- 5, /* Mode 12 : INACTIVE WB16k, Predictive */
- -1, /* Mode 13 : UNVOICED WB16k, Predictive */
- 6, /* Mode 14 : VOICED WB16k, Predictive */
- 5, /* Mode 15 : GENERIC WB16k, Predictive */
- -1, /* Mode 16 : TRANSITION WB16k, Predictive */
- 5, /* Mode 17 : AUDIO WB16k, Predictive */
- 5, /* Mode 18 : GENERIC WB, MA Predictive */
-}; // Q0
-
-
-const Word16 predmode_tab_float[][6] =
-{
- {1,1,2,2,0,2},
- {1,1,2,2,0,2},
- {1,-1,2,1,0,1},
- {1,1,2,1,0,1} /* should check how is the cb for audio mode at 13.2*/
-};
-
-const Word16 predmode_tab[][6] =
-{
- {1,1,2,2,0,2},
- {1,1,2,2,0,2},
- {1,-1,2,1,0,1},
- {1,1,2,1,0,2} /* should check how is the cb for audio mode at 13.2*/
-}; // Q0
-
-
-const Word16 SVNB_SN1_fx[256] =
-{//Qlog2(2.56)
- 135, 109, 135, -153, -549, 214, 416, 195, 291, 247, 100, -127, -579, -160, -66, -32,
- -107, -150, -274, -149, 642, 594, 338, 183, 81, -31, -14, -150, -387, -40, -44, -18,
- 73, 42, 171, 339, 213, 42, -137, -277, -379, -441, -440, -478, 270, 126, -4, 6,
- -307, -479, -636, -596, -100, 83, 167, 200, 260, 376, 523, 1051, 1142, 490, 249, 108,
- -148, -215, -324, -570, -917, -685, -208, 127, 285, 353, 441, 940, 1100, 458, 229, 100,
- 427, 432, 548, 426, 133, 13, -9, -141, -108, -144, -195, -419, -733, -144, -109, -45,
- -115, -220, -194, 661, 896, 688, 489, 351, 211, 258, 147, 30, -746, -784, -156, -95,
- 16, -48, -88, -430, -798, 36, 204, 68, 174, 162, 20, 61, 627, 266, 102, 48,
- -252, -370, -630, -614, 680, 1024, 869, 598, 419, 259, 193, 27, 90, 156, 53, 27,
- -48, 33, 26, -227, -556, -766, -391, 231, 413, 282, 226, 89, 194, 187, 44, 30,
- -204, -291, -345, -131, 125, 72, 16, -29, -106, -49, -27, 183, 714, 277, 114, 49,
- -11, 205, 285, 69, -58, -207, -301, -160, -30, -2, 12, -99, -580, -178, -80, -41,
- 120, 189, 281, 427, 234, 138, 124, 126, 50, 205, 121, 76, -797, -1204, -235, -133,
- 63, -18, 146, 666, 480, 236, 134, -39, -97, -130, -175, -378, -746, -159, -106, -46,
- 386, 399, 415, 157, -175, -282, -315, -318, -222, -225, -267, -342, 317, 152, 15, 14,
- 39, 56, 71, -95, -387, -509, -595, -466, -395, -186, -24, 421, 814, 292, 127, 52
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 SVNB_SN2_fx[256] =
-{//Qlog2(2.56)
- -16, 111, 111, -89, -115, -404, -514, 162, 277, 41, -94, -89, 15, 31, 2, 2,
- -82, -99, -25, -287, -464, 204, 18, -123, -38, 56, 109, 198, 160, 96, 41, 19,
- -95, -62, -242, -415, 318, 118, -121, 44, 74, 40, 85, 114, 52, 36, 21, 8,
- 29, 40, 43, 23, -202, -149, 288, 149, -20, -109, -186, -275, -127, 18, -25, -6,
- 20, 36, -97, -228, 565, 508, 134, 42, -70, -237, -258, -259, -123, -9, -29, -10,
- -72, -169, 492, 463, 193, 204, -13, -75, -82, -125, -181, -230, -181, -10, -40, -12,
- -108, -221, -229, 648, 575, 288, 146, 1, -14, -4, -51, -120, -81, -14, -17, -5,
- -199, -264, -309, 209, 8, -128, 24, -47, 87, 257, 240, 185, 93, 70, 34, 16,
- 25, 82, -60, -155, -407, -615, 29, 100, -113, 32, 207, 258, 203, 111, 49, 21,
- 37, 127, 95, 4, 112, -45, -217, -158, -277, -407, -304, -152, 72, 52, -6, 0,
- -30, -81, -116, -416, -219, 677, 538, 328, 213, 60, -60, -109, -78, 0, -5, 0,
- 9, -15, 26, 75, -175, -336, -673, -586, 238, 310, 198, 189, 212, 126, 48, 24,
- -18, -4, -80, 102, 130, -116, -268, -471, -567, -104, 205, 221, 143, 81, 29, 12,
- 4, 39, 65, 115, 88, 189, 136, 124, 49, 106, 37, 89, -375, -626, -114, -73,
- 540, 525, 472, 221, 118, -31, 15, 7, -71, -139, -108, -93, -13, -4, -13, -8,
- -44, -44, -143, -272, -525, -365, 479, 502, 312, 225, 161, 72, 28, 42, 26, 12
-};
-
-const Word16 GETRNB_SN1_fx[512] =
-{//Qlog2(2.56)
- -119, -271, -427, 447, 321, 58, 37, -105, -65, 99, 106, 21, -277, 53, 9, -6,
- -93, -241, -433, -826, -1028, 17, 180, 138, 320, 234, 152, 235, 973, 594, 199, 96,
- -300, -474, -553, -497, -374, -231, -224, -170, -145, 51, 154, 714, 1338, 690, 271, 118,
- -115, -228, -248, 9, -27, -196, -240, -269, -293, -310, -276, -254, 769, 481, 117, 59,
- 172, 58, 469, 585, 512, 336, 145, -52, -167, -344, -379, -487, 285, 377, 27, 27,
- 81, 34, 574, 859, 818, 702, 521, 344, 177, 23, -116, -274, -611, -78, -61, -35,
- 76, 19, -104, -388, -687, 54, 279, 144, 237, 223, 110, 9, -335, 4, 3, -10,
- 115, 380, 486, 446, 389, 316, 239, 249, 197, 207, 162, 141, -435, -1516, -409, -136,
- -146, -348, -425, 645, 998, 790, 609, 468, 282, 287, 153, 87, -461, -592, -88, -64,
- -249, -471, -835, -642, 589, 960, 887, 637, 442, 286, 242, 132, 142, 299, 99, 44,
- 128, 37, -120, -314, -571, -730, -868, -558, -259, -109, 8, 413, 1145, 593, 210, 92,
- 151, 331, 267, 130, -24, -89, -133, -43, -75, 57, 19, 94, -469, -796, -124, -90,
- -339, -468, -292, -34, 76, 179, 231, 269, 259, 281, 275, 204, -93, 157, 53, 16,
- 33, 176, 25, -201, -311, -497, -509, -242, -47, 6, 86, 48, -165, 176, 24, 8,
- 27, 223, 461, 500, 479, 475, 489, 560, 635, 741, 924, 1347, 1546, 806, 277, 54,
- 510, 464, 402, 114, -80, -285, -290, -321, -283, -368, -325, -424, 388, 402, 52, 38,
- 521, 614, 732, 549, 428, 278, 180, 81, 14, -110, -204, -355, -649, -32, -56, -36,
- 72, 26, 262, 263, 159, 113, 60, -10, -73, -121, -201, -329, -768, -61, -60, -39,
- 85, 57, 116, -40, -78, -159, -154, -247, -220, -366, -331, -532, -35, 344, 0, 25,
- 527, 919, 1339, 1225, 1190, 1023, 774, 577, 393, 160, -4, -184, -281, 29, -21, -12,
- -230, -283, -338, -379, -313, -293, -163, -122, 15, 97, 243, 168, 361, 449, 102, 61,
- 378, 369, 369, 136, 42, -72, -73, -154, -155, -260, -270, -444, -562, 173, -36, -9,
- 168, 108, -36, -347, -559, -436, -254, -263, -236, -227, -247, -238, 796, 488, 123, 62,
- -151, -118, 163, 452, 430, 484, 456, 418, 377, 363, 256, 183, -403, -1429, -382, -126,
- -204, -366, -652, -512, 428, 353, 182, 88, -10, -94, -54, -11, 801, 527, 151, 76,
- 60, 79, -169, -465, -789, -844, -55, 181, 209, 172, 210, 107, 260, 399, 91, 52,
- -69, -205, -377, -164, 647, 584, 302, 151, 32, -135, -136, -223, -269, 170, 4, 5,
- 38, 418, 885, 979, 990, 1027, 870, 804, 669, 537, 360, 241, -336, -1281, -338, -111,
- -420, -700, -912, -622, -337, -51, 67, 173, 326, 554, 766, 1395, 1656, 894, 390, 178,
- -141, -252, -507, -822, -1084, -845, -280, 20, 149, 242, 393, 951, 1428, 740, 303, 135,
- -120, -37, 31, 105, 72, 99, 53, 117, 59, 171, 120, 177, -414, -993, -160, -98,
- -382, -612, -631, -167, 4, 104, 130, 141, 242, 325, 348, 430, 1048, 651, 222, 109
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 GETRNB_SN2_fx[256] =
-{//Qlog2(2.56)
- -27, 71, 45, -4, 28, 69, 25, 94, 45, 90, 45, 87, -177, -567, -116, -59,
- -208, -147, 531, 399, 199, 113, -21, -28, -34, -38, -48, -46, -47, 18, -1, -1,
- 69, -20, -115, -355, -380, 388, 379, 193, 134, 37, -42, -60, -35, 29, 6, 5,
- 107, 89, -98, -189, 379, 289, 68, 22, -71, -179, -187, -192, -137, 4, -17, -7,
- -44, -81, -371, -448, 226, 75, -52, 43, 40, 36, 79, 120, 130, 76, 36, 15,
- 131, 115, 192, 177, 25, -7, -23, -95, -132, -184, -206, -245, -200, -12, -29, -11,
- 45, -25, -249, 50, -189, -358, 253, 145, -39, 27, 34, -20, -52, 13, 1, 2,
- -254, -155, 23, -89, -30, 23, -23, -21, -45, -86, -92, -109, -48, 52, 3, 3,
- -248, -233, 139, 213, 232, 361, 349, 401, 373, 301, 230, 207, 204, 101, 32, 14,
- 491, 546, 409, 147, 34, -18, 52, 59, 48, 27, 14, 7, -1, -37, -16, -9,
- 36, 41, 0, -21, -29, -64, -207, -346, -516, -355, -64, 73, 156, 94, 30, 11,
- -28, -173, -278, 506, 427, 164, 111, 21, -33, -61, -78, -90, -32, 39, 4, 4,
- -44, -60, -215, -373, -485, -270, 12, 151, 271, 265, 215, 178, 153, 71, 32, 17,
- 110, 155, -29, -259, -218, -183, -175, -132, -85, -98, -87, -93, -77, 0, -9, -4,
- -116, -14, 235, 1, -238, -398, -419, -55, 109, 77, 62, 74, 73, 47, 16, 8,
- -20, -108, -219, 246, 20, -184, -328, -449, -67, 142, 125, 110, 91, 74, 28, 13
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 AUNB_SN1_fx[256] =
-{//Qlog2(2.56)
- -180, -79, -51, 39, 66, 99, 48, 108, 56, 127, 34, 46, -470, -845, -141, -90,
- -212, 82, 284, 422, 416, 416, 313, 289, 233, 210, 108, 55, -439, -1323, -336, -123,
- -9, 405, 532, 659, 710, 798, 844, 971, 1072, 1181, 1464, 1913, 2028, 1232, 549, 265,
- 75, 49, 330, 493, 448, 329, 204, 67, -18, -134, -235, -400, -605, -30, -67, -36,
- -9, -7, -95, -222, -322, -421, -321, -233, -110, -86, 67, -19, 3, 345, 41, 30,
- 153, 34, -172, -386, -500, -548, -503, -420, -317, -207, -114, 183, 1096, 661, 198, 94,
- 616, 501, 471, 220, 157, 55, 4, -161, -178, -314, -267, -389, 216, 429, 46, 38,
- -559, -854, -789, -369, -153, 64, 146, 296, 388, 520, 574, 958, 1481, 898, 340, 164,
- 131, 137, 116, 57, 64, -21, -38, -112, -123, -199, -214, -379, -641, 83, -53, -21,
- -101, -324, -648, -801, -835, -737, -501, -296, -86, 144, 400, 1025, 1501, 861, 322, 151,
- -231, -397, -512, -506, -308, -200, -127, -91, -18, 17, 94, 114, 798, 625, 161, 88,
- -518, -617, -201, 103, 258, 279, 273, 267, 281, 251, 214, 114, 58, 270, 70, 31,
- 17, -86, -78, -82, -22, -73, -171, -299, -334, -431, -422, -526, 517, 511, 71, 53,
- 276, 182, -40, -336, -461, -93, 342, 267, 166, 18, -43, -196, -146, 236, 18, 14,
- 227, 338, 224, 188, 107, 80, 57, 92, 34, 80, -5, -4, -515, -927, -174, -100,
- 731, 744, 797, 675, 590, 438, 328, 215, 144, 24, -96, -239, -486, -175, -65, -41
-};
-
-const Word16 SVWB_SN1_fx[256] =
-{//Qlog2(2.56)
- -71, -61, -170, -563, -962, -845, 186, 421, 282, 344, 260, 155, 186, 52, -18, -11,
- -107, -139, -289, -270, 788, 615, 249, 174, -1, -24, 159, 106, -46, -183, -187, -107,
- -144, -221, -215, 359, 192, -34, -186, -326, -256, -124, -49, 84, 214, 237, 186, 91,
- 218, 332, 335, 41, -191, -394, -614, -543, -415, -379, -285, -153, -86, -101, -69, -13,
- 587, 616, 732, 419, 270, 252, 102, 40, 53, -35, -57, -34, 19, -14, -15, -120,
- -76, -222, -127, 1216, 1188, 815, 532, 320, 311, 228, 34, -59, -96, -86, -44, -38,
- -176, -282, -507, -455, 1122, 1359, 965, 742, 610, 448, 474, 412, 185, 127, 127, -24,
- -156, -225, 16, 458, 423, 438, 393, 400, 525, 658, 682, 681, 612, 438, 267, 68,
- 89, 120, 172, 355, 195, -8, -22, -67, -110, -40, -93, -163, -382, -685, -926, -468,
- -227, -362, -452, -577, -213, -22, 56, 82, 132, 216, 348, 420, 358, 299, 257, 143,
- 38, -77, 117, 856, 486, 282, 16, -154, -130, -315, -618, -783, -892, -545, -88, 59,
- 218, 324, 232, -162, -583, -552, 126, 62, -40, -27, -227, -348, -334, -324, -238, -65,
- 82, 16, -20, -539, -787, 604, 340, 259, 260, -53, -251, -211, -12, 127, 171, 99,
- -24, 168, 202, -142, -223, -448, -282, 122, 148, 155, 363, 380, 347, 263, 124, -68,
- 165, 150, 226, 95, -172, -257, -413, -510, -533, -734, -1014, -1206, -834, -162, 6, 97,
- -78, -72, -81, -322, -605, -731, -740, -564, -356, -219, -151, 11, 200, 237, 212, 170
-};
-
-const Word16 SVWB_SN2_fx[256] =
-{//Qlog2(2.56)
- -126, -152, -342, -423, 311, 95, 3, 29, -93, 4, 227, 193, 142, 120, 93, 62,
- 190, 258, 382, 310, 166, -11, -77, -67, -217, -327, -330, -378, -461, -309, -142, -47,
- -16, -58, -77, -339, -534, 469, 399, 237, 290, 135, 34, 86, -14, -77, -30, 10,
- 13, -4, 644, 572, 412, 438, 272, 286, 234, 177, 118, 147, 131, 138, 127, 38,
- -73, -88, -112, 42, 36, 141, 424, 386, 504, 576, 523, 483, 431, 328, 233, 59,
- -120, -169, -270, -445, -593, -268, -133, -138, -11, 56, 133, 210, 166, 116, 122, 137,
- 282, 370, 255, 76, -89, -191, 139, 80, 12, 176, 185, 145, 244, 253, 173, -18,
- 13, 14, -43, 73, -59, -270, -448, -622, -59, 374, 353, 293, 189, -54, -199, -122,
- -75, -106, -281, -312, 585, 405, 185, 62, -176, -319, -330, -400, -418, -162, -4, 78,
- -31, -11, -79, -83, -88, -274, -343, -431, -623, -518, -148, -11, -17, -21, 21, 90,
- -101, -173, -240, 444, 303, 121, 104, -37, 185, 134, -45, -136, -164, 4, 153, 114,
- -8, 40, 107, -76, -254, -551, -673, 288, 318, 25, 14, -62, -97, -2, 13, -20,
- 87, 127, 80, 216, 336, 147, 188, 165, -10, 125, 193, 87, -126, -396, -736, -669,
- 2, 4, 96, 185, 6, 62, -37, -136, -177, -250, -227, 201, 744, 651, 351, 74,
- -16, -39, -82, -177, -380, -183, -24, -109, -194, -407, -641, -615, -157, 146, 191, 167,
- -21, -12, -39, -63, -159, -128, 20, 6, 16, 39, -60, -243, -594, -733, -364, 46
-};
-
-const Word16 GETRWB_SN1_fx[512] =
-{//Qlog2(2.56)
- -232, -191, 282, 248, 344, 390, 428, 490, 538, 592, 620, 607, 533, 372, 261, 136,
- -59, -227, -418, -288, -247, -448, -501, -644, -760, -922, -1112, -1204, -523, -130, 12, 131,
- 139, 838, 1402, 1327, 1465, 1391, 1371, 1342, 1220, 1147, 1041, 910, 733, 518, 335, 181,
- 211, 148, -94, -275, -484, -586, -541, -634, -583, -511, -424, -322, -285, -299, -194, -87,
- 410, 362, 337, 73, -36, -113, -180, -274, -373, -493, -501, -473, -393, -361, -271, -251,
- -85, -366, -819, -532, 753, 688, 414, 203, 24, -43, 129, 60, -100, -123, -97, -114,
- 4, 37, 484, 514, 340, 225, 89, 59, 40, 3, -5, -1, -11, -49, -43, -48,
- -223, -471, -661, -567, -496, -519, -464, -542, -484, -343, -276, -185, -43, 17, 84, 133,
- -106, -312, -668, -741, 385, 329, 121, -157, -423, -710, -957, -1280, -1143, -330, -20, 131,
- 250, 157, 71, -310, -552, -740, -745, -778, -827, -1064, -1336, -1629, -788, -195, -44, 131,
- 140, 633, 970, 864, 867, 761, 683, 648, 572, 544, 516, 469, 383, 238, 143, 55,
- 116, 143, 229, 134, -25, -120, -232, -333, -535, -642, -985, -1259, -1873, -1727, -330, -10,
- -64, -82, -62, -232, -308, -346, -296, -272, -153, -26, 108, 205, 232, 158, 129, 53,
- 82, -92, -309, -791, -1128, -259, -243, -405, -367, -637, -903, -1084, -675, -199, 17, 146,
- -247, -569, -886, -758, -334, -206, -158, -150, -64, 57, 190, 252, 261, 210, 163, 129,
- -23, -319, -458, 791, 718, 400, 233, -81, -174, -400, -758, -1048, -1338, -1038, -288, -6,
- 50, 462, 303, -47, -122, -134, 15, 137, 179, 222, 266, 249, 219, 123, 80, 30,
- -116, -332, -650, -1104, -1367, -691, -376, -295, -178, -199, -170, -24, 125, 95, 125, 168,
- -66, -314, -526, 325, 156, -56, -114, -287, -126, -185, -292, -298, -189, -81, 1, 23,
- 147, -30, -291, -771, -939, 262, 182, 126, 127, -100, -163, -134, -91, -95, -52, -19,
- -225, -496, -449, -61, 46, 135, 182, 247, 324, 404, 457, 464, 420, 305, 209, 106,
- 418, 312, 415, 74, -156, -345, -400, -634, -769, -1057, -1362, -1841, -1848, -471, -147, 87,
- 38, 19, -232, -552, -698, -941, -483, 119, 54, -34, 70, -68, -144, -192, -253, -236,
- 80, -30, -214, -157, -292, -312, -283, -347, -384, -372, -487, -503, -746, -950, -1372, -644,
- 44, 55, 124, 181, 125, 109, 61, 29, -73, -54, -206, -278, -638, -929, -1563, -1742,
- 802, 823, 726, 353, 272, 122, 117, 94, 80, 40, 68, 47, 42, -19, -26, -69,
- 50, -97, -306, -666, -918, -1109, -1124, -776, -710, -728, -675, -486, -150, -3, 93, 160,
- 81, -144, -131, 319, 227, -96, -236, -517, -711, -949, -1231, -1644, -1625, -444, -117, 86,
- -230, -237, 586, 799, 931, 1023, 1077, 1179, 1133, 1101, 1027, 909, 731, 515, 330, 171,
- 448, 632, 1047, 782, 631, 390, 155, -82, -342, -685, -1103, -1520, -1779, -931, -214, 34,
- -77, -352, -353, 787, 938, 677, 513, 352, 284, 278, 247, 181, 141, 73, 8, -39,
- 54, 42, -67, -298, -465, -593, -533, -547, -626, -741, -977, -1317, -1665, -613, -119, 80
-};
-
-const Word16 GETRWB_SN2_fx[256] =
-{//Qlog2(2.56)
- -202, -246, -356, -356, -232, -164, -79, 4, 78, 130, 152, 165, 170, 141, 90, 70,
- 38, 78, -72, -185, -446, -552, 269, 295, 104, 77, -54, -184, -168, -72, -32, -2,
- 69, 93, 39, 116, 100, 46, 50, -1, -2, 62, 8, -105, -404, -656, -494, -224,
- -285, -305, 263, 97, 29, 33, -24, 54, 35, 25, -4, -6, -30, 13, 20, 21,
- -28, -70, -160, 34, 5, -145, -264, -425, -539, -329, -19, 228, 411, 280, 141, 51,
- 244, 245, 19, -319, -461, -184, -10, 47, 220, 293, 309, 330, 281, 140, 71, 12,
- -128, -251, -374, 424, 279, 68, 35, -68, 13, 45, -6, -41, -73, -17, 8, 27,
- -55, -7, 438, 500, 493, 442, 286, 211, 68, -39, -117, -167, -180, -131, -75, -63,
- 30, 31, 69, 114, -172, -407, -596, -391, 102, 169, 158, 131, 46, 4, -6, -3,
- 69, 76, 33, 238, 164, 119, 160, 165, 273, 342, 383, 419, 456, 378, 262, 96,
- -55, 43, -59, -273, -200, -286, -287, -221, -247, -245, -194, -160, -129, -36, -31, 3,
- -35, -46, -272, -357, 484, 246, -11, 21, -123, -197, -102, -94, -96, -22, 6, 6,
- -117, -188, -252, -227, 0, 460, 506, 526, 501, 389, 250, 131, -28, -32, 24, 17,
- 399, 511, 390, 146, 80, -84, -81, -57, -123, -138, -95, -82, -51, -33, -14, -45,
- -9, 12, 300, 304, 182, 27, -197, -258, -344, -393, -384, -318, -140, -5, -6, 6,
- 64, 25, -7, -256, -306, 381, 243, 96, -17, -190, -285, -246, -65, 48, 37, 29
-};
-
-const Word16 AUWB_SN1_fx[256] =
-{//Qlog2(2.56)
- 328, 137, 358, 330, 184, 145, -60, -294, -555, -784, -945, -872, -601, -337, -155, -33,
- 32, -212, -488, -651, -752, -877, -892, -886, -853, -795, -705, -549, -330, -224, -127, -9,
- 372, 327, 197, 33, 13, -55, -87, -124, -125, -148, -144, -168, -175, -184, -127, -125,
- 752, 727, 623, 519, 449, 350, 309, 289, 272, 252, 185, 124, 118, 35, 22, -20,
- 14, 144, 296, 432, 416, 325, 177, 166, 151, 123, 109, 104, 47, -22, -45, -49,
- 310, 112, -141, -529, -654, -53, 162, -33, -297, -551, -772, -817, -540, -287, -95, -7,
- -158, 241, 443, 543, 559, 579, 566, 606, 610, 622, 602, 578, 485, 331, 197, 104,
- -471, -530, 37, 272, 397, 442, 466, 523, 561, 592, 608, 576, 485, 348, 222, 133,
- 162, 0, -87, -85, -151, -331, -410, -603, -767, -1030, -1348, -1812, -1735, -678, -284, -6,
- -156, 36, 15, 26, 41, 118, 201, 265, 339, 382, 420, 435, 377, 264, 159, 84,
- -69, -274, -411, -158, 60, -56, -190, -305, -371, -389, -411, -407, -338, -276, -173, -99,
- 0, -26, -196, -379, -369, -327, -193, -148, -77, -10, 63, 98, 98, 49, 40, -5,
- -149, -432, -729, -923, -927, -766, -568, -455, -333, -219, -122, -29, 11, 9, 20, 54,
- 177, 64, -60, -232, -411, -552, -557, -550, -509, -464, -380, -331, -297, -288, -215, -170,
- -16, 439, 971, 1104, 1209, 1323, 1339, 1374, 1317, 1223, 1107, 983, 781, 535, 315, 151,
- -432, -727, -686, -340, -156, -40, 18, 102, 169, 257, 306, 335, 296, 213, 137, 97
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 TRWB2_SN1_fx[256] =
-{//Qlog2(2.56)
- -74, -384, -764, -964, -1122, -912, -819, -740, -728, -572, -379, -317, -250, -51, -67, 85,
- -311, -618, -439, -108, 156, 257, 404, 543, 643, 729, 732, 572, 446, 329, 236, 164,
- 523, 1549, 1557, 1476, 1374, 1192, 1068, 923, 901, 788, 717, 401, 262, 6, -100, -368,
- -13, -80, -189, -386, -486, -357, -216, -63, 65, 189, 248, 194, 218, 219, 205, 169,
- -104, -519, -772, 492, 224, 18, -203, -244, -126, -220, -362, -417, -271, -71, -34, -50,
- -202, 124, 811, 975, 1326, 1468, 1613, 1527, 1474, 1366, 1220, 906, 700, 509, 351, 207,
- -57, -196, -238, -281, -267, -239, -190, -137, -27, 4, 77, -178, -256, -553, -669, -1105,
- -183, -211, 804, 789, 685, 529, 479, 403, 371, 313, 279, 49, -19, -156, -179, -335,
- 758, 848, 608, 313, 271, 176, 177, 73, 106, 61, 59, -159, -203, -287, -268, -343,
- 199, 70, 95, -29, -245, -411, -745, -1009, -1473, -1921, -2633, -1648, -537, -284, -87, 207,
- 82, -217, -460, -646, -718, -821, -983, -1282, -1580, -2108, -1863, -609, -407, -122, -50, 243,
- -132, 364, 364, 340, 489, 496, 596, 606, 704, 756, 777, 616, 521, 409, 305, 211,
- 123, -189, -91, -306, -319, -407, -600, -679, -911, -855, -566, -249, -65, -1, -65, -25,
- 79, -58, -103, -150, -268, -265, -426, -479, -614, -671, -1005, -1378, -2027, -1547, -568, -52,
- -275, -669, -1070, -1097, -688, -433, -340, -148, -27, 194, 309, 277, 229, 188, 82, 127,
- 397, 1343, 1482, 1729, 1978, 2012, 1969, 1852, 1729, 1574, 1407, 1087, 848, 636, 431, 278
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 TRWB2_SN2_fx[256] =
-{//Qlog2(2.56)
- 50, -66, -486, -850, 504, 345, 261, 10, -207, -218, -174, -18, 72, 69, 3, 24,
- -171, -439, -632, 390, 143, -89, -292, -314, -227, -157, 33, 181, 185, 204, 128, 167,
- 458, 459, 78, -250, -365, -381, -353, -382, -327, -284, -191, -18, 3, 37, 29, 95,
- -169, -227, -423, -448, -485, -426, -364, -284, -238, -184, -228, -190, -145, 17, 65, 145,
- -4, -120, -170, -333, -677, -782, -719, -391, -112, 232, 464, 392, 275, 215, 121, 139,
- -94, -130, 453, 295, -45, -286, -444, -473, -519, -428, -268, -40, -12, 46, 39, 118,
- -189, -245, 805, 815, 518, 293, 162, 110, -67, -158, -223, -120, -36, 15, 26, 60,
- 23, 130, 107, 0, -31, -66, 33, 22, 101, -10, -32, -232, -281, -590, -672, -1089,
- 51, 106, 157, 132, 40, 11, -73, -66, -165, -294, -561, -770, -742, -489, -202, 4,
- 25, 230, 286, 179, 75, 18, 15, 24, 109, 187, 310, 334, 328, 291, 237, 212,
- -238, -492, -550, 563, 764, 610, 542, 427, 373, 261, 166, 171, 122, 34, -21, -92,
- -359, -462, -10, 22, -42, -2, 78, 167, 154, 155, 74, 73, 66, 94, 89, 126,
- -5, -110, -374, -546, -386, -136, 95, 305, 437, 570, 615, 558, 463, 335, 209, 151,
- 23, 376, 292, 235, 485, 519, 657, 549, 478, 338, 186, 7, -28, -155, -95, -188,
- 166, 139, -277, -716, -822, 234, 319, 326, 234, 36, -155, -317, -247, -80, 49, 117,
- 431, 853, 745, 512, 325, 139, 83, -31, -25, -47, -17, -12, -24, -43, -5, 13
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 AUWB2_SN1_fx[256] =
-{//Qlog2(2.56)
- -107, -446, -835, -1041, -1152, -1161, -1146, -969, -828, -533, -251, -242, -139, 172, 95, 466,
- 1052, 1008, 1052, 875, 864, 748, 783, 690, 754, 715, 688, 342, 195, -32, -251, -509,
- -311, -170, 366, 632, 748, 863, 983, 1042, 1118, 1188, 1133, 895, 728, 621, 460, 418,
- 608, 525, 322, 30, -237, -483, -862, -1178, -1651, -2184, -2770, -1349, -430, -28, 128, 562,
- 296, 171, -192, -429, -488, -470, -492, -473, -448, -352, -242, -309, -337, -210, -265, -182,
- 831, 703, 456, 217, 165, 65, 17, -53, -67, -78, -38, -222, -340, -329, -349, -391,
- 162, -13, -158, -335, -526, -705, -986, -1245, -1640, -2149, -2754, -1344, -372, -12, 134, 564,
- -79, -389, -569, -699, -811, -940, -1058, -1299, -1534, -2077, -1953, -507, -216, 143, 191, 607,
- -106, -116, -210, -225, -323, -330, -494, -491, -700, -757, -1057, -1424, -2222, -1509, -259, 348,
- -366, -748, -1177, -1216, -1017, -698, -444, -154, 10, 285, 361, 284, 255, 359, 187, 365,
- 77, 447, 418, 475, 453, 459, 475, 515, 562, 648, 658, 452, 367, 334, 244, 204,
- 10, 197, 170, 166, 144, 60, 52, -2, -20, -40, 18, -238, -279, -434, -451, -807,
- -460, -713, -547, -153, 64, 243, 386, 492, 620, 752, 759, 536, 445, 324, 151, -32,
- -246, -396, -413, -371, -354, -317, -307, -228, -195, -101, -36, -174, -197, -162, -261, -349,
- -329, -240, 326, 462, 428, 344, 405, 374, 439, 434, 467, 127, 85, -154, -248, -683,
- -12, 15, -222, -227, -31, 124, 200, 294, 357, 541, 607, 459, 376, 352, 282, 283
-};
-
-/* An 16-by-32 matrix */
-const Word16 IAA_MA1_fx[512] =
-{//Qlog2(2.56)
- -175, -490, -520, -631, -645, -614, -610, -548, -503, -432, -353, -301, -238, -141, -67, 26,
- 301, 407, 227, 96, -12, -18, -13, 2, 39, 107, 124, 92, 83, 100, 62, 72,
- -280, -737, -569, -164, -9, 100, 141, 211, 252, 281, 274, 217, 206, 219, 117, 106,
- -266, -753, -841, -587, -487, -345, -263, -167, -114, -30, 8, 32, 34, 61, 55, 104,
- -91, -137, -293, -349, -352, -326, -268, -247, -178, -129, -56, -96, -11, 219, 49, 56,
- -18, 1, -33, -14, -19, -5, -22, -14, -43, -37, -104, -143, -375, -770, -190, -100,
- 72, -22, -121, -220, -320, -378, -500, -587, -729, -795, -1056, -1305, -1691, -1090, -452, -60,
- 19, -279, -453, -580, -588, -739, -858, -1044, -1281, -1614, -921, -376, -273, -84, -2, 187,
- 853, 759, 591, 376, 260, 122, 39, -71, -133, -184, -209, -297, -299, -171, -124, -83,
- 266, 34, -182, -367, -516, -686, -881, -1121, -1414, -1834, -2110, -997, -519, -274, -109, 137,
- -2, -8, 42, 91, 172, 211, 298, 336, 433, 409, 546, 1043, 1499, 1038, 410, 189,
- 86, 254, 259, 254, 246, 219, 184, 122, 79, 11, -55, -170, -363, -934, -371, -188,
- 168, 167, -122, -244, -325, -340, -359, -343, -331, -291, -278, -270, -272, -162, -101, -46,
- -244, -459, -367, -340, -295, -220, -173, -107, -22, 53, 103, 293, 1084, 807, 260, 117,
- -319, -650, -685, -427, -290, -105, 25, 161, 303, 418, 587, 1074, 1563, 1085, 400, 170,
- 146, 257, 282, 295, 303, 294, 297, 262, 237, 193, 92, 341, 1220, 884, 315, 144,
- -291, -558, 147, 201, 282, 280, 310, 302, 313, 306, 292, 239, 198, 188, 106, 94,
- -11, -8, -156, -204, -231, -250, -265, -289, -269, -316, -322, -450, -488, -676, -778, -973,
- -117, -27, 4, 96, 174, 229, 271, 310, 344, 362, 344, 273, 209, 180, 109, 106,
- -260, -290, 151, 269, 406, 442, 551, 590, 679, 681, 900, 1293, 1631, 1132, 477, 221,
- -37, 374, 394, 414, 419, 395, 345, 313, 282, 255, 211, 126, 84, 51, -10, -53,
- 404, 327, 174, 28, -124, -290, -490, -695, -1011, -1111, -529, -288, -183, -69, -7, 142,
- 563, 752, 585, 555, 512, 478, 424, 396, 376, 343, 300, 194, 193, 162, 78, 46,
- -59, -131, -35, 49, 54, -12, -92, -185, -243, -289, -288, -344, -326, 0, -38, 6,
- 496, 582, 564, 514, 521, 490, 486, 436, 432, 320, 456, 1060, 1523, 1058, 419, 194,
- 174, 77, 18, -89, -112, -196, -165, -247, -222, -326, -332, -494, 499, 617, 121, 60,
- 315, 299, 229, 137, 78, -3, -40, -138, -198, -307, -375, -502, -515, -25, -88, -49,
- -232, -29, 353, 399, 485, 487, 523, 526, 556, 559, 520, 415, 328, 283, 187, 166,
- 182, 385, 403, 453, 515, 572, 635, 691, 787, 852, 1154, 1483, 1779, 1231, 524, 246,
- -273, -492, -185, -97, -52, -51, -17, -27, 13, 20, 45, -20, 52, 244, 58, 56,
- 20, -3, -241, -267, -194, -86, 4, 75, 140, 191, 200, 154, 137, 146, 85, 77,
- 92, 628, 611, 708, 706, 716, 672, 694, 655, 619, 550, 432, 354, 284, 204, 172
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 UVD_MA1_fx[256] =
-{//Qlog2(2.56)
- -301, -503, -426, -187, -131, -64, -45, -20, 11, 56, 63, 90, 110, 175, 97, 33,
- 161, 353, 474, 502, 709, 782, 794, 765, 632, 532, 406, 285, 230, 145, 97, 52,
- -37, -5, 205, 323, 412, 349, 221, 91, -6, -59, -86, -112, -32, 209, 73, 23,
- -273, -615, -820, -794, -834, -838, -822, -819, -751, -701, -641, -562, -391, -271, -184, -63,
- 262, 168, 104, -9, -78, -163, -141, -199, -191, -249, -245, -317, -168, 535, 109, 33,
- -410, -675, -681, -611, -500, -396, -273, -183, -47, 60, 194, 357, 1044, 1080, 335, 140,
- 154, 185, 256, 238, 203, 238, 280, 260, 300, 267, 258, 196, 121, -618, -263, -60,
- 345, 705, 859, 786, 743, 584, 425, 267, 168, 105, 74, 28, 119, 267, 105, 39,
- -39, -166, -230, -196, -255, -276, -318, -349, -387, -438, -539, -613, -752, -956, -1353, -1628,
- 498, 479, 414, 231, 98, 5, -18, -41, -60, -78, -91, -96, -81, 72, 30, -8,
- 41, 120, 65, 141, 117, 186, 249, 299, 418, 520, 566, 618, 692, 579, 321, 166,
- -236, -278, -69, 13, 113, 362, 445, 539, 503, 387, 269, 172, 120, -21, 1, 4,
- -103, -46, -137, -132, -108, -97, -67, -37, -8, 41, 82, 107, 43, -605, -189, -56,
- -220, -315, -482, -516, -489, -445, -415, -362, -304, -205, -136, -68, -7, 131, 70, 25,
- -10, -121, -210, -237, -224, -302, -246, -310, -271, -343, -285, -364, 28, 703, 135, 54,
- 118, 50, -67, -166, -349, -416, -442, -446, -439, -420, -382, -319, -245, -209, -140, -82
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 UVD_MA2_fx[256] =
-{//Qlog2(2.56)
- -75, -64, -150, -231, -272, -278, -248, -194, -156, -107, -74, -43, -92, -21, 9, 5,
- 393, 275, -12, -156, -208, -215, -162, -132, -115, -109, -94, -85, -104, -10, 5, -1,
- -297, -389, -99, -78, -66, -19, -12, 8, 0, -3, -15, -22, -113, -82, -16, 2,
- 59, -11, 5, -33, -11, -61, -70, -139, -143, -239, -207, -223, 711, 701, 143, 68,
- -195, 406, 222, 49, -6, -23, -6, 9, 0, 13, 26, 49, -44, -129, -18, -7,
- 23, -30, -141, 79, -18, -76, -55, -14, 44, 98, 88, 86, -96, -351, -112, -39,
- 380, 329, 235, 173, 141, 72, 25, -4, -6, -19, -21, -33, -55, -23, 3, -1,
- -81, -210, -284, 158, 396, 290, 163, 59, -25, -22, -10, -6, -46, -32, 9, 5,
- 9, 34, -15, 5, 23, -48, -127, -243, -347, -421, -455, -475, -495, -449, -294, -163,
- -13, -171, -416, -414, -245, -25, 69, 102, 104, 84, 50, 33, -38, -4, 0, 5,
- 50, 118, 68, 37, 147, 319, 371, 355, 291, 204, 130, 81, 21, 46, 36, 22,
- -95, -108, 311, 214, -28, -153, -226, -192, -129, -69, -42, -11, -48, -17, 13, 2,
- -185, -223, -104, 26, 53, 89, 132, 181, 258, 346, 397, 445, 392, 241, 125, 58,
- 83, 33, -9, -81, 40, 99, 56, 8, -51, -85, -106, -124, -196, 5, 5, 0,
- 143, 148, 19, -121, -247, -211, -67, 83, 198, 268, 290, 300, 240, 164, 86, 37,
- -198, -136, 370, 372, 300, 240, 156, 113, 79, 60, 44, 29, -35, -38, 6, 7
-};
-
-/* An 16-by-16 matrix in Scale = 2.56f */
-const Word16 UVWB_MA3_fx[256] =
-{//Qlog2(2.56)
- -26, 23, 7, -6, -1, 3, 40, 35, -43, -24, 56, 157, 265, 423, 382, 260,
- 61, -300, -130, -101, -8, 106, 108, 114, 88, 43, -2, -33, -56, 67, 29, 13,
- -31, 47, 45, -121, 46, 22, 111, 233, -256, -252, -123, -71, -31, 54, 56, 33,
- 20, -154, 67, 198, -232, -167, -86, -12, 79, 116, 88, 78, 44, 75, 27, -7,
- -14, 153, -166, 21, 107, 64, 233, -223, -147, -27, -1, 43, 61, 70, 50, 18,
- 3, -115, -8, 143, 192, 193, -124, -195, -198, -162, -75, 14, 45, 83, 79, 49,
- 12, -57, 25, -29, -11, 12, -7, -13, -12, 31, 74, 99, -10, -421, -209, -111,
- -25, 115, 119, -19, -117, -164, -203, -237, -206, -169, -110, -41, -11, 15, 1, -7,
- -13, 170, -143, -128, -224, -94, 1, 96, 144, 102, 29, 2, -37, 46, 7, -12,
- -11, 10, -34, 38, 24, 86, 149, 211, 240, 279, 247, 218, 154, 161, 74, 15,
- -24, 64, 110, 125, -24, 123, 161, 166, 177, 18, -112, -116, -141, -117, -113, -91,
- -4, -20, -17, -11, -27, 13, -15, -40, -58, -157, -252, -283, -288, -186, -162, -112,
- -20, 2, 32, 44, -31, -49, 8, 13, 55, -59, -162, -212, -61, 384, 115, 36,
- -4, 42, -75, 92, 268, -203, -125, 10, 52, 121, 72, -43, -109, -47, -66, -76,
- -39, 76, 268, -254, -28, 87, 2, 91, 85, 68, 89, 96, 42, 90, 39, 4,
- 2, 2, -56, 7, 67, -31, -219, -192, -24, 146, 249, 269, 209, 199, 106, 31
-};
-
-/* An 16-by-8 matrix in Scale = 2.56f */
-const Word16 GESVNB_AR1_fx[128] =
-{//Qlog2(2.56)
- -25, -64, -140, -118, 270, 240, 127, 70, 20, -40, -56, -111, -82, 64, 2, 5,
- 81, 104, 71, 70, 0, -49, -54, -73, -59, -92, -102, -201, -404, -52, -40, -15,
- -112, -217, -251, -202, -34, 57, 58, 62, 79, 127, 177, 306, 524, 315, 112, 53,
- 17, -6, 34, 66, 14, -26, -174, -196, -142, -131, -102, -97, 180, 154, 29, 17,
- 5, -27, -107, -197, -343, -333, -182, -143, -91, -17, 43, 120, 383, 267, 83, 40,
- -1, -15, -35, -56, -169, -145, 86, 101, 77, 48, 29, 78, -9, 68, 15, 9,
- 3, 9, 320, 450, 385, 348, 215, 155, 105, 45, -13, -75, -272, -129, -52, -23,
- 4, 49, 54, 90, 92, 101, 59, 69, 20, 70, 23, 43, -280, -624, -114, -55
-};
-
-/* An 16-by-8 matrix in Scale = 2.56f */
-const Word16 GESVNB_AR2_fx[128] =
-{//Qlog2(2.56)
- -22, -35, -31, -166, -164, 217, 212, 155, 166, 123, 67, 33, -21, -41, -3, -1,
- -14, -20, -16, -70, -77, -53, 23, -7, -98, -123, -99, -49, 357, 114, 36, 19,
- -57, -119, -303, -215, -33, -103, -97, -117, -105, -102, -67, -134, -176, 113, 16, 8,
- -12, 14, 30, -37, -112, -226, -206, -25, 125, 134, 99, 83, 55, -4, 9, 4,
- -19, 23, 171, 57, 13, -15, -26, -42, -65, -69, -77, -169, -351, -105, -49, -21,
- -14, -10, 8, 35, 161, 104, -74, -102, -135, -47, 45, 264, 52, -69, -1, -5,
- 213, 284, 230, 121, 50, 12, 43, 48, 27, -7, -24, -39, 75, 1, -9, -3,
- -75, -137, -89, 275, 164, 65, 125, 91, 86, 91, 56, 10, 9, -10, 0, 0
-};
-
-/* An 16-by-8 matrix in Scale = 2.56f */
-const Word16 GESVWB_AR1_fx[128] =
-{//Qlog2(2.56)
- -3, -16, -31, 2, -81, -123, -226, -260, -196, -122, -20, 78, 178, 145, 84, 46,
- 55, 42, 15, 32, -48, -81, -109, -137, -187, -264, -330, -387, -363, -176, -38, 37,
- -32, -70, -144, -269, -337, -183, 59, 58, 44, 49, 42, 51, 72, 50, 26, 38,
- -18, -58, -79, 125, 352, 291, 180, 118, 72, 25, -23, -82, -185, -167, -33, 6,
- -10, 135, 544, 517, 517, 561, 515, 528, 500, 472, 413, 383, 318, 219, 118, 57,
- -54, -280, -614, -548, -521, -522, -448, -479, -457, -438, -377, -355, -318, -271, -222, -89,
- -62, -96, -86, -10, 104, 155, 120, 112, 190, 264, 291, 272, 232, 166, 95, 27,
- 33, 61, 155, 121, 9, -28, 6, 103, 64, 17, 4, -2, -31, -88, -209, -206
-};
-
-/* An 16-by-8 matrix in Scale = 2.56f */
-const Word16 GESVWB_AR2_fx[128] =
-{//Qlog2(2.56)
- -147, -326, -421, -91, -22, -25, -14, -21, 32, 76, 104, 102, 65, 47, 50, 41,
- -39, -16, 61, -13, -38, -56, 47, 153, 195, 213, 212, 220, 245, 245, 209, 86,
- -34, -73, 82, 387, 199, 71, 56, -18, -33, -56, -88, -79, -5, 59, 55, 29,
- -7, -21, -21, -158, -123, 304, 226, 168, 124, 8, -75, -91, -54, -5, 37, 30,
- -26, -22, -67, -225, 107, 38, -82, -113, -213, -205, -62, 28, 89, 95, 52, 17,
- 227, 404, 325, 134, 45, -16, 3, -15, -55, -65, -55, -54, -18, -8, 1, -14,
- 19, 30, 12, 28, 48, 13, 2, -47, -38, 41, 29, -8, -154, -315, -411, -242,
- 8, 24, 29, -61, -215, -329, -237, -106, -12, -12, -64, -118, -167, -119, 8, 52
-};
-
-/* An 16-by-32 matrix in Scale = 2.56f */
-const Word16 GEWB2_MA1_fx[512] =
-{//Qlog2(2.56)
- 659, 1694, 1634, 1513, 1305, 1098, 933, 805, 733, 624, 525, 339, 239, 50, -35, -215,
- 6, 65, 125, 55, -85, -126, -272, -316, -507, -586, -1010, -1278, -1941, -1910, -426, 78,
- 281, 315, 236, -4, -102, -171, -232, -335, -362, -425, -488, -603, -669, -736, -648, -593,
- 29, -251, -582, -871, -969, -897, -991, -1077, -1275, -1480, -998, -393, -247, -9, 28, 271,
- -60, -361, 401, 552, 236, 35, -196, -215, -496, -683, -911, -820, -576, -299, -240, -141,
- 416, 574, 662, 350, 133, -160, -431, -781, -1200, -1652, -2035, -1092, -449, -192, -11, 263,
- -206, -609, -931, 28, -229, -358, -543, -462, -377, -360, -336, -251, -105, 35, 26, 80,
- 369, 1256, 1380, 1571, 1726, 1727, 1644, 1521, 1350, 1156, 984, 748, 580, 395, 254, 108,
- -147, -479, -330, -73, -272, -441, -685, -837, -1139, -1458, -1370, -414, -208, -12, 14, 213,
- -50, 100, -82, -253, -7, 119, 294, 392, 494, 578, 589, 523, 462, 383, 300, 249,
- -94, -362, -575, -770, -987, -999, -922, -697, -582, -305, -135, -31, -8, 23, -33, 62,
- 29, -64, -4, -123, -344, -414, -679, -767, -1152, -1401, -2105, -1905, -582, -300, -64, 223,
- 428, 990, 1019, 809, 681, 470, 366, 179, 126, -26, -141, -363, -423, -536, -437, -545,
- -133, -357, 364, 241, -39, -227, -334, -305, -426, -292, -102, 87, 159, 182, 160, 190,
- 560, 764, 531, 156, 22, -18, 23, -20, 19, 0, 13, -61, -35, -44, -12, -48,
- 33, -235, -634, -1093, 136, -31, -68, -285, -529, -535, -462, -249, -95, -53, -116, -61,
- -188, -628, -894, 702, 700, 373, 196, 51, 95, -56, -191, -181, -173, -132, -116, -218,
- 37, -188, -661, -1087, -1322, -258, -186, -181, -238, -372, -418, -508, -433, -197, -73, 28,
- -231, -222, 911, 875, 669, 440, 363, 301, 257, 192, 147, 68, 77, 43, 57, 17,
- -4, -187, -356, -410, -569, -499, -584, -568, -660, -703, -965, -1201, -1540, -708, -252, 87,
- 220, 64, -67, -357, -572, -744, -913, -1176, -1439, -1894, -2152, -762, -419, -146, -10, 281,
- -253, -627, -1075, -1206, -721, -398, -337, -188, -118, 50, 125, 198, 200, 190, 96, 164,
- -348, -741, -854, -357, -163, -103, -26, 143, 231, 318, 335, 325, 274, 233, 167, 190,
- -143, -256, -191, -280, -250, -191, -82, 37, 126, 102, 67, -130, -202, -430, -495, -810,
- 232, 107, -22, -341, -497, -523, -607, -646, -746, -690, -478, -295, -160, -77, -53, -7,
- -33, -98, -258, -501, -589, -438, -316, -168, -58, 82, 175, 219, 249, 259, 237, 226,
- -393, -665, -19, 185, 249, 266, 378, 468, 499, 508, 464, 388, 310, 238, 186, 145,
- -240, -99, 408, 480, 693, 761, 946, 943, 951, 893, 782, 613, 482, 351, 260, 163,
- -23, 523, 885, 903, 1172, 1287, 1482, 1491, 1476, 1402, 1240, 1005, 787, 604, 433, 292,
- 262, 988, 904, 732, 734, 665, 715, 656, 673, 615, 541, 372, 284, 139, 68, -84,
- -119, 446, 1118, 1215, 1372, 1280, 1208, 989, 881, 675, 557, 319, 227, 23, -39, -256,
- -102, 178, 379, 252, 365, 319, 455, 377, 413, 278, 225, -36, -67, -351, -375, -772
-};
-
-/* An 16-by-32 matrix in Scale = 2.56f */
-const Word16 GEWB_MA1_fx[512] =
-{//Qlog2(2.56)
- 269, 268, 416, 287, 157, 7, -132, -276, -482, -701, -1025, -1350, -1642, -982, -321, -49,
- 237, 949, 1374, 1228, 1337, 1219, 1123, 1016, 852, 752, 664, 559, 448, 306, 194, 83,
- -6, -176, -373, -111, -221, -387, -483, -639, -753, -786, -774, -655, -328, -114, -25, 27,
- 135, 164, -4, -181, -364, -528, -464, -424, -393, -314, -242, -185, -104, -61, -32, -37,
- 15, -218, -322, 668, 597, 343, 196, -5, -46, -159, -359, -524, -629, -548, -308, -95,
- 242, 463, 767, 661, 558, 403, 268, 191, 71, -4, -51, -103, -141, -176, -161, -142,
- -179, -147, 715, 865, 970, 932, 822, 763, 602, 514, 436, 370, 285, 189, 106, 36,
- -49, -227, -589, -933, -1172, -700, -248, -175, -132, -132, -125, -103, -47, -49, -12, 60,
- -7, -227, -404, 272, 83, -50, -165, -319, -343, -501, -731, -939, -1013, -607, -202, -2,
- -76, -271, -661, -582, 296, 86, -60, -166, -335, -314, -213, -285, -324, -280, -164, -39,
- -264, -452, -111, 171, 229, 357, 355, 461, 509, 517, 489, 441, 347, 246, 158, 75,
- 67, -49, -340, -546, -758, -919, -876, -727, -658, -567, -492, -400, -234, -140, -63, 36,
- -142, 94, 514, 400, 406, 389, 379, 413, 391, 377, 354, 314, 245, 156, 94, 34,
- 97, -47, -316, -620, -874, -179, -206, -290, -304, -514, -690, -723, -503, -252, -73, 39,
- 485, 674, 532, 195, 38, -60, 17, 52, 63, 74, 85, 62, 35, -10, -22, -51,
- -105, -23, 287, 394, 469, 609, 706, 860, 933, 933, 874, 789, 638, 465, 297, 148,
- -223, -499, -837, -813, -391, -231, -178, -182, -81, 2, 84, 113, 131, 142, 127, 107,
- -64, 269, 879, 849, 1013, 1157, 1250, 1337, 1263, 1176, 1048, 900, 703, 502, 318, 165,
- 61, 1, -198, -209, -345, -417, -280, -280, -307, -272, -341, -418, -604, -738, -887, -394,
- 45, 77, 124, 152, 99, 43, 20, -4, -91, -85, -192, -280, -544, -754, -1176, -1296,
- 173, 69, -49, -226, -344, -479, -489, -618, -727, -909, -1122, -1446, -1292, -492, -205, 10,
- -80, -80, 338, 285, 123, 48, -76, -80, -105, -118, -108, -80, -58, -28, -9, -8,
- 74, -79, -292, -618, -756, 345, 216, 180, 143, -73, -186, -223, -200, -143, -52, -21,
- -253, -519, -578, -188, -96, -35, -7, 27, 133, 218, 258, 258, 231, 180, 120, 70,
- 273, 740, 950, 736, 701, 635, 611, 602, 566, 533, 494, 447, 350, 230, 131, 42,
- -100, -345, -702, -352, 709, 682, 485, 324, 161, 112, 148, 25, -88, -106, -86, -101,
- 307, 265, 253, 65, -63, -75, -169, -282, -390, -501, -550, -532, -406, -296, -186, -132,
- -26, 70, 50, -84, -89, 28, 106, 199, 305, 391, 450, 469, 419, 301, 191, 80,
- 22, 39, -154, -426, -597, -497, -159, -69, 41, 95, 114, 114, 99, 33, -7, -40,
- -162, -356, -511, -461, -475, -513, -477, -485, -395, -249, -136, -71, -4, 33, 54, 64,
- -82, -295, -562, 241, 65, -163, -227, -384, -237, -229, -266, -223, -94, 10, 41, 31,
- -104, -323, -302, 733, 646, 418, 271, 149, 155, 154, 119, 99, 89, 63, 13, -16
-};
-
-/* An 16-by-32 matrix in Scale = 2.56f */
-const Word16 AUWB2_MA1_fx[512] =
-{//Qlog2(2.56)
- 391, 298, 179, -37, -225, -387, -627, -864, -1216, -1644, -2108, -804, -277, -5, 121, 468,
- 351, 213, 141, -75, -130, -164, -332, -410, -524, -573, -575, -474, -331, -103, -22, 201,
- 81, 874, 1137, 1223, 1242, 1262, 1238, 1185, 1141, 1085, 993, 733, 570, 424, 256, 145,
- -6, -25, -105, -147, -327, -342, -587, -620, -954, -1143, -1878, -2059, -356, -100, 134, 477,
- -197, -505, -826, -1043, -863, -485, -296, -103, -6, 178, 269, 245, 231, 320, 243, 413,
- -518, -605, 282, 430, 532, 596, 676, 748, 808, 861, 834, 681, 534, 498, 293, 337,
- -244, -563, -720, -599, -500, -494, -627, -739, -1028, -1219, -297, 9, 71, 272, 285, 563,
- -448, -854, -916, -518, -287, -52, 56, 245, 347, 524, 557, 497, 416, 452, 321, 437,
- 150, 113, 28, -26, 1, -80, -177, -226, -193, -156, -62, -227, -240, -383, -535, -809,
- -240, -246, -174, -66, 80, 149, 244, 284, 413, 434, 473, 158, 56, -167, -326, -723,
- 131, -11, 141, 32, 24, -122, -397, -610, -888, -812, 30, 232, 306, 371, 341, 446,
- -158, -545, -529, 151, 142, -101, -426, -716, -1031, -1479, -1550, -352, -132, 145, 187, 517,
- 148, -104, -445, -841, -31, 183, -86, -316, -615, -660, -231, 84, 192, 275, 201, 311,
- -183, -220, -243, -182, -237, -176, -266, -233, -336, -339, -650, -1019, -1652, -846, -52, 387,
- -104, -117, -254, -332, -191, 1, 64, 182, 317, 495, 626, 574, 519, 508, 456, 505,
- -151, -237, 492, 479, 273, 139, 36, -60, -119, 74, 174, 188, 298, 366, 347, 478,
- 158, 23, -210, -450, -673, -637, -423, -331, -133, 14, 128, 69, 62, 143, 171, 313,
- 501, 394, 37, -57, 67, 70, 46, 35, 92, 120, 337, 258, 276, 283, 368, 500,
- 42, -157, -398, -600, -742, -780, -781, -980, -1166, -1629, -968, -149, -99, 188, 209, 529,
- -240, 190, 465, 543, 575, 565, 605, 596, 653, 599, 583, 279, 203, -51, -186, -589,
- 316, 371, 417, 372, 293, 189, 230, 154, 184, 91, 94, -175, -198, -358, -454, -736,
- 72, -159, -362, -499, -633, -690, -794, -739, -662, -456, -360, -338, -251, -6, 50, 346,
- -202, -332, -428, -462, -508, -440, -552, -647, -885, -1217, -1733, -619, -162, 95, 202, 510,
- -91, -391, -709, -884, -1012, -1001, -936, -714, -509, -198, 42, 99, 119, 261, 238, 496,
- -370, 92, 476, 604, 681, 762, 826, 893, 934, 1001, 954, 783, 629, 590, 412, 467,
- -193, -22, -28, 46, 214, 387, 502, 643, 728, 864, 859, 723, 581, 569, 435, 483,
- 223, 291, 633, 508, 350, 141, -156, -476, -930, -1417, -1809, -764, -206, 77, 191, 515,
- -475, -791, -417, 75, 201, 343, 408, 549, 612, 707, 686, 572, 463, 457, 321, 373,
- 842, 716, 669, 593, 419, 423, 373, 321, 273, 280, 354, 217, 193, 232, 175, 294,
- 116, -60, -144, -299, -421, -551, -732, -952, -1203, -1662, -1996, -537, -240, 55, 138, 486,
- -323, -665, -686, -214, -201, -260, -373, -329, -333, -165, 66, 96, 175, 310, 291, 486,
- -19, 43, 35, 40, 42, 55, 63, 101, 133, 194, 222, 152, 117, 145, 133, 213
-};
-
-const Word16 *const Quantizers_fx[] = { SVNB_SN1_fx, SVNB_SN2_fx, GETRNB_SN1_fx, GETRNB_SN2_fx, AUNB_SN1_fx,SVWB_SN1_fx, SVWB_SN2_fx, GETRWB_SN1_fx,
- GETRWB_SN2_fx, AUWB_SN1_fx,/* U13, */
- TRWB2_SN1_fx, TRWB2_SN2_fx, AUWB2_SN1_fx, CNG_SN1_fx, SVWB2_SN1_fx, SVWB2_SN2_fx
-};//Qlog2(2.56)
-
-const Word16 *const Quantizers_p_fx[] = { IAA_MA1_fx, UVD_MA1_fx, UVD_MA2_fx, UVWB_MA3_fx, GESVNB_AR1_fx, GESVNB_AR2_fx, GESVWB_AR1_fx, GESVWB_AR2_fx,
- GEWB2_MA1_fx,GEWB_MA1_fx, AUWB2_MA1_fx, SVWB2_AR1_fx, SVWB2_AR2_fx
-};//Qlog2(2.56)
-
-const Word16 vals_fx[NO_LEADERS][MAX_NO_VALS] = /*Q1 */
-{
- {2, 0, 0, 0},
- {1, 0, 0, 0},
- {2, 0, 0, 0},
- {4, 0, 0, 0},
- {3, 1, 0, 0},
- {2, 0, 0, 0},
- {4, 2, 0, 0},
- {3, 1, 0, 0},
- {2, 0, 0, 0},
- {4, 2, 0, 0},
- {4, 0, 0, 0},
- {3, 1, 0, 0},
- {5, 1, 0, 0},
- {4, 2, 0, 0},
- {4, 2, 0, 0},
- {6, 2, 0, 0},
- {3, 1, 0, 0},
- {5, 3, 1, 0},
- {4, 2, 0, 0},
- {4, 0, 0, 0},
- {6, 2, 0, 0},
- {3, 1, 0, 0},
- {5, 3, 1, 0},
- {4, 2, 0, 0},
- {4, 2, 0, 0},
- {6, 2, 0, 0},
- {6, 4, 2, 0},
- {3, 1, 0, 0},
- {5, 3, 1, 0},
- {5, 1, 0, 0},
- {7, 1, 0, 0},
- {4, 2, 0, 0},
- {4, 0, 0, 0},
- {6, 2, 0, 0},
- {6, 4, 2, 0},
- {8, 0, 0, 0},
- {3, 1, 0, 0},
- {5, 3, 1, 0},
- {5, 3, 1, 0},
- {7, 3, 1, 0},
- {4, 2, 0, 0},
- {6, 4, 2, 0},
- {6, 4, 2, 0},
- {6, 0, 0, 0},
- {8, 2, 0, 0},
- {3, 0, 0, 0},
- {5, 3, 1, 0},
- {5, 3, 1, 0},
- {7, 3, 1, 0},
-};
-
-const Word16 no_vals[NO_LEADERS]= {2,1,2,2,2,2,3,2,1,3,2,2,2,3,3,3,2,3,3,2,3,2,3,2,3,3,4,2,3,2,2,3,2,2,4,2,2,3,3,3,3,4,4,2,3,1,3,3,3}; // Q0
-
-const Word16 no_vals_ind[NO_LEADERS][MAX_NO_VALS]=
-{
- {2,6,0,0},
- {8,0,0,0},
- {4,4,0,0},
- {1,7,0,0},
- {1,7,0,0},
- {6,2,0,0},
- {1,2,5,0},
- {2,6,0,0},
- {8,0,0,0},
- {1,4,3,0},
- {2,6,0,0},
- {3,5,0,0},
- {1,7,0,0},
- {1,6,1,0},
- {2,2,4,0},
- {1,1,6,0},
- {4,4,0,0},
- {1,1,6,0},
- {2,4,2,0},
- {3,5,0,0},
- {1,3,4,0},
- {5,3,0,0},
- {1,2,5,0},
- {2,6,0,0},
- {3,2,3,0},
- {1,5,2,0},
- {1,1,1,5},
- {6,2,0,0},
- {1,3,4,0},
- {2,6,0,0},
- {1,7,0,0},
- {3,4,1,0},
- {4,4,0,0},
- {1,7,0,0},
- {1,1,3,3},
- {1,7,0,0},
- {7,1,0,0},
- {1,4,3,0},
- {2,1,5,0},
- {1,1,6,0},
- {4,2,2,0},
- {1,1,5,1},
- {1,2,1,4},
- {2,6,0,0},
- {1,2,5,0},
- {8,0,0,0},
- {1,5,2,0},
- {2,2,4,0},
- {1,2,5,0}
-}; // Q0
-
-
-const Word16 C_VQ[LATTICE_DIM+1][LATTICE_DIM+1] =
-{
- {1,0,0,0,0,0,0,0,0},
- {1,1,0,0,0,0,0,0,0},
- {1,2,1,0,0,0,0,0,0},
- {1,3,3,1,0,0,0,0,0},
- {1,4,6,4,1,0,0,0,0},
- {1,5,10,10,5,1,0,0,0},
- {1,6,15,20,15,6,1,0,0},
- {1,7,21,35,35,21,7,1,0},
- {1,8,28,56,70,56,28,8,1}
-};
-
-const Word16 C_VQ_fx[LATTICE_DIM + 1][LATTICE_DIM + 1] =
-{
- {1,0,0,0,0,0,0,0,0},
- {1,1,0,0,0,0,0,0,0},
- {1,2,1,0,0,0,0,0,0},
- {1,3,3,1,0,0,0,0,0},
- {1,4,6,4,1,0,0,0,0},
- {1,5,10,10,5,1,0,0,0},
- {1,6,15,20,15,6,1,0,0},
- {1,7,21,35,35,21,7,1,0},
- {1,8,28,56,70,56,28,8,1}
-}; // Q0
-
-const UWord32 table_no_cv[] = //Q0
-{
- 0, 112, 240, 1360, 1376, 2400, 4192, 5536, 9120, 9376, 18336, 18448, 25616, 26640, 33808, 40528, 40752,
- 49712, 56880, 83760, 84208, 88688, 95856, 117360, 124528, 142448, 153200, 155888, 159472, 195312, 198896, 199920, 235760, 236880,
- 238928, 274768, 274784, 275808, 311648, 333152, 340320, 367200, 410208, 423648, 423760, 425104, 425232, 446736, 500496, 522000, 0
-};
-//Q0
-const Word32 table_no_cv_fx[] = { 0, 112, 240, 1360, 1376, 2400, 4192, 5536, 9120, 9376, 18336, 18448, 25616, 26640, 33808, 40528, 40752,
- 49712, 56880, 83760, 84208, 88688, 95856, 117360, 124528, 142448, 153200, 155888, 159472, 195312, 198896, 199920,
- 235760, 236880, 238928, 274768, 274784, 275808, 311648, 333152, 340320, 367200, 410208, 423648,423760, 425104, 425232, 446736, 500496, 522000
- ,0
-}; // Q0
-
-
-const Word16 pi0[] =
-{
- 28,1,70,8,8,28,168,28,1,280,28,56,8,56,420,56, 70, 56,420, 56, 280, 56, 168, 28, 560, 168,336,28,280,28,8,
- 280,70, 8, 1120, 8, 8, 280, 168, 56, 420, 336, 840, 28, 168, 1, 168, 420, 168
-}; // Q0
-
-const Word16 pl_HQ_fx[] = /* Q1 vectors in first layers */
-{
- 2, 2, 0, 0, 0, 0, 0, 0, /* 112, 4, 28 */
- 1, 1, 1, 1, 1, 1, 1, 1, /* 128, 128, 1 */
- 2, 2, 2, 2, 0, 0, 0, 0, /* 1120, 16, 70 */
- 4, 0, 0, 0, 0, 0, 0, 0, /* 16 , 2, 8 */
- 3, 1, 1, 1, 1, 1, 1, 1, /* 5 */ /* 1024,128, 8 */
- 2, 2, 2, 2, 2, 2, 0, 0, /* 1792, 64, 28 */
- 4, 2, 2, 0, 0, 0, 0, 0, /* 1344, 8, 168 */
- 3, 3, 1, 1, 1, 1, 1, 1, /* 3584, 128, 28*/
- 2, 2, 2, 2, 2, 2, 2, 2, /*256, 256, 1*/
- 4, 2, 2, 2, 2, 0, 0, 0, /* 10 */ /* 8960, 32, 280 */
- 4, 4, 0, 0, 0, 0, 0, 0, /* 112, 4, 28 */
- 3, 3, 3, 1, 1, 1, 1, 1, /* 7168, 128, 56 */
- 5, 1, 1, 1, 1, 1, 1, 1, /* 1024, 128, 8*/
- 4, 2, 2, 2, 2, 2, 2, 0, /* 7168, 128, 56*/
- 4, 4, 2, 2, 0, 0, 0, 0, /* 15 */ /* 6720, 16, 420 */
- 6, 2, 0, 0, 0, 0, 0, 0, /* 224, 4, 56 */
- 3, 3, 3, 3, 1, 1, 1, 1, /* 8960, 128, 70 */
- 5, 3, 1, 1, 1, 1, 1, 1, /* 7168, 128, 56*/
- 4, 4, 2, 2, 2, 2, 0, 0, /* 26880, 64, 420 */
- 4, 4, 4, 0, 0, 0, 0, 0, /*20 */ /* 448, 8, 56 */
- 6, 2, 2, 2, 0, 0, 0, 0, /* 4480, 16, 280 */
- 3, 3, 3, 3, 3, 1, 1, 1, /* 7168, 128, 56 */
- 5, 3, 3, 1, 1, 1, 1, 1, /* 21504, 128, 168 */
- 4, 4, 2, 2, 2, 2, 2, 2, /* 7168, 256, 28 */
- 4, 4, 4, 2, 2, 0, 0, 0, /* 25 */ /* 17920, 32, 560 */
- 6, 2, 2, 2, 2, 2, 0, 0, /* 10752, 64, 168 */
- 6, 4, 2, 0, 0, 0, 0, 0, /* 2688, 8, 336 */
- 3, 3, 3, 3, 3, 3, 1, 1, /* 3584, 128, 28 */
- 5, 3, 3, 3, 1, 1, 1, 1, /* 35840,128,280*/
- 5, 5, 1, 1, 1, 1, 1, 1, /*30 */ /* 3584, 128, 28*/
- 7, 1, 1, 1, 1, 1, 1, 1, /* 1024,128, 8 */
- 4, 4, 4, 2, 2, 2, 2, 0,
- 4, 4, 4, 4, 0, 0, 0, 0,
- 6, 2, 2, 2, 2, 2, 2, 2,
- 6, 4, 2, 2, 2, 0, 0, 0,
- 8, 0, 0, 0, 0, 0, 0, 0,
- 3, 3, 3, 3, 3, 3, 3, 1,
- 5, 3, 3, 3, 3, 1, 1, 1,
- 5, 5, 3, 1, 1, 1, 1, 1,
- 7, 3, 1, 1, 1, 1, 1, 1,
- 4, 4, 4, 4, 2, 2, 0, 0,
- 6, 4, 2, 2, 2, 2, 2, 0,
- 6, 4, 4, 2, 0, 0, 0, 0,
- 6, 6, 0, 0, 0, 0, 0, 0,
- 8, 2, 2, 0, 0, 0, 0, 0,
- 3, 3, 3, 3, 3, 3, 3, 3,
- 5, 3, 3, 3, 3, 3, 1, 1,
- 5, 5, 3, 3, 1, 1, 1, 1,
- 7, 3, 3, 1, 1, 1, 1, 1
-};
-/*----------------------------------------------------------------------------------*
- * LSF quantization for CNG
- *----------------------------------------------------------------------------------*/
-
-const Word16 cng_sort[] = {/*5f */1,1,0,1,0,0, /* 4f */0,1,0,1,0,0,1,1,1,1}; // Q0
-
-
-const Word16 perm_MSLVQ[][4] =
-{
- /* 5f*/
- {6,11,7,15},
- {6,15,-1,0},
- {5,8,7,15},
- {7,10,-1,0},
- {-1,0,0,0},
- {-1,0,0,0},
- /* 4f */
- {-1,0,0,0},
- {0,9,7,10},
- {-1,0,0,0},
- {7,15,-1,0},
- {-1,0,0,0},
- {-1,0,0,0},
- {6,10,7,11},
- {6,11,7,12},
- {6,11,7,12},
- {6,11,7,12}
-}; // Q0
-
-const Word16 pl_par[] = /* 1 if even number of signs */
-{
- 0, 1, 0, 0, -1, 0, 0, 1, 0, 0,
- 0, -1, 1, 0, 0, 0, 1, -1, 0, 0,
- 0, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0,
- 0, 0, 0, 0, -1, 1, -1, 1, 0, 0, 0, 0, 0, 1, -1, 1, -1
-}; // Q0
-
-const Word16 scales_fx[][6] =//Q11
-{
- {3129, 0, 0, 3138, 0, 0, }, /* 14 */
- {3287, 0, 0, 3138, 0, 0, }, /* 15 */
- {2611, 5034, 0, 3138, 0, 0, },
- {2611, 5034, 0, 3340, 0, 0, },
- {2165, 3674, 5931, 2363, 3809, 6281, },
- {1898, 2986, 4745, 2116, 3668, 7045, }, /* 28 */ /* mode 0 UV WB*/
- {2630, 5480, 0, 2972, 0, 0, },
- {2802, 0, 0, 2869, 5073, 0, },
- {1763, 2546, 3723, 2515, 4559, 21109, },
- {2195, 3961, 7440, 2501, 6017, 21961, },
- {1841, 2902, 1386, 2116, 3762, 22309, },
- {1700, 2710, 1288, 1866, 3246, 20660, }, /* 32 */ /* mode 1 UV NB*/
-
-
- {3222, 0, 0, 3391, 0, 0, },
- {2537, 4923, 0, 3187, 0, 0, },
- {2161, 3482, 9091, 3391, 0, 0, },
- {2560, 4923, 8462, 2775, 4835, 0, },
- {2163, 3656, 9263, 2699, 5296, 0, },
- {2040, 3082, 6871, 2427, 3637, 5587, },
- {1903, 2841, 6875, 2212, 3484, 5908, },
- {1888, 3058, 6900, 2212, 3484, 5908, },
- {1888, 3058, 6900, 2183, 3469, 6420, },
- {1888, 3058, 6900, 1970, 3174, 8081, },
- {1528, 2269, 5876, 1964, 3033, 8002, },
- {1577, 2445, 5782, 1858, 2871, 4334, },
-
- {1532, 2259, 5870, 2421, 1661, 6824, }, /* 34 */
-
- {1386, 1972, 4356, 1487, 2216, 4514, }, /* 37 */ /* mode 2 V WB*/
- {3357, 0, 0, 2494, 4426, 0, },
- {2634, 5009, 0, 2888, 0, 0, },
- {2224, 3539, 7696, 2494, 4426, 0, },
- {2120, 3226, 9861, 2494, 4426, 0, },
- {1974, 3140, 10121, 2494, 4426, 0, },
- {1722, 2454, 4059, 2494, 4426, 0, },
- {1839, 2658, 4473, 2490, 5456, 0, },
- {1722, 2533, 4581, 2038, 3394, 5808, },
-
- {1427, 2009, 4184, 1915, 3082, 1350, },
- {1370, 1862, 2720, 2017, 1339, 3914, }, /* 37 */ /* mode 3 V NB */
-
- {2482, 3885, 0, 0, 0, 0, },
- {3346, 0, 0, 3418, 0, 0, },
- {2638, 4962, 0, 3418, 0, 0, },
- {2482, 3885, 0, 3418, 0, 0, },
- {2218, 3617, 6502, 3418, 0, 0, },
- {2124, 3295, 8659, 3418, 0, 0, },
- {2243, 3398, 5562, 2693, 5132, 0, },
- {1927, 2839, 4549, 2693, 5132, 0, },
- {1860, 2675, 3893, 2703, 5372, 0, },
- {2202, 3619, 1618, 2703, 5372, 0, },
- {2093, 3135, 1554, 2273, 3594, 5313, },
- {2202, 3619, 1618, 2238, 3895, 6173, },
- {1829, 3015, 1382, 2259, 3625, 5820, },
- {1864, 3170, 1403, 2114, 3381, 5147, },
- {1692, 2572, 1294, 2009, 3158, 4540, }, /* 32 (31.995) */ /* G WB*/
- {2425, 3707, 5655, 0, 0, 0, },
- {3299, 0, 0, 3314, 0, 0, },
- {2425, 3707, 5655, 3174, 0, 0, },
- {2425, 3707, 5655, 3314, 0, 0, },
- {2177, 3557, 6113, 3314, 0, 0, },
- {2208, 3738, 6476, 3009, 4606, 0, },
- {2816, 1874, 4264, 3009, 4606, 0, },
- {1966, 2914, 1434, 2683, 4366, 0, },
- {2302, 1626, 3895, 2628, 4714, 0, },
- {2206, 3537, 1571, 2560, 3996, 6105, },
- {1911, 3013, 1403, 2560, 3996, 6105, },
- {1898, 3277, 1380, 2363, 3637, 5845, },
- {2144, 1479, 3656, 2163, 3363, 5532, },
- {1989, 1409, 3090, 2136, 3543, 6003, },
- {1882, 1356, 2800, 2165, 3703, 6285, }, /* 32 (31.987) */ /* G NB*/
- {3312, 0, 0, 3394, 0, 0, },
- {2611, 4706, 0, 3201, 0, 0, },
- {2679, 4821, 0, 2841, 0, 0, },
- {2644, 4952, 0, 2775, 5003, 0, },
- {2210, 3623, 6169, 2841, 0, 0, },
- {2210, 3623, 6169, 2714, 5233, 0, },
- {1837, 2744, 5333, 2191, 3459, 5175, },
- {1837, 2744, 5333, 1923, 2978, 4266, },
- {1853, 2718, 5323, 2271, 1591, 3492, },
- {1561, 2255, 4831, 1923, 2978, 4266, },
- {1626, 2511, 6513, 2271, 1591, 3492, }, /* 33 */
- /* mode 6 T WB */
- {3336, 0, 0, 2439, 4528, 0, },
- {2615, 5237, 0, 2800, 0, 0, },
- {2216, 3607, 8047, 2439, 4528, 0, },
- {2085, 3144, 5751, 2439, 4528, 0, },
- {1933, 3025, 5659, 2439, 4528, 0, },
- {1864, 3572, 6793, 2439, 4528, 0, },
- {1884, 3375, 6283, 1985, 3447, 8096, },
- {1513, 2275, 5517, 1800, 2890, 4721, },
- {1452, 2114, 5564, 1659, 2550, 3736, }, /* 32 */ /* mode 7 T NB */
-
- {1552, 2286, 4022, 2497, 4139, 1634,},
- {1432, 2118, 4051, 2497, 4139, 1634, }, /* 32 */ /* mode 8 G 16k */
-
- {1487, 2150, 3779, 2775, 1761, 4516, },
- {1386, 2042, 3418, 2775, 1761, 4516, }, /* 33 (32.983) */ /* T 16k */
-
- {3371, 0, 0, 2568, 5036, 0, },
- {2198, 3815, 6617, 3437, 0, 0, },
- {2198, 3815, 6617, 2568, 5036, 0, },
- {1948, 3056, 5112, 2570, 6085, 0, },
- {2351, 3770, 1665, 2570, 6085, 0, }, /* 26 */
- {1233, 1780, 2904, 2589, 1565, 4542, }, /* 36 */ /* mode 10 AUDIO_WB 36 + 4 + 1 */
-
- {1747, 3623, 9062, 0, 0, 0, },
- {2071, 3406, 9017, 3232, 0, 0, },
- {2071, 3406, 9017, 2462, 4964, 0, },
- {1804, 3314, 8471, 2462, 4964, 0, },
- {1735, 3668, 9146, 2462, 4964, 0, }, /* 27 */ /* AUDIO_NB */
- {1372, 2277, 4893, 2462, 4964, 0, }, /* 28 */ /* AUDIO_NB */
- {2316, 3717, 1630, 2591, 5722, 0, },
- {1167, 1647, 2451, 2380, 3992, 1491, }, /* 36 */ /* mode 12 AUDIO_WB 16k 15-36 + 4 + 1*/
- {2140, 3248, 7688, 3418, 0, 0, },
- {1802, 2621, 5784, 2251, 3553, 0, },
- {1702, 2488, 5994, 2230, 3498, 5077, },
- {1782, 2718, 5951, 2183, 3521, 5480, },
-
- {1581, 2298, 4815, 2961, 1933, 4243, },
-
- {1436, 2001, 3559, 1939, 2976, 4264, },
-
- {1473, 2091, 3484, 2292, 1626, 3473, },
-
- {1311, 1810, 3547, 1546, 2232, 3170, }, /* 37 (36.995) */ /* VOICED 16k */
- {2494, 1630, 4676, 2642, 6810, 0, },
- {3256, 1710, 9085, 2247, 6287, 0, },
-
- {2036, 5360, 0, 2234, 4573, 7080, },
- {1817, 3222, 7256, 2228, 3742, 6281, },
- {1714, 2535, 3897, 2658, 5728, 0, },
- {2331, 5788, 0, 2265, 5726, 8993, },
- {1927, 3955, 9161, 1395, 2593, 4768, },
- {2769, 8872, 0, 1679, 3164, 8550, },
- {2750, 7387, 0, 1759, 2976, 5304, },
- {2474, 5612, 0, 1554, 2540, 4469, },
- {2300, 5603, 0, 1790, 3068, 5296, },
- {1882, 5061, 0, 1260, 2195, 4293, },
- {3170, 9232, 0, 1690, 4461, 8817, },
- {2492, 5935, 0, 1509, 2492, 3953, },
-
- {1999, 4485, 11706, 3084, 1315, 8624, },
- {2267, 5315, 0, 2666, 1237, 1802}, /* CNG */
-
-};/* An 6-by-146 matrix in Scale = 2048.00f */
-
-const Word16 scales_p_fx[][6] =
-{//Q11
- {2998, 4862, 0, 0, 0, 0, },
- {2591, 5251, 0, 3355, 0, 0, },
- {2177, 3488, 5745, 2650, 4819, 0, },
- {2177, 3926, 6273, 2796, 0, 0, },
- {1872, 2892, 4553, 2650, 4819, 0, },
- {1806, 2869, 4919, 2689, 4999, 0, },
- {2777, 1776, 4868, 2191, 3453, 5214, },
- {1733, 2761, 5214, 2204, 3568, 5444, },
- {1731, 2824, 5255, 2087, 3230, 5003, },
- {1548, 2435, 5732, 2220, 3695, 5648, },
- {1546, 2494, 5777, 1933, 2935, 4041, },
- {1483, 2529, 6025, 2570, 1737, 4096, },
- {1407, 2279, 4788, 1747, 2720, 3981, },
- {1327, 2107, 3760, 1749, 2777, 4016, },
- {1327, 2107, 3760, 1407, 2167, 3891, }, /* 39 (38.488) */ /* V WB*/ /* 14 */
- {3303, 0, 0, 0, 0, 0, },
- {2595, 5069, 0, 3316, 0, 0, },
- {2077, 3338, 5046, 2632, 4405, 0, },
- {1829, 2847, 4739, 3000, 4708, 0, },
- {1905, 2869, 4403, 2621, 4616, 0, },
- {1829, 2847, 4739, 2613, 4518, 6111, },
- {1829, 2847, 4739, 2122, 3371, 5061, },
- {1755, 2738, 5046, 2136, 3543, 5376, },
- {1567, 2497, 3181, 2122, 3371, 5061, },
- {1616, 2720, 3383, 2154, 3654, 5542, },
- {1565, 2507, 3185, 1884, 2955, 4168, },
- {1358, 2173, 2535, 2824, 1839, 3996, },
- {1378, 2261, 2675, 2578, 1696, 4002, },
- {1364, 2193, 2558, 1645, 2542, 3541, },
- {1348, 2128, 2486, 1946, 1333, 2927, }, /* 39 (38.512) */ /* V NB*/ /* 29 */
- {3277, 0, 0, 3181, 0, 0, },
- {2322, 4067, 6748, 3181, 0, 0, },
- {2021, 3662, 5446, 3373, 0, 0, },
- {1841, 3281, 5282, 3373, 0, 0, },
- {1632, 2650, 4383, 3373, 0, 0, },
- {1632, 2650, 4383, 2734, 4557, 0, },
- {1518, 2357, 3719, 2734, 4557, 0, },
- {1632, 2650, 4383, 2429, 3957, 0, },
- {1518, 2357, 3719, 2384, 3734, 5671, },
- {1450, 2306, 4000, 2204, 3543, 5687, },
- {1352, 2148, 3217, 2204, 3543, 5687, },
- {1356, 2101, 3183, 2200, 3918, 6189, },
- {1352, 2148, 3217, 2947, 1896, 4364, },
- {1290, 1978, 3117, 2687, 1804, 4520, },
- {1264, 1886, 2963, 2114, 3172, 1548, }, /* 35 (34.994) */ /* G WB*/ /* 44 */
- {3267, 0, 0, 3076, 0, 0, },
- {2300, 3985, 7643, 3076, 0, 0, },
- {2116, 4250, 8886, 2906, 5009, 0, },
- {2017, 3672, 12216, 2623, 4760, 0, },
- {1804, 3289, 14326, 2906, 5009, 0, },
- {1729, 3240, 14377, 2623, 4760, 0, },
- {1616, 3113, 14752, 2623, 4760, 0, },
- {1780, 3168, 14326, 2109, 3592, 6353, },
- {1673, 3056, 14582, 2109, 3592, 6353, },
- {1546, 2830, 14608, 2109, 3592, 6353, },
- {1446, 2693, 14797, 2109, 3592, 6353, },
- {1411, 2654, 14930, 2081, 3840, 6633, },
- {1430, 2611, 14764, 1872, 3170, 4983, },
- {1391, 2693, 14930, 2517, 3779, 1665, },
- {1391, 2693, 14930, 2433, 1581, 4004, }, /* 35 (34.952) */ /* G NB*/ /* 59 */
-
- {2070, 3639, 5652, 3305, 0,0,},
- {1747, 2830, 4231, 2550, 5487, 0,},
- {2472, 1593, 4522, 2550, 5487, 0,},
- {2472, 1593, 4522, 2075, 3752, 6253},
- {2472, 1593, 4522, 2908, 1786, 4772,},
- {1075, 1577, 2198, 1669, 2533, 1161}, /* 40 (39.990) */ /* AUDIO_WB */ /* 65 */
-
- {2191, 3668, 7993, 3275, 0, 0, },
- {1679, 2492, 4278, 2570, 4690, 0, },
- {1597, 2394, 5110, 2570, 4690, 0, },
- {2202, 1481, 4835, 2273, 4016, 7150, },
-
- {1415, 2107, 4786, 2118, 3668, 8200, }, /* 31 */ /*AUDIO_NB */ /* 70 */
- {1374, 2204, 5337, 1956, 3168, 5149, }, /* 32 */ /*AUDIO_NB */ /* 71 */
- {2425, 4336, 1589,3420, 2165, 1380, },
- {1067, 1530, 2116, 1630, 2730, 1110,}, /* 40 */ /* mode AUDIO_WB 16k */ /* 73*/
-
- {3439, 0, 0, 2626, 5061, 0, },
- {2228, 3787, 6543, 3455, 0, 0, },
- {2228, 3787, 6543, 2626, 5061, 0, },
- {2306, 3459, 1618, 2626, 5061, 0, },
- {1905, 2830, 1397, 2626, 5061, 0, },
- {2284, 1626, 3793, 2623, 6212, 0, },
- {1720, 2818, 1276, 1638, 2900, 8724, }, /* 36 (35.998) */ /* INACTIVE NB */
- {1640, 2351, 3690, 0, 0, 0, },
- {2230, 3711, 6496, 3434, 0, 0, },
- {2230, 3899, 6597, 3115, 5396, 0, },
- {1731, 2482, 3961, 2689, 4954, 0, },
- {1595, 2243, 3482, 2689, 4954, 0, },
- {1481, 2079, 3408, 2689, 4954, 0, },
- {1829, 1335, 2945, 2204, 1475, 3674, }, /* 36 (35.929) */ /* INACTIVE WB*/
- {2783, 4723, 0, 3418, 0, 0, },
- {2206, 3946, 7262, 3418, 0, 0, },
- {2206, 4162, 7328, 2927, 5552, 0, },
- {1706, 2566, 4311, 2628, 5235, 0, },
- {1589, 2359, 3805, 2628, 5235, 0, },
- {1473, 2183, 3547, 2628, 5235, 0, },
- {1927, 1333, 3205, 1479, 2437, 3973, }, /* 36 (35.915) */ /* INACTIVE 16k*/
-
- {2646, 5077, 0, 3156, 0, 0, },
- {2462, 3897, 0, 3156, 0, 0, },
- {2105, 3361, 5028, 3375, 0, 0, },
- {2554, 1798, 4770, 3375, 0, 0, },
- {1767, 2781, 5165, 3375, 0, 0, },
- {1673, 2503, 4116, 2200, 3656, 5597, },
- {1669, 1253, 2623, 2161, 3531, 6046, }, /* 32 (31.990) */ /* UNVOICED NB*/
-
- {3164, 0, 0, 3170, 0, 0, },
- {3359, 0, 0, 3170, 0, 0, },
- {2636, 5630, 0, 3170, 0, 0, },
- {2636, 5630, 0, 3387, 0, 0, },
- {2437, 4149, 0, 3387, 0, 0, },
- {1907, 2986, 5018, 2650, 5616, 0, },
- {1796, 2859, 5605, 2214, 3719, 6881, }, /* 28 (27.996) */ /* UNVOICED WB */
- {2316, 3351, 0, 2808, 0, 0, },
- {1913, 2615, 1491, 2370, 3475, 0, },
- {1706, 2380, 1348, 2357, 3455, 0, },
- {1538, 2114, 1225, 2357, 3455, 0, },
- {1452, 2058, 1167, 2171, 3629, 5569, },
- {1528, 2050, 1231, 2056, 3693, 5923, },
- {1522, 2048, 1227, 1917, 3811, 5886, },
- {1587, 1257, 2124, 1630, 2671, 3901, }, /* 39 (38.301) */ /* VOICED 16k */
- {1831, 2742, 5220, 2679, 5327, 0, },
- {1475, 2073, 3273, 3097, 1896, 4377, },
- {1395, 1993, 3377, 2828, 1794, 4360, },
- {1401, 1974, 3359, 2392, 3637, 1612, },
- {1368, 1915, 3176, 2081, 3109, 1458, },
- {1350, 1866, 2918, 2738, 1821, 1315, },
- {1350, 1866, 2918, 1718, 2636, 1243, }, /* 37 (36.989) */ /* GENERIC 16k*/
- {3344, 0, 0, 3455, 0, 0, },
- {2204, 3666, 6025, 3455, 0, 0, },
- {1708, 2517, 3871, 3455, 0, 0, },
- {1921, 2875, 4409, 2675, 5386, 0, },
- {2744, 1815, 4751, 2675, 5386, 0, },
- {1706, 2560, 3908, 2675, 5386, 0, },
- {1706, 2484, 3836, 2304, 3766, 5773, },
- {1567, 2380, 3461, 2097, 3559, 5812, },
- {1485, 2150, 3668, 3031, 1888, 6357, },
- {1458, 2073, 3172, 3060, 1849, 6889, },
- {1350, 1898, 2779, 3060, 1849, 6889, },
- {1683, 1257, 2638, 1864, 3090, 4618, },
- {1722, 1278, 2617, 2378, 1561, 3703, },
- {1716, 1274, 2593, 2212, 1456, 3502, },
- {1704, 1268, 2611, 1921, 2929, 1319, }, /* 37 (36.971) */ /* GENERIC 12.8k MA*/
- {1810, 2763, 5263, 2691, 5343, 0, },
- {1456, 2085, 3308, 3035, 1886, 7027, },
-
- {1391, 1995, 3398, 1942, 3172, 7062, },
-
- {1702, 1266, 3033, 1911, 3101, 4731, },
- {1671, 1249, 2871, 2920, 1796, 4639, },
- {1612, 2574, 1221, 1759, 2963, 4979, },
- {1612, 2574, 1221, 2265, 1505, 3398}, /* 37 (36.993) */ /* AUDIO 16k */
-
-};
-
-const Word16 sigma_MSLVQ_fx[][16] =
-{//Qlog2(2.56)
- {3},
- {3},
- {107, 113, 160, 185, 202, 211, 219, 222, 222, 217, 218, 270, 327, 176, 66, 43},
- {125, 130, 182, 185, 191, 199, 204, 207, 205, 191, 179, 227, 305, 261, 95, 64},
- {123, 123, 176, 197, 207, 218, 228, 235, 232, 218, 209, 272, 342, 216, 89, 68},
- {219, 212, 255, 271, 273, 274, 260, 255, 250, 248, 249, 302, 328, 394, 85, 37},
- {3},
- {3},
- {113, 134, 220, 253, 260, 275, 274, 287, 304, 323, 321, 325, 349, 350, 376, 332},
- {158, 179, 242, 248, 246, 259, 257, 267, 278, 274, 276, 289, 309, 309, 312, 306},
- {146, 146, 222, 256, 261, 278, 290, 302, 318, 313, 323, 352, 394, 407, 415, 399},
- {217, 227, 287, 303, 316, 310, 296, 304, 303, 305, 317, 327, 355, 321, 305, 279},
- {3},
- {3},
- {193, 216, 283, 320, 343, 359, 375, 408, 413, 445, 479, 489, 502, 466, 456, 479},
- {230, 238, 312, 330, 334, 329, 339, 357, 353, 358, 391, 403, 441, 459, 379, 497},
- {231, 277, 304, 322, 347, 353, 366, 372, 373, 397, 438, 451, 424, 413, 381, 447},
- {264, 287, 364, 386, 384, 373, 382, 373, 393, 403, 448, 438, 403, 430, 401, 586},
- {224, 298, 262, 264, 258, 244, 260, 283, 313, 295, 275, 279, 260, 286, 286, 399},
- {411, 314, 301, 332, 335, 343, 356, 409, 430, 413, 363, 364, 338, 332, 315, 412},
- {136, 269, 343, 367, 405, 430, 411, 421, 444, 466, 435, 423, 328, 247, 235, 240},
- {178, 433, 305, 268, 258, 252, 253, 246, 250, 250, 245, 256, 242, 273, 300, 371},
- {349, 334, 335, 341, 336, 331, 343, 425, 505, 722, 783, 655,1006, 862, 346, 248},
- {315, 306, 323, 306, 300, 278, 276, 287, 380, 394, 327, 333, 339, 382, 370, 626},
- {236, 250, 241, 231, 241, 245, 238, 221, 215, 190, 181, 178, 183, 428, 184, 55},
- {113, 189, 360, 312, 332, 326, 296, 268, 272, 282, 320, 275, 219, 203, 179, 143},
- {273, 255, 245, 237, 242, 236, 214, 217, 223, 260, 233, 193, 187, 183, 174, 163},
- {111, 321, 275, 219, 213, 207, 202, 205, 205, 225, 239, 208, 192, 187, 168, 152},
- {383, 326, 300, 287, 290, 292, 276, 251, 258, 291, 430, 521, 397, 305, 274, 269},
- {152, 221, 271, 291, 344, 310, 308, 257, 252, 256, 339, 491, 499, 199, 179, 107},
- {226, 237, 236, 239, 250, 238, 228, 223, 227, 241, 311, 312, 299, 313, 421, 360},
- {221, 238, 214, 220, 246, 244, 232, 221, 210, 208, 200, 229, 368, 431, 106, 71},
- {249, 259, 267, 283, 278, 275, 251, 237, 203, 209, 198, 279, 543, 509, 122, 90},
- {192, 249, 256, 235, 231, 230, 213, 215, 210, 247, 284, 237, 214, 210, 199, 181},
-};
-
-/* An 16-by-33 matrix in Scale = 32768.00f */
-const Word16 inv_sigma_MSLVQ_fx[][16] =//Q15
-{
- {32767},
- {32767},
- {783, 746, 523, 453, 416, 397, 384, 378, 378, 386, 384, 310, 256, 477, 1273, 1935},
- {670, 647, 461, 452, 440, 421, 412, 405, 410, 440, 468, 369, 275, 321, 883, 1305},
- {679, 682, 477, 426, 405, 385, 368, 357, 362, 385, 401, 308, 245, 388, 942, 1231},
- {383, 395, 329, 309, 307, 307, 322, 329, 335, 338, 337, 278, 256, 213, 989, 2243},
- {32767},
- {32767},
- {740, 628, 382, 332, 322, 305, 306, 292, 276, 259, 261, 258, 240, 240, 223, 253},
- {530, 469, 346, 338, 341, 323, 326, 314, 302, 306, 304, 290, 271, 272, 269, 274},
- {576, 576, 378, 327, 322, 302, 289, 278, 264, 268, 259, 238, 213, 206, 202, 210},
- {386, 370, 292, 277, 266, 271, 284, 276, 276, 275, 264, 257, 236, 262, 275, 300},
- {32767},
- {32767},
- {435, 389, 296, 262, 244, 233, 223, 205, 203, 188, 175, 172, 167, 180, 184, 175},
- {365, 352, 268, 254, 251, 255, 247, 235, 237, 234, 214, 208, 190, 183, 221, 169},
- {363, 302, 276, 261, 241, 237, 229, 226, 225, 211, 191, 186, 198, 203, 220, 188},
- {318, 292, 230, 218, 218, 225, 219, 225, 213, 208, 187, 192, 208, 195, 209, 143},
- {374, 281, 320, 318, 325, 344, 322, 296, 268, 284, 305, 301, 322, 294, 293, 210},
- {204, 267, 279, 253, 250, 245, 235, 205, 195, 203, 231, 231, 248, 252, 266, 204},
- {616, 312, 245, 229, 207, 195, 204, 199, 189, 180, 193, 198, 256, 340, 356, 349},
- {471, 194, 275, 313, 325, 333, 332, 342, 335, 336, 342, 328, 347, 307, 280, 226},
- {241, 251, 250, 246, 250, 254, 245, 197, 166, 116, 107, 128, 83, 97, 242, 339},
- {266, 274, 259, 274, 279, 302, 304, 292, 221, 213, 257, 252, 247, 219, 227, 134},
- {355, 336, 348, 363, 348, 342, 353, 379, 391, 442, 462, 472, 458, 196, 456,1518},
- {744, 443, 233, 269, 253, 257, 283, 313, 308, 298, 262, 305, 383, 413, 469, 585},
- {308, 330, 343, 353, 347, 356, 392, 387, 376, 322, 359, 435, 448, 458, 482, 514},
- {756, 261, 305, 384, 394, 406, 415, 409, 409, 372, 352, 403, 438, 448, 498, 552},
- {219, 257, 280, 293, 289, 288, 304, 335, 325, 289, 195, 161, 211, 275, 306, 312},
- {550, 380, 309, 288, 244, 271, 272, 326, 332, 328, 248, 171, 168, 421, 468, 781},
- {371, 355, 356, 350, 336, 353, 368, 376, 369, 348, 269, 269, 281, 268, 199, 233},
- {380, 353, 392, 381, 342, 344, 362, 379, 399, 403, 420, 367, 228, 195, 789,1184},
- {337, 324, 314, 297, 301, 305, 335, 354, 414, 401, 425, 301, 154, 165, 690, 927},
- {438, 337, 327, 357, 363, 365, 394, 390, 400, 340, 295, 354, 392, 399, 421, 462},
-};
-
-/* An 16-by-19 matrix in Scale = 32768.00f */
-const Word16 inv_sigma_p_fx[][16] =//Q15
-{
- {552, 513, 469, 494, 486, 478, 492, 496, 496, 482, 480, 388, 339, 276, 743, 760},
- {640, 492, 472, 478, 482, 471, 470, 471, 623, 504, 501, 477, 459, 425, 421, 408},
- {1001, 939, 696, 589, 545, 480, 456, 451, 444, 462, 472, 424, 342, 441, 1567, 3002},
- {609, 534, 419, 432, 444, 403, 406, 407, 391, 425, 452, 378, 269, 278, 818, 1939},
- {32767},
- {574, 507, 459, 432, 425, 415, 440, 442, 449, 450, 490, 443, 299, 270, 1377, 2451},
- {591, 499, 456, 457, 449, 441, 448, 446, 443, 436, 420, 397, 364, 342, 496, 475},
- {482, 512, 498, 426, 280, 225, 422, 1411, 404, 404, 402, 385, 364, 342, 355, 361},
- {917, 831, 572, 507, 482, 430, 406, 399, 385, 365, 364, 344, 313, 309, 311, 335},
- {533, 436, 371, 399, 398, 368, 367, 348, 343, 342, 338, 319, 306, 305, 311, 334},
- {32767},
- {641, 523, 458, 434, 415, 410, 412, 395, 397, 394, 386, 381, 366, 392, 413, 419},
- {449, 380, 364, 366, 354, 362, 362, 356, 337, 323, 293, 296, 336, 352, 353, 283},
- {32767},
- {601, 485, 348, 262, 267, 266, 276, 285, 255, 233, 227, 235, 216, 237, 233, 212},
- {338, 279, 247, 244, 233, 239, 231, 232, 228, 215, 194, 194, 207, 210, 222, 180},
- {32767},
- {594, 466, 394, 376, 362, 358, 346, 350, 336, 332, 313, 329, 343, 358, 370, 419},
- {471, 409, 323, 325, 308, 295, 305, 290, 281, 280, 271, 262, 251, 255, 266, 312},
-};
-
-const Word16 sigma_p_fx[][16] =
-{//Qlog2(2.56)
- {152, 164, 179, 170, 172, 176, 171, 169, 169, 174, 175, 216, 247, 304, 113, 110},
- {131, 171, 178, 176, 174, 178, 178, 178, 135, 166, 167, 176, 183, 197, 199, 206},
- {84, 89, 120, 142, 154, 175, 184, 186, 189, 181, 178, 198, 245, 190, 54, 28},
- {138, 157, 200, 194, 189, 208, 207, 206, 214, 197, 186, 222, 311, 302, 103, 43},
- {3},
- {146, 165, 183, 194, 197, 202, 191, 190, 187, 186, 171, 189, 281, 311, 61, 34},
- {142, 168, 184, 183, 187, 190, 187, 188, 189, 193, 200, 212, 231, 245, 169, 177},
- {174, 164, 168, 197, 300, 372, 199, 59, 208, 208, 209, 218, 231, 246, 237, 232},
- {91, 101, 147, 165, 174, 195, 207, 210, 218, 230, 230, 244, 268, 272, 269, 250},
- {157, 192, 226, 210, 211, 228, 228, 241, 245, 246, 248, 263, 274, 275, 270, 251},
- {3},
- {131, 160, 183, 193, 202, 205, 203, 212, 212, 213, 217, 220, 229, 214, 203, 200},
- {187, 221, 231, 229, 237, 232, 232, 236, 249, 259, 286, 284, 250, 238, 238, 296},
- {3},
- {140, 173, 241, 320, 314, 315, 304, 295, 329, 359, 369, 357, 388, 354, 359, 396},
- {248, 300, 339, 344, 360, 350, 363, 361, 368, 391, 431, 433, 406, 400, 377, 467},
- {3},
- {141, 180, 213, 223, 232, 234, 242, 240, 250, 253, 268, 255, 245, 235, 227, 200},
- {178, 205, 259, 258, 273, 285, 275, 289, 299, 300, 310, 320, 335, 329, 316, 269},
-};
-
-const Word16 sigma_p_ivas_fx[][16] =
-{//Qlog2(2.56)
- {152, 164, 179, 170, 172, 176, 171, 169, 169, 174, 175, 216, 247, 304, 113, 110},
- {131, 171, 178, 176, 174, 178, 178, 178, 135, 166, 167, 176, 183, 197, 199, 206},
- {84, 89, 120, 142, 154, 175, 184, 186, 189, 181, 178, 198, 245, 190, 54, 28},
- {138, 157, 200, 194, 189, 208, 207, 206, 214, 197, 186, 222, 311, 302, 103, 43},
- {3},
- {146, 165, 183, 194, 197, 202, 191, 190, 187, 186, 171, 189, 281, 311, 61, 34},
- {142, 168, 184, 183, 187, 190, 187, 188, 189, 193, 200, 212, 231, 245, 169, 177},
- {174, 164, 168, 197, 300, 372, 199, 59, 208, 208, 209, 218, 231, 246, 237, 232},
- {91, 101, 147, 165, 174, 195, 207, 210, 218, 230, 230, 244, 268, 272, 269, 250},
- {157, 192, 226, 210, 211, 228, 228, 241, 245, 246, 248, 263, 274, 275, 270, 251},
- {3},
- {131, 160, 183, 193, 202, 205, 203, 212, 212, 213, 217, 220, 229, 214, 203, 200},
- {187, 221, 231, 229, 237, 232, 232, 236, 249, 259, 286, 284, 250, 238, 238, 296},
- {3},
- {127, 173, 226, 217, 264, 256, 290, 295, 297, 325, 334, 326, 302, 290, 275, 254},
- {248, 300, 339, 344, 360, 350, 363, 361, 368, 391, 431, 433, 406, 400, 377, 467},
- {3},
- {141, 180, 213, 223, 232, 234, 242, 240, 250, 253, 268, 255, 245, 235, 227, 200},
- {178, 205, 259, 258, 273, 285, 275, 289, 299, 300, 310, 320, 335, 329, 316, 269},
-};
-
-const Word16 inv_sigma_p_ivas_fx[][16] =
-{//Qlog2(2.56)
- {552, 513, 470, 494, 487, 478, 492, 496, 496, 482, 480, 389, 339, 276, 743, 760},
- {640, 492, 472, 478, 482, 471, 470, 471, 623, 504, 501, 477, 459, 425, 420, 408},
- {1002, 939, 696, 589, 545, 480, 456, 450, 444, 462, 472, 424, 342, 441, 1568, 2996},
- {609, 534, 419, 432, 444, 403, 406, 407, 392, 425, 452, 378, 269, 278, 818, 1940},
- {32767},
- {575, 507, 459, 432, 425, 415, 440, 442, 449, 450, 489, 443, 299, 270, 1378, 2449},
- {591, 499, 456, 457, 449, 441, 448, 446, 444, 435, 420, 397, 364, 342, 496, 475},
- {482, 512, 498, 426, 280, 225, 422, 1410, 404, 404, 402, 385, 364, 342, 355, 361},
- {918, 832, 572, 507, 482, 430, 406, 399, 385, 366, 364, 344, 313, 309, 311, 335},
- {533, 436, 371, 399, 398, 368, 367, 348, 343, 342, 338, 319, 306, 305, 311, 334},
- {32767},
- {641, 523, 458, 434, 415, 410, 412, 395, 397, 394, 386, 380, 366, 392, 413, 419},
- {449, 380, 364, 366, 355, 362, 362, 356, 337, 323, 293, 296, 336, 352, 353, 283},
- {32767},
- {659, 486, 371, 386, 318, 328, 289, 284, 283, 258, 251, 257, 278, 290, 305, 330},
- {338, 279, 247, 244, 233, 239, 231, 232, 228, 215, 194, 194, 207, 210, 222, 180},
- {32767},
- {594, 466, 394, 376, 362, 358, 346, 350, 336, 332, 313, 329, 343, 358, 370, 419},
- {471, 409, 323, 325, 308, 295, 304, 290, 281, 280, 271, 262, 251, 255, 266, 312}
-};
-
-const Word8 leaders_short[][MAX_NO_SCALES] = // Q0
-{{ 0, 0, 0},
-{ 1, 0, 0},
-{ 15, 3, 3},
-{ 2, 2, 0},
-{ 2, 0, 0},
-{ 2, 1, 0},
-{ 4, 0, 0},
-{ 9, 7, 6},
-{ 4, 1, 0},
-{ 5, 2, 0},
-{ 6, 3, 2},
-{ 5, 3, 1},
-{ 8, 3, 0},
-{ 9, 3, 0},
-{ 2, 2, 1},
-{ 9, 8, 5},
-{ 5, 5, 0},
-{ 17, 3, 0},
-{ 5, 2, 1},
-{ 7, 3, 0},
-{ 5, 4, 0},
-{ 5, 5, 1},
-{ 2, 2, 2},
-{ 4, 2, 2},
-{ 5, 2, 2},
-{ 6, 6, 5},
-{ 5, 3, 2},
-{ 6, 3, 0},
-{ 12, 3, 2},
-{ 15, 3, 2},
-{ 19, 3, 2},
-{ 7, 6, 3},
-{ 5, 4, 2},
-{ 9, 8, 2},
-{ 6, 5, 2},
-{ 5, 4, 1},
-{ 9, 9, 3},
-{ 6, 6, 2},
-{ 8, 6, 2},
-{ 8, 7, 2},
-{ 8, 8, 2},
-{ 4, 2, 0},
-{ 11, 8, 2},
-{ 13, 11, 2},
-{ 5, 5, 2},
-{ 16, 13, 2},
-{ 13, 12, 2},
-{ 18, 17, 2},
-{ 21, 17, 2},
-{ 18, 16, 2},
-{ 32, 28, 2},
-{ 8, 8, 4},
-{ 7, 5, 2},
-{ 13, 11, 9},
-{ 38, 31, 2},
-{ 4, 4, 2},
-{ 8, 8, 3},
-{ 9, 8, 3},
-{ 8, 5, 2},
-{ 10, 9, 3},
-{ 11, 10, 3},
-{ 13, 10, 3},
-{ 22, 10, 3},
-{ 23, 10, 3},
-{ 13, 11, 3},
-{ 15, 13, 3},
-{ 35, 15, 3},
-{ 32, 16, 3},
-{ 5, 5, 4},
-{ 8, 7, 4},
-{ 33, 31, 2},
-{ 9, 9, 4},
-{ 16, 12, 4},
-{ 17, 13, 4},
-{ 5, 5, 5},
-{ 7, 5, 5},
-{ 4, 3, 2},
-{ 8, 6, 5},
-{ 9, 6, 5},
-{ 9, 7, 5},
-{ 8, 8, 5},
-{ 3, 2, 0},
-{ 10, 8, 5},
-{ 11, 8, 5},
-{ 12, 8, 5},
-{ 13, 8, 5},
-{ 16, 8, 5},
-{ 18, 8, 5},
-{ 10, 9, 5},
-{ 18, 9, 5},
-{ 23, 21, 2},
-{ 13, 8, 8},
-{ 14, 10, 5},
-{ 11, 11, 5},
-{ 13, 11, 5},
-{ 13, 13, 5},
-{ 14, 13, 5},
-{ 15, 13, 5},
-{ 16, 13, 5},
-{ 17, 13, 5},
-{ 18, 13, 5},
-{ 18, 16, 5},
-{ 18, 17, 5},
-{ 19, 18, 5},
-{ 13, 10, 5},
-{ 21, 21, 5},
-{ 23, 21, 5},
-{ 24, 21, 5},
-{ 25, 23, 5},
-{ 32, 23, 5},
-{ 11, 10, 5},
-{ 8, 8, 6},
-{ 5, 5, 7},
-{ 8, 7, 7},
-{ 8, 8, 7},
-{ 10, 8, 7},
-{ 13, 8, 7},
-{ 10, 9, 7},
-{ 13, 11, 7},
-{ 9, 8, 8},
-{ 12, 8, 8},
-{ 23, 18, 5},
-{ 9, 9, 8},
-{ 11, 9, 8},
-{ 13, 9, 8},
-{ 18, 10, 8},
-{ 26, 10, 8},
-{ 27, 10, 8},
-{ 31, 10, 8},
-{ 40, 21, 11},
-{ 13, 11, 8},
-{ 13, 12, 8},
-{ 14, 12, 8},
-{ 18, 12, 8},
-{ 13, 13, 8},
-{ 14, 13, 8},
-{ 16, 13, 8},
-{ 18, 13, 8},
-{ 18, 16, 8},
-{ 18, 17, 8},
-{ 23, 18, 8},
-{ 23, 21, 8},
-{ 24, 21, 8},
-{ 28, 23, 8},
-{ 31, 31, 8},
-{ 36, 31, 8},
-{ 38, 31, 8},
-{ 11, 9, 9},
-{ 12, 9, 9},
-{ 13, 9, 9},
-{ 12, 11, 9},
-{ 42, 31, 2},
-{ 14, 12, 9},
-{ 13, 13, 9},
-{ 14, 13, 9},
-{ 16, 13, 9},
-{ 17, 13, 9},
-{ 18, 13, 9},
-{ 18, 14, 9},
-{ 18, 18, 9},
-{ 26, 25, 9},
-{ 13, 11, 10},
-{ 18, 12, 10},
-{ 18, 13, 10},
-{ 21, 14, 10},
-{ 22, 16, 10},
-{ 18, 18, 10},
-{ 23, 18, 10},
-{ 24, 18, 10},
-{ 24, 21, 10},
-{ 23, 22, 10},
-{ 24, 23, 10},
-{ 32, 25, 10},
-{ 34, 28, 10},
-{ 42, 31, 10},
-{ 17, 11, 11},
-{ 18, 13, 11},
-{ 21, 13, 11},
-{ 18, 17, 11},
-{ 18, 18, 11},
-{ 48, 35, 24},
-{ 18, 17, 12},
-{ 18, 18, 12},
-{ 20, 18, 12},
-{ 39, 30, 12},
-{ 31, 31, 12},
-{ 43, 34, 12},
-{ 16, 13, 13},
-{ 17, 13, 13},
-{ 16, 16, 13},
-{ 18, 17, 13},
-{ 20, 18, 13},
-{ 22, 18, 13},
-{ 23, 18, 13},
-{ 22, 21, 13},
-{ 23, 23, 13},
-{ 24, 23, 13},
-{ 43, 36, 13},
-{ 43, 40, 13},
-{ 43, 41, 13},
-{ 31, 30, 18},
-{ 24, 21, 14},
-{ 31, 31, 14},
-{ 23, 18, 16},
-{ 23, 23, 16},
-{ 31, 25, 16},
-{ 31, 29, 16},
-{ 45, 35, 16},
-{ 23, 21, 17},
-{ 23, 22, 17},
-{ 23, 23, 17},
-{ 31, 31, 17},
-{ 21, 18, 18},
-{ 23, 21, 18},
-{ 23, 22, 18},
-{ 27, 23, 18},
-{ 29, 23, 18},
-{ 32, 23, 18},
-{ 31, 27, 18},
-{ 30, 28, 18},
-{ 31, 28, 18},
-{ 43, 42, 13},
-{ 31, 31, 18},
-{ 32, 31, 18},
-{ 36, 31, 18},
-{ 46, 48, 18},
-{ 46, 32, 19},
-{ 43, 38, 19},
-{ 43, 42, 19},
-{ 32, 32, 20},
-{ 27, 23, 21},
-{ 31, 23, 21},
-{ 31, 24, 21},
-{ 32, 30, 21},
-{ 32, 31, 21},
-{ 43, 33, 21},
-{ 43, 34, 21},
-{ 24, 23, 23},
-{ 32, 32, 23},
-{ 48, 40, 23},
-{ 48, 46, 23},
-{ 28, 24, 24},
-{ 32, 31, 24},
-{ 34, 32, 24},
-{ 36, 32, 24},
-{ 48, 32, 24},
-{ 35, 10, 8},
-{ 40, 28, 25},
-{ 45, 31, 25},
-{ 44, 32, 25},
-{ 31, 31, 27},
-{ 39, 32, 27},
-{ 44, 32, 27},
-{ 32, 32, 28},
-{ 43, 32, 28},
-{ 48, 32, 28},
-{ 36, 36, 28},
-{ 48, 45, 28},
-{ 40, 32, 29},
-{ 44, 34, 30},
-{ 40, 32, 31},
-{ 41, 32, 31},
-{ 42, 32, 31},
-{ 44, 43, 31},
-{ 48, 37, 32},
-{ 48, 39, 32},
-{ 46, 43, 32},
-{ 48, 48, 34},
-{ 48, 36, 35},
-{ 48, 41, 35},
-{ 47, 43, 36},
-{ 48, 48, 37},
-{ 48, 48, 40},
-{ 48, 48, 45},
-{ 48, 48, 47},
-{ 48, 48, 48}};
-
-const UWord8 no_lead_idx[][2] = { // Q0
-{ 1, 1},
-{ 4, 1},
-{ 41, 1},
-{ 41, 4},
-{ 52, 32},
-{ 56, 38},
-{ 41, 1},
-{ 6, 5},
-{119, 14},
-{ 58, 18},
-{138, 21},
-{169, 40},
-{ 4, 4},
-{ 41, 1},
-{ 35, 1},
-{ 35, 4},
-{ 52, 4},
-{ 18, 8},
-{ 44, 41},
-{ 58, 6},
-{ 58, 9},
-{ 69, 26},
-{ 51, 34},
-{ 85, 34},
-{ 85, 38},
-{ 85, 42},
-{139, 40},
-{142, 33},
-{140, 64},
-{141, 73},
-{236, 124},
-{235, 133},
-{211, 160},
-{ 4, 3},
-{ 41, 1},
-{ 52, 3},
-{ 39, 3},
-{ 42, 3},
-{153, 3},
-{118, 9},
-{158, 44},
-{202, 93},
-{250, 201},
-{ 20, 0},
-{ 52, 0},
-{ 1, 1},
-{ 4, 1},
-{ 4, 4},
-{ 4, 4},
-{ 41, 1},
-{ 41, 4},
-{ 20, 4},
-{ 52, 4},
-{ 39, 4},
-{ 44, 41},
-{ 58, 6},
-{ 80, 41},
-{114, 9},
-{124, 9},
-{130, 21},
-{124, 58},
-{165, 34},
-{164, 39},
-{169, 40},
-{ 35, 0},
-{ 4, 4},
-{ 35, 1},
-{ 35, 4},
-{ 52, 4},
-{ 58, 5},
-{ 15, 5},
-{135, 3},
-{116, 41},
-{124, 24},
-{137, 24},
-{177, 26},
-{194, 44},
-{208, 52},
-{230, 58},
-{ 4, 4},
-{ 41, 1},
-{ 41, 4},
-{ 20, 4},
-{ 8, 6},
-{ 9, 8},
-{ 44, 41},
-{ 58, 6},
-{ 58, 9},
-{114, 9},
-{124, 9},
-{ 92, 21},
-{124, 58},
-{ 92, 51},
-{104, 91},
-{141, 51},
-{121, 91},
-{ 4, 3},
-{ 41, 1},
-{ 52, 3},
-{ 69, 3},
-{ 83, 3},
-{ 87, 3},
-{ 86, 44},
-{143, 74},
-{144, 112},
-{179, 78},
-{196, 78},
-{196, 78},
-{224, 78},
-{ 4, 3},
-{ 41, 1},
-{ 20, 1},
-{ 20, 4},
-{ 52, 4},
-{ 52, 3},
-{111, 5},
-{132, 4},
-{ 57, 41},
-{123, 41},
-{214, 3},
-{183, 81},
-{215, 41},
-{213, 32},
-{219, 44},
-{233, 52},
-{ 7, 52},
-{ 3, 57},
-{ 14, 59},
-{ 11, 53},
-{ 62, 0},
-{ 37, 4},
-{ 37, 3},
-{ 63, 3},
-{ 67, 3},
-{184, 3},
-{123, 41},
-{ 19, 124},
-{ 39, 4},
-{ 44, 41},
-{ 58, 6},
-{ 58, 9},
-{ 58, 44},
-{115, 32},
-{ 95, 16},
-{102, 21},
-{ 99, 38},
-{126, 58},
-{141, 57},
-{206, 56},
-{205, 120},
-{226, 124},
-{226, 133},
-{225, 182},
-{152, 3},
-{ 65, 3},
-{ 17, 14},
-{ 61, 22},
-{135, 3},
-{ 19, 11},
-{ 76, 25},
-{ 41, 36},
-{ 41, 33},
-{ 41, 7},
-{ 27, 10},
-{ 81, 15},
-{ 3, 2},
-{ 41, 36},
-{ 55, 31},
-{ 81, 7},
-};
-const UWord8 no_lead_p_idx[][2] = { // Q0
- { 5, 0},
-{ 3, 0},
-{ 41, 0},
-{ 35, 0},
-{ 52, 0},
-{ 1, 1},
-{ 4, 1},
-{ 4, 4},
-{ 3, 4},
-{ 41, 1},
-{ 41, 4},
-{ 35, 4},
-{ 52, 4},
-{ 39, 4},
-{ 44, 41},
-{ 58, 6},
-{ 80, 41},
-{ 15, 9},
-{ 94, 9},
-{110, 34},
-{ 96, 52},
-{ 98, 39},
-{105, 58},
-{107, 51},
-{105, 104},
-{109, 94},
-{145, 98},
-{207, 100},
-{239, 103},
-{240, 108},
-{207, 146},
-{ 4, 0},
-{ 41, 4},
-{ 39, 3},
-{ 94, 5},
-{ 80, 41},
-{ 94, 18},
-{ 94, 44},
-{ 96, 52},
-{106, 44},
-{121, 58},
-{107, 51},
-{199, 15},
-{197, 104},
-{198, 156},
-{221, 200},
-{ 4, 1},
-{ 3, 1},
-{ 3, 4},
-{ 41, 1},
-{ 35, 1},
-{ 35, 4},
-{ 52, 4},
-{ 39, 4},
-{ 88, 4},
-{135, 4},
-{135, 3},
-{190, 3},
-{155, 41},
-{135, 20},
-{190, 32},
-{194, 44},
-{231, 44},
-{230, 58},
-{231, 15},
-{242, 83},
-{253, 130},
-{ 4, 1},
-{ 32, 1},
-{ 58, 5},
-{ 39, 3},
-{ 43, 5},
-{ 45, 3},
-{ 48, 3},
-{ 46, 44},
-{ 49, 44},
-{ 90, 44},
-{ 50, 44},
-{ 54, 52},
-{ 70, 51},
-{151, 122},
-{151, 53},
-{ 52, 4},
-{ 39, 4},
-{ 83, 4},
-{ 89, 4},
-{ 80, 41},
-{ 85, 41},
-{100, 8},
-{101, 9},
-{ 85, 38},
-{ 85, 15},
-{195, 52},
-{234, 52},
-{217, 15},
-{254, 15},
-{251, 104},
-{ 10, 153},
-{ 18, 157},
-{ 19, 192},
-{ 19, 237},
-{ 19, 0},
-{ 52, 4},
-{153, 3},
-{159, 3},
-{171, 32},
-{185, 44},
-{186, 68},
-{ 85, 15},
-{220, 44},
-{218, 75},
-{227, 75},
-{ 1, 77},
-{228, 147},
-{ 15, 150},
-{ 18, 187},
-{ 16, 212},
-{ 16, 241},
-{ 17, 248},
-{ 4, 3},
-{ 52, 4},
-{ 52, 3},
-{161, 3},
-{166, 3},
-{149, 9},
-{247, 47},
-{178, 0},
-{ 41, 1},
-{ 20, 1},
-{ 20, 4},
-{ 52, 4},
-{ 58, 5},
-{117, 4},
-{117, 3},
-{153, 3},
-{182, 3},
-{204, 3},
-{162, 9},
-{163, 44},
-{167, 44},
-{173, 44},
-{254, 44},
-{ 12, 52},
-{254, 15},
-{ 13, 82},
-{244, 188},
-{ 3, 4},
-{ 52, 4},
-{ 58, 5},
-{153, 3},
-{190, 3},
-{209, 3},
-{243, 189},
-{ 41, 1},
-{ 20, 1},
-{ 39, 4},
-{ 88, 4},
-{ 97, 4},
-{138, 21},
-{ 6, 44},
-{ 1, 1},
-{ 4, 1},
-{ 4, 4},
-{ 5, 4},
-{ 41, 1},
-{ 41, 4},
-{ 20, 4},
-{ 52, 4},
-{ 39, 4},
-{ 83, 4},
-{135, 4},
-{ 80, 41},
-{116, 41},
-{136, 41},
-{110, 34},
-{ 13, 6},
-{113, 41},
-{114, 18},
-{ 91, 24},
-{125, 24},
-{127, 24},
-{163, 12},
-{168, 13},
-{172, 13},
-{128, 84},
-{174, 28},
-{252, 29},
-{249, 30},
-{246, 129},
-{246, 180},
-{ 9, 66},
-{110, 41},
-{155, 41},
-{154, 20},
-{158, 44},
-{203, 21},
-{232, 44},
-{210, 39},
-{223, 79},
-{222, 123},
-{229, 131},
-{238, 139},
-{238, 170},
-{ 4, 4},
-{ 4, 4},
-{ 41, 1},
-{ 20, 1},
-{ 20, 4},
-{ 52, 4},
-{ 39, 4},
-{ 88, 4},
-{135, 4},
-{ 80, 41},
-{110, 41},
-{136, 41},
-{134, 32},
-{176, 44},
-{193, 44},
-{195, 52},
-{210, 39},
-{242, 39},
-{ 6, 71},
-{ 2, 148},
-{ 4, 175},
-{ 5, 191},
-{110, 41},
-{204, 3},
-{216, 22},
-{210, 23},
-{195, 32},
-{220, 44},
-{210, 39},
-{222, 33},
-{245, 57},
-{255, 60},
-{ 8, 72},
-{ 8, 181},
-};
-
-const Word16 min_lat_bits_SN[] = {-1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 };
-//Q0
-const Word16 min_lat_bits_SN_fx[] = { -1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 };
-
-const Word16 min_lat_bits_pred[] = {17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16};
-//Q0
-const Word16 min_lat_bits_pred_fx[] = { 17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16 };
-
-const Word16 offset_lvq_modes_SN[] = {-1,-1,33,64,96, 129,-1,-1,12,43,79,109,-1,-1,137,-1,107,135,
- 112
- }; /* CNG */
-//Q0
-const Word16 offset_lvq_modes_SN_fx[] = { -1,-1,26,51,77,96,-1,-1,12,36,66,90,-1,-1,105,-1,88,102,112 }; /* CNG */
-
-const Word16 offset_lvq_modes_pred[] = {119, 153, 31, 67, -1, 102, 126, 160, 0, 46, -1, 82, 146, -1, 175, 191, -1, 225, 203};
-//Qlog2(1.6)
-const Word16 offset_lvq_modes_pred_fx[] = { 74, 95, 15, 45, -1, 66, 81, 102, 0, 30, -1, 60, 88, -1, 109, 117, -1, 139, 124 };
-
-const Word16 offset_in_lvq_mode_SN[][21] =
-{
- {0}, /* I NB */
- {0,1,1,1,1,1,2,3,3,3,3,4,4,4,5}, /* UV NB*/
- {0,1,1,1,1,2,3,4,5,5,6,6,7,7,7,7,7,8,8,8,9}, /* V NB */
- {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
- {0,1,1,1,1,2,3,4,5,5,5,6,6,6,7,8}, /* T NB */
- {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
- {0}, /* I WB */
- {0}, /* UV WB*/
- {1}, /* V WB */ /* granularity 1 */
- {1}, /* G WB */ /* granularity 1 */
- {1}, /* T WB */ /* granularity 1 */
- {1}, /* A WB */ /* granularity 1 */
- {0}, /* I 16k */
- {0}, /* UV 16k */
- {1}, /* V 16k */ /* granularity 1 */
- {0}, /* G 16k */
- {0,1}, /* T 16k */
- {0}, /* A 16k */
-};
-
-const Word16 offset_in_lvq_mode_SN_fx[][21] =
-{//Q0
- {0}, /* I NB */
- {0,1,1,1,1,1,2,3,3,3,3,4,4,4,5}, /* UV NB*/
- {0,1,1,1,1,2,3,4,5,5,6,6,7,7,7,7,7,8,8,8,9}, /* V NB */
- {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
- {0,1,1,1,1,2,3,4,5,5,5,6,6,6,7,8}, /* T NB */
- {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
- {0}, /* I WB */
- {0,1,1,1,2,3,3,3,3,3,3,4,4,4,5}, /* UV WB*/
- {0,1,1,1,2,3,3,3,4,5,6,7,8,9,9,10,11,12,12,12,13}, /* V WB */
- {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G WB */
- {0,1,1,1,2,3,3,4,5,5,5,6,6,7,8,9,10}, /* T WB */
- {0,0,0,0,1,2,2,2,3,4,4,4,4,4,4,4,4,4,4,5}, /* A WB */
- {0},
- {0},
- {0,0,0,0,0,0,1,2,3,3,4,5,6,6,6,7}, /* V 16k */
- {0}, /* G 16k */
- {0,1}, /* T 16k */
- {0}, /*{0,0,0,0,0,0,0,0,0,0,1} */ /* A 16k */
-};
-
-const Word16 offset_in_lvq_mode_pred[][32] =
-{
- {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I NB */
- {0,1,1,1,2,3,4,4,4,4,4,5,5,5,6}, /* UV NB */
- {0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,3,4,4,5,6,7,8,9,10,10,11,12,13,13,13,14}, /* V NB */
- {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
- {0}, /* T NB */
- {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
- {1}, /* I WB */
- {1}, /* UV WB */ /* granularity 1 */
- {1}, /* V WB */ /* granularity 1 */
- {1}, /* G WB */
- {0}, /* T WB */
- {1}, /* A WB */
- {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I 16k */
- {0}, /* UV 16k */
- {1}, /* V 16k */
- {1}, /* G 16k */
- {0}, /* T 16k */
- {1}, /* A 16k */
- {1}, /* G WB MA*/
-};
-
-const Word16 offset_in_lvq_mode_pred_fx[][32] =
-{//Q0
- {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I NB */
- {0,1,1,1,2,3,4,4,4,4,4,5,5,5,6}, /* UV NB */
- {0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,3,4,4,5,6,7,8,9,10,10,11,12,13,13,13,14}, /* V NB */
- {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
- {0}, /* T NB */
- {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
- {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I WB */
- {0,1,1,1,2,3,4,4,4,4,4,5,5,5,6}, /* UV WB */
- {0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,3,4,4,5,6,7,8,9,10,10,11,12,13,13,13,14}, /* V WB */
- {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G WB */
- {0}, /* T WB */
- {0,0,0,0,1,2,2,2,3,4,4,4,4,4,4,4,4,4,4,5}, /* A WB */
- {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I 16k */
- {0}, /* UV 16k */
- {0,0,0,0,0,0,1,2,3,3,4,5,6,6,6,7}, /* V 16k */
- {0,0,0,0,0,0,1,2,3,4,5,6}, /* G 16k */
- {0}, /* T 16k */
- {0,0,0,0,0,0,1,2,3,4,5,6}, /* A 16k */
- {0,0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G WB MA*/
-};
-
-/*-----------------------------------------------------------------*
- * BC-TCVQ frame-end quantization tables (BC-TCVQ is used in Voiced mode for 16kHz isf)
- *-----------------------------------------------------------------*/
-const Word16 NTRANS[4][NUM_STATE] = {{0,2,4,6,8,10,12,14,0,2,4,6,8,10,12,14}, /* indices of previous state of first branche */
- {1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15}, /* indices of previous state of second branches */
- {4,2,1,3,0,2,1,3,2,0,3,1,7,0,3,1}, /* indices of previous subset of first branch */
- {2,0,3,6,2,0,3,1,0,2,1,3,0,2,1,5} /* indices of previous subset of second branch */
-}; // Q0
-
-const Word16 NTRANS2[4][NUM_STATE] = {{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7},
- {8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15},
- {4,2,2,0,1,3,3,6,0,2,2,0,1,3,3,1},
- {2,0,0,2,3,1,1,3,7,0,0,2,3,1,1,5}
-}; // Q0
-
-/* BC-TCQ Bit Allocations */
-const Word16 BC_TCVQ_BIT_ALLOC_40B[M/2+4] = {1, 4, 5,5,4,4, 2,2,2,2, 5,4 }; /*1+39bit Q0*/
-
-const Word16 FixBranch_tbl[4][4][N_STAGE_VQ - 4] =
-{
- {{0, 0, 0, 0}, {1, 0, 0, 0}, {0, 1, 0, 0}, {1, 1, 0, 0}}, /* incase of initial state 0 */
- {{0, 0, 1, 0}, {1, 0, 1, 0}, {0, 1, 1, 0}, {1, 1, 1, 0}}, /* incase of initial state 4 */
- {{0, 0, 0, 1}, {1, 0, 0, 1}, {0, 1, 0, 1}, {1, 1, 0, 1}}, /* incase of initial state 8 */
- {{0, 0, 1, 1}, {1, 0, 1, 1}, {0, 1, 1, 1}, {1, 1, 1, 1}} /* incase of initial state 12 */
-}; // Q0
-
-/* Intra-Prediction */
-
-const Word16 SN_IntraCoeff_fx[N_STAGE_VQ - 1][2][2] = /* Q15 */
-{
- {{-14822, 26501}, {-17180, 10012}},
- {{ 317, 19858}, { -432, 13799}},
- {{ 4747, 22069}, { 2653, 19016}},
- {{ 6823, 20747}, { 7077, 19154}},
- {{ 1665, 25161}, { 2519, 13654}},
- {{ 166, 18043}, { -221, 9732}},
- {{ -781, 20026}, { -5332, 18882}}
-};
-
-const Word16 AR_IntraCoeff_fx[N_STAGE_VQ - 1][2][2] = /* Q15 */
-{
- {{-9584, 22162}, {-13849, 7127}},
- {{ 1604, 16400}, { 2861, 9414}},
- {{ 6537, 16475}, { 3498, 13792}},
- {{ 7879, 14434}, { 7021, 12992}},
- {{ 6329, 16215}, { 5200, 10052}},
- {{ 3062, 12146}, { 2147, 4857}},
- {{ 1226, 11040}, { -794, 6137}}
-};
-
-const Word16 scale_ARSN_fx[M] = /* Q14 */
-{
- 29994, 30153, 29506, 28534, 28246, 28618, 26388, 27029,
- 25726, 25474, 25797, 26540, 25613, 24968, 25880, 25584
-};
-
-const Word16 scale_inv_ARSN_fx[M] = /* Q15 */
-{
- 17898, 17806, 18196, 18815, 19005, 18760, 20342, 19864,
- 20870, 21076, 20811, 20228, 20962, 21502, 20745, 20985
-};
-
-/* TCVQ Codebook */
-
-const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2] = /* x2.65 */
-{//Qlog2(2.56)
- {
- {-435 , -434}, {-233 , 124}, {-381 , 44}, {-274 , -88}, {-332 , -224}, {-563 , -600}, {-332 , 134}, { 53 , -739},
- {-567 , 0}, { 149 , 316}, {-191 , 541}, {-123 , 317}, {-493 , -634}, {-528 , 268}, {-321 , -386}, {-432 , -220},
- {-244 , -230}, { -33 , 454}, {-188 , -642}, {-131 , -215}, {-676 , 263}, {-472 , -403}, {-312 , -159}, {-340 , 297},
- {-121 , -217}, { -6 , 241}, {-203 , -211}, {-126 , -15}, {-734 , -374}, {-458 , -6}, {-297 , -27}, {-307 , -553},
- {-177 , 3}, {-175 , -273}, { 63 , 363}, { 133 , 527}, {-133 , -185}, {-449 , -1206}, {-287 , -281}, {-131 , 869},
- {-100 , -105}, { -75 , -179}, {-141 , 131}, { -32 , 108}, { -81 , 161}, {-446 , -230}, {-283 , -884}, {-128 , -165},
- {-153 , -451}, {-177 , -114}, {-113 , -127}, {-223 , -355}, {-246 , -447}, {-396 , -705}, {-280 , 329}, { -37 , -64},
- {-118 , 208}, { -82 , 64}, {-339 , -367}, { -58 , -132}, {-458 , 644}, {-381 , -543}, {-272 , 557}, { 62 , 75},
- {-307 , -829}, { 310 , 445}, { 73 , -26}, { 95 , 219}, { 223 , 611}, { 279 , 195}, { 430 , 575}, { 424 , 221},
- { -25 , 2}, { 323 , 236}, {-100 , -310}, { 11 , -35}, { 83 , -3}, { 281 , 738}, { 495 , 393}, { 89 , 1284},
- { 32 , 136}, { 29 , 34}, { 491 , 575}, { 105 , -188}, { 15 , -440}, { 285 , 10}, { 516 , -105}, { 313 , 704},
- { -6 , -274}, { -62 , -64}, { -12 , -127}, { 170 , 2387}, { 162 , 196}, { 336 , 413}, { 543 , 210}, { 231 , -70},
- { -2 , 691}, { 98 , 134}, { 25 , 141}, { 261 , 305}, { 312 , -322}, { 336 , 228}, { 561 , 781}, { 766 , 514},
- { -14 , -117}, { 166 , 905}, { -50 , 1}, { 471 , 369}, { 345 , 247}, { 347 , -383}, { 561 , 1128}, { 513 , 1030},
- { 100 , -15}, { 185 , 70}, { 167 , 131}, { 122 , 36}, { 561 , 743}, { 401 , 111}, { 595 , -579}, { 674 , 215},
- { 191 , 189}, { 38 , -78}, { 428 , 0}, { 261 , 136}, { -29 , -99}, { 405 , 308}, { 614 , 574}, {1682 , 1704}
- },
- {
- {-942 , -168}, {-262 , -361}, { -53 , -171}, {-245 , 472}, {-2145 , -2315}, {-1307 , 1261}, {-870 , -1940}, { -652 , -564},
- {-500 , 447}, {-578 , -198}, {-554 , 111}, { -98 , -84}, {-1315 , 0}, {-1229 , -1618}, {-868 , 230}, { -385 , 1061},
- {-768 , -998}, {-202 , -60}, {-283 , -197}, {-142 , -325}, { -558 , 755}, {-1217 , 456}, {-803 , 766}, { -982 , 743},
- {-415 , -357}, { -28 , 1054}, { 114 , -246}, { 81 , 732}, { -804 , -506}, {-1126 , -112}, {-797 , -132}, { -289 , -204},
- {-347 , -29}, { -37 , -259}, {-142 , -438}, {-249 , 87}, { -874 , 341}, {-1074 , -2635}, {-668 , -1552}, {-1140 , -764},
- {-245 , -513}, { -48 , 526}, { 14 , 395}, {-452 , -646}, { -441 , -969}, { -953 , -1284}, {-645 , -387}, { -736 , 111},
- {-163 , 305}, {-349 , 224}, {-225 , 736}, { 94 , -85}, { -302 , -549}, { -937 , -892}, {-605 , -1089}, { -64 , -101},
- {-161 , -211}, {-392 , -1299}, {-148 , 125}, { 14 , 131}, { -432 , -127}, { -920 , -510}, {-598 , -730}, { 85 , 154},
- { 25 , -155}, { -57 , 238}, { 471 , 276}, { 421 , 680}, { -173 , 316}, { 597 , 1805}, { 906 , -673}, { 538 , 450},
- {-267 , -805}, { 2 , -19}, { 222 , 219}, { 185 , 352}, { -33 , -178}, { 606 , 118}, { 959 , -70}, { 350 , -91},
- { -87 , 42}, { 727 , 905}, { 54 , 33}, { 316 , 44}, { 251 , 15}, { 610 , -122}, { 990 , 1436}, { 82 , 1480},
- { 181 , 535}, { 177 , 130}, { 700 , 565}, { 626 , 331}, { 279 , 551}, { 680 , 707}, {1012 , 727}, { 1057 , 766},
- { -13 , -396}, { 364 , 412}, { 442 , -181}, { 202 , -386}, { 565 , 1397}, { 740 , 2621}, {1080 , 361}, { 1118 , 191},
- { 81 , 266}, { 217 , -130}, { 349 , 1009}, { 678 , -476}, { 1361 , 878}, { 795 , 472}, {1267 , 1034}, { 1040 , 1255},
- { 351 , 201}, { -69 , -633}, { -36 , -1046}, { 808 , 30}, { 1300 , -198}, { 803 , 1026}, {1390 , -326}, { 2291 , 2479},
- { 166 , 13}, { 521 , 84}, { 255 , -717}, { 987 , 448}, { 777 , 220}, { 811 , 208}, {1395 , 2021}, { 1499 , 417}
- }
-};
-const Word16 AR_TCVQ_CB_SUB2_fx[2][64][2] =
-{//Qlog2(2.56)
- {
- {-357 , -53}, {-525 , 167}, {-232 , 255}, {-132 , -359}, {-940 , -221}, { -260 , -1296}, {-1197 , -455}, { -833 , 49},
- {-132 , -1}, {-401 , -280}, {-212 , -217}, {-194 , 92}, {-580 , -710}, { -862 , -750}, { -669 , 430}, { -521 , 719},
- {-620 , -454}, {-239 , 509}, { -15 , -575}, { 389 , 704}, {-890 , 518}, {-1154 , 84}, { -632 , -1023}, { -620 , -1263},
- {-268 , -470}, {-326 , -738}, { 44 , 635}, { 73 , 362}, {-226 , -22}, { -625 , -106}, { -720 , -114}, {-1114 , -1070},
- { 19 , -250}, { 83 , 99}, { 35 , -16}, { 263 , -316}, { 472 , 1096}, { -52 , -328}, { -249 , 971}, { 1387 , 876},
- { 10 , 203}, { 869 , 649}, { 225 , 170}, { 301 , 83}, {1256 , 482}, { 391 , -777}, { 1064 , -320}, { 52 , 1207},
- { 309 , 375}, { 469 , 226}, { 619 , 400}, { 60 , -93}, { 335 , 244}, { 316 , -65}, { -45 , -987}, { 648 , -294},
- { 218 , -66}, {-108 , -133}, { 500 , -19}, { 824 , 163}, { 483 , -443}, { 1297 , 240}, { 1000 , 1205}, { 623 , 1347}
- },
- {
- {-424 , -965}, { -46 , -194}, { 20 , 298}, {-333 , -278}, {-797 , -522}, {-868 , -60}, { -20 , -140}, {-1085 , -904},
- {-615 , -243}, {-367 , 22}, {-261 , -519}, {-111 , -27}, {-745 , 142}, {-484 , -1519}, { -329 , 13}, {-1077 , 92},
- {-529 , 218}, {-519 , -597}, {-276 , -72}, { -87 , -398}, { -51 , -1257}, {-291 , 409}, { -883 , 611}, { 176 , -401},
- {-134 , -245}, { 37 , 506}, { 23 , -10}, {-225 , 293}, {-913 , -1324}, {-174 , -290}, {-1086 , -386}, { -139 , -78},
- {-123 , 125}, { -26 , -738}, { 113 , -344}, { 175 , 182}, { 754 , -446}, {1207 , 529}, { 932 , 990}, { 136 , 122},
- { 267 , 327}, { 382 , -182}, { 718 , 471}, { 738 , 108}, { 158 , 130}, { 437 , 401}, { 358 , -667}, { 1380 , 836},
- { 184 , -17}, { 435 , 231}, { 403 , 63}, { 151 , -125}, {-109 , -237}, { 692 , -241}, { 1247 , 193}, { 885 , 324},
- {-283 , 661}, { 44 , 105}, { 156 , 911}, { 387 , 588}, { 690 , 1459}, { 664 , 1057}, { -38 , 1455}, { 645 , 909}
- }
-};
-const Word16 AR_TCVQ_CB_SUB3_fx[4][32][2] =
-{//Qlog2(2.56)
- {
- {-487 , 9}, {-456 , -400}, { 96 , 451}, {-239 , 422}, {-685 , -1309}, { 68 , -709}, {-302 , -1185}, { 481 , -287},
- {-287 , -697}, {-194 , 73}, {-159 , -132}, {-161 , -312}, {-809 , 417}, {-860 , -926}, { -26 , -71}, {-1052 , -432},
- { 53 , 134}, { 106 , -140}, { 336 , -18}, { 404 , 735}, {-109 , -516}, { 719 , -65}, { -34 , 1336}, { -171 , 905},
- { 52 , -347}, { 359 , 266}, { 715 , 351}, { 100 , 133}, { 87 , 130}, { 975 , 999}, {1257 , 547}, { 738 , 1372}
- },
- {
- {-340 , -464}, {-216 , -779}, { 104 , -403}, { -92 , -221}, {-760 , -602}, {-914 , -811}, {-661 , -895}, {-1292 , -290},
- {-317 , 131}, {-575 , -154}, {-228 , -129}, {-257 , 487}, {-286 , -1354}, { -93 , -259}, {-798 , 179}, { -815 , -1368},
- { 215 , 570}, { -2 , 73}, { 545 , 167}, { 250 , 188}, { 76 , 48}, {-943 , 587}, { 379 , 1232}, { 1070 , 112},
- { 117 , -27}, { 389 , -142}, { 18 , 214}, { 735 , 581}, {1098 , 1244}, { 451 , 408}, {1482 , 650}, { -174 , 1160}
- },
- {
- {-256 , -485}, { -67 , 571}, { -5 , 161}, {-171 , 153}, {-1188 , -440}, {-1081 , 110}, {-641 , -921}, {-232 , -96},
- {-511 , 146}, {-288 , -93}, { 484 , 665}, {-610 , -366}, { -357 , -899}, { -861 , -1088}, { -78 , -105}, {-265 , -845},
- { 15 , 18}, { 79 , -383}, {-205 , -258}, { 306 , 264}, { 28 , 69}, { 34 , 65}, {1170 , 669}, { 133 , 74},
- { 521 , 183}, { 132 , 84}, { 362 , -90}, { 57 , -181}, { 894 , 456}, { 1147 , 742}, { 212 , 274}, { 891 , 262}
- },
- {
- { 94 , 464}, { 8 , 138}, {-365 , -640}, {-399 , 172}, {-249 , -109}, { -94 , -316}, {-163 , -250}, {-598 , -704},
- {-185 , 36}, {-470 , -199}, { 65 , 241}, {-104 , -362}, {-220 , -801}, {-866 , -66}, {-931 , -400}, {-172 , -132},
- {-148 , -494}, { 465 , 251}, {-179 , -72}, { 439 , 287}, { 824 , 559}, { 33 , 134}, { 59 , 134}, { 88 , 146},
- { 186 , 43}, { 69 , -261}, { 267 , -96}, { 40 , 79}, { 84 , 130}, { 678 , 378}, { 811 , 448}, { 920 , 541}
- }
-};
-
-
-const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2] =
-{//Qlog2(2.56)
- {
- {-639 , 105}, {-488 , -449}, {-530 , -811}, {-419 , -634}, {-781 , -1061}, {-585 , 386}, {-501 , -737}, {-489 , -728},
- {-702 , -685}, {-510 , -762}, {-390 , -287}, {-379 , -379}, {-573 , -848}, {-583 , -778}, {-500 , -810}, {-671 , -420},
- {-516 , 802}, {-265 , -492}, {-523 , -568}, {-195 , 2882}, {-600 , -172}, {-568 , -869}, {-497 , 663}, {-643 , -929},
- {-346 , -378}, {-253 , -313}, {-418 , 595}, {-240 , -465}, {-424 , -546}, {-556 , -305}, {-497 , 2453}, {-451 , -235},
- {-452 , -670}, {-368 , -624}, {-379 , -662}, {-305 , -85}, {-549 , 399}, {-546 , -644}, {-484 , -426}, {-387 , -546},
- {-325 , -550}, {-229 , 118}, { -83 , 1004}, {-120 , 465}, {-289 , -222}, {-516 , 155}, {-480 , 1494}, {-415 , 138},
- {-419 , -100}, {-347 , 1091}, {-434 , 76}, {-138 , -291}, {-434 , -719}, {-514 , 945}, {-473 , -26}, {-144 , -320},
- {-376 , 1505}, {-329 , 374}, {-316 , -504}, { -58 , -6}, {-270 , -466}, {-507 , -540}, {-466 , -181}, {-256 , -518},
- {-196 , 726}, { -88 , -356}, {-186 , -394}, { 31 , -201}, { -77 , -319}, { 408 , 136}, { 630 , 680}, { 875 , 1365},
- {-200 , -190}, { 166 , 1289}, { 600 , 1085}, { 276 , 464}, { 567 , 1575}, { 425 , 278}, { 666 , 377}, {1209 , 2344},
- {-182 , -409}, { -95 , -141}, { 65 , 507}, { 127 , 212}, { 340 , 235}, { 481 , 408}, { 721 , 1203}, {1112 , 756},
- { 162 , 362}, { 138 , 753}, {-169 , -128}, { 187 , -32}, { 68 , -93}, { 528 , 2866}, { 786 , 789}, {1247 , 1468},
- {-476 , 2428}, { 20 , 133}, { 2 , -236}, { 426 , 799}, { 393 , 590}, { 532 , 1562}, { 807 , 534}, {1410 , 1051},
- { -14 , -263}, { 83 , -158}, { 158 , -38}, { 616 , 550}, { 845 , 543}, { 536 , 238}, { 912 , 1521}, {1635 , 1344},
- { 115 , -55}, { 263 , 87}, {-126 , 234}, { 376 , 191}, { 459 , 2644}, { 542 , 927}, { 941 , 948}, {1896 , 1528},
- { -19 , 1853}, { 455 , 366}, { 545 , 283}, { 831 , 835}, {1217 , 846}, { 560 , 542}, {1013 , 650}, {1905 , 2343}
- },
- {
- {-528 , -246}, {-631 , 56}, {-717 , -277}, { -40 , 1327}, {-1011 , -688}, {-827 , -341}, {-656 , -1599}, { -992 , -1559},
- {-450 , 933}, {-540 , 2109}, {-598 , -1267}, {-387 , -512}, {-1100 , -1979}, {-812 , -617}, {-649 , -147}, { -874 , 586},
- {-720 , -601}, {-281 , -279}, {-578 , 635}, { 169 , 80}, {-1020 , -134}, {-794 , 259}, {-638 , 821}, { -907 , 42},
- {-709 , -1525}, {-482 , 1340}, {-232 , -979}, { 104 , 2314}, { -918 , -1179}, {-790 , 1284}, {-609 , 2259}, { -854 , -978},
- {-624 , 326}, {-194 , 1705}, { -88 , 1060}, { 383 , 1190}, { -415 , 15}, {-789 , -1145}, {-604 , 407}, { -869 , 1136},
- {-503 , -1047}, {-545 , -794}, {-128 , 471}, { 84 , 638}, { -591 , -1509}, {-699 , 1746}, {-600 , -369}, { -784 , 1642},
- {-221 , -668}, {-223 , 261}, { -82 , -446}, {-378 , -1215}, { -741 , 969}, {-689 , -863}, {-569 , -595}, {-1012 , -403},
- {-331 , 518}, {-175 , 787}, {-220 , -3}, { -46 , -841}, { -960 , 297}, {-666 , 68}, {-565 , -1364}, { -265 , -21},
- { 649 , 767}, { 255 , 360}, { 338 , -342}, {1664 , 1627}, { 205 , -226}, { 967 , 31}, {1217 , 928}, { 1697 , 1233},
- { 322 , 1445}, { 320 , 1790}, { 413 , 212}, { 994 , 209}, { 766 , 264}, { 974 , 883}, {1228 , 241}, { 1679 , 801},
- { 75 , 312}, { 754 , 1425}, { 348 , 621}, { 644 , 474}, { 1008 , 763}, {1036 , 2024}, {1354 , 530}, { 1611 , 2129},
- { 162 , 931}, { 883 , 822}, { 990 , 488}, { 615 , -203}, { 1929 , 1234}, {1059 , 1375}, {1382 , 1426}, { 2048 , 1599},
- { 602 , 162}, { 380 , 820}, { 709 , 1064}, {1168 , 1374}, { 549 , 583}, {1062 , 470}, {1415 , 1092}, { 2095 , 2234},
- { 187 , -630}, { 118 , -493}, { 714 , 1787}, {1298 , 673}, { 957 , 1258}, {1082 , 1124}, {1460 , 786}, { 2124 , 1205},
- { 34 , -189}, { 54 , -35}, { 798 , 0}, { 747 , 2378}, { 1420 , 1152}, {1118 , 1673}, {1492 , 2287}, { 2416 , 1618},
- {1159 , 1795}, { 389 , -126}, {1194 , 1003}, {1578 , 1002}, { 1294 , 366}, {1148 , 694}, {1513 , 1791}, { 2746 , 2096}
- }
-};
-
-const Word16 SN_TCVQ_CB_SUB2_fx[2][64][2] =
-{//Qlog2(2.56)
- {
- {-709 , -609}, {-615 , -1025}, {-430 , -321}, { -44 , 1032}, {-1050 , -32}, {-1028 , -1856}, {-970 , -109}, { -572 , -1426},
- {-568 , 154}, {-142 , -189}, { -80 , 533}, { -38 , -632}, { -391 , 1275}, { -986 , -732}, {-479 , -510}, { -966 , 96},
- {-847 , -1387}, {-895 , 607}, {-368 , -930}, {-386 , 352}, { -290 , 10}, { -833 , 94}, {-528 , 1718}, { -210 , 115},
- {-529 , 857}, {-727 , -230}, {-128 , 31}, { 133 , 76}, { -275 , -777}, { -615 , -1367}, {-339 , -13}, {-1035 , 1231},
- { 448 , 851}, { 599 , 106}, {1103 , 1112}, { 635 , 1249}, { 761 , 774}, { 531 , -71}, { 722 , 473}, { 767 , 413},
- { 258 , 276}, { 346 , -380}, { 487 , 504}, {1114 , 122}, { 882 , 1553}, { 1983 , 1239}, {2126 , 1217}, { 1742 , 1262},
- { 135 , -252}, { 216 , 545}, { 500 , -125}, {1379 , 1910}, { 304 , 76}, { 1509 , 609}, {1543 , 1385}, { 542 , 1831},
- {-240 , -467}, { 771 , 652}, { 913 , 280}, {1307 , 716}, { 1834 , 1029}, { 1049 , 491}, {1624 , 733}, { 2495 , 1944}
- },
- {
- {-729 , -852}, {-590 , 306}, {-398 , 295}, { -31 , 13}, {-659 , -75}, {-604 , -1229}, {-519 , -675}, {-823 , 47},
- {-755 , -207}, {-818 , -424}, {-705 , -1285}, {-258 , -828}, {-807 , -707}, {-182 , -712}, {-928 , 3}, {-455 , -1149},
- {-844 , 422}, {-596 , -1008}, {-504 , -470}, {-459 , 737}, {-338 , -728}, {-836 , 1028}, {-613 , 1242}, {-609 , 1292},
- {-285 , 36}, {-280 , -424}, { 100 , 126}, {-459 , -135}, {-159 , -151}, {-287 , 190}, { 56 , -262}, {-264 , -317},
- { -8 , 603}, { 63 , 301}, { 537 , -155}, { 289 , 569}, { 193 , -412}, { 864 , 79}, { 686 , 399}, { 842 , 1657},
- { 115 , -211}, { 608 , 340}, { 12 , -650}, { 711 , 1103}, { 101 , 510}, { 358 , -416}, {1266 , 453}, { 532 , 612},
- {-256 , -680}, { 41 , 1163}, { 597 , 793}, { 484 , -61}, { 476 , 256}, {1729 , 1246}, {1209 , 1483}, {1472 , 1113},
- { 389 , 330}, { 176 , -388}, {1025 , 317}, {1049 , 732}, {1480 , 1108}, {1285 , 616}, {1730 , 999}, {2001 , 1669}
- }
-};
-const Word16 SN_TCVQ_CB_SUB3_fx[4][32][2] =
-{//Qlog2(2.56)
- {
- {-377 , -872}, {-407 , 801}, {-611 , -449}, {-397 , -87}, {-476 , -1063}, {-797 , -249}, {-263 , -662}, {-473 , 1508},
- {-716 , 310}, {-616 , -982}, {-742 , -1326}, { 197 , 327}, {-894 , -1556}, {-871 , -1259}, {-708 , -1380}, {-789 , -848},
- { 64 , -313}, { -59 , -547}, { -2 , 67}, { 363 , -167}, { 633 , 1840}, { 232 , -357}, {1243 , 1492}, {1640 , 973},
- { 203 , 518}, { 511 , 946}, { 612 , 241}, {1085 , 724}, { 811 , 326}, { 863 , 241}, { 556 , 534}, {1956 , 2087}
- },
- {
- {-948 , 28}, {-827 , -1180}, {-348 , -331}, { -36 , 216}, {-1453 , -1162}, {-682 , -639}, {-747 , -1517}, {-704 , 1228},
- {-535 , -988}, {-550 , -109}, {-478 , 580}, {-310 , -699}, {-1308 , -225}, {-775 , -1581}, {-831 , -613}, {-120 , -222},
- { 32 , 200}, { 120 , -221}, { 470 , 466}, { 808 , 313}, { 950 , 711}, { 430 , -576}, {1984 , 1405}, {1645 , 887},
- { 131 , 1148}, { 286 , 508}, { 342 , -236}, {1003 , 1202}, { 317 , -726}, {1493 , 732}, {1336 , 694}, {2382 , 1772}
- },
- {
- {-874 , -374}, {-237 , 26}, { 15 , 870}, {-710 , 433}, { 40 , -769}, {-1059 , -1350}, { 65 , 208}, {-1012 , -1369},
- { -79 , -459}, {-671 , -942}, { -12 , 56}, {-162 , -431}, {-820 , -1073}, { -886 , -136}, {-327 , -501}, { -55 , -14},
- { 652 , 647}, { 365 , 411}, { 614 , 252}, { 154 , 215}, { 12 , 62}, { 226 , 177}, {1689 , 1213}, { 751 , 179},
- { 31 , 182}, { 281 , -291}, {-354 , -642}, { 939 , 924}, { 619 , 90}, { 1675 , 1130}, { 827 , 272}, { 1550 , 1446}
- },
- {
- {-366 , -916}, {-346 , -234}, {-518 , -140}, { 26 , 305}, {-254 , -92}, {-634 , -976}, {-493 , -1076}, {-334 , -913},
- {-566 , 68}, { 102 , 216}, {-296 , -927}, {-501 , -1030}, {-437 , -1006}, {-146 , -145}, {-211 , -202}, { 62 , 359},
- { 163 , -122}, { 759 , 553}, { 82 , 207}, {-177 , -243}, { 163 , 343}, {1152 , 929}, { 197 , 248}, { 43 , -147},
- { 169 , 371}, {-468 , -1043}, { 686 , 418}, { 563, 245}, {1052 , 843}, { 259 , 341}, {1063 , 637}, { 865 , 654}
- }
-};
-
-
-const Word16 AR_SVQ_CB1_fx[32][8] = /* x2.56 */
-{//Qlog2(2.56)
- { -1, 4, 16, 4, 45, -110, 10, 167, },
- { -3, 2, 8, -12, -7, 23, 279, -46, },
- { 0, 2, 1, 8, -73, -40, 71, -97, },
- { 0, 2, 42, 74, -39, 72, 27, 8, },
- { 0, 1, 9, -6, 40, -65, -55, -128, },
- { 0, 0, 8, -10, -43, 105, -5, -126, },
- { 0, 0, 12, -3, -98, -18, -88, -73, },
- { 0, 1, -6, -12, -49, -179, -30, -15, },
- { -1, 0, 24, 78, 25, -69, -26, -14, },
- { 0, 1, -1, -29, 23, -65, -126, 34, },
- { 2, -4, -23, -7, -13, -2, -22, -4, },
- { -1, 1, -2, 44, -54, -58, 107, 60, },
- { 0, 1, -3, -15, -54, 97, -100, 41, },
- { 0, -2, -81, 93, -13, 18, -31, -75, },
- { -1, 2, 0, -5, 166, -64, -48, 8, },
- { -2, 0, -27, -108, 36, 3, 12, -80, },
- { 0, 0, 0, 4, 82, -1, 79, 54, },
- { 1, -4, 5, -9, -38, 289, 16, 16, },
- { -1, 2, 6, -68, 61, 67, -31, 100, },
- { 3, -6, 2, -2, -1, -6, -217, 273, },
- { 0, 1, -43, -62, -7, -60, 28, 78, },
- { -1, 2, 10, 0, 76, 84, -55, -45, },
- { -1, -2, 4, 5, -32, 75, 70, 176, },
- { 2, -1, 0, 6, 27, 29, -220, -97, },
- { -1, 1, 90, -56, -10, -16, 29, 8, },
- { -1, 3, -10, 0, 2, -24, 49, -336, },
- { -1, 1, -8, -9, 55, -134, 105, -44, },
- { 0, 1, -16, 69, 51, 40, -51, 98, },
- { 0, 2, -12, -32, -140, 49, 50, 26, },
- { 0, 3, 8, 29, 77, 24, 76, -103, },
- { -1, 2, -24, -18, 7, 100, 94, 5, },
- { 0, -1, 10, 26, -87, -34, -56, 103, }
-};
-
-const Word16 AR_SVQ_CB2_fx[16][8] = /* x2.56 */
-{//Qlog2(2.56)
- { -37, -59, 208, -88, 54, 58, -16, -24, },
- { 0, -98, 9, -65, -182, -21, 19, 9, },
- { -1, 110, -8, 59, 201, 9, -38, -22, },
- { -1, 40, -22, -183, 46, -162, -38, -6, },
- { 12, 2, -193, 64, -43, -48, 11, 9, },
- { -83, 175, -8, -55, -65, 66, 26, 6, },
- { 29, 3, 2, -10, -100, 293, 75, -12, },
- { 7, -54, -76, -91, 63, 119, -84, -84, },
- { 3, 7, 6, 6, -30, 15, -176, 168, },
- { -10, 45, 26, 57, -92, -68, -117, -134, },
- { 0, -37, -34, -69, 106, 54, 121, 131, },
- { -25, -64, 7, 205, 1, 93, 27, 6, },
- { 64, 28, 51, 8, -7, 18, 27, 0, },
- { -20, 44, 57, 78, -55, -170, 88, 93, },
- { 12, -125, 12, 56, 100, -160, -87, -3, },
- { -7, -18, -7, -6, 36, -54, 175, -176, }
-};
-
-
-const Word16 W_DTX_HO_FX[HO_HIST_SIZE] = /* Q15 */
-{
- 6554, 5243, 4194, 3355, 2684, 2147, 1718, 344
-};
-
-
-const Word16 ENR_ATT_fx[5] = /*Q8*/
-{
- 459, 357, 281, 255, 255
-};
-
-
-const Word16 HO_ATT_FX[5] = /* Q15 */
-{
- 17597, 20205, 22410, 23198, 23198
-};
-
-const Word16 uniform_model[] = { MAX_AR_FREQ, MAX_AR_FREQ / 2, 0 }; // Q0
-
-
-/*-----------------------------------------------------------------*
- * LSF quantization - mid-frame quantization tables
- *-----------------------------------------------------------------*/
-
-
-const Word16 tbl_mid_gen_wb_2b_fx[] =//Q13
-{
- 3814, 5145, 5856, 5290, 5277, 4880, 4877, 4273, 3868, 3776, 3392, 3163, 3120, 3019, 3395, 5814,
- 1482, 861, 1968, 3198, 3105, 3737, 3749, 4525, 4982, 4828, 5023, 5335, 5327, 5296, 5092, 3444,
- 3955, 3851, 1520, 1666, 1554, 1385, 1537, 1276, 1443, 1526, 1597, 1636, 1867, 2041, 2483, 2059,
- 7038, 8112, 7324, 6969, 6877, 7028, 6987, 7098, 7003, 6955, 6927, 6808, 6685, 6459, 5871, 6047,
-};
-
-const Word16 tbl_mid_gen_wb_4b_fx[] =
-{//Q13
- 5532, 5133, 2125, 3516, 4905, 5624, 6338, 6918, 6854, 6354, 5345, 3996, 3603, 5588, 6962, 7511,
- 4218, 4157, 4892, 6332, 5786, 2931, 2749, 2306, 3420, 4629, 5591, 6249, 6638, 7273, 7904, 8379,
- 993, 369, 2927, 5138, 4840, 5892, 5331, 5158, 3956, 3130, 3324, 5022, 5292, 3974, 2488, 1119,
- 1067, 2471, 6356, 4184, 3166, 3224, 3980, 5055, 4965, 4822, 3843, 2328, 1438, 916, 2514, 8248,
- 3788, 949, 522, 1709, 1932, 3306, 3287, 4521, 5432, 5291, 5644, 6116, 6166, 5943, 5631, 2088,
- 7865, 8237, 6466, 4043, 3793, 4589, 4885, 5405, 6002, 6746, 7203, 7361, 6982, 6157, 3994, 2143,
- 2837, 7217, 7926, 7751, 7605, 7549, 6937, 6852, 6270, 5895, 5612, 5245, 4862, 3654, 3139, 6321,
- 4317, 3387, 1035, 2799, 2769, 3400, 3054, 2246, 2307, 1829, 1456, 1007, 1055, 895, 782, 108,
- 7164, 8021, 6869, 6458, 6311, 5505, 5577, 4491, 3934, 3760, 3244, 2798, 2498, 2166, 1950, 4759,
- 5758, 5400, 1203, 687, 647, 963, 1486, 2000, 2998, 3179, 3634, 4296, 4465, 3719, 3275, 4785,
- 1051, 1802, 6133, 6475, 6875, 6981, 7181, 7303, 7136, 7036, 7276, 7197, 6986, 7118, 6659, 5813,
- 4095, 6275, 6049, 4850, 3198, 4942, 3257, 1456, 1327, 504, 559, 1472, 3985, 5835, 5772, 7356,
- 6814, 7430, 4049, 2579, 4315, 2443, 3236, 3107, 2458, 2891, 2553, 1923, 1871, 2068, 3583, -188,
- 412, 238, 247, 507, 498, 540, 811, 767, 679, 480, 416, 306, 574, 532, 731, 2227,
- 8495, 9589, 8346, 7953, 7655, 7990, 8089, 8412, 8530, 8482, 8421, 8420, 8464, 8242, 7698, 7341,
- 3085, 2920, 3059, 3020, 1227, -101, -417, -872, -195, 1126, 1766, 2513, 2649, 3451, 4444, 1734
-};
-
-
-const Word16 tbl_mid_gen_wb_5b_fx[] =
-{//Q13
- 6510, 8058, 7103, 6095, 6483, 5866, 6026, 6443, 6882, 6907, 7015, 6581, 5649, 4044, 2816, 2519,
- 3778, 2123, 3580, 4221, 2598, 4631, 2844, 4905, 5446, 4529, 5186, 6228, 6210, 5693, 6213, -4670,
- 9050, 9934, 8441, 7921, 7546, 7840, 7977, 8335, 8679, 8706, 8703, 8607, 8560, 8375, 7759, 6405,
- 4243, 5775, 2939, 5887, 4078, 3117, 5267, 5680, 4589, 2401, 731, 1011, 1657, 4733, 7051, 3992,
- 2508, 3156, 3347, 1605, 4450, 4633, 3476, 6019, 4083, 3824, 5133, 6020, 3253, 1368, 1736, 13507,
- 5934, 6372, 4494, 2957, 4424, 6667, 8167, 8413, 7957, 7139, 5518, 3059, 2829, 2821, 2773, 3274,
- 4984, 5566, 5831, 4556, 5732, 6738, 6689, 4683, 2265, 4214, 7242, 9989, 9776, 9068, 4748, 2292,
- 2601, 4933, 2764, 4923, 3763, 3678, 5596, 2079, 6108, 6824, 5507, 5612, 6793, 5553, 1140, 9993,
- 7084, 6685, 5313, 5196, 3111, 5337, 3535, 2476, 2477, 1737, 2090, 4033, 5680, 6548, 7310, 11811,
- 8140, 8602, 7166, 6738, 6018, 5299, 5686, 4722, 4108, 4456, 3713, 3131, 2658, 2336, 2250, 8051,
- 727, 1865, 6073, 3932, 2258, 2413, 4823, 5733, 5101, 6126, 4690, 1130, 1172, 1479, 3956, 7204,
- 6042, 1024, 5371, 5997, 4964, 5575, 5078, 5843, 6909, 8465, 8601, 6137, 5699, 8049, 9922, 8318,
- 2728, 1625, 4750, 5004, 5799, 4938, 6353, 3274, 1781, 3095, 1479, 3136, 5470, 1391, -626, 2422,
- 4407, 3228, 1266, 1488, 1222, 963, 1148, 1182, 1330, 1770, 860, 381, 813, 1268, 2352, 3956,
- 1683, -120, 83, 1239, 946, 1609, 1982, 3215, 3950, 4200, 4497, 4898, 4551, 3595, 2345, 2444,
- 1055, 3207, 7460, 6808, 7103, 6980, 7902, 8196, 6821, 6190, 6405, 7414, 7967, 7506, 6921, 9871,
- 3164, 7995, 8446, 8770, 8443, 8302, 7372, 7049, 6090, 5698, 5090, 4792, 4996, 4874, 4285, 6685,
- 3681, 319, 536, 3174, 4495, 5486, 5807, 5751, 5461, 4423, 3556, 3449, 5148, 7560, 6277, 3783,
- 1987, 4209, 6954, 5880, 7459, 7762, 4326, 4958, 5154, 2150, 2988, 2469, 1175, 1099, 3999, 3950,
- 1306, 2303, 7748, 8238, 6116, 2824, 1772, 1130, 2538, 3345, 5317, 4773, 3668, 5458, 5519, 5594,
- 4140, 4329, 3339, 3001, 2669, -79, -582, -1729, -680, 1294, 2752, 3700, 3627, 4428, 4950, 2744,
- 5309, 3611, 993, 3526, 2043, 3938, 2069, 1434, 4173, 2609, 2704, 3690, 3686, 1894, 1401, -1682,
- 6091, 4810, 970, 1063, 1707, 3056, 4597, 6742, 7397, 6913, 7359, 7884, 7571, 6830, 6039, 3823,
- 6599, 6006, 1248, 4330, 6935, 3784, 3535, 3902, 3221, 5384, 5691, 5997, 5975, 6731, 9125, 5385,
- 204, 242, 2009, 3375, 3412, 3407, 2691, 2547, 598, -150, 67, 250, 618, 1185, 1987, 1157,
- 4986, 7977, 6971, 1528, 86, 281, 1497, 3002, 4193, 4430, 4721, 5317, 6001, 6181, 6962, 5480,
- 6914, 7963, 5254, 3050, 5365, 3224, 3781, 3044, 2571, 3155, 2243, 1612, 2157, 2526, 2784, -1629,
- 7350, 6702, 2435, 1937, 2549, 1978, 2819, 2817, 2059, 2493, 3408, 2344, 1239, 1177, 914, 3763,
- 4362, 3105, -1457, -1760, 314, 1452, 2603, 1642, 1670, 1652, 2258, 2492, 3844, 4399, 5213, 660,
- 350, 357, 109, 83, -555, -886, -714, -587, -120, 25, 189, 531, 591, 146, 156, 1435,
- 498, 211, 3062, 6766, 7150, 8142, 7531, 7527, 7855, 6898, 6613, 6480, 5290, 4310, 5341, 4129,
- 2753, 6959, 7088, 4622, 2646, 2395, 1756, 325, 488, 259, -125, -577, -553, 615, 557, 4617,
-};
-
-
-
-const Word16 tbl_mid_voi_wb_1b_fx[] = /* Q13*/
-{
- 4551, 4599, 4754, 5035, 4982, 5228, 5318, 5603, 5699, 5652, 5642, 5766, 5825, 5874, 5819, 6056,
- 3816, 3355, 2321, 2712, 2900, 2715, 2790, 2508, 2506, 2610, 2617, 2419, 2538, 2622, 3004, 2725,
-};
-const Word16 tbl_mid_voi_wb_4b_fx[] =//Q13
-{
- 4337, 4235, 3526, 4083, 3514, 5457, 3168, 2509, 4418, 5021, 1313, 2952, 5347, 3893, 8325, 11758,
- 4180, 4037, 3965, 3481, 4028, 3284, 2644, 4585, 4749, 3076, 3211, 1101, 4175, 7440, 5745, -4105,
- 4239, 3957, 4450, 4974, 5400, 5734, 6246, 6586, 7774, 2699, 2783, 3474, 1345, -316, 5069, 4904,
- 3964, 3810, 2673, 3031, 2249, 3168, 3155, 4204, 7316, 7176, 8680, 7147, 4918, 4136, 3142, 3011,
- 4071, 3853, 3898, 3973, 3464, 2878, 5783, 5341, 1725, 801, 1194, 4239, 6866, 4950, 794, 6270,
- 3933, 3750, 4931, 3667, 3585, 2550, 4308, 5757, 4503, 7081, 4893, 1076, 109, 1650, 1887, 8861,
- 4803, 4827, 4969, 5511, 5768, 4327, 5277, 4934, 6909, 7672, 5355, 3940, 9990, 9622, 7457, 4202,
- 4515, 4259, 2444, 4847, 3728, 4599, 4975, 6144, 4087, 4367, 7025, 5028, 2405, 7014, 13366, 6264,
- 4746, 4556, 5408, 5866, 4733, 4088, 3965, 3329, 4669, 3105, 5918, 7824, 6026, 9177, 1856, 13229,
- 4130, 4214, 2516, 3542, 4847, 3751, 3704, 2380, 4190, 4787, 4651, 4981, 5702, -27, -2961, 129,
- 4461, 4724, 5233, 4680, 6010, 7222, 6351, 3069, 605, 5934, 5627, 3836, 3490, 6060, 3556, 2585,
- 4628, 4723, 5465, 4180, 4460, 6173, 5915, 7260, 4703, 4114, 3938, 9585, 8085, 3781, 7520, 625,
- 5002, 5621, 6352, 6914, 7170, 7719, 7585, 8408, 8360, 7883, 7370, 7222, 6616, 6002, 5565, 9394,
- 4059, 4121, 4178, 4417, 3437, 1460, 1031, 111, 585, 1708, 4219, 5419, 2585, 3195, 6149, 3221,
- 3394, 2776, 1970, 2707, 2983, 3931, 3247, 1729, 449, -109, -46, -469, 397, 1980, 2305, 1573,
- 3259, 1870, 242, 392, 748, 615, 1185, 1285, 2259, 2687, 2212, 1762, 2174, 1887, 1847, 2073,
-};
-const Word16 tbl_mid_voi_wb_5b_fx[] =//Q13
-{
- 4182, 3820, 4103, 5620, 4100, 4478, 3949, 5053, 2918, 3083, 4229, 3732, 1823, 6350, 17230, 4601,
- 4361, 4077, 2236, 4128, 3216, 4673, 6022, 6522, 5746, 4282, 3121, 4448, 6457, 12573, 4401, 7796,
- 4228, 4086, 4375, 4320, 4474, 4735, 4427, 5616, 5975, 138, 5887, 3722, 2304, -3430, 4995, 6246,
- 4320, 4344, 4008, 4327, 3323, 6835, 3627, 3330, 3123, 3971, 2382, 1801, 6422, 3162, 9038, 14129,
- 4193, 4202, 4413, 2703, 4175, 4330, 2615, 7600, 1717, 3506, 5671, 7170, 3545, 2350, -2738, 7287,
- 4170, 3912, 4323, 3821, 4450, 6765, 7496, 8107, 7447, 5525, 3088, 1963, 2014, 3330, 976, 1002,
- 4583, 4419, 3584, 4125, 4783, 5133, 3188, 5000, 4812, 4639, 10038, 7018, 5114, 5567, 3292, -6364,
- 3926, 4092, 2710, 2721, 1799, 3509, 4542, 3351, 4583, 5877, 6539, 5135, 981, 4029, 7221, 592,
- 4624, 4567, 4468, 4630, 5710, 5222, 5883, 2562, 8453, 2825, 109, 6491, 1210, 2921, 7292, 7118,
- 4245, 4160, 5119, 4356, 5544, 3034, 1507, 4179, 5971, 1949, 3388, 613, 4995, 9019, 6755, -628,
- 4905, 4962, 4529, 7025, 4905, 4470, 5063, 3440, 6348, 6102, 4319, 4395, 7515, 6549, -3697, 6513,
- 4683, 4592, 5303, 4593, 4171, 5264, 6116, 7434, 4105, 5454, 2544, 8493, 6491, 894, 8983, -2406,
- 3632, 3435, 3988, 4195, 3684, 2173, 6735, 4552, -339, 763, 308, 3463, 6123, 2895, 2831, 5715,
- 4316, 4111, 2236, 2682, 1058, 544, 2541, 1677, 3549, 2767, 3376, 5901, 6689, 5811, 6617, 3311,
- 4487, 4285, 4992, 3656, 5970, 4547, 3975, 5998, 4985, 6614, 4807, 1971, 14937, 4388, 6153, 3352,
- 4601, 4710, 4957, 4454, 4873, 7207, 5881, 3461, 2282, 1829, 5617, 9926, 10043, 7722, 3232, 4629,
- 3965, 3837, 2088, 4265, 5042, 3478, 4453, 2804, 4162, 4858, 4315, 4343, 5193, -1823, -5028, -1137,
- 3439, 2837, 2549, 4062, 2857, 2657, 2662, 5088, 10548, 8913, 6631, 6395, 5568, 3210, 2431, 3400,
- 4073, 3839, 5806, 5296, 3766, 2342, 2585, 891, 3144, 2988, 6807, 4626, 3700, 5854, 1543, 16158,
- 4189, 4045, 4293, 4527, 4008, 1413, 4871, 6081, 3297, 6546, 5006, -365, -2369, 1375, 5522, 8787,
- 4778, 4782, 4941, 4538, 4497, 3129, 4934, 4371, 7175, 6923, 8620, 10236, 8664, 10088, 10923, 7314,
- 4945, 5016, 6439, 6353, 6624, 6463, 6938, 7547, 7004, 7283, 7655, 7149, 7650, 2747, 3416, 14892,
- 4776, 5431, 5515, 6194, 5700, 5485, 2795, 5476, 4024, 8891, 2930, 7916, 3428, 8070, 5920, 13440,
- 4718, 4986, 4800, 5286, 6567, 6554, 6601, 1235, -1216, 6556, 6098, 3962, 4361, 5536, 5517, 3935,
- 4741, 4679, 5593, 4891, 3849, 5675, 6487, 6239, 7062, 12044, 10918, 2438, 3977, 7296, 8445, 6625,
- 4859, 5781, 6592, 7399, 8027, 8858, 8139, 8951, 8760, 5506, 6294, 6540, 6516, 7527, 7688, 4084,
- 4077, 3771, 3650, 3381, 3367, 4048, 3899, 4382, 3017, -2156, -1464, -2207, 828, 4838, 2071, 2363,
- 3796, 3437, 3558, 3842, 2170, 4311, 2602, 696, 1939, 2576, 1239, 328, -129, -647, 1702, 2893,
- 4015, 3506, 367, 1350, 3328, 3700, 3827, 2439, 1434, 3887, 2279, 1593, 3673, 5508, 3905, -2973,
- 4088, 3990, 3732, 3256, 4718, 1375, 152, -99, -254, 1140, 3578, 3316, 2195, 2408, 5027, 999,
- 3749, 3175, 1475, 686, 2006, 1959, 1558, 3059, 5374, 5014, 2439, 2396, 2467, 2218, 1031, 7866,
- 2037, 701, 124, 278, 328, 253, 660, 528, 826, 473, 801, 800, 1053, 1330, 804, 967,
-};
-
-
-const Word16 tbl_mid_unv_wb_4b_fx[] =//Q13
-{
- 5190, 3143, 50, 2521, 5180, 6320, 3890, 3365, 3582, 3517, 3406, 3049, 2864, 1621, 1932, -950,
- 6813, 6650, 2135, 972, 452, 1453, 3221, 1697, 3165, 4443, 5924, 6297, 3907, 2862, 3586, 4625,
- 3204, 2673, 6499, 4319, 1054, 559, 4404, 5815, 5072, 6625, 4493, 2479, 1773, 1606, 2099, 8330,
- 1924, 2666, 4171, 5517, 5898, 7238, 7318, 7696, 7250, 6269, 6164, 6038, 5249, 4284, 4147, 2828,
- 2834, 788, 77, 2016, 1824, 3224, 3441, 4472, 6286, 6717, 6783, 6743, 6715, 7051, 6562, 2531,
- 6386, 5634, 5761, 5184, 3523, 4284, 1867, 1045, 579, 1176, 1743, 2599, 5276, 5564, 5368, 7914,
- 1795, 1380, 5184, 9326, 8023, 3138, 1258, 1729, 3328, 3934, 5169, 5645, 5271, 5894, 5591, 5145,
- 5734, 5844, 8799, 8753, 5628, 5710, 5255, 4872, 5349, 3431, 3006, 2486, 1418, 974, 1115, 2035,
- 4194, 8421, 1812, 6078, 3003, 3455, 6719, 7501, 2120, 1892, 2658, 2317, 2296, 5735, 6553, 4485,
- 8072, 11456, 6455, 5069, 4918, 4936, 4819, 4932, 6029, 6246, 6289, 6704, 6749, 5337, 4526, 3974,
- 3709, 5584, 4884, -1502, 4864, 2333, 606, 5976, 6438, 2413, 1937, 3663, 5593, 6989, 6450, 3555,
- 3843, -6887, 3697, 3880, 4448, 4264, 5961, 4198, 3583, 3942, 3606, 3768, 4457, 4374, 4096, 4524,
- 2551, 6781, 7017, 2902, 9227, 8728, 7130, 1873, 2308, 4393, 3981, 3976, 4002, 4080, 4820, 5611,
- 220, -174, -43, -542, 449, 1470, 1759, 1893, 1294, 995, 723, 723, 769, 994, 1369, 4413,
- 1651, 2259, 3079, 2913, 1176, -491, -1262, -827, -217, 908, 1126, 1751, 1901, 1765, 2656, 247,
- 5380, 7307, 7727, 8135, 8270, 8471, 8792, 8573, 8335, 8420, 8057, 7562, 7119, 7458, 6806, 7385,
-};
-const Word16 tbl_mid_unv_wb_5b_fx[] =
-{//Q13
- 6237, 6323, 1151, 763, 4218, 6546, 8437, 8701, 7456, 6604, 4631, 2901, 3050, 1793, 1955, 2260,
- 5542, 4318, 5343, 5521, 5999, 5477, 5265, 5234, 4616, 3329, 3444, 1816, -442, 45, -2, 8922,
- 6370, 8208, 6583, 5630, 5401, 5458, 5188, 5595, 6637, 6891, 6962, 6967, 7014, 6330, 5445, 3101,
- 2750, 2858, 5206, 4594, 3310, 3494, 2463, 3410, 3405, 6151, 7682, 8593, 4440, 3715, 2946, -4371,
- 1157, 661, 3743, 6418, 7515, 8319, 7485, 7298, 7928, 7515, 6812, 5671, 5095, 5122, 4997, 3940,
- 5133, 3446, 2693, 1620, 1860, 2663, 4603, 6289, 7451, 7255, 7511, 7486, 8869, 8704, 8431, 6632,
- 2497, 6706, 7036, 3437, 10854, 8893, 6033, 3021, 2936, 4766, 4145, 4097, 5177, 4883, 5920, 7612,
- -152, -54, 3955, 1170, 5562, 4695, 1370, 8293, 3106, 1942, 5508, 4878, 3495, 1094, 1079, 5401,
- 482, 373, 220, -355, -236, -328, -426, -147, 244, 563, 567, 915, 1012, 676, 804, 2721,
- 437, 816, 3208, 3395, 2501, 3795, 4380, 2553, 399, 31, -519, -475, -162, 1755, 2852, 1040,
- 2067, 2125, 1247, 2393, 2872, 2218, 3502, 3977, 4712, 4275, 2600, 2380, 2314, 2893, 3555, 13929,
- 3967, -635, -1752, 2490, 303, 969, 1045, 2839, 5670, 4651, 5202, 5248, 4182, 4381, 5492, 53,
- 3041, 2494, 9264, 4970, 360, -3795, 6296, 6475, 4482, 6667, 5265, 2908, 2381, 2889, 3718, 5160,
- 3364, 4119, 5929, 3164, -745, 9368, 1652, -719, 6323, 5113, 1919, 1260, 2630, 3585, 2224, 3178,
- 1643, 837, 8074, 8337, 4237, 2332, 2190, -1176, 1968, 1238, 2354, 4756, 5269, 5759, 4962, 5411,
- 7590, 6471, 2635, 1869, 1209, 1505, 2118, 892, 1652, 3717, 5010, 3969, 2265, 2428, 3278, 5027,
- 7289, 8658, 11183, 8913, 6084, 6673, 5961, 4041, 3839, 2643, 2094, 3215, 2956, 2895, 3327, 5063,
- 5814, -4982, 1120, 2112, 4384, 5288, 6052, 4305, 4724, 5062, 3380, 4200, 5838, 7181, 6383, 4771,
- 3891, 7361, 4160, 1422, 4971, 939, 281, 3585, 4817, 1176, -306, 260, 3815, 8273, 7095, 1529,
- 8179, 19416, 3518, 3547, 4619, 4231, 3359, 3606, 5131, 4469, 5204, 5115, 4941, 4772, 4175, 5160,
- 4539, 5393, 2706, 5371, 1468, 8488, 10356, 2778, 1426, 371, 8093, 7808, 5208, 5996, 6081, 5057,
- 3266, 3481, -4953, -5638, 4022, 5502, 3586, 3117, 2737, 3826, 3658, 3933, 3602, 4920, 4959, 3483,
- 3846, 9592, 3360, 6480, 1215, 3170, 5218, 8641, 664, 2695, 3353, 1479, 1687, 6049, 7074, 4696,
- 2231, 4497, 6761, 6799, 5941, 5445, 8083, 7944, 5879, 3744, 2518, 6482, 6581, 6096, 6379, -133,
- 3360, 6078, 1064, 13807, 8185, 3605, 4327, 3777, 6211, 4977, 5015, 4871, 5825, 2506, 2130, 4946,
- 5412, 4507, 952, 4098, 5027, 3949, 3501, 1778, 1955, 2126, 1626, 3669, 4446, -1101, 736, -2708,
- 4824, 7481, 8884, -2619, -2754, 281, 4158, 3251, 4602, 2946, 3915, 6169, 6075, 3495, 3266, 4375,
- 6135, 2668, 6784, 10326, 6892, 5479, 1511, 3070, 6410, 9193, 6954, 1084, 2873, 7030, 8139, 5670,
- 7255, 5764, 5122, 5787, 3129, 5475, -2720, 3770, -827, 872, 1591, 4645, 7218, 5513, 5778, 6323,
- 1185, -13100, 5560, 5867, 4153, 2591, 4923, 3450, 2062, 4251, 4289, 3397, 3835, 2082, 2343, 3172,
- 4460, 4411, 3940, 4420, 9410, -2789, -2525, -2877, -1868, 2850, 4490, 4093, 3162, 3889, 3800, 3492,
- 6408, 8292, 8434, 8544, 8707, 9146, 9377, 9301, 9063, 8945, 8346, 8173, 7175, 7254, 6120, 7420,
-};
-
-
-/*------------------------------------------------------------------------------*
- * AVQ - RE8 tables
- *------------------------------------------------------------------------------*/
-
-const Word16 select_table22[5][9] =
-{
- {1, 1, 1, 1, 1, 1, 1, 1, 1},
- {0, 1, 2, 3, 4, 5, 6, 7, 8},
- {0, 0, 1, 3, 6, 10, 15, 21, 28},
- {0, 0, 0, 1, 4, 10, 20, 35, 56},
- {0, 0, 0, 0, 1, 5, 15, 35, 70}
-}; // Q0
-
-/* value of leader element */
-const Word16 vals_a[36][4] =
-{
- {1}, {0,2}, {0,2}, {1,3}, {0,4}, {2,0}, {1,3}, {0,2,4},
- {2}, {1,3}, {2,0,4}, {0,4}, {1,5}, {1,3}, {2,0,4}, {0,2,4},
- {1,3,5}, {0,2,6}, {0,4}, {0,2,6}, {0,2,4,6}, {1,7}, {0,8}, {0,6},
- {0,2,8}, {0,4,8}, {1,9}, {0,2,10}, {0,8}, {0,6,10}, {0,12}, {0,4,12},
- {0,10}, {0,2,14}, {0,8,12}, {0,16}
-}; // Q0
-
-/* code parameter for every leader */
-const Word16 vals_q[36][4] =
-{
- {7,1}, {2,2,2}, {4,2,4}, {7,2,1}, {1,2,1}, {6,2,2}, {7,2,2}, {3,3,3,1},
- {8,1}, {7,2,3}, {5,3,4,1}, {2,2,2}, {7,2,1}, {7,2,4}, {7,3,2,1}, {4,3,4,2},
- {7,3,2,1}, {2,3,2,1}, {3,2,3}, {4,3,4,1}, {3,4,3,2}, {7,2,1}, {1,2,1}, {2,2,2},
- {3,3,3,1}, {2,3,2,1}, {7,2,1}, {2,3,2,1}, {2,2,2}, {2,3,2,1}, {1,2,1}, {2,3,2,1},
- {2,2,2}, {2,3,2,1}, {2,3,2,1}, {1,2,1}
-}; // Q0
-
-/* codebook start address for every leader */
-const UWord16 Is[36] =
-{
- 0, 128, 256, 1376, 240, 0, 1792, 2400, 5376, 5632, 12800, 3744,
- 21760, 22784, 31744, 38912, 45632, 3856, 52800, 53248, 57728, 60416, 4080, 61440,
- 61552, 62896, 63120, 64144, 64368, 64480, 64704, 64720, 64944, 65056, 65280, 65504
-}; // Q0
-
-/* A3 - Number of the absolute leaders in codebook Q3 */
-const Word16 AA3[NB_LDQ3] =
-{
- 0, 1, 4, 2, 3, 7, 11, 17, 22
-}; // Q0
-
-/* A4 - Number of the absolute leaders in codebook Q4 */
-const Word16 AA4[NB_LDQ4] =
-{
- 5, 6, 8, 9, 10, 12, 13, 14, 15,
- 16, 18, 19, 20, 21, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35
-}; // Q0
-
-/* I3 - Cardinality offsets for absolute leaders in Q3 */
-const UWord16 II3[NB_LDQ3] =
-{
- 0, 128, 240, 256, 1376, 2400, 3744, 3856, 4080
-}; // Q0
-
-/* I4 - Cardinality offset for absolute leaders in Q4 */
-const UWord16 II4[NB_LDQ4] =
-{
- 0, 1792, 5376, 5632, 12800, 21760, 22784, 31744, 38912,
- 45632, 52800, 53248, 57728, 60416, 61440, 61552, 62896, 63120,
- 64144, 64368, 64480, 64704, 64720, 64944, 65056, 65280, 65504
-}; // Q0
-
- /* Position of the first absolute leader on a spherical shell (or sphere) */
-const Word16 Da_pos[NB_SPHERE] =
-{
- 0, 2, 5, 8, 13, 18, 20, 22, 23, 25, 26, 27, 27, 28, 28, 28,
- 29, 30, 31, 31, 32, 32, 32, 32, 32, 34, 35, 35, 35, 35, 35, 35
-}; // Q0
-
-/* Number of absolute leaders on a spherical shell */
-const Word16 Da_nb[NB_SPHERE] =
-{
- 2, 3, 3, 5, 5, 2, 2, 1, 2, 1, 1, 0, 1, 0, 0, 1,
- 1, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1
-}; // Q0
-
-/* Identification code of an absolute leader */
-const Word16 Da_id[NB_LEADER] =
-{
- 0x0001, 0x0004, 0x0008, 0x000B, 0x0020, 0x000C, 0x0015, 0x0024,
- 0x0010, 0x001F, 0x0028, 0x0040, 0x004F, 0x0029, 0x002C, 0x0044,
- 0x0059, 0x00A4, 0x0060, 0x00A8, 0x00C4, 0x012D, 0x0200, 0x0144,
- 0x0204, 0x0220, 0x0335, 0x04E4, 0x0400, 0x0584, 0x0A20, 0x0A40,
- 0x09C4, 0x12C4, 0x0C20, 0x2000
-}; // Q0
-
-/* Codebook number for each absolute leader */
-const Word16 Da_nq[NB_LEADER+2] =
-{
- 2, 2, 3, 3, 2, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 4,
- 4, 3, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 0, 100
-}; // Q0
-
-
-/*------------------------------------------------------------------------------*
- * SWB TBE tables
- *------------------------------------------------------------------------------*/
-
-const Word16 skip_bands_SWB_TBE[NUM_SHB_SUBFR+1] = {0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320}; /* bands for SWB TBE quantisation Q0*/
-const Word16 skip_bands_WB_TBE[NUM_SHB_SUBFR/2+1] = {0, 10, 20, 30, 40, 50, 60, 70, 80}; /* bands for WB TBE quantisation Q0*/
-
-const Word16 interpol_frac_shb[NB_SUBFR * 2] =
-{
- 22938, 9830, 13107, 19660, 3277, 29490, 0, 32767 /* Q15*/
- /*0.7f, 0.3f, 0.4f, 0.6f, 0.1f, 0.9f, 0.0f, 1.0f */
-};
-/* All pass filter coeffs for interpolation and decimation by a factor of 2 */
-const Word16 AP1_STEEP_FX[ALLPASSSECTIONS_STEEP] = { 1985, 14072, 26500 }; /*Q15 Format */
-const Word16 AP2_STEEP_FX[ALLPASSSECTIONS_STEEP] = { 7230, 20838, 30852 }; /*Q15 Format */
-const Word16 cos_fb_exc_fx[32] = /* Q15 */
-{
- /*Q35*/
- 32767, 32138, 30274, 27246, 23170, 18205, 12540, 6393,
- 0, -6393, -12540, -18205, -23170, -27246, -30274, -32138,
- -32768, -32138, -30274, -27246, -23170, -18205, -12540, -6393,
- 0, 6393, 12540, 18205, 23170, 27246, 30274, 32138,
-};
-
-const Word16 Hilbert_coeffs_fx[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1] = /* Q14 */
-{
- { 0, 14320, 0, -30699, 0, 16384}, /* num_Real[0] */
- {11897, 0, -28240, 0, 16384, 0}, /* num_Imag[0] */
- {16384, 0, -30699, 0, 14320, 0}, /* den_Real[0] */
- {16384, 0, -28240, 0, 11897, 0}, /* den_Imag[0] */
- {7671, 0, -23855, 0, 16384, 0}, /* num_Real[1] */
- { 2505, 0, -18139, 0, 16384, 0}, /* num_Imag[1] */
- {16384, 0, -23855, 0, 7671, 0}, /* den_Imag[1] */
- {16384, 0, -18139, 0, 2505, 0}, /* den_Imag[1] */
-};
-
-
-/* Overlap add window for SHB excitation used in analysis and synthesis */
-
-const Word16 window_shb_fx[L_SHB_LAHEAD] = /*sin, 1, sin */
-{
- /*Q15(round) */
- 1513, 4527, 7502, 10413, 13236, 15945, 18518, 20934, 23170, 25210,
- 27034, 28627, 29976, 31069, 31898, 32454, 32733, 32767, 32767, 32767,
-};
-
-/* Upsampled overlap add window for SHB excitation used transition generation */
-
-const Word16 window_shb_32k_fx[2 * L_SHB_LAHEAD] =
-{
- /*Q15(round) */
- 1513, 3020, 4527, 6015, 7502, 8958, 10413, 11825, 13236, 14590,
- 15945, 17232, 18518, 19726, 20934, 22052, 23170, 24190, 25210, 26122,
- 27034, 27830, 28627, 29301, 29976, 30523, 31069, 31483, 31898, 32176,
- 32454, 32593, 32733, 32751, 32767, 32767, 32767, 32767, 32767, 32767,
-};
-
-/* Short overlap add window for SHB excitation used in anal and synth */
-
-const Word16 subwin_shb_fx[SHB_OVERLAP_LEN + 1] =
-{
- /*Q15(round) */
- 0, 202, 802, 1786, 3129,
- 4799, 6754, 8946, 11321, 13821,
- 16384,18947, 21447, 23822, 26014,
- 27969, 29639, 30982, 31966, 32566,
- 32767
-};
-
-const Word16 window_wb_fx[L_SHB_LAHEAD / 4] =/*sin, 1 */
-{ 7502, 18518, 27034, 31898, 32767 }; /*Q15*/
-
-/* Short overlap add window for SHB excitation used in anal and synth */
-
-const Word16 subwin_wb_fx[SHB_OVERLAP_LEN / 2 + 1] =
-{ 0, 5126, 10126, 14876, 19261, 23170, 26510, 29197, 31164, 32365, 32767 }; // Q15
-
-/* Window for calculating SHB LPC coeffs */
-
-const Word16 win_lpc_shb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 8] =
-{
- /*Q15 */
- 1, 4, 10, 18, 28, 40, 54, 71, 89, 110, 134, 159, 186, 216, 248,
- 282, 318, 357, 397, 440, 485, 532, 581, 632, 686, 741, 799, 859, 921,
- 984, 1050, 1119, 1189, 1261, 1335, 1411, 1490, 1570, 1652, 1736, 1823,
- 1911, 2001, 2093, 2187, 2283, 2381, 2481, 2582, 2686, 2791, 2898, 3007,
- 3118, 3230, 3345, 3461, 3579, 3698, 3819, 3942, 4067, 4193, 4321, 4451,
- 4582, 4715, 4849, 4985, 5123, 5261, 5402, 5544, 5687, 5832, 5978, 6126,
- 6275, 6426, 6577, 6730, 6885, 7041, 7197, 7356, 7515, 7676, 7837, 8000,
- 8164, 8329, 8496, 8663, 8831, 9001, 9171, 9342, 9515, 9688, 9862, 10037,
- 10213, 10390, 10567, 10745, 10924, 11104, 11285, 11466, 11648, 11830, 12013,
- 12197, 12381, 12566, 12751, 12937, 13123, 13310, 13497, 13684, 13872, 14060,
- 14249, 14438, 14627, 14816, 15006, 15195, 15385, 15575, 15765, 15955, 16146,
- 16336, 16526, 16716, 16907, 17097, 17287, 17477, 17667, 17856, 18046, 18235,
- 18424, 18612, 18801, 18989, 19176, 19364, 19551, 19737, 19923, 20109, 20294,
- 20478, 20662, 20846, 21028, 21210, 21392, 21573, 21753, 21932, 22111, 22289,
- 22466, 22642, 22818, 22992, 23166, 23339, 23510, 23681, 23851, 24020, 24188,
- 24355, 24520, 24685, 24848, 25011, 25172, 25332, 25491, 25648, 25804, 25960,
- 26113, 26266, 26417, 26567, 26715, 26862, 27007, 27152, 27294, 27435, 27575,
- 27713, 27850, 27985, 28119, 28251, 28381, 28510, 28637, 28762, 28886, 29008,
- 29129, 29248, 29364, 29480, 29593, 29705, 29815, 29923, 30029, 30133, 30236,
- 30337, 30435, 30532, 30627, 30720, 30811, 30901, 30988, 31073, 31156, 31238,
- 31317, 31394, 31469, 31543, 31614, 31683, 31750, 31815, 31878, 31938, 31997,
- 32054, 32108, 32161, 32211, 32259, 32305, 32349, 32390, 32430, 32467, 32502,
- 32535, 32566, 32595, 32621, 32645, 32667, 32687, 32705, 32720, 32734, 32745,
- 32753, 32760, 32765, 32767
-};
-
-
-const Word16 win_lpc_hb_wb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 32] =
-{//Q15
- 17, 70, 157, 279, 435, 625, 849, 1106,
- 1396, 1718, 2071, 2454, 2867, 3309, 3779, 4276,
- 4799, 5346, 5917, 6510, 7125, 7759, 8411, 9081,
- 9766, 10465, 11177, 11900, 12633, 13373, 14120, 14872,
- 15627, 16384, 17141, 17896, 18648, 19395, 20135, 20868,
- 21591, 22303, 23002, 23687, 24357, 25009, 25643, 26258,
- 26851, 27422, 27969, 28492, 28989, 29459, 29901, 30314,
- 30697, 31050, 31372, 31662, 31919, 32143, 32333, 32489,
- 32611, 32698, 32751
-};
-
-const Word16 win_lpc_hb_wb_ivas_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 32] =
-{//Q15
- 6, 51, 140, 274,
- 453, 675, 940, 1247,
- 1596, 1985, 2414, 2882,
- 3386, 3926, 4499, 5106,
- 5743, 6410, 7104, 7823,
- 8566, 9331, 10114, 10915,
- 11731, 12559, 13398, 14245,
- 15099, 15955, 16813, 17669,
- 18523, 19370, 20209, 21037,
- 21853, 22654, 23437, 24202,
- 24945, 25664, 26358, 27025,
- 27662, 28269, 28842, 29382,
- 29886, 30354, 30783, 31172,
- 31521, 31828, 32093, 32315,
- 32494, 32628, 32717, 32762
-};
-
-
-const Word16 ola_win_shb_switch_fold_fx[L_SUBFR16k] =
-{//Q15
- 322, 965, 1608, 2250, 2892, 3532, 4171, 4808,
- 5444, 6077, 6708, 7336, 7962, 8585, 9204, 9819,
- 10431, 11039, 11643, 12242, 12836, 13426, 14010, 14589,
- 15162, 15730, 16291, 16846, 17395, 17937, 18472, 18999,
- 19520, 20033, 20538, 21035, 21525, 22006, 22478, 22942,
- 23397, 23843, 24279, 24707, 25125, 25533, 25931, 26320,
- 26698, 27066, 27423, 27770, 28106, 28431, 28746, 29049,
- 29341, 29622, 29891, 30149, 30395, 30630, 30853, 31063,
- 31262, 31449, 31624, 31786, 31936, 32074, 32200, 32313,
- 32413, 32501, 32577, 32640, 32691, 32729, 32754, 32766
-};
-
-/* Window for calculating whitening filter for SHB excitation */
-
-const Word16 win_flatten_fx[L_FRAME16k / 2] = /*Q15 */
-{
- 3, 13, 28, 50, 78, 113, 154, 200, 254, 313,
- 378, 450, 528, 611, 701, 797, 899, 1006, 1120, 1239,
- 1365, 1496, 1632, 1775, 1923, 2076, 2235, 2400, 2569, 2745,
- 2925, 3110, 3301, 3496, 3697, 3902, 4112, 4327, 4546, 4770,
- 4999, 5232, 5469, 5710, 5955, 6205, 6458, 6715, 6976, 7240,
- 7508, 7779, 8054, 8331, 8612, 8896, 9183, 9472, 9764, 10059,
- 10356, 10655, 10956, 11260, 11566, 11873, 12182, 12493, 12805, 13119,
- 13434, 13750, 14067, 14385, 14703, 15023, 15342, 15663, 15983, 16304,
- 16625, 16945, 17265, 17586, 17905, 18224, 18542, 18860, 19176, 19492,
- 19806, 20119, 20431, 20741, 21049, 21355, 21660, 21963, 22263, 22561,
- 22857, 23150, 23441, 23729, 24014, 24297, 24576, 24852, 25125, 25395,
- 25661, 25923, 26182, 26437, 26689, 26936, 27179, 27418, 27653, 27884,
- 28110, 28332, 28549, 28761, 28969, 29172, 29370, 29563, 29751, 29934,
- 30112, 30284, 30451, 30613, 30769, 30920, 31065, 31205, 31338, 31467,
- 31589, 31705, 31816, 31921, 32020, 32113, 32199, 32280, 32355, 32423,
- 32486, 32542, 32592, 32636, 32673, 32704, 32730, 32748, 32761, 32767
-};
-
-const Word16 win_flatten_4k_fx[L_FRAME16k / 8] = /*Q15 */
-{
- 13, 114, 315, 615, 1013, 1505, 2089, 2761,
- 3517, 4353, 5263, 6241, 7282, 8378, 9525, 10713,
- 11937, 13188, 14458, 15741, 17027, 18310, 19580, 20831,
- 22055, 23243, 24390, 25486, 26527, 27505, 28415, 29251,
- 30007, 30679, 31263, 31755, 32153, 32453, 32654, 32755
-};
-
-const Word16 wb_bwe_lsfvq_cbook_8bit_fx[256 * 6] =
-{//Q15
- 2107, 3430, 5123, 6677, 9403, 13197,
- 4031, 5069, 7343, 8910, 10647, 12245,
- 2037, 3542, 6708, 8763, 10505, 12655,
- 5732, 6373, 7912, 9546, 12584, 14230,
- 2028, 3337, 5473, 7880, 10269, 12450,
- 5809, 6497, 8317, 9624, 11497, 14007,
- 2428, 3962, 5675, 7724, 11361, 13385,
- 6348, 8307, 8898, 9948, 11058, 13350,
- 3552, 4421, 5896, 7143, 9975, 13233,
- 5719, 6344, 7482, 8403, 10765, 13455,
- 3509, 4379, 5896, 7437, 11765, 14307,
- 4521, 8122, 8791, 9856, 11232, 14020,
- 2175, 3970, 7788, 9803, 11334, 12910,
- 4511, 8156, 8886, 10450, 12686, 14959,
- 4223, 5285, 7053, 8423, 11317, 14566,
- 7159, 8379, 9040, 10122, 11799, 14270,
- 1866, 3064, 4848, 7227, 11225, 13963,
- 5915, 6631, 8740, 10002, 11385, 12726,
- 3342, 4547, 6475, 9404, 11994, 13418,
- 6156, 6880, 8932, 10353, 12380, 13746,
- 2648, 4972, 7575, 9476, 12117, 13875,
- 5822, 6526, 8747, 10941, 12671, 13971,
- 4032, 5110, 7592, 9267, 11374, 14390,
- 6864, 8384, 9086, 10649, 12944, 15026,
- 3661, 4636, 6668, 8329, 10374, 12185,
- 5802, 6444, 8344, 9811, 12234, 14843,
- 3593, 4436, 6663, 8693, 11539, 14272,
- 5110, 8270, 9006, 10703, 12269, 13901,
- 1992, 3229, 5616, 9085, 11419, 13254,
- 4319, 5859, 9602, 11396, 12836, 14199,
- 3836, 4822, 8285, 10190, 11728, 13302,
- 8016, 8698, 10179, 11434, 12944, 14783,
- 1891, 3329, 6168, 8307, 10818, 14213,
- 5803, 6442, 7973, 9131, 11090, 12657,
- 2803, 5499, 8093, 9694, 11223, 12849,
- 6222, 6981, 8615, 9848, 12016, 13380,
- 2543, 4747, 7638, 9373, 11129, 13652,
- 5912, 6615, 9006, 10553, 11959, 13312,
- 3604, 4520, 7650, 9833, 12161, 14748,
- 7970, 8729, 9780, 10789, 12483, 13985,
- 3793, 4716, 7041, 8547, 10610, 13601,
- 5640, 6235, 7313, 8370, 12057, 14300,
- 3765, 4699, 6784, 9512, 12663, 14216,
- 4634, 8363, 9195, 10385, 11477, 13310,
- 2462, 4816, 8556, 10394, 11920, 13468,
- 3698, 7974, 9207, 10962, 13507, 15208,
- 3738, 4667, 7545, 10775, 13024, 14559,
- 7267, 8610, 9509, 11264, 12821, 14495,
- 2624, 4295, 6173, 8897, 12343, 14174,
- 6324, 7135, 8742, 10013, 12598, 14108,
- 4448, 5839, 8842, 10335, 11737, 13071,
- 6147, 6988, 9510, 10893, 12240, 13535,
- 3025, 5140, 7152, 9223, 11404, 13255,
- 5985, 6782, 9611, 11341, 12723, 14007,
- 4679, 5958, 8100, 9842, 11835, 13492,
- 7740, 8565, 9432, 10478, 12611, 14609,
- 3830, 4784, 7681, 9528, 11134, 12675,
- 5742, 6527, 8359, 10728, 13195, 14626,
- 4491, 5635, 7284, 8749, 11594, 13785,
- 6772, 8490, 9253, 10943, 12476, 13973,
- 2024, 3588, 7524, 10453, 12198, 13858,
- 5783, 8882, 9978, 11763, 13237, 14829,
- 3979, 5009, 8342, 10323, 12231, 14313,
- 8148, 8903, 10193, 11350, 13246, 14490,
- 2297, 3810, 5638, 7265, 9162, 11514,
- 5809, 6518, 7832, 8766, 10327, 11957,
- 2535, 4591, 7415, 9080, 10623, 12257,
- 5948, 6598, 8515, 10082, 12721, 14188,
- 2443, 4278, 6581, 8172, 9883, 11807,
- 5913, 6535, 8878, 10296, 12141, 14245,
- 2428, 3925, 6409, 9835, 11962, 13628,
- 7430, 8531, 9302, 10259, 11444, 12933,
- 3701, 4694, 6372, 7671, 9445, 11571,
- 5822, 6470, 7807, 8885, 11506, 14529,
- 3742, 4580, 6232, 7860, 11252, 13127,
- 5710, 8330, 8943, 10243, 11696, 14511,
- 2607, 4197, 6714, 10408, 12714, 14320,
- 4116, 8438, 9717, 11018, 12156, 13663,
- 4224, 5318, 7486, 10110, 12779, 14331,
- 5565, 8413, 9115, 10930, 12588, 14759,
- 1898, 3150, 5779, 9497, 12432, 14439,
- 6274, 7186, 9258, 10404, 11733, 12952,
- 3700, 4591, 7575, 9533, 11461, 13777,
- 6234, 7104, 9032, 10986, 13088, 14417,
- 2354, 4579, 7744, 9960, 12629, 14802,
- 6050, 6729, 9345, 10745, 12436, 14253,
- 4345, 5529, 8117, 9718, 12433, 14109,
- 8009, 8701, 9863, 10954, 13046, 14474,
- 4184, 5186, 6876, 8428, 11236, 12973,
- 6113, 6842, 8386, 9659, 12892, 14707,
- 3989, 4936, 7152, 8879, 11743, 13632,
- 5169, 8411, 9209, 11361, 13452, 15076,
- 2397, 4387, 7033, 9035, 11821, 13736,
- 3607, 8128, 10170, 11565, 12819, 14147,
- 4449, 5805, 8963, 10676, 12596, 14558,
- 7911, 8741, 10040, 11622, 13579, 15092,
- 2372, 4290, 6990, 8705, 10637, 13685,
- 6137, 6917, 8382, 9380, 10859, 12348,
- 3235, 5973, 8187, 10174, 12420, 14382,
- 6077, 6764, 8551, 9803, 12150, 14079,
- 2952, 5097, 6853, 8952, 12066, 14080,
- 6606, 7683, 9508, 10695, 12182, 13601,
- 3707, 4638, 7468, 10484, 12295, 13754,
- 7960, 8715, 10051, 11348, 12757, 14072,
- 4139, 5241, 7576, 9037, 10912, 13485,
- 5838, 6444, 7768, 8965, 12867, 14998,
- 4245, 5338, 7248, 9190, 12328, 14047,
- 6159, 8874, 9899, 11134, 12150, 13512,
- 2250, 4288, 8698, 10944, 12624, 14316,
- 3146, 6848, 9904, 11775, 13534, 14953,
- 4044, 5161, 8365, 10294, 12945, 14907,
- 7398, 8724, 9813, 11821, 13246, 14552,
- 2121, 3890, 6855, 9274, 12059, 14663,
- 6329, 7182, 8789, 10081, 13001, 14917,
- 4484, 5761, 8634, 10295, 12111, 14022,
- 6326, 7208, 9672, 11078, 12830, 14529,
- 3230, 5564, 7646, 9955, 12011, 13683,
- 4683, 6896, 10002, 11805, 13329, 14747,
- 4771, 6044, 8081, 10305, 12526, 14037,
- 8231, 9203, 10351, 11427, 12926, 14635,
- 4385, 5774, 7989, 9305, 10751, 12299,
- 5810, 6658, 9062, 11629, 13359, 14655,
- 4288, 5388, 7804, 9378, 11781, 13652,
- 4398, 8560, 9646, 11161, 12701, 14872,
- 1947, 3440, 7202, 10953, 13222, 14806,
- 4686, 8972, 10615, 12054, 13260, 14615,
- 3801, 4849, 8922, 11200, 12882, 14423,
- 8061, 8813, 10453, 11912, 13335, 14710,
- 2365, 3888, 5664, 7346, 10407, 14331,
- 4563, 5839, 7472, 8684, 10572, 12800,
- 2593, 4197, 6719, 9323, 11229, 12919,
- 6081, 6774, 8132, 9244, 12202, 13918,
- 2405, 3981, 6144, 8740, 11347, 13796,
- 5793, 6444, 8286, 10049, 12152, 13520,
- 2795, 4727, 6528, 8506, 11323, 13474,
- 6181, 8598, 9346, 10614, 11725, 13545,
- 4002, 5001, 6596, 7792, 9987, 13065,
- 5748, 6365, 7759, 9028, 11818, 13487,
- 3906, 4863, 6462, 7763, 10705, 14359,
- 4315, 8428, 9322, 10582, 11942, 14500,
- 2812, 4622, 7346, 10036, 11745, 13429,
- 4221, 8338, 9277, 11280, 12869, 14317,
- 4345, 5427, 7121, 8736, 12787, 14837,
- 7678, 8614, 9456, 10461, 12024, 13852,
- 2193, 3662, 5609, 7867, 12276, 14739,
- 6083, 6864, 8879, 10080, 11623, 13720,
- 4114, 5125, 7224, 9729, 11808, 13297,
- 6383, 7232, 9252, 10720, 12622, 14030,
- 2788, 5189, 8074, 9953, 11795, 14361,
- 6079, 6987, 8662, 10589, 12444, 14390,
- 4480, 5690, 7708, 9115, 11800, 14576,
- 7848, 8763, 9802, 10924, 12515, 14832,
- 3582, 4575, 6729, 9084, 11139, 12800,
- 5885, 6534, 8853, 10432, 12664, 14960,
- 3891, 4850, 7195, 8932, 12097, 14665,
- 5797, 8545, 9385, 11556, 12997, 14392,
- 1962, 3544, 7039, 9349, 11272, 13857,
- 4106, 5493, 9652, 12038, 13603, 14932,
- 4328, 5413, 7949, 10282, 12164, 13618,
- 8135, 8918, 10057, 11085, 13190, 15015,
- 2702, 4627, 6447, 8009, 10197, 13676,
- 5998, 6656, 8315, 9496, 11597, 13122,
- 3146, 6293, 8530, 10158, 11798, 13558,
- 6374, 7289, 8698, 9776, 11885, 14236,
- 3171, 5794, 7737, 9377, 11312, 13878,
- 6279, 7150, 9192, 10414, 12052, 14174,
- 4117, 5195, 7805, 9512, 12450, 14849,
- 7963, 8955, 10071, 11129, 12324, 13605,
- 4365, 5505, 7013, 8171, 10488, 13658,
- 6124, 6894, 8286, 9349, 11859, 14737,
- 3753, 4673, 6421, 8146, 12726, 14980,
- 5457, 8706, 9598, 11035, 12294, 14268,
- 2783, 4916, 7947, 10568, 12395, 14123,
- 3909, 8145, 9524, 11951, 14052, 15282,
- 3952, 5139, 8180, 11380, 13699, 15085,
- 7200, 9031, 10025, 11484, 12924, 14848,
- 2533, 4412, 6472, 8299, 11405, 14627,
- 6563, 7530, 9064, 10267, 12560, 14422,
- 4849, 6618, 8678, 10166, 11983, 13841,
- 6393, 7569, 9960, 11300, 12644, 13906,
- 3170, 5117, 7158, 9665, 11687, 14114,
- 6122, 7071, 10013, 11733, 13170, 14466,
- 4308, 5441, 7607, 9900, 11904, 14292,
- 8129, 9024, 10087, 11081, 12670, 14356,
- 4253, 5392, 8175, 9780, 11353, 12988,
- 5453, 6638, 8596, 11453, 13885, 15263,
- 4664, 5903, 7618, 9420, 12198, 13853,
- 7149, 8859, 9746, 11029, 12219, 14188,
- 2318, 4251, 7702, 9889, 11778, 14182,
- 6679, 9280, 10573, 11950, 13100, 14491,
- 4010, 5176, 8989, 10821, 12250, 13654,
- 8076, 8886, 10411, 11722, 12992, 14267,
- 2308, 4017, 6024, 7618, 9736, 13081,
- 6001, 6751, 7987, 8966, 10964, 13589,
- 2908, 5350, 7266, 8739, 10442, 12981,
- 6143, 6839, 9027, 10366, 12881, 14416,
- 2667, 4224, 6172, 8378, 10717, 12602,
- 6275, 7120, 9249, 10613, 12580, 14823,
- 2692, 4586, 6968, 9858, 12120, 14209,
- 7771, 8769, 9743, 10745, 11943, 13225,
- 4201, 5355, 7129, 8337, 9975, 11767,
- 6216, 7100, 8444, 9442, 11298, 13690,
- 4111, 5040, 6562, 8071, 12034, 13923,
- 6657, 8599, 9337, 10665, 12040, 14704,
- 3060, 5215, 7260, 10118, 12577, 14386,
- 5103, 8913, 10157, 11519, 12669, 14220,
- 4633, 5920, 7804, 9514, 12741, 14690,
- 6720, 8585, 9448, 11556, 13510, 15095,
- 2361, 3970, 6213, 9335, 13270, 15075,
- 6506, 7440, 9041, 10179, 12024, 13587,
- 4221, 5405, 8311, 9818, 11579, 14044,
- 6216, 7224, 9515, 11389, 13545, 15068,
- 2872, 5507, 8153, 10650, 13065, 14825,
- 6002, 6676, 9393, 11023, 12965, 14755,
- 4438, 5642, 8268, 10097, 12295, 14724,
- 7797, 8622, 9642, 10932, 13287, 15118,
- 4471, 5638, 7551, 9217, 11440, 12928,
- 6051, 6890, 8906, 10655, 13437, 15116,
- 3953, 4934, 7779, 9619, 12204, 14012,
- 5439, 8649, 9791, 12232, 13899, 15193,
- 2728, 4495, 6728, 9363, 11344, 14053,
- 4069, 8460, 9835, 11742, 13366, 14825,
- 4874, 6937, 9226, 10944, 12845, 14547,
- 8195, 9093, 10392, 11594, 13355, 15010,
- 2956, 5192, 7080, 8765, 11014, 14174,
- 6384, 7287, 8812, 9816, 11336, 12808,
- 2912, 6122, 9132, 10874, 12583, 14265,
- 6148, 6925, 8821, 10030, 12212, 14758,
- 2572, 4778, 7325, 9216, 11620, 14651,
- 6654, 7718, 9546, 10806, 12633, 14354,
- 4328, 5514, 8231, 10852, 12821, 14261,
- 8051, 9205, 10385, 11490, 12674, 13988,
- 4624, 6013, 7907, 9239, 11160, 13787,
- 5786, 6531, 8210, 9968, 13410, 15249,
- 3859, 4898, 7132, 9692, 13395, 15118,
- 6712, 8944, 10028, 11521, 12690, 14118,
- 2417, 4875, 9132, 11671, 13382, 14841,
- 4113, 8355, 10734, 12517, 13905, 15115,
- 4455, 5753, 7923, 10298, 13343, 15030,
- 6998, 8878, 10113, 12233, 13768, 15107,
- 2720, 4801, 6883, 9267, 12694, 14837,
- 6507, 7496, 9312, 10696, 13185, 14850,
- 4631, 6341, 9164, 10796, 12325, 13734,
- 6602, 7817, 9932, 11349, 13132, 14672,
- 3089, 5561, 7579, 9433, 12256, 14633,
- 6246, 7715, 10371, 12065, 13563, 14878,
- 4757, 6352, 8543, 10216, 12748, 14620,
- 8183, 9366, 10628, 11857, 13185, 14599,
- 4734, 6314, 8348, 9716, 11274, 12942,
- 5824, 6871, 9829, 12268, 13874, 15138,
- 4719, 6142, 8224, 9683, 11915, 14350,
- 6288, 8774, 9655, 11204, 12696, 14867,
- 2661, 4586, 7326, 10934, 13501, 15026,
- 5932, 9323, 10877, 12454, 13715, 15004,
- 4467, 6039, 8842, 11164, 13356, 14901,
- 7880, 9158, 10593, 12209, 13609, 14989,
-};
-
-const Word16 swb_tbe_lsfvq_cbook_8b[256 * LPC_SHB_ORDER] = /* Q15 */
-{
- 1705, 3230, 4202, 5086, 6148, 7221, 8127, 10728, 13656, 15364,
- 1668, 2958, 4063, 5644, 7356, 9440, 11046, 12261, 13228, 14503,
- 1546, 2917, 4226, 5477, 6976, 8349, 9709, 11882, 13218, 14715,
- 1158, 2729, 5177, 6967, 8297, 9611, 10655, 11668, 12757, 14415,
- 1616, 3005, 4368, 5810, 7107, 8129, 9376, 10457, 12738, 14835,
- 1232, 2451, 4145, 6446, 7741, 8993, 10377, 11898, 14213, 15314,
- 1638, 3089, 5134, 6351, 7360, 8304, 9787, 12377, 13755, 15209,
- 1264, 2543, 5564, 6686, 7958, 9481, 11021, 12517, 13875, 15147,
- 1304, 2537, 3713, 4863, 6564, 7910, 9400, 11794, 13268, 14834,
- 1652, 3245, 4686, 6405, 7931, 9223, 10591, 12020, 13193, 14759,
- 1302, 2619, 4287, 5884, 7166, 8556, 10512, 12471, 13767, 15075,
- 2034, 3467, 5577, 6530, 7674, 8783, 10920, 12798, 13727, 15002,
- 2621, 3956, 5275, 6542, 7509, 8517, 9456, 10781, 12456, 14099,
- 1496, 2653, 4147, 5637, 7370, 9233, 11817, 12986, 13968, 15046,
- 2224, 3324, 4700, 5868, 7211, 8638, 11369, 12695, 13600, 14559,
- 1267, 3050, 4707, 6321, 8663, 10140, 11174, 12453, 13425, 14844,
- 1662, 2980, 4155, 5414, 6639, 7797, 9253, 11360, 12838, 14440,
- 1521, 2856, 4944, 6367, 7506, 8857, 10971, 12183, 13275, 15006,
- 1454, 2859, 4563, 5971, 7186, 8569, 10151, 11770, 13396, 14984,
- 1143, 2942, 5267, 6840, 8377, 9457, 10589, 11615, 13892, 15271,
- 1674, 3053, 4605, 5768, 7104, 8452, 10094, 11782, 12793, 13758,
- 1702, 3261, 4723, 6245, 7899, 9494, 11010, 12387, 13680, 15066,
- 1365, 2796, 5406, 6505, 7488, 8679, 10447, 12000, 13637, 15046,
- 2090, 3931, 5788, 7157, 8254, 9717, 11007, 12081, 13238, 14880,
- 1952, 3157, 4132, 5164, 6334, 7389, 9004, 11798, 14096, 15505,
- 1641, 3212, 4919, 6364, 7863, 9311, 10766, 12234, 13694, 15054,
- 1653, 3008, 4213, 5354, 6980, 8821, 11185, 12685, 13903, 15251,
- 1856, 3444, 5146, 6579, 7801, 9250, 11062, 12947, 14145, 15291,
- 1365, 3567, 5552, 6474, 7332, 8254, 9952, 11364, 13505, 14951,
- 1488, 2896, 4521, 6279, 7880, 9446, 11418, 12921, 14431, 15465,
- 1516, 3174, 5364, 6410, 7295, 8285, 10799, 12594, 14172, 15424,
- 1738, 3416, 5237, 6878, 8440, 10539, 12105, 13063, 13924, 15150,
- 1431, 2659, 3909, 5328, 6641, 7950, 9347, 11037, 13510, 14992,
- 1400, 2646, 4233, 6366, 7749, 9220, 10560, 11594, 13046, 14992,
- 1115, 2198, 3607, 5279, 8055, 9774, 11024, 12426, 13972, 15232,
- 1360, 3418, 5724, 6973, 7912, 9078, 10810, 12437, 13630, 14826,
- 1422, 3051, 5132, 6141, 7206, 8275, 9355, 10859, 13814, 15202,
- 1080, 2227, 4117, 6404, 8080, 9318, 10934, 12404, 13688, 14827,
- 1611, 3423, 4928, 6214, 7426, 8723, 10502, 11915, 13438, 15105,
- 1947, 3524, 5198, 7008, 8358, 10006, 11397, 12444, 13583, 15135,
- 1394, 2672, 4004, 5681, 6953, 8301, 9815, 12000, 13709, 15079,
- 1788, 3193, 4579, 6221, 7874, 9170, 11186, 12647, 13521, 14538,
- 1548, 2811, 4058, 5331, 6528, 7769, 10982, 12743, 13822, 15131,
- 1751, 4007, 5154, 6463, 7935, 9470, 11103, 12406, 13337, 14520,
- 2004, 3172, 5079, 6116, 7109, 8155, 10351, 12192, 13413, 14773,
- 1644, 3185, 4750, 6290, 7816, 9271, 11041, 12831, 14139, 15341,
- 2311, 3779, 5116, 6100, 7321, 9139, 10353, 12134, 13834, 15172,
- 1723, 3339, 5049, 6754, 8353, 10290, 12048, 13157, 14206, 15460,
- 2218, 3501, 4639, 5764, 6789, 7834, 9804, 11907, 13182, 14689,
- 1640, 3173, 4679, 6202, 7660, 9120, 10773, 12395, 13894, 15200,
- 1591, 3070, 4537, 6005, 7341, 8802, 10480, 12240, 13768, 15130,
- 1169, 3611, 5983, 7054, 8601, 10022, 10948, 11927, 12834, 14747,
- 1708, 3191, 4642, 6156, 7396, 8805, 10028, 11733, 13206, 14857,
- 1519, 3082, 4752, 6484, 7730, 9328, 10796, 12003, 14524, 15513,
- 2153, 3558, 5162, 6714, 7762, 8857, 10008, 12012, 13725, 15209,
- 2680, 4053, 5310, 6996, 8309, 9343, 10361, 12333, 14224, 15498,
- 2356, 3805, 5032, 5970, 6915, 7880, 8924, 12060, 13838, 15185,
- 1807, 3439, 4962, 6483, 8013, 9556, 10952, 12327, 13686, 15059,
- 1571, 2900, 4208, 6449, 7675, 8592, 11138, 12775, 14181, 15422,
- 2006, 4262, 5508, 6414, 7621, 8725, 10788, 12605, 13609, 14776,
- 1785, 3741, 5267, 6702, 8097, 9460, 10487, 11481, 12889, 14885,
- 1647, 3223, 4795, 6391, 8007, 9620, 11575, 12955, 14100, 15381,
- 1518, 3214, 5233, 6509, 7687, 8803, 11778, 13932, 14760, 15491,
- 2136, 3647, 5373, 7317, 8671, 10261, 11786, 12933, 13820, 15186,
- 1633, 3265, 4672, 5640, 6776, 7783, 8907, 10184, 12066, 14492,
- 1690, 3028, 4184, 6049, 7489, 8678, 11045, 12244, 13372, 15016,
- 1649, 3080, 4358, 5795, 7364, 8601, 10257, 12126, 13328, 15113,
- 1850, 3286, 5392, 6765, 7826, 9185, 10506, 11776, 13248, 15163,
- 2111, 3522, 4870, 6087, 7162, 8385, 9645, 10861, 12341, 14302,
- 1529, 2909, 4136, 6783, 8064, 9325, 10942, 12094, 13886, 15169,
- 1847, 3281, 4752, 6098, 7310, 8744, 10129, 12278, 13554, 14930,
- 1149, 2767, 5869, 7479, 8514, 9723, 11235, 12300, 13871, 15068,
- 1689, 3066, 4325, 5613, 6772, 7936, 9051, 12135, 13730, 15025,
- 2127, 3394, 5263, 6880, 7874, 9155, 10305, 12136, 13494, 14437,
- 1682, 3054, 4412, 6053, 7380, 8465, 9817, 12460, 14155, 15285,
- 1799, 3430, 5123, 6594, 7934, 9609, 11472, 12791, 13686, 14849,
- 1899, 3656, 5369, 6355, 7516, 8800, 9888, 11646, 13024, 13965,
- 1410, 3252, 5101, 6050, 7480, 9912, 11739, 12806, 14085, 15186,
- 1487, 3934, 5351, 6390, 7519, 8890, 11488, 12818, 13787, 14941,
- 1562, 3156, 5075, 7044, 8872, 10271, 11479, 12632, 13907, 14993,
- 1548, 2926, 4338, 5796, 7011, 8143, 9336, 11323, 13461, 14904,
- 1421, 2907, 4736, 6272, 7730, 8977, 10453, 12374, 13840, 15234,
- 1495, 2996, 4496, 6036, 7545, 9034, 10534, 12014, 13486, 14958,
- 1388, 3203, 5691, 7076, 8578, 9661, 10874, 12326, 14433, 15423,
- 1248, 2983, 5304, 6423, 7544, 8611, 10290, 11682, 12904, 14549,
- 1496, 2988, 4632, 6342, 7852, 9329, 11175, 12546, 13758, 15182,
- 1373, 3379, 5067, 6179, 7379, 8775, 10005, 11464, 14147, 15386,
- 2537, 3849, 5533, 7263, 8318, 9657, 11346, 12355, 13955, 15314,
- 2113, 3405, 4419, 5268, 6436, 8005, 10292, 12442, 13655, 15176,
- 1620, 3681, 5454, 6406, 7459, 9354, 10872, 12035, 14163, 15279,
- 1903, 3232, 4517, 5758, 7156, 8851, 10670, 12413, 14518, 15565,
- 1714, 3779, 5166, 6557, 8107, 9168, 10560, 12854, 14208, 15329,
- 1926, 3645, 5521, 7072, 7999, 8974, 9806, 11088, 13527, 15298,
- 1820, 2840, 4726, 7091, 8261, 9758, 11218, 12148, 14064, 15262,
- 2072, 3303, 5391, 6710, 7504, 8497, 10457, 12394, 14480, 15541,
- 1627, 3294, 5209, 7432, 8846, 10147, 11517, 12890, 14488, 15411,
- 2172, 3405, 4580, 5623, 6732, 7648, 8485, 9913, 13396, 15213,
- 1581, 3058, 4633, 6225, 7724, 9238, 10779, 12240, 13650, 15094,
- 1675, 2927, 4090, 5753, 7461, 8922, 10277, 11670, 13987, 15336,
- 1868, 3611, 5256, 6927, 8093, 9434, 10998, 12144, 13380, 15165,
- 1498, 3635, 5273, 6823, 7825, 8916, 9811, 10903, 12514, 14884,
- 1448, 2626, 3930, 6895, 8348, 9746, 11404, 12565, 14288, 15325,
- 1945, 3408, 4987, 6340, 7627, 8954, 10251, 12381, 13481, 14983,
- 1956, 3759, 5388, 6894, 8466, 9962, 11460, 12759, 14145, 15321,
- 1670, 3271, 4588, 5970, 7185, 8366, 9640, 12011, 13488, 14833,
- 1964, 3444, 4826, 6213, 7936, 9097, 10785, 12617, 13612, 15229,
- 1646, 3390, 4669, 6049, 7001, 7940, 10461, 12478, 14675, 15704,
- 2202, 3782, 5107, 6754, 8280, 9628, 11687, 13028, 13871, 15207,
- 2354, 3830, 5174, 6360, 7555, 8997, 10681, 11977, 13066, 14781,
- 2351, 3525, 4892, 6386, 7616, 9133, 11859, 13061, 13946, 15004,
- 2252, 3772, 5155, 6485, 7799, 9145, 10769, 12561, 13763, 15241,
- 1714, 3107, 4725, 6097, 9158, 10459, 11619, 12699, 14346, 15256,
- 1830, 3506, 4969, 5973, 6900, 7836, 8994, 11088, 13366, 14860,
- 1856, 3406, 4898, 6367, 7810, 9186, 10422, 12172, 13969, 15331,
- 2006, 3382, 4743, 6100, 7430, 8753, 10805, 12234, 13673, 15195,
- 1491, 3607, 5343, 7464, 9179, 10087, 11024, 12099, 13199, 14956,
- 1749, 3371, 5121, 6500, 7646, 8770, 9968, 11673, 13339, 14931,
- 1857, 3506, 5083, 6595, 8200, 9739, 11138, 12528, 13884, 15137,
- 1780, 3860, 5581, 6692, 7837, 8989, 10304, 12318, 13611, 15109,
- 2164, 4463, 5655, 7632, 9047, 9922, 10784, 12950, 14723, 15589,
- 2305, 3300, 4366, 5608, 6857, 7795, 10006, 11950, 14376, 15700,
- 1628, 3408, 5074, 6761, 8312, 9687, 11104, 12332, 13619, 15076,
- 1842, 3314, 4771, 6460, 7463, 8661, 11191, 12739, 14592, 15633,
- 1808, 4360, 5904, 6869, 8134, 9174, 10780, 12589, 13995, 15150,
- 2966, 4354, 5686, 6983, 7938, 9092, 10062, 11747, 13307, 14611,
- 1932, 3293, 4910, 6818, 7690, 9074, 11715, 13019, 14429, 15478,
- 1978, 3772, 5429, 6580, 7448, 8496, 11755, 13132, 14549, 15560,
- 1881, 3635, 5627, 7292, 8573, 10911, 12325, 13200, 14068, 15243,
- 1436, 2716, 4002, 5347, 6553, 7646, 8955, 10690, 12967, 14784,
- 1426, 2825, 4206, 5726, 8100, 9391, 10712, 12262, 13506, 14954,
- 1448, 2767, 4089, 5265, 7185, 8684, 10378, 12257, 13431, 14803,
- 1669, 3312, 4990, 6887, 8050, 9595, 10943, 12015, 13145, 14920,
- 1534, 2814, 4191, 5933, 7393, 8687, 9865, 11185, 12958, 14743,
- 1397, 2706, 4322, 6052, 7618, 9168, 10995, 12433, 13931, 15267,
- 1717, 3164, 4630, 6329, 7519, 8846, 10088, 12116, 14012, 15197,
- 1606, 3316, 5165, 6942, 8278, 9625, 11461, 12806, 14095, 15299,
- 2014, 3357, 4281, 5076, 6191, 7372, 9501, 12414, 13419, 14901,
- 1322, 3655, 5269, 6494, 7613, 9253, 10752, 11974, 13302, 14833,
- 1687, 3291, 4718, 5817, 7001, 8136, 10741, 12692, 13884, 15224,
- 2255, 3723, 5555, 7021, 8101, 9345, 10765, 12705, 13693, 15223,
- 2376, 3715, 5249, 6505, 7410, 8345, 10176, 11618, 12708, 14488,
- 1842, 3232, 4371, 5954, 7832, 9126, 11296, 12743, 13862, 15331,
- 2046, 3597, 5325, 6453, 7353, 8588, 10588, 12082, 13664, 15152,
- 1970, 3564, 4925, 6547, 8672, 9980, 11383, 12786, 13969, 15234,
- 1497, 2938, 4909, 6099, 7102, 8072, 9514, 11294, 12761, 14578,
- 1666, 3164, 5098, 6255, 7350, 8902, 10694, 12503, 13808, 14980,
- 1467, 2774, 4556, 6308, 7435, 8644, 10040, 12356, 13597, 14776,
- 1915, 3618, 5160, 6707, 8479, 9521, 10481, 11536, 14163, 15479,
- 1857, 3466, 4760, 6205, 7312, 8801, 10376, 11978, 13161, 14235,
- 1615, 3107, 4710, 6452, 8069, 9877, 11348, 12575, 13751, 15049,
- 1563, 3092, 4977, 6851, 8056, 9025, 10327, 12181, 14039, 15192,
- 2294, 3843, 5781, 7222, 8505, 9851, 11210, 12802, 13676, 15158,
- 1931, 3436, 4681, 5837, 6908, 7825, 9440, 12600, 14162, 15305,
- 1572, 3189, 4879, 6680, 7970, 9293, 10974, 12193, 13506, 15218,
- 1759, 3172, 4687, 5950, 7484, 8874, 10563, 12821, 14112, 15299,
- 1461, 4009, 5495, 6608, 7867, 9497, 11307, 12520, 14357, 15467,
- 1922, 4314, 5736, 6599, 7481, 8598, 9852, 11345, 14012, 15280,
- 1249, 2609, 4690, 7006, 8061, 9011, 11477, 13214, 14382, 15337,
- 2251, 3776, 5514, 6458, 7300, 8078, 10961, 12696, 14279, 15567,
- 1697, 3374, 5134, 6984, 8675, 10700, 12194, 13233, 14184, 15464,
- 1985, 3326, 4440, 5685, 6870, 8207, 9545, 11223, 13672, 15143,
- 1453, 2824, 4722, 6476, 7730, 8963, 10217, 11743, 13545, 15152,
- 1217, 2442, 3821, 5409, 7315, 8949, 10797, 12564, 14281, 15410,
- 1546, 3204, 5604, 6730, 8040, 9677, 11029, 12107, 13803, 15267,
- 2042, 3424, 4830, 6328, 7473, 8525, 9386, 10755, 13398, 14998,
- 1106, 2508, 4816, 7337, 8399, 9630, 11278, 12453, 14067, 15024,
- 1764, 3305, 4955, 6537, 7767, 9117, 10404, 11961, 13576, 15021,
- 1604, 3797, 5700, 7128, 8515, 9896, 11389, 12534, 13696, 15136,
- 1623, 3004, 4355, 6217, 7351, 8437, 9819, 11537, 13974, 15340,
- 2457, 3890, 4962, 5848, 7311, 9718, 11213, 12292, 13705, 15111,
- 1601, 3330, 4648, 6043, 7138, 8179, 11247, 13078, 14768, 15641,
- 2457, 3677, 5174, 6432, 7982, 10024, 11164, 12170, 13704, 15112,
- 1552, 3777, 5267, 6325, 7532, 8642, 9894, 12404, 13569, 14620,
- 1961, 3463, 4720, 6498, 8059, 9304, 11486, 12824, 14102, 15458,
- 2443, 3699, 5252, 6348, 7638, 8733, 10224, 12666, 13768, 15009,
- 2204, 3657, 5086, 6792, 8300, 10152, 12313, 13306, 14079, 15287,
- 2360, 3731, 5002, 6094, 6952, 8009, 9152, 11586, 13038, 14158,
- 1888, 3469, 4880, 6183, 7603, 9244, 10801, 12319, 13657, 15002,
- 1670, 3283, 4591, 6080, 7801, 8951, 10534, 12572, 13620, 14969,
- 1304, 4140, 5864, 7008, 8377, 9651, 10825, 11805, 13637, 15300,
- 2077, 3547, 4890, 6216, 7303, 8608, 9810, 11796, 13525, 14984,
- 1658, 3252, 4916, 6498, 8069, 9529, 11029, 12538, 13903, 15184,
- 2206, 3648, 4949, 6636, 7875, 8833, 9853, 12624, 14448, 15475,
- 3039, 4664, 5792, 7321, 8798, 9724, 10485, 12329, 14465, 15650,
- 1885, 3201, 5227, 6590, 7343, 8049, 9372, 12313, 14594, 15645,
- 1826, 3446, 5138, 6665, 8008, 9352, 10668, 12583, 13810, 15065,
- 1455, 3065, 5233, 6306, 7404, 8776, 11422, 12775, 14032, 15239,
- 2395, 4674, 5883, 6877, 7900, 9322, 10931, 12537, 13765, 14888,
- 1840, 4359, 5629, 6875, 7968, 9185, 10266, 11861, 13202, 14464,
- 1662, 3278, 4865, 6555, 8122, 10011, 11874, 13087, 14128, 15418,
- 1643, 3366, 5837, 7033, 7854, 8928, 11487, 12972, 14409, 15467,
- 1878, 3685, 5789, 7325, 8714, 10906, 12273, 13110, 13834, 14837,
- 2259, 3652, 4995, 6055, 7005, 7900, 8843, 10024, 12609, 14736,
- 1568, 2949, 4504, 6035, 7428, 9194, 10893, 12444, 13595, 14939,
- 1678, 3143, 4416, 5872, 7501, 8768, 10418, 12127, 13144, 14622,
- 1878, 3549, 5481, 7178, 8322, 9347, 10532, 12117, 13554, 15167,
- 2055, 3346, 4814, 6193, 7418, 8757, 10144, 11365, 12698, 14779,
- 1486, 2779, 3954, 6134, 8290, 9646, 10767, 12112, 14441, 15428,
- 1787, 3511, 4962, 6055, 7295, 8858, 10179, 12437, 13813, 15217,
- 1374, 3184, 5771, 7998, 9354, 10209, 11249, 12469, 14015, 15248,
- 1627, 2947, 4046, 5182, 6798, 8225, 9770, 12661, 14250, 15408,
- 2117, 3704, 5007, 6630, 8002, 9222, 10550, 12108, 13472, 15034,
- 1365, 2885, 4896, 6144, 7426, 9137, 10283, 12727, 14709, 15505,
- 2073, 3691, 5305, 6800, 8134, 9508, 11139, 12857, 13896, 15239,
- 1564, 4084, 5497, 6495, 7391, 8539, 10468, 11705, 12804, 14704,
- 1844, 3180, 4380, 5754, 8181, 9923, 11738, 12995, 14138, 15232,
- 2157, 3736, 5059, 5932, 7192, 8916, 11216, 12783, 13945, 15189,
- 1782, 2860, 4362, 7179, 9083, 10438, 11580, 12929, 14789, 15500,
- 1651, 3273, 4587, 5886, 7069, 8346, 9787, 11277, 13152, 14811,
- 1549, 3138, 5049, 6704, 7803, 9102, 10748, 12577, 13813, 15215,
- 1674, 3187, 4709, 6204, 7622, 9024, 10541, 12135, 13576, 15063,
- 1888, 3562, 5468, 7111, 8694, 9948, 11111, 12286, 14070, 15300,
- 1905, 3158, 5368, 6372, 7554, 8719, 10568, 12430, 13449, 14427,
- 1953, 3411, 4718, 6545, 8090, 9298, 11232, 12723, 13668, 15077,
- 1459, 3444, 5688, 6814, 7843, 8977, 10119, 12107, 14316, 15368,
- 2450, 4363, 5827, 7349, 8683, 10032, 11143, 12131, 13519, 15058,
- 2482, 3664, 4763, 5944, 7191, 8390, 10105, 12234, 13702, 15188,
- 1838, 3465, 5255, 6751, 8016, 9254, 10946, 12321, 13790, 15337,
- 2497, 3548, 4702, 5987, 7645, 8883, 10740, 12247, 14393, 15540,
- 1717, 3679, 5335, 6587, 8564, 9808, 10735, 12675, 14672, 15558,
- 2454, 3997, 5364, 6810, 8026, 8913, 9715, 11315, 14258, 15605,
- 1906, 3443, 4901, 6363, 8186, 9716, 11074, 13186, 14701, 15474,
- 1992, 3246, 5488, 6514, 7455, 8324, 10807, 13238, 14763, 15579,
- 1721, 3438, 5244, 7173, 9106, 10873, 12178, 13181, 14060, 15415,
- 2191, 3555, 4802, 6108, 7015, 7850, 8947, 11115, 14483, 15593,
- 1925, 3232, 4601, 6574, 7791, 8989, 11038, 12282, 13630, 15136,
- 1816, 3167, 4292, 5730, 7588, 9096, 10743, 12341, 13760, 15252,
- 2069, 3850, 5424, 6815, 8274, 9569, 10910, 12283, 13835, 15185,
- 2419, 3773, 5288, 6591, 7672, 8909, 9832, 10975, 13163, 14998,
- 1215, 2710, 4939, 6437, 8745, 9918, 11200, 12553, 14234, 15384,
- 1867, 3527, 5134, 6496, 7656, 8923, 10602, 12568, 13896, 15276,
- 2259, 4214, 5751, 7270, 8590, 10120, 11611, 12822, 14130, 15258,
- 1911, 3261, 4446, 5685, 6897, 8494, 10128, 11970, 13707, 15106,
- 1762, 3549, 4874, 6153, 8146, 9634, 10690, 11886, 13713, 15057,
- 2371, 3716, 4778, 6111, 7097, 8063, 10544, 12615, 14716, 15724,
- 2254, 3759, 5627, 6870, 7896, 9379, 11627, 12889, 13795, 15272,
- 2516, 4000, 5378, 6444, 7496, 8634, 9767, 12110, 13503, 14640,
- 2385, 3201, 4283, 6677, 8216, 9689, 11654, 12319, 14142, 15367,
- 2775, 4055, 5455, 6553, 7821, 8901, 10890, 12775, 13696, 14884,
- 1568, 3940, 5341, 6824, 9355, 10305, 11405, 12879, 14291, 15334,
- 2436, 3807, 5183, 6189, 7099, 8116, 9655, 11275, 13641, 15137,
- 1755, 3340, 4871, 6382, 7790, 9316, 10921, 12432, 13903, 15217,
- 1932, 3246, 4603, 6454, 7590, 8678, 10609, 12641, 13938, 15245,
- 1417, 4366, 6289, 7362, 8846, 10151, 11160, 12134, 13593, 15216,
- 1820, 3378, 4782, 6421, 7788, 9056, 10070, 11271, 13614, 15297,
- 1855, 3399, 4933, 6526, 8097, 9655, 11043, 12475, 14301, 15370,
- 1901, 3653, 6053, 7290, 8154, 8986, 10262, 12993, 14405, 15387,
- 1958, 4295, 5824, 8196, 9580, 10318, 11267, 12551, 13716, 15374,
- 2082, 4060, 5500, 6423, 7298, 8128, 9713, 12497, 14442, 15562,
- 1878, 3425, 4781, 7062, 8455, 9625, 10810, 12311, 13948, 15201,
- 2035, 3727, 4804, 6256, 7248, 9235, 11563, 13120, 14882, 15662,
- 2143, 3982, 6527, 7709, 8742, 9804, 11240, 12658, 14397, 15409,
- 2593, 4431, 5861, 7222, 8381, 9351, 10400, 11837, 13286, 15326,
- 1840, 3798, 5465, 6800, 7919, 9752, 12004, 13265, 14424, 15420,
- 2157, 4145, 5394, 6454, 7240, 8776, 11093, 12831, 14856, 15708,
- 1467, 3782, 5811, 8123, 9314, 10456, 11641, 13211, 14562, 15331,
-};
-
-
-const Word16 wac_swb_h[LPC_SHB_ORDER] =
-{//Q15
- 32758,
- 32731,
- 32686,
- 32622,
- 32541,
- 32442,
- 32325,
- 32191,
- 32039,
- 31870
-};
-
-const Word16 wac_swb_l[LPC_SHB_ORDER] =
-{//Q15
- 29673,
- 20874,
- 7850,
- 25873,
- 12831,
- 5927,
- 10541,
- 239,
- 15037,
- 30328
-};
-
-const Word16 wac_swb_ivas_h[LPC_SHB_ORDER] =
-{//Q15
- 32749,
- 32731,
- 32686,
- 32622,
- 32541,
- 32442,
- 32325,
- 32191,
- 32039,
- 31870
-};
-
-const Word16 wac_swb_ivas_l[LPC_SHB_ORDER] =
-{//Q15
- 2624,
- 20874,
- 7850,
- 25873,
- 12831,
- 5927,
- 10541,
- 239,
- 15037,
- 30328
-};
-
-const Word16 lbr_wb_bwe_lsfvq_cbook_2bit_fx[4 * 4] =
-{
- /*Q15 */
- 3876, 5920, 8951, 11884,
- 6556, 7979, 10835, 13133,
- 4401, 6781, 10676, 13493,
- 8453, 9693, 12024, 13921,
-};
-
-const Word16 SHBCB_SubGain5bit_fx[128] =
-{
- /*Q14 */
- -2388, -7806, -6576, -6024,
- -7066, -5430, -4998, -3495,
- -16722, -15343, -960, -7940,
- -26291, -5921, -4917, -4378,
- -1526, -6621, -8475, -9624,
- -8047, -4086, -8940, -3043,
- -3630, -5129, -4964, -7381,
- -270, -18662, -24233, -25418,
- -9246, -7551, -5584, -2053,
- -2091, -4622, -9199, -14628,
- -4645, -2197, -10255, -9697,
- -2438, -9386, -11737, -4570,
- -14366, -11436, -8252, -819,
- -16192, -16332, -17043, -225,
- -5407, -8588, -7577, -2296,
- -26309, -21930, -7522, -2514,
- -3260, -4246, -7947, -6614,
- -1820, -5520, -15272, -19764,
- -3706, -3737, -5850, -10520,
- -10081, -4050, -4065, -5001,
- -3908, -9909, -2881, -9604,
- -520, -11156, -12620, -12768,
- -4539, -5149, -6208, -4462,
- -4866, -7672, -4235, -4407,
- -9163, -13411, -2975, -3915,
- -12267, -7568, -3842, -2827,
- -7181, -4914, -2608, -9392,
- -6275, -2868, -5962, -6511,
- -12962, -1034, -8517, -10992,
- -8247, -7608, -2502, -5026,
- -5812, -4998, -3860, -5778,
- -16907, -5974, -4434, -3276,
-};
-
-
-const Word16 HBCB_SubGain5bit_fx[128] =
-{//Q8
- -15224, -17789, -9897, -5048, -456, -1232, -2238, -2782,
- -3391, -3864, -4026, -4045, -2017, -1311, -878, -1973,
- -12837, -15376, -8273, -4141, -2791, -3037, -2403, -342,
- -3388, -3646, -3471, -2829, -157, -2025, -2318, -2243,
- -14652, -16433, -7699, -1188, -2567, -1755, -346, -1682,
- -2068, -2321, -2344, -2348, -1759, -1038, -1865, -2041,
- -11396, -13719, -7749, -2734, -809, -1935, -1886, -781,
- -2136, -1940, -942, -1571, -1926, -2378, -2572, -2145,
- -17531, -19267, -7721, -2672, -714, -675, -1516, -2071,
- -1925, -2325, -2523, -2657, -1644, -1674, -2036, -2017,
- -12781, -14601, -6714, -1380, -2093, -1704, -1124, -756,
- -2776, -2687, -2066, -1202, -1102, -680, -1956, -2376,
- -14436, -15846, -4918, -2071, -1613, -744, -1807, -1381,
- -620, -1294, -2026, -2162, -794, -1755, -1167, -1762,
- -11627, -13377, -5876, -1959, -1009, -1879, -1027, -1915,
- -1734, -1265, -2001, -1018, -698, -1733, -2172, -1195,
-
-};
-
-
-const Word32 SHBCB_FrameGain64_fx[64] =
-{
- /* Q18 */
- 11553, 19429, 27466, 35948, 45184, 54817, 65050, 76114,
- 88089, 100815, 114314, 128727, 144236, 160812, 178639, 197656,
- 217917, 239688, 263098, 288617, 315962, 345380, 376751, 410569,
- 446867, 485779, 527885, 574220, 624562, 679333, 738912, 803391,
- 873329, 949299, 1032054, 1121728, 1219559, 1327347, 1446046, 1576547,
- 1720983, 1881933, 2062979, 2266614, 2496129, 2759206, 3060575, 3409584,
- 3818114, 4295643, 4868000, 5551295, 6368310, 7329048, 8475924, 9889403,
- 11649918, 13794493, 16487623, 19979932, 24732260, 31339886, 41958624, 64261100,
-};
-
-/* 4 bit Quantizer table for SHB overall gain */
-
-const Word32 SHBCB_FrameGain16_fx[16] =
-{
- /*Q18*/
- 38968, 125277, 254474, 493383, 1043711, 2083177, 3792746, 6395076,
- 10256080, 15738899, 23269902, 34118236, 48362464, 71128080, 107459896, 192888864
-};
-
-/* 18th order elliptic Bandpass filter at 14.15 to 20 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */
-
-const Word16 full_band_bpf_1_fx[6][5] = /*in Q13*/
-{
- { 789, 802, 248, 802, 789},
- { 789, 1199, 838, 1199, 789},
- { 789, 136, -1123, 136, 789},
- { 8192, 19654, 24391, 17059, 6561},
- { 8192, 15339, 20118, 13819, 6190},
- { 8192, 21155, 26558, 17237, 5599}
-};
-
-/* 12th order elliptic Bandpass filter at 16.3 to 19.8 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */
-
-const Word16 full_band_bpf_2_fx[6][5] = /*in Q13*/
-{
- { 492, 912, 974, 912, 492},
- { 492, 1161, 1353, 1161, 492},
- { 492, 259, -311, 259, 492},
- { 8192, 22912, 30622, 21214, 7143},
- { 8192, 20364, 27329, 18844, 6886},
- { 8192, 23496, 31199, 20826, 6487}
-};
-
-/* 12th order elliptic Bandpass filter at 15.4 to 20.0 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */
-
-const Word16 full_band_bpf_3_fx[6][5] = /*in Q13*/
-{
- {611, 888, 717, 888, 611},
- {611, 1211, 1214, 1211, 611},
- {611, 197, -671, 197, 611},
- {8192, 21727, 28230, 19588, 6871},
- {8192, 18438, 24377, 16796, 6567},
- {8192, 22683, 29442, 19400, 6081}
-};
-
-/* 4-bit/3-bit TD SWB BWE differential LSF scalar quantizer tables */
-
-const Word16 lsf_q_cb_size[NUM_Q_LSF] = {16, 16, 8, 8, 8}; // Q0
-const Word16 lsf_q_num_bits[NUM_Q_LSF] = { 4, 4, 3, 3, 3 }; // Q0
-
-/* Tables for approximation of upper half of SWB LSFs */
-
-const Word16 mirror_point_q_cb_fx[MIRROR_POINT_Q_CB_SIZE] = { 471, 692, 896, 1216 }; // Q15
-
-const Word16 allpass_poles_3_ov_2[9] = /* Q15 */
-{
- 2368,
- 20545,
- 30606,
- 25520,
- 7188,
- 31808,
- 28575,
- 14384,
- 32472
-};
-
-const Word16 decimate_3_ov_2_lowpass_num_fx[3] = /* Q15 */
-{
- 6399,
- 12797,
- 6399
-};
-
-const Word16 decimate_3_ov_2_lowpass_den_fx[3] = /* Q15 */
-{
- 32767,
- 0,
- 5624
-};
-
-
-/*------------------------------------------------------------------------------*
- * WB BWE tables
- *------------------------------------------------------------------------------*/
-const Word16 F_2_5_fx[64] = /*Q10 */
-{
- 1189, 675, -5106, -5293, 10476, -12, 10860, 10026,
- -382, -616, 6426, 339, 9681, 9068, 3002, 2216,
- 3208, 3042, 8255, -604, 16133, 5171, 17641, 18769,
- -2529, -3248, -1447, -1991, 15511, 14855, 11631, 11996,
- 9654, -124, 7267, -1617, 12799, 3237, 10598, 1555,
- 5510, -1775, 1149, -2292, 12659, 12425, 4382, -1814,
- 6305, 5629, 3404, -2632, 19555, 9582, 7835, 7619,
- -517, -3795, 19031, 11574, 19156, 18748, 23563, 23465,
-};
-/*------------------------------------------------------------------------------*
- * SWB BWE tables
- *------------------------------------------------------------------------------*/
-
-const Word16 swb_bwe_trans_subband[SWB_FENV_TRANS+1] = {240, 316, 392, 476, 560}; // Q0
-const Word16 swb_bwe_trans_subband_width[SWB_FENV_TRANS] = {76, 76, 84, 84}; // Q0
-
-const Word16 sqrt_swb_bwe_trans_subband_width_fx[SWB_FENV_TRANS] = { 17854, 17854, 18770, 18770 };/*Q11 */
-
-const Word16 sqrt_swb_bwe_subband_fx_L1[SWB_FENV] = { 16384, 20066, 16384, 20066, 16384, 20066, 16384, 20066, 20066, 20066, 20066, 20066, 23170, 23170 }; /*Q12 */
-
-const Word16 sqrt_swb_bwe_subband_fx_L2[SWB_FENV / 2] = { 25905, 25905, 25905, 25905, 28378, 28378, 32767 }; /*Q12 */
-
-const Word16 swb_bwe_subband[SWB_FENV+1] = {240, 256, 280, 296, 320, 336, 360, 376, 400, 424, 448, 472, 496, 528, 560}; // Q0
-const Word16 fb_bwe_subband[DIM_FB + 1] = { 640, 680, 720, 800 }; // Q0
-const Word16 fb_bwe_sm_subband[DIM_FB] = { 656, 696, 760 }; // Q0
-const Word16 swb_inv_bwe_subband_width_fx[SWB_FENV] = { 2048,1365,2048,1365,2048,1365,2048,1365,1365,1365,1365,1365,1024,1024 };//Q15
-const Word16 swb_bwe_sm_subband[SWB_FENV] = {248, 268, 288, 308, 328, 348, 368, 388, 412, 436, 460, 484, 512, 544}; // Q0
-const Word16 smooth_factor_fx[SWB_FENV - 1] = { 1638, 1638, 1638, 1638, 1638, 1638, 1638, 1366, 1366, 1366, 1366, 1024, 1024 };//Q15
-
-const Word16 fb_bwe_subband_float[DIM_FB+1] = {640, 680, 720, 800}; // Q0
-const Word16 fb_inv_bwe_subband_width_fx[DIM_FB] = { 819, 819, 409 };//Q15
-const Word16 fb_bwe_sm_subband_float[DIM_FB] = {656, 696, 760}; // Q0
-const Word16 fb_smooth_factor_fx[DIM_FB] = { 1024, 819, 512 };//Q15
-
-
-const Word16 EnvCdbk11_fx[N_CB11 * DIM11] = /*Q8 */
-{
- -2220, 29, 1168, 2124, 2180, 1208, 741,
- 1521, -312, -843, -1523, -1970, -2205, -2541,
- 746, 1835, 3461, 4398, 4292, 4184, 3462,
- 1627, 2475, 2937, 2839, 2198, 1729, 1325,
- -514, -731, -557, -200, 100, 475, 540,
- 655, 956, 1272, 1083, 774, 687, 459,
- 5987, 5460, 4689, 4192, 3845, 3615, 3393,
- 3571, 4840, 5784, 6266, 5933, 5158, 4433,
- 2959, 2087, 1180, 979, 1180, 1371, 1636,
- 6029, 6157, 6431, 6762, 6998, 7153, 7050,
- -822, 210, 450, 178, -639, -1346, -1577,
- 4451, 4184, 4111, 4329, 4833, 5232, 5512,
- 3420, 3994, 4321, 4205, 3684, 3154, 2651,
- -3734, -2305, -1388, -324, 22, -847, -1141,
- 850, 510, 896, 1780, 2130, 2688, 2826,
- 3294, 2823, 2510, 2516, 3029, 3413, 3843,
- -3563, -3409, -3199, -2917, -2584, -2282, -1981,
- -2738, -3185, -3752, -4320, -4484, -4524, -4329,
- -7534, -7481, -7283, -7175, -6757, -6281, -5865,
- -4868, -4836, -4603, -4422, -4086, -3738, -3323,
- -13896, -13775, -13484, -13339, -12926, -12399, -11970,
- 8409, 8420, 8305, 8103, 7954, 7778, 7496,
- 7180, 6845, 6369, 5971, 5557, 5309, 5027,
- 4633, 4008, 3267, 2422, 2072, 1778, 1510,
- 10128, 10432, 10540, 10473, 10176, 9837, 9586,
- 2933, 2695, 2060, 1286, 424, -254, -825,
- -10032, -9847, -9544, -9420, -9000, -8508, -8084,
- 1830, 927, -158, -388, -360, -368, -287,
- -21962, -21904, -21548, -21471, -21004, -20511, -20064,
- -6090, -6142, -5937, -5852, -5493, -5104, -4671,
- -1382, -1640, -2205, -2557, -2785, -3019, -2994,
- -1300, -1567, -1744, -1642, -1409, -1080, -902,
-};
-
-const Word16 EnvCdbk1st_fx[N_CB1ST * DIM1ST] = /*Q8 */
-{
- -1819, -1138, 751,
- -494, 162, -826,
- -3199, -123, 2479,
- -2071, 238, -429,
- -1819, 1780, 1233,
- 284, 1187, -1123,
- -1689, -722, -484,
- -1256, 52, -1336,
- -604, 3738, -1297,
- 555, 412, 743,
- -626, -1685, 1527,
- 145, 1557, -224,
- -638, 1370, 1589,
- -1188, 37, -410,
- -428, -3320, 1860,
- 2597, -95, -2876,
- -742, -583, -684,
- 1607, -1671, -1874,
- -1111, -936, -1374,
- 275, -2314, 518,
- 2682, 2368, -302,
- 1809, -555, -579,
- 3193, -1270, -1208,
- 750, 84, 154,
- -1160, 429, 1098,
- 816, -613, -2897,
- 2159, -1885, 1245,
- -671, 426, 3177,
- 867, -144, -639,
- 843, -1888, 2271,
- 1542, 259, -148,
- -1680, 1027, 285,
- 162, -763, 1666,
- -1916, 1175, -1227,
- -345, -907, -151,
- 1979, 1062, 402,
- -1231, 2437, 3130,
- -2422, 361, 1040,
- -4314, -4106, -4221,
- 146, -1200, -1828,
- 485, 889, -3847,
- 384, -2461, -2845,
- 1526, -600, 1599,
- -838, -571, 1097,
- 1776, -3393, 4058,
- -3330, 2429, 1732,
- 468, -2140, -934,
- 833, 2292, -1129,
- -20, -1029, 652,
- -346, 168, 1834,
- -1730, 838, 2234,
- 1622, -1695, -194,
- -3198, -773, 228,
- 1070, 1741, 285,
- 1655, -212, -1628,
- 2178, 604, 1784,
- 1801, -3224, -848,
- -819, 348, 187,
- 16, 300, 244,
- 769, 201, 1554,
- 719, -394, 780,
- 311, 2853, 185,
- 1163, 489, -1022,
- -330, 459, 877,
- 109, -541, -691,
- -509, -267, 478,
- -340, -417, -1403,
- -860, -675, -2703,
- 1025, 826, 250,
- -1043, 1008, -434,
- -1042, -631, 60,
- -173, 332, -2084,
- 984, 919, -2042,
- -1257, -2287, 339,
- 366, -1309, -158,
- 1041, 1039, 1083,
- 3566, 918, 227,
- 62, -139, 936,
- 2424, 730, -1022,
- -745, 1954, 427,
- -1091, -1358, -478,
- -173, 2121, -2367,
- -2175, 2535, -1946,
- -880, -1964, -1549,
- -249, -1203, -927,
- -2377, -443, -1775,
- -1439, -582, 2037,
- -529, -3679, -550,
- 608, -284, -1566,
- 201, 63, -344,
- 1376, 218, 816,
- 2471, -348, 479,
- -1388, 988, -2674,
- 1429, -3538, 1125,
- 864, -1351, 845,
- 301, 977, 408,
- -1122, 3364, 1107,
- -213, 730, -329,
- 839, -683, -92,
- 631, 1172, 2364,
- 598, 685, -329,
- -780, -1317, 448,
- -424, -153, -199,
- 768, -331, 2825,
- 882, -1047, -975,
- -375, -1835, -299,
- 2861, -3375, -3158,
- 2099, 2168, -2630,
- 1602, 1930, 1451,
- 1294, 1265, -586,
- -2500, -2570, -2667,
- -806, -1529, 3272,
- -522, 1072, 478,
- 4035, -2491, 480,
- -1908, 2414, -178,
- -1563, -143, 438,
- 205, 861, 1287,
- -691, 963, -1374,
- -2359, -2032, -886,
- 162, -442, 160,
- 194, 2494, 1960,
- -2533, -2578, 1924,
- 267, 1701, 937,
- 2919, 2950, 2382,
- -670, 2102, -859,
- -3147, 1385, -215,
- 1482, -595, 415,
- 228, 290, -1060,
-};
-
-const Word16 EnvCdbk2nd_fx[N_CB2ND * DIM2ND] = /*Q8 */
-{
- 1104, -1833, -1110, -954,
- 757, 853, -176, 286,
- -873, -587, -7, 1458,
- -462, -553, -350, 104,
- 1938, 1957, -1340, -703,
- 1202, -779, 21, 1996,
- -2851, -169, 1049, 940,
- -1355, -726, -1788, 1076,
- -767, -641, -646, -880,
- 135, -832, -197, -889,
- -826, 3, 279, -502,
- -714, 544, -526, 375,
- 291, -1076, -816, -3929,
- -1175, -475, 2219, -642,
- 197, -219, -1052, -1601,
- 1175, -162, -695, -336,
- 1124, 126, -2326, -1573,
- 1164, -1323, -1958, 1074,
- -2080, -2152, 113, 649,
- -637, -860, 721, 267,
- -609, 1658, -1006, -1352,
- 1631, 2225, 2128, 1827,
- -1112, -1351, 1856, 1656,
- -2132, 1006, 770, -1294,
- -472, 776, 1661, 2248,
- -121, -574, -1481, -316,
- 2565, -1081, 188, 293,
- 398, 2598, 704, -1129,
- 1023, 104, 550, 499,
- -416, 127, 253, -1894,
- 456, -2578, 190, 1018,
- -1488, 286, -1202, -915,
- -1164, 1874, 1651, 302,
- -1312, -1547, -1625, -1516,
- 170, -233, 817, 1209,
- -1090, 341, 709, 725,
- 854, 819, -278, -1083,
- -15, 113, 286, 283,
- 1166, -906, 1880, 301,
- 342, -7, -587, 776,
- -785, -1259, -1166, 3194,
- -1630, -1071, 300, -1080,
- -12, 190, -538, -493,
- 351, 907, 1929, -1534,
- 480, 36, 593, -526,
- 813, 1216, 986, 89,
- 98, 1010, -2272, 268,
- 2766, -102, -1307, -873,
- -1660, -467, -365, 47,
- 1496, 1277, -228, -2791,
- 1565, -669, 520, -1598,
- -361, 1078, 457, -364,
- 543, -950, 28, 248,
- 1904, 815, -1034, 1125,
- -13, -1951, 1085, -1005,
- -2223, 1519, -624, 857,
- 1121, 831, 872, 1295,
- 193, 2284, -422, 609,
- -156, 827, -733, 2065,
- -3390, -3384, -3197, -3220,
- 31, 896, 539, 978,
- -21, 408, 1502, 405,
- -583, -1662, -665, -164,
- 2193, 976, 613, -436,
-};
-
-const Word16 EnvCdbk3rd_fx[N_CB3RD * DIM3RD] = /*Q8 */
-{
- 1031, -2454, 748,
- 2770, 2442, 1761,
- -2348, 4079, -959,
- 1874, -735, -2242,
- -59, 35, 201,
- -1518, 162, 1809,
- -1977, -1063, -103,
- 2485, 1212, -863,
- 882, 192, 39,
- 1356, 851, 979,
- -1377, -2961, -1477,
- 497, -808, 593,
- -394, -748, -1564,
- -950, -198, -436,
- -503, -1420, -234,
- 318, 985, -1905,
- -118, 1783, 1563,
- 220, 929, 400,
- 857, 37, -995,
- -807, 1943, -409,
- -743, -524, 552,
- 940, 1643, -299,
- 805, -1421, -768,
- -2330, 705, 156,
- 61, 203, 1213,
- -138, 517, -642,
- 64, -501, -435,
- 2194, -625, 157,
- -1600, 341, -1611,
- 1137, -351, 2353,
- -811, -1715, 1522,
- -870, 613, 446,
-};
-
-const Word16 EnvCdbk4th_fx[N_CB4TH * DIM4TH] = /*Q8 */
-{
- 1024, -210, -207, 591,
- -280, -2486, -951, 958,
- 1539, 1136, 411, 1314,
- 1761, -202, 1339, 203,
- -2438, -2109, -2028, -2125,
- 1849, -1408, -670, 144,
- -469, 2674, -1589, -3604,
- 1642, -702, 139, 2476,
- -483, 372, -861, 540,
- -119, 827, 863, 952,
- 23, 99, -24, -303,
- 488, -2233, -1432, -1399,
- 54, -43, 96, -1527,
- 1170, 133, -119, -717,
- 258, -1215, -439, 160,
- -1049, 793, 970, -770,
- -1914, -1245, 1281, 422,
- -1194, 1005, 176, -2368,
- -1631, 1316, -1125, -361,
- 1124, 1132, 61, -2186,
- 790, -2055, 1174, 938,
- 2974, 3874, 2315, 2040,
- -300, 2484, 59, -860,
- 543, 1307, -1868, -725,
- 389, -115, -945, -146,
- -1837, -578, -620, 975,
- 389, 1779, 1732, 296,
- 377, 897, 1555, 2269,
- -854, 26, 590, 1413,
- -780, -985, 1389, 2639,
- 312, -277, -935, -3289,
- 1740, 1852, 641, -519,
- 738, 898, -466, 115,
- 1187, -286, -1514, -1309,
- 74, -801, -583, -987,
- 510, -667, 430, -191,
- 418, -303, 806, 1258,
- -1083, -1065, 362, -2114,
- -1075, 82, 260, 286,
- -2579, 14, 75, -854,
- -661, -634, 482, -581,
- -338, -306, 3255, 388,
- -230, -24, 1161, 205,
- 256, 546, -141, 1379,
- -63, -775, -484, 1478,
- -517, -546, -451, 86,
- 1473, -1201, 430, -1892,
- 394, 831, 620, -664,
- 334, 64, 1773, -1576,
- -1783, 1270, 1020, 944,
- 1023, 98, -1908, 1330,
- -560, -1044, 380, 707,
- -427, -708, -1815, -90,
- -54, 2298, -537, 1151,
- -499, 703, -1018, 3322,
- 92, 717, -607, -1032,
- -1313, -1393, -580, -485,
- 34, -2192, 788, -860,
- 2641, 628, -776, -259,
- -702, -159, -1483, -1638,
- -33, -63, 97, 553,
- 692, 523, 548, 349,
- -913, 54, -456, -702,
- -341, 944, 157, 100,
-};
-
-
-const Word16 EnvCdbkFB_fx[N_CB_FB * DIM_FB] = /*Q7 */
-{
- -2126, -1242, -945,
- 1628, -686, -539,
- 1230, 2245, 2532,
- 2822, 3094, 2669,
- -12376, -11507, -11342,
- 2678, 3533, 3510,
- 489, 903, 689,
- 1930, 2929, 3025,
- 3424, 4179, 4050,
- -2500, -1707, -1415,
- -3511, -2563, -2224,
- -865, -987, -1212,
- -424, 891, 1919,
- 1976, 2520, 2277,
- 673, 1667, 1945,
- 5169, 6024, 5983,
- -1367, -501, -236,
- -254, 679, 989,
- -18974, -18088, -17834,
- -23007, -22053, -22109,
- 2262, 2301, -625,
- -124, 431, 372,
- 1454, 1962, 1791,
- 200, 1094, 1347,
- -997, -110, 213,
- -697, 267, 602,
- -3066, -2172, -1876,
- -4358, -3493, -3164,
- -360, 59, -472,
- -1813, -919, -601,
- 4204, 4967, 4913,
- 953, 1457, 1245
-};
-
-const Word16 Mean_env_fb_fx[DIM_FB] = { 1760, 805, 473 }; /*Q8 */
-
-const Word16 w_NOR_fx[SWB_FENV] = /*Q15 */
-{
- 32767, 32056, 31374, 30720, 30093, 29491, 28913,
- 28357, 27822, 27307, 26810, 26331, 25869, 25423,
-};
-const Word16 Mean_env_fx[SWB_FENV] = /*Q8 */
-{
- 7327, 7414, 7181, 7160, 6889, 6866, 6746,
- 6651, 6385, 6152, 5873, 5668, 5435, 5222,
-};
-
-const Word16 Env_TR_Cdbk1_fx[N_CB_TR1 * DIM_TR1] = /*Q8 */
-{
- 229, -2347,
- 8199, 7726,
- -312, 1700,
- 9881, 5949,
- 8942, 8358,
- 3865, 3287,
- 2405, 796,
- 3664, 1433,
- 3059, 2215,
- 618, 874,
- -5479, -4636,
- 2237, 2512,
- 4265, 2428,
- 6583, 2065,
- 4548, 6579,
- 11325, 7340,
- 10578, 9264,
- 8491, 6457,
- -1380, -2484,
- 3377, 5069,
- 7393, 5120,
- 4798, 4440,
- 5506, 7614,
- -3371, -3982,
- 2806, 2959,
- 2242, 3550,
- 1334, 3065,
- 2055, -1350,
- 815, 5507,
- 4940, 1457,
- -1950, -1046,
- 653, -1133,
- 872, -3622,
- -1756, 245,
- 5792, 5542,
- 4084, 7696,
- 4569, 5204,
- -810, -1555,
- 10127, 10384,
- 11341, 11713,
- 6365, 4996,
- 8641, 10527,
- 5914, 3366,
- 4522, 3266,
- 5217, 2830,
- 8107, 8980,
- 3952, 5858,
- 5848, 8990,
- 6424, 5931,
- 5185, 3823,
- 6367, 6917,
- 3548, 2683,
- 1634, 2098,
- 2729, -89,
- 6964, 7664,
- 3179, 3561,
- 6388, 4193,
- 4024, 4828,
- -378, 434,
- 9338, 9507,
- 7593, 3483,
- -6835, -6317,
- 5207, 5029,
- 11326, 10488,
- 7411, 6086,
- 10072, 8255,
- -6099, -5652,
- 7074, 8702,
- -12228, -11384,
- -11471, -10567,
- -13025, -12253,
- -12879, -11289,
- -13952, -13062,
- -16214, -15389,
- -11659, -10789,
- -12351, -11477,
- -12789, -11947,
- -15139, -14249,
- -11326, -11219,
- -11950, -11093,
- -11800, -10928,
- -23738, -22881,
- 12795, 11890,
- -3793, -2879,
- -27373, -26492,
- -11928, -11531,
- -12110, -11258,
- -20492, -19634,
- -14371, -13608,
- -12591, -11728,
- -14055, -11739,
- 9471, 7272,
- -11184, -10335,
- -13313, -11673,
- -12209, -10610,
- -13465, -12761,
- 7690, 7115,
- 2564, 4496,
- 5587, 4551,
- -813, -562,
- -4483, -5521,
- 1556, 98,
- 2, 3468,
- 1410, 1339,
- 4049, 161,
- -4538, -4026,
- -9866, -9115,
- -1616, -4727,
- 2457, 1653,
- 631, 2155,
- -17982, -17082,
- 2628, 6088,
- -10791, -9933,
- -12426, -11566,
- 4322, 4000,
- -1574, 2162,
- -7968, -7599,
- 1523, 4192,
- 5621, 6537,
- -2511, -1987,
- 12471, 9218,
- 8746, 4971,
- 3642, 4148,
- 5089, 5948,
- 350, -92,
- 7028, 6683,
- -2430, -3216,
- -3974, -886,
-};
-
-const Word16 Env_TR_Cdbk2_fx[N_CB_TR2 * DIM_TR2] = /*Q8 */
-{
- 2639, 375,
- -481, 1694,
- -2400, -3306,
- 86, -4018,
- -1301, 47,
- 734, 299,
- 957, -1039,
- 2204, 1486,
- 361, -1136,
- 2628, -838,
- -2010, 1296,
- 373, 127,
- -573, 2604,
- 689, -1554,
- 1676, -371,
- 1298, 279,
- -901, 1086,
- 1747, -2723,
- 214, -657,
- -731, -909,
- 1545, -1658,
- -369, -2208,
- -1276, 1748,
- 1141, -522,
- 186, -1893,
- -1260, -2016,
- -478, -504,
- 1287, 1882,
- -97, -1400,
- -1372, -1165,
- 800, -152,
- 413, -240,
- -208, -858,
- -90, -399,
- 492, 2519,
- 913, 1368,
- -344, 282,
- 305, 526,
- -251, 860,
- -1066, 567,
- -2800, -687,
- 1, 674,
- 176, 878,
- -716, -153,
- 706, 831,
- -1083, -424,
- 419, 1192,
- -132, 565,
- 708, -2406,
- 600, -661,
- 1712, 2969,
- -1974, 379,
- -672, 208,
- 26, 296,
- -1821, -501,
- -513, 635,
- 266, 1737,
- -221, 1232,
- -3498, 1632,
- -337, -66,
- -552, -1427,
- 1329, 850,
- -718, -2948,
- -3, 0,
-};
-
-const Word16 Mean_env_tr_fx[5] = { 6971, 6095, 6111, 4995 }; /*Q8 */
-
-/*------------------------------------------------------------------------------*
- * LR MDCT SWB BWE coding tables
- *------------------------------------------------------------------------------*/
-
-
-const Word16 gain_table_SWB_BWE_fx[NB_SWB_SUBBANDS] = { -6554/*-0.4f*/, 1638/*0.1f*/, 9830/*0.6f*/, 18022/*1.1f*/ }; /* Q14 */
-
-const Word16 bits_lagIndices_modeNormal[NB_SWB_SUBBANDS] = {2, 2, 1, 1}; // Q0
-const Word16 subband_offsets_12KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_12KBPS, SWB_SB_OFF1_12KBPS, SWB_SB_OFF2_12KBPS, SWB_SB_OFF3_12KBPS}; // Q0
-const Word16 subband_offsets_16KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_16KBPS, SWB_SB_OFF1_16KBPS, SWB_SB_OFF2_16KBPS, SWB_SB_OFF3_16KBPS}; // Q0
-
-/* Search offset for the subbands that use a partial search */
-const Word16 subband_search_offsets[NB_SWB_SUBBANDS] =
-{
- 0, 0, 64, 64
-}; // Q0
-
-
-
-/* SPT : shorten subband length table */
-const Word16 bw_SPT_tbl[2][SPT_SHORTEN_SBNUM]=
-{
- {15, 31, 31, 31}, /* 13.2kbps: original band_width 53, 66, 82, 102 */
- {15, 15, 31, 31} /* 16.4kbps: original band_width 51 64, 80, 90 */
-};
-
-
-/* Harmonic Mode */
-const Word16 bits_lagIndices_mode0_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = {1,1}; // Q0
-
-
-/* 13.2 kbps */
-const Word16 subband_offsets_sub5_13p2kbps_Har[NB_SWB_SUBBANDS_HAR] =
-{
- SWB_SB_OFF0_SUB5_12KBPS_HAR, SWB_SB_OFF1_SUB5_12KBPS_HAR, SWB_SB_OFF2_SUB5_12KBPS_HAR, SWB_SB_OFF3_SUB5_12KBPS_HAR
-}; // Q0
-
-/* Search offset for the subbands that use a partial search */
-const Word16 subband_search_offsets_13p2kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] =
-{
- 120, 210
-}; // Q0
-
-/* 16.4 kbps */
-const Word16 subband_offsets_sub5_16p4kbps_Har[NB_SWB_SUBBANDS_HAR] =
-{
- SWB_SB_OFF0_SUB5_16KBPS_HAR, SWB_SB_OFF1_SUB5_16KBPS_HAR, SWB_SB_OFF2_SUB5_16KBPS_HAR, SWB_SB_OFF3_SUB5_16KBPS_HAR
-}; // Q0
-
-/* Search offset for the subbands that use a partial search */
-const Word16 subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] =
-{
- 120, 210
-}; // Q0
-
-
-/*------------------------------------------------------------------------------*
- * HQ core tables
- *------------------------------------------------------------------------------*/
-const Word16 wscw16q15_fx[240] =/*Q15 */
-{
- -32768, -32766, -32764, -32759, -32754, -32747, -32738, -32729, -32717, -32705, -32691,
- -32675, -32658, -32640, -32621, -32600, -32577, -32553, -32528, -32501, -32473, -32444,
- -32413, -32381, -32348, -32313, -32276, -32239, -32200, -32159, -32117, -32074, -32029,
- -31984, -31936, -31887, -31837, -31786, -31733, -31679, -31624, -31567, -31508, -31449,
- -31388, -31326, -31262, -31197, -31131, -31063, -30994, -30924, -30853, -30780, -30705,
- -30630, -30553, -30475, -30395, -30315, -30232, -30149, -30064, -29979, -29891, -29803,
- -29713, -29622, -29530, -29436, -29341, -29245, -29148, -29049, -28949, -28848, -28746,
- -28642, -28537, -28431, -28324, -28216, -28106, -27995, -27883, -27770, -27655, -27540,
- -27423, -27305, -27186, -27066, -26944, -26821, -26698, -26573, -26447, -26320, -26191,
- -26062, -25931, -25800, -25667, -25533, -25398, -25262, -25125, -24986, -24847, -24707,
- -24565, -24423, -24279, -24135, -23989, -23843, -23695, -23546, -23397, -23246, 23095,
- 22942, 22788, 22634, 22478, 22322, 22164, 22006, 21846, 21686, 21525, 21363,
- 21199, 21035, 20871, 20705, 20538, 20371, 20202, 20033, 19863, 19692, 19520,
- 19347, 19174, 18999, 18824, 18648, 18472, 18294, 18116, 17937, 17757, 17576,
- 17395, 17213, 17030, 16846, 16662, 16477, 16291, 16105, 15917, 15730, 15541,
- 15352, 15162, 14972, 14781, 14589, 14397, 14204, 14010, 13816, 13621, 13426,
- 13230, 13033, 12836, 12639, 12441, 12242, 12043, 11843, 11643, 11442, 11241,
- 11039, 10837, 10634, 10431, 10228, 10024, 9819, 9615, 9409, 9204, 8998,
- 8791, 8585, 8377, 8170, 7962, 7754, 7545, 7336, 7127, 6918, 6708,
- 6498, 6288, 6077, 5866, 5655, 5444, 5232, 5020, 4808, 4596, 4383,
- 4171, 3958, 3745, 3532, 3319, 3105, 2892, 2678, 2464, 2250, 2036,
- 1822, 1608, 1394, 1179, 965, 751, 536, 322, 107
-};
-const Word16 wscw16q15_8_fx[40] =/*Q15 */
-{
- -32762, -32711, -32610, -32459, -32258, -32007, -31706, -31357,
- -30959, -30514, -30022, -29483, -28899, -28270, -27598, -26883,
- -26127, -25330, -24494, -23621, 22711, 21766, 20788, 19777,
- 18736, 17666, 16569, 15447, 14300, 13132, 11943, 10736,
- 9512, 8274, 7022, 5760, 4490, 3212, 1929, 643
-};
-const Word16 wscw16q15_16_fx[80] =/*Q15 */
-{
- -32766, -32754, -32729, -32691, -32640, -32577, -32501, -32413,
- -32313, -32200, -32074, -31936, -31786, -31624, -31449, -31262,
- -31063, -30853, -30630, -30395, -30149, -29891, -29622, -29341,
- -29049, -28746, -28431, -28106, -27770, -27423, -27066, -26698,
- -26320, -25931, -25533, -25125, -24707, -24279, -23843, -23397,
- 22942, 22478, 22006, 21525, 21035, 20538, 20033, 19520,
- 18999, 18472, 17937, 17395, 16846, 16291, 15730, 15162,
- 14589, 14010, 13426, 12836, 12242, 11643, 11039, 10431,
- 9819, 9204, 8585, 7962, 7336, 6708, 6077, 5444,
- 4808, 4171, 3532, 2892, 2250, 1608, 965, 322
-};
-const Word16 wscw16q15_32_fx[160] =/*Q15 */
-{
- -32768, -32764, -32758, -32749, -32736, -32720, -32701, -32679, -32654, -32626, -32594,
- -32559, -32522, -32481, -32437, -32389, -32339, -32286, -32229, -32169, -32107, -32041,
- -31972, -31900, -31825, -31747, -31665, -31581, -31494, -31403, -31310, -31214, -31114,
- -31012, -30906, -30798, -30687, -30572, -30455, -30335, -30212, -30086, -29957, -29825,
- -29690, -29553, -29412, -29269, -29123, -28974, -28823, -28668, -28511, -28351, -28188,
- -28023, -27855, -27684, -27511, -27335, -27156, -26975, -26791, -26604, -26415, -26223,
- -26029, -25833, -25633, -25432, -25228, -25021, -24812, -24601, -24387, -24171, -23953,
- -23732, -23509, -23284, 23056, 22827, 22595, 22361, 22125, 21886, 21646, 21403,
- 21159, 20912, 20663, 20413, 20160, 19905, 19649, 19390, 19130, 18868, 18604,
- 18338, 18071, 17802, 17531, 17258, 16984, 16708, 16430, 16151, 15871, 15588,
- 15305, 15019, 14733, 14445, 14155, 13865, 13572, 13279, 12984, 12688, 12391,
- 12093, 11793, 11492, 11191, 10888, 10584, 10279, 9973, 9666, 9358, 9049,
- 8740, 8429, 8118, 7806, 7493, 7180, 6865, 6550, 6235, 5919, 5602,
- 5285, 4967, 4649, 4330, 4011, 3692, 3372, 3052, 2731, 2411, 2090,
- 1768, 1447, 1126, 804, 483, 161
-};
-
-/* Codebook for quantization of norms */
-const Word32 dicn_fx[40] = /* Q=14 */
-{
- 2147483647, 1518500224,
- 1073741824, 759250112,
- 536870912, 379625056,
- 268435456, 189812528,
- 134217728, 94906264,
- 67108864, 47453132,
- 33554432, 23726566,
- 16777216, 11863283,
- 8388608, 5931642,
- 4194304, 2965821,
- 2097152, 1482910,
- 1048576, 741455,
- 524288, 370728,
- 262144, 185364,
- 131072, 92682,
- 65536, 46341,
- 32768, 23170,
- 16384, 11585,
- 8192, 5793,
- 4096, 2896
-};
-
-const Word32 dicn_pg_fx[45] = /* Q12 */
-{
- 536870912, 451452834, 379625056, 319225344, 268435456,
- 225726416, 189812528, 159612672, 134217728, 112863208,
- 94906264, 67108864, 47453132, 33554432, 23726566,
- 16777216, 11863283, 8388608, 5931641, 4194304,
- 2965821, 2097152, 1482910, 1048576, 741455,
- 524288, 370728, 262144, 185364, 131072,
- 92682, 65536, 46341, 32768, 23170,
- 16384, 11585, 8192, 5793, 4096,
- 2896, 2048, 1448, 1024, 724
-};
-const Word16 expPkEnrg_tbl[45] =
-{
- 0, 0, 0, 0, 0, 2, 2, 2, 2,
- 4, 4, 4, 6, 6, 8, 8, 10, 10,
- 12, 12, 14, 14, 16, 16, 18, 18, 20,
- 20, 22, 22, 24, 24, 26, 26, 28, 28,
- 30, 30, 32, 32, 34, 34, 36, 36, 38
-}; // Q0
-
-const Word32 manPkEnrg_tbl[45] =
-{
- 2147483646, 1518500308, 1073741787, 759250076, 536870912,
- 1518500294, 1073741787, 759250076, 536870912, 1518500294,
- 1073741787, 536870912, 1073741787, 536870912, 1073741787,
- 536870912, 1073741787, 536870912, 1073741606, 536870912,
- 1073741968, 536870912, 1073741244, 536870912, 1073741244,
- 536870912, 1073744140, 536870912, 1073744140, 536870912,
- 1073744140, 536870912, 1073744140, 536870912, 1073697800,
- 536870912, 1073697800, 536870912, 1073883168, 536870912,
- 1073512448, 536870912, 1073512448, 536870912, 1073512448
-}; // Q0
-const Word32 E_max5_tbl[40] =
-{
- 2047999999, 1448154663, 1024000000, 1448154663, 1024000000,
- 1448154663, 1024000000, 1448154663, 1024000000, 1448154663,
- 1024000000, 1448154663, 1024000000, 1448154663, 1024000000,
- 1448154663, 1024000000, 1448154785, 1024000000, 1448154785,
- 1024000000, 1448154296, 1024000000, 1448154296, 1024000000,
- 1448156250, 1024000000, 1448156250, 1024000000, 1448156250,
- 1024000000, 1448156250, 1024000000, 1448125000, 1024000000,
- 1448125000, 1024000000, 1448250000, 1024000000, 1448000000
-}; // Q0
-
-
-const Word16 resize_huffsizn[32] =
-{
- 0, 0, 0, 0, 0, 11, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2,
- 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0
-}; // Q0
-
-const Word16 huffsizn[32] =
-{
- 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 4, 4, 3, 3,
- 3, 3, 4, 4, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7
-}; // Q0
-
-const Word16 huffnorm_tran[32] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,122, 10, 6, 1,
- 0, 3, 2, 26, 58, 186, 442, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-}; // Q0
-
-const Word16 huffsizn_tran[32] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 5, 3, 2, 2,
- 2, 4, 6, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-}; // Q0
-
-const Word16 pgain_huffsizn[32] =
-{
- 10, 11, 10, 10, 9, 8, 6, 5, 5, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 5, 5, 6, 7, 7, 8, 10, 10, 12, 12
-}; // Q0
-
-const Word16 dicnlg2_float[40] =
-{
- 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,
- 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
- 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,
- 4, 3, 2, 1, 0, -1, -2, -3, -4, -5
-}; // Q0
-
-/*** Table for quantization of MLT coefficients ***/
-const Word16 norm_order_48[NB_SFM] =
-{
- 0, 1, 8, 9, 16, 20, 24, 28, 32, 36, 40, 41, 37, 33, 29, 25, 21, 17, 11, 10, 3, 2,
- 4, 5, 12, 13, 18, 22, 26, 30, 34, 38, 42, 43, 39, 35, 31, 27, 23, 19, 15, 14, 7, 6
-}; // Q0
-
-const Word16 norm_order_32[SFM_N_SWB] =
-{
- 0, 1, 8, 9, 16, 20, 24, 28, 32, 36, 37, 33, 29, 25, 21, 17, 11, 10, 3, 2,
- 4, 5, 12, 13, 18, 22, 26, 30, 34, 38, 35, 31, 27, 23, 19, 15, 14, 7, 6
-}; // Q0
-
-const Word16 norm_order_16[SFM_N_WB] =
-{
- 0, 1, 8, 9, 16, 20, 24, 21, 17, 11, 10, 3, 2,
- 4, 5, 12, 13, 18, 22, 25, 23, 19, 15, 14, 7, 6
-}; // Q0
-
-const Word16 intl_bw_16[N_INTL_GRP_16] = {16, 16}; // Q0
-const Word16 intl_bw_32[N_INTL_GRP_32] = {16, 24}; // Q0
-const Word16 intl_bw_48[N_INTL_GRP_48] = {16, 24, 32}; // Q0
-
-const Word16 intl_cnt_16[N_INTL_GRP_16] = {4, 1}; // Q0
-const Word16 intl_cnt_32[N_INTL_GRP_32] = {4, 4}; // Q0
-const Word16 intl_cnt_48[N_INTL_GRP_48] = {4, 3, 2}; // Q0
-
-const Word16 band_start_HQ[44] =
-{
- 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88,
- 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240,
- 256, 280, 304, 328, 352, 376, 400, 424, 448, 472, 496, 520,
- 544, 576, 608, 640, 672, 704, 736, 768
-}; // Q0
-
-const Word16 band_end_HQ[44] =
-{
- 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96,
- 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256,
- 280, 304, 328, 352, 376, 400, 424, 448, 472, 496, 520, 544,
- 576, 608, 640, 672, 704, 736, 768, 800
-}; // Q0
-
-const Word16 band_len_HQ[44] =
-{
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 32, 32, 32, 32, 32, 32, 32, 32
-}; // Q0
-
-const Word16 band_start_wb[26] =
-{
- 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88,
- 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240,
- 256, 288
-}; // Q0
-
-const Word16 band_end_wb[26] =
-{
- 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96,
- 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256,
- 288, 320
-}; // Q0
-
-const Word16 band_len_wb[26] =
-{
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16,
- 32, 32
-}; // Q0
-const Word16 band_len_harm_float[SFM_N_HARM_FB] = // Q0
-{
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 16, 16, 16, 16, 16, 16, 32, 32, 32, 48, 48, 48, 48, 64, 64, 64, 96
-};
-
-const Word16 band_start_harm[SFM_N_HARM_FB] =//Q0
-{
- 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120,
- 128, 144, 160, 176, 192, 208, 224, 256, 288, 320, 368, 416, 464, 512, 576, 640, 704
-};
-
-const Word16 band_end_harm[SFM_N_HARM_FB] =//Q0
-{
- 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128,
- 144, 160, 176, 192, 208, 224, 256, 288, 320, 368, 416, 464, 512, 576, 640, 704, 800
-};
-
-const Word16 rat_fx[SFM_N_WB] = { 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576,
- 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 13107, 13107
-};//Q14
-
-const Word16 sfm_width[20] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 8}; // Q0
-const Word16 a_map[20] = {8, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 7, 11}; // Q0
-
-
-const Word32 SQRT_DIM_fx[65] = /* sqrt(x) for x = 0, 1, ..., 64. in Q15 */
-{
- 0, 32768, 46341, 56756, 65536, 73271, 80265, 86696,
- 92682, 98304, 103622, 108679, 113512, 118147, 122607, 126910,
- 131072, 135106, 139023, 142832, 146543, 150162, 153696, 157150,
- 160530, 163840, 167085, 170268, 173392, 176461, 179478, 182445,
- 185364, 188238, 191069, 193858, 196608, 199320, 201996, 204636,
- 207243, 209818, 212361, 214874, 217358, 219814, 222243, 224646,
- 227023, 229376, 231705, 234010, 236293, 238555, 240795, 243014,
- 245213, 247393, 249554, 251696, 253820, 255926, 258015, 260088,
- 262144
-};
-
-
-
-/*------------------------------------------------------------------------------*
- * HQ core tables for SWB signals
- *------------------------------------------------------------------------------*/
-
-const Word16 short_window_48kHz_fx[L_FRAME48k / 2 / 2] = /* second half is symetric and omitted Q15*/
-{
- 107, 322, 536, 751, 965, 1179, 1394, 1608, 1822, 2036, 2250, 2464, 2678, 2892, 3105, 3319,
- 3532, 3745, 3958, 4171, 4383, 4596, 4808, 5020, 5232, 5444, 5655, 5866, 6077, 6288, 6498, 6708,
- 6918, 7127, 7336, 7545, 7754, 7962, 8170, 8377, 8585, 8791, 8998, 9204, 9409, 9615, 9819, 10024,
- 10228, 10431, 10634, 10837, 11039, 11241, 11442, 11643, 11843, 12043, 12242, 12441, 12639, 12836, 13033, 13230,
- 13426, 13621, 13816, 14010, 14204, 14397, 14589, 14781, 14972, 15162, 15352, 15541, 15730, 15917, 16105, 16291,
- 16477, 16662, 16846, 17030, 17213, 17395, 17576, 17757, 17937, 18116, 18294, 18472, 18648, 18824, 18999, 19174,
- 19347, 19520, 19692, 19863, 20033, 20202, 20371, 20538, 20705, 20871, 21035, 21199, 21363, 21525, 21686, 21846,
- 22006, 22164, 22322, 22478, 22634, 22788, 22942, 23095, 23246, 23397, 23546, 23695, 23843, 23989, 24135, 24279,
- 24423, 24565, 24707, 24847, 24986, 25125, 25262, 25398, 25533, 25667, 25800, 25931, 26062, 26191, 26320, 26447,
- 26573, 26698, 26821, 26944, 27066, 27186, 27305, 27423, 27540, 27655, 27770, 27883, 27995, 28106, 28216, 28324,
- 28431, 28537, 28642, 28746, 28848, 28949, 29049, 29148, 29245, 29341, 29436, 29530, 29622, 29713, 29803, 29891,
- 29979, 30064, 30149, 30232, 30315, 30395, 30475, 30553, 30630, 30705, 30780, 30853, 30924, 30994, 31063, 31131,
- 31197, 31262, 31326, 31388, 31449, 31508, 31567, 31624, 31679, 31733, 31786, 31837, 31887, 31936, 31984, 32029,
- 32074, 32117, 32159, 32200, 32239, 32276, 32313, 32348, 32381, 32413, 32444, 32473, 32501, 32528, 32553, 32577,
- 32600, 32621, 32640, 32658, 32675, 32691, 32705, 32717, 32729, 32738, 32747, 32754, 32759, 32764, 32766, 32767,
-};
-const Word16 short_window_32kHz_fx[L_FRAME32k / 2 / 2] = /* second half is symetric and omitted Q15*/
-{
- 161, 483, 804, 1126, 1447, 1768, 2090, 2411, 2731, 3052, 3372, 3692, 4011, 4330, 4649, 4967,
- 5285, 5602, 5919, 6235, 6550, 6865, 7180, 7493, 7806, 8118, 8429, 8740, 9049, 9358, 9666, 9973,
- 10279, 10584, 10888, 11191, 11492, 11793, 12093, 12391, 12688, 12984, 13279, 13572, 13865, 14155, 14445, 14733,
- 15019, 15305, 15588, 15871, 16151, 16430, 16708, 16984, 17258, 17531, 17802, 18071, 18338, 18604, 18868, 19130,
- 19390, 19649, 19905, 20160, 20413, 20663, 20912, 21159, 21403, 21646, 21886, 22125, 22361, 22595, 22827, 23056,
- 23284, 23509, 23732, 23953, 24171, 24387, 24601, 24812, 25021, 25228, 25432, 25633, 25833, 26029, 26223, 26415,
- 26604, 26791, 26975, 27156, 27335, 27511, 27684, 27855, 28023, 28188, 28351, 28511, 28668, 28823, 28974, 29123,
- 29269, 29412, 29553, 29690, 29825, 29957, 30086, 30212, 30335, 30455, 30572, 30687, 30798, 30906, 31012, 31114,
- 31214, 31310, 31403, 31494, 31581, 31665, 31747, 31825, 31900, 31972, 32041, 32107, 32169, 32229, 32286, 32339,
- 32389, 32437, 32481, 32522, 32559, 32594, 32626, 32654, 32679, 32701, 32720, 32736, 32749, 32758, 32764, 32767,
-};
-
-const Word16 short_window_16kHz_fx[L_FRAME16k / 2 / 2] = /* second half is symetric and omitted Q15*/
-{
- 322, 965, 1608, 2250, 2892, 3532, 4171, 4808, 5444, 6077, 6708, 7336, 7962, 8585, 9204, 9819,
- 10431, 11039, 11643, 12242, 12836, 13426, 14010, 14589, 15162, 15730, 16291, 16846, 17395, 17937, 18472, 18999,
- 19520, 20033, 20538, 21035, 21525, 22006, 22478, 22942, 23397, 23843, 24279, 24707, 25125, 25533, 25931, 26320,
- 26698, 27066, 27423, 27770, 28106, 28431, 28746, 29049, 29341, 29622, 29891, 30149, 30395, 30630, 30853, 31063,
- 31262, 31449, 31624, 31786, 31936, 32074, 32200, 32313, 32413, 32501, 32577, 32640, 32691, 32729, 32754, 32766,
-};
-
-const Word16 short_window_8kHz_fx[L_FRAME8k / 2 / 2] = /* second half is symetric and omitted Q15*/
-{
- 643, 1929, 3212, 4490, 5760, 7022, 8274, 9512,
- 10736, 11943, 13132, 14300, 15447, 16569, 17666, 18736,
- 19777, 20788, 21766, 22711, 23621, 24494, 25330, 26127,
- 26883, 27598, 28270, 28899, 29483, 30022, 30514, 30959,
- 31357, 31706, 32007, 32258, 32459, 32610, 32711, 32762,
-};
-
-const Word16 inv_jp2[64] =//Q15
-{
- 16384, 10923, 8192, 6554, 5461, 4681, 4096, 3641, 3277, 2979, 2731, 2521, 2341, 2185, 2048, 1928,
- 1820, 1725, 1638, 1560, 1489, 1425, 1365, 1311, 1260, 1214, 1170, 1130, 1092, 1057, 1024, 993,
- 964, 936, 910, 886, 862, 840, 819, 799, 780, 762, 745, 728, 712, 697, 683, 669,
- 655, 643, 630, 618, 607, 596, 585, 575, 565, 555, 546, 537, 529, 520, 512, 504
-};
-const Word16 subf_norm_groups[4][11] =
-{
- {0,1,8,9,16,20,24,28,32,36,40},
- {2,3,10,11,17,21,25,29,33,37,41},
- {4,5,12,13,18,22,26,30,34,38,42},
- {6,7,14,15,19,23,27,31,35,39,43}
-}; // Q0
-
-const Word16 gain_att_fx[40] = /* Q=15 */
-{
- 15711, 19367, 21781, 23743, 24899, 25929, 26758, 27514,
- 28059, 28562, 28994, 29398, 29693, 29970, 30213, 30442,
- 30619, 30786, 30936, 31077, 31190, 31298, 31395, 31488,
- 31564, 31637, 31704, 31768, 31822, 31873, 31920, 31966,
- 32005, 32042, 32077, 32111, 32140, 32168, 32195, 32220
-};
-
-const Word16 stab_trans_fx[10] = /* Q15 */
-{
- 16384, 11381, 7232, 4292, 2433,
- 1341, 728, 391, 209, 112
-};
-
-const Word16 env_stab_tp_fx[2][2] = /* Q15 */
-{
- {32735, 16384},
- {33, 16384}
-};
-
-const Word16 att_step_fx[4] = /* Q=13 */
-{
- 32767, 16384, 10923, 8192
-};
-
-const Word32 table_logcum_fx[563] =//Q16
-{
- 0, 0, 0, 65536, 169408, 300480, 452650, 622058, 806041,
- 1002649, 1210393, 1428099, 1654816, 1889761, 2132272, 2381791, 2637833,
- 2899977, 3167853, 3441134, 3719526, 4002767, 4290623, 4582876, 4879332,
- 5179812, 5484152, 5792200, 6103816, 6418871, 6737244, 7058822, 7383500,
- 7711180, 8041769, 8375181, 8711333, 9050150, 9391557, 9735485, 10081869,
- 10430647, 10781759, 11135150, 11490766, 11848556, 12208469, 12570461, 12934487,
- 13300503, 13668469, 14038345, 14410092, 14783676, 15159061, 15536214, 15915101,
- 16295692, 16677956, 17061866, 17447390, 17834504, 18223180, 18613394, 19005122,
- 19398338, 19793020, 20189146, 20586692, 20985640, 21385968, 21787658, 22190686,
- 22595040, 23000696, 23407638, 23815850, 24225314, 24636014, 25047934, 25461060,
- 25875374, 26290862, 26707510, 27125304, 27544232, 27964278, 28385428, 28807674,
- 29231000, 29655392, 30080844, 30507338, 30934866, 31363416, 31792978, 32223540,
- 32655092, 33087624, 33521126, 33955588, 34391000, 34827352, 35264636, 35702840,
- 36141960, 36581988, 37022908, 37464716, 37907404, 38350964, 38795388, 39240668,
- 39686792, 40133760, 40581560, 41030188, 41479632, 41929888, 42380948, 42832808,
- 43285456, 43738892, 44193104, 44648088, 45103840, 45560348, 46017612, 46475624,
- 46934376, 47393864, 47854080, 48315024, 48776684, 49239060, 49702144, 50165928,
- 50630412, 51095588, 51561452, 52028000, 52495224, 52963124, 53431688, 53900916,
- 54370808, 54841348, 55312540, 55784380, 56256856, 56729972, 57203720, 57678096,
- 58153096, 58628716, 59104952, 59581800, 60059256, 60537316, 61015980, 61495236,
- 61975084, 62455524, 62936548, 63418156, 63900340, 64383100, 64866428, 65350328,
- 65834792, 66319816, 66805396, 67291536, 67778224, 68265456, 68753240, 69241560,
- 69730424, 70219816, 70709744, 71200208, 71691192, 72182704, 72674736, 73167280,
- 73660344, 74153920, 74648008, 75142600, 75637704, 76133296, 76629400, 77125992,
- 77623080, 78120656, 78618728, 79117280, 79616320, 80115840, 80615832, 81116312,
- 81617256, 82118680, 82620568, 83122920, 83625744, 84129024, 84632768, 85136968,
- 85641624, 86146728, 86652288, 87158304, 87664760, 88171664, 88679008, 89186792,
- 89695016, 90203680, 90712776, 91222304, 91732256, 92242648, 92753464, 93264704,
- 93776368, 94288448, 94800952, 95313872, 95827208, 96340960, 96855120, 97369696,
- 97884672, 98400064, 98915856, 99432048, 99948648, 100465640, 100983040, 101500832,
- 102019016, 102537592, 103056568, 103575928, 104095672, 104615808, 105136328, 105657232,
- 106178520, 106700184, 107222232, 107744656, 108267456, 108790632, 109314176, 109838096,
- 110362384, 110887040, 111412064, 111937448, 112463208, 112989320, 113515800, 114042640,
- 114569832, 115097392, 115625304, 116153568, 116682184, 117211160, 117740480, 118270152,
- 118800168, 119330536, 119861248, 120392312, 120923712, 121455448, 121987536, 122519960,
- 123052720, 123585816, 124119248, 124653016, 125187120, 125721552, 126256320, 126791416,
- 127326840, 127862592, 128398664, 128935072, 129471800, 130008856, 130546224, 131083920,
- 131621936, 132160272, 132698920, 133237888, 133777176, 134316768, 134856688, 135396912,
- 135937440, 136478288, 137019440, 137560912, 138102688, 138644768, 139187152, 139729840,
- 140272832, 140816128, 141359712, 141903616, 142447808, 142992304, 143537104, 144082192,
- 144627568, 145173248, 145719232, 146265504, 146812064, 147358912, 147906048, 148453488,
- 149001200, 149549216, 150097504, 150646096, 151194960, 151744112, 152293536, 152843264,
- 153393264, 153943536, 154494096, 155044944, 155596064, 156147456, 156699120, 157251072,
- 157803296, 158355792, 158908560, 159461616, 160014928, 160568512, 161122368, 161676496,
- 162230896, 162785568, 163340496, 163895696, 164451168, 165006896, 165562896, 166119152,
- 166675664, 167232448, 167789504, 168346816, 168904368, 169462208, 170020288, 170578624,
- 171137232, 171696080, 172255200, 172814560, 173374192, 173934064, 174494192, 175054576,
- 175615216, 176176096, 176737232, 177298608, 177860256, 178422128, 178984256, 179546640,
- 180109264, 180672128, 181235248, 181798608, 182362208, 182926064, 183490144, 184054480,
- 184619056, 185183872, 185748928, 186314224, 186879760, 187445520, 188011536, 188577776,
- 189144272, 189710992, 190277936, 190845136, 191412560, 191980208, 192548112, 193116224,
- 193684592, 194253168, 194821984, 195391040, 195960320, 196529824, 197099568, 197669520,
- 198239712, 198810144, 199380784, 199951648, 200522752, 201094080, 201665616, 202237392,
- 202809376, 203381600, 203954032, 204526688, 205099568, 205672672, 206246000, 206819536,
- 207393296, 207967280, 208541472, 209115888, 209690528, 210265376, 210840432, 211415712,
- 211991216, 212566912, 213142848, 213718976, 214295328, 214871888, 215448672, 216025664,
- 216602864, 217180272, 217757888, 218335712, 218913760, 219492000, 220070464, 220649120,
- 221228000, 221807072, 222386368, 222965856, 223545552, 224125456, 224705568, 225285872,
- 225866400, 226447120, 227028032, 227609168, 228190496, 228772016, 229353760, 229935680,
- 230517824, 231100160, 231682688, 232265424, 232848352, 233431472, 234014800, 234598336,
- 235182048, 235765968, 236350080, 236934400, 237518896, 238103600, 238688496, 239273600,
- 239858880, 240444352, 241030032, 241615888, 242201952, 242788192, 243374640, 243961264,
- 244548096, 245135104, 245722304, 246309696, 246897280, 247485056, 248073008, 248661152,
- 249249488, 249838016, 250426720, 251015616, 251604704, 252193968, 252783424, 253373056,
- 253962880, 254552896, 255143088, 255733472, 256324032, 256914768, 257505696, 258096800,
- 258688096, 259279568, 259871216, 260463056, 261055056, 261647264, 262239632, 262832192,
- 263424928, 264017840, 264610928, 265204192, 265797632, 266391264, 266985072, 267579040,
- 268173200, 268767520, 269362048, 269956736, 270551584, 271146624, 271741824, 272337216,
- 272932768, 273528480, 274124384, 274720480, 275316704, 275913120, 276509728, 277106496,
- 277703424, 278300544, 278897824, 279495264, 280092896, 280690688, 281288640, 281886752,
- 282485056, 283083520
-};
-const Word32 pow_getbitsfrompulses_fx[16] = /*Q21 */
-{
- 2097152, 2190001, 2286961, 2388214, 2493948, 2604365, 2719671, 2840081,
- 2965822, 3097129, 3234251, 3377442, 3526976, 3683128, 3846194, 4016480
-};
-const Word16 DDP_fx[4] = { 3, 0, 1, 2 };//Q0
-
-const Word16 step_tcq[8][STATES] = { {0,4}, {0,4}, {1,5}, {1,5}, {2,6}, {2,6}, {3,7}, {3,7} }; // Q0
-const Word16 denc[8][STATES] = { {0,2}, {2,0}, {1,3}, {3,1}, {2,0}, {0,2}, {3,1}, {1,3} }; /* enc trellis Q0*/
-const Word16 ddec[8][STATES] = { {0,2}, {1,3}, {2,0}, {3,1}, {2,0}, {3,1}, {0,2}, {1,3} }; /* dec trellis Q0*/
-
-
-const Word16 step_LSB[STATES_LSB][2] = { {0,1}, {2,3}, {0,1}, {2,3} }; // Q0
-const Word16 denc_LSB[STATES_LSB][2] = { {0,3}, {2,1}, {3,0}, {1,2} }; // Q0
-const Word16 dqnt_LSB[STATES_LSB][4] = { {0,8,1,8}, {0,8,1,8}, {8,0,8,1}, {8,0,8,1} }; // Q0
-
-const Word16 dstep_LSB[4][2] = { {0,2}, {0,2}, {1,3}, {1,3} }; // Q0
-const Word16 ddec_LSB[4][2] = { {0,3}, {3,0}, {2,1}, {1,2} }; // Q0
-
-
-const Word16 nextstate[STATES][2] = {{0, 1}, {2, 3}, {4, 5}, {6, 7}, {0, 1}, {2, 3}, {4, 5}, {6, 7}};/*current state points to next two states Q0*/
-
-/*------------------------------------------------------------------------------*
- * PVQ tables
- *------------------------------------------------------------------------------*/
-
-const Word16 fine_gain_bits[8] = {0, 0, 0, 1, 2, 2, 4, 5}; // Q0
-const Word16 finegain_1_fx[2] = { -12204, 12647 }; /* Q14 */
-const Word16 finegain_2_fx[4] = { -17773, -5925, 6010, 18769 }; /* Q14 */
-const Word16 finegain_3_fx[8] = { -16384, -11703, -7022, -2341, 2341, 7022, 11703, 16384 }; /* Q14 */
-const Word16 finegain_4_fx[16] = /* Q14 */
-{
- -21683, -18292, -14998, -11876, -8936, -6239, -3702, -1371,
- 945, 3275, 6088, 9079, 12450, 15999, 19796, 23868
-};
-const Word16 finegain_5_fx[32] = /* Q14 */
-{
- -21462, -18895, -16284, -14135, -12605, -11307, -10139, -8910,
- -8028, -6792, -5638, -4812, -3672, -2681, -1725, -479,
- 449, 1390, 2364, 3433, 4579, 5516, 6769, 7767,
- 9085, 10152, 11009, 12535, 14765, 17093, 20094, 24716
-};
-const Word16* finegain_fx[5] = { finegain_1_fx, finegain_2_fx, finegain_3_fx, finegain_4_fx, finegain_5_fx };/* Q14 */
-
-
-const UWord8 hBitsMinus1_N01[2] = {1, 7}; // Q0
-
-const UWord8 hBitsMinus1_N02[65]=
-{
- 64, 15, 23, 28, 31, 34, 36, 38, 39, 41, 42, 43, 44, 45, 46, 47,
- 47, 48, 49, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59,
- 60, 61, 62, 63, 63, 64, 65, 65, 67, 68, 69, 69, 70, 71, 72, 72,
- 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 85, 86, 87,
- 87
-}; // Q0
-
-const UWord8 hBitsMinus1_N03[65]=
-{
- 64, 20, 33, 41, 48, 53, 57, 61, 64, 66, 69, 71, 73, 75, 76, 78,
- 80, 81, 82, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98, 99, 100, 102,
- 104, 106, 108, 110, 111, 113, 114, 115, 118, 120, 122, 123, 125, 127, 128, 129,
- 131, 133, 135, 137, 139, 141, 142, 144, 145, 146, 149, 151, 153, 155, 157, 158,
- 160
-}; // Q0
-
-const UWord8 hBitsMinus1_N04[65]=
-{
- 64, 23, 39, 51, 60, 67, 73, 79, 83, 87, 91, 94, 97, 100, 102, 105,
- 107, 109, 111, 113, 115, 116, 119, 122, 125, 127, 130, 132, 134, 136, 138, 141,
- 144, 147, 150, 152, 154, 156, 158, 160, 164, 167, 170, 173, 175, 177, 180, 182,
- 184, 187, 190, 193, 196, 199, 201, 203, 205, 207, 211, 214, 217, 220, 222, 225,
- 227
-}; // Q0
-
-const UWord8 hBitsMinus1_N05[54]=
-{
- 53, 26, 45, 59, 70, 79, 87, 94, 100, 105, 110, 114, 118, 122, 125, 128,
- 131, 134, 136, 139, 141, 144, 148, 152, 155, 158, 161, 164, 167, 170, 172, 176,
- 181, 184, 188, 191, 194, 197, 200, 202, 207, 211, 215, 219, 222, 225, 228, 231,
- 233, 238, 242, 246, 250, 253
-}; // Q0
-
-const UWord8 hBitsMinus1_N06[42]=
-{
- 41, 28, 49, 65, 78, 89, 99, 107, 114, 120, 126, 132, 136, 141, 145, 149,
- 153, 156, 159, 162, 165, 168, 173, 178, 183, 187, 191, 194, 198, 201, 204, 209,
- 214, 219, 224, 228, 231, 235, 238, 241, 247, 253
-}; // Q0
-
-const UWord8 hBitsMinus1_N07[34]=
-{
- 33, 30, 52, 70, 85, 98, 109, 118, 126, 134, 141, 147, 153, 158, 163, 168,
- 172, 176, 180, 184, 188, 191, 197, 203, 208, 213, 218, 222, 226, 230, 233, 240,
- 246, 252
-}; // Q0
-
-const UWord8 hBitsMinus1_N08[29]=
-{
- 28, 31, 55, 75, 91, 105, 117, 128, 138, 146, 154, 161, 168, 174, 180, 185,
- 190, 195, 200, 204, 208, 212, 219, 226, 232, 238, 243, 248, 253
-}; // Q0
-
-const UWord8 hBitsMinus1_N09[25]=
-{
- 24, 33, 58, 79, 97, 112, 125, 137, 148, 157, 166, 174, 182, 189, 195, 201,
- 207, 212, 217, 222, 227, 231, 240, 247, 254
-}; // Q0
-
-const UWord8 hBitsMinus1_N10[22]=
-{
- 21, 34, 61, 83, 101, 118, 132, 145, 157, 167, 177, 186, 194, 202, 209, 216,
- 222, 228, 234, 239, 245, 250
-}; // Q0
-
-const UWord8 hBitsMinus1_N11[19]=
-{
- 18, 35, 63, 86, 106, 123, 139, 152, 165, 176, 187, 197, 206, 214, 222, 230,
- 237, 243, 250
-}; // Q0
-
-const UWord8 hBitsMinus1_N12[17]=
-{
- 16, 36, 65, 89, 110, 128, 144, 159, 173, 185, 196, 207, 217, 226, 234, 242,
- 250
-}; // Q0
-
-const UWord8 hBitsMinus1_N13[16]=
-{
- 15, 37, 67, 92, 113, 133, 150, 165, 180, 193, 205, 216, 227, 237, 246, 254,
-}; // Q0
-
-const UWord8 hBitsMinus1_N14[14]=
-{
- 13, 38, 68, 94, 117, 137, 155, 171, 186, 200, 213, 225, 236, 247
-}; // Q0
-
-const UWord8 hBitsMinus1_N15[13]=
-{
- 12, 39, 70, 97, 120, 141, 160, 177, 193, 207, 221, 233, 245
-}; // Q0
-
-const UWord8 hBitsMinus1_N16[13]=
-{
- 12, 39, 71, 99, 123, 144, 164, 182, 198, 214, 228, 241, 253
-}; // Q0
-
-const UWord8 hBitsMinus1_N17[12]=
-{
- 11, 40, 73, 101, 126, 148, 168, 187, 204, 220, 234, 248
-}; // Q0
-
-const UWord8 hBitsMinus1_N18[12]=
-{
- 11, 41, 74, 103, 128, 151, 172, 191, 209, 225, 241, 255
-}; // Q0
-
-const UWord8 hBitsMinus1_N19[11]=
-{
- 10, 41, 75, 105, 131, 154, 176, 196, 214, 231, 247
-}; // Q0
-
-const UWord8 hBitsMinus1_N20[11]=
-{
- 10, 42, 77, 107, 133, 157, 179, 200, 219, 236, 253
-}; // Q0
-
-const UWord8 hBitsMinus1_N21[10]=
-{
- 9, 43, 78, 108, 135, 160, 183, 204, 223, 241
-}; // Q0
-
-const UWord8 hBitsMinus1_N22[10]=
-{
- 9, 43, 79, 110, 138, 163, 186, 207, 227, 246
-}; // Q0
-
-const UWord8 hBitsMinus1_N23[10]=
-{
- 9, 44, 80, 111, 140, 165, 189, 211, 231, 250
-}; // Q0
-
-const UWord8 hBitsMinus1_N24[10]=
-{
- 9, 44, 81, 113, 142, 168, 192, 214, 235, 255
-}; // Q0
-
-const UWord8 hBitsMinus1_N25[9]=
-{
- 8, 45, 82, 114, 143, 170, 195, 217, 239
-}; // Q0
-
-const UWord8 hBitsMinus1_N26[9]=
-{
- 8, 45, 83, 116, 145, 172, 197, 221, 242
-}; // Q0
-
-const UWord8 hBitsMinus1_N27[9]=
-{
- 8, 46, 84, 117, 147, 175, 200, 224, 246
-}; // Q0
-
-const UWord8 hBitsMinus1_N28[9]=
-{
- 8, 46, 84, 118, 149, 177, 202, 227, 249
-}; // Q0
-const UWord8 hBitsMinus1_N29[9]=
-{
- 8, 46, 85, 119, 150, 179, 205, 229, 252
-}; // Q0
-const UWord8 hBitsMinus1_N30[8]=
-{
- 7, 47, 86, 121, 152, 181, 207, 232
-}; // Q0
-const UWord8 hBitsMinus1_N31[8]=
-{
- 7, 47, 87, 122, 153, 182, 209, 235
-}; // Q0
-const UWord8 hBitsMinus1_N32[8]=
-{
- 7, 47, 87, 123, 155, 184, 212, 237
-}; // Q0
-const UWord8 hBitsMinus1_N33[8]=
-{
- 7, 48, 88, 124, 156, 186, 214, 240
-}; // Q0
-const UWord8 hBitsMinus1_N34[8]=
-{
- 7, 48, 89, 125, 158, 188, 216, 242
-}; // Q0
-const UWord8 hBitsMinus1_N35[8]=
-{
- 7, 49, 90, 126, 159, 189, 218, 245
-}; // Q0
-const UWord8 hBitsMinus1_N36[8]=
-{
- 7, 49, 90, 127, 160, 191, 220, 247
-}; // Q0
-const UWord8 hBitsMinus1_N37[8]=
-{
- 7, 49, 91, 128, 162, 193, 222, 249
-}; // Q0
-const UWord8 hBitsMinus1_N38[8]=
-{
- 7, 49, 91, 129, 163, 194, 224, 251
-}; // Q0
-const UWord8 hBitsMinus1_N39[8]=
-{
- 7, 50, 92, 130, 164, 196, 225, 253
-}; // Q0
-const UWord8 hBitsMinus1_N40[8]=
-{
- 7, 50, 93, 131, 165, 197, 227, 255
-}; // Q0
-const UWord8 hBitsMinus1_N41[7]=
-{
- 6, 50, 93, 131, 166, 199, 229
-}; // Q0
-const UWord8 hBitsMinus1_N42[7]=
-{
- 6, 51, 94, 132, 167, 200, 230
-}; // Q0
-const UWord8 hBitsMinus1_N43[7]=
-{
- 6, 51, 94, 133, 168, 201, 232
-}; // Q0
-const UWord8 hBitsMinus1_N44[7]=
-{
- 6, 51, 95, 134, 170, 203, 234
-}; // Q0
-const UWord8 hBitsMinus1_N45[7]=
-{
- 6, 51, 95, 135, 171, 204, 235
-}; // Q0
-const UWord8 hBitsMinus1_N46[7]=
-{
- 6, 52, 96, 135, 172, 205, 237
-}; // Q0
-const UWord8 hBitsMinus1_N47[7]=
-{
- 6, 52, 96, 136, 173, 206, 238
-}; // Q0
-const UWord8 hBitsMinus1_N48[7]=
-{
- 6, 52, 97, 137, 174, 208, 240
-}; // Q0
-const UWord8 hBitsMinus1_N49[7]=
-{
- 6, 52, 97, 138, 175, 209, 241
-}; // Q0
-const UWord8 hBitsMinus1_N50[7]=
-{
- 6, 53, 98, 138, 175, 210, 243
-}; // Q0
-const UWord8 hBitsMinus1_N51[7]=
-{
- 6, 53, 98, 139, 176, 211, 244
-}; // Q0
-const UWord8 hBitsMinus1_N52[7]=
-{
- 6, 53, 99, 140, 177, 212, 245
-}; // Q0
-const UWord8 hBitsMinus1_N53[7]=
-{
- 6, 53, 99, 140, 178, 213, 247
-}; // Q0
-const UWord8 hBitsMinus1_N54[7]=
-{
- 6, 54, 100, 141, 179, 214, 248
-}; // Q0
-const UWord8 hBitsMinus1_N55[7]=
-{
- 6, 54, 100, 142, 180, 216, 249
-}; // Q0
-const UWord8 hBitsMinus1_N56[7]=
-{
- 6, 54, 100, 142, 181, 217, 250
-}; // Q0
-const UWord8 hBitsMinus1_N57[7]=
-{
- 6, 54, 101, 143, 181, 218, 252
-};
-const UWord8 hBitsMinus1_N58[7]=
-{
- 6, 54, 101, 143, 182, 219, 253
-}; // Q0
-const UWord8 hBitsMinus1_N59[7]=
-{
- 6, 55, 102, 144, 183, 220, 254
-}; // Q0
-const UWord8 hBitsMinus1_N60[7]=
-{
- 6, 55, 102, 145, 184, 221, 255
-}; // Q0
-const UWord8 hBitsMinus1_N61[6]=
-{
- 5, 55, 102, 145, 185, 221
-}; // Q0
-const UWord8 hBitsMinus1_N62[6]=
-{
- 5, 55, 103, 146, 185, 222
-}; // Q0
-const UWord8 hBitsMinus1_N63[6]=
-{
- 5, 55, 103, 146, 186, 223
-}; // Q0
-const UWord8 hBitsMinus1_N64[6]=
-{
- 5, 55, 103, 147, 187, 224
-}; // Q0
-const Word16 dsHighDiracsTab[PVQ_MAX_BAND_SIZE - DS_INDEX_LINEAR_END ] =
-{
- 23, 25, 27, 29, 31, 33, 35, 37, 39,
- 43, 47, 51, 55, 59, 63, 67, 71, 75,
- 83, 91, 99, 107, 115, 123, 131, 139, 147,
- 163, 179, 195, 211, 227, 243, 259, 275, 291,
- 323, 355, 387, 419, 451, 483, 512
-}; // Q0
-
-const UWord32 intLimCDivInvDQ31[67+1] =
-{
- 0x00000000, 0x80000000, 0x40000000, 0x2aaaaaab, 0x20000000, 0x1999999a, 0x15555556, 0x12492493,
- 0x10000000, 0x0e38e38f, 0x0ccccccd, 0x0ba2e8bb, 0x0aaaaaab, 0x09d89d8a, 0x0924924a, 0x08888889,
- 0x08000000, 0x07878788, 0x071c71c8, 0x06bca1b0, 0x06666667, 0x06186187, 0x05d1745e, 0x0590b217,
- 0x05555556, 0x051eb852, 0x04ec4ec5, 0x04bda130, 0x04924925, 0x0469ee59, 0x04444445, 0x04210843,
- 0x04000000, 0x03e0f83f, 0x03c3c3c4, 0x03a83a84, 0x038e38e4, 0x03759f23, 0x035e50d8, 0x03483484,
- 0x03333334, 0x031f3832, 0x030c30c4, 0x02fa0be9, 0x02e8ba2f, 0x02d82d83, 0x02c8590c, 0x02b93106,
- 0x02aaaaab, 0x029cbc15, 0x028f5c29, 0x02828283, 0x02762763, 0x026a43a0, 0x025ed098, 0x0253c826,
- 0x02492493, 0x023ee090, 0x0234f72d, 0x022b63cc, 0x02222223, 0x02192e2a, 0x02108422, 0x02082083,
- 0x02000000, 0x01f81f82, 0x01f07c20, 0x01e9131b
-}; // Q0
-
-const UWord8 obtainEnergyQuantizerDensity_f[57] =
- {
- 1, 1, 1, 1, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 4, 4, 4,
- 4, 4, 4, 6, 6, 6, 6, 8,
- 8, 8, 10,10,12,12,14,14,
- 16,18,20,20,22,24,26,30,
- 32,34,38,42,46,50,54,58,
- 64,70,76,82,90,98,108,118, 128
-}; // Q0
-
-
-/* (char)ceil(log2(hBitsN[N][0])) - 2) */
-const UWord8 f_log2_n[ PVQ_MAX_BAND_SIZE + 1] =
-{
- 0xff, 0xff, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
- 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01}; // Q0
-
-const UWord8 * const hBitsN[ PVQ_MAX_BAND_SIZE + 1 ]=
-{
-f_log2_n/*N=0*/, hBitsMinus1_N01, hBitsMinus1_N02, hBitsMinus1_N03, hBitsMinus1_N04,
-hBitsMinus1_N05, hBitsMinus1_N06, hBitsMinus1_N07, hBitsMinus1_N08, hBitsMinus1_N09,
-hBitsMinus1_N10, hBitsMinus1_N11, hBitsMinus1_N12, hBitsMinus1_N13, hBitsMinus1_N14,
-hBitsMinus1_N15, hBitsMinus1_N16, hBitsMinus1_N17, hBitsMinus1_N18, hBitsMinus1_N19,
-hBitsMinus1_N20, hBitsMinus1_N21, hBitsMinus1_N22, hBitsMinus1_N23, hBitsMinus1_N24,
-hBitsMinus1_N25, hBitsMinus1_N26, hBitsMinus1_N27, hBitsMinus1_N28, hBitsMinus1_N29,
-hBitsMinus1_N30, hBitsMinus1_N31, hBitsMinus1_N32, hBitsMinus1_N33, hBitsMinus1_N34,
-hBitsMinus1_N35, hBitsMinus1_N36, hBitsMinus1_N37, hBitsMinus1_N38, hBitsMinus1_N39,
-hBitsMinus1_N40, hBitsMinus1_N41, hBitsMinus1_N42, hBitsMinus1_N43, hBitsMinus1_N44,
-hBitsMinus1_N45, hBitsMinus1_N46, hBitsMinus1_N47, hBitsMinus1_N48, hBitsMinus1_N49,
-hBitsMinus1_N50, hBitsMinus1_N51, hBitsMinus1_N52, hBitsMinus1_N53, hBitsMinus1_N54,
-hBitsMinus1_N55, hBitsMinus1_N56, hBitsMinus1_N57, hBitsMinus1_N58, hBitsMinus1_N59,
-hBitsMinus1_N60, hBitsMinus1_N61, hBitsMinus1_N62, hBitsMinus1_N63, hBitsMinus1_N64,
-}; // Q0
-
-const Word16 lim_neg_inv_tbl_fx[MAX_SPLITS + 1 ] =
-{ /* 1 = optimized inv_tbl_fx constant for div by 1, Q15 */
- /* 2-10 = negated inv_tbl_fx Q15*/
- 0,
- -32768, -16384, -10923, -8192, -6554,
- -5462, -4681, -4096, -3641, -3277
-};
-
-const Word16 Idx2Freq_Tbl[] = { 6554/*12.8*512*/, 48 * 512, 13108/*25.6*512*/, 32 * 512, 16 * 512, 8 * 512 }; /* in Q9 */
-
-const Word16 fg_inv_tbl_fx [HQ_MAX_BAND_LEN/8 + 1 ] =
-{ /* i/8 , slice of inv_tbl_fx , Q15 */
- 0,
- 4096, 2048, 1366, 1024, 820, 683,
- 586, 512, 456, 410, 373, 342
-};
-
-
-const UWord32 exactdivodd[ODD_DIV_SIZE] =
-{
- /* exactdivodd[0]=1/1, exactdivodd[1]=1/3, exactdivodd[n]=1/(2*n+1), exactdivodd[47]=1/95 ) */
- 1U, 2863311531U, 3435973837U, 3067833783U, 954437177U, 3123612579U, 3303820997U, 4008636143U,
- 4042322161U, 678152731U, 1022611261U, 3921491879U, 3264175145U, 1749801491U, 1332920885U, 3186588639U,
- 1041204193U, 2331553675U, 2437684141U, 2532929431U, 3247414297U, 799063683U, 2767867813U, 1736263375U,
- 438261969U, 4210752251U, 2350076445U, 1483715975U, 3089362441U, 2693454067U, 3238827797U, 3204181951U,
- 3237744577U, 128207979U, 2738819725U, 3811027319U, 3353604601U, 2519714147U, 1059797125U, 1631000239U,
- 2014922929U, 724452315U, 4244438269U, 1875962727U, 4198451177U, 3539808211U, 1062196213U, 3571604383U
-}; // Q0
-
-const Word16 gain_cb_size[MAX_GAIN_BITS] = {2, 4, 8, 16, 32}; // Q0
-
-const Word16 inner_frame_tbl[4] = {L_FRAME8k, L_FRAME16k, L_FRAME32k, L_FRAME48k}; /* corresponds to NB, WB, SWB, FB Q0*/
-const Word16 hq_nominal_scaling_inv[7] = { 0, 8192, 11585, 0, 16384, 0, 20066 }; /*Q13 */
-const Word16 hq_nominal_scaling[7] = { 0, 32767, 23170, 0, 16384, 0, 13377 }; /*Q15 */
-
-const Word16 l_spec_tbl[4] = {L_SPEC8k, L_SPEC16k, L_SPEC32k, L_SPEC48k}; /* corresponds to NB, WB, SWB, FB Q0*/
-const Word16 l_spec_ext_tbl[4] = {0, L_SPEC16k_EXT, L_SPEC32k_EXT, L_SPEC48k_EXT}; /* corresponds to NB, WB, SWB, FB Q0*/
-const Word16 sinq_16k[3 * L_FRAME16k / 20] =/*Q15 */
-{
- 536, 1608, 2678, 3745, 4808, 5866, 6918, 7962,
- 8998, 10024, 11039, 12043, 13033, 14010, 14972, 15917,
- 16846, 17757, 18648, 19520, 20371, 21199, 22006, 22788,
- 23546, 24279, 24986, 25667, 26319, 26944, 27540, 28106,
- 28642, 29147, 29622, 30064, 30475, 30852, 31197, 31508,
- 31786, 32029, 32238, 32413, 32553, 32658, 32728, 32763
-};
-const Word16 sinq_32k[3 * L_FRAME32k / 20] =/*Q15 */
-{
- 268, 804, 1340, 1876, 2411, 2945, 3479, 4011, 4543, 5073, 5602, 6130,
- 6655, 7180, 7702, 8222, 8740, 9255, 9768, 10279, 10786, 11291, 11793, 12292,
- 12787, 13279, 13767, 14252, 14733, 15210, 15683, 16151, 16616, 17075, 17531, 17981,
- 18427, 18868, 19304, 19734, 20160, 20580, 20994, 21403, 21806, 22203, 22595, 22980,
- 23359, 23732, 24098, 24459, 24812, 25159, 25499, 25832, 26159, 26478, 26790, 27095,
- 27393, 27684, 27967, 28243, 28511, 28771, 29024, 29269, 29506, 29735, 29956, 30170,
- 30375, 30572, 30761, 30941, 31114, 31278, 31433, 31580, 31719, 31849, 31971, 32084,
- 32189, 32285, 32372, 32451, 32521, 32582, 32634, 32678, 32713, 32740, 32757, 32766
-};
-const Word16 sinq_48k[3 * L_FRAME48k / 20] =/*Q15 */
-{
- 179, 536, 893, 1251, 1608, 1965, 2321, 2678, 3034, 3390, 3745, 4100,
- 4454, 4808, 5161, 5514, 5866, 6217, 6568, 6918, 7267, 7615, 7962, 8308,
- 8654, 8998, 9341, 9683, 10024, 10364, 10702, 11039, 11375, 11710, 12043, 12375,
- 12705, 13033, 13361, 13686, 14010, 14332, 14653, 14972, 15289, 15604, 15918, 16229,
- 16539, 16846, 17152, 17455, 17757, 18056, 18353, 18648, 18941, 19232, 19520, 19806,
- 20090, 20371, 20650, 20926, 21200, 21471, 21740, 22006, 22269, 22530, 22789, 23044,
- 23297, 23547, 23794, 24038, 24280, 24519, 24754, 24987, 25217, 25444, 25667, 25888,
- 26106, 26320, 26531, 26740, 26945, 27147, 27345, 27541, 27733, 27921, 28107, 28289,
- 28468, 28643, 28815, 28984, 29149, 29310, 29468, 29623, 29774, 29922, 30066, 30206,
- 30343, 30476, 30606, 30732, 30854, 30973, 31087, 31199, 31306, 31410, 31510, 31606,
- 31699, 31788, 31873, 31954, 32031, 32105, 32175, 32241, 32303, 32361, 32415, 32466,
- 32513, 32556, 32595, 32630, 32661, 32688, 32712, 32731, 32747, 32759, 32766, 32767
-};
-/*------------------------------------------------------------------------------*
- * LR-MDCT tables
- *------------------------------------------------------------------------------*/
-
-/* subband width tables */
-
-/* NB short win: 7200/8000/9600, 13200/16400/24400 */
-const Word16 band_width_40_4_6_0_0_0[4] = { 6, 8, 11, 15 }; // Q0
-const Word16 band_width_40_5_6_0_0_0[5] = { 6, 7, 7, 9, 11 }; // Q0
-
-/* NB long win: 7200, 8000, 9600, 13200, 16400 */
-const Word16 band_width_160_13_6_2_0_0[13] = { 6, 6, 6, 6, 7, 8, 9, 10, 13, 15, 19, 24, 31 }; // Q0
-const Word16 band_width_160_14_6_3_0_0[14] = { 6, 6, 6, 6, 6, 7, 8, 9, 10, 12, 15, 18, 22, 29 }; // Q0
-const Word16 band_width_160_17_6_3_0_0[17] = { 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 13, 15, 17, 19 }; // Q0
-const Word16 band_width_160_18_6_4_0_0[18] = { 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 12, 14, 15, 17 }; // Q0
-
-/* WB short win: 13200/16400/24400 */
-const Word16 band_width_80_7_6_0_0_0[7] = { 6, 7, 8, 10, 12, 16, 21 }; // Q0
-
-/* WB long win: 13200, 16400 */
-const Word16 band_width_320_18_6_3_0_0[18] = { 6, 6, 6, 6, 6, 7, 7, 8, 10, 11, 13, 16, 19, 24, 30, 37, 47, 61 }; // Q0
-const Word16 band_width_320_20_6_3_0_0[20] = { 6, 6, 6, 6, 6, 6, 7, 8, 8, 9, 11, 12, 14, 17, 20, 23, 28, 34, 42, 51 }; // Q0
-
-/* SWB short win: 13200, 16400 */
-const Word16 band_width_142_8_8_0_0_0[8] = {7,8,10,11,15,21,29,41}; // Q0
-const Word16 band_width_160_8_8_0_0_0[8] = { 8, 9, 11,13,17,23,32,47}; // Q0
-
-/* SWB long win: 13200, 16400 */
-const Word16 band_width_568_22_6_2_0_0[22] = { 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, 11, 13, 16, 19, 23, 28, 34, 42, 55, 68, 84, 105}; // Q0
-const Word16 band_width_640_24_6_4_0_0[24] = { 6, 6, 6, 6, 6, 6, 7,7,8,9,10,11,13,15,18,21,26,32,39,48,59, 74,92,115}; // Q0
-
-/* LR-MDCT: NB configuration tables */
-const Xcore_Config xcore_config_8kHz_007200bps_long = { 13, L_FRAME8k, band_width_160_13_6_2_0_0, 536870912L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0 /*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_8kHz_008000bps_long = { 14, L_FRAME8k, band_width_160_14_6_3_0_0, 536870912L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0 /*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_8kHz_013200bps_long = { 17, L_FRAME8k, band_width_160_17_6_3_0_0, 429496730L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 4, 2, 24576/*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_8kHz_016400bps_long = { 18, L_FRAME8k, band_width_160_18_6_4_0_0, 322122547L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0 /*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
-
-const Xcore_Config xcore_config_8kHz_007200bps_short = { 4, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_4_6_0_0_0, 966367642L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0/*p2a_th*/,9830 /*pd_thresh*/, 2949/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_8kHz_008000bps_short = { 4, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_4_6_0_0_0, 1181116006L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 4, 0, 0/*p2a_th*/,9830 /*pd_thresh*/, 2949/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_8kHz_013200bps_short = { 5, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_5_6_0_0_0, 751619276L, 24576, 24576/*eref*/, 11469, 11469/*bit_alloc_weight*/, 2, 4, 0, 0/*p2a_th*/,22938/*pd_thresh*/, 3604/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_8kHz_016400bps_short = { 5, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_5_6_0_0_0, 536870912L, 24576, 24576/*eref*/, 11469, 11469/*bit_alloc_weight*/, 2, 6, 0, 0/*p2a_th*/,22491/*pd_thresh*/, 3604/*ld_slope*/, 19661/*ni_coef*/ };
-
-/* LR-MDCT: WB configuration tables */
-const Xcore_Config xcore_config_16kHz_013200bps_long = { 18, L_FRAME16k, band_width_320_18_6_3_0_0, 429496730L, 24576, 24576/*eref*/, 13106, 13106/*bit_alloc_weight*/, 2, 6, 3, 24576/*p2a_th*/, 13107/*pd_thresh*/, 3932/*ld_slope*/, 18022/*ni_coef*/ };
-const Xcore_Config xcore_config_16kHz_016400bps_long = { 20, L_FRAME16k, band_width_320_20_6_3_0_0, 429496730L, 24576, 24576/*eref*/, 13106, 13106/*bit_alloc_weight*/, 2, 6, 3, 24576/*p2a_th*/, 13107/*pd_thresh*/, 3932/*ld_slope*/, 19660/*ni_coef*/ };
-
-const Xcore_Config xcore_config_16kHz_013200bps_short = { 7, L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS, band_width_80_7_6_0_0_0, 966367642L, 24576, 24576/*eref*/, 9830, 9830/*bit_alloc_weight*/, 2, 4, 0, 0 /*p2a_th*/, 9830 /*pd_thresh*/, 4258/*ld_slope*/, 18022/*ni_coef*/ };
-const Xcore_Config xcore_config_16kHz_016400bps_short = { 7, L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS, band_width_80_7_6_0_0_0, 966367642L, 24576, 24576/*eref*/, 11468, 11468/*bit_alloc_weight*/, 2, 8, 0, 0 /*p2a_th*/, 9830 /*pd_thresh*/, 4258/*ld_slope*/, 19660/*ni_coef*/ };
-
-/* LR-MDCT: SWB configuration tables */
-const Xcore_Config xcore_config_32kHz_013200bps_long = { 22, 568, band_width_568_22_6_2_0_0, 322122547L, 24576, 24576/*eref*/, 6554, 6554/*bit_alloc_weight*/, 2, 4, 5, 28672/*p2a_th*/, 13107 /*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_32kHz_016400bps_long = { 24, 640, band_width_640_24_6_4_0_0, 322122547L, 24576, 24576/*eref*/, 8192, 8192/*bit_alloc_weight*/, 2, 4, 5, 28672/*p2a_th*/, 13107 /*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_32kHz_013200bps_short = { 8, 568 / NUM_TIME_SWITCHING_BLOCKS, band_width_142_8_8_0_0_0, 1610612736L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 4, 0, 0 /*p2a_th*/, 16384 /*pd_thresh*/, 3604/*ld_slope*/, 19661/*ni_coef*/ };
-const Xcore_Config xcore_config_32kHz_016400bps_short = { 8, 640 / NUM_TIME_SWITCHING_BLOCKS, band_width_160_8_8_0_0_0, 644245094L, 24576, 24576/*eref*/, 8192, 8192/*bit_alloc_weight*/, 2, 4, 0, 0 /*p2a_th*/, 9830 /*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
-
-/* bandwidths */
-const Word16 Nb[ NB_SFM] =
-{
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16,
- 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 32, 32, 32, 32, 32, 32, 32, 32
-}; // Q0
-
-/* log2(Nb) to calculate minimum bits for one pulse in PVQ */
-const Word16 LNb[ NB_SFM] =
-{
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
- 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5
-}; // Q0
-
-
-/*------------------------------------------------------------------------------*
- * GSC tables
- *------------------------------------------------------------------------------*/
-
-const Word16 gsc_sfm_start[MBANDS_GN] = {0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240}; // Q0
-
-const Word16 gsc_sfm_end[MBANDS_GN] = {16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256}; // Q0
-
-const Word16 gsc_sfm_size[MBANDS_GN] = {16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; // Q0
-
-const Word16 sm_table_fx[] =
-{
- 32767, 32126, 31480, 30838, 30196, 29557, 28918, 28279, 27643, 27007,
- 26375, 25746, 25120, 24494, 23875, 23255, 22643, 22033, 21427, 20824,
- 20228, 19638, 19048, 18468, 17891, 17321, 16758, 16197, 15647, 15103,
- 14562, 14031, 13507, 12989, 12481, 11980, 11488, 11000, 10525, 10056,
- 9598, 9146, 8706, 8274, 7851, 7438, 7035, 6642, 6259, 5885,
- 5521, 5171, 4830, 4499, 4178, 3870, 3572, 3287, 3011, 2746,
- 2494, 2254, 2025, 1809, 1602, 1412, 1229, 1062, 904, 760,
- 629, 511, 403, 308, 226, 157, 102, 56, 26, 7,
-}; // Q15
-
-const Word16 GSC_freq_bits[] =
-{
- 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_5k00*/
- 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_6k15*/
- 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_7k20*/
- 21, 74, -4, 26, 16, 12, 11, 9, 0, 0, 4, 4, 1, 1, 3, 0, 0, /* ACELP_8k00*/
- 26, 80, -3, 28, 18, 13, 12, 9, 0, 0, 4, 4, 1, 1, 3, 0, 0, /* ACELP_9k60*/
- 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_11k60*/
- 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_12k15*/
- 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_12k85*/
- 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_13k20*/
- 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_14k80*/
- 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
- 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_22k60*/
- 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4 /* ACELP_24k40*/
-}; // Q0
-const Word32 GSC_freq_bits_fx[] =/*Q18*/
-{
- 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_5k00*/
- 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_6k15*/
- 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_7k20*/
- 5505024, 19660800, -1048576, 6815744, 4194304, 3145728, 2883584, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/
- 6815744, 20971520, -786432, 7340032, 4718592, 3407872, 3145728, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/
- 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_11k60*/
- 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k15*/
- 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k85*/
- 8126464, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_14k80*/
- 8126464, 25165824, -262144, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
- 8126464, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_22k60*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
- 8126464, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_22k60*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
-};
-
-const Word32 GSC_freq_bits_fx_Q18[] =/*Q18*/
-{
- 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0,
- 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0,
- 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0,
- 5505024, 19398656, -1048576, 6815744, 4194304, 3145728, 2883584, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0,
- 6815744, 20971520, -786432, 7340032, 4718592, 3407872, 3145728, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0,
- 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
- 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
- 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
- 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
- 6815744, 25165824, -262144, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
- 6815744, 25165824, -262144, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
- 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
- 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
-};
-const Word16 Compl_GSC_freq_bits[] =
-{
- 5, 10, 10, 10 /* bitrate > ACELP_16k40 && FS = 16kHz */
-}; // Q0
-
-const Word16 mfreq_bindiv_loc[] = { 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 32, 32, 32 }; // Q0
-
-const Word16 mean_gp_fx[] = { 9590 }; /*Q14*/
-
-const Word16 dic_gp_fx[] = /*Q14*/
-{
- -9580, -7692, -6385, -4474, -3254, -2038, -806, -82,
- 1034, 2259, 3457, 4684, 5290, 6544, 8548, 10052,
- -8964, -8338, -7021, -5754, -5118, -3850, -2654, -1429,
- 408, 1660, 2852, 4071, 5915, 7170, 7825, 9249
-};
-const Word16 Gain_meanNB_fx[] =
-{
- 9852,
-};/* Q12 */
-
-const Word16 Gain_mean_dicNB_fx[1 * 64] = /*Q12 */
-{
- -1309, -931, -568, -396, -54, 807, 1174, 1533,
- 1901, 2092, 2286, 2493, 2698, 3130, 2909, 286,
- -748, 990, 631, -1119, -1697, -2114, -2788, -5399,
- -9841, -1902, -3270, -7975, -7438, -6926, -7192, -2325,
- -1504, -2549, -3022, -3532, -3818, -4136, -4751, -5071,
- -5756, -6093, -8998, -6389, -8765, -9438, 3369, 3917,
- 3619, 4684, -8264, 4255, -4433, -6662, -9230, -7678,
- 5859, 118, 457, -227, 1717, 1353, -8499, -9649
-};
-
-const Word16 Mean_dic_NB_fx[1 * 10] = /*Q12 */
-{
- -444, -100, -120, -37, 25,
- 70, 148, 63, 170, 229
-};
-
-const Word16 Gain_dic1_NB_fx[3 * 64] = /*Q12 */
-{
- -606, -92, 5,
- -1965, 294, 666,
- -440, 119, 661,
- -106, 267, 108,
- -1213, 345, -136,
- -1251, 618, 566,
- -1905, -750, 648,
- -1043, -360, -498,
- -18, -322, 96,
- 334, 116, -247,
- -1929, 660, 23,
- -1845, 1178, 485,
- -180, 836, 167,
- -1892, -922, -321,
- 416, -437, -344,
- 595, -548, 158,
- -265, -807, -338,
- -1065, -1015, -20,
- -626, 595, -333,
- -569, 1090, 651,
- 27, 587, -331,
- -184, -85, -503,
- -1902, -1807, 326,
- -1861, -159, -989,
- -666, 143, -1163,
- -1718, 1031, -744,
- 847, 301, -59,
- 720, -1001, -216,
- 1380, -866, -969,
- 803, -4, -608,
- 233, 408, -998,
- 1459, 87, 263,
- 345, -615, -1026,
- 877, -148, -7,
- 68, -1075, 270,
- 802, 329, 475,
- -1923, -126, -38,
- 1275, -419, -349,
- 401, 926, 575,
- 846, -233, 547,
- 693, -1880, 356,
- -362, -1683, -219,
- 231, -339, 598,
- 1227, -616, 267,
- 1116, 91, -1316,
- -551, -650, 530,
- 444, 32, 181,
- -384, 1207, -775,
- -993, 1163, 41,
- 784, -1018, 538,
- 635, 636, -424,
- 1373, -1367, 149,
- 1442, 401, -444,
- 1094, 888, 123,
- 874, 1113, -1082,
- -646, -1112, -1103,
- 539, -1632, -683,
- 402, 571, 99,
- -1778, -1809, -849,
- -732, -1691, 700,
- -678, 526, 274,
- 320, 1227, -118,
- -1222, -180, 454,
- 173, 349, 530
-};
-
-const Word16 Gain_dic2_NB_fx[3 * 32] = /*Q12 */
-{
- 28, 0, -66,
- -557, 4, 206,
- 281, -642, 36,
- -417, 81, -494,
- -380, 684, 450,
- 521, -1544, 258,
- -1119, 613, -1151,
- 514, 24, 797,
- 292, -84, -526,
- 296, 418, -231,
- -419, -68, 976,
- 2, -308, 398,
- -456, -1007, 263,
- -1221, -371, 446,
- -221, -390, -181,
- -1210, 588, 751,
- -1093, 528, -174,
- 590, 372, -1271,
- -79, -251, -1241,
- -1016, -487, -512,
- 542, 581, 338,
- -265, 456, -105,
- 490, -71, 89,
- 42, 235, 379,
- 31, 1194, -202,
- 173, -839, 850,
- -46, 500, -802,
- 152, 933, 1073,
- 980, 345, -263,
- 807, -580, -521,
- -23, -992, -585,
- 876, -576, 411
-};
-
-const Word16 Gain_dic3_NB_fx[4 * 16] = /*Q12 */
-{
- -16, 65, -227, 11,
- -214, 553, 366, 185,
- 137, -338, -300, -625,
- -122, 82, 538, -797,
- 160, 285, -1103, 35,
- -594, 312, -379, -423,
- 169, -642, -395, 363,
- 351, -1166, 630, -261,
- -1190, 217, 416, 187,
- -577, 244, -636, 858,
- 580, 482, -220, 635,
- 475, -188, 372, 27,
- -65, -369, 504, 910,
- -423, -442, 124, -40,
- 480, 575, -41, -651,
- 682, 680, 910, 489
-};
-
-const Word16 Gain_dic2_NBHR_fx[3 * 64] = /*Q12 */
-{
- 29, 0, -94,
- -605, -202, -174,
- 324, -380, -163,
- -126, -301, -306,
- -288, 124, 112,
- -86, 524, -115,
- 234, 18, -464,
- -55, -281, 179,
- 161, 446, 632,
- 366, -82, 97,
- 228, -1149, 270,
- 293, 286, -143,
- -123, -35, -896,
- -540, -675, 175,
- 331, -483, -687,
- -779, 204, -668,
- -492, 768, -510,
- -1215, -620, -483,
- 681, -76, -296,
- -671, 396, -45,
- -759, 298, 564,
- -284, 589, 321,
- -1366, -592, 496,
- -448, -585, -712,
- 12, -756, -90,
- 513, 167, -927,
- -1172, 1060, -1198,
- -477, 748, 1006,
- 42, 103, 1277,
- -940, 1049, 138,
- -924, -14, -1469,
- 684, 679, -1580,
- 417, -374, -1572,
- 607, 270, 256,
- 567, 778, 843,
- 1414, -223, -542,
- 97, 200, 251,
- 222, 1074, -547,
- -714, -285, 1046,
- 386, -684, 984,
- 338, 674, 116,
- -274, 171, -368,
- 581, -1871, 342,
- 94, 442, -597,
- -293, -1205, 851,
- -127, 501, -1247,
- 175, 1700, 1357,
- -24, 1224, 285,
- 707, -952, -293,
- 668, 492, -407,
- 1164, 751, 201,
- 381, -595, 288,
- -1570, 481, -531,
- -597, -160, 326,
- -578, -1311, -40,
- -118, -523, 576,
- -1513, 527, 757,
- -184, 40, 609,
- -1215, 98, 68,
- -65, -1324, -836,
- 821, -299, 204,
- 796, 21, 840,
- 310, -133, 542,
- 1042, -974, 537
-};
-
-const Word16 Gain_dic3_NBHR_fx[4 * 128] = /*Q12 */
-{
- 293, 7, -202, -95,
- 535, 110, 542, -512,
- -578, 65, -560, -345,
- 206, 332, 10, -533,
- -76, 356, -14, 83,
- 149, -372, -195, -490,
- -478, -241, -55, 113,
- -293, -470, -606, 62,
- 797, -1448, 625, -1128,
- 173, 464, -1686, -49,
- -392, -295, -159, -464,
- -715, 420, -146, -984,
- -36, 28, -484, 119,
- 472, 272, -729, -116,
- 68, -87, -628, -429,
- 429, -918, -158, -191,
- -545, 230, -435, 261,
- -128, 15, -791, 612,
- 268, -387, -1258, 102,
- 378, 238, 301, 3,
- -494, 149, 131, -124,
- 634, -308, 99, 24,
- 572, 711, 754, -1137,
- -1109, 400, 1093, 369,
- -831, -423, 1583, 1089,
- -83, 156, -105, 1078,
- -930, 476, 152, 380,
- 776, 1162, 788, -43,
- 279, 50, 408, 597,
- 476, 483, 73, 749,
- 903, 686, 80, -411,
- 195, -768, 280, 344,
- -263, -999, -46, -284,
- -66, 263, 315, -1239,
- 435, 578, -234, -1169,
- 199, -1669, 188, 114,
- -57, 419, -509, -633,
- 98, -119, 129, -816,
- -157, -365, -249, 537,
- 67, -624, 121, 1153,
- 1444, 142, -584, 38,
- 1086, -84, 162, 994,
- 392, -384, -124, 533,
- 252, 183, -1161, -885,
- -431, -829, 102, 432,
- -708, 987, -1021, -644,
- -64, 120, -1684, 985,
- 210, -494, -906, 1302,
- 50, -186, 177, 185,
- -256, 872, -1004, 387,
- 564, -80, -679, 515,
- -763, -40, -1174, 228,
- -1029, 199, -59, -297,
- 30, -47, 198, -264,
- -396, -1435, 913, -1018,
- -141, 962, 36, 458,
- 36, -388, 776, -1000,
- -74, 489, 1137, 140,
- -970, -766, 666, -117,
- 90, 599, 1665, 1405,
- -313, -685, -764, -615,
- 563, -462, -627, -768,
- 792, 560, -1445, 556,
- -581, 721, -559, 1137,
- -699, -273, 274, -846,
- 940, -690, 747, -253,
- -177, -541, 1355, -217,
- -586, 427, 1196, -868,
- 147, 532, -550, 405,
- 258, 677, -245, -166,
- 772, 1062, -331, 482,
- 388, 1870, -576, 1585,
- 462, 865, 454, 1212,
- 570, 528, -681, 1229,
- -386, 607, 599, 865,
- -154, -20, -211, -231,
- 96, 736, 408, -259,
- 763, -1533, 1094, 249,
- 705, -1132, 1757, -1082,
- 310, -481, 329, -395,
- 194, -781, 59, -954,
- -933, -957, -25, 1866,
- -852, -224, -482, 822,
- -1438, 490, 221, 1281,
- 392, 677, 539, 347,
- 884, -614, 1844, 678,
- -773, 484, -928, 2477,
- -274, -461, 378, -263,
- -283, -312, 583, 342,
- 453, -1541, 378, 1266,
- 778, 1095, 1290, 824,
- -958, -443, -208, -71,
- 985, -1001, -123, 473,
- 56, -1003, -513, 474,
- -259, 1435, 975, 315,
- -59, -169, 724, 961,
- -210, 1030, 341, -977,
- 1054, 2917, -7, -877,
- -852, -228, 330, 625,
- 9, -524, -97, -14,
- 16, -50, 476, 2406,
- 264, -238, 768, 56,
- 187, 108, -169, 446,
- 673, 238, 992, 671,
- -218, 285, 485, 181,
- 669, -526, 639, 571,
- 650, 20, -188, -516,
- 1031, 165, 526, 136,
- -333, 307, 102, -569,
- -157, 309, -934, -121,
- -336, 141, 39, 536,
- 662, 364, -133, 222,
- -1284, 637, -636, 77,
- 1241, 846, 467, 638,
- 842, 328, 1330, -320,
- 152, -1009, 550, -215,
- -772, 13, 594, -122,
- 336, -410, -547, -2,
- 869, -106, 321, -1180,
- 516, 1247, -828, -577,
- -670, 873, 367, -132,
- -415, 630, -287, -164,
- -105, 138, 657, -441,
- -160, -1085, 940, 704,
- -128, -68, -369, -1052,
- -1434, 594, 546, -665,
- -1849, 75, 175, 174,
- -1283, 729, -1590, 1032
-};
-
-const Word16 YG_mean16_fx[1 * 16] = /*Q12 */
-{
- -396, -192, -168, -136, -60, -17, 45, 39,
- 120, 81, 90, 67, 147, 34, 163, 184
-};
-
-const Word16 YG_dicMR_1_fx[4 * 64] = /*Q12 */
-{
- -1879, 826, 539, -210,
- -120, 267, -137, -142,
- -798, -473, 434, 243,
- 297, -896, 369, 307,
- -1883, -1333, 416, 510,
- -1955, -660, -471, 224,
- -905, -804, -517, 433,
- -961, 20, -258, -224,
- 209, 977, -213, -17,
- 536, -244, 159, 97,
- -265, 775, 412, -327,
- 337, -391, -237, -472,
- -1962, -1836, -692, 471,
- 625, 173, -463, -15,
- -965, 263, 62, 600,
- -782, 889, -433, 211,
- -1791, 852, -453, -776,
- -182, -177, -1078, 80,
- -364, 350, 280, 293,
- -902, 1119, 295, -1194,
- 16, 440, -342, 459,
- -1825, -1584, -1382, -798,
- 723, 57, -1235, -661,
- 888, -1638, 277, 234,
- 340, 345, 141, -610,
- 1280, -23, 17, 144,
- -639, -852, -520, -553,
- 1032, 843, 149, 435,
- 581, 783, 519, -196,
- 457, 945, 498, -1289,
- -1897, -41, 425, 514,
- 787, 161, 506, 385,
- -559, 1079, 319, 515,
- 500, 340, 60, 106,
- 251, -997, -1163, -960,
- 261, -1288, -631, 335,
- 1241, -620, -387, -662,
- 167, 194, 476, 67,
- 830, -261, 430, -1201,
- -479, -123, 71, -1162,
- 225, -1482, 132, -802,
- 680, 763, -1010, 429,
- 200, -125, 261, 590,
- 771, -740, -183, 229,
- -1860, -348, 278, -549,
- -1768, 967, 281, 594,
- -1727, -1697, 87, -764,
- 1169, 631, -114, -471,
- -1636, -101, -1324, -91,
- 821, -745, 458, -264,
- 1014, -576, 390, 470,
- 1041, -517, -1018, 367,
- 826, 17, 426, -326,
- -467, -1641, 201, 325,
- -1906, 428, -338, 222,
- -1021, 630, 419, -75,
- -86, -379, -203, 234,
- 659, 527, -491, -1507,
- -564, -1745, -979, -173,
- -1764, -433, -743, -1090,
- 242, 709, 269, 497,
- 716, 74, -208, 618,
- -297, 645, -864, -805,
- -46, -326, 412, -296
-};
-const Word16 YG_dicMR_2_fx[4 * 32] = /*Q12 */
-{
- 93, 217, -122, 37,
- -13, -83, 105, -491,
- -398, -592, 399, -160,
- 543, -81, -470, 408,
- 394, -630, -94, -258,
- -665, 133, -136, -125,
- 397, -351, 630, -148,
- -1166, 406, -865, 554,
- -136, -302, -263, 81,
- -674, -657, -571, -691,
- -206, 381, -699, 122,
- 272, -1506, 356, 15,
- 451, -961, 638, -1133,
- 316, -787, 165, 585,
- 312, -144, 185, 274,
- 39, -706, -997, 250,
- -915, -871, -114, 458,
- -834, 348, 364, -1188,
- 450, 723, -256, 412,
- 369, 468, -1371, 416,
- 344, 164, 290, -1094,
- 664, 122, 34, -218,
- 555, 254, 559, 825,
- 312, 492, 496, -27,
- -399, 315, 690, -330,
- -458, 710, 206, 415,
- 290, 89, -662, -467,
- -72, 593, -108, -460,
- -217, 46, 319, 189,
- -1366, 199, 365, 62,
- -552, -166, 772, 861,
- -159, 120, -215, 775
-};
-const Word16 YG_dicMR_3_fx[4 * 32] = /*Q12 */
-{
- -103, -143, -85, -19,
- -404, 182, -795, 84,
- 398, -594, -55, -256,
- 283, 128, -472, 279,
- -246, -628, 281, 297,
- -853, 468, 358, -915,
- 272, 149, 209, -443,
- -168, -504, 452, -525,
- 624, -427, 779, 117,
- 1079, 404, -98, 80,
- 136, 165, 142, -1394,
- 513, -566, -150, 822,
- 124, 646, 199, 272,
- -165, -702, -615, 165,
- 333, 810, -457, 1038,
- -360, 105, -110, 537,
- -224, 125, 562, -26,
- 699, -1105, 809, -1323,
- -1229, 841, -767, 571,
- -310, 437, -114, -230,
- -1045, 630, 564, 322,
- 282, 1170, -723, -306,
- -328, -247, -251, -598,
- 354, 332, -1593, 499,
- 332, -23, 219, 304,
- 325, -1511, 378, 299,
- -94, -54, 679, 956,
- 507, 830, 861, -739,
- -895, -135, 16, -34,
- 677, 650, 961, 714,
- 816, -665, -1741, -671,
- 274, 93, -617, -433
-};
-const Word16 YG_dicMR_4_fx[4 * 16] = /*Q12 */
-{
- -163, -44, -108, 32,
- 556, 153, 115, 120,
- 617, 818, 802, 719,
- -639, -665, 122, 664,
- 353, -555, -352, -86,
- -1162, 833, -1034, 326,
- -511, -406, -478, -523,
- 491, -1473, 404, -21,
- 148, 288, -45, -544,
- -61, 172, -791, -44,
- 715, -449, 861, 504,
- -108, 263, 610, 118,
- 962, 826, -1013, -37,
- -32, -495, 362, -214,
- -37, 661, -75, 289,
- -835, 243, 85, -105
-};
-
-
-const Word16 mean_m_fx[1 * 1] = /*Q12 */
-{
- 11762
-};
-
-const Word16 mean_gain_dic_fx[1 * 64] =
-{
- -739, -519, -76, 147, 574, 779, 983, 1185,
- 1384, 1580, 1784, 1989, 2204, 2643, 2864, 2422,
- 362, -295, -1197, -1936, -2757, -11755, -8216, 3083,
- 3311, -1434, -1682, -3341, -9284, -9057, -8616, -7783,
- -7359, -6964, -6592, -6233, -5470, -5050, -4651, -3954,
- -2470, -963, -2199, -3042, -3643, -4292, -5854, -10199,
- 4103, 3548, 4390, 4717, 3817, -10525, -11521, -9570,
- -9899, -9171, -10841, -11165, 5500, 5079, 6139, 6993
-}; /* Q12 */
-
-const Word16 YGain_mean_LR_fx[1 * 12] =/* Q12 */
-{
- -385, -178, -143, -116, -46, -12,
- 64, 50, 118, 68, 133, 151
-};
-
-const Word16 YGain_dic1_LR_fx[3 * 32] = /*Q12 */
-{
- -1909, 159, -90,
- -155, 416, -15,
- -99, -84, 396,
- -1832, -848, -320,
- -779, 1024, 45,
- -1860, -1761, 273,
- 81, -341, -309,
- -819, -3, -315,
- 483, 215, -194,
- 242, 937, -76,
- -1830, -1753, -1102,
- -1589, 868, -657,
- -911, 389, 421,
- -1834, 915, 390,
- -144, 564, -869,
- 878, -1544, 301,
- 446, 332, 376,
- -540, -822, -1001,
- 548, -192, 232,
- 920, -589, -175,
- 869, 717, -564,
- 797, -103, -1047,
- -335, -1732, -186,
- -1840, -345, 566,
- 1205, 109, 43,
- 985, -456, 570,
- 650, -1223, -874,
- 928, 752, 390,
- -124, 833, 575,
- -1811, -249, -1142,
- -711, -767, 185,
- 344, -876, 267,
-};
-
-const Word16 YGain_dic2_LR_fx[4 * 32] = /*Q12 */
-{
- -294, -73, -41, 11,
- 276, 330, -1316, 173,
- 26, -712, 86, 1,
- -841, -539, 246, -479,
- 43, -207, 709, 116,
- 104, -197, 227, -548,
- 261, -228, 165, 606,
- 613, 403, -122, -420,
- 14, 182, -544, -669,
- -734, 392, -492, -131,
- -1316, 274, 116, 331,
- -1339, 535, -1261, 608,
- -346, 277, -426, 729,
- -1067, -836, -571, 388,
- 643, 503, 484, 532,
- -148, 447, 120, -392,
- -600, 263, 519, -75,
- 686, -346, 379, 23,
- 130, 239, 376, -1366,
- 68, 656, -361, 92,
- 608, 286, -405, 487,
- -1031, 507, 523, -971,
- 51, -44, -521, 172,
- -573, -500, 398, 632,
- 240, 147, 104, 51,
- -319, -680, -890, -398,
- -195, 503, 306, 459,
- 335, 368, 662, -389,
- 378, -788, -537, 680,
- 433, -1129, 472, -883,
- 472, -312, -301, -207,
- 378, -1346, 433, 408,
-};
-
-const Word16 YGain_dic3_LR_fx[5 * 32] = /*Q12 */
-{
- -332, -191, -122, -455, -210,
- 364, -48, -664, 408, 225,
- -576, -342, 367, 52, 270,
- -392, -157, -77, 625, -224,
- -183, -652, -406, 99, 266,
- 24, 65, 74, 525, 613,
- -805, 306, -383, -21, 247,
- 16, 133, -416, -4, -567,
- 294, -750, 443, -367, 228,
- 536, 816, 767, 562, 594,
- -54, 200, -1108, -582, 227,
- 123, -43, 414, -376, -649,
- 592, -652, -674, -386, -356,
- 100, -58, -45, -108, 103,
- -727, -194, -1170, 931, 1096,
- 512, 758, -440, -769, -1051,
- 362, 787, -276, -139, 149,
- -218, 387, 457, -414, 265,
- -202, 663, -1104, 882, -338,
- -57, 405, 269, 257, -221,
- 335, 864, 1164, -611, -618,
- 1275, 494, -1783, 119, 1222,
- 752, 76, 270, 73, -57,
- 376, -1255, 145, 724, 603,
- -989, 618, 659, 675, 560,
- 128, -147, -138, -368, 963,
- 140, -170, 866, 538, 127,
- 122, -616, 166, 236, -396,
- 374, 279, 407, 650, -1269,
- -861, 613, -755, -1334, -972,
- -922, 314, 416, -114, -648,
- 265, 85, 61, -1110, 45
-};
-
-const Word16 YG_mean16HR_fx[] =
-{
- //Q12
- -396, -191, -167, -135,
- -60, -17, 45, 39,
- 120, 81, 89, 67,
- 146, 33, 163, 183,
-};
-
-const Word16 YG_dicHR_1_fx[] =
-{
- //Q12
- -1955, 412, 133, 32,
- -340, 88, -42, 20,
- -999, 314, -144, 456,
- -429, -190, 186, 547,
- -1057, 160, 243, -197,
- -46, -81, -491, -223,
- 143, 986, -113, 15,
- 286, -313, 77, 3,
- 249, -1251, 380, 305,
- -1909, -258, 481, 86,
- 902, 59, 42, -186,
- -1969, -992, -335, 223,
- -1913, -163, -465, -167,
- -806, 1201, 24, 481,
- -564, -1943, 212, 380,
- -120, -691, -162, 138,
- -966, 1009, 437, -464,
- 434, 147, 185, 158,
- -1944, -133, -313, 602,
- -1029, 236, -612, -373,
- -749, -571, -1008, -399,
- 666, -954, -111, 88,
- 186, -16, -174, 338,
- -235, -314, 403, -244,
- 285, 133, 85, -349,
- -1981, -1506, -1290, 338,
- -1977, -1925, -368, 876,
- -1930, 256, 453, 667,
- -1884, 259, -123, -779,
- -813, 1087, -595, -1014,
- 396, 66, -876, 412,
- -543, 907, -657, 301,
- -485, 612, 515, 777,
- -362, 420, 417, -518,
- -1754, 1307, 65, -1202,
- -618, 705, -56, -56,
- -1938, 1005, 561, 59,
- 62, 521, -440, 319,
- -1776, 1011, -279, -165,
- 558, 357, -444, -47,
- 801, -1998, 313, 319,
- -1873, -826, -1691, -978,
- -588, -294, -328, -1021,
- -91, 513, -288, -530,
- -1945, -1964, -350, -293,
- -307, -1057, 203, -631,
- 94, -1713, -548, -62,
- 616, -11, -510, -780,
- 682, -1574, 260, -441,
- 507, -778, 522, -88,
- 1321, -635, -432, -619,
- 369, -615, -335, -1646,
- 1026, -572, 265, -256,
- 779, 127, -155, 356,
- -462, -180, -637, 405,
- 1329, 1071, 543, 784,
- 434, -468, 120, -581,
- 1293, -532, 60, 377,
- 63, -1290, -336, 708,
- 756, 42, 412, 607,
- 731, 1003, 598, -1388,
- -1818, -1666, 547, 185,
- -1915, -802, 485, 789,
- 907, 437, 455, 108,
- 507, -102, 573, -109,
- 1037, -1292, -691, 512,
- 1428, 159, 20, 271,
- 111, -826, -607, -563,
- -622, -1328, -1391, -1000,
- -15, 1094, 339, -684,
- 448, 790, -439, -1617,
- -1765, -943, -657, -675,
- 107, -835, -1140, 241,
- 33, 122, 520, 242,
- 194, 204, 313, -1080,
- 1308, 548, -711, -850,
- 1520, 474, 334, -516,
- 1091, -42, 347, -1543,
- 1098, -219, 680, 139,
- 855, -895, 613, -985,
- -1631, -1550, 539, -1277,
- 672, 905, -1057, 430,
- 555, 659, -38, 450,
- -1118, -53, 536, 487,
- 563, -485, -204, 650,
- -678, -930, 470, 425,
- 1180, -259, -990, 319,
- 993, 319, -362, 926,
- 782, -254, -1447, -534,
- -1946, 964, 86, 617,
- -1651, 727, -813, 514,
- -552, 395, 522, 124,
- -1710, 579, 831, -542,
- 34, 463, 143, 2,
- -1742, -207, -642, -1517,
- -1967, -740, 272, -606,
- 663, 670, 58, -620,
- 229, 274, 122, 677,
- 65, 1144, 24, 693,
- -1383, 1061, 630, 894,
- 536, 539, 106, -31,
- 1080, 774, -267, 67,
- 355, 518, 609, -336,
- 777, -735, 412, 551,
- 219, -424, 392, 451,
- -543, -1909, -189, -933,
- -938, -178, 489, -1008,
- -749, -1216, -440, -157,
- 681, -355, -423, -19,
- 299, 1053, -913, -506,
- -258, 360, -1457, -38,
- -264, 967, 519, 58,
- -718, -1676, -1184, 185,
- 741, -314, 184, 210,
- -1780, -305, -1299, 167,
- -1912, -1932, -1292, -970,
- -1017, -520, -96, -136,
- -1829, 500, -1244, -625,
- -1041, -791, -461, 591,
- 708, -1386, -1078, -956,
- 339, 636, 509, 408,
- -131, 106, -1202, -1118,
- 818, 18, 477, -676,
- 668, 1176, 422, -36,
- 1074, -1259, 425, 267,
- -281, 539, 31, 430,
- -1196, 756, 338, 236,
- -568, 1030, 421, -1589,
-};
-
-const Word16 YG_dicHR_2_fx[] =
-{
- //Q12
- 146, -73, -67, -101,
- -11, 330, -176, -609,
- -283, -31, -381, -191,
- -208, -81, 142, 234,
- 141, -376, -66, -646,
- 568, -38, -429, 160,
- 166, 831, 89, -103,
- 280, -881, -296, -82,
- -117, -4, 340, -956,
- 286, -136, -679, -410,
- 141, 181, -197, 511,
- -685, 648, 246, -365,
- 625, -670, 591, 190,
- -7, -296, -454, 235,
- 840, 126, 652, 1064,
- -428, -570, -18, -77,
- -298, -973, 637, 380,
- -774, -31, -333, -902,
- -1509, 167, 471, -369,
- 431, -1437, 124, 610,
- -917, 511, 518, -1488,
- -97, 262, -872, 247,
- 549, -166, 602, -590,
- 644, -1030, 796, -1279,
- 525, -37, 212, 197,
- 141, 345, 195, 211,
- 91, -71, 674, 223,
- -1343, -902, -27, 234,
- -467, -981, -427, 725,
- 176, -527, 85, 275,
- -654, -859, 473, -873,
- 671, -457, -326, 742,
- 699, 613, -78, 457,
- -487, 505, 231, 578,
- -194, 927, -493, 529,
- 635, 554, -917, 532,
- -554, -12, -314, 611,
- 172, 667, 532, -874,
- 594, 270, -27, -378,
- 388, -530, -1307, 274,
- 647, 451, 670, 24,
- 745, -470, 8, -260,
- -725, -292, -1018, -32,
- 95, 184, 330, -280,
- -761, -135, 552, 250,
- -415, -3, 197, -307,
- 142, 702, 584, 755,
- 450, 595, -1010, -525,
- -455, -1143, -775, -639,
- 228, 496, -1676, 399,
- 82, 242, -532, 1222,
- 125, -214, 319, 804,
- -292, 380, -126, 70,
- 96, -480, 407, -259,
- -636, -148, 890, 1241,
- 213, 404, -382, -7,
- -315, 509, 660, 61,
- 505, 18, 33, -1385,
- -568, 716, -623, -338,
- -440, 38, 972, -455,
- -1420, 576, -1125, 668,
- -1391, 481, 229, 593,
- 335, -1464, 430, -375,
- -918, 124, -155, 34,
-};
-
-const Word16 YG_dicHR_3_fx[] =
-{
- //Q12
- -174, -82, -158, -12,
- 155, -403, 114, -132,
- 188, 2, -231, -470,
- 448, -222, -598, -103,
- -353, 304, -1173, 420,
- -43, -77, -533, 386,
- 526, -57, 360, -247,
- -837, -219, -344, 42,
- -236, 88, -664, -226,
- -1218, 66, 362, -529,
- -398, 496, -300, 299,
- 212, 508, -521, 80,
- -267, -522, 45, 286,
- -65, -1143, 154, -169,
- 725, -1483, 883, -1459,
- 9, -109, 334, -752,
- -38, 860, -22, -333,
- -487, 340, 202, -1529,
- -349, 387, 645, -464,
- -106, 73, 170, 427,
- 180, 384, -292, 989,
- 178, -505, 618, 375,
- 481, 539, -1777, 1050,
- 680, -792, 65, 136,
- -1388, 798, -1090, 670,
- -377, -507, -139, -580,
- 301, 614, 194, 392,
- -218, -1155, 341, 834,
- 338, -1071, -1177, 673,
- -406, 188, -92, -546,
- -58, -656, 773, -540,
- 461, 649, 840, -108,
- -775, -352, 620, 233,
- -390, 666, 601, 438,
- -394, 1594, -299, 1009,
- 367, 448, 291, -886,
- 788, 76, 479, 531,
- -77, -655, -500, -14,
- 514, -1745, 497, 217,
- 904, -963, 630, 1261,
- 775, 224, -795, 520,
- 291, -435, -112, 679,
- 494, 1380, -1018, -186,
- -75, 86, 731, 1048,
- 65, 74, 617, 99,
- 512, -46, 709, -1636,
- -926, 1237, 1090, -812,
- 40, 297, 97, -131,
- 656, 770, 1176, 920,
- 1313, -582, -1832, -912,
- 490, -648, -43, -805,
- -449, -882, -1473, -698,
- 1028, 421, -151, -289,
- 1089, 1107, -144, 760,
- 188, 357, -638, -1027,
- -337, -210, 300, -194,
- 319, 223, -1587, -64,
- 972, 1384, 786, -1026,
- 928, -468, 1116, -198,
- -1489, 642, 269, 385,
- -627, 250, 153, 50,
- -906, 613, -518, -436,
- 379, 18, -68, 218,
- -648, -85, -110, 765,
-};
-
-const Word16 YG_mean16HR_16kHz_fx[] =
-{
- //Q12
- 342, 152, 373, 359
-};
-
-const Word16 YG_dicHR_4_16kHz_fx[] =
-{
- //Q12
- 137, 109, 215, 21,
- 328, -26, 537, -270,
- -137, -851, -385, -703,
- -537, -81, -244, -23,
- -174, -425, -175, -351,
- 861, 1100, 696, 574,
- -150, -14, -390, -241,
- -828, 166, 164, -151,
- -226, 541, 204, -110,
- 184, 820, -89, 264,
- -26, 889, 709, 520,
- 83, -176, -713, -276,
- -149, -1318, 731, -193,
- -324, -55, 118, 182,
- 474, -493, -411, 52,
- 156, -1459, -370, -71,
- 513, 451, 973, 283,
- 903, -296, 309, 121,
- 1261, 296, 886, 702,
- 984, -1204, 915, 15,
- -401, 456, -316, 136,
- 458, -1779, 335, -788,
- 471, -796, 239, -331,
- -390, -2265, 493, -305,
- 469, -1946, 389, 280,
- 150, 463, -725, 114,
- -411, 99, -906, -128,
- 628, 888, 1299, 1039,
- 1454, 1377, 1415, 1350,
- -1, 242, -164, -11,
- 632, 621, 416, 695,
- 396, -1030, 356, 492,
- 48, -279, -98, -30,
- -568, -212, -376, -571,
- 275, 570, 382, 152,
- 443, 75, 521, 418,
- -1366, -1566, -2460, -2925,
- -1059, 64, -585, -231,
- 134, 489, -296, -380,
- -1453, -890, -1200, -1157,
- -27, 240, -1694, 47,
- 464, 86, -204, -79,
- 746, 462, 234, 57,
- 1087, -738, 1095, 1050,
- 922, 619, -412, 409,
- -261, 35, 124, -313,
- -794, 842, -992, 314,
- 280, -465, 1028, 196,
- 233, -346, 257, 183,
- -1640, 244, -110, 28,
- 377, 171, -57, 392,
- -89, 368, 195, 456,
- 501, 1327, 119, 980,
- -64, -84, -417, 262,
- -414, -558, -638, -102,
- -1785, 392, -1756, -430,
- -705, -299, -1189, -730,
- -477, 347, -400, -367,
- -93, -825, -20, -13,
- -710, -540, 45, -265,
- -151, -487, 380, -243,
- -269, 32, 702, 143,
- 206, -145, -27, -474,
- -694, 777, 287, 357,
-};
-
-const Word16 YG_meanL2G_16kHz_fx[] =
-{
- //Q12
- 424, 651,
-};
-
-const Word16 YG_dicL2G_16kHz_fx[] =//Q12
-{
- -255, 122,
- 296, 314,
- -226, -333,
- 668, 668,
- 101, -53,
- -579, -647,
- -1202, -1244,
- 1213, 1254,
-};
-
-const Word16 Odx_fft64[64] =
-{
- 0,59,54,49,44,39,34,29,24,19,14,9,4,63,58,53,48,43,38,33,28,23,18,13,8,3,62,57,52,47,42,37,
- 32,27,22,17,12,7,2,61,56,51,46,41,36,31,26,21,16,11,6,1,60,55,50,45,40,35,30,25,20,15,10,5
-}; // Q0
-
-const Word16 Ip_fft64[6] = { 32,1,0,64,32,96 }; // Q0
-
-const Word16 Odx_fft32_15[32] = { 0,17,2,19,4,21,6,23,8,25,10,27,12,29,14,31,16,1,18,3,20,5,22,7,24,9,26,11,28,13,30,15 }; // Q0
-
-const Word32 w_fft32_16fx[16] =//Q30
-{
- 1073741824, 0, 759250113, 759250113, 992008059, 410903236, 410903236, 992008059,
- 1053110143, 209476636, 596539003, 892783685, 892783685, 596539003, 209476636, 1053110143
-};
-const Word16 Ip_fft32[6] = { 16,1,0,32,16,48 }; // Q0
-
-const Word16 Odx_fft32_5[32] = { 0,27,22,17,12,7,2,29,24,19,14,9,4,31,26,21,16,11,6,1,28,23,18,13,8,3,30,25,20,15,10,5 }; // Q0
-
-const Word16 Odx_fft16[16] = {0,11,6,1,12,7,2,13,8,3,14,9,4,15,10,5}; // Q0
-
-const Word16 Ip_fft16[6] = {8,1,0,16,8,24}; // Q0
-
-const Word16 Ip_fft8[6] = {4,1,0,8,4,12}; // Q0
-
-const Word16 Idx_dortft80[80] =
-{
- 0,65,50,35,20,5,70,55,40,25,10,75,60,45,30,15,16,1,66,51,36,21,6,71,56,41,26,11,76,61,
- 46,31,32,17,2,67,52,37,22,7,72,57,42,27,12,77,62,47,48,33,18,3,68,53,38,23,8,73,58,43,
- 28,13,78,63,64,49,34,19,4,69,54,39,24,9,74,59,44,29,14,79
-}; // Q0
-
-const Word16 Idx_dortft120[120] =
-{
- 0,105,90,75,60,45,30,15,16,1,106,91,76,61,46,31,32,17,2,107,92,77,62,47,
- 48,33,18,3,108,93,78,63,64,49,34,19,4,109,94,79,80,65,50,35,20,5,110,95,
- 96,81,66,51,36,21,6,111,112,97,82,67,52,37,22,7,8,113,98,83,68,53,38,23,
- 24,9,114,99,84,69,54,39,40,25,10,115,100,85,70,55,56,41,26,11,116,101,86,
- 71,72,57,42,27,12,117,102,87,88,73,58,43,28,13,118,103,104,89,74,59,44,29,14,119
-}; // Q0
-
-const Word16 Idx_dortft160[160] =
-{
- 0,65,130,35,100,5,70,135,40,105,10,75,140,45,110,15,80,145,
- 50,115,20,85,150,55,120,25,90,155,60,125,30,95,96,1,66,131,
- 36,101,6,71,136,41,106,11,76,141,46,111,16,81,146,51,116,21,
- 86,151,56,121,26,91,156,61,126,31,32,97,2,67,132,37,102,7,
- 72,137,42,107,12,77,142,47,112,17,82,147,52,117,22,87,152,57,
- 122,27,92,157,62,127,128,33,98,3,68,133,38,103,8,73,138,43,
- 108,13,78,143,48,113,18,83,148,53,118,23,88,153,58,123,28,93,
- 158,63,64,129,34,99,4,69,134,39,104,9,74,139,44,109,14,79,
- 144,49,114,19,84,149,54,119,24,89,154,59,124,29,94,159
-}; // Q0
-
-const Word16 Idx_dortft320[320] =
-{
- 0,65,130,195,260,5,70,135,200,265,10,75,140,205,270,15,80,145,210,275,20,85,150,215,280,25,90,155,220,285,30,95,
- 160,225,290,35,100,165,230,295,40,105,170,235,300,45,110,175,240,305,50,115,180,245,310,55,120,185,250,315,60,125,
- 190,255,256,1,66,131,196,261,6,71,136,201,266,11,76,141,206,271,16,81,146,211,276,21,86,151,216,281,26,91,156,221,
- 286,31,96,161,226,291,36,101,166,231,296,41,106,171,236,301,46,111,176,241,306,51,116,181,246,311,56,121,186,251,
- 316,61,126,191,192,257,2,67,132,197,262,7,72,137,202,267,12,77,142,207,272,17,82,147,212,277,22,87,152,217,282,27,
- 92,157,222,287,32,97,162,227,292,37,102,167,232,297,42,107,172,237,302,47,112,177,242,307,52,117,182,247,312,57,122,
- 187,252,317,62,127,128,193,258,3,68,133,198,263,8,73,138,203,268,13,78,143,208,273,18,83,148,213,278,23,88,153,218,
- 283,28,93,158,223,288,33,98,163,228,293,38,103,168,233,298,43,108,173,238,303,48,113,178,243,308,53,118,183,248,313,
- 58,123,188,253,318,63,64,129,194,259,4,69,134,199,264,9,74,139,204,269,14,79,144,209,274,19,84,149,214,279,24,89,154,
- 219,284,29,94,159,224,289,34,99,164,229,294,39,104,169,234,299,44,109,174,239,304,49,114,179,244,309,54,119,184,249,
- 314,59,124,189,254,319
-}; // Q0
-
-const Word16 Idx_dortft480[480] =
-{
- 0,225,450,195,420,165,390,135,360,105,330,75,300,45,270,15,240,465,210,435,180,405,150,375,120,345,
- 90,315,60,285,30,255,256,1,226,451,196,421,166,391,136,361,106,331,76,301,46,271,16,241,466,211,436,
- 181,406,151,376,121,346,91,316,61,286,31,32,257,2,227,452,197,422,167,392,137,362,107,332,77,302,47,
- 272,17,242,467,212,437,182,407,152,377,122,347,92,317,62,287,288,33,258,3,228,453,198,423,168,393,138,
- 363,108,333,78,303,48,273,18,243,468,213,438,183,408,153,378,123,348,93,318,63,64,289,34,259,4,229,454,
- 199,424,169,394,139,364,109,334,79,304,49,274,19,244,469,214,439,184,409,154,379,124,349,94,319,320,
- 65,290,35,260,5,230,455,200,425,170,395,140,365,110,335,80,305,50,275,20,245,470,215,440,185,410,155,
- 380,125,350,95,96,321,66,291,36,261,6,231,456,201,426,171,396,141,366,111,336,81,306,51,276,21,246,471,
- 216,441,186,411,156,381,126,351,352,97,322,67,292,37,262,7,232,457,202,427,172,397,142,367,112,337,82,
- 307,52,277,22,247,472,217,442,187,412,157,382,127,128,353,98,323,68,293,38,263,8,233,458,203,428,173,
- 398,143,368,113,338,83,308,53,278,23,248,473,218,443,188,413,158,383,384,129,354,99,324,69,294,39,264,
- 9,234,459,204,429,174,399,144,369,114,339,84,309,54,279,24,249,474,219,444,189,414,159,160,385,130,355,
- 100,325,70,295,40,265,10,235,460,205,430,175,400,145,370,115,340,85,310,55,280,25,250,475,220,445,190,
- 415,416,161,386,131,356,101,326,71,296,41,266,11,236,461,206,431,176,401,146,371,116,341,86,311,56,281,
- 26,251,476,221,446,191,192,417,162,387,132,357,102,327,72,297,42,267,12,237,462,207,432,177,402,147,372,
- 117,342,87,312,57,282,27,252,477,222,447,448,193,418,163,388,133,358,103,328,73,298,43,268,13,238,463,
- 208,433,178,403,148,373,118,343,88,313,58,283,28,253,478,223,224,449,194,419,164,389,134,359,104,329,74,
- 299,44,269,14,239,464,209,434,179,404,149,374,119,344,89,314,59,284,29,254,479
-}; // Q0
-
-const Word16 Ip_fft128[10] = { 64, 1, 0, 128, 64, 192, 32, 160, 96, 224 }; // Q0
-
-const Word32 w_fft128_16fx[64] =
-{
- 1073741824, 0, 759250112, 759250112, 992008064, 410903232, 410903232, 992008064,
- 1053110144, 209476640, 596539008, 892783680, 892783680, 596539008, 209476640, 1053110144,
- 1068571456, 105245104, 681174592, 830013632, 946955712, 506158400, 311690816, 1027506880,
- 1027506880, 311690816, 506158400, 946955712, 830013632, 681174592, 105245104, 1068571456,
- 1072448448, 52686008, 721080960, 795590208, 970651136, 459083776, 361732736, 1010975232,
- 1041563136, 260897968, 552013632, 920979072, 862437504, 639627264, 157550640, 1062120192,
- 1062120192, 157550640, 639627264, 862437504, 920979072, 552013632, 260897968, 1041563136,
- 1010975232, 361732736, 459083776, 970651136, 795590208, 721080960, 52686008, 1072448448,
-}; // Q30
-
-const Word16 Ip_fft256[10] = {128, 1, 0, 256, 128, 384, 64, 320,192, 448}; // Q0
-
-const Word16 Ip_fft512[18] = {256, 1, 0, 512, 256, 768, 128, 640,384, 896, 64, 576, 320, 832, 192, 704,448, 960}; // Q0
-
-const Word16 w_fft512_fx_evs[256] =//Q14
-{
- 16384, 0, 11585, 11585, 15137, 6270, 6270, 15137,
- 16069, 3196, 9102, 13623, 13623, 9102, 3196, 16069,
- 16305, 1606, 10394, 12665, 14449, 7723, 4756, 15679,
- 15679, 4756, 7723, 14449, 12665, 10394, 1606, 16305,
- 16364, 804, 11003, 12140, 14811, 7005, 5520, 15426,
- 15893, 3981, 8423, 14053, 13160, 9760, 2404, 16207,
- 16207, 2404, 9760, 13160, 14053, 8423, 3981, 15893,
- 15426, 5520, 7005, 14811, 12140, 11003, 804, 16364,
- 16379, 402, 11297, 11866, 14978, 6639, 5897, 15286,
- 15986, 3590, 8765, 13842, 13395, 9434, 2801, 16143,
- 16261, 2006, 10080, 12916, 14256, 8076, 4370, 15791,
- 15557, 5139, 7366, 14635, 12406, 10702, 1205, 16340,
- 16340, 1205, 10702, 12406, 14635, 7366, 5139, 15557,
- 15791, 4370, 8076, 14256, 12916, 10080, 2006, 16261,
- 16143, 2801, 9434, 13395, 13842, 8765, 3590, 15986,
- 15286, 5897, 6639, 14978, 11866, 11297, 402, 16379,
- 16383, 201, 11442, 11727, 15059, 6455, 6084, 15213,
- 16029, 3393, 8935, 13733, 13510, 9269, 2999, 16107,
- 16284, 1806, 10238, 12792, 14354, 7900, 4563, 15736,
- 15619, 4948, 7545, 14543, 12537, 10549, 1406, 16324,
- 16353, 1005, 10853, 12274, 14724, 7186, 5330, 15493,
- 15843, 4176, 8250, 14155, 13039, 9921, 2205, 16235,
- 16176, 2603, 9598, 13279, 13949, 8595, 3786, 15941,
- 15357, 5708, 6823, 14896, 12004, 11151, 603, 16373,
- 16373, 603, 11151, 12004, 14896, 6823, 5708, 15357,
- 15941, 3786, 8595, 13949, 13279, 9598, 2603, 16176,
- 16235, 2205, 9921, 13039, 14155, 8250, 4176, 15843,
- 15493, 5330, 7186, 14724, 12274, 10853, 1005, 16353,
- 16324, 1406, 10549, 12537, 14543, 7545, 4948, 15619,
- 15736, 4563, 7900, 14354, 12792, 10238, 1806, 16284,
- 16107, 2999, 9269, 13510, 13733, 8935, 3393, 16029,
- 15213, 6084, 6455, 15059, 11727, 11442, 201, 16383
-};
-const Word16 Idx_dortft40[40] =
-{
- 0, 25, 10, 35, 20, 5, 30, 15, 16, 1, 26, 11, 36, 21, 6, 31, 32, 17, 2, 27,
- 12, 37, 22, 7, 8, 33, 18, 3, 28, 13, 38, 23, 24, 9, 34, 19, 4, 29, 14, 39
-}; // Q0
-
-const Word16 Odx_fft8_5[8] = {0, 3, 6, 1, 4, 7, 2, 5}; // Q0
-const Word16 Idx_dortft20[20] = {0, 5, 10, 15, 16, 1, 6, 11, 12, 17, 2, 7, 8, 13, 18, 3, 4, 9, 14, 19}; // Q0
-const Word16 Odx_fft4_5[4] = {0, 3, 2, 1}; // Q0
-const Word16 Ip_fft4[6] = {2,1,0,4,2,6}; // Q0
-const Word16 ip_edct2_64[6] = {16, 64, 0, 32, 16, 48}; // Q0
-
-const Word16 w_edct2_64_fx[80] = /*Q14 */
-{
- 16384, 0, 11585, 11585, 15137, 6270, 6270, 15137,
- 16069, 3196, 9102, 13623, 13623, 9102, 3196, 16069,
- 11585, 8190, 8182, 8170, 8153, 8130, 8103, 8071,
- 8035, 7993, 7946, 7895, 7839, 7779, 7713, 7643,
- 7568, 7489, 7405, 7317, 7225, 7128, 7027, 6921,
- 6811, 6698, 6580, 6458, 6333, 6203, 6070, 5933,
- 5793, 5649, 5501, 5351, 5197, 5040, 4880, 4717,
- 4551, 4383, 4212, 4038, 3862, 3683, 3503, 3320,
- 3135, 2948, 2760, 2570, 2378, 2185, 1990, 1795,
- 1598, 1401, 1202, 1003, 803, 603, 402, 201
-};
-
-/* HVQ */
-const Word16 hvq_thr_adj_fx[5] = { 23170, 16384, 8192, 16384, 23170 }; /* Q15 */
-
-const Word16 hvq_index_mapping_fx[4] = { 0, 1, 3, 4 };
-
-const Word16 hvq_class_c_fx[16] = /* Q15 */
-{
- -7617, -14387, 2136, 6914,
- 4821, -4428, 14131, -4538,
- -4538, 14131, -4428, 4821,
- 6914, 2136, -14387, -7617
-};
-
-const Word16 hvq_cb_search_overlap24k[17] =
-{
- 0, 8, 17, 27,
- 39, 53, 69, 89,
- 113, 128, 128, 128,
- 128, 128, 128, 128,
- 128
-}; // Q0
-
-const Word16 hvq_cb_search_overlap32k[21] =
-{
- 0, 6, 13, 21,
- 30, 40, 51, 64,
- 78, 96, 116, 128,
- 128, 128, 128, 128,
- 128, 128, 128, 128,
- 128
-}; // Q0
-
-const Word16 hvq_peak_cb_fx[1024] = /* Q15 */
-{
- -22652,-20549,-23019, 13968,-25496,-27493, -6957, 5753,-19678,-20274,
- -6119, 18297, -5329,-22843,-21254, 13929,-27525,-29034, 563, 7265,
- -26138,-13138, -9678, 7972, -517,-20830,-10703, 26832,-27818,-21449,
- 208, 6297,-14803,-28396, -7655, 5118, 15134,-24005,-21776, 25330,
- -11282,-23669,-20340, -2006,-16212,-24127, 9075, 22581,-20047,-25695,
- -254, 6509,-17174,-29714, 1589, 7104,-17683, -4117, -4049, 22347,
- -28338,-13898, 671, 6777,-18368,-17925, -7409, 5169,-22093,-19561,
- 702, 5969, -6610,-27398, -4875, 8773,-29634, -5552, 272, 6992,
- -9167,-19887, -9136, 6447,-23125,-25612, 9760, 5749,-10410,-29816,
- 1606, 7019,-13758,-24849, 2084, 7129,-17795,-16160, 596, 7287,
- -22276,-11145, 521, 6474,-13471,-20705, -74, 6740, 1891,-16245,
- -12763, 13602, -1617,-27384, -9648, 2511,-21802,-11734, -4836, -1602,
- -9670,-27913, 6456, 6338,-23227, -4603, 754, 5830, -7699,-24416,
- 2204, 6518,-27591, 2763, 1885, 6839,-15248,-10500, 344, 6942,
- -13247, -9761, -4486, 4294,-12097,-15164, 637, 6142,-25994,-16384,
- 17277, 6511,-10346,-26179, 923, -2374,-13316,-18125, 6841, 7100,
- -21083,-24251, 4207, -9464,-22914, -7057, 8647, 8026, 2488,-20731,
- -799, 13754, -3451,-12872, 2545, 17315, 2576,-19594,-10340, 4361,
- -7007,-19401, 1937, 6751, 17502,-24923,-16948, 8534, -3436,-29004,
- 6315, 6467,-16936, -4957, 591, 6604, 1099,-26790, -708, 5543,
- -5949,-14167, -4750, 4068,-10682,-14990, -7489, -5197, 169, -6472,
- -5143, 16200,-20331, 1722, 395, 6233,-15661,-22913, 24689, 14221,
- -3892,-22862, 5154, 6301, -8786,-10120, 216, 6831,-12390,-11062,
- 4824, 6473, -7705, -4195, -5326, 6572, -560,-20773, -2777, 1822,
- -6703,-14413, 2409, 6083,-10595,-25038, 14291, 4825, 2064,-25736,
- 16863, 20463, -2752,-29103, 12609, 7539, -7638,-18024, 1948, 689,
- -10961, -5839, 683, 6170,-26004, 12209, 10742, 15580, -2105, -8625,
- -4932, 6977, -9940,-15129, 12160, 9806,-13921, -55, 440, 6315,
- -305, -6080, 11303, 25730,-12423, -3161, 6875, 9836, -2780,-16434,
- 4128, 5778, 17790,-10991, -6633, 21111, 12367,-26550,-10581, -2530,
- -6713,-10210, 4804, 6280, -5932, 2832, 4978, 18330, 2696,-23822,
- -11870,-13313, 5266,-10870, -7933, 4455, -3155,-10994, 2225, 5803,
- 820,-11966, -1397, 5344, -5027, -7230, 1236, 5812, -1649,-21007,
- 8948, 5539,-16246, -801, -533, -3132, -8272, -1302, 367, 5958,
- -26574, -3470, 7126, -8876, -4819, -5380, -3923, 1466, 1929,-20655,
- 4419, 3663, 2437,-26758, 10897, 5616, -6601,-10394, 2148, 137,
- 15007,-22909, -3948, 6197, -9059,-27702, 23041, 4088, 8312, -267,
- 2973, 25579, -3795, -3612, -489, 5401, 7711,-25887, 3443, 2623,
- -24306, 3091, 13248, 3273, -3113, -1410, 3541, 12047, 306,-11933,
- -4493, -1997,-18725, 8257, 7593, 7218,-13588, -8411, 8715, -1137,
- -12028, 5907, 17904, 21327, -2223,-22989, 9863, -1633, -723, -5944,
- 714, 5170, 2128,-15199, 2081, 1626, -482, -8521, 8131, 10765,
- 53,-12020, 5152, 5033, 2361,-13747, 24714, 26357, 1074,-28538,
- 18087, 4333, 1067,-22148, 14277, 5540, 729,-15049, 7936, 4648,
- -16646, -6350, 23646, 9628, -91, -8477, 3298, 4297, 3499, -7417,
- -2214, 2931, -4795, -4424, 6487, 4264, -9333, 3377, 6570, 5734,
- 1733,-17598, 11163, 4167, -2713,-16183, 14693, 4188,-23780, 9825,
- 25701, 15331, 586,-19288, 21576, 12040, 11328,-15656, 2944, 7335,
- 9203,-16906, -5723, -5371, -7906, -4632, 12470, 5724, -123,-16520,
- 976, -8288, 1262, -3966, -3014, -148, 230, -2169, 505, 3954,
- -2256,-11474, 9990, 2644, 4841, -8017, -4617, -2959, 24226,-22733,
- 7475, 17722, 6747, -5782, 4877, 8664, -6893,-24218, 12181,-14683,
- 2839, -7574, 4815, 2376, 2680, -3986, 1749, 2061, -563, 3232,
- 3039, 5761, 343, -4150, 6600, 3792, 6356, 7199, 10702, 24266,
- -25636,-12157, 22874,-14633, 2438, -8680, 8312, 3091, 7135, -3110,
- 268, 4547, 4272, 4886, 5861, 14177, 11382,-10386, -767, 1448,
- 1770,-28758, 27658, 4643, -3008,-10314, 18024, 5252, 6999,-17854,
- 9789, 909, 1556,-21532, 20929, 3182, 26836,-23774, -2868, 3509,
- -9884,-14471, 24685, 193, -3300, -5891, 5237, -5722, -9043,-14338,
- 17448, -7167, -683, 26, 4002, -235, 3072,-12689, 13537, 2670,
- 3577,-10477, 10097, 1435, 17713,-24555, 7486, 1713, 6633, -6645,
- 1863, -783, 3185, -8349, 3975, -3967, 8090,-23915, 7470, -8732,
- 2793,-16733, 17412, 1948, -5975,-14195, 1741,-22095, 3376, -782,
- 18258, 16642, 3845, -3536, 5136, 335, 3267, -719, 10538, 7756,
- -10993, 5165, 17885, 4767, 4733, -7751, 15643, 8215, 3678, 1686,
- 3571, 2189,-11186, 1470, 6152,-11489, 4353, -2197, 1357, -3164,
- 4258, -6029, 8420, -230, 6220, -1478, 2105, -787, -4229, -4632,
- 15095, -1672, 1986,-16134, 14035, -6088, 7849,-14512, 2875,-10127,
- 4796,-14269, -8761,-25428, 1192,-24490, 22001, -6216, 258,-10418,
- 27459, 10524, -754, 7182, 7574, 3444, 5995, 3253, 25190, 25483,
- 6379, -6363, 409, -8435, -3319, 3253, 12035, 1358, 3184, -6482,
- 12864, -216, 25363, -7652, -2971, 5718, 4969, -3415, 7040, -2605,
- 2616,-21129, 28211, 1289, 2553,-15075, 23833, 1871, 14598, -6793,
- 7189, 4535, 5581, -1997, 4257, -4337, 6027,-10630, 9913, -5633,
- 3695,-11614, 19091, 585, 4415, -8798, 15569, -1099, -879, 752,
- 19480, 5412, 5743, 448, 9863, 1342, 20634,-16941, -7404,-16938,
- -11946, 17852, 19422, 5918, 12538,-20829, 22707, 1113, 4715, -4341,
- 12573, -3709, 4015, -8219, 3349,-17549, 6395, -1551, 4414, -8302,
- 24598,-24474, 21909, 9778, 5346, 1386, 6942, -4708, -1507, 2077,
- 8224,-10420, 6088, -3411, 8824, -6355, 7219, 17353, 22325, 25889,
- 6666, -1811, 1964,-13461, 8123, -4454, 26614, 11418, 4582, -7133,
- 18420, -3918, -264, 10545, 24810, 12821, 6936,-22880, 10241,-24118,
- 3108, -7220, 11991,-12963, 4237,-10392, 23417, -2591, 4624,-14780,
- 29121, -1235, 7543, -1157, 17358, 1244, 20161, -6319, 2575, -5204,
- 4384, 5974, 10993, -2909, 1619, -4017, 26017, 722, 4659, 11545,
- 14463, 4774, -2892, 10593, 15058, -4543, 1972,-15782, 26652,-10199,
- 6046, -562, 11992, -8022, 6197, -349, 7928,-12070, 21399,-13670,
- 15116, 99, 5829, -4061, 16713, -7200, -8904, 4170, 24814, -7599,
- 12177, 6080, 19388, 11094, 4262, 1544, 17090, -4775, -6957, -5908,
- 19576,-23176, 7126,-23499, 24889,-17683, 5514, -5416, 23284, -5830,
- 6388, -1788, 14378,-11597, 5099, -8771, 28791, -4573, 6029, -4164,
- 3217,-26929, 6427, 145, 9306,-17874, 5544, 3835, 25432, -15,
- 8297,-10673, 21003,-15084, 6019, -7628, 13891,-22535, 27144, 1685,
- 10077, 4230, 5211, -1543, 22179,-10638, 6385, 5710, 13476,-12976,
- 5272, 17571, 23747, 5084, -2100, 9127, 13746,-20852,-16310, 15716,
- 21422,-23074, 6532, -31, 17127,-16620, 5397, -3362, 28477, -9453,
- 6238, 1258, 13189,-22475, 12895, -4568, 8062,-26648, 2873, 5975,
- 22151,-15208, 6319, -507, 23117,-17415, 24129,-14207, 12908,-21101,
- 7262, 8470, 25405, -9450, 5424, -1162, 29494,-16114, 21373, 22875,
- 24554, 16783, 6684, 2453, 15785,-28885, 6504, 1085, 21619,-24241,
- 21468, 620, 23222, -7235, 10917, 8863, 18570,-21606, 6710, -2091,
- 28961,-25837, 6884, 20869, 27603, -8999, 6798, 5617, 28706,-21501,
- 6066, 4720, 25084,-28951
-};
-
-const Word16 hvq_pg_huff_offset[NUM_PG_HUFFLEN] = {0,2,3,8,9,11,13,15,19}; // Q0
-const Word16 hvq_pg_huff_thres[NUM_PG_HUFFLEN] = {0,0x2,0x4,0x18,0x20,0x40,0x80,0x100,0x300}; // Q0
-
-const Word16 hvq_pg_huff_tab[32] =
-{
- 30, 31, 1, 0, 2, 3, 28, 29, 4, 5, 27, 25, 26, 6, 24, 7, 8, 22, 23, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21
-}; // Q0
-
-const Word16 hvq_cp_huff_len[52] =
-{
- 3, 4, 5, 6, 6, 6, 6, 6, 4, 4, 5, 5, 5, 5, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 8,
- 8, 8, 8, 8, 9, 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 12, 12, 13, 13, 12, 12, 11, 12
-}; // Q0
-
-const Word16 hvq_cp_huff_val[52] =
-{
- 7, 8, 6, 3, 4, 5, 6, 7, 9, 10, 7, 8, 9, 10, 11, 12, 13, 11, 12, 13, 14, 15, 8, 9, 10,
- 11, 4, 5, 3, 4, 5, 6, 7, 5, 4, 5, 3, 4, 5, 6, 7, 8, 9, 6, 1, 2, 0, 1, 3, 4, 7, 5
-}; // Q0
-
-const Word16 hvq_cp_layer1_map5[HVQ_CP_MAP_LEN] = { 16, 8, 4, 2, 1, 18, 17, 9 }; // Q0
-
-const Word16 hvq_cp_huff_thres[HVQ_CP_HUFF_NUM_LEN] = { 0x0, 0x2, 0xC, 0x20, 0x50, 0x60, 0x100, 0x180, 0x600, 0x1000, 0x1C00 }; // Q0
-const Word16 hvq_cp_huff_offset[HVQ_CP_HUFF_NUM_LEN] = { 0, 2, 7, 12, 18, 19, 24, 26, 35, 45, 51 }; // Q0
-
-const Word16 hvq_cp_huff_tab[52] =
-{
- 46, 47, 44, 45, 48, 49, 51, 36, 37, 38, 43, 50, 34, 35, 39, 40, 41, 42, 33, 28, 29, 30, 31, 32, 26, 27,
- 3, 4, 5, 6, 7, 22, 23, 24, 25, 2, 10, 11, 12, 13, 17, 18, 19, 20, 21, 1, 8, 9, 14, 15, 16, 0
-}; // Q0
-
-/*----------------------------------------------------------------------------------*
- * FEC for HQ core
- *----------------------------------------------------------------------------------*/
-
-const Word16 Num_bands_NB[MAX_SB_NB] = {8,8,2}; // Q0
-
-const Word16 SmoothingWin_NB875_fx[70] = /*Q15*/
-{
- 0, 16, 66, 148, 263, 411, 590, 802, 1045, 1318,
- 1623, 1956, 2319, 2710, 3129, 3574, 4046, 4542, 5062, 5604,
- 6169, 6754, 7358, 7981, 8620, 9275, 9945, 10627, 11321, 12025,
- 12738, 13459, 14185, 14915, 15649, 16384, 17119, 17853, 18583, 19309,
- 20030, 20743, 21447, 22141, 22823, 23493, 24148, 24787, 25410, 26014,
- 26599, 27164, 27706, 28226, 28722, 29194, 29639, 30058, 30449, 30812,
- 31145, 31450, 31723, 31966, 32178, 32357, 32505, 32620, 32702, 32752
-};
-
-const Word16 SmoothingWin_NB2_fx[16] =
-{/* Q15 */
- 0, 315, 1247, 2761, 4799, 7282, 10114, 13188, 16384, 19580, 22654, 25486, 27969, 30007, 31521, 32453
-};
-/*----------------------------------------------------------------------------------*
- * SC-VBR
- *----------------------------------------------------------------------------------*/
-
-const Word16 bp1_num_coef_wb_fx[5] = { 15286, 0, -30572, 0, 15286, }; /* Q14 */
-const Word16 bp1_den_coef_wb_fx[5] = { 16384, 0, -30498, 0, 14262, }; /* Q14 */
-
-const Word16 shape1_num_coef_fx[11] = /* Q15 */
-{
- 31437, -2443, -13636, 4316,
- -10188, 48, 2639, -3575,
- -776, 1046, 399
-};
-
-const Word16 shape1_den_coef_fx[11] = { 32767, /* Q15 */
- 2940, -12237, 4032, -9609,
- -1998, 2335, -3900, -1595,
- 857, 253
-};
-
-const Word16 shape2_num_coef_fx[11] = /* Q15 */
-{
- 30760, 31, -9699, 9516,
- -5878, -7249, -10468, 442,
- 3278, -63, 1115
-};
-
-const Word16 shape2_den_coef_fx[11] = { 32767, /* Q15 */
- 16019, -890, 12799, 2346,
- -6985, -13192, -5795, -949,
- -1492, -304
-};
-
-const Word16 shape3_num_coef_fx[11] = /* Q15 */
-{
- 30685, -383, -9937, -9605,
- -5997, 7611, -10393, -355,
- 3239, 12, 1196
-};
-
-const Word16 shape3_den_coef_fx[11] = { 32767, /* Q15 */
- -16498, -911, -12947, 2286,
- 7430, -13385, 6066, -1182,
- 1580, -273
-};
-
-const Word16 txlpf1_num_coef_fx[11] = /* Q13 */
-{
- 138, 198, 514, 681, 921,
- 964, 921, 681, 514, 198,
- 138,
-};
-
-
-const Word16 txlpf1_den_coef_fx[11] = /* Q13 */
-{
- 8192,-18945, 31613,-31149, 24494,
- -12753, 5528, -1436, 347, -25,
- 4,
-};
-
-
-const Word16 txhpf1_num_coef_fx[11] = /* Q13 */
-{
- 138, -198, 514, -681, 921,
- -964, 921, -681, 514, -198,
- 138,
-};
-
-const Word16 txhpf1_den_coef_fx[11] = /* Q13 */
-{
- 8192, 18945, 31613, 31149, 24494,
- 12753, 5528, 1436, 347, 25,
- 4,
-};
-
-/* NELP filter coefficients */
-const Word16 bp1_num_coef_nb_fx_order7[8] =
-{
- /* Q = BP1_COEF_NB_QF_ORDER7 = 13 */
- 1481, 6730, 15579, 22923, 22923, 15579, 6730, 1481,
-
-};
-
-const Word16 bp1_den_coef_nb_fx_order7[8] =
-{
- /* Q = BP1_COEF_NB_QF_ORDER7 = 13 */
- 8192, 16156, 23814, 21855, 14620, 6614, 1907, 268,
-};
-
-/* NELP gain tables */
-const Word16 UVG1CB_WB_FX[UVG1_CBSIZE][2] = /* Q13 */
-{
- { -2224, -2114, },
- { 12666, 12314, },
- { 3723, 9690, },
- { 17880, 17978, },
- { 4136, 3946, },
- { 11605, 21280, },
- { 9777, 9340, },
- { 21701, 21627, },
- { 1088, 1679, },
- { 13993, 13697, },
- { 10443, 5214, },
- { 19702, 19692, },
- { 5458, 5317, },
- { 17051, 16918, },
- { 14206, 8503, },
- { 24330, 24271, },
- { -118, -279, },
- { 11615, 14863, },
- { 6898, 6544, },
- { 18913, 18637, },
- { 1142, 6811, },
- { 15995, 16070, },
- { 6921, 13182, },
- { 22857, 22741, },
- { 3017, 2260, },
- { 14952, 14992, },
- { 8176, 8093, },
- { 20721, 20549, },
- { 7441, 2370, },
- { 17897, 13988, },
- { 10986, 10966, },
- { 26098, 25992, },
-};
-
-const Word16 UVG1CB_NB_FX[UVG1_CBSIZE][2] = /* Q13 */
-{
- { -4791, -5157, },
- { 4824, 4937, },
- { -3443, 3610, },
- { 5539, 15293, },
- { -469, -3986, },
- { 7977, 8157, },
- { 2748, 2492, },
- { 14070, 14014, },
- { -2486, -2863, },
- { 6033, 5892, },
- { 2678, -441, },
- { 11741, 11804, },
- { -256, -847, },
- { 9153, 8922, },
- { -106, 5979, },
- { 16876, 16741, },
- { -3584, -3873, },
- { 3511, 9538, },
- { 401, 416, },
- { 11082, 10550, },
- { -1418, -1725, },
- { 8988, 5255, },
- { 6275, 1137, },
- { 15372, 15247, },
- { -3899, 301, },
- { 6976, 7095, },
- { 1581, 1453, },
- { 12988, 12824, },
- { 2692, -3093, },
- { 9778, 10153, },
- { 3938, 3628, },
- { 18823, 18695, },
-};
-
-const Word16 UVG2CB1_WB_FX[UVG2_CBSIZE][5] = /* Q12 */
-{
- { 914, 990, 1490, 5954, 2618, },
- { 5599, 4621, 4078, 3493, 3057, },
- { 4930, 4031, 2999, 2150, 1706, },
- { 7722, 3021, 1804, 1478, 1452, },
- { 1171, 1390, 6895, 2592, 1486, },
- { 4155, 4287, 4409, 4515, 4577, },
- { 3633, 3661, 3694, 3711, 3736, },
- { 13212, 5009, 2611, 2175, 2048, },
- { 3716, 2887, 2253, 1965, 1723, },
- { 7141, 4567, 3434, 2970, 2396, },
- { 2856, 3038, 3259, 3481, 3709, },
- { 5929, 5459, 4923, 4448, 4084, },
- { 980, 1024, 1550, 5686, 8038, },
- { 3516, 7354, 10392, 3619, 2856, },
- { 2598, 3093, 3582, 4780, 5965, },
- { 1962, 10993, 5020, 2861, 2587, },
- { 796, 916, 1010, 1175, 7720, },
- { 4445, 4406, 4344, 4249, 4175, },
- { 1454, 6493, 2611, 1758, 1765, },
- { 6296, 7686, 4763, 2945, 2203, },
- { 1502, 1573, 1895, 2981, 5464, },
- { 4750, 4829, 4909, 4929, 4895, },
- { 3644, 3774, 3922, 4037, 4116, },
- { 9051, 7403, 6003, 4746, 4081, },
- { 1558, 1869, 2331, 3000, 3595, },
- { 4671, 4646, 4614, 4553, 4482, },
- { 2262, 2608, 3158, 3890, 4468, },
- { 5556, 5441, 6824, 7146, 5724, },
- { 1470, 1550, 2016, 11169, 3828, },
- { 5488, 6270, 6771, 8202, 9281, },
- { 3477, 3693, 4113, 4460, 4705, },
- { 10877, 17984, 10194, 7291, 2824, },
- { 1327, 1498, 1476, 1667, 2138, },
- { 4463, 4299, 4094, 3880, 3731, },
- { 3188, 3164, 3156, 3104, 3140, },
- { 9757, 5690, 3366, 2296, 1792, },
- { 1731, 1753, 12406, 4082, 2247, },
- { 3866, 4060, 5007, 5274, 5225, },
- { 3998, 3957, 3900, 3839, 3789, },
- { 18040, 9417, 5567, 3465, 2504, },
- { 2160, 2532, 2895, 2577, 2321, },
- { 5052, 4789, 4490, 4203, 3953, },
- { 3381, 3415, 3458, 3496, 3536, },
- { 6166, 5811, 5440, 5035, 4650, },
- { 2839, 3389, 5057, 7558, 10414, },
- { 3875, 4431, 5183, 6310, 7166, },
- { 4311, 4130, 3571, 3070, 8555, },
- { 8791, 8260, 7299, 6243, 5421, },
- { 1191, 1237, 1368, 1814, 11819, },
- { 2486, 5729, 6150, 4222, 3667, },
- { 4018, 3825, 3600, 3388, 3256, },
- { 7504, 5817, 4989, 4065, 3322, },
- { 1430, 1962, 5546, 4096, 4681, },
- { 5393, 5378, 5324, 5230, 5052, },
- { 4041, 4090, 4132, 4159, 4181, },
- { 12469, 9221, 5735, 3617, 2501, },
- { 2482, 2565, 2768, 3088, 3461, },
- { 5209, 5080, 4905, 4706, 4522, },
- { 3139, 3362, 3647, 3910, 4156, },
- { 7139, 6588, 5941, 5251, 4674, },
- { 1719, 1866, 7993, 7634, 3987, },
- { 3587, 5289, 7882, 13519, 16095, },
- { 2409, 2515, 2749, 7316, 4636, },
- { 30391, 18493, 13798, 4799, 2283, },
-};
-
-const Word16 UVG2CB2_WB_FX[UVG2_CBSIZE][5] = /* Q12 */
-{
- { 1565, 1391, 1635, 5228, 2681, },
- { 2156, 2558, 6205, 5561, 3944, },
- { 2039, 2406, 3094, 3409, 3968, },
- { 5090, 5065, 4989, 4858, 4764, },
- { 1436, 1736, 2816, 2362, 2400, },
- { 4375, 4425, 4465, 4478, 4493, },
- { 4648, 4081, 3550, 2981, 2667, },
- { 1705, 1950, 3679, 7828, 9895, },
- { 2839, 1826, 1443, 1210, 1245, },
- { 1387, 1410, 1768, 8873, 4383, },
- { 4022, 3784, 3565, 3316, 3096, },
- { 9983, 7147, 5225, 3742, 3027, },
- { 6769, 2357, 1531, 1448, 1556, },
- { 4591, 4671, 4735, 4765, 4789, },
- { 4308, 4198, 4052, 3896, 3769, },
- { 2288, 2550, 4922, 8294, 14878, },
- { 1361, 1480, 1511, 1991, 10450, },
- { 2933, 3131, 3694, 4687, 5201, },
- { 3984, 3048, 2479, 2644, 5514, },
- { 5353, 5480, 5488, 5434, 5437, },
- { 3319, 2881, 2528, 2152, 1927, },
- { 4873, 4748, 4578, 4407, 4257, },
- { 6185, 4396, 3751, 3400, 2899, },
- { 2159, 8067, 7534, 5121, 3640, },
- { 2265, 10177, 3803, 2588, 2441, },
- { 2188, 2206, 4293, 12691, 5893, },
- { 3587, 3651, 3760, 3864, 3960, },
- { 13158, 9752, 7171, 5431, 5364, },
- { 5710, 4173, 2928, 2090, 1774, },
- { 3531, 3831, 4641, 5787, 6622, },
- { 4395, 4356, 4281, 4194, 4111, },
- { 2243, 2476, 5814, 3965, 27176, },
- { 1575, 1667, 7544, 3005, 1984, },
- { 2583, 2511, 11684, 5765, 4807, },
- { 3632, 3458, 3277, 3114, 2971, },
- { 8569, 6778, 5866, 5515, 5141, },
- { 3267, 3035, 2940, 2782, 2691, },
- { 3929, 4249, 4577, 4877, 5162, },
- { 4443, 4173, 3864, 3590, 3337, },
- { 3998, 4725, 5728, 6873, 7885, },
- { 4369, 2824, 2237, 1648, 1404, },
- { 1000, 1022, 1477, 2682, 15276, },
- { 3916, 3851, 3766, 3664, 3591, },
- { 13206, 4485, 3230, 3897, 3648, },
- { 10002, 3515, 2393, 2233, 2211, },
- { 4603, 4836, 5071, 5259, 5411, },
- { 3919, 4035, 4177, 4304, 4419, },
- { 3046, 8332, 16475, 11172, 10858, },
- { 1027, 1007, 1196, 1578, 5937, },
- { 1892, 2422, 3227, 3920, 7400, },
- { 3584, 3532, 3508, 3470, 3437, },
- { 5363, 6155, 6805, 6854, 6811, },
- { 4038, 3512, 3030, 2636, 2332, },
- { 6760, 6124, 5235, 4299, 3687, },
- { 4125, 6528, 4068, 3238, 3483, },
- { 5020, 5905, 7082, 8554, 9623, },
- { 1399, 5868, 3069, 1726, 1655, },
- { 4691, 4234, 3974, 3757, 9616, },
- { 3978, 4003, 4003, 3983, 3960, },
- { 2103, 16858, 9252, 4860, 4727, },
- { 8043, 5294, 3970, 3098, 2583, },
- { 4680, 5109, 5576, 5965, 6275, },
- { 4867, 4584, 4276, 3958, 3682, },
- { 1213, 3115, 6552, 22778, 20977, },
-};
-
-const Word16 UVG2CB1_NB_FX[UVG2_CBSIZE][5] = /* Q12 */
-{
- { 773, 785, 785, 785, 860, },
- { 3560, 3521, 3410, 3265, 3167, },
- { 1766, 2982, 10273, 3790, 2248, },
- { 4986, 4753, 4496, 4172, 3922, },
- { 2036, 2030, 2009, 1973, 1897, },
- { 3291, 3554, 3868, 4126, 4345, },
- { 3207, 3122, 3026, 2913, 2797, },
- { 13220, 6844, 3967, 2746, 2466, },
- { 1553, 1627, 1392, 1766, 3679, },
- { 5379, 4640, 3844, 3254, 2635, },
- { 1600, 1622, 2430, 9446, 4214, },
- { 5115, 5200, 5311, 5365, 5343, },
- { 6229, 3008, 1989, 1622, 1597, },
- { 1726, 2114, 7046, 6162, 4301, },
- { 1004, 1056, 1841, 6006, 7101, },
- { 6388, 9659, 4510, 2774, 2113, },
- { 1060, 1153, 1400, 1733, 2121, },
- { 3448, 3523, 3612, 3683, 3770, },
- { 1496, 2045, 2910, 3563, 4058, },
- { 4419, 4592, 4795, 4921, 4978, },
- { 1407, 5314, 2788, 1675, 1350, },
- { 4210, 4225, 4227, 4186, 4169, },
- { 2247, 8245, 4392, 2522, 1709, },
- { 7211, 6741, 6110, 5397, 4680, },
- { 3602, 2286, 1577, 1229, 1148, },
- { 6674, 5227, 3576, 2448, 1901, },
- { 954, 1035, 1079, 1683, 9558, },
- { 4011, 5853, 8979, 7138, 4484, },
- { 2784, 2702, 2637, 2546, 2471, },
- { 4414, 4065, 4627, 4208, 9275, },
- { 2771, 3012, 3357, 3735, 4066, },
- { 19742, 8603, 3943, 2546, 2085, },
- { 1132, 1123, 1107, 1093, 1114, },
- { 3913, 3838, 3733, 3630, 3548, },
- { 948, 1565, 6063, 2654, 1667, },
- { 6159, 5567, 4884, 4241, 3770, },
- { 925, 1164, 1585, 6062, 3090, },
- { 3818, 4037, 4322, 4536, 4726, },
- { 4291, 3894, 3441, 3006, 2733, },
- { 8544, 6487, 4962, 3812, 2970, },
- { 1744, 1758, 1704, 1633, 1576, },
- { 4416, 4259, 4044, 3810, 3628, },
- { 1919, 2159, 3323, 13977, 7898, },
- { 5952, 5731, 5419, 5061, 4732, },
- { 2775, 2812, 2507, 2540, 6585, },
- { 3436, 3960, 4661, 5975, 6274, },
- { 3082, 3150, 3246, 3337, 3404, },
- { 4089, 16018, 8285, 4116, 2704, },
- { 1419, 1425, 1400, 1371, 1363, },
- { 3825, 3890, 3953, 3993, 4015, },
- { 2498, 2689, 2846, 3011, 3213, },
- { 5122, 5024, 4881, 4691, 4524, },
- { 2285, 2325, 2317, 2313, 2271, },
- { 4493, 4529, 4517, 4478, 4443, },
- { 9138, 3969, 2522, 2222, 2415, },
- { 10009, 8719, 7292, 5837, 4532, },
- { 831, 908, 1039, 1656, 6813, },
- { 2070, 5478, 5174, 3911, 3694, },
- { 1577, 1565, 1635, 2583, 13154, },
- { 5590, 5788, 5922, 6752, 7063, },
- { 4061, 3497, 2710, 2099, 1716, },
- { 2750, 3118, 16574, 7891, 3651, },
- { 2598, 3072, 3809, 4906, 5172, },
- { 15348, 10948, 7740, 4979, 3446, },
-};
-
-const Word16 UVG2CB2_NB_FX[UVG2_CBSIZE][5] = /* Q12 */
-{
- { 961, 867, 812, 771, 775, },
- { 2544, 2686, 3010, 3605, 5048, },
- { 1524, 1818, 2889, 3029, 3046, },
- { 4195, 4301, 4421, 4497, 4580, },
- { 2026, 1990, 1965, 1943, 1939, },
- { 4338, 4156, 3963, 3750, 3590, },
- { 7732, 2904, 1804, 1407, 1513, },
- { 1613, 2353, 11315, 5764, 4291, },
- { 1519, 1462, 1434, 1341, 1294, },
- { 1627, 1710, 2163, 9654, 5615, },
- { 2322, 7293, 3251, 2020, 2066, },
- { 4967, 5112, 5174, 5203, 5230, },
- { 1590, 1449, 1943, 5947, 3563, },
- { 7747, 5170, 3268, 2392, 2082, },
- { 3970, 3559, 3164, 2774, 2493, },
- { 1993, 2210, 3204, 3717, 23534, },
- { 1185, 1236, 1423, 2115, 4772, },
- { 3935, 3840, 3714, 3583, 3477, },
- { 1640, 1550, 1800, 2609, 10880, },
- { 4067, 4437, 4811, 5108, 5536, },
- { 1472, 1367, 1533, 2132, 7352, },
- { 4310, 4284, 4216, 4117, 4057, },
- { 10817, 4587, 2611, 2066, 2037, },
- { 2089, 2427, 4698, 14635, 7517, },
- { 2529, 1561, 1209, 976, 945, },
- { 2908, 3070, 4055, 5862, 6448, },
- { 2676, 2861, 3115, 3295, 3408, },
- { 2932, 14330, 6533, 3739, 3462, },
- { 3681, 3079, 2559, 2151, 1903, },
- { 5636, 5316, 4978, 4690, 4425, },
- { 2298, 7228, 6976, 4251, 3347, },
- { 2504, 3421, 6784, 8483, 15064, },
- { 1253, 1180, 1136, 1094, 1076, },
- { 3451, 3524, 3600, 3646, 3707, },
- { 1701, 2030, 6574, 4746, 4451, },
- { 4688, 4751, 4762, 4727, 4722, },
- { 2977, 2363, 1883, 1563, 1399, },
- { 5080, 4685, 4275, 3835, 3513, },
- { 5445, 3828, 2851, 2242, 1948, },
- { 1929, 5037, 17760, 8346, 6300, },
- { 1839, 1782, 1680, 1586, 1534, },
- { 3086, 3472, 4031, 4950, 9695, },
- { 3199, 3052, 2896, 2751, 2622, },
- { 5822, 5782, 5727, 5566, 5478, },
- { 1548, 2234, 6748, 2562, 1722, },
- { 6699, 5216, 4475, 3531, 3028, },
- { 3773, 3628, 3460, 3279, 3155, },
- { 1581, 1672, 2929, 20221, 16432, },
- { 1210, 1215, 1389, 1678, 2177, },
- { 3863, 3886, 3937, 3961, 3989, },
- { 1541, 1745, 1829, 3479, 15563, },
- { 4444, 4952, 5573, 6056, 6545, },
- { 2460, 2397, 2284, 2133, 2041, },
- { 4808, 4676, 4493, 4322, 4213, },
- { 15031, 6644, 3315, 2900, 2885, },
- { 4003, 4760, 6946, 8274, 8401, },
- { 5001, 2495, 1594, 1337, 1365, },
- { 3428, 3706, 4073, 4457, 4670, },
- { 3326, 3277, 3222, 3142, 3088, },
- { 6162, 6317, 6494, 6459, 6530, },
- { 2659, 2599, 2537, 2482, 2546, },
- { 8554, 6902, 5233, 4116, 3650, },
- { 4643, 4099, 3616, 3201, 2895, },
- { 9589, 26630, 15412, 12532, 8715, },
-};
-
-const Word16 frac_4sf_fx[NB_SUBFR + 2] = { 4,8,12,16,16,16 }; /* Q4 */
-
-/* ERB table for PPP-ampl-quant */
-const Word16 erb_WB_fx[NUM_ERB_WB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 11264, 13568, 16387 };//Q(log2(2.56)
-
-
-/* ERB table for PPP-ampl-quant */
-const Word16 erb_NB_fx[NUM_ERB_NB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 10243 };//Q(log2(2.56)
-
-
-
-/*Amplitude and power tables for PPP*/
-
-const Word16 AmpCB1_WB_fx[640] =
-{//Q13
- 5655, 1589, -653, 3568, -3173, -1852, -3204, -4623, -2100, -5103,
- -923, -67, -7152, -4958, -2019, -1810, -8532, -648, 6581, 8043,
- 160, 778, -1535, 863, 5482, 1674, -3576, 123, -3163, -3595,
- -852, -53, -1080, -2683, -3199, -950, -1353, 6258, -1431, 1249,
- 2059, 677, 146, 1011, 956, -2022, -25, 300, 421, -5859,
- 1027, -452, -7343, -1052, 3818, 1099, -1005, 659, -511, -658,
- 2091, 720, -600, 145, -1504, -1716, -442, -2172, -1505, 2702,
- 731, 1473, -213, -4120, -2976, 688, 3205, 1213, 679, 232,
- 3672, 4770, -1198, -298, -1714, -3669, -2833, -664, -1859, -2380,
- -1169, -1593, -453, 295, -1225, -3110, -1776, 2112, 2710, 3333,
- 1022, 1248, 1091, 1164, 1200, 1782, -809, -2306, -3124, -2194,
- -1567, 465, 2223, -1301, -463, -2157, 729, 2279, -1938, 610,
- 437, -803, -1025, 775, -171, -637, 163, 2251, 316, -1663,
- -4123, -20, -2827, -1529, -1436, 3447, 79, -274, 1650, 4097,
- 2369, 927, 448, -449, 293, -239, -1028, -4805, 1354, 431,
- -2219, -490, -3849, 1639, -2925, 817, 1485, 2527, 5444, -1994,
- 1476, 506, -1643, 2003, -1676, -788, -1681, -2011, 1389, 452,
- 593, 3, -1200, -3987, -1634, -4310, -686, 882, 6235, 2420,
- -196, -1257, -2038, -498, 1394, 671, -2302, -809, -446, 3644,
- -1643, -2304, -828, 105, -323, -3906, -960, 7324, 3095, -786,
- 95, 633, 1266, 750, 1509, -2033, -3134, 432, 1028, -1825,
- 1258, 256, -3249, -6868, -523, -325, -1779, 4313, 2524, 3433,
- -600, -410, -88, 410, -1182, -1140, -1448, -1344, -5074, 6054,
- 2194, 1505, -681, -2408, 1376, 1389, 1209, 1048, -4199, -2939,
- 1855, 1744, -1344, -1431, -1955, -1805, -4992, 512, 624, 2749,
- -3446, -1215, -3764, -2169, -3601, -1321, 67, 4326, 6624, 5816,
- -334, -1746, -441, -754, 1853, 3889, -595, -493, 441, -811,
- -48, -764, -1473, -683, 603, -1754, 780, 698, 1084, 1713,
- 560, -808, -754, -2890, -1205, -318, -1021, 3195, 5693, -4603,
- 1343, -1061, -2441, -1784, 721, 267, 227, -622, 3013, -768,
- -472, 90, 13, 290, 1055, 948, 1617, -2368, -1087, 1103,
- -4784, -3872, 5125, -2518, -215, 6962, 1095, -1521, 2091, -2962,
- 2285, 1117, 1174, 2635, -1907, -1012, 814, -417, -2162, -2805,
- -1188, -707, -808, -1757, 260, -1093, -3957, -3266, 4132, 5980,
- 177, -1478, 960, 2029, 3989, 597, -3062, -3940, -1688, 236,
- -1559, 150, 2432, 348, -242, -2014, -1027, 6298, -2957, -3960,
- 1090, 1014, -1261, -744, -954, -938, -3713, -3272, 5356, -2356,
- -1439, 3808, -2330, -4437, 5177, -3606, -1382, 1824, 407, 325,
- 649, 330, 85, 206, -415, 183, -646, 602, -2656, 808,
- 1039, 29, -3202, -6168, -3640, 3736, 4183, 3959, 330, 339,
- 2701, 343, 1501, 1879, -3194, -4648, -1630, 1656, -1578, -84,
- -3065, -4126, 24, -260, 263, -1705, -1289, 2432, 1229, 7481,
- 2586, 1696, 646, -1773, -792, 1932, -1908, -1897, -1129, 112,
- -5667, -1592, 2253, -980, 1581, 211, 5277, 4846, -288, -159,
- 956, 1196, 771, -973, -1785, -516, -1015, 847, 614, -791,
- -442, -1594, -4632, -4392, -416, 1398, 2570, 752, 264, 6570,
- 1655, 546, 1238, -1362, -1330, -2005, 3590, -2155, -184, -1224,
- -1452, -1533, -534, 1010, -1707, 801, 3628, -289, 2414, 132,
- 2643, -2813, -4524, 5092, -7362, 740, 428, -510, 81, -1209,
- 616, 1454, 1861, -3958, -4084, 189, -1219, -875, 3764, 2086,
- -1554, -2071, 1515, 3392, 12, -686, -2414, -1382, 176, 1685,
- 2055, -5698, 1582, 4117, -4846, -2922, 610, 2082, 4682, -2487,
- 348, 2258, -338, -1379, 1472, 618, -202, -1122, -76, -2468,
- -1216, -986, -327, -1441, 102, 403, -2105, 2411, 1510, 1288,
- -715, -577, 1074, 2533, -3521, -3449, 2140, -751, -307, 3805,
- 158, -1385, -404, -1378, -1948, 3785, 4216, 2667, -1894, -1559,
- 1037, 1371, 989, -205, -333, -4784, -3429, -1283, 3299, 859,
- -4922, -5481, -1196, -1748, -720, 516, 113, 4590, 7071, 4345,
- -5729, -3862, 3590, 1463, 7094, 4991, 854, -66, -1630, -686,
- -923, -3266, -1988, 2345, 785, -1420, 3004, 2934, -1245, -65,
- -2696, -3088, -1438, 614, 1584, -239, -1552, 580, 6285, -1673,
- -1598, -4018, -1909, 747, 3191, 366, 1467, -1933, 2759, 2804,
- 518, 193, -1149, -3108, 441, 1458, 2791, -4131, 2694, 3372,
- -5023, -6491, 1794, 2739, 1463, 5843, 2869, 1993, -1409, 4832
-};
-
-const Word16 AmpCB2_WB_fx[64 * (NUM_ERB_WB - 13)] =
-{//Q13
- -5276, -7711, -3518, -2416, -382, 319, -1900, -900, 1725, 884,
- 4071, -4052, -2430, -336, 2136, 3006, 591, -3893, -2731, 2625,
- 2390, -1047, -883, -3368, -4235, -3726, 189, -1803, 784, 2336,
- 206, -2140, 3001, -730, -2279, 85, -3395, 4367, 2214, -254,
- -3114, -2348, 2763, 686, -7495, -6618, 3164, -3957, -2681, -2049,
- 1659, 3634, 2962, 1574, 379, -2478, 2861, 616, 1124, 205,
- -3075, -348, -2006, -90, 761, 1157, -114, -9460, -2786, -3254,
- -1120, -1500, -446, 2835, -314, 3205, 2115, -837, -261, 36,
- 80, -485, 1133, 2124, -1031, -401, -3166, 1145, -1616, -3425,
- -3071, -6891, -4198, 2292, 5160, -46, 1430, 280, 1378, 1700,
- -1673, -1126, 5270, 5096, -975, -1070, 1314, -2389, -2982, 20,
- -3218, -892, -636, -876, -302, -2923, -3240, 4121, 1625, -557,
- 994, 544, 2657, 7133, -273, -3530, -1419, 1431, -936, -2622,
- 303, 75, -5444, -5549, 4183, 1248, 3474, -789, 2375, -1778,
- 1660, 1520, -1433, -4047, 531, 7001, 695, 1889, 4261, -2791,
- -1557, -2980, -316, 415, 1134, 1501, -6923, 521, -3134, -1812,
- 1848, 676, -1733, 734, 2207, 2029, -476, -1976, -161, 29,
- 7147, -1774, 720, -1070, -372, -1626, -6473, -2448, -5235, -2651,
- -1800, -1477, -767, 1335, 471, 4857, 888, 593, -370, 196,
- 907, 174, 557, -720, -1339, 1590, 37, -1247, -1307, 276,
- -1739, -6032, -3088, -2499, -497, -393, -569, 3003, 2694, 3751,
- 4652, -258, -1305, 175, 189, -344, -2381, -1992, 463, 529,
- -6375, 3966, -3558, -3001, -640, 3117, 1120, 966, 1316, -561,
- 27, 2794, 2831, 3512, 3453, -418, -2319, -6741, -3443, 80,
- 1281, 1691, 1500, -591, -739, 2385, -4676, -5822, -1437, 730,
- 3593, -437, 1090, 3497, -1932, 2854, 4858, 2654, 947, 1879,
- -4115, 2700, -3092, -1524, 225, -8272, -6736, -1277, 2991, 2983,
- 1129, -1661, 2817, 468, 491, -744, 390, 677, 8129, -3130,
- -687, -433, 1488, -3763, -177, -581, -764, 39, 1537, -2203,
- -1678, 263, -1214, 2175, -1857, 3097, -894, 4207, -1943, -834,
- 1513, -4123, 3981, 6041, 653, -757, -313, -3024, -4614, -3139,
- -2966, 178, 4956, -427, -41, 2376, 1008, -1351, -92, 978,
- 1998, 5146, 2069, 117, -1754, -2756, 4425, 168, -1807, -1761,
- -1215, 178, -1562, -3369, -919, -2576, 3614, 4968, -30, -396,
- -1151, -1146, 868, 1073, -359, 2732, 546, 4431, -321, -1081,
- 1410, -3214, -2316, -4889, -2460, -3844, -7323, -1438, -1488, 1849,
- 4037, 2421, 2697, -2372, -1877, 670, 3674, -907, 888, -3703,
- 375, -1278, -1477, 2501, -936, -1682, -1353, -335, -4440, 383,
- -2730, -2130, -1105, 1588, 3340, 4816, -4023, 502, -4146, 236,
- 4481, 589, -3696, 826, -97, 222, -8037, -2244, 142, 810,
- -2195, 1315, 656, 1901, -485, 317, 1512, 1465, -2026, 1853,
- 929, 1670, -2736, -463, -836, -4946, -134, 2769, 2972, -5148,
- -3147, 913, -1483, 267, -1560, 3903, 1507, 1105, -1496, 210,
- -1196, 3764, 601, 1630, 3842, 6374, -1293, -4555, -3087, 199,
- -1917, -3331, -2317, -1774, 479, 3712, 2729, 1309, -3047, -514,
- 861, -213, 1317, -2035, 4369, 5228, 942, -3052, -2316, -3377,
- 1123, -65, 2507, 2711, -2096, -2164, -2634, -5215, -3919, 1551,
- -47, 1990, 2370, 2025, -2401, 4833, -3879, -162, -3081, 501,
- -510, 2744, -907, 253, -1746, -2520, 3418, -1461, 2140, 2507,
- 135, 1457, 3195, -1277, -2558, -66, 10850, -1633, -1051, -3436,
- -1617, 1438, -1231, -1744, 696, -348, 3434, 2121, -1629, -2460,
- -4065, 1159, -1288, 2843, 697, -862, 4, 966, -444, -1860,
- 1450, 6426, 5544, 1456, -2826, -1303, -2778, -1278, -6656, -3241,
- -7083, 2234, 204, 1753, 803, 499, 1641, 87, 1471, -1325,
- 398, 2983, 4340, -1382, 735, -600, -4671, -254, 2327, -1008,
- -144, -1453, -1806, -1669, 395, -3285, -1803, -2119, 1232, 2914,
- 1480, 8610, 1788, 2644, 1359, 3783, -110, -1339, -1337, -3427,
- -630, -1189, -2560, 976, 483, -2744, -3653, -1289, 2910, -2437,
- 3171, 1479, 157, 823, 4631, -1910, 3736, -424, -155, -5470,
- -741, 3829, -2794, -55, -1447, -3469, -1947, 2914, -61, -3430,
- 3544, -1867, 2986, 1009, -1051, 725, 2933, 2926, 5849, 257,
- -2666, 6286, -2282, -2998, -2576, -975, -3655, -1867, -5040, -1440,
- 3542, -603, 4806, -2808, -1633, 1388, 1149, -1616, -1851, 2122,
- 4477, 2485, 1376, 721, 2174, -3072, 1378, -2574, -37, 1322,
- -1646, -3612, 4443, 1612, -3403, 711, 132, 119, -227, 5059,
- 2892, 840, 5462, -3471, -1340, 2097, 143, 1750, -3052, -1932,
- -6352, -4166, -645, 4317, 633, 3681, 2811, 2346, 2374, -2999,
- -1265, -210, 5115, 4652, 1305, 3704, -1456, -307, -457, -1455,
- -3580, 674, 2215, 2458, -3021, -66, 2535, -652, 1226, 685,
- 875, -1753, -1164, -609, 3444, 563, 3826, 1607, 3798, 1385,
- 3902, -1990, -4078, -2509
-};
-
-const Word16 AmpCB1_NB_fx[640] =
-{//Q13
- -1355, 185, -222, -221, 1976, 3119, 540, 1333, -3646, -2511,
- -979, 1664, 2087, 951, 787, -1687, -855, 1594, 1264, -4990,
- -1957, -215, -850, 1369, -113, 2541, -2904, 743, 634, -657,
- -3438, -2047, 706, 85, -596, -50, 212, 944, 118, 1380,
- -1203, -78, -213, -1811, -781, -1970, 6607, -2971, 147, -1483,
- 38, 5607, 5222, -4567, -4040, -2259, -3110, -2120, 932, -236,
- -1052, 1039, -872, 334, -919, 2761, 3320, -5828, 53, 1063,
- -1064, -75, -1015, -2137, -722, 565, 629, 1961, -454, 866,
- -888, 2652, 1996, -2170, -885, 3325, -645, -1898, -984, -643,
- -1008, 2472, 2400, -3708, -2408, -1051, 2029, 1357, -636, -470,
- -1307, 655, 663, 29, 892, -95, -91, -2966, -1610, 2657,
- -2175, -3170, -3799, -3065, 1130, 1351, 3814, 2791, 1478, 1520,
- -1326, -520, -692, 899, 1979, -397, -407, 450, -569, -611,
- -1228, 864, 2549, 3067, -2511, -4737, -2701, -304, 680, 1426,
- -1070, -19, -1582, -2813, -1832, 3010, 250, -613, 3390, -171,
- -1450, -417, -773, -651, -405, -2304, -780, 6656, -3270, -1322,
- 70, 5105, 3202, -83, -925, -458, 1203, -1582, -4158, -3630,
- -1702, -849, -55, -986, -1963, -1140, -1942, 3347, 3526, -435,
- -1429, -2089, -1620, -1271, 2851, 2184, -2472, 3216, 2885, -2922,
- -1217, 86, -186, -279, -746, 1288, 3016, -651, -2719, 317,
- -1307, -127, -1110, 1389, 212, 1783, 2619, -1718, 1795, -4086,
- -1295, 743, 301, -1823, -223, -651, -1774, -405, 1687, 2031,
- -865, 1059, -391, 505, -2739, -2773, 16, -2960, 3071, 3325,
- -791, 2301, 435, 107, -4039, 801, -1224, 1854, -1039, 507,
- -518, 997, 837, 3311, 506, 1026, -232, -1920, -3904, 406,
- -1857, -529, -776, -700, -663, -1520, 1699, 814, 2084, -477,
- -1341, -1123, -2564, -2784, 2457, 3223, -959, 385, -1864, 3754,
- -1351, -1347, -2229, -2882, -1061, -1499, -3028, 3302, 2250, 5539,
- -957, -340, 27, 1508, 167, -3513, 1689, 2577, -1810, -516,
- -1061, 2171, 1774, 2031, 923, -1933, -1640, -2881, 859, -834,
- 408, 2462, 2073, 2107, -2671, 1140, -3497, -2497, 2984, -2707,
- -1762, -2524, -2196, 279, -2580, 477, 2306, 4645, 693, -909,
- -1089, 1952, 3034, -1790, 786, -1149, -3117, 3605, -1933, -1886,
- -959, 934, 246, -2177, -2440, 1356, 871, 3472, 2558, -4512,
- -782, 1262, 893, 1979, 2386, -1809, -4357, -392, -1928, 1576,
- -1751, -327, -1018, -617, -2370, -2910, 4230, -90, -1361, 3596,
- -1069, -315, -162, -339, -313, 33, 4684, 2811, -2717, -3684,
- 695, 4567, -745, -2311, -776, -2600, -827, -1040, -997, 2480,
- -1549, -748, -622, -260, 1460, 1116, -302, -2529, 2156, -42,
- -1318, -568, -266, -446, -2212, 2690, -4669, 5325, -2022, 1358,
- -1312, 2293, 1528, 706, 970, -291, 383, -683, -1532, -1843,
- -1379, 845, 1218, 395, -1884, 14, 676, -1711, 795, 290,
- -742, 386, -435, 411, 1311, 549, -4181, -4922, 1497, 4465,
- -1722, -699, -1958, -4126, -3727, -655, 1553, 1793, 4933, 3055,
- -1260, -618, 535, -2008, 3802, -3784, 2527, -833, 193, -1062,
- -866, 823, 1562, 147, -623, -1808, -1099, 694, -577, 745,
- -2282, -4139, -3171, 76, 25, -1077, 477, 545, 6081, 3244,
- -1332, -785, 98, -1681, -3603, -3937, 524, 4648, 1114, 2547,
- -1145, 407, 2030, 3120, -1739, -513, -518, 1325, -1700, -2860,
- -1427, 520, -1040, -792, -366, -2174, -522, -240, 5660, -3163,
- -1449, -1653, -1507, 581, 1338, -2627, -1863, 1831, 1301, 2106,
- -1252, 974, 199, 68, -69, -869, 864, 2373, -5818, 2873,
- 26, 972, 359, -561, -390, 376, 225, 517, 649, -1767,
- -653, 2167, 882, -698, 214, -4084, -4134, 2092, 2798, -523,
- -1002, 486, 648, -1082, 404, -1490, 1560, -4984, 5614, -1441,
- -1024, -311, 427, 356, -2342, 215, -2312, 445, -2378, 5111,
- -568, 85, 1328, 1847, 3506, 1183, -2521, -2070, -794, -1881,
- -485, 1121, 1242, 1301, -4365, -2222, 2602, -387, 1498, -1344,
- -1272, -1365, -2207, -213, -1877, 2858, 849, -915, 333, 2488,
- -2019, -2048, -1461, -1930, -1409, -400, 490, -2222, 1276, 7305,
- -1530, -1741, -2663, 3159, 1162, -1490, 1516, -1498, 1222, 838,
- 1325, 5387, 3888, 1944, -1706, -2890, -1905, -3901, -3207, 206,
- -1411, -959, -292, -396, -1547, -84, -4405, -1073, 5532, 1796,
- 3160, 48, -2339, -5884, -184, -52, 129, 5398, 378, -321
-};
-
-const Word16 AmpCB2_NB_fx[64 * (NUM_ERB_NB - 13)] =
-{//Q13
- -2681, -4389, -4270, -4727, -239, 1938, 1748, 2311, 4300, -3957,
- -1299, 3487, 1595, -377, 295, -1193, -1588, 2112, -1573, -6362,
- -504, 1796, -2521, -68, 1322, 1223, 2263, -503, -3906, 3686,
- -3899, -139, 2086, 48, 349, 547, -6387, 1340, -1467, -1062,
- -193, 1325, -1190, 2394, 1671, -1982, -2597, -390, -1504, 2271,
- -379, -2350, 4071, 70, -955, -883, -1770, -1065, -2443, -1779,
- -1101, -661, 6325, 1871, -2673, 3596, 3773, -681, 3340, -1418,
- 701, -4253, -3931, -1840, -2388, -2677, -3545, -41, 3675, 3843,
- 2198, -1713, -324, 599, 1323, 1827, -4909, -1668, 616, 2608,
- 360, -1769, -5263, -1278, 3490, 1935, 1355, -1298, 952, 1801,
- 449, 251, -1021, -3666, 479, 3497, 1542, -2234, -3414, -4483,
- -5785, 1406, 1207, 2984, 1767, 3262, -799, -3124, 5237, 460,
- 2007, -1525, -2106, -770, 546, 137, 401, -1308, 969, 204,
- -1626, -589, -4257, 1744, 2836, 2383, 2740, -423, 3166, 1920,
- -690, -3000, -4489, 2523, -6693, -5135, -739, -1919, 1228, 2354,
- 3340, 1902, 1069, -3185, -2614, 2764, -212, -2061, -1377, 698,
- 3694, -125, -954, -4132, -404, 4297, 1294, 1765, 2446, -2287,
- -1387, -14, 508, 1149, 9, -437, 519, -420, 450, -751,
- -1632, -1391, -2208, -1955, -1170, 4818, 1112, 1086, -782, 1337,
- 846, -3434, 569, 1721, -776, -2723, 1207, 982, -1432, -887,
- 315, -3031, 3452, 765, -1263, -2146, 2959, -2619, 1507, 1312,
- 4087, 3125, 1637, -1402, -45, -3193, 1397, -2611, -3641, -2478,
- -1706, 588, 199, 3721, 1217, -1249, -1196, 7228, 996, 879,
- -1339, 11, -971, -1680, 716, -39, 233, 1945, 1548, -1476,
- 550, -2277, 307, 7413, 2094, -1631, -569, -1351, -198, -483,
- -515, -1347, -212, -2649, -519, 195, 2944, -795, 1470, 654,
- -1448, 3156, 1369, 3966, 3382, -2782, -4255, -1157, -212, 392,
- 861, 5064, 4740, -2513, -3413, -552, -2298, -575, 1130, 1178,
- 1568, 4591, 1238, 367, 1626, 600, -5889, 163, -3742, -3650,
- -3911, 716, 919, -1501, 55, 1807, 3801, -5571, -4635, 1225,
- 3211, 3804, 1491, -906, 100, 404, -1742, -1878, -2140, 1651,
- 1640, 3976, -3432, -1149, 1365, 2042, 392, 768, -1534, 1096,
- 3811, -211, -2067, -1315, -4167, 1145, -2747, -149, 5296, -735,
- 438, 56, -404, -159, -2164, -959, 3492, -690, -688, -1081,
- 2762, -1191, 654, 2051, -2144, -3210, -1823, 743, 686, -751,
- 2483, 160, 1279, 3246, 1874, 2488, 1192, -5977, -478, 120,
- -349, -65, -2350, -222, -1678, -3584, 1114, 3269, 1462, -1114,
- -138, 2360, -2762, 720, -3822, 2523, 216, 1170, 4398, -4229,
- -1850, 1272, 383, 1736, -383, -1295, 85, -132, 1133, 1505,
- 1467, -2389, -2175, 4028, -2752, 241, -4353, -2103, -562, 817,
- 3959, 5471, 1941, -1598, -2349, 201, 1412, -796, 2791, -4226,
- 3227, -1992, -159, -159, 4085, -1549, 1020, -2179, -776, -2088,
- -147, -42, 1880, -1029, 4982, -2056, 111, 1420, 2141, 302,
- -2574, -986, -477, -3697, -2349, -2064, -335, -220, 5857, 57,
- -7, -5407, -546, -353, 2866, 137, -136, 3508, 992, -2059,
- -2034, -1127, -189, -300, -2153, 3606, 2523, -3727, 1526, -3797,
- 2134, 4352, -920, -459, 2722, 1784, -71, -3030, -877, 1967,
- -1645, -4432, 512, 39, 1757, 2875, -947, 1842, 1365, 1500,
- 851, 594, -2892, -404, 3327, -3078, -1575, -1258, -973, -191,
- -390, 45, 627, -227, 1624, -143, 215, 2157, 4846, 5335,
- 3397, -199, -4443, -3091, -283, -216, 1237, -1478, -5639, -775,
- 525, 2107, 2469, 2934, -255, 2438, 824, 5973, -1820, -1330,
- -1202, -2433, 900, 650, -5654, 2891, -1539, -453, 1662, 231,
- -145, 1661, 741, -332, 1221, 1809, 943, 4831, -1588, -4619,
- 65, -790, -985, -893, 3374, 3148, 289, 2947, -4980, -661,
- -427, 1441, 7696, 158, -1914, -2069, -1717, -418, 2657, 4219,
- 1505, -1096, 601, -1466, -1754, -479, -159, 3378, 5252, 5060,
- 4001, 1301, 420, -1268, -2813, -4196
-};
-
-const Word16 PowerCB_WB_fx[128] = /* Q11 */
-{
- -3371, -1712,
- -170, 350,
- -638, -939,
- 56, 1074,
- -1559, -626,
- 200, 344,
- -397, 238,
- 284, 1415,
- -1323, -1880,
- -544, 1170,
- -619, -255,
- 587, 974,
- -1262, -98,
- 327, 151,
- 41, -302,
- 941, 1876,
- -2257, -1233,
- 28, 202,
- -520, -561,
- 338, 1048,
- -1080, -495,
- 190, 582,
- -284, -24,
- 578, 1585,
- -1324, -1089,
- -71, 568,
- -471, -26,
- 1140, 909,
- -856, -128,
- 425, 740,
- 140, 12,
- 1595, 1891,
- -2176, -2310,
- -308, 541,
- -315, -859,
- -80, 1314,
- -1782, 510,
- 403, 450,
- -607, 582,
- 145, 1837,
- -920, -1386,
- -225, 872,
- -395, -258,
- 829, 981,
- -945, 345,
- 643, 241,
- -56, -23,
- 1211, 1482,
- -1793, -1459,
- 40, 400,
- -239, -471,
- 532, 1238,
- -774, -516,
- 244, 831,
- -157, 152,
- 576, 2287,
- -928, -844,
- 41, 759,
- -161, -198,
- 873, 1353,
- -640, 105,
- 695, 623,
- 364, -184,
- 1238, 2446
-};
-
-const Word16 PowerCB_NB_fx[128] = /* Q11 */
-{
- -3349, -2784,
- -784, 385,
- -891, -562,
- 126, 915,
- -1518, -1438,
- 304, 53,
- -314, -447,
- 687, 1219,
- -2585, -1807,
- -65, 153,
- -1219, -337,
- 497, 700,
- -894, -1051,
- 161, 451,
- -46, -516,
- 987, 1519,
- -2277, -2303,
- -354, 445,
- -532, -540,
- 5, 1271,
- -1047, -1433,
- 672, -225,
- -335, -75,
- 1007, 1056,
- -1362, -1879,
- -93, 367,
- -468, -259,
- 1800, -290,
- -1118, -793,
- 412, 472,
- -9, -197,
- 1471, 1634,
- -2627, -2847,
- -269, 164,
- -689, -373,
- 432, 940,
- -1601, -839,
- 311, 271,
- -212, -251,
- 543, 1714,
- -2014, -1336,
- 109, 241,
- -789, -110,
- 729, 888,
- -418, -1277,
- 256, 674,
- 218, -217,
- 1027, 2065,
- -1769, -2293,
- -276, 853,
- -360, -764,
- 376, 1247,
- -1274, -1122,
- 602, 272,
- -133, -32,
- 1374, 1118,
- -1860, -1795,
- -23, 620,
- -525, 60,
- 1070, 548,
- -691, -799,
- 701, 572,
- 81, 18,
- 1949, 2120
-};
-
-
-const Word16 sinc_fx[8][12] = /* sinc for warp/extrapolate, in Q14 */
-{
- {0,0,0,0,0,16384,0,0,0,0,0,0,},
- {-388,484,-638,939,-1773,15966,2281,-1063,694,-514,409,-339,},
- {-701,868,-1134,1639,-2949,14751,4917,-2106,1341,-982,776,-640,},
- {-895,1101,-1427,2029,-3503,12849,7709,-2964,1835,-1328,1042,-856,},
- {-947,1159,-1489,2086,-3476,10430,10430,-3476,2086,-1489,1159,-947,},
- {-856,1042,-1328,1835,-2964,7709,12849,-3503,2029,-1427,1101,-895,},
- {-640,776,-982,1341,-2106,4917,14751,-2949,1639,-1134,868,-701,},
- {-339,409,-514,694,-1063,2281,15966,-1773,939,-638,484,-388,},
-};
-/*----------------------------------------------------------------------------------*
- * Highrate SWB BWE tables
- *----------------------------------------------------------------------------------*/
-const Word16 overlap_coefs_48kHz_fx[NSV_OVERLAP*WIDTH_BAND] = /* in Q15 */
-{
- 9830, 11141, 11796, 12780, 13763, 14418, 15073, 15565, 16056, 16712, 17695, 18678, 20316, 23593, 27197, 31130
-};
-
-const Word16 overlap_coefs_fx[NSV_OVERLAP*WIDTH_BAND] = /* in Q15 */
-{
- 8847, 10027, 10617, 11502, 12386, 12976, 13566, 14008, 14451, 15041, 15925, 16810, 18285, 21234, 24478, 28017
-};
-
-
-const Word16 swb_hr_env_code1_fx[NUM_ENVLOPE_CODE_HR1 * 2] = /* in Q9 */
-{
- 23, 21, 268, 240, 344, 310, 504, 438,
- 629, 580, 856, 734, 1305, 1209, 1637, 1693,
- 1321, 2671, 2154, 3709, 1801, 890, 2243, 1410,
- 2436, 2404, 3496, 3127, 2279, 5187, 3715, 6394,
- 3435, 1000, 3381, 1894, 5434, 1299, 4806, 2171,
- 3645, 4240, 4640, 3628, 4567, 4999, 5785, 6023,
- 6032, 3010, 7194, 4949, 5735, 4609, 7391, 6777,
- 7341, 1999, 10276, 2220, 9270, 4210, 11444, 4917,
- 3708, 8481, 6030, 9814, 5694, 7913, 7457, 8888,
- 9124, 6090, 8943, 7832, 10925, 6889, 10519, 8768,
- 4637, 11437, 5754, 14762, 6791, 12873, 8317, 14468,
- 7818, 11028, 8696, 12646, 10031, 11617, 10315, 13255,
- 9112, 9960, 10901, 10336, 12338, 9772, 12090, 11543,
- 12125, 8360, 13766, 9934, 13317, 8004, 14817, 8315,
- 12848, 6332, 14189, 6791, 14505, 5289, 15684, 6580,
- 12940, 3143, 14948, 3698, 16472, 2570, 16373, 4851
-};
-
-const Word16 swb_hr_env_code2_fx[NUM_ENVLOPE_CODE_HR2 * 2] = /* in Q9 */
-{
- 262, 242, 686, 568, 1303, 901, 1600, 1559,
- 2505, 1905, 2053, 2944, 2617, 1108, 3414, 1993,
- 4329, 1409, 5695, 1801, 3391, 3052, 4384, 2562,
- 4567, 3985, 5509, 3051, 6374, 4280, 7003, 5750,
- 7000, 2794, 8434, 2006, 10706, 3294, 13034, 4412,
- 8402, 3878, 9510, 5269, 11309, 6406, 10839, 8811,
- 2701, 4927, 4656, 5773, 6116, 7956, 8474, 7704,
- 3255, 8984, 6818, 11144, 3915, 13367, 1255, 16350
-};
-
-const Word16 swb_hr_env_code3_fx[NUM_ENVLOPE_CODE_HR_TR*N_BANDS_TRANS_BWE_HR] = /* in Q9 */
-{
- 409, 347, 898, 622, 1457, 1033, 2242, 1012,
- 3039, 1508, 2017, 2161, 4137, 1348, 3881, 2553,
- 2538, 5306, 3962, 4430, 4730, 3610, 5225, 2877,
- 5450, 2240, 5970, 1779, 5553, 1364, 6003, 838
-};
-const Word32 thren_HQ_fx[39] =
-{//Q14
- 1805811328,
- 1276901376,
- 902905664,
- 638450688,
- 451452832,
- 319225344,
- 225726416,
- 159612672,
- 112863208,
- 79806336,
- 56431604,
- 39903168,
- 28215802,
- 19951584,
- 14107901,
- 9975792,
- 7053950,
- 4987896,
- 3526975,
- 2493948,
- 1763487,
- 1246974,
- 881743,
- 623487,
- 440871,
- 311743,
- 220435,
- 155871,
- 110217,
- 77935,
- 55108,
- 38967,
- 27554,
- 19483,
- 13777,
- 9741,
- 6888,
- 4870,
- 3444,
-};
-
-/*----------------------------------------------------------------------------------*
- * ACELP/HQ core switching
- *----------------------------------------------------------------------------------*/
-
-/* short filters for BWE of ACELP->HQ switching frame */
-const Word16 hp12800_16000_fx[21] =
-{//Q15
- -0, 70, -207, 380, -405, 0, 1041, -2668, 4505,
- -5968, 6526, -5968, 4505, -2668, 1041, 0, -405, 380,
- -207, 70, -0
-};
-
-const Word16 hp12800_32000_fx[41] =
-{//Q15
- -0, 45, 35, -47, -104, 0, 191, 156,
- -203, -422, -0, 675, 523, -656, -1341, 0,
- 2264, 1943, -2999, -9872, 19678, -9872, -2999, 1943,
- 2264, 0, -1341, -656, 523, 675, -0, -422,
- -203, 156, 191, 0, -104, -47, 35, 45, -0
-};
-
-const Word16 hp12800_48000_fx[61] =//Q15
-{
- -0, 22, 33, 23, -10, -51, -69, -37, 45, 127,
- 140, 40, -136, -271, -238, 0, 326, 507, 349, -143,
- -696, -894, -450, 535, 1509, 1696, 521, -1998, -5136, -7735,
- 24039, -7735, -5136, -1998, 521, 1696, 1509, 535, -450, -894,
- -696, -143, 349, 507, 326, 0, -238, -271, -136, 40,
- 140, 127, 45, -37, -69, -51, -10, 23, 33, 22, -0,
-};
-
-const Word16 hp16000_32000_fx[33] =//Q15
-{
- -0, 62, -0, -127, -0, 270, -0, -523, -0, 940,
- -0, -1662, -0, 3212, -0, -10353, 16407, -10353, -0, 3212,
- -0, -1662, -0, 940, -0, -523, -0, 270, -0, -127,
- -0, 62, -0
-};
-
-const Word16 hp16000_48000_fx[49] =//Q15
-{
- -0, 33, 39, -0, -64, -83, -0, 138, 175, 0,
- -272, -334, -0, 493, 596, 0, -870, -1059, -0, 1636,
- 2120, 0, -4448, -9003, 21858, -9003, -4448, 0, 2120, 1636,
- -0, -1059, -870, 0, 596, 493, -0, -334, -272, 0,
- 175, 138, -0, -83, -64, -0, 39, 33, -0
-};
-
-const Word16 ct2[7][13] =
-{
- /* accepted configurations */
- /*input 12.8, output :*/
- /*8*/ {30, 22, 30, 16, 25, 30, 19, 30, 30, 0, 8, 4, 15},
- /*16*/ {25, 22, 19, 16, 16, 0, 0, 0, 12, 1, 4, 4, 15},
- /*32*/ {19, 16, 19, 16, 16, 0, 0, 0, 6, 2, 2, 4, 15},
- /*48*/ {17, 14, 15, 16, 16, 0, 0, 0, 4, 3, 4, 4, 15},
-
- /*input 16, output :*/
- /*12*/ { 9, 3, 4, 5, 9, 0, 0, 0, 5, 0, 5, 5, 4},
- /*32*/ { 4, 4, 4, 4, 4, 0, 0, 0, 2, 1, 1, 4, 4},
- /*48*/ {18, 18, 18, 18, 18, 0, 0, 0, 5, 2, 1, 4, 15},
-}; // Q0
-const Word16 ct2_fx[7][14] =
-{
- /* accepted configurations */
- /*input 12.8, output : fout/fin Q13*/
- /*8*/ {30, 22, 30, 16, 25, 30, 19, 30, 30, 0, 8, 4, 15, 5120},
- /*16*/ {25, 22, 19, 16, 16, 0, 0, 0, 12, 1, 4, 4, 15, 10240},
- /*32*/ {19, 16, 19, 16, 16, 0, 0, 0, 6, 2, 2, 4, 15, 20480},
- /*48*/ {17, 14, 15, 16, 16, 0, 0, 0, 4, 3, 4, 4, 15, 30720},
-
- /*input 16, output :*/
- /*12*/ { 9, 3, 4, 5, 9, 0, 0, 0, 5, 0, 5, 5, 4, 6554},
- /*32*/ { 4, 4, 4, 4, 4, 0, 0, 0, 2, 1, 1, 4, 4, 16384},
- /*48*/ {18, 18, 18, 18, 18, 0, 0, 0, 5, 2, 1, 4, 15, 24576},
-};
-
-const Word16 cu15_fx[28][3] = /*Q13*/
-{
- /* xx/3, xx*xx/3, xx*xx*xx/3 xx v */
- /* 0:*/ { 182, 12, 1 }, /* 1/15 */
- /* 1:*/ { 364, 49, 6 }, /* 2/15 */
- /* 2:*/ { 546, 109, 22 }, /* 3/15 */
- /* 3:*/ { 728, 194, 52 }, /* 4/15 */
- /* 4:*/ { 910, 303, 101 }, /* 5/15 */
- /* 5:*/ { 1092, 437, 175 }, /* 6/15 */
- /* 6:*/ { 1274, 595, 278 }, /* 7/15 */
- /* 7:*/ { 1456, 777, 414 }, /* 8/15 */
- /* 8:*/ { 1638, 983, 590 }, /* 9/15 */
- /* 9:*/ { 1820, 1214, 809 }, /* 10/15 */
- /*10:*/ { 2002, 1468, 1077 }, /* 11/15 */
- /*11:*/ { 2185, 1748, 1398 }, /* 12/15 */
- /*12:*/ { 2367, 2051, 1778 }, /* 13/15 */
- /*13:*/ { 2549, 2379, 2220 }, /* 14/15 */
- /*14:*/ { 2913, 3107, 3314 }, /* 16/15 */
- /*15:*/ { 3095, 3507, 3975 }, /* 17/15 */
- /*16:*/ { 3277, 3932, 4719 }, /* 18/15 */
- /*17:*/ { 3459, 4381, 5550 }, /* 19/15 */
- /*18:*/ { 3641, 4855, 6473 }, /* 20/15 */
- /*19:*/ { 3823, 5352, 7493 }, /* 21/15 */
- /*20:*/ { 4005, 5874, 8615 }, /* 22/15 */
- /*21:*/ { 4187, 6420, 9844 }, /* 23/15 */
- /*22:*/ { 4369, 6991, 11185 }, /* 24/15 */
- /*23:*/ { 4551, 7585, 12642 }, /* 25/15 */
- /*24:*/ { 4733, 8204, 14221 }, /* 26/15 */
- /*25:*/ { 4915, 8847, 15925 }, /* 27/15 */
- /*26:*/ { 5097, 9515, 17761 }, /* 28/15 */
- /*27:*/ { 5279, 10207, 19733 }, /* 29/15 */
-};
-
-const Word16 cu4_fx[6][3] = /*Q13*/
-{
- /* xx/3, xx*xx/3, xx*xx*xx/3 xx v */
- /* 0:*/ { 683, 171, 43 }, /* 1/4 */
- /* 1:*/ { 1365, 683, 341 }, /* 2/4 */
- /* 2:*/ { 2048, 1536, 1152 }, /* 3/4 */
- /* 3:*/ { 3413, 4267, 5333 }, /* 5/4 */
- /* 4:*/ { 4096, 6144, 9216 }, /* 6/4 */
- /* 5:*/ { 4779, 8363, 14635 }, /* 7/4 */
-};
-
-
-/*----------------------------------------------------------------------------------*
- * hp filter for filtering random part of excitation in frame error concealment
- * Used in lib_dec\syn_bfi.c
- *----------------------------------------------------------------------------------*/
-
-const Word16 h_high_fx[5] = { -410, -3572, 25602, -3572, -410 };//Q15
-
-const Word16 sincos_t_rad3_fx[T_SIN_PI_2 + 1] =
-{//Q15
- 0, 134, 268, 402, 536, 670, 804, 938,
- 1072, 1206, 1340, 1474, 1608, 1742, 1876, 2009,
- 2143, 2277, 2411, 2544, 2678, 2811, 2945, 3078,
- 3212, 3345, 3479, 3612, 3745, 3878, 4011, 4144,
- 4277, 4410, 4543, 4675, 4808, 4941, 5073, 5205,
- 5338, 5470, 5602, 5734, 5866, 5998, 6130, 6261,
- 6393, 6524, 6655, 6787, 6918, 7049, 7180, 7310,
- 7441, 7571, 7702, 7832, 7962, 8092, 8222, 8351,
- 8481, 8610, 8740, 8869, 8998, 9127, 9255, 9384,
- 9512, 9640, 9768, 9896, 10024, 10151, 10279, 10406,
- 10533, 10660, 10786, 10913, 11039, 11165, 11291, 11417,
- 11543, 11668, 11793, 11918, 12043, 12167, 12292, 12416,
- 12540, 12664, 12787, 12910, 13033, 13156, 13279, 13401,
- 13524, 13646, 13767, 13889, 14010, 14131, 14252, 14373,
- 14493, 14613, 14733, 14852, 14972, 15091, 15210, 15328,
- 15447, 15565, 15683, 15800, 15917, 16035, 16151, 16268,
- 16384, 16500, 16616, 16731, 16846, 16961, 17075, 17190,
- 17304, 17417, 17531, 17644, 17757, 17869, 17981, 18093,
- 18205, 18316, 18427, 18538, 18648, 18758, 18868, 18978,
- 19087, 19195, 19304, 19412, 19520, 19627, 19735, 19841,
- 19948, 20054, 20160, 20265, 20371, 20475, 20580, 20684,
- 20788, 20891, 20994, 21097, 21199, 21301, 21403, 21504,
- 21605, 21706, 21806, 21906, 22006, 22105, 22204, 22302,
- 22400, 22498, 22595, 22692, 22788, 22884, 22980, 23076,
- 23170, 23265, 23359, 23453, 23546, 23640, 23732, 23824,
- 23916, 24008, 24099, 24189, 24279, 24369, 24459, 24548,
- 24636, 24724, 24812, 24900, 24986, 25073, 25159, 25245,
- 25330, 25415, 25499, 25583, 25667, 25750, 25833, 25915,
- 25997, 26078, 26159, 26239, 26320, 26399, 26478, 26557,
- 26635, 26713, 26791, 26868, 26944, 27020, 27096, 27171,
- 27246, 27320, 27394, 27467, 27540, 27612, 27684, 27756,
- 27827, 27897, 27967, 28037, 28106, 28175, 28243, 28311,
- 28378, 28445, 28511, 28577, 28642, 28707, 28771, 28835,
- 28899, 28962, 29024, 29086, 29148, 29209, 29269, 29329,
- 29389, 29448, 29506, 29564, 29622, 29679, 29736, 29792,
- 29847, 29902, 29957, 30011, 30064, 30118, 30170, 30222,
- 30274, 30325, 30375, 30425, 30475, 30524, 30572, 30620,
- 30668, 30715, 30761, 30807, 30853, 30897, 30942, 30986,
- 31029, 31072, 31114, 31156, 31197, 31238, 31278, 31318,
- 31357, 31396, 31434, 31471, 31508, 31545, 31581, 31617,
- 31651, 31686, 31720, 31753, 31786, 31818, 31850, 31881,
- 31912, 31942, 31972, 32001, 32029, 32058, 32085, 32112,
- 32138, 32164, 32190, 32214, 32239, 32262, 32286, 32308,
- 32330, 32352, 32373, 32393, 32413, 32433, 32452, 32470,
- 32488, 32505, 32522, 32538, 32553, 32568, 32583, 32597,
- 32610, 32623, 32635, 32647, 32658, 32669, 32679, 32689,
- 32698, 32706, 32714, 32722, 32729, 32735, 32741, 32746,
- 32750, 32755, 32758, 32761, 32764, 32766, 32767, 32767,
- 32767
-};
-
-/*----------------------------------------------------------------------------------*
- * TCX
- *----------------------------------------------------------------------------------*/
-
-const Word16 gain_corr_fac[3] = { 0x4155, 0x40A9, 0x4055 }; /* pow(10, 2^(-n-2)/28) (1Q14) */
-const Word16 gain_corr_inv_fac[3] = { 0x7D67, 0x7EB2, 0x7F59 }; /* pow(10,-2^(-n-2)/28) (0Q15) */
-
-const Word16 inter4_2tcx2[4][4] =
-{
- { 7620/*0.2325402f Q15*/, 17528/*0.5349195f Q15*/, 7620/*0.2325402f Q15*/, 0/*0.0000000f Q15*/ },
- { 4434/*0.1353017f Q15*/, 16694/*0.5094465f Q15*/, 11141/*0.3400065f Q15*/, 500/*0.0152453f Q15*/ },
- { 1995/*0.0608774f Q15*/, 14389/*0.4391226f Q15*/, 14389/*0.4391226f Q15*/, 1995/*0.0608774f Q15*/ },
- { 500/*0.0152453f Q15*/, 11141/*0.3400065f Q15*/, 16694/*0.5094465f Q15*/, 4434/*0.1353017f Q15*/ }
-};
-const Word16 inter6_2tcx2[6][4] =
-{
- { 7345/*0.2241379f Q15*/, 18079/*0.5517241f Q15*/, 7345/*0.2241379f Q15*/, 0/*0.0000000f Q15*/ },
- { 5119/*0.1562044f Q15*/, 17657/*0.5388595f Q15*/, 9798/*0.2990011f Q15*/, 194/*0.0059349f Q15*/ },
- { 3249/*0.0991379f Q15*/, 16444/*0.5018346f Q15*/, 12288/*0.3750000f Q15*/, 787/*0.0240275f Q15*/ },
- { 1800/*0.0549361f Q15*/, 14584/*0.4450639f Q15*/, 14584/*0.4450639f Q15*/, 1800/*0.0549361f Q15*/ },
- { 787/*0.0240275f Q15*/, 12288/*0.3750000f Q15*/, 16444/*0.5018346f Q15*/, 3249/*0.0991379f Q15*/ },
- { 194/*0.0059349f Q15*/, 9798/*0.2990011f Q15*/, 17657/*0.5388595f Q15*/, 5119/*0.1562044f Q15*/ }
-};
-
-const Word16 inter_core_12_8kHz_output_8kHz[] =
-{
- 17528/*0.5349196f Q15*/, 16694/*0.5094466f Q15*/, 14389/*0.4391227f Q15*/, 11141/*0.3400065f Q15*/,
- 7620/*0.2325402f Q15*/, 4434/*0.1353016f Q15*/, 1995/*0.0608773f Q15*/, 500/*0.0152453f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_12_8kHz_output_16kHz[] =
-{
- 14023/*0.4279357f Q15*/, 13592/*0.4147958f Q15*/, 12367/*0.3774199f Q15*/, 10533/*0.3214508f Q15*/,
- 8350/*0.2548195f Q15*/, 6096/*0.1860321f Q15*/, 4017/*0.1225801f Q15*/, 2291/*0.0699165f Q15*/,
- 1023/*0.0312127f Q15*/, 256/*0.0078047f Q15*/, 0/*0.0000000f Q15*/, 0/*0.0000000f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_12_8kHz_output_32kHz[] =
-{
- 7011/*0.2139679f Q15*/, 6957/*0.2123089f Q15*/, 6796/*0.2073979f Q15*/, 6535/*0.1994284f Q15*/,
- 6184/*0.1887100f Q15*/, 5756/*0.1756491f Q15*/, 5267/*0.1607254f Q15*/, 4734/*0.1444646f Q15*/,
- 4175/*0.1274097f Q15*/, 3608/*0.1100939f Q15*/, 3048/*0.0930161f Q15*/, 2511/*0.0766219f Q15*/,
- 2008/*0.0612900f Q15*/, 1551/*0.0473253f Q15*/, 1146/*0.0349583f Q15*/, 798/*0.0243509f Q15*/,
- 511/*0.0156063f Q15*/, 288/*0.0087817f Q15*/, 128/*0.0039024f Q15*/, 32/*0.0009753f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_12_8kHz_output_48kHz[] =
-{
- 4674/*0.1426452f Q15*/, 4658/*0.1421528f Q15*/, 4610/*0.1406841f Q15*/, 4531/*0.1382653f Q15*/,
- 4422/*0.1349386f Q15*/, 4285/*0.1307618f Q15*/, 4122/*0.1258066f Q15*/, 3937/*0.1201564f Q15*/,
- 3732/*0.1139041f Q15*/, 3511/*0.1071503f Q15*/, 3277/*0.1000000f Q15*/, 3033/*0.0925607f Q15*/,
- 2783/*0.0849398f Q15*/, 2531/*0.0772420f Q15*/, 2280/*0.0695677f Q15*/, 2032/*0.0620107f Q15*/,
- 1791/*0.0546572f Q15*/, 1559/*0.0475844f Q15*/, 1339/*0.0408600f Q15*/, 1132/*0.0345417f Q15*/,
- 940/*0.0286774f Q15*/, 764/*0.0233055f Q15*/, 605/*0.0184558f Q15*/, 464/*0.0141503f Q15*/,
- 341/*0.0104042f Q15*/, 237/*0.0072274f Q15*/, 152/*0.0046257f Q15*/, 85/*0.0026016f Q15*/,
- 38/*0.0011560f Q15*/, 9/*0.0002890f Q15*/, 0/*0.0000000f Q15*/, 0/*0.0000000f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_16kHz_output_8kHz[] =
-{
- 18079/*0.5517241f Q15*/, 17657/*0.5388595f Q15*/, 16444/*0.5018346f Q15*/, 14584/*0.4450639f Q15*/, 12288/*0.3750000f Q15*/, 9798/*0.2990011f Q15*/,
- 7345/*0.2241379f Q15*/, 5119/*0.1562044f Q15*/, 3249/*0.0991379f Q15*/, 1800/*0.0549361f Q15*/, 787/*0.0240275f Q15*/, 194/*0.0059349f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_16kHz_output_16kHz[] =
-{
- 18079/*0.5517241f Q15*/, 17657/*0.5388595f Q15*/, 16444/*0.5018346f Q15*/, 14584/*0.4450639f Q15*/, 12288/*0.3750000f Q15*/, 9798/*0.2990011f Q15*/,
- 7345/*0.2241379f Q15*/, 5119/*0.1562044f Q15*/, 3249/*0.0991379f Q15*/, 1800/*0.0549361f Q15*/, 787/*0.0240275f Q15*/, 194/*0.0059349f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_16kHz_output_32kHz[] =
-{
- 9039/*0.2758621f Q15*/, 8986/*0.2742414f Q15*/, 8829/*0.2694298f Q15*/, 8571/*0.2615753f Q15*/, 8222/*0.2509173f Q15*/, 7791/*0.2377748f Q15*/,
- 7292/*0.2225320f Q15*/, 6738/*0.2056203f Q15*/, 6144/*0.1875000f Q15*/, 5526/*0.1686403f Q15*/, 4899/*0.1495006f Q15*/, 4277/*0.1305132f Q15*/,
- 3672/*0.1120690f Q15*/, 3097/*0.0945060f Q15*/, 2559/*0.0781022f Q15*/, 2067/*0.0630725f Q15*/, 1624/*0.0495690f Q15*/, 1235/*0.0376861f Q15*/,
- 900/*0.0274680f Q15*/, 620/*0.0189188f Q15*/, 394/*0.0120137f Q15*/, 220/*0.0067120f Q15*/, 97/*0.0029675f Q15*/, 24/*0.0007394f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_16kHz_output_48kHz[] =
-{
- 6026/*0.1839080f Q15*/, 6011/*0.1834272f Q15*/, 5963/*0.1819912f Q15*/, 5886/*0.1796198f Q15*/, 5778/*0.1763457f Q15*/, 5643/*0.1722133f Q15*/,
- 5481/*0.1672782f Q15*/, 5296/*0.1616061f Q15*/, 5088/*0.1552712f Q15*/, 4861/*0.1483546f Q15*/, 4618/*0.1409433f Q15*/, 4362/*0.1331275f Q15*/,
- 4096/*0.1250000f Q15*/, 3823/*0.1166535f Q15*/, 3545/*0.1081796f Q15*/, 3266/*0.0996670f Q15*/, 2988/*0.0912002f Q15*/, 2715/*0.0828579f Q15*/,
- 2448/*0.0747126f Q15*/, 2190/*0.0668293f Q15*/, 1942/*0.0592649f Q15*/, 1706/*0.0520681f Q15*/, 1484/*0.0452794f Q15*/, 1276/*0.0389306f Q15*/,
- 1083/*0.0330460f Q15*/, 906/*0.0276422f Q15*/, 745/*0.0227295f Q15*/, 600/*0.0183120f Q15*/, 472/*0.0143894f Q15*/, 359/*0.0109575f Q15*/,
- 262/*0.0080092f Q15*/, 181/*0.0055360f Q15*/, 116/*0.0035286f Q15*/, 65/*0.0019783f Q15*/, 29/*0.0008771f Q15*/, 7/*0.0002189f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_25_6kHz_output_8kHz[] =
-{
- 17528/*0.5349196f Q15*/, 16694/*0.5094466f Q15*/, 14389/*0.4391227f Q15*/, 11141/*0.3400065f Q15*/,
- 7620/*0.2325402f Q15*/, 4434/*0.1353016f Q15*/, 1995/*0.0608773f Q15*/, 500/*0.0152453f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_25_6kHz_output_16kHz[] =
-{
- 17528/*0.5349196f Q15*/, 16694/*0.5094466f Q15*/, 14389/*0.4391227f Q15*/, 11141/*0.3400065f Q15*/,
- 7620/*0.2325402f Q15*/, 4434/*0.1353016f Q15*/, 1995/*0.0608773f Q15*/, 500/*0.0152453f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_25_6kHz_output_32kHz[] =
-{
- 14023/*0.4279357f Q15*/, 13592/*0.4147958f Q15*/, 12367/*0.3774199f Q15*/, 10533/*0.3214508f Q15*/,
- 8350/*0.2548195f Q15*/, 6096/*0.1860321f Q15*/, 4017/*0.1225801f Q15*/, 2291/*0.0699165f Q15*/,
- 1023/*0.0312127f Q15*/, 256/*0.0078047f Q15*/, 0/*0.0000000f Q15*/, 0/*0.0000000f Q15*/,
- 0/*0.0000000f Q15*/
-};
-const Word16 inter_core_25_6kHz_output_48kHz[] =
-{
- 9349/*0.2852965f Q15*/, 9220/*0.2813740f Q15*/, 8843/*0.2698819f Q15*/, 8245/*0.2516166f Q15*/,
- 7465/*0.2278099f Q15*/, 6554/*0.2000000f Q15*/, 5567/*0.1698781f Q15*/, 4559/*0.1391327f Q15*/,
- 3582/*0.1093111f Q15*/, 2678/*0.0817166f Q15*/, 1879/*0.0573517f Q15*/, 1209/*0.0369093f Q15*/,
- 682/*0.0208069f Q15*/, 303/*0.0092505f Q15*/, 76/*0.0023118f Q15*/, 0/*0.0000000f Q15*/,
- 0/*0.0000000f Q15*/
-};
-
-const TCX_LTP_FILTER tcxLtpFilters[12] =
-{
- { inter_core_12_8kHz_output_8kHz, 2 },
- { inter_core_12_8kHz_output_16kHz, 3 },
- { inter_core_12_8kHz_output_32kHz, 5 },
- { inter_core_12_8kHz_output_48kHz, 8 },
- { inter_core_16kHz_output_8kHz, 2 },
- { inter_core_16kHz_output_16kHz, 2 },
- { inter_core_16kHz_output_32kHz, 4 },
- { inter_core_16kHz_output_48kHz, 6 },
- { inter_core_25_6kHz_output_8kHz, 2 },
- { inter_core_25_6kHz_output_16kHz, 2 },
- { inter_core_25_6kHz_output_32kHz, 3 },
- { inter_core_25_6kHz_output_48kHz, 4 },
-};
-
-
-
-const SCALE_TCX_SETUP scaleTcxTable[SIZE_SCALE_TABLE_TCX] =
-{
- { 0, 0, 8000, /* 0.67f ,*/ 21955/*0.67f Q15*/ },
- { 0, 8000, 9600, /* 0.70f ,*/ 22938/*0.70f Q15*/ },
- { 0, 9600, 13200, /* 0.76f ,*/ 24904/*0.76f Q15*/ },
- { 0, 13200, 16400, /* 0.86f ,*/ 28180/*0.86f Q15*/ },
- { 0, 16400, 24400, /* 0.90f ,*/ 29491/*0.90f Q15*/ },
- { 0, 24400, 64000, /* 0.96f ,*/ 31457/*0.96f Q15*/ },
- { 1, 0, 8000, /* 1.f ,*/ 32767/*1.f Q15*/ },
- { 1, 8000, 9600, /* 1.f ,*/ 32767/*1.f Q15*/ },
- { 1, 9600, 13200, /* 1.f ,*/ 32767/*1.f Q15*/ },
- { 1, 13200, 16400, /* 0.85f ,*/ 27853/*0.85f Q15*/ },
- { 1, 16400, 24400, /* 0.88f ,*/ 28836/*0.88f Q15*/ },
- { 1, 24400, 32000, /* 0.90f ,*/ 29491/*0.90f Q15*/ },
- { 1, 32000, 32400, /* 0.95f ,*/ 31130/*0.95f Q15*/ },
-};
-
-
-/*----------------------------------------------------------------------------------*
- * Arithmetic coder
- *----------------------------------------------------------------------------------*/
-
-const UWord8 ari_lookup_s17_LC[4096] = // Q0
-{
- 0x01,0x04,0x29,0x13,0x0A,0x0D,0x05,0x10,
- 0x10,0x0D,0x00,0x0D,0x2A,0x2A,0x22,0x25,
- 0x25,0x28,0x2B,0x2E,0x31,0x34,0x34,0x0E,
- 0x21,0x21,0x21,0x36,0x38,0x38,0x36,0x10,
- 0x10,0x08,0x09,0x0B,0x0C,0x0E,0x0E,0x21,
- 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x10,
- 0x10,0x1A,0x09,0x1D,0x0C,0x20,0x20,0x21,
- 0x36,0x36,0x36,0x36,0x36,0x0A,0x36,0x16,
- 0x1A,0x1A,0x2D,0x0C,0x20,0x20,0x21,0x21,
- 0x21,0x36,0x38,0x38,0x38,0x38,0x36,0x16,
- 0x16,0x1A,0x3F,0x1F,0x20,0x21,0x24,0x06,
- 0x36,0x36,0x36,0x38,0x00,0x0A,0x36,0x22,
- 0x3E,0x3E,0x3F,0x30,0x20,0x21,0x06,0x06,
- 0x06,0x38,0x36,0x36,0x36,0x26,0x36,0x1C,
- 0x1C,0x3E,0x3F,0x02,0x20,0x21,0x06,0x36,
- 0x36,0x38,0x0A,0x0A,0x0A,0x0A,0x05,0x16,
- 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
- 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
- 0x16,0x3F,0x3F,0x0E,0x35,0x14,0x38,0x38,
- 0x05,0x05,0x05,0x0D,0x13,0x13,0x1C,0x16,
- 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
- 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
- 0x3F,0x3F,0x3F,0x20,0x35,0x14,0x27,0x38,
- 0x38,0x0A,0x2A,0x2A,0x2A,0x16,0x05,0x10,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x3F,0x02,0x0E,0x02,0x14,0x13,0x0A,
- 0x0D,0x0D,0x0D,0x13,0x00,0x00,0x16,0x19,
- 0x19,0x3F,0x3F,0x02,0x02,0x14,0x38,0x36,
- 0x0A,0x0A,0x0A,0x0D,0x0D,0x0D,0x1C,0x22,
- 0x22,0x3F,0x3F,0x02,0x17,0x26,0x26,0x1C,
- 0x1C,0x10,0x16,0x16,0x16,0x19,0x22,0x25,
- 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x15,0x2C,0x2E,0x2E,0x2E,0x31,
- 0x31,0x31,0x31,0x31,0x31,0x31,0x34,0x39,
- 0x39,0x39,0x15,0x2C,0x2E,0x2E,0x0C,0x34,
- 0x34,0x34,0x36,0x36,0x36,0x36,0x36,0x36,
- 0x36,0x39,0x15,0x3C,0x2E,0x31,0x34,0x34,
- 0x31,0x31,0x31,0x1F,0x1E,0x1E,0x1E,0x1E,
- 0x1E,0x39,0x28,0x2C,0x2E,0x31,0x37,0x34,
- 0x01,0x01,0x01,0x01,0x01,0x00,0x39,0x39,
- 0x39,0x39,0x39,0x2C,0x2E,0x31,0x1E,0x34,
- 0x34,0x35,0x01,0x01,0x01,0x01,0x01,0x01,
- 0x01,0x39,0x39,0x3C,0x2E,0x03,0x07,0x34,
- 0x34,0x0F,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x15,0x2B,0x31,0x1E,0x34,
- 0x34,0x01,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x2C,0x39,0x2F,0x2E,0x2E,
- 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
- 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
- 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
- 0x2E,0x39,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
- 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
- 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
- 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
- 0x1E,0x1E,0x1E,0x1E,0x1E,0x0F,0x2E,0x2E,
- 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
- 0x2E,0x2E,0x39,0x15,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
- 0x19,0x1C,0x16,0x22,0x22,0x25,0x25,0x25,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x3E,0x3E,0x2F,0x3D,0x21,0x36,0x38,0x05,
- 0x0D,0x0D,0x0D,0x10,0x16,0x16,0x16,0x25,
- 0x2D,0x2D,0x37,0x3D,0x33,0x38,0x05,0x0D,
- 0x0D,0x10,0x16,0x16,0x16,0x16,0x16,0x25,
- 0x2F,0x2F,0x30,0x12,0x06,0x05,0x0A,0x0D,
- 0x0D,0x10,0x16,0x16,0x16,0x22,0x22,0x25,
- 0x1F,0x1F,0x32,0x3B,0x29,0x0A,0x0A,0x10,
- 0x16,0x16,0x16,0x16,0x22,0x22,0x22,0x25,
- 0x02,0x02,0x14,0x29,0x05,0x0D,0x2A,0x10,
- 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
- 0x35,0x35,0x14,0x29,0x0A,0x2A,0x2A,0x10,
- 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
- 0x17,0x17,0x26,0x05,0x0D,0x10,0x10,0x16,
- 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x25,
- 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,
- 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,
- 0x26,0x26,0x26,0x1C,0x0D,0x16,0x16,0x16,
- 0x22,0x22,0x22,0x22,0x22,0x22,0x25,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x26,0x1C,0x1C,0x10,0x16,0x16,0x22,
- 0x22,0x22,0x22,0x22,0x22,0x25,0x25,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x1C,0x1C,0x1C,0x16,0x16,0x16,0x22,
- 0x22,0x22,0x22,0x25,0x25,0x25,0x25,0x00,
- 0x00,0x26,0x1C,0x1C,0x16,0x16,0x16,0x22,
- 0x22,0x22,0x22,0x25,0x25,0x25,0x25,0x00,
- 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x22,
- 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x00,
- 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
- 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
- 0x15,0x15,0x3C,0x1E,0x0F,0x06,0x27,0x2A,
- 0x2A,0x10,0x16,0x16,0x16,0x16,0x16,0x22,
- 0x2C,0x2C,0x0B,0x37,0x23,0x27,0x13,0x2A,
- 0x10,0x10,0x10,0x16,0x16,0x16,0x16,0x22,
- 0x1B,0x1B,0x1D,0x0F,0x24,0x13,0x13,0x2A,
- 0x00,0x10,0x16,0x16,0x16,0x16,0x16,0x22,
- 0x1F,0x1F,0x03,0x24,0x07,0x0A,0x0A,0x10,
- 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x22,
- 0x22,0x35,0x06,0x27,0x13,0x2A,0x2A,0x10,
- 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x22,
- 0x22,0x06,0x27,0x27,0x13,0x2A,0x2A,0x10,
- 0x16,0x16,0x16,0x16,0x16,0x16,0x22,0x22,
- 0x22,0x05,0x0A,0x2A,0x2A,0x10,0x10,0x16,
- 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x22,
- 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
- 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
- 0x22,0x0D,0x2A,0x10,0x10,0x10,0x10,0x16,
- 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x25,
- 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
- 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
- 0x10,0x10,0x10,0x10,0x10,0x16,0x16,0x16,
- 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
- 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
- 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
- 0x10,0x10,0x10,0x10,0x16,0x16,0x16,0x16,
- 0x16,0x22,0x22,0x22,0x22,0x22,0x22,0x25,
- 0x0D,0x0D,0x10,0x10,0x10,0x16,0x16,0x16,
- 0x16,0x22,0x22,0x22,0x22,0x22,0x22,0x25,
- 0x0D,0x0D,0x0D,0x0D,0x0D,0x10,0x10,0x16,
- 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x3A,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x11,0x3A,0x3A,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x18,
- 0x00,0x11,0x3A,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x11,0x11,0x11,0x18,0x18,0x18,0x18,
- 0x18,0x25,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x3A,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x18,0x18,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x18,0x18,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x18,0x18,0x18,0x18,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x11,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x11,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x11,0x11,0x11,0x3A,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x18,0x3A,0x3A,0x11,0x11,0x11,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x11,0x11,0x11,0x3A,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
- 0x18,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x11,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x2A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
- 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A
-};
-
-const UWord16 ari_pk_s17_LC_ext[64][18] = // Q0
-{
- {
- 16384, 16368,16337,16231,16143,16115,16059,15916,15793,15710,15586,15472,15367,15302,15201,15107,15020,
- 0
- },
- {
- 16384, 8983, 8540, 8498, 8485, 4319, 3666, 3594, 3579, 2285, 1908, 1851, 1835, 1326, 1120, 1085, 1074,
- 0
- },
- {
- 16384, 12022,10039, 9520, 9346, 7347, 5335, 4648, 4382, 3815, 3083, 2728, 2562, 2363, 2050, 1869, 1777,
- 0
- },
- {
- 16384, 13429,11201,10562,10371, 8231, 5713, 4770, 4441, 3798, 2844, 2359, 2152, 1947, 1614, 1406, 1304,
- 0
- },
- {
- 16384, 13229,11403,10769,10529, 8415, 6431, 5645, 5311, 4448, 3547, 3176, 3001, 2617, 2181, 1984, 1886,
- 0
- },
- {
- 16384, 15168,13754,13120,12826,11553, 9705, 8723, 8227, 7675, 6762, 6180, 5842, 5585, 5141, 4816, 4607,
- 0
- },
- {
- 16384, 14625,12743,12034,11772,10059, 7706, 6652, 6223, 5594, 4594, 4023, 3742, 3501, 3089, 2818, 2664,
- 0
- },
- {
- 16384, 15275,13679,12951,12652,11158, 8852, 7652, 7121, 6406, 5242, 4542, 4196, 3894, 3398, 3063, 2864,
- 0
- },
- {
- 16384, 4860, 3338, 3214, 3193, 1428, 676, 571, 547, 356, 222, 189, 180, 139, 102, 89, 84,
- 0
- },
- {
- 16384, 8357, 5798, 5475, 5410, 3093, 1523, 1227, 1152, 849, 560, 470, 441, 370, 294, 261, 248,
- 0
- },
- {
- 16384, 15550,14350,13710,13387,12297,10541, 9493, 8929, 8354, 7371, 6696, 6299, 6008, 5491, 5107, 4856,
- 0
- },
- {
- 16384, 10346, 7298, 6933, 6865, 4052, 1863, 1471, 1381, 1055, 673, 536, 491, 429, 339, 293, 273,
- 0
- },
- {
- 16384, 11652, 8699, 8030, 7839, 5667, 3460, 2766, 2532, 2093, 1542, 1301, 1203, 1070, 893, 802, 759,
- 0
- },
- {
- 16384, 15639,14601,14037,13729,12847,11421,10520, 9978, 9521, 8720, 8136, 7750, 7493, 7033, 6676, 6426,
- 0
- },
- {
- 16384, 12427, 9590, 8715, 8386, 6641, 4708, 3886, 3515, 3071, 2490, 2198, 2052, 1886, 1670, 1549, 1478,
- 0
- },
- {
- 16384, 13605,10996,10363,10183, 7802, 5032, 4124, 3840, 3267, 2403, 1976, 1804, 1633, 1345, 1171, 1086,
- 0
- },
- {
- 16384, 15936,15224,14759,14464,13808,12678,11866,11331,10910,10150, 9549, 9122, 8853, 8352, 7938, 7626,
- 0
- },
- {
- 16384, 16383,16382,14829,14138,14137,14136,12895,12272,10935, 9788, 9082, 8674, 8073, 7508, 7118, 6867,
- 0
- },
- {
- 16384, 13888,11474,10840,10662, 8335, 5585, 4695, 4411, 3801, 2917, 2506, 2337, 2150, 1847, 1672, 1581,
- 0
- },
- {
- 16384, 15463,14162,13504,13196,11977,10063, 8978, 8429, 7811, 6768, 6088, 5705, 5406, 4882, 4504, 4266,
- 0
- },
- {
- 16384, 13764,11941,11367,11151, 9312, 7171, 6301, 5943, 5335, 4430, 3942, 3708, 3466, 3074, 2819, 2679,
- 0
- },
- {
- 16384, 5179, 3300, 3206, 3197, 1220, 374, 303, 293, 171, 81, 63, 59, 44, 29, 24, 22,
- 0
- },
- {
- 16384, 16026,15468,15096,14842,14329,13447,12790,12322,11985,11367,10860,10477,10248, 9811, 9443, 9148,
- 0
- },
- {
- 16384, 12809,11291,10848,10649, 8976, 7199, 6506, 6196, 5657, 4887, 4451, 4219, 3974, 3590, 3365, 3218,
- 0
- },
- {
- 16384, 16383,16382,15744,15348,15347,15346,14714,14288,13688,13097,12652,12328,11967,11584,11278,11045,
- 0
- },
- {
- 16384, 15415,14987,14866,14806,13751,13046,12818,12709,12187,11720,11527,11427,11096,10759,10601,10510,
- 0
- },
- {
- 16384, 5926, 4280, 4090, 4053, 2138, 1120, 947, 903, 632, 413, 353, 334, 264, 198, 174, 166,
- 0
- },
- {
- 16384, 9206, 6640, 6345, 6291, 3683, 1772, 1423, 1342, 1024, 652, 515, 467, 406, 314, 267, 245,
- 0
- },
- {
- 16384, 15086,13966,13505,13271,12238,10875,10157, 9763, 9331, 8629, 8155, 7845, 7608, 7198, 6892, 6670,
- 0
- },
- {
- 16384, 11427, 8599, 8132, 8027, 5406, 3012, 2429, 2270, 1823, 1244, 1006, 920, 814, 654, 564, 524,
- 0
- },
- {
- 16384, 11561, 8220, 7814, 7737, 4780, 2215, 1731, 1621, 1279, 830, 657, 599, 532, 424, 366, 339,
- 0
- },
- {
- 16384, 11649, 9374, 8867, 8724, 6398, 4154, 3470, 3253, 2718, 2010, 1695, 1570, 1412, 1172, 1042, 980,
- 0
- },
- {
- 16384, 13021,10503, 9726, 9443, 7520, 5271, 4369, 4016, 3495, 2741, 2365, 2181, 1990, 1719, 1561, 1478,
- 0
- },
- {
- 16384, 13815,11388,10605,10316, 8467, 6133, 5175, 4782, 4255, 3466, 3063, 2864, 2688, 2408, 2229, 2125,
- 0
- },
- {
- 16384, 16175,15807,15536,15338,15006,14402,13919,13549,13312,12871,12491,12182,12010,11681,11390,11143,
- 0
- },
- {
- 16384, 14310,12047,11336,11110, 9065, 6381, 5318, 4938, 4279, 3272, 2732, 2499, 2284, 1920, 1693, 1574,
- 0
- },
- {
- 16384, 14765,12824,12096,11834,10003, 7429, 6282, 5841, 5145, 4022, 3402, 3123, 2868, 2426, 2150, 2003,
- 0
- },
- {
- 16384, 16295,16127,15943,15802,15650,15360,15059,14816,14668,14401,14162,13954,13839,13634,13443,13275,
- 0
- },
- {
- 16384, 14182,12821,12340,12120,10698, 9040, 8284, 7908, 7378, 6549, 6053, 5772, 5520, 5080, 4785, 4597,
- 0
- },
- {
- 16384, 15164,13583,12892,12600,11161, 8997, 7888, 7386, 6744, 5673, 5015, 4673, 4391, 3898, 3555, 3349,
- 0
- },
- {
- 16384, 3758, 2571, 2481, 2467, 988, 478, 412, 397, 245, 154, 133, 127, 95, 69, 61, 58,
- 0
- },
- {
- 16384, 14805,13193,12553,12285,10706, 8596, 7623, 7178, 6542, 5563, 4996, 4703, 4426, 3967, 3662, 3482,
- 0
- },
- {
- 16384, 15787,14870,14320,14005,13147,11705,10747,10171, 9651, 8735, 8068, 7629, 7332, 6785, 6361, 6061,
- 0
- },
- {
- 16384, 7111, 4622, 4304, 4233, 2346, 1174, 938, 870, 659, 455, 389, 365, 316, 260, 236, 226,
- 0
- },
- {
- 16384, 7146, 4703, 4532, 4512, 2078, 740, 583, 556, 371, 201, 153, 141, 118, 87, 72, 66,
- 0
- },
- {
- 16384, 9593, 7184, 6853, 6790, 4144, 2206, 1832, 1745, 1320, 878, 741, 697, 599, 476, 424, 401,
- 0
- },
- {
- 16384, 9209, 5969, 5479, 5351, 3346, 1763, 1382, 1261, 1017, 733, 622, 578, 520, 446, 410, 392,
- 0
- },
- {
- 16384, 11324, 8681, 8252, 8159, 5450, 3114, 2606, 2473, 1987, 1412, 1211, 1142, 1017, 847, 765, 730,
- 0
- },
- {
- 16384, 12663,10073, 9527, 9392, 6827, 4204, 3489, 3286, 2713, 1966, 1666, 1554, 1400, 1172, 1051, 994,
- 0
- },
- {
- 16384, 10413, 7096, 6340, 6115, 4393, 2704, 2156, 1947, 1634, 1254, 1091, 1010, 925, 805, 742, 707,
- 0
- },
- {
- 16384, 13337,11073,10477,10306, 8045, 5534, 4705, 4438, 3804, 2942, 2530, 2360, 2164, 1850, 1668, 1574,
- 0
- },
- {
- 16384, 14323,12104,11391,11156, 9183, 6649, 5649, 5287, 4676, 3778, 3302, 3089, 2886, 2548, 2341, 2223,
- 0
- },
- {
- 16384, 11646, 8435, 7504, 7150, 5603, 3882, 3170, 2853, 2487, 2029, 1791, 1666, 1549, 1386, 1288, 1231,
- 0
- },
- {
- 16384, 13147,11339,10752,10524, 8775, 6682, 5776, 5398, 4813, 3908, 3406, 3154, 2933, 2554, 2310, 2176,
- 0
- },
- {
- 16384, 14551,12495,11707,11356, 9962, 8005, 7006, 6500, 6034, 5298, 4839, 4575, 4381, 4057, 3825, 3673,
- 0
- },
- {
- 16384, 12395, 9526, 9032, 8925, 6130, 3448, 2813, 2649, 2144, 1489, 1231, 1142, 1020, 836, 738, 694,
- 0
- },
- {
- 16384, 14921,13187,12475,12164,10758, 8775, 7752, 7257, 6727, 5864, 5306, 5004, 4777, 4393, 4119, 3942,
- 0
- },
- {
- 16384, 2151, 1301, 1276, 1274, 315, 84, 70, 68, 32, 14, 11, 10, 7, 4, 3, 2,
- 0
- },
- {
- 16384, 16383,16382,13774,13091,13090,13089,11287,10713, 7917, 6052, 5265, 4947, 4161, 3534, 3199, 3039,
- 0
- },
- {
- 16384, 14374,12331,11688,11474, 9505, 6993, 5998, 5634, 4991, 4008, 3498, 3265, 3036, 2658, 2417, 2285,
- 0
- },
- {
- 16384, 8798, 5867, 5626, 5593, 2841, 1038, 807, 765, 538, 302, 234, 215, 182, 139, 119, 111,
- 0
- },
- {
- 16384, 13325,10612,10015, 9860, 7343, 4583, 3802, 3571, 3023, 2269, 1945, 1817, 1670, 1440, 1309, 1243,
- 0
- },
- {
- 16384, 7741, 5790, 5571, 5528, 3110, 1698, 1464, 1409, 1034, 704, 613, 585, 487, 381, 342, 327,
- 0
- },
- {
- 16384, 9664, 7506, 7059, 6917, 4820, 3136, 2640, 2455, 2000, 1504, 1297, 1217, 1073, 896, 815, 777,
- 0
- }
-};
-
-const Word16 NumRatioBits[2][17] =
-{
- /* NB */
- {
- 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2
- },
-
- /* WB */
- {
- 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2
- }
-}; // Q0
-
-/* 7Q8 */
-const Word16 Ratios_WB_2_fx[32] =
-/* 2 */{ 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 15360, 16384, 18432 };
-const Word16 Ratios_WB_3_fx[32] =/* 7Q8 */
-/* 3 */{ 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 11264, 12288, 13824, 15360, 17408, 19968, 20480 };
-const Word16 Ratios_WB_4_fx[32] =/* 7Q8 */
-/* 4 */{ 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 10752, 11264, 12288, 13312, 13824, 17408 };
-const Word16 Ratios_WB_5_fx[32] =/* 7Q8 */
-/* 5 */{ 256, 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 10240, 11264, 12288, 13824 };
-const Word16 Ratios_WB_6_fx[32] =/* 7Q8 */
-/* 6 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536, 1664, 1792, 1920, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 8704, 10240, 10496 };
-const Word16 Ratios_WB_7_fx[32] =/* 7Q8 */
-/* 7 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5760, 6144, 6400, 6912, 7168, 7680, 8960 };
-const Word16 Ratios_WB_8_fx[16] =/* 7Q8 */
-/* 8 */{ 128, 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536, 1792, 2048, 2304, 2560 };
-const Word16 Ratios_WB_9_fx[16] =/* 7Q8 */
-/* 9 */{ 256, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3840, 4096, 4608, 6912 };
-const Word16 Ratios_WB_10_fx[16] =/* 7Q8 */
-/* 10 */{ 256, 384, 512, 640, 768, 896, 1024, 1280, 1536, 2048, 2560, 3840, 4608, 5632, 6144, 6656 };
-const Word16 Ratios_WB_11_fx[16] =/* 7Q8 */
-/* 11 */{ 256, 384, 512, 640, 768, 896, 1024, 1280, 1536, 2048, 2560, 3072, 3328, 3584, 4608, 5376 };
-const Word16 Ratios_WB_12_fx[16] =/* 7Q8 */
-/* 12 */{ 128, 256, 384, 512, 640, 768, 1024, 1280, 1536, 2048, 2304, 2816, 3072, 3456, 4096, 5120 };
-const Word16 Ratios_WB_13_fx[16] =/* 7Q8 */
-/* 13 */{ 128, 256, 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2560, 2816, 3072, 3584, 5120 };
-const Word16 Ratios_WB_14_fx[16] =/* 7Q8 */
-/* 14 */{ 128, 256, 384, 512, 640, 768, 1024, 1152, 1536, 1920, 2304, 2560, 3072, 3584, 3840, 4608 };
-const Word16 Ratios_WB_15_fx[16] =/* 7Q8 */
-/* 15 */{ 128, 256, 320, 384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 2048, 2304, 3584 };
-const Word16 Ratios_WB_16_fx[4] =/* 7Q8 */
-/* 16 */{ 128, 256, 512, 1024 };
-const Word16 Ratios_WB_17_fx[4] =/* 7Q8 */
-/* 17 */{ 256, 384, 512, 1024 };
-const Word16 Ratios_WB_18_fx[4] =/* 7Q8 */
-/* 18 */{ 256, 512, 768, 1024 };
-
-/******************************************************************************/
-
-/* 7Q8 */
-const Word16 Ratios_NB_2_fx[32] =
-/* 2 */{ 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 5888, 6144, 6400, 6656, 6912, 7168, 7680, 8192, 8704, 9216, 9728, 10240 };
-const Word16 Ratios_NB_3_fx[16] =/* 7Q8 */
-/* 3 */{ 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 4096, 5120, 6144, 7680 };
-const Word16 Ratios_NB_4_fx[16] =/* 7Q8 */
-/* 4 */{ 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 6144, 7680 };
-const Word16 Ratios_NB_5_fx[16] =/* 7Q8 */
-/* 5 */{ 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 6144, 7680 };
-const Word16 Ratios_NB_6_fx[16] =/* 7Q8 */
-/* 6 */{ 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120 };
-const Word16 Ratios_NB_7_fx[16] =/* 7Q8 */
-/* 7 */{ 256, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120 };
-const Word16 Ratios_NB_8_fx[16] =/* 7Q8 */
-/* 8 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 4096 };
-const Word16 Ratios_NB_9_fx[8] =/* 7Q8 */
-/* 9 */{ 256, 512, 768, 1024, 1280, 1536, 2048, 2560 };
-const Word16 Ratios_NB_10_fx[8] =/* 7Q8 */
-/* 10 */{ 256, 512, 768, 1024, 1280, 1536, 2048, 2560 };
-const Word16 Ratios_NB_11_fx[8] =/* 7Q8 */
-/* 11 */{ 256, 384, 512, 768, 1024, 1280, 1536, 2048 };
-const Word16 Ratios_NB_12_fx[8] =/* 7Q8 */
-/* 12 */{ 256, 512, 640, 768, 1024, 1280, 1536, 2048 };
-const Word16 Ratios_NB_13_fx[4] =/* 7Q8 */
-/* 13 */{ 256, 512, 768, 1024 };
-const Word16 Ratios_NB_14_fx[4] =/* 7Q8 */
-/* 14 */{ 256, 512, 1024, 1536 };
-const Word16 Ratios_NB_15_fx[4] =/* 7Q8 */
-/* 15 */{ 256, 512, 768, 1024 };
-const Word16 Ratios_NB_16_fx[4] =/* 7Q8 */
-/* 16 */{ 256, 384, 512, 1024 };
-const Word16 Ratios_NB_17_fx[4] =/* 7Q8 */
-/* 17 */{ 256, 384, 512, 768 };
-const Word16 Ratios_NB_18_fx[4] =/* 7Q8 */
-/* 18 */{ 128, 256, 512, 768 };
-
-/******************************************************************************/
-
-const Word16 *const Ratios_fx[2][17] =/* 7Q8 */
-{
- /* NB */
- {
- Ratios_NB_2_fx,
- Ratios_NB_3_fx,
- Ratios_NB_4_fx,
- Ratios_NB_5_fx,
- Ratios_NB_6_fx,
- Ratios_NB_7_fx,
- Ratios_NB_8_fx,
- Ratios_NB_9_fx,
- Ratios_NB_10_fx,
- Ratios_NB_11_fx,
- Ratios_NB_12_fx,
- Ratios_NB_13_fx,
- Ratios_NB_14_fx,
- Ratios_NB_15_fx
- , Ratios_NB_16_fx
- , Ratios_NB_17_fx
- , Ratios_NB_18_fx
- },
-
- /* WB */
- {
- Ratios_WB_2_fx,
- Ratios_WB_3_fx,
- Ratios_WB_4_fx,
- Ratios_WB_5_fx,
- Ratios_WB_6_fx,
- Ratios_WB_7_fx,
- Ratios_WB_8_fx,
- Ratios_WB_9_fx,
- Ratios_WB_10_fx,
- Ratios_WB_11_fx,
- Ratios_WB_12_fx,
- Ratios_WB_13_fx,
- Ratios_WB_14_fx,
- Ratios_WB_15_fx
- , Ratios_WB_16_fx
- , Ratios_WB_17_fx
- , Ratios_WB_18_fx
- }
-};
-#define QGC(x) FL2WORD16_SCALE(x, 4)
-const Word16 qGains[2][1 << kTcxHmNumGainBits] =
-{
- /* GC */ { QGC(0.75f) },
- /* VC */ { QGC(0.6f), QGC(1.4f), QGC(4.5f), QGC(10.0f) }
-};
-
-
-/*----------------------------------------------------------------------------------*
- * TNS
- *----------------------------------------------------------------------------------*/
-
-const struct TnsParameters tnsParametersIGF32kHz_LowBR[1] =
-{
- { 600, 3, /*1.85f, 0.075f, 4.4f,*/ 237/*1.85f Q7*/, 15518925/*1.85f Q23*/, 2458/*0.075f Q15*/,563 /*4.4f Q7*/ }
-};
-
-const struct TnsParameters tnsParameters32kHz[2] =
-{
- { 4500, 3, /*1.35f, 0.0300f, 1.0f ,*/ 173/*1.35f Q7*/,11324621/*1.35f Q23*/, 983/*0.0300f Q15*/, 128/*1.0f Q7*/},
- { 600, 1, /*1.75f, 0.0625f, 4.4f ,*/ 224/*1.75f Q7*/,14680064/*1.75f Q23*/, 2048/*0.0625f Q15*/, 563 /*4.4f Q7*/ }
-};
-
-const struct TnsParameters tnsParameters32kHz_grouped[2] =
-{
- { 8400, 3, /*1.375f, 0.03125f, 1.0f ,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/ },
- { 800, 3, /*1.375f, 0.03125f, 1.0f ,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/}
-};
-
-const struct TnsParameters tnsParameters16kHz[1] =
-{
- { 600, 3, /*1.5f, 0.05f, 4.4f,*/ 192/*1.5f Q7*/, 12582912/*1.5f Q23*/, 1638/*0.05f Q15*/ ,563 /*4.4f Q7*/ }
-};
-
-const struct TnsParameters tnsParameters16kHz_grouped[2] =
-{
- { 4400, 3, /*1.5f, 0.05f, 1.0f,*/ 192/*1.5f Q7*/, 12582912/*1.5f Q23*/, 1638/*0.05f Q15*/ , 128/*1.0f Q7*/},
- { 800, 3, /*1.5f, 0.05f, 1.0f,*/ 192/*1.5f Q7*/, 12582912/*1.5f Q23*/, 1638/*0.05f Q15*/ , 128/*1.0f Q7*/}
-};
-
-const struct TnsParameters tnsParameters48kHz_grouped[2] =
-{
- { 10400, 3, /*1.375f, 0.03125f, 1.0f,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/},
- { 800, 3, /*1.375f, 0.03125f, 1.0f,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/ }
-};
-
-const struct TnsParameters tnsParameters32kHz_Stereo[2]=
-{
- { 4500, 3, /*1.35f, 0.0300f, 1.0f ,*/ 173/*1.35f Q7*/, 11324621/*1.35f Q23*/, 983/*0.0300f Q15*/ , 128/*1.0f Q7*/},
- { 600, 3, /*1.75f, 0.0625f, 4.4f ,*/ 224/*1.75f Q7*/,14680064/*1.75f Q23*/, 2048/*0.0625f Q15*/ ,563 /*4.4f Q7*/ }
-};
-
-const Word16 tnsAcfWindow_fx[TNS_MAX_FILTER_ORDER] =
-{
- 32696/*0.997803f Q15*/, 32480/*0.991211f Q15*/, 32120/*0.980225f Q15*/, 31616/*0.964844f Q15*/, 30968/*0.945068f Q15*/, 30176/*0.920898f Q15*/, 29240/*0.892334f Q15*/, 28160/*0.859375f Q15*/
-};
-
-
-/* Definition of the mapping between TNS parameters and a bitstream */
-/* Helper structures for hufmann table coding */
-
-const Coding codesTnsCoeff0TCX20[] =
-{
- { -8+INDEX_SHIFT, 609, 11 }, /* 01001100001 */
- { -7+INDEX_SHIFT, 305, 10 }, /* 0100110001 */
- { -6+INDEX_SHIFT, 77, 8 }, /* 01001101 */
- { -5+INDEX_SHIFT, 39, 7 }, /* 0100111 */
- { -4+INDEX_SHIFT, 8, 5 }, /* 01000 */
- { -3+INDEX_SHIFT, 21, 5 }, /* 10101 */
- { -2+INDEX_SHIFT, 11, 4 }, /* 1011 */
- { -1+INDEX_SHIFT, 3, 3 }, /* 011 */
- { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 1+INDEX_SHIFT, 0, 2 }, /* 00 */
- { 2+INDEX_SHIFT, 4, 3 }, /* 100 */
- { 3+INDEX_SHIFT, 5, 4 }, /* 0101 */
- { 4+INDEX_SHIFT, 20, 5 }, /* 10100 */
- { 5+INDEX_SHIFT, 18, 6 }, /* 010010 */
- { 6+INDEX_SHIFT, 153, 9 }, /* 010011001 */
- { 7+INDEX_SHIFT, 608, 11 } /* 01001100000 */
-};
-
-const Coding codesTnsCoeff0TCX10[] =
-{
- { -8+INDEX_SHIFT, 441, 9 }, /* 110111001 */
- { -7+INDEX_SHIFT, 111, 7 }, /* 1101111 */
- { -6+INDEX_SHIFT, 8, 4 }, /* 1000 */
- { -5+INDEX_SHIFT, 9, 4 }, /* 1001 */
- { -4+INDEX_SHIFT, 14, 4 }, /* 1110 */
- { -3+INDEX_SHIFT, 15, 4 }, /* 1111 */
- { -2+INDEX_SHIFT, 3, 3 }, /* 011 */
- { -1+INDEX_SHIFT, 5, 3 }, /* 101 */
- { 0+INDEX_SHIFT, 0, 2 }, /* 00 */
- { 1+INDEX_SHIFT, 2, 3 }, /* 010 */
- { 2+INDEX_SHIFT, 12, 4 }, /* 1100 */
- { 3+INDEX_SHIFT, 26, 5 }, /* 11010 */
- { 4+INDEX_SHIFT, 54, 6 }, /* 110110 */
- { 5+INDEX_SHIFT, 221, 8 }, /* 11011101 */
- { 6+INDEX_SHIFT, 881, 10 }, /* 1101110001 */
- { 7+INDEX_SHIFT, 880, 10 } /* 1101110000 */
-};
-
-const Coding codesTnsCoeff1TCX20[] =
-{
- { -8+INDEX_SHIFT, 30018, 15 }, /* 111010101000010 */
- { -7+INDEX_SHIFT, 30019, 15 }, /* 111010101000011 */
- { -6+INDEX_SHIFT, 7505, 13 }, /* 1110101010001 */
- { -5+INDEX_SHIFT, 3753, 12 }, /* 111010101001 */
- { -4+INDEX_SHIFT, 939, 10 }, /* 1110101011 */
- { -3+INDEX_SHIFT, 235, 8 }, /* 11101011 */
- { -2+INDEX_SHIFT, 28, 5 }, /* 11100 */
- { -1+INDEX_SHIFT, 6, 3 }, /* 110 */
- { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
- { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 2+INDEX_SHIFT, 15, 4 }, /* 1111 */
- { 3+INDEX_SHIFT, 59, 6 }, /* 111011 */
- { 4+INDEX_SHIFT, 116, 7 }, /* 1110100 */
- { 5+INDEX_SHIFT, 468, 9 }, /* 111010100 */
- { 6+INDEX_SHIFT, 1877, 11 }, /* 11101010101 */
- { 7+INDEX_SHIFT, 15008, 14 } /* 11101010100000 */
-};
-
-const Coding codesTnsCoeff1TCX10[] =
-{
- { -8+INDEX_SHIFT, 2818, 12 }, /* 101100000010 */
- { -7+INDEX_SHIFT, 2819, 12 }, /* 101100000011 */
- { -6+INDEX_SHIFT, 705, 10 }, /* 1011000001 */
- { -5+INDEX_SHIFT, 353, 9 }, /* 101100001 */
- { -4+INDEX_SHIFT, 177, 8 }, /* 10110001 */
- { -3+INDEX_SHIFT, 45, 6 }, /* 101101 */
- { -2+INDEX_SHIFT, 10, 4 }, /* 1010 */
- { -1+INDEX_SHIFT, 3, 3 }, /* 011 */
- { 0+INDEX_SHIFT, 6, 3 }, /* 110 */
- { 1+INDEX_SHIFT, 0, 2 }, /* 00 */
- { 2+INDEX_SHIFT, 7, 3 }, /* 111 */
- { 3+INDEX_SHIFT, 4, 3 }, /* 100 */
- { 4+INDEX_SHIFT, 2, 3 }, /* 010 */
- { 5+INDEX_SHIFT, 23, 5 }, /* 10111 */
- { 6+INDEX_SHIFT, 89, 7 }, /* 1011001 */
- { 7+INDEX_SHIFT, 1408, 11 } /* 10110000000 */
-};
-
-const Coding codesTnsCoeff2TCX20[] =
-{
- { -8+INDEX_SHIFT, 13312, 14 }, /* 11010000000000 */
- { -7+INDEX_SHIFT, 13313, 14 }, /* 11010000000001 */
- { -6+INDEX_SHIFT, 3329, 12 }, /* 110100000001 */
- { -5+INDEX_SHIFT, 833, 10 }, /* 1101000001 */
- { -4+INDEX_SHIFT, 209, 8 }, /* 11010001 */
- { -3+INDEX_SHIFT, 53, 6 }, /* 110101 */
- { -2+INDEX_SHIFT, 12, 4 }, /* 1100 */
- { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
- { 1+INDEX_SHIFT, 7, 3 }, /* 111 */
- { 2+INDEX_SHIFT, 27, 5 }, /* 11011 */
- { 3+INDEX_SHIFT, 105, 7 }, /* 1101001 */
- { 4+INDEX_SHIFT, 417, 9 }, /* 110100001 */
- { 5+INDEX_SHIFT, 1665, 11 }, /* 11010000001 */
- { 6+INDEX_SHIFT, 13314, 14 }, /* 11010000000010 */
- { 7+INDEX_SHIFT, 13315, 14 } /* 11010000000011 */
-};
-
-const Coding codesTnsCoeff2TCX10[] =
-{
- { -8+INDEX_SHIFT, 512, 12 }, /* 001000000000 */
- { -7+INDEX_SHIFT, 513, 12 }, /* 001000000001 */
- { -6+INDEX_SHIFT, 65, 9 }, /* 001000001 */
- { -5+INDEX_SHIFT, 17, 7 }, /* 0010001 */
- { -4+INDEX_SHIFT, 5, 5 }, /* 00101 */
- { -3+INDEX_SHIFT, 0, 3 }, /* 000 */
- { -2+INDEX_SHIFT, 6, 3 }, /* 110 */
- { -1+INDEX_SHIFT, 1, 2 }, /* 01 */
- { 0+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 1+INDEX_SHIFT, 7, 3 }, /* 111 */
- { 2+INDEX_SHIFT, 3, 4 }, /* 0011 */
- { 3+INDEX_SHIFT, 9, 6 }, /* 001001 */
- { 4+INDEX_SHIFT, 33, 8 }, /* 00100001 */
- { 5+INDEX_SHIFT, 129, 10 }, /* 0010000001 */
- { 6+INDEX_SHIFT, 514, 12 }, /* 001000000010 */
- { 7+INDEX_SHIFT, 515, 12 } /* 001000000011 */
-};
-
-const Coding codesTnsCoeff3TCX20[] =
-{
- { -8+INDEX_SHIFT, 13318, 14 }, /* 11010000000110 */
- { -7+INDEX_SHIFT, 13319, 14 }, /* 11010000000111 */
- { -6+INDEX_SHIFT, 6656, 13 }, /* 1101000000000 */
- { -5+INDEX_SHIFT, 1665, 11 }, /* 11010000001 */
- { -4+INDEX_SHIFT, 417, 9 }, /* 110100001 */
- { -3+INDEX_SHIFT, 105, 7 }, /* 1101001 */
- { -2+INDEX_SHIFT, 27, 5 }, /* 11011 */
- { -1+INDEX_SHIFT, 7, 3 }, /* 111 */
- { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
- { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 2+INDEX_SHIFT, 12, 4 }, /* 1100 */
- { 3+INDEX_SHIFT, 53, 6 }, /* 110101 */
- { 4+INDEX_SHIFT, 209, 8 }, /* 11010001 */
- { 5+INDEX_SHIFT, 833, 10 }, /* 1101000001 */
- { 6+INDEX_SHIFT, 6657, 13 }, /* 1101000000001 */
- { 7+INDEX_SHIFT, 6658, 13 } /* 1101000000010 */
-};
-
-const Coding codesTnsCoeff3TCX10[] =
-{
- { -8+INDEX_SHIFT, 1284, 12 }, /* 010100000100 */
- { -7+INDEX_SHIFT, 1285, 12 }, /* 010100000101 */
- { -6+INDEX_SHIFT, 1286, 12 }, /* 010100000110 */
- { -5+INDEX_SHIFT, 1287, 12 }, /* 010100000111 */
- { -4+INDEX_SHIFT, 161, 9 }, /* 010100001 */
- { -3+INDEX_SHIFT, 41, 7 }, /* 0101001 */
- { -2+INDEX_SHIFT, 11, 5 }, /* 01011 */
- { -1+INDEX_SHIFT, 0, 2 }, /* 00 */
- { 0+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 1+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 2+INDEX_SHIFT, 3, 3 }, /* 011 */
- { 3+INDEX_SHIFT, 4, 4 }, /* 0100 */
- { 4+INDEX_SHIFT, 21, 6 }, /* 010101 */
- { 5+INDEX_SHIFT, 81, 8 }, /* 01010001 */
- { 6+INDEX_SHIFT, 640, 11 }, /* 01010000000 */
- { 7+INDEX_SHIFT, 641, 11 } /* 01010000001 */
-};
-
-const Coding codesTnsCoeff4TCX20[] =
-{
- { -8+INDEX_SHIFT, 13318, 14 }, /* 11010000000110 */
- { -7+INDEX_SHIFT, 13319, 14 }, /* 11010000000111 */
- { -6+INDEX_SHIFT, 6656, 13 }, /* 1101000000000 */
- { -5+INDEX_SHIFT, 833, 10 }, /* 1101000001 */
- { -4+INDEX_SHIFT, 209, 8 }, /* 11010001 */
- { -3+INDEX_SHIFT, 53, 6 }, /* 110101 */
- { -2+INDEX_SHIFT, 12, 4 }, /* 1100 */
- { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
- { 1+INDEX_SHIFT, 7, 3 }, /* 111 */
- { 2+INDEX_SHIFT, 27, 5 }, /* 11011 */
- { 3+INDEX_SHIFT, 105, 7 }, /* 1101001 */
- { 4+INDEX_SHIFT, 417, 9 }, /* 110100001 */
- { 5+INDEX_SHIFT, 1665, 11 }, /* 11010000001 */
- { 6+INDEX_SHIFT, 6657, 13 }, /* 1101000000001 */
- { 7+INDEX_SHIFT, 6658, 13 } /* 1101000000010 */
-};
-
-const Coding codesTnsCoeff4TCX10[] =
-{
- { -8+INDEX_SHIFT, 20, 12 }, /* 000000010100 */
- { -7+INDEX_SHIFT, 21, 12 }, /* 000000010101 */
- { -6+INDEX_SHIFT, 22, 12 }, /* 000000010110 */
- { -5+INDEX_SHIFT, 3, 9 }, /* 000000011 */
- { -4+INDEX_SHIFT, 1, 7 }, /* 0000001 */
- { -3+INDEX_SHIFT, 1, 5 }, /* 00001 */
- { -2+INDEX_SHIFT, 1, 3 }, /* 001 */
- { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
- { 2+INDEX_SHIFT, 1, 4 }, /* 0001 */
- { 3+INDEX_SHIFT, 1, 6 }, /* 000001 */
- { 4+INDEX_SHIFT, 0, 8 }, /* 00000000 */
- { 5+INDEX_SHIFT, 23, 12 }, /* 000000010111 */
- { 6+INDEX_SHIFT, 8, 11 }, /* 00000001000 */
- { 7+INDEX_SHIFT, 9, 11 } /* 00000001001 */
-};
-
-const Coding codesTnsCoeff5[] =
-{
- { -8+INDEX_SHIFT, 6788, 13 }, /* 1101010000100 */
- { -7+INDEX_SHIFT, 6789, 13 }, /* 1101010000101 */
- { -6+INDEX_SHIFT, 6790, 13 }, /* 1101010000110 */
- { -5+INDEX_SHIFT, 849, 10 }, /* 1101010001 */
- { -4+INDEX_SHIFT, 213, 8 }, /* 11010101 */
- { -3+INDEX_SHIFT, 107, 7 }, /* 1101011 */
- { -2+INDEX_SHIFT, 27, 5 }, /* 11011 */
- { -1+INDEX_SHIFT, 7, 3 }, /* 111 */
- { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
- { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 2+INDEX_SHIFT, 12, 4 }, /* 1100 */
- { 3+INDEX_SHIFT, 52, 6 }, /* 110100 */
- { 4+INDEX_SHIFT, 425, 9 }, /* 110101001 */
- { 5+INDEX_SHIFT, 6791, 13 }, /* 1101010000111 */
- { 6+INDEX_SHIFT, 3392, 12 }, /* 110101000000 */
- { 7+INDEX_SHIFT, 3393, 12 } /* 110101000001 */
-};
-
-const Coding codesTnsCoeff6[] =
-{
- { -8+INDEX_SHIFT, 4, 12 }, /* 000000000100 */
- { -7+INDEX_SHIFT, 5, 12 }, /* 000000000101 */
- { -6+INDEX_SHIFT, 6, 12 }, /* 000000000110 */
- { -5+INDEX_SHIFT, 1, 9 }, /* 000000001 */
- { -4+INDEX_SHIFT, 1, 7 }, /* 0000001 */
- { -3+INDEX_SHIFT, 1, 5 }, /* 00001 */
- { -2+INDEX_SHIFT, 1, 3 }, /* 001 */
- { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
- { 2+INDEX_SHIFT, 1, 4 }, /* 0001 */
- { 3+INDEX_SHIFT, 1, 6 }, /* 000001 */
- { 4+INDEX_SHIFT, 1, 8 }, /* 00000001 */
- { 5+INDEX_SHIFT, 7, 12 }, /* 000000000111 */
- { 6+INDEX_SHIFT, 0, 11 }, /* 00000000000 */
- { 7+INDEX_SHIFT, 1, 11 } /* 00000000001 */
-};
-
-const Coding codesTnsCoeff7[] =
-{
- { -8+INDEX_SHIFT, 14, 11 }, /* 00000001110 */
- { -7+INDEX_SHIFT, 15, 11 }, /* 00000001111 */
- { -6+INDEX_SHIFT, 0, 10 }, /* 0000000000 */
- { -5+INDEX_SHIFT, 1, 10 }, /* 0000000001 */
- { -4+INDEX_SHIFT, 1, 7 }, /* 0000001 */
- { -3+INDEX_SHIFT, 1, 5 }, /* 00001 */
- { -2+INDEX_SHIFT, 1, 4 }, /* 0001 */
- { -1+INDEX_SHIFT, 1, 2 }, /* 01 */
- { 0+INDEX_SHIFT, 2, 10 }, /* 0000000010 */
- { 1+INDEX_SHIFT, 1, 1 }, /* 1 */
- { 2+INDEX_SHIFT, 1, 3 }, /* 001 */
- { 3+INDEX_SHIFT, 1, 6 }, /* 000001 */
- { 4+INDEX_SHIFT, 3, 10 }, /* 0000000011 */
- { 5+INDEX_SHIFT, 4, 10 }, /* 0000000100 */
- { 6+INDEX_SHIFT, 5, 10 }, /* 0000000101 */
- { 7+INDEX_SHIFT, 6, 10 } /* 0000000110 */
-};
-
-const Coding codesTnsCoeff456[] =
-{
- { -8+INDEX_SHIFT, 516, 12 }, /* 001000000100 */
- { -7+INDEX_SHIFT, 517, 12 }, /* 001000000101 */
- { -6+INDEX_SHIFT, 518, 12 }, /* 001000000110 */
- { -5+INDEX_SHIFT, 65, 9 }, /* 001000001 */
- { -4+INDEX_SHIFT, 17, 7 }, /* 0010001 */
- { -3+INDEX_SHIFT, 5, 5 }, /* 00101 */
- { -2+INDEX_SHIFT, 3, 4 }, /* 0011 */
- { -1+INDEX_SHIFT, 1, 2 }, /* 01 */
- { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 2+INDEX_SHIFT, 0, 3 }, /* 000 */
- { 3+INDEX_SHIFT, 9, 6 }, /* 001001 */
- { 4+INDEX_SHIFT, 33, 8 }, /* 00100001 */
- { 5+INDEX_SHIFT, 519, 12 }, /* 001000000111 */
- { 6+INDEX_SHIFT, 256, 11 }, /* 00100000000 */
- { 7+INDEX_SHIFT, 257, 11 } /* 00100000001 */
-};
-
-const Coding codesTnsCoeff0WBTCX20[] =
-{
- { -8+INDEX_SHIFT, 225, 10 }, /* 0011100001 */
- { -7+INDEX_SHIFT, 113, 9 }, /* 001110001 */
- { -6+INDEX_SHIFT, 29, 7 }, /* 0011101 */
- { -5+INDEX_SHIFT, 15, 6 }, /* 001111 */
- { -4+INDEX_SHIFT, 2, 4 }, /* 0010 */
- { -3+INDEX_SHIFT, 0, 3 }, /* 000 */
- { -2+INDEX_SHIFT, 13, 4 }, /* 1101 */
- { -1+INDEX_SHIFT, 2, 3 }, /* 010 */
- { 0+INDEX_SHIFT, 5, 3 }, /* 101 */
- { 1+INDEX_SHIFT, 3, 3 }, /* 011 */
- { 2+INDEX_SHIFT, 4, 3 }, /* 100 */
- { 3+INDEX_SHIFT, 7, 3 }, /* 111 */
- { 4+INDEX_SHIFT, 12, 4 }, /* 1100 */
- { 5+INDEX_SHIFT, 6, 5 }, /* 00110 */
- { 6+INDEX_SHIFT, 57, 8 }, /* 00111001 */
- { 7+INDEX_SHIFT, 224, 10 } /* 0011100000 */
-};
-
-
-const Coding codesTnsCoeff1WBTCX20[] =
-{
- { -8+INDEX_SHIFT, 512, 12 }, /* 001000000000 */
- { -7+INDEX_SHIFT, 513, 12 }, /* 001000000001 */
- { -6+INDEX_SHIFT, 514, 12 }, /* 001000000010 */
- { -5+INDEX_SHIFT, 65, 9 }, /* 001000001 */
- { -4+INDEX_SHIFT, 17, 7 }, /* 0010001 */
- { -3+INDEX_SHIFT, 5, 5 }, /* 00101 */
- { -2+INDEX_SHIFT, 0, 3 }, /* 000 */
- { -1+INDEX_SHIFT, 2, 3 }, /* 010 */
- { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
- { 2+INDEX_SHIFT, 3, 3 }, /* 011 */
- { 3+INDEX_SHIFT, 3, 4 }, /* 0011 */
- { 4+INDEX_SHIFT, 9, 6 }, /* 001001 */
- { 5+INDEX_SHIFT, 33, 8 }, /* 00100001 */
- { 6+INDEX_SHIFT, 129, 10 }, /* 0010000001 */
- { 7+INDEX_SHIFT, 515, 12 } /* 001000000011 */
-};
-
-
-const Coding codesTnsCoeff2WB[] =
-{
- { -8+INDEX_SHIFT, 5632, 13 }, /* 1011000000000 */
- { -7+INDEX_SHIFT, 5633, 13 }, /* 1011000000001 */
- { -6+INDEX_SHIFT, 1409, 11 }, /* 10110000001 */
- { -5+INDEX_SHIFT, 353, 9 }, /* 101100001 */
- { -4+INDEX_SHIFT, 89, 7 }, /* 1011001 */
- { -3+INDEX_SHIFT, 23, 5 }, /* 10111 */
- { -2+INDEX_SHIFT, 4, 3 }, /* 100 */
- { -1+INDEX_SHIFT, 0, 2 }, /* 00 */
- { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
- { 2+INDEX_SHIFT, 10, 4 }, /* 1010 */
- { 3+INDEX_SHIFT, 45, 6 }, /* 101101 */
- { 4+INDEX_SHIFT, 177, 8 }, /* 10110001 */
- { 5+INDEX_SHIFT, 705, 10 }, /* 1011000001 */
- { 6+INDEX_SHIFT, 5634, 13 }, /* 1011000000010 */
- { 7+INDEX_SHIFT, 5635, 13 } /* 1011000000011 */
-};
-
-const Coding codesTnsCoeff3WB[] =
-{
- { -8+INDEX_SHIFT, 5638, 13 }, /* 1011000000110 */
- { -7+INDEX_SHIFT, 5639, 13 }, /* 1011000000111 */
- { -6+INDEX_SHIFT, 2816, 12 }, /* 101100000000 */
- { -5+INDEX_SHIFT, 353, 9 }, /* 101100001 */
- { -4+INDEX_SHIFT, 177, 8 }, /* 10110001 */
- { -3+INDEX_SHIFT, 45, 6 }, /* 101101 */
- { -2+INDEX_SHIFT, 10, 4 }, /* 1010 */
- { -1+INDEX_SHIFT, 0, 2 }, /* 00 */
- { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
- { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
- { 2+INDEX_SHIFT, 4, 3 }, /* 100 */
- { 3+INDEX_SHIFT, 23, 5 }, /* 10111 */
- { 4+INDEX_SHIFT, 89, 7 }, /* 1011001 */
- { 5+INDEX_SHIFT, 705, 10 }, /* 1011000001 */
- { 6+INDEX_SHIFT, 2817, 12 }, /* 101100000001 */
- { 7+INDEX_SHIFT, 2818, 12 } /* 101100000010 */
-};
-
-const Word16 nTnsCoeffCodes = sizeof(codesTnsCoeff0TCX20)/sizeof(codesTnsCoeff0TCX20[0]);
-
-const Coding * const codesTnsCoeffSWBTCX20[] = { codesTnsCoeff0TCX20, codesTnsCoeff1TCX20, codesTnsCoeff2TCX20, codesTnsCoeff3TCX20, codesTnsCoeff4TCX20, codesTnsCoeff5, codesTnsCoeff6, codesTnsCoeff7 };
-const Coding * const codesTnsCoeffSWBTCX10[] = { codesTnsCoeff0TCX10, codesTnsCoeff1TCX10, codesTnsCoeff2TCX10, codesTnsCoeff3TCX10, codesTnsCoeff4TCX10, codesTnsCoeff5, codesTnsCoeff6, codesTnsCoeff7 };
-const Coding * const codesTnsCoeffWBTCX20[] = { codesTnsCoeff0WBTCX20, codesTnsCoeff1WBTCX20, codesTnsCoeff2WB, codesTnsCoeff3WB, codesTnsCoeff456, codesTnsCoeff456, codesTnsCoeff456, codesTnsCoeff7 };
-
-const Word16 nTnsCoeffTables = sizeof(codesTnsCoeffSWBTCX20)/sizeof(codesTnsCoeffSWBTCX20[0]); // Q0
-
-const Coding codesTnsOrderTCX20[] =
-{
- { 1, 0, 2 }, /* 00 */
- { 2, 40, 6 }, /* 101000 */
- { 3, 41, 6 }, /* 101001 */
- { 4, 21, 5 }, /* 10101 */
- { 5, 11, 4 }, /* 1011 */
- { 6, 4, 3 }, /* 100 */
- { 7, 1, 2 }, /* 01 */
- { 8, 3, 2 } /* 11 */
-};
-const Coding codesTnsOrderTCX10[] =
-{
- { 1, 0, 3 }, /* 000 */
- { 2, 16, 5 }, /* 10000 */
- { 3, 17, 5 }, /* 10001 */
- { 4, 9, 4 }, /* 1001 */
- { 5, 1, 3 }, /* 001 */
- { 6, 5, 3 }, /* 101 */
- { 7, 1, 2 }, /* 01 */
- { 8, 3, 2 } /* 11 */
-};
-const Coding codesTnsOrder[] =
-{
- { 1, 96, 7 }, /* 1100000 */
- { 2, 97, 7 }, /* 1100001 */
- { 3, 49, 6 }, /* 110001 */
- { 4, 25, 5 }, /* 11001 */
- { 5, 13, 4 }, /* 1101 */
- { 6, 7, 3 }, /* 111 */
- { 7, 2, 2 }, /* 10 */
- { 8, 0, 1 } /* 0 */
-};
-
-const Word16 nTnsOrderCodes = sizeof(codesTnsOrder)/sizeof(codesTnsOrder[0]); // Q0
-
-const ParamsBitMap tnsSWBTCX20FilterCoeffBitMap =
-{
- 1,
- {
- { 0, GetSWBTCX20TnsFilterCoeffBits, TRUE, GetTnsFilterCoeff, SetTnsFilterCoeff, EncodeSWBTCX20TnsFilterCoeff, DecodeSWBTCX20TnsFilterCoeff_flt, NULL } /* TNS filter coefficients */
- }
-};
-
-const ParamsBitMap tnsSWBTCX10FilterCoeffBitMap =
-{
- 1,
- {
- { 0, GetSWBTCX10TnsFilterCoeffBits, TRUE, GetTnsFilterCoeff, SetTnsFilterCoeff, EncodeSWBTCX10TnsFilterCoeff, DecodeSWBTCX10TnsFilterCoeff_flt, NULL } /* TNS filter coefficients */
- }
-};
-
-const ParamsBitMap tnsSWBTCX20FilterBitMap =
-{
- 1,
- {
- { 0, GetTnsFilterOrderBitsSWBTCX20, FALSE, GetTnsFilterOrder, SetTnsFilterOrder, EncodeTnsFilterOrderSWBTCX20, DecodeTnsFilterOrderSWBTCX20_flt, &tnsSWBTCX20FilterCoeffBitMap } /* TNS filter order */
- }
-};
-
-const ParamsBitMap tnsSWBTCX10FilterBitMap =
-{
- 1,
- {
- { 0, GetTnsFilterOrderBitsSWBTCX10, FALSE, GetTnsFilterOrder, SetTnsFilterOrder, EncodeTnsFilterOrderSWBTCX10, DecodeTnsFilterOrderSWBTCX10_flt, &tnsSWBTCX10FilterCoeffBitMap } /* TNS filter order */
- }
-};
-
-const ParamsBitMap tnsSWBTCX20BitMap =
-{
- 1,
- {
- { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX20FilterBitMap } /* Number of TNS filters */
- }
-};
-
-/* For storing/reading bits in SWB/FB mode */
-const ParamsBitMap tnsEnabledSWBTCX20BitMap =
-{
- 1,
- {
- { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsSWBTCX20BitMap } /* TNS Enabled/Disable */
- }
-};
-
-const ParamsBitMap tnsSWBTCX10BitMap =
-{
- 1,
- {
- { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX10FilterBitMap } /* Number of TNS filters */
- }
-};
-
-/* For storing/reading bits in SWB/FB mode */
-const ParamsBitMap tnsEnabledSWBTCX10BitMap =
-{
- 1,
- {
- { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsSWBTCX10BitMap } /* TNS Enabled/Disable */
- }
-};
-
-const ParamsBitMap tnsWBTCX20FilterCoeffBitMap =
-{
- 1,
- {
- { 0, GetWBTCX20TnsFilterCoeffBits, TRUE, GetTnsFilterCoeff, SetTnsFilterCoeff, EncodeWBTCX20TnsFilterCoeff, DecodeWBTCX20TnsFilterCoeff_flt, NULL } /* TNS filter coefficients */
- }
-};
-
-
-const ParamsBitMap tnsWBTCX20FilterBitMap =
-{
- 1,
- {
- { 0, GetTnsFilterOrderBits, FALSE, GetTnsFilterOrder, SetTnsFilterOrder, EncodeTnsFilterOrder, DecodeTnsFilterOrder_flt, &tnsWBTCX20FilterCoeffBitMap } /* TNS filter order */
- }
-};
-
-
-/* For storing/reading bits in WB mode */
-const ParamsBitMap tnsEnabledWBTCX20BitMap =
-{
- 1,
- {
- { 1, NULL, TRUE, GetTnsEnabledSingleFilter, SetTnsEnabledSingleFilter, NULL, NULL, &tnsWBTCX20FilterBitMap } /* TNS Enabled/Disable */
- }
-};
-
-/* For storing/reading bits in SWB/FB mode */
-const ParamsBitMap tnsOnWhiteSWBTCX20BitMap =
-{
- 2,
- {
- { 1, NULL, TRUE, GetTnsOnWhite, SetTnsOnWhite, NULL, NULL, NULL }, /* TNS Enabled/Disable */
- { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX20FilterBitMap }
- }
-};
-
-const ParamsBitMap tnsEnabledOnWhiteSWBTCX20BitMap =
-{
- 1,
- {
- { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsOnWhiteSWBTCX20BitMap } /* TNS Enabled/Disable */
- }
-};
-/* For storing/reading bits in SWB/FB mode */
-const ParamsBitMap tnsOnWhiteSWBTCX10BitMap =
-{
- 2,
- {
- { 1, NULL, TRUE, GetTnsOnWhite, SetTnsOnWhite, NULL, NULL, NULL }, /* TNS on whitened spectra */
- { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX10FilterBitMap }
- }
-};
-
-/* For storing/reading bits in SWB/FB mode */
-const ParamsBitMap tnsEnabledOnWhiteSWBTCX10BitMap =
-{
- 1,
- {
- { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsOnWhiteSWBTCX10BitMap } /* TNS Enabled/Disable */
- }
-};
-
-
-/**
- * 4 bit resolution TNS coefficients.
- */
-const Word16 tnsCoeff4[16] =
-{
- -32628/*-0.99573418F Q15*/, /* = sin(-8*(PI/2.0)/(8 + 0.5)) */
- -31517/*-0.96182564F Q15*/, /* = sin(-7*(PI/2.0)/(8 + 0.5)) */
- -29333/*-0.89516329F Q15*/,
- -26149/*-0.79801723F Q15*/,
- -22076/*-0.67369564F Q15*/,
- -17250/*-0.52643216F Q15*/,
- -11837/*-0.36124167F Q15*/,
- -6021/*-0.18374952F Q15*/, /* = sin(-1*(PI/2.0)/(8 + 0.5)) */
- 0/* 0.00000000F Q15*/, /* = sin(0*(PI/2.0)/(8 + 0.5)) */
- 6813/* 0.20791169F Q15*/, /* = sin(1*(PI/2.0)/(8 - 0.5)) */
- 13328/* 0.40673664F Q15*/,
- 19261/* 0.58778525F Q15*/,
- 24351/* 0.74314483F Q15*/,
- 28378/* 0.86602540F Q15*/,
- 31164/* 0.95105652F Q15*/, /* = sin(6*(PI/2.0)/(8 - 0.5)) */
- 32588/* 0.99452190F Q15*/ /* = sin(7*(PI/2.0)/(8 - 0.5)) */
-};
-
-
-/*----------------------------------------------------------------------------------*
- * IGF settings for each bitrate
- *----------------------------------------------------------------------------------*/
-
-const Word16 swb_offset_LB_new[IGF_BITRATE_UNKNOWN][IGF_MAX_SFB] = // Q0
-{
- /* 0: for 9600 kbs WB */
- {
- 4, 164, 186, 242, 320
- },
- /* 1: for 13200 kbs WB RF */
- {
- 4, 164, 186, 242, 320
- },
- /* 2: for 9600 kbs SWB */
- {
- 4, 200, 322, 444, 566
- },
- /* 3: for 13200 kbs SWB */
- {
- 7, 256, 288, 328, 376, 432, 496, 566
- },
- /* 4: for 13200 kbs SWB RF */
- {
- 4, 200, 322, 444, 566
- },
- /* 5: for 16400 kbs SWB */
- {
- 8, 256, 288, 328, 376, 432, 496, 576, 640
- },
- /* 6: for 24400 kbs SWB */
- {
- 9, 256, 284, 318, 358, 402, 450, 508, 576, 640
- },
- /* 7: for 32000 kbs SWB */
- {
- 9, 256, 284, 318, 358, 402, 450, 508, 576, 640
- },
- /* 8: for 48000 kbs SWB */
- {
- 4, 512, 534, 576, 640
- },
- /* 9: for 64000 kbs SWB */
- {
- 4, 512, 534, 576, 640
- },
- /* 10: for 16400 kbs FB */
- {
- 10, 256, 288, 328, 376, 432, 496, 576, 640, 720, 800
- },
- /* 11: for 24400 kbs FB */
- {
- 11, 256, 284, 318, 358, 402, 450, 508, 576, 640, 720, 800
- },
- /* 12: for 32000 kbs FB */
- {
- 11, 256, 284, 318, 358, 402, 450, 508, 576, 640, 720, 800
- },
- /* 13: for 48000 kbs FB */
- {
- 5, 512, 584, 656, 728, 800
- },
- /* 14: for 64000 kbs FB */
- {
- 5, 512, 584, 656, 728, 800
- },
- /* 15: for 96000 kbs FB */
- {
- 3, 640, 720, 800 /* old: 640, 760, 880 */
- },
- /* 16: for 128000 kbs FB */
- {
- 3, 640, 720, 800 /* old: 640, 760, 880 */
- },
- /* 17: for 13200 kbs WB (stereo) */
- {
- 3, 196, 248, 320
- },
- /* 18: for 16400 kbs WB (stereo) */
- {
- 3, 228, 268, 320
- },
- /* 19: for 13200 kbs SWB (stereo) */
- {
- 5, 200, 264, 344, 440, 566
- },
- /* 20: for 16400 kbs SWB (stereo) */
- {
- 7, 228, 264, 308, 360, 420, 488, 566
- },
- /* 21: for 24400 kbs SWB (stereo) */
- {
- 8, 256, 288, 328, 376, 432, 496, 576, 640
- },
- /* 22: for 32000 kbs SWB (stereo) */
- {
- 9, 256, 284, 320, 360, 404, 452, 508, 576, 640
- },
- /* 23: for 48000 kbs SWB (stereo) */
- {
- 7, 360, 392, 424, 464, 508, 560, 640
- },
- /* 24: for 48000 kbs SWB (stereo TCX10) */
- {
- 4, 360, 424, 508, 640
- },
- /* 25: for 64000 kbs SWB (stereo) */
- {
- 8, 400, 424, 448, 476, 508, 540, 576, 640
- },
- /* 26: for 80000 kbs SWB (stereo) */
- {
- 5, 464, 496, 532, 576, 640
- },
- /* 27: for 96000 kbs SWB (stereo) */
- {
- 4, 512, 536, 576, 640
- },
- /* 28: for 24400 kbs FB (stereo) */
- {
- 10, 256, 288, 328, 376, 432, 496, 576, 640, 720, 800
- },
- /* 29: for 32000 kbs FB (stereo) */
- {
- 11, 256, 284, 320, 360, 404, 452, 508, 576, 640, 720, 800
- },
- /* 30: for 48000 kbs FB (stereo) */
- {
- 9, 360, 392, 424, 464, 508, 560, 640, 720, 800
- },
- /* 31: for 48000 kbs FB (stereo TCX10) */
- {
- 5, 360, 424, 508, 640, 800
- },
- /* 32: for 64000 kbs FB (stereo) */
- {
- 10, 400, 424, 448, 476, 508, 540, 576, 640, 720, 800
- },
- /* 33: for 80000 kbs FB (stereo) */
- {
- 7, 464, 496, 532, 576, 640, 720, 800
- },
- /* 34: for 96000 kbs FB (stereo) */
- {
- 6, 512, 536, 576, 640, 720, 800
- },
- /* 35: for 128000 kbs FB (stereo) */
- {
- 3, 640, 720, 800
- }
-};/*Q0*/
-
-const Word16 igf_tile_offset_table[IGF_BITRATE_UNKNOWN][2*IGF_MAX_TILES+1] = { // Q0
- { 2, 2, 0, 3, 0}, /* 9600 WB*/
- { 2, 2, 0, 3, 0}, /* 13200 WB RF */
- { 3, 1, 0, 2, 32, 3, 46}, /* 9600 SWB */
- { 2, 4, 0, 6, 32}, /* 13200 SWB RF */
- { 3, 1, 0, 2, 32, 3, 46}, /* 13200 SWB */
- { 3, 4, 0, 6, 48, 7, 64}, /* 16400 SWB */
- { 3, 4, 0, 7, 32, 8, 64}, /* 24400 SWB */
- { 3, 4, 0, 7, 32, 8, 64}, /* 32000 SWB */
- { 1, 3, 320}, /* 48000 SWB */
- { 1, 3, 320}, /* 64000 SWB */
- { 3, 4, 0, 7, 0, 9, 0}, /* 16400 FB */
- { 4, 4, 0, 6, 32, 9, 0, 10, 80}, /* 24400 FB */
- { 4, 4, 0, 6, 32, 9, 0, 10, 80}, /* 32000 FB */
- { 1, 4, 160}, /* 48000 FB */
- { 1, 4, 160}, /* 64000 FB */
- { 1, 2, 416}, /* 96000 FB */
- { 1, 2, 416}, /*128000 FB */
- { 2, 1, 40, 2, 92}, /* 13200 WB (stereo) */
- { 2, 1, 80, 2, 120}, /* 16400 WB (stereo) */
- { 4, 1, 0, 2, 32, 3, 46, 4, 40}, /* 13200 SWB (stereo) */
- { 6, 1, 0, 2, 36, 3, 80, 4, 132, 5, 32, 6, 100 }, /* 16400 SWB (stereo) */
- { 7, 1, 0, 2, 32, 3, 72, 4, 120, 5, 48, 6, 112, 7, 64 }, /* 24400 SWB (stereo) */
- { 8, 1, 0, 2, 28, 3, 64, 4, 104, 5, 32, 6, 80, 7, 136, 8, 64 }, /* 32000 SWB (stereo) */
- { 6, 1, 120, 2, 152, 3, 184, 4, 224, 5, 140, 6, 192}, /* 48000 SWB (stereo) */
- { 3, 1, 0, 2, 40, 3, 80 }, /* 48000 SWB (stereo TCX10) */
- { 4, 2, 80, 4, 128, 6, 144, 7, 212 }, /* 64000 SWB (stereo) */
- { 2, 2, 212, 4, 280 }, /* 80000 SWB (stereo) */
- { 1, 3, 200}, /* 96000 SWB (stereo) */
- { 9, 1, 0, 2, 32, 3, 72, 4, 120, 5, 48, 6, 112, 7, 64, 8, 0, 9, 80 }, /* 24400 FB (stereo) */
- {10, 1, 0, 2, 28, 3, 64, 4, 104, 5, 32, 6, 80, 7, 136, 8, 64, 9, 0, 10, 80 }, /* 32000 FB (stereo) */
- { 7, 1, 120, 2, 152, 3, 184, 4, 224, 5, 140, 6, 192, 8, 140}, /* 48000 FB (stereo) */
- { 4, 1, 0, 2, 40, 3, 80, 4, 140 }, /* 48000 FB (stereo TCX10) */
- { 5, 2, 80, 4, 128, 6, 144, 7, 212, 9, 160 }, /* 64000 FB (stereo) */
- { 3, 2, 212, 4, 280, 6, 200 }, /* 80000 FB (stereo) */
- { 2, 3, 200, 5, 240}, /* 96000 FB (stereo) */
- { 1, 2, 416} /*128000 FB (stereo) */
-};
-
-const Word16 igf_whitening_TH_ivas_fx[][2][IGF_MAX_TILES] =
-{
- /* 0: for 9600 kbs WB */
- {
- /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 1: for 13200 kbs WB RF */
- {
- /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 2: for 9600 kbs SWB */
- {
- /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 3: for 13200 kbs SWB */
- {
- /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 4: for 13200 kbs SWB RF */
- {
- /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 5: for 16400 kbs SWB */
- {
- /* medium */ { 6799/*0.83f Q13*/, 7291/*0.89f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10732/*1.31f Q13*/, 9748/*1.19f Q13*/, 9748/*1.19f Q13*/, 0/*0.f Q13*/}
- },
- /* 6: for 24400 kbs SWB*/
- {
- /* medium */ { 6636/*0.81f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 11059/*1.35f Q13*/, 10076/*1.23f Q13*/, 10076/*1.23f Q13*/, 0/*0.f Q13*/}
- },
- /* 7: for 32000 kbs SWB */
- {
- /* medium */ { 7455/*0.91f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10977/*1.34f Q13*/, 11059/*1.35f Q13*/, 11059/*1.35f Q13*/, 0/*0.f Q13*/}
- },
- /* 8: for 48000 kbs SWB */
- {
- /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 9: for 64000 kbs SWB */
- {
- /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 10: for 16400 kbs FB */
- {
- /* medium */ { 5161/*0.63f Q13*/, 2212/*0.27f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 12534/*1.53f Q13*/, 10813/*1.32f Q13*/, 5489/*0.67f Q13*/, 0/*0.f Q13*/}
- },
- /* 11: for 24400 kbs FB */
- {
- /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
- /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
- },
- /* 12: for 32000 kbs FB */
- {
- /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
- /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
- },
- /* 13: for 48000 kbs FB */
- {
- /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 14: for 64000 kbs FB */
- {
- /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 15: for 96000 kbs FB */
- {
- /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 16: for 128000 kbs FB */
- {
- /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
- },
- /* 17: for 13200 kbs WB (stereo) */
- {
- /* medium */ {6554/*0.800000 Q13*/, 6144/*0.750000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ },
- /* strong */ {12288/*1.500000 Q13*/, 11878/*1.450000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 18: for 16400 kbs WB (stereo) */
- {
-
- /* medium */ {7373/*0.900000 Q13*/, 6963/*0.850000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ },
- /* strong */ {13107/*1.600000 Q13*/, 12288/*1.500000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 19: for 13200 kbs SWB (stereo) */
- {
- /* medium */ {7291/*0.890000 Q13*/, 7291/*0.890000 Q13*/, 6554/*0.800000 Q13*/, 6554/*0.800000 Q13*/, },
- /* strong */ {10240/*1.250000 Q13*/, 10240/*1.250000 Q13*/, 9748/*1.190000 Q13*/, 9748/*1.190000 Q13*/, }
- },
- /* 20: for 16400 kbs SWB (stereo) */
- {
- /* medium */ {8602/*1.050000 Q13*/, 8602/*1.050000 Q13*/, 9011/*1.100000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8602/*1.050000 Q13*/, },
- /* strong */ {13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13517/*1.650000 Q13*/, 13517/*1.650000 Q13*/, 13107/*1.600000 Q13*/, 12288/*1.500000 Q13*/, }
- },
- /* 21: for 24400 kbs SWB (stereo) */
- {
- /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, },
- /* strong */ {13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, }
- },
- /* 22: for 32000 kbs SWB (stereo) */
- {
- /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, },
- /* strong */ {14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 13517/*1.650000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, }
- },
- /* 23: for 48000 kbs SWB (stereo) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
- {
- /* medium */ {6144/*0.750000 Q13*/, 5734/*0.700000 Q13*/, 4096/*0.500000 Q13*/, 0/*0.000000 Q13*/ },
- /* strong */ {10240/*1.250000 Q13*/, 9011/*1.100000 Q13*/, 8192/*1.000000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 24: for 48000 kbs SWB (stereo TCX10) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
- {
- /* medium */ {6144/*0.750000 Q13*/, 5734/*0.700000 Q13*/, 4096/*0.500000 Q13*/, 0/*0.000000 Q13*/ },
- /* strong */ {10240/*1.250000 Q13*/, 9011/*1.100000 Q13*/, 8192/*1.000000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 25: for 64000 kbs SWB (stereo) */
- {
- /* medium */ {8192/*1.000000 Q13*/, 8192/*1.000000 Q13*/, 9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/ },
- /* strong */ {12288/*1.500000 Q13*/, 12288/*1.500000 Q13*/, 13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/ }
- },
- /* 26: for 80000 kbs SWB (stereo) */
- {
- /* medium */ {9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/, 0/*0.000000 Q13*/ },
- /* strong */ {13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 27: for 96000 kbs SWB (stereo) */
- {
- /* medium */ {9421/*1.150000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ },
- /* strong */ {9748/*1.190000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 28: for 24400 kbs FB (stereo) */
- {
- /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, 2785/*0.340000 Q13*/, 2785/*0.340000 Q13*/ },
- /* strong */ {13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, 5325/*0.650000 Q13*/, 5325/*0.650000 Q13*/ }
- },
- /* 29: for 32000 kbs FB (stereo) */
- {
- /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, 2785/*0.340000 Q13*/, 2785/*0.340000 Q13*/ },
- /* strong */ {14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 13517/*1.650000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, 5325/*0.650000 Q13*/, 5325/*0.650000 Q13*/ }
- },
- /* 30: for 48000 kbs FB (stereo) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
- {
- /* medium */ {6390/*0.780000 Q13*/, 2540/*0.310000 Q13*/, 2785/*0.340000 Q13*/, 2785/*0.340000 Q13*/ },
- /* strong */ {12206/*1.490000 Q13*/, 11305/*1.380000 Q13*/, 5325/*0.650000 Q13*/, 5325/*0.650000 Q13*/ }
- },
- /* 31: for 48000 kbs FB (stereo TCX10) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
- {
- /* medium */ {6144/*0.750000 Q13*/, 5734/*0.700000 Q13*/, 4096/*0.500000 Q13*/, 4096/*0.500000 Q13*/ },
- /* strong */ {10240/*1.250000 Q13*/, 9011/*1.100000 Q13*/, 8192/*1.000000 Q13*/, 8192/*1.000000 Q13*/ }
- },
- /* 32: for 64000 kbs FB (stereo) */
- {
- /* medium */ {8192/*1.000000 Q13*/, 8192/*1.000000 Q13*/, 9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/, 6144/*0.750000 Q13*/ },
- /* strong */ {12288/*1.500000 Q13*/, 12288/*1.500000 Q13*/, 13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/, 8192/*1.000000 Q13*/ }
- },
- /* 33: for 80000 kbs FB (stereo) */
- {
- /* medium */ {9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/, 6144/*0.750000 Q13*/, 0/*0.000000 Q13*/ },
- /* strong */ {13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/, 8192/*1.000000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 34: for 96000 kbs FB (stereo) */
- {
- /* medium */ {7455/*0.910000 Q13*/, 6963/*0.850000 Q13*/ , 0/*0.000000 Q13*/ },
- /* strong */ {10977/*1.340000 Q13*/, 11059/*1.350000 Q13*/, 0/*0.000000 Q13*/ }
- },
- /* 35: for 128000 kbs FB (stereo) */
- {
- /* medium */ { 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/},
- /* strong */ {23101/*2.820000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/}
- }
-};
-const Word16 igf_whitening_TH[][2][IGF_MAX_TILES] =
-{
- /* 0: for 9600 kbs WB */
- {
- /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 1: for 13200 kbs WB RF */
-{
- /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 2: for 9600 kbs SWB */
-{
- /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 3: for 13200 kbs SWB */
-{
- /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 4: for 13200 kbs SWB RF */
-{
- /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 5: for 16400 kbs SWB */
-{
- /* medium */ { 6799/*0.83f Q13*/, 7291/*0.89f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10732/*1.31f Q13*/, 9748/*1.19f Q13*/, 9748/*1.19f Q13*/, 0/*0.f Q13*/}
-},
-/* 6: for 24400 kbs SWB*/
-{
- /* medium */ { 6636/*0.81f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 11059/*1.35f Q13*/, 10076/*1.23f Q13*/, 10076/*1.23f Q13*/, 0/*0.f Q13*/}
-},
-/* 7: for 32000 kbs SWB */
-{
- /* medium */ { 7455/*0.91f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 10977/*1.34f Q13*/, 11059/*1.35f Q13*/, 11059/*1.35f Q13*/, 0/*0.f Q13*/}
-},
-/* 8: for 48000 kbs SWB */
-{
- /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 9: for 64000 kbs SWB */
-{
- /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 10: for 16400 kbs FB */
-{
- /* medium */ { 5161/*0.63f Q13*/, 2212/*0.27f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 12534/*1.53f Q13*/, 10813/*1.32f Q13*/, 5489/*0.67f Q13*/, 0/*0.f Q13*/}
-},
-/* 11: for 24400 kbs FB */
-{
- /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
- /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
-},
-/* 12: for 32000 kbs FB */
-{
- /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
- /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
-},
-/* 13: for 48000 kbs FB */
-{
- /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 14: for 64000 kbs FB */
-{
- /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 15: for 96000 kbs FB */
-{
- /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-},
-/* 16: for 128000 kbs FB */
-{
- /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
- /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
-}
-};
-
-/* IGF SCF arithmetic coder cumulative frequency tables and offsets */
-
-const Word16 cf_off_se01_tab[10] = { // Q0
- +1, /* 9.6 kbs B*/
- +1, /* 13.2 kbs WB RF B*/
- +1, /* 9.6 kbs SWB B*/
- +1, /* 13.2 kbs A*/
- +1, /* 13.2 kbs SWB RF B*/
- +1, /* 16.4 kbs B*/
- +1, /* 24.4 kbs B*/
- +1, /* 32.0 kbs A*/
- -1, /* 48.0 kbs B*/
- -1 /* 64.0 kbs B*/
-};
-
-const Word16 cf_off_se02_tab[10][IGF_CTX_COUNT] = { // Q0
- { +1, +2, +2, +2, +3, +3, +4}, /* 9.6 kbs B*/
- { +1, +2, +2, +2, +3, +3, +4}, /* 13.2 kbs WB RF B*/
- { +0, +2, +3, +3, +2, +2, +4}, /* 9.6 kbs SWB B*/
- { +0, +2, +3, +3, +2, +2, +4}, /* 13.2 kbs A*/
- { +0, +2, +3, +3, +2, +2, +4}, /* 13.2 kbs SWB RF B*/
- { +0, +2, +3, +3, +2, +2, +4}, /* 16.4 kbs B*/
- { -1, +2, +2, +2, +2, +3, +5}, /* 24.4 kbs B*/
- { -1, +2, +2, +2, +2, +3, +5}, /* 32.0 kbs A*/
- { +3, +2, +3, +2, +3, +3, +6}, /* 48.0 kbs B*/
- { +3, +2, +3, +2, +3, +3, +6} /* 64.0 kbs B*/
-};
-
-const Word16 cf_off_se10_tab = -7; // Q0
-
-const Word16 cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT] = // Q0
-{
- { -5, +0, +0, +0, +0, +0, +0},
- { +0, +0, +0, +0, +0, +0, +0},
- { +0, +0, +0, +0, +0, +0, +0},
- { +0, +0, +0, +0, +0, +0, +0},
- { +0, +0, +0, +0, +0, +0, +0},
- { +0, +0, +0, +0, +0, +0, +1},
- { +0, +1, +0, +0, +3, +0, +3}
-};
-
-const UWord16 cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1] = // Q0
-{
- 16384, 16356, 16299, 16185, 15904, 15282, 14669, 13598, 11886, 9541, 6613, 3845, 1799, 606, 153, 32, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
-};
-
-const UWord16 cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1] = // Q0
-{
- {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 9.6 kbs B*/
- {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 13.2 kbs WB RF B*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 9.6 kbs SWB B*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs A*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs SWB RF B*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 16.4 kbs B*/
- {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0 }, /* 24.4 kbs B*/
- {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0}, /* 32.0 kbs A*/
- {16384, 16368, 16355, 16334, 16291, 16212, 16071, 15816, 15359, 14523, 13014, 10534, 7345, 4272, 2228, 1149, 626, 357, 215, 139, 93, 67, 53, 43, 36, 28, 22, 0}, /* 48.0 kbs B*/
- {16384, 16368, 16355, 16334, 16291, 16212, 16071, 15816, 15359, 14523, 13014, 10534, 7345, 4272, 2228, 1149, 626, 357, 215, 139, 93, 67, 53, 43, 36, 28, 22, 0} /* 64.0 kbs B*/
-};
-
-const UWord16 cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = // Q0
-{
- { /* 9.6 kbs B */
- { 16384, 16369, 16348, 16316, 16256, 16172, 16017, 15735, 15246, 14363, 13036, 11139, 8916, 6724, 4757, 3282, 2221, 1549, 1105, 771, 548, 364, 238, 151, 89, 50, 30, 0},
- { 16384, 16371, 16358, 16339, 16290, 16241, 16153, 16040, 15813, 15397, 14601, 13301, 11360, 8916, 6254, 3911, 2220, 1280, 755, 461, 278, 177, 111, 70, 35, 20, 12, 0},
- { 16384, 16375, 16359, 16333, 16286, 16243, 16154, 16024, 15771, 15380, 14712, 13537, 11742, 9425, 6872, 4378, 2327, 1197, 671, 412, 259, 145, 93, 52, 26, 13, 5, 0},
- { 16384, 16372, 16358, 16326, 16289, 16241, 16147, 16014, 15765, 15321, 14670, 13546, 11912, 9787, 7323, 4824, 2536, 1330, 731, 438, 258, 148, 86, 37, 22, 11, 2, 0},
- { 16384, 16376, 16364, 16344, 16315, 16272, 16219, 16119, 15910, 15620, 15100, 14254, 13063, 11489, 9413, 7100, 4738, 2751, 1584, 973, 597, 349, 201, 96, 47, 22, 9, 0},
- { 16384, 16364, 16340, 16312, 16288, 16237, 16166, 16026, 15756, 15390, 14833, 13870, 12627, 10998, 8985, 6893, 4720, 3048, 1860, 1131, 725, 449, 215, 111, 56, 34, 14, 0},
- { 16384, 16326, 16297, 16246, 16183, 16064, 15884, 15632, 15240, 14763, 14107, 13230, 12185, 10886, 9390, 7781, 6194, 4696, 3350, 2259, 1506, 975, 604, 356, 201, 106, 48, 0}
- },
- { /* 13.2 kbs WB RF B*/
- { 16384, 16369, 16348, 16316, 16256, 16172, 16017, 15735, 15246, 14363, 13036, 11139, 8916, 6724, 4757, 3282, 2221, 1549, 1105, 771, 548, 364, 238, 151, 89, 50, 30, 0},
- { 16384, 16371, 16358, 16339, 16290, 16241, 16153, 16040, 15813, 15397, 14601, 13301, 11360, 8916, 6254, 3911, 2220, 1280, 755, 461, 278, 177, 111, 70, 35, 20, 12, 0},
- { 16384, 16375, 16359, 16333, 16286, 16243, 16154, 16024, 15771, 15380, 14712, 13537, 11742, 9425, 6872, 4378, 2327, 1197, 671, 412, 259, 145, 93, 52, 26, 13, 5, 0},
- { 16384, 16372, 16358, 16326, 16289, 16241, 16147, 16014, 15765, 15321, 14670, 13546, 11912, 9787, 7323, 4824, 2536, 1330, 731, 438, 258, 148, 86, 37, 22, 11, 2, 0},
- { 16384, 16376, 16364, 16344, 16315, 16272, 16219, 16119, 15910, 15620, 15100, 14254, 13063, 11489, 9413, 7100, 4738, 2751, 1584, 973, 597, 349, 201, 96, 47, 22, 9, 0},
- { 16384, 16364, 16340, 16312, 16288, 16237, 16166, 16026, 15756, 15390, 14833, 13870, 12627, 10998, 8985, 6893, 4720, 3048, 1860, 1131, 725, 449, 215, 111, 56, 34, 14, 0},
- { 16384, 16326, 16297, 16246, 16183, 16064, 15884, 15632, 15240, 14763, 14107, 13230, 12185, 10886, 9390, 7781, 6194, 4696, 3350, 2259, 1506, 975, 604, 356, 201, 106, 48, 0}
- },
- { /* 9.6 kbs SWB B*/
- { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
- { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
- { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
- { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
- { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
- { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
- { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
- },
- { /* 13.2 kbs A */
- { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
- { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
- { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
- { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
- { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
- { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
- { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
- },
- { /* 13.2 kbs SWB RF B*/
- { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
- { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
- { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
- { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
- { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
- { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
- { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
- },
- { /* 16.4 kbs B */
- { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
- { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
- { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
- { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
- { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
- { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
- { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
- },
- { /* 24.4 kbs B */
- { 16384, 16351, 16333, 16303, 16254, 16163, 15993, 15681, 15080, 13987, 12109, 9465, 6588, 4160, 2488, 1480, 912, 589, 389, 266, 190, 131, 93, 68, 47, 34, 24, 0},
- { 16384, 16379, 16375, 16369, 16360, 16345, 16328, 16286, 16211, 16078, 15810, 15233, 14058, 11933, 8881, 5609, 2940, 1290, 558, 274, 150, 80, 47, 29, 17, 11, 6, 0},
- { 16384, 16382, 16380, 16377, 16370, 16358, 16337, 16300, 16224, 16088, 15811, 15233, 14112, 12019, 9061, 5723, 2780, 1121, 480, 239, 123, 69, 41, 22, 13, 8, 5, 0},
- { 16384, 16377, 16375, 16369, 16363, 16351, 16325, 16268, 16172, 16009, 15686, 15039, 13830, 11799, 8924, 5422, 2444, 960, 441, 220, 111, 63, 37, 22, 11, 6, 3, 0},
- { 16384, 16374, 16369, 16363, 16356, 16335, 16290, 16214, 16068, 15826, 15382, 14550, 13126, 10956, 8000, 4622, 2090, 973, 478, 249, 128, 75, 42, 19, 13, 7, 4, 0},
- { 16384, 16375, 16370, 16367, 16362, 16340, 16298, 16232, 16097, 15860, 15440, 14718, 13570, 11874, 9557, 6790, 4053, 2166, 1150, 622, 323, 179, 96, 53, 33, 17, 12, 0},
- { 16384, 16335, 16304, 16276, 16228, 16166, 16094, 15983, 15775, 15501, 15040, 14417, 13552, 12326, 10847, 9117, 7308, 5373, 3666, 2297, 1336, 807, 495, 313, 216, 152, 114, 0}
- },
- { /* 32.0 kbs A */
- { 16384, 16351, 16333, 16303, 16254, 16163, 15993, 15681, 15080, 13987, 12109, 9465, 6588, 4160, 2488, 1480, 912, 589, 389, 266, 190, 131, 93, 68, 47, 34, 24, 0},
- { 16384, 16379, 16375, 16369, 16360, 16345, 16328, 16286, 16211, 16078, 15810, 15233, 14058, 11933, 8881, 5609, 2940, 1290, 558, 274, 150, 80, 47, 29, 17, 11, 6, 0},
- { 16384, 16382, 16380, 16377, 16370, 16358, 16337, 16300, 16224, 16088, 15811, 15233, 14112, 12019, 9061, 5723, 2780, 1121, 480, 239, 123, 69, 41, 22, 13, 8, 5, 0},
- { 16384, 16377, 16375, 16369, 16363, 16351, 16325, 16268, 16172, 16009, 15686, 15039, 13830, 11799, 8924, 5422, 2444, 960, 441, 220, 111, 63, 37, 22, 11, 6, 3, 0},
- { 16384, 16374, 16369, 16363, 16356, 16335, 16290, 16214, 16068, 15826, 15382, 14550, 13126, 10956, 8000, 4622, 2090, 973, 478, 249, 128, 75, 42, 19, 13, 7, 4, 0},
- { 16384, 16375, 16370, 16367, 16362, 16340, 16298, 16232, 16097, 15860, 15440, 14718, 13570, 11874, 9557, 6790, 4053, 2166, 1150, 622, 323, 179, 96, 53, 33, 17, 12, 0},
- { 16384, 16335, 16304, 16276, 16228, 16166, 16094, 15983, 15775, 15501, 15040, 14417, 13552, 12326, 10847, 9117, 7308, 5373, 3666, 2297, 1336, 807, 495, 313, 216, 152, 114, 0}
- },
- { /* 48.0 kbs B */
- { 16384, 16334, 16310, 16285, 16254, 16204, 16128, 16031, 15903, 15697, 15380, 14820, 13857, 12267, 9878, 7099, 4509, 2576, 1478, 871, 531, 349, 230, 163, 111, 80, 62, 0},
- { 16384, 16337, 16327, 16307, 16278, 16239, 16178, 16092, 15947, 15719, 15286, 14428, 12833, 10246, 7123, 4088, 1896, 849, 481, 287, 190, 139, 94, 66, 52, 34, 24, 0},
- { 16384, 16352, 16341, 16329, 16312, 16295, 16265, 16223, 16151, 16026, 15825, 15437, 14645, 13089, 10612, 7364, 4077, 1783, 779, 444, 281, 192, 138, 93, 65, 43, 30, 0},
- { 16384, 16354, 16347, 16337, 16314, 16284, 16233, 16165, 16051, 15847, 15450, 14621, 13069, 10623, 7298, 3789, 1569, 727, 445, 302, 207, 143, 96, 59, 36, 18, 9, 0},
- { 16384, 16352, 16342, 16330, 16314, 16295, 16266, 16215, 16127, 15984, 15709, 15190, 14242, 12540, 9979, 6448, 3160, 1392, 752, 481, 344, 251, 169, 115, 73, 28, 8, 0},
- { 16384, 16340, 16320, 16302, 16272, 16257, 16220, 16135, 16011, 15784, 15370, 14688, 13423, 11457, 8721, 5529, 2736, 1375, 784, 525, 353, 263, 172, 113, 78, 26, 11, 0},
- { 16384, 16238, 16170, 16113, 16077, 16030, 16000, 15948, 15873, 15752, 15535, 15157, 14595, 13788, 12569, 10767, 8611, 6186, 4101, 2459, 1478, 881, 607, 385, 243, 168, 116, 0}
- },
- { /* 64.0 kbs B */
- { 16384, 16334, 16310, 16285, 16254, 16204, 16128, 16031, 15903, 15697, 15380, 14820, 13857, 12267, 9878, 7099, 4509, 2576, 1478, 871, 531, 349, 230, 163, 111, 80, 62, 0},
- { 16384, 16337, 16327, 16307, 16278, 16239, 16178, 16092, 15947, 15719, 15286, 14428, 12833, 10246, 7123, 4088, 1896, 849, 481, 287, 190, 139, 94, 66, 52, 34, 24, 0},
- { 16384, 16352, 16341, 16329, 16312, 16295, 16265, 16223, 16151, 16026, 15825, 15437, 14645, 13089, 10612, 7364, 4077, 1783, 779, 444, 281, 192, 138, 93, 65, 43, 30, 0},
- { 16384, 16354, 16347, 16337, 16314, 16284, 16233, 16165, 16051, 15847, 15450, 14621, 13069, 10623, 7298, 3789, 1569, 727, 445, 302, 207, 143, 96, 59, 36, 18, 9, 0},
- { 16384, 16352, 16342, 16330, 16314, 16295, 16266, 16215, 16127, 15984, 15709, 15190, 14242, 12540, 9979, 6448, 3160, 1392, 752, 481, 344, 251, 169, 115, 73, 28, 8, 0},
- { 16384, 16340, 16320, 16302, 16272, 16257, 16220, 16135, 16011, 15784, 15370, 14688, 13423, 11457, 8721, 5529, 2736, 1375, 784, 525, 353, 263, 172, 113, 78, 26, 11, 0},
- { 16384, 16238, 16170, 16113, 16077, 16030, 16000, 15948, 15873, 15752, 15535, 15157, 14595, 13788, 12569, 10767, 8611, 6186, 4101, 2459, 1478, 881, 607, 385, 243, 168, 116, 0}
- }
-};
-
-/* only needed for >= 48 kbps */
-
-const UWord16 cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1] = // Q0
-{
- 16384, 15493, 15154, 14810, 14331, 13701, 13086, 12403, 11585, 10923, 10293, 9631, 8943, 8385, 7760, 7182, 6593, 6009, 5540, 5082, 4571, 4133, 3711, 3299, 2887, 2460, 2043, 0
-};
-
-const UWord16 cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = // Q0
-{
- {
- { 16384, 16313, 16312, 16241, 16206, 16099, 15957, 15386, 14601, 12852, 10282, 7534, 4964, 2966, 1824, 896, 504, 255, 113, 112, 41, 40, 39, 38, 37, 36, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16207, 16206, 16205, 16120, 15949, 14663, 12777, 9947, 6860, 3773, 1972, 772, 430, 259, 174, 89, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16115, 15941, 14891, 12965, 11477, 8587, 5347, 3421, 1407, 620, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16254, 16253, 16004, 15005, 13756, 12006, 9256, 5755, 3755, 1755, 756, 132, 131, 130, 129, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15964, 15550, 14929, 12856, 9954, 6430, 2906, 1456, 1042, 628, 214, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16087, 15503, 14334, 14333, 11994, 10240, 8193, 5268, 2929, 1760, 1176, 299, 298, 297, 296, 295, 294, 293, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 14922, 13467, 10919, 9464, 7280, 6189, 3641, 2914, 2187, 1824, 1823, 1096, 369, 368, 367, 4, 3, 2, 1, 0}
- },
- {
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16238, 16237, 15678, 15399, 14840, 13441, 11341, 8681, 6161, 3781, 2522, 702, 283, 144, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16374, 15693, 14671, 12625, 7507, 4778, 2390, 1368, 1028, 347, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16374, 15595, 13776, 9877, 6498, 3639, 3120, 1561, 1042, 523, 265, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 15709, 13704, 12702, 11032, 7355, 3010, 1340, 1007, 674, 341, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16374, 12816, 10683, 7125, 2854, 720, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 12738, 12737, 10920, 9103, 5466, 1828, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 15359, 15358, 14337, 14336, 14335, 14334, 14333, 10240, 7170, 5124, 2054, 1032, 1031, 1030, 1029, 7, 6, 5, 4, 3, 2, 1, 0}
- },
- {
- { 16384, 16383, 16382, 16107, 16106, 16105, 16104, 16103, 15966, 15965, 15690, 15140, 14315, 12939, 10324, 8122, 4956, 2479, 1654, 966, 691, 416, 141, 140, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15320, 14265, 12945, 10568, 8984, 6343, 4230, 1853, 797, 270, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16112, 16111, 16110, 15037, 14501, 12622, 11012, 7790, 5374, 3226, 1347, 542, 275, 274, 273, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15597, 14819, 12090, 7021, 4292, 1953, 1175, 787, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 15935, 14165, 12838, 9297, 6641, 3985, 1772, 1331, 890, 449, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 14740, 13923, 9010, 6555, 4100, 2464, 828, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 13104, 13103, 8192, 4920, 1647, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
- },
- {
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16077, 16076, 16075, 15926, 15176, 14425, 10819, 7664, 5711, 2856, 1354, 754, 454, 154, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16044, 16043, 14373, 12369, 10030, 7023, 5019, 1677, 676, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16077, 16076, 16075, 15470, 14258, 12743, 11531, 6375, 3040, 3039, 917, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15309, 13531, 11396, 7480, 3564, 1786, 364, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15833, 15289, 13652, 10377, 6556, 3827, 3283, 1646, 555, 554, 553, 552, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 14146, 13404, 13403, 13402, 10425, 7448, 3727, 2240, 2239, 752, 751, 750, 749, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 15562, 14745, 13928, 10653, 7378, 5742, 2467, 830, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
- },
- {
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16219, 15590, 14803, 13544, 11339, 9292, 6930, 4568, 2521, 1419, 790, 318, 161, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16014, 15652, 14925, 14198, 12743, 10196, 5464, 3645, 1826, 371, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16050, 15396, 15395, 12447, 10810, 8518, 4915, 2950, 1313, 659, 333, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 14792, 14001, 11096, 8455, 6079, 3174, 2119, 535, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 15796, 15795, 15794, 15793, 11700, 8777, 6439, 4101, 1178, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 15473, 15472, 15471, 14563, 13655, 12746, 10017, 7288, 6379, 6378, 4559, 1830, 1829, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15723, 15069, 13105, 9174, 7865, 3934, 3280, 1971, 1317, 663, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
- },
- {
- { 16384, 16383, 16382, 16381, 16232, 16231, 16230, 16229, 16228, 16227, 16078, 15628, 15329, 13977, 12325, 10222, 5413, 4212, 1959, 908, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16109, 15842, 15841, 13694, 11815, 10205, 5640, 3493, 2151, 1347, 543, 542, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16168, 14699, 13650, 11761, 9452, 6093, 3784, 1685, 636, 427, 426, 425, 424, 423, 422, 421, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16122, 15611, 14332, 13053, 10238, 7423, 4608, 2561, 2050, 1027, 516, 515, 260, 259, 258, 257, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15207, 13649, 10531, 6632, 3514, 1176, 398, 397, 396, 395, 394, 393, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15749, 15120, 12601, 10082, 8823, 6304, 3785, 3156, 1267, 638, 637, 636, 7, 6, 5, 4, 3, 2, 1, 0},
- { 16384, 16383, 15729, 15728, 15727, 15726, 15725, 15071, 14417, 12453, 10489, 8525, 5905, 1975, 1321, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
- },
- {
- { 16384, 16383, 16372, 16340, 16339, 16328, 16285, 16253, 16136, 15923, 15614, 14931, 13833, 12201, 10175, 7615, 5269, 3243, 2123, 1142, 673, 342, 182, 150, 86, 54, 11, 0},
- { 16384, 16383, 16366, 16349, 16332, 16331, 16314, 16245, 16244, 16141, 15813, 15451, 14105, 12672, 9910, 7113, 4472, 2590, 1071, 484, 294, 156, 53, 36, 19, 18, 1, 0},
- { 16384, 16383, 16382, 16369, 16355, 16341, 16271, 16117, 15921, 15627, 14772, 13089, 10929, 8334, 5487, 3299, 1644, 999, 424, 228, 88, 46, 18, 17, 16, 15, 14, 0},
- { 16384, 16367, 16366, 16365, 16364, 16363, 16259, 16173, 15809, 15028, 13951, 12214, 9278, 6203, 3719, 2052, 1079, 402, 194, 125, 56, 22, 21, 20, 3, 2, 1, 0},
- { 16384, 16383, 16360, 16359, 16358, 16357, 16356, 16333, 16332, 16143, 15954, 15434, 14227, 12262, 9540, 6652, 3882, 1988, 1207, 829, 427, 191, 73, 50, 49, 2, 1, 0},
- { 16384, 16383, 16382, 16381, 16380, 16296, 16254, 15748, 14862, 13427, 11189, 8487, 5278, 3252, 2028, 1099, 551, 340, 298, 214, 172, 88, 46, 45, 3, 2, 1, 0},
- { 16384, 16383, 16307, 16269, 16231, 16230, 16077, 15886, 15464, 14620, 13546, 11896, 9671, 7024, 4338, 2382, 1423, 809, 541, 311, 158, 43, 5, 4, 3, 2, 1, 0}
- }
-};
-
-const IGF_MODE igfMode[IGF_BITRATE_UNKNOWN] =
-{
- /* sampleRate, frameLength, igfMinFq, maxHopsize */
- { 16000, 320, 774, 4 }, /* 9.6kbs WB 0 */
- { 16000, 320, 774, 4 }, /* 13.2kbs WB RF 1 */
- { 32000, 640, 800, 2 }, /* 9.6kbs SWB 2 */
- { 32000, 640, 800, 4 }, /* 13.2kbs SWB 3 */
- { 32000, 640, 800, 2 }, /* 13.2kbs SWB RF 4 */
- { 32000, 640, 800, 4 }, /* 16.4kbs SWB 5 */
- { 32000, 640, 800, 4 }, /* 24.4kbs SWB 6 */
- { 32000, 640, 800, 4 }, /* 32.0kbs SWB 7 */
- { 32000, 640, 1600, 4 }, /* 48.0kbs SWB 8 */
- { 32000, 640, 1600, 4 }, /* 64.0kbs SWB 9 */
- { 48000, 960, 800, 4 }, /* 16.4kbs FB 10 */
- { 48000, 960, 800, 2 }, /* 24.4kbs FB 11 */
- { 48000, 960, 800, 2 }, /* 32.0kbs FB 12 */
- { 48000, 960, 1600, 2 }, /* 48.0kbs FB 13 */
- { 48000, 960, 1600, 2 }, /* 64.0kbs FB 14 */
- { 48000, 960, 1600, 1 }, /* 96.0kbs FB 15 */
- { 48000, 960, 1600, 1 }, /*128.0kbs FB 16 */
- { 16000, 320, 800, 2 }, /* 13.2kbs WB CPE 17 */ /* stereo mode */
- { 16000, 320, 800, 2 }, /* 16.4kbs WB CPE 18 */ /* stereo mode */
- { 32000, 640, 800, 2 }, /* 13.2kbs SWB CPE 19 */ /* stereo mode */
- { 32000, 640, 800, 2 }, /* 16.4kbs SWB CPE 20 */ /* stereo mode */
- { 32000, 640, 800, 2 }, /* 24.4kbs SWB CPE 21 */ /* stereo mode */
- { 32000, 640, 800, 2 }, /* 32.0kbs SWB CPE 22 */ /* stereo mode */
- { 32000, 640, 1200, 2 }, /* 48.0kbs SWB CPE 23 */ /* stereo mode */
- { 32000, 640, 1200, 2 }, /* 48.0kbs SWB CPE 24 */ /* stereo TCX10 mode */
- { 32000, 640, 1200, 2 }, /* 64.0kbs SWB CPE 25 */ /* stereo mode */
- { 32000, 640, 1600, 2 }, /* 80.0kbs SWB CPE 26 */ /* stereo mode */
- { 32000, 640, 1600, 4 }, /* 96.0kbs SWB CPE 27 */ /* stereo mode */
- { 48000, 960, 800, 2 }, /* 24.4kbs FB CPE 28 */ /* stereo mode */
- { 48000, 960, 800, 2 }, /* 32.0kbs FB CPE 29 */ /* stereo mode */
- { 48000, 960, 1200, 2 }, /* 48.0kbs FB CPE 30 */ /* stereo mode */
- { 48000, 960, 1200, 2 }, /* 48.0kbs FB CPE 31 */ /* stereo TCX10 mode */
- { 48000, 960, 1200, 2 }, /* 64.0kbs FB CPE 32 */ /* stereo mode */
- { 48000, 960, 1600, 2 }, /* 80.0kbs FB CPE 33 */ /* stereo mode */
- { 48000, 960, 1600, 1 }, /* 96.0kbs FB CPE 34 */ /* stereo mode */
- { 48000, 960, 1600, 1 } /*128.0kbs FB CPE 35 */ /* stereo mode */
-};
-
-#define STCP( a, b ) {{ WORD322WORD16( a ), WORD322WORD16( b ) }}
-
-const PWord16 SineTable512_fx[] =//Q15
-{
- STCP(0x7fffffff, 0x00000000), STCP(0x7fffd886, 0x006487e3), STCP(0x7fff6216, 0x00c90f88), STCP(0x7ffe9cb2, 0x012d96b1),
- STCP(0x7ffd885a, 0x01921d20), STCP(0x7ffc250f, 0x01f6a297), STCP(0x7ffa72d1, 0x025b26d7), STCP(0x7ff871a2, 0x02bfa9a4),
- STCP(0x7ff62182, 0x03242abf), STCP(0x7ff38274, 0x0388a9ea), STCP(0x7ff09478, 0x03ed26e6), STCP(0x7fed5791, 0x0451a177),
- STCP(0x7fe9cbc0, 0x04b6195d), STCP(0x7fe5f108, 0x051a8e5c), STCP(0x7fe1c76b, 0x057f0035), STCP(0x7fdd4eec, 0x05e36ea9),
- STCP(0x7fd8878e, 0x0647d97c), STCP(0x7fd37153, 0x06ac406f), STCP(0x7fce0c3e, 0x0710a345), STCP(0x7fc85854, 0x077501be),
- STCP(0x7fc25596, 0x07d95b9e), STCP(0x7fbc040a, 0x083db0a7), STCP(0x7fb563b3, 0x08a2009a), STCP(0x7fae7495, 0x09064b3a),
- STCP(0x7fa736b4, 0x096a9049), STCP(0x7f9faa15, 0x09cecf89), STCP(0x7f97cebd, 0x0a3308bd), STCP(0x7f8fa4b0, 0x0a973ba5),
- STCP(0x7f872bf3, 0x0afb6805), STCP(0x7f7e648c, 0x0b5f8d9f), STCP(0x7f754e80, 0x0bc3ac35), STCP(0x7f6be9d4, 0x0c27c389),
- STCP(0x7f62368f, 0x0c8bd35e), STCP(0x7f5834b7, 0x0cefdb76), STCP(0x7f4de451, 0x0d53db92), STCP(0x7f434563, 0x0db7d376),
- STCP(0x7f3857f6, 0x0e1bc2e4), STCP(0x7f2d1c0e, 0x0e7fa99e), STCP(0x7f2191b4, 0x0ee38766), STCP(0x7f15b8ee, 0x0f475bff),
- STCP(0x7f0991c4, 0x0fab272b), STCP(0x7efd1c3c, 0x100ee8ad), STCP(0x7ef05860, 0x1072a048), STCP(0x7ee34636, 0x10d64dbd),
- STCP(0x7ed5e5c6, 0x1139f0cf), STCP(0x7ec8371a, 0x119d8941), STCP(0x7eba3a39, 0x120116d5), STCP(0x7eabef2c, 0x1264994e),
- STCP(0x7e9d55fc, 0x12c8106f), STCP(0x7e8e6eb2, 0x132b7bf9), STCP(0x7e7f3957, 0x138edbb1), STCP(0x7e6fb5f4, 0x13f22f58),
- STCP(0x7e5fe493, 0x145576b1), STCP(0x7e4fc53e, 0x14b8b17f), STCP(0x7e3f57ff, 0x151bdf86), STCP(0x7e2e9cdf, 0x157f0086),
- STCP(0x7e1d93ea, 0x15e21445), STCP(0x7e0c3d29, 0x16451a83), STCP(0x7dfa98a8, 0x16a81305), STCP(0x7de8a670, 0x170afd8d),
- STCP(0x7dd6668f, 0x176dd9de), STCP(0x7dc3d90d, 0x17d0a7bc), STCP(0x7db0fdf8, 0x183366e9), STCP(0x7d9dd55a, 0x18961728),
- STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x7d769bb5, 0x195b49ea), STCP(0x7d628ac6, 0x19bdcbf3), STCP(0x7d4e2c7f, 0x1a203e1b),
- STCP(0x7d3980ec, 0x1a82a026), STCP(0x7d24881b, 0x1ae4f1d6), STCP(0x7d0f4218, 0x1b4732ef), STCP(0x7cf9aef0, 0x1ba96335),
- STCP(0x7ce3ceb2, 0x1c0b826a), STCP(0x7ccda169, 0x1c6d9053), STCP(0x7cb72724, 0x1ccf8cb3), STCP(0x7ca05ff1, 0x1d31774d),
- STCP(0x7c894bde, 0x1d934fe5), STCP(0x7c71eaf9, 0x1df5163f), STCP(0x7c5a3d50, 0x1e56ca1e), STCP(0x7c4242f2, 0x1eb86b46),
- STCP(0x7c29fbee, 0x1f19f97b), STCP(0x7c116853, 0x1f7b7481), STCP(0x7bf88830, 0x1fdcdc1b), STCP(0x7bdf5b94, 0x203e300d),
- STCP(0x7bc5e290, 0x209f701c), STCP(0x7bac1d31, 0x21009c0c), STCP(0x7b920b89, 0x2161b3a0), STCP(0x7b77ada8, 0x21c2b69c),
- STCP(0x7b5d039e, 0x2223a4c5), STCP(0x7b420d7a, 0x22847de0), STCP(0x7b26cb4f, 0x22e541af), STCP(0x7b0b3d2c, 0x2345eff8),
- STCP(0x7aef6323, 0x23a6887f), STCP(0x7ad33d45, 0x24070b08), STCP(0x7ab6cba4, 0x24677758), STCP(0x7a9a0e50, 0x24c7cd33),
- STCP(0x7a7d055b, 0x25280c5e), STCP(0x7a5fb0d8, 0x2588349d), STCP(0x7a4210d8, 0x25e845b6), STCP(0x7a24256f, 0x26483f6c),
- STCP(0x7a05eead, 0x26a82186), STCP(0x79e76ca7, 0x2707ebc7), STCP(0x79c89f6e, 0x27679df4), STCP(0x79a98715, 0x27c737d3),
- STCP(0x798a23b1, 0x2826b928), STCP(0x796a7554, 0x288621b9), STCP(0x794a7c12, 0x28e5714b), STCP(0x792a37fe, 0x2944a7a2),
- STCP(0x7909a92d, 0x29a3c485), STCP(0x78e8cfb2, 0x2a02c7b8), STCP(0x78c7aba2, 0x2a61b101), STCP(0x78a63d11, 0x2ac08026),
- STCP(0x78848414, 0x2b1f34eb), STCP(0x786280bf, 0x2b7dcf17), STCP(0x78403329, 0x2bdc4e6f), STCP(0x781d9b65, 0x2c3ab2b9),
- STCP(0x77fab989, 0x2c98fbba), STCP(0x77d78daa, 0x2cf72939), STCP(0x77b417df, 0x2d553afc), STCP(0x7790583e, 0x2db330c7),
- STCP(0x776c4edb, 0x2e110a62), STCP(0x7747fbce, 0x2e6ec792), STCP(0x77235f2d, 0x2ecc681e), STCP(0x76fe790e, 0x2f29ebcc),
- STCP(0x76d94989, 0x2f875262), STCP(0x76b3d0b4, 0x2fe49ba7), STCP(0x768e0ea6, 0x3041c761), STCP(0x76680376, 0x309ed556),
- STCP(0x7641af3d, 0x30fbc54d), STCP(0x761b1211, 0x3158970e), STCP(0x75f42c0b, 0x31b54a5e), STCP(0x75ccfd42, 0x3211df04),
- STCP(0x75a585cf, 0x326e54c7), STCP(0x757dc5ca, 0x32caab6f), STCP(0x7555bd4c, 0x3326e2c3), STCP(0x752d6c6c, 0x3382fa88),
- STCP(0x7504d345, 0x33def287), STCP(0x74dbf1ef, 0x343aca87), STCP(0x74b2c884, 0x34968250), STCP(0x7489571c, 0x34f219a8),
- STCP(0x745f9dd1, 0x354d9057), STCP(0x74359cbd, 0x35a8e625), STCP(0x740b53fb, 0x36041ad9), STCP(0x73e0c3a3, 0x365f2e3b),
- STCP(0x73b5ebd1, 0x36ba2014), STCP(0x738acc9e, 0x3714f02a), STCP(0x735f6626, 0x376f9e46), STCP(0x7333b883, 0x37ca2a30),
- STCP(0x7307c3d0, 0x382493b0), STCP(0x72db8828, 0x387eda8e), STCP(0x72af05a7, 0x38d8fe93), STCP(0x72823c67, 0x3932ff87),
- STCP(0x72552c85, 0x398cdd32), STCP(0x7227d61c, 0x39e6975e), STCP(0x71fa3949, 0x3a402dd2), STCP(0x71cc5626, 0x3a99a057),
- STCP(0x719e2cd2, 0x3af2eeb7), STCP(0x716fbd68, 0x3b4c18ba), STCP(0x71410805, 0x3ba51e29), STCP(0x71120cc5, 0x3bfdfecd),
- STCP(0x70e2cbc6, 0x3c56ba70), STCP(0x70b34525, 0x3caf50da), STCP(0x708378ff, 0x3d07c1d6), STCP(0x70536771, 0x3d600d2c),
- STCP(0x7023109a, 0x3db832a6), STCP(0x6ff27497, 0x3e10320d), STCP(0x6fc19385, 0x3e680b2c), STCP(0x6f906d84, 0x3ebfbdcd),
- STCP(0x6f5f02b2, 0x3f1749b8), STCP(0x6f2d532c, 0x3f6eaeb8), STCP(0x6efb5f12, 0x3fc5ec98), STCP(0x6ec92683, 0x401d0321),
- STCP(0x6e96a99d, 0x4073f21d), STCP(0x6e63e87f, 0x40cab958), STCP(0x6e30e34a, 0x4121589b), STCP(0x6dfd9a1c, 0x4177cfb1),
- STCP(0x6dca0d14, 0x41ce1e65), STCP(0x6d963c54, 0x42244481), STCP(0x6d6227fa, 0x427a41d0), STCP(0x6d2dd027, 0x42d0161e),
- STCP(0x6cf934fc, 0x4325c135), STCP(0x6cc45698, 0x437b42e1), STCP(0x6c8f351c, 0x43d09aed), STCP(0x6c59d0a9, 0x4425c923),
- STCP(0x6c242960, 0x447acd50), STCP(0x6bee3f62, 0x44cfa740), STCP(0x6bb812d1, 0x452456bd), STCP(0x6b81a3cd, 0x4578db93),
- STCP(0x6b4af279, 0x45cd358f), STCP(0x6b13fef5, 0x4621647d), STCP(0x6adcc964, 0x46756828), STCP(0x6aa551e9, 0x46c9405c),
- STCP(0x6a6d98a4, 0x471cece7), STCP(0x6a359db9, 0x47706d93), STCP(0x69fd614a, 0x47c3c22f), STCP(0x69c4e37a, 0x4816ea86),
- STCP(0x698c246c, 0x4869e665), STCP(0x69532442, 0x48bcb599), STCP(0x6919e320, 0x490f57ee), STCP(0x68e06129, 0x4961cd33),
- STCP(0x68a69e81, 0x49b41533), STCP(0x686c9b4b, 0x4a062fbd), STCP(0x683257ab, 0x4a581c9e), STCP(0x67f7d3c5, 0x4aa9dba2),
- STCP(0x67bd0fbd, 0x4afb6c98), STCP(0x67820bb7, 0x4b4ccf4d), STCP(0x6746c7d8, 0x4b9e0390), STCP(0x670b4444, 0x4bef092d),
- STCP(0x66cf8120, 0x4c3fdff4), STCP(0x66937e91, 0x4c9087b1), STCP(0x66573cbb, 0x4ce10034), STCP(0x661abbc5, 0x4d31494b),
- STCP(0x65ddfbd3, 0x4d8162c4), STCP(0x65a0fd0b, 0x4dd14c6e), STCP(0x6563bf92, 0x4e210617), STCP(0x6526438f, 0x4e708f8f),
- STCP(0x64e88926, 0x4ebfe8a5), STCP(0x64aa907f, 0x4f0f1126), STCP(0x646c59bf, 0x4f5e08e3), STCP(0x642de50d, 0x4faccfab),
- STCP(0x63ef3290, 0x4ffb654d), STCP(0x63b0426d, 0x5049c999), STCP(0x637114cc, 0x5097fc5e), STCP(0x6331a9d4, 0x50e5fd6d),
- STCP(0x62f201ac, 0x5133cc94), STCP(0x62b21c7b, 0x518169a5), STCP(0x6271fa69, 0x51ced46e), STCP(0x62319b9d, 0x521c0cc2),
- STCP(0x61f1003f, 0x5269126e), STCP(0x61b02876, 0x52b5e546), STCP(0x616f146c, 0x53028518), STCP(0x612dc447, 0x534ef1b5),
- STCP(0x60ec3830, 0x539b2af0), STCP(0x60aa7050, 0x53e73097), STCP(0x60686ccf, 0x5433027d), STCP(0x60262dd6, 0x547ea073),
- STCP(0x5fe3b38d, 0x54ca0a4b), STCP(0x5fa0fe1f, 0x55153fd4), STCP(0x5f5e0db3, 0x556040e2), STCP(0x5f1ae274, 0x55ab0d46),
- STCP(0x5ed77c8a, 0x55f5a4d2), STCP(0x5e93dc1f, 0x56400758), STCP(0x5e50015d, 0x568a34a9), STCP(0x5e0bec6e, 0x56d42c99),
- STCP(0x5dc79d7c, 0x571deefa), STCP(0x5d8314b1, 0x57677b9d), STCP(0x5d3e5237, 0x57b0d256), STCP(0x5cf95638, 0x57f9f2f8),
- STCP(0x5cb420e0, 0x5842dd54), STCP(0x5c6eb258, 0x588b9140), STCP(0x5c290acc, 0x58d40e8c), STCP(0x5be32a67, 0x591c550e),
- STCP(0x5b9d1154, 0x59646498), STCP(0x5b56bfbd, 0x59ac3cfd), STCP(0x5b1035cf, 0x59f3de12), STCP(0x5ac973b5, 0x5a3b47ab),
- STCP(0x5a82799a, 0x5a82799a)
-};
-
-/* Lookup-Table for binary logarithm */
-const Word16 ldCoeff[7] =//Q15
-{
- -32768, -16384, -10923, -8192, -6554, -5461, -4681
- /* -4096, -3641, -3277 */
-};
-
-/* Lookup-Table for binary power algorithm */
-/* This table is used for lookup 2^x with x in range [0...1.0[ in steps of 1/32 */
-const UWord32 exp2_tab_long[32] =//Q31
-{
- 0x40000000,0x4166C34C,0x42D561B4,0x444C0740,
- 0x45CAE0F2,0x47521CC6,0x48E1E9BA,0x4A7A77D4,
- 0x4C1BF829,0x4DC69CDD,0x4F7A9930,0x51382182,
- 0x52FF6B55,0x54D0AD5A,0x56AC1F75,0x5891FAC1,
- 0x5A82799A,0x5C7DD7A4,0x5E8451D0,0x60962665,
- 0x62B39509,0x64DCDEC3,0x6712460B,0x69540EC9,
- 0x6BA27E65,0x6DFDDBCC,0x70666F76,0x72DC8374,
- 0x75606374,0x77F25CCE,0x7A92BE8B,0x7D41D96E
-};
-
-/* Lookup-Table for binary power algorithm */
-/* This table is used for lookup 2^x with x in range [0...1/32[ in steps of 1/1024 */
-const UWord32 exp2w_tab_long[32] =//Q31
-{
- 0x40000000,0x400B1818,0x4016321B,0x40214E0C,
- 0x402C6BE9,0x40378BB4,0x4042AD6D,0x404DD113,
- 0x4058F6A8,0x40641E2B,0x406F479E,0x407A7300,
- 0x4085A051,0x4090CF92,0x409C00C4,0x40A733E6,
- 0x40B268FA,0x40BD9FFF,0x40C8D8F5,0x40D413DD,
- 0x40DF50B8,0x40EA8F86,0x40F5D046,0x410112FA,
- 0x410C57A2,0x41179E3D,0x4122E6CD,0x412E3152,
- 0x41397DCC,0x4144CC3B,0x41501CA0,0x415B6EFB
-};
-
-/* Lookup-Table for binary power algorithm */
-/* This table is used for lookup 2^x with x in range [0...1/1024[ in steps of 1/32768 */
-const UWord32 exp2x_tab_long[32] =//Q31
-{
- 0x40000000,0x400058B9,0x4000B173,0x40010A2D,
- 0x400162E8,0x4001BBA3,0x4002145F,0x40026D1B,
- 0x4002C5D8,0x40031E95,0x40037752,0x4003D011,
- 0x400428CF,0x4004818E,0x4004DA4E,0x4005330E,
- 0x40058BCE,0x4005E48F,0x40063D51,0x40069613,
- 0x4006EED5,0x40074798,0x4007A05B,0x4007F91F,
- 0x400851E4,0x4008AAA8,0x4009036E,0x40095C33,
- 0x4009B4FA,0x400A0DC0,0x400A6688,0x400ABF4F
-};
-
-/* square root tables */
-const Word32 SqrtTable[32] = /* Q31 */
-{
- 0x5A82D429, 0x5BEA10FE, 0x5D4BE6E5, 0x5EA89270, 0x60004BE2, 0x615347A1, 0x62A1B68C, 0x63EBC651,
- 0x6531A1B5, 0x667370D4, 0x67B1595F, 0x68EB7EC8, 0x6A220277, 0x6B5503F0, 0x6C84A0F9, 0x6DB0F5BD,
- 0x6EDA1CE9, 0x70002FC7, 0x7123465A, 0x72437773, 0x7360D8C5, 0x747B7EFA, 0x75937DC4, 0x76A8E7EB,
- 0x77BBCF60, 0x78CC4545, 0x79DA5A00, 0x7AE61D3E, 0x7BEF9E07, 0x7CF6EAC2, 0x7DFC113F, 0x7EFF1EC0
-};
-
-const Word16 SqrtDiffTable[32] = /* Q15 */
-{
- 0x59CF, 0x5875, 0x572B, 0x55EE, 0x54BF, 0x539C, 0x5284, 0x5177,
- 0x5074, 0x4F7A, 0x4E89, 0x4DA1, 0x4CC0, 0x4BE7, 0x4B15, 0x4A4A,
- 0x4985, 0x48C6, 0x480C, 0x4758, 0x46AA, 0x4600, 0x455B, 0x44BA,
- 0x441D, 0x4385, 0x42F1, 0x4260, 0x41D3, 0x414A, 0x40C3, 0x4040
-};
-
-const Word32 ISqrtTable[32] = /* Q31 */
-{
- 0x7FFE7F85, 0x7E0A4E25, 0x7C2C56C7, 0x7A63002C, 0x78ACD922, 0x7708939D, 0x75750088, 0x73F10C2D,
- 0x727BBB1A, 0x71142774, 0x6FB97EA5, 0x6E6AFF54, 0x6D27F79D, 0x6BEFC388, 0x6AC1CBA4, 0x699D83DA,
- 0x68826A53, 0x6770068E, 0x6665E882, 0x6563A7DF, 0x6468E364, 0x63754043, 0x62886999, 0x61A20FEE,
- 0x60C1E8C8, 0x5FE7AE45, 0x5F131EBE, 0x5E43FC76, 0x5D7A0D4F, 0x5CB51A81, 0x5BF4F061, 0x5B395E26
-};
-
-const Word16 ISqrtDiffTable[32] = /* Q15 */
-{
- 0x7D0C, 0x777E, 0x7256, 0x6D8A, 0x6911, 0x64E5, 0x60FD, 0x5D54,
- 0x59E5, 0x56AA, 0x53A0, 0x50C2, 0x4E0D, 0x4B7E, 0x4912, 0x46C6,
- 0x4499, 0x4288, 0x4090, 0x3EB1, 0x3CE9, 0x3B36, 0x3996, 0x380A,
- 0x368F, 0x3524, 0x33C9, 0x327C, 0x313D, 0x300B, 0x2EE5, 0x2DCA
-};
-
-/* 1/x tables */
-const Word32 InvTable[32] = /* Q31 */
-{
- 0x7FFBFE40, 0x7C1B608E, 0x78752176, 0x750440BA, 0x71C44C49, 0x6EB14D0A, 0x6BC7B6B4, 0x69045A19,
- 0x6664598A, 0x63E51EE2, 0x61845308, 0x5F3FD698, 0x5D15BB8E, 0x5B043FD0, 0x5909C861, 0x5724DD3C,
- 0x555425B2, 0x53966532, 0x51EA787F, 0x504F5331, 0x4EC3FD84, 0x4D479267, 0x4BD93DBE, 0x4A783ADC,
- 0x4923D31D, 0x47DB5CAE, 0x469E3974, 0x456BD608, 0x4443A8D9, 0x43253159, 0x420FF746, 0x41038A01
-};
-
-const Word16 InvDiffTable[32] = /* Q15 */
-{
- 0x7C14, 0x74C8, 0x6E1C, 0x67FF, 0x6260, 0x5D33, 0x586C, 0x5400,
- 0x4FE7, 0x4C19, 0x4890, 0x4543, 0x422F, 0x3F4F, 0x3C9D, 0x3A17,
- 0x37B8, 0x357E, 0x3365, 0x316B, 0x2F8D, 0x2DCB, 0x2C20, 0x2A8D,
- 0x290F, 0x27A4, 0x264C, 0x2506, 0x23CF, 0x22A7, 0x218E, 0x2081
-};
-
-const Word16 tcx_mdct_window_48_fx[420] =//Q15
-{ 61, 183, 306, 428, 551, 673, 796, 919, 1041, 1163, 1286,
-1408, 1531, 1653, 1776, 1898, 2020, 2143, 2265, 2387, 2509,
-2632, 2754, 2876, 2998, 3120, 3242, 3364, 3486, 3607, 3729,
-3851, 3973, 4094, 4216, 4337, 4459, 4580, 4701, 4823, 4944,
-5065, 5186, 5307, 5428, 5549, 5669, 5790, 5911, 6031, 6152,
-6272, 6392, 6512, 6632, 6752, 6872, 6992, 7112, 7231, 7351,
-7470, 7589, 7709, 7828, 7947, 8065, 8184, 8303, 8421, 8540,
-8658, 8776, 8894, 9012, 9130, 9247, 9365, 9482, 9599, 9717,
-9834, 9950, 10067, 10184, 10300, 10416, 10532, 10648, 10764, 10880,
-10995, 11111, 11226, 11341, 11456, 11571, 11685, 11800, 11914, 12028,
-12142, 12256, 12369, 12483, 12596, 12709, 12822, 12934, 13047, 13159,
-13271, 13383, 13495, 13607, 13718, 13829, 13940, 14051, 14162, 14272,
-14382, 14492, 14602, 14712, 14821, 14930, 15039, 15148, 15257, 15365,
-15473, 15581, 15689, 15796, 15904, 16011, 16117, 16224, 16330, 16437,
-16542, 16648, 16754, 16859, 16964, 17068, 17173, 17277, 17381, 17485,
-17589, 17692, 17795, 17898, 18000, 18102, 18204, 18306, 18408, 18509,
-18610, 18711, 18811, 18911, 19011, 19111, 19210, 19310, 19408, 19507,
-19605, 19703, 19801, 19899, 19996, 20093, 20190, 20286, 20382, 20478,
-20573, 20669, 20764, 20858, 20953, 21047, 21140, 21234, 21327, 21420,
-21513, 21605, 21697, 21789, 21880, 21971, 22062, 22152, 22242, 22332,
-22422, 22511, 22600, 22688, 22777, 22865, 22952, 23040, 23127, 23213,
-23300, 23386, 23471, 23557, 23642, 23726, 23811, 23895, 23978, 24062,
-24145, 24227, 24310, 24392, 24473, 24555, 24636, 24716, 24797, 24877,
-24956, 25035, 25114, 25193, 25271, 25349, 25426, 25504, 25580, 25657,
-25733, 25808, 25884, 25959, 26033, 26108, 26181, 26255, 26328, 26401,
-26473, 26545, 26617, 26688, 26759, 26830, 26900, 26970, 27039, 27108,
-27177, 27245, 27313, 27381, 27448, 27514, 27581, 27647, 27712, 27778,
-27842, 27907, 27971, 28034, 28098, 28161, 28223, 28285, 28347, 28408,
-28469, 28529, 28589, 28649, 28708, 28767, 28826, 28884, 28942, 28999,
-29056, 29112, 29168, 29224, 29279, 29334, 29388, 29442, 29496, 29549,
-29602, 29654, 29706, 29758, 29809, 29859, 29910, 29959, 30009, 30058,
-30106, 30155, 30202, 30250, 30297, 30343, 30389, 30435, 30480, 30525,
-30569, 30613, 30656, 30700, 30742, 30784, 30826, 30867, 30908, 30949,
-30989, 31029, 31068, 31106, 31145, 31183, 31220, 31257, 31294, 31330,
-31365, 31401, 31435, 31470, 31504, 31537, 31570, 31603, 31635, 31667,
-31698, 31729, 31759, 31789, 31819, 31848, 31876, 31905, 31932, 31960,
-31986, 32013, 32039, 32064, 32089, 32114, 32138, 32162, 32185, 32208,
-32230, 32252, 32273, 32294, 32315, 32335, 32354, 32374, 32392, 32411,
-32428, 32446, 32463, 32479, 32495, 32511, 32526, 32540, 32555, 32568,
-32582, 32594, 32607, 32619, 32630, 32641, 32652, 32662, 32671, 32680,
-32689, 32697, 32705, 32712, 32719, 32726, 32732, 32737, 32742, 32747,
-32751, 32755, 32758, 32761, 32763, 32765, 32766, 32767, 32767 };
-
-const Word16 tcx_mdct_window_half_48_fx[180] =//Q15
-{
- 142, 428, 714, 1000, 1286, 1572, 1857, 2143, 2428, 2713, 2998,
-3282, 3567, 3851, 4135, 4418, 4701, 4984, 5267, 5549, 5830,
-6112, 6392, 6672, 6952, 7231, 7510, 7788, 8065, 8342, 8619,
-8894, 9169, 9443, 9717, 9989, 10261, 10532, 10803, 11072, 11341,
-11609, 11876, 12142, 12407, 12671, 12934, 13197, 13458, 13718, 13977,
-14235, 14492, 14748, 15003, 15257, 15509, 15761, 16011, 16260, 16507,
-16754, 16999, 17242, 17485, 17726, 17966, 18204, 18441, 18677, 18911,
-19144, 19376, 19605, 19834, 20061, 20286, 20510, 20732, 20953, 21172,
-21389, 21605, 21819, 22032, 22242, 22452, 22659, 22865, 23069, 23271,
-23471, 23670, 23867, 24062, 24255, 24446, 24636, 24823, 25009, 25193,
-25375, 25555, 25733, 25909, 26083, 26255, 26425, 26593, 26759, 26923,
-27085, 27245, 27403, 27559, 27712, 27864, 28013, 28161, 28306, 28449,
-28589, 28728, 28865, 28999, 29131, 29261, 29388, 29514, 29637, 29758,
-29876, 29992, 30106, 30218, 30328, 30435, 30540, 30642, 30742, 30840,
-30935, 31029, 31119, 31208, 31294, 31377, 31458, 31537, 31614, 31688,
-31759, 31828, 31895, 31960, 32021, 32081, 32138, 32192, 32245, 32294,
-32341, 32386, 32428, 32468, 32506, 32540, 32573, 32603, 32630, 32655,
-32677, 32697, 32715, 32730, 32742, 32752, 32760, 32765, 32767 };
-
-
-const Word16 tcx_mdct_window_trans_48_fx[60] =//Q15
-{ 428, 1286, 2143, 2998, 3851, 4701, 5549, 6392, 7231, 8065, 8894,
-9717, 10532, 11341, 12142, 12934, 13718, 14492, 15257, 16011, 16754,
-17485, 18204, 18911, 19605, 20286, 20953, 21605, 22242, 22865, 23471,
-24062, 24636, 25193, 25733, 26255, 26759, 27245, 27712, 28161, 28589,
-28999, 29388, 29758, 30106, 30435, 30742, 31029, 31294, 31537, 31759,
-31960, 32138, 32294, 32428, 32540, 32630, 32697, 32742, 32765
-};
-
-/*----------------------------------------------------------------------------------*
- * SWB TBE LSF tables (1.75 kbps)
- *----------------------------------------------------------------------------------*/
-
-const Word32 sigma_BWE_fx[] = {//Q31
-17011214, 16701976, 17561200,
-17474996, 19251270, 20645372, 39204284,
-40792208, 18917444, 18895726, 19477682,
-19499580, 20916386, 22705246, 39204284,
-40792208 }; /* for 3 bits first stage */
-
-
-const Word16 inv_modified_sigma_BWE_fx[] = {//x2.56
-323,
-329,
-313,
-314,
-285,
-266,
-140,
-134,
-290,
-290,
-282,
-281,
-262,
-242,
-140,
-134
-};
-
-const Word16 modified_sigma_BWE_fx[] =//Q15
-{ 259,
-254,
-267,
-266,
-293,
-315,
-598,
-622,
-288,
-288,
-297,
-297,
-319,
-346,
-598,
-622 };
-
-
-const Word16 SHB_LSF_mean_fx[10] = {//Q15
-1353, 2646, 4046,
-5428, 6896, 8339, 9863,
-11368, 12977, 14558
-};
-
-/* 4 bit VQ first stage */
-/* An 6-by-16 matrix */
-
-const Word16 SHB_LSF_VQ4_fx[96] =//Q15
-{ 150, 51, -507, -986, -1115, -944,
--184, -77, 95, 232, 440, 497, -115,
--107, -109, -242, -446, -592, 387, 799,
-1132, 1263, 1259, 1122, -128, -599, -1214,
--1389, -1319, -1016, 533, 424, 148, -125,
--378, -501, -337, -590, -587, -630, -715,
--750, 504, 849, 750, 508, 234, 68,
-176, -177, -407, 327, 206, 21, -107,
-341, 423, 264, -17, -180, -110, -381,
--716, -725, -232, -42, 170, 265, 273,
-336, 397, 450, 69, 285, 519, 686,
-656, 564, 120, 115, -123, -382, -19,
-234, -377, -629, -296, -95, 21, 63,
--206, -456, 518, 472, 179, 22 };
-/* 3 bit VQ first stage */
-const Word16 SHB_LSF_VQ3_fx[48] =//Q15
-{ 278, 403, 285, 65, -206, -337,
-386, 770, 838, 753, 599, 445, -196,
--455, -609, -524, -206, -78, 39, 199,
-393, 514, 491, 462, -91, -435, -979,
--1241, -1225, -976, -52, -98, -216, -422,
--599, -688, 127, 137, 0, 52, 301,
-412, -278, -422, 9, 199, 137, 72 };
-const Word16 *const cb_LSF_BWE_fx[] = { SHB_LSF_VQ4_fx, SHB_LSF_VQ3_fx }; // Q15
-
-const Word16 mslvq_SHB_min_bits[] = {14, 12}; /* for 4 bits and 3 bits respectively Q0*/
-
-const Word16 scales_BWE_fx[] = {//Q13
-7634, 13737,
-23027, 7299, 14499,
-24592, 6955, 14491,
-26427 };
-
-const Word16 scales_BWE_fx_new[] = {//Q11
-
-1908,
-3434,
-5756,
-1824,
-3624,
-6148,
-1738,
-3622,
-6606
-};
-const Word8 no_lead_BWE[] = { // Q0
- 8, 6, 5, /* 14 bits */
- 10,9,5, /* 15 bits*/
- 16, 11, 5}; /* 16 bits */
-
-const Word16 scales_BWE_3b_fx[] = {//Q13
-7847, 14262,
-28934, 7610, 12771,
-21544, 7249, 12689,
-23060 };
-
-const Word16 scales_BWE_3b_fx_new[] = {//Q11
- 1961,
-3565,
-7233,
-1902,
-3192,
-5386,
-1812,
-3172,
-5765
-};
-
-const Word8 no_lead_BWE_3b[] = { // Q0
- 4, 5, 2, /* 12 bits */
- 5, 5, 5, /* 13 bits */
- 8, 6, 5 /* 14 bits */
- };
-
-const Word32 LastCoefPred_0bit_fx[18] =//Q31
-{
-10930692, -29356102, -14495515,
--11918534, 3435973, 89292368, 269423296,
-1105954048, 0, 17544942, -13851270,
--20121922, -15590731, 7795365, 46127948,
-176888224, 438086656, 0 };
-
-
-const Word32 LastCoefPred_1bit_fx[36] = {//Q31
-37795712, -47094316, 24910810,
-18060338, 38268160, 87424056, 217346816,
-810181184, 9685151, 53107272, -26843546,
-11703786, -7301444, 20444044, 22655952,
-138448272, 307648512, 9234180 };
-
-const Word16 config_LSF_BWE[] = { // Q0
- 4, 16, 1, /* 21 bits */
- 4, 16, 1, /* 20 */
- 4, 16, 1, /* 19 */
- 3, 8, 1, /* 18 */
- 3, 8, 1, /* 17 */
- 3, 8, 0 /* 16 */
-};
-
-//basops
-const Word32 BASOP_util_normReciprocal[CHEAP_NORM_SIZE] =
-{
- 0l/*0.0 Q31*/, 2147483647l/*1.0000000000 Q31*/, 1073741824l/*0.5000000000 Q31*/, 715827883l/*0.3333333333 Q31*/, 536870912l/*0.2500000000 Q31*/, 429496730l/*0.2000000000 Q31*/,
- 357913941l/*0.1666666667 Q31*/, 306783378l/*0.1428571429 Q31*/, 268435456l/*0.1250000000 Q31*/, 238609294l/*0.1111111111 Q31*/, 214748365l/*0.1000000000 Q31*/, 195225786l/*0.0909090909 Q31*/,
- 178956971l/*0.0833333333 Q31*/, 165191050l/*0.0769230769 Q31*/, 153391689l/*0.0714285714 Q31*/, 143165577l/*0.0666666667 Q31*/, 134217728l/*0.0625000000 Q31*/, 126322568l/*0.0588235294 Q31*/,
- 119304647l/*0.0555555556 Q31*/, 113025455l/*0.0526315789 Q31*/, 107374182l/*0.0500000000 Q31*/, 102261126l/*0.0476190476 Q31*/, 97612893l/*0.0454545455 Q31*/, 93368854l/*0.0434782609 Q31*/,
- 89478485l/*0.0416666667 Q31*/, 85899346l/*0.0400000000 Q31*/, 82595525l/*0.0384615385 Q31*/, 79536431l/*0.0370370370 Q31*/, 76695845l/*0.0357142857 Q31*/, 74051160l/*0.0344827586 Q31*/,
- 71582788l/*0.0333333333 Q31*/, 69273666l/*0.0322580645 Q31*/, 67108864l/*0.0312500000 Q31*/, 65075262l/*0.0303030303 Q31*/, 63161284l/*0.0294117647 Q31*/, 61356676l/*0.0285714286 Q31*/,
- 59652324l/*0.0277777778 Q31*/, 58040099l/*0.0270270270 Q31*/, 56512728l/*0.0263157895 Q31*/, 55063683l/*0.0256410256 Q31*/, 53687091l/*0.0250000000 Q31*/, 52377650l/*0.0243902439 Q31*/,
- 51130563l/*0.0238095238 Q31*/, 49941480l/*0.0232558140 Q31*/, 48806446l/*0.0227272727 Q31*/, 47721859l/*0.0222222222 Q31*/, 46684427l/*0.0217391304 Q31*/, 45691141l/*0.0212765957 Q31*/,
- 44739243l/*0.0208333333 Q31*/, 43826197l/*0.0204081633 Q31*/, 42949673l/*0.0200000000 Q31*/, 42107522l/*0.0196078431 Q31*/, 41297762l/*0.0192307692 Q31*/, 40518559l/*0.0188679245 Q31*/,
- 39768216l/*0.0185185185 Q31*/, 39045157l/*0.0181818182 Q31*/, 38347922l/*0.0178571429 Q31*/, 37675152l/*0.0175438596 Q31*/, 37025580l/*0.0172413793 Q31*/, 36398028l/*0.0169491525 Q31*/,
- 35791394l/*0.0166666667 Q31*/, 35204650l/*0.0163934426 Q31*/, 34636833l/*0.0161290323 Q31*/, 34087042l/*0.0158730159 Q31*/, 33554432l/*0.0156250000 Q31*/, 33038210l/*0.0153846154 Q31*/,
- 32537631l/*0.0151515152 Q31*/, 32051995l/*0.0149253731 Q31*/, 31580642l/*0.0147058824 Q31*/, 31122951l/*0.0144927536 Q31*/, 30678338l/*0.0142857143 Q31*/, 30246248l/*0.0140845070 Q31*/,
- 29826162l/*0.0138888889 Q31*/, 29417584l/*0.0136986301 Q31*/, 29020049l/*0.0135135135 Q31*/, 28633115l/*0.0133333333 Q31*/, 28256364l/*0.0131578947 Q31*/, 27889398l/*0.0129870130 Q31*/,
- 27531842l/*0.0128205128 Q31*/, 27183337l/*0.0126582278 Q31*/, 26843546l/*0.0125000000 Q31*/, 26512144l/*0.0123456790 Q31*/, 26188825l/*0.0121951220 Q31*/, 25873297l/*0.0120481928 Q31*/,
- 25565282l/*0.0119047619 Q31*/, 25264514l/*0.0117647059 Q31*/, 24970740l/*0.0116279070 Q31*/, 24683720l/*0.0114942529 Q31*/, 24403223l/*0.0113636364 Q31*/, 24129030l/*0.0112359551 Q31*/,
- 23860929l/*0.0111111111 Q31*/, 23598721l/*0.0109890110 Q31*/, 23342214l/*0.0108695652 Q31*/, 23091222l/*0.0107526882 Q31*/, 22845571l/*0.0106382979 Q31*/, 22605091l/*0.0105263158 Q31*/,
- 22369621l/*0.0104166667 Q31*/, 22139007l/*0.0103092784 Q31*/, 21913098l/*0.0102040816 Q31*/, 21691754l/*0.0101010101 Q31*/, 21474836l/*0.0100000000 Q31*/, 21262214l/*0.0099009901 Q31*/,
- 21053761l/*0.0098039216 Q31*/, 20849356l/*0.0097087379 Q31*/, 20648881l/*0.0096153846 Q31*/, 20452225l/*0.0095238095 Q31*/, 20259280l/*0.0094339623 Q31*/, 20069941l/*0.0093457944 Q31*/,
- 19884108l/*0.0092592593 Q31*/, 19701685l/*0.0091743119 Q31*/, 19522579l/*0.0090909091 Q31*/, 19346700l/*0.0090090090 Q31*/, 19173961l/*0.0089285714 Q31*/, 19004280l/*0.0088495575 Q31*/,
- 18837576l/*0.0087719298 Q31*/, 18673771l/*0.0086956522 Q31*/, 18512790l/*0.0086206897 Q31*/, 18354561l/*0.0085470085 Q31*/, 18199014l/*0.0084745763 Q31*/, 18046081l/*0.0084033613 Q31*/,
- 17895697l/*0.0083333333 Q31*/, 17747799l/*0.0082644628 Q31*/, 17602325l/*0.0081967213 Q31*/, 17459217l/*0.0081300813 Q31*/, 17318416l/*0.0080645161 Q31*/, 17179869l/*0.0080000000 Q31*/,
- 17043521l/*0.0079365079 Q31*/, 16909320l/*0.0078740157 Q31*/, 16777216l/*0.0078125000 Q31*/, 16647160l/*0.0077519380 Q31*/, 16519105l/*0.0076923077 Q31*/, 16393005l/*0.0076335878 Q31*/,
- 16268816l/*0.0075757576 Q31*/, 16146494l/*0.0075187970 Q31*/, 16025997l/*0.0074626866 Q31*/, 15907286l/*0.0074074074 Q31*/, 15790321l/*0.0073529412 Q31*/, 15675063l/*0.0072992701 Q31*/,
- 15561476l/*0.0072463768 Q31*/, 15449523l/*0.0071942446 Q31*/, 15339169l/*0.0071428571 Q31*/, 15230381l/*0.0070921986 Q31*/, 15123124l/*0.0070422535 Q31*/, 15017368l/*0.0069930070 Q31*/,
- 14913081l/*0.0069444444 Q31*/, 14810232l/*0.0068965517 Q31*/, 14708792l/*0.0068493151 Q31*/, 14608732l/*0.0068027211 Q31*/, 14510025l/*0.0067567568 Q31*/, 14412642l/*0.0067114094 Q31*/,
- 14316558l/*0.0066666667 Q31*/, 14221746l/*0.0066225166 Q31*/, 14128182l/*0.0065789474 Q31*/, 14035841l/*0.0065359477 Q31*/, 13944699l/*0.0064935065 Q31*/, 13854733l/*0.0064516129 Q31*/,
- 13765921l/*0.0064102564 Q31*/, 13678240l/*0.0063694268 Q31*/, 13591669l/*0.0063291139 Q31*/, 13506187l/*0.0062893082 Q31*/, 13421773l/*0.0062500000 Q31*/
-};
-
-const Word16 f_atan_expand_range[MAXSFTAB - (MINSFTAB - 1)] =
-{
- /*****************************************************************************
- *
- * Table holds fixp_atan() output values which are outside of input range
- * of fixp_atan() to improve SNR of fixp_atan2().
- *
- * This Table might also be used in fixp_atan() [todo] so there a wider input
- * range can be covered, too.
- *
- * Matlab (generate table):
- * for scl = 7:25 % MINSFTAB .. MAXSFTAB
- * at=atan(0.5 *(2^scl)); % 0.5 because get in 'middle' area of current scale level 'scl'
- * at/2 % div at by ATO_SCALE
- * end
- *
- * Table divided by 2=ATO_SCALE <-- SF=ATO_SF
- *****************************************************************************/
- 25480/*7.775862990872099e-001 Q15*/, 25608/*7.814919928673978e-001 Q15*/, 25672/*7.834450483314648e-001 Q15*/,
- 25704/*7.844216021392089e-001 Q15*/, 25720/*7.849098823026687e-001 Q15*/, 25728/*7.851540227918509e-001 Q15*/,
- 25732/*7.852760930873737e-001 Q15*/, 25734/*7.853371282415015e-001 Q15*/, 25735/*7.853676458193612e-001 Q15*/,
- 25735/*7.853829046083906e-001 Q15*/, 25736/*7.853905340029177e-001 Q15*/, 25736/*7.853943487001828e-001 Q15*/,
- 25736/*7.853962560488155e-001 Q15*/, 25736/*7.853972097231319e-001 Q15*/, 25736/*7.853976865602901e-001 Q15*/,
- 25736/*7.853979249788692e-001 Q15*/, 25736/*7.853980441881587e-001 Q15*/, 25736/*7.853981037928035e-001 Q15*/,
- 25736/*7.853981335951259e-001 Q15*/
- /* pi/4 = 0.785398163397448 = pi/2/ATO_SCALE */
-};
-
-
-const Word16 Grid[GRID100_POINTS + 1] =//Q15
-{
- 32767, 32751, 32703, 32622, 32509, 32364,
- 32187, 31978, 31738, 31466, 31164, 30830,
- 30466, 30072, 29649, 29196, 28714, 28204,
- 27666, 27101, 26509, 25891, 25248, 24579,
- 23886, 23170, 22431, 21669, 20887, 20083,
- 19260, 18418, 17557, 16680, 15786, 14876,
- 13951, 13013, 12062, 11099, 10125, 9141,
- 8149, 7148, 6140, 5126, 4106, 3083,
- 2057, 1029, 0, -1029, -2057, -3083,
- -4106, -5126, -6140, -7148, -8149, -9141,
- -10125, -11099, -12062, -13013, -13951, -14876,
- -15786, -16680, -17557, -18418, -19260, -20083,
- -20887, -21669, -22431, -23170, -23886, -24579,
- -25248, -25891, -26509, -27101, -27666, -28204,
- -28714, -29196, -29649, -30072, -30466, -30830,
- -31164, -31466, -31738, -31978, -32187, -32364,
- -32509, -32622, -32703, -32751, -32760
-};
-
-const Word16 pwAlpha[10] = { 0x6666, 0x51ec, 0x4189, 0x346e, 0x29f1,//Q15
- 0x218e, 0x1ad8, 0x157a, 0x112e, 0x0dbe
-};
-
-/* Used in 'lsp2lsf_fx.c' */
-const Word8 Ind_Guess[256] =
-{
- 126, 122, 120, 119, 117, 116, 115, 114,
- 113, 112, 111, 110, 110, 109, 108, 108,
- 107, 106, 106, 105, 104, 104, 103, 103,
- 102, 102, 101, 101, 100, 100, 99, 99,
- 98, 98, 97, 97, 96, 96, 95, 95,
- 94, 94, 94, 93, 93, 92, 92, 91,
- 91, 91, 90, 90, 89, 89, 89, 88,
- 88, 87, 87, 87, 86, 86, 86, 85,
- 85, 84, 84, 84, 83, 83, 83, 82,
- 82, 82, 81, 81, 81, 80, 80, 80,
- 79, 79, 78, 78, 78, 77, 77, 77,
- 76, 76, 76, 75, 75, 75, 74, 74,
- 74, 73, 73, 73, 72, 72, 72, 72,
- 71, 71, 71, 70, 70, 70, 69, 69,
- 69, 68, 68, 68, 67, 67, 67, 66,
- 66, 66, 65, 65, 65, 64, 64, 64,
- 64, 63, 63, 63, 62, 62, 62, 61,
- 61, 61, 60, 60, 60, 59, 59, 59,
- 58, 58, 58, 57, 57, 57, 56, 56,
- 56, 55, 55, 55, 55, 54, 54, 54,
- 53, 53, 53, 52, 52, 52, 51, 51,
- 51, 50, 50, 50, 49, 49, 49, 48,
- 48, 47, 47, 47, 46, 46, 46, 45,
- 45, 45, 44, 44, 44, 43, 43, 43,
- 42, 42, 41, 41, 41, 40, 40, 40,
- 39, 39, 38, 38, 38, 37, 37, 36,
- 36, 36, 35, 35, 34, 34, 33, 33,
- 33, 32, 32, 31, 31, 30, 30, 29,
- 29, 28, 28, 27, 27, 26, 26, 25,
- 25, 24, 24, 23, 23, 22, 21, 21,
- 20, 19, 19, 18, 17, 17, 16, 15,
- 14, 13, 12, 11, 10, 8, 7, 5
-};
-
-const Word16 cos_table_129[129] =//Q15
-{
- 32767,
- 32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138,
- 31972, 31786, 31581, 31357, 31114, 30853, 30572, 30274,
- 29957, 29622, 29269, 28899, 28511, 28106, 27684, 27246,
- 26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170,
- 22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205,
- 17531, 16846, 16151, 15447, 14733, 14010, 13279, 12540,
- 11793, 11039, 10279, 9512, 8740, 7962, 7180, 6393,
- 5602, 4808, 4011, 3212, 2411, 1608, 804, 0,
- -804, -1608, -2411, -3212, -4011, -4808, -5602, -6393,
- -7180, -7962, -8740, -9512, -10279, -11039, -11793, -12540,
- -13279, -14010, -14733, -15447, -16151, -16846, -17531, -18205,
- -18868, -19520, -20160, -20788, -21403, -22006, -22595, -23170,
- -23732, -24279, -24812, -25330, -25833, -26320, -26791, -27246,
- -27684, -28106, -28511, -28899, -29269, -29622, -29957, -30274,
- -30572, -30853, -31114, -31357, -31581, -31786, -31972, -32138,
- -32286, -32413, -32522, -32610, -32679, -32729, -32758, -32768
-};
-
-const Word16 acos_slope[128] =//Q15
-{
- -26214, -9039, -5243, -3799, -2979, -2405, -2064, -1771,
- -1579, -1409, -1279, -1170, -1079, -1004, -933, -880,
- -827, -783, -743, -708, -676, -647, -621, -599,
- -576, -557, -538, -521, -506, -492, -479, -466,
- -456, -445, -435, -426, -417, -410, -402, -395,
- -389, -383, -377, -372, -367, -363, -359, -355,
- -351, -348, -345, -342, -340, -337, -335, -333,
- -331, -330, -329, -328, -327, -326, -326, -326,
- -326, -326, -326, -327, -328, -329, -330, -331,
- -333, -335, -337, -340, -342, -345, -348, -351,
- -355, -359, -363, -367, -372, -377, -383, -389,
- -395, -402, -410, -417, -426, -435, -445, -456,
- -466, -479, -492, -506, -521, -538, -557, -576,
- -599, -621, -647, -676, -708, -743, -783, -827,
- -880, -933, -1004, -1079, -1170, -1279, -1409, -1579,
- -1771, -2064, -2405, -2979, -3799, -5243, -9039,-26214
-};
-#define SHC(x) ((Word16)x)
-
-const Word16 cos_coef_new[4] = { SHC(0x02BA), SHC(0xE60A), SHC(0xEEEF), SHC(0xAAAB) };//Q15
-
-const Word16 cos_table[512] =//Q15
-{
- SHC(0x7fff),
- SHC(0x7ffe),
- SHC(0x7ff6),
- SHC(0x7fea),
- SHC(0x7fd9),
- SHC(0x7fc2),
- SHC(0x7fa7),
- SHC(0x7f87),
- SHC(0x7f62),
- SHC(0x7f38),
- SHC(0x7f0a),
- SHC(0x7ed6),
- SHC(0x7e9d),
- SHC(0x7e60),
- SHC(0x7e1e),
- SHC(0x7dd6),
- SHC(0x7d8a),
- SHC(0x7d3a),
- SHC(0x7ce4),
- SHC(0x7c89),
- SHC(0x7c2a),
- SHC(0x7bc6),
- SHC(0x7b5d),
- SHC(0x7aef),
- SHC(0x7a7d),
- SHC(0x7a06),
- SHC(0x798a),
- SHC(0x790a),
- SHC(0x7885),
- SHC(0x77fb),
- SHC(0x776c),
- SHC(0x76d9),
- SHC(0x7642),
- SHC(0x75a6),
- SHC(0x7505),
- SHC(0x7460),
- SHC(0x73b6),
- SHC(0x7308),
- SHC(0x7255),
- SHC(0x719e),
- SHC(0x70e3),
- SHC(0x7023),
- SHC(0x6f5f),
- SHC(0x6e97),
- SHC(0x6dca),
- SHC(0x6cf9),
- SHC(0x6c24),
- SHC(0x6b4b),
- SHC(0x6a6e),
- SHC(0x698c),
- SHC(0x68a7),
- SHC(0x67bd),
- SHC(0x66d0),
- SHC(0x65de),
- SHC(0x64e9),
- SHC(0x63ef),
- SHC(0x62f2),
- SHC(0x61f1),
- SHC(0x60ec),
- SHC(0x5fe4),
- SHC(0x5ed7),
- SHC(0x5dc8),
- SHC(0x5cb4),
- SHC(0x5b9d),
- SHC(0x5a82),
- SHC(0x5964),
- SHC(0x5843),
- SHC(0x571e),
- SHC(0x55f6),
- SHC(0x54ca),
- SHC(0x539b),
- SHC(0x5269),
- SHC(0x5134),
- SHC(0x4ffb),
- SHC(0x4ec0),
- SHC(0x4d81),
- SHC(0x4c40),
- SHC(0x4afb),
- SHC(0x49b4),
- SHC(0x486a),
- SHC(0x471d),
- SHC(0x45cd),
- SHC(0x447b),
- SHC(0x4326),
- SHC(0x41ce),
- SHC(0x4074),
- SHC(0x3f17),
- SHC(0x3db8),
- SHC(0x3c57),
- SHC(0x3af3),
- SHC(0x398d),
- SHC(0x3825),
- SHC(0x36ba),
- SHC(0x354e),
- SHC(0x33df),
- SHC(0x326e),
- SHC(0x30fc),
- SHC(0x2f87),
- SHC(0x2e11),
- SHC(0x2c99),
- SHC(0x2b1f),
- SHC(0x29a4),
- SHC(0x2827),
- SHC(0x26a8),
- SHC(0x2528),
- SHC(0x23a7),
- SHC(0x2224),
- SHC(0x209f),
- SHC(0x1f1a),
- SHC(0x1d93),
- SHC(0x1c0c),
- SHC(0x1a83),
- SHC(0x18f9),
- SHC(0x176e),
- SHC(0x15e2),
- SHC(0x1455),
- SHC(0x12c8),
- SHC(0x113a),
- SHC(0xfab),
- SHC(0xe1c),
- SHC(0xc8c),
- SHC(0xafb),
- SHC(0x96b),
- SHC(0x7d9),
- SHC(0x648),
- SHC(0x4b6),
- SHC(0x324),
- SHC(0x192),
- SHC(0x0),
- SHC(0xfe6e),
- SHC(0xfcdc),
- SHC(0xfb4a),
- SHC(0xf9b8),
- SHC(0xf827),
- SHC(0xf695),
- SHC(0xf505),
- SHC(0xf374),
- SHC(0xf1e4),
- SHC(0xf055),
- SHC(0xeec6),
- SHC(0xed38),
- SHC(0xebab),
- SHC(0xea1e),
- SHC(0xe892),
- SHC(0xe707),
- SHC(0xe57d),
- SHC(0xe3f4),
- SHC(0xe26d),
- SHC(0xe0e6),
- SHC(0xdf61),
- SHC(0xdddc),
- SHC(0xdc59),
- SHC(0xdad8),
- SHC(0xd958),
- SHC(0xd7d9),
- SHC(0xd65c),
- SHC(0xd4e1),
- SHC(0xd367),
- SHC(0xd1ef),
- SHC(0xd079),
- SHC(0xcf04),
- SHC(0xcd92),
- SHC(0xcc21),
- SHC(0xcab2),
- SHC(0xc946),
- SHC(0xc7db),
- SHC(0xc673),
- SHC(0xc50d),
- SHC(0xc3a9),
- SHC(0xc248),
- SHC(0xc0e9),
- SHC(0xbf8c),
- SHC(0xbe32),
- SHC(0xbcda),
- SHC(0xbb85),
- SHC(0xba33),
- SHC(0xb8e3),
- SHC(0xb796),
- SHC(0xb64c),
- SHC(0xb505),
- SHC(0xb3c0),
- SHC(0xb27f),
- SHC(0xb140),
- SHC(0xb005),
- SHC(0xaecc),
- SHC(0xad97),
- SHC(0xac65),
- SHC(0xab36),
- SHC(0xaa0a),
- SHC(0xa8e2),
- SHC(0xa7bd),
- SHC(0xa69c),
- SHC(0xa57e),
- SHC(0xa463),
- SHC(0xa34c),
- SHC(0xa238),
- SHC(0xa129),
- SHC(0xa01c),
- SHC(0x9f14),
- SHC(0x9e0f),
- SHC(0x9d0e),
- SHC(0x9c11),
- SHC(0x9b17),
- SHC(0x9a22),
- SHC(0x9930),
- SHC(0x9843),
- SHC(0x9759),
- SHC(0x9674),
- SHC(0x9592),
- SHC(0x94b5),
- SHC(0x93dc),
- SHC(0x9307),
- SHC(0x9236),
- SHC(0x9169),
- SHC(0x90a1),
- SHC(0x8fdd),
- SHC(0x8f1d),
- SHC(0x8e62),
- SHC(0x8dab),
- SHC(0x8cf8),
- SHC(0x8c4a),
- SHC(0x8ba0),
- SHC(0x8afb),
- SHC(0x8a5a),
- SHC(0x89be),
- SHC(0x8927),
- SHC(0x8894),
- SHC(0x8805),
- SHC(0x877b),
- SHC(0x86f6),
- SHC(0x8676),
- SHC(0x85fa),
- SHC(0x8583),
- SHC(0x8511),
- SHC(0x84a3),
- SHC(0x843a),
- SHC(0x83d6),
- SHC(0x8377),
- SHC(0x831c),
- SHC(0x82c6),
- SHC(0x8276),
- SHC(0x822a),
- SHC(0x81e2),
- SHC(0x81a0),
- SHC(0x8163),
- SHC(0x812a),
- SHC(0x80f6),
- SHC(0x80c8),
- SHC(0x809e),
- SHC(0x8079),
- SHC(0x8059),
- SHC(0x803e),
- SHC(0x8027),
- SHC(0x8016),
- SHC(0x800a),
- SHC(0x8002),
- SHC(0x8001),
- SHC(0x8002),
- SHC(0x800a),
- SHC(0x8016),
- SHC(0x8027),
- SHC(0x803e),
- SHC(0x8059),
- SHC(0x8079),
- SHC(0x809e),
- SHC(0x80c8),
- SHC(0x80f6),
- SHC(0x812a),
- SHC(0x8163),
- SHC(0x81a0),
- SHC(0x81e2),
- SHC(0x822a),
- SHC(0x8276),
- SHC(0x82c6),
- SHC(0x831c),
- SHC(0x8377),
- SHC(0x83d6),
- SHC(0x843a),
- SHC(0x84a3),
- SHC(0x8511),
- SHC(0x8583),
- SHC(0x85fa),
- SHC(0x8676),
- SHC(0x86f6),
- SHC(0x877b),
- SHC(0x8805),
- SHC(0x8894),
- SHC(0x8927),
- SHC(0x89be),
- SHC(0x8a5a),
- SHC(0x8afb),
- SHC(0x8ba0),
- SHC(0x8c4a),
- SHC(0x8cf8),
- SHC(0x8dab),
- SHC(0x8e62),
- SHC(0x8f1d),
- SHC(0x8fdd),
- SHC(0x90a1),
- SHC(0x9169),
- SHC(0x9236),
- SHC(0x9307),
- SHC(0x93dc),
- SHC(0x94b5),
- SHC(0x9592),
- SHC(0x9674),
- SHC(0x9759),
- SHC(0x9843),
- SHC(0x9930),
- SHC(0x9a22),
- SHC(0x9b17),
- SHC(0x9c11),
- SHC(0x9d0e),
- SHC(0x9e0f),
- SHC(0x9f14),
- SHC(0xa01c),
- SHC(0xa129),
- SHC(0xa238),
- SHC(0xa34c),
- SHC(0xa463),
- SHC(0xa57e),
- SHC(0xa69c),
- SHC(0xa7bd),
- SHC(0xa8e2),
- SHC(0xaa0a),
- SHC(0xab36),
- SHC(0xac65),
- SHC(0xad97),
- SHC(0xaecc),
- SHC(0xb005),
- SHC(0xb140),
- SHC(0xb27f),
- SHC(0xb3c0),
- SHC(0xb505),
- SHC(0xb64c),
- SHC(0xb796),
- SHC(0xb8e3),
- SHC(0xba33),
- SHC(0xbb85),
- SHC(0xbcda),
- SHC(0xbe32),
- SHC(0xbf8c),
- SHC(0xc0e9),
- SHC(0xc248),
- SHC(0xc3a9),
- SHC(0xc50d),
- SHC(0xc673),
- SHC(0xc7db),
- SHC(0xc946),
- SHC(0xcab2),
- SHC(0xcc21),
- SHC(0xcd92),
- SHC(0xcf04),
- SHC(0xd079),
- SHC(0xd1ef),
- SHC(0xd367),
- SHC(0xd4e1),
- SHC(0xd65c),
- SHC(0xd7d9),
- SHC(0xd958),
- SHC(0xdad8),
- SHC(0xdc59),
- SHC(0xdddc),
- SHC(0xdf61),
- SHC(0xe0e6),
- SHC(0xe26d),
- SHC(0xe3f4),
- SHC(0xe57d),
- SHC(0xe707),
- SHC(0xe892),
- SHC(0xea1e),
- SHC(0xebab),
- SHC(0xed38),
- SHC(0xeec6),
- SHC(0xf055),
- SHC(0xf1e4),
- SHC(0xf374),
- SHC(0xf505),
- SHC(0xf695),
- SHC(0xf827),
- SHC(0xf9b8),
- SHC(0xfb4a),
- SHC(0xfcdc),
- SHC(0xfe6e),
- SHC(0x0),
- SHC(0x192),
- SHC(0x324),
- SHC(0x4b6),
- SHC(0x648),
- SHC(0x7d9),
- SHC(0x96b),
- SHC(0xafb),
- SHC(0xc8c),
- SHC(0xe1c),
- SHC(0xfab),
- SHC(0x113a),
- SHC(0x12c8),
- SHC(0x1455),
- SHC(0x15e2),
- SHC(0x176e),
- SHC(0x18f9),
- SHC(0x1a83),
- SHC(0x1c0c),
- SHC(0x1d93),
- SHC(0x1f1a),
- SHC(0x209f),
- SHC(0x2224),
- SHC(0x23a7),
- SHC(0x2528),
- SHC(0x26a8),
- SHC(0x2827),
- SHC(0x29a4),
- SHC(0x2b1f),
- SHC(0x2c99),
- SHC(0x2e11),
- SHC(0x2f87),
- SHC(0x30fc),
- SHC(0x326e),
- SHC(0x33df),
- SHC(0x354e),
- SHC(0x36ba),
- SHC(0x3825),
- SHC(0x398d),
- SHC(0x3af3),
- SHC(0x3c57),
- SHC(0x3db8),
- SHC(0x3f17),
- SHC(0x4074),
- SHC(0x41ce),
- SHC(0x4326),
- SHC(0x447b),
- SHC(0x45cd),
- SHC(0x471d),
- SHC(0x486a),
- SHC(0x49b4),
- SHC(0x4afb),
- SHC(0x4c40),
- SHC(0x4d81),
- SHC(0x4ec0),
- SHC(0x4ffb),
- SHC(0x5134),
- SHC(0x5269),
- SHC(0x539b),
- SHC(0x54ca),
- SHC(0x55f6),
- SHC(0x571e),
- SHC(0x5843),
- SHC(0x5964),
- SHC(0x5a82),
- SHC(0x5b9d),
- SHC(0x5cb4),
- SHC(0x5dc8),
- SHC(0x5ed7),
- SHC(0x5fe4),
- SHC(0x60ec),
- SHC(0x61f1),
- SHC(0x62f2),
- SHC(0x63ef),
- SHC(0x64e9),
- SHC(0x65de),
- SHC(0x66d0),
- SHC(0x67bd),
- SHC(0x68a7),
- SHC(0x698c),
- SHC(0x6a6e),
- SHC(0x6b4b),
- SHC(0x6c24),
- SHC(0x6cf9),
- SHC(0x6dca),
- SHC(0x6e97),
- SHC(0x6f5f),
- SHC(0x7023),
- SHC(0x70e3),
- SHC(0x719e),
- SHC(0x7255),
- SHC(0x7308),
- SHC(0x73b6),
- SHC(0x7460),
- SHC(0x7505),
- SHC(0x75a6),
- SHC(0x7642),
- SHC(0x76d9),
- SHC(0x776c),
- SHC(0x77fb),
- SHC(0x7885),
- SHC(0x790a),
- SHC(0x798a),
- SHC(0x7a06),
- SHC(0x7a7d),
- SHC(0x7aef),
- SHC(0x7b5d),
- SHC(0x7bc6),
- SHC(0x7c2a),
- SHC(0x7c89),
- SHC(0x7ce4),
- SHC(0x7d3a),
- SHC(0x7d8a),
- SHC(0x7dd6),
- SHC(0x7e1e),
- SHC(0x7e60),
- SHC(0x7e9d),
- SHC(0x7ed6),
- SHC(0x7f0a),
- SHC(0x7f38),
- SHC(0x7f62),
- SHC(0x7f87),
- SHC(0x7fa7),
- SHC(0x7fc2),
- SHC(0x7fd9),
- SHC(0x7fea),
- SHC(0x7ff6),
- SHC(0x7ffe)
-};
-
-const PWord16 w1N8[15] =
-{
- {{ 32729/*0.998795 Q15*/, -1608/*-0.049068 Q15*/}},
- {{ 32610/*0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
- {{ 32413/*0.989177 Q15*/, -4808/*-0.146730 Q15*/}},
- {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{ 31786/*0.970031 Q15*/, -7962/*-0.242980 Q15*/}},
- {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
- {{ 30853/*0.941544 Q15*/, -11039/*-0.336890 Q15*/}},
- {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{ 29622/*0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
- {{ 28899/*0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
- {{ 28106/*0.857729 Q15*/, -16846/*-0.514103 Q15*/}},
- {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
- {{ 26320/*0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
- {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
- {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}}
-};
-
-const PWord16 w2N8[15] =
-{
- {{ 32610/*0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
- {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
- {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{ 28899/*0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
- {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
- {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
- {{ 23170/*0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
- {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
- {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
- {{ 15447/*0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
- {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{ 9512/*0.290285 Q15*/, -31357/*-0.956940 Q15*/}},
- {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
- {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}}
-};
-
-const PWord16 w3N8[15] =
-{
- {{ 32413/*0.989177 Q15*/, -4808/*-0.146730 Q15*/}},
- {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
- {{ 29622/*0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
- {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
- {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
- {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
- {{ 16846/*0.514103 Q15*/, -28106/*-0.857729 Q15*/}},
- {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{ 7962/*0.242980 Q15*/, -31786/*-0.970031 Q15*/}},
- {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}},
- {{ -1608/*-0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
- {{ -6393/*-0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
- {{-11039/*-0.336890 Q15*/, -30853/*-0.941544 Q15*/}},
- {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
- {{-19520/*-0.595699 Q15*/, -26320/*-0.803208 Q15*/}}
-};
-
-const PWord16 w4N8[15] =
-{
- {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
- {{ 23170/*0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
- {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
- {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
- {{ 0/*0.000000 Q15*/, -32768/*-1.000000 Q15*/}},
- {{ -6393/*-0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
- {{-12540/*-0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{-18205/*-0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
- {{-23170/*-0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
- {{-27246/*-0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
- {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}}
-};
-
-const PWord16 w5N8[15] =
-{
- {{ 31786/*0.970031 Q15*/, -7962/*-0.242980 Q15*/}},
- {{ 28899/*0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
- {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
- {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
- {{ 11039/*0.336890 Q15*/, -30853/*-0.941544 Q15*/}},
- {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}},
- {{ -4808/*-0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
- {{-12540/*-0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{-19520/*-0.595699 Q15*/, -26320/*-0.803208 Q15*/}},
- {{-25330/*-0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
- {{-29622/*-0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
- {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{-32729/*-0.998795 Q15*/, 1608/*0.049068 Q15*/}},
- {{-31357/*-0.956940 Q15*/, 9512/*0.290285 Q15*/}},
- {{-28106/*-0.857729 Q15*/, 16846/*0.514103 Q15*/}}
-};
-
-const PWord16 w6N8[15] =
-{
- {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
- {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
- {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
- {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}},
- {{ -6393/*-0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
- {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
- {{-23170/*-0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
- {{-28899/*-0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
- {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{-32610/*-0.995185 Q15*/, 3212/*0.098017 Q15*/}},
- {{-30274/*-0.923880 Q15*/, 12540/*0.382683 Q15*/}},
- {{-25330/*-0.773010 Q15*/, 20788/*0.634393 Q15*/}},
- {{-18205/*-0.555570 Q15*/, 27246/*0.831470 Q15*/}},
- {{ -9512/*-0.290285 Q15*/, 31357/*0.956940 Q15*/}}
-};
-
-const PWord16 w7N8[15] =
-{
- {{ 30853/*0.941544 Q15*/, -11039/*-0.336890 Q15*/}},
- {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
- {{ 16846/*0.514103 Q15*/, -28106/*-0.857729 Q15*/}},
- {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
- {{ -4808/*-0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
- {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
- {{-24279/*-0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
- {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{-32729/*-0.998795 Q15*/, -1608/*-0.049068 Q15*/}},
- {{-31357/*-0.956940 Q15*/, 9512/*0.290285 Q15*/}},
- {{-26320/*-0.803208 Q15*/, 19520/*0.595699 Q15*/}},
- {{-18205/*-0.555570 Q15*/, 27246/*0.831470 Q15*/}},
- {{ -7962/*-0.242980 Q15*/, 31786/*0.970031 Q15*/}},
- {{ 3212/*0.098017 Q15*/, 32610/*0.995185 Q15*/}},
- {{ 14010/*0.427555 Q15*/, 29622/*0.903989 Q15*/}}
-};
-
-const PWord16 *w_a[7] = { w1N8, w2N8, w3N8, w4N8, w5N8, w6N8, w7N8 };//Q15
-
-const PWord16 w19N[127] =
-{
- {{ 31881/*0.972940 Q15*/, 7571/*0.231058 Q15*/}},
- {{ 29269/*0.893224 Q15*/, 14733/*0.449611 Q15*/}},
- {{ 25073/*0.765167 Q15*/, 21097/*0.643832 Q15*/}},
- {{ 19520/*0.595699 Q15*/, 26320/*0.803208 Q15*/}},
- {{ 12910/*0.393992 Q15*/, 30118/*0.919114 Q15*/}},
- {{ 5602/*0.170962 Q15*/, 32286/*0.985278 Q15*/}},
- {{ -2009/*-0.061321 Q15*/, 32706/*0.998118 Q15*/}},
- {{ -9512/*-0.290285 Q15*/, 31357/*0.956940 Q15*/}},
- {{-16500/*-0.503538 Q15*/, 28311/*0.863973 Q15*/}},
- {{-22595/*-0.689541 Q15*/, 23732/*0.724247 Q15*/}},
- {{-27467/*-0.838225 Q15*/, 17869/*0.545325 Q15*/}},
- {{-30853/*-0.941544 Q15*/, 11039/*0.336890 Q15*/}},
- {{-32568/*-0.993907 Q15*/, 3612/*0.110222 Q15*/}},
- {{-32522/*-0.992480 Q15*/, -4011/*-0.122411 Q15*/}},
- {{-30715/*-0.937339 Q15*/, -11417/*-0.348419 Q15*/}},
- {{-27246/*-0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
- {{-22302/*-0.680601 Q15*/, -24008/*-0.732654 Q15*/}},
- {{-16151/*-0.492898 Q15*/, -28511/*-0.870087 Q15*/}},
- {{ -9127/*-0.278520 Q15*/, -31471/*-0.960431 Q15*/}},
- {{ -1608/*-0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
- {{ 5998/*0.183040 Q15*/, -32214/*-0.983105 Q15*/}},
- {{ 13279/*0.405241 Q15*/, -29957/*-0.914210 Q15*/}},
- {{ 19841/*0.605511 Q15*/, -26078/*-0.795837 Q15*/}},
- {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
- {{ 29448/*0.898674 Q15*/, -14373/*-0.438616 Q15*/}},
- {{ 31972/*0.975702 Q15*/, -7180/*-0.219101 Q15*/}},
- {{ 32766/*0.999925 Q15*/, 402/*0.012272 Q15*/}},
- {{ 31786/*0.970031 Q15*/, 7962/*0.242980 Q15*/}},
- {{ 29086/*0.887640 Q15*/, 15091/*0.460539 Q15*/}},
- {{ 24812/*0.757209 Q15*/, 21403/*0.653173 Q15*/}},
- {{ 19195/*0.585798 Q15*/, 26557/*0.810457 Q15*/}},
- {{ 12540/*0.382683 Q15*/, 30274/*0.923880 Q15*/}},
- {{ 5205/*0.158858 Q15*/, 32352/*0.987301 Q15*/}},
- {{ -2411/*-0.073565 Q15*/, 32679/*0.997290 Q15*/}},
- {{ -9896/*-0.302006 Q15*/, 31238/*0.953306 Q15*/}},
- {{-16846/*-0.514103 Q15*/, 28106/*0.857729 Q15*/}},
- {{-22884/*-0.698376 Q15*/, 23453/*0.715731 Q15*/}},
- {{-27684/*-0.844854 Q15*/, 17531/*0.534998 Q15*/}},
- {{-30986/*-0.945607 Q15*/, 10660/*0.325310 Q15*/}},
- {{-32610/*-0.995185 Q15*/, 3212/*0.098017 Q15*/}},
- {{-32470/*-0.990903 Q15*/, -4410/*-0.134581 Q15*/}},
- {{-30572/*-0.932993 Q15*/, -11793/*-0.359895 Q15*/}},
- {{-27020/*-0.824589 Q15*/, -18538/*-0.565732 Q15*/}},
- {{-22006/*-0.671559 Q15*/, -24279/*-0.740951 Q15*/}},
- {{-15800/*-0.482184 Q15*/, -28707/*-0.876070 Q15*/}},
- {{ -8740/*-0.266713 Q15*/, -31581/*-0.963776 Q15*/}},
- {{ -1206/*-0.036807 Q15*/, -32746/*-0.999322 Q15*/}},
- {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
- {{ 13646/*0.416430 Q15*/, -29792/*-0.909168 Q15*/}},
- {{ 20160/*0.615232 Q15*/, -25833/*-0.788346 Q15*/}},
- {{ 25583/*0.780737 Q15*/, -20475/*-0.624859 Q15*/}},
- {{ 29622/*0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
- {{ 32057/*0.978317 Q15*/, -6787/*-0.207111 Q15*/}},
- {{ 32758/*0.999699 Q15*/, 804/*0.024541 Q15*/}},
- {{ 31686/*0.966976 Q15*/, 8351/*0.254866 Q15*/}},
- {{ 28899/*0.881921 Q15*/, 15447/*0.471397 Q15*/}},
- {{ 24548/*0.749136 Q15*/, 21706/*0.662416 Q15*/}},
- {{ 18868/*0.575808 Q15*/, 26791/*0.817585 Q15*/}},
- {{ 12167/*0.371317 Q15*/, 30425/*0.928506 Q15*/}},
- {{ 4808/*0.146730 Q15*/, 32413/*0.989177 Q15*/}},
- {{ -2811/*-0.085797 Q15*/, 32647/*0.996313 Q15*/}},
- {{-10279/*-0.313682 Q15*/, 31114/*0.949528 Q15*/}},
- {{-17190/*-0.524590 Q15*/, 27897/*0.851355 Q15*/}},
- {{-23170/*-0.707107 Q15*/, 23170/*0.707107 Q15*/}},
- {{-27897/*-0.851355 Q15*/, 17190/*0.524590 Q15*/}},
- {{-31114/*-0.949528 Q15*/, 10279/*0.313682 Q15*/}},
- {{-32647/*-0.996313 Q15*/, 2811/*0.085797 Q15*/}},
- {{-32413/*-0.989177 Q15*/, -4808/*-0.146730 Q15*/}},
- {{-30425/*-0.928506 Q15*/, -12167/*-0.371317 Q15*/}},
- {{-26791/*-0.817585 Q15*/, -18868/*-0.575808 Q15*/}},
- {{-21706/*-0.662416 Q15*/, -24548/*-0.749136 Q15*/}},
- {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
- {{ -8351/*-0.254866 Q15*/, -31686/*-0.966976 Q15*/}},
- {{ -804/*-0.024541 Q15*/, -32758/*-0.999699 Q15*/}},
- {{ 6787/*0.207111 Q15*/, -32057/*-0.978317 Q15*/}},
- {{ 14010/*0.427555 Q15*/, -29622/*-0.903989 Q15*/}},
- {{ 20475/*0.624859 Q15*/, -25583/*-0.780737 Q15*/}},
- {{ 25833/*0.788346 Q15*/, -20160/*-0.615232 Q15*/}},
- {{ 29792/*0.909168 Q15*/, -13646/*-0.416430 Q15*/}},
- {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{ 32746/*0.999322 Q15*/, 1206/*0.036807 Q15*/}},
- {{ 31581/*0.963776 Q15*/, 8740/*0.266713 Q15*/}},
- {{ 28707/*0.876070 Q15*/, 15800/*0.482184 Q15*/}},
- {{ 24279/*0.740951 Q15*/, 22006/*0.671559 Q15*/}},
- {{ 18538/*0.565732 Q15*/, 27020/*0.824589 Q15*/}},
- {{ 11793/*0.359895 Q15*/, 30572/*0.932993 Q15*/}},
- {{ 4410/*0.134581 Q15*/, 32470/*0.990903 Q15*/}},
- {{ -3212/*-0.098017 Q15*/, 32610/*0.995185 Q15*/}},
- {{-10660/*-0.325310 Q15*/, 30986/*0.945607 Q15*/}},
- {{-17531/*-0.534998 Q15*/, 27684/*0.844854 Q15*/}},
- {{-23453/*-0.715731 Q15*/, 22884/*0.698376 Q15*/}},
- {{-28106/*-0.857729 Q15*/, 16846/*0.514103 Q15*/}},
- {{-31238/*-0.953306 Q15*/, 9896/*0.302006 Q15*/}},
- {{-32679/*-0.997290 Q15*/, 2411/*0.073565 Q15*/}},
- {{-32352/*-0.987301 Q15*/, -5205/*-0.158858 Q15*/}},
- {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{-26557/*-0.810457 Q15*/, -19195/*-0.585798 Q15*/}},
- {{-21403/*-0.653173 Q15*/, -24812/*-0.757209 Q15*/}},
- {{-15091/*-0.460539 Q15*/, -29086/*-0.887640 Q15*/}},
- {{ -7962/*-0.242980 Q15*/, -31786/*-0.970031 Q15*/}},
- {{ -402/*-0.012272 Q15*/, -32766/*-0.999925 Q15*/}},
- {{ 7180/*0.219101 Q15*/, -31972/*-0.975702 Q15*/}},
- {{ 14373/*0.438616 Q15*/, -29448/*-0.898674 Q15*/}},
- {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
- {{ 26078/*0.795837 Q15*/, -19841/*-0.605511 Q15*/}},
- {{ 29957/*0.914210 Q15*/, -13279/*-0.405241 Q15*/}},
- {{ 32214/*0.983105 Q15*/, -5998/*-0.183040 Q15*/}},
- {{ 32729/*0.998795 Q15*/, 1608/*0.049068 Q15*/}},
- {{ 31471/*0.960431 Q15*/, 9127/*0.278520 Q15*/}},
- {{ 28511/*0.870087 Q15*/, 16151/*0.492898 Q15*/}},
- {{ 24008/*0.732654 Q15*/, 22302/*0.680601 Q15*/}},
- {{ 18205/*0.555570 Q15*/, 27246/*0.831470 Q15*/}},
- {{ 11417/*0.348419 Q15*/, 30715/*0.937339 Q15*/}},
- {{ 4011/*0.122411 Q15*/, 32522/*0.992480 Q15*/}},
- {{ -3612/*-0.110222 Q15*/, 32568/*0.993907 Q15*/}},
- {{-11039/*-0.336890 Q15*/, 30853/*0.941544 Q15*/}},
- {{-17869/*-0.545325 Q15*/, 27467/*0.838225 Q15*/}},
- {{-23732/*-0.724247 Q15*/, 22595/*0.689541 Q15*/}},
- {{-28311/*-0.863973 Q15*/, 16500/*0.503538 Q15*/}},
- {{-31357/*-0.956940 Q15*/, 9512/*0.290285 Q15*/}},
- {{-32706/*-0.998118 Q15*/, 2009/*0.061321 Q15*/}},
- {{-32286/*-0.985278 Q15*/, -5602/*-0.170962 Q15*/}},
- {{-30118/*-0.919114 Q15*/, -12910/*-0.393992 Q15*/}},
- {{-26320/*-0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
- {{-21097/*-0.643832 Q15*/, -25073/*-0.765167 Q15*/}},
- {{-14733/*-0.449611 Q15*/, -29269/*-0.893224 Q15*/}},
- {{ -7571/*-0.231058 Q15*/, -31881/*-0.972940 Q15*/}}
-};
-
-const PWord16 w18N[127] =
-{
- {{ 31972/*0.975702 Q15*/, 7180/*0.219101 Q15*/}},
- {{ 29622/*0.903989 Q15*/, 14010/*0.427555 Q15*/}},
- {{ 25833/*0.788346 Q15*/, 20160/*0.615232 Q15*/}},
- {{ 20788/*0.634393 Q15*/, 25330/*0.773010 Q15*/}},
- {{ 14733/*0.449611 Q15*/, 29269/*0.893224 Q15*/}},
- {{ 7962/*0.242980 Q15*/, 31786/*0.970031 Q15*/}},
- {{ 804/*0.024541 Q15*/, 32758/*0.999699 Q15*/}},
- {{ -6393/*-0.195090 Q15*/, 32138/*0.980785 Q15*/}},
- {{-13279/*-0.405241 Q15*/, 29957/*0.914210 Q15*/}},
- {{-19520/*-0.595699 Q15*/, 26320/*0.803208 Q15*/}},
- {{-24812/*-0.757209 Q15*/, 21403/*0.653173 Q15*/}},
- {{-28899/*-0.881921 Q15*/, 15447/*0.471397 Q15*/}},
- {{-31581/*-0.963776 Q15*/, 8740/*0.266713 Q15*/}},
- {{-32729/*-0.998795 Q15*/, 1608/*0.049068 Q15*/}},
- {{-32286/*-0.985278 Q15*/, -5602/*-0.170962 Q15*/}},
- {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{-26791/*-0.817585 Q15*/, -18868/*-0.575808 Q15*/}},
- {{-22006/*-0.671559 Q15*/, -24279/*-0.740951 Q15*/}},
- {{-16151/*-0.492898 Q15*/, -28511/*-0.870087 Q15*/}},
- {{ -9512/*-0.290285 Q15*/, -31357/*-0.956940 Q15*/}},
- {{ -2411/*-0.073565 Q15*/, -32679/*-0.997290 Q15*/}},
- {{ 4808/*0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
- {{ 11793/*0.359895 Q15*/, -30572/*-0.932993 Q15*/}},
- {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
- {{ 23732/*0.724247 Q15*/, -22595/*-0.689541 Q15*/}},
- {{ 28106/*0.857729 Q15*/, -16846/*-0.514103 Q15*/}},
- {{ 31114/*0.949528 Q15*/, -10279/*-0.313682 Q15*/}},
- {{ 32610/*0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
- {{ 32522/*0.992480 Q15*/, 4011/*0.122411 Q15*/}},
- {{ 30853/*0.941544 Q15*/, 11039/*0.336890 Q15*/}},
- {{ 27684/*0.844854 Q15*/, 17531/*0.534998 Q15*/}},
- {{ 23170/*0.707107 Q15*/, 23170/*0.707107 Q15*/}},
- {{ 17531/*0.534998 Q15*/, 27684/*0.844854 Q15*/}},
- {{ 11039/*0.336890 Q15*/, 30853/*0.941544 Q15*/}},
- {{ 4011/*0.122411 Q15*/, 32522/*0.992480 Q15*/}},
- {{ -3212/*-0.098017 Q15*/, 32610/*0.995185 Q15*/}},
- {{-10279/*-0.313682 Q15*/, 31114/*0.949528 Q15*/}},
- {{-16846/*-0.514103 Q15*/, 28106/*0.857729 Q15*/}},
- {{-22595/*-0.689541 Q15*/, 23732/*0.724247 Q15*/}},
- {{-27246/*-0.831470 Q15*/, 18205/*0.555570 Q15*/}},
- {{-30572/*-0.932993 Q15*/, 11793/*0.359895 Q15*/}},
- {{-32413/*-0.989177 Q15*/, 4808/*0.146730 Q15*/}},
- {{-32679/*-0.997290 Q15*/, -2411/*-0.073565 Q15*/}},
- {{-31357/*-0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
- {{-28511/*-0.870087 Q15*/, -16151/*-0.492898 Q15*/}},
- {{-24279/*-0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
- {{-18868/*-0.575808 Q15*/, -26791/*-0.817585 Q15*/}},
- {{-12540/*-0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{ -5602/*-0.170962 Q15*/, -32286/*-0.985278 Q15*/}},
- {{ 1608/*0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
- {{ 8740/*0.266713 Q15*/, -31581/*-0.963776 Q15*/}},
- {{ 15447/*0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
- {{ 21403/*0.653173 Q15*/, -24812/*-0.757209 Q15*/}},
- {{ 26320/*0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
- {{ 29957/*0.914210 Q15*/, -13279/*-0.405241 Q15*/}},
- {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{ 32758/*0.999699 Q15*/, 804/*0.024541 Q15*/}},
- {{ 31786/*0.970031 Q15*/, 7962/*0.242980 Q15*/}},
- {{ 29269/*0.893224 Q15*/, 14733/*0.449611 Q15*/}},
- {{ 25330/*0.773010 Q15*/, 20788/*0.634393 Q15*/}},
- {{ 20160/*0.615232 Q15*/, 25833/*0.788346 Q15*/}},
- {{ 14010/*0.427555 Q15*/, 29622/*0.903989 Q15*/}},
- {{ 7180/*0.219101 Q15*/, 31972/*0.975702 Q15*/}},
- {{ 0/*0.000000 Q15*/, 32767/*1.000000 Q15*/}},
- {{ -7180/*-0.219101 Q15*/, 31972/*0.975702 Q15*/}},
- {{-14010/*-0.427555 Q15*/, 29622/*0.903989 Q15*/}},
- {{-20160/*-0.615232 Q15*/, 25833/*0.788346 Q15*/}},
- {{-25330/*-0.773010 Q15*/, 20788/*0.634393 Q15*/}},
- {{-29269/*-0.893224 Q15*/, 14733/*0.449611 Q15*/}},
- {{-31786/*-0.970031 Q15*/, 7962/*0.242980 Q15*/}},
- {{-32758/*-0.999699 Q15*/, 804/*0.024541 Q15*/}},
- {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
- {{-29957/*-0.914210 Q15*/, -13279/*-0.405241 Q15*/}},
- {{-26320/*-0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
- {{-21403/*-0.653173 Q15*/, -24812/*-0.757209 Q15*/}},
- {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
- {{ -8740/*-0.266713 Q15*/, -31581/*-0.963776 Q15*/}},
- {{ -1608/*-0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
- {{ 5602/*0.170962 Q15*/, -32286/*-0.985278 Q15*/}},
- {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
- {{ 18868/*0.575808 Q15*/, -26791/*-0.817585 Q15*/}},
- {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
- {{ 28511/*0.870087 Q15*/, -16151/*-0.492898 Q15*/}},
- {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
- {{ 32679/*0.997290 Q15*/, -2411/*-0.073565 Q15*/}},
- {{ 32413/*0.989177 Q15*/, 4808/*0.146730 Q15*/}},
- {{ 30572/*0.932993 Q15*/, 11793/*0.359895 Q15*/}},
- {{ 27246/*0.831470 Q15*/, 18205/*0.555570 Q15*/}},
- {{ 22595/*0.689541 Q15*/, 23732/*0.724247 Q15*/}},
- {{ 16846/*0.514103 Q15*/, 28106/*0.857729 Q15*/}},
- {{ 10279/*0.313682 Q15*/, 31114/*0.949528 Q15*/}},
- {{ 3212/*0.098017 Q15*/, 32610/*0.995185 Q15*/}},
- {{ -4011/*-0.122411 Q15*/, 32522/*0.992480 Q15*/}},
- {{-11039/*-0.336890 Q15*/, 30853/*0.941544 Q15*/}},
- {{-17531/*-0.534998 Q15*/, 27684/*0.844854 Q15*/}},
- {{-23170/*-0.707107 Q15*/, 23170/*0.707107 Q15*/}},
- {{-27684/*-0.844854 Q15*/, 17531/*0.534998 Q15*/}},
- {{-30853/*-0.941544 Q15*/, 11039/*0.336890 Q15*/}},
- {{-32522/*-0.992480 Q15*/, 4011/*0.122411 Q15*/}},
- {{-32610/*-0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
- {{-31114/*-0.949528 Q15*/, -10279/*-0.313682 Q15*/}},
- {{-28106/*-0.857729 Q15*/, -16846/*-0.514103 Q15*/}},
- {{-23732/*-0.724247 Q15*/, -22595/*-0.689541 Q15*/}},
- {{-18205/*-0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
- {{-11793/*-0.359895 Q15*/, -30572/*-0.932993 Q15*/}},
- {{ -4808/*-0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
- {{ 2411/*0.073565 Q15*/, -32679/*-0.997290 Q15*/}},
- {{ 9512/*0.290285 Q15*/, -31357/*-0.956940 Q15*/}},
- {{ 16151/*0.492898 Q15*/, -28511/*-0.870087 Q15*/}},
- {{ 22006/*0.671559 Q15*/, -24279/*-0.740951 Q15*/}},
- {{ 26791/*0.817585 Q15*/, -18868/*-0.575808 Q15*/}},
- {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
- {{ 32286/*0.985278 Q15*/, -5602/*-0.170962 Q15*/}},
- {{ 32729/*0.998795 Q15*/, 1608/*0.049068 Q15*/}},
- {{ 31581/*0.963776 Q15*/, 8740/*0.266713 Q15*/}},
- {{ 28899/*0.881921 Q15*/, 15447/*0.471397 Q15*/}},
- {{ 24812/*0.757209 Q15*/, 21403/*0.653173 Q15*/}},
- {{ 19520/*0.595699 Q15*/, 26320/*0.803208 Q15*/}},
- {{ 13279/*0.405241 Q15*/, 29957/*0.914210 Q15*/}},
- {{ 6393/*0.195090 Q15*/, 32138/*0.980785 Q15*/}},
- {{ -804/*-0.024541 Q15*/, 32758/*0.999699 Q15*/}},
- {{ -7962/*-0.242980 Q15*/, 31786/*0.970031 Q15*/}},
- {{-14733/*-0.449611 Q15*/, 29269/*0.893224 Q15*/}},
- {{-20788/*-0.634393 Q15*/, 25330/*0.773010 Q15*/}},
- {{-25833/*-0.788346 Q15*/, 20160/*0.615232 Q15*/}},
- {{-29622/*-0.903989 Q15*/, 14010/*0.427555 Q15*/}},
- {{-31972/*-0.975702 Q15*/, 7180/*0.219101 Q15*/}}
-};
-
-/*-------------------------------------------------------------------*
- * 1/4 resolution interpolation filter (-3 dB at 0.791*fs/2)
- * for fractional pitch search
- * Used in lib_enc\pit_enc.c Q14
- *-------------------------------------------------------------------*/
-const Word16 inter4_1_fx[32] =//Q14
-{
- -12, -26, 32, 206,
- 420, 455, 73, -766,
- -1732, -2142,-1242, 1376,
- 5429, 9910,13418,14746,
- 13418, 9910, 5429, 1376,
- -1242, -2142,-1732, -766,
- 73, 455, 420, 206,
- 32, -26, -12, 0
-};
-
-const Word16 sin_switch_8[15] = { 3212, 6393, 9512, 12540, 15447, 18205, 20788, 23170,
- 25330, 27246, 28899, 30274, 31357, 32138, 32610
-};//Q15
-
-const Word16 sin_switch_16[30] = { 1660, 3315, 4962, 6596, 8213, 9810, 11380, 12922,
- 14431, 15902, 17333, 18719, 20057, 21344, 22576, 23750,
- 24863, 25912, 26895, 27808, 28651, 29419, 30112, 30728,
- 31265, 31722, 32097, 32390, 32600, 32726
-};//Q15
-
-
-const Word16 sin_switch_32[60] = { 844, 1687, 2529, 3369, 4207, 5043, 5875, 6703,
- 7526, 8345, 9158, 9965, 10766, 11559, 12345, 13122,
- 13891, 14650, 15400, 16140, 16869, 17586, 18293, 18986,
- 19668, 20336, 20991, 21632, 22258, 22870, 23467, 24048,
- 24613, 25162, 25694, 26209, 26707, 27187, 27649, 28092,
- 28518, 28924, 29311, 29678, 30026, 30354, 30662, 30949,
- 31216, 31462, 31688, 31892, 32075, 32237, 32378, 32497,
- 32594, 32670, 32725, 32757
-};//Q15
-
-
-const Word16 sin_switch_48[90] = { 566, 1131, 1696, 2261, 2825, 3388, 3950, 4511,
- 5070, 5628, 6185, 6739, 7292, 7842, 8390, 8935,
- 9478, 10018, 10555, 11089, 11620, 12147, 12670, 13190,
- 13706, 14218, 14725, 15228, 15727, 16220, 16709, 17194,
- 17672, 18146, 18614, 19077, 19534, 19985, 20431, 20870,
- 21303, 21729, 22149, 22563, 22970, 23370, 23763, 24148,
- 24527, 24899, 25263, 25619, 25968, 26309, 26642, 26968,
- 27285, 27594, 27895, 28188, 28472, 28747, 29015, 29273,
- 29523, 29764, 29996, 30219, 30433, 30639, 30835, 31021,
- 31199, 31367, 31526, 31676, 31816, 31946, 32068, 32179,
- 32281, 32373, 32456, 32529, 32592, 32646, 32690, 32724,
- 32748, 32763
-};//Q15
-
-const Word16 one_on_win_48k_fx[210] =
-{
- 16399, 16412, 16425, 16439, 16452, 16465, 16479, 16492,
- 16506, 16519, 16533, 16547, 16561, 16575, 16589, 16603,
- 16618, 16632, 16647, 16662, 16677, 16692, 16707, 16722,
- 16738, 16754, 16770, 16786, 16802, 16818, 16835, 16851,
- 16868, 16885, 16902, 16919, 16937, 16955, 16972, 16990,
- 17008, 17027, 17045, 17064, 17083, 17102, 17121, 17140,
- 17160, 17180, 17200, 17220, 17240, 17261, 17281, 17302,
- 17323, 17345, 17366, 17388, 17410, 17432, 17454, 17477,
- 17499, 17522, 17545, 17569, 17592, 17616, 17640, 17664,
- 17689, 17713, 17738, 17763, 17789, 17814, 17840, 17866,
- 17892, 17918, 17945, 17972, 17999, 18027, 18054, 18082,
- 18110, 18139, 18167, 18196, 18225, 18255, 18284, 18314,
- 18345, 18375, 18406, 18437, 18468, 18499, 18531, 18563,
- 18596, 18628, 18661, 18695, 18728, 18762, 18796, 18830,
- 18865, 18900, 18935, 18971, 19007, 19043, 19080, 19117,
- 19154, 19191, 19229, 19267, 19306, 19345, 19384, 19423,
- 19463, 19504, 19544, 19585, 19626, 19668, 19710, 19752,
- 19795, 19838, 19882, 19926, 19970, 20015, 20060, 20105,
- 20151, 20198, 20244, 20291, 20339, 20387, 20435, 20484,
- 20533, 20583, 20633, 20684, 20735, 20787, 20839, 20891,
- 20944, 20997, 21051, 21106, 21161, 21216, 21272, 21328,
- 21385, 21443, 21501, 21559, 21618, 21678, 21738, 21799,
- 21860, 21922, 21984, 22048, 22111, 22175, 22240, 22306,
- 22372, 22439, 22506, 22574, 22643, 22712, 22782, 22853,
- 22924, 22996, 23069, 23142, 23216, 23291, 23367, 23443,
- 23521, 23599, 23677, 23757, 23837, 23918, 24000, 24083,
- 24167, 24251
-};//Q14
-
-const Word16 one_on_win_8k_16k_48k_fx[70] =
-{
- 16432, 16472, 16512, 16554, 16596, 16639, 16684, 16730,
- 16778, 16826, 16876, 16928, 16981, 17036, 17092, 17150,
- 17210, 17271, 17334, 17399, 17465, 17534, 17604, 17676,
- 17751, 17827, 17905, 17986, 18068, 18153, 18240, 18329,
- 18421, 18515, 18612, 18711, 18813, 18918, 19025, 19135,
- 19248, 19364, 19483, 19606, 19731, 19860, 19992, 20128,
- 20268, 20411, 20558, 20709, 20865, 21024, 21188, 21357,
- 21530, 21708, 21891, 22079, 22273, 22472, 22677, 22888,
- 23105, 23329, 23560, 23797, 24041, 24251
-};//Q14
-
-const Word16 window_8_16_32kHz_fx[370] =
-{
- 3, 9, 19, 33, 49, 69, 93, 119,
- 149, 182, 219, 258, 301, 347, 396, 448,
- 503, 561, 623, 687, 755, 825, 898, 974,
- 1054, 1136, 1221, 1309, 1399, 1493, 1589, 1688,
- 1790, 1895, 2002, 2112, 2225, 2340, 2458, 2579,
- 2702, 2827, 2955, 3086, 3219, 3355, 3493, 3633,
- 3775, 3920, 4068, 4217, 4369, 4523, 4679, 4837,
- 4998, 5160, 5325, 5491, 5660, 5830, 6003, 6177,
- 6353, 6531, 6711, 6892, 7076, 7260, 7447, 7635,
- 7825, 8016, 8209, 8403, 8599, 8796, 8995, 9195,
- 9396, 9598, 9802, 10007, 10212, 10419, 10628, 10837,
- 11047, 11248, 11437, 11623, 11809, 11997, 12185, 12374,
- 12564, 12754, 12944, 13135, 13326, 13517, 13709, 13901,
- 14093, 14286, 14478, 14671, 14864, 15057, 15250, 15443,
- 15636, 15829, 16023, 16216, 16409, 16602, 16794, 16987,
- 17179, 17372, 17564, 17755, 17947, 18138, 18329, 18519,
- 18710, 18899, 19089, 19278, 19466, 19654, 19841, 20028,
- 20214, 20400, 20585, 20770, 20954, 21137, 21319, 21501,
- 21682, 21862, 22042, 22220, 22398, 22575, 22751, 22926,
- 23101, 23274, 23446, 23618, 23788, 23958, 24126, 24266,
- 24321, 24460, 24625, 24789, 24953, 25114, 25275, 25435,
- 25593, 25751, 25907, 26061, 26215, 26367, 26518, 26668,
- 26817, 26964, 27110, 27254, 27398, 27540, 27680, 27819,
- 27957, 28093, 28228, 28362, 28494, 28625, 28754, 28882,
- 29008, 29133, 29256, 29378, 29499, 29618, 29736, 29852,
- 29966, 30079, 30191, 30301, 30410, 30517, 30623, 30727,
- 30830, 30931, 31031, 31129, 31226, 31322, 31416, 31508,
- 31599, 31689, 31777, 31864, 31950, 32035, 32118, 32200,
- 32280, 32360, 32439, 32517, 32595, 32673, 32673, 32593,
- 32513, 32432, 32349, 32265, 32178, 32090, 31999, 31907,
- 31812, 31715, 31615, 31514, 31410, 31304, 31196, 31085,
- 30972, 30857, 30739, 30619, 30497, 30372, 30245, 30116,
- 29984, 29850, 29714, 29575, 29434, 29290, 29144, 28996,
- 28845, 28692, 28537, 28379, 28219, 28057, 27892, 27725,
- 27555, 27383, 27209, 27033, 26854, 26672, 26489, 26303,
- 26115, 25924, 25731, 25536, 25338, 25138, 24936, 24731,
- 24525, 24316, 24104, 23890, 23674, 23456, 23236, 23013,
- 22788, 22561, 22331, 22138, 22060, 21865, 21629, 21390,
- 21150, 20907, 20662, 20414, 20165, 19913, 19659, 19403,
- 19145, 18885, 18622, 18357, 18090, 17821, 17550, 17277,
- 17001, 16723, 16443, 16161, 15877, 15591, 15303, 15012,
- 14719, 14425, 14127, 13828, 13527, 13223, 12918, 12610,
- 12300, 11988, 11673, 11356, 11038, 10716, 10393, 10067,
- 9739, 9408, 9076, 8740, 8403, 8062, 7720, 7374,
- 7026, 6675, 6322, 5965, 5606, 5243, 4878, 4508,
- 4136, 3759, 3378, 2993, 2603, 2208, 1807, 1397,
- 978, 545
-};//Q15
-
-const Word16 window_48kHz_fx[1110] =
-{
- 0, 1, 2, 3, 5, 8, 10, 13,
- 17, 21, 25, 30, 35, 40, 46, 52,
- 58, 65, 72, 80, 88, 96, 105, 114,
- 124, 133, 144, 154, 165, 176, 188, 200,
- 212, 225, 238, 251, 265, 279, 293, 308,
- 323, 339, 354, 371, 387, 404, 421, 439,
- 457, 475, 493, 512, 532, 551, 571, 591,
- 612, 633, 654, 676, 698, 720, 743, 766,
- 789, 813, 837, 861, 885, 910, 936, 961,
- 987, 1013, 1040, 1067, 1094, 1122, 1149, 1178,
- 1206, 1235, 1264, 1293, 1323, 1353, 1384, 1414,
- 1445, 1477, 1508, 1540, 1573, 1605, 1638, 1671,
- 1705, 1739, 1773, 1807, 1842, 1877, 1912, 1948,
- 1984, 2020, 2057, 2093, 2130, 2168, 2206, 2244,
- 2282, 2320, 2359, 2399, 2438, 2478, 2518, 2558,
- 2599, 2640, 2681, 2722, 2764, 2806, 2848, 2891,
- 2934, 2977, 3020, 3064, 3108, 3152, 3196, 3241,
- 3286, 3332, 3377, 3423, 3469, 3515, 3562, 3609,
- 3656, 3704, 3751, 3799, 3847, 3896, 3945, 3994,
- 4043, 4092, 4142, 4192, 4242, 4293, 4343, 4394,
- 4445, 4497, 4549, 4600, 4653, 4705, 4758, 4811,
- 4864, 4917, 4971, 5024, 5078, 5133, 5187, 5242,
- 5297, 5352, 5407, 5463, 5519, 5575, 5631, 5688,
- 5744, 5801, 5859, 5916, 5974, 6031, 6089, 6147,
- 6206, 6265, 6323, 6382, 6442, 6501, 6561, 6620,
- 6680, 6741, 6801, 6862, 6922, 6983, 7045, 7106,
- 7168, 7229, 7291, 7353, 7416, 7478, 7541, 7604,
- 7667, 7730, 7793, 7857, 7920, 7984, 8048, 8112,
- 8177, 8241, 8306, 8371, 8436, 8501, 8566, 8632,
- 8697, 8763, 8829, 8895, 8961, 9028, 9094, 9161,
- 9228, 9295, 9362, 9429, 9497, 9564, 9632, 9700,
- 9768, 9836, 9904, 9972, 10041, 10109, 10178, 10247,
- 10316, 10385, 10454, 10523, 10593, 10662, 10732, 10802,
- 10871, 10941, 11012, 11082, 11152, 11222, 11283, 11344,
- 11406, 11467, 11529, 11591, 11653, 11716, 11778, 11840,
- 11903, 11966, 12028, 12091, 12154, 12217, 12280, 12343,
- 12406, 12469, 12532, 12595, 12658, 12722, 12785, 12849,
- 12912, 12976, 13039, 13103, 13166, 13230, 13294, 13358,
- 13421, 13485, 13549, 13613, 13677, 13741, 13805, 13869,
- 13933, 13997, 14061, 14125, 14189, 14253, 14318, 14382,
- 14446, 14510, 14574, 14639, 14703, 14767, 14832, 14896,
- 14960, 15025, 15089, 15153, 15218, 15282, 15346, 15411,
- 15475, 15540, 15604, 15668, 15733, 15797, 15862, 15926,
- 15990, 16055, 16119, 16183, 16248, 16312, 16376, 16441,
- 16505, 16569, 16634, 16698, 16762, 16826, 16891, 16955,
- 17019, 17083, 17147, 17211, 17275, 17339, 17404, 17468,
- 17532, 17596, 17659, 17723, 17787, 17851, 17915, 17979,
- 18042, 18106, 18170, 18233, 18297, 18361, 18424, 18488,
- 18551, 18614, 18678, 18741, 18804, 18868, 18931, 18994,
- 19057, 19120, 19183, 19246, 19309, 19372, 19434, 19497,
- 19560, 19622, 19685, 19748, 19810, 19872, 19935, 19997,
- 20059, 20121, 20183, 20245, 20307, 20369, 20431, 20493,
- 20554, 20616, 20677, 20739, 20800, 20862, 20923, 20984,
- 21045, 21106, 21167, 21228, 21289, 21349, 21410, 21471,
- 21531, 21591, 21652, 21712, 21772, 21832, 21892, 21952,
- 22012, 22071, 22131, 22190, 22250, 22309, 22368, 22427,
- 22486, 22545, 22604, 22663, 22722, 22780, 22839, 22897,
- 22955, 23013, 23071, 23129, 23187, 23245, 23303, 23360,
- 23418, 23475, 23532, 23589, 23646, 23703, 23760, 23817,
- 23873, 23930, 23986, 24042, 24098, 24154, 24210, 24266,
- 24321, 24377, 24432, 24488, 24543, 24598, 24653, 24707,
- 24762, 24817, 24871, 24925, 24979, 25034, 25087, 25141,
- 25195, 25248, 25302, 25355, 25408, 25461, 25514, 25567,
- 25620, 25672, 25724, 25777, 25829, 25881, 25932, 25984,
- 26036, 26087, 26138, 26189, 26240, 26291, 26342, 26393,
- 26443, 26493, 26543, 26593, 26643, 26693, 26743, 26792,
- 26841, 26890, 26939, 26988, 27037, 27086, 27134, 27182,
- 27230, 27278, 27326, 27374, 27421, 27469, 27516, 27563,
- 27610, 27657, 27703, 27750, 27796, 27842, 27888, 27934,
- 27980, 28025, 28071, 28116, 28161, 28206, 28250, 28295,
- 28340, 28384, 28428, 28472, 28516, 28559, 28603, 28646,
- 28689, 28732, 28775, 28818, 28860, 28903, 28945, 28987,
- 29029, 29071, 29112, 29154, 29195, 29236, 29277, 29318,
- 29358, 29399, 29439, 29479, 29519, 29559, 29598, 29638,
- 29677, 29716, 29755, 29794, 29832, 29871, 29909, 29947,
- 29985, 30023, 30061, 30098, 30135, 30172, 30209, 30246,
- 30283, 30319, 30356, 30392, 30428, 30464, 30499, 30535,
- 30570, 30605, 30640, 30675, 30710, 30744, 30779, 30813,
- 30847, 30881, 30914, 30948, 30981, 31014, 31047, 31080,
- 31113, 31145, 31178, 31210, 31242, 31274, 31306, 31337,
- 31369, 31400, 31431, 31462, 31493, 31523, 31554, 31584,
- 31614, 31644, 31674, 31704, 31733, 31763, 31792, 31821,
- 31850, 31879, 31907, 31936, 31964, 31992, 32020, 32048,
- 32076, 32104, 32131, 32159, 32186, 32213, 32240, 32267,
- 32294, 32320, 32347, 32373, 32399, 32426, 32452, 32478,
- 32504, 32530, 32556, 32582, 32607, 32633, 32659, 32685,
- 32712, 32739, 32739, 32712, 32685, 32659, 32633, 32606,
- 32580, 32553, 32527, 32500, 32473, 32446, 32418, 32391,
- 32363, 32335, 32307, 32279, 32251, 32222, 32193, 32164,
- 32134, 32105, 32075, 32045, 32015, 31984, 31953, 31922,
- 31891, 31859, 31828, 31796, 31764, 31731, 31698, 31665,
- 31632, 31599, 31565, 31531, 31497, 31462, 31428, 31393,
- 31357, 31322, 31286, 31250, 31214, 31177, 31141, 31104,
- 31066, 31029, 30991, 30953, 30915, 30876, 30837, 30798,
- 30759, 30719, 30679, 30639, 30599, 30558, 30517, 30476,
- 30435, 30393, 30351, 30309, 30266, 30224, 30181, 30138,
- 30094, 30050, 30006, 29962, 29917, 29873, 29827, 29782,
- 29737, 29691, 29645, 29598, 29551, 29505, 29457, 29410,
- 29362, 29314, 29266, 29218, 29169, 29120, 29070, 29021,
- 28971, 28921, 28871, 28820, 28769, 28718, 28667, 28615,
- 28563, 28511, 28459, 28406, 28353, 28300, 28246, 28192,
- 28138, 28084, 28030, 27975, 27920, 27864, 27809, 27753,
- 27697, 27640, 27584, 27527, 27470, 27412, 27355, 27297,
- 27238, 27180, 27121, 27062, 27003, 26944, 26884, 26824,
- 26763, 26703, 26642, 26581, 26520, 26458, 26396, 26334,
- 26272, 26209, 26146, 26083, 26020, 25956, 25892, 25828,
- 25763, 25699, 25634, 25568, 25503, 25437, 25371, 25305,
- 25239, 25172, 25105, 25037, 24970, 24902, 24834, 24766,
- 24697, 24628, 24559, 24490, 24420, 24351, 24281, 24210,
- 24140, 24069, 23998, 23926, 23855, 23783, 23711, 23638,
- 23566, 23493, 23420, 23346, 23273, 23199, 23125, 23050,
- 22976, 22901, 22826, 22750, 22675, 22599, 22523, 22446,
- 22370, 22293, 22215, 22138, 22060, 21983, 21904, 21826,
- 21747, 21669, 21589, 21510, 21430, 21351, 21271, 21190,
- 21110, 21029, 20948, 20866, 20785, 20703, 20621, 20538,
- 20456, 20373, 20290, 20207, 20123, 20039, 19955, 19871,
- 19787, 19702, 19617, 19532, 19446, 19360, 19274, 19188,
- 19102, 19015, 18928, 18841, 18754, 18666, 18578, 18490,
- 18402, 18313, 18224, 18135, 18046, 17956, 17866, 17776,
- 17686, 17595, 17505, 17414, 17322, 17231, 17139, 17047,
- 16955, 16863, 16770, 16677, 16584, 16490, 16397, 16303,
- 16209, 16114, 16020, 15925, 15830, 15735, 15639, 15543,
- 15447, 15351, 15254, 15158, 15061, 14964, 14866, 14768,
- 14671, 14572, 14474, 14375, 14276, 14177, 14078, 13978,
- 13878, 13778, 13678, 13578, 13477, 13376, 13274, 13173,
- 13071, 12969, 12867, 12764, 12662, 12559, 12455, 12352,
- 12248, 12144, 12040, 11936, 11831, 11726, 11621, 11515,
- 11410, 11304, 11197, 11091, 10984, 10877, 10770, 10663,
- 10555, 10447, 10339, 10230, 10122, 10013, 9904, 9794,
- 9684, 9574, 9464, 9353, 9243, 9131, 9020, 8908,
- 8797, 8684, 8572, 8459, 8346, 8233, 8119, 8006,
- 7892, 7777, 7662, 7547, 7432, 7317, 7201, 7085,
- 6968, 6851, 6734, 6617, 6499, 6381, 6263, 6144,
- 6025, 5906, 5786, 5666, 5546, 5425, 5304, 5183,
- 5061, 4939, 4817, 4694, 4570, 4447, 4323, 4198,
- 4074, 3948, 3823, 3696, 3570, 3443, 3315, 3187,
- 3058, 2929, 2800, 2669, 2539, 2407, 2275, 2142,
- 2009, 1875, 1740, 1604, 1467, 1330, 1191, 1051,
- 909, 766, 621, 474, 324, 169
-};//Q15
-
-const Word16 window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?Q15*/
-{
- 1, 3, 7, 12, 19, 27, 36, 47,
- 58, 72, 86, 102, 119, 138, 157, 178,
- 201, 224, 249, 275, 302, 331, 361, 391,
- 424, 457, 492, 527, 564, 603, 642, 683,
- 724, 767, 811, 857, 903, 951, 999, 1049,
- 1100, 1152, 1205, 1260, 1315, 1372, 1430, 1488,
- 1548, 1609, 1671, 1735, 1799, 1864, 1931, 1998,
- 2066, 2136, 2207, 2278, 2351, 2424, 2499, 2575,
- 2651, 2729, 2808, 2887, 2968, 3049, 3132, 3215,
- 3300, 3385, 3472, 3559, 3647, 3736, 3826, 3917,
- 4009, 4101, 4195, 4289, 4385, 4481, 4578, 4676,
- 4774, 4874, 4974, 5075, 5177, 5280, 5384, 5488,
- 5593, 5699, 5806, 5913, 6021, 6130, 6240, 6350,
- 6461, 6573, 6685, 6798, 6912, 7026, 7141, 7257,
- 7373, 7491, 7608, 7726, 7845, 7965, 8085, 8206,
- 8327, 8449, 8571, 8694, 8817, 8941, 9066, 9191,
- 9316, 9442, 9569, 9696, 9823, 9951, 10079, 10208,
- 10337, 10467, 10597, 10727, 10858, 10990, 11121, 11253,
- 11367, 11482, 11598, 11714, 11831, 11948, 12065, 12182,
- 12300, 12418, 12536, 12654, 12772, 12891, 13010, 13129,
- 13248, 13367, 13486, 13605, 13725, 13844, 13964, 14084,
- 14203, 14323, 14443, 14563, 14683, 14804, 14924, 15044,
- 15164, 15284, 15405, 15525, 15645, 15765, 15885, 16006,
- 16126, 16246, 16366, 16486, 16606, 16726, 16846, 16966,
- 17086, 17206, 17325, 17445, 17564, 17684, 17803, 17922,
- 18041, 18160, 18279, 18397, 18516, 18634, 18753, 18871,
- 18988, 19106, 19224, 19341, 19458, 19575, 19692, 19809,
- 19925, 20041, 20157, 20273, 20388, 20503, 20618, 20733,
- 20848, 20962, 21076, 21190, 21303, 21416, 21529, 21642,
- 21754, 21866, 21978, 22089, 22200, 22311, 22421, 22531,
- 22641, 22751, 22860, 22968, 23077, 23185, 23293, 23400,
- 23507, 23613, 23719, 23825, 23931, 24036, 24140, 24244,
- 24348, 24452, 24555, 24657, 24759, 24861, 24962, 25063,
- 25163, 25263, 25363, 25462, 25561, 25659, 25756, 25854,
- 25950, 26047, 26142, 26238, 26333, 26427, 26521, 26614,
- 26707, 26799, 26891, 26982, 27073, 27164, 27253, 27343,
- 27432, 27520, 27608, 27695, 27781, 27868, 27953, 28038,
- 28123, 28207, 28290, 28373, 28456, 28537, 28619, 28699,
- 28780, 28859, 28938, 29017, 29095, 29172, 29249, 29325,
- 29401, 29476, 29550, 29624, 29698, 29771, 29843, 29915,
- 29986, 30056, 30126, 30196, 30264, 30333, 30400, 30467,
- 30534, 30600, 30665, 30730, 30794, 30858, 30921, 30984,
- 31046, 31107, 31168, 31228, 31288, 31347, 31406, 31464,
- 31522, 31579, 31635, 31691, 31746, 31801, 31856, 31909,
- 31963, 32016, 32068, 32120, 32171, 32222, 32273, 32323,
- 32372, 32422, 32471, 32520, 32568, 32617, 32666, 32715,
- 32715, 32666, 32616, 32567, 32517, 32466, 32415, 32364,
- 32311, 32258, 32204, 32150, 32094, 32038, 31981, 31923,
- 31864, 31805, 31744, 31683, 31621, 31557, 31494, 31429,
- 31363, 31296, 31229, 31161, 31091, 31021, 30950, 30878,
- 30805, 30731, 30657, 30581, 30505, 30427, 30349, 30270,
- 30189, 30108, 30026, 29943, 29860, 29775, 29689, 29603,
- 29515, 29427, 29337, 29247, 29156, 29064, 28971, 28877,
- 28782, 28687, 28590, 28492, 28394, 28294, 28194, 28093,
- 27991, 27888, 27784, 27679, 27573, 27466, 27358, 27250,
- 27140, 27030, 26919, 26806, 26693, 26579, 26464, 26349,
- 26232, 26114, 25996, 25876, 25756, 25635, 25512, 25389,
- 25265, 25140, 25015, 24888, 24761, 24632, 24503, 24373,
- 24242, 24110, 23977, 23843, 23708, 23573, 23436, 23299,
- 23161, 23022, 22882, 22741, 22599, 22457, 22313, 22169,
- 22024, 21878, 21731, 21583, 21435, 21285, 21135, 20984,
- 20832, 20679, 20525, 20370, 20215, 20059, 19901, 19743,
- 19584, 19425, 19264, 19103, 18940, 18777, 18613, 18448,
- 18283, 18116, 17949, 17781, 17612, 17442, 17271, 17100,
- 16927, 16754, 16580, 16405, 16230, 16053, 15876, 15698,
- 15518, 15339, 15158, 14976, 14794, 14611, 14427, 14242,
- 14056, 13869, 13682, 13494, 13305, 13115, 12924, 12732,
- 12540, 12346, 12152, 11957, 11761, 11564, 11366, 11168,
- 10968, 10768, 10566, 10364, 10161, 9957, 9752, 9547,
- 9340, 9132, 8924, 8714, 8503, 8292, 8079, 7866,
- 7651, 7436, 7219, 7002, 6783, 6563, 6343, 6121,
- 5897, 5673, 5448, 5221, 4993, 4764, 4533, 4301,
- 4067, 3832, 3596, 3358, 3118, 2876, 2632, 2387,
- 2139, 1888, 1635, 1379, 1119, 854, 583, 304
-};
-
-const Word16 small_overlap_48[R2_48 / 7] =//Q15
-{
- 429, 1286, 2143, 2998, 3851, 4702, 5549, 6393,
- 7232, 8066, 8895, 9717, 10533, 11342, 12142, 12935,
- 13719, 14493, 15257, 16011, 16754, 17485, 18205, 18912,
- 19606, 20286, 20953, 21605, 22243, 22865, 23472, 24062,
- 24636, 25193, 25733, 26255, 26760, 27246, 27713, 28161,
- 28590, 28999, 29389, 29758, 30107, 30435, 30743, 31029,
- 31294, 31538, 31760, 31960, 32138, 32295, 32429, 32541,
- 32631, 32698, 32743, 32765
-};
-
-const Word16 small_overlap_25[R2_25 / 7] =//Q15
-{
- 804, 2411, 4011, 5602, 7180, 8740, 10279, 11793,
- 13279, 14733, 16151, 17531, 18868, 20160, 21403, 22595,
- 23732, 24812, 25833, 26791, 27684, 28511, 29269, 29957,
- 30572, 31114, 31581, 31972, 32286, 32522, 32679, 32758
-};
-
-const Word16 small_overlap_int[R2_16 / 7] =//Q15
-{
- 2571, 5126,
- 7650, 10126, 12540, 14876, 17121, 19261, 21281, 22865,
- 23472, 24917, 26510, 27939, 29197, 30274, 31164, 31863,
- 32365, 32667
-};
-
-
-const Word16 half_overlap_48[3 * R2_48 / 7] =//Q15
-{
- 143, 429,
- 715, 1001, 1286, 1572, 1858, 2143, 2428, 2713,
- 2998, 3283, 3567, 3851, 4135, 4419, 4702, 4985,
- 5267, 5549, 5831, 6112, 6393, 6673, 6953, 7232,
- 7510, 7788, 8066, 8343, 8619, 8895, 9169, 9444,
- 9717, 9990, 10262, 10533, 10803, 11073, 11342, 11609,
- 11876, 12142, 12408, 12672, 12935, 13197, 13458, 13719,
- 13978, 14236, 14493, 14749, 15004, 15257, 15510, 15761,
- 16011, 16260, 16508, 16754, 16999, 17243, 17485, 17727,
- 17966, 18205, 18442, 18678, 18912, 19145, 19376, 19606,
- 19834, 20061, 20286, 20510, 20732, 20953, 21172, 21390,
- 21605, 21820, 22032, 22243, 22452, 22659, 22865, 23069,
- 23271, 23472, 23670, 23867, 24062, 24255, 24447, 24636,
- 24824, 25010, 25193, 25375, 25555, 25733, 25909, 26083,
- 26255, 26426, 26594, 26760, 26924, 27086, 27246, 27403,
- 27559, 27713, 27864, 28014, 28161, 28306, 28449, 28590,
- 28729, 28865, 28999, 29131, 29261, 29389, 29514, 29637,
- 29758, 29877, 29993, 30107, 30219, 30328, 30435, 30540,
- 30643, 30743, 30840, 30936, 31029, 31120, 31208, 31294,
- 31378, 31459, 31538, 31614, 31688, 31760, 31829, 31896,
- 31960, 32022, 32081, 32138, 32193, 32245, 32295, 32342,
- 32387, 32429, 32469, 32506, 32541, 32573, 32603, 32631,
- 32655, 32678, 32698, 32715, 32730, 32743, 32753, 32760,
- 32765, 32767
-};
-
-const Word16 half_overlap_25[3 * R2_25 / 7] =//Q15
-{
- 268, 804, 1340, 1876, 2411, 2945, 3479, 4011,
- 4543, 5073, 5602, 6130, 6655, 7180, 7702, 8222,
- 8740, 9255, 9768, 10279, 10786, 11291, 11793, 12292,
- 12787, 13279, 13767, 14252, 14733, 15210, 15683, 16151,
- 16616, 17075, 17531, 17981, 18427, 18868, 19304, 19735,
- 20160, 20580, 20994, 21403, 21806, 22204, 22595, 22980,
- 23359, 23732, 24099, 24459, 24812, 25159, 25499, 25833,
- 26159, 26478, 26791, 27096, 27394, 27684, 27967, 28243,
- 28511, 28771, 29024, 29269, 29506, 29736, 29957, 30170,
- 30375, 30572, 30761, 30942, 31114, 31278, 31434, 31581,
- 31720, 31850, 31972, 32085, 32190, 32286, 32373, 32452,
- 32522, 32583, 32635, 32679, 32714, 32741, 32758, 32767
-};
-
-const Word16 half_overlap_int[3 * R2_16 / 7] =//Q15
-{
- 858, 1715, 2571, 3425, 4277, 5126,
- 5971, 6813, 7650, 8481, 9307, 10126, 10938, 11743,
- 12540, 13328, 14107, 14876, 15636, 16384, 17121, 17847,
- 18560, 19261, 19948, 20622, 21281, 21926, 22556, 23069,
- 23271, 23769, 24351, 24917, 25466, 25997, 26510, 27005,
- 27482, 27939, 28378, 28797, 29197, 29576, 29935, 30274,
- 30592, 30888, 31164, 31419, 31651, 31863, 32052, 32219,
- 32365, 32488, 32588, 32667, 32723, 32757
-};
-const Word16 wac_h[LPC_SHB_ORDER] =//Q15
-{
- 32763,
- 32751,
- 32731,
- 32703,
- 32667,
- 32622,
- 32570,
- 32510,
- 32442,
- 32366
-};
-
-const Word16 wac_l[LPC_SHB_ORDER] =//Q15
-{
- 31381,
- 27317,
- 20869,
- 12529,
- 2980,
- 25869,
- 16731,
- 9600,
- 5926,
- 7354
-};
-
-const Word16 dsDiracsTab[65] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 23, 25,
- 27, 29, 31, 33, 35, 37, 39, 43,
- 47, 51, 55, 59, 63, 67, 71, 75,
- 83, 91, 99, 107, 115, 123, 131, 139,
- 147, 163, 179, 195, 211, 227, 243, 259,
- 275, 291, 323, 355, 387, 419, 451, 483,
- 512
-};
-
-const Word16 pwf_fx[17] =//Q12
-{
- 22938, 16056, 11239, 7868, 5507, 3855, 2699, 1889,
- 1322, 926, 648, 454, 317, 222, 156, 109,
- 76
-};
-
-const Word32 inverse_table[] =//Q29
-{
- 0,
- 134217728, 67108864, 44739242, 33554432, 26843545, 22369621, 19173961, 16777216, 14913080, 13421772, 12201611, 11184810, 10324440, 9586980, 8947848, 8388608, 7895160, 7456540, 7064090, 6710886, 6391320, 6100805, 5835553, 5592405, 5368709, 5162220, 4971026, 4793490, 4628197, 4473924, 4329604, 4194304, 4067203, 3947580, 3834792, 3728270, 3627506, 3532045, 3441480, 3355443, 3273603, 3195660, 3121342, 3050402, 2982616, 2917776, 2855696, 2796202, 2739137, 2684354, 2631720, 2581110, 2532409, 2485513, 2440322, 2396745, 2354696, 2314098, 2274876, 2236962, 2200290, 2164802, 2130440, 2097152, 2064888, 2033601, 2003249, 1973790, 1945184, 1917396, 1890390, 1864135, 1838599, 1813753, 1789569, 1766022, 1743087, 1720740, 1698958, 1677721, 1657008, 1636801, 1617081, 1597830, 1579032, 1560671, 1542732, 1525201, 1508064, 1491308, 1474920, 1458888, 1443201, 1427848, 1412818, 1398101, 1383687, 1369568, 1355734, 1342177, 1328888, 1315860, 1303084, 1290555, 1278264, 1266204, 1254371, 1242756, 1231355, 1220161, 1209168, 1198372, 1187767, 1177348, 1167110, 1157049, 1147160, 1137438, 1127880, 1118481, 1109237, 1100145, 1091201, 1082401, 1073741, 1065220, 1056832, 1048576, 1040447, 1032444, 1024562, 1016800, 1009155, 1001624, 994205, 986895, 979691, 972592, 965595, 958698, 951898, 945195, 938585, 932067, 925639, 919299, 913045, 906876, 900790, 894784, 888859, 883011, 877240, 871543, 865920, 860370, 854889, 849479, 844136, 838860, 833650, 828504, 823421, 818400, 813440, 808540, 803698, 798915, 794187, 789516, 784898, 780335, 775825, 771366, 766958, 762600, 758292, 754032, 749819, 745654, 741534, 737460, 733430, 729444, 725501, 721600, 717741, 713924, 710146, 706409, 702710, 699050, 695428, 691843, 688296, 684784, 681308, 677867, 674460, 671088, 667749, 664444, 661171, 657930, 654720, 651542, 648394, 645277, 642190, 639132, 636102, 633102, 630130, 627185, 624268, 621378, 618514, 615677, 612866, 610080, 607320, 604584, 601873, 599186, 596523, 593883, 591267, 588674, 586103, 583555, 581029, 578524, 576041, 573580, 571139, 568719, 566319, 563940, 561580, 559240, 556920, 554618, 552336, 550072, 547827, 545600, 543391, 541200, 539027, 536870, 534731, 532610, 530504, 528416, 526344,
-};
-
-const Word16 cos_diff_table[512] =//Q15
-{
- SHC(0xFFFF), SHC(0xFFF8), SHC(0xFFF4), SHC(0xFFEF), SHC(0xFFE9), SHC(0xFFE5), SHC(0xFFE0), SHC(0xFFDB),
- SHC(0xFFD6), SHC(0xFFD2), SHC(0xFFCC), SHC(0xFFC7), SHC(0xFFC3), SHC(0xFFBE), SHC(0xFFB8), SHC(0xFFB4),
- SHC(0xFFB0), SHC(0xFFAA), SHC(0xFFA5), SHC(0xFFA1), SHC(0xFF9C), SHC(0xFF97), SHC(0xFF92), SHC(0xFF8E),
- SHC(0xFF89), SHC(0xFF84), SHC(0xFF80), SHC(0xFF7B), SHC(0xFF76), SHC(0xFF71), SHC(0xFF6D), SHC(0xFF69),
- SHC(0xFF64), SHC(0xFF5F), SHC(0xFF5B), SHC(0xFF56), SHC(0xFF52), SHC(0xFF4D), SHC(0xFF49), SHC(0xFF45),
- SHC(0xFF40), SHC(0xFF3C), SHC(0xFF38), SHC(0xFF33), SHC(0xFF2F), SHC(0xFF2B), SHC(0xFF27), SHC(0xFF23),
- SHC(0xFF1E), SHC(0xFF1B), SHC(0xFF16), SHC(0xFF13), SHC(0xFF0E), SHC(0xFF0B), SHC(0xFF06), SHC(0xFF03),
- SHC(0xFEFF), SHC(0xFEFB), SHC(0xFEF8), SHC(0xFEF3), SHC(0xFEF1), SHC(0xFEEC), SHC(0xFEE9), SHC(0xFEE5),
- SHC(0xFEE2), SHC(0xFEDF), SHC(0xFEDB), SHC(0xFED8), SHC(0xFED4), SHC(0xFED1), SHC(0xFECE), SHC(0xFECB),
- SHC(0xFEC7), SHC(0xFEC5), SHC(0xFEC1), SHC(0xFEBF), SHC(0xFEBB), SHC(0xFEB9), SHC(0xFEB6), SHC(0xFEB3),
- SHC(0xFEB0), SHC(0xFEAE), SHC(0xFEAB), SHC(0xFEA8), SHC(0xFEA6), SHC(0xFEA3), SHC(0xFEA1), SHC(0xFE9F),
- SHC(0xFE9C), SHC(0xFE9A), SHC(0xFE98), SHC(0xFE95), SHC(0xFE94), SHC(0xFE91), SHC(0xFE8F), SHC(0xFE8E),
- SHC(0xFE8B), SHC(0xFE8A), SHC(0xFE88), SHC(0xFE86), SHC(0xFE85), SHC(0xFE83), SHC(0xFE81), SHC(0xFE80),
- SHC(0xFE7F), SHC(0xFE7D), SHC(0xFE7B), SHC(0xFE7B), SHC(0xFE79), SHC(0xFE79), SHC(0xFE77), SHC(0xFE76),
- SHC(0xFE75), SHC(0xFE74), SHC(0xFE73), SHC(0xFE73), SHC(0xFE72), SHC(0xFE71), SHC(0xFE71), SHC(0xFE70),
- SHC(0xFE6F), SHC(0xFE70), SHC(0xFE6E), SHC(0xFE6F), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E),
- SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6F), SHC(0xFE6E), SHC(0xFE70), SHC(0xFE6F),
- SHC(0xFE70), SHC(0xFE71), SHC(0xFE71), SHC(0xFE72), SHC(0xFE73), SHC(0xFE73), SHC(0xFE74), SHC(0xFE75),
- SHC(0xFE76), SHC(0xFE77), SHC(0xFE79), SHC(0xFE79), SHC(0xFE7B), SHC(0xFE7B), SHC(0xFE7D), SHC(0xFE7F),
- SHC(0xFE80), SHC(0xFE81), SHC(0xFE83), SHC(0xFE85), SHC(0xFE86), SHC(0xFE88), SHC(0xFE8A), SHC(0xFE8B),
- SHC(0xFE8E), SHC(0xFE8F), SHC(0xFE91), SHC(0xFE94), SHC(0xFE95), SHC(0xFE98), SHC(0xFE9A), SHC(0xFE9C),
- SHC(0xFE9F), SHC(0xFEA1), SHC(0xFEA3), SHC(0xFEA6), SHC(0xFEA8), SHC(0xFEAB), SHC(0xFEAE), SHC(0xFEB0),
- SHC(0xFEB3), SHC(0xFEB6), SHC(0xFEB9), SHC(0xFEBB), SHC(0xFEBF), SHC(0xFEC1), SHC(0xFEC5), SHC(0xFEC7),
- SHC(0xFECB), SHC(0xFECE), SHC(0xFED1), SHC(0xFED4), SHC(0xFED8), SHC(0xFEDB), SHC(0xFEDF), SHC(0xFEE2),
- SHC(0xFEE5), SHC(0xFEE9), SHC(0xFEEC), SHC(0xFEF1), SHC(0xFEF3), SHC(0xFEF8), SHC(0xFEFB), SHC(0xFEFF),
- SHC(0xFF03), SHC(0xFF06), SHC(0xFF0B), SHC(0xFF0E), SHC(0xFF13), SHC(0xFF16), SHC(0xFF1B), SHC(0xFF1E),
- SHC(0xFF23), SHC(0xFF27), SHC(0xFF2B), SHC(0xFF2F), SHC(0xFF33), SHC(0xFF38), SHC(0xFF3C), SHC(0xFF40),
- SHC(0xFF45), SHC(0xFF49), SHC(0xFF4D), SHC(0xFF52), SHC(0xFF56), SHC(0xFF5B), SHC(0xFF5F), SHC(0xFF64),
- SHC(0xFF69), SHC(0xFF6D), SHC(0xFF71), SHC(0xFF76), SHC(0xFF7B), SHC(0xFF80), SHC(0xFF84), SHC(0xFF89),
- SHC(0xFF8E), SHC(0xFF92), SHC(0xFF97), SHC(0xFF9C), SHC(0xFFA1), SHC(0xFFA5), SHC(0xFFAA), SHC(0xFFB0),
- SHC(0xFFB4), SHC(0xFFB8), SHC(0xFFBE), SHC(0xFFC3), SHC(0xFFC7), SHC(0xFFCC), SHC(0xFFD2), SHC(0xFFD6),
- SHC(0xFFDB), SHC(0xFFE0), SHC(0xFFE5), SHC(0xFFE9), SHC(0xFFEF), SHC(0xFFF4), SHC(0xFFF8), SHC(0xFFFF),
- SHC(0x0001), SHC(0x0008), SHC(0x000C), SHC(0x0011), SHC(0x0017), SHC(0x001B), SHC(0x0020), SHC(0x0025),
- SHC(0x002A), SHC(0x002E), SHC(0x0034), SHC(0x0039), SHC(0x003D), SHC(0x0042), SHC(0x0048), SHC(0x004C),
- SHC(0x0050), SHC(0x0056), SHC(0x005B), SHC(0x005F), SHC(0x0064), SHC(0x0069), SHC(0x006E), SHC(0x0072),
- SHC(0x0077), SHC(0x007C), SHC(0x0080), SHC(0x0085), SHC(0x008A), SHC(0x008F), SHC(0x0093), SHC(0x0097),
- SHC(0x009C), SHC(0x00A1), SHC(0x00A5), SHC(0x00AA), SHC(0x00AE), SHC(0x00B3), SHC(0x00B7), SHC(0x00BB),
- SHC(0x00C0), SHC(0x00C4), SHC(0x00C8), SHC(0x00CD), SHC(0x00D1), SHC(0x00D5), SHC(0x00D9), SHC(0x00DD),
- SHC(0x00E2), SHC(0x00E5), SHC(0x00EA), SHC(0x00ED), SHC(0x00F2), SHC(0x00F5), SHC(0x00FA), SHC(0x00FD),
- SHC(0x0101), SHC(0x0105), SHC(0x0108), SHC(0x010D), SHC(0x010F), SHC(0x0114), SHC(0x0117), SHC(0x011B),
- SHC(0x011E), SHC(0x0121), SHC(0x0125), SHC(0x0128), SHC(0x012C), SHC(0x012F), SHC(0x0132), SHC(0x0135),
- SHC(0x0139), SHC(0x013B), SHC(0x013F), SHC(0x0141), SHC(0x0145), SHC(0x0147), SHC(0x014A), SHC(0x014D),
- SHC(0x0150), SHC(0x0152), SHC(0x0155), SHC(0x0158), SHC(0x015A), SHC(0x015D), SHC(0x015F), SHC(0x0161),
- SHC(0x0164), SHC(0x0166), SHC(0x0168), SHC(0x016B), SHC(0x016C), SHC(0x016F), SHC(0x0171), SHC(0x0172),
- SHC(0x0175), SHC(0x0176), SHC(0x0178), SHC(0x017A), SHC(0x017B), SHC(0x017D), SHC(0x017F), SHC(0x0180),
- SHC(0x0181), SHC(0x0183), SHC(0x0185), SHC(0x0185), SHC(0x0187), SHC(0x0187), SHC(0x0189), SHC(0x018A),
- SHC(0x018B), SHC(0x018C), SHC(0x018D), SHC(0x018D), SHC(0x018E), SHC(0x018F), SHC(0x018F), SHC(0x0190),
- SHC(0x0191), SHC(0x0190), SHC(0x0192), SHC(0x0191), SHC(0x0192), SHC(0x0192), SHC(0x0192), SHC(0x0192),
- SHC(0x0192), SHC(0x0192), SHC(0x0192), SHC(0x0192), SHC(0x0191), SHC(0x0192), SHC(0x0190), SHC(0x0191),
- SHC(0x0190), SHC(0x018F), SHC(0x018F), SHC(0x018E), SHC(0x018D), SHC(0x018D), SHC(0x018C), SHC(0x018B),
- SHC(0x018A), SHC(0x0189), SHC(0x0187), SHC(0x0187), SHC(0x0185), SHC(0x0185), SHC(0x0183), SHC(0x0181),
- SHC(0x0180), SHC(0x017F), SHC(0x017D), SHC(0x017B), SHC(0x017A), SHC(0x0178), SHC(0x0176), SHC(0x0175),
- SHC(0x0172), SHC(0x0171), SHC(0x016F), SHC(0x016C), SHC(0x016B), SHC(0x0168), SHC(0x0166), SHC(0x0164),
- SHC(0x0161), SHC(0x015F), SHC(0x015D), SHC(0x015A), SHC(0x0158), SHC(0x0155), SHC(0x0152), SHC(0x0150),
- SHC(0x014D), SHC(0x014A), SHC(0x0147), SHC(0x0145), SHC(0x0141), SHC(0x013F), SHC(0x013B), SHC(0x0139),
- SHC(0x0135), SHC(0x0132), SHC(0x012F), SHC(0x012C), SHC(0x0128), SHC(0x0125), SHC(0x0121), SHC(0x011E),
- SHC(0x011B), SHC(0x0117), SHC(0x0114), SHC(0x010F), SHC(0x010D), SHC(0x0108), SHC(0x0105), SHC(0x0101),
- SHC(0x00FD), SHC(0x00FA), SHC(0x00F5), SHC(0x00F2), SHC(0x00ED), SHC(0x00EA), SHC(0x00E5), SHC(0x00E2),
- SHC(0x00DD), SHC(0x00D9), SHC(0x00D5), SHC(0x00D1), SHC(0x00CD), SHC(0x00C8), SHC(0x00C4), SHC(0x00C0),
- SHC(0x00BB), SHC(0x00B7), SHC(0x00B3), SHC(0x00AE), SHC(0x00AA), SHC(0x00A5), SHC(0x00A1), SHC(0x009C),
- SHC(0x0097), SHC(0x0093), SHC(0x008F), SHC(0x008A), SHC(0x0085), SHC(0x0080), SHC(0x007C), SHC(0x0077),
- SHC(0x0072), SHC(0x006E), SHC(0x0069), SHC(0x0064), SHC(0x005F), SHC(0x005B), SHC(0x0056), SHC(0x0050),
- SHC(0x004C), SHC(0x0048), SHC(0x0042), SHC(0x003D), SHC(0x0039), SHC(0x0034), SHC(0x002E), SHC(0x002A),
- SHC(0x0025), SHC(0x0020), SHC(0x001B), SHC(0x0017), SHC(0x0011), SHC(0x000C), SHC(0x0008), SHC(0x0001)
-
-};
-
-const Word16 fftSineTab640_fx[ 321 ] =
-{//Q15
- SHC( 0x0000 ), SHC( 0x0141 ), SHC( 0x0283 ), SHC( 0x03c4 ), SHC( 0x0506 ), SHC( 0x0647 ), SHC( 0x0789 ), SHC( 0x08ca ),
- SHC( 0x0a0a ), SHC( 0x0b4b ), SHC( 0x0c8b ), SHC( 0x0dcb ), SHC( 0x0f0b ), SHC( 0x104a ), SHC( 0x1189 ), SHC( 0x12c8 ),
- SHC( 0x1406 ), SHC( 0x1543 ), SHC( 0x1680 ), SHC( 0x17bc ), SHC( 0x18f8 ), SHC( 0x1a33 ), SHC( 0x1b6e ), SHC( 0x1ca8 ),
- SHC( 0x1de1 ), SHC( 0x1f19 ), SHC( 0x2051 ), SHC( 0x2188 ), SHC( 0x22be ), SHC( 0x23f3 ), SHC( 0x2528 ), SHC( 0x265b ),
- SHC( 0x278d ), SHC( 0x28bf ), SHC( 0x29ef ), SHC( 0x2b1f ), SHC( 0x2c4d ), SHC( 0x2d7a ), SHC( 0x2ea6 ), SHC( 0x2fd1 ),
- SHC( 0x30fb ), SHC( 0x3224 ), SHC( 0x334b ), SHC( 0x3471 ), SHC( 0x3596 ), SHC( 0x36ba ), SHC( 0x37dc ), SHC( 0x38fd ),
- SHC( 0x3a1c ), SHC( 0x3b3a ), SHC( 0x3c56 ), SHC( 0x3d71 ), SHC( 0x3e8b ), SHC( 0x3fa3 ), SHC( 0x40b9 ), SHC( 0x41ce ),
- SHC( 0x42e1 ), SHC( 0x43f2 ), SHC( 0x4502 ), SHC( 0x4610 ), SHC( 0x471c ), SHC( 0x4827 ), SHC( 0x4930 ), SHC( 0x4a37 ),
- SHC( 0x4b3c ), SHC( 0x4c3f ), SHC( 0x4d41 ), SHC( 0x4e40 ), SHC( 0x4f3e ), SHC( 0x503a ), SHC( 0x5133 ), SHC( 0x522b ),
- SHC( 0x5321 ), SHC( 0x5414 ), SHC( 0x5506 ), SHC( 0x55f5 ), SHC( 0x56e2 ), SHC( 0x57ce ), SHC( 0x58b7 ), SHC( 0x599d ),
- SHC( 0x5a82 ), SHC( 0x5b64 ), SHC( 0x5c44 ), SHC( 0x5d22 ), SHC( 0x5dfe ), SHC( 0x5ed7 ), SHC( 0x5fae ), SHC( 0x6082 ),
- SHC( 0x6154 ), SHC( 0x6224 ), SHC( 0x62f2 ), SHC( 0x63bc ), SHC( 0x6485 ), SHC( 0x654b ), SHC( 0x660e ), SHC( 0x66cf ),
- SHC( 0x678d ), SHC( 0x6849 ), SHC( 0x6902 ), SHC( 0x69b9 ), SHC( 0x6a6d ), SHC( 0x6b1f ), SHC( 0x6bcd ), SHC( 0x6c79 ),
- SHC( 0x6d23 ), SHC( 0x6dca ), SHC( 0x6e6e ), SHC( 0x6f0f ), SHC( 0x6fad ), SHC( 0x7049 ), SHC( 0x70e2 ), SHC( 0x7179 ),
- SHC( 0x720c ), SHC( 0x729d ), SHC( 0x732a ), SHC( 0x73b5 ), SHC( 0x743e ), SHC( 0x74c3 ), SHC( 0x7545 ), SHC( 0x75c5 ),
- SHC( 0x7641 ), SHC( 0x76bb ), SHC( 0x7732 ), SHC( 0x77a5 ), SHC( 0x7816 ), SHC( 0x7884 ), SHC( 0x78ef ), SHC( 0x7957 ),
- SHC( 0x79bc ), SHC( 0x7a1e ), SHC( 0x7a7d ), SHC( 0x7ad8 ), SHC( 0x7b31 ), SHC( 0x7b87 ), SHC( 0x7bda ), SHC( 0x7c29 ),
- SHC( 0x7c76 ), SHC( 0x7cc0 ), SHC( 0x7d06 ), SHC( 0x7d4a ), SHC( 0x7d8a ), SHC( 0x7dc7 ), SHC( 0x7e01 ), SHC( 0x7e38 ),
- SHC( 0x7e6c ), SHC( 0x7e9d ), SHC( 0x7eca ), SHC( 0x7ef5 ), SHC( 0x7f1c ), SHC( 0x7f41 ), SHC( 0x7f62 ), SHC( 0x7f80 ),
- SHC( 0x7f9a ), SHC( 0x7fb2 ), SHC( 0x7fc7 ), SHC( 0x7fd8 ), SHC( 0x7fe6 ), SHC( 0x7ff1 ), SHC( 0x7ff9 ), SHC( 0x7ffe ),
- SHC( 0x7fff ), SHC( 0x7ffe ), SHC( 0x7ff9 ), SHC( 0x7ff1 ), SHC( 0x7fe6 ), SHC( 0x7fd8 ), SHC( 0x7fc7 ), SHC( 0x7fb2 ),
- SHC( 0x7f9a ), SHC( 0x7f80 ), SHC( 0x7f62 ), SHC( 0x7f41 ), SHC( 0x7f1c ), SHC( 0x7ef5 ), SHC( 0x7eca ), SHC( 0x7e9d ),
- SHC( 0x7e6c ), SHC( 0x7e38 ), SHC( 0x7e01 ), SHC( 0x7dc7 ), SHC( 0x7d8a ), SHC( 0x7d4a ), SHC( 0x7d06 ), SHC( 0x7cc0 ),
- SHC( 0x7c76 ), SHC( 0x7c29 ), SHC( 0x7bda ), SHC( 0x7b87 ), SHC( 0x7b31 ), SHC( 0x7ad8 ), SHC( 0x7a7d ), SHC( 0x7a1e ),
- SHC( 0x79bc ), SHC( 0x7957 ), SHC( 0x78ef ), SHC( 0x7884 ), SHC( 0x7816 ), SHC( 0x77a5 ), SHC( 0x7732 ), SHC( 0x76bb ),
- SHC( 0x7641 ), SHC( 0x75c5 ), SHC( 0x7545 ), SHC( 0x74c3 ), SHC( 0x743e ), SHC( 0x73b5 ), SHC( 0x732a ), SHC( 0x729d ),
- SHC( 0x720c ), SHC( 0x7179 ), SHC( 0x70e2 ), SHC( 0x7049 ), SHC( 0x6fad ), SHC( 0x6f0f ), SHC( 0x6e6e ), SHC( 0x6dca ),
- SHC( 0x6d23 ), SHC( 0x6c79 ), SHC( 0x6bcd ), SHC( 0x6b1f ), SHC( 0x6a6d ), SHC( 0x69b9 ), SHC( 0x6902 ), SHC( 0x6849 ),
- SHC( 0x678d ), SHC( 0x66cf ), SHC( 0x660e ), SHC( 0x654b ), SHC( 0x6485 ), SHC( 0x63bc ), SHC( 0x62f2 ), SHC( 0x6224 ),
- SHC( 0x6154 ), SHC( 0x6082 ), SHC( 0x5fae ), SHC( 0x5ed7 ), SHC( 0x5dfe ), SHC( 0x5d22 ), SHC( 0x5c44 ), SHC( 0x5b64 ),
- SHC( 0x5a82 ), SHC( 0x599d ), SHC( 0x58b7 ), SHC( 0x57ce ), SHC( 0x56e2 ), SHC( 0x55f5 ), SHC( 0x5506 ), SHC( 0x5414 ),
- SHC( 0x5321 ), SHC( 0x522b ), SHC( 0x5133 ), SHC( 0x503a ), SHC( 0x4f3e ), SHC( 0x4e40 ), SHC( 0x4d41 ), SHC( 0x4c3f ),
- SHC( 0x4b3c ), SHC( 0x4a37 ), SHC( 0x4930 ), SHC( 0x4827 ), SHC( 0x471c ), SHC( 0x4610 ), SHC( 0x4502 ), SHC( 0x43f2 ),
- SHC( 0x42e1 ), SHC( 0x41ce ), SHC( 0x40b9 ), SHC( 0x3fa3 ), SHC( 0x3e8b ), SHC( 0x3d71 ), SHC( 0x3c56 ), SHC( 0x3b3a ),
- SHC( 0x3a1c ), SHC( 0x38fd ), SHC( 0x37dc ), SHC( 0x36ba ), SHC( 0x3596 ), SHC( 0x3471 ), SHC( 0x334b ), SHC( 0x3224 ),
- SHC( 0x30fb ), SHC( 0x2fd1 ), SHC( 0x2ea6 ), SHC( 0x2d7a ), SHC( 0x2c4d ), SHC( 0x2b1f ), SHC( 0x29ef ), SHC( 0x28bf ),
- SHC( 0x278d ), SHC( 0x265b ), SHC( 0x2528 ), SHC( 0x23f3 ), SHC( 0x22be ), SHC( 0x2188 ), SHC( 0x2051 ), SHC( 0x1f19 ),
- SHC( 0x1de1 ), SHC( 0x1ca8 ), SHC( 0x1b6e ), SHC( 0x1a33 ), SHC( 0x18f8 ), SHC( 0x17bc ), SHC( 0x1680 ), SHC( 0x1543 ),
- SHC( 0x1406 ), SHC( 0x12c8 ), SHC( 0x1189 ), SHC( 0x104a ), SHC( 0x0f0b ), SHC( 0x0dcb ), SHC( 0x0c8b ), SHC( 0x0b4b ),
- SHC( 0x0a0a ), SHC( 0x08ca ), SHC( 0x0789 ), SHC( 0x0647 ), SHC( 0x0506 ), SHC( 0x03c4 ), SHC( 0x0283 ), SHC( 0x0141 ),
- SHC( 0x0000 ),
-};
-
-
-const Word32 bwMode2fs[4] = { 8000, 16000, 32000, 48000 };//Q0
-
-const Word16 cos_pi_by_127[128] = /* Q15 */
-{
- 32767 ,32756 ,32726 ,32676 ,32606 ,32516 ,
- 32406 ,32276 ,32127 ,31958 ,31769 ,
- 31561 ,31333 ,31087 ,30821 ,30537 ,
- 30233 ,29912 ,29572 ,29213 ,28837 ,
- 28444 ,28033 ,27605 ,27160 ,26698 ,
- 26220 ,25726 ,25216 ,24691 ,24150 ,
- 23595 ,23026 ,22442 ,21844 ,21234 ,
- 20610 ,19974 ,19325 ,18665 ,17993 ,
- 17310 ,16616 ,15913 ,15199 ,14477 ,
- 13745 ,13005 ,12258 ,11502 ,10740 ,
- 9971 ,9196 ,8415 ,7629 ,6839 ,
- 6044 ,5245 ,4444 ,3639 ,2833 ,
- 2025 ,1215 ,405 ,-405 ,-1215 ,
- -2025 ,-2833 ,-3639 ,-4444 ,-5245 ,
- -6044 ,-6839 ,-7629 ,-8415 ,-9196 ,
- -9971 ,-10740 ,-11502 ,-12258 ,-13005 ,
- -13745 ,-14477 ,-15199 ,-15913 ,-16616 ,
- -17310 ,-17993 ,-18665 ,-19325 ,-19974 ,
- -20610 ,-21234 ,-21844 ,-22442 ,-23026 ,
- -23595 ,-24150 ,-24691 ,-25216 ,-25726 ,
- -26220 ,-26698 ,-27160 ,-27605 ,-28033 ,
- -28444 ,-28837 ,-29213 ,-29572 ,-29912 ,
- -30233 ,-30537 ,-30821 ,-31087 ,-31333 ,
- -31561 ,-31769 ,-31958 ,-32127 ,-32276 ,
- -32406 ,-32516 ,-32606 ,-32676 ,-32726 ,
- -32756 ,-32767
-};
-
-const Word16 cos_pi_by_255[256] = /* Q15 */
-{
- 32767 ,32764 ,32757 ,32744 ,32727 ,32704 ,
- 32677 ,32645 ,32607 ,32565 ,32518 ,
- 32466 ,32409 ,32347 ,32280 ,32209 ,
- 32132 ,32050 ,31964 ,31873 ,31777 ,
- 31676 ,31570 ,31460 ,31345 ,31225 ,
- 31100 ,30970 ,30836 ,30697 ,30554 ,
- 30406 ,30253 ,30096 ,29934 ,29767 ,
- 29596 ,29421 ,29241 ,29056 ,28868 ,
- 28674 ,28477 ,28275 ,28069 ,27859 ,
- 27644 ,27425 ,27202 ,26975 ,26744 ,
- 26509 ,26269 ,26026 ,25779 ,25528 ,
- 25273 ,25014 ,24751 ,24485 ,24215 ,
- 23941 ,23663 ,23382 ,23098 ,22810 ,
- 22518 ,22223 ,21925 ,21623 ,21318 ,
- 21010 ,20699 ,20384 ,20067 ,19746 ,
- 19422 ,19096 ,18766 ,18434 ,18099 ,
- 17761 ,17420 ,17077 ,16731 ,16383 ,
- 16032 ,15679 ,15323 ,14965 ,14605 ,
- 14243 ,13878 ,13511 ,13142 ,12772 ,
- 12399 ,12024 ,11648 ,11270 ,10890 ,
- 10508 ,10125 ,9740 ,9354 ,8967 ,
- 8578 ,8187 ,7796 ,7403 ,7009 ,
- 6615 ,6219 ,5822 ,5424 ,5026 ,
- 4626 ,4226 ,3826 ,3425 ,3023 ,
- 2621 ,2218 ,1815 ,1412 ,1009 ,
- 605 ,201 ,-201 ,-605 ,-1009 ,
- -1412 ,-1815 ,-2218 ,-2621 ,-3023 ,
- -3425 ,-3826 ,-4226 ,-4626 ,-5026 ,
- -5424 ,-5822 ,-6219 ,-6615 ,-7009 ,
- -7403 ,-7796 ,-8187 ,-8578 ,-8967 ,
- -9354 ,-9740 ,-10125 ,-10508 ,-10890 ,
- -11270 ,-11648 ,-12024 ,-12399 ,-12772 ,
- -13142 ,-13511 ,-13878 ,-14243 ,-14605 ,
- -14965 ,-15323 ,-15679 ,-16032 ,-16383 ,
- -16731 ,-17077 ,-17420 ,-17761 ,-18099 ,
- -18434 ,-18766 ,-19096 ,-19422 ,-19746 ,
- -20067 ,-20384 ,-20699 ,-21010 ,-21318 ,
- -21623 ,-21925 ,-22223 ,-22518 ,-22810 ,
- -23098 ,-23382 ,-23663 ,-23941 ,-24215 ,
- -24485 ,-24751 ,-25014 ,-25273 ,-25528 ,
- -25779 ,-26026 ,-26269 ,-26509 ,-26744 ,
- -26975 ,-27202 ,-27425 ,-27644 ,-27859 ,
- -28069 ,-28275 ,-28477 ,-28674 ,-28868 ,
- -29056 ,-29241 ,-29421 ,-29596 ,-29767 ,
- -29934 ,-30096 ,-30253 ,-30406 ,-30554 ,
- -30697 ,-30836 ,-30970 ,-31100 ,-31225 ,
- -31345 ,-31460 ,-31570 ,-31676 ,-31777 ,
- -31873 ,-31964 ,-32050 ,-32132 ,-32209 ,
- -32280 ,-32347 ,-32409 ,-32466 ,-32518 ,
- -32565 ,-32607 ,-32645 ,-32677 ,-32704 ,
- -32727 ,-32744 ,-32757 ,-32764 ,-32767
-};
-
-const Word16 cos_pi_by_383[384] = /* Q15 */
-{
- 32767 ,32765 ,32762 ,32757 ,32749 ,32739 ,
- 32727 ,32713 ,32696 ,32677 ,32656 ,
- 32633 ,32608 ,32580 ,32551 ,32519 ,
- 32485 ,32448 ,32410 ,32369 ,32327 ,
- 32282 ,32234 ,32185 ,32134 ,32080 ,
- 32024 ,31966 ,31906 ,31844 ,31779 ,
- 31713 ,31644 ,31573 ,31500 ,31425 ,
- 31348 ,31269 ,31188 ,31104 ,31019 ,
- 30931 ,30841 ,30749 ,30655 ,30560 ,
- 30462 ,30361 ,30259 ,30155 ,30049 ,
- 29941 ,29831 ,29719 ,29604 ,29488 ,
- 29370 ,29250 ,29128 ,29004 ,28878 ,
- 28750 ,28620 ,28488 ,28354 ,28218 ,
- 28081 ,27941 ,27800 ,27657 ,27512 ,
- 27365 ,27216 ,27066 ,26913 ,26759 ,
- 26603 ,26445 ,26286 ,26124 ,25961 ,
- 25796 ,25630 ,25461 ,25291 ,25120 ,
- 24946 ,24771 ,24594 ,24416 ,24236 ,
- 24054 ,23871 ,23686 ,23499 ,23311 ,
- 23122 ,22930 ,22738 ,22543 ,22348 ,
- 22150 ,21952 ,21751 ,21550 ,21346 ,
- 21142 ,20936 ,20728 ,20519 ,20309 ,
- 20097 ,19885 ,19670 ,19455 ,19238 ,
- 19019 ,18800 ,18579 ,18357 ,18134 ,
- 17910 ,17684 ,17457 ,17229 ,17000 ,
- 16769 ,16538 ,16305 ,16072 ,15837 ,
- 15601 ,15364 ,15126 ,14887 ,14647 ,
- 14407 ,14165 ,13922 ,13678 ,13433 ,
- 13188 ,12941 ,12694 ,12446 ,12197 ,
- 11947 ,11696 ,11445 ,11192 ,10939 ,
- 10686 ,10431 ,10176 ,9920 ,9664 ,
- 9407 ,9149 ,8891 ,8632 ,8372 ,
- 8112 ,7851 ,7590 ,7328 ,7066 ,
- 6803 ,6540 ,6277 ,6013 ,5748 ,
- 5483 ,5218 ,4953 ,4687 ,4421 ,
- 4154 ,3888 ,3621 ,3353 ,3086 ,
- 2818 ,2550 ,2282 ,2014 ,1746 ,
- 1477 ,1209 ,940 ,671 ,403 ,
- 134 ,-134 ,-403 ,-671 ,-940 ,
- -1209 ,-1477 ,-1746 ,-2014 ,-2282 ,
- -2550 ,-2818 ,-3086 ,-3353 ,-3621 ,
- -3888 ,-4154 ,-4421 ,-4687 ,-4953 ,
- -5218 ,-5483 ,-5748 ,-6013 ,-6277 ,
- -6540 ,-6803 ,-7066 ,-7328 ,-7590 ,
- -7851 ,-8112 ,-8372 ,-8632 ,-8891 ,
- -9149 ,-9407 ,-9664 ,-9920 ,-10176 ,
- -10431 ,-10686 ,-10939 ,-11192 ,-11445 ,
- -11696 ,-11947 ,-12197 ,-12446 ,-12694 ,
- -12941 ,-13188 ,-13433 ,-13678 ,-13922 ,
- -14165 ,-14407 ,-14647 ,-14887 ,-15126 ,
- -15364 ,-15601 ,-15837 ,-16072 ,-16305 ,
- -16538 ,-16769 ,-17000 ,-17229 ,-17457 ,
- -17684 ,-17910 ,-18134 ,-18357 ,-18579 ,
- -18800 ,-19019 ,-19238 ,-19455 ,-19670 ,
- -19885 ,-20097 ,-20309 ,-20519 ,-20728 ,
- -20936 ,-21142 ,-21346 ,-21550 ,-21751 ,
- -21952 ,-22150 ,-22348 ,-22543 ,-22738 ,
- -22930 ,-23122 ,-23311 ,-23499 ,-23686 ,
- -23871 ,-24054 ,-24236 ,-24416 ,-24594 ,
- -24771 ,-24946 ,-25120 ,-25291 ,-25461 ,
- -25630 ,-25796 ,-25961 ,-26124 ,-26286 ,
- -26445 ,-26603 ,-26759 ,-26913 ,-27066 ,
- -27216 ,-27365 ,-27512 ,-27657 ,-27800 ,
- -27941 ,-28081 ,-28218 ,-28354 ,-28488 ,
- -28620 ,-28750 ,-28878 ,-29004 ,-29128 ,
- -29250 ,-29370 ,-29488 ,-29604 ,-29719 ,
- -29831 ,-29941 ,-30049 ,-30155 ,-30259 ,
- -30361 ,-30462 ,-30560 ,-30655 ,-30749 ,
- -30841 ,-30931 ,-31019 ,-31104 ,-31188 ,
- -31269 ,-31348 ,-31425 ,-31500 ,-31573 ,
- -31644 ,-31713 ,-31779 ,-31844 ,-31906 ,
- -31966 ,-32024 ,-32080 ,-32134 ,-32185 ,
- -32234 ,-32282 ,-32327 ,-32369 ,-32410 ,
- -32448 ,-32485 ,-32519 ,-32551 ,-32580 ,
- -32608 ,-32633 ,-32656 ,-32677 ,-32696 ,
- -32713 ,-32727 ,-32739 ,-32749 ,-32757 ,
- -32762 ,-32765 ,-32767
-};
-
-const Word16 swb_lsp_prev_interp_init[10] = { 32767, 31164, 26510, 19261, 10126, 0, -10126, -19261, -26510, -31164 };//Q15
-/* st->swb_lsp_prev_interp[i] = (float)cos( (float)i * PI / (float)10.0f )*/
-
-//ivas_sns_com_fx.c
-/*
- powf( 10.0f, (float) i * (float) tilt / ( (float) FDNS_NPTS - 1.0f ) / 10.0f ) where 0 =< i < FDNS_NPTS;
- tilt = 19.f for L_FRAME16k,
- 22.f for L_FRAME25_6k,
- 23.5f for L_FRAME32k;
-*/
-
-/* Q23 */
-const Word32 pow_tilt_16k[64] = {
- 8388608, 8991841, 9638454, 10331564, 11074518, 11870897, 12724546, 13639580,
- 14620416, 15671785, 16798759, 18006775, 19301660, 20689662, 22177476, 23772281,
- 25481769, 27314189, 29278380, 31383818, 33640660, 36059793, 38652889, 41432458,
- 44411907, 47605612, 51028980, 54698525, 58631951, 62848233, 67367713, 72212193,
- 77405045, 82971319, 88937870, 95333482, 102189009, 109537523, 117414477, 125857870,
- 134908436, 144609837, 155008876, 166155720, 178104145, 190911793, 204640453, 219356353,
- 235130489, 252038960, 270163335, 289591052, 310415836, 332738151, 356665686, 382313874,
- 409806450, 439276044, 470864826, 504725189, 541020486, 579925813, 621628862, 666330818
-};
-
-/* Q23 */
-const Word32 pow_tilt_25_6k[64] = {
- 8388608, 9090977, 9852154, 10677063, 11571041, 12539871, 13589820, 14727680,
- 15960812, 17297192, 18745466, 20315003, 22015955, 23859325, 25857039, 28022019,
- 30368270, 32910971, 35666569, 38652889, 41889251, 45396590, 49197594, 53316853,
- 57781011, 62618949, 67861961, 73543965, 79701717, 86375050, 93607134, 101444752,
- 109938604, 119143637, 129119397, 139930415, 151646628, 164343826, 178104145, 193016600,
- 209177658, 226691863, 245672512, 266242389, 288534558, 312693225, 338874669, 367248256,
- 397997530, 431321405, 467435450, 506573283, 548988082, 594954222, 644769055, 698754827,
- 757260765, 820665338, 889378703, 963845359, 1044547023, 1132005744, 1226787283, 1329504771
-};
-
-/* Q23 */
-const Word32 pow_tilt_32k[64] = {
- 8388608, 9140953, 9960774, 10854121, 11827590, 12888365, 14044278, 15303861,
- 16676411, 18172061, 19801850, 21577810, 23513049, 25621853, 27919788, 30423818,
- 33152425, 36125751, 39365745, 42896322, 46743545, 50935812, 55504069, 60482037,
- 65906462, 71817384, 78258437, 85277166, 92925380, 101259536, 110341153, 120237270,
- 131020935, 142771749, 155576454, 169529568, 184734089, 201302251, 219356353, 239029666,
- 260467410, 283827832, 309283369, 337021925, 367248256, 400185482, 436076734, 475186948,
- 517804822, 564244946, 614850125, 669993906, 730083343, 795561993, 866913198, 944663645,
- 1029387260, 1121709444, 1222311686, 1331936594, 1451393382, 1581563835, 1723408827, 1877975405
-};
-
-const Word16 L_frame_inv[8] = { 0x4000, 0x369D, 0x3333, 0x2D83, 0x2AAB, 0x28F6, 0, 0x2222 }; // Q14
-
-const Word16 InvIntTable[65] = // Q15
-{
- 0x7FFF,
- 0x7FFF, 0x4000, 0x2AAB, 0x2000, 0x199A, 0x1555, 0x1249, 0x1000,
- 0x0E39, 0x0CCD, 0x0BA3, 0x0AAB, 0x09D9, 0x0925, 0x0889, 0x0800,
- 0x0788, 0x071C, 0x06BD, 0x0666, 0x0618, 0x05D1, 0x0591, 0x0555,
- 0x051F, 0x04EC, 0x04BE, 0x0492, 0x046A, 0x0444, 0x0421, 0x0400,
- 0x03E1, 0x03C4, 0x03A8, 0x038E, 0x0376, 0x035E, 0x0348, 0x0333,
- 0x031F, 0x030C, 0x02FA, 0x02E9, 0x02D8, 0x02C8, 0x02B9, 0x02AB,
- 0x029D, 0x028F, 0x0283, 0x0276, 0x026A, 0x025F, 0x0254, 0x0249,
- 0x023F, 0x0235, 0x022B, 0x0222, 0x0219, 0x0211, 0x0208, 0x0200
-};
-
-const Word16 TecLowBandTable[] = { 0, 2, 4, 6 }; //Q0
-const Word16 TecSC_Fx[] =
-{
- 23999/*0.3662f*2.0f Q15*/, 7065/*0.1078f*2.0f Q15*/, 7825/*0.1194f*2.0f Q15*/,
- 8448/*0.1289f*2.0f Q15*/, 8946/*0.1365f*2.0f Q15*/, 9254/*0.1412f*2.0f Q15*/
-};
-
-/* clang-format on */
-const Word16 sqrt_table_pitch_search[256 + 1] = /* Q11 */
- {
- 0, 2048, 2896, 3547, 4096, 4579, 5017, 5418,
- 5793, 6144, 6476, 6792, 7094, 7384, 7663, 7932,
- 8192, 8444, 8689, 8927, 9159, 9385, 9606, 9822,
- 10033, 10240, 10443, 10642, 10837, 11029, 11217, 11403,
- 11585, 11765, 11942, 12116, 12288, 12457, 12625, 12790,
- 12953, 13114, 13273, 13430, 13585, 13738, 13890, 14040,
- 14189, 14336, 14482, 14626, 14768, 14910, 15050, 15188,
- 15326, 15462, 15597, 15731, 15864, 15995, 16126, 16255,
- 16384, 16512, 16638, 16764, 16888, 17012, 17135, 17257,
- 17378, 17498, 17618, 17736, 17854, 17971, 18087, 18203,
- 18318, 18432, 18545, 18658, 18770, 18882, 18992, 19102,
- 19212, 19321, 19429, 19537, 19644, 19750, 19856, 19961,
- 20066, 20170, 20274, 20377, 20480, 20582, 20684, 20785,
- 20886, 20986, 21085, 21185, 21283, 21382, 21480, 21577,
- 21674, 21771, 21867, 21962, 22058, 22153, 22247, 22341,
- 22435, 22528, 22621, 22713, 22806, 22897, 22989, 23080,
- 23170, 23261, 23351, 23440, 23530, 23619, 23707, 23796,
- 23884, 23971, 24059, 24146, 24232, 24319, 24405, 24491,
- 24576, 24661, 24746, 24831, 24915, 24999, 25083, 25166,
- 25249, 25332, 25415, 25497, 25580, 25661, 25743, 25824,
- 25905, 25986, 26067, 26147, 26227, 26307, 26387, 26466,
- 26545, 26624, 26703, 26781, 26859, 26937, 27015, 27092,
- 27170, 27247, 27324, 27400, 27477, 27553, 27629, 27705,
- 27780, 27856, 27931, 28006, 28081, 28155, 28230, 28304,
- 28378, 28452, 28525, 28599, 28672, 28745, 28818, 28891,
- 28963, 29035, 29108, 29180, 29251, 29323, 29394, 29466,
- 29537, 29608, 29678, 29749, 29819, 29890, 29960, 30030,
- 30099, 30169, 30238, 30308, 30377, 30446, 30515, 30583,
- 30652, 30720, 30788, 30856, 30924, 30992, 31059, 31127,
- 31194, 31261, 31328, 31395, 31462, 31529, 31595, 31661,
- 31727, 31794, 31859, 31925, 31991, 32056, 32122, 32187,
- 32252, 32317, 32382, 32446, 32511, 32575, 32640, 32704,
- 32766
- };
-
-// fft_evs.c
-const Word16 RotVector_32[2 * 20] = { // Q15
- /**
- * \brief Twiddle factors are unscaled
- */
- SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5a82 ), SHC( 0xa57e ),
- SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x7642 ), SHC( 0xcf04 ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xa57e ), SHC( 0xa57e ),
- SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0xe707 ), SHC( 0x8276 ),
- SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x89be ), SHC( 0x30fc ), SHC( 0xb8e3 ), SHC( 0x6a6e )
-};
-
-/**
- * \brief Twiddle factors are unscaled
- */
-const Word16 RotVector_480[2 * ( 480 - 30 )] = { // Q15
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff5 ), SHC( 0xfca6 ),
- SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7ee8 ), SHC( 0xef4b ),
- SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7ddb ), SHC( 0xe8ad ), SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7c77 ), SHC( 0xe21e ),
- SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7abb ), SHC( 0xdba5 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x78a8 ), SHC( 0xd546 ),
- SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x7388 ), SHC( 0xc8e5 ),
- SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x707d ), SHC( 0xc2ec ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6d23 ), SHC( 0xbd1f ),
- SHC( 0x6b5a ), SHC( 0xba49 ), SHC( 0x697d ), SHC( 0xb780 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x658d ), SHC( 0xb214 ),
- SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5cd9 ), SHC( 0xa7e4 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7e6d ), SHC( 0xebfa ),
- SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7780 ), SHC( 0xd221 ),
- SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6b5a ), SHC( 0xba49 ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5a82 ), SHC( 0xa57e ),
- SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x508e ), SHC( 0x9c86 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x45b7 ), SHC( 0x94a6 ),
- SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x2ddf ), SHC( 0x8880 ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x1406 ), SHC( 0x8193 ),
- SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x06b3 ), SHC( 0x802d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f9b ), SHC( 0xf5f5 ),
- SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7642 ), SHC( 0xcf04 ),
- SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6155 ), SHC( 0xacdf ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x42e1 ), SHC( 0x92dd ),
- SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1de2 ), SHC( 0x8389 ),
- SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0a0b ), SHC( 0x8065 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
- SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xe21e ), SHC( 0x8389 ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcf04 ), SHC( 0x89be ),
- SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xacdf ), SHC( 0x9eab ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x79bc ), SHC( 0xd872 ),
- SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5f1f ), SHC( 0xaa5a ),
- SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3410 ), SHC( 0x8b11 ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x0000 ), SHC( 0x8000 ),
- SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xe563 ), SHC( 0x82cc ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcbf0 ), SHC( 0x8b11 ),
- SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0xa0e1 ), SHC( 0xaa5a ),
- SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x9126 ), SHC( 0xc000 ), SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x8644 ), SHC( 0xd872 ),
- SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x80b4 ), SHC( 0xf29f ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ee8 ), SHC( 0xef4b ),
- SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x658d ), SHC( 0xb214 ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4dec ), SHC( 0x9a73 ), SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x30fc ), SHC( 0x89be ),
- SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x10b5 ), SHC( 0x8118 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xef4b ), SHC( 0x8118 ),
- SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb214 ), SHC( 0x9a73 ),
- SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9a73 ), SHC( 0xb214 ), SHC( 0x9126 ), SHC( 0xc000 ), SHC( 0x89be ), SHC( 0xcf04 ),
- SHC( 0x845d ), SHC( 0xdedf ), SHC( 0x8118 ), SHC( 0xef4b ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8118 ), SHC( 0x10b5 ),
- SHC( 0x845d ), SHC( 0x2121 ), SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9126 ), SHC( 0x4000 ), SHC( 0x9a73 ), SHC( 0x4dec ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ),
- SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ),
- SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x8df3 ), SHC( 0x3a1c ),
- SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xa57e ), SHC( 0x5a82 ), SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xc5e4 ), SHC( 0x720d ),
- SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xebfa ), SHC( 0x7e6d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ddb ), SHC( 0xe8ad ),
- SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x4dec ), SHC( 0x9a73 ),
- SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x245b ), SHC( 0x8545 ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
- SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xc8e5 ), SHC( 0x8c78 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa327 ), SHC( 0xa7e4 ),
- SHC( 0x94a6 ), SHC( 0xba49 ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x800b ), SHC( 0xfca6 ),
- SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x8758 ), SHC( 0x2aba ), SHC( 0x9126 ), SHC( 0x4000 ), SHC( 0x9eab ), SHC( 0x5321 ),
- SHC( 0xaf72 ), SHC( 0x637a ), SHC( 0xc2ec ), SHC( 0x707d ), SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xef4b ), SHC( 0x7ee8 ),
- SHC( 0x06b3 ), SHC( 0x7fd3 ), SHC( 0x1de2 ), SHC( 0x7c77 ), SHC( 0x3410 ), SHC( 0x74ef ), SHC( 0x4880 ), SHC( 0x697d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffd ), SHC( 0xfe53 ), SHC( 0x7ff5 ), SHC( 0xfca6 ), SHC( 0x7fe7 ), SHC( 0xfafa ),
- SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7fba ), SHC( 0xf7a1 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f77 ), SHC( 0xf44a ),
- SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7ee8 ), SHC( 0xef4b ), SHC( 0x7ead ), SHC( 0xeda2 ),
- SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7e27 ), SHC( 0xea53 ), SHC( 0x7ddb ), SHC( 0xe8ad ), SHC( 0x7d8a ), SHC( 0xe707 ),
- SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7cd8 ), SHC( 0xe3c0 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7c10 ), SHC( 0xe07e ),
- SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7abb ), SHC( 0xdba5 ), SHC( 0x7a3e ), SHC( 0xda0b ),
- SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7935 ), SHC( 0xd6db ), SHC( 0x78a8 ), SHC( 0xd546 ), SHC( 0x7817 ), SHC( 0xd3b2 ),
- SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x76e3 ), SHC( 0xd092 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fe7 ), SHC( 0xfafa ),
- SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7d8a ), SHC( 0xe707 ),
- SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7817 ), SHC( 0xd3b2 ),
- SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x743e ), SHC( 0xca69 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6fae ), SHC( 0xc175 ),
- SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6485 ), SHC( 0xb0c2 ),
- SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5dfe ), SHC( 0xa91d ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x56e3 ), SHC( 0xa202 ),
- SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x4f3e ), SHC( 0x9b7b ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x471d ), SHC( 0x9592 ),
- SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x3597 ), SHC( 0x8bc2 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fba ), SHC( 0xf7a1 ), SHC( 0x7ee8 ), SHC( 0xef4b ), SHC( 0x7d8a ), SHC( 0xe707 ),
- SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7935 ), SHC( 0xd6db ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x72cd ), SHC( 0xc763 ),
- SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x658d ), SHC( 0xb214 ), SHC( 0x603c ), SHC( 0xab9b ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5465 ), SHC( 0x9fc4 ), SHC( 0x4dec ), SHC( 0x9a73 ), SHC( 0x471d ), SHC( 0x9592 ),
- SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x389d ), SHC( 0x8d33 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2925 ), SHC( 0x86cb ),
- SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x10b5 ), SHC( 0x8118 ), SHC( 0x085f ), SHC( 0x8046 ),
- SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf7a1 ), SHC( 0x8046 ), SHC( 0xef4b ), SHC( 0x8118 ), SHC( 0xe707 ), SHC( 0x8276 ),
- SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xd6db ), SHC( 0x86cb ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f77 ), SHC( 0xf44a ),
- SHC( 0x7ddb ), SHC( 0xe8ad ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x72cd ), SHC( 0xc763 ),
- SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x668f ), SHC( 0xb36a ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x56e3 ), SHC( 0xa202 ),
- SHC( 0x4dec ), SHC( 0x9a73 ), SHC( 0x444d ), SHC( 0x93bf ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x2f6e ), SHC( 0x891d ),
- SHC( 0x245b ), SHC( 0x8545 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x01ad ), SHC( 0x8003 ),
- SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xea53 ), SHC( 0x81d9 ), SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xd3b2 ), SHC( 0x87e9 ),
- SHC( 0xc8e5 ), SHC( 0x8c78 ), SHC( 0xbe8e ), SHC( 0x91ff ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xab9b ), SHC( 0x9fc4 ),
- SHC( 0xa327 ), SHC( 0xa7e4 ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x94a6 ), SHC( 0xba49 ), SHC( 0x8eb9 ), SHC( 0xc467 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7817 ), SHC( 0xd3b2 ),
- SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x56e3 ), SHC( 0xa202 ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x22bf ), SHC( 0x84ce ),
- SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xe707 ), SHC( 0x8276 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xca69 ), SHC( 0x8bc2 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xb0c2 ), SHC( 0x9b7b ),
- SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x92dd ), SHC( 0xbd1f ), SHC( 0x8bc2 ), SHC( 0xca69 ),
- SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8019 ), SHC( 0x0506 ),
- SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x84ce ), SHC( 0x22bf ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ead ), SHC( 0xeda2 ),
- SHC( 0x7abb ), SHC( 0xdba5 ), SHC( 0x743e ), SHC( 0xca69 ), SHC( 0x6b5a ), SHC( 0xba49 ), SHC( 0x603c ), SHC( 0xab9b ),
- SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x444d ), SHC( 0x93bf ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x22bf ), SHC( 0x84ce ),
- SHC( 0x10b5 ), SHC( 0x8118 ), SHC( 0xfe53 ), SHC( 0x8003 ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xda0b ), SHC( 0x85c2 ),
- SHC( 0xc8e5 ), SHC( 0x8c78 ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0x9d97 ), SHC( 0xae27 ),
- SHC( 0x92dd ), SHC( 0xbd1f ), SHC( 0x8a65 ), SHC( 0xcd79 ), SHC( 0x845d ), SHC( 0xdedf ), SHC( 0x80e3 ), SHC( 0xf0f5 ),
- SHC( 0x800b ), SHC( 0x035a ), SHC( 0x81d9 ), SHC( 0x15ad ), SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x8d33 ), SHC( 0x389d ),
- SHC( 0x9683 ), SHC( 0x4880 ), SHC( 0xa202 ), SHC( 0x56e3 ), SHC( 0xaf72 ), SHC( 0x637a ), SHC( 0xbe8e ), SHC( 0x6e01 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e27 ), SHC( 0xea53 ), SHC( 0x78a8 ), SHC( 0xd546 ), SHC( 0x6fae ), SHC( 0xc175 ),
- SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x5465 ), SHC( 0x9fc4 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x2f6e ), SHC( 0x891d ),
- SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xef4b ), SHC( 0x8118 ), SHC( 0xda0b ), SHC( 0x85c2 ),
- SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb36a ), SHC( 0x9971 ), SHC( 0xa327 ), SHC( 0xa7e4 ), SHC( 0x9592 ), SHC( 0xb8e3 ),
- SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x83f0 ), SHC( 0xe07e ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8089 ), SHC( 0x0bb6 ),
- SHC( 0x845d ), SHC( 0x2121 ), SHC( 0x8bc2 ), SHC( 0x3597 ), SHC( 0x9683 ), SHC( 0x4880 ), SHC( 0xa450 ), SHC( 0x5951 ),
- SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xc763 ), SHC( 0x72cd ), SHC( 0xdba5 ), SHC( 0x7abb ), SHC( 0xf0f5 ), SHC( 0x7f1d ),
- SHC( 0x06b3 ), SHC( 0x7fd3 ), SHC( 0x1c40 ), SHC( 0x7cd8 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d8a ), SHC( 0xe707 ),
- SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x471d ), SHC( 0x9592 ),
- SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xe707 ), SHC( 0x8276 ),
- SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9592 ), SHC( 0xb8e3 ),
- SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8276 ), SHC( 0x18f9 ),
- SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9592 ), SHC( 0x471d ), SHC( 0xa57e ), SHC( 0x5a82 ), SHC( 0xb8e3 ), SHC( 0x6a6e ),
- SHC( 0xcf04 ), SHC( 0x7642 ), SHC( 0xe707 ), SHC( 0x7d8a ), SHC( 0x0000 ), SHC( 0x7fff ), SHC( 0x18f9 ), SHC( 0x7d8a ),
- SHC( 0x30fc ), SHC( 0x7642 ), SHC( 0x471d ), SHC( 0x6a6e ), SHC( 0x5a82 ), SHC( 0x5a82 ), SHC( 0x6a6e ), SHC( 0x471d )
-};
-
-const Word16 RotVector_600[2 * ( 600 - 30 )] = { // Q15
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff9 ), SHC( 0xfd52 ),
- SHC( 0x7fe3 ), SHC( 0xfaa4 ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7f4c ), SHC( 0xf29f ),
- SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7ea0 ), SHC( 0xed4d ), SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7dbc ), SHC( 0xe804 ),
- SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7c9e ), SHC( 0xe2c5 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7b49 ), SHC( 0xdd94 ),
- SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x77f9 ), SHC( 0xd362 ),
- SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x7600 ), SHC( 0xce66 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x73d1 ), SHC( 0xc980 ),
- SHC( 0x72a7 ), SHC( 0xc716 ), SHC( 0x716f ), SHC( 0xc4b3 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6eda ), SHC( 0xc000 ),
- SHC( 0x6d7d ), SHC( 0xbdb1 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x691b ), SHC( 0xb6f3 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fe3 ), SHC( 0xfaa4 ), SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7efe ), SHC( 0xeff5 ),
- SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7a89 ), SHC( 0xdb01 ),
- SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x72a7 ), SHC( 0xc716 ),
- SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6d7d ), SHC( 0xbdb1 ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x678e ), SHC( 0xb4c3 ),
- SHC( 0x6450 ), SHC( 0xb07e ), SHC( 0x60e5 ), SHC( 0xac5d ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x598f ), SHC( 0xa48c ),
- SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4d64 ), SHC( 0x9a0b ), SHC( 0x490d ), SHC( 0x96e5 ),
- SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3b4d ), SHC( 0x8e91 ), SHC( 0x3680 ), SHC( 0x8c2f ),
- SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x2c9e ), SHC( 0x8807 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fbf ), SHC( 0xf7f6 ),
- SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x79bc ), SHC( 0xd872 ),
- SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6c13 ), SHC( 0xbb6a ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x579f ), SHC( 0xa2b1 ),
- SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3daa ), SHC( 0x8fd5 ),
- SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2f1f ), SHC( 0x88fd ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1fd5 ), SHC( 0x8405 ),
- SHC( 0x17fc ), SHC( 0x8244 ), SHC( 0x100b ), SHC( 0x8102 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0x0000 ), SHC( 0x8000 ),
- SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xe02b ), SHC( 0x8405 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7bfb ), SHC( 0xe02b ),
- SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6a9d ), SHC( 0xb92a ),
- SHC( 0x6450 ), SHC( 0xb07e ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4d64 ), SHC( 0x9a0b ),
- SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3b4d ), SHC( 0x8e91 ), SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x278e ), SHC( 0x8644 ),
- SHC( 0x1d3b ), SHC( 0x8362 ), SHC( 0x12b3 ), SHC( 0x8160 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xfd52 ), SHC( 0x8007 ),
- SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xdd94 ), SHC( 0x84b7 ), SHC( 0xd362 ), SHC( 0x8807 ),
- SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb6f3 ), SHC( 0x96e5 ), SHC( 0xae69 ), SHC( 0x9d60 ),
- SHC( 0xa671 ), SHC( 0xa48c ), SHC( 0x9f1b ), SHC( 0xac5d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f4c ), SHC( 0xf29f ),
- SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x6eda ), SHC( 0xc000 ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4b3d ), SHC( 0x9872 ),
- SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1a9d ), SHC( 0x82cc ),
- SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xe563 ), SHC( 0x82cc ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcbf0 ), SHC( 0x8b11 ), SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb4c3 ), SHC( 0x9872 ),
- SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0xa0e1 ), SHC( 0xaa5a ), SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x9126 ), SHC( 0xc000 ),
- SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x80b4 ), SHC( 0xf29f ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7703 ), SHC( 0xd0e1 ),
- SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5197 ), SHC( 0x9d60 ),
- SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x17fc ), SHC( 0x8244 ),
- SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xd872 ), SHC( 0x8644 ),
- SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa2b1 ), SHC( 0xa861 ),
- SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x88fd ), SHC( 0xd0e1 ), SHC( 0x8405 ), SHC( 0xe02b ),
- SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x8405 ), SHC( 0x1fd5 ),
- SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x8fd5 ), SHC( 0x3daa ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ea0 ), SHC( 0xed4d ),
- SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x5f1f ), SHC( 0xaa5a ),
- SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x424f ), SHC( 0x9283 ), SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x1fd5 ), SHC( 0x8405 ),
- SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0xfaa4 ), SHC( 0x801d ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xd5e8 ), SHC( 0x871f ),
- SHC( 0xc4b3 ), SHC( 0x8e91 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa671 ), SHC( 0xa48c ), SHC( 0x9a0b ), SHC( 0xb29c ),
- SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8807 ), SHC( 0xd362 ), SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x8041 ), SHC( 0xf7f6 ),
- SHC( 0x8073 ), SHC( 0x0ab6 ), SHC( 0x8362 ), SHC( 0x1d3b ), SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9126 ), SHC( 0x4000 ),
- SHC( 0x9bb0 ), SHC( 0x4f82 ), SHC( 0xa861 ), SHC( 0x5d4f ), SHC( 0xb6f3 ), SHC( 0x691b ), SHC( 0xc716 ), SHC( 0x72a7 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x702b ), SHC( 0xc256 ),
- SHC( 0x6450 ), SHC( 0xb07e ), SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x319a ), SHC( 0x8a00 ),
- SHC( 0x1d3b ), SHC( 0x8362 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xdd94 ), SHC( 0x84b7 ),
- SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xb6f3 ), SHC( 0x96e5 ), SHC( 0xa671 ), SHC( 0xa48c ), SHC( 0x9872 ), SHC( 0xb4c3 ),
- SHC( 0x8d59 ), SHC( 0xc716 ), SHC( 0x8577 ), SHC( 0xdb01 ), SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x801d ), SHC( 0x055c ),
- SHC( 0x82cc ), SHC( 0x1a9d ), SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9283 ), SHC( 0x424f ), SHC( 0x9f1b ), SHC( 0x53a3 ),
- SHC( 0xae69 ), SHC( 0x62a0 ), SHC( 0xc000 ), SHC( 0x6eda ), SHC( 0xd362 ), SHC( 0x77f9 ), SHC( 0xe804 ), SHC( 0x7dbc ),
- SHC( 0xfd52 ), SHC( 0x7ff9 ), SHC( 0x12b3 ), SHC( 0x7ea0 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7dbc ), SHC( 0xe804 ),
- SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x4b3d ), SHC( 0x9872 ),
- SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xeff5 ), SHC( 0x8102 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9d60 ), SHC( 0xae69 ),
- SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8041 ), SHC( 0x080a ),
- SHC( 0x8405 ), SHC( 0x1fd5 ), SHC( 0x8c2f ), SHC( 0x3680 ), SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xa861 ), SHC( 0x5d4f ),
- SHC( 0xbb6a ), SHC( 0x6c13 ), SHC( 0xd0e1 ), SHC( 0x7703 ), SHC( 0xe804 ), SHC( 0x7dbc ), SHC( 0x0000 ), SHC( 0x7fff ),
- SHC( 0x17fc ), SHC( 0x7dbc ), SHC( 0x2f1f ), SHC( 0x7703 ), SHC( 0x4496 ), SHC( 0x6c13 ), SHC( 0x579f ), SHC( 0x5d4f ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffe ), SHC( 0xfea9 ), SHC( 0x7ff9 ), SHC( 0xfd52 ), SHC( 0x7ff0 ), SHC( 0xfbfb ),
- SHC( 0x7fe3 ), SHC( 0xfaa4 ), SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7fa8 ), SHC( 0xf6a0 ),
- SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7f27 ), SHC( 0xf14a ),
- SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7ed1 ), SHC( 0xeea1 ), SHC( 0x7ea0 ), SHC( 0xed4d ), SHC( 0x7e6d ), SHC( 0xebfa ),
- SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7dfa ), SHC( 0xe955 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7d7a ), SHC( 0xe6b3 ),
- SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7c9e ), SHC( 0xe2c5 ), SHC( 0x7c4e ), SHC( 0xe178 ),
- SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7b49 ), SHC( 0xdd94 ), SHC( 0x7aeb ), SHC( 0xdc4a ),
- SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x7a25 ), SHC( 0xd9b9 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff0 ), SHC( 0xfbfb ),
- SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7e6d ), SHC( 0xebfa ),
- SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7aeb ), SHC( 0xdc4a ),
- SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x786f ), SHC( 0xd4a4 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x7579 ), SHC( 0xcd2a ),
- SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6e2d ), SHC( 0xbed8 ),
- SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x69de ), SHC( 0xb80e ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6524 ), SHC( 0xb18c ),
- SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x6004 ), SHC( 0xab5a ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5a82 ), SHC( 0xa57e ),
- SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4e74 ), SHC( 0x9adc ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7e6d ), SHC( 0xebfa ),
- SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7780 ), SHC( 0xd221 ),
- SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6b5a ), SHC( 0xba49 ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5a82 ), SHC( 0xa57e ),
- SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x508e ), SHC( 0x9c86 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x45b7 ), SHC( 0x94a6 ),
- SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x2ddf ), SHC( 0x8880 ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x1406 ), SHC( 0x8193 ),
- SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x06b3 ), SHC( 0x802d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fa8 ), SHC( 0xf6a0 ),
- SHC( 0x7ea0 ), SHC( 0xed4d ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x7780 ), SHC( 0xd221 ),
- SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6f84 ), SHC( 0xc12a ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x6524 ), SHC( 0xb18c ),
- SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5898 ), SHC( 0xa39d ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4a26 ), SHC( 0x97aa ),
- SHC( 0x424f ), SHC( 0x9283 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x28d4 ), SHC( 0x86b0 ),
- SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x16ab ), SHC( 0x8206 ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x0405 ), SHC( 0x8010 ),
- SHC( 0xfaa4 ), SHC( 0x801d ), SHC( 0xf14a ), SHC( 0x80d9 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xdedf ), SHC( 0x845d ),
- SHC( 0xd5e8 ), SHC( 0x871f ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xc4b3 ), SHC( 0x8e91 ), SHC( 0xbc8d ), SHC( 0x9337 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7aeb ), SHC( 0xdc4a ),
- SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6524 ), SHC( 0xb18c ),
- SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4128 ), SHC( 0x91d3 ),
- SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x1406 ), SHC( 0x8193 ),
- SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xe414 ), SHC( 0x8315 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xb80e ), SHC( 0x9622 ),
- SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x9622 ), SHC( 0xb80e ),
- SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8a87 ), SHC( 0xcd2a ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f27 ), SHC( 0xf14a ),
- SHC( 0x7c9e ), SHC( 0xe2c5 ), SHC( 0x786f ), SHC( 0xd4a4 ), SHC( 0x72a7 ), SHC( 0xc716 ), SHC( 0x6b5a ), SHC( 0xba49 ),
- SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x5898 ), SHC( 0xa39d ), SHC( 0x4d64 ), SHC( 0x9a0b ), SHC( 0x4128 ), SHC( 0x91d3 ),
- SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x2647 ), SHC( 0x85db ), SHC( 0x17fc ), SHC( 0x8244 ), SHC( 0x0960 ), SHC( 0x8058 ),
- SHC( 0xfaa4 ), SHC( 0x801d ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xdd94 ), SHC( 0x84b7 ), SHC( 0xcfa3 ), SHC( 0x897d ),
- SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xb5da ), SHC( 0x97aa ), SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0x9ffc ), SHC( 0xab5a ),
- SHC( 0x96e5 ), SHC( 0xb6f3 ), SHC( 0x8f31 ), SHC( 0xc383 ), SHC( 0x88fd ), SHC( 0xd0e1 ), SHC( 0x845d ), SHC( 0xdedf ),
- SHC( 0x8160 ), SHC( 0xed4d ), SHC( 0x8010 ), SHC( 0xfbfb ), SHC( 0x8073 ), SHC( 0x0ab6 ), SHC( 0x8286 ), SHC( 0x194d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ed1 ), SHC( 0xeea1 ), SHC( 0x7b49 ), SHC( 0xdd94 ), SHC( 0x7579 ), SHC( 0xcd2a ),
- SHC( 0x6d7d ), SHC( 0xbdb1 ), SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x4a26 ), SHC( 0x97aa ),
- SHC( 0x3b4d ), SHC( 0x8e91 ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x0960 ), SHC( 0x8058 ),
- SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xe6b3 ), SHC( 0x8286 ), SHC( 0xd5e8 ), SHC( 0x871f ), SHC( 0xc5e4 ), SHC( 0x8df3 ),
- SHC( 0xb6f3 ), SHC( 0x96e5 ), SHC( 0xa95c ), SHC( 0xa1c8 ), SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x9337 ), SHC( 0xbc8d ),
- SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x8515 ), SHC( 0xdc4a ), SHC( 0x8160 ), SHC( 0xed4d ), SHC( 0x8002 ), SHC( 0xfea9 ),
- SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x845d ), SHC( 0x2121 ), SHC( 0x8a00 ), SHC( 0x319a ), SHC( 0x91d3 ), SHC( 0x4128 ),
- SHC( 0x9bb0 ), SHC( 0x4f82 ), SHC( 0xa768 ), SHC( 0x5c63 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ),
- SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ),
- SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ),
- SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ),
- SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8193 ), SHC( 0x1406 ),
- SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x8df3 ), SHC( 0x3a1c ), SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xa57e ), SHC( 0x5a82 ),
- SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xc5e4 ), SHC( 0x720d ), SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xebfa ), SHC( 0x7e6d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7dfa ), SHC( 0xe955 ), SHC( 0x77f9 ), SHC( 0xd362 ), SHC( 0x6e2d ), SHC( 0xbed8 ),
- SHC( 0x60e5 ), SHC( 0xac5d ), SHC( 0x508e ), SHC( 0x9c86 ), SHC( 0x3daa ), SHC( 0x8fd5 ), SHC( 0x28d4 ), SHC( 0x86b0 ),
- SHC( 0x12b3 ), SHC( 0x8160 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xe563 ), SHC( 0x82cc ), SHC( 0xcfa3 ), SHC( 0x897d ),
- SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xa95c ), SHC( 0xa1c8 ), SHC( 0x9a0b ), SHC( 0xb29c ), SHC( 0x8df3 ), SHC( 0xc5e4 ),
- SHC( 0x8577 ), SHC( 0xdb01 ), SHC( 0x80d9 ), SHC( 0xf14a ), SHC( 0x8041 ), SHC( 0x080a ), SHC( 0x83b2 ), SHC( 0x1e88 ),
- SHC( 0x8b11 ), SHC( 0x3410 ), SHC( 0x9622 ), SHC( 0x47f2 ), SHC( 0xa48c ), SHC( 0x598f ), SHC( 0xb5da ), SHC( 0x6856 ),
- SHC( 0xc980 ), SHC( 0x73d1 ), SHC( 0xdedf ), SHC( 0x7ba3 ), SHC( 0xf54a ), SHC( 0x7f8d ), SHC( 0x0c0c ), SHC( 0x7f6f ),
- SHC( 0x226c ), SHC( 0x7b49 ), SHC( 0x37b6 ), SHC( 0x733e ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d7a ), SHC( 0xe6b3 ),
- SHC( 0x7600 ), SHC( 0xce66 ), SHC( 0x69de ), SHC( 0xb80e ), SHC( 0x598f ), SHC( 0xa48c ), SHC( 0x45b7 ), SHC( 0x94a6 ),
- SHC( 0x2f1f ), SHC( 0x88fd ), SHC( 0x16ab ), SHC( 0x8206 ), SHC( 0xfd52 ), SHC( 0x8007 ), SHC( 0xe414 ), SHC( 0x8315 ),
- SHC( 0xcbf0 ), SHC( 0x8b11 ), SHC( 0xb5da ), SHC( 0x97aa ), SHC( 0xa2b1 ), SHC( 0xa861 ), SHC( 0x9337 ), SHC( 0xbc8d ),
- SHC( 0x8807 ), SHC( 0xd362 ), SHC( 0x8193 ), SHC( 0xebfa ), SHC( 0x801d ), SHC( 0x055c ), SHC( 0x83b2 ), SHC( 0x1e88 ),
- SHC( 0x8c2f ), SHC( 0x3680 ), SHC( 0x993d ), SHC( 0x4c51 ), SHC( 0xaa5a ), SHC( 0x5f1f ), SHC( 0xbed8 ), SHC( 0x6e2d ),
- SHC( 0xd5e8 ), SHC( 0x78e1 ), SHC( 0xeea1 ), SHC( 0x7ed1 ), SHC( 0x080a ), SHC( 0x7fbf ), SHC( 0x2121 ), SHC( 0x7ba3 ),
- SHC( 0x38ea ), SHC( 0x72a7 ), SHC( 0x4e74 ), SHC( 0x6524 ), SHC( 0x60e5 ), SHC( 0x53a3 ), SHC( 0x6f84 ), SHC( 0x3ed6 )
-};
-
-
-/**
- * \brief Twiddle factors are unscaled
- */
-const Word16 RotVector_256[2 * ( 256 - 32 )] = { // Q15
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff6 ), SHC( 0xfcdc ), SHC( 0x7fd9 ), SHC( 0xf9b8 ), SHC( 0x7fa7 ), SHC( 0xf695 ),
- SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7f0a ), SHC( 0xf055 ), SHC( 0x7e9d ), SHC( 0xed38 ), SHC( 0x7e1e ), SHC( 0xea1e ),
- SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7ce4 ), SHC( 0xe3f4 ), SHC( 0x7c2a ), SHC( 0xe0e6 ), SHC( 0x7b5d ), SHC( 0xdddc ),
- SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x798a ), SHC( 0xd7d9 ), SHC( 0x7885 ), SHC( 0xd4e1 ), SHC( 0x776c ), SHC( 0xd1ef ),
- SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x7505 ), SHC( 0xcc21 ), SHC( 0x73b6 ), SHC( 0xc946 ), SHC( 0x7255 ), SHC( 0xc673 ),
- SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6f5f ), SHC( 0xc0e9 ), SHC( 0x6dca ), SHC( 0xbe32 ), SHC( 0x6c24 ), SHC( 0xbb85 ),
- SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x68a7 ), SHC( 0xb64c ), SHC( 0x66d0 ), SHC( 0xb3c0 ), SHC( 0x64e9 ), SHC( 0xb140 ),
- SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x60ec ), SHC( 0xac65 ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x5cb4 ), SHC( 0xa7bd ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fd9 ), SHC( 0xf9b8 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7e9d ), SHC( 0xed38 ),
- SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7c2a ), SHC( 0xe0e6 ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x7885 ), SHC( 0xd4e1 ),
- SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x73b6 ), SHC( 0xc946 ), SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6dca ), SHC( 0xbe32 ),
- SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x66d0 ), SHC( 0xb3c0 ), SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x5ed7 ), SHC( 0xaa0a ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x55f6 ), SHC( 0xa129 ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x4c40 ), SHC( 0x9930 ),
- SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x41ce ), SHC( 0x9236 ), SHC( 0x3c57 ), SHC( 0x8f1d ), SHC( 0x36ba ), SHC( 0x8c4a ),
- SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2b1f ), SHC( 0x877b ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x1f1a ), SHC( 0x83d6 ),
- SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x12c8 ), SHC( 0x8163 ), SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0x0648 ), SHC( 0x8027 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fa7 ), SHC( 0xf695 ), SHC( 0x7e9d ), SHC( 0xed38 ), SHC( 0x7ce4 ), SHC( 0xe3f4 ),
- SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x776c ), SHC( 0xd1ef ), SHC( 0x73b6 ), SHC( 0xc946 ), SHC( 0x6f5f ), SHC( 0xc0e9 ),
- SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x64e9 ), SHC( 0xb140 ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x5843 ), SHC( 0xa34c ),
- SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x49b4 ), SHC( 0x9759 ), SHC( 0x41ce ), SHC( 0x9236 ), SHC( 0x398d ), SHC( 0x8dab ),
- SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2827 ), SHC( 0x8676 ), SHC( 0x1f1a ), SHC( 0x83d6 ), SHC( 0x15e2 ), SHC( 0x81e2 ),
- SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0x0324 ), SHC( 0x800a ), SHC( 0xf9b8 ), SHC( 0x8027 ), SHC( 0xf055 ), SHC( 0x80f6 ),
- SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xdddc ), SHC( 0x84a3 ), SHC( 0xd4e1 ), SHC( 0x877b ), SHC( 0xcc21 ), SHC( 0x8afb ),
- SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xbb85 ), SHC( 0x93dc ), SHC( 0xb3c0 ), SHC( 0x9930 ), SHC( 0xac65 ), SHC( 0x9f14 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7a7d ), SHC( 0xdad8 ),
- SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x62f2 ), SHC( 0xaecc ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x3c57 ), SHC( 0x8f1d ),
- SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0c8c ), SHC( 0x809e ),
- SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf374 ), SHC( 0x809e ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xdad8 ), SHC( 0x8583 ),
- SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xaecc ), SHC( 0x9d0e ),
- SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9d0e ), SHC( 0xaecc ), SHC( 0x9592 ), SHC( 0xb8e3 ), SHC( 0x8f1d ), SHC( 0xc3a9 ),
- SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x8583 ), SHC( 0xdad8 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x809e ), SHC( 0xf374 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f0a ), SHC( 0xf055 ), SHC( 0x7c2a ), SHC( 0xe0e6 ), SHC( 0x776c ), SHC( 0xd1ef ),
- SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x68a7 ), SHC( 0xb64c ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x539b ), SHC( 0x9f14 ),
- SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x398d ), SHC( 0x8dab ), SHC( 0x2b1f ), SHC( 0x877b ), SHC( 0x1c0c ), SHC( 0x831c ),
- SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0xfcdc ), SHC( 0x800a ), SHC( 0xed38 ), SHC( 0x8163 ), SHC( 0xdddc ), SHC( 0x84a3 ),
- SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xc0e9 ), SHC( 0x90a1 ), SHC( 0xb3c0 ), SHC( 0x9930 ), SHC( 0xa7bd ), SHC( 0xa34c ),
- SHC( 0x9d0e ), SHC( 0xaecc ), SHC( 0x93dc ), SHC( 0xbb85 ), SHC( 0x8c4a ), SHC( 0xc946 ), SHC( 0x8676 ), SHC( 0xd7d9 ),
- SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8059 ), SHC( 0xf695 ), SHC( 0x8027 ), SHC( 0x0648 ), SHC( 0x81e2 ), SHC( 0x15e2 ),
- SHC( 0x8583 ), SHC( 0x2528 ), SHC( 0x8afb ), SHC( 0x33df ), SHC( 0x9236 ), SHC( 0x41ce ), SHC( 0x9b17 ), SHC( 0x4ec0 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e9d ), SHC( 0xed38 ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x73b6 ), SHC( 0xc946 ),
- SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x41ce ), SHC( 0x9236 ),
- SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x1f1a ), SHC( 0x83d6 ), SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0xf9b8 ), SHC( 0x8027 ),
- SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xd4e1 ), SHC( 0x877b ), SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xb3c0 ), SHC( 0x9930 ),
- SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9930 ), SHC( 0xb3c0 ), SHC( 0x8f1d ), SHC( 0xc3a9 ), SHC( 0x877b ), SHC( 0xd4e1 ),
- SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8027 ), SHC( 0xf9b8 ), SHC( 0x809e ), SHC( 0x0c8c ), SHC( 0x83d6 ), SHC( 0x1f1a ),
- SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9236 ), SHC( 0x41ce ), SHC( 0x9d0e ), SHC( 0x5134 ), SHC( 0xaa0a ), SHC( 0x5ed7 ),
- SHC( 0xb8e3 ), SHC( 0x6a6e ), SHC( 0xc946 ), SHC( 0x73b6 ), SHC( 0xdad8 ), SHC( 0x7a7d ), SHC( 0xed38 ), SHC( 0x7e9d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e1e ), SHC( 0xea1e ), SHC( 0x7885 ), SHC( 0xd4e1 ), SHC( 0x6f5f ), SHC( 0xc0e9 ),
- SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x539b ), SHC( 0x9f14 ), SHC( 0x41ce ), SHC( 0x9236 ), SHC( 0x2e11 ), SHC( 0x8894 ),
- SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0324 ), SHC( 0x800a ), SHC( 0xed38 ), SHC( 0x8163 ), SHC( 0xd7d9 ), SHC( 0x8676 ),
- SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xb140 ), SHC( 0x9b17 ), SHC( 0xa129 ), SHC( 0xaa0a ), SHC( 0x93dc ), SHC( 0xbb85 ),
- SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x831c ), SHC( 0xe3f4 ), SHC( 0x8027 ), SHC( 0xf9b8 ), SHC( 0x80f6 ), SHC( 0x0fab ),
- SHC( 0x8583 ), SHC( 0x2528 ), SHC( 0x8dab ), SHC( 0x398d ), SHC( 0x9930 ), SHC( 0x4c40 ), SHC( 0xa7bd ), SHC( 0x5cb4 ),
- SHC( 0xb8e3 ), SHC( 0x6a6e ), SHC( 0xcc21 ), SHC( 0x7505 ), SHC( 0xe0e6 ), SHC( 0x7c2a ), SHC( 0xf695 ), SHC( 0x7fa7 ),
- SHC( 0x0c8c ), SHC( 0x7f62 ), SHC( 0x2224 ), SHC( 0x7b5d ), SHC( 0x36ba ), SHC( 0x73b6 ), SHC( 0x49b4 ), SHC( 0x68a7 )
-};
-
-/**
- * \brief Twiddle factors are unscaled
- */
-const Word16 RotVector_320[2 * ( 320 - 20 )] = { // Q15
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fe7 ), SHC( 0xfafa ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f1d ), SHC( 0xf0f5 ),
- SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7b32 ), SHC( 0xdd41 ),
- SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x743e ), SHC( 0xca69 ),
- SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6fae ), SHC( 0xc175 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x6a6e ), SHC( 0xb8e3 ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6485 ), SHC( 0xb0c2 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5dfe ), SHC( 0xa91d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7c77 ), SHC( 0xe21e ),
- SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6d23 ), SHC( 0xbd1f ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5321 ), SHC( 0x9eab ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x30fc ), SHC( 0x89be ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1de2 ), SHC( 0x8389 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0a0b ), SHC( 0x8065 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7817 ), SHC( 0xd3b2 ),
- SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x56e3 ), SHC( 0xa202 ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x22bf ), SHC( 0x84ce ),
- SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xe707 ), SHC( 0x8276 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xca69 ), SHC( 0x8bc2 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xb0c2 ), SHC( 0x9b7b ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ),
- SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x18f9 ), SHC( 0x8276 ),
- SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xb8e3 ), SHC( 0x9592 ),
- SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9592 ), SHC( 0xb8e3 ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x8276 ), SHC( 0xe707 ),
- SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8276 ), SHC( 0x18f9 ), SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9592 ), SHC( 0x471d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6155 ), SHC( 0xacdf ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x92dd ), SHC( 0xbd1f ),
- SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x89be ), SHC( 0x30fc ),
- SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xacdf ), SHC( 0x6155 ), SHC( 0xc5e4 ), SHC( 0x720d ), SHC( 0xe21e ), SHC( 0x7c77 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x56e3 ), SHC( 0xa202 ),
- SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xd3b2 ), SHC( 0x87e9 ),
- SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x80e3 ), SHC( 0xf0f5 ),
- SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x8bc2 ), SHC( 0x3597 ), SHC( 0x9eab ), SHC( 0x5321 ), SHC( 0xb8e3 ), SHC( 0x6a6e ),
- SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xfafa ), SHC( 0x7fe7 ), SHC( 0x1de2 ), SHC( 0x7c77 ), SHC( 0x3e8b ), SHC( 0x6fae ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffa ), SHC( 0xfd7d ), SHC( 0x7fe7 ), SHC( 0xfafa ), SHC( 0x7fc7 ), SHC( 0xf877 ),
- SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7ecb ), SHC( 0xee76 ),
- SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7e02 ), SHC( 0xe980 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7d07 ), SHC( 0xe492 ),
- SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7bda ), SHC( 0xdfae ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7a7d ), SHC( 0xdad8 ),
- SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x78ef ), SHC( 0xd610 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x7732 ), SHC( 0xd159 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fc7 ), SHC( 0xf877 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7e02 ), SHC( 0xe980 ),
- SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x7546 ), SHC( 0xccb4 ),
- SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6e6e ), SHC( 0xbf47 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x660f ), SHC( 0xb2bf ),
- SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5c45 ), SHC( 0xa749 ), SHC( 0x56e3 ), SHC( 0xa202 ), SHC( 0x5134 ), SHC( 0x9d0e ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4502 ), SHC( 0x9432 ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x37dc ), SHC( 0x8cd5 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7a7d ), SHC( 0xdad8 ),
- SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x62f2 ), SHC( 0xaecc ),
- SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x3c57 ), SHC( 0x8f1d ),
- SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0c8c ), SHC( 0x809e ),
- SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf374 ), SHC( 0x809e ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xdad8 ), SHC( 0x8583 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ecb ), SHC( 0xee76 ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7546 ), SHC( 0xccb4 ),
- SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x56e3 ), SHC( 0xa202 ), SHC( 0x4930 ), SHC( 0x96fd ),
- SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x29f0 ), SHC( 0x8711 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0789 ), SHC( 0x8039 ),
- SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xe492 ), SHC( 0x82f9 ), SHC( 0xd3b2 ), SHC( 0x87e9 ), SHC( 0xc3a9 ), SHC( 0x8f1d ),
- SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa749 ), SHC( 0xa3bb ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x9192 ), SHC( 0xbf47 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e02 ), SHC( 0xe980 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x6e6e ), SHC( 0xbf47 ),
- SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x29f0 ), SHC( 0x8711 ),
- SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xfd7d ), SHC( 0x8006 ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xd159 ), SHC( 0x88ce ),
- SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xaafa ), SHC( 0xa052 ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x8f1d ), SHC( 0xc3a9 ),
- SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8135 ), SHC( 0xee76 ), SHC( 0x8019 ), SHC( 0x0506 ), SHC( 0x82f9 ), SHC( 0x1b6e ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d07 ), SHC( 0xe492 ), SHC( 0x743e ), SHC( 0xca69 ), SHC( 0x660f ), SHC( 0xb2bf ),
- SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x3c57 ), SHC( 0x8f1d ), SHC( 0x22bf ), SHC( 0x84ce ), SHC( 0x0789 ), SHC( 0x8039 ),
- SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xd159 ), SHC( 0x88ce ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xa3bb ), SHC( 0xa749 ),
- SHC( 0x92dd ), SHC( 0xbd1f ), SHC( 0x8711 ), SHC( 0xd610 ), SHC( 0x80e3 ), SHC( 0xf0f5 ), SHC( 0x809e ), SHC( 0x0c8c ),
- SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x9192 ), SHC( 0x40b9 ), SHC( 0xa202 ), SHC( 0x56e3 ), SHC( 0xb6d0 ), SHC( 0x6903 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7bda ), SHC( 0xdfae ), SHC( 0x6fae ), SHC( 0xc175 ), SHC( 0x5c45 ), SHC( 0xa749 ),
- SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xe492 ), SHC( 0x82f9 ),
- SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xaafa ), SHC( 0xa052 ), SHC( 0x9592 ), SHC( 0xb8e3 ), SHC( 0x8711 ), SHC( 0xd610 ),
- SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x81fe ), SHC( 0x1680 ), SHC( 0x8bc2 ), SHC( 0x3597 ), SHC( 0x9d0e ), SHC( 0x5134 ),
- SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xd159 ), SHC( 0x7732 ), SHC( 0xf0f5 ), SHC( 0x7f1d ), SHC( 0x118a ), SHC( 0x7ecb ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5134 ), SHC( 0x9d0e ),
- SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xc3a9 ), SHC( 0x8f1d ),
- SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x8f1d ), SHC( 0xc3a9 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x809e ), SHC( 0x0c8c ),
- SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9d0e ), SHC( 0x5134 ), SHC( 0xb8e3 ), SHC( 0x6a6e ), SHC( 0xdad8 ), SHC( 0x7a7d ),
- SHC( 0x0000 ), SHC( 0x7fff ), SHC( 0x2528 ), SHC( 0x7a7d ), SHC( 0x471d ), SHC( 0x6a6e ), SHC( 0x62f2 ), SHC( 0x5134 )
-};
-
-
-/**
- * \brief Twiddle factors are unscaled
- * Rotation factor table, real and imaginary part interleaved, for dim1=20,dim2=20
- */
-
-const Word16 RotVector_400[2 * ( 400 - 20 )] = { // Q15
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff0 ), SHC( 0xfbfb ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f6f ), SHC( 0xf3f4 ),
- SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7ceb ), SHC( 0xe414 ),
- SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x786f ), SHC( 0xd4a4 ),
- SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x7579 ), SHC( 0xcd2a ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x720d ), SHC( 0xc5e4 ),
- SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6e2d ), SHC( 0xbed8 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x69de ), SHC( 0xb80e ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7dbc ), SHC( 0xe804 ),
- SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x73d1 ), SHC( 0xc980 ),
- SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x62a0 ), SHC( 0xae69 ),
- SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4b3d ), SHC( 0x9872 ),
- SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3daa ), SHC( 0x8fd5 ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2f1f ), SHC( 0x88fd ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7aeb ), SHC( 0xdc4a ),
- SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6524 ), SHC( 0xb18c ),
- SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4128 ), SHC( 0x91d3 ),
- SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x1406 ), SHC( 0x8193 ),
- SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xe414 ), SHC( 0x8315 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7703 ), SHC( 0xd0e1 ),
- SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5197 ), SHC( 0x9d60 ),
- SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x17fc ), SHC( 0x8244 ),
- SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xd872 ), SHC( 0x8644 ),
- SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa2b1 ), SHC( 0xa861 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ),
- SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x6c13 ), SHC( 0xbb6a ),
- SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x1fd5 ), SHC( 0x8405 ),
- SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc256 ), SHC( 0x8fd5 ),
- SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8644 ), SHC( 0xd872 ),
- SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8041 ), SHC( 0x080a ), SHC( 0x8405 ), SHC( 0x1fd5 ), SHC( 0x8c2f ), SHC( 0x3680 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6524 ), SHC( 0xb18c ),
- SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x0405 ), SHC( 0x8010 ),
- SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0x9ffc ), SHC( 0xab5a ),
- SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8515 ), SHC( 0xdc4a ), SHC( 0x8041 ), SHC( 0xf7f6 ), SHC( 0x8193 ), SHC( 0x1406 ),
- SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9622 ), SHC( 0x47f2 ), SHC( 0xa861 ), SHC( 0x5d4f ), SHC( 0xbed8 ), SHC( 0x6e2d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x5d4f ), SHC( 0xa861 ),
- SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xe804 ), SHC( 0x8244 ),
- SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x88fd ), SHC( 0xd0e1 ),
- SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9872 ), SHC( 0x4b3d ),
- SHC( 0xae69 ), SHC( 0x62a0 ), SHC( 0xc980 ), SHC( 0x73d1 ), SHC( 0xe804 ), SHC( 0x7dbc ), SHC( 0x080a ), SHC( 0x7fbf ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x54a6 ), SHC( 0x9ffc ),
- SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xcd2a ), SHC( 0x8a87 ),
- SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9622 ), SHC( 0xb80e ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8010 ), SHC( 0xfbfb ),
- SHC( 0x8405 ), SHC( 0x1fd5 ), SHC( 0x91d3 ), SHC( 0x4128 ), SHC( 0xa861 ), SHC( 0x5d4f ), SHC( 0xc5e4 ), SHC( 0x720d ),
- SHC( 0xe804 ), SHC( 0x7dbc ), SHC( 0x0c0c ), SHC( 0x7f6f ), SHC( 0x2f1f ), SHC( 0x7703 ), SHC( 0x4e74 ), SHC( 0x6524 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffc ), SHC( 0xfdfd ), SHC( 0x7ff0 ), SHC( 0xfbfb ), SHC( 0x7fdc ), SHC( 0xf9f8 ),
- SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7f3a ), SHC( 0xf1f4 ),
- SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7eb9 ), SHC( 0xedf7 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7e18 ), SHC( 0xe9fe ),
- SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7d57 ), SHC( 0xe60b ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7c77 ), SHC( 0xe21e ),
- SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7b77 ), SHC( 0xde39 ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x7a57 ), SHC( 0xda5d ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fdc ), SHC( 0xf9f8 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7eb9 ), SHC( 0xedf7 ),
- SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x7919 ), SHC( 0xd68a ),
- SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x74a9 ), SHC( 0xcb53 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6f2f ), SHC( 0xc095 ),
- SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x68b9 ), SHC( 0xb666 ), SHC( 0x6524 ), SHC( 0xb18c ), SHC( 0x6155 ), SHC( 0xacdf ),
- SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5914 ), SHC( 0xa414 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x5008 ), SHC( 0x9c1b ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7c77 ), SHC( 0xe21e ),
- SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6d23 ), SHC( 0xbd1f ),
- SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5321 ), SHC( 0x9eab ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x30fc ), SHC( 0x89be ),
- SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1de2 ), SHC( 0x8389 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0a0b ), SHC( 0x8065 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f3a ), SHC( 0xf1f4 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7919 ), SHC( 0xd68a ),
- SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x6524 ), SHC( 0xb18c ), SHC( 0x5bec ), SHC( 0xa6ec ),
- SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4646 ), SHC( 0x9504 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x2d3f ), SHC( 0x8843 ),
- SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x1209 ), SHC( 0x8147 ), SHC( 0x0405 ), SHC( 0x8010 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
- SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xda5d ), SHC( 0x85a9 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xc095 ), SHC( 0x90d1 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7eb9 ), SHC( 0xedf7 ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x74a9 ), SHC( 0xcb53 ),
- SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x4646 ), SHC( 0x9504 ),
- SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x25a3 ), SHC( 0x85a9 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0203 ), SHC( 0x8004 ),
- SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xde39 ), SHC( 0x8489 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xbd1f ), SHC( 0x92dd ),
- SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa154 ), SHC( 0xa9db ), SHC( 0x9622 ), SHC( 0xb80e ), SHC( 0x8d0d ), SHC( 0xc7b0 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e18 ), SHC( 0xe9fe ), SHC( 0x786f ), SHC( 0xd4a4 ), SHC( 0x6f2f ), SHC( 0xc095 ),
- SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x4128 ), SHC( 0x91d3 ), SHC( 0x2d3f ), SHC( 0x8843 ),
- SHC( 0x17fc ), SHC( 0x8244 ), SHC( 0x0203 ), SHC( 0x8004 ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xd68a ), SHC( 0x86e7 ),
- SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xaff8 ), SHC( 0x9c1b ), SHC( 0x9ffc ), SHC( 0xab5a ), SHC( 0x92dd ), SHC( 0xbd1f ),
- SHC( 0x88fd ), SHC( 0xd0e1 ), SHC( 0x82a9 ), SHC( 0xe60b ), SHC( 0x8010 ), SHC( 0xfbfb ), SHC( 0x8147 ), SHC( 0x1209 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d57 ), SHC( 0xe60b ), SHC( 0x7579 ), SHC( 0xcd2a ), SHC( 0x68b9 ), SHC( 0xb666 ),
- SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1209 ), SHC( 0x8147 ),
- SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xde39 ), SHC( 0x8489 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xaff8 ), SHC( 0x9c1b ),
- SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x8ee1 ), SHC( 0xc41b ), SHC( 0x8515 ), SHC( 0xdc4a ), SHC( 0x8065 ), SHC( 0xf5f5 ),
- SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x86e7 ), SHC( 0x2976 ), SHC( 0x91d3 ), SHC( 0x4128 ), SHC( 0xa154 ), SHC( 0x5625 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6155 ), SHC( 0xacdf ),
- SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
- SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x92dd ), SHC( 0xbd1f ),
- SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x89be ), SHC( 0x30fc ),
- SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xacdf ), SHC( 0x6155 ), SHC( 0xc5e4 ), SHC( 0x720d ), SHC( 0xe21e ), SHC( 0x7c77 ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7b77 ), SHC( 0xde39 ), SHC( 0x6e2d ), SHC( 0xbed8 ), SHC( 0x5914 ), SHC( 0xa414 ),
- SHC( 0x3daa ), SHC( 0x8fd5 ), SHC( 0x1de2 ), SHC( 0x8389 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xda5d ), SHC( 0x85a9 ),
- SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xa154 ), SHC( 0xa9db ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x82a9 ), SHC( 0xe60b ),
- SHC( 0x8041 ), SHC( 0x080a ), SHC( 0x86e7 ), SHC( 0x2976 ), SHC( 0x9622 ), SHC( 0x47f2 ), SHC( 0xacdf ), SHC( 0x6155 ),
- SHC( 0xc980 ), SHC( 0x73d1 ), SHC( 0xe9fe ), SHC( 0x7e18 ), SHC( 0x0c0c ), SHC( 0x7f6f ), SHC( 0x2d3f ), SHC( 0x77bd ),
- SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7a57 ), SHC( 0xda5d ), SHC( 0x69de ), SHC( 0xb80e ), SHC( 0x5008 ), SHC( 0x9c1b ),
- SHC( 0x2f1f ), SHC( 0x88fd ), SHC( 0x0a0b ), SHC( 0x8065 ), SHC( 0xe414 ), SHC( 0x8315 ), SHC( 0xc095 ), SHC( 0x90d1 ),
- SHC( 0xa2b1 ), SHC( 0xa861 ), SHC( 0x8d0d ), SHC( 0xc7b0 ), SHC( 0x8193 ), SHC( 0xebfa ), SHC( 0x8147 ), SHC( 0x1209 ),
- SHC( 0x8c2f ), SHC( 0x3680 ), SHC( 0xa154 ), SHC( 0x5625 ), SHC( 0xbed8 ), SHC( 0x6e2d ), SHC( 0xe21e ), SHC( 0x7c77 ),
- SHC( 0x080a ), SHC( 0x7fbf ), SHC( 0x2d3f ), SHC( 0x77bd ), SHC( 0x4e74 ), SHC( 0x6524 ), SHC( 0x68b9 ), SHC( 0x499a )
-};
-
-const Word16 FFT_W64[( 64 * 2 ) * 2] = { // Q15
- 16384, 0, 16364, -804, 16305, -1606, 16207, -2404,
- 16069, -3196, 15893, -3981, 15679, -4756, 15426, -5520,
- 15137, -6270, 14811, -7005, 14449, -7723, 14053, -8423,
- 13623, -9102, 13160, -9760, 12665, -10394, 12140, -11003,
- 11585, -11585, 11003, -12140, 10394, -12665, 9760, -13160,
- 9102, -13623, 8423, -14053, 7723, -14449, 7005, -14811,
- 6270, -15137, 5520, -15426, 4756, -15679, 3981, -15893,
- 3196, -16069, 2404, -16207, 1606, -16305, 804, -16364,
- 0, -16384, -804, -16364, -1606, -16305, -2404, -16207,
- -3196, -16069, -3981, -15893, -4756, -15679, -5520, -15426,
- -6270, -15137, -7005, -14811, -7723, -14449, -8423, -14053,
- -9102, -13623, -9760, -13160, -10394, -12665, -11003, -12140,
- -11585, -11585, -12140, -11003, -12665, -10394, -13160, -9760,
- -13623, -9102, -14053, -8423, -14449, -7723, -14811, -7005,
- -15137, -6270, -15426, -5520, -15679, -4756, -15893, -3981,
- -16069, -3196, -16207, -2404, -16305, -1606, -16364, -804,
- /* The following is a duplication of the above but scaled up by a factor of 2.
- * This save one operation in inverse FFT inner loops */
- 32767, 0, 32729, -1608, 32610, -3212, 32413, -4808,
- 32138, -6393, 31786, -7962, 31357, -9512, 30853, -11039,
- 30274, -12540, 29622, -14010, 28899, -15447, 28106, -16846,
- 27246, -18205, 26320, -19520, 25330, -20788, 24279, -22006,
- 23170, -23170, 22006, -24279, 20788, -25330, 19520, -26320,
- 18205, -27246, 16846, -28106, 15447, -28899, 14010, -29622,
- 12540, -30274, 11039, -30853, 9512, -31357, 7962, -31786,
- 6393, -32138, 4808, -32413, 3212, -32610, 1608, -32729,
- 0, -32768, -1608, -32729, -3212, -32610, -4808, -32413,
- -6393, -32138, -7962, -31786, -9512, -31357, -11039, -30853,
- -12540, -30274, -14010, -29622, -15447, -28899, -16846, -28106,
- -18205, -27246, -19520, -26320, -20788, -25330, -22006, -24279,
- -23170, -23170, -24279, -22006, -25330, -20788, -26320, -19520,
- -27246, -18205, -28106, -16846, -28899, -15447, -29622, -14010,
- -30274, -12540, -30853, -11039, -31357, -9512, -31786, -7962,
- -32138, -6393, -32413, -4808, -32610, -3212, -32729, -1608
-};
-
-const Word16 FFT_W128[] = { // Q15
- /* part of table that is not scaled by 2 */
- 16384, 0, 16379, -402, 16364, -804, 16339, -1205,
- 16305, -1606, 16260, -2006, 16206, -2404, 16142, -2801,
- 16069, -3196, 15985, -3590, 15893, -3981, 15790, -4370,
- 15678, -4756, 15557, -5139, 15426, -5519, 15286, -5896,
- 15136, -6270, 14978, -6639, 14811, -7005, 14634, -7366,
- 14449, -7723, 14255, -8075, 14053, -8423, 13842, -8765,
- 13622, -9102, 13395, -9434, 13159, -9760, 12916, -10080,
- 12665, -10394, 12406, -10701, 12139, -11002, 11866, -11297,
- 11585, -11585, 11297, -11866, 11002, -12139, 10701, -12406,
- 10394, -12665, 10080, -12916, 9760, -13159, 9434, -13395,
- 9102, -13622, 8765, -13842, 8423, -14053, 8075, -14255,
- 7723, -14449, 7366, -14634, 7005, -14811, 6639, -14978,
- 6270, -15136, 5896, -15286, 5519, -15426, 5139, -15557,
- 4756, -15678, 4370, -15790, 3981, -15893, 3590, -15985,
- 3196, -16069, 2801, -16142, 2404, -16206, 2006, -16260,
- 1606, -16305, 1205, -16339, 804, -16364, 402, -16379,
- 0, -16384, -402, -16379, -804, -16364, -1205, -16339,
- -1606, -16305, -2006, -16260, -2404, -16206, -2801, -16142,
- -3196, -16069, -3590, -15985, -3981, -15893, -4370, -15790,
- -4756, -15678, -5139, -15557, -5519, -15426, -5896, -15286,
- -6270, -15136, -6639, -14978, -7005, -14811, -7366, -14634,
- -7723, -14449, -8075, -14255, -8423, -14053, -8765, -13842,
- -9102, -13622, -9434, -13395, -9760, -13159, -10080, -12916,
- -10394, -12665, -10701, -12406, -11002, -12139, -11297, -11866,
- -11585, -11585, -11866, -11297, -12139, -11002, -12406, -10701,
- -12665, -10394, -12916, -10080, -13159, -9760, -13395, -9434,
- -13622, -9102, -13842, -8765, -14053, -8423, -14255, -8075,
- -14449, -7723, -14634, -7366, -14811, -7005, -14978, -6639,
- -15136, -6270, -15286, -5896, -15426, -5519, -15557, -5139,
- -15678, -4756, -15790, -4370, -15893, -3981, -15985, -3590,
- -16069, -3196, -16142, -2801, -16206, -2404, -16260, -2006,
- -16305, -1606, -16339, -1205, -16364, -804, -16379, -402,
- /* part of table that is scaled by 2 (this save one operation in FFT inner loops) */
- 32767, 0, 32758, -804, 32728, -1608, 32678, -2410,
- 32610, -3212, 32520, -4012, 32412, -4808, 32284, -5602,
- 32138, -6392, 31970, -7180, 31786, -7962, 31580, -8740,
- 31356, -9512, 31114, -10278, 30852, -11038, 30572, -11792,
- 30272, -12540, 29956, -13278, 29622, -14010, 29268, -14732,
- 28898, -15446, 28510, -16150, 28106, -16846, 27684, -17530,
- 27244, -18204, 26790, -18868, 26318, -19520, 25832, -20160,
- 25330, -20788, 24812, -21402, 24278, -22004, 23732, -22594,
- 23170, -23170, 22594, -23732, 22004, -24278, 21402, -24812,
- 20788, -25330, 20160, -25832, 19520, -26318, 18868, -26790,
- 18204, -27244, 17530, -27684, 16846, -28106, 16150, -28510,
- 15446, -28898, 14732, -29268, 14010, -29622, 13278, -29956,
- 12540, -30272, 11792, -30572, 11038, -30852, 10278, -31114,
- 9512, -31356, 8740, -31580, 7962, -31786, 7180, -31970,
- 6392, -32138, 5602, -32284, 4808, -32412, 4012, -32520,
- 3212, -32610, 2410, -32678, 1608, -32728, 804, -32758,
- 0, -32768, -804, -32758, -1608, -32728, -2410, -32678,
- -3212, -32610, -4012, -32520, -4808, -32412, -5602, -32284,
- -6392, -32138, -7180, -31970, -7962, -31786, -8740, -31580,
- -9512, -31356, -10278, -31114, -11038, -30852, -11792, -30572,
- -12540, -30272, -13278, -29956, -14010, -29622, -14732, -29268,
- -15446, -28898, -16150, -28510, -16846, -28106, -17530, -27684,
- -18204, -27244, -18868, -26790, -19520, -26318, -20160, -25832,
- -20788, -25330, -21402, -24812, -22004, -24278, -22594, -23732,
- -23170, -23170, -23732, -22594, -24278, -22004, -24812, -21402,
- -25330, -20788, -25832, -20160, -26318, -19520, -26790, -18868,
- -27244, -18204, -27684, -17530, -28106, -16846, -28510, -16150,
- -28898, -15446, -29268, -14732, -29622, -14010, -29956, -13278,
- -30272, -12540, -30572, -11792, -30852, -11038, -31114, -10278,
- -31356, -9512, -31580, -8740, -31786, -7962, -31970, -7180,
- -32138, -6392, -32284, -5602, -32412, -4808, -32520, -4012,
- -32610, -3212, -32678, -2410, -32728, -1608, -32758, -804
-};
-
-const Word16 FFT_W256[( 256 * 2 ) * 2] = { // Q15
- /* Each adjacent pair represents the real and imaginary part of a complex number: */
- /* W = exp{-j*(PI*n/256)} = cos(PI*n/256)*16384 -j*sin(PI*n/256)*16384 for n=0, 1, ..., 255. */
- 16384, 0, 16383, -201, 16379, -402, 16373, -603,
- 16364, -804, 16353, -1005, 16340, -1205, 16324, -1406,
- 16305, -1606, 16284, -1806, 16261, -2006, 16235, -2205,
- 16207, -2404, 16176, -2603, 16143, -2801, 16107, -2999,
- 16069, -3196, 16029, -3393, 15986, -3590, 15941, -3786,
- 15893, -3981, 15843, -4176, 15791, -4370, 15736, -4563,
- 15679, -4756, 15619, -4948, 15557, -5139, 15493, -5330,
- 15426, -5520, 15357, -5708, 15286, -5897, 15213, -6084,
- 15137, -6270, 15059, -6455, 14978, -6639, 14896, -6823,
- 14811, -7005, 14724, -7186, 14635, -7366, 14543, -7545,
- 14449, -7723, 14354, -7900, 14256, -8076, 14155, -8250,
- 14053, -8423, 13949, -8595, 13842, -8765, 13733, -8935,
- 13623, -9102, 13510, -9269, 13395, -9434, 13279, -9598,
- 13160, -9760, 13039, -9921, 12916, -10080, 12792, -10238,
- 12665, -10394, 12537, -10549, 12406, -10702, 12274, -10853,
- 12140, -11003, 12004, -11151, 11866, -11297, 11727, -11442,
- 11585, -11585, 11442, -11727, 11297, -11866, 11151, -12004,
- 11003, -12140, 10853, -12274, 10702, -12406, 10549, -12537,
- 10394, -12665, 10238, -12792, 10080, -12916, 9921, -13039,
- 9760, -13160, 9598, -13279, 9434, -13395, 9269, -13510,
- 9102, -13623, 8935, -13733, 8765, -13842, 8595, -13949,
- 8423, -14053, 8250, -14155, 8076, -14256, 7900, -14354,
- 7723, -14449, 7545, -14543, 7366, -14635, 7186, -14724,
- 7005, -14811, 6823, -14896, 6639, -14978, 6455, -15059,
- 6270, -15137, 6084, -15213, 5897, -15286, 5708, -15357,
- 5520, -15426, 5330, -15493, 5139, -15557, 4948, -15619,
- 4756, -15679, 4563, -15736, 4370, -15791, 4176, -15843,
- 3981, -15893, 3786, -15941, 3590, -15986, 3393, -16029,
- 3196, -16069, 2999, -16107, 2801, -16143, 2603, -16176,
- 2404, -16207, 2205, -16235, 2006, -16261, 1806, -16284,
- 1606, -16305, 1406, -16324, 1205, -16340, 1005, -16353,
- 804, -16364, 603, -16373, 402, -16379, 201, -16383,
- 0, -16384, -201, -16383, -402, -16379, -603, -16373,
- -804, -16364, -1005, -16353, -1205, -16340, -1406, -16324,
- -1606, -16305, -1806, -16284, -2006, -16261, -2205, -16235,
- -2404, -16207, -2603, -16176, -2801, -16143, -2999, -16107,
- -3196, -16069, -3393, -16029, -3590, -15986, -3786, -15941,
- -3981, -15893, -4176, -15843, -4370, -15791, -4563, -15736,
- -4756, -15679, -4948, -15619, -5139, -15557, -5330, -15493,
- -5520, -15426, -5708, -15357, -5897, -15286, -6084, -15213,
- -6270, -15137, -6455, -15059, -6639, -14978, -6823, -14896,
- -7005, -14811, -7186, -14724, -7366, -14635, -7545, -14543,
- -7723, -14449, -7900, -14354, -8076, -14256, -8250, -14155,
- -8423, -14053, -8595, -13949, -8765, -13842, -8935, -13733,
- -9102, -13623, -9269, -13510, -9434, -13395, -9598, -13279,
- -9760, -13160, -9921, -13039, -10080, -12916, -10238, -12792,
- -10394, -12665, -10549, -12537, -10702, -12406, -10853, -12274,
- -11003, -12140, -11151, -12004, -11297, -11866, -11442, -11727,
- -11585, -11585, -11727, -11442, -11866, -11297, -12004, -11151,
- -12140, -11003, -12274, -10853, -12406, -10702, -12537, -10549,
- -12665, -10394, -12792, -10238, -12916, -10080, -13039, -9921,
- -13160, -9760, -13279, -9598, -13395, -9434, -13510, -9269,
- -13623, -9102, -13733, -8935, -13842, -8765, -13949, -8595,
- -14053, -8423, -14155, -8250, -14256, -8076, -14354, -7900,
- -14449, -7723, -14543, -7545, -14635, -7366, -14724, -7186,
- -14811, -7005, -14896, -6823, -14978, -6639, -15059, -6455,
- -15137, -6270, -15213, -6084, -15286, -5897, -15357, -5708,
- -15426, -5520, -15493, -5330, -15557, -5139, -15619, -4948,
- -15679, -4756, -15736, -4563, -15791, -4370, -15843, -4176,
- -15893, -3981, -15941, -3786, -15986, -3590, -16029, -3393,
- -16069, -3196, -16107, -2999, -16143, -2801, -16176, -2603,
- -16207, -2404, -16235, -2205, -16261, -2006, -16284, -1806,
- -16305, -1606, -16324, -1406, -16340, -1205, -16353, -1005,
- -16364, -804, -16373, -603, -16379, -402, -16383, -201,
-
- /* The following is a duplication of the above but scaled up by a factor of 2.
- * This save one operation in inverse FFT inner loops */
- 32767, 0, 32766, -402, 32758, -804, 32746, -1206,
- 32729, -1608, 32706, -2009, 32679, -2411, 32647, -2811,
- 32610, -3212, 32568, -3612, 32522, -4011, 32470, -4410,
- 32413, -4808, 32352, -5205, 32286, -5602, 32214, -5998,
- 32138, -6393, 32058, -6787, 31972, -7180, 31881, -7571,
- 31786, -7962, 31686, -8351, 31581, -8740, 31471, -9127,
- 31357, -9512, 31238, -9896, 31114, -10279, 30986, -10660,
- 30853, -11039, 30715, -11417, 30572, -11793, 30425, -12167,
- 30274, -12540, 30118, -12910, 29957, -13279, 29792, -13646,
- 29622, -14010, 29448, -14373, 29269, -14733, 29086, -15091,
- 28899, -15447, 28707, -15800, 28511, -16151, 28311, -16500,
- 28106, -16846, 27897, -17190, 27684, -17531, 27467, -17869,
- 27246, -18205, 27020, -18538, 26791, -18868, 26557, -19195,
- 26320, -19520, 26078, -19841, 25833, -20160, 25583, -20475,
- 25330, -20788, 25073, -21097, 24812, -21403, 24548, -21706,
- 24279, -22006, 24008, -22302, 23732, -22595, 23453, -22884,
- 23170, -23170, 22884, -23453, 22595, -23732, 22302, -24008,
- 22006, -24279, 21706, -24548, 21403, -24812, 21097, -25073,
- 20788, -25330, 20475, -25583, 20160, -25833, 19841, -26078,
- 19520, -26320, 19195, -26557, 18868, -26791, 18538, -27020,
- 18205, -27246, 17869, -27467, 17531, -27684, 17190, -27897,
- 16846, -28106, 16500, -28311, 16151, -28511, 15800, -28707,
- 15447, -28899, 15091, -29086, 14733, -29269, 14373, -29448,
- 14010, -29622, 13646, -29792, 13279, -29957, 12910, -30118,
- 12540, -30274, 12167, -30425, 11793, -30572, 11417, -30715,
- 11039, -30853, 10660, -30986, 10279, -31114, 9896, -31238,
- 9512, -31357, 9127, -31471, 8740, -31581, 8351, -31686,
- 7962, -31786, 7571, -31881, 7180, -31972, 6787, -32058,
- 6393, -32138, 5998, -32214, 5602, -32286, 5205, -32352,
- 4808, -32413, 4410, -32470, 4011, -32522, 3612, -32568,
- 3212, -32610, 2811, -32647, 2411, -32679, 2009, -32706,
- 1608, -32729, 1206, -32746, 804, -32758, 402, -32766,
- 0, -32768, -402, -32766, -804, -32758, -1206, -32746,
- -1608, -32729, -2009, -32706, -2411, -32679, -2811, -32647,
- -3212, -32610, -3612, -32568, -4011, -32522, -4410, -32470,
- -4808, -32413, -5205, -32352, -5602, -32286, -5998, -32214,
- -6393, -32138, -6787, -32058, -7180, -31972, -7571, -31881,
- -7962, -31786, -8351, -31686, -8740, -31581, -9127, -31471,
- -9512, -31357, -9896, -31238, -10279, -31114, -10660, -30986,
- -11039, -30853, -11417, -30715, -11793, -30572, -12167, -30425,
- -12540, -30274, -12910, -30118, -13279, -29957, -13646, -29792,
- -14010, -29622, -14373, -29448, -14733, -29269, -15091, -29086,
- -15447, -28899, -15800, -28707, -16151, -28511, -16500, -28311,
- -16846, -28106, -17190, -27897, -17531, -27684, -17869, -27467,
- -18205, -27246, -18538, -27020, -18868, -26791, -19195, -26557,
- -19520, -26320, -19841, -26078, -20160, -25833, -20475, -25583,
- -20788, -25330, -21097, -25073, -21403, -24812, -21706, -24548,
- -22006, -24279, -22302, -24008, -22595, -23732, -22884, -23453,
- -23170, -23170, -23453, -22884, -23732, -22595, -24008, -22302,
- -24279, -22006, -24548, -21706, -24812, -21403, -25073, -21097,
- -25330, -20788, -25583, -20475, -25833, -20160, -26078, -19841,
- -26320, -19520, -26557, -19195, -26791, -18868, -27020, -18538,
- -27246, -18205, -27467, -17869, -27684, -17531, -27897, -17190,
- -28106, -16846, -28311, -16500, -28511, -16151, -28707, -15800,
- -28899, -15447, -29086, -15091, -29269, -14733, -29448, -14373,
- -29622, -14010, -29792, -13646, -29957, -13279, -30118, -12910,
- -30274, -12540, -30425, -12167, -30572, -11793, -30715, -11417,
- -30853, -11039, -30986, -10660, -31114, -10279, -31238, -9896,
- -31357, -9512, -31471, -9127, -31581, -8740, -31686, -8351,
- -31786, -7962, -31881, -7571, -31972, -7180, -32058, -6787,
- -32138, -6393, -32214, -5998, -32286, -5602, -32352, -5205,
- -32413, -4808, -32470, -4410, -32522, -4011, -32568, -3612,
- -32610, -3212, -32647, -2811, -32679, -2411, -32706, -2009,
- -32729, -1608, -32746, -1206, -32758, -804, -32766, -402
-};
-
-const Word16 FFT_W512[( 512 * 2 ) * 2] = { // Q15
- 16384, 0, 16384, -101, 16383, -201, 16381, -302,
- 16379, -402, 16376, -503, 16373, -603, 16369, -704,
- 16364, -804, 16359, -904, 16353, -1005, 16347, -1105,
- 16340, -1205, 16332, -1306, 16324, -1406, 16315, -1506,
- 16305, -1606, 16295, -1706, 16284, -1806, 16273, -1906,
- 16261, -2006, 16248, -2105, 16235, -2205, 16221, -2305,
- 16207, -2404, 16192, -2503, 16176, -2603, 16160, -2702,
- 16143, -2801, 16125, -2900, 16107, -2999, 16088, -3098,
- 16069, -3196, 16049, -3295, 16029, -3393, 16008, -3492,
- 15986, -3590, 15964, -3688, 15941, -3786, 15917, -3883,
- 15893, -3981, 15868, -4078, 15843, -4176, 15817, -4273,
- 15791, -4370, 15763, -4467, 15736, -4563, 15707, -4660,
- 15679, -4756, 15649, -4852, 15619, -4948, 15588, -5044,
- 15557, -5139, 15525, -5235, 15493, -5330, 15460, -5425,
- 15426, -5520, 15392, -5614, 15357, -5708, 15322, -5803,
- 15286, -5897, 15250, -5990, 15213, -6084, 15175, -6177,
- 15137, -6270, 15098, -6363, 15059, -6455, 15019, -6547,
- 14978, -6639, 14937, -6731, 14896, -6823, 14854, -6914,
- 14811, -7005, 14768, -7096, 14724, -7186, 14680, -7276,
- 14635, -7366, 14589, -7456, 14543, -7545, 14497, -7635,
- 14449, -7723, 14402, -7812, 14354, -7900, 14305, -7988,
- 14256, -8076, 14206, -8163, 14155, -8250, 14104, -8337,
- 14053, -8423, 14001, -8509, 13949, -8595, 13896, -8680,
- 13842, -8765, 13788, -8850, 13733, -8935, 13678, -9019,
- 13623, -9102, 13567, -9186, 13510, -9269, 13453, -9352,
- 13395, -9434, 13337, -9516, 13279, -9598, 13219, -9679,
- 13160, -9760, 13100, -9841, 13039, -9921, 12978, -10001,
- 12916, -10080, 12854, -10159, 12792, -10238, 12729, -10316,
- 12665, -10394, 12601, -10471, 12537, -10549, 12472, -10625,
- 12406, -10702, 12340, -10778, 12274, -10853, 12207, -10928,
- 12140, -11003, 12072, -11077, 12004, -11151, 11935, -11224,
- 11866, -11297, 11797, -11370, 11727, -11442, 11656, -11514,
- 11585, -11585, 11514, -11656, 11442, -11727, 11370, -11797,
- 11297, -11866, 11224, -11935, 11151, -12004, 11077, -12072,
- 11003, -12140, 10928, -12207, 10853, -12274, 10778, -12340,
- 10702, -12406, 10625, -12472, 10549, -12537, 10471, -12601,
- 10394, -12665, 10316, -12729, 10238, -12792, 10159, -12854,
- 10080, -12916, 10001, -12978, 9921, -13039, 9841, -13100,
- 9760, -13160, 9679, -13219, 9598, -13279, 9516, -13337,
- 9434, -13395, 9352, -13453, 9269, -13510, 9186, -13567,
- 9102, -13623, 9019, -13678, 8935, -13733, 8850, -13788,
- 8765, -13842, 8680, -13896, 8595, -13949, 8509, -14001,
- 8423, -14053, 8337, -14104, 8250, -14155, 8163, -14206,
- 8076, -14256, 7988, -14305, 7900, -14354, 7812, -14402,
- 7723, -14449, 7635, -14497, 7545, -14543, 7456, -14589,
- 7366, -14635, 7276, -14680, 7186, -14724, 7096, -14768,
- 7005, -14811, 6914, -14854, 6823, -14896, 6731, -14937,
- 6639, -14978, 6547, -15019, 6455, -15059, 6363, -15098,
- 6270, -15137, 6177, -15175, 6084, -15213, 5990, -15250,
- 5897, -15286, 5803, -15322, 5708, -15357, 5614, -15392,
- 5520, -15426, 5425, -15460, 5330, -15493, 5235, -15525,
- 5139, -15557, 5044, -15588, 4948, -15619, 4852, -15649,
- 4756, -15679, 4660, -15707, 4563, -15736, 4467, -15763,
- 4370, -15791, 4273, -15817, 4176, -15843, 4078, -15868,
- 3981, -15893, 3883, -15917, 3786, -15941, 3688, -15964,
- 3590, -15986, 3492, -16008, 3393, -16029, 3295, -16049,
- 3196, -16069, 3098, -16088, 2999, -16107, 2900, -16125,
- 2801, -16143, 2702, -16160, 2603, -16176, 2503, -16192,
- 2404, -16207, 2305, -16221, 2205, -16235, 2105, -16248,
- 2006, -16261, 1906, -16273, 1806, -16284, 1706, -16295,
- 1606, -16305, 1506, -16315, 1406, -16324, 1306, -16332,
- 1205, -16340, 1105, -16347, 1005, -16353, 904, -16359,
- 804, -16364, 703, -16369, 603, -16373, 503, -16376,
- 402, -16379, 302, -16381, 201, -16383, 101, -16384,
- 0, -16384, -101, -16384, -201, -16383, -302, -16381,
- -402, -16379, -503, -16376, -603, -16373, -704, -16369,
- -804, -16364, -904, -16359, -1005, -16353, -1105, -16347,
- -1205, -16340, -1306, -16332, -1406, -16324, -1506, -16315,
- -1606, -16305, -1706, -16295, -1806, -16284, -1906, -16273,
- -2006, -16261, -2105, -16248, -2205, -16235, -2305, -16221,
- -2404, -16207, -2503, -16192, -2603, -16176, -2702, -16160,
- -2801, -16143, -2900, -16125, -2999, -16107, -3098, -16088,
- -3196, -16069, -3295, -16049, -3393, -16029, -3492, -16008,
- -3590, -15986, -3688, -15964, -3786, -15941, -3883, -15917,
- -3981, -15893, -4078, -15868, -4176, -15843, -4273, -15817,
- -4370, -15791, -4467, -15763, -4563, -15736, -4660, -15707,
- -4756, -15679, -4852, -15649, -4948, -15619, -5044, -15588,
- -5139, -15557, -5235, -15525, -5330, -15493, -5425, -15460,
- -5520, -15426, -5614, -15392, -5708, -15357, -5803, -15322,
- -5897, -15286, -5990, -15250, -6084, -15213, -6177, -15175,
- -6270, -15137, -6363, -15098, -6455, -15059, -6547, -15019,
- -6639, -14978, -6731, -14937, -6823, -14896, -6914, -14854,
- -7005, -14811, -7096, -14768, -7186, -14724, -7276, -14680,
- -7366, -14635, -7456, -14589, -7545, -14543, -7635, -14497,
- -7723, -14449, -7812, -14402, -7900, -14354, -7988, -14305,
- -8076, -14256, -8163, -14206, -8250, -14155, -8337, -14104,
- -8423, -14053, -8509, -14001, -8595, -13949, -8680, -13896,
- -8765, -13842, -8850, -13788, -8935, -13733, -9019, -13678,
- -9102, -13623, -9186, -13567, -9269, -13510, -9352, -13453,
- -9434, -13395, -9516, -13337, -9598, -13279, -9679, -13219,
- -9760, -13160, -9841, -13100, -9921, -13039, -10001, -12978,
- -10080, -12916, -10159, -12854, -10238, -12792, -10316, -12729,
- -10394, -12665, -10471, -12601, -10549, -12537, -10625, -12472,
- -10702, -12406, -10778, -12340, -10853, -12274, -10928, -12207,
- -11003, -12140, -11077, -12072, -11151, -12004, -11224, -11935,
- -11297, -11866, -11370, -11797, -11442, -11727, -11514, -11656,
- -11585, -11585, -11656, -11514, -11727, -11442, -11797, -11370,
- -11866, -11297, -11935, -11224, -12004, -11151, -12072, -11077,
- -12140, -11003, -12207, -10928, -12274, -10853, -12340, -10778,
- -12406, -10702, -12472, -10625, -12537, -10549, -12601, -10471,
- -12665, -10394, -12729, -10316, -12792, -10238, -12854, -10159,
- -12916, -10080, -12978, -10001, -13039, -9921, -13100, -9840,
- -13160, -9760, -13219, -9679, -13279, -9598, -13337, -9516,
- -13395, -9434, -13453, -9352, -13510, -9269, -13567, -9186,
- -13623, -9102, -13678, -9019, -13733, -8935, -13788, -8850,
- -13842, -8765, -13896, -8680, -13949, -8595, -14001, -8509,
- -14053, -8423, -14104, -8337, -14155, -8250, -14206, -8163,
- -14256, -8076, -14305, -7988, -14354, -7900, -14402, -7812,
- -14449, -7723, -14497, -7635, -14543, -7545, -14589, -7456,
- -14635, -7366, -14680, -7276, -14724, -7186, -14768, -7096,
- -14811, -7005, -14854, -6914, -14896, -6823, -14937, -6731,
- -14978, -6639, -15019, -6547, -15059, -6455, -15098, -6363,
- -15137, -6270, -15175, -6177, -15213, -6084, -15250, -5990,
- -15286, -5897, -15322, -5803, -15357, -5708, -15392, -5614,
- -15426, -5520, -15460, -5425, -15493, -5330, -15525, -5235,
- -15557, -5139, -15588, -5044, -15619, -4948, -15649, -4852,
- -15679, -4756, -15707, -4660, -15736, -4563, -15763, -4467,
- -15791, -4370, -15817, -4273, -15843, -4176, -15868, -4078,
- -15893, -3981, -15917, -3883, -15941, -3786, -15964, -3688,
- -15986, -3590, -16008, -3492, -16029, -3393, -16049, -3295,
- -16069, -3196, -16088, -3098, -16107, -2999, -16125, -2900,
- -16143, -2801, -16160, -2702, -16176, -2603, -16192, -2503,
- -16207, -2404, -16221, -2305, -16235, -2205, -16248, -2105,
- -16261, -2006, -16273, -1906, -16284, -1806, -16295, -1706,
- -16305, -1606, -16315, -1506, -16324, -1406, -16332, -1306,
- -16340, -1205, -16347, -1105, -16353, -1005, -16359, -904,
- -16364, -804, -16369, -703, -16373, -603, -16376, -503,
- -16379, -402, -16381, -302, -16383, -201, -16384, -101,
- /* The following is a duplication of the above but scaled up by a factor of 2.
- * This save one operation in inverse FFT inner loops */
- 32767, 0, 32767, -201, 32766, -402, 32762, -603,
- 32758, -804, 32753, -1005, 32746, -1206, 32738, -1407,
- 32729, -1608, 32718, -1809, 32706, -2009, 32693, -2210,
- 32679, -2411, 32664, -2611, 32647, -2811, 32629, -3012,
- 32610, -3212, 32590, -3412, 32568, -3612, 32546, -3812,
- 32522, -4011, 32496, -4211, 32470, -4410, 32442, -4609,
- 32413, -4808, 32383, -5007, 32352, -5205, 32319, -5404,
- 32286, -5602, 32251, -5800, 32214, -5998, 32177, -6195,
- 32138, -6393, 32099, -6590, 32058, -6787, 32015, -6983,
- 31972, -7180, 31927, -7376, 31881, -7571, 31834, -7767,
- 31786, -7962, 31737, -8157, 31686, -8351, 31634, -8546,
- 31581, -8740, 31527, -8933, 31471, -9127, 31415, -9319,
- 31357, -9512, 31298, -9704, 31238, -9896, 31177, -10088,
- 31114, -10279, 31050, -10469, 30986, -10660, 30920, -10850,
- 30853, -11039, 30784, -11228, 30715, -11417, 30644, -11605,
- 30572, -11793, 30499, -11980, 30425, -12167, 30350, -12354,
- 30274, -12540, 30196, -12725, 30118, -12910, 30038, -13095,
- 29957, -13279, 29875, -13463, 29792, -13646, 29707, -13828,
- 29622, -14010, 29535, -14192, 29448, -14373, 29359, -14553,
- 29269, -14733, 29178, -14912, 29086, -15091, 28993, -15269,
- 28899, -15447, 28803, -15624, 28707, -15800, 28610, -15976,
- 28511, -16151, 28411, -16326, 28311, -16500, 28209, -16673,
- 28106, -16846, 28002, -17018, 27897, -17190, 27791, -17361,
- 27684, -17531, 27576, -17700, 27467, -17869, 27357, -18037,
- 27246, -18205, 27133, -18372, 27020, -18538, 26906, -18703,
- 26791, -18868, 26674, -19032, 26557, -19195, 26439, -19358,
- 26320, -19520, 26199, -19681, 26078, -19841, 25956, -20001,
- 25833, -20160, 25708, -20318, 25583, -20475, 25457, -20632,
- 25330, -20788, 25202, -20943, 25073, -21097, 24943, -21251,
- 24812, -21403, 24680, -21555, 24548, -21706, 24414, -21856,
- 24279, -22006, 24144, -22154, 24008, -22302, 23870, -22449,
- 23732, -22595, 23593, -22740, 23453, -22884, 23312, -23028,
- 23170, -23170, 23028, -23312, 22884, -23453, 22740, -23593,
- 22595, -23732, 22449, -23870, 22302, -24008, 22154, -24144,
- 22006, -24279, 21856, -24414, 21706, -24548, 21555, -24680,
- 21403, -24812, 21251, -24943, 21097, -25073, 20943, -25202,
- 20788, -25330, 20632, -25457, 20475, -25583, 20318, -25708,
- 20160, -25833, 20001, -25956, 19841, -26078, 19681, -26199,
- 19520, -26320, 19358, -26439, 19195, -26557, 19032, -26674,
- 18868, -26791, 18703, -26906, 18538, -27020, 18372, -27133,
- 18205, -27246, 18037, -27357, 17869, -27467, 17700, -27576,
- 17531, -27684, 17361, -27791, 17190, -27897, 17018, -28002,
- 16846, -28106, 16673, -28209, 16500, -28311, 16326, -28411,
- 16151, -28511, 15976, -28610, 15800, -28707, 15624, -28803,
- 15447, -28899, 15269, -28993, 15091, -29086, 14912, -29178,
- 14733, -29269, 14553, -29359, 14373, -29448, 14192, -29535,
- 14010, -29622, 13828, -29707, 13646, -29792, 13463, -29875,
- 13279, -29957, 13095, -30038, 12910, -30118, 12725, -30196,
- 12540, -30274, 12354, -30350, 12167, -30425, 11980, -30499,
- 11793, -30572, 11605, -30644, 11417, -30715, 11228, -30784,
- 11039, -30853, 10850, -30920, 10660, -30986, 10469, -31050,
- 10279, -31114, 10088, -31177, 9896, -31238, 9704, -31298,
- 9512, -31357, 9319, -31415, 9127, -31471, 8933, -31527,
- 8740, -31581, 8546, -31634, 8351, -31686, 8157, -31737,
- 7962, -31786, 7767, -31834, 7571, -31881, 7376, -31927,
- 7180, -31972, 6983, -32015, 6787, -32058, 6590, -32099,
- 6393, -32138, 6195, -32177, 5998, -32214, 5800, -32251,
- 5602, -32286, 5404, -32319, 5205, -32352, 5007, -32383,
- 4808, -32413, 4609, -32442, 4410, -32470, 4211, -32496,
- 4011, -32522, 3812, -32546, 3612, -32568, 3412, -32590,
- 3212, -32610, 3012, -32629, 2811, -32647, 2611, -32664,
- 2411, -32679, 2210, -32693, 2009, -32706, 1809, -32718,
- 1608, -32729, 1407, -32738, 1206, -32746, 1005, -32753,
- 804, -32758, 603, -32762, 402, -32766, 201, -32767,
- 0, -32768, -201, -32767, -402, -32766, -603, -32762,
- -804, -32758, -1005, -32753, -1206, -32746, -1407, -32738,
- -1608, -32729, -1809, -32718, -2009, -32706, -2210, -32693,
- -2411, -32679, -2611, -32664, -2811, -32647, -3012, -32629,
- -3212, -32610, -3412, -32590, -3612, -32568, -3812, -32546,
- -4011, -32522, -4211, -32496, -4410, -32470, -4609, -32442,
- -4808, -32413, -5007, -32383, -5205, -32352, -5404, -32319,
- -5602, -32286, -5800, -32251, -5998, -32214, -6195, -32177,
- -6393, -32138, -6590, -32099, -6787, -32058, -6983, -32015,
- -7180, -31972, -7376, -31927, -7571, -31881, -7767, -31834,
- -7962, -31786, -8157, -31737, -8351, -31686, -8546, -31634,
- -8740, -31581, -8933, -31527, -9127, -31471, -9319, -31415,
- -9512, -31357, -9704, -31298, -9896, -31238, -10088, -31177,
- -10279, -31114, -10469, -31050, -10660, -30986, -10850, -30920,
- -11039, -30853, -11228, -30784, -11417, -30715, -11605, -30644,
- -11793, -30572, -11980, -30499, -12167, -30425, -12354, -30350,
- -12540, -30274, -12725, -30196, -12910, -30118, -13095, -30038,
- -13279, -29957, -13463, -29875, -13646, -29792, -13828, -29707,
- -14010, -29622, -14192, -29535, -14373, -29448, -14553, -29359,
- -14733, -29269, -14912, -29178, -15091, -29086, -15269, -28993,
- -15447, -28899, -15624, -28803, -15800, -28707, -15976, -28610,
- -16151, -28511, -16326, -28411, -16500, -28311, -16673, -28209,
- -16846, -28106, -17018, -28002, -17190, -27897, -17361, -27791,
- -17531, -27684, -17700, -27576, -17869, -27467, -18037, -27357,
- -18205, -27246, -18372, -27133, -18538, -27020, -18703, -26906,
- -18868, -26791, -19032, -26674, -19195, -26557, -19358, -26439,
- -19520, -26320, -19681, -26199, -19841, -26078, -20001, -25956,
- -20160, -25833, -20318, -25708, -20475, -25583, -20632, -25457,
- -20788, -25330, -20943, -25202, -21097, -25073, -21251, -24943,
- -21403, -24812, -21555, -24680, -21706, -24548, -21856, -24414,
- -22006, -24279, -22154, -24144, -22302, -24008, -22449, -23870,
- -22595, -23732, -22740, -23593, -22884, -23453, -23028, -23312,
- -23170, -23170, -23312, -23028, -23453, -22884, -23593, -22740,
- -23732, -22595, -23870, -22449, -24008, -22302, -24144, -22154,
- -24279, -22006, -24414, -21856, -24548, -21706, -24680, -21555,
- -24812, -21403, -24943, -21251, -25073, -21097, -25202, -20943,
- -25330, -20788, -25457, -20632, -25583, -20475, -25708, -20318,
- -25833, -20160, -25956, -20001, -26078, -19841, -26199, -19681,
- -26320, -19520, -26439, -19358, -26557, -19195, -26674, -19032,
- -26791, -18868, -26906, -18703, -27020, -18538, -27133, -18372,
- -27246, -18205, -27357, -18037, -27467, -17869, -27576, -17700,
- -27684, -17531, -27791, -17361, -27897, -17190, -28002, -17018,
- -28106, -16846, -28209, -16673, -28311, -16500, -28411, -16326,
- -28511, -16151, -28610, -15976, -28707, -15800, -28803, -15624,
- -28899, -15447, -28993, -15269, -29086, -15091, -29178, -14912,
- -29269, -14733, -29359, -14553, -29448, -14373, -29535, -14192,
- -29622, -14010, -29707, -13828, -29792, -13646, -29875, -13463,
- -29957, -13279, -30038, -13095, -30118, -12910, -30196, -12725,
- -30274, -12540, -30350, -12354, -30425, -12167, -30499, -11980,
- -30572, -11793, -30644, -11605, -30715, -11417, -30784, -11228,
- -30853, -11039, -30920, -10850, -30986, -10660, -31050, -10469,
- -31114, -10279, -31177, -10088, -31238, -9896, -31298, -9704,
- -31357, -9512, -31415, -9319, -31471, -9127, -31527, -8933,
- -31581, -8740, -31634, -8546, -31686, -8351, -31737, -8157,
- -31786, -7962, -31834, -7767, -31881, -7571, -31927, -7376,
- -31972, -7180, -32015, -6983, -32058, -6787, -32099, -6590,
- -32138, -6393, -32177, -6195, -32214, -5998, -32251, -5800,
- -32286, -5602, -32319, -5404, -32352, -5205, -32383, -5007,
- -32413, -4808, -32442, -4609, -32470, -4410, -32496, -4211,
- -32522, -4011, -32546, -3812, -32568, -3612, -32590, -3412,
- -32610, -3212, -32629, -3012, -32647, -2811, -32664, -2611,
- -32679, -2411, -32693, -2210, -32706, -2009, -32718, -1809,
- -32729, -1608, -32738, -1407, -32746, -1206, -32753, -1005,
- -32758, -804, -32762, -603, -32766, -402, -32767, -201
-};
-
-const Word16 FFT_REORDER_1024[512] = {
- 0, 512, 256, 768, 128, 640, 384, 896,
- 64, 576, 320, 832, 192, 704, 448, 960,
- 32, 544, 288, 800, 160, 672, 416, 928,
- 96, 608, 352, 864, 224, 736, 480, 992,
- 16, 528, 272, 784, 144, 656, 400, 912,
- 80, 592, 336, 848, 208, 720, 464, 976,
- 48, 560, 304, 816, 176, 688, 432, 944,
- 112, 624, 368, 880, 240, 752, 496, 1008,
- 8, 520, 264, 776, 136, 648, 392, 904,
- 72, 584, 328, 840, 200, 712, 456, 968,
- 40, 552, 296, 808, 168, 680, 424, 936,
- 104, 616, 360, 872, 232, 744, 488, 1000,
- 24, 536, 280, 792, 152, 664, 408, 920,
- 88, 600, 344, 856, 216, 728, 472, 984,
- 56, 568, 312, 824, 184, 696, 440, 952,
- 120, 632, 376, 888, 248, 760, 504, 1016,
- 4, 516, 260, 772, 132, 644, 388, 900,
- 68, 580, 324, 836, 196, 708, 452, 964,
- 36, 548, 292, 804, 164, 676, 420, 932,
- 100, 612, 356, 868, 228, 740, 484, 996,
- 20, 532, 276, 788, 148, 660, 404, 916,
- 84, 596, 340, 852, 212, 724, 468, 980,
- 52, 564, 308, 820, 180, 692, 436, 948,
- 116, 628, 372, 884, 244, 756, 500, 1012,
- 12, 524, 268, 780, 140, 652, 396, 908,
- 76, 588, 332, 844, 204, 716, 460, 972,
- 44, 556, 300, 812, 172, 684, 428, 940,
- 108, 620, 364, 876, 236, 748, 492, 1004,
- 28, 540, 284, 796, 156, 668, 412, 924,
- 92, 604, 348, 860, 220, 732, 476, 988,
- 60, 572, 316, 828, 188, 700, 444, 956,
- 124, 636, 380, 892, 252, 764, 508, 1020,
- 2, 514, 258, 770, 130, 642, 386, 898,
- 66, 578, 322, 834, 194, 706, 450, 962,
- 34, 546, 290, 802, 162, 674, 418, 930,
- 98, 610, 354, 866, 226, 738, 482, 994,
- 18, 530, 274, 786, 146, 658, 402, 914,
- 82, 594, 338, 850, 210, 722, 466, 978,
- 50, 562, 306, 818, 178, 690, 434, 946,
- 114, 626, 370, 882, 242, 754, 498, 1010,
- 10, 522, 266, 778, 138, 650, 394, 906,
- 74, 586, 330, 842, 202, 714, 458, 970,
- 42, 554, 298, 810, 170, 682, 426, 938,
- 106, 618, 362, 874, 234, 746, 490, 1002,
- 26, 538, 282, 794, 154, 666, 410, 922,
- 90, 602, 346, 858, 218, 730, 474, 986,
- 58, 570, 314, 826, 186, 698, 442, 954,
- 122, 634, 378, 890, 250, 762, 506, 1018,
- 6, 518, 262, 774, 134, 646, 390, 902,
- 70, 582, 326, 838, 198, 710, 454, 966,
- 38, 550, 294, 806, 166, 678, 422, 934,
- 102, 614, 358, 870, 230, 742, 486, 998,
- 22, 534, 278, 790, 150, 662, 406, 918,
- 86, 598, 342, 854, 214, 726, 470, 982,
- 54, 566, 310, 822, 182, 694, 438, 950,
- 118, 630, 374, 886, 246, 758, 502, 1014,
- 14, 526, 270, 782, 142, 654, 398, 910,
- 78, 590, 334, 846, 206, 718, 462, 974,
- 46, 558, 302, 814, 174, 686, 430, 942,
- 110, 622, 366, 878, 238, 750, 494, 1006,
- 30, 542, 286, 798, 158, 670, 414, 926,
- 94, 606, 350, 862, 222, 734, 478, 990,
- 62, 574, 318, 830, 190, 702, 446, 958,
- 126, 638, 382, 894, 254, 766, 510, 1022
-};
-
-const Word16 Gamma_19661_Tbl_fx[] = {
- 19661, 11797, 7078, 4247, 2548, 1529, 917, 550, 330, 198, 119, 71, 43, 26, 16, 10
-}; /*Q15 */
-
-const Word16 Gamma_29491_Tbl[] = {
- 29491, 26542, 23888, 21499, 19349, 17414, 15672, 14105,
- 12694, 11425, 10282, 9254, 8329, 7496, 6746, 6071
-}; // Q15
-
-/*---------------------------------------------------------------------*
- * NB post-filter tables
- *---------------------------------------------------------------------*/
-
-const Word16 tab_hup_s_fx[SIZ_TAB_HUP_S] = { // Q15
- -188, 2873, 31650, -1597, -484, 7041, 28469, -2147, -933, 12266,
- 23705, -1992, -1492, 18050, 18050, -1492, -1992, 23705, 12266, -933,
- -2147, 28469, 7041, -484, -1597, 31650, 2873, -188
-};
-
-const Word16 tab_hup_l_fx[SIZ_TAB_HUP_L] = { // Q15
- -40, 72, -156, 315, -579, 1023, -1874, 4439,
- 31915, -3390, 1595, -887, 501, -266, 130, -59,
- -77, 147, -317, 631, -1150, 2030, -3773, 9639,
- 29436, -5579, 2727, -1527, 859, -453, 218, -101,
- -106, 212, -455, 892, -1614, 2850, -5392, 15206,
- 25569, -6549, 3303, -1860, 1041, -543, 258, -122,
- -123, 253, -538, 1044, -1876, 3319, -6414, 20676,
- 20676, -6414, 3319, -1876, 1044, -538, 253, -123,
- -122, 258, -543, 1041, -1860, 3303, -6549, 25569,
- 15206, -5392, 2850, -1614, 892, -455, 212, -106,
- -101, 218, -453, 859, -1527, 2727, -5579, 29436,
- 9639, -3773, 2030, -1150, 631, -317, 147, -77,
- -59, 130, -266, 501, -887, 1595, -3390, 31915,
- 4439, -1874, 1023, -579, 315, -156, 72, -40
-};
-
-const Word16 mfreq_loc_Q2fx[] = { 700, 1500, 3100, 4700, 6300, 7900, 9500, 11100, 12700, 14300, 15900, 17500, 19100, 20700, 22300, 25500, 28700, 31900 }; // Q0
-const Word16 mfreq_loc_div_25[] = { 7, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 255, 287, 319 }; // Q0
-
-// low_rate_band_att_fx.c
-/* %* lowered Table ROM, call with band_len_idx[sfm_size>>3] */
-/* % sfms =[ 8, 16, 24, 32, 48, 64, 80, 96 ], */
-/* sfm/8= [ 1 2 3 4 6 8 10 12]; */
-/* % idx= 0 1 2 3 4 5 6 7; */
-/* call with band_len_idx[sfm_size>>3] */
-const Word16 band_len_idx[1 + ( MAX_SFM_LEN_FX / 8 )] = {
- // Q0
- /*sfm/8*/ /*1*/ /*2 */ /*3 */ /*4 */ /*6 */ /*8 */ /*10*/ /*12*/
- -1, 0 /*8*/, 1 /*16*/, 2 /*24*/, 3 /*32*/, -1, 4 /*48 */, -1, 5 /*64 */, -1, 6 /*80*/, -1, 7 /*96*/
-};
-const Word16 band_len_ener_shift[8] = { 1, 2, 2, 2, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; /* 96 requires 1 bit more than 48 */ // Q0
-/*% sfms=[8,16,24,32,48,64,80,96], round(sqrt(sfms)*2^11) */
-const Word16 fine_gain_pred_sqrt_bw[8] = { 5793, 8192, 10033, 11585, 14189, 16384, 18318, 20066 }; /* (Q11) */
-const Word16 ivas_band_len_idx[1 + ( MAX_SFM_LEN_FX / 8 )] = {
- /*sfm/8*/ /*1*/ /*2 */ /*3 */ /*4 */ /*6 */ /*8 */ /*10*/ /*12*/
- -1, 0 /*8*/, 1 /*16*/, 2 /*24*/, 3 /*32*/, 4 /*40*/, 5 /*48 */, -1, 6 /*64 */, -1, 7 /*80*/, -1, 8 /*96*/
-}; // Q0
-const Word16 ivas_band_len_ener_shift[9] = { 1, 2, 2, 2, 3, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; // Q0 /* 96 requires 1 bit more than 48 */
-const Word16 ivas_fine_gain_pred_sqrt_bw[9] = { 5793, 8192, 10033, 11585, 12953, 14189, 16384, 18318, 20066 }; /* (Q11) */
-/*% sfms=[8,16,24,32,40,48,64,80,96], round(sqrt(sfms)*2^11) */
-/*----------------------------------------------------------------------------------*
- * means of ISFs for WB active speech
- *----------------------------------------------------------------------------------*/
-const Word16 Mean_isf_wb[M] = /* G722.2 active speech ISF's means Q2.56*/
- {
- 738, 1326, 2336, 3578, 4596, 5662, 6711, 7730,
- 8750, 9753, 10705, 11728, 12833, 13971, 15043, 4037
- };
-
-const Word16 lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = {
- /*Q15 */
- 0,
- 1638,
- 3277,
- 4915,
- 6554,
- 8192,
- 9830,
- 11469,
- 13107,
- 14746
-};
-
-const Word16 lsp_shb_prev_tbl_swb_tbe_enc_fx[LPC_SHB_ORDER] = {
- // Q15
- 32767,
- 31165,
- 26509,
- 19262,
- 10123,
- 0,
- -10124,
- -19261,
- -26509,
- -31166,
-};
-
-const Word16 ivas_lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = {
- /* Q15 */
- 1489,
- 2979,
- 4468,
- 5958,
- 7447,
- 8937,
- 10426,
- 11916,
- 13405,
- 14895
-};
-
-/* These words are subtracted from high/low/value with a shift left by 1. */
-/* The value 0x0CCC should never be referenced, low is less/equal high */
-/* The value 0x0BBB should never be referenced, loop must break instead. */
-/* Refer to this table with indices: tab_ari_qnew[msb_high][msb_low] */
-const Word16 tab_ari_qnew[4][4] = { { 0x0000, 0x0CCC, 0x0CCC, 0x0CCC },
- { 0x0000, 0x0000, 0x0CCC, 0x0CCC },
- { 0x0BBB, 0x2000, 0x4000, 0x0CCC },
- { 0x0BBB, 0x0BBB, 0x4000, 0x4000 } };
-
-const Word16 phs_tbl_dec[64 * 2] = { // Q15
- /* part of table that is not scaled by 2 */
- 16384, 0, 16305, -1606, 16069, -3196, 15678, -4756, 15136, -6270,
- 14449, -7723, 13622, -9102, 12665, -10394, 11585, -11585, 10394, -12665,
- 9102, -13622, 7723, -14449, 6270, -15136, 4756, -15678, 3196, -16069,
- 1606, -16305, 0, -16384, -1606, -16305, -3196, -16069, -4756, -15678,
- -6270, -15136, -7723, -14449, -9102, -13622, -10394, -12665, -11585, -11585,
- -12665, -10394, -13622, -9102, -14449, -7723, -15136, -6270, -15678, -4756,
- -16069, -3196, -16305, -1606,
- /* part of table that is scaled by 2 (this save one operation in FFT inner loops) */
- 32767, 0, 32610, -3212, 32138, -6392, 31356, -9512, 30272, -12540,
- 28898, -15446, 27244, -18204, 25330, -20788, 23170, -23170, 20788, -25330,
- 18204, -27244, 15446, -28898, 12540, -30272, 9512, -31356, 6392, -32138,
- 3212, -32610, 0, -32768, -3212, -32610, -6392, -32138, -9512, -31356,
- -12540, -30272, -15446, -28898, -18204, -27244, -20788, -25330, -23170, -23170,
- -25330, -20788, -27244, -18204, -28898, -15446, -30272, -12540, -31356, -9512,
- -32138, -6392, -32610, -3212
-};
-
-/* 2.0 - 6.4 kHz phase dispersion */
-const Word16 Low_H_phasedisp[L_SUBFR] = { // Q15
- 16389, 16381, 16386, 16382, 16382, 16383, 16381, 16384, 16385, 10265,
- 10154, 9894, 14052, 16343, -531, 13216, 16373, 15510, 9407, 15949,
- 4726, 14593, 10404, 9796, -16336, -1815, -10623, 12647, 14556, -12683,
- 11389, 8176, 16382, -14197, 11781, 10379, 7516, 10424, -12472, 16285,
- -1200, -13137, 12659, -7446, 15684, -3763, -13418, -5280, 521, -9685,
- -16375, -1219, 8436, -13059, -12861, -12775, 0, 3, 0, -2,
- -1, -1, -1, 2
-};
-
-/* 3.2 - 6.4 kHz phase dispersion */
-const Word16 Mid_H_phasedisp[L_SUBFR] = { // Q15
- 16382, 16382, 16384, 16385, 16386, 16388, 16387, 16383, 16387, 16383,
- 16386, 16386, 16386, 16384, 16382, 16388, 14847, 9629, 13249, 14487,
- 10995, 643, 13818, 13779, 6468, 8665, 11634, 9781, -14636, -982,
- 11746, -722, 16386, -16365, -11422, 16354, 7363, 13148, -11538, -13903,
- -15051, -8862, 8812, -16371, -12146, 7661, -9637, -13253, -6922, 4,
- -4, -1, -5, 1, 7, 6, -7, -1, 4, -4,
- 0, -1, -3, 3
-};
-
-// ACcontextMapping_dec_fx.c
-const Word16 Tab_esc_nb[4] = { 0 << ( NBITS_CONTEXT + NBITS_RATEQ ),
- 1 << ( NBITS_CONTEXT + NBITS_RATEQ ),
- 2 << ( NBITS_CONTEXT + NBITS_RATEQ ),
- 3 << ( NBITS_CONTEXT + NBITS_RATEQ ) }; // Q0
-
-const Word16 pow2tab[15] = { 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; // Q0
-const Word32 pow2[] = { // Q0
- 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576
-};
-// d_gain2p.c
-const Word16 Es_pred_qua[8] = {
- 1521 /* 5.9422f Q8*/,
- 3909 /*15.2711f Q8*/,
- 5987 /*23.3857f Q8*/,
- 7816 /*30.5310f Q8*/,
- 9477 /*37.0190f Q8*/,
- 11124 /*43.4539f Q8*/,
- 12863 /*50.2442f Q8*/,
- 15031 /*58.7164f Q8*/
-};
-
-const Word16 Es_pred_qua_2[16] = {
- -1280 /*-5.f Q8*/,
- 0 /* 0.f Q8*/,
- 1280 /* 5.f Q8*/,
- 2560 /*10.f Q8*/,
- 3840 /*15.f Q8*/,
- 5120 /*20.f Q8*/,
- 6400 /*25.f Q8*/,
- 7680 /*30.f Q8*/,
- 8960 /*35.f Q8*/,
- 10240 /*40.f Q8*/,
- 11520 /*45.f Q8*/,
- 12800 /*50.f Q8*/,
- 14080 /*55.f Q8*/,
- 15360 /*60.f Q8*/,
- 16640 /*65.f Q8*/,
- 17920 /*70.f Q8*/
-};
-const Word16 T_DIV_L_Frame[] = /*0Q15 * 2^-7 */
- {
- 26214 /*160*/
- ,
- 16384 /*256*/
- ,
- 13107 /*320*/
- ,
- 8738 /*480*/
- ,
- 8192 /*512*/
- ,
- 6553 /*640*/
- };
-
-/* order 8 LPF for nelp frames when non-native sampling freq inputs used with -max_band NB */
-/* used to suppress frequencies above 4kHz present at the output of filters in pre_proc() */
-
-const Word16 num_nelp_lp_fx[NELP_LP_ORDER + 1] = /*Q13*/
- {
- 727,
- 3506,
- 8988,
- 15029,
- 17732,
- 15022,
- 8979,
- 3501,
- 726
- };
-
-const Word16 den_nelp_lp_fx[NELP_LP_ORDER + 1] = { // Q13
- 8192,
- 8819,
- 21618,
- 12167,
- 15902,
- 3553,
- 3998,
- -120,
- 353
-};
-
-/*----------------------------------------------------------------------------------*
- * AMR-WB IO WB BWE - band-pass 6-8kHz FIR filter, values in Q15:
- *----------------------------------------------------------------------------------*/
-const Word16 fir_6k_8k_fx[31] = { // Q15
- 44, -155, 323, -482, 563, -590, 726, -1180, 1986, -2818, 3028,
- -1991, -423, 3583, -6281, 7342, -6281, 3583, -423, -1991, 3028,
- -2818, 1986, -1180, 726, -590, 563, -482, 323, -155, 44
-};
-
-const Word16 pwf78_fx[17] = { 25559, 19936, 15550, 12129, 9460, 7379, 5755, 4489,
- 3501, 2731, 2130, 1661, 1296, 1011, 788, 615,
- 479 }; /* 0.78^i (i=1,...,17), Q15 */
-
-/*------------------------------------------------------------------------------*
- * lag window for windowing the autocorrelations in LP analysis
- * Used in lib_enc\analy_lp_fx.c
- *------------------------------------------------------------------------------*/
-const Word16 hamcos_window_fx[L_LP_AMR_WB] = { // Q15
- 2621, 2622, 2626, 2632, 2640, 2650, 2662, 2677,
- 2694, 2714, 2735, 2759, 2785, 2814, 2844, 2877,
- 2912, 2949, 2989, 3031, 3075, 3121, 3169, 3220,
- 3273, 3328, 3385, 3444, 3506, 3569, 3635, 3703,
- 3773, 3845, 3919, 3996, 4074, 4155, 4237, 4321,
- 4408, 4496, 4587, 4680, 4774, 4870, 4969, 5069,
- 5171, 5275, 5381, 5489, 5599, 5710, 5824, 5939,
- 6056, 6174, 6295, 6417, 6541, 6666, 6793, 6922,
- 7052, 7185, 7318, 7453, 7590, 7728, 7868, 8009,
- 8152, 8296, 8442, 8589, 8737, 8887, 9038, 9191,
- 9344, 9499, 9655, 9813, 9971, 10131, 10292, 10454,
- 10617, 10781, 10946, 11113, 11280, 11448, 11617, 11787,
- 11958, 12130, 12303, 12476, 12650, 12825, 13001, 13178,
- 13355, 13533, 13711, 13890, 14070, 14250, 14431, 14612,
- 14793, 14975, 15158, 15341, 15524, 15708, 15891, 16076,
- 16260, 16445, 16629, 16814, 16999, 17185, 17370, 17555,
- 17740, 17926, 18111, 18296, 18481, 18666, 18851, 19036,
- 19221, 19405, 19589, 19773, 19956, 20139, 20322, 20504,
- 20686, 20867, 21048, 21229, 21408, 21588, 21767, 21945,
- 22122, 22299, 22475, 22651, 22825, 22999, 23172, 23344,
- 23516, 23686, 23856, 24025, 24192, 24359, 24525, 24689,
- 24853, 25016, 25177, 25337, 25496, 25654, 25811, 25967,
- 26121, 26274, 26426, 26576, 26725, 26873, 27019, 27164,
- 27308, 27450, 27590, 27729, 27867, 28003, 28137, 28270,
- 28401, 28531, 28659, 28785, 28910, 29033, 29154, 29274,
- 29391, 29507, 29622, 29734, 29845, 29953, 30060, 30165,
- 30268, 30370, 30469, 30566, 30662, 30755, 30847, 30936,
- 31024, 31109, 31193, 31274, 31354, 31431, 31506, 31579,
- 31651, 31719, 31786, 31851, 31914, 31974, 32032, 32088,
- 32142, 32194, 32243, 32291, 32336, 32379, 32419, 32458,
- 32494, 32528, 32560, 32589, 32617, 32642, 32664, 32685,
- 32703, 32719, 32733, 32744, 32753, 32760, 32764, 32767,
- 32767, 32765, 32757, 32745, 32727, 32705, 32678, 32646,
- 32609, 32567, 32520, 32468, 32411, 32349, 32283, 32211,
- 32135, 32054, 31968, 31877, 31781, 31681, 31575, 31465,
- 31351, 31231, 31107, 30978, 30844, 30706, 30563, 30415,
- 30263, 30106, 29945, 29779, 29609, 29434, 29255, 29071,
- 28883, 28691, 28494, 28293, 28087, 27878, 27664, 27446,
- 27224, 26997, 26767, 26533, 26294, 26052, 25806, 25555,
- 25301, 25043, 24782, 24516, 24247, 23974, 23698, 23418,
- 23134, 22847, 22557, 22263, 21965, 21665, 21361, 21054,
- 20743, 20430, 20113, 19794, 19471, 19146, 18817, 18486,
- 18152, 17815, 17476, 17134, 16789, 16442, 16092, 15740,
- 15385, 15028, 14669, 14308, 13944, 13579, 13211, 12841,
- 12470, 12096, 11721, 11344, 10965, 10584, 10202, 9819,
- 9433, 9047, 8659, 8270, 7879, 7488, 7095, 6701,
- 6306, 5910, 5514, 5116, 4718, 4319, 3919, 3519,
- 3118, 2716, 2315, 1913, 1510, 1108, 705, 302
-};
-
-
-const Word16 CNG_burst_att_fx[6][8] = { // Q15
- { 30076, 27793, 25832, 24129, 22637, 21319, 20146, 19095 },
- { 29714, 27181, 25046, 23222, 21646, 20270, 20205, 20205 },
- { 29415, 26685, 24418, 22506, 22410, 22410, 22410, 22410 },
- { 29310, 26512, 24201, 23198, 23198, 23198, 23198, 23198 },
- { 29310, 26512, 24201, 23198, 23198, 23198, 23198, 23198 },
- { 29789, 27307, 25206, 23406, 21845, 20480, 19661, 19661 }
-};
-
-const Word16 lpc_weights_fx[LPC_SHB_ORDER + 1] = { // Q15
- 32767, 31948, 31150, 30371, 29612,
- 28871, 28149, 27446, 26760, 26091, 25438
-};
-
-const Word16 SHBCB_SubGain5bit_12_fx[128] = {
- /*Q12 */
- -597,
- -1952,
- -1644,
- -1506,
- -1767,
- -1357,
- -1249,
- -874,
- -4181,
- -3836,
- -240,
- -1985,
- -6573,
- -1480,
- -1229,
- -1094,
- -381,
- -1655,
- -2119,
- -2406,
- -2012,
- -1022,
- -2235,
- -761,
- -908,
- -1282,
- -1241,
- -1845,
- -68,
- -4666,
- -6058,
- -6355,
- -2311,
- -1888,
- -1396,
- -513,
- -523,
- -1155,
- -2300,
- -3657,
- -1161,
- -549,
- -2564,
- -2424,
- -609,
- -2346,
- -2934,
- -1142,
- -3591,
- -2859,
- -2063,
- -205,
- -4048,
- -4083,
- -4261,
- -56,
- -1352,
- -2147,
- -1894,
- -574,
- -6577,
- -5483,
- -1881,
- -628,
- -815,
- -1061,
- -1987,
- -1654,
- -455,
- -1380,
- -3818,
- -4941,
- -926,
- -934,
- -1463,
- -2630,
- -2520,
- -1013,
- -1016,
- -1250,
- -977,
- -2477,
- -720,
- -2401,
- -130,
- -2789,
- -3155,
- -3192,
- -1135,
- -1287,
- -1552,
- -1115,
- -1217,
- -1918,
- -1059,
- -1102,
- -2291,
- -3353,
- -744,
- -979,
- -3067,
- -1892,
- -961,
- -707,
- -1795,
- -1229,
- -652,
- -2348,
- -1569,
- -717,
- -1490,
- -1628,
- -3240,
- -258,
- -2129,
- -2748,
- -2062,
- -1902,
- -625,
- -1257,
- -1453,
- -1250,
- -965,
- -1445,
- -4227,
- -1494,
- -1108,
- -819,
-
-
-};
-
-
-const Word16 E_ROM_inter4_1_fx[UP_SAMP * L_INTERPOL1 + 1] = {
- /* cut-off frequency at 0.9*fs/2 */
- 14746 /*0.900000F Q14*/,
- 13418 /*0.818959F Q14*/, 9910 /*0.604850F Q14*/, 5429 /*0.331379F Q14*/, 1376 /*0.083958F Q14*/,
- -1242 /*-0.075795F Q14*/, -2142 /*-0.130717F Q14*/, -1732 /*-0.105685F Q14*/, -766 /*-0.046774F Q14*/,
- 73 /*0.004467F Q14*/, 455 /*0.027789F Q14*/, 420 /*0.025642F Q14*/, 206 /*0.012571F Q14*/,
- 32 /*0.001927F Q14*/, -26 /*-0.001571F Q14*/, -12 /*-0.000753F Q14*/, 0 /*0.000000f Q14*/
-};
-const Word16 E_ROM_inter6_1_fx[PIT_UP_SAMP6 * L_INTERPOL1 + 1] = {
- 14759 /*0.900848F Q14*/,
- 14158 /*0.864136F Q14*/,
- 12453 /*0.760071F Q14*/,
- 9919 /*0.605408F Q14*/,
- 6948 /*0.424072F Q14*/,
- 3972 /*0.242462F Q14*/,
- 1377 /*0.0840759F Q14*/,
- -563 /*-0.0343933F Q14*/,
- -1729 /*-0.105560F Q14*/,
- -2152 /*-0.131348F Q14*/,
- -1984 /*-0.121124F Q14*/,
- -1450 /*-0.0884705F Q14*/,
- -780 /*-0.0476379F Q14*/,
- -168 /*-0.0102539F Q14*/,
- 267 /*0.0162964F Q14*/,
- 485 /*0.0296021F Q14*/,
- 512 /*0.0312195F Q14*/,
- 412 /*0.0251160F Q14*/,
- 258 /*0.0157471F Q14*/,
- 110 /*0.00671387F Q14*/,
- 0 /*0.000000F Q14*/,
- -65 /*-0.00399780F Q14*/,
- -97 /*-0.00592041F Q14*/,
- -108 /*-0.00656128F Q14*/,
- 0 /*0.000000F Q14*/
-};
-const Word16 kLog2TableFrac_x[256] = { // Q8
- 0, 1, 3, 4, 6, 7, 9, 10,
- 11, 13, 14, 16, 17, 18, 20, 21,
- 22, 24, 25, 26, 28, 29, 30, 32,
- 33, 34, 36, 37, 38, 40, 41, 42,
- 44, 45, 46, 47, 49, 50, 51, 52,
- 54, 55, 56, 57, 59, 60, 61, 62,
- 63, 65, 66, 67, 68, 69, 71, 72,
- 73, 74, 75, 77, 78, 79, 80, 81,
- 82, 84, 85, 86, 87, 88, 89, 90,
- 92, 93, 94, 95, 96, 97, 98, 99,
- 100, 102, 103, 104, 105, 106, 107, 108,
- 109, 110, 111, 112, 113, 114, 116, 117,
- 118, 119, 120, 121, 122, 123, 124, 125,
- 126, 127, 128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139, 140, 141,
- 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 151, 152, 153, 154, 155, 155, 156,
- 157, 158, 159, 160, 161, 162, 163, 164,
- 165, 166, 167, 168, 169, 169, 170, 171,
- 172, 173, 174, 175, 176, 177, 178, 178,
- 179, 180, 181, 182, 183, 184, 185, 185,
- 186, 187, 188, 189, 190, 191, 192, 192,
- 193, 194, 195, 196, 197, 198, 198, 199,
- 200, 201, 202, 203, 203, 204, 205, 206,
- 207, 208, 208, 209, 210, 211, 212, 212,
- 213, 214, 215, 216, 216, 217, 218, 219,
- 220, 220, 221, 222, 223, 224, 224, 225,
- 226, 227, 228, 228, 229, 230, 231, 231,
- 232, 233, 234, 234, 235, 236, 237, 238,
- 238, 239, 240, 241, 241, 242, 243, 244,
- 244, 245, 246, 247, 247, 248, 249, 249,
- 250, 251, 252, 252, 253, 254, 255, 255
-};
-
-const Word16 kExp2TableFrac_x[256] = /* Q15 */
- {
- 32767, 32678, 32590, 32502, 32414, 32326, 32239, 32152,
- 32065, 31978, 31892, 31805, 31719, 31634, 31548, 31463,
- 31378, 31293, 31208, 31124, 31040, 30956, 30872, 30789,
- 30705, 30622, 30540, 30457, 30375, 30293, 30211, 30129,
- 30047, 29966, 29885, 29804, 29724, 29643, 29563, 29483,
- 29404, 29324, 29245, 29166, 29087, 29008, 28930, 28852,
- 28774, 28696, 28618, 28541, 28464, 28387, 28310, 28233,
- 28157, 28081, 28005, 27929, 27854, 27778, 27703, 27628,
- 27554, 27479, 27405, 27331, 27257, 27183, 27110, 27036,
- 26963, 26890, 26818, 26745, 26673, 26601, 26529, 26457,
- 26385, 26314, 26243, 26172, 26101, 26031, 25960, 25890,
- 25820, 25750, 25681, 25611, 25542, 25473, 25404, 25335,
- 25267, 25198, 25130, 25062, 24995, 24927, 24860, 24792,
- 24725, 24659, 24592, 24525, 24459, 24393, 24327, 24261,
- 24196, 24130, 24065, 24000, 23935, 23870, 23806, 23741,
- 23677, 23613, 23549, 23486, 23422, 23359, 23296, 23233,
- 23170, 23107, 23045, 22982, 22920, 22858, 22796, 22735,
- 22673, 22612, 22551, 22490, 22429, 22368, 22308, 22248,
- 22187, 22127, 22068, 22008, 21948, 21889, 21830, 21771,
- 21712, 21653, 21595, 21536, 21478, 21420, 21362, 21304,
- 21247, 21189, 21132, 21075, 21018, 20961, 20904, 20848,
- 20791, 20735, 20679, 20623, 20568, 20512, 20456, 20401,
- 20346, 20291, 20236, 20181, 20127, 20072, 20018, 19964,
- 19910, 19856, 19802, 19749, 19696, 19642, 19589, 19536,
- 19483, 19431, 19378, 19326, 19274, 19221, 19169, 19118,
- 19066, 19014, 18963, 18912, 18861, 18810, 18759, 18708,
- 18657, 18607, 18557, 18506, 18456, 18406, 18357, 18307,
- 18258, 18208, 18159, 18110, 18061, 18012, 17963, 17915,
- 17866, 17818, 17770, 17722, 17674, 17626, 17578, 17531,
- 17483, 17436, 17389, 17342, 17295, 17248, 17202, 17155,
- 17109, 17063, 17016, 16970, 16925, 16879, 16833, 16788,
- 16742, 16697, 16652, 16607, 16562, 16517, 16472, 16428
- };
-
-/*-------------------------------------------------------------------*
- * inverse (reciprocal) of integer, used in FEC_fx.c, pitch_extr and in pitchDoubling_det
- * 1/n = One_div[n-1]
- *-------------------------------------------------------------------*/
-const Word16 One_div_fx[] = /* in Q15 */
- {
- 32767, /* 1/1 */
- 16384, /* 1/2 */
- 10923, /* 1/3 */
- 8192, /* 1/4 */
- 6554, /* 1/5 */
- 5461, /* 1/6 */
- 4681, /* 1/7 */
- 4096 /* 1/8 */
- };
-
-const Word32 tbl_two_pow_shift_by_4[35] = { // Q30
- 1073741824, 902905664, 759250112, 638450688, 536870912, 451452832, 379625056, 319225344,
- 268435456, 225726416, 189812528, 159612672, 134217728, 112863208, 94906264, 79806336,
- 67108864, 56431604, 47453132, 39903168, 33554432, 28215802, 23726566, 19951584,
- 16777216, 14107901, 11863283, 9975792, 8388608, 7053950, 5931641, 4987896,
- 4194304, 3526975, 2965820
-};
-
-
-const Word16 ivas_tan_panning_gain_tbl_fx[601] = { // Q15
- SHC( 0x0000 ), SHC( 0x0042 ), SHC( 0x0084 ), SHC( 0x00c6 ), SHC( 0x0109 ), SHC( 0x014b ), SHC( 0x018e ), SHC( 0x01d1 ),
- SHC( 0x0214 ), SHC( 0x0257 ), SHC( 0x029b ), SHC( 0x02de ), SHC( 0x0322 ), SHC( 0x0365 ), SHC( 0x03a9 ), SHC( 0x03ed ),
- SHC( 0x0431 ), SHC( 0x0475 ), SHC( 0x04ba ), SHC( 0x04fe ), SHC( 0x0543 ), SHC( 0x0588 ), SHC( 0x05cd ), SHC( 0x0612 ),
- SHC( 0x0657 ), SHC( 0x069c ), SHC( 0x06e1 ), SHC( 0x0727 ), SHC( 0x076d ), SHC( 0x07b2 ), SHC( 0x07f8 ), SHC( 0x083e ),
- SHC( 0x0885 ), SHC( 0x08cb ), SHC( 0x0911 ), SHC( 0x0958 ), SHC( 0x099f ), SHC( 0x09e6 ), SHC( 0x0a2d ), SHC( 0x0a74 ),
- SHC( 0x0abb ), SHC( 0x0b02 ), SHC( 0x0b4a ), SHC( 0x0b91 ), SHC( 0x0bd9 ), SHC( 0x0c21 ), SHC( 0x0c69 ), SHC( 0x0cb1 ),
- SHC( 0x0cf9 ), SHC( 0x0d42 ), SHC( 0x0d8a ), SHC( 0x0dd3 ), SHC( 0x0e1c ), SHC( 0x0e65 ), SHC( 0x0eae ), SHC( 0x0ef7 ),
- SHC( 0x0f40 ), SHC( 0x0f89 ), SHC( 0x0fd3 ), SHC( 0x101d ), SHC( 0x1066 ), SHC( 0x10b0 ), SHC( 0x10fa ), SHC( 0x1144 ),
- SHC( 0x118f ), SHC( 0x11d9 ), SHC( 0x1223 ), SHC( 0x126e ), SHC( 0x12b9 ), SHC( 0x1304 ), SHC( 0x134f ), SHC( 0x139a ),
- SHC( 0x13e5 ), SHC( 0x1430 ), SHC( 0x147c ), SHC( 0x14c7 ), SHC( 0x1513 ), SHC( 0x155f ), SHC( 0x15aa ), SHC( 0x15f6 ),
- SHC( 0x1643 ), SHC( 0x168f ), SHC( 0x16db ), SHC( 0x1728 ), SHC( 0x1774 ), SHC( 0x17c1 ), SHC( 0x180e ), SHC( 0x185a ),
- SHC( 0x18a7 ), SHC( 0x18f5 ), SHC( 0x1942 ), SHC( 0x198f ), SHC( 0x19dd ), SHC( 0x1a2a ), SHC( 0x1a78 ), SHC( 0x1ac5 ),
- SHC( 0x1b13 ), SHC( 0x1b61 ), SHC( 0x1baf ), SHC( 0x1bfd ), SHC( 0x1c4c ), SHC( 0x1c9a ), SHC( 0x1ce8 ), SHC( 0x1d37 ),
- SHC( 0x1d86 ), SHC( 0x1dd4 ), SHC( 0x1e23 ), SHC( 0x1e72 ), SHC( 0x1ec1 ), SHC( 0x1f10 ), SHC( 0x1f5f ), SHC( 0x1faf ),
- SHC( 0x1ffe ), SHC( 0x204d ), SHC( 0x209d ), SHC( 0x20ed ), SHC( 0x213c ), SHC( 0x218c ), SHC( 0x21dc ), SHC( 0x222c ),
- SHC( 0x227c ), SHC( 0x22cc ), SHC( 0x231c ), SHC( 0x236d ), SHC( 0x23bd ), SHC( 0x240e ), SHC( 0x245e ), SHC( 0x24af ),
- SHC( 0x24ff ), SHC( 0x2550 ), SHC( 0x25a1 ), SHC( 0x25f2 ), SHC( 0x2643 ), SHC( 0x2694 ), SHC( 0x26e5 ), SHC( 0x2736 ),
- SHC( 0x2787 ), SHC( 0x27d9 ), SHC( 0x282a ), SHC( 0x287b ), SHC( 0x28cd ), SHC( 0x291e ), SHC( 0x2970 ), SHC( 0x29c2 ),
- SHC( 0x2a13 ), SHC( 0x2a65 ), SHC( 0x2ab7 ), SHC( 0x2b09 ), SHC( 0x2b5b ), SHC( 0x2bad ), SHC( 0x2bff ), SHC( 0x2c51 ),
- SHC( 0x2ca3 ), SHC( 0x2cf5 ), SHC( 0x2d47 ), SHC( 0x2d99 ), SHC( 0x2dec ), SHC( 0x2e3e ), SHC( 0x2e90 ), SHC( 0x2ee3 ),
- SHC( 0x2f35 ), SHC( 0x2f87 ), SHC( 0x2fda ), SHC( 0x302c ), SHC( 0x307f ), SHC( 0x30d2 ), SHC( 0x3124 ), SHC( 0x3177 ),
- SHC( 0x31c9 ), SHC( 0x321c ), SHC( 0x326f ), SHC( 0x32c1 ), SHC( 0x3314 ), SHC( 0x3367 ), SHC( 0x33ba ), SHC( 0x340c ),
- SHC( 0x345f ), SHC( 0x34b2 ), SHC( 0x3505 ), SHC( 0x3557 ), SHC( 0x35aa ), SHC( 0x35fd ), SHC( 0x3650 ), SHC( 0x36a2 ),
- SHC( 0x36f5 ), SHC( 0x3748 ), SHC( 0x379b ), SHC( 0x37ed ), SHC( 0x3840 ), SHC( 0x3893 ), SHC( 0x38e6 ), SHC( 0x3938 ),
- SHC( 0x398b ), SHC( 0x39de ), SHC( 0x3a30 ), SHC( 0x3a83 ), SHC( 0x3ad6 ), SHC( 0x3b28 ), SHC( 0x3b7b ), SHC( 0x3bcd ),
- SHC( 0x3c20 ), SHC( 0x3c72 ), SHC( 0x3cc5 ), SHC( 0x3d17 ), SHC( 0x3d69 ), SHC( 0x3dbc ), SHC( 0x3e0e ), SHC( 0x3e60 ),
- SHC( 0x3eb2 ), SHC( 0x3f04 ), SHC( 0x3f57 ), SHC( 0x3fa9 ), SHC( 0x3ffb ), SHC( 0x404c ), SHC( 0x409e ), SHC( 0x40f0 ),
- SHC( 0x4142 ), SHC( 0x4194 ), SHC( 0x41e5 ), SHC( 0x4237 ), SHC( 0x4288 ), SHC( 0x42da ), SHC( 0x432b ), SHC( 0x437c ),
- SHC( 0x43ce ), SHC( 0x441f ), SHC( 0x4470 ), SHC( 0x44c1 ), SHC( 0x4512 ), SHC( 0x4563 ), SHC( 0x45b3 ), SHC( 0x4604 ),
- SHC( 0x4654 ), SHC( 0x46a5 ), SHC( 0x46f5 ), SHC( 0x4746 ), SHC( 0x4796 ), SHC( 0x47e6 ), SHC( 0x4836 ), SHC( 0x4886 ),
- SHC( 0x48d5 ), SHC( 0x4925 ), SHC( 0x4975 ), SHC( 0x49c4 ), SHC( 0x4a13 ), SHC( 0x4a63 ), SHC( 0x4ab2 ), SHC( 0x4b01 ),
- SHC( 0x4b50 ), SHC( 0x4b9e ), SHC( 0x4bed ), SHC( 0x4c3b ), SHC( 0x4c8a ), SHC( 0x4cd8 ), SHC( 0x4d26 ), SHC( 0x4d74 ),
- SHC( 0x4dc2 ), SHC( 0x4e10 ), SHC( 0x4e5d ), SHC( 0x4eab ), SHC( 0x4ef8 ), SHC( 0x4f45 ), SHC( 0x4f92 ), SHC( 0x4fdf ),
- SHC( 0x502c ), SHC( 0x5078 ), SHC( 0x50c4 ), SHC( 0x5111 ), SHC( 0x515d ), SHC( 0x51a9 ), SHC( 0x51f4 ), SHC( 0x5240 ),
- SHC( 0x528b ), SHC( 0x52d7 ), SHC( 0x5322 ), SHC( 0x536d ), SHC( 0x53b8 ), SHC( 0x5402 ), SHC( 0x544d ), SHC( 0x5497 ),
- SHC( 0x54e1 ), SHC( 0x552b ), SHC( 0x5574 ), SHC( 0x55be ), SHC( 0x5607 ), SHC( 0x5650 ), SHC( 0x5699 ), SHC( 0x56e2 ),
- SHC( 0x572b ), SHC( 0x5773 ), SHC( 0x57bb ), SHC( 0x5803 ), SHC( 0x584b ), SHC( 0x5893 ), SHC( 0x58da ), SHC( 0x5921 ),
- SHC( 0x5968 ), SHC( 0x59af ), SHC( 0x59f5 ), SHC( 0x5a3c ), SHC( 0x5a82 ), SHC( 0x5ac8 ), SHC( 0x5b0e ), SHC( 0x5b53 ),
- SHC( 0x5b98 ), SHC( 0x5bde ), SHC( 0x5c22 ), SHC( 0x5c67 ), SHC( 0x5cab ), SHC( 0x5cf0 ), SHC( 0x5d34 ), SHC( 0x5d77 ),
- SHC( 0x5dbb ), SHC( 0x5dfe ), SHC( 0x5e41 ), SHC( 0x5e84 ), SHC( 0x5ec7 ), SHC( 0x5f09 ), SHC( 0x5f4b ), SHC( 0x5f8d ),
- SHC( 0x5fcf ), SHC( 0x6010 ), SHC( 0x6051 ), SHC( 0x6092 ), SHC( 0x60d3 ), SHC( 0x6113 ), SHC( 0x6153 ), SHC( 0x6193 ),
- SHC( 0x61d3 ), SHC( 0x6213 ), SHC( 0x6252 ), SHC( 0x6291 ), SHC( 0x62cf ), SHC( 0x630e ), SHC( 0x634c ), SHC( 0x638a ),
- SHC( 0x63c8 ), SHC( 0x6405 ), SHC( 0x6442 ), SHC( 0x647f ), SHC( 0x64bc ), SHC( 0x64f8 ), SHC( 0x6534 ), SHC( 0x6570 ),
- SHC( 0x65ac ), SHC( 0x65e7 ), SHC( 0x6622 ), SHC( 0x665d ), SHC( 0x6698 ), SHC( 0x66d2 ), SHC( 0x670c ), SHC( 0x6746 ),
- SHC( 0x677f ), SHC( 0x67b8 ), SHC( 0x67f1 ), SHC( 0x682a ), SHC( 0x6862 ), SHC( 0x689a ), SHC( 0x68d2 ), SHC( 0x690a ),
- SHC( 0x6941 ), SHC( 0x6978 ), SHC( 0x69af ), SHC( 0x69e5 ), SHC( 0x6a1c ), SHC( 0x6a52 ), SHC( 0x6a87 ), SHC( 0x6abd ),
- SHC( 0x6af2 ), SHC( 0x6b26 ), SHC( 0x6b5b ), SHC( 0x6b8f ), SHC( 0x6bc3 ), SHC( 0x6bf7 ), SHC( 0x6c2a ), SHC( 0x6c5d ),
- SHC( 0x6c90 ), SHC( 0x6cc3 ), SHC( 0x6cf5 ), SHC( 0x6d27 ), SHC( 0x6d59 ), SHC( 0x6d8a ), SHC( 0x6dbb ), SHC( 0x6dec ),
- SHC( 0x6e1d ), SHC( 0x6e4d ), SHC( 0x6e7d ), SHC( 0x6ead ), SHC( 0x6edc ), SHC( 0x6f0b ), SHC( 0x6f3a ), SHC( 0x6f69 ),
- SHC( 0x6f97 ), SHC( 0x6fc5 ), SHC( 0x6ff3 ), SHC( 0x7020 ), SHC( 0x704e ), SHC( 0x707a ), SHC( 0x70a7 ), SHC( 0x70d3 ),
- SHC( 0x70ff ), SHC( 0x712b ), SHC( 0x7157 ), SHC( 0x7182 ), SHC( 0x71ad ), SHC( 0x71d7 ), SHC( 0x7202 ), SHC( 0x722c ),
- SHC( 0x7255 ), SHC( 0x727f ), SHC( 0x72a8 ), SHC( 0x72d1 ), SHC( 0x72fa ), SHC( 0x7322 ), SHC( 0x734a ), SHC( 0x7372 ),
- SHC( 0x7399 ), SHC( 0x73c0 ), SHC( 0x73e7 ), SHC( 0x740e ), SHC( 0x7434 ), SHC( 0x745a ), SHC( 0x7480 ), SHC( 0x74a6 ),
- SHC( 0x74cb ), SHC( 0x74f0 ), SHC( 0x7515 ), SHC( 0x7539 ), SHC( 0x755d ), SHC( 0x7581 ), SHC( 0x75a5 ), SHC( 0x75c8 ),
- SHC( 0x75eb ), SHC( 0x760e ), SHC( 0x7630 ), SHC( 0x7652 ), SHC( 0x7674 ), SHC( 0x7696 ), SHC( 0x76b7 ), SHC( 0x76d9 ),
- SHC( 0x76f9 ), SHC( 0x771a ), SHC( 0x773a ), SHC( 0x775a ), SHC( 0x777a ), SHC( 0x779a ), SHC( 0x77b9 ), SHC( 0x77d8 ),
- SHC( 0x77f6 ), SHC( 0x7815 ), SHC( 0x7833 ), SHC( 0x7851 ), SHC( 0x786e ), SHC( 0x788c ), SHC( 0x78a9 ), SHC( 0x78c6 ),
- SHC( 0x78e2 ), SHC( 0x78ff ), SHC( 0x791b ), SHC( 0x7937 ), SHC( 0x7952 ), SHC( 0x796d ), SHC( 0x7988 ), SHC( 0x79a3 ),
- SHC( 0x79be ), SHC( 0x79d8 ), SHC( 0x79f2 ), SHC( 0x7a0c ), SHC( 0x7a25 ), SHC( 0x7a3e ), SHC( 0x7a57 ), SHC( 0x7a70 ),
- SHC( 0x7a89 ), SHC( 0x7aa1 ), SHC( 0x7ab9 ), SHC( 0x7ad1 ), SHC( 0x7ae8 ), SHC( 0x7aff ), SHC( 0x7b16 ), SHC( 0x7b2d ),
- SHC( 0x7b44 ), SHC( 0x7b5a ), SHC( 0x7b70 ), SHC( 0x7b86 ), SHC( 0x7b9b ), SHC( 0x7bb1 ), SHC( 0x7bc6 ), SHC( 0x7bdb ),
- SHC( 0x7bef ), SHC( 0x7c04 ), SHC( 0x7c18 ), SHC( 0x7c2c ), SHC( 0x7c40 ), SHC( 0x7c53 ), SHC( 0x7c66 ), SHC( 0x7c79 ),
- SHC( 0x7c8c ), SHC( 0x7c9e ), SHC( 0x7cb1 ), SHC( 0x7cc3 ), SHC( 0x7cd5 ), SHC( 0x7ce6 ), SHC( 0x7cf8 ), SHC( 0x7d09 ),
- SHC( 0x7d1a ), SHC( 0x7d2b ), SHC( 0x7d3b ), SHC( 0x7d4c ), SHC( 0x7d5c ), SHC( 0x7d6b ), SHC( 0x7d7b ), SHC( 0x7d8b ),
- SHC( 0x7d9a ), SHC( 0x7da9 ), SHC( 0x7db8 ), SHC( 0x7dc6 ), SHC( 0x7dd5 ), SHC( 0x7de3 ), SHC( 0x7df1 ), SHC( 0x7dff ),
- SHC( 0x7e0c ), SHC( 0x7e19 ), SHC( 0x7e27 ), SHC( 0x7e34 ), SHC( 0x7e40 ), SHC( 0x7e4d ), SHC( 0x7e59 ), SHC( 0x7e65 ),
- SHC( 0x7e71 ), SHC( 0x7e7d ), SHC( 0x7e89 ), SHC( 0x7e94 ), SHC( 0x7e9f ), SHC( 0x7eaa ), SHC( 0x7eb5 ), SHC( 0x7ebf ),
- SHC( 0x7eca ), SHC( 0x7ed4 ), SHC( 0x7ede ), SHC( 0x7ee8 ), SHC( 0x7ef1 ), SHC( 0x7efb ), SHC( 0x7f04 ), SHC( 0x7f0d ),
- SHC( 0x7f16 ), SHC( 0x7f1f ), SHC( 0x7f27 ), SHC( 0x7f30 ), SHC( 0x7f38 ), SHC( 0x7f40 ), SHC( 0x7f48 ), SHC( 0x7f4f ),
- SHC( 0x7f57 ), SHC( 0x7f5e ), SHC( 0x7f65 ), SHC( 0x7f6c ), SHC( 0x7f73 ), SHC( 0x7f79 ), SHC( 0x7f80 ), SHC( 0x7f86 ),
- SHC( 0x7f8c ), SHC( 0x7f92 ), SHC( 0x7f98 ), SHC( 0x7f9d ), SHC( 0x7fa3 ), SHC( 0x7fa8 ), SHC( 0x7fad ), SHC( 0x7fb2 ),
- SHC( 0x7fb7 ), SHC( 0x7fbb ), SHC( 0x7fc0 ), SHC( 0x7fc4 ), SHC( 0x7fc8 ), SHC( 0x7fcc ), SHC( 0x7fd0 ), SHC( 0x7fd4 ),
- SHC( 0x7fd7 ), SHC( 0x7fdb ), SHC( 0x7fde ), SHC( 0x7fe1 ), SHC( 0x7fe4 ), SHC( 0x7fe7 ), SHC( 0x7fe9 ), SHC( 0x7fec ),
- SHC( 0x7fee ), SHC( 0x7ff0 ), SHC( 0x7ff2 ), SHC( 0x7ff4 ), SHC( 0x7ff6 ), SHC( 0x7ff7 ), SHC( 0x7ff9 ), SHC( 0x7ffa ),
- SHC( 0x7ffb ), SHC( 0x7ffc ), SHC( 0x7ffd ), SHC( 0x7ffe ), SHC( 0x7ffe ), SHC( 0x7fff ), SHC( 0x7fff ), SHC( 0x7fff ),
- SHC( 0x7fff )
-};
-
-const Word16 ivas_sine_panning_tbl_fx[601] = { // Q15
- SHC( 0xc001 ), SHC( 0xc032 ), SHC( 0xc064 ), SHC( 0xc095 ), SHC( 0xc0c7 ), SHC( 0xc0f9 ), SHC( 0xc12b ), SHC( 0xc15c ),
- SHC( 0xc18e ), SHC( 0xc1c0 ), SHC( 0xc1f2 ), SHC( 0xc224 ), SHC( 0xc256 ), SHC( 0xc289 ), SHC( 0xc2bb ), SHC( 0xc2ed ),
- SHC( 0xc31f ), SHC( 0xc352 ), SHC( 0xc384 ), SHC( 0xc3b6 ), SHC( 0xc3e9 ), SHC( 0xc41b ), SHC( 0xc44e ), SHC( 0xc481 ),
- SHC( 0xc4b3 ), SHC( 0xc4e6 ), SHC( 0xc519 ), SHC( 0xc54b ), SHC( 0xc57e ), SHC( 0xc5b1 ), SHC( 0xc5e4 ), SHC( 0xc617 ),
- SHC( 0xc64a ), SHC( 0xc67d ), SHC( 0xc6b0 ), SHC( 0xc6e3 ), SHC( 0xc717 ), SHC( 0xc74a ), SHC( 0xc77d ), SHC( 0xc7b1 ),
- SHC( 0xc7e4 ), SHC( 0xc817 ), SHC( 0xc84b ), SHC( 0xc87e ), SHC( 0xc8b2 ), SHC( 0xc8e6 ), SHC( 0xc919 ), SHC( 0xc94d ),
- SHC( 0xc981 ), SHC( 0xc9b4 ), SHC( 0xc9e8 ), SHC( 0xca1c ), SHC( 0xca50 ), SHC( 0xca84 ), SHC( 0xcab8 ), SHC( 0xcaec ),
- SHC( 0xcb20 ), SHC( 0xcb54 ), SHC( 0xcb88 ), SHC( 0xcbbc ), SHC( 0xcbf1 ), SHC( 0xcc25 ), SHC( 0xcc59 ), SHC( 0xcc8d ),
- SHC( 0xccc2 ), SHC( 0xccf6 ), SHC( 0xcd2b ), SHC( 0xcd5f ), SHC( 0xcd94 ), SHC( 0xcdc8 ), SHC( 0xcdfd ), SHC( 0xce32 ),
- SHC( 0xce66 ), SHC( 0xce9b ), SHC( 0xced0 ), SHC( 0xcf05 ), SHC( 0xcf3a ), SHC( 0xcf6e ), SHC( 0xcfa3 ), SHC( 0xcfd8 ),
- SHC( 0xd00d ), SHC( 0xd042 ), SHC( 0xd078 ), SHC( 0xd0ad ), SHC( 0xd0e2 ), SHC( 0xd117 ), SHC( 0xd14c ), SHC( 0xd181 ),
- SHC( 0xd1b7 ), SHC( 0xd1ec ), SHC( 0xd221 ), SHC( 0xd257 ), SHC( 0xd28c ), SHC( 0xd2c2 ), SHC( 0xd2f7 ), SHC( 0xd32d ),
- SHC( 0xd362 ), SHC( 0xd398 ), SHC( 0xd3ce ), SHC( 0xd403 ), SHC( 0xd439 ), SHC( 0xd46f ), SHC( 0xd4a5 ), SHC( 0xd4db ),
- SHC( 0xd510 ), SHC( 0xd546 ), SHC( 0xd57c ), SHC( 0xd5b2 ), SHC( 0xd5e8 ), SHC( 0xd61e ), SHC( 0xd654 ), SHC( 0xd68a ),
- SHC( 0xd6c0 ), SHC( 0xd6f7 ), SHC( 0xd72d ), SHC( 0xd763 ), SHC( 0xd799 ), SHC( 0xd7d0 ), SHC( 0xd806 ), SHC( 0xd83c ),
- SHC( 0xd873 ), SHC( 0xd8a9 ), SHC( 0xd8df ), SHC( 0xd916 ), SHC( 0xd94c ), SHC( 0xd983 ), SHC( 0xd9ba ), SHC( 0xd9f0 ),
- SHC( 0xda27 ), SHC( 0xda5d ), SHC( 0xda94 ), SHC( 0xdacb ), SHC( 0xdb02 ), SHC( 0xdb38 ), SHC( 0xdb6f ), SHC( 0xdba6 ),
- SHC( 0xdbdd ), SHC( 0xdc14 ), SHC( 0xdc4b ), SHC( 0xdc81 ), SHC( 0xdcb8 ), SHC( 0xdcef ), SHC( 0xdd26 ), SHC( 0xdd5d ),
- SHC( 0xdd95 ), SHC( 0xddcc ), SHC( 0xde03 ), SHC( 0xde3a ), SHC( 0xde71 ), SHC( 0xdea8 ), SHC( 0xdee0 ), SHC( 0xdf17 ),
- SHC( 0xdf4e ), SHC( 0xdf85 ), SHC( 0xdfbd ), SHC( 0xdff4 ), SHC( 0xe02b ), SHC( 0xe063 ), SHC( 0xe09a ), SHC( 0xe0d2 ),
- SHC( 0xe109 ), SHC( 0xe141 ), SHC( 0xe178 ), SHC( 0xe1b0 ), SHC( 0xe1e7 ), SHC( 0xe21f ), SHC( 0xe257 ), SHC( 0xe28e ),
- SHC( 0xe2c6 ), SHC( 0xe2fe ), SHC( 0xe335 ), SHC( 0xe36d ), SHC( 0xe3a5 ), SHC( 0xe3dd ), SHC( 0xe414 ), SHC( 0xe44c ),
- SHC( 0xe484 ), SHC( 0xe4bc ), SHC( 0xe4f4 ), SHC( 0xe52c ), SHC( 0xe564 ), SHC( 0xe59c ), SHC( 0xe5d4 ), SHC( 0xe60c ),
- SHC( 0xe644 ), SHC( 0xe67c ), SHC( 0xe6b4 ), SHC( 0xe6ec ), SHC( 0xe724 ), SHC( 0xe75c ), SHC( 0xe794 ), SHC( 0xe7cc ),
- SHC( 0xe804 ), SHC( 0xe83d ), SHC( 0xe875 ), SHC( 0xe8ad ), SHC( 0xe8e5 ), SHC( 0xe91e ), SHC( 0xe956 ), SHC( 0xe98e ),
- SHC( 0xe9c6 ), SHC( 0xe9ff ), SHC( 0xea37 ), SHC( 0xea6f ), SHC( 0xeaa8 ), SHC( 0xeae0 ), SHC( 0xeb19 ), SHC( 0xeb51 ),
- SHC( 0xeb8a ), SHC( 0xebc2 ), SHC( 0xebfa ), SHC( 0xec33 ), SHC( 0xec6b ), SHC( 0xeca4 ), SHC( 0xecdd ), SHC( 0xed15 ),
- SHC( 0xed4e ), SHC( 0xed86 ), SHC( 0xedbf ), SHC( 0xedf7 ), SHC( 0xee30 ), SHC( 0xee69 ), SHC( 0xeea1 ), SHC( 0xeeda ),
- SHC( 0xef13 ), SHC( 0xef4b ), SHC( 0xef84 ), SHC( 0xefbd ), SHC( 0xeff6 ), SHC( 0xf02e ), SHC( 0xf067 ), SHC( 0xf0a0 ),
- SHC( 0xf0d9 ), SHC( 0xf111 ), SHC( 0xf14a ), SHC( 0xf183 ), SHC( 0xf1bc ), SHC( 0xf1f5 ), SHC( 0xf22e ), SHC( 0xf266 ),
- SHC( 0xf29f ), SHC( 0xf2d8 ), SHC( 0xf311 ), SHC( 0xf34a ), SHC( 0xf383 ), SHC( 0xf3bc ), SHC( 0xf3f5 ), SHC( 0xf42e ),
- SHC( 0xf467 ), SHC( 0xf4a0 ), SHC( 0xf4d9 ), SHC( 0xf512 ), SHC( 0xf54b ), SHC( 0xf584 ), SHC( 0xf5bd ), SHC( 0xf5f6 ),
- SHC( 0xf62f ), SHC( 0xf668 ), SHC( 0xf6a1 ), SHC( 0xf6da ), SHC( 0xf713 ), SHC( 0xf74c ), SHC( 0xf785 ), SHC( 0xf7be ),
- SHC( 0xf7f7 ), SHC( 0xf830 ), SHC( 0xf869 ), SHC( 0xf8a2 ), SHC( 0xf8db ), SHC( 0xf914 ), SHC( 0xf94e ), SHC( 0xf987 ),
- SHC( 0xf9c0 ), SHC( 0xf9f9 ), SHC( 0xfa32 ), SHC( 0xfa6b ), SHC( 0xfaa4 ), SHC( 0xfadd ), SHC( 0xfb17 ), SHC( 0xfb50 ),
- SHC( 0xfb89 ), SHC( 0xfbc2 ), SHC( 0xfbfb ), SHC( 0xfc34 ), SHC( 0xfc6e ), SHC( 0xfca7 ), SHC( 0xfce0 ), SHC( 0xfd19 ),
- SHC( 0xfd52 ), SHC( 0xfd8b ), SHC( 0xfdc5 ), SHC( 0xfdfe ), SHC( 0xfe37 ), SHC( 0xfe70 ), SHC( 0xfea9 ), SHC( 0xfee3 ),
- SHC( 0xff1c ), SHC( 0xff55 ), SHC( 0xff8e ), SHC( 0xffc7 ), SHC( 0x0000 ), SHC( 0x0039 ), SHC( 0x0072 ), SHC( 0x00ab ),
- SHC( 0x00e4 ), SHC( 0x011d ), SHC( 0x0157 ), SHC( 0x0190 ), SHC( 0x01c9 ), SHC( 0x0202 ), SHC( 0x023b ), SHC( 0x0275 ),
- SHC( 0x02ae ), SHC( 0x02e7 ), SHC( 0x0320 ), SHC( 0x0359 ), SHC( 0x0392 ), SHC( 0x03cc ), SHC( 0x0405 ), SHC( 0x043e ),
- SHC( 0x0477 ), SHC( 0x04b0 ), SHC( 0x04e9 ), SHC( 0x0523 ), SHC( 0x055c ), SHC( 0x0595 ), SHC( 0x05ce ), SHC( 0x0607 ),
- SHC( 0x0640 ), SHC( 0x0679 ), SHC( 0x06b2 ), SHC( 0x06ec ), SHC( 0x0725 ), SHC( 0x075e ), SHC( 0x0797 ), SHC( 0x07d0 ),
- SHC( 0x0809 ), SHC( 0x0842 ), SHC( 0x087b ), SHC( 0x08b4 ), SHC( 0x08ed ), SHC( 0x0926 ), SHC( 0x095f ), SHC( 0x0998 ),
- SHC( 0x09d1 ), SHC( 0x0a0a ), SHC( 0x0a43 ), SHC( 0x0a7c ), SHC( 0x0ab5 ), SHC( 0x0aee ), SHC( 0x0b27 ), SHC( 0x0b60 ),
- SHC( 0x0b99 ), SHC( 0x0bd2 ), SHC( 0x0c0b ), SHC( 0x0c44 ), SHC( 0x0c7d ), SHC( 0x0cb6 ), SHC( 0x0cef ), SHC( 0x0d28 ),
- SHC( 0x0d61 ), SHC( 0x0d9a ), SHC( 0x0dd2 ), SHC( 0x0e0b ), SHC( 0x0e44 ), SHC( 0x0e7d ), SHC( 0x0eb6 ), SHC( 0x0eef ),
- SHC( 0x0f27 ), SHC( 0x0f60 ), SHC( 0x0f99 ), SHC( 0x0fd2 ), SHC( 0x100a ), SHC( 0x1043 ), SHC( 0x107c ), SHC( 0x10b5 ),
- SHC( 0x10ed ), SHC( 0x1126 ), SHC( 0x115f ), SHC( 0x1197 ), SHC( 0x11d0 ), SHC( 0x1209 ), SHC( 0x1241 ), SHC( 0x127a ),
- SHC( 0x12b2 ), SHC( 0x12eb ), SHC( 0x1323 ), SHC( 0x135c ), SHC( 0x1395 ), SHC( 0x13cd ), SHC( 0x1406 ), SHC( 0x143e ),
- SHC( 0x1476 ), SHC( 0x14af ), SHC( 0x14e7 ), SHC( 0x1520 ), SHC( 0x1558 ), SHC( 0x1591 ), SHC( 0x15c9 ), SHC( 0x1601 ),
- SHC( 0x163a ), SHC( 0x1672 ), SHC( 0x16aa ), SHC( 0x16e2 ), SHC( 0x171b ), SHC( 0x1753 ), SHC( 0x178b ), SHC( 0x17c3 ),
- SHC( 0x17fc ), SHC( 0x1834 ), SHC( 0x186c ), SHC( 0x18a4 ), SHC( 0x18dc ), SHC( 0x1914 ), SHC( 0x194c ), SHC( 0x1984 ),
- SHC( 0x19bc ), SHC( 0x19f4 ), SHC( 0x1a2c ), SHC( 0x1a64 ), SHC( 0x1a9c ), SHC( 0x1ad4 ), SHC( 0x1b0c ), SHC( 0x1b44 ),
- SHC( 0x1b7c ), SHC( 0x1bb4 ), SHC( 0x1bec ), SHC( 0x1c23 ), SHC( 0x1c5b ), SHC( 0x1c93 ), SHC( 0x1ccb ), SHC( 0x1d02 ),
- SHC( 0x1d3a ), SHC( 0x1d72 ), SHC( 0x1da9 ), SHC( 0x1de1 ), SHC( 0x1e19 ), SHC( 0x1e50 ), SHC( 0x1e88 ), SHC( 0x1ebf ),
- SHC( 0x1ef7 ), SHC( 0x1f2e ), SHC( 0x1f66 ), SHC( 0x1f9d ), SHC( 0x1fd5 ), SHC( 0x200c ), SHC( 0x2043 ), SHC( 0x207b ),
- SHC( 0x20b2 ), SHC( 0x20e9 ), SHC( 0x2120 ), SHC( 0x2158 ), SHC( 0x218f ), SHC( 0x21c6 ), SHC( 0x21fd ), SHC( 0x2234 ),
- SHC( 0x226b ), SHC( 0x22a3 ), SHC( 0x22da ), SHC( 0x2311 ), SHC( 0x2348 ), SHC( 0x237f ), SHC( 0x23b5 ), SHC( 0x23ec ),
- SHC( 0x2423 ), SHC( 0x245a ), SHC( 0x2491 ), SHC( 0x24c8 ), SHC( 0x24fe ), SHC( 0x2535 ), SHC( 0x256c ), SHC( 0x25a3 ),
- SHC( 0x25d9 ), SHC( 0x2610 ), SHC( 0x2646 ), SHC( 0x267d ), SHC( 0x26b4 ), SHC( 0x26ea ), SHC( 0x2721 ), SHC( 0x2757 ),
- SHC( 0x278d ), SHC( 0x27c4 ), SHC( 0x27fa ), SHC( 0x2830 ), SHC( 0x2867 ), SHC( 0x289d ), SHC( 0x28d3 ), SHC( 0x2909 ),
- SHC( 0x2940 ), SHC( 0x2976 ), SHC( 0x29ac ), SHC( 0x29e2 ), SHC( 0x2a18 ), SHC( 0x2a4e ), SHC( 0x2a84 ), SHC( 0x2aba ),
- SHC( 0x2af0 ), SHC( 0x2b25 ), SHC( 0x2b5b ), SHC( 0x2b91 ), SHC( 0x2bc7 ), SHC( 0x2bfd ), SHC( 0x2c32 ), SHC( 0x2c68 ),
- SHC( 0x2c9e ), SHC( 0x2cd3 ), SHC( 0x2d09 ), SHC( 0x2d3e ), SHC( 0x2d74 ), SHC( 0x2da9 ), SHC( 0x2ddf ), SHC( 0x2e14 ),
- SHC( 0x2e49 ), SHC( 0x2e7f ), SHC( 0x2eb4 ), SHC( 0x2ee9 ), SHC( 0x2f1e ), SHC( 0x2f53 ), SHC( 0x2f88 ), SHC( 0x2fbe ),
- SHC( 0x2ff3 ), SHC( 0x3028 ), SHC( 0x305d ), SHC( 0x3092 ), SHC( 0x30c6 ), SHC( 0x30fb ), SHC( 0x3130 ), SHC( 0x3165 ),
- SHC( 0x319a ), SHC( 0x31ce ), SHC( 0x3203 ), SHC( 0x3238 ), SHC( 0x326c ), SHC( 0x32a1 ), SHC( 0x32d5 ), SHC( 0x330a ),
- SHC( 0x333e ), SHC( 0x3373 ), SHC( 0x33a7 ), SHC( 0x33db ), SHC( 0x340f ), SHC( 0x3444 ), SHC( 0x3478 ), SHC( 0x34ac ),
- SHC( 0x34e0 ), SHC( 0x3514 ), SHC( 0x3548 ), SHC( 0x357c ), SHC( 0x35b0 ), SHC( 0x35e4 ), SHC( 0x3618 ), SHC( 0x364c ),
- SHC( 0x367f ), SHC( 0x36b3 ), SHC( 0x36e7 ), SHC( 0x371a ), SHC( 0x374e ), SHC( 0x3782 ), SHC( 0x37b5 ), SHC( 0x37e9 ),
- SHC( 0x381c ), SHC( 0x384f ), SHC( 0x3883 ), SHC( 0x38b6 ), SHC( 0x38e9 ), SHC( 0x391d ), SHC( 0x3950 ), SHC( 0x3983 ),
- SHC( 0x39b6 ), SHC( 0x39e9 ), SHC( 0x3a1c ), SHC( 0x3a4f ), SHC( 0x3a82 ), SHC( 0x3ab5 ), SHC( 0x3ae7 ), SHC( 0x3b1a ),
- SHC( 0x3b4d ), SHC( 0x3b7f ), SHC( 0x3bb2 ), SHC( 0x3be5 ), SHC( 0x3c17 ), SHC( 0x3c4a ), SHC( 0x3c7c ), SHC( 0x3cae ),
- SHC( 0x3ce1 ), SHC( 0x3d13 ), SHC( 0x3d45 ), SHC( 0x3d77 ), SHC( 0x3daa ), SHC( 0x3ddc ), SHC( 0x3e0e ), SHC( 0x3e40 ),
- SHC( 0x3e72 ), SHC( 0x3ea4 ), SHC( 0x3ed5 ), SHC( 0x3f07 ), SHC( 0x3f39 ), SHC( 0x3f6b ), SHC( 0x3f9c ), SHC( 0x3fce ),
- SHC( 0x3fff )
-};
-
-const Word16 ivas_sin_az_fx[361] = { // Q15
- SHC( 0x0000 ), SHC( 0xfdc5 ), SHC( 0xfb89 ), SHC( 0xf94e ), SHC( 0xf713 ), SHC( 0xf4d9 ), SHC( 0xf29f ), SHC( 0xf067 ),
- SHC( 0xee30 ), SHC( 0xebfa ), SHC( 0xe9c6 ), SHC( 0xe794 ), SHC( 0xe564 ), SHC( 0xe335 ), SHC( 0xe109 ), SHC( 0xdee0 ),
- SHC( 0xdcb8 ), SHC( 0xda94 ), SHC( 0xd873 ), SHC( 0xd654 ), SHC( 0xd439 ), SHC( 0xd221 ), SHC( 0xd00d ), SHC( 0xcdfd ),
- SHC( 0xcbf1 ), SHC( 0xc9e8 ), SHC( 0xc7e4 ), SHC( 0xc5e4 ), SHC( 0xc3e9 ), SHC( 0xc1f2 ), SHC( 0xc001 ), SHC( 0xbe14 ),
- SHC( 0xbc2c ), SHC( 0xba4a ), SHC( 0xb86d ), SHC( 0xb696 ), SHC( 0xb4c4 ), SHC( 0xb2f8 ), SHC( 0xb133 ), SHC( 0xaf73 ),
- SHC( 0xadba ), SHC( 0xac07 ), SHC( 0xaa5a ), SHC( 0xa8b5 ), SHC( 0xa716 ), SHC( 0xa57e ), SHC( 0xa3ed ), SHC( 0xa264 ),
- SHC( 0xa0e1 ), SHC( 0x9f66 ), SHC( 0x9df3 ), SHC( 0x9c87 ), SHC( 0x9b23 ), SHC( 0x99c7 ), SHC( 0x9873 ), SHC( 0x9727 ),
- SHC( 0x95e3 ), SHC( 0x94a7 ), SHC( 0x9374 ), SHC( 0x9249 ), SHC( 0x9127 ), SHC( 0x900d ), SHC( 0x8efc ), SHC( 0x8df4 ),
- SHC( 0x8cf5 ), SHC( 0x8bff ), SHC( 0x8b11 ), SHC( 0x8a2d ), SHC( 0x8953 ), SHC( 0x8881 ), SHC( 0x87b9 ), SHC( 0x86fa ),
- SHC( 0x8644 ), SHC( 0x8598 ), SHC( 0x84f6 ), SHC( 0x845d ), SHC( 0x83ce ), SHC( 0x8348 ), SHC( 0x82cd ), SHC( 0x825b ),
- SHC( 0x81f2 ), SHC( 0x8194 ), SHC( 0x813f ), SHC( 0x80f5 ), SHC( 0x80b4 ), SHC( 0x807d ), SHC( 0x8050 ), SHC( 0x802d ),
- SHC( 0x8014 ), SHC( 0x8005 ), SHC( 0x8000 ), SHC( 0x8005 ), SHC( 0x8014 ), SHC( 0x802d ), SHC( 0x8050 ), SHC( 0x807d ),
- SHC( 0x80b4 ), SHC( 0x80f5 ), SHC( 0x813f ), SHC( 0x8194 ), SHC( 0x81f2 ), SHC( 0x825b ), SHC( 0x82cd ), SHC( 0x8348 ),
- SHC( 0x83ce ), SHC( 0x845d ), SHC( 0x84f6 ), SHC( 0x8598 ), SHC( 0x8644 ), SHC( 0x86fa ), SHC( 0x87b9 ), SHC( 0x8881 ),
- SHC( 0x8953 ), SHC( 0x8a2d ), SHC( 0x8b11 ), SHC( 0x8bff ), SHC( 0x8cf5 ), SHC( 0x8df4 ), SHC( 0x8efc ), SHC( 0x900d ),
- SHC( 0x9127 ), SHC( 0x9249 ), SHC( 0x9374 ), SHC( 0x94a7 ), SHC( 0x95e3 ), SHC( 0x9727 ), SHC( 0x9873 ), SHC( 0x99c7 ),
- SHC( 0x9b23 ), SHC( 0x9c87 ), SHC( 0x9df3 ), SHC( 0x9f66 ), SHC( 0xa0e1 ), SHC( 0xa264 ), SHC( 0xa3ed ), SHC( 0xa57e ),
- SHC( 0xa716 ), SHC( 0xa8b5 ), SHC( 0xaa5a ), SHC( 0xac07 ), SHC( 0xadba ), SHC( 0xaf73 ), SHC( 0xb133 ), SHC( 0xb2f8 ),
- SHC( 0xb4c4 ), SHC( 0xb696 ), SHC( 0xb86d ), SHC( 0xba4a ), SHC( 0xbc2c ), SHC( 0xbe14 ), SHC( 0xc001 ), SHC( 0xc1f2 ),
- SHC( 0xc3e9 ), SHC( 0xc5e4 ), SHC( 0xc7e4 ), SHC( 0xc9e8 ), SHC( 0xcbf1 ), SHC( 0xcdfd ), SHC( 0xd00d ), SHC( 0xd221 ),
- SHC( 0xd439 ), SHC( 0xd654 ), SHC( 0xd873 ), SHC( 0xda94 ), SHC( 0xdcb8 ), SHC( 0xdee0 ), SHC( 0xe109 ), SHC( 0xe335 ),
- SHC( 0xe564 ), SHC( 0xe794 ), SHC( 0xe9c6 ), SHC( 0xebfa ), SHC( 0xee30 ), SHC( 0xf067 ), SHC( 0xf29f ), SHC( 0xf4d9 ),
- SHC( 0xf713 ), SHC( 0xf94e ), SHC( 0xfb89 ), SHC( 0xfdc5 ), SHC( 0x0000 ), SHC( 0x023b ), SHC( 0x0477 ), SHC( 0x06b2 ),
- SHC( 0x08ed ), SHC( 0x0b27 ), SHC( 0x0d61 ), SHC( 0x0f99 ), SHC( 0x11d0 ), SHC( 0x1406 ), SHC( 0x163a ), SHC( 0x186c ),
- SHC( 0x1a9c ), SHC( 0x1ccb ), SHC( 0x1ef7 ), SHC( 0x2120 ), SHC( 0x2348 ), SHC( 0x256c ), SHC( 0x278d ), SHC( 0x29ac ),
- SHC( 0x2bc7 ), SHC( 0x2ddf ), SHC( 0x2ff3 ), SHC( 0x3203 ), SHC( 0x340f ), SHC( 0x3618 ), SHC( 0x381c ), SHC( 0x3a1c ),
- SHC( 0x3c17 ), SHC( 0x3e0e ), SHC( 0x3fff ), SHC( 0x41ec ), SHC( 0x43d4 ), SHC( 0x45b6 ), SHC( 0x4793 ), SHC( 0x496a ),
- SHC( 0x4b3c ), SHC( 0x4d08 ), SHC( 0x4ecd ), SHC( 0x508d ), SHC( 0x5246 ), SHC( 0x53f9 ), SHC( 0x55a6 ), SHC( 0x574b ),
- SHC( 0x58ea ), SHC( 0x5a82 ), SHC( 0x5c13 ), SHC( 0x5d9c ), SHC( 0x5f1f ), SHC( 0x609a ), SHC( 0x620d ), SHC( 0x6379 ),
- SHC( 0x64dd ), SHC( 0x6639 ), SHC( 0x678d ), SHC( 0x68d9 ), SHC( 0x6a1d ), SHC( 0x6b59 ), SHC( 0x6c8c ), SHC( 0x6db7 ),
- SHC( 0x6ed9 ), SHC( 0x6ff3 ), SHC( 0x7104 ), SHC( 0x720c ), SHC( 0x730b ), SHC( 0x7401 ), SHC( 0x74ef ), SHC( 0x75d3 ),
- SHC( 0x76ad ), SHC( 0x777f ), SHC( 0x7847 ), SHC( 0x7906 ), SHC( 0x79bc ), SHC( 0x7a68 ), SHC( 0x7b0a ), SHC( 0x7ba3 ),
- SHC( 0x7c32 ), SHC( 0x7cb8 ), SHC( 0x7d33 ), SHC( 0x7da5 ), SHC( 0x7e0e ), SHC( 0x7e6c ), SHC( 0x7ec1 ), SHC( 0x7f0b ),
- SHC( 0x7f4c ), SHC( 0x7f83 ), SHC( 0x7fb0 ), SHC( 0x7fd3 ), SHC( 0x7fec ), SHC( 0x7ffb ), SHC( 0x7fff ), SHC( 0x7ffb ),
- SHC( 0x7fec ), SHC( 0x7fd3 ), SHC( 0x7fb0 ), SHC( 0x7f83 ), SHC( 0x7f4c ), SHC( 0x7f0b ), SHC( 0x7ec1 ), SHC( 0x7e6c ),
- SHC( 0x7e0e ), SHC( 0x7da5 ), SHC( 0x7d33 ), SHC( 0x7cb8 ), SHC( 0x7c32 ), SHC( 0x7ba3 ), SHC( 0x7b0a ), SHC( 0x7a68 ),
- SHC( 0x79bc ), SHC( 0x7906 ), SHC( 0x7847 ), SHC( 0x777f ), SHC( 0x76ad ), SHC( 0x75d3 ), SHC( 0x74ef ), SHC( 0x7401 ),
- SHC( 0x730b ), SHC( 0x720c ), SHC( 0x7104 ), SHC( 0x6ff3 ), SHC( 0x6ed9 ), SHC( 0x6db7 ), SHC( 0x6c8c ), SHC( 0x6b59 ),
- SHC( 0x6a1d ), SHC( 0x68d9 ), SHC( 0x678d ), SHC( 0x6639 ), SHC( 0x64dd ), SHC( 0x6379 ), SHC( 0x620d ), SHC( 0x609a ),
- SHC( 0x5f1f ), SHC( 0x5d9c ), SHC( 0x5c13 ), SHC( 0x5a82 ), SHC( 0x58ea ), SHC( 0x574b ), SHC( 0x55a6 ), SHC( 0x53f9 ),
- SHC( 0x5246 ), SHC( 0x508d ), SHC( 0x4ecd ), SHC( 0x4d08 ), SHC( 0x4b3c ), SHC( 0x496a ), SHC( 0x4793 ), SHC( 0x45b6 ),
- SHC( 0x43d4 ), SHC( 0x41ec ), SHC( 0x3fff ), SHC( 0x3e0e ), SHC( 0x3c17 ), SHC( 0x3a1c ), SHC( 0x381c ), SHC( 0x3618 ),
- SHC( 0x340f ), SHC( 0x3203 ), SHC( 0x2ff3 ), SHC( 0x2ddf ), SHC( 0x2bc7 ), SHC( 0x29ac ), SHC( 0x278d ), SHC( 0x256c ),
- SHC( 0x2348 ), SHC( 0x2120 ), SHC( 0x1ef7 ), SHC( 0x1ccb ), SHC( 0x1a9c ), SHC( 0x186c ), SHC( 0x163a ), SHC( 0x1406 ),
- SHC( 0x11d0 ), SHC( 0x0f99 ), SHC( 0x0d61 ), SHC( 0x0b27 ), SHC( 0x08ed ), SHC( 0x06b2 ), SHC( 0x0477 ), SHC( 0x023b ),
- SHC( 0x0000 )
-
-};
-
-/* Tables required in edxt_fx() */
-const Word16 sin_scale_tbl_960[960] = /* Q15 */
- {
- 0, 53, 107, 160, 214,
- 268, 321, 375, 428, 482,
- 536, 589, 643, 696, 750,
- 804, 857, 911, 964, 1018,
- 1072, 1125, 1179, 1232, 1286,
- 1339, 1393, 1447, 1500, 1554,
- 1607, 1661, 1714, 1768, 1821,
- 1875, 1929, 1982, 2036, 2089,
- 2143, 2196, 2250, 2303, 2357,
- 2410, 2463, 2517, 2570, 2624,
- 2677, 2731, 2784, 2838, 2891,
- 2944, 2998, 3051, 3104, 3158,
- 3211, 3265, 3318, 3371, 3425,
- 3478, 3531, 3585, 3638, 3691,
- 3744, 3798, 3851, 3904, 3957,
- 4011, 4064, 4117, 4170, 4223,
- 4276, 4330, 4383, 4436, 4489,
- 4542, 4595, 4648, 4701, 4754,
- 4807, 4860, 4913, 4966, 5019,
- 5072, 5125, 5178, 5231, 5284,
- 5337, 5390, 5443, 5496, 5549,
- 5601, 5654, 5707, 5760, 5813,
- 5865, 5918, 5971, 6024, 6076,
- 6129, 6182, 6234, 6287, 6339,
- 6392, 6445, 6497, 6550, 6602,
- 6655, 6707, 6760, 6812, 6865,
- 6917, 6969, 7022, 7074, 7126,
- 7179, 7231, 7283, 7336, 7388,
- 7440, 7492, 7544, 7597, 7649,
- 7701, 7753, 7805, 7857, 7909,
- 7961, 8013, 8065, 8117, 8169,
- 8221, 8273, 8325, 8377, 8428,
- 8480, 8532, 8584, 8635, 8687,
- 8739, 8791, 8842, 8894, 8945,
- 8997, 9048, 9100, 9151, 9203,
- 9254, 9306, 9357, 9409, 9460,
- 9511, 9563, 9614, 9665, 9716,
- 9767, 9819, 9870, 9921, 9972,
- 10023, 10074, 10125, 10176, 10227,
- 10278, 10329, 10380, 10431, 10481,
- 10532, 10583, 10634, 10684, 10735,
- 10786, 10836, 10887, 10937, 10988,
- 11038, 11089, 11139, 11190, 11240,
- 11290, 11341, 11391, 11441, 11491,
- 11542, 11592, 11642, 11692, 11742,
- 11792, 11842, 11892, 11942, 11992,
- 12042, 12092, 12142, 12191, 12241,
- 12291, 12340, 12390, 12440, 12489,
- 12539, 12588, 12638, 12687, 12737,
- 12786, 12835, 12885, 12934, 12983,
- 13033, 13082, 13131, 13180, 13229,
- 13278, 13327, 13376, 13425, 13474,
- 13523, 13571, 13620, 13669, 13718,
- 13766, 13815, 13864, 13912, 13961,
- 14009, 14058, 14106, 14154, 14203,
- 14251, 14299, 14348, 14396, 14444,
- 14492, 14540, 14588, 14636, 14684,
- 14732, 14780, 14828, 14875, 14923,
- 14971, 15019, 15066, 15114, 15161,
- 15209, 15256, 15304, 15351, 15398,
- 15446, 15493, 15540, 15587, 15635,
- 15682, 15729, 15776, 15823, 15870,
- 15917, 15963, 16010, 16057, 16104,
- 16150, 16197, 16244, 16290, 16337,
- 16383, 16429, 16476, 16522, 16568,
- 16615, 16661, 16707, 16753, 16799,
- 16845, 16891, 16937, 16983, 17029,
- 17074, 17120, 17166, 17212, 17257,
- 17303, 17348, 17394, 17439, 17484,
- 17530, 17575, 17620, 17665, 17711,
- 17756, 17801, 17846, 17891, 17936,
- 17980, 18025, 18070, 18115, 18159,
- 18204, 18248, 18293, 18337, 18382,
- 18426, 18470, 18515, 18559, 18603,
- 18647, 18691, 18735, 18779, 18823,
- 18867, 18911, 18955, 18998, 19042,
- 19086, 19129, 19173, 19216, 19259,
- 19303, 19346, 19389, 19433, 19476,
- 19519, 19562, 19605, 19648, 19691,
- 19733, 19776, 19819, 19862, 19904,
- 19947, 19989, 20032, 20074, 20116,
- 20159, 20201, 20243, 20285, 20327,
- 20369, 20411, 20453, 20495, 20537,
- 20579, 20620, 20662, 20704, 20745,
- 20787, 20828, 20869, 20911, 20952,
- 20993, 21034, 21075, 21116, 21157,
- 21198, 21239, 21280, 21321, 21361,
- 21402, 21443, 21483, 21524, 21564,
- 21604, 21645, 21685, 21725, 21765,
- 21805, 21845, 21885, 21925, 21965,
- 22004, 22044, 22084, 22123, 22163,
- 22202, 22242, 22281, 22320, 22360,
- 22399, 22438, 22477, 22516, 22555,
- 22594, 22632, 22671, 22710, 22749,
- 22787, 22826, 22864, 22902, 22941,
- 22979, 23017, 23055, 23093, 23131,
- 23169, 23207, 23245, 23283, 23320,
- 23358, 23396, 23433, 23471, 23508,
- 23545, 23583, 23620, 23657, 23694,
- 23731, 23768, 23805, 23842, 23878,
- 23915, 23952, 23988, 24025, 24061,
- 24097, 24134, 24170, 24206, 24242,
- 24278, 24314, 24350, 24386, 24422,
- 24457, 24493, 24529, 24564, 24600,
- 24635, 24670, 24706, 24741, 24776,
- 24811, 24846, 24881, 24916, 24951,
- 24985, 25020, 25054, 25089, 25123,
- 25158, 25192, 25226, 25261, 25295,
- 25329, 25363, 25397, 25430, 25464,
- 25498, 25532, 25565, 25599, 25632,
- 25665, 25699, 25732, 25765, 25798,
- 25831, 25864, 25897, 25930, 25963,
- 25995, 26028, 26060, 26093, 26125,
- 26158, 26190, 26222, 26254, 26286,
- 26318, 26350, 26382, 26414, 26445,
- 26477, 26509, 26540, 26571, 26603,
- 26634, 26665, 26696, 26727, 26758,
- 26789, 26820, 26851, 26882, 26912,
- 26943, 26973, 27004, 27034, 27064,
- 27094, 27125, 27155, 27185, 27214,
- 27244, 27274, 27304, 27333, 27363,
- 27392, 27422, 27451, 27480, 27509,
- 27538, 27567, 27596, 27625, 27654,
- 27683, 27711, 27740, 27769, 27797,
- 27825, 27854, 27882, 27910, 27938,
- 27966, 27994, 28022, 28049, 28077,
- 28105, 28132, 28160, 28187, 28214,
- 28242, 28269, 28296, 28323, 28350,
- 28377, 28403, 28430, 28457, 28483,
- 28510, 28536, 28562, 28589, 28615,
- 28641, 28667, 28693, 28719, 28744,
- 28770, 28796, 28821, 28847, 28872,
- 28897, 28923, 28948, 28973, 28998,
- 29023, 29048, 29072, 29097, 29122,
- 29146, 29171, 29195, 29219, 29244,
- 29268, 29292, 29316, 29340, 29364,
- 29387, 29411, 29435, 29458, 29482,
- 29505, 29528, 29551, 29575, 29598,
- 29621, 29643, 29666, 29689, 29712,
- 29734, 29757, 29779, 29801, 29824,
- 29846, 29868, 29890, 29912, 29934,
- 29955, 29977, 29999, 30020, 30042,
- 30063, 30084, 30106, 30127, 30148,
- 30169, 30190, 30210, 30231, 30252,
- 30272, 30293, 30313, 30333, 30354,
- 30374, 30394, 30414, 30434, 30454,
- 30473, 30493, 30513, 30532, 30552,
- 30571, 30590, 30609, 30628, 30647,
- 30666, 30685, 30704, 30723, 30741,
- 30760, 30778, 30797, 30815, 30833,
- 30851, 30869, 30887, 30905, 30923,
- 30940, 30958, 30975, 30993, 31010,
- 31028, 31045, 31062, 31079, 31096,
- 31113, 31129, 31146, 31163, 31179,
- 31196, 31212, 31228, 31245, 31261,
- 31277, 31293, 31308, 31324, 31340,
- 31356, 31371, 31387, 31402, 31417,
- 31432, 31447, 31462, 31477, 31492,
- 31507, 31522, 31536, 31551, 31565,
- 31580, 31594, 31608, 31622, 31636,
- 31650, 31664, 31678, 31691, 31705,
- 31718, 31732, 31745, 31758, 31771,
- 31785, 31797, 31810, 31823, 31836,
- 31849, 31861, 31874, 31886, 31898,
- 31911, 31923, 31935, 31947, 31959,
- 31970, 31982, 31994, 32005, 32017,
- 32028, 32039, 32050, 32062, 32073,
- 32084, 32094, 32105, 32116, 32126,
- 32137, 32147, 32158, 32168, 32178,
- 32188, 32198, 32208, 32218, 32228,
- 32237, 32247, 32256, 32266, 32275,
- 32284, 32293, 32302, 32311, 32320,
- 32329, 32338, 32346, 32355, 32363,
- 32371, 32380, 32388, 32396, 32404,
- 32412, 32420, 32427, 32435, 32443,
- 32450, 32457, 32465, 32472, 32479,
- 32486, 32493, 32500, 32507, 32513,
- 32520, 32527, 32533, 32539, 32546,
- 32552, 32558, 32564, 32570, 32576,
- 32581, 32587, 32593, 32598, 32603,
- 32609, 32614, 32619, 32624, 32629,
- 32634, 32639, 32643, 32648, 32652,
- 32657, 32661, 32665, 32670, 32674,
- 32678, 32682, 32685, 32689, 32693,
- 32696, 32700, 32703, 32706, 32710,
- 32713, 32716, 32719, 32722, 32724,
- 32727, 32730, 32732, 32735, 32737,
- 32739, 32741, 32743, 32745, 32747,
- 32749, 32751, 32752, 32754, 32755,
- 32757, 32758, 32759, 32760, 32761,
- 32762, 32763, 32764, 32764, 32765,
- 32765, 32766, 32766, 32766, 32766
- };
-
-const Word16 cos_scale_tbl_960[960] = /* Q15 */
- {
- 32767, 32766, 32766, 32766, 32766,
- 32765, 32765, 32764, 32764, 32763,
- 32762, 32761, 32760, 32759, 32758,
- 32757, 32755, 32754, 32752, 32751,
- 32749, 32747, 32745, 32743, 32741,
- 32739, 32737, 32735, 32732, 32730,
- 32727, 32724, 32722, 32719, 32716,
- 32713, 32710, 32706, 32703, 32700,
- 32696, 32693, 32689, 32685, 32682,
- 32678, 32674, 32670, 32665, 32661,
- 32657, 32652, 32648, 32643, 32639,
- 32634, 32629, 32624, 32619, 32614,
- 32609, 32603, 32598, 32593, 32587,
- 32581, 32576, 32570, 32564, 32558,
- 32552, 32546, 32539, 32533, 32527,
- 32520, 32513, 32507, 32500, 32493,
- 32486, 32479, 32472, 32465, 32457,
- 32450, 32443, 32435, 32427, 32420,
- 32412, 32404, 32396, 32388, 32380,
- 32371, 32363, 32355, 32346, 32338,
- 32329, 32320, 32311, 32302, 32293,
- 32284, 32275, 32266, 32256, 32247,
- 32237, 32228, 32218, 32208, 32198,
- 32188, 32178, 32168, 32158, 32147,
- 32137, 32126, 32116, 32105, 32094,
- 32084, 32073, 32062, 32050, 32039,
- 32028, 32017, 32005, 31994, 31982,
- 31970, 31959, 31947, 31935, 31923,
- 31911, 31898, 31886, 31874, 31861,
- 31849, 31836, 31823, 31810, 31797,
- 31785, 31771, 31758, 31745, 31732,
- 31718, 31705, 31691, 31678, 31664,
- 31650, 31636, 31622, 31608, 31594,
- 31580, 31565, 31551, 31536, 31522,
- 31507, 31492, 31477, 31462, 31447,
- 31432, 31417, 31402, 31387, 31371,
- 31356, 31340, 31324, 31308, 31293,
- 31277, 31261, 31245, 31228, 31212,
- 31196, 31179, 31163, 31146, 31129,
- 31113, 31096, 31079, 31062, 31045,
- 31028, 31010, 30993, 30975, 30958,
- 30940, 30923, 30905, 30887, 30869,
- 30851, 30833, 30815, 30797, 30778,
- 30760, 30741, 30723, 30704, 30685,
- 30666, 30647, 30628, 30609, 30590,
- 30571, 30552, 30532, 30513, 30493,
- 30473, 30454, 30434, 30414, 30394,
- 30374, 30354, 30333, 30313, 30293,
- 30272, 30252, 30231, 30210, 30190,
- 30169, 30148, 30127, 30106, 30084,
- 30063, 30042, 30020, 29999, 29977,
- 29955, 29934, 29912, 29890, 29868,
- 29846, 29824, 29801, 29779, 29757,
- 29734, 29712, 29689, 29666, 29643,
- 29621, 29598, 29575, 29551, 29528,
- 29505, 29482, 29458, 29435, 29411,
- 29387, 29364, 29340, 29316, 29292,
- 29268, 29244, 29219, 29195, 29171,
- 29146, 29122, 29097, 29072, 29048,
- 29023, 28998, 28973, 28948, 28923,
- 28897, 28872, 28847, 28821, 28796,
- 28770, 28744, 28719, 28693, 28667,
- 28641, 28615, 28589, 28562, 28536,
- 28510, 28483, 28457, 28430, 28403,
- 28377, 28350, 28323, 28296, 28269,
- 28242, 28214, 28187, 28160, 28132,
- 28105, 28077, 28049, 28022, 27994,
- 27966, 27938, 27910, 27882, 27854,
- 27825, 27797, 27769, 27740, 27711,
- 27683, 27654, 27625, 27596, 27567,
- 27538, 27509, 27480, 27451, 27422,
- 27392, 27363, 27333, 27304, 27274,
- 27244, 27214, 27185, 27155, 27125,
- 27094, 27064, 27034, 27004, 26973,
- 26943, 26912, 26882, 26851, 26820,
- 26789, 26758, 26727, 26696, 26665,
- 26634, 26603, 26571, 26540, 26509,
- 26477, 26445, 26414, 26382, 26350,
- 26318, 26286, 26254, 26222, 26190,
- 26158, 26125, 26093, 26060, 26028,
- 25995, 25963, 25930, 25897, 25864,
- 25831, 25798, 25765, 25732, 25699,
- 25665, 25632, 25599, 25565, 25532,
- 25498, 25464, 25430, 25397, 25363,
- 25329, 25295, 25261, 25226, 25192,
- 25158, 25123, 25089, 25054, 25020,
- 24985, 24951, 24916, 24881, 24846,
- 24811, 24776, 24741, 24706, 24670,
- 24635, 24600, 24564, 24529, 24493,
- 24457, 24422, 24386, 24350, 24314,
- 24278, 24242, 24206, 24170, 24134,
- 24097, 24061, 24025, 23988, 23952,
- 23915, 23878, 23842, 23805, 23768,
- 23731, 23694, 23657, 23620, 23583,
- 23545, 23508, 23471, 23433, 23396,
- 23358, 23320, 23283, 23245, 23207,
- 23169, 23131, 23093, 23055, 23017,
- 22979, 22941, 22902, 22864, 22826,
- 22787, 22749, 22710, 22671, 22632,
- 22594, 22555, 22516, 22477, 22438,
- 22399, 22360, 22320, 22281, 22242,
- 22202, 22163, 22123, 22084, 22044,
- 22004, 21965, 21925, 21885, 21845,
- 21805, 21765, 21725, 21685, 21645,
- 21604, 21564, 21524, 21483, 21443,
- 21402, 21361, 21321, 21280, 21239,
- 21198, 21157, 21116, 21075, 21034,
- 20993, 20952, 20911, 20869, 20828,
- 20787, 20745, 20704, 20662, 20620,
- 20579, 20537, 20495, 20453, 20411,
- 20369, 20327, 20285, 20243, 20201,
- 20159, 20116, 20074, 20032, 19989,
- 19947, 19904, 19862, 19819, 19776,
- 19733, 19691, 19648, 19605, 19562,
- 19519, 19476, 19433, 19389, 19346,
- 19303, 19259, 19216, 19173, 19129,
- 19086, 19042, 18998, 18955, 18911,
- 18867, 18823, 18779, 18735, 18691,
- 18647, 18603, 18559, 18515, 18470,
- 18426, 18382, 18337, 18293, 18248,
- 18204, 18159, 18115, 18070, 18025,
- 17980, 17936, 17891, 17846, 17801,
- 17756, 17711, 17665, 17620, 17575,
- 17530, 17484, 17439, 17394, 17348,
- 17303, 17257, 17212, 17166, 17120,
- 17074, 17029, 16983, 16937, 16891,
- 16845, 16799, 16753, 16707, 16661,
- 16615, 16568, 16522, 16476, 16429,
- 16383, 16337, 16290, 16244, 16197,
- 16150, 16104, 16057, 16010, 15963,
- 15917, 15870, 15823, 15776, 15729,
- 15682, 15635, 15587, 15540, 15493,
- 15446, 15398, 15351, 15304, 15256,
- 15209, 15161, 15114, 15066, 15019,
- 14971, 14923, 14875, 14828, 14780,
- 14732, 14684, 14636, 14588, 14540,
- 14492, 14444, 14396, 14348, 14299,
- 14251, 14203, 14154, 14106, 14058,
- 14009, 13961, 13912, 13864, 13815,
- 13766, 13718, 13669, 13620, 13571,
- 13523, 13474, 13425, 13376, 13327,
- 13278, 13229, 13180, 13131, 13082,
- 13033, 12983, 12934, 12885, 12835,
- 12786, 12737, 12687, 12638, 12588,
- 12539, 12489, 12440, 12390, 12340,
- 12291, 12241, 12191, 12142, 12092,
- 12042, 11992, 11942, 11892, 11842,
- 11792, 11742, 11692, 11642, 11592,
- 11542, 11491, 11441, 11391, 11341,
- 11290, 11240, 11190, 11139, 11089,
- 11038, 10988, 10937, 10887, 10836,
- 10786, 10735, 10684, 10634, 10583,
- 10532, 10481, 10431, 10380, 10329,
- 10278, 10227, 10176, 10125, 10074,
- 10023, 9972, 9921, 9870, 9819,
- 9767, 9716, 9665, 9614, 9563,
- 9511, 9460, 9409, 9357, 9306,
- 9254, 9203, 9151, 9100, 9048,
- 8997, 8945, 8894, 8842, 8791,
- 8739, 8687, 8635, 8584, 8532,
- 8480, 8428, 8377, 8325, 8273,
- 8221, 8169, 8117, 8065, 8013,
- 7961, 7909, 7857, 7805, 7753,
- 7701, 7649, 7597, 7544, 7492,
- 7440, 7388, 7336, 7283, 7231,
- 7179, 7126, 7074, 7022, 6969,
- 6917, 6865, 6812, 6760, 6707,
- 6655, 6602, 6550, 6497, 6445,
- 6392, 6339, 6287, 6234, 6182,
- 6129, 6076, 6024, 5971, 5918,
- 5865, 5813, 5760, 5707, 5654,
- 5601, 5549, 5496, 5443, 5390,
- 5337, 5284, 5231, 5178, 5125,
- 5072, 5019, 4966, 4913, 4860,
- 4807, 4754, 4701, 4648, 4595,
- 4542, 4489, 4436, 4383, 4330,
- 4276, 4223, 4170, 4117, 4064,
- 4011, 3957, 3904, 3851, 3798,
- 3744, 3691, 3638, 3585, 3531,
- 3478, 3425, 3371, 3318, 3265,
- 3211, 3158, 3104, 3051, 2998,
- 2944, 2891, 2838, 2784, 2731,
- 2677, 2624, 2570, 2517, 2463,
- 2410, 2357, 2303, 2250, 2196,
- 2143, 2089, 2036, 1982, 1929,
- 1875, 1821, 1768, 1714, 1661,
- 1607, 1554, 1500, 1447, 1393,
- 1339, 1286, 1232, 1179, 1125,
- 1072, 1018, 964, 911, 857,
- 804, 750, 696, 643, 589,
- 536, 482, 428, 375, 321,
- 268, 214, 160, 107, 53
- };
-
-const Word16 cos_scale_tbl_640[640] = /* Q15 */
- {
- 32767, 32766, 32766, 32766, 32765,
- 32764, 32763, 32762, 32760, 32759,
- 32757, 32755, 32752, 32750, 32747,
- 32744, 32741, 32738, 32735, 32731,
- 32727, 32723, 32719, 32714, 32710,
- 32705, 32700, 32695, 32689, 32684,
- 32678, 32672, 32665, 32659, 32652,
- 32646, 32639, 32631, 32624, 32617,
- 32609, 32601, 32593, 32584, 32576,
- 32567, 32558, 32549, 32539, 32530,
- 32520, 32510, 32500, 32490, 32479,
- 32468, 32457, 32446, 32435, 32424,
- 32412, 32400, 32388, 32376, 32363,
- 32350, 32338, 32324, 32311, 32298,
- 32284, 32270, 32256, 32242, 32228,
- 32213, 32198, 32183, 32168, 32152,
- 32137, 32121, 32105, 32089, 32073,
- 32056, 32039, 32022, 32005, 31988,
- 31970, 31953, 31935, 31917, 31898,
- 31880, 31861, 31842, 31823, 31804,
- 31785, 31765, 31745, 31725, 31705,
- 31684, 31664, 31643, 31622, 31601,
- 31580, 31558, 31536, 31514, 31492,
- 31470, 31447, 31425, 31402, 31379,
- 31356, 31332, 31308, 31285, 31261,
- 31236, 31212, 31188, 31163, 31138,
- 31113, 31087, 31062, 31036, 31010,
- 30984, 30958, 30932, 30905, 30878,
- 30851, 30824, 30797, 30769, 30741,
- 30713, 30685, 30657, 30628, 30600,
- 30571, 30542, 30513, 30483, 30454,
- 30424, 30394, 30364, 30333, 30303,
- 30272, 30241, 30210, 30179, 30148,
- 30116, 30084, 30052, 30020, 29988,
- 29955, 29923, 29890, 29857, 29824,
- 29790, 29757, 29723, 29689, 29655,
- 29621, 29586, 29551, 29517, 29482,
- 29446, 29411, 29375, 29340, 29304,
- 29268, 29232, 29195, 29159, 29122,
- 29085, 29048, 29010, 28973, 28935,
- 28897, 28859, 28821, 28783, 28744,
- 28706, 28667, 28628, 28589, 28549,
- 28510, 28470, 28430, 28390, 28350,
- 28309, 28269, 28228, 28187, 28146,
- 28105, 28063, 28022, 27980, 27938,
- 27896, 27854, 27811, 27769, 27726,
- 27683, 27640, 27596, 27553, 27509,
- 27466, 27422, 27378, 27333, 27289,
- 27244, 27200, 27155, 27109, 27064,
- 27019, 26973, 26927, 26882, 26836,
- 26789, 26743, 26696, 26650, 26603,
- 26556, 26509, 26461, 26414, 26366,
- 26318, 26270, 26222, 26174, 26125,
- 26077, 26028, 25979, 25930, 25881,
- 25831, 25782, 25732, 25682, 25632,
- 25582, 25532, 25481, 25430, 25380,
- 25329, 25278, 25226, 25175, 25123,
- 25072, 25020, 24968, 24916, 24863,
- 24811, 24758, 24706, 24653, 24600,
- 24546, 24493, 24440, 24386, 24332,
- 24278, 24224, 24170, 24116, 24061,
- 24006, 23952, 23897, 23842, 23786,
- 23731, 23675, 23620, 23564, 23508,
- 23452, 23396, 23339, 23283, 23226,
- 23169, 23112, 23055, 22998, 22941,
- 22883, 22826, 22768, 22710, 22652,
- 22594, 22535, 22477, 22418, 22360,
- 22301, 22242, 22183, 22123, 22064,
- 22004, 21945, 21885, 21825, 21765,
- 21705, 21645, 21584, 21524, 21463,
- 21402, 21341, 21280, 21219, 21157,
- 21096, 21034, 20973, 20911, 20849,
- 20787, 20724, 20662, 20600, 20537,
- 20474, 20411, 20348, 20285, 20222,
- 20159, 20095, 20032, 19968, 19904,
- 19840, 19776, 19712, 19648, 19583,
- 19519, 19454, 19389, 19324, 19259,
- 19194, 19129, 19064, 18998, 18933,
- 18867, 18801, 18735, 18669, 18603,
- 18537, 18470, 18404, 18337, 18271,
- 18204, 18137, 18070, 18003, 17936,
- 17868, 17801, 17733, 17665, 17598,
- 17530, 17462, 17394, 17325, 17257,
- 17189, 17120, 17052, 16983, 16914,
- 16845, 16776, 16707, 16638, 16568,
- 16499, 16429, 16360, 16290, 16220,
- 16150, 16080, 16010, 15940, 15870,
- 15799, 15729, 15658, 15587, 15517,
- 15446, 15375, 15304, 15233, 15161,
- 15090, 15019, 14947, 14875, 14804,
- 14732, 14660, 14588, 14516, 14444,
- 14372, 14299, 14227, 14154, 14082,
- 14009, 13936, 13864, 13791, 13718,
- 13645, 13571, 13498, 13425, 13352,
- 13278, 13204, 13131, 13057, 12983,
- 12909, 12835, 12761, 12687, 12613,
- 12539, 12465, 12390, 12316, 12241,
- 12166, 12092, 12017, 11942, 11867,
- 11792, 11717, 11642, 11567, 11491,
- 11416, 11341, 11265, 11190, 11114,
- 11038, 10963, 10887, 10811, 10735,
- 10659, 10583, 10507, 10431, 10354,
- 10278, 10202, 10125, 10049, 9972,
- 9895, 9819, 9742, 9665, 9588,
- 9511, 9434, 9357, 9280, 9203,
- 9126, 9048, 8971, 8894, 8816,
- 8739, 8661, 8584, 8506, 8428,
- 8351, 8273, 8195, 8117, 8039,
- 7961, 7883, 7805, 7727, 7649,
- 7571, 7492, 7414, 7336, 7257,
- 7179, 7100, 7022, 6943, 6865,
- 6786, 6707, 6628, 6550, 6471,
- 6392, 6313, 6234, 6155, 6076,
- 5997, 5918, 5839, 5760, 5681,
- 5601, 5522, 5443, 5364, 5284,
- 5205, 5125, 5046, 4966, 4887,
- 4807, 4728, 4648, 4569, 4489,
- 4409, 4330, 4250, 4170, 4090,
- 4011, 3931, 3851, 3771, 3691,
- 3611, 3531, 3451, 3371, 3291,
- 3211, 3131, 3051, 2971, 2891,
- 2811, 2731, 2651, 2570, 2490,
- 2410, 2330, 2250, 2169, 2089,
- 2009, 1929, 1848, 1768, 1688,
- 1607, 1527, 1447, 1366, 1286,
- 1206, 1125, 1045, 964, 884,
- 804, 723, 643, 562, 482,
- 402, 321, 241, 160, 80
- };
-
-const Word16 sin_scale_tbl_640[640] = /* Q15 */
- {
- 0, 80, 160, 241, 321,
- 402, 482, 562, 643, 723,
- 804, 884, 964, 1045, 1125,
- 1206, 1286, 1366, 1447, 1527,
- 1607, 1688, 1768, 1848, 1929,
- 2009, 2089, 2169, 2250, 2330,
- 2410, 2490, 2570, 2651, 2731,
- 2811, 2891, 2971, 3051, 3131,
- 3211, 3291, 3371, 3451, 3531,
- 3611, 3691, 3771, 3851, 3931,
- 4011, 4090, 4170, 4250, 4330,
- 4409, 4489, 4569, 4648, 4728,
- 4807, 4887, 4966, 5046, 5125,
- 5205, 5284, 5364, 5443, 5522,
- 5601, 5681, 5760, 5839, 5918,
- 5997, 6076, 6155, 6234, 6313,
- 6392, 6471, 6550, 6628, 6707,
- 6786, 6865, 6943, 7022, 7100,
- 7179, 7257, 7336, 7414, 7492,
- 7571, 7649, 7727, 7805, 7883,
- 7961, 8039, 8117, 8195, 8273,
- 8351, 8428, 8506, 8584, 8661,
- 8739, 8816, 8894, 8971, 9048,
- 9126, 9203, 9280, 9357, 9434,
- 9511, 9588, 9665, 9742, 9819,
- 9895, 9972, 10049, 10125, 10202,
- 10278, 10354, 10431, 10507, 10583,
- 10659, 10735, 10811, 10887, 10963,
- 11038, 11114, 11190, 11265, 11341,
- 11416, 11491, 11567, 11642, 11717,
- 11792, 11867, 11942, 12017, 12092,
- 12166, 12241, 12316, 12390, 12465,
- 12539, 12613, 12687, 12761, 12835,
- 12909, 12983, 13057, 13131, 13204,
- 13278, 13352, 13425, 13498, 13571,
- 13645, 13718, 13791, 13864, 13936,
- 14009, 14082, 14154, 14227, 14299,
- 14372, 14444, 14516, 14588, 14660,
- 14732, 14804, 14875, 14947, 15019,
- 15090, 15161, 15233, 15304, 15375,
- 15446, 15517, 15587, 15658, 15729,
- 15799, 15870, 15940, 16010, 16080,
- 16150, 16220, 16290, 16360, 16429,
- 16499, 16568, 16638, 16707, 16776,
- 16845, 16914, 16983, 17052, 17120,
- 17189, 17257, 17325, 17394, 17462,
- 17530, 17598, 17665, 17733, 17801,
- 17868, 17936, 18003, 18070, 18137,
- 18204, 18271, 18337, 18404, 18470,
- 18537, 18603, 18669, 18735, 18801,
- 18867, 18933, 18998, 19064, 19129,
- 19194, 19259, 19324, 19389, 19454,
- 19519, 19583, 19648, 19712, 19776,
- 19840, 19904, 19968, 20032, 20095,
- 20159, 20222, 20285, 20348, 20411,
- 20474, 20537, 20600, 20662, 20724,
- 20787, 20849, 20911, 20973, 21034,
- 21096, 21157, 21219, 21280, 21341,
- 21402, 21463, 21524, 21584, 21645,
- 21705, 21765, 21825, 21885, 21945,
- 22004, 22064, 22123, 22183, 22242,
- 22301, 22360, 22418, 22477, 22535,
- 22594, 22652, 22710, 22768, 22826,
- 22883, 22941, 22998, 23055, 23112,
- 23169, 23226, 23283, 23339, 23396,
- 23452, 23508, 23564, 23620, 23675,
- 23731, 23786, 23842, 23897, 23952,
- 24006, 24061, 24116, 24170, 24224,
- 24278, 24332, 24386, 24440, 24493,
- 24546, 24600, 24653, 24706, 24758,
- 24811, 24863, 24916, 24968, 25020,
- 25072, 25123, 25175, 25226, 25278,
- 25329, 25380, 25430, 25481, 25532,
- 25582, 25632, 25682, 25732, 25782,
- 25831, 25881, 25930, 25979, 26028,
- 26077, 26125, 26174, 26222, 26270,
- 26318, 26366, 26414, 26461, 26509,
- 26556, 26603, 26650, 26696, 26743,
- 26789, 26836, 26882, 26927, 26973,
- 27019, 27064, 27109, 27155, 27200,
- 27244, 27289, 27333, 27378, 27422,
- 27466, 27509, 27553, 27596, 27640,
- 27683, 27726, 27769, 27811, 27854,
- 27896, 27938, 27980, 28022, 28063,
- 28105, 28146, 28187, 28228, 28269,
- 28309, 28350, 28390, 28430, 28470,
- 28510, 28549, 28589, 28628, 28667,
- 28706, 28744, 28783, 28821, 28859,
- 28897, 28935, 28973, 29010, 29048,
- 29085, 29122, 29159, 29195, 29232,
- 29268, 29304, 29340, 29375, 29411,
- 29446, 29482, 29517, 29551, 29586,
- 29621, 29655, 29689, 29723, 29757,
- 29790, 29824, 29857, 29890, 29923,
- 29955, 29988, 30020, 30052, 30084,
- 30116, 30148, 30179, 30210, 30241,
- 30272, 30303, 30333, 30364, 30394,
- 30424, 30454, 30483, 30513, 30542,
- 30571, 30600, 30628, 30657, 30685,
- 30713, 30741, 30769, 30797, 30824,
- 30851, 30878, 30905, 30932, 30958,
- 30984, 31010, 31036, 31062, 31087,
- 31113, 31138, 31163, 31188, 31212,
- 31236, 31261, 31285, 31308, 31332,
- 31356, 31379, 31402, 31425, 31447,
- 31470, 31492, 31514, 31536, 31558,
- 31580, 31601, 31622, 31643, 31664,
- 31684, 31705, 31725, 31745, 31765,
- 31785, 31804, 31823, 31842, 31861,
- 31880, 31898, 31917, 31935, 31953,
- 31970, 31988, 32005, 32022, 32039,
- 32056, 32073, 32089, 32105, 32121,
- 32137, 32152, 32168, 32183, 32198,
- 32213, 32228, 32242, 32256, 32270,
- 32284, 32298, 32311, 32324, 32338,
- 32350, 32363, 32376, 32388, 32400,
- 32412, 32424, 32435, 32446, 32457,
- 32468, 32479, 32490, 32500, 32510,
- 32520, 32530, 32539, 32549, 32558,
- 32567, 32576, 32584, 32593, 32601,
- 32609, 32617, 32624, 32631, 32639,
- 32646, 32652, 32659, 32665, 32672,
- 32678, 32684, 32689, 32695, 32700,
- 32705, 32710, 32714, 32719, 32723,
- 32727, 32731, 32735, 32738, 32741,
- 32744, 32747, 32750, 32752, 32755,
- 32757, 32759, 32760, 32762, 32763,
- 32764, 32765, 32766, 32766, 32766
- };
-
-const Word16 sin_scale_tbl_512[512] = /* Q15 */
- {
- 0, 100, 201, 301, 402,
- 502, 603, 703, 804, 904,
- 1005, 1105, 1206, 1306, 1406,
- 1507, 1607, 1708, 1808, 1908,
- 2009, 2109, 2209, 2310, 2410,
- 2510, 2610, 2711, 2811, 2911,
- 3011, 3111, 3211, 3311, 3411,
- 3511, 3611, 3711, 3811, 3911,
- 4011, 4110, 4210, 4310, 4409,
- 4509, 4608, 4708, 4807, 4907,
- 5006, 5106, 5205, 5304, 5403,
- 5502, 5601, 5700, 5799, 5898,
- 5997, 6096, 6195, 6293, 6392,
- 6491, 6589, 6688, 6786, 6884,
- 6982, 7081, 7179, 7277, 7375,
- 7473, 7571, 7668, 7766, 7864,
- 7961, 8059, 8156, 8253, 8351,
- 8448, 8545, 8642, 8739, 8836,
- 8932, 9029, 9126, 9222, 9319,
- 9415, 9511, 9607, 9703, 9799,
- 9895, 9991, 10087, 10182, 10278,
- 10373, 10469, 10564, 10659, 10754,
- 10849, 10944, 11038, 11133, 11227,
- 11322, 11416, 11510, 11604, 11698,
- 11792, 11886, 11980, 12073, 12166,
- 12260, 12353, 12446, 12539, 12632,
- 12724, 12817, 12909, 13002, 13094,
- 13186, 13278, 13370, 13462, 13553,
- 13645, 13736, 13827, 13918, 14009,
- 14100, 14191, 14281, 14372, 14462,
- 14552, 14642, 14732, 14822, 14911,
- 15001, 15090, 15179, 15268, 15357,
- 15446, 15534, 15623, 15711, 15799,
- 15887, 15975, 16063, 16150, 16238,
- 16325, 16412, 16499, 16586, 16672,
- 16759, 16845, 16931, 17017, 17103,
- 17189, 17274, 17360, 17445, 17530,
- 17615, 17699, 17784, 17868, 17952,
- 18036, 18120, 18204, 18287, 18371,
- 18454, 18537, 18620, 18702, 18785,
- 18867, 18949, 19031, 19113, 19194,
- 19276, 19357, 19438, 19519, 19599,
- 19680, 19760, 19840, 19920, 20000,
- 20079, 20159, 20238, 20317, 20396,
- 20474, 20553, 20631, 20709, 20787,
- 20864, 20942, 21019, 21096, 21173,
- 21249, 21326, 21402, 21478, 21554,
- 21629, 21705, 21780, 21855, 21930,
- 22004, 22079, 22153, 22227, 22301,
- 22374, 22448, 22521, 22594, 22666,
- 22739, 22811, 22883, 22955, 23027,
- 23098, 23169, 23240, 23311, 23382,
- 23452, 23522, 23592, 23661, 23731,
- 23800, 23869, 23938, 24006, 24075,
- 24143, 24211, 24278, 24346, 24413,
- 24480, 24546, 24613, 24679, 24745,
- 24811, 24877, 24942, 25007, 25072,
- 25136, 25201, 25265, 25329, 25392,
- 25456, 25519, 25582, 25645, 25707,
- 25769, 25831, 25893, 25954, 26016,
- 26077, 26137, 26198, 26258, 26318,
- 26378, 26437, 26497, 26556, 26615,
- 26673, 26731, 26789, 26847, 26905,
- 26962, 27019, 27076, 27132, 27188,
- 27244, 27300, 27355, 27411, 27466,
- 27520, 27575, 27629, 27683, 27736,
- 27790, 27843, 27896, 27948, 28001,
- 28053, 28105, 28156, 28208, 28259,
- 28309, 28360, 28410, 28460, 28510,
- 28559, 28608, 28657, 28706, 28754,
- 28802, 28850, 28897, 28945, 28992,
- 29038, 29085, 29131, 29177, 29222,
- 29268, 29313, 29358, 29402, 29446,
- 29490, 29534, 29577, 29621, 29663,
- 29706, 29748, 29790, 29832, 29873,
- 29915, 29955, 29996, 30036, 30076,
- 30116, 30156, 30195, 30234, 30272,
- 30311, 30349, 30386, 30424, 30461,
- 30498, 30535, 30571, 30607, 30643,
- 30678, 30713, 30748, 30783, 30817,
- 30851, 30885, 30918, 30951, 30984,
- 31017, 31049, 31081, 31113, 31144,
- 31175, 31206, 31236, 31267, 31297,
- 31326, 31356, 31385, 31413, 31442,
- 31470, 31498, 31525, 31553, 31580,
- 31606, 31633, 31659, 31684, 31710,
- 31735, 31760, 31785, 31809, 31833,
- 31856, 31880, 31903, 31926, 31948,
- 31970, 31992, 32014, 32035, 32056,
- 32077, 32097, 32117, 32137, 32156,
- 32176, 32194, 32213, 32231, 32249,
- 32267, 32284, 32301, 32318, 32334,
- 32350, 32366, 32382, 32397, 32412,
- 32426, 32441, 32455, 32468, 32482,
- 32495, 32508, 32520, 32532, 32544,
- 32556, 32567, 32578, 32588, 32599,
- 32609, 32618, 32628, 32637, 32646,
- 32654, 32662, 32670, 32678, 32685,
- 32692, 32699, 32705, 32711, 32717,
- 32722, 32727, 32732, 32736, 32740,
- 32744, 32748, 32751, 32754, 32757,
- 32759, 32761, 32763, 32764, 32765,
- 32766, 32766
- };
-
-const Word16 cos_scale_tbl_512[512] = /* Q15 */
- {
- 32767, 32766, 32766, 32765, 32764,
- 32763, 32761, 32759, 32757, 32754,
- 32751, 32748, 32744, 32740, 32736,
- 32732, 32727, 32722, 32717, 32711,
- 32705, 32699, 32692, 32685, 32678,
- 32670, 32662, 32654, 32646, 32637,
- 32628, 32618, 32609, 32599, 32588,
- 32578, 32567, 32556, 32544, 32532,
- 32520, 32508, 32495, 32482, 32468,
- 32455, 32441, 32426, 32412, 32397,
- 32382, 32366, 32350, 32334, 32318,
- 32301, 32284, 32267, 32249, 32231,
- 32213, 32194, 32176, 32156, 32137,
- 32117, 32097, 32077, 32056, 32035,
- 32014, 31992, 31970, 31948, 31926,
- 31903, 31880, 31856, 31833, 31809,
- 31785, 31760, 31735, 31710, 31684,
- 31659, 31633, 31606, 31580, 31553,
- 31525, 31498, 31470, 31442, 31413,
- 31385, 31356, 31326, 31297, 31267,
- 31236, 31206, 31175, 31144, 31113,
- 31081, 31049, 31017, 30984, 30951,
- 30918, 30885, 30851, 30817, 30783,
- 30748, 30713, 30678, 30643, 30607,
- 30571, 30535, 30498, 30461, 30424,
- 30386, 30349, 30311, 30272, 30234,
- 30195, 30156, 30116, 30076, 30036,
- 29996, 29955, 29915, 29873, 29832,
- 29790, 29748, 29706, 29663, 29621,
- 29577, 29534, 29490, 29446, 29402,
- 29358, 29313, 29268, 29222, 29177,
- 29131, 29085, 29038, 28992, 28945,
- 28897, 28850, 28802, 28754, 28706,
- 28657, 28608, 28559, 28510, 28460,
- 28410, 28360, 28309, 28259, 28208,
- 28156, 28105, 28053, 28001, 27948,
- 27896, 27843, 27790, 27736, 27683,
- 27629, 27575, 27520, 27466, 27411,
- 27355, 27300, 27244, 27188, 27132,
- 27076, 27019, 26962, 26905, 26847,
- 26789, 26731, 26673, 26615, 26556,
- 26497, 26437, 26378, 26318, 26258,
- 26198, 26137, 26077, 26016, 25954,
- 25893, 25831, 25769, 25707, 25645,
- 25582, 25519, 25456, 25392, 25329,
- 25265, 25201, 25136, 25072, 25007,
- 24942, 24877, 24811, 24745, 24679,
- 24613, 24546, 24480, 24413, 24346,
- 24278, 24211, 24143, 24075, 24006,
- 23938, 23869, 23800, 23731, 23661,
- 23592, 23522, 23452, 23382, 23311,
- 23240, 23169, 23098, 23027, 22955,
- 22883, 22811, 22739, 22666, 22594,
- 22521, 22448, 22374, 22301, 22227,
- 22153, 22079, 22004, 21930, 21855,
- 21780, 21705, 21629, 21554, 21478,
- 21402, 21326, 21249, 21173, 21096,
- 21019, 20942, 20864, 20787, 20709,
- 20631, 20553, 20474, 20396, 20317,
- 20238, 20159, 20079, 20000, 19920,
- 19840, 19760, 19680, 19599, 19519,
- 19438, 19357, 19276, 19194, 19113,
- 19031, 18949, 18867, 18785, 18702,
- 18620, 18537, 18454, 18371, 18287,
- 18204, 18120, 18036, 17952, 17868,
- 17784, 17699, 17615, 17530, 17445,
- 17360, 17274, 17189, 17103, 17017,
- 16931, 16845, 16759, 16672, 16586,
- 16499, 16412, 16325, 16238, 16150,
- 16063, 15975, 15887, 15799, 15711,
- 15623, 15534, 15446, 15357, 15268,
- 15179, 15090, 15001, 14911, 14822,
- 14732, 14642, 14552, 14462, 14372,
- 14281, 14191, 14100, 14009, 13918,
- 13827, 13736, 13645, 13553, 13462,
- 13370, 13278, 13186, 13094, 13002,
- 12909, 12817, 12724, 12632, 12539,
- 12446, 12353, 12260, 12166, 12073,
- 11980, 11886, 11792, 11698, 11604,
- 11510, 11416, 11322, 11227, 11133,
- 11038, 10944, 10849, 10754, 10659,
- 10564, 10469, 10373, 10278, 10182,
- 10087, 9991, 9895, 9799, 9703,
- 9607, 9511, 9415, 9319, 9222,
- 9126, 9029, 8932, 8836, 8739,
- 8642, 8545, 8448, 8351, 8253,
- 8156, 8059, 7961, 7864, 7766,
- 7668, 7571, 7473, 7375, 7277,
- 7179, 7081, 6982, 6884, 6786,
- 6688, 6589, 6491, 6392, 6293,
- 6195, 6096, 5997, 5898, 5799,
- 5700, 5601, 5502, 5403, 5304,
- 5205, 5106, 5006, 4907, 4807,
- 4708, 4608, 4509, 4409, 4310,
- 4210, 4110, 4011, 3911, 3811,
- 3711, 3611, 3511, 3411, 3311,
- 3211, 3111, 3011, 2911, 2811,
- 2711, 2610, 2510, 2410, 2310,
- 2209, 2109, 2009, 1908, 1808,
- 1708, 1607, 1507, 1406, 1306,
- 1206, 1105, 1005, 904, 804,
- 703, 603, 502, 402, 301,
- 201, 100
- };
-
-const Word16 sin_scale_tbl_1200[1200] = { /* Q15 */
- 0, 42, 85, 128, 171, 214, 257, 300,
- 343, 386, 428, 471, 514, 557, 600, 643,
- 686, 729, 771, 814, 857, 900, 943, 986,
- 1029, 1072, 1114, 1157, 1200, 1243, 1286, 1329,
- 1372, 1414, 1457, 1500, 1543, 1586, 1629, 1672,
- 1714, 1757, 1800, 1843, 1886, 1929, 1971, 2014,
- 2057, 2100, 2143, 2185, 2228, 2271, 2314, 2357,
- 2399, 2442, 2485, 2528, 2570, 2613, 2656, 2699,
- 2741, 2784, 2827, 2870, 2912, 2955, 2998, 3040,
- 3083, 3126, 3169, 3211, 3254, 3297, 3339, 3382,
- 3425, 3467, 3510, 3553, 3595, 3638, 3680, 3723,
- 3766, 3808, 3851, 3893, 3936, 3979, 4021, 4064,
- 4106, 4149, 4191, 4234, 4276, 4319, 4361, 4404,
- 4446, 4489, 4531, 4574, 4616, 4659, 4701, 4744,
- 4786, 4829, 4871, 4913, 4956, 4998, 5041, 5083,
- 5125, 5168, 5210, 5252, 5295, 5337, 5379, 5422,
- 5464, 5506, 5549, 5591, 5633, 5675, 5718, 5760,
- 5802, 5844, 5886, 5929, 5971, 6013, 6055, 6097,
- 6139, 6182, 6224, 6266, 6308, 6350, 6392, 6434,
- 6476, 6518, 6560, 6602, 6644, 6686, 6728, 6770,
- 6812, 6854, 6896, 6938, 6980, 7022, 7064, 7106,
- 7147, 7189, 7231, 7273, 7315, 7357, 7398, 7440,
- 7482, 7524, 7565, 7607, 7649, 7691, 7732, 7774,
- 7816, 7857, 7899, 7940, 7982, 8024, 8065, 8107,
- 8148, 8190, 8231, 8273, 8314, 8356, 8397, 8439,
- 8480, 8522, 8563, 8604, 8646, 8687, 8729, 8770,
- 8811, 8853, 8894, 8935, 8976, 9018, 9059, 9100,
- 9141, 9182, 9224, 9265, 9306, 9347, 9388, 9429,
- 9470, 9511, 9552, 9593, 9634, 9675, 9716, 9757,
- 9798, 9839, 9880, 9921, 9962, 10003, 10043, 10084,
- 10125, 10166, 10207, 10247, 10288, 10329, 10370, 10410,
- 10451, 10491, 10532, 10573, 10613, 10654, 10694, 10735,
- 10775, 10816, 10856, 10897, 10937, 10978, 11018, 11059,
- 11099, 11139, 11180, 11220, 11260, 11300, 11341, 11381,
- 11421, 11461, 11502, 11542, 11582, 11622, 11662, 11702,
- 11742, 11782, 11822, 11862, 11902, 11942, 11982, 12022,
- 12062, 12102, 12142, 12181, 12221, 12261, 12301, 12340,
- 12380, 12420, 12460, 12499, 12539, 12579, 12618, 12658,
- 12697, 12737, 12776, 12816, 12855, 12895, 12934, 12973,
- 13013, 13052, 13092, 13131, 13170, 13209, 13249, 13288,
- 13327, 13366, 13405, 13444, 13484, 13523, 13562, 13601,
- 13640, 13679, 13718, 13757, 13796, 13834, 13873, 13912,
- 13951, 13990, 14029, 14067, 14106, 14145, 14183, 14222,
- 14261, 14299, 14338, 14376, 14415, 14453, 14492, 14530,
- 14569, 14607, 14646, 14684, 14722, 14761, 14799, 14837,
- 14875, 14914, 14952, 14990, 15028, 15066, 15104, 15142,
- 15180, 15218, 15256, 15294, 15332, 15370, 15408, 15446,
- 15484, 15521, 15559, 15597, 15635, 15672, 15710, 15748,
- 15785, 15823, 15860, 15898, 15935, 15973, 16010, 16048,
- 16085, 16122, 16160, 16197, 16234, 16271, 16309, 16346,
- 16383, 16420, 16457, 16494, 16531, 16568, 16605, 16642,
- 16679, 16716, 16753, 16790, 16827, 16863, 16900, 16937,
- 16974, 17010, 17047, 17084, 17120, 17157, 17193, 17230,
- 17266, 17303, 17339, 17375, 17412, 17448, 17484, 17521,
- 17557, 17593, 17629, 17665, 17702, 17738, 17774, 17810,
- 17846, 17882, 17918, 17953, 17989, 18025, 18061, 18097,
- 18132, 18168, 18204, 18240, 18275, 18311, 18346, 18382,
- 18417, 18453, 18488, 18524, 18559, 18594, 18630, 18665,
- 18700, 18735, 18770, 18806, 18841, 18876, 18911, 18946,
- 18981, 19016, 19051, 19086, 19120, 19155, 19190, 19225,
- 19259, 19294, 19329, 19363, 19398, 19433, 19467, 19502,
- 19536, 19570, 19605, 19639, 19673, 19708, 19742, 19776,
- 19810, 19845, 19879, 19913, 19947, 19981, 20015, 20049,
- 20083, 20117, 20150, 20184, 20218, 20252, 20285, 20319,
- 20353, 20386, 20420, 20453, 20487, 20520, 20554, 20587,
- 20620, 20654, 20687, 20720, 20753, 20787, 20820, 20853,
- 20886, 20919, 20952, 20985, 21018, 21051, 21084, 21116,
- 21149, 21182, 21215, 21247, 21280, 21313, 21345, 21378,
- 21410, 21443, 21475, 21507, 21540, 21572, 21604, 21637,
- 21669, 21701, 21733, 21765, 21797, 21829, 21861, 21893,
- 21925, 21957, 21989, 22020, 22052, 22084, 22115, 22147,
- 22179, 22210, 22242, 22273, 22305, 22336, 22367, 22399,
- 22430, 22461, 22493, 22524, 22555, 22586, 22617, 22648,
- 22679, 22710, 22741, 22772, 22802, 22833, 22864, 22895,
- 22925, 22956, 22987, 23017, 23048, 23078, 23109, 23139,
- 23169, 23200, 23230, 23260, 23290, 23320, 23351, 23381,
- 23411, 23441, 23471, 23500, 23530, 23560, 23590, 23620,
- 23649, 23679, 23709, 23738, 23768, 23797, 23827, 23856,
- 23886, 23915, 23944, 23974, 24003, 24032, 24061, 24090,
- 24119, 24148, 24177, 24206, 24235, 24264, 24293, 24321,
- 24350, 24379, 24407, 24436, 24465, 24493, 24522, 24550,
- 24578, 24607, 24635, 24663, 24692, 24720, 24748, 24776,
- 24804, 24832, 24860, 24888, 24916, 24944, 24971, 24999,
- 25027, 25054, 25082, 25110, 25137, 25165, 25192, 25220,
- 25247, 25274, 25302, 25329, 25356, 25383, 25410, 25437,
- 25464, 25491, 25518, 25545, 25572, 25599, 25625, 25652,
- 25679, 25705, 25732, 25759, 25785, 25811, 25838, 25864,
- 25891, 25917, 25943, 25969, 25995, 26021, 26047, 26073,
- 26099, 26125, 26151, 26177, 26203, 26228, 26254, 26280,
- 26305, 26331, 26356, 26382, 26407, 26433, 26458, 26483,
- 26509, 26534, 26559, 26584, 26609, 26634, 26659, 26684,
- 26709, 26734, 26758, 26783, 26808, 26832, 26857, 26882,
- 26906, 26931, 26955, 26979, 27004, 27028, 27052, 27076,
- 27100, 27125, 27149, 27173, 27197, 27220, 27244, 27268,
- 27292, 27316, 27339, 27363, 27386, 27410, 27433, 27457,
- 27480, 27504, 27527, 27550, 27573, 27596, 27620, 27643,
- 27666, 27689, 27711, 27734, 27757, 27780, 27803, 27825,
- 27848, 27871, 27893, 27916, 27938, 27960, 27983, 28005,
- 28027, 28049, 28072, 28094, 28116, 28138, 28160, 28182,
- 28203, 28225, 28247, 28269, 28290, 28312, 28334, 28355,
- 28377, 28398, 28419, 28441, 28462, 28483, 28504, 28525,
- 28547, 28568, 28589, 28610, 28630, 28651, 28672, 28693,
- 28713, 28734, 28755, 28775, 28796, 28816, 28837, 28857,
- 28877, 28897, 28918, 28938, 28958, 28978, 28998, 29018,
- 29038, 29058, 29077, 29097, 29117, 29136, 29156, 29176,
- 29195, 29215, 29234, 29253, 29273, 29292, 29311, 29330,
- 29349, 29368, 29387, 29406, 29425, 29444, 29463, 29482,
- 29500, 29519, 29537, 29556, 29575, 29593, 29611, 29630,
- 29648, 29666, 29684, 29703, 29721, 29739, 29757, 29775,
- 29792, 29810, 29828, 29846, 29863, 29881, 29899, 29916,
- 29934, 29951, 29968, 29986, 30003, 30020, 30037, 30055,
- 30072, 30089, 30106, 30122, 30139, 30156, 30173, 30190,
- 30206, 30223, 30239, 30256, 30272, 30289, 30305, 30321,
- 30338, 30354, 30370, 30386, 30402, 30418, 30434, 30450,
- 30465, 30481, 30497, 30513, 30528, 30544, 30559, 30575,
- 30590, 30605, 30621, 30636, 30651, 30666, 30681, 30696,
- 30711, 30726, 30741, 30756, 30771, 30786, 30800, 30815,
- 30829, 30844, 30858, 30873, 30887, 30901, 30916, 30930,
- 30944, 30958, 30972, 30986, 31000, 31014, 31028, 31041,
- 31055, 31069, 31082, 31096, 31109, 31123, 31136, 31149,
- 31163, 31176, 31189, 31202, 31215, 31228, 31241, 31254,
- 31267, 31280, 31293, 31305, 31318, 31331, 31343, 31356,
- 31368, 31380, 31393, 31405, 31417, 31429, 31441, 31453,
- 31465, 31477, 31489, 31501, 31513, 31525, 31536, 31548,
- 31559, 31571, 31582, 31594, 31605, 31616, 31628, 31639,
- 31650, 31661, 31672, 31683, 31694, 31705, 31716, 31726,
- 31737, 31748, 31758, 31769, 31779, 31790, 31800, 31810,
- 31821, 31831, 31841, 31851, 31861, 31871, 31881, 31891,
- 31901, 31911, 31920, 31930, 31940, 31949, 31959, 31968,
- 31977, 31987, 31996, 32005, 32014, 32023, 32033, 32042,
- 32050, 32059, 32068, 32077, 32086, 32094, 32103, 32112,
- 32120, 32128, 32137, 32145, 32154, 32162, 32170, 32178,
- 32186, 32194, 32202, 32210, 32218, 32226, 32233, 32241,
- 32249, 32256, 32264, 32271, 32279, 32286, 32293, 32300,
- 32308, 32315, 32322, 32329, 32336, 32343, 32350, 32356,
- 32363, 32370, 32376, 32383, 32389, 32396, 32402, 32409,
- 32415, 32421, 32427, 32434, 32440, 32446, 32452, 32457,
- 32463, 32469, 32475, 32481, 32486, 32492, 32497, 32503,
- 32508, 32513, 32519, 32524, 32529, 32534, 32539, 32544,
- 32549, 32554, 32559, 32564, 32569, 32573, 32578, 32582,
- 32587, 32591, 32596, 32600, 32604, 32609, 32613, 32617,
- 32621, 32625, 32629, 32633, 32637, 32641, 32644, 32648,
- 32652, 32655, 32659, 32662, 32665, 32669, 32672, 32675,
- 32679, 32682, 32685, 32688, 32691, 32694, 32696, 32699,
- 32702, 32705, 32707, 32710, 32712, 32715, 32717, 32719,
- 32722, 32724, 32726, 32728, 32730, 32732, 32734, 32736,
- 32738, 32740, 32741, 32743, 32744, 32746, 32748, 32749,
- 32750, 32752, 32753, 32754, 32755, 32756, 32757, 32758,
- 32759, 32760, 32761, 32762, 32762, 32763, 32764, 32764,
- 32765, 32765, 32765, 32766, 32766, 32766, 32766, 32766
-};
-
-const Word16 cos_scale_tbl_1200[1200] = { /* Q15 */
- 0, 42, 85, 128, 171, 214, 257, 300,
- 343, 386, 428, 471, 514, 557, 600, 643,
- 686, 729, 771, 814, 857, 900, 943, 986,
- 1029, 1072, 1114, 1157, 1200, 1243, 1286, 1329,
- 1372, 1414, 1457, 1500, 1543, 1586, 1629, 1672,
- 1714, 1757, 1800, 1843, 1886, 1929, 1971, 2014,
- 2057, 2100, 2143, 2185, 2228, 2271, 2314, 2357,
- 2399, 2442, 2485, 2528, 2570, 2613, 2656, 2699,
- 2741, 2784, 2827, 2870, 2912, 2955, 2998, 3040,
- 3083, 3126, 3169, 3211, 3254, 3297, 3339, 3382,
- 3425, 3467, 3510, 3553, 3595, 3638, 3680, 3723,
- 3766, 3808, 3851, 3893, 3936, 3979, 4021, 4064,
- 4106, 4149, 4191, 4234, 4276, 4319, 4361, 4404,
- 4446, 4489, 4531, 4574, 4616, 4659, 4701, 4744,
- 4786, 4829, 4871, 4913, 4956, 4998, 5041, 5083,
- 5125, 5168, 5210, 5252, 5295, 5337, 5379, 5422,
- 5464, 5506, 5549, 5591, 5633, 5675, 5718, 5760,
- 5802, 5844, 5886, 5929, 5971, 6013, 6055, 6097,
- 6139, 6182, 6224, 6266, 6308, 6350, 6392, 6434,
- 6476, 6518, 6560, 6602, 6644, 6686, 6728, 6770,
- 6812, 6854, 6896, 6938, 6980, 7022, 7064, 7106,
- 7147, 7189, 7231, 7273, 7315, 7357, 7398, 7440,
- 7482, 7524, 7565, 7607, 7649, 7691, 7732, 7774,
- 7816, 7857, 7899, 7940, 7982, 8024, 8065, 8107,
- 8148, 8190, 8231, 8273, 8314, 8356, 8397, 8439,
- 8480, 8522, 8563, 8604, 8646, 8687, 8729, 8770,
- 8811, 8853, 8894, 8935, 8976, 9018, 9059, 9100,
- 9141, 9182, 9224, 9265, 9306, 9347, 9388, 9429,
- 9470, 9511, 9552, 9593, 9634, 9675, 9716, 9757,
- 9798, 9839, 9880, 9921, 9962, 10003, 10043, 10084,
- 10125, 10166, 10207, 10247, 10288, 10329, 10370, 10410,
- 10451, 10491, 10532, 10573, 10613, 10654, 10694, 10735,
- 10775, 10816, 10856, 10897, 10937, 10978, 11018, 11059,
- 11099, 11139, 11180, 11220, 11260, 11300, 11341, 11381,
- 11421, 11461, 11502, 11542, 11582, 11622, 11662, 11702,
- 11742, 11782, 11822, 11862, 11902, 11942, 11982, 12022,
- 12062, 12102, 12142, 12181, 12221, 12261, 12301, 12340,
- 12380, 12420, 12460, 12499, 12539, 12579, 12618, 12658,
- 12697, 12737, 12776, 12816, 12855, 12895, 12934, 12973,
- 13013, 13052, 13092, 13131, 13170, 13209, 13249, 13288,
- 13327, 13366, 13405, 13444, 13484, 13523, 13562, 13601,
- 13640, 13679, 13718, 13757, 13796, 13834, 13873, 13912,
- 13951, 13990, 14029, 14067, 14106, 14145, 14183, 14222,
- 14261, 14299, 14338, 14376, 14415, 14453, 14492, 14530,
- 14569, 14607, 14646, 14684, 14722, 14761, 14799, 14837,
- 14875, 14914, 14952, 14990, 15028, 15066, 15104, 15142,
- 15180, 15218, 15256, 15294, 15332, 15370, 15408, 15446,
- 15484, 15521, 15559, 15597, 15635, 15672, 15710, 15748,
- 15785, 15823, 15860, 15898, 15935, 15973, 16010, 16048,
- 16085, 16122, 16160, 16197, 16234, 16271, 16309, 16346,
- 16383, 16420, 16457, 16494, 16531, 16568, 16605, 16642,
- 16679, 16716, 16753, 16790, 16827, 16863, 16900, 16937,
- 16974, 17010, 17047, 17084, 17120, 17157, 17193, 17230,
- 17266, 17303, 17339, 17375, 17412, 17448, 17484, 17521,
- 17557, 17593, 17629, 17665, 17702, 17738, 17774, 17810,
- 17846, 17882, 17918, 17953, 17989, 18025, 18061, 18097,
- 18132, 18168, 18204, 18240, 18275, 18311, 18346, 18382,
- 18417, 18453, 18488, 18524, 18559, 18594, 18630, 18665,
- 18700, 18735, 18770, 18806, 18841, 18876, 18911, 18946,
- 18981, 19016, 19051, 19086, 19120, 19155, 19190, 19225,
- 19259, 19294, 19329, 19363, 19398, 19433, 19467, 19502,
- 19536, 19570, 19605, 19639, 19673, 19708, 19742, 19776,
- 19810, 19845, 19879, 19913, 19947, 19981, 20015, 20049,
- 20083, 20117, 20150, 20184, 20218, 20252, 20285, 20319,
- 20353, 20386, 20420, 20453, 20487, 20520, 20554, 20587,
- 20620, 20654, 20687, 20720, 20753, 20787, 20820, 20853,
- 20886, 20919, 20952, 20985, 21018, 21051, 21084, 21116,
- 21149, 21182, 21215, 21247, 21280, 21313, 21345, 21378,
- 21410, 21443, 21475, 21507, 21540, 21572, 21604, 21637,
- 21669, 21701, 21733, 21765, 21797, 21829, 21861, 21893,
- 21925, 21957, 21989, 22020, 22052, 22084, 22115, 22147,
- 22179, 22210, 22242, 22273, 22305, 22336, 22367, 22399,
- 22430, 22461, 22493, 22524, 22555, 22586, 22617, 22648,
- 22679, 22710, 22741, 22772, 22802, 22833, 22864, 22895,
- 22925, 22956, 22987, 23017, 23048, 23078, 23109, 23139,
- 23169, 23200, 23230, 23260, 23290, 23320, 23351, 23381,
- 23411, 23441, 23471, 23500, 23530, 23560, 23590, 23620,
- 23649, 23679, 23709, 23738, 23768, 23797, 23827, 23856,
- 23886, 23915, 23944, 23974, 24003, 24032, 24061, 24090,
- 24119, 24148, 24177, 24206, 24235, 24264, 24293, 24321,
- 24350, 24379, 24407, 24436, 24465, 24493, 24522, 24550,
- 24578, 24607, 24635, 24663, 24692, 24720, 24748, 24776,
- 24804, 24832, 24860, 24888, 24916, 24944, 24971, 24999,
- 25027, 25054, 25082, 25110, 25137, 25165, 25192, 25220,
- 25247, 25274, 25302, 25329, 25356, 25383, 25410, 25437,
- 25464, 25491, 25518, 25545, 25572, 25599, 25625, 25652,
- 25679, 25705, 25732, 25759, 25785, 25811, 25838, 25864,
- 25891, 25917, 25943, 25969, 25995, 26021, 26047, 26073,
- 26099, 26125, 26151, 26177, 26203, 26228, 26254, 26280,
- 26305, 26331, 26356, 26382, 26407, 26433, 26458, 26483,
- 26509, 26534, 26559, 26584, 26609, 26634, 26659, 26684,
- 26709, 26734, 26758, 26783, 26808, 26832, 26857, 26882,
- 26906, 26931, 26955, 26979, 27004, 27028, 27052, 27076,
- 27100, 27125, 27149, 27173, 27197, 27220, 27244, 27268,
- 27292, 27316, 27339, 27363, 27386, 27410, 27433, 27457,
- 27480, 27504, 27527, 27550, 27573, 27596, 27620, 27643,
- 27666, 27689, 27711, 27734, 27757, 27780, 27803, 27825,
- 27848, 27871, 27893, 27916, 27938, 27960, 27983, 28005,
- 28027, 28049, 28072, 28094, 28116, 28138, 28160, 28182,
- 28203, 28225, 28247, 28269, 28290, 28312, 28334, 28355,
- 28377, 28398, 28419, 28441, 28462, 28483, 28504, 28525,
- 28547, 28568, 28589, 28610, 28630, 28651, 28672, 28693,
- 28713, 28734, 28755, 28775, 28796, 28816, 28837, 28857,
- 28877, 28897, 28918, 28938, 28958, 28978, 28998, 29018,
- 29038, 29058, 29077, 29097, 29117, 29136, 29156, 29176,
- 29195, 29215, 29234, 29253, 29273, 29292, 29311, 29330,
- 29349, 29368, 29387, 29406, 29425, 29444, 29463, 29482,
- 29500, 29519, 29537, 29556, 29575, 29593, 29611, 29630,
- 29648, 29666, 29684, 29703, 29721, 29739, 29757, 29775,
- 29792, 29810, 29828, 29846, 29863, 29881, 29899, 29916,
- 29934, 29951, 29968, 29986, 30003, 30020, 30037, 30055,
- 30072, 30089, 30106, 30122, 30139, 30156, 30173, 30190,
- 30206, 30223, 30239, 30256, 30272, 30289, 30305, 30321,
- 30338, 30354, 30370, 30386, 30402, 30418, 30434, 30450,
- 30465, 30481, 30497, 30513, 30528, 30544, 30559, 30575,
- 30590, 30605, 30621, 30636, 30651, 30666, 30681, 30696,
- 30711, 30726, 30741, 30756, 30771, 30786, 30800, 30815,
- 30829, 30844, 30858, 30873, 30887, 30901, 30916, 30930,
- 30944, 30958, 30972, 30986, 31000, 31014, 31028, 31041,
- 31055, 31069, 31082, 31096, 31109, 31123, 31136, 31149,
- 31163, 31176, 31189, 31202, 31215, 31228, 31241, 31254,
- 31267, 31280, 31293, 31305, 31318, 31331, 31343, 31356,
- 31368, 31380, 31393, 31405, 31417, 31429, 31441, 31453,
- 31465, 31477, 31489, 31501, 31513, 31525, 31536, 31548,
- 31559, 31571, 31582, 31594, 31605, 31616, 31628, 31639,
- 31650, 31661, 31672, 31683, 31694, 31705, 31716, 31726,
- 31737, 31748, 31758, 31769, 31779, 31790, 31800, 31810,
- 31821, 31831, 31841, 31851, 31861, 31871, 31881, 31891,
- 31901, 31911, 31920, 31930, 31940, 31949, 31959, 31968,
- 31977, 31987, 31996, 32005, 32014, 32023, 32033, 32042,
- 32050, 32059, 32068, 32077, 32086, 32094, 32103, 32112,
- 32120, 32128, 32137, 32145, 32154, 32162, 32170, 32178,
- 32186, 32194, 32202, 32210, 32218, 32226, 32233, 32241,
- 32249, 32256, 32264, 32271, 32279, 32286, 32293, 32300,
- 32308, 32315, 32322, 32329, 32336, 32343, 32350, 32356,
- 32363, 32370, 32376, 32383, 32389, 32396, 32402, 32409,
- 32415, 32421, 32427, 32434, 32440, 32446, 32452, 32457,
- 32463, 32469, 32475, 32481, 32486, 32492, 32497, 32503,
- 32508, 32513, 32519, 32524, 32529, 32534, 32539, 32544,
- 32549, 32554, 32559, 32564, 32569, 32573, 32578, 32582,
- 32587, 32591, 32596, 32600, 32604, 32609, 32613, 32617,
- 32621, 32625, 32629, 32633, 32637, 32641, 32644, 32648,
- 32652, 32655, 32659, 32662, 32665, 32669, 32672, 32675,
- 32679, 32682, 32685, 32688, 32691, 32694, 32696, 32699,
- 32702, 32705, 32707, 32710, 32712, 32715, 32717, 32719,
- 32722, 32724, 32726, 32728, 32730, 32732, 32734, 32736,
- 32738, 32740, 32741, 32743, 32744, 32746, 32748, 32749,
- 32750, 32752, 32753, 32754, 32755, 32756, 32757, 32758,
- 32759, 32760, 32761, 32762, 32762, 32763, 32764, 32764,
- 32765, 32765, 32765, 32766, 32766, 32766, 32766, 32766
-};
-
-const Word16 sin_scale_tbl_800[800] = { /* Q15 */
- 0, 64, 128, 193, 257, 321, 386, 450,
- 514, 579, 643, 707, 771, 836, 900, 964,
- 1029, 1093, 1157, 1222, 1286, 1350, 1414, 1479,
- 1543, 1607, 1672, 1736, 1800, 1864, 1929, 1993,
- 2057, 2121, 2185, 2250, 2314, 2378, 2442, 2506,
- 2570, 2635, 2699, 2763, 2827, 2891, 2955, 3019,
- 3083, 3147, 3211, 3275, 3339, 3403, 3467, 3531,
- 3595, 3659, 3723, 3787, 3851, 3915, 3979, 4042,
- 4106, 4170, 4234, 4298, 4361, 4425, 4489, 4553,
- 4616, 4680, 4744, 4807, 4871, 4935, 4998, 5062,
- 5125, 5189, 5252, 5316, 5379, 5443, 5506, 5570,
- 5633, 5696, 5760, 5823, 5886, 5950, 6013, 6076,
- 6139, 6203, 6266, 6329, 6392, 6455, 6518, 6581,
- 6644, 6707, 6770, 6833, 6896, 6959, 7022, 7085,
- 7147, 7210, 7273, 7336, 7398, 7461, 7524, 7586,
- 7649, 7711, 7774, 7836, 7899, 7961, 8024, 8086,
- 8148, 8211, 8273, 8335, 8397, 8460, 8522, 8584,
- 8646, 8708, 8770, 8832, 8894, 8956, 9018, 9079,
- 9141, 9203, 9265, 9326, 9388, 9450, 9511, 9573,
- 9634, 9696, 9757, 9819, 9880, 9941, 10003, 10064,
- 10125, 10186, 10247, 10308, 10370, 10431, 10491, 10552,
- 10613, 10674, 10735, 10796, 10856, 10917, 10978, 11038,
- 11099, 11159, 11220, 11280, 11341, 11401, 11461, 11522,
- 11582, 11642, 11702, 11762, 11822, 11882, 11942, 12002,
- 12062, 12122, 12181, 12241, 12301, 12360, 12420, 12479,
- 12539, 12598, 12658, 12717, 12776, 12835, 12895, 12954,
- 13013, 13072, 13131, 13190, 13249, 13307, 13366, 13425,
- 13484, 13542, 13601, 13659, 13718, 13776, 13834, 13893,
- 13951, 14009, 14067, 14125, 14183, 14241, 14299, 14357,
- 14415, 14473, 14530, 14588, 14646, 14703, 14761, 14818,
- 14875, 14933, 14990, 15047, 15104, 15161, 15218, 15275,
- 15332, 15389, 15446, 15502, 15559, 15616, 15672, 15729,
- 15785, 15841, 15898, 15954, 16010, 16066, 16122, 16178,
- 16234, 16290, 16346, 16402, 16457, 16513, 16568, 16624,
- 16679, 16735, 16790, 16845, 16900, 16955, 17010, 17065,
- 17120, 17175, 17230, 17284, 17339, 17394, 17448, 17503,
- 17557, 17611, 17665, 17720, 17774, 17828, 17882, 17936,
- 17989, 18043, 18097, 18150, 18204, 18257, 18311, 18364,
- 18417, 18470, 18524, 18577, 18630, 18682, 18735, 18788,
- 18841, 18893, 18946, 18998, 19051, 19103, 19155, 19207,
- 19259, 19311, 19363, 19415, 19467, 19519, 19570, 19622,
- 19673, 19725, 19776, 19827, 19879, 19930, 19981, 20032,
- 20083, 20133, 20184, 20235, 20285, 20336, 20386, 20437,
- 20487, 20537, 20587, 20637, 20687, 20737, 20787, 20836,
- 20886, 20936, 20985, 21034, 21084, 21133, 21182, 21231,
- 21280, 21329, 21378, 21426, 21475, 21524, 21572, 21620,
- 21669, 21717, 21765, 21813, 21861, 21909, 21957, 22004,
- 22052, 22100, 22147, 22194, 22242, 22289, 22336, 22383,
- 22430, 22477, 22524, 22570, 22617, 22663, 22710, 22756,
- 22802, 22849, 22895, 22941, 22987, 23032, 23078, 23124,
- 23169, 23215, 23260, 23305, 23351, 23396, 23441, 23486,
- 23530, 23575, 23620, 23664, 23709, 23753, 23797, 23842,
- 23886, 23930, 23974, 24017, 24061, 24105, 24148, 24192,
- 24235, 24278, 24321, 24364, 24407, 24450, 24493, 24536,
- 24578, 24621, 24663, 24706, 24748, 24790, 24832, 24874,
- 24916, 24957, 24999, 25041, 25082, 25123, 25165, 25206,
- 25247, 25288, 25329, 25370, 25410, 25451, 25491, 25532,
- 25572, 25612, 25652, 25692, 25732, 25772, 25811, 25851,
- 25891, 25930, 25969, 26008, 26047, 26086, 26125, 26164,
- 26203, 26241, 26280, 26318, 26356, 26395, 26433, 26471,
- 26509, 26546, 26584, 26622, 26659, 26696, 26734, 26771,
- 26808, 26845, 26882, 26918, 26955, 26991, 27028, 27064,
- 27100, 27137, 27173, 27208, 27244, 27280, 27316, 27351,
- 27386, 27422, 27457, 27492, 27527, 27562, 27596, 27631,
- 27666, 27700, 27734, 27769, 27803, 27837, 27871, 27904,
- 27938, 27972, 28005, 28038, 28072, 28105, 28138, 28171,
- 28203, 28236, 28269, 28301, 28334, 28366, 28398, 28430,
- 28462, 28494, 28525, 28557, 28589, 28620, 28651, 28682,
- 28713, 28744, 28775, 28806, 28837, 28867, 28897, 28928,
- 28958, 28988, 29018, 29048, 29077, 29107, 29136, 29166,
- 29195, 29224, 29253, 29282, 29311, 29340, 29368, 29397,
- 29425, 29453, 29482, 29510, 29537, 29565, 29593, 29621,
- 29648, 29675, 29703, 29730, 29757, 29784, 29810, 29837,
- 29863, 29890, 29916, 29942, 29968, 29994, 30020, 30046,
- 30072, 30097, 30122, 30148, 30173, 30198, 30223, 30248,
- 30272, 30297, 30321, 30346, 30370, 30394, 30418, 30442,
- 30465, 30489, 30513, 30536, 30559, 30582, 30605, 30628,
- 30651, 30674, 30696, 30719, 30741, 30763, 30786, 30807,
- 30829, 30851, 30873, 30894, 30916, 30937, 30958, 30979,
- 31000, 31021, 31041, 31062, 31082, 31103, 31123, 31143,
- 31163, 31183, 31202, 31222, 31241, 31261, 31280, 31299,
- 31318, 31337, 31356, 31374, 31393, 31411, 31429, 31447,
- 31465, 31483, 31501, 31519, 31536, 31554, 31571, 31588,
- 31605, 31622, 31639, 31656, 31672, 31689, 31705, 31721,
- 31737, 31753, 31769, 31785, 31800, 31816, 31831, 31846,
- 31861, 31876, 31891, 31906, 31920, 31935, 31949, 31963,
- 31977, 31991, 32005, 32019, 32033, 32046, 32059, 32073,
- 32086, 32099, 32112, 32124, 32137, 32149, 32162, 32174,
- 32186, 32198, 32210, 32222, 32233, 32245, 32256, 32267,
- 32279, 32290, 32300, 32311, 32322, 32332, 32343, 32353,
- 32363, 32373, 32383, 32393, 32402, 32412, 32421, 32430,
- 32440, 32449, 32457, 32466, 32475, 32483, 32492, 32500,
- 32508, 32516, 32524, 32532, 32539, 32547, 32554, 32561,
- 32569, 32576, 32582, 32589, 32596, 32602, 32609, 32615,
- 32621, 32627, 32633, 32639, 32644, 32650, 32655, 32660,
- 32665, 32670, 32675, 32680, 32685, 32689, 32694, 32698,
- 32702, 32706, 32710, 32713, 32717, 32720, 32724, 32727,
- 32730, 32733, 32736, 32739, 32741, 32744, 32746, 32748,
- 32750, 32752, 32754, 32756, 32757, 32759, 32760, 32761,
- 32762, 32763, 32764, 32765, 32765, 32766, 32766, 32766
-};
-
-const Word16 cos_scale_tbl_800[800] = { /* Q15 */
- 0, 64, 128, 193, 257, 321, 386, 450,
- 514, 579, 643, 707, 771, 836, 900, 964,
- 1029, 1093, 1157, 1222, 1286, 1350, 1414, 1479,
- 1543, 1607, 1672, 1736, 1800, 1864, 1929, 1993,
- 2057, 2121, 2185, 2250, 2314, 2378, 2442, 2506,
- 2570, 2635, 2699, 2763, 2827, 2891, 2955, 3019,
- 3083, 3147, 3211, 3275, 3339, 3403, 3467, 3531,
- 3595, 3659, 3723, 3787, 3851, 3915, 3979, 4042,
- 4106, 4170, 4234, 4298, 4361, 4425, 4489, 4553,
- 4616, 4680, 4744, 4807, 4871, 4935, 4998, 5062,
- 5125, 5189, 5252, 5316, 5379, 5443, 5506, 5570,
- 5633, 5696, 5760, 5823, 5886, 5950, 6013, 6076,
- 6139, 6203, 6266, 6329, 6392, 6455, 6518, 6581,
- 6644, 6707, 6770, 6833, 6896, 6959, 7022, 7085,
- 7147, 7210, 7273, 7336, 7398, 7461, 7524, 7586,
- 7649, 7711, 7774, 7836, 7899, 7961, 8024, 8086,
- 8148, 8211, 8273, 8335, 8397, 8460, 8522, 8584,
- 8646, 8708, 8770, 8832, 8894, 8956, 9018, 9079,
- 9141, 9203, 9265, 9326, 9388, 9450, 9511, 9573,
- 9634, 9696, 9757, 9819, 9880, 9941, 10003, 10064,
- 10125, 10186, 10247, 10308, 10370, 10431, 10491, 10552,
- 10613, 10674, 10735, 10796, 10856, 10917, 10978, 11038,
- 11099, 11159, 11220, 11280, 11341, 11401, 11461, 11522,
- 11582, 11642, 11702, 11762, 11822, 11882, 11942, 12002,
- 12062, 12122, 12181, 12241, 12301, 12360, 12420, 12479,
- 12539, 12598, 12658, 12717, 12776, 12835, 12895, 12954,
- 13013, 13072, 13131, 13190, 13249, 13307, 13366, 13425,
- 13484, 13542, 13601, 13659, 13718, 13776, 13834, 13893,
- 13951, 14009, 14067, 14125, 14183, 14241, 14299, 14357,
- 14415, 14473, 14530, 14588, 14646, 14703, 14761, 14818,
- 14875, 14933, 14990, 15047, 15104, 15161, 15218, 15275,
- 15332, 15389, 15446, 15502, 15559, 15616, 15672, 15729,
- 15785, 15841, 15898, 15954, 16010, 16066, 16122, 16178,
- 16234, 16290, 16346, 16402, 16457, 16513, 16568, 16624,
- 16679, 16735, 16790, 16845, 16900, 16955, 17010, 17065,
- 17120, 17175, 17230, 17284, 17339, 17394, 17448, 17503,
- 17557, 17611, 17665, 17720, 17774, 17828, 17882, 17936,
- 17989, 18043, 18097, 18150, 18204, 18257, 18311, 18364,
- 18417, 18470, 18524, 18577, 18630, 18682, 18735, 18788,
- 18841, 18893, 18946, 18998, 19051, 19103, 19155, 19207,
- 19259, 19311, 19363, 19415, 19467, 19519, 19570, 19622,
- 19673, 19725, 19776, 19827, 19879, 19930, 19981, 20032,
- 20083, 20133, 20184, 20235, 20285, 20336, 20386, 20437,
- 20487, 20537, 20587, 20637, 20687, 20737, 20787, 20836,
- 20886, 20936, 20985, 21034, 21084, 21133, 21182, 21231,
- 21280, 21329, 21378, 21426, 21475, 21524, 21572, 21620,
- 21669, 21717, 21765, 21813, 21861, 21909, 21957, 22004,
- 22052, 22100, 22147, 22194, 22242, 22289, 22336, 22383,
- 22430, 22477, 22524, 22570, 22617, 22663, 22710, 22756,
- 22802, 22849, 22895, 22941, 22987, 23032, 23078, 23124,
- 23169, 23215, 23260, 23305, 23351, 23396, 23441, 23486,
- 23530, 23575, 23620, 23664, 23709, 23753, 23797, 23842,
- 23886, 23930, 23974, 24017, 24061, 24105, 24148, 24192,
- 24235, 24278, 24321, 24364, 24407, 24450, 24493, 24536,
- 24578, 24621, 24663, 24706, 24748, 24790, 24832, 24874,
- 24916, 24957, 24999, 25041, 25082, 25123, 25165, 25206,
- 25247, 25288, 25329, 25370, 25410, 25451, 25491, 25532,
- 25572, 25612, 25652, 25692, 25732, 25772, 25811, 25851,
- 25891, 25930, 25969, 26008, 26047, 26086, 26125, 26164,
- 26203, 26241, 26280, 26318, 26356, 26395, 26433, 26471,
- 26509, 26546, 26584, 26622, 26659, 26696, 26734, 26771,
- 26808, 26845, 26882, 26918, 26955, 26991, 27028, 27064,
- 27100, 27137, 27173, 27208, 27244, 27280, 27316, 27351,
- 27386, 27422, 27457, 27492, 27527, 27562, 27596, 27631,
- 27666, 27700, 27734, 27769, 27803, 27837, 27871, 27904,
- 27938, 27972, 28005, 28038, 28072, 28105, 28138, 28171,
- 28203, 28236, 28269, 28301, 28334, 28366, 28398, 28430,
- 28462, 28494, 28525, 28557, 28589, 28620, 28651, 28682,
- 28713, 28744, 28775, 28806, 28837, 28867, 28897, 28928,
- 28958, 28988, 29018, 29048, 29077, 29107, 29136, 29166,
- 29195, 29224, 29253, 29282, 29311, 29340, 29368, 29397,
- 29425, 29453, 29482, 29510, 29537, 29565, 29593, 29621,
- 29648, 29675, 29703, 29730, 29757, 29784, 29810, 29837,
- 29863, 29890, 29916, 29942, 29968, 29994, 30020, 30046,
- 30072, 30097, 30122, 30148, 30173, 30198, 30223, 30248,
- 30272, 30297, 30321, 30346, 30370, 30394, 30418, 30442,
- 30465, 30489, 30513, 30536, 30559, 30582, 30605, 30628,
- 30651, 30674, 30696, 30719, 30741, 30763, 30786, 30807,
- 30829, 30851, 30873, 30894, 30916, 30937, 30958, 30979,
- 31000, 31021, 31041, 31062, 31082, 31103, 31123, 31143,
- 31163, 31183, 31202, 31222, 31241, 31261, 31280, 31299,
- 31318, 31337, 31356, 31374, 31393, 31411, 31429, 31447,
- 31465, 31483, 31501, 31519, 31536, 31554, 31571, 31588,
- 31605, 31622, 31639, 31656, 31672, 31689, 31705, 31721,
- 31737, 31753, 31769, 31785, 31800, 31816, 31831, 31846,
- 31861, 31876, 31891, 31906, 31920, 31935, 31949, 31963,
- 31977, 31991, 32005, 32019, 32033, 32046, 32059, 32073,
- 32086, 32099, 32112, 32124, 32137, 32149, 32162, 32174,
- 32186, 32198, 32210, 32222, 32233, 32245, 32256, 32267,
- 32279, 32290, 32300, 32311, 32322, 32332, 32343, 32353,
- 32363, 32373, 32383, 32393, 32402, 32412, 32421, 32430,
- 32440, 32449, 32457, 32466, 32475, 32483, 32492, 32500,
- 32508, 32516, 32524, 32532, 32539, 32547, 32554, 32561,
- 32569, 32576, 32582, 32589, 32596, 32602, 32609, 32615,
- 32621, 32627, 32633, 32639, 32644, 32650, 32655, 32660,
- 32665, 32670, 32675, 32680, 32685, 32689, 32694, 32698,
- 32702, 32706, 32710, 32713, 32717, 32720, 32724, 32727,
- 32730, 32733, 32736, 32739, 32741, 32744, 32746, 32748,
- 32750, 32752, 32754, 32756, 32757, 32759, 32760, 32761,
- 32762, 32763, 32764, 32765, 32765, 32766, 32766, 32766
-};
-
-const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2] = /* 2 subvectors Q11*/
- {
- {
- 3129,
- 0,
- 0,
- 3137,
- 0,
- 0,
- },
- {
- 3287,
- 0,
- 0,
- 3137,
- 0,
- 0,
- },
- {
- 2611,
- 5033,
- 0,
- 3137,
- 0,
- 0,
- },
- {
- 2611,
- 5033,
- 0,
- 3340,
- 0,
- 0,
- },
- {
- 2164,
- 3674,
- 5931,
- 2363,
- 3809,
- 6281,
- },
- {
- 1898,
- 2985,
- 4745,
- 2115,
- 3667,
- 7045,
- },
- {
- 2629,
- 5480,
- 0,
- 2971,
- 0,
- 0,
- },
- {
- 2801,
- 0,
- 0,
- 2869,
- 5072,
- 0,
- },
- {
- 1763,
- 2545,
- 3723,
- 2514,
- 4558,
- 21108,
- },
- {
- 2195,
- 3960,
- 7440,
- 2500,
- 6017,
- 21960,
- },
- {
- 1841,
- 2902,
- 1386,
- 2115,
- 3762,
- 22308,
- },
- {
- 1699,
- 2709,
- 1288,
- 1865,
- 3246,
- 20660,
- },
- {
- 3221,
- 0,
- 0,
- 3391,
- 0,
- 0,
- },
- {
- 2537,
- 4923,
- 0,
- 3186,
- 0,
- 0,
- },
- {
- 2816,
- 4229,
- 6397,
- 3676,
- 0,
- 0,
- },
- {
- 2816,
- 4229,
- 6397,
- 3893,
- 0,
- 0,
- },
- {
- 2160,
- 3481,
- 9091,
- 3391,
- 0,
- 0,
- },
- {
- 2560,
- 4923,
- 8462,
- 2775,
- 4835,
- 0,
- },
- {
- 2551,
- 3803,
- 5619,
- 3072,
- 5537,
- 0,
- },
- {
- 2545,
- 4206,
- 7450,
- 3229,
- 0,
- 0,
- },
- {
- 2162,
- 3655,
- 9263,
- 2699,
- 5296,
- 0,
- },
- {
- 2039,
- 3082,
- 6871,
- 2426,
- 3637,
- 5586,
- },
- {
- 1902,
- 2840,
- 6875,
- 2211,
- 3483,
- 5908,
- },
- {
- 1888,
- 3057,
- 6899,
- 2211,
- 3483,
- 5908,
- },
- {
- 1888,
- 3057,
- 6899,
- 2183,
- 3469,
- 6420,
- },
- {
- 1888,
- 3057,
- 6899,
- 1970,
- 3174,
- 8081,
- },
- {
- 2633,
- 1855,
- 4960,
- 2301,
- 3477,
- 5083,
- },
- {
- 1527,
- 2269,
- 5875,
- 1964,
- 3033,
- 8001,
- },
- {
- 1576,
- 2445,
- 5781,
- 1857,
- 2871,
- 4333,
- },
- {
- 1531,
- 2258,
- 5869,
- 2420,
- 1660,
- 6823,
- },
- {
- 1566,
- 2318,
- 3776,
- 2543,
- 3876,
- 1888,
- },
- {
- 1568,
- 2320,
- 3780,
- 2183,
- 3360,
- 1665,
- },
- {
- 1386,
- 1972,
- 4356,
- 1486,
- 2215,
- 4513,
- },
- {
- 3356,
- 0,
- 0,
- 2494,
- 4425,
- 0,
- },
- {
- 2633,
- 5009,
- 0,
- 2887,
- 0,
- 0,
- },
- {
- 2224,
- 3538,
- 7696,
- 2494,
- 4425,
- 0,
- },
- {
- 2119,
- 3225,
- 9861,
- 2494,
- 4425,
- 0,
- },
- {
- 1974,
- 3139,
- 10121,
- 2494,
- 4425,
- 0,
- },
- {
- 1722,
- 2453,
- 4059,
- 2494,
- 4425,
- 0,
- },
- {
- 1839,
- 2658,
- 4472,
- 2490,
- 5455,
- 0,
- },
- {
- 1722,
- 2533,
- 4581,
- 2037,
- 3393,
- 5808,
- },
- {
- 1427,
- 2009,
- 4184,
- 1914,
- 3082,
- 1349,
- },
- {
- 1370,
- 1861,
- 2719,
- 2017,
- 1339,
- 3913,
- },
- {
- 2482,
- 3885,
- 0,
- 0,
- 0,
- 0,
- },
- {
- 2375,
- 3827,
- 6975,
- 0,
- 0,
- 0,
- },
- {
- 3395,
- 0,
- 0,
- 3883,
- 0,
- 0,
- },
- {
- 3563,
- 0,
- 0,
- 3883,
- 0,
- 0,
- },
- {
- 3346,
- 0,
- 0,
- 3418,
- 0,
- 0,
- },
- {
- 3563,
- 0,
- 0,
- 4128,
- 0,
- 0,
- },
- {
- 2820,
- 5218,
- 0,
- 3883,
- 0,
- 0,
- },
- {
- 2637,
- 4962,
- 0,
- 3418,
- 0,
- 0,
- },
- {
- 2482,
- 3885,
- 0,
- 3418,
- 0,
- 0,
- },
- {
- 2217,
- 3616,
- 6502,
- 3418,
- 0,
- 0,
- },
- {
- 2123,
- 3295,
- 8658,
- 3418,
- 0,
- 0,
- },
- {
- 2242,
- 3397,
- 5562,
- 2693,
- 5132,
- 0,
- },
- {
- 2387,
- 4024,
- 7483,
- 3452,
- 0,
- 0,
- },
- {
- 1927,
- 2838,
- 4548,
- 2693,
- 5132,
- 0,
- },
- {
- 1859,
- 2674,
- 3893,
- 2703,
- 5371,
- 0,
- },
- {
- 2201,
- 3618,
- 1617,
- 2703,
- 5371,
- 0,
- },
- {
- 2093,
- 3135,
- 1554,
- 2273,
- 3594,
- 5312,
- },
- {
- 2201,
- 3618,
- 1617,
- 2238,
- 3895,
- 6172,
- },
- {
- 1828,
- 3014,
- 1382,
- 2258,
- 3624,
- 5820,
- },
- {
- 1863,
- 3170,
- 1402,
- 2113,
- 3381,
- 5146,
- },
- {
- 1691,
- 2572,
- 1294,
- 2009,
- 3158,
- 4540,
- },
- {
- 2424,
- 3706,
- 5654,
- 0,
- 0,
- 0,
- },
- {
- 3299,
- 0,
- 0,
- 3313,
- 0,
- 0,
- },
- {
- 2424,
- 3706,
- 5654,
- 3174,
- 0,
- 0,
- },
- {
- 2424,
- 3706,
- 5654,
- 3313,
- 0,
- 0,
- },
- {
- 2177,
- 3557,
- 6113,
- 3313,
- 0,
- 0,
- },
- {
- 2207,
- 3737,
- 6475,
- 3008,
- 4605,
- 0,
- },
- {
- 2816,
- 1873,
- 4263,
- 3008,
- 4605,
- 0,
- },
- {
- 1966,
- 2914,
- 1433,
- 2682,
- 4366,
- 0,
- },
- {
- 2301,
- 1626,
- 3895,
- 2627,
- 4714,
- 0,
- },
- {
- 2205,
- 3536,
- 1570,
- 2560,
- 3995,
- 6105,
- },
- {
- 1910,
- 3012,
- 1402,
- 2560,
- 3995,
- 6105,
- },
- {
- 1898,
- 3276,
- 1380,
- 2363,
- 3637,
- 5844,
- },
- {
- 2144,
- 1478,
- 3655,
- 2162,
- 3362,
- 5531,
- },
- {
- 1988,
- 1409,
- 3090,
- 2136,
- 3543,
- 6002,
- },
- {
- 1882,
- 1355,
- 2799,
- 2164,
- 3702,
- 6285,
- },
- {
- 3311,
- 0,
- 0,
- 3393,
- 0,
- 0,
- },
- {
- 2611,
- 4706,
- 0,
- 3201,
- 0,
- 0,
- },
- {
- 2820,
- 5218,
- 0,
- 4128,
- 0,
- 0,
- },
- {
- 2660,
- 4134,
- 0,
- 4128,
- 0,
- 0,
- },
- {
- 2678,
- 4820,
- 0,
- 2840,
- 0,
- 0,
- },
- {
- 2643,
- 4952,
- 0,
- 2775,
- 5003,
- 0,
- },
- {
- 2402,
- 3618,
- 5726,
- 3252,
- 6201,
- 0,
- },
- {
- 2209,
- 3622,
- 6168,
- 2840,
- 0,
- 0,
- },
- {
- 2209,
- 3622,
- 6168,
- 2713,
- 5232,
- 0,
- },
- {
- 1992,
- 2850,
- 4124,
- 3262,
- 6518,
- 0,
- },
- {
- 2353,
- 3835,
- 1736,
- 3262,
- 6518,
- 0,
- },
- {
- 1837,
- 2744,
- 5332,
- 2191,
- 3459,
- 5175,
- },
- {
- 2353,
- 3835,
- 1736,
- 2701,
- 4685,
- 7550,
- },
- {
- 1837,
- 2744,
- 5332,
- 1923,
- 2977,
- 4265,
- },
- {
- 1853,
- 2717,
- 5322,
- 2271,
- 1591,
- 3491,
- },
- {
- 1560,
- 2254,
- 4831,
- 1923,
- 2977,
- 4265,
- },
- {
- 1626,
- 2510,
- 6512,
- 2271,
- 1591,
- 3491,
- },
- {
- 3336,
- 0,
- 0,
- 2439,
- 4528,
- 0,
- },
- {
- 2615,
- 5236,
- 0,
- 2799,
- 0,
- 0,
- },
- {
- 2215,
- 3606,
- 8046,
- 2439,
- 4528,
- 0,
- },
- {
- 2084,
- 3143,
- 5750,
- 2439,
- 4528,
- 0,
- },
- {
- 1933,
- 3024,
- 5658,
- 2439,
- 4528,
- 0,
- },
- {
- 1863,
- 3571,
- 6793,
- 2439,
- 4528,
- 0,
- },
- {
- 1884,
- 3375,
- 6283,
- 1984,
- 3446,
- 8095,
- },
- {
- 1513,
- 2275,
- 5517,
- 1800,
- 2889,
- 4720,
- },
- {
- 1452,
- 2113,
- 5564,
- 1658,
- 2549,
- 3735,
- },
- {
- 1552,
- 2285,
- 4022,
- 4139,
- 1634,
- 2496,
- },
- {
- 1431,
- 2117,
- 4050,
- 4139,
- 1634,
- 2496,
- },
- {
- 1486,
- 2150,
- 3778,
- 2775,
- 1761,
- 4515,
- },
- {
- 1386,
- 2041,
- 3418,
- 2775,
- 1761,
- 4515,
- },
- {
- 3371,
- 0,
- 0,
- 2568,
- 5036,
- 0,
- },
- {
- 3031,
- 6023,
- 0,
- 3733,
- 0,
- 0,
- },
- {
- 2801,
- 4704,
- 0,
- 3733,
- 0,
- 0,
- },
- {
- 2801,
- 4704,
- 0,
- 4065,
- 0,
- 0,
- },
- {
- 2197,
- 3815,
- 6617,
- 3436,
- 0,
- 0,
- },
- {
- 2197,
- 3815,
- 6617,
- 2568,
- 5036,
- 0,
- },
- {
- 2162,
- 3229,
- 5052,
- 3698,
- 6123,
- 0,
- },
- {
- 2314,
- 3723,
- 1712,
- 4065,
- 0,
- 0,
- },
- {
- 1947,
- 3055,
- 5111,
- 2570,
- 6084,
- 0,
- },
- {
- 2351,
- 3770,
- 1665,
- 2570,
- 6084,
- 0,
- },
- {
- 2351,
- 1656,
- 3932,
- 3133,
- 5603,
- 0,
- },
- {
- 2469,
- 1742,
- 4464,
- 3098,
- 6504,
- 0,
- },
- {
- 1646,
- 2457,
- 4046,
- 3080,
- 6574,
- 0,
- },
- {
- 2336,
- 1650,
- 3921,
- 4040,
- 2387,
- 7604,
- },
- {
- 2289,
- 1593,
- 4149,
- 2537,
- 4380,
- 7731,
- },
- {
- 1576,
- 2322,
- 3921,
- 2521,
- 4706,
- 7946,
- },
- {
- 2099,
- 1452,
- 3545,
- 2521,
- 4706,
- 7946,
- },
- {
- 1980,
- 1460,
- 3385,
- 3768,
- 2252,
- 5793,
- },
- {
- 2025,
- 1429,
- 3278,
- 2224,
- 4022,
- 5902,
- },
- {
- 1232,
- 1779,
- 2904,
- 2588,
- 1564,
- 4542,
- },
- {
- 1746,
- 3622,
- 9062,
- 2048,
- 2048,
- 2048,
- },
- {
- 2070,
- 3405,
- 9017,
- 3231,
- 0,
- 0,
- },
- {
- 2070,
- 3405,
- 9017,
- 2461,
- 4964,
- 0,
- },
- {
- 1804,
- 3313,
- 8470,
- 2461,
- 4964,
- 0,
- },
- {
- 1734,
- 3667,
- 9146,
- 2461,
- 4964,
- 0,
- },
- {
- 1372,
- 2277,
- 4892,
- 2461,
- 4964,
- 0,
- },
- {
- 2316,
- 3717,
- 1630,
- 2590,
- 5722,
- 0,
- },
- {
- 1167,
- 1646,
- 2451,
- 2379,
- 3991,
- 1490,
- },
- {
- 2140,
- 3248,
- 7688,
- 3418,
- 0,
- 0,
- },
- {
- 2252,
- 3284,
- 4700,
- 2732,
- 4962,
- 0,
- },
- {
- 2234,
- 3588,
- 6479,
- 2881,
- 0,
- 0,
- },
- {
- 2234,
- 3588,
- 6479,
- 2756,
- 5171,
- 0,
- },
- {
- 2234,
- 3588,
- 6479,
- 2230,
- 3448,
- 5167,
- },
- {
- 1925,
- 2762,
- 3897,
- 2455,
- 3665,
- 5251,
- },
- {
- 1802,
- 2621,
- 5783,
- 2250,
- 3553,
- 0,
- },
- {
- 1701,
- 2488,
- 5994,
- 2230,
- 3497,
- 5076,
- },
- {
- 1781,
- 2717,
- 5951,
- 2183,
- 3520,
- 5480,
- },
- {
- 1566,
- 6379,
- 3723,
- 2299,
- 4728,
- 9779,
- },
- {
- 1581,
- 2297,
- 4814,
- 2961,
- 1933,
- 4243,
- },
- {
- 1435,
- 2000,
- 3559,
- 1939,
- 2975,
- 4263,
- },
- {
- 1472,
- 2091,
- 3483,
- 2291,
- 1626,
- 3473,
- },
- {
- 1718,
- 1310,
- 3117,
- 2289,
- 3475,
- 1630,
- },
- {
- 1718,
- 1310,
- 3117,
- 1968,
- 3008,
- 1447,
- },
- {
- 1310,
- 1810,
- 3547,
- 1546,
- 2232,
- 3170,
- },
- {
- 2494,
- 1630,
- 4675,
- 2641,
- 6809,
- 0,
- },
- {
- 3256,
- 1710,
- 9084,
- 2246,
- 6287,
- 0,
- },
- {
- 2035,
- 5359,
- 0,
- 2234,
- 4573,
- 7079,
- },
- {
- 1816,
- 3221,
- 7256,
- 2228,
- 3741,
- 6281,
- },
- {
- 1714,
- 2535,
- 3897,
- 2658,
- 5728,
- 0,
- },
- {
- 2330,
- 5787,
- 0,
- 2265,
- 5726,
- 8992,
- },
- {
- 1927,
- 3954,
- 9160,
- 1394,
- 2592,
- 4767,
- },
- {
- 2768,
- 8871,
- 0,
- 1679,
- 3164,
- 8550,
- },
- {
- 2750,
- 7387,
- 0,
- 1759,
- 2975,
- 5304,
- },
- {
- 2473,
- 5611,
- 0,
- 1554,
- 2539,
- 4468,
- },
- {
- 2299,
- 5603,
- 0,
- 1789,
- 3067,
- 5296,
- },
- {
- 1882,
- 5060,
- 0,
- 1259,
- 2195,
- 4292,
- },
- {
- 3170,
- 9232,
- 0,
- 1689,
- 4460,
- 8816,
- },
- {
- 2492,
- 5935,
- 0,
- 1509,
- 2492,
- 3952,
- },
- {
- 1998,
- 4485,
- 11706,
- 3084,
- 1314,
- 8624,
- },
- {
- 2267,
- 5314,
- 0,
- 2666,
- 1236,
- 1802,
- }
- };
-const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2] = /* 2 subvectors 20 modes Q11 */
- {
- {
- 2998,
- 4861,
- 0,
- 0,
- 0,
- 0,
- },
- {
- 2629,
- 4421,
- 0,
- 0,
- 0,
- 0,
- },
- {
- 2549,
- 5304,
- 0,
- 0,
- 0,
- 0,
- },
- {
- 2338,
- 3805,
- 5994,
- 0,
- 0,
- 0,
- },
- {
- 2125,
- 3762,
- 6162,
- 0,
- 0,
- 0,
- },
- {
- 3102,
- 0,
- 0,
- 3153,
- 0,
- 0,
- },
- {
- 3244,
- 0,
- 0,
- 3153,
- 0,
- 0,
- },
- {
- 3244,
- 0,
- 0,
- 3317,
- 0,
- 0,
- },
- {
- 2629,
- 4421,
- 0,
- 3317,
- 0,
- 0,
- },
- {
- 2549,
- 5304,
- 0,
- 3153,
- 0,
- 0,
- },
- {
- 2590,
- 5251,
- 0,
- 3354,
- 0,
- 0,
- },
- {
- 2338,
- 3805,
- 5994,
- 3317,
- 0,
- 0,
- },
- {
- 2125,
- 3762,
- 6162,
- 3317,
- 0,
- 0,
- },
- {
- 2023,
- 3401,
- 5199,
- 3317,
- 0,
- 0,
- },
- {
- 2177,
- 3487,
- 5744,
- 2650,
- 4818,
- 0,
- },
- {
- 2177,
- 3926,
- 6273,
- 2795,
- 0,
- 0,
- },
- {
- 1871,
- 2891,
- 4552,
- 2650,
- 4818,
- 0,
- },
- {
- 1843,
- 2887,
- 4616,
- 2658,
- 4941,
- 0,
- },
- {
- 1806,
- 2869,
- 4919,
- 2689,
- 4999,
- 0,
- },
- {
- 2777,
- 1775,
- 4868,
- 2191,
- 3452,
- 5214,
- },
- {
- 1732,
- 2760,
- 5214,
- 2203,
- 3567,
- 5443,
- },
- {
- 1730,
- 2824,
- 5255,
- 2086,
- 3229,
- 5003,
- },
- {
- 1548,
- 2435,
- 5732,
- 2220,
- 3694,
- 5648,
- },
- {
- 1546,
- 2494,
- 5777,
- 1933,
- 2934,
- 4040,
- },
- {
- 1525,
- 2451,
- 5935,
- 2543,
- 1726,
- 3997,
- },
- {
- 1482,
- 2529,
- 6025,
- 2570,
- 1736,
- 4096,
- },
- {
- 1406,
- 2279,
- 4788,
- 1746,
- 2719,
- 3981,
- },
- {
- 1327,
- 2107,
- 3760,
- 1748,
- 2777,
- 4016,
- },
- {
- 1243,
- 1912,
- 3106,
- 1603,
- 2484,
- 3141,
- },
- {
- 1226,
- 1853,
- 3131,
- 1497,
- 2275,
- 3072,
- },
- {
- 1327,
- 2107,
- 3760,
- 1406,
- 2166,
- 3891,
- },
- {
- 3303,
- 0,
- 0,
- 0,
- 0,
- 0,
- },
- {
- 2594,
- 5068,
- 0,
- 3315,
- 0,
- 0,
- },
- {
- 2076,
- 3338,
- 5046,
- 2631,
- 4405,
- 0,
- },
- {
- 1828,
- 2846,
- 4739,
- 3000,
- 4708,
- 0,
- },
- {
- 1904,
- 2869,
- 4403,
- 2621,
- 4616,
- 0,
- },
- {
- 1828,
- 2846,
- 4739,
- 2613,
- 4517,
- 6111,
- },
- {
- 1828,
- 2846,
- 4739,
- 2121,
- 3371,
- 5060,
- },
- {
- 1755,
- 2738,
- 5046,
- 2136,
- 3543,
- 5376,
- },
- {
- 1566,
- 2496,
- 3180,
- 2121,
- 3371,
- 5060,
- },
- {
- 1615,
- 2719,
- 3383,
- 2154,
- 3653,
- 5541,
- },
- {
- 1564,
- 2506,
- 3184,
- 1884,
- 2955,
- 4167,
- },
- {
- 1357,
- 2172,
- 2535,
- 2824,
- 1839,
- 3995,
- },
- {
- 1378,
- 2260,
- 2674,
- 2578,
- 1695,
- 4001,
- },
- {
- 1363,
- 2193,
- 2557,
- 1644,
- 2541,
- 3540,
- },
- {
- 1347,
- 2127,
- 2486,
- 1945,
- 1333,
- 2926,
- },
- {
- 3276,
- 0,
- 0,
- 3180,
- 0,
- 0,
- },
- {
- 2674,
- 4970,
- 0,
- 3235,
- 0,
- 0,
- },
- {
- 2674,
- 4970,
- 0,
- 3432,
- 0,
- 0,
- },
- {
- 2560,
- 5926,
- 0,
- 3235,
- 0,
- 0,
- },
- {
- 2322,
- 4067,
- 6748,
- 3180,
- 0,
- 0,
- },
- {
- 2340,
- 4202,
- 6850,
- 3432,
- 0,
- 0,
- },
- {
- 2138,
- 4159,
- 7141,
- 3432,
- 0,
- 0,
- },
- {
- 2021,
- 3661,
- 5445,
- 3373,
- 0,
- 0,
- },
- {
- 1841,
- 3280,
- 5281,
- 3373,
- 0,
- 0,
- },
- {
- 1632,
- 2650,
- 4382,
- 3373,
- 0,
- 0,
- },
- {
- 1632,
- 2650,
- 4382,
- 2734,
- 4556,
- 0,
- },
- {
- 1517,
- 2357,
- 3719,
- 2734,
- 4556,
- 0,
- },
- {
- 2007,
- 3485,
- 1445,
- 2697,
- 5382,
- 0,
- },
- {
- 1632,
- 2650,
- 4382,
- 2428,
- 3956,
- 0,
- },
- {
- 1517,
- 2357,
- 3719,
- 2383,
- 3733,
- 5670,
- },
- {
- 1449,
- 2306,
- 3999,
- 2203,
- 3543,
- 5687,
- },
- {
- 1351,
- 2148,
- 3217,
- 2203,
- 3543,
- 5687,
- },
- {
- 1355,
- 2101,
- 3182,
- 2199,
- 3917,
- 6189,
- },
- {
- 1351,
- 2148,
- 3217,
- 2947,
- 1896,
- 4364,
- },
- {
- 1290,
- 1978,
- 3117,
- 2686,
- 1804,
- 4519,
- },
- {
- 1263,
- 1886,
- 2963,
- 2113,
- 3172,
- 1548,
- },
- {
- 3266,
- 0,
- 0,
- 3076,
- 0,
- 0,
- },
- {
- 2299,
- 3985,
- 7643,
- 3076,
- 0,
- 0,
- },
- {
- 2115,
- 4249,
- 8886,
- 2906,
- 5009,
- 0,
- },
- {
- 2017,
- 3672,
- 12216,
- 2623,
- 4759,
- 0,
- },
- {
- 1804,
- 3289,
- 14325,
- 2906,
- 5009,
- 0,
- },
- {
- 1728,
- 3239,
- 14376,
- 2623,
- 4759,
- 0,
- },
- {
- 1615,
- 3112,
- 14751,
- 2623,
- 4759,
- 0,
- },
- {
- 1779,
- 3168,
- 14325,
- 2109,
- 3592,
- 6352,
- },
- {
- 1673,
- 3055,
- 14581,
- 2109,
- 3592,
- 6352,
- },
- {
- 1546,
- 2830,
- 14608,
- 2109,
- 3592,
- 6352,
- },
- {
- 1445,
- 2693,
- 14796,
- 2109,
- 3592,
- 6352,
- },
- {
- 1411,
- 2654,
- 14929,
- 2080,
- 3840,
- 6633,
- },
- {
- 1429,
- 2611,
- 14764,
- 1871,
- 3170,
- 4982,
- },
- {
- 1390,
- 2693,
- 14929,
- 2516,
- 3778,
- 1665,
- },
- {
- 1390,
- 2693,
- 14929,
- 2433,
- 1581,
- 4003,
- },
- {
- 2070,
- 3639,
- 5652,
- 3305,
- 0,
- 0,
- },
- {
- 1974,
- 3235,
- 8183,
- 3540,
- 0,
- 0,
- },
- {
- 1798,
- 2949,
- 4687,
- 3540,
- 0,
- 0,
- },
- {
- 1744,
- 3364,
- 4974,
- 3540,
- 0,
- 0,
- },
- {
- 1746,
- 2830,
- 4231,
- 2549,
- 5486,
- 0,
- },
- {
- 2471,
- 1593,
- 4521,
- 2549,
- 5486,
- 0,
- },
- {
- 1646,
- 2772,
- 5421,
- 2883,
- 5355,
- 0,
- },
- {
- 1601,
- 2568,
- 5732,
- 2822,
- 5545,
- 0,
- },
- {
- 2471,
- 1593,
- 4521,
- 2074,
- 3751,
- 6252,
- },
- {
- 2471,
- 1593,
- 4521,
- 2908,
- 1785,
- 4771,
- },
- {
- 1398,
- 2080,
- 3661,
- 2306,
- 3862,
- 5988,
- },
- {
- 1284,
- 1878,
- 2965,
- 2306,
- 3862,
- 5988,
- },
- {
- 1347,
- 2105,
- 3188,
- 3035,
- 1996,
- 4397,
- },
- {
- 1626,
- 1187,
- 2725,
- 3035,
- 1996,
- 4397,
- },
- {
- 1685,
- 1212,
- 2709,
- 2756,
- 1832,
- 4726,
- },
- {
- 2248,
- 1511,
- 1136,
- 1779,
- 2641,
- 3813,
- },
- {
- 1552,
- 2275,
- 1126,
- 1783,
- 2799,
- 3903,
- },
- {
- 1128,
- 1568,
- 2285,
- 1619,
- 2459,
- 3405,
- },
- {
- 1128,
- 1568,
- 2285,
- 1972,
- 1427,
- 2709,
- },
- {
- 1075,
- 1576,
- 2197,
- 1669,
- 2533,
- 1161,
- },
- {
- 2191,
- 3667,
- 7993,
- 3274,
- 0,
- 0,
- },
- {
- 1679,
- 2492,
- 4278,
- 2570,
- 4689,
- 0,
- },
- {
- 1597,
- 2394,
- 5109,
- 2570,
- 4689,
- 0,
- },
- {
- 2201,
- 1480,
- 4835,
- 2273,
- 4016,
- 7149,
- },
- {
- 1415,
- 2107,
- 4786,
- 2117,
- 3667,
- 8200,
- },
- {
- 1374,
- 2203,
- 5337,
- 1955,
- 3168,
- 5148,
- },
- {
- 2424,
- 1589,
- 4335,
- 2164,
- 3420,
- 1380,
- },
- {
- 1937,
- 2965,
- 5576,
- 2854,
- 5416,
- 9381,
- },
- {
- 1941,
- 2977,
- 5576,
- 4034,
- 2404,
- 7135,
- },
- {
- 1812,
- 2879,
- 5658,
- 4034,
- 2404,
- 7135,
- },
- {
- 2549,
- 1724,
- 4870,
- 4093,
- 2392,
- 7540,
- },
- {
- 1781,
- 2756,
- 5763,
- 3571,
- 2166,
- 5933,
- },
- {
- 1693,
- 2496,
- 4456,
- 3252,
- 5324,
- 2037,
- },
- {
- 1673,
- 2428,
- 4079,
- 3262,
- 1994,
- 5363,
- },
- {
- 1683,
- 2467,
- 4298,
- 2998,
- 1851,
- 4911,
- },
- {
- 1683,
- 2467,
- 4298,
- 4204,
- 1714,
- 2783,
- },
- {
- 1067,
- 1529,
- 2115,
- 1630,
- 2729,
- 1110,
- },
- {
- 3438,
- 0,
- 0,
- 2625,
- 5060,
- 0,
- },
- {
- 2228,
- 3786,
- 6543,
- 3454,
- 0,
- 0,
- },
- {
- 2228,
- 3786,
- 6543,
- 2625,
- 5060,
- 0,
- },
- {
- 2306,
- 3459,
- 1617,
- 2625,
- 5060,
- 0,
- },
- {
- 1904,
- 2830,
- 1396,
- 2625,
- 5060,
- 0,
- },
- {
- 2283,
- 1626,
- 3792,
- 2623,
- 6211,
- 0,
- },
- {
- 1720,
- 2818,
- 1275,
- 1638,
- 2899,
- 8724,
- },
- {
- 1640,
- 2351,
- 3690,
- 0,
- 0,
- 0,
- },
- {
- 2752,
- 5380,
- 0,
- 3223,
- 0,
- 0,
- },
- {
- 2580,
- 4188,
- 0,
- 3223,
- 0,
- 0,
- },
- {
- 2580,
- 4188,
- 0,
- 3430,
- 0,
- 0,
- },
- {
- 2230,
- 3710,
- 6496,
- 3434,
- 0,
- 0,
- },
- {
- 2230,
- 3899,
- 6596,
- 3115,
- 5396,
- 0,
- },
- {
- 1972,
- 2949,
- 4335,
- 3430,
- 0,
- 0,
- },
- {
- 1972,
- 2949,
- 4335,
- 2666,
- 4935,
- 0,
- },
- {
- 1730,
- 2482,
- 3960,
- 2689,
- 4954,
- 0,
- },
- {
- 1595,
- 2242,
- 3481,
- 2689,
- 4954,
- 0,
- },
- {
- 1480,
- 2078,
- 3407,
- 2689,
- 4954,
- 0,
- },
- {
- 2066,
- 3414,
- 1540,
- 2676,
- 6187,
- 0,
- },
- {
- 2058,
- 3373,
- 1533,
- 2179,
- 3831,
- 6856,
- },
- {
- 1832,
- 3051,
- 1396,
- 2179,
- 3831,
- 6856,
- },
- {
- 1611,
- 2605,
- 1245,
- 2179,
- 3831,
- 6856,
- },
- {
- 1763,
- 1327,
- 2988,
- 2179,
- 3831,
- 6856,
- },
- {
- 1697,
- 1292,
- 2738,
- 2168,
- 4161,
- 7020,
- },
- {
- 1763,
- 1327,
- 2988,
- 3155,
- 1884,
- 5142,
- },
- {
- 1736,
- 1296,
- 2781,
- 2883,
- 1800,
- 5552,
- },
- {
- 1828,
- 1335,
- 2945,
- 2203,
- 1474,
- 3674,
- },
- {
- 2783,
- 4722,
- 0,
- 3418,
- 0,
- 0,
- },
- {
- 2205,
- 3946,
- 7262,
- 3418,
- 0,
- 0,
- },
- {
- 2205,
- 4161,
- 7327,
- 2926,
- 5552,
- 0,
- },
- {
- 1705,
- 2566,
- 4311,
- 2627,
- 5234,
- 0,
- },
- {
- 1589,
- 2359,
- 3805,
- 2627,
- 5234,
- 0,
- },
- {
- 1472,
- 2183,
- 3547,
- 2627,
- 5234,
- 0,
- },
- {
- 1927,
- 1333,
- 3205,
- 1478,
- 2437,
- 3973,
- },
- {
- 2646,
- 5076,
- 0,
- 3155,
- 0,
- 0,
- },
- {
- 2461,
- 3897,
- 0,
- 3155,
- 0,
- 0,
- },
- {
- 2105,
- 3360,
- 5027,
- 3375,
- 0,
- 0,
- },
- {
- 2553,
- 1798,
- 4769,
- 3375,
- 0,
- 0,
- },
- {
- 1767,
- 2781,
- 5165,
- 3375,
- 0,
- 0,
- },
- {
- 1673,
- 2502,
- 4116,
- 2199,
- 3655,
- 5597,
- },
- {
- 1669,
- 1253,
- 2623,
- 2160,
- 3530,
- 6045,
- },
- {
- 3164,
- 0,
- 0,
- 3170,
- 0,
- 0,
- },
- {
- 3358,
- 0,
- 0,
- 3170,
- 0,
- 0,
- },
- {
- 2723,
- 0,
- 0,
- 3270,
- 0,
- 0,
- },
- {
- 2529,
- 4743,
- 0,
- 3270,
- 0,
- 0,
- },
- {
- 2635,
- 5629,
- 0,
- 3170,
- 0,
- 0,
- },
- {
- 2635,
- 5629,
- 0,
- 3387,
- 0,
- 0,
- },
- {
- 2437,
- 4149,
- 0,
- 3387,
- 0,
- 0,
- },
- {
- 1949,
- 3428,
- 5656,
- 3270,
- 0,
- 0,
- },
- {
- 1880,
- 3217,
- 6574,
- 3270,
- 0,
- 0,
- },
- {
- 2572,
- 1622,
- 4255,
- 3270,
- 0,
- 0,
- },
- {
- 1550,
- 2463,
- 3837,
- 3270,
- 0,
- 0,
- },
- {
- 1906,
- 2985,
- 5017,
- 2650,
- 5615,
- 0,
- },
- {
- 2287,
- 1507,
- 3840,
- 2562,
- 5257,
- 0,
- },
- {
- 1581,
- 2531,
- 3934,
- 2562,
- 5257,
- 0,
- },
- {
- 1796,
- 2859,
- 5605,
- 2213,
- 3719,
- 6881,
- },
- {
- 2316,
- 3350,
- 0,
- 2807,
- 0,
- 0,
- },
- {
- 1826,
- 3260,
- 7012,
- 2658,
- 6565,
- 0,
- },
- {
- 1792,
- 3168,
- 7084,
- 2631,
- 5937,
- 8499,
- },
- {
- 1732,
- 3379,
- 6772,
- 2611,
- 5009,
- 8202,
- },
- {
- 1654,
- 6285,
- 3514,
- 2611,
- 5009,
- 8202,
- },
- {
- 1566,
- 6406,
- 3733,
- 2611,
- 5009,
- 8202,
- },
- {
- 1912,
- 2615,
- 1490,
- 2369,
- 3475,
- 0,
- },
- {
- 1705,
- 2379,
- 1347,
- 2357,
- 3454,
- 0,
- },
- {
- 1538,
- 2113,
- 1224,
- 2357,
- 3454,
- 0,
- },
- {
- 1554,
- 6426,
- 3778,
- 1888,
- 3088,
- 6369,
- },
- {
- 1452,
- 2058,
- 1167,
- 2170,
- 3629,
- 5568,
- },
- {
- 1527,
- 2050,
- 1230,
- 2056,
- 3692,
- 5922,
- },
- {
- 1521,
- 2048,
- 1226,
- 1916,
- 3811,
- 5885,
- },
- {
- 1536,
- 6492,
- 3942,
- 1509,
- 2914,
- 5502,
- },
- {
- 1536,
- 6492,
- 3942,
- 1349,
- 2168,
- 4044,
- },
- {
- 1587,
- 1257,
- 2123,
- 1630,
- 2670,
- 3901,
- },
- {
- 1830,
- 2742,
- 5220,
- 2678,
- 5326,
- 0,
- },
- {
- 1703,
- 2568,
- 3966,
- 2676,
- 5353,
- 0,
- },
- {
- 1703,
- 2523,
- 3923,
- 2371,
- 4048,
- 0,
- },
- {
- 1689,
- 2580,
- 4081,
- 2095,
- 3561,
- 5726,
- },
- {
- 1536,
- 2281,
- 3201,
- 2140,
- 3690,
- 5490,
- },
- {
- 1417,
- 2048,
- 2930,
- 2095,
- 3561,
- 5726,
- },
- {
- 1474,
- 2072,
- 3272,
- 3096,
- 1896,
- 4376,
- },
- {
- 1394,
- 1992,
- 3377,
- 2828,
- 1794,
- 4360,
- },
- {
- 1400,
- 1974,
- 3358,
- 2392,
- 3637,
- 1611,
- },
- {
- 1368,
- 1914,
- 3176,
- 2080,
- 3108,
- 1458,
- },
- {
- 1349,
- 1865,
- 2918,
- 2738,
- 1820,
- 1314,
- },
- {
- 1349,
- 1865,
- 2918,
- 1718,
- 2635,
- 1243,
- },
- {
- 3344,
- 0,
- 0,
- 3454,
- 0,
- 0,
- },
- {
- 3463,
- 0,
- 0,
- 3428,
- 0,
- 0,
- },
- {
- 2719,
- 5251,
- 0,
- 3180,
- 0,
- 0,
- },
- {
- 2560,
- 4079,
- 0,
- 3180,
- 0,
- 0,
- },
- {
- 2560,
- 4079,
- 0,
- 3428,
- 0,
- 0,
- },
- {
- 2203,
- 3665,
- 6025,
- 3454,
- 0,
- 0,
- },
- {
- 2183,
- 3446,
- 8349,
- 3428,
- 0,
- 0,
- },
- {
- 2621,
- 1865,
- 5072,
- 3428,
- 0,
- 0,
- },
- {
- 1708,
- 2516,
- 3870,
- 3454,
- 0,
- 0,
- },
- {
- 1921,
- 2875,
- 4409,
- 2674,
- 5386,
- 0,
- },
- {
- 2744,
- 1814,
- 4751,
- 2674,
- 5386,
- 0,
- },
- {
- 1705,
- 2560,
- 3907,
- 2674,
- 5386,
- 0,
- },
- {
- 1705,
- 2484,
- 3835,
- 2304,
- 3766,
- 5773,
- },
- {
- 1748,
- 2594,
- 3743,
- 2138,
- 3604,
- 5902,
- },
- {
- 1566,
- 2379,
- 3461,
- 2097,
- 3559,
- 5812,
- },
- {
- 1484,
- 2150,
- 3667,
- 3031,
- 1888,
- 6356,
- },
- {
- 1458,
- 2072,
- 3172,
- 3059,
- 1849,
- 6889,
- },
- {
- 1349,
- 1898,
- 2779,
- 3059,
- 1849,
- 6889,
- },
- {
- 1683,
- 1257,
- 2637,
- 1863,
- 3090,
- 4618,
- },
- {
- 1722,
- 1277,
- 2617,
- 2377,
- 1560,
- 3702,
- },
- {
- 1716,
- 1273,
- 2592,
- 2211,
- 1456,
- 3502,
- },
- {
- 1703,
- 1267,
- 2611,
- 1921,
- 2928,
- 1318,
- },
- {
- 1810,
- 2762,
- 5263,
- 2691,
- 5343,
- 0,
- },
- {
- 2009,
- 3016,
- 5701,
- 3461,
- 6844,
- 0,
- },
- {
- 1976,
- 3100,
- 5500,
- 2885,
- 5089,
- 8081,
- },
- {
- 1998,
- 2983,
- 5453,
- 4405,
- 2603,
- 8552,
- },
- {
- 2029,
- 3080,
- 6320,
- 5091,
- 2693,
- 9277,
- },
- {
- 1937,
- 2965,
- 5576,
- 2854,
- 5416,
- 9381,
- },
- {
- 1456,
- 2084,
- 3307,
- 3035,
- 1886,
- 7026,
- },
- {
- 1390,
- 1994,
- 3397,
- 1941,
- 3172,
- 7061,
- },
- {
- 1701,
- 1265,
- 3033,
- 1910,
- 3100,
- 4730,
- },
- {
- 1671,
- 1249,
- 2871,
- 2920,
- 1796,
- 4638,
- },
- {
- 1611,
- 2574,
- 1220,
- 1759,
- 2963,
- 4978,
- },
- {
- 1611,
- 2574,
- 1220,
- 2265,
- 1505,
- 3397,
- }
- };
diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h
index 8a8ff7dd03e7d60d834f94ab6d6054f0f247d6f2..fd1a9221d375a241c1f1973df8e9af1f3d327240 100644
--- a/lib_com/rom_com.h
+++ b/lib_com/rom_com.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef ROM_COM_H
@@ -47,21 +47,17 @@
#define MINSFTAB 7
#define MAXSFTAB 25
#define INTERP_EXP 0
+
typedef struct
{
- Word32 fin_fx; /* input frequency Q0 */
- Word32 fout_fx; /* output frequency Q0 */
- Word16 fac_num_fx; /* numerator of resampling factor Q0 */
-
- Word16 fac_den_fx; /* denominator of resampling factor Q0 */
- Word16 lg_out; /* denominator of resampling factor Q15 */
-
+ Word32 fin_fx; /* input frequency Q0 */
+ Word32 fout_fx; /* output frequency Q0 */
+ Word16 fac_num_fx; /* numerator of resampling factor Q0 */
+ Word16 fac_den_fx; /* denominator of resampling factor Q0 */
+ Word16 lg_out; /* denominator of resampling factor Q15 */
const Word16 *filter_fx; /* resampling filter coefficients Q14 */
-
- Word16 filt_len_fx; /* number of filter coeff. Q0 */
- UWord16 flags_fx; /* flags from config. table Q0 */
- // UNS_Word16 flags_fx; /* flags from config. table Q0 */
-
+ Word16 filt_len_fx; /* number of filter coeff. Q0 */
+ UWord16 flags_fx; /* flags from config. table Q0 */
} Resampling_cfg;
typedef struct
@@ -70,27 +66,24 @@ typedef struct
Word16 bw; // Q0
const Word16 *band_width; // Q0
Word32 L_qint;
-
Word16 eref_fx;
Word16 eref;
-
Word16 bit_alloc_weight_fx;
Word16 bit_alloc_weight;
-
Word16 gqlevs; // Q0
Word16 Ngq; // Q0
Word16 p2a_bands; // Q0
-
Word16 p2a_th;
-
Word16 pd_thresh;
-
Word16 ld_slope;
-
Word16 ni_coef;
} Xcore_Config;
+/*-----------------------------------------------------------------*
+ * LP filters tables
+ *-----------------------------------------------------------------*/
+
extern const Word16 filter_LP15_180H_fx[]; // Q14 /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */
extern const Word16 filter_LP3_90H_fx[]; // Q14 /* Sincfilt.m: N=90*2+1, Fmin=0, Fmax=1/3, hann( N )' */
extern const Word16 filter_LP12_180H_13b_fx[]; // Q13/* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )' */
@@ -156,7 +149,6 @@ extern const Word16 inv_N_fx[32]; // Q15
extern const Word16 band_len_harm[]; // Q0
/* PVQ tables */
-
extern const Word32 thren_fx[39]; // Q8
/* Band structure */
@@ -169,8 +161,6 @@ extern const Word16 h_high_fx[5]; // Q15
extern const Word16 sincos_t_fx[161]; // Q15
extern const Word16 sincos_t_ext_fx[]; // Q15
extern const Word32 crit_bands_fx[];
-extern const float sincos_t_ext[]; // fft_rel dep
-extern const Word16 sincos_t_rad3_fx[]; // Q15
extern const Word16 fft256_read_indexes[]; /* FFT Q0*/
extern const Word16 inter4_2_fx[];
extern const Word16 pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1]; /*1Q14*/
@@ -336,17 +326,14 @@ extern const Word16 hq_swb_bwe_nb_bits[]; // Q0
/*----------------------------------------------------------------------------------*
* ISF quantization (AMR-WB IO mode)
*----------------------------------------------------------------------------------*/
-extern const Word16 Indirect_dico1[SIZE_BK1]; // Q0
-
-extern const Word16 mean_isf_amr_wb_fx[M]; /*Qlog2(2.56)*/ /* Mean ISF vector (only in AMR-WB IO mode) */
+extern const Word16 Indirect_dico1[SIZE_BK1]; // Q0
+extern const Word16 mean_isf_amr_wb_fx[M]; /*Qlog2(2.56)*/ /* Mean ISF vector (only in AMR-WB IO mode) */
extern const Word16 mean_isf_noise_amr_wb_fx[]; /*Qlog2(2.56)*/ /* Mean ISF vector for SID frame (only in AMR-WB IO mode) */
-
-extern const Word16 gaus_dico_fx[]; // Q12
-extern const Word16 gaus_dico_swb_fx[]; // Q15
+extern const Word16 gaus_dico_fx[]; // Q12
+extern const Word16 gaus_dico_swb_fx[]; // Q15
extern const Word16 dico1_isf_fx[]; /* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/
-
extern const Word16 dico2_isf_fx[]; /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) Qlog2(2.56)*/
extern const Word16 dico21_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/
@@ -356,9 +343,7 @@ extern const Word16 dico24_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 4th s
extern const Word16 dico25_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) Qlog2(2.56)*/
extern const Word16 dico21_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/
-
extern const Word16 dico22_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) Qlog2(2.56)*/
-
extern const Word16 dico23_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) Qlog2(2.56)*/
extern const Word16 dico1_ns_28b_fx[]; /*Qlog2(2.56)*/ /* ISF codebook for SID frames - 28b, 1st split Qlog2(2.56)*/
@@ -1126,13 +1111,6 @@ extern const Word16 CLDFB80_32[320]; // Q.5
extern const Word16 CLDFB80_40[400]; // Q.5
extern const Word16 CLDFB80_60[600]; // Q.5
extern const Word16 CLDFB80_30[300]; // Q.5
-extern const Word16 LDQMF_10_enc_fx[100];
-extern const Word16 LDQMF_16_enc_fx[160];
-extern const Word16 LDQMF_20_enc_fx[200];
-extern const Word16 LDQMF_30_enc_fx[300];
-extern const Word16 LDQMF_32_enc_fx[320];
-extern const Word16 LDQMF_40_enc_fx[400];
-extern const Word16 LDQMF_60_enc_fx[600];
extern const Word16 rRotVectr_10[]; // Q(sqrt(1.0/16.00))
extern const Word16 iRotVectr_10[]; // Q(sqrt(1.0/16.00))
@@ -1497,6 +1475,7 @@ extern const Word16 FFT_W256[]; // Q15
extern const Word16 FFT_W512[]; // Q15
extern const Word16 Gamma_19661_Tbl_fx[]; // Q15
extern const Word16 Gamma_29491_Tbl[]; // Q15
+
/*---------------------------------------------------------------------*
* NB post-filter tables
*---------------------------------------------------------------------*/
@@ -1587,4 +1566,69 @@ extern const Word16 sin_scale_tbl_800[800]; // Q15
extern const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2]; // Q11
extern const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2]; // Q11
+/*------------------------------------------------------------------------------*
+ * FFT transform tables
+ *------------------------------------------------------------------------------*/
+
+extern const Word16 w_fft64_fx[32]; // Q15
+extern const Word16 w_fft32_fx[16]; // Q15
+extern const Word16 w_fft16_fx[8]; // Q15
+extern const Word16 w_fft8_fx[8]; // Q15
+extern const Word16 w_fft128_fx[64]; // Q15
+extern const Word16 w_fft256_fx[128]; // Q15
+extern const Word16 w_fft512_fx[256]; // Q15
+extern const Word16 w_fft4_fx[2]; // Q15
+
+extern const Word16 FFT_RotVector_960_fx[1860]; // Q15
+extern const Word16 FFT_RotVector_640_fx[1240]; // Q15
+extern const Word16 FFT_RotVector_600_fx[1140]; // Q15
+extern const Word16 FFT_RotVector_400_fx[760]; // Q15
+extern const Word16 FFT_RotVector_256_fx[448]; // Q15
+extern const Word16 FFT_RotVector_32_fx[40]; // Q15
+
+extern const Word16 sincos_t_rad3_fx[T_SIN_PI_2 + 1]; // Q15
+
+extern const Word16 cos_twiddle_table_25_5_5[25]; // Q15
+extern const Word16 sin_twiddle_table_25_5_5[25]; // Q15
+extern const Word16 cos_twiddle_table_16_8_2[16]; // Q15
+extern const Word16 sin_twiddle_table_16_8_2[16]; // Q15
+
+extern const Word32 CLDFB80_10_fx[100]; // Q30
+extern const Word32 CLDFB80_16_fx[160]; // Q30
+extern const Word32 CLDFB80_20_fx[200]; // Q30
+extern const Word32 CLDFB80_30_fx[300]; // Q30
+extern const Word32 CLDFB80_32_fx[320]; // Q30
+extern const Word32 CLDFB80_40_fx[400]; // Q30
+extern const Word32 CLDFB80_60_fx[600]; // Q30
+
+/*5ms delay*/
+extern const Word32 LDQMF_10_fx[100]; // Q30
+extern const Word32 LDQMF_16_fx[160]; // Q30
+extern const Word32 LDQMF_20_fx[200]; // Q30
+extern const Word32 LDQMF_30_fx[300]; // Q30
+extern const Word32 LDQMF_32_fx[320]; // Q30
+extern const Word32 LDQMF_40_fx[400]; // Q30
+extern const Word32 LDQMF_60_fx[600]; // Q30
+
+extern const Word32 rot_vec_delay_re_LDQMF_fx[60]; // Q31
+extern const Word32 rot_vec_delay_im_LDQMF_fx[60]; // Q31
+
+extern const Word32 rot_vec_ana_re_L10_fx[5]; // Q29
+extern const Word32 rot_vec_ana_im_L10_fx[5]; // Q29
+extern const Word32 rot_vec_ana_re_L16_fx[8]; // Q29
+extern const Word32 rot_vec_ana_im_L16_fx[8]; // Q29
+extern const Word32 rot_vec_ana_re_L20_fx[10]; // Q29
+extern const Word32 rot_vec_ana_im_L20_fx[10]; // Q29
+extern const Word32 rot_vec_ana_re_L30_fx[15]; // Q29
+extern const Word32 rot_vec_ana_im_L30_fx[15]; // Q29
+extern const Word32 rot_vec_ana_re_L32_fx[16]; // Q29
+extern const Word32 rot_vec_ana_im_L32_fx[16]; // Q29
+extern const Word32 rot_vec_ana_re_L40_fx[20]; // Q29
+extern const Word32 rot_vec_ana_im_L40_fx[20]; // Q29
+extern const Word32 rot_vec_ana_re_L60_fx[30]; // Q29
+extern const Word32 rot_vec_ana_im_L60_fx[30]; // Q29
+
+extern const Word16 LP_assym_window_fx[]; /* Assymetric window for LP analysis @12.8kHz (Q15) */
+extern const Word16 LP_assym_window_16k_fx[]; /* Assymetric window for LP analysis @16kHz (Q15) */
+
#endif
diff --git a/lib_com/rom_com_fx.c b/lib_com/rom_com_fx.c
index 49f50e1622ba4a26b851bc236695c6e4b472078d..51d65d9171b7c32b9f5515e02f2869609e76af3f 100644
--- a/lib_com/rom_com_fx.c
+++ b/lib_com/rom_com_fx.c
@@ -31,19 +31,31149 @@
*******************************************************************************************************/
/*====================================================================================
- 3GPP TS26.258 Aug 24, 2023. IVAS Codec Version IVAS-FL-1.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
- ====================================================================================*/
+#include
+#include "options.h"
+#include "cnst.h"
+#include "rom_com.h"
+#include "prot_fx.h"
+#include "basop_util.h"
+#include "wmc_auto.h"
+
+/* clang-format off */
+#define SHC(x) ( (Word16) x )
+#define W16(x) ( (Word16) x )
+
+/*----------------------------------------------------------------------------------*
+ * Table of bitrates
+ *----------------------------------------------------------------------------------*/
+
+const Word32 brate_tbl[SIZE_BRATE_TBL] = // Q0
+{
+ ACELP_7k20, ACELP_8k00, ACELP_9k60, ACELP_13k20, ACELP_16k40, ACELP_24k40,
+ ACELP_32k, ACELP_48k, ACELP_64k, HQ_96k, HQ_128k
+};
+
+const Word32 brate_intermed_tbl[SIZE_BRATE_INTERMED_TBL] = // Q0
+{
+ ACELP_5k00, ACELP_6k15, ACELP_7k20, ACELP_8k00, ACELP_9k60, ACELP_11k60, ACELP_12k15, ACELP_12k85, ACELP_13k20,
+ ACELP_14k80, ACELP_16k40, ACELP_22k60, ACELP_24k40, ACELP_29k00, ACELP_29k20, ACELP_30k20,
+ ACELP_30k40, ACELP_32k, ACELP_48k, ACELP_64k, HQ_96k, HQ_128k
+};
+
+const Word16 bit_rates_div50[] = /* bit rate values / 50 to Fit in a Word16 */
+{
+ ACELP_5k00 / 50, ACELP_6k15 / 50, ACELP_7k20 / 50, ACELP_8k00 / 50, ACELP_9k60 / 50, ACELP_11k60 / 50, ACELP_12k15 / 50,
+ ACELP_12k85 / 50, ACELP_13k20 / 50, ACELP_14k80 / 50, ACELP_16k40 / 50, ACELP_22k60 / 50,
+ ACELP_24k40 / 50, ACELP_29k00 / 50, ACELP_29k20 / 50, ACELP_30k20 / 50, ACELP_30k40 / 50,
+ ACELP_32k / 50, ACELP_48k / 50, ACELP_64k / 50, HQ_96k / 50, HQ_128k / 50
+};
+
+const Word16 bit_rates_16k_div50[] = /* bit rate values / 50 to Fit in a Word16 */
+{
+ ACELP_8k00 / 50, ACELP_14k80 / 50, ACELP_22k60 / 50, ACELP_24k40 / 50, ACELP_29k00 / 50,
+ ACELP_29k20 / 50, ACELP_30k20 / 50, ACELP_30k40 / 50, ACELP_32k / 50, ACELP_48k / 50, ACELP_64k / 50
+};
+
+/*----------------------------------------------------------------------------------*
+ * Frame size and mode configuration tables
+ *----------------------------------------------------------------------------------*/
+
+const FrameSizeParams FrameSizeConfig[FRAME_SIZE_NB] =
+{
+ /* bits, net bits, trans_bits, trans_mode, band_bits, band_mode_min, band_mode_max, reserved_bits */
+ { FRAME_0, FRAME_0, 0, {0,0}, 0, 0, 0, 0}, /* 0 kbps ZERO_FRAME*/
+ { FRAME_2_4, FRAME_2_4-2, 1, {1,1}, 1, NB, WB, 0}, /* 2.4kbps VBR(SID)*/
+ { FRAME_7_2, FRAME_7_2-1, 0, {0,1}, 1, NB, WB, 0}, /* 7.2kbps VBR/CBR*/
+ { FRAME_8, FRAME_8-1, 0, {0,1}, 1, NB, WB, 0}, /* 8 kbps VBR/CBR*/
+ { FRAME_9_6, FRAME_9_6-2, 0, {0,1}, 2, NB, SWB, 0}, /* 9.6kbps CBR*/
+ { FRAME_13_2, FRAME_13_2-2, 0, {0,1}, 2, NB, SWB, 0}, /* 13.2kbps CBR*/
+ { FRAME_16_4, FRAME_16_4-3, 0, {0,1}, 2, NB, FB, 1}, /* 16.4kbps CBR*/
+ { FRAME_24_4, FRAME_24_4-3, 0, {0,1}, 2, NB, FB, 1}, /* 24.4kbps CBR*/
+ { FRAME_32, FRAME_32-3, 0, {0,1}, 2, WB, FB, 1}, /* 32 kbps CBR*/
+ { FRAME_48, FRAME_48-3, 0, {0,1}, 2, WB, FB, 1}, /* 48 kbps CBR*/
+ { FRAME_64, FRAME_64-3, 0, {0,1}, 2, WB, FB, 1}, /* 64 kbps CBR*/
+ { FRAME_96, FRAME_96-3, 0, {0,1}, 2, WB, FB, 1}, /* 96 kbps CBR*/
+ { FRAME_128, FRAME_128-3, 0, {0,1}, 2, WB, FB, 1} /*128 kbps CBR*/
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Conversion of ACELP signaling parameters (ACELP internal Fs, coder type, bandwidth, sharpening flag) to index
+ * (to be consulted with the decision matrix)
+ *
+ * - in order to retrieve the index, each section in this table starts with the bitrate
+ * - the second value in each section corresponds to the number of bits
+ * - the other values represent indices created by combining different parameters into a single value through the macro SIG2IND()
+ *----------------------------------------------------------------------------------*/
+
+const Word32 acelp_sig_tbl[MAX_ACELP_SIG] = // Q0
+{
+ /* GENERIC UNVOICED VOICED TRANSITION AUDIO INACTIVE */
+ ACELP_7k20, 4,
+ SIG2IND(GENERIC, NB, 1, 0), SIG2IND(UNVOICED, NB, 0, 0), SIG2IND(VOICED, NB, 1, 0), SIG2IND(TRANSITION, NB, 1, 0), SIG2IND(AUDIO, NB, 0, 0), SIG2IND(INACTIVE, NB, 0, 0),
+ SIG2IND(GENERIC, WB, 1, 0), SIG2IND(UNVOICED, WB, 0, 0), SIG2IND(VOICED, WB, 1, 0), SIG2IND(TRANSITION, WB, 1, 0), SIG2IND(AUDIO, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
+ SIG2IND(GENERIC, NB, 0, 0),
+ SIG2IND(GENERIC, WB, 0, 0),
+ SIG2IND(LR_MDCT, NB, 0, 0),
+
+ ACELP_8k00, 4,
+ SIG2IND(GENERIC, NB, 1, 0), SIG2IND(UNVOICED, NB, 0, 0), SIG2IND(VOICED, NB, 1, 0), SIG2IND(TRANSITION, NB, 1, 0), SIG2IND(AUDIO, NB, 0, 0), SIG2IND(INACTIVE, NB, 0, 0),
+ SIG2IND(GENERIC, WB, 1, 0), SIG2IND(UNVOICED, WB, 0, 0), SIG2IND(VOICED, WB, 1, 0), SIG2IND(TRANSITION, WB, 1, 0), SIG2IND(AUDIO, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
+ SIG2IND(GENERIC, NB, 0, 0),
+ SIG2IND(GENERIC, WB, 0, 0),
+ SIG2IND(LR_MDCT, NB, 0, 0),
+
+ ACELP_13k20, 5,
+ SIG2IND(GENERIC, NB, 1, 0), SIG2IND(VOICED, NB, 1, 0), SIG2IND(TRANSITION, NB, 0, 0), SIG2IND(AUDIO, NB, 0, 0), SIG2IND(INACTIVE, NB, 0, 0),
+ SIG2IND(GENERIC, WB, 1, 0), SIG2IND(VOICED, WB, 1, 0), SIG2IND(TRANSITION, WB, 0, 0), SIG2IND(AUDIO, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
+ SIG2IND(GENERIC, SWB, 1, 0), SIG2IND(VOICED, SWB, 1, 0), SIG2IND(TRANSITION, SWB, 0, 0), SIG2IND(AUDIO, SWB, 0, 0), SIG2IND(INACTIVE, SWB, 0, 0),
+ SIG2IND(GENERIC, NB, 0, 0), SIG2IND(VOICED, NB, 0, 0),
+ SIG2IND(GENERIC, WB, 0, 0), SIG2IND(VOICED, WB, 0, 0),
+ SIG2IND(GENERIC, SWB, 0, 0), SIG2IND(VOICED, SWB, 0, 0),
+ SIG2IND(GENERIC, WB, 1, 1), SIG2IND(UNVOICED, WB, 0, 1), SIG2IND(VOICED, WB, 1, 1), SIG2IND(INACTIVE, WB, 0, 1),
+ SIG2IND(GENERIC, SWB, 1, 1), SIG2IND(UNVOICED, SWB, 0, 1), SIG2IND(VOICED, SWB, 1, 1), SIG2IND(INACTIVE, SWB, 0, 1),
+ SIG2IND(LR_MDCT, NB, 0, 0),
+ SIG2IND(LR_MDCT, WB, 0, 0),
+ SIG2IND(LR_MDCT, SWB, 0, 0),
+
+ ACELP_32k, 4,
+ SIG2IND(GENERIC, WB, 1, 0), SIG2IND(TRANSITION, WB, 1, 0), SIG2IND(INACTIVE, WB, 0, 0),
+ SIG2IND(GENERIC, SWB, 1, 0), SIG2IND(TRANSITION, SWB, 1, 0), SIG2IND(INACTIVE, SWB, 0, 0),
+ SIG2IND(GENERIC, FB, 1, 0), SIG2IND(TRANSITION, FB, 1, 0), SIG2IND(INACTIVE, FB, 0, 0),
+ SIG2IND(GENERIC, WB, 0, 0), SIG2IND(TRANSITION, WB, 0, 0),
+ SIG2IND(GENERIC, SWB, 0, 0), SIG2IND(TRANSITION, SWB, 0, 0),
+ SIG2IND(GENERIC, FB, 0, 0), SIG2IND(TRANSITION, FB, 0, 0),
+
+ ACELP_64k, 4,
+ SIG2IND(GENERIC, WB, 0, 0), SIG2IND(TRANSITION, WB, 0, 0), SIG2IND(INACTIVE, WB, 0, 0),
+ SIG2IND(GENERIC, SWB, 1, 0), SIG2IND(TRANSITION, SWB, 1, 0), SIG2IND(INACTIVE, SWB, 0, 0),
+ SIG2IND(GENERIC, FB, 1, 0), SIG2IND(TRANSITION, FB, 1, 0), SIG2IND(INACTIVE, FB, 0, 0),
+ SIG2IND(GENERIC, SWB, 0, 0), SIG2IND(TRANSITION, SWB, 0, 0),
+ SIG2IND(GENERIC, FB, 0, 0), SIG2IND(TRANSITION, FB, 0, 0),
+};
+
+/*----------------------------------------------------------------------------------*
+ * ACELP bit allocation tables
+ *----------------------------------------------------------------------------------*/
+
+/* bit allocation table for end-frame LSF quantizer */
+const Word16 LSF_bits_tbl[] = // Q0
+{
+ /* IC UC VC GC TC AC */
+ 22, 31, 24, 29, 24, 22, /* ACELP_5k00 */
+ 22, 31, 24, 29, 24, 22, /* ACELP_6k15 */
+ 22, 37, 31, 29, 31, 22, /* ACELP_7k20 */
+ 22, 40, 36, 33, 34, 22, /* ACELP_8k00 */
+ 27, 40, 34, 35, 37, 27, /* ACELP_9k60 */
+ 31, 0, 37, 37, 40, 31, /* ACELP_11k60 */
+ 31, 0, 39, 39, 41, 31, /* ACELP_12k15 */
+ 31, 0, 38, 38, 40, 31, /* ACELP_12k85 */
+ 31, 0, 38, 38, 40, 31, /* ACELP_13k20 */
+ 31, 0, 37, 42, 42, 31, /* ACELP_14k80 */
+ 31, 0, 43, 40, 40, 31, /* ACELP_16k40 */
+ 31, 0, 42, 40, 40, 31, /* ACELP_22k60 */
+ 31, 0, 46, 41, 41, 31, /* ACELP_24k40 */
+ 41, 0, 0, 41, 41, 0, /* ACELP_29k00 */
+ 41, 0, 0, 41, 41, 0, /* ACELP_29k20 */
+ 41, 0, 0, 41, 41, 0, /* ACELP_30k20 */
+ 41, 0, 0, 41, 41, 0, /* ACELP_30k40 */
+ 41, 0, 0, 41, 41, 0, /* ACELP_32k */
+ 41, 0, 0, 41, 41, 0, /* ACELP_48k */
+ 41, 0, 0, 41, 41, 0, /* ACELP_64k */
+};
+
+/* bit allocation table for mid-frame LSF quantizer */
+const Word16 mid_LSF_bits_tbl[] = // Q0
+{
+ /* IC UC VC GC TC AC */
+ 2, 5, 1, 2, 2, 2, /* ACELP_5k00 */
+ 2, 5, 1, 2, 2, 2, /* ACELP_6k15 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_7k20 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_8k00 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_9k60 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_11k60 */
+ 2, 5, 5, 5, 5, 2, /* ACELP_12k15 */
+ 2, 5, 5, 5, 5, 2, /* ACELP_12k85 */
+ 2, 5, 5, 5, 5, 2, /* ACELP_13k20 */
+ 4, 0, 5, 5, 5, 4, /* ACELP_14k80 */
+ 4, 0, 5, 5, 5, 4, /* ACELP_16k40 */
+ 5, 0, 5, 5, 5, 5, /* ACELP_22k60 */
+ 5, 0, 5, 5, 5, 5, /* ACELP_24k40 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_29k00 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_29k20 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_30k20 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_30k40 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_32k */
+ 5, 0, 0, 5, 5, 5, /* ACELP_48k */
+ 5, 0, 0, 5, 5, 5, /* ACELP_64k */
+};
+
+
+/* bit allocation table for scaled innovation energy prediction */
+const Word16 Es_pred_bits_tbl[] = // Q0
+{
+/* UC VC GC TC */
+ 0, 0, 0, 4, /* ACELP_5k00 */
+ 0, 0, 0, 4, /* ACELP_6k15 */
+ 0, 0, 0, 4, /* ACELP_7k20 */
+ 0, 0, 0, 4, /* ACELP_8k00 */
+ 0, 5, 5, 5, /* ACELP_9k60 */
+ 0, 5, 4, 4, /* ACELP_11k60 */
+ 0, 5, 5, 5, /* ACELP_12k15 */
+ 0, 5, 4, 5, /* ACELP_12k85 */
+ 0, 5, 4, 4, /* ACELP_13k20 */
+ 0, 5, 5, 5, /* ACELP_14k80 */
+ 0, 5, 5, 5, /* ACELP_16k40 */
+ 0, 5, 5, 5, /* ACELP_22k60 */
+ 0, 5, 5, 5, /* ACELP_24k40 */
+ 0, 0, 5, 5, /* ACELP_29k00 */
+ 0, 0, 5, 5, /* ACELP_29k20 */
+ 0, 0, 5, 5, /* ACELP_30k20 */
+ 0, 0, 5, 5, /* ACELP_30k40 */
+ 0, 0, 5, 5, /* ACELP_32k */
+ 0, 0, 5, 5, /* ACELP_48k */
+ 0, 0, 5, 5, /* ACELP_64k */
+};
+
+/* bit allocation table for gain quantizer (ACELP@12.8kHz) */
+/* the 4 values allocated correspond to 4 subframes */
+const Word16 gain_bits_tbl[] = // Q0
+{
+/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 6,6,6,6, 7,6,6,6, 7,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_5k00 */
+ 6,6,6,6, 7,6,6,6, 7,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_6k15 */
+ 7,7,7,7, 7,6,6,6, 6,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_7k20 */
+ 7,7,7,7, 8,7,6,6, 8,7,6,6, 5,5,5,5, 5,6,5,5, 5,3,6,6, 5,3,3,6, 3,5,5,5, 3,3,6,6, 3,3,3,14, /* ACELP_8k00 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_9k60 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,13, /* ACELP_11k60 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,14, /* ACELP_12k15 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,5, 3,3,3,14, /* ACELP_12k85 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_13k20 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_14k80 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_16k40 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,14, /* ACELP_22k60 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_24k40 */
+};
+
+
+/* bit allocation table for gain gain quantizer (ACELP@16kHz) */
+/* the 5 values allocated correspond to 5 subframes */
+const Word16 gain_bits_16kHz_tbl[] = // Q0
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0,0,0,0,0, 6,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0, 0, /* ACELP_8k00 */
+ 0,0,0,0,0, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,15, /* ACELP_14k80 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,15, /* ACELP_22k60 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,16, /* ACELP_24k40 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_29k00 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_29k20 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_30k20 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_30k40 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_32k */
+ 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12, 6,12,12,12,12, 6,6,12,12,12, 6,6,6,12,12, 6,6,6,6,12, /* ACELP_48k */
+ 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12, 6,12,12,12,12, 6,6,12,12,12, 6,6,6,12,12, 6,6,6,6,12 /* ACELP_64k */
+};
+
+/* bit allocation table for adaptive codebook (pitch) (ACELP@12.8kHz) */
+/* the 4 values correspond to 4 subframes */
+const Word16 ACB_bits_tbl[] = // Q0
+{
+/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_5k00 */
+ 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_6k15 */
+ 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_7k20 */
+ 0,0,0,0, 10,5,5,5, 9,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,5, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_8k00 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_9k60 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_11k60 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_12k15 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_12k85 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_13k20 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_14k80 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_16k40 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_22k60 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_24k40 */
+};
+
+/* bit allocation table for adaptive codebook (pitch) (ACELP@16kHz) */
+/* the 5 values correspond to 5 subframes */
+const Word16 ACB_bits_16kHz_tbl[] = // Q0
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0,0, 0,0,0, 9,0, 0,0,0, 0,0, 0,0,0, 0,0, 0,0,0, 0,0, 0,0,0, 0,0,0, 0,0, 0,0,0,0, 0, /* ACELP_8k00 */
+ 0,0, 0,0,0, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_14k80 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_22k60 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_24k40 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_29k00 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_29k20 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_30k20 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_30k40 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_32k */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_48k */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10 /* ACELP_64k */
+};
+
+/* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@12.8kHz) */
+/* the 4 values correspond to 4 subframes */
+const Word16 FCB_bits_tbl[] = // Q0
+{
+/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 8,8,8,8, 12,12,12,20, 7, 7, 0, 7, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_5k00 */
+ 10,10,10,10, 12,12,12,20, 12, 7,12, 7, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_6k15 */
+ 13,13,13,13, 12,12,12,20, 12,12,12,20, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_7k20 */
+ 13,13,13,13, 12,20,12,20, 12,20,12,20, 20,12,12,12, 20,12,12,12, 20,12,20,12, 20,12,20,20, 20,12,12,20, 20,12,20,12, 12,20,12,20, /* ACELP_8k00 */
+ 13,13,13,13, 20,28,20,28, 20,20,20,28, 20,20,20,20, 20,20,20,20, 20,20,28,20, 20,28,20,28, 20,28,20,20, 20,20,20,28, 20,28,20,28, /* ACELP_9k60 */
+ 0, 0, 0, 0, 28,36,28,36, 28,28,28,36, 28,28,28,28, 28,28,28,28, 28,28,36,28, 28,36,28,36, 28,36,28,28, 28,28,28,36, 28,36,28,36, /* ACELP_11k60 */
+ 0, 0, 0, 0, 28,36,36,36, 28,36,28,36, 36,28,28,28, 36,28,28,28, 36,28,36,28, 36,36,28,43, 28,36,28,36, 28,36,28,36, 28,36,36,36, /* ACELP_12k15 */
+ 0, 0, 0, 0, 36,36,36,43, 36,36,36,36, 36,36,28,36, 36,28,36,36, 36,36,36,36, 36,36,43,43, 36,36,36,36, 36,36,36,43, 36,36,36,43, /* ACELP_12k85 */
+ 0, 0, 0, 0, 36,43,36,43, 36,36,36,43, 36,36,36,36, 36,36,36,36, 36,36,43,36, 36,43,43,43, 36,43,36,36, 43,36,43,36, 36,43,36,43, /* ACELP_13k20 */
+ 0, 0, 0, 0, 43,50,43,50, 43,43,43,43, 43,43,43,43, 43,43,43,43, 43,43,50,43, 43,50,50,50, 43,43,43,50, 50,43,50,43, 43,50,43,50, /* ACELP_14k80 */
+ 0, 0, 0, 0, 50,56,50,56, 50,50,50,56, 56,50,50,50, 56,50,50,50, 56,50,56,56, 56,56,56,56, 50,56,50,56, 50,56,56,56, 50,56,56,56, /* ACELP_16k40 */
+ 0, 0, 0, 0, 83,83,83,87, 78,83,83,83, 83,78,83,83, 83,78,83,87, 83,87,83,87, 83,87,87,92, 87,83,87,83, 87,83,87,87, 83,87,87,87, /* ACELP_22k60 */
+ 0, 0, 0, 0, 92,92,92,92, 87,92,92,92, 92,87,92,92, 92,87,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, /* ACELP_24k40 */
+};
+
+/* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@16kHz) */
+/* the 5 values correspond to 5 subframes */
+const Word16 FCB_bits_16kHz_tbl[] = // Q0
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_8k00 */
+ 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_14k80 */
+ 0, 0, 0, 0, 0, 62,56,56,56,62, 62,56,56,56,56, 56,56,56,56,73, 62,56,62,62,62, 56,62,62,62,73, 62,62,62,62,68, /* ACELP_22k60 */
+ 0, 0, 0, 0, 0, 68,68,68,73,73, 68,68,68,68,73, 68,73,68,73,73, 73,73,73,73,73, 73,78,73,73,78, 73,78,73,73,78, /* ACELP_24k40 */
+ 12,12,12,12,12, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, /* ACELP_29k00 */
+ 12,12,12,12,12, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, /* ACELP_29k20 */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_30k20 */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_30k40 */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_32k */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_48k */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36 /* ACELP_64k */
+};
+
+/* bit allocation table for AVQ bits in active segments (ACELP@16kHz) */
+const Word16 AVQ_bits_16kHz_tbl[] = // Q0
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_8k00 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_14k80 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_22k60 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_24k40 */
+ 78, 78, 78, 78, 78, 48, 48, 48, 48, 49, 48, 49, 49, 48, 49, 50, 50, 51, 52, 52, 50, 54, 53, 54, 54, 55, 55, 55, 55, 54, 52, 56, 56, 56, 56, /* ACELP_29k00 */
+ 79, 79, 79, 79, 78, 49, 49, 49, 49, 49, 50, 49, 49, 50, 49, 52, 52, 51, 52, 52, 54, 54, 53, 54, 54, 56, 55, 55, 56, 56, 56, 56, 56, 56, 56, /* ACELP_29k20 */
+ 78, 78, 78, 78, 78, 50, 50, 50, 50, 49, 51, 50, 50, 50, 50, 53, 53, 53, 52, 52, 55, 55, 55, 54, 54, 57, 57, 56, 56, 56, 57, 57, 57, 57, 56, /* ACELP_30k20 */
+ 79, 79, 79, 79, 78, 51, 51, 51, 50, 50, 51, 51, 51, 51, 51, 54, 54, 53, 53, 53, 56, 56, 56, 55, 54, 58, 57, 57, 57, 57, 58, 58, 58, 57, 57, /* ACELP_30k40 */
+ 86, 85, 85, 85, 85, 57, 57, 57, 57, 57, 58, 58, 57, 57, 57, 60, 60, 60, 60, 59, 62, 62, 62, 62, 61, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, /* ACELP_32k */
+ 143,142,142,142,142, 116,115,115,115,115, 116,116,115,115,115, 119,119,118,118,118, 121,121,121,121,121, 124,124,123,123,123, 126,126,126,126,126, /* ACELP_48k */
+ 207,206,206,206,206, 180,179,179,179,179, 180,180,179,179,179, 183,183,182,182,182, 185,185,185,185,185, 188,188,187,187,187, 190,190,190,190,190 /* ACELP_64k */
+};
+
+/* bit allocation table for reserved bits (ACELP@12.8kHz) */
+const Word16 reserved_bits_tbl[] = // Q0
+{
+/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_5k00 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_6k15 */
+ 1, 0, 0, 0, 0, 2, 4, 0, 3, 0, /* ACELP_7k20 */
+ 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, /* ACELP_8k00 */
+ 46, 0, 0, 0, 1, 2, 4, 1, 4, 0, /* ACELP_9k60 */
+ 0, 0, 0, 0, 1, 3, 6, 2, 6, 0, /* ACELP_11k60 */
+ 0, 0, 0, 0, 2, 4, 0, 3, 7, 0, /* ACELP_12k15 */
+ 0, 0, 0, 0, 1, 3, 0, 2, 0, 0, /* ACELP_12k85 */
+ 0, 0, 0, 0, 1, 4, 1, 3, 0, 0, /* ACELP_13k20 */
+ 0, 0, 0, 0, 2, 5, 2, 4, 1, 1, /* ACELP_14k80 */
+ 0, 0, 0, 0, 2, 0, 5, 5, 3, 3, /* ACELP_16k40 */
+ 0, 0, 2, 2, 0, 1, 3, 0, 0, 1, /* ACELP_22k60 */
+ 0, 0, 1, 1, 3, 8, 19, 7, 11, 11, /* ACELP_24k40 */
+};
+
+/* NRG mode */
+const UWord8 ACELP_NRG_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
+{
+ {{0,0,1,1,0,0,0,0},{2,2,1,1,0,0,0,0}},
+ {{1,1,1,1,0,0,0,0},{1,1,1,1,1,1,1,0}},
+};
+
+/* NRG bits : (0/2/3 bits) */
+const UWord8 ACELP_NRG_BITS[3] = { 0, 3, 4 }; // Q0
+
+/* LTP MODE*/
+const UWord8 ACELP_LTP_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
+{
+ {{0,0,1,2,0,0,0,0},{0,0,1,2,0,0,0,0}},
+ {{4,4,3,4,0,0,0,0},{4,4,3,4,8,0,9,0}},
+};
+
+/* LTP bits */
+const UWord8 ACELP_LTP_BITS_SFR[8+RF_MODE_MAX][5] = // Q0
+{
+ {0,0,0,0,0},
+ {8,4,4,4,4},
+ {8,5,8,5,5},
+ {9,6,6,6,6},
+ {9,6,9,6,6},
+ {8,5,5,5,5},
+ {8,5,8,5,5},
+ {8,0,0,0,0},
+ {8,5,5,5,5}, /* All-pred mode in RF, rf_frame_type = 0 */
+ {8,4,4,4,0}, /* Gen-pred mode in RF, rf_frame_type = 2 */
+};
+
+/* LTF modes (0 - LOW_PASS (LP filtering), 1 - FULL_BAND (no filtering), 2 - NORMAL_OPERATION (adaptive)) */
+/* Mode 2 ACELP: INACTIVE,UNVOICED,VOICED,GENERIC */
+const UWord8 ACELP_LTF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
+{
+ {{1,1,1,0,0,0,0,0},{1,1,1,0,0,0,0,0}},
+ {{0,0,2,0,0,0,0,0},{0,0,2,0,1,1,1,0}},
+};
+
+/* LTF bits */
+const UWord8 ACELP_LTF_BITS[4] = { 0, 0, 4, 0 }; // Q0
+
+/* GAINS ELEMENT */
+/* 5 modes: (EVS: 5b/subframe), (AMRWB: 7b/subframe),(AMRWB: 6b/subframe),(UC: 5b/subframe) */
+const UWord8 ACELP_GAINS_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
+{
+ {{6,6,1,1,0,0,0,0},{7,7,1,1,0,0,0,0}},
+ {{2,2,3,3,0,0,0,0},{2,2,3,3,3,2,1,0}},
+};
+
+/* gains bits */
+const UWord8 ACELP_GAINS_BITS[10] = // Q0
+{
+ 0, /* skip sub-frame wise gain coding*/
+ 5,
+ 6,
+ 7,
+ 6,
+ 7,
+ 6, /* UC */
+ 7, /* GUNVOICED UV (5b ICB/2b Gaussian) */
+ 4, /* GNELP UV */
+ 5 /* GNELP UV */
+};
+
+/* BPF modes (0 - no filtering, 1 - filtering, 2 - adaptive) */
+const UWord8 ACELP_BPF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0
+{
+ {{1,1,1,1,0,0,0,0},{1,1,1,1,0,0,0,0}},
+ {{1,1,2,2,0,0,0,0},{1,1,2,2,1,1,1,1}},
+};
+
+/* BPF bits */
+const UWord8 ACELP_BPF_BITS[3] = { 0, 0, 2 }; // Q0
+const Word16 ACELP_CDK_BITS[ACELP_FIXED_CDK_NB] =
+{
+ 7, 10, 12, 15, 17, 20, 24, 26, 28, 30, 32, 34, 36, 40, 43, 46,
+ 47, 49, 50, 53, 55, 56, 58, 59, 61, 62, 65, 68, 70, 73, 75, 78, 80, 83,
+ 85, 87, 89, 92, 94, 96, 98
+};
+
+/*----------------------------------------------------------------------------------*
+ * Perceptual critical bands
+ *----------------------------------------------------------------------------------*/
+
+const Word32 crit_bands_fx[] =//Q0
+{
+ 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480,
+ 1720, 2000, 2320, 2700, 3150, 3700, 4400, 5300, 6350, 7700,
+ 9500, 12000, 15500, 40000
+};
+
+
+const Word16 crit_bins_corr_fx[CRIT_NOIS_BAND] =
+{//Q15
+ /*.9f, .9f, .85f, .8f, .775f, .75f, .725f , .7f , .675f, .65f, .625f , .60f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f*/
+ 29491, 29491, 27853, 26214, 25395, 24576, 23577 , 22938, 22118, 21299, 20480,
+ 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661
+};
+const Word16 crit_bins[CRIT_NOIS_BAND] = // Q0
+{
+ 4, 4, 4, 4, 4, 5, 6, 6, 6, 8, 8, 10, 11, 13, 15, 18, 22, 16, 16, 20, 20, 20, 16
+};
+
+
+const Word16 crit_bands_loc_fx[CRIT_NOIS_BAND] =
+{//Q0
+ 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720,
+ 2000, 2320, 2700, 3150, 3700, 4100, 4500, 5000, 5500, 6000, 6375
+};
+
+const Word16 inv_tbl_fx[146] =//Q15
+{
+ 0, 32767, 16384, 10923, 8192, 6554, 5462, 4681,
+ 4096, 3641, 3277, 2979, 2731, 2521, 2341, 2185,
+ 2048, 1928, 1820, 1725, 1638, 1560, 1489, 1425,
+ 1365, 1311, 1260, 1214, 1170, 1130, 1092, 1057,
+ 1024, 993, 964, 936, 910, 886, 862, 840,
+ 819, 799, 780, 762, 745, 728, 712, 697,
+ 683, 669, 655, 643, 630, 618, 607, 596,
+ 585, 575, 565, 555, 546, 537, 529, 520,
+ 512, 504, 496, 489, 482, 475, 468, 462,
+ 455, 449, 443, 437, 431, 426, 420, 415,
+ 410, 405, 400, 395, 390, 386, 381, 377,
+ 372, 368, 364, 360, 356, 352, 349, 345,
+ 341, 338, 334, 331, 328, 324, 321, 318,
+ 315, 312, 309, 306, 303, 301, 298, 295,
+ 293, 290, 287, 285, 282, 280, 278, 275,
+ 273, 271, 269, 266, 264, 262, 260, 258,
+ 256, 254, 252, 250, 248, 246, 245, 243,
+ 241, 239, 237, 236, 234, 232, 231, 229,
+ 228, 226
+};
+
+
+const Word16 hvq_bwe_fac_fx[16] = /* Q15 */
+{
+ 16384, 17408, 18432, 19456,
+ 20480, 21504, 22528, 23552,
+ 24576, 25600, 26624, 27648,
+ 28672, 29696, 30720, 31744
+};
+
+const Word16 sqac_headroom_fx[146] = /* Q0 */
+{
+ 0 /*not used */, 0, 0, 1, 1, 1, 1, 1, 1, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4
+};
+
+const Word16 inv_N_fx[32] = /* Q15 */
+{
+ 0, 1056, 2113, 3170,
+ 4227, 5284, 6341, 7398,
+ 8455, 9512, 10569, 11626,
+ 12683, 13740, 14797, 15854,
+ 16912, 17969, 19026, 20083,
+ 21140, 22197, 23254, 24311,
+ 25368, 26425, 27482, 28539,
+ 29596, 30653, 31710, 32767
+};
+
+const Word16 band_len_harm[SFM_N_HARM_FB] =
+{
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 16, 16, 16, 16, 16, 16, 32, 32, 32, 48, 48, 48, 48, 64, 64, 64, 96
+};
+
+const Word32 thren_fx[39] = /* Q8 */
+{
+ 28215802, 19951584, 14107901,
+ 9975792, 7053951, 4987896,
+ 3526975, 2493948, 1763488,
+ 1246974, 881744, 623487,
+ 440872, 311744, 220436,
+ 155872, 110218, 77936,
+ 55109, 38968, 27554,
+ 19484, 13777, 9742,
+ 6889, 4871, 3444,
+ 2435, 1722, 1218,
+ 861, 609, 431,
+ 304, 215, 152,
+ 108, 76, 54
+};
+
+const Word16 dicnlg2[40] = // Q0
+{
+ 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,
+ 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
+ 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,
+ 4, 3, 2, 1, 0, -1, -2, -3, -4, -5
+};
+
+/*----------------------------------------------------------------------------------*
+ * LD music post-filter
+ *----------------------------------------------------------------------------------*/
+
+const Word16 mfreq_loc_LD_fx[] = { 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480,//Q0
+ 1720, 2000, 2320, 2700, 3150, 3700, 4400, 5300, (6400 - BIN_16kdct_fx)
+};
+
+const Word16 mfreq_bindiv_LD[] = {10, 10, 10, 10, 11, 12, 14, 15, 16, 19, 21, 24, 28, 32, 38, 45, 55, 70, 90, 110}; // Q0
+const Word16 sc_qnoise_fx[] = { 3277, 3277, 3277, 3277, 3277, 3277, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2185, 2185, 2185, 2185, 2185 };//Q15
+const Word16 inv_mfreq_bindiv_LD_fx[] = { 3277, 3277, 3277, 3277, 2979, 2731, 2341, 2185, 2048, 1725, 1560, 1365, 1170, 1024, 862, 728, 596, 468, 364, 298 }; /*Q15 */
+
+const Word16 inv_mfreq_bindiv_LD_M1_fx[] = { 3641, 3641, 3641, 3641, 3277, 2979, 2521, 2341, 2185, 1820, 1638, 1425, 1214, 1057, 886, 745, 607, 475, 368, 301 }; /*Q15 */
+
+const Word16 post_dct_wind_fx[OFFSET2] = /*Q15 */
+{
+ 32767, 32766, 32759, 32748, 32733, 32713, 32689, 32660,
+ 32627, 32590, 32548, 32502, 32452, 32397, 32338, 32274,
+ 32207, 32135, 32059, 31979, 31894, 31805, 31712, 31615,
+ 31514, 31409, 31300, 31187, 31070, 30949, 30823, 30695,
+ 30562, 30425, 30285, 30141, 29993, 29841, 29686, 29527,
+ 29365, 29200, 29030, 28858, 28682, 28503, 28320, 28134,
+ 27945, 27753, 27558, 27360, 27159, 26955, 26749, 26539,
+ 26327, 26112, 25894, 25674, 25452, 25226, 24999, 24769,
+ 24537, 24303, 24067, 23828, 23588, 23345, 23101, 22855,
+ 22607, 22358, 22107, 21854, 21600, 21345, 21088, 20830,
+ 20570, 20310, 20049, 19786, 19523, 19258, 18993, 18728,
+ 18461, 18195, 17927, 17659, 17391, 17123, 16854, 16586,
+ 16317, 16048, 15779, 15511, 15243, 14975, 14707, 14440,
+ 14173, 13907, 13642, 13377, 13114, 12851, 12589, 12328,
+ 12068, 11809, 11552, 11296, 11041, 10787, 10536, 10285,
+ 10037, 9790, 9545, 9301, 9060, 8820, 8583, 8348,
+ 8115, 7884, 7655, 7429, 7205, 6983, 6765, 6548,
+ 6335, 6124, 5916, 5710, 5508, 5308, 5112, 4918,
+ 4728, 4540, 4356, 4175, 3998, 3824, 3653, 3485,
+ 3321, 3161, 3004, 2851, 2701, 2555, 2413, 2274,
+ 2139, 2009, 1882, 1758, 1639, 1524, 1413, 1306,
+ 1203, 1104, 1009, 918, 831, 749, 671, 597,
+ 527, 461, 400, 343, 291, 242, 199, 159,
+ 124, 93, 67, 45, 27, 14, 5, 1
+};
+
+const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD] = { 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 17096, 17096, 17096, 17096 };//Q14
+
+const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD] = { 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 1425, 1425, 1425, 1425 };//Q15
+
+const Word16 wind_sss_fx[LEN_WIN_SSS] = /*window for subsampling*/
+{//Q15
+ 2621, 2627, 2645, 2675, 2717, 2771, 2836, 2914,
+ 3003, 3103, 3216, 3340, 3475, 3621, 3779, 3948,
+ 4127, 4318, 4519, 4730, 4952, 5184, 5426, 5677,
+ 5938, 6209, 6488, 6777, 7074, 7379, 7693, 8015,
+ 8344, 8681, 9025, 9375, 9733, 10097, 10466, 10842,
+ 11223, 11609, 12000, 12395, 12795, 13198, 13605, 14016,
+ 14429, 14845, 15263, 15683, 16105, 16527, 16951, 17376,
+ 17800, 18225, 18649, 19072, 19495, 19916, 20335, 20752,
+ 21166, 21578, 21987, 22392, 22794, 23191, 23585, 23973,
+ 24357, 24735, 25108, 25474, 25835, 26189, 26537, 26877,
+ 27210, 27536, 27853, 28163, 28464, 28757, 29041, 29316,
+ 29582, 29838, 30085, 30322, 30549, 30765, 30972, 31167,
+ 31352, 31526, 31690, 31842, 31983, 32112, 32230, 32337,
+ 32432, 32515, 32586, 32646, 32694, 32730, 32754, 32766,
+ 32767, 32096, 30111, 26894, 22575, 17333, 11380, 4962
+};
+/*----------------------------------------------------------------------------------*
+ * Low-pass FIR filter for low-frequency post-filtering @ 8kHz
+ * fir1(240,(3900/32000),hanning(241))*5
+ *----------------------------------------------------------------------------------*/
+
+const Word16 filter5_39s320_120_fx[121] = /* Q15 */
+{
+ 19968, 19480, 18061, 15834, 12993, 9779, 6458, 3290,
+ 506, -1713, -3253, -4075, -4212, -3762, -2873, -1720,
+ -488, 654, 1568, 2160, 2389, 2263, 1838, 1201,
+ 460, -275, -903, -1348, -1566, -1546, -1312, -914,
+ -422, 90, 547, 891, 1083, 1108, 975, 716,
+ 376, 9, -331, -599, -762, -805, -732, -562,
+ -325, -61, 192, 399, 533, 582, 546, 435,
+ 272, 83, -103, -259, -366, -413, -398, -328,
+ -218, -86, 46, 161, 243, 283, 280, 238,
+ 166, 77, -14, -94, -153, -185, -188, -163,
+ -119, -62, -3, 50, 90, 113, 117, 104,
+ 78, 44, 9, -23, -47, -62, -65, -58,
+ -45, -27, -8, 9, 21, 28, 30, 27,
+ 20, 13, 5, -2, -7, -9, -9, -8,
+ -6, -3, -1, 0, 1, 1, 1, 0,
+ 0
+
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * LP analysis windows
+ *----------------------------------------------------------------------------------*/
+const Word16 Assym_window_W16fx[L_LP] = /*Q15*/
+{
+ 2621, 2624, 2630, 2640, 2655, 2674, 2698, 2725,
+ 2757, 2792, 2833, 2877, 2925, 2978, 3034, 3095,
+ 3160, 3229, 3302, 3379, 3460, 3545, 3634, 3727,
+ 3824, 3925, 4029, 4138, 4250, 4366, 4486, 4609,
+ 4737, 4867, 5002, 5140, 5281, 5426, 5575, 5727,
+ 5882, 6040, 6202, 6367, 6535, 6707, 6881, 7059,
+ 7239, 7422, 7609, 7798, 7990, 8184, 8382, 8581,
+ 8784, 8989, 9196, 9406, 9618, 9832, 10049, 10268,
+ 10489, 10711, 10936, 11163, 11391, 11622, 11854, 12087,
+ 12322, 12559, 12797, 13037, 13278, 13520, 13763, 14007,
+ 14253, 14499, 14746, 14994, 15243, 15493, 15743, 15994,
+ 16245, 16496, 16748, 17000, 17253, 17505, 17758, 18010,
+ 18263, 18515, 18767, 19019, 19270, 19521, 19772, 20022,
+ 20271, 20519, 20767, 21014, 21260, 21504, 21748, 21991,
+ 22232, 22473, 22711, 22949, 23185, 23419, 23652, 23883,
+ 24113, 24340, 24566, 24790, 25012, 25231, 25449, 25664,
+ 25878, 26089, 26297, 26503, 26707, 26908, 27107, 27303,
+ 27496, 27687, 27874, 28059, 28241, 28420, 28596, 28769,
+ 28939, 29105, 29269, 29429, 29586, 29739, 29889, 30036,
+ 30179, 30319, 30455, 30588, 30717, 30842, 30964, 31082,
+ 31196, 31306, 31413, 31516, 31615, 31709, 31800, 31888,
+ 31971, 32050, 32125, 32196, 32263, 32325, 32384, 32439,
+ 32489, 32535, 32577, 32615, 32649, 32679, 32704, 32725,
+ 32742, 32755, 32763, 32767, 32767, 32758, 32741, 32715,
+ 32681, 32638, 32587, 32527, 32458, 32381, 32296, 32203,
+ 32101, 31991, 31873, 31746, 31612, 31470, 31320, 31162,
+ 30996, 30823, 30642, 30454, 30259, 30056, 29847, 29630,
+ 29407, 29177, 28940, 28697, 28448, 28193, 27931, 27664,
+ 27391, 27113, 26829, 26540, 26246, 25947, 25643, 25335,
+ 25022, 24706, 24385, 24060, 23732, 23401, 23066, 22728,
+ 22387, 22043, 21697, 21349, 20999, 20646, 20292, 19937,
+ 19580, 19223, 18864, 18505, 18145, 17785, 17425, 17065,
+ 16705, 16346, 15988, 15631, 15275, 14920, 14567, 14215,
+ 13866, 13519, 13174, 12832, 12492, 12156, 11823, 11493,
+ 11166, 10844, 10525, 10210, 9900, 9594, 9292, 8996,
+ 8704, 8418, 8137, 7861, 7591, 7327, 7068, 6816,
+ 6570, 6330, 6097, 5870, 5650, 5437, 5231, 5032,
+ 4840, 4656, 4479, 4310, 4148, 3994, 3848, 3709,
+ 3579, 3457, 3343, 3237, 3139, 3050, 2969, 2896,
+ 2832, 2776, 2729, 2690, 2660, 2639, 2626, 2621
+};
+
+const Word16 assym_window_16k_fx[L_LP_16k] = /*Q15*/
+{
+ 2621, 2623, 2627, 2634, 2643, 2655, 2670, 2688,
+ 2708, 2731, 2757, 2785, 2816, 2849, 2886, 2925,
+ 2966, 3011, 3058, 3107, 3159, 3214, 3271, 3331,
+ 3394, 3459, 3527, 3597, 3670, 3745, 3823, 3903,
+ 3985, 4071, 4158, 4248, 4341, 4436, 4533, 4632,
+ 4734, 4839, 4945, 5054, 5165, 5279, 5394, 5512,
+ 5632, 5754, 5879, 6005, 6134, 6264, 6397, 6531,
+ 6668, 6807, 6947, 7090, 7234, 7381, 7529, 7679,
+ 7831, 7984, 8140, 8297, 8455, 8616, 8778, 8941,
+ 9107, 9273, 9442, 9611, 9782, 9955, 10129, 10304,
+ 10481, 10659, 10838, 11019, 11200, 11383, 11567, 11752,
+ 11938, 12125, 12313, 12502, 12693, 12883, 13075, 13268,
+ 13461, 13655, 13850, 14046, 14242, 14439, 14637, 14835,
+ 15033, 15232, 15432, 15631, 15832, 16032, 16233, 16434,
+ 16635, 16837, 17039, 17240, 17442, 17644, 17846, 18048,
+ 18250, 18452, 18653, 18855, 19056, 19257, 19458, 19658,
+ 19858, 20058, 20257, 20456, 20654, 20852, 21049, 21245,
+ 21441, 21637, 21831, 22025, 22218, 22410, 22602, 22792,
+ 22982, 23170, 23358, 23545, 23730, 23915, 24098, 24280,
+ 24461, 24641, 24820, 24997, 25173, 25348, 25521, 25693,
+ 25863, 26032, 26200, 26366, 26530, 26693, 26854, 27014,
+ 27171, 27328, 27482, 27635, 27786, 27935, 28082, 28227,
+ 28371, 28513, 28652, 28790, 28926, 29059, 29191, 29320,
+ 29448, 29573, 29697, 29818, 29937, 30053, 30168, 30280,
+ 30390, 30498, 30603, 30706, 30807, 30905, 31002, 31095,
+ 31186, 31275, 31362, 31446, 31527, 31606, 31683, 31757,
+ 31828, 31897, 31963, 32027, 32088, 32147, 32203, 32257,
+ 32307, 32356, 32401, 32444, 32484, 32522, 32557, 32589,
+ 32619, 32646, 32670, 32692, 32711, 32727, 32741, 32751,
+ 32760, 32765, 32767, 32767, 32762, 32751, 32734, 32712,
+ 32685, 32652, 32614, 32570, 32521, 32466, 32406, 32341,
+ 32270, 32194, 32112, 32026, 31934, 31837, 31735, 31627,
+ 31515, 31398, 31275, 31148, 31016, 30878, 30737, 30590,
+ 30438, 30282, 30122, 29957, 29787, 29613, 29434, 29252,
+ 29065, 28874, 28679, 28480, 28277, 28070, 27859, 27644,
+ 27426, 27205, 26980, 26751, 26520, 26285, 26047, 25805,
+ 25561, 25314, 25065, 24812, 24557, 24300, 24040, 23777,
+ 23513, 23246, 22978, 22707, 22435, 22161, 21885, 21608,
+ 21329, 21049, 20768, 20485, 20202, 19918, 19632, 19347,
+ 19060, 18773, 18486, 18198, 17911, 17623, 17335, 17047,
+ 16760, 16473, 16186, 15900, 15614, 15330, 15046, 14763,
+ 14481, 14200, 13921, 13643, 13367, 13092, 12818, 12547,
+ 12277, 12010, 11744, 11481, 11220, 10961, 10705, 10451,
+ 10200, 9951, 9706, 9463, 9223, 8987, 8754, 8523,
+ 8297, 8073, 7854, 7637, 7425, 7216, 7011, 6810,
+ 6613, 6420, 6231, 6046, 5865, 5689, 5517, 5350,
+ 5187, 5028, 4875, 4726, 4581, 4442, 4307, 4177,
+ 4052, 3932, 3818, 3708, 3603, 3503, 3409, 3320,
+ 3236, 3157, 3084, 3016, 2953, 2895, 2844, 2797,
+ 2756, 2720, 2690, 2665, 2646, 2632, 2624, 2621
+};
+
+const Word16 lag_window_8k[2][16] = /* LAGW_STRONG Q15*/
+{
+ /* h */ { 32728, 32619, 32438, 32187, 31867, 31480, 31029, 30517, 29946, 29321, 28645, 27923, 27158, 26356, 25521, 24658 },
+ /* l */ { 11904, 17280, 30720, 25856, 24192, 28992, 24384, 7360, 19456, 14720, 22080, 12928, 31040, 27328, 22080, 5184 }
+};
+const Word16 lag_window_12k8[NUM_LAGW_STRENGTHS][2][16] =
+{//Q15
+ /* LAGW_WEAK */
+ {
+ /* h */ { 32763, 32758, 32750, 32739, 32725, 32707, 32687, 32663, 32637, 32607, 32574, 32538, 32498, 32456, 32411, 32362 },
+ /* l */ { 4736, 13312, 16896, 15360, 8896, 30464, 14528, 27008, 2496, 6720, 7296, 4480, 31424, 22976, 12160, 32384 }
+},
+/* LAGW_MEDIUM */
+{
+ /* h */ { 32758, 32739, 32707, 32663, 32607, 32538, 32456, 32362, 32257, 32139, 32009, 31867, 31714, 31549, 31374, 31187 },
+ /* l */ { 13312, 15360, 30464, 27008, 6720, 4480, 22976, 32384, 3520, 5888, 11200, 24192, 17472, 29376, 576, 3136 }
+},
+/* LAGW_STRONG */
+{
+ /* h */ { 32750, 32707, 32637, 32538, 32411, 32257, 32075, 31867, 31633, 31374, 31089, 30780, 30449, 30094, 29718, 29321 },
+ /* l */ { 16896, 30464, 2496, 4480, 12160, 3520, 24256, 24192, 20736, 576, 18240, 31488, 128, 16704, 11520, 14720 }
+}
+};
+const Word16 lag_window_16k[NUM_LAGW_STRENGTHS][2][16] =
+{//Q15
+ /* LAGW_WEAK */
+ {
+ /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 },
+ /* l */ { 23360, 22272, 20672, 18304, 15360, 11904, 8000, 3648, 31808, 27008, 22080, 17280, 12608, 8256, 4480, 1344 }
+},
+/* LAGW_MEDIUM */
+{
+ /* h */ { 32760, 32748, 32728, 32700, 32663, 32619, 32567, 32507, 32438, 32362, 32279, 32187, 32088, 31981, 31867, 31746 },
+ /* l */ { 22272, 18304, 11904, 3648, 27008, 17280, 8256, 1344, 30720, 32384, 8256, 25856, 21824, 31360, 24192, 3072 }
+},
+/* LAGW_STRONG */
+{
+ /* h */ { 32755, 32728, 32682, 32619, 32538, 32438, 32322, 32187, 32036, 31867, 31682, 31480, 31263, 31029, 30780, 30517 },
+ /* l */ { 20672, 11904, 31808, 17280, 4480, 30720, 2944, 25856, 8320, 24192, 16896, 28992, 5824, 24384, 31488, 7360 }
+}
+};
+const Word16 lag_window_25k6[NUM_LAGW_STRENGTHS][2][16] =
+{//Q15
+ /* LAGW_WEAK */
+ {
+ /* h */ { 32764, 32763, 32761, 32758, 32754, 32750, 32745, 32739, 32732, 32725, 32716, 32707, 32698, 32687, 32676, 32663 },
+ /* l */ { 10752, 4736, 5568, 13312, 28096, 16896, 12672, 15360, 25024, 8896, 32576, 30464, 2624, 14528, 832, 27008 }
+},
+/* LAGW_MEDIUM */
+{
+ /* h */ { 32763, 32758, 32750, 32739, 32725, 32707, 32687, 32663, 32637, 32607, 32574, 32538, 32498, 32456, 32411, 32362 },
+ /* l */ { 4736, 13312, 16896, 15360, 8896, 30464, 14528, 27008, 2496, 6720, 7296, 4480, 31424, 22976, 12160, 32384 }
+},
+/* LAGW_STRONG */
+{
+ /* h */ { 32761, 32750, 32732, 32707, 32676, 32637, 32591, 32538, 32478, 32411, 32337, 32257, 32169, 32075, 31975, 31867 },
+ /* l */ { 5568, 16896, 25024, 30464, 832, 2496, 3328, 4480, 7040, 12160, 21440, 3520, 25728, 24256, 1216, 24192 }
+}
+};
+const Word16 lag_window_32k[NUM_LAGW_STRENGTHS][2][16] =
+{//Q15
+ /* LAGW_WEAK */
+ {
+ /* h */ { 32764, 32763, 32762, 32760, 32758, 32755, 32752, 32748, 32744, 32739, 32734, 32728, 32722, 32715, 32707, 32700 },
+ /* l */ { 15424, 23360, 14720, 22272, 13312, 20672, 11328, 18304, 8704, 15360, 5504, 11904, 1792, 8000, 30464, 3648 }
+},
+/* LAGW_MEDIUM */
+{
+ /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 },
+ /* l */ { 23360, 22272, 20672, 18304, 15360, 11904, 8000, 3648, 31808, 27008, 22080, 17280, 12608, 8256, 4480, 1344 }
+},
+/* LAGW_STRONG */
+{
+ /* h */ { 32762, 32755, 32744, 32728, 32707, 32682, 32653, 32619, 32581, 32538, 32490, 32438, 32382, 32322, 32257, 32187 },
+ /* l */ { 14720, 20672, 8704, 11904, 30464, 31808, 16384, 17280, 2240, 4480, 24704, 30720, 23168, 2944, 3520, 25856 }
+}
+};
+const Word16 lag_window_48k[2][16] = /* LAGW_STRONG */
+{//Q15
+ /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 },
+ /* l */ { 23360, 22272, 20672, 18304, 15360, 11904, 8000, 3648, 31808, 27008, 22080, 17280, 12608, 8256, 4480, 1344 }
+};
+
+/* 32 bit declarations */
+const Word32 lag_window_8k_32[16] = /* LAGW_STRONG */
+{//Q31
+ 2144886016, 2137753344, 2125918208, 2109458944, 2088484096, 2063131264, 2033565312, 1999976832, 1962579968, 1921610496, 1877322880, 1829987584, 1779888768, 1727321472, 1672588416, 1615997056
+};
+
+const Word32 lag_window_12k8_32[NUM_LAGW_STRENGTHS][16] =
+{//Q31
+ /* LAGW_WEAK */
+ {
+ 2147165440, 2146854912, 2146337792, 2145613824, 2144683392, 2143546880, 2142204288, 2140656384, 2138903424, 2136945792, 2134784256, 2132419328, 2129851776, 2127082368, 2124111616, 2120940800
+},
+/* LAGW_MEDIUM */
+{
+ 2146854912, 2145613824, 2143546880, 2140656384, 2136945792, 2132419328, 2127082368, 2120940800, 2114001792, 2106273280, 2097764224, 2088484096, 2078443648, 2067654016, 2056127616, 2043877504
+},
+/* LAGW_STRONG */
+{
+ 2146337792, 2143546880, 2138903424, 2132419328, 2124111616, 2114001792, 2102115712, 2088484096, 2073141760, 2056127616, 2037485184, 2017261056, 1995505920, 1972273792, 1947621888, 1921610496
+}
+};
+
+const Word32 lag_window_16k_32[NUM_LAGW_STRENGTHS][16] =
+{//Q31
+ /* LAGW_WEAK */
+ {
+ 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440
+},
+/* LAGW_MEDIUM */
+{
+ 2147003904, 2146209536, 2144886016, 2143034496, 2140656384, 2137753344, 2134327424, 2130381440, 2125918208, 2120940800, 2115453056, 2109458944, 2102962816, 2095969536, 2088484096, 2080512000
+},
+/* LAGW_STRONG */
+{
+ 2146673024, 2144886016, 2141911168, 2137753344, 2132419328, 2125918208, 2118260480, 2109458944, 2099527936, 2088484096, 2076345344, 2063131264, 2048863616, 2033565312, 2017261056, 1999976832
+}
+};
+const Word32 lag_window_25k6_32[NUM_LAGW_STRENGTHS][16] =
+{//Q31
+ /* LAGW_WEAK */
+ {
+ 2147243008, 2147165440, 2147036032, 2146854912, 2146622336, 2146337792, 2146001664, 2145613824, 2145174400, 2144683392, 2144140928, 2143546880, 2142901376, 2142204288, 2141456000, 2140656384
+},
+/* LAGW_MEDIUM */
+{
+ 2147165440, 2146854912, 2146337792, 2145613824, 2144683392, 2143546880, 2142204288, 2140656384, 2138903424, 2136945792, 2134784256, 2132419328, 2129851776, 2127082368, 2124111616, 2120940800
+},
+/* LAGW_STRONG */
+{
+ 2147036032, 2146337792, 2145174400, 2143546880, 2141456000, 2138903424, 2135890432, 2132419328, 2128492288, 2124111616, 2119280512, 2114001792, 2108279040, 2102115712, 2095516032, 2088484096
+}
+};
+const Word32 lag_window_32k_32[NUM_LAGW_STRENGTHS][16] =
+{//Q31
+ /* LAGW_WEAK */
+ {
+ 2147252352, 2147202688, 2147119872, 2147003904, 2146854912, 2146673024, 2146457728, 2146209536, 2145928192, 2145613824, 2145266432, 2144886016, 2144472576, 2144026240, 2143546880, 2143034496
+},
+/* LAGW_MEDIUM */
+{
+ 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440
+},
+/* LAGW_STRONG */
+{
+ 2147119872, 2146673024, 2145928192, 2144886016, 2143546880, 2141911168, 2139979776, 2137753344, 2135232896, 2132419328, 2129314048, 2125918208, 2122233088, 2118260480, 2114001792, 2109458944
+}
+};
+const Word32 lag_window_48k_32[16] = /* LAGW_STRONG */
+{//Q31
+ 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440
+};
+/*----------------------------------------------------------------------------------*
+ * LP analysis - grid of points for evaluating Chebyshev polynomials
+ *----------------------------------------------------------------------------------*/
+
+const Word16 grid50_fx[(GRID50_POINTS - 1) / 2 - 1] =
+{//Q15
+ 32703, 32510, 32188, 31739, 31164, 30467,
+ 29649, 28715, 27667, 26510, 25248, 23887,
+ 22431, 20887, 19261, 17558, 15786, 13952,
+ 12063, 10126, 8149, 6140, 4107, 2058
+};
+
+const Word16 grid40_fx[(GRID40_POINTS - 1) / 2 - 1] =
+{//Q15
+ 32667, 32365, 31863, 31164, 30274, 29197,
+ 27939, 26510, 24917, 23170, 21281, 19261,
+ 17121, 14876, 12540, 10126, 7650, 5126,
+ 2571
+};
+
+/*----------------------------------------------------------------------------------*
+ * Sinus & Cosinus - table for the FFT and IFFT of 256 points,
+ * dimension of the table = 161
+ *----------------------------------------------------------------------------------*/
+const Word16 sincos_t_fx[161] =
+{
+ /*Q15 */
+ 0,
+ 804, 1607, 2410, 3211, 4011,
+ 4808, 5602, 6392, 7179, 7961,
+ 8739, 9512, 10278, 11039, 11793,
+ 12539, 13278, 14010, 14732, 15446,
+ 16151, 16846, 17530, 18204, 18868,
+ 19519, 20159, 20787, 21403, 22005,
+ 22594, 23170, 23732, 24279, 24812,
+ 25330, 25832, 26319, 26790, 27245,
+ 27684, 28106, 28511, 28898, 29269,
+ 29621, 29956, 30273, 30572, 30852,
+ 31114, 31357, 31581, 31785, 31971,
+ 32138, 32285, 32413, 32521, 32610,
+ 32679, 32728, 32758, 32767, 32758,
+ 32728, 32679, 32610, 32521, 32413,
+ 32285, 32138, 31971, 31785, 31581,
+ 31357, 31114, 30852, 30572, 30273,
+ 29956, 29621, 29269, 28898, 28511,
+ 28106, 27684, 27245, 26790, 26319,
+ 25832, 25330, 24812, 24279, 23732,
+ 23170, 22594, 22005, 21403, 20787,
+ 20159, 19519, 18868, 18204, 17530,
+ 16846, 16151, 15446, 14732, 14010,
+ 13278, 12539, 11793, 11039, 10278,
+ 9512, 8739, 7961, 7179, 6392,
+ 5602, 4808, 4011, 3211, 2410,
+ 1607, 804, 0, -804, -1607,
+ -2410, -3211, -4011, -4808, -5602,
+ -6392, -7179, -7961, -8739, -9512,
+ -10278, -11039, -11793, -12539, -13278,
+ -14010, -14732, -15446, -16151, -16846,
+ -17530, -18204, -18868, -19519, -20159,
+ -20787, -21403, -22005, -22594, -23170,
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Sinus & Cosinus - table for the FFT and IFFT of 1024 points, value range [0 ... sin(-5pi/4)]
+ * dimension of the table = 641=4*256*(5/8)+1
+ *----------------------------------------------------------------------------------*/
+
+const Word16 sincos_t_ext_fx[641] =
+{//Q15
+ 0, 201, 402, 603, 804, 1005, 1206, 1407,
+ 1608, 1809, 2009, 2210, 2411, 2611, 2811, 3012,
+ 3212, 3412, 3612, 3812, 4011, 4211, 4410, 4609,
+ 4808, 5007, 5205, 5404, 5602, 5800, 5998, 6195,
+ 6393, 6590, 6787, 6983, 7180, 7376, 7571, 7767,
+ 7962, 8157, 8351, 8546, 8740, 8933, 9127, 9319,
+ 9512, 9704, 9896, 10088, 10279, 10469, 10660, 10850,
+ 11039, 11228, 11417, 11605, 11793, 11980, 12167, 12354,
+ 12540, 12725, 12910, 13095, 13279, 13463, 13646, 13828,
+ 14010, 14192, 14373, 14553, 14733, 14912, 15091, 15269,
+ 15447, 15624, 15800, 15976, 16151, 16326, 16500, 16673,
+ 16846, 17018, 17190, 17361, 17531, 17700, 17869, 18037,
+ 18205, 18372, 18538, 18703, 18868, 19032, 19195, 19358,
+ 19520, 19681, 19841, 20001, 20160, 20318, 20475, 20632,
+ 20788, 20943, 21097, 21251, 21403, 21555, 21706, 21856,
+ 22006, 22154, 22302, 22449, 22595, 22740, 22884, 23028,
+ 23170, 23312, 23453, 23593, 23732, 23870, 24008, 24144,
+ 24279, 24414, 24548, 24680, 24812, 24943, 25073, 25202,
+ 25330, 25457, 25583, 25708, 25833, 25956, 26078, 26199,
+ 26320, 26439, 26557, 26674, 26791, 26906, 27020, 27133,
+ 27246, 27357, 27467, 27576, 27684, 27791, 27897, 28002,
+ 28106, 28209, 28311, 28411, 28511, 28610, 28707, 28803,
+ 28899, 28993, 29086, 29178, 29269, 29359, 29448, 29535,
+ 29622, 29707, 29792, 29875, 29957, 30038, 30118, 30196,
+ 30274, 30350, 30425, 30499, 30572, 30644, 30715, 30784,
+ 30853, 30920, 30986, 31050, 31114, 31177, 31238, 31298,
+ 31357, 31415, 31471, 31527, 31581, 31634, 31686, 31737,
+ 31786, 31834, 31881, 31927, 31972, 32015, 32058, 32099,
+ 32138, 32177, 32214, 32251, 32286, 32319, 32352, 32383,
+ 32413, 32442, 32470, 32496, 32522, 32546, 32568, 32590,
+ 32610, 32629, 32647, 32664, 32679, 32693, 32706, 32718,
+ 32729, 32738, 32746, 32753, 32758, 32762, 32766, 32767,
+ 32767, 32767, 32766, 32762, 32758, 32753, 32746, 32738,
+ 32729, 32718, 32706, 32693, 32679, 32664, 32647, 32629,
+ 32610, 32590, 32568, 32546, 32522, 32496, 32470, 32442,
+ 32413, 32383, 32352, 32319, 32286, 32251, 32214, 32177,
+ 32138, 32099, 32058, 32015, 31972, 31927, 31881, 31834,
+ 31786, 31737, 31686, 31634, 31581, 31527, 31471, 31415,
+ 31357, 31298, 31238, 31177, 31114, 31050, 30986, 30920,
+ 30853, 30784, 30715, 30644, 30572, 30499, 30425, 30350,
+ 30274, 30196, 30118, 30038, 29957, 29875, 29792, 29707,
+ 29622, 29535, 29448, 29359, 29269, 29178, 29086, 28993,
+ 28899, 28803, 28707, 28610, 28511, 28411, 28311, 28209,
+ 28106, 28002, 27897, 27791, 27684, 27576, 27467, 27357,
+ 27246, 27133, 27020, 26906, 26791, 26674, 26557, 26439,
+ 26320, 26199, 26078, 25956, 25833, 25708, 25583, 25457,
+ 25330, 25202, 25073, 24943, 24812, 24680, 24548, 24414,
+ 24279, 24144, 24008, 23870, 23732, 23593, 23453, 23312,
+ 23170, 23028, 22884, 22740, 22595, 22449, 22302, 22154,
+ 22006, 21856, 21706, 21555, 21403, 21251, 21097, 20943,
+ 20788, 20632, 20475, 20318, 20160, 20001, 19841, 19681,
+ 19520, 19358, 19195, 19032, 18868, 18703, 18538, 18372,
+ 18205, 18037, 17869, 17700, 17531, 17361, 17190, 17018,
+ 16846, 16673, 16500, 16326, 16151, 15976, 15800, 15624,
+ 15447, 15269, 15091, 14912, 14733, 14553, 14373, 14192,
+ 14010, 13828, 13646, 13463, 13279, 13095, 12910, 12725,
+ 12540, 12354, 12167, 11980, 11793, 11605, 11417, 11228,
+ 11039, 10850, 10660, 10469, 10279, 10088, 9896, 9704,
+ 9512, 9319, 9127, 8933, 8740, 8546, 8351, 8157,
+ 7962, 7767, 7571, 7376, 7180, 6983, 6787, 6590,
+ 6393, 6195, 5998, 5800, 5602, 5404, 5205, 5007,
+ 4808, 4609, 4410, 4211, 4011, 3812, 3612, 3412,
+ 3212, 3012, 2811, 2611, 2411, 2210, 2009, 1809,
+ 1608, 1407, 1206, 1005, 804, 603, 402, 201,
+ 0, -201, -402, -603, -804, -1005, -1206, -1407,
+ -1608, -1809, -2009, -2210, -2411, -2611, -2811, -3012,
+ -3212, -3412, -3612, -3812, -4011, -4211, -4410, -4609,
+ -4808, -5007, -5205, -5404, -5602, -5800, -5998, -6195,
+ -6393, -6590, -6787, -6983, -7180, -7376, -7571, -7767,
+ -7962, -8157, -8351, -8546, -8740, -8933, -9127, -9319,
+ -9512, -9704, -9896, -10088, -10279, -10469, -10660, -10850,
+ -11039, -11228, -11417, -11605, -11793, -11980, -12167, -12354,
+ -12540, -12725, -12910, -13095, -13279, -13463, -13646, -13828,
+ -14010, -14192, -14373, -14553, -14733, -14912, -15091, -15269,
+ -15447, -15624, -15800, -15976, -16151, -16326, -16500, -16673,
+ -16846, -17018, -17190, -17361, -17531, -17700, -17869, -18037,
+ -18205, -18372, -18538, -18703, -18868, -19032, -19195, -19358,
+ -19520, -19681, -19841, -20001, -20160, -20318, -20475, -20632,
+ -20788, -20943, -21097, -21251, -21403, -21555, -21706, -21856,
+ -22006, -22154, -22302, -22449, -22595, -22740, -22884, -23028,
+ -23028
+};/*Q15*/
+
+
+const Word16 Asr_LP16_fx[21] =
+{
+ /*Q15 */
+ 0, 110, 0, -428, 0, 1153, 0, -2832,
+ 0, 10199, 16384, 10199, 0, -2832, 0, 1153,
+ 0, -428, 0, 110, 0
+};
+
+const Word16 Asr_LP32_fx[41] =
+{
+ /*Q15 */
+ 0, 24, 55, 58, 0, -113, -214, -198,
+ 0, 323, 576, 510, 0, -795, -1416, -1280,
+ 0, 2337, 5099, 7334, 8192, 7334, 5099, 2337,
+ 0, -1280, -1416, -795, 0, 510, 576, 323,
+ 0, -198, -214, -113, 0, 58, 55, 24,
+ 0
+};
+
+const Word16 Asr_LP48_fx[61] =
+{
+ /*Q17 */
+ 0, 38, 93, 146, 167, 123, 0, -192,
+ -408, -571, -592, -407, 0, 564, 1143, 1537,
+ 1546, 1035, 0, -1391, -2801, -3776, -3843, -2635,
+ 0, 3919, 8679, 13599, 17887, 20809, 21845, 20809,
+ 17887, 13599, 8679, 3919, 0, -2635, -3843, -3776,
+ -2801, -1391, 0, 1035, 1546, 1537, 1143, 564,
+ 0, -407, -592, -571, -408, -192, 0, 123,
+ 167, 146, 93, 38, 0
+};
+
+const Word16 fft256_read_indexes[]= // Q0
+{
+ 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
+ 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
+ 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
+ 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
+ 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
+ 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
+ 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,
+ 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,
+ 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
+ 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,
+ 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,
+ 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
+ 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
+ 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,
+ 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
+ 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Sinus & Cosinus - table for the DCT-IV based 2
+ *----------------------------------------------------------------------------------*/
+
+const Word16 sin_table256_fx[] =
+{//Q15
+ 101, 302, 503, 704, 905, 1106, 1307, 1507, 1708,
+ 1909, 2110, 2310, 2511, 2711, 2912, 3112, 3312, 3512,
+ 3712, 3911, 4111, 4310, 4510, 4709, 4907, 5106, 5305,
+ 5503, 5701, 5899, 6097, 6294, 6491, 6688, 6885, 7081,
+ 7278, 7473, 7669, 7864, 8059, 8254, 8449, 8643, 8836,
+ 9030, 9223, 9416, 9608, 9800, 9992, 10183, 10374, 10565,
+ 10755, 10945, 11134, 11323, 11511, 11699, 11887, 12074, 12261,
+ 12447, 12633, 12818, 13003, 13187, 13371, 13554, 13737, 13919,
+ 14101, 14282, 14463, 14643, 14823, 15002, 15180, 15358, 15535,
+ 15712, 15888, 16064, 16239, 16413, 16587, 16760, 16932, 17104,
+ 17275, 17446, 17616, 17785, 17953, 18121, 18288, 18455, 18621,
+ 18786, 18950, 19114, 19277, 19439, 19601, 19761, 19921, 20081,
+ 20239, 20397, 20554, 20710, 20865, 21020, 21174, 21327, 21479,
+ 21631, 21781, 21931, 22080, 22228, 22375, 22522, 22668, 22812,
+ 22956, 23099, 23241, 23383, 23523, 23663, 23801, 23939, 24076,
+ 24212, 24347, 24481, 24614, 24746, 24878, 25008, 25138, 25266,
+ 25394, 25520, 25646, 25771, 25894, 26017, 26139, 26259, 26379,
+ 26498, 26616, 26733, 26848, 26963, 27077, 27190, 27301, 27412,
+ 27522, 27630, 27738, 27844, 27950, 28054, 28158, 28260, 28361,
+ 28461, 28560, 28658, 28755, 28851, 28946, 29040, 29132, 29224,
+ 29314, 29404, 29492, 29579, 29665, 29750, 29833, 29916, 29997,
+ 30078, 30157, 30235, 30312, 30388, 30462, 30536, 30608, 30680,
+ 30750, 30819, 30886, 30953, 31018, 31082, 31146, 31207, 31268,
+ 31328, 31386, 31443, 31499, 31554, 31608, 31660, 31711, 31761,
+ 31810, 31858, 31904, 31950, 31994, 32037, 32078, 32119, 32158,
+ 32196, 32233, 32268, 32303, 32336, 32368, 32398, 32428, 32456,
+ 32483, 32509, 32534, 32557, 32579, 32600, 32620, 32638, 32656,
+ 32672, 32686, 32700, 32712, 32723, 32733, 32742, 32749, 32756,
+ 32760, 32764, 32767, 32767
+};
+/*----------------------------------------------------------------------------------*
+ * 1/4 resolution interpolation filter (-3 dB at 0.913*fs/2)
+ *----------------------------------------------------------------------------------*/
+
+const Word16 inter4_2_fx[] =
+{//evs table , some mismatch in values compared to float is observed
+ 0, 1, 2, 1,
+ -2, -7, -10, -7,
+ 4, 19, 28, 22,
+ -2, -33, -55, -49,
+ -10, 47, 91, 92,
+ 38, -52, -133, -153,
+ -88, 43, 175, 231,
+ 165, -9, -209, -325,
+ -275, -60, 226, 431,
+ 424, 175, -213, -544,
+ -619, -355, 153, 656,
+ 871, 626, -16, -762,
+ -1207, -1044, -249, 853,
+ 1699, 1749, 780, -923,
+ -2598, -3267, -2147, 968,
+ 5531, 10359, 14031, 15401,
+ 14031, 10359, 5531, 968,
+ -2147, -3267, -2598, -923,
+ 780, 1749, 1699, 853,
+ -249, -1044, -1207, -762,
+ -16, 626, 871, 656,
+ 153, -355, -619, -544,
+ -213, 175, 424, 431,
+ 226, -60, -275, -325,
+ -209, -9, 165, 231,
+ 175, 43, -88, -153,
+ -133, -52, 38, 92,
+ 91, 47, -10, -49,
+ -55, -33, -2, 22,
+ 28, 19, 4, -7,
+ -10, -7, -2, 1,
+ 2, 1, 0, 0
+};
+
+/* 1/4 resolution interpolation filter (-3 dB at 0.856*fs/2) */
+const Word32 L_pitch_inter4_2[PIT_FIR_SIZE2] = { /* Q31 */
+ 2018634624, 1839083520, 1357785216, 724904576, 126856152, -281447072,
+ -428193216, -340524320, -121030032, 102233104, 229241728, 222704784,
+ 111802296, -32603096, -136805440, -158183648, -99851544, -2110976,
+ 82091856, 114123720, 86026048, 19988778, -46544560, -81104016,
+ -71266392, -27977416, 22982370, 55621972, 56517476, 29680372,
+ -7827578, -36105644, -42638288, -27414776, -1138166, 21646636,
+ 30326764, 22885734, 5570572, -11516955, -20066088, -17396766,
+ -6833293, 5003637, 12101070, 11944304, 6107443, -1346472, -6427418,
+ -7219840, -4389456, -249108, 2823941, 3633542, 2471753, 556198,
+ -895500, -1327144, -932007, -285615, 135291, 210453, 103079, 15032, 0
+};
+const Word16 pitch_inter4_2[PIT_FIR_SIZE2] =
+{
+ /* cut-off frequency at 0.94*fs/2 */
+ 30802/*0.940000f Q15*/,
+ 28062/*0.856390f Q15*/, 20718/*0.632268f Q15*/, 11061/*0.337560f Q15*/, 1936/*0.059072f Q15*/,
+ -4295/*-0.131059f Q15*/, -6534/*-0.199393f Q15*/, -5196/*-0.158569f Q15*/, -1847/*-0.056359f Q15*/,
+ 1560/*0.047606f Q15*/, 3498/*0.106749f Q15*/, 3398/*0.1037059f Q15*/, 1706/*0.052062f Q15*/,
+ -497/*-0.015182f Q15*/, -2087/*-0.063705f Q15*/, -2414/*-0.073660f Q15*/, -1524/*-0.046497f Q15*/,
+ -32/*-0.000983f Q15*/, 1253/*0.038227f Q15*/, 1741/*0.053143f Q15*/, 1313/*0.040059f Q15*/,
+ 305/*0.009308f Q15*/, -710/*-0.021674f Q15*/, -1238/*-0.037767f Q15*/, -1087/*-0.033186f Q15*/,
+ -427/*-0.013028f Q15*/, 351/*0.010702f Q15*/, 849/*0.025901f Q15*/, 862/*0.026318f Q15*/,
+ 453/*0.013821f Q15*/, -119/*-0.003645f Q15*/, -551/*-0.016813f Q15*/, -651/*-0.019855f Q15*/,
+ -418/*-0.012766f Q15*/, -17/*-0.000530f Q15*/, 330/*0.010080f Q15*/, 463/*0.014122f Q15*/,
+ 349/*0.010657f Q15*/, 85/*0.002594f Q15*/, -176/*-0.005363f Q15*/, -306/*-0.009344f Q15*/,
+ -265/*-0.008101f Q15*/, -104/*-0.003182f Q15*/, 76/*0.002330f Q15*/, 185/*0.005635f Q15*/,
+ 182/*0.005562f Q15*/, 93/*0.002844f Q15*/, -21/*-0.000627f Q15*/, -98/*-0.002993f Q15*/,
+ -110/*-0.003362f Q15*/, -67/*-0.002044f Q15*/, -4/*-0.000116f Q15*/, 43/*0.001315f Q15*/,
+ 55/*0.001692f Q15*/, 38/*0.001151f Q15*/, 8/*0.000259f Q15*/, -14/*-0.000417f Q15*/,
+ -20/*-0.000618f Q15*/, -14/*-0.000434f Q15*/, -4/*-0.000133f Q15*/, 2/*0.000063f Q15*/,
+ 3/*0.000098f Q15*/, 2/*0.000048f Q15*/, 0/*0.000007f Q15*/, 0/*0.000000f Q15*/
+};
+/* 1/4 resolution interpolation filter (-3 dB at 0.791*fs/2) */
+const Word32 L_pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1] = /* Q31 */
+{
+ 1932735283, 1758701061, 1298905484, 711630983, 180298432, -162768528,
+ -280712608, -226956816, -100446400, 9592809, 59676424, 55065776,
+ 26996016, 4138201, -3373696, -1617055, 0
+};
+/* 1/4 resolution interpolation filter (-3 dB at 0.791*fs/2) */
+const Word16 pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1] =
+{
+ 29491/*0.900000F Q15*/,
+ 26836/*0.818959F Q15*/, 19820/* 0.604850F Q15*/, 10859/* 0.331379F Q15*/, 2751/* 0.083958F Q15*/,
+ -2484/*-0.075795F Q15*/, -4283/* -0.130717F Q15*/, -3463/*-0.105685F Q15*/, -1533/*-0.046774F Q15*/,
+ 146/*0.004467F Q15*/, 911/* 0.027789F Q15*/, 840/* 0.025642F Q15*/, 412/* 0.012571F Q15*/,
+ 63/*0.001927F Q15*/, -51/* -0.001571F Q15*/, -25/*-0.000753F Q15*/, 0/* 0.000000f Q15*/
+};
+
+/*----------------------------------------------------------------------------------*
+ * 1/6 resolution interpolation filter (-3 dB at 0.95*fs/2)
+ *----------------------------------------------------------------------------------*/
+
+/* 1/6 resolution interpolation filter (-3 dB at 0.95*fs/2) */
+const Word16 pitch_inter6_2[PIT_FIR_SIZE6_2] =
+{
+ 31129/*0.949986374119862f Q15*/,
+ 29854/*0.911081104469830f Q15*/,
+ 26218/*0.800115099292852f Q15*/,
+ 20753/*0.633320673120883f Q15*/,
+ 14240/*0.434558462154083f Q15*/,
+ 7575/*0.231177017786780f Q15*/,
+ 1618/*0.049378173063717f Q15*/,
+ -2950/*-0.090039611811170f Q15*/,
+ -5727/*-0.174782560924477f Q15*/,
+ -6635/*-0.202477516286360f Q15*/,
+ -5905/*-0.180218293244902f Q15*/,
+ -4012/*-0.122429229978978f Q15*/,
+ -1558/*-0.047552067127379f Q15*/,
+ 843/*0.025733669494145f Q15*/,
+ 2687/*0.081995376731897f Q15*/,
+ 3656/*0.111581381838187f Q15*/,
+ 3663/*0.111781798292302f Q15*/,
+ 2834/*0.086499988914996f Q15*/,
+ 1462/*0.044629684447068f Q15*/,
+ -79/*-0.002416435594242f Q15*/,
+ -1423/*-0.043440027386915f Q15*/,
+ -2289/*-0.069857782812169f Q15*/,
+ -2533/*-0.077293683967992f Q15*/,
+ -2166/*-0.066098268486336f Q15*/,
+ -1336/*-0.040782649068098f Q15*/,
+ -282/*-0.008590773415008f Q15*/,
+ 734/*0.022397654632128f Q15*/,
+ 1480/*0.045171360007974f Q15*/,
+ 1811/*0.055274128677739f Q15*/,
+ 1690/*0.051578034020076f Q15*/,
+ 1187/*0.036232016917169f Q15*/,
+ 454/*0.013869500422767f Q15*/,
+ -317/*-0.009680698856947f Q15*/,
+ -945/*-0.028843394410080f Q15*/,
+ -1296/*-0.039560663181280f Q15*/,
+ -1314/*-0.040095747151623f Q15*/,
+ -1023/*-0.031231107680685f Q15*/,
+ -520/*-0.015866154815425f Q15*/,
+ 60/*0.001841532922707f Q15*/,
+ 575/*0.017553701334759f Q15*/,
+ 910/*0.027778555138199f Q15*/,
+ 1003/*0.030612329573745f Q15*/,
+ 853/*0.026046143652186f Q15*/,
+ 518/*0.015803012695681f Q15*/,
+ 91/*0.002782973481834f Q15*/,
+ -319/*-0.009720124055079f Q15*/,
+ -617/*-0.018826488463900f Q15*/,
+ -744/*-0.022710487805852f Q15*/,
+ -686/*-0.020936374578238f Q15*/,
+ -473/*-0.014436620433404f Q15*/,
+ -169/*-0.005169079181373f Q15*/,
+ 145/*0.004437651243491f Q15*/,
+ 397/*0.012100372954920f Q15*/,
+ 531/*0.016207075406240f Q15*/,
+ 529/*0.016135389123271f Q15*/,
+ 403/*0.012306629559665f Q15*/,
+ 196/*0.005986734945567f Q15*/,
+ -36/*-0.001094950878591f Q15*/,
+ -236/*-0.007200842219958f Q15*/,
+ -360/*-0.010998212848124f Q15*/,
+ -388/*-0.011835179448280f Q15*/,
+ -322/*-0.009826566540474f Q15*/,
+ -188/*-0.005747665080695f Q15*/,
+ -26/*-0.000780600030751f Q15*/,
+ 125/*0.003810613287985f Q15*/,
+ 229/*0.006990479233404f Q15*/,
+ 268/*0.008174249796791f Q15*/,
+ 240/*0.007317375965949f Q15*/,
+ 159/*0.004864690818765f Q15*/,
+ 52/*0.001587005259212f Q15*/,
+ -54/*-0.001642504305841f Q15*/,
+ -133/*-0.004070609517416f Q15*/,
+ -171/*-0.005230670504649f Q15*/,
+ -164/*-0.005019147682711f Q15*/,
+ -120/*-0.003673879223241f Q15*/,
+ -55/*-0.001671460853812f Q15*/,
+ 14/*0.000420750005150f Q15*/,
+ 69/*0.002095384947391f Q15*/,
+ 99/*0.003020513665060f Q15*/,
+ 101/*0.003095468528243f Q15*/,
+ 80/*0.002441025550729f Q15*/,
+ 44/*0.001335514431569f Q15*/,
+ 4/*0.000120805384516f Q15*/,
+ -29/*-0.000893340757369f Q15*/,
+ -49/*-0.001501610712267f Q15*/,
+ -54/*-0.001636887611783f Q15*/,
+ -45/*-0.001362571776250f Q15*/,
+ -27/*-0.000832126175863f Q15*/,
+ -8/*-0.000232033375863f Q15*/,
+ 9/*0.000273627139471f Q15*/,
+ 19/*0.000582092683087f Q15*/,
+ 22/*0.000666445711949f Q15*/,
+ 19/*0.000566088888178f Q15*/,
+ 12/*0.000360374058147f Q15*/,
+ 4/*0.000136306914913f Q15*/,
+ -1/*-0.000038864994777f Q15*/,
+ -4/*-0.000132755824518f Q15*/,
+ -5/*-0.000148377158880f Q15*/,
+ -4/*-0.000112937171810f Q15*/,
+ -2/*-0.000061132514471f Q15*/,
+ -1/*-0.000019974224468f Q15*/,
+ 0/*-0.000000460344975f Q15*/,
+ 0/*0.000001976848453f Q15*/
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Low-pass FIR filter for low-frequency post-filtering @ 16kHz
+ * response : -6dB @ 50Hz, -3dB @ 500Hz, -6dB @ 6.4kHz)
+ * L_FILT=15 @ 16kHz (1+4x15=61 coef)
+ * L_FILT=12 @ 12.8kHz (1+5x12=61 coef)
+ * filter parameters: fs/2=32000, fc=6400, gain=5.0, n=61
+ *----------------------------------------------------------------------------------*/
+
+const Word16 filter_LP12_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )' */
+{//Q14
+ 16384, 16196, 15641, 14741, 13533, 12067,
+ 10402, 8604, 6742, 4887, 3105, 1459,
+ 0, -1230, -2202, -2900, -3322, -3478,
+ -3392, -3095, -2628, -2037, -1371, -676,
+ 0, 618, 1143, 1550, 1822, 1954,
+ 1946, 1811, 1565, 1233, 842, 421,
+ 0, -394, -736, -1008, -1196, -1294,
+ -1299, -1217, -1059, -839, -576, -290,
+ 0, 274, 514, 707, 842, 913,
+ 920, 865, 755, 600, 413, 208,
+ 0, -197, -371, -511, -609, -662,
+ -667, -627, -548, -436, -300, -151,
+ 0, 143, 270, 371, 443, 481,
+ 485, 456, 398, 316, 217, 109,
+ 0, -104, -195, -268, -319, -346,
+ -348, -326, -284, -225, -155, -78,
+ 0, 73, 137, 189, 224, 242,
+ 243, 227, 198, 156, 107, 54,
+ 0, -50, -94, -128, -151, -163,
+ -163, -152, -131, -103, -70, -35,
+ 0, 32, 60, 82, 96, 103,
+ 102, 95, 81, 64, 43, 21,
+ 0, -19, -36, -48, -56, -59,
+ -58, -53, -45, -35, -23, -11,
+ 0, 10, 18, 24, 28, 29,
+ 28, 25, 21, 16, 10, 5,
+ 0, -4, -7, -9, -10, -10,
+ -9, -8, -6, -5, -3, -1,
+ 0, 1, 1, 2, 2, 1,
+ 1, 1, 0, 0, 0, 0,
+ 0
+};
+const Word16 filter_LP12_180H_13b_fx[] = /*Q13 Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )*/
+{//Q13
+ 8192, 8098, 7820, 7370, 6766, 6033,
+ 5201, 4302, 3371, 2443, 1553, 729,
+ 0, -615, -1101, -1450, -1661, -1739,
+ -1696, -1547, -1314, -1019, -685, -338,
+ 0, 309, 571, 775, 911, 977,
+ 973, 905, 783, 616, 421, 210,
+ 0, -197, -368, -504, -598, -647,
+ -649, -608, -529, -420, -288, -145,
+ 0, 137, 257, 353, 421, 457,
+ 460, 432, 377, 300, 206, 104,
+ 0, -99, -185, -255, -305, -331,
+ -333, -314, -274, -218, -150, -76,
+ 0, 72, 135, 186, 221, 240,
+ 242, 228, 199, 158, 109, 55,
+ 0, -52, -97, -134, -159, -173,
+ -174, -163, -142, -113, -77, -39,
+ 0, 37, 69, 94, 112, 121,
+ 121, 114, 99, 78, 53, 27,
+ 0, -25, -47, -64, -76, -81,
+ -81, -76, -66, -52, -35, -18,
+ 0, 16, 30, 41, 48, 52,
+ 51, 47, 41, 32, 21, 11,
+ 0, -10, -18, -24, -28, -30,
+ -29, -27, -23, -17, -12, -6,
+ 0, 5, 9, 12, 14, 14,
+ 14, 13, 10, 8, 5, 2,
+ 0, -2, -4, -5, -5, -5,
+ -5, -4, -3, -2, -1, -1,
+ 0, 0, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0,
+ 0
+};
+
+const Word16 filter_LP15_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */
+{//Q14
+ 16384, 16263, 15904, 15317, 14516, 13524,
+ 12366, 11073, 9678, 8216, 6723, 5236,
+ 3790, 2416, 1144, 0, -997, -1831,
+ -2492, -2976, -3285, -3425, -3408, -3248,
+ -2966, -2583, -2123, -1610, -1070, -526,
+ 0, 487, 919, 1281, 1564, 1761,
+ 1869, 1891, 1830, 1695, 1496, 1244,
+ 954, 641, 318, 0, -300, -569,
+ -799, -982, -1113, -1188, -1209, -1176,
+ -1094, -969, -809, -623, -420, -209,
+ 0, 198, 377, 531, 653, 741,
+ 793, 807, 786, 732, 649, 543,
+ 418, 282, 140, 0, -133, -253,
+ -356, -438, -497, -531, -540, -526,
+ -489, -433, -362, -278, -187, -93,
+ 0, 88, 167, 234, 288, 325,
+ 347, 352, 342, 317, 280, 233,
+ 179, 120, 59, 0, -56, -105,
+ -147, -180, -203, -215, -217, -210,
+ -194, -170, -141, -107, -72, -35,
+ 0, 33, 61, 85, 103, 116,
+ 122, 122, 117, 107, 93, 76,
+ 58, 38, 19, 0, -17, -31,
+ -43, -51, -57, -59, -58, -55,
+ -49, -42, -34, -25, -16, -8,
+ 0, 7, 12, 16, 19, 20,
+ 21, 20, 18, 16, 13, 10,
+ 7, 4, 2, 0, -1, -2,
+ -3, -3, -3, -3, -2, -2,
+ -1, -1, 0, 0, 0, 0,
+ 0
+};
+
+const Word16 filter_LP15_180H_13b_fx[6 * 31] = /*Q13 Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )'*/
+{//Q13
+ 8192, 8132, 7952, 7658, 7258, 6762,
+ 6183, 5536, 4839, 4108, 3362, 2618,
+ 1895, 1208, 572, 0, -498, -915,
+ -1246, -1488, -1643, -1713, -1704, -1624,
+ -1483, -1291, -1061, -805, -535, -263,
+ 0, 244, 459, 640, 782, 880,
+ 935, 945, 915, 848, 748, 622,
+ 477, 320, 159, 0, -150, -285,
+ -400, -491, -556, -594, -604, -588,
+ -547, -485, -405, -312, -210, -104,
+ 0, 99, 189, 265, 327, 371,
+ 396, 404, 393, 366, 325, 271,
+ 209, 141, 70, 0, -66, -127,
+ -178, -219, -248, -266, -270, -263,
+ -245, -217, -181, -139, -94, -46,
+ 0, 44, 83, 117, 144, 163,
+ 173, 176, 171, 158, 140, 116,
+ 89, 60, 30, 0, -28, -53,
+ -74, -90, -101, -108, -109, -105,
+ -97, -85, -70, -54, -36, -18,
+ 0, 16, 31, 43, 52, 58,
+ 61, 61, 58, 53, 47, 38,
+ 29, 19, 9, 0, -8, -16,
+ -21, -26, -28, -29, -29, -27,
+ -25, -21, -17, -13, -8, -4,
+ 0, 3, 6, 8, 10, 10,
+ 10, 10, 9, 8, 6, 5,
+ 3, 2, 1, 0, -1, -1,
+ -1, -2, -2, -1, -1, -1,
+ -1, 0, 0, 0, 0, 0,
+ 0
+};
+
+const Word16 filter_LP24_90H_fx[] =
+{//Q14
+
+ 10240, 10208, 10111, 9951, 9731,
+ 9452, 9119, 8734, 8304, 7834,
+ 7328, 6794, 6237, 5664, 5081,
+ 4495, 3913, 3339, 2780, 2241,
+ 1727, 1242, 791, 376, 0,
+ -335, -629, -880, -1089, -1256,
+ -1383, -1471, -1523, -1540, -1527,
+ -1487, -1422, -1337, -1235, -1119,
+ -994, -862, -727, -592, -460,
+ -333, -212, -101, 0, 90,
+ 167, 232, 285, 325, 354,
+ 371, 378, 376, 366, 349,
+ 326, 299, 269, 236, 203,
+ 171, 139, 109, 81, 56,
+ 34, 15, 0, -12, -21,
+ -27, -30, -31, -31, -29,
+ -26, -22, -18, -14, -10,
+ -7, -4, -2, -1, 0,
+ 0, 0, 0, 0, 0,
+ 0,
+ 0
+
+};
+
+const Word16 filter_LP24_90H_13b_fx[] =
+{//Q13
+
+ 5120, 5104, 5056, 4976, 4865,
+ 4726, 4559, 4367, 4152, 3917,
+ 3664, 3397, 3119, 2832, 2541,
+ 2248, 1956, 1669, 1390, 1120,
+ 863, 621, 396, 188, 0,
+ -168, -315, -440, -545, -628,
+ -691, -735, -761, -770, -764,
+ -743, -711, -668, -617, -560,
+ -497, -431, -364, -296, -230,
+ -166, -106, -51, 0, 45,
+ 84, 116, 143, 163, 177,
+ 186, 189, 188, 183, 174,
+ 163, 149, 134, 118, 102,
+ 85, 69, 54, 40, 28,
+ 17, 8, 0, -6, -10,
+ -13, -15, -16, -15, -14,
+ -13, -11, -9, -7, -5,
+ -3, -2, -1, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0,
+ 0
+};
+
+const Word16 filter_LP3_90H_fx[] = /* Sincfilt.m: N=90*2+1, Fmin=0, Fmax=1/3, hann( N )' */
+{//Q14
+ 16384, 13545, 6766, 0, -3371, -2689,
+ 0, 1907, 1661, 0, -1314, -1187,
+ 0, 990, 911, 0, -783, -729,
+ 0, 638, 598, 0, -529, -499,
+ 0, 445, 421, 0, -377, -357,
+ 0, 321, 305, 0, -274, -260,
+ 0, 234, 221, 0, -199, -188,
+ 0, 169, 159, 0, -142, -134,
+ 0, 119, 112, 0, -99, -93,
+ 0, 81, 76, 0, -66, -61,
+ 0, 52, 48, 0, -41, -37,
+ 0, 31, 28, 0, -23, -20,
+ 0, 16, 14, 0, -10, -9,
+ 0, 6, 5, 0, -3, -2,
+ 0, 1, 1, 0, 0, 0,
+ 0
+};
+
+const Word16 filter_LP15_360H_13b_fx[] = /* Sincfilt.m: N=360*2+1, Fmin=0, Fmax=1/15, hann( N )' */
+{//Q13
+
+ 8192, 8132, 7954, 7662, 7265, 6772, 6196, 5552,
+ 4857, 4127, 3381, 2636, 1911, 1220, 579, 0,
+ -506, -931, -1269, -1519, -1681, -1757, -1752, -1674,
+ -1533, -1339, -1104, -840, -560, -276, 0, 258,
+ 488, 682, 836, 946, 1008, 1024, 996, 927,
+ 821, 687, 529, 357, 178, 0, -170, -325,
+ -458, -567, -646, -694, -710, -696, -652, -581,
+ -489, -379, -257, -129, 0, 124, 238, 338,
+ 420, 481, 518, 533, 523, 492, 440, 372,
+ 289, 197, 99, 0, -96, -184, -262, -326,
+ -374, -405, -417, -410, -386, -346, -293, -228,
+ -156, -78, 0, 76, 147, 209, 260, 299,
+ 324, 334, 329, 310, 279, 236, 184, 125,
+ 63, 0, -62, -119, -169, -211, -243, -263,
+ -271, -268, -252, -227, -192, -150, -102, -52,
+ 0, 50, 97, 138, 173, 198, 215, 222,
+ 219, 207, 186, 157, 123, 84, 42, 0,
+ -41, -80, -113, -142, -163, -176, -182, -180,
+ -170, -152, -129, -101, -69, -35, 0, 34,
+ 65, 93, 116, 133, 144, 149, 147, 139,
+ 125, 106, 82, 56, 28, 0, -28, -53,
+ -76, -95, -109, -118, -121, -120, -113, -101,
+ -86, -67, -46, -23, 0, 22, 43, 61,
+ 77, 88, 95, 98, 97, 91, 82, 69,
+ 54, 37, 19, 0, -18, -35, -49, -61,
+ -70, -76, -78, -77, -73, -65, -55, -43,
+ -29, -15, 0, 14, 27, 39, 48, 55,
+ 60, 62, 61, 57, 51, 43, 33, 23,
+ 11, 0, -11, -21, -30, -37, -43, -46,
+ -48, -47, -44, -39, -33, -26, -17, -9,
+ 0, 8, 16, 23, 28, 32, 35, 36,
+ 35, 33, 29, 25, 19, 13, 6, 0,
+ -6, -12, -17, -21, -24, -25, -26, -25,
+ -24, -21, -18, -14, -9, -5, 0, 4,
+ 8, 12, 14, 16, 18, 18, 17, 16,
+ 14, 12, 9, 6, 3, 0, -3, -6,
+ -8, -10, -11, -11, -12, -11, -10, -9,
+ -8, -6, -4, -2, 0, 2, 3, 5,
+ 6, 6, 7, 7, 7, 6, 5, 4,
+ 3, 2, 1, 0, -1, -2, -3, -3,
+ -3, -3, -3, -3, -3, -3, -2, -2,
+ -1, 0, 0, 0, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0
+
+};
+
+static const Word16 filter_LP30_300K_fx[LFE_PLC_FDEL + 1] =
+{//Q14
+16395,16364,16273,16123,15913,15646,15323,14947,14520,14045,13524,12963,12363,11730,11067,10379,9669,
+8943,8205,7460,6712,5965,5225,4495,3779,3082,2408,1759,1140,552,0,-515,-991,-1426,-1819,-2169,-2475,
+-2736,-2953,-3126,-3257,-3345,-3392,-3400,-3371,-3307,-3210,-3083,-2928,-2749,-2547,-2327,-2091,-1842,
+-1584,-1319,-1051,-782,-515,-254,0,244,476,695,897,1083,1249,1397,1523,1628,1712,1774,1815,1834,1833,
+1811,1771,1712,1637,1546,1442,1325,1197,1060,916,767,614,459,304,150,0,-145,-285,-417,-541,-655,-758,
+-850,-930,-997,-1051,-1092,-1119,-1134,-1136,-1125,-1102,-1068,-1023,-968,-904,-832,-753,-668,-578,
+-484,-388,-290,-192,-95,0,92,181,266,345,418,484,543,594,638,672,699,717,727,728,721,707,685,656,621,580,
+534,483,428,371,311,249,186,123,61,0,-59,-116,-170,-220,-267,-309,-347,-379,-407,-429,-445,-456,-462,-463,
+-458,-448,-434,-416,-393,-367,-337,-305,-270,-233,-195,-156,-117,-77,-38,0,37,72,106,137,166,192,215,234,251,
+264,274,280,283,283,280,274,264,253,238,222,204,184,162,140,117,93,69,46,22,0,-21,-42,-62,-80,-97,-112,-125,-136,
+-146,-153,-158,-161,-163,-162,-160,-156,-150,-143,-135,-125,-114,-103,-91,-78,-65,-51,-38,-25,-12,0,11,23,33,43,
+52,59,66,72,76,80,82,84,84,83,82,79,76,72,67,62,57,51,44,38,31,25,18,12,5,0,-5,-10,-15,-19,-23,-27,-29,-32,-34,
+-35,-36,-36,-36,-35,-34,-33,-31,-29,-27,-24,-22,-19,-17,-14,-11,-9,-6,-4,-2,0
+
+};
+
+const Resampling_cfg resampling_cfg_tbl[] =
+{
+ /* fin fout up.fact. den.fac. len.out filter coefs. filter length/2 filter mem./2 flags */
+ { 8000, 12800, 8, 5, 256, /*filter5_39s320_120,*/ filter5_39s320_120_fx, 15, RS_INV_FAC },
+ { 12800, 8000, 5, 8, 160, /*filter5_39s320_120,*/ filter5_39s320_120_fx, L_FILT_UP8k, RS_INV_FAC },
+ { 16000, 8000, 6, 12, 160, /*filter_LP12_180H,*/ filter_LP12_180H_fx, 180 / 6, 0 },
+ { 12800, 16000, 15, 12, 320, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT_UP16k, 0 },
+ { 12800, 32000, 15, 6, 640, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT_UP32k, 0 },
+ { 12800, 48000, 15, 4, 960, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT_UP48k, 0 },
+
+ { 16000, 12800, 12, 15, 256, /*filter_LP15_180H,*/ filter_LP15_180H_fx, L_FILT16k, 0, },
+ { 16000, 32000, 12, 6, 640, /*filter_LP12_180H, */ filter_LP12_180H_fx, L_FILT16k, 0, },
+ { 16000, 48000, 12, 4, 960, /*filter_LP12_180H,*/ filter_LP12_180H_fx, L_FILT16k, 0, },
+
+ { 32000, 12800, 6, 15, 256, /*filter_LP15_180H,*/ filter_LP15_180H_13b_fx, L_FILT32k, 0, },
+ { 32000, 16000, 6, 12, 320, /*filter_LP12_180H,*/ filter_LP12_180H_13b_fx, L_FILT32k, 0, },
+ { 32000, 25600, 12, 15, 512, /*filter_LP15_360H,*/ filter_LP15_360H_13b_fx, L_FILT32k, 0, },
+ { 32000, 48000, 3, 2, 960, /*filter_LP3_90H,*/ filter_LP3_90H_fx, L_FILT32k, 0, },
+
+ { 48000, 12800, 4, 15, 256, /*filter_LP15_180H,*/ filter_LP15_180H_13b_fx, L_FILT48k, 0, },
+ { 48000, 16000, 4, 12, 320, /*filter_LP12_180H,*/ filter_LP12_180H_13b_fx, L_FILT48k, 0, },
+ { 48000, 25600, 8, 15, 512, /*filter_LP15_360H,*/ filter_LP15_360H_13b_fx, L_FILT48k, 0, },
+ { 48000, 32000, 2, 3, 640, /*filter_LP3_90H,*/ filter_LP3_90H_fx, L_FILT48k, 0, },
+
+ /* configs with NB 4kHz low-pass */
+ { 16000, 12800, 12, 15, 256, /*filter_LP24_90H,*/ filter_LP24_90H_fx, L_FILT16k, 0, },
+ { 32000, 12800, 6, 15, 256, /*filter_LP24_90H,*/ filter_LP24_90H_13b_fx, L_FILT32k, 0, },
+ { 48000, 12800, 4, 15, 256, /*filter_LP24_90H,*/ filter_LP24_90H_13b_fx, L_FILT48k, 0, },
+
+ /* entry for LFE PLC */
+ { 1600, 48000, 30, 1, 960, /*filter_LP30_300K,*/ filter_LP30_300K_fx, LFE_PLC_FDEL / 30, 0, },
+ { 0, 0, 0, 0, 0, /* 0, */ 0, 0, 0, } /* trailing entry (just to calculate the length of this table) */
+};
+
+//den fac value for last entry is calculated as den.fac = (num.fac*fin)/fout
+//lg_out value for last entry is calculated as = fout/50 = ((fin/50)*num.fac)/den.fac
+//filter_LP30_300K_fx has been calculated with Q14
+
+/*----------------------------------------------------------------------------------*
+ * LSP interpolation coefficients
+ *----------------------------------------------------------------------------------*/
+
+
+const Word16 interpol_frac2_fx[NB_SUBFR] = {//Q15
+ 16384, 16384, 32767, 32767
+};
+
+const Word16 interpol_frac2_mid_fx[NB_SUBFR * 3] = {//Q15
+ 8191, 24575, 0,
+ 8191, 24575, 0,
+ 0, 8191, 24575,
+ 0, 8191, 24575
+};/*Q15*/
+
+
+const Word16 interpol_frac_12k8_fx[NB_SUBFR] = {//Q15
+ 8191, 16383, 24575, 32767
+};
+
+const Word16 interpol_frac_fx[NB_SUBFR] = { 8192, 16384, 24576,32767 };/*Q15*/
+
+const Word16 interpol_isp_amr_wb_fx[] = { 14746, 26214, 31457, 32767 };/*Q15*/
+
+const Word16 interpol_frac_16k_fx[NB_SUBFR16k] = { 6554, 13107, 19661, 26214, 32767 };//Q15
+
+const Word16 interpol_frac_mid_fx[NB_SUBFR * 3] = { 16384, 16384, 0,//Q15
+ 0, 32767, 0,
+ 0, 16384, 16384,
+ 0, 0, 32767
+};/*Q15*/
+
+const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3] = { 18022, 14746, 0,//Q15
+ 4915, 27853, 0,
+ 0, 24576, 8192,
+ 0, 11469, 21299,
+ 0, 0, 32767
+};
+
+const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3] = { 0, 22938, 9830,//Q15
+ 0, 0, 32767,
+ 0, 0, 32767,
+ 0, 0, 32767
+};/*Q15*/
+
+const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3] = { 8192, 18022, 6554,//Q15
+ 0, 22938, 9830,
+ 0, 14746, 18022,
+ 0, 0, 32767
+};/*Q15*/
+
+const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3] = { 4915, 22938, 4915,//Q15
+ 1638, 21299, 9830,
+ 0, 16384, 16384,
+ 0, 0, 32767
+};
+
+const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3] = { 0, 22938, 9830,//Q15
+ 0, 0, 32767,
+ 0, 0, 32767,
+ 0, 0, 32767,
+ 0, 0, 32767
+};/*Q15*/
+
+const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3] = { 13107, 13107, 6554,//Q15
+ 0, 26214, 6554,
+ 0, 21299, 11469,
+ 0, 4915, 27853,
+ 0, 0, 32767
+};/*Q15*/
+
+const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3] = { 4915, 22938, 4915,//Q15
+ 1638, 21299, 9830,
+ 0, 16384, 16384,
+ 0, 4915, 27853,
+ 0, 0, 32767
+};/*Q15*/
+
+/*----------------------------------------------------------------------------------*
+ * Innovative codebook
+ *----------------------------------------------------------------------------------*/
+
+/* Innovative codebook config */
+const PulseConfig PulseConfTable[] =
+{
+ /* Design rules:
+ * ---> "fixed" + "tried-pair-pos"*2 = pulses & 0xfe
+ * ---> tracks with pulses % 3 == 0, have always TRACKPOS_FIXED_FIRST */
+ /* bits,iter,alp,pulses,fixed,tried-pair-pos,codetrack */
+ { 7, 4, 16384/*2.0f Q13*/, 1, 0, {8}, TRACKPOS_FREE_ONE }, /* 7 bits, 1 pulses, 4 tracks, 1000 free track */
+ { 10, 4, 16384/*2.0f Q13*/, 2, 0, {8}, TRACKPOS_FIXED_EVEN }, /* 10 bits, 2 pulses, 4 tracks 1010 (used only even tracks designed for NB) */
+ { 12, 4, 16384/*2.0f Q13*/, 2, 0, {8}, TRACKPOS_FIXED_TWO }, /* 12 bits, 2 pulses, 2 tracks 11 used all tracks ala AMR-WB 6.6 */
+ { 15, 4, 16384/*2.0f Q13*/, 3, 0, {8}, TRACKPOS_FIXED_FIRST }, /* 15 bits, 3 pulses, 4 tracks 1110 fixed track to first ? */
+ { 17, 6, 16384/*2.0f Q13*/, 3, 0, {8}, TRACKPOS_FREE_THREE }, /* 17 bits, 3 pulses, 4 tracks (used all tracks) - 1110, 1101, 1011, 0111 */
+ { 20, 4, 16384/*2.0f Q13*/, 4, 0, {4, 8}, TRACKPOS_FIXED_FIRST }, /* 20 bits, 4 pulses, 4 tracks 1111 */
+ { 24, 4, 16384/*2.0f Q13*/, 5, 0, {4, 8}, TRACKPOS_FIXED_FIRST }, /* 24 bits, 5 pulses, 4 tracks 2111 fixed track to first */
+ { 26, 4, 16384/*2.0f Q13*/, 5, 0, {4, 8}, TRACKPOS_FREE_ONE }, /* 26 bits, 5 pulses, 4 tracks 2111 one free track ? */
+ { 28, 4, 12288/*1.5f Q13*/, 6, 0, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 28 bits, 6 pulses, 4 tracks 2211 */
+ { 30, 4, 12288/*1.5f Q13*/, 6, 0, {4, 8, 8}, TRACKPOS_FIXED_TWO }, /* 30 bits, 6 pulses, 4 tracks 2211 free consecutive track positions ? */
+ { 32, 4, 12288/*1.5f Q13*/, 7, 0, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 32 bits, 6 pulses, 4 tracks 2221 fixed ?*/
+ { 34, 4, 12288/*1.5f Q13*/, 7, 0, {4, 8, 8}, TRACKPOS_FREE_THREE }, /* 34 bits, 6 pulses, 4 tracks 2221 free track positions ? */
+ { 36, 4, 8192/*1.0f Q13*/, 8, 2, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 36 bits, 8 pulses, 4 tracks 2222 */
+ { 40, 4, 8192/*1.0f Q13*/, 9, 2, {4, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 40 bits, 9 pulses, 4 tracks 3222 fixed ?*/
+ { 43, 4, 8192/*1.0f Q13*/, 10, 2, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 44 bits, 10 pulses, 4 tracks 3322 */
+ { 46, 4, 8192/*1.0f Q13*/, 10, 2, {4, 6, 8, 8}, TRACKPOS_FIXED_TWO }, /* 46 bits, 10 pulses, 4 tracks 3322 free consecutive tracks ? */
+ { 47, 4, 8192/*1.0f Q13*/, 11, 2, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 47 bits, 10 pulses, 4 tracks 3332 fixed ? */
+ { 49, 4, 8192/*1.0f Q13*/, 11, 2, {4, 6, 8, 8}, TRACKPOS_FREE_THREE }, /* 49 bits, 10 pulses, 4 tracks 3332 free three track positions ? */
+ { 50, 4, 8192/*1.0f Q13*/, 12, 4, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 50 bits, 12 pulses, 4 tracks 3333 */
+ { 53, 4, 8192/*1.0f Q13*/, 13, 4, {4, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 53 bits, 13 pulses, 4 tracks 4333 fixed ? */
+ { 55, 4, 8192/*1.0f Q13*/, 13, 4, {4, 6, 8, 8}, TRACKPOS_FREE_ONE }, /* 55 bits, 13 pulses, 4 tracks 4333 free one ? */
+ { 56, 4, 8192/*1.0f Q13*/, 14, 4, {4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 56 bits, 14 pulses, 4 tracks 4433 fixed ?!?! */
+ { 58, 4, 8192/*1.0f Q13*/, 14, 4, {4, 6, 6, 8, 8}, TRACKPOS_FIXED_TWO }, /* 58 bits, 14 pulses, 4 tracks 4433 free consecutive ? */
+ { 59, 4, 8192/*1.0f Q13*/, 15, 4, {4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 59 bits, 15 pulses, 4 tracks 4443 fixed ? */
+ { 61, 4, 8192/*1.0f Q13*/, 15, 4, {4, 6, 6, 8, 8}, TRACKPOS_FREE_THREE }, /* 61 bits, 15 pulses, 4 tracks 4443 free ? */
+ { 62, 3, 6554/*0.8f Q13*/, 16, 4, {4, 4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 62 bits, 16 pulses, 4 tracks 4444 */
+ { 65, 3, 6554/*0.8f Q13*/, 17, 4, {4, 4, 6, 6, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 65 bits, 17 pulses, 4 tracks 5444 fixed ?*/
+ { 68, 3, 6144/*0.75f Q13*/, 18, 4, {2, 3, 4, 5, 6, 7, 8}, TRACKPOS_FIXED_FIRST }, /* 68 bits, 18 pulses, 4 tracks 5544 */
+ { 70, 3, 6144/*0.75f Q13*/, 19, 4, {2, 3, 4, 5, 6, 7, 8}, TRACKPOS_FIXED_FIRST }, /* 70 bits, 19 pulses, 4 tracks 5554 fixed ? */
+ { 73, 3, 6144/*0.75f Q13*/, 20, 4, {2, 3, 4, 5, 6, 7, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 73 bits, 20 pulses, 4 tracks 5555 fixed ? */
+ { 75, 3, 6144/*0.75f Q13*/, 21, 4, {2, 3, 4, 5, 6, 7, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 75 bits, 21 pulses, 4 tracks 6555 fixed ? */
+ { 78, 3, 6144/*0.75f Q13*/, 22, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 78 bits, 22 pulses, 4 tracks 6655 fixed ? */
+ { 80, 3, 6144/*0.75f Q13*/, 23, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8}, TRACKPOS_FIXED_FIRST }, /* 80 bits, 23 pulses, 4 tracks 6665 fixed ? */
+ { 83, 2, 2458/*0.30f Q13*/, 24, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 83 bits, 24 pulses, 4 tracks 6666 */
+ { 85, 2, 2458/*0.30f Q13*/, 25, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 85 bits, 25 pulses, 4 tracks 7666 */
+ { 87, 2, 2048/*0.25f Q13*/, 26, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 87 bits, 26 pulses, 4 tracks 7766 */
+ { 89, 2, 2048/*0.25f Q13*/, 27, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 89 bits, 27 pulses, 4 tracks 7776 */
+ { 92, 2, 2048/*0.25f Q13*/, 28, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 92 bits, 28 pulses, 4 tracks 7777 */
+ { 94, 2, 2048/*0.25f Q13*/, 29, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 94 bits, 29 pulses, 4 tracks 8777 */
+ { 96, 1, 1638/*0.20f Q13*/, 30, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 96 bits, 30 pulses, 4 tracks 8877 */
+ { 98, 1, 1638/*0.20f Q13*/, 31, 4, {2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8}, TRACKPOS_FIXED_FIRST}, /* 98 bits, 31 pulses, 4 tracks 8887 */
+};
+
+
+/* Number of pulses & positions to the number of unique states that can be achieved with those pulses */
+const UWord32 pulsestostates[17][9] =
+{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 2, 2, 2, 2, 2, 2, 2, 2, 2},
+ { 4, 8, 12, 16, 20, 24, 28, 32, 36},
+ { 6, 18, 38, 66, 102, 146, 198, 258, 326},
+ { 8, 32, 88, 192, 360, 608, 952, 1408, 1992},
+ { 10, 50, 170, 450, 1002, 1970, 3530, 5890, 9290},
+ { 12, 72, 292, 912, 2364, 5336, 10836, 20256, 35436},
+ { 14, 98, 462, 1666, 4942, 12642, 28814, 59906, 115598},
+ { 16, 128, 688, 2816, 9424, 27008, 68464, 157184, 332688},
+ { 18, 162, 978, 4482, 16722, 53154, 148626, 374274, 864146},
+ { 20, 200, 1340, 6800, 28004, 97880, 299660, 822560, 2060980},
+ { 22, 242, 1782, 9922, 44726, 170610, 568150, 1690370, 4573910},
+ { 24, 288, 2312, 14016, 68664, 284000, 1022760, 3281280, 9545560},
+ { 26, 338, 2938, 19266, 101946, 454610, 1761370, 6065410, 18892250},
+ { 28, 392, 3668, 25872, 147084, 703640, 2919620, 10746400, 35704060},
+ { 30, 450, 4510, 34050, 207006, 1057730, 4680990, 18347010, 64797470},
+ { 32, 512, 5472, 44032, 285088, 1549824, 7288544, 30316544, 113461024},
+};
+
+/*----------------------------------------------------------------------------------*
+ * Gain quantization table for memory-less gain quantizer
+ *----------------------------------------------------------------------------------*/
+
+const Word16 gain_qua_mless_7b_fx[128*2] =
+{//Q14
+ 419, 28,
+ 1499, 607,
+ 1586, 322,
+ 1632, 144,
+ 1686, 229,
+ 1745, 495,
+ 2182, 409,
+ 2515, 716,
+ 2772, 824,
+ 3069, 1069,
+ 3211, 936,
+ 3218, 89,
+ 3477, 1244,
+ 3755, 272,
+ 3865, 549,
+ 3881, 348,
+ 4171, 181,
+ 4414, 627,
+ 4419, 472,
+ 4909, 1429,
+ 5238, 404,
+ 5241, 1651,
+ 5721, 85,
+ 5833, 250,
+ 5846, 693,
+ 5897, 325,
+ 6036, 544,
+ 6088, 779,
+ 6459, 1889,
+ 6650, 157,
+ 6678, 462,
+ 6798, 879,
+ 6922, 993,
+ 6929, 1130,
+ 7352, 620,
+ 7461, 386,
+ 7864, 232,
+ 7999, 314,
+ 8136, 536,
+ 8398, 712,
+ 8680, 459,
+ 8797, 1276,
+ 9046, 806,
+ 9198, 86,
+ 9434, 398,
+ 9730, 587,
+ 9735, 267,
+ 9742, 175,
+ 9917, 917,
+ 10042, 509,
+ 10053, 655,
+ 10132, 1030,
+ 10238, 339,
+ 10694, 1560,
+ 10817, 447,
+ 10964, 723,
+ 11405, 1149,
+ 11526, 549,
+ 11582, 386,
+ 11602, 791,
+ 11618, 286,
+ 11883, 862,
+ 11954, 607,
+ 12057, 214,
+ 12104, 496,
+ 12170, 1397,
+ 12437, 668,
+ 12616, 335,
+ 12668, 952,
+ 12684, 435,
+ 12983, 112,
+ 13235, 742,
+ 13399, 549,
+ 13525, 380,
+ 13527, 270,
+ 13625, 1044,
+ 13733, 482,
+ 13820, 617,
+ 14036, 817,
+ 14041, 1257,
+ 14295, 425,
+ 14346, 684,
+ 14367, 319,
+ 14416, 199,
+ 14644, 898,
+ 14944, 518,
+ 15090, 364,
+ 15154, 578,
+ 15309, 462,
+ 15360, 1933,
+ 15362, 756,
+ 15381, 262,
+ 15566, 1127,
+ 15699, 639,
+ 15804, 410,
+ 16081, 316,
+ 16161, 993,
+ 16359, 701,
+ 16451, 828,
+ 16500, 543,
+ 16540, 491,
+ 16617, 1729,
+ 16630, 196,
+ 16749, 369,
+ 16959, 1530,
+ 17028, 442,
+ 17139, 603,
+ 17369, 898,
+ 17393, 268,
+ 17972, 763,
+ 17985, 1361,
+ 18016, 333,
+ 18032, 667,
+ 18234, 406,
+ 18270, 105,
+ 18299, 554,
+ 18342, 488,
+ 18747, 1207,
+ 19027, 1073,
+ 19530, 216,
+ 19566, 963,
+ 19751, 835,
+ 19794, 615,
+ 19810, 298,
+ 19988, 710,
+ 19990, 449,
+ 20005, 374,
+ 20149, 531,
+};
+
+const Word16 gain_qua_mless_6b_stereo_fx[64 * 2] =
+{//Q14
+ 570, 695,
+ 932, 535,
+ 972, 913,
+ 1305, 165,
+ 1503, 343,
+ 1942, 2102,
+ 2763, 440,
+ 2957, 1204,
+ 3163, 621,
+ 3232, 760,
+ 4215, 255,
+ 4415, 533,
+ 4884, 873,
+ 5395, 429,
+ 5601, 664,
+ 5724, 1615,
+ 6847, 1057,
+ 6849, 535,
+ 6889, 3303,
+ 7086, 335,
+ 7135, 766,
+ 8267, 616,
+ 8601, 907,
+ 8690, 442,
+ 9501, 1264,
+ 9517, 728,
+ 10050, 73,
+ 10243, 514,
+ 10723, 861,
+ 10884, 641,
+ 11005, 339,
+ 11919, 1623,
+ 11976, 1037,
+ 12219, 564,
+ 12286, 770,
+ 12858, 413,
+ 12944, 8191,
+ 13347, 684,
+ 13751, 502,
+ 13802, 873,
+ 13812, 1207,
+ 14417, 615,
+ 14633, 392,
+ 15119, 732,
+ 15214, 521,
+ 15247, 976,
+ 15509, 290,
+ 15936, 1440,
+ 16101, 603,
+ 16157, 448,
+ 16277, 799,
+ 16358, 2544,
+ 16863, 4652,
+ 17010, 1093,
+ 17073, 350,
+ 17348, 659,
+ 17583, 509,
+ 17853, 854,
+ 19087, 1756,
+ 19109, 405,
+ 19348, 727,
+ 19553, 566,
+ 19553, 1240,
+ 19659, 953
+};
+
+const Word16 gain_qua_mless_6b_fx[64 * 2] =
+{//Q14
+ 1676, 71,
+ 2128, 198,
+ 2318, 491,
+ 2348, 339,
+ 2798, 625,
+ 2893, 785,
+ 3911, 1099,
+ 4779, 244,
+ 4781, 427,
+ 5115, 935,
+ 5294, 1509,
+ 5767, 114,
+ 6018, 543,
+ 6152, 335,
+ 6205, 675,
+ 6234, 1822,
+ 6740, 1251,
+ 7034, 802,
+ 7782, 434,
+ 8005, 230,
+ 9232, 622,
+ 9337, 336,
+ 9388, 520,
+ 9770, 1038,
+ 9865, 734,
+ 10224, 879,
+ 10617, 118,
+ 10776, 426,
+ 11518, 249,
+ 11708, 1399,
+ 12044, 587,
+ 12270, 501,
+ 12277, 348,
+ 12498, 684,
+ 13020, 786,
+ 13097, 1196,
+ 13530, 422,
+ 13818, 917,
+ 14123, 290,
+ 14500, 1039,
+ 14538, 636,
+ 14636, 556,
+ 14667, 484,
+ 14931, 362,
+ 15055, 210,
+ 15653, 1594,
+ 15830, 1874,
+ 15868, 717,
+ 15897, 828,
+ 16153, 434,
+ 16540, 294,
+ 16874, 608,
+ 16936, 513,
+ 17182, 373,
+ 17644, 1337,
+ 17696, 126,
+ 18342, 1122,
+ 18461, 944,
+ 18991, 242,
+ 19114, 795,
+ 19187, 674,
+ 19256, 449,
+ 19485, 557,
+ 19515, 344,
+};
+
+const Word16 gain_qua_mless_5b_fx[32 * 2] =
+{//Q14
+ 2695, 109,
+ 3444, 271,
+ 3529, 433,
+ 4284, 801,
+ 4365, 607,
+ 4935, 1089,
+ 6896, 1407,
+ 7722, 324,
+ 7913, 146,
+ 8090, 468,
+ 9049, 913,
+ 9499, 600,
+ 9894, 741,
+ 9942, 1840,
+ 11906, 382,
+ 12008, 1103,
+ 12349, 243,
+ 12429, 501,
+ 13687, 630,
+ 13974, 896,
+ 14510, 748,
+ 15160, 322,
+ 15424, 428,
+ 15679, 541,
+ 15832, 1574,
+ 15999, 1281,
+ 17223, 211,
+ 17719, 1029,
+ 18185, 649,
+ 18432, 818,
+ 18638, 353,
+ 18889, 493,
+};
+
+const Word16 E_ROM_qua_gain5b_const[NB_QUA_GAIN5B * 2]=
+{//Q0
+ 1774,577,
+ 2090,1805,
+ 2103,3371,
+ 3908,1116,
+ 4834,2500,
+ 6030,4763,
+ 6838,1334,
+ 7490,2033,
+ 8585,3036,
+ 9845,1575,
+ 10437,2320,
+ 10649,3739,
+ 11298,945,
+ 12108,1920,
+ 12310,5108,
+ 12391,2758,
+ 12659,1237,
+ 13729,1557,
+ 13798,2201,
+ 13972,3275,
+ 14881,993,
+ 15175,1776,
+ 15409,16190,
+ 15551,2395,
+ 15879,4048,
+ 16341,1335,
+ 16988,2918,
+ 18317,7449,
+ 18368,2026,
+ 19114,1364,
+ 19991,4472,
+ 20644,2790,
+};
+
+const Word16 E_ROM_qua_gain6b_const[NB_QUA_GAIN6B * 2] =
+{//Q0
+ 0,2758,
+ 143,3562,
+ 397,2146,
+ 544,4306,
+ 952,1726,
+ 1236,724,
+ 1779,3158,
+ 1820,5448,
+ 1975,2473,
+ 2121,1343,
+ 3049,3912,
+ 3081,1885,
+ 3289,8261,
+ 3416,2843,
+ 3495,2204,
+ 3831,3386,
+ 4295,4590,
+ 4300,2476,
+ 4345,1545,
+ 4913,1122,
+ 5198,2080,
+ 5200,3079,
+ 5448,3714,
+ 5482,2689,
+ 5546,1817,
+ 5783,17318,
+ 5934,6236,
+ 6156,2320,
+ 6481,4225,
+ 6828,3351,
+ 6832,5045,
+ 6888,2895,
+ 7186,2559,
+ 7214,1663,
+ 7373,2052,
+ 7906,3819,
+ 8192,1372,
+ 8452,3063,
+ 8464,2354,
+ 9021,4468,
+ 9037,2715,
+ 9175,1874,
+ 9219,3463,
+ 9831,2155,
+ 10523,5383,
+ 10557,9061,
+ 10618,3093,
+ 10633,3949,
+ 10890,2465,
+ 11141,1654,
+ 12132,2790,
+ 12180,3477,
+ 12376,2079,
+ 12494,4560,
+ 14430,2468,
+ 14573,3914,
+ 14576,3111,
+ 15043,1827,
+ 15207,1329,
+ 16073,6155,
+ 17519,4719,
+ 18345,2148,
+ 18554,2784,
+ 18576,3563,
+};
+
+const Word16 E_ROM_qua_gain7b_const[NB_QUA_GAIN7B * 2] =
+{//Q0
+ 123,2777,
+ 369,2102,
+ 404,4368,
+ 693,3486,
+ 1107,719,
+ 1222,1679,
+ 1657,1293,
+ 1667,5547,
+ 1805,2425,
+ 2369,3075,
+ 2489,12063,
+ 2681,1901,
+ 2693,3984,
+ 3031,7547,
+ 3248,990,
+ 3466,2672,
+ 3674,2165,
+ 3718,1513,
+ 3844,3456,
+ 4120,4656,
+ 4748,2967,
+ 4821,19622,
+ 4855,2400,
+ 4912,1776,
+ 5245,3860,
+ 5312,6282,
+ 5500,1176,
+ 5713,2056,
+ 5872,3287,
+ 5960,2662,
+ 6170,9756,
+ 6364,5021,
+ 6545,1476,
+ 6788,2283,
+ 6796,4163,
+ 7038,2949,
+ 7216,1831,
+ 7274,3516,
+ 7707,2510,
+ 8123,5762,
+ 8361,4485,
+ 8376,2110,
+ 8594,3135,
+ 8611,3755,
+ 8634,1570,
+ 8636,2748,
+ 8683,8222,
+ 9274,335,
+ 9512,2404,
+ 9640,5020,
+ 9690,1893,
+ 9778,3361,
+ 9808,15435,
+ 9936,4029,
+ 10194,2767,
+ 10306,6510,
+ 10325,1252,
+ 10686,2186,
+ 10844,32767,
+ 10913,4453,
+ 10968,3078,
+ 11044,1666,
+ 11076,3609,
+ 11398,2509,
+ 11423,5160,
+ 11848,1994,
+ 11997,2823,
+ 12002,3880,
+ 12084,7573,
+ 12129,3325,
+ 12214,5867,
+ 12331,1496,
+ 12450,4245,
+ 12458,2283,
+ 12768,901,
+ 12896,4741,
+ 12898,1811,
+ 12902,2569,
+ 12983,2959,
+ 13173,3331,
+ 13413,2059,
+ 13416,3734,
+ 13429,10641,
+ 13448,1148,
+ 13615,5340,
+ 13674,1425,
+ 13779,2332,
+ 13847,4264,
+ 13909,2657,
+ 13958,6488,
+ 14047,3085,
+ 14130,1648,
+ 14547,1915,
+ 14554,3684,
+ 14749,2739,
+ 14868,5017,
+ 14875,2216,
+ 14898,3197,
+ 14988,1085,
+ 15026,4246,
+ 15375,7971,
+ 15421,1446,
+ 15548,2462,
+ 15722,5920,
+ 15882,3449,
+ 15960,1782,
+ 15994,2863,
+ 16365,3977,
+ 16419,4754,
+ 16472,2162,
+ 17378,3101,
+ 17410,2550,
+ 17743,1339,
+ 17856,5485,
+ 17979,1982,
+ 17996,3628,
+ 18041,7110,
+ 18242,4381,
+ 18602,22207,
+ 19373,12827,
+ 19533,2777,
+ 19640,1678,
+ 19728,2272,
+ 19795,8861,
+ 20065,3275,
+ 20133,4881,
+ 20198,3947,
+ 20290,6128,
+};
+
+/*----------------------------------------------------------------------------------*
+ * MA predicition coefficients for gain quantizer
+ *----------------------------------------------------------------------------------*/
+
+const Word16 pred_gain_fx[GAIN_PRED_ORDER] = { 8192, 6554, 4915, 3277 };//Q14
+
+/*----------------------------------------------------------------------------------*
+ * 6-bit gain quantization table (only for AMR-WB IO mode)
+ *----------------------------------------------------------------------------------*/
+
+const Word16 t_qua_gain6b_fx[64 * 2] =
+{//Q14
+ 1566, 1332,
+ 1577, 3557,
+ 3071, 6490,
+ 4193, 10163,
+ 4496, 2534,
+ 5019, 4488,
+ 5586, 15614,
+ 5725, 1422,
+ 6453, 580,
+ 6724, 6831,
+ 7657, 3527,
+ 8072, 2099,
+ 8232, 5319,
+ 8827, 8775,
+ 9740, 2868,
+ 9856, 1465,
+ 10087, 12488,
+ 10241, 4453,
+ 10859, 6618,
+ 11321, 3587,
+ 11417, 1800,
+ 11643, 2428,
+ 11718, 988,
+ 12312, 5093,
+ 12523, 8413,
+ 12574, 26214,
+ 12601, 3396,
+ 13172, 1623,
+ 13285, 2423,
+ 13418, 6087,
+ 13459, 12810,
+ 13656, 3607,
+ 14111, 4521,
+ 14144, 1229,
+ 14425, 1871,
+ 14431, 7234,
+ 14445, 2834,
+ 14628, 10036,
+ 14860, 17496,
+ 15161, 3629,
+ 15209, 5819,
+ 15299, 2256,
+ 15518, 4722,
+ 15663, 1060,
+ 15759, 7972,
+ 15939, 11964,
+ 16020, 2996,
+ 16086, 1707,
+ 16521, 4254,
+ 16576, 6224,
+ 16894, 2380,
+ 16906, 681,
+ 17213, 8406,
+ 17610, 3418,
+ 17895, 5269,
+ 18168, 11748,
+ 18230, 1575,
+ 18607, 32767,
+ 18728, 21684,
+ 19137, 2543,
+ 19422, 6577,
+ 19446, 4097,
+ 19450, 9056,
+ 20371, 14885
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * 7-bit gain quantization table (only for AMR-WB IO mode)
+ *----------------------------------------------------------------------------------*/
+
+const Word16 t_qua_gain7b_fx[128 * 2] =
+{//Q14
+ 204, 441,
+ 464, 1977,
+ 869, 1077,
+ 1072, 3062,
+ 1281, 4759,
+ 1647, 1539,
+ 1845, 7020,
+ 1853, 634,
+ 1995, 2336,
+ 2351, 15400,
+ 2661, 1165,
+ 2702, 3900,
+ 2710, 10133,
+ 3195, 1752,
+ 3498, 2624,
+ 3663, 849,
+ 3984, 5697,
+ 4214, 3399,
+ 4415, 1304,
+ 4695, 2056,
+ 5376, 4558,
+ 5386, 676,
+ 5518, 23554,
+ 5567, 7794,
+ 5644, 3061,
+ 5672, 1513,
+ 5957, 2338,
+ 6533, 1060,
+ 6804, 5998,
+ 6820, 1767,
+ 6937, 3837,
+ 7277, 414,
+ 7305, 2665,
+ 7466, 11304,
+ 7942, 794,
+ 8007, 1982,
+ 8007, 1366,
+ 8326, 3105,
+ 8336, 4810,
+ 8708, 7954,
+ 8989, 2279,
+ 9031, 1055,
+ 9247, 3568,
+ 9283, 1631,
+ 9654, 6311,
+ 9811, 2605,
+ 10120, 683,
+ 10143, 4179,
+ 10245, 1946,
+ 10335, 1218,
+ 10468, 9960,
+ 10651, 3000,
+ 10951, 1530,
+ 10969, 5290,
+ 11203, 2305,
+ 11325, 3562,
+ 11771, 6754,
+ 11839, 1849,
+ 11941, 4495,
+ 11954, 1298,
+ 11975, 15223,
+ 11977, 883,
+ 11986, 2842,
+ 12438, 2141,
+ 12593, 3665,
+ 12636, 8367,
+ 12658, 1594,
+ 12886, 2628,
+ 12984, 4942,
+ 13146, 1115,
+ 13224, 524,
+ 13341, 3163,
+ 13399, 1923,
+ 13549, 5961,
+ 13606, 1401,
+ 13655, 2399,
+ 13782, 3909,
+ 13868, 10923,
+ 14226, 1723,
+ 14232, 2939,
+ 14278, 7528,
+ 14439, 4598,
+ 14451, 984,
+ 14458, 2265,
+ 14792, 1403,
+ 14818, 3445,
+ 14899, 5709,
+ 15017, 15362,
+ 15048, 1946,
+ 15069, 2655,
+ 15405, 9591,
+ 15405, 4079,
+ 15570, 7183,
+ 15687, 2286,
+ 15691, 1624,
+ 15699, 3068,
+ 15772, 5149,
+ 15868, 1205,
+ 15970, 696,
+ 16249, 3584,
+ 16338, 1917,
+ 16424, 2560,
+ 16483, 4438,
+ 16529, 6410,
+ 16620, 11966,
+ 16839, 8780,
+ 17030, 3050,
+ 17033, 18325,
+ 17092, 1568,
+ 17123, 5197,
+ 17351, 2113,
+ 17374, 980,
+ 17566, 26214,
+ 17609, 3912,
+ 17639, 32767,
+ 18151, 7871,
+ 18197, 2516,
+ 18202, 5649,
+ 18679, 3283,
+ 18930, 1370,
+ 19271, 13757,
+ 19317, 4120,
+ 19460, 1973,
+ 19654, 10018,
+ 19764, 6792,
+ 19912, 5135,
+ 20040, 2841,
+ 21234, 19833
+};
+
+/*----------------------------------------------------------------------------------*
+ * Quantization table for scaled innovation energy prediciton
+ *----------------------------------------------------------------------------------*/
+
+const Word16 Es_pred_qua_5b_fx[32] =
+{//Q8
+ -2048,
+ -525,
+ 642,
+ 1688,
+ 2547,
+ 3326,
+ 4026,
+ 4647,
+ 5211,
+ 5740,
+ 6221,
+ 6661,
+ 7067,
+ 7447,
+ 7815,
+ 8170,
+ 8518,
+ 8865,
+ 9204,
+ 9551,
+ 9912,
+ 10284,
+ 10669,
+ 11077,
+ 11509,
+ 11976,
+ 12486,
+ 13049,
+ 13695,
+ 14434,
+ 15354,
+ 16640,
+};
+
+const Word16 Es_pred_qua_4b_fx[16] =
+{//Q8
+ -2048,
+ -36,
+ 1828,
+ 3284,
+ 4584,
+ 5742,
+ 6821,
+ 7834,
+ /*8779, */
+ 8778,
+ 9701,
+ 10610,
+ 11524,
+ 12487,
+ 13560,
+ 14862,
+ 16640
+};
+
+const Word16 Es_pred_qua_3b_fx[8] =
+{
+ 1521/* 5.9422f Q8*/,
+ 3909/*15.2711f Q8*/,
+ 5987/*23.3857f Q8*/,
+ 7816/*30.5310f Q8*/,
+ 9477/*37.0190f Q8*/,
+ 11124/*43.4539f Q8*/,
+ 12863/*50.2442f Q8*/,
+ 15031/*58.7164f Q8*/
+};
+
+const Word16 Es_pred_qua_4b_no_ltp_fx[16] =
+{
+ -1280/*-5.f Q8*/,
+ 0/* 0.f Q8*/,
+ 1280/* 5.f Q8*/,
+ 2560/*10.f Q8*/,
+ 3840/*15.f Q8*/,
+ 5120/*20.f Q8*/,
+ 6400/*25.f Q8*/,
+ 7680/*30.f Q8*/,
+ 8960/*35.f Q8*/,
+ 10240/*40.f Q8*/,
+ 11520/*45.f Q8*/,
+ 12800/*50.f Q8*/,
+ 14080/*55.f Q8*/,
+ 15360/*60.f Q8*/,
+ 16640/*65.f Q8*/,
+ 17920/*70.f Q8*/
+};
+/*----------------------------------------------------------------------------------*
+ * Gain estimation constants (for gain quantizer at 7.2 and 8.0 kbps)
+ *----------------------------------------------------------------------------------*/
+
+const Word16 b_1sfr_fx[2] = /*Q12 */
+{
+ 9697, -920
+};
+
+const Word16 b_2sfr_fx[4] = /*Q12 */
+{
+ -1, 70, 3763, 542
+};
+
+const Word16 b_3sfr_fx[6] =//Q12
+{
+ -478, 110, 553, 3264, 92, 730
+};
+
+const Word16 b_4sfr_fx[8] =//Q12
+{
+ -381, 65, -271, 836, 3246, 34, 143, 650
+};
+
+/*----------------------------------------------------------------------------------*
+ * Gain codebooks (for gain quantizer at 7.2 and 8.0 kbps)
+ *----------------------------------------------------------------------------------*/
+
+const Word16 gp_gamma_3sfr_7b_fx[2 * 128] = //Q14/Q9
+{
+ 141, 207,
+ 268, 836,
+ 355, 385,
+ 470, 124,
+ 944, 265,
+ 1202, 503,
+ 1308, 640,
+ 1384, 150,
+ 1399, 75,
+ 1534, 323,
+ 1835, 1252,
+ 1872, 216,
+ 2297, 443,
+ 2495, 122,
+ 2697, 358,
+ 2849, 181,
+ 2920, 274,
+ 2937, 552,
+ 3353, 2982,
+ 3666, 394,
+ 3759, 1755,
+ 3790, 972,
+ 3838, 225,
+ 3929, 758,
+ 3973, 143,
+ 4075, 313,
+ 4329, 471,
+ 4689, 625,
+ 4938, 178,
+ 5073, 266,
+ 5216, 379,
+ 5519, 520,
+ 6089, 321,
+ 6149, 221,
+ 6247, 432,
+ 6254, 1083,
+ 6556, 131,
+ 6751, 733,
+ 6773, 587,
+ 7140, 17402,
+ 7257, 366,
+ 7295, 269,
+ 7314, 483,
+ 8121, 204,
+ 8214, 1515,
+ 8332, 538,
+ 8386, 842,
+ 8483, 314,
+ 8484, 660,
+ 8503, 395,
+ 9079, 455,
+ 9543, 249,
+ 9687, 1056,
+ 9724, 11493,
+ 9727, 336,
+ 9862, 603,
+ 10141, 158,
+ 10278, 498,
+ 10347, 393,
+ 10380, 751,
+ 10899, 287,
+ 11239, 564,
+ 11377, 210,
+ 11389, 437,
+ 11531, 926,
+ 11565, 339,
+ 11594, 684,
+ 11635, 7228,
+ 12176, 509,
+ 12240, 1235,
+ 12467, 381,
+ 12631, 254,
+ 12758, 809,
+ 12877, 458,
+ 12881, 620,
+ 13160, 313,
+ 13243, 1692,
+ 13441, 533,
+ 13620, 420,
+ 13855, 718,
+ 13895, 998,
+ 14047, 354,
+ 14150, 199,
+ 14170, 586,
+ 14358, 477,
+ 14770, 280,
+ 14777, 143,
+ 14810, 397,
+ 14965, 857,
+ 14984, 655,
+ 15112, 524,
+ 15406, 330,
+ 15535, 442,
+ 15599, 1120,
+ 15635, 4946,
+ 15823, 582,
+ 15891, 736,
+ 16161, 374,
+ 16216, 229,
+ 16265, 493,
+ 16607, 638,
+ 16610, 2511,
+ 16905, 803,
+ 16906, 433,
+ 16911, 310,
+ 16924, 1415,
+ 17161, 543,
+ 17656, 951,
+ 17694, 680,
+ 17736, 375,
+ 17982, 479,
+ 18345, 287,
+ 18372, 586,
+ 18469, 3627,
+ 18649, 183,
+ 18898, 2002,
+ 18925, 403,
+ 18959, 712,
+ 19244, 857,
+ 19306, 245,
+ 19447, 1203,
+ 19455, 334,
+ 19458, 526,
+ 19600, 455,
+ 19699, 623,
+ 19724, 1583,
+ 19788, 1001,
+ 20031, 749,
+};
+
+const Word16 gp_gamma_4sfr_7b_fx[2 * 128] = /*Q14/Q9 */
+{
+ 101, 174,
+ 228, 542,
+ 400, 269,
+ 735, 418,
+ 799, 111,
+ 1146, 802,
+ 1250, 345,
+ 1291, 1138,
+ 1327, 224,
+ 1478, 1705,
+ 1557, 491,
+ 1947, 295,
+ 1988, 639,
+ 2343, 386,
+ 2386, 213,
+ 2541, 133,
+ 2904, 2881,
+ 3198, 455,
+ 3204, 736,
+ 3219, 276,
+ 3463, 549,
+ 3709, 343,
+ 3741, 177,
+ 4431, 226,
+ 4480, 927,
+ 4516, 396,
+ 4547, 622,
+ 4900, 290,
+ 5011, 503,
+ 5601, 742,
+ 5616, 173,
+ 5688, 428,
+ 5975, 337,
+ 6196, 5865,
+ 6293, 253,
+ 6294, 580,
+ 6305, 1053,
+ 6792, 480,
+ 6951, 391,
+ 7151, 212,
+ 7298, 671,
+ 7475, 317,
+ 7757, 534,
+ 7917, 856,
+ 8195, 1449,
+ 8198, 437,
+ 8228, 261,
+ 8434, 154,
+ 8493, 622,
+ 8552, 358,
+ 9324, 493,
+ 9373, 744,
+ 9391, 217,
+ 9410, 296,
+ 9711, 14146,
+ 9711, 405,
+ 9724, 598,
+ 10128, 1140,
+ 10248, 8800,
+ 10391, 344,
+ 10530, 883,
+ 10541, 542,
+ 10559, 257,
+ 10772, 441,
+ 11075, 664,
+ 11463, 304,
+ 11510, 196,
+ 11551, 2230,
+ 11574, 501,
+ 11611, 391,
+ 12154, 784,
+ 12205, 576,
+ 12304, 133,
+ 12413, 343,
+ 12457, 84,
+ 12468, 445,
+ 12734, 247,
+ 12970, 639,
+ 13072, 1411,
+ 13142, 983,
+ 13159, 499,
+ 13356, 386,
+ 13460, 298,
+ 13838, 710,
+ 13850, 550,
+ 13930, 429,
+ 14446, 343,
+ 14449, 170,
+ 14511, 467,
+ 14530, 857,
+ 14697, 623,
+ 14770, 4569,
+ 14833, 229,
+ 15086, 512,
+ 15112, 387,
+ 15527, 574,
+ 15552, 1126,
+ 15573, 764,
+ 15662, 291,
+ 15677, 442,
+ 16056, 648,
+ 16200, 508,
+ 16322, 369,
+ 16719, 586,
+ 16832, 936,
+ 16835, 450,
+ 16969, 702,
+ 17188, 315,
+ 17425, 538,
+ 17680, 395,
+ 17808, 209,
+ 17855, 791,
+ 18054, 1861,
+ 18122, 471,
+ 18273, 632,
+ 18425, 3478,
+ 18630, 1239,
+ 18947, 143,
+ 18948, 2576,
+ 19051, 264,
+ 19068, 349,
+ 19112, 502,
+ 19303, 1530,
+ 19502, 836,
+ 19558, 422,
+ 19571, 692,
+ 19667, 1014,
+ 19685, 569
+};
+
+const Word16 gp_gamma_1sfr_8b_fx[2 * 256] = /*Q14/Q9 */
+{
+ 305, 152,
+ 333, 37,
+ 352, 556,
+ 573, 82,
+ 652, 12,
+ 694, 207,
+ 808, 389,
+ 915, 776,
+ 986, 1089,
+ 987, 1583,
+ 1055, 60,
+ 1202, 2779,
+ 1205, 20,
+ 1346, 127,
+ 1432, 332,
+ 1689, 6554,
+ 1715, 261,
+ 1820, 49,
+ 2041, 698,
+ 2179, 4032,
+ 2199, 100,
+ 2272, 1303,
+ 2317, 461,
+ 2340, 175,
+ 2562, 26,
+ 2574, 14814,
+ 2657, 2101,
+ 2732, 66,
+ 2818, 9,
+ 2836, 296,
+ 2929, 938,
+ 3479, 130,
+ 3510, 220,
+ 3651, 3154,
+ 3667, 717,
+ 3720, 384,
+ 3783, 530,
+ 3811, 10744,
+ 3883, 5385,
+ 3941, 1609,
+ 3964, 46,
+ 4120, 80,
+ 4402, 15,
+ 4440, 1181,
+ 4485, 173,
+ 4740, 311,
+ 4848, 31,
+ 5125, 7642,
+ 5147, 110,
+ 5167, 908,
+ 5237, 252,
+ 5323, 623,
+ 5376, 2514,
+ 5590, 7,
+ 5595, 4475,
+ 5634, 64,
+ 5654, 461,
+ 5822, 22,
+ 5893, 140,
+ 5905, 1810,
+ 6177, 367,
+ 6268, 201,
+ 6352, 1092,
+ 6567, 752,
+ 6626, 50,
+ 6734, 95,
+ 6758, 295,
+ 6882, 3085,
+ 6962, 1363,
+ 7274, 540,
+ 7413, 166,
+ 7635, 2120,
+ 7642, 38,
+ 7671, 393,
+ 7730, 227,
+ 7860, 75,
+ 7980, 115,
+ 8011, 955,
+ 8092, 3687,
+ 8120, 17,
+ 8146, 5902,
+ 8453, 672,
+ 8524, 1602,
+ 8583, 58,
+ 8679, 275,
+ 8873, 332,
+ 8920, 454,
+ 8969, 9712,
+ 9129, 2566,
+ 9159, 196,
+ 9193, 1127,
+ 9219, 142,
+ 9300, 9,
+ 9302, 828,
+ 9409, 91,
+ 9736, 26,
+ 9872, 574,
+ 10066, 246,
+ 10131, 1352,
+ 10154, 1971,
+ 10196, 399,
+ 10238, 15785,
+ 10255, 4254,
+ 10401, 67,
+ 10439, 43,
+ 10511, 116,
+ 10531, 7399,
+ 10706, 998,
+ 10798, 722,
+ 10845, 171,
+ 10848, 304,
+ 10876, 2981,
+ 11069, 28204,
+ 11139, 507,
+ 11280, 12,
+ 11427, 388,
+ 11459, 214,
+ 11647, 1174,
+ 11710, 5061,
+ 11742, 1614,
+ 11793, 806,
+ 11816, 82,
+ 11890, 132,
+ 11996, 2301,
+ 12000, 603,
+ 12060, 55,
+ 12232, 256,
+ 12299, 33,
+ 12438, 338,
+ 12452, 458,
+ 12627, 3563,
+ 12646, 9489,
+ 12665, 934,
+ 12801, 1329,
+ 12802, 190,
+ 12877, 683,
+ 12941, 103,
+ 13038, 1890,
+ 13209, 6209,
+ 13222, 12674,
+ 13318, 21,
+ 13374, 283,
+ 13385, 149,
+ 13391, 383,
+ 13453, 545,
+ 13564, 1064,
+ 13596, 2561,
+ 13771, 810,
+ 13834, 1481,
+ 13874, 69,
+ 14027, 226,
+ 14093, 4429,
+ 14147, 7,
+ 14171, 609,
+ 14185, 47,
+ 14223, 3051,
+ 14273, 434,
+ 14321, 314,
+ 14415, 120,
+ 14443, 1252,
+ 14500, 173,
+ 14557, 933,
+ 14616, 1696,
+ 14639, 8229,
+ 14724, 89,
+ 14837, 703,
+ 14902, 2072,
+ 14917, 366,
+ 15000, 487,
+ 15009, 30,
+ 15095, 256,
+ 15138, 1119,
+ 15228, 3580,
+ 15371, 1386,
+ 15387, 5525,
+ 15398, 17932,
+ 15462, 149,
+ 15471, 791,
+ 15551, 569,
+ 15554, 2467,
+ 15559, 201,
+ 15616, 14,
+ 15664, 319,
+ 15798, 401,
+ 15811, 974,
+ 15874, 41,
+ 15929, 1649,
+ 15945, 79,
+ 16046, 111,
+ 16225, 647,
+ 16230, 1240,
+ 16297, 4110,
+ 16328, 10499,
+ 16331, 278,
+ 16355, 3003,
+ 16383, 455,
+ 16404, 169,
+ 16435, 2172,
+ 16438, 850,
+ 16745, 7090,
+ 16776, 354,
+ 16801, 1063,
+ 16803, 62,
+ 16812, 223,
+ 16927, 530,
+ 16951, 721,
+ 17039, 1447,
+ 17208, 1837,
+ 17233, 135,
+ 17371, 4642,
+ 17570, 406,
+ 17608, 267,
+ 17696, 906,
+ 17702, 2529,
+ 17705, 23239,
+ 17709, 1209,
+ 17745, 592,
+ 17800, 92,
+ 17858, 35,
+ 17860, 3360,
+ 17866, 9,
+ 17978, 184,
+ 18035, 321,
+ 18255, 754,
+ 18274, 480,
+ 18320, 18,
+ 18406, 55,
+ 18582, 13017,
+ 18677, 1516,
+ 18726, 1998,
+ 18904, 25,
+ 18914, 6103,
+ 19020, 8567,
+ 19022, 1116,
+ 19025, 349,
+ 19147, 239,
+ 19224, 604,
+ 19251, 160,
+ 19270, 4870,
+ 19358, 3789,
+ 19394, 126,
+ 19394, 103,
+ 19433, 72,
+ 19444, 46,
+ 19448, 2842,
+ 19489, 430,
+ 19575, 815,
+ 19628, 1306,
+ 19631, 972,
+ 19637, 202,
+ 19642, 289,
+ 19660, 527,
+ 19717, 1697,
+ 19731, 2263,
+ 19754, 676,
+ 19854, 382,
+};
+
+const Word16 gp_gamma_1sfr_7b_fx[2 * 128] = /*Q14/Q9 */
+{
+ 350, 85,
+ 428, 24,
+ 438, 681,
+ 642, 195,
+ 1071, 2012,
+ 1080, 402,
+ 1148, 1236,
+ 1159, 62,
+ 1424, 12,
+ 1662, 134,
+ 1985, 299,
+ 2100, 34,
+ 2163, 3168,
+ 2219, 538,
+ 2393, 6580,
+ 2499, 967,
+ 2882, 221,
+ 2974, 12743,
+ 3251, 98,
+ 3294, 51,
+ 3586, 1560,
+ 3711, 411,
+ 3721, 700,
+ 3862, 21,
+ 3947, 169,
+ 4001, 2249,
+ 4198, 4632,
+ 4372, 8,
+ 4993, 70,
+ 5022, 265,
+ 5568, 1194,
+ 5664, 495,
+ 5698, 115,
+ 5885, 854,
+ 6115, 2990,
+ 6266, 153,
+ 6376, 39,
+ 6432, 16,
+ 6601, 345,
+ 7108, 1957,
+ 7231, 660,
+ 7491, 202,
+ 7687, 93,
+ 8054, 3882,
+ 8108, 9624,
+ 8186, 1424,
+ 8243, 59,
+ 8354, 935,
+ 8358, 6401,
+ 8383, 439,
+ 8794, 285,
+ 8940, 124,
+ 9643, 25,
+ 9643, 581,
+ 9670, 2709,
+ 10065, 160,
+ 10218, 9,
+ 10240, 1728,
+ 10249, 80,
+ 10418, 1113,
+ 10497, 373,
+ 10650, 236,
+ 11095, 44,
+ 11095, 756,
+ 11284, 4978,
+ 11290, 16722,
+ 11815, 2299,
+ 11882, 482,
+ 12059, 114,
+ 12332, 8550,
+ 12363, 1394,
+ 12392, 186,
+ 12517, 336,
+ 12549, 3413,
+ 12694, 953,
+ 13096, 614,
+ 13185, 71,
+ 13247, 262,
+ 13479, 1914,
+ 13791, 14,
+ 13805, 30,
+ 14064, 138,
+ 14182, 420,
+ 14212, 1175,
+ 14477, 765,
+ 14605, 2745,
+ 14612, 6324,
+ 14730, 4199,
+ 14833, 301,
+ 14842, 203,
+ 14910, 12790,
+ 15171, 100,
+ 15191, 1625,
+ 15289, 532,
+ 15405, 52,
+ 15550, 985,
+ 16096, 357,
+ 16175, 2113,
+ 16284, 232,
+ 16333, 669,
+ 16363, 22999,
+ 16396, 156,
+ 16443, 1270,
+ 16455, 3482,
+ 16543, 8,
+ 16650, 5425,
+ 16878, 452,
+ 16989, 84,
+ 17024, 9676,
+ 17194, 876,
+ 17730, 20,
+ 17780, 1442,
+ 17864, 38,
+ 17874, 254,
+ 17929, 526,
+ 18011, 2403,
+ 18751, 7153,
+ 18786, 117,
+ 18820, 4420,
+ 19002, 63,
+ 19099, 401,
+ 19111, 183,
+ 19197, 776,
+ 19202, 2953,
+ 19236, 1052,
+ 19255, 301,
+ 19354, 1760,
+ 19432, 593,
+};
+
+const Word16 gp_gamma_1sfr_6b_fx[2 * 64] = /*Q14/Q9 */
+{
+ 436, 182,
+ 473, 63,
+ 962, 16,
+ 992, 647,
+ 1258, 1582,
+ 1447, 351,
+ 1711, 125,
+ 1809, 46,
+ 2569, 4173,
+ 2607, 957,
+ 2826, 251,
+ 2904, 12481,
+ 3248, 26,
+ 3594, 2254,
+ 3664, 78,
+ 3715, 483,
+ 4232, 8,
+ 4681, 188,
+ 5066, 6623,
+ 5232, 1273,
+ 6232, 695,
+ 6234, 49,
+ 6238, 113,
+ 6312, 318,
+ 7012, 17,
+ 7327, 3183,
+ 8008, 1739,
+ 8692, 446,
+ 8769, 163,
+ 8923, 1019,
+ 9094, 81,
+ 10358, 286,
+ 10491, 28,
+ 10612, 9788,
+ 10715, 760,
+ 11045, 4822,
+ 11319, 2403,
+ 11684, 56,
+ 12314, 108,
+ 12460, 556,
+ 12580, 9,
+ 12716, 213,
+ 12821, 1336,
+ 14202, 374,
+ 14325, 16971,
+ 14612, 838,
+ 14625, 3285,
+ 14668, 6231,
+ 14919, 39,
+ 15131, 137,
+ 15476, 1847,
+ 16056, 255,
+ 16277, 494,
+ 16290, 66,
+ 16582, 1048,
+ 16859, 17,
+ 17220, 8723,
+ 17443, 4295,
+ 18069, 2499,
+ 18212, 176,
+ 18499, 91,
+ 18517, 1445,
+ 18522, 332,
+ 18596, 663,
+};
+
+const Word16 gp_gamma_2sfr_7b_fx[2 * 128] = /*Q14/Q9 */
+{
+ 99, 1224,
+ 156, 243,
+ 168, 579,
+ 290, 355,
+ 437, 441,
+ 475, 187,
+ 734, 738,
+ 930, 93,
+ 1133, 153,
+ 1136, 298,
+ 1490, 508,
+ 1946, 401,
+ 1978, 16790,
+ 2098, 224,
+ 2117, 962,
+ 2407, 119,
+ 2686, 339,
+ 2929, 555,
+ 3404, 271,
+ 3465, 171,
+ 3469, 422,
+ 3714, 663,
+ 4436, 494,
+ 4494, 332,
+ 4571, 220,
+ 4583, 2182,
+ 4997, 848,
+ 5346, 380,
+ 5419, 108,
+ 5570, 579,
+ 5758, 266,
+ 5875, 442,
+ 5927, 170,
+ 6204, 3338,
+ 6394, 6435,
+ 6515, 328,
+ 6638, 730,
+ 6687, 1472,
+ 7045, 1056,
+ 7101, 498,
+ 7123, 210,
+ 7163, 9668,
+ 7345, 386,
+ 7598, 280,
+ 7853, 627,
+ 8462, 442,
+ 8648, 331,
+ 8822, 236,
+ 8887, 551,
+ 8953, 906,
+ 9317, 136,
+ 9587, 386,
+ 9651, 691,
+ 9796, 286,
+ 9852, 489,
+ 10005, 1215,
+ 10041, 192,
+ 10623, 576,
+ 10758, 329,
+ 10840, 425,
+ 10944, 792,
+ 11038, 257,
+ 11190, 1870,
+ 11541, 501,
+ 11729, 642,
+ 11873, 367,
+ 12064, 163,
+ 12332, 216,
+ 12339, 1100,
+ 12339, 295,
+ 12478, 444,
+ 12561, 568,
+ 12665, 845,
+ 13257, 396,
+ 13317, 677,
+ 13411, 511,
+ 13709, 324,
+ 13710, 1547,
+ 13711, 246,
+ 14054, 991,
+ 14112, 447,
+ 14246, 580,
+ 14355, 748,
+ 14394, 175,
+ 14453, 99,
+ 14604, 363,
+ 14887, 491,
+ 15074, 282,
+ 15110, 637,
+ 15242, 1292,
+ 15351, 413,
+ 15430, 843,
+ 15700, 541,
+ 15776, 204,
+ 15964, 335,
+ 15992, 688,
+ 16077, 453,
+ 16315, 4617,
+ 16406, 1032,
+ 16549, 595,
+ 16666, 384,
+ 16850, 776,
+ 16851, 482,
+ 16916, 253,
+ 17234, 309,
+ 17307, 2128,
+ 17469, 546,
+ 17666, 643,
+ 17699, 421,
+ 17852, 882,
+ 17870, 146,
+ 18146, 1244,
+ 18457, 489,
+ 18478, 346,
+ 18588, 723,
+ 18826, 208,
+ 19011, 1731,
+ 19042, 586,
+ 19286, 281,
+ 19428, 944,
+ 19446, 382,
+ 19555, 444,
+ 19689, 792,
+ 19755, 1111,
+ 19762, 527,
+ 19769, 1405,
+ 19774, 657,
+ 19780, 2675,
+};
+
+const Word16 gp_gamma_2sfr_6b_fx[2 * 64] = /*Q14/Q9 */
+{
+ 185, 306,
+ 435, 519,
+ 458, 145,
+ 1000, 211,
+ 1217, 394,
+ 1241, 751,
+ 1788, 93,
+ 2026, 1234,
+ 2162, 265,
+ 2397, 158,
+ 2617, 472,
+ 3324, 340,
+ 3391, 623,
+ 3835, 207,
+ 4503, 17210,
+ 4628, 407,
+ 4939, 897,
+ 5102, 275,
+ 5300, 120,
+ 5560, 511,
+ 6309, 1909,
+ 6571, 335,
+ 6770, 205,
+ 6990, 642,
+ 7085, 5087,
+ 7500, 428,
+ 8357, 827,
+ 8452, 261,
+ 9079, 537,
+ 9289, 354,
+ 9854, 1176,
+ 9864, 165,
+ 10436, 8580,
+ 10549, 437,
+ 10615, 677,
+ 11010, 282,
+ 11940, 530,
+ 12183, 367,
+ 12475, 920,
+ 12865, 225,
+ 13359, 618,
+ 13431, 441,
+ 13521, 1623,
+ 14177, 341,
+ 14299, 130,
+ 14452, 775,
+ 14799, 508,
+ 15250, 276,
+ 15715, 1130,
+ 15757, 660,
+ 15879, 422,
+ 16355, 3256,
+ 16439, 187,
+ 16751, 562,
+ 16906, 331,
+ 17178, 827,
+ 17889, 471,
+ 18219, 2175,
+ 18786, 248,
+ 18985, 1354,
+ 19067, 703,
+ 19220, 384,
+ 19349, 954,
+ 19422, 553,
+};
+const Word16 gp_gamma_3sfr_6b_fx[2 * 64] = /*Q14/Q9 */
+{
+ 195, 150,
+ 817, 288,
+ 1152, 616,
+ 1366, 188,
+ 1377, 410,
+ 1526, 902,
+ 1570, 98,
+ 2258, 238,
+ 2489, 518,
+ 2935, 338,
+ 3142, 161,
+ 3456, 1705,
+ 3990, 432,
+ 4159, 709,
+ 4187, 270,
+ 4374, 1236,
+ 5283, 526,
+ 5431, 131,
+ 5507, 356,
+ 5762, 211,
+ 6792, 620,
+ 6842, 446,
+ 6969, 304,
+ 7671, 807,
+ 8362, 245,
+ 8448, 530,
+ 8610, 380,
+ 9314, 1088,
+ 9828, 170,
+ 9921, 7010,
+ 10026, 459,
+ 10193, 312,
+ 10261, 658,
+ 11554, 394,
+ 11739, 882,
+ 11791, 542,
+ 11985, 4329,
+ 11996, 246,
+ 12762, 13441,
+ 12844, 1512,
+ 13131, 465,
+ 13135, 339,
+ 13215, 740,
+ 14138, 608,
+ 14524, 417,
+ 14780, 1030,
+ 14823, 283,
+ 15016, 171,
+ 15264, 527,
+ 15823, 2706,
+ 15943, 699,
+ 15959, 360,
+ 16350, 473,
+ 17211, 573,
+ 17366, 901,
+ 17517, 238,
+ 17799, 414,
+ 18069, 1415,
+ 18630, 1920,
+ 18887, 634,
+ 19018, 318,
+ 19304, 495,
+ 19400, 1114,
+ 19413, 767,
+};
+
+
+const Word16 gp_gamma_4sfr_6b_fx[2 * 64] = /*Q14/Q9 */
+{
+ 153, 141,
+ 282, 501,
+ 399, 239,
+ 783, 369,
+ 1110, 744,
+ 1430, 183,
+ 1440, 1748,
+ 1524, 1091,
+ 1602, 296,
+ 1828, 99,
+ 2000, 439,
+ 2678, 228,
+ 2815, 600,
+ 3084, 347,
+ 3861, 477,
+ 4154, 163,
+ 4214, 285,
+ 4428, 733,
+ 4976, 384,
+ 5482, 566,
+ 5552, 234,
+ 6158, 929,
+ 6536, 470,
+ 6560, 326,
+ 7288, 173,
+ 7429, 663,
+ 7447, 10616,
+ 7871, 407,
+ 8457, 266,
+ 8559, 550,
+ 8679, 1421,
+ 9457, 356,
+ 9533, 785,
+ 9854, 471,
+ 10584, 5781,
+ 10792, 3815,
+ 10813, 206,
+ 10829, 302,
+ 10986, 606,
+ 11380, 433,
+ 11468, 1073,
+ 12485, 356,
+ 12726, 520,
+ 12783, 721,
+ 13554, 259,
+ 13763, 139,
+ 13884, 430,
+ 14060, 2592,
+ 14266, 599,
+ 14332, 925,
+ 14997, 337,
+ 15355, 485,
+ 15526, 712,
+ 16440, 587,
+ 16504, 395,
+ 16626, 204,
+ 17228, 1287,
+ 17563, 805,
+ 17629, 517,
+ 18159, 1814,
+ 18320, 303,
+ 19228, 437,
+ 19263, 636,
+ 19417, 989,
+};
+
+
+
+/*----------------------------------------------------------------------------------*
+ * Transition coding - gain quantization table
+ *----------------------------------------------------------------------------------*/
+const Word16 tbl_gain_code_tc_fx[N_GAIN_CODE_TC] = /*q13 */
+{
+ 2966,
+ 5930,
+ 7924,
+ 9712,
+ 11566,
+ 13754,
+ 16993,
+ 27280
+};
+const Word16 tbl_gain_code_tc_quant_mean[N_GAIN_CODE_TC - 1] =
+{
+ 4448, 6927, 8818, 10639,
+ 12660, 15374, 22136
+}; /* Q13 */
+/*-----------------------------------------------------------------*
+ * Transition coding - gain quantization table for g_trans
+ *-----------------------------------------------------------------*/
+const Word16 tbl_gain_trans_tc_fx[N_GAIN_TC] =
+{
+ 4588, 11109, 19212, 29862,/*<- Q7
+Q4 ->*/ 5536, 8184, 13115, 24000
+};
+/*-----------------------------------------------------------------*
+ * Transition coding - table of prototype glottal impulses
+ *-----------------------------------------------------------------*/
+
+const Word16 Glottal_cdbk_fx[L_IMPULSE*NUM_IMPULSE] = /*Q13*/
+{
+ /* impulse 0 */
+ -715, -1690, -2903, -1742, -1295, -4266,
+ -4893, 1725, 8192, 5812, -628, -1956,
+ 581, 936, -81, 831, 1517,
+
+ /* impulse 1 */
+ -2168, -1356, -404, -2715, -4469, -2164,
+ -2180, -8058, -9140, 1163, 10343, 6677,
+ -1758, -2839, 377, 326, -490,
+
+ /* impulse 2 */
+ 360, 561, 4184, 2533, -3326, -2549,
+ 2059, -2112, -9542, -6134, 1307, 124,
+ -3421, -1465, 475, -886, -1262,
+
+ /* impulse 3 */
+ -1294, -715, -184, -1544, -1638, -219,
+ -3503, -9409, -7955, -1407, -285, -2494,
+ 305, 4658, 3289, 116, 1488,
+
+ /* impulse 4 */
+ 837, 2523, 2444, 2679, 5962, 6935,
+ -924, -9907, -7565, 643, 1350, -2577,
+ -2100, -277, -1546, -2279, -882,
+
+ /* impulse 5 */
+ -418, -886, -48, -494, -2368, -2060,
+ -1233, -5271,-10430, -6955, 3301, 7578,
+ 2599, -1665, -461, 735, -181,
+
+ /* impulse 6 */
+ -467, -1865, -1455, -127, -1881, -3776,
+ 822, 8335, 8192, 863, -2762, -375,
+ 757, -558, -285, 653, 150,
+
+ /* impulse 7 */
+ 1087, 471, -618, 706, 1546, -1605,
+ -3256, 2396, 8060, 5189, -99, -37,
+ 1105, -668, -1434, -59, -81
+};
+
+/*----------------------------------------------------------------------------------*
+ * AMR-WB IO WB BWE - deemphasis
+ *----------------------------------------------------------------------------------*/
+const Word16 deem_tab_fx[56] =
+{//Q15
+ 20668, 20625, 20583, 20541, 20501, 20462, 20423, 20385,
+ 20348, 20313, 20277, 20243, 20210, 20177, 20146, 20115,
+ 20085, 20055, 20027, 19999, 19972, 19946, 19921, 19896,
+ 19873, 19850, 19827, 19806, 19785, 19766, 19746, 19728,
+ 19710, 19693, 19677, 19662, 19647, 19633, 19620, 19607,
+ 19596, 19585, 19574, 19565, 19556, 19548, 19540, 19533,
+ 19527, 19522, 19518, 19514, 19510, 19508, 19506, 19505
+};
+
+
+const Word16 filt_hp_fx[56] =
+{//Q15
+ 53, 153, 274, 415, 578, 765, 978, 1217, 1483, 1778, 2102,
+ 2457, 2843, 3261, 3710, 4192, 4706, 5252, 5829, 6438, 7077,
+ 7746, 8443, 9168, 9918, 10693, 11489, 12306, 13141, 13992,
+ 14856, 15732, 16615, 17504, 18395, 19287, 20174, 21056, 21928,
+ 22787, 23631, 24456, 25260, 26039, 26791, 27512, 28201, 28853,
+ 29468, 30043, 30574, 31061, 31502, 31894, 32237, 32529
+};
+
+/* table of values exp(-j*w*i) */
+
+const Word16 exp_tab_q_fx[34] = /*Q14 */
+{
+ 16384, -16068, 15137, -13622,
+ 11585, -9101, 6270, -3195,
+ 0, 3196, -6269, 9102,
+ -11584, 13623, -15136, 16069,
+ -16383, 0, -3195, 6270,
+ -9101, 11585, -13622, 15137,
+ -16068, 16384, -16068, 15137,
+ -13622, 11585, -9101, 6270,
+ -3195, 0
+};
+
+
+const Word16 exp_tab_p_fx[34] = /*Q14 */
+{
+ 16384, -11584, 0, 11585,
+ -16383, 11585, 0, -11584,
+ 16384, -11584, 0, 11585,
+ -16383, 11585, 0, -11584,
+ 16384, 0, -11584, 16384,
+ -11584, 0, 11585, -16383,
+ 11585, 0, -11584, 16384,
+ -11584, 0, 11585, -16383,
+ 11585, 0
+};
+/* gains for 23k85 mode */
+
+const Word16 HP_gain_fx[16] =
+{//Q15
+ 3624, 4673, 5597, 6479, 7425, 8378, 9324, 10264,
+ 11210, 12206, 13391, 14844, 16770, 19655, 24289, 32728
+};
+/* band-pass 6-8kHz filter */
+
+const Word16 fir_6k_7k_fx[31] =
+{//Q15
+ -32, 47, 32, -27, -369,
+ 1122, -1421, 0, 3798, -8880,
+ 12349, -10984, 3548, 7766, -18001,
+ 22118, -18001, 7766, 3548, -10984,
+ 12349, -8880, 3798, 0, -1421,
+ 1122, -369, -27, 32, 47,
+ -32
+};
+const Word16 no_lead_fx[][MAX_NO_SCALES * 2] =
+{//Q0
+ { 1, 0, 0, 1, 0, 0, }, /* 14 */
+ { 2, 0, 0, 1, 0, 0, }, /* 15 */
+ { 4, 2, 0, 1, 0, 0, }, /* 18 */
+ { 4, 2, 0, 2, 0, 0, }, /* 19 */
+ { 7, 5, 2, 5, 4, 2, }, /* 25 */
+ { 8, 8, 3, 8, 6, 2, }, /* 28 */ /* mode UV WB*/
+ { 4, 2, 0, 1, 0, 0, }, /* 18 */
+ { 4, 0, 0, 2, 1, 0, }, /* 19 */
+ { 9, 8, 8, 2, 2, 1, }, /* 24 */
+ { 8, 5, 2, 5, 2, 1, }, /* 25 */
+ { 18, 16, 8, 5, 5, 1, }, /* 29 */
+ { 24, 21, 10, 8, 8, 2, }, /* 32 */ /* mode UV NB*/
+
+ { 2, 0, 0, 2, 0, 0, }, /* 17 */
+ { 4, 2, 0, 1, 0, 0, }, /* 18 */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 */
+ { 5, 2, 1, 4, 1, 0, }, /* 22 */
+ { 8, 5, 2, 5, 2, 0, }, /* 25 */
+ { 8, 7, 4, 5, 3, 2, },
+ { 8, 8, 4, 6, 5, 2, },
+ { 13, 8, 5, 6, 5, 2, },
+ { 13, 8, 5, 8, 6, 2, },
+ { 13, 8, 5, 11, 8, 2, }, /* 30 */
+ { 24, 21, 8, 9, 8, 2, }, /* 32 */
+ { 23, 18, 8, 13, 11, 3, },
+ { 23, 21, 8, 17, 13, 4, }, /* 34 */
+ { 31, 31, 17, 26, 25, 9, }, /* 37 */ /* mode V WB*/
+ { 2, 0, 0, 2, 2, 0, }, /* 17 */
+ { 4, 2, 0, 1, 0, 0, }, /* 18 */
+ { 7, 5, 2, 2, 2, 0, }, /* 22 */
+ { 8, 7, 2, 2, 2, 0, }, /* 23 */
+ { 11, 8, 2, 2, 2, 0, }, /* 24 */
+ { 13, 13, 9, 2, 2, 0, }, /* 25 */
+ { 13, 11, 7, 5, 2, 0, }, /* 27 */
+ { 18, 14, 9, 5, 5, 2, }, /* 29 */
+ { 31, 31, 14, 11, 11, 5, }, /* 34 */
+ { 31, 31, 27, 24, 21, 14, }, /* 37 */ /* mode V NB */
+ { 5, 4, 0, 0, 0, 0, }, /* 12 (11.883) */
+ { 2, 0, 0, 2, 0, 0, }, /* 16 (15.826) */
+ { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
+ { 5, 4, 0, 2, 0, 0, }, /* 20 (19.796) */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
+ { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
+ { 5, 5, 2, 4, 2, 0, }, /* 23 (22.959) */
+ { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
+ { 8, 8, 7, 5, 2, 0, }, /* 26 (25.904) */
+ { 13, 9, 8, 5, 2, 0, }, /* 27 (26.829) */
+ { 13, 11, 8, 5, 5, 1, }, /* 28 (27.989) */
+ { 13, 9, 8, 8, 5, 2, }, /* 29 (28.984) */
+ { 22, 16, 10, 6, 5, 2, }, /* 30 (29.980) */
+ { 21, 14, 10, 8, 7, 2, }, /* 31 (30.966) */
+ { 24, 21, 10, 8, 8, 2, }, /* 32 (31.995) */ /* G WB*/
+
+ { 5, 4, 1, 0, 0, 0, }, /* 12 (11.925) */
+ { 2, 0, 0, 2, 0, 0, }, /* 16 (15.826) */
+ { 5, 4, 1, 1, 0, 0, }, /* 19 (18.745) */
+ { 5, 4, 1, 2, 0, 0, }, /* 20 (19.838) */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
+ { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
+ { 9, 8, 5, 2, 1, 0, }, /* 23 (22.815) */
+ { 14, 13, 8, 2, 2, 0, }, /* 25 (24.996) */
+ { 13, 8, 7, 4, 2, 0, }, /* 26 (25.993) */
+ { 13, 9, 8, 5, 2, 2, }, /* 27 (26.954) */
+ { 18, 13, 8, 5, 2, 2, }, /* 28 (27.992) */
+ { 21, 13, 11, 5, 3, 2, }, /* 29 (28.996) */
+ { 22, 21, 13, 5, 5, 2, }, /* 30 (29.988) */
+ { 23, 21, 17, 7, 5, 2, }, /* 31 (30.962) */
+ { 27, 23, 21, 8, 5, 2, }, /* 32 (31.987) */ /* G NB*/
+ { 2, 0, 0, 2, 0, 0, }, /* 17 */
+ { 4, 2, 0, 1, 0, 0, }, /* 18 */
+ { 4, 1, 0, 4, 0, 0, }, /* 21 */
+ { 5, 2, 0, 4, 1, 0, }, /* 22 */
+ { 8, 5, 2, 4, 0, 0, }, /* 24 */
+ { 8, 5, 2, 5, 2, 0, }, /* 25 */
+ { 14, 10, 5, 5, 5, 1, }, /* 28 */
+ { 14, 10, 5, 8, 8, 4, }, /* 30 */
+ { 13, 10, 5, 13, 8, 8, },
+ { 23, 21, 8, 8, 8, 4, },
+ { 23, 18, 5, 13, 8, 8, }, /* 33 */
+ /* mode T WB */
+ { 2, 0, 0, 2, 2, 0, }, /* 17 */
+ { 4, 2, 0, 1, 0, 0, }, /* 18 */
+ { 7, 5, 2, 2, 2, 0, }, /* 22 */
+ { 8, 7, 4, 2, 2, 0, }, /* 23 */
+ { 11, 8, 5, 2, 2, 0, }, /* 24 */
+ { 18, 8, 5, 2, 2, 0, }, /* 25 */
+ { 16, 8, 5, 5, 5, 2, }, /* 28 */
+ { 28, 23, 8, 5, 5, 5, }, /* 31 */
+ { 31, 31, 8, 5, 5, 7, }, /* 32 */ /* mode T NB */
+
+ { 18, 18, 11, 9, 6, 5, }, /* 31 */
+ { 24, 23, 13, 9, 6, 5, }, /* 32 */ /* mode G 16k */
+
+ { 24, 23, 13, 9, 6, 5, }, /* 32 (31.998) */
+ { 36, 31, 18, 9, 6, 5, }, /* 33 (32.983) */ /* T 16k */
+
+ { 2, 0, 0, 2, 2, 0, }, /* 17 */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 */
+ { 7, 5, 2, 2, 2, 0, }, /* 22 */
+ { 9, 8, 3, 4, 2, 0, }, /* 25 */
+ { 11, 9, 8, 4, 2, 0, }, /* 26 */
+ { 48, 48, 34, 13, 11, 9 }, /* 36 */ /* mode AUDIO_WB 36 + 4 + 1 */
+
+ { 22, 10, 3, 0, 0, 0 }, /* 17 */
+ { 6, 6, 2, 2, 0, 0 }, /* 21 */
+ { 6, 6, 2, 2, 2, 0 }, /* 22 */
+ { 23, 10, 3, 2, 2, 0 }, /* 26 */
+ { 32, 16, 3, 2, 2, 0 }, /* 27 */ /* AUDIO_NB */
+ { 39, 30, 12, 2, 2, 0 }, /* 28 */ /* AUDIO_NB */
+ { 11, 9, 8, 4, 2, 0, }, /* 26 */
+ { 48, 48, 48, 13, 9, 8 }, /* 36 */ /* mode AUDIO_WB 16k 15-36 + 4 + 1*/
+ { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
+ { 13, 13, 5, 5, 5, 0, }, /* 28 (27.994) */
+ { 18, 17, 5, 5, 5, 1, }, /* 29 (28.996) */
+ { 17, 13, 5, 8, 6, 2, }, /* 30 (29.991) */
+ { 23, 21, 8, 9, 8, 3, }, /* 32 (31.992) */
+ { 31, 29, 16, 8, 8, 3, }, /* 33 (32.993) */
+ { 31, 25, 16, 12, 8, 8, }, /* 34 (33.968) */
+ { 46, 48, 18, 18, 18, 12, }, /* 37 (36.995) */ /* VOICED 16k */
+ { 14, 12, 9, 2, 2, 0, }, /* 25 (24.980) */
+ { 15, 13, 3, 2, 2, 0, }, /* 25 (24.974) */
+ { 17, 3, 0, 2, 2, 1, }, /* 25 (24.852) */
+ { 13, 10, 3, 2, 2, 2, }, /* 25 (24.994) */
+ { 14, 13, 8, 2, 2, 0, }, /* 25 (24.996) */
+ { 7, 3, 0, 5, 3, 1, }, /* 25 (24.671) */
+ { 4, 3, 2, 6, 6, 5, }, /* 25 (24.936) */
+ { 4, 2, 0, 9, 9, 3, }, /* 25 (24.955) */
+ { 4, 2, 0, 9, 8, 2, }, /* 25 (24.853) */
+ { 4, 2, 0, 9, 7, 6, }, /* 25 (24.881) */
+ { 6, 3, 0, 6, 3, 2, }, /* 25 (24.939) */
+ { 3, 2, 0, 9, 8, 5, }, /* 25 (24.996) */
+ { 2, 2, 0, 15, 3, 3, }, /* 25 (24.310) */
+ { 4, 2, 0, 9, 9, 3, }, /* 25 (24.955) */
+ { 4, 4, 2, 7, 6, 3, }, /* 25 (24.984) */
+ { 3, 2, 0, 9, 7, 6, }, /* 25 (24.866) */
+
+};
+
+const Word16 no_lead_p_fx[][MAX_NO_SCALES * 2] = // Q0
+{
+
+ { 2, 1, 0, 0, 0, 0, }, /* 9 (8.464) */
+ { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
+ { 5, 5, 2, 4, 2, 0, }, /* 23 (22.959) */
+ { 8, 5, 2, 4, 0, 0, }, /* 24 (23.949) */
+ { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
+ { 13, 11, 5, 5, 2, 0, }, /* 27 (26.902) */
+ { 11, 10, 5, 6, 5, 2, }, /* 28 (27.996) */
+ { 14, 13, 5, 7, 5, 2, }, /* 29 (28.937) */
+ { 16, 13, 5, 8, 7, 2, }, /* 30 (29.954) */
+ { 21, 21, 5, 8, 5, 2, }, /* 31 (30.978) */
+ { 24, 21, 5, 8, 8, 4, }, /* 32 (31.978) */
+ { 32, 23, 5, 13, 11, 5, }, /* 34 (33.975) */
+ { 36, 31, 8, 16, 13, 5, }, /* 35 (34.975) */
+ { 45, 35, 16, 18, 13, 5, }, /* 36 (35.889) */
+ { 45, 35, 16, 38, 31, 8, }, /* 39 (38.488) */ /* V WB*/ /* 14 */
+
+ { 2, 0, 0, 0, 0, 0, }, /* 8 (7.913) */
+ { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
+ { 8, 7, 2, 2, 2, 0, }, /* 23 (22.773) */
+ { 13, 11, 5, 2, 1, 0, }, /* 24 (23.999) */
+ { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
+ { 13, 11, 5, 5, 2, 1, }, /* 27 (26.962) */
+ { 13, 11, 5, 5, 5, 2, }, /* 28 (27.835) */
+ { 14, 13, 5, 7, 5, 2, }, /* 29 (28.937) */
+ { 23, 21, 5, 5, 5, 2, }, /* 30 (29.969) */
+ { 23, 18, 5, 8, 5, 2, }, /* 31 (30.952) */
+ { 24, 21, 5, 8, 8, 4, }, /* 32 (31.978) */
+ { 43, 41, 13, 9, 8, 5, }, /* 34 (33.992) */
+ { 43, 36, 13, 13, 10, 5, }, /* 35 (35.000) */
+ { 43, 40, 13, 17, 13, 9, }, /* 36 (35.980) */
+ { 43, 42, 13, 31, 30, 18, }, /* 39 (38.512) */ /* V NB*/ /* 29 */
+
+ { 2, 0, 0, 1, 0, 0, }, /* 15 (14.733) */
+ { 5, 4, 1, 1, 0, 0, }, /* 19 (18.745) */
+ { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
+ { 10, 9, 5, 2, 0, 0, }, /* 23 (22.791) */
+ { 14, 13, 8, 2, 0, 0, }, /* 24 (23.999) */
+ { 14, 13, 8, 2, 2, 0, }, /* 25 (24.996) */
+ { 18, 17, 13, 2, 2, 0, }, /* 26 (25.934) */
+ { 14, 13, 8, 5, 4, 0, }, /* 28 (27.969) */
+ { 18, 17, 13, 5, 4, 2, }, /* 29 (28.996) */
+ { 22, 21, 13, 5, 5, 2, }, /* 30 (29.988) */
+ { 31, 23, 21, 5, 5, 2, }, /* 31 (30.931) */
+ { 27, 23, 21, 8, 5, 2, }, /* 32 (31.987) */
+ { 31, 23, 21, 9, 8, 5, }, /* 33 (32.982) */
+ { 32, 31, 24, 11, 8, 5, }, /* 34 (33.967) */
+ { 32, 32, 28, 13, 11, 8, }, /* 35 (34.994) */ /* G WB*/ /* 44 */
+
+ { 2, 0, 0, 1, 0, 0, }, /* 15 (14.733) */
+ { 5, 4, 2, 1, 0, 0, }, /* 19 (18.792) */
+ { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
+ { 8, 7, 2, 2, 2, 0, }, /* 23 (22.773) */
+ { 13, 11, 2, 2, 1, 0, }, /* 24 (23.932) */
+ { 16, 13, 2, 2, 2, 0, }, /* 25 (24.955) */
+ { 21, 17, 2, 2, 2, 0, }, /* 26 (25.991) */
+ { 13, 12, 2, 5, 5, 2, }, /* 28 (27.979) */
+ { 18, 16, 2, 5, 5, 2, }, /* 29 (28.878) */
+ { 23, 21, 2, 5, 5, 2, }, /* 30 (29.954) */
+ { 32, 28, 2, 5, 5, 2, }, /* 31 (30.893) */
+ { 38, 31, 2, 7, 5, 2, }, /* 32 (31.963) */
+ { 33, 31, 2, 8, 8, 4, }, /* 33 (32.997) */
+ { 42, 31, 2, 9, 9, 8, }, /* 34 (33.986) */
+ { 42, 31, 2, 13, 11, 9, }, /* 35 (34.952) */ /* G NB*/ /* 59 */
+
+ { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
+ { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
+ { 13, 8, 5, 4, 2, 0, }, /* 26 */
+ { 13, 8, 5, 8, 6, 2, }, /* 29 */
+ { 13, 8, 5, 9, 8, 5, }, /* 30 */
+ { 48, 48, 48, 36, 36, 28 }, /* 40 */ /* mode 7 AUDIO_WB */ /* 65*/
+
+ { 7, 5, 2, 2, 0, 0 }, /* 21 */
+ { 13, 13, 9, 2, 2, 0 }, /* 25 */
+ { 18, 18, 9, 2, 2, 0 }, /* 26 */
+ { 24, 23, 10, 5, 4, 2 }, /* 30 */
+ { 31, 31, 12, 5, 5, 2 }, /* 31 */ /*AUDIO_NB */ /* 70 */
+ { 43, 34, 12, 5, 5, 4 }, /* 32 */ /*AUDIO_NB */ /* 71 */
+ { 13, 8, 5, 9, 8, 5, }, /* 30 */
+ { 48, 48, 45, 45, 31, 25 }, /* 40 */ /* mode AUDIO_WB 16k */ /* 73*/
+
+ { 2, 0, 0, 2, 2, 0, }, /* 17 (16.823) */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
+ { 7, 5, 2, 2, 2, 0, }, /* 22 (21.907) */
+ { 13, 11, 10, 2, 2, 0, }, /* 25 (24.863) */
+ { 18, 18, 10, 2, 2, 0, }, /* 26 (25.921) */
+ { 13, 9, 9, 5, 2, 0, }, /* 27 (26.837) */
+ { 40, 28, 25, 18, 17, 2, }, /* 36 (35.998) */ /* INACTIVE NB*/ /* 80*/
+
+ { 18, 17, 11, 0, 0, 0, }, /* 17 (16.932) */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
+ { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
+ { 13, 13, 9, 2, 2, 0, }, /* 25 (24.845) */
+ { 18, 18, 12, 2, 2, 0, }, /* 26 (25.999) */
+ { 23, 23, 16, 2, 2, 0, }, /* 27 (26.981) */
+ { 36, 32, 24, 17, 13, 13, }, /* 36 (35.929) */ /* INACTIVE WB */ /* 87 */
+
+ { 2, 2, 0, 2, 0, 0, }, /* 17 (16.823) */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
+ { 8, 5, 2, 2, 1, 0, }, /* 22 (21.985) */
+ { 13, 13, 9, 2, 2, 0, }, /* 25 (24.845) */
+ { 18, 17, 13, 2, 2, 0, }, /* 26 (25.934) */
+ { 23, 22, 17, 2, 2, 0, }, /* 27 (26.914) */
+ { 34, 32, 24, 16, 16, 13, }, /* 36 (35.915) */ /* INACTIVE WB 16k*/ /* 94 */
+
+ { 4, 2, 0, 1, 0, 0, }, /* 18 (17.479) */
+ { 5, 4, 0, 1, 0, 0, }, /* 19 (18.703) */
+ { 8, 7, 2, 2, 0, 0, }, /* 22 (21.776) */
+ { 10, 9, 5, 2, 0, 0, }, /* 23 (22.791) */
+ { 15, 13, 5, 2, 0, 0, }, /* 24 (23.999) */
+ { 18, 16, 8, 5, 5, 1, }, /* 29 (28.966) */
+ { 42, 32, 31, 5, 5, 2, }, /* 32 (31.990) */ /* UNVOICED NB*/ /* 100 */
+
+ { 1, 0, 0, 1, 0, 0, }, /* 14 (13.640) */
+ { 2, 0, 0, 1, 0, 0, }, /* 15 (14.733) */
+ { 4, 2, 0, 1, 0, 0, }, /* 18 (17.479) */
+ { 4, 2, 0, 2, 0, 0, }, /* 19 (18.572) */
+ { 5, 4, 0, 2, 0, 0, }, /* 20 (19.796) */
+ { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
+ { 11, 10, 5, 6, 5, 2, }, /* 28 (27.996) */ /* UNVOICED WB */ /* 106 */
+ { 9, 3, 0, 4, 0, 0, }, /* 24 (23.818) */
+ { 18, 13, 10, 8, 3, 0, }, /* 30 (29.992) */
+ { 24, 18, 10, 9, 3, 0, }, /* 31 (30.998) */
+ { 32, 25, 10, 9, 3, 0, }, /* 32 (31.987) */
+ { 42, 31, 10, 12, 3, 2, }, /* 34 (33.994) */
+ { 44, 32, 27, 15, 3, 2, }, /* 35 (35.000) */
+ { 44, 32, 25, 19, 3, 2, }, /* 36 (35.994) */
+ { 48, 39, 32, 35, 15, 3, }, /* 39 (38.301) */ /* VOICED 16k */
+ { 11, 10, 5, 4, 2, 0, }, /* 26 (25.917) */ /* 107 */
+ { 23, 23, 17, 8, 7, 2, }, /* 32 (31.980) */
+ { 32, 31, 18, 9, 7, 5, }, /* 33 (32.990) */
+ { 31, 31, 18, 11, 9, 8, }, /* 34 (33.974) */
+ { 32, 32, 20, 13, 12, 8, }, /* 35 (34.989) */
+ { 32, 32, 23, 18, 17, 8, }, /* 36 (35.988) */
+ { 32, 32, 23, 23, 22, 10, }, /* 37 (36.989) */ /* GENERIC 16k*/ /* 113 */
+
+ { 2, 0, 0, 2, 0, 0, }, /* 16 (15.826) */ /* 114 */
+ { 7, 5, 2, 2, 0, 0, }, /* 21 (20.910) */
+ { 14, 13, 8, 2, 0, 0, }, /* 24 (23.999) */
+ { 8, 8, 5, 4, 2, 0, }, /* 25 (24.992) */
+ { 11, 10, 5, 4, 2, 0, }, /* 26 (25.917) */
+ { 16, 13, 8, 4, 2, 0, }, /* 27 (26.883) */
+ { 13, 13, 8, 5, 4, 2, }, /* 28 (27.901) */
+ { 23, 18, 13, 5, 5, 2, }, /* 30 (29.916) */
+ { 23, 23, 13, 7, 5, 2, }, /* 31 (30.993) */
+ { 23, 23, 17, 8, 7, 2, }, /* 32 (31.980) */
+ { 32, 31, 24, 8, 7, 2, }, /* 33 (32.958) */
+ { 42, 32, 31, 9, 9, 4, }, /* 34 (33.987) */
+ { 40, 32, 29, 12, 9, 9, }, /* 35 (34.994) */
+ { 40, 32, 31, 17, 11, 11, }, /* 36 (35.968) */
+ { 41, 32, 31, 20, 18, 13, }, /* 37 (36.971) */ /* GENERIC 12.8k MA*/ /* 128 */
+
+ { 11, 10, 5, 4, 2, 0, }, /* 26 (25.917) */ /* 129 */
+ { 23, 23, 17, 8, 7, 2, }, /* 32 (31.980) */
+ { 31, 31, 18, 9, 8, 2, }, /* 33 (32.995) */
+ { 48, 32, 24, 9, 8, 3, }, /* 34 (33.993) */
+ { 48, 32, 28, 11, 10, 3, }, /* 35 (34.992) */
+ { 48, 37, 32, 16, 12, 4, }, /* 36 (35.997) */
+ { 48, 37, 32, 18, 17, 12, }, /* 37 (36.961) */ /* AUDIO 16k */
+};
+
+/*----------------------------------------------------------------------------------*
+ * Enhacer - 2.0 - 6.4 kHz impulse response with phase dispersion in freq. domain
+ *----------------------------------------------------------------------------------*/
+const Word16 low_H[64] = /* (1Q14) */
+{
+ 16388, 16380, 16386, 16381, 16382, 16382, 16381, 16383, 16385, 10265,
+ 10154, 9894, 14051, 16342, -531, 13216, 16372, 15509, 9406, 15948,
+ 4726, 14593, 10404, 9795, -16337, -1815, -10624, 12646, 14555, -12684,
+ 11388, 8175, 16382, -14198, 11781, 10378, 7515, 10423, -12473, 16284,
+ -1200, -13137, 12658, -7446, 15683, -3764, -13419, -5281, 521, -9686,
+ -16375, -1219, 8435, -13059, -12862, -12775, -1, 2, 0, -3,
+ -1, -1, -2, 1
+};
+
+const Word16 low_H16k[80] = /* (1Q14) */
+{
+ 16388, 16380, 16386, 16381, 16382, 16382, 16381, 16383, 16385, 10265,
+ 10154, 9894, 14051, 16342, -531, 13216, 16372, 15509, 9406, 15948,
+ 4726, 14593, 10404, 9795, -16337, -1815, -10624, 12646, 14555, -12684,
+ 11388, 8175, -4121, -13408, 10605, -12308, 16358, 4699, 7640, -7360,
+ 16382, -14639, -14494, 15695, -907, -10815, -12489, 9416, 15857,
+ -14198, 11781, 10378, 7515, 10423, -12473, 16284, -1200, -13137, 12658,
+ -7446, 15683, -3764, -13419, -5281, 521, -9686, -16375, -1219, 8435,
+ -13059, -12862, -12775, -1, 2, 0, -3, -1, -1, -2, 1
+};
+/*----------------------------------------------------------------------------------*
+ * Enhancer - 3.2 - 6.4 kHz impulse response with phase dispersion in freq. domain
+ *----------------------------------------------------------------------------------*/
+
+const Word16 mid_H[64] = /* (1Q14) */
+{
+ 16382, 16381, 16384, 16384, 16385, 16387, 16386, 16382, 16387, 16382,
+ 16385, 16385, 16385, 16384, 16382, 16388, 14847, 9629, 13248, 14486,
+ 10995, 642, 13817, 13779, 6468, 8664, 11634, 9780, -14636, -982,
+ 11746, -722, 16385, -16366, -11423, 16354, 7362, 13147, -11538, -13904,
+ -15052, -8862, 8811, -16371, -12146, 7660, -9638, -13254, -6923, 3,
+ -5, -2, -6, 1, 6, 5, -8, -2, 3, -5,
+ 0, -2, -4, 3
+};
+
+const Word16 mid_H16k[80] = /* (1Q14) */
+{
+ 16382, 16381, 16384, 16384, 16385, 16387, 16386, 16382, 16387, 16382,
+ 16385, 16385, 16385, 16384, 16382, 16388, 14847, 9629, 13248, 14486,
+ 10995, 642, 13817, 13779, 6468, 8664, 11634, 9780, -14636, -982,
+ 11746, -722, 108, -16195, -13199, -13289, 5114, 12941, 7110, 8873,
+ 16385, -13774, -14761, 10047, -15566, -9584, 9707, 2483, 16383,
+ -16366, -11423, 16354, 7362, 13147, -11538, -13904, -15052, -8862,
+ 8811, -16371, -12146, 7660, -9638, -13254, -6923, 3, -5, -2, -6,
+ 1, 6, 5, -8, -2, 3, -5, 0, -2, -4, 3
+};
+
+/*-------------------------------------------------------------------*
+ * Low-pass FIR filter for low-freq post-filtering
+ * response : 0dB @ 50Hz, -6dB @ 500Hz, -45dB @ 1kHz)
+ * filter parameters: fs/2=8000, fc=500, gain=1.0, n=16
+ *-------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------*
+ * Bass post-filter
+ *-------------------------------------------------------------------*/
+
+/* For bass post filter */
+const Word16 filt_lp_fx[1 + L_FILT] =
+{
+ 2892/*0.088250f Q15*/, 2831/*0.086410f Q15*/, 2657/*0.081074f Q15*/, 2384/*0.072768f Q15*/,
+ 2041/*0.062294f Q15*/, 1659/*0.050623f Q15*/, 1271/*0.038774f Q15*/, 907/*0.027692f Q15*/,
+ 594/*0.018130f Q15*/, 347/*0.010578f Q15*/, 171/*0.005221f Q15*/, 64/*0.001946f Q15*/,
+ 13/*0.000385f Q15*/
+};
+
+const Word16 filt_lp_16kHz_fx[1 + L_FILT16k] =
+{
+ 2340/*0.071410f Q15*/, 2308/*0.070433f Q15*/, 2214/*0.067568f Q15*/, 2064/*0.062999f Q15*/,
+ 1868/*0.057020f Q15*/, 1639/*0.050005f Q15*/, 1389/*0.042378f Q15*/, 1133/*0.034577f Q15*/,
+ 885/*0.027022f Q15*/, 658/*0.020078f Q15*/, 460/*0.014031f Q15*/, 297/*0.009070f Q15*/,
+ 173/*0.005276f Q15*/, 86/*0.002625f Q15*/, 33/*0.000999f Q15*/, 7/*0.000205f Q15*/
+};
+
+/*-------------------------------------------------------------------*
+ * Pulse indexing tables for ACELP innovation coding
+ *-------------------------------------------------------------------*/
+
+const Word32 PI_select_table[23][8] = // Q0
+{
+ {1, 0, 0, 0, 0, 0, 0, 0},
+ {1, 1, 0, 0, 0, 0, 0, 0},
+ {1, 2, 1, 0, 0, 0, 0, 0},
+ {1, 3, 3, 1, 0, 0, 0, 0},
+ {1, 4, 6, 4, 1, 0, 0, 0},
+ {1, 5, 10, 10, 5, 1, 0, 0},
+ {1, 6, 15, 20, 15, 6, 1, 0},
+ {1, 7, 21, 35, 35, 21, 7, 1},
+ {1, 8, 28, 56, 70, 56, 28, 8},
+ {1, 9, 36, 84, 126, 126, 84, 36},
+ {1, 10, 45, 120, 210, 252, 210, 120},
+ {1, 11, 55, 165, 330, 462, 462, 330},
+ {1, 12, 66, 220, 495, 792, 924, 792},
+ {1, 13, 78, 286, 715, 1287, 1716, 1716},
+ {1, 14, 91, 364, 1001, 2002, 3003, 3432},
+ {1, 15, 105, 455, 1365, 3003, 5005, 6435},
+ {1, 16, 120, 560, 1820, 4368, 8008, 11440},
+ {1, 17, 136, 680, 2380, 6188, 12376, 19448},
+ {1, 18, 153, 816, 3060, 8568, 18564, 31824},
+ {1, 19, 171, 969, 3876, 11628, 27132, 50388},
+ {1, 20, 190, 1140, 4845, 15504, 38760, 77520},
+ {1, 21, 210, 1330, 5985, 20349, 54264, 116280},
+ {1, 22, 231, 1540, 7315, 26334, 74613, 1705444}
+};
+
+const Word32 PI_offset[8][8] = // Q0
+{
+ /* for 0p(0). */
+ {0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000},
+ /* for 1p(1). */
+ {0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000},
+ /* for 2p(2,1). */
+ {0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000},
+ /* for 3p(3,2,1). */
+ {0x00000,0x00000,0x01180,0x01540,0x00000,0x00000,0x00000,0x00000},
+ /* for 4p(4,3,2,1). */
+ {0x00000,0x00000,0x071C0,0x0A640,0x0ABE0,0x00000,0x00000,0x00000},
+ /* for 5p(5,4,3,2,1). */
+ {0x00000,0x00000,0x22200,0x3E900,0x45200,0x45980,0x00000,0x00000},
+ /* for 6p(6,5,4,3,2,1). */
+ {0x00000,0x00000,0x07d200,0x127c00,0x16ed80,0x179c80,0x17a5e0,0x00000},
+ /* for 7p(7,6,5,4,3,2,1). */
+ {0x00000,0x00000,0x165800,0x454400,0x654200,0x6E2500,0x6F2B80,0x6F36C0}
+};
+
+const Word16 PI_factor[7] = {0,0,120,560,1820,4368,8008}; // Q0
+
+/* ACELP pulse coding */
+const Word16 hi_to_low_tmpl[10] = { 0, 0, 0, 3, 9, 5, 3, 1, 8, 8 }; // Q0
+const UWord16 low_len[10] = { 0, 0, 8, 5, 7,11,13,15,16,16 }; // Q0
+const UWord16 low_mask[10] = { 0, 0, 255,31,127,2047,8191,32767,65535,65535 }; // Q0
+const UWord16 indx_fact[10] = { 0, 0,2,172,345,140,190,223,463,1732 }; // Q0
+const Word16 index_len[3] = { 0, 5, 9 }; // Q0
+const Word16 index_mask_ACELP[3] = { 0, 31, 511 }; // Q0
+
+
+/*------------------------------------------------------------------------------*
+ * EDCT tables
+ *------------------------------------------------------------------------------*/
+
+//Fix
+const Word16 edct_table_80_fx[80] = /*Q16 */
+{
+ 21911, 21903, 21886, 21860, 21827, 21784, 21734, 21675,
+ 21608, 21532, 21448, 21356, 21255, 21147, 21030, 20905,
+ 20772, 20631, 20482, 20325, 20161, 19988, 19808, 19621,
+ 19425, 19222, 19012, 18795, 18570, 18338, 18099, 17853,
+ 17600, 17340, 17074, 16801, 16522, 16236, 15944, 15646,
+ 15341, 15031, 14715, 14394, 14067, 13734, 13396, 13053,
+ 12705, 12352, 11994, 11632, 11265, 10894, 10519, 10139,
+ 9756, 9369, 8978, 8584, 8186, 7786, 7382, 6975,
+ 6566, 6155, 5741, 5324, 4906, 4486, 4064, 3640,
+ 3215, 2789, 2362, 1934, 1505, 1075, 645, 215
+};
+
+const Word16 edct_table_100_fx[] =
+{/*Q16 */
+ 20723, 20718, 20708, 20692, 20672, 20646, 20616, 20580,
+ 20539, 20493, 20442, 20386, 20325, 20259, 20188, 20112,
+ 20031, 19946, 19855, 19759, 19658, 19553, 19443, 19328,
+ 19208, 19083, 18954, 18820, 18681, 18538, 18390, 18238,
+ 18081, 17920, 17754, 17584, 17410, 17231, 17048, 16861,
+ 16670, 16474, 16275, 16071, 15864, 15652, 15437, 15218,
+ 14995, 14768, 14538, 14304, 14067, 13826, 13582, 13335,
+ 13084, 12830, 12573, 12312, 12049, 11783, 11513, 11241,
+ 10966, 10689, 10409, 10126, 9841, 9553, 9263, 8971,
+ 8676, 8379, 8081, 7780, 7477, 7173, 6867, 6559,
+ 6249, 5938, 5625, 5311, 4996, 4679, 4362, 4043,
+ 3723, 3403, 3081, 2759, 2436, 2112, 1788, 1464,
+ 1139, 814, 488, 163
+};
+
+const Word16 edct_table_120_fx[120] = /*Q16 */
+{
+ 19800, 19797, 19790, 19780, 19766, 19749, 19729, 19705,
+ 19678, 19648, 19614, 19576, 19536, 19492, 19445, 19394,
+ 19340, 19283, 19223, 19159, 19092, 19021, 18948, 18871,
+ 18791, 18708, 18621, 18531, 18438, 18342, 18243, 18141,
+ 18035, 17927, 17815, 17701, 17583, 17462, 17339, 17212,
+ 17082, 16950, 16815, 16676, 16535, 16391, 16244, 16095,
+ 15942, 15787, 15629, 15469, 15306, 15140, 14972, 14801,
+ 14628, 14452, 14273, 14092, 13909, 13723, 13535, 13345,
+ 13152, 12958, 12761, 12561, 12360, 12156, 11951, 11743,
+ 11533, 11322, 11108, 10893, 10675, 10456, 10235, 10012,
+ 9788, 9562, 9334, 9104, 8874, 8641, 8407, 8172,
+ 7935, 7697, 7457, 7217, 6975, 6732, 6487, 6242,
+ 5995, 5748, 5499, 5250, 4999, 4748, 4496, 4243,
+ 3990, 3736, 3481, 3225, 2969, 2713, 2456, 2199,
+ 1941, 1683, 1424, 1166, 907, 648, 389, 130
+};
+
+const Word16 edct_table_320_fx[320] = /*Q16 */
+{
+ 15495, 15495, 15494, 15493, 15491, 15489, 15487, 15484,
+ 15481, 15478, 15474, 15470, 15466, 15461, 15456, 15450,
+ 15444, 15438, 15431, 15424, 15417, 15409, 15401, 15392,
+ 15383, 15374, 15364, 15354, 15344, 15333, 15322, 15310,
+ 15298, 15286, 15273, 15260, 15247, 15233, 15219, 15205,
+ 15190, 15175, 15159, 15143, 15127, 15110, 15093, 15076,
+ 15058, 15040, 15021, 15002, 14983, 14964, 14944, 14924,
+ 14903, 14882, 14860, 14839, 14817, 14794, 14771, 14748,
+ 14725, 14701, 14677, 14652, 14627, 14602, 14576, 14550,
+ 14524, 14497, 14470, 14443, 14415, 14387, 14359, 14330,
+ 14301, 14271, 14242, 14212, 14181, 14150, 14119, 14088,
+ 14056, 14024, 13991, 13958, 13925, 13891, 13858, 13823,
+ 13789, 13754, 13719, 13683, 13647, 13611, 13575, 13538,
+ 13501, 13463, 13425, 13387, 13349, 13310, 13271, 13231,
+ 13192, 13152, 13111, 13071, 13030, 12988, 12947, 12905,
+ 12862, 12820, 12777, 12734, 12690, 12647, 12602, 12558,
+ 12513, 12468, 12423, 12377, 12331, 12285, 12239, 12192,
+ 12145, 12098, 12050, 12002, 11954, 11905, 11856, 11807,
+ 11758, 11708, 11658, 11608, 11557, 11507, 11455, 11404,
+ 11352, 11301, 11248, 11196, 11143, 11090, 11037, 10983,
+ 10930, 10876, 10821, 10767, 10712, 10657, 10601, 10546,
+ 10490, 10434, 10378, 10321, 10264, 10207, 10150, 10092,
+ 10034, 9976, 9918, 9859, 9800, 9741, 9682, 9623,
+ 9563, 9503, 9443, 9382, 9322, 9261, 9200, 9138,
+ 9077, 9015, 8953, 8891, 8829, 8766, 8703, 8640,
+ 8577, 8513, 8450, 8386, 8322, 8258, 8193, 8129,
+ 8064, 7999, 7933, 7868, 7802, 7737, 7671, 7604,
+ 7538, 7471, 7405, 7338, 7271, 7203, 7136, 7068,
+ 7001, 6933, 6865, 6796, 6728, 6659, 6591, 6522,
+ 6453, 6383, 6314, 6244, 6175, 6105, 6035, 5965,
+ 5895, 5824, 5754, 5683, 5612, 5541, 5470, 5399,
+ 5327, 5256, 5184, 5113, 5041, 4969, 4897, 4824,
+ 4752, 4680, 4607, 4534, 4462, 4389, 4316, 4243,
+ 4169, 4096, 4023, 3949, 3876, 3802, 3728, 3654,
+ 3580, 3506, 3432, 3358, 3284, 3209, 3135, 3060,
+ 2986, 2911, 2836, 2761, 2687, 2612, 2537, 2462,
+ 2386, 2311, 2236, 2161, 2085, 2010, 1934, 1859,
+ 1783, 1708, 1632, 1557, 1481, 1405, 1329, 1254,
+ 1178, 1102, 1026, 950, 874, 798, 722, 646,
+ 570, 494, 418, 342, 266, 190, 114, 38
+};
+
+const Word16 edct_table_480_fx[480] = /*Q16 */
+{
+ 14001, 14001, 14001, 14000, 14000, 13999, 13998, 13997,
+ 13996, 13995, 13993, 13991, 13990, 13988, 13986, 13983,
+ 13981, 13978, 13976, 13973, 13970, 13967, 13963, 13960,
+ 13956, 13953, 13949, 13945, 13940, 13936, 13932, 13927,
+ 13922, 13917, 13912, 13907, 13902, 13896, 13890, 13885,
+ 13879, 13872, 13866, 13860, 13853, 13846, 13840, 13833,
+ 13825, 13818, 13811, 13803, 13795, 13787, 13779, 13771,
+ 13763, 13754, 13746, 13737, 13728, 13719, 13709, 13700,
+ 13691, 13681, 13671, 13661, 13651, 13641, 13630, 13620,
+ 13609, 13598, 13587, 13576, 13565, 13553, 13542, 13530,
+ 13518, 13506, 13494, 13482, 13469, 13457, 13444, 13431,
+ 13418, 13405, 13392, 13378, 13365, 13351, 13337, 13323,
+ 13309, 13295, 13280, 13266, 13251, 13236, 13221, 13206,
+ 13191, 13175, 13160, 13144, 13128, 13112, 13096, 13080,
+ 13063, 13047, 13030, 13013, 12996, 12979, 12962, 12944,
+ 12927, 12909, 12891, 12873, 12855, 12837, 12819, 12800,
+ 12782, 12763, 12744, 12725, 12706, 12686, 12667, 12647,
+ 12628, 12608, 12588, 12568, 12547, 12527, 12506, 12486,
+ 12465, 12444, 12423, 12402, 12380, 12359, 12337, 12316,
+ 12294, 12272, 12250, 12227, 12205, 12182, 12160, 12137,
+ 12114, 12091, 12068, 12045, 12021, 11998, 11974, 11950,
+ 11926, 11902, 11878, 11854, 11829, 11804, 11780, 11755,
+ 11730, 11705, 11680, 11654, 11629, 11603, 11578, 11552,
+ 11526, 11500, 11474, 11447, 11421, 11394, 11368, 11341,
+ 11314, 11287, 11260, 11232, 11205, 11177, 11150, 11122,
+ 11094, 11066, 11038, 11010, 10981, 10953, 10924, 10895,
+ 10867, 10838, 10809, 10779, 10750, 10721, 10691, 10662,
+ 10632, 10602, 10572, 10542, 10512, 10481, 10451, 10420,
+ 10390, 10359, 10328, 10297, 10266, 10235, 10203, 10172,
+ 10140, 10109, 10077, 10045, 10013, 9981, 9949, 9917,
+ 9884, 9852, 9819, 9786, 9754, 9721, 9688, 9654,
+ 9621, 9588, 9554, 9521, 9487, 9454, 9420, 9386,
+ 9352, 9318, 9283, 9249, 9214, 9180, 9145, 9111,
+ 9076, 9041, 9006, 8971, 8935, 8900, 8865, 8829,
+ 8794, 8758, 8722, 8686, 8650, 8614, 8578, 8542,
+ 8505, 8469, 8432, 8396, 8359, 8322, 8285, 8248,
+ 8211, 8174, 8137, 8099, 8062, 8025, 7987, 7949,
+ 7912, 7874, 7836, 7798, 7760, 7721, 7683, 7645,
+ 7606, 7568, 7529, 7491, 7452, 7413, 7374, 7335,
+ 7296, 7257, 7218, 7178, 7139, 7100, 7060, 7020,
+ 6981, 6941, 6901, 6861, 6821, 6781, 6741, 6701,
+ 6661, 6620, 6580, 6539, 6499, 6458, 6418, 6377,
+ 6336, 6295, 6254, 6213, 6172, 6131, 6090, 6048,
+ 6007, 5966, 5924, 5883, 5841, 5799, 5758, 5716,
+ 5674, 5632, 5590, 5548, 5506, 5464, 5422, 5379,
+ 5337, 5295, 5252, 5210, 5167, 5124, 5082, 5039,
+ 4996, 4953, 4911, 4868, 4825, 4782, 4738, 4695,
+ 4652, 4609, 4566, 4522, 4479, 4435, 4392, 4348,
+ 4305, 4261, 4218, 4174, 4130, 4086, 4042, 3999,
+ 3955, 3911, 3867, 3823, 3778, 3734, 3690, 3646,
+ 3602, 3557, 3513, 3469, 3424, 3380, 3335, 3291,
+ 3246, 3202, 3157, 3112, 3068, 3023, 2978, 2933,
+ 2889, 2844, 2799, 2754, 2709, 2664, 2619, 2574,
+ 2529, 2484, 2439, 2394, 2349, 2303, 2258, 2213,
+ 2168, 2122, 2077, 2032, 1986, 1941, 1896, 1850,
+ 1805, 1759, 1714, 1668, 1623, 1577, 1532, 1486,
+ 1441, 1395, 1350, 1304, 1258, 1213, 1167, 1121,
+ 1076, 1030, 984, 939, 893, 847, 801, 756,
+ 710, 664, 618, 573, 527, 481, 435, 389,
+ 344, 298, 252, 206, 160, 115, 69, 23
+};
+
+const Word16 edct_table_600_fx[] =/*Q16 */
+{
+ 26483, 26483, 26483, 26482, 26481, 26481, 26479, 26478,
+ 26477, 26475, 26473, 26471, 26469, 26467, 26464, 26461,
+ 26459, 26455, 26452, 26449, 26445, 26441, 26437, 26433,
+ 26429, 26424, 26420, 26415, 26410, 26404, 26399, 26393,
+ 26387, 26381, 26375, 26369, 26362, 26356, 26349, 26342,
+ 26335, 26327, 26320, 26312, 26304, 26296, 26287, 26279,
+ 26270, 26261, 26252, 26243, 26234, 26224, 26214, 26204,
+ 26194, 26184, 26173, 26163, 26152, 26141, 26130, 26118,
+ 26107, 26095, 26083, 26071, 26059, 26046, 26033, 26021,
+ 26008, 25994, 25981, 25968, 25954, 25940, 25926, 25912,
+ 25897, 25883, 25868, 25853, 25838, 25823, 25807, 25791,
+ 25776, 25760, 25743, 25727, 25711, 25694, 25677, 25660,
+ 25643, 25625, 25608, 25590, 25572, 25554, 25535, 25517,
+ 25498, 25480, 25461, 25441, 25422, 25403, 25383, 25363,
+ 25343, 25323, 25302, 25282, 25261, 25240, 25219, 25198,
+ 25176, 25155, 25133, 25111, 25089, 25067, 25044, 25022,
+ 24999, 24976, 24953, 24929, 24906, 24882, 24858, 24834,
+ 24810, 24786, 24761, 24737, 24712, 24687, 24662, 24636,
+ 24611, 24585, 24559, 24533, 24507, 24481, 24454, 24427,
+ 24401, 24373, 24346, 24319, 24291, 24264, 24236, 24208,
+ 24180, 24151, 24123, 24094, 24065, 24036, 24007, 23978,
+ 23948, 23918, 23888, 23858, 23828, 23798, 23767, 23737,
+ 23706, 23675, 23644, 23612, 23581, 23549, 23518, 23486,
+ 23453, 23421, 23389, 23356, 23323, 23290, 23257, 23224,
+ 23191, 23157, 23123, 23090, 23056, 23021, 22987, 22953,
+ 22918, 22883, 22848, 22813, 22778, 22742, 22707, 22671,
+ 22635, 22599, 22563, 22526, 22490, 22453, 22416, 22379,
+ 22342, 22305, 22267, 22230, 22192, 22154, 22116, 22078,
+ 22039, 22001, 21962, 21923, 21884, 21845, 21806, 21766,
+ 21727, 21687, 21647, 21607, 21567, 21527, 21486, 21446,
+ 21405, 21364, 21323, 21282, 21241, 21199, 21157, 21116,
+ 21074, 21032, 20989, 20947, 20905, 20862, 20819, 20776,
+ 20733, 20690, 20647, 20603, 20560, 20516, 20472, 20428,
+ 20384, 20339, 20295, 20250, 20205, 20161, 20116, 20070,
+ 20025, 19980, 19934, 19888, 19842, 19796, 19750, 19704,
+ 19658, 19611, 19565, 19518, 19471, 19424, 19377, 19329,
+ 19282, 19234, 19186, 19139, 19091, 19042, 18994, 18946,
+ 18897, 18849, 18800, 18751, 18702, 18653, 18604, 18554,
+ 18505, 18455, 18405, 18355, 18305, 18255, 18205, 18154,
+ 18104, 18053, 18002, 17951, 17900, 17849, 17798, 17747,
+ 17695, 17643, 17592, 17540, 17488, 17436, 17383, 17331,
+ 17278, 17226, 17173, 17120, 17067, 17014, 16961, 16908,
+ 16854, 16801, 16747, 16693, 16640, 16586, 16531, 16477,
+ 16423, 16368, 16314, 16259, 16204, 16149, 16094, 16039,
+ 15984, 15929, 15873, 15818, 15762, 15706, 15650, 15595,
+ 15538, 15482, 15426, 15370, 15313, 15256, 15200, 15143,
+ 15086, 15029, 14972, 14914, 14857, 14800, 14742, 14684,
+ 14627, 14569, 14511, 14453, 14395, 14336, 14278, 14220,
+ 14161, 14103, 14044, 13985, 13926, 13867, 13808, 13749,
+ 13689, 13630, 13570, 13511, 13451, 13391, 13332, 13272,
+ 13212, 13151, 13091, 13031, 12971, 12910, 12849, 12789,
+ 12728, 12667, 12606, 12545, 12484, 12423, 12362, 12300,
+ 12239, 12177, 12116, 12054, 11992, 11930, 11868, 11806,
+ 11744, 11682, 11620, 11558, 11495, 11433, 11370, 11307,
+ 11245, 11182, 11119, 11056, 10993, 10930, 10867, 10803,
+ 10740, 10677, 10613, 10550, 10486, 10422, 10358, 10295,
+ 10231, 10167, 10103, 10039, 9974, 9910, 9846, 9781,
+ 9717, 9652, 9588, 9523, 9458, 9394, 9329, 9264,
+ 9199, 9134, 9069, 9003, 8938, 8873, 8808, 8742,
+ 8677, 8611, 8546, 8480, 8414, 8348, 8283, 8217,
+ 8151, 8085, 8019, 7953, 7886, 7820, 7754, 7688,
+ 7621, 7555, 7488, 7422, 7355, 7289, 7222, 7155,
+ 7088, 7022, 6955, 6888, 6821, 6754, 6687, 6620,
+ 6553, 6485, 6418, 6351, 6283, 6216, 6149, 6081,
+ 6014, 5946, 5879, 5811, 5743, 5676, 5608, 5540,
+ 5472, 5404, 5337, 5269, 5201, 5133, 5065, 4997,
+ 4928, 4860, 4792, 4724, 4656, 4587, 4519, 4451,
+ 4382, 4314, 4246, 4177, 4109, 4040, 3972, 3903,
+ 3834, 3766, 3697, 3629, 3560, 3491, 3422, 3354,
+ 3285, 3216, 3147, 3078, 3009, 2941, 2872, 2803,
+ 2734, 2665, 2596, 2527, 2458, 2389, 2320, 2251,
+ 2182, 2112, 2043, 1974, 1905, 1836, 1767, 1697,
+ 1628, 1559, 1490, 1421, 1351, 1282, 1213, 1144,
+ 1074, 1005, 936, 867, 797, 728, 659, 589,
+ 520, 451, 381, 312, 243, 173, 104, 35
+};
+
+const Word16 edct_table_128_fx[128] = /*Q16 */
+{
+ 19483, 19480, 19474, 19466, 19454, 19439, 19422, 19401,
+ 19378, 19351, 19322, 19290, 19255, 19217, 19176, 19132,
+ 19086, 19036, 18984, 18928, 18870, 18809, 18746, 18679,
+ 18610, 18537, 18462, 18385, 18304, 18221, 18135, 18046,
+ 17954, 17860, 17763, 17664, 17561, 17457, 17349, 17239,
+ 17126, 17011, 16893, 16773, 16650, 16524, 16396, 16266,
+ 16133, 15998, 15860, 15720, 15578, 15433, 15286, 15137,
+ 14985, 14831, 14675, 14516, 14356, 14193, 14028, 13861,
+ 13692, 13521, 13348, 13173, 12996, 12816, 12635, 12452,
+ 12268, 12081, 11892, 11702, 11510, 11316, 11121, 10924,
+ 10725, 10524, 10322, 10119, 9914, 9707, 9499, 9290,
+ 9079, 8867, 8653, 8438, 8222, 8005, 7786, 7566,
+ 7345, 7123, 6900, 6676, 6451, 6225, 5998, 5770,
+ 5541, 5312, 5081, 4850, 4618, 4385, 4152, 3918,
+ 3684, 3449, 3213, 2977, 2741, 2504, 2266, 2029,
+ 1791, 1552, 1314, 1075, 837, 598, 359, 120
+};
+
+const Word16 edct_table_160_fx[160] = /*Q16 */
+{
+ 18426, 18425, 18421, 18416, 18409, 18400, 18389, 18377,
+ 18362, 18346, 18329, 18309, 18288, 18265, 18240, 18214,
+ 18185, 18155, 18123, 18090, 18055, 18018, 17979, 17938,
+ 17896, 17852, 17806, 17759, 17710, 17659, 17607, 17552,
+ 17497, 17439, 17380, 17319, 17256, 17192, 17126, 17058,
+ 16989, 16918, 16846, 16772, 16696, 16619, 16540, 16459,
+ 16377, 16293, 16208, 16121, 16033, 15943, 15851, 15758,
+ 15664, 15568, 15470, 15371, 15271, 15169, 15065, 14960,
+ 14854, 14746, 14637, 14527, 14415, 14301, 14186, 14070,
+ 13953, 13834, 13714, 13592, 13469, 13345, 13220, 13093,
+ 12965, 12836, 12706, 12574, 12441, 12307, 12172, 12036,
+ 11898, 11759, 11620, 11479, 11337, 11193, 11049, 10904,
+ 10758, 10610, 10462, 10312, 10162, 10011, 9858, 9705,
+ 9551, 9395, 9239, 9082, 8925, 8766, 8606, 8446,
+ 8285, 8123, 7960, 7797, 7632, 7467, 7301, 7135,
+ 6968, 6800, 6632, 6463, 6293, 6122, 5952, 5780,
+ 5608, 5435, 5262, 5089, 4915, 4740, 4565, 4389,
+ 4214, 4037, 3861, 3684, 3506, 3328, 3150, 2972,
+ 2793, 2614, 2435, 2256, 2076, 1896, 1716, 1536,
+ 1356, 1175, 994, 814, 633, 452, 271, 90
+};
+
+const Word16 edct_table_40_fx[40] = /*Q16 */
+{
+ 26049, 26009, 25928, 25808, 25648, 25448, 25210, 24932,
+ 24616, 24262, 23870, 23442, 22977, 22477, 21943, 21375,
+ 20773, 20140, 19475, 18781, 18058, 17306, 16528, 15725,
+ 14897, 14047, 13174, 12282, 11370, 10441, 9496, 8536,
+ 7563, 6578, 5584, 4580, 3570, 2554, 1534, 512
+};
+
+const Word16 edct_table_20_fx[20] = /*Q16 */
+{
+ 30939, 30749, 30368, 29801, 29049, 28119, 27015, 25745,
+ 24316, 22737, 21018, 19169, 17202, 15129, 12963, 10717,
+ 8405, 6041, 3639, 1216
+};
+
+
+const Word16 edct_table_64_fx[] =/*Q16 */
+{
+ 23167, 23153, 23125, 23083, 23027, 22958, 22874, 22777,
+ 22666, 22542, 22403, 22252, 22087, 21908, 21717, 21512,
+ 21295, 21064, 20821, 20565, 20297, 20017, 19725, 19420,
+ 19105, 18777, 18438, 18089, 17728, 17356, 16975, 16582,
+ 16180, 15769, 15347, 14917, 14477, 14029, 13572, 13107,
+ 12634, 12154, 11666, 11171, 10670, 10162, 9648, 9128,
+ 8603, 8072, 7537, 6997, 6453, 5905, 5353, 4798,
+ 4241, 3681, 3118, 2554, 1988, 1421, 853, 284
+};
+
+
+const Word16 edct_table_200_fx[] =/*Q16 */
+{
+ 17427, 17426, 17423, 17420, 17416, 17411, 17404, 17397,
+ 17388, 17378, 17368, 17356, 17343, 17329, 17314, 17298,
+ 17281, 17262, 17243, 17223, 17201, 17179, 17155, 17131,
+ 17105, 17079, 17051, 17022, 16992, 16961, 16929, 16896,
+ 16862, 16827, 16791, 16754, 16716, 16676, 16636, 16595,
+ 16553, 16509, 16465, 16420, 16373, 16326, 16278, 16228,
+ 16178, 16126, 16074, 16021, 15966, 15911, 15855, 15797,
+ 15739, 15680, 15620, 15558, 15496, 15433, 15369, 15304,
+ 15238, 15171, 15103, 15035, 14965, 14894, 14823, 14751,
+ 14677, 14603, 14528, 14452, 14375, 14297, 14218, 14139,
+ 14058, 13977, 13895, 13812, 13728, 13643, 13558, 13471,
+ 13384, 13296, 13207, 13117, 13027, 12935, 12843, 12750,
+ 12657, 12562, 12467, 12371, 12274, 12177, 12078, 11979,
+ 11880, 11779, 11678, 11576, 11473, 11370, 11266, 11161,
+ 11055, 10949, 10843, 10735, 10627, 10518, 10409, 10299,
+ 10188, 10076, 9964, 9852, 9739, 9625, 9510, 9395,
+ 9280, 9164, 9047, 8930, 8812, 8694, 8575, 8455,
+ 8335, 8215, 8094, 7973, 7851, 7728, 7605, 7482,
+ 7358, 7234, 7109, 6984, 6858, 6732, 6606, 6479,
+ 6352, 6224, 6096, 5967, 5839, 5710, 5580, 5450,
+ 5320, 5190, 5059, 4928, 4796, 4664, 4532, 4400,
+ 4268, 4135, 4002, 3868, 3735, 3601, 3467, 3333,
+ 3198, 3064, 2929, 2794, 2659, 2523, 2388, 2252,
+ 2116, 1980, 1844, 1708, 1572, 1436, 1299, 1163,
+ 1026, 889, 753, 616, 479, 342, 205, 68
+};
+
+const Word16 edct_table_240_fx[] =/*Q16 */
+{
+ 16650, 16650, 16648, 16646, 16643, 16640, 16635, 16630,
+ 16625, 16618, 16611, 16603, 16595, 16585, 16575, 16565,
+ 16553, 16541, 16528, 16515, 16501, 16486, 16470, 16454,
+ 16437, 16419, 16401, 16381, 16362, 16341, 16320, 16298,
+ 16275, 16252, 16228, 16203, 16178, 16151, 16125, 16097,
+ 16069, 16040, 16010, 15980, 15949, 15918, 15885, 15852,
+ 15819, 15784, 15749, 15713, 15677, 15640, 15602, 15564,
+ 15525, 15485, 15445, 15404, 15362, 15320, 15277, 15233,
+ 15189, 15144, 15098, 15052, 15005, 14957, 14909, 14860,
+ 14811, 14761, 14710, 14659, 14607, 14554, 14501, 14447,
+ 14392, 14337, 14282, 14225, 14168, 14111, 14053, 13994,
+ 13934, 13874, 13814, 13753, 13691, 13629, 13566, 13502,
+ 13438, 13374, 13309, 13243, 13176, 13109, 13042, 12974,
+ 12905, 12836, 12767, 12696, 12626, 12554, 12482, 12410,
+ 12337, 12264, 12190, 12115, 12040, 11965, 11889, 11812,
+ 11735, 11657, 11579, 11501, 11422, 11342, 11262, 11182,
+ 11101, 11019, 10937, 10855, 10772, 10689, 10605, 10521,
+ 10436, 10351, 10265, 10179, 10093, 10006, 9919, 9831,
+ 9743, 9654, 9565, 9476, 9386, 9296, 9205, 9114,
+ 9023, 8931, 8839, 8746, 8653, 8560, 8466, 8372,
+ 8278, 8183, 8088, 7993, 7897, 7801, 7704, 7608,
+ 7511, 7413, 7315, 7217, 7119, 7020, 6921, 6822,
+ 6723, 6623, 6523, 6422, 6321, 6221, 6119, 6018,
+ 5916, 5814, 5712, 5609, 5507, 5404, 5300, 5197,
+ 5093, 4990, 4885, 4781, 4677, 4572, 4467, 4362,
+ 4257, 4151, 4046, 3940, 3834, 3728, 3622, 3515,
+ 3408, 3302, 3195, 3088, 2981, 2873, 2766, 2658,
+ 2551, 2443, 2335, 2227, 2119, 2011, 1903, 1795,
+ 1686, 1578, 1469, 1361, 1252, 1143, 1035, 926,
+ 817, 708, 599, 490, 381, 272, 163, 54
+};
+
+const Word16 edct_table_256_fx[] =/*Q16 */
+{
+ 16384, 16383, 16382, 16380, 16378, 16375, 16371, 16367,
+ 16362, 16356, 16350, 16343, 16336, 16328, 16319, 16310,
+ 16300, 16290, 16278, 16267, 16254, 16242, 16228, 16214,
+ 16199, 16184, 16168, 16151, 16134, 16116, 16098, 16079,
+ 16059, 16039, 16018, 15997, 15975, 15952, 15929, 15905,
+ 15881, 15856, 15830, 15804, 15777, 15750, 15722, 15693,
+ 15664, 15634, 15604, 15573, 15541, 15509, 15476, 15443,
+ 15409, 15375, 15340, 15304, 15268, 15231, 15194, 15156,
+ 15117, 15078, 15039, 14999, 14958, 14917, 14875, 14832,
+ 14789, 14746, 14702, 14657, 14612, 14566, 14520, 14473,
+ 14426, 14378, 14329, 14280, 14231, 14181, 14130, 14079,
+ 14027, 13975, 13922, 13869, 13815, 13761, 13706, 13651,
+ 13595, 13538, 13481, 13424, 13366, 13308, 13249, 13190,
+ 13130, 13069, 13008, 12947, 12885, 12823, 12760, 12697,
+ 12633, 12569, 12504, 12439, 12373, 12307, 12240, 12173,
+ 12106, 12038, 11969, 11901, 11831, 11762, 11691, 11621,
+ 11550, 11478, 11406, 11334, 11261, 11188, 11114, 11040,
+ 10965, 10891, 10815, 10740, 10663, 10587, 10510, 10433,
+ 10355, 10277, 10198, 10119, 10040, 9961, 9881, 9800,
+ 9719, 9638, 9557, 9475, 9393, 9310, 9227, 9144,
+ 9061, 8977, 8892, 8808, 8723, 8638, 8552, 8466,
+ 8380, 8293, 8206, 8119, 8032, 7944, 7856, 7768,
+ 7679, 7590, 7501, 7411, 7321, 7231, 7141, 7050,
+ 6960, 6868, 6777, 6685, 6593, 6501, 6409, 6316,
+ 6223, 6130, 6037, 5943, 5850, 5756, 5661, 5567,
+ 5472, 5377, 5282, 5187, 5092, 4996, 4900, 4804,
+ 4708, 4611, 4515, 4418, 4321, 4224, 4127, 4030,
+ 3932, 3835, 3737, 3639, 3541, 3442, 3344, 3246,
+ 3147, 3048, 2949, 2851, 2751, 2652, 2553, 2454,
+ 2354, 2255, 2155, 2055, 1956, 1856, 1756, 1656,
+ 1556, 1456, 1356, 1255, 1155, 1055, 954, 854,
+ 754, 653, 553, 452, 352, 251, 151, 50
+};
+
+const Word16 edct_table_400_fx[] =/*Q16 */
+{
+ 29308, 29308, 29307, 29306, 29304, 29302, 29299, 29296,
+ 29292, 29288, 29284, 29279, 29273, 29267, 29261, 29254,
+ 29247, 29239, 29231, 29223, 29214, 29204, 29194, 29184,
+ 29173, 29162, 29150, 29138, 29125, 29112, 29099, 29085,
+ 29070, 29055, 29040, 29024, 29008, 28991, 28974, 28957,
+ 28939, 28920, 28901, 28882, 28862, 28842, 28821, 28800,
+ 28779, 28757, 28734, 28711, 28688, 28664, 28640, 28615,
+ 28590, 28565, 28539, 28512, 28485, 28458, 28430, 28402,
+ 28373, 28344, 28315, 28285, 28255, 28224, 28192, 28161,
+ 28129, 28096, 28063, 28030, 27996, 27962, 27927, 27892,
+ 27856, 27820, 27784, 27747, 27710, 27672, 27634, 27595,
+ 27556, 27517, 27477, 27437, 27396, 27355, 27313, 27272,
+ 27229, 27186, 27143, 27100, 27055, 27011, 26966, 26921,
+ 26875, 26829, 26782, 26736, 26688, 26640, 26592, 26544,
+ 26495, 26445, 26395, 26345, 26294, 26243, 26192, 26140,
+ 26088, 26035, 25982, 25929, 25875, 25821, 25766, 25711,
+ 25655, 25600, 25543, 25487, 25430, 25372, 25315, 25256,
+ 25198, 25139, 25079, 25020, 24960, 24899, 24838, 24777,
+ 24715, 24653, 24591, 24528, 24465, 24401, 24337, 24273,
+ 24208, 24143, 24078, 24012, 23946, 23879, 23812, 23745,
+ 23677, 23609, 23541, 23472, 23403, 23334, 23264, 23194,
+ 23123, 23052, 22981, 22909, 22837, 22765, 22692, 22619,
+ 22546, 22472, 22398, 22324, 22249, 22174, 22098, 22023,
+ 21947, 21870, 21793, 21716, 21639, 21561, 21483, 21404,
+ 21326, 21246, 21167, 21087, 21007, 20927, 20846, 20765,
+ 20684, 20602, 20520, 20437, 20355, 20272, 20189, 20105,
+ 20021, 19937, 19852, 19768, 19682, 19597, 19511, 19425,
+ 19339, 19252, 19165, 19078, 18991, 18903, 18815, 18726,
+ 18638, 18549, 18459, 18370, 18280, 18190, 18100, 18009,
+ 17918, 17827, 17735, 17643, 17551, 17459, 17366, 17274,
+ 17181, 17087, 16994, 16900, 16805, 16711, 16616, 16521,
+ 16426, 16331, 16235, 16139, 16043, 15946, 15850, 15753,
+ 15656, 15558, 15461, 15363, 15265, 15166, 15068, 14969,
+ 14870, 14770, 14671, 14571, 14471, 14371, 14271, 14170,
+ 14069, 13968, 13867, 13765, 13663, 13562, 13459, 13357,
+ 13254, 13152, 13049, 12946, 12842, 12739, 12635, 12531,
+ 12427, 12323, 12218, 12113, 12008, 11903, 11798, 11693,
+ 11587, 11481, 11375, 11269, 11163, 11056, 10950, 10843,
+ 10736, 10628, 10521, 10414, 10306, 10198, 10090, 9982,
+ 9874, 9765, 9657, 9548, 9439, 9330, 9221, 9112,
+ 9002, 8892, 8783, 8673, 8563, 8453, 8342, 8232,
+ 8122, 8011, 7900, 7789, 7678, 7567, 7456, 7344,
+ 7233, 7121, 7010, 6898, 6786, 6674, 6562, 6450,
+ 6337, 6225, 6112, 6000, 5887, 5774, 5661, 5548,
+ 5435, 5322, 5209, 5096, 4982, 4869, 4755, 4642,
+ 4528, 4414, 4300, 4187, 4073, 3959, 3845, 3730,
+ 3616, 3502, 3388, 3273, 3159, 3044, 2930, 2815,
+ 2701, 2586, 2472, 2357, 2242, 2127, 2013, 1898,
+ 1783, 1668, 1553, 1438, 1323, 1208, 1093, 978,
+ 863, 748, 633, 518, 403, 288, 173, 58
+};
+
+const Word16 edct_table_320_16fx[320] =/*Q16 */
+{
+ 7747, 7747, 7747, 7746, 7746, 7745, 7744, 7742,
+ 7741, 7739, 7737, 7735, 7733, 7730, 7728, 7725,
+ 7722, 7719, 7716, 7712, 7708, 7704, 7700, 7696,
+ 7692, 7687, 7682, 7677, 7672, 7666, 7661, 7655,
+ 7649, 7643, 7637, 7630, 7623, 7617, 7610, 7602,
+ 7595, 7587, 7580, 7572, 7563, 7555, 7547, 7538,
+ 7529, 7520, 7511, 7501, 7492, 7482, 7472, 7462,
+ 7451, 7441, 7430, 7419, 7408, 7397, 7386, 7374,
+ 7362, 7350, 7338, 7326, 7314, 7301, 7288, 7275,
+ 7262, 7249, 7235, 7221, 7208, 7194, 7179, 7165,
+ 7150, 7136, 7121, 7106, 7091, 7075, 7060, 7044,
+ 7028, 7012, 6995, 6979, 6962, 6946, 6929, 6912,
+ 6894, 6877, 6859, 6842, 6824, 6806, 6787, 6769,
+ 6750, 6732, 6713, 6694, 6674, 6655, 6635, 6616,
+ 6596, 6576, 6556, 6535, 6515, 6494, 6473, 6452,
+ 6431, 6410, 6388, 6367, 6345, 6323, 6301, 6279,
+ 6257, 6234, 6211, 6189, 6166, 6143, 6119, 6096,
+ 6072, 6049, 6025, 6001, 5977, 5953, 5928, 5904,
+ 5879, 5854, 5829, 5804, 5779, 5753, 5728, 5702,
+ 5676, 5650, 5624, 5598, 5572, 5545, 5518, 5492,
+ 5465, 5438, 5411, 5383, 5356, 5328, 5301, 5273,
+ 5245, 5217, 5189, 5160, 5132, 5104, 5075, 5046,
+ 5017, 4988, 4959, 4930, 4900, 4871, 4841, 4811,
+ 4781, 4751, 4721, 4691, 4661, 4630, 4600, 4569,
+ 4538, 4508, 4477, 4446, 4414, 4383, 4352, 4320,
+ 4288, 4257, 4225, 4193, 4161, 4129, 4097, 4064,
+ 4032, 3999, 3967, 3934, 3901, 3868, 3835, 3802,
+ 3769, 3736, 3702, 3669, 3635, 3602, 3568, 3534,
+ 3500, 3466, 3432, 3398, 3364, 3330, 3295, 3261,
+ 3226, 3192, 3157, 3122, 3087, 3052, 3017, 2982,
+ 2947, 2912, 2877, 2841, 2806, 2771, 2735, 2699,
+ 2664, 2628, 2592, 2556, 2520, 2484, 2448, 2412,
+ 2376, 2340, 2304, 2267, 2231, 2194, 2158, 2121,
+ 2085, 2048, 2011, 1975, 1938, 1901, 1864, 1827,
+ 1790, 1753, 1716, 1679, 1642, 1605, 1567, 1530,
+ 1493, 1455, 1418, 1381, 1343, 1306, 1268, 1231,
+ 1193, 1156, 1118, 1080, 1043, 1005, 967, 930,
+ 892, 854, 816, 778, 740, 703, 665, 627,
+ 589, 551, 513, 475, 437, 399, 361, 323,
+ 285, 247, 209, 171, 133, 95, 57, 19
+};
+const Word16 edct_table_128_16fx[128] = /*Q15 */
+{
+ 9742, 9740, 9737, 9733, 9727, 9720, 9711, 9701,
+ 9689, 9676, 9661, 9645, 9627, 9608, 9588, 9566,
+ 9543, 9518, 9492, 9464, 9435, 9405, 9373, 9339,
+ 9305, 9269, 9231, 9192, 9152, 9110, 9067, 9023,
+ 8977, 8930, 8882, 8832, 8781, 8728, 8675, 8619,
+ 8563, 8505, 8447, 8386, 8325, 8262, 8198, 8133,
+ 8067, 7999, 7930, 7860, 7789, 7717, 7643, 7568,
+ 7492, 7415, 7337, 7258, 7178, 7097, 7014, 6931,
+ 6846, 6761, 6674, 6586, 6498, 6408, 6318, 6226,
+ 6134, 6040, 5946, 5851, 5755, 5658, 5560, 5462,
+ 5362, 5262, 5161, 5059, 4957, 4854, 4750, 4645,
+ 4539, 4433, 4327, 4219, 4111, 4002, 3893, 3783,
+ 3673, 3562, 3450, 3338, 3226, 3113, 2999, 2885,
+ 2771, 2656, 2541, 2425, 2309, 2193, 2076, 1959,
+ 1842, 1724, 1607, 1489, 1370, 1252, 1133, 1014,
+ 895, 776, 657, 538, 418, 299, 179, 60
+};
+const Word16 edct_table_160_16fx[160] =//Q15
+{
+ 9213, 9212, 9211, 9208, 9204, 9200, 9195, 9188,
+ 9181, 9173, 9164, 9155, 9144, 9132, 9120, 9107,
+ 9093, 9078, 9062, 9045, 9027, 9009, 8989, 8969,
+ 8948, 8926, 8903, 8880, 8855, 8830, 8803, 8776,
+ 8748, 8719, 8690, 8659, 8628, 8596, 8563, 8529,
+ 8495, 8459, 8423, 8386, 8348, 8309, 8270, 8230,
+ 8188, 8147, 8104, 8061, 8016, 7971, 7926, 7879,
+ 7832, 7784, 7735, 7686, 7635, 7584, 7533, 7480,
+ 7427, 7373, 7319, 7263, 7207, 7151, 7093, 7035,
+ 6976, 6917, 6857, 6796, 6735, 6673, 6610, 6547,
+ 6483, 6418, 6353, 6287, 6221, 6154, 6086, 6018,
+ 5949, 5880, 5810, 5739, 5668, 5597, 5525, 5452,
+ 5379, 5305, 5231, 5156, 5081, 5005, 4929, 4852,
+ 4775, 4698, 4620, 4541, 4462, 4383, 4303, 4223,
+ 4142, 4061, 3980, 3898, 3816, 3734, 3651, 3568,
+ 3484, 3400, 3316, 3231, 3146, 3061, 2976, 2890,
+ 2804, 2718, 2631, 2544, 2457, 2370, 2282, 2195,
+ 2107, 2019, 1930, 1842, 1753, 1664, 1575, 1486,
+ 1397, 1307, 1218, 1128, 1038, 948, 858, 768,
+ 678, 588, 497, 407, 317, 226, 136, 45
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Mean ISF vector for active signal (only for AMR-WB IO mode)
+ *----------------------------------------------------------------------------------*/
+
+const Word16 mean_isf_amr_wb_fx[M] =/*Qlog2(2.56)*/
+{
+ 738, 1326, 2336, 3578, 4596, 5662, 6711, 7730,
+ 8750, 9753,10705, 11728, 12833, 13971,15043, 4037
+};/*1.28f Q1*/
+
+/*----------------------------------------------------------------------------------*
+ * Mean ISF vector for SID frames (only in AMR-WB IO mode)
+ *----------------------------------------------------------------------------------*/
+
+const Word16 mean_isf_noise_amr_wb_fx[M] =/*Qlog2(2.56)*/
+{
+ 478, 1100, 2213, 3267, 4219, 5222, 6198, 7240,
+ 8229, 9153,10098, 11108, 12144, 13184,14165, 3803
+};/*14Q1*1.28*/
+
+/* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) */
+/*------------------------------------------------------*
+ * Indirection for 1st stage 1st split of 46 bit cb. :
+ The transmitted_index = indirect_dico1[found_index];
+ *------------------------------------------------------*/
+const Word16 Indirect_dico1[SIZE_BK1] = // Q0
+{
+ 2, 6, 18, 22, 34, 35, 38, 50,
+ 66, 67, 70, 82, 98, 99, 102, 130,
+ 131, 134, 146, 150, 162, 178, 194, 198,
+ 210, 226, 230, 242, 0, 1, 3, 4,
+ 5, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 19, 20, 21, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 36, 37, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 68, 69,
+ 71, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 100, 101, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114,
+ 115, 116, 117, 118, 119, 120, 121, 122,
+ 123, 124, 125, 126, 127, 128, 129, 132,
+ 133, 135, 136, 137, 138, 139, 140, 141,
+ 142, 143, 144, 145, 147, 148, 149, 151,
+ 152, 153, 154, 155, 156, 157, 158, 159,
+ 160, 161, 163, 164, 165, 166, 167, 168,
+ 169, 170, 171, 172, 173, 174, 175, 176,
+ 177, 179, 180, 181, 182, 183, 184, 185,
+ 186, 187, 188, 189, 190, 191, 192, 193,
+ 195, 196, 197, 199, 200, 201, 202, 203,
+ 204, 205, 206, 207, 208, 209, 211, 212,
+ 213, 214, 215, 216, 217, 218, 219, 220,
+ 221, 222, 223, 224, 225, 227, 228, 229,
+ 231, 232, 233, 234, 235, 236, 237, 238,
+ 239, 240, 241, 243, 244, 245, 246, 247,
+ 248, 249, 250, 251, 252, 253, 254, 255
+};
+
+/*----------------------------------------------------------------------------------*
+ * Initial LSF memory
+ *----------------------------------------------------------------------------------*/
+
+const Word16 lsf_init_fx[16] = /*14Q1*1.28*/
+{
+ 960, 1920, 2880, 3840, 4800, 5760, 6720, 7680, 8640, 9600, 10560, 11520, 12480, 13440, 14400, 15360
+};
+
+/*----------------------------------------------------------------------------------*
+ * Gaussian codebook
+ *----------------------------------------------------------------------------------*/
+
+/*table in Q12*/
+const Word16 gaus_dico_fx[190] =
+{
+ -399, -125, 523, -466, 305, -658, -809, 47,
+ -141, -171, -583, -259, 296, 1334, -285, -401,
+ -478, -418, 140, -540, 177, -1089, 130, -292,
+ 143, 492, -310, -862, -320, 388, 546, 84,
+ -1202, 107, 108, 340, 239, -130, 930, 342,
+ 153, -264, -763, -113, 387, -535, 83, -856,
+ -361, -421, 120, 396, -367, 640, 817, 222,
+ -1017, -82, -120, 890, 340, -384, 47, 339,
+ -505, -430, 161, 979, 890, -267, 104, 508,
+ -150, -194, 442, 193, 413, -24, 395, -43,
+ -217, 69, -398, 167, 116, -936, -95, 1466,
+ -435, 461, 862, -136, -94, 1311, -371, 68,
+ 134, -296, -156, -564, -48, -487, 647, 315,
+ 513, -101, -685, -318, -344, -644, -66, 851,
+ 414, -29, 509, 414, 502, 399, 557, 649,
+ -299, 750, 546, -756, -12, -365, 593, -707,
+ 394, -131, -375, -62, -914, -256, -424, 64,
+ 464, -1140, 280, 91, -83, -288, -550, 389,
+ 52, -1228, 6, -430, 74, 205, -478, -148,
+ -592, 282, -73, 1212, 42, 580, -334, 484,
+ -765, 443, 649, 271, -739, 375, 613, -460,
+ -208, 235, -120, -49, -311, 605, 875, 521,
+ 202, -506, -548, -1088, -43, -221, 673, -245,
+ -27, 469, 353, 53, 744, 275
+};
+
+const Word16 gaus_dico_swb_fx[256] =
+{
+ /*Q15 */
+ 709, 11759, -5333, -2701, 2397, -18, -4286, 2368,
+ -4576, -1584, -900, -940, 3676, 5441, -44, 2234,
+ -5698, 3082, -2671, 1666, -640, -3343, -1005, -1689,
+ 2048, 281, -3935, -3723, 5628, 385, -746, -3243,
+ -3332, -7228, -1748, -206, -5474, 2554, 2861, 3168,
+ 5039, 588, -508, -8167, 6549, -3433, 2187, -3666,
+ -5874, 2767, 8370, 1038, 6434, 6279, 625, 4030,
+ -1031, 1823, 9896, -1395, 2712, -1110, -742, 6142,
+ -4456, -10487, -144, -5104, 1968, -312, 6176, 2173,
+ 2334, -240, 2712, 7460, 2219, -3116, -56, 2770,
+ 5577, -1225, 770, 3557, 2246, 2322, 3077, 41,
+ 992, -4971, 441, -5039, 4913, 3811, 1142, -1283,
+ -6578, 4171, -1473, -3793, -5008, 1984, -1138, -1185,
+ 5646, 1014, -5118, 7141, 2656, -7241, -3538, 2337,
+ 7239, -504, -943, -10129, 702, -3811, -302, 2435,
+ 5090, 3744, 2335, -3904, -1401, -1662, -7256, 6484,
+ -6864, -5428, 1954, -7316, -1420, -1542, 5442, 311,
+ 3698, -1343, -2974, 8756, 324, -1903, 2580, 2635,
+ 4236, -1851, 3147, -772, -708, -3830, 2601, -1889,
+ -3444, -762, 3939, 3206, -7406, -837, -1167, -438,
+ 3707, -1015, -7472, 1849, 4277, 1459, -3047, -3760,
+ 740, -7134, -3753, -3092, 209, -12121, 1398, 2266,
+ 2505, -7974, -1121, -3481, -5644, 1329, 4532, 958,
+ 5311, -4258, -3195, -1769, -3055, 4399, -15, 10182,
+ 4503, 1912, -1574, 5054, -3163, 4881, -5364, 1925,
+ -1205, -6432, 2305, -8917, -1422, 514, -3001, 3928,
+ 2321, 360, -355, 1477, -3492, -4570, 1913, 2772,
+ -1380, -5161, 3812, 2614, 2204, -3135, 1244, -3066,
+ -4446, -6389, 4899, -5250, 1372, 1999, 1122, 5312,
+ 1310, -1189, -3310, 6403, 3818, 7734, 1620, -8533,
+ 706, 7498, -4472, 1272, -949, 3203, -4427, -2855,
+ 4419, 2283, 6410, 2584, -3397, -3382, -2976, -48,
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * CLDFB tables
+ *----------------------------------------------------------------------------------*/
+
+const Word16 freqTable[2] = {20, 40}; // Q0
+
+/* SNR: 109.44, PHASE: 3.500000000000000 */
+
+/* SNR: 109.44, PHASE: 3.500000000000000 */
+
+const Word32 CLDFB80_10_fx[100] = // q = 30
+{
+ 3584, -2501, -707, 157, -1170, -1038,
+-11, -1944, -1380, 1837, 14727, -9096,
+-1691, -267, 3897, -4705, 419, 4651,
+5275, -6639, -243747, -72521, -17071, 14831,
+-23632, -38285, 18452, -20885, -6245, -281515,
+-1070487, -153329, -20195, -4338, -209848, 194011,
+24972, -5106, -34468, 1151402, -2164680, -832327,
+376720, 1686598, 1844777, 1697325, 2356308, 3037447,
+3248821, 1779296, -1533240, -1713947, 833816, 2751563,
+2421812, 284255, -3540922, -6991555, -10248264, -14642952,
+20031906, 26043234, 34417552, 45928496, 60756732, 78698864,
+98151832, 116245496, 129823136, 136344976, 134601568, 122059576,
+95304000, 53433792, -3371365, -74987256, -160511088, -258343120,
+-366360320, -481533344, 599091264, 714631872, 823505600, 920768896,
+1001735168, 1062249792, 1100603392, 1116473216, 1114030976, 1091249536,
+1031959808, 939413760, 835792512, 727712064, 614651648, 499141824,
+382288320, 266885408, 148867680, 44714176
+};
+
+
+/* SNR: 292.49, PHASE: 2.000000000000000 */
+const Word32 CLDFB80_16_fx[160] = // q = 30
+{ 592, -824, -251, 104, 64, -2,
+-19, 2357, 3222, -18, -2, 75,
+37, -82, -596, 808, 2242, -3035,
+-755, 254, 126, -435, 107, -19350,
+26445, -100, 482, -149, -91, 247,
+2196, -3062, -344117, -158537, -67240, -47926,
+-21715, 16231, 6227, 48320, 46494, 5449,
+17932, -33783, -26258, -13467, -97911, -469416,
+-1317171, -563405, -199456, -118497, -43264, 11679,
+-61886, 64706, -248886, 55869, 3768, 67211,
+64791, 39611, 345778, 1796799, -2314105, -1658358,
+-815220, -115680, 761413, 1616443, 1931089, 1230669,
+1712206, 1949652, 2418775, 2970521, 3179526, 3272216,
+2739046, 1383591, -1186345, -2091284, -1594461, -20541,
+1561481, 2685864, 2822045, 2243697, 1007270, -1321111,
+-3774214, -5979353, -7970747, -10025660, -12576468, -15588057,
+19092548, 22464968, 26489252, 31480652, 37681832, 45115060,
+53868456, 63884792, 75139712, 87185504, 99355152, 110921760,
+121117896, 129158840, 134480400, 136595408, 135565040, 130704096,
+120827352, 105296200, 83827480, 56486836, 23319760, -15680647,
+-60454808, -110775264, -166285472, -226570624, -291114656, -359358976,
+-430528992, -503583200, 577127680, 650096768, 721690560, 790528896,
+855345280, 915113088, 968648896, 1014713216, 1052549440, 1081848192,
+1102232576, 1113723648, 1117499392, 1114694144, 1104247168, 1084392960,
+1047294336, 993703296, 933123072, 868665920, 802559168, 734628416,
+664562240, 593135168, 520952544, 448011680, 375024864, 302909728,
+230463232, 156264608, 85568040, 29877076
+};
+
+
+/* SNR: 89.77, PHASE: 1.500000000000000 */
+const Word32 CLDFB80_20_fx[200] = // q = 30
+{ 1767, -5032, -88, -196, 26, 203,
+-254, -755, -8, 5224, 7569, 3,
+161, -101, 462, -85, -115, 1651,
+-2694, 4755, 4946, -22236, -524, -658,
+65, 469, -402, -1021, 719, -9362,
+12273, -828, -312, 170, -1089, 201,
+407, -7058, 12038, -3893, -327043, -222151,
+-35479, -70712, -44739, -22286, -4950, 10391,
+-6975, 55398, 27635, -7373, 3144, -22481,
+-20586, -25326, -30793, 63871, -118589, -531211,
+-1262671, -706692, -140675, -191397, -107627, -49946,
+-20212, 30609, -145958, 302172, -516943, 139838,
+-27637, 62099, 52144, 58317, 81974, -160536,
+375017, 1963206, -2140127, -2009648, -925313, -652848,
+-36271, 664400, 1339893, 1799274, 1945125, 831665,
+1777056, 1828829, 2078398, 2585601, 2993432, 3154609,
+3289693, 3034094, 2356141, 1146722, -993260, -1911082,
+-2021484, -1182252, 157141, 1427332, 2466905, 2979250,
+2692828, 2193128, 1283653, -616499, -2589952, -4472529,
+-6187298, -7776617, -9380603, -11192438, -13438549, -15899665,
+18725886, 21392202, 24336266, 27874318, 32044188, 37006492,
+42749912, 49318540, 56747120, 64938688, 73960840, 83528888,
+93302528, 102923904, 112017456, 120184144, 127010856, 132191136,
+135478896, 136610544, 135791440, 132663544, 126439184, 116783968,
+103416816, 86239880, 65299188, 40633116, 12229525, -19893306,
+-55715672, -95119752, -137902624, -183892768, -232841840, -284483936,
+-338536576, -394642624, -452297696, -510956224, 569805312, 628294144,
+686151296, 742695360, 797209408, 849073920, 897777728, 942743488,
+983299712, 1018874944, 1049145600, 1073975296, 1093176448, 1106582656,
+1114420736, 1117424512, 1116238848, 1110577792, 1099271424, 1081958528,
+1052270720, 1010577920, 964128448, 914037760, 862118336, 809238464,
+755241024, 699830528, 643231744, 585949312, 528205504, 469954944,
+411440896, 353300032, 295721536, 237791168, 178588864, 119772248,
+66882256, 25081918
+};
+
+
+/* SNR: 89.29, PHASE: 0.833333333333333 */
+const Word32 CLDFB80_30_fx[300] = // q = 30
+{ -298, 3584, 1941, -855, -2501, -18,
+108, -707, 31, 15, 157, 303,
+46, -1170, 5206, 7621, -1038, 39,
+476, -11, -29, -11, -1944, 58,
+-3, -1380, -660, 1053, 1837, -2898,
+-12992, 14727, 8112, -3476, -9096, -22,
+265, -1691, 46, -32, -267, 593,
+210, 3897, 9064, -12976, -4705, -177,
+-1102, 419, 158, 60, 4651, -142,
+-11, 5275, 2753, -4425, -6639, 19639,
+-341195, -243747, -157895, -76329, -72521, -65719,
+-49275, -17071, -21325, -4817, 14831, 27866,
+-1522, -23632, 5019, -51348, -38285, -878,
+59536, 18452, -11251, -36822, -20885, -26546,
+-28596, -6245, -16613, -92408, -281515, -679650,
+-1089989, -1070487, -687312, -252030, -153329, -178007,
+-122647, -20195, -41359, -29533, -4338, 53191,
+-112253, -209848, 617831, -803951, 194011, 106901,
+-106999, 24972, 64775, 70954, -5106, 66493,
+77725, -34468, 24005, 399486, 1151402, 2091330,
+-1945866, -2164680, -1871142, -1133490, -832327, -560635,
+-144700, 376720, 793103, 1258629, 1686598, 1843272,
+1942367, 1844777, 286874, 1790714, 1697325, 1882734,
+2048236, 2356308, 2670961, 2960784, 3037447, 3187788,
+3282834, 3248821, 2972461, 2561469, 1779296, 779690,
+-670109, -1533240, -2023874, -2068454, -1713947, -979306,
+-79112, 833816, 1606493, 2311180, 2751563, 2948543,
+2758276, 2421812, 2144318, 1669907, 284255, -925661,
+-2240403, -3540922, -4767759, -5909822, -6991555, -8035796,
+-9103931, -10248264, -11549851, -13052389, -14642952, -16334399,
+18220558, 20031906, 21872604, 23814234, 26043234, 28516756,
+31295850, 34417552, 37909524, 41736344, 45928496, 50500180,
+55453996, 60756732, 66352956, 72392624, 78698864, 85151696,
+91671536, 98151832, 104484224, 110553528, 116245496, 121424144,
+125981624, 129823136, 132872256, 135069696, 136344976, 136548112,
+135995744, 134601568, 131846392, 127706624, 122059576, 114818808,
+105909512, 95304000, 83010216, 69049472, 53433792, 36159948,
+17222988, -3371365, -25594396, -49478012, -74987256, -102019216,
+-130543792, -160511088, -191851984, -224489536, -258343120, -293333280,
+-329374368, -366360320, -404158112, -442603456, -481533344, -520813312,
+560055680, 599091264, 637996480, 676579264, 714631872, 751940864,
+788293056, 823505600, 857424640, 889902848, 920768896, 949826944,
+976873792, 1001735168, 1024295104, 1044475456, 1062249792, 1077572608,
+1090377088, 1100603392, 1108260608, 1113474048, 1116473216, 1117510400,
+1116725248, 1114030976, 1109119488, 1101598848, 1091249536, 1078932736,
+1059134272, 1031959808, 1003169408, 972174976, 939413760, 905472960,
+870845632, 835792512, 800328576, 764335744, 727712064, 690466496,
+652724672, 614651648, 576357376, 537862912, 499141824, 460206112,
+421184800, 382288320, 343676096, 305305440, 266885408, 228014720,
+188521408, 148867680, 110353960, 74971128, 44714176, 18455688
+};
+
+
+const Word32 CLDFB80_32_fx[320] = // q = 30
+{
+ -1093, 2020, -1500, 75, -3259, -200,
+2, 86, -307, -6, -372, -406,
+686, 39, -1685, 4713, 6814, -1488,
+47, 778, -40, -130, 24, -872,
+225, -5, -116, -556, -123, -751,
+1334, -5815, -17696, 8208, -6989, 239,
+-11912, -669, 1, 206, -738, 0,
+-579, -811, 1617, 569, 3828, 10109,
+-14335, -4601, -628, -1935, 180, 186,
+-69, 2086, -538, 14, 408, 1524,
+585, 3601, -4502, 26170, -348871, -274413,
+-191283, -101650, -55023, -71745, -57839, -39470,
+-16489, -17154, -4618, 1542, 27531, -4838,
+-24078, -6041, -61576, -45939, -4350, 52992,
+-21467, -30551, -47624, -16879, -16327, -28526,
+-30774, 45781, -47861, -103961, -321282, -704888,
+-1065517, -1123685, -707166, -371532, -86309, -196314,
+-147630, -95796, -26567, -30201, -12085, -23646,
+30175, -133297, -186726, 644643, -823106, 165914,
+127129, -77847, 76139, 59764, 84597, 13696,
+44921, 72597, 82827, -180230, 163871, 385660,
+1272552, 2097220, -1940583, -2216918, -1963534, -1312195,
+-811283, -684818, -332127, 81208, 566324, 995811,
+1374732, 1743252, 1885233, 1944746, 1791356, 230889,
+1776037, 1693755, 1848743, 2021967, 2237951, 2554532,
+2866858, 3010232, 3111818, 3235821, 3289505, 3179984,
+2912034, 2438977, 1724392, 733947, -625866, -1486531,
+-1958890, -2094028, -1863598, -1255187, -454123, 425746,
+1212702, 1901282, 2517750, 2869908, 2908450, 2719155,
+2384774, 2140992, 1717492, 398307, -731735, -1939480,
+-3196994, -4359654, -5453402, -6492968, -7485701, -8462297,
+-9485345, -10586349, -11872517, -13293064, -14799378, -16391634,
+18159074, 19878216, 21572990, 23372214, 25384474, 27638258,
+30127980, 32911950, 36012916, 39421380, 43135868, 47172528,
+51552328, 56259572, 61272356, 66530936, 72196904, 78102488,
+84136944, 90243120, 96340328, 102334376, 108124720, 113633800,
+118743656, 123354504, 127384760, 130768192, 133428752, 135331936,
+136411184, 136532064, 136012736, 134791376, 132367184, 128735088,
+123803096, 117494272, 109734136, 100486232, 89749032, 77539936,
+63866580, 48743548, 32160198, 14114131, -5387419, -26313940,
+-48704924, -72531920, -97696000, -124178280, -151940320, -180929216,
+-211078752, -242327632, -274608448, -307853568, -341987136, -376916512,
+-412518528, -448658976, -485200704, -522047808, 558838528, 595432000,
+631934592, 668176768, 703995904, 739213504, 773652800, 807151808,
+839574912, 870801792, 900704320, 929133248, 955922048, 980906240,
+1003949120, 1024962240, 1043881152, 1060686784, 1075342592, 1087794688,
+1097989248, 1105913344, 1111637504, 1115325568, 1117191552, 1117410816,
+1116024960, 1112890624, 1107711872, 1100166016, 1090143104, 1078585600,
+1060024128, 1034545088, 1007817280, 979127552, 948772416, 917237312,
+884973248, 852271488, 819225472, 785777536, 751820160, 717295872,
+682246976, 646793792, 611070144, 575157504, 539069056, 502781984,
+466300064, 429718016, 393203360, 356913536, 320878656, 284927936,
+248740064, 212036736, 174863904, 137843808, 102263632, 69872776,
+42173520, 17586372
+};
+
+
+/* SNR: 81.55, PHASE: 0.500000000000000 */
+const Word32 CLDFB80_40_fx[400] = // q = 30
+{
+-4459, -419, -3627, 1424, -337, -2077,
+303, 18, 81, 159, -711, 9,
+12, -289, -782, 599, -26, 261,
+-439, 2799, 3758, -185, 230, -43,
+682, -21, -75, -29, -55, -1950,
+416, 56, 16, 233, 887, -479,
+680, -2718, -569, -16448, -33103, -1653,
+-16424, 6275, -1401, -7536, 1256, 82,
+202, 378, -1703, -5, -27, -665,
+-1194, 1295, -18, 118, -11445, 11396,
+-15922, 16043, 175, 78, -1655, 102,
+374, 132, 161, 4663, -995, -137,
+-67, -970, -4393, 2058, -3082, 11739,
+-993, 52507, -372470, -339964, -238020, -154668,
+-91227, -39704, -68193, -63466, -52270, -36721,
+-12972, -20431, -6925, 7426, -2361, 29241,
+920, -11369, 13936, -42084, -90219, 4460,
+-7456, 295, 60570, -36066, -9836, -23630,
+-40550, -22839, -11573, -27317, -28142, -21799,
+74247, -37443, -94761, -175261, -418504, -781461,
+-995765, -1274142, -822204, -644197, -320592, -79371,
+-211045, -170432, -131251, -90676, -8615, -38865,
+-25806, 10490, -21115, 43834, -93771, -212052,
+-80067, 687824, -841077, -28319, 196054, 89800,
+-98757, 81413, 22561, 71310, 76947, -1234,
+38817, 69237, 75947, 74313, -220677, 108139,
+388007, 614410, 1602908, 2104013, -1945962, -2345233,
+-2073811, -1788974, -1237042, -801097, -773094, -511061,
+-205272, 126459, 548962, 854332, 1215260, 1516757,
+1754373, 1867886, 1938796, 1938332, 1525725, 104199,
+1696967, 1687208, 1745905, 1910502, 2033618, 2194668,
+2472078, 2712787, 2937869, 3012596, 3095693, 3204093,
+3274808, 3283756, 3148592, 2939051, 2641685, 2031332,
+1549503, 597843, -490013, -1328870, -1713436, -2059616,
+-2084878, -1903964, -1464478, -873102, -195311, 513856,
+1135793, 1697317, 2228107, 2629045, 2909611, 2926214,
+2785543, 2569874, 2293850, 2134485, 1852516, 752397,
+-164140, -1082527, -2067571, -3082101, -4010647, -4913513,
+-5770452, -6592737, -7388101, -8166445, -8966356, -9806266,
+-10700961, -11733450, -12861255, -14030459, -15273330, -16566203,
+17977196, 19420796, 20683474, 22109952, 23560036, 25167814,
+26942868, 28845886, 30930688, 33206692, 35686848, 38368864,
+41237952, 44313740, 47594052, 51099240, 54815852, 58726668,
+62834600, 67067844, 71610536, 76321632, 81103048, 85964624,
+90855304, 95735248, 100552568, 105257896, 109812680, 114164760,
+118253480, 122029112, 125449296, 128468360, 131068744, 133194984,
+134844544, 135983552, 136548480, 136476080, 136056288, 135290432,
+133727152, 131405624, 128303264, 124356992, 119537688, 113797504,
+107116320, 99479544, 90889712, 81356080, 70886368, 59482072,
+47150368, 33884192, 19681098, 4546190, -11521655, -28482206,
+-46395036, -65246120, -84945856, -105504280, -126897840, -149107856,
+-172107808, -195862240, -220341504, -245510512, -271335616, -297782912,
+-324814976, -352387008, -380449280, -408931776, -437767552, -466890752,
+-496221408, -525752320, 555187200, 584450368, 613710272, 642840512,
+671780800, 700438528, 728721728, 756541312, 783807872, 810444608,
+836384512, 861566464, 885927424, 909395008, 931888896, 953321728,
+973609216, 992677120, 1010468928, 1026949632, 1042084096, 1055868544,
+1068286464, 1079312512, 1088916480, 1097072128, 1103772032, 1109042176,
+1112948608, 1115590912, 1117080960, 1117511680, 1116923264, 1115280512,
+1112471040, 1108330880, 1102691712, 1095455872, 1086748672, 1077537920,
+1062688064, 1042243712, 1021432192, 999408768, 976158720, 951869952,
+926793472, 901173760, 875200384, 848982208, 822546624, 795860992,
+768868224, 741522368, 713812928, 685772416, 657463808, 628958848,
+600314432, 571556608, 542686272, 513690592, 484561600, 455329056,
+426060320, 396846880, 367771776, 338869952, 310096864, 281325184,
+252379520, 223109248, 193485184, 163693120, 134192648, 105710896,
+79151352, 55383672, 34725716, 14899882
+};
+
+
+/* SNR: 85.15, PHASE: 0.166666666666667 */
+const Word32 CLDFB80_60_fx[600] = // q = 30
+{ -11638, 1767, -122, 1628, -5032, -196,
+161, -88, -3545, 137, -196, 21,
+36, 26, 132, -1128, 203, 12,
+-29, -254, -97, -286, -755, 689,
+-55, -8, 215, -1583, 5224, -169,
+-595, 7569, -1361, 190, 3, -67,
+788, 161, -43, -20, -101, -32,
+-10, 462, -3064, 321, -85, 24,
+12, -115, 151, -968, 1651, -22,
+-258, -2694, -28, 68, 4755, -32803,
+-51846, 4946, -596, 6086, -22236, -388,
+578, -524, -12974, 673, -658, 65,
+91, 65, 314, -2699, 469, 12,
+-69, -402, -518, -689, -1021, 1669,
+-23, 719, 449, -2322, -9362, 9537,
+-13566, 12273, 3730, -157, -828, 61,
+-1978, -312, 206, 462, 170, 84,
+41, -1089, 7330, -768, 201, -60,
+-41, 407, -660, 3231, -7058, 161,
+771, 12038, 198, -1291, -3893, 106546,
+-387363, -327043, -319712, -213953, -222151, -158504,
+-105319, -35479, -59682, -66733, -70712, -61610,
+-55171, -44739, -31711, -9900, -22286, -19252,
+-9917, -4950, 14172, 3111, 10391, 26566,
+4086, -6975, -13332, -9892, 55398, -89244,
+-120822, 27635, -30751, -9363, -7373, 2810,
+49557, 3144, -15960, 10651, -22481, -39335,
+-43081, -20586, -29742, -8098, -25326, -28071,
+-28128, -30793, -15878, 36414, 63871, -51035,
+-98423, -118589, -196780, -380753, -531211, -867079,
+-924260, -1262671, -1211187, -909700, -706692, -590140,
+-387713, -140675, -90592, -207147, -191397, -163116,
+-139419, -107627, -77449, 8620, -49946, -36329,
+-21446, -20212, 13295, -23389, 30609, 24765,
+-73159, -145958, -228347, -136170, 302172, 622362,
+-742756, -516943, 79533, 208728, 139838, 68780,
+-69177, -27637, 72365, 6204, 62099, 78720,
+81230, 52144, -15436, 27781, 58317, 71170,
+74613, 81974, 55368, -164496, -160536, 180918,
+362005, 375017, 795458, 1461875, 1963206, 2095155,
+-1983049, -2140127, -2301661, -2078197, -2009648, -1702455,
+-1336746, -925313, -815553, -803613, -652848, -461551,
+-265137, -36271, 196856, 518314, 664400, 915382,
+1166217, 1339893, 1585569, 1738976, 1799274, 1890535,
+1933937, 1945125, 1923994, 1665861, 831665, 77564,
+1488037, 1777056, 1688417, 1721975, 1828829, 1937199,
+2017937, 2078398, 2252451, 2437196, 2585601, 2754365,
+2909842, 2993432, 3016599, 3074266, 3154609, 3219375,
+3265044, 3289693, 3277126, 3189837, 3034094, 2902602,
+2709099, 2356141, 1938986, 1632226, 1146722, 418214,
+-305018, -993260, -1403823, -1653092, -1911082, -2083225,
+-2096449, -2021484, -1849083, -1552144, -1182252, -764155,
+-310625, 157141, 627282, 1032601, 1427332, 1788414,
+2142931, 2466905, 2666629, 2856089, 2979250, 2902477,
+2810289, 2692828, 2523008, 2330296, 2193128, 2132550,
+2001086, 1283653, 592123, -15236, -616499, -1241115,
+-1897102, -2589952, -3235046, -3852858, -4472529, -5058432,
+-5630304, -6187298, -6725206, -7257095, -7776617, -8297675,
+-8829816, -9380603, -9952123, -10548511, -11192438, -11919065,
+-12671172, -13438549, -14232061, -15062200, -15899665, -16802572,
+17739412, 18725886, 19625418, 20458448, 21392202, 22346532,
+23310144, 24336266, 25457146, 26639572, 27874318, 29180440,
+30570936, 32044188, 33604364, 35257056, 37006492, 38833420,
+40745368, 42749912, 44846596, 47032812, 49318540, 51704112,
+54183000, 56747120, 59397304, 62137772, 64938688, 67793344,
+70831448, 73960840, 77111768, 80298224, 83528888, 86778376,
+90039080, 93302528, 96541856, 99755032, 102923904, 106027616,
+109066040, 112017456, 114866184, 117592440, 120184144, 122624224,
+124905544, 127010856, 128931552, 130666344, 132191136, 133505016,
+134605360, 135478896, 136120576, 136498544, 136610544, 136390896,
+136106368, 135791440, 135081680, 134039064, 132663544, 130943336,
+128876128, 126439184, 123615464, 120403880, 116783968, 112750168,
+108296544, 103416816, 98114136, 92387688, 86239880, 79676032,
+72697184, 65299188, 57491652, 49271324, 40633116, 31582262,
+22113356, 12229525, 1933215, -8779568, -19893306, -31396530,
+-43338216, -55715672, -68469528, -81601800, -95119752, -109012544,
+-123274624, -137902624, -152887216, -168220960, -183892768, -199892672,
+-216212560, -232841840, -249770272, -266987040, -284483936, -302248800,
+-320270592, -338536576, -357031680, -375740448, -394642624, -413715328,
+-432939744, -452297696, -471766976, -491319872, -510956224, -530689568,
+550314688, 569805312, 589331520, 608841280, 628294144, 647679424,
+666974528, 686151296, 705180416, 724037376, 742695360, 761126400,
+779305216, 797209408, 814818048, 832112192, 849073920, 865685504,
+881927232, 897777728, 913213888, 928211072, 942743488, 956784768,
+970310720, 983299712, 995732352, 1007593856, 1018874944, 1029566592,
+1039655360, 1049145600, 1058033856, 1066312576, 1073975296, 1081012992,
+1087415680, 1093176448, 1098289920, 1102755712, 1106582656, 1109785856,
+1112388096, 1114420736, 1115916544, 1116907776, 1117424512, 1117484800,
+1117091968, 1116238848, 1114897920, 1113026048, 1110577792, 1107500160,
+1103739520, 1099271424, 1094099328, 1088271360, 1081958528, 1076012800,
+1066112832, 1052270720, 1038832960, 1024980800, 1010577920, 995613248,
+980113280, 964128448, 947737280, 931017344, 914037760, 896864896,
+879548544, 862118336, 844591360, 826968768, 809238464, 791384896,
+773390848, 755241024, 736928896, 718455680, 699830528, 681070912,
+662197568, 643231744, 624193216, 605096768, 585949312, 566752640,
+547506176, 528205504, 508844544, 489425088, 469954944, 450450944,
+430937408, 411440896, 391989376, 372605984, 353300032, 334067616,
+314888448, 295721536, 276517248, 257224080, 237791168, 218193616,
+198443888, 178588864, 158737840, 139063920, 119772248, 101121944,
+83411368, 66882256, 51724928, 38009000, 25081918, 11097560
+};
+
+
+/* 5ms delay prototype */
+const Word32 LDQMF_10_fx[] = // q = 30
+{
+ 136778, 68195, -70890, -226890, -352352, -420072,
+-436802, -444543, -506661, -672815, -980068, -1367880,
+-1747442, -2041059, -2171766, -2084001, -1756846, -1205000,
+-470033, 391658, -1352314, -2311012, -3225024, -4068760,
+-4825637, -5483931, -6033975, -6472204, -6808585, -7075060,
+-7325812, -7636335, -8074047, -8676456, -9424478, -10219283,
+-10865228, -11073811, -10475044, -8652076, 5180201, -339904,
+-8224782, -18673422, -31726070, -47229416, -64809980, -83846512,
+-103451368, -122477480, -139540384, -153063904, -161342016, -162639632,
+-155309920, -137908720, -109304704, -68777832, -16099735, 48410956,
+-123867744, -208812656, -301278944, -398795360, -498505440, -597277184,
+-691834048, -778907776, -855407232, -918606592, -966152640, -996390080,
+-1008509056, -1002265344, -978191040, -937540800, -882190336, -814525888,
+-737309056, -653527872, 566225280, 478344672, 392910464, 312395584,
+238918544, 174094816, 118926376, 73749168, 38239292, 11438051,
+-6809585, -17473586, -23179288, -24893300, -23497172, -19904868,
+-15070633, -9938406, -5364481, -2000462
+};
+
+
+const Word32 LDQMF_16_fx[] = // q = 30
+{
+135840, 119105, 61025, -23300, -120396, -217572,
+-303688, -369787, -411986, -431913, -436960, -439365,
+-455121, -500073, -585815, -716339, -910646, -1146410,
+-1392576, -1634245, -1852285, -2026746, -2138911, -2173116,
+-2118583, -1970211, -1728614, -1399460, -992562, -520340,
+3268, 562389, -1169900, -1774888, -2369781, -2945925,
+-3497147, -4018445, -4506032, -4956920, -5368526, -5738270,
+-6064626, -6347064, -6587229, -6790047, -6964112, -7121373,
+-7276728, -7449880, -7659373, -7920485, -8244154, -8633965,
+-9083566, -9574508, -10074442, -10534940, -10894573, -11076715,
+-10992408, -10543848, -9627864, -8139161, 5976364, 3037887,
+-760649, -5491840, -11209240, -17943616, -25700144, -34454400,
+-44150032, -54695840, -65964980, -77789648, -89960896, -102229872,
+-114308392, -125871952, -136561440, -145990880, -153753088, -159424128,
+-162577504, -162794960, -159676832, -152853360, -141995744, -126825840,
+-107126032, -82747424, -53617472, -19744928, 18775524, 61761592,
+-108947912, -159965984, -214394832, -271716064, -331337920, -392605120,
+-454808224, -517194272, -578978880, -639359104, -697528768, -752693376,
+-804086912, -850989824, -892747136, -928791232, -958536704, -981563328,
+-997684800, -1006698432, -1008520640, -1003187328, -990852800, -971782976,
+-946346880, -915003328, -878295040, -836832960, -791284544, -742359104,
+-690793664, -637338560, 582754624, 527645440, 472906400, 419190784,
+367113152, 317241312, 270082016, 226065808, 185534960, 148735312,
+115810224, 86800312, 61646000, 40190228, 22181636, 7245162,
+-4169367, -12156084, -17964338, -21866804, -24101958, -24886370,
+-24433336, -22962478, -20701850, -17885954, -14749119, -11519968,
+-8412224, -5619924, -3298610, -1524161
+};
+
+
+const Word32 LDQMF_20_fx[] = // q = 30
+{
+132095, 130054, 94118, 37811, -32619, -110471,
+-188997, -262715, -325880, -375095, -408842, -427924,
+-435582, -437285, -440062, -452482, -482692, -537287,
+-620381, -731564, -887814, -1074239, -1268925, -1466394,
+-1657422, -1832122, -1980124, -2091724, -2157946, -2171782,
+-2128230, -2024638, -1860817, -1638685, -1362085, -1036418,
+-668022, -263994, 167952, 619489, -1109006, -1594302,
+-2074063, -2544892, -3002259, -3443307, -3865450, -4266665,
+-4645248, -4999899, -5329217, -5631869, -5906959, -6153951,
+-6372928, -6565001, -6732690, -6880012, -7012401, -7136777,
+-7260809, -7394870, -7549043, -7731644, -7949919, -8208793,
+-8510223, -8852171, -9227619, -9624792, -10025312, -10404401,
+-10731825, -10971712, -11081824, -11015548, -10722771, -10150872,
+-9246198, -7954792, 6226194, 4006049, 1251053, -2079213,
+-6018496, -10592059, -15815707, -21694928, -28223572, -35382820,
+-43140436, -51449560, -60249600, -69462792, -78994976, -88734976,
+-98555328, -108312432, -117847120, -126986608, -135542896, -143318016,
+-150106768, -155693424, -159859744, -162387488, -163062224, -161676800,
+-158034768, -151954128, -143271408, -131843832, -117553208, -100308496,
+-80048728, -56744644, -30400730, -1056328, 31212950, 66296312,
+-104051416, -144280880, -186784688, -231313168, -277585056, -325290400,
+-374093504, -423635840, -473540064, -523412928, -572850304, -621440576,
+-668770368, -714429248, -758014656, -799138176, -837430848, -872549376,
+-904183040, -932063424, -955866112, -975368256, -990502784, -1001141248,
+-1007204608, -1008661952, -1005531712, -997881088, -985824192, -969518976,
+-949164608, -924995776, -897283008, -866326016, -832450624, -796003264,
+-757347840, -716859456, -674920448, -631918336, 588261568, 544170240,
+500187776, 456655456, 413899520, 372230592, 331939808, 293293792,
+256529792, 221851008, 189423392, 159373024, 131783696, 106697088,
+84113256, 63991576, 46252108, 30775584, 17400960, 5897692,
+-3242832, -10003035, -15315395, -19324048, -22161874, -23947232,
+-24790774, -24801182, -24088950, -22768174, -20956786, -18774960,
+-16343248, -13780261, -11200397, -8711802, -6413878, -4393110,
+-2713518, -1364255
+};
+
+
+const Word32 LDQMF_30_fx[] = // q = 30
+{
+ 121571, 136778, 125655, 101704, 68195, 26875,
+-20212, -70890, -123705, -176138, -226890, -274106,
+-316253, -352352, -381787, -404297, -420072, -429892,
+-434876, -436802, -437431, -439163, -444543, -456066,
+-476087, -506661, -549091, -604538, -672815, -752814,
+-858037, -980068, -1106184, -1235998, -1367880, -1498945,
+-1626464, -1747442, -1858910, -1957741, -2041059, -2106142,
+-2150372, -2171766, -2168618, -2139643, -2084001, -2001495,
+-1892255, -1756846, -1596236, -1411745, -1205000, -977797,
+-732072, -470033, -193708, 94399, 391658, 694989,
+-1028102, -1352314, -1674661, -1994503, -2311012, -2622127,
+-2927093, -3225024, -3515027, -3796480, -4068760, -4331384,
+-4583784, -4825637, -5056603, -5276176, -5483931, -5679645,
+-5863044, -6033975, -6192384, -6338348, -6472204, -6594554,
+-6706284, -6808585, -6902959, -6991107, -7075060, -7157331,
+-7239857, -7325812, -7418951, -7521577, -7636335, -7765375,
+-7910813, -8074047, -8256089, -8457071, -8676456, -8912695,
+-9163169, -9424478, -9691922, -9959316, -10219283, -10463412,
+-10682245, -10865228, -11000298, -11074417, -11073811, -10983892,
+-10789539, -10475044, -10024687, -9422374, -8652076, -7698111,
+6547450, 5180201, 3585185, 1749124, -339904, -2692689,
+-5318487, -8224782, -11417230, -14899579, -18673422, -22738288,
+-27091010, -31726070, -36635292, -41807760, -47229416, -52884028,
+-58751904, -64809980, -71032152, -77388632, -83846512, -90369776,
+-96918936, -103451368, -109921528, -116280640, -122477480, -128458624,
+-134165992, -139540384, -144523760, -149052944, -153063904, -156492352,
+-159273296, -161342016, -162634320, -163087360, -162639632, -161231616,
+-158806368, -155309920, -150691824, -144905568, -137908720, -129663752,
+-120138088, -109304704, -97142448, -83636416, -68777832, -52564528,
+-35001268, -16099735, 4121304, 25635912, 48410956, 72407360,
+-97584200, -123867744, -151213264, -179552912, -208812656, -238912112,
+-269764832, -301278944, -333357440, -365898336, -398795360, -431938528,
+-465214080, -498505440, -531693760, -564658432, -597277184, -629427584,
+-660987072, -691834048, -721848128, -750911168, -778907776, -805726528,
+-831260224, -855407232, -878071616, -899164800, -918606592, -936328128,
+-952202112, -966152640, -978197888, -988289792, -996390080, -1002471040,
+-1006513664, -1008509056, -1008457600, -1006369728, -1002265344, -996173888,
+-988133504, -978191040, -966401920, -952828672, -937540800, -920615360,
+-902135488, -882190336, -860873664, -838284672, -814525888, -789704064,
+-763927872, -737309056, -709960000, -681994880, -653527872, -624673024,
+595607552, 566225280, 536822976, 507495872, 478344672, 449466912,
+420958208, 392910464, 365412224, 338547584, 312395584, 287029856,
+262517344, 238918544, 216286160, 194665808, 174094816, 154602160,
+136208672, 118926376, 102759984, 87704592, 73749168, 60872400,
+49048000, 38239292, 28404982, 19492542, 11438051, 4150853,
+-1959299, -6809585, -10983833, -14524688, -17473586, -19875174,
+-21764768, -23179288, -24150308, -24711158, -24893300, -24729546,
+-24252922, -23497172, -22497182, -21287720, -19904868, -18383770,
+-16760795, -15070633, -13348427, -11626766, -9938406, -8313092,
+-6779951, -5364481, -4088471, -2966834, -2000462, -1134160
+};
+
+
+const Word32 LDQMF_32_fx[] = // q = 30
+{
+119697, 137151, 128520, 107723, 78400, 41836,
+-442, -46740, -95597, -145201, -193804, -240598,
+-283800, -322316, -355411, -382593, -403699, -418862,
+-428699, -434120, -436480, -437237, -438149, -441391,
+-449045, -463039, -485346, -517326, -560092, -614348,
+-679872, -755580, -854379, -968457, -1086190, -1207329,
+-1330799, -1454135, -1575271, -1691704, -1801098, -1900763,
+-1988263, -2061316, -2117677, -2155275, -2172543, -2168111,
+-2140952, -2090356, -2016155, -1918414, -1797519, -1654212,
+-1489464, -1304576, -1100939, -880095, -643755, -393648,
+-131597, 140303, 419876, 704520, -1017921, -1322020,
+-1624457, -1924758, -2222508, -2515835, -2804014, -3086295,
+-3361992, -3630425, -3891163, -4143616, -4387487, -4622276,
+-4847761, -5063642, -5269495, -5464963, -5649876, -5823971,
+-5987172, -6139337, -6280537, -6410931, -6530943, -6641149,
+-6742439, -6835855, -6922708, -7004445, -7082802, -7159902,
+-7237256, -7317480, -7403834, -7498178, -7602711, -7719257,
+-7849652, -7995245, -8157013, -8335469, -8530447, -8741283,
+-8966383, -9203373, -9449370, -9700315, -9951033, -10195449,
+-10426707, -10637019, -10818085, -10960053, -11052529, -11084311,
+-11043675, -10918394, -10695736, -10362793, -9906464, -9313511,
+-8570674, -7665161, 6586647, 5317833, 3849979, 2171972,
+273875, -1853535, -4218327, -6827112, -9685347, -12796811,
+-16163952, -19787344, -23665996, -27796800, -32174812, -36793016,
+-41642268, -46710992, -51985904, -57451192, -63088408, -68876552,
+-74792144, -80808992, -86898528, -93029584, -99168576, -105279432,
+-111323816, -117260928, -123048216, -128641440, -133992400, -139052160,
+-143773440, -148104208, -151991888, -155383600, -158225792, -160465072,
+-162048320, -162923104, -163038096, -162343200, -160789920, -158332016,
+-154925376, -150528912, -145104496, -138617152, -131035664, -122332640,
+-112485024, -101474136, -89286032, -75911456, -61346324, -45591780,
+-28653996, -10544916, 8718141, 29112362, 50609392, 73176464,
+-96780680, -121357544, -146873168, -173272304, -200494976, -228475968,
+-257145792, -286430368, -316251616, -346527296, -377172096, -408096800,
+-439210240, -470417824, -501623072, -532727936, -563632832, -594237184,
+-624439872, -654140096, -683237312, -711632192, -739226496, -765924288,
+-791632320, -816260416, -839722176, -861935360, -882823040, -902313408,
+-920341952, -936853184, -951735680, -964924736, -976443584, -986251200,
+-994314944, -1000609792, -1005117952, -1007828864, -1008739392, -1007854080,
+-1005185024, -1000751488, -994580096, -986704064, -977163328, -966004416,
+-953279168, -939044864, -923364608, -906306368, -887942656, -868349888,
+-847608448, -825801792, -803016512, -779341120, -754867072, -729686080,
+-703891520, -677576896, -650837184, -623766656, 596524928, 568982144,
+541414592, 513899552, 486520032, 459356832, 432489472, 405994688,
+379947008, 354417408, 329473600, 305178976, 281592608, 258768368,
+236754960, 215594992, 195325728, 175977920, 157575920, 140137536,
+123674336, 108191456, 93687496, 80154992, 67580128, 55943780,
+45219876, 35377480, 26377892, 18179138, 10724362, 3937154,
+-1793747, -6383129, -10375463, -13802420, -16701194, -19108980,
+-21056298, -22573612, -23687536, -24425978, -24814642, -24880884,
+-24650790, -24152456, -23413234, -22462376, -21328340, -20040900,
+-18629038, -17122794, -15550818, -13942058, -12323783, -10723672,
+-9166937, -7678115, -6278687, -4990172, -3829056, -2807491,
+-1918388, -1103400
+};
+
+
+const Word32 LDQMF_40_fx[] = // q = 30
+{
+113206, 137254, 134425, 123146, 105211, 81666,
+53560, 21302, -14069, -51499, -90644, -130324,
+-169687, -208133, -245093, -279677, -311296, -339564,
+-364227, -384972, -401866, -414904, -424383, -430758,
+-434462, -436342, -437086, -437526, -438798, -441921,
+-448029, -458055, -473038, -493889, -521096, -555299,
+-596905, -645667, -701531, -764070, -843495, -933719,
+-1026835, -1122239, -1219597, -1318430, -1417239, -1515133,
+-1610824, -1702996, -1790556, -1872015, -1946188, -2011806,
+-2067738, -2112859, -2146050, -2166539, -2173557, -2166437,
+-2144725, -2108000, -2056211, -1989295, -1907357, -1810628,
+-1699503, -1574446, -1436054, -1285028, -1122103, -948052,
+-763730, -570121, -367947, -158284, 57837, 279329,
+505114, 733496, -987128, -1230885, -1473412, -1714779,
+-1954662, -2192913, -2428356, -2660607, -2889345, -3114179,
+-3334742, -3550687, -3761781, -3967793, -4168400, -4363503,
+-4552806, -4736194, -4913551, -5084693, -5249383, -5407420,
+-5558753, -5703241, -5840790, -5971350, -6094838, -6211308,
+-6320774, -6423390, -6519396, -6609079, -6692852, -6771222,
+-6844809, -6914280, -6980363, -7043921, -7105964, -7167616,
+-7229469, -7292854, -7359781, -7431209, -7508135, -7591745,
+-7682927, -7782628, -7891680, -8010673, -8140087, -8280182,
+-8430924, -8592083, -8763179, -8943293, -9131195, -9325472,
+-9524332, -9725493, -9926142, -10123188, -10313198, -10492333,
+-10656603, -10801577, -10922158, -11013175, -11068951, -11083709,
+-11051345, -10965628, -10820070, -10607987, -10322919, -9958035,
+-9506509, -8961670, -8316717, -7565184, 6702942, 5718827,
+4609517, 3369113, 1992225, 473872, -1190731, -3005819,
+-4975066, -7101637, -9388180, -11836610, -14448347, -17224060,
+-20163764, -23266722, -26531342, -29955288, -33535422, -37267720,
+-41147260, -45168140, -49323552, -53606284, -58007508, -62517548,
+-67125584, -71820016, -76587808, -81415152, -86287160, -91187832,
+-96100320, -101006496, -105887512, -110723520, -115493552, -120176040,
+-124748632, -129188288, -133469680, -137567456, -141458352, -145116032,
+-148513808, -151624560, -154421360, -156876704, -158963328, -160653808,
+-161921024, -162738128, -163078752, -162916896, -162227280, -160985216,
+-159167008, -156749920, -153712208, -150033328, -145694224, -140676912,
+-134964928, -128543672, -121399776, -113521832, -104900488, -95527920,
+-85398544, -74508560, -62856444, -50442808, -37270156, -23343566,
+-8670189, 6740502, 22876916, 39724980, 57268860, 75490816,
+-94376496, -113883272, -134001320, -154702832, -175958544, -197737504,
+-220006032, -242729312, -265870144, -289389664, -313247648, -337401888,
+-361809024, -386424256, -411201216, -436093120, -461051360, -486026816,
+-510969600, -535829088, -560554240, -585093440, -609395008, -633407296,
+-657078592, -680357568, -703193408, -725535424, -747334272, -768541184,
+-789108672, -808990656, -828142272, -846520832, -864084928, -880795968,
+-896616960, -911514304, -925457216, -938417536, -950324992, -961141376,
+-970896128, -979566976, -987136576, -993587776, -998908288, -1003088128,
+-1006120192, -1008000960, -1008729280, -1008307648, -1006741504, -1004039168,
+-1000212096, -995274560, -989243584, -982139008, -973983296, -964801472,
+-954620608, -943470016, -931381312, -918388608, -904527488, -889835648,
+-874352128, -858117568, -841174400, -823565824, -805336512, -786531904,
+-767198144, -747382720, -727132672, -706495808, -685520512, -664254656,
+-642746560, -621047616, 599273536, 577248256, 555196416, 533150944,
+511154144, 489249568, 467478368, 445881248, 424498464, 403368608,
+382529632, 362017792, 341868224, 322114240, 302787552, 283917824,
+265532592, 247657504, 230315568, 213527440, 197311648, 181683920,
+166657488, 152242496, 138447232, 125276624, 112733328, 100817520,
+89526080, 78854768, 68795096, 59337532, 50469688, 42175888,
+34440516, 27241264, 20558124, 14361678, 8619497, 3303077,
+-1288525, -5070930, -8454926, -11459781, -14115485, -16433949,
+-18436136, -20138626, -21555150, -22702724, -23593500, -24242222,
+-24662498, -24867088, -24870766, -24686354, -24328404, -23811232,
+-23148884, -22356736, -21449164, -20441404, -19348716, -18185774,
+-16968062, -15710186, -14426756, -13132428, -11840736, -10565599,
+-9320040, -8115962, -6965903, -5879984, -4867950, -3939393,
+-3097321, -2346408, -1680052, -1007771
+};
+
+
+const Word32 LDQMF_60_fx[] = // q = 30
+{
+ 102336, 132095, 137435, 135349, 130054, 120487,
+108540, 94118, 77297, 58570, 37811, 15643,
+-7974, -32619, -57897, -84046, -110471, -136942,
+-163210, -188997, -214438, -239091, -262715, -285164,
+-306247, -325880, -343923, -360378, -375095, -388054,
+-399325, -408842, -416725, -423037, -427924, -431547,
+-434000, -435582, -436522, -437005, -437285, -437644,
+-438481, -440062, -442703, -446767, -452482, -460182,
+-470154, -482692, -497967, -516093, -537287, -561715,
+-589463, -620381, -654511, -691825, -731564, -775911,
+-829205, -887814, -949148, -1011179, -1074239, -1138341,
+-1203246, -1268925, -1334921, -1400802, -1466394, -1531260,
+-1595082, -1657422, -1717943, -1776350, -1832122, -1884921,
+-1934396, -1980124, -2021834, -2059138, -2091724, -2119241,
+-2141378, -2157946, -2168655, -2173353, -2171782, -2163852,
+-2149388, -2128230, -2100421, -2065896, -2024638, -1976676,
+-1922048, -1860817, -1793099, -1719008, -1638685, -1552286,
+-1460012, -1362085, -1258676, -1150050, -1036418, -918024,
+-795131, -668022, -536993, -402188, -263994, -122679,
+21420, 167952, 316690, 467104, 619489, 773430,
+-945239, -1109006, -1271451, -1433050, -1594302, -1754861,
+-1914784, -2074063, -2232363, -2389328, -2544892, -2698989,
+-2851488, -3002259, -3151251, -3298296, -3443307, -3586211,
+-3726943, -3865450, -4001599, -4135335, -4266665, -4395461,
+-4521664, -4645248, -4766175, -4884420, -4999899, -5112604,
+-5222404, -5329217, -5433113, -5533999, -5631869, -5726641,
+-5818340, -5906959, -5992421, -6074745, -6153951, -6230036,
+-6303010, -6372928, -6439843, -6503845, -6565001, -6623435,
+-6679269, -6732690, -6783804, -6832855, -6880012, -6925506,
+-6969547, -7012401, -7054336, -7095680, -7136777, -7177903,
+-7219120, -7260809, -7303731, -7348340, -7394870, -7443617,
+-7494881, -7549043, -7606393, -7667166, -7731644, -7800142,
+-7872827, -7949919, -8031501, -8117779, -8208793, -8304570,
+-8405066, -8510223, -8619935, -8734017, -8852171, -8974106,
+-9099397, -9227619, -9358364, -9490965, -9624792, -9759051,
+-9892867, -10025312, -10155439, -10282162, -10404401, -10520844,
+-10630426, -10731825, -10823502, -10903968, -10971712, -11025073,
+-11062346, -11081824, -11081759, -11060277, -11015548, -10945697,
+-10848751, -10722771, -10565739, -10375810, -10150872, -9888970,
+-9588053, -9246198, -8861297, -8431401, -7954792, -7429283,
+6854949, 6226194, 5542800, 4803353, 4006049, 3149248,
+2231398, 1251053, 206700, -902968, -2079213, -3323232,
+-4636016, -6018496, -7471561, -8995894, -10592059, -12260527,
+-14001671, -15815707, -17702624, -19662438, -21694928, -23799650,
+-25976100, -28223572, -30541232, -32928052, -35382820, -37904240,
+-40490688, -43140436, -45851544, -48621904, -51449560, -54331840,
+-57266136, -60249600, -63279032, -66351236, -69462792, -72609920,
+-75788648, -78994976, -82224448, -85472704, -88734976, -92006232,
+-95281520, -98555328, -101822272, -105076584, -108312432, -111523680,
+-114704032, -117847120, -120946376, -123995120, -126986608, -129913560,
+-132768248, -135542896, -138230992, -140825344, -143318016, -145701104,
+-147966688, -150106768, -152113232, -153978192, -155693424, -157250816,
+-158642336, -159859744, -160895152, -161740352, -162387488, -162828688,
+-163056176, -163062224, -162839296, -162379936, -161676800, -160722816,
+-159511024, -158034768, -156287280, -154262480, -151954128, -149356496,
+-146464032, -143271408, -139773568, -135965808, -131843832, -127403488,
+-122641048, -117553208, -112136840, -106389392, -100308496, -93892368,
+-87139520, -80048728, -72619504, -64851416, -56744644, -48299972,
+-39518100, -30400730, -20949652, -11167261, -1056328, 9379870,
+20137698, 31212950, 42601076, 54297248, 66296312, 78593112,
+-91185600, -104051416, -117194704, -130607064, -144280880, -158207776,
+-172378736, -186784688, -201415824, -216262032, -231313168, -246558128,
+-261985952, -277585056, -293343616, -309249600, -325290400, -341453376,
+-357725472, -374093504, -390543744, -407062432, -423635840, -440249504,
+-456889088, -473540064, -490187584, -506816896, -523412928, -539960640,
+-556444864, -572850304, -589161600, -605363456, -621440576, -637377600,
+-653159232, -668770368, -684195712, -699420352, -714429248, -729207616,
+-743740992, -758014656, -772014784, -785727168, -799138176, -812234496,
+-825002880, -837430848, -849505856, -861215872, -872549376, -883495616,
+-894043456, -904183040, -913905152, -923200640, -932063424, -940477696,
+-948417216, -955866112, -962841216, -969345024, -975368256, -980905536,
+-985952256, -990502784, -994553344, -998100544, -1001141248, -1003673344,
+-1005694720, -1007204608, -1008202304, -1008687808, -1008661952, -1008125952,
+-1007081664, -1005531712, -1003479040, -1000927424, -997881088, -994344832,
+-990323904, -985824192, -980852096, -975414528, -969518976, -963173312,
+-956385600, -949164608, -941519424, -933459776, -924995776, -916137728,
+-906896448, -897283008, -887308928, -876985984, -866326016, -855341824,
+-844045696, -832450624, -820569472, -808415936, -796003264, -783345088,
+-770455104, -757347840, -744036608, -730535808, -716859456, -703022272,
+-689038016, -674920448, -660685696, -646345600, -631918336, -617424704,
+602927232, 588261568, 573575488, 558872576, 544170240, 529480224,
+514815008, 500187776, 485610624, 471095904, 456655456, 442301536,
+428045760, 413899520, 399874240, 385981024, 372230592, 358633472,
+345199872, 331939808, 318862624, 305977728, 293293792, 280819232,
+268562016, 256529792, 244729552, 233167968, 221851008, 210784624,
+199973840, 189423392, 179137440, 169119664, 159373024, 149900064,
+140703152, 131783696, 123142424, 114780232, 106697088, 98892400,
+91364808, 84113256, 77135992, 70429688, 63991576, 57819020,
+51907328, 46252108, 40848248, 35691672, 30775584, 26091894,
+21637068, 17400960, 13374445, 9548629, 5897692, 2475272,
+-592184, -3242832, -5659970, -7917455, -10003035, -11926348,
+-13696880, -15315395, -16789184, -18123694, -19324048, -20394110,
+-21338122, -22161874, -22868630, -23462238, -23947232, -24327810,
+-24607834, -24790774, -24881324, -24883598, -24801182, -24638338,
+-24399474, -24088950, -23710470, -23268668, -22768174, -22213084,
+-21607820, -20956786, -20264828, -19536176, -18774960, -17986262,
+-17174228, -16343248, -15497611, -14641749, -13780261, -12916498,
+-12055168, -11200397, -10355588, -9525147, -8711802, -7920384,
+-7153632, -6413878, -5706099, -5031208, -4393110, -3792571,
+-3230785, -2713518, -2227977, -1784736, -1364255, -871387
+};
+
+const Word32 rot_vec_delay_re_LDQMF_fx[60] = // q = 31
+{
+ -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224,
+ 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224,
+ -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224,
+ 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224,
+ -1518500224, 1518500224, 1518500224, -1518500224
+};
+
+const Word32 rot_vec_delay_im_LDQMF_fx[60] = // q = 31
+{
+ -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224,
+ 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224,
+ -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224,
+ 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224, -1518500224, -1518500224, 1518500224, 1518500224,
+ -1518500224, -1518500224, 1518500224, 1518500224
+};
+
+const Word32 rot_vec_ana_re_L10_fx[5] = // q = 29
+{
+ 1517329536, 1424643840, 1192503936, 843633536, 412182400
+};
+
+const Word32 rot_vec_ana_im_L10_fx[5] = // q = 29
+{
+ -59616040, -525578848, -940094336, -1262586752, -1461488512
+};
+
+const Word32 rot_vec_ana_re_L16_fx[8] = // q = 29
+{
+ 1200118272, 1171310720, 1097490432, 981494080, 827779520, 642253888, 432046752, 205236304
+};
+
+const Word32 rot_vec_ana_im_L16_fx[8] = // q = 29
+{
+ -29461250, -263026624, -486484032, -691246144, -869444032, -1014229696, -1120039040, -1182806016
+};
+
+const Word32 rot_vec_ana_re_L20_fx[10] = // q = 29
+{
+ 1073534848, 1057019968, 1014477760, 946955776, 856116544, 744196864, 613952640, 468590848, 311690784, 147115888
+};
+
+const Word32 rot_vec_ana_im_L20_fx[10] = // q = 29
+{
+ -21081516, -188759824, -351790240, -506158400, -648063232, -774010624, -880899328, -966097344, -1027506880, -1063615744
+};
+
+const Word32 rot_vec_ana_re_L30_fx[15] = // q = 29
+{
+ 876631424, 870629568, 855088960, 830179840, 796175040, 753447232, 702464448, 643785344, 578052800, 505986944, 428377440, 346074528, 259979936, 171036960, 80220064
+};
+
+const Word32 rot_vec_ana_im_L30_fx[15] = // q = 29
+{
+ -11475734, -103045800, -193486880, -281808064, -367041728, -448253984, -524555072, -595109056, -659142848, -715955008, -764922944, -805510272, -837272192, -859860864, -873028672
+};
+
+const Word32 rot_vec_ana_re_L32_fx[16] = // q = 29
+{
+ 848803520, 843695296, 830461760, 809230464, 780205824, 743667392, 699967040, 649525568, 592828864, 530422880, 462908640, 390936320, 315199072, 236426304, 155376608, 72830544
+};
+
+const Word32 rot_vec_ana_im_L32_fx[16] = // q = 29
+{
+ -10416909, -93564040, -175810112, -256363024, -334447008, -409310112, -480231328, -546527616, -607560576, -662742400, -711541696, -753488384, -788178560, -815278208, -834526272, -845737344
+};
+
+const Word32 rot_vec_ana_re_L40_fx[20] = // q = 29
+{
+ 759213504, 756288320, 748700352, 736496320, 719751616, 698569408, 673080256, 643441344, 609835392, 572469632, 531574400, 487401824, 440224256, 390332576, 338034336,
+ 283652032, 227520896, 169987024, 111405128, 52136384
+};
+
+const Word32 rot_vec_ana_im_L40_fx[20] = // q = 29
+{
+ -7453801, -66998032, -126129192, -184482736, -241698864, -297424864, -351317120, -403043392, -452284768, -498737664, -542115648, -582151360, -618597888, -651230528,
+ -679848192, -704274304, -724358336, -739976448, -751032384, -757457984
+};
+
+const Word32 rot_vec_ana_re_L60_fx[30] = // q = 29
+{
+ 619911872, 618849920, 616091776, 611644992, 605521728, 597738752, 588317440, 577283520, 564667392, 550503488, 534830720, 517692032, 499134368, 479208608, 457969376, 435474880, 411786784,
+ 386970016, 361092576, 334225408, 306442144, 277818944, 248434272, 218368656, 187704512, 156525872, 124918216, 92968160, 60763288, 28391868
+};
+
+const Word32 rot_vec_ana_im_L60_fx[30] = // q = 29
+{
+ -4057371, -36495492, -68833576, -100983000, -132855632, -164364112, -195422080, -225944416, -255847456, -285049248, -313469728, -341030976, -367657536, -393276352, -417817216, -441212864,
+ -463399200, -484315392, -503904096, -522111616, -538888128, -554187520, -567967936, -580191616, -590825024, -599838976, -607208896, -612914432, -616940032, -619274624
+};
+
+
+/*!
+ * \brief CLDFB prototype filter
+ *
+ * cldfb bands: 10
+ * delay[ms]: 1.00
+ * abs. max Val: 1.04
+ * scale: 0.50
+ */
+const Word16 CLDFB80_10[] =//Q.5
+{
+ W16(0x0000), W16(0xfffc), W16(0xffdf), W16(0x0132), W16(0x23b5),
+ W16(0x0000), W16(0xffff), W16(0xfff3), W16(0x018d), W16(0x2a98),
+ W16(0x0000), W16(0x0000), W16(0x0006), W16(0x020d), W16(0x3116),
+ W16(0x0000), W16(0x0000), W16(0x001a), W16(0x02bd), W16(0x36e2),
+ W16(0x0000), W16(0x0000), W16(0x001c), W16(0x039f), W16(0x3bb5),
+ W16(0x0000), W16(0xffff), W16(0x001a), W16(0x04b1), W16(0x3f51),
+ W16(0x0000), W16(0x0000), W16(0x0024), W16(0x05da), W16(0x419a),
+ W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ee), W16(0x428c),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07bd), W16(0x4267),
+ W16(0x0000), W16(0xfffc), W16(0x001b), W16(0x0820), W16(0x410b),
+ W16(0x0000), W16(0xfff0), W16(0xffe9), W16(0x0806), W16(0x3d82),
+ W16(0x0000), W16(0xfffe), W16(0xffe6), W16(0x0746), W16(0x37fe),
+ W16(0x0000), W16(0x0000), W16(0x000d), W16(0x05ae), W16(0x31d1),
+ W16(0x0000), W16(0x0000), W16(0x002a), W16(0x032f), W16(0x2b60),
+ W16(0x0000), W16(0xfffd), W16(0x0025), W16(0xffcd), W16(0x24a3),
+ W16(0x0000), W16(0x0003), W16(0x0004), W16(0xfb88), W16(0x1dc0),
+ W16(0x0000), W16(0x0000), W16(0xffca), W16(0xf66f), W16(0x16c9),
+ W16(0x0000), W16(0x0000), W16(0xff95), W16(0xf09a), W16(0x0fe8),
+ W16(0x0000), W16(0xffff), W16(0xff64), W16(0xea2a), W16(0x08e0),
+ W16(0x0000), W16(0x0012), W16(0xff21), W16(0xe34c), W16(0x02aa)
+};
+
+/*!
+ * \brief CLDFB prototype filter
+ *
+ * cldfb bands: 16
+ * delay[ms]: 1.00
+ * abs. max Val: 1.04
+ * scale: 0.50
+ */
+const Word16 CLDFB80_16[] =//Q.5
+{
+ W16(0x0000), W16(0xfffb), W16(0xffdd), W16(0x0123), W16(0x2266),
+ W16(0x0000), W16(0xfffe), W16(0xffe7), W16(0x0157), W16(0x26c0),
+ W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0194), W16(0x2b04),
+ W16(0x0000), W16(0xffff), W16(0xfffe), W16(0x01e0), W16(0x2f1f),
+ W16(0x0000), W16(0x0000), W16(0x000c), W16(0x023f), W16(0x32fc),
+ W16(0x0000), W16(0x0000), W16(0x0019), W16(0x02b0), W16(0x368c),
+ W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0336), W16(0x39bc),
+ W16(0x0000), W16(0x0001), W16(0x0013), W16(0x03cf), W16(0x3c7b),
+ W16(0x0000), W16(0x0001), W16(0x001a), W16(0x047b), W16(0x3ebd),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0532), W16(0x407c),
+ W16(0x0000), W16(0x0000), W16(0x0025), W16(0x05ec), W16(0x41b3),
+ W16(0x0000), W16(0xffff), W16(0x002d), W16(0x069d), W16(0x4262),
+ W16(0x0000), W16(0x0000), W16(0x0031), W16(0x0738), W16(0x429c),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07b3), W16(0x4271),
+ W16(0x0000), W16(0xffff), W16(0x002a), W16(0x0804), W16(0x41d1),
+ W16(0x0000), W16(0xfff9), W16(0x0015), W16(0x0824), W16(0x40a3),
+ W16(0x0000), W16(0xffec), W16(0xffee), W16(0x0815), W16(0x3e6c),
+ W16(0x0000), W16(0xfff7), W16(0xffe0), W16(0x07ca), W16(0x3b3b),
+ W16(0x0000), W16(0xfffd), W16(0xffe8), W16(0x0734), W16(0x379e),
+ W16(0x0000), W16(0xfffe), W16(0x0000), W16(0x0647), W16(0x33c7),
+ W16(0x0000), W16(0xffff), W16(0x0018), W16(0x04ff), W16(0x2fd6),
+ W16(0x0000), W16(0x0000), W16(0x0029), W16(0x035e), W16(0x2bca),
+ W16(0x0000), W16(0xffff), W16(0x002b), W16(0x0164), W16(0x279c),
+ W16(0x0000), W16(0x0001), W16(0x0022), W16(0xff11), W16(0x235b),
+ W16(0x0000), W16(0xfffc), W16(0x000f), W16(0xfc66), W16(0x1f0d),
+ W16(0x0000), W16(0x0001), W16(0xffec), W16(0xf966), W16(0x1ab4),
+ W16(0x0000), W16(0x0000), W16(0xffc6), W16(0xf617), W16(0x165a),
+ W16(0x0000), W16(0x0001), W16(0xffa5), W16(0xf27f), W16(0x120e),
+ W16(0x0000), W16(0x0001), W16(0xff86), W16(0xeea6), W16(0x0dbd),
+ W16(0x0000), W16(0x0001), W16(0xff67), W16(0xea95), W16(0x0950),
+ W16(0x0000), W16(0x0005), W16(0xff40), W16(0xe657), W16(0x051a),
+ W16(0x0000), W16(0x001b), W16(0xff12), W16(0xe1fc), W16(0x01c8)
+};
+
+/*!
+ * \brief CLDFB prototype filter
+ *
+ * cldfb bands: 20
+ * delay[ms]: 1.00
+ * abs. max Val: 1.04
+ * scale: 0.50
+ */
+const Word16 CLDFB80_20[] =//Q.5
+{
+ W16(0x0000), W16(0xfffb), W16(0xffdf), W16(0x011e), W16(0x21f7),
+ W16(0x0000), W16(0xfffd), W16(0xffe1), W16(0x0146), W16(0x2573),
+ W16(0x0000), W16(0xffff), W16(0xfff2), W16(0x0173), W16(0x28e6),
+ W16(0x0000), W16(0xffff), W16(0xfff6), W16(0x01a9), W16(0x2c45),
+ W16(0x0000), W16(0xffff), W16(0xffff), W16(0x01e9), W16(0x2f84),
+ W16(0x0000), W16(0x0000), W16(0x000a), W16(0x0235), W16(0x329c),
+ W16(0x0000), W16(0x0000), W16(0x0014), W16(0x028c), W16(0x3583),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02f1), W16(0x3831),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0362), W16(0x3a9c),
+ W16(0x0000), W16(0x0001), W16(0x000d), W16(0x03df), W16(0x3cbb),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x0469), W16(0x3e89),
+ W16(0x0000), W16(0x0000), W16(0x001c), W16(0x04fb), W16(0x4004),
+ W16(0x0000), W16(0x0000), W16(0x0020), W16(0x0590), W16(0x4129),
+ W16(0x0000), W16(0x0000), W16(0x0027), W16(0x0622), W16(0x41f5),
+ W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ad), W16(0x426d),
+ W16(0x0000), W16(0x0000), W16(0x0030), W16(0x072a), W16(0x429b),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0792), W16(0x4288),
+ W16(0x0000), W16(0x0001), W16(0x002e), W16(0x07e1), W16(0x4232),
+ W16(0x0000), W16(0xfffe), W16(0x0024), W16(0x0813), W16(0x4186),
+ W16(0x0000), W16(0xfff8), W16(0x0011), W16(0x0825), W16(0x407d),
+ W16(0x0000), W16(0xffed), W16(0xfff1), W16(0x0818), W16(0x3eb8),
+ W16(0x0000), W16(0xfff5), W16(0xffe3), W16(0x07e8), W16(0x3c3c),
+ W16(0x0000), W16(0xfffe), W16(0xffe1), W16(0x0789), W16(0x3977),
+ W16(0x0000), W16(0xfffd), W16(0xffee), W16(0x06f6), W16(0x367b),
+ W16(0x0000), W16(0xfffe), W16(0x0002), W16(0x062a), W16(0x3363),
+ W16(0x0000), W16(0xffff), W16(0x0016), W16(0x0524), W16(0x303c),
+ W16(0x0000), W16(0x0000), W16(0x0026), W16(0x03e4), W16(0x2d04),
+ W16(0x0000), W16(0x0000), W16(0x002d), W16(0x026c), W16(0x29b7),
+ W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x00bb), W16(0x2657),
+ W16(0x0000), W16(0x0005), W16(0x0021), W16(0xfed0), W16(0x22ed),
+ W16(0x0000), W16(0xfff8), W16(0x0014), W16(0xfcae), W16(0x1f7c),
+ W16(0x0000), W16(0x0002), W16(0xfff7), W16(0xfa55), W16(0x1c03),
+ W16(0x0000), W16(0x0000), W16(0xffd8), W16(0xf7c8), W16(0x1886),
+ W16(0x0000), W16(0x0001), W16(0xffbc), W16(0xf50a), W16(0x150f),
+ W16(0x0000), W16(0x0001), W16(0xffa2), W16(0xf21f), W16(0x11a0),
+ W16(0x0000), W16(0x0001), W16(0xff89), W16(0xef0b), W16(0x0e2c),
+ W16(0x0000), W16(0x0001), W16(0xff71), W16(0xebd2), W16(0x0aa5),
+ W16(0x0000), W16(0xfffe), W16(0xff55), W16(0xe87a), W16(0x0724),
+ W16(0x0000), W16(0x0006), W16(0xff33), W16(0xe50a), W16(0x03fd),
+ W16(0x0000), W16(0x001e), W16(0xff0d), W16(0xe18b), W16(0x017f)
+};
+
+/*!
+ * \brief CLDFB prototype filter
+ *
+ * cldfb bands: 32
+ * delay[ms]: 1.00
+ * abs. max Val: 1.04
+ * scale: 0.50
+ */
+const Word16 CLDFB80_32[] =//Q.5
+{
+ W16(0x0000), W16(0xfffb), W16(0xffe2), W16(0x0115), W16(0x214f),
+ W16(0x0000), W16(0xfffc), W16(0xffde), W16(0x012f), W16(0x237e),
+ W16(0x0000), W16(0xfffd), W16(0xffe2), W16(0x0149), W16(0x25ab),
+ W16(0x0000), W16(0xfffe), W16(0xffec), W16(0x0165), W16(0x27d4),
+ W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0183), W16(0x29f6),
+ W16(0x0000), W16(0xffff), W16(0xfff6), W16(0x01a6), W16(0x2c10),
+ W16(0x0000), W16(0xffff), W16(0xfffb), W16(0x01cc), W16(0x2e1d),
+ W16(0x0000), W16(0xffff), W16(0x0001), W16(0x01f6), W16(0x301c),
+ W16(0x0000), W16(0x0000), W16(0x0009), W16(0x0226), W16(0x320b),
+ W16(0x0000), W16(0x0000), W16(0x000f), W16(0x025a), W16(0x33e7),
+ W16(0x0000), W16(0x0000), W16(0x0015), W16(0x0292), W16(0x35b0),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02d0), W16(0x3761),
+ W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0313), W16(0x38fa),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x035a), W16(0x3a77),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x03a7), W16(0x3bd7),
+ W16(0x0000), W16(0x0000), W16(0x0004), W16(0x03f7), W16(0x3d18),
+ W16(0x0000), W16(0xffff), W16(0x001b), W16(0x044e), W16(0x3e38),
+ W16(0x0000), W16(0xffff), W16(0x001a), W16(0x04a8), W16(0x3f39),
+ W16(0x0000), W16(0x0000), W16(0x001c), W16(0x0504), W16(0x4018),
+ W16(0x0000), W16(0x0001), W16(0x001f), W16(0x0561), W16(0x40d6),
+ W16(0x0000), W16(0x0000), W16(0x0022), W16(0x05be), W16(0x4172),
+ W16(0x0000), W16(0x0000), W16(0x0027), W16(0x0619), W16(0x41eb),
+ W16(0x0000), W16(0xffff), W16(0x002c), W16(0x0672), W16(0x4242),
+ W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06c6), W16(0x427b),
+ W16(0x0000), W16(0x0000), W16(0x002f), W16(0x0714), W16(0x4297),
+ W16(0x0000), W16(0x0000), W16(0x0031), W16(0x075a), W16(0x429a),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0798), W16(0x4285),
+ W16(0x0000), W16(0x0001), W16(0x0031), W16(0x07cb), W16(0x4255),
+ W16(0x0000), W16(0xffff), W16(0x002c), W16(0x07f4), W16(0x4206),
+ W16(0x0000), W16(0xfffe), W16(0x0025), W16(0x0811), W16(0x4193),
+ W16(0x0000), W16(0xfffb), W16(0x001a), W16(0x0821), W16(0x40fa),
+ W16(0x0000), W16(0xfff5), W16(0x000b), W16(0x0823), W16(0x404a),
+ W16(0x0000), W16(0xfff0), W16(0xfff6), W16(0x081b), W16(0x3f2f),
+ W16(0x0000), W16(0xffef), W16(0xffe9), W16(0x0809), W16(0x3daa),
+ W16(0x0000), W16(0xfff5), W16(0xffe2), W16(0x07e4), W16(0x3c12),
+ W16(0x0000), W16(0xfffa), W16(0xffe0), W16(0x07ac), W16(0x3a5c),
+ W16(0x0000), W16(0xffff), W16(0xffe4), W16(0x0761), W16(0x388d),
+ W16(0x0000), W16(0xfffd), W16(0xffed), W16(0x0701), W16(0x36ac),
+ W16(0x0000), W16(0xfffe), W16(0xfff9), W16(0x068a), W16(0x34c0),
+ W16(0x0000), W16(0xffff), W16(0x0006), W16(0x05fd), W16(0x32cd),
+ W16(0x0000), W16(0x0000), W16(0x0013), W16(0x0559), W16(0x30d4),
+ W16(0x0000), W16(0x0000), W16(0x001d), W16(0x049f), W16(0x2ed6),
+ W16(0x0000), W16(0x0000), W16(0x0026), W16(0x03cf), W16(0x2cd0),
+ W16(0x0000), W16(0x0000), W16(0x002c), W16(0x02e8), W16(0x2ac1),
+ W16(0x0000), W16(0x0000), W16(0x002c), W16(0x01eb), W16(0x28aa),
+ W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x00d7), W16(0x268d),
+ W16(0x0000), W16(0xfffd), W16(0x0024), W16(0xffae), W16(0x246c),
+ W16(0x0000), W16(0x000a), W16(0x0021), W16(0xfe6e), W16(0x2248),
+ W16(0x0000), W16(0xfff3), W16(0x001a), W16(0xfd19), W16(0x2022),
+ W16(0x0000), W16(0x0003), W16(0x0006), W16(0xfbad), W16(0x1df8),
+ W16(0x0000), W16(0x0002), W16(0xfff5), W16(0xfa2d), W16(0x1bcb),
+ W16(0x0000), W16(0xffff), W16(0xffe2), W16(0xf899), W16(0x199d),
+ W16(0x0000), W16(0x0001), W16(0xffcf), W16(0xf6f2), W16(0x1770),
+ W16(0x0000), W16(0x0001), W16(0xffbd), W16(0xf537), W16(0x1546),
+ W16(0x0000), W16(0x0001), W16(0xffad), W16(0xf36b), W16(0x1320),
+ W16(0x0000), W16(0x0000), W16(0xff9d), W16(0xf18e), W16(0x10fc),
+ W16(0x0000), W16(0x0001), W16(0xff8e), W16(0xefa2), W16(0x0ed3),
+ W16(0x0000), W16(0x0001), W16(0xff7f), W16(0xeda7), W16(0x0ca3),
+ W16(0x0000), W16(0x0001), W16(0xff6f), W16(0xeb9e), W16(0x0a6c),
+ W16(0x0000), W16(0xfffd), W16(0xff5e), W16(0xe989), W16(0x0837),
+ W16(0x0000), W16(0x0003), W16(0xff4b), W16(0xe769), W16(0x0618),
+ W16(0x0000), W16(0x0006), W16(0xff35), W16(0xe542), W16(0x042a),
+ W16(0x0000), W16(0x0013), W16(0xff1e), W16(0xe314), W16(0x0284),
+ W16(0x0000), W16(0x0020), W16(0xff06), W16(0xe0e2), W16(0x010c)
+};
+
+/*!
+ * \brief CLDFB prototype filter
+ *
+ * cldfb bands: 40
+ * delay[ms]: 1.00
+ * abs. max Val: 1.04
+ * scale: 0.50
+ */
+const Word16 CLDFB80_40[] =//Q.5
+{
+ W16(0x0000), W16(0xfffa), W16(0xffe2), W16(0x0112), W16(0x2117),
+ W16(0x0000), W16(0xfffb), W16(0xffdc), W16(0x0128), W16(0x22d6),
+ W16(0x0000), W16(0xfffc), W16(0xffe0), W16(0x013c), W16(0x2494),
+ W16(0x0000), W16(0xfffe), W16(0xffe5), W16(0x0151), W16(0x2651),
+ W16(0x0000), W16(0xffff), W16(0xffed), W16(0x0167), W16(0x280b),
+ W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0180), W16(0x29c0),
+ W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x019b), W16(0x2b6f),
+ W16(0x0000), W16(0xffff), W16(0xfff8), W16(0x01b8), W16(0x2d18),
+ W16(0x0000), W16(0xffff), W16(0xfffd), W16(0x01d8), W16(0x2eb8),
+ W16(0x0000), W16(0xffff), W16(0x0002), W16(0x01fb), W16(0x304e),
+ W16(0x0000), W16(0x0000), W16(0x0008), W16(0x0221), W16(0x31da),
+ W16(0x0000), W16(0x0000), W16(0x000d), W16(0x0249), W16(0x335a),
+ W16(0x0000), W16(0x0000), W16(0x0013), W16(0x0275), W16(0x34ce),
+ W16(0x0000), W16(0x0000), W16(0x0017), W16(0x02a4), W16(0x3634),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02d6), W16(0x378b),
+ W16(0x0000), W16(0x0000), W16(0x001d), W16(0x030c), W16(0x38d3),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0344), W16(0x3a08),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0380), W16(0x3b2b),
+ W16(0x0000), W16(0x0000), W16(0x0017), W16(0x03bf), W16(0x3c3b),
+ W16(0x0000), W16(0xffff), W16(0x0002), W16(0x03ff), W16(0x3d36),
+ W16(0x0000), W16(0xffff), W16(0x001a), W16(0x0445), W16(0x3e1d),
+ W16(0x0000), W16(0x0000), W16(0x001a), W16(0x048d), W16(0x3eef),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x04d6), W16(0x3fad),
+ W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0520), W16(0x4055),
+ W16(0x0000), W16(0x0001), W16(0x001f), W16(0x056a), W16(0x40e8),
+ W16(0x0000), W16(0xffff), W16(0x0021), W16(0x05b5), W16(0x4164),
+ W16(0x0000), W16(0x0000), W16(0x0026), W16(0x05fe), W16(0x41ca),
+ W16(0x0000), W16(0x0000), W16(0x0029), W16(0x0646), W16(0x421b),
+ W16(0x0000), W16(0xffff), W16(0x002d), W16(0x068c), W16(0x4256),
+ W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ce), W16(0x427f),
+ W16(0x0000), W16(0x0000), W16(0x002f), W16(0x070c), W16(0x4295),
+ W16(0x0000), W16(0x0000), W16(0x0031), W16(0x0746), W16(0x429c),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x077a), W16(0x4293),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07a8), W16(0x427a),
+ W16(0x0000), W16(0x0001), W16(0x0030), W16(0x07d0), W16(0x424f),
+ W16(0x0000), W16(0xffff), W16(0x002d), W16(0x07f0), W16(0x4210),
+ W16(0x0000), W16(0xffff), W16(0x0028), W16(0x080a), W16(0x41ba),
+ W16(0x0000), W16(0xfffd), W16(0x001f), W16(0x081b), W16(0x414b),
+ W16(0x0000), W16(0xfffa), W16(0x0018), W16(0x0824), W16(0x40c6),
+ W16(0x0000), W16(0xfff4), W16(0x0009), W16(0x0822), W16(0x403a),
+ W16(0xffff), W16(0xfff1), W16(0xfff9), W16(0x081c), W16(0x3f57),
+ W16(0x0000), W16(0xffed), W16(0xffec), W16(0x0810), W16(0x3e1f),
+ W16(0x0000), W16(0xfff3), W16(0xffe6), W16(0x07f9), W16(0x3ce2),
+ W16(0x0000), W16(0xfff6), W16(0xffe1), W16(0x07d5), W16(0x3b92),
+ W16(0x0000), W16(0xfffb), W16(0xffe0), W16(0x07a6), W16(0x3a2f),
+ W16(0x0000), W16(0xffff), W16(0xffe3), W16(0x076a), W16(0x38bc),
+ W16(0x0000), W16(0xfffd), W16(0xffea), W16(0x0720), W16(0x373e),
+ W16(0x0000), W16(0xfffd), W16(0xfff3), W16(0x06c8), W16(0x35b7),
+ W16(0x0000), W16(0xfffe), W16(0xfffd), W16(0x0662), W16(0x342a),
+ W16(0x0000), W16(0xffff), W16(0x0008), W16(0x05ee), W16(0x329a),
+ W16(0x0000), W16(0x0000), W16(0x0011), W16(0x056b), W16(0x3107),
+ W16(0x0000), W16(0xffff), W16(0x001a), W16(0x04d9), W16(0x2f70),
+ W16(0x0000), W16(0x0000), W16(0x0022), W16(0x043a), W16(0x2dd4),
+ W16(0x0000), W16(0x0000), W16(0x0028), W16(0x038c), W16(0x2c33),
+ W16(0x0000), W16(0x0000), W16(0x002c), W16(0x02cf), W16(0x2a8c),
+ W16(0x0000), W16(0x0001), W16(0x002d), W16(0x0205), W16(0x28e0),
+ W16(0x0000), W16(0xffff), W16(0x002b), W16(0x012c), W16(0x2730),
+ W16(0x0000), W16(0xfffd), W16(0x0027), W16(0x0045), W16(0x257d),
+ W16(0x0000), W16(0xffff), W16(0x0023), W16(0xff50), W16(0x23c8),
+ W16(0x0000), W16(0x000a), W16(0x0021), W16(0xfe4d), W16(0x2211),
+ W16(0x0000), W16(0xfff3), W16(0x001c), W16(0xfd3c), W16(0x2059),
+ W16(0x0000), W16(0x0000), W16(0x000b), W16(0xfc1c), W16(0x1e9e),
+ W16(0x0000), W16(0x0003), W16(0xfffd), W16(0xfaf0), W16(0x1ce2),
+ W16(0x0000), W16(0x0001), W16(0xffef), W16(0xf9b6), W16(0x1b24),
+ W16(0x0000), W16(0xfffe), W16(0xffe0), W16(0xf870), W16(0x1965),
+ W16(0x0000), W16(0x0001), W16(0xffd1), W16(0xf71d), W16(0x17a7),
+ W16(0x0000), W16(0x0000), W16(0xffc3), W16(0xf5be), W16(0x15ec),
+ W16(0x0000), W16(0x0001), W16(0xffb5), W16(0xf453), W16(0x1433),
+ W16(0x0000), W16(0x0001), W16(0xffa8), W16(0xf2de), W16(0x127c),
+ W16(0x0000), W16(0x0000), W16(0xff9b), W16(0xf15e), W16(0x10c5),
+ W16(0x0000), W16(0x0001), W16(0xff8f), W16(0xefd4), W16(0x0f0b),
+ W16(0x0000), W16(0x0001), W16(0xff83), W16(0xee40), W16(0x0d4c),
+ W16(0x0000), W16(0x0001), W16(0xff77), W16(0xeca4), W16(0x0b88),
+ W16(0x0000), W16(0x0001), W16(0xff6a), W16(0xeaff), W16(0x09c2),
+ W16(0x0000), W16(0xfffd), W16(0xff5d), W16(0xe953), W16(0x0800),
+ W16(0x0000), W16(0x0002), W16(0xff4d), W16(0xe7a0), W16(0x064d),
+ W16(0x0000), W16(0x0006), W16(0xff3c), W16(0xe5e8), W16(0x04b8),
+ W16(0x0000), W16(0x0009), W16(0xff2a), W16(0xe42c), W16(0x034d),
+ W16(0x0000), W16(0x0018), W16(0xff17), W16(0xe26c), W16(0x0212),
+ W16(0x0001), W16(0x0020), W16(0xff03), W16(0xe0aa), W16(0x00e3)
+};
+
+/*!
+ * \brief CLDFB prototype filter
+ *
+ * cldfb bands: 60
+ * delay[ms]: 1.00
+ * abs. max Val: 1.04
+ * scale: 0.50
+ */
+const Word16 CLDFB80_60[] =//Q.5
+{
+ W16(0x0000), W16(0xfffa), W16(0xffe2), W16(0x010f), W16(0x20cd),
+ W16(0x0000), W16(0xfffb), W16(0xffdf), W16(0x011e), W16(0x21f7),
+ W16(0x0000), W16(0xfffb), W16(0xffdd), W16(0x012b), W16(0x2320),
+ W16(0x0000), W16(0xfffd), W16(0xffe0), W16(0x0138), W16(0x244a),
+ W16(0x0000), W16(0xfffd), W16(0xffe1), W16(0x0146), W16(0x2573),
+ W16(0x0000), W16(0xfffe), W16(0xffe6), W16(0x0155), W16(0x269b),
+ W16(0x0000), W16(0xfffe), W16(0xffec), W16(0x0164), W16(0x27c1),
+ W16(0x0000), W16(0xffff), W16(0xfff2), W16(0x0173), W16(0x28e6),
+ W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0184), W16(0x2a08),
+ W16(0x0000), W16(0xffff), W16(0xfff4), W16(0x0196), W16(0x2b28),
+ W16(0x0000), W16(0xffff), W16(0xfff6), W16(0x01a9), W16(0x2c45),
+ W16(0x0000), W16(0xffff), W16(0xfff9), W16(0x01bd), W16(0x2d5e),
+ W16(0x0000), W16(0xffff), W16(0xfffc), W16(0x01d2), W16(0x2e73),
+ W16(0x0000), W16(0xffff), W16(0xffff), W16(0x01e9), W16(0x2f84),
+ W16(0x0000), W16(0x0000), W16(0x0003), W16(0x0201), W16(0x3091),
+ W16(0x0000), W16(0x0000), W16(0x0008), W16(0x021a), W16(0x3199),
+ W16(0x0000), W16(0x0000), W16(0x000a), W16(0x0235), W16(0x329c),
+ W16(0x0000), W16(0x0000), W16(0x000e), W16(0x0251), W16(0x3399),
+ W16(0x0000), W16(0x0000), W16(0x0012), W16(0x026e), W16(0x3491),
+ W16(0x0000), W16(0x0000), W16(0x0014), W16(0x028c), W16(0x3583),
+ W16(0x0000), W16(0x0000), W16(0x0018), W16(0x02ac), W16(0x366f),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02ce), W16(0x3753),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x02f1), W16(0x3831),
+ W16(0x0000), W16(0x0000), W16(0x001d), W16(0x0315), W16(0x3907),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x033b), W16(0x39d6),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x0362), W16(0x3a9c),
+ W16(0x0000), W16(0x0000), W16(0x001d), W16(0x038a), W16(0x3b5a),
+ W16(0x0000), W16(0x0000), W16(0x0019), W16(0x03b4), W16(0x3c0f),
+ W16(0x0000), W16(0x0001), W16(0x000d), W16(0x03df), W16(0x3cbb),
+ W16(0x0000), W16(0xffff), W16(0x0001), W16(0x040a), W16(0x3d5e),
+ W16(0x0000), W16(0xfffe), W16(0x0017), W16(0x0439), W16(0x3df8),
+ W16(0x0000), W16(0x0000), W16(0x001b), W16(0x0469), W16(0x3e89),
+ W16(0x0000), W16(0x0000), W16(0x001a), W16(0x0499), W16(0x3f10),
+ W16(0x0000), W16(0x0000), W16(0x001a), W16(0x04c9), W16(0x3f8f),
+ W16(0x0000), W16(0x0000), W16(0x001c), W16(0x04fb), W16(0x4004),
+ W16(0x0000), W16(0x0000), W16(0x001e), W16(0x052c), W16(0x406f),
+ W16(0x0000), W16(0x0001), W16(0x001f), W16(0x055e), W16(0x40d1),
+ W16(0x0000), W16(0x0000), W16(0x0020), W16(0x0590), W16(0x4129),
+ W16(0x0000), W16(0x0000), W16(0x0022), W16(0x05c1), W16(0x4177),
+ W16(0x0000), W16(0x0000), W16(0x0025), W16(0x05f2), W16(0x41bb),
+ W16(0x0000), W16(0x0000), W16(0x0027), W16(0x0622), W16(0x41f5),
+ W16(0x0000), W16(0xffff), W16(0x002a), W16(0x0652), W16(0x4226),
+ W16(0x0000), W16(0xffff), W16(0x002c), W16(0x0680), W16(0x424e),
+ W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06ad), W16(0x426d),
+ W16(0x0000), W16(0x0000), W16(0x002e), W16(0x06d9), W16(0x4284),
+ W16(0x0000), W16(0x0000), W16(0x002f), W16(0x0702), W16(0x4293),
+ W16(0x0000), W16(0x0000), W16(0x0030), W16(0x072a), W16(0x429b),
+ W16(0x0000), W16(0x0000), W16(0x0031), W16(0x074f), W16(0x429b),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0772), W16(0x4295),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x0792), W16(0x4288),
+ W16(0x0000), W16(0x0000), W16(0x0032), W16(0x07af), W16(0x4274),
+ W16(0x0000), W16(0x0001), W16(0x0031), W16(0x07ca), W16(0x4257),
+ W16(0x0000), W16(0x0001), W16(0x002e), W16(0x07e1), W16(0x4232),
+ W16(0x0000), W16(0xffff), W16(0x002c), W16(0x07f5), W16(0x4203),
+ W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x0806), W16(0x41ca),
+ W16(0x0000), W16(0xfffe), W16(0x0024), W16(0x0813), W16(0x4186),
+ W16(0x0000), W16(0xfffd), W16(0x001e), W16(0x081d), W16(0x4137),
+ W16(0x0000), W16(0xfffa), W16(0x0019), W16(0x0823), W16(0x40de),
+ W16(0x0000), W16(0xfff8), W16(0x0011), W16(0x0825), W16(0x407d),
+ W16(0xffff), W16(0xfff3), W16(0x0006), W16(0x0821), W16(0x4023),
+ W16(0xffff), W16(0xfff2), W16(0xfffb), W16(0x081d), W16(0x3f8c),
+ W16(0x0000), W16(0xffed), W16(0xfff1), W16(0x0818), W16(0x3eb8),
+ W16(0x0000), W16(0xffee), W16(0xffeb), W16(0x080d), W16(0x3deb),
+ W16(0x0000), W16(0xfff2), W16(0xffe7), W16(0x07fd), W16(0x3d18),
+ W16(0x0000), W16(0xfff5), W16(0xffe3), W16(0x07e8), W16(0x3c3c),
+ W16(0x0000), W16(0xfff7), W16(0xffe0), W16(0x07ce), W16(0x3b58),
+ W16(0x0000), W16(0xfffa), W16(0xffe0), W16(0x07ae), W16(0x3a6b),
+ W16(0x0000), W16(0xfffe), W16(0xffe1), W16(0x0789), W16(0x3977),
+ W16(0x0000), W16(0xffff), W16(0xffe4), W16(0x075e), W16(0x387d),
+ W16(0x0000), W16(0xfffd), W16(0xffe8), W16(0x072d), W16(0x377e),
+ W16(0x0000), W16(0xfffd), W16(0xffee), W16(0x06f6), W16(0x367b),
+ W16(0x0000), W16(0xfffe), W16(0xfff4), W16(0x06b8), W16(0x3575),
+ W16(0x0000), W16(0xfffe), W16(0xfffb), W16(0x0674), W16(0x346d),
+ W16(0x0000), W16(0xfffe), W16(0x0002), W16(0x062a), W16(0x3363),
+ W16(0x0000), W16(0xffff), W16(0x000a), W16(0x05d9), W16(0x3257),
+ W16(0x0000), W16(0x0000), W16(0x0010), W16(0x0582), W16(0x314b),
+ W16(0x0000), W16(0xffff), W16(0x0016), W16(0x0524), W16(0x303c),
+ W16(0x0000), W16(0xffff), W16(0x001b), W16(0x04c0), W16(0x2f2c),
+ W16(0x0000), W16(0x0000), W16(0x0021), W16(0x0455), W16(0x2e19),
+ W16(0x0000), W16(0x0000), W16(0x0026), W16(0x03e4), W16(0x2d04),
+ W16(0x0000), W16(0x0000), W16(0x0029), W16(0x036d), W16(0x2bed),
+ W16(0x0000), W16(0x0000), W16(0x002c), W16(0x02f0), W16(0x2ad3),
+ W16(0x0000), W16(0x0000), W16(0x002d), W16(0x026c), W16(0x29b7),
+ W16(0x0000), W16(0x0000), W16(0x002c), W16(0x01e2), W16(0x2898),
+ W16(0x0000), W16(0xffff), W16(0x002b), W16(0x0151), W16(0x2778),
+ W16(0x0000), W16(0xfffe), W16(0x0029), W16(0x00bb), W16(0x2657),
+ W16(0x0000), W16(0xfffd), W16(0x0026), W16(0x001d), W16(0x2534),
+ W16(0x0000), W16(0xfffe), W16(0x0024), W16(0xff7a), W16(0x2411),
+ W16(0x0000), W16(0x0005), W16(0x0021), W16(0xfed0), W16(0x22ed),
+ W16(0x0000), W16(0x0009), W16(0x0021), W16(0xfe21), W16(0x21c8),
+ W16(0x0000), W16(0xfff5), W16(0x001f), W16(0xfd6b), W16(0x20a2),
+ W16(0x0000), W16(0xfff8), W16(0x0014), W16(0xfcae), W16(0x1f7c),
+ W16(0x0000), W16(0x0001), W16(0x0009), W16(0xfbeb), W16(0x1e54),
+ W16(0x0000), W16(0x0003), W16(0x0000), W16(0xfb23), W16(0x1d2c),
+ W16(0x0000), W16(0x0002), W16(0xfff7), W16(0xfa55), W16(0x1c03),
+ W16(0x0000), W16(0x0001), W16(0xffed), W16(0xf981), W16(0x1ad9),
+ W16(0x0000), W16(0xffff), W16(0xffe3), W16(0xf8a7), W16(0x19b0),
+ W16(0x0000), W16(0x0000), W16(0xffd8), W16(0xf7c8), W16(0x1886),
+ W16(0x0000), W16(0x0001), W16(0xffcf), W16(0xf6e3), W16(0x175d),
+ W16(0x0000), W16(0x0000), W16(0xffc5), W16(0xf5f9), W16(0x1636),
+ W16(0x0000), W16(0x0001), W16(0xffbc), W16(0xf50a), W16(0x150f),
+ W16(0x0000), W16(0x0001), W16(0xffb3), W16(0xf416), W16(0x13e9),
+ W16(0x0000), W16(0x0001), W16(0xffaa), W16(0xf31d), W16(0x12c5),
+ W16(0x0000), W16(0x0001), W16(0xffa2), W16(0xf21f), W16(0x11a0),
+ W16(0x0000), W16(0x0000), W16(0xff99), W16(0xf11d), W16(0x107b),
+ W16(0x0000), W16(0x0000), W16(0xff91), W16(0xf016), W16(0x0f55),
+ W16(0x0000), W16(0x0001), W16(0xff89), W16(0xef0b), W16(0x0e2c),
+ W16(0x0000), W16(0x0001), W16(0xff81), W16(0xedfc), W16(0x0d01),
+ W16(0x0000), W16(0x0001), W16(0xff79), W16(0xece9), W16(0x0bd4),
+ W16(0x0000), W16(0x0001), W16(0xff71), W16(0xebd2), W16(0x0aa5),
+ W16(0x0000), W16(0x0001), W16(0xff68), W16(0xeab8), W16(0x0976),
+ W16(0x0000), W16(0xfffd), W16(0xff5f), W16(0xe99b), W16(0x084a),
+ W16(0x0000), W16(0xfffe), W16(0xff55), W16(0xe87a), W16(0x0724),
+ W16(0x0000), W16(0x0003), W16(0xff4a), W16(0xe757), W16(0x0607),
+ W16(0x0000), W16(0x0006), W16(0xff3f), W16(0xe632), W16(0x04f9),
+ W16(0x0000), W16(0x0006), W16(0xff33), W16(0xe50a), W16(0x03fd),
+ W16(0x0000), W16(0x000c), W16(0xff27), W16(0xe3e1), W16(0x0315),
+ W16(0x0000), W16(0x0016), W16(0xff1a), W16(0xe2b7), W16(0x0244),
+ W16(0x0000), W16(0x001e), W16(0xff0d), W16(0xe18b), W16(0x017f),
+ W16(0x0002), W16(0x0020), W16(0xff00), W16(0xe05e), W16(0x00a9)
+};
+
+const Word16 CLDFB80_30[] =//Q.5
+{
+ 0, -5, -30, 278, 8546,
+ 0, -4, -33, 306, 9141,
+ 0, -2, -29, 334, 9735,
+ 0, -1, -17, 363, 10324,
+ 0, -1, -13, 397, 10904,
+ 0, -1, -9, 435, 11474,
+ 0, -1, -2, 478, 12028,
+ 0, 0, 6, 525, 12566,
+ 0, 0, 12, 578, 13083,
+ 0, 0, 19, 637, 13579,
+ 0, 0, 26, 701, 14050,
+ 0, 0, 28, 771, 14493,
+ 0, 0, 30, 846, 14906,
+ 0, 0, 28, 927, 15285,
+ 0, 0, 4, 1012, 15630,
+ 0, -1, 27, 1105, 15937,
+ 0, -1, 26, 1201, 16209,
+ 0, 0, 29, 1299, 16442,
+ 0, 1, 31, 1399, 16638,
+ 0, 0, 36, 1498, 16794,
+ 0, 0, 41, 1594, 16911,
+ 0, -1, 45, 1687, 16990,
+ 0, 0, 46, 1774, 17036,
+ 0, 0, 49, 1853, 17052,
+ 0, 0, 50, 1922, 17040,
+ 0, 0, 50, 1981, 16999,
+ 0, 0, 45, 2027, 16924,
+ 0, -1, 39, 2061, 16809,
+ 0, -4, 27, 2080, 16651,
+ 0, -10, 12, 2084, 16463,
+ 0, -17, -10, 2075, 16161,
+ 0, -16, -23, 2054, 15746,
+ 0, -10, -31, 2012, 15307,
+ 0, -4, -32, 1949, 14834,
+ 0, -2, -26, 1862, 14334,
+ 0, -3, -15, 1752, 13816,
+ 0, -2, -1, 1616, 13288,
+ 0, 0, 13, 1454, 12753,
+ 0, -1, 25, 1267, 12212,
+ 0, 0, 35, 1054, 11663,
+ 0, 0, 42, 815, 11104,
+ 0, 1, 45, 552, 10536,
+ 0, -2, 42, 263, 9960,
+ 0, -3, 37, -51, 9379,
+ 0, 9, 33, -391, 8795,
+ 0, -12, 25, -755, 8207,
+ 0, 3, 4, -1144, 7616,
+ 0, 2, -14, -1557, 7022,
+ 0, -2, -34, -1992, 6427,
+ 0, 0, -54, -2449, 5833,
+ 0, 1, -73, -2927, 5244,
+ 0, 1, -90, -3425, 4659,
+ 0, 0, -107, -3942, 4072,
+ 0, 1, -123, -4476, 3479,
+ 0, 1, -139, -5026, 2877,
+ 0, -1, -156, -5590, 2272,
+ 0, 0, -176, -6167, 1684,
+ 0, 6, -199, -6754, 1144,
+ 0, 18, -223, -7348, 682,
+ 0, 32, -249, -7947, 282
+};
+
+/*!
+ * \brief CLDFB rRotVectr
+ *
+ * cldfb bands: 10
+ * global gain: 8.00
+ * scale: sqrt(1.0/16.00)
+ */
+const Word16 rRotVectr_10[] =//Q(sqrt(1.0/16.00))
+{
+ W16(0x5a71), W16(0x54ea), W16(0x4714), W16(0x3249), W16(0x1891)
+};
+
+/*!
+ * \brief CLDFB iRotVectr
+ *
+ * cldfb bands: 10
+ * global gain: 8.00
+ * scale: sqrt(1.0/16.00)
+ */
+const Word16 iRotVectr_10[] =//Q(sqrt(1.0/16.00))
+{
+ W16(0xfc72), W16(0xe0ac), W16(0xc7f7), W16(0xb4be), W16(0xa8e3)
+};
+
+/*!
+ * \brief CLDFB rRotVectr
+ *
+ * cldfb bands: 16
+ * global gain: 5.00
+ * scale: sqrt(1.0/8.00)
+ */
+const Word16 rRotVectr_16[] =//Q(sqrt(1.0/8.00))
+{
+ W16(0x652a), W16(0x62bc), W16(0x5c83), W16(0x52bc), W16(0x45c7),
+ W16(0x3623), W16(0x246b), W16(0x114d)
+};
+
+/*!
+ * \brief CLDFB iRotVectr
+ *
+ * cldfb bands: 16
+ * global gain: 5.00
+ * scale: sqrt(1.0/8.00)
+ */
+const Word16 iRotVectr_16[] =//Q(sqrt(1.0/8.00))
+{
+ W16(0xfd84), W16(0xe9d4), W16(0xd6fe), W16(0xc5bb), W16(0xb6b6),
+ W16(0xaa82), W16(0xa196), W16(0x9c4c)
+};
+
+/*!
+ * \brief CLDFB rRotVectr
+ *
+ * cldfb bands: 20
+ * global gain: 4.00
+ * scale: sqrt(1.0/8.00)
+ */
+const Word16 rRotVectr_20[] =//Q(sqrt(1.0/8.00))
+{
+ W16(0x5a7e), W16(0x591a), W16(0x5584), W16(0x4fd3), W16(0x482a),
+ W16(0x3ebb), W16(0x33c1), W16(0x2780), W16(0x1a46), W16(0x0c67)
+};
+
+/*!
+ * \brief CLDFB iRotVectr
+ *
+ * cldfb bands: 20
+ * global gain: 4.00
+ * scale: sqrt(1.0/8.00)
+ */
+const Word16 iRotVectr_20[] =//Q(sqrt(1.0/8.00)
+{
+ W16(0xfe39), W16(0xf017), W16(0xe259), W16(0xd556), W16(0xc95f),
+ W16(0xbec1), W16(0xb5bf), W16(0xae90), W16(0xa963), W16(0xa658)
+};
+
+/*!
+ * \brief CLDFB rRotVectr
+ *
+ * cldfb bands: 30
+ * global gain: 2.50
+ * scale: sqrt(1.0/4.00)
+ */
+const Word16 rRotVectr_30[] =//Q(sqrt(1.0/4.00))
+{
+ 25902, 25725, 25265, 24529, 23525, 22262, 20756, 19022, 17080, 14950, 12657, 10226, 7682, 5054, 2370
+};
+
+/*!
+ * \brief CLDFB iRotVectr
+ *
+ * cldfb bands: 30
+ * global gain: 2.50
+ * scale: sqrt(1.0/4.00)
+ */
+const Word16 iRotVectr_30[] =//Q(sqrt(1.0/4.00))
+{
+ -339, -3045, -5717, -8327, -10845, -13245, -15499, -17584, -19476, -21154, -22601, -23801, -24739, -25406, -25796
+};
+/*!
+ * \brief CLDFB rRotVectr
+ *
+ * cldfb bands: 32
+ * global gain: 2.50
+ * scale: sqrt(1.0/4.00)
+ */
+const Word16 rRotVectr_32[] =//Q(sqrt(1.0/4.00))
+{
+ W16(0x652f), W16(0x6494), W16(0x6300), W16(0x6078), W16(0x5d02),
+ W16(0x58a7), W16(0x5371), W16(0x4d6e), W16(0x46ac), W16(0x3f3b),
+ W16(0x372f), W16(0x2e9a), W16(0x2593), W16(0x1c2f), W16(0x1286),
+ W16(0x08af)
+};
+
+/*!
+ * \brief CLDFB iRotVectr
+ *
+ * cldfb bands: 32
+ * global gain: 2.50
+ * scale: sqrt(1.0/4.00)
+ */
+const Word16 iRotVectr_32[] =//Q(sqrt(1.0/4.00))
+{
+ W16(0xfec2), W16(0xf4d9), W16(0xeb0b), W16(0xe170), W16(0xd821),
+ W16(0xcf35), W16(0xc6c1), W16(0xbed9), W16(0xb793), W16(0xb0ff),
+ W16(0xab2d), W16(0xa62d), W16(0xa20b), W16(0x9ed0), W16(0x9c84),
+ W16(0x9b2e)
+};
+
+/*!
+ * \brief CLDFB rRotVectr
+ *
+ * cldfb bands: 40
+ * global gain: 2.00
+ * scale: sqrt(1.0/4.00)
+ */
+const Word16 rRotVectr_40[] =//Q(sqrt(1.0/4.00))
+{
+ W16(0x5a81), W16(0x5a28), W16(0x5941), W16(0x57cc), W16(0x55cd),
+ W16(0x5347), W16(0x503d), W16(0x4cb4), W16(0x48b3), W16(0x443e),
+ W16(0x3f5e), W16(0x3a1a), W16(0x347b), W16(0x2e88), W16(0x284c),
+ W16(0x21d0), W16(0x1b1f), W16(0x1444), W16(0x0d48), W16(0x0637)
+};
+
+/*!
+ * \brief CLDFB iRotVectr
+ *
+ * cldfb bands: 40
+ * global gain: 2.00
+ * scale: sqrt(1.0/4.00)
+ */
+const Word16 iRotVectr_40[] =//Q(sqrt(1.0/4.00))
+{
+ W16(0xff1d), W16(0xf803), W16(0xf0f7), W16(0xea02), W16(0xe330),
+ W16(0xdc8b), W16(0xd61f), W16(0xcff4), W16(0xca15), W16(0xc48c),
+ W16(0xbf60), W16(0xba9a), W16(0xb642), W16(0xb25e), W16(0xaef5),
+ W16(0xac0b), W16(0xa9a6), W16(0xa7ca), W16(0xa678), W16(0xa5b4)
+};
+
+/*!
+ * \brief CLDFB rRotVectr
+ *
+ * cldfb bands: 60
+ * global gain: 1.33
+ * scale: sqrt(1.0/2.00)
+ */
+const Word16 rRotVectr_60[] =//Q(sqrt(1.0/2.00))
+{
+ W16(0x6882), W16(0x6855), W16(0x67de), W16(0x671e), W16(0x6615),
+ W16(0x64c5), W16(0x632f), W16(0x6153), W16(0x5f32), W16(0x5ccf),
+ W16(0x5a2a), W16(0x5747), W16(0x5426), W16(0x50ca), W16(0x4d35),
+ W16(0x496a), W16(0x456c), W16(0x413d), W16(0x3ce0), W16(0x3859),
+ W16(0x33aa), W16(0x2ed6), W16(0x29e2), W16(0x24d0), W16(0x1fa5),
+ W16(0x1a63), W16(0x150f), W16(0x0fac), W16(0x0a3e), W16(0x04c9)
+};
+
+/*!
+ * \brief CLDFB iRotVectr
+ *
+ * cldfb bands: 60
+ * global gain: 1.33
+ * scale: sqrt(1.0/2.00)
+ */
+const Word16 iRotVectr_60[] =//Q(sqrt(1.0/2.00))
+{
+ W16(0xff51), W16(0xf9d9), W16(0xf465), W16(0xeefa), W16(0xe99a),
+ W16(0xe44a), W16(0xdf0e), W16(0xd9e9), W16(0xd4de), W16(0xcff2),
+ W16(0xcb27), W16(0xc682), W16(0xc204), W16(0xbdb3), W16(0xb990),
+ W16(0xb59e), W16(0xb1e0), W16(0xae5a), W16(0xab0c), W16(0xa7fb),
+ W16(0xa526), W16(0xa292), W16(0xa03f), W16(0x9e30), W16(0x9c65),
+ W16(0x9ae0), W16(0x99a2), W16(0x98ac), W16(0x97fe), W16(0x9799)
+};
+
+const Word16 cldfb_anaScale[] = // Q0
+{
+ SCALE_CLDFB_ANA_10, SCALE_CLDFB_ANA_16, SCALE_CLDFB_ANA_20, SCALE_CLDFB_ANA_32, SCALE_CLDFB_ANA_40, SCALE_CLDFB_ANA_60, SCALE_CLDFB_ANA_30
+};
+const Word16 cldfb_synScale[] = // Q0
+{
+ SCALE_CLDFB_SYN_10, SCALE_CLDFB_SYN_16, SCALE_CLDFB_SYN_20, SCALE_CLDFB_SYN_32, SCALE_CLDFB_SYN_40, SCALE_CLDFB_SYN_60, SCALE_CLDFB_SYN_30
+};
+const Word16 cldfb_synGain[] =//Q0
+{
+ 0x6666, /* 10 bands */
+ 0x51EC, /* 16 bands */
+ 0x6666, /* 20 bands */
+ 0x51EC, /* 32 bands */
+ 0x6666, /* 40 bands */
+ 0x4CCD /* 60 bands */
+};
+
+const Word16 *cldfb_protoFilter_2_5ms[] =
+{
+ CLDFB80_10, CLDFB80_16, CLDFB80_20, CLDFB80_32, CLDFB80_40, CLDFB80_60, CLDFB80_30
+};
+
+const Word16 cldfb_scale_2_5ms[7] =
+{
+ 22603/*88.293854 Q8*/, /* 10 bands */
+ 22605/*88.299622 Q8*/, /* 16 bands */
+ 22605/*88.300926 Q8*/, /* 20 bands */
+ 22606/*88.303848 Q8*/, /* 32 bands */
+ 22606/*88.304718 Q8*/, /* 40 bands */
+ 22535/*88.028412 Q8*/, /* 60 bands */
+ 22588/*88.234489 Q8*/ /* 30 bands */
+};
+
+const Word16 cldfb_scale_5_0ms[7] =
+{
+ 21649/*88.293854 Q8*/, /* 10 bands */
+ 21649/*88.299622 Q8*/, /* 16 bands */
+ 21649/*88.300926 Q8*/, /* 20 bands */
+ 21649/*88.303848 Q8*/, /* 32 bands */
+ 21649/*88.304718 Q8*/, /* 40 bands */
+ 22535/*88.028412 Q8*/, /* 60 bands */
+ 21581/*88.028412 Q8*/ /* 30 bands */
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_re_L10_fx[5] =
+{
+ 239910864 ,225255952 ,188551424 ,133390176 ,65171760 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_im_L10_fx[5] =
+{
+ -9426123 ,-83101312 ,-148641968 ,-199632496 ,-231081632 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_re_L16_fx[8] =
+{
+ 240023664 ,234262144 ,219498080 ,196298816 ,165555904 ,128450776 ,86409352 ,41047260 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_im_L16_fx[8] =
+{
+ -5892250 ,-52605324 ,-97296808 ,-138249232 ,-173888800 ,-202845936 ,-224007808 ,-236561200 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_re_L20_fx[10] =
+{
+ 240049696 ,236356848 ,226844128 ,211745744 ,191433472 ,166407488 ,137283984 ,104780104 ,69696184 ,32896112 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_im_L20_fx[10] =
+{
+ -4713971 ,-42207980 ,-78662688 ,-113180456 ,-144911344 ,-173074048 ,-196975088 ,-216025936 ,-229757520 ,-237831712 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_re_L30_fx[15] =
+{
+ 240075408 ,238431728 ,234175760 ,227354112 ,218041520 ,206340016 ,192377808 ,176307872 ,
+ 158306272 ,138570240 ,117315992 ,94776408 ,71198440 ,46840400 ,21969170 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_im_L30_fx[15] =
+{
+ -3142759 ,-28220256 ,-52988564 ,-77176320 ,-100518520 ,-122759408 ,-143655328 ,-162977328 ,
+ -180513712 ,-196072352 ,-209482768 ,-220598064 ,-229296448 ,-235482592 ,-239088752 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_re_L32_fx[16] =
+{
+ 240077888 ,238633056 ,234890064 ,228884944 ,220675536 ,210340896 ,197980576 ,183713584 ,
+ 167677328 ,150026240 ,130930336 ,110573488 ,89151760 ,66871456 ,43947140 ,20599588 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_im_L32_fx[16] =
+{
+ -2946347 ,-26463908 ,-49726608 ,-72510408 ,-94595904 ,-115770384 ,-135829936 ,-154581360 ,
+ -171844080 ,-187451856 ,-201254368 ,-213118704 ,-222930576 ,-230595504 ,-236039664 ,-239210640 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_re_L40_fx[20] =
+{
+ 240084400 ,239159360 ,236759824 ,232900592 ,227605456 ,220907040 ,212846672 ,203474016 ,
+ 192846896 ,181030800 ,168098592 ,154130000 ,139211136 ,123434000 ,106895848 ,89698648 ,
+ 71948424 ,53754620 ,35229396 ,16486972 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_im_L40_fx[20] =
+{
+ -2357099 ,-21186638 ,-39885552 ,-58338564 ,-76431896 ,-94054000 ,-111096224 ,-127453512 ,
+ -143025008 ,-157714704 ,-171432032 ,-184092416 ,-195617824 ,-205937184 ,-214986864 ,-222711088 ,
+ -229062224 ,-234001104 ,-237497296 ,-239529232 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_re_L60_fx[30] =
+{
+ 240090832 ,239679552 ,238611328 ,236889088 ,234517552 ,231503216 ,227854352 ,223580960 ,218694736 ,
+ 213209088 ,207139056 ,200501264 ,193313904 ,185596688 ,177370784 ,168658704 ,159484336 ,149872832 ,
+ 139850544 ,129444936 ,118684528 ,107598816 ,96218184 ,84573816 ,72697640 ,60622212 ,48380616 ,
+ 36006412 ,23533520 ,10996123 ,
+};
+
+
+/*Q31*/
+const Word32 rot_vec_syn_im_L60_fx[30] =
+{
+ -1571413 ,-14134643 ,-26659130 ,-39110548 ,-51454764 ,-63657948 ,-75686648 ,-87507896 ,-99089296 ,
+ -110399096 ,-121406296 ,-132080736 ,-142393152 ,-152315264 ,-161819904 ,-170881008 ,-179473744 ,
+ -187574544 ,-195161216 ,-202212960 ,-208710464 ,-214635904 ,-219973040 ,-224707248 ,-228825536 ,
+ -232316640 ,-235170976 ,-237380736 ,-238939840 ,-239844032 ,
+};
+
+
+const Word16 bpf_weights_16_Fx[16] =
+{
+ 16385/*0.500020f Q15*/, 23022/*0.702561f Q15*/, 6843/*0.208838f Q15*/, 51/*0.001553f Q15*/,
+ 58/*0.001777f Q15*/, 45/*0.001370f Q15*/, 30/*0.000926f Q15*/, 18/*0.000554f Q15*/,
+ 9/*0.000270f Q15*/, 3/*0.000080f Q15*/, 1/*0.000030f Q15*/, 3/*0.000082f Q15*/,
+ 3/*0.000081f Q15*/, 2/*0.000052f Q15*/, 1/*0.000017f Q15*/, 1/*0.000016f Q15*/
+};
+
+const Word16 bpf_weights_16_ivas_fx[16] =
+{
+ 32767/*0.999969f Q15*/, 23022/*0.702561f Q15*/, 6843/*0.208838f Q15*/, 51/*0.001553f Q15*/,
+ 58/*0.001777f Q15*/, 45/*0.001370f Q15*/, 30/*0.000926f Q15*/, 18/*0.000554f Q15*/,
+ 9/*0.000270f Q15*/, 3/*0.000080f Q15*/, 1/*0.000030f Q15*/, 3/*0.000082f Q15*/,
+ 3/*0.000081f Q15*/, 2/*0.000052f Q15*/, 1/*0.000017f Q15*/, 1/*0.000016f Q15*/
+};
+const Word32 bpf_weights_16_ivas_fx_32[16] =
+{
+ 1073784774/*1.000040f Q30*/, 754369130/*0.702561f Q30*/, 224238095/*0.208838f Q30*/, 1667521/*0.001553f Q30*/,
+ 1908039/*0.001777f Q30*/, 1435593/*0.001370f Q30*/, 994285/*0.000926f Q30*/, 594853/*0.000554f Q30*/,
+ 289910/*0.000270f Q30*/, 85899/*0.000080f Q30*/, 32212/*0.000030f Q30*/, 88047/*0.000082f Q30*/,
+ 86973/*0.000081f Q30*/, 55835/*0.000052f Q30*/, 18254/*0.000017f Q30*/, 17179/*0.000016f Q30*/
+};
+
+
+/*-------------------------------------------------------------------*
+ * LP CNG excitation details code book
+ *-------------------------------------------------------------------*/
+
+const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG] = /* Q6 */
+{
+ {443,547,613,547,510,471,540,479,586,535,565,611,532,500,462,551,498,463,446,484},
+ {600,499,472,537,633,654,641,646,674,677,687,693,693,690,688,700,693,696,640,571},
+ {529,537,501,582,537,474,505,491,521,545,561,591,566,609,570,608,636,655,649,524},
+ {648,690,689,684,693,599,668,714,663,675,524,519,726,658,673,696,654,715,708,668},
+ {623,630,660,656,686,688,637,666,630,555,470,468,464,445,502,583,615,545,605,592},
+ {659,668,669,625,662,700,700,693,702,702,688,677,654,584,525,492,446,477,634,615},
+ {634,648,656,552,520,557,662,659,572,617,691,683,684,666,673,695,682,698,680,623},
+ {756,743,734,709,730,757,746,722,484,552,779,688,686,610,616,749,758,694,745,729},
+ {549,568,556,625,683,619,609,667,663,684,709,649,691,668,594,511,525,617,542,684},
+ {550,467,533,760,739,692,773,756,743,770,765,791,779,784,775,792,759,577,642,553},
+ {658,674,656,651,670,582,593,520,467,470,522,589,600,596,587,631,652,679,645,669},
+ {788,765,787,797,785,799,787,786,780,692,641,550,501,513,726,747,670,687,734,773},
+ {641,654,668,673,665,682,689,684,697,665,664,593,544,494,458,537,622,650,635,635},
+ {706,753,762,716,748,762,788,792,785,788,799,777,782,766,760,710,704,503,519,735},
+ {748,775,784,635,717,504,539,640,764,778,681,721,791,786,787,780,780,770,774,781},
+ {752,516,624,780,713,753,569,548,770,784,749,740,690,755,776,748,744,730,767,698},
+ {453,471,516,517,561,653,659,616,629,608,682,698,679,681,645,587,594,522,499,469},
+ {617,534,506,615,782,792,754,771,740,787,791,776,782,787,793,788,775,778,651,736},
+ {661,593,490,495,491,495,554,656,658,611,628,660,680,677,698,678,673,699,687,679},
+ {798,793,786,795,799,772,771,696,624,557,507,545,724,757,747,770,780,785,793,784},
+ {703,695,703,714,697,701,697,631,598,498,475,451,503,611,648,664,664,683,679,688},
+ {744,672,659,762,785,745,757,761,761,767,722,757,761,737,699,471,582,770,724,756},
+ {775,746,535,680,541,513,697,723,743,744,769,741,741,738,769,772,779,743,714,724},
+ {767,771,697,756,766,752,710,477,602,783,746,766,692,708,783,782,761,778,787,785},
+ {483,588,700,665,665,640,650,717,699,707,692,698,700,692,668,650,609,610,540,484},
+ {507,618,788,766,754,692,709,785,788,770,793,785,799,784,767,776,789,759,761,495},
+ {709,712,706,678,661,604,503,480,653,664,664,639,621,675,695,689,704,681,711,709},
+ {788,740,770,768,771,776,732,749,739,764,714,492,544,783,714,708,717,559,739,768},
+ {758,771,789,779,777,799,791,785,779,779,752,675,718,510,501,600,727,750,752,758},
+ {759,765,676,658,774,767,737,749,769,784,778,738,755,769,788,756,473,530,777,725},
+ {669,665,721,653,499,774,780,781,767,561,690,747,722,779,757,727,764,745,770,736},
+ {731,768,745,775,783,782,715,741,786,673,766,777,764,730,773,769,774,781,778,764},
+ {557,505,545,604,660,672,604,596,580,612,587,556,546,597,530,494,437,480,546,555},
+ {560,588,510,495,606,720,718,742,756,755,767,774,776,778,772,772,776,776,754,592},
+ {680,644,620,612,516,477,471,499,502,598,664,588,656,682,689,671,668,672,682,692},
+ {757,778,781,799,775,750,799,758,789,774,489,579,799,739,774,723,686,788,787,778},
+ {705,685,654,680,672,680,657,579,574,619,639,518,482,545,665,587,540,599,606,651},
+ {729,767,767,773,783,778,793,773,784,779,757,768,686,654,679,564,483,549,490,522},
+ {725,693,715,588,522,629,721,647,697,684,614,725,708,674,715,729,717,725,689,738},
+ {797,783,795,797,782,757,636,624,508,517,703,750,746,757,772,771,774,790,779,799},
+ {556,591,652,692,728,712,698,688,704,718,728,717,713,693,716,558,490,540,620,678},
+ {532,617,777,775,763,789,768,785,778,791,792,792,793,777,781,724,551,665,540,509},
+ {710,697,706,717,673,679,620,581,546,474,562,684,680,675,660,656,702,680,701,708},
+ {771,793,788,787,794,791,792,783,791,792,733,770,532,525,692,761,777,753,734,728},
+ {724,695,678,652,695,735,697,712,714,721,696,710,569,581,570,522,642,704,748,726},
+ {796,754,785,782,732,814,803,794,799,790,810,806,794,797,756,745,749,506,741,779},
+ {793,767,785,780,724,648,488,747,784,771,793,740,759,805,794,796,795,795,801,806},
+ {787,508,640,775,722,792,774,705,781,801,774,800,786,806,808,783,795,797,784,782},
+ {654,649,601,597,594,667,646,662,615,623,651,671,669,674,682,653,624,484,473,665},
+ {790,765,479,527,746,728,770,753,721,774,794,802,789,782,803,795,764,804,779,776},
+ {738,699,642,509,515,501,466,614,702,612,683,720,687,717,704,739,714,733,721,718},
+ {778,795,791,786,758,783,783,743,744,527,554,789,762,767,722,722,777,788,776,782},
+ {694,696,700,696,709,710,696,689,674,662,581,538,496,637,644,681,679,671,689,704},
+ {776,788,742,796,779,756,788,789,782,798,795,804,771,753,571,611,504,545,593,779},
+ {799,717,747,682,487,573,766,774,775,762,711,802,799,796,790,787,802,789,773,786},
+ {795,797,790,804,788,791,774,706,532,770,786,743,789,708,755,785,804,803,807,770},
+ {568,722,738,680,713,703,693,749,703,705,740,720,712,631,621,727,730,722,574,612},
+ {626,762,734,770,759,750,792,775,790,792,788,786,791,767,782,778,794,745,504,544},
+ {774,784,779,753,654,560,530,532,555,699,742,695,716,767,770,772,778,780,779,782},
+ {781,781,790,783,792,798,787,792,765,740,701,537,564,773,767,756,786,797,789,801},
+ {738,717,799,794,772,784,774,790,788,748,789,769,768,763,504,587,783,751,784,732},
+ {776,789,763,772,800,786,802,787,805,799,776,773,792,761,750,702,532,745,807,735},
+ {765,778,764,484,607,791,757,760,700,687,789,777,779,783,768,791,778,757,784,770},
+ {800,825,775,782,821,679,805,824,752,824,796,785,829,817,824,803,814,807,762,779}
+};
+/*-------------------------------------------------------------------*
+ * FD CNG
+ *-------------------------------------------------------------------*/
+
+const Word16 d_array[SIZE_SCALE_TABLE_CN] = { 1, 2, 5, 8, 10, 15, 20, 30, 40, 60, 80, 120, 140, 160, 180, 220, 260, 300 };
+const Word16 m_array[SIZE_SCALE_TABLE_CN] = { 0/*0.000f Q15*/, 8520/*0.260f Q15*/, 15729/*0.480f Q15*/, 19005/*0.580f Q15*/, 19988/*0.610f Q15*/, 21889/*0.668f Q15*/, 23101/*0.705f Q15*/, 24969/*0.762f Q15*/, 26214/*0.800f Q15*/, 27558/*0.841f Q15*/, 28344/*0.865f Q15*/, 29164/*0.890f Q15*/, 29491/*0.900f Q15*/, 29819/*0.910f Q15*/, 30147/*0.920f Q15*/, 30474/*0.930f Q15*/, 30638/*0.935f Q15*/, 30802/*0.940f Q15*/ };
+const Word16 msQeqInvAv_thresh[3] = { 328/*0.01f Q15*/, 983/*0.03f Q15*/, 1638/*0.05f Q15*/ };
+const Word16 msNoiseSlopeMax[4] = { 32767/*2.f Q14*/, 26214/*1.6f Q14*/, 21299/*1.3f Q14*/, 18022/*1.1f Q14*/ };
+
+
+const SCALE_SETUP scaleTableStereo[SIZE_SCALE_TABLE_STEREO] =
+{
+ { 1, 0, 8000, /* -5.5f,*/ -704/*-5.5f Q7*/, -704 },
+ { 1, 8000, 9600, /* -5.0f,*/ -640/*-5.0f Q7*/, -640 },
+ { 1, 9600, 13200, /* -4.0f,*/ -512/*-4.0f Q7*/, -512 },
+ { 1, 13200, 16400, /* -3.0f,*/ -384/*-3.0f Q7*/, -384 },
+ { 1, 16400, 24400, /* -1.6f,*/ -204/*-1.6f Q7*/, -204 },
+ { 1, 24400, 32000, /* -0.2f,*/ -26/*-1.6f Q7*/, -26 },
+ { 1, 32000,512001, /* 0.0f,*/ 0 /*0.0f Q7*/, 0 },
+
+ { 2, 0, 8000, /*-0.9f ,*/ -115/*-0.9f Q7*/, -115 },
+ { 2, 8000, 9600, /*-0.65f,*/ -83/*-0.65f Q7*/, -83 },
+ { 2, 9600, 13200, /*-2.0f ,*/ -256/*-2.0f Q7*/, -256 },
+ { 2, 13200, 16400, /*-3.0f ,*/ -384/*-3.0f Q7*/, -384 },
+ { 2, 16400, 24400, /*-0.8f ,*/ -102/*-0.8f Q7*/, -102 },
+ { 2, 24400, 32000, /*-0.25f,*/ -32/*-0.25f Q7*/, -32 },
+ { 2, 32000,512001, /* 0.0f ,*/ 0/* 0.0f Q7*/, 0 }
+};
+const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO] =
+{
+ { 0, 0, 8000, /* -5.5f,*/ -704/*-5.5f Q7*/, -704 },
+ { 0, 8000, 9600, /* -5.0f,*/ -640/*-5.0f Q7*/, -640 },
+ { 0, 9600, 13200, /* -4.0f,*/ -512/*-4.0f Q7*/, -512 },
+ { 0, 13200, 16400, /* -3.0f,*/ -384/*-3.0f Q7*/, -384 },
+ { 0, 16400, 24400, /* -1.5f,*/ -192/*-1.5f Q7*/, -192 },
+ { 0, 24400,128001, /* -0.5f,*/ -64/*-0.5f Q7*/, -64 },
+
+ { 1, 0, 8000, /*-5.5f ,*/ -704/*-5.5f Q7*/, -704 },
+ { 1, 8000, 9600, /*-5.0f ,*/ -640/*-5.0f Q7*/, -640 },
+ { 1, 9600, 13200, /*-1.55f,*/ -198/*-1.55f Q7*/, -198 },
+ { 1, 13200, 16400, /*-3.0f ,*/ -384/*-3.0f Q7*/,-384 },
+ { 1, 16400, 24400, /*-0.6f ,*/ -77/*-0.6f Q7*/, -77 },
+ { 1, 24400, 32000, /*-0.2f ,*/ -26/*-0.2f Q7*/, -26 },
+ { 1, 32000,128001, /* 0.0f ,*/ 0/* 0.0f Q7*/, 0 },
+
+ { 2, 0, 8000, /*-0.9f ,*/ -115/*-0.9f Q7*/, -115 },
+ { 2, 8000, 9600, /*-0.65f,*/ -83/*-0.65f Q7*/, -83 },
+ { 2, 9600, 13200, /*-2.0f ,*/ -256/*-2.0f Q7*/, -256 },
+ { 2, 13200, 16400, /*-3.0f ,*/ -384/*-3.0f Q7*/, -384 },
+ { 2, 16400, 24400, /*-0.8f ,*/ -102/*-0.8f Q7*/, -102 },
+ { 2, 24400, 32000, /*-0.25f,*/ -32/*-0.25f Q7*/, -32 },
+ { 2, 32000,128001, /* 0.0f ,*/ 0/* 0.0f Q7*/,0 }
+};
+
+const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN] =
+{
+ { 0, 0, 8000, /*-3.5f,*/ 20295/*1.2387211385 Q14*/ /*-3.5f*/, 20295 },
+ { 0, 8000, 9600, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
+ { 0, 9600, 13200, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 0, 13200, 16400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
+ { 0, 16400,128001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
+
+ { 1, 0, 8000, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
+ { 1, 8000, 9600, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 1, 9600, 13200, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
+ { 1, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 1, 16400, 24400, /*-0.5f,*/ 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 },
+ { 1, 24400,128001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
+
+ { 2, 0, 8000, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 2, 8000, 9600, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 2, 9600, 13200, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
+ { 2, 13200, 16400, /*-1.0f,*/ 4242/*0.2589254379 Q14*/ /*-1.0f*/, 4242 },
+
+ { 2, 16400, 24400, /*-0.5f,*/ 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 },
+ { 2, 24400, 32000, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
+ { 2, 32000,128001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }
+};
+
+const SCALE_SETUP scaleTable_cn_dirac[15] =
+{
+ { 0, 0, 13200, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
+ { 0, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 0, 16400, 24400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
+ { 0, 24400, 32000, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
+ { 0, 32000,512001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
+
+ { 1, 0, 13200, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
+ { 1, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 1, 16400, 24400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
+ { 1, 24400, 32000, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
+ { 1, 32000,512001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 },
+
+ { 2, 0, 13200, /*-3.0f,*/ 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 },
+ { 2, 13200, 16400, /*-2.5f,*/ 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 },
+ { 2, 16400, 24400, /*-2.0f,*/ 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 },
+ { 2, 24400, 32000, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 },
+ { 2, 32000,512001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }
+};
+const Word16 scaleTable_cn_only_amrwbio[3][2] =
+{
+ { ACELP_6k60, 24771/*1.5118864315 Q14*/ },
+ { ACELP_8k85, 16306/*0.9952622652 Q14*/ },
+ { ACELP_12k65, 9583/*0.5848932266 Q14*/ },
+};
+const Word32 scaleTable_cn_only_amrwbio_fx_by_10f[SIZE_SCALE_TABLE_CN_AMRWB][2] =//Q29
+{
+ { ACELP_6k60, 858993459 },
+ { ACELP_8k85, 644245094 },
+ { ACELP_12k65, 429496729 }
+};
+
+const Word16 sidparts_encoder_noise_est[SIZE_SIDPARTS_ENC_NOISE_EST] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 279 }; // Q0
+
+const Word16 sidPartitions_nb[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 159 }; // Q0
+const Word16 sidPartitions_wb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255 }; // Q0
+const Word16 sidPartitions_wb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259 }; // Q0
+const Word16 sidPartitions_wb3[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319 }; // Q0
+const Word16 sidPartitions_swb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 274 }; // Q0
+const Word16 sidPartitions_swb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319, 324, 329, 339 }; // Q0
+
+const Word16 shapingPartitions_nb[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 159 }; // Q0
+const Word16 shapingPartitions_wb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0
+const Word16 shapingPartitions_wb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0
+const Word16 shapingPartitions_wb3[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; // Q0
+const Word16 shapingPartitions_swb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0
+const Word16 shapingPartitions_swb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; // Q0
+
+const FD_CNG_SETUP FdCngSetup_nb = { 512, 160, sizeof(sidPartitions_nb)/sizeof(Word16), sidPartitions_nb, sizeof(shapingPartitions_nb)/sizeof(Word16), shapingPartitions_nb };
+const FD_CNG_SETUP FdCngSetup_wb1 = { 512, 256, sizeof(sidPartitions_wb1)/sizeof(Word16), sidPartitions_wb1, sizeof(shapingPartitions_wb1)/sizeof(Word16), shapingPartitions_wb1 };
+const FD_CNG_SETUP FdCngSetup_wb2 = { 512, 256, sizeof(sidPartitions_wb2)/sizeof(Word16), sidPartitions_wb2, sizeof(shapingPartitions_wb2)/sizeof(Word16), shapingPartitions_wb2 };
+const FD_CNG_SETUP FdCngSetup_wb3 = { 640, 320, sizeof(sidPartitions_wb3)/sizeof(Word16), sidPartitions_wb3, sizeof(shapingPartitions_wb3)/sizeof(Word16), shapingPartitions_wb3 };
+const FD_CNG_SETUP FdCngSetup_swb1 = { 512, 256, sizeof(sidPartitions_swb1)/sizeof(Word16), sidPartitions_swb1, sizeof(shapingPartitions_swb1)/sizeof(Word16), shapingPartitions_swb1 };
+const FD_CNG_SETUP FdCngSetup_swb2 = { 640, 320, sizeof(sidPartitions_swb2)/sizeof(Word16), sidPartitions_swb2, sizeof(shapingPartitions_swb2)/sizeof(Word16), shapingPartitions_swb2 };
+
+
+const Word16 levels_37bits[FD_CNG_stages_37bits] = { 128, 64, 64, 64, 64, 64 }; // Q0
+const Word16 bits_37bits[FD_CNG_stages_37bits] = { 7, 6, 6, 6, 6, 6 }; // Q0
+
+/* IDCT_MATRIX_ROM: 18*24 Word16 = 432 Word16 */
+/* or compressed IDCT_MATRIX_ROM: 18*24 Word8 + 25 = 230 Word16 + WMOPS (INDIRECT(432) and STORE(432) ) */
+
+/* Stage1 Word8 tables 16x8+ 17*10+ 17*16 + 78*18 = = 1974 Word8 -> 987 Word16 */
+
+/* ROM storeSizeW8 = W8reduction (3072- (987+230) )/3072 = 1207/3072 --> 39.3 % */
+/* ROM with DCTII-24 in PROM = W8reduction (3072- (987) )/3072 = /3072 --> 31.8 % */
+
+/* additional minor Table ROM ( dct_mid points 18 Word16, dct_col_upshifts 52, scaleFactors 2*2 = ~= 74 Word16s */
+
+
+const Word16 cdk1_ivas_entries_per_segment[FDCNG_VQ_DCT_NSEGM] = { 16, 17, 17, 78 }; // Q0
+const Word16 cdk1_ivas_cum_entries_per_segment[FDCNG_VQ_DCT_NSEGM + 1] = { 0, 16 ,33, 50, 128 }; // Q0
+const Word16 /* DCT trunc_len */ cdk1_ivas_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MINTRUNC, 10, 16, FDCNG_VQ_DCT_MAXTRUNC }; /* 8, 10, 16, 18 */
+const Word16 /* segment inner DCT trunc_len */ cdk1_ivas_trunc_dct_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MAXTRUNC - FDCNG_VQ_DCT_MINTRUNC, FDCNG_VQ_DCT_MAXTRUNC - 10 , FDCNG_VQ_DCT_MAXTRUNC - 16 , 0 };
+
+/* to get back to FDCNG VQ domain for segment S use : idct as follows */
+/* cdk1r_vec[col, row] = cdk1r_tr_midQ_truncQ(col 1:24 ) + invScaleFQ * idctMat( cdk1_ivas_dct_sS_W8[1:col]<fftlen/2+1; j++) hs->fftSineTab[j] = (float)sin(2.0*EVS_PI*j/hs->fftlen); */
+
+
+const Word32 olapWinAna512_fx[512] = { /* Q30 */
+ 4658693, 13975905, 23292590, 32608396, 41922980, 51235980, 60547056, 69855848,
+ 79162008, 88465192, 97765048, 107061216, 116353360, 125641120, 134924144, 144202096,
+ 153474624, 162741360, 172001968, 181256112, 190503440, 199743568, 208976192, 218200960,
+ 227417488, 236625472, 245824528, 255014368, 264194560, 273364832, 282524800, 291674144,
+ 300812512, 309939520, 319054880, 328158240, 337249248, 346327520, 355392768, 364444672,
+ 373482816, 382506912, 391516576, 400511584, 409491456, 418455904, 427404576, 436337216,
+ 445253408, 454152800, 463035104, 471900032, 480747136, 489576160, 498386752, 507178592,
+ 515951328, 524704608, 533438144, 542151616, 550844672, 559516992, 568168256, 576798144,
+ 585406272, 593992320, 602556096, 611097152, 619615168, 628109888, 636580992, 645028096,
+ 653450880, 661849088, 670222400, 678570432, 686892992, 695189632, 703460096, 711704128,
+ 719921344, 728111424, 736274112, 744409088, 752515968, 760594560, 768644608, 776665664,
+ 784657408, 792619584, 800552064, 808454272, 816326144, 824167232, 831977280, 839756032,
+ 847503104, 855218368, 862901376, 870551936, 878169728, 885754432, 893305728, 900823488,
+ 908307264, 915756864, 923171904, 930552256, 937897664, 945207680, 952482048, 959720640,
+ 966923136, 974089152, 981218496, 988310912, 995366080, 1002383808, 1009363840, 1016305856,
+ 1023209536, 1030074688, 1036901120, 1043688512, 1050436672, 1057145152, 1063813888, 1070442688,
+ 1077031040, 1083578880, 1090085888, 1096551936, 1102976640, 1109359872, 1115701248, 1122000640,
+ 1128257792, 1134472576, 1140644480, 1146773504, 1152859392, 1158901888, 1164900608, 1170855680,
+ 1176766592, 1182633088, 1188455168, 1194232448, 1199964800, 1205651968, 1211293824, 1216889984,
+ 1222440320, 1227944704, 1233402752, 1238814464, 1244179456, 1249497600, 1254768768, 1259992704,
+ 1265169152, 1270297984, 1275378944, 1280411904, 1285396736, 1290333056, 1295220992, 1300060032,
+ 1304850048, 1309591040, 1314282624, 1318924928, 1323517440, 1328060032, 1332552832, 1336995328,
+ 1341387520, 1345729152, 1350020224, 1354260352, 1358449536, 1362587648, 1366674432, 1370709632,
+ 1374693376, 1378625408, 1382505344, 1386333312, 1390109184, 1393832576, 1397503616, 1401121920,
+ 1404687488, 1408200320, 1411659904, 1415066496, 1418419840, 1421719680, 1424966016, 1428158720,
+ 1431297664, 1434382720, 1437413760, 1440390656, 1443313408, 1446181632, 1448995584, 1451755008,
+ 1454459648, 1457109632, 1459704704, 1462244864, 1464729856, 1467159808, 1469534464, 1471853824,
+ 1474117760, 1476326272, 1478479104, 1480576256, 1482617728, 1484603264, 1486533120, 1488406912,
+ 1490224640, 1491986176, 1493691648, 1495340800, 1496933760, 1498470400, 1499950464, 1501374080,
+ 1502741248, 1504051840, 1505305856, 1506503168, 1507643648, 1508727424, 1509754368, 1510724480,
+ 1511637888, 1512494208, 1513293568, 1514035968, 1514721408, 1515349760, 1515921152, 1516435456,
+ 1516892672, 1517292672, 1517635584, 1517921408, 1518150144, 1518321664, 1518435968, 1518493184,
+ 1518493184, 1518435968, 1518321664, 1518150144, 1517921408, 1517635584, 1517292672, 1516892672,
+ 1516435456, 1515921152, 1515349760, 1514721408, 1514035968, 1513293568, 1512494208, 1511637888,
+ 1510724480, 1509754368, 1508727424, 1507643648, 1506503040, 1505305728, 1504051840, 1502741248,
+ 1501374080, 1499950464, 1498470272, 1496933760, 1495340800, 1493691648, 1491986176, 1490224640,
+ 1488406784, 1486533120, 1484603264, 1482617728, 1480576256, 1478479104, 1476326272, 1474117760,
+ 1471853824, 1469534464, 1467159808, 1464729856, 1462244864, 1459704704, 1457109504, 1454459648,
+ 1451754880, 1448995584, 1446181632, 1443313408, 1440390656, 1437413760, 1434382720, 1431297664,
+ 1428158720, 1424966016, 1421719680, 1418419712, 1415066496, 1411659904, 1408200192, 1404687488,
+ 1401121920, 1397503488, 1393832576, 1390109056, 1386333312, 1382505344, 1378625280, 1374693376,
+ 1370709632, 1366674432, 1362587648, 1358449536, 1354260352, 1350020096, 1345729024, 1341387392,
+ 1336995200, 1332552704, 1328060032, 1323517440, 1318924800, 1314282624, 1309590912, 1304850048,
+ 1300059904, 1295220864, 1290333056, 1285396736, 1280411904, 1275378944, 1270297856, 1265169024,
+ 1259992576, 1254768640, 1249497600, 1244179456, 1238814336, 1233402752, 1227944576, 1222440192,
+ 1216889984, 1211293696, 1205651840, 1199964672, 1194232320, 1188455040, 1182632960, 1176766464,
+ 1170855552, 1164900608, 1158901760, 1152859264, 1146773504, 1140644352, 1134472448, 1128257664,
+ 1122000640, 1115701120, 1109359744, 1102976512, 1096551808, 1090085760, 1083578752, 1077030912,
+ 1070442560, 1063813824, 1057145088, 1050436608, 1043688448, 1036901056, 1030074624, 1023209472,
+ 1016305728, 1009363776, 1002383744, 995365952, 988310848, 981218432, 974089024, 966922944,
+ 959720576, 952481920, 945207488, 937897472, 930552192, 923171840, 915756736, 908307072,
+ 900823296, 893305664, 885754240, 878169600, 870551808, 862901248, 855218240, 847503040,
+ 839755968, 831977216, 824167104, 816326016, 808454208, 800551936, 792619520, 784657280,
+ 776665472, 768644480, 760594496, 752515904, 744408960, 736273984, 728111296, 719921216,
+ 711704000, 703460032, 695189504, 686892864, 678570368, 670222272, 661848960, 653450752,
+ 645027968, 636580864, 628109760, 619615104, 611097024, 602555968, 593992256, 585406144,
+ 576798016, 568168128, 559516864, 550844544, 542151488, 533438016, 524704480, 515951200,
+ 507178432, 498386592, 489576032, 480747008, 471899904, 463035040, 454152672, 445253280,
+ 436337056, 427404480, 418455744, 409491328, 400511456, 391516512, 382506816, 373482688,
+ 364444544, 355392672, 346327392, 337249088, 328158112, 319054752, 309939392, 300812384,
+ 291674016, 282524672, 273364704, 264194448, 255014224, 245824400, 236625328, 227417360,
+ 218200832, 208976064, 199743440, 190503312, 181255984, 172001856, 162741232, 153474480,
+ 144201968, 134924016, 125640984, 116353224, 107061080, 97764912, 88465064, 79161880,
+ 69855712, 60546920, 51235848, 41922844, 32608264, 23292456, 13975772, 4658560
+};
+
+const Word32 olapWinAna640_fx[640] = { /* Q30 */
+ 3726956, 11180779, 18634332, 26087438, 33539914, 40991584, 48442264, 55891776,
+ 63339940, 70786584, 78231520, 85674560, 93115552, 100554288, 107990608, 115424328,
+ 122855256, 130283240, 137708080, 145129584, 152547616, 159961952, 167372448, 174778896,
+ 182181152, 189579008, 196972288, 204360832, 211744464, 219122960, 226496192, 233863984,
+ 241226128, 248582448, 255932784, 263276976, 270614784, 277946112, 285270720, 292588448,
+ 299899136, 307202592, 314498688, 321787136, 329067872, 336340672, 343605344, 350861792,
+ 358109728, 365349088, 372579616, 379801184, 387013568, 394216640, 401410208, 408594112,
+ 415768160, 422932192, 430086016, 437229536, 444362464, 451484736, 458596064, 465696416,
+ 472785504, 479863168, 486929344, 493983712, 501026240, 508056672, 515074880, 522080640,
+ 529073824, 536054304, 543021824, 549976256, 556917440, 563845248, 570759424, 577659840,
+ 584546368, 591418816, 598276992, 605120768, 611949952, 618764352, 625563904, 632348352,
+ 639117568, 645871424, 652609664, 659332224, 666038848, 672729472, 679403776, 686061824,
+ 692703360, 699328128, 705936064, 712526976, 719100736, 725657216, 732196160, 738717440,
+ 745220992, 751706496, 758173952, 764623104, 771053888, 777466048, 783859456, 790234048,
+ 796589568, 802925888, 809242816, 815540288, 821818048, 828076096, 834314176, 840532096,
+ 846729856, 852907136, 859063872, 865199872, 871315072, 877409344, 883482368, 889534144,
+ 895564480, 901573248, 907560320, 913525504, 919468672, 925389632, 931288320, 937164672,
+ 943018240, 948849280, 954657344, 960442432, 966204416, 971943104, 977658304, 983350016,
+ 989017984, 994662144, 1000282368, 1005878464, 1011450368, 1016997760, 1022520768, 1028019136,
+ 1033492736, 1038941376, 1044364992, 1049763520, 1055136768, 1060484416, 1065806656, 1071103168,
+ 1076373888, 1081618688, 1086837376, 1092029952, 1097196160, 1102335872, 1107449088, 1112535680,
+ 1117595392, 1122628224, 1127633920, 1132612480, 1137563776, 1142487680, 1147383936, 1152252672,
+ 1157093632, 1161906688, 1166691712, 1171448576, 1176177280, 1180877696, 1185549568, 1190193024,
+ 1194807680, 1199393536, 1203950464, 1208478464, 1212977408, 1217447040, 1221887232, 1226298112,
+ 1230679424, 1235031040, 1239352960, 1243644928, 1247907072, 1252139008, 1256340864, 1260512384,
+ 1264653440, 1268764288, 1272844288, 1276893824, 1280912512, 1284900352, 1288857216, 1292782976,
+ 1296677760, 1300541056, 1304373120, 1308173824, 1311942912, 1315680512, 1319386240, 1323060224,
+ 1326702336, 1330312576, 1333890688, 1337436672, 1340950400, 1344431872, 1347880960, 1351297536,
+ 1354681472, 1358032896, 1361351424, 1364637312, 1367890304, 1371110272, 1374297216, 1377451008,
+ 1380571776, 1383659136, 1386713216, 1389733760, 1392720896, 1395674496, 1398594432, 1401480704,
+ 1404333312, 1407151872, 1409936640, 1412687360, 1415404160, 1418086784, 1420735232, 1423349376,
+ 1425929344, 1428475008, 1430986112, 1433462784, 1435904896, 1438312448, 1440685312, 1443023360,
+ 1445326848, 1447595392, 1449828992, 1452027776, 1454191616, 1456320256, 1458413824, 1460472448,
+ 1462495616, 1464483712, 1466436480, 1468353920, 1470235904, 1472082688, 1473893760, 1475669376,
+ 1477409536, 1479113984, 1480782720, 1482416000, 1484013440, 1485575040, 1487100928, 1488591104,
+ 1490045184, 1491463424, 1492845824, 1494192256, 1495502592, 1496776960, 1498015232, 1499217280,
+ 1500383360, 1501513344, 1502606976, 1503664512, 1504685824, 1505670912, 1506619520, 1507532032,
+ 1508408192, 1509247872, 1510051200, 1510818304, 1511548928, 1512243072, 1512900864, 1513522176,
+ 1514107008, 1514655360, 1515167104, 1515642496, 1516081408, 1516483584, 1516849280, 1517178496,
+ 1517471232, 1517727232, 1517946752, 1518129664, 1518276096, 1518385792, 1518459008, 1518495488,
+ 1518495488, 1518459008, 1518385792, 1518276096, 1518129664, 1517946752, 1517727232, 1517471104,
+ 1517178496, 1516849280, 1516483584, 1516081280, 1515642496, 1515167104, 1514655360, 1514107008,
+ 1513522176, 1512900864, 1512243072, 1511548928, 1510818304, 1510051200, 1509247872, 1508408192,
+ 1507532032, 1506619520, 1505670912, 1504685696, 1503664512, 1502606976, 1501513344, 1500383360,
+ 1499217280, 1498015232, 1496776960, 1495502592, 1494192128, 1492845824, 1491463424, 1490045184,
+ 1488590976, 1487100928, 1485575040, 1484013312, 1482416000, 1480782720, 1479113984, 1477409536,
+ 1475669376, 1473893760, 1472082560, 1470235904, 1468353920, 1466436480, 1464483712, 1462495616,
+ 1460472320, 1458413824, 1456320256, 1454191488, 1452027776, 1449828992, 1447595392, 1445326848,
+ 1443023360, 1440685312, 1438312448, 1435904768, 1433462656, 1430986112, 1428474880, 1425929344,
+ 1423349376, 1420735104, 1418086784, 1415404160, 1412687360, 1409936640, 1407151872, 1404333184,
+ 1401480704, 1398594432, 1395674496, 1392720896, 1389733760, 1386713088, 1383659008, 1380571648,
+ 1377451008, 1374297216, 1371110272, 1367890304, 1364637312, 1361351424, 1358032768, 1354681472,
+ 1351297408, 1347880832, 1344431744, 1340950272, 1337436672, 1333890688, 1330312576, 1326702336,
+ 1323060224, 1319386240, 1315680384, 1311942912, 1308173696, 1304373120, 1300541056, 1296677632,
+ 1292782848, 1288857088, 1284900224, 1280912512, 1276893696, 1272844288, 1268764160, 1264653440,
+ 1260512256, 1256340736, 1252138880, 1247906944, 1243644800, 1239352832, 1235030912, 1230679296,
+ 1226297984, 1221887104, 1217446912, 1212977280, 1208478336, 1203950464, 1199393408, 1194807552,
+ 1190192896, 1185549440, 1180877696, 1176177280, 1171448576, 1166691584, 1161906560, 1157093504,
+ 1152252544, 1147383808, 1142487552, 1137563648, 1132612352, 1127633792, 1122628096, 1117595264,
+ 1112535552, 1107448960, 1102335872, 1097196032, 1092029824, 1086837248, 1081618560, 1076373888,
+ 1071103104, 1065806592, 1060484352, 1055136576, 1049763456, 1044364928, 1038941312, 1033492608,
+ 1028019072, 1022520704, 1016997696, 1011450240, 1005878400, 1000282304, 994662080, 989017920,
+ 983349888, 977658240, 971942976, 966204288, 960442368, 954657280, 948849152, 943018176,
+ 937164480, 931288192, 925389504, 919468544, 913525312, 907560192, 901573184, 895564416,
+ 889534016, 883482304, 877409152, 871314944, 865199808, 859063744, 852907008, 846729728,
+ 840532032, 834314112, 828075968, 821817984, 815540096, 809242752, 802925696, 796589376,
+ 790233856, 783859392, 777465984, 771053824, 764622976, 758173824, 751706432, 745220864,
+ 738717312, 732196032, 725657088, 719100608, 712526848, 705935936, 699328000, 692703232,
+ 686061760, 679403712, 672729280, 666038720, 659332096, 652609536, 645871296, 639117440,
+ 632348224, 625563776, 618764224, 611949824, 605120640, 598276864, 591418688, 584546240,
+ 577659712, 570759296, 563845120, 556917312, 549976128, 543021696, 536054144, 529073696,
+ 522080512, 515074752, 508056512, 501026112, 493983648, 486929216, 479863072, 472785376,
+ 465696288, 458596000, 451484608, 444362336, 437229408, 430085952, 422932064, 415768032,
+ 408593952, 401410080, 394216512, 387013440, 379801024, 372579456, 365348960, 358109632,
+ 350861664, 343605248, 336340544, 329067744, 321787008, 314498528, 307202464, 299899008,
+ 292588320, 285270592, 277945984, 270614656, 263276832, 255932656, 248582320, 241225984,
+ 233863840, 226496064, 219122832, 211744320, 204360704, 196972144, 189578864, 182181008,
+ 174778768, 167372304, 159961824, 152547472, 145129456, 137707936, 130283104, 122855136,
+ 115424192, 107990472, 100554160, 93115416, 85674432, 78231384, 70786448, 63339808,
+ 55891640, 48442128, 40991448, 33539780, 26087306, 18634200, 11180647, 3726823
+};
+
+/* Synthesis windows for overlap-add */
+/* for (j=0; jfftlen; j++) hs->olapWinSyn[j] = (float)sin(EVS_PI*((float)j+0.5f)/(float)(hs->fftlen); */
+
+const Word16 olapWinSyn256_fx[256] =
+{//Q15
+ 201, 603, 1005, 1407, 1808, 2210, 2611, 3011, 3411, 3811, 4210, 4609, 5006, 5403, 5800, 6195,
+ 6589, 6983, 7375, 7766, 8156, 8545, 8933, 9319, 9704, 10087, 10469, 10849, 11228, 11605, 11980, 12353,
+ 12725, 13094, 13462, 13828, 14191, 14552, 14912, 15269, 15623, 15976, 16325, 16673, 17018, 17360, 17700, 18037,
+ 18371, 18703, 19032, 19358, 19681, 20001, 20318, 20631, 20942, 21250, 21555, 21856, 22154, 22448, 22740, 23027,
+ 23312, 23593, 23870, 24144, 24414, 24680, 24943, 25201, 25457, 25708, 25955, 26199, 26438, 26674, 26905, 27133,
+ 27356, 27576, 27791, 28002, 28208, 28411, 28609, 28803, 28993, 29178, 29359, 29535, 29707, 29874, 30037, 30196,
+ 30350, 30499, 30644, 30784, 30919, 31050, 31176, 31298, 31414, 31526, 31634, 31736, 31834, 31927, 32015, 32098,
+ 32176, 32250, 32319, 32383, 32442, 32496, 32545, 32589, 32629, 32663, 32693, 32718, 32737, 32752, 32762, 32767,
+ 32767, 32762, 32752, 32737, 32718, 32693, 32663, 32629, 32589, 32545, 32496, 32442, 32383, 32319, 32250, 32176,
+ 32098, 32015, 31927, 31834, 31736, 31634, 31526, 31414, 31298, 31176, 31050, 30919, 30784, 30644, 30499, 30350,
+ 30196, 30037, 29874, 29707, 29535, 29359, 29178, 28993, 28803, 28609, 28411, 28208, 28002, 27791, 27576, 27356,
+ 27133, 26905, 26674, 26438, 26199, 25955, 25708, 25457, 25201, 24943, 24680, 24414, 24144, 23870, 23593, 23312,
+ 23027, 22740, 22448, 22154, 21856, 21555, 21250, 20942, 20631, 20318, 20001, 19681, 19358, 19032, 18703, 18371,
+ 18037, 17700, 17360, 17018, 16673, 16325, 15976, 15623, 15269, 14912, 14552, 14191, 13828, 13462, 13094, 12725,
+ 12353, 11980, 11605, 11228, 10849, 10469, 10087, 9704, 9319, 8933, 8545, 8156, 7766, 7375, 6983, 6589,
+ 6195, 5800, 5403, 5006, 4609, 4210, 3811, 3411, 3011, 2611, 2210, 1808, 1407, 1005, 603, 201
+};
+
+
+const Word16 olapWinSyn320_fx[320] =
+{//Q15
+ 160, 482, 804, 1125, 1447, 1768, 2089, 2410, 2731, 3051,
+ 3371, 3691, 4011, 4330, 4648, 4967, 5284, 5602, 5918, 6234,
+ 6550, 6865, 7179, 7493, 7805, 8117, 8429, 8739, 9049, 9358,
+ 9665, 9972, 10278, 10583, 10887, 11190, 11492, 11793, 12092, 12391,
+ 12688, 12984, 13278, 13572, 13864, 14155, 14444, 14732, 15019, 15304,
+ 15588, 15870, 16151, 16430, 16707, 16983, 17258, 17530, 17801, 18070,
+ 18338, 18604, 18868, 19130, 19390, 19648, 19905, 20159, 20412, 20663,
+ 20911, 21158, 21403, 21645, 21886, 22124, 22360, 22594, 22826, 23056,
+ 23283, 23509, 23732, 23952, 24171, 24387, 24600, 24812, 25021, 25227,
+ 25431, 25633, 25832, 26029, 26223, 26415, 26604, 26790, 26974, 27155,
+ 27334, 27510, 27684, 27854, 28023, 28188, 28351, 28511, 28668, 28822,
+ 28974, 29123, 29269, 29412, 29552, 29690, 29825, 29956, 30085, 30211,
+ 30334, 30455, 30572, 30686, 30797, 30906, 31011, 31114, 31213, 31309,
+ 31403, 31493, 31581, 31665, 31746, 31824, 31899, 31971, 32040, 32106,
+ 32169, 32229, 32285, 32339, 32389, 32436, 32480, 32521, 32559, 32594,
+ 32625, 32653, 32679, 32701, 32720, 32736, 32748, 32758, 32764, 32767,
+ 32767, 32764, 32758, 32748, 32736, 32720, 32701, 32679, 32653, 32625,
+ 32594, 32559, 32521, 32480, 32436, 32389, 32339, 32285, 32229, 32169,
+ 32106, 32040, 31971, 31899, 31824, 31746, 31665, 31581, 31493, 31403,
+ 31309, 31213, 31114, 31011, 30906, 30797, 30686, 30572, 30455, 30334,
+ 30211, 30085, 29956, 29825, 29690, 29552, 29412, 29269, 29123, 28974,
+ 28822, 28668, 28511, 28351, 28188, 28023, 27854, 27684, 27510, 27334,
+ 27155, 26974, 26790, 26604, 26415, 26223, 26029, 25832, 25633, 25431,
+ 25227, 25021, 24812, 24600, 24387, 24171, 23952, 23732, 23509, 23283,
+ 23056, 22826, 22594, 22360, 22124, 21886, 21645, 21403, 21158, 20911,
+ 20663, 20412, 20159, 19905, 19648, 19390, 19130, 18868, 18604, 18338,
+ 18070, 17801, 17530, 17258, 16983, 16707, 16430, 16151, 15870, 15588,
+ 15304, 15019, 14732, 14444, 14155, 13864, 13572, 13278, 12984, 12688,
+ 12391, 12092, 11793, 11492, 11190, 10887, 10583, 10278, 9972, 9665,
+ 9358, 9049, 8739, 8429, 8117, 7805, 7493, 7179, 6865, 6550,
+ 6234, 5918, 5602, 5284, 4967, 4648, 4330, 4011, 3691, 3371,
+ 3051, 2731, 2410, 2089, 1768, 1447, 1125, 804, 482, 160
+};
+
+/*-------------------------------------------------------------------*
+ * AMR-WB ISF codebook - common 1st stage for 46bit and 36bit codebooks,
+ * 2 splits
+ *
+ * codebook vector dimension number of vectors
+ * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
+ * 1_1 9 256
+ * 1_2 7 256
+ *-------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------*
+ * 1nd stage, 1st split: ISF0 to ISF8
+ *-------------------------------------------------------------------*/
+
+const Word16 dico1_isf_fx[] =
+{/*Qlog2(2.56)*/
+ 740, 1263, 1292, 1006, 997, 1019, 1017, 976, 923,
+ 557, 946, 1049, 867, 846, 990, 1112, 1262, 1241,
+ 633, 898, 996, 756, 662, 683, 783, 909, 996,
+ 830, 736, 278, 820, 1254, 686, 712, 1039, 473,
+ 503, 885, 1508, 1307, 1282, 1172, 1119, 1209, 1061,
+ 416, 719, 989, 1227, 1001, 1052, 954, 741, 1044,
+ 585, 1132, 1233, 1091, 1247, 1433, 1512, 1448, 1314,
+ -31, 469, 803, 659, 619, 658, 843, 987, 1113,
+ 842, 1678, 1841, 1549, 1474, 1256, 1082, 905, 742,
+ 370, 1216, 1768, 1633, 1212, 636, 22, -330, 71,
+ 73, 738, 893, 968, 993, 1768, 2273, 1840, 1391,
+ 1513, 1714, 1238, 534, 276, 315, 461, 459, 508,
+ 421, 1293, 1640, 1623, 1742, 1617, 1499, 1284, 1006,
+ -95, 752, 1680, 1569, 1618, 1436, 1200, 980, 712,
+ -78, 831, 1194, 1110, 1378, 1481, 1492, 1365, 1217,
+ 670, 1208, 1168, 860, 742, 601, 528, 403, 309,
+ 397, 621, 966, 752, 579, 398, 400, 329, 252,
+ 510, 864, 1108, 807, 939, 902, 925, 717, 481,
+ 539, 835, 913, 719, 617, 544, 591, 565, 642,
+ 162, 889, 654, 108, -34, 244, 488, 561, 532,
+ -62, 1033, 1308, 1035, 1127, 1098, 1029, 961, 823,
+ -14, 945, 990, 801, 755, 815, 847, 913, 892,
+ 394, 1765, 1666, 1339, 1117, 806, 642, 479, 380,
+ 529, 1851, 2003, 1228, 622, -41, -416, 344, 819,
+ 635, 1058, 883, 492, 372, 312, 317, 274, 241,
+ 279, 966, 1642, 1478, 1463, 1123, 795, 525, 339,
+ 457, 955, 1177, 1214, 1427, 1457, 1345, 917, 539,
+ 148, 751, 1515, 1105, 867, 606, 474, 448, 399,
+ 579, 1081, 1035, 390, 3, -263, -198, -82, 38,
+ 18, -68, -12, 313, 761, 405, 249, 111, -76,
+ -91, 827, 948, 648, 613, 535, 522, 490, 421,
+ 41, -44, -281, -472, 652, 534, 193, 135, -90,
+ 41, -121, -356, -60, 663, 307, 61, -48, -344,
+ -118, -204, 328, 512, 870, 793, 610, 402, 186,
+ 156, 293, 74, -338, -475, -897, -594, -161, -497,
+ 226, 131, -138, 307, 169, -271, -164, -387, -624,
+ 62, -32, -61, -252, -541, -828, -1027, -523, -662,
+ 102, -61, 141, 112, -270, -251, -541, 25, -150,
+ 6, -132, -356, -686, -96, -322, -522, -31, -326,
+ -36, -209, -521, -229, 307, -132, -5, -99, -384,
+ 60, -51, -237, -668, -973, -407, -708, -75, -172,
+ 26, -138, -266, 111, -302, 43, -278, -356, -359,
+ 570, 822, 496, -154, -312, -92, 137, 279, 371,
+ -146, 368, 409, 68, 6, 77, 167, 202, 162,
+ -103, 294, 607, 415, 483, 462, 480, 431, 408,
+ -120, -338, -612, -524, 584, 331, 92, 433, 276,
+ -178, -293, -154, -41, 269, 100, -9, 213, 160,
+ -218, -304, 463, 454, 397, 273, 202, 286, 273,
+ -232, 7, 6, -388, -472, -427, -378, -167, -100,
+ -294, -183, 134, -47, 101, -88, -84, -117, -3,
+ 57, 17, -202, -634, -989, -1119, -533, 176, -36,
+ 120, -28, 23, 111, -319, 318, -22, -77, 266,
+ -271, -464, -434, -658, -640, -385, -385, -99, -69,
+ -198, -259, -266, -44, -39, -139, -137, 171, 66,
+ 9, -145, -377, -846, -1000, -111, -325, 342, 135,
+ -81, -286, -380, 192, -57, 307, 76, -24, -140,
+ 677, 702, 247, 56, 249, 141, -105, -236, -99,
+ 36, -39, -69, 348, 198, -93, 322, 91, -72,
+ -127, -376, -657, 139, 623, 223, 501, 306, 220,
+ -113, -384, -796, 504, 438, 85, 213, -83, -194,
+ -174, -422, 7, 1155, 1089, 1182, 1003, 945, 806,
+ 8, -126, -317, -103, -351, -695, -98, -268, -537,
+ 33, -103, -290, 167, -39, -407, 44, -208, -375,
+ 104, -23, -64, -291, -637, -851, -1084, -61, -112,
+ -75, -306, -434, 218, -148, -354, -680, -133, -216,
+ -121, -377, -718, -97, -130, -361, -156, -379, -599,
+ -56, -254, -586, 235, 157, -214, 11, -260, -149,
+ -124, -267, -397, -580, -593, -527, -805, -385, 346,
+ -193, -440, -708, -351, -141, -255, -499, -147, -185,
+ 448, 660, 494, 208, 509, 461, 338, 291, 149,
+ -223, 88, 335, 159, 212, 191, 286, 308, 205,
+ -171, -242, 514, 362, 295, 524, 552, 694, 585,
+ -64, -308, -448, -21, 284, 786, 446, 289, 92,
+ -218, -390, -7, 169, 206, 330, 352, 408, 358,
+ -36, 702, 959, 859, 861, 1115, 1269, 1357, 1305,
+ -133, -341, -65, 678, 417, 440, 486, 518, 780,
+ 33, -44, -191, -344, -461, -755, -201, 217, -31,
+ -353, -547, -44, 123, -61, -68, -79, 29, 60,
+ 73, -57, -406, -766, -1243, -1203, 240, 400, 165,
+ -73, -282, -601, -213, -171, -375, 332, 35, -103,
+ -29, -207, -553, -476, -638, -908, 172, -22, -135,
+ -192, -239, -164, -103, -111, -47, 153, 125, 110,
+ -1, -203, -570, -1030, -1424, -535, 155, 1, 147,
+ -333, -653, -865, -197, -158, -21, -44, 95, 108,
+ 389, 588, 490, 33, -237, -524, -628, -136, -260,
+ 40, -177, -462, 453, 862, 380, 131, -130, -405,
+ -76, -281, -741, -742, 898, 619, 277, 71, -222,
+ -32, -265, -556, -25, 994, 682, 305, 126, -165,
+ -69, -349, -585, 234, 1158, 903, 626, 510, 251,
+ -1, -99, -272, -210, -603, -351, -540, -811, -383,
+ -16, -230, -504, 410, 149, -205, -343, -651, -639,
+ 103, -9, -227, -205, -562, -781, -1079, -1208, -156,
+ 143, 63, -135, -67, -317, -602, -784, -1154, -640,
+ -144, -391, -674, -622, -200, -254, -660, -947, -395,
+ -40, -250, -625, 27, 543, 94, -131, -386, -673,
+ -123, -371, -757, -451, -564, -614, -415, -711, -35,
+ -116, -309, -593, -268, 239, -33, -338, -650, -135,
+ 94, 251, 554, 57, -312, -423, -154, -57, 235,
+ -268, -71, 381, 114, -44, -87, 125, 173, 133,
+ -131, -19, 1149, 670, 486, 356, 309, 369, 296,
+ -223, -501, -899, -722, -70, 6, 131, 310, 394,
+ -99, -303, -517, 249, 64, -53, 135, -11, 453,
+ -147, -399, -730, -401, 817, 738, 802, 749, 575,
+ -154, -435, -739, 800, 593, 366, 529, 318, 326,
+ -224, 45, -39, -387, -515, -518, -608, -384, -321,
+ -315, -377, 143, -101, -113, -377, -177, -144, -12,
+ 117, 40, -239, -651, -1051, -581, -737, -990, -328,
+ 26, -50, -157, -23, -453, -283, -531, -546, 192,
+ -252, -501, -743, -589, -627, -499, -328, -118, -72,
+ -324, -494, -244, -306, -144, -177, -262, -135, -78,
+ -36, -234, -519, -961, -1290, -314, -479, -371, -45,
+ -95, -292, -535, -8, -300, 112, -164, -277, 198,
+ -99, -128, 880, 836, 579, 351, 23, -95, -217,
+ -27, -258, 124, 1011, 597, 425, 144, 7, -73,
+ -69, -300, -683, -435, 1132, 899, 504, 332, 109,
+ -74, -323, -637, 563, 1074, 608, 371, 105, -49,
+ -259, -121, 1440, 1334, 1628, 1490, 1438, 1223, 933,
+ -82, -306, -613, -222, -378, -675, -545, -671, -845,
+ 53, -124, -347, 422, 52, -125, -270, -529, 9,
+ 79, -89, -320, -662, -999, -1199, -1243, -676, -297,
+ -68, -273, -611, 137, -146, -397, -627, -845, -220,
+ -112, -346, -797, -826, 234, -132, -188, -278, -522,
+ -159, -405, -734, -419, 293, 74, -167, -167, 184,
+ -153, -437, -833, -1080, -336, -472, -561, -340, -253,
+ -169, -423, -820, -904, -131, -19, -346, -604, 31,
+ 33, -31, 312, 62, -148, 49, -59, 564, 486,
+ -306, -333, 194, -44, 67, 72, 147, 205, 243,
+ -207, -49, 1360, 983, 969, 991, 1014, 1110, 973,
+ -211, -172, 883, 627, 711, 674, 705, 798, 746,
+ -88, -325, -763, -974, 687, 908, 514, 382, 172,
+ -292, -612, -805, 63, 131, 270, 259, 352, 348,
+ -235, -84, 955, 818, 1120, 1289, 1559, 1480, 1285,
+ -180, -461, -614, 657, 691, 745, 854, 783, 713,
+ -97, -309, -477, -614, -777, -734, -768, -526, -472,
+ -344, -476, -35, -169, 49, -77, -150, -240, -141,
+ -52, -268, -639, -919, -1278, -1113, -342, -333, -151,
+ -68, -242, -585, -73, -209, -478, -159, -429, 133,
+ -197, -499, -1005, -1268, -272, -224, -105, -67, 17,
+ -363, -618, -414, -116, -62, 20, 10, 116, 108,
+ -195, -475, -906, -1260, -891, -441, -277, -142, -28,
+ -226, -519, -950, -700, -275, -266, -116, -105, 82,
+ 404, 511, 520, 327, 17, -194, -333, -536, -586,
+ -114, -130, 276, 237, 204, 342, 135, -16, -111,
+ 191, 180, -137, -467, 272, 106, -95, 17, -192,
+ -80, -290, -626, 194, 598, 196, 21, -281, 77,
+ 137, 367, 534, 764, 670, 382, 296, 153, 84,
+ 303, 497, 144, -85, -125, -539, -482, -464, -764,
+ 233, 347, 68, -147, 169, -210, -242, -226, -482,
+ 307, 422, 154, -175, -386, -722, -724, -904, -1015,
+ 309, 308, 160, -60, -470, -420, -598, -791, -219,
+ 68, 121, -137, -560, -146, -446, -515, -494, -729,
+ 130, 53, -227, 46, 474, 32, -161, -192, -490,
+ 213, 164, -71, -465, -876, -161, -456, -587, -48,
+ 218, 117, 39, 177, -194, -88, -226, -418, 50,
+ 210, 547, 569, 279, 121, -44, -50, 10, -84,
+ 58, 140, 182, -5, 267, 117, 106, 211, 198,
+ 153, 559, 872, 460, 222, 108, 188, 180, 183,
+ 158, 119, 284, -153, -271, 229, 87, 110, -57,
+ -183, 82, 118, 21, 13, 40, 118, 191, 185,
+ 163, 56, 609, 341, 50, 329, 68, 266, 218,
+ 100, 206, 18, -304, -107, -436, -487, -65, -306,
+ -86, 154, 134, -30, -45, -73, -104, -80, -96,
+ 245, 330, 10, -440, -849, -1082, 79, 40, -265,
+ 196, 372, 272, -181, -493, -389, 275, 80, -59,
+ 2, -12, -246, -505, -100, -436, 21, -187, -431,
+ -221, -48, 36, -271, -186, -147, -109, 26, 71,
+ 213, 140, 72, -351, -620, -84, -363, 69, 46,
+ 91, 167, -3, -95, -99, -105, -48, 114, 147,
+ 259, 249, 172, 607, 406, 52, 59, -189, -320,
+ 115, -85, -54, 574, 128, 226, -59, -253, 130,
+ 39, 364, 757, 940, 728, 660, 659, 583, 770,
+ -115, -338, -760, -471, 394, 37, 441, 178, 6,
+ -57, -305, -525, 796, 453, 188, -4, -114, 248,
+ 71, 444, 797, 731, 1096, 1157, 1222, 1029, 811,
+ 135, 359, 551, 425, 749, 815, 874, 704, 502,
+ 132, 247, 0, -206, -449, -750, -258, -514, -633,
+ 248, 249, 91, 121, -195, -499, -90, -282, -435,
+ 78, 20, -277, -623, -983, -1224, -415, -458, -639,
+ 347, 509, 208, -179, -464, -728, -76, -237, -486,
+ -103, -343, -756, -713, -265, -609, -191, -398, -636,
+ -121, -383, -749, 567, 252, -36, -354, -417, -50,
+ 204, 100, -149, -650, -1081, -47, -7, -263, 111,
+ -46, -180, -267, -324, -562, -394, -692, 398, 292,
+ 482, 670, 683, 624, 442, 165, 116, 36, -149,
+ 108, 247, 291, 247, 355, 122, 109, 224, 296,
+ 292, 349, 725, 482, 388, 329, 429, 620, 667,
+ -34, 197, 213, -127, 84, 494, 620, 575, 375,
+ 126, 207, 172, 167, 362, 202, 296, 395, 455,
+ -6, 250, 539, 467, 636, 801, 1149, 1287, 1118,
+ 27, 240, 369, 280, 440, 411, 634, 892, 953,
+ 159, 170, -58, -395, -797, -690, 77, -211, -334,
+ -5, -28, -13, -74, -335, -603, 300, 88, -205,
+ 82, -33, -364, -698, -1203, -1153, 110, -146, -289,
+ 113, 1, -243, -588, -994, -496, 414, 160, 42,
+ -56, -247, -440, -693, -996, -479, 11, -178, -357,
+ -151, -353, -327, -211, -340, 141, 65, 425, 453,
+ 34, -169, -455, -932, -1215, 138, 499, 256, 324,
+ 68, 139, -15, -547, -478, 17, 306, 502, 481,
+ -32, -134, 445, 129, -143, -244, -503, -507, -599,
+ 61, -140, -345, 496, 458, -2, 20, -227, -514,
+ 215, 519, 920, 1053, 1090, 791, 528, 290, 155,
+ -54, -233, -647, -602, 639, 294, -2, -167, -442,
+ -78, -315, -791, -113, 820, 403, 158, -116, -356,
+ -105, -379, -236, 1224, 893, 749, 568, 356, 214,
+ -17, -199, -144, 50, -283, -247, -578, -846, -1087,
+ 69, -11, -381, -206, 209, -284, -387, -416, -716,
+ 39, -5, -145, -374, -682, -909, -1074, -1169, -1066,
+ 287, 226, 67, -221, -662, -171, -421, -642, -707,
+ -132, -348, -538, -448, -20, -4, -354, -748, -933,
+ 4, -75, -289, -598, 317, 52, -208, -297, -559,
+ -88, -264, -358, -589, -631, -248, -523, -822, -1071,
+ 70, -8, 54, -314, -515, 92, -146, -274, -493,
+ 199, 62, 391, 158, -141, 71, -219, -203, -207,
+ 152, 40, 329, 162, -29, 48, -149, 108, 127,
+ 267, 722, 1256, 882, 625, 248, 8, -81, -60,
+ -58, -138, -291, -600, -12, -2, -39, 147, 117,
+ -107, -345, -513, 459, 76, 92, -272, 388, 262,
+ 362, 516, 203, -409, -716, -831, -331, 185, 209,
+ -117, -391, -298, 671, 292, 538, 257, 166, -38,
+ -102, -319, -194, -283, -573, -262, -579, -219, -444,
+ -235, 78, 11, -168, -101, -229, -263, -321, -123,
+ 70, 50, -170, -599, -996, -588, -263, -516, -455,
+ 394, 363, 229, -136, -538, 21, -183, -348, -201,
+ -124, -368, -640, -879, -847, -209, -409, -494, -515,
+ -127, -341, -541, -425, -510, -10, -252, -473, -291,
+ 84, -69, -201, -676, -868, 103, -311, -132, -320,
+ 5, -173, -188, -297, -628, 197, -57, 7, -11,
+ 49, -160, 56, 558, 111, 33, -311, -440, -463,
+ -1, -246, -307, 862, 453, 139, -170, -355, -232,
+ -197, -38, 1702, 1331, 1252, 950, 692, 504, 426,
+ -108, -344, -861, -1172, 444, 354, 88, -46, -220,
+ -53, -321, -494, 1113, 744, 364, 198, -34, -75,
+ -69, 199, 897, 1140, 1343, 1183, 977, 742, 522,
+ 122, 44, -269, 27, -155, -562, -307, -590, -773,
+ 154, 42, -160, 252, -129, -305, -471, -733, -371,
+ 135, 185, -82, -416, -722, -913, -504, -743, -880,
+ 149, 214, -84, -329, -680, -835, -426, -661, -81,
+ -128, -380, -735, -998, -337, 17, -182, -467, -697,
+ -84, -290, -510, -592, 13, 440, 154, -38, -279,
+ 70, -61, -246, -727, -1047, -80, -381, -535, -704,
+ 178, -2, -146, -670, -938, 482, 138, 63, 65,
+ -11, 15, 772, 443, 142, -20, -209, -126, -161,
+ -32, -249, 95, 552, 124, 30, -343, 82, -86,
+ -163, -257, 899, 1097, 906, 751, 502, 390, 294,
+ -51, -258, -447, -806, -368, 763, 464, 364, 183,
+ -166, -374, -367, 87, 35, 399, 418, 856, 833,
+ -205, -310, 588, 778, 785, 1065, 1118, 1245, 1157,
+ -173, -312, 107, 345, 400, 790, 870, 1113, 1001,
+ -7, -120, -387, -410, -614, -943, -226, -384, -491,
+ -203, -288, -51, -331, -90, -178, -408, -573, -338,
+ 56, -29, -273, -627, -1041, -798, -247, -467, 148,
+ 66, -2, -205, -205, -575, -349, -57, -352, -58,
+ -45, -225, -471, -924, -497, 77, -32, 44, -135,
+ -277, -491, -497, -502, -424, -202, -137, 77, 96,
+ 26, -179, -469, -1008, -1260, 262, -35, -132, -259,
+ -66, -232, -447, -533, -789, -191, -100, -267, 364,
+ 111, 43, -287, -423, -608, -987, -922, -799, -827,
+ 77, 76, -101, -260, -549, -850, -88, -231, -329,
+ 75, 24, -66, -269, -427, -528, -773, 201, -5,
+ 67, 7, -61, -320, -487, 12, -200, -242, -94,
+ 27, -54, -149, -354, -661, -594, -450, -481, 560,
+ 31, -69, -246, -549, -1141, -178, -232, -275, -288,
+ 16, -84, -176, 7, -83, -210, -246, -424, -589,
+ 63, -60, -201, -90, -269, -400, -685, -1218, -258,
+ 169, 217, 142, -71, -243, -433, -504, -511, -537,
+ 6, -105, -234, -321, -188, -131, -307, -521, -1319,
+ -34, -151, -369, 11, 44, -95, -280, -500, 160,
+ 31, -37, -163, -334, 288, 89, -150, -86, -299,
+ -35, -161, -362, -74, -74, -263, 240, 9, -153,
+ -45, -208, -529, -896, 89, 24, -130, -313, -373,
+ 234, 276, 197, -10, -236, -162, -134, -85, -112,
+ 42, -73, 133, 392, 98, 72, -153, -162, -99,
+ -3, -145, -338, 408, 401, 133, -52, -296, -501,
+ 3, -109, -152, -85, -56, 42, -145, 703, 205,
+ -49, -149, -281, -134, -121, -41, -21, 16, 958,
+ 30, -107, -196, -463, -523, 490, 236, 70, -128,
+ -33, -161, -364, -148, 757, 516, 250, 43, -65,
+ -34, -193, -244, 750, 527, 349, 234, 172, 134,
+ -64, -223, -379, 55, 28, 248, 793, 442, 320,
+ 29, -85, -298, -622, -888, 127, 206, 387, 460,
+ -48, -170, -477, -876, 573, 635, 440, 375, 311,
+ 42, 3, -212, -441, -718, -821, 388, 373, 211,
+ -106, -155, 1092, 459, 570, 561, 506, 604, 514,
+ -144, -264, 0, 460, 619, 877, 916, 1273, 921
+};
+
+/*-------------------------------------------------------------------*
+ * 1nd stage, 2nd split: ISF9 to ISF15
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) */
+const Word16 dico2_isf_fx[] =
+{/*Qlog2(2.56)*/
+ 1357, 1313, 1136, 784, 438, 181, 145,
+ 636, 648, 667, 568, 442, 217, 362,
+ 427, 440, 674, 524, 332, 117, -417,
+ 121, 295, 468, 465, 230, 44, -221,
+ -147, -240, 149, 80, 390, 278, 106,
+ -418, -556, 552, 511, 235, 144, -95,
+ 43, 193, 274, 150, 67, 34, -273,
+ -43, -126, 171, 416, 282, 63, -354,
+ -372, -86, -344, -108, -94, -182, -89,
+ -600, -840, -200, 465, 258, -11, -253,
+ -48, 329, 97, -290, -543, -795, -354,
+ -570, -117, 187, 10, -133, -416, -76,
+ -618, -129, -247, -371, 45, -76, 277,
+ -1022, -1079, 126, 474, 254, 127, 52,
+ -281, 76, -167, -361, -283, -551, -283,
+ -119, -52, -1, 134, -32, -204, -415,
+ 1064, 827, 637, 684, 464, 209, 12,
+ 482, 416, 449, 371, 335, 294, 194,
+ 719, 576, 365, 135, 113, 91, -199,
+ 298, 176, 493, 366, 194, 163, 36,
+ -35, -236, -259, -36, -4, 99, 152,
+ -98, -306, -27, 228, 90, 111, -86,
+ 91, 13, -211, -258, -106, 86, -64,
+ 73, -35, -57, -31, 162, 35, -192,
+ -109, -335, -629, -66, -61, -128, 322,
+ -495, -669, -728, 193, 31, -220, 122,
+ 324, 95, -89, -91, -409, -710, -154,
+ 0, -234, 92, 33, -343, -609, -220,
+ -343, -408, -476, -655, -153, 82, 222,
+ -490, -745, -255, 49, -48, 135, -127,
+ 119, -67, -328, -390, -272, -545, -56,
+ -57, -130, -10, -7, -164, -47, -22,
+ 984, 1064, 961, 568, 210, -27, 16,
+ 811, 691, 754, 514, 224, -35, 166,
+ 662, 704, 618, 386, 57, -211, -257,
+ 510, 359, 418, 393, 91, -144, -18,
+ -193, -31, -27, 223, 89, -143, 24,
+ -112, -98, 471, 319, 185, 3, 175,
+ 252, 146, -47, 272, 48, -211, -234,
+ 146, 69, 203, 364, 68, -52, 51,
+ -259, -478, -697, -349, -758, -501, 63,
+ -501, -769, -289, 79, -311, -497, -106,
+ 251, 53, -235, -469, -895, -884, 145,
+ -416, -551, 140, -133, -523, -775, 44,
+ -326, -423, -713, -497, -86, -431, 99,
+ -757, -772, -160, -76, -46, -32, 379,
+ 85, -35, -200, -401, -663, -1040, -247,
+ -180, -330, -92, -376, 27, -183, -110,
+ 1279, 1086, 781, 502, 324, 164, 157,
+ 682, 466, 449, 277, 146, 28, 409,
+ 635, 472, 390, 107, -232, -538, -139,
+ 196, 396, 332, 213, 209, -29, -81,
+ 150, -95, -312, 76, -77, -320, -50,
+ 46, 9, 47, 175, 139, 30, 384,
+ 218, 206, -24, -250, -96, -276, -183,
+ 26, 119, 38, 14, -4, -133, -52,
+ -477, -614, -987, -715, -631, -813, 200,
+ -744, -1009, -1065, -745, -631, -171, 18,
+ -137, -251, -483, -613, -980, -1203, 12,
+ -605, -767, -562, -686, -1088, -515, 58,
+ -202, -428, -782, -1072, -96, -234, -179,
+ -480, -709, -1070, -897, -131, -92, 321,
+ -145, -193, -512, -729, -572, -765, -210,
+ -331, -585, -525, -631, -281, -208, -303,
+ 1165, 1104, 939, 828, 716, 426, 155,
+ 6, -109, 820, 778, 415, 113, -27,
+ 381, 339, 314, 265, 121, -9, -474,
+ -373, 47, 584, 442, 99, -231, -113,
+ -496, -38, -285, 262, 305, 170, 4,
+ -587, -556, 69, 66, 471, 354, 13,
+ -138, 70, -18, 106, 67, 167, -302,
+ -445, -141, 185, 191, 151, 83, -133,
+ -257, -521, -720, -198, 134, -46, -182,
+ -819, -1168, -777, 512, 359, 95, -113,
+ 137, -2, -74, -138, -401, -114, -371,
+ -242, -466, 204, 223, -31, -212, -192,
+ -532, -637, -466, -686, 256, 277, -139,
+ -1141, -1244, -381, -75, -54, 14, 88,
+ -311, 115, -143, -499, -343, 124, -416,
+ -616, -147, -135, 43, -4, 121, -369,
+ 835, 783, 641, 390, 355, 350, 64,
+ 72, 194, 443, 467, 436, 219, 372,
+ 464, 369, 192, 4, -156, -72, -226,
+ 57, 206, 303, 205, 188, 101, 265,
+ -40, -205, -488, -184, 276, 64, -26,
+ -217, -433, -297, 137, 328, 308, -289,
+ 378, 81, -308, -465, 57, -37, 227,
+ -100, 24, -36, -151, 199, 8, 143,
+ -426, -697, -1059, -133, 388, 161, 321,
+ -644, -1023, -1271, 39, 66, -123, 70,
+ 372, 177, -173, -556, -553, -304, -189,
+ -117, -369, -425, -122, -462, -152, -73,
+ -649, -850, -1189, -767, 497, 360, 222,
+ -798, -1139, -1455, -190, 430, 234, 179,
+ 42, -94, -405, -692, 38, -202, -246,
+ -169, -366, -290, -88, -64, 32, -292,
+ 1010, 923, 938, 710, 465, 230, 342,
+ 217, 300, 1054, 675, 68, -458, -179,
+ 78, 453, 316, 18, -237, -496, -243,
+ 167, 21, 424, 215, -91, -303, -170,
+ -290, -81, -70, -67, 40, 54, -59,
+ -353, -427, -90, 53, 94, 9, 54,
+ -28, 318, 283, 15, -240, -58, 79,
+ -75, -121, 229, 35, 58, 6, -133,
+ -351, -514, -744, -834, -705, -137, 164,
+ -1124, -1388, -1055, -230, -73, 40, 36,
+ -163, -233, -532, -785, -1170, -697, 96,
+ -788, -959, -246, -430, -624, -165, -8,
+ -856, -540, -630, -907, -337, -70, 76,
+ -937, -1042, -659, -733, -208, 199, -26,
+ -523, 78, -98, -501, -869, -890, -81,
+ -624, -703, -45, -348, -25, 87, -186,
+ 1005, 823, 546, 249, 90, -22, 207,
+ 298, 397, 381, 319, 200, 62, 303,
+ 473, 379, 133, -247, -632, -441, 75,
+ 284, 208, 391, 115, -25, 44, 95,
+ -72, 79, -95, -63, -129, -293, 203,
+ -164, -349, 115, 122, 69, -1, 378,
+ 348, 170, 99, 58, -179, -302, 188,
+ -190, -2, 150, 23, -51, -11, 216,
+ -615, -863, -1090, -1427, -802, -48, -6,
+ -961, -1276, -1548, -727, -58, 56, 223,
+ -124, -255, -561, -988, -1277, -148, -82,
+ -480, -660, -891, -1191, -1339, -325, 20,
+ -621, -917, -1296, -1350, 264, 289, 50,
+ -844, -1022, -1345, -1329, -293, 46, 278,
+ -260, -468, -829, -1176, -533, -560, -78,
+ -215, -484, -822, -1233, -791, 15, -138,
+ 1301, 1317, 1262, 1048, 716, 357, -64,
+ 578, 824, 925, 802, 630, 362, 102,
+ 470, 925, 767, 514, 327, 190, -112,
+ 225, 492, 495, 437, 598, 384, -45,
+ 43, 82, -42, 175, 519, 342, -64,
+ -304, -154, 159, 576, 403, 221, 327,
+ 214, 244, 122, -62, 312, 92, -160,
+ 218, 208, 310, 268, 306, 323, -199,
+ -285, -269, -79, -124, -143, -153, 236,
+ -205, -384, -426, 344, 59, -185, -184,
+ -272, 247, 126, -210, -518, -468, 78,
+ -99, -120, 502, 160, -280, -557, 304,
+ -423, -17, -283, -443, 215, 212, -140,
+ -564, -684, -228, 510, 361, 130, 323,
+ -428, 335, 98, -65, 36, -215, -246,
+ -362, 51, 364, -16, -234, 150, -165,
+ 914, 883, 751, 653, 676, 464, -153,
+ 631, 545, 535, 720, 596, 360, -81,
+ 783, 712, 512, 439, 341, 251, -391,
+ 497, 417, 249, 372, 295, 173, -193,
+ 128, -110, -385, 93, 39, 173, -231,
+ 216, -59, -253, 462, 389, 154, 69,
+ 455, 270, -4, -337, -49, 233, -322,
+ 307, 143, 53, 218, 128, 236, -156,
+ -37, -186, -240, -411, -110, 9, 399,
+ -140, -365, -628, 258, 380, 214, 277,
+ 131, 454, 177, -285, -520, 108, -214,
+ 77, -141, 201, -123, -490, -131, 60,
+ -14, -194, -521, -741, 273, 362, -33,
+ -362, -566, -287, -228, 161, 237, 317,
+ -269, 195, -75, -375, -204, 11, 77,
+ -128, -264, -156, -223, -475, 265, 27,
+ 1238, 1147, 916, 689, 432, 210, -280,
+ 800, 664, 879, 726, 411, 160, -164,
+ 454, 686, 536, 275, 147, 46, 111,
+ 303, 486, 512, 355, 241, 181, -69,
+ 79, 92, 29, 147, 233, 52, 17,
+ -171, 289, 131, 439, 271, 3, -10,
+ 413, 241, 144, 174, 155, -2, 14,
+ 58, 217, 247, 219, 149, 175, -18,
+ 228, -8, -240, -206, -513, -191, 202,
+ -96, -272, -454, 33, -300, -575, 46,
+ -10, -108, -246, -347, -770, -535, 9,
+ -326, -430, -61, -321, -704, -299, 201,
+ -1, -280, -603, -419, -185, 18, -36,
+ -516, -522, -379, -291, -181, -97, 27,
+ -159, -313, -525, -224, -510, -831, -197,
+ -292, -459, -59, -310, -562, -143, -351,
+ 1066, 912, 631, 389, 207, 86, -224,
+ 596, 512, 596, 505, 314, 122, -48,
+ 787, 861, 441, -93, -303, 33, -190,
+ 257, 469, 337, 51, 15, 298, -93,
+ 295, 73, -119, 25, 36, 23, 108,
+ -28, -3, -32, 114, 21, 185, 107,
+ 482, 305, 15, -279, -319, 52, 96,
+ 226, 46, 115, 72, -136, 133, -125,
+ 18, -207, -559, -590, -503, -482, 321,
+ -571, -789, -951, -172, -441, -538, 113,
+ 181, 14, -310, -641, -1001, -202, 159,
+ -136, -393, -433, -513, -911, -144, -22,
+ 72, -265, -706, -954, -159, 53, 332,
+ -338, -591, -852, -383, -395, 56, 44,
+ 43, -158, -464, -897, -631, -157, -294,
+ -161, -128, -328, -573, -483, -125, 11,
+ 1017, 906, 1051, 1005, 679, 341, -102,
+ 359, 334, 1567, 1314, 723, 105, 10,
+ -65, 726, 529, 301, 220, 43, -273,
+ -510, 436, 719, 566, 358, 179, 114,
+ -560, 298, 133, -120, 342, 225, 14,
+ -899, -101, 217, 617, 400, 146, -58,
+ -41, 352, 82, -196, 39, 121, -167,
+ -212, 59, 447, 284, 423, 250, -169,
+ -371, -484, -596, 30, -41, 249, 22,
+ -372, -650, -794, 477, 445, 216, -79,
+ -352, 275, 17, -443, -929, 92, 19,
+ -699, -696, 431, 264, -49, -310, 182,
+ -978, -217, -430, -400, 101, 261, 72,
+ -929, -889, -357, -13, 463, 378, 236,
+ -826, 56, 30, -299, -360, -128, -51,
+ -878, -299, -111, 75, 65, 36, 3,
+ 817, 368, -25, 354, 697, 591, -173,
+ 309, 212, 222, 751, 484, 140, -56,
+ 593, 379, 70, -8, 258, 180, 110,
+ 165, -46, 255, 297, 219, 273, 105,
+ 160, -70, -358, -181, 379, 330, 319,
+ -238, -369, -198, 740, 580, 319, -143,
+ 201, 109, -202, -456, 328, 276, -141,
+ 203, 170, 111, 42, 207, 360, 188,
+ -345, -399, -513, -233, 650, 422, 81,
+ -635, -961, -1220, 463, 539, 204, 209,
+ 202, -25, -194, -498, -787, 193, -143,
+ -449, -538, 195, -106, -331, 68, 62,
+ -228, -477, -840, -576, 317, 128, 283,
+ -671, -937, -807, -114, 391, 335, -62,
+ 246, 2, -314, -679, -303, 180, -88,
+ -107, -272, 90, -198, -28, 290, -112,
+ 885, 1149, 1021, 712, 496, 281, -83,
+ 269, 492, 787, 643, 347, 70, 124,
+ 336, 636, 499, 92, -229, -179, 191,
+ 26, 402, 564, 340, 149, -11, 135,
+ -440, 561, 470, 204, -72, -186, 140,
+ -720, 14, 355, 229, 68, -133, 465,
+ 110, 310, 103, 12, 106, 29, 158,
+ -178, 113, 161, 142, 121, 115, 27,
+ -651, -414, -645, -152, -164, -13, -429,
+ -639, -944, -681, -104, -81, 52, -189,
+ -663, -164, -316, -683, -954, -205, -83,
+ -609, -669, -172, -517, -694, 283, -80,
+ -646, -152, -383, -678, -246, -40, -143,
+ -747, -796, -745, -390, -98, 43, 275,
+ -599, -199, -398, -433, -436, -538, 31,
+ -1107, -568, -376, -265, -126, -21, 1,
+ 847, 573, 308, 392, 305, 101, 55,
+ 273, 293, 201, 267, 346, 201, 123,
+ 727, 480, 226, 2, -65, -138, 164,
+ 273, 208, 173, 292, 12, 253, 174,
+ 340, 207, 180, 88, 116, 46, 475,
+ -460, -166, -30, 13, 110, 173, 396,
+ 137, 88, 43, -137, -94, 34, 284,
+ 96, -14, 226, 40, 63, 70, 130,
+ -467, -735, -1012, -1174, -307, 305, -67,
+ -612, -920, -1146, -567, -8, 92, -25,
+ -182, -271, -492, -754, -857, 287, -75,
+ -494, -787, -689, -683, -709, 137, -326,
+ -288, -550, -903, -1105, 334, 321, -62,
+ -354, -653, -834, -445, 1, 377, -152,
+ -162, -306, -608, -937, -297, 247, -192,
+ -234, -477, -244, -488, -266, 342, -332
+};
+
+/*-------------------------------------------------------------------*
+ * AMR-WB ISF codebook - 46bits, 2 stages, 1st stage common with the
+ * 36bit codebook,5 splits in the 2nd stage
+ *
+ * codebook vector dimension number of vectors
+ * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
+ * 2_1 3 64
+ * 2_2 3 128
+ * 2_3 3 128
+ * 2_4 3 32
+ * 2_5 4 32
+ *-------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 1st split: ISF0 to ISF2
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) */
+const Word16 dico21_isf_46b_fx[] =
+{/*Qlog2(2.56)*/
+ 329, 409, 249,
+ -33, 505, 160,
+ -29, -14, 582,
+ -262, 127, 354,
+ 145, 237, 175,
+ -152, 245, 122,
+ 27, 42, 340,
+ -84, -93, 311,
+ 285, 222, -156,
+ 47, -43, -504,
+ 234, 121, 385,
+ 104, -317, 45,
+ 176, 195, 8,
+ 104, -59, -94,
+ 177, 53, 192,
+ -34, -127, 152,
+ 570, 277, -34,
+ -67, -329, -639,
+ -157, -272, 462,
+ -177, -462, 198,
+ 322, 179, 115,
+ -386, 171, 19,
+ 19, -12, 195,
+ -120, -252, 201,
+ 304, 36, -336,
+ -128, -221, -380,
+ 171, -185, 296,
+ -242, -312, 23,
+ 198, 39, 16,
+ -3, -177, -111,
+ 111, -93, 76,
+ -92, -223, 4,
+ 177, 406, -44,
+ -168, 380, -149,
+ -4, 273, 331,
+ -420, 513, 277,
+ 21, 247, 47,
+ -58, 131, -2,
+ -3, 134, 180,
+ -145, 40, 175,
+ 189, 74, -145,
+ -27, -45, -325,
+ 370, -114, -21,
+ -83, -415, -173,
+ 77, 95, -51,
+ -40, -30, -67,
+ 71, 88, 86,
+ -35, -98, 14,
+ 69, 197, -334,
+ -196, 79, -231,
+ -348, -137, 218,
+ -352, -89, -85,
+ 47, 201, -130,
+ -165, 37, -15,
+ -43, 3, 86,
+ -161, -108, 79,
+ 83, 21, -237,
+ -81, -149, -238,
+ 150, -186, -251,
+ -186, -249, -162,
+ -19, 66, -139,
+ -26, -50, -181,
+ 24, 11, 0,
+ -130, -105, -98
+};
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 2nd split: ISF3 to ISF5
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 46b, 2nd stage, 2st split (only in AMR-WB IO mode) */
+const Word16 dico22_isf_46b_fx[] =
+{/*Qlog2(2.56)*/
+ -127, 310, 42,
+ -242, 197, 5,
+ -151, 84, -17,
+ -214, 127, -149,
+ -247, -131, 159,
+ -268, -267, -95,
+ -217, 1, -79,
+ -271, -80, -185,
+ -45, 436, 159,
+ 165, 199, 391,
+ -33, 81, 187,
+ -66, -42, 355,
+ -298, -57, 343,
+ -108, -537, 226,
+ -144, -23, 193,
+ 176, -402, 87,
+ 53, 296, 25,
+ -84, 253, -104,
+ -58, 105, -126,
+ -169, 174, -314,
+ -48, 44, -294,
+ -164, -417, -242,
+ -139, 3, -194,
+ -155, -207, -211,
+ 119, 322, 213,
+ 333, 50, 380,
+ 237, 247, -2,
+ 466, -16, 201,
+ 238, -255, -107,
+ 67, -440, -149,
+ 122, -88, -139,
+ 88, -247, -73,
+ -41, 231, 167,
+ -62, 155, 16,
+ -65, 16, 77,
+ -68, -2, -63,
+ -151, -300, 160,
+ -18, -333, 54,
+ -56, -94, 5,
+ 2, -190, 14,
+ 92, 148, 209,
+ 108, 9, 272,
+ 108, 35, 110,
+ 142, -85, 145,
+ 47, -157, 279,
+ 3, -320, 246,
+ 43, -72, 68,
+ 86, -217, 135,
+ 36, 140, 79,
+ 56, 175, -49,
+ 26, 45, 3,
+ 73, 55, -101,
+ 109, -183, -242,
+ -4, -283, -242,
+ 48, -68, -48,
+ -6, -153, -122,
+ 161, 196, 96,
+ 232, 80, 190,
+ 165, 97, 11,
+ 258, -31, 71,
+ 267, -77, -91,
+ 311, -209, 87,
+ 152, -14, -22,
+ 150, -149, 9,
+ -324, 557, 187,
+ -384, 307, 46,
+ -251, 27, 77,
+ -365, 77, -52,
+ -482, -84, 160,
+ -424, -515, -64,
+ -294, -120, -4,
+ -476, -116, -109,
+ -97, 318, 365,
+ 106, 627, 445,
+ -190, 120, 287,
+ -146, 65, 619,
+ -427, 242, 363,
+ -361, -371, 432,
+ -347, 102, 168,
+ -629, 195, -14,
+ -65, 476, -47,
+ -297, 320, -168,
+ -55, 356, -264,
+ -391, 82, -286,
+ -51, -31, -556,
+ -178, -399, -586,
+ -205, -49, -360,
+ -343, -238, -337,
+ 220, 457, 58,
+ 561, 467, 259,
+ 340, 270, -168,
+ 450, 77, -280,
+ 60, 167, -413,
+ 133, -252, -492,
+ 216, 157, -290,
+ 282, 0, -495,
+ -226, 293, 183,
+ -157, 135, 122,
+ -158, -59, 39,
+ -133, -118, -97,
+ -332, -309, 113,
+ -160, -425, -6,
+ -149, -211, 24,
+ -80, -277, -90,
+ -11, 125, 338,
+ 130, -71, 465,
+ 5, -45, 184,
+ 237, -95, 253,
+ -139, -197, 297,
+ -19, -300, 511,
+ -63, -152, 139,
+ 250, -289, 336,
+ 124, 339, -150,
+ 34, 176, -208,
+ 171, 166, -116,
+ 94, 38, -229,
+ 75, -65, -339,
+ -78, -205, -385,
+ 0, -30, -163,
+ -56, -110, -242,
+ 321, 244, 194,
+ 505, 238, -1,
+ 317, 116, 65,
+ 309, 88, -74,
+ 452, -51, -50,
+ 334, -217, -290,
+ 211, 41, -152,
+ 238, -55, -260
+};
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 3rd split: ISF6 to ISF8
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 46b, 2nd stage, 3rd split (only in AMR-WB IO mode) */
+const Word16 dico23_isf_46b_fx[] =
+{/*Qlog2(2.56)*/
+ -10, 151, 359,
+ 136, 298, 223,
+ 255, -104, 290,
+ 423, 6, 183,
+ -270, -269, -98,
+ -52, -82, 13,
+ -82, -274, -97,
+ 90, -246, -72,
+ -299, -70, 421,
+ -88, 365, 430,
+ 187, -318, 381,
+ 380, 37, 488,
+ -373, -316, 79,
+ -308, -101, 5,
+ -135, -451, 8,
+ 72, -421, -154,
+ 180, 170, -121,
+ 62, 177, -40,
+ 326, 80, -105,
+ 248, 263, -5,
+ -168, -181, -221,
+ -2, -23, -158,
+ -14, -149, -121,
+ 119, -91, -147,
+ 119, 332, -153,
+ 49, 303, 34,
+ 442, -55, -69,
+ 217, 454, 58,
+ -359, -187, -375,
+ -42, 50, -274,
+ -8, -267, -249,
+ 85, -86, -346,
+ -77, -40, 345,
+ 89, 134, 219,
+ 156, -80, 160,
+ 108, 40, 116,
+ -158, -206, 29,
+ 5, -32, 175,
+ -65, -158, 146,
+ 55, -78, 73,
+ -114, -222, 353,
+ -47, 81, 211,
+ 49, -151, 268,
+ 105, 4, 302,
+ -263, -132, 183,
+ -151, -28, 201,
+ -177, -307, 166,
+ 101, -221, 130,
+ 74, 58, -98,
+ 32, 44, 13,
+ 194, 30, -142,
+ 170, 96, 8,
+ -136, -119, -91,
+ -65, 8, -55,
+ 3, -188, 12,
+ 45, -63, -49,
+ 149, -21, -19,
+ 24, 144, 95,
+ 254, -22, 60,
+ 161, 196, 96,
+ -158, -61, 48,
+ -70, 33, 82,
+ -23, -321, 58,
+ 155, -147, 5,
+ -364, 328, 77,
+ -21, 453, 173,
+ -108, 82, 630,
+ 367, 263, 208,
+ -300, -62, -176,
+ -205, 143, -158,
+ -169, -410, -264,
+ 257, -269, -100,
+ -636, 289, -2,
+ -292, 627, 173,
+ -382, -363, 387,
+ 248, 524, 447,
+ -521, -111, -107,
+ -395, 118, -274,
+ -343, -680, -125,
+ -172, -447, -663,
+ 75, 148, -367,
+ -79, 263, -94,
+ 249, 148, -286,
+ 380, 271, -162,
+ -142, -4, -186,
+ -57, 111, -125,
+ -35, -108, -254,
+ 100, 29, -242,
+ -80, 303, -264,
+ -78, 464, -57,
+ 248, -22, -494,
+ 661, 662, 44,
+ -193, -40, -330,
+ -178, 145, -337,
+ -90, -199, -400,
+ -40, -23, -498,
+ -192, 114, 315,
+ -41, 244, 190,
+ 88, -97, 485,
+ 241, 80, 212,
+ -246, 40, 87,
+ -156, 147, 134,
+ -2, -334, 239,
+ 308, -203, 110,
+ -459, 251, 422,
+ -218, 310, 228,
+ -86, -346, 654,
+ 184, 175, 425,
+ -481, -63, 169,
+ -349, 117, 188,
+ -125, -560, 310,
+ 158, -416, 94,
+ 46, 171, -192,
+ -63, 157, 14,
+ 256, -35, -271,
+ 322, 123, 53,
+ -214, 4, -76,
+ -156, 86, -18,
+ 128, -197, -232,
+ 265, -90, -98,
+ -308, 332, -145,
+ -131, 308, 58,
+ 509, 59, -339,
+ 562, 196, -14,
+ -378, 100, -47,
+ -234, 202, 1,
+ 104, -270, -493,
+ 319, -210, -325
+};
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 4th split: ISF9 to ISF11
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 46b, 2nd stage, 4th split (only in AMR-WB IO mode) */
+const Word16 dico24_isf_46b_fx[] =
+{/*Qlog2(2.56)*/
+ -79, -89, -4,
+ -171, 77, -211,
+ 160, -193, 98,
+ 120, -103, 323,
+ 32, -22, -129,
+ 72, 78, -268,
+ 182, -76, -66,
+ 309, 99, -145,
+ -229, -157, -84,
+ -383, 98, -71,
+ -90, -352, 12,
+ -284, -178, 178,
+ -65, -125, -166,
+ -87, -175, -351,
+ 42, -198, -48,
+ 154, -140, -243,
+ -77, 18, 108,
+ -39, 355, 91,
+ 87, 8, 155,
+ -4, 158, 239,
+ 128, 95, -54,
+ 7, 246, -124,
+ 258, 15, 89,
+ 206, 216, 98,
+ -201, 9, 18,
+ -312, 233, 204,
+ -39, -174, 155,
+ -144, -9, 284,
+ -57, 70, -69,
+ -157, 187, 18,
+ 54, -30, 23,
+ 24, 135, 55
+};
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 1st split: ISF12 to ISF15
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) */
+const Word16 dico25_isf_46b_fx[] =
+{/*Qlog2(2.56)*/
+ 169, 142, -119, 115,
+ 206, -20, 94, 226,
+ -106, 313, -21, 16,
+ -62, 161, 71, 255,
+ -89, 101, -185, 125,
+ 72, -30, -201, 344,
+ -258, 33, -8, 81,
+ -104, -154, 72, 296,
+ 144, -68, -268, -25,
+ 81, -78, -87, 106,
+ 22, 155, -186, -119,
+ -46, -28, 27, 91,
+ -114, -37, -175, -33,
+ -94, -222, -189, 122,
+ -132, -119, -191, -270,
+ -172, -173, 18, -43,
+ 279, 135, -42, -128,
+ 187, -86, 229, -138,
+ 159, 240, 140, 46,
+ 69, 25, 227, 77,
+ 21, 115, 13, 8,
+ 68, -248, 126, 81,
+ -150, 137, 207, -9,
+ -154, -133, 289, 67,
+ 143, -37, -86, -326,
+ 180, -32, 19, -23,
+ 26, 168, 116, -233,
+ -32, -26, 118, -78,
+ 3, -8, -45, -115,
+ 57, -215, -54, -83,
+ -209, 112, -22, -167,
+ -91, -151, 168, -262
+};
+
+
+/*-------------------------------------------------------------------*
+ * AMR-WB ISF codebook - 36bits, 2 stages, 1st stage common with the
+ * 46bit codebook,3 splits in the 2nd stage
+ *
+ * codebook vector dimension number of vectors
+ * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
+ * 2_1 5 128
+ * 2_2 4 128
+ * 2_3 7 64
+ *-------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 1st split: ISF0 to ISF4
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) */
+const Word16 dico21_isf_36b_fx[] =
+{/*Qlog2(2.56)*/
+ -52, -96, 212, 315, -73,
+ 82, -204, 363, 136, -197,
+ -126, -331, 183, 218, 143,
+ -49, -41, 557, 230, 72,
+ 2, -73, 163, 377, 221,
+ 133, 111, 278, 215, -110,
+ -102, -20, 284, 113, 273,
+ 84, 319, 290, 18, 85,
+ -25, -5, 125, 132, -204,
+ -38, -5, 286, -9, -356,
+ -140, -256, 92, 117, -189,
+ -144, 191, 313, 51, -98,
+ 167, -10, 44, 247, 36,
+ 381, 197, 238, 74, 6,
+ 38, -408, 29, -3, -85,
+ 92, 266, 157, -25, -200,
+ 161, -121, 70, 84, -140,
+ -16, -86, 112, -94, -189,
+ -269, -270, 351, 107, -24,
+ -68, -67, 492, -103, -155,
+ -53, -131, 62, 122, 10,
+ 135, 84, 283, -55, -120,
+ -12, -219, 331, -81, 167,
+ 220, -136, 147, -172, -42,
+ 140, -95, -109, -88, -194,
+ 0, -2, -4, -33, -381,
+ -66, -217, 152, -186, -402,
+ 244, 108, 156, -140, -395,
+ 113, -136, -196, 110, -24,
+ 214, 118, 11, -64, -131,
+ -110, -286, -6, -332, 16,
+ 94, 97, 79, -291, -205,
+ -5, -39, -20, 252, -96,
+ 76, 174, 101, 163, 61,
+ -69, -239, -55, 399, 6,
+ -115, 319, 164, 275, 196,
+ -15, 36, -47, 331, 121,
+ 226, 209, 271, 325, 184,
+ 13, -80, -218, 471, 353,
+ 288, 378, 16, -51, 251,
+ 174, 116, 52, 149, -279,
+ 235, 276, 39, 120, -48,
+ 0, -108, -108, 241, -339,
+ -93, 534, 45, 33, -87,
+ 194, 149, -71, 405, -44,
+ 409, 370, 81, -186, -154,
+ 25, -102, -448, 124, -173,
+ 22, 408, -110, -310, -214,
+ -26, 23, -83, 114, 14,
+ -110, 164, 52, 223, -82,
+ 37, -25, -263, 306, -15,
+ -466, 415, 292, 165, -18,
+ 29, -19, -171, 155, 182,
+ 179, 144, -27, 231, 258,
+ -103, -247, -396, 238, 113,
+ 375, -154, -109, -4, 156,
+ 98, 85, -292, -5, -124,
+ 116, 139, -116, -98, -294,
+ -14, -83, -278, -117, -378,
+ 106, 33, -106, -344, -484,
+ 119, 17, -412, 138, 166,
+ 384, 101, -204, 88, -156,
+ -121, -284, -300, -1, -166,
+ 280, 33, -152, -313, -81,
+ -37, 22, 229, 153, 37,
+ -60, -83, 236, -8, -41,
+ -169, -228, 126, -20, 363,
+ -235, 17, 364, -156, 156,
+ -25, -30, 72, 144, 156,
+ 153, -26, 256, 97, 144,
+ -21, -37, 48, -65, 250,
+ 63, 77, 273, -128, 124,
+ -129, -26, 40, 9, -115,
+ -6, 82, 38, -90, -182,
+ -336, -13, 28, 158, 91,
+ -30, 241, 137, -170, -17,
+ 146, 14, -11, 33, 61,
+ 192, 197, 54, -84, 85,
+ 23, -200, -78, -29, 140,
+ 122, 237, 106, -341, 136,
+ -57, -142, -85, -16, -74,
+ -59, -90, -8, -187, -20,
+ -211, -267, 216, -179, -110,
+ -50, -7, 220, -267, -70,
+ -57, -42, -17, -15, 71,
+ 32, 21, 63, -137, 33,
+ -137, -175, 104, -68, 97,
+ -67, -43, 133, -301, 221,
+ -116, -200, -81, -92, -272,
+ -64, -41, -54, -244, -220,
+ -287, -242, -50, -87, -89,
+ -245, 236, 102, -166, -295,
+ 66, 24, -162, -71, 95,
+ 66, 136, -90, -220, -36,
+ -98, -161, -222, -188, 29,
+ -18, 18, -19, -415, 9,
+ 49, 61, 100, 39, -56,
+ -111, 82, 135, -31, 52,
+ -90, -153, -93, 189, 182,
+ -214, 295, 119, -74, 284,
+ 2, 137, 37, 47, 182,
+ 92, 117, 184, -53, 373,
+ -21, -14, -35, 136, 391,
+ 146, 129, -164, -28, 333,
+ 92, 80, -84, 100, -134,
+ -8, 217, -32, 3, -47,
+ -151, 251, -215, 142, 92,
+ -224, 310, -172, -275, 98,
+ 159, 155, -177, 112, 53,
+ 205, 27, 8, -240, 192,
+ 169, 120, -319, -201, 106,
+ 11, 36, -86, -237, 455,
+ -109, -154, -163, 174, -55,
+ -38, 32, -101, -78, -59,
+ -205, -321, -97, 69, 79,
+ -310, 44, 18, -185, 34,
+ -115, -20, -148, -39, 203,
+ -29, 154, -30, -158, 166,
+ -45, -131, -317, -24, 363,
+ -165, -205, -112, -222, 265,
+ -32, -44, -150, 54, -193,
+ -6, -38, -255, -169, -115,
+ -266, 87, -189, -36, -169,
+ -60, -87, -266, -436, -170,
+ -68, -81, -278, 24, 38,
+ -23, -19, -155, -256, 141,
+ -61, -226, -565, -175, 71,
+ 9, -29, -237, -515, 263
+};
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 2nd split: ISF5 to ISF8
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) */
+
+const Word16 dico22_isf_36b_fx[] =
+{/*Qlog2(2.56)*/
+ -298, -6, 95, 31,
+ -213, -87, -122, 261,
+ 4, -49, 208, 14,
+ -129, -110, 30, 118,
+ -214, 258, 110, -235,
+ -41, -18, -126, 120,
+ 103, 65, 127, -37,
+ 126, -36, -24, 25,
+ -138, -67, -278, -186,
+ -164, -194, -201, 78,
+ -211, -87, -51, -221,
+ -174, -79, -94, -39,
+ 23, -6, -157, -240,
+ 22, -110, -153, -68,
+ 148, -5, -2, -149,
+ -1, -135, -39, -179,
+ 68, 360, -117, -15,
+ 137, 47, -278, 146,
+ 136, 260, 135, 65,
+ 61, 116, -45, 97,
+ 231, 379, 87, -120,
+ 338, 177, -272, 3,
+ 266, 156, 28, -69,
+ 260, 84, -85, 86,
+ -266, 154, -256, -182,
+ -17, -65, -304, -6,
+ -40, 175, -151, -180,
+ -27, 27, -87, -63,
+ 121, 114, -166, -469,
+ 159, -66, -323, -231,
+ 214, 152, -141, -212,
+ 137, 36, -184, -51,
+ -282, -237, 40, 10,
+ -48, -235, -37, 251,
+ -54, -323, 136, 29,
+ -88, -174, 213, 198,
+ -390, 99, -63, -375,
+ 107, -169, -164, 424,
+ 69, -111, 141, -167,
+ 74, -129, 65, 144,
+ -353, -207, -205, -109,
+ -160, -386, -355, 98,
+ -176, -493, -20, -143,
+ -252, -432, -2, 216,
+ -90, -174, -168, -411,
+ 13, -284, -229, -160,
+ -87, -279, 34, -251,
+ -75, -263, -58, -42,
+ 420, 53, -211, -358,
+ 384, -35, -374, 396,
+ 68, -228, 323, -2,
+ 167, -307, 192, 194,
+ 459, 329, -5, -332,
+ 375, 79, -7, 313,
+ 282, -124, 200, -92,
+ 271, -162, -70, 180,
+ -157, -298, -514, -309,
+ 58, -163, -546, 18,
+ 124, -364, 167, -238,
+ 83, -411, -117, 96,
+ 140, -112, -388, -624,
+ 259, -133, -317, 41,
+ 163, -130, -64, -334,
+ 226, -165, -124, -110,
+ -466, -61, 6, 229,
+ -153, 205, -145, 242,
+ -159, 48, 195, 148,
+ -58, 28, 31, 279,
+ -303, 185, 279, -4,
+ -61, 197, 59, 86,
+ -114, 123, 168, -52,
+ 35, 36, 100, 126,
+ -407, 102, -77, -40,
+ -338, -1, -342, 156,
+ -179, 105, -34, -97,
+ -185, 84, -35, 108,
+ -133, 107, -91, -357,
+ -180, 54, -229, 24,
+ -44, 47, 47, -182,
+ -66, 13, 45, 4,
+ -339, 251, 64, 226,
+ -42, 101, -350, 275,
+ -99, 398, 142, 121,
+ 111, 12, -102, 260,
+ 0, 505, 260, -94,
+ 161, 285, -96, 224,
+ -4, 206, 314, 33,
+ 167, 139, 88, 204,
+ -235, 316, -60, -25,
+ -8, -150, -312, 201,
+ -36, 292, 61, -104,
+ -40, 174, -162, 42,
+ -21, 402, -29, -351,
+ 21, 152, -360, -93,
+ 57, 191, 212, -196,
+ 76, 158, -21, -69,
+ -328, -185, 331, 119,
+ -53, 285, 56, 337,
+ -107, -24, 405, 29,
+ -18, 137, 272, 277,
+ -255, 22, 173, -191,
+ 295, 322, 325, 302,
+ 21, -27, 332, -178,
+ 119, 13, 271, 129,
+ -455, -180, 116, -191,
+ -227, 62, -148, 524,
+ -176, -287, 282, -157,
+ -243, 13, 199, 430,
+ -59, -49, 115, -365,
+ 72, -172, -137, 93,
+ -138, -126, 141, -84,
+ 5, -124, 38, -20,
+ -258, 311, 601, 213,
+ 94, 130, -61, 502,
+ -1, -157, 485, 313,
+ 146, -74, 158, 345,
+ 276, 135, 280, -57,
+ 490, 252, 99, 43,
+ 267, -74, 429, 105,
+ 278, -23, 119, 94,
+ -542, 488, 257, -115,
+ -84, -244, -438, 478,
+ -113, -545, 387, 101,
+ -95, -306, 111, 498,
+ 95, 166, 22, -301,
+ 420, -15, -58, -78,
+ 270, 29, 122, -282,
+ 160, -240, 50, -38
+};
+
+/*-------------------------------------------------------------------*
+ * 2nd stage, 3rd split: ISF9 to ISF15
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) */
+const Word16 dico23_isf_36b_fx[] =
+{/*Qlog2(2.56)*/
+ 81, -18, 68, -27, -122, -280, -4,
+ 45, -177, 209, -30, -136, -74, 131,
+ -44, 101, -75, -88, -48, -137, -54,
+ -245, -28, 63, -18, -112, -103, 58,
+ -79, -6, 220, -65, 114, -35, -50,
+ 109, -65, 143, -114, 129, 76, 125,
+ 166, 90, -61, -242, 186, -74, -43,
+ -46, -92, 49, -227, 24, -155, 39,
+ 67, 85, 99, -42, 53, -184, -281,
+ 142, -122, 0, 21, -142, -15, -17,
+ 223, 92, -21, -48, -82, -14, -167,
+ 51, -37, -243, -30, -90, 18, -56,
+ 54, 105, 74, 86, 69, 13, -101,
+ 196, 72, -89, 43, 65, 19, 39,
+ 121, 34, 131, -82, 25, 213, -156,
+ 101, -102, -136, -21, 57, 214, 22,
+ 36, -124, 205, 204, 58, -156, -83,
+ 83, -117, 137, 137, 85, 116, 44,
+ -92, -148, -68, 11, -102, -197, -220,
+ -76, -185, -58, 132, -26, -183, 85,
+ -7, -31, -2, 23, 205, -151, 10,
+ -27, -37, -5, -18, 292, 131, 1,
+ 117, -168, 9, -93, 80, -59, -125,
+ -182, -244, 98, -24, 135, -22, 94,
+ 221, 97, 106, 42, 43, -160, 83,
+ 25, -64, -21, 6, 14, -15, 154,
+ 126, 15, -140, 150, -10, -207, -114,
+ 79, -63, -211, -70, -28, -217, 165,
+ 46, 38, -22, 281, 132, -62, 109,
+ 112, 54, -112, -93, 208, 27, 296,
+ 115, 10, -147, 41, 216, 42, -276,
+ 50, -115, -254, 167, 117, -2, 61,
+ 17, 144, 34, -72, -186, -150, 272,
+ -29, -66, -89, -95, -149, 129, 251,
+ 122, 0, -50, -234, -91, 36, 26,
+ -105, -102, -88, -121, -236, -7, -11,
+ -204, 109, 5, -191, 105, -15, 163,
+ -80, 32, -24, -209, 41, 294, 70,
+ -106, -94, -204, -118, 120, -50, -37,
+ -82, -241, 46, -131, -29, 150, -55,
+ 33, 155, 120, -89, -8, 7, 62,
+ 213, 82, 61, 18, -161, 144, 152,
+ 30, 131, 65, -87, -255, -17, -107,
+ -8, 85, -64, 51, -162, 223, -53,
+ -134, 261, 69, -56, 218, 72, -111,
+ 2, 155, -113, -87, 49, 85, -28,
+ -163, 42, -1, -196, 7, 39, -245,
+ 14, -137, -79, 11, -160, 202, -293,
+ -94, 33, 208, 100, 56, -44, 326,
+ -78, -41, 232, 13, -142, 227, 80,
+ -16, -87, 201, 33, -133, 15, -183,
+ -58, -192, -47, 184, -128, 133, 99,
+ -205, 11, -155, 78, 52, 72, 141,
+ -246, 26, 99, 151, 59, 115, -64,
+ -79, -47, -16, -14, 6, 47, -43,
+ -72, -178, -27, 162, 112, 43, -174,
+ -175, 238, 186, 71, -54, -188, -76,
+ -225, 233, 39, -39, -158, 122, 44,
+ -26, 43, 84, 130, -93, -51, 22,
+ 3, 92, -150, 136, -182, -57, 97,
+ -131, 179, -78, 80, 91, -165, 90,
+ -2, 148, 15, 130, 65, 175, 117,
+ -138, 114, -137, 132, 3, -10, -186,
+ 140, -4, -37, 254, -62, 92, -109
+};
+
+/*-------------------------------------------------------------------*
+ * AMR-WB ISF codebook for SID - 28bits, 1 stage, 5 splits
+ *
+ * codebook vector dimension number of vectors
+ * ~~~~~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
+ * 1 2 64
+ * 2 3 64
+ * 3 3 64
+ * 4 4 32
+ * 5 4 32
+ *-------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------*
+ * 1st stage, 1st split: ISF0 to ISF1
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook for SID frames - 28b, 1st split */
+const Word16 dico1_ns_28b_fx[] =
+{/*Qlog2(2.56)*/
+ -269, -673,
+ -222, -537,
+ -233, -430,
+ -138, -451,
+ -212, -331,
+ -192, -241,
+ -87, -231,
+ -191, -128,
+ -70, -106,
+ -164, -6,
+ 74, -179,
+ 27, -33,
+ -102, 74,
+ -162, 115,
+ -94, 172,
+ -6, 130,
+ -143, 234,
+ 14, 218,
+ -65, 270,
+ 88, 182,
+ -124, 341,
+ -44, 381,
+ 38, 335,
+ 117, 274,
+ -112, 454,
+ 74, 431,
+ -5, 488,
+ 175, 384,
+ -83, 561,
+ 122, 529,
+ 21, 601,
+ 229, 481,
+ 231, 303,
+ 226, 608,
+ 300, 372,
+ 210, 187,
+ 306, 265,
+ 328, 473,
+ 382, 331,
+ 371, 132,
+ 139, 58,
+ 365, 21,
+ 250, -82,
+ 443, 218,
+ 483, 110,
+ 426, 415,
+ 579, 222,
+ 518, 333,
+ 573, 448,
+ 455, 529,
+ 685, 329,
+ 332, 580,
+ 595, 593,
+ 468, 645,
+ 762, 517,
+ 326, 709,
+ 485, 793,
+ 130, 684,
+ 671, 737,
+ 354, 876,
+ 88, 806,
+ -65, 706,
+ -35, 1016,
+ 266, 1123
+};
+
+/*-------------------------------------------------------------------*
+ * 1st stage, 2ndt split: ISF2 to ISF4
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook for SID frames - 28b, 2nd spilt */
+const Word16 dico2_ns_28b_fx[] =
+{/*Qlog2(2.56)*/
+ -824, -884, -949,
+ -805, -456, -418,
+ -442, -438, -541,
+ -217, -578, -793,
+ -168, -444, -582,
+ -287, -492, -274,
+ -552, -297, -300,
+ -163, -333, -358,
+ -370, -232, -232,
+ -175, -358, -159,
+ -381, -21, -357,
+ -184, -159, -162,
+ -53, -191, -280,
+ 18, -267, -215,
+ -138, 61, -283,
+ 71, -95, -294,
+ 13, -156, -546,
+ 0, -83, -79,
+ 44, 97, -316,
+ 178, -52, -213,
+ 222, -261, -422,
+ 237, -118, -44,
+ 141, 145, -132,
+ 363, 81, -287,
+ 213, 65, 34,
+ -107, 94, -5,
+ 91, -29, 126,
+ -355, 51, -41,
+ -219, -76, 145,
+ -63, 100, 244,
+ -719, 44, 27,
+ -572, -124, 155,
+ -423, 133, 315,
+ -917, 71, 224,
+ -268, 318, 131,
+ -93, -190, 420,
+ -97, 122, 491,
+ -79, 317, 355,
+ 130, 100, 325,
+ 86, -293, 210,
+ 133, 258, 161,
+ 176, -73, 465,
+ 195, 300, 384,
+ 348, 22, 221,
+ 376, 183, 409,
+ 377, 286, 202,
+ 242, 213, 659,
+ 257, 565, 248,
+ 344, 408, -76,
+ 405, 440, 509,
+ 612, 385, 379,
+ 536, 607, 216,
+ -56, 582, 192,
+ 100, 517, 567,
+ -365, 448, 445,
+ 728, 347, 10,
+ 505, 357, 759,
+ 636, 582, 658,
+ 335, 517, 852,
+ 378, 809, 572,
+ -195, 878, 829,
+ 529, 707, 987,
+ 918, 726, 392,
+ 1250, 997, 1063
+};
+
+/*-------------------------------------------------------------------*
+ * 1st stage, 3rd split: ISF5 to ISF7
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook for SID frames - 28b, 3rd spilt */
+const Word16 dico3_ns_28b_fx[] =
+{/*Qlog2(2.56)*/
+ -805, -838, -774,
+ -522, -627, -828,
+ -477, -486, -603,
+ -295, -481, -634,
+ -366, -384, -393,
+ -186, -414, -396,
+ -237, -394, -106,
+ -252, -202, -275,
+ -61, -177, -442,
+ -84, -198, -199,
+ -179, -125, -31,
+ -72, -47, -163,
+ -298, -220, 215,
+ -64, -168, 251,
+ -133, 156, -59,
+ -30, -2, 127,
+ 54, 66, -61,
+ -233, 21, 251,
+ 209, -50, 32,
+ 33, 194, 136,
+ -117, -18, 475,
+ 202, 46, 309,
+ 256, 185, 53,
+ 35, 200, 390,
+ 200, 263, 242,
+ -216, 302, 294,
+ 128, 358, 0,
+ 19, 431, 287,
+ 224, 447, 280,
+ 367, 165, 213,
+ 397, 314, 319,
+ 383, 379, 75,
+ 277, 325, 462,
+ 394, 505, 334,
+ 251, 98, -213,
+ 450, 153, 448,
+ 565, 226, 76,
+ 470, 383, 502,
+ 635, 390, 278,
+ 237, 135, 620,
+ 342, 401, 649,
+ 331, 551, 518,
+ 130, 418, 592,
+ 531, 306, 737,
+ 729, 389, 580,
+ 497, 557, 699,
+ 296, 383, 874,
+ 283, 624, 759,
+ 126, 622, 476,
+ 559, 595, 472,
+ 382, 770, 616,
+ 719, 613, 745,
+ 540, 639, 928,
+ 517, 826, 801,
+ 684, 811, 604,
+ 752, 786, 857,
+ 933, 661, 350,
+ 694, 450, 1061,
+ 562, 911, 1051,
+ 824, 813, 1104,
+ 758, 1047, 882,
+ 1140, 917, 889,
+ 1039, 1246, 1426,
+ 1483, 1666, 1876
+};
+
+/*-------------------------------------------------------------------*
+ * 1st stage, 4th split: ISF8 to ISF11
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook for SID frames - 28b, 4th spilt */
+const Word16 dico4_ns_28b_fx[] =
+{/*Qlog2(2.56)*/
+ -776, -854, -891, -920,
+ -552, -610, -663, -741,
+ -321, -370, -476, -565,
+ 274, -160, -456, 201,
+ 265, 67, -160, -306,
+ -8, -210, 79, 272,
+ 163, 236, 307, 308,
+ 578, 317, 64, 298,
+ -9, 197, 342, 620,
+ 343, 232, 314, 622,
+ 173, 149, 548, 527,
+ 356, 370, 481, 376,
+ 135, 444, 488, 556,
+ 391, 471, 487, 653,
+ 228, 424, 576, 835,
+ 422, 372, 722, 682,
+ 295, 673, 693, 635,
+ 539, 596, 590, 449,
+ 475, 618, 659, 818,
+ 735, 517, 491, 673,
+ 602, 346, 257, 877,
+ 625, 635, 849, 720,
+ 727, 818, 698, 595,
+ 653, 481, 690, 1139,
+ 814, 762, 704, 908,
+ 507, 747, 898, 936,
+ 848, 855, 924, 785,
+ 646, 1037, 882, 795,
+ 772, 845, 1024, 1151,
+ 1133, 983, 818, 921,
+ 940, 1068, 1252, 1302,
+ 1588, 1767, 1718, 1513
+};
+
+/*-------------------------------------------------------------------*
+ * 1st stage, 5th split: ISF12 to ISF15
+ *-------------------------------------------------------------------*/
+
+/* ISF codebook for SID frames - 28b, 5th spilt */
+const Word16 dico5_ns_28b_fx[] =
+{/*Qlog2(2.56)*/
+ -810, -879, -945, -254,
+ 248, 184, 671, 128,
+ 288, 703, 918, 99,
+ 658, 558, 662, 219,
+ 552, 585, 910, 208,
+ 559, 804, 759, 119,
+ 606, 774, 921, -139,
+ 782, 761, 748, 208,
+ 756, 708, 983, 56,
+ 544, 864, 1010, 152,
+ 737, 698, 987, 299,
+ 771, 924, 879, 103,
+ 536, 785, 961, 405,
+ 667, 916, 801, 328,
+ 738, 705, 773, 439,
+ 823, 871, 992, 355,
+ 640, 1004, 1052, 369,
+ 724, 822, 949, 597,
+ 415, 655, 729, 482,
+ 1009, 896, 793, 363,
+ 908, 803, 687, -25,
+ 1016, 838, 1011, 189,
+ 947, 1112, 942, 222,
+ 914, 1049, 981, 527,
+ 956, 987, 1011, -120,
+ 781, 1049, 1121, 92,
+ 1178, 1053, 884, 47,
+ 1123, 1059, 1182, 118,
+ 933, 972, 1277, 357,
+ 1109, 918, 1101, 503,
+ 1039, 1286, 1220, 317,
+ 1351, 1207, 1010, 326
+}; /*1.28f Q1*/
+
+const Word16 means_nb_31bits_ma_lsf[16] = { 861 /*336.3281f*1.28f Q1*/, 1360 /*531.2500f*1.28f Q1*/, 2270 /*886.7188f*1.28f Q1*/, 3243 /*1266.7969f*1.28f Q1*/, 4171 /*1629.2969f*1.28f Q1*/, 5052 /*1973.4375f*1.28f Q1*/, 6012 /*2348.4375f*1.28f Q1*/, 6776 /*2646.8750f*1.28f Q1*/, 7676 /*2998.4375f*1.28f Q1*/, 8428 /*3292.1875f*1.28f Q1*/, 9194 /*3591.4062f*1.28f Q1*/, 9744 /*3806.2500f*1.28f Q1*/, 10580 /*4132.8125f*1.28f Q1*/, 11911 /*4652.7344f*1.28f Q1*/, 13440 /*5250.0000f*1.28f Q1*/, 15061 /*5883.2031f*1.28f Q1*/ };
+const Word16 means_wb_31bits_ma_lsf[16] = { 818 /*319.5312f*1.28f Q1*/, 1403 /*548.0469f*1.28f Q1*/, 2392 /*934.3750f*1.28f Q1*/, 3465 /*1353.5156f*1.28f Q1*/, 4429 /*1730.0781f*1.28f Q1*/, 5428 /*2120.3125f*1.28f Q1*/, 6414 /*2505.4688f*1.28f Q1*/, 7323 /*2860.5469f*1.28f Q1*/, 8304 /*3243.7500f*1.28f Q1*/, 9221 /*3601.9531f*1.28f Q1*/, 10162 /*3969.5312f*1.28f Q1*/, 11091 /*4332.4219f*1.28f Q1*/, 12125 /*4736.3281f*1.28f Q1*/, 13153 /*5137.8906f*1.28f Q1*/, 14241 /*5562.8906f*1.28f Q1*/, 15266 /*5963.2812f*1.28f Q1*/ };
+
+
+const Word16 *lsf_means[2] = { means_wb_31bits_ma_lsf, means_nb_31bits_ma_lsf };
+
+const lsp_unw_triplet p16_gamma0_92to1[16] = /* Q14 */
+{
+ { 0, 19622, -9695 },
+ { -14938, 29357, -13258 },
+ { -8483, 23708, -13414 },
+ { -7350, 22410, -12305 },
+ { -7397, 21417, -12160 },
+ { -7071, 19878, -11229 },
+ { -7144, 19877, -11326 },
+ { -6423, 17194, -9613 },
+ { -7407, 18024, -9695 },
+ { -6972, 16339, -8191 },
+ { -8220, 17625, -8422 },
+ { -8159, 17459, -8289 },
+ { -8700, 19066, -9508 },
+ { -7986, 17629, -8607 },
+ { -8503, 17203, -8109 },
+ { -7820, 14903, 0 }
+};
+
+const lsp_unw_triplet p16_gamma0_94to1[16] = /* Q14 */
+{
+ { 0, 12931, -6314 },
+ { -9364, 19577, -8870 },
+ { -5512, 16236, -9305 },
+ { -4892, 15366, -8398 },
+ { -4869, 14631, -8275 },
+ { -4631, 13358, -7540 },
+ { -4575, 13271, -7599 },
+ { -4151, 11403, -6385 },
+ { -4859, 11947, -6371 },
+ { -4504, 10805, -5407 },
+ { -5346, 11618, -5515 },
+ { -5418, 11578, -5424 },
+ { -5806, 12711, -6226 },
+ { -5205, 11592, -5606 },
+ { -5745, 11498, -5188 },
+ { -5473, 10245, 0 }
+};
+
+
+const Word16 dico_lsf_abs_8b[256 * M] = /*14Q1*1.28*/
+{
+ 966, 1761, 2937, 3740, 4574, 5488, 6457, 7398, 8355, 9289, 10254, 11211, 12247, 13202, 14221, 15172,
+ 1540, 2731, 3544, 4232, 5065, 5917, 6846, 7707, 8602, 9538, 10479, 11445, 12439, 13339, 14332, 15243,
+ 1414, 2201, 3469, 4160, 4832, 5563, 6504, 7493, 8507, 9423, 10261, 11087, 12014, 12887, 13935, 15041,
+ 1176, 2031, 3312, 4141, 4915, 5612, 6368, 7097, 7965, 8861, 9900, 10956, 12137, 13161, 14215, 15190,
+ 840, 1102, 1853, 3913, 4514, 5155, 5976, 6577, 7726, 8469, 9195, 9896, 12016, 13534, 14458, 15327,
+ 1165, 1552, 2467, 3520, 3933, 4902, 6085, 6607, 7652, 8343, 8922, 9577, 11002, 13331, 14521, 15310,
+ 1113, 1431, 2280, 3471, 3975, 4853, 5690, 6407, 7275, 8032, 8621, 9884, 12276, 13033, 13880, 15039,
+ 719, 1036, 1867, 2553, 4352, 5021, 5775, 6505, 7179, 7826, 9601, 11113, 12075, 12807, 14022, 15272,
+ 953, 1294, 1952, 2553, 3007, 5085, 6062, 6718, 8178, 8712, 9927, 11330, 12351, 13205, 14164, 15087,
+ 940, 1283, 2111, 2792, 3256, 3911, 6096, 6898, 7589, 9317, 10103, 10891, 11893, 12886, 13757, 15049,
+ 587, 903, 1795, 3140, 4297, 4853, 5479, 6468, 7886, 8442, 9844, 11336, 12043, 12793, 13911, 15151,
+ 861, 1323, 2258, 3258, 3853, 4815, 5824, 6684, 8004, 9358, 10709, 11951, 12810, 13582, 14465, 15216,
+ 758, 1202, 2449, 3134, 3694, 4423, 5673, 6885, 7835, 9014, 10027, 11120, 12196, 13199, 14218, 15199,
+ 1042, 1478, 2150, 3726, 4263, 4954, 6139, 6790, 7965, 8974, 9643, 10764, 12030, 12725, 13557, 14581,
+ 719, 926, 2434, 3748, 4185, 5032, 5661, 6815, 7286, 9180, 10365, 11159, 11991, 12918, 13824, 15248,
+ 715, 1008, 2245, 3846, 4283, 5859, 6516, 7754, 9005, 9791, 10611, 11473, 12342, 13216, 14190, 15177,
+ 972, 1282, 1856, 2557, 3020, 4536, 7105, 8030, 8649, 9405, 10103, 10712, 11575, 12633, 13608, 14745,
+ 813, 1132, 1994, 2990, 3472, 4041, 4711, 7349, 8285, 8967, 9924, 10497, 11905, 13402, 14503, 15358,
+ 897, 1260, 1953, 3238, 3878, 4495, 6373, 7420, 8046, 9326, 10330, 10893, 11883, 13155, 14226, 15156,
+ 772, 1190, 1952, 2591, 4617, 5613, 6788, 7715, 8323, 9061, 10103, 11442, 12520, 13313, 14105, 15130,
+ 648, 914, 1614, 2978, 3913, 5180, 6371, 7029, 7510, 8288, 10181, 11303, 12262, 13298, 14629, 15443,
+ 679, 934, 1510, 2061, 4006, 5506, 6056, 6653, 7326, 8996, 10254, 11800, 12686, 13410, 14130, 15080,
+ 536, 802, 1288, 2431, 4428, 4896, 5421, 6396, 8409, 9756, 10509, 11135, 12212, 13338, 14298, 15284,
+ 774, 1064, 1751, 2361, 3813, 5723, 6272, 7170, 7837, 9027, 9999, 10677, 11383, 12564, 14005, 15142,
+ 678, 938, 1492, 2025, 4146, 5207, 5984, 6738, 7509, 8781, 9766, 10948, 12156, 13220, 14217, 15296,
+ 639, 927, 1490, 2153, 4243, 5592, 6466, 7219, 7989, 9277, 10369, 11353, 12295, 13240, 14272, 15267,
+ 743, 1035, 1700, 2248, 3167, 5728, 6394, 7572, 8421, 9284, 10729, 11762, 12753, 13526, 14380, 15202,
+ 468, 692, 1255, 2740, 4287, 5357, 6462, 7499, 8537, 9503, 10499, 11458, 12457, 13393, 14352, 15260,
+ 734, 989, 1478, 1957, 2947, 5157, 6144, 7370, 8090, 8834, 9907, 11183, 12331, 13280, 14246, 15263,
+ 461, 681, 1659, 3534, 4547, 5654, 6632, 7664, 8623, 9608, 10561, 11542, 12490, 13438, 14368, 15271,
+ 792, 1113, 1855, 2398, 3238, 5817, 6524, 7434, 8483, 9164, 10021, 11002, 12178, 13218, 14316, 15216,
+ 658, 1008, 1970, 3074, 4543, 5908, 7154, 8105, 8980, 9832, 10606, 11401, 12264, 13165, 14158, 15163,
+ 1009, 1541, 2392, 3464, 4644, 5562, 6666, 7588, 8538, 9554, 10547, 11489, 12487, 13412, 14326, 15206,
+ 955, 1704, 3142, 3903, 4985, 6046, 7112, 8024, 8864, 9606, 10417, 11275, 12242, 13171, 14188, 15188,
+ 1152, 2084, 3441, 4308, 5341, 6367, 7465, 8361, 9258, 10034, 10799, 11569, 12435, 13295, 14269, 15192,
+ 1361, 2472, 3734, 4540, 5724, 6786, 7934, 8876, 9753, 10482, 11209, 11930, 12704, 13494, 14411, 15293,
+ 1448, 2793, 3997, 5078, 6382, 7418, 8278, 9062, 9827, 10479, 11193, 11976, 12798, 13632, 14523, 15357,
+ 1488, 2499, 3704, 4557, 5499, 6512, 7628, 8636, 9720, 10662, 11547, 12425, 13250, 13991, 14754, 15490,
+ 1099, 2055, 3146, 3872, 4700, 5675, 6721, 7670, 8652, 9638, 10640, 11603, 12561, 13473, 14404, 15285,
+ 575, 841, 1577, 3091, 3894, 4777, 5587, 6225, 8293, 8937, 9666, 10986, 12135, 13292, 14164, 15178,
+ 799, 1086, 1834, 2360, 3186, 5166, 5756, 7271, 8036, 8703, 9532, 10239, 11731, 13180, 14418, 15362,
+ 956, 1297, 2021, 2413, 4341, 5175, 5948, 6783, 7304, 8114, 9024, 9853, 10910, 12746, 14094, 15167,
+ 1288, 1856, 2407, 3125, 3686, 4421, 5672, 6339, 7288, 8274, 9315, 10205, 11191, 12856, 14483, 15463,
+ 1020, 1359, 2139, 2709, 3398, 4646, 5412, 6441, 7053, 7923, 9213, 10192, 11791, 13084, 14208, 15242,
+ 839, 1165, 2114, 2625, 3382, 3972, 5064, 7268, 7966, 8749, 9833, 12022, 13123, 13848, 14622, 15279,
+ 837, 1104, 1848, 2230, 3860, 4731, 5491, 6377, 6917, 8917, 10029, 10891, 12043, 12753, 13952, 15201,
+ 1136, 1564, 2097, 2558, 3026, 4824, 5743, 6459, 7664, 8183, 9819, 10837, 11538, 12762, 14193, 15309,
+ 1013, 1492, 2105, 2593, 3135, 5090, 6278, 6877, 7559, 8026, 9120, 10257, 11268, 12899, 14253, 15324,
+ 677, 952, 1578, 2156, 3456, 4665, 5545, 6815, 7822, 8967, 10044, 11143, 12218, 13205, 14269, 15290,
+ 560, 833, 1626, 2825, 4189, 5300, 5822, 6280, 7858, 9256, 10189, 11481, 12413, 13040, 14138, 15123,
+ 666, 1181, 2686, 3416, 4169, 5158, 6179, 7282, 8275, 9372, 10419, 11434, 12436, 13400, 14358, 15244,
+ 773, 1040, 1809, 3551, 4049, 5132, 5867, 6525, 7877, 8558, 9275, 10956, 12231, 13016, 14012, 15032,
+ 881, 1209, 1988, 3725, 4126, 5152, 6189, 6712, 8497, 9495, 10097, 11006, 12228, 13271, 14197, 15140,
+ 850, 1109, 2540, 3212, 3836, 4671, 5423, 6258, 6873, 7502, 9107, 10990, 12254, 13154, 14378, 15352,
+ 721, 954, 2751, 3694, 4320, 5071, 5825, 6738, 7291, 7984, 9289, 11579, 12483, 13254, 14338, 15260,
+ 1055, 1371, 1968, 3743, 4580, 4986, 5695, 6267, 7257, 8890, 9548, 10261, 11586, 12347, 13324, 15091,
+ 676, 972, 2112, 2850, 3753, 4728, 5494, 6367, 7285, 8675, 9943, 11368, 12460, 13350, 14172, 15122,
+ 1049, 1494, 2200, 3000, 3527, 5081, 6046, 6884, 8291, 9069, 10097, 11369, 12496, 13375, 14347, 15128,
+ 814, 1123, 2183, 2717, 3304, 3975, 5256, 6076, 7491, 8840, 10493, 11738, 12716, 13494, 14450, 15263,
+ 948, 1271, 2388, 3106, 3719, 4616, 5356, 6675, 7383, 7967, 9440, 11584, 12408, 13133, 13866, 14860,
+ 635, 881, 1924, 3907, 4384, 5217, 5950, 6984, 7695, 8650, 9877, 11108, 12074, 13120, 14245, 15282,
+ 762, 1028, 2283, 3533, 3943, 4563, 5144, 6692, 7423, 8653, 9739, 10969, 12023, 13103, 14147, 15192,
+ 579, 854, 1748, 3347, 3979, 4734, 5418, 7056, 8203, 9063, 10246, 11271, 12279, 13293, 14338, 15258,
+ 503, 768, 1465, 3077, 4620, 5151, 5798, 7143, 8378, 9391, 10401, 11373, 12315, 13200, 14113, 15106,
+ 717, 1002, 1807, 3675, 4066, 5418, 6034, 6837, 8445, 8980, 10353, 11755, 12753, 13520, 14476, 15232,
+ 672, 949, 1676, 3274, 4729, 5344, 6538, 7393, 8330, 9755, 10902, 11594, 12475, 13327, 14247, 15152,
+ 496, 912, 2757, 3804, 4833, 5819, 6853, 7814, 8753, 9709, 10654, 11604, 12540, 13471, 14395, 15300,
+ 775, 1049, 2302, 3012, 3920, 4950, 5709, 7219, 7761, 9746, 10544, 11297, 12044, 12831, 13700, 15084,
+ 1078, 1504, 2140, 3195, 3778, 4555, 5966, 6673, 7747, 8995, 9612, 10447, 11613, 12329, 13101, 14856,
+ 968, 1849, 3399, 4265, 5004, 5732, 6679, 7575, 8554, 9526, 10485, 11412, 12400, 13344, 14309, 15220,
+ 1199, 2464, 3945, 4913, 6009, 6786, 7495, 8106, 8835, 9620, 10520, 11438, 12438, 13342, 14319, 15235,
+ 1081, 2165, 3828, 4637, 5448, 6070, 6800, 7534, 8434, 9349, 10320, 11262, 12293, 13218, 14232, 15192,
+ 1083, 1694, 2537, 3083, 3771, 5128, 6256, 7141, 8587, 9530, 10324, 11062, 11832, 12707, 13900, 15104,
+ 925, 1244, 2121, 3433, 3834, 5306, 6241, 6848, 8344, 9060, 9700, 10464, 11277, 12214, 14081, 15400,
+ 773, 1006, 1754, 4566, 5209, 5778, 6451, 7124, 8069, 8706, 9253, 10001, 10837, 12064, 14326, 15356,
+ 620, 950, 1866, 3048, 4740, 5460, 5977, 6457, 7915, 9271, 9868, 10687, 11496, 12237, 13203, 15016,
+ 1104, 1439, 2275, 2648, 3695, 5401, 5983, 7243, 7860, 8327, 8987, 11178, 12399, 13141, 14208, 14977,
+ 1076, 1712, 2332, 3118, 4625, 5250, 6130, 7069, 7734, 8740, 10166, 11116, 12011, 12960, 13959, 14830,
+ 659, 949, 1548, 2807, 4382, 4952, 5938, 7089, 7729, 8587, 10547, 11148, 11668, 12528, 13953, 15131,
+ 618, 891, 1593, 3197, 3993, 4733, 5928, 6583, 7372, 9278, 10158, 10852, 12066, 13201, 14256, 15298,
+ 1226, 1611, 2351, 3438, 3930, 4616, 6358, 6975, 7675, 9306, 10025, 10545, 11077, 12750, 14164, 15269,
+ 680, 957, 1852, 3036, 3864, 5284, 5883, 6570, 7132, 8763, 9943, 10590, 11425, 12827, 14180, 15184,
+ 567, 890, 1811, 3039, 4034, 4670, 5067, 5886, 7597, 8889, 10127, 10989, 12275, 13126, 14471, 15240,
+ 1017, 1306, 1912, 4065, 5098, 5506, 6244, 6943, 7610, 8963, 10029, 10608, 11375, 12363, 14054, 15433,
+ 718, 949, 1640, 4407, 4989, 5504, 6145, 6846, 8055, 8755, 9764, 11309, 12335, 13157, 13991, 15052,
+ 833, 1104, 2582, 3256, 3910, 5291, 5740, 7382, 8142, 8582, 9618, 11230, 12436, 13284, 14118, 14993,
+ 1157, 1491, 2370, 3490, 3848, 5022, 5800, 6591, 7995, 8564, 9304, 10921, 12495, 13372, 14254, 15054,
+ 1052, 1417, 2072, 2620, 3044, 4572, 5432, 6284, 7546, 8244, 9800, 10798, 12368, 13625, 14662, 15445,
+ 795, 1132, 1902, 2810, 3433, 4747, 5790, 6745, 8443, 9315, 10050, 10836, 11673, 12528, 13832, 15149,
+ 967, 1250, 2420, 3159, 3625, 4266, 4948, 7030, 7674, 8235, 9112, 9840, 11161, 12837, 14235, 15341,
+ 730, 997, 2113, 3171, 3737, 4764, 5577, 6449, 7240, 8394, 9116, 10604, 12009, 13102, 14231, 15244,
+ 1192, 1617, 2341, 3430, 4000, 4721, 5596, 6358, 7429, 8167, 8895, 9916, 10855, 12188, 13896, 15254,
+ 872, 1150, 2032, 3553, 3983, 4963, 5636, 6604, 7462, 8064, 9470, 10203, 11089, 12799, 14118, 15282,
+ 1013, 1444, 1984, 3267, 4408, 4772, 5805, 7143, 7690, 8647, 10029, 10669, 11431, 12636, 13988, 15117,
+ 830, 1134, 1866, 3581, 4056, 4925, 6011, 6558, 8076, 8830, 9656, 10706, 12639, 13726, 14663, 15367,
+ 684, 957, 1801, 3005, 3559, 4879, 5574, 6920, 7739, 8471, 9724, 10719, 12040, 13148, 14262, 15275,
+ 699, 1022, 2042, 3021, 3652, 5369, 6030, 7152, 8031, 8854, 9968, 10869, 11910, 13073, 14255, 15228,
+ 831, 1105, 1945, 3827, 4272, 5403, 6214, 6843, 8117, 8827, 9516, 10328, 11201, 12905, 14507, 15398,
+ 785, 1036, 2037, 4291, 4698, 5531, 6223, 7000, 8372, 9181, 9784, 10501, 11195, 12592, 13855, 15023,
+ 1079, 1556, 2081, 3294, 4678, 5189, 5975, 6991, 7650, 8458, 9624, 10387, 11370, 12518, 13343, 14521,
+ 1085, 1535, 2122, 2772, 3190, 4157, 6280, 7310, 8119, 8898, 9511, 10169, 11313, 12529, 13732, 15153,
+ 1130, 1625, 2359, 3044, 3504, 5151, 6102, 6755, 7616, 8099, 8791, 9828, 10718, 12434, 14231, 15302,
+ 894, 1194, 1854, 2315, 3048, 5073, 5700, 6637, 7336, 8181, 9563, 10924, 12316, 13331, 14349, 15237,
+ 1274, 1843, 2368, 2935, 3396, 4031, 5905, 6950, 7597, 8704, 9554, 10193, 11657, 13031, 13891, 14934,
+ 1208, 1660, 2310, 3189, 3644, 4355, 5442, 6162, 7602, 8433, 9505, 10600, 12310, 13625, 14495, 15234,
+ 884, 1244, 2154, 2652, 3187, 3810, 5991, 6674, 7284, 8251, 9106, 10547, 11947, 13173, 14248, 15300,
+ 851, 1095, 2125, 2913, 3429, 4068, 4931, 6228, 6911, 8477, 9513, 10932, 12187, 13333, 14385, 15286,
+ 637, 976, 2370, 3892, 4718, 6063, 7126, 8378, 9405, 10359, 11188, 12001, 12807, 13610, 14465, 15303,
+ 674, 1156, 3206, 3848, 4574, 5332, 6275, 7180, 7979, 8944, 9945, 11135, 12211, 13166, 14189, 15185,
+ 648, 874, 1620, 4523, 5335, 5818, 6480, 7079, 8024, 8654, 9320, 10068, 11602, 13428, 14329, 15293,
+ 602, 831, 3174, 4258, 4758, 5558, 6154, 6862, 7261, 8173, 9894, 11228, 12406, 13185, 14416, 15390,
+ 728, 1050, 2523, 3324, 4581, 5112, 6274, 7249, 7665, 8228, 9024, 9779, 11962, 13886, 14569, 15310,
+ 625, 1064, 2658, 3373, 4317, 5328, 6341, 7576, 8230, 9137, 10072, 11030, 12105, 13071, 14050, 15127,
+ 860, 1199, 2569, 3264, 3928, 5082, 6012, 7023, 7568, 8726, 9899, 10975, 11665, 12602, 13465, 14849,
+ 994, 1326, 2131, 3392, 3914, 4629, 5507, 6365, 7208, 8086, 9307, 10139, 11960, 13752, 14791, 15505,
+ 1297, 1723, 2304, 2955, 3528, 4575, 5330, 6141, 7321, 7873, 9079, 11066, 12114, 12781, 13485, 14866,
+ 1247, 1673, 2480, 3557, 4100, 4892, 5843, 6678, 7764, 8607, 9292, 10007, 11055, 11895, 12912, 14829,
+ 1108, 1515, 2302, 3815, 4582, 5275, 6233, 7271, 7993, 8890, 9807, 10489, 11145, 11905, 12753, 14036,
+ 969, 1302, 2055, 2425, 3922, 5219, 6014, 6785, 7331, 9195, 10032, 10897, 11788, 12542, 13408, 14826,
+ 1042, 1398, 2217, 2813, 3449, 4242, 5032, 6957, 7766, 8985, 9916, 10576, 11237, 12222, 13952, 15302,
+ 1099, 1456, 2313, 2814, 3532, 5651, 6349, 7119, 8208, 8769, 9427, 10112, 11070, 12005, 12975, 14815,
+ 952, 1343, 2279, 4277, 5014, 5588, 6550, 7259, 8172, 9304, 10112, 10905, 11848, 12798, 13734, 14852,
+ 827, 1155, 2015, 2590, 3389, 5575, 6147, 7237, 8788, 9352, 9943, 10452, 11166, 11866, 13017, 14908,
+ 965, 1342, 1904, 3530, 4756, 5265, 6282, 7430, 8006, 8866, 10189, 10858, 11593, 12497, 13413, 14286,
+ 791, 1033, 1807, 4669, 5445, 6065, 6777, 7311, 8217, 8955, 9594, 10171, 10891, 11711, 13024, 15079,
+ 703, 982, 1468, 2926, 5508, 6551, 7045, 7648, 8280, 9027, 10043, 10724, 11477, 12486, 13816, 15160,
+ 636, 1084, 3228, 4342, 5051, 5884, 6638, 7545, 8362, 9253, 10190, 11160, 12212, 13207, 14220, 15198,
+ 821, 1100, 1682, 3559, 5618, 6419, 6944, 7630, 8233, 9075, 10130, 10822, 11427, 12149, 13027, 14146,
+ 629, 1332, 3013, 3722, 4532, 5532, 6531, 7553, 8517, 9499, 10507, 11474, 12457, 13390, 14358, 15272,
+ 1317, 2450, 3297, 3892, 4613, 5418, 6425, 7337, 8291, 9245, 10282, 11346, 12442, 13393, 14373, 15268,
+ 1375, 2387, 3533, 4376, 5325, 6263, 7320, 8268, 9276, 10272, 11197, 12094, 13000, 13818, 14648, 15432,
+ 1158, 2044, 2814, 3372, 4231, 5273, 6326, 7190, 8055, 8945, 9909, 11036, 12230, 13264, 14271, 15192,
+ 871, 1102, 2233, 4189, 4539, 5309, 5875, 6894, 8135, 8683, 9397, 10814, 12535, 13312, 14286, 15134,
+ 814, 1062, 2256, 4246, 4741, 5468, 6095, 6832, 7800, 8445, 9019, 9623, 10539, 12957, 14398, 15333,
+ 958, 1249, 1879, 3625, 4221, 4743, 5374, 6010, 7564, 8370, 9054, 10537, 11472, 12580, 13996, 15129,
+ 871, 1148, 2666, 3651, 4193, 5040, 5660, 6778, 7459, 8017, 8780, 9530, 10508, 12721, 14270, 15304,
+ 651, 1057, 2426, 3096, 4328, 5224, 6148, 6984, 7722, 9038, 10150, 11248, 12299, 13281, 14301, 15245,
+ 617, 889, 2138, 4101, 4573, 5464, 6134, 7293, 8294, 9277, 10316, 11265, 12281, 13301, 14327, 15273,
+ 792, 1161, 2081, 2883, 3644, 5502, 6438, 7760, 8867, 9704, 10404, 11003, 11913, 13286, 14647, 15445,
+ 1202, 1869, 2491, 2996, 4025, 5336, 6574, 7586, 8415, 9166, 9940, 11099, 12441, 13461, 14408, 15252,
+ 1164, 2036, 2762, 3315, 4510, 5722, 6901, 7925, 8892, 9813, 10715, 11594, 12526, 13416, 14359, 15235,
+ 1442, 2242, 2916, 3528, 4751, 5836, 6787, 7599, 8395, 9235, 10177, 11157, 12208, 13147, 14145, 15115,
+ 1182, 2189, 3501, 4359, 5481, 6402, 7306, 7997, 8719, 9457, 10314, 11195, 12207, 13152, 14186, 15159,
+ 1123, 1928, 3249, 4174, 5190, 6018, 6841, 7570, 8320, 9079, 9969, 10880, 11946, 12957, 14056, 15116,
+ 1391, 2121, 3172, 3766, 4449, 5215, 6232, 7171, 8096, 8981, 9854, 10664, 11746, 12851, 14017, 15116,
+ 1330, 2144, 2998, 3489, 4141, 5059, 6328, 7427, 8552, 9564, 10505, 11379, 12290, 13173, 14193, 15189,
+ 1109, 1492, 2303, 2946, 3382, 4987, 6548, 6997, 8296, 9305, 9871, 10389, 11172, 13047, 14487, 15395,
+ 1088, 1547, 2223, 3092, 3620, 4386, 6452, 7580, 8220, 9176, 10021, 10624, 11535, 12511, 13349, 14330,
+ 888, 1265, 1930, 3715, 4354, 4929, 6671, 7348, 8125, 9622, 10527, 11265, 12457, 13225, 13909, 14800,
+ 815, 1189, 2006, 3817, 4374, 5838, 6485, 7386, 8816, 9395, 10242, 10930, 11702, 12358, 13510, 14977,
+ 990, 1329, 1856, 2513, 2960, 3841, 6200, 7584, 8128, 9084, 9884, 10615, 11927, 13026, 14162, 15236,
+ 809, 1891, 3000, 3978, 4992, 5938, 6931, 7857, 8818, 9757, 10695, 11637, 12557, 13495, 14394, 15295,
+ 554, 1531, 2712, 3754, 4813, 5795, 6805, 7758, 8739, 9677, 10642, 11569, 12527, 13426, 14344, 15173,
+ 961, 1247, 2162, 4030, 4594, 5392, 6191, 6804, 7979, 8852, 9449, 10061, 10905, 11757, 12852, 14951,
+ 1214, 1854, 2494, 3286, 3894, 4471, 5973, 7358, 7967, 8807, 9608, 10178, 10994, 12344, 13316, 14487,
+ 1024, 1446, 2069, 2773, 3329, 5327, 6627, 7318, 8209, 8780, 9592, 11114, 12066, 12765, 13662, 14618,
+ 907, 1229, 2135, 2657, 3456, 4585, 5614, 6412, 7107, 8072, 10517, 11769, 12447, 13038, 14011, 15186,
+ 608, 888, 1729, 3791, 4395, 4825, 5374, 6977, 7738, 8387, 9316, 10715, 12651, 13548, 14546, 15311,
+ 941, 1202, 2101, 3123, 3503, 4159, 4619, 6676, 7402, 8223, 9627, 10280, 11822, 13131, 14470, 15468,
+ 800, 1065, 1726, 2186, 4630, 5715, 6394, 7256, 7782, 8452, 9368, 11407, 12394, 13086, 14086, 15167,
+ 875, 1208, 1941, 2508, 3296, 4447, 5532, 6821, 7582, 8862, 9556, 10519, 11696, 12896, 14109, 15273,
+ 900, 1183, 1959, 2423, 3386, 5868, 6409, 7218, 7883, 8442, 9143, 9913, 11104, 13003, 14241, 15213,
+ 1115, 1573, 2286, 3113, 3574, 4645, 5519, 6311, 8196, 8937, 9864, 11290, 12252, 13043, 13810, 14631,
+ 754, 1068, 2679, 3694, 4190, 5008, 5606, 7347, 8013, 8864, 9972, 10786, 11627, 12824, 14010, 15316,
+ 825, 1144, 1765, 3426, 4206, 4874, 6385, 7180, 7946, 9319, 10153, 10682, 11276, 11957, 13415, 15087,
+ 537, 862, 1866, 3116, 4349, 4842, 5496, 7245, 7958, 8822, 9611, 10099, 11455, 13291, 14370, 15284,
+ 887, 1205, 1698, 3243, 5173, 5813, 6470, 7237, 7881, 8707, 9739, 10497, 11284, 12115, 13185, 14869,
+ 726, 1002, 2984, 3728, 4334, 5142, 5946, 7127, 7676, 8367, 9085, 10668, 11889, 13054, 14011, 15180,
+ 771, 981, 1772, 4221, 4795, 5401, 6003, 6690, 7480, 8115, 8717, 9938, 12232, 13037, 13941, 15157,
+ 1303, 1922, 2468, 3316, 4185, 4656, 5507, 6631, 7341, 8291, 9593, 10378, 11412, 12616, 13556, 14820,
+ 1080, 1403, 2477, 2954, 3741, 4642, 5517, 6582, 7111, 7805, 8786, 9547, 11253, 12874, 14045, 15236,
+ 872, 1141, 2386, 3209, 3896, 5042, 5805, 7002, 7549, 8285, 9036, 9939, 12031, 13030, 13767, 15055,
+ 728, 1046, 2013, 4276, 5230, 5799, 6889, 7772, 8535, 9890, 10949, 11702, 12791, 13661, 14459, 15218,
+ 768, 1578, 3171, 4134, 5114, 6061, 7128, 8112, 9139, 10152, 11101, 12005, 12913, 13736, 14586, 15387,
+ 622, 1221, 3202, 4279, 5529, 6753, 7808, 8631, 9408, 10115, 10830, 11631, 12512, 13365, 14324, 15263,
+ 621, 848, 1626, 4612, 5335, 5797, 6416, 7167, 8286, 8933, 9880, 11327, 12709, 13565, 14439, 15329,
+ 650, 861, 3115, 4397, 4828, 5572, 6159, 7071, 7513, 8108, 8667, 9739, 12413, 13532, 14414, 15581,
+ 756, 1091, 1615, 2958, 4679, 5429, 6304, 7065, 7657, 8329, 10012, 10763, 11425, 12569, 14285, 15324,
+ 765, 1051, 2074, 3446, 3838, 5659, 6318, 7149, 8407, 8942, 9688, 11058, 12443, 13347, 14361, 15231,
+ 1121, 1473, 2217, 2827, 3347, 5017, 5872, 6668, 7595, 8264, 9085, 10487, 12210, 13022, 13866, 14985,
+ 1056, 1457, 2212, 2861, 3453, 5060, 5976, 6759, 7697, 8519, 9461, 10348, 11169, 12000, 13798, 15274,
+ 1042, 1388, 2220, 3677, 4297, 5120, 6037, 6788, 7788, 8549, 9262, 10069, 10878, 11755, 14085, 15413,
+ 961, 1331, 1957, 3111, 3796, 4344, 5010, 5553, 7612, 9441, 10155, 10903, 11982, 12664, 13391, 14959,
+ 1135, 1470, 2082, 3284, 3937, 4423, 5140, 5618, 7055, 8860, 9355, 10318, 11706, 12556, 13826, 15192,
+ 1084, 1383, 2209, 3550, 4038, 4636, 5240, 5911, 8011, 9044, 9570, 10294, 11155, 11865, 13587, 15219,
+ 737, 1028, 1858, 2434, 3038, 3815, 5414, 6560, 7753, 9010, 10088, 11109, 12200, 13241, 14292, 15286,
+ 979, 1377, 2142, 3511, 4042, 4787, 5869, 6505, 7764, 8710, 9567, 10378, 11383, 13445, 14620, 15417,
+ 802, 1063, 1768, 3997, 4648, 5273, 6005, 6694, 7698, 8427, 9191, 10230, 11176, 12425, 13991, 15244,
+ 926, 1148, 2359, 3438, 3811, 4446, 4994, 6492, 7088, 7840, 8921, 9955, 11823, 13037, 14140, 15275,
+ 639, 939, 1753, 3080, 4204, 5022, 5702, 6198, 6811, 8268, 9786, 10836, 12243, 13126, 14260, 15306,
+ 736, 1079, 1802, 3276, 4001, 5415, 6381, 7119, 8492, 9232, 10308, 11105, 12031, 12793, 13904, 15114,
+ 1249, 1897, 2616, 3398, 4149, 4840, 5809, 6616, 7453, 8768, 9869, 10767, 12051, 13177, 14339, 15241,
+ 1026, 1314, 2014, 3249, 3690, 4344, 4892, 5691, 7289, 7970, 9397, 10615, 11663, 13015, 14272, 15328,
+ 970, 1249, 2342, 2895, 3661, 4685, 5348, 6691, 7176, 8850, 10323, 11025, 11936, 12697, 13429, 14816,
+ 872, 1155, 1680, 2334, 2880, 4439, 6448, 7088, 8221, 9517, 10060, 10691, 11577, 12830, 14274, 15377,
+ 874, 1131, 2067, 2714, 3203, 3786, 4480, 6643, 7487, 8708, 9861, 10989, 12079, 13208, 14240, 15290,
+ 804, 1079, 1708, 2236, 2842, 5275, 6096, 7030, 7886, 8704, 9978, 11354, 12923, 13800, 14706, 15380,
+ 646, 907, 1724, 3428, 3981, 5158, 5889, 7244, 8226, 8728, 9227, 10055, 11833, 13065, 14232, 15287,
+ 986, 1315, 1948, 2518, 3010, 5465, 6638, 7224, 8275, 8820, 9602, 10482, 11268, 12169, 14206, 15449,
+ 565, 805, 1593, 3458, 4571, 5319, 6411, 7828, 8796, 9460, 10121, 10926, 11931, 12989, 14085, 15181,
+ 532, 795, 1654, 3253, 3949, 5323, 6246, 7279, 8378, 9364, 10397, 11379, 12395, 13375, 14390, 15290,
+ 835, 1169, 1895, 2461, 3233, 5608, 6358, 7353, 8521, 9756, 10632, 11371, 12291, 12967, 13777, 14575,
+ 528, 840, 1585, 2511, 4342, 5075, 5825, 7183, 8370, 8938, 9529, 10614, 12398, 13483, 14482, 15340,
+ 789, 1044, 2065, 2677, 3589, 5397, 5969, 7559, 8126, 8638, 9332, 10989, 12645, 13441, 14355, 15188,
+ 685, 970, 1644, 2232, 4331, 5344, 6203, 6877, 7736, 9534, 10331, 11186, 11981, 12778, 13629, 14878,
+ 800, 1120, 1829, 2303, 4180, 4963, 5877, 6722, 7425, 8436, 9106, 10138, 12113, 13163, 14087, 15242,
+ 851, 1150, 2243, 3088, 3642, 5370, 6027, 6953, 7919, 8562, 9276, 9957, 10896, 12786, 14320, 15324,
+ 735, 1113, 2000, 3196, 4699, 5471, 6589, 7347, 8003, 8855, 9650, 10594, 12001, 13017, 13918, 15089,
+ 837, 1098, 1699, 2175, 3008, 6101, 6902, 7529, 8229, 8790, 9674, 10585, 11532, 12971, 14334, 15323,
+ 626, 1278, 3315, 4325, 5436, 6586, 7790, 8824, 9821, 10690, 11482, 12268, 13043, 13789, 14591, 15381,
+ 1439, 2612, 3825, 4715, 5881, 7098, 8204, 9129, 10075, 10889, 11673, 12416, 13159, 13897, 14672, 15420,
+ 1489, 2697, 3785, 4568, 5440, 6284, 7191, 8043, 8936, 9852, 10756, 11696, 12662, 13539, 14458, 15314,
+ 663, 932, 1850, 4514, 5042, 5800, 6482, 7381, 8674, 9537, 10447, 11239, 12074, 12975, 13958, 14969,
+ 695, 1028, 1781, 2195, 4548, 5142, 6539, 7282, 7728, 8259, 8915, 9755, 11646, 13482, 14373, 15221,
+ 846, 1138, 1713, 2239, 2823, 5254, 6237, 6940, 7777, 8443, 9981, 10858, 11793, 13022, 14259, 15331,
+ 595, 882, 1481, 3108, 4815, 5391, 5979, 6529, 8058, 8939, 9706, 10649, 11884, 13065, 14350, 15334,
+ 887, 1139, 1829, 2276, 3102, 5552, 6221, 7067, 7712, 8368, 9127, 10682, 12241, 13127, 14112, 15133,
+ 1019, 1418, 2165, 2865, 3353, 4937, 6019, 6784, 7810, 8440, 9197, 10025, 12092, 13614, 14602, 15352,
+ 951, 1206, 2295, 3066, 3586, 4125, 4780, 7215, 7687, 8320, 9079, 10918, 12519, 13503, 14488, 15224,
+ 847, 1149, 2069, 2504, 4231, 5041, 6034, 6862, 7321, 7882, 8765, 10837, 12433, 13022, 13809, 15203,
+ 829, 1111, 2677, 3505, 3999, 5080, 5694, 7033, 7667, 8302, 8963, 10297, 12410, 13340, 14485, 15373,
+ 908, 1284, 2182, 2613, 3944, 5116, 5768, 7284, 7825, 8461, 10123, 11755, 12583, 13368, 14195, 15053,
+ 930, 1215, 2323, 2834, 3500, 4216, 5200, 5956, 6576, 7757, 9998, 10921, 12073, 12844, 14003, 15254,
+ 973, 1343, 2164, 3265, 3733, 4538, 5294, 6469, 7850, 8468, 9747, 10750, 11398, 12428, 13990, 15226,
+ 952, 1239, 1992, 3093, 3498, 4156, 4605, 5695, 7946, 8668, 9684, 11027, 12029, 13102, 14093, 15158,
+ 558, 828, 1638, 2628, 3361, 4827, 6046, 7182, 8226, 9297, 10326, 11331, 12343, 13333, 14312, 15248,
+ 543, 797, 1292, 2197, 4031, 4954, 6096, 7133, 8292, 9244, 10253, 11267, 12293, 13293, 14303, 15272,
+ 562, 818, 1546, 2854, 3792, 5212, 5897, 6697, 8329, 9105, 10103, 11572, 13033, 13866, 14716, 15223,
+ 897, 1320, 1937, 2717, 3205, 4412, 6880, 7773, 8381, 9585, 10492, 11242, 12589, 13425, 14212, 15053,
+ 798, 1174, 2038, 2482, 3869, 4999, 5820, 7157, 7807, 9160, 10013, 11078, 12122, 13113, 14028, 14997,
+ 686, 1000, 2269, 3020, 3755, 5347, 5960, 7664, 8406, 9199, 10485, 11521, 12512, 13361, 14217, 15144,
+ 715, 1058, 1660, 3282, 4591, 4997, 6361, 7315, 7878, 9084, 10356, 11033, 12186, 13333, 14390, 15279,
+ 784, 1087, 1584, 3299, 5404, 6007, 6611, 7254, 7870, 8870, 10201, 10911, 11780, 12799, 14077, 15156,
+ 664, 905, 1952, 4880, 5346, 5934, 6519, 7374, 8530, 9311, 10103, 10819, 11525, 12818, 14071, 15168,
+ 626, 914, 2854, 4227, 4737, 5634, 6361, 7354, 7918, 8636, 9491, 10701, 11785, 13139, 14220, 15292,
+ 1793, 3491, 4468, 5330, 6092, 6716, 7382, 8023, 8852, 9777, 10729, 11640, 12576, 13418, 14323, 15182,
+ 688, 949, 1560, 3990, 5022, 5519, 6194, 6798, 8071, 8773, 9515, 10514, 12712, 13784, 14609, 15400,
+ 783, 1014, 2824, 3542, 4129, 4903, 5606, 6542, 6965, 7778, 10053, 10913, 11995, 12759, 13498, 15320,
+ 753, 1093, 2085, 2706, 4391, 5134, 5930, 6777, 7408, 8184, 9523, 10719, 12392, 13543, 14552, 15277,
+ 920, 1325, 2067, 2928, 3400, 4646, 5913, 6704, 8091, 8819, 9941, 10843, 12080, 13740, 14761, 15449,
+ 618, 961, 2096, 3325, 4242, 5555, 6567, 7721, 8801, 9891, 10891, 11871, 12871, 13717, 14555, 15310,
+ 826, 1165, 2466, 3876, 4364, 5723, 6461, 7667, 8417, 9095, 9913, 10755, 11704, 12971, 14239, 15196,
+ 1056, 1577, 2885, 3726, 4232, 5031, 5736, 6842, 8006, 8903, 10198, 11414, 12536, 13409, 14359, 15205,
+ 876, 1205, 2453, 3059, 3652, 4312, 5617, 6518, 7542, 8743, 9363, 11286, 13049, 13835, 14643, 15303,
+ 763, 990, 2805, 3723, 4228, 4936, 5628, 6613, 7058, 7705, 8476, 10130, 11974, 13113, 14180, 15342,
+ 857, 1152, 1913, 3994, 4629, 5137, 6183, 6861, 7722, 9347, 10177, 10777, 11599, 13112, 14298, 15264,
+ 656, 1269, 3434, 4621, 5637, 6438, 7220, 7942, 8741, 9612, 10517, 11433, 12435, 13354, 14316, 15237,
+ 1359, 2605, 3748, 4758, 6042, 7092, 7952, 8651, 9338, 9974, 10723, 11579, 12528, 13418, 14397, 15297,
+ 1529, 3067, 4410, 5449, 6449, 7233, 7901, 8525, 9237, 10002, 10859, 11784, 12730, 13589, 14467, 15300,
+ 1790, 3311, 4192, 4897, 5538, 6210, 6922, 7697, 8597, 9590, 10560, 11494, 12426, 13283, 14229, 15138,
+ 1252, 2359, 3404, 4211, 5155, 6055, 7030, 7899, 8850, 9793, 10761, 11714, 12674, 13565, 14489, 15352,
+ 590, 998, 2402, 3314, 4528, 5604, 6649, 7644, 8508, 9487, 10408, 11383, 12335, 13276, 14293, 15243,
+ 727, 1025, 1614, 3818, 5876, 6391, 6980, 7606, 8211, 9304, 10696, 11324, 12381, 13241, 13988, 14791,
+ 621, 899, 2068, 4152, 5232, 6483, 7323, 8193, 8960, 9627, 10417, 11291, 12234, 13192, 14216, 15187,
+ 582, 828, 1926, 4025, 4942, 6029, 6957, 7599, 8278, 9093, 10032, 11126, 12233, 13209, 14256, 15311,
+ 788, 1126, 1690, 3183, 3923, 4599, 6240, 6890, 7758, 9022, 9656, 10453, 11779, 12706, 13913, 15214
+};
+
+
+const Word16 lsf_cdk_nb_gc_stg1[] = /* 14Q1*1.28 */
+{
+ -2046, -827, -3490, -8984, -9331, -8562, -2854, 112, 2194, 13294, 11592, 7952,
+ -294, 2271, 1647, -1260, -2029, -3649, -4081, -3432, -3649, 333, 5042, 4720,
+ -1209, 984, -241, -3413, -4476, -4817, -2910, -2016, -2016, 2900, 6868, 5408,
+ -1900, 896, 688, -197, -33, -993, -1470, -1283, -2145, -665, 2161, 4064,
+ -1998, -351, -1985, -4742, -4879, -5329, -3500, -2023, -1264, 8507, 9766, 6640,
+ 245, 3962, 3664, 1935, 1601, 144, -1054, -1236, -2225, -2647, -3746, 1695,
+ -3051, -1382, -1825, 828, 2537, 1872, 957, 689, -592, 1675, 5507, 5216,
+ -2178, -281, 2097, 5417, 4372, 1648, -802, -1304, -2817, -754, 3345, 4224,
+ -3400, -2402, -4098, -3148, -2066, -1985, -558, 466, 705, 11042, 11096, 7424,
+ 776, 4355, 3200, -1139, -2922, -3985, -2990, -2405, -2881, -661, 2897, 4176,
+ -1818, 394, -385, -1504, -1545, -2913, -3062, -2451, -2609, 2093, 6387, 5248,
+ -1081, 2069, 1952, 1345, 1649, 64, -1394, -1526, -2577, -2051, -1025, 2863,
+ 276, 2780, 1567, -3228, -4881, -5970, -4363, -3523, -3089, 3447, 7300, 5456,
+ 1917, 6445, 5552, 2069, 684, -1233, -2371, -2377, -3409, -1635, 1616, 3648,
+ -2734, -1049, -2001, -1927, -1908, -2273, -1294, -652, -944, 4451, 7893, 5888,
+ -1193, 2108, 5153, 7875, 8214, 6145, 2891, 2001, 208, -1312, -2273, 1599,
+ -3697, -3538, -6739, -7238, -4524, -2464, 2424, 4591, 6098, 15691, 13066, 8912,
+ -352, 2108, 847, -247, 1179, -769, -2757, -2873, -3713, 203, 4994, 4688,
+ -1185, 1565, 703, -1788, -2372, -2721, -1951, -1554, -2129, -374, 2529, 4192,
+ -2094, 401, 352, 1118, 2376, 1632, 582, 351, -1009, -1389, -784, 3056,
+ -367, 1637, -145, -5132, -6888, -8178, -5371, -3397, -1776, 9469, 9894, 6752,
+ 953, 5894, 6785, 5196, 4663, 2400, 31, -598, -2065, -2581, -2786, 1743,
+ -2637, -1222, -560, 5363, 6867, 5329, 2192, 1264, -544, -508, 1345, 3664,
+ -1112, 1918, 2976, 3989, 4508, 3104, 1245, 606, -897, -2381, -4258, 1119,
+ -1983, -328, -2930, -6112, -1802, 144, 486, 194, -960, 4066, 7797, 5872,
+ 648, 3526, 3104, 562, -200, -2177, -3380, -3162, -3857, -1516, 2433, 3920,
+ -2908, -722, -417, -181, 290, -352, -352, -175, -1088, 1689, 5603, 5184,
+ -536, 2771, 2064, 10, -643, -1793, -1733, -1523, -2193, -1813, -1585, 2831,
+ 2239, 5541, 4400, -637, -2370, -4802, -5148, -3901, -2912, 7328, 9222, 6320,
+ 8159, 12344, 9921, 5311, 4611, 2480, -1461, -1819, -2032, 5438, 7396, 5968,
+ -3908, -2998, -3105, 1031, 2171, 1952, 2012, 1982, 1280, 8825, 10343, 7056,
+ -80, 5935, 10546, 12414, 12351, 9601, 4823, 3380, 1152, -840, -2161, 1967
+};
+const Word16 lsf_cdk_nb_gc_stg2[] = /* 14Q1*1.28 */
+{
+ -476, -1387, -3185, 464, 1104, 0,
+ -1029, -675, 63, -1664, -1168, 0,
+ -691, -1002, -1697, -1968, -704, 0,
+ -957, -724, -945, 816, 928, 0,
+ -1131, -2087, -1296, 2704, 1376, 0,
+ -1167, -1003, 512, 592, 192, 0,
+ 492, 517, -721, -3600, -1888, 0,
+ 489, -147, -1153, -688, -864, 0,
+ 865, 179, -608, 2000, 1008, 0,
+ -1286, -1953, -1633, -304, -368, 0,
+ 2033, 1593, -369, -576, 272, 0,
+ -718, 685, 751, -192, 192, 0,
+ 1394, 1172, 1520, -480, -576, 0,
+ -1455, -466, 2896, 2176, 896, 0,
+ -1171, 324, 2512, -272, -496, 0,
+ 4950, 5112, 3536, 1040, 80, 0
+};
+const Word16 lsf_cdk_nb_gc_stg3[] = /* 14Q1*1.28 */
+{
+ 1, 6, -801, -3701, -3408, -1712, 2661, 2257, 768,
+ 4, 11, -481, -1886, -2409, -2353, -652, 1216, 256,
+ 14, 6, -1713, -1706, -1012, -817, -1158, -369, -97,
+ 8, 15, 127, -780, -1241, -1617, -2819, -1474, -577,
+ 13, 6, 2320, 103, -1175, -1681, 297, 1536, 384,
+ 4, 14, -529, -319, -161, -129, -2113, -4131, -1281,
+ 0, 5, -2001, -1650, -185, 1040, 2146, 1713, 736,
+ 12, 4, 320, 1615, 1634, 1376, -1700, -4675, -1697,
+ 15, 13, -401, -348, -511, -320, 2570, 2865, 944,
+ 7, 14, 335, -1107, -768, -112, -338, -65, 15,
+ 13, 15, -1025, 563, -38, -865, -1105, 383, 31,
+ 4, 6, 1056, 1034, 443, -289, -2357, -1986, -689,
+ 7, 6, 1008, 1608, 1329, 816, 730, 1312, 432,
+ 4, 12, -1281, 789, 1794, 1328, -517, -561, -113,
+ 12, 4, 704, 1656, 2289, 3153, 5215, 3682, 1680,
+ 11, 15, 2528, 4255, 3539, 2320, -669, -1585, -641
+};
+const Word16 lsf_cdk_nb_vc_stg1[] = /* 14Q1*1.28 */
+{
+ -1950, -1358, -4562, -8912, -8626, -8050, -2211, 1051, 4226, 15749, 13194, 8800,
+ 224, 2532, 175, -5316, -6930, -5601, 381, 515, -416, 3224, 6964, 5584,
+ -2481, -1570, -3746, -3444, -3066, -3665, -2328, -929, -256, 10781, 10903, 7280,
+ -164, 2676, 1952, 1170, 1362, 32, -809, -978, -1793, -2288, -3137, 2287,
+ -1649, -589, -3746, -9056, -6586, -2160, 1693, 1869, 1072, 8982, 10375, 7056,
+ -1442, 731, -465, -352, 881, 0, -1397, -1476, -2273, -792, 2209, 4048,
+ -570, 1125, -577, -4067, -5011, -6130, -4457, -3228, -2464, 7796, 9414, 6432,
+ 314, 2780, 1599, -2442, -4050, -5762, -4680, -3747, -3169, 3706, 7556, 5568,
+ -3306, -3212, -6178, -5257, -2978, -2209, 33, 2038, 3490, 15396, 13130, 8704,
+ -303, 2334, 927, -1025, -1877, -2753, -1964, -1602, -2145, -943, 1457, 3872,
+ -1437, 228, -1633, -3020, -3188, -2833, -1579, -942, -1184, 2482, 6532, 5408,
+ 2622, 6487, 4448, 511, -1383, -2769, -2495, -2230, -2977, -107, 4082, 4480,
+ -1897, -706, -2994, -2432, 566, 704, 220, 99, -608, 3533, 7300, 5744,
+ -2605, -1419, -1376, 1700, 1217, 112, -957, -849, -1633, 1902, 6131, 5296,
+ 2177, 3621, 751, -6700, -10534, -11698, -2205, 713, 3954, 15329, 12986, 8656,
+ 7156, 9030, 4704, 653, -2345, -6178, -4996, -1616, 1762, 14213, 12329, 8272,
+ -997, 238, -2066, -5868, -6868, -7474, -4302, -2171, -623, 12371, 11336, 7600,
+ 2585, 4011, 959, -298, 477, -353, -2457, -2786, -3233, 5865, 8693, 6064,
+ -2145, -680, -1553, -1961, -2011, -3249, -3184, -2317, -1968, 5674, 8613, 6080,
+ 675, 4202, 4128, 2060, 1483, -865, -2647, -2552, -3377, -2094, 64, 3184,
+ -3084, -2915, -5698, -905, 1626, 2176, 1517, 1566, 1024, 9339, 10663, 7232,
+ -741, 1377, 1168, 206, 185, -1601, -3079, -2936, -3553, -265, 4402, 4528,
+ 872, 3048, 799, -4039, -5660, -7890, -7222, -4564, -1792, 10306, 10311, 6992,
+ 2766, 6132, 4848, -1357, -2881, -4914, -4864, -3528, -2608, 9503, 10134, 6832,
+ -1649, -1598, -6691, -10943, -5664, -3632, 2663, 6788, 11044, 19895, 15933, 10416,
+ 530, 3138, 2560, -401, -1453, -3425, -4047, -3463, -3713, 252, 4914, 4672,
+ -879, 1210, 47, -2253, -2732, -3777, -3689, -2947, -2833, 2110, 6499, 5232,
+ 5749, 8736, 6865, 3519, 2447, 383, -1446, -1459, -2385, 970, 4146, 4560,
+ -2556, -1914, -3969, 3390, 7938, 6305, 1777, 560, -928, 1091, 4563, 4928,
+ -1808, -411, 1313, 6469, 6395, 3680, 398, -149, -1713, -1588, 832, 3360,
+ 3630, 5517, 2479, -2938, -6552, -10675, -4951, -545, 1441, 13744, 12041, 8080,
+ 10956, 13776, 9201, 4285, 3873, -801, -5835, -2466, 1233, 13746, 12105, 8192
+};
+const Word16 lsf_cdk_nb_vc_stg2[] = /* 14Q1*1.28 */
+{
+ -377, -729, -1793, 400, 1312, 0,
+ -1197, -1432, -2033, -1936, -1520, 0,
+ -403, -100, 127, -3232, -3456, 0,
+ 555, 364, -865, -592, -1264, 0,
+ -1136, -1968, -2640, 4448, 3824, 0,
+ -1539, 94, 591, 1600, 1376, 0,
+ -1564, -393, 2528, -304, -688, 0,
+ 1075, 823, 1648, -96, -704, 0,
+ -770, -404, 527, -1648, 64, 0,
+ -1320, -1678, -1072, 48, -688, 0,
+ 145, 83, -1089, -3632, -448, 0,
+ 1994, 1756, 159, 1120, 1504, 0,
+ 282, -236, -800, 2080, 624, 0,
+ -1357, -1537, 1008, 2624, 1360, 0,
+ 2002, 2046, 1215, -2336, -1808, 0,
+ 3757, 3480, 2592, 1472, 512, 0
+};
+const Word16 lsf_cdk_nb_vc_stg3[] = /* 14Q1*1.28 */
+{
+ 3, 5, -657, -4633, -3805, -736, 1304, 1024, 368,
+ 6, 12, -305, -1836, -2507, -2625, -1818, -241, -305,
+ 6, 4, -2577, -1854, -1236, -1073, -594, 207, -1,
+ 2, 2, -80, 643, 38, -993, -3719, -1602, -769,
+ 13, 10, -625, -1825, -2422, -2449, 2887, 2625, 784,
+ 6, 0, -336, 315, 466, 560, -2183, -4867, -1345,
+ 10, 7, -2625, 1255, 2305, 1296, 181, 544, 208,
+ 0, 7, 912, 1998, 1662, 623, -416, 256, 32,
+ 10, 6, -1713, -1720, -311, 1408, 2066, 1585, 672,
+ 7, 11, 15, -1217, -99, -33, -851, -33, -81,
+ 12, 0, -1680, 556, -499, -897, 454, 896, 256,
+ 2, 8, 2608, 425, -938, -1937, -1205, 15, -177,
+ 6, 2, 1504, -796, -939, 80, 2179, 1777, 672,
+ 3, 13, 1984, 3517, 3171, 2320, -2605, -5651, -1857,
+ 14, 2, -160, 1660, 2380, 2832, 2924, 2097, 992,
+ 10, 0, 3857, 3623, 2853, 1728, 1554, 1441, 656
+};
+const Word16 lsf_cdk_wb_gc_stg1[] = /* 14Q1*1.28 */
+{
+ -854, -266, -3202, -8408, -10604, -11763, -10826, -9448, -7970, -4784, -3493, -2593,
+ -2727, -1241, -1489, -1469, -1977, -2529, -2344, -2279, -2273, -1750, -1365, -1505,
+ -728, 1001, -113, -1594, -2256, -3553, -4619, -4591, -4497, -3300, -2327, -2129,
+ -590, 1699, 1264, 1187, 300, -865, -1554, -1669, -1649, -1202, -837, -1169,
+ -1612, -578, -2546, -5013, -6155, -6834, -6779, -6002, -5506, -3988, -2968, -2625,
+ -1725, 1072, 1280, 74, 277, 672, 1385, 2172, 2688, 2643, 2065, 848,
+ -86, 3639, 3824, 1931, 2115, 1120, 338, 500, 496, 751, 718, -65,
+ -1024, 1647, 5377, 9202, 8763, 7665, 5376, 4447, 3824, 2803, 2000, 608,
+ -2585, -2600, -6211, -11489, -11790, -10322, -5788, -3684, -2289, -465, -33, -289,
+ -3165, -2478, -3521, -1181, 298, 1632, 2160, 2107, 2272, 2075, 1407, 319,
+ 1275, 3587, 2848, 570, -26, -1489, -4034, -4818, -5202, -3732, -2550, -2049,
+ -2614, -1530, -848, 4992, 6996, 8002, 9185, 9172, 9106, 7739, 5862, 3408,
+ 440, 2263, 751, -3627, -4674, -4978, -4938, -5078, -5554, -5428, -4266, -3361,
+ -2308, -80, 176, 2603, 3871, 3792, 3219, 2667, 2480, 2189, 1405, 95,
+ 2569, 6546, 6257, 3885, 2438, 1504, 1431, 1319, 1392, 1337, 942, -65,
+ -712, 3328, 6290, 10673, 12635, 13827, 14544, 13939, 13619, 10691, 8026, 4768,
+ 842, 2338, 159, -5945, -8498, -9619, -8197, -7076, -6066, -4502, -3722, -3409,
+ -1628, 617, -129, -1907, -2194, -1505, -95, 486, 928, 1268, 1071, 175,
+ 538, 3277, 2111, -1606, -3194, -3553, -2105, -1604, -1393, -974, -740, -1009,
+ -1279, 456, 2593, 6823, 5435, 3536, 1502, 544, -96, -521, -548, -1105,
+ -983, 675, -865, -4388, -5936, -5697, -3245, -2211, -1633, -519, -276, -849,
+ -102, 3506, 2480, 332, -670, -448, 859, 1384, 1776, 1846, 1568, 448,
+ 270, 5022, 5136, 4435, 4546, 4305, 4185, 4385, 4337, 3659, 2785, 1152,
+ 216, 5449, 10098, 11459, 11060, 9922, 8139, 7175, 6289, 4794, 3394, 1600,
+ -3137, -3309, -5826, -6310, -5500, -4385, -2187, -1054, -288, 502, 527, -129,
+ -2997, -2031, -1344, 2452, 2535, 1856, 912, 451, 272, -124, -515, -993,
+ 3808, 7001, 5536, 908, -807, -1665, -2041, -2232, -2449, -2206, -1782, -1905,
+ -1117, 2493, 3616, 4843, 5755, 6273, 6815, 6906, 6769, 5801, 4580, 2528,
+ 2509, 4911, 3439, -2294, -4945, -7203, -9006, -7957, -6818, -4297, -3321, -3009,
+ -1110, 1877, 1776, 2112, 2398, 2704, 3465, 3938, 4257, 4039, 3202, 1568,
+ 7131, 11568, 10626, 7755, 6467, 5073, 4839, 4543, 4128, 3206, 2160, 912,
+ 2457, 10049, 15204, 18687, 18433, 17364, 14947, 13353, 11682, 8277, 6182, 3232
+};
+const Word16 lsf_cdk_wb_gc_stg2[] = /* 14Q1*1.28 */
+{
+ -1224, -2316, -3425, -928, 128, 0,
+ -1874, -2354, -1025, -624, -448, 0,
+ -1026, -888, -481, -2352, -1024, 0,
+ 838, 174, -2306, -4048, -960, 0,
+ -1336, -2679, -1776, 2464, 1200, 0,
+ 497, 2649, 3536, 1344, 320, 0,
+ -1099, 4, 2448, -544, -752, 0,
+ 993, 486, 592, 64, -480, 0,
+ 288, -551, -2385, 1824, 2016, 0,
+ -1090, -815, 128, 1008, 704, 0,
+ 279, -579, -1729, -560, -832, 0,
+ 60, 1211, 543, -288, 272, 0,
+ 480, 1062, 560, 3152, 1680, 0,
+ -1276, -672, 2961, 2704, 1200, 0,
+ 1357, 1787, 767, -3424, -2768, 0,
+ 4229, 3682, 1696, 192, -256, 0
+};
+const Word16 lsf_cdk_wb_gc_stg3[] = /* 14Q1*1.28 */
+{
+ 15, 1, -1665, -4778, -4630, -3105, -554, -304, -112,
+ 13, 10, -753, -1579, -1817, -1953, -2415, -2148, -1697,
+ 8, 15, 1135, -1716, -3415, -5154, -4958, -3443, -1905,
+ 4, 1, -32, 570, 443, -65, -2187, -2759, -2561,
+ 4, 14, 399, -979, -269, 816, 385, -194, -673,
+ 2, 5, -2161, -1600, -401, -97, -412, -433, -321,
+ 0, 15, 2128, 3449, 1993, 175, -2815, -2580, -1729,
+ 3, 2, 400, 714, 1209, 1904, 2711, 2436, 1840,
+ 9, 13, 143, -1925, -2694, -2545, 358, 930, 960,
+ 10, 0, -960, 868, 173, -513, -97, 577, 896,
+ 0, 5, 1824, 11, -1080, -1761, -1565, -1058, -705,
+ 7, 1, -880, 2304, 2790, 2384, 573, -18, -273,
+ 5, 8, 1840, 1467, 978, 768, 598, 351, -17,
+ 6, 7, -1473, -2052, -711, 992, 3166, 2788, 2080,
+ 7, 12, 1856, 3557, 3483, 3184, 2417, 1923, 1408,
+ 3, 13, -1649, 1850, 4068, 5073, 4907, 4086, 2976
+};
+const Word16 lsf_cdk_wb_vc_stg1[] = /* 14Q1*1.28 */
+{
+ -1159, -1161, -5395, -12785, -14024, -12291, -8572, -6523, -4593, -1979, -1169, -897,
+ -1903, -921, -2065, -1931, -2752, -3825, -4238, -4174, -4145, -3108, -2167, -2081,
+ 522, 1696, -513, -6103, -8611, -9571, -9024, -8617, -7826, -5631, -4489, -3761,
+ -1839, -544, -1280, 1080, 564, 752, 844, 1110, 1344, 1185, 1039, 63,
+ -2685, -2538, -5074, -6161, -6745, -6738, -5709, -4457, -3377, -1830, -1188, -1185,
+ -3059, -3565, -6706, -3405, -1183, -272, -112, 33, 160, -5, 13, -721,
+ 4464, 5425, 1535, -8151, -13242, -15171, -5882, -2159, -288, 176, 739, 1440,
+ 1431, 2210, -769, -2539, -889, -721, -4378, -6019, -8099, -8147, -6215, -3873,
+ -1779, -2663, -8548, -12911, -8955, -5265, -1796, -700, 240, 746, 528, -160,
+ -847, 1228, 735, -1117, -1191, -1857, -2236, -2407, -2321, -1779, -1542, -1665,
+ -11, 1561, 591, -2764, -3940, -4994, -5679, -5652, -5586, -4852, -3930, -3297,
+ -783, 2500, 2912, 1480, 864, -64, -492, -833, -769, -353, -452, -1009,
+ -1207, 305, -1169, -3978, -4167, -3249, -1227, -606, -48, 233, -51, -545,
+ -2442, -2531, -3873, 5622, 7990, 7025, 4210, 3337, 2576, 1042, 237, -673,
+ 7644, 9215, 4703, -2206, -6625, -10676, -11281, -8039, -4321, -386, 15, -113,
+ 5397, 7494, 5296, -39, -1846, -2017, -1875, -1846, -1697, -2156, -2072, -1969,
+ -279, 230, -3010, -8280, -10317, -11859, -10729, -9576, -7922, -4867, -3862, -2865,
+ -899, -234, -2897, 3569, 4566, 799, -5740, -7153, -6546, -3276, -2048, -960,
+ 954, 3319, 1295, -3334, -5133, -5137, -2866, -2245, -1793, -1073, -934, -1281,
+ -1098, 1538, 1024, 1919, 2978, 3729, 4709, 5431, 5521, 4962, 3843, 1920,
+ -772, 429, -1810, -5319, -6411, -7074, -6828, -6001, -5266, -3901, -3160, -2833,
+ -140, 1442, -1153, -2496, -631, 1264, 2033, 3167, 3840, 3225, 2577, 1232,
+ 2263, 4102, 1167, -4671, -6812, -9651, -10507, -2400, 272, 1823, 1124, -2641,
+ 3904, 5709, 4800, 1435, -1797, -3682, -7176, -9009, -11812, -10666, -5157, -2353,
+ 122, 738, -2898, -9698, -11180, -8161, -1527, -926, -352, 476, -116, -705,
+ 1615, 3938, 3296, -117, -1405, -2593, -4075, -4383, -4273, -3528, -3017, -2881,
+ 3319, 4999, 2191, -4352, -6684, -7394, -7503, -7494, -6914, -5038, -4138, -3841,
+ 1933, 5658, 4544, 2619, 2149, 1456, 812, 401, 240, 207, 12, -673,
+ 1747, 3791, 1295, -236, -1712, -1232, 632, 903, 1488, 1527, 1184, 368,
+ -1030, 922, 4017, 7665, 6754, 5073, 3236, 1989, 1056, 426, 45, -609,
+ 12487, 14522, 8896, 2687, 1057, -3810, -10425, -9171, -6482, -2948, -2321, -1169,
+ 7344, 9906, 7921, 4454, 3289, 2320, 1483, 513, 192, 491, 493, 79
+};
+const Word16 lsf_cdk_wb_vc_stg2[] = /* 14Q1*1.28 */
+{
+ -182, -1035, -2593, -176, 528, 0,
+ -2110, -2904, -2881, -1696, -864, 0,
+ -160, -876, -1777, -4160, -2112, 0,
+ 1601, 651, -1393, 208, -896, 0,
+ -1109, -1806, -2112, 2592, 1360, 0,
+ -1723, -1575, 1104, 912, 288, 0,
+ -700, 1343, 687, 1408, 144, 0,
+ 863, 454, 864, 464, -160, 0,
+ -1234, -1141, -289, -832, 832, 0,
+ -230, -608, -480, -1520, -2352, 0,
+ 1268, 2126, 1919, -3440, -3072, 0,
+ 1298, 1365, -65, -2832, 672, 0,
+ 1095, 493, -849, 3184, 3056, 0,
+ -469, -479, 1617, 3728, 2112, 0,
+ -675, 1400, 3984, 240, -592, 0,
+ 2580, 2697, 2432, 1920, 1040, 0
+};
+const Word16 lsf_cdk_wb_vc_stg3[] = /* 14Q1*1.28 */
+{
+ 7, 3, -1329, -4391, -3913, -3041, -859, -255, 176,
+ 13, 7, -2257, -960, -1287, -1649, -1313, -770, -433,
+ 3, 13, -33, -1650, -2302, -2721, -4039, -3798, -2609,
+ 10, 4, 0, 1123, 279, -1057, -2271, -1039, 160,
+ 7, 12, 15, -748, 384, 848, -1029, -1992, -2385,
+ 4, 1, -2417, -2753, -316, 912, 1240, 993, 704,
+ 0, 0, 2497, 3043, 1347, -849, -5667, -5913, -4193,
+ 5, 2, 848, 519, 1737, 2560, 1763, 1506, 912,
+ 12, 12, 271, -2734, -3306, -736, 1294, 383, -209,
+ 10, 14, -577, -71, -129, -449, 1561, 2068, 1920,
+ 14, 1, 1408, -1285, -2943, -4177, -1355, 306, 752,
+ 15, 8, -2529, 2194, 2953, 2368, 1761, 1377, 816,
+ 14, 10, 3024, 1322, 224, -304, 514, 511, -81,
+ 1, 12, -849, -709, 112, 2417, 5221, 4664, 3648,
+ 1, 9, 160, 3607, 3314, 2016, -333, -884, -1233,
+ 13, 12, 1888, 3621, 3935, 4000, 3607, 2932, 2128
+};
+
+const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES] = /* 14Q1*1.28 */
+{
+ {
+ { lsf_cdk_wb_gc_stg1, lsf_cdk_wb_gc_stg2, lsf_cdk_wb_gc_stg3 },
+ { lsf_cdk_wb_vc_stg1, lsf_cdk_wb_vc_stg2, lsf_cdk_wb_vc_stg3 }
+ },
+ {
+ { lsf_cdk_nb_gc_stg1, lsf_cdk_nb_gc_stg2, lsf_cdk_nb_gc_stg3 },
+ { lsf_cdk_nb_vc_stg1, lsf_cdk_nb_vc_stg2, lsf_cdk_nb_vc_stg3 }
+ }
+};
+
+const Word16 lsf_numbits[TCXLPC_NUMSTAGES] = { 5, 4, 4 }; // Q0
+
+const Word16 lsf_dims_ivas[TCXLPC_NUMSTAGES] = { 16, 6, 10 }; // Q0
+const Word16 lsf_offs_ivas[TCXLPC_NUMSTAGES] = { 0, 0, 6 }; // Q0
+const Word16 lsf_dims[TCXLPC_NUMSTAGES] = { 16, 8, 12 }; // Q0
+const Word16 lsf_offs[TCXLPC_NUMSTAGES] = { 0, 0, 4 }; // Q0
+
+
+const Word16 lsf_ind_cdk_nb_gc_stg4[] = /* 14Q1*1.28 */
+{
+ -1360, -704, 0,
+ 80, 256, 0,
+ -896, 1008, 0,
+ 960, 2016, 0
+};
+const Word16 lsf_ind_cdk_nb_vc_stg4[] = /* 14Q1*1.28 */
+{
+ -1360, -944, 0,
+ 624, 1408, 0,
+ -368, 240, 0,
+ 2480, 3216, 0
+};
+const Word16 lsf_ind_cdk_wb_gc_stg4[] = /* 14Q1*1.28 */
+{
+ -1280, -816, 0,
+ 368, 272, 0,
+ -704, 1136, 0,
+ 1296, 2448, 0
+};
+const Word16 lsf_ind_cdk_wb_vc_stg4[] = /* 14Q1*1.28 */
+{
+ -1040, -848, 0,
+ 688, 400, 0,
+ -560, 1520, 0,
+ 2256, 2704, 0
+};
+
+const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES] = /* 14Q1*1.28 */
+{
+ { { lsf_ind_cdk_wb_gc_stg4 }, { lsf_ind_cdk_wb_vc_stg4 } },
+ { { lsf_ind_cdk_nb_gc_stg4 }, { lsf_ind_cdk_nb_vc_stg4 } }
+};
+
+const Word16 lsf_ind_numbits[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0
+
+const Word16 lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0
+const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES] = { 4 }; // Q0
+const Word16 lsf_ind_offs[TCXLPC_IND_NUMSTAGES] = { 0 }; // Q0
+
+const Word16 min_distance_thr[2][2] = /* 14Q1*1.28 */
+{
+ /* GC, VC */
+ /* WB */ { 580, 580 },
+ /* NB */ {1000, 580 }
+};
+const Word16 lsf_q_diff_cb_8b_rf[256 * 16] = /* Q6 */
+{
+ -3145, 863, -1389, 4087, 1110, 3193, 290, -3160, 824, 212, -2936, -5827, -10181, -15650, -13373, -3849,
+ -4602, -3228, -8398, -1649, -5788, -8971, -2025, -2971, -1476, -2748, -2458, 966, -4, -1802, -1360, 654,
+ -8629, -7702, 6280, 3296, -1205, 365, -5964, 3125, 2443, 1442, 1149, -3835, -9867, -4238, -1977, -1955,
+ -2629, -759, -2056, -2297, -1839, 1678, -2412, -7539, -13208, -9624, -1688, -2171, 943, -454, 536, 2644,
+ -2840, -1391, -10500, 2516, 907, 146, -2762, -6750, 2949, -2282, -4614, -5663, -7773, -5510, -5947, -3727,
+ -4006, -939, -2500, -771, -3414, -4521, -6417, -4064, 3698, 3969, 4300, 4177, -3195, -10419, -13072, -6695,
+ -4284, -1172, -4415, -1601, -6029, 66, -4338, -2300, -3402, -5614, -7181, -7288, 7154, 6538, 64, -3263,
+ -6470, -4503, -9698, -5885, 235, 5049, 2698, -3656, -3600, -6261, -4270, 766, 1037, -1511, -1274, 1800,
+ 669, 2937, -3464, -1034, -4098, -11296, -382, -4610, -9613, -2081, 3947, 2832, 2962, -332, -9039, -10702,
+ -11109, -5950, -7200, -6525, -4260, -5060, -8936, -91, -672, 4557, 3192, -147, -2247, 1566, -734, -3007,
+ -2411, 1587, -2575, 2172, -3270, 10648, 7093, 1517, 1512, -392, 49, -9117, -16895, -908, -8443, -9923,
+ -1934, -603, -6588, 5335, -1565, -11521, 5944, -5092, -615, -2221, -7703, -1903, -5195, 2323, 3958, 3050,
+ -7094, 5361, -7885, -3299, -3282, -3125, -1888, -406, 1522, -23, -1506, -6075, -8517, -7605, -3450, -3362,
+ -3573, -2421, 1385, -181, -11027, 4778, -4014, -4956, 7316, 3138, 2351, 3406, -1998, -968, -2375, -3262,
+ -141, 6652, 11944, -4131, -2073, -2592, -1562, 1521, -1804, -2585, -2685, -5798, -10850, -11629, -4300, -4287,
+ -1569, 2229, 2330, 3147, -1026, -7010, 265, -1320, -3648, 1942, -5375, 73, 10348, 3913, -5535, -5938,
+ -5642, -3433, -8423, 1178, -540, -4790, -1976, 4686, 1701, -1323, -2009, -5997, -5693, -3852, -7604, -5361,
+ -1784, -325, -8561, -17592, 1663, 1377, 2347, -245, -2426, 141, -137, 985, -4926, -7898, -3559, 895,
+ -2548, -1563, -5007, 7311, 4409, 3177, 3920, 1546, -725, -5252, -9754, -9267, -5701, -6900, -961, 1772,
+ -1676, 889, -4798, 8060, 3460, -1911, 415, -4044, -6146, -12074, -10588, 13056, 2765, 1396, -4737, -4905,
+ 943, 3342, -8515, 4676, -774, -3963, -5503, -1625, 3909, -3614, 12347, 2835, -9710, 5877, 297, -918,
+ -5317, -2799, -3708, -4084, -8175, -6155, 1752, 6801, 7493, 6271, 4083, 3132, -809, -4200, -5389, -5982,
+ -5060, -5285, -1533, -2751, 2259, -3893, -3473, -108, -4711, -2627, -2069, -2320, -172, 1547, 770, 309,
+ -4485, -2618, -7238, 1767, -2965, 6693, 5256, 18, -1789, -5076, 7167, 3204, -1242, 1628, 4519, 1796,
+ -114, 1225, -3083, 321, -4002, 4834, -3014, -741, -4189, -5946, 6871, -2068, -13016, -9772, -3235, 2044,
+ 559, 10477, -9704, -7733, -8989, -10787, -10342, -8585, -2844, 1474, 5638, 9798, 10986, 9105, 4619, 2186,
+ 1576, 9039, 4354, 2073, 1861, -1492, -715, 1840, -6736, -10798, 994, -2921, -6369, 779, 2668, -443,
+ -2067, -1020, 1, 14571, 2253, -2163, 5255, 973, -1722, 4173, 102, -3633, -1430, -1720, 1243, 1749,
+ -6589, -1601, -9469, -5581, 3018, 1186, -11, 1252, 5708, 3338, 187, -3950, -6035, -3294, -106, -1130,
+ -2490, 445, -2543, -3283, -3432, -6963, 9950, 4072, 2294, 4517, 2736, 8173, 4270, -8347, -9374, 4776,
+ -66, 3476, 537, 2659, -677, 1552, 1974, -1703, -2139, -634, -1988, 694, 1921, -12938, -16525, 5848,
+ -9849, 7389, 4653, -1158, 1340, -2250, -2460, -2201, -3122, -90, 3974, 5105, 9127, 8701, 6184, 3770,
+ -5086, -3159, -3197, -9944, -7474, 961, 1158, -3536, 1050, 5572, -1480, -11120, -9276, -1841, -2086, -24,
+ -1019, -346, -6765, -8343, -6302, -3019, -5606, 2728, -3994, -6909, 10146, 6321, -230, -393, -846, -1536,
+ -1598, 3610, 3330, -233, -1215, -1953, -1330, 19, -4839, -10681, -11699, -1104, 1146, -6143, -6849, 422,
+ 892, 7937, -5005, -5547, 1756, -4020, -3420, -6811, -6304, -7812, -6019, 5109, 5503, 5568, 4600, 6472,
+ -3296, -2230, -6010, 3497, 5502, -2291, -2342, -6544, -12576, 2192, -1004, -5205, -500, -6764, -6200, 1816,
+ 5114, 4922, 6498, 6613, 4909, 2318, -5626, -11915, 3072, 11570, 1766, 4361, 552, -8139, -14006, -17228,
+ -3321, -1514, -473, 3295, -1028, -4536, -12374, 12452, 7396, -2269, -5052, 554, 1053, -4370, -5859, 97,
+ -2532, 2546, -4920, -13800, 8116, 2425, 1695, -2088, -5105, -346, -2869, -2457, 9336, 13166, 6150, 5166,
+ -2329, 72, 11513, -3075, -7745, -5492, -8015, -5108, -16, 3261, 876, -357, -3241, -2956, -4265, -2320,
+ -7869, -6495, -16668, -1339, -3678, 975, -2740, -2776, 3755, 141, -190, 1026, 5972, 3232, -924, -3212,
+ -1077, 568, -5606, 1478, -243, 2479, 10198, 3667, 682, -2873, -9164, -9042, 2186, 4347, -750, 5303,
+ 556, 5098, -6825, -2564, -3946, -5752, 1977, -6171, -5627, 4580, -835, -6362, 10132, 9511, 6475, 2861,
+ 3320, 11074, -483, 2698, -20, -4084, -4213, -3931, -231, -17, -1826, -2737, -5920, -1539, -1897, -3347,
+ -1346, 2075, -1230, -5248, 10906, 9461, 5046, 3485, -267, -948, 4273, 1889, 81, -488, -4763, -5532,
+ -1237, 6446, 3974, 5166, -723, -10033, 8338, 4102, 683, 1474, 624, -5287, -8628, -7519, -6290, 1767,
+ 207, 2676, 870, 13754, 7087, 2357, -922, -1734, -4651, 352, 14028, 10050, 8916, 2725, -5722, -9415,
+ 364, 3660, -813, 4370, -2151, -2115, 5570, -2545, -8167, -1978, -8301, -10715, 959, -5127, -11250, -7721,
+ -1668, -1437, -5508, -11155, -15130, 6829, 6070, -1555, -3048, -314, -528, 1714, 1474, -42, -541, 3361,
+ -15356, -12047, -4659, -1598, 4105, 3069, 2375, 3647, 1217, 140, -2518, -4195, -3080, 2155, 66, -570,
+ 84, 1523, -742, 13326, 5544, -2653, -5484, -3816, -9239, -10794, 6967, 2095, -4231, -2102, 4368, 8737,
+ 2959, 3968, -2430, 4601, 317, 5804, -3547, -11099, 5849, 273, -5513, 767, -9421, -11095, 3029, 8472,
+ -518, 2355, 2733, 53, -1439, -2709, -394, 5355, -2408, -3122, 8729, 5660, 7771, 4999, -7588, -15134,
+ -2240, 2281, 6677, -5155, 5663, 266, -4355, -7052, -3825, -2235, -2745, -3212, -2018, 1828, 1971, 2086,
+ -1241, 699, -2126, 3835, 1147, 4456, -3810, -23, 1284, -4878, 3807, 14029, 2820, -6773, 9556, 6600,
+ -1716, 315, -3259, -3282, -2859, -2219, 3508, -3452, -7850, 623, -5558, -2168, 1842, -8228, -885, 15388,
+ -8177, -7705, -14377, -6808, -7099, -7676, -4141, -5548, 3677, 5846, 6160, 10031, 11318, 8141, 3326, 904,
+ -3072, 1139, 1875, 4811, 3767, 7294, 4507, 1476, -1622, -6385, 384, 3318, -3867, -10447, -6387, -4252,
+ -19, 1102, -6317, 3433, -1856, -5732, 7225, -2107, -6977, 9620, 7964, 3013, 7152, 4986, -2184, 2136,
+ -524, 1479, -923, 3729, -259, 227, 6477, 2660, 4208, 1017, -423, -6090, -13677, 5309, 702, 2721,
+ -822, 2175, 1717, 3580, 1133, 3835, 980, 13265, 6367, 2741, 7462, 6211, -2347, -7635, 4781, 4132,
+ -8168, 13481, 5777, -963, 643, -2853, -2086, -1593, -2092, 2348, 3867, 413, 461, 1644, -259, -1656,
+ -846, 1615, -2805, 935, 3206, 1907, 7862, 3901, -975, 4507, 3151, 1433, 15449, 4412, -1221, 1001,
+ -3952, 1411, -2148, -1025, -2553, -4164, -4725, -3465, -2654, -3828, -6151, -7679, -5881, -2007, -581, -2499,
+ -1744, 4546, -8725, -6274, -1364, -1087, -2198, -4504, -3542, -1966, -516, -802, 448, -162, -1277, -2081,
+ -12133, -10923, 10206, 4436, 611, -2300, -4926, -4708, -5138, -3373, 2358, 295, -370, 4406, 2947, 351,
+ 1477, 3584, 3776, 4714, -1508, 2029, 426, -5245, -2805, -5852, -8752, 199, -3945, 10358, 10127, 4852,
+ -1894, 528, -776, 2698, -1298, -7579, -12457, -12545, 2483, 2421, -140, 723, -395, -292, -4196, -1766,
+ -3071, 1449, -3716, 3712, -3017, 543, -391, -1984, 3301, 375, 1107, -2635, 4730, 870, -19666, -12653,
+ -2823, 3165, 5399, -10321, -6087, -2824, -329, -1699, -268, -1995, -2254, 2744, 319, 51, 2834, 452,
+ -2837, -240, -1298, 2244, 1977, 3061, 3676, -1207, -3774, -2607, -3405, 9701, 12102, -3052, -10263, 1164,
+ -1548, -515, -3862, 1117, 3329, 4105, -804, -4141, -9321, -3136, 1792, 3484, 2025, -6747, -11991, -10905,
+ -3361, -2922, -3472, 1165, -3055, -1620, -4751, -8940, -477, 1932, 1054, 4687, 5735, 5566, 2447, -778,
+ 1791, 3768, 602, -2421, -6876, 9505, 7350, 2428, -3175, -6252, -707, -3720, -7723, -42, 4292, -1141,
+ -2469, 269, -1028, 1057, -890, 383, -128, 821, -2854, -5548, -2437, -3349, 3935, 1474, 14267, 13393,
+ -3416, 14072, 1196, -3166, -4252, -711, 521, 2462, 5346, 1483, -4287, -7676, -5805, -321, 867, 475,
+ -1674, 1391, 539, -471, -5201, -25, 6911, -2142, 10454, 10963, 1353, -2831, -3219, -131, -3005, -4468,
+ 3476, 4986, 6318, -2959, -9204, -87, 3906, -833, -247, 5687, 451, 716, -2970, -5788, -6743, -9436,
+ 4831, 6767, 3852, 2164, -1362, -1404, -3260, -4807, 2809, -2699, -4693, 21984, 10803, 4063, 2353, 6177,
+ -2813, -890, -5363, -165, -5755, -20361, 3639, 4639, -2073, 1798, -1097, -6169, 30, -1827, -4590, -2586,
+ -5855, -6418, -10115, -6038, 2674, 3620, 1206, 1379, -520, 5333, 5334, 3618, 439, -1048, 439, 777,
+ -7871, 2657, -3649, 7671, 10875, 5285, 423, 1869, -2283, -6081, -2750, -3935, -1815, 2851, 754, -2545,
+ -2253, -245, 87, 3432, 4323, 803, -3981, -8416, -12174, 6263, 9281, 7472, 2558, 327, -3198, -1436,
+ -1398, -211, -6595, 4670, 63, 2041, -4372, 967, 2444, -9123, -11355, 1727, -4221, -3144, 6411, 4338,
+ -4409, -3256, -6504, 6064, 4055, -2268, 5638, 5466, 82, -516, 6974, 5206, 1235, -364, -4919, -6016,
+ 2, 7, -5, 5, 1, 2, -8, 4, 4, 2, 4, 5, 0, -1, -3, 1,
+ -1139, 1101, -1501, -3122, 2059, 9130, 5593, -2976, -5845, -8198, 10800, 771, -4815, 20594, 5385, 9434,
+ -497, 877, -5365, -1190, -2940, -6216, 4700, 872, -2276, 9901, 5530, 417, -4381, -9743, -1935, -1025,
+ -3555, -643, -5254, -6674, -6586, -4879, -3791, -2733, 1046, 2275, 3157, 3643, 8384, 10607, 11929, 9237,
+ 1573, 3323, 130, 12128, 9521, 6522, 4035, -1444, -7190, 565, 2160, -2808, -3716, -9398, -1115, 4631,
+ -1938, -2034, -5142, 6407, 5972, 302, -3078, -7362, -12229, 6591, 5640, 1240, 2727, 3243, 9738, 7334,
+ -8793, 935, -4176, 103, 2398, 1724, 1579, 7649, 5685, 2791, 1754, -453, -5030, -4870, -3871, -3139,
+ -243, 3111, -2068, 3022, -4587, -11340, 14571, 7771, 3558, 5750, 1203, 4665, -1981, -109, 4442, 1369,
+ -2041, 3713, 1013, 1345, 4716, 129, 3062, 1444, -3639, -6184, 7457, 7819, 958, -8391, -8799, 9312,
+ 235, 3895, 12172, 2716, -1347, -1094, -4869, -880, 7519, 9011, 9914, 5683, 5909, 7805, 4428, 2129,
+ -1538, -36, -678, 1486, -649, 1517, -5121, 8530, 5048, -1844, -4781, -9145, -11353, -8076, -4133, -307,
+ -2707, 80, -5905, -4315, -4389, -6758, -6105, -9003, -10744, -1701, 3765, 6091, 10523, 7504, 4350, 4312,
+ 786, 3663, 9280, 6578, 391, 1514, -7019, 5089, 3483, -6871, -8172, -180, -7469, 1419, -121, 838,
+ 2692, 6995, 1431, -1074, 1394, -268, -1170, -3367, -7586, -5698, 7587, 7378, 5733, 8353, 10152, 10834,
+ -8158, -6271, -9914, 9985, 5364, -2601, -1959, -6260, -4097, 3235, 2097, -196, 2968, 3371, 2095, -1207,
+ -2269, 648, -1910, 7766, 5356, 3667, 981, 2825, 4288, 6668, 696, -661, 4042, -5356, -12858, -3646,
+ -4703, -3239, 10100, -2312, -256, -2120, -2612, 4835, -1675, 1068, 5746, -140, -869, 3620, 3505, 1703,
+ -3250, -2423, -1423, -674, -4843, 10905, 4109, 635, -1606, -6241, -2449, 3295, 6275, 14389, 8002, 4352,
+ -842, 3170, 1430, 1513, -4583, -12820, 1470, -4220, -8952, 6987, 4718, 532, -2136, -3700, -1727, 4512,
+ -3663, -2257, -8998, 5471, 843, -2858, -4142, 5134, 7250, 525, 3002, 118, 423, 6929, 5389, -1003,
+ -3457, -2564, 4399, 5758, -1462, 9992, 2582, 885, 6350, -670, -4446, -5882, -1814, -1178, -3073, 1157,
+ 2529, 7505, 5440, 202, -5746, -976, 8235, 1049, -181, -142, -6919, -6675, 18283, 16554, 8385, 3001,
+ 2266, 12753, -3253, -3832, -7200, -5627, -4778, -925, 239, 539, 2225, 324, 3182, 1914, -309, -507,
+ 5074, 4381, 9167, 1915, -3908, 1754, -5997, 2537, 17796, 13293, 7314, 12286, 1815, -4329, -8064, -20774,
+ -2484, 4942, 14515, 5406, -2595, -1380, 8417, 5956, 1651, 1559, -1389, 24, -6421, -4047, 2557, -1331,
+ -3164, 848, 15096, 9663, 6043, 3180, 595, 2733, 830, 1861, 9051, 8435, 8904, 6571, 2208, -762,
+ -135, 870, -2484, -3227, -9497, -586, 14177, 5880, -3708, 505, -1483, -415, 2507, -1973, -13853, -8468,
+ -3854, -2420, -9258, -4766, -3435, -2360, 10467, 7572, 598, -4099, 3457, 402, -195, 4193, 2023, 1851,
+ -4359, -3760, -1315, -585, 11411, 2958, 5446, 1608, 228, 4691, 1446, -1971, -3898, -3822, -1651, -1697,
+ 5112, 1738, -12375, 11069, 8416, -139, -721, 740, -8678, -7527, 10378, 4791, 5388, 2724, 4652, 1931,
+ -1419, 520, -6325, 10393, 8379, 2544, -2104, -11110, 7461, 2884, -1766, 548, -217, -2709, -1287, -2598,
+ 1996, 4969, 3862, 5813, -629, -7138, 7107, 9009, 5157, 1564, 5244, 1326, 78, 263, -4389, -5858,
+ -5423, -34, 1648, 2316, -3981, -5525, -1762, -996, 2075, 878, 718, 1458, 613, 3914, 3912, 2074,
+ -1176, 643, -3222, -444, 779, 9634, 14238, 11755, 3727, 1970, -1421, 3653, 1795, -2315, 10947, 8623,
+ 19, 6095, 3277, 2648, 2148, 509, 3577, 978, 1862, 5842, 1302, -3853, -10993, -12406, 858, 7763,
+ -4944, -1993, -5563, 833, -1365, -2240, -25, 2546, 10150, 10369, 10670, 10551, 9322, 5582, 881, -1029,
+ -763, 4474, 9314, 8818, 2703, 4844, 7776, 1684, 1, -3980, -9739, 5565, 2667, 1185, 2203, 1611,
+ -635, 724, -4112, 8414, 3049, 1437, 2314, -2611, -5835, 5541, -3027, 1017, 14246, 10165, 9910, 14393,
+ 2201, 3204, -295, 2519, -855, 5303, -2184, -12725, 10839, 1337, 154, -5290, -7908, 9490, 4292, 5533,
+ 544, 3574, 602, -783, -3121, 21721, 8166, -1137, 4729, -2399, 2504, 3721, -2704, -10309, 4957, 8028,
+ 2782, 11109, 5440, 2691, -3942, 3286, 2848, -532, -186, -2661, 7318, 6015, -1200, 2174, 5498, -379,
+ 4440, 6050, 3576, -819, -3697, 13144, 9664, -2178, 2966, 3302, -623, 10572, 15713, 9000, 2137, -5160,
+ -1593, 613, 3985, -7128, -5989, 2429, 721, -5488, -11848, 981, -3054, -4499, -4102, -7743, -7416, -340,
+ -2759, -2449, -4426, -6796, -13804, -7472, -1409, -1103, 181, 3071, 434, -741, 1045, 1976, 1407, 1365,
+ -2578, -1275, 5323, 9313, 4798, -1130, -6220, -2101, -3402, -868, -1959, -4365, -4536, -1626, -3701, -5011,
+ -3479, -3407, -9706, 4812, -812, -4014, 2558, -5416, -10543, -5186, -3840, 1189, 3804, 5839, 4744, 1003,
+ -3585, -2339, -4745, 3869, -2763, 1306, -6059, -8604, -1377, -5116, -730, -1693, -3321, 888, -685, 876,
+ -3492, 910, -7012, -2555, -5147, -1372, -1910, -8518, 2661, 7652, 6967, 7296, 4514, -4741, -9827, 873,
+ -1258, 4649, 3654, 653, -5264, -5509, -4222, 1703, 3992, -5102, -4342, -6447, 6603, 2642, -923, 6242,
+ -992, 647, 1228, -3124, -3463, 15067, 838, -6186, -3433, 872, 97, 2876, 3686, -2643, -6780, 356,
+ -1727, 2555, 2552, -1938, -8798, -773, -757, -3588, -7005, -6121, 4601, 235, -4446, 2984, 1353, -776,
+ -15055, -12154, -6273, 84, 390, -3286, -4758, -3713, -2185, -1512, 1403, 3479, 7578, 6327, 5045, 3075,
+ 2469, 8960, 6679, 3813, 1059, 9183, 2971, 4300, -1040, -927, -2376, -6240, -5131, -6030, -7385, -7560,
+ 933, 4512, -899, -1226, -7230, -10649, 11249, 4655, -7924, -5423, -5107, 993, 588, 2896, 4305, 1369,
+ -1938, 11282, -2696, -7285, 1163, -6289, -344, -2329, 3632, 2191, -1017, -1404, -2305, -6223, -2822, -1369,
+ -3688, -918, -3118, 256, -5446, 8638, 6195, 2855, 7432, 6937, 8638, 4020, -3296, -4260, 21, -3914,
+ 3006, 5845, 16377, 17059, 3579, 103, 204, -563, 1735, 6204, -405, -2618, -7929, -14028, -9415, -5277,
+ 303, 934, -305, 3211, -2970, 2963, 10231, 2833, 1656, 1162, -4439, 6346, 9314, 7062, -5015, -15980,
+ -320, 499, -14803, 4610, 2112, -4049, 7242, -245, -3115, 1323, -1276, -4286, -1951, 100, -1389, -1612,
+ -4391, -2691, -5202, -11000, 373, -2423, 4221, 4146, 1045, 503, -4063, -2244, 2311, 1646, -1779, -3188,
+ -3374, 346, -3243, -3662, 5971, 5519, 3022, 516, -4538, -6550, -5227, -6165, -4919, -1105, 30, 721,
+ 2935, 3922, -1041, 4217, 2528, 1985, 661, -824, -10133, -13715, 8714, 2218, 3769, 3384, 1193, -6246,
+ -5357, -2959, -8106, 5394, 1542, -4964, -7749, -4183, 877, 1146, 8307, 2891, -4905, -5775, 1888, 1442,
+ -2472, -850, 1278, 1397, -4545, -3625, -11722, 9811, 7790, 7832, 12234, 6079, -2436, -890, -1820, -234,
+ -3905, -1081, -7818, 2577, -299, 5742, 4982, -1421, 3506, -604, -4944, 2130, 544, 1545, -2399, -3202,
+ -895, -203, 783, -203, -2734, 10200, 7718, 3943, -6098, 9859, 9374, 6777, 2263, -2089, 866, 3381,
+ -3828, 1991, -2866, -1612, 747, -3896, 6041, 2875, -5838, -6829, -2319, -1146, -8845, -10612, 3630, 2942,
+ -509, 5457, 1119, -3222, -3623, -6421, -9746, -8661, 5658, 8283, 8062, 6310, 1787, 454, 1766, 2750,
+ -1632, 7787, 5349, 243, -1526, 3143, 5218, 10290, 1446, -6324, -3035, -1055, 2974, -7871, 39, 3664,
+ -769, -9, -8896, 9699, 4546, -1295, 6107, -4534, 3367, 1450, -3607, 8816, 3219, -5601, 1298, 12366,
+ -7130, -4420, -6848, 3453, 3599, 4371, 609, -6059, 8057, 9067, 2408, -3523, -6908, -6822, -6636, -2017,
+ -477, 5145, -1462, -475, -2003, -3769, 7781, 4563, 4437, 2134, -2726, 15777, 2839, -1929, 2913, 2174,
+ 841, 2396, 754, 14163, 4130, -1807, -177, -3884, -6782, 9287, 1864, -599, 5913, -2587, -10749, 5856,
+ 1304, 7980, -2237, -2092, -4384, -828, 552, -6108, 2193, 10107, 6057, 9885, 13003, 8977, 4006, -926,
+ -1523, 1282, -1805, -2709, -6024, -7618, -10251, 832, -689, -1488, 1528, -1635, -4512, -3974, 3366, 5884,
+ -2891, -646, -4227, -16787, 4586, 2689, -48, 1956, -5398, -5693, 4030, 1138, 2292, 2634, 6453, 3271,
+ -3526, 9059, 2896, 8101, 3313, -270, -1336, -3002, 826, -1572, -3793, -2235, -1597, 272, 910, -778,
+ -1195, 3634, 1576, 2036, -3675, -10512, -6414, -3268, -9714, -6636, 3287, -947, 6643, 7755, 4317, 2928,
+ -592, -46, -6118, -3775, 11750, 5301, -2878, -7240, -4674, 1543, -626, -1300, -608, -1661, -4053, -3154,
+ -2514, -545, 771, 7292, 3641, 749, -1664, -1652, 2686, 8715, 10176, 4547, -6065, -7417, -6454, -4928,
+ -576, 940, 681, 2977, -2947, -1968, -6468, 10093, 7720, -2235, -3869, -8057, -4152, 7399, 8617, 5658,
+ -1043, 1637, -3699, -5968, 13092, 1526, 1185, -3128, -2234, 3343, 5773, 9935, 7870, 6240, 3284, 3932,
+ 377, 5872, 3528, 3824, -852, -1575, -3799, -8401, -5628, -3612, -2451, 1396, 1471, -1669, -579, -384,
+ -6978, -4522, -6731, -1881, 1485, -73, -38, -3990, 11379, 4104, 1154, 5492, 3709, -645, -641, -750,
+ -97, 2556, 1619, 3351, 1996, 10845, 8411, 2751, 3099, -165, -6582, -11822, 8128, 7722, 4495, 3322,
+ 950, 2744, -2039, -3959, -6098, -2113, 4512, -1699, -758, 3243, -4760, 7788, 11837, 5336, 7626, 5509,
+ -4876, 13906, -3059, 1351, 4037, 2283, 614, -5014, 2149, 613, 744, -4239, -5981, -4296, -1799, -3121,
+ -2111, 3530, -1221, 1654, 9442, 10361, 6422, 7826, 7510, 7790, 3836, -323, -761, 1652, 330, -386,
+ -3239, 3070, 7009, -1209, 6710, 213, 5225, 3105, 1173, 842, -1774, -5027, -3901, -1359, -2786, -3513,
+ 1481, 1904, 7402, 23443, 5946, -3615, -1528, -4317, -2629, 11277, 7171, 5620, 7938, 4715, 3575, -3794,
+ 2315, 5200, 63, 4010, -400, -2074, 6624, -516, -731, -2133, -10088, 6969, -3380, -7450, -7347, -6915,
+ -3407, -3447, -1422, -4020, -11809, 3562, 3865, 570, 7656, 6367, 5964, 802, -2306, 5862, 7700, 6476,
+ -17049, -2577, 3748, -1004, 990, 2569, 4487, 2137, -3540, -3508, 608, -2102, 90, 4634, 3115, 1273,
+ -1960, -1414, 1516, 9460, 6833, 2088, -3598, -3590, -2554, -1783, 2680, 2127, 939, 8562, 4170, 1914,
+ 3335, 6241, -2988, 1816, 3233, -951, 587, -5590, -3415, -926, -7987, 8897, 3700, -12712, 5722, 4683,
+ -756, 1823, 2804, 3392, -2019, 801, -2923, 43, 5720, 2302, 3604, 14791, 4960, -425, -7298, -6606,
+ 205, 5909, 8599, 4641, -4600, -1580, -4536, -5178, 2346, 6910, 3641, -2630, -6079, 351, 5478, 5524,
+ 151, 1252, -2569, 6834, 5377, 4284, 450, -1607, 7257, 4429, -2568, 9851, 9183, 2197, 20053, 9155,
+ -1462, 924, -3196, -3257, -8953, 6147, 6251, -3186, 3285, 3198, 2326, 1225, -8446, -11295, 5393, 10785,
+ -2381, -2014, -9329, 4719, -880, -2308, -4714, 4429, 3675, -1874, 3253, 9686, 12557, 9338, 4719, 3836,
+ -3103, 7031, 11258, 6883, 11690, 8131, 3644, -307, -2590, -274, 1004, -1314, -166, 3063, 695, -1815,
+ -2455, 811, -1161, 2731, 5931, 2352, 3361, -363, -7371, 2805, 4053, 3586, 7364, 242, -1692, 17531,
+ -4497, -535, 286, 214, 3804, 11412, 4562, -1157, 550, 4841, 1657, -4984, -6307, 1482, 5745, 3540,
+ -2763, -1313, -1385, 3735, -2423, 5601, 14635, 10815, 9726, 6141, 4010, 3556, -104, -3353, -7143, 7077,
+ -245, 8209, 15457, 5234, 1860, -2195, -4620, -4895, -4263, -759, 2016, 2664, 3153, 2966, 1601, 30,
+ -4764, -1351, 3227, 2660, 1556, 198, 5379, 11277, 8580, 6978, 2506, 3310, 13165, 9623, 7120, 1665,
+ -59, 558, 3194, 1299, -2918, -2455, 3754, -3394, -3634, -2782, -7987, -7903, -7058, -2214, -1060, 2183,
+ -1954, -186, -11418, -2859, -1110, -2027, -932, -2040, 1282, 174, -161, -2628, -3341, 2675, 4169, 2475,
+ -5934, -5196, 10580, 9382, 1417, -1362, -2572, -4391, 7418, 4314, 148, 31, -82, 461, -2595, -570,
+ -3639, -2081, -1014, 4355, 5943, 6217, 2491, -4106, -6520, -4050, -5030, -2053, 6821, 6135, 2456, 1015,
+ -3447, -1303, -5380, -6759, -3272, -129, -4989, -11231, 5106, 1264, -3433, -3327, -3139, -1282, 1031, 1558,
+ 4180, 1592, -3435, 2252, -4803, -6443, 8937, 1696, -5599, 9240, 5481, -328, 3197, -4392, -12452, -16482,
+ -4613, 5693, 11596, -9035, 1399, 1388, 5182, 4750, 958, 310, -866, 829, 5122, 1203, -115, -759,
+ -3551, -1843, -3272, -1753, -195, 17324, 8182, -502, -2987, -146, -2640, 6865, 6979, -3675, -6047, 12865,
+ 3739, 8307, 5634, -2783, 96, 1167, -274, -636, -5808, -8880, 835, 6363, 5092, -700, -8229, -7634,
+ -6799, -5871, 4391, 1265, -1493, 440, -7322, 2387, 1763, -1406, 4030, 8075, 8810, 5655, 1375, 2309,
+ 3191, 6527, 2671, -128, -5345, 14221, 13006, 1792, -548, -2974, -7549, -3471, 1835, -1490, -3556, -4240,
+ -3368, -1748, -3945, 8349, 2444, -5349, 5825, 4222, -1891, -3570, -10832, 8764, 2791, 5495, 9332, 5366,
+ 1020, 5766, -8313, 522, -568, -20, -2169, 3981, 6641, 4235, 1781, -4362, -7143, -3864, -2205, -3217,
+ -3300, -1346, -1200, 5950, -1315, -285, 2642, -180, 12986, 11560, 5996, 6755, -2578, -1417, 1848, 5560,
+ 10662, 13080, 11225, 419, -4335, -128, 6716, 1638, -4903, 154, -2404, -4228, 5262, -364, -5170, -12310,
+ 360, 1588, 2173, 8939, 4304, 7241, 367, -2361, 6569, 837, -4801, 8650, 7208, 5996, 3566, 1112,
+ -5017, 4300, 2649, 3064, -6110, -14292, 2204, 13008, 5245, 1594, -6536, -11045, 5146, -211, -4067, -11435,
+ -530, 1840, 187, -12175, 1984, -1576, 3659, 4293, -1971, 8025, 8287, 4420, 3935, 358, -1691, -2707,
+ -3429, 252, 1235, 3895, 13024, 5900, 317, 1720, 3724, 1510, -3576, -6091, -8218, -3620, -844, -406,
+ 2105, 7096, 3064, 3952, 2071, -2774, 8459, 1501, -10913, 1387, -405, 12863, 2328, 4475, 3498, -1584,
+ -3085, -920, -7032, 8494, 2146, 1346, 1867, -404, 1886, -1042, -378, -2121, -10433, -7336, 15525, 9808,
+ -15685, -7623, 1925, 2963, 4001, -105, 3843, 5498, 4039, 6151, 6044, 3867, 1730, 2971, 1484, -319,
+ 3080, 9412, -1223, -3973, 4734, 2248, 3127, 1119, -1738, -1669, -1477, -1472, 1412, 1213, 773, 1674,
+ -730, 2282, 495, 1849, 753, 4313, 2052, 11060, 2638, -4153, 12967, 4232, 1600, 8305, 6247, 4101,
+ 1078, -516, -6160, -2738, -3949, 549, 2665, 313, -11805, 5780, 13753, 4964, -3343, -3825, 7392, 657,
+ -3356, -672, 2091, 1930, -1942, -6931, -7983, -7306, 1452, 3417, 9758, 12537, 14305, 11570, 5653, 1593,
+ 2820, 8229, 5573, 6212, 5169, 4568, 4877, 1219, -5520, -3569, -4997, 3799, -1152, -6233, 13054, 8210,
+ -1905, -1112, -1728, 19102, 8663, -331, 3226, 1066, -1807, 8189, 5678, 1987, 4661, 3278, 7947, 11458,
+ -4574, -517, -5124, 4711, -740, 416, 4847, 4427, 11056, 3251, -1915, -3528, -2529, -2213, 1857, 1203,
+ 316, 3731, 4619, -1294, -3138, -336, 8691, 7311, 3124, 9892, 5880, 614, 1873, 1916, 3856, 3588,
+ 1323, 8284, 7332, 4197, 626, 4877, 9117, 4163, 1998, 4387, 5489, 4184, 2124, -5170, -10914, 3921,
+ -1504, 12727, 938, 3478, 1876, -1017, 389, 3233, 8278, 8027, 8392, 12663, 13264, 9858, 5767, 4287,
+ -4008, 49, -1854, -5454, -9369, 5309, -1597, 6002, 6031, -2543, -4793, -2340, -2559, 229, -983, -2068,
+ -3514, 815, -7510, -3824, -931, -1573, -1337, -1189, -2019, 245, 4084, 4416, 6165, 7239, 3899, 2461,
+ -4781, -2173, 17577, 2751, -894, 2264, 1789, -623, 992, -322, -3113, -1854, -1553, 2213, 731, 850,
+ 2054, 3456, 3747, 3842, 980, -940, -5065, -5905, 423, -2009, 74, 3933, 13511, 12742, 8908, 5783,
+ 894, 6872, -2742, 7127, 5497, -660, -2361, -3114, -5552, -884, -1825, -8536, 4278, 4047, 3263, 2117,
+ 46, 3829, 3392, 7000, 5004, 11640, 7090, 2661, 2072, 3834, 6408, 9453, 4328, -5807, -11811, -6081,
+ 1119, 3292, 8329, 5549, -1361, -4414, -15806, 7144, 6824, -4515, -1143, 4774, 1451, 5261, 4830, 5562,
+ -1393, 5662, 4446, 1807, 8826, 6248, 6415, 4547, -1665, 1181, 6405, 5864, 8293, 10387, 7545, 4688,
+ 1312, 7883, 6317, -3965, -8535, -2725, 1117, -5447, -7012, 3655, 3196, 4576, 6822, -341, -646, 6098,
+ -6332, -4527, -5839, 4942, 2805, 6652, 925, -1187, 3859, 4466, 5194, 4814, 7489, 8532, 2922, 2874,
+ -1137, 1068, 2253, 3741, -2505, 9887, 10247, 3472, 9158, 1176, -2976, 1937, -2064, 7351, 6057, 2696,
+ 532, 4702, 4601, 502, -1350, -5364, 9112, 2103, -4340, 18, -1329, -2532, 2939, 15707, 4071, -2154,
+ -628, 13794, -2239, -2982, -3391, -2332, -1483, 5699, 7418, 5487, 5469, 3426, 2471, 2248, -610, -2978,
+ 4520, 7035, 8360, 8190, 4367, 11231, 9045, 6518, 5468, 6414, -626, -2179, -2327, -6601, -11740, -18010,
+ 872, 6597, 9823, 6115, 5121, 3028, -3065, 9266, 9664, 2144, 2461, -758, -3373, -348, -421, -2786,
+ -2998, -2310, 5826, 14327, 10399, 10344, 5906, 4646, 4013, 7488, 6656, 3601, 212, 2499, 812, -4251,
+ -3455, -259, -2801, -3743, -3930, 4402, 11531, 8368, 3812, 2663, -1885, -3062, -3413, -12432, -6348, -1832,
+ -2574, 1227, -6578, -7396, -131, 1139, 3464, 2303, 6848, 4302, 422, 1994, 4840, 6023, 4369, 1222,
+ -5186, -3043, -5221, 9413, 9009, 6329, 6302, 7712, 4428, -1745, -1711, 1216, 1855, 1215, 1003, 58,
+ 3844, 4380, -2452, 17587, 5229, 106, 3809, 5238, 2909, -6280, 6367, 4649, 3777, 2815, 4377, 9833,
+ -3469, 6722, -2982, 1867, 2944, 3428, -115, -6063, 4740, 2369, 3681, 2580, 319, 76, 4169, 1079,
+ 5357, 7937, 8749, 6732, 3237, 475, 10599, 7708, 2300, 9384, 6872, 6516, 11437, 2109, -2788, -10922,
+ -2925, 1420, 3109, 500, 6953, 1289, -522, 1064, 2885, 6445, 3595, 2000, 2669, 2797, 2174, 873,
+ 1980, 6159, 1331, 1321, -1922, 6722, 11666, 3321, -1515, 1233, -1664, 9262, 9668, 2502, 13862, 9666,
+ 3582, 10575, 2715, -603, 596, -1567, 4182, 49, 2208, 1795, 10525, 9472, -2866, -8439, 7591, 11197,
+ -2356, 153, -10244, -4768, -2178, -2408, 1367, 708, 4615, 9681, 13007, 14875, 15382, 12708, 8355, 5074,
+ -358, 1803, 1987, 7888, 9168, 16089, 2288, -2716, -1669, 1078, 1165, 5324, 4412, -4354, 298, 6519,
+ 4826, 9355, 6507, 12087, 4177, -6, 2865, -2898, -5149, 6100, -1829, 80, 12459, 4967, 591, 7846,
+ -3452, 13887, -142, 4052, 5842, 3702, 4535, 2718, 4976, 3690, 1377, -72, -1938, -836, 961, -1944,
+ 4315, 5391, 6496, 1795, -2279, 20485, 16142, 9768, 8889, 6390, 1789, 3149, 4186, 487, -922, -2249,
+ -1225, 14246, 10277, 980, 2427, 180, 5713, 4730, -901, 590, 3351, 1871, 4389, 4760, 8650, 3433,
+ 1760, 3580, 5798, 6813, 4246, 17695, 7227, 4364, 2222, 13912, 11731, 10965, 14919, 7273, -6023, 6474,
+};
+
+/*----------------------------------------------------------------------------------*
+ * LSF quantization - Scaling factors
+ *----------------------------------------------------------------------------------*/
+
+/* Stable ISP vector in Q15 */
+const Word16 stable_ISP_fx[16] = { 32139, 30274, 27247, 23170, 18206, 12540, 6393, 0, -6390, -12537, -18203, -23170, -27243, -30271, -32139, 1475 };
+/* Stable LSP vector in Q15 */
+/* This LSP corresponds to GEWB_Ave_fx Q15*/
+const Word16 stable_LSP_fx[16] = { 32437, 31676, 29486, 25681, 21564, 16413, 10838, 5385, -735, -6405, -11986, -17040, -22052, -26346, -29678, -31784 };
+
+/* stable ISF vector */
+const Word16 stable_ISF_fx[M] =/*15Q16*/
+{ 1023, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13311, 14335, 15361, 3978 };
+
+/*----------------------------------------------------------------------------------*
+ * LSF quantization - Mean LSF vectors
+ *----------------------------------------------------------------------------------*/
+/* These are not used anywhere */
+/* Length 16 vector in Scale = 2.56f */
+const Word16 means_wb_cleanspeech_lsf16k0[16] = { 727, 1426, 2582, 3554, 4548, 5481, 6397, 7293, 8170, 9010, 9972, 11003, 12072, 13034, 14097, 14956 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 means_swb_cleanspeech_lsf25k6[16] = { 786, 1840, 2892, 3833, 4778, 5658, 6641, 7662, 8692, 9630, 10603, 11534, 12489, 13387, 14349, 15217 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 means_swb_cleanspeech_lsf32k0[16] = { 757, 1855, 2862, 3798, 4705, 5661, 6742, 7692, 8658, 9577, 10513, 11401, 12358, 13269, 14275, 15149 };
+
+
+/* An 16-by-1 matrix */
+const Word16 SVWB2_Ave_fx[16] = { 998, 1488, 2682, 3823, 5084, 6305, 7485, 8686, 9861, 11004, 12339, 13664, 15088, 16330, 17663, 18754 }; // Q2.56
+/* An 16-by-1 matrix */
+const Word16 IANB_Ave_fx[16] =
+{
+ 726, 1433, 2493, 3408, 4340, 5215, 6103, 6947, 7772, 8536, 9252, 10012, 10909, 12427, 13997, 15193
+}; // Q2.56
+/* An 16-by-1 matrix */
+const Word16 IAWB_Ave_fx[16] =
+{
+ 577, 1350, 2526, 3535, 4539, 5504, 6497, 7460, 8445, 9396, 10371, 11319, 12307, 13268, 14249, 15207
+}; // Q2.56
+/* An 16-by-1 matrix */
+const Word16 IAWB2_Ave_fx[16] =
+{
+ 731, 1777, 3194, 4386, 5629, 6806, 8012, 9164, 10329, 11469, 12731, 14037, 15326, 16538, 17801, 18927
+}; // Q2.56
+/* Length 16 vector in Scale = 2.56f */
+const Word16 UVNB_Ave_fx[16] = { 1018, 1764, 2856, 3751, 4611, 5410, 6233, 6961, 7685, 8304, 8859, 9325, 9977, 11741, 13699, 15074 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 UVWB_Ave_fx[16] = { 898, 1900, 3172, 4190, 5181, 6161, 7134, 8066, 8995, 9888, 10784, 11636, 12527, 13396, 14301, 15183 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 SVNB_Ave_fx[16] = { 890, 1268, 1930, 2902, 3938, 4823, 5832, 6644, 7487, 8202, 8906, 9545, 10788, 12565, 13959, 15183 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 SVWB_Ave_fx[16] = { 832, 1248, 1949, 3083, 4131, 5117, 6179, 7067, 8008, 8922, 9875, 10741, 11785, 12860, 13968, 15048 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 GEWB_Ave_fx[16] = { 742, 1350, 2354, 3495, 4446, 5456, 6434, 7331, 8309, 9218, 10145, 11044, 12042, 13063, 14101, 15103 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 GEWB2_Ave_fx[16] = { 909, 1783, 3227, 4443, 5685, 6851, 7996, 9116, 10213, 11263, 12465, 13754, 15090, 16293, 17621, 18695 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 GENB_Ave_fx[16] = { 836, 1344, 2257, 3263, 4173, 5031, 5950, 6707, 7514, 8234, 8881, 9439, 10393, 12226, 13855, 15135 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 TRNB_Ave_fx[16] = { 919, 1335, 2106, 3142, 4092, 4938, 5905, 6670, 7490, 8199, 8868, 9444, 10544, 12383, 13900, 15156 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 TRWB_Ave_fx[16] = { 834, 1326, 2151, 3341, 4305, 5299, 6318, 7198, 8167, 9071, 10001, 10867, 11871, 12912, 13986, 15046 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 TRWB2_Ave_fx[16] = { 945, 1546, 2866, 4150, 5342, 6568, 7660, 8809, 9894, 10934, 12170, 13577, 14981, 16280, 17614, 18778 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 AUNB_Ave_fx[16] = { 887, 1443, 2356, 3194, 4105, 4949, 5841, 6635, 7437, 8181, 8867, 9478, 10385, 12182, 13858, 15131 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 AUWB_Ave_fx[16] = { 810, 1468, 2476, 3417, 4396, 5342, 6311, 7215, 8171, 9078, 10030, 10969, 12014, 13075, 14146, 15133 };
+/* Length 16 vector in Scale = 2.56f */
+const Word16 AUWB2_Ave_fx[16] = { 933, 1745, 3040, 4157, 5379, 6490, 7646, 8725, 9852, 10930, 12214, 13647, 15062, 16297, 17636, 18768 };
+
+
+
+
+
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor0_fx[16] = { 27361, 27361, 27361, 27197, 27197, 27197, 26378, 26460, 26214, 25985, 26460, 26460, 25985, 25723, 25723, 24740 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor1_fx[16] = { 27034, 27034, 27034, 26640, 26313, 26640, 26640, 26132, 26214, 26214, 26460, 26870, 26870, 26706, 27034, 26640 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor2_fx[16] = { 24248, 23593, 24510, 24248, 24510, 24019, 24019, 23757, 23757, 24019, 24248, 24248, 23593, 23101, 23593, 23101 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor3_fx[16] = { 24248, 24248, 24740, 24248, 24510, 23757, 23429, 23101, 22610, 23101, 23593, 24740, 25002, 24740, 25002, 24838 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor4_fx[16] = { 19005, 18350, 19268, 19005, 19268, 18776, 18776, 18514, 18514, 18776, 19005, 19005, 18350, 17859, 17695, 17203 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor5_fx[16] = { 23839, 23593, 23593, 23839, 23839, 23593, 23593, 23593, 23839, 24084, 24347, 24576, 24576, 23364, 23364, 23364 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor6_fx[16] = { 24084, 23839, 24084, 23593, 23593, 22938, 22381, 21791, 21135, 21955, 22381, 24347, 24576, 23593, 24576, 24347 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor7_fx[16] = { 24347, 24084, 24347, 24347, 24347, 24084, 24347, 24576, 24576, 24740, 25068, 24347, 24084, 23839, 23364, 24740 };
+/* Length 16 vector in Q = 15 */
+const Word16 Predictor8_fx[16] = { 24740, 24740, 24740, 24576, 24576, 24576, 24084, 23839, 23593, 23364, 23839, 23839, 23364, 23101, 23101, 22118 };
+
+/* An 16-by-16 matrix */
+const Word16 CNG_SN1_fx[256] =
+{//Qlog2(2.56)
+ 600, 1640, 3039, 4257, 5512, 6740, 7989, 9169, 10393, 11612, 12880, 14100, 15378, 16554, 17816, 18918,
+ 1188, 2487, 3746, 4903, 6103, 7261, 8437, 9587, 10776, 11954, 13172, 14355, 15564, 16712, 17913, 19012,
+ 346, 799, 2259, 3555, 4876, 6175, 7516, 8803, 10073, 11323, 12631, 13938, 15282, 16553, 17817, 19039,
+ 439, 1616, 3446, 4743, 6073, 7288, 8553, 9726, 10947, 12106, 13312, 14474, 15650, 16773, 17894, 18977,
+ 921, 1800, 2976, 4007, 5105, 6137, 7178, 8150, 9057, 9914, 11009, 12545, 13671, 15502, 17428, 18927,
+ 896, 1899, 3035, 4128, 5301, 6429, 7604, 8719, 9886, 11059, 12417, 13621, 14962, 16135, 17475, 18460,
+ 722, 1507, 2537, 3437, 4328, 5190, 6018, 6841, 7587, 8343, 8925, 9511, 9919, 11075, 13613, 15021,
+ 315, 612, 1671, 2910, 3990, 5083, 6120, 7170, 8188, 9173, 10148, 11186, 12250, 13262, 14290, 15284,
+ 885, 1928, 3010, 3973, 4952, 5900, 6848, 7769, 8701, 9609, 10581, 11540, 12508, 13450, 14412, 15349,
+ 338, 1020, 2657, 3736, 4839, 5791, 6806, 7760, 8738, 9659, 10627, 11567, 12534, 13468, 14416, 15334,
+ 1126, 1964, 2999, 3855, 4764, 5608, 6482, 7286, 8109, 8827, 9570, 10649, 11999, 13125, 14223, 15252,
+ 385, 815, 2000, 2939, 3906, 4879, 5793, 6734, 7661, 8526, 9309, 10146, 11597, 12955, 14106, 15241,
+ 633, 1445, 2400, 3293, 4235, 5171, 6143, 7084, 8057, 8980, 9924, 10924, 11987, 12998, 14016, 15058,
+ 584, 1248, 2250, 3131, 4050, 4920, 5811, 6652, 7471, 8244, 8913, 9480, 10188, 12225, 13871, 15123,
+ 1157, 1820, 2745, 3505, 4354, 5097, 5932, 6648, 7408, 8034, 8635, 9083, 9977, 12228, 13819, 15108,
+ 572, 1401, 2514, 3501, 4503, 5465, 6469, 7435, 8416, 9328, 10306, 11309, 12328, 13303, 14306, 15261,
+};
+
+const Word16 SVWB2_SN1_fx[256] = {//Qlog2(2.56)
+ -257, -385, -673, 926, 1408, 874, 735, 512, 624, 587, 493, 688, 845, 521, 428, 95,
+ -32, -90, 1046, 666, 329, -59, -324, -282, -712, -783, -229, 28, -354, -434, -497, -351,
+ 182, 111, 512, 746, 365, 91, -214, -477, -401, -496, -931, -1180, -1422, -1085, -456, -9,
+ -286, -387, -325, 317, 172, 274, 238, 550, 555, 574, 618, 717, 751, 611, 441, 233,
+ 96, 178, 203, -112, -464, -591, -212, 124, 32, 192, 244, 94, -41, -293, -507, -649,
+ -94, -164, 1011, 926, 688, 461, 593, 587, 398, 400, 351, 486, 482, 424, 294, 219,
+ -260, -356, -458, -252, -162, -350, -394, -255, 30, 173, 90, 64, 93, 157, 66, 2,
+ 43, 100, -48, -596, -852, -787, -569, -536, -780, -607, -169, -125, -75, 96, 98, 154,
+ 240, 203, 404, 79, -202, -555, -718, -1023, -1158, -1390, -1537, -774, -478, -173, -63, 272,
+ -164, -291, -405, 1049, 779, 349, 224, 12, 265, 37, -182, -446, -396, -81, -16, -146,
+ 75, 45, -248, -832, 729, 416, 499, 178, -115, 16, 79, 243, 265, 77, -69, -43,
+ 639, 705, 482, -40, -529, -198, -109, -399, -242, -433, -713, -811, -934, -777, -332, 26,
+ 110, 166, -54, -792, -974, 386, 190, 192, 67, -172, -141, -298, -539, -400, -139, 80,
+ 147, 307, 168, 52, -285, -270, -212, -179, 138, 200, 194, 64, 476, 673, 636, 500,
+ 5, 38, -176, 212, 752, 433, 322, 500, 560, 276, 107, -245, -358, -768, -817, -1065,
+ -233, -294, -581, -1147, -869, 77, 144, 335, 269, 501, 638, 719, 614, 376, 219, 172
+};
+
+/* An 16-by-16 matrix */
+const Word16 SVWB2_SN2_fx[256] = {//Qlog2(2.56)
+ -100, -130, -545, -834, 489, 501, 523, 297, 137, 198, 270, 172, 17, -50, -147, -63,
+ 333, 351, 143, 142, 47, -137, -131, -323, -216, -32, 105, 264, 541, 425, 342, 153,
+ -93, -168, 184, 605, 372, 237, 186, 175, 307, 321, 448, 205, -128, -481, -477, -512,
+ -24, -30, 26, -47, -159, -88, -344, -130, -88, -280, -742, -901, -264, 176, 38, -26,
+ 258, 250, 114, -75, -186, -326, -360, -237, 268, 532, 236, -341, -556, -334, -181, -30,
+ 123, 241, 118, 205, 441, 172, 49, -158, -273, -214, -428, -729, -758, -532, -289, -112,
+ -160, -224, -512, 393, 460, 216, 179, -94, -78, -320, -473, 13, 224, 196, 127, 37,
+ -35, -65, 360, 164, -185, -563, -683, -357, -634, -61, 400, 133, -232, -264, -174, 32,
+ -140, -196, -470, -355, -532, -323, -268, -76, 260, 258, 218, 161, 206, 266, 234, 168,
+ 99, 109, -60, -368, -564, -49, 75, -60, -160, -654, -847, 162, 278, 76, -24, 42,
+ 12, 88, 124, -54, -91, 197, 289, 211, 240, 184, 10, 16, 560, 677, 619, 350,
+ -37, -91, 771, 654, 291, 165, 104, 43, -224, -365, -411, -78, -90, -20, 85, 168,
+ 45, 1, 58, 80, 293, 411, 443, 655, 604, 642, 624, 529, 373, 227, 166, 128,
+ -176, -124, -182, -131, -260, -127, 350, 460, 425, 260, -76, -400, -605, -506, -121, -49,
+ -96, -92, -274, -176, -220, -323, -399, -505, -610, -530, 124, 268, 235, 272, 128, 160,
+ -6, 80, 145, -198, -197, 38, -15, 100, 45, 58, 542, 524, 197, -128, -324, -448
+};
+
+/* SVWB2_AR1 * 2.56f */
+const Word16 SVWB2_AR1_fx[128] = {//Qlog2(2.56)
+ -28, -38, -122, 74, 296, 148, 146, 120, 148, 36, -11, -163, -223, -299, -290, -320,
+ -22, -30, -138, -319, -385, 159, 124, 51, 32, -44, -15, -78, -96, -53, 40, 64,
+ -96, -144, -205, -96, 80, 96, 152, 246, 206, 193, 265, 333, 320, 232, 131, 32,
+ 108, 106, 102, 37, -14, -17, -61, -144, -161, -160, -257, -404, -540, -316, -124, 18,
+ 22, 12, 34, -14, -52, -106, -144, -266, -346, -472, -401, -30, -4, -43, -88, -10,
+ -52, -117, -203, 415, 324, 171, 121, -31, 48, -31, -60, -65, 128, 193, 141, 67,
+ -47, -86, 430, 334, 193, 136, 85, 82, 1, -34, 47, 84, 2, -30, -77, -45,
+ -4, -14, -9, -38, -136, -242, -217, -54, -38, 179, 191, 61, 42, -3, 5, -37
+};
+
+/* SVWB2_AR2 * 2.56f */
+const Word16 SVWB2_AR2_fx[128] = {//Qlog2(2.56)
+ 12, 16, -46, -156, -329, -293, 43, 141, 61, 15, -9, 29, -74, -41, -37, 16,
+ -47, -81, -136, 82, -33, -111, -268, -293, 109, 136, 53, -58, -51, 62, 64, 14,
+ -15, -19, -171, -347, 258, 161, 88, 13, -57, -26, -59, 24, 10, 14, -41, -8,
+ 33, 38, 139, 157, 31, 65, -14, 52, 63, 30, -8, -1, -182, -341, -344, -258,
+ 14, 16, 46, 6, -54, -64, -136, -132, -318, -303, 261, 146, -19, -57, -30, 30,
+ -34, -34, 21, 93, 163, 201, 290, 257, 225, 296, 209, 197, 72, 26, 57, 1,
+ 33, 66, 73, -8, -104, 44, 31, -13, 70, 72, -17, -48, 430, 373, 218, 92,
+ 1, -2, 74, 172, 67, -3, -34, -25, -156, -219, -432, -288, -181, -35, 113, 112
+};
+
+/*----------------------------------------------------------------------------------*
+ * LSF quantization - LSF mode/codebook selection tables
+ *----------------------------------------------------------------------------------*/
+const Word16 CB_lsf[] =
+{
+ -1, /* Mode 0 : INACTIVE NB, Safety net */
+ -1, /* Mode 1 : UNVOICED NB, Safety net */
+ 0, /* Mode 2 : VOICED NB, Safety net */
+ 2, /* Mode 3 : GENERIC NB, Safety net */
+ 2, /* Mode 4 : TRANSITION NB, Safety net */
+ 4, /* Mode 5 : AUDIO NB, Safety net */
+ -1, /* Mode 6 : INACTIVE WB, Safety net */
+ -1, /* Mode 7 : UNVOICED WB, Safety net */
+ 5, /* Mode 8 : VOICED WB, Safety net */
+ 7, /* Mode 9 : GENERIC WB, Safety net */
+ 7, /* Mode 10 : TRANSITION WB, Safety net */
+ 9, /* Mode 11 : AUDIO WB, Safety net */
+ -1, /* Mode 12 : INACTIVE WB16k, Safety net */
+ -1, /* Mode 13 : UNVOICED WB16k, Safety net */
+ 14, /* Mode 14 : VOICED WB16k, Safety net */
+ -1, /* Mode 15 : GENERIC WB 16k, Safety net */
+ 10, /* Mode 16 : TRANSITION WB16k, Safety net */
+ -1, /* Mode 17 : AUDIO WB16k, Safety net */
+ 13 /* Mode 18 : CNG, Safety net */
+}; // Q0
+
+const Word16 CB_p_lsf[] =
+{
+ 0, /* Mode 0 : INACTIVE NB, Predictive */
+ 1, /* Mode 1 : UNVOICED NB, Predictive */
+ 4, /* Mode 2 : VOICED NB, Predictive */
+ 4, /* Mode 3 : GENERIC NB, Predictive */
+ -1, /* Mode 4 : TRANSITION NB, Predictive */
+ -1, /* Mode 5 : AUDIO NB, Predictive */
+ 0, /* Mode 6 : INACTIVE WB, Predictive */
+ 1, /* Mode 7 : UNVOICED WB, Predictive */
+ 6, /* Mode 8 : VOICED WB, Predictive */
+ 6, /* Mode 9 : GENERIC WB, Predictive */
+ -1, /* Mode 10 : TRANSITION WB, Predictive */
+ -1, /* Mode 11 : AUDIO WB, Predictive */
+ 0, /* Mode 12 : INACTIVE WB16k, Predictive */
+ -1, /* Mode 13 : UNVOICED WB16k, Predictive */
+ 11, /* Mode 14 : VOICED WB16k, Predictive */
+ 8, /* Mode 15 : GENERIC WB16k, Predictive */
+ -1, /* Mode 16 : TRANSITION WB16k, Predictive */
+ 10, /* Mode 17 : AUDIO WB16k, Predictive */
+ 9, /* Mode 18 : GENERIC WB, MA Predictive */
+}; // Q0
+
+
+const Word16 *const ModeMeans_fx[] = { IANB_Ave_fx, UVNB_Ave_fx, SVNB_Ave_fx, GENB_Ave_fx, TRNB_Ave_fx, AUNB_Ave_fx, IAWB_Ave_fx, UVWB_Ave_fx,
+ SVWB_Ave_fx, GEWB_Ave_fx, TRWB_Ave_fx, AUWB_Ave_fx, IAWB2_Ave_fx, NULL, SVWB2_Ave_fx, GEWB2_Ave_fx, TRWB2_Ave_fx, AUWB2_Ave_fx
+}; //Qlog2(2.56)
+const Word16 * const Predictors_fx[] = { Predictor6_fx, NULL, Predictor1_fx, Predictor3_fx, NULL, Predictor6_fx,Predictor5_fx, NULL, Predictor0_fx,
+ Predictor2_fx, NULL, Predictor5_fx, Predictor7_fx, NULL, Predictor8_fx, Predictor4_fx, NULL, Predictor7_fx
+}; // Q15
+
+const Word16 CBsizes[] =
+{
+ 1,2,4,8,16,32,64
+}; // Q0
+
+
+const Word16 CBbits[] =
+{
+ -1, /* Mode 0 : INACTIVE NB, Safety net */
+ -1, /* Mode 1 : UNVOICED NB, Safety net */
+ 4, /* Mode 2 : VOICED NB, Safety net */
+ 5, /* Mode 3 : GENERIC NB, Safety net */
+ 5, /* Mode 4 : TRANSITION NB, Safety net */
+ 4, /* Mode 5 : AUDIO NB, Safety net */
+ -1, /* Mode 6 : INACTIVE WB, Safety net */
+ -1, /* Mode 7 : UNVOICED WB, Safety net */
+ 4, /* Mode 8 : VOICED WB, Safety net */
+ 5, /* Mode 9 : GENERIC WB, Safety net */
+ 5, /* Mode 10 : TRANSITION WB, Safety net */
+ 4, /* Mode 11 : AUDIO WB, Safety net */
+ -1, /* Mode 12 : INACTIVE WB16k, Safety net */
+ -1, /* Mode 13 : UNVOICED WB16k, Safety net */
+ 4, /* Mode 14 : VOICED WB16k, Safety net */
+ -1, /* Mode 15 : GENERIC WB16k, Safety net */
+ 4, /* Mode 16 : TRANSITION WB16k, Safety net */
+ -1, /* Mode 17 : AUDIO WB16k, Safety net */
+ 4, /* Mode 18: CNG, Safety net */
+}; // Q0
+
+
+const Word16 CBbits_p[] =
+{
+ 5, /* Mode 0 : INACTIVE NB, Predictive */
+ 4, /* Mode 1 : UNVOICED NB, Predictive */
+ 3, /* Mode 2 : VOICED NB, Predictive */
+ 3, /* Mode 3 : GENERIC NB, Predictive */
+ -1, /* Mode 4 : TRANSITION NB, Predictive */
+ 0, /* Mode 5 : AUDIO NB, Predictive */
+ 5, /* Mode 6 : INACTIVE WB, Predictive */
+ 4, /* Mode 7 : UNVOICED WB, Predictive */
+ 3, /* Mode 8 : VOICED WB, Predictive */
+ 3, /* Mode 9 : GENERIC WB, Predictive */
+ -1, /* Mode 10 : TRANSITION WB, Predictive */
+ 0, /* Mode 11 : AUDIO WB, Predictive */
+ 5, /* Mode 12 : INACTIVE WB16k, Predictive */
+ -1, /* Mode 13 : UNVOICED WB16k, Predictive */
+ 3, /* Mode 14 : VOICED WB16k, Predictive */
+ 5, /* Mode 15 : GENERIC WB16k, Predictive */
+ -1, /* Mode 16 : TRANSITION WB16k, Predictive */
+ 5, /* Mode 17 : AUDIO WB16k, Predictive */
+ 5, /* Mode 9 : GENERIC WB, Predictive */
+}; // Q0
+
+
+
+const Word16 BitsVQ[]=
+{
+ -1, /* Mode 0 : INACTIVE NB, Safety net */
+ -1, /* Mode 1 : UNVOICED NB, Safety net */
+ 8, /* Mode 2 : VOICED NB, Safety net */
+ 9, /* Mode 3 : GENERIC NB, Safety net */
+ 9, /* Mode 4 : TRANSITION NB, Safety net */
+ 4, /* Mode 5 : AUDIO NB, Safety net */
+ -1, /* Mode 6 : INACTIVE WB, Safety net */
+ -1, /* Mode 7 : UNVOICED WB, Safety net */
+ 8, /* Mode 8 : VOICED WB, Safety net */
+ 9, /* Mode 9 : GENERIC WB, Safety net */
+ 9, /* Mode 10 : TRANSITION WB, Safety net */
+ 4, /* Mode 11 : AUDIO WB, Safety net */
+ -1, /* Mode 12 : INACTIVE WB16k, Safety net */
+ -1, /* Mode 13 : UNVOICED WB16k, Safety net */
+ 8, /* Mode 14 : VOICED WB16k, Safety net */
+ -1, /* Mode 15 : GENERIC WB16k, Safety net */
+ 8, /* Mode 16 : TRANSITION WB16k, Safety net */
+ -1, /* Mode 17 : AUDIO WB16k, Safety net */
+ 4, /* Mode 18: CNG, Safety net */
+}; // Q0
+
+
+const Word16 BitsVQ_p[]=
+{
+ 5, /* Mode 0 : INACTIVE NB, Predictive */
+ 8, /* Mode 1 : UNVOICED NB, Predictive */
+ 6, /* Mode 2 : VOICED NB, Predictive */
+ 6, /* Mode 3 : GENERIC NB, Predictive */
+ -1, /* Mode 4 : TRANSITION NB, Predictive */
+ 0, /* Mode 5 : AUDIO NB, Predictive */
+ 5, /* Mode 6 : INACTIVE WB, Predictive */
+ 12, /* Mode 7 : UNVOICED WB, Predictive */
+ 6, /* Mode 8 : VOICED WB, Predictive */
+ 6, /* Mode 9 : GENERIC WB, Predictive */
+ -1, /* Mode 10 : TRANSITION WB, Predictive */
+ 0, /* Mode 11 : AUDIO WB, Predictive */
+ 5, /* Mode 12 : INACTIVE WB16k, Predictive */
+ -1, /* Mode 13 : UNVOICED WB16k, Predictive */
+ 6, /* Mode 14 : VOICED WB16k, Predictive */
+ 5, /* Mode 15 : GENERIC WB16k, Predictive */
+ -1, /* Mode 16 : TRANSITION WB16k, Predictive */
+ 5, /* Mode 17 : AUDIO WB16k, Predictive */
+ 5, /* Mode 18 : GENERIC WB, MA Predictive */
+}; // Q0
+
+
+const Word16 predmode_tab_float[][6] =
+{
+ {1,1,2,2,0,2},
+ {1,1,2,2,0,2},
+ {1,-1,2,1,0,1},
+ {1,1,2,1,0,1} /* should check how is the cb for audio mode at 13.2*/
+};
+
+const Word16 predmode_tab[][6] =
+{
+ {1,1,2,2,0,2},
+ {1,1,2,2,0,2},
+ {1,-1,2,1,0,1},
+ {1,1,2,1,0,2} /* should check how is the cb for audio mode at 13.2*/
+}; // Q0
+
+
+const Word16 SVNB_SN1_fx[256] =
+{//Qlog2(2.56)
+ 135, 109, 135, -153, -549, 214, 416, 195, 291, 247, 100, -127, -579, -160, -66, -32,
+ -107, -150, -274, -149, 642, 594, 338, 183, 81, -31, -14, -150, -387, -40, -44, -18,
+ 73, 42, 171, 339, 213, 42, -137, -277, -379, -441, -440, -478, 270, 126, -4, 6,
+ -307, -479, -636, -596, -100, 83, 167, 200, 260, 376, 523, 1051, 1142, 490, 249, 108,
+ -148, -215, -324, -570, -917, -685, -208, 127, 285, 353, 441, 940, 1100, 458, 229, 100,
+ 427, 432, 548, 426, 133, 13, -9, -141, -108, -144, -195, -419, -733, -144, -109, -45,
+ -115, -220, -194, 661, 896, 688, 489, 351, 211, 258, 147, 30, -746, -784, -156, -95,
+ 16, -48, -88, -430, -798, 36, 204, 68, 174, 162, 20, 61, 627, 266, 102, 48,
+ -252, -370, -630, -614, 680, 1024, 869, 598, 419, 259, 193, 27, 90, 156, 53, 27,
+ -48, 33, 26, -227, -556, -766, -391, 231, 413, 282, 226, 89, 194, 187, 44, 30,
+ -204, -291, -345, -131, 125, 72, 16, -29, -106, -49, -27, 183, 714, 277, 114, 49,
+ -11, 205, 285, 69, -58, -207, -301, -160, -30, -2, 12, -99, -580, -178, -80, -41,
+ 120, 189, 281, 427, 234, 138, 124, 126, 50, 205, 121, 76, -797, -1204, -235, -133,
+ 63, -18, 146, 666, 480, 236, 134, -39, -97, -130, -175, -378, -746, -159, -106, -46,
+ 386, 399, 415, 157, -175, -282, -315, -318, -222, -225, -267, -342, 317, 152, 15, 14,
+ 39, 56, 71, -95, -387, -509, -595, -466, -395, -186, -24, 421, 814, 292, 127, 52
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 SVNB_SN2_fx[256] =
+{//Qlog2(2.56)
+ -16, 111, 111, -89, -115, -404, -514, 162, 277, 41, -94, -89, 15, 31, 2, 2,
+ -82, -99, -25, -287, -464, 204, 18, -123, -38, 56, 109, 198, 160, 96, 41, 19,
+ -95, -62, -242, -415, 318, 118, -121, 44, 74, 40, 85, 114, 52, 36, 21, 8,
+ 29, 40, 43, 23, -202, -149, 288, 149, -20, -109, -186, -275, -127, 18, -25, -6,
+ 20, 36, -97, -228, 565, 508, 134, 42, -70, -237, -258, -259, -123, -9, -29, -10,
+ -72, -169, 492, 463, 193, 204, -13, -75, -82, -125, -181, -230, -181, -10, -40, -12,
+ -108, -221, -229, 648, 575, 288, 146, 1, -14, -4, -51, -120, -81, -14, -17, -5,
+ -199, -264, -309, 209, 8, -128, 24, -47, 87, 257, 240, 185, 93, 70, 34, 16,
+ 25, 82, -60, -155, -407, -615, 29, 100, -113, 32, 207, 258, 203, 111, 49, 21,
+ 37, 127, 95, 4, 112, -45, -217, -158, -277, -407, -304, -152, 72, 52, -6, 0,
+ -30, -81, -116, -416, -219, 677, 538, 328, 213, 60, -60, -109, -78, 0, -5, 0,
+ 9, -15, 26, 75, -175, -336, -673, -586, 238, 310, 198, 189, 212, 126, 48, 24,
+ -18, -4, -80, 102, 130, -116, -268, -471, -567, -104, 205, 221, 143, 81, 29, 12,
+ 4, 39, 65, 115, 88, 189, 136, 124, 49, 106, 37, 89, -375, -626, -114, -73,
+ 540, 525, 472, 221, 118, -31, 15, 7, -71, -139, -108, -93, -13, -4, -13, -8,
+ -44, -44, -143, -272, -525, -365, 479, 502, 312, 225, 161, 72, 28, 42, 26, 12
+};
+
+const Word16 GETRNB_SN1_fx[512] =
+{//Qlog2(2.56)
+ -119, -271, -427, 447, 321, 58, 37, -105, -65, 99, 106, 21, -277, 53, 9, -6,
+ -93, -241, -433, -826, -1028, 17, 180, 138, 320, 234, 152, 235, 973, 594, 199, 96,
+ -300, -474, -553, -497, -374, -231, -224, -170, -145, 51, 154, 714, 1338, 690, 271, 118,
+ -115, -228, -248, 9, -27, -196, -240, -269, -293, -310, -276, -254, 769, 481, 117, 59,
+ 172, 58, 469, 585, 512, 336, 145, -52, -167, -344, -379, -487, 285, 377, 27, 27,
+ 81, 34, 574, 859, 818, 702, 521, 344, 177, 23, -116, -274, -611, -78, -61, -35,
+ 76, 19, -104, -388, -687, 54, 279, 144, 237, 223, 110, 9, -335, 4, 3, -10,
+ 115, 380, 486, 446, 389, 316, 239, 249, 197, 207, 162, 141, -435, -1516, -409, -136,
+ -146, -348, -425, 645, 998, 790, 609, 468, 282, 287, 153, 87, -461, -592, -88, -64,
+ -249, -471, -835, -642, 589, 960, 887, 637, 442, 286, 242, 132, 142, 299, 99, 44,
+ 128, 37, -120, -314, -571, -730, -868, -558, -259, -109, 8, 413, 1145, 593, 210, 92,
+ 151, 331, 267, 130, -24, -89, -133, -43, -75, 57, 19, 94, -469, -796, -124, -90,
+ -339, -468, -292, -34, 76, 179, 231, 269, 259, 281, 275, 204, -93, 157, 53, 16,
+ 33, 176, 25, -201, -311, -497, -509, -242, -47, 6, 86, 48, -165, 176, 24, 8,
+ 27, 223, 461, 500, 479, 475, 489, 560, 635, 741, 924, 1347, 1546, 806, 277, 54,
+ 510, 464, 402, 114, -80, -285, -290, -321, -283, -368, -325, -424, 388, 402, 52, 38,
+ 521, 614, 732, 549, 428, 278, 180, 81, 14, -110, -204, -355, -649, -32, -56, -36,
+ 72, 26, 262, 263, 159, 113, 60, -10, -73, -121, -201, -329, -768, -61, -60, -39,
+ 85, 57, 116, -40, -78, -159, -154, -247, -220, -366, -331, -532, -35, 344, 0, 25,
+ 527, 919, 1339, 1225, 1190, 1023, 774, 577, 393, 160, -4, -184, -281, 29, -21, -12,
+ -230, -283, -338, -379, -313, -293, -163, -122, 15, 97, 243, 168, 361, 449, 102, 61,
+ 378, 369, 369, 136, 42, -72, -73, -154, -155, -260, -270, -444, -562, 173, -36, -9,
+ 168, 108, -36, -347, -559, -436, -254, -263, -236, -227, -247, -238, 796, 488, 123, 62,
+ -151, -118, 163, 452, 430, 484, 456, 418, 377, 363, 256, 183, -403, -1429, -382, -126,
+ -204, -366, -652, -512, 428, 353, 182, 88, -10, -94, -54, -11, 801, 527, 151, 76,
+ 60, 79, -169, -465, -789, -844, -55, 181, 209, 172, 210, 107, 260, 399, 91, 52,
+ -69, -205, -377, -164, 647, 584, 302, 151, 32, -135, -136, -223, -269, 170, 4, 5,
+ 38, 418, 885, 979, 990, 1027, 870, 804, 669, 537, 360, 241, -336, -1281, -338, -111,
+ -420, -700, -912, -622, -337, -51, 67, 173, 326, 554, 766, 1395, 1656, 894, 390, 178,
+ -141, -252, -507, -822, -1084, -845, -280, 20, 149, 242, 393, 951, 1428, 740, 303, 135,
+ -120, -37, 31, 105, 72, 99, 53, 117, 59, 171, 120, 177, -414, -993, -160, -98,
+ -382, -612, -631, -167, 4, 104, 130, 141, 242, 325, 348, 430, 1048, 651, 222, 109
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 GETRNB_SN2_fx[256] =
+{//Qlog2(2.56)
+ -27, 71, 45, -4, 28, 69, 25, 94, 45, 90, 45, 87, -177, -567, -116, -59,
+ -208, -147, 531, 399, 199, 113, -21, -28, -34, -38, -48, -46, -47, 18, -1, -1,
+ 69, -20, -115, -355, -380, 388, 379, 193, 134, 37, -42, -60, -35, 29, 6, 5,
+ 107, 89, -98, -189, 379, 289, 68, 22, -71, -179, -187, -192, -137, 4, -17, -7,
+ -44, -81, -371, -448, 226, 75, -52, 43, 40, 36, 79, 120, 130, 76, 36, 15,
+ 131, 115, 192, 177, 25, -7, -23, -95, -132, -184, -206, -245, -200, -12, -29, -11,
+ 45, -25, -249, 50, -189, -358, 253, 145, -39, 27, 34, -20, -52, 13, 1, 2,
+ -254, -155, 23, -89, -30, 23, -23, -21, -45, -86, -92, -109, -48, 52, 3, 3,
+ -248, -233, 139, 213, 232, 361, 349, 401, 373, 301, 230, 207, 204, 101, 32, 14,
+ 491, 546, 409, 147, 34, -18, 52, 59, 48, 27, 14, 7, -1, -37, -16, -9,
+ 36, 41, 0, -21, -29, -64, -207, -346, -516, -355, -64, 73, 156, 94, 30, 11,
+ -28, -173, -278, 506, 427, 164, 111, 21, -33, -61, -78, -90, -32, 39, 4, 4,
+ -44, -60, -215, -373, -485, -270, 12, 151, 271, 265, 215, 178, 153, 71, 32, 17,
+ 110, 155, -29, -259, -218, -183, -175, -132, -85, -98, -87, -93, -77, 0, -9, -4,
+ -116, -14, 235, 1, -238, -398, -419, -55, 109, 77, 62, 74, 73, 47, 16, 8,
+ -20, -108, -219, 246, 20, -184, -328, -449, -67, 142, 125, 110, 91, 74, 28, 13
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 AUNB_SN1_fx[256] =
+{//Qlog2(2.56)
+ -180, -79, -51, 39, 66, 99, 48, 108, 56, 127, 34, 46, -470, -845, -141, -90,
+ -212, 82, 284, 422, 416, 416, 313, 289, 233, 210, 108, 55, -439, -1323, -336, -123,
+ -9, 405, 532, 659, 710, 798, 844, 971, 1072, 1181, 1464, 1913, 2028, 1232, 549, 265,
+ 75, 49, 330, 493, 448, 329, 204, 67, -18, -134, -235, -400, -605, -30, -67, -36,
+ -9, -7, -95, -222, -322, -421, -321, -233, -110, -86, 67, -19, 3, 345, 41, 30,
+ 153, 34, -172, -386, -500, -548, -503, -420, -317, -207, -114, 183, 1096, 661, 198, 94,
+ 616, 501, 471, 220, 157, 55, 4, -161, -178, -314, -267, -389, 216, 429, 46, 38,
+ -559, -854, -789, -369, -153, 64, 146, 296, 388, 520, 574, 958, 1481, 898, 340, 164,
+ 131, 137, 116, 57, 64, -21, -38, -112, -123, -199, -214, -379, -641, 83, -53, -21,
+ -101, -324, -648, -801, -835, -737, -501, -296, -86, 144, 400, 1025, 1501, 861, 322, 151,
+ -231, -397, -512, -506, -308, -200, -127, -91, -18, 17, 94, 114, 798, 625, 161, 88,
+ -518, -617, -201, 103, 258, 279, 273, 267, 281, 251, 214, 114, 58, 270, 70, 31,
+ 17, -86, -78, -82, -22, -73, -171, -299, -334, -431, -422, -526, 517, 511, 71, 53,
+ 276, 182, -40, -336, -461, -93, 342, 267, 166, 18, -43, -196, -146, 236, 18, 14,
+ 227, 338, 224, 188, 107, 80, 57, 92, 34, 80, -5, -4, -515, -927, -174, -100,
+ 731, 744, 797, 675, 590, 438, 328, 215, 144, 24, -96, -239, -486, -175, -65, -41
+};
+
+const Word16 SVWB_SN1_fx[256] =
+{//Qlog2(2.56)
+ -71, -61, -170, -563, -962, -845, 186, 421, 282, 344, 260, 155, 186, 52, -18, -11,
+ -107, -139, -289, -270, 788, 615, 249, 174, -1, -24, 159, 106, -46, -183, -187, -107,
+ -144, -221, -215, 359, 192, -34, -186, -326, -256, -124, -49, 84, 214, 237, 186, 91,
+ 218, 332, 335, 41, -191, -394, -614, -543, -415, -379, -285, -153, -86, -101, -69, -13,
+ 587, 616, 732, 419, 270, 252, 102, 40, 53, -35, -57, -34, 19, -14, -15, -120,
+ -76, -222, -127, 1216, 1188, 815, 532, 320, 311, 228, 34, -59, -96, -86, -44, -38,
+ -176, -282, -507, -455, 1122, 1359, 965, 742, 610, 448, 474, 412, 185, 127, 127, -24,
+ -156, -225, 16, 458, 423, 438, 393, 400, 525, 658, 682, 681, 612, 438, 267, 68,
+ 89, 120, 172, 355, 195, -8, -22, -67, -110, -40, -93, -163, -382, -685, -926, -468,
+ -227, -362, -452, -577, -213, -22, 56, 82, 132, 216, 348, 420, 358, 299, 257, 143,
+ 38, -77, 117, 856, 486, 282, 16, -154, -130, -315, -618, -783, -892, -545, -88, 59,
+ 218, 324, 232, -162, -583, -552, 126, 62, -40, -27, -227, -348, -334, -324, -238, -65,
+ 82, 16, -20, -539, -787, 604, 340, 259, 260, -53, -251, -211, -12, 127, 171, 99,
+ -24, 168, 202, -142, -223, -448, -282, 122, 148, 155, 363, 380, 347, 263, 124, -68,
+ 165, 150, 226, 95, -172, -257, -413, -510, -533, -734, -1014, -1206, -834, -162, 6, 97,
+ -78, -72, -81, -322, -605, -731, -740, -564, -356, -219, -151, 11, 200, 237, 212, 170
+};
+
+const Word16 SVWB_SN2_fx[256] =
+{//Qlog2(2.56)
+ -126, -152, -342, -423, 311, 95, 3, 29, -93, 4, 227, 193, 142, 120, 93, 62,
+ 190, 258, 382, 310, 166, -11, -77, -67, -217, -327, -330, -378, -461, -309, -142, -47,
+ -16, -58, -77, -339, -534, 469, 399, 237, 290, 135, 34, 86, -14, -77, -30, 10,
+ 13, -4, 644, 572, 412, 438, 272, 286, 234, 177, 118, 147, 131, 138, 127, 38,
+ -73, -88, -112, 42, 36, 141, 424, 386, 504, 576, 523, 483, 431, 328, 233, 59,
+ -120, -169, -270, -445, -593, -268, -133, -138, -11, 56, 133, 210, 166, 116, 122, 137,
+ 282, 370, 255, 76, -89, -191, 139, 80, 12, 176, 185, 145, 244, 253, 173, -18,
+ 13, 14, -43, 73, -59, -270, -448, -622, -59, 374, 353, 293, 189, -54, -199, -122,
+ -75, -106, -281, -312, 585, 405, 185, 62, -176, -319, -330, -400, -418, -162, -4, 78,
+ -31, -11, -79, -83, -88, -274, -343, -431, -623, -518, -148, -11, -17, -21, 21, 90,
+ -101, -173, -240, 444, 303, 121, 104, -37, 185, 134, -45, -136, -164, 4, 153, 114,
+ -8, 40, 107, -76, -254, -551, -673, 288, 318, 25, 14, -62, -97, -2, 13, -20,
+ 87, 127, 80, 216, 336, 147, 188, 165, -10, 125, 193, 87, -126, -396, -736, -669,
+ 2, 4, 96, 185, 6, 62, -37, -136, -177, -250, -227, 201, 744, 651, 351, 74,
+ -16, -39, -82, -177, -380, -183, -24, -109, -194, -407, -641, -615, -157, 146, 191, 167,
+ -21, -12, -39, -63, -159, -128, 20, 6, 16, 39, -60, -243, -594, -733, -364, 46
+};
+
+const Word16 GETRWB_SN1_fx[512] =
+{//Qlog2(2.56)
+ -232, -191, 282, 248, 344, 390, 428, 490, 538, 592, 620, 607, 533, 372, 261, 136,
+ -59, -227, -418, -288, -247, -448, -501, -644, -760, -922, -1112, -1204, -523, -130, 12, 131,
+ 139, 838, 1402, 1327, 1465, 1391, 1371, 1342, 1220, 1147, 1041, 910, 733, 518, 335, 181,
+ 211, 148, -94, -275, -484, -586, -541, -634, -583, -511, -424, -322, -285, -299, -194, -87,
+ 410, 362, 337, 73, -36, -113, -180, -274, -373, -493, -501, -473, -393, -361, -271, -251,
+ -85, -366, -819, -532, 753, 688, 414, 203, 24, -43, 129, 60, -100, -123, -97, -114,
+ 4, 37, 484, 514, 340, 225, 89, 59, 40, 3, -5, -1, -11, -49, -43, -48,
+ -223, -471, -661, -567, -496, -519, -464, -542, -484, -343, -276, -185, -43, 17, 84, 133,
+ -106, -312, -668, -741, 385, 329, 121, -157, -423, -710, -957, -1280, -1143, -330, -20, 131,
+ 250, 157, 71, -310, -552, -740, -745, -778, -827, -1064, -1336, -1629, -788, -195, -44, 131,
+ 140, 633, 970, 864, 867, 761, 683, 648, 572, 544, 516, 469, 383, 238, 143, 55,
+ 116, 143, 229, 134, -25, -120, -232, -333, -535, -642, -985, -1259, -1873, -1727, -330, -10,
+ -64, -82, -62, -232, -308, -346, -296, -272, -153, -26, 108, 205, 232, 158, 129, 53,
+ 82, -92, -309, -791, -1128, -259, -243, -405, -367, -637, -903, -1084, -675, -199, 17, 146,
+ -247, -569, -886, -758, -334, -206, -158, -150, -64, 57, 190, 252, 261, 210, 163, 129,
+ -23, -319, -458, 791, 718, 400, 233, -81, -174, -400, -758, -1048, -1338, -1038, -288, -6,
+ 50, 462, 303, -47, -122, -134, 15, 137, 179, 222, 266, 249, 219, 123, 80, 30,
+ -116, -332, -650, -1104, -1367, -691, -376, -295, -178, -199, -170, -24, 125, 95, 125, 168,
+ -66, -314, -526, 325, 156, -56, -114, -287, -126, -185, -292, -298, -189, -81, 1, 23,
+ 147, -30, -291, -771, -939, 262, 182, 126, 127, -100, -163, -134, -91, -95, -52, -19,
+ -225, -496, -449, -61, 46, 135, 182, 247, 324, 404, 457, 464, 420, 305, 209, 106,
+ 418, 312, 415, 74, -156, -345, -400, -634, -769, -1057, -1362, -1841, -1848, -471, -147, 87,
+ 38, 19, -232, -552, -698, -941, -483, 119, 54, -34, 70, -68, -144, -192, -253, -236,
+ 80, -30, -214, -157, -292, -312, -283, -347, -384, -372, -487, -503, -746, -950, -1372, -644,
+ 44, 55, 124, 181, 125, 109, 61, 29, -73, -54, -206, -278, -638, -929, -1563, -1742,
+ 802, 823, 726, 353, 272, 122, 117, 94, 80, 40, 68, 47, 42, -19, -26, -69,
+ 50, -97, -306, -666, -918, -1109, -1124, -776, -710, -728, -675, -486, -150, -3, 93, 160,
+ 81, -144, -131, 319, 227, -96, -236, -517, -711, -949, -1231, -1644, -1625, -444, -117, 86,
+ -230, -237, 586, 799, 931, 1023, 1077, 1179, 1133, 1101, 1027, 909, 731, 515, 330, 171,
+ 448, 632, 1047, 782, 631, 390, 155, -82, -342, -685, -1103, -1520, -1779, -931, -214, 34,
+ -77, -352, -353, 787, 938, 677, 513, 352, 284, 278, 247, 181, 141, 73, 8, -39,
+ 54, 42, -67, -298, -465, -593, -533, -547, -626, -741, -977, -1317, -1665, -613, -119, 80
+};
+
+const Word16 GETRWB_SN2_fx[256] =
+{//Qlog2(2.56)
+ -202, -246, -356, -356, -232, -164, -79, 4, 78, 130, 152, 165, 170, 141, 90, 70,
+ 38, 78, -72, -185, -446, -552, 269, 295, 104, 77, -54, -184, -168, -72, -32, -2,
+ 69, 93, 39, 116, 100, 46, 50, -1, -2, 62, 8, -105, -404, -656, -494, -224,
+ -285, -305, 263, 97, 29, 33, -24, 54, 35, 25, -4, -6, -30, 13, 20, 21,
+ -28, -70, -160, 34, 5, -145, -264, -425, -539, -329, -19, 228, 411, 280, 141, 51,
+ 244, 245, 19, -319, -461, -184, -10, 47, 220, 293, 309, 330, 281, 140, 71, 12,
+ -128, -251, -374, 424, 279, 68, 35, -68, 13, 45, -6, -41, -73, -17, 8, 27,
+ -55, -7, 438, 500, 493, 442, 286, 211, 68, -39, -117, -167, -180, -131, -75, -63,
+ 30, 31, 69, 114, -172, -407, -596, -391, 102, 169, 158, 131, 46, 4, -6, -3,
+ 69, 76, 33, 238, 164, 119, 160, 165, 273, 342, 383, 419, 456, 378, 262, 96,
+ -55, 43, -59, -273, -200, -286, -287, -221, -247, -245, -194, -160, -129, -36, -31, 3,
+ -35, -46, -272, -357, 484, 246, -11, 21, -123, -197, -102, -94, -96, -22, 6, 6,
+ -117, -188, -252, -227, 0, 460, 506, 526, 501, 389, 250, 131, -28, -32, 24, 17,
+ 399, 511, 390, 146, 80, -84, -81, -57, -123, -138, -95, -82, -51, -33, -14, -45,
+ -9, 12, 300, 304, 182, 27, -197, -258, -344, -393, -384, -318, -140, -5, -6, 6,
+ 64, 25, -7, -256, -306, 381, 243, 96, -17, -190, -285, -246, -65, 48, 37, 29
+};
+
+const Word16 AUWB_SN1_fx[256] =
+{//Qlog2(2.56)
+ 328, 137, 358, 330, 184, 145, -60, -294, -555, -784, -945, -872, -601, -337, -155, -33,
+ 32, -212, -488, -651, -752, -877, -892, -886, -853, -795, -705, -549, -330, -224, -127, -9,
+ 372, 327, 197, 33, 13, -55, -87, -124, -125, -148, -144, -168, -175, -184, -127, -125,
+ 752, 727, 623, 519, 449, 350, 309, 289, 272, 252, 185, 124, 118, 35, 22, -20,
+ 14, 144, 296, 432, 416, 325, 177, 166, 151, 123, 109, 104, 47, -22, -45, -49,
+ 310, 112, -141, -529, -654, -53, 162, -33, -297, -551, -772, -817, -540, -287, -95, -7,
+ -158, 241, 443, 543, 559, 579, 566, 606, 610, 622, 602, 578, 485, 331, 197, 104,
+ -471, -530, 37, 272, 397, 442, 466, 523, 561, 592, 608, 576, 485, 348, 222, 133,
+ 162, 0, -87, -85, -151, -331, -410, -603, -767, -1030, -1348, -1812, -1735, -678, -284, -6,
+ -156, 36, 15, 26, 41, 118, 201, 265, 339, 382, 420, 435, 377, 264, 159, 84,
+ -69, -274, -411, -158, 60, -56, -190, -305, -371, -389, -411, -407, -338, -276, -173, -99,
+ 0, -26, -196, -379, -369, -327, -193, -148, -77, -10, 63, 98, 98, 49, 40, -5,
+ -149, -432, -729, -923, -927, -766, -568, -455, -333, -219, -122, -29, 11, 9, 20, 54,
+ 177, 64, -60, -232, -411, -552, -557, -550, -509, -464, -380, -331, -297, -288, -215, -170,
+ -16, 439, 971, 1104, 1209, 1323, 1339, 1374, 1317, 1223, 1107, 983, 781, 535, 315, 151,
+ -432, -727, -686, -340, -156, -40, 18, 102, 169, 257, 306, 335, 296, 213, 137, 97
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 TRWB2_SN1_fx[256] =
+{//Qlog2(2.56)
+ -74, -384, -764, -964, -1122, -912, -819, -740, -728, -572, -379, -317, -250, -51, -67, 85,
+ -311, -618, -439, -108, 156, 257, 404, 543, 643, 729, 732, 572, 446, 329, 236, 164,
+ 523, 1549, 1557, 1476, 1374, 1192, 1068, 923, 901, 788, 717, 401, 262, 6, -100, -368,
+ -13, -80, -189, -386, -486, -357, -216, -63, 65, 189, 248, 194, 218, 219, 205, 169,
+ -104, -519, -772, 492, 224, 18, -203, -244, -126, -220, -362, -417, -271, -71, -34, -50,
+ -202, 124, 811, 975, 1326, 1468, 1613, 1527, 1474, 1366, 1220, 906, 700, 509, 351, 207,
+ -57, -196, -238, -281, -267, -239, -190, -137, -27, 4, 77, -178, -256, -553, -669, -1105,
+ -183, -211, 804, 789, 685, 529, 479, 403, 371, 313, 279, 49, -19, -156, -179, -335,
+ 758, 848, 608, 313, 271, 176, 177, 73, 106, 61, 59, -159, -203, -287, -268, -343,
+ 199, 70, 95, -29, -245, -411, -745, -1009, -1473, -1921, -2633, -1648, -537, -284, -87, 207,
+ 82, -217, -460, -646, -718, -821, -983, -1282, -1580, -2108, -1863, -609, -407, -122, -50, 243,
+ -132, 364, 364, 340, 489, 496, 596, 606, 704, 756, 777, 616, 521, 409, 305, 211,
+ 123, -189, -91, -306, -319, -407, -600, -679, -911, -855, -566, -249, -65, -1, -65, -25,
+ 79, -58, -103, -150, -268, -265, -426, -479, -614, -671, -1005, -1378, -2027, -1547, -568, -52,
+ -275, -669, -1070, -1097, -688, -433, -340, -148, -27, 194, 309, 277, 229, 188, 82, 127,
+ 397, 1343, 1482, 1729, 1978, 2012, 1969, 1852, 1729, 1574, 1407, 1087, 848, 636, 431, 278
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 TRWB2_SN2_fx[256] =
+{//Qlog2(2.56)
+ 50, -66, -486, -850, 504, 345, 261, 10, -207, -218, -174, -18, 72, 69, 3, 24,
+ -171, -439, -632, 390, 143, -89, -292, -314, -227, -157, 33, 181, 185, 204, 128, 167,
+ 458, 459, 78, -250, -365, -381, -353, -382, -327, -284, -191, -18, 3, 37, 29, 95,
+ -169, -227, -423, -448, -485, -426, -364, -284, -238, -184, -228, -190, -145, 17, 65, 145,
+ -4, -120, -170, -333, -677, -782, -719, -391, -112, 232, 464, 392, 275, 215, 121, 139,
+ -94, -130, 453, 295, -45, -286, -444, -473, -519, -428, -268, -40, -12, 46, 39, 118,
+ -189, -245, 805, 815, 518, 293, 162, 110, -67, -158, -223, -120, -36, 15, 26, 60,
+ 23, 130, 107, 0, -31, -66, 33, 22, 101, -10, -32, -232, -281, -590, -672, -1089,
+ 51, 106, 157, 132, 40, 11, -73, -66, -165, -294, -561, -770, -742, -489, -202, 4,
+ 25, 230, 286, 179, 75, 18, 15, 24, 109, 187, 310, 334, 328, 291, 237, 212,
+ -238, -492, -550, 563, 764, 610, 542, 427, 373, 261, 166, 171, 122, 34, -21, -92,
+ -359, -462, -10, 22, -42, -2, 78, 167, 154, 155, 74, 73, 66, 94, 89, 126,
+ -5, -110, -374, -546, -386, -136, 95, 305, 437, 570, 615, 558, 463, 335, 209, 151,
+ 23, 376, 292, 235, 485, 519, 657, 549, 478, 338, 186, 7, -28, -155, -95, -188,
+ 166, 139, -277, -716, -822, 234, 319, 326, 234, 36, -155, -317, -247, -80, 49, 117,
+ 431, 853, 745, 512, 325, 139, 83, -31, -25, -47, -17, -12, -24, -43, -5, 13
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 AUWB2_SN1_fx[256] =
+{//Qlog2(2.56)
+ -107, -446, -835, -1041, -1152, -1161, -1146, -969, -828, -533, -251, -242, -139, 172, 95, 466,
+ 1052, 1008, 1052, 875, 864, 748, 783, 690, 754, 715, 688, 342, 195, -32, -251, -509,
+ -311, -170, 366, 632, 748, 863, 983, 1042, 1118, 1188, 1133, 895, 728, 621, 460, 418,
+ 608, 525, 322, 30, -237, -483, -862, -1178, -1651, -2184, -2770, -1349, -430, -28, 128, 562,
+ 296, 171, -192, -429, -488, -470, -492, -473, -448, -352, -242, -309, -337, -210, -265, -182,
+ 831, 703, 456, 217, 165, 65, 17, -53, -67, -78, -38, -222, -340, -329, -349, -391,
+ 162, -13, -158, -335, -526, -705, -986, -1245, -1640, -2149, -2754, -1344, -372, -12, 134, 564,
+ -79, -389, -569, -699, -811, -940, -1058, -1299, -1534, -2077, -1953, -507, -216, 143, 191, 607,
+ -106, -116, -210, -225, -323, -330, -494, -491, -700, -757, -1057, -1424, -2222, -1509, -259, 348,
+ -366, -748, -1177, -1216, -1017, -698, -444, -154, 10, 285, 361, 284, 255, 359, 187, 365,
+ 77, 447, 418, 475, 453, 459, 475, 515, 562, 648, 658, 452, 367, 334, 244, 204,
+ 10, 197, 170, 166, 144, 60, 52, -2, -20, -40, 18, -238, -279, -434, -451, -807,
+ -460, -713, -547, -153, 64, 243, 386, 492, 620, 752, 759, 536, 445, 324, 151, -32,
+ -246, -396, -413, -371, -354, -317, -307, -228, -195, -101, -36, -174, -197, -162, -261, -349,
+ -329, -240, 326, 462, 428, 344, 405, 374, 439, 434, 467, 127, 85, -154, -248, -683,
+ -12, 15, -222, -227, -31, 124, 200, 294, 357, 541, 607, 459, 376, 352, 282, 283
+};
+
+/* An 16-by-32 matrix */
+const Word16 IAA_MA1_fx[512] =
+{//Qlog2(2.56)
+ -175, -490, -520, -631, -645, -614, -610, -548, -503, -432, -353, -301, -238, -141, -67, 26,
+ 301, 407, 227, 96, -12, -18, -13, 2, 39, 107, 124, 92, 83, 100, 62, 72,
+ -280, -737, -569, -164, -9, 100, 141, 211, 252, 281, 274, 217, 206, 219, 117, 106,
+ -266, -753, -841, -587, -487, -345, -263, -167, -114, -30, 8, 32, 34, 61, 55, 104,
+ -91, -137, -293, -349, -352, -326, -268, -247, -178, -129, -56, -96, -11, 219, 49, 56,
+ -18, 1, -33, -14, -19, -5, -22, -14, -43, -37, -104, -143, -375, -770, -190, -100,
+ 72, -22, -121, -220, -320, -378, -500, -587, -729, -795, -1056, -1305, -1691, -1090, -452, -60,
+ 19, -279, -453, -580, -588, -739, -858, -1044, -1281, -1614, -921, -376, -273, -84, -2, 187,
+ 853, 759, 591, 376, 260, 122, 39, -71, -133, -184, -209, -297, -299, -171, -124, -83,
+ 266, 34, -182, -367, -516, -686, -881, -1121, -1414, -1834, -2110, -997, -519, -274, -109, 137,
+ -2, -8, 42, 91, 172, 211, 298, 336, 433, 409, 546, 1043, 1499, 1038, 410, 189,
+ 86, 254, 259, 254, 246, 219, 184, 122, 79, 11, -55, -170, -363, -934, -371, -188,
+ 168, 167, -122, -244, -325, -340, -359, -343, -331, -291, -278, -270, -272, -162, -101, -46,
+ -244, -459, -367, -340, -295, -220, -173, -107, -22, 53, 103, 293, 1084, 807, 260, 117,
+ -319, -650, -685, -427, -290, -105, 25, 161, 303, 418, 587, 1074, 1563, 1085, 400, 170,
+ 146, 257, 282, 295, 303, 294, 297, 262, 237, 193, 92, 341, 1220, 884, 315, 144,
+ -291, -558, 147, 201, 282, 280, 310, 302, 313, 306, 292, 239, 198, 188, 106, 94,
+ -11, -8, -156, -204, -231, -250, -265, -289, -269, -316, -322, -450, -488, -676, -778, -973,
+ -117, -27, 4, 96, 174, 229, 271, 310, 344, 362, 344, 273, 209, 180, 109, 106,
+ -260, -290, 151, 269, 406, 442, 551, 590, 679, 681, 900, 1293, 1631, 1132, 477, 221,
+ -37, 374, 394, 414, 419, 395, 345, 313, 282, 255, 211, 126, 84, 51, -10, -53,
+ 404, 327, 174, 28, -124, -290, -490, -695, -1011, -1111, -529, -288, -183, -69, -7, 142,
+ 563, 752, 585, 555, 512, 478, 424, 396, 376, 343, 300, 194, 193, 162, 78, 46,
+ -59, -131, -35, 49, 54, -12, -92, -185, -243, -289, -288, -344, -326, 0, -38, 6,
+ 496, 582, 564, 514, 521, 490, 486, 436, 432, 320, 456, 1060, 1523, 1058, 419, 194,
+ 174, 77, 18, -89, -112, -196, -165, -247, -222, -326, -332, -494, 499, 617, 121, 60,
+ 315, 299, 229, 137, 78, -3, -40, -138, -198, -307, -375, -502, -515, -25, -88, -49,
+ -232, -29, 353, 399, 485, 487, 523, 526, 556, 559, 520, 415, 328, 283, 187, 166,
+ 182, 385, 403, 453, 515, 572, 635, 691, 787, 852, 1154, 1483, 1779, 1231, 524, 246,
+ -273, -492, -185, -97, -52, -51, -17, -27, 13, 20, 45, -20, 52, 244, 58, 56,
+ 20, -3, -241, -267, -194, -86, 4, 75, 140, 191, 200, 154, 137, 146, 85, 77,
+ 92, 628, 611, 708, 706, 716, 672, 694, 655, 619, 550, 432, 354, 284, 204, 172
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 UVD_MA1_fx[256] =
+{//Qlog2(2.56)
+ -301, -503, -426, -187, -131, -64, -45, -20, 11, 56, 63, 90, 110, 175, 97, 33,
+ 161, 353, 474, 502, 709, 782, 794, 765, 632, 532, 406, 285, 230, 145, 97, 52,
+ -37, -5, 205, 323, 412, 349, 221, 91, -6, -59, -86, -112, -32, 209, 73, 23,
+ -273, -615, -820, -794, -834, -838, -822, -819, -751, -701, -641, -562, -391, -271, -184, -63,
+ 262, 168, 104, -9, -78, -163, -141, -199, -191, -249, -245, -317, -168, 535, 109, 33,
+ -410, -675, -681, -611, -500, -396, -273, -183, -47, 60, 194, 357, 1044, 1080, 335, 140,
+ 154, 185, 256, 238, 203, 238, 280, 260, 300, 267, 258, 196, 121, -618, -263, -60,
+ 345, 705, 859, 786, 743, 584, 425, 267, 168, 105, 74, 28, 119, 267, 105, 39,
+ -39, -166, -230, -196, -255, -276, -318, -349, -387, -438, -539, -613, -752, -956, -1353, -1628,
+ 498, 479, 414, 231, 98, 5, -18, -41, -60, -78, -91, -96, -81, 72, 30, -8,
+ 41, 120, 65, 141, 117, 186, 249, 299, 418, 520, 566, 618, 692, 579, 321, 166,
+ -236, -278, -69, 13, 113, 362, 445, 539, 503, 387, 269, 172, 120, -21, 1, 4,
+ -103, -46, -137, -132, -108, -97, -67, -37, -8, 41, 82, 107, 43, -605, -189, -56,
+ -220, -315, -482, -516, -489, -445, -415, -362, -304, -205, -136, -68, -7, 131, 70, 25,
+ -10, -121, -210, -237, -224, -302, -246, -310, -271, -343, -285, -364, 28, 703, 135, 54,
+ 118, 50, -67, -166, -349, -416, -442, -446, -439, -420, -382, -319, -245, -209, -140, -82
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 UVD_MA2_fx[256] =
+{//Qlog2(2.56)
+ -75, -64, -150, -231, -272, -278, -248, -194, -156, -107, -74, -43, -92, -21, 9, 5,
+ 393, 275, -12, -156, -208, -215, -162, -132, -115, -109, -94, -85, -104, -10, 5, -1,
+ -297, -389, -99, -78, -66, -19, -12, 8, 0, -3, -15, -22, -113, -82, -16, 2,
+ 59, -11, 5, -33, -11, -61, -70, -139, -143, -239, -207, -223, 711, 701, 143, 68,
+ -195, 406, 222, 49, -6, -23, -6, 9, 0, 13, 26, 49, -44, -129, -18, -7,
+ 23, -30, -141, 79, -18, -76, -55, -14, 44, 98, 88, 86, -96, -351, -112, -39,
+ 380, 329, 235, 173, 141, 72, 25, -4, -6, -19, -21, -33, -55, -23, 3, -1,
+ -81, -210, -284, 158, 396, 290, 163, 59, -25, -22, -10, -6, -46, -32, 9, 5,
+ 9, 34, -15, 5, 23, -48, -127, -243, -347, -421, -455, -475, -495, -449, -294, -163,
+ -13, -171, -416, -414, -245, -25, 69, 102, 104, 84, 50, 33, -38, -4, 0, 5,
+ 50, 118, 68, 37, 147, 319, 371, 355, 291, 204, 130, 81, 21, 46, 36, 22,
+ -95, -108, 311, 214, -28, -153, -226, -192, -129, -69, -42, -11, -48, -17, 13, 2,
+ -185, -223, -104, 26, 53, 89, 132, 181, 258, 346, 397, 445, 392, 241, 125, 58,
+ 83, 33, -9, -81, 40, 99, 56, 8, -51, -85, -106, -124, -196, 5, 5, 0,
+ 143, 148, 19, -121, -247, -211, -67, 83, 198, 268, 290, 300, 240, 164, 86, 37,
+ -198, -136, 370, 372, 300, 240, 156, 113, 79, 60, 44, 29, -35, -38, 6, 7
+};
+
+/* An 16-by-16 matrix in Scale = 2.56f */
+const Word16 UVWB_MA3_fx[256] =
+{//Qlog2(2.56)
+ -26, 23, 7, -6, -1, 3, 40, 35, -43, -24, 56, 157, 265, 423, 382, 260,
+ 61, -300, -130, -101, -8, 106, 108, 114, 88, 43, -2, -33, -56, 67, 29, 13,
+ -31, 47, 45, -121, 46, 22, 111, 233, -256, -252, -123, -71, -31, 54, 56, 33,
+ 20, -154, 67, 198, -232, -167, -86, -12, 79, 116, 88, 78, 44, 75, 27, -7,
+ -14, 153, -166, 21, 107, 64, 233, -223, -147, -27, -1, 43, 61, 70, 50, 18,
+ 3, -115, -8, 143, 192, 193, -124, -195, -198, -162, -75, 14, 45, 83, 79, 49,
+ 12, -57, 25, -29, -11, 12, -7, -13, -12, 31, 74, 99, -10, -421, -209, -111,
+ -25, 115, 119, -19, -117, -164, -203, -237, -206, -169, -110, -41, -11, 15, 1, -7,
+ -13, 170, -143, -128, -224, -94, 1, 96, 144, 102, 29, 2, -37, 46, 7, -12,
+ -11, 10, -34, 38, 24, 86, 149, 211, 240, 279, 247, 218, 154, 161, 74, 15,
+ -24, 64, 110, 125, -24, 123, 161, 166, 177, 18, -112, -116, -141, -117, -113, -91,
+ -4, -20, -17, -11, -27, 13, -15, -40, -58, -157, -252, -283, -288, -186, -162, -112,
+ -20, 2, 32, 44, -31, -49, 8, 13, 55, -59, -162, -212, -61, 384, 115, 36,
+ -4, 42, -75, 92, 268, -203, -125, 10, 52, 121, 72, -43, -109, -47, -66, -76,
+ -39, 76, 268, -254, -28, 87, 2, 91, 85, 68, 89, 96, 42, 90, 39, 4,
+ 2, 2, -56, 7, 67, -31, -219, -192, -24, 146, 249, 269, 209, 199, 106, 31
+};
+
+/* An 16-by-8 matrix in Scale = 2.56f */
+const Word16 GESVNB_AR1_fx[128] =
+{//Qlog2(2.56)
+ -25, -64, -140, -118, 270, 240, 127, 70, 20, -40, -56, -111, -82, 64, 2, 5,
+ 81, 104, 71, 70, 0, -49, -54, -73, -59, -92, -102, -201, -404, -52, -40, -15,
+ -112, -217, -251, -202, -34, 57, 58, 62, 79, 127, 177, 306, 524, 315, 112, 53,
+ 17, -6, 34, 66, 14, -26, -174, -196, -142, -131, -102, -97, 180, 154, 29, 17,
+ 5, -27, -107, -197, -343, -333, -182, -143, -91, -17, 43, 120, 383, 267, 83, 40,
+ -1, -15, -35, -56, -169, -145, 86, 101, 77, 48, 29, 78, -9, 68, 15, 9,
+ 3, 9, 320, 450, 385, 348, 215, 155, 105, 45, -13, -75, -272, -129, -52, -23,
+ 4, 49, 54, 90, 92, 101, 59, 69, 20, 70, 23, 43, -280, -624, -114, -55
+};
+
+/* An 16-by-8 matrix in Scale = 2.56f */
+const Word16 GESVNB_AR2_fx[128] =
+{//Qlog2(2.56)
+ -22, -35, -31, -166, -164, 217, 212, 155, 166, 123, 67, 33, -21, -41, -3, -1,
+ -14, -20, -16, -70, -77, -53, 23, -7, -98, -123, -99, -49, 357, 114, 36, 19,
+ -57, -119, -303, -215, -33, -103, -97, -117, -105, -102, -67, -134, -176, 113, 16, 8,
+ -12, 14, 30, -37, -112, -226, -206, -25, 125, 134, 99, 83, 55, -4, 9, 4,
+ -19, 23, 171, 57, 13, -15, -26, -42, -65, -69, -77, -169, -351, -105, -49, -21,
+ -14, -10, 8, 35, 161, 104, -74, -102, -135, -47, 45, 264, 52, -69, -1, -5,
+ 213, 284, 230, 121, 50, 12, 43, 48, 27, -7, -24, -39, 75, 1, -9, -3,
+ -75, -137, -89, 275, 164, 65, 125, 91, 86, 91, 56, 10, 9, -10, 0, 0
+};
+
+/* An 16-by-8 matrix in Scale = 2.56f */
+const Word16 GESVWB_AR1_fx[128] =
+{//Qlog2(2.56)
+ -3, -16, -31, 2, -81, -123, -226, -260, -196, -122, -20, 78, 178, 145, 84, 46,
+ 55, 42, 15, 32, -48, -81, -109, -137, -187, -264, -330, -387, -363, -176, -38, 37,
+ -32, -70, -144, -269, -337, -183, 59, 58, 44, 49, 42, 51, 72, 50, 26, 38,
+ -18, -58, -79, 125, 352, 291, 180, 118, 72, 25, -23, -82, -185, -167, -33, 6,
+ -10, 135, 544, 517, 517, 561, 515, 528, 500, 472, 413, 383, 318, 219, 118, 57,
+ -54, -280, -614, -548, -521, -522, -448, -479, -457, -438, -377, -355, -318, -271, -222, -89,
+ -62, -96, -86, -10, 104, 155, 120, 112, 190, 264, 291, 272, 232, 166, 95, 27,
+ 33, 61, 155, 121, 9, -28, 6, 103, 64, 17, 4, -2, -31, -88, -209, -206
+};
+
+/* An 16-by-8 matrix in Scale = 2.56f */
+const Word16 GESVWB_AR2_fx[128] =
+{//Qlog2(2.56)
+ -147, -326, -421, -91, -22, -25, -14, -21, 32, 76, 104, 102, 65, 47, 50, 41,
+ -39, -16, 61, -13, -38, -56, 47, 153, 195, 213, 212, 220, 245, 245, 209, 86,
+ -34, -73, 82, 387, 199, 71, 56, -18, -33, -56, -88, -79, -5, 59, 55, 29,
+ -7, -21, -21, -158, -123, 304, 226, 168, 124, 8, -75, -91, -54, -5, 37, 30,
+ -26, -22, -67, -225, 107, 38, -82, -113, -213, -205, -62, 28, 89, 95, 52, 17,
+ 227, 404, 325, 134, 45, -16, 3, -15, -55, -65, -55, -54, -18, -8, 1, -14,
+ 19, 30, 12, 28, 48, 13, 2, -47, -38, 41, 29, -8, -154, -315, -411, -242,
+ 8, 24, 29, -61, -215, -329, -237, -106, -12, -12, -64, -118, -167, -119, 8, 52
+};
+
+/* An 16-by-32 matrix in Scale = 2.56f */
+const Word16 GEWB2_MA1_fx[512] =
+{//Qlog2(2.56)
+ 659, 1694, 1634, 1513, 1305, 1098, 933, 805, 733, 624, 525, 339, 239, 50, -35, -215,
+ 6, 65, 125, 55, -85, -126, -272, -316, -507, -586, -1010, -1278, -1941, -1910, -426, 78,
+ 281, 315, 236, -4, -102, -171, -232, -335, -362, -425, -488, -603, -669, -736, -648, -593,
+ 29, -251, -582, -871, -969, -897, -991, -1077, -1275, -1480, -998, -393, -247, -9, 28, 271,
+ -60, -361, 401, 552, 236, 35, -196, -215, -496, -683, -911, -820, -576, -299, -240, -141,
+ 416, 574, 662, 350, 133, -160, -431, -781, -1200, -1652, -2035, -1092, -449, -192, -11, 263,
+ -206, -609, -931, 28, -229, -358, -543, -462, -377, -360, -336, -251, -105, 35, 26, 80,
+ 369, 1256, 1380, 1571, 1726, 1727, 1644, 1521, 1350, 1156, 984, 748, 580, 395, 254, 108,
+ -147, -479, -330, -73, -272, -441, -685, -837, -1139, -1458, -1370, -414, -208, -12, 14, 213,
+ -50, 100, -82, -253, -7, 119, 294, 392, 494, 578, 589, 523, 462, 383, 300, 249,
+ -94, -362, -575, -770, -987, -999, -922, -697, -582, -305, -135, -31, -8, 23, -33, 62,
+ 29, -64, -4, -123, -344, -414, -679, -767, -1152, -1401, -2105, -1905, -582, -300, -64, 223,
+ 428, 990, 1019, 809, 681, 470, 366, 179, 126, -26, -141, -363, -423, -536, -437, -545,
+ -133, -357, 364, 241, -39, -227, -334, -305, -426, -292, -102, 87, 159, 182, 160, 190,
+ 560, 764, 531, 156, 22, -18, 23, -20, 19, 0, 13, -61, -35, -44, -12, -48,
+ 33, -235, -634, -1093, 136, -31, -68, -285, -529, -535, -462, -249, -95, -53, -116, -61,
+ -188, -628, -894, 702, 700, 373, 196, 51, 95, -56, -191, -181, -173, -132, -116, -218,
+ 37, -188, -661, -1087, -1322, -258, -186, -181, -238, -372, -418, -508, -433, -197, -73, 28,
+ -231, -222, 911, 875, 669, 440, 363, 301, 257, 192, 147, 68, 77, 43, 57, 17,
+ -4, -187, -356, -410, -569, -499, -584, -568, -660, -703, -965, -1201, -1540, -708, -252, 87,
+ 220, 64, -67, -357, -572, -744, -913, -1176, -1439, -1894, -2152, -762, -419, -146, -10, 281,
+ -253, -627, -1075, -1206, -721, -398, -337, -188, -118, 50, 125, 198, 200, 190, 96, 164,
+ -348, -741, -854, -357, -163, -103, -26, 143, 231, 318, 335, 325, 274, 233, 167, 190,
+ -143, -256, -191, -280, -250, -191, -82, 37, 126, 102, 67, -130, -202, -430, -495, -810,
+ 232, 107, -22, -341, -497, -523, -607, -646, -746, -690, -478, -295, -160, -77, -53, -7,
+ -33, -98, -258, -501, -589, -438, -316, -168, -58, 82, 175, 219, 249, 259, 237, 226,
+ -393, -665, -19, 185, 249, 266, 378, 468, 499, 508, 464, 388, 310, 238, 186, 145,
+ -240, -99, 408, 480, 693, 761, 946, 943, 951, 893, 782, 613, 482, 351, 260, 163,
+ -23, 523, 885, 903, 1172, 1287, 1482, 1491, 1476, 1402, 1240, 1005, 787, 604, 433, 292,
+ 262, 988, 904, 732, 734, 665, 715, 656, 673, 615, 541, 372, 284, 139, 68, -84,
+ -119, 446, 1118, 1215, 1372, 1280, 1208, 989, 881, 675, 557, 319, 227, 23, -39, -256,
+ -102, 178, 379, 252, 365, 319, 455, 377, 413, 278, 225, -36, -67, -351, -375, -772
+};
+
+/* An 16-by-32 matrix in Scale = 2.56f */
+const Word16 GEWB_MA1_fx[512] =
+{//Qlog2(2.56)
+ 269, 268, 416, 287, 157, 7, -132, -276, -482, -701, -1025, -1350, -1642, -982, -321, -49,
+ 237, 949, 1374, 1228, 1337, 1219, 1123, 1016, 852, 752, 664, 559, 448, 306, 194, 83,
+ -6, -176, -373, -111, -221, -387, -483, -639, -753, -786, -774, -655, -328, -114, -25, 27,
+ 135, 164, -4, -181, -364, -528, -464, -424, -393, -314, -242, -185, -104, -61, -32, -37,
+ 15, -218, -322, 668, 597, 343, 196, -5, -46, -159, -359, -524, -629, -548, -308, -95,
+ 242, 463, 767, 661, 558, 403, 268, 191, 71, -4, -51, -103, -141, -176, -161, -142,
+ -179, -147, 715, 865, 970, 932, 822, 763, 602, 514, 436, 370, 285, 189, 106, 36,
+ -49, -227, -589, -933, -1172, -700, -248, -175, -132, -132, -125, -103, -47, -49, -12, 60,
+ -7, -227, -404, 272, 83, -50, -165, -319, -343, -501, -731, -939, -1013, -607, -202, -2,
+ -76, -271, -661, -582, 296, 86, -60, -166, -335, -314, -213, -285, -324, -280, -164, -39,
+ -264, -452, -111, 171, 229, 357, 355, 461, 509, 517, 489, 441, 347, 246, 158, 75,
+ 67, -49, -340, -546, -758, -919, -876, -727, -658, -567, -492, -400, -234, -140, -63, 36,
+ -142, 94, 514, 400, 406, 389, 379, 413, 391, 377, 354, 314, 245, 156, 94, 34,
+ 97, -47, -316, -620, -874, -179, -206, -290, -304, -514, -690, -723, -503, -252, -73, 39,
+ 485, 674, 532, 195, 38, -60, 17, 52, 63, 74, 85, 62, 35, -10, -22, -51,
+ -105, -23, 287, 394, 469, 609, 706, 860, 933, 933, 874, 789, 638, 465, 297, 148,
+ -223, -499, -837, -813, -391, -231, -178, -182, -81, 2, 84, 113, 131, 142, 127, 107,
+ -64, 269, 879, 849, 1013, 1157, 1250, 1337, 1263, 1176, 1048, 900, 703, 502, 318, 165,
+ 61, 1, -198, -209, -345, -417, -280, -280, -307, -272, -341, -418, -604, -738, -887, -394,
+ 45, 77, 124, 152, 99, 43, 20, -4, -91, -85, -192, -280, -544, -754, -1176, -1296,
+ 173, 69, -49, -226, -344, -479, -489, -618, -727, -909, -1122, -1446, -1292, -492, -205, 10,
+ -80, -80, 338, 285, 123, 48, -76, -80, -105, -118, -108, -80, -58, -28, -9, -8,
+ 74, -79, -292, -618, -756, 345, 216, 180, 143, -73, -186, -223, -200, -143, -52, -21,
+ -253, -519, -578, -188, -96, -35, -7, 27, 133, 218, 258, 258, 231, 180, 120, 70,
+ 273, 740, 950, 736, 701, 635, 611, 602, 566, 533, 494, 447, 350, 230, 131, 42,
+ -100, -345, -702, -352, 709, 682, 485, 324, 161, 112, 148, 25, -88, -106, -86, -101,
+ 307, 265, 253, 65, -63, -75, -169, -282, -390, -501, -550, -532, -406, -296, -186, -132,
+ -26, 70, 50, -84, -89, 28, 106, 199, 305, 391, 450, 469, 419, 301, 191, 80,
+ 22, 39, -154, -426, -597, -497, -159, -69, 41, 95, 114, 114, 99, 33, -7, -40,
+ -162, -356, -511, -461, -475, -513, -477, -485, -395, -249, -136, -71, -4, 33, 54, 64,
+ -82, -295, -562, 241, 65, -163, -227, -384, -237, -229, -266, -223, -94, 10, 41, 31,
+ -104, -323, -302, 733, 646, 418, 271, 149, 155, 154, 119, 99, 89, 63, 13, -16
+};
+
+/* An 16-by-32 matrix in Scale = 2.56f */
+const Word16 AUWB2_MA1_fx[512] =
+{//Qlog2(2.56)
+ 391, 298, 179, -37, -225, -387, -627, -864, -1216, -1644, -2108, -804, -277, -5, 121, 468,
+ 351, 213, 141, -75, -130, -164, -332, -410, -524, -573, -575, -474, -331, -103, -22, 201,
+ 81, 874, 1137, 1223, 1242, 1262, 1238, 1185, 1141, 1085, 993, 733, 570, 424, 256, 145,
+ -6, -25, -105, -147, -327, -342, -587, -620, -954, -1143, -1878, -2059, -356, -100, 134, 477,
+ -197, -505, -826, -1043, -863, -485, -296, -103, -6, 178, 269, 245, 231, 320, 243, 413,
+ -518, -605, 282, 430, 532, 596, 676, 748, 808, 861, 834, 681, 534, 498, 293, 337,
+ -244, -563, -720, -599, -500, -494, -627, -739, -1028, -1219, -297, 9, 71, 272, 285, 563,
+ -448, -854, -916, -518, -287, -52, 56, 245, 347, 524, 557, 497, 416, 452, 321, 437,
+ 150, 113, 28, -26, 1, -80, -177, -226, -193, -156, -62, -227, -240, -383, -535, -809,
+ -240, -246, -174, -66, 80, 149, 244, 284, 413, 434, 473, 158, 56, -167, -326, -723,
+ 131, -11, 141, 32, 24, -122, -397, -610, -888, -812, 30, 232, 306, 371, 341, 446,
+ -158, -545, -529, 151, 142, -101, -426, -716, -1031, -1479, -1550, -352, -132, 145, 187, 517,
+ 148, -104, -445, -841, -31, 183, -86, -316, -615, -660, -231, 84, 192, 275, 201, 311,
+ -183, -220, -243, -182, -237, -176, -266, -233, -336, -339, -650, -1019, -1652, -846, -52, 387,
+ -104, -117, -254, -332, -191, 1, 64, 182, 317, 495, 626, 574, 519, 508, 456, 505,
+ -151, -237, 492, 479, 273, 139, 36, -60, -119, 74, 174, 188, 298, 366, 347, 478,
+ 158, 23, -210, -450, -673, -637, -423, -331, -133, 14, 128, 69, 62, 143, 171, 313,
+ 501, 394, 37, -57, 67, 70, 46, 35, 92, 120, 337, 258, 276, 283, 368, 500,
+ 42, -157, -398, -600, -742, -780, -781, -980, -1166, -1629, -968, -149, -99, 188, 209, 529,
+ -240, 190, 465, 543, 575, 565, 605, 596, 653, 599, 583, 279, 203, -51, -186, -589,
+ 316, 371, 417, 372, 293, 189, 230, 154, 184, 91, 94, -175, -198, -358, -454, -736,
+ 72, -159, -362, -499, -633, -690, -794, -739, -662, -456, -360, -338, -251, -6, 50, 346,
+ -202, -332, -428, -462, -508, -440, -552, -647, -885, -1217, -1733, -619, -162, 95, 202, 510,
+ -91, -391, -709, -884, -1012, -1001, -936, -714, -509, -198, 42, 99, 119, 261, 238, 496,
+ -370, 92, 476, 604, 681, 762, 826, 893, 934, 1001, 954, 783, 629, 590, 412, 467,
+ -193, -22, -28, 46, 214, 387, 502, 643, 728, 864, 859, 723, 581, 569, 435, 483,
+ 223, 291, 633, 508, 350, 141, -156, -476, -930, -1417, -1809, -764, -206, 77, 191, 515,
+ -475, -791, -417, 75, 201, 343, 408, 549, 612, 707, 686, 572, 463, 457, 321, 373,
+ 842, 716, 669, 593, 419, 423, 373, 321, 273, 280, 354, 217, 193, 232, 175, 294,
+ 116, -60, -144, -299, -421, -551, -732, -952, -1203, -1662, -1996, -537, -240, 55, 138, 486,
+ -323, -665, -686, -214, -201, -260, -373, -329, -333, -165, 66, 96, 175, 310, 291, 486,
+ -19, 43, 35, 40, 42, 55, 63, 101, 133, 194, 222, 152, 117, 145, 133, 213
+};
+
+const Word16 *const Quantizers_fx[] = { SVNB_SN1_fx, SVNB_SN2_fx, GETRNB_SN1_fx, GETRNB_SN2_fx, AUNB_SN1_fx,SVWB_SN1_fx, SVWB_SN2_fx, GETRWB_SN1_fx,
+ GETRWB_SN2_fx, AUWB_SN1_fx,/* U13, */
+ TRWB2_SN1_fx, TRWB2_SN2_fx, AUWB2_SN1_fx, CNG_SN1_fx, SVWB2_SN1_fx, SVWB2_SN2_fx
+};//Qlog2(2.56)
+
+const Word16 *const Quantizers_p_fx[] = { IAA_MA1_fx, UVD_MA1_fx, UVD_MA2_fx, UVWB_MA3_fx, GESVNB_AR1_fx, GESVNB_AR2_fx, GESVWB_AR1_fx, GESVWB_AR2_fx,
+ GEWB2_MA1_fx,GEWB_MA1_fx, AUWB2_MA1_fx, SVWB2_AR1_fx, SVWB2_AR2_fx
+};//Qlog2(2.56)
+
+const Word16 vals_fx[NO_LEADERS][MAX_NO_VALS] = /*Q1 */
+{
+ {2, 0, 0, 0},
+ {1, 0, 0, 0},
+ {2, 0, 0, 0},
+ {4, 0, 0, 0},
+ {3, 1, 0, 0},
+ {2, 0, 0, 0},
+ {4, 2, 0, 0},
+ {3, 1, 0, 0},
+ {2, 0, 0, 0},
+ {4, 2, 0, 0},
+ {4, 0, 0, 0},
+ {3, 1, 0, 0},
+ {5, 1, 0, 0},
+ {4, 2, 0, 0},
+ {4, 2, 0, 0},
+ {6, 2, 0, 0},
+ {3, 1, 0, 0},
+ {5, 3, 1, 0},
+ {4, 2, 0, 0},
+ {4, 0, 0, 0},
+ {6, 2, 0, 0},
+ {3, 1, 0, 0},
+ {5, 3, 1, 0},
+ {4, 2, 0, 0},
+ {4, 2, 0, 0},
+ {6, 2, 0, 0},
+ {6, 4, 2, 0},
+ {3, 1, 0, 0},
+ {5, 3, 1, 0},
+ {5, 1, 0, 0},
+ {7, 1, 0, 0},
+ {4, 2, 0, 0},
+ {4, 0, 0, 0},
+ {6, 2, 0, 0},
+ {6, 4, 2, 0},
+ {8, 0, 0, 0},
+ {3, 1, 0, 0},
+ {5, 3, 1, 0},
+ {5, 3, 1, 0},
+ {7, 3, 1, 0},
+ {4, 2, 0, 0},
+ {6, 4, 2, 0},
+ {6, 4, 2, 0},
+ {6, 0, 0, 0},
+ {8, 2, 0, 0},
+ {3, 0, 0, 0},
+ {5, 3, 1, 0},
+ {5, 3, 1, 0},
+ {7, 3, 1, 0},
+};
+
+const Word16 no_vals[NO_LEADERS]= {2,1,2,2,2,2,3,2,1,3,2,2,2,3,3,3,2,3,3,2,3,2,3,2,3,3,4,2,3,2,2,3,2,2,4,2,2,3,3,3,3,4,4,2,3,1,3,3,3}; // Q0
+
+const Word16 no_vals_ind[NO_LEADERS][MAX_NO_VALS]=
+{
+ {2,6,0,0},
+ {8,0,0,0},
+ {4,4,0,0},
+ {1,7,0,0},
+ {1,7,0,0},
+ {6,2,0,0},
+ {1,2,5,0},
+ {2,6,0,0},
+ {8,0,0,0},
+ {1,4,3,0},
+ {2,6,0,0},
+ {3,5,0,0},
+ {1,7,0,0},
+ {1,6,1,0},
+ {2,2,4,0},
+ {1,1,6,0},
+ {4,4,0,0},
+ {1,1,6,0},
+ {2,4,2,0},
+ {3,5,0,0},
+ {1,3,4,0},
+ {5,3,0,0},
+ {1,2,5,0},
+ {2,6,0,0},
+ {3,2,3,0},
+ {1,5,2,0},
+ {1,1,1,5},
+ {6,2,0,0},
+ {1,3,4,0},
+ {2,6,0,0},
+ {1,7,0,0},
+ {3,4,1,0},
+ {4,4,0,0},
+ {1,7,0,0},
+ {1,1,3,3},
+ {1,7,0,0},
+ {7,1,0,0},
+ {1,4,3,0},
+ {2,1,5,0},
+ {1,1,6,0},
+ {4,2,2,0},
+ {1,1,5,1},
+ {1,2,1,4},
+ {2,6,0,0},
+ {1,2,5,0},
+ {8,0,0,0},
+ {1,5,2,0},
+ {2,2,4,0},
+ {1,2,5,0}
+}; // Q0
+
+
+const Word16 C_VQ[LATTICE_DIM+1][LATTICE_DIM+1] =
+{
+ {1,0,0,0,0,0,0,0,0},
+ {1,1,0,0,0,0,0,0,0},
+ {1,2,1,0,0,0,0,0,0},
+ {1,3,3,1,0,0,0,0,0},
+ {1,4,6,4,1,0,0,0,0},
+ {1,5,10,10,5,1,0,0,0},
+ {1,6,15,20,15,6,1,0,0},
+ {1,7,21,35,35,21,7,1,0},
+ {1,8,28,56,70,56,28,8,1}
+};
+
+const Word16 C_VQ_fx[LATTICE_DIM + 1][LATTICE_DIM + 1] =
+{
+ {1,0,0,0,0,0,0,0,0},
+ {1,1,0,0,0,0,0,0,0},
+ {1,2,1,0,0,0,0,0,0},
+ {1,3,3,1,0,0,0,0,0},
+ {1,4,6,4,1,0,0,0,0},
+ {1,5,10,10,5,1,0,0,0},
+ {1,6,15,20,15,6,1,0,0},
+ {1,7,21,35,35,21,7,1,0},
+ {1,8,28,56,70,56,28,8,1}
+}; // Q0
+
+const UWord32 table_no_cv[] = //Q0
+{
+ 0, 112, 240, 1360, 1376, 2400, 4192, 5536, 9120, 9376, 18336, 18448, 25616, 26640, 33808, 40528, 40752,
+ 49712, 56880, 83760, 84208, 88688, 95856, 117360, 124528, 142448, 153200, 155888, 159472, 195312, 198896, 199920, 235760, 236880,
+ 238928, 274768, 274784, 275808, 311648, 333152, 340320, 367200, 410208, 423648, 423760, 425104, 425232, 446736, 500496, 522000, 0
+};
+//Q0
+const Word32 table_no_cv_fx[] = { 0, 112, 240, 1360, 1376, 2400, 4192, 5536, 9120, 9376, 18336, 18448, 25616, 26640, 33808, 40528, 40752,
+ 49712, 56880, 83760, 84208, 88688, 95856, 117360, 124528, 142448, 153200, 155888, 159472, 195312, 198896, 199920,
+ 235760, 236880, 238928, 274768, 274784, 275808, 311648, 333152, 340320, 367200, 410208, 423648,423760, 425104, 425232, 446736, 500496, 522000
+ ,0
+}; // Q0
+
+
+const Word16 pi0[] =
+{
+ 28,1,70,8,8,28,168,28,1,280,28,56,8,56,420,56, 70, 56,420, 56, 280, 56, 168, 28, 560, 168,336,28,280,28,8,
+ 280,70, 8, 1120, 8, 8, 280, 168, 56, 420, 336, 840, 28, 168, 1, 168, 420, 168
+}; // Q0
+
+const Word16 pl_HQ_fx[] = /* Q1 vectors in first layers */
+{
+ 2, 2, 0, 0, 0, 0, 0, 0, /* 112, 4, 28 */
+ 1, 1, 1, 1, 1, 1, 1, 1, /* 128, 128, 1 */
+ 2, 2, 2, 2, 0, 0, 0, 0, /* 1120, 16, 70 */
+ 4, 0, 0, 0, 0, 0, 0, 0, /* 16 , 2, 8 */
+ 3, 1, 1, 1, 1, 1, 1, 1, /* 5 */ /* 1024,128, 8 */
+ 2, 2, 2, 2, 2, 2, 0, 0, /* 1792, 64, 28 */
+ 4, 2, 2, 0, 0, 0, 0, 0, /* 1344, 8, 168 */
+ 3, 3, 1, 1, 1, 1, 1, 1, /* 3584, 128, 28*/
+ 2, 2, 2, 2, 2, 2, 2, 2, /*256, 256, 1*/
+ 4, 2, 2, 2, 2, 0, 0, 0, /* 10 */ /* 8960, 32, 280 */
+ 4, 4, 0, 0, 0, 0, 0, 0, /* 112, 4, 28 */
+ 3, 3, 3, 1, 1, 1, 1, 1, /* 7168, 128, 56 */
+ 5, 1, 1, 1, 1, 1, 1, 1, /* 1024, 128, 8*/
+ 4, 2, 2, 2, 2, 2, 2, 0, /* 7168, 128, 56*/
+ 4, 4, 2, 2, 0, 0, 0, 0, /* 15 */ /* 6720, 16, 420 */
+ 6, 2, 0, 0, 0, 0, 0, 0, /* 224, 4, 56 */
+ 3, 3, 3, 3, 1, 1, 1, 1, /* 8960, 128, 70 */
+ 5, 3, 1, 1, 1, 1, 1, 1, /* 7168, 128, 56*/
+ 4, 4, 2, 2, 2, 2, 0, 0, /* 26880, 64, 420 */
+ 4, 4, 4, 0, 0, 0, 0, 0, /*20 */ /* 448, 8, 56 */
+ 6, 2, 2, 2, 0, 0, 0, 0, /* 4480, 16, 280 */
+ 3, 3, 3, 3, 3, 1, 1, 1, /* 7168, 128, 56 */
+ 5, 3, 3, 1, 1, 1, 1, 1, /* 21504, 128, 168 */
+ 4, 4, 2, 2, 2, 2, 2, 2, /* 7168, 256, 28 */
+ 4, 4, 4, 2, 2, 0, 0, 0, /* 25 */ /* 17920, 32, 560 */
+ 6, 2, 2, 2, 2, 2, 0, 0, /* 10752, 64, 168 */
+ 6, 4, 2, 0, 0, 0, 0, 0, /* 2688, 8, 336 */
+ 3, 3, 3, 3, 3, 3, 1, 1, /* 3584, 128, 28 */
+ 5, 3, 3, 3, 1, 1, 1, 1, /* 35840,128,280*/
+ 5, 5, 1, 1, 1, 1, 1, 1, /*30 */ /* 3584, 128, 28*/
+ 7, 1, 1, 1, 1, 1, 1, 1, /* 1024,128, 8 */
+ 4, 4, 4, 2, 2, 2, 2, 0,
+ 4, 4, 4, 4, 0, 0, 0, 0,
+ 6, 2, 2, 2, 2, 2, 2, 2,
+ 6, 4, 2, 2, 2, 0, 0, 0,
+ 8, 0, 0, 0, 0, 0, 0, 0,
+ 3, 3, 3, 3, 3, 3, 3, 1,
+ 5, 3, 3, 3, 3, 1, 1, 1,
+ 5, 5, 3, 1, 1, 1, 1, 1,
+ 7, 3, 1, 1, 1, 1, 1, 1,
+ 4, 4, 4, 4, 2, 2, 0, 0,
+ 6, 4, 2, 2, 2, 2, 2, 0,
+ 6, 4, 4, 2, 0, 0, 0, 0,
+ 6, 6, 0, 0, 0, 0, 0, 0,
+ 8, 2, 2, 0, 0, 0, 0, 0,
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 5, 3, 3, 3, 3, 3, 1, 1,
+ 5, 5, 3, 3, 1, 1, 1, 1,
+ 7, 3, 3, 1, 1, 1, 1, 1
+};
+/*----------------------------------------------------------------------------------*
+ * LSF quantization for CNG
+ *----------------------------------------------------------------------------------*/
+
+const Word16 cng_sort[] = {/*5f */1,1,0,1,0,0, /* 4f */0,1,0,1,0,0,1,1,1,1}; // Q0
+
+
+const Word16 perm_MSLVQ[][4] =
+{
+ /* 5f*/
+ {6,11,7,15},
+ {6,15,-1,0},
+ {5,8,7,15},
+ {7,10,-1,0},
+ {-1,0,0,0},
+ {-1,0,0,0},
+ /* 4f */
+ {-1,0,0,0},
+ {0,9,7,10},
+ {-1,0,0,0},
+ {7,15,-1,0},
+ {-1,0,0,0},
+ {-1,0,0,0},
+ {6,10,7,11},
+ {6,11,7,12},
+ {6,11,7,12},
+ {6,11,7,12}
+}; // Q0
+
+const Word16 pl_par[] = /* 1 if even number of signs */
+{
+ 0, 1, 0, 0, -1, 0, 0, 1, 0, 0,
+ 0, -1, 1, 0, 0, 0, 1, -1, 0, 0,
+ 0, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0,
+ 0, 0, 0, 0, -1, 1, -1, 1, 0, 0, 0, 0, 0, 1, -1, 1, -1
+}; // Q0
+
+const Word16 scales_fx[][6] =//Q11
+{
+ {3129, 0, 0, 3138, 0, 0, }, /* 14 */
+ {3287, 0, 0, 3138, 0, 0, }, /* 15 */
+ {2611, 5034, 0, 3138, 0, 0, },
+ {2611, 5034, 0, 3340, 0, 0, },
+ {2165, 3674, 5931, 2363, 3809, 6281, },
+ {1898, 2986, 4745, 2116, 3668, 7045, }, /* 28 */ /* mode 0 UV WB*/
+ {2630, 5480, 0, 2972, 0, 0, },
+ {2802, 0, 0, 2869, 5073, 0, },
+ {1763, 2546, 3723, 2515, 4559, 21109, },
+ {2195, 3961, 7440, 2501, 6017, 21961, },
+ {1841, 2902, 1386, 2116, 3762, 22309, },
+ {1700, 2710, 1288, 1866, 3246, 20660, }, /* 32 */ /* mode 1 UV NB*/
+
+
+ {3222, 0, 0, 3391, 0, 0, },
+ {2537, 4923, 0, 3187, 0, 0, },
+ {2161, 3482, 9091, 3391, 0, 0, },
+ {2560, 4923, 8462, 2775, 4835, 0, },
+ {2163, 3656, 9263, 2699, 5296, 0, },
+ {2040, 3082, 6871, 2427, 3637, 5587, },
+ {1903, 2841, 6875, 2212, 3484, 5908, },
+ {1888, 3058, 6900, 2212, 3484, 5908, },
+ {1888, 3058, 6900, 2183, 3469, 6420, },
+ {1888, 3058, 6900, 1970, 3174, 8081, },
+ {1528, 2269, 5876, 1964, 3033, 8002, },
+ {1577, 2445, 5782, 1858, 2871, 4334, },
+
+ {1532, 2259, 5870, 2421, 1661, 6824, }, /* 34 */
+
+ {1386, 1972, 4356, 1487, 2216, 4514, }, /* 37 */ /* mode 2 V WB*/
+ {3357, 0, 0, 2494, 4426, 0, },
+ {2634, 5009, 0, 2888, 0, 0, },
+ {2224, 3539, 7696, 2494, 4426, 0, },
+ {2120, 3226, 9861, 2494, 4426, 0, },
+ {1974, 3140, 10121, 2494, 4426, 0, },
+ {1722, 2454, 4059, 2494, 4426, 0, },
+ {1839, 2658, 4473, 2490, 5456, 0, },
+ {1722, 2533, 4581, 2038, 3394, 5808, },
+
+ {1427, 2009, 4184, 1915, 3082, 1350, },
+ {1370, 1862, 2720, 2017, 1339, 3914, }, /* 37 */ /* mode 3 V NB */
+
+ {2482, 3885, 0, 0, 0, 0, },
+ {3346, 0, 0, 3418, 0, 0, },
+ {2638, 4962, 0, 3418, 0, 0, },
+ {2482, 3885, 0, 3418, 0, 0, },
+ {2218, 3617, 6502, 3418, 0, 0, },
+ {2124, 3295, 8659, 3418, 0, 0, },
+ {2243, 3398, 5562, 2693, 5132, 0, },
+ {1927, 2839, 4549, 2693, 5132, 0, },
+ {1860, 2675, 3893, 2703, 5372, 0, },
+ {2202, 3619, 1618, 2703, 5372, 0, },
+ {2093, 3135, 1554, 2273, 3594, 5313, },
+ {2202, 3619, 1618, 2238, 3895, 6173, },
+ {1829, 3015, 1382, 2259, 3625, 5820, },
+ {1864, 3170, 1403, 2114, 3381, 5147, },
+ {1692, 2572, 1294, 2009, 3158, 4540, }, /* 32 (31.995) */ /* G WB*/
+ {2425, 3707, 5655, 0, 0, 0, },
+ {3299, 0, 0, 3314, 0, 0, },
+ {2425, 3707, 5655, 3174, 0, 0, },
+ {2425, 3707, 5655, 3314, 0, 0, },
+ {2177, 3557, 6113, 3314, 0, 0, },
+ {2208, 3738, 6476, 3009, 4606, 0, },
+ {2816, 1874, 4264, 3009, 4606, 0, },
+ {1966, 2914, 1434, 2683, 4366, 0, },
+ {2302, 1626, 3895, 2628, 4714, 0, },
+ {2206, 3537, 1571, 2560, 3996, 6105, },
+ {1911, 3013, 1403, 2560, 3996, 6105, },
+ {1898, 3277, 1380, 2363, 3637, 5845, },
+ {2144, 1479, 3656, 2163, 3363, 5532, },
+ {1989, 1409, 3090, 2136, 3543, 6003, },
+ {1882, 1356, 2800, 2165, 3703, 6285, }, /* 32 (31.987) */ /* G NB*/
+ {3312, 0, 0, 3394, 0, 0, },
+ {2611, 4706, 0, 3201, 0, 0, },
+ {2679, 4821, 0, 2841, 0, 0, },
+ {2644, 4952, 0, 2775, 5003, 0, },
+ {2210, 3623, 6169, 2841, 0, 0, },
+ {2210, 3623, 6169, 2714, 5233, 0, },
+ {1837, 2744, 5333, 2191, 3459, 5175, },
+ {1837, 2744, 5333, 1923, 2978, 4266, },
+ {1853, 2718, 5323, 2271, 1591, 3492, },
+ {1561, 2255, 4831, 1923, 2978, 4266, },
+ {1626, 2511, 6513, 2271, 1591, 3492, }, /* 33 */
+ /* mode 6 T WB */
+ {3336, 0, 0, 2439, 4528, 0, },
+ {2615, 5237, 0, 2800, 0, 0, },
+ {2216, 3607, 8047, 2439, 4528, 0, },
+ {2085, 3144, 5751, 2439, 4528, 0, },
+ {1933, 3025, 5659, 2439, 4528, 0, },
+ {1864, 3572, 6793, 2439, 4528, 0, },
+ {1884, 3375, 6283, 1985, 3447, 8096, },
+ {1513, 2275, 5517, 1800, 2890, 4721, },
+ {1452, 2114, 5564, 1659, 2550, 3736, }, /* 32 */ /* mode 7 T NB */
+
+ {1552, 2286, 4022, 2497, 4139, 1634,},
+ {1432, 2118, 4051, 2497, 4139, 1634, }, /* 32 */ /* mode 8 G 16k */
+
+ {1487, 2150, 3779, 2775, 1761, 4516, },
+ {1386, 2042, 3418, 2775, 1761, 4516, }, /* 33 (32.983) */ /* T 16k */
+
+ {3371, 0, 0, 2568, 5036, 0, },
+ {2198, 3815, 6617, 3437, 0, 0, },
+ {2198, 3815, 6617, 2568, 5036, 0, },
+ {1948, 3056, 5112, 2570, 6085, 0, },
+ {2351, 3770, 1665, 2570, 6085, 0, }, /* 26 */
+ {1233, 1780, 2904, 2589, 1565, 4542, }, /* 36 */ /* mode 10 AUDIO_WB 36 + 4 + 1 */
+
+ {1747, 3623, 9062, 0, 0, 0, },
+ {2071, 3406, 9017, 3232, 0, 0, },
+ {2071, 3406, 9017, 2462, 4964, 0, },
+ {1804, 3314, 8471, 2462, 4964, 0, },
+ {1735, 3668, 9146, 2462, 4964, 0, }, /* 27 */ /* AUDIO_NB */
+ {1372, 2277, 4893, 2462, 4964, 0, }, /* 28 */ /* AUDIO_NB */
+ {2316, 3717, 1630, 2591, 5722, 0, },
+ {1167, 1647, 2451, 2380, 3992, 1491, }, /* 36 */ /* mode 12 AUDIO_WB 16k 15-36 + 4 + 1*/
+ {2140, 3248, 7688, 3418, 0, 0, },
+ {1802, 2621, 5784, 2251, 3553, 0, },
+ {1702, 2488, 5994, 2230, 3498, 5077, },
+ {1782, 2718, 5951, 2183, 3521, 5480, },
+
+ {1581, 2298, 4815, 2961, 1933, 4243, },
+
+ {1436, 2001, 3559, 1939, 2976, 4264, },
+
+ {1473, 2091, 3484, 2292, 1626, 3473, },
+
+ {1311, 1810, 3547, 1546, 2232, 3170, }, /* 37 (36.995) */ /* VOICED 16k */
+ {2494, 1630, 4676, 2642, 6810, 0, },
+ {3256, 1710, 9085, 2247, 6287, 0, },
+
+ {2036, 5360, 0, 2234, 4573, 7080, },
+ {1817, 3222, 7256, 2228, 3742, 6281, },
+ {1714, 2535, 3897, 2658, 5728, 0, },
+ {2331, 5788, 0, 2265, 5726, 8993, },
+ {1927, 3955, 9161, 1395, 2593, 4768, },
+ {2769, 8872, 0, 1679, 3164, 8550, },
+ {2750, 7387, 0, 1759, 2976, 5304, },
+ {2474, 5612, 0, 1554, 2540, 4469, },
+ {2300, 5603, 0, 1790, 3068, 5296, },
+ {1882, 5061, 0, 1260, 2195, 4293, },
+ {3170, 9232, 0, 1690, 4461, 8817, },
+ {2492, 5935, 0, 1509, 2492, 3953, },
+
+ {1999, 4485, 11706, 3084, 1315, 8624, },
+ {2267, 5315, 0, 2666, 1237, 1802}, /* CNG */
+
+};/* An 6-by-146 matrix in Scale = 2048.00f */
+
+const Word16 scales_p_fx[][6] =
+{//Q11
+ {2998, 4862, 0, 0, 0, 0, },
+ {2591, 5251, 0, 3355, 0, 0, },
+ {2177, 3488, 5745, 2650, 4819, 0, },
+ {2177, 3926, 6273, 2796, 0, 0, },
+ {1872, 2892, 4553, 2650, 4819, 0, },
+ {1806, 2869, 4919, 2689, 4999, 0, },
+ {2777, 1776, 4868, 2191, 3453, 5214, },
+ {1733, 2761, 5214, 2204, 3568, 5444, },
+ {1731, 2824, 5255, 2087, 3230, 5003, },
+ {1548, 2435, 5732, 2220, 3695, 5648, },
+ {1546, 2494, 5777, 1933, 2935, 4041, },
+ {1483, 2529, 6025, 2570, 1737, 4096, },
+ {1407, 2279, 4788, 1747, 2720, 3981, },
+ {1327, 2107, 3760, 1749, 2777, 4016, },
+ {1327, 2107, 3760, 1407, 2167, 3891, }, /* 39 (38.488) */ /* V WB*/ /* 14 */
+ {3303, 0, 0, 0, 0, 0, },
+ {2595, 5069, 0, 3316, 0, 0, },
+ {2077, 3338, 5046, 2632, 4405, 0, },
+ {1829, 2847, 4739, 3000, 4708, 0, },
+ {1905, 2869, 4403, 2621, 4616, 0, },
+ {1829, 2847, 4739, 2613, 4518, 6111, },
+ {1829, 2847, 4739, 2122, 3371, 5061, },
+ {1755, 2738, 5046, 2136, 3543, 5376, },
+ {1567, 2497, 3181, 2122, 3371, 5061, },
+ {1616, 2720, 3383, 2154, 3654, 5542, },
+ {1565, 2507, 3185, 1884, 2955, 4168, },
+ {1358, 2173, 2535, 2824, 1839, 3996, },
+ {1378, 2261, 2675, 2578, 1696, 4002, },
+ {1364, 2193, 2558, 1645, 2542, 3541, },
+ {1348, 2128, 2486, 1946, 1333, 2927, }, /* 39 (38.512) */ /* V NB*/ /* 29 */
+ {3277, 0, 0, 3181, 0, 0, },
+ {2322, 4067, 6748, 3181, 0, 0, },
+ {2021, 3662, 5446, 3373, 0, 0, },
+ {1841, 3281, 5282, 3373, 0, 0, },
+ {1632, 2650, 4383, 3373, 0, 0, },
+ {1632, 2650, 4383, 2734, 4557, 0, },
+ {1518, 2357, 3719, 2734, 4557, 0, },
+ {1632, 2650, 4383, 2429, 3957, 0, },
+ {1518, 2357, 3719, 2384, 3734, 5671, },
+ {1450, 2306, 4000, 2204, 3543, 5687, },
+ {1352, 2148, 3217, 2204, 3543, 5687, },
+ {1356, 2101, 3183, 2200, 3918, 6189, },
+ {1352, 2148, 3217, 2947, 1896, 4364, },
+ {1290, 1978, 3117, 2687, 1804, 4520, },
+ {1264, 1886, 2963, 2114, 3172, 1548, }, /* 35 (34.994) */ /* G WB*/ /* 44 */
+ {3267, 0, 0, 3076, 0, 0, },
+ {2300, 3985, 7643, 3076, 0, 0, },
+ {2116, 4250, 8886, 2906, 5009, 0, },
+ {2017, 3672, 12216, 2623, 4760, 0, },
+ {1804, 3289, 14326, 2906, 5009, 0, },
+ {1729, 3240, 14377, 2623, 4760, 0, },
+ {1616, 3113, 14752, 2623, 4760, 0, },
+ {1780, 3168, 14326, 2109, 3592, 6353, },
+ {1673, 3056, 14582, 2109, 3592, 6353, },
+ {1546, 2830, 14608, 2109, 3592, 6353, },
+ {1446, 2693, 14797, 2109, 3592, 6353, },
+ {1411, 2654, 14930, 2081, 3840, 6633, },
+ {1430, 2611, 14764, 1872, 3170, 4983, },
+ {1391, 2693, 14930, 2517, 3779, 1665, },
+ {1391, 2693, 14930, 2433, 1581, 4004, }, /* 35 (34.952) */ /* G NB*/ /* 59 */
+
+ {2070, 3639, 5652, 3305, 0,0,},
+ {1747, 2830, 4231, 2550, 5487, 0,},
+ {2472, 1593, 4522, 2550, 5487, 0,},
+ {2472, 1593, 4522, 2075, 3752, 6253},
+ {2472, 1593, 4522, 2908, 1786, 4772,},
+ {1075, 1577, 2198, 1669, 2533, 1161}, /* 40 (39.990) */ /* AUDIO_WB */ /* 65 */
+
+ {2191, 3668, 7993, 3275, 0, 0, },
+ {1679, 2492, 4278, 2570, 4690, 0, },
+ {1597, 2394, 5110, 2570, 4690, 0, },
+ {2202, 1481, 4835, 2273, 4016, 7150, },
+
+ {1415, 2107, 4786, 2118, 3668, 8200, }, /* 31 */ /*AUDIO_NB */ /* 70 */
+ {1374, 2204, 5337, 1956, 3168, 5149, }, /* 32 */ /*AUDIO_NB */ /* 71 */
+ {2425, 4336, 1589,3420, 2165, 1380, },
+ {1067, 1530, 2116, 1630, 2730, 1110,}, /* 40 */ /* mode AUDIO_WB 16k */ /* 73*/
+
+ {3439, 0, 0, 2626, 5061, 0, },
+ {2228, 3787, 6543, 3455, 0, 0, },
+ {2228, 3787, 6543, 2626, 5061, 0, },
+ {2306, 3459, 1618, 2626, 5061, 0, },
+ {1905, 2830, 1397, 2626, 5061, 0, },
+ {2284, 1626, 3793, 2623, 6212, 0, },
+ {1720, 2818, 1276, 1638, 2900, 8724, }, /* 36 (35.998) */ /* INACTIVE NB */
+ {1640, 2351, 3690, 0, 0, 0, },
+ {2230, 3711, 6496, 3434, 0, 0, },
+ {2230, 3899, 6597, 3115, 5396, 0, },
+ {1731, 2482, 3961, 2689, 4954, 0, },
+ {1595, 2243, 3482, 2689, 4954, 0, },
+ {1481, 2079, 3408, 2689, 4954, 0, },
+ {1829, 1335, 2945, 2204, 1475, 3674, }, /* 36 (35.929) */ /* INACTIVE WB*/
+ {2783, 4723, 0, 3418, 0, 0, },
+ {2206, 3946, 7262, 3418, 0, 0, },
+ {2206, 4162, 7328, 2927, 5552, 0, },
+ {1706, 2566, 4311, 2628, 5235, 0, },
+ {1589, 2359, 3805, 2628, 5235, 0, },
+ {1473, 2183, 3547, 2628, 5235, 0, },
+ {1927, 1333, 3205, 1479, 2437, 3973, }, /* 36 (35.915) */ /* INACTIVE 16k*/
+
+ {2646, 5077, 0, 3156, 0, 0, },
+ {2462, 3897, 0, 3156, 0, 0, },
+ {2105, 3361, 5028, 3375, 0, 0, },
+ {2554, 1798, 4770, 3375, 0, 0, },
+ {1767, 2781, 5165, 3375, 0, 0, },
+ {1673, 2503, 4116, 2200, 3656, 5597, },
+ {1669, 1253, 2623, 2161, 3531, 6046, }, /* 32 (31.990) */ /* UNVOICED NB*/
+
+ {3164, 0, 0, 3170, 0, 0, },
+ {3359, 0, 0, 3170, 0, 0, },
+ {2636, 5630, 0, 3170, 0, 0, },
+ {2636, 5630, 0, 3387, 0, 0, },
+ {2437, 4149, 0, 3387, 0, 0, },
+ {1907, 2986, 5018, 2650, 5616, 0, },
+ {1796, 2859, 5605, 2214, 3719, 6881, }, /* 28 (27.996) */ /* UNVOICED WB */
+ {2316, 3351, 0, 2808, 0, 0, },
+ {1913, 2615, 1491, 2370, 3475, 0, },
+ {1706, 2380, 1348, 2357, 3455, 0, },
+ {1538, 2114, 1225, 2357, 3455, 0, },
+ {1452, 2058, 1167, 2171, 3629, 5569, },
+ {1528, 2050, 1231, 2056, 3693, 5923, },
+ {1522, 2048, 1227, 1917, 3811, 5886, },
+ {1587, 1257, 2124, 1630, 2671, 3901, }, /* 39 (38.301) */ /* VOICED 16k */
+ {1831, 2742, 5220, 2679, 5327, 0, },
+ {1475, 2073, 3273, 3097, 1896, 4377, },
+ {1395, 1993, 3377, 2828, 1794, 4360, },
+ {1401, 1974, 3359, 2392, 3637, 1612, },
+ {1368, 1915, 3176, 2081, 3109, 1458, },
+ {1350, 1866, 2918, 2738, 1821, 1315, },
+ {1350, 1866, 2918, 1718, 2636, 1243, }, /* 37 (36.989) */ /* GENERIC 16k*/
+ {3344, 0, 0, 3455, 0, 0, },
+ {2204, 3666, 6025, 3455, 0, 0, },
+ {1708, 2517, 3871, 3455, 0, 0, },
+ {1921, 2875, 4409, 2675, 5386, 0, },
+ {2744, 1815, 4751, 2675, 5386, 0, },
+ {1706, 2560, 3908, 2675, 5386, 0, },
+ {1706, 2484, 3836, 2304, 3766, 5773, },
+ {1567, 2380, 3461, 2097, 3559, 5812, },
+ {1485, 2150, 3668, 3031, 1888, 6357, },
+ {1458, 2073, 3172, 3060, 1849, 6889, },
+ {1350, 1898, 2779, 3060, 1849, 6889, },
+ {1683, 1257, 2638, 1864, 3090, 4618, },
+ {1722, 1278, 2617, 2378, 1561, 3703, },
+ {1716, 1274, 2593, 2212, 1456, 3502, },
+ {1704, 1268, 2611, 1921, 2929, 1319, }, /* 37 (36.971) */ /* GENERIC 12.8k MA*/
+ {1810, 2763, 5263, 2691, 5343, 0, },
+ {1456, 2085, 3308, 3035, 1886, 7027, },
+
+ {1391, 1995, 3398, 1942, 3172, 7062, },
+
+ {1702, 1266, 3033, 1911, 3101, 4731, },
+ {1671, 1249, 2871, 2920, 1796, 4639, },
+ {1612, 2574, 1221, 1759, 2963, 4979, },
+ {1612, 2574, 1221, 2265, 1505, 3398}, /* 37 (36.993) */ /* AUDIO 16k */
+
+};
+
+const Word16 sigma_MSLVQ_fx[][16] =
+{//Qlog2(2.56)
+ {3},
+ {3},
+ {107, 113, 160, 185, 202, 211, 219, 222, 222, 217, 218, 270, 327, 176, 66, 43},
+ {125, 130, 182, 185, 191, 199, 204, 207, 205, 191, 179, 227, 305, 261, 95, 64},
+ {123, 123, 176, 197, 207, 218, 228, 235, 232, 218, 209, 272, 342, 216, 89, 68},
+ {219, 212, 255, 271, 273, 274, 260, 255, 250, 248, 249, 302, 328, 394, 85, 37},
+ {3},
+ {3},
+ {113, 134, 220, 253, 260, 275, 274, 287, 304, 323, 321, 325, 349, 350, 376, 332},
+ {158, 179, 242, 248, 246, 259, 257, 267, 278, 274, 276, 289, 309, 309, 312, 306},
+ {146, 146, 222, 256, 261, 278, 290, 302, 318, 313, 323, 352, 394, 407, 415, 399},
+ {217, 227, 287, 303, 316, 310, 296, 304, 303, 305, 317, 327, 355, 321, 305, 279},
+ {3},
+ {3},
+ {193, 216, 283, 320, 343, 359, 375, 408, 413, 445, 479, 489, 502, 466, 456, 479},
+ {230, 238, 312, 330, 334, 329, 339, 357, 353, 358, 391, 403, 441, 459, 379, 497},
+ {231, 277, 304, 322, 347, 353, 366, 372, 373, 397, 438, 451, 424, 413, 381, 447},
+ {264, 287, 364, 386, 384, 373, 382, 373, 393, 403, 448, 438, 403, 430, 401, 586},
+ {224, 298, 262, 264, 258, 244, 260, 283, 313, 295, 275, 279, 260, 286, 286, 399},
+ {411, 314, 301, 332, 335, 343, 356, 409, 430, 413, 363, 364, 338, 332, 315, 412},
+ {136, 269, 343, 367, 405, 430, 411, 421, 444, 466, 435, 423, 328, 247, 235, 240},
+ {178, 433, 305, 268, 258, 252, 253, 246, 250, 250, 245, 256, 242, 273, 300, 371},
+ {349, 334, 335, 341, 336, 331, 343, 425, 505, 722, 783, 655,1006, 862, 346, 248},
+ {315, 306, 323, 306, 300, 278, 276, 287, 380, 394, 327, 333, 339, 382, 370, 626},
+ {236, 250, 241, 231, 241, 245, 238, 221, 215, 190, 181, 178, 183, 428, 184, 55},
+ {113, 189, 360, 312, 332, 326, 296, 268, 272, 282, 320, 275, 219, 203, 179, 143},
+ {273, 255, 245, 237, 242, 236, 214, 217, 223, 260, 233, 193, 187, 183, 174, 163},
+ {111, 321, 275, 219, 213, 207, 202, 205, 205, 225, 239, 208, 192, 187, 168, 152},
+ {383, 326, 300, 287, 290, 292, 276, 251, 258, 291, 430, 521, 397, 305, 274, 269},
+ {152, 221, 271, 291, 344, 310, 308, 257, 252, 256, 339, 491, 499, 199, 179, 107},
+ {226, 237, 236, 239, 250, 238, 228, 223, 227, 241, 311, 312, 299, 313, 421, 360},
+ {221, 238, 214, 220, 246, 244, 232, 221, 210, 208, 200, 229, 368, 431, 106, 71},
+ {249, 259, 267, 283, 278, 275, 251, 237, 203, 209, 198, 279, 543, 509, 122, 90},
+ {192, 249, 256, 235, 231, 230, 213, 215, 210, 247, 284, 237, 214, 210, 199, 181},
+};
+
+/* An 16-by-33 matrix in Scale = 32768.00f */
+const Word16 inv_sigma_MSLVQ_fx[][16] =//Q15
+{
+ {32767},
+ {32767},
+ {783, 746, 523, 453, 416, 397, 384, 378, 378, 386, 384, 310, 256, 477, 1273, 1935},
+ {670, 647, 461, 452, 440, 421, 412, 405, 410, 440, 468, 369, 275, 321, 883, 1305},
+ {679, 682, 477, 426, 405, 385, 368, 357, 362, 385, 401, 308, 245, 388, 942, 1231},
+ {383, 395, 329, 309, 307, 307, 322, 329, 335, 338, 337, 278, 256, 213, 989, 2243},
+ {32767},
+ {32767},
+ {740, 628, 382, 332, 322, 305, 306, 292, 276, 259, 261, 258, 240, 240, 223, 253},
+ {530, 469, 346, 338, 341, 323, 326, 314, 302, 306, 304, 290, 271, 272, 269, 274},
+ {576, 576, 378, 327, 322, 302, 289, 278, 264, 268, 259, 238, 213, 206, 202, 210},
+ {386, 370, 292, 277, 266, 271, 284, 276, 276, 275, 264, 257, 236, 262, 275, 300},
+ {32767},
+ {32767},
+ {435, 389, 296, 262, 244, 233, 223, 205, 203, 188, 175, 172, 167, 180, 184, 175},
+ {365, 352, 268, 254, 251, 255, 247, 235, 237, 234, 214, 208, 190, 183, 221, 169},
+ {363, 302, 276, 261, 241, 237, 229, 226, 225, 211, 191, 186, 198, 203, 220, 188},
+ {318, 292, 230, 218, 218, 225, 219, 225, 213, 208, 187, 192, 208, 195, 209, 143},
+ {374, 281, 320, 318, 325, 344, 322, 296, 268, 284, 305, 301, 322, 294, 293, 210},
+ {204, 267, 279, 253, 250, 245, 235, 205, 195, 203, 231, 231, 248, 252, 266, 204},
+ {616, 312, 245, 229, 207, 195, 204, 199, 189, 180, 193, 198, 256, 340, 356, 349},
+ {471, 194, 275, 313, 325, 333, 332, 342, 335, 336, 342, 328, 347, 307, 280, 226},
+ {241, 251, 250, 246, 250, 254, 245, 197, 166, 116, 107, 128, 83, 97, 242, 339},
+ {266, 274, 259, 274, 279, 302, 304, 292, 221, 213, 257, 252, 247, 219, 227, 134},
+ {355, 336, 348, 363, 348, 342, 353, 379, 391, 442, 462, 472, 458, 196, 456,1518},
+ {744, 443, 233, 269, 253, 257, 283, 313, 308, 298, 262, 305, 383, 413, 469, 585},
+ {308, 330, 343, 353, 347, 356, 392, 387, 376, 322, 359, 435, 448, 458, 482, 514},
+ {756, 261, 305, 384, 394, 406, 415, 409, 409, 372, 352, 403, 438, 448, 498, 552},
+ {219, 257, 280, 293, 289, 288, 304, 335, 325, 289, 195, 161, 211, 275, 306, 312},
+ {550, 380, 309, 288, 244, 271, 272, 326, 332, 328, 248, 171, 168, 421, 468, 781},
+ {371, 355, 356, 350, 336, 353, 368, 376, 369, 348, 269, 269, 281, 268, 199, 233},
+ {380, 353, 392, 381, 342, 344, 362, 379, 399, 403, 420, 367, 228, 195, 789,1184},
+ {337, 324, 314, 297, 301, 305, 335, 354, 414, 401, 425, 301, 154, 165, 690, 927},
+ {438, 337, 327, 357, 363, 365, 394, 390, 400, 340, 295, 354, 392, 399, 421, 462},
+};
+
+/* An 16-by-19 matrix in Scale = 32768.00f */
+const Word16 inv_sigma_p_fx[][16] =//Q15
+{
+ {552, 513, 469, 494, 486, 478, 492, 496, 496, 482, 480, 388, 339, 276, 743, 760},
+ {640, 492, 472, 478, 482, 471, 470, 471, 623, 504, 501, 477, 459, 425, 421, 408},
+ {1001, 939, 696, 589, 545, 480, 456, 451, 444, 462, 472, 424, 342, 441, 1567, 3002},
+ {609, 534, 419, 432, 444, 403, 406, 407, 391, 425, 452, 378, 269, 278, 818, 1939},
+ {32767},
+ {574, 507, 459, 432, 425, 415, 440, 442, 449, 450, 490, 443, 299, 270, 1377, 2451},
+ {591, 499, 456, 457, 449, 441, 448, 446, 443, 436, 420, 397, 364, 342, 496, 475},
+ {482, 512, 498, 426, 280, 225, 422, 1411, 404, 404, 402, 385, 364, 342, 355, 361},
+ {917, 831, 572, 507, 482, 430, 406, 399, 385, 365, 364, 344, 313, 309, 311, 335},
+ {533, 436, 371, 399, 398, 368, 367, 348, 343, 342, 338, 319, 306, 305, 311, 334},
+ {32767},
+ {641, 523, 458, 434, 415, 410, 412, 395, 397, 394, 386, 381, 366, 392, 413, 419},
+ {449, 380, 364, 366, 354, 362, 362, 356, 337, 323, 293, 296, 336, 352, 353, 283},
+ {32767},
+ {601, 485, 348, 262, 267, 266, 276, 285, 255, 233, 227, 235, 216, 237, 233, 212},
+ {338, 279, 247, 244, 233, 239, 231, 232, 228, 215, 194, 194, 207, 210, 222, 180},
+ {32767},
+ {594, 466, 394, 376, 362, 358, 346, 350, 336, 332, 313, 329, 343, 358, 370, 419},
+ {471, 409, 323, 325, 308, 295, 305, 290, 281, 280, 271, 262, 251, 255, 266, 312},
+};
+
+const Word16 sigma_p_fx[][16] =
+{//Qlog2(2.56)
+ {152, 164, 179, 170, 172, 176, 171, 169, 169, 174, 175, 216, 247, 304, 113, 110},
+ {131, 171, 178, 176, 174, 178, 178, 178, 135, 166, 167, 176, 183, 197, 199, 206},
+ {84, 89, 120, 142, 154, 175, 184, 186, 189, 181, 178, 198, 245, 190, 54, 28},
+ {138, 157, 200, 194, 189, 208, 207, 206, 214, 197, 186, 222, 311, 302, 103, 43},
+ {3},
+ {146, 165, 183, 194, 197, 202, 191, 190, 187, 186, 171, 189, 281, 311, 61, 34},
+ {142, 168, 184, 183, 187, 190, 187, 188, 189, 193, 200, 212, 231, 245, 169, 177},
+ {174, 164, 168, 197, 300, 372, 199, 59, 208, 208, 209, 218, 231, 246, 237, 232},
+ {91, 101, 147, 165, 174, 195, 207, 210, 218, 230, 230, 244, 268, 272, 269, 250},
+ {157, 192, 226, 210, 211, 228, 228, 241, 245, 246, 248, 263, 274, 275, 270, 251},
+ {3},
+ {131, 160, 183, 193, 202, 205, 203, 212, 212, 213, 217, 220, 229, 214, 203, 200},
+ {187, 221, 231, 229, 237, 232, 232, 236, 249, 259, 286, 284, 250, 238, 238, 296},
+ {3},
+ {140, 173, 241, 320, 314, 315, 304, 295, 329, 359, 369, 357, 388, 354, 359, 396},
+ {248, 300, 339, 344, 360, 350, 363, 361, 368, 391, 431, 433, 406, 400, 377, 467},
+ {3},
+ {141, 180, 213, 223, 232, 234, 242, 240, 250, 253, 268, 255, 245, 235, 227, 200},
+ {178, 205, 259, 258, 273, 285, 275, 289, 299, 300, 310, 320, 335, 329, 316, 269},
+};
+
+const Word16 sigma_p_ivas_fx[][16] =
+{//Qlog2(2.56)
+ {152, 164, 179, 170, 172, 176, 171, 169, 169, 174, 175, 216, 247, 304, 113, 110},
+ {131, 171, 178, 176, 174, 178, 178, 178, 135, 166, 167, 176, 183, 197, 199, 206},
+ {84, 89, 120, 142, 154, 175, 184, 186, 189, 181, 178, 198, 245, 190, 54, 28},
+ {138, 157, 200, 194, 189, 208, 207, 206, 214, 197, 186, 222, 311, 302, 103, 43},
+ {3},
+ {146, 165, 183, 194, 197, 202, 191, 190, 187, 186, 171, 189, 281, 311, 61, 34},
+ {142, 168, 184, 183, 187, 190, 187, 188, 189, 193, 200, 212, 231, 245, 169, 177},
+ {174, 164, 168, 197, 300, 372, 199, 59, 208, 208, 209, 218, 231, 246, 237, 232},
+ {91, 101, 147, 165, 174, 195, 207, 210, 218, 230, 230, 244, 268, 272, 269, 250},
+ {157, 192, 226, 210, 211, 228, 228, 241, 245, 246, 248, 263, 274, 275, 270, 251},
+ {3},
+ {131, 160, 183, 193, 202, 205, 203, 212, 212, 213, 217, 220, 229, 214, 203, 200},
+ {187, 221, 231, 229, 237, 232, 232, 236, 249, 259, 286, 284, 250, 238, 238, 296},
+ {3},
+ {127, 173, 226, 217, 264, 256, 290, 295, 297, 325, 334, 326, 302, 290, 275, 254},
+ {248, 300, 339, 344, 360, 350, 363, 361, 368, 391, 431, 433, 406, 400, 377, 467},
+ {3},
+ {141, 180, 213, 223, 232, 234, 242, 240, 250, 253, 268, 255, 245, 235, 227, 200},
+ {178, 205, 259, 258, 273, 285, 275, 289, 299, 300, 310, 320, 335, 329, 316, 269},
+};
+
+const Word16 inv_sigma_p_ivas_fx[][16] =
+{//Qlog2(2.56)
+ {552, 513, 470, 494, 487, 478, 492, 496, 496, 482, 480, 389, 339, 276, 743, 760},
+ {640, 492, 472, 478, 482, 471, 470, 471, 623, 504, 501, 477, 459, 425, 420, 408},
+ {1002, 939, 696, 589, 545, 480, 456, 450, 444, 462, 472, 424, 342, 441, 1568, 2996},
+ {609, 534, 419, 432, 444, 403, 406, 407, 392, 425, 452, 378, 269, 278, 818, 1940},
+ {32767},
+ {575, 507, 459, 432, 425, 415, 440, 442, 449, 450, 489, 443, 299, 270, 1378, 2449},
+ {591, 499, 456, 457, 449, 441, 448, 446, 444, 435, 420, 397, 364, 342, 496, 475},
+ {482, 512, 498, 426, 280, 225, 422, 1410, 404, 404, 402, 385, 364, 342, 355, 361},
+ {918, 832, 572, 507, 482, 430, 406, 399, 385, 366, 364, 344, 313, 309, 311, 335},
+ {533, 436, 371, 399, 398, 368, 367, 348, 343, 342, 338, 319, 306, 305, 311, 334},
+ {32767},
+ {641, 523, 458, 434, 415, 410, 412, 395, 397, 394, 386, 380, 366, 392, 413, 419},
+ {449, 380, 364, 366, 355, 362, 362, 356, 337, 323, 293, 296, 336, 352, 353, 283},
+ {32767},
+ {659, 486, 371, 386, 318, 328, 289, 284, 283, 258, 251, 257, 278, 290, 305, 330},
+ {338, 279, 247, 244, 233, 239, 231, 232, 228, 215, 194, 194, 207, 210, 222, 180},
+ {32767},
+ {594, 466, 394, 376, 362, 358, 346, 350, 336, 332, 313, 329, 343, 358, 370, 419},
+ {471, 409, 323, 325, 308, 295, 304, 290, 281, 280, 271, 262, 251, 255, 266, 312}
+};
+
+const Word8 leaders_short[][MAX_NO_SCALES] = // Q0
+{{ 0, 0, 0},
+{ 1, 0, 0},
+{ 15, 3, 3},
+{ 2, 2, 0},
+{ 2, 0, 0},
+{ 2, 1, 0},
+{ 4, 0, 0},
+{ 9, 7, 6},
+{ 4, 1, 0},
+{ 5, 2, 0},
+{ 6, 3, 2},
+{ 5, 3, 1},
+{ 8, 3, 0},
+{ 9, 3, 0},
+{ 2, 2, 1},
+{ 9, 8, 5},
+{ 5, 5, 0},
+{ 17, 3, 0},
+{ 5, 2, 1},
+{ 7, 3, 0},
+{ 5, 4, 0},
+{ 5, 5, 1},
+{ 2, 2, 2},
+{ 4, 2, 2},
+{ 5, 2, 2},
+{ 6, 6, 5},
+{ 5, 3, 2},
+{ 6, 3, 0},
+{ 12, 3, 2},
+{ 15, 3, 2},
+{ 19, 3, 2},
+{ 7, 6, 3},
+{ 5, 4, 2},
+{ 9, 8, 2},
+{ 6, 5, 2},
+{ 5, 4, 1},
+{ 9, 9, 3},
+{ 6, 6, 2},
+{ 8, 6, 2},
+{ 8, 7, 2},
+{ 8, 8, 2},
+{ 4, 2, 0},
+{ 11, 8, 2},
+{ 13, 11, 2},
+{ 5, 5, 2},
+{ 16, 13, 2},
+{ 13, 12, 2},
+{ 18, 17, 2},
+{ 21, 17, 2},
+{ 18, 16, 2},
+{ 32, 28, 2},
+{ 8, 8, 4},
+{ 7, 5, 2},
+{ 13, 11, 9},
+{ 38, 31, 2},
+{ 4, 4, 2},
+{ 8, 8, 3},
+{ 9, 8, 3},
+{ 8, 5, 2},
+{ 10, 9, 3},
+{ 11, 10, 3},
+{ 13, 10, 3},
+{ 22, 10, 3},
+{ 23, 10, 3},
+{ 13, 11, 3},
+{ 15, 13, 3},
+{ 35, 15, 3},
+{ 32, 16, 3},
+{ 5, 5, 4},
+{ 8, 7, 4},
+{ 33, 31, 2},
+{ 9, 9, 4},
+{ 16, 12, 4},
+{ 17, 13, 4},
+{ 5, 5, 5},
+{ 7, 5, 5},
+{ 4, 3, 2},
+{ 8, 6, 5},
+{ 9, 6, 5},
+{ 9, 7, 5},
+{ 8, 8, 5},
+{ 3, 2, 0},
+{ 10, 8, 5},
+{ 11, 8, 5},
+{ 12, 8, 5},
+{ 13, 8, 5},
+{ 16, 8, 5},
+{ 18, 8, 5},
+{ 10, 9, 5},
+{ 18, 9, 5},
+{ 23, 21, 2},
+{ 13, 8, 8},
+{ 14, 10, 5},
+{ 11, 11, 5},
+{ 13, 11, 5},
+{ 13, 13, 5},
+{ 14, 13, 5},
+{ 15, 13, 5},
+{ 16, 13, 5},
+{ 17, 13, 5},
+{ 18, 13, 5},
+{ 18, 16, 5},
+{ 18, 17, 5},
+{ 19, 18, 5},
+{ 13, 10, 5},
+{ 21, 21, 5},
+{ 23, 21, 5},
+{ 24, 21, 5},
+{ 25, 23, 5},
+{ 32, 23, 5},
+{ 11, 10, 5},
+{ 8, 8, 6},
+{ 5, 5, 7},
+{ 8, 7, 7},
+{ 8, 8, 7},
+{ 10, 8, 7},
+{ 13, 8, 7},
+{ 10, 9, 7},
+{ 13, 11, 7},
+{ 9, 8, 8},
+{ 12, 8, 8},
+{ 23, 18, 5},
+{ 9, 9, 8},
+{ 11, 9, 8},
+{ 13, 9, 8},
+{ 18, 10, 8},
+{ 26, 10, 8},
+{ 27, 10, 8},
+{ 31, 10, 8},
+{ 40, 21, 11},
+{ 13, 11, 8},
+{ 13, 12, 8},
+{ 14, 12, 8},
+{ 18, 12, 8},
+{ 13, 13, 8},
+{ 14, 13, 8},
+{ 16, 13, 8},
+{ 18, 13, 8},
+{ 18, 16, 8},
+{ 18, 17, 8},
+{ 23, 18, 8},
+{ 23, 21, 8},
+{ 24, 21, 8},
+{ 28, 23, 8},
+{ 31, 31, 8},
+{ 36, 31, 8},
+{ 38, 31, 8},
+{ 11, 9, 9},
+{ 12, 9, 9},
+{ 13, 9, 9},
+{ 12, 11, 9},
+{ 42, 31, 2},
+{ 14, 12, 9},
+{ 13, 13, 9},
+{ 14, 13, 9},
+{ 16, 13, 9},
+{ 17, 13, 9},
+{ 18, 13, 9},
+{ 18, 14, 9},
+{ 18, 18, 9},
+{ 26, 25, 9},
+{ 13, 11, 10},
+{ 18, 12, 10},
+{ 18, 13, 10},
+{ 21, 14, 10},
+{ 22, 16, 10},
+{ 18, 18, 10},
+{ 23, 18, 10},
+{ 24, 18, 10},
+{ 24, 21, 10},
+{ 23, 22, 10},
+{ 24, 23, 10},
+{ 32, 25, 10},
+{ 34, 28, 10},
+{ 42, 31, 10},
+{ 17, 11, 11},
+{ 18, 13, 11},
+{ 21, 13, 11},
+{ 18, 17, 11},
+{ 18, 18, 11},
+{ 48, 35, 24},
+{ 18, 17, 12},
+{ 18, 18, 12},
+{ 20, 18, 12},
+{ 39, 30, 12},
+{ 31, 31, 12},
+{ 43, 34, 12},
+{ 16, 13, 13},
+{ 17, 13, 13},
+{ 16, 16, 13},
+{ 18, 17, 13},
+{ 20, 18, 13},
+{ 22, 18, 13},
+{ 23, 18, 13},
+{ 22, 21, 13},
+{ 23, 23, 13},
+{ 24, 23, 13},
+{ 43, 36, 13},
+{ 43, 40, 13},
+{ 43, 41, 13},
+{ 31, 30, 18},
+{ 24, 21, 14},
+{ 31, 31, 14},
+{ 23, 18, 16},
+{ 23, 23, 16},
+{ 31, 25, 16},
+{ 31, 29, 16},
+{ 45, 35, 16},
+{ 23, 21, 17},
+{ 23, 22, 17},
+{ 23, 23, 17},
+{ 31, 31, 17},
+{ 21, 18, 18},
+{ 23, 21, 18},
+{ 23, 22, 18},
+{ 27, 23, 18},
+{ 29, 23, 18},
+{ 32, 23, 18},
+{ 31, 27, 18},
+{ 30, 28, 18},
+{ 31, 28, 18},
+{ 43, 42, 13},
+{ 31, 31, 18},
+{ 32, 31, 18},
+{ 36, 31, 18},
+{ 46, 48, 18},
+{ 46, 32, 19},
+{ 43, 38, 19},
+{ 43, 42, 19},
+{ 32, 32, 20},
+{ 27, 23, 21},
+{ 31, 23, 21},
+{ 31, 24, 21},
+{ 32, 30, 21},
+{ 32, 31, 21},
+{ 43, 33, 21},
+{ 43, 34, 21},
+{ 24, 23, 23},
+{ 32, 32, 23},
+{ 48, 40, 23},
+{ 48, 46, 23},
+{ 28, 24, 24},
+{ 32, 31, 24},
+{ 34, 32, 24},
+{ 36, 32, 24},
+{ 48, 32, 24},
+{ 35, 10, 8},
+{ 40, 28, 25},
+{ 45, 31, 25},
+{ 44, 32, 25},
+{ 31, 31, 27},
+{ 39, 32, 27},
+{ 44, 32, 27},
+{ 32, 32, 28},
+{ 43, 32, 28},
+{ 48, 32, 28},
+{ 36, 36, 28},
+{ 48, 45, 28},
+{ 40, 32, 29},
+{ 44, 34, 30},
+{ 40, 32, 31},
+{ 41, 32, 31},
+{ 42, 32, 31},
+{ 44, 43, 31},
+{ 48, 37, 32},
+{ 48, 39, 32},
+{ 46, 43, 32},
+{ 48, 48, 34},
+{ 48, 36, 35},
+{ 48, 41, 35},
+{ 47, 43, 36},
+{ 48, 48, 37},
+{ 48, 48, 40},
+{ 48, 48, 45},
+{ 48, 48, 47},
+{ 48, 48, 48}};
+
+const UWord8 no_lead_idx[][2] = { // Q0
+{ 1, 1},
+{ 4, 1},
+{ 41, 1},
+{ 41, 4},
+{ 52, 32},
+{ 56, 38},
+{ 41, 1},
+{ 6, 5},
+{119, 14},
+{ 58, 18},
+{138, 21},
+{169, 40},
+{ 4, 4},
+{ 41, 1},
+{ 35, 1},
+{ 35, 4},
+{ 52, 4},
+{ 18, 8},
+{ 44, 41},
+{ 58, 6},
+{ 58, 9},
+{ 69, 26},
+{ 51, 34},
+{ 85, 34},
+{ 85, 38},
+{ 85, 42},
+{139, 40},
+{142, 33},
+{140, 64},
+{141, 73},
+{236, 124},
+{235, 133},
+{211, 160},
+{ 4, 3},
+{ 41, 1},
+{ 52, 3},
+{ 39, 3},
+{ 42, 3},
+{153, 3},
+{118, 9},
+{158, 44},
+{202, 93},
+{250, 201},
+{ 20, 0},
+{ 52, 0},
+{ 1, 1},
+{ 4, 1},
+{ 4, 4},
+{ 4, 4},
+{ 41, 1},
+{ 41, 4},
+{ 20, 4},
+{ 52, 4},
+{ 39, 4},
+{ 44, 41},
+{ 58, 6},
+{ 80, 41},
+{114, 9},
+{124, 9},
+{130, 21},
+{124, 58},
+{165, 34},
+{164, 39},
+{169, 40},
+{ 35, 0},
+{ 4, 4},
+{ 35, 1},
+{ 35, 4},
+{ 52, 4},
+{ 58, 5},
+{ 15, 5},
+{135, 3},
+{116, 41},
+{124, 24},
+{137, 24},
+{177, 26},
+{194, 44},
+{208, 52},
+{230, 58},
+{ 4, 4},
+{ 41, 1},
+{ 41, 4},
+{ 20, 4},
+{ 8, 6},
+{ 9, 8},
+{ 44, 41},
+{ 58, 6},
+{ 58, 9},
+{114, 9},
+{124, 9},
+{ 92, 21},
+{124, 58},
+{ 92, 51},
+{104, 91},
+{141, 51},
+{121, 91},
+{ 4, 3},
+{ 41, 1},
+{ 52, 3},
+{ 69, 3},
+{ 83, 3},
+{ 87, 3},
+{ 86, 44},
+{143, 74},
+{144, 112},
+{179, 78},
+{196, 78},
+{196, 78},
+{224, 78},
+{ 4, 3},
+{ 41, 1},
+{ 20, 1},
+{ 20, 4},
+{ 52, 4},
+{ 52, 3},
+{111, 5},
+{132, 4},
+{ 57, 41},
+{123, 41},
+{214, 3},
+{183, 81},
+{215, 41},
+{213, 32},
+{219, 44},
+{233, 52},
+{ 7, 52},
+{ 3, 57},
+{ 14, 59},
+{ 11, 53},
+{ 62, 0},
+{ 37, 4},
+{ 37, 3},
+{ 63, 3},
+{ 67, 3},
+{184, 3},
+{123, 41},
+{ 19, 124},
+{ 39, 4},
+{ 44, 41},
+{ 58, 6},
+{ 58, 9},
+{ 58, 44},
+{115, 32},
+{ 95, 16},
+{102, 21},
+{ 99, 38},
+{126, 58},
+{141, 57},
+{206, 56},
+{205, 120},
+{226, 124},
+{226, 133},
+{225, 182},
+{152, 3},
+{ 65, 3},
+{ 17, 14},
+{ 61, 22},
+{135, 3},
+{ 19, 11},
+{ 76, 25},
+{ 41, 36},
+{ 41, 33},
+{ 41, 7},
+{ 27, 10},
+{ 81, 15},
+{ 3, 2},
+{ 41, 36},
+{ 55, 31},
+{ 81, 7},
+};
+const UWord8 no_lead_p_idx[][2] = { // Q0
+ { 5, 0},
+{ 3, 0},
+{ 41, 0},
+{ 35, 0},
+{ 52, 0},
+{ 1, 1},
+{ 4, 1},
+{ 4, 4},
+{ 3, 4},
+{ 41, 1},
+{ 41, 4},
+{ 35, 4},
+{ 52, 4},
+{ 39, 4},
+{ 44, 41},
+{ 58, 6},
+{ 80, 41},
+{ 15, 9},
+{ 94, 9},
+{110, 34},
+{ 96, 52},
+{ 98, 39},
+{105, 58},
+{107, 51},
+{105, 104},
+{109, 94},
+{145, 98},
+{207, 100},
+{239, 103},
+{240, 108},
+{207, 146},
+{ 4, 0},
+{ 41, 4},
+{ 39, 3},
+{ 94, 5},
+{ 80, 41},
+{ 94, 18},
+{ 94, 44},
+{ 96, 52},
+{106, 44},
+{121, 58},
+{107, 51},
+{199, 15},
+{197, 104},
+{198, 156},
+{221, 200},
+{ 4, 1},
+{ 3, 1},
+{ 3, 4},
+{ 41, 1},
+{ 35, 1},
+{ 35, 4},
+{ 52, 4},
+{ 39, 4},
+{ 88, 4},
+{135, 4},
+{135, 3},
+{190, 3},
+{155, 41},
+{135, 20},
+{190, 32},
+{194, 44},
+{231, 44},
+{230, 58},
+{231, 15},
+{242, 83},
+{253, 130},
+{ 4, 1},
+{ 32, 1},
+{ 58, 5},
+{ 39, 3},
+{ 43, 5},
+{ 45, 3},
+{ 48, 3},
+{ 46, 44},
+{ 49, 44},
+{ 90, 44},
+{ 50, 44},
+{ 54, 52},
+{ 70, 51},
+{151, 122},
+{151, 53},
+{ 52, 4},
+{ 39, 4},
+{ 83, 4},
+{ 89, 4},
+{ 80, 41},
+{ 85, 41},
+{100, 8},
+{101, 9},
+{ 85, 38},
+{ 85, 15},
+{195, 52},
+{234, 52},
+{217, 15},
+{254, 15},
+{251, 104},
+{ 10, 153},
+{ 18, 157},
+{ 19, 192},
+{ 19, 237},
+{ 19, 0},
+{ 52, 4},
+{153, 3},
+{159, 3},
+{171, 32},
+{185, 44},
+{186, 68},
+{ 85, 15},
+{220, 44},
+{218, 75},
+{227, 75},
+{ 1, 77},
+{228, 147},
+{ 15, 150},
+{ 18, 187},
+{ 16, 212},
+{ 16, 241},
+{ 17, 248},
+{ 4, 3},
+{ 52, 4},
+{ 52, 3},
+{161, 3},
+{166, 3},
+{149, 9},
+{247, 47},
+{178, 0},
+{ 41, 1},
+{ 20, 1},
+{ 20, 4},
+{ 52, 4},
+{ 58, 5},
+{117, 4},
+{117, 3},
+{153, 3},
+{182, 3},
+{204, 3},
+{162, 9},
+{163, 44},
+{167, 44},
+{173, 44},
+{254, 44},
+{ 12, 52},
+{254, 15},
+{ 13, 82},
+{244, 188},
+{ 3, 4},
+{ 52, 4},
+{ 58, 5},
+{153, 3},
+{190, 3},
+{209, 3},
+{243, 189},
+{ 41, 1},
+{ 20, 1},
+{ 39, 4},
+{ 88, 4},
+{ 97, 4},
+{138, 21},
+{ 6, 44},
+{ 1, 1},
+{ 4, 1},
+{ 4, 4},
+{ 5, 4},
+{ 41, 1},
+{ 41, 4},
+{ 20, 4},
+{ 52, 4},
+{ 39, 4},
+{ 83, 4},
+{135, 4},
+{ 80, 41},
+{116, 41},
+{136, 41},
+{110, 34},
+{ 13, 6},
+{113, 41},
+{114, 18},
+{ 91, 24},
+{125, 24},
+{127, 24},
+{163, 12},
+{168, 13},
+{172, 13},
+{128, 84},
+{174, 28},
+{252, 29},
+{249, 30},
+{246, 129},
+{246, 180},
+{ 9, 66},
+{110, 41},
+{155, 41},
+{154, 20},
+{158, 44},
+{203, 21},
+{232, 44},
+{210, 39},
+{223, 79},
+{222, 123},
+{229, 131},
+{238, 139},
+{238, 170},
+{ 4, 4},
+{ 4, 4},
+{ 41, 1},
+{ 20, 1},
+{ 20, 4},
+{ 52, 4},
+{ 39, 4},
+{ 88, 4},
+{135, 4},
+{ 80, 41},
+{110, 41},
+{136, 41},
+{134, 32},
+{176, 44},
+{193, 44},
+{195, 52},
+{210, 39},
+{242, 39},
+{ 6, 71},
+{ 2, 148},
+{ 4, 175},
+{ 5, 191},
+{110, 41},
+{204, 3},
+{216, 22},
+{210, 23},
+{195, 32},
+{220, 44},
+{210, 39},
+{222, 33},
+{245, 57},
+{255, 60},
+{ 8, 72},
+{ 8, 181},
+};
+
+const Word16 min_lat_bits_SN[] = {-1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 };
+//Q0
+const Word16 min_lat_bits_SN_fx[] = { -1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 };
+
+const Word16 min_lat_bits_pred[] = {17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16};
+//Q0
+const Word16 min_lat_bits_pred_fx[] = { 17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16 };
+
+const Word16 offset_lvq_modes_SN[] = {-1,-1,33,64,96, 129,-1,-1,12,43,79,109,-1,-1,137,-1,107,135,
+ 112
+ }; /* CNG */
+//Q0
+const Word16 offset_lvq_modes_SN_fx[] = { -1,-1,26,51,77,96,-1,-1,12,36,66,90,-1,-1,105,-1,88,102,112 }; /* CNG */
+
+const Word16 offset_lvq_modes_pred[] = {119, 153, 31, 67, -1, 102, 126, 160, 0, 46, -1, 82, 146, -1, 175, 191, -1, 225, 203};
+//Qlog2(1.6)
+const Word16 offset_lvq_modes_pred_fx[] = { 74, 95, 15, 45, -1, 66, 81, 102, 0, 30, -1, 60, 88, -1, 109, 117, -1, 139, 124 };
+
+const Word16 offset_in_lvq_mode_SN[][21] =
+{
+ {0}, /* I NB */
+ {0,1,1,1,1,1,2,3,3,3,3,4,4,4,5}, /* UV NB*/
+ {0,1,1,1,1,2,3,4,5,5,6,6,7,7,7,7,7,8,8,8,9}, /* V NB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
+ {0,1,1,1,1,2,3,4,5,5,5,6,6,6,7,8}, /* T NB */
+ {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
+ {0}, /* I WB */
+ {0}, /* UV WB*/
+ {1}, /* V WB */ /* granularity 1 */
+ {1}, /* G WB */ /* granularity 1 */
+ {1}, /* T WB */ /* granularity 1 */
+ {1}, /* A WB */ /* granularity 1 */
+ {0}, /* I 16k */
+ {0}, /* UV 16k */
+ {1}, /* V 16k */ /* granularity 1 */
+ {0}, /* G 16k */
+ {0,1}, /* T 16k */
+ {0}, /* A 16k */
+};
+
+const Word16 offset_in_lvq_mode_SN_fx[][21] =
+{//Q0
+ {0}, /* I NB */
+ {0,1,1,1,1,1,2,3,3,3,3,4,4,4,5}, /* UV NB*/
+ {0,1,1,1,1,2,3,4,5,5,6,6,7,7,7,7,7,8,8,8,9}, /* V NB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
+ {0,1,1,1,1,2,3,4,5,5,5,6,6,6,7,8}, /* T NB */
+ {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
+ {0}, /* I WB */
+ {0,1,1,1,2,3,3,3,3,3,3,4,4,4,5}, /* UV WB*/
+ {0,1,1,1,2,3,3,3,4,5,6,7,8,9,9,10,11,12,12,12,13}, /* V WB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G WB */
+ {0,1,1,1,2,3,3,4,5,5,5,6,6,7,8,9,10}, /* T WB */
+ {0,0,0,0,1,2,2,2,3,4,4,4,4,4,4,4,4,4,4,5}, /* A WB */
+ {0},
+ {0},
+ {0,0,0,0,0,0,1,2,3,3,4,5,6,6,6,7}, /* V 16k */
+ {0}, /* G 16k */
+ {0,1}, /* T 16k */
+ {0}, /*{0,0,0,0,0,0,0,0,0,0,1} */ /* A 16k */
+};
+
+const Word16 offset_in_lvq_mode_pred[][32] =
+{
+ {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I NB */
+ {0,1,1,1,2,3,4,4,4,4,4,5,5,5,6}, /* UV NB */
+ {0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,3,4,4,5,6,7,8,9,10,10,11,12,13,13,13,14}, /* V NB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
+ {0}, /* T NB */
+ {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
+ {1}, /* I WB */
+ {1}, /* UV WB */ /* granularity 1 */
+ {1}, /* V WB */ /* granularity 1 */
+ {1}, /* G WB */
+ {0}, /* T WB */
+ {1}, /* A WB */
+ {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I 16k */
+ {0}, /* UV 16k */
+ {1}, /* V 16k */
+ {1}, /* G 16k */
+ {0}, /* T 16k */
+ {1}, /* A 16k */
+ {1}, /* G WB MA*/
+};
+
+const Word16 offset_in_lvq_mode_pred_fx[][32] =
+{//Q0
+ {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I NB */
+ {0,1,1,1,2,3,4,4,4,4,4,5,5,5,6}, /* UV NB */
+ {0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,3,4,4,5,6,7,8,9,10,10,11,12,13,13,13,14}, /* V NB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
+ {0}, /* T NB */
+ {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
+ {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I WB */
+ {0,1,1,1,2,3,4,4,4,4,4,5,5,5,6}, /* UV WB */
+ {0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,3,4,4,5,6,7,8,9,10,10,11,12,13,13,13,14}, /* V WB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G WB */
+ {0}, /* T WB */
+ {0,0,0,0,1,2,2,2,3,4,4,4,4,4,4,4,4,4,4,5}, /* A WB */
+ {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I 16k */
+ {0}, /* UV 16k */
+ {0,0,0,0,0,0,1,2,3,3,4,5,6,6,6,7}, /* V 16k */
+ {0,0,0,0,0,0,1,2,3,4,5,6}, /* G 16k */
+ {0}, /* T 16k */
+ {0,0,0,0,0,0,1,2,3,4,5,6}, /* A 16k */
+ {0,0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G WB MA*/
+};
+
+/*-----------------------------------------------------------------*
+ * BC-TCVQ frame-end quantization tables (BC-TCVQ is used in Voiced mode for 16kHz isf)
+ *-----------------------------------------------------------------*/
+const Word16 NTRANS[4][NUM_STATE] = {{0,2,4,6,8,10,12,14,0,2,4,6,8,10,12,14}, /* indices of previous state of first branche */
+ {1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15}, /* indices of previous state of second branches */
+ {4,2,1,3,0,2,1,3,2,0,3,1,7,0,3,1}, /* indices of previous subset of first branch */
+ {2,0,3,6,2,0,3,1,0,2,1,3,0,2,1,5} /* indices of previous subset of second branch */
+}; // Q0
+
+const Word16 NTRANS2[4][NUM_STATE] = {{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7},
+ {8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15},
+ {4,2,2,0,1,3,3,6,0,2,2,0,1,3,3,1},
+ {2,0,0,2,3,1,1,3,7,0,0,2,3,1,1,5}
+}; // Q0
+
+/* BC-TCQ Bit Allocations */
+const Word16 BC_TCVQ_BIT_ALLOC_40B[M/2+4] = {1, 4, 5,5,4,4, 2,2,2,2, 5,4 }; /*1+39bit Q0*/
+
+const Word16 FixBranch_tbl[4][4][N_STAGE_VQ - 4] =
+{
+ {{0, 0, 0, 0}, {1, 0, 0, 0}, {0, 1, 0, 0}, {1, 1, 0, 0}}, /* incase of initial state 0 */
+ {{0, 0, 1, 0}, {1, 0, 1, 0}, {0, 1, 1, 0}, {1, 1, 1, 0}}, /* incase of initial state 4 */
+ {{0, 0, 0, 1}, {1, 0, 0, 1}, {0, 1, 0, 1}, {1, 1, 0, 1}}, /* incase of initial state 8 */
+ {{0, 0, 1, 1}, {1, 0, 1, 1}, {0, 1, 1, 1}, {1, 1, 1, 1}} /* incase of initial state 12 */
+}; // Q0
+
+/* Intra-Prediction */
+
+const Word16 SN_IntraCoeff_fx[N_STAGE_VQ - 1][2][2] = /* Q15 */
+{
+ {{-14822, 26501}, {-17180, 10012}},
+ {{ 317, 19858}, { -432, 13799}},
+ {{ 4747, 22069}, { 2653, 19016}},
+ {{ 6823, 20747}, { 7077, 19154}},
+ {{ 1665, 25161}, { 2519, 13654}},
+ {{ 166, 18043}, { -221, 9732}},
+ {{ -781, 20026}, { -5332, 18882}}
+};
+
+const Word16 AR_IntraCoeff_fx[N_STAGE_VQ - 1][2][2] = /* Q15 */
+{
+ {{-9584, 22162}, {-13849, 7127}},
+ {{ 1604, 16400}, { 2861, 9414}},
+ {{ 6537, 16475}, { 3498, 13792}},
+ {{ 7879, 14434}, { 7021, 12992}},
+ {{ 6329, 16215}, { 5200, 10052}},
+ {{ 3062, 12146}, { 2147, 4857}},
+ {{ 1226, 11040}, { -794, 6137}}
+};
+
+const Word16 scale_ARSN_fx[M] = /* Q14 */
+{
+ 29994, 30153, 29506, 28534, 28246, 28618, 26388, 27029,
+ 25726, 25474, 25797, 26540, 25613, 24968, 25880, 25584
+};
+
+const Word16 scale_inv_ARSN_fx[M] = /* Q15 */
+{
+ 17898, 17806, 18196, 18815, 19005, 18760, 20342, 19864,
+ 20870, 21076, 20811, 20228, 20962, 21502, 20745, 20985
+};
+
+/* TCVQ Codebook */
+
+const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2] = /* x2.65 */
+{//Qlog2(2.56)
+ {
+ {-435 , -434}, {-233 , 124}, {-381 , 44}, {-274 , -88}, {-332 , -224}, {-563 , -600}, {-332 , 134}, { 53 , -739},
+ {-567 , 0}, { 149 , 316}, {-191 , 541}, {-123 , 317}, {-493 , -634}, {-528 , 268}, {-321 , -386}, {-432 , -220},
+ {-244 , -230}, { -33 , 454}, {-188 , -642}, {-131 , -215}, {-676 , 263}, {-472 , -403}, {-312 , -159}, {-340 , 297},
+ {-121 , -217}, { -6 , 241}, {-203 , -211}, {-126 , -15}, {-734 , -374}, {-458 , -6}, {-297 , -27}, {-307 , -553},
+ {-177 , 3}, {-175 , -273}, { 63 , 363}, { 133 , 527}, {-133 , -185}, {-449 , -1206}, {-287 , -281}, {-131 , 869},
+ {-100 , -105}, { -75 , -179}, {-141 , 131}, { -32 , 108}, { -81 , 161}, {-446 , -230}, {-283 , -884}, {-128 , -165},
+ {-153 , -451}, {-177 , -114}, {-113 , -127}, {-223 , -355}, {-246 , -447}, {-396 , -705}, {-280 , 329}, { -37 , -64},
+ {-118 , 208}, { -82 , 64}, {-339 , -367}, { -58 , -132}, {-458 , 644}, {-381 , -543}, {-272 , 557}, { 62 , 75},
+ {-307 , -829}, { 310 , 445}, { 73 , -26}, { 95 , 219}, { 223 , 611}, { 279 , 195}, { 430 , 575}, { 424 , 221},
+ { -25 , 2}, { 323 , 236}, {-100 , -310}, { 11 , -35}, { 83 , -3}, { 281 , 738}, { 495 , 393}, { 89 , 1284},
+ { 32 , 136}, { 29 , 34}, { 491 , 575}, { 105 , -188}, { 15 , -440}, { 285 , 10}, { 516 , -105}, { 313 , 704},
+ { -6 , -274}, { -62 , -64}, { -12 , -127}, { 170 , 2387}, { 162 , 196}, { 336 , 413}, { 543 , 210}, { 231 , -70},
+ { -2 , 691}, { 98 , 134}, { 25 , 141}, { 261 , 305}, { 312 , -322}, { 336 , 228}, { 561 , 781}, { 766 , 514},
+ { -14 , -117}, { 166 , 905}, { -50 , 1}, { 471 , 369}, { 345 , 247}, { 347 , -383}, { 561 , 1128}, { 513 , 1030},
+ { 100 , -15}, { 185 , 70}, { 167 , 131}, { 122 , 36}, { 561 , 743}, { 401 , 111}, { 595 , -579}, { 674 , 215},
+ { 191 , 189}, { 38 , -78}, { 428 , 0}, { 261 , 136}, { -29 , -99}, { 405 , 308}, { 614 , 574}, {1682 , 1704}
+ },
+ {
+ {-942 , -168}, {-262 , -361}, { -53 , -171}, {-245 , 472}, {-2145 , -2315}, {-1307 , 1261}, {-870 , -1940}, { -652 , -564},
+ {-500 , 447}, {-578 , -198}, {-554 , 111}, { -98 , -84}, {-1315 , 0}, {-1229 , -1618}, {-868 , 230}, { -385 , 1061},
+ {-768 , -998}, {-202 , -60}, {-283 , -197}, {-142 , -325}, { -558 , 755}, {-1217 , 456}, {-803 , 766}, { -982 , 743},
+ {-415 , -357}, { -28 , 1054}, { 114 , -246}, { 81 , 732}, { -804 , -506}, {-1126 , -112}, {-797 , -132}, { -289 , -204},
+ {-347 , -29}, { -37 , -259}, {-142 , -438}, {-249 , 87}, { -874 , 341}, {-1074 , -2635}, {-668 , -1552}, {-1140 , -764},
+ {-245 , -513}, { -48 , 526}, { 14 , 395}, {-452 , -646}, { -441 , -969}, { -953 , -1284}, {-645 , -387}, { -736 , 111},
+ {-163 , 305}, {-349 , 224}, {-225 , 736}, { 94 , -85}, { -302 , -549}, { -937 , -892}, {-605 , -1089}, { -64 , -101},
+ {-161 , -211}, {-392 , -1299}, {-148 , 125}, { 14 , 131}, { -432 , -127}, { -920 , -510}, {-598 , -730}, { 85 , 154},
+ { 25 , -155}, { -57 , 238}, { 471 , 276}, { 421 , 680}, { -173 , 316}, { 597 , 1805}, { 906 , -673}, { 538 , 450},
+ {-267 , -805}, { 2 , -19}, { 222 , 219}, { 185 , 352}, { -33 , -178}, { 606 , 118}, { 959 , -70}, { 350 , -91},
+ { -87 , 42}, { 727 , 905}, { 54 , 33}, { 316 , 44}, { 251 , 15}, { 610 , -122}, { 990 , 1436}, { 82 , 1480},
+ { 181 , 535}, { 177 , 130}, { 700 , 565}, { 626 , 331}, { 279 , 551}, { 680 , 707}, {1012 , 727}, { 1057 , 766},
+ { -13 , -396}, { 364 , 412}, { 442 , -181}, { 202 , -386}, { 565 , 1397}, { 740 , 2621}, {1080 , 361}, { 1118 , 191},
+ { 81 , 266}, { 217 , -130}, { 349 , 1009}, { 678 , -476}, { 1361 , 878}, { 795 , 472}, {1267 , 1034}, { 1040 , 1255},
+ { 351 , 201}, { -69 , -633}, { -36 , -1046}, { 808 , 30}, { 1300 , -198}, { 803 , 1026}, {1390 , -326}, { 2291 , 2479},
+ { 166 , 13}, { 521 , 84}, { 255 , -717}, { 987 , 448}, { 777 , 220}, { 811 , 208}, {1395 , 2021}, { 1499 , 417}
+ }
+};
+const Word16 AR_TCVQ_CB_SUB2_fx[2][64][2] =
+{//Qlog2(2.56)
+ {
+ {-357 , -53}, {-525 , 167}, {-232 , 255}, {-132 , -359}, {-940 , -221}, { -260 , -1296}, {-1197 , -455}, { -833 , 49},
+ {-132 , -1}, {-401 , -280}, {-212 , -217}, {-194 , 92}, {-580 , -710}, { -862 , -750}, { -669 , 430}, { -521 , 719},
+ {-620 , -454}, {-239 , 509}, { -15 , -575}, { 389 , 704}, {-890 , 518}, {-1154 , 84}, { -632 , -1023}, { -620 , -1263},
+ {-268 , -470}, {-326 , -738}, { 44 , 635}, { 73 , 362}, {-226 , -22}, { -625 , -106}, { -720 , -114}, {-1114 , -1070},
+ { 19 , -250}, { 83 , 99}, { 35 , -16}, { 263 , -316}, { 472 , 1096}, { -52 , -328}, { -249 , 971}, { 1387 , 876},
+ { 10 , 203}, { 869 , 649}, { 225 , 170}, { 301 , 83}, {1256 , 482}, { 391 , -777}, { 1064 , -320}, { 52 , 1207},
+ { 309 , 375}, { 469 , 226}, { 619 , 400}, { 60 , -93}, { 335 , 244}, { 316 , -65}, { -45 , -987}, { 648 , -294},
+ { 218 , -66}, {-108 , -133}, { 500 , -19}, { 824 , 163}, { 483 , -443}, { 1297 , 240}, { 1000 , 1205}, { 623 , 1347}
+ },
+ {
+ {-424 , -965}, { -46 , -194}, { 20 , 298}, {-333 , -278}, {-797 , -522}, {-868 , -60}, { -20 , -140}, {-1085 , -904},
+ {-615 , -243}, {-367 , 22}, {-261 , -519}, {-111 , -27}, {-745 , 142}, {-484 , -1519}, { -329 , 13}, {-1077 , 92},
+ {-529 , 218}, {-519 , -597}, {-276 , -72}, { -87 , -398}, { -51 , -1257}, {-291 , 409}, { -883 , 611}, { 176 , -401},
+ {-134 , -245}, { 37 , 506}, { 23 , -10}, {-225 , 293}, {-913 , -1324}, {-174 , -290}, {-1086 , -386}, { -139 , -78},
+ {-123 , 125}, { -26 , -738}, { 113 , -344}, { 175 , 182}, { 754 , -446}, {1207 , 529}, { 932 , 990}, { 136 , 122},
+ { 267 , 327}, { 382 , -182}, { 718 , 471}, { 738 , 108}, { 158 , 130}, { 437 , 401}, { 358 , -667}, { 1380 , 836},
+ { 184 , -17}, { 435 , 231}, { 403 , 63}, { 151 , -125}, {-109 , -237}, { 692 , -241}, { 1247 , 193}, { 885 , 324},
+ {-283 , 661}, { 44 , 105}, { 156 , 911}, { 387 , 588}, { 690 , 1459}, { 664 , 1057}, { -38 , 1455}, { 645 , 909}
+ }
+};
+const Word16 AR_TCVQ_CB_SUB3_fx[4][32][2] =
+{//Qlog2(2.56)
+ {
+ {-487 , 9}, {-456 , -400}, { 96 , 451}, {-239 , 422}, {-685 , -1309}, { 68 , -709}, {-302 , -1185}, { 481 , -287},
+ {-287 , -697}, {-194 , 73}, {-159 , -132}, {-161 , -312}, {-809 , 417}, {-860 , -926}, { -26 , -71}, {-1052 , -432},
+ { 53 , 134}, { 106 , -140}, { 336 , -18}, { 404 , 735}, {-109 , -516}, { 719 , -65}, { -34 , 1336}, { -171 , 905},
+ { 52 , -347}, { 359 , 266}, { 715 , 351}, { 100 , 133}, { 87 , 130}, { 975 , 999}, {1257 , 547}, { 738 , 1372}
+ },
+ {
+ {-340 , -464}, {-216 , -779}, { 104 , -403}, { -92 , -221}, {-760 , -602}, {-914 , -811}, {-661 , -895}, {-1292 , -290},
+ {-317 , 131}, {-575 , -154}, {-228 , -129}, {-257 , 487}, {-286 , -1354}, { -93 , -259}, {-798 , 179}, { -815 , -1368},
+ { 215 , 570}, { -2 , 73}, { 545 , 167}, { 250 , 188}, { 76 , 48}, {-943 , 587}, { 379 , 1232}, { 1070 , 112},
+ { 117 , -27}, { 389 , -142}, { 18 , 214}, { 735 , 581}, {1098 , 1244}, { 451 , 408}, {1482 , 650}, { -174 , 1160}
+ },
+ {
+ {-256 , -485}, { -67 , 571}, { -5 , 161}, {-171 , 153}, {-1188 , -440}, {-1081 , 110}, {-641 , -921}, {-232 , -96},
+ {-511 , 146}, {-288 , -93}, { 484 , 665}, {-610 , -366}, { -357 , -899}, { -861 , -1088}, { -78 , -105}, {-265 , -845},
+ { 15 , 18}, { 79 , -383}, {-205 , -258}, { 306 , 264}, { 28 , 69}, { 34 , 65}, {1170 , 669}, { 133 , 74},
+ { 521 , 183}, { 132 , 84}, { 362 , -90}, { 57 , -181}, { 894 , 456}, { 1147 , 742}, { 212 , 274}, { 891 , 262}
+ },
+ {
+ { 94 , 464}, { 8 , 138}, {-365 , -640}, {-399 , 172}, {-249 , -109}, { -94 , -316}, {-163 , -250}, {-598 , -704},
+ {-185 , 36}, {-470 , -199}, { 65 , 241}, {-104 , -362}, {-220 , -801}, {-866 , -66}, {-931 , -400}, {-172 , -132},
+ {-148 , -494}, { 465 , 251}, {-179 , -72}, { 439 , 287}, { 824 , 559}, { 33 , 134}, { 59 , 134}, { 88 , 146},
+ { 186 , 43}, { 69 , -261}, { 267 , -96}, { 40 , 79}, { 84 , 130}, { 678 , 378}, { 811 , 448}, { 920 , 541}
+ }
+};
+
+
+const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2] =
+{//Qlog2(2.56)
+ {
+ {-639 , 105}, {-488 , -449}, {-530 , -811}, {-419 , -634}, {-781 , -1061}, {-585 , 386}, {-501 , -737}, {-489 , -728},
+ {-702 , -685}, {-510 , -762}, {-390 , -287}, {-379 , -379}, {-573 , -848}, {-583 , -778}, {-500 , -810}, {-671 , -420},
+ {-516 , 802}, {-265 , -492}, {-523 , -568}, {-195 , 2882}, {-600 , -172}, {-568 , -869}, {-497 , 663}, {-643 , -929},
+ {-346 , -378}, {-253 , -313}, {-418 , 595}, {-240 , -465}, {-424 , -546}, {-556 , -305}, {-497 , 2453}, {-451 , -235},
+ {-452 , -670}, {-368 , -624}, {-379 , -662}, {-305 , -85}, {-549 , 399}, {-546 , -644}, {-484 , -426}, {-387 , -546},
+ {-325 , -550}, {-229 , 118}, { -83 , 1004}, {-120 , 465}, {-289 , -222}, {-516 , 155}, {-480 , 1494}, {-415 , 138},
+ {-419 , -100}, {-347 , 1091}, {-434 , 76}, {-138 , -291}, {-434 , -719}, {-514 , 945}, {-473 , -26}, {-144 , -320},
+ {-376 , 1505}, {-329 , 374}, {-316 , -504}, { -58 , -6}, {-270 , -466}, {-507 , -540}, {-466 , -181}, {-256 , -518},
+ {-196 , 726}, { -88 , -356}, {-186 , -394}, { 31 , -201}, { -77 , -319}, { 408 , 136}, { 630 , 680}, { 875 , 1365},
+ {-200 , -190}, { 166 , 1289}, { 600 , 1085}, { 276 , 464}, { 567 , 1575}, { 425 , 278}, { 666 , 377}, {1209 , 2344},
+ {-182 , -409}, { -95 , -141}, { 65 , 507}, { 127 , 212}, { 340 , 235}, { 481 , 408}, { 721 , 1203}, {1112 , 756},
+ { 162 , 362}, { 138 , 753}, {-169 , -128}, { 187 , -32}, { 68 , -93}, { 528 , 2866}, { 786 , 789}, {1247 , 1468},
+ {-476 , 2428}, { 20 , 133}, { 2 , -236}, { 426 , 799}, { 393 , 590}, { 532 , 1562}, { 807 , 534}, {1410 , 1051},
+ { -14 , -263}, { 83 , -158}, { 158 , -38}, { 616 , 550}, { 845 , 543}, { 536 , 238}, { 912 , 1521}, {1635 , 1344},
+ { 115 , -55}, { 263 , 87}, {-126 , 234}, { 376 , 191}, { 459 , 2644}, { 542 , 927}, { 941 , 948}, {1896 , 1528},
+ { -19 , 1853}, { 455 , 366}, { 545 , 283}, { 831 , 835}, {1217 , 846}, { 560 , 542}, {1013 , 650}, {1905 , 2343}
+ },
+ {
+ {-528 , -246}, {-631 , 56}, {-717 , -277}, { -40 , 1327}, {-1011 , -688}, {-827 , -341}, {-656 , -1599}, { -992 , -1559},
+ {-450 , 933}, {-540 , 2109}, {-598 , -1267}, {-387 , -512}, {-1100 , -1979}, {-812 , -617}, {-649 , -147}, { -874 , 586},
+ {-720 , -601}, {-281 , -279}, {-578 , 635}, { 169 , 80}, {-1020 , -134}, {-794 , 259}, {-638 , 821}, { -907 , 42},
+ {-709 , -1525}, {-482 , 1340}, {-232 , -979}, { 104 , 2314}, { -918 , -1179}, {-790 , 1284}, {-609 , 2259}, { -854 , -978},
+ {-624 , 326}, {-194 , 1705}, { -88 , 1060}, { 383 , 1190}, { -415 , 15}, {-789 , -1145}, {-604 , 407}, { -869 , 1136},
+ {-503 , -1047}, {-545 , -794}, {-128 , 471}, { 84 , 638}, { -591 , -1509}, {-699 , 1746}, {-600 , -369}, { -784 , 1642},
+ {-221 , -668}, {-223 , 261}, { -82 , -446}, {-378 , -1215}, { -741 , 969}, {-689 , -863}, {-569 , -595}, {-1012 , -403},
+ {-331 , 518}, {-175 , 787}, {-220 , -3}, { -46 , -841}, { -960 , 297}, {-666 , 68}, {-565 , -1364}, { -265 , -21},
+ { 649 , 767}, { 255 , 360}, { 338 , -342}, {1664 , 1627}, { 205 , -226}, { 967 , 31}, {1217 , 928}, { 1697 , 1233},
+ { 322 , 1445}, { 320 , 1790}, { 413 , 212}, { 994 , 209}, { 766 , 264}, { 974 , 883}, {1228 , 241}, { 1679 , 801},
+ { 75 , 312}, { 754 , 1425}, { 348 , 621}, { 644 , 474}, { 1008 , 763}, {1036 , 2024}, {1354 , 530}, { 1611 , 2129},
+ { 162 , 931}, { 883 , 822}, { 990 , 488}, { 615 , -203}, { 1929 , 1234}, {1059 , 1375}, {1382 , 1426}, { 2048 , 1599},
+ { 602 , 162}, { 380 , 820}, { 709 , 1064}, {1168 , 1374}, { 549 , 583}, {1062 , 470}, {1415 , 1092}, { 2095 , 2234},
+ { 187 , -630}, { 118 , -493}, { 714 , 1787}, {1298 , 673}, { 957 , 1258}, {1082 , 1124}, {1460 , 786}, { 2124 , 1205},
+ { 34 , -189}, { 54 , -35}, { 798 , 0}, { 747 , 2378}, { 1420 , 1152}, {1118 , 1673}, {1492 , 2287}, { 2416 , 1618},
+ {1159 , 1795}, { 389 , -126}, {1194 , 1003}, {1578 , 1002}, { 1294 , 366}, {1148 , 694}, {1513 , 1791}, { 2746 , 2096}
+ }
+};
+
+const Word16 SN_TCVQ_CB_SUB2_fx[2][64][2] =
+{//Qlog2(2.56)
+ {
+ {-709 , -609}, {-615 , -1025}, {-430 , -321}, { -44 , 1032}, {-1050 , -32}, {-1028 , -1856}, {-970 , -109}, { -572 , -1426},
+ {-568 , 154}, {-142 , -189}, { -80 , 533}, { -38 , -632}, { -391 , 1275}, { -986 , -732}, {-479 , -510}, { -966 , 96},
+ {-847 , -1387}, {-895 , 607}, {-368 , -930}, {-386 , 352}, { -290 , 10}, { -833 , 94}, {-528 , 1718}, { -210 , 115},
+ {-529 , 857}, {-727 , -230}, {-128 , 31}, { 133 , 76}, { -275 , -777}, { -615 , -1367}, {-339 , -13}, {-1035 , 1231},
+ { 448 , 851}, { 599 , 106}, {1103 , 1112}, { 635 , 1249}, { 761 , 774}, { 531 , -71}, { 722 , 473}, { 767 , 413},
+ { 258 , 276}, { 346 , -380}, { 487 , 504}, {1114 , 122}, { 882 , 1553}, { 1983 , 1239}, {2126 , 1217}, { 1742 , 1262},
+ { 135 , -252}, { 216 , 545}, { 500 , -125}, {1379 , 1910}, { 304 , 76}, { 1509 , 609}, {1543 , 1385}, { 542 , 1831},
+ {-240 , -467}, { 771 , 652}, { 913 , 280}, {1307 , 716}, { 1834 , 1029}, { 1049 , 491}, {1624 , 733}, { 2495 , 1944}
+ },
+ {
+ {-729 , -852}, {-590 , 306}, {-398 , 295}, { -31 , 13}, {-659 , -75}, {-604 , -1229}, {-519 , -675}, {-823 , 47},
+ {-755 , -207}, {-818 , -424}, {-705 , -1285}, {-258 , -828}, {-807 , -707}, {-182 , -712}, {-928 , 3}, {-455 , -1149},
+ {-844 , 422}, {-596 , -1008}, {-504 , -470}, {-459 , 737}, {-338 , -728}, {-836 , 1028}, {-613 , 1242}, {-609 , 1292},
+ {-285 , 36}, {-280 , -424}, { 100 , 126}, {-459 , -135}, {-159 , -151}, {-287 , 190}, { 56 , -262}, {-264 , -317},
+ { -8 , 603}, { 63 , 301}, { 537 , -155}, { 289 , 569}, { 193 , -412}, { 864 , 79}, { 686 , 399}, { 842 , 1657},
+ { 115 , -211}, { 608 , 340}, { 12 , -650}, { 711 , 1103}, { 101 , 510}, { 358 , -416}, {1266 , 453}, { 532 , 612},
+ {-256 , -680}, { 41 , 1163}, { 597 , 793}, { 484 , -61}, { 476 , 256}, {1729 , 1246}, {1209 , 1483}, {1472 , 1113},
+ { 389 , 330}, { 176 , -388}, {1025 , 317}, {1049 , 732}, {1480 , 1108}, {1285 , 616}, {1730 , 999}, {2001 , 1669}
+ }
+};
+const Word16 SN_TCVQ_CB_SUB3_fx[4][32][2] =
+{//Qlog2(2.56)
+ {
+ {-377 , -872}, {-407 , 801}, {-611 , -449}, {-397 , -87}, {-476 , -1063}, {-797 , -249}, {-263 , -662}, {-473 , 1508},
+ {-716 , 310}, {-616 , -982}, {-742 , -1326}, { 197 , 327}, {-894 , -1556}, {-871 , -1259}, {-708 , -1380}, {-789 , -848},
+ { 64 , -313}, { -59 , -547}, { -2 , 67}, { 363 , -167}, { 633 , 1840}, { 232 , -357}, {1243 , 1492}, {1640 , 973},
+ { 203 , 518}, { 511 , 946}, { 612 , 241}, {1085 , 724}, { 811 , 326}, { 863 , 241}, { 556 , 534}, {1956 , 2087}
+ },
+ {
+ {-948 , 28}, {-827 , -1180}, {-348 , -331}, { -36 , 216}, {-1453 , -1162}, {-682 , -639}, {-747 , -1517}, {-704 , 1228},
+ {-535 , -988}, {-550 , -109}, {-478 , 580}, {-310 , -699}, {-1308 , -225}, {-775 , -1581}, {-831 , -613}, {-120 , -222},
+ { 32 , 200}, { 120 , -221}, { 470 , 466}, { 808 , 313}, { 950 , 711}, { 430 , -576}, {1984 , 1405}, {1645 , 887},
+ { 131 , 1148}, { 286 , 508}, { 342 , -236}, {1003 , 1202}, { 317 , -726}, {1493 , 732}, {1336 , 694}, {2382 , 1772}
+ },
+ {
+ {-874 , -374}, {-237 , 26}, { 15 , 870}, {-710 , 433}, { 40 , -769}, {-1059 , -1350}, { 65 , 208}, {-1012 , -1369},
+ { -79 , -459}, {-671 , -942}, { -12 , 56}, {-162 , -431}, {-820 , -1073}, { -886 , -136}, {-327 , -501}, { -55 , -14},
+ { 652 , 647}, { 365 , 411}, { 614 , 252}, { 154 , 215}, { 12 , 62}, { 226 , 177}, {1689 , 1213}, { 751 , 179},
+ { 31 , 182}, { 281 , -291}, {-354 , -642}, { 939 , 924}, { 619 , 90}, { 1675 , 1130}, { 827 , 272}, { 1550 , 1446}
+ },
+ {
+ {-366 , -916}, {-346 , -234}, {-518 , -140}, { 26 , 305}, {-254 , -92}, {-634 , -976}, {-493 , -1076}, {-334 , -913},
+ {-566 , 68}, { 102 , 216}, {-296 , -927}, {-501 , -1030}, {-437 , -1006}, {-146 , -145}, {-211 , -202}, { 62 , 359},
+ { 163 , -122}, { 759 , 553}, { 82 , 207}, {-177 , -243}, { 163 , 343}, {1152 , 929}, { 197 , 248}, { 43 , -147},
+ { 169 , 371}, {-468 , -1043}, { 686 , 418}, { 563, 245}, {1052 , 843}, { 259 , 341}, {1063 , 637}, { 865 , 654}
+ }
+};
+
+
+const Word16 AR_SVQ_CB1_fx[32][8] = /* x2.56 */
+{//Qlog2(2.56)
+ { -1, 4, 16, 4, 45, -110, 10, 167, },
+ { -3, 2, 8, -12, -7, 23, 279, -46, },
+ { 0, 2, 1, 8, -73, -40, 71, -97, },
+ { 0, 2, 42, 74, -39, 72, 27, 8, },
+ { 0, 1, 9, -6, 40, -65, -55, -128, },
+ { 0, 0, 8, -10, -43, 105, -5, -126, },
+ { 0, 0, 12, -3, -98, -18, -88, -73, },
+ { 0, 1, -6, -12, -49, -179, -30, -15, },
+ { -1, 0, 24, 78, 25, -69, -26, -14, },
+ { 0, 1, -1, -29, 23, -65, -126, 34, },
+ { 2, -4, -23, -7, -13, -2, -22, -4, },
+ { -1, 1, -2, 44, -54, -58, 107, 60, },
+ { 0, 1, -3, -15, -54, 97, -100, 41, },
+ { 0, -2, -81, 93, -13, 18, -31, -75, },
+ { -1, 2, 0, -5, 166, -64, -48, 8, },
+ { -2, 0, -27, -108, 36, 3, 12, -80, },
+ { 0, 0, 0, 4, 82, -1, 79, 54, },
+ { 1, -4, 5, -9, -38, 289, 16, 16, },
+ { -1, 2, 6, -68, 61, 67, -31, 100, },
+ { 3, -6, 2, -2, -1, -6, -217, 273, },
+ { 0, 1, -43, -62, -7, -60, 28, 78, },
+ { -1, 2, 10, 0, 76, 84, -55, -45, },
+ { -1, -2, 4, 5, -32, 75, 70, 176, },
+ { 2, -1, 0, 6, 27, 29, -220, -97, },
+ { -1, 1, 90, -56, -10, -16, 29, 8, },
+ { -1, 3, -10, 0, 2, -24, 49, -336, },
+ { -1, 1, -8, -9, 55, -134, 105, -44, },
+ { 0, 1, -16, 69, 51, 40, -51, 98, },
+ { 0, 2, -12, -32, -140, 49, 50, 26, },
+ { 0, 3, 8, 29, 77, 24, 76, -103, },
+ { -1, 2, -24, -18, 7, 100, 94, 5, },
+ { 0, -1, 10, 26, -87, -34, -56, 103, }
+};
+
+const Word16 AR_SVQ_CB2_fx[16][8] = /* x2.56 */
+{//Qlog2(2.56)
+ { -37, -59, 208, -88, 54, 58, -16, -24, },
+ { 0, -98, 9, -65, -182, -21, 19, 9, },
+ { -1, 110, -8, 59, 201, 9, -38, -22, },
+ { -1, 40, -22, -183, 46, -162, -38, -6, },
+ { 12, 2, -193, 64, -43, -48, 11, 9, },
+ { -83, 175, -8, -55, -65, 66, 26, 6, },
+ { 29, 3, 2, -10, -100, 293, 75, -12, },
+ { 7, -54, -76, -91, 63, 119, -84, -84, },
+ { 3, 7, 6, 6, -30, 15, -176, 168, },
+ { -10, 45, 26, 57, -92, -68, -117, -134, },
+ { 0, -37, -34, -69, 106, 54, 121, 131, },
+ { -25, -64, 7, 205, 1, 93, 27, 6, },
+ { 64, 28, 51, 8, -7, 18, 27, 0, },
+ { -20, 44, 57, 78, -55, -170, 88, 93, },
+ { 12, -125, 12, 56, 100, -160, -87, -3, },
+ { -7, -18, -7, -6, 36, -54, 175, -176, }
+};
+
+
+const Word16 W_DTX_HO_FX[HO_HIST_SIZE] = /* Q15 */
+{
+ 6554, 5243, 4194, 3355, 2684, 2147, 1718, 344
+};
+
+
+const Word16 ENR_ATT_fx[5] = /*Q8*/
+{
+ 459, 357, 281, 255, 255
+};
+
+
+const Word16 HO_ATT_FX[5] = /* Q15 */
+{
+ 17597, 20205, 22410, 23198, 23198
+};
+
+const Word16 uniform_model[] = { MAX_AR_FREQ, MAX_AR_FREQ / 2, 0 }; // Q0
+
+
+/*-----------------------------------------------------------------*
+ * LSF quantization - mid-frame quantization tables
+ *-----------------------------------------------------------------*/
+
+
+const Word16 tbl_mid_gen_wb_2b_fx[] =//Q13
+{
+ 3814, 5145, 5856, 5290, 5277, 4880, 4877, 4273, 3868, 3776, 3392, 3163, 3120, 3019, 3395, 5814,
+ 1482, 861, 1968, 3198, 3105, 3737, 3749, 4525, 4982, 4828, 5023, 5335, 5327, 5296, 5092, 3444,
+ 3955, 3851, 1520, 1666, 1554, 1385, 1537, 1276, 1443, 1526, 1597, 1636, 1867, 2041, 2483, 2059,
+ 7038, 8112, 7324, 6969, 6877, 7028, 6987, 7098, 7003, 6955, 6927, 6808, 6685, 6459, 5871, 6047,
+};
+
+const Word16 tbl_mid_gen_wb_4b_fx[] =
+{//Q13
+ 5532, 5133, 2125, 3516, 4905, 5624, 6338, 6918, 6854, 6354, 5345, 3996, 3603, 5588, 6962, 7511,
+ 4218, 4157, 4892, 6332, 5786, 2931, 2749, 2306, 3420, 4629, 5591, 6249, 6638, 7273, 7904, 8379,
+ 993, 369, 2927, 5138, 4840, 5892, 5331, 5158, 3956, 3130, 3324, 5022, 5292, 3974, 2488, 1119,
+ 1067, 2471, 6356, 4184, 3166, 3224, 3980, 5055, 4965, 4822, 3843, 2328, 1438, 916, 2514, 8248,
+ 3788, 949, 522, 1709, 1932, 3306, 3287, 4521, 5432, 5291, 5644, 6116, 6166, 5943, 5631, 2088,
+ 7865, 8237, 6466, 4043, 3793, 4589, 4885, 5405, 6002, 6746, 7203, 7361, 6982, 6157, 3994, 2143,
+ 2837, 7217, 7926, 7751, 7605, 7549, 6937, 6852, 6270, 5895, 5612, 5245, 4862, 3654, 3139, 6321,
+ 4317, 3387, 1035, 2799, 2769, 3400, 3054, 2246, 2307, 1829, 1456, 1007, 1055, 895, 782, 108,
+ 7164, 8021, 6869, 6458, 6311, 5505, 5577, 4491, 3934, 3760, 3244, 2798, 2498, 2166, 1950, 4759,
+ 5758, 5400, 1203, 687, 647, 963, 1486, 2000, 2998, 3179, 3634, 4296, 4465, 3719, 3275, 4785,
+ 1051, 1802, 6133, 6475, 6875, 6981, 7181, 7303, 7136, 7036, 7276, 7197, 6986, 7118, 6659, 5813,
+ 4095, 6275, 6049, 4850, 3198, 4942, 3257, 1456, 1327, 504, 559, 1472, 3985, 5835, 5772, 7356,
+ 6814, 7430, 4049, 2579, 4315, 2443, 3236, 3107, 2458, 2891, 2553, 1923, 1871, 2068, 3583, -188,
+ 412, 238, 247, 507, 498, 540, 811, 767, 679, 480, 416, 306, 574, 532, 731, 2227,
+ 8495, 9589, 8346, 7953, 7655, 7990, 8089, 8412, 8530, 8482, 8421, 8420, 8464, 8242, 7698, 7341,
+ 3085, 2920, 3059, 3020, 1227, -101, -417, -872, -195, 1126, 1766, 2513, 2649, 3451, 4444, 1734
+};
+
+
+const Word16 tbl_mid_gen_wb_5b_fx[] =
+{//Q13
+ 6510, 8058, 7103, 6095, 6483, 5866, 6026, 6443, 6882, 6907, 7015, 6581, 5649, 4044, 2816, 2519,
+ 3778, 2123, 3580, 4221, 2598, 4631, 2844, 4905, 5446, 4529, 5186, 6228, 6210, 5693, 6213, -4670,
+ 9050, 9934, 8441, 7921, 7546, 7840, 7977, 8335, 8679, 8706, 8703, 8607, 8560, 8375, 7759, 6405,
+ 4243, 5775, 2939, 5887, 4078, 3117, 5267, 5680, 4589, 2401, 731, 1011, 1657, 4733, 7051, 3992,
+ 2508, 3156, 3347, 1605, 4450, 4633, 3476, 6019, 4083, 3824, 5133, 6020, 3253, 1368, 1736, 13507,
+ 5934, 6372, 4494, 2957, 4424, 6667, 8167, 8413, 7957, 7139, 5518, 3059, 2829, 2821, 2773, 3274,
+ 4984, 5566, 5831, 4556, 5732, 6738, 6689, 4683, 2265, 4214, 7242, 9989, 9776, 9068, 4748, 2292,
+ 2601, 4933, 2764, 4923, 3763, 3678, 5596, 2079, 6108, 6824, 5507, 5612, 6793, 5553, 1140, 9993,
+ 7084, 6685, 5313, 5196, 3111, 5337, 3535, 2476, 2477, 1737, 2090, 4033, 5680, 6548, 7310, 11811,
+ 8140, 8602, 7166, 6738, 6018, 5299, 5686, 4722, 4108, 4456, 3713, 3131, 2658, 2336, 2250, 8051,
+ 727, 1865, 6073, 3932, 2258, 2413, 4823, 5733, 5101, 6126, 4690, 1130, 1172, 1479, 3956, 7204,
+ 6042, 1024, 5371, 5997, 4964, 5575, 5078, 5843, 6909, 8465, 8601, 6137, 5699, 8049, 9922, 8318,
+ 2728, 1625, 4750, 5004, 5799, 4938, 6353, 3274, 1781, 3095, 1479, 3136, 5470, 1391, -626, 2422,
+ 4407, 3228, 1266, 1488, 1222, 963, 1148, 1182, 1330, 1770, 860, 381, 813, 1268, 2352, 3956,
+ 1683, -120, 83, 1239, 946, 1609, 1982, 3215, 3950, 4200, 4497, 4898, 4551, 3595, 2345, 2444,
+ 1055, 3207, 7460, 6808, 7103, 6980, 7902, 8196, 6821, 6190, 6405, 7414, 7967, 7506, 6921, 9871,
+ 3164, 7995, 8446, 8770, 8443, 8302, 7372, 7049, 6090, 5698, 5090, 4792, 4996, 4874, 4285, 6685,
+ 3681, 319, 536, 3174, 4495, 5486, 5807, 5751, 5461, 4423, 3556, 3449, 5148, 7560, 6277, 3783,
+ 1987, 4209, 6954, 5880, 7459, 7762, 4326, 4958, 5154, 2150, 2988, 2469, 1175, 1099, 3999, 3950,
+ 1306, 2303, 7748, 8238, 6116, 2824, 1772, 1130, 2538, 3345, 5317, 4773, 3668, 5458, 5519, 5594,
+ 4140, 4329, 3339, 3001, 2669, -79, -582, -1729, -680, 1294, 2752, 3700, 3627, 4428, 4950, 2744,
+ 5309, 3611, 993, 3526, 2043, 3938, 2069, 1434, 4173, 2609, 2704, 3690, 3686, 1894, 1401, -1682,
+ 6091, 4810, 970, 1063, 1707, 3056, 4597, 6742, 7397, 6913, 7359, 7884, 7571, 6830, 6039, 3823,
+ 6599, 6006, 1248, 4330, 6935, 3784, 3535, 3902, 3221, 5384, 5691, 5997, 5975, 6731, 9125, 5385,
+ 204, 242, 2009, 3375, 3412, 3407, 2691, 2547, 598, -150, 67, 250, 618, 1185, 1987, 1157,
+ 4986, 7977, 6971, 1528, 86, 281, 1497, 3002, 4193, 4430, 4721, 5317, 6001, 6181, 6962, 5480,
+ 6914, 7963, 5254, 3050, 5365, 3224, 3781, 3044, 2571, 3155, 2243, 1612, 2157, 2526, 2784, -1629,
+ 7350, 6702, 2435, 1937, 2549, 1978, 2819, 2817, 2059, 2493, 3408, 2344, 1239, 1177, 914, 3763,
+ 4362, 3105, -1457, -1760, 314, 1452, 2603, 1642, 1670, 1652, 2258, 2492, 3844, 4399, 5213, 660,
+ 350, 357, 109, 83, -555, -886, -714, -587, -120, 25, 189, 531, 591, 146, 156, 1435,
+ 498, 211, 3062, 6766, 7150, 8142, 7531, 7527, 7855, 6898, 6613, 6480, 5290, 4310, 5341, 4129,
+ 2753, 6959, 7088, 4622, 2646, 2395, 1756, 325, 488, 259, -125, -577, -553, 615, 557, 4617,
+};
+
+
+
+const Word16 tbl_mid_voi_wb_1b_fx[] = /* Q13*/
+{
+ 4551, 4599, 4754, 5035, 4982, 5228, 5318, 5603, 5699, 5652, 5642, 5766, 5825, 5874, 5819, 6056,
+ 3816, 3355, 2321, 2712, 2900, 2715, 2790, 2508, 2506, 2610, 2617, 2419, 2538, 2622, 3004, 2725,
+};
+const Word16 tbl_mid_voi_wb_4b_fx[] =//Q13
+{
+ 4337, 4235, 3526, 4083, 3514, 5457, 3168, 2509, 4418, 5021, 1313, 2952, 5347, 3893, 8325, 11758,
+ 4180, 4037, 3965, 3481, 4028, 3284, 2644, 4585, 4749, 3076, 3211, 1101, 4175, 7440, 5745, -4105,
+ 4239, 3957, 4450, 4974, 5400, 5734, 6246, 6586, 7774, 2699, 2783, 3474, 1345, -316, 5069, 4904,
+ 3964, 3810, 2673, 3031, 2249, 3168, 3155, 4204, 7316, 7176, 8680, 7147, 4918, 4136, 3142, 3011,
+ 4071, 3853, 3898, 3973, 3464, 2878, 5783, 5341, 1725, 801, 1194, 4239, 6866, 4950, 794, 6270,
+ 3933, 3750, 4931, 3667, 3585, 2550, 4308, 5757, 4503, 7081, 4893, 1076, 109, 1650, 1887, 8861,
+ 4803, 4827, 4969, 5511, 5768, 4327, 5277, 4934, 6909, 7672, 5355, 3940, 9990, 9622, 7457, 4202,
+ 4515, 4259, 2444, 4847, 3728, 4599, 4975, 6144, 4087, 4367, 7025, 5028, 2405, 7014, 13366, 6264,
+ 4746, 4556, 5408, 5866, 4733, 4088, 3965, 3329, 4669, 3105, 5918, 7824, 6026, 9177, 1856, 13229,
+ 4130, 4214, 2516, 3542, 4847, 3751, 3704, 2380, 4190, 4787, 4651, 4981, 5702, -27, -2961, 129,
+ 4461, 4724, 5233, 4680, 6010, 7222, 6351, 3069, 605, 5934, 5627, 3836, 3490, 6060, 3556, 2585,
+ 4628, 4723, 5465, 4180, 4460, 6173, 5915, 7260, 4703, 4114, 3938, 9585, 8085, 3781, 7520, 625,
+ 5002, 5621, 6352, 6914, 7170, 7719, 7585, 8408, 8360, 7883, 7370, 7222, 6616, 6002, 5565, 9394,
+ 4059, 4121, 4178, 4417, 3437, 1460, 1031, 111, 585, 1708, 4219, 5419, 2585, 3195, 6149, 3221,
+ 3394, 2776, 1970, 2707, 2983, 3931, 3247, 1729, 449, -109, -46, -469, 397, 1980, 2305, 1573,
+ 3259, 1870, 242, 392, 748, 615, 1185, 1285, 2259, 2687, 2212, 1762, 2174, 1887, 1847, 2073,
+};
+const Word16 tbl_mid_voi_wb_5b_fx[] =//Q13
+{
+ 4182, 3820, 4103, 5620, 4100, 4478, 3949, 5053, 2918, 3083, 4229, 3732, 1823, 6350, 17230, 4601,
+ 4361, 4077, 2236, 4128, 3216, 4673, 6022, 6522, 5746, 4282, 3121, 4448, 6457, 12573, 4401, 7796,
+ 4228, 4086, 4375, 4320, 4474, 4735, 4427, 5616, 5975, 138, 5887, 3722, 2304, -3430, 4995, 6246,
+ 4320, 4344, 4008, 4327, 3323, 6835, 3627, 3330, 3123, 3971, 2382, 1801, 6422, 3162, 9038, 14129,
+ 4193, 4202, 4413, 2703, 4175, 4330, 2615, 7600, 1717, 3506, 5671, 7170, 3545, 2350, -2738, 7287,
+ 4170, 3912, 4323, 3821, 4450, 6765, 7496, 8107, 7447, 5525, 3088, 1963, 2014, 3330, 976, 1002,
+ 4583, 4419, 3584, 4125, 4783, 5133, 3188, 5000, 4812, 4639, 10038, 7018, 5114, 5567, 3292, -6364,
+ 3926, 4092, 2710, 2721, 1799, 3509, 4542, 3351, 4583, 5877, 6539, 5135, 981, 4029, 7221, 592,
+ 4624, 4567, 4468, 4630, 5710, 5222, 5883, 2562, 8453, 2825, 109, 6491, 1210, 2921, 7292, 7118,
+ 4245, 4160, 5119, 4356, 5544, 3034, 1507, 4179, 5971, 1949, 3388, 613, 4995, 9019, 6755, -628,
+ 4905, 4962, 4529, 7025, 4905, 4470, 5063, 3440, 6348, 6102, 4319, 4395, 7515, 6549, -3697, 6513,
+ 4683, 4592, 5303, 4593, 4171, 5264, 6116, 7434, 4105, 5454, 2544, 8493, 6491, 894, 8983, -2406,
+ 3632, 3435, 3988, 4195, 3684, 2173, 6735, 4552, -339, 763, 308, 3463, 6123, 2895, 2831, 5715,
+ 4316, 4111, 2236, 2682, 1058, 544, 2541, 1677, 3549, 2767, 3376, 5901, 6689, 5811, 6617, 3311,
+ 4487, 4285, 4992, 3656, 5970, 4547, 3975, 5998, 4985, 6614, 4807, 1971, 14937, 4388, 6153, 3352,
+ 4601, 4710, 4957, 4454, 4873, 7207, 5881, 3461, 2282, 1829, 5617, 9926, 10043, 7722, 3232, 4629,
+ 3965, 3837, 2088, 4265, 5042, 3478, 4453, 2804, 4162, 4858, 4315, 4343, 5193, -1823, -5028, -1137,
+ 3439, 2837, 2549, 4062, 2857, 2657, 2662, 5088, 10548, 8913, 6631, 6395, 5568, 3210, 2431, 3400,
+ 4073, 3839, 5806, 5296, 3766, 2342, 2585, 891, 3144, 2988, 6807, 4626, 3700, 5854, 1543, 16158,
+ 4189, 4045, 4293, 4527, 4008, 1413, 4871, 6081, 3297, 6546, 5006, -365, -2369, 1375, 5522, 8787,
+ 4778, 4782, 4941, 4538, 4497, 3129, 4934, 4371, 7175, 6923, 8620, 10236, 8664, 10088, 10923, 7314,
+ 4945, 5016, 6439, 6353, 6624, 6463, 6938, 7547, 7004, 7283, 7655, 7149, 7650, 2747, 3416, 14892,
+ 4776, 5431, 5515, 6194, 5700, 5485, 2795, 5476, 4024, 8891, 2930, 7916, 3428, 8070, 5920, 13440,
+ 4718, 4986, 4800, 5286, 6567, 6554, 6601, 1235, -1216, 6556, 6098, 3962, 4361, 5536, 5517, 3935,
+ 4741, 4679, 5593, 4891, 3849, 5675, 6487, 6239, 7062, 12044, 10918, 2438, 3977, 7296, 8445, 6625,
+ 4859, 5781, 6592, 7399, 8027, 8858, 8139, 8951, 8760, 5506, 6294, 6540, 6516, 7527, 7688, 4084,
+ 4077, 3771, 3650, 3381, 3367, 4048, 3899, 4382, 3017, -2156, -1464, -2207, 828, 4838, 2071, 2363,
+ 3796, 3437, 3558, 3842, 2170, 4311, 2602, 696, 1939, 2576, 1239, 328, -129, -647, 1702, 2893,
+ 4015, 3506, 367, 1350, 3328, 3700, 3827, 2439, 1434, 3887, 2279, 1593, 3673, 5508, 3905, -2973,
+ 4088, 3990, 3732, 3256, 4718, 1375, 152, -99, -254, 1140, 3578, 3316, 2195, 2408, 5027, 999,
+ 3749, 3175, 1475, 686, 2006, 1959, 1558, 3059, 5374, 5014, 2439, 2396, 2467, 2218, 1031, 7866,
+ 2037, 701, 124, 278, 328, 253, 660, 528, 826, 473, 801, 800, 1053, 1330, 804, 967,
+};
+
+
+const Word16 tbl_mid_unv_wb_4b_fx[] =//Q13
+{
+ 5190, 3143, 50, 2521, 5180, 6320, 3890, 3365, 3582, 3517, 3406, 3049, 2864, 1621, 1932, -950,
+ 6813, 6650, 2135, 972, 452, 1453, 3221, 1697, 3165, 4443, 5924, 6297, 3907, 2862, 3586, 4625,
+ 3204, 2673, 6499, 4319, 1054, 559, 4404, 5815, 5072, 6625, 4493, 2479, 1773, 1606, 2099, 8330,
+ 1924, 2666, 4171, 5517, 5898, 7238, 7318, 7696, 7250, 6269, 6164, 6038, 5249, 4284, 4147, 2828,
+ 2834, 788, 77, 2016, 1824, 3224, 3441, 4472, 6286, 6717, 6783, 6743, 6715, 7051, 6562, 2531,
+ 6386, 5634, 5761, 5184, 3523, 4284, 1867, 1045, 579, 1176, 1743, 2599, 5276, 5564, 5368, 7914,
+ 1795, 1380, 5184, 9326, 8023, 3138, 1258, 1729, 3328, 3934, 5169, 5645, 5271, 5894, 5591, 5145,
+ 5734, 5844, 8799, 8753, 5628, 5710, 5255, 4872, 5349, 3431, 3006, 2486, 1418, 974, 1115, 2035,
+ 4194, 8421, 1812, 6078, 3003, 3455, 6719, 7501, 2120, 1892, 2658, 2317, 2296, 5735, 6553, 4485,
+ 8072, 11456, 6455, 5069, 4918, 4936, 4819, 4932, 6029, 6246, 6289, 6704, 6749, 5337, 4526, 3974,
+ 3709, 5584, 4884, -1502, 4864, 2333, 606, 5976, 6438, 2413, 1937, 3663, 5593, 6989, 6450, 3555,
+ 3843, -6887, 3697, 3880, 4448, 4264, 5961, 4198, 3583, 3942, 3606, 3768, 4457, 4374, 4096, 4524,
+ 2551, 6781, 7017, 2902, 9227, 8728, 7130, 1873, 2308, 4393, 3981, 3976, 4002, 4080, 4820, 5611,
+ 220, -174, -43, -542, 449, 1470, 1759, 1893, 1294, 995, 723, 723, 769, 994, 1369, 4413,
+ 1651, 2259, 3079, 2913, 1176, -491, -1262, -827, -217, 908, 1126, 1751, 1901, 1765, 2656, 247,
+ 5380, 7307, 7727, 8135, 8270, 8471, 8792, 8573, 8335, 8420, 8057, 7562, 7119, 7458, 6806, 7385,
+};
+const Word16 tbl_mid_unv_wb_5b_fx[] =
+{//Q13
+ 6237, 6323, 1151, 763, 4218, 6546, 8437, 8701, 7456, 6604, 4631, 2901, 3050, 1793, 1955, 2260,
+ 5542, 4318, 5343, 5521, 5999, 5477, 5265, 5234, 4616, 3329, 3444, 1816, -442, 45, -2, 8922,
+ 6370, 8208, 6583, 5630, 5401, 5458, 5188, 5595, 6637, 6891, 6962, 6967, 7014, 6330, 5445, 3101,
+ 2750, 2858, 5206, 4594, 3310, 3494, 2463, 3410, 3405, 6151, 7682, 8593, 4440, 3715, 2946, -4371,
+ 1157, 661, 3743, 6418, 7515, 8319, 7485, 7298, 7928, 7515, 6812, 5671, 5095, 5122, 4997, 3940,
+ 5133, 3446, 2693, 1620, 1860, 2663, 4603, 6289, 7451, 7255, 7511, 7486, 8869, 8704, 8431, 6632,
+ 2497, 6706, 7036, 3437, 10854, 8893, 6033, 3021, 2936, 4766, 4145, 4097, 5177, 4883, 5920, 7612,
+ -152, -54, 3955, 1170, 5562, 4695, 1370, 8293, 3106, 1942, 5508, 4878, 3495, 1094, 1079, 5401,
+ 482, 373, 220, -355, -236, -328, -426, -147, 244, 563, 567, 915, 1012, 676, 804, 2721,
+ 437, 816, 3208, 3395, 2501, 3795, 4380, 2553, 399, 31, -519, -475, -162, 1755, 2852, 1040,
+ 2067, 2125, 1247, 2393, 2872, 2218, 3502, 3977, 4712, 4275, 2600, 2380, 2314, 2893, 3555, 13929,
+ 3967, -635, -1752, 2490, 303, 969, 1045, 2839, 5670, 4651, 5202, 5248, 4182, 4381, 5492, 53,
+ 3041, 2494, 9264, 4970, 360, -3795, 6296, 6475, 4482, 6667, 5265, 2908, 2381, 2889, 3718, 5160,
+ 3364, 4119, 5929, 3164, -745, 9368, 1652, -719, 6323, 5113, 1919, 1260, 2630, 3585, 2224, 3178,
+ 1643, 837, 8074, 8337, 4237, 2332, 2190, -1176, 1968, 1238, 2354, 4756, 5269, 5759, 4962, 5411,
+ 7590, 6471, 2635, 1869, 1209, 1505, 2118, 892, 1652, 3717, 5010, 3969, 2265, 2428, 3278, 5027,
+ 7289, 8658, 11183, 8913, 6084, 6673, 5961, 4041, 3839, 2643, 2094, 3215, 2956, 2895, 3327, 5063,
+ 5814, -4982, 1120, 2112, 4384, 5288, 6052, 4305, 4724, 5062, 3380, 4200, 5838, 7181, 6383, 4771,
+ 3891, 7361, 4160, 1422, 4971, 939, 281, 3585, 4817, 1176, -306, 260, 3815, 8273, 7095, 1529,
+ 8179, 19416, 3518, 3547, 4619, 4231, 3359, 3606, 5131, 4469, 5204, 5115, 4941, 4772, 4175, 5160,
+ 4539, 5393, 2706, 5371, 1468, 8488, 10356, 2778, 1426, 371, 8093, 7808, 5208, 5996, 6081, 5057,
+ 3266, 3481, -4953, -5638, 4022, 5502, 3586, 3117, 2737, 3826, 3658, 3933, 3602, 4920, 4959, 3483,
+ 3846, 9592, 3360, 6480, 1215, 3170, 5218, 8641, 664, 2695, 3353, 1479, 1687, 6049, 7074, 4696,
+ 2231, 4497, 6761, 6799, 5941, 5445, 8083, 7944, 5879, 3744, 2518, 6482, 6581, 6096, 6379, -133,
+ 3360, 6078, 1064, 13807, 8185, 3605, 4327, 3777, 6211, 4977, 5015, 4871, 5825, 2506, 2130, 4946,
+ 5412, 4507, 952, 4098, 5027, 3949, 3501, 1778, 1955, 2126, 1626, 3669, 4446, -1101, 736, -2708,
+ 4824, 7481, 8884, -2619, -2754, 281, 4158, 3251, 4602, 2946, 3915, 6169, 6075, 3495, 3266, 4375,
+ 6135, 2668, 6784, 10326, 6892, 5479, 1511, 3070, 6410, 9193, 6954, 1084, 2873, 7030, 8139, 5670,
+ 7255, 5764, 5122, 5787, 3129, 5475, -2720, 3770, -827, 872, 1591, 4645, 7218, 5513, 5778, 6323,
+ 1185, -13100, 5560, 5867, 4153, 2591, 4923, 3450, 2062, 4251, 4289, 3397, 3835, 2082, 2343, 3172,
+ 4460, 4411, 3940, 4420, 9410, -2789, -2525, -2877, -1868, 2850, 4490, 4093, 3162, 3889, 3800, 3492,
+ 6408, 8292, 8434, 8544, 8707, 9146, 9377, 9301, 9063, 8945, 8346, 8173, 7175, 7254, 6120, 7420,
+};
+
+
+/*------------------------------------------------------------------------------*
+ * AVQ - RE8 tables
+ *------------------------------------------------------------------------------*/
+
+const Word16 select_table22[5][9] =
+{
+ {1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {0, 1, 2, 3, 4, 5, 6, 7, 8},
+ {0, 0, 1, 3, 6, 10, 15, 21, 28},
+ {0, 0, 0, 1, 4, 10, 20, 35, 56},
+ {0, 0, 0, 0, 1, 5, 15, 35, 70}
+}; // Q0
+
+/* value of leader element */
+const Word16 vals_a[36][4] =
+{
+ {1}, {0,2}, {0,2}, {1,3}, {0,4}, {2,0}, {1,3}, {0,2,4},
+ {2}, {1,3}, {2,0,4}, {0,4}, {1,5}, {1,3}, {2,0,4}, {0,2,4},
+ {1,3,5}, {0,2,6}, {0,4}, {0,2,6}, {0,2,4,6}, {1,7}, {0,8}, {0,6},
+ {0,2,8}, {0,4,8}, {1,9}, {0,2,10}, {0,8}, {0,6,10}, {0,12}, {0,4,12},
+ {0,10}, {0,2,14}, {0,8,12}, {0,16}
+}; // Q0
+
+/* code parameter for every leader */
+const Word16 vals_q[36][4] =
+{
+ {7,1}, {2,2,2}, {4,2,4}, {7,2,1}, {1,2,1}, {6,2,2}, {7,2,2}, {3,3,3,1},
+ {8,1}, {7,2,3}, {5,3,4,1}, {2,2,2}, {7,2,1}, {7,2,4}, {7,3,2,1}, {4,3,4,2},
+ {7,3,2,1}, {2,3,2,1}, {3,2,3}, {4,3,4,1}, {3,4,3,2}, {7,2,1}, {1,2,1}, {2,2,2},
+ {3,3,3,1}, {2,3,2,1}, {7,2,1}, {2,3,2,1}, {2,2,2}, {2,3,2,1}, {1,2,1}, {2,3,2,1},
+ {2,2,2}, {2,3,2,1}, {2,3,2,1}, {1,2,1}
+}; // Q0
+
+/* codebook start address for every leader */
+const UWord16 Is[36] =
+{
+ 0, 128, 256, 1376, 240, 0, 1792, 2400, 5376, 5632, 12800, 3744,
+ 21760, 22784, 31744, 38912, 45632, 3856, 52800, 53248, 57728, 60416, 4080, 61440,
+ 61552, 62896, 63120, 64144, 64368, 64480, 64704, 64720, 64944, 65056, 65280, 65504
+}; // Q0
+
+/* A3 - Number of the absolute leaders in codebook Q3 */
+const Word16 AA3[NB_LDQ3] =
+{
+ 0, 1, 4, 2, 3, 7, 11, 17, 22
+}; // Q0
+
+/* A4 - Number of the absolute leaders in codebook Q4 */
+const Word16 AA4[NB_LDQ4] =
+{
+ 5, 6, 8, 9, 10, 12, 13, 14, 15,
+ 16, 18, 19, 20, 21, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35
+}; // Q0
+
+/* I3 - Cardinality offsets for absolute leaders in Q3 */
+const UWord16 II3[NB_LDQ3] =
+{
+ 0, 128, 240, 256, 1376, 2400, 3744, 3856, 4080
+}; // Q0
+
+/* I4 - Cardinality offset for absolute leaders in Q4 */
+const UWord16 II4[NB_LDQ4] =
+{
+ 0, 1792, 5376, 5632, 12800, 21760, 22784, 31744, 38912,
+ 45632, 52800, 53248, 57728, 60416, 61440, 61552, 62896, 63120,
+ 64144, 64368, 64480, 64704, 64720, 64944, 65056, 65280, 65504
+}; // Q0
+
+ /* Position of the first absolute leader on a spherical shell (or sphere) */
+const Word16 Da_pos[NB_SPHERE] =
+{
+ 0, 2, 5, 8, 13, 18, 20, 22, 23, 25, 26, 27, 27, 28, 28, 28,
+ 29, 30, 31, 31, 32, 32, 32, 32, 32, 34, 35, 35, 35, 35, 35, 35
+}; // Q0
+
+/* Number of absolute leaders on a spherical shell */
+const Word16 Da_nb[NB_SPHERE] =
+{
+ 2, 3, 3, 5, 5, 2, 2, 1, 2, 1, 1, 0, 1, 0, 0, 1,
+ 1, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1
+}; // Q0
+
+/* Identification code of an absolute leader */
+const Word16 Da_id[NB_LEADER] =
+{
+ 0x0001, 0x0004, 0x0008, 0x000B, 0x0020, 0x000C, 0x0015, 0x0024,
+ 0x0010, 0x001F, 0x0028, 0x0040, 0x004F, 0x0029, 0x002C, 0x0044,
+ 0x0059, 0x00A4, 0x0060, 0x00A8, 0x00C4, 0x012D, 0x0200, 0x0144,
+ 0x0204, 0x0220, 0x0335, 0x04E4, 0x0400, 0x0584, 0x0A20, 0x0A40,
+ 0x09C4, 0x12C4, 0x0C20, 0x2000
+}; // Q0
+
+/* Codebook number for each absolute leader */
+const Word16 Da_nq[NB_LEADER+2] =
+{
+ 2, 2, 3, 3, 2, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 4,
+ 4, 3, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 0, 100
+}; // Q0
+
+
+/*------------------------------------------------------------------------------*
+ * SWB TBE tables
+ *------------------------------------------------------------------------------*/
+
+const Word16 skip_bands_SWB_TBE[NUM_SHB_SUBFR+1] = {0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320}; /* bands for SWB TBE quantisation Q0*/
+const Word16 skip_bands_WB_TBE[NUM_SHB_SUBFR/2+1] = {0, 10, 20, 30, 40, 50, 60, 70, 80}; /* bands for WB TBE quantisation Q0*/
+
+const Word16 interpol_frac_shb[NB_SUBFR * 2] =
+{
+ 22938, 9830, 13107, 19660, 3277, 29490, 0, 32767 /* Q15*/
+ /*0.7f, 0.3f, 0.4f, 0.6f, 0.1f, 0.9f, 0.0f, 1.0f */
+};
+/* All pass filter coeffs for interpolation and decimation by a factor of 2 */
+const Word16 AP1_STEEP_FX[ALLPASSSECTIONS_STEEP] = { 1985, 14072, 26500 }; /*Q15 Format */
+const Word16 AP2_STEEP_FX[ALLPASSSECTIONS_STEEP] = { 7230, 20838, 30852 }; /*Q15 Format */
+const Word16 cos_fb_exc_fx[32] = /* Q15 */
+{
+ /*Q35*/
+ 32767, 32138, 30274, 27246, 23170, 18205, 12540, 6393,
+ 0, -6393, -12540, -18205, -23170, -27246, -30274, -32138,
+ -32768, -32138, -30274, -27246, -23170, -18205, -12540, -6393,
+ 0, 6393, 12540, 18205, 23170, 27246, 30274, 32138,
+};
+
+const Word16 Hilbert_coeffs_fx[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1] = /* Q14 */
+{
+ { 0, 14320, 0, -30699, 0, 16384}, /* num_Real[0] */
+ {11897, 0, -28240, 0, 16384, 0}, /* num_Imag[0] */
+ {16384, 0, -30699, 0, 14320, 0}, /* den_Real[0] */
+ {16384, 0, -28240, 0, 11897, 0}, /* den_Imag[0] */
+ {7671, 0, -23855, 0, 16384, 0}, /* num_Real[1] */
+ { 2505, 0, -18139, 0, 16384, 0}, /* num_Imag[1] */
+ {16384, 0, -23855, 0, 7671, 0}, /* den_Imag[1] */
+ {16384, 0, -18139, 0, 2505, 0}, /* den_Imag[1] */
+};
+
+
+/* Overlap add window for SHB excitation used in analysis and synthesis */
+
+const Word16 window_shb_fx[L_SHB_LAHEAD] = /*sin, 1, sin */
+{
+ /*Q15(round) */
+ 1513, 4527, 7502, 10413, 13236, 15945, 18518, 20934, 23170, 25210,
+ 27034, 28627, 29976, 31069, 31898, 32454, 32733, 32767, 32767, 32767,
+};
+
+/* Upsampled overlap add window for SHB excitation used transition generation */
+
+const Word16 window_shb_32k_fx[2 * L_SHB_LAHEAD] =
+{
+ /*Q15(round) */
+ 1513, 3020, 4527, 6015, 7502, 8958, 10413, 11825, 13236, 14590,
+ 15945, 17232, 18518, 19726, 20934, 22052, 23170, 24190, 25210, 26122,
+ 27034, 27830, 28627, 29301, 29976, 30523, 31069, 31483, 31898, 32176,
+ 32454, 32593, 32733, 32751, 32767, 32767, 32767, 32767, 32767, 32767,
+};
+
+/* Short overlap add window for SHB excitation used in anal and synth */
+
+const Word16 subwin_shb_fx[SHB_OVERLAP_LEN + 1] =
+{
+ /*Q15(round) */
+ 0, 202, 802, 1786, 3129,
+ 4799, 6754, 8946, 11321, 13821,
+ 16384,18947, 21447, 23822, 26014,
+ 27969, 29639, 30982, 31966, 32566,
+ 32767
+};
+
+const Word16 window_wb_fx[L_SHB_LAHEAD / 4] =/*sin, 1 */
+{ 7502, 18518, 27034, 31898, 32767 }; /*Q15*/
+
+/* Short overlap add window for SHB excitation used in anal and synth */
+
+const Word16 subwin_wb_fx[SHB_OVERLAP_LEN / 2 + 1] =
+{ 0, 5126, 10126, 14876, 19261, 23170, 26510, 29197, 31164, 32365, 32767 }; // Q15
+
+/* Window for calculating SHB LPC coeffs */
+
+const Word16 win_lpc_shb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 8] =
+{
+ /*Q15 */
+ 1, 4, 10, 18, 28, 40, 54, 71, 89, 110, 134, 159, 186, 216, 248,
+ 282, 318, 357, 397, 440, 485, 532, 581, 632, 686, 741, 799, 859, 921,
+ 984, 1050, 1119, 1189, 1261, 1335, 1411, 1490, 1570, 1652, 1736, 1823,
+ 1911, 2001, 2093, 2187, 2283, 2381, 2481, 2582, 2686, 2791, 2898, 3007,
+ 3118, 3230, 3345, 3461, 3579, 3698, 3819, 3942, 4067, 4193, 4321, 4451,
+ 4582, 4715, 4849, 4985, 5123, 5261, 5402, 5544, 5687, 5832, 5978, 6126,
+ 6275, 6426, 6577, 6730, 6885, 7041, 7197, 7356, 7515, 7676, 7837, 8000,
+ 8164, 8329, 8496, 8663, 8831, 9001, 9171, 9342, 9515, 9688, 9862, 10037,
+ 10213, 10390, 10567, 10745, 10924, 11104, 11285, 11466, 11648, 11830, 12013,
+ 12197, 12381, 12566, 12751, 12937, 13123, 13310, 13497, 13684, 13872, 14060,
+ 14249, 14438, 14627, 14816, 15006, 15195, 15385, 15575, 15765, 15955, 16146,
+ 16336, 16526, 16716, 16907, 17097, 17287, 17477, 17667, 17856, 18046, 18235,
+ 18424, 18612, 18801, 18989, 19176, 19364, 19551, 19737, 19923, 20109, 20294,
+ 20478, 20662, 20846, 21028, 21210, 21392, 21573, 21753, 21932, 22111, 22289,
+ 22466, 22642, 22818, 22992, 23166, 23339, 23510, 23681, 23851, 24020, 24188,
+ 24355, 24520, 24685, 24848, 25011, 25172, 25332, 25491, 25648, 25804, 25960,
+ 26113, 26266, 26417, 26567, 26715, 26862, 27007, 27152, 27294, 27435, 27575,
+ 27713, 27850, 27985, 28119, 28251, 28381, 28510, 28637, 28762, 28886, 29008,
+ 29129, 29248, 29364, 29480, 29593, 29705, 29815, 29923, 30029, 30133, 30236,
+ 30337, 30435, 30532, 30627, 30720, 30811, 30901, 30988, 31073, 31156, 31238,
+ 31317, 31394, 31469, 31543, 31614, 31683, 31750, 31815, 31878, 31938, 31997,
+ 32054, 32108, 32161, 32211, 32259, 32305, 32349, 32390, 32430, 32467, 32502,
+ 32535, 32566, 32595, 32621, 32645, 32667, 32687, 32705, 32720, 32734, 32745,
+ 32753, 32760, 32765, 32767
+};
+
+
+const Word16 win_lpc_hb_wb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 32] =
+{//Q15
+ 17, 70, 157, 279, 435, 625, 849, 1106,
+ 1396, 1718, 2071, 2454, 2867, 3309, 3779, 4276,
+ 4799, 5346, 5917, 6510, 7125, 7759, 8411, 9081,
+ 9766, 10465, 11177, 11900, 12633, 13373, 14120, 14872,
+ 15627, 16384, 17141, 17896, 18648, 19395, 20135, 20868,
+ 21591, 22303, 23002, 23687, 24357, 25009, 25643, 26258,
+ 26851, 27422, 27969, 28492, 28989, 29459, 29901, 30314,
+ 30697, 31050, 31372, 31662, 31919, 32143, 32333, 32489,
+ 32611, 32698, 32751
+};
+
+const Word16 win_lpc_hb_wb_ivas_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 32] =
+{//Q15
+ 6, 51, 140, 274,
+ 453, 675, 940, 1247,
+ 1596, 1985, 2414, 2882,
+ 3386, 3926, 4499, 5106,
+ 5743, 6410, 7104, 7823,
+ 8566, 9331, 10114, 10915,
+ 11731, 12559, 13398, 14245,
+ 15099, 15955, 16813, 17669,
+ 18523, 19370, 20209, 21037,
+ 21853, 22654, 23437, 24202,
+ 24945, 25664, 26358, 27025,
+ 27662, 28269, 28842, 29382,
+ 29886, 30354, 30783, 31172,
+ 31521, 31828, 32093, 32315,
+ 32494, 32628, 32717, 32762
+};
+
+
+const Word16 ola_win_shb_switch_fold_fx[L_SUBFR16k] =
+{//Q15
+ 322, 965, 1608, 2250, 2892, 3532, 4171, 4808,
+ 5444, 6077, 6708, 7336, 7962, 8585, 9204, 9819,
+ 10431, 11039, 11643, 12242, 12836, 13426, 14010, 14589,
+ 15162, 15730, 16291, 16846, 17395, 17937, 18472, 18999,
+ 19520, 20033, 20538, 21035, 21525, 22006, 22478, 22942,
+ 23397, 23843, 24279, 24707, 25125, 25533, 25931, 26320,
+ 26698, 27066, 27423, 27770, 28106, 28431, 28746, 29049,
+ 29341, 29622, 29891, 30149, 30395, 30630, 30853, 31063,
+ 31262, 31449, 31624, 31786, 31936, 32074, 32200, 32313,
+ 32413, 32501, 32577, 32640, 32691, 32729, 32754, 32766
+};
+
+/* Window for calculating whitening filter for SHB excitation */
+
+const Word16 win_flatten_fx[L_FRAME16k / 2] = /*Q15 */
+{
+ 3, 13, 28, 50, 78, 113, 154, 200, 254, 313,
+ 378, 450, 528, 611, 701, 797, 899, 1006, 1120, 1239,
+ 1365, 1496, 1632, 1775, 1923, 2076, 2235, 2400, 2569, 2745,
+ 2925, 3110, 3301, 3496, 3697, 3902, 4112, 4327, 4546, 4770,
+ 4999, 5232, 5469, 5710, 5955, 6205, 6458, 6715, 6976, 7240,
+ 7508, 7779, 8054, 8331, 8612, 8896, 9183, 9472, 9764, 10059,
+ 10356, 10655, 10956, 11260, 11566, 11873, 12182, 12493, 12805, 13119,
+ 13434, 13750, 14067, 14385, 14703, 15023, 15342, 15663, 15983, 16304,
+ 16625, 16945, 17265, 17586, 17905, 18224, 18542, 18860, 19176, 19492,
+ 19806, 20119, 20431, 20741, 21049, 21355, 21660, 21963, 22263, 22561,
+ 22857, 23150, 23441, 23729, 24014, 24297, 24576, 24852, 25125, 25395,
+ 25661, 25923, 26182, 26437, 26689, 26936, 27179, 27418, 27653, 27884,
+ 28110, 28332, 28549, 28761, 28969, 29172, 29370, 29563, 29751, 29934,
+ 30112, 30284, 30451, 30613, 30769, 30920, 31065, 31205, 31338, 31467,
+ 31589, 31705, 31816, 31921, 32020, 32113, 32199, 32280, 32355, 32423,
+ 32486, 32542, 32592, 32636, 32673, 32704, 32730, 32748, 32761, 32767
+};
+
+const Word16 win_flatten_4k_fx[L_FRAME16k / 8] = /*Q15 */
+{
+ 13, 114, 315, 615, 1013, 1505, 2089, 2761,
+ 3517, 4353, 5263, 6241, 7282, 8378, 9525, 10713,
+ 11937, 13188, 14458, 15741, 17027, 18310, 19580, 20831,
+ 22055, 23243, 24390, 25486, 26527, 27505, 28415, 29251,
+ 30007, 30679, 31263, 31755, 32153, 32453, 32654, 32755
+};
+
+const Word16 wb_bwe_lsfvq_cbook_8bit_fx[256 * 6] =
+{//Q15
+ 2107, 3430, 5123, 6677, 9403, 13197,
+ 4031, 5069, 7343, 8910, 10647, 12245,
+ 2037, 3542, 6708, 8763, 10505, 12655,
+ 5732, 6373, 7912, 9546, 12584, 14230,
+ 2028, 3337, 5473, 7880, 10269, 12450,
+ 5809, 6497, 8317, 9624, 11497, 14007,
+ 2428, 3962, 5675, 7724, 11361, 13385,
+ 6348, 8307, 8898, 9948, 11058, 13350,
+ 3552, 4421, 5896, 7143, 9975, 13233,
+ 5719, 6344, 7482, 8403, 10765, 13455,
+ 3509, 4379, 5896, 7437, 11765, 14307,
+ 4521, 8122, 8791, 9856, 11232, 14020,
+ 2175, 3970, 7788, 9803, 11334, 12910,
+ 4511, 8156, 8886, 10450, 12686, 14959,
+ 4223, 5285, 7053, 8423, 11317, 14566,
+ 7159, 8379, 9040, 10122, 11799, 14270,
+ 1866, 3064, 4848, 7227, 11225, 13963,
+ 5915, 6631, 8740, 10002, 11385, 12726,
+ 3342, 4547, 6475, 9404, 11994, 13418,
+ 6156, 6880, 8932, 10353, 12380, 13746,
+ 2648, 4972, 7575, 9476, 12117, 13875,
+ 5822, 6526, 8747, 10941, 12671, 13971,
+ 4032, 5110, 7592, 9267, 11374, 14390,
+ 6864, 8384, 9086, 10649, 12944, 15026,
+ 3661, 4636, 6668, 8329, 10374, 12185,
+ 5802, 6444, 8344, 9811, 12234, 14843,
+ 3593, 4436, 6663, 8693, 11539, 14272,
+ 5110, 8270, 9006, 10703, 12269, 13901,
+ 1992, 3229, 5616, 9085, 11419, 13254,
+ 4319, 5859, 9602, 11396, 12836, 14199,
+ 3836, 4822, 8285, 10190, 11728, 13302,
+ 8016, 8698, 10179, 11434, 12944, 14783,
+ 1891, 3329, 6168, 8307, 10818, 14213,
+ 5803, 6442, 7973, 9131, 11090, 12657,
+ 2803, 5499, 8093, 9694, 11223, 12849,
+ 6222, 6981, 8615, 9848, 12016, 13380,
+ 2543, 4747, 7638, 9373, 11129, 13652,
+ 5912, 6615, 9006, 10553, 11959, 13312,
+ 3604, 4520, 7650, 9833, 12161, 14748,
+ 7970, 8729, 9780, 10789, 12483, 13985,
+ 3793, 4716, 7041, 8547, 10610, 13601,
+ 5640, 6235, 7313, 8370, 12057, 14300,
+ 3765, 4699, 6784, 9512, 12663, 14216,
+ 4634, 8363, 9195, 10385, 11477, 13310,
+ 2462, 4816, 8556, 10394, 11920, 13468,
+ 3698, 7974, 9207, 10962, 13507, 15208,
+ 3738, 4667, 7545, 10775, 13024, 14559,
+ 7267, 8610, 9509, 11264, 12821, 14495,
+ 2624, 4295, 6173, 8897, 12343, 14174,
+ 6324, 7135, 8742, 10013, 12598, 14108,
+ 4448, 5839, 8842, 10335, 11737, 13071,
+ 6147, 6988, 9510, 10893, 12240, 13535,
+ 3025, 5140, 7152, 9223, 11404, 13255,
+ 5985, 6782, 9611, 11341, 12723, 14007,
+ 4679, 5958, 8100, 9842, 11835, 13492,
+ 7740, 8565, 9432, 10478, 12611, 14609,
+ 3830, 4784, 7681, 9528, 11134, 12675,
+ 5742, 6527, 8359, 10728, 13195, 14626,
+ 4491, 5635, 7284, 8749, 11594, 13785,
+ 6772, 8490, 9253, 10943, 12476, 13973,
+ 2024, 3588, 7524, 10453, 12198, 13858,
+ 5783, 8882, 9978, 11763, 13237, 14829,
+ 3979, 5009, 8342, 10323, 12231, 14313,
+ 8148, 8903, 10193, 11350, 13246, 14490,
+ 2297, 3810, 5638, 7265, 9162, 11514,
+ 5809, 6518, 7832, 8766, 10327, 11957,
+ 2535, 4591, 7415, 9080, 10623, 12257,
+ 5948, 6598, 8515, 10082, 12721, 14188,
+ 2443, 4278, 6581, 8172, 9883, 11807,
+ 5913, 6535, 8878, 10296, 12141, 14245,
+ 2428, 3925, 6409, 9835, 11962, 13628,
+ 7430, 8531, 9302, 10259, 11444, 12933,
+ 3701, 4694, 6372, 7671, 9445, 11571,
+ 5822, 6470, 7807, 8885, 11506, 14529,
+ 3742, 4580, 6232, 7860, 11252, 13127,
+ 5710, 8330, 8943, 10243, 11696, 14511,
+ 2607, 4197, 6714, 10408, 12714, 14320,
+ 4116, 8438, 9717, 11018, 12156, 13663,
+ 4224, 5318, 7486, 10110, 12779, 14331,
+ 5565, 8413, 9115, 10930, 12588, 14759,
+ 1898, 3150, 5779, 9497, 12432, 14439,
+ 6274, 7186, 9258, 10404, 11733, 12952,
+ 3700, 4591, 7575, 9533, 11461, 13777,
+ 6234, 7104, 9032, 10986, 13088, 14417,
+ 2354, 4579, 7744, 9960, 12629, 14802,
+ 6050, 6729, 9345, 10745, 12436, 14253,
+ 4345, 5529, 8117, 9718, 12433, 14109,
+ 8009, 8701, 9863, 10954, 13046, 14474,
+ 4184, 5186, 6876, 8428, 11236, 12973,
+ 6113, 6842, 8386, 9659, 12892, 14707,
+ 3989, 4936, 7152, 8879, 11743, 13632,
+ 5169, 8411, 9209, 11361, 13452, 15076,
+ 2397, 4387, 7033, 9035, 11821, 13736,
+ 3607, 8128, 10170, 11565, 12819, 14147,
+ 4449, 5805, 8963, 10676, 12596, 14558,
+ 7911, 8741, 10040, 11622, 13579, 15092,
+ 2372, 4290, 6990, 8705, 10637, 13685,
+ 6137, 6917, 8382, 9380, 10859, 12348,
+ 3235, 5973, 8187, 10174, 12420, 14382,
+ 6077, 6764, 8551, 9803, 12150, 14079,
+ 2952, 5097, 6853, 8952, 12066, 14080,
+ 6606, 7683, 9508, 10695, 12182, 13601,
+ 3707, 4638, 7468, 10484, 12295, 13754,
+ 7960, 8715, 10051, 11348, 12757, 14072,
+ 4139, 5241, 7576, 9037, 10912, 13485,
+ 5838, 6444, 7768, 8965, 12867, 14998,
+ 4245, 5338, 7248, 9190, 12328, 14047,
+ 6159, 8874, 9899, 11134, 12150, 13512,
+ 2250, 4288, 8698, 10944, 12624, 14316,
+ 3146, 6848, 9904, 11775, 13534, 14953,
+ 4044, 5161, 8365, 10294, 12945, 14907,
+ 7398, 8724, 9813, 11821, 13246, 14552,
+ 2121, 3890, 6855, 9274, 12059, 14663,
+ 6329, 7182, 8789, 10081, 13001, 14917,
+ 4484, 5761, 8634, 10295, 12111, 14022,
+ 6326, 7208, 9672, 11078, 12830, 14529,
+ 3230, 5564, 7646, 9955, 12011, 13683,
+ 4683, 6896, 10002, 11805, 13329, 14747,
+ 4771, 6044, 8081, 10305, 12526, 14037,
+ 8231, 9203, 10351, 11427, 12926, 14635,
+ 4385, 5774, 7989, 9305, 10751, 12299,
+ 5810, 6658, 9062, 11629, 13359, 14655,
+ 4288, 5388, 7804, 9378, 11781, 13652,
+ 4398, 8560, 9646, 11161, 12701, 14872,
+ 1947, 3440, 7202, 10953, 13222, 14806,
+ 4686, 8972, 10615, 12054, 13260, 14615,
+ 3801, 4849, 8922, 11200, 12882, 14423,
+ 8061, 8813, 10453, 11912, 13335, 14710,
+ 2365, 3888, 5664, 7346, 10407, 14331,
+ 4563, 5839, 7472, 8684, 10572, 12800,
+ 2593, 4197, 6719, 9323, 11229, 12919,
+ 6081, 6774, 8132, 9244, 12202, 13918,
+ 2405, 3981, 6144, 8740, 11347, 13796,
+ 5793, 6444, 8286, 10049, 12152, 13520,
+ 2795, 4727, 6528, 8506, 11323, 13474,
+ 6181, 8598, 9346, 10614, 11725, 13545,
+ 4002, 5001, 6596, 7792, 9987, 13065,
+ 5748, 6365, 7759, 9028, 11818, 13487,
+ 3906, 4863, 6462, 7763, 10705, 14359,
+ 4315, 8428, 9322, 10582, 11942, 14500,
+ 2812, 4622, 7346, 10036, 11745, 13429,
+ 4221, 8338, 9277, 11280, 12869, 14317,
+ 4345, 5427, 7121, 8736, 12787, 14837,
+ 7678, 8614, 9456, 10461, 12024, 13852,
+ 2193, 3662, 5609, 7867, 12276, 14739,
+ 6083, 6864, 8879, 10080, 11623, 13720,
+ 4114, 5125, 7224, 9729, 11808, 13297,
+ 6383, 7232, 9252, 10720, 12622, 14030,
+ 2788, 5189, 8074, 9953, 11795, 14361,
+ 6079, 6987, 8662, 10589, 12444, 14390,
+ 4480, 5690, 7708, 9115, 11800, 14576,
+ 7848, 8763, 9802, 10924, 12515, 14832,
+ 3582, 4575, 6729, 9084, 11139, 12800,
+ 5885, 6534, 8853, 10432, 12664, 14960,
+ 3891, 4850, 7195, 8932, 12097, 14665,
+ 5797, 8545, 9385, 11556, 12997, 14392,
+ 1962, 3544, 7039, 9349, 11272, 13857,
+ 4106, 5493, 9652, 12038, 13603, 14932,
+ 4328, 5413, 7949, 10282, 12164, 13618,
+ 8135, 8918, 10057, 11085, 13190, 15015,
+ 2702, 4627, 6447, 8009, 10197, 13676,
+ 5998, 6656, 8315, 9496, 11597, 13122,
+ 3146, 6293, 8530, 10158, 11798, 13558,
+ 6374, 7289, 8698, 9776, 11885, 14236,
+ 3171, 5794, 7737, 9377, 11312, 13878,
+ 6279, 7150, 9192, 10414, 12052, 14174,
+ 4117, 5195, 7805, 9512, 12450, 14849,
+ 7963, 8955, 10071, 11129, 12324, 13605,
+ 4365, 5505, 7013, 8171, 10488, 13658,
+ 6124, 6894, 8286, 9349, 11859, 14737,
+ 3753, 4673, 6421, 8146, 12726, 14980,
+ 5457, 8706, 9598, 11035, 12294, 14268,
+ 2783, 4916, 7947, 10568, 12395, 14123,
+ 3909, 8145, 9524, 11951, 14052, 15282,
+ 3952, 5139, 8180, 11380, 13699, 15085,
+ 7200, 9031, 10025, 11484, 12924, 14848,
+ 2533, 4412, 6472, 8299, 11405, 14627,
+ 6563, 7530, 9064, 10267, 12560, 14422,
+ 4849, 6618, 8678, 10166, 11983, 13841,
+ 6393, 7569, 9960, 11300, 12644, 13906,
+ 3170, 5117, 7158, 9665, 11687, 14114,
+ 6122, 7071, 10013, 11733, 13170, 14466,
+ 4308, 5441, 7607, 9900, 11904, 14292,
+ 8129, 9024, 10087, 11081, 12670, 14356,
+ 4253, 5392, 8175, 9780, 11353, 12988,
+ 5453, 6638, 8596, 11453, 13885, 15263,
+ 4664, 5903, 7618, 9420, 12198, 13853,
+ 7149, 8859, 9746, 11029, 12219, 14188,
+ 2318, 4251, 7702, 9889, 11778, 14182,
+ 6679, 9280, 10573, 11950, 13100, 14491,
+ 4010, 5176, 8989, 10821, 12250, 13654,
+ 8076, 8886, 10411, 11722, 12992, 14267,
+ 2308, 4017, 6024, 7618, 9736, 13081,
+ 6001, 6751, 7987, 8966, 10964, 13589,
+ 2908, 5350, 7266, 8739, 10442, 12981,
+ 6143, 6839, 9027, 10366, 12881, 14416,
+ 2667, 4224, 6172, 8378, 10717, 12602,
+ 6275, 7120, 9249, 10613, 12580, 14823,
+ 2692, 4586, 6968, 9858, 12120, 14209,
+ 7771, 8769, 9743, 10745, 11943, 13225,
+ 4201, 5355, 7129, 8337, 9975, 11767,
+ 6216, 7100, 8444, 9442, 11298, 13690,
+ 4111, 5040, 6562, 8071, 12034, 13923,
+ 6657, 8599, 9337, 10665, 12040, 14704,
+ 3060, 5215, 7260, 10118, 12577, 14386,
+ 5103, 8913, 10157, 11519, 12669, 14220,
+ 4633, 5920, 7804, 9514, 12741, 14690,
+ 6720, 8585, 9448, 11556, 13510, 15095,
+ 2361, 3970, 6213, 9335, 13270, 15075,
+ 6506, 7440, 9041, 10179, 12024, 13587,
+ 4221, 5405, 8311, 9818, 11579, 14044,
+ 6216, 7224, 9515, 11389, 13545, 15068,
+ 2872, 5507, 8153, 10650, 13065, 14825,
+ 6002, 6676, 9393, 11023, 12965, 14755,
+ 4438, 5642, 8268, 10097, 12295, 14724,
+ 7797, 8622, 9642, 10932, 13287, 15118,
+ 4471, 5638, 7551, 9217, 11440, 12928,
+ 6051, 6890, 8906, 10655, 13437, 15116,
+ 3953, 4934, 7779, 9619, 12204, 14012,
+ 5439, 8649, 9791, 12232, 13899, 15193,
+ 2728, 4495, 6728, 9363, 11344, 14053,
+ 4069, 8460, 9835, 11742, 13366, 14825,
+ 4874, 6937, 9226, 10944, 12845, 14547,
+ 8195, 9093, 10392, 11594, 13355, 15010,
+ 2956, 5192, 7080, 8765, 11014, 14174,
+ 6384, 7287, 8812, 9816, 11336, 12808,
+ 2912, 6122, 9132, 10874, 12583, 14265,
+ 6148, 6925, 8821, 10030, 12212, 14758,
+ 2572, 4778, 7325, 9216, 11620, 14651,
+ 6654, 7718, 9546, 10806, 12633, 14354,
+ 4328, 5514, 8231, 10852, 12821, 14261,
+ 8051, 9205, 10385, 11490, 12674, 13988,
+ 4624, 6013, 7907, 9239, 11160, 13787,
+ 5786, 6531, 8210, 9968, 13410, 15249,
+ 3859, 4898, 7132, 9692, 13395, 15118,
+ 6712, 8944, 10028, 11521, 12690, 14118,
+ 2417, 4875, 9132, 11671, 13382, 14841,
+ 4113, 8355, 10734, 12517, 13905, 15115,
+ 4455, 5753, 7923, 10298, 13343, 15030,
+ 6998, 8878, 10113, 12233, 13768, 15107,
+ 2720, 4801, 6883, 9267, 12694, 14837,
+ 6507, 7496, 9312, 10696, 13185, 14850,
+ 4631, 6341, 9164, 10796, 12325, 13734,
+ 6602, 7817, 9932, 11349, 13132, 14672,
+ 3089, 5561, 7579, 9433, 12256, 14633,
+ 6246, 7715, 10371, 12065, 13563, 14878,
+ 4757, 6352, 8543, 10216, 12748, 14620,
+ 8183, 9366, 10628, 11857, 13185, 14599,
+ 4734, 6314, 8348, 9716, 11274, 12942,
+ 5824, 6871, 9829, 12268, 13874, 15138,
+ 4719, 6142, 8224, 9683, 11915, 14350,
+ 6288, 8774, 9655, 11204, 12696, 14867,
+ 2661, 4586, 7326, 10934, 13501, 15026,
+ 5932, 9323, 10877, 12454, 13715, 15004,
+ 4467, 6039, 8842, 11164, 13356, 14901,
+ 7880, 9158, 10593, 12209, 13609, 14989,
+};
+
+const Word16 swb_tbe_lsfvq_cbook_8b[256 * LPC_SHB_ORDER] = /* Q15 */
+{
+ 1705, 3230, 4202, 5086, 6148, 7221, 8127, 10728, 13656, 15364,
+ 1668, 2958, 4063, 5644, 7356, 9440, 11046, 12261, 13228, 14503,
+ 1546, 2917, 4226, 5477, 6976, 8349, 9709, 11882, 13218, 14715,
+ 1158, 2729, 5177, 6967, 8297, 9611, 10655, 11668, 12757, 14415,
+ 1616, 3005, 4368, 5810, 7107, 8129, 9376, 10457, 12738, 14835,
+ 1232, 2451, 4145, 6446, 7741, 8993, 10377, 11898, 14213, 15314,
+ 1638, 3089, 5134, 6351, 7360, 8304, 9787, 12377, 13755, 15209,
+ 1264, 2543, 5564, 6686, 7958, 9481, 11021, 12517, 13875, 15147,
+ 1304, 2537, 3713, 4863, 6564, 7910, 9400, 11794, 13268, 14834,
+ 1652, 3245, 4686, 6405, 7931, 9223, 10591, 12020, 13193, 14759,
+ 1302, 2619, 4287, 5884, 7166, 8556, 10512, 12471, 13767, 15075,
+ 2034, 3467, 5577, 6530, 7674, 8783, 10920, 12798, 13727, 15002,
+ 2621, 3956, 5275, 6542, 7509, 8517, 9456, 10781, 12456, 14099,
+ 1496, 2653, 4147, 5637, 7370, 9233, 11817, 12986, 13968, 15046,
+ 2224, 3324, 4700, 5868, 7211, 8638, 11369, 12695, 13600, 14559,
+ 1267, 3050, 4707, 6321, 8663, 10140, 11174, 12453, 13425, 14844,
+ 1662, 2980, 4155, 5414, 6639, 7797, 9253, 11360, 12838, 14440,
+ 1521, 2856, 4944, 6367, 7506, 8857, 10971, 12183, 13275, 15006,
+ 1454, 2859, 4563, 5971, 7186, 8569, 10151, 11770, 13396, 14984,
+ 1143, 2942, 5267, 6840, 8377, 9457, 10589, 11615, 13892, 15271,
+ 1674, 3053, 4605, 5768, 7104, 8452, 10094, 11782, 12793, 13758,
+ 1702, 3261, 4723, 6245, 7899, 9494, 11010, 12387, 13680, 15066,
+ 1365, 2796, 5406, 6505, 7488, 8679, 10447, 12000, 13637, 15046,
+ 2090, 3931, 5788, 7157, 8254, 9717, 11007, 12081, 13238, 14880,
+ 1952, 3157, 4132, 5164, 6334, 7389, 9004, 11798, 14096, 15505,
+ 1641, 3212, 4919, 6364, 7863, 9311, 10766, 12234, 13694, 15054,
+ 1653, 3008, 4213, 5354, 6980, 8821, 11185, 12685, 13903, 15251,
+ 1856, 3444, 5146, 6579, 7801, 9250, 11062, 12947, 14145, 15291,
+ 1365, 3567, 5552, 6474, 7332, 8254, 9952, 11364, 13505, 14951,
+ 1488, 2896, 4521, 6279, 7880, 9446, 11418, 12921, 14431, 15465,
+ 1516, 3174, 5364, 6410, 7295, 8285, 10799, 12594, 14172, 15424,
+ 1738, 3416, 5237, 6878, 8440, 10539, 12105, 13063, 13924, 15150,
+ 1431, 2659, 3909, 5328, 6641, 7950, 9347, 11037, 13510, 14992,
+ 1400, 2646, 4233, 6366, 7749, 9220, 10560, 11594, 13046, 14992,
+ 1115, 2198, 3607, 5279, 8055, 9774, 11024, 12426, 13972, 15232,
+ 1360, 3418, 5724, 6973, 7912, 9078, 10810, 12437, 13630, 14826,
+ 1422, 3051, 5132, 6141, 7206, 8275, 9355, 10859, 13814, 15202,
+ 1080, 2227, 4117, 6404, 8080, 9318, 10934, 12404, 13688, 14827,
+ 1611, 3423, 4928, 6214, 7426, 8723, 10502, 11915, 13438, 15105,
+ 1947, 3524, 5198, 7008, 8358, 10006, 11397, 12444, 13583, 15135,
+ 1394, 2672, 4004, 5681, 6953, 8301, 9815, 12000, 13709, 15079,
+ 1788, 3193, 4579, 6221, 7874, 9170, 11186, 12647, 13521, 14538,
+ 1548, 2811, 4058, 5331, 6528, 7769, 10982, 12743, 13822, 15131,
+ 1751, 4007, 5154, 6463, 7935, 9470, 11103, 12406, 13337, 14520,
+ 2004, 3172, 5079, 6116, 7109, 8155, 10351, 12192, 13413, 14773,
+ 1644, 3185, 4750, 6290, 7816, 9271, 11041, 12831, 14139, 15341,
+ 2311, 3779, 5116, 6100, 7321, 9139, 10353, 12134, 13834, 15172,
+ 1723, 3339, 5049, 6754, 8353, 10290, 12048, 13157, 14206, 15460,
+ 2218, 3501, 4639, 5764, 6789, 7834, 9804, 11907, 13182, 14689,
+ 1640, 3173, 4679, 6202, 7660, 9120, 10773, 12395, 13894, 15200,
+ 1591, 3070, 4537, 6005, 7341, 8802, 10480, 12240, 13768, 15130,
+ 1169, 3611, 5983, 7054, 8601, 10022, 10948, 11927, 12834, 14747,
+ 1708, 3191, 4642, 6156, 7396, 8805, 10028, 11733, 13206, 14857,
+ 1519, 3082, 4752, 6484, 7730, 9328, 10796, 12003, 14524, 15513,
+ 2153, 3558, 5162, 6714, 7762, 8857, 10008, 12012, 13725, 15209,
+ 2680, 4053, 5310, 6996, 8309, 9343, 10361, 12333, 14224, 15498,
+ 2356, 3805, 5032, 5970, 6915, 7880, 8924, 12060, 13838, 15185,
+ 1807, 3439, 4962, 6483, 8013, 9556, 10952, 12327, 13686, 15059,
+ 1571, 2900, 4208, 6449, 7675, 8592, 11138, 12775, 14181, 15422,
+ 2006, 4262, 5508, 6414, 7621, 8725, 10788, 12605, 13609, 14776,
+ 1785, 3741, 5267, 6702, 8097, 9460, 10487, 11481, 12889, 14885,
+ 1647, 3223, 4795, 6391, 8007, 9620, 11575, 12955, 14100, 15381,
+ 1518, 3214, 5233, 6509, 7687, 8803, 11778, 13932, 14760, 15491,
+ 2136, 3647, 5373, 7317, 8671, 10261, 11786, 12933, 13820, 15186,
+ 1633, 3265, 4672, 5640, 6776, 7783, 8907, 10184, 12066, 14492,
+ 1690, 3028, 4184, 6049, 7489, 8678, 11045, 12244, 13372, 15016,
+ 1649, 3080, 4358, 5795, 7364, 8601, 10257, 12126, 13328, 15113,
+ 1850, 3286, 5392, 6765, 7826, 9185, 10506, 11776, 13248, 15163,
+ 2111, 3522, 4870, 6087, 7162, 8385, 9645, 10861, 12341, 14302,
+ 1529, 2909, 4136, 6783, 8064, 9325, 10942, 12094, 13886, 15169,
+ 1847, 3281, 4752, 6098, 7310, 8744, 10129, 12278, 13554, 14930,
+ 1149, 2767, 5869, 7479, 8514, 9723, 11235, 12300, 13871, 15068,
+ 1689, 3066, 4325, 5613, 6772, 7936, 9051, 12135, 13730, 15025,
+ 2127, 3394, 5263, 6880, 7874, 9155, 10305, 12136, 13494, 14437,
+ 1682, 3054, 4412, 6053, 7380, 8465, 9817, 12460, 14155, 15285,
+ 1799, 3430, 5123, 6594, 7934, 9609, 11472, 12791, 13686, 14849,
+ 1899, 3656, 5369, 6355, 7516, 8800, 9888, 11646, 13024, 13965,
+ 1410, 3252, 5101, 6050, 7480, 9912, 11739, 12806, 14085, 15186,
+ 1487, 3934, 5351, 6390, 7519, 8890, 11488, 12818, 13787, 14941,
+ 1562, 3156, 5075, 7044, 8872, 10271, 11479, 12632, 13907, 14993,
+ 1548, 2926, 4338, 5796, 7011, 8143, 9336, 11323, 13461, 14904,
+ 1421, 2907, 4736, 6272, 7730, 8977, 10453, 12374, 13840, 15234,
+ 1495, 2996, 4496, 6036, 7545, 9034, 10534, 12014, 13486, 14958,
+ 1388, 3203, 5691, 7076, 8578, 9661, 10874, 12326, 14433, 15423,
+ 1248, 2983, 5304, 6423, 7544, 8611, 10290, 11682, 12904, 14549,
+ 1496, 2988, 4632, 6342, 7852, 9329, 11175, 12546, 13758, 15182,
+ 1373, 3379, 5067, 6179, 7379, 8775, 10005, 11464, 14147, 15386,
+ 2537, 3849, 5533, 7263, 8318, 9657, 11346, 12355, 13955, 15314,
+ 2113, 3405, 4419, 5268, 6436, 8005, 10292, 12442, 13655, 15176,
+ 1620, 3681, 5454, 6406, 7459, 9354, 10872, 12035, 14163, 15279,
+ 1903, 3232, 4517, 5758, 7156, 8851, 10670, 12413, 14518, 15565,
+ 1714, 3779, 5166, 6557, 8107, 9168, 10560, 12854, 14208, 15329,
+ 1926, 3645, 5521, 7072, 7999, 8974, 9806, 11088, 13527, 15298,
+ 1820, 2840, 4726, 7091, 8261, 9758, 11218, 12148, 14064, 15262,
+ 2072, 3303, 5391, 6710, 7504, 8497, 10457, 12394, 14480, 15541,
+ 1627, 3294, 5209, 7432, 8846, 10147, 11517, 12890, 14488, 15411,
+ 2172, 3405, 4580, 5623, 6732, 7648, 8485, 9913, 13396, 15213,
+ 1581, 3058, 4633, 6225, 7724, 9238, 10779, 12240, 13650, 15094,
+ 1675, 2927, 4090, 5753, 7461, 8922, 10277, 11670, 13987, 15336,
+ 1868, 3611, 5256, 6927, 8093, 9434, 10998, 12144, 13380, 15165,
+ 1498, 3635, 5273, 6823, 7825, 8916, 9811, 10903, 12514, 14884,
+ 1448, 2626, 3930, 6895, 8348, 9746, 11404, 12565, 14288, 15325,
+ 1945, 3408, 4987, 6340, 7627, 8954, 10251, 12381, 13481, 14983,
+ 1956, 3759, 5388, 6894, 8466, 9962, 11460, 12759, 14145, 15321,
+ 1670, 3271, 4588, 5970, 7185, 8366, 9640, 12011, 13488, 14833,
+ 1964, 3444, 4826, 6213, 7936, 9097, 10785, 12617, 13612, 15229,
+ 1646, 3390, 4669, 6049, 7001, 7940, 10461, 12478, 14675, 15704,
+ 2202, 3782, 5107, 6754, 8280, 9628, 11687, 13028, 13871, 15207,
+ 2354, 3830, 5174, 6360, 7555, 8997, 10681, 11977, 13066, 14781,
+ 2351, 3525, 4892, 6386, 7616, 9133, 11859, 13061, 13946, 15004,
+ 2252, 3772, 5155, 6485, 7799, 9145, 10769, 12561, 13763, 15241,
+ 1714, 3107, 4725, 6097, 9158, 10459, 11619, 12699, 14346, 15256,
+ 1830, 3506, 4969, 5973, 6900, 7836, 8994, 11088, 13366, 14860,
+ 1856, 3406, 4898, 6367, 7810, 9186, 10422, 12172, 13969, 15331,
+ 2006, 3382, 4743, 6100, 7430, 8753, 10805, 12234, 13673, 15195,
+ 1491, 3607, 5343, 7464, 9179, 10087, 11024, 12099, 13199, 14956,
+ 1749, 3371, 5121, 6500, 7646, 8770, 9968, 11673, 13339, 14931,
+ 1857, 3506, 5083, 6595, 8200, 9739, 11138, 12528, 13884, 15137,
+ 1780, 3860, 5581, 6692, 7837, 8989, 10304, 12318, 13611, 15109,
+ 2164, 4463, 5655, 7632, 9047, 9922, 10784, 12950, 14723, 15589,
+ 2305, 3300, 4366, 5608, 6857, 7795, 10006, 11950, 14376, 15700,
+ 1628, 3408, 5074, 6761, 8312, 9687, 11104, 12332, 13619, 15076,
+ 1842, 3314, 4771, 6460, 7463, 8661, 11191, 12739, 14592, 15633,
+ 1808, 4360, 5904, 6869, 8134, 9174, 10780, 12589, 13995, 15150,
+ 2966, 4354, 5686, 6983, 7938, 9092, 10062, 11747, 13307, 14611,
+ 1932, 3293, 4910, 6818, 7690, 9074, 11715, 13019, 14429, 15478,
+ 1978, 3772, 5429, 6580, 7448, 8496, 11755, 13132, 14549, 15560,
+ 1881, 3635, 5627, 7292, 8573, 10911, 12325, 13200, 14068, 15243,
+ 1436, 2716, 4002, 5347, 6553, 7646, 8955, 10690, 12967, 14784,
+ 1426, 2825, 4206, 5726, 8100, 9391, 10712, 12262, 13506, 14954,
+ 1448, 2767, 4089, 5265, 7185, 8684, 10378, 12257, 13431, 14803,
+ 1669, 3312, 4990, 6887, 8050, 9595, 10943, 12015, 13145, 14920,
+ 1534, 2814, 4191, 5933, 7393, 8687, 9865, 11185, 12958, 14743,
+ 1397, 2706, 4322, 6052, 7618, 9168, 10995, 12433, 13931, 15267,
+ 1717, 3164, 4630, 6329, 7519, 8846, 10088, 12116, 14012, 15197,
+ 1606, 3316, 5165, 6942, 8278, 9625, 11461, 12806, 14095, 15299,
+ 2014, 3357, 4281, 5076, 6191, 7372, 9501, 12414, 13419, 14901,
+ 1322, 3655, 5269, 6494, 7613, 9253, 10752, 11974, 13302, 14833,
+ 1687, 3291, 4718, 5817, 7001, 8136, 10741, 12692, 13884, 15224,
+ 2255, 3723, 5555, 7021, 8101, 9345, 10765, 12705, 13693, 15223,
+ 2376, 3715, 5249, 6505, 7410, 8345, 10176, 11618, 12708, 14488,
+ 1842, 3232, 4371, 5954, 7832, 9126, 11296, 12743, 13862, 15331,
+ 2046, 3597, 5325, 6453, 7353, 8588, 10588, 12082, 13664, 15152,
+ 1970, 3564, 4925, 6547, 8672, 9980, 11383, 12786, 13969, 15234,
+ 1497, 2938, 4909, 6099, 7102, 8072, 9514, 11294, 12761, 14578,
+ 1666, 3164, 5098, 6255, 7350, 8902, 10694, 12503, 13808, 14980,
+ 1467, 2774, 4556, 6308, 7435, 8644, 10040, 12356, 13597, 14776,
+ 1915, 3618, 5160, 6707, 8479, 9521, 10481, 11536, 14163, 15479,
+ 1857, 3466, 4760, 6205, 7312, 8801, 10376, 11978, 13161, 14235,
+ 1615, 3107, 4710, 6452, 8069, 9877, 11348, 12575, 13751, 15049,
+ 1563, 3092, 4977, 6851, 8056, 9025, 10327, 12181, 14039, 15192,
+ 2294, 3843, 5781, 7222, 8505, 9851, 11210, 12802, 13676, 15158,
+ 1931, 3436, 4681, 5837, 6908, 7825, 9440, 12600, 14162, 15305,
+ 1572, 3189, 4879, 6680, 7970, 9293, 10974, 12193, 13506, 15218,
+ 1759, 3172, 4687, 5950, 7484, 8874, 10563, 12821, 14112, 15299,
+ 1461, 4009, 5495, 6608, 7867, 9497, 11307, 12520, 14357, 15467,
+ 1922, 4314, 5736, 6599, 7481, 8598, 9852, 11345, 14012, 15280,
+ 1249, 2609, 4690, 7006, 8061, 9011, 11477, 13214, 14382, 15337,
+ 2251, 3776, 5514, 6458, 7300, 8078, 10961, 12696, 14279, 15567,
+ 1697, 3374, 5134, 6984, 8675, 10700, 12194, 13233, 14184, 15464,
+ 1985, 3326, 4440, 5685, 6870, 8207, 9545, 11223, 13672, 15143,
+ 1453, 2824, 4722, 6476, 7730, 8963, 10217, 11743, 13545, 15152,
+ 1217, 2442, 3821, 5409, 7315, 8949, 10797, 12564, 14281, 15410,
+ 1546, 3204, 5604, 6730, 8040, 9677, 11029, 12107, 13803, 15267,
+ 2042, 3424, 4830, 6328, 7473, 8525, 9386, 10755, 13398, 14998,
+ 1106, 2508, 4816, 7337, 8399, 9630, 11278, 12453, 14067, 15024,
+ 1764, 3305, 4955, 6537, 7767, 9117, 10404, 11961, 13576, 15021,
+ 1604, 3797, 5700, 7128, 8515, 9896, 11389, 12534, 13696, 15136,
+ 1623, 3004, 4355, 6217, 7351, 8437, 9819, 11537, 13974, 15340,
+ 2457, 3890, 4962, 5848, 7311, 9718, 11213, 12292, 13705, 15111,
+ 1601, 3330, 4648, 6043, 7138, 8179, 11247, 13078, 14768, 15641,
+ 2457, 3677, 5174, 6432, 7982, 10024, 11164, 12170, 13704, 15112,
+ 1552, 3777, 5267, 6325, 7532, 8642, 9894, 12404, 13569, 14620,
+ 1961, 3463, 4720, 6498, 8059, 9304, 11486, 12824, 14102, 15458,
+ 2443, 3699, 5252, 6348, 7638, 8733, 10224, 12666, 13768, 15009,
+ 2204, 3657, 5086, 6792, 8300, 10152, 12313, 13306, 14079, 15287,
+ 2360, 3731, 5002, 6094, 6952, 8009, 9152, 11586, 13038, 14158,
+ 1888, 3469, 4880, 6183, 7603, 9244, 10801, 12319, 13657, 15002,
+ 1670, 3283, 4591, 6080, 7801, 8951, 10534, 12572, 13620, 14969,
+ 1304, 4140, 5864, 7008, 8377, 9651, 10825, 11805, 13637, 15300,
+ 2077, 3547, 4890, 6216, 7303, 8608, 9810, 11796, 13525, 14984,
+ 1658, 3252, 4916, 6498, 8069, 9529, 11029, 12538, 13903, 15184,
+ 2206, 3648, 4949, 6636, 7875, 8833, 9853, 12624, 14448, 15475,
+ 3039, 4664, 5792, 7321, 8798, 9724, 10485, 12329, 14465, 15650,
+ 1885, 3201, 5227, 6590, 7343, 8049, 9372, 12313, 14594, 15645,
+ 1826, 3446, 5138, 6665, 8008, 9352, 10668, 12583, 13810, 15065,
+ 1455, 3065, 5233, 6306, 7404, 8776, 11422, 12775, 14032, 15239,
+ 2395, 4674, 5883, 6877, 7900, 9322, 10931, 12537, 13765, 14888,
+ 1840, 4359, 5629, 6875, 7968, 9185, 10266, 11861, 13202, 14464,
+ 1662, 3278, 4865, 6555, 8122, 10011, 11874, 13087, 14128, 15418,
+ 1643, 3366, 5837, 7033, 7854, 8928, 11487, 12972, 14409, 15467,
+ 1878, 3685, 5789, 7325, 8714, 10906, 12273, 13110, 13834, 14837,
+ 2259, 3652, 4995, 6055, 7005, 7900, 8843, 10024, 12609, 14736,
+ 1568, 2949, 4504, 6035, 7428, 9194, 10893, 12444, 13595, 14939,
+ 1678, 3143, 4416, 5872, 7501, 8768, 10418, 12127, 13144, 14622,
+ 1878, 3549, 5481, 7178, 8322, 9347, 10532, 12117, 13554, 15167,
+ 2055, 3346, 4814, 6193, 7418, 8757, 10144, 11365, 12698, 14779,
+ 1486, 2779, 3954, 6134, 8290, 9646, 10767, 12112, 14441, 15428,
+ 1787, 3511, 4962, 6055, 7295, 8858, 10179, 12437, 13813, 15217,
+ 1374, 3184, 5771, 7998, 9354, 10209, 11249, 12469, 14015, 15248,
+ 1627, 2947, 4046, 5182, 6798, 8225, 9770, 12661, 14250, 15408,
+ 2117, 3704, 5007, 6630, 8002, 9222, 10550, 12108, 13472, 15034,
+ 1365, 2885, 4896, 6144, 7426, 9137, 10283, 12727, 14709, 15505,
+ 2073, 3691, 5305, 6800, 8134, 9508, 11139, 12857, 13896, 15239,
+ 1564, 4084, 5497, 6495, 7391, 8539, 10468, 11705, 12804, 14704,
+ 1844, 3180, 4380, 5754, 8181, 9923, 11738, 12995, 14138, 15232,
+ 2157, 3736, 5059, 5932, 7192, 8916, 11216, 12783, 13945, 15189,
+ 1782, 2860, 4362, 7179, 9083, 10438, 11580, 12929, 14789, 15500,
+ 1651, 3273, 4587, 5886, 7069, 8346, 9787, 11277, 13152, 14811,
+ 1549, 3138, 5049, 6704, 7803, 9102, 10748, 12577, 13813, 15215,
+ 1674, 3187, 4709, 6204, 7622, 9024, 10541, 12135, 13576, 15063,
+ 1888, 3562, 5468, 7111, 8694, 9948, 11111, 12286, 14070, 15300,
+ 1905, 3158, 5368, 6372, 7554, 8719, 10568, 12430, 13449, 14427,
+ 1953, 3411, 4718, 6545, 8090, 9298, 11232, 12723, 13668, 15077,
+ 1459, 3444, 5688, 6814, 7843, 8977, 10119, 12107, 14316, 15368,
+ 2450, 4363, 5827, 7349, 8683, 10032, 11143, 12131, 13519, 15058,
+ 2482, 3664, 4763, 5944, 7191, 8390, 10105, 12234, 13702, 15188,
+ 1838, 3465, 5255, 6751, 8016, 9254, 10946, 12321, 13790, 15337,
+ 2497, 3548, 4702, 5987, 7645, 8883, 10740, 12247, 14393, 15540,
+ 1717, 3679, 5335, 6587, 8564, 9808, 10735, 12675, 14672, 15558,
+ 2454, 3997, 5364, 6810, 8026, 8913, 9715, 11315, 14258, 15605,
+ 1906, 3443, 4901, 6363, 8186, 9716, 11074, 13186, 14701, 15474,
+ 1992, 3246, 5488, 6514, 7455, 8324, 10807, 13238, 14763, 15579,
+ 1721, 3438, 5244, 7173, 9106, 10873, 12178, 13181, 14060, 15415,
+ 2191, 3555, 4802, 6108, 7015, 7850, 8947, 11115, 14483, 15593,
+ 1925, 3232, 4601, 6574, 7791, 8989, 11038, 12282, 13630, 15136,
+ 1816, 3167, 4292, 5730, 7588, 9096, 10743, 12341, 13760, 15252,
+ 2069, 3850, 5424, 6815, 8274, 9569, 10910, 12283, 13835, 15185,
+ 2419, 3773, 5288, 6591, 7672, 8909, 9832, 10975, 13163, 14998,
+ 1215, 2710, 4939, 6437, 8745, 9918, 11200, 12553, 14234, 15384,
+ 1867, 3527, 5134, 6496, 7656, 8923, 10602, 12568, 13896, 15276,
+ 2259, 4214, 5751, 7270, 8590, 10120, 11611, 12822, 14130, 15258,
+ 1911, 3261, 4446, 5685, 6897, 8494, 10128, 11970, 13707, 15106,
+ 1762, 3549, 4874, 6153, 8146, 9634, 10690, 11886, 13713, 15057,
+ 2371, 3716, 4778, 6111, 7097, 8063, 10544, 12615, 14716, 15724,
+ 2254, 3759, 5627, 6870, 7896, 9379, 11627, 12889, 13795, 15272,
+ 2516, 4000, 5378, 6444, 7496, 8634, 9767, 12110, 13503, 14640,
+ 2385, 3201, 4283, 6677, 8216, 9689, 11654, 12319, 14142, 15367,
+ 2775, 4055, 5455, 6553, 7821, 8901, 10890, 12775, 13696, 14884,
+ 1568, 3940, 5341, 6824, 9355, 10305, 11405, 12879, 14291, 15334,
+ 2436, 3807, 5183, 6189, 7099, 8116, 9655, 11275, 13641, 15137,
+ 1755, 3340, 4871, 6382, 7790, 9316, 10921, 12432, 13903, 15217,
+ 1932, 3246, 4603, 6454, 7590, 8678, 10609, 12641, 13938, 15245,
+ 1417, 4366, 6289, 7362, 8846, 10151, 11160, 12134, 13593, 15216,
+ 1820, 3378, 4782, 6421, 7788, 9056, 10070, 11271, 13614, 15297,
+ 1855, 3399, 4933, 6526, 8097, 9655, 11043, 12475, 14301, 15370,
+ 1901, 3653, 6053, 7290, 8154, 8986, 10262, 12993, 14405, 15387,
+ 1958, 4295, 5824, 8196, 9580, 10318, 11267, 12551, 13716, 15374,
+ 2082, 4060, 5500, 6423, 7298, 8128, 9713, 12497, 14442, 15562,
+ 1878, 3425, 4781, 7062, 8455, 9625, 10810, 12311, 13948, 15201,
+ 2035, 3727, 4804, 6256, 7248, 9235, 11563, 13120, 14882, 15662,
+ 2143, 3982, 6527, 7709, 8742, 9804, 11240, 12658, 14397, 15409,
+ 2593, 4431, 5861, 7222, 8381, 9351, 10400, 11837, 13286, 15326,
+ 1840, 3798, 5465, 6800, 7919, 9752, 12004, 13265, 14424, 15420,
+ 2157, 4145, 5394, 6454, 7240, 8776, 11093, 12831, 14856, 15708,
+ 1467, 3782, 5811, 8123, 9314, 10456, 11641, 13211, 14562, 15331,
+};
+
+
+const Word16 wac_swb_h[LPC_SHB_ORDER] =
+{//Q15
+ 32758,
+ 32731,
+ 32686,
+ 32622,
+ 32541,
+ 32442,
+ 32325,
+ 32191,
+ 32039,
+ 31870
+};
+
+const Word16 wac_swb_l[LPC_SHB_ORDER] =
+{//Q15
+ 29673,
+ 20874,
+ 7850,
+ 25873,
+ 12831,
+ 5927,
+ 10541,
+ 239,
+ 15037,
+ 30328
+};
+
+const Word16 wac_swb_ivas_h[LPC_SHB_ORDER] =
+{//Q15
+ 32749,
+ 32731,
+ 32686,
+ 32622,
+ 32541,
+ 32442,
+ 32325,
+ 32191,
+ 32039,
+ 31870
+};
+
+const Word16 wac_swb_ivas_l[LPC_SHB_ORDER] =
+{//Q15
+ 2624,
+ 20874,
+ 7850,
+ 25873,
+ 12831,
+ 5927,
+ 10541,
+ 239,
+ 15037,
+ 30328
+};
+
+const Word16 lbr_wb_bwe_lsfvq_cbook_2bit_fx[4 * 4] =
+{
+ /*Q15 */
+ 3876, 5920, 8951, 11884,
+ 6556, 7979, 10835, 13133,
+ 4401, 6781, 10676, 13493,
+ 8453, 9693, 12024, 13921,
+};
+
+const Word16 SHBCB_SubGain5bit_fx[128] =
+{
+ /*Q14 */
+ -2388, -7806, -6576, -6024,
+ -7066, -5430, -4998, -3495,
+ -16722, -15343, -960, -7940,
+ -26291, -5921, -4917, -4378,
+ -1526, -6621, -8475, -9624,
+ -8047, -4086, -8940, -3043,
+ -3630, -5129, -4964, -7381,
+ -270, -18662, -24233, -25418,
+ -9246, -7551, -5584, -2053,
+ -2091, -4622, -9199, -14628,
+ -4645, -2197, -10255, -9697,
+ -2438, -9386, -11737, -4570,
+ -14366, -11436, -8252, -819,
+ -16192, -16332, -17043, -225,
+ -5407, -8588, -7577, -2296,
+ -26309, -21930, -7522, -2514,
+ -3260, -4246, -7947, -6614,
+ -1820, -5520, -15272, -19764,
+ -3706, -3737, -5850, -10520,
+ -10081, -4050, -4065, -5001,
+ -3908, -9909, -2881, -9604,
+ -520, -11156, -12620, -12768,
+ -4539, -5149, -6208, -4462,
+ -4866, -7672, -4235, -4407,
+ -9163, -13411, -2975, -3915,
+ -12267, -7568, -3842, -2827,
+ -7181, -4914, -2608, -9392,
+ -6275, -2868, -5962, -6511,
+ -12962, -1034, -8517, -10992,
+ -8247, -7608, -2502, -5026,
+ -5812, -4998, -3860, -5778,
+ -16907, -5974, -4434, -3276,
+};
+
+
+const Word16 HBCB_SubGain5bit_fx[128] =
+{//Q8
+ -15224, -17789, -9897, -5048, -456, -1232, -2238, -2782,
+ -3391, -3864, -4026, -4045, -2017, -1311, -878, -1973,
+ -12837, -15376, -8273, -4141, -2791, -3037, -2403, -342,
+ -3388, -3646, -3471, -2829, -157, -2025, -2318, -2243,
+ -14652, -16433, -7699, -1188, -2567, -1755, -346, -1682,
+ -2068, -2321, -2344, -2348, -1759, -1038, -1865, -2041,
+ -11396, -13719, -7749, -2734, -809, -1935, -1886, -781,
+ -2136, -1940, -942, -1571, -1926, -2378, -2572, -2145,
+ -17531, -19267, -7721, -2672, -714, -675, -1516, -2071,
+ -1925, -2325, -2523, -2657, -1644, -1674, -2036, -2017,
+ -12781, -14601, -6714, -1380, -2093, -1704, -1124, -756,
+ -2776, -2687, -2066, -1202, -1102, -680, -1956, -2376,
+ -14436, -15846, -4918, -2071, -1613, -744, -1807, -1381,
+ -620, -1294, -2026, -2162, -794, -1755, -1167, -1762,
+ -11627, -13377, -5876, -1959, -1009, -1879, -1027, -1915,
+ -1734, -1265, -2001, -1018, -698, -1733, -2172, -1195,
+
+};
+
+
+const Word32 SHBCB_FrameGain64_fx[64] =
+{
+ /* Q18 */
+ 11553, 19429, 27466, 35948, 45184, 54817, 65050, 76114,
+ 88089, 100815, 114314, 128727, 144236, 160812, 178639, 197656,
+ 217917, 239688, 263098, 288617, 315962, 345380, 376751, 410569,
+ 446867, 485779, 527885, 574220, 624562, 679333, 738912, 803391,
+ 873329, 949299, 1032054, 1121728, 1219559, 1327347, 1446046, 1576547,
+ 1720983, 1881933, 2062979, 2266614, 2496129, 2759206, 3060575, 3409584,
+ 3818114, 4295643, 4868000, 5551295, 6368310, 7329048, 8475924, 9889403,
+ 11649918, 13794493, 16487623, 19979932, 24732260, 31339886, 41958624, 64261100,
+};
+
+/* 4 bit Quantizer table for SHB overall gain */
+
+const Word32 SHBCB_FrameGain16_fx[16] =
+{
+ /*Q18*/
+ 38968, 125277, 254474, 493383, 1043711, 2083177, 3792746, 6395076,
+ 10256080, 15738899, 23269902, 34118236, 48362464, 71128080, 107459896, 192888864
+};
+
+/* 18th order elliptic Bandpass filter at 14.15 to 20 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */
+
+const Word16 full_band_bpf_1_fx[6][5] = /*in Q13*/
+{
+ { 789, 802, 248, 802, 789},
+ { 789, 1199, 838, 1199, 789},
+ { 789, 136, -1123, 136, 789},
+ { 8192, 19654, 24391, 17059, 6561},
+ { 8192, 15339, 20118, 13819, 6190},
+ { 8192, 21155, 26558, 17237, 5599}
+};
+
+/* 12th order elliptic Bandpass filter at 16.3 to 19.8 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */
+
+const Word16 full_band_bpf_2_fx[6][5] = /*in Q13*/
+{
+ { 492, 912, 974, 912, 492},
+ { 492, 1161, 1353, 1161, 492},
+ { 492, 259, -311, 259, 492},
+ { 8192, 22912, 30622, 21214, 7143},
+ { 8192, 20364, 27329, 18844, 6886},
+ { 8192, 23496, 31199, 20826, 6487}
+};
+
+/* 12th order elliptic Bandpass filter at 15.4 to 20.0 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */
+
+const Word16 full_band_bpf_3_fx[6][5] = /*in Q13*/
+{
+ {611, 888, 717, 888, 611},
+ {611, 1211, 1214, 1211, 611},
+ {611, 197, -671, 197, 611},
+ {8192, 21727, 28230, 19588, 6871},
+ {8192, 18438, 24377, 16796, 6567},
+ {8192, 22683, 29442, 19400, 6081}
+};
+
+/* 4-bit/3-bit TD SWB BWE differential LSF scalar quantizer tables */
+
+const Word16 lsf_q_cb_size[NUM_Q_LSF] = {16, 16, 8, 8, 8}; // Q0
+const Word16 lsf_q_num_bits[NUM_Q_LSF] = { 4, 4, 3, 3, 3 }; // Q0
+
+/* Tables for approximation of upper half of SWB LSFs */
+
+const Word16 mirror_point_q_cb_fx[MIRROR_POINT_Q_CB_SIZE] = { 471, 692, 896, 1216 }; // Q15
+
+const Word16 allpass_poles_3_ov_2[9] = /* Q15 */
+{
+ 2368,
+ 20545,
+ 30606,
+ 25520,
+ 7188,
+ 31808,
+ 28575,
+ 14384,
+ 32472
+};
+
+const Word16 decimate_3_ov_2_lowpass_num_fx[3] = /* Q15 */
+{
+ 6399,
+ 12797,
+ 6399
+};
+
+const Word16 decimate_3_ov_2_lowpass_den_fx[3] = /* Q15 */
+{
+ 32767,
+ 0,
+ 5624
+};
+
+
+/*------------------------------------------------------------------------------*
+ * WB BWE tables
+ *------------------------------------------------------------------------------*/
+const Word16 F_2_5_fx[64] = /*Q10 */
+{
+ 1189, 675, -5106, -5293, 10476, -12, 10860, 10026,
+ -382, -616, 6426, 339, 9681, 9068, 3002, 2216,
+ 3208, 3042, 8255, -604, 16133, 5171, 17641, 18769,
+ -2529, -3248, -1447, -1991, 15511, 14855, 11631, 11996,
+ 9654, -124, 7267, -1617, 12799, 3237, 10598, 1555,
+ 5510, -1775, 1149, -2292, 12659, 12425, 4382, -1814,
+ 6305, 5629, 3404, -2632, 19555, 9582, 7835, 7619,
+ -517, -3795, 19031, 11574, 19156, 18748, 23563, 23465,
+};
+/*------------------------------------------------------------------------------*
+ * SWB BWE tables
+ *------------------------------------------------------------------------------*/
+
+const Word16 swb_bwe_trans_subband[SWB_FENV_TRANS+1] = {240, 316, 392, 476, 560}; // Q0
+const Word16 swb_bwe_trans_subband_width[SWB_FENV_TRANS] = {76, 76, 84, 84}; // Q0
+
+const Word16 sqrt_swb_bwe_trans_subband_width_fx[SWB_FENV_TRANS] = { 17854, 17854, 18770, 18770 };/*Q11 */
+
+const Word16 sqrt_swb_bwe_subband_fx_L1[SWB_FENV] = { 16384, 20066, 16384, 20066, 16384, 20066, 16384, 20066, 20066, 20066, 20066, 20066, 23170, 23170 }; /*Q12 */
+
+const Word16 sqrt_swb_bwe_subband_fx_L2[SWB_FENV / 2] = { 25905, 25905, 25905, 25905, 28378, 28378, 32767 }; /*Q12 */
+
+const Word16 swb_bwe_subband[SWB_FENV+1] = {240, 256, 280, 296, 320, 336, 360, 376, 400, 424, 448, 472, 496, 528, 560}; // Q0
+const Word16 fb_bwe_subband[DIM_FB + 1] = { 640, 680, 720, 800 }; // Q0
+const Word16 fb_bwe_sm_subband[DIM_FB] = { 656, 696, 760 }; // Q0
+const Word16 swb_inv_bwe_subband_width_fx[SWB_FENV] = { 2048,1365,2048,1365,2048,1365,2048,1365,1365,1365,1365,1365,1024,1024 };//Q15
+const Word16 swb_bwe_sm_subband[SWB_FENV] = {248, 268, 288, 308, 328, 348, 368, 388, 412, 436, 460, 484, 512, 544}; // Q0
+const Word16 smooth_factor_fx[SWB_FENV - 1] = { 1638, 1638, 1638, 1638, 1638, 1638, 1638, 1366, 1366, 1366, 1366, 1024, 1024 };//Q15
+
+const Word16 fb_bwe_subband_float[DIM_FB+1] = {640, 680, 720, 800}; // Q0
+const Word16 fb_inv_bwe_subband_width_fx[DIM_FB] = { 819, 819, 409 };//Q15
+const Word16 fb_bwe_sm_subband_float[DIM_FB] = {656, 696, 760}; // Q0
+const Word16 fb_smooth_factor_fx[DIM_FB] = { 1024, 819, 512 };//Q15
+
+
+const Word16 EnvCdbk11_fx[N_CB11 * DIM11] = /*Q8 */
+{
+ -2220, 29, 1168, 2124, 2180, 1208, 741,
+ 1521, -312, -843, -1523, -1970, -2205, -2541,
+ 746, 1835, 3461, 4398, 4292, 4184, 3462,
+ 1627, 2475, 2937, 2839, 2198, 1729, 1325,
+ -514, -731, -557, -200, 100, 475, 540,
+ 655, 956, 1272, 1083, 774, 687, 459,
+ 5987, 5460, 4689, 4192, 3845, 3615, 3393,
+ 3571, 4840, 5784, 6266, 5933, 5158, 4433,
+ 2959, 2087, 1180, 979, 1180, 1371, 1636,
+ 6029, 6157, 6431, 6762, 6998, 7153, 7050,
+ -822, 210, 450, 178, -639, -1346, -1577,
+ 4451, 4184, 4111, 4329, 4833, 5232, 5512,
+ 3420, 3994, 4321, 4205, 3684, 3154, 2651,
+ -3734, -2305, -1388, -324, 22, -847, -1141,
+ 850, 510, 896, 1780, 2130, 2688, 2826,
+ 3294, 2823, 2510, 2516, 3029, 3413, 3843,
+ -3563, -3409, -3199, -2917, -2584, -2282, -1981,
+ -2738, -3185, -3752, -4320, -4484, -4524, -4329,
+ -7534, -7481, -7283, -7175, -6757, -6281, -5865,
+ -4868, -4836, -4603, -4422, -4086, -3738, -3323,
+ -13896, -13775, -13484, -13339, -12926, -12399, -11970,
+ 8409, 8420, 8305, 8103, 7954, 7778, 7496,
+ 7180, 6845, 6369, 5971, 5557, 5309, 5027,
+ 4633, 4008, 3267, 2422, 2072, 1778, 1510,
+ 10128, 10432, 10540, 10473, 10176, 9837, 9586,
+ 2933, 2695, 2060, 1286, 424, -254, -825,
+ -10032, -9847, -9544, -9420, -9000, -8508, -8084,
+ 1830, 927, -158, -388, -360, -368, -287,
+ -21962, -21904, -21548, -21471, -21004, -20511, -20064,
+ -6090, -6142, -5937, -5852, -5493, -5104, -4671,
+ -1382, -1640, -2205, -2557, -2785, -3019, -2994,
+ -1300, -1567, -1744, -1642, -1409, -1080, -902,
+};
+
+const Word16 EnvCdbk1st_fx[N_CB1ST * DIM1ST] = /*Q8 */
+{
+ -1819, -1138, 751,
+ -494, 162, -826,
+ -3199, -123, 2479,
+ -2071, 238, -429,
+ -1819, 1780, 1233,
+ 284, 1187, -1123,
+ -1689, -722, -484,
+ -1256, 52, -1336,
+ -604, 3738, -1297,
+ 555, 412, 743,
+ -626, -1685, 1527,
+ 145, 1557, -224,
+ -638, 1370, 1589,
+ -1188, 37, -410,
+ -428, -3320, 1860,
+ 2597, -95, -2876,
+ -742, -583, -684,
+ 1607, -1671, -1874,
+ -1111, -936, -1374,
+ 275, -2314, 518,
+ 2682, 2368, -302,
+ 1809, -555, -579,
+ 3193, -1270, -1208,
+ 750, 84, 154,
+ -1160, 429, 1098,
+ 816, -613, -2897,
+ 2159, -1885, 1245,
+ -671, 426, 3177,
+ 867, -144, -639,
+ 843, -1888, 2271,
+ 1542, 259, -148,
+ -1680, 1027, 285,
+ 162, -763, 1666,
+ -1916, 1175, -1227,
+ -345, -907, -151,
+ 1979, 1062, 402,
+ -1231, 2437, 3130,
+ -2422, 361, 1040,
+ -4314, -4106, -4221,
+ 146, -1200, -1828,
+ 485, 889, -3847,
+ 384, -2461, -2845,
+ 1526, -600, 1599,
+ -838, -571, 1097,
+ 1776, -3393, 4058,
+ -3330, 2429, 1732,
+ 468, -2140, -934,
+ 833, 2292, -1129,
+ -20, -1029, 652,
+ -346, 168, 1834,
+ -1730, 838, 2234,
+ 1622, -1695, -194,
+ -3198, -773, 228,
+ 1070, 1741, 285,
+ 1655, -212, -1628,
+ 2178, 604, 1784,
+ 1801, -3224, -848,
+ -819, 348, 187,
+ 16, 300, 244,
+ 769, 201, 1554,
+ 719, -394, 780,
+ 311, 2853, 185,
+ 1163, 489, -1022,
+ -330, 459, 877,
+ 109, -541, -691,
+ -509, -267, 478,
+ -340, -417, -1403,
+ -860, -675, -2703,
+ 1025, 826, 250,
+ -1043, 1008, -434,
+ -1042, -631, 60,
+ -173, 332, -2084,
+ 984, 919, -2042,
+ -1257, -2287, 339,
+ 366, -1309, -158,
+ 1041, 1039, 1083,
+ 3566, 918, 227,
+ 62, -139, 936,
+ 2424, 730, -1022,
+ -745, 1954, 427,
+ -1091, -1358, -478,
+ -173, 2121, -2367,
+ -2175, 2535, -1946,
+ -880, -1964, -1549,
+ -249, -1203, -927,
+ -2377, -443, -1775,
+ -1439, -582, 2037,
+ -529, -3679, -550,
+ 608, -284, -1566,
+ 201, 63, -344,
+ 1376, 218, 816,
+ 2471, -348, 479,
+ -1388, 988, -2674,
+ 1429, -3538, 1125,
+ 864, -1351, 845,
+ 301, 977, 408,
+ -1122, 3364, 1107,
+ -213, 730, -329,
+ 839, -683, -92,
+ 631, 1172, 2364,
+ 598, 685, -329,
+ -780, -1317, 448,
+ -424, -153, -199,
+ 768, -331, 2825,
+ 882, -1047, -975,
+ -375, -1835, -299,
+ 2861, -3375, -3158,
+ 2099, 2168, -2630,
+ 1602, 1930, 1451,
+ 1294, 1265, -586,
+ -2500, -2570, -2667,
+ -806, -1529, 3272,
+ -522, 1072, 478,
+ 4035, -2491, 480,
+ -1908, 2414, -178,
+ -1563, -143, 438,
+ 205, 861, 1287,
+ -691, 963, -1374,
+ -2359, -2032, -886,
+ 162, -442, 160,
+ 194, 2494, 1960,
+ -2533, -2578, 1924,
+ 267, 1701, 937,
+ 2919, 2950, 2382,
+ -670, 2102, -859,
+ -3147, 1385, -215,
+ 1482, -595, 415,
+ 228, 290, -1060,
+};
+
+const Word16 EnvCdbk2nd_fx[N_CB2ND * DIM2ND] = /*Q8 */
+{
+ 1104, -1833, -1110, -954,
+ 757, 853, -176, 286,
+ -873, -587, -7, 1458,
+ -462, -553, -350, 104,
+ 1938, 1957, -1340, -703,
+ 1202, -779, 21, 1996,
+ -2851, -169, 1049, 940,
+ -1355, -726, -1788, 1076,
+ -767, -641, -646, -880,
+ 135, -832, -197, -889,
+ -826, 3, 279, -502,
+ -714, 544, -526, 375,
+ 291, -1076, -816, -3929,
+ -1175, -475, 2219, -642,
+ 197, -219, -1052, -1601,
+ 1175, -162, -695, -336,
+ 1124, 126, -2326, -1573,
+ 1164, -1323, -1958, 1074,
+ -2080, -2152, 113, 649,
+ -637, -860, 721, 267,
+ -609, 1658, -1006, -1352,
+ 1631, 2225, 2128, 1827,
+ -1112, -1351, 1856, 1656,
+ -2132, 1006, 770, -1294,
+ -472, 776, 1661, 2248,
+ -121, -574, -1481, -316,
+ 2565, -1081, 188, 293,
+ 398, 2598, 704, -1129,
+ 1023, 104, 550, 499,
+ -416, 127, 253, -1894,
+ 456, -2578, 190, 1018,
+ -1488, 286, -1202, -915,
+ -1164, 1874, 1651, 302,
+ -1312, -1547, -1625, -1516,
+ 170, -233, 817, 1209,
+ -1090, 341, 709, 725,
+ 854, 819, -278, -1083,
+ -15, 113, 286, 283,
+ 1166, -906, 1880, 301,
+ 342, -7, -587, 776,
+ -785, -1259, -1166, 3194,
+ -1630, -1071, 300, -1080,
+ -12, 190, -538, -493,
+ 351, 907, 1929, -1534,
+ 480, 36, 593, -526,
+ 813, 1216, 986, 89,
+ 98, 1010, -2272, 268,
+ 2766, -102, -1307, -873,
+ -1660, -467, -365, 47,
+ 1496, 1277, -228, -2791,
+ 1565, -669, 520, -1598,
+ -361, 1078, 457, -364,
+ 543, -950, 28, 248,
+ 1904, 815, -1034, 1125,
+ -13, -1951, 1085, -1005,
+ -2223, 1519, -624, 857,
+ 1121, 831, 872, 1295,
+ 193, 2284, -422, 609,
+ -156, 827, -733, 2065,
+ -3390, -3384, -3197, -3220,
+ 31, 896, 539, 978,
+ -21, 408, 1502, 405,
+ -583, -1662, -665, -164,
+ 2193, 976, 613, -436,
+};
+
+const Word16 EnvCdbk3rd_fx[N_CB3RD * DIM3RD] = /*Q8 */
+{
+ 1031, -2454, 748,
+ 2770, 2442, 1761,
+ -2348, 4079, -959,
+ 1874, -735, -2242,
+ -59, 35, 201,
+ -1518, 162, 1809,
+ -1977, -1063, -103,
+ 2485, 1212, -863,
+ 882, 192, 39,
+ 1356, 851, 979,
+ -1377, -2961, -1477,
+ 497, -808, 593,
+ -394, -748, -1564,
+ -950, -198, -436,
+ -503, -1420, -234,
+ 318, 985, -1905,
+ -118, 1783, 1563,
+ 220, 929, 400,
+ 857, 37, -995,
+ -807, 1943, -409,
+ -743, -524, 552,
+ 940, 1643, -299,
+ 805, -1421, -768,
+ -2330, 705, 156,
+ 61, 203, 1213,
+ -138, 517, -642,
+ 64, -501, -435,
+ 2194, -625, 157,
+ -1600, 341, -1611,
+ 1137, -351, 2353,
+ -811, -1715, 1522,
+ -870, 613, 446,
+};
+
+const Word16 EnvCdbk4th_fx[N_CB4TH * DIM4TH] = /*Q8 */
+{
+ 1024, -210, -207, 591,
+ -280, -2486, -951, 958,
+ 1539, 1136, 411, 1314,
+ 1761, -202, 1339, 203,
+ -2438, -2109, -2028, -2125,
+ 1849, -1408, -670, 144,
+ -469, 2674, -1589, -3604,
+ 1642, -702, 139, 2476,
+ -483, 372, -861, 540,
+ -119, 827, 863, 952,
+ 23, 99, -24, -303,
+ 488, -2233, -1432, -1399,
+ 54, -43, 96, -1527,
+ 1170, 133, -119, -717,
+ 258, -1215, -439, 160,
+ -1049, 793, 970, -770,
+ -1914, -1245, 1281, 422,
+ -1194, 1005, 176, -2368,
+ -1631, 1316, -1125, -361,
+ 1124, 1132, 61, -2186,
+ 790, -2055, 1174, 938,
+ 2974, 3874, 2315, 2040,
+ -300, 2484, 59, -860,
+ 543, 1307, -1868, -725,
+ 389, -115, -945, -146,
+ -1837, -578, -620, 975,
+ 389, 1779, 1732, 296,
+ 377, 897, 1555, 2269,
+ -854, 26, 590, 1413,
+ -780, -985, 1389, 2639,
+ 312, -277, -935, -3289,
+ 1740, 1852, 641, -519,
+ 738, 898, -466, 115,
+ 1187, -286, -1514, -1309,
+ 74, -801, -583, -987,
+ 510, -667, 430, -191,
+ 418, -303, 806, 1258,
+ -1083, -1065, 362, -2114,
+ -1075, 82, 260, 286,
+ -2579, 14, 75, -854,
+ -661, -634, 482, -581,
+ -338, -306, 3255, 388,
+ -230, -24, 1161, 205,
+ 256, 546, -141, 1379,
+ -63, -775, -484, 1478,
+ -517, -546, -451, 86,
+ 1473, -1201, 430, -1892,
+ 394, 831, 620, -664,
+ 334, 64, 1773, -1576,
+ -1783, 1270, 1020, 944,
+ 1023, 98, -1908, 1330,
+ -560, -1044, 380, 707,
+ -427, -708, -1815, -90,
+ -54, 2298, -537, 1151,
+ -499, 703, -1018, 3322,
+ 92, 717, -607, -1032,
+ -1313, -1393, -580, -485,
+ 34, -2192, 788, -860,
+ 2641, 628, -776, -259,
+ -702, -159, -1483, -1638,
+ -33, -63, 97, 553,
+ 692, 523, 548, 349,
+ -913, 54, -456, -702,
+ -341, 944, 157, 100,
+};
+
+
+const Word16 EnvCdbkFB_fx[N_CB_FB * DIM_FB] = /*Q7 */
+{
+ -2126, -1242, -945,
+ 1628, -686, -539,
+ 1230, 2245, 2532,
+ 2822, 3094, 2669,
+ -12376, -11507, -11342,
+ 2678, 3533, 3510,
+ 489, 903, 689,
+ 1930, 2929, 3025,
+ 3424, 4179, 4050,
+ -2500, -1707, -1415,
+ -3511, -2563, -2224,
+ -865, -987, -1212,
+ -424, 891, 1919,
+ 1976, 2520, 2277,
+ 673, 1667, 1945,
+ 5169, 6024, 5983,
+ -1367, -501, -236,
+ -254, 679, 989,
+ -18974, -18088, -17834,
+ -23007, -22053, -22109,
+ 2262, 2301, -625,
+ -124, 431, 372,
+ 1454, 1962, 1791,
+ 200, 1094, 1347,
+ -997, -110, 213,
+ -697, 267, 602,
+ -3066, -2172, -1876,
+ -4358, -3493, -3164,
+ -360, 59, -472,
+ -1813, -919, -601,
+ 4204, 4967, 4913,
+ 953, 1457, 1245
+};
+
+const Word16 Mean_env_fb_fx[DIM_FB] = { 1760, 805, 473 }; /*Q8 */
+
+const Word16 w_NOR_fx[SWB_FENV] = /*Q15 */
+{
+ 32767, 32056, 31374, 30720, 30093, 29491, 28913,
+ 28357, 27822, 27307, 26810, 26331, 25869, 25423,
+};
+const Word16 Mean_env_fx[SWB_FENV] = /*Q8 */
+{
+ 7327, 7414, 7181, 7160, 6889, 6866, 6746,
+ 6651, 6385, 6152, 5873, 5668, 5435, 5222,
+};
+
+const Word16 Env_TR_Cdbk1_fx[N_CB_TR1 * DIM_TR1] = /*Q8 */
+{
+ 229, -2347,
+ 8199, 7726,
+ -312, 1700,
+ 9881, 5949,
+ 8942, 8358,
+ 3865, 3287,
+ 2405, 796,
+ 3664, 1433,
+ 3059, 2215,
+ 618, 874,
+ -5479, -4636,
+ 2237, 2512,
+ 4265, 2428,
+ 6583, 2065,
+ 4548, 6579,
+ 11325, 7340,
+ 10578, 9264,
+ 8491, 6457,
+ -1380, -2484,
+ 3377, 5069,
+ 7393, 5120,
+ 4798, 4440,
+ 5506, 7614,
+ -3371, -3982,
+ 2806, 2959,
+ 2242, 3550,
+ 1334, 3065,
+ 2055, -1350,
+ 815, 5507,
+ 4940, 1457,
+ -1950, -1046,
+ 653, -1133,
+ 872, -3622,
+ -1756, 245,
+ 5792, 5542,
+ 4084, 7696,
+ 4569, 5204,
+ -810, -1555,
+ 10127, 10384,
+ 11341, 11713,
+ 6365, 4996,
+ 8641, 10527,
+ 5914, 3366,
+ 4522, 3266,
+ 5217, 2830,
+ 8107, 8980,
+ 3952, 5858,
+ 5848, 8990,
+ 6424, 5931,
+ 5185, 3823,
+ 6367, 6917,
+ 3548, 2683,
+ 1634, 2098,
+ 2729, -89,
+ 6964, 7664,
+ 3179, 3561,
+ 6388, 4193,
+ 4024, 4828,
+ -378, 434,
+ 9338, 9507,
+ 7593, 3483,
+ -6835, -6317,
+ 5207, 5029,
+ 11326, 10488,
+ 7411, 6086,
+ 10072, 8255,
+ -6099, -5652,
+ 7074, 8702,
+ -12228, -11384,
+ -11471, -10567,
+ -13025, -12253,
+ -12879, -11289,
+ -13952, -13062,
+ -16214, -15389,
+ -11659, -10789,
+ -12351, -11477,
+ -12789, -11947,
+ -15139, -14249,
+ -11326, -11219,
+ -11950, -11093,
+ -11800, -10928,
+ -23738, -22881,
+ 12795, 11890,
+ -3793, -2879,
+ -27373, -26492,
+ -11928, -11531,
+ -12110, -11258,
+ -20492, -19634,
+ -14371, -13608,
+ -12591, -11728,
+ -14055, -11739,
+ 9471, 7272,
+ -11184, -10335,
+ -13313, -11673,
+ -12209, -10610,
+ -13465, -12761,
+ 7690, 7115,
+ 2564, 4496,
+ 5587, 4551,
+ -813, -562,
+ -4483, -5521,
+ 1556, 98,
+ 2, 3468,
+ 1410, 1339,
+ 4049, 161,
+ -4538, -4026,
+ -9866, -9115,
+ -1616, -4727,
+ 2457, 1653,
+ 631, 2155,
+ -17982, -17082,
+ 2628, 6088,
+ -10791, -9933,
+ -12426, -11566,
+ 4322, 4000,
+ -1574, 2162,
+ -7968, -7599,
+ 1523, 4192,
+ 5621, 6537,
+ -2511, -1987,
+ 12471, 9218,
+ 8746, 4971,
+ 3642, 4148,
+ 5089, 5948,
+ 350, -92,
+ 7028, 6683,
+ -2430, -3216,
+ -3974, -886,
+};
+
+const Word16 Env_TR_Cdbk2_fx[N_CB_TR2 * DIM_TR2] = /*Q8 */
+{
+ 2639, 375,
+ -481, 1694,
+ -2400, -3306,
+ 86, -4018,
+ -1301, 47,
+ 734, 299,
+ 957, -1039,
+ 2204, 1486,
+ 361, -1136,
+ 2628, -838,
+ -2010, 1296,
+ 373, 127,
+ -573, 2604,
+ 689, -1554,
+ 1676, -371,
+ 1298, 279,
+ -901, 1086,
+ 1747, -2723,
+ 214, -657,
+ -731, -909,
+ 1545, -1658,
+ -369, -2208,
+ -1276, 1748,
+ 1141, -522,
+ 186, -1893,
+ -1260, -2016,
+ -478, -504,
+ 1287, 1882,
+ -97, -1400,
+ -1372, -1165,
+ 800, -152,
+ 413, -240,
+ -208, -858,
+ -90, -399,
+ 492, 2519,
+ 913, 1368,
+ -344, 282,
+ 305, 526,
+ -251, 860,
+ -1066, 567,
+ -2800, -687,
+ 1, 674,
+ 176, 878,
+ -716, -153,
+ 706, 831,
+ -1083, -424,
+ 419, 1192,
+ -132, 565,
+ 708, -2406,
+ 600, -661,
+ 1712, 2969,
+ -1974, 379,
+ -672, 208,
+ 26, 296,
+ -1821, -501,
+ -513, 635,
+ 266, 1737,
+ -221, 1232,
+ -3498, 1632,
+ -337, -66,
+ -552, -1427,
+ 1329, 850,
+ -718, -2948,
+ -3, 0,
+};
+
+const Word16 Mean_env_tr_fx[5] = { 6971, 6095, 6111, 4995 }; /*Q8 */
+
+/*------------------------------------------------------------------------------*
+ * LR MDCT SWB BWE coding tables
+ *------------------------------------------------------------------------------*/
+
+
+const Word16 gain_table_SWB_BWE_fx[NB_SWB_SUBBANDS] = { -6554/*-0.4f*/, 1638/*0.1f*/, 9830/*0.6f*/, 18022/*1.1f*/ }; /* Q14 */
+
+const Word16 bits_lagIndices_modeNormal[NB_SWB_SUBBANDS] = {2, 2, 1, 1}; // Q0
+const Word16 subband_offsets_12KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_12KBPS, SWB_SB_OFF1_12KBPS, SWB_SB_OFF2_12KBPS, SWB_SB_OFF3_12KBPS}; // Q0
+const Word16 subband_offsets_16KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_16KBPS, SWB_SB_OFF1_16KBPS, SWB_SB_OFF2_16KBPS, SWB_SB_OFF3_16KBPS}; // Q0
+
+/* Search offset for the subbands that use a partial search */
+const Word16 subband_search_offsets[NB_SWB_SUBBANDS] =
+{
+ 0, 0, 64, 64
+}; // Q0
+
+
+
+/* SPT : shorten subband length table */
+const Word16 bw_SPT_tbl[2][SPT_SHORTEN_SBNUM]=
+{
+ {15, 31, 31, 31}, /* 13.2kbps: original band_width 53, 66, 82, 102 */
+ {15, 15, 31, 31} /* 16.4kbps: original band_width 51 64, 80, 90 */
+};
+
+
+/* Harmonic Mode */
+const Word16 bits_lagIndices_mode0_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = {1,1}; // Q0
+
+
+/* 13.2 kbps */
+const Word16 subband_offsets_sub5_13p2kbps_Har[NB_SWB_SUBBANDS_HAR] =
+{
+ SWB_SB_OFF0_SUB5_12KBPS_HAR, SWB_SB_OFF1_SUB5_12KBPS_HAR, SWB_SB_OFF2_SUB5_12KBPS_HAR, SWB_SB_OFF3_SUB5_12KBPS_HAR
+}; // Q0
+
+/* Search offset for the subbands that use a partial search */
+const Word16 subband_search_offsets_13p2kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] =
+{
+ 120, 210
+}; // Q0
+
+/* 16.4 kbps */
+const Word16 subband_offsets_sub5_16p4kbps_Har[NB_SWB_SUBBANDS_HAR] =
+{
+ SWB_SB_OFF0_SUB5_16KBPS_HAR, SWB_SB_OFF1_SUB5_16KBPS_HAR, SWB_SB_OFF2_SUB5_16KBPS_HAR, SWB_SB_OFF3_SUB5_16KBPS_HAR
+}; // Q0
+
+/* Search offset for the subbands that use a partial search */
+const Word16 subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] =
+{
+ 120, 210
+}; // Q0
+
+
+/*------------------------------------------------------------------------------*
+ * HQ core tables
+ *------------------------------------------------------------------------------*/
+const Word16 wscw16q15_fx[240] =/*Q15 */
+{
+ -32768, -32766, -32764, -32759, -32754, -32747, -32738, -32729, -32717, -32705, -32691,
+ -32675, -32658, -32640, -32621, -32600, -32577, -32553, -32528, -32501, -32473, -32444,
+ -32413, -32381, -32348, -32313, -32276, -32239, -32200, -32159, -32117, -32074, -32029,
+ -31984, -31936, -31887, -31837, -31786, -31733, -31679, -31624, -31567, -31508, -31449,
+ -31388, -31326, -31262, -31197, -31131, -31063, -30994, -30924, -30853, -30780, -30705,
+ -30630, -30553, -30475, -30395, -30315, -30232, -30149, -30064, -29979, -29891, -29803,
+ -29713, -29622, -29530, -29436, -29341, -29245, -29148, -29049, -28949, -28848, -28746,
+ -28642, -28537, -28431, -28324, -28216, -28106, -27995, -27883, -27770, -27655, -27540,
+ -27423, -27305, -27186, -27066, -26944, -26821, -26698, -26573, -26447, -26320, -26191,
+ -26062, -25931, -25800, -25667, -25533, -25398, -25262, -25125, -24986, -24847, -24707,
+ -24565, -24423, -24279, -24135, -23989, -23843, -23695, -23546, -23397, -23246, 23095,
+ 22942, 22788, 22634, 22478, 22322, 22164, 22006, 21846, 21686, 21525, 21363,
+ 21199, 21035, 20871, 20705, 20538, 20371, 20202, 20033, 19863, 19692, 19520,
+ 19347, 19174, 18999, 18824, 18648, 18472, 18294, 18116, 17937, 17757, 17576,
+ 17395, 17213, 17030, 16846, 16662, 16477, 16291, 16105, 15917, 15730, 15541,
+ 15352, 15162, 14972, 14781, 14589, 14397, 14204, 14010, 13816, 13621, 13426,
+ 13230, 13033, 12836, 12639, 12441, 12242, 12043, 11843, 11643, 11442, 11241,
+ 11039, 10837, 10634, 10431, 10228, 10024, 9819, 9615, 9409, 9204, 8998,
+ 8791, 8585, 8377, 8170, 7962, 7754, 7545, 7336, 7127, 6918, 6708,
+ 6498, 6288, 6077, 5866, 5655, 5444, 5232, 5020, 4808, 4596, 4383,
+ 4171, 3958, 3745, 3532, 3319, 3105, 2892, 2678, 2464, 2250, 2036,
+ 1822, 1608, 1394, 1179, 965, 751, 536, 322, 107
+};
+const Word16 wscw16q15_8_fx[40] =/*Q15 */
+{
+ -32762, -32711, -32610, -32459, -32258, -32007, -31706, -31357,
+ -30959, -30514, -30022, -29483, -28899, -28270, -27598, -26883,
+ -26127, -25330, -24494, -23621, 22711, 21766, 20788, 19777,
+ 18736, 17666, 16569, 15447, 14300, 13132, 11943, 10736,
+ 9512, 8274, 7022, 5760, 4490, 3212, 1929, 643
+};
+const Word16 wscw16q15_16_fx[80] =/*Q15 */
+{
+ -32766, -32754, -32729, -32691, -32640, -32577, -32501, -32413,
+ -32313, -32200, -32074, -31936, -31786, -31624, -31449, -31262,
+ -31063, -30853, -30630, -30395, -30149, -29891, -29622, -29341,
+ -29049, -28746, -28431, -28106, -27770, -27423, -27066, -26698,
+ -26320, -25931, -25533, -25125, -24707, -24279, -23843, -23397,
+ 22942, 22478, 22006, 21525, 21035, 20538, 20033, 19520,
+ 18999, 18472, 17937, 17395, 16846, 16291, 15730, 15162,
+ 14589, 14010, 13426, 12836, 12242, 11643, 11039, 10431,
+ 9819, 9204, 8585, 7962, 7336, 6708, 6077, 5444,
+ 4808, 4171, 3532, 2892, 2250, 1608, 965, 322
+};
+const Word16 wscw16q15_32_fx[160] =/*Q15 */
+{
+ -32768, -32764, -32758, -32749, -32736, -32720, -32701, -32679, -32654, -32626, -32594,
+ -32559, -32522, -32481, -32437, -32389, -32339, -32286, -32229, -32169, -32107, -32041,
+ -31972, -31900, -31825, -31747, -31665, -31581, -31494, -31403, -31310, -31214, -31114,
+ -31012, -30906, -30798, -30687, -30572, -30455, -30335, -30212, -30086, -29957, -29825,
+ -29690, -29553, -29412, -29269, -29123, -28974, -28823, -28668, -28511, -28351, -28188,
+ -28023, -27855, -27684, -27511, -27335, -27156, -26975, -26791, -26604, -26415, -26223,
+ -26029, -25833, -25633, -25432, -25228, -25021, -24812, -24601, -24387, -24171, -23953,
+ -23732, -23509, -23284, 23056, 22827, 22595, 22361, 22125, 21886, 21646, 21403,
+ 21159, 20912, 20663, 20413, 20160, 19905, 19649, 19390, 19130, 18868, 18604,
+ 18338, 18071, 17802, 17531, 17258, 16984, 16708, 16430, 16151, 15871, 15588,
+ 15305, 15019, 14733, 14445, 14155, 13865, 13572, 13279, 12984, 12688, 12391,
+ 12093, 11793, 11492, 11191, 10888, 10584, 10279, 9973, 9666, 9358, 9049,
+ 8740, 8429, 8118, 7806, 7493, 7180, 6865, 6550, 6235, 5919, 5602,
+ 5285, 4967, 4649, 4330, 4011, 3692, 3372, 3052, 2731, 2411, 2090,
+ 1768, 1447, 1126, 804, 483, 161
+};
+
+/* Codebook for quantization of norms */
+const Word32 dicn_fx[40] = /* Q=14 */
+{
+ 2147483647, 1518500224,
+ 1073741824, 759250112,
+ 536870912, 379625056,
+ 268435456, 189812528,
+ 134217728, 94906264,
+ 67108864, 47453132,
+ 33554432, 23726566,
+ 16777216, 11863283,
+ 8388608, 5931642,
+ 4194304, 2965821,
+ 2097152, 1482910,
+ 1048576, 741455,
+ 524288, 370728,
+ 262144, 185364,
+ 131072, 92682,
+ 65536, 46341,
+ 32768, 23170,
+ 16384, 11585,
+ 8192, 5793,
+ 4096, 2896
+};
+
+const Word32 dicn_pg_fx[45] = /* Q12 */
+{
+ 536870912, 451452834, 379625056, 319225344, 268435456,
+ 225726416, 189812528, 159612672, 134217728, 112863208,
+ 94906264, 67108864, 47453132, 33554432, 23726566,
+ 16777216, 11863283, 8388608, 5931641, 4194304,
+ 2965821, 2097152, 1482910, 1048576, 741455,
+ 524288, 370728, 262144, 185364, 131072,
+ 92682, 65536, 46341, 32768, 23170,
+ 16384, 11585, 8192, 5793, 4096,
+ 2896, 2048, 1448, 1024, 724
+};
+const Word16 expPkEnrg_tbl[45] =
+{
+ 0, 0, 0, 0, 0, 2, 2, 2, 2,
+ 4, 4, 4, 6, 6, 8, 8, 10, 10,
+ 12, 12, 14, 14, 16, 16, 18, 18, 20,
+ 20, 22, 22, 24, 24, 26, 26, 28, 28,
+ 30, 30, 32, 32, 34, 34, 36, 36, 38
+}; // Q0
+
+const Word32 manPkEnrg_tbl[45] =
+{
+ 2147483646, 1518500308, 1073741787, 759250076, 536870912,
+ 1518500294, 1073741787, 759250076, 536870912, 1518500294,
+ 1073741787, 536870912, 1073741787, 536870912, 1073741787,
+ 536870912, 1073741787, 536870912, 1073741606, 536870912,
+ 1073741968, 536870912, 1073741244, 536870912, 1073741244,
+ 536870912, 1073744140, 536870912, 1073744140, 536870912,
+ 1073744140, 536870912, 1073744140, 536870912, 1073697800,
+ 536870912, 1073697800, 536870912, 1073883168, 536870912,
+ 1073512448, 536870912, 1073512448, 536870912, 1073512448
+}; // Q0
+const Word32 E_max5_tbl[40] =
+{
+ 2047999999, 1448154663, 1024000000, 1448154663, 1024000000,
+ 1448154663, 1024000000, 1448154663, 1024000000, 1448154663,
+ 1024000000, 1448154663, 1024000000, 1448154663, 1024000000,
+ 1448154663, 1024000000, 1448154785, 1024000000, 1448154785,
+ 1024000000, 1448154296, 1024000000, 1448154296, 1024000000,
+ 1448156250, 1024000000, 1448156250, 1024000000, 1448156250,
+ 1024000000, 1448156250, 1024000000, 1448125000, 1024000000,
+ 1448125000, 1024000000, 1448250000, 1024000000, 1448000000
+}; // Q0
+
+
+const Word16 resize_huffsizn[32] =
+{
+ 0, 0, 0, 0, 0, 11, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2,
+ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0
+}; // Q0
+
+const Word16 huffsizn[32] =
+{
+ 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 4, 4, 3, 3,
+ 3, 3, 4, 4, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7
+}; // Q0
+
+const Word16 huffnorm_tran[32] =
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,122, 10, 6, 1,
+ 0, 3, 2, 26, 58, 186, 442, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+}; // Q0
+
+const Word16 huffsizn_tran[32] =
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 5, 3, 2, 2,
+ 2, 4, 6, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+}; // Q0
+
+const Word16 pgain_huffsizn[32] =
+{
+ 10, 11, 10, 10, 9, 8, 6, 5, 5, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 5, 5, 6, 7, 7, 8, 10, 10, 12, 12
+}; // Q0
+
+const Word16 dicnlg2_float[40] =
+{
+ 34, 33, 32, 31, 30, 29, 28, 27, 26, 25,
+ 24, 23, 22, 21, 20, 19, 18, 17, 16, 15,
+ 14, 13, 12, 11, 10, 9, 8, 7, 6, 5,
+ 4, 3, 2, 1, 0, -1, -2, -3, -4, -5
+}; // Q0
+
+/*** Table for quantization of MLT coefficients ***/
+const Word16 norm_order_48[NB_SFM] =
+{
+ 0, 1, 8, 9, 16, 20, 24, 28, 32, 36, 40, 41, 37, 33, 29, 25, 21, 17, 11, 10, 3, 2,
+ 4, 5, 12, 13, 18, 22, 26, 30, 34, 38, 42, 43, 39, 35, 31, 27, 23, 19, 15, 14, 7, 6
+}; // Q0
+
+const Word16 norm_order_32[SFM_N_SWB] =
+{
+ 0, 1, 8, 9, 16, 20, 24, 28, 32, 36, 37, 33, 29, 25, 21, 17, 11, 10, 3, 2,
+ 4, 5, 12, 13, 18, 22, 26, 30, 34, 38, 35, 31, 27, 23, 19, 15, 14, 7, 6
+}; // Q0
+
+const Word16 norm_order_16[SFM_N_WB] =
+{
+ 0, 1, 8, 9, 16, 20, 24, 21, 17, 11, 10, 3, 2,
+ 4, 5, 12, 13, 18, 22, 25, 23, 19, 15, 14, 7, 6
+}; // Q0
+
+const Word16 intl_bw_16[N_INTL_GRP_16] = {16, 16}; // Q0
+const Word16 intl_bw_32[N_INTL_GRP_32] = {16, 24}; // Q0
+const Word16 intl_bw_48[N_INTL_GRP_48] = {16, 24, 32}; // Q0
+
+const Word16 intl_cnt_16[N_INTL_GRP_16] = {4, 1}; // Q0
+const Word16 intl_cnt_32[N_INTL_GRP_32] = {4, 4}; // Q0
+const Word16 intl_cnt_48[N_INTL_GRP_48] = {4, 3, 2}; // Q0
+
+const Word16 band_start_HQ[44] =
+{
+ 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88,
+ 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240,
+ 256, 280, 304, 328, 352, 376, 400, 424, 448, 472, 496, 520,
+ 544, 576, 608, 640, 672, 704, 736, 768
+}; // Q0
+
+const Word16 band_end_HQ[44] =
+{
+ 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96,
+ 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256,
+ 280, 304, 328, 352, 376, 400, 424, 448, 472, 496, 520, 544,
+ 576, 608, 640, 672, 704, 736, 768, 800
+}; // Q0
+
+const Word16 band_len_HQ[44] =
+{
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 32, 32, 32, 32, 32, 32, 32, 32
+}; // Q0
+
+const Word16 band_start_wb[26] =
+{
+ 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88,
+ 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240,
+ 256, 288
+}; // Q0
+
+const Word16 band_end_wb[26] =
+{
+ 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96,
+ 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256,
+ 288, 320
+}; // Q0
+
+const Word16 band_len_wb[26] =
+{
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16,
+ 32, 32
+}; // Q0
+const Word16 band_len_harm_float[SFM_N_HARM_FB] = // Q0
+{
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 16, 16, 16, 16, 16, 16, 32, 32, 32, 48, 48, 48, 48, 64, 64, 64, 96
+};
+
+const Word16 band_start_harm[SFM_N_HARM_FB] =//Q0
+{
+ 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120,
+ 128, 144, 160, 176, 192, 208, 224, 256, 288, 320, 368, 416, 464, 512, 576, 640, 704
+};
+
+const Word16 band_end_harm[SFM_N_HARM_FB] =//Q0
+{
+ 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128,
+ 144, 160, 176, 192, 208, 224, 256, 288, 320, 368, 416, 464, 512, 576, 640, 704, 800
+};
+
+const Word16 rat_fx[SFM_N_WB] = { 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576,
+ 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 13107, 13107
+};//Q14
+
+const Word16 sfm_width[20] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 8}; // Q0
+const Word16 a_map[20] = {8, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 7, 11}; // Q0
+
+
+const Word32 SQRT_DIM_fx[65] = /* sqrt(x) for x = 0, 1, ..., 64. in Q15 */
+{
+ 0, 32768, 46341, 56756, 65536, 73271, 80265, 86696,
+ 92682, 98304, 103622, 108679, 113512, 118147, 122607, 126910,
+ 131072, 135106, 139023, 142832, 146543, 150162, 153696, 157150,
+ 160530, 163840, 167085, 170268, 173392, 176461, 179478, 182445,
+ 185364, 188238, 191069, 193858, 196608, 199320, 201996, 204636,
+ 207243, 209818, 212361, 214874, 217358, 219814, 222243, 224646,
+ 227023, 229376, 231705, 234010, 236293, 238555, 240795, 243014,
+ 245213, 247393, 249554, 251696, 253820, 255926, 258015, 260088,
+ 262144
+};
+
+
+
+/*------------------------------------------------------------------------------*
+ * HQ core tables for SWB signals
+ *------------------------------------------------------------------------------*/
+
+const Word16 short_window_48kHz_fx[L_FRAME48k / 2 / 2] = /* second half is symetric and omitted Q15*/
+{
+ 107, 322, 536, 751, 965, 1179, 1394, 1608, 1822, 2036, 2250, 2464, 2678, 2892, 3105, 3319,
+ 3532, 3745, 3958, 4171, 4383, 4596, 4808, 5020, 5232, 5444, 5655, 5866, 6077, 6288, 6498, 6708,
+ 6918, 7127, 7336, 7545, 7754, 7962, 8170, 8377, 8585, 8791, 8998, 9204, 9409, 9615, 9819, 10024,
+ 10228, 10431, 10634, 10837, 11039, 11241, 11442, 11643, 11843, 12043, 12242, 12441, 12639, 12836, 13033, 13230,
+ 13426, 13621, 13816, 14010, 14204, 14397, 14589, 14781, 14972, 15162, 15352, 15541, 15730, 15917, 16105, 16291,
+ 16477, 16662, 16846, 17030, 17213, 17395, 17576, 17757, 17937, 18116, 18294, 18472, 18648, 18824, 18999, 19174,
+ 19347, 19520, 19692, 19863, 20033, 20202, 20371, 20538, 20705, 20871, 21035, 21199, 21363, 21525, 21686, 21846,
+ 22006, 22164, 22322, 22478, 22634, 22788, 22942, 23095, 23246, 23397, 23546, 23695, 23843, 23989, 24135, 24279,
+ 24423, 24565, 24707, 24847, 24986, 25125, 25262, 25398, 25533, 25667, 25800, 25931, 26062, 26191, 26320, 26447,
+ 26573, 26698, 26821, 26944, 27066, 27186, 27305, 27423, 27540, 27655, 27770, 27883, 27995, 28106, 28216, 28324,
+ 28431, 28537, 28642, 28746, 28848, 28949, 29049, 29148, 29245, 29341, 29436, 29530, 29622, 29713, 29803, 29891,
+ 29979, 30064, 30149, 30232, 30315, 30395, 30475, 30553, 30630, 30705, 30780, 30853, 30924, 30994, 31063, 31131,
+ 31197, 31262, 31326, 31388, 31449, 31508, 31567, 31624, 31679, 31733, 31786, 31837, 31887, 31936, 31984, 32029,
+ 32074, 32117, 32159, 32200, 32239, 32276, 32313, 32348, 32381, 32413, 32444, 32473, 32501, 32528, 32553, 32577,
+ 32600, 32621, 32640, 32658, 32675, 32691, 32705, 32717, 32729, 32738, 32747, 32754, 32759, 32764, 32766, 32767,
+};
+const Word16 short_window_32kHz_fx[L_FRAME32k / 2 / 2] = /* second half is symetric and omitted Q15*/
+{
+ 161, 483, 804, 1126, 1447, 1768, 2090, 2411, 2731, 3052, 3372, 3692, 4011, 4330, 4649, 4967,
+ 5285, 5602, 5919, 6235, 6550, 6865, 7180, 7493, 7806, 8118, 8429, 8740, 9049, 9358, 9666, 9973,
+ 10279, 10584, 10888, 11191, 11492, 11793, 12093, 12391, 12688, 12984, 13279, 13572, 13865, 14155, 14445, 14733,
+ 15019, 15305, 15588, 15871, 16151, 16430, 16708, 16984, 17258, 17531, 17802, 18071, 18338, 18604, 18868, 19130,
+ 19390, 19649, 19905, 20160, 20413, 20663, 20912, 21159, 21403, 21646, 21886, 22125, 22361, 22595, 22827, 23056,
+ 23284, 23509, 23732, 23953, 24171, 24387, 24601, 24812, 25021, 25228, 25432, 25633, 25833, 26029, 26223, 26415,
+ 26604, 26791, 26975, 27156, 27335, 27511, 27684, 27855, 28023, 28188, 28351, 28511, 28668, 28823, 28974, 29123,
+ 29269, 29412, 29553, 29690, 29825, 29957, 30086, 30212, 30335, 30455, 30572, 30687, 30798, 30906, 31012, 31114,
+ 31214, 31310, 31403, 31494, 31581, 31665, 31747, 31825, 31900, 31972, 32041, 32107, 32169, 32229, 32286, 32339,
+ 32389, 32437, 32481, 32522, 32559, 32594, 32626, 32654, 32679, 32701, 32720, 32736, 32749, 32758, 32764, 32767,
+};
+
+const Word16 short_window_16kHz_fx[L_FRAME16k / 2 / 2] = /* second half is symetric and omitted Q15*/
+{
+ 322, 965, 1608, 2250, 2892, 3532, 4171, 4808, 5444, 6077, 6708, 7336, 7962, 8585, 9204, 9819,
+ 10431, 11039, 11643, 12242, 12836, 13426, 14010, 14589, 15162, 15730, 16291, 16846, 17395, 17937, 18472, 18999,
+ 19520, 20033, 20538, 21035, 21525, 22006, 22478, 22942, 23397, 23843, 24279, 24707, 25125, 25533, 25931, 26320,
+ 26698, 27066, 27423, 27770, 28106, 28431, 28746, 29049, 29341, 29622, 29891, 30149, 30395, 30630, 30853, 31063,
+ 31262, 31449, 31624, 31786, 31936, 32074, 32200, 32313, 32413, 32501, 32577, 32640, 32691, 32729, 32754, 32766,
+};
+
+const Word16 short_window_8kHz_fx[L_FRAME8k / 2 / 2] = /* second half is symetric and omitted Q15*/
+{
+ 643, 1929, 3212, 4490, 5760, 7022, 8274, 9512,
+ 10736, 11943, 13132, 14300, 15447, 16569, 17666, 18736,
+ 19777, 20788, 21766, 22711, 23621, 24494, 25330, 26127,
+ 26883, 27598, 28270, 28899, 29483, 30022, 30514, 30959,
+ 31357, 31706, 32007, 32258, 32459, 32610, 32711, 32762,
+};
+
+const Word16 inv_jp2[64] =//Q15
+{
+ 16384, 10923, 8192, 6554, 5461, 4681, 4096, 3641, 3277, 2979, 2731, 2521, 2341, 2185, 2048, 1928,
+ 1820, 1725, 1638, 1560, 1489, 1425, 1365, 1311, 1260, 1214, 1170, 1130, 1092, 1057, 1024, 993,
+ 964, 936, 910, 886, 862, 840, 819, 799, 780, 762, 745, 728, 712, 697, 683, 669,
+ 655, 643, 630, 618, 607, 596, 585, 575, 565, 555, 546, 537, 529, 520, 512, 504
+};
+const Word16 subf_norm_groups[4][11] =
+{
+ {0,1,8,9,16,20,24,28,32,36,40},
+ {2,3,10,11,17,21,25,29,33,37,41},
+ {4,5,12,13,18,22,26,30,34,38,42},
+ {6,7,14,15,19,23,27,31,35,39,43}
+}; // Q0
+
+const Word16 gain_att_fx[40] = /* Q=15 */
+{
+ 15711, 19367, 21781, 23743, 24899, 25929, 26758, 27514,
+ 28059, 28562, 28994, 29398, 29693, 29970, 30213, 30442,
+ 30619, 30786, 30936, 31077, 31190, 31298, 31395, 31488,
+ 31564, 31637, 31704, 31768, 31822, 31873, 31920, 31966,
+ 32005, 32042, 32077, 32111, 32140, 32168, 32195, 32220
+};
+
+const Word16 stab_trans_fx[10] = /* Q15 */
+{
+ 16384, 11381, 7232, 4292, 2433,
+ 1341, 728, 391, 209, 112
+};
+
+const Word16 env_stab_tp_fx[2][2] = /* Q15 */
+{
+ {32735, 16384},
+ {33, 16384}
+};
+
+const Word16 att_step_fx[4] = /* Q=13 */
+{
+ 32767, 16384, 10923, 8192
+};
+
+const Word32 table_logcum_fx[563] =//Q16
+{
+ 0, 0, 0, 65536, 169408, 300480, 452650, 622058, 806041,
+ 1002649, 1210393, 1428099, 1654816, 1889761, 2132272, 2381791, 2637833,
+ 2899977, 3167853, 3441134, 3719526, 4002767, 4290623, 4582876, 4879332,
+ 5179812, 5484152, 5792200, 6103816, 6418871, 6737244, 7058822, 7383500,
+ 7711180, 8041769, 8375181, 8711333, 9050150, 9391557, 9735485, 10081869,
+ 10430647, 10781759, 11135150, 11490766, 11848556, 12208469, 12570461, 12934487,
+ 13300503, 13668469, 14038345, 14410092, 14783676, 15159061, 15536214, 15915101,
+ 16295692, 16677956, 17061866, 17447390, 17834504, 18223180, 18613394, 19005122,
+ 19398338, 19793020, 20189146, 20586692, 20985640, 21385968, 21787658, 22190686,
+ 22595040, 23000696, 23407638, 23815850, 24225314, 24636014, 25047934, 25461060,
+ 25875374, 26290862, 26707510, 27125304, 27544232, 27964278, 28385428, 28807674,
+ 29231000, 29655392, 30080844, 30507338, 30934866, 31363416, 31792978, 32223540,
+ 32655092, 33087624, 33521126, 33955588, 34391000, 34827352, 35264636, 35702840,
+ 36141960, 36581988, 37022908, 37464716, 37907404, 38350964, 38795388, 39240668,
+ 39686792, 40133760, 40581560, 41030188, 41479632, 41929888, 42380948, 42832808,
+ 43285456, 43738892, 44193104, 44648088, 45103840, 45560348, 46017612, 46475624,
+ 46934376, 47393864, 47854080, 48315024, 48776684, 49239060, 49702144, 50165928,
+ 50630412, 51095588, 51561452, 52028000, 52495224, 52963124, 53431688, 53900916,
+ 54370808, 54841348, 55312540, 55784380, 56256856, 56729972, 57203720, 57678096,
+ 58153096, 58628716, 59104952, 59581800, 60059256, 60537316, 61015980, 61495236,
+ 61975084, 62455524, 62936548, 63418156, 63900340, 64383100, 64866428, 65350328,
+ 65834792, 66319816, 66805396, 67291536, 67778224, 68265456, 68753240, 69241560,
+ 69730424, 70219816, 70709744, 71200208, 71691192, 72182704, 72674736, 73167280,
+ 73660344, 74153920, 74648008, 75142600, 75637704, 76133296, 76629400, 77125992,
+ 77623080, 78120656, 78618728, 79117280, 79616320, 80115840, 80615832, 81116312,
+ 81617256, 82118680, 82620568, 83122920, 83625744, 84129024, 84632768, 85136968,
+ 85641624, 86146728, 86652288, 87158304, 87664760, 88171664, 88679008, 89186792,
+ 89695016, 90203680, 90712776, 91222304, 91732256, 92242648, 92753464, 93264704,
+ 93776368, 94288448, 94800952, 95313872, 95827208, 96340960, 96855120, 97369696,
+ 97884672, 98400064, 98915856, 99432048, 99948648, 100465640, 100983040, 101500832,
+ 102019016, 102537592, 103056568, 103575928, 104095672, 104615808, 105136328, 105657232,
+ 106178520, 106700184, 107222232, 107744656, 108267456, 108790632, 109314176, 109838096,
+ 110362384, 110887040, 111412064, 111937448, 112463208, 112989320, 113515800, 114042640,
+ 114569832, 115097392, 115625304, 116153568, 116682184, 117211160, 117740480, 118270152,
+ 118800168, 119330536, 119861248, 120392312, 120923712, 121455448, 121987536, 122519960,
+ 123052720, 123585816, 124119248, 124653016, 125187120, 125721552, 126256320, 126791416,
+ 127326840, 127862592, 128398664, 128935072, 129471800, 130008856, 130546224, 131083920,
+ 131621936, 132160272, 132698920, 133237888, 133777176, 134316768, 134856688, 135396912,
+ 135937440, 136478288, 137019440, 137560912, 138102688, 138644768, 139187152, 139729840,
+ 140272832, 140816128, 141359712, 141903616, 142447808, 142992304, 143537104, 144082192,
+ 144627568, 145173248, 145719232, 146265504, 146812064, 147358912, 147906048, 148453488,
+ 149001200, 149549216, 150097504, 150646096, 151194960, 151744112, 152293536, 152843264,
+ 153393264, 153943536, 154494096, 155044944, 155596064, 156147456, 156699120, 157251072,
+ 157803296, 158355792, 158908560, 159461616, 160014928, 160568512, 161122368, 161676496,
+ 162230896, 162785568, 163340496, 163895696, 164451168, 165006896, 165562896, 166119152,
+ 166675664, 167232448, 167789504, 168346816, 168904368, 169462208, 170020288, 170578624,
+ 171137232, 171696080, 172255200, 172814560, 173374192, 173934064, 174494192, 175054576,
+ 175615216, 176176096, 176737232, 177298608, 177860256, 178422128, 178984256, 179546640,
+ 180109264, 180672128, 181235248, 181798608, 182362208, 182926064, 183490144, 184054480,
+ 184619056, 185183872, 185748928, 186314224, 186879760, 187445520, 188011536, 188577776,
+ 189144272, 189710992, 190277936, 190845136, 191412560, 191980208, 192548112, 193116224,
+ 193684592, 194253168, 194821984, 195391040, 195960320, 196529824, 197099568, 197669520,
+ 198239712, 198810144, 199380784, 199951648, 200522752, 201094080, 201665616, 202237392,
+ 202809376, 203381600, 203954032, 204526688, 205099568, 205672672, 206246000, 206819536,
+ 207393296, 207967280, 208541472, 209115888, 209690528, 210265376, 210840432, 211415712,
+ 211991216, 212566912, 213142848, 213718976, 214295328, 214871888, 215448672, 216025664,
+ 216602864, 217180272, 217757888, 218335712, 218913760, 219492000, 220070464, 220649120,
+ 221228000, 221807072, 222386368, 222965856, 223545552, 224125456, 224705568, 225285872,
+ 225866400, 226447120, 227028032, 227609168, 228190496, 228772016, 229353760, 229935680,
+ 230517824, 231100160, 231682688, 232265424, 232848352, 233431472, 234014800, 234598336,
+ 235182048, 235765968, 236350080, 236934400, 237518896, 238103600, 238688496, 239273600,
+ 239858880, 240444352, 241030032, 241615888, 242201952, 242788192, 243374640, 243961264,
+ 244548096, 245135104, 245722304, 246309696, 246897280, 247485056, 248073008, 248661152,
+ 249249488, 249838016, 250426720, 251015616, 251604704, 252193968, 252783424, 253373056,
+ 253962880, 254552896, 255143088, 255733472, 256324032, 256914768, 257505696, 258096800,
+ 258688096, 259279568, 259871216, 260463056, 261055056, 261647264, 262239632, 262832192,
+ 263424928, 264017840, 264610928, 265204192, 265797632, 266391264, 266985072, 267579040,
+ 268173200, 268767520, 269362048, 269956736, 270551584, 271146624, 271741824, 272337216,
+ 272932768, 273528480, 274124384, 274720480, 275316704, 275913120, 276509728, 277106496,
+ 277703424, 278300544, 278897824, 279495264, 280092896, 280690688, 281288640, 281886752,
+ 282485056, 283083520
+};
+const Word32 pow_getbitsfrompulses_fx[16] = /*Q21 */
+{
+ 2097152, 2190001, 2286961, 2388214, 2493948, 2604365, 2719671, 2840081,
+ 2965822, 3097129, 3234251, 3377442, 3526976, 3683128, 3846194, 4016480
+};
+const Word16 DDP_fx[4] = { 3, 0, 1, 2 };//Q0
+
+const Word16 step_tcq[8][STATES] = { {0,4}, {0,4}, {1,5}, {1,5}, {2,6}, {2,6}, {3,7}, {3,7} }; // Q0
+const Word16 denc[8][STATES] = { {0,2}, {2,0}, {1,3}, {3,1}, {2,0}, {0,2}, {3,1}, {1,3} }; /* enc trellis Q0*/
+const Word16 ddec[8][STATES] = { {0,2}, {1,3}, {2,0}, {3,1}, {2,0}, {3,1}, {0,2}, {1,3} }; /* dec trellis Q0*/
+
+
+const Word16 step_LSB[STATES_LSB][2] = { {0,1}, {2,3}, {0,1}, {2,3} }; // Q0
+const Word16 denc_LSB[STATES_LSB][2] = { {0,3}, {2,1}, {3,0}, {1,2} }; // Q0
+const Word16 dqnt_LSB[STATES_LSB][4] = { {0,8,1,8}, {0,8,1,8}, {8,0,8,1}, {8,0,8,1} }; // Q0
+
+const Word16 dstep_LSB[4][2] = { {0,2}, {0,2}, {1,3}, {1,3} }; // Q0
+const Word16 ddec_LSB[4][2] = { {0,3}, {3,0}, {2,1}, {1,2} }; // Q0
+
+
+const Word16 nextstate[STATES][2] = {{0, 1}, {2, 3}, {4, 5}, {6, 7}, {0, 1}, {2, 3}, {4, 5}, {6, 7}};/*current state points to next two states Q0*/
+
+/*------------------------------------------------------------------------------*
+ * PVQ tables
+ *------------------------------------------------------------------------------*/
+
+const Word16 fine_gain_bits[8] = {0, 0, 0, 1, 2, 2, 4, 5}; // Q0
+const Word16 finegain_1_fx[2] = { -12204, 12647 }; /* Q14 */
+const Word16 finegain_2_fx[4] = { -17773, -5925, 6010, 18769 }; /* Q14 */
+const Word16 finegain_3_fx[8] = { -16384, -11703, -7022, -2341, 2341, 7022, 11703, 16384 }; /* Q14 */
+const Word16 finegain_4_fx[16] = /* Q14 */
+{
+ -21683, -18292, -14998, -11876, -8936, -6239, -3702, -1371,
+ 945, 3275, 6088, 9079, 12450, 15999, 19796, 23868
+};
+const Word16 finegain_5_fx[32] = /* Q14 */
+{
+ -21462, -18895, -16284, -14135, -12605, -11307, -10139, -8910,
+ -8028, -6792, -5638, -4812, -3672, -2681, -1725, -479,
+ 449, 1390, 2364, 3433, 4579, 5516, 6769, 7767,
+ 9085, 10152, 11009, 12535, 14765, 17093, 20094, 24716
+};
+const Word16* finegain_fx[5] = { finegain_1_fx, finegain_2_fx, finegain_3_fx, finegain_4_fx, finegain_5_fx };/* Q14 */
+
+
+const UWord8 hBitsMinus1_N01[2] = {1, 7}; // Q0
+
+const UWord8 hBitsMinus1_N02[65]=
+{
+ 64, 15, 23, 28, 31, 34, 36, 38, 39, 41, 42, 43, 44, 45, 46, 47,
+ 47, 48, 49, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59,
+ 60, 61, 62, 63, 63, 64, 65, 65, 67, 68, 69, 69, 70, 71, 72, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 85, 86, 87,
+ 87
+}; // Q0
+
+const UWord8 hBitsMinus1_N03[65]=
+{
+ 64, 20, 33, 41, 48, 53, 57, 61, 64, 66, 69, 71, 73, 75, 76, 78,
+ 80, 81, 82, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98, 99, 100, 102,
+ 104, 106, 108, 110, 111, 113, 114, 115, 118, 120, 122, 123, 125, 127, 128, 129,
+ 131, 133, 135, 137, 139, 141, 142, 144, 145, 146, 149, 151, 153, 155, 157, 158,
+ 160
+}; // Q0
+
+const UWord8 hBitsMinus1_N04[65]=
+{
+ 64, 23, 39, 51, 60, 67, 73, 79, 83, 87, 91, 94, 97, 100, 102, 105,
+ 107, 109, 111, 113, 115, 116, 119, 122, 125, 127, 130, 132, 134, 136, 138, 141,
+ 144, 147, 150, 152, 154, 156, 158, 160, 164, 167, 170, 173, 175, 177, 180, 182,
+ 184, 187, 190, 193, 196, 199, 201, 203, 205, 207, 211, 214, 217, 220, 222, 225,
+ 227
+}; // Q0
+
+const UWord8 hBitsMinus1_N05[54]=
+{
+ 53, 26, 45, 59, 70, 79, 87, 94, 100, 105, 110, 114, 118, 122, 125, 128,
+ 131, 134, 136, 139, 141, 144, 148, 152, 155, 158, 161, 164, 167, 170, 172, 176,
+ 181, 184, 188, 191, 194, 197, 200, 202, 207, 211, 215, 219, 222, 225, 228, 231,
+ 233, 238, 242, 246, 250, 253
+}; // Q0
+
+const UWord8 hBitsMinus1_N06[42]=
+{
+ 41, 28, 49, 65, 78, 89, 99, 107, 114, 120, 126, 132, 136, 141, 145, 149,
+ 153, 156, 159, 162, 165, 168, 173, 178, 183, 187, 191, 194, 198, 201, 204, 209,
+ 214, 219, 224, 228, 231, 235, 238, 241, 247, 253
+}; // Q0
+
+const UWord8 hBitsMinus1_N07[34]=
+{
+ 33, 30, 52, 70, 85, 98, 109, 118, 126, 134, 141, 147, 153, 158, 163, 168,
+ 172, 176, 180, 184, 188, 191, 197, 203, 208, 213, 218, 222, 226, 230, 233, 240,
+ 246, 252
+}; // Q0
+
+const UWord8 hBitsMinus1_N08[29]=
+{
+ 28, 31, 55, 75, 91, 105, 117, 128, 138, 146, 154, 161, 168, 174, 180, 185,
+ 190, 195, 200, 204, 208, 212, 219, 226, 232, 238, 243, 248, 253
+}; // Q0
+
+const UWord8 hBitsMinus1_N09[25]=
+{
+ 24, 33, 58, 79, 97, 112, 125, 137, 148, 157, 166, 174, 182, 189, 195, 201,
+ 207, 212, 217, 222, 227, 231, 240, 247, 254
+}; // Q0
+
+const UWord8 hBitsMinus1_N10[22]=
+{
+ 21, 34, 61, 83, 101, 118, 132, 145, 157, 167, 177, 186, 194, 202, 209, 216,
+ 222, 228, 234, 239, 245, 250
+}; // Q0
+
+const UWord8 hBitsMinus1_N11[19]=
+{
+ 18, 35, 63, 86, 106, 123, 139, 152, 165, 176, 187, 197, 206, 214, 222, 230,
+ 237, 243, 250
+}; // Q0
+
+const UWord8 hBitsMinus1_N12[17]=
+{
+ 16, 36, 65, 89, 110, 128, 144, 159, 173, 185, 196, 207, 217, 226, 234, 242,
+ 250
+}; // Q0
+
+const UWord8 hBitsMinus1_N13[16]=
+{
+ 15, 37, 67, 92, 113, 133, 150, 165, 180, 193, 205, 216, 227, 237, 246, 254,
+}; // Q0
+
+const UWord8 hBitsMinus1_N14[14]=
+{
+ 13, 38, 68, 94, 117, 137, 155, 171, 186, 200, 213, 225, 236, 247
+}; // Q0
+
+const UWord8 hBitsMinus1_N15[13]=
+{
+ 12, 39, 70, 97, 120, 141, 160, 177, 193, 207, 221, 233, 245
+}; // Q0
+
+const UWord8 hBitsMinus1_N16[13]=
+{
+ 12, 39, 71, 99, 123, 144, 164, 182, 198, 214, 228, 241, 253
+}; // Q0
+
+const UWord8 hBitsMinus1_N17[12]=
+{
+ 11, 40, 73, 101, 126, 148, 168, 187, 204, 220, 234, 248
+}; // Q0
+
+const UWord8 hBitsMinus1_N18[12]=
+{
+ 11, 41, 74, 103, 128, 151, 172, 191, 209, 225, 241, 255
+}; // Q0
+
+const UWord8 hBitsMinus1_N19[11]=
+{
+ 10, 41, 75, 105, 131, 154, 176, 196, 214, 231, 247
+}; // Q0
+
+const UWord8 hBitsMinus1_N20[11]=
+{
+ 10, 42, 77, 107, 133, 157, 179, 200, 219, 236, 253
+}; // Q0
+
+const UWord8 hBitsMinus1_N21[10]=
+{
+ 9, 43, 78, 108, 135, 160, 183, 204, 223, 241
+}; // Q0
+
+const UWord8 hBitsMinus1_N22[10]=
+{
+ 9, 43, 79, 110, 138, 163, 186, 207, 227, 246
+}; // Q0
+
+const UWord8 hBitsMinus1_N23[10]=
+{
+ 9, 44, 80, 111, 140, 165, 189, 211, 231, 250
+}; // Q0
+
+const UWord8 hBitsMinus1_N24[10]=
+{
+ 9, 44, 81, 113, 142, 168, 192, 214, 235, 255
+}; // Q0
+
+const UWord8 hBitsMinus1_N25[9]=
+{
+ 8, 45, 82, 114, 143, 170, 195, 217, 239
+}; // Q0
+
+const UWord8 hBitsMinus1_N26[9]=
+{
+ 8, 45, 83, 116, 145, 172, 197, 221, 242
+}; // Q0
+
+const UWord8 hBitsMinus1_N27[9]=
+{
+ 8, 46, 84, 117, 147, 175, 200, 224, 246
+}; // Q0
+
+const UWord8 hBitsMinus1_N28[9]=
+{
+ 8, 46, 84, 118, 149, 177, 202, 227, 249
+}; // Q0
+const UWord8 hBitsMinus1_N29[9]=
+{
+ 8, 46, 85, 119, 150, 179, 205, 229, 252
+}; // Q0
+const UWord8 hBitsMinus1_N30[8]=
+{
+ 7, 47, 86, 121, 152, 181, 207, 232
+}; // Q0
+const UWord8 hBitsMinus1_N31[8]=
+{
+ 7, 47, 87, 122, 153, 182, 209, 235
+}; // Q0
+const UWord8 hBitsMinus1_N32[8]=
+{
+ 7, 47, 87, 123, 155, 184, 212, 237
+}; // Q0
+const UWord8 hBitsMinus1_N33[8]=
+{
+ 7, 48, 88, 124, 156, 186, 214, 240
+}; // Q0
+const UWord8 hBitsMinus1_N34[8]=
+{
+ 7, 48, 89, 125, 158, 188, 216, 242
+}; // Q0
+const UWord8 hBitsMinus1_N35[8]=
+{
+ 7, 49, 90, 126, 159, 189, 218, 245
+}; // Q0
+const UWord8 hBitsMinus1_N36[8]=
+{
+ 7, 49, 90, 127, 160, 191, 220, 247
+}; // Q0
+const UWord8 hBitsMinus1_N37[8]=
+{
+ 7, 49, 91, 128, 162, 193, 222, 249
+}; // Q0
+const UWord8 hBitsMinus1_N38[8]=
+{
+ 7, 49, 91, 129, 163, 194, 224, 251
+}; // Q0
+const UWord8 hBitsMinus1_N39[8]=
+{
+ 7, 50, 92, 130, 164, 196, 225, 253
+}; // Q0
+const UWord8 hBitsMinus1_N40[8]=
+{
+ 7, 50, 93, 131, 165, 197, 227, 255
+}; // Q0
+const UWord8 hBitsMinus1_N41[7]=
+{
+ 6, 50, 93, 131, 166, 199, 229
+}; // Q0
+const UWord8 hBitsMinus1_N42[7]=
+{
+ 6, 51, 94, 132, 167, 200, 230
+}; // Q0
+const UWord8 hBitsMinus1_N43[7]=
+{
+ 6, 51, 94, 133, 168, 201, 232
+}; // Q0
+const UWord8 hBitsMinus1_N44[7]=
+{
+ 6, 51, 95, 134, 170, 203, 234
+}; // Q0
+const UWord8 hBitsMinus1_N45[7]=
+{
+ 6, 51, 95, 135, 171, 204, 235
+}; // Q0
+const UWord8 hBitsMinus1_N46[7]=
+{
+ 6, 52, 96, 135, 172, 205, 237
+}; // Q0
+const UWord8 hBitsMinus1_N47[7]=
+{
+ 6, 52, 96, 136, 173, 206, 238
+}; // Q0
+const UWord8 hBitsMinus1_N48[7]=
+{
+ 6, 52, 97, 137, 174, 208, 240
+}; // Q0
+const UWord8 hBitsMinus1_N49[7]=
+{
+ 6, 52, 97, 138, 175, 209, 241
+}; // Q0
+const UWord8 hBitsMinus1_N50[7]=
+{
+ 6, 53, 98, 138, 175, 210, 243
+}; // Q0
+const UWord8 hBitsMinus1_N51[7]=
+{
+ 6, 53, 98, 139, 176, 211, 244
+}; // Q0
+const UWord8 hBitsMinus1_N52[7]=
+{
+ 6, 53, 99, 140, 177, 212, 245
+}; // Q0
+const UWord8 hBitsMinus1_N53[7]=
+{
+ 6, 53, 99, 140, 178, 213, 247
+}; // Q0
+const UWord8 hBitsMinus1_N54[7]=
+{
+ 6, 54, 100, 141, 179, 214, 248
+}; // Q0
+const UWord8 hBitsMinus1_N55[7]=
+{
+ 6, 54, 100, 142, 180, 216, 249
+}; // Q0
+const UWord8 hBitsMinus1_N56[7]=
+{
+ 6, 54, 100, 142, 181, 217, 250
+}; // Q0
+const UWord8 hBitsMinus1_N57[7]=
+{
+ 6, 54, 101, 143, 181, 218, 252
+};
+const UWord8 hBitsMinus1_N58[7]=
+{
+ 6, 54, 101, 143, 182, 219, 253
+}; // Q0
+const UWord8 hBitsMinus1_N59[7]=
+{
+ 6, 55, 102, 144, 183, 220, 254
+}; // Q0
+const UWord8 hBitsMinus1_N60[7]=
+{
+ 6, 55, 102, 145, 184, 221, 255
+}; // Q0
+const UWord8 hBitsMinus1_N61[6]=
+{
+ 5, 55, 102, 145, 185, 221
+}; // Q0
+const UWord8 hBitsMinus1_N62[6]=
+{
+ 5, 55, 103, 146, 185, 222
+}; // Q0
+const UWord8 hBitsMinus1_N63[6]=
+{
+ 5, 55, 103, 146, 186, 223
+}; // Q0
+const UWord8 hBitsMinus1_N64[6]=
+{
+ 5, 55, 103, 147, 187, 224
+}; // Q0
+const Word16 dsHighDiracsTab[PVQ_MAX_BAND_SIZE - DS_INDEX_LINEAR_END ] =
+{
+ 23, 25, 27, 29, 31, 33, 35, 37, 39,
+ 43, 47, 51, 55, 59, 63, 67, 71, 75,
+ 83, 91, 99, 107, 115, 123, 131, 139, 147,
+ 163, 179, 195, 211, 227, 243, 259, 275, 291,
+ 323, 355, 387, 419, 451, 483, 512
+}; // Q0
+
+const UWord32 intLimCDivInvDQ31[67+1] =
+{
+ 0x00000000, 0x80000000, 0x40000000, 0x2aaaaaab, 0x20000000, 0x1999999a, 0x15555556, 0x12492493,
+ 0x10000000, 0x0e38e38f, 0x0ccccccd, 0x0ba2e8bb, 0x0aaaaaab, 0x09d89d8a, 0x0924924a, 0x08888889,
+ 0x08000000, 0x07878788, 0x071c71c8, 0x06bca1b0, 0x06666667, 0x06186187, 0x05d1745e, 0x0590b217,
+ 0x05555556, 0x051eb852, 0x04ec4ec5, 0x04bda130, 0x04924925, 0x0469ee59, 0x04444445, 0x04210843,
+ 0x04000000, 0x03e0f83f, 0x03c3c3c4, 0x03a83a84, 0x038e38e4, 0x03759f23, 0x035e50d8, 0x03483484,
+ 0x03333334, 0x031f3832, 0x030c30c4, 0x02fa0be9, 0x02e8ba2f, 0x02d82d83, 0x02c8590c, 0x02b93106,
+ 0x02aaaaab, 0x029cbc15, 0x028f5c29, 0x02828283, 0x02762763, 0x026a43a0, 0x025ed098, 0x0253c826,
+ 0x02492493, 0x023ee090, 0x0234f72d, 0x022b63cc, 0x02222223, 0x02192e2a, 0x02108422, 0x02082083,
+ 0x02000000, 0x01f81f82, 0x01f07c20, 0x01e9131b
+}; // Q0
+
+const UWord8 obtainEnergyQuantizerDensity_f[57] =
+ {
+ 1, 1, 1, 1, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 4, 4, 4,
+ 4, 4, 4, 6, 6, 6, 6, 8,
+ 8, 8, 10,10,12,12,14,14,
+ 16,18,20,20,22,24,26,30,
+ 32,34,38,42,46,50,54,58,
+ 64,70,76,82,90,98,108,118, 128
+}; // Q0
+
+
+/* (char)ceil(log2(hBitsN[N][0])) - 2) */
+const UWord8 f_log2_n[ PVQ_MAX_BAND_SIZE + 1] =
+{
+ 0xff, 0xff, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01}; // Q0
+
+const UWord8 * const hBitsN[ PVQ_MAX_BAND_SIZE + 1 ]=
+{
+f_log2_n/*N=0*/, hBitsMinus1_N01, hBitsMinus1_N02, hBitsMinus1_N03, hBitsMinus1_N04,
+hBitsMinus1_N05, hBitsMinus1_N06, hBitsMinus1_N07, hBitsMinus1_N08, hBitsMinus1_N09,
+hBitsMinus1_N10, hBitsMinus1_N11, hBitsMinus1_N12, hBitsMinus1_N13, hBitsMinus1_N14,
+hBitsMinus1_N15, hBitsMinus1_N16, hBitsMinus1_N17, hBitsMinus1_N18, hBitsMinus1_N19,
+hBitsMinus1_N20, hBitsMinus1_N21, hBitsMinus1_N22, hBitsMinus1_N23, hBitsMinus1_N24,
+hBitsMinus1_N25, hBitsMinus1_N26, hBitsMinus1_N27, hBitsMinus1_N28, hBitsMinus1_N29,
+hBitsMinus1_N30, hBitsMinus1_N31, hBitsMinus1_N32, hBitsMinus1_N33, hBitsMinus1_N34,
+hBitsMinus1_N35, hBitsMinus1_N36, hBitsMinus1_N37, hBitsMinus1_N38, hBitsMinus1_N39,
+hBitsMinus1_N40, hBitsMinus1_N41, hBitsMinus1_N42, hBitsMinus1_N43, hBitsMinus1_N44,
+hBitsMinus1_N45, hBitsMinus1_N46, hBitsMinus1_N47, hBitsMinus1_N48, hBitsMinus1_N49,
+hBitsMinus1_N50, hBitsMinus1_N51, hBitsMinus1_N52, hBitsMinus1_N53, hBitsMinus1_N54,
+hBitsMinus1_N55, hBitsMinus1_N56, hBitsMinus1_N57, hBitsMinus1_N58, hBitsMinus1_N59,
+hBitsMinus1_N60, hBitsMinus1_N61, hBitsMinus1_N62, hBitsMinus1_N63, hBitsMinus1_N64,
+}; // Q0
+
+const Word16 lim_neg_inv_tbl_fx[MAX_SPLITS + 1 ] =
+{ /* 1 = optimized inv_tbl_fx constant for div by 1, Q15 */
+ /* 2-10 = negated inv_tbl_fx Q15*/
+ 0,
+ -32768, -16384, -10923, -8192, -6554,
+ -5462, -4681, -4096, -3641, -3277
+};
+
+const Word16 Idx2Freq_Tbl[] = { 6554/*12.8*512*/, 48 * 512, 13108/*25.6*512*/, 32 * 512, 16 * 512, 8 * 512 }; /* in Q9 */
+
+const Word16 fg_inv_tbl_fx [HQ_MAX_BAND_LEN/8 + 1 ] =
+{ /* i/8 , slice of inv_tbl_fx , Q15 */
+ 0,
+ 4096, 2048, 1366, 1024, 820, 683,
+ 586, 512, 456, 410, 373, 342
+};
+
+
+const UWord32 exactdivodd[ODD_DIV_SIZE] =
+{
+ /* exactdivodd[0]=1/1, exactdivodd[1]=1/3, exactdivodd[n]=1/(2*n+1), exactdivodd[47]=1/95 ) */
+ 1U, 2863311531U, 3435973837U, 3067833783U, 954437177U, 3123612579U, 3303820997U, 4008636143U,
+ 4042322161U, 678152731U, 1022611261U, 3921491879U, 3264175145U, 1749801491U, 1332920885U, 3186588639U,
+ 1041204193U, 2331553675U, 2437684141U, 2532929431U, 3247414297U, 799063683U, 2767867813U, 1736263375U,
+ 438261969U, 4210752251U, 2350076445U, 1483715975U, 3089362441U, 2693454067U, 3238827797U, 3204181951U,
+ 3237744577U, 128207979U, 2738819725U, 3811027319U, 3353604601U, 2519714147U, 1059797125U, 1631000239U,
+ 2014922929U, 724452315U, 4244438269U, 1875962727U, 4198451177U, 3539808211U, 1062196213U, 3571604383U
+}; // Q0
+
+const Word16 gain_cb_size[MAX_GAIN_BITS] = {2, 4, 8, 16, 32}; // Q0
+
+const Word16 inner_frame_tbl[4] = {L_FRAME8k, L_FRAME16k, L_FRAME32k, L_FRAME48k}; /* corresponds to NB, WB, SWB, FB Q0*/
+const Word16 hq_nominal_scaling_inv[7] = { 0, 8192, 11585, 0, 16384, 0, 20066 }; /*Q13 */
+const Word16 hq_nominal_scaling[7] = { 0, 32767, 23170, 0, 16384, 0, 13377 }; /*Q15 */
+
+const Word16 l_spec_tbl[4] = {L_SPEC8k, L_SPEC16k, L_SPEC32k, L_SPEC48k}; /* corresponds to NB, WB, SWB, FB Q0*/
+const Word16 l_spec_ext_tbl[4] = {0, L_SPEC16k_EXT, L_SPEC32k_EXT, L_SPEC48k_EXT}; /* corresponds to NB, WB, SWB, FB Q0*/
+const Word16 sinq_16k[3 * L_FRAME16k / 20] =/*Q15 */
+{
+ 536, 1608, 2678, 3745, 4808, 5866, 6918, 7962,
+ 8998, 10024, 11039, 12043, 13033, 14010, 14972, 15917,
+ 16846, 17757, 18648, 19520, 20371, 21199, 22006, 22788,
+ 23546, 24279, 24986, 25667, 26319, 26944, 27540, 28106,
+ 28642, 29147, 29622, 30064, 30475, 30852, 31197, 31508,
+ 31786, 32029, 32238, 32413, 32553, 32658, 32728, 32763
+};
+const Word16 sinq_32k[3 * L_FRAME32k / 20] =/*Q15 */
+{
+ 268, 804, 1340, 1876, 2411, 2945, 3479, 4011, 4543, 5073, 5602, 6130,
+ 6655, 7180, 7702, 8222, 8740, 9255, 9768, 10279, 10786, 11291, 11793, 12292,
+ 12787, 13279, 13767, 14252, 14733, 15210, 15683, 16151, 16616, 17075, 17531, 17981,
+ 18427, 18868, 19304, 19734, 20160, 20580, 20994, 21403, 21806, 22203, 22595, 22980,
+ 23359, 23732, 24098, 24459, 24812, 25159, 25499, 25832, 26159, 26478, 26790, 27095,
+ 27393, 27684, 27967, 28243, 28511, 28771, 29024, 29269, 29506, 29735, 29956, 30170,
+ 30375, 30572, 30761, 30941, 31114, 31278, 31433, 31580, 31719, 31849, 31971, 32084,
+ 32189, 32285, 32372, 32451, 32521, 32582, 32634, 32678, 32713, 32740, 32757, 32766
+};
+const Word16 sinq_48k[3 * L_FRAME48k / 20] =/*Q15 */
+{
+ 179, 536, 893, 1251, 1608, 1965, 2321, 2678, 3034, 3390, 3745, 4100,
+ 4454, 4808, 5161, 5514, 5866, 6217, 6568, 6918, 7267, 7615, 7962, 8308,
+ 8654, 8998, 9341, 9683, 10024, 10364, 10702, 11039, 11375, 11710, 12043, 12375,
+ 12705, 13033, 13361, 13686, 14010, 14332, 14653, 14972, 15289, 15604, 15918, 16229,
+ 16539, 16846, 17152, 17455, 17757, 18056, 18353, 18648, 18941, 19232, 19520, 19806,
+ 20090, 20371, 20650, 20926, 21200, 21471, 21740, 22006, 22269, 22530, 22789, 23044,
+ 23297, 23547, 23794, 24038, 24280, 24519, 24754, 24987, 25217, 25444, 25667, 25888,
+ 26106, 26320, 26531, 26740, 26945, 27147, 27345, 27541, 27733, 27921, 28107, 28289,
+ 28468, 28643, 28815, 28984, 29149, 29310, 29468, 29623, 29774, 29922, 30066, 30206,
+ 30343, 30476, 30606, 30732, 30854, 30973, 31087, 31199, 31306, 31410, 31510, 31606,
+ 31699, 31788, 31873, 31954, 32031, 32105, 32175, 32241, 32303, 32361, 32415, 32466,
+ 32513, 32556, 32595, 32630, 32661, 32688, 32712, 32731, 32747, 32759, 32766, 32767
+};
+/*------------------------------------------------------------------------------*
+ * LR-MDCT tables
+ *------------------------------------------------------------------------------*/
+
+/* subband width tables */
+
+/* NB short win: 7200/8000/9600, 13200/16400/24400 */
+const Word16 band_width_40_4_6_0_0_0[4] = { 6, 8, 11, 15 }; // Q0
+const Word16 band_width_40_5_6_0_0_0[5] = { 6, 7, 7, 9, 11 }; // Q0
+
+/* NB long win: 7200, 8000, 9600, 13200, 16400 */
+const Word16 band_width_160_13_6_2_0_0[13] = { 6, 6, 6, 6, 7, 8, 9, 10, 13, 15, 19, 24, 31 }; // Q0
+const Word16 band_width_160_14_6_3_0_0[14] = { 6, 6, 6, 6, 6, 7, 8, 9, 10, 12, 15, 18, 22, 29 }; // Q0
+const Word16 band_width_160_17_6_3_0_0[17] = { 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 13, 15, 17, 19 }; // Q0
+const Word16 band_width_160_18_6_4_0_0[18] = { 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 12, 14, 15, 17 }; // Q0
+
+/* WB short win: 13200/16400/24400 */
+const Word16 band_width_80_7_6_0_0_0[7] = { 6, 7, 8, 10, 12, 16, 21 }; // Q0
+
+/* WB long win: 13200, 16400 */
+const Word16 band_width_320_18_6_3_0_0[18] = { 6, 6, 6, 6, 6, 7, 7, 8, 10, 11, 13, 16, 19, 24, 30, 37, 47, 61 }; // Q0
+const Word16 band_width_320_20_6_3_0_0[20] = { 6, 6, 6, 6, 6, 6, 7, 8, 8, 9, 11, 12, 14, 17, 20, 23, 28, 34, 42, 51 }; // Q0
+
+/* SWB short win: 13200, 16400 */
+const Word16 band_width_142_8_8_0_0_0[8] = {7,8,10,11,15,21,29,41}; // Q0
+const Word16 band_width_160_8_8_0_0_0[8] = { 8, 9, 11,13,17,23,32,47}; // Q0
+
+/* SWB long win: 13200, 16400 */
+const Word16 band_width_568_22_6_2_0_0[22] = { 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, 11, 13, 16, 19, 23, 28, 34, 42, 55, 68, 84, 105}; // Q0
+const Word16 band_width_640_24_6_4_0_0[24] = { 6, 6, 6, 6, 6, 6, 7,7,8,9,10,11,13,15,18,21,26,32,39,48,59, 74,92,115}; // Q0
+
+/* LR-MDCT: NB configuration tables */
+const Xcore_Config xcore_config_8kHz_007200bps_long = { 13, L_FRAME8k, band_width_160_13_6_2_0_0, 536870912L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0 /*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_8kHz_008000bps_long = { 14, L_FRAME8k, band_width_160_14_6_3_0_0, 536870912L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0 /*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_8kHz_013200bps_long = { 17, L_FRAME8k, band_width_160_17_6_3_0_0, 429496730L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 4, 2, 24576/*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_8kHz_016400bps_long = { 18, L_FRAME8k, band_width_160_18_6_4_0_0, 322122547L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0 /*p2a_th*/, 13107/*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
+
+const Xcore_Config xcore_config_8kHz_007200bps_short = { 4, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_4_6_0_0_0, 966367642L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0/*p2a_th*/,9830 /*pd_thresh*/, 2949/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_8kHz_008000bps_short = { 4, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_4_6_0_0_0, 1181116006L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 4, 0, 0/*p2a_th*/,9830 /*pd_thresh*/, 2949/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_8kHz_013200bps_short = { 5, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_5_6_0_0_0, 751619276L, 24576, 24576/*eref*/, 11469, 11469/*bit_alloc_weight*/, 2, 4, 0, 0/*p2a_th*/,22938/*pd_thresh*/, 3604/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_8kHz_016400bps_short = { 5, L_FRAME8k / NUM_TIME_SWITCHING_BLOCKS, band_width_40_5_6_0_0_0, 536870912L, 24576, 24576/*eref*/, 11469, 11469/*bit_alloc_weight*/, 2, 6, 0, 0/*p2a_th*/,22491/*pd_thresh*/, 3604/*ld_slope*/, 19661/*ni_coef*/ };
+
+/* LR-MDCT: WB configuration tables */
+const Xcore_Config xcore_config_16kHz_013200bps_long = { 18, L_FRAME16k, band_width_320_18_6_3_0_0, 429496730L, 24576, 24576/*eref*/, 13106, 13106/*bit_alloc_weight*/, 2, 6, 3, 24576/*p2a_th*/, 13107/*pd_thresh*/, 3932/*ld_slope*/, 18022/*ni_coef*/ };
+const Xcore_Config xcore_config_16kHz_016400bps_long = { 20, L_FRAME16k, band_width_320_20_6_3_0_0, 429496730L, 24576, 24576/*eref*/, 13106, 13106/*bit_alloc_weight*/, 2, 6, 3, 24576/*p2a_th*/, 13107/*pd_thresh*/, 3932/*ld_slope*/, 19660/*ni_coef*/ };
+
+const Xcore_Config xcore_config_16kHz_013200bps_short = { 7, L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS, band_width_80_7_6_0_0_0, 966367642L, 24576, 24576/*eref*/, 9830, 9830/*bit_alloc_weight*/, 2, 4, 0, 0 /*p2a_th*/, 9830 /*pd_thresh*/, 4258/*ld_slope*/, 18022/*ni_coef*/ };
+const Xcore_Config xcore_config_16kHz_016400bps_short = { 7, L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS, band_width_80_7_6_0_0_0, 966367642L, 24576, 24576/*eref*/, 11468, 11468/*bit_alloc_weight*/, 2, 8, 0, 0 /*p2a_th*/, 9830 /*pd_thresh*/, 4258/*ld_slope*/, 19660/*ni_coef*/ };
+
+/* LR-MDCT: SWB configuration tables */
+const Xcore_Config xcore_config_32kHz_013200bps_long = { 22, 568, band_width_568_22_6_2_0_0, 322122547L, 24576, 24576/*eref*/, 6554, 6554/*bit_alloc_weight*/, 2, 4, 5, 28672/*p2a_th*/, 13107 /*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_32kHz_016400bps_long = { 24, 640, band_width_640_24_6_4_0_0, 322122547L, 24576, 24576/*eref*/, 8192, 8192/*bit_alloc_weight*/, 2, 4, 5, 28672/*p2a_th*/, 13107 /*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_32kHz_013200bps_short = { 8, 568 / NUM_TIME_SWITCHING_BLOCKS, band_width_142_8_8_0_0_0, 1610612736L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 4, 0, 0 /*p2a_th*/, 16384 /*pd_thresh*/, 3604/*ld_slope*/, 19661/*ni_coef*/ };
+const Xcore_Config xcore_config_32kHz_016400bps_short = { 8, 640 / NUM_TIME_SWITCHING_BLOCKS, band_width_160_8_8_0_0_0, 644245094L, 24576, 24576/*eref*/, 8192, 8192/*bit_alloc_weight*/, 2, 4, 0, 0 /*p2a_th*/, 9830 /*pd_thresh*/, 4260/*ld_slope*/, 19661/*ni_coef*/ };
+
+/* bandwidths */
+const Word16 Nb[ NB_SFM] =
+{
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16,
+ 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 32, 32, 32, 32, 32, 32, 32, 32
+}; // Q0
+
+/* log2(Nb) to calculate minimum bits for one pulse in PVQ */
+const Word16 LNb[ NB_SFM] =
+{
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
+ 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5
+}; // Q0
+
+
+/*------------------------------------------------------------------------------*
+ * GSC tables
+ *------------------------------------------------------------------------------*/
+
+const Word16 gsc_sfm_start[MBANDS_GN] = {0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240}; // Q0
+
+const Word16 gsc_sfm_end[MBANDS_GN] = {16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256}; // Q0
+
+const Word16 gsc_sfm_size[MBANDS_GN] = {16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; // Q0
+
+const Word16 sm_table_fx[] =
+{
+ 32767, 32126, 31480, 30838, 30196, 29557, 28918, 28279, 27643, 27007,
+ 26375, 25746, 25120, 24494, 23875, 23255, 22643, 22033, 21427, 20824,
+ 20228, 19638, 19048, 18468, 17891, 17321, 16758, 16197, 15647, 15103,
+ 14562, 14031, 13507, 12989, 12481, 11980, 11488, 11000, 10525, 10056,
+ 9598, 9146, 8706, 8274, 7851, 7438, 7035, 6642, 6259, 5885,
+ 5521, 5171, 4830, 4499, 4178, 3870, 3572, 3287, 3011, 2746,
+ 2494, 2254, 2025, 1809, 1602, 1412, 1229, 1062, 904, 760,
+ 629, 511, 403, 308, 226, 157, 102, 56, 26, 7,
+}; // Q15
+
+const Word16 GSC_freq_bits[] =
+{
+ 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_5k00*/
+ 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_6k15*/
+ 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_7k20*/
+ 21, 74, -4, 26, 16, 12, 11, 9, 0, 0, 4, 4, 1, 1, 3, 0, 0, /* ACELP_8k00*/
+ 26, 80, -3, 28, 18, 13, 12, 9, 0, 0, 4, 4, 1, 1, 3, 0, 0, /* ACELP_9k60*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_11k60*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_12k15*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_12k85*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_13k20*/
+ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_14k80*/
+ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+ 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_22k60*/
+ 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4 /* ACELP_24k40*/
+}; // Q0
+const Word32 GSC_freq_bits_fx[] =/*Q18*/
+{
+ 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_5k00*/
+ 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_6k15*/
+ 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_7k20*/
+ 5505024, 19660800, -1048576, 6815744, 4194304, 3145728, 2883584, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/
+ 6815744, 20971520, -786432, 7340032, 4718592, 3407872, 3145728, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_11k60*/
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k15*/
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k85*/
+ 8126464, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_14k80*/
+ 8126464, 25165824, -262144, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+ 8126464, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_22k60*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+ 8126464, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_22k60*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+};
+
+const Word32 GSC_freq_bits_fx_Q18[] =/*Q18*/
+{
+ 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0,
+ 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0,
+ 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0,
+ 5505024, 19398656, -1048576, 6815744, 4194304, 3145728, 2883584, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0,
+ 6815744, 20971520, -786432, 7340032, 4718592, 3407872, 3145728, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0,
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+ 6815744, 25165824, -262144, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+ 6815744, 25165824, -262144, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+ 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+ 6815744, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576,
+};
+const Word16 Compl_GSC_freq_bits[] =
+{
+ 5, 10, 10, 10 /* bitrate > ACELP_16k40 && FS = 16kHz */
+}; // Q0
+
+const Word16 mfreq_bindiv_loc[] = { 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 32, 32, 32 }; // Q0
+
+const Word16 mean_gp_fx[] = { 9590 }; /*Q14*/
+
+const Word16 dic_gp_fx[] = /*Q14*/
+{
+ -9580, -7692, -6385, -4474, -3254, -2038, -806, -82,
+ 1034, 2259, 3457, 4684, 5290, 6544, 8548, 10052,
+ -8964, -8338, -7021, -5754, -5118, -3850, -2654, -1429,
+ 408, 1660, 2852, 4071, 5915, 7170, 7825, 9249
+};
+const Word16 Gain_meanNB_fx[] =
+{
+ 9852,
+};/* Q12 */
+
+const Word16 Gain_mean_dicNB_fx[1 * 64] = /*Q12 */
+{
+ -1309, -931, -568, -396, -54, 807, 1174, 1533,
+ 1901, 2092, 2286, 2493, 2698, 3130, 2909, 286,
+ -748, 990, 631, -1119, -1697, -2114, -2788, -5399,
+ -9841, -1902, -3270, -7975, -7438, -6926, -7192, -2325,
+ -1504, -2549, -3022, -3532, -3818, -4136, -4751, -5071,
+ -5756, -6093, -8998, -6389, -8765, -9438, 3369, 3917,
+ 3619, 4684, -8264, 4255, -4433, -6662, -9230, -7678,
+ 5859, 118, 457, -227, 1717, 1353, -8499, -9649
+};
+
+const Word16 Mean_dic_NB_fx[1 * 10] = /*Q12 */
+{
+ -444, -100, -120, -37, 25,
+ 70, 148, 63, 170, 229
+};
+
+const Word16 Gain_dic1_NB_fx[3 * 64] = /*Q12 */
+{
+ -606, -92, 5,
+ -1965, 294, 666,
+ -440, 119, 661,
+ -106, 267, 108,
+ -1213, 345, -136,
+ -1251, 618, 566,
+ -1905, -750, 648,
+ -1043, -360, -498,
+ -18, -322, 96,
+ 334, 116, -247,
+ -1929, 660, 23,
+ -1845, 1178, 485,
+ -180, 836, 167,
+ -1892, -922, -321,
+ 416, -437, -344,
+ 595, -548, 158,
+ -265, -807, -338,
+ -1065, -1015, -20,
+ -626, 595, -333,
+ -569, 1090, 651,
+ 27, 587, -331,
+ -184, -85, -503,
+ -1902, -1807, 326,
+ -1861, -159, -989,
+ -666, 143, -1163,
+ -1718, 1031, -744,
+ 847, 301, -59,
+ 720, -1001, -216,
+ 1380, -866, -969,
+ 803, -4, -608,
+ 233, 408, -998,
+ 1459, 87, 263,
+ 345, -615, -1026,
+ 877, -148, -7,
+ 68, -1075, 270,
+ 802, 329, 475,
+ -1923, -126, -38,
+ 1275, -419, -349,
+ 401, 926, 575,
+ 846, -233, 547,
+ 693, -1880, 356,
+ -362, -1683, -219,
+ 231, -339, 598,
+ 1227, -616, 267,
+ 1116, 91, -1316,
+ -551, -650, 530,
+ 444, 32, 181,
+ -384, 1207, -775,
+ -993, 1163, 41,
+ 784, -1018, 538,
+ 635, 636, -424,
+ 1373, -1367, 149,
+ 1442, 401, -444,
+ 1094, 888, 123,
+ 874, 1113, -1082,
+ -646, -1112, -1103,
+ 539, -1632, -683,
+ 402, 571, 99,
+ -1778, -1809, -849,
+ -732, -1691, 700,
+ -678, 526, 274,
+ 320, 1227, -118,
+ -1222, -180, 454,
+ 173, 349, 530
+};
+
+const Word16 Gain_dic2_NB_fx[3 * 32] = /*Q12 */
+{
+ 28, 0, -66,
+ -557, 4, 206,
+ 281, -642, 36,
+ -417, 81, -494,
+ -380, 684, 450,
+ 521, -1544, 258,
+ -1119, 613, -1151,
+ 514, 24, 797,
+ 292, -84, -526,
+ 296, 418, -231,
+ -419, -68, 976,
+ 2, -308, 398,
+ -456, -1007, 263,
+ -1221, -371, 446,
+ -221, -390, -181,
+ -1210, 588, 751,
+ -1093, 528, -174,
+ 590, 372, -1271,
+ -79, -251, -1241,
+ -1016, -487, -512,
+ 542, 581, 338,
+ -265, 456, -105,
+ 490, -71, 89,
+ 42, 235, 379,
+ 31, 1194, -202,
+ 173, -839, 850,
+ -46, 500, -802,
+ 152, 933, 1073,
+ 980, 345, -263,
+ 807, -580, -521,
+ -23, -992, -585,
+ 876, -576, 411
+};
+
+const Word16 Gain_dic3_NB_fx[4 * 16] = /*Q12 */
+{
+ -16, 65, -227, 11,
+ -214, 553, 366, 185,
+ 137, -338, -300, -625,
+ -122, 82, 538, -797,
+ 160, 285, -1103, 35,
+ -594, 312, -379, -423,
+ 169, -642, -395, 363,
+ 351, -1166, 630, -261,
+ -1190, 217, 416, 187,
+ -577, 244, -636, 858,
+ 580, 482, -220, 635,
+ 475, -188, 372, 27,
+ -65, -369, 504, 910,
+ -423, -442, 124, -40,
+ 480, 575, -41, -651,
+ 682, 680, 910, 489
+};
+
+const Word16 Gain_dic2_NBHR_fx[3 * 64] = /*Q12 */
+{
+ 29, 0, -94,
+ -605, -202, -174,
+ 324, -380, -163,
+ -126, -301, -306,
+ -288, 124, 112,
+ -86, 524, -115,
+ 234, 18, -464,
+ -55, -281, 179,
+ 161, 446, 632,
+ 366, -82, 97,
+ 228, -1149, 270,
+ 293, 286, -143,
+ -123, -35, -896,
+ -540, -675, 175,
+ 331, -483, -687,
+ -779, 204, -668,
+ -492, 768, -510,
+ -1215, -620, -483,
+ 681, -76, -296,
+ -671, 396, -45,
+ -759, 298, 564,
+ -284, 589, 321,
+ -1366, -592, 496,
+ -448, -585, -712,
+ 12, -756, -90,
+ 513, 167, -927,
+ -1172, 1060, -1198,
+ -477, 748, 1006,
+ 42, 103, 1277,
+ -940, 1049, 138,
+ -924, -14, -1469,
+ 684, 679, -1580,
+ 417, -374, -1572,
+ 607, 270, 256,
+ 567, 778, 843,
+ 1414, -223, -542,
+ 97, 200, 251,
+ 222, 1074, -547,
+ -714, -285, 1046,
+ 386, -684, 984,
+ 338, 674, 116,
+ -274, 171, -368,
+ 581, -1871, 342,
+ 94, 442, -597,
+ -293, -1205, 851,
+ -127, 501, -1247,
+ 175, 1700, 1357,
+ -24, 1224, 285,
+ 707, -952, -293,
+ 668, 492, -407,
+ 1164, 751, 201,
+ 381, -595, 288,
+ -1570, 481, -531,
+ -597, -160, 326,
+ -578, -1311, -40,
+ -118, -523, 576,
+ -1513, 527, 757,
+ -184, 40, 609,
+ -1215, 98, 68,
+ -65, -1324, -836,
+ 821, -299, 204,
+ 796, 21, 840,
+ 310, -133, 542,
+ 1042, -974, 537
+};
+
+const Word16 Gain_dic3_NBHR_fx[4 * 128] = /*Q12 */
+{
+ 293, 7, -202, -95,
+ 535, 110, 542, -512,
+ -578, 65, -560, -345,
+ 206, 332, 10, -533,
+ -76, 356, -14, 83,
+ 149, -372, -195, -490,
+ -478, -241, -55, 113,
+ -293, -470, -606, 62,
+ 797, -1448, 625, -1128,
+ 173, 464, -1686, -49,
+ -392, -295, -159, -464,
+ -715, 420, -146, -984,
+ -36, 28, -484, 119,
+ 472, 272, -729, -116,
+ 68, -87, -628, -429,
+ 429, -918, -158, -191,
+ -545, 230, -435, 261,
+ -128, 15, -791, 612,
+ 268, -387, -1258, 102,
+ 378, 238, 301, 3,
+ -494, 149, 131, -124,
+ 634, -308, 99, 24,
+ 572, 711, 754, -1137,
+ -1109, 400, 1093, 369,
+ -831, -423, 1583, 1089,
+ -83, 156, -105, 1078,
+ -930, 476, 152, 380,
+ 776, 1162, 788, -43,
+ 279, 50, 408, 597,
+ 476, 483, 73, 749,
+ 903, 686, 80, -411,
+ 195, -768, 280, 344,
+ -263, -999, -46, -284,
+ -66, 263, 315, -1239,
+ 435, 578, -234, -1169,
+ 199, -1669, 188, 114,
+ -57, 419, -509, -633,
+ 98, -119, 129, -816,
+ -157, -365, -249, 537,
+ 67, -624, 121, 1153,
+ 1444, 142, -584, 38,
+ 1086, -84, 162, 994,
+ 392, -384, -124, 533,
+ 252, 183, -1161, -885,
+ -431, -829, 102, 432,
+ -708, 987, -1021, -644,
+ -64, 120, -1684, 985,
+ 210, -494, -906, 1302,
+ 50, -186, 177, 185,
+ -256, 872, -1004, 387,
+ 564, -80, -679, 515,
+ -763, -40, -1174, 228,
+ -1029, 199, -59, -297,
+ 30, -47, 198, -264,
+ -396, -1435, 913, -1018,
+ -141, 962, 36, 458,
+ 36, -388, 776, -1000,
+ -74, 489, 1137, 140,
+ -970, -766, 666, -117,
+ 90, 599, 1665, 1405,
+ -313, -685, -764, -615,
+ 563, -462, -627, -768,
+ 792, 560, -1445, 556,
+ -581, 721, -559, 1137,
+ -699, -273, 274, -846,
+ 940, -690, 747, -253,
+ -177, -541, 1355, -217,
+ -586, 427, 1196, -868,
+ 147, 532, -550, 405,
+ 258, 677, -245, -166,
+ 772, 1062, -331, 482,
+ 388, 1870, -576, 1585,
+ 462, 865, 454, 1212,
+ 570, 528, -681, 1229,
+ -386, 607, 599, 865,
+ -154, -20, -211, -231,
+ 96, 736, 408, -259,
+ 763, -1533, 1094, 249,
+ 705, -1132, 1757, -1082,
+ 310, -481, 329, -395,
+ 194, -781, 59, -954,
+ -933, -957, -25, 1866,
+ -852, -224, -482, 822,
+ -1438, 490, 221, 1281,
+ 392, 677, 539, 347,
+ 884, -614, 1844, 678,
+ -773, 484, -928, 2477,
+ -274, -461, 378, -263,
+ -283, -312, 583, 342,
+ 453, -1541, 378, 1266,
+ 778, 1095, 1290, 824,
+ -958, -443, -208, -71,
+ 985, -1001, -123, 473,
+ 56, -1003, -513, 474,
+ -259, 1435, 975, 315,
+ -59, -169, 724, 961,
+ -210, 1030, 341, -977,
+ 1054, 2917, -7, -877,
+ -852, -228, 330, 625,
+ 9, -524, -97, -14,
+ 16, -50, 476, 2406,
+ 264, -238, 768, 56,
+ 187, 108, -169, 446,
+ 673, 238, 992, 671,
+ -218, 285, 485, 181,
+ 669, -526, 639, 571,
+ 650, 20, -188, -516,
+ 1031, 165, 526, 136,
+ -333, 307, 102, -569,
+ -157, 309, -934, -121,
+ -336, 141, 39, 536,
+ 662, 364, -133, 222,
+ -1284, 637, -636, 77,
+ 1241, 846, 467, 638,
+ 842, 328, 1330, -320,
+ 152, -1009, 550, -215,
+ -772, 13, 594, -122,
+ 336, -410, -547, -2,
+ 869, -106, 321, -1180,
+ 516, 1247, -828, -577,
+ -670, 873, 367, -132,
+ -415, 630, -287, -164,
+ -105, 138, 657, -441,
+ -160, -1085, 940, 704,
+ -128, -68, -369, -1052,
+ -1434, 594, 546, -665,
+ -1849, 75, 175, 174,
+ -1283, 729, -1590, 1032
+};
+
+const Word16 YG_mean16_fx[1 * 16] = /*Q12 */
+{
+ -396, -192, -168, -136, -60, -17, 45, 39,
+ 120, 81, 90, 67, 147, 34, 163, 184
+};
+
+const Word16 YG_dicMR_1_fx[4 * 64] = /*Q12 */
+{
+ -1879, 826, 539, -210,
+ -120, 267, -137, -142,
+ -798, -473, 434, 243,
+ 297, -896, 369, 307,
+ -1883, -1333, 416, 510,
+ -1955, -660, -471, 224,
+ -905, -804, -517, 433,
+ -961, 20, -258, -224,
+ 209, 977, -213, -17,
+ 536, -244, 159, 97,
+ -265, 775, 412, -327,
+ 337, -391, -237, -472,
+ -1962, -1836, -692, 471,
+ 625, 173, -463, -15,
+ -965, 263, 62, 600,
+ -782, 889, -433, 211,
+ -1791, 852, -453, -776,
+ -182, -177, -1078, 80,
+ -364, 350, 280, 293,
+ -902, 1119, 295, -1194,
+ 16, 440, -342, 459,
+ -1825, -1584, -1382, -798,
+ 723, 57, -1235, -661,
+ 888, -1638, 277, 234,
+ 340, 345, 141, -610,
+ 1280, -23, 17, 144,
+ -639, -852, -520, -553,
+ 1032, 843, 149, 435,
+ 581, 783, 519, -196,
+ 457, 945, 498, -1289,
+ -1897, -41, 425, 514,
+ 787, 161, 506, 385,
+ -559, 1079, 319, 515,
+ 500, 340, 60, 106,
+ 251, -997, -1163, -960,
+ 261, -1288, -631, 335,
+ 1241, -620, -387, -662,
+ 167, 194, 476, 67,
+ 830, -261, 430, -1201,
+ -479, -123, 71, -1162,
+ 225, -1482, 132, -802,
+ 680, 763, -1010, 429,
+ 200, -125, 261, 590,
+ 771, -740, -183, 229,
+ -1860, -348, 278, -549,
+ -1768, 967, 281, 594,
+ -1727, -1697, 87, -764,
+ 1169, 631, -114, -471,
+ -1636, -101, -1324, -91,
+ 821, -745, 458, -264,
+ 1014, -576, 390, 470,
+ 1041, -517, -1018, 367,
+ 826, 17, 426, -326,
+ -467, -1641, 201, 325,
+ -1906, 428, -338, 222,
+ -1021, 630, 419, -75,
+ -86, -379, -203, 234,
+ 659, 527, -491, -1507,
+ -564, -1745, -979, -173,
+ -1764, -433, -743, -1090,
+ 242, 709, 269, 497,
+ 716, 74, -208, 618,
+ -297, 645, -864, -805,
+ -46, -326, 412, -296
+};
+const Word16 YG_dicMR_2_fx[4 * 32] = /*Q12 */
+{
+ 93, 217, -122, 37,
+ -13, -83, 105, -491,
+ -398, -592, 399, -160,
+ 543, -81, -470, 408,
+ 394, -630, -94, -258,
+ -665, 133, -136, -125,
+ 397, -351, 630, -148,
+ -1166, 406, -865, 554,
+ -136, -302, -263, 81,
+ -674, -657, -571, -691,
+ -206, 381, -699, 122,
+ 272, -1506, 356, 15,
+ 451, -961, 638, -1133,
+ 316, -787, 165, 585,
+ 312, -144, 185, 274,
+ 39, -706, -997, 250,
+ -915, -871, -114, 458,
+ -834, 348, 364, -1188,
+ 450, 723, -256, 412,
+ 369, 468, -1371, 416,
+ 344, 164, 290, -1094,
+ 664, 122, 34, -218,
+ 555, 254, 559, 825,
+ 312, 492, 496, -27,
+ -399, 315, 690, -330,
+ -458, 710, 206, 415,
+ 290, 89, -662, -467,
+ -72, 593, -108, -460,
+ -217, 46, 319, 189,
+ -1366, 199, 365, 62,
+ -552, -166, 772, 861,
+ -159, 120, -215, 775
+};
+const Word16 YG_dicMR_3_fx[4 * 32] = /*Q12 */
+{
+ -103, -143, -85, -19,
+ -404, 182, -795, 84,
+ 398, -594, -55, -256,
+ 283, 128, -472, 279,
+ -246, -628, 281, 297,
+ -853, 468, 358, -915,
+ 272, 149, 209, -443,
+ -168, -504, 452, -525,
+ 624, -427, 779, 117,
+ 1079, 404, -98, 80,
+ 136, 165, 142, -1394,
+ 513, -566, -150, 822,
+ 124, 646, 199, 272,
+ -165, -702, -615, 165,
+ 333, 810, -457, 1038,
+ -360, 105, -110, 537,
+ -224, 125, 562, -26,
+ 699, -1105, 809, -1323,
+ -1229, 841, -767, 571,
+ -310, 437, -114, -230,
+ -1045, 630, 564, 322,
+ 282, 1170, -723, -306,
+ -328, -247, -251, -598,
+ 354, 332, -1593, 499,
+ 332, -23, 219, 304,
+ 325, -1511, 378, 299,
+ -94, -54, 679, 956,
+ 507, 830, 861, -739,
+ -895, -135, 16, -34,
+ 677, 650, 961, 714,
+ 816, -665, -1741, -671,
+ 274, 93, -617, -433
+};
+const Word16 YG_dicMR_4_fx[4 * 16] = /*Q12 */
+{
+ -163, -44, -108, 32,
+ 556, 153, 115, 120,
+ 617, 818, 802, 719,
+ -639, -665, 122, 664,
+ 353, -555, -352, -86,
+ -1162, 833, -1034, 326,
+ -511, -406, -478, -523,
+ 491, -1473, 404, -21,
+ 148, 288, -45, -544,
+ -61, 172, -791, -44,
+ 715, -449, 861, 504,
+ -108, 263, 610, 118,
+ 962, 826, -1013, -37,
+ -32, -495, 362, -214,
+ -37, 661, -75, 289,
+ -835, 243, 85, -105
+};
+
+
+const Word16 mean_m_fx[1 * 1] = /*Q12 */
+{
+ 11762
+};
+
+const Word16 mean_gain_dic_fx[1 * 64] =
+{
+ -739, -519, -76, 147, 574, 779, 983, 1185,
+ 1384, 1580, 1784, 1989, 2204, 2643, 2864, 2422,
+ 362, -295, -1197, -1936, -2757, -11755, -8216, 3083,
+ 3311, -1434, -1682, -3341, -9284, -9057, -8616, -7783,
+ -7359, -6964, -6592, -6233, -5470, -5050, -4651, -3954,
+ -2470, -963, -2199, -3042, -3643, -4292, -5854, -10199,
+ 4103, 3548, 4390, 4717, 3817, -10525, -11521, -9570,
+ -9899, -9171, -10841, -11165, 5500, 5079, 6139, 6993
+}; /* Q12 */
+
+const Word16 YGain_mean_LR_fx[1 * 12] =/* Q12 */
+{
+ -385, -178, -143, -116, -46, -12,
+ 64, 50, 118, 68, 133, 151
+};
+
+const Word16 YGain_dic1_LR_fx[3 * 32] = /*Q12 */
+{
+ -1909, 159, -90,
+ -155, 416, -15,
+ -99, -84, 396,
+ -1832, -848, -320,
+ -779, 1024, 45,
+ -1860, -1761, 273,
+ 81, -341, -309,
+ -819, -3, -315,
+ 483, 215, -194,
+ 242, 937, -76,
+ -1830, -1753, -1102,
+ -1589, 868, -657,
+ -911, 389, 421,
+ -1834, 915, 390,
+ -144, 564, -869,
+ 878, -1544, 301,
+ 446, 332, 376,
+ -540, -822, -1001,
+ 548, -192, 232,
+ 920, -589, -175,
+ 869, 717, -564,
+ 797, -103, -1047,
+ -335, -1732, -186,
+ -1840, -345, 566,
+ 1205, 109, 43,
+ 985, -456, 570,
+ 650, -1223, -874,
+ 928, 752, 390,
+ -124, 833, 575,
+ -1811, -249, -1142,
+ -711, -767, 185,
+ 344, -876, 267,
+};
+
+const Word16 YGain_dic2_LR_fx[4 * 32] = /*Q12 */
+{
+ -294, -73, -41, 11,
+ 276, 330, -1316, 173,
+ 26, -712, 86, 1,
+ -841, -539, 246, -479,
+ 43, -207, 709, 116,
+ 104, -197, 227, -548,
+ 261, -228, 165, 606,
+ 613, 403, -122, -420,
+ 14, 182, -544, -669,
+ -734, 392, -492, -131,
+ -1316, 274, 116, 331,
+ -1339, 535, -1261, 608,
+ -346, 277, -426, 729,
+ -1067, -836, -571, 388,
+ 643, 503, 484, 532,
+ -148, 447, 120, -392,
+ -600, 263, 519, -75,
+ 686, -346, 379, 23,
+ 130, 239, 376, -1366,
+ 68, 656, -361, 92,
+ 608, 286, -405, 487,
+ -1031, 507, 523, -971,
+ 51, -44, -521, 172,
+ -573, -500, 398, 632,
+ 240, 147, 104, 51,
+ -319, -680, -890, -398,
+ -195, 503, 306, 459,
+ 335, 368, 662, -389,
+ 378, -788, -537, 680,
+ 433, -1129, 472, -883,
+ 472, -312, -301, -207,
+ 378, -1346, 433, 408,
+};
+
+const Word16 YGain_dic3_LR_fx[5 * 32] = /*Q12 */
+{
+ -332, -191, -122, -455, -210,
+ 364, -48, -664, 408, 225,
+ -576, -342, 367, 52, 270,
+ -392, -157, -77, 625, -224,
+ -183, -652, -406, 99, 266,
+ 24, 65, 74, 525, 613,
+ -805, 306, -383, -21, 247,
+ 16, 133, -416, -4, -567,
+ 294, -750, 443, -367, 228,
+ 536, 816, 767, 562, 594,
+ -54, 200, -1108, -582, 227,
+ 123, -43, 414, -376, -649,
+ 592, -652, -674, -386, -356,
+ 100, -58, -45, -108, 103,
+ -727, -194, -1170, 931, 1096,
+ 512, 758, -440, -769, -1051,
+ 362, 787, -276, -139, 149,
+ -218, 387, 457, -414, 265,
+ -202, 663, -1104, 882, -338,
+ -57, 405, 269, 257, -221,
+ 335, 864, 1164, -611, -618,
+ 1275, 494, -1783, 119, 1222,
+ 752, 76, 270, 73, -57,
+ 376, -1255, 145, 724, 603,
+ -989, 618, 659, 675, 560,
+ 128, -147, -138, -368, 963,
+ 140, -170, 866, 538, 127,
+ 122, -616, 166, 236, -396,
+ 374, 279, 407, 650, -1269,
+ -861, 613, -755, -1334, -972,
+ -922, 314, 416, -114, -648,
+ 265, 85, 61, -1110, 45
+};
+
+const Word16 YG_mean16HR_fx[] =
+{
+ //Q12
+ -396, -191, -167, -135,
+ -60, -17, 45, 39,
+ 120, 81, 89, 67,
+ 146, 33, 163, 183,
+};
+
+const Word16 YG_dicHR_1_fx[] =
+{
+ //Q12
+ -1955, 412, 133, 32,
+ -340, 88, -42, 20,
+ -999, 314, -144, 456,
+ -429, -190, 186, 547,
+ -1057, 160, 243, -197,
+ -46, -81, -491, -223,
+ 143, 986, -113, 15,
+ 286, -313, 77, 3,
+ 249, -1251, 380, 305,
+ -1909, -258, 481, 86,
+ 902, 59, 42, -186,
+ -1969, -992, -335, 223,
+ -1913, -163, -465, -167,
+ -806, 1201, 24, 481,
+ -564, -1943, 212, 380,
+ -120, -691, -162, 138,
+ -966, 1009, 437, -464,
+ 434, 147, 185, 158,
+ -1944, -133, -313, 602,
+ -1029, 236, -612, -373,
+ -749, -571, -1008, -399,
+ 666, -954, -111, 88,
+ 186, -16, -174, 338,
+ -235, -314, 403, -244,
+ 285, 133, 85, -349,
+ -1981, -1506, -1290, 338,
+ -1977, -1925, -368, 876,
+ -1930, 256, 453, 667,
+ -1884, 259, -123, -779,
+ -813, 1087, -595, -1014,
+ 396, 66, -876, 412,
+ -543, 907, -657, 301,
+ -485, 612, 515, 777,
+ -362, 420, 417, -518,
+ -1754, 1307, 65, -1202,
+ -618, 705, -56, -56,
+ -1938, 1005, 561, 59,
+ 62, 521, -440, 319,
+ -1776, 1011, -279, -165,
+ 558, 357, -444, -47,
+ 801, -1998, 313, 319,
+ -1873, -826, -1691, -978,
+ -588, -294, -328, -1021,
+ -91, 513, -288, -530,
+ -1945, -1964, -350, -293,
+ -307, -1057, 203, -631,
+ 94, -1713, -548, -62,
+ 616, -11, -510, -780,
+ 682, -1574, 260, -441,
+ 507, -778, 522, -88,
+ 1321, -635, -432, -619,
+ 369, -615, -335, -1646,
+ 1026, -572, 265, -256,
+ 779, 127, -155, 356,
+ -462, -180, -637, 405,
+ 1329, 1071, 543, 784,
+ 434, -468, 120, -581,
+ 1293, -532, 60, 377,
+ 63, -1290, -336, 708,
+ 756, 42, 412, 607,
+ 731, 1003, 598, -1388,
+ -1818, -1666, 547, 185,
+ -1915, -802, 485, 789,
+ 907, 437, 455, 108,
+ 507, -102, 573, -109,
+ 1037, -1292, -691, 512,
+ 1428, 159, 20, 271,
+ 111, -826, -607, -563,
+ -622, -1328, -1391, -1000,
+ -15, 1094, 339, -684,
+ 448, 790, -439, -1617,
+ -1765, -943, -657, -675,
+ 107, -835, -1140, 241,
+ 33, 122, 520, 242,
+ 194, 204, 313, -1080,
+ 1308, 548, -711, -850,
+ 1520, 474, 334, -516,
+ 1091, -42, 347, -1543,
+ 1098, -219, 680, 139,
+ 855, -895, 613, -985,
+ -1631, -1550, 539, -1277,
+ 672, 905, -1057, 430,
+ 555, 659, -38, 450,
+ -1118, -53, 536, 487,
+ 563, -485, -204, 650,
+ -678, -930, 470, 425,
+ 1180, -259, -990, 319,
+ 993, 319, -362, 926,
+ 782, -254, -1447, -534,
+ -1946, 964, 86, 617,
+ -1651, 727, -813, 514,
+ -552, 395, 522, 124,
+ -1710, 579, 831, -542,
+ 34, 463, 143, 2,
+ -1742, -207, -642, -1517,
+ -1967, -740, 272, -606,
+ 663, 670, 58, -620,
+ 229, 274, 122, 677,
+ 65, 1144, 24, 693,
+ -1383, 1061, 630, 894,
+ 536, 539, 106, -31,
+ 1080, 774, -267, 67,
+ 355, 518, 609, -336,
+ 777, -735, 412, 551,
+ 219, -424, 392, 451,
+ -543, -1909, -189, -933,
+ -938, -178, 489, -1008,
+ -749, -1216, -440, -157,
+ 681, -355, -423, -19,
+ 299, 1053, -913, -506,
+ -258, 360, -1457, -38,
+ -264, 967, 519, 58,
+ -718, -1676, -1184, 185,
+ 741, -314, 184, 210,
+ -1780, -305, -1299, 167,
+ -1912, -1932, -1292, -970,
+ -1017, -520, -96, -136,
+ -1829, 500, -1244, -625,
+ -1041, -791, -461, 591,
+ 708, -1386, -1078, -956,
+ 339, 636, 509, 408,
+ -131, 106, -1202, -1118,
+ 818, 18, 477, -676,
+ 668, 1176, 422, -36,
+ 1074, -1259, 425, 267,
+ -281, 539, 31, 430,
+ -1196, 756, 338, 236,
+ -568, 1030, 421, -1589,
+};
+
+const Word16 YG_dicHR_2_fx[] =
+{
+ //Q12
+ 146, -73, -67, -101,
+ -11, 330, -176, -609,
+ -283, -31, -381, -191,
+ -208, -81, 142, 234,
+ 141, -376, -66, -646,
+ 568, -38, -429, 160,
+ 166, 831, 89, -103,
+ 280, -881, -296, -82,
+ -117, -4, 340, -956,
+ 286, -136, -679, -410,
+ 141, 181, -197, 511,
+ -685, 648, 246, -365,
+ 625, -670, 591, 190,
+ -7, -296, -454, 235,
+ 840, 126, 652, 1064,
+ -428, -570, -18, -77,
+ -298, -973, 637, 380,
+ -774, -31, -333, -902,
+ -1509, 167, 471, -369,
+ 431, -1437, 124, 610,
+ -917, 511, 518, -1488,
+ -97, 262, -872, 247,
+ 549, -166, 602, -590,
+ 644, -1030, 796, -1279,
+ 525, -37, 212, 197,
+ 141, 345, 195, 211,
+ 91, -71, 674, 223,
+ -1343, -902, -27, 234,
+ -467, -981, -427, 725,
+ 176, -527, 85, 275,
+ -654, -859, 473, -873,
+ 671, -457, -326, 742,
+ 699, 613, -78, 457,
+ -487, 505, 231, 578,
+ -194, 927, -493, 529,
+ 635, 554, -917, 532,
+ -554, -12, -314, 611,
+ 172, 667, 532, -874,
+ 594, 270, -27, -378,
+ 388, -530, -1307, 274,
+ 647, 451, 670, 24,
+ 745, -470, 8, -260,
+ -725, -292, -1018, -32,
+ 95, 184, 330, -280,
+ -761, -135, 552, 250,
+ -415, -3, 197, -307,
+ 142, 702, 584, 755,
+ 450, 595, -1010, -525,
+ -455, -1143, -775, -639,
+ 228, 496, -1676, 399,
+ 82, 242, -532, 1222,
+ 125, -214, 319, 804,
+ -292, 380, -126, 70,
+ 96, -480, 407, -259,
+ -636, -148, 890, 1241,
+ 213, 404, -382, -7,
+ -315, 509, 660, 61,
+ 505, 18, 33, -1385,
+ -568, 716, -623, -338,
+ -440, 38, 972, -455,
+ -1420, 576, -1125, 668,
+ -1391, 481, 229, 593,
+ 335, -1464, 430, -375,
+ -918, 124, -155, 34,
+};
+
+const Word16 YG_dicHR_3_fx[] =
+{
+ //Q12
+ -174, -82, -158, -12,
+ 155, -403, 114, -132,
+ 188, 2, -231, -470,
+ 448, -222, -598, -103,
+ -353, 304, -1173, 420,
+ -43, -77, -533, 386,
+ 526, -57, 360, -247,
+ -837, -219, -344, 42,
+ -236, 88, -664, -226,
+ -1218, 66, 362, -529,
+ -398, 496, -300, 299,
+ 212, 508, -521, 80,
+ -267, -522, 45, 286,
+ -65, -1143, 154, -169,
+ 725, -1483, 883, -1459,
+ 9, -109, 334, -752,
+ -38, 860, -22, -333,
+ -487, 340, 202, -1529,
+ -349, 387, 645, -464,
+ -106, 73, 170, 427,
+ 180, 384, -292, 989,
+ 178, -505, 618, 375,
+ 481, 539, -1777, 1050,
+ 680, -792, 65, 136,
+ -1388, 798, -1090, 670,
+ -377, -507, -139, -580,
+ 301, 614, 194, 392,
+ -218, -1155, 341, 834,
+ 338, -1071, -1177, 673,
+ -406, 188, -92, -546,
+ -58, -656, 773, -540,
+ 461, 649, 840, -108,
+ -775, -352, 620, 233,
+ -390, 666, 601, 438,
+ -394, 1594, -299, 1009,
+ 367, 448, 291, -886,
+ 788, 76, 479, 531,
+ -77, -655, -500, -14,
+ 514, -1745, 497, 217,
+ 904, -963, 630, 1261,
+ 775, 224, -795, 520,
+ 291, -435, -112, 679,
+ 494, 1380, -1018, -186,
+ -75, 86, 731, 1048,
+ 65, 74, 617, 99,
+ 512, -46, 709, -1636,
+ -926, 1237, 1090, -812,
+ 40, 297, 97, -131,
+ 656, 770, 1176, 920,
+ 1313, -582, -1832, -912,
+ 490, -648, -43, -805,
+ -449, -882, -1473, -698,
+ 1028, 421, -151, -289,
+ 1089, 1107, -144, 760,
+ 188, 357, -638, -1027,
+ -337, -210, 300, -194,
+ 319, 223, -1587, -64,
+ 972, 1384, 786, -1026,
+ 928, -468, 1116, -198,
+ -1489, 642, 269, 385,
+ -627, 250, 153, 50,
+ -906, 613, -518, -436,
+ 379, 18, -68, 218,
+ -648, -85, -110, 765,
+};
+
+const Word16 YG_mean16HR_16kHz_fx[] =
+{
+ //Q12
+ 342, 152, 373, 359
+};
+
+const Word16 YG_dicHR_4_16kHz_fx[] =
+{
+ //Q12
+ 137, 109, 215, 21,
+ 328, -26, 537, -270,
+ -137, -851, -385, -703,
+ -537, -81, -244, -23,
+ -174, -425, -175, -351,
+ 861, 1100, 696, 574,
+ -150, -14, -390, -241,
+ -828, 166, 164, -151,
+ -226, 541, 204, -110,
+ 184, 820, -89, 264,
+ -26, 889, 709, 520,
+ 83, -176, -713, -276,
+ -149, -1318, 731, -193,
+ -324, -55, 118, 182,
+ 474, -493, -411, 52,
+ 156, -1459, -370, -71,
+ 513, 451, 973, 283,
+ 903, -296, 309, 121,
+ 1261, 296, 886, 702,
+ 984, -1204, 915, 15,
+ -401, 456, -316, 136,
+ 458, -1779, 335, -788,
+ 471, -796, 239, -331,
+ -390, -2265, 493, -305,
+ 469, -1946, 389, 280,
+ 150, 463, -725, 114,
+ -411, 99, -906, -128,
+ 628, 888, 1299, 1039,
+ 1454, 1377, 1415, 1350,
+ -1, 242, -164, -11,
+ 632, 621, 416, 695,
+ 396, -1030, 356, 492,
+ 48, -279, -98, -30,
+ -568, -212, -376, -571,
+ 275, 570, 382, 152,
+ 443, 75, 521, 418,
+ -1366, -1566, -2460, -2925,
+ -1059, 64, -585, -231,
+ 134, 489, -296, -380,
+ -1453, -890, -1200, -1157,
+ -27, 240, -1694, 47,
+ 464, 86, -204, -79,
+ 746, 462, 234, 57,
+ 1087, -738, 1095, 1050,
+ 922, 619, -412, 409,
+ -261, 35, 124, -313,
+ -794, 842, -992, 314,
+ 280, -465, 1028, 196,
+ 233, -346, 257, 183,
+ -1640, 244, -110, 28,
+ 377, 171, -57, 392,
+ -89, 368, 195, 456,
+ 501, 1327, 119, 980,
+ -64, -84, -417, 262,
+ -414, -558, -638, -102,
+ -1785, 392, -1756, -430,
+ -705, -299, -1189, -730,
+ -477, 347, -400, -367,
+ -93, -825, -20, -13,
+ -710, -540, 45, -265,
+ -151, -487, 380, -243,
+ -269, 32, 702, 143,
+ 206, -145, -27, -474,
+ -694, 777, 287, 357,
+};
+
+const Word16 YG_meanL2G_16kHz_fx[] =
+{
+ //Q12
+ 424, 651,
+};
+
+const Word16 YG_dicL2G_16kHz_fx[] =//Q12
+{
+ -255, 122,
+ 296, 314,
+ -226, -333,
+ 668, 668,
+ 101, -53,
+ -579, -647,
+ -1202, -1244,
+ 1213, 1254,
+};
+
+const Word16 Odx_fft64[64] =
+{
+ 0,59,54,49,44,39,34,29,24,19,14,9,4,63,58,53,48,43,38,33,28,23,18,13,8,3,62,57,52,47,42,37,
+ 32,27,22,17,12,7,2,61,56,51,46,41,36,31,26,21,16,11,6,1,60,55,50,45,40,35,30,25,20,15,10,5
+}; // Q0
+
+const Word16 Ip_fft64[6] = { 32,1,0,64,32,96 }; // Q0
+
+const Word16 Odx_fft32_15[32] = { 0,17,2,19,4,21,6,23,8,25,10,27,12,29,14,31,16,1,18,3,20,5,22,7,24,9,26,11,28,13,30,15 }; // Q0
+
+const Word32 w_fft32_16fx[16] =//Q30
+{
+ 1073741824, 0, 759250113, 759250113, 992008059, 410903236, 410903236, 992008059,
+ 1053110143, 209476636, 596539003, 892783685, 892783685, 596539003, 209476636, 1053110143
+};
+const Word16 Ip_fft32[6] = { 16,1,0,32,16,48 }; // Q0
+
+const Word16 Odx_fft32_5[32] = { 0,27,22,17,12,7,2,29,24,19,14,9,4,31,26,21,16,11,6,1,28,23,18,13,8,3,30,25,20,15,10,5 }; // Q0
+
+const Word16 Odx_fft16[16] = {0,11,6,1,12,7,2,13,8,3,14,9,4,15,10,5}; // Q0
+
+const Word16 Ip_fft16[6] = {8,1,0,16,8,24}; // Q0
+
+const Word16 Ip_fft8[6] = {4,1,0,8,4,12}; // Q0
+
+const Word16 Idx_dortft80[80] =
+{
+ 0,65,50,35,20,5,70,55,40,25,10,75,60,45,30,15,16,1,66,51,36,21,6,71,56,41,26,11,76,61,
+ 46,31,32,17,2,67,52,37,22,7,72,57,42,27,12,77,62,47,48,33,18,3,68,53,38,23,8,73,58,43,
+ 28,13,78,63,64,49,34,19,4,69,54,39,24,9,74,59,44,29,14,79
+}; // Q0
+
+const Word16 Idx_dortft120[120] =
+{
+ 0,105,90,75,60,45,30,15,16,1,106,91,76,61,46,31,32,17,2,107,92,77,62,47,
+ 48,33,18,3,108,93,78,63,64,49,34,19,4,109,94,79,80,65,50,35,20,5,110,95,
+ 96,81,66,51,36,21,6,111,112,97,82,67,52,37,22,7,8,113,98,83,68,53,38,23,
+ 24,9,114,99,84,69,54,39,40,25,10,115,100,85,70,55,56,41,26,11,116,101,86,
+ 71,72,57,42,27,12,117,102,87,88,73,58,43,28,13,118,103,104,89,74,59,44,29,14,119
+}; // Q0
+
+const Word16 Idx_dortft160[160] =
+{
+ 0,65,130,35,100,5,70,135,40,105,10,75,140,45,110,15,80,145,
+ 50,115,20,85,150,55,120,25,90,155,60,125,30,95,96,1,66,131,
+ 36,101,6,71,136,41,106,11,76,141,46,111,16,81,146,51,116,21,
+ 86,151,56,121,26,91,156,61,126,31,32,97,2,67,132,37,102,7,
+ 72,137,42,107,12,77,142,47,112,17,82,147,52,117,22,87,152,57,
+ 122,27,92,157,62,127,128,33,98,3,68,133,38,103,8,73,138,43,
+ 108,13,78,143,48,113,18,83,148,53,118,23,88,153,58,123,28,93,
+ 158,63,64,129,34,99,4,69,134,39,104,9,74,139,44,109,14,79,
+ 144,49,114,19,84,149,54,119,24,89,154,59,124,29,94,159
+}; // Q0
+
+const Word16 Idx_dortft320[320] =
+{
+ 0,65,130,195,260,5,70,135,200,265,10,75,140,205,270,15,80,145,210,275,20,85,150,215,280,25,90,155,220,285,30,95,
+ 160,225,290,35,100,165,230,295,40,105,170,235,300,45,110,175,240,305,50,115,180,245,310,55,120,185,250,315,60,125,
+ 190,255,256,1,66,131,196,261,6,71,136,201,266,11,76,141,206,271,16,81,146,211,276,21,86,151,216,281,26,91,156,221,
+ 286,31,96,161,226,291,36,101,166,231,296,41,106,171,236,301,46,111,176,241,306,51,116,181,246,311,56,121,186,251,
+ 316,61,126,191,192,257,2,67,132,197,262,7,72,137,202,267,12,77,142,207,272,17,82,147,212,277,22,87,152,217,282,27,
+ 92,157,222,287,32,97,162,227,292,37,102,167,232,297,42,107,172,237,302,47,112,177,242,307,52,117,182,247,312,57,122,
+ 187,252,317,62,127,128,193,258,3,68,133,198,263,8,73,138,203,268,13,78,143,208,273,18,83,148,213,278,23,88,153,218,
+ 283,28,93,158,223,288,33,98,163,228,293,38,103,168,233,298,43,108,173,238,303,48,113,178,243,308,53,118,183,248,313,
+ 58,123,188,253,318,63,64,129,194,259,4,69,134,199,264,9,74,139,204,269,14,79,144,209,274,19,84,149,214,279,24,89,154,
+ 219,284,29,94,159,224,289,34,99,164,229,294,39,104,169,234,299,44,109,174,239,304,49,114,179,244,309,54,119,184,249,
+ 314,59,124,189,254,319
+}; // Q0
+
+const Word16 Idx_dortft480[480] =
+{
+ 0,225,450,195,420,165,390,135,360,105,330,75,300,45,270,15,240,465,210,435,180,405,150,375,120,345,
+ 90,315,60,285,30,255,256,1,226,451,196,421,166,391,136,361,106,331,76,301,46,271,16,241,466,211,436,
+ 181,406,151,376,121,346,91,316,61,286,31,32,257,2,227,452,197,422,167,392,137,362,107,332,77,302,47,
+ 272,17,242,467,212,437,182,407,152,377,122,347,92,317,62,287,288,33,258,3,228,453,198,423,168,393,138,
+ 363,108,333,78,303,48,273,18,243,468,213,438,183,408,153,378,123,348,93,318,63,64,289,34,259,4,229,454,
+ 199,424,169,394,139,364,109,334,79,304,49,274,19,244,469,214,439,184,409,154,379,124,349,94,319,320,
+ 65,290,35,260,5,230,455,200,425,170,395,140,365,110,335,80,305,50,275,20,245,470,215,440,185,410,155,
+ 380,125,350,95,96,321,66,291,36,261,6,231,456,201,426,171,396,141,366,111,336,81,306,51,276,21,246,471,
+ 216,441,186,411,156,381,126,351,352,97,322,67,292,37,262,7,232,457,202,427,172,397,142,367,112,337,82,
+ 307,52,277,22,247,472,217,442,187,412,157,382,127,128,353,98,323,68,293,38,263,8,233,458,203,428,173,
+ 398,143,368,113,338,83,308,53,278,23,248,473,218,443,188,413,158,383,384,129,354,99,324,69,294,39,264,
+ 9,234,459,204,429,174,399,144,369,114,339,84,309,54,279,24,249,474,219,444,189,414,159,160,385,130,355,
+ 100,325,70,295,40,265,10,235,460,205,430,175,400,145,370,115,340,85,310,55,280,25,250,475,220,445,190,
+ 415,416,161,386,131,356,101,326,71,296,41,266,11,236,461,206,431,176,401,146,371,116,341,86,311,56,281,
+ 26,251,476,221,446,191,192,417,162,387,132,357,102,327,72,297,42,267,12,237,462,207,432,177,402,147,372,
+ 117,342,87,312,57,282,27,252,477,222,447,448,193,418,163,388,133,358,103,328,73,298,43,268,13,238,463,
+ 208,433,178,403,148,373,118,343,88,313,58,283,28,253,478,223,224,449,194,419,164,389,134,359,104,329,74,
+ 299,44,269,14,239,464,209,434,179,404,149,374,119,344,89,314,59,284,29,254,479
+}; // Q0
+
+const Word16 Ip_fft128[10] = { 64, 1, 0, 128, 64, 192, 32, 160, 96, 224 }; // Q0
+
+const Word32 w_fft128_16fx[64] =
+{
+ 1073741824, 0, 759250112, 759250112, 992008064, 410903232, 410903232, 992008064,
+ 1053110144, 209476640, 596539008, 892783680, 892783680, 596539008, 209476640, 1053110144,
+ 1068571456, 105245104, 681174592, 830013632, 946955712, 506158400, 311690816, 1027506880,
+ 1027506880, 311690816, 506158400, 946955712, 830013632, 681174592, 105245104, 1068571456,
+ 1072448448, 52686008, 721080960, 795590208, 970651136, 459083776, 361732736, 1010975232,
+ 1041563136, 260897968, 552013632, 920979072, 862437504, 639627264, 157550640, 1062120192,
+ 1062120192, 157550640, 639627264, 862437504, 920979072, 552013632, 260897968, 1041563136,
+ 1010975232, 361732736, 459083776, 970651136, 795590208, 721080960, 52686008, 1072448448,
+}; // Q30
+
+const Word16 Ip_fft256[10] = {128, 1, 0, 256, 128, 384, 64, 320,192, 448}; // Q0
+
+const Word16 Ip_fft512[18] = {256, 1, 0, 512, 256, 768, 128, 640,384, 896, 64, 576, 320, 832, 192, 704,448, 960}; // Q0
+
+const Word16 w_fft512_fx_evs[256] =//Q14
+{
+ 16384, 0, 11585, 11585, 15137, 6270, 6270, 15137,
+ 16069, 3196, 9102, 13623, 13623, 9102, 3196, 16069,
+ 16305, 1606, 10394, 12665, 14449, 7723, 4756, 15679,
+ 15679, 4756, 7723, 14449, 12665, 10394, 1606, 16305,
+ 16364, 804, 11003, 12140, 14811, 7005, 5520, 15426,
+ 15893, 3981, 8423, 14053, 13160, 9760, 2404, 16207,
+ 16207, 2404, 9760, 13160, 14053, 8423, 3981, 15893,
+ 15426, 5520, 7005, 14811, 12140, 11003, 804, 16364,
+ 16379, 402, 11297, 11866, 14978, 6639, 5897, 15286,
+ 15986, 3590, 8765, 13842, 13395, 9434, 2801, 16143,
+ 16261, 2006, 10080, 12916, 14256, 8076, 4370, 15791,
+ 15557, 5139, 7366, 14635, 12406, 10702, 1205, 16340,
+ 16340, 1205, 10702, 12406, 14635, 7366, 5139, 15557,
+ 15791, 4370, 8076, 14256, 12916, 10080, 2006, 16261,
+ 16143, 2801, 9434, 13395, 13842, 8765, 3590, 15986,
+ 15286, 5897, 6639, 14978, 11866, 11297, 402, 16379,
+ 16383, 201, 11442, 11727, 15059, 6455, 6084, 15213,
+ 16029, 3393, 8935, 13733, 13510, 9269, 2999, 16107,
+ 16284, 1806, 10238, 12792, 14354, 7900, 4563, 15736,
+ 15619, 4948, 7545, 14543, 12537, 10549, 1406, 16324,
+ 16353, 1005, 10853, 12274, 14724, 7186, 5330, 15493,
+ 15843, 4176, 8250, 14155, 13039, 9921, 2205, 16235,
+ 16176, 2603, 9598, 13279, 13949, 8595, 3786, 15941,
+ 15357, 5708, 6823, 14896, 12004, 11151, 603, 16373,
+ 16373, 603, 11151, 12004, 14896, 6823, 5708, 15357,
+ 15941, 3786, 8595, 13949, 13279, 9598, 2603, 16176,
+ 16235, 2205, 9921, 13039, 14155, 8250, 4176, 15843,
+ 15493, 5330, 7186, 14724, 12274, 10853, 1005, 16353,
+ 16324, 1406, 10549, 12537, 14543, 7545, 4948, 15619,
+ 15736, 4563, 7900, 14354, 12792, 10238, 1806, 16284,
+ 16107, 2999, 9269, 13510, 13733, 8935, 3393, 16029,
+ 15213, 6084, 6455, 15059, 11727, 11442, 201, 16383
+};
+const Word16 Idx_dortft40[40] =
+{
+ 0, 25, 10, 35, 20, 5, 30, 15, 16, 1, 26, 11, 36, 21, 6, 31, 32, 17, 2, 27,
+ 12, 37, 22, 7, 8, 33, 18, 3, 28, 13, 38, 23, 24, 9, 34, 19, 4, 29, 14, 39
+}; // Q0
+
+const Word16 Odx_fft8_5[8] = {0, 3, 6, 1, 4, 7, 2, 5}; // Q0
+const Word16 Idx_dortft20[20] = {0, 5, 10, 15, 16, 1, 6, 11, 12, 17, 2, 7, 8, 13, 18, 3, 4, 9, 14, 19}; // Q0
+const Word16 Odx_fft4_5[4] = {0, 3, 2, 1}; // Q0
+const Word16 Ip_fft4[6] = {2,1,0,4,2,6}; // Q0
+const Word16 ip_edct2_64[6] = {16, 64, 0, 32, 16, 48}; // Q0
+
+const Word16 w_edct2_64_fx[80] = /*Q14 */
+{
+ 16384, 0, 11585, 11585, 15137, 6270, 6270, 15137,
+ 16069, 3196, 9102, 13623, 13623, 9102, 3196, 16069,
+ 11585, 8190, 8182, 8170, 8153, 8130, 8103, 8071,
+ 8035, 7993, 7946, 7895, 7839, 7779, 7713, 7643,
+ 7568, 7489, 7405, 7317, 7225, 7128, 7027, 6921,
+ 6811, 6698, 6580, 6458, 6333, 6203, 6070, 5933,
+ 5793, 5649, 5501, 5351, 5197, 5040, 4880, 4717,
+ 4551, 4383, 4212, 4038, 3862, 3683, 3503, 3320,
+ 3135, 2948, 2760, 2570, 2378, 2185, 1990, 1795,
+ 1598, 1401, 1202, 1003, 803, 603, 402, 201
+};
+
+/* HVQ */
+const Word16 hvq_thr_adj_fx[5] = { 23170, 16384, 8192, 16384, 23170 }; /* Q15 */
+
+const Word16 hvq_index_mapping_fx[4] = { 0, 1, 3, 4 };
+
+const Word16 hvq_class_c_fx[16] = /* Q15 */
+{
+ -7617, -14387, 2136, 6914,
+ 4821, -4428, 14131, -4538,
+ -4538, 14131, -4428, 4821,
+ 6914, 2136, -14387, -7617
+};
+
+const Word16 hvq_cb_search_overlap24k[17] =
+{
+ 0, 8, 17, 27,
+ 39, 53, 69, 89,
+ 113, 128, 128, 128,
+ 128, 128, 128, 128,
+ 128
+}; // Q0
+
+const Word16 hvq_cb_search_overlap32k[21] =
+{
+ 0, 6, 13, 21,
+ 30, 40, 51, 64,
+ 78, 96, 116, 128,
+ 128, 128, 128, 128,
+ 128, 128, 128, 128,
+ 128
+}; // Q0
+
+const Word16 hvq_peak_cb_fx[1024] = /* Q15 */
+{
+ -22652,-20549,-23019, 13968,-25496,-27493, -6957, 5753,-19678,-20274,
+ -6119, 18297, -5329,-22843,-21254, 13929,-27525,-29034, 563, 7265,
+ -26138,-13138, -9678, 7972, -517,-20830,-10703, 26832,-27818,-21449,
+ 208, 6297,-14803,-28396, -7655, 5118, 15134,-24005,-21776, 25330,
+ -11282,-23669,-20340, -2006,-16212,-24127, 9075, 22581,-20047,-25695,
+ -254, 6509,-17174,-29714, 1589, 7104,-17683, -4117, -4049, 22347,
+ -28338,-13898, 671, 6777,-18368,-17925, -7409, 5169,-22093,-19561,
+ 702, 5969, -6610,-27398, -4875, 8773,-29634, -5552, 272, 6992,
+ -9167,-19887, -9136, 6447,-23125,-25612, 9760, 5749,-10410,-29816,
+ 1606, 7019,-13758,-24849, 2084, 7129,-17795,-16160, 596, 7287,
+ -22276,-11145, 521, 6474,-13471,-20705, -74, 6740, 1891,-16245,
+ -12763, 13602, -1617,-27384, -9648, 2511,-21802,-11734, -4836, -1602,
+ -9670,-27913, 6456, 6338,-23227, -4603, 754, 5830, -7699,-24416,
+ 2204, 6518,-27591, 2763, 1885, 6839,-15248,-10500, 344, 6942,
+ -13247, -9761, -4486, 4294,-12097,-15164, 637, 6142,-25994,-16384,
+ 17277, 6511,-10346,-26179, 923, -2374,-13316,-18125, 6841, 7100,
+ -21083,-24251, 4207, -9464,-22914, -7057, 8647, 8026, 2488,-20731,
+ -799, 13754, -3451,-12872, 2545, 17315, 2576,-19594,-10340, 4361,
+ -7007,-19401, 1937, 6751, 17502,-24923,-16948, 8534, -3436,-29004,
+ 6315, 6467,-16936, -4957, 591, 6604, 1099,-26790, -708, 5543,
+ -5949,-14167, -4750, 4068,-10682,-14990, -7489, -5197, 169, -6472,
+ -5143, 16200,-20331, 1722, 395, 6233,-15661,-22913, 24689, 14221,
+ -3892,-22862, 5154, 6301, -8786,-10120, 216, 6831,-12390,-11062,
+ 4824, 6473, -7705, -4195, -5326, 6572, -560,-20773, -2777, 1822,
+ -6703,-14413, 2409, 6083,-10595,-25038, 14291, 4825, 2064,-25736,
+ 16863, 20463, -2752,-29103, 12609, 7539, -7638,-18024, 1948, 689,
+ -10961, -5839, 683, 6170,-26004, 12209, 10742, 15580, -2105, -8625,
+ -4932, 6977, -9940,-15129, 12160, 9806,-13921, -55, 440, 6315,
+ -305, -6080, 11303, 25730,-12423, -3161, 6875, 9836, -2780,-16434,
+ 4128, 5778, 17790,-10991, -6633, 21111, 12367,-26550,-10581, -2530,
+ -6713,-10210, 4804, 6280, -5932, 2832, 4978, 18330, 2696,-23822,
+ -11870,-13313, 5266,-10870, -7933, 4455, -3155,-10994, 2225, 5803,
+ 820,-11966, -1397, 5344, -5027, -7230, 1236, 5812, -1649,-21007,
+ 8948, 5539,-16246, -801, -533, -3132, -8272, -1302, 367, 5958,
+ -26574, -3470, 7126, -8876, -4819, -5380, -3923, 1466, 1929,-20655,
+ 4419, 3663, 2437,-26758, 10897, 5616, -6601,-10394, 2148, 137,
+ 15007,-22909, -3948, 6197, -9059,-27702, 23041, 4088, 8312, -267,
+ 2973, 25579, -3795, -3612, -489, 5401, 7711,-25887, 3443, 2623,
+ -24306, 3091, 13248, 3273, -3113, -1410, 3541, 12047, 306,-11933,
+ -4493, -1997,-18725, 8257, 7593, 7218,-13588, -8411, 8715, -1137,
+ -12028, 5907, 17904, 21327, -2223,-22989, 9863, -1633, -723, -5944,
+ 714, 5170, 2128,-15199, 2081, 1626, -482, -8521, 8131, 10765,
+ 53,-12020, 5152, 5033, 2361,-13747, 24714, 26357, 1074,-28538,
+ 18087, 4333, 1067,-22148, 14277, 5540, 729,-15049, 7936, 4648,
+ -16646, -6350, 23646, 9628, -91, -8477, 3298, 4297, 3499, -7417,
+ -2214, 2931, -4795, -4424, 6487, 4264, -9333, 3377, 6570, 5734,
+ 1733,-17598, 11163, 4167, -2713,-16183, 14693, 4188,-23780, 9825,
+ 25701, 15331, 586,-19288, 21576, 12040, 11328,-15656, 2944, 7335,
+ 9203,-16906, -5723, -5371, -7906, -4632, 12470, 5724, -123,-16520,
+ 976, -8288, 1262, -3966, -3014, -148, 230, -2169, 505, 3954,
+ -2256,-11474, 9990, 2644, 4841, -8017, -4617, -2959, 24226,-22733,
+ 7475, 17722, 6747, -5782, 4877, 8664, -6893,-24218, 12181,-14683,
+ 2839, -7574, 4815, 2376, 2680, -3986, 1749, 2061, -563, 3232,
+ 3039, 5761, 343, -4150, 6600, 3792, 6356, 7199, 10702, 24266,
+ -25636,-12157, 22874,-14633, 2438, -8680, 8312, 3091, 7135, -3110,
+ 268, 4547, 4272, 4886, 5861, 14177, 11382,-10386, -767, 1448,
+ 1770,-28758, 27658, 4643, -3008,-10314, 18024, 5252, 6999,-17854,
+ 9789, 909, 1556,-21532, 20929, 3182, 26836,-23774, -2868, 3509,
+ -9884,-14471, 24685, 193, -3300, -5891, 5237, -5722, -9043,-14338,
+ 17448, -7167, -683, 26, 4002, -235, 3072,-12689, 13537, 2670,
+ 3577,-10477, 10097, 1435, 17713,-24555, 7486, 1713, 6633, -6645,
+ 1863, -783, 3185, -8349, 3975, -3967, 8090,-23915, 7470, -8732,
+ 2793,-16733, 17412, 1948, -5975,-14195, 1741,-22095, 3376, -782,
+ 18258, 16642, 3845, -3536, 5136, 335, 3267, -719, 10538, 7756,
+ -10993, 5165, 17885, 4767, 4733, -7751, 15643, 8215, 3678, 1686,
+ 3571, 2189,-11186, 1470, 6152,-11489, 4353, -2197, 1357, -3164,
+ 4258, -6029, 8420, -230, 6220, -1478, 2105, -787, -4229, -4632,
+ 15095, -1672, 1986,-16134, 14035, -6088, 7849,-14512, 2875,-10127,
+ 4796,-14269, -8761,-25428, 1192,-24490, 22001, -6216, 258,-10418,
+ 27459, 10524, -754, 7182, 7574, 3444, 5995, 3253, 25190, 25483,
+ 6379, -6363, 409, -8435, -3319, 3253, 12035, 1358, 3184, -6482,
+ 12864, -216, 25363, -7652, -2971, 5718, 4969, -3415, 7040, -2605,
+ 2616,-21129, 28211, 1289, 2553,-15075, 23833, 1871, 14598, -6793,
+ 7189, 4535, 5581, -1997, 4257, -4337, 6027,-10630, 9913, -5633,
+ 3695,-11614, 19091, 585, 4415, -8798, 15569, -1099, -879, 752,
+ 19480, 5412, 5743, 448, 9863, 1342, 20634,-16941, -7404,-16938,
+ -11946, 17852, 19422, 5918, 12538,-20829, 22707, 1113, 4715, -4341,
+ 12573, -3709, 4015, -8219, 3349,-17549, 6395, -1551, 4414, -8302,
+ 24598,-24474, 21909, 9778, 5346, 1386, 6942, -4708, -1507, 2077,
+ 8224,-10420, 6088, -3411, 8824, -6355, 7219, 17353, 22325, 25889,
+ 6666, -1811, 1964,-13461, 8123, -4454, 26614, 11418, 4582, -7133,
+ 18420, -3918, -264, 10545, 24810, 12821, 6936,-22880, 10241,-24118,
+ 3108, -7220, 11991,-12963, 4237,-10392, 23417, -2591, 4624,-14780,
+ 29121, -1235, 7543, -1157, 17358, 1244, 20161, -6319, 2575, -5204,
+ 4384, 5974, 10993, -2909, 1619, -4017, 26017, 722, 4659, 11545,
+ 14463, 4774, -2892, 10593, 15058, -4543, 1972,-15782, 26652,-10199,
+ 6046, -562, 11992, -8022, 6197, -349, 7928,-12070, 21399,-13670,
+ 15116, 99, 5829, -4061, 16713, -7200, -8904, 4170, 24814, -7599,
+ 12177, 6080, 19388, 11094, 4262, 1544, 17090, -4775, -6957, -5908,
+ 19576,-23176, 7126,-23499, 24889,-17683, 5514, -5416, 23284, -5830,
+ 6388, -1788, 14378,-11597, 5099, -8771, 28791, -4573, 6029, -4164,
+ 3217,-26929, 6427, 145, 9306,-17874, 5544, 3835, 25432, -15,
+ 8297,-10673, 21003,-15084, 6019, -7628, 13891,-22535, 27144, 1685,
+ 10077, 4230, 5211, -1543, 22179,-10638, 6385, 5710, 13476,-12976,
+ 5272, 17571, 23747, 5084, -2100, 9127, 13746,-20852,-16310, 15716,
+ 21422,-23074, 6532, -31, 17127,-16620, 5397, -3362, 28477, -9453,
+ 6238, 1258, 13189,-22475, 12895, -4568, 8062,-26648, 2873, 5975,
+ 22151,-15208, 6319, -507, 23117,-17415, 24129,-14207, 12908,-21101,
+ 7262, 8470, 25405, -9450, 5424, -1162, 29494,-16114, 21373, 22875,
+ 24554, 16783, 6684, 2453, 15785,-28885, 6504, 1085, 21619,-24241,
+ 21468, 620, 23222, -7235, 10917, 8863, 18570,-21606, 6710, -2091,
+ 28961,-25837, 6884, 20869, 27603, -8999, 6798, 5617, 28706,-21501,
+ 6066, 4720, 25084,-28951
+};
+
+const Word16 hvq_pg_huff_offset[NUM_PG_HUFFLEN] = {0,2,3,8,9,11,13,15,19}; // Q0
+const Word16 hvq_pg_huff_thres[NUM_PG_HUFFLEN] = {0,0x2,0x4,0x18,0x20,0x40,0x80,0x100,0x300}; // Q0
+
+const Word16 hvq_pg_huff_tab[32] =
+{
+ 30, 31, 1, 0, 2, 3, 28, 29, 4, 5, 27, 25, 26, 6, 24, 7, 8, 22, 23, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21
+}; // Q0
+
+const Word16 hvq_cp_huff_len[52] =
+{
+ 3, 4, 5, 6, 6, 6, 6, 6, 4, 4, 5, 5, 5, 5, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 8,
+ 8, 8, 8, 8, 9, 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 12, 12, 13, 13, 12, 12, 11, 12
+}; // Q0
+
+const Word16 hvq_cp_huff_val[52] =
+{
+ 7, 8, 6, 3, 4, 5, 6, 7, 9, 10, 7, 8, 9, 10, 11, 12, 13, 11, 12, 13, 14, 15, 8, 9, 10,
+ 11, 4, 5, 3, 4, 5, 6, 7, 5, 4, 5, 3, 4, 5, 6, 7, 8, 9, 6, 1, 2, 0, 1, 3, 4, 7, 5
+}; // Q0
+
+const Word16 hvq_cp_layer1_map5[HVQ_CP_MAP_LEN] = { 16, 8, 4, 2, 1, 18, 17, 9 }; // Q0
+
+const Word16 hvq_cp_huff_thres[HVQ_CP_HUFF_NUM_LEN] = { 0x0, 0x2, 0xC, 0x20, 0x50, 0x60, 0x100, 0x180, 0x600, 0x1000, 0x1C00 }; // Q0
+const Word16 hvq_cp_huff_offset[HVQ_CP_HUFF_NUM_LEN] = { 0, 2, 7, 12, 18, 19, 24, 26, 35, 45, 51 }; // Q0
+
+const Word16 hvq_cp_huff_tab[52] =
+{
+ 46, 47, 44, 45, 48, 49, 51, 36, 37, 38, 43, 50, 34, 35, 39, 40, 41, 42, 33, 28, 29, 30, 31, 32, 26, 27,
+ 3, 4, 5, 6, 7, 22, 23, 24, 25, 2, 10, 11, 12, 13, 17, 18, 19, 20, 21, 1, 8, 9, 14, 15, 16, 0
+}; // Q0
+
+/*----------------------------------------------------------------------------------*
+ * FEC for HQ core
+ *----------------------------------------------------------------------------------*/
+
+const Word16 Num_bands_NB[MAX_SB_NB] = {8,8,2}; // Q0
+
+const Word16 SmoothingWin_NB875_fx[70] = /*Q15*/
+{
+ 0, 16, 66, 148, 263, 411, 590, 802, 1045, 1318,
+ 1623, 1956, 2319, 2710, 3129, 3574, 4046, 4542, 5062, 5604,
+ 6169, 6754, 7358, 7981, 8620, 9275, 9945, 10627, 11321, 12025,
+ 12738, 13459, 14185, 14915, 15649, 16384, 17119, 17853, 18583, 19309,
+ 20030, 20743, 21447, 22141, 22823, 23493, 24148, 24787, 25410, 26014,
+ 26599, 27164, 27706, 28226, 28722, 29194, 29639, 30058, 30449, 30812,
+ 31145, 31450, 31723, 31966, 32178, 32357, 32505, 32620, 32702, 32752
+};
+
+const Word16 SmoothingWin_NB2_fx[16] =
+{/* Q15 */
+ 0, 315, 1247, 2761, 4799, 7282, 10114, 13188, 16384, 19580, 22654, 25486, 27969, 30007, 31521, 32453
+};
+/*----------------------------------------------------------------------------------*
+ * SC-VBR
+ *----------------------------------------------------------------------------------*/
+
+const Word16 bp1_num_coef_wb_fx[5] = { 15286, 0, -30572, 0, 15286, }; /* Q14 */
+const Word16 bp1_den_coef_wb_fx[5] = { 16384, 0, -30498, 0, 14262, }; /* Q14 */
+
+const Word16 shape1_num_coef_fx[11] = /* Q15 */
+{
+ 31437, -2443, -13636, 4316,
+ -10188, 48, 2639, -3575,
+ -776, 1046, 399
+};
+
+const Word16 shape1_den_coef_fx[11] = { 32767, /* Q15 */
+ 2940, -12237, 4032, -9609,
+ -1998, 2335, -3900, -1595,
+ 857, 253
+};
+
+const Word16 shape2_num_coef_fx[11] = /* Q15 */
+{
+ 30760, 31, -9699, 9516,
+ -5878, -7249, -10468, 442,
+ 3278, -63, 1115
+};
+
+const Word16 shape2_den_coef_fx[11] = { 32767, /* Q15 */
+ 16019, -890, 12799, 2346,
+ -6985, -13192, -5795, -949,
+ -1492, -304
+};
+
+const Word16 shape3_num_coef_fx[11] = /* Q15 */
+{
+ 30685, -383, -9937, -9605,
+ -5997, 7611, -10393, -355,
+ 3239, 12, 1196
+};
+
+const Word16 shape3_den_coef_fx[11] = { 32767, /* Q15 */
+ -16498, -911, -12947, 2286,
+ 7430, -13385, 6066, -1182,
+ 1580, -273
+};
+
+const Word16 txlpf1_num_coef_fx[11] = /* Q13 */
+{
+ 138, 198, 514, 681, 921,
+ 964, 921, 681, 514, 198,
+ 138,
+};
+
+
+const Word16 txlpf1_den_coef_fx[11] = /* Q13 */
+{
+ 8192,-18945, 31613,-31149, 24494,
+ -12753, 5528, -1436, 347, -25,
+ 4,
+};
+
+
+const Word16 txhpf1_num_coef_fx[11] = /* Q13 */
+{
+ 138, -198, 514, -681, 921,
+ -964, 921, -681, 514, -198,
+ 138,
+};
+
+const Word16 txhpf1_den_coef_fx[11] = /* Q13 */
+{
+ 8192, 18945, 31613, 31149, 24494,
+ 12753, 5528, 1436, 347, 25,
+ 4,
+};
+
+/* NELP filter coefficients */
+const Word16 bp1_num_coef_nb_fx_order7[8] =
+{
+ /* Q = BP1_COEF_NB_QF_ORDER7 = 13 */
+ 1481, 6730, 15579, 22923, 22923, 15579, 6730, 1481,
+
+};
+
+const Word16 bp1_den_coef_nb_fx_order7[8] =
+{
+ /* Q = BP1_COEF_NB_QF_ORDER7 = 13 */
+ 8192, 16156, 23814, 21855, 14620, 6614, 1907, 268,
+};
+
+/* NELP gain tables */
+const Word16 UVG1CB_WB_FX[UVG1_CBSIZE][2] = /* Q13 */
+{
+ { -2224, -2114, },
+ { 12666, 12314, },
+ { 3723, 9690, },
+ { 17880, 17978, },
+ { 4136, 3946, },
+ { 11605, 21280, },
+ { 9777, 9340, },
+ { 21701, 21627, },
+ { 1088, 1679, },
+ { 13993, 13697, },
+ { 10443, 5214, },
+ { 19702, 19692, },
+ { 5458, 5317, },
+ { 17051, 16918, },
+ { 14206, 8503, },
+ { 24330, 24271, },
+ { -118, -279, },
+ { 11615, 14863, },
+ { 6898, 6544, },
+ { 18913, 18637, },
+ { 1142, 6811, },
+ { 15995, 16070, },
+ { 6921, 13182, },
+ { 22857, 22741, },
+ { 3017, 2260, },
+ { 14952, 14992, },
+ { 8176, 8093, },
+ { 20721, 20549, },
+ { 7441, 2370, },
+ { 17897, 13988, },
+ { 10986, 10966, },
+ { 26098, 25992, },
+};
+
+const Word16 UVG1CB_NB_FX[UVG1_CBSIZE][2] = /* Q13 */
+{
+ { -4791, -5157, },
+ { 4824, 4937, },
+ { -3443, 3610, },
+ { 5539, 15293, },
+ { -469, -3986, },
+ { 7977, 8157, },
+ { 2748, 2492, },
+ { 14070, 14014, },
+ { -2486, -2863, },
+ { 6033, 5892, },
+ { 2678, -441, },
+ { 11741, 11804, },
+ { -256, -847, },
+ { 9153, 8922, },
+ { -106, 5979, },
+ { 16876, 16741, },
+ { -3584, -3873, },
+ { 3511, 9538, },
+ { 401, 416, },
+ { 11082, 10550, },
+ { -1418, -1725, },
+ { 8988, 5255, },
+ { 6275, 1137, },
+ { 15372, 15247, },
+ { -3899, 301, },
+ { 6976, 7095, },
+ { 1581, 1453, },
+ { 12988, 12824, },
+ { 2692, -3093, },
+ { 9778, 10153, },
+ { 3938, 3628, },
+ { 18823, 18695, },
+};
+
+const Word16 UVG2CB1_WB_FX[UVG2_CBSIZE][5] = /* Q12 */
+{
+ { 914, 990, 1490, 5954, 2618, },
+ { 5599, 4621, 4078, 3493, 3057, },
+ { 4930, 4031, 2999, 2150, 1706, },
+ { 7722, 3021, 1804, 1478, 1452, },
+ { 1171, 1390, 6895, 2592, 1486, },
+ { 4155, 4287, 4409, 4515, 4577, },
+ { 3633, 3661, 3694, 3711, 3736, },
+ { 13212, 5009, 2611, 2175, 2048, },
+ { 3716, 2887, 2253, 1965, 1723, },
+ { 7141, 4567, 3434, 2970, 2396, },
+ { 2856, 3038, 3259, 3481, 3709, },
+ { 5929, 5459, 4923, 4448, 4084, },
+ { 980, 1024, 1550, 5686, 8038, },
+ { 3516, 7354, 10392, 3619, 2856, },
+ { 2598, 3093, 3582, 4780, 5965, },
+ { 1962, 10993, 5020, 2861, 2587, },
+ { 796, 916, 1010, 1175, 7720, },
+ { 4445, 4406, 4344, 4249, 4175, },
+ { 1454, 6493, 2611, 1758, 1765, },
+ { 6296, 7686, 4763, 2945, 2203, },
+ { 1502, 1573, 1895, 2981, 5464, },
+ { 4750, 4829, 4909, 4929, 4895, },
+ { 3644, 3774, 3922, 4037, 4116, },
+ { 9051, 7403, 6003, 4746, 4081, },
+ { 1558, 1869, 2331, 3000, 3595, },
+ { 4671, 4646, 4614, 4553, 4482, },
+ { 2262, 2608, 3158, 3890, 4468, },
+ { 5556, 5441, 6824, 7146, 5724, },
+ { 1470, 1550, 2016, 11169, 3828, },
+ { 5488, 6270, 6771, 8202, 9281, },
+ { 3477, 3693, 4113, 4460, 4705, },
+ { 10877, 17984, 10194, 7291, 2824, },
+ { 1327, 1498, 1476, 1667, 2138, },
+ { 4463, 4299, 4094, 3880, 3731, },
+ { 3188, 3164, 3156, 3104, 3140, },
+ { 9757, 5690, 3366, 2296, 1792, },
+ { 1731, 1753, 12406, 4082, 2247, },
+ { 3866, 4060, 5007, 5274, 5225, },
+ { 3998, 3957, 3900, 3839, 3789, },
+ { 18040, 9417, 5567, 3465, 2504, },
+ { 2160, 2532, 2895, 2577, 2321, },
+ { 5052, 4789, 4490, 4203, 3953, },
+ { 3381, 3415, 3458, 3496, 3536, },
+ { 6166, 5811, 5440, 5035, 4650, },
+ { 2839, 3389, 5057, 7558, 10414, },
+ { 3875, 4431, 5183, 6310, 7166, },
+ { 4311, 4130, 3571, 3070, 8555, },
+ { 8791, 8260, 7299, 6243, 5421, },
+ { 1191, 1237, 1368, 1814, 11819, },
+ { 2486, 5729, 6150, 4222, 3667, },
+ { 4018, 3825, 3600, 3388, 3256, },
+ { 7504, 5817, 4989, 4065, 3322, },
+ { 1430, 1962, 5546, 4096, 4681, },
+ { 5393, 5378, 5324, 5230, 5052, },
+ { 4041, 4090, 4132, 4159, 4181, },
+ { 12469, 9221, 5735, 3617, 2501, },
+ { 2482, 2565, 2768, 3088, 3461, },
+ { 5209, 5080, 4905, 4706, 4522, },
+ { 3139, 3362, 3647, 3910, 4156, },
+ { 7139, 6588, 5941, 5251, 4674, },
+ { 1719, 1866, 7993, 7634, 3987, },
+ { 3587, 5289, 7882, 13519, 16095, },
+ { 2409, 2515, 2749, 7316, 4636, },
+ { 30391, 18493, 13798, 4799, 2283, },
+};
+
+const Word16 UVG2CB2_WB_FX[UVG2_CBSIZE][5] = /* Q12 */
+{
+ { 1565, 1391, 1635, 5228, 2681, },
+ { 2156, 2558, 6205, 5561, 3944, },
+ { 2039, 2406, 3094, 3409, 3968, },
+ { 5090, 5065, 4989, 4858, 4764, },
+ { 1436, 1736, 2816, 2362, 2400, },
+ { 4375, 4425, 4465, 4478, 4493, },
+ { 4648, 4081, 3550, 2981, 2667, },
+ { 1705, 1950, 3679, 7828, 9895, },
+ { 2839, 1826, 1443, 1210, 1245, },
+ { 1387, 1410, 1768, 8873, 4383, },
+ { 4022, 3784, 3565, 3316, 3096, },
+ { 9983, 7147, 5225, 3742, 3027, },
+ { 6769, 2357, 1531, 1448, 1556, },
+ { 4591, 4671, 4735, 4765, 4789, },
+ { 4308, 4198, 4052, 3896, 3769, },
+ { 2288, 2550, 4922, 8294, 14878, },
+ { 1361, 1480, 1511, 1991, 10450, },
+ { 2933, 3131, 3694, 4687, 5201, },
+ { 3984, 3048, 2479, 2644, 5514, },
+ { 5353, 5480, 5488, 5434, 5437, },
+ { 3319, 2881, 2528, 2152, 1927, },
+ { 4873, 4748, 4578, 4407, 4257, },
+ { 6185, 4396, 3751, 3400, 2899, },
+ { 2159, 8067, 7534, 5121, 3640, },
+ { 2265, 10177, 3803, 2588, 2441, },
+ { 2188, 2206, 4293, 12691, 5893, },
+ { 3587, 3651, 3760, 3864, 3960, },
+ { 13158, 9752, 7171, 5431, 5364, },
+ { 5710, 4173, 2928, 2090, 1774, },
+ { 3531, 3831, 4641, 5787, 6622, },
+ { 4395, 4356, 4281, 4194, 4111, },
+ { 2243, 2476, 5814, 3965, 27176, },
+ { 1575, 1667, 7544, 3005, 1984, },
+ { 2583, 2511, 11684, 5765, 4807, },
+ { 3632, 3458, 3277, 3114, 2971, },
+ { 8569, 6778, 5866, 5515, 5141, },
+ { 3267, 3035, 2940, 2782, 2691, },
+ { 3929, 4249, 4577, 4877, 5162, },
+ { 4443, 4173, 3864, 3590, 3337, },
+ { 3998, 4725, 5728, 6873, 7885, },
+ { 4369, 2824, 2237, 1648, 1404, },
+ { 1000, 1022, 1477, 2682, 15276, },
+ { 3916, 3851, 3766, 3664, 3591, },
+ { 13206, 4485, 3230, 3897, 3648, },
+ { 10002, 3515, 2393, 2233, 2211, },
+ { 4603, 4836, 5071, 5259, 5411, },
+ { 3919, 4035, 4177, 4304, 4419, },
+ { 3046, 8332, 16475, 11172, 10858, },
+ { 1027, 1007, 1196, 1578, 5937, },
+ { 1892, 2422, 3227, 3920, 7400, },
+ { 3584, 3532, 3508, 3470, 3437, },
+ { 5363, 6155, 6805, 6854, 6811, },
+ { 4038, 3512, 3030, 2636, 2332, },
+ { 6760, 6124, 5235, 4299, 3687, },
+ { 4125, 6528, 4068, 3238, 3483, },
+ { 5020, 5905, 7082, 8554, 9623, },
+ { 1399, 5868, 3069, 1726, 1655, },
+ { 4691, 4234, 3974, 3757, 9616, },
+ { 3978, 4003, 4003, 3983, 3960, },
+ { 2103, 16858, 9252, 4860, 4727, },
+ { 8043, 5294, 3970, 3098, 2583, },
+ { 4680, 5109, 5576, 5965, 6275, },
+ { 4867, 4584, 4276, 3958, 3682, },
+ { 1213, 3115, 6552, 22778, 20977, },
+};
+
+const Word16 UVG2CB1_NB_FX[UVG2_CBSIZE][5] = /* Q12 */
+{
+ { 773, 785, 785, 785, 860, },
+ { 3560, 3521, 3410, 3265, 3167, },
+ { 1766, 2982, 10273, 3790, 2248, },
+ { 4986, 4753, 4496, 4172, 3922, },
+ { 2036, 2030, 2009, 1973, 1897, },
+ { 3291, 3554, 3868, 4126, 4345, },
+ { 3207, 3122, 3026, 2913, 2797, },
+ { 13220, 6844, 3967, 2746, 2466, },
+ { 1553, 1627, 1392, 1766, 3679, },
+ { 5379, 4640, 3844, 3254, 2635, },
+ { 1600, 1622, 2430, 9446, 4214, },
+ { 5115, 5200, 5311, 5365, 5343, },
+ { 6229, 3008, 1989, 1622, 1597, },
+ { 1726, 2114, 7046, 6162, 4301, },
+ { 1004, 1056, 1841, 6006, 7101, },
+ { 6388, 9659, 4510, 2774, 2113, },
+ { 1060, 1153, 1400, 1733, 2121, },
+ { 3448, 3523, 3612, 3683, 3770, },
+ { 1496, 2045, 2910, 3563, 4058, },
+ { 4419, 4592, 4795, 4921, 4978, },
+ { 1407, 5314, 2788, 1675, 1350, },
+ { 4210, 4225, 4227, 4186, 4169, },
+ { 2247, 8245, 4392, 2522, 1709, },
+ { 7211, 6741, 6110, 5397, 4680, },
+ { 3602, 2286, 1577, 1229, 1148, },
+ { 6674, 5227, 3576, 2448, 1901, },
+ { 954, 1035, 1079, 1683, 9558, },
+ { 4011, 5853, 8979, 7138, 4484, },
+ { 2784, 2702, 2637, 2546, 2471, },
+ { 4414, 4065, 4627, 4208, 9275, },
+ { 2771, 3012, 3357, 3735, 4066, },
+ { 19742, 8603, 3943, 2546, 2085, },
+ { 1132, 1123, 1107, 1093, 1114, },
+ { 3913, 3838, 3733, 3630, 3548, },
+ { 948, 1565, 6063, 2654, 1667, },
+ { 6159, 5567, 4884, 4241, 3770, },
+ { 925, 1164, 1585, 6062, 3090, },
+ { 3818, 4037, 4322, 4536, 4726, },
+ { 4291, 3894, 3441, 3006, 2733, },
+ { 8544, 6487, 4962, 3812, 2970, },
+ { 1744, 1758, 1704, 1633, 1576, },
+ { 4416, 4259, 4044, 3810, 3628, },
+ { 1919, 2159, 3323, 13977, 7898, },
+ { 5952, 5731, 5419, 5061, 4732, },
+ { 2775, 2812, 2507, 2540, 6585, },
+ { 3436, 3960, 4661, 5975, 6274, },
+ { 3082, 3150, 3246, 3337, 3404, },
+ { 4089, 16018, 8285, 4116, 2704, },
+ { 1419, 1425, 1400, 1371, 1363, },
+ { 3825, 3890, 3953, 3993, 4015, },
+ { 2498, 2689, 2846, 3011, 3213, },
+ { 5122, 5024, 4881, 4691, 4524, },
+ { 2285, 2325, 2317, 2313, 2271, },
+ { 4493, 4529, 4517, 4478, 4443, },
+ { 9138, 3969, 2522, 2222, 2415, },
+ { 10009, 8719, 7292, 5837, 4532, },
+ { 831, 908, 1039, 1656, 6813, },
+ { 2070, 5478, 5174, 3911, 3694, },
+ { 1577, 1565, 1635, 2583, 13154, },
+ { 5590, 5788, 5922, 6752, 7063, },
+ { 4061, 3497, 2710, 2099, 1716, },
+ { 2750, 3118, 16574, 7891, 3651, },
+ { 2598, 3072, 3809, 4906, 5172, },
+ { 15348, 10948, 7740, 4979, 3446, },
+};
+
+const Word16 UVG2CB2_NB_FX[UVG2_CBSIZE][5] = /* Q12 */
+{
+ { 961, 867, 812, 771, 775, },
+ { 2544, 2686, 3010, 3605, 5048, },
+ { 1524, 1818, 2889, 3029, 3046, },
+ { 4195, 4301, 4421, 4497, 4580, },
+ { 2026, 1990, 1965, 1943, 1939, },
+ { 4338, 4156, 3963, 3750, 3590, },
+ { 7732, 2904, 1804, 1407, 1513, },
+ { 1613, 2353, 11315, 5764, 4291, },
+ { 1519, 1462, 1434, 1341, 1294, },
+ { 1627, 1710, 2163, 9654, 5615, },
+ { 2322, 7293, 3251, 2020, 2066, },
+ { 4967, 5112, 5174, 5203, 5230, },
+ { 1590, 1449, 1943, 5947, 3563, },
+ { 7747, 5170, 3268, 2392, 2082, },
+ { 3970, 3559, 3164, 2774, 2493, },
+ { 1993, 2210, 3204, 3717, 23534, },
+ { 1185, 1236, 1423, 2115, 4772, },
+ { 3935, 3840, 3714, 3583, 3477, },
+ { 1640, 1550, 1800, 2609, 10880, },
+ { 4067, 4437, 4811, 5108, 5536, },
+ { 1472, 1367, 1533, 2132, 7352, },
+ { 4310, 4284, 4216, 4117, 4057, },
+ { 10817, 4587, 2611, 2066, 2037, },
+ { 2089, 2427, 4698, 14635, 7517, },
+ { 2529, 1561, 1209, 976, 945, },
+ { 2908, 3070, 4055, 5862, 6448, },
+ { 2676, 2861, 3115, 3295, 3408, },
+ { 2932, 14330, 6533, 3739, 3462, },
+ { 3681, 3079, 2559, 2151, 1903, },
+ { 5636, 5316, 4978, 4690, 4425, },
+ { 2298, 7228, 6976, 4251, 3347, },
+ { 2504, 3421, 6784, 8483, 15064, },
+ { 1253, 1180, 1136, 1094, 1076, },
+ { 3451, 3524, 3600, 3646, 3707, },
+ { 1701, 2030, 6574, 4746, 4451, },
+ { 4688, 4751, 4762, 4727, 4722, },
+ { 2977, 2363, 1883, 1563, 1399, },
+ { 5080, 4685, 4275, 3835, 3513, },
+ { 5445, 3828, 2851, 2242, 1948, },
+ { 1929, 5037, 17760, 8346, 6300, },
+ { 1839, 1782, 1680, 1586, 1534, },
+ { 3086, 3472, 4031, 4950, 9695, },
+ { 3199, 3052, 2896, 2751, 2622, },
+ { 5822, 5782, 5727, 5566, 5478, },
+ { 1548, 2234, 6748, 2562, 1722, },
+ { 6699, 5216, 4475, 3531, 3028, },
+ { 3773, 3628, 3460, 3279, 3155, },
+ { 1581, 1672, 2929, 20221, 16432, },
+ { 1210, 1215, 1389, 1678, 2177, },
+ { 3863, 3886, 3937, 3961, 3989, },
+ { 1541, 1745, 1829, 3479, 15563, },
+ { 4444, 4952, 5573, 6056, 6545, },
+ { 2460, 2397, 2284, 2133, 2041, },
+ { 4808, 4676, 4493, 4322, 4213, },
+ { 15031, 6644, 3315, 2900, 2885, },
+ { 4003, 4760, 6946, 8274, 8401, },
+ { 5001, 2495, 1594, 1337, 1365, },
+ { 3428, 3706, 4073, 4457, 4670, },
+ { 3326, 3277, 3222, 3142, 3088, },
+ { 6162, 6317, 6494, 6459, 6530, },
+ { 2659, 2599, 2537, 2482, 2546, },
+ { 8554, 6902, 5233, 4116, 3650, },
+ { 4643, 4099, 3616, 3201, 2895, },
+ { 9589, 26630, 15412, 12532, 8715, },
+};
+
+const Word16 frac_4sf_fx[NB_SUBFR + 2] = { 4,8,12,16,16,16 }; /* Q4 */
+
+/* ERB table for PPP-ampl-quant */
+const Word16 erb_WB_fx[NUM_ERB_WB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 11264, 13568, 16387 };//Q(log2(2.56)
+
+
+/* ERB table for PPP-ampl-quant */
+const Word16 erb_NB_fx[NUM_ERB_NB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 10243 };//Q(log2(2.56)
+
+
+
+/*Amplitude and power tables for PPP*/
+
+const Word16 AmpCB1_WB_fx[640] =
+{//Q13
+ 5655, 1589, -653, 3568, -3173, -1852, -3204, -4623, -2100, -5103,
+ -923, -67, -7152, -4958, -2019, -1810, -8532, -648, 6581, 8043,
+ 160, 778, -1535, 863, 5482, 1674, -3576, 123, -3163, -3595,
+ -852, -53, -1080, -2683, -3199, -950, -1353, 6258, -1431, 1249,
+ 2059, 677, 146, 1011, 956, -2022, -25, 300, 421, -5859,
+ 1027, -452, -7343, -1052, 3818, 1099, -1005, 659, -511, -658,
+ 2091, 720, -600, 145, -1504, -1716, -442, -2172, -1505, 2702,
+ 731, 1473, -213, -4120, -2976, 688, 3205, 1213, 679, 232,
+ 3672, 4770, -1198, -298, -1714, -3669, -2833, -664, -1859, -2380,
+ -1169, -1593, -453, 295, -1225, -3110, -1776, 2112, 2710, 3333,
+ 1022, 1248, 1091, 1164, 1200, 1782, -809, -2306, -3124, -2194,
+ -1567, 465, 2223, -1301, -463, -2157, 729, 2279, -1938, 610,
+ 437, -803, -1025, 775, -171, -637, 163, 2251, 316, -1663,
+ -4123, -20, -2827, -1529, -1436, 3447, 79, -274, 1650, 4097,
+ 2369, 927, 448, -449, 293, -239, -1028, -4805, 1354, 431,
+ -2219, -490, -3849, 1639, -2925, 817, 1485, 2527, 5444, -1994,
+ 1476, 506, -1643, 2003, -1676, -788, -1681, -2011, 1389, 452,
+ 593, 3, -1200, -3987, -1634, -4310, -686, 882, 6235, 2420,
+ -196, -1257, -2038, -498, 1394, 671, -2302, -809, -446, 3644,
+ -1643, -2304, -828, 105, -323, -3906, -960, 7324, 3095, -786,
+ 95, 633, 1266, 750, 1509, -2033, -3134, 432, 1028, -1825,
+ 1258, 256, -3249, -6868, -523, -325, -1779, 4313, 2524, 3433,
+ -600, -410, -88, 410, -1182, -1140, -1448, -1344, -5074, 6054,
+ 2194, 1505, -681, -2408, 1376, 1389, 1209, 1048, -4199, -2939,
+ 1855, 1744, -1344, -1431, -1955, -1805, -4992, 512, 624, 2749,
+ -3446, -1215, -3764, -2169, -3601, -1321, 67, 4326, 6624, 5816,
+ -334, -1746, -441, -754, 1853, 3889, -595, -493, 441, -811,
+ -48, -764, -1473, -683, 603, -1754, 780, 698, 1084, 1713,
+ 560, -808, -754, -2890, -1205, -318, -1021, 3195, 5693, -4603,
+ 1343, -1061, -2441, -1784, 721, 267, 227, -622, 3013, -768,
+ -472, 90, 13, 290, 1055, 948, 1617, -2368, -1087, 1103,
+ -4784, -3872, 5125, -2518, -215, 6962, 1095, -1521, 2091, -2962,
+ 2285, 1117, 1174, 2635, -1907, -1012, 814, -417, -2162, -2805,
+ -1188, -707, -808, -1757, 260, -1093, -3957, -3266, 4132, 5980,
+ 177, -1478, 960, 2029, 3989, 597, -3062, -3940, -1688, 236,
+ -1559, 150, 2432, 348, -242, -2014, -1027, 6298, -2957, -3960,
+ 1090, 1014, -1261, -744, -954, -938, -3713, -3272, 5356, -2356,
+ -1439, 3808, -2330, -4437, 5177, -3606, -1382, 1824, 407, 325,
+ 649, 330, 85, 206, -415, 183, -646, 602, -2656, 808,
+ 1039, 29, -3202, -6168, -3640, 3736, 4183, 3959, 330, 339,
+ 2701, 343, 1501, 1879, -3194, -4648, -1630, 1656, -1578, -84,
+ -3065, -4126, 24, -260, 263, -1705, -1289, 2432, 1229, 7481,
+ 2586, 1696, 646, -1773, -792, 1932, -1908, -1897, -1129, 112,
+ -5667, -1592, 2253, -980, 1581, 211, 5277, 4846, -288, -159,
+ 956, 1196, 771, -973, -1785, -516, -1015, 847, 614, -791,
+ -442, -1594, -4632, -4392, -416, 1398, 2570, 752, 264, 6570,
+ 1655, 546, 1238, -1362, -1330, -2005, 3590, -2155, -184, -1224,
+ -1452, -1533, -534, 1010, -1707, 801, 3628, -289, 2414, 132,
+ 2643, -2813, -4524, 5092, -7362, 740, 428, -510, 81, -1209,
+ 616, 1454, 1861, -3958, -4084, 189, -1219, -875, 3764, 2086,
+ -1554, -2071, 1515, 3392, 12, -686, -2414, -1382, 176, 1685,
+ 2055, -5698, 1582, 4117, -4846, -2922, 610, 2082, 4682, -2487,
+ 348, 2258, -338, -1379, 1472, 618, -202, -1122, -76, -2468,
+ -1216, -986, -327, -1441, 102, 403, -2105, 2411, 1510, 1288,
+ -715, -577, 1074, 2533, -3521, -3449, 2140, -751, -307, 3805,
+ 158, -1385, -404, -1378, -1948, 3785, 4216, 2667, -1894, -1559,
+ 1037, 1371, 989, -205, -333, -4784, -3429, -1283, 3299, 859,
+ -4922, -5481, -1196, -1748, -720, 516, 113, 4590, 7071, 4345,
+ -5729, -3862, 3590, 1463, 7094, 4991, 854, -66, -1630, -686,
+ -923, -3266, -1988, 2345, 785, -1420, 3004, 2934, -1245, -65,
+ -2696, -3088, -1438, 614, 1584, -239, -1552, 580, 6285, -1673,
+ -1598, -4018, -1909, 747, 3191, 366, 1467, -1933, 2759, 2804,
+ 518, 193, -1149, -3108, 441, 1458, 2791, -4131, 2694, 3372,
+ -5023, -6491, 1794, 2739, 1463, 5843, 2869, 1993, -1409, 4832
+};
+
+const Word16 AmpCB2_WB_fx[64 * (NUM_ERB_WB - 13)] =
+{//Q13
+ -5276, -7711, -3518, -2416, -382, 319, -1900, -900, 1725, 884,
+ 4071, -4052, -2430, -336, 2136, 3006, 591, -3893, -2731, 2625,
+ 2390, -1047, -883, -3368, -4235, -3726, 189, -1803, 784, 2336,
+ 206, -2140, 3001, -730, -2279, 85, -3395, 4367, 2214, -254,
+ -3114, -2348, 2763, 686, -7495, -6618, 3164, -3957, -2681, -2049,
+ 1659, 3634, 2962, 1574, 379, -2478, 2861, 616, 1124, 205,
+ -3075, -348, -2006, -90, 761, 1157, -114, -9460, -2786, -3254,
+ -1120, -1500, -446, 2835, -314, 3205, 2115, -837, -261, 36,
+ 80, -485, 1133, 2124, -1031, -401, -3166, 1145, -1616, -3425,
+ -3071, -6891, -4198, 2292, 5160, -46, 1430, 280, 1378, 1700,
+ -1673, -1126, 5270, 5096, -975, -1070, 1314, -2389, -2982, 20,
+ -3218, -892, -636, -876, -302, -2923, -3240, 4121, 1625, -557,
+ 994, 544, 2657, 7133, -273, -3530, -1419, 1431, -936, -2622,
+ 303, 75, -5444, -5549, 4183, 1248, 3474, -789, 2375, -1778,
+ 1660, 1520, -1433, -4047, 531, 7001, 695, 1889, 4261, -2791,
+ -1557, -2980, -316, 415, 1134, 1501, -6923, 521, -3134, -1812,
+ 1848, 676, -1733, 734, 2207, 2029, -476, -1976, -161, 29,
+ 7147, -1774, 720, -1070, -372, -1626, -6473, -2448, -5235, -2651,
+ -1800, -1477, -767, 1335, 471, 4857, 888, 593, -370, 196,
+ 907, 174, 557, -720, -1339, 1590, 37, -1247, -1307, 276,
+ -1739, -6032, -3088, -2499, -497, -393, -569, 3003, 2694, 3751,
+ 4652, -258, -1305, 175, 189, -344, -2381, -1992, 463, 529,
+ -6375, 3966, -3558, -3001, -640, 3117, 1120, 966, 1316, -561,
+ 27, 2794, 2831, 3512, 3453, -418, -2319, -6741, -3443, 80,
+ 1281, 1691, 1500, -591, -739, 2385, -4676, -5822, -1437, 730,
+ 3593, -437, 1090, 3497, -1932, 2854, 4858, 2654, 947, 1879,
+ -4115, 2700, -3092, -1524, 225, -8272, -6736, -1277, 2991, 2983,
+ 1129, -1661, 2817, 468, 491, -744, 390, 677, 8129, -3130,
+ -687, -433, 1488, -3763, -177, -581, -764, 39, 1537, -2203,
+ -1678, 263, -1214, 2175, -1857, 3097, -894, 4207, -1943, -834,
+ 1513, -4123, 3981, 6041, 653, -757, -313, -3024, -4614, -3139,
+ -2966, 178, 4956, -427, -41, 2376, 1008, -1351, -92, 978,
+ 1998, 5146, 2069, 117, -1754, -2756, 4425, 168, -1807, -1761,
+ -1215, 178, -1562, -3369, -919, -2576, 3614, 4968, -30, -396,
+ -1151, -1146, 868, 1073, -359, 2732, 546, 4431, -321, -1081,
+ 1410, -3214, -2316, -4889, -2460, -3844, -7323, -1438, -1488, 1849,
+ 4037, 2421, 2697, -2372, -1877, 670, 3674, -907, 888, -3703,
+ 375, -1278, -1477, 2501, -936, -1682, -1353, -335, -4440, 383,
+ -2730, -2130, -1105, 1588, 3340, 4816, -4023, 502, -4146, 236,
+ 4481, 589, -3696, 826, -97, 222, -8037, -2244, 142, 810,
+ -2195, 1315, 656, 1901, -485, 317, 1512, 1465, -2026, 1853,
+ 929, 1670, -2736, -463, -836, -4946, -134, 2769, 2972, -5148,
+ -3147, 913, -1483, 267, -1560, 3903, 1507, 1105, -1496, 210,
+ -1196, 3764, 601, 1630, 3842, 6374, -1293, -4555, -3087, 199,
+ -1917, -3331, -2317, -1774, 479, 3712, 2729, 1309, -3047, -514,
+ 861, -213, 1317, -2035, 4369, 5228, 942, -3052, -2316, -3377,
+ 1123, -65, 2507, 2711, -2096, -2164, -2634, -5215, -3919, 1551,
+ -47, 1990, 2370, 2025, -2401, 4833, -3879, -162, -3081, 501,
+ -510, 2744, -907, 253, -1746, -2520, 3418, -1461, 2140, 2507,
+ 135, 1457, 3195, -1277, -2558, -66, 10850, -1633, -1051, -3436,
+ -1617, 1438, -1231, -1744, 696, -348, 3434, 2121, -1629, -2460,
+ -4065, 1159, -1288, 2843, 697, -862, 4, 966, -444, -1860,
+ 1450, 6426, 5544, 1456, -2826, -1303, -2778, -1278, -6656, -3241,
+ -7083, 2234, 204, 1753, 803, 499, 1641, 87, 1471, -1325,
+ 398, 2983, 4340, -1382, 735, -600, -4671, -254, 2327, -1008,
+ -144, -1453, -1806, -1669, 395, -3285, -1803, -2119, 1232, 2914,
+ 1480, 8610, 1788, 2644, 1359, 3783, -110, -1339, -1337, -3427,
+ -630, -1189, -2560, 976, 483, -2744, -3653, -1289, 2910, -2437,
+ 3171, 1479, 157, 823, 4631, -1910, 3736, -424, -155, -5470,
+ -741, 3829, -2794, -55, -1447, -3469, -1947, 2914, -61, -3430,
+ 3544, -1867, 2986, 1009, -1051, 725, 2933, 2926, 5849, 257,
+ -2666, 6286, -2282, -2998, -2576, -975, -3655, -1867, -5040, -1440,
+ 3542, -603, 4806, -2808, -1633, 1388, 1149, -1616, -1851, 2122,
+ 4477, 2485, 1376, 721, 2174, -3072, 1378, -2574, -37, 1322,
+ -1646, -3612, 4443, 1612, -3403, 711, 132, 119, -227, 5059,
+ 2892, 840, 5462, -3471, -1340, 2097, 143, 1750, -3052, -1932,
+ -6352, -4166, -645, 4317, 633, 3681, 2811, 2346, 2374, -2999,
+ -1265, -210, 5115, 4652, 1305, 3704, -1456, -307, -457, -1455,
+ -3580, 674, 2215, 2458, -3021, -66, 2535, -652, 1226, 685,
+ 875, -1753, -1164, -609, 3444, 563, 3826, 1607, 3798, 1385,
+ 3902, -1990, -4078, -2509
+};
+
+const Word16 AmpCB1_NB_fx[640] =
+{//Q13
+ -1355, 185, -222, -221, 1976, 3119, 540, 1333, -3646, -2511,
+ -979, 1664, 2087, 951, 787, -1687, -855, 1594, 1264, -4990,
+ -1957, -215, -850, 1369, -113, 2541, -2904, 743, 634, -657,
+ -3438, -2047, 706, 85, -596, -50, 212, 944, 118, 1380,
+ -1203, -78, -213, -1811, -781, -1970, 6607, -2971, 147, -1483,
+ 38, 5607, 5222, -4567, -4040, -2259, -3110, -2120, 932, -236,
+ -1052, 1039, -872, 334, -919, 2761, 3320, -5828, 53, 1063,
+ -1064, -75, -1015, -2137, -722, 565, 629, 1961, -454, 866,
+ -888, 2652, 1996, -2170, -885, 3325, -645, -1898, -984, -643,
+ -1008, 2472, 2400, -3708, -2408, -1051, 2029, 1357, -636, -470,
+ -1307, 655, 663, 29, 892, -95, -91, -2966, -1610, 2657,
+ -2175, -3170, -3799, -3065, 1130, 1351, 3814, 2791, 1478, 1520,
+ -1326, -520, -692, 899, 1979, -397, -407, 450, -569, -611,
+ -1228, 864, 2549, 3067, -2511, -4737, -2701, -304, 680, 1426,
+ -1070, -19, -1582, -2813, -1832, 3010, 250, -613, 3390, -171,
+ -1450, -417, -773, -651, -405, -2304, -780, 6656, -3270, -1322,
+ 70, 5105, 3202, -83, -925, -458, 1203, -1582, -4158, -3630,
+ -1702, -849, -55, -986, -1963, -1140, -1942, 3347, 3526, -435,
+ -1429, -2089, -1620, -1271, 2851, 2184, -2472, 3216, 2885, -2922,
+ -1217, 86, -186, -279, -746, 1288, 3016, -651, -2719, 317,
+ -1307, -127, -1110, 1389, 212, 1783, 2619, -1718, 1795, -4086,
+ -1295, 743, 301, -1823, -223, -651, -1774, -405, 1687, 2031,
+ -865, 1059, -391, 505, -2739, -2773, 16, -2960, 3071, 3325,
+ -791, 2301, 435, 107, -4039, 801, -1224, 1854, -1039, 507,
+ -518, 997, 837, 3311, 506, 1026, -232, -1920, -3904, 406,
+ -1857, -529, -776, -700, -663, -1520, 1699, 814, 2084, -477,
+ -1341, -1123, -2564, -2784, 2457, 3223, -959, 385, -1864, 3754,
+ -1351, -1347, -2229, -2882, -1061, -1499, -3028, 3302, 2250, 5539,
+ -957, -340, 27, 1508, 167, -3513, 1689, 2577, -1810, -516,
+ -1061, 2171, 1774, 2031, 923, -1933, -1640, -2881, 859, -834,
+ 408, 2462, 2073, 2107, -2671, 1140, -3497, -2497, 2984, -2707,
+ -1762, -2524, -2196, 279, -2580, 477, 2306, 4645, 693, -909,
+ -1089, 1952, 3034, -1790, 786, -1149, -3117, 3605, -1933, -1886,
+ -959, 934, 246, -2177, -2440, 1356, 871, 3472, 2558, -4512,
+ -782, 1262, 893, 1979, 2386, -1809, -4357, -392, -1928, 1576,
+ -1751, -327, -1018, -617, -2370, -2910, 4230, -90, -1361, 3596,
+ -1069, -315, -162, -339, -313, 33, 4684, 2811, -2717, -3684,
+ 695, 4567, -745, -2311, -776, -2600, -827, -1040, -997, 2480,
+ -1549, -748, -622, -260, 1460, 1116, -302, -2529, 2156, -42,
+ -1318, -568, -266, -446, -2212, 2690, -4669, 5325, -2022, 1358,
+ -1312, 2293, 1528, 706, 970, -291, 383, -683, -1532, -1843,
+ -1379, 845, 1218, 395, -1884, 14, 676, -1711, 795, 290,
+ -742, 386, -435, 411, 1311, 549, -4181, -4922, 1497, 4465,
+ -1722, -699, -1958, -4126, -3727, -655, 1553, 1793, 4933, 3055,
+ -1260, -618, 535, -2008, 3802, -3784, 2527, -833, 193, -1062,
+ -866, 823, 1562, 147, -623, -1808, -1099, 694, -577, 745,
+ -2282, -4139, -3171, 76, 25, -1077, 477, 545, 6081, 3244,
+ -1332, -785, 98, -1681, -3603, -3937, 524, 4648, 1114, 2547,
+ -1145, 407, 2030, 3120, -1739, -513, -518, 1325, -1700, -2860,
+ -1427, 520, -1040, -792, -366, -2174, -522, -240, 5660, -3163,
+ -1449, -1653, -1507, 581, 1338, -2627, -1863, 1831, 1301, 2106,
+ -1252, 974, 199, 68, -69, -869, 864, 2373, -5818, 2873,
+ 26, 972, 359, -561, -390, 376, 225, 517, 649, -1767,
+ -653, 2167, 882, -698, 214, -4084, -4134, 2092, 2798, -523,
+ -1002, 486, 648, -1082, 404, -1490, 1560, -4984, 5614, -1441,
+ -1024, -311, 427, 356, -2342, 215, -2312, 445, -2378, 5111,
+ -568, 85, 1328, 1847, 3506, 1183, -2521, -2070, -794, -1881,
+ -485, 1121, 1242, 1301, -4365, -2222, 2602, -387, 1498, -1344,
+ -1272, -1365, -2207, -213, -1877, 2858, 849, -915, 333, 2488,
+ -2019, -2048, -1461, -1930, -1409, -400, 490, -2222, 1276, 7305,
+ -1530, -1741, -2663, 3159, 1162, -1490, 1516, -1498, 1222, 838,
+ 1325, 5387, 3888, 1944, -1706, -2890, -1905, -3901, -3207, 206,
+ -1411, -959, -292, -396, -1547, -84, -4405, -1073, 5532, 1796,
+ 3160, 48, -2339, -5884, -184, -52, 129, 5398, 378, -321
+};
+
+const Word16 AmpCB2_NB_fx[64 * (NUM_ERB_NB - 13)] =
+{//Q13
+ -2681, -4389, -4270, -4727, -239, 1938, 1748, 2311, 4300, -3957,
+ -1299, 3487, 1595, -377, 295, -1193, -1588, 2112, -1573, -6362,
+ -504, 1796, -2521, -68, 1322, 1223, 2263, -503, -3906, 3686,
+ -3899, -139, 2086, 48, 349, 547, -6387, 1340, -1467, -1062,
+ -193, 1325, -1190, 2394, 1671, -1982, -2597, -390, -1504, 2271,
+ -379, -2350, 4071, 70, -955, -883, -1770, -1065, -2443, -1779,
+ -1101, -661, 6325, 1871, -2673, 3596, 3773, -681, 3340, -1418,
+ 701, -4253, -3931, -1840, -2388, -2677, -3545, -41, 3675, 3843,
+ 2198, -1713, -324, 599, 1323, 1827, -4909, -1668, 616, 2608,
+ 360, -1769, -5263, -1278, 3490, 1935, 1355, -1298, 952, 1801,
+ 449, 251, -1021, -3666, 479, 3497, 1542, -2234, -3414, -4483,
+ -5785, 1406, 1207, 2984, 1767, 3262, -799, -3124, 5237, 460,
+ 2007, -1525, -2106, -770, 546, 137, 401, -1308, 969, 204,
+ -1626, -589, -4257, 1744, 2836, 2383, 2740, -423, 3166, 1920,
+ -690, -3000, -4489, 2523, -6693, -5135, -739, -1919, 1228, 2354,
+ 3340, 1902, 1069, -3185, -2614, 2764, -212, -2061, -1377, 698,
+ 3694, -125, -954, -4132, -404, 4297, 1294, 1765, 2446, -2287,
+ -1387, -14, 508, 1149, 9, -437, 519, -420, 450, -751,
+ -1632, -1391, -2208, -1955, -1170, 4818, 1112, 1086, -782, 1337,
+ 846, -3434, 569, 1721, -776, -2723, 1207, 982, -1432, -887,
+ 315, -3031, 3452, 765, -1263, -2146, 2959, -2619, 1507, 1312,
+ 4087, 3125, 1637, -1402, -45, -3193, 1397, -2611, -3641, -2478,
+ -1706, 588, 199, 3721, 1217, -1249, -1196, 7228, 996, 879,
+ -1339, 11, -971, -1680, 716, -39, 233, 1945, 1548, -1476,
+ 550, -2277, 307, 7413, 2094, -1631, -569, -1351, -198, -483,
+ -515, -1347, -212, -2649, -519, 195, 2944, -795, 1470, 654,
+ -1448, 3156, 1369, 3966, 3382, -2782, -4255, -1157, -212, 392,
+ 861, 5064, 4740, -2513, -3413, -552, -2298, -575, 1130, 1178,
+ 1568, 4591, 1238, 367, 1626, 600, -5889, 163, -3742, -3650,
+ -3911, 716, 919, -1501, 55, 1807, 3801, -5571, -4635, 1225,
+ 3211, 3804, 1491, -906, 100, 404, -1742, -1878, -2140, 1651,
+ 1640, 3976, -3432, -1149, 1365, 2042, 392, 768, -1534, 1096,
+ 3811, -211, -2067, -1315, -4167, 1145, -2747, -149, 5296, -735,
+ 438, 56, -404, -159, -2164, -959, 3492, -690, -688, -1081,
+ 2762, -1191, 654, 2051, -2144, -3210, -1823, 743, 686, -751,
+ 2483, 160, 1279, 3246, 1874, 2488, 1192, -5977, -478, 120,
+ -349, -65, -2350, -222, -1678, -3584, 1114, 3269, 1462, -1114,
+ -138, 2360, -2762, 720, -3822, 2523, 216, 1170, 4398, -4229,
+ -1850, 1272, 383, 1736, -383, -1295, 85, -132, 1133, 1505,
+ 1467, -2389, -2175, 4028, -2752, 241, -4353, -2103, -562, 817,
+ 3959, 5471, 1941, -1598, -2349, 201, 1412, -796, 2791, -4226,
+ 3227, -1992, -159, -159, 4085, -1549, 1020, -2179, -776, -2088,
+ -147, -42, 1880, -1029, 4982, -2056, 111, 1420, 2141, 302,
+ -2574, -986, -477, -3697, -2349, -2064, -335, -220, 5857, 57,
+ -7, -5407, -546, -353, 2866, 137, -136, 3508, 992, -2059,
+ -2034, -1127, -189, -300, -2153, 3606, 2523, -3727, 1526, -3797,
+ 2134, 4352, -920, -459, 2722, 1784, -71, -3030, -877, 1967,
+ -1645, -4432, 512, 39, 1757, 2875, -947, 1842, 1365, 1500,
+ 851, 594, -2892, -404, 3327, -3078, -1575, -1258, -973, -191,
+ -390, 45, 627, -227, 1624, -143, 215, 2157, 4846, 5335,
+ 3397, -199, -4443, -3091, -283, -216, 1237, -1478, -5639, -775,
+ 525, 2107, 2469, 2934, -255, 2438, 824, 5973, -1820, -1330,
+ -1202, -2433, 900, 650, -5654, 2891, -1539, -453, 1662, 231,
+ -145, 1661, 741, -332, 1221, 1809, 943, 4831, -1588, -4619,
+ 65, -790, -985, -893, 3374, 3148, 289, 2947, -4980, -661,
+ -427, 1441, 7696, 158, -1914, -2069, -1717, -418, 2657, 4219,
+ 1505, -1096, 601, -1466, -1754, -479, -159, 3378, 5252, 5060,
+ 4001, 1301, 420, -1268, -2813, -4196
+};
+
+const Word16 PowerCB_WB_fx[128] = /* Q11 */
+{
+ -3371, -1712,
+ -170, 350,
+ -638, -939,
+ 56, 1074,
+ -1559, -626,
+ 200, 344,
+ -397, 238,
+ 284, 1415,
+ -1323, -1880,
+ -544, 1170,
+ -619, -255,
+ 587, 974,
+ -1262, -98,
+ 327, 151,
+ 41, -302,
+ 941, 1876,
+ -2257, -1233,
+ 28, 202,
+ -520, -561,
+ 338, 1048,
+ -1080, -495,
+ 190, 582,
+ -284, -24,
+ 578, 1585,
+ -1324, -1089,
+ -71, 568,
+ -471, -26,
+ 1140, 909,
+ -856, -128,
+ 425, 740,
+ 140, 12,
+ 1595, 1891,
+ -2176, -2310,
+ -308, 541,
+ -315, -859,
+ -80, 1314,
+ -1782, 510,
+ 403, 450,
+ -607, 582,
+ 145, 1837,
+ -920, -1386,
+ -225, 872,
+ -395, -258,
+ 829, 981,
+ -945, 345,
+ 643, 241,
+ -56, -23,
+ 1211, 1482,
+ -1793, -1459,
+ 40, 400,
+ -239, -471,
+ 532, 1238,
+ -774, -516,
+ 244, 831,
+ -157, 152,
+ 576, 2287,
+ -928, -844,
+ 41, 759,
+ -161, -198,
+ 873, 1353,
+ -640, 105,
+ 695, 623,
+ 364, -184,
+ 1238, 2446
+};
+
+const Word16 PowerCB_NB_fx[128] = /* Q11 */
+{
+ -3349, -2784,
+ -784, 385,
+ -891, -562,
+ 126, 915,
+ -1518, -1438,
+ 304, 53,
+ -314, -447,
+ 687, 1219,
+ -2585, -1807,
+ -65, 153,
+ -1219, -337,
+ 497, 700,
+ -894, -1051,
+ 161, 451,
+ -46, -516,
+ 987, 1519,
+ -2277, -2303,
+ -354, 445,
+ -532, -540,
+ 5, 1271,
+ -1047, -1433,
+ 672, -225,
+ -335, -75,
+ 1007, 1056,
+ -1362, -1879,
+ -93, 367,
+ -468, -259,
+ 1800, -290,
+ -1118, -793,
+ 412, 472,
+ -9, -197,
+ 1471, 1634,
+ -2627, -2847,
+ -269, 164,
+ -689, -373,
+ 432, 940,
+ -1601, -839,
+ 311, 271,
+ -212, -251,
+ 543, 1714,
+ -2014, -1336,
+ 109, 241,
+ -789, -110,
+ 729, 888,
+ -418, -1277,
+ 256, 674,
+ 218, -217,
+ 1027, 2065,
+ -1769, -2293,
+ -276, 853,
+ -360, -764,
+ 376, 1247,
+ -1274, -1122,
+ 602, 272,
+ -133, -32,
+ 1374, 1118,
+ -1860, -1795,
+ -23, 620,
+ -525, 60,
+ 1070, 548,
+ -691, -799,
+ 701, 572,
+ 81, 18,
+ 1949, 2120
+};
+
+
+const Word16 sinc_fx[8][12] = /* sinc for warp/extrapolate, in Q14 */
+{
+ {0,0,0,0,0,16384,0,0,0,0,0,0,},
+ {-388,484,-638,939,-1773,15966,2281,-1063,694,-514,409,-339,},
+ {-701,868,-1134,1639,-2949,14751,4917,-2106,1341,-982,776,-640,},
+ {-895,1101,-1427,2029,-3503,12849,7709,-2964,1835,-1328,1042,-856,},
+ {-947,1159,-1489,2086,-3476,10430,10430,-3476,2086,-1489,1159,-947,},
+ {-856,1042,-1328,1835,-2964,7709,12849,-3503,2029,-1427,1101,-895,},
+ {-640,776,-982,1341,-2106,4917,14751,-2949,1639,-1134,868,-701,},
+ {-339,409,-514,694,-1063,2281,15966,-1773,939,-638,484,-388,},
+};
+/*----------------------------------------------------------------------------------*
+ * Highrate SWB BWE tables
+ *----------------------------------------------------------------------------------*/
+const Word16 overlap_coefs_48kHz_fx[NSV_OVERLAP*WIDTH_BAND] = /* in Q15 */
+{
+ 9830, 11141, 11796, 12780, 13763, 14418, 15073, 15565, 16056, 16712, 17695, 18678, 20316, 23593, 27197, 31130
+};
+
+const Word16 overlap_coefs_fx[NSV_OVERLAP*WIDTH_BAND] = /* in Q15 */
+{
+ 8847, 10027, 10617, 11502, 12386, 12976, 13566, 14008, 14451, 15041, 15925, 16810, 18285, 21234, 24478, 28017
+};
+
+
+const Word16 swb_hr_env_code1_fx[NUM_ENVLOPE_CODE_HR1 * 2] = /* in Q9 */
+{
+ 23, 21, 268, 240, 344, 310, 504, 438,
+ 629, 580, 856, 734, 1305, 1209, 1637, 1693,
+ 1321, 2671, 2154, 3709, 1801, 890, 2243, 1410,
+ 2436, 2404, 3496, 3127, 2279, 5187, 3715, 6394,
+ 3435, 1000, 3381, 1894, 5434, 1299, 4806, 2171,
+ 3645, 4240, 4640, 3628, 4567, 4999, 5785, 6023,
+ 6032, 3010, 7194, 4949, 5735, 4609, 7391, 6777,
+ 7341, 1999, 10276, 2220, 9270, 4210, 11444, 4917,
+ 3708, 8481, 6030, 9814, 5694, 7913, 7457, 8888,
+ 9124, 6090, 8943, 7832, 10925, 6889, 10519, 8768,
+ 4637, 11437, 5754, 14762, 6791, 12873, 8317, 14468,
+ 7818, 11028, 8696, 12646, 10031, 11617, 10315, 13255,
+ 9112, 9960, 10901, 10336, 12338, 9772, 12090, 11543,
+ 12125, 8360, 13766, 9934, 13317, 8004, 14817, 8315,
+ 12848, 6332, 14189, 6791, 14505, 5289, 15684, 6580,
+ 12940, 3143, 14948, 3698, 16472, 2570, 16373, 4851
+};
+
+const Word16 swb_hr_env_code2_fx[NUM_ENVLOPE_CODE_HR2 * 2] = /* in Q9 */
+{
+ 262, 242, 686, 568, 1303, 901, 1600, 1559,
+ 2505, 1905, 2053, 2944, 2617, 1108, 3414, 1993,
+ 4329, 1409, 5695, 1801, 3391, 3052, 4384, 2562,
+ 4567, 3985, 5509, 3051, 6374, 4280, 7003, 5750,
+ 7000, 2794, 8434, 2006, 10706, 3294, 13034, 4412,
+ 8402, 3878, 9510, 5269, 11309, 6406, 10839, 8811,
+ 2701, 4927, 4656, 5773, 6116, 7956, 8474, 7704,
+ 3255, 8984, 6818, 11144, 3915, 13367, 1255, 16350
+};
+
+const Word16 swb_hr_env_code3_fx[NUM_ENVLOPE_CODE_HR_TR*N_BANDS_TRANS_BWE_HR] = /* in Q9 */
+{
+ 409, 347, 898, 622, 1457, 1033, 2242, 1012,
+ 3039, 1508, 2017, 2161, 4137, 1348, 3881, 2553,
+ 2538, 5306, 3962, 4430, 4730, 3610, 5225, 2877,
+ 5450, 2240, 5970, 1779, 5553, 1364, 6003, 838
+};
+const Word32 thren_HQ_fx[39] =
+{//Q14
+ 1805811328,
+ 1276901376,
+ 902905664,
+ 638450688,
+ 451452832,
+ 319225344,
+ 225726416,
+ 159612672,
+ 112863208,
+ 79806336,
+ 56431604,
+ 39903168,
+ 28215802,
+ 19951584,
+ 14107901,
+ 9975792,
+ 7053950,
+ 4987896,
+ 3526975,
+ 2493948,
+ 1763487,
+ 1246974,
+ 881743,
+ 623487,
+ 440871,
+ 311743,
+ 220435,
+ 155871,
+ 110217,
+ 77935,
+ 55108,
+ 38967,
+ 27554,
+ 19483,
+ 13777,
+ 9741,
+ 6888,
+ 4870,
+ 3444,
+};
+
+/*----------------------------------------------------------------------------------*
+ * ACELP/HQ core switching
+ *----------------------------------------------------------------------------------*/
+
+/* short filters for BWE of ACELP->HQ switching frame */
+const Word16 hp12800_16000_fx[21] =
+{//Q15
+ -0, 70, -207, 380, -405, 0, 1041, -2668, 4505,
+ -5968, 6526, -5968, 4505, -2668, 1041, 0, -405, 380,
+ -207, 70, -0
+};
+
+const Word16 hp12800_32000_fx[41] =
+{//Q15
+ -0, 45, 35, -47, -104, 0, 191, 156,
+ -203, -422, -0, 675, 523, -656, -1341, 0,
+ 2264, 1943, -2999, -9872, 19678, -9872, -2999, 1943,
+ 2264, 0, -1341, -656, 523, 675, -0, -422,
+ -203, 156, 191, 0, -104, -47, 35, 45, -0
+};
+
+const Word16 hp12800_48000_fx[61] =//Q15
+{
+ -0, 22, 33, 23, -10, -51, -69, -37, 45, 127,
+ 140, 40, -136, -271, -238, 0, 326, 507, 349, -143,
+ -696, -894, -450, 535, 1509, 1696, 521, -1998, -5136, -7735,
+ 24039, -7735, -5136, -1998, 521, 1696, 1509, 535, -450, -894,
+ -696, -143, 349, 507, 326, 0, -238, -271, -136, 40,
+ 140, 127, 45, -37, -69, -51, -10, 23, 33, 22, -0,
+};
+
+const Word16 hp16000_32000_fx[33] =//Q15
+{
+ -0, 62, -0, -127, -0, 270, -0, -523, -0, 940,
+ -0, -1662, -0, 3212, -0, -10353, 16407, -10353, -0, 3212,
+ -0, -1662, -0, 940, -0, -523, -0, 270, -0, -127,
+ -0, 62, -0
+};
+
+const Word16 hp16000_48000_fx[49] =//Q15
+{
+ -0, 33, 39, -0, -64, -83, -0, 138, 175, 0,
+ -272, -334, -0, 493, 596, 0, -870, -1059, -0, 1636,
+ 2120, 0, -4448, -9003, 21858, -9003, -4448, 0, 2120, 1636,
+ -0, -1059, -870, 0, 596, 493, -0, -334, -272, 0,
+ 175, 138, -0, -83, -64, -0, 39, 33, -0
+};
+
+const Word16 ct2[7][13] =
+{
+ /* accepted configurations */
+ /*input 12.8, output :*/
+ /*8*/ {30, 22, 30, 16, 25, 30, 19, 30, 30, 0, 8, 4, 15},
+ /*16*/ {25, 22, 19, 16, 16, 0, 0, 0, 12, 1, 4, 4, 15},
+ /*32*/ {19, 16, 19, 16, 16, 0, 0, 0, 6, 2, 2, 4, 15},
+ /*48*/ {17, 14, 15, 16, 16, 0, 0, 0, 4, 3, 4, 4, 15},
+
+ /*input 16, output :*/
+ /*12*/ { 9, 3, 4, 5, 9, 0, 0, 0, 5, 0, 5, 5, 4},
+ /*32*/ { 4, 4, 4, 4, 4, 0, 0, 0, 2, 1, 1, 4, 4},
+ /*48*/ {18, 18, 18, 18, 18, 0, 0, 0, 5, 2, 1, 4, 15},
+}; // Q0
+const Word16 ct2_fx[7][14] =
+{
+ /* accepted configurations */
+ /*input 12.8, output : fout/fin Q13*/
+ /*8*/ {30, 22, 30, 16, 25, 30, 19, 30, 30, 0, 8, 4, 15, 5120},
+ /*16*/ {25, 22, 19, 16, 16, 0, 0, 0, 12, 1, 4, 4, 15, 10240},
+ /*32*/ {19, 16, 19, 16, 16, 0, 0, 0, 6, 2, 2, 4, 15, 20480},
+ /*48*/ {17, 14, 15, 16, 16, 0, 0, 0, 4, 3, 4, 4, 15, 30720},
+
+ /*input 16, output :*/
+ /*12*/ { 9, 3, 4, 5, 9, 0, 0, 0, 5, 0, 5, 5, 4, 6554},
+ /*32*/ { 4, 4, 4, 4, 4, 0, 0, 0, 2, 1, 1, 4, 4, 16384},
+ /*48*/ {18, 18, 18, 18, 18, 0, 0, 0, 5, 2, 1, 4, 15, 24576},
+};
+
+const Word16 cu15_fx[28][3] = /*Q13*/
+{
+ /* xx/3, xx*xx/3, xx*xx*xx/3 xx v */
+ /* 0:*/ { 182, 12, 1 }, /* 1/15 */
+ /* 1:*/ { 364, 49, 6 }, /* 2/15 */
+ /* 2:*/ { 546, 109, 22 }, /* 3/15 */
+ /* 3:*/ { 728, 194, 52 }, /* 4/15 */
+ /* 4:*/ { 910, 303, 101 }, /* 5/15 */
+ /* 5:*/ { 1092, 437, 175 }, /* 6/15 */
+ /* 6:*/ { 1274, 595, 278 }, /* 7/15 */
+ /* 7:*/ { 1456, 777, 414 }, /* 8/15 */
+ /* 8:*/ { 1638, 983, 590 }, /* 9/15 */
+ /* 9:*/ { 1820, 1214, 809 }, /* 10/15 */
+ /*10:*/ { 2002, 1468, 1077 }, /* 11/15 */
+ /*11:*/ { 2185, 1748, 1398 }, /* 12/15 */
+ /*12:*/ { 2367, 2051, 1778 }, /* 13/15 */
+ /*13:*/ { 2549, 2379, 2220 }, /* 14/15 */
+ /*14:*/ { 2913, 3107, 3314 }, /* 16/15 */
+ /*15:*/ { 3095, 3507, 3975 }, /* 17/15 */
+ /*16:*/ { 3277, 3932, 4719 }, /* 18/15 */
+ /*17:*/ { 3459, 4381, 5550 }, /* 19/15 */
+ /*18:*/ { 3641, 4855, 6473 }, /* 20/15 */
+ /*19:*/ { 3823, 5352, 7493 }, /* 21/15 */
+ /*20:*/ { 4005, 5874, 8615 }, /* 22/15 */
+ /*21:*/ { 4187, 6420, 9844 }, /* 23/15 */
+ /*22:*/ { 4369, 6991, 11185 }, /* 24/15 */
+ /*23:*/ { 4551, 7585, 12642 }, /* 25/15 */
+ /*24:*/ { 4733, 8204, 14221 }, /* 26/15 */
+ /*25:*/ { 4915, 8847, 15925 }, /* 27/15 */
+ /*26:*/ { 5097, 9515, 17761 }, /* 28/15 */
+ /*27:*/ { 5279, 10207, 19733 }, /* 29/15 */
+};
+
+const Word16 cu4_fx[6][3] = /*Q13*/
+{
+ /* xx/3, xx*xx/3, xx*xx*xx/3 xx v */
+ /* 0:*/ { 683, 171, 43 }, /* 1/4 */
+ /* 1:*/ { 1365, 683, 341 }, /* 2/4 */
+ /* 2:*/ { 2048, 1536, 1152 }, /* 3/4 */
+ /* 3:*/ { 3413, 4267, 5333 }, /* 5/4 */
+ /* 4:*/ { 4096, 6144, 9216 }, /* 6/4 */
+ /* 5:*/ { 4779, 8363, 14635 }, /* 7/4 */
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * hp filter for filtering random part of excitation in frame error concealment
+ * Used in lib_dec\syn_bfi.c
+ *----------------------------------------------------------------------------------*/
+
+const Word16 h_high_fx[5] = { -410, -3572, 25602, -3572, -410 };//Q15
+
+const Word16 sincos_t_rad3_fx[T_SIN_PI_2 + 1] =
+{//Q15
+ 0, 134, 268, 402, 536, 670, 804, 938,
+ 1072, 1206, 1340, 1474, 1608, 1742, 1876, 2009,
+ 2143, 2277, 2411, 2544, 2678, 2811, 2945, 3078,
+ 3212, 3345, 3479, 3612, 3745, 3878, 4011, 4144,
+ 4277, 4410, 4543, 4675, 4808, 4941, 5073, 5205,
+ 5338, 5470, 5602, 5734, 5866, 5998, 6130, 6261,
+ 6393, 6524, 6655, 6787, 6918, 7049, 7180, 7310,
+ 7441, 7571, 7702, 7832, 7962, 8092, 8222, 8351,
+ 8481, 8610, 8740, 8869, 8998, 9127, 9255, 9384,
+ 9512, 9640, 9768, 9896, 10024, 10151, 10279, 10406,
+ 10533, 10660, 10786, 10913, 11039, 11165, 11291, 11417,
+ 11543, 11668, 11793, 11918, 12043, 12167, 12292, 12416,
+ 12540, 12664, 12787, 12910, 13033, 13156, 13279, 13401,
+ 13524, 13646, 13767, 13889, 14010, 14131, 14252, 14373,
+ 14493, 14613, 14733, 14852, 14972, 15091, 15210, 15328,
+ 15447, 15565, 15683, 15800, 15917, 16035, 16151, 16268,
+ 16384, 16500, 16616, 16731, 16846, 16961, 17075, 17190,
+ 17304, 17417, 17531, 17644, 17757, 17869, 17981, 18093,
+ 18205, 18316, 18427, 18538, 18648, 18758, 18868, 18978,
+ 19087, 19195, 19304, 19412, 19520, 19627, 19735, 19841,
+ 19948, 20054, 20160, 20265, 20371, 20475, 20580, 20684,
+ 20788, 20891, 20994, 21097, 21199, 21301, 21403, 21504,
+ 21605, 21706, 21806, 21906, 22006, 22105, 22204, 22302,
+ 22400, 22498, 22595, 22692, 22788, 22884, 22980, 23076,
+ 23170, 23265, 23359, 23453, 23546, 23640, 23732, 23824,
+ 23916, 24008, 24099, 24189, 24279, 24369, 24459, 24548,
+ 24636, 24724, 24812, 24900, 24986, 25073, 25159, 25245,
+ 25330, 25415, 25499, 25583, 25667, 25750, 25833, 25915,
+ 25997, 26078, 26159, 26239, 26320, 26399, 26478, 26557,
+ 26635, 26713, 26791, 26868, 26944, 27020, 27096, 27171,
+ 27246, 27320, 27394, 27467, 27540, 27612, 27684, 27756,
+ 27827, 27897, 27967, 28037, 28106, 28175, 28243, 28311,
+ 28378, 28445, 28511, 28577, 28642, 28707, 28771, 28835,
+ 28899, 28962, 29024, 29086, 29148, 29209, 29269, 29329,
+ 29389, 29448, 29506, 29564, 29622, 29679, 29736, 29792,
+ 29847, 29902, 29957, 30011, 30064, 30118, 30170, 30222,
+ 30274, 30325, 30375, 30425, 30475, 30524, 30572, 30620,
+ 30668, 30715, 30761, 30807, 30853, 30897, 30942, 30986,
+ 31029, 31072, 31114, 31156, 31197, 31238, 31278, 31318,
+ 31357, 31396, 31434, 31471, 31508, 31545, 31581, 31617,
+ 31651, 31686, 31720, 31753, 31786, 31818, 31850, 31881,
+ 31912, 31942, 31972, 32001, 32029, 32058, 32085, 32112,
+ 32138, 32164, 32190, 32214, 32239, 32262, 32286, 32308,
+ 32330, 32352, 32373, 32393, 32413, 32433, 32452, 32470,
+ 32488, 32505, 32522, 32538, 32553, 32568, 32583, 32597,
+ 32610, 32623, 32635, 32647, 32658, 32669, 32679, 32689,
+ 32698, 32706, 32714, 32722, 32729, 32735, 32741, 32746,
+ 32750, 32755, 32758, 32761, 32764, 32766, 32767, 32767,
+ 32767
+};
+
+/*----------------------------------------------------------------------------------*
+ * TCX
+ *----------------------------------------------------------------------------------*/
+
+const Word16 gain_corr_fac[3] = { 0x4155, 0x40A9, 0x4055 }; /* pow(10, 2^(-n-2)/28) (1Q14) */
+const Word16 gain_corr_inv_fac[3] = { 0x7D67, 0x7EB2, 0x7F59 }; /* pow(10,-2^(-n-2)/28) (0Q15) */
+
+const Word16 inter4_2tcx2[4][4] =
+{
+ { 7620/*0.2325402f Q15*/, 17528/*0.5349195f Q15*/, 7620/*0.2325402f Q15*/, 0/*0.0000000f Q15*/ },
+ { 4434/*0.1353017f Q15*/, 16694/*0.5094465f Q15*/, 11141/*0.3400065f Q15*/, 500/*0.0152453f Q15*/ },
+ { 1995/*0.0608774f Q15*/, 14389/*0.4391226f Q15*/, 14389/*0.4391226f Q15*/, 1995/*0.0608774f Q15*/ },
+ { 500/*0.0152453f Q15*/, 11141/*0.3400065f Q15*/, 16694/*0.5094465f Q15*/, 4434/*0.1353017f Q15*/ }
+};
+const Word16 inter6_2tcx2[6][4] =
+{
+ { 7345/*0.2241379f Q15*/, 18079/*0.5517241f Q15*/, 7345/*0.2241379f Q15*/, 0/*0.0000000f Q15*/ },
+ { 5119/*0.1562044f Q15*/, 17657/*0.5388595f Q15*/, 9798/*0.2990011f Q15*/, 194/*0.0059349f Q15*/ },
+ { 3249/*0.0991379f Q15*/, 16444/*0.5018346f Q15*/, 12288/*0.3750000f Q15*/, 787/*0.0240275f Q15*/ },
+ { 1800/*0.0549361f Q15*/, 14584/*0.4450639f Q15*/, 14584/*0.4450639f Q15*/, 1800/*0.0549361f Q15*/ },
+ { 787/*0.0240275f Q15*/, 12288/*0.3750000f Q15*/, 16444/*0.5018346f Q15*/, 3249/*0.0991379f Q15*/ },
+ { 194/*0.0059349f Q15*/, 9798/*0.2990011f Q15*/, 17657/*0.5388595f Q15*/, 5119/*0.1562044f Q15*/ }
+};
+
+const Word16 inter_core_12_8kHz_output_8kHz[] =
+{
+ 17528/*0.5349196f Q15*/, 16694/*0.5094466f Q15*/, 14389/*0.4391227f Q15*/, 11141/*0.3400065f Q15*/,
+ 7620/*0.2325402f Q15*/, 4434/*0.1353016f Q15*/, 1995/*0.0608773f Q15*/, 500/*0.0152453f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_12_8kHz_output_16kHz[] =
+{
+ 14023/*0.4279357f Q15*/, 13592/*0.4147958f Q15*/, 12367/*0.3774199f Q15*/, 10533/*0.3214508f Q15*/,
+ 8350/*0.2548195f Q15*/, 6096/*0.1860321f Q15*/, 4017/*0.1225801f Q15*/, 2291/*0.0699165f Q15*/,
+ 1023/*0.0312127f Q15*/, 256/*0.0078047f Q15*/, 0/*0.0000000f Q15*/, 0/*0.0000000f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_12_8kHz_output_32kHz[] =
+{
+ 7011/*0.2139679f Q15*/, 6957/*0.2123089f Q15*/, 6796/*0.2073979f Q15*/, 6535/*0.1994284f Q15*/,
+ 6184/*0.1887100f Q15*/, 5756/*0.1756491f Q15*/, 5267/*0.1607254f Q15*/, 4734/*0.1444646f Q15*/,
+ 4175/*0.1274097f Q15*/, 3608/*0.1100939f Q15*/, 3048/*0.0930161f Q15*/, 2511/*0.0766219f Q15*/,
+ 2008/*0.0612900f Q15*/, 1551/*0.0473253f Q15*/, 1146/*0.0349583f Q15*/, 798/*0.0243509f Q15*/,
+ 511/*0.0156063f Q15*/, 288/*0.0087817f Q15*/, 128/*0.0039024f Q15*/, 32/*0.0009753f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_12_8kHz_output_48kHz[] =
+{
+ 4674/*0.1426452f Q15*/, 4658/*0.1421528f Q15*/, 4610/*0.1406841f Q15*/, 4531/*0.1382653f Q15*/,
+ 4422/*0.1349386f Q15*/, 4285/*0.1307618f Q15*/, 4122/*0.1258066f Q15*/, 3937/*0.1201564f Q15*/,
+ 3732/*0.1139041f Q15*/, 3511/*0.1071503f Q15*/, 3277/*0.1000000f Q15*/, 3033/*0.0925607f Q15*/,
+ 2783/*0.0849398f Q15*/, 2531/*0.0772420f Q15*/, 2280/*0.0695677f Q15*/, 2032/*0.0620107f Q15*/,
+ 1791/*0.0546572f Q15*/, 1559/*0.0475844f Q15*/, 1339/*0.0408600f Q15*/, 1132/*0.0345417f Q15*/,
+ 940/*0.0286774f Q15*/, 764/*0.0233055f Q15*/, 605/*0.0184558f Q15*/, 464/*0.0141503f Q15*/,
+ 341/*0.0104042f Q15*/, 237/*0.0072274f Q15*/, 152/*0.0046257f Q15*/, 85/*0.0026016f Q15*/,
+ 38/*0.0011560f Q15*/, 9/*0.0002890f Q15*/, 0/*0.0000000f Q15*/, 0/*0.0000000f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_16kHz_output_8kHz[] =
+{
+ 18079/*0.5517241f Q15*/, 17657/*0.5388595f Q15*/, 16444/*0.5018346f Q15*/, 14584/*0.4450639f Q15*/, 12288/*0.3750000f Q15*/, 9798/*0.2990011f Q15*/,
+ 7345/*0.2241379f Q15*/, 5119/*0.1562044f Q15*/, 3249/*0.0991379f Q15*/, 1800/*0.0549361f Q15*/, 787/*0.0240275f Q15*/, 194/*0.0059349f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_16kHz_output_16kHz[] =
+{
+ 18079/*0.5517241f Q15*/, 17657/*0.5388595f Q15*/, 16444/*0.5018346f Q15*/, 14584/*0.4450639f Q15*/, 12288/*0.3750000f Q15*/, 9798/*0.2990011f Q15*/,
+ 7345/*0.2241379f Q15*/, 5119/*0.1562044f Q15*/, 3249/*0.0991379f Q15*/, 1800/*0.0549361f Q15*/, 787/*0.0240275f Q15*/, 194/*0.0059349f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_16kHz_output_32kHz[] =
+{
+ 9039/*0.2758621f Q15*/, 8986/*0.2742414f Q15*/, 8829/*0.2694298f Q15*/, 8571/*0.2615753f Q15*/, 8222/*0.2509173f Q15*/, 7791/*0.2377748f Q15*/,
+ 7292/*0.2225320f Q15*/, 6738/*0.2056203f Q15*/, 6144/*0.1875000f Q15*/, 5526/*0.1686403f Q15*/, 4899/*0.1495006f Q15*/, 4277/*0.1305132f Q15*/,
+ 3672/*0.1120690f Q15*/, 3097/*0.0945060f Q15*/, 2559/*0.0781022f Q15*/, 2067/*0.0630725f Q15*/, 1624/*0.0495690f Q15*/, 1235/*0.0376861f Q15*/,
+ 900/*0.0274680f Q15*/, 620/*0.0189188f Q15*/, 394/*0.0120137f Q15*/, 220/*0.0067120f Q15*/, 97/*0.0029675f Q15*/, 24/*0.0007394f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_16kHz_output_48kHz[] =
+{
+ 6026/*0.1839080f Q15*/, 6011/*0.1834272f Q15*/, 5963/*0.1819912f Q15*/, 5886/*0.1796198f Q15*/, 5778/*0.1763457f Q15*/, 5643/*0.1722133f Q15*/,
+ 5481/*0.1672782f Q15*/, 5296/*0.1616061f Q15*/, 5088/*0.1552712f Q15*/, 4861/*0.1483546f Q15*/, 4618/*0.1409433f Q15*/, 4362/*0.1331275f Q15*/,
+ 4096/*0.1250000f Q15*/, 3823/*0.1166535f Q15*/, 3545/*0.1081796f Q15*/, 3266/*0.0996670f Q15*/, 2988/*0.0912002f Q15*/, 2715/*0.0828579f Q15*/,
+ 2448/*0.0747126f Q15*/, 2190/*0.0668293f Q15*/, 1942/*0.0592649f Q15*/, 1706/*0.0520681f Q15*/, 1484/*0.0452794f Q15*/, 1276/*0.0389306f Q15*/,
+ 1083/*0.0330460f Q15*/, 906/*0.0276422f Q15*/, 745/*0.0227295f Q15*/, 600/*0.0183120f Q15*/, 472/*0.0143894f Q15*/, 359/*0.0109575f Q15*/,
+ 262/*0.0080092f Q15*/, 181/*0.0055360f Q15*/, 116/*0.0035286f Q15*/, 65/*0.0019783f Q15*/, 29/*0.0008771f Q15*/, 7/*0.0002189f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_25_6kHz_output_8kHz[] =
+{
+ 17528/*0.5349196f Q15*/, 16694/*0.5094466f Q15*/, 14389/*0.4391227f Q15*/, 11141/*0.3400065f Q15*/,
+ 7620/*0.2325402f Q15*/, 4434/*0.1353016f Q15*/, 1995/*0.0608773f Q15*/, 500/*0.0152453f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_25_6kHz_output_16kHz[] =
+{
+ 17528/*0.5349196f Q15*/, 16694/*0.5094466f Q15*/, 14389/*0.4391227f Q15*/, 11141/*0.3400065f Q15*/,
+ 7620/*0.2325402f Q15*/, 4434/*0.1353016f Q15*/, 1995/*0.0608773f Q15*/, 500/*0.0152453f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_25_6kHz_output_32kHz[] =
+{
+ 14023/*0.4279357f Q15*/, 13592/*0.4147958f Q15*/, 12367/*0.3774199f Q15*/, 10533/*0.3214508f Q15*/,
+ 8350/*0.2548195f Q15*/, 6096/*0.1860321f Q15*/, 4017/*0.1225801f Q15*/, 2291/*0.0699165f Q15*/,
+ 1023/*0.0312127f Q15*/, 256/*0.0078047f Q15*/, 0/*0.0000000f Q15*/, 0/*0.0000000f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+const Word16 inter_core_25_6kHz_output_48kHz[] =
+{
+ 9349/*0.2852965f Q15*/, 9220/*0.2813740f Q15*/, 8843/*0.2698819f Q15*/, 8245/*0.2516166f Q15*/,
+ 7465/*0.2278099f Q15*/, 6554/*0.2000000f Q15*/, 5567/*0.1698781f Q15*/, 4559/*0.1391327f Q15*/,
+ 3582/*0.1093111f Q15*/, 2678/*0.0817166f Q15*/, 1879/*0.0573517f Q15*/, 1209/*0.0369093f Q15*/,
+ 682/*0.0208069f Q15*/, 303/*0.0092505f Q15*/, 76/*0.0023118f Q15*/, 0/*0.0000000f Q15*/,
+ 0/*0.0000000f Q15*/
+};
+
+const TCX_LTP_FILTER tcxLtpFilters[12] =
+{
+ { inter_core_12_8kHz_output_8kHz, 2 },
+ { inter_core_12_8kHz_output_16kHz, 3 },
+ { inter_core_12_8kHz_output_32kHz, 5 },
+ { inter_core_12_8kHz_output_48kHz, 8 },
+ { inter_core_16kHz_output_8kHz, 2 },
+ { inter_core_16kHz_output_16kHz, 2 },
+ { inter_core_16kHz_output_32kHz, 4 },
+ { inter_core_16kHz_output_48kHz, 6 },
+ { inter_core_25_6kHz_output_8kHz, 2 },
+ { inter_core_25_6kHz_output_16kHz, 2 },
+ { inter_core_25_6kHz_output_32kHz, 3 },
+ { inter_core_25_6kHz_output_48kHz, 4 },
+};
+
+
+
+const SCALE_TCX_SETUP scaleTcxTable[SIZE_SCALE_TABLE_TCX] =
+{
+ { 0, 0, 8000, /* 0.67f ,*/ 21955/*0.67f Q15*/ },
+ { 0, 8000, 9600, /* 0.70f ,*/ 22938/*0.70f Q15*/ },
+ { 0, 9600, 13200, /* 0.76f ,*/ 24904/*0.76f Q15*/ },
+ { 0, 13200, 16400, /* 0.86f ,*/ 28180/*0.86f Q15*/ },
+ { 0, 16400, 24400, /* 0.90f ,*/ 29491/*0.90f Q15*/ },
+ { 0, 24400, 64000, /* 0.96f ,*/ 31457/*0.96f Q15*/ },
+ { 1, 0, 8000, /* 1.f ,*/ 32767/*1.f Q15*/ },
+ { 1, 8000, 9600, /* 1.f ,*/ 32767/*1.f Q15*/ },
+ { 1, 9600, 13200, /* 1.f ,*/ 32767/*1.f Q15*/ },
+ { 1, 13200, 16400, /* 0.85f ,*/ 27853/*0.85f Q15*/ },
+ { 1, 16400, 24400, /* 0.88f ,*/ 28836/*0.88f Q15*/ },
+ { 1, 24400, 32000, /* 0.90f ,*/ 29491/*0.90f Q15*/ },
+ { 1, 32000, 32400, /* 0.95f ,*/ 31130/*0.95f Q15*/ },
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Arithmetic coder
+ *----------------------------------------------------------------------------------*/
+
+const UWord8 ari_lookup_s17_LC[4096] = // Q0
+{
+ 0x01,0x04,0x29,0x13,0x0A,0x0D,0x05,0x10,
+ 0x10,0x0D,0x00,0x0D,0x2A,0x2A,0x22,0x25,
+ 0x25,0x28,0x2B,0x2E,0x31,0x34,0x34,0x0E,
+ 0x21,0x21,0x21,0x36,0x38,0x38,0x36,0x10,
+ 0x10,0x08,0x09,0x0B,0x0C,0x0E,0x0E,0x21,
+ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x10,
+ 0x10,0x1A,0x09,0x1D,0x0C,0x20,0x20,0x21,
+ 0x36,0x36,0x36,0x36,0x36,0x0A,0x36,0x16,
+ 0x1A,0x1A,0x2D,0x0C,0x20,0x20,0x21,0x21,
+ 0x21,0x36,0x38,0x38,0x38,0x38,0x36,0x16,
+ 0x16,0x1A,0x3F,0x1F,0x20,0x21,0x24,0x06,
+ 0x36,0x36,0x36,0x38,0x00,0x0A,0x36,0x22,
+ 0x3E,0x3E,0x3F,0x30,0x20,0x21,0x06,0x06,
+ 0x06,0x38,0x36,0x36,0x36,0x26,0x36,0x1C,
+ 0x1C,0x3E,0x3F,0x02,0x20,0x21,0x06,0x36,
+ 0x36,0x38,0x0A,0x0A,0x0A,0x0A,0x05,0x16,
+ 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
+ 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16,
+ 0x16,0x3F,0x3F,0x0E,0x35,0x14,0x38,0x38,
+ 0x05,0x05,0x05,0x0D,0x13,0x13,0x1C,0x16,
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
+ 0x3F,0x3F,0x3F,0x20,0x35,0x14,0x27,0x38,
+ 0x38,0x0A,0x2A,0x2A,0x2A,0x16,0x05,0x10,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x3F,0x02,0x0E,0x02,0x14,0x13,0x0A,
+ 0x0D,0x0D,0x0D,0x13,0x00,0x00,0x16,0x19,
+ 0x19,0x3F,0x3F,0x02,0x02,0x14,0x38,0x36,
+ 0x0A,0x0A,0x0A,0x0D,0x0D,0x0D,0x1C,0x22,
+ 0x22,0x3F,0x3F,0x02,0x17,0x26,0x26,0x1C,
+ 0x1C,0x10,0x16,0x16,0x16,0x19,0x22,0x25,
+ 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x15,0x2C,0x2E,0x2E,0x2E,0x31,
+ 0x31,0x31,0x31,0x31,0x31,0x31,0x34,0x39,
+ 0x39,0x39,0x15,0x2C,0x2E,0x2E,0x0C,0x34,
+ 0x34,0x34,0x36,0x36,0x36,0x36,0x36,0x36,
+ 0x36,0x39,0x15,0x3C,0x2E,0x31,0x34,0x34,
+ 0x31,0x31,0x31,0x1F,0x1E,0x1E,0x1E,0x1E,
+ 0x1E,0x39,0x28,0x2C,0x2E,0x31,0x37,0x34,
+ 0x01,0x01,0x01,0x01,0x01,0x00,0x39,0x39,
+ 0x39,0x39,0x39,0x2C,0x2E,0x31,0x1E,0x34,
+ 0x34,0x35,0x01,0x01,0x01,0x01,0x01,0x01,
+ 0x01,0x39,0x39,0x3C,0x2E,0x03,0x07,0x34,
+ 0x34,0x0F,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x15,0x2B,0x31,0x1E,0x34,
+ 0x34,0x01,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x2C,0x39,0x2F,0x2E,0x2E,
+ 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
+ 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
+ 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
+ 0x2E,0x39,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
+ 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
+ 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
+ 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,
+ 0x1E,0x1E,0x1E,0x1E,0x1E,0x0F,0x2E,0x2E,
+ 0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,0x2E,
+ 0x2E,0x2E,0x39,0x15,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x39,
+ 0x19,0x1C,0x16,0x22,0x22,0x25,0x25,0x25,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x3E,0x3E,0x2F,0x3D,0x21,0x36,0x38,0x05,
+ 0x0D,0x0D,0x0D,0x10,0x16,0x16,0x16,0x25,
+ 0x2D,0x2D,0x37,0x3D,0x33,0x38,0x05,0x0D,
+ 0x0D,0x10,0x16,0x16,0x16,0x16,0x16,0x25,
+ 0x2F,0x2F,0x30,0x12,0x06,0x05,0x0A,0x0D,
+ 0x0D,0x10,0x16,0x16,0x16,0x22,0x22,0x25,
+ 0x1F,0x1F,0x32,0x3B,0x29,0x0A,0x0A,0x10,
+ 0x16,0x16,0x16,0x16,0x22,0x22,0x22,0x25,
+ 0x02,0x02,0x14,0x29,0x05,0x0D,0x2A,0x10,
+ 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
+ 0x35,0x35,0x14,0x29,0x0A,0x2A,0x2A,0x10,
+ 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
+ 0x17,0x17,0x26,0x05,0x0D,0x10,0x10,0x16,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x25,
+ 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,
+ 0x26,0x26,0x26,0x26,0x26,0x26,0x26,0x26,
+ 0x26,0x26,0x26,0x1C,0x0D,0x16,0x16,0x16,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x25,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x26,0x1C,0x1C,0x10,0x16,0x16,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x25,0x25,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x1C,0x1C,0x1C,0x16,0x16,0x16,0x22,
+ 0x22,0x22,0x22,0x25,0x25,0x25,0x25,0x00,
+ 0x00,0x26,0x1C,0x1C,0x16,0x16,0x16,0x22,
+ 0x22,0x22,0x22,0x25,0x25,0x25,0x25,0x00,
+ 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x22,
+ 0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x00,
+ 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
+ 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15,
+ 0x15,0x15,0x3C,0x1E,0x0F,0x06,0x27,0x2A,
+ 0x2A,0x10,0x16,0x16,0x16,0x16,0x16,0x22,
+ 0x2C,0x2C,0x0B,0x37,0x23,0x27,0x13,0x2A,
+ 0x10,0x10,0x10,0x16,0x16,0x16,0x16,0x22,
+ 0x1B,0x1B,0x1D,0x0F,0x24,0x13,0x13,0x2A,
+ 0x00,0x10,0x16,0x16,0x16,0x16,0x16,0x22,
+ 0x1F,0x1F,0x03,0x24,0x07,0x0A,0x0A,0x10,
+ 0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x22,
+ 0x22,0x35,0x06,0x27,0x13,0x2A,0x2A,0x10,
+ 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x22,
+ 0x22,0x06,0x27,0x27,0x13,0x2A,0x2A,0x10,
+ 0x16,0x16,0x16,0x16,0x16,0x16,0x22,0x22,
+ 0x22,0x05,0x0A,0x2A,0x2A,0x10,0x10,0x16,
+ 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,
+ 0x22,0x0D,0x2A,0x10,0x10,0x10,0x10,0x16,
+ 0x16,0x16,0x16,0x16,0x16,0x22,0x22,0x25,
+ 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
+ 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
+ 0x10,0x10,0x10,0x10,0x10,0x16,0x16,0x16,
+ 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
+ 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
+ 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,
+ 0x10,0x10,0x10,0x10,0x16,0x16,0x16,0x16,
+ 0x16,0x22,0x22,0x22,0x22,0x22,0x22,0x25,
+ 0x0D,0x0D,0x10,0x10,0x10,0x16,0x16,0x16,
+ 0x16,0x22,0x22,0x22,0x22,0x22,0x22,0x25,
+ 0x0D,0x0D,0x0D,0x0D,0x0D,0x10,0x10,0x16,
+ 0x16,0x16,0x16,0x22,0x22,0x22,0x22,0x25,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x3A,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x11,0x3A,0x3A,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x18,
+ 0x00,0x11,0x3A,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x11,0x11,0x11,0x18,0x18,0x18,0x18,
+ 0x18,0x25,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x3A,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x18,0x18,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x18,0x18,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x18,0x18,0x18,0x18,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x11,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x11,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x11,0x11,0x11,0x3A,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x18,0x3A,0x3A,0x11,0x11,0x11,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x11,0x11,0x11,0x3A,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
+ 0x18,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x11,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x2A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x18,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x11,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x11,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,
+ 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A
+};
+
+const UWord16 ari_pk_s17_LC_ext[64][18] = // Q0
+{
+ {
+ 16384, 16368,16337,16231,16143,16115,16059,15916,15793,15710,15586,15472,15367,15302,15201,15107,15020,
+ 0
+ },
+ {
+ 16384, 8983, 8540, 8498, 8485, 4319, 3666, 3594, 3579, 2285, 1908, 1851, 1835, 1326, 1120, 1085, 1074,
+ 0
+ },
+ {
+ 16384, 12022,10039, 9520, 9346, 7347, 5335, 4648, 4382, 3815, 3083, 2728, 2562, 2363, 2050, 1869, 1777,
+ 0
+ },
+ {
+ 16384, 13429,11201,10562,10371, 8231, 5713, 4770, 4441, 3798, 2844, 2359, 2152, 1947, 1614, 1406, 1304,
+ 0
+ },
+ {
+ 16384, 13229,11403,10769,10529, 8415, 6431, 5645, 5311, 4448, 3547, 3176, 3001, 2617, 2181, 1984, 1886,
+ 0
+ },
+ {
+ 16384, 15168,13754,13120,12826,11553, 9705, 8723, 8227, 7675, 6762, 6180, 5842, 5585, 5141, 4816, 4607,
+ 0
+ },
+ {
+ 16384, 14625,12743,12034,11772,10059, 7706, 6652, 6223, 5594, 4594, 4023, 3742, 3501, 3089, 2818, 2664,
+ 0
+ },
+ {
+ 16384, 15275,13679,12951,12652,11158, 8852, 7652, 7121, 6406, 5242, 4542, 4196, 3894, 3398, 3063, 2864,
+ 0
+ },
+ {
+ 16384, 4860, 3338, 3214, 3193, 1428, 676, 571, 547, 356, 222, 189, 180, 139, 102, 89, 84,
+ 0
+ },
+ {
+ 16384, 8357, 5798, 5475, 5410, 3093, 1523, 1227, 1152, 849, 560, 470, 441, 370, 294, 261, 248,
+ 0
+ },
+ {
+ 16384, 15550,14350,13710,13387,12297,10541, 9493, 8929, 8354, 7371, 6696, 6299, 6008, 5491, 5107, 4856,
+ 0
+ },
+ {
+ 16384, 10346, 7298, 6933, 6865, 4052, 1863, 1471, 1381, 1055, 673, 536, 491, 429, 339, 293, 273,
+ 0
+ },
+ {
+ 16384, 11652, 8699, 8030, 7839, 5667, 3460, 2766, 2532, 2093, 1542, 1301, 1203, 1070, 893, 802, 759,
+ 0
+ },
+ {
+ 16384, 15639,14601,14037,13729,12847,11421,10520, 9978, 9521, 8720, 8136, 7750, 7493, 7033, 6676, 6426,
+ 0
+ },
+ {
+ 16384, 12427, 9590, 8715, 8386, 6641, 4708, 3886, 3515, 3071, 2490, 2198, 2052, 1886, 1670, 1549, 1478,
+ 0
+ },
+ {
+ 16384, 13605,10996,10363,10183, 7802, 5032, 4124, 3840, 3267, 2403, 1976, 1804, 1633, 1345, 1171, 1086,
+ 0
+ },
+ {
+ 16384, 15936,15224,14759,14464,13808,12678,11866,11331,10910,10150, 9549, 9122, 8853, 8352, 7938, 7626,
+ 0
+ },
+ {
+ 16384, 16383,16382,14829,14138,14137,14136,12895,12272,10935, 9788, 9082, 8674, 8073, 7508, 7118, 6867,
+ 0
+ },
+ {
+ 16384, 13888,11474,10840,10662, 8335, 5585, 4695, 4411, 3801, 2917, 2506, 2337, 2150, 1847, 1672, 1581,
+ 0
+ },
+ {
+ 16384, 15463,14162,13504,13196,11977,10063, 8978, 8429, 7811, 6768, 6088, 5705, 5406, 4882, 4504, 4266,
+ 0
+ },
+ {
+ 16384, 13764,11941,11367,11151, 9312, 7171, 6301, 5943, 5335, 4430, 3942, 3708, 3466, 3074, 2819, 2679,
+ 0
+ },
+ {
+ 16384, 5179, 3300, 3206, 3197, 1220, 374, 303, 293, 171, 81, 63, 59, 44, 29, 24, 22,
+ 0
+ },
+ {
+ 16384, 16026,15468,15096,14842,14329,13447,12790,12322,11985,11367,10860,10477,10248, 9811, 9443, 9148,
+ 0
+ },
+ {
+ 16384, 12809,11291,10848,10649, 8976, 7199, 6506, 6196, 5657, 4887, 4451, 4219, 3974, 3590, 3365, 3218,
+ 0
+ },
+ {
+ 16384, 16383,16382,15744,15348,15347,15346,14714,14288,13688,13097,12652,12328,11967,11584,11278,11045,
+ 0
+ },
+ {
+ 16384, 15415,14987,14866,14806,13751,13046,12818,12709,12187,11720,11527,11427,11096,10759,10601,10510,
+ 0
+ },
+ {
+ 16384, 5926, 4280, 4090, 4053, 2138, 1120, 947, 903, 632, 413, 353, 334, 264, 198, 174, 166,
+ 0
+ },
+ {
+ 16384, 9206, 6640, 6345, 6291, 3683, 1772, 1423, 1342, 1024, 652, 515, 467, 406, 314, 267, 245,
+ 0
+ },
+ {
+ 16384, 15086,13966,13505,13271,12238,10875,10157, 9763, 9331, 8629, 8155, 7845, 7608, 7198, 6892, 6670,
+ 0
+ },
+ {
+ 16384, 11427, 8599, 8132, 8027, 5406, 3012, 2429, 2270, 1823, 1244, 1006, 920, 814, 654, 564, 524,
+ 0
+ },
+ {
+ 16384, 11561, 8220, 7814, 7737, 4780, 2215, 1731, 1621, 1279, 830, 657, 599, 532, 424, 366, 339,
+ 0
+ },
+ {
+ 16384, 11649, 9374, 8867, 8724, 6398, 4154, 3470, 3253, 2718, 2010, 1695, 1570, 1412, 1172, 1042, 980,
+ 0
+ },
+ {
+ 16384, 13021,10503, 9726, 9443, 7520, 5271, 4369, 4016, 3495, 2741, 2365, 2181, 1990, 1719, 1561, 1478,
+ 0
+ },
+ {
+ 16384, 13815,11388,10605,10316, 8467, 6133, 5175, 4782, 4255, 3466, 3063, 2864, 2688, 2408, 2229, 2125,
+ 0
+ },
+ {
+ 16384, 16175,15807,15536,15338,15006,14402,13919,13549,13312,12871,12491,12182,12010,11681,11390,11143,
+ 0
+ },
+ {
+ 16384, 14310,12047,11336,11110, 9065, 6381, 5318, 4938, 4279, 3272, 2732, 2499, 2284, 1920, 1693, 1574,
+ 0
+ },
+ {
+ 16384, 14765,12824,12096,11834,10003, 7429, 6282, 5841, 5145, 4022, 3402, 3123, 2868, 2426, 2150, 2003,
+ 0
+ },
+ {
+ 16384, 16295,16127,15943,15802,15650,15360,15059,14816,14668,14401,14162,13954,13839,13634,13443,13275,
+ 0
+ },
+ {
+ 16384, 14182,12821,12340,12120,10698, 9040, 8284, 7908, 7378, 6549, 6053, 5772, 5520, 5080, 4785, 4597,
+ 0
+ },
+ {
+ 16384, 15164,13583,12892,12600,11161, 8997, 7888, 7386, 6744, 5673, 5015, 4673, 4391, 3898, 3555, 3349,
+ 0
+ },
+ {
+ 16384, 3758, 2571, 2481, 2467, 988, 478, 412, 397, 245, 154, 133, 127, 95, 69, 61, 58,
+ 0
+ },
+ {
+ 16384, 14805,13193,12553,12285,10706, 8596, 7623, 7178, 6542, 5563, 4996, 4703, 4426, 3967, 3662, 3482,
+ 0
+ },
+ {
+ 16384, 15787,14870,14320,14005,13147,11705,10747,10171, 9651, 8735, 8068, 7629, 7332, 6785, 6361, 6061,
+ 0
+ },
+ {
+ 16384, 7111, 4622, 4304, 4233, 2346, 1174, 938, 870, 659, 455, 389, 365, 316, 260, 236, 226,
+ 0
+ },
+ {
+ 16384, 7146, 4703, 4532, 4512, 2078, 740, 583, 556, 371, 201, 153, 141, 118, 87, 72, 66,
+ 0
+ },
+ {
+ 16384, 9593, 7184, 6853, 6790, 4144, 2206, 1832, 1745, 1320, 878, 741, 697, 599, 476, 424, 401,
+ 0
+ },
+ {
+ 16384, 9209, 5969, 5479, 5351, 3346, 1763, 1382, 1261, 1017, 733, 622, 578, 520, 446, 410, 392,
+ 0
+ },
+ {
+ 16384, 11324, 8681, 8252, 8159, 5450, 3114, 2606, 2473, 1987, 1412, 1211, 1142, 1017, 847, 765, 730,
+ 0
+ },
+ {
+ 16384, 12663,10073, 9527, 9392, 6827, 4204, 3489, 3286, 2713, 1966, 1666, 1554, 1400, 1172, 1051, 994,
+ 0
+ },
+ {
+ 16384, 10413, 7096, 6340, 6115, 4393, 2704, 2156, 1947, 1634, 1254, 1091, 1010, 925, 805, 742, 707,
+ 0
+ },
+ {
+ 16384, 13337,11073,10477,10306, 8045, 5534, 4705, 4438, 3804, 2942, 2530, 2360, 2164, 1850, 1668, 1574,
+ 0
+ },
+ {
+ 16384, 14323,12104,11391,11156, 9183, 6649, 5649, 5287, 4676, 3778, 3302, 3089, 2886, 2548, 2341, 2223,
+ 0
+ },
+ {
+ 16384, 11646, 8435, 7504, 7150, 5603, 3882, 3170, 2853, 2487, 2029, 1791, 1666, 1549, 1386, 1288, 1231,
+ 0
+ },
+ {
+ 16384, 13147,11339,10752,10524, 8775, 6682, 5776, 5398, 4813, 3908, 3406, 3154, 2933, 2554, 2310, 2176,
+ 0
+ },
+ {
+ 16384, 14551,12495,11707,11356, 9962, 8005, 7006, 6500, 6034, 5298, 4839, 4575, 4381, 4057, 3825, 3673,
+ 0
+ },
+ {
+ 16384, 12395, 9526, 9032, 8925, 6130, 3448, 2813, 2649, 2144, 1489, 1231, 1142, 1020, 836, 738, 694,
+ 0
+ },
+ {
+ 16384, 14921,13187,12475,12164,10758, 8775, 7752, 7257, 6727, 5864, 5306, 5004, 4777, 4393, 4119, 3942,
+ 0
+ },
+ {
+ 16384, 2151, 1301, 1276, 1274, 315, 84, 70, 68, 32, 14, 11, 10, 7, 4, 3, 2,
+ 0
+ },
+ {
+ 16384, 16383,16382,13774,13091,13090,13089,11287,10713, 7917, 6052, 5265, 4947, 4161, 3534, 3199, 3039,
+ 0
+ },
+ {
+ 16384, 14374,12331,11688,11474, 9505, 6993, 5998, 5634, 4991, 4008, 3498, 3265, 3036, 2658, 2417, 2285,
+ 0
+ },
+ {
+ 16384, 8798, 5867, 5626, 5593, 2841, 1038, 807, 765, 538, 302, 234, 215, 182, 139, 119, 111,
+ 0
+ },
+ {
+ 16384, 13325,10612,10015, 9860, 7343, 4583, 3802, 3571, 3023, 2269, 1945, 1817, 1670, 1440, 1309, 1243,
+ 0
+ },
+ {
+ 16384, 7741, 5790, 5571, 5528, 3110, 1698, 1464, 1409, 1034, 704, 613, 585, 487, 381, 342, 327,
+ 0
+ },
+ {
+ 16384, 9664, 7506, 7059, 6917, 4820, 3136, 2640, 2455, 2000, 1504, 1297, 1217, 1073, 896, 815, 777,
+ 0
+ }
+};
+
+const Word16 NumRatioBits[2][17] =
+{
+ /* NB */
+ {
+ 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2
+ },
+
+ /* WB */
+ {
+ 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2
+ }
+}; // Q0
+
+/* 7Q8 */
+const Word16 Ratios_WB_2_fx[32] =
+/* 2 */{ 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 15360, 16384, 18432 };
+const Word16 Ratios_WB_3_fx[32] =/* 7Q8 */
+/* 3 */{ 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 11264, 12288, 13824, 15360, 17408, 19968, 20480 };
+const Word16 Ratios_WB_4_fx[32] =/* 7Q8 */
+/* 4 */{ 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 10752, 11264, 12288, 13312, 13824, 17408 };
+const Word16 Ratios_WB_5_fx[32] =/* 7Q8 */
+/* 5 */{ 256, 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 10240, 11264, 12288, 13824 };
+const Word16 Ratios_WB_6_fx[32] =/* 7Q8 */
+/* 6 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536, 1664, 1792, 1920, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 8704, 10240, 10496 };
+const Word16 Ratios_WB_7_fx[32] =/* 7Q8 */
+/* 7 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5760, 6144, 6400, 6912, 7168, 7680, 8960 };
+const Word16 Ratios_WB_8_fx[16] =/* 7Q8 */
+/* 8 */{ 128, 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536, 1792, 2048, 2304, 2560 };
+const Word16 Ratios_WB_9_fx[16] =/* 7Q8 */
+/* 9 */{ 256, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3840, 4096, 4608, 6912 };
+const Word16 Ratios_WB_10_fx[16] =/* 7Q8 */
+/* 10 */{ 256, 384, 512, 640, 768, 896, 1024, 1280, 1536, 2048, 2560, 3840, 4608, 5632, 6144, 6656 };
+const Word16 Ratios_WB_11_fx[16] =/* 7Q8 */
+/* 11 */{ 256, 384, 512, 640, 768, 896, 1024, 1280, 1536, 2048, 2560, 3072, 3328, 3584, 4608, 5376 };
+const Word16 Ratios_WB_12_fx[16] =/* 7Q8 */
+/* 12 */{ 128, 256, 384, 512, 640, 768, 1024, 1280, 1536, 2048, 2304, 2816, 3072, 3456, 4096, 5120 };
+const Word16 Ratios_WB_13_fx[16] =/* 7Q8 */
+/* 13 */{ 128, 256, 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2560, 2816, 3072, 3584, 5120 };
+const Word16 Ratios_WB_14_fx[16] =/* 7Q8 */
+/* 14 */{ 128, 256, 384, 512, 640, 768, 1024, 1152, 1536, 1920, 2304, 2560, 3072, 3584, 3840, 4608 };
+const Word16 Ratios_WB_15_fx[16] =/* 7Q8 */
+/* 15 */{ 128, 256, 320, 384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 2048, 2304, 3584 };
+const Word16 Ratios_WB_16_fx[4] =/* 7Q8 */
+/* 16 */{ 128, 256, 512, 1024 };
+const Word16 Ratios_WB_17_fx[4] =/* 7Q8 */
+/* 17 */{ 256, 384, 512, 1024 };
+const Word16 Ratios_WB_18_fx[4] =/* 7Q8 */
+/* 18 */{ 256, 512, 768, 1024 };
+
+/******************************************************************************/
+
+/* 7Q8 */
+const Word16 Ratios_NB_2_fx[32] =
+/* 2 */{ 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 5888, 6144, 6400, 6656, 6912, 7168, 7680, 8192, 8704, 9216, 9728, 10240 };
+const Word16 Ratios_NB_3_fx[16] =/* 7Q8 */
+/* 3 */{ 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 4096, 5120, 6144, 7680 };
+const Word16 Ratios_NB_4_fx[16] =/* 7Q8 */
+/* 4 */{ 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 6144, 7680 };
+const Word16 Ratios_NB_5_fx[16] =/* 7Q8 */
+/* 5 */{ 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 6144, 7680 };
+const Word16 Ratios_NB_6_fx[16] =/* 7Q8 */
+/* 6 */{ 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120 };
+const Word16 Ratios_NB_7_fx[16] =/* 7Q8 */
+/* 7 */{ 256, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120 };
+const Word16 Ratios_NB_8_fx[16] =/* 7Q8 */
+/* 8 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 4096 };
+const Word16 Ratios_NB_9_fx[8] =/* 7Q8 */
+/* 9 */{ 256, 512, 768, 1024, 1280, 1536, 2048, 2560 };
+const Word16 Ratios_NB_10_fx[8] =/* 7Q8 */
+/* 10 */{ 256, 512, 768, 1024, 1280, 1536, 2048, 2560 };
+const Word16 Ratios_NB_11_fx[8] =/* 7Q8 */
+/* 11 */{ 256, 384, 512, 768, 1024, 1280, 1536, 2048 };
+const Word16 Ratios_NB_12_fx[8] =/* 7Q8 */
+/* 12 */{ 256, 512, 640, 768, 1024, 1280, 1536, 2048 };
+const Word16 Ratios_NB_13_fx[4] =/* 7Q8 */
+/* 13 */{ 256, 512, 768, 1024 };
+const Word16 Ratios_NB_14_fx[4] =/* 7Q8 */
+/* 14 */{ 256, 512, 1024, 1536 };
+const Word16 Ratios_NB_15_fx[4] =/* 7Q8 */
+/* 15 */{ 256, 512, 768, 1024 };
+const Word16 Ratios_NB_16_fx[4] =/* 7Q8 */
+/* 16 */{ 256, 384, 512, 1024 };
+const Word16 Ratios_NB_17_fx[4] =/* 7Q8 */
+/* 17 */{ 256, 384, 512, 768 };
+const Word16 Ratios_NB_18_fx[4] =/* 7Q8 */
+/* 18 */{ 128, 256, 512, 768 };
+
+/******************************************************************************/
+
+const Word16 *const Ratios_fx[2][17] =/* 7Q8 */
+{
+ /* NB */
+ {
+ Ratios_NB_2_fx,
+ Ratios_NB_3_fx,
+ Ratios_NB_4_fx,
+ Ratios_NB_5_fx,
+ Ratios_NB_6_fx,
+ Ratios_NB_7_fx,
+ Ratios_NB_8_fx,
+ Ratios_NB_9_fx,
+ Ratios_NB_10_fx,
+ Ratios_NB_11_fx,
+ Ratios_NB_12_fx,
+ Ratios_NB_13_fx,
+ Ratios_NB_14_fx,
+ Ratios_NB_15_fx
+ , Ratios_NB_16_fx
+ , Ratios_NB_17_fx
+ , Ratios_NB_18_fx
+ },
+
+ /* WB */
+ {
+ Ratios_WB_2_fx,
+ Ratios_WB_3_fx,
+ Ratios_WB_4_fx,
+ Ratios_WB_5_fx,
+ Ratios_WB_6_fx,
+ Ratios_WB_7_fx,
+ Ratios_WB_8_fx,
+ Ratios_WB_9_fx,
+ Ratios_WB_10_fx,
+ Ratios_WB_11_fx,
+ Ratios_WB_12_fx,
+ Ratios_WB_13_fx,
+ Ratios_WB_14_fx,
+ Ratios_WB_15_fx
+ , Ratios_WB_16_fx
+ , Ratios_WB_17_fx
+ , Ratios_WB_18_fx
+ }
+};
+#define QGC(x) FL2WORD16_SCALE(x, 4)
+const Word16 qGains[2][1 << kTcxHmNumGainBits] =
+{
+ /* GC */ { QGC(0.75f) },
+ /* VC */ { QGC(0.6f), QGC(1.4f), QGC(4.5f), QGC(10.0f) }
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * TNS
+ *----------------------------------------------------------------------------------*/
+
+const struct TnsParameters tnsParametersIGF32kHz_LowBR[1] =
+{
+ { 600, 3, /*1.85f, 0.075f, 4.4f,*/ 237/*1.85f Q7*/, 15518925/*1.85f Q23*/, 2458/*0.075f Q15*/,563 /*4.4f Q7*/ }
+};
+
+const struct TnsParameters tnsParameters32kHz[2] =
+{
+ { 4500, 3, /*1.35f, 0.0300f, 1.0f ,*/ 173/*1.35f Q7*/,11324621/*1.35f Q23*/, 983/*0.0300f Q15*/, 128/*1.0f Q7*/},
+ { 600, 1, /*1.75f, 0.0625f, 4.4f ,*/ 224/*1.75f Q7*/,14680064/*1.75f Q23*/, 2048/*0.0625f Q15*/, 563 /*4.4f Q7*/ }
+};
+
+const struct TnsParameters tnsParameters32kHz_grouped[2] =
+{
+ { 8400, 3, /*1.375f, 0.03125f, 1.0f ,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/ },
+ { 800, 3, /*1.375f, 0.03125f, 1.0f ,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/}
+};
+
+const struct TnsParameters tnsParameters16kHz[1] =
+{
+ { 600, 3, /*1.5f, 0.05f, 4.4f,*/ 192/*1.5f Q7*/, 12582912/*1.5f Q23*/, 1638/*0.05f Q15*/ ,563 /*4.4f Q7*/ }
+};
+
+const struct TnsParameters tnsParameters16kHz_grouped[2] =
+{
+ { 4400, 3, /*1.5f, 0.05f, 1.0f,*/ 192/*1.5f Q7*/, 12582912/*1.5f Q23*/, 1638/*0.05f Q15*/ , 128/*1.0f Q7*/},
+ { 800, 3, /*1.5f, 0.05f, 1.0f,*/ 192/*1.5f Q7*/, 12582912/*1.5f Q23*/, 1638/*0.05f Q15*/ , 128/*1.0f Q7*/}
+};
+
+const struct TnsParameters tnsParameters48kHz_grouped[2] =
+{
+ { 10400, 3, /*1.375f, 0.03125f, 1.0f,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/},
+ { 800, 3, /*1.375f, 0.03125f, 1.0f,*/ 176/*1.375f Q7*/,11534336/*1.375f Q23*/, 1024/*0.03125f Q15*/ , 128/*1.0f Q7*/ }
+};
+
+const struct TnsParameters tnsParameters32kHz_Stereo[2]=
+{
+ { 4500, 3, /*1.35f, 0.0300f, 1.0f ,*/ 173/*1.35f Q7*/, 11324621/*1.35f Q23*/, 983/*0.0300f Q15*/ , 128/*1.0f Q7*/},
+ { 600, 3, /*1.75f, 0.0625f, 4.4f ,*/ 224/*1.75f Q7*/,14680064/*1.75f Q23*/, 2048/*0.0625f Q15*/ ,563 /*4.4f Q7*/ }
+};
+
+const Word16 tnsAcfWindow_fx[TNS_MAX_FILTER_ORDER] =
+{
+ 32696/*0.997803f Q15*/, 32480/*0.991211f Q15*/, 32120/*0.980225f Q15*/, 31616/*0.964844f Q15*/, 30968/*0.945068f Q15*/, 30176/*0.920898f Q15*/, 29240/*0.892334f Q15*/, 28160/*0.859375f Q15*/
+};
+
+
+/* Definition of the mapping between TNS parameters and a bitstream */
+/* Helper structures for hufmann table coding */
+
+const Coding codesTnsCoeff0TCX20[] =
+{
+ { -8+INDEX_SHIFT, 609, 11 }, /* 01001100001 */
+ { -7+INDEX_SHIFT, 305, 10 }, /* 0100110001 */
+ { -6+INDEX_SHIFT, 77, 8 }, /* 01001101 */
+ { -5+INDEX_SHIFT, 39, 7 }, /* 0100111 */
+ { -4+INDEX_SHIFT, 8, 5 }, /* 01000 */
+ { -3+INDEX_SHIFT, 21, 5 }, /* 10101 */
+ { -2+INDEX_SHIFT, 11, 4 }, /* 1011 */
+ { -1+INDEX_SHIFT, 3, 3 }, /* 011 */
+ { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 1+INDEX_SHIFT, 0, 2 }, /* 00 */
+ { 2+INDEX_SHIFT, 4, 3 }, /* 100 */
+ { 3+INDEX_SHIFT, 5, 4 }, /* 0101 */
+ { 4+INDEX_SHIFT, 20, 5 }, /* 10100 */
+ { 5+INDEX_SHIFT, 18, 6 }, /* 010010 */
+ { 6+INDEX_SHIFT, 153, 9 }, /* 010011001 */
+ { 7+INDEX_SHIFT, 608, 11 } /* 01001100000 */
+};
+
+const Coding codesTnsCoeff0TCX10[] =
+{
+ { -8+INDEX_SHIFT, 441, 9 }, /* 110111001 */
+ { -7+INDEX_SHIFT, 111, 7 }, /* 1101111 */
+ { -6+INDEX_SHIFT, 8, 4 }, /* 1000 */
+ { -5+INDEX_SHIFT, 9, 4 }, /* 1001 */
+ { -4+INDEX_SHIFT, 14, 4 }, /* 1110 */
+ { -3+INDEX_SHIFT, 15, 4 }, /* 1111 */
+ { -2+INDEX_SHIFT, 3, 3 }, /* 011 */
+ { -1+INDEX_SHIFT, 5, 3 }, /* 101 */
+ { 0+INDEX_SHIFT, 0, 2 }, /* 00 */
+ { 1+INDEX_SHIFT, 2, 3 }, /* 010 */
+ { 2+INDEX_SHIFT, 12, 4 }, /* 1100 */
+ { 3+INDEX_SHIFT, 26, 5 }, /* 11010 */
+ { 4+INDEX_SHIFT, 54, 6 }, /* 110110 */
+ { 5+INDEX_SHIFT, 221, 8 }, /* 11011101 */
+ { 6+INDEX_SHIFT, 881, 10 }, /* 1101110001 */
+ { 7+INDEX_SHIFT, 880, 10 } /* 1101110000 */
+};
+
+const Coding codesTnsCoeff1TCX20[] =
+{
+ { -8+INDEX_SHIFT, 30018, 15 }, /* 111010101000010 */
+ { -7+INDEX_SHIFT, 30019, 15 }, /* 111010101000011 */
+ { -6+INDEX_SHIFT, 7505, 13 }, /* 1110101010001 */
+ { -5+INDEX_SHIFT, 3753, 12 }, /* 111010101001 */
+ { -4+INDEX_SHIFT, 939, 10 }, /* 1110101011 */
+ { -3+INDEX_SHIFT, 235, 8 }, /* 11101011 */
+ { -2+INDEX_SHIFT, 28, 5 }, /* 11100 */
+ { -1+INDEX_SHIFT, 6, 3 }, /* 110 */
+ { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
+ { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 2+INDEX_SHIFT, 15, 4 }, /* 1111 */
+ { 3+INDEX_SHIFT, 59, 6 }, /* 111011 */
+ { 4+INDEX_SHIFT, 116, 7 }, /* 1110100 */
+ { 5+INDEX_SHIFT, 468, 9 }, /* 111010100 */
+ { 6+INDEX_SHIFT, 1877, 11 }, /* 11101010101 */
+ { 7+INDEX_SHIFT, 15008, 14 } /* 11101010100000 */
+};
+
+const Coding codesTnsCoeff1TCX10[] =
+{
+ { -8+INDEX_SHIFT, 2818, 12 }, /* 101100000010 */
+ { -7+INDEX_SHIFT, 2819, 12 }, /* 101100000011 */
+ { -6+INDEX_SHIFT, 705, 10 }, /* 1011000001 */
+ { -5+INDEX_SHIFT, 353, 9 }, /* 101100001 */
+ { -4+INDEX_SHIFT, 177, 8 }, /* 10110001 */
+ { -3+INDEX_SHIFT, 45, 6 }, /* 101101 */
+ { -2+INDEX_SHIFT, 10, 4 }, /* 1010 */
+ { -1+INDEX_SHIFT, 3, 3 }, /* 011 */
+ { 0+INDEX_SHIFT, 6, 3 }, /* 110 */
+ { 1+INDEX_SHIFT, 0, 2 }, /* 00 */
+ { 2+INDEX_SHIFT, 7, 3 }, /* 111 */
+ { 3+INDEX_SHIFT, 4, 3 }, /* 100 */
+ { 4+INDEX_SHIFT, 2, 3 }, /* 010 */
+ { 5+INDEX_SHIFT, 23, 5 }, /* 10111 */
+ { 6+INDEX_SHIFT, 89, 7 }, /* 1011001 */
+ { 7+INDEX_SHIFT, 1408, 11 } /* 10110000000 */
+};
+
+const Coding codesTnsCoeff2TCX20[] =
+{
+ { -8+INDEX_SHIFT, 13312, 14 }, /* 11010000000000 */
+ { -7+INDEX_SHIFT, 13313, 14 }, /* 11010000000001 */
+ { -6+INDEX_SHIFT, 3329, 12 }, /* 110100000001 */
+ { -5+INDEX_SHIFT, 833, 10 }, /* 1101000001 */
+ { -4+INDEX_SHIFT, 209, 8 }, /* 11010001 */
+ { -3+INDEX_SHIFT, 53, 6 }, /* 110101 */
+ { -2+INDEX_SHIFT, 12, 4 }, /* 1100 */
+ { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
+ { 1+INDEX_SHIFT, 7, 3 }, /* 111 */
+ { 2+INDEX_SHIFT, 27, 5 }, /* 11011 */
+ { 3+INDEX_SHIFT, 105, 7 }, /* 1101001 */
+ { 4+INDEX_SHIFT, 417, 9 }, /* 110100001 */
+ { 5+INDEX_SHIFT, 1665, 11 }, /* 11010000001 */
+ { 6+INDEX_SHIFT, 13314, 14 }, /* 11010000000010 */
+ { 7+INDEX_SHIFT, 13315, 14 } /* 11010000000011 */
+};
+
+const Coding codesTnsCoeff2TCX10[] =
+{
+ { -8+INDEX_SHIFT, 512, 12 }, /* 001000000000 */
+ { -7+INDEX_SHIFT, 513, 12 }, /* 001000000001 */
+ { -6+INDEX_SHIFT, 65, 9 }, /* 001000001 */
+ { -5+INDEX_SHIFT, 17, 7 }, /* 0010001 */
+ { -4+INDEX_SHIFT, 5, 5 }, /* 00101 */
+ { -3+INDEX_SHIFT, 0, 3 }, /* 000 */
+ { -2+INDEX_SHIFT, 6, 3 }, /* 110 */
+ { -1+INDEX_SHIFT, 1, 2 }, /* 01 */
+ { 0+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 1+INDEX_SHIFT, 7, 3 }, /* 111 */
+ { 2+INDEX_SHIFT, 3, 4 }, /* 0011 */
+ { 3+INDEX_SHIFT, 9, 6 }, /* 001001 */
+ { 4+INDEX_SHIFT, 33, 8 }, /* 00100001 */
+ { 5+INDEX_SHIFT, 129, 10 }, /* 0010000001 */
+ { 6+INDEX_SHIFT, 514, 12 }, /* 001000000010 */
+ { 7+INDEX_SHIFT, 515, 12 } /* 001000000011 */
+};
+
+const Coding codesTnsCoeff3TCX20[] =
+{
+ { -8+INDEX_SHIFT, 13318, 14 }, /* 11010000000110 */
+ { -7+INDEX_SHIFT, 13319, 14 }, /* 11010000000111 */
+ { -6+INDEX_SHIFT, 6656, 13 }, /* 1101000000000 */
+ { -5+INDEX_SHIFT, 1665, 11 }, /* 11010000001 */
+ { -4+INDEX_SHIFT, 417, 9 }, /* 110100001 */
+ { -3+INDEX_SHIFT, 105, 7 }, /* 1101001 */
+ { -2+INDEX_SHIFT, 27, 5 }, /* 11011 */
+ { -1+INDEX_SHIFT, 7, 3 }, /* 111 */
+ { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
+ { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 2+INDEX_SHIFT, 12, 4 }, /* 1100 */
+ { 3+INDEX_SHIFT, 53, 6 }, /* 110101 */
+ { 4+INDEX_SHIFT, 209, 8 }, /* 11010001 */
+ { 5+INDEX_SHIFT, 833, 10 }, /* 1101000001 */
+ { 6+INDEX_SHIFT, 6657, 13 }, /* 1101000000001 */
+ { 7+INDEX_SHIFT, 6658, 13 } /* 1101000000010 */
+};
+
+const Coding codesTnsCoeff3TCX10[] =
+{
+ { -8+INDEX_SHIFT, 1284, 12 }, /* 010100000100 */
+ { -7+INDEX_SHIFT, 1285, 12 }, /* 010100000101 */
+ { -6+INDEX_SHIFT, 1286, 12 }, /* 010100000110 */
+ { -5+INDEX_SHIFT, 1287, 12 }, /* 010100000111 */
+ { -4+INDEX_SHIFT, 161, 9 }, /* 010100001 */
+ { -3+INDEX_SHIFT, 41, 7 }, /* 0101001 */
+ { -2+INDEX_SHIFT, 11, 5 }, /* 01011 */
+ { -1+INDEX_SHIFT, 0, 2 }, /* 00 */
+ { 0+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 1+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 2+INDEX_SHIFT, 3, 3 }, /* 011 */
+ { 3+INDEX_SHIFT, 4, 4 }, /* 0100 */
+ { 4+INDEX_SHIFT, 21, 6 }, /* 010101 */
+ { 5+INDEX_SHIFT, 81, 8 }, /* 01010001 */
+ { 6+INDEX_SHIFT, 640, 11 }, /* 01010000000 */
+ { 7+INDEX_SHIFT, 641, 11 } /* 01010000001 */
+};
+
+const Coding codesTnsCoeff4TCX20[] =
+{
+ { -8+INDEX_SHIFT, 13318, 14 }, /* 11010000000110 */
+ { -7+INDEX_SHIFT, 13319, 14 }, /* 11010000000111 */
+ { -6+INDEX_SHIFT, 6656, 13 }, /* 1101000000000 */
+ { -5+INDEX_SHIFT, 833, 10 }, /* 1101000001 */
+ { -4+INDEX_SHIFT, 209, 8 }, /* 11010001 */
+ { -3+INDEX_SHIFT, 53, 6 }, /* 110101 */
+ { -2+INDEX_SHIFT, 12, 4 }, /* 1100 */
+ { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
+ { 1+INDEX_SHIFT, 7, 3 }, /* 111 */
+ { 2+INDEX_SHIFT, 27, 5 }, /* 11011 */
+ { 3+INDEX_SHIFT, 105, 7 }, /* 1101001 */
+ { 4+INDEX_SHIFT, 417, 9 }, /* 110100001 */
+ { 5+INDEX_SHIFT, 1665, 11 }, /* 11010000001 */
+ { 6+INDEX_SHIFT, 6657, 13 }, /* 1101000000001 */
+ { 7+INDEX_SHIFT, 6658, 13 } /* 1101000000010 */
+};
+
+const Coding codesTnsCoeff4TCX10[] =
+{
+ { -8+INDEX_SHIFT, 20, 12 }, /* 000000010100 */
+ { -7+INDEX_SHIFT, 21, 12 }, /* 000000010101 */
+ { -6+INDEX_SHIFT, 22, 12 }, /* 000000010110 */
+ { -5+INDEX_SHIFT, 3, 9 }, /* 000000011 */
+ { -4+INDEX_SHIFT, 1, 7 }, /* 0000001 */
+ { -3+INDEX_SHIFT, 1, 5 }, /* 00001 */
+ { -2+INDEX_SHIFT, 1, 3 }, /* 001 */
+ { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
+ { 2+INDEX_SHIFT, 1, 4 }, /* 0001 */
+ { 3+INDEX_SHIFT, 1, 6 }, /* 000001 */
+ { 4+INDEX_SHIFT, 0, 8 }, /* 00000000 */
+ { 5+INDEX_SHIFT, 23, 12 }, /* 000000010111 */
+ { 6+INDEX_SHIFT, 8, 11 }, /* 00000001000 */
+ { 7+INDEX_SHIFT, 9, 11 } /* 00000001001 */
+};
+
+const Coding codesTnsCoeff5[] =
+{
+ { -8+INDEX_SHIFT, 6788, 13 }, /* 1101010000100 */
+ { -7+INDEX_SHIFT, 6789, 13 }, /* 1101010000101 */
+ { -6+INDEX_SHIFT, 6790, 13 }, /* 1101010000110 */
+ { -5+INDEX_SHIFT, 849, 10 }, /* 1101010001 */
+ { -4+INDEX_SHIFT, 213, 8 }, /* 11010101 */
+ { -3+INDEX_SHIFT, 107, 7 }, /* 1101011 */
+ { -2+INDEX_SHIFT, 27, 5 }, /* 11011 */
+ { -1+INDEX_SHIFT, 7, 3 }, /* 111 */
+ { 0+INDEX_SHIFT, 0, 1 }, /* 0 */
+ { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 2+INDEX_SHIFT, 12, 4 }, /* 1100 */
+ { 3+INDEX_SHIFT, 52, 6 }, /* 110100 */
+ { 4+INDEX_SHIFT, 425, 9 }, /* 110101001 */
+ { 5+INDEX_SHIFT, 6791, 13 }, /* 1101010000111 */
+ { 6+INDEX_SHIFT, 3392, 12 }, /* 110101000000 */
+ { 7+INDEX_SHIFT, 3393, 12 } /* 110101000001 */
+};
+
+const Coding codesTnsCoeff6[] =
+{
+ { -8+INDEX_SHIFT, 4, 12 }, /* 000000000100 */
+ { -7+INDEX_SHIFT, 5, 12 }, /* 000000000101 */
+ { -6+INDEX_SHIFT, 6, 12 }, /* 000000000110 */
+ { -5+INDEX_SHIFT, 1, 9 }, /* 000000001 */
+ { -4+INDEX_SHIFT, 1, 7 }, /* 0000001 */
+ { -3+INDEX_SHIFT, 1, 5 }, /* 00001 */
+ { -2+INDEX_SHIFT, 1, 3 }, /* 001 */
+ { -1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
+ { 2+INDEX_SHIFT, 1, 4 }, /* 0001 */
+ { 3+INDEX_SHIFT, 1, 6 }, /* 000001 */
+ { 4+INDEX_SHIFT, 1, 8 }, /* 00000001 */
+ { 5+INDEX_SHIFT, 7, 12 }, /* 000000000111 */
+ { 6+INDEX_SHIFT, 0, 11 }, /* 00000000000 */
+ { 7+INDEX_SHIFT, 1, 11 } /* 00000000001 */
+};
+
+const Coding codesTnsCoeff7[] =
+{
+ { -8+INDEX_SHIFT, 14, 11 }, /* 00000001110 */
+ { -7+INDEX_SHIFT, 15, 11 }, /* 00000001111 */
+ { -6+INDEX_SHIFT, 0, 10 }, /* 0000000000 */
+ { -5+INDEX_SHIFT, 1, 10 }, /* 0000000001 */
+ { -4+INDEX_SHIFT, 1, 7 }, /* 0000001 */
+ { -3+INDEX_SHIFT, 1, 5 }, /* 00001 */
+ { -2+INDEX_SHIFT, 1, 4 }, /* 0001 */
+ { -1+INDEX_SHIFT, 1, 2 }, /* 01 */
+ { 0+INDEX_SHIFT, 2, 10 }, /* 0000000010 */
+ { 1+INDEX_SHIFT, 1, 1 }, /* 1 */
+ { 2+INDEX_SHIFT, 1, 3 }, /* 001 */
+ { 3+INDEX_SHIFT, 1, 6 }, /* 000001 */
+ { 4+INDEX_SHIFT, 3, 10 }, /* 0000000011 */
+ { 5+INDEX_SHIFT, 4, 10 }, /* 0000000100 */
+ { 6+INDEX_SHIFT, 5, 10 }, /* 0000000101 */
+ { 7+INDEX_SHIFT, 6, 10 } /* 0000000110 */
+};
+
+const Coding codesTnsCoeff456[] =
+{
+ { -8+INDEX_SHIFT, 516, 12 }, /* 001000000100 */
+ { -7+INDEX_SHIFT, 517, 12 }, /* 001000000101 */
+ { -6+INDEX_SHIFT, 518, 12 }, /* 001000000110 */
+ { -5+INDEX_SHIFT, 65, 9 }, /* 001000001 */
+ { -4+INDEX_SHIFT, 17, 7 }, /* 0010001 */
+ { -3+INDEX_SHIFT, 5, 5 }, /* 00101 */
+ { -2+INDEX_SHIFT, 3, 4 }, /* 0011 */
+ { -1+INDEX_SHIFT, 1, 2 }, /* 01 */
+ { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 2+INDEX_SHIFT, 0, 3 }, /* 000 */
+ { 3+INDEX_SHIFT, 9, 6 }, /* 001001 */
+ { 4+INDEX_SHIFT, 33, 8 }, /* 00100001 */
+ { 5+INDEX_SHIFT, 519, 12 }, /* 001000000111 */
+ { 6+INDEX_SHIFT, 256, 11 }, /* 00100000000 */
+ { 7+INDEX_SHIFT, 257, 11 } /* 00100000001 */
+};
+
+const Coding codesTnsCoeff0WBTCX20[] =
+{
+ { -8+INDEX_SHIFT, 225, 10 }, /* 0011100001 */
+ { -7+INDEX_SHIFT, 113, 9 }, /* 001110001 */
+ { -6+INDEX_SHIFT, 29, 7 }, /* 0011101 */
+ { -5+INDEX_SHIFT, 15, 6 }, /* 001111 */
+ { -4+INDEX_SHIFT, 2, 4 }, /* 0010 */
+ { -3+INDEX_SHIFT, 0, 3 }, /* 000 */
+ { -2+INDEX_SHIFT, 13, 4 }, /* 1101 */
+ { -1+INDEX_SHIFT, 2, 3 }, /* 010 */
+ { 0+INDEX_SHIFT, 5, 3 }, /* 101 */
+ { 1+INDEX_SHIFT, 3, 3 }, /* 011 */
+ { 2+INDEX_SHIFT, 4, 3 }, /* 100 */
+ { 3+INDEX_SHIFT, 7, 3 }, /* 111 */
+ { 4+INDEX_SHIFT, 12, 4 }, /* 1100 */
+ { 5+INDEX_SHIFT, 6, 5 }, /* 00110 */
+ { 6+INDEX_SHIFT, 57, 8 }, /* 00111001 */
+ { 7+INDEX_SHIFT, 224, 10 } /* 0011100000 */
+};
+
+
+const Coding codesTnsCoeff1WBTCX20[] =
+{
+ { -8+INDEX_SHIFT, 512, 12 }, /* 001000000000 */
+ { -7+INDEX_SHIFT, 513, 12 }, /* 001000000001 */
+ { -6+INDEX_SHIFT, 514, 12 }, /* 001000000010 */
+ { -5+INDEX_SHIFT, 65, 9 }, /* 001000001 */
+ { -4+INDEX_SHIFT, 17, 7 }, /* 0010001 */
+ { -3+INDEX_SHIFT, 5, 5 }, /* 00101 */
+ { -2+INDEX_SHIFT, 0, 3 }, /* 000 */
+ { -1+INDEX_SHIFT, 2, 3 }, /* 010 */
+ { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 1+INDEX_SHIFT, 2, 2 }, /* 10 */
+ { 2+INDEX_SHIFT, 3, 3 }, /* 011 */
+ { 3+INDEX_SHIFT, 3, 4 }, /* 0011 */
+ { 4+INDEX_SHIFT, 9, 6 }, /* 001001 */
+ { 5+INDEX_SHIFT, 33, 8 }, /* 00100001 */
+ { 6+INDEX_SHIFT, 129, 10 }, /* 0010000001 */
+ { 7+INDEX_SHIFT, 515, 12 } /* 001000000011 */
+};
+
+
+const Coding codesTnsCoeff2WB[] =
+{
+ { -8+INDEX_SHIFT, 5632, 13 }, /* 1011000000000 */
+ { -7+INDEX_SHIFT, 5633, 13 }, /* 1011000000001 */
+ { -6+INDEX_SHIFT, 1409, 11 }, /* 10110000001 */
+ { -5+INDEX_SHIFT, 353, 9 }, /* 101100001 */
+ { -4+INDEX_SHIFT, 89, 7 }, /* 1011001 */
+ { -3+INDEX_SHIFT, 23, 5 }, /* 10111 */
+ { -2+INDEX_SHIFT, 4, 3 }, /* 100 */
+ { -1+INDEX_SHIFT, 0, 2 }, /* 00 */
+ { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
+ { 2+INDEX_SHIFT, 10, 4 }, /* 1010 */
+ { 3+INDEX_SHIFT, 45, 6 }, /* 101101 */
+ { 4+INDEX_SHIFT, 177, 8 }, /* 10110001 */
+ { 5+INDEX_SHIFT, 705, 10 }, /* 1011000001 */
+ { 6+INDEX_SHIFT, 5634, 13 }, /* 1011000000010 */
+ { 7+INDEX_SHIFT, 5635, 13 } /* 1011000000011 */
+};
+
+const Coding codesTnsCoeff3WB[] =
+{
+ { -8+INDEX_SHIFT, 5638, 13 }, /* 1011000000110 */
+ { -7+INDEX_SHIFT, 5639, 13 }, /* 1011000000111 */
+ { -6+INDEX_SHIFT, 2816, 12 }, /* 101100000000 */
+ { -5+INDEX_SHIFT, 353, 9 }, /* 101100001 */
+ { -4+INDEX_SHIFT, 177, 8 }, /* 10110001 */
+ { -3+INDEX_SHIFT, 45, 6 }, /* 101101 */
+ { -2+INDEX_SHIFT, 10, 4 }, /* 1010 */
+ { -1+INDEX_SHIFT, 0, 2 }, /* 00 */
+ { 0+INDEX_SHIFT, 3, 2 }, /* 11 */
+ { 1+INDEX_SHIFT, 1, 2 }, /* 01 */
+ { 2+INDEX_SHIFT, 4, 3 }, /* 100 */
+ { 3+INDEX_SHIFT, 23, 5 }, /* 10111 */
+ { 4+INDEX_SHIFT, 89, 7 }, /* 1011001 */
+ { 5+INDEX_SHIFT, 705, 10 }, /* 1011000001 */
+ { 6+INDEX_SHIFT, 2817, 12 }, /* 101100000001 */
+ { 7+INDEX_SHIFT, 2818, 12 } /* 101100000010 */
+};
+
+const Word16 nTnsCoeffCodes = sizeof(codesTnsCoeff0TCX20)/sizeof(codesTnsCoeff0TCX20[0]);
+
+const Coding * const codesTnsCoeffSWBTCX20[] = { codesTnsCoeff0TCX20, codesTnsCoeff1TCX20, codesTnsCoeff2TCX20, codesTnsCoeff3TCX20, codesTnsCoeff4TCX20, codesTnsCoeff5, codesTnsCoeff6, codesTnsCoeff7 };
+const Coding * const codesTnsCoeffSWBTCX10[] = { codesTnsCoeff0TCX10, codesTnsCoeff1TCX10, codesTnsCoeff2TCX10, codesTnsCoeff3TCX10, codesTnsCoeff4TCX10, codesTnsCoeff5, codesTnsCoeff6, codesTnsCoeff7 };
+const Coding * const codesTnsCoeffWBTCX20[] = { codesTnsCoeff0WBTCX20, codesTnsCoeff1WBTCX20, codesTnsCoeff2WB, codesTnsCoeff3WB, codesTnsCoeff456, codesTnsCoeff456, codesTnsCoeff456, codesTnsCoeff7 };
+
+const Word16 nTnsCoeffTables = sizeof(codesTnsCoeffSWBTCX20)/sizeof(codesTnsCoeffSWBTCX20[0]); // Q0
+
+const Coding codesTnsOrderTCX20[] =
+{
+ { 1, 0, 2 }, /* 00 */
+ { 2, 40, 6 }, /* 101000 */
+ { 3, 41, 6 }, /* 101001 */
+ { 4, 21, 5 }, /* 10101 */
+ { 5, 11, 4 }, /* 1011 */
+ { 6, 4, 3 }, /* 100 */
+ { 7, 1, 2 }, /* 01 */
+ { 8, 3, 2 } /* 11 */
+};
+const Coding codesTnsOrderTCX10[] =
+{
+ { 1, 0, 3 }, /* 000 */
+ { 2, 16, 5 }, /* 10000 */
+ { 3, 17, 5 }, /* 10001 */
+ { 4, 9, 4 }, /* 1001 */
+ { 5, 1, 3 }, /* 001 */
+ { 6, 5, 3 }, /* 101 */
+ { 7, 1, 2 }, /* 01 */
+ { 8, 3, 2 } /* 11 */
+};
+const Coding codesTnsOrder[] =
+{
+ { 1, 96, 7 }, /* 1100000 */
+ { 2, 97, 7 }, /* 1100001 */
+ { 3, 49, 6 }, /* 110001 */
+ { 4, 25, 5 }, /* 11001 */
+ { 5, 13, 4 }, /* 1101 */
+ { 6, 7, 3 }, /* 111 */
+ { 7, 2, 2 }, /* 10 */
+ { 8, 0, 1 } /* 0 */
+};
+
+const Word16 nTnsOrderCodes = sizeof(codesTnsOrder)/sizeof(codesTnsOrder[0]); // Q0
+
+const ParamsBitMap tnsSWBTCX20FilterCoeffBitMap =
+{
+ 1,
+ {
+ { 0, GetSWBTCX20TnsFilterCoeffBits, TRUE, GetTnsFilterCoeff, SetTnsFilterCoeff, EncodeSWBTCX20TnsFilterCoeff, DecodeSWBTCX20TnsFilterCoeff_flt, NULL } /* TNS filter coefficients */
+ }
+};
+
+const ParamsBitMap tnsSWBTCX10FilterCoeffBitMap =
+{
+ 1,
+ {
+ { 0, GetSWBTCX10TnsFilterCoeffBits, TRUE, GetTnsFilterCoeff, SetTnsFilterCoeff, EncodeSWBTCX10TnsFilterCoeff, DecodeSWBTCX10TnsFilterCoeff_flt, NULL } /* TNS filter coefficients */
+ }
+};
+
+const ParamsBitMap tnsSWBTCX20FilterBitMap =
+{
+ 1,
+ {
+ { 0, GetTnsFilterOrderBitsSWBTCX20, FALSE, GetTnsFilterOrder, SetTnsFilterOrder, EncodeTnsFilterOrderSWBTCX20, DecodeTnsFilterOrderSWBTCX20_flt, &tnsSWBTCX20FilterCoeffBitMap } /* TNS filter order */
+ }
+};
+
+const ParamsBitMap tnsSWBTCX10FilterBitMap =
+{
+ 1,
+ {
+ { 0, GetTnsFilterOrderBitsSWBTCX10, FALSE, GetTnsFilterOrder, SetTnsFilterOrder, EncodeTnsFilterOrderSWBTCX10, DecodeTnsFilterOrderSWBTCX10_flt, &tnsSWBTCX10FilterCoeffBitMap } /* TNS filter order */
+ }
+};
+
+const ParamsBitMap tnsSWBTCX20BitMap =
+{
+ 1,
+ {
+ { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX20FilterBitMap } /* Number of TNS filters */
+ }
+};
+
+/* For storing/reading bits in SWB/FB mode */
+const ParamsBitMap tnsEnabledSWBTCX20BitMap =
+{
+ 1,
+ {
+ { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsSWBTCX20BitMap } /* TNS Enabled/Disable */
+ }
+};
+
+const ParamsBitMap tnsSWBTCX10BitMap =
+{
+ 1,
+ {
+ { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX10FilterBitMap } /* Number of TNS filters */
+ }
+};
+
+/* For storing/reading bits in SWB/FB mode */
+const ParamsBitMap tnsEnabledSWBTCX10BitMap =
+{
+ 1,
+ {
+ { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsSWBTCX10BitMap } /* TNS Enabled/Disable */
+ }
+};
+
+const ParamsBitMap tnsWBTCX20FilterCoeffBitMap =
+{
+ 1,
+ {
+ { 0, GetWBTCX20TnsFilterCoeffBits, TRUE, GetTnsFilterCoeff, SetTnsFilterCoeff, EncodeWBTCX20TnsFilterCoeff, DecodeWBTCX20TnsFilterCoeff_flt, NULL } /* TNS filter coefficients */
+ }
+};
+
+
+const ParamsBitMap tnsWBTCX20FilterBitMap =
+{
+ 1,
+ {
+ { 0, GetTnsFilterOrderBits, FALSE, GetTnsFilterOrder, SetTnsFilterOrder, EncodeTnsFilterOrder, DecodeTnsFilterOrder_flt, &tnsWBTCX20FilterCoeffBitMap } /* TNS filter order */
+ }
+};
+
+
+/* For storing/reading bits in WB mode */
+const ParamsBitMap tnsEnabledWBTCX20BitMap =
+{
+ 1,
+ {
+ { 1, NULL, TRUE, GetTnsEnabledSingleFilter, SetTnsEnabledSingleFilter, NULL, NULL, &tnsWBTCX20FilterBitMap } /* TNS Enabled/Disable */
+ }
+};
+
+/* For storing/reading bits in SWB/FB mode */
+const ParamsBitMap tnsOnWhiteSWBTCX20BitMap =
+{
+ 2,
+ {
+ { 1, NULL, TRUE, GetTnsOnWhite, SetTnsOnWhite, NULL, NULL, NULL }, /* TNS Enabled/Disable */
+ { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX20FilterBitMap }
+ }
+};
+
+const ParamsBitMap tnsEnabledOnWhiteSWBTCX20BitMap =
+{
+ 1,
+ {
+ { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsOnWhiteSWBTCX20BitMap } /* TNS Enabled/Disable */
+ }
+};
+/* For storing/reading bits in SWB/FB mode */
+const ParamsBitMap tnsOnWhiteSWBTCX10BitMap =
+{
+ 2,
+ {
+ { 1, NULL, TRUE, GetTnsOnWhite, SetTnsOnWhite, NULL, NULL, NULL }, /* TNS on whitened spectra */
+ { 1, NULL, FALSE, GetNumOfTnsFilters_flt, SetNumOfTnsFilters_flt, NULL, NULL, &tnsSWBTCX10FilterBitMap }
+ }
+};
+
+/* For storing/reading bits in SWB/FB mode */
+const ParamsBitMap tnsEnabledOnWhiteSWBTCX10BitMap =
+{
+ 1,
+ {
+ { 1, NULL, TRUE, GetTnsEnabled, SetTnsEnabled, NULL, NULL, &tnsOnWhiteSWBTCX10BitMap } /* TNS Enabled/Disable */
+ }
+};
+
+
+/**
+ * 4 bit resolution TNS coefficients.
+ */
+const Word16 tnsCoeff4[16] =
+{
+ -32628/*-0.99573418F Q15*/, /* = sin(-8*(PI/2.0)/(8 + 0.5)) */
+ -31517/*-0.96182564F Q15*/, /* = sin(-7*(PI/2.0)/(8 + 0.5)) */
+ -29333/*-0.89516329F Q15*/,
+ -26149/*-0.79801723F Q15*/,
+ -22076/*-0.67369564F Q15*/,
+ -17250/*-0.52643216F Q15*/,
+ -11837/*-0.36124167F Q15*/,
+ -6021/*-0.18374952F Q15*/, /* = sin(-1*(PI/2.0)/(8 + 0.5)) */
+ 0/* 0.00000000F Q15*/, /* = sin(0*(PI/2.0)/(8 + 0.5)) */
+ 6813/* 0.20791169F Q15*/, /* = sin(1*(PI/2.0)/(8 - 0.5)) */
+ 13328/* 0.40673664F Q15*/,
+ 19261/* 0.58778525F Q15*/,
+ 24351/* 0.74314483F Q15*/,
+ 28378/* 0.86602540F Q15*/,
+ 31164/* 0.95105652F Q15*/, /* = sin(6*(PI/2.0)/(8 - 0.5)) */
+ 32588/* 0.99452190F Q15*/ /* = sin(7*(PI/2.0)/(8 - 0.5)) */
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * IGF settings for each bitrate
+ *----------------------------------------------------------------------------------*/
+
+const Word16 swb_offset_LB_new[IGF_BITRATE_UNKNOWN][IGF_MAX_SFB] = // Q0
+{
+ /* 0: for 9600 kbs WB */
+ {
+ 4, 164, 186, 242, 320
+ },
+ /* 1: for 13200 kbs WB RF */
+ {
+ 4, 164, 186, 242, 320
+ },
+ /* 2: for 9600 kbs SWB */
+ {
+ 4, 200, 322, 444, 566
+ },
+ /* 3: for 13200 kbs SWB */
+ {
+ 7, 256, 288, 328, 376, 432, 496, 566
+ },
+ /* 4: for 13200 kbs SWB RF */
+ {
+ 4, 200, 322, 444, 566
+ },
+ /* 5: for 16400 kbs SWB */
+ {
+ 8, 256, 288, 328, 376, 432, 496, 576, 640
+ },
+ /* 6: for 24400 kbs SWB */
+ {
+ 9, 256, 284, 318, 358, 402, 450, 508, 576, 640
+ },
+ /* 7: for 32000 kbs SWB */
+ {
+ 9, 256, 284, 318, 358, 402, 450, 508, 576, 640
+ },
+ /* 8: for 48000 kbs SWB */
+ {
+ 4, 512, 534, 576, 640
+ },
+ /* 9: for 64000 kbs SWB */
+ {
+ 4, 512, 534, 576, 640
+ },
+ /* 10: for 16400 kbs FB */
+ {
+ 10, 256, 288, 328, 376, 432, 496, 576, 640, 720, 800
+ },
+ /* 11: for 24400 kbs FB */
+ {
+ 11, 256, 284, 318, 358, 402, 450, 508, 576, 640, 720, 800
+ },
+ /* 12: for 32000 kbs FB */
+ {
+ 11, 256, 284, 318, 358, 402, 450, 508, 576, 640, 720, 800
+ },
+ /* 13: for 48000 kbs FB */
+ {
+ 5, 512, 584, 656, 728, 800
+ },
+ /* 14: for 64000 kbs FB */
+ {
+ 5, 512, 584, 656, 728, 800
+ },
+ /* 15: for 96000 kbs FB */
+ {
+ 3, 640, 720, 800 /* old: 640, 760, 880 */
+ },
+ /* 16: for 128000 kbs FB */
+ {
+ 3, 640, 720, 800 /* old: 640, 760, 880 */
+ },
+ /* 17: for 13200 kbs WB (stereo) */
+ {
+ 3, 196, 248, 320
+ },
+ /* 18: for 16400 kbs WB (stereo) */
+ {
+ 3, 228, 268, 320
+ },
+ /* 19: for 13200 kbs SWB (stereo) */
+ {
+ 5, 200, 264, 344, 440, 566
+ },
+ /* 20: for 16400 kbs SWB (stereo) */
+ {
+ 7, 228, 264, 308, 360, 420, 488, 566
+ },
+ /* 21: for 24400 kbs SWB (stereo) */
+ {
+ 8, 256, 288, 328, 376, 432, 496, 576, 640
+ },
+ /* 22: for 32000 kbs SWB (stereo) */
+ {
+ 9, 256, 284, 320, 360, 404, 452, 508, 576, 640
+ },
+ /* 23: for 48000 kbs SWB (stereo) */
+ {
+ 7, 360, 392, 424, 464, 508, 560, 640
+ },
+ /* 24: for 48000 kbs SWB (stereo TCX10) */
+ {
+ 4, 360, 424, 508, 640
+ },
+ /* 25: for 64000 kbs SWB (stereo) */
+ {
+ 8, 400, 424, 448, 476, 508, 540, 576, 640
+ },
+ /* 26: for 80000 kbs SWB (stereo) */
+ {
+ 5, 464, 496, 532, 576, 640
+ },
+ /* 27: for 96000 kbs SWB (stereo) */
+ {
+ 4, 512, 536, 576, 640
+ },
+ /* 28: for 24400 kbs FB (stereo) */
+ {
+ 10, 256, 288, 328, 376, 432, 496, 576, 640, 720, 800
+ },
+ /* 29: for 32000 kbs FB (stereo) */
+ {
+ 11, 256, 284, 320, 360, 404, 452, 508, 576, 640, 720, 800
+ },
+ /* 30: for 48000 kbs FB (stereo) */
+ {
+ 9, 360, 392, 424, 464, 508, 560, 640, 720, 800
+ },
+ /* 31: for 48000 kbs FB (stereo TCX10) */
+ {
+ 5, 360, 424, 508, 640, 800
+ },
+ /* 32: for 64000 kbs FB (stereo) */
+ {
+ 10, 400, 424, 448, 476, 508, 540, 576, 640, 720, 800
+ },
+ /* 33: for 80000 kbs FB (stereo) */
+ {
+ 7, 464, 496, 532, 576, 640, 720, 800
+ },
+ /* 34: for 96000 kbs FB (stereo) */
+ {
+ 6, 512, 536, 576, 640, 720, 800
+ },
+ /* 35: for 128000 kbs FB (stereo) */
+ {
+ 3, 640, 720, 800
+ }
+};/*Q0*/
+
+const Word16 igf_tile_offset_table[IGF_BITRATE_UNKNOWN][2*IGF_MAX_TILES+1] = { // Q0
+ { 2, 2, 0, 3, 0}, /* 9600 WB*/
+ { 2, 2, 0, 3, 0}, /* 13200 WB RF */
+ { 3, 1, 0, 2, 32, 3, 46}, /* 9600 SWB */
+ { 2, 4, 0, 6, 32}, /* 13200 SWB RF */
+ { 3, 1, 0, 2, 32, 3, 46}, /* 13200 SWB */
+ { 3, 4, 0, 6, 48, 7, 64}, /* 16400 SWB */
+ { 3, 4, 0, 7, 32, 8, 64}, /* 24400 SWB */
+ { 3, 4, 0, 7, 32, 8, 64}, /* 32000 SWB */
+ { 1, 3, 320}, /* 48000 SWB */
+ { 1, 3, 320}, /* 64000 SWB */
+ { 3, 4, 0, 7, 0, 9, 0}, /* 16400 FB */
+ { 4, 4, 0, 6, 32, 9, 0, 10, 80}, /* 24400 FB */
+ { 4, 4, 0, 6, 32, 9, 0, 10, 80}, /* 32000 FB */
+ { 1, 4, 160}, /* 48000 FB */
+ { 1, 4, 160}, /* 64000 FB */
+ { 1, 2, 416}, /* 96000 FB */
+ { 1, 2, 416}, /*128000 FB */
+ { 2, 1, 40, 2, 92}, /* 13200 WB (stereo) */
+ { 2, 1, 80, 2, 120}, /* 16400 WB (stereo) */
+ { 4, 1, 0, 2, 32, 3, 46, 4, 40}, /* 13200 SWB (stereo) */
+ { 6, 1, 0, 2, 36, 3, 80, 4, 132, 5, 32, 6, 100 }, /* 16400 SWB (stereo) */
+ { 7, 1, 0, 2, 32, 3, 72, 4, 120, 5, 48, 6, 112, 7, 64 }, /* 24400 SWB (stereo) */
+ { 8, 1, 0, 2, 28, 3, 64, 4, 104, 5, 32, 6, 80, 7, 136, 8, 64 }, /* 32000 SWB (stereo) */
+ { 6, 1, 120, 2, 152, 3, 184, 4, 224, 5, 140, 6, 192}, /* 48000 SWB (stereo) */
+ { 3, 1, 0, 2, 40, 3, 80 }, /* 48000 SWB (stereo TCX10) */
+ { 4, 2, 80, 4, 128, 6, 144, 7, 212 }, /* 64000 SWB (stereo) */
+ { 2, 2, 212, 4, 280 }, /* 80000 SWB (stereo) */
+ { 1, 3, 200}, /* 96000 SWB (stereo) */
+ { 9, 1, 0, 2, 32, 3, 72, 4, 120, 5, 48, 6, 112, 7, 64, 8, 0, 9, 80 }, /* 24400 FB (stereo) */
+ {10, 1, 0, 2, 28, 3, 64, 4, 104, 5, 32, 6, 80, 7, 136, 8, 64, 9, 0, 10, 80 }, /* 32000 FB (stereo) */
+ { 7, 1, 120, 2, 152, 3, 184, 4, 224, 5, 140, 6, 192, 8, 140}, /* 48000 FB (stereo) */
+ { 4, 1, 0, 2, 40, 3, 80, 4, 140 }, /* 48000 FB (stereo TCX10) */
+ { 5, 2, 80, 4, 128, 6, 144, 7, 212, 9, 160 }, /* 64000 FB (stereo) */
+ { 3, 2, 212, 4, 280, 6, 200 }, /* 80000 FB (stereo) */
+ { 2, 3, 200, 5, 240}, /* 96000 FB (stereo) */
+ { 1, 2, 416} /*128000 FB (stereo) */
+};
+
+const Word16 igf_whitening_TH_ivas_fx[][2][IGF_MAX_TILES] =
+{
+ /* 0: for 9600 kbs WB */
+ {
+ /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 1: for 13200 kbs WB RF */
+ {
+ /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 2: for 9600 kbs SWB */
+ {
+ /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 3: for 13200 kbs SWB */
+ {
+ /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 4: for 13200 kbs SWB RF */
+ {
+ /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 5: for 16400 kbs SWB */
+ {
+ /* medium */ { 6799/*0.83f Q13*/, 7291/*0.89f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10732/*1.31f Q13*/, 9748/*1.19f Q13*/, 9748/*1.19f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 6: for 24400 kbs SWB*/
+ {
+ /* medium */ { 6636/*0.81f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 11059/*1.35f Q13*/, 10076/*1.23f Q13*/, 10076/*1.23f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 7: for 32000 kbs SWB */
+ {
+ /* medium */ { 7455/*0.91f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10977/*1.34f Q13*/, 11059/*1.35f Q13*/, 11059/*1.35f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 8: for 48000 kbs SWB */
+ {
+ /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 9: for 64000 kbs SWB */
+ {
+ /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 10: for 16400 kbs FB */
+ {
+ /* medium */ { 5161/*0.63f Q13*/, 2212/*0.27f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 12534/*1.53f Q13*/, 10813/*1.32f Q13*/, 5489/*0.67f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 11: for 24400 kbs FB */
+ {
+ /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
+ /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
+ },
+ /* 12: for 32000 kbs FB */
+ {
+ /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
+ /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
+ },
+ /* 13: for 48000 kbs FB */
+ {
+ /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 14: for 64000 kbs FB */
+ {
+ /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 15: for 96000 kbs FB */
+ {
+ /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 16: for 128000 kbs FB */
+ {
+ /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 17: for 13200 kbs WB (stereo) */
+ {
+ /* medium */ {6554/*0.800000 Q13*/, 6144/*0.750000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ },
+ /* strong */ {12288/*1.500000 Q13*/, 11878/*1.450000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 18: for 16400 kbs WB (stereo) */
+ {
+
+ /* medium */ {7373/*0.900000 Q13*/, 6963/*0.850000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ },
+ /* strong */ {13107/*1.600000 Q13*/, 12288/*1.500000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 19: for 13200 kbs SWB (stereo) */
+ {
+ /* medium */ {7291/*0.890000 Q13*/, 7291/*0.890000 Q13*/, 6554/*0.800000 Q13*/, 6554/*0.800000 Q13*/, },
+ /* strong */ {10240/*1.250000 Q13*/, 10240/*1.250000 Q13*/, 9748/*1.190000 Q13*/, 9748/*1.190000 Q13*/, }
+ },
+ /* 20: for 16400 kbs SWB (stereo) */
+ {
+ /* medium */ {8602/*1.050000 Q13*/, 8602/*1.050000 Q13*/, 9011/*1.100000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8602/*1.050000 Q13*/, },
+ /* strong */ {13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13517/*1.650000 Q13*/, 13517/*1.650000 Q13*/, 13107/*1.600000 Q13*/, 12288/*1.500000 Q13*/, }
+ },
+ /* 21: for 24400 kbs SWB (stereo) */
+ {
+ /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, },
+ /* strong */ {13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, }
+ },
+ /* 22: for 32000 kbs SWB (stereo) */
+ {
+ /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, },
+ /* strong */ {14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 13517/*1.650000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, }
+ },
+ /* 23: for 48000 kbs SWB (stereo) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
+ {
+ /* medium */ {6144/*0.750000 Q13*/, 5734/*0.700000 Q13*/, 4096/*0.500000 Q13*/, 0/*0.000000 Q13*/ },
+ /* strong */ {10240/*1.250000 Q13*/, 9011/*1.100000 Q13*/, 8192/*1.000000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 24: for 48000 kbs SWB (stereo TCX10) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
+ {
+ /* medium */ {6144/*0.750000 Q13*/, 5734/*0.700000 Q13*/, 4096/*0.500000 Q13*/, 0/*0.000000 Q13*/ },
+ /* strong */ {10240/*1.250000 Q13*/, 9011/*1.100000 Q13*/, 8192/*1.000000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 25: for 64000 kbs SWB (stereo) */
+ {
+ /* medium */ {8192/*1.000000 Q13*/, 8192/*1.000000 Q13*/, 9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/ },
+ /* strong */ {12288/*1.500000 Q13*/, 12288/*1.500000 Q13*/, 13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/ }
+ },
+ /* 26: for 80000 kbs SWB (stereo) */
+ {
+ /* medium */ {9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/, 0/*0.000000 Q13*/ },
+ /* strong */ {13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 27: for 96000 kbs SWB (stereo) */
+ {
+ /* medium */ {9421/*1.150000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ },
+ /* strong */ {9748/*1.190000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 28: for 24400 kbs FB (stereo) */
+ {
+ /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, 2785/*0.340000 Q13*/, 2785/*0.340000 Q13*/ },
+ /* strong */ {13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 13926/*1.700000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, 5325/*0.650000 Q13*/, 5325/*0.650000 Q13*/ }
+ },
+ /* 29: for 32000 kbs FB (stereo) */
+ {
+ /* medium */ {9830/*1.200000 Q13*/, 9830/*1.200000 Q13*/, 9421/*1.150000 Q13*/, 9421/*1.150000 Q13*/, 9011/*1.100000 Q13*/, 8602/*1.050000 Q13*/, 8192/*1.000000 Q13*/, 7373/*0.900000 Q13*/, 2785/*0.340000 Q13*/, 2785/*0.340000 Q13*/ },
+ /* strong */ {14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 14746/*1.800000 Q13*/, 13517/*1.650000 Q13*/, 12698/*1.550000 Q13*/, 11878/*1.450000 Q13*/, 9830/*1.200000 Q13*/, 5325/*0.650000 Q13*/, 5325/*0.650000 Q13*/ }
+ },
+ /* 30: for 48000 kbs FB (stereo) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
+ {
+ /* medium */ {6390/*0.780000 Q13*/, 2540/*0.310000 Q13*/, 2785/*0.340000 Q13*/, 2785/*0.340000 Q13*/ },
+ /* strong */ {12206/*1.490000 Q13*/, 11305/*1.380000 Q13*/, 5325/*0.650000 Q13*/, 5325/*0.650000 Q13*/ }
+ },
+ /* 31: for 48000 kbs FB (stereo TCX10) */ /* currently not used due to adaptive calculation of thresholds at 48 kbps */
+ {
+ /* medium */ {6144/*0.750000 Q13*/, 5734/*0.700000 Q13*/, 4096/*0.500000 Q13*/, 4096/*0.500000 Q13*/ },
+ /* strong */ {10240/*1.250000 Q13*/, 9011/*1.100000 Q13*/, 8192/*1.000000 Q13*/, 8192/*1.000000 Q13*/ }
+ },
+ /* 32: for 64000 kbs FB (stereo) */
+ {
+ /* medium */ {8192/*1.000000 Q13*/, 8192/*1.000000 Q13*/, 9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/, 6144/*0.750000 Q13*/ },
+ /* strong */ {12288/*1.500000 Q13*/, 12288/*1.500000 Q13*/, 13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/, 8192/*1.000000 Q13*/ }
+ },
+ /* 33: for 80000 kbs FB (stereo) */
+ {
+ /* medium */ {9830/*1.200000 Q13*/, 10240/*1.250000 Q13*/, 6144/*0.750000 Q13*/, 0/*0.000000 Q13*/ },
+ /* strong */ {13107/*1.600000 Q13*/, 13107/*1.600000 Q13*/, 8192/*1.000000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 34: for 96000 kbs FB (stereo) */
+ {
+ /* medium */ {7455/*0.910000 Q13*/, 6963/*0.850000 Q13*/ , 0/*0.000000 Q13*/ },
+ /* strong */ {10977/*1.340000 Q13*/, 11059/*1.350000 Q13*/, 0/*0.000000 Q13*/ }
+ },
+ /* 35: for 128000 kbs FB (stereo) */
+ {
+ /* medium */ { 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/},
+ /* strong */ {23101/*2.820000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/, 0/*0.000000 Q13*/}
+ }
+};
+const Word16 igf_whitening_TH[][2][IGF_MAX_TILES] =
+{
+ /* 0: for 9600 kbs WB */
+ {
+ /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 1: for 13200 kbs WB RF */
+{
+ /* medium */ { 2949/*0.36f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 11551/*1.41f Q13*/, 11551/*1.41f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 2: for 9600 kbs SWB */
+{
+ /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 3: for 13200 kbs SWB */
+{
+ /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 4: for 13200 kbs SWB RF */
+{
+ /* medium */ { 6881/*0.84f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10650/*1.30f Q13*/, 10240/*1.25f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 5: for 16400 kbs SWB */
+{
+ /* medium */ { 6799/*0.83f Q13*/, 7291/*0.89f Q13*/, 7291/*0.89f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10732/*1.31f Q13*/, 9748/*1.19f Q13*/, 9748/*1.19f Q13*/, 0/*0.f Q13*/}
+},
+/* 6: for 24400 kbs SWB*/
+{
+ /* medium */ { 6636/*0.81f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 11059/*1.35f Q13*/, 10076/*1.23f Q13*/, 10076/*1.23f Q13*/, 0/*0.f Q13*/}
+},
+/* 7: for 32000 kbs SWB */
+{
+ /* medium */ { 7455/*0.91f Q13*/, 6963/*0.85f Q13*/, 6963/*0.85f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 10977/*1.34f Q13*/, 11059/*1.35f Q13*/, 11059/*1.35f Q13*/, 0/*0.f Q13*/}
+},
+/* 8: for 48000 kbs SWB */
+{
+ /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 9: for 64000 kbs SWB */
+{
+ /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 10: for 16400 kbs FB */
+{
+ /* medium */ { 5161/*0.63f Q13*/, 2212/*0.27f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 12534/*1.53f Q13*/, 10813/*1.32f Q13*/, 5489/*0.67f Q13*/, 0/*0.f Q13*/}
+},
+/* 11: for 24400 kbs FB */
+{
+ /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
+ /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
+},
+/* 12: for 32000 kbs FB */
+{
+ /* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
+ /* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
+},
+/* 13: for 48000 kbs FB */
+{
+ /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 14: for 64000 kbs FB */
+{
+ /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 15: for 96000 kbs FB */
+{
+ /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+},
+/* 16: for 128000 kbs FB */
+{
+ /* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+}
+};
+
+/* IGF SCF arithmetic coder cumulative frequency tables and offsets */
+
+const Word16 cf_off_se01_tab[10] = { // Q0
+ +1, /* 9.6 kbs B*/
+ +1, /* 13.2 kbs WB RF B*/
+ +1, /* 9.6 kbs SWB B*/
+ +1, /* 13.2 kbs A*/
+ +1, /* 13.2 kbs SWB RF B*/
+ +1, /* 16.4 kbs B*/
+ +1, /* 24.4 kbs B*/
+ +1, /* 32.0 kbs A*/
+ -1, /* 48.0 kbs B*/
+ -1 /* 64.0 kbs B*/
+};
+
+const Word16 cf_off_se02_tab[10][IGF_CTX_COUNT] = { // Q0
+ { +1, +2, +2, +2, +3, +3, +4}, /* 9.6 kbs B*/
+ { +1, +2, +2, +2, +3, +3, +4}, /* 13.2 kbs WB RF B*/
+ { +0, +2, +3, +3, +2, +2, +4}, /* 9.6 kbs SWB B*/
+ { +0, +2, +3, +3, +2, +2, +4}, /* 13.2 kbs A*/
+ { +0, +2, +3, +3, +2, +2, +4}, /* 13.2 kbs SWB RF B*/
+ { +0, +2, +3, +3, +2, +2, +4}, /* 16.4 kbs B*/
+ { -1, +2, +2, +2, +2, +3, +5}, /* 24.4 kbs B*/
+ { -1, +2, +2, +2, +2, +3, +5}, /* 32.0 kbs A*/
+ { +3, +2, +3, +2, +3, +3, +6}, /* 48.0 kbs B*/
+ { +3, +2, +3, +2, +3, +3, +6} /* 64.0 kbs B*/
+};
+
+const Word16 cf_off_se10_tab = -7; // Q0
+
+const Word16 cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT] = // Q0
+{
+ { -5, +0, +0, +0, +0, +0, +0},
+ { +0, +0, +0, +0, +0, +0, +0},
+ { +0, +0, +0, +0, +0, +0, +0},
+ { +0, +0, +0, +0, +0, +0, +0},
+ { +0, +0, +0, +0, +0, +0, +0},
+ { +0, +0, +0, +0, +0, +0, +1},
+ { +0, +1, +0, +0, +3, +0, +3}
+};
+
+const UWord16 cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1] = // Q0
+{
+ 16384, 16356, 16299, 16185, 15904, 15282, 14669, 13598, 11886, 9541, 6613, 3845, 1799, 606, 153, 32, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+
+const UWord16 cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1] = // Q0
+{
+ {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 9.6 kbs B*/
+ {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 13.2 kbs WB RF B*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 9.6 kbs SWB B*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs A*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs SWB RF B*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 16.4 kbs B*/
+ {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0 }, /* 24.4 kbs B*/
+ {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0}, /* 32.0 kbs A*/
+ {16384, 16368, 16355, 16334, 16291, 16212, 16071, 15816, 15359, 14523, 13014, 10534, 7345, 4272, 2228, 1149, 626, 357, 215, 139, 93, 67, 53, 43, 36, 28, 22, 0}, /* 48.0 kbs B*/
+ {16384, 16368, 16355, 16334, 16291, 16212, 16071, 15816, 15359, 14523, 13014, 10534, 7345, 4272, 2228, 1149, 626, 357, 215, 139, 93, 67, 53, 43, 36, 28, 22, 0} /* 64.0 kbs B*/
+};
+
+const UWord16 cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = // Q0
+{
+ { /* 9.6 kbs B */
+ { 16384, 16369, 16348, 16316, 16256, 16172, 16017, 15735, 15246, 14363, 13036, 11139, 8916, 6724, 4757, 3282, 2221, 1549, 1105, 771, 548, 364, 238, 151, 89, 50, 30, 0},
+ { 16384, 16371, 16358, 16339, 16290, 16241, 16153, 16040, 15813, 15397, 14601, 13301, 11360, 8916, 6254, 3911, 2220, 1280, 755, 461, 278, 177, 111, 70, 35, 20, 12, 0},
+ { 16384, 16375, 16359, 16333, 16286, 16243, 16154, 16024, 15771, 15380, 14712, 13537, 11742, 9425, 6872, 4378, 2327, 1197, 671, 412, 259, 145, 93, 52, 26, 13, 5, 0},
+ { 16384, 16372, 16358, 16326, 16289, 16241, 16147, 16014, 15765, 15321, 14670, 13546, 11912, 9787, 7323, 4824, 2536, 1330, 731, 438, 258, 148, 86, 37, 22, 11, 2, 0},
+ { 16384, 16376, 16364, 16344, 16315, 16272, 16219, 16119, 15910, 15620, 15100, 14254, 13063, 11489, 9413, 7100, 4738, 2751, 1584, 973, 597, 349, 201, 96, 47, 22, 9, 0},
+ { 16384, 16364, 16340, 16312, 16288, 16237, 16166, 16026, 15756, 15390, 14833, 13870, 12627, 10998, 8985, 6893, 4720, 3048, 1860, 1131, 725, 449, 215, 111, 56, 34, 14, 0},
+ { 16384, 16326, 16297, 16246, 16183, 16064, 15884, 15632, 15240, 14763, 14107, 13230, 12185, 10886, 9390, 7781, 6194, 4696, 3350, 2259, 1506, 975, 604, 356, 201, 106, 48, 0}
+ },
+ { /* 13.2 kbs WB RF B*/
+ { 16384, 16369, 16348, 16316, 16256, 16172, 16017, 15735, 15246, 14363, 13036, 11139, 8916, 6724, 4757, 3282, 2221, 1549, 1105, 771, 548, 364, 238, 151, 89, 50, 30, 0},
+ { 16384, 16371, 16358, 16339, 16290, 16241, 16153, 16040, 15813, 15397, 14601, 13301, 11360, 8916, 6254, 3911, 2220, 1280, 755, 461, 278, 177, 111, 70, 35, 20, 12, 0},
+ { 16384, 16375, 16359, 16333, 16286, 16243, 16154, 16024, 15771, 15380, 14712, 13537, 11742, 9425, 6872, 4378, 2327, 1197, 671, 412, 259, 145, 93, 52, 26, 13, 5, 0},
+ { 16384, 16372, 16358, 16326, 16289, 16241, 16147, 16014, 15765, 15321, 14670, 13546, 11912, 9787, 7323, 4824, 2536, 1330, 731, 438, 258, 148, 86, 37, 22, 11, 2, 0},
+ { 16384, 16376, 16364, 16344, 16315, 16272, 16219, 16119, 15910, 15620, 15100, 14254, 13063, 11489, 9413, 7100, 4738, 2751, 1584, 973, 597, 349, 201, 96, 47, 22, 9, 0},
+ { 16384, 16364, 16340, 16312, 16288, 16237, 16166, 16026, 15756, 15390, 14833, 13870, 12627, 10998, 8985, 6893, 4720, 3048, 1860, 1131, 725, 449, 215, 111, 56, 34, 14, 0},
+ { 16384, 16326, 16297, 16246, 16183, 16064, 15884, 15632, 15240, 14763, 14107, 13230, 12185, 10886, 9390, 7781, 6194, 4696, 3350, 2259, 1506, 975, 604, 356, 201, 106, 48, 0}
+ },
+ { /* 9.6 kbs SWB B*/
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 13.2 kbs A */
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 13.2 kbs SWB RF B*/
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 16.4 kbs B */
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 24.4 kbs B */
+ { 16384, 16351, 16333, 16303, 16254, 16163, 15993, 15681, 15080, 13987, 12109, 9465, 6588, 4160, 2488, 1480, 912, 589, 389, 266, 190, 131, 93, 68, 47, 34, 24, 0},
+ { 16384, 16379, 16375, 16369, 16360, 16345, 16328, 16286, 16211, 16078, 15810, 15233, 14058, 11933, 8881, 5609, 2940, 1290, 558, 274, 150, 80, 47, 29, 17, 11, 6, 0},
+ { 16384, 16382, 16380, 16377, 16370, 16358, 16337, 16300, 16224, 16088, 15811, 15233, 14112, 12019, 9061, 5723, 2780, 1121, 480, 239, 123, 69, 41, 22, 13, 8, 5, 0},
+ { 16384, 16377, 16375, 16369, 16363, 16351, 16325, 16268, 16172, 16009, 15686, 15039, 13830, 11799, 8924, 5422, 2444, 960, 441, 220, 111, 63, 37, 22, 11, 6, 3, 0},
+ { 16384, 16374, 16369, 16363, 16356, 16335, 16290, 16214, 16068, 15826, 15382, 14550, 13126, 10956, 8000, 4622, 2090, 973, 478, 249, 128, 75, 42, 19, 13, 7, 4, 0},
+ { 16384, 16375, 16370, 16367, 16362, 16340, 16298, 16232, 16097, 15860, 15440, 14718, 13570, 11874, 9557, 6790, 4053, 2166, 1150, 622, 323, 179, 96, 53, 33, 17, 12, 0},
+ { 16384, 16335, 16304, 16276, 16228, 16166, 16094, 15983, 15775, 15501, 15040, 14417, 13552, 12326, 10847, 9117, 7308, 5373, 3666, 2297, 1336, 807, 495, 313, 216, 152, 114, 0}
+ },
+ { /* 32.0 kbs A */
+ { 16384, 16351, 16333, 16303, 16254, 16163, 15993, 15681, 15080, 13987, 12109, 9465, 6588, 4160, 2488, 1480, 912, 589, 389, 266, 190, 131, 93, 68, 47, 34, 24, 0},
+ { 16384, 16379, 16375, 16369, 16360, 16345, 16328, 16286, 16211, 16078, 15810, 15233, 14058, 11933, 8881, 5609, 2940, 1290, 558, 274, 150, 80, 47, 29, 17, 11, 6, 0},
+ { 16384, 16382, 16380, 16377, 16370, 16358, 16337, 16300, 16224, 16088, 15811, 15233, 14112, 12019, 9061, 5723, 2780, 1121, 480, 239, 123, 69, 41, 22, 13, 8, 5, 0},
+ { 16384, 16377, 16375, 16369, 16363, 16351, 16325, 16268, 16172, 16009, 15686, 15039, 13830, 11799, 8924, 5422, 2444, 960, 441, 220, 111, 63, 37, 22, 11, 6, 3, 0},
+ { 16384, 16374, 16369, 16363, 16356, 16335, 16290, 16214, 16068, 15826, 15382, 14550, 13126, 10956, 8000, 4622, 2090, 973, 478, 249, 128, 75, 42, 19, 13, 7, 4, 0},
+ { 16384, 16375, 16370, 16367, 16362, 16340, 16298, 16232, 16097, 15860, 15440, 14718, 13570, 11874, 9557, 6790, 4053, 2166, 1150, 622, 323, 179, 96, 53, 33, 17, 12, 0},
+ { 16384, 16335, 16304, 16276, 16228, 16166, 16094, 15983, 15775, 15501, 15040, 14417, 13552, 12326, 10847, 9117, 7308, 5373, 3666, 2297, 1336, 807, 495, 313, 216, 152, 114, 0}
+ },
+ { /* 48.0 kbs B */
+ { 16384, 16334, 16310, 16285, 16254, 16204, 16128, 16031, 15903, 15697, 15380, 14820, 13857, 12267, 9878, 7099, 4509, 2576, 1478, 871, 531, 349, 230, 163, 111, 80, 62, 0},
+ { 16384, 16337, 16327, 16307, 16278, 16239, 16178, 16092, 15947, 15719, 15286, 14428, 12833, 10246, 7123, 4088, 1896, 849, 481, 287, 190, 139, 94, 66, 52, 34, 24, 0},
+ { 16384, 16352, 16341, 16329, 16312, 16295, 16265, 16223, 16151, 16026, 15825, 15437, 14645, 13089, 10612, 7364, 4077, 1783, 779, 444, 281, 192, 138, 93, 65, 43, 30, 0},
+ { 16384, 16354, 16347, 16337, 16314, 16284, 16233, 16165, 16051, 15847, 15450, 14621, 13069, 10623, 7298, 3789, 1569, 727, 445, 302, 207, 143, 96, 59, 36, 18, 9, 0},
+ { 16384, 16352, 16342, 16330, 16314, 16295, 16266, 16215, 16127, 15984, 15709, 15190, 14242, 12540, 9979, 6448, 3160, 1392, 752, 481, 344, 251, 169, 115, 73, 28, 8, 0},
+ { 16384, 16340, 16320, 16302, 16272, 16257, 16220, 16135, 16011, 15784, 15370, 14688, 13423, 11457, 8721, 5529, 2736, 1375, 784, 525, 353, 263, 172, 113, 78, 26, 11, 0},
+ { 16384, 16238, 16170, 16113, 16077, 16030, 16000, 15948, 15873, 15752, 15535, 15157, 14595, 13788, 12569, 10767, 8611, 6186, 4101, 2459, 1478, 881, 607, 385, 243, 168, 116, 0}
+ },
+ { /* 64.0 kbs B */
+ { 16384, 16334, 16310, 16285, 16254, 16204, 16128, 16031, 15903, 15697, 15380, 14820, 13857, 12267, 9878, 7099, 4509, 2576, 1478, 871, 531, 349, 230, 163, 111, 80, 62, 0},
+ { 16384, 16337, 16327, 16307, 16278, 16239, 16178, 16092, 15947, 15719, 15286, 14428, 12833, 10246, 7123, 4088, 1896, 849, 481, 287, 190, 139, 94, 66, 52, 34, 24, 0},
+ { 16384, 16352, 16341, 16329, 16312, 16295, 16265, 16223, 16151, 16026, 15825, 15437, 14645, 13089, 10612, 7364, 4077, 1783, 779, 444, 281, 192, 138, 93, 65, 43, 30, 0},
+ { 16384, 16354, 16347, 16337, 16314, 16284, 16233, 16165, 16051, 15847, 15450, 14621, 13069, 10623, 7298, 3789, 1569, 727, 445, 302, 207, 143, 96, 59, 36, 18, 9, 0},
+ { 16384, 16352, 16342, 16330, 16314, 16295, 16266, 16215, 16127, 15984, 15709, 15190, 14242, 12540, 9979, 6448, 3160, 1392, 752, 481, 344, 251, 169, 115, 73, 28, 8, 0},
+ { 16384, 16340, 16320, 16302, 16272, 16257, 16220, 16135, 16011, 15784, 15370, 14688, 13423, 11457, 8721, 5529, 2736, 1375, 784, 525, 353, 263, 172, 113, 78, 26, 11, 0},
+ { 16384, 16238, 16170, 16113, 16077, 16030, 16000, 15948, 15873, 15752, 15535, 15157, 14595, 13788, 12569, 10767, 8611, 6186, 4101, 2459, 1478, 881, 607, 385, 243, 168, 116, 0}
+ }
+};
+
+/* only needed for >= 48 kbps */
+
+const UWord16 cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1] = // Q0
+{
+ 16384, 15493, 15154, 14810, 14331, 13701, 13086, 12403, 11585, 10923, 10293, 9631, 8943, 8385, 7760, 7182, 6593, 6009, 5540, 5082, 4571, 4133, 3711, 3299, 2887, 2460, 2043, 0
+};
+
+const UWord16 cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = // Q0
+{
+ {
+ { 16384, 16313, 16312, 16241, 16206, 16099, 15957, 15386, 14601, 12852, 10282, 7534, 4964, 2966, 1824, 896, 504, 255, 113, 112, 41, 40, 39, 38, 37, 36, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16207, 16206, 16205, 16120, 15949, 14663, 12777, 9947, 6860, 3773, 1972, 772, 430, 259, 174, 89, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16115, 15941, 14891, 12965, 11477, 8587, 5347, 3421, 1407, 620, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16254, 16253, 16004, 15005, 13756, 12006, 9256, 5755, 3755, 1755, 756, 132, 131, 130, 129, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15964, 15550, 14929, 12856, 9954, 6430, 2906, 1456, 1042, 628, 214, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16087, 15503, 14334, 14333, 11994, 10240, 8193, 5268, 2929, 1760, 1176, 299, 298, 297, 296, 295, 294, 293, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 14922, 13467, 10919, 9464, 7280, 6189, 3641, 2914, 2187, 1824, 1823, 1096, 369, 368, 367, 4, 3, 2, 1, 0}
+ },
+ {
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16238, 16237, 15678, 15399, 14840, 13441, 11341, 8681, 6161, 3781, 2522, 702, 283, 144, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16374, 15693, 14671, 12625, 7507, 4778, 2390, 1368, 1028, 347, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16374, 15595, 13776, 9877, 6498, 3639, 3120, 1561, 1042, 523, 265, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 15709, 13704, 12702, 11032, 7355, 3010, 1340, 1007, 674, 341, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16374, 12816, 10683, 7125, 2854, 720, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 12738, 12737, 10920, 9103, 5466, 1828, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 15359, 15358, 14337, 14336, 14335, 14334, 14333, 10240, 7170, 5124, 2054, 1032, 1031, 1030, 1029, 7, 6, 5, 4, 3, 2, 1, 0}
+ },
+ {
+ { 16384, 16383, 16382, 16107, 16106, 16105, 16104, 16103, 15966, 15965, 15690, 15140, 14315, 12939, 10324, 8122, 4956, 2479, 1654, 966, 691, 416, 141, 140, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15320, 14265, 12945, 10568, 8984, 6343, 4230, 1853, 797, 270, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16112, 16111, 16110, 15037, 14501, 12622, 11012, 7790, 5374, 3226, 1347, 542, 275, 274, 273, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15597, 14819, 12090, 7021, 4292, 1953, 1175, 787, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 15935, 14165, 12838, 9297, 6641, 3985, 1772, 1331, 890, 449, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 14740, 13923, 9010, 6555, 4100, 2464, 828, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 13104, 13103, 8192, 4920, 1647, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+ },
+ {
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16077, 16076, 16075, 15926, 15176, 14425, 10819, 7664, 5711, 2856, 1354, 754, 454, 154, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16044, 16043, 14373, 12369, 10030, 7023, 5019, 1677, 676, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16077, 16076, 16075, 15470, 14258, 12743, 11531, 6375, 3040, 3039, 917, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15309, 13531, 11396, 7480, 3564, 1786, 364, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15833, 15289, 13652, 10377, 6556, 3827, 3283, 1646, 555, 554, 553, 552, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 14146, 13404, 13403, 13402, 10425, 7448, 3727, 2240, 2239, 752, 751, 750, 749, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 15562, 14745, 13928, 10653, 7378, 5742, 2467, 830, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+ },
+ {
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 16219, 15590, 14803, 13544, 11339, 9292, 6930, 4568, 2521, 1419, 790, 318, 161, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16014, 15652, 14925, 14198, 12743, 10196, 5464, 3645, 1826, 371, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16050, 15396, 15395, 12447, 10810, 8518, 4915, 2950, 1313, 659, 333, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 14792, 14001, 11096, 8455, 6079, 3174, 2119, 535, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 15796, 15795, 15794, 15793, 11700, 8777, 6439, 4101, 1178, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 15473, 15472, 15471, 14563, 13655, 12746, 10017, 7288, 6379, 6378, 4559, 1830, 1829, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15723, 15069, 13105, 9174, 7865, 3934, 3280, 1971, 1317, 663, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+ },
+ {
+ { 16384, 16383, 16382, 16381, 16232, 16231, 16230, 16229, 16228, 16227, 16078, 15628, 15329, 13977, 12325, 10222, 5413, 4212, 1959, 908, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16109, 15842, 15841, 13694, 11815, 10205, 5640, 3493, 2151, 1347, 543, 542, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16168, 14699, 13650, 11761, 9452, 6093, 3784, 1685, 636, 427, 426, 425, 424, 423, 422, 421, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16122, 15611, 14332, 13053, 10238, 7423, 4608, 2561, 2050, 1027, 516, 515, 260, 259, 258, 257, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 16376, 16375, 15207, 13649, 10531, 6632, 3514, 1176, 398, 397, 396, 395, 394, 393, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16379, 16378, 16377, 15749, 15120, 12601, 10082, 8823, 6304, 3785, 3156, 1267, 638, 637, 636, 7, 6, 5, 4, 3, 2, 1, 0},
+ { 16384, 16383, 15729, 15728, 15727, 15726, 15725, 15071, 14417, 12453, 10489, 8525, 5905, 1975, 1321, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}
+ },
+ {
+ { 16384, 16383, 16372, 16340, 16339, 16328, 16285, 16253, 16136, 15923, 15614, 14931, 13833, 12201, 10175, 7615, 5269, 3243, 2123, 1142, 673, 342, 182, 150, 86, 54, 11, 0},
+ { 16384, 16383, 16366, 16349, 16332, 16331, 16314, 16245, 16244, 16141, 15813, 15451, 14105, 12672, 9910, 7113, 4472, 2590, 1071, 484, 294, 156, 53, 36, 19, 18, 1, 0},
+ { 16384, 16383, 16382, 16369, 16355, 16341, 16271, 16117, 15921, 15627, 14772, 13089, 10929, 8334, 5487, 3299, 1644, 999, 424, 228, 88, 46, 18, 17, 16, 15, 14, 0},
+ { 16384, 16367, 16366, 16365, 16364, 16363, 16259, 16173, 15809, 15028, 13951, 12214, 9278, 6203, 3719, 2052, 1079, 402, 194, 125, 56, 22, 21, 20, 3, 2, 1, 0},
+ { 16384, 16383, 16360, 16359, 16358, 16357, 16356, 16333, 16332, 16143, 15954, 15434, 14227, 12262, 9540, 6652, 3882, 1988, 1207, 829, 427, 191, 73, 50, 49, 2, 1, 0},
+ { 16384, 16383, 16382, 16381, 16380, 16296, 16254, 15748, 14862, 13427, 11189, 8487, 5278, 3252, 2028, 1099, 551, 340, 298, 214, 172, 88, 46, 45, 3, 2, 1, 0},
+ { 16384, 16383, 16307, 16269, 16231, 16230, 16077, 15886, 15464, 14620, 13546, 11896, 9671, 7024, 4338, 2382, 1423, 809, 541, 311, 158, 43, 5, 4, 3, 2, 1, 0}
+ }
+};
+
+const IGF_MODE igfMode[IGF_BITRATE_UNKNOWN] =
+{
+ /* sampleRate, frameLength, igfMinFq, maxHopsize */
+ { 16000, 320, 774, 4 }, /* 9.6kbs WB 0 */
+ { 16000, 320, 774, 4 }, /* 13.2kbs WB RF 1 */
+ { 32000, 640, 800, 2 }, /* 9.6kbs SWB 2 */
+ { 32000, 640, 800, 4 }, /* 13.2kbs SWB 3 */
+ { 32000, 640, 800, 2 }, /* 13.2kbs SWB RF 4 */
+ { 32000, 640, 800, 4 }, /* 16.4kbs SWB 5 */
+ { 32000, 640, 800, 4 }, /* 24.4kbs SWB 6 */
+ { 32000, 640, 800, 4 }, /* 32.0kbs SWB 7 */
+ { 32000, 640, 1600, 4 }, /* 48.0kbs SWB 8 */
+ { 32000, 640, 1600, 4 }, /* 64.0kbs SWB 9 */
+ { 48000, 960, 800, 4 }, /* 16.4kbs FB 10 */
+ { 48000, 960, 800, 2 }, /* 24.4kbs FB 11 */
+ { 48000, 960, 800, 2 }, /* 32.0kbs FB 12 */
+ { 48000, 960, 1600, 2 }, /* 48.0kbs FB 13 */
+ { 48000, 960, 1600, 2 }, /* 64.0kbs FB 14 */
+ { 48000, 960, 1600, 1 }, /* 96.0kbs FB 15 */
+ { 48000, 960, 1600, 1 }, /*128.0kbs FB 16 */
+ { 16000, 320, 800, 2 }, /* 13.2kbs WB CPE 17 */ /* stereo mode */
+ { 16000, 320, 800, 2 }, /* 16.4kbs WB CPE 18 */ /* stereo mode */
+ { 32000, 640, 800, 2 }, /* 13.2kbs SWB CPE 19 */ /* stereo mode */
+ { 32000, 640, 800, 2 }, /* 16.4kbs SWB CPE 20 */ /* stereo mode */
+ { 32000, 640, 800, 2 }, /* 24.4kbs SWB CPE 21 */ /* stereo mode */
+ { 32000, 640, 800, 2 }, /* 32.0kbs SWB CPE 22 */ /* stereo mode */
+ { 32000, 640, 1200, 2 }, /* 48.0kbs SWB CPE 23 */ /* stereo mode */
+ { 32000, 640, 1200, 2 }, /* 48.0kbs SWB CPE 24 */ /* stereo TCX10 mode */
+ { 32000, 640, 1200, 2 }, /* 64.0kbs SWB CPE 25 */ /* stereo mode */
+ { 32000, 640, 1600, 2 }, /* 80.0kbs SWB CPE 26 */ /* stereo mode */
+ { 32000, 640, 1600, 4 }, /* 96.0kbs SWB CPE 27 */ /* stereo mode */
+ { 48000, 960, 800, 2 }, /* 24.4kbs FB CPE 28 */ /* stereo mode */
+ { 48000, 960, 800, 2 }, /* 32.0kbs FB CPE 29 */ /* stereo mode */
+ { 48000, 960, 1200, 2 }, /* 48.0kbs FB CPE 30 */ /* stereo mode */
+ { 48000, 960, 1200, 2 }, /* 48.0kbs FB CPE 31 */ /* stereo TCX10 mode */
+ { 48000, 960, 1200, 2 }, /* 64.0kbs FB CPE 32 */ /* stereo mode */
+ { 48000, 960, 1600, 2 }, /* 80.0kbs FB CPE 33 */ /* stereo mode */
+ { 48000, 960, 1600, 1 }, /* 96.0kbs FB CPE 34 */ /* stereo mode */
+ { 48000, 960, 1600, 1 } /*128.0kbs FB CPE 35 */ /* stereo mode */
+};
+
+#define STCP( a, b ) {{ WORD322WORD16( a ), WORD322WORD16( b ) }}
+
+const PWord16 SineTable512_fx[] =//Q15
+{
+ STCP(0x7fffffff, 0x00000000), STCP(0x7fffd886, 0x006487e3), STCP(0x7fff6216, 0x00c90f88), STCP(0x7ffe9cb2, 0x012d96b1),
+ STCP(0x7ffd885a, 0x01921d20), STCP(0x7ffc250f, 0x01f6a297), STCP(0x7ffa72d1, 0x025b26d7), STCP(0x7ff871a2, 0x02bfa9a4),
+ STCP(0x7ff62182, 0x03242abf), STCP(0x7ff38274, 0x0388a9ea), STCP(0x7ff09478, 0x03ed26e6), STCP(0x7fed5791, 0x0451a177),
+ STCP(0x7fe9cbc0, 0x04b6195d), STCP(0x7fe5f108, 0x051a8e5c), STCP(0x7fe1c76b, 0x057f0035), STCP(0x7fdd4eec, 0x05e36ea9),
+ STCP(0x7fd8878e, 0x0647d97c), STCP(0x7fd37153, 0x06ac406f), STCP(0x7fce0c3e, 0x0710a345), STCP(0x7fc85854, 0x077501be),
+ STCP(0x7fc25596, 0x07d95b9e), STCP(0x7fbc040a, 0x083db0a7), STCP(0x7fb563b3, 0x08a2009a), STCP(0x7fae7495, 0x09064b3a),
+ STCP(0x7fa736b4, 0x096a9049), STCP(0x7f9faa15, 0x09cecf89), STCP(0x7f97cebd, 0x0a3308bd), STCP(0x7f8fa4b0, 0x0a973ba5),
+ STCP(0x7f872bf3, 0x0afb6805), STCP(0x7f7e648c, 0x0b5f8d9f), STCP(0x7f754e80, 0x0bc3ac35), STCP(0x7f6be9d4, 0x0c27c389),
+ STCP(0x7f62368f, 0x0c8bd35e), STCP(0x7f5834b7, 0x0cefdb76), STCP(0x7f4de451, 0x0d53db92), STCP(0x7f434563, 0x0db7d376),
+ STCP(0x7f3857f6, 0x0e1bc2e4), STCP(0x7f2d1c0e, 0x0e7fa99e), STCP(0x7f2191b4, 0x0ee38766), STCP(0x7f15b8ee, 0x0f475bff),
+ STCP(0x7f0991c4, 0x0fab272b), STCP(0x7efd1c3c, 0x100ee8ad), STCP(0x7ef05860, 0x1072a048), STCP(0x7ee34636, 0x10d64dbd),
+ STCP(0x7ed5e5c6, 0x1139f0cf), STCP(0x7ec8371a, 0x119d8941), STCP(0x7eba3a39, 0x120116d5), STCP(0x7eabef2c, 0x1264994e),
+ STCP(0x7e9d55fc, 0x12c8106f), STCP(0x7e8e6eb2, 0x132b7bf9), STCP(0x7e7f3957, 0x138edbb1), STCP(0x7e6fb5f4, 0x13f22f58),
+ STCP(0x7e5fe493, 0x145576b1), STCP(0x7e4fc53e, 0x14b8b17f), STCP(0x7e3f57ff, 0x151bdf86), STCP(0x7e2e9cdf, 0x157f0086),
+ STCP(0x7e1d93ea, 0x15e21445), STCP(0x7e0c3d29, 0x16451a83), STCP(0x7dfa98a8, 0x16a81305), STCP(0x7de8a670, 0x170afd8d),
+ STCP(0x7dd6668f, 0x176dd9de), STCP(0x7dc3d90d, 0x17d0a7bc), STCP(0x7db0fdf8, 0x183366e9), STCP(0x7d9dd55a, 0x18961728),
+ STCP(0x7d8a5f40, 0x18f8b83c), STCP(0x7d769bb5, 0x195b49ea), STCP(0x7d628ac6, 0x19bdcbf3), STCP(0x7d4e2c7f, 0x1a203e1b),
+ STCP(0x7d3980ec, 0x1a82a026), STCP(0x7d24881b, 0x1ae4f1d6), STCP(0x7d0f4218, 0x1b4732ef), STCP(0x7cf9aef0, 0x1ba96335),
+ STCP(0x7ce3ceb2, 0x1c0b826a), STCP(0x7ccda169, 0x1c6d9053), STCP(0x7cb72724, 0x1ccf8cb3), STCP(0x7ca05ff1, 0x1d31774d),
+ STCP(0x7c894bde, 0x1d934fe5), STCP(0x7c71eaf9, 0x1df5163f), STCP(0x7c5a3d50, 0x1e56ca1e), STCP(0x7c4242f2, 0x1eb86b46),
+ STCP(0x7c29fbee, 0x1f19f97b), STCP(0x7c116853, 0x1f7b7481), STCP(0x7bf88830, 0x1fdcdc1b), STCP(0x7bdf5b94, 0x203e300d),
+ STCP(0x7bc5e290, 0x209f701c), STCP(0x7bac1d31, 0x21009c0c), STCP(0x7b920b89, 0x2161b3a0), STCP(0x7b77ada8, 0x21c2b69c),
+ STCP(0x7b5d039e, 0x2223a4c5), STCP(0x7b420d7a, 0x22847de0), STCP(0x7b26cb4f, 0x22e541af), STCP(0x7b0b3d2c, 0x2345eff8),
+ STCP(0x7aef6323, 0x23a6887f), STCP(0x7ad33d45, 0x24070b08), STCP(0x7ab6cba4, 0x24677758), STCP(0x7a9a0e50, 0x24c7cd33),
+ STCP(0x7a7d055b, 0x25280c5e), STCP(0x7a5fb0d8, 0x2588349d), STCP(0x7a4210d8, 0x25e845b6), STCP(0x7a24256f, 0x26483f6c),
+ STCP(0x7a05eead, 0x26a82186), STCP(0x79e76ca7, 0x2707ebc7), STCP(0x79c89f6e, 0x27679df4), STCP(0x79a98715, 0x27c737d3),
+ STCP(0x798a23b1, 0x2826b928), STCP(0x796a7554, 0x288621b9), STCP(0x794a7c12, 0x28e5714b), STCP(0x792a37fe, 0x2944a7a2),
+ STCP(0x7909a92d, 0x29a3c485), STCP(0x78e8cfb2, 0x2a02c7b8), STCP(0x78c7aba2, 0x2a61b101), STCP(0x78a63d11, 0x2ac08026),
+ STCP(0x78848414, 0x2b1f34eb), STCP(0x786280bf, 0x2b7dcf17), STCP(0x78403329, 0x2bdc4e6f), STCP(0x781d9b65, 0x2c3ab2b9),
+ STCP(0x77fab989, 0x2c98fbba), STCP(0x77d78daa, 0x2cf72939), STCP(0x77b417df, 0x2d553afc), STCP(0x7790583e, 0x2db330c7),
+ STCP(0x776c4edb, 0x2e110a62), STCP(0x7747fbce, 0x2e6ec792), STCP(0x77235f2d, 0x2ecc681e), STCP(0x76fe790e, 0x2f29ebcc),
+ STCP(0x76d94989, 0x2f875262), STCP(0x76b3d0b4, 0x2fe49ba7), STCP(0x768e0ea6, 0x3041c761), STCP(0x76680376, 0x309ed556),
+ STCP(0x7641af3d, 0x30fbc54d), STCP(0x761b1211, 0x3158970e), STCP(0x75f42c0b, 0x31b54a5e), STCP(0x75ccfd42, 0x3211df04),
+ STCP(0x75a585cf, 0x326e54c7), STCP(0x757dc5ca, 0x32caab6f), STCP(0x7555bd4c, 0x3326e2c3), STCP(0x752d6c6c, 0x3382fa88),
+ STCP(0x7504d345, 0x33def287), STCP(0x74dbf1ef, 0x343aca87), STCP(0x74b2c884, 0x34968250), STCP(0x7489571c, 0x34f219a8),
+ STCP(0x745f9dd1, 0x354d9057), STCP(0x74359cbd, 0x35a8e625), STCP(0x740b53fb, 0x36041ad9), STCP(0x73e0c3a3, 0x365f2e3b),
+ STCP(0x73b5ebd1, 0x36ba2014), STCP(0x738acc9e, 0x3714f02a), STCP(0x735f6626, 0x376f9e46), STCP(0x7333b883, 0x37ca2a30),
+ STCP(0x7307c3d0, 0x382493b0), STCP(0x72db8828, 0x387eda8e), STCP(0x72af05a7, 0x38d8fe93), STCP(0x72823c67, 0x3932ff87),
+ STCP(0x72552c85, 0x398cdd32), STCP(0x7227d61c, 0x39e6975e), STCP(0x71fa3949, 0x3a402dd2), STCP(0x71cc5626, 0x3a99a057),
+ STCP(0x719e2cd2, 0x3af2eeb7), STCP(0x716fbd68, 0x3b4c18ba), STCP(0x71410805, 0x3ba51e29), STCP(0x71120cc5, 0x3bfdfecd),
+ STCP(0x70e2cbc6, 0x3c56ba70), STCP(0x70b34525, 0x3caf50da), STCP(0x708378ff, 0x3d07c1d6), STCP(0x70536771, 0x3d600d2c),
+ STCP(0x7023109a, 0x3db832a6), STCP(0x6ff27497, 0x3e10320d), STCP(0x6fc19385, 0x3e680b2c), STCP(0x6f906d84, 0x3ebfbdcd),
+ STCP(0x6f5f02b2, 0x3f1749b8), STCP(0x6f2d532c, 0x3f6eaeb8), STCP(0x6efb5f12, 0x3fc5ec98), STCP(0x6ec92683, 0x401d0321),
+ STCP(0x6e96a99d, 0x4073f21d), STCP(0x6e63e87f, 0x40cab958), STCP(0x6e30e34a, 0x4121589b), STCP(0x6dfd9a1c, 0x4177cfb1),
+ STCP(0x6dca0d14, 0x41ce1e65), STCP(0x6d963c54, 0x42244481), STCP(0x6d6227fa, 0x427a41d0), STCP(0x6d2dd027, 0x42d0161e),
+ STCP(0x6cf934fc, 0x4325c135), STCP(0x6cc45698, 0x437b42e1), STCP(0x6c8f351c, 0x43d09aed), STCP(0x6c59d0a9, 0x4425c923),
+ STCP(0x6c242960, 0x447acd50), STCP(0x6bee3f62, 0x44cfa740), STCP(0x6bb812d1, 0x452456bd), STCP(0x6b81a3cd, 0x4578db93),
+ STCP(0x6b4af279, 0x45cd358f), STCP(0x6b13fef5, 0x4621647d), STCP(0x6adcc964, 0x46756828), STCP(0x6aa551e9, 0x46c9405c),
+ STCP(0x6a6d98a4, 0x471cece7), STCP(0x6a359db9, 0x47706d93), STCP(0x69fd614a, 0x47c3c22f), STCP(0x69c4e37a, 0x4816ea86),
+ STCP(0x698c246c, 0x4869e665), STCP(0x69532442, 0x48bcb599), STCP(0x6919e320, 0x490f57ee), STCP(0x68e06129, 0x4961cd33),
+ STCP(0x68a69e81, 0x49b41533), STCP(0x686c9b4b, 0x4a062fbd), STCP(0x683257ab, 0x4a581c9e), STCP(0x67f7d3c5, 0x4aa9dba2),
+ STCP(0x67bd0fbd, 0x4afb6c98), STCP(0x67820bb7, 0x4b4ccf4d), STCP(0x6746c7d8, 0x4b9e0390), STCP(0x670b4444, 0x4bef092d),
+ STCP(0x66cf8120, 0x4c3fdff4), STCP(0x66937e91, 0x4c9087b1), STCP(0x66573cbb, 0x4ce10034), STCP(0x661abbc5, 0x4d31494b),
+ STCP(0x65ddfbd3, 0x4d8162c4), STCP(0x65a0fd0b, 0x4dd14c6e), STCP(0x6563bf92, 0x4e210617), STCP(0x6526438f, 0x4e708f8f),
+ STCP(0x64e88926, 0x4ebfe8a5), STCP(0x64aa907f, 0x4f0f1126), STCP(0x646c59bf, 0x4f5e08e3), STCP(0x642de50d, 0x4faccfab),
+ STCP(0x63ef3290, 0x4ffb654d), STCP(0x63b0426d, 0x5049c999), STCP(0x637114cc, 0x5097fc5e), STCP(0x6331a9d4, 0x50e5fd6d),
+ STCP(0x62f201ac, 0x5133cc94), STCP(0x62b21c7b, 0x518169a5), STCP(0x6271fa69, 0x51ced46e), STCP(0x62319b9d, 0x521c0cc2),
+ STCP(0x61f1003f, 0x5269126e), STCP(0x61b02876, 0x52b5e546), STCP(0x616f146c, 0x53028518), STCP(0x612dc447, 0x534ef1b5),
+ STCP(0x60ec3830, 0x539b2af0), STCP(0x60aa7050, 0x53e73097), STCP(0x60686ccf, 0x5433027d), STCP(0x60262dd6, 0x547ea073),
+ STCP(0x5fe3b38d, 0x54ca0a4b), STCP(0x5fa0fe1f, 0x55153fd4), STCP(0x5f5e0db3, 0x556040e2), STCP(0x5f1ae274, 0x55ab0d46),
+ STCP(0x5ed77c8a, 0x55f5a4d2), STCP(0x5e93dc1f, 0x56400758), STCP(0x5e50015d, 0x568a34a9), STCP(0x5e0bec6e, 0x56d42c99),
+ STCP(0x5dc79d7c, 0x571deefa), STCP(0x5d8314b1, 0x57677b9d), STCP(0x5d3e5237, 0x57b0d256), STCP(0x5cf95638, 0x57f9f2f8),
+ STCP(0x5cb420e0, 0x5842dd54), STCP(0x5c6eb258, 0x588b9140), STCP(0x5c290acc, 0x58d40e8c), STCP(0x5be32a67, 0x591c550e),
+ STCP(0x5b9d1154, 0x59646498), STCP(0x5b56bfbd, 0x59ac3cfd), STCP(0x5b1035cf, 0x59f3de12), STCP(0x5ac973b5, 0x5a3b47ab),
+ STCP(0x5a82799a, 0x5a82799a)
+};
+
+/* Lookup-Table for binary logarithm */
+const Word16 ldCoeff[7] =//Q15
+{
+ -32768, -16384, -10923, -8192, -6554, -5461, -4681
+ /* -4096, -3641, -3277 */
+};
+
+/* Lookup-Table for binary power algorithm */
+/* This table is used for lookup 2^x with x in range [0...1.0[ in steps of 1/32 */
+const UWord32 exp2_tab_long[32] =//Q31
+{
+ 0x40000000,0x4166C34C,0x42D561B4,0x444C0740,
+ 0x45CAE0F2,0x47521CC6,0x48E1E9BA,0x4A7A77D4,
+ 0x4C1BF829,0x4DC69CDD,0x4F7A9930,0x51382182,
+ 0x52FF6B55,0x54D0AD5A,0x56AC1F75,0x5891FAC1,
+ 0x5A82799A,0x5C7DD7A4,0x5E8451D0,0x60962665,
+ 0x62B39509,0x64DCDEC3,0x6712460B,0x69540EC9,
+ 0x6BA27E65,0x6DFDDBCC,0x70666F76,0x72DC8374,
+ 0x75606374,0x77F25CCE,0x7A92BE8B,0x7D41D96E
+};
+
+/* Lookup-Table for binary power algorithm */
+/* This table is used for lookup 2^x with x in range [0...1/32[ in steps of 1/1024 */
+const UWord32 exp2w_tab_long[32] =//Q31
+{
+ 0x40000000,0x400B1818,0x4016321B,0x40214E0C,
+ 0x402C6BE9,0x40378BB4,0x4042AD6D,0x404DD113,
+ 0x4058F6A8,0x40641E2B,0x406F479E,0x407A7300,
+ 0x4085A051,0x4090CF92,0x409C00C4,0x40A733E6,
+ 0x40B268FA,0x40BD9FFF,0x40C8D8F5,0x40D413DD,
+ 0x40DF50B8,0x40EA8F86,0x40F5D046,0x410112FA,
+ 0x410C57A2,0x41179E3D,0x4122E6CD,0x412E3152,
+ 0x41397DCC,0x4144CC3B,0x41501CA0,0x415B6EFB
+};
+
+/* Lookup-Table for binary power algorithm */
+/* This table is used for lookup 2^x with x in range [0...1/1024[ in steps of 1/32768 */
+const UWord32 exp2x_tab_long[32] =//Q31
+{
+ 0x40000000,0x400058B9,0x4000B173,0x40010A2D,
+ 0x400162E8,0x4001BBA3,0x4002145F,0x40026D1B,
+ 0x4002C5D8,0x40031E95,0x40037752,0x4003D011,
+ 0x400428CF,0x4004818E,0x4004DA4E,0x4005330E,
+ 0x40058BCE,0x4005E48F,0x40063D51,0x40069613,
+ 0x4006EED5,0x40074798,0x4007A05B,0x4007F91F,
+ 0x400851E4,0x4008AAA8,0x4009036E,0x40095C33,
+ 0x4009B4FA,0x400A0DC0,0x400A6688,0x400ABF4F
+};
+
+/* square root tables */
+const Word32 SqrtTable[32] = /* Q31 */
+{
+ 0x5A82D429, 0x5BEA10FE, 0x5D4BE6E5, 0x5EA89270, 0x60004BE2, 0x615347A1, 0x62A1B68C, 0x63EBC651,
+ 0x6531A1B5, 0x667370D4, 0x67B1595F, 0x68EB7EC8, 0x6A220277, 0x6B5503F0, 0x6C84A0F9, 0x6DB0F5BD,
+ 0x6EDA1CE9, 0x70002FC7, 0x7123465A, 0x72437773, 0x7360D8C5, 0x747B7EFA, 0x75937DC4, 0x76A8E7EB,
+ 0x77BBCF60, 0x78CC4545, 0x79DA5A00, 0x7AE61D3E, 0x7BEF9E07, 0x7CF6EAC2, 0x7DFC113F, 0x7EFF1EC0
+};
+
+const Word16 SqrtDiffTable[32] = /* Q15 */
+{
+ 0x59CF, 0x5875, 0x572B, 0x55EE, 0x54BF, 0x539C, 0x5284, 0x5177,
+ 0x5074, 0x4F7A, 0x4E89, 0x4DA1, 0x4CC0, 0x4BE7, 0x4B15, 0x4A4A,
+ 0x4985, 0x48C6, 0x480C, 0x4758, 0x46AA, 0x4600, 0x455B, 0x44BA,
+ 0x441D, 0x4385, 0x42F1, 0x4260, 0x41D3, 0x414A, 0x40C3, 0x4040
+};
+
+const Word32 ISqrtTable[32] = /* Q31 */
+{
+ 0x7FFE7F85, 0x7E0A4E25, 0x7C2C56C7, 0x7A63002C, 0x78ACD922, 0x7708939D, 0x75750088, 0x73F10C2D,
+ 0x727BBB1A, 0x71142774, 0x6FB97EA5, 0x6E6AFF54, 0x6D27F79D, 0x6BEFC388, 0x6AC1CBA4, 0x699D83DA,
+ 0x68826A53, 0x6770068E, 0x6665E882, 0x6563A7DF, 0x6468E364, 0x63754043, 0x62886999, 0x61A20FEE,
+ 0x60C1E8C8, 0x5FE7AE45, 0x5F131EBE, 0x5E43FC76, 0x5D7A0D4F, 0x5CB51A81, 0x5BF4F061, 0x5B395E26
+};
+
+const Word16 ISqrtDiffTable[32] = /* Q15 */
+{
+ 0x7D0C, 0x777E, 0x7256, 0x6D8A, 0x6911, 0x64E5, 0x60FD, 0x5D54,
+ 0x59E5, 0x56AA, 0x53A0, 0x50C2, 0x4E0D, 0x4B7E, 0x4912, 0x46C6,
+ 0x4499, 0x4288, 0x4090, 0x3EB1, 0x3CE9, 0x3B36, 0x3996, 0x380A,
+ 0x368F, 0x3524, 0x33C9, 0x327C, 0x313D, 0x300B, 0x2EE5, 0x2DCA
+};
+
+/* 1/x tables */
+const Word32 InvTable[32] = /* Q31 */
+{
+ 0x7FFBFE40, 0x7C1B608E, 0x78752176, 0x750440BA, 0x71C44C49, 0x6EB14D0A, 0x6BC7B6B4, 0x69045A19,
+ 0x6664598A, 0x63E51EE2, 0x61845308, 0x5F3FD698, 0x5D15BB8E, 0x5B043FD0, 0x5909C861, 0x5724DD3C,
+ 0x555425B2, 0x53966532, 0x51EA787F, 0x504F5331, 0x4EC3FD84, 0x4D479267, 0x4BD93DBE, 0x4A783ADC,
+ 0x4923D31D, 0x47DB5CAE, 0x469E3974, 0x456BD608, 0x4443A8D9, 0x43253159, 0x420FF746, 0x41038A01
+};
+
+const Word16 InvDiffTable[32] = /* Q15 */
+{
+ 0x7C14, 0x74C8, 0x6E1C, 0x67FF, 0x6260, 0x5D33, 0x586C, 0x5400,
+ 0x4FE7, 0x4C19, 0x4890, 0x4543, 0x422F, 0x3F4F, 0x3C9D, 0x3A17,
+ 0x37B8, 0x357E, 0x3365, 0x316B, 0x2F8D, 0x2DCB, 0x2C20, 0x2A8D,
+ 0x290F, 0x27A4, 0x264C, 0x2506, 0x23CF, 0x22A7, 0x218E, 0x2081
+};
+
+const Word16 tcx_mdct_window_48_fx[420] =//Q15
+{ 61, 183, 306, 428, 551, 673, 796, 919, 1041, 1163, 1286,
+1408, 1531, 1653, 1776, 1898, 2020, 2143, 2265, 2387, 2509,
+2632, 2754, 2876, 2998, 3120, 3242, 3364, 3486, 3607, 3729,
+3851, 3973, 4094, 4216, 4337, 4459, 4580, 4701, 4823, 4944,
+5065, 5186, 5307, 5428, 5549, 5669, 5790, 5911, 6031, 6152,
+6272, 6392, 6512, 6632, 6752, 6872, 6992, 7112, 7231, 7351,
+7470, 7589, 7709, 7828, 7947, 8065, 8184, 8303, 8421, 8540,
+8658, 8776, 8894, 9012, 9130, 9247, 9365, 9482, 9599, 9717,
+9834, 9950, 10067, 10184, 10300, 10416, 10532, 10648, 10764, 10880,
+10995, 11111, 11226, 11341, 11456, 11571, 11685, 11800, 11914, 12028,
+12142, 12256, 12369, 12483, 12596, 12709, 12822, 12934, 13047, 13159,
+13271, 13383, 13495, 13607, 13718, 13829, 13940, 14051, 14162, 14272,
+14382, 14492, 14602, 14712, 14821, 14930, 15039, 15148, 15257, 15365,
+15473, 15581, 15689, 15796, 15904, 16011, 16117, 16224, 16330, 16437,
+16542, 16648, 16754, 16859, 16964, 17068, 17173, 17277, 17381, 17485,
+17589, 17692, 17795, 17898, 18000, 18102, 18204, 18306, 18408, 18509,
+18610, 18711, 18811, 18911, 19011, 19111, 19210, 19310, 19408, 19507,
+19605, 19703, 19801, 19899, 19996, 20093, 20190, 20286, 20382, 20478,
+20573, 20669, 20764, 20858, 20953, 21047, 21140, 21234, 21327, 21420,
+21513, 21605, 21697, 21789, 21880, 21971, 22062, 22152, 22242, 22332,
+22422, 22511, 22600, 22688, 22777, 22865, 22952, 23040, 23127, 23213,
+23300, 23386, 23471, 23557, 23642, 23726, 23811, 23895, 23978, 24062,
+24145, 24227, 24310, 24392, 24473, 24555, 24636, 24716, 24797, 24877,
+24956, 25035, 25114, 25193, 25271, 25349, 25426, 25504, 25580, 25657,
+25733, 25808, 25884, 25959, 26033, 26108, 26181, 26255, 26328, 26401,
+26473, 26545, 26617, 26688, 26759, 26830, 26900, 26970, 27039, 27108,
+27177, 27245, 27313, 27381, 27448, 27514, 27581, 27647, 27712, 27778,
+27842, 27907, 27971, 28034, 28098, 28161, 28223, 28285, 28347, 28408,
+28469, 28529, 28589, 28649, 28708, 28767, 28826, 28884, 28942, 28999,
+29056, 29112, 29168, 29224, 29279, 29334, 29388, 29442, 29496, 29549,
+29602, 29654, 29706, 29758, 29809, 29859, 29910, 29959, 30009, 30058,
+30106, 30155, 30202, 30250, 30297, 30343, 30389, 30435, 30480, 30525,
+30569, 30613, 30656, 30700, 30742, 30784, 30826, 30867, 30908, 30949,
+30989, 31029, 31068, 31106, 31145, 31183, 31220, 31257, 31294, 31330,
+31365, 31401, 31435, 31470, 31504, 31537, 31570, 31603, 31635, 31667,
+31698, 31729, 31759, 31789, 31819, 31848, 31876, 31905, 31932, 31960,
+31986, 32013, 32039, 32064, 32089, 32114, 32138, 32162, 32185, 32208,
+32230, 32252, 32273, 32294, 32315, 32335, 32354, 32374, 32392, 32411,
+32428, 32446, 32463, 32479, 32495, 32511, 32526, 32540, 32555, 32568,
+32582, 32594, 32607, 32619, 32630, 32641, 32652, 32662, 32671, 32680,
+32689, 32697, 32705, 32712, 32719, 32726, 32732, 32737, 32742, 32747,
+32751, 32755, 32758, 32761, 32763, 32765, 32766, 32767, 32767 };
+
+const Word16 tcx_mdct_window_half_48_fx[180] =//Q15
+{
+ 142, 428, 714, 1000, 1286, 1572, 1857, 2143, 2428, 2713, 2998,
+3282, 3567, 3851, 4135, 4418, 4701, 4984, 5267, 5549, 5830,
+6112, 6392, 6672, 6952, 7231, 7510, 7788, 8065, 8342, 8619,
+8894, 9169, 9443, 9717, 9989, 10261, 10532, 10803, 11072, 11341,
+11609, 11876, 12142, 12407, 12671, 12934, 13197, 13458, 13718, 13977,
+14235, 14492, 14748, 15003, 15257, 15509, 15761, 16011, 16260, 16507,
+16754, 16999, 17242, 17485, 17726, 17966, 18204, 18441, 18677, 18911,
+19144, 19376, 19605, 19834, 20061, 20286, 20510, 20732, 20953, 21172,
+21389, 21605, 21819, 22032, 22242, 22452, 22659, 22865, 23069, 23271,
+23471, 23670, 23867, 24062, 24255, 24446, 24636, 24823, 25009, 25193,
+25375, 25555, 25733, 25909, 26083, 26255, 26425, 26593, 26759, 26923,
+27085, 27245, 27403, 27559, 27712, 27864, 28013, 28161, 28306, 28449,
+28589, 28728, 28865, 28999, 29131, 29261, 29388, 29514, 29637, 29758,
+29876, 29992, 30106, 30218, 30328, 30435, 30540, 30642, 30742, 30840,
+30935, 31029, 31119, 31208, 31294, 31377, 31458, 31537, 31614, 31688,
+31759, 31828, 31895, 31960, 32021, 32081, 32138, 32192, 32245, 32294,
+32341, 32386, 32428, 32468, 32506, 32540, 32573, 32603, 32630, 32655,
+32677, 32697, 32715, 32730, 32742, 32752, 32760, 32765, 32767 };
+
+
+const Word16 tcx_mdct_window_trans_48_fx[60] =//Q15
+{ 428, 1286, 2143, 2998, 3851, 4701, 5549, 6392, 7231, 8065, 8894,
+9717, 10532, 11341, 12142, 12934, 13718, 14492, 15257, 16011, 16754,
+17485, 18204, 18911, 19605, 20286, 20953, 21605, 22242, 22865, 23471,
+24062, 24636, 25193, 25733, 26255, 26759, 27245, 27712, 28161, 28589,
+28999, 29388, 29758, 30106, 30435, 30742, 31029, 31294, 31537, 31759,
+31960, 32138, 32294, 32428, 32540, 32630, 32697, 32742, 32765
+};
-#include "prot_fx.h"
-#include "basop_util.h"
-#include "wmc_auto.h"
-#include "rom_com_fx.h"
+/*----------------------------------------------------------------------------------*
+ * SWB TBE LSF tables (1.75 kbps)
+ *----------------------------------------------------------------------------------*/
+
+const Word32 sigma_BWE_fx[] = {//Q31
+17011214, 16701976, 17561200,
+17474996, 19251270, 20645372, 39204284,
+40792208, 18917444, 18895726, 19477682,
+19499580, 20916386, 22705246, 39204284,
+40792208 }; /* for 3 bits first stage */
+
+
+const Word16 inv_modified_sigma_BWE_fx[] = {//x2.56
+323,
+329,
+313,
+314,
+285,
+266,
+140,
+134,
+290,
+290,
+282,
+281,
+262,
+242,
+140,
+134
+};
+
+const Word16 modified_sigma_BWE_fx[] =//Q15
+{ 259,
+254,
+267,
+266,
+293,
+315,
+598,
+622,
+288,
+288,
+297,
+297,
+319,
+346,
+598,
+622 };
+
+
+const Word16 SHB_LSF_mean_fx[10] = {//Q15
+1353, 2646, 4046,
+5428, 6896, 8339, 9863,
+11368, 12977, 14558
+};
+
+/* 4 bit VQ first stage */
+/* An 6-by-16 matrix */
+
+const Word16 SHB_LSF_VQ4_fx[96] =//Q15
+{ 150, 51, -507, -986, -1115, -944,
+-184, -77, 95, 232, 440, 497, -115,
+-107, -109, -242, -446, -592, 387, 799,
+1132, 1263, 1259, 1122, -128, -599, -1214,
+-1389, -1319, -1016, 533, 424, 148, -125,
+-378, -501, -337, -590, -587, -630, -715,
+-750, 504, 849, 750, 508, 234, 68,
+176, -177, -407, 327, 206, 21, -107,
+341, 423, 264, -17, -180, -110, -381,
+-716, -725, -232, -42, 170, 265, 273,
+336, 397, 450, 69, 285, 519, 686,
+656, 564, 120, 115, -123, -382, -19,
+234, -377, -629, -296, -95, 21, 63,
+-206, -456, 518, 472, 179, 22 };
+/* 3 bit VQ first stage */
+const Word16 SHB_LSF_VQ3_fx[48] =//Q15
+{ 278, 403, 285, 65, -206, -337,
+386, 770, 838, 753, 599, 445, -196,
+-455, -609, -524, -206, -78, 39, 199,
+393, 514, 491, 462, -91, -435, -979,
+-1241, -1225, -976, -52, -98, -216, -422,
+-599, -688, 127, 137, 0, 52, 301,
+412, -278, -422, 9, 199, 137, 72 };
+const Word16 *const cb_LSF_BWE_fx[] = { SHB_LSF_VQ4_fx, SHB_LSF_VQ3_fx }; // Q15
+
+const Word16 mslvq_SHB_min_bits[] = {14, 12}; /* for 4 bits and 3 bits respectively Q0*/
+
+const Word16 scales_BWE_fx[] = {//Q13
+7634, 13737,
+23027, 7299, 14499,
+24592, 6955, 14491,
+26427 };
+
+const Word16 scales_BWE_fx_new[] = {//Q11
+
+1908,
+3434,
+5756,
+1824,
+3624,
+6148,
+1738,
+3622,
+6606
+};
+const Word8 no_lead_BWE[] = { // Q0
+ 8, 6, 5, /* 14 bits */
+ 10,9,5, /* 15 bits*/
+ 16, 11, 5}; /* 16 bits */
+
+const Word16 scales_BWE_3b_fx[] = {//Q13
+7847, 14262,
+28934, 7610, 12771,
+21544, 7249, 12689,
+23060 };
+
+const Word16 scales_BWE_3b_fx_new[] = {//Q11
+ 1961,
+3565,
+7233,
+1902,
+3192,
+5386,
+1812,
+3172,
+5765
+};
+
+const Word8 no_lead_BWE_3b[] = { // Q0
+ 4, 5, 2, /* 12 bits */
+ 5, 5, 5, /* 13 bits */
+ 8, 6, 5 /* 14 bits */
+ };
+
+const Word32 LastCoefPred_0bit_fx[18] =//Q31
+{
+10930692, -29356102, -14495515,
+-11918534, 3435973, 89292368, 269423296,
+1105954048, 0, 17544942, -13851270,
+-20121922, -15590731, 7795365, 46127948,
+176888224, 438086656, 0 };
+
+
+const Word32 LastCoefPred_1bit_fx[36] = {//Q31
+37795712, -47094316, 24910810,
+18060338, 38268160, 87424056, 217346816,
+810181184, 9685151, 53107272, -26843546,
+11703786, -7301444, 20444044, 22655952,
+138448272, 307648512, 9234180 };
+
+const Word16 config_LSF_BWE[] = { // Q0
+ 4, 16, 1, /* 21 bits */
+ 4, 16, 1, /* 20 */
+ 4, 16, 1, /* 19 */
+ 3, 8, 1, /* 18 */
+ 3, 8, 1, /* 17 */
+ 3, 8, 0 /* 16 */
+};
+
+//basops
+const Word32 BASOP_util_normReciprocal[CHEAP_NORM_SIZE] =
+{
+ 0l/*0.0 Q31*/, 2147483647l/*1.0000000000 Q31*/, 1073741824l/*0.5000000000 Q31*/, 715827883l/*0.3333333333 Q31*/, 536870912l/*0.2500000000 Q31*/, 429496730l/*0.2000000000 Q31*/,
+ 357913941l/*0.1666666667 Q31*/, 306783378l/*0.1428571429 Q31*/, 268435456l/*0.1250000000 Q31*/, 238609294l/*0.1111111111 Q31*/, 214748365l/*0.1000000000 Q31*/, 195225786l/*0.0909090909 Q31*/,
+ 178956971l/*0.0833333333 Q31*/, 165191050l/*0.0769230769 Q31*/, 153391689l/*0.0714285714 Q31*/, 143165577l/*0.0666666667 Q31*/, 134217728l/*0.0625000000 Q31*/, 126322568l/*0.0588235294 Q31*/,
+ 119304647l/*0.0555555556 Q31*/, 113025455l/*0.0526315789 Q31*/, 107374182l/*0.0500000000 Q31*/, 102261126l/*0.0476190476 Q31*/, 97612893l/*0.0454545455 Q31*/, 93368854l/*0.0434782609 Q31*/,
+ 89478485l/*0.0416666667 Q31*/, 85899346l/*0.0400000000 Q31*/, 82595525l/*0.0384615385 Q31*/, 79536431l/*0.0370370370 Q31*/, 76695845l/*0.0357142857 Q31*/, 74051160l/*0.0344827586 Q31*/,
+ 71582788l/*0.0333333333 Q31*/, 69273666l/*0.0322580645 Q31*/, 67108864l/*0.0312500000 Q31*/, 65075262l/*0.0303030303 Q31*/, 63161284l/*0.0294117647 Q31*/, 61356676l/*0.0285714286 Q31*/,
+ 59652324l/*0.0277777778 Q31*/, 58040099l/*0.0270270270 Q31*/, 56512728l/*0.0263157895 Q31*/, 55063683l/*0.0256410256 Q31*/, 53687091l/*0.0250000000 Q31*/, 52377650l/*0.0243902439 Q31*/,
+ 51130563l/*0.0238095238 Q31*/, 49941480l/*0.0232558140 Q31*/, 48806446l/*0.0227272727 Q31*/, 47721859l/*0.0222222222 Q31*/, 46684427l/*0.0217391304 Q31*/, 45691141l/*0.0212765957 Q31*/,
+ 44739243l/*0.0208333333 Q31*/, 43826197l/*0.0204081633 Q31*/, 42949673l/*0.0200000000 Q31*/, 42107522l/*0.0196078431 Q31*/, 41297762l/*0.0192307692 Q31*/, 40518559l/*0.0188679245 Q31*/,
+ 39768216l/*0.0185185185 Q31*/, 39045157l/*0.0181818182 Q31*/, 38347922l/*0.0178571429 Q31*/, 37675152l/*0.0175438596 Q31*/, 37025580l/*0.0172413793 Q31*/, 36398028l/*0.0169491525 Q31*/,
+ 35791394l/*0.0166666667 Q31*/, 35204650l/*0.0163934426 Q31*/, 34636833l/*0.0161290323 Q31*/, 34087042l/*0.0158730159 Q31*/, 33554432l/*0.0156250000 Q31*/, 33038210l/*0.0153846154 Q31*/,
+ 32537631l/*0.0151515152 Q31*/, 32051995l/*0.0149253731 Q31*/, 31580642l/*0.0147058824 Q31*/, 31122951l/*0.0144927536 Q31*/, 30678338l/*0.0142857143 Q31*/, 30246248l/*0.0140845070 Q31*/,
+ 29826162l/*0.0138888889 Q31*/, 29417584l/*0.0136986301 Q31*/, 29020049l/*0.0135135135 Q31*/, 28633115l/*0.0133333333 Q31*/, 28256364l/*0.0131578947 Q31*/, 27889398l/*0.0129870130 Q31*/,
+ 27531842l/*0.0128205128 Q31*/, 27183337l/*0.0126582278 Q31*/, 26843546l/*0.0125000000 Q31*/, 26512144l/*0.0123456790 Q31*/, 26188825l/*0.0121951220 Q31*/, 25873297l/*0.0120481928 Q31*/,
+ 25565282l/*0.0119047619 Q31*/, 25264514l/*0.0117647059 Q31*/, 24970740l/*0.0116279070 Q31*/, 24683720l/*0.0114942529 Q31*/, 24403223l/*0.0113636364 Q31*/, 24129030l/*0.0112359551 Q31*/,
+ 23860929l/*0.0111111111 Q31*/, 23598721l/*0.0109890110 Q31*/, 23342214l/*0.0108695652 Q31*/, 23091222l/*0.0107526882 Q31*/, 22845571l/*0.0106382979 Q31*/, 22605091l/*0.0105263158 Q31*/,
+ 22369621l/*0.0104166667 Q31*/, 22139007l/*0.0103092784 Q31*/, 21913098l/*0.0102040816 Q31*/, 21691754l/*0.0101010101 Q31*/, 21474836l/*0.0100000000 Q31*/, 21262214l/*0.0099009901 Q31*/,
+ 21053761l/*0.0098039216 Q31*/, 20849356l/*0.0097087379 Q31*/, 20648881l/*0.0096153846 Q31*/, 20452225l/*0.0095238095 Q31*/, 20259280l/*0.0094339623 Q31*/, 20069941l/*0.0093457944 Q31*/,
+ 19884108l/*0.0092592593 Q31*/, 19701685l/*0.0091743119 Q31*/, 19522579l/*0.0090909091 Q31*/, 19346700l/*0.0090090090 Q31*/, 19173961l/*0.0089285714 Q31*/, 19004280l/*0.0088495575 Q31*/,
+ 18837576l/*0.0087719298 Q31*/, 18673771l/*0.0086956522 Q31*/, 18512790l/*0.0086206897 Q31*/, 18354561l/*0.0085470085 Q31*/, 18199014l/*0.0084745763 Q31*/, 18046081l/*0.0084033613 Q31*/,
+ 17895697l/*0.0083333333 Q31*/, 17747799l/*0.0082644628 Q31*/, 17602325l/*0.0081967213 Q31*/, 17459217l/*0.0081300813 Q31*/, 17318416l/*0.0080645161 Q31*/, 17179869l/*0.0080000000 Q31*/,
+ 17043521l/*0.0079365079 Q31*/, 16909320l/*0.0078740157 Q31*/, 16777216l/*0.0078125000 Q31*/, 16647160l/*0.0077519380 Q31*/, 16519105l/*0.0076923077 Q31*/, 16393005l/*0.0076335878 Q31*/,
+ 16268816l/*0.0075757576 Q31*/, 16146494l/*0.0075187970 Q31*/, 16025997l/*0.0074626866 Q31*/, 15907286l/*0.0074074074 Q31*/, 15790321l/*0.0073529412 Q31*/, 15675063l/*0.0072992701 Q31*/,
+ 15561476l/*0.0072463768 Q31*/, 15449523l/*0.0071942446 Q31*/, 15339169l/*0.0071428571 Q31*/, 15230381l/*0.0070921986 Q31*/, 15123124l/*0.0070422535 Q31*/, 15017368l/*0.0069930070 Q31*/,
+ 14913081l/*0.0069444444 Q31*/, 14810232l/*0.0068965517 Q31*/, 14708792l/*0.0068493151 Q31*/, 14608732l/*0.0068027211 Q31*/, 14510025l/*0.0067567568 Q31*/, 14412642l/*0.0067114094 Q31*/,
+ 14316558l/*0.0066666667 Q31*/, 14221746l/*0.0066225166 Q31*/, 14128182l/*0.0065789474 Q31*/, 14035841l/*0.0065359477 Q31*/, 13944699l/*0.0064935065 Q31*/, 13854733l/*0.0064516129 Q31*/,
+ 13765921l/*0.0064102564 Q31*/, 13678240l/*0.0063694268 Q31*/, 13591669l/*0.0063291139 Q31*/, 13506187l/*0.0062893082 Q31*/, 13421773l/*0.0062500000 Q31*/
+};
+
+const Word16 f_atan_expand_range[MAXSFTAB - (MINSFTAB - 1)] =
+{
+ /*****************************************************************************
+ *
+ * Table holds fixp_atan() output values which are outside of input range
+ * of fixp_atan() to improve SNR of fixp_atan2().
+ *
+ * This Table might also be used in fixp_atan() [todo] so there a wider input
+ * range can be covered, too.
+ *
+ * Matlab (generate table):
+ * for scl = 7:25 % MINSFTAB .. MAXSFTAB
+ * at=atan(0.5 *(2^scl)); % 0.5 because get in 'middle' area of current scale level 'scl'
+ * at/2 % div at by ATO_SCALE
+ * end
+ *
+ * Table divided by 2=ATO_SCALE <-- SF=ATO_SF
+ *****************************************************************************/
+ 25480/*7.775862990872099e-001 Q15*/, 25608/*7.814919928673978e-001 Q15*/, 25672/*7.834450483314648e-001 Q15*/,
+ 25704/*7.844216021392089e-001 Q15*/, 25720/*7.849098823026687e-001 Q15*/, 25728/*7.851540227918509e-001 Q15*/,
+ 25732/*7.852760930873737e-001 Q15*/, 25734/*7.853371282415015e-001 Q15*/, 25735/*7.853676458193612e-001 Q15*/,
+ 25735/*7.853829046083906e-001 Q15*/, 25736/*7.853905340029177e-001 Q15*/, 25736/*7.853943487001828e-001 Q15*/,
+ 25736/*7.853962560488155e-001 Q15*/, 25736/*7.853972097231319e-001 Q15*/, 25736/*7.853976865602901e-001 Q15*/,
+ 25736/*7.853979249788692e-001 Q15*/, 25736/*7.853980441881587e-001 Q15*/, 25736/*7.853981037928035e-001 Q15*/,
+ 25736/*7.853981335951259e-001 Q15*/
+ /* pi/4 = 0.785398163397448 = pi/2/ATO_SCALE */
+};
+
+
+const Word16 Grid[GRID100_POINTS + 1] =//Q15
+{
+ 32767, 32751, 32703, 32622, 32509, 32364,
+ 32187, 31978, 31738, 31466, 31164, 30830,
+ 30466, 30072, 29649, 29196, 28714, 28204,
+ 27666, 27101, 26509, 25891, 25248, 24579,
+ 23886, 23170, 22431, 21669, 20887, 20083,
+ 19260, 18418, 17557, 16680, 15786, 14876,
+ 13951, 13013, 12062, 11099, 10125, 9141,
+ 8149, 7148, 6140, 5126, 4106, 3083,
+ 2057, 1029, 0, -1029, -2057, -3083,
+ -4106, -5126, -6140, -7148, -8149, -9141,
+ -10125, -11099, -12062, -13013, -13951, -14876,
+ -15786, -16680, -17557, -18418, -19260, -20083,
+ -20887, -21669, -22431, -23170, -23886, -24579,
+ -25248, -25891, -26509, -27101, -27666, -28204,
+ -28714, -29196, -29649, -30072, -30466, -30830,
+ -31164, -31466, -31738, -31978, -32187, -32364,
+ -32509, -32622, -32703, -32751, -32760
+};
+
+const Word16 pwAlpha[10] = { 0x6666, 0x51ec, 0x4189, 0x346e, 0x29f1,//Q15
+ 0x218e, 0x1ad8, 0x157a, 0x112e, 0x0dbe
+};
+
+/* Used in 'lsp2lsf_fx.c' */
+const Word8 Ind_Guess[256] =
+{
+ 126, 122, 120, 119, 117, 116, 115, 114,
+ 113, 112, 111, 110, 110, 109, 108, 108,
+ 107, 106, 106, 105, 104, 104, 103, 103,
+ 102, 102, 101, 101, 100, 100, 99, 99,
+ 98, 98, 97, 97, 96, 96, 95, 95,
+ 94, 94, 94, 93, 93, 92, 92, 91,
+ 91, 91, 90, 90, 89, 89, 89, 88,
+ 88, 87, 87, 87, 86, 86, 86, 85,
+ 85, 84, 84, 84, 83, 83, 83, 82,
+ 82, 82, 81, 81, 81, 80, 80, 80,
+ 79, 79, 78, 78, 78, 77, 77, 77,
+ 76, 76, 76, 75, 75, 75, 74, 74,
+ 74, 73, 73, 73, 72, 72, 72, 72,
+ 71, 71, 71, 70, 70, 70, 69, 69,
+ 69, 68, 68, 68, 67, 67, 67, 66,
+ 66, 66, 65, 65, 65, 64, 64, 64,
+ 64, 63, 63, 63, 62, 62, 62, 61,
+ 61, 61, 60, 60, 60, 59, 59, 59,
+ 58, 58, 58, 57, 57, 57, 56, 56,
+ 56, 55, 55, 55, 55, 54, 54, 54,
+ 53, 53, 53, 52, 52, 52, 51, 51,
+ 51, 50, 50, 50, 49, 49, 49, 48,
+ 48, 47, 47, 47, 46, 46, 46, 45,
+ 45, 45, 44, 44, 44, 43, 43, 43,
+ 42, 42, 41, 41, 41, 40, 40, 40,
+ 39, 39, 38, 38, 38, 37, 37, 36,
+ 36, 36, 35, 35, 34, 34, 33, 33,
+ 33, 32, 32, 31, 31, 30, 30, 29,
+ 29, 28, 28, 27, 27, 26, 26, 25,
+ 25, 24, 24, 23, 23, 22, 21, 21,
+ 20, 19, 19, 18, 17, 17, 16, 15,
+ 14, 13, 12, 11, 10, 8, 7, 5
+};
+
+const Word16 cos_table_129[129] =//Q15
+{
+ 32767,
+ 32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138,
+ 31972, 31786, 31581, 31357, 31114, 30853, 30572, 30274,
+ 29957, 29622, 29269, 28899, 28511, 28106, 27684, 27246,
+ 26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170,
+ 22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205,
+ 17531, 16846, 16151, 15447, 14733, 14010, 13279, 12540,
+ 11793, 11039, 10279, 9512, 8740, 7962, 7180, 6393,
+ 5602, 4808, 4011, 3212, 2411, 1608, 804, 0,
+ -804, -1608, -2411, -3212, -4011, -4808, -5602, -6393,
+ -7180, -7962, -8740, -9512, -10279, -11039, -11793, -12540,
+ -13279, -14010, -14733, -15447, -16151, -16846, -17531, -18205,
+ -18868, -19520, -20160, -20788, -21403, -22006, -22595, -23170,
+ -23732, -24279, -24812, -25330, -25833, -26320, -26791, -27246,
+ -27684, -28106, -28511, -28899, -29269, -29622, -29957, -30274,
+ -30572, -30853, -31114, -31357, -31581, -31786, -31972, -32138,
+ -32286, -32413, -32522, -32610, -32679, -32729, -32758, -32768
+};
+
+const Word16 acos_slope[128] =//Q15
+{
+ -26214, -9039, -5243, -3799, -2979, -2405, -2064, -1771,
+ -1579, -1409, -1279, -1170, -1079, -1004, -933, -880,
+ -827, -783, -743, -708, -676, -647, -621, -599,
+ -576, -557, -538, -521, -506, -492, -479, -466,
+ -456, -445, -435, -426, -417, -410, -402, -395,
+ -389, -383, -377, -372, -367, -363, -359, -355,
+ -351, -348, -345, -342, -340, -337, -335, -333,
+ -331, -330, -329, -328, -327, -326, -326, -326,
+ -326, -326, -326, -327, -328, -329, -330, -331,
+ -333, -335, -337, -340, -342, -345, -348, -351,
+ -355, -359, -363, -367, -372, -377, -383, -389,
+ -395, -402, -410, -417, -426, -435, -445, -456,
+ -466, -479, -492, -506, -521, -538, -557, -576,
+ -599, -621, -647, -676, -708, -743, -783, -827,
+ -880, -933, -1004, -1079, -1170, -1279, -1409, -1579,
+ -1771, -2064, -2405, -2979, -3799, -5243, -9039,-26214
+};
+
+
+const Word16 cos_coef_new[4] = { SHC(0x02BA), SHC(0xE60A), SHC(0xEEEF), SHC(0xAAAB) };//Q15
+
+const Word16 cos_table[512] =//Q15
+{
+ SHC(0x7fff),
+ SHC(0x7ffe),
+ SHC(0x7ff6),
+ SHC(0x7fea),
+ SHC(0x7fd9),
+ SHC(0x7fc2),
+ SHC(0x7fa7),
+ SHC(0x7f87),
+ SHC(0x7f62),
+ SHC(0x7f38),
+ SHC(0x7f0a),
+ SHC(0x7ed6),
+ SHC(0x7e9d),
+ SHC(0x7e60),
+ SHC(0x7e1e),
+ SHC(0x7dd6),
+ SHC(0x7d8a),
+ SHC(0x7d3a),
+ SHC(0x7ce4),
+ SHC(0x7c89),
+ SHC(0x7c2a),
+ SHC(0x7bc6),
+ SHC(0x7b5d),
+ SHC(0x7aef),
+ SHC(0x7a7d),
+ SHC(0x7a06),
+ SHC(0x798a),
+ SHC(0x790a),
+ SHC(0x7885),
+ SHC(0x77fb),
+ SHC(0x776c),
+ SHC(0x76d9),
+ SHC(0x7642),
+ SHC(0x75a6),
+ SHC(0x7505),
+ SHC(0x7460),
+ SHC(0x73b6),
+ SHC(0x7308),
+ SHC(0x7255),
+ SHC(0x719e),
+ SHC(0x70e3),
+ SHC(0x7023),
+ SHC(0x6f5f),
+ SHC(0x6e97),
+ SHC(0x6dca),
+ SHC(0x6cf9),
+ SHC(0x6c24),
+ SHC(0x6b4b),
+ SHC(0x6a6e),
+ SHC(0x698c),
+ SHC(0x68a7),
+ SHC(0x67bd),
+ SHC(0x66d0),
+ SHC(0x65de),
+ SHC(0x64e9),
+ SHC(0x63ef),
+ SHC(0x62f2),
+ SHC(0x61f1),
+ SHC(0x60ec),
+ SHC(0x5fe4),
+ SHC(0x5ed7),
+ SHC(0x5dc8),
+ SHC(0x5cb4),
+ SHC(0x5b9d),
+ SHC(0x5a82),
+ SHC(0x5964),
+ SHC(0x5843),
+ SHC(0x571e),
+ SHC(0x55f6),
+ SHC(0x54ca),
+ SHC(0x539b),
+ SHC(0x5269),
+ SHC(0x5134),
+ SHC(0x4ffb),
+ SHC(0x4ec0),
+ SHC(0x4d81),
+ SHC(0x4c40),
+ SHC(0x4afb),
+ SHC(0x49b4),
+ SHC(0x486a),
+ SHC(0x471d),
+ SHC(0x45cd),
+ SHC(0x447b),
+ SHC(0x4326),
+ SHC(0x41ce),
+ SHC(0x4074),
+ SHC(0x3f17),
+ SHC(0x3db8),
+ SHC(0x3c57),
+ SHC(0x3af3),
+ SHC(0x398d),
+ SHC(0x3825),
+ SHC(0x36ba),
+ SHC(0x354e),
+ SHC(0x33df),
+ SHC(0x326e),
+ SHC(0x30fc),
+ SHC(0x2f87),
+ SHC(0x2e11),
+ SHC(0x2c99),
+ SHC(0x2b1f),
+ SHC(0x29a4),
+ SHC(0x2827),
+ SHC(0x26a8),
+ SHC(0x2528),
+ SHC(0x23a7),
+ SHC(0x2224),
+ SHC(0x209f),
+ SHC(0x1f1a),
+ SHC(0x1d93),
+ SHC(0x1c0c),
+ SHC(0x1a83),
+ SHC(0x18f9),
+ SHC(0x176e),
+ SHC(0x15e2),
+ SHC(0x1455),
+ SHC(0x12c8),
+ SHC(0x113a),
+ SHC(0xfab),
+ SHC(0xe1c),
+ SHC(0xc8c),
+ SHC(0xafb),
+ SHC(0x96b),
+ SHC(0x7d9),
+ SHC(0x648),
+ SHC(0x4b6),
+ SHC(0x324),
+ SHC(0x192),
+ SHC(0x0),
+ SHC(0xfe6e),
+ SHC(0xfcdc),
+ SHC(0xfb4a),
+ SHC(0xf9b8),
+ SHC(0xf827),
+ SHC(0xf695),
+ SHC(0xf505),
+ SHC(0xf374),
+ SHC(0xf1e4),
+ SHC(0xf055),
+ SHC(0xeec6),
+ SHC(0xed38),
+ SHC(0xebab),
+ SHC(0xea1e),
+ SHC(0xe892),
+ SHC(0xe707),
+ SHC(0xe57d),
+ SHC(0xe3f4),
+ SHC(0xe26d),
+ SHC(0xe0e6),
+ SHC(0xdf61),
+ SHC(0xdddc),
+ SHC(0xdc59),
+ SHC(0xdad8),
+ SHC(0xd958),
+ SHC(0xd7d9),
+ SHC(0xd65c),
+ SHC(0xd4e1),
+ SHC(0xd367),
+ SHC(0xd1ef),
+ SHC(0xd079),
+ SHC(0xcf04),
+ SHC(0xcd92),
+ SHC(0xcc21),
+ SHC(0xcab2),
+ SHC(0xc946),
+ SHC(0xc7db),
+ SHC(0xc673),
+ SHC(0xc50d),
+ SHC(0xc3a9),
+ SHC(0xc248),
+ SHC(0xc0e9),
+ SHC(0xbf8c),
+ SHC(0xbe32),
+ SHC(0xbcda),
+ SHC(0xbb85),
+ SHC(0xba33),
+ SHC(0xb8e3),
+ SHC(0xb796),
+ SHC(0xb64c),
+ SHC(0xb505),
+ SHC(0xb3c0),
+ SHC(0xb27f),
+ SHC(0xb140),
+ SHC(0xb005),
+ SHC(0xaecc),
+ SHC(0xad97),
+ SHC(0xac65),
+ SHC(0xab36),
+ SHC(0xaa0a),
+ SHC(0xa8e2),
+ SHC(0xa7bd),
+ SHC(0xa69c),
+ SHC(0xa57e),
+ SHC(0xa463),
+ SHC(0xa34c),
+ SHC(0xa238),
+ SHC(0xa129),
+ SHC(0xa01c),
+ SHC(0x9f14),
+ SHC(0x9e0f),
+ SHC(0x9d0e),
+ SHC(0x9c11),
+ SHC(0x9b17),
+ SHC(0x9a22),
+ SHC(0x9930),
+ SHC(0x9843),
+ SHC(0x9759),
+ SHC(0x9674),
+ SHC(0x9592),
+ SHC(0x94b5),
+ SHC(0x93dc),
+ SHC(0x9307),
+ SHC(0x9236),
+ SHC(0x9169),
+ SHC(0x90a1),
+ SHC(0x8fdd),
+ SHC(0x8f1d),
+ SHC(0x8e62),
+ SHC(0x8dab),
+ SHC(0x8cf8),
+ SHC(0x8c4a),
+ SHC(0x8ba0),
+ SHC(0x8afb),
+ SHC(0x8a5a),
+ SHC(0x89be),
+ SHC(0x8927),
+ SHC(0x8894),
+ SHC(0x8805),
+ SHC(0x877b),
+ SHC(0x86f6),
+ SHC(0x8676),
+ SHC(0x85fa),
+ SHC(0x8583),
+ SHC(0x8511),
+ SHC(0x84a3),
+ SHC(0x843a),
+ SHC(0x83d6),
+ SHC(0x8377),
+ SHC(0x831c),
+ SHC(0x82c6),
+ SHC(0x8276),
+ SHC(0x822a),
+ SHC(0x81e2),
+ SHC(0x81a0),
+ SHC(0x8163),
+ SHC(0x812a),
+ SHC(0x80f6),
+ SHC(0x80c8),
+ SHC(0x809e),
+ SHC(0x8079),
+ SHC(0x8059),
+ SHC(0x803e),
+ SHC(0x8027),
+ SHC(0x8016),
+ SHC(0x800a),
+ SHC(0x8002),
+ SHC(0x8001),
+ SHC(0x8002),
+ SHC(0x800a),
+ SHC(0x8016),
+ SHC(0x8027),
+ SHC(0x803e),
+ SHC(0x8059),
+ SHC(0x8079),
+ SHC(0x809e),
+ SHC(0x80c8),
+ SHC(0x80f6),
+ SHC(0x812a),
+ SHC(0x8163),
+ SHC(0x81a0),
+ SHC(0x81e2),
+ SHC(0x822a),
+ SHC(0x8276),
+ SHC(0x82c6),
+ SHC(0x831c),
+ SHC(0x8377),
+ SHC(0x83d6),
+ SHC(0x843a),
+ SHC(0x84a3),
+ SHC(0x8511),
+ SHC(0x8583),
+ SHC(0x85fa),
+ SHC(0x8676),
+ SHC(0x86f6),
+ SHC(0x877b),
+ SHC(0x8805),
+ SHC(0x8894),
+ SHC(0x8927),
+ SHC(0x89be),
+ SHC(0x8a5a),
+ SHC(0x8afb),
+ SHC(0x8ba0),
+ SHC(0x8c4a),
+ SHC(0x8cf8),
+ SHC(0x8dab),
+ SHC(0x8e62),
+ SHC(0x8f1d),
+ SHC(0x8fdd),
+ SHC(0x90a1),
+ SHC(0x9169),
+ SHC(0x9236),
+ SHC(0x9307),
+ SHC(0x93dc),
+ SHC(0x94b5),
+ SHC(0x9592),
+ SHC(0x9674),
+ SHC(0x9759),
+ SHC(0x9843),
+ SHC(0x9930),
+ SHC(0x9a22),
+ SHC(0x9b17),
+ SHC(0x9c11),
+ SHC(0x9d0e),
+ SHC(0x9e0f),
+ SHC(0x9f14),
+ SHC(0xa01c),
+ SHC(0xa129),
+ SHC(0xa238),
+ SHC(0xa34c),
+ SHC(0xa463),
+ SHC(0xa57e),
+ SHC(0xa69c),
+ SHC(0xa7bd),
+ SHC(0xa8e2),
+ SHC(0xaa0a),
+ SHC(0xab36),
+ SHC(0xac65),
+ SHC(0xad97),
+ SHC(0xaecc),
+ SHC(0xb005),
+ SHC(0xb140),
+ SHC(0xb27f),
+ SHC(0xb3c0),
+ SHC(0xb505),
+ SHC(0xb64c),
+ SHC(0xb796),
+ SHC(0xb8e3),
+ SHC(0xba33),
+ SHC(0xbb85),
+ SHC(0xbcda),
+ SHC(0xbe32),
+ SHC(0xbf8c),
+ SHC(0xc0e9),
+ SHC(0xc248),
+ SHC(0xc3a9),
+ SHC(0xc50d),
+ SHC(0xc673),
+ SHC(0xc7db),
+ SHC(0xc946),
+ SHC(0xcab2),
+ SHC(0xcc21),
+ SHC(0xcd92),
+ SHC(0xcf04),
+ SHC(0xd079),
+ SHC(0xd1ef),
+ SHC(0xd367),
+ SHC(0xd4e1),
+ SHC(0xd65c),
+ SHC(0xd7d9),
+ SHC(0xd958),
+ SHC(0xdad8),
+ SHC(0xdc59),
+ SHC(0xdddc),
+ SHC(0xdf61),
+ SHC(0xe0e6),
+ SHC(0xe26d),
+ SHC(0xe3f4),
+ SHC(0xe57d),
+ SHC(0xe707),
+ SHC(0xe892),
+ SHC(0xea1e),
+ SHC(0xebab),
+ SHC(0xed38),
+ SHC(0xeec6),
+ SHC(0xf055),
+ SHC(0xf1e4),
+ SHC(0xf374),
+ SHC(0xf505),
+ SHC(0xf695),
+ SHC(0xf827),
+ SHC(0xf9b8),
+ SHC(0xfb4a),
+ SHC(0xfcdc),
+ SHC(0xfe6e),
+ SHC(0x0),
+ SHC(0x192),
+ SHC(0x324),
+ SHC(0x4b6),
+ SHC(0x648),
+ SHC(0x7d9),
+ SHC(0x96b),
+ SHC(0xafb),
+ SHC(0xc8c),
+ SHC(0xe1c),
+ SHC(0xfab),
+ SHC(0x113a),
+ SHC(0x12c8),
+ SHC(0x1455),
+ SHC(0x15e2),
+ SHC(0x176e),
+ SHC(0x18f9),
+ SHC(0x1a83),
+ SHC(0x1c0c),
+ SHC(0x1d93),
+ SHC(0x1f1a),
+ SHC(0x209f),
+ SHC(0x2224),
+ SHC(0x23a7),
+ SHC(0x2528),
+ SHC(0x26a8),
+ SHC(0x2827),
+ SHC(0x29a4),
+ SHC(0x2b1f),
+ SHC(0x2c99),
+ SHC(0x2e11),
+ SHC(0x2f87),
+ SHC(0x30fc),
+ SHC(0x326e),
+ SHC(0x33df),
+ SHC(0x354e),
+ SHC(0x36ba),
+ SHC(0x3825),
+ SHC(0x398d),
+ SHC(0x3af3),
+ SHC(0x3c57),
+ SHC(0x3db8),
+ SHC(0x3f17),
+ SHC(0x4074),
+ SHC(0x41ce),
+ SHC(0x4326),
+ SHC(0x447b),
+ SHC(0x45cd),
+ SHC(0x471d),
+ SHC(0x486a),
+ SHC(0x49b4),
+ SHC(0x4afb),
+ SHC(0x4c40),
+ SHC(0x4d81),
+ SHC(0x4ec0),
+ SHC(0x4ffb),
+ SHC(0x5134),
+ SHC(0x5269),
+ SHC(0x539b),
+ SHC(0x54ca),
+ SHC(0x55f6),
+ SHC(0x571e),
+ SHC(0x5843),
+ SHC(0x5964),
+ SHC(0x5a82),
+ SHC(0x5b9d),
+ SHC(0x5cb4),
+ SHC(0x5dc8),
+ SHC(0x5ed7),
+ SHC(0x5fe4),
+ SHC(0x60ec),
+ SHC(0x61f1),
+ SHC(0x62f2),
+ SHC(0x63ef),
+ SHC(0x64e9),
+ SHC(0x65de),
+ SHC(0x66d0),
+ SHC(0x67bd),
+ SHC(0x68a7),
+ SHC(0x698c),
+ SHC(0x6a6e),
+ SHC(0x6b4b),
+ SHC(0x6c24),
+ SHC(0x6cf9),
+ SHC(0x6dca),
+ SHC(0x6e97),
+ SHC(0x6f5f),
+ SHC(0x7023),
+ SHC(0x70e3),
+ SHC(0x719e),
+ SHC(0x7255),
+ SHC(0x7308),
+ SHC(0x73b6),
+ SHC(0x7460),
+ SHC(0x7505),
+ SHC(0x75a6),
+ SHC(0x7642),
+ SHC(0x76d9),
+ SHC(0x776c),
+ SHC(0x77fb),
+ SHC(0x7885),
+ SHC(0x790a),
+ SHC(0x798a),
+ SHC(0x7a06),
+ SHC(0x7a7d),
+ SHC(0x7aef),
+ SHC(0x7b5d),
+ SHC(0x7bc6),
+ SHC(0x7c2a),
+ SHC(0x7c89),
+ SHC(0x7ce4),
+ SHC(0x7d3a),
+ SHC(0x7d8a),
+ SHC(0x7dd6),
+ SHC(0x7e1e),
+ SHC(0x7e60),
+ SHC(0x7e9d),
+ SHC(0x7ed6),
+ SHC(0x7f0a),
+ SHC(0x7f38),
+ SHC(0x7f62),
+ SHC(0x7f87),
+ SHC(0x7fa7),
+ SHC(0x7fc2),
+ SHC(0x7fd9),
+ SHC(0x7fea),
+ SHC(0x7ff6),
+ SHC(0x7ffe)
+};
+
+const PWord16 w1N8[15] =
+{
+ {{ 32729/*0.998795 Q15*/, -1608/*-0.049068 Q15*/}},
+ {{ 32610/*0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
+ {{ 32413/*0.989177 Q15*/, -4808/*-0.146730 Q15*/}},
+ {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{ 31786/*0.970031 Q15*/, -7962/*-0.242980 Q15*/}},
+ {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
+ {{ 30853/*0.941544 Q15*/, -11039/*-0.336890 Q15*/}},
+ {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{ 29622/*0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
+ {{ 28899/*0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
+ {{ 28106/*0.857729 Q15*/, -16846/*-0.514103 Q15*/}},
+ {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
+ {{ 26320/*0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
+ {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
+ {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}}
+};
+
+const PWord16 w2N8[15] =
+{
+ {{ 32610/*0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
+ {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
+ {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{ 28899/*0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
+ {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
+ {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
+ {{ 23170/*0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
+ {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
+ {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
+ {{ 15447/*0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
+ {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{ 9512/*0.290285 Q15*/, -31357/*-0.956940 Q15*/}},
+ {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
+ {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}}
+};
+
+const PWord16 w3N8[15] =
+{
+ {{ 32413/*0.989177 Q15*/, -4808/*-0.146730 Q15*/}},
+ {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
+ {{ 29622/*0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
+ {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
+ {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
+ {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
+ {{ 16846/*0.514103 Q15*/, -28106/*-0.857729 Q15*/}},
+ {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{ 7962/*0.242980 Q15*/, -31786/*-0.970031 Q15*/}},
+ {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}},
+ {{ -1608/*-0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
+ {{ -6393/*-0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
+ {{-11039/*-0.336890 Q15*/, -30853/*-0.941544 Q15*/}},
+ {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
+ {{-19520/*-0.595699 Q15*/, -26320/*-0.803208 Q15*/}}
+};
+
+const PWord16 w4N8[15] =
+{
+ {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
+ {{ 23170/*0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
+ {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
+ {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
+ {{ 0/*0.000000 Q15*/, -32768/*-1.000000 Q15*/}},
+ {{ -6393/*-0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
+ {{-12540/*-0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{-18205/*-0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
+ {{-23170/*-0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
+ {{-27246/*-0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
+ {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}}
+};
+
+const PWord16 w5N8[15] =
+{
+ {{ 31786/*0.970031 Q15*/, -7962/*-0.242980 Q15*/}},
+ {{ 28899/*0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
+ {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
+ {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
+ {{ 11039/*0.336890 Q15*/, -30853/*-0.941544 Q15*/}},
+ {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}},
+ {{ -4808/*-0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
+ {{-12540/*-0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{-19520/*-0.595699 Q15*/, -26320/*-0.803208 Q15*/}},
+ {{-25330/*-0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
+ {{-29622/*-0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
+ {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{-32729/*-0.998795 Q15*/, 1608/*0.049068 Q15*/}},
+ {{-31357/*-0.956940 Q15*/, 9512/*0.290285 Q15*/}},
+ {{-28106/*-0.857729 Q15*/, 16846/*0.514103 Q15*/}}
+};
+
+const PWord16 w6N8[15] =
+{
+ {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
+ {{ 27246/*0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
+ {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
+ {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{ 3212/*0.098017 Q15*/, -32610/*-0.995185 Q15*/}},
+ {{ -6393/*-0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
+ {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
+ {{-23170/*-0.707107 Q15*/, -23170/*-0.707107 Q15*/}},
+ {{-28899/*-0.881921 Q15*/, -15447/*-0.471397 Q15*/}},
+ {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{-32610/*-0.995185 Q15*/, 3212/*0.098017 Q15*/}},
+ {{-30274/*-0.923880 Q15*/, 12540/*0.382683 Q15*/}},
+ {{-25330/*-0.773010 Q15*/, 20788/*0.634393 Q15*/}},
+ {{-18205/*-0.555570 Q15*/, 27246/*0.831470 Q15*/}},
+ {{ -9512/*-0.290285 Q15*/, 31357/*0.956940 Q15*/}}
+};
+
+const PWord16 w7N8[15] =
+{
+ {{ 30853/*0.941544 Q15*/, -11039/*-0.336890 Q15*/}},
+ {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
+ {{ 16846/*0.514103 Q15*/, -28106/*-0.857729 Q15*/}},
+ {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
+ {{ -4808/*-0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
+ {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
+ {{-24279/*-0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
+ {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{-32729/*-0.998795 Q15*/, -1608/*-0.049068 Q15*/}},
+ {{-31357/*-0.956940 Q15*/, 9512/*0.290285 Q15*/}},
+ {{-26320/*-0.803208 Q15*/, 19520/*0.595699 Q15*/}},
+ {{-18205/*-0.555570 Q15*/, 27246/*0.831470 Q15*/}},
+ {{ -7962/*-0.242980 Q15*/, 31786/*0.970031 Q15*/}},
+ {{ 3212/*0.098017 Q15*/, 32610/*0.995185 Q15*/}},
+ {{ 14010/*0.427555 Q15*/, 29622/*0.903989 Q15*/}}
+};
+
+const PWord16 *w_a[7] = { w1N8, w2N8, w3N8, w4N8, w5N8, w6N8, w7N8 };//Q15
+
+const PWord16 w19N[127] =
+{
+ {{ 31881/*0.972940 Q15*/, 7571/*0.231058 Q15*/}},
+ {{ 29269/*0.893224 Q15*/, 14733/*0.449611 Q15*/}},
+ {{ 25073/*0.765167 Q15*/, 21097/*0.643832 Q15*/}},
+ {{ 19520/*0.595699 Q15*/, 26320/*0.803208 Q15*/}},
+ {{ 12910/*0.393992 Q15*/, 30118/*0.919114 Q15*/}},
+ {{ 5602/*0.170962 Q15*/, 32286/*0.985278 Q15*/}},
+ {{ -2009/*-0.061321 Q15*/, 32706/*0.998118 Q15*/}},
+ {{ -9512/*-0.290285 Q15*/, 31357/*0.956940 Q15*/}},
+ {{-16500/*-0.503538 Q15*/, 28311/*0.863973 Q15*/}},
+ {{-22595/*-0.689541 Q15*/, 23732/*0.724247 Q15*/}},
+ {{-27467/*-0.838225 Q15*/, 17869/*0.545325 Q15*/}},
+ {{-30853/*-0.941544 Q15*/, 11039/*0.336890 Q15*/}},
+ {{-32568/*-0.993907 Q15*/, 3612/*0.110222 Q15*/}},
+ {{-32522/*-0.992480 Q15*/, -4011/*-0.122411 Q15*/}},
+ {{-30715/*-0.937339 Q15*/, -11417/*-0.348419 Q15*/}},
+ {{-27246/*-0.831470 Q15*/, -18205/*-0.555570 Q15*/}},
+ {{-22302/*-0.680601 Q15*/, -24008/*-0.732654 Q15*/}},
+ {{-16151/*-0.492898 Q15*/, -28511/*-0.870087 Q15*/}},
+ {{ -9127/*-0.278520 Q15*/, -31471/*-0.960431 Q15*/}},
+ {{ -1608/*-0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
+ {{ 5998/*0.183040 Q15*/, -32214/*-0.983105 Q15*/}},
+ {{ 13279/*0.405241 Q15*/, -29957/*-0.914210 Q15*/}},
+ {{ 19841/*0.605511 Q15*/, -26078/*-0.795837 Q15*/}},
+ {{ 25330/*0.773010 Q15*/, -20788/*-0.634393 Q15*/}},
+ {{ 29448/*0.898674 Q15*/, -14373/*-0.438616 Q15*/}},
+ {{ 31972/*0.975702 Q15*/, -7180/*-0.219101 Q15*/}},
+ {{ 32766/*0.999925 Q15*/, 402/*0.012272 Q15*/}},
+ {{ 31786/*0.970031 Q15*/, 7962/*0.242980 Q15*/}},
+ {{ 29086/*0.887640 Q15*/, 15091/*0.460539 Q15*/}},
+ {{ 24812/*0.757209 Q15*/, 21403/*0.653173 Q15*/}},
+ {{ 19195/*0.585798 Q15*/, 26557/*0.810457 Q15*/}},
+ {{ 12540/*0.382683 Q15*/, 30274/*0.923880 Q15*/}},
+ {{ 5205/*0.158858 Q15*/, 32352/*0.987301 Q15*/}},
+ {{ -2411/*-0.073565 Q15*/, 32679/*0.997290 Q15*/}},
+ {{ -9896/*-0.302006 Q15*/, 31238/*0.953306 Q15*/}},
+ {{-16846/*-0.514103 Q15*/, 28106/*0.857729 Q15*/}},
+ {{-22884/*-0.698376 Q15*/, 23453/*0.715731 Q15*/}},
+ {{-27684/*-0.844854 Q15*/, 17531/*0.534998 Q15*/}},
+ {{-30986/*-0.945607 Q15*/, 10660/*0.325310 Q15*/}},
+ {{-32610/*-0.995185 Q15*/, 3212/*0.098017 Q15*/}},
+ {{-32470/*-0.990903 Q15*/, -4410/*-0.134581 Q15*/}},
+ {{-30572/*-0.932993 Q15*/, -11793/*-0.359895 Q15*/}},
+ {{-27020/*-0.824589 Q15*/, -18538/*-0.565732 Q15*/}},
+ {{-22006/*-0.671559 Q15*/, -24279/*-0.740951 Q15*/}},
+ {{-15800/*-0.482184 Q15*/, -28707/*-0.876070 Q15*/}},
+ {{ -8740/*-0.266713 Q15*/, -31581/*-0.963776 Q15*/}},
+ {{ -1206/*-0.036807 Q15*/, -32746/*-0.999322 Q15*/}},
+ {{ 6393/*0.195090 Q15*/, -32138/*-0.980785 Q15*/}},
+ {{ 13646/*0.416430 Q15*/, -29792/*-0.909168 Q15*/}},
+ {{ 20160/*0.615232 Q15*/, -25833/*-0.788346 Q15*/}},
+ {{ 25583/*0.780737 Q15*/, -20475/*-0.624859 Q15*/}},
+ {{ 29622/*0.903989 Q15*/, -14010/*-0.427555 Q15*/}},
+ {{ 32057/*0.978317 Q15*/, -6787/*-0.207111 Q15*/}},
+ {{ 32758/*0.999699 Q15*/, 804/*0.024541 Q15*/}},
+ {{ 31686/*0.966976 Q15*/, 8351/*0.254866 Q15*/}},
+ {{ 28899/*0.881921 Q15*/, 15447/*0.471397 Q15*/}},
+ {{ 24548/*0.749136 Q15*/, 21706/*0.662416 Q15*/}},
+ {{ 18868/*0.575808 Q15*/, 26791/*0.817585 Q15*/}},
+ {{ 12167/*0.371317 Q15*/, 30425/*0.928506 Q15*/}},
+ {{ 4808/*0.146730 Q15*/, 32413/*0.989177 Q15*/}},
+ {{ -2811/*-0.085797 Q15*/, 32647/*0.996313 Q15*/}},
+ {{-10279/*-0.313682 Q15*/, 31114/*0.949528 Q15*/}},
+ {{-17190/*-0.524590 Q15*/, 27897/*0.851355 Q15*/}},
+ {{-23170/*-0.707107 Q15*/, 23170/*0.707107 Q15*/}},
+ {{-27897/*-0.851355 Q15*/, 17190/*0.524590 Q15*/}},
+ {{-31114/*-0.949528 Q15*/, 10279/*0.313682 Q15*/}},
+ {{-32647/*-0.996313 Q15*/, 2811/*0.085797 Q15*/}},
+ {{-32413/*-0.989177 Q15*/, -4808/*-0.146730 Q15*/}},
+ {{-30425/*-0.928506 Q15*/, -12167/*-0.371317 Q15*/}},
+ {{-26791/*-0.817585 Q15*/, -18868/*-0.575808 Q15*/}},
+ {{-21706/*-0.662416 Q15*/, -24548/*-0.749136 Q15*/}},
+ {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
+ {{ -8351/*-0.254866 Q15*/, -31686/*-0.966976 Q15*/}},
+ {{ -804/*-0.024541 Q15*/, -32758/*-0.999699 Q15*/}},
+ {{ 6787/*0.207111 Q15*/, -32057/*-0.978317 Q15*/}},
+ {{ 14010/*0.427555 Q15*/, -29622/*-0.903989 Q15*/}},
+ {{ 20475/*0.624859 Q15*/, -25583/*-0.780737 Q15*/}},
+ {{ 25833/*0.788346 Q15*/, -20160/*-0.615232 Q15*/}},
+ {{ 29792/*0.909168 Q15*/, -13646/*-0.416430 Q15*/}},
+ {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{ 32746/*0.999322 Q15*/, 1206/*0.036807 Q15*/}},
+ {{ 31581/*0.963776 Q15*/, 8740/*0.266713 Q15*/}},
+ {{ 28707/*0.876070 Q15*/, 15800/*0.482184 Q15*/}},
+ {{ 24279/*0.740951 Q15*/, 22006/*0.671559 Q15*/}},
+ {{ 18538/*0.565732 Q15*/, 27020/*0.824589 Q15*/}},
+ {{ 11793/*0.359895 Q15*/, 30572/*0.932993 Q15*/}},
+ {{ 4410/*0.134581 Q15*/, 32470/*0.990903 Q15*/}},
+ {{ -3212/*-0.098017 Q15*/, 32610/*0.995185 Q15*/}},
+ {{-10660/*-0.325310 Q15*/, 30986/*0.945607 Q15*/}},
+ {{-17531/*-0.534998 Q15*/, 27684/*0.844854 Q15*/}},
+ {{-23453/*-0.715731 Q15*/, 22884/*0.698376 Q15*/}},
+ {{-28106/*-0.857729 Q15*/, 16846/*0.514103 Q15*/}},
+ {{-31238/*-0.953306 Q15*/, 9896/*0.302006 Q15*/}},
+ {{-32679/*-0.997290 Q15*/, 2411/*0.073565 Q15*/}},
+ {{-32352/*-0.987301 Q15*/, -5205/*-0.158858 Q15*/}},
+ {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{-26557/*-0.810457 Q15*/, -19195/*-0.585798 Q15*/}},
+ {{-21403/*-0.653173 Q15*/, -24812/*-0.757209 Q15*/}},
+ {{-15091/*-0.460539 Q15*/, -29086/*-0.887640 Q15*/}},
+ {{ -7962/*-0.242980 Q15*/, -31786/*-0.970031 Q15*/}},
+ {{ -402/*-0.012272 Q15*/, -32766/*-0.999925 Q15*/}},
+ {{ 7180/*0.219101 Q15*/, -31972/*-0.975702 Q15*/}},
+ {{ 14373/*0.438616 Q15*/, -29448/*-0.898674 Q15*/}},
+ {{ 20788/*0.634393 Q15*/, -25330/*-0.773010 Q15*/}},
+ {{ 26078/*0.795837 Q15*/, -19841/*-0.605511 Q15*/}},
+ {{ 29957/*0.914210 Q15*/, -13279/*-0.405241 Q15*/}},
+ {{ 32214/*0.983105 Q15*/, -5998/*-0.183040 Q15*/}},
+ {{ 32729/*0.998795 Q15*/, 1608/*0.049068 Q15*/}},
+ {{ 31471/*0.960431 Q15*/, 9127/*0.278520 Q15*/}},
+ {{ 28511/*0.870087 Q15*/, 16151/*0.492898 Q15*/}},
+ {{ 24008/*0.732654 Q15*/, 22302/*0.680601 Q15*/}},
+ {{ 18205/*0.555570 Q15*/, 27246/*0.831470 Q15*/}},
+ {{ 11417/*0.348419 Q15*/, 30715/*0.937339 Q15*/}},
+ {{ 4011/*0.122411 Q15*/, 32522/*0.992480 Q15*/}},
+ {{ -3612/*-0.110222 Q15*/, 32568/*0.993907 Q15*/}},
+ {{-11039/*-0.336890 Q15*/, 30853/*0.941544 Q15*/}},
+ {{-17869/*-0.545325 Q15*/, 27467/*0.838225 Q15*/}},
+ {{-23732/*-0.724247 Q15*/, 22595/*0.689541 Q15*/}},
+ {{-28311/*-0.863973 Q15*/, 16500/*0.503538 Q15*/}},
+ {{-31357/*-0.956940 Q15*/, 9512/*0.290285 Q15*/}},
+ {{-32706/*-0.998118 Q15*/, 2009/*0.061321 Q15*/}},
+ {{-32286/*-0.985278 Q15*/, -5602/*-0.170962 Q15*/}},
+ {{-30118/*-0.919114 Q15*/, -12910/*-0.393992 Q15*/}},
+ {{-26320/*-0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
+ {{-21097/*-0.643832 Q15*/, -25073/*-0.765167 Q15*/}},
+ {{-14733/*-0.449611 Q15*/, -29269/*-0.893224 Q15*/}},
+ {{ -7571/*-0.231058 Q15*/, -31881/*-0.972940 Q15*/}}
+};
+
+const PWord16 w18N[127] =
+{
+ {{ 31972/*0.975702 Q15*/, 7180/*0.219101 Q15*/}},
+ {{ 29622/*0.903989 Q15*/, 14010/*0.427555 Q15*/}},
+ {{ 25833/*0.788346 Q15*/, 20160/*0.615232 Q15*/}},
+ {{ 20788/*0.634393 Q15*/, 25330/*0.773010 Q15*/}},
+ {{ 14733/*0.449611 Q15*/, 29269/*0.893224 Q15*/}},
+ {{ 7962/*0.242980 Q15*/, 31786/*0.970031 Q15*/}},
+ {{ 804/*0.024541 Q15*/, 32758/*0.999699 Q15*/}},
+ {{ -6393/*-0.195090 Q15*/, 32138/*0.980785 Q15*/}},
+ {{-13279/*-0.405241 Q15*/, 29957/*0.914210 Q15*/}},
+ {{-19520/*-0.595699 Q15*/, 26320/*0.803208 Q15*/}},
+ {{-24812/*-0.757209 Q15*/, 21403/*0.653173 Q15*/}},
+ {{-28899/*-0.881921 Q15*/, 15447/*0.471397 Q15*/}},
+ {{-31581/*-0.963776 Q15*/, 8740/*0.266713 Q15*/}},
+ {{-32729/*-0.998795 Q15*/, 1608/*0.049068 Q15*/}},
+ {{-32286/*-0.985278 Q15*/, -5602/*-0.170962 Q15*/}},
+ {{-30274/*-0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{-26791/*-0.817585 Q15*/, -18868/*-0.575808 Q15*/}},
+ {{-22006/*-0.671559 Q15*/, -24279/*-0.740951 Q15*/}},
+ {{-16151/*-0.492898 Q15*/, -28511/*-0.870087 Q15*/}},
+ {{ -9512/*-0.290285 Q15*/, -31357/*-0.956940 Q15*/}},
+ {{ -2411/*-0.073565 Q15*/, -32679/*-0.997290 Q15*/}},
+ {{ 4808/*0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
+ {{ 11793/*0.359895 Q15*/, -30572/*-0.932993 Q15*/}},
+ {{ 18205/*0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
+ {{ 23732/*0.724247 Q15*/, -22595/*-0.689541 Q15*/}},
+ {{ 28106/*0.857729 Q15*/, -16846/*-0.514103 Q15*/}},
+ {{ 31114/*0.949528 Q15*/, -10279/*-0.313682 Q15*/}},
+ {{ 32610/*0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
+ {{ 32522/*0.992480 Q15*/, 4011/*0.122411 Q15*/}},
+ {{ 30853/*0.941544 Q15*/, 11039/*0.336890 Q15*/}},
+ {{ 27684/*0.844854 Q15*/, 17531/*0.534998 Q15*/}},
+ {{ 23170/*0.707107 Q15*/, 23170/*0.707107 Q15*/}},
+ {{ 17531/*0.534998 Q15*/, 27684/*0.844854 Q15*/}},
+ {{ 11039/*0.336890 Q15*/, 30853/*0.941544 Q15*/}},
+ {{ 4011/*0.122411 Q15*/, 32522/*0.992480 Q15*/}},
+ {{ -3212/*-0.098017 Q15*/, 32610/*0.995185 Q15*/}},
+ {{-10279/*-0.313682 Q15*/, 31114/*0.949528 Q15*/}},
+ {{-16846/*-0.514103 Q15*/, 28106/*0.857729 Q15*/}},
+ {{-22595/*-0.689541 Q15*/, 23732/*0.724247 Q15*/}},
+ {{-27246/*-0.831470 Q15*/, 18205/*0.555570 Q15*/}},
+ {{-30572/*-0.932993 Q15*/, 11793/*0.359895 Q15*/}},
+ {{-32413/*-0.989177 Q15*/, 4808/*0.146730 Q15*/}},
+ {{-32679/*-0.997290 Q15*/, -2411/*-0.073565 Q15*/}},
+ {{-31357/*-0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
+ {{-28511/*-0.870087 Q15*/, -16151/*-0.492898 Q15*/}},
+ {{-24279/*-0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
+ {{-18868/*-0.575808 Q15*/, -26791/*-0.817585 Q15*/}},
+ {{-12540/*-0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{ -5602/*-0.170962 Q15*/, -32286/*-0.985278 Q15*/}},
+ {{ 1608/*0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
+ {{ 8740/*0.266713 Q15*/, -31581/*-0.963776 Q15*/}},
+ {{ 15447/*0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
+ {{ 21403/*0.653173 Q15*/, -24812/*-0.757209 Q15*/}},
+ {{ 26320/*0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
+ {{ 29957/*0.914210 Q15*/, -13279/*-0.405241 Q15*/}},
+ {{ 32138/*0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{ 32758/*0.999699 Q15*/, 804/*0.024541 Q15*/}},
+ {{ 31786/*0.970031 Q15*/, 7962/*0.242980 Q15*/}},
+ {{ 29269/*0.893224 Q15*/, 14733/*0.449611 Q15*/}},
+ {{ 25330/*0.773010 Q15*/, 20788/*0.634393 Q15*/}},
+ {{ 20160/*0.615232 Q15*/, 25833/*0.788346 Q15*/}},
+ {{ 14010/*0.427555 Q15*/, 29622/*0.903989 Q15*/}},
+ {{ 7180/*0.219101 Q15*/, 31972/*0.975702 Q15*/}},
+ {{ 0/*0.000000 Q15*/, 32767/*1.000000 Q15*/}},
+ {{ -7180/*-0.219101 Q15*/, 31972/*0.975702 Q15*/}},
+ {{-14010/*-0.427555 Q15*/, 29622/*0.903989 Q15*/}},
+ {{-20160/*-0.615232 Q15*/, 25833/*0.788346 Q15*/}},
+ {{-25330/*-0.773010 Q15*/, 20788/*0.634393 Q15*/}},
+ {{-29269/*-0.893224 Q15*/, 14733/*0.449611 Q15*/}},
+ {{-31786/*-0.970031 Q15*/, 7962/*0.242980 Q15*/}},
+ {{-32758/*-0.999699 Q15*/, 804/*0.024541 Q15*/}},
+ {{-32138/*-0.980785 Q15*/, -6393/*-0.195090 Q15*/}},
+ {{-29957/*-0.914210 Q15*/, -13279/*-0.405241 Q15*/}},
+ {{-26320/*-0.803208 Q15*/, -19520/*-0.595699 Q15*/}},
+ {{-21403/*-0.653173 Q15*/, -24812/*-0.757209 Q15*/}},
+ {{-15447/*-0.471397 Q15*/, -28899/*-0.881921 Q15*/}},
+ {{ -8740/*-0.266713 Q15*/, -31581/*-0.963776 Q15*/}},
+ {{ -1608/*-0.049068 Q15*/, -32729/*-0.998795 Q15*/}},
+ {{ 5602/*0.170962 Q15*/, -32286/*-0.985278 Q15*/}},
+ {{ 12540/*0.382683 Q15*/, -30274/*-0.923880 Q15*/}},
+ {{ 18868/*0.575808 Q15*/, -26791/*-0.817585 Q15*/}},
+ {{ 24279/*0.740951 Q15*/, -22006/*-0.671559 Q15*/}},
+ {{ 28511/*0.870087 Q15*/, -16151/*-0.492898 Q15*/}},
+ {{ 31357/*0.956940 Q15*/, -9512/*-0.290285 Q15*/}},
+ {{ 32679/*0.997290 Q15*/, -2411/*-0.073565 Q15*/}},
+ {{ 32413/*0.989177 Q15*/, 4808/*0.146730 Q15*/}},
+ {{ 30572/*0.932993 Q15*/, 11793/*0.359895 Q15*/}},
+ {{ 27246/*0.831470 Q15*/, 18205/*0.555570 Q15*/}},
+ {{ 22595/*0.689541 Q15*/, 23732/*0.724247 Q15*/}},
+ {{ 16846/*0.514103 Q15*/, 28106/*0.857729 Q15*/}},
+ {{ 10279/*0.313682 Q15*/, 31114/*0.949528 Q15*/}},
+ {{ 3212/*0.098017 Q15*/, 32610/*0.995185 Q15*/}},
+ {{ -4011/*-0.122411 Q15*/, 32522/*0.992480 Q15*/}},
+ {{-11039/*-0.336890 Q15*/, 30853/*0.941544 Q15*/}},
+ {{-17531/*-0.534998 Q15*/, 27684/*0.844854 Q15*/}},
+ {{-23170/*-0.707107 Q15*/, 23170/*0.707107 Q15*/}},
+ {{-27684/*-0.844854 Q15*/, 17531/*0.534998 Q15*/}},
+ {{-30853/*-0.941544 Q15*/, 11039/*0.336890 Q15*/}},
+ {{-32522/*-0.992480 Q15*/, 4011/*0.122411 Q15*/}},
+ {{-32610/*-0.995185 Q15*/, -3212/*-0.098017 Q15*/}},
+ {{-31114/*-0.949528 Q15*/, -10279/*-0.313682 Q15*/}},
+ {{-28106/*-0.857729 Q15*/, -16846/*-0.514103 Q15*/}},
+ {{-23732/*-0.724247 Q15*/, -22595/*-0.689541 Q15*/}},
+ {{-18205/*-0.555570 Q15*/, -27246/*-0.831470 Q15*/}},
+ {{-11793/*-0.359895 Q15*/, -30572/*-0.932993 Q15*/}},
+ {{ -4808/*-0.146730 Q15*/, -32413/*-0.989177 Q15*/}},
+ {{ 2411/*0.073565 Q15*/, -32679/*-0.997290 Q15*/}},
+ {{ 9512/*0.290285 Q15*/, -31357/*-0.956940 Q15*/}},
+ {{ 16151/*0.492898 Q15*/, -28511/*-0.870087 Q15*/}},
+ {{ 22006/*0.671559 Q15*/, -24279/*-0.740951 Q15*/}},
+ {{ 26791/*0.817585 Q15*/, -18868/*-0.575808 Q15*/}},
+ {{ 30274/*0.923880 Q15*/, -12540/*-0.382683 Q15*/}},
+ {{ 32286/*0.985278 Q15*/, -5602/*-0.170962 Q15*/}},
+ {{ 32729/*0.998795 Q15*/, 1608/*0.049068 Q15*/}},
+ {{ 31581/*0.963776 Q15*/, 8740/*0.266713 Q15*/}},
+ {{ 28899/*0.881921 Q15*/, 15447/*0.471397 Q15*/}},
+ {{ 24812/*0.757209 Q15*/, 21403/*0.653173 Q15*/}},
+ {{ 19520/*0.595699 Q15*/, 26320/*0.803208 Q15*/}},
+ {{ 13279/*0.405241 Q15*/, 29957/*0.914210 Q15*/}},
+ {{ 6393/*0.195090 Q15*/, 32138/*0.980785 Q15*/}},
+ {{ -804/*-0.024541 Q15*/, 32758/*0.999699 Q15*/}},
+ {{ -7962/*-0.242980 Q15*/, 31786/*0.970031 Q15*/}},
+ {{-14733/*-0.449611 Q15*/, 29269/*0.893224 Q15*/}},
+ {{-20788/*-0.634393 Q15*/, 25330/*0.773010 Q15*/}},
+ {{-25833/*-0.788346 Q15*/, 20160/*0.615232 Q15*/}},
+ {{-29622/*-0.903989 Q15*/, 14010/*0.427555 Q15*/}},
+ {{-31972/*-0.975702 Q15*/, 7180/*0.219101 Q15*/}}
+};
+
+/*-------------------------------------------------------------------*
+ * 1/4 resolution interpolation filter (-3 dB at 0.791*fs/2)
+ * for fractional pitch search
+ * Used in lib_enc\pit_enc.c Q14
+ *-------------------------------------------------------------------*/
+const Word16 inter4_1_fx[32] =//Q14
+{
+ -12, -26, 32, 206,
+ 420, 455, 73, -766,
+ -1732, -2142,-1242, 1376,
+ 5429, 9910,13418,14746,
+ 13418, 9910, 5429, 1376,
+ -1242, -2142,-1732, -766,
+ 73, 455, 420, 206,
+ 32, -26, -12, 0
+};
+
+const Word16 sin_switch_8[15] = { 3212, 6393, 9512, 12540, 15447, 18205, 20788, 23170,
+ 25330, 27246, 28899, 30274, 31357, 32138, 32610
+};//Q15
+
+const Word16 sin_switch_16[30] = { 1660, 3315, 4962, 6596, 8213, 9810, 11380, 12922,
+ 14431, 15902, 17333, 18719, 20057, 21344, 22576, 23750,
+ 24863, 25912, 26895, 27808, 28651, 29419, 30112, 30728,
+ 31265, 31722, 32097, 32390, 32600, 32726
+};//Q15
+
+
+const Word16 sin_switch_32[60] = { 844, 1687, 2529, 3369, 4207, 5043, 5875, 6703,
+ 7526, 8345, 9158, 9965, 10766, 11559, 12345, 13122,
+ 13891, 14650, 15400, 16140, 16869, 17586, 18293, 18986,
+ 19668, 20336, 20991, 21632, 22258, 22870, 23467, 24048,
+ 24613, 25162, 25694, 26209, 26707, 27187, 27649, 28092,
+ 28518, 28924, 29311, 29678, 30026, 30354, 30662, 30949,
+ 31216, 31462, 31688, 31892, 32075, 32237, 32378, 32497,
+ 32594, 32670, 32725, 32757
+};//Q15
+
+
+const Word16 sin_switch_48[90] = { 566, 1131, 1696, 2261, 2825, 3388, 3950, 4511,
+ 5070, 5628, 6185, 6739, 7292, 7842, 8390, 8935,
+ 9478, 10018, 10555, 11089, 11620, 12147, 12670, 13190,
+ 13706, 14218, 14725, 15228, 15727, 16220, 16709, 17194,
+ 17672, 18146, 18614, 19077, 19534, 19985, 20431, 20870,
+ 21303, 21729, 22149, 22563, 22970, 23370, 23763, 24148,
+ 24527, 24899, 25263, 25619, 25968, 26309, 26642, 26968,
+ 27285, 27594, 27895, 28188, 28472, 28747, 29015, 29273,
+ 29523, 29764, 29996, 30219, 30433, 30639, 30835, 31021,
+ 31199, 31367, 31526, 31676, 31816, 31946, 32068, 32179,
+ 32281, 32373, 32456, 32529, 32592, 32646, 32690, 32724,
+ 32748, 32763
+};//Q15
+
+const Word16 one_on_win_48k_fx[210] =
+{
+ 16399, 16412, 16425, 16439, 16452, 16465, 16479, 16492,
+ 16506, 16519, 16533, 16547, 16561, 16575, 16589, 16603,
+ 16618, 16632, 16647, 16662, 16677, 16692, 16707, 16722,
+ 16738, 16754, 16770, 16786, 16802, 16818, 16835, 16851,
+ 16868, 16885, 16902, 16919, 16937, 16955, 16972, 16990,
+ 17008, 17027, 17045, 17064, 17083, 17102, 17121, 17140,
+ 17160, 17180, 17200, 17220, 17240, 17261, 17281, 17302,
+ 17323, 17345, 17366, 17388, 17410, 17432, 17454, 17477,
+ 17499, 17522, 17545, 17569, 17592, 17616, 17640, 17664,
+ 17689, 17713, 17738, 17763, 17789, 17814, 17840, 17866,
+ 17892, 17918, 17945, 17972, 17999, 18027, 18054, 18082,
+ 18110, 18139, 18167, 18196, 18225, 18255, 18284, 18314,
+ 18345, 18375, 18406, 18437, 18468, 18499, 18531, 18563,
+ 18596, 18628, 18661, 18695, 18728, 18762, 18796, 18830,
+ 18865, 18900, 18935, 18971, 19007, 19043, 19080, 19117,
+ 19154, 19191, 19229, 19267, 19306, 19345, 19384, 19423,
+ 19463, 19504, 19544, 19585, 19626, 19668, 19710, 19752,
+ 19795, 19838, 19882, 19926, 19970, 20015, 20060, 20105,
+ 20151, 20198, 20244, 20291, 20339, 20387, 20435, 20484,
+ 20533, 20583, 20633, 20684, 20735, 20787, 20839, 20891,
+ 20944, 20997, 21051, 21106, 21161, 21216, 21272, 21328,
+ 21385, 21443, 21501, 21559, 21618, 21678, 21738, 21799,
+ 21860, 21922, 21984, 22048, 22111, 22175, 22240, 22306,
+ 22372, 22439, 22506, 22574, 22643, 22712, 22782, 22853,
+ 22924, 22996, 23069, 23142, 23216, 23291, 23367, 23443,
+ 23521, 23599, 23677, 23757, 23837, 23918, 24000, 24083,
+ 24167, 24251
+};//Q14
+
+const Word16 one_on_win_8k_16k_48k_fx[70] =
+{
+ 16432, 16472, 16512, 16554, 16596, 16639, 16684, 16730,
+ 16778, 16826, 16876, 16928, 16981, 17036, 17092, 17150,
+ 17210, 17271, 17334, 17399, 17465, 17534, 17604, 17676,
+ 17751, 17827, 17905, 17986, 18068, 18153, 18240, 18329,
+ 18421, 18515, 18612, 18711, 18813, 18918, 19025, 19135,
+ 19248, 19364, 19483, 19606, 19731, 19860, 19992, 20128,
+ 20268, 20411, 20558, 20709, 20865, 21024, 21188, 21357,
+ 21530, 21708, 21891, 22079, 22273, 22472, 22677, 22888,
+ 23105, 23329, 23560, 23797, 24041, 24251
+};//Q14
+
+const Word16 window_8_16_32kHz_fx[370] =
+{
+ 3, 9, 19, 33, 49, 69, 93, 119,
+ 149, 182, 219, 258, 301, 347, 396, 448,
+ 503, 561, 623, 687, 755, 825, 898, 974,
+ 1054, 1136, 1221, 1309, 1399, 1493, 1589, 1688,
+ 1790, 1895, 2002, 2112, 2225, 2340, 2458, 2579,
+ 2702, 2827, 2955, 3086, 3219, 3355, 3493, 3633,
+ 3775, 3920, 4068, 4217, 4369, 4523, 4679, 4837,
+ 4998, 5160, 5325, 5491, 5660, 5830, 6003, 6177,
+ 6353, 6531, 6711, 6892, 7076, 7260, 7447, 7635,
+ 7825, 8016, 8209, 8403, 8599, 8796, 8995, 9195,
+ 9396, 9598, 9802, 10007, 10212, 10419, 10628, 10837,
+ 11047, 11248, 11437, 11623, 11809, 11997, 12185, 12374,
+ 12564, 12754, 12944, 13135, 13326, 13517, 13709, 13901,
+ 14093, 14286, 14478, 14671, 14864, 15057, 15250, 15443,
+ 15636, 15829, 16023, 16216, 16409, 16602, 16794, 16987,
+ 17179, 17372, 17564, 17755, 17947, 18138, 18329, 18519,
+ 18710, 18899, 19089, 19278, 19466, 19654, 19841, 20028,
+ 20214, 20400, 20585, 20770, 20954, 21137, 21319, 21501,
+ 21682, 21862, 22042, 22220, 22398, 22575, 22751, 22926,
+ 23101, 23274, 23446, 23618, 23788, 23958, 24126, 24266,
+ 24321, 24460, 24625, 24789, 24953, 25114, 25275, 25435,
+ 25593, 25751, 25907, 26061, 26215, 26367, 26518, 26668,
+ 26817, 26964, 27110, 27254, 27398, 27540, 27680, 27819,
+ 27957, 28093, 28228, 28362, 28494, 28625, 28754, 28882,
+ 29008, 29133, 29256, 29378, 29499, 29618, 29736, 29852,
+ 29966, 30079, 30191, 30301, 30410, 30517, 30623, 30727,
+ 30830, 30931, 31031, 31129, 31226, 31322, 31416, 31508,
+ 31599, 31689, 31777, 31864, 31950, 32035, 32118, 32200,
+ 32280, 32360, 32439, 32517, 32595, 32673, 32673, 32593,
+ 32513, 32432, 32349, 32265, 32178, 32090, 31999, 31907,
+ 31812, 31715, 31615, 31514, 31410, 31304, 31196, 31085,
+ 30972, 30857, 30739, 30619, 30497, 30372, 30245, 30116,
+ 29984, 29850, 29714, 29575, 29434, 29290, 29144, 28996,
+ 28845, 28692, 28537, 28379, 28219, 28057, 27892, 27725,
+ 27555, 27383, 27209, 27033, 26854, 26672, 26489, 26303,
+ 26115, 25924, 25731, 25536, 25338, 25138, 24936, 24731,
+ 24525, 24316, 24104, 23890, 23674, 23456, 23236, 23013,
+ 22788, 22561, 22331, 22138, 22060, 21865, 21629, 21390,
+ 21150, 20907, 20662, 20414, 20165, 19913, 19659, 19403,
+ 19145, 18885, 18622, 18357, 18090, 17821, 17550, 17277,
+ 17001, 16723, 16443, 16161, 15877, 15591, 15303, 15012,
+ 14719, 14425, 14127, 13828, 13527, 13223, 12918, 12610,
+ 12300, 11988, 11673, 11356, 11038, 10716, 10393, 10067,
+ 9739, 9408, 9076, 8740, 8403, 8062, 7720, 7374,
+ 7026, 6675, 6322, 5965, 5606, 5243, 4878, 4508,
+ 4136, 3759, 3378, 2993, 2603, 2208, 1807, 1397,
+ 978, 545
+};//Q15
+
+const Word16 window_48kHz_fx[1110] =
+{
+ 0, 1, 2, 3, 5, 8, 10, 13,
+ 17, 21, 25, 30, 35, 40, 46, 52,
+ 58, 65, 72, 80, 88, 96, 105, 114,
+ 124, 133, 144, 154, 165, 176, 188, 200,
+ 212, 225, 238, 251, 265, 279, 293, 308,
+ 323, 339, 354, 371, 387, 404, 421, 439,
+ 457, 475, 493, 512, 532, 551, 571, 591,
+ 612, 633, 654, 676, 698, 720, 743, 766,
+ 789, 813, 837, 861, 885, 910, 936, 961,
+ 987, 1013, 1040, 1067, 1094, 1122, 1149, 1178,
+ 1206, 1235, 1264, 1293, 1323, 1353, 1384, 1414,
+ 1445, 1477, 1508, 1540, 1573, 1605, 1638, 1671,
+ 1705, 1739, 1773, 1807, 1842, 1877, 1912, 1948,
+ 1984, 2020, 2057, 2093, 2130, 2168, 2206, 2244,
+ 2282, 2320, 2359, 2399, 2438, 2478, 2518, 2558,
+ 2599, 2640, 2681, 2722, 2764, 2806, 2848, 2891,
+ 2934, 2977, 3020, 3064, 3108, 3152, 3196, 3241,
+ 3286, 3332, 3377, 3423, 3469, 3515, 3562, 3609,
+ 3656, 3704, 3751, 3799, 3847, 3896, 3945, 3994,
+ 4043, 4092, 4142, 4192, 4242, 4293, 4343, 4394,
+ 4445, 4497, 4549, 4600, 4653, 4705, 4758, 4811,
+ 4864, 4917, 4971, 5024, 5078, 5133, 5187, 5242,
+ 5297, 5352, 5407, 5463, 5519, 5575, 5631, 5688,
+ 5744, 5801, 5859, 5916, 5974, 6031, 6089, 6147,
+ 6206, 6265, 6323, 6382, 6442, 6501, 6561, 6620,
+ 6680, 6741, 6801, 6862, 6922, 6983, 7045, 7106,
+ 7168, 7229, 7291, 7353, 7416, 7478, 7541, 7604,
+ 7667, 7730, 7793, 7857, 7920, 7984, 8048, 8112,
+ 8177, 8241, 8306, 8371, 8436, 8501, 8566, 8632,
+ 8697, 8763, 8829, 8895, 8961, 9028, 9094, 9161,
+ 9228, 9295, 9362, 9429, 9497, 9564, 9632, 9700,
+ 9768, 9836, 9904, 9972, 10041, 10109, 10178, 10247,
+ 10316, 10385, 10454, 10523, 10593, 10662, 10732, 10802,
+ 10871, 10941, 11012, 11082, 11152, 11222, 11283, 11344,
+ 11406, 11467, 11529, 11591, 11653, 11716, 11778, 11840,
+ 11903, 11966, 12028, 12091, 12154, 12217, 12280, 12343,
+ 12406, 12469, 12532, 12595, 12658, 12722, 12785, 12849,
+ 12912, 12976, 13039, 13103, 13166, 13230, 13294, 13358,
+ 13421, 13485, 13549, 13613, 13677, 13741, 13805, 13869,
+ 13933, 13997, 14061, 14125, 14189, 14253, 14318, 14382,
+ 14446, 14510, 14574, 14639, 14703, 14767, 14832, 14896,
+ 14960, 15025, 15089, 15153, 15218, 15282, 15346, 15411,
+ 15475, 15540, 15604, 15668, 15733, 15797, 15862, 15926,
+ 15990, 16055, 16119, 16183, 16248, 16312, 16376, 16441,
+ 16505, 16569, 16634, 16698, 16762, 16826, 16891, 16955,
+ 17019, 17083, 17147, 17211, 17275, 17339, 17404, 17468,
+ 17532, 17596, 17659, 17723, 17787, 17851, 17915, 17979,
+ 18042, 18106, 18170, 18233, 18297, 18361, 18424, 18488,
+ 18551, 18614, 18678, 18741, 18804, 18868, 18931, 18994,
+ 19057, 19120, 19183, 19246, 19309, 19372, 19434, 19497,
+ 19560, 19622, 19685, 19748, 19810, 19872, 19935, 19997,
+ 20059, 20121, 20183, 20245, 20307, 20369, 20431, 20493,
+ 20554, 20616, 20677, 20739, 20800, 20862, 20923, 20984,
+ 21045, 21106, 21167, 21228, 21289, 21349, 21410, 21471,
+ 21531, 21591, 21652, 21712, 21772, 21832, 21892, 21952,
+ 22012, 22071, 22131, 22190, 22250, 22309, 22368, 22427,
+ 22486, 22545, 22604, 22663, 22722, 22780, 22839, 22897,
+ 22955, 23013, 23071, 23129, 23187, 23245, 23303, 23360,
+ 23418, 23475, 23532, 23589, 23646, 23703, 23760, 23817,
+ 23873, 23930, 23986, 24042, 24098, 24154, 24210, 24266,
+ 24321, 24377, 24432, 24488, 24543, 24598, 24653, 24707,
+ 24762, 24817, 24871, 24925, 24979, 25034, 25087, 25141,
+ 25195, 25248, 25302, 25355, 25408, 25461, 25514, 25567,
+ 25620, 25672, 25724, 25777, 25829, 25881, 25932, 25984,
+ 26036, 26087, 26138, 26189, 26240, 26291, 26342, 26393,
+ 26443, 26493, 26543, 26593, 26643, 26693, 26743, 26792,
+ 26841, 26890, 26939, 26988, 27037, 27086, 27134, 27182,
+ 27230, 27278, 27326, 27374, 27421, 27469, 27516, 27563,
+ 27610, 27657, 27703, 27750, 27796, 27842, 27888, 27934,
+ 27980, 28025, 28071, 28116, 28161, 28206, 28250, 28295,
+ 28340, 28384, 28428, 28472, 28516, 28559, 28603, 28646,
+ 28689, 28732, 28775, 28818, 28860, 28903, 28945, 28987,
+ 29029, 29071, 29112, 29154, 29195, 29236, 29277, 29318,
+ 29358, 29399, 29439, 29479, 29519, 29559, 29598, 29638,
+ 29677, 29716, 29755, 29794, 29832, 29871, 29909, 29947,
+ 29985, 30023, 30061, 30098, 30135, 30172, 30209, 30246,
+ 30283, 30319, 30356, 30392, 30428, 30464, 30499, 30535,
+ 30570, 30605, 30640, 30675, 30710, 30744, 30779, 30813,
+ 30847, 30881, 30914, 30948, 30981, 31014, 31047, 31080,
+ 31113, 31145, 31178, 31210, 31242, 31274, 31306, 31337,
+ 31369, 31400, 31431, 31462, 31493, 31523, 31554, 31584,
+ 31614, 31644, 31674, 31704, 31733, 31763, 31792, 31821,
+ 31850, 31879, 31907, 31936, 31964, 31992, 32020, 32048,
+ 32076, 32104, 32131, 32159, 32186, 32213, 32240, 32267,
+ 32294, 32320, 32347, 32373, 32399, 32426, 32452, 32478,
+ 32504, 32530, 32556, 32582, 32607, 32633, 32659, 32685,
+ 32712, 32739, 32739, 32712, 32685, 32659, 32633, 32606,
+ 32580, 32553, 32527, 32500, 32473, 32446, 32418, 32391,
+ 32363, 32335, 32307, 32279, 32251, 32222, 32193, 32164,
+ 32134, 32105, 32075, 32045, 32015, 31984, 31953, 31922,
+ 31891, 31859, 31828, 31796, 31764, 31731, 31698, 31665,
+ 31632, 31599, 31565, 31531, 31497, 31462, 31428, 31393,
+ 31357, 31322, 31286, 31250, 31214, 31177, 31141, 31104,
+ 31066, 31029, 30991, 30953, 30915, 30876, 30837, 30798,
+ 30759, 30719, 30679, 30639, 30599, 30558, 30517, 30476,
+ 30435, 30393, 30351, 30309, 30266, 30224, 30181, 30138,
+ 30094, 30050, 30006, 29962, 29917, 29873, 29827, 29782,
+ 29737, 29691, 29645, 29598, 29551, 29505, 29457, 29410,
+ 29362, 29314, 29266, 29218, 29169, 29120, 29070, 29021,
+ 28971, 28921, 28871, 28820, 28769, 28718, 28667, 28615,
+ 28563, 28511, 28459, 28406, 28353, 28300, 28246, 28192,
+ 28138, 28084, 28030, 27975, 27920, 27864, 27809, 27753,
+ 27697, 27640, 27584, 27527, 27470, 27412, 27355, 27297,
+ 27238, 27180, 27121, 27062, 27003, 26944, 26884, 26824,
+ 26763, 26703, 26642, 26581, 26520, 26458, 26396, 26334,
+ 26272, 26209, 26146, 26083, 26020, 25956, 25892, 25828,
+ 25763, 25699, 25634, 25568, 25503, 25437, 25371, 25305,
+ 25239, 25172, 25105, 25037, 24970, 24902, 24834, 24766,
+ 24697, 24628, 24559, 24490, 24420, 24351, 24281, 24210,
+ 24140, 24069, 23998, 23926, 23855, 23783, 23711, 23638,
+ 23566, 23493, 23420, 23346, 23273, 23199, 23125, 23050,
+ 22976, 22901, 22826, 22750, 22675, 22599, 22523, 22446,
+ 22370, 22293, 22215, 22138, 22060, 21983, 21904, 21826,
+ 21747, 21669, 21589, 21510, 21430, 21351, 21271, 21190,
+ 21110, 21029, 20948, 20866, 20785, 20703, 20621, 20538,
+ 20456, 20373, 20290, 20207, 20123, 20039, 19955, 19871,
+ 19787, 19702, 19617, 19532, 19446, 19360, 19274, 19188,
+ 19102, 19015, 18928, 18841, 18754, 18666, 18578, 18490,
+ 18402, 18313, 18224, 18135, 18046, 17956, 17866, 17776,
+ 17686, 17595, 17505, 17414, 17322, 17231, 17139, 17047,
+ 16955, 16863, 16770, 16677, 16584, 16490, 16397, 16303,
+ 16209, 16114, 16020, 15925, 15830, 15735, 15639, 15543,
+ 15447, 15351, 15254, 15158, 15061, 14964, 14866, 14768,
+ 14671, 14572, 14474, 14375, 14276, 14177, 14078, 13978,
+ 13878, 13778, 13678, 13578, 13477, 13376, 13274, 13173,
+ 13071, 12969, 12867, 12764, 12662, 12559, 12455, 12352,
+ 12248, 12144, 12040, 11936, 11831, 11726, 11621, 11515,
+ 11410, 11304, 11197, 11091, 10984, 10877, 10770, 10663,
+ 10555, 10447, 10339, 10230, 10122, 10013, 9904, 9794,
+ 9684, 9574, 9464, 9353, 9243, 9131, 9020, 8908,
+ 8797, 8684, 8572, 8459, 8346, 8233, 8119, 8006,
+ 7892, 7777, 7662, 7547, 7432, 7317, 7201, 7085,
+ 6968, 6851, 6734, 6617, 6499, 6381, 6263, 6144,
+ 6025, 5906, 5786, 5666, 5546, 5425, 5304, 5183,
+ 5061, 4939, 4817, 4694, 4570, 4447, 4323, 4198,
+ 4074, 3948, 3823, 3696, 3570, 3443, 3315, 3187,
+ 3058, 2929, 2800, 2669, 2539, 2407, 2275, 2142,
+ 2009, 1875, 1740, 1604, 1467, 1330, 1191, 1051,
+ 909, 766, 621, 474, 324, 169
+};//Q15
+
+const Word16 window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?Q15*/
+{
+ 1, 3, 7, 12, 19, 27, 36, 47,
+ 58, 72, 86, 102, 119, 138, 157, 178,
+ 201, 224, 249, 275, 302, 331, 361, 391,
+ 424, 457, 492, 527, 564, 603, 642, 683,
+ 724, 767, 811, 857, 903, 951, 999, 1049,
+ 1100, 1152, 1205, 1260, 1315, 1372, 1430, 1488,
+ 1548, 1609, 1671, 1735, 1799, 1864, 1931, 1998,
+ 2066, 2136, 2207, 2278, 2351, 2424, 2499, 2575,
+ 2651, 2729, 2808, 2887, 2968, 3049, 3132, 3215,
+ 3300, 3385, 3472, 3559, 3647, 3736, 3826, 3917,
+ 4009, 4101, 4195, 4289, 4385, 4481, 4578, 4676,
+ 4774, 4874, 4974, 5075, 5177, 5280, 5384, 5488,
+ 5593, 5699, 5806, 5913, 6021, 6130, 6240, 6350,
+ 6461, 6573, 6685, 6798, 6912, 7026, 7141, 7257,
+ 7373, 7491, 7608, 7726, 7845, 7965, 8085, 8206,
+ 8327, 8449, 8571, 8694, 8817, 8941, 9066, 9191,
+ 9316, 9442, 9569, 9696, 9823, 9951, 10079, 10208,
+ 10337, 10467, 10597, 10727, 10858, 10990, 11121, 11253,
+ 11367, 11482, 11598, 11714, 11831, 11948, 12065, 12182,
+ 12300, 12418, 12536, 12654, 12772, 12891, 13010, 13129,
+ 13248, 13367, 13486, 13605, 13725, 13844, 13964, 14084,
+ 14203, 14323, 14443, 14563, 14683, 14804, 14924, 15044,
+ 15164, 15284, 15405, 15525, 15645, 15765, 15885, 16006,
+ 16126, 16246, 16366, 16486, 16606, 16726, 16846, 16966,
+ 17086, 17206, 17325, 17445, 17564, 17684, 17803, 17922,
+ 18041, 18160, 18279, 18397, 18516, 18634, 18753, 18871,
+ 18988, 19106, 19224, 19341, 19458, 19575, 19692, 19809,
+ 19925, 20041, 20157, 20273, 20388, 20503, 20618, 20733,
+ 20848, 20962, 21076, 21190, 21303, 21416, 21529, 21642,
+ 21754, 21866, 21978, 22089, 22200, 22311, 22421, 22531,
+ 22641, 22751, 22860, 22968, 23077, 23185, 23293, 23400,
+ 23507, 23613, 23719, 23825, 23931, 24036, 24140, 24244,
+ 24348, 24452, 24555, 24657, 24759, 24861, 24962, 25063,
+ 25163, 25263, 25363, 25462, 25561, 25659, 25756, 25854,
+ 25950, 26047, 26142, 26238, 26333, 26427, 26521, 26614,
+ 26707, 26799, 26891, 26982, 27073, 27164, 27253, 27343,
+ 27432, 27520, 27608, 27695, 27781, 27868, 27953, 28038,
+ 28123, 28207, 28290, 28373, 28456, 28537, 28619, 28699,
+ 28780, 28859, 28938, 29017, 29095, 29172, 29249, 29325,
+ 29401, 29476, 29550, 29624, 29698, 29771, 29843, 29915,
+ 29986, 30056, 30126, 30196, 30264, 30333, 30400, 30467,
+ 30534, 30600, 30665, 30730, 30794, 30858, 30921, 30984,
+ 31046, 31107, 31168, 31228, 31288, 31347, 31406, 31464,
+ 31522, 31579, 31635, 31691, 31746, 31801, 31856, 31909,
+ 31963, 32016, 32068, 32120, 32171, 32222, 32273, 32323,
+ 32372, 32422, 32471, 32520, 32568, 32617, 32666, 32715,
+ 32715, 32666, 32616, 32567, 32517, 32466, 32415, 32364,
+ 32311, 32258, 32204, 32150, 32094, 32038, 31981, 31923,
+ 31864, 31805, 31744, 31683, 31621, 31557, 31494, 31429,
+ 31363, 31296, 31229, 31161, 31091, 31021, 30950, 30878,
+ 30805, 30731, 30657, 30581, 30505, 30427, 30349, 30270,
+ 30189, 30108, 30026, 29943, 29860, 29775, 29689, 29603,
+ 29515, 29427, 29337, 29247, 29156, 29064, 28971, 28877,
+ 28782, 28687, 28590, 28492, 28394, 28294, 28194, 28093,
+ 27991, 27888, 27784, 27679, 27573, 27466, 27358, 27250,
+ 27140, 27030, 26919, 26806, 26693, 26579, 26464, 26349,
+ 26232, 26114, 25996, 25876, 25756, 25635, 25512, 25389,
+ 25265, 25140, 25015, 24888, 24761, 24632, 24503, 24373,
+ 24242, 24110, 23977, 23843, 23708, 23573, 23436, 23299,
+ 23161, 23022, 22882, 22741, 22599, 22457, 22313, 22169,
+ 22024, 21878, 21731, 21583, 21435, 21285, 21135, 20984,
+ 20832, 20679, 20525, 20370, 20215, 20059, 19901, 19743,
+ 19584, 19425, 19264, 19103, 18940, 18777, 18613, 18448,
+ 18283, 18116, 17949, 17781, 17612, 17442, 17271, 17100,
+ 16927, 16754, 16580, 16405, 16230, 16053, 15876, 15698,
+ 15518, 15339, 15158, 14976, 14794, 14611, 14427, 14242,
+ 14056, 13869, 13682, 13494, 13305, 13115, 12924, 12732,
+ 12540, 12346, 12152, 11957, 11761, 11564, 11366, 11168,
+ 10968, 10768, 10566, 10364, 10161, 9957, 9752, 9547,
+ 9340, 9132, 8924, 8714, 8503, 8292, 8079, 7866,
+ 7651, 7436, 7219, 7002, 6783, 6563, 6343, 6121,
+ 5897, 5673, 5448, 5221, 4993, 4764, 4533, 4301,
+ 4067, 3832, 3596, 3358, 3118, 2876, 2632, 2387,
+ 2139, 1888, 1635, 1379, 1119, 854, 583, 304
+};
+
+const Word16 small_overlap_48[R2_48 / 7] =//Q15
+{
+ 429, 1286, 2143, 2998, 3851, 4702, 5549, 6393,
+ 7232, 8066, 8895, 9717, 10533, 11342, 12142, 12935,
+ 13719, 14493, 15257, 16011, 16754, 17485, 18205, 18912,
+ 19606, 20286, 20953, 21605, 22243, 22865, 23472, 24062,
+ 24636, 25193, 25733, 26255, 26760, 27246, 27713, 28161,
+ 28590, 28999, 29389, 29758, 30107, 30435, 30743, 31029,
+ 31294, 31538, 31760, 31960, 32138, 32295, 32429, 32541,
+ 32631, 32698, 32743, 32765
+};
+
+const Word16 small_overlap_25[R2_25 / 7] =//Q15
+{
+ 804, 2411, 4011, 5602, 7180, 8740, 10279, 11793,
+ 13279, 14733, 16151, 17531, 18868, 20160, 21403, 22595,
+ 23732, 24812, 25833, 26791, 27684, 28511, 29269, 29957,
+ 30572, 31114, 31581, 31972, 32286, 32522, 32679, 32758
+};
+
+const Word16 small_overlap_int[R2_16 / 7] =//Q15
+{
+ 2571, 5126,
+ 7650, 10126, 12540, 14876, 17121, 19261, 21281, 22865,
+ 23472, 24917, 26510, 27939, 29197, 30274, 31164, 31863,
+ 32365, 32667
+};
+
+
+const Word16 half_overlap_48[3 * R2_48 / 7] =//Q15
+{
+ 143, 429,
+ 715, 1001, 1286, 1572, 1858, 2143, 2428, 2713,
+ 2998, 3283, 3567, 3851, 4135, 4419, 4702, 4985,
+ 5267, 5549, 5831, 6112, 6393, 6673, 6953, 7232,
+ 7510, 7788, 8066, 8343, 8619, 8895, 9169, 9444,
+ 9717, 9990, 10262, 10533, 10803, 11073, 11342, 11609,
+ 11876, 12142, 12408, 12672, 12935, 13197, 13458, 13719,
+ 13978, 14236, 14493, 14749, 15004, 15257, 15510, 15761,
+ 16011, 16260, 16508, 16754, 16999, 17243, 17485, 17727,
+ 17966, 18205, 18442, 18678, 18912, 19145, 19376, 19606,
+ 19834, 20061, 20286, 20510, 20732, 20953, 21172, 21390,
+ 21605, 21820, 22032, 22243, 22452, 22659, 22865, 23069,
+ 23271, 23472, 23670, 23867, 24062, 24255, 24447, 24636,
+ 24824, 25010, 25193, 25375, 25555, 25733, 25909, 26083,
+ 26255, 26426, 26594, 26760, 26924, 27086, 27246, 27403,
+ 27559, 27713, 27864, 28014, 28161, 28306, 28449, 28590,
+ 28729, 28865, 28999, 29131, 29261, 29389, 29514, 29637,
+ 29758, 29877, 29993, 30107, 30219, 30328, 30435, 30540,
+ 30643, 30743, 30840, 30936, 31029, 31120, 31208, 31294,
+ 31378, 31459, 31538, 31614, 31688, 31760, 31829, 31896,
+ 31960, 32022, 32081, 32138, 32193, 32245, 32295, 32342,
+ 32387, 32429, 32469, 32506, 32541, 32573, 32603, 32631,
+ 32655, 32678, 32698, 32715, 32730, 32743, 32753, 32760,
+ 32765, 32767
+};
+
+const Word16 half_overlap_25[3 * R2_25 / 7] =//Q15
+{
+ 268, 804, 1340, 1876, 2411, 2945, 3479, 4011,
+ 4543, 5073, 5602, 6130, 6655, 7180, 7702, 8222,
+ 8740, 9255, 9768, 10279, 10786, 11291, 11793, 12292,
+ 12787, 13279, 13767, 14252, 14733, 15210, 15683, 16151,
+ 16616, 17075, 17531, 17981, 18427, 18868, 19304, 19735,
+ 20160, 20580, 20994, 21403, 21806, 22204, 22595, 22980,
+ 23359, 23732, 24099, 24459, 24812, 25159, 25499, 25833,
+ 26159, 26478, 26791, 27096, 27394, 27684, 27967, 28243,
+ 28511, 28771, 29024, 29269, 29506, 29736, 29957, 30170,
+ 30375, 30572, 30761, 30942, 31114, 31278, 31434, 31581,
+ 31720, 31850, 31972, 32085, 32190, 32286, 32373, 32452,
+ 32522, 32583, 32635, 32679, 32714, 32741, 32758, 32767
+};
+
+const Word16 half_overlap_int[3 * R2_16 / 7] =//Q15
+{
+ 858, 1715, 2571, 3425, 4277, 5126,
+ 5971, 6813, 7650, 8481, 9307, 10126, 10938, 11743,
+ 12540, 13328, 14107, 14876, 15636, 16384, 17121, 17847,
+ 18560, 19261, 19948, 20622, 21281, 21926, 22556, 23069,
+ 23271, 23769, 24351, 24917, 25466, 25997, 26510, 27005,
+ 27482, 27939, 28378, 28797, 29197, 29576, 29935, 30274,
+ 30592, 30888, 31164, 31419, 31651, 31863, 32052, 32219,
+ 32365, 32488, 32588, 32667, 32723, 32757
+};
+const Word16 wac_h[LPC_SHB_ORDER] =//Q15
+{
+ 32763,
+ 32751,
+ 32731,
+ 32703,
+ 32667,
+ 32622,
+ 32570,
+ 32510,
+ 32442,
+ 32366
+};
+
+const Word16 wac_l[LPC_SHB_ORDER] =//Q15
+{
+ 31381,
+ 27317,
+ 20869,
+ 12529,
+ 2980,
+ 25869,
+ 16731,
+ 9600,
+ 5926,
+ 7354
+};
+
+const Word16 dsDiracsTab[65] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 23, 25,
+ 27, 29, 31, 33, 35, 37, 39, 43,
+ 47, 51, 55, 59, 63, 67, 71, 75,
+ 83, 91, 99, 107, 115, 123, 131, 139,
+ 147, 163, 179, 195, 211, 227, 243, 259,
+ 275, 291, 323, 355, 387, 419, 451, 483,
+ 512
+};
+
+const Word16 pwf_fx[17] =//Q12
+{
+ 22938, 16056, 11239, 7868, 5507, 3855, 2699, 1889,
+ 1322, 926, 648, 454, 317, 222, 156, 109,
+ 76
+};
+
+const Word32 inverse_table[] =//Q29
+{
+ 0,
+ 134217728, 67108864, 44739242, 33554432, 26843545, 22369621, 19173961, 16777216, 14913080, 13421772, 12201611, 11184810, 10324440, 9586980, 8947848, 8388608, 7895160, 7456540, 7064090, 6710886, 6391320, 6100805, 5835553, 5592405, 5368709, 5162220, 4971026, 4793490, 4628197, 4473924, 4329604, 4194304, 4067203, 3947580, 3834792, 3728270, 3627506, 3532045, 3441480, 3355443, 3273603, 3195660, 3121342, 3050402, 2982616, 2917776, 2855696, 2796202, 2739137, 2684354, 2631720, 2581110, 2532409, 2485513, 2440322, 2396745, 2354696, 2314098, 2274876, 2236962, 2200290, 2164802, 2130440, 2097152, 2064888, 2033601, 2003249, 1973790, 1945184, 1917396, 1890390, 1864135, 1838599, 1813753, 1789569, 1766022, 1743087, 1720740, 1698958, 1677721, 1657008, 1636801, 1617081, 1597830, 1579032, 1560671, 1542732, 1525201, 1508064, 1491308, 1474920, 1458888, 1443201, 1427848, 1412818, 1398101, 1383687, 1369568, 1355734, 1342177, 1328888, 1315860, 1303084, 1290555, 1278264, 1266204, 1254371, 1242756, 1231355, 1220161, 1209168, 1198372, 1187767, 1177348, 1167110, 1157049, 1147160, 1137438, 1127880, 1118481, 1109237, 1100145, 1091201, 1082401, 1073741, 1065220, 1056832, 1048576, 1040447, 1032444, 1024562, 1016800, 1009155, 1001624, 994205, 986895, 979691, 972592, 965595, 958698, 951898, 945195, 938585, 932067, 925639, 919299, 913045, 906876, 900790, 894784, 888859, 883011, 877240, 871543, 865920, 860370, 854889, 849479, 844136, 838860, 833650, 828504, 823421, 818400, 813440, 808540, 803698, 798915, 794187, 789516, 784898, 780335, 775825, 771366, 766958, 762600, 758292, 754032, 749819, 745654, 741534, 737460, 733430, 729444, 725501, 721600, 717741, 713924, 710146, 706409, 702710, 699050, 695428, 691843, 688296, 684784, 681308, 677867, 674460, 671088, 667749, 664444, 661171, 657930, 654720, 651542, 648394, 645277, 642190, 639132, 636102, 633102, 630130, 627185, 624268, 621378, 618514, 615677, 612866, 610080, 607320, 604584, 601873, 599186, 596523, 593883, 591267, 588674, 586103, 583555, 581029, 578524, 576041, 573580, 571139, 568719, 566319, 563940, 561580, 559240, 556920, 554618, 552336, 550072, 547827, 545600, 543391, 541200, 539027, 536870, 534731, 532610, 530504, 528416, 526344,
+};
+
+const Word16 cos_diff_table[512] =//Q15
+{
+ SHC(0xFFFF), SHC(0xFFF8), SHC(0xFFF4), SHC(0xFFEF), SHC(0xFFE9), SHC(0xFFE5), SHC(0xFFE0), SHC(0xFFDB),
+ SHC(0xFFD6), SHC(0xFFD2), SHC(0xFFCC), SHC(0xFFC7), SHC(0xFFC3), SHC(0xFFBE), SHC(0xFFB8), SHC(0xFFB4),
+ SHC(0xFFB0), SHC(0xFFAA), SHC(0xFFA5), SHC(0xFFA1), SHC(0xFF9C), SHC(0xFF97), SHC(0xFF92), SHC(0xFF8E),
+ SHC(0xFF89), SHC(0xFF84), SHC(0xFF80), SHC(0xFF7B), SHC(0xFF76), SHC(0xFF71), SHC(0xFF6D), SHC(0xFF69),
+ SHC(0xFF64), SHC(0xFF5F), SHC(0xFF5B), SHC(0xFF56), SHC(0xFF52), SHC(0xFF4D), SHC(0xFF49), SHC(0xFF45),
+ SHC(0xFF40), SHC(0xFF3C), SHC(0xFF38), SHC(0xFF33), SHC(0xFF2F), SHC(0xFF2B), SHC(0xFF27), SHC(0xFF23),
+ SHC(0xFF1E), SHC(0xFF1B), SHC(0xFF16), SHC(0xFF13), SHC(0xFF0E), SHC(0xFF0B), SHC(0xFF06), SHC(0xFF03),
+ SHC(0xFEFF), SHC(0xFEFB), SHC(0xFEF8), SHC(0xFEF3), SHC(0xFEF1), SHC(0xFEEC), SHC(0xFEE9), SHC(0xFEE5),
+ SHC(0xFEE2), SHC(0xFEDF), SHC(0xFEDB), SHC(0xFED8), SHC(0xFED4), SHC(0xFED1), SHC(0xFECE), SHC(0xFECB),
+ SHC(0xFEC7), SHC(0xFEC5), SHC(0xFEC1), SHC(0xFEBF), SHC(0xFEBB), SHC(0xFEB9), SHC(0xFEB6), SHC(0xFEB3),
+ SHC(0xFEB0), SHC(0xFEAE), SHC(0xFEAB), SHC(0xFEA8), SHC(0xFEA6), SHC(0xFEA3), SHC(0xFEA1), SHC(0xFE9F),
+ SHC(0xFE9C), SHC(0xFE9A), SHC(0xFE98), SHC(0xFE95), SHC(0xFE94), SHC(0xFE91), SHC(0xFE8F), SHC(0xFE8E),
+ SHC(0xFE8B), SHC(0xFE8A), SHC(0xFE88), SHC(0xFE86), SHC(0xFE85), SHC(0xFE83), SHC(0xFE81), SHC(0xFE80),
+ SHC(0xFE7F), SHC(0xFE7D), SHC(0xFE7B), SHC(0xFE7B), SHC(0xFE79), SHC(0xFE79), SHC(0xFE77), SHC(0xFE76),
+ SHC(0xFE75), SHC(0xFE74), SHC(0xFE73), SHC(0xFE73), SHC(0xFE72), SHC(0xFE71), SHC(0xFE71), SHC(0xFE70),
+ SHC(0xFE6F), SHC(0xFE70), SHC(0xFE6E), SHC(0xFE6F), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E),
+ SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6E), SHC(0xFE6F), SHC(0xFE6E), SHC(0xFE70), SHC(0xFE6F),
+ SHC(0xFE70), SHC(0xFE71), SHC(0xFE71), SHC(0xFE72), SHC(0xFE73), SHC(0xFE73), SHC(0xFE74), SHC(0xFE75),
+ SHC(0xFE76), SHC(0xFE77), SHC(0xFE79), SHC(0xFE79), SHC(0xFE7B), SHC(0xFE7B), SHC(0xFE7D), SHC(0xFE7F),
+ SHC(0xFE80), SHC(0xFE81), SHC(0xFE83), SHC(0xFE85), SHC(0xFE86), SHC(0xFE88), SHC(0xFE8A), SHC(0xFE8B),
+ SHC(0xFE8E), SHC(0xFE8F), SHC(0xFE91), SHC(0xFE94), SHC(0xFE95), SHC(0xFE98), SHC(0xFE9A), SHC(0xFE9C),
+ SHC(0xFE9F), SHC(0xFEA1), SHC(0xFEA3), SHC(0xFEA6), SHC(0xFEA8), SHC(0xFEAB), SHC(0xFEAE), SHC(0xFEB0),
+ SHC(0xFEB3), SHC(0xFEB6), SHC(0xFEB9), SHC(0xFEBB), SHC(0xFEBF), SHC(0xFEC1), SHC(0xFEC5), SHC(0xFEC7),
+ SHC(0xFECB), SHC(0xFECE), SHC(0xFED1), SHC(0xFED4), SHC(0xFED8), SHC(0xFEDB), SHC(0xFEDF), SHC(0xFEE2),
+ SHC(0xFEE5), SHC(0xFEE9), SHC(0xFEEC), SHC(0xFEF1), SHC(0xFEF3), SHC(0xFEF8), SHC(0xFEFB), SHC(0xFEFF),
+ SHC(0xFF03), SHC(0xFF06), SHC(0xFF0B), SHC(0xFF0E), SHC(0xFF13), SHC(0xFF16), SHC(0xFF1B), SHC(0xFF1E),
+ SHC(0xFF23), SHC(0xFF27), SHC(0xFF2B), SHC(0xFF2F), SHC(0xFF33), SHC(0xFF38), SHC(0xFF3C), SHC(0xFF40),
+ SHC(0xFF45), SHC(0xFF49), SHC(0xFF4D), SHC(0xFF52), SHC(0xFF56), SHC(0xFF5B), SHC(0xFF5F), SHC(0xFF64),
+ SHC(0xFF69), SHC(0xFF6D), SHC(0xFF71), SHC(0xFF76), SHC(0xFF7B), SHC(0xFF80), SHC(0xFF84), SHC(0xFF89),
+ SHC(0xFF8E), SHC(0xFF92), SHC(0xFF97), SHC(0xFF9C), SHC(0xFFA1), SHC(0xFFA5), SHC(0xFFAA), SHC(0xFFB0),
+ SHC(0xFFB4), SHC(0xFFB8), SHC(0xFFBE), SHC(0xFFC3), SHC(0xFFC7), SHC(0xFFCC), SHC(0xFFD2), SHC(0xFFD6),
+ SHC(0xFFDB), SHC(0xFFE0), SHC(0xFFE5), SHC(0xFFE9), SHC(0xFFEF), SHC(0xFFF4), SHC(0xFFF8), SHC(0xFFFF),
+ SHC(0x0001), SHC(0x0008), SHC(0x000C), SHC(0x0011), SHC(0x0017), SHC(0x001B), SHC(0x0020), SHC(0x0025),
+ SHC(0x002A), SHC(0x002E), SHC(0x0034), SHC(0x0039), SHC(0x003D), SHC(0x0042), SHC(0x0048), SHC(0x004C),
+ SHC(0x0050), SHC(0x0056), SHC(0x005B), SHC(0x005F), SHC(0x0064), SHC(0x0069), SHC(0x006E), SHC(0x0072),
+ SHC(0x0077), SHC(0x007C), SHC(0x0080), SHC(0x0085), SHC(0x008A), SHC(0x008F), SHC(0x0093), SHC(0x0097),
+ SHC(0x009C), SHC(0x00A1), SHC(0x00A5), SHC(0x00AA), SHC(0x00AE), SHC(0x00B3), SHC(0x00B7), SHC(0x00BB),
+ SHC(0x00C0), SHC(0x00C4), SHC(0x00C8), SHC(0x00CD), SHC(0x00D1), SHC(0x00D5), SHC(0x00D9), SHC(0x00DD),
+ SHC(0x00E2), SHC(0x00E5), SHC(0x00EA), SHC(0x00ED), SHC(0x00F2), SHC(0x00F5), SHC(0x00FA), SHC(0x00FD),
+ SHC(0x0101), SHC(0x0105), SHC(0x0108), SHC(0x010D), SHC(0x010F), SHC(0x0114), SHC(0x0117), SHC(0x011B),
+ SHC(0x011E), SHC(0x0121), SHC(0x0125), SHC(0x0128), SHC(0x012C), SHC(0x012F), SHC(0x0132), SHC(0x0135),
+ SHC(0x0139), SHC(0x013B), SHC(0x013F), SHC(0x0141), SHC(0x0145), SHC(0x0147), SHC(0x014A), SHC(0x014D),
+ SHC(0x0150), SHC(0x0152), SHC(0x0155), SHC(0x0158), SHC(0x015A), SHC(0x015D), SHC(0x015F), SHC(0x0161),
+ SHC(0x0164), SHC(0x0166), SHC(0x0168), SHC(0x016B), SHC(0x016C), SHC(0x016F), SHC(0x0171), SHC(0x0172),
+ SHC(0x0175), SHC(0x0176), SHC(0x0178), SHC(0x017A), SHC(0x017B), SHC(0x017D), SHC(0x017F), SHC(0x0180),
+ SHC(0x0181), SHC(0x0183), SHC(0x0185), SHC(0x0185), SHC(0x0187), SHC(0x0187), SHC(0x0189), SHC(0x018A),
+ SHC(0x018B), SHC(0x018C), SHC(0x018D), SHC(0x018D), SHC(0x018E), SHC(0x018F), SHC(0x018F), SHC(0x0190),
+ SHC(0x0191), SHC(0x0190), SHC(0x0192), SHC(0x0191), SHC(0x0192), SHC(0x0192), SHC(0x0192), SHC(0x0192),
+ SHC(0x0192), SHC(0x0192), SHC(0x0192), SHC(0x0192), SHC(0x0191), SHC(0x0192), SHC(0x0190), SHC(0x0191),
+ SHC(0x0190), SHC(0x018F), SHC(0x018F), SHC(0x018E), SHC(0x018D), SHC(0x018D), SHC(0x018C), SHC(0x018B),
+ SHC(0x018A), SHC(0x0189), SHC(0x0187), SHC(0x0187), SHC(0x0185), SHC(0x0185), SHC(0x0183), SHC(0x0181),
+ SHC(0x0180), SHC(0x017F), SHC(0x017D), SHC(0x017B), SHC(0x017A), SHC(0x0178), SHC(0x0176), SHC(0x0175),
+ SHC(0x0172), SHC(0x0171), SHC(0x016F), SHC(0x016C), SHC(0x016B), SHC(0x0168), SHC(0x0166), SHC(0x0164),
+ SHC(0x0161), SHC(0x015F), SHC(0x015D), SHC(0x015A), SHC(0x0158), SHC(0x0155), SHC(0x0152), SHC(0x0150),
+ SHC(0x014D), SHC(0x014A), SHC(0x0147), SHC(0x0145), SHC(0x0141), SHC(0x013F), SHC(0x013B), SHC(0x0139),
+ SHC(0x0135), SHC(0x0132), SHC(0x012F), SHC(0x012C), SHC(0x0128), SHC(0x0125), SHC(0x0121), SHC(0x011E),
+ SHC(0x011B), SHC(0x0117), SHC(0x0114), SHC(0x010F), SHC(0x010D), SHC(0x0108), SHC(0x0105), SHC(0x0101),
+ SHC(0x00FD), SHC(0x00FA), SHC(0x00F5), SHC(0x00F2), SHC(0x00ED), SHC(0x00EA), SHC(0x00E5), SHC(0x00E2),
+ SHC(0x00DD), SHC(0x00D9), SHC(0x00D5), SHC(0x00D1), SHC(0x00CD), SHC(0x00C8), SHC(0x00C4), SHC(0x00C0),
+ SHC(0x00BB), SHC(0x00B7), SHC(0x00B3), SHC(0x00AE), SHC(0x00AA), SHC(0x00A5), SHC(0x00A1), SHC(0x009C),
+ SHC(0x0097), SHC(0x0093), SHC(0x008F), SHC(0x008A), SHC(0x0085), SHC(0x0080), SHC(0x007C), SHC(0x0077),
+ SHC(0x0072), SHC(0x006E), SHC(0x0069), SHC(0x0064), SHC(0x005F), SHC(0x005B), SHC(0x0056), SHC(0x0050),
+ SHC(0x004C), SHC(0x0048), SHC(0x0042), SHC(0x003D), SHC(0x0039), SHC(0x0034), SHC(0x002E), SHC(0x002A),
+ SHC(0x0025), SHC(0x0020), SHC(0x001B), SHC(0x0017), SHC(0x0011), SHC(0x000C), SHC(0x0008), SHC(0x0001)
+
+};
+
+const Word16 fftSineTab640_fx[ 321 ] =
+{//Q15
+ SHC( 0x0000 ), SHC( 0x0141 ), SHC( 0x0283 ), SHC( 0x03c4 ), SHC( 0x0506 ), SHC( 0x0647 ), SHC( 0x0789 ), SHC( 0x08ca ),
+ SHC( 0x0a0a ), SHC( 0x0b4b ), SHC( 0x0c8b ), SHC( 0x0dcb ), SHC( 0x0f0b ), SHC( 0x104a ), SHC( 0x1189 ), SHC( 0x12c8 ),
+ SHC( 0x1406 ), SHC( 0x1543 ), SHC( 0x1680 ), SHC( 0x17bc ), SHC( 0x18f8 ), SHC( 0x1a33 ), SHC( 0x1b6e ), SHC( 0x1ca8 ),
+ SHC( 0x1de1 ), SHC( 0x1f19 ), SHC( 0x2051 ), SHC( 0x2188 ), SHC( 0x22be ), SHC( 0x23f3 ), SHC( 0x2528 ), SHC( 0x265b ),
+ SHC( 0x278d ), SHC( 0x28bf ), SHC( 0x29ef ), SHC( 0x2b1f ), SHC( 0x2c4d ), SHC( 0x2d7a ), SHC( 0x2ea6 ), SHC( 0x2fd1 ),
+ SHC( 0x30fb ), SHC( 0x3224 ), SHC( 0x334b ), SHC( 0x3471 ), SHC( 0x3596 ), SHC( 0x36ba ), SHC( 0x37dc ), SHC( 0x38fd ),
+ SHC( 0x3a1c ), SHC( 0x3b3a ), SHC( 0x3c56 ), SHC( 0x3d71 ), SHC( 0x3e8b ), SHC( 0x3fa3 ), SHC( 0x40b9 ), SHC( 0x41ce ),
+ SHC( 0x42e1 ), SHC( 0x43f2 ), SHC( 0x4502 ), SHC( 0x4610 ), SHC( 0x471c ), SHC( 0x4827 ), SHC( 0x4930 ), SHC( 0x4a37 ),
+ SHC( 0x4b3c ), SHC( 0x4c3f ), SHC( 0x4d41 ), SHC( 0x4e40 ), SHC( 0x4f3e ), SHC( 0x503a ), SHC( 0x5133 ), SHC( 0x522b ),
+ SHC( 0x5321 ), SHC( 0x5414 ), SHC( 0x5506 ), SHC( 0x55f5 ), SHC( 0x56e2 ), SHC( 0x57ce ), SHC( 0x58b7 ), SHC( 0x599d ),
+ SHC( 0x5a82 ), SHC( 0x5b64 ), SHC( 0x5c44 ), SHC( 0x5d22 ), SHC( 0x5dfe ), SHC( 0x5ed7 ), SHC( 0x5fae ), SHC( 0x6082 ),
+ SHC( 0x6154 ), SHC( 0x6224 ), SHC( 0x62f2 ), SHC( 0x63bc ), SHC( 0x6485 ), SHC( 0x654b ), SHC( 0x660e ), SHC( 0x66cf ),
+ SHC( 0x678d ), SHC( 0x6849 ), SHC( 0x6902 ), SHC( 0x69b9 ), SHC( 0x6a6d ), SHC( 0x6b1f ), SHC( 0x6bcd ), SHC( 0x6c79 ),
+ SHC( 0x6d23 ), SHC( 0x6dca ), SHC( 0x6e6e ), SHC( 0x6f0f ), SHC( 0x6fad ), SHC( 0x7049 ), SHC( 0x70e2 ), SHC( 0x7179 ),
+ SHC( 0x720c ), SHC( 0x729d ), SHC( 0x732a ), SHC( 0x73b5 ), SHC( 0x743e ), SHC( 0x74c3 ), SHC( 0x7545 ), SHC( 0x75c5 ),
+ SHC( 0x7641 ), SHC( 0x76bb ), SHC( 0x7732 ), SHC( 0x77a5 ), SHC( 0x7816 ), SHC( 0x7884 ), SHC( 0x78ef ), SHC( 0x7957 ),
+ SHC( 0x79bc ), SHC( 0x7a1e ), SHC( 0x7a7d ), SHC( 0x7ad8 ), SHC( 0x7b31 ), SHC( 0x7b87 ), SHC( 0x7bda ), SHC( 0x7c29 ),
+ SHC( 0x7c76 ), SHC( 0x7cc0 ), SHC( 0x7d06 ), SHC( 0x7d4a ), SHC( 0x7d8a ), SHC( 0x7dc7 ), SHC( 0x7e01 ), SHC( 0x7e38 ),
+ SHC( 0x7e6c ), SHC( 0x7e9d ), SHC( 0x7eca ), SHC( 0x7ef5 ), SHC( 0x7f1c ), SHC( 0x7f41 ), SHC( 0x7f62 ), SHC( 0x7f80 ),
+ SHC( 0x7f9a ), SHC( 0x7fb2 ), SHC( 0x7fc7 ), SHC( 0x7fd8 ), SHC( 0x7fe6 ), SHC( 0x7ff1 ), SHC( 0x7ff9 ), SHC( 0x7ffe ),
+ SHC( 0x7fff ), SHC( 0x7ffe ), SHC( 0x7ff9 ), SHC( 0x7ff1 ), SHC( 0x7fe6 ), SHC( 0x7fd8 ), SHC( 0x7fc7 ), SHC( 0x7fb2 ),
+ SHC( 0x7f9a ), SHC( 0x7f80 ), SHC( 0x7f62 ), SHC( 0x7f41 ), SHC( 0x7f1c ), SHC( 0x7ef5 ), SHC( 0x7eca ), SHC( 0x7e9d ),
+ SHC( 0x7e6c ), SHC( 0x7e38 ), SHC( 0x7e01 ), SHC( 0x7dc7 ), SHC( 0x7d8a ), SHC( 0x7d4a ), SHC( 0x7d06 ), SHC( 0x7cc0 ),
+ SHC( 0x7c76 ), SHC( 0x7c29 ), SHC( 0x7bda ), SHC( 0x7b87 ), SHC( 0x7b31 ), SHC( 0x7ad8 ), SHC( 0x7a7d ), SHC( 0x7a1e ),
+ SHC( 0x79bc ), SHC( 0x7957 ), SHC( 0x78ef ), SHC( 0x7884 ), SHC( 0x7816 ), SHC( 0x77a5 ), SHC( 0x7732 ), SHC( 0x76bb ),
+ SHC( 0x7641 ), SHC( 0x75c5 ), SHC( 0x7545 ), SHC( 0x74c3 ), SHC( 0x743e ), SHC( 0x73b5 ), SHC( 0x732a ), SHC( 0x729d ),
+ SHC( 0x720c ), SHC( 0x7179 ), SHC( 0x70e2 ), SHC( 0x7049 ), SHC( 0x6fad ), SHC( 0x6f0f ), SHC( 0x6e6e ), SHC( 0x6dca ),
+ SHC( 0x6d23 ), SHC( 0x6c79 ), SHC( 0x6bcd ), SHC( 0x6b1f ), SHC( 0x6a6d ), SHC( 0x69b9 ), SHC( 0x6902 ), SHC( 0x6849 ),
+ SHC( 0x678d ), SHC( 0x66cf ), SHC( 0x660e ), SHC( 0x654b ), SHC( 0x6485 ), SHC( 0x63bc ), SHC( 0x62f2 ), SHC( 0x6224 ),
+ SHC( 0x6154 ), SHC( 0x6082 ), SHC( 0x5fae ), SHC( 0x5ed7 ), SHC( 0x5dfe ), SHC( 0x5d22 ), SHC( 0x5c44 ), SHC( 0x5b64 ),
+ SHC( 0x5a82 ), SHC( 0x599d ), SHC( 0x58b7 ), SHC( 0x57ce ), SHC( 0x56e2 ), SHC( 0x55f5 ), SHC( 0x5506 ), SHC( 0x5414 ),
+ SHC( 0x5321 ), SHC( 0x522b ), SHC( 0x5133 ), SHC( 0x503a ), SHC( 0x4f3e ), SHC( 0x4e40 ), SHC( 0x4d41 ), SHC( 0x4c3f ),
+ SHC( 0x4b3c ), SHC( 0x4a37 ), SHC( 0x4930 ), SHC( 0x4827 ), SHC( 0x471c ), SHC( 0x4610 ), SHC( 0x4502 ), SHC( 0x43f2 ),
+ SHC( 0x42e1 ), SHC( 0x41ce ), SHC( 0x40b9 ), SHC( 0x3fa3 ), SHC( 0x3e8b ), SHC( 0x3d71 ), SHC( 0x3c56 ), SHC( 0x3b3a ),
+ SHC( 0x3a1c ), SHC( 0x38fd ), SHC( 0x37dc ), SHC( 0x36ba ), SHC( 0x3596 ), SHC( 0x3471 ), SHC( 0x334b ), SHC( 0x3224 ),
+ SHC( 0x30fb ), SHC( 0x2fd1 ), SHC( 0x2ea6 ), SHC( 0x2d7a ), SHC( 0x2c4d ), SHC( 0x2b1f ), SHC( 0x29ef ), SHC( 0x28bf ),
+ SHC( 0x278d ), SHC( 0x265b ), SHC( 0x2528 ), SHC( 0x23f3 ), SHC( 0x22be ), SHC( 0x2188 ), SHC( 0x2051 ), SHC( 0x1f19 ),
+ SHC( 0x1de1 ), SHC( 0x1ca8 ), SHC( 0x1b6e ), SHC( 0x1a33 ), SHC( 0x18f8 ), SHC( 0x17bc ), SHC( 0x1680 ), SHC( 0x1543 ),
+ SHC( 0x1406 ), SHC( 0x12c8 ), SHC( 0x1189 ), SHC( 0x104a ), SHC( 0x0f0b ), SHC( 0x0dcb ), SHC( 0x0c8b ), SHC( 0x0b4b ),
+ SHC( 0x0a0a ), SHC( 0x08ca ), SHC( 0x0789 ), SHC( 0x0647 ), SHC( 0x0506 ), SHC( 0x03c4 ), SHC( 0x0283 ), SHC( 0x0141 ),
+ SHC( 0x0000 ),
+};
+
+
+const Word32 bwMode2fs[4] = { 8000, 16000, 32000, 48000 };//Q0
+
+const Word16 cos_pi_by_127[128] = /* Q15 */
+{
+ 32767 ,32756 ,32726 ,32676 ,32606 ,32516 ,
+ 32406 ,32276 ,32127 ,31958 ,31769 ,
+ 31561 ,31333 ,31087 ,30821 ,30537 ,
+ 30233 ,29912 ,29572 ,29213 ,28837 ,
+ 28444 ,28033 ,27605 ,27160 ,26698 ,
+ 26220 ,25726 ,25216 ,24691 ,24150 ,
+ 23595 ,23026 ,22442 ,21844 ,21234 ,
+ 20610 ,19974 ,19325 ,18665 ,17993 ,
+ 17310 ,16616 ,15913 ,15199 ,14477 ,
+ 13745 ,13005 ,12258 ,11502 ,10740 ,
+ 9971 ,9196 ,8415 ,7629 ,6839 ,
+ 6044 ,5245 ,4444 ,3639 ,2833 ,
+ 2025 ,1215 ,405 ,-405 ,-1215 ,
+ -2025 ,-2833 ,-3639 ,-4444 ,-5245 ,
+ -6044 ,-6839 ,-7629 ,-8415 ,-9196 ,
+ -9971 ,-10740 ,-11502 ,-12258 ,-13005 ,
+ -13745 ,-14477 ,-15199 ,-15913 ,-16616 ,
+ -17310 ,-17993 ,-18665 ,-19325 ,-19974 ,
+ -20610 ,-21234 ,-21844 ,-22442 ,-23026 ,
+ -23595 ,-24150 ,-24691 ,-25216 ,-25726 ,
+ -26220 ,-26698 ,-27160 ,-27605 ,-28033 ,
+ -28444 ,-28837 ,-29213 ,-29572 ,-29912 ,
+ -30233 ,-30537 ,-30821 ,-31087 ,-31333 ,
+ -31561 ,-31769 ,-31958 ,-32127 ,-32276 ,
+ -32406 ,-32516 ,-32606 ,-32676 ,-32726 ,
+ -32756 ,-32767
+};
+
+const Word16 cos_pi_by_255[256] = /* Q15 */
+{
+ 32767 ,32764 ,32757 ,32744 ,32727 ,32704 ,
+ 32677 ,32645 ,32607 ,32565 ,32518 ,
+ 32466 ,32409 ,32347 ,32280 ,32209 ,
+ 32132 ,32050 ,31964 ,31873 ,31777 ,
+ 31676 ,31570 ,31460 ,31345 ,31225 ,
+ 31100 ,30970 ,30836 ,30697 ,30554 ,
+ 30406 ,30253 ,30096 ,29934 ,29767 ,
+ 29596 ,29421 ,29241 ,29056 ,28868 ,
+ 28674 ,28477 ,28275 ,28069 ,27859 ,
+ 27644 ,27425 ,27202 ,26975 ,26744 ,
+ 26509 ,26269 ,26026 ,25779 ,25528 ,
+ 25273 ,25014 ,24751 ,24485 ,24215 ,
+ 23941 ,23663 ,23382 ,23098 ,22810 ,
+ 22518 ,22223 ,21925 ,21623 ,21318 ,
+ 21010 ,20699 ,20384 ,20067 ,19746 ,
+ 19422 ,19096 ,18766 ,18434 ,18099 ,
+ 17761 ,17420 ,17077 ,16731 ,16383 ,
+ 16032 ,15679 ,15323 ,14965 ,14605 ,
+ 14243 ,13878 ,13511 ,13142 ,12772 ,
+ 12399 ,12024 ,11648 ,11270 ,10890 ,
+ 10508 ,10125 ,9740 ,9354 ,8967 ,
+ 8578 ,8187 ,7796 ,7403 ,7009 ,
+ 6615 ,6219 ,5822 ,5424 ,5026 ,
+ 4626 ,4226 ,3826 ,3425 ,3023 ,
+ 2621 ,2218 ,1815 ,1412 ,1009 ,
+ 605 ,201 ,-201 ,-605 ,-1009 ,
+ -1412 ,-1815 ,-2218 ,-2621 ,-3023 ,
+ -3425 ,-3826 ,-4226 ,-4626 ,-5026 ,
+ -5424 ,-5822 ,-6219 ,-6615 ,-7009 ,
+ -7403 ,-7796 ,-8187 ,-8578 ,-8967 ,
+ -9354 ,-9740 ,-10125 ,-10508 ,-10890 ,
+ -11270 ,-11648 ,-12024 ,-12399 ,-12772 ,
+ -13142 ,-13511 ,-13878 ,-14243 ,-14605 ,
+ -14965 ,-15323 ,-15679 ,-16032 ,-16383 ,
+ -16731 ,-17077 ,-17420 ,-17761 ,-18099 ,
+ -18434 ,-18766 ,-19096 ,-19422 ,-19746 ,
+ -20067 ,-20384 ,-20699 ,-21010 ,-21318 ,
+ -21623 ,-21925 ,-22223 ,-22518 ,-22810 ,
+ -23098 ,-23382 ,-23663 ,-23941 ,-24215 ,
+ -24485 ,-24751 ,-25014 ,-25273 ,-25528 ,
+ -25779 ,-26026 ,-26269 ,-26509 ,-26744 ,
+ -26975 ,-27202 ,-27425 ,-27644 ,-27859 ,
+ -28069 ,-28275 ,-28477 ,-28674 ,-28868 ,
+ -29056 ,-29241 ,-29421 ,-29596 ,-29767 ,
+ -29934 ,-30096 ,-30253 ,-30406 ,-30554 ,
+ -30697 ,-30836 ,-30970 ,-31100 ,-31225 ,
+ -31345 ,-31460 ,-31570 ,-31676 ,-31777 ,
+ -31873 ,-31964 ,-32050 ,-32132 ,-32209 ,
+ -32280 ,-32347 ,-32409 ,-32466 ,-32518 ,
+ -32565 ,-32607 ,-32645 ,-32677 ,-32704 ,
+ -32727 ,-32744 ,-32757 ,-32764 ,-32767
+};
+
+const Word16 cos_pi_by_383[384] = /* Q15 */
+{
+ 32767 ,32765 ,32762 ,32757 ,32749 ,32739 ,
+ 32727 ,32713 ,32696 ,32677 ,32656 ,
+ 32633 ,32608 ,32580 ,32551 ,32519 ,
+ 32485 ,32448 ,32410 ,32369 ,32327 ,
+ 32282 ,32234 ,32185 ,32134 ,32080 ,
+ 32024 ,31966 ,31906 ,31844 ,31779 ,
+ 31713 ,31644 ,31573 ,31500 ,31425 ,
+ 31348 ,31269 ,31188 ,31104 ,31019 ,
+ 30931 ,30841 ,30749 ,30655 ,30560 ,
+ 30462 ,30361 ,30259 ,30155 ,30049 ,
+ 29941 ,29831 ,29719 ,29604 ,29488 ,
+ 29370 ,29250 ,29128 ,29004 ,28878 ,
+ 28750 ,28620 ,28488 ,28354 ,28218 ,
+ 28081 ,27941 ,27800 ,27657 ,27512 ,
+ 27365 ,27216 ,27066 ,26913 ,26759 ,
+ 26603 ,26445 ,26286 ,26124 ,25961 ,
+ 25796 ,25630 ,25461 ,25291 ,25120 ,
+ 24946 ,24771 ,24594 ,24416 ,24236 ,
+ 24054 ,23871 ,23686 ,23499 ,23311 ,
+ 23122 ,22930 ,22738 ,22543 ,22348 ,
+ 22150 ,21952 ,21751 ,21550 ,21346 ,
+ 21142 ,20936 ,20728 ,20519 ,20309 ,
+ 20097 ,19885 ,19670 ,19455 ,19238 ,
+ 19019 ,18800 ,18579 ,18357 ,18134 ,
+ 17910 ,17684 ,17457 ,17229 ,17000 ,
+ 16769 ,16538 ,16305 ,16072 ,15837 ,
+ 15601 ,15364 ,15126 ,14887 ,14647 ,
+ 14407 ,14165 ,13922 ,13678 ,13433 ,
+ 13188 ,12941 ,12694 ,12446 ,12197 ,
+ 11947 ,11696 ,11445 ,11192 ,10939 ,
+ 10686 ,10431 ,10176 ,9920 ,9664 ,
+ 9407 ,9149 ,8891 ,8632 ,8372 ,
+ 8112 ,7851 ,7590 ,7328 ,7066 ,
+ 6803 ,6540 ,6277 ,6013 ,5748 ,
+ 5483 ,5218 ,4953 ,4687 ,4421 ,
+ 4154 ,3888 ,3621 ,3353 ,3086 ,
+ 2818 ,2550 ,2282 ,2014 ,1746 ,
+ 1477 ,1209 ,940 ,671 ,403 ,
+ 134 ,-134 ,-403 ,-671 ,-940 ,
+ -1209 ,-1477 ,-1746 ,-2014 ,-2282 ,
+ -2550 ,-2818 ,-3086 ,-3353 ,-3621 ,
+ -3888 ,-4154 ,-4421 ,-4687 ,-4953 ,
+ -5218 ,-5483 ,-5748 ,-6013 ,-6277 ,
+ -6540 ,-6803 ,-7066 ,-7328 ,-7590 ,
+ -7851 ,-8112 ,-8372 ,-8632 ,-8891 ,
+ -9149 ,-9407 ,-9664 ,-9920 ,-10176 ,
+ -10431 ,-10686 ,-10939 ,-11192 ,-11445 ,
+ -11696 ,-11947 ,-12197 ,-12446 ,-12694 ,
+ -12941 ,-13188 ,-13433 ,-13678 ,-13922 ,
+ -14165 ,-14407 ,-14647 ,-14887 ,-15126 ,
+ -15364 ,-15601 ,-15837 ,-16072 ,-16305 ,
+ -16538 ,-16769 ,-17000 ,-17229 ,-17457 ,
+ -17684 ,-17910 ,-18134 ,-18357 ,-18579 ,
+ -18800 ,-19019 ,-19238 ,-19455 ,-19670 ,
+ -19885 ,-20097 ,-20309 ,-20519 ,-20728 ,
+ -20936 ,-21142 ,-21346 ,-21550 ,-21751 ,
+ -21952 ,-22150 ,-22348 ,-22543 ,-22738 ,
+ -22930 ,-23122 ,-23311 ,-23499 ,-23686 ,
+ -23871 ,-24054 ,-24236 ,-24416 ,-24594 ,
+ -24771 ,-24946 ,-25120 ,-25291 ,-25461 ,
+ -25630 ,-25796 ,-25961 ,-26124 ,-26286 ,
+ -26445 ,-26603 ,-26759 ,-26913 ,-27066 ,
+ -27216 ,-27365 ,-27512 ,-27657 ,-27800 ,
+ -27941 ,-28081 ,-28218 ,-28354 ,-28488 ,
+ -28620 ,-28750 ,-28878 ,-29004 ,-29128 ,
+ -29250 ,-29370 ,-29488 ,-29604 ,-29719 ,
+ -29831 ,-29941 ,-30049 ,-30155 ,-30259 ,
+ -30361 ,-30462 ,-30560 ,-30655 ,-30749 ,
+ -30841 ,-30931 ,-31019 ,-31104 ,-31188 ,
+ -31269 ,-31348 ,-31425 ,-31500 ,-31573 ,
+ -31644 ,-31713 ,-31779 ,-31844 ,-31906 ,
+ -31966 ,-32024 ,-32080 ,-32134 ,-32185 ,
+ -32234 ,-32282 ,-32327 ,-32369 ,-32410 ,
+ -32448 ,-32485 ,-32519 ,-32551 ,-32580 ,
+ -32608 ,-32633 ,-32656 ,-32677 ,-32696 ,
+ -32713 ,-32727 ,-32739 ,-32749 ,-32757 ,
+ -32762 ,-32765 ,-32767
+};
+
+const Word16 swb_lsp_prev_interp_init[10] = { 32767, 31164, 26510, 19261, 10126, 0, -10126, -19261, -26510, -31164 };//Q15
+/* st->swb_lsp_prev_interp[i] = (float)cos( (float)i * PI / (float)10.0f )*/
+
+//ivas_sns_com_fx.c
+/*
+ powf( 10.0f, (float) i * (float) tilt / ( (float) FDNS_NPTS - 1.0f ) / 10.0f ) where 0 =< i < FDNS_NPTS;
+ tilt = 19.f for L_FRAME16k,
+ 22.f for L_FRAME25_6k,
+ 23.5f for L_FRAME32k;
+*/
+
+/* Q23 */
+const Word32 pow_tilt_16k[64] = {
+ 8388608, 8991841, 9638454, 10331564, 11074518, 11870897, 12724546, 13639580,
+ 14620416, 15671785, 16798759, 18006775, 19301660, 20689662, 22177476, 23772281,
+ 25481769, 27314189, 29278380, 31383818, 33640660, 36059793, 38652889, 41432458,
+ 44411907, 47605612, 51028980, 54698525, 58631951, 62848233, 67367713, 72212193,
+ 77405045, 82971319, 88937870, 95333482, 102189009, 109537523, 117414477, 125857870,
+ 134908436, 144609837, 155008876, 166155720, 178104145, 190911793, 204640453, 219356353,
+ 235130489, 252038960, 270163335, 289591052, 310415836, 332738151, 356665686, 382313874,
+ 409806450, 439276044, 470864826, 504725189, 541020486, 579925813, 621628862, 666330818
+};
+
+/* Q23 */
+const Word32 pow_tilt_25_6k[64] = {
+ 8388608, 9090977, 9852154, 10677063, 11571041, 12539871, 13589820, 14727680,
+ 15960812, 17297192, 18745466, 20315003, 22015955, 23859325, 25857039, 28022019,
+ 30368270, 32910971, 35666569, 38652889, 41889251, 45396590, 49197594, 53316853,
+ 57781011, 62618949, 67861961, 73543965, 79701717, 86375050, 93607134, 101444752,
+ 109938604, 119143637, 129119397, 139930415, 151646628, 164343826, 178104145, 193016600,
+ 209177658, 226691863, 245672512, 266242389, 288534558, 312693225, 338874669, 367248256,
+ 397997530, 431321405, 467435450, 506573283, 548988082, 594954222, 644769055, 698754827,
+ 757260765, 820665338, 889378703, 963845359, 1044547023, 1132005744, 1226787283, 1329504771
+};
+
+/* Q23 */
+const Word32 pow_tilt_32k[64] = {
+ 8388608, 9140953, 9960774, 10854121, 11827590, 12888365, 14044278, 15303861,
+ 16676411, 18172061, 19801850, 21577810, 23513049, 25621853, 27919788, 30423818,
+ 33152425, 36125751, 39365745, 42896322, 46743545, 50935812, 55504069, 60482037,
+ 65906462, 71817384, 78258437, 85277166, 92925380, 101259536, 110341153, 120237270,
+ 131020935, 142771749, 155576454, 169529568, 184734089, 201302251, 219356353, 239029666,
+ 260467410, 283827832, 309283369, 337021925, 367248256, 400185482, 436076734, 475186948,
+ 517804822, 564244946, 614850125, 669993906, 730083343, 795561993, 866913198, 944663645,
+ 1029387260, 1121709444, 1222311686, 1331936594, 1451393382, 1581563835, 1723408827, 1877975405
+};
+
+const Word16 L_frame_inv[8] = { 0x4000, 0x369D, 0x3333, 0x2D83, 0x2AAB, 0x28F6, 0, 0x2222 }; // Q14
+
+const Word16 InvIntTable[65] = // Q15
+{
+ 0x7FFF,
+ 0x7FFF, 0x4000, 0x2AAB, 0x2000, 0x199A, 0x1555, 0x1249, 0x1000,
+ 0x0E39, 0x0CCD, 0x0BA3, 0x0AAB, 0x09D9, 0x0925, 0x0889, 0x0800,
+ 0x0788, 0x071C, 0x06BD, 0x0666, 0x0618, 0x05D1, 0x0591, 0x0555,
+ 0x051F, 0x04EC, 0x04BE, 0x0492, 0x046A, 0x0444, 0x0421, 0x0400,
+ 0x03E1, 0x03C4, 0x03A8, 0x038E, 0x0376, 0x035E, 0x0348, 0x0333,
+ 0x031F, 0x030C, 0x02FA, 0x02E9, 0x02D8, 0x02C8, 0x02B9, 0x02AB,
+ 0x029D, 0x028F, 0x0283, 0x0276, 0x026A, 0x025F, 0x0254, 0x0249,
+ 0x023F, 0x0235, 0x022B, 0x0222, 0x0219, 0x0211, 0x0208, 0x0200
+};
+
+const Word16 TecLowBandTable[] = { 0, 2, 4, 6 }; //Q0
+const Word16 TecSC_Fx[] =
+{
+ 23999/*0.3662f*2.0f Q15*/, 7065/*0.1078f*2.0f Q15*/, 7825/*0.1194f*2.0f Q15*/,
+ 8448/*0.1289f*2.0f Q15*/, 8946/*0.1365f*2.0f Q15*/, 9254/*0.1412f*2.0f Q15*/
+};
-#define SHC( x ) ( (Word16) x )
+/* clang-format on */
+const Word16 sqrt_table_pitch_search[256 + 1] = /* Q11 */
+ {
+ 0, 2048, 2896, 3547, 4096, 4579, 5017, 5418,
+ 5793, 6144, 6476, 6792, 7094, 7384, 7663, 7932,
+ 8192, 8444, 8689, 8927, 9159, 9385, 9606, 9822,
+ 10033, 10240, 10443, 10642, 10837, 11029, 11217, 11403,
+ 11585, 11765, 11942, 12116, 12288, 12457, 12625, 12790,
+ 12953, 13114, 13273, 13430, 13585, 13738, 13890, 14040,
+ 14189, 14336, 14482, 14626, 14768, 14910, 15050, 15188,
+ 15326, 15462, 15597, 15731, 15864, 15995, 16126, 16255,
+ 16384, 16512, 16638, 16764, 16888, 17012, 17135, 17257,
+ 17378, 17498, 17618, 17736, 17854, 17971, 18087, 18203,
+ 18318, 18432, 18545, 18658, 18770, 18882, 18992, 19102,
+ 19212, 19321, 19429, 19537, 19644, 19750, 19856, 19961,
+ 20066, 20170, 20274, 20377, 20480, 20582, 20684, 20785,
+ 20886, 20986, 21085, 21185, 21283, 21382, 21480, 21577,
+ 21674, 21771, 21867, 21962, 22058, 22153, 22247, 22341,
+ 22435, 22528, 22621, 22713, 22806, 22897, 22989, 23080,
+ 23170, 23261, 23351, 23440, 23530, 23619, 23707, 23796,
+ 23884, 23971, 24059, 24146, 24232, 24319, 24405, 24491,
+ 24576, 24661, 24746, 24831, 24915, 24999, 25083, 25166,
+ 25249, 25332, 25415, 25497, 25580, 25661, 25743, 25824,
+ 25905, 25986, 26067, 26147, 26227, 26307, 26387, 26466,
+ 26545, 26624, 26703, 26781, 26859, 26937, 27015, 27092,
+ 27170, 27247, 27324, 27400, 27477, 27553, 27629, 27705,
+ 27780, 27856, 27931, 28006, 28081, 28155, 28230, 28304,
+ 28378, 28452, 28525, 28599, 28672, 28745, 28818, 28891,
+ 28963, 29035, 29108, 29180, 29251, 29323, 29394, 29466,
+ 29537, 29608, 29678, 29749, 29819, 29890, 29960, 30030,
+ 30099, 30169, 30238, 30308, 30377, 30446, 30515, 30583,
+ 30652, 30720, 30788, 30856, 30924, 30992, 31059, 31127,
+ 31194, 31261, 31328, 31395, 31462, 31529, 31595, 31661,
+ 31727, 31794, 31859, 31925, 31991, 32056, 32122, 32187,
+ 32252, 32317, 32382, 32446, 32511, 32575, 32640, 32704,
+ 32766
+ };
+
+// fft_evs.c
+const Word16 RotVector_32[2 * 20] = { // Q15
+ /**
+ * \brief Twiddle factors are unscaled
+ */
+ SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5a82 ), SHC( 0xa57e ),
+ SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x7642 ), SHC( 0xcf04 ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xa57e ), SHC( 0xa57e ),
+ SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0xe707 ), SHC( 0x8276 ),
+ SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x89be ), SHC( 0x30fc ), SHC( 0xb8e3 ), SHC( 0x6a6e )
+};
+
+/**
+ * \brief Twiddle factors are unscaled
+ */
+const Word16 RotVector_480[2 * ( 480 - 30 )] = { // Q15
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff5 ), SHC( 0xfca6 ),
+ SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7ee8 ), SHC( 0xef4b ),
+ SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7ddb ), SHC( 0xe8ad ), SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7c77 ), SHC( 0xe21e ),
+ SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7abb ), SHC( 0xdba5 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x78a8 ), SHC( 0xd546 ),
+ SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x7388 ), SHC( 0xc8e5 ),
+ SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x707d ), SHC( 0xc2ec ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6d23 ), SHC( 0xbd1f ),
+ SHC( 0x6b5a ), SHC( 0xba49 ), SHC( 0x697d ), SHC( 0xb780 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x658d ), SHC( 0xb214 ),
+ SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5cd9 ), SHC( 0xa7e4 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7e6d ), SHC( 0xebfa ),
+ SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7780 ), SHC( 0xd221 ),
+ SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6b5a ), SHC( 0xba49 ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5a82 ), SHC( 0xa57e ),
+ SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x508e ), SHC( 0x9c86 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x45b7 ), SHC( 0x94a6 ),
+ SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x2ddf ), SHC( 0x8880 ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x1406 ), SHC( 0x8193 ),
+ SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x06b3 ), SHC( 0x802d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f9b ), SHC( 0xf5f5 ),
+ SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7642 ), SHC( 0xcf04 ),
+ SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6155 ), SHC( 0xacdf ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x42e1 ), SHC( 0x92dd ),
+ SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1de2 ), SHC( 0x8389 ),
+ SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0a0b ), SHC( 0x8065 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
+ SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xe21e ), SHC( 0x8389 ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcf04 ), SHC( 0x89be ),
+ SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xacdf ), SHC( 0x9eab ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x79bc ), SHC( 0xd872 ),
+ SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5f1f ), SHC( 0xaa5a ),
+ SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3410 ), SHC( 0x8b11 ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x0000 ), SHC( 0x8000 ),
+ SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xe563 ), SHC( 0x82cc ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcbf0 ), SHC( 0x8b11 ),
+ SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0xa0e1 ), SHC( 0xaa5a ),
+ SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x9126 ), SHC( 0xc000 ), SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x8644 ), SHC( 0xd872 ),
+ SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x80b4 ), SHC( 0xf29f ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ee8 ), SHC( 0xef4b ),
+ SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x658d ), SHC( 0xb214 ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4dec ), SHC( 0x9a73 ), SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x30fc ), SHC( 0x89be ),
+ SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x10b5 ), SHC( 0x8118 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xef4b ), SHC( 0x8118 ),
+ SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb214 ), SHC( 0x9a73 ),
+ SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9a73 ), SHC( 0xb214 ), SHC( 0x9126 ), SHC( 0xc000 ), SHC( 0x89be ), SHC( 0xcf04 ),
+ SHC( 0x845d ), SHC( 0xdedf ), SHC( 0x8118 ), SHC( 0xef4b ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8118 ), SHC( 0x10b5 ),
+ SHC( 0x845d ), SHC( 0x2121 ), SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9126 ), SHC( 0x4000 ), SHC( 0x9a73 ), SHC( 0x4dec ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ),
+ SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ),
+ SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x8df3 ), SHC( 0x3a1c ),
+ SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xa57e ), SHC( 0x5a82 ), SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xc5e4 ), SHC( 0x720d ),
+ SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xebfa ), SHC( 0x7e6d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ddb ), SHC( 0xe8ad ),
+ SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x4dec ), SHC( 0x9a73 ),
+ SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x245b ), SHC( 0x8545 ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
+ SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xc8e5 ), SHC( 0x8c78 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa327 ), SHC( 0xa7e4 ),
+ SHC( 0x94a6 ), SHC( 0xba49 ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x800b ), SHC( 0xfca6 ),
+ SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x8758 ), SHC( 0x2aba ), SHC( 0x9126 ), SHC( 0x4000 ), SHC( 0x9eab ), SHC( 0x5321 ),
+ SHC( 0xaf72 ), SHC( 0x637a ), SHC( 0xc2ec ), SHC( 0x707d ), SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xef4b ), SHC( 0x7ee8 ),
+ SHC( 0x06b3 ), SHC( 0x7fd3 ), SHC( 0x1de2 ), SHC( 0x7c77 ), SHC( 0x3410 ), SHC( 0x74ef ), SHC( 0x4880 ), SHC( 0x697d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffd ), SHC( 0xfe53 ), SHC( 0x7ff5 ), SHC( 0xfca6 ), SHC( 0x7fe7 ), SHC( 0xfafa ),
+ SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7fba ), SHC( 0xf7a1 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f77 ), SHC( 0xf44a ),
+ SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7ee8 ), SHC( 0xef4b ), SHC( 0x7ead ), SHC( 0xeda2 ),
+ SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7e27 ), SHC( 0xea53 ), SHC( 0x7ddb ), SHC( 0xe8ad ), SHC( 0x7d8a ), SHC( 0xe707 ),
+ SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7cd8 ), SHC( 0xe3c0 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7c10 ), SHC( 0xe07e ),
+ SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7abb ), SHC( 0xdba5 ), SHC( 0x7a3e ), SHC( 0xda0b ),
+ SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7935 ), SHC( 0xd6db ), SHC( 0x78a8 ), SHC( 0xd546 ), SHC( 0x7817 ), SHC( 0xd3b2 ),
+ SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x76e3 ), SHC( 0xd092 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fe7 ), SHC( 0xfafa ),
+ SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7d8a ), SHC( 0xe707 ),
+ SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7817 ), SHC( 0xd3b2 ),
+ SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x743e ), SHC( 0xca69 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6fae ), SHC( 0xc175 ),
+ SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6485 ), SHC( 0xb0c2 ),
+ SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5dfe ), SHC( 0xa91d ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x56e3 ), SHC( 0xa202 ),
+ SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x4f3e ), SHC( 0x9b7b ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x471d ), SHC( 0x9592 ),
+ SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x3597 ), SHC( 0x8bc2 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fba ), SHC( 0xf7a1 ), SHC( 0x7ee8 ), SHC( 0xef4b ), SHC( 0x7d8a ), SHC( 0xe707 ),
+ SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7935 ), SHC( 0xd6db ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x72cd ), SHC( 0xc763 ),
+ SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x658d ), SHC( 0xb214 ), SHC( 0x603c ), SHC( 0xab9b ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5465 ), SHC( 0x9fc4 ), SHC( 0x4dec ), SHC( 0x9a73 ), SHC( 0x471d ), SHC( 0x9592 ),
+ SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x389d ), SHC( 0x8d33 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2925 ), SHC( 0x86cb ),
+ SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x10b5 ), SHC( 0x8118 ), SHC( 0x085f ), SHC( 0x8046 ),
+ SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf7a1 ), SHC( 0x8046 ), SHC( 0xef4b ), SHC( 0x8118 ), SHC( 0xe707 ), SHC( 0x8276 ),
+ SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xd6db ), SHC( 0x86cb ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f77 ), SHC( 0xf44a ),
+ SHC( 0x7ddb ), SHC( 0xe8ad ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7780 ), SHC( 0xd221 ), SHC( 0x72cd ), SHC( 0xc763 ),
+ SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x668f ), SHC( 0xb36a ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x56e3 ), SHC( 0xa202 ),
+ SHC( 0x4dec ), SHC( 0x9a73 ), SHC( 0x444d ), SHC( 0x93bf ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x2f6e ), SHC( 0x891d ),
+ SHC( 0x245b ), SHC( 0x8545 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x01ad ), SHC( 0x8003 ),
+ SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xea53 ), SHC( 0x81d9 ), SHC( 0xdedf ), SHC( 0x845d ), SHC( 0xd3b2 ), SHC( 0x87e9 ),
+ SHC( 0xc8e5 ), SHC( 0x8c78 ), SHC( 0xbe8e ), SHC( 0x91ff ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xab9b ), SHC( 0x9fc4 ),
+ SHC( 0xa327 ), SHC( 0xa7e4 ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x94a6 ), SHC( 0xba49 ), SHC( 0x8eb9 ), SHC( 0xc467 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7817 ), SHC( 0xd3b2 ),
+ SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x56e3 ), SHC( 0xa202 ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x22bf ), SHC( 0x84ce ),
+ SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xe707 ), SHC( 0x8276 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xca69 ), SHC( 0x8bc2 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xb0c2 ), SHC( 0x9b7b ),
+ SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x92dd ), SHC( 0xbd1f ), SHC( 0x8bc2 ), SHC( 0xca69 ),
+ SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8019 ), SHC( 0x0506 ),
+ SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x84ce ), SHC( 0x22bf ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ead ), SHC( 0xeda2 ),
+ SHC( 0x7abb ), SHC( 0xdba5 ), SHC( 0x743e ), SHC( 0xca69 ), SHC( 0x6b5a ), SHC( 0xba49 ), SHC( 0x603c ), SHC( 0xab9b ),
+ SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x444d ), SHC( 0x93bf ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x22bf ), SHC( 0x84ce ),
+ SHC( 0x10b5 ), SHC( 0x8118 ), SHC( 0xfe53 ), SHC( 0x8003 ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xda0b ), SHC( 0x85c2 ),
+ SHC( 0xc8e5 ), SHC( 0x8c78 ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0x9d97 ), SHC( 0xae27 ),
+ SHC( 0x92dd ), SHC( 0xbd1f ), SHC( 0x8a65 ), SHC( 0xcd79 ), SHC( 0x845d ), SHC( 0xdedf ), SHC( 0x80e3 ), SHC( 0xf0f5 ),
+ SHC( 0x800b ), SHC( 0x035a ), SHC( 0x81d9 ), SHC( 0x15ad ), SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x8d33 ), SHC( 0x389d ),
+ SHC( 0x9683 ), SHC( 0x4880 ), SHC( 0xa202 ), SHC( 0x56e3 ), SHC( 0xaf72 ), SHC( 0x637a ), SHC( 0xbe8e ), SHC( 0x6e01 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e27 ), SHC( 0xea53 ), SHC( 0x78a8 ), SHC( 0xd546 ), SHC( 0x6fae ), SHC( 0xc175 ),
+ SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x5465 ), SHC( 0x9fc4 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x2f6e ), SHC( 0x891d ),
+ SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xef4b ), SHC( 0x8118 ), SHC( 0xda0b ), SHC( 0x85c2 ),
+ SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb36a ), SHC( 0x9971 ), SHC( 0xa327 ), SHC( 0xa7e4 ), SHC( 0x9592 ), SHC( 0xb8e3 ),
+ SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x83f0 ), SHC( 0xe07e ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8089 ), SHC( 0x0bb6 ),
+ SHC( 0x845d ), SHC( 0x2121 ), SHC( 0x8bc2 ), SHC( 0x3597 ), SHC( 0x9683 ), SHC( 0x4880 ), SHC( 0xa450 ), SHC( 0x5951 ),
+ SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xc763 ), SHC( 0x72cd ), SHC( 0xdba5 ), SHC( 0x7abb ), SHC( 0xf0f5 ), SHC( 0x7f1d ),
+ SHC( 0x06b3 ), SHC( 0x7fd3 ), SHC( 0x1c40 ), SHC( 0x7cd8 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d8a ), SHC( 0xe707 ),
+ SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x471d ), SHC( 0x9592 ),
+ SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xe707 ), SHC( 0x8276 ),
+ SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9592 ), SHC( 0xb8e3 ),
+ SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8276 ), SHC( 0x18f9 ),
+ SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9592 ), SHC( 0x471d ), SHC( 0xa57e ), SHC( 0x5a82 ), SHC( 0xb8e3 ), SHC( 0x6a6e ),
+ SHC( 0xcf04 ), SHC( 0x7642 ), SHC( 0xe707 ), SHC( 0x7d8a ), SHC( 0x0000 ), SHC( 0x7fff ), SHC( 0x18f9 ), SHC( 0x7d8a ),
+ SHC( 0x30fc ), SHC( 0x7642 ), SHC( 0x471d ), SHC( 0x6a6e ), SHC( 0x5a82 ), SHC( 0x5a82 ), SHC( 0x6a6e ), SHC( 0x471d )
+};
+
+const Word16 RotVector_600[2 * ( 600 - 30 )] = { // Q15
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff9 ), SHC( 0xfd52 ),
+ SHC( 0x7fe3 ), SHC( 0xfaa4 ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7f4c ), SHC( 0xf29f ),
+ SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7ea0 ), SHC( 0xed4d ), SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7dbc ), SHC( 0xe804 ),
+ SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7c9e ), SHC( 0xe2c5 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7b49 ), SHC( 0xdd94 ),
+ SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x77f9 ), SHC( 0xd362 ),
+ SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x7600 ), SHC( 0xce66 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x73d1 ), SHC( 0xc980 ),
+ SHC( 0x72a7 ), SHC( 0xc716 ), SHC( 0x716f ), SHC( 0xc4b3 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6eda ), SHC( 0xc000 ),
+ SHC( 0x6d7d ), SHC( 0xbdb1 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x691b ), SHC( 0xb6f3 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fe3 ), SHC( 0xfaa4 ), SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7efe ), SHC( 0xeff5 ),
+ SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7a89 ), SHC( 0xdb01 ),
+ SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x72a7 ), SHC( 0xc716 ),
+ SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6d7d ), SHC( 0xbdb1 ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x678e ), SHC( 0xb4c3 ),
+ SHC( 0x6450 ), SHC( 0xb07e ), SHC( 0x60e5 ), SHC( 0xac5d ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x598f ), SHC( 0xa48c ),
+ SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4d64 ), SHC( 0x9a0b ), SHC( 0x490d ), SHC( 0x96e5 ),
+ SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3b4d ), SHC( 0x8e91 ), SHC( 0x3680 ), SHC( 0x8c2f ),
+ SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x2c9e ), SHC( 0x8807 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fbf ), SHC( 0xf7f6 ),
+ SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x79bc ), SHC( 0xd872 ),
+ SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6c13 ), SHC( 0xbb6a ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x579f ), SHC( 0xa2b1 ),
+ SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3daa ), SHC( 0x8fd5 ),
+ SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2f1f ), SHC( 0x88fd ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1fd5 ), SHC( 0x8405 ),
+ SHC( 0x17fc ), SHC( 0x8244 ), SHC( 0x100b ), SHC( 0x8102 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0x0000 ), SHC( 0x8000 ),
+ SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xe02b ), SHC( 0x8405 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7bfb ), SHC( 0xe02b ),
+ SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6a9d ), SHC( 0xb92a ),
+ SHC( 0x6450 ), SHC( 0xb07e ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4d64 ), SHC( 0x9a0b ),
+ SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3b4d ), SHC( 0x8e91 ), SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x278e ), SHC( 0x8644 ),
+ SHC( 0x1d3b ), SHC( 0x8362 ), SHC( 0x12b3 ), SHC( 0x8160 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xfd52 ), SHC( 0x8007 ),
+ SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xdd94 ), SHC( 0x84b7 ), SHC( 0xd362 ), SHC( 0x8807 ),
+ SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb6f3 ), SHC( 0x96e5 ), SHC( 0xae69 ), SHC( 0x9d60 ),
+ SHC( 0xa671 ), SHC( 0xa48c ), SHC( 0x9f1b ), SHC( 0xac5d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f4c ), SHC( 0xf29f ),
+ SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x6eda ), SHC( 0xc000 ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4b3d ), SHC( 0x9872 ),
+ SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1a9d ), SHC( 0x82cc ),
+ SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xe563 ), SHC( 0x82cc ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcbf0 ), SHC( 0x8b11 ), SHC( 0xc000 ), SHC( 0x9126 ), SHC( 0xb4c3 ), SHC( 0x9872 ),
+ SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0xa0e1 ), SHC( 0xaa5a ), SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x9126 ), SHC( 0xc000 ),
+ SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x80b4 ), SHC( 0xf29f ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7703 ), SHC( 0xd0e1 ),
+ SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5197 ), SHC( 0x9d60 ),
+ SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x17fc ), SHC( 0x8244 ),
+ SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xd872 ), SHC( 0x8644 ),
+ SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa2b1 ), SHC( 0xa861 ),
+ SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x88fd ), SHC( 0xd0e1 ), SHC( 0x8405 ), SHC( 0xe02b ),
+ SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x8405 ), SHC( 0x1fd5 ),
+ SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x8fd5 ), SHC( 0x3daa ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ea0 ), SHC( 0xed4d ),
+ SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x5f1f ), SHC( 0xaa5a ),
+ SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x424f ), SHC( 0x9283 ), SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x1fd5 ), SHC( 0x8405 ),
+ SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0xfaa4 ), SHC( 0x801d ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xd5e8 ), SHC( 0x871f ),
+ SHC( 0xc4b3 ), SHC( 0x8e91 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa671 ), SHC( 0xa48c ), SHC( 0x9a0b ), SHC( 0xb29c ),
+ SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8807 ), SHC( 0xd362 ), SHC( 0x82cc ), SHC( 0xe563 ), SHC( 0x8041 ), SHC( 0xf7f6 ),
+ SHC( 0x8073 ), SHC( 0x0ab6 ), SHC( 0x8362 ), SHC( 0x1d3b ), SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9126 ), SHC( 0x4000 ),
+ SHC( 0x9bb0 ), SHC( 0x4f82 ), SHC( 0xa861 ), SHC( 0x5d4f ), SHC( 0xb6f3 ), SHC( 0x691b ), SHC( 0xc716 ), SHC( 0x72a7 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x78e1 ), SHC( 0xd5e8 ), SHC( 0x702b ), SHC( 0xc256 ),
+ SHC( 0x6450 ), SHC( 0xb07e ), SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x319a ), SHC( 0x8a00 ),
+ SHC( 0x1d3b ), SHC( 0x8362 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xf29f ), SHC( 0x80b4 ), SHC( 0xdd94 ), SHC( 0x84b7 ),
+ SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xb6f3 ), SHC( 0x96e5 ), SHC( 0xa671 ), SHC( 0xa48c ), SHC( 0x9872 ), SHC( 0xb4c3 ),
+ SHC( 0x8d59 ), SHC( 0xc716 ), SHC( 0x8577 ), SHC( 0xdb01 ), SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x801d ), SHC( 0x055c ),
+ SHC( 0x82cc ), SHC( 0x1a9d ), SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9283 ), SHC( 0x424f ), SHC( 0x9f1b ), SHC( 0x53a3 ),
+ SHC( 0xae69 ), SHC( 0x62a0 ), SHC( 0xc000 ), SHC( 0x6eda ), SHC( 0xd362 ), SHC( 0x77f9 ), SHC( 0xe804 ), SHC( 0x7dbc ),
+ SHC( 0xfd52 ), SHC( 0x7ff9 ), SHC( 0x12b3 ), SHC( 0x7ea0 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7dbc ), SHC( 0xe804 ),
+ SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x4b3d ), SHC( 0x9872 ),
+ SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xeff5 ), SHC( 0x8102 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9d60 ), SHC( 0xae69 ),
+ SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8041 ), SHC( 0x080a ),
+ SHC( 0x8405 ), SHC( 0x1fd5 ), SHC( 0x8c2f ), SHC( 0x3680 ), SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xa861 ), SHC( 0x5d4f ),
+ SHC( 0xbb6a ), SHC( 0x6c13 ), SHC( 0xd0e1 ), SHC( 0x7703 ), SHC( 0xe804 ), SHC( 0x7dbc ), SHC( 0x0000 ), SHC( 0x7fff ),
+ SHC( 0x17fc ), SHC( 0x7dbc ), SHC( 0x2f1f ), SHC( 0x7703 ), SHC( 0x4496 ), SHC( 0x6c13 ), SHC( 0x579f ), SHC( 0x5d4f ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffe ), SHC( 0xfea9 ), SHC( 0x7ff9 ), SHC( 0xfd52 ), SHC( 0x7ff0 ), SHC( 0xfbfb ),
+ SHC( 0x7fe3 ), SHC( 0xfaa4 ), SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7fa8 ), SHC( 0xf6a0 ),
+ SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7f27 ), SHC( 0xf14a ),
+ SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7ed1 ), SHC( 0xeea1 ), SHC( 0x7ea0 ), SHC( 0xed4d ), SHC( 0x7e6d ), SHC( 0xebfa ),
+ SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7dfa ), SHC( 0xe955 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7d7a ), SHC( 0xe6b3 ),
+ SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7c9e ), SHC( 0xe2c5 ), SHC( 0x7c4e ), SHC( 0xe178 ),
+ SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x7b49 ), SHC( 0xdd94 ), SHC( 0x7aeb ), SHC( 0xdc4a ),
+ SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x7a25 ), SHC( 0xd9b9 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff0 ), SHC( 0xfbfb ),
+ SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7e6d ), SHC( 0xebfa ),
+ SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7aeb ), SHC( 0xdc4a ),
+ SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x786f ), SHC( 0xd4a4 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x7579 ), SHC( 0xcd2a ),
+ SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6e2d ), SHC( 0xbed8 ),
+ SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x69de ), SHC( 0xb80e ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6524 ), SHC( 0xb18c ),
+ SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x6004 ), SHC( 0xab5a ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5a82 ), SHC( 0xa57e ),
+ SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4e74 ), SHC( 0x9adc ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7e6d ), SHC( 0xebfa ),
+ SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7ba3 ), SHC( 0xdedf ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7780 ), SHC( 0xd221 ),
+ SHC( 0x74ef ), SHC( 0xcbf0 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6eda ), SHC( 0xc000 ), SHC( 0x6b5a ), SHC( 0xba49 ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5a82 ), SHC( 0xa57e ),
+ SHC( 0x55a6 ), SHC( 0xa0e1 ), SHC( 0x508e ), SHC( 0x9c86 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x45b7 ), SHC( 0x94a6 ),
+ SHC( 0x4000 ), SHC( 0x9126 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x2ddf ), SHC( 0x8880 ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x2121 ), SHC( 0x845d ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x1406 ), SHC( 0x8193 ),
+ SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x06b3 ), SHC( 0x802d ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fa8 ), SHC( 0xf6a0 ),
+ SHC( 0x7ea0 ), SHC( 0xed4d ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7a89 ), SHC( 0xdb01 ), SHC( 0x7780 ), SHC( 0xd221 ),
+ SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6f84 ), SHC( 0xc12a ), SHC( 0x6a9d ), SHC( 0xb92a ), SHC( 0x6524 ), SHC( 0xb18c ),
+ SHC( 0x5f1f ), SHC( 0xaa5a ), SHC( 0x5898 ), SHC( 0xa39d ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4a26 ), SHC( 0x97aa ),
+ SHC( 0x424f ), SHC( 0x9283 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x319a ), SHC( 0x8a00 ), SHC( 0x28d4 ), SHC( 0x86b0 ),
+ SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x16ab ), SHC( 0x8206 ), SHC( 0x0d61 ), SHC( 0x80b4 ), SHC( 0x0405 ), SHC( 0x8010 ),
+ SHC( 0xfaa4 ), SHC( 0x801d ), SHC( 0xf14a ), SHC( 0x80d9 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xdedf ), SHC( 0x845d ),
+ SHC( 0xd5e8 ), SHC( 0x871f ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xc4b3 ), SHC( 0x8e91 ), SHC( 0xbc8d ), SHC( 0x9337 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7aeb ), SHC( 0xdc4a ),
+ SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6524 ), SHC( 0xb18c ),
+ SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4128 ), SHC( 0x91d3 ),
+ SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x1406 ), SHC( 0x8193 ),
+ SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xe414 ), SHC( 0x8315 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xb80e ), SHC( 0x9622 ),
+ SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x9622 ), SHC( 0xb80e ),
+ SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8a87 ), SHC( 0xcd2a ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f27 ), SHC( 0xf14a ),
+ SHC( 0x7c9e ), SHC( 0xe2c5 ), SHC( 0x786f ), SHC( 0xd4a4 ), SHC( 0x72a7 ), SHC( 0xc716 ), SHC( 0x6b5a ), SHC( 0xba49 ),
+ SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x5898 ), SHC( 0xa39d ), SHC( 0x4d64 ), SHC( 0x9a0b ), SHC( 0x4128 ), SHC( 0x91d3 ),
+ SHC( 0x3410 ), SHC( 0x8b11 ), SHC( 0x2647 ), SHC( 0x85db ), SHC( 0x17fc ), SHC( 0x8244 ), SHC( 0x0960 ), SHC( 0x8058 ),
+ SHC( 0xfaa4 ), SHC( 0x801d ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xdd94 ), SHC( 0x84b7 ), SHC( 0xcfa3 ), SHC( 0x897d ),
+ SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xb5da ), SHC( 0x97aa ), SHC( 0xaa5a ), SHC( 0xa0e1 ), SHC( 0x9ffc ), SHC( 0xab5a ),
+ SHC( 0x96e5 ), SHC( 0xb6f3 ), SHC( 0x8f31 ), SHC( 0xc383 ), SHC( 0x88fd ), SHC( 0xd0e1 ), SHC( 0x845d ), SHC( 0xdedf ),
+ SHC( 0x8160 ), SHC( 0xed4d ), SHC( 0x8010 ), SHC( 0xfbfb ), SHC( 0x8073 ), SHC( 0x0ab6 ), SHC( 0x8286 ), SHC( 0x194d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ed1 ), SHC( 0xeea1 ), SHC( 0x7b49 ), SHC( 0xdd94 ), SHC( 0x7579 ), SHC( 0xcd2a ),
+ SHC( 0x6d7d ), SHC( 0xbdb1 ), SHC( 0x637a ), SHC( 0xaf72 ), SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x4a26 ), SHC( 0x97aa ),
+ SHC( 0x3b4d ), SHC( 0x8e91 ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1a9d ), SHC( 0x82cc ), SHC( 0x0960 ), SHC( 0x8058 ),
+ SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xe6b3 ), SHC( 0x8286 ), SHC( 0xd5e8 ), SHC( 0x871f ), SHC( 0xc5e4 ), SHC( 0x8df3 ),
+ SHC( 0xb6f3 ), SHC( 0x96e5 ), SHC( 0xa95c ), SHC( 0xa1c8 ), SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x9337 ), SHC( 0xbc8d ),
+ SHC( 0x8b11 ), SHC( 0xcbf0 ), SHC( 0x8515 ), SHC( 0xdc4a ), SHC( 0x8160 ), SHC( 0xed4d ), SHC( 0x8002 ), SHC( 0xfea9 ),
+ SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x845d ), SHC( 0x2121 ), SHC( 0x8a00 ), SHC( 0x319a ), SHC( 0x91d3 ), SHC( 0x4128 ),
+ SHC( 0x9bb0 ), SHC( 0x4f82 ), SHC( 0xa768 ), SHC( 0x5c63 ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ),
+ SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ),
+ SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ),
+ SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ),
+ SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ), SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8193 ), SHC( 0x1406 ),
+ SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x8df3 ), SHC( 0x3a1c ), SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xa57e ), SHC( 0x5a82 ),
+ SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xc5e4 ), SHC( 0x720d ), SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xebfa ), SHC( 0x7e6d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7dfa ), SHC( 0xe955 ), SHC( 0x77f9 ), SHC( 0xd362 ), SHC( 0x6e2d ), SHC( 0xbed8 ),
+ SHC( 0x60e5 ), SHC( 0xac5d ), SHC( 0x508e ), SHC( 0x9c86 ), SHC( 0x3daa ), SHC( 0x8fd5 ), SHC( 0x28d4 ), SHC( 0x86b0 ),
+ SHC( 0x12b3 ), SHC( 0x8160 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xe563 ), SHC( 0x82cc ), SHC( 0xcfa3 ), SHC( 0x897d ),
+ SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xa95c ), SHC( 0xa1c8 ), SHC( 0x9a0b ), SHC( 0xb29c ), SHC( 0x8df3 ), SHC( 0xc5e4 ),
+ SHC( 0x8577 ), SHC( 0xdb01 ), SHC( 0x80d9 ), SHC( 0xf14a ), SHC( 0x8041 ), SHC( 0x080a ), SHC( 0x83b2 ), SHC( 0x1e88 ),
+ SHC( 0x8b11 ), SHC( 0x3410 ), SHC( 0x9622 ), SHC( 0x47f2 ), SHC( 0xa48c ), SHC( 0x598f ), SHC( 0xb5da ), SHC( 0x6856 ),
+ SHC( 0xc980 ), SHC( 0x73d1 ), SHC( 0xdedf ), SHC( 0x7ba3 ), SHC( 0xf54a ), SHC( 0x7f8d ), SHC( 0x0c0c ), SHC( 0x7f6f ),
+ SHC( 0x226c ), SHC( 0x7b49 ), SHC( 0x37b6 ), SHC( 0x733e ), SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d7a ), SHC( 0xe6b3 ),
+ SHC( 0x7600 ), SHC( 0xce66 ), SHC( 0x69de ), SHC( 0xb80e ), SHC( 0x598f ), SHC( 0xa48c ), SHC( 0x45b7 ), SHC( 0x94a6 ),
+ SHC( 0x2f1f ), SHC( 0x88fd ), SHC( 0x16ab ), SHC( 0x8206 ), SHC( 0xfd52 ), SHC( 0x8007 ), SHC( 0xe414 ), SHC( 0x8315 ),
+ SHC( 0xcbf0 ), SHC( 0x8b11 ), SHC( 0xb5da ), SHC( 0x97aa ), SHC( 0xa2b1 ), SHC( 0xa861 ), SHC( 0x9337 ), SHC( 0xbc8d ),
+ SHC( 0x8807 ), SHC( 0xd362 ), SHC( 0x8193 ), SHC( 0xebfa ), SHC( 0x801d ), SHC( 0x055c ), SHC( 0x83b2 ), SHC( 0x1e88 ),
+ SHC( 0x8c2f ), SHC( 0x3680 ), SHC( 0x993d ), SHC( 0x4c51 ), SHC( 0xaa5a ), SHC( 0x5f1f ), SHC( 0xbed8 ), SHC( 0x6e2d ),
+ SHC( 0xd5e8 ), SHC( 0x78e1 ), SHC( 0xeea1 ), SHC( 0x7ed1 ), SHC( 0x080a ), SHC( 0x7fbf ), SHC( 0x2121 ), SHC( 0x7ba3 ),
+ SHC( 0x38ea ), SHC( 0x72a7 ), SHC( 0x4e74 ), SHC( 0x6524 ), SHC( 0x60e5 ), SHC( 0x53a3 ), SHC( 0x6f84 ), SHC( 0x3ed6 )
+};
+
+
+/**
+ * \brief Twiddle factors are unscaled
+ */
+const Word16 RotVector_256[2 * ( 256 - 32 )] = { // Q15
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff6 ), SHC( 0xfcdc ), SHC( 0x7fd9 ), SHC( 0xf9b8 ), SHC( 0x7fa7 ), SHC( 0xf695 ),
+ SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7f0a ), SHC( 0xf055 ), SHC( 0x7e9d ), SHC( 0xed38 ), SHC( 0x7e1e ), SHC( 0xea1e ),
+ SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7ce4 ), SHC( 0xe3f4 ), SHC( 0x7c2a ), SHC( 0xe0e6 ), SHC( 0x7b5d ), SHC( 0xdddc ),
+ SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x798a ), SHC( 0xd7d9 ), SHC( 0x7885 ), SHC( 0xd4e1 ), SHC( 0x776c ), SHC( 0xd1ef ),
+ SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x7505 ), SHC( 0xcc21 ), SHC( 0x73b6 ), SHC( 0xc946 ), SHC( 0x7255 ), SHC( 0xc673 ),
+ SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6f5f ), SHC( 0xc0e9 ), SHC( 0x6dca ), SHC( 0xbe32 ), SHC( 0x6c24 ), SHC( 0xbb85 ),
+ SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x68a7 ), SHC( 0xb64c ), SHC( 0x66d0 ), SHC( 0xb3c0 ), SHC( 0x64e9 ), SHC( 0xb140 ),
+ SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x60ec ), SHC( 0xac65 ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x5cb4 ), SHC( 0xa7bd ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fd9 ), SHC( 0xf9b8 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7e9d ), SHC( 0xed38 ),
+ SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7c2a ), SHC( 0xe0e6 ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x7885 ), SHC( 0xd4e1 ),
+ SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x73b6 ), SHC( 0xc946 ), SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6dca ), SHC( 0xbe32 ),
+ SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x66d0 ), SHC( 0xb3c0 ), SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x5ed7 ), SHC( 0xaa0a ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x55f6 ), SHC( 0xa129 ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x4c40 ), SHC( 0x9930 ),
+ SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x41ce ), SHC( 0x9236 ), SHC( 0x3c57 ), SHC( 0x8f1d ), SHC( 0x36ba ), SHC( 0x8c4a ),
+ SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2b1f ), SHC( 0x877b ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x1f1a ), SHC( 0x83d6 ),
+ SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x12c8 ), SHC( 0x8163 ), SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0x0648 ), SHC( 0x8027 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fa7 ), SHC( 0xf695 ), SHC( 0x7e9d ), SHC( 0xed38 ), SHC( 0x7ce4 ), SHC( 0xe3f4 ),
+ SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x776c ), SHC( 0xd1ef ), SHC( 0x73b6 ), SHC( 0xc946 ), SHC( 0x6f5f ), SHC( 0xc0e9 ),
+ SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x64e9 ), SHC( 0xb140 ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x5843 ), SHC( 0xa34c ),
+ SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x49b4 ), SHC( 0x9759 ), SHC( 0x41ce ), SHC( 0x9236 ), SHC( 0x398d ), SHC( 0x8dab ),
+ SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2827 ), SHC( 0x8676 ), SHC( 0x1f1a ), SHC( 0x83d6 ), SHC( 0x15e2 ), SHC( 0x81e2 ),
+ SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0x0324 ), SHC( 0x800a ), SHC( 0xf9b8 ), SHC( 0x8027 ), SHC( 0xf055 ), SHC( 0x80f6 ),
+ SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xdddc ), SHC( 0x84a3 ), SHC( 0xd4e1 ), SHC( 0x877b ), SHC( 0xcc21 ), SHC( 0x8afb ),
+ SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xbb85 ), SHC( 0x93dc ), SHC( 0xb3c0 ), SHC( 0x9930 ), SHC( 0xac65 ), SHC( 0x9f14 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7a7d ), SHC( 0xdad8 ),
+ SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x62f2 ), SHC( 0xaecc ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x3c57 ), SHC( 0x8f1d ),
+ SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0c8c ), SHC( 0x809e ),
+ SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf374 ), SHC( 0x809e ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xdad8 ), SHC( 0x8583 ),
+ SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xaecc ), SHC( 0x9d0e ),
+ SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9d0e ), SHC( 0xaecc ), SHC( 0x9592 ), SHC( 0xb8e3 ), SHC( 0x8f1d ), SHC( 0xc3a9 ),
+ SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x8583 ), SHC( 0xdad8 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x809e ), SHC( 0xf374 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f0a ), SHC( 0xf055 ), SHC( 0x7c2a ), SHC( 0xe0e6 ), SHC( 0x776c ), SHC( 0xd1ef ),
+ SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x68a7 ), SHC( 0xb64c ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x539b ), SHC( 0x9f14 ),
+ SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x398d ), SHC( 0x8dab ), SHC( 0x2b1f ), SHC( 0x877b ), SHC( 0x1c0c ), SHC( 0x831c ),
+ SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0xfcdc ), SHC( 0x800a ), SHC( 0xed38 ), SHC( 0x8163 ), SHC( 0xdddc ), SHC( 0x84a3 ),
+ SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xc0e9 ), SHC( 0x90a1 ), SHC( 0xb3c0 ), SHC( 0x9930 ), SHC( 0xa7bd ), SHC( 0xa34c ),
+ SHC( 0x9d0e ), SHC( 0xaecc ), SHC( 0x93dc ), SHC( 0xbb85 ), SHC( 0x8c4a ), SHC( 0xc946 ), SHC( 0x8676 ), SHC( 0xd7d9 ),
+ SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8059 ), SHC( 0xf695 ), SHC( 0x8027 ), SHC( 0x0648 ), SHC( 0x81e2 ), SHC( 0x15e2 ),
+ SHC( 0x8583 ), SHC( 0x2528 ), SHC( 0x8afb ), SHC( 0x33df ), SHC( 0x9236 ), SHC( 0x41ce ), SHC( 0x9b17 ), SHC( 0x4ec0 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e9d ), SHC( 0xed38 ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x73b6 ), SHC( 0xc946 ),
+ SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5ed7 ), SHC( 0xaa0a ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x41ce ), SHC( 0x9236 ),
+ SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x1f1a ), SHC( 0x83d6 ), SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0xf9b8 ), SHC( 0x8027 ),
+ SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xd4e1 ), SHC( 0x877b ), SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xb3c0 ), SHC( 0x9930 ),
+ SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9930 ), SHC( 0xb3c0 ), SHC( 0x8f1d ), SHC( 0xc3a9 ), SHC( 0x877b ), SHC( 0xd4e1 ),
+ SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x8027 ), SHC( 0xf9b8 ), SHC( 0x809e ), SHC( 0x0c8c ), SHC( 0x83d6 ), SHC( 0x1f1a ),
+ SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9236 ), SHC( 0x41ce ), SHC( 0x9d0e ), SHC( 0x5134 ), SHC( 0xaa0a ), SHC( 0x5ed7 ),
+ SHC( 0xb8e3 ), SHC( 0x6a6e ), SHC( 0xc946 ), SHC( 0x73b6 ), SHC( 0xdad8 ), SHC( 0x7a7d ), SHC( 0xed38 ), SHC( 0x7e9d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e1e ), SHC( 0xea1e ), SHC( 0x7885 ), SHC( 0xd4e1 ), SHC( 0x6f5f ), SHC( 0xc0e9 ),
+ SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x539b ), SHC( 0x9f14 ), SHC( 0x41ce ), SHC( 0x9236 ), SHC( 0x2e11 ), SHC( 0x8894 ),
+ SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0324 ), SHC( 0x800a ), SHC( 0xed38 ), SHC( 0x8163 ), SHC( 0xd7d9 ), SHC( 0x8676 ),
+ SHC( 0xc3a9 ), SHC( 0x8f1d ), SHC( 0xb140 ), SHC( 0x9b17 ), SHC( 0xa129 ), SHC( 0xaa0a ), SHC( 0x93dc ), SHC( 0xbb85 ),
+ SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x831c ), SHC( 0xe3f4 ), SHC( 0x8027 ), SHC( 0xf9b8 ), SHC( 0x80f6 ), SHC( 0x0fab ),
+ SHC( 0x8583 ), SHC( 0x2528 ), SHC( 0x8dab ), SHC( 0x398d ), SHC( 0x9930 ), SHC( 0x4c40 ), SHC( 0xa7bd ), SHC( 0x5cb4 ),
+ SHC( 0xb8e3 ), SHC( 0x6a6e ), SHC( 0xcc21 ), SHC( 0x7505 ), SHC( 0xe0e6 ), SHC( 0x7c2a ), SHC( 0xf695 ), SHC( 0x7fa7 ),
+ SHC( 0x0c8c ), SHC( 0x7f62 ), SHC( 0x2224 ), SHC( 0x7b5d ), SHC( 0x36ba ), SHC( 0x73b6 ), SHC( 0x49b4 ), SHC( 0x68a7 )
+};
+
+/**
+ * \brief Twiddle factors are unscaled
+ */
+const Word16 RotVector_320[2 * ( 320 - 20 )] = { // Q15
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fe7 ), SHC( 0xfafa ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f1d ), SHC( 0xf0f5 ),
+ SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7b32 ), SHC( 0xdd41 ),
+ SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x743e ), SHC( 0xca69 ),
+ SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6fae ), SHC( 0xc175 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x6a6e ), SHC( 0xb8e3 ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6485 ), SHC( 0xb0c2 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5dfe ), SHC( 0xa91d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7c77 ), SHC( 0xe21e ),
+ SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6d23 ), SHC( 0xbd1f ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5321 ), SHC( 0x9eab ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x30fc ), SHC( 0x89be ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1de2 ), SHC( 0x8389 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0a0b ), SHC( 0x8065 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7817 ), SHC( 0xd3b2 ),
+ SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x56e3 ), SHC( 0xa202 ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x22bf ), SHC( 0x84ce ),
+ SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xe707 ), SHC( 0x8276 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xca69 ), SHC( 0x8bc2 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xb0c2 ), SHC( 0x9b7b ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ),
+ SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x6a6e ), SHC( 0xb8e3 ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x18f9 ), SHC( 0x8276 ),
+ SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xcf04 ), SHC( 0x89be ), SHC( 0xb8e3 ), SHC( 0x9592 ),
+ SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x9592 ), SHC( 0xb8e3 ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x8276 ), SHC( 0xe707 ),
+ SHC( 0x8000 ), SHC( 0x0000 ), SHC( 0x8276 ), SHC( 0x18f9 ), SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9592 ), SHC( 0x471d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6155 ), SHC( 0xacdf ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x92dd ), SHC( 0xbd1f ),
+ SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x89be ), SHC( 0x30fc ),
+ SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xacdf ), SHC( 0x6155 ), SHC( 0xc5e4 ), SHC( 0x720d ), SHC( 0xe21e ), SHC( 0x7c77 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x56e3 ), SHC( 0xa202 ),
+ SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xd3b2 ), SHC( 0x87e9 ),
+ SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x89be ), SHC( 0xcf04 ), SHC( 0x80e3 ), SHC( 0xf0f5 ),
+ SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x8bc2 ), SHC( 0x3597 ), SHC( 0x9eab ), SHC( 0x5321 ), SHC( 0xb8e3 ), SHC( 0x6a6e ),
+ SHC( 0xd872 ), SHC( 0x79bc ), SHC( 0xfafa ), SHC( 0x7fe7 ), SHC( 0x1de2 ), SHC( 0x7c77 ), SHC( 0x3e8b ), SHC( 0x6fae ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffa ), SHC( 0xfd7d ), SHC( 0x7fe7 ), SHC( 0xfafa ), SHC( 0x7fc7 ), SHC( 0xf877 ),
+ SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7ecb ), SHC( 0xee76 ),
+ SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7e02 ), SHC( 0xe980 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7d07 ), SHC( 0xe492 ),
+ SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7bda ), SHC( 0xdfae ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7a7d ), SHC( 0xdad8 ),
+ SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x78ef ), SHC( 0xd610 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x7732 ), SHC( 0xd159 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fc7 ), SHC( 0xf877 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7e02 ), SHC( 0xe980 ),
+ SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x7546 ), SHC( 0xccb4 ),
+ SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6e6e ), SHC( 0xbf47 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x660f ), SHC( 0xb2bf ),
+ SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5c45 ), SHC( 0xa749 ), SHC( 0x56e3 ), SHC( 0xa202 ), SHC( 0x5134 ), SHC( 0x9d0e ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4502 ), SHC( 0x9432 ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x37dc ), SHC( 0x8cd5 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7a7d ), SHC( 0xdad8 ),
+ SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x70e3 ), SHC( 0xc3a9 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x62f2 ), SHC( 0xaecc ),
+ SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x471d ), SHC( 0x9592 ), SHC( 0x3c57 ), SHC( 0x8f1d ),
+ SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0c8c ), SHC( 0x809e ),
+ SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xf374 ), SHC( 0x809e ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xdad8 ), SHC( 0x8583 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ecb ), SHC( 0xee76 ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x7546 ), SHC( 0xccb4 ),
+ SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x62f2 ), SHC( 0xaecc ), SHC( 0x56e3 ), SHC( 0xa202 ), SHC( 0x4930 ), SHC( 0x96fd ),
+ SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x29f0 ), SHC( 0x8711 ), SHC( 0x18f9 ), SHC( 0x8276 ), SHC( 0x0789 ), SHC( 0x8039 ),
+ SHC( 0xf5f5 ), SHC( 0x8065 ), SHC( 0xe492 ), SHC( 0x82f9 ), SHC( 0xd3b2 ), SHC( 0x87e9 ), SHC( 0xc3a9 ), SHC( 0x8f1d ),
+ SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa749 ), SHC( 0xa3bb ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x9192 ), SHC( 0xbf47 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e02 ), SHC( 0xe980 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x6e6e ), SHC( 0xbf47 ),
+ SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5134 ), SHC( 0x9d0e ), SHC( 0x3e8b ), SHC( 0x9052 ), SHC( 0x29f0 ), SHC( 0x8711 ),
+ SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xfd7d ), SHC( 0x8006 ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xd159 ), SHC( 0x88ce ),
+ SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xaafa ), SHC( 0xa052 ), SHC( 0x9b7b ), SHC( 0xb0c2 ), SHC( 0x8f1d ), SHC( 0xc3a9 ),
+ SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8135 ), SHC( 0xee76 ), SHC( 0x8019 ), SHC( 0x0506 ), SHC( 0x82f9 ), SHC( 0x1b6e ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d07 ), SHC( 0xe492 ), SHC( 0x743e ), SHC( 0xca69 ), SHC( 0x660f ), SHC( 0xb2bf ),
+ SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x3c57 ), SHC( 0x8f1d ), SHC( 0x22bf ), SHC( 0x84ce ), SHC( 0x0789 ), SHC( 0x8039 ),
+ SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xd159 ), SHC( 0x88ce ), SHC( 0xb8e3 ), SHC( 0x9592 ), SHC( 0xa3bb ), SHC( 0xa749 ),
+ SHC( 0x92dd ), SHC( 0xbd1f ), SHC( 0x8711 ), SHC( 0xd610 ), SHC( 0x80e3 ), SHC( 0xf0f5 ), SHC( 0x809e ), SHC( 0x0c8c ),
+ SHC( 0x8644 ), SHC( 0x278e ), SHC( 0x9192 ), SHC( 0x40b9 ), SHC( 0xa202 ), SHC( 0x56e3 ), SHC( 0xb6d0 ), SHC( 0x6903 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7bda ), SHC( 0xdfae ), SHC( 0x6fae ), SHC( 0xc175 ), SHC( 0x5c45 ), SHC( 0xa749 ),
+ SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x2528 ), SHC( 0x8583 ), SHC( 0x0506 ), SHC( 0x8019 ), SHC( 0xe492 ), SHC( 0x82f9 ),
+ SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xaafa ), SHC( 0xa052 ), SHC( 0x9592 ), SHC( 0xb8e3 ), SHC( 0x8711 ), SHC( 0xd610 ),
+ SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x81fe ), SHC( 0x1680 ), SHC( 0x8bc2 ), SHC( 0x3597 ), SHC( 0x9d0e ), SHC( 0x5134 ),
+ SHC( 0xb4c3 ), SHC( 0x678e ), SHC( 0xd159 ), SHC( 0x7732 ), SHC( 0xf0f5 ), SHC( 0x7f1d ), SHC( 0x118a ), SHC( 0x7ecb ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7a7d ), SHC( 0xdad8 ), SHC( 0x6a6e ), SHC( 0xb8e3 ), SHC( 0x5134 ), SHC( 0x9d0e ),
+ SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x0c8c ), SHC( 0x809e ), SHC( 0xe707 ), SHC( 0x8276 ), SHC( 0xc3a9 ), SHC( 0x8f1d ),
+ SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x8f1d ), SHC( 0xc3a9 ), SHC( 0x8276 ), SHC( 0xe707 ), SHC( 0x809e ), SHC( 0x0c8c ),
+ SHC( 0x89be ), SHC( 0x30fc ), SHC( 0x9d0e ), SHC( 0x5134 ), SHC( 0xb8e3 ), SHC( 0x6a6e ), SHC( 0xdad8 ), SHC( 0x7a7d ),
+ SHC( 0x0000 ), SHC( 0x7fff ), SHC( 0x2528 ), SHC( 0x7a7d ), SHC( 0x471d ), SHC( 0x6a6e ), SHC( 0x62f2 ), SHC( 0x5134 )
+};
+
+
+/**
+ * \brief Twiddle factors are unscaled
+ * Rotation factor table, real and imaginary part interleaved, for dim1=20,dim2=20
+ */
+
+const Word16 RotVector_400[2 * ( 400 - 20 )] = { // Q15
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff0 ), SHC( 0xfbfb ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f6f ), SHC( 0xf3f4 ),
+ SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7ceb ), SHC( 0xe414 ),
+ SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x786f ), SHC( 0xd4a4 ),
+ SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x7579 ), SHC( 0xcd2a ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x720d ), SHC( 0xc5e4 ),
+ SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6e2d ), SHC( 0xbed8 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x69de ), SHC( 0xb80e ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7dbc ), SHC( 0xe804 ),
+ SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x73d1 ), SHC( 0xc980 ),
+ SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x62a0 ), SHC( 0xae69 ),
+ SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4b3d ), SHC( 0x9872 ),
+ SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3daa ), SHC( 0x8fd5 ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2f1f ), SHC( 0x88fd ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7aeb ), SHC( 0xdc4a ),
+ SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6524 ), SHC( 0xb18c ),
+ SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x4128 ), SHC( 0x91d3 ),
+ SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x1406 ), SHC( 0x8193 ),
+ SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xe414 ), SHC( 0x8315 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7703 ), SHC( 0xd0e1 ),
+ SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5197 ), SHC( 0x9d60 ),
+ SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x17fc ), SHC( 0x8244 ),
+ SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xd872 ), SHC( 0x8644 ),
+ SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa2b1 ), SHC( 0xa861 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x720d ), SHC( 0xc5e4 ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3a1c ), SHC( 0x8df3 ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0000 ), SHC( 0x8000 ), SHC( 0xebfa ), SHC( 0x8193 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0xa57e ), SHC( 0xa57e ),
+ SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8193 ), SHC( 0xebfa ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x6c13 ), SHC( 0xbb6a ),
+ SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x1fd5 ), SHC( 0x8405 ),
+ SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xc256 ), SHC( 0x8fd5 ),
+ SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8644 ), SHC( 0xd872 ),
+ SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8041 ), SHC( 0x080a ), SHC( 0x8405 ), SHC( 0x1fd5 ), SHC( 0x8c2f ), SHC( 0x3680 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6524 ), SHC( 0xb18c ),
+ SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x0405 ), SHC( 0x8010 ),
+ SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xb4c3 ), SHC( 0x9872 ), SHC( 0x9ffc ), SHC( 0xab5a ),
+ SHC( 0x8fd5 ), SHC( 0xc256 ), SHC( 0x8515 ), SHC( 0xdc4a ), SHC( 0x8041 ), SHC( 0xf7f6 ), SHC( 0x8193 ), SHC( 0x1406 ),
+ SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9622 ), SHC( 0x47f2 ), SHC( 0xa861 ), SHC( 0x5d4f ), SHC( 0xbed8 ), SHC( 0x6e2d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x702b ), SHC( 0xc256 ), SHC( 0x5d4f ), SHC( 0xa861 ),
+ SHC( 0x4496 ), SHC( 0x93ed ), SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x080a ), SHC( 0x8041 ), SHC( 0xe804 ), SHC( 0x8244 ),
+ SHC( 0xc980 ), SHC( 0x8c2f ), SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9872 ), SHC( 0xb4c3 ), SHC( 0x88fd ), SHC( 0xd0e1 ),
+ SHC( 0x8102 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x88fd ), SHC( 0x2f1f ), SHC( 0x9872 ), SHC( 0x4b3d ),
+ SHC( 0xae69 ), SHC( 0x62a0 ), SHC( 0xc980 ), SHC( 0x73d1 ), SHC( 0xe804 ), SHC( 0x7dbc ), SHC( 0x080a ), SHC( 0x7fbf ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x54a6 ), SHC( 0x9ffc ),
+ SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xcd2a ), SHC( 0x8a87 ),
+ SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0x9622 ), SHC( 0xb80e ), SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8010 ), SHC( 0xfbfb ),
+ SHC( 0x8405 ), SHC( 0x1fd5 ), SHC( 0x91d3 ), SHC( 0x4128 ), SHC( 0xa861 ), SHC( 0x5d4f ), SHC( 0xc5e4 ), SHC( 0x720d ),
+ SHC( 0xe804 ), SHC( 0x7dbc ), SHC( 0x0c0c ), SHC( 0x7f6f ), SHC( 0x2f1f ), SHC( 0x7703 ), SHC( 0x4e74 ), SHC( 0x6524 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffc ), SHC( 0xfdfd ), SHC( 0x7ff0 ), SHC( 0xfbfb ), SHC( 0x7fdc ), SHC( 0xf9f8 ),
+ SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7f3a ), SHC( 0xf1f4 ),
+ SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7eb9 ), SHC( 0xedf7 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7e18 ), SHC( 0xe9fe ),
+ SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7d57 ), SHC( 0xe60b ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7c77 ), SHC( 0xe21e ),
+ SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7b77 ), SHC( 0xde39 ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x7a57 ), SHC( 0xda5d ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fdc ), SHC( 0xf9f8 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7eb9 ), SHC( 0xedf7 ),
+ SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x7919 ), SHC( 0xd68a ),
+ SHC( 0x7703 ), SHC( 0xd0e1 ), SHC( 0x74a9 ), SHC( 0xcb53 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6f2f ), SHC( 0xc095 ),
+ SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x68b9 ), SHC( 0xb666 ), SHC( 0x6524 ), SHC( 0xb18c ), SHC( 0x6155 ), SHC( 0xacdf ),
+ SHC( 0x5d4f ), SHC( 0xa861 ), SHC( 0x5914 ), SHC( 0xa414 ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x5008 ), SHC( 0x9c1b ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7c77 ), SHC( 0xe21e ),
+ SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6d23 ), SHC( 0xbd1f ),
+ SHC( 0x678e ), SHC( 0xb4c3 ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x5a82 ), SHC( 0xa57e ), SHC( 0x5321 ), SHC( 0x9eab ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x30fc ), SHC( 0x89be ),
+ SHC( 0x278e ), SHC( 0x8644 ), SHC( 0x1de2 ), SHC( 0x8389 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0a0b ), SHC( 0x8065 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7f3a ), SHC( 0xf1f4 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7919 ), SHC( 0xd68a ),
+ SHC( 0x73d1 ), SHC( 0xc980 ), SHC( 0x6d23 ), SHC( 0xbd1f ), SHC( 0x6524 ), SHC( 0xb18c ), SHC( 0x5bec ), SHC( 0xa6ec ),
+ SHC( 0x5197 ), SHC( 0x9d60 ), SHC( 0x4646 ), SHC( 0x9504 ), SHC( 0x3a1c ), SHC( 0x8df3 ), SHC( 0x2d3f ), SHC( 0x8843 ),
+ SHC( 0x1fd5 ), SHC( 0x8405 ), SHC( 0x1209 ), SHC( 0x8147 ), SHC( 0x0405 ), SHC( 0x8010 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
+ SHC( 0xe804 ), SHC( 0x8244 ), SHC( 0xda5d ), SHC( 0x85a9 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xc095 ), SHC( 0x90d1 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7eb9 ), SHC( 0xedf7 ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x74a9 ), SHC( 0xcb53 ),
+ SHC( 0x6c13 ), SHC( 0xbb6a ), SHC( 0x6155 ), SHC( 0xacdf ), SHC( 0x54a6 ), SHC( 0x9ffc ), SHC( 0x4646 ), SHC( 0x9504 ),
+ SHC( 0x3680 ), SHC( 0x8c2f ), SHC( 0x25a3 ), SHC( 0x85a9 ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0x0203 ), SHC( 0x8004 ),
+ SHC( 0xeff5 ), SHC( 0x8102 ), SHC( 0xde39 ), SHC( 0x8489 ), SHC( 0xcd2a ), SHC( 0x8a87 ), SHC( 0xbd1f ), SHC( 0x92dd ),
+ SHC( 0xae69 ), SHC( 0x9d60 ), SHC( 0xa154 ), SHC( 0xa9db ), SHC( 0x9622 ), SHC( 0xb80e ), SHC( 0x8d0d ), SHC( 0xc7b0 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7e18 ), SHC( 0xe9fe ), SHC( 0x786f ), SHC( 0xd4a4 ), SHC( 0x6f2f ), SHC( 0xc095 ),
+ SHC( 0x62a0 ), SHC( 0xae69 ), SHC( 0x5321 ), SHC( 0x9eab ), SHC( 0x4128 ), SHC( 0x91d3 ), SHC( 0x2d3f ), SHC( 0x8843 ),
+ SHC( 0x17fc ), SHC( 0x8244 ), SHC( 0x0203 ), SHC( 0x8004 ), SHC( 0xebfa ), SHC( 0x8193 ), SHC( 0xd68a ), SHC( 0x86e7 ),
+ SHC( 0xc256 ), SHC( 0x8fd5 ), SHC( 0xaff8 ), SHC( 0x9c1b ), SHC( 0x9ffc ), SHC( 0xab5a ), SHC( 0x92dd ), SHC( 0xbd1f ),
+ SHC( 0x88fd ), SHC( 0xd0e1 ), SHC( 0x82a9 ), SHC( 0xe60b ), SHC( 0x8010 ), SHC( 0xfbfb ), SHC( 0x8147 ), SHC( 0x1209 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7d57 ), SHC( 0xe60b ), SHC( 0x7579 ), SHC( 0xcd2a ), SHC( 0x68b9 ), SHC( 0xb666 ),
+ SHC( 0x579f ), SHC( 0xa2b1 ), SHC( 0x42e1 ), SHC( 0x92dd ), SHC( 0x2b5c ), SHC( 0x8791 ), SHC( 0x1209 ), SHC( 0x8147 ),
+ SHC( 0xf7f6 ), SHC( 0x8041 ), SHC( 0xde39 ), SHC( 0x8489 ), SHC( 0xc5e4 ), SHC( 0x8df3 ), SHC( 0xaff8 ), SHC( 0x9c1b ),
+ SHC( 0x9d60 ), SHC( 0xae69 ), SHC( 0x8ee1 ), SHC( 0xc41b ), SHC( 0x8515 ), SHC( 0xdc4a ), SHC( 0x8065 ), SHC( 0xf5f5 ),
+ SHC( 0x8102 ), SHC( 0x100b ), SHC( 0x86e7 ), SHC( 0x2976 ), SHC( 0x91d3 ), SHC( 0x4128 ), SHC( 0xa154 ), SHC( 0x5625 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x720d ), SHC( 0xc5e4 ), SHC( 0x6155 ), SHC( 0xacdf ),
+ SHC( 0x4b3d ), SHC( 0x9872 ), SHC( 0x30fc ), SHC( 0x89be ), SHC( 0x1406 ), SHC( 0x8193 ), SHC( 0xf5f5 ), SHC( 0x8065 ),
+ SHC( 0xd872 ), SHC( 0x8644 ), SHC( 0xbd1f ), SHC( 0x92dd ), SHC( 0xa57e ), SHC( 0xa57e ), SHC( 0x92dd ), SHC( 0xbd1f ),
+ SHC( 0x8644 ), SHC( 0xd872 ), SHC( 0x8065 ), SHC( 0xf5f5 ), SHC( 0x8193 ), SHC( 0x1406 ), SHC( 0x89be ), SHC( 0x30fc ),
+ SHC( 0x9872 ), SHC( 0x4b3d ), SHC( 0xacdf ), SHC( 0x6155 ), SHC( 0xc5e4 ), SHC( 0x720d ), SHC( 0xe21e ), SHC( 0x7c77 ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7b77 ), SHC( 0xde39 ), SHC( 0x6e2d ), SHC( 0xbed8 ), SHC( 0x5914 ), SHC( 0xa414 ),
+ SHC( 0x3daa ), SHC( 0x8fd5 ), SHC( 0x1de2 ), SHC( 0x8389 ), SHC( 0xfbfb ), SHC( 0x8010 ), SHC( 0xda5d ), SHC( 0x85a9 ),
+ SHC( 0xbb6a ), SHC( 0x93ed ), SHC( 0xa154 ), SHC( 0xa9db ), SHC( 0x8df3 ), SHC( 0xc5e4 ), SHC( 0x82a9 ), SHC( 0xe60b ),
+ SHC( 0x8041 ), SHC( 0x080a ), SHC( 0x86e7 ), SHC( 0x2976 ), SHC( 0x9622 ), SHC( 0x47f2 ), SHC( 0xacdf ), SHC( 0x6155 ),
+ SHC( 0xc980 ), SHC( 0x73d1 ), SHC( 0xe9fe ), SHC( 0x7e18 ), SHC( 0x0c0c ), SHC( 0x7f6f ), SHC( 0x2d3f ), SHC( 0x77bd ),
+ SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7a57 ), SHC( 0xda5d ), SHC( 0x69de ), SHC( 0xb80e ), SHC( 0x5008 ), SHC( 0x9c1b ),
+ SHC( 0x2f1f ), SHC( 0x88fd ), SHC( 0x0a0b ), SHC( 0x8065 ), SHC( 0xe414 ), SHC( 0x8315 ), SHC( 0xc095 ), SHC( 0x90d1 ),
+ SHC( 0xa2b1 ), SHC( 0xa861 ), SHC( 0x8d0d ), SHC( 0xc7b0 ), SHC( 0x8193 ), SHC( 0xebfa ), SHC( 0x8147 ), SHC( 0x1209 ),
+ SHC( 0x8c2f ), SHC( 0x3680 ), SHC( 0xa154 ), SHC( 0x5625 ), SHC( 0xbed8 ), SHC( 0x6e2d ), SHC( 0xe21e ), SHC( 0x7c77 ),
+ SHC( 0x080a ), SHC( 0x7fbf ), SHC( 0x2d3f ), SHC( 0x77bd ), SHC( 0x4e74 ), SHC( 0x6524 ), SHC( 0x68b9 ), SHC( 0x499a )
+};
+
+const Word16 FFT_W64[( 64 * 2 ) * 2] = { // Q15
+ 16384, 0, 16364, -804, 16305, -1606, 16207, -2404,
+ 16069, -3196, 15893, -3981, 15679, -4756, 15426, -5520,
+ 15137, -6270, 14811, -7005, 14449, -7723, 14053, -8423,
+ 13623, -9102, 13160, -9760, 12665, -10394, 12140, -11003,
+ 11585, -11585, 11003, -12140, 10394, -12665, 9760, -13160,
+ 9102, -13623, 8423, -14053, 7723, -14449, 7005, -14811,
+ 6270, -15137, 5520, -15426, 4756, -15679, 3981, -15893,
+ 3196, -16069, 2404, -16207, 1606, -16305, 804, -16364,
+ 0, -16384, -804, -16364, -1606, -16305, -2404, -16207,
+ -3196, -16069, -3981, -15893, -4756, -15679, -5520, -15426,
+ -6270, -15137, -7005, -14811, -7723, -14449, -8423, -14053,
+ -9102, -13623, -9760, -13160, -10394, -12665, -11003, -12140,
+ -11585, -11585, -12140, -11003, -12665, -10394, -13160, -9760,
+ -13623, -9102, -14053, -8423, -14449, -7723, -14811, -7005,
+ -15137, -6270, -15426, -5520, -15679, -4756, -15893, -3981,
+ -16069, -3196, -16207, -2404, -16305, -1606, -16364, -804,
+ /* The following is a duplication of the above but scaled up by a factor of 2.
+ * This save one operation in inverse FFT inner loops */
+ 32767, 0, 32729, -1608, 32610, -3212, 32413, -4808,
+ 32138, -6393, 31786, -7962, 31357, -9512, 30853, -11039,
+ 30274, -12540, 29622, -14010, 28899, -15447, 28106, -16846,
+ 27246, -18205, 26320, -19520, 25330, -20788, 24279, -22006,
+ 23170, -23170, 22006, -24279, 20788, -25330, 19520, -26320,
+ 18205, -27246, 16846, -28106, 15447, -28899, 14010, -29622,
+ 12540, -30274, 11039, -30853, 9512, -31357, 7962, -31786,
+ 6393, -32138, 4808, -32413, 3212, -32610, 1608, -32729,
+ 0, -32768, -1608, -32729, -3212, -32610, -4808, -32413,
+ -6393, -32138, -7962, -31786, -9512, -31357, -11039, -30853,
+ -12540, -30274, -14010, -29622, -15447, -28899, -16846, -28106,
+ -18205, -27246, -19520, -26320, -20788, -25330, -22006, -24279,
+ -23170, -23170, -24279, -22006, -25330, -20788, -26320, -19520,
+ -27246, -18205, -28106, -16846, -28899, -15447, -29622, -14010,
+ -30274, -12540, -30853, -11039, -31357, -9512, -31786, -7962,
+ -32138, -6393, -32413, -4808, -32610, -3212, -32729, -1608
+};
+
+const Word16 FFT_W128[] = { // Q15
+ /* part of table that is not scaled by 2 */
+ 16384, 0, 16379, -402, 16364, -804, 16339, -1205,
+ 16305, -1606, 16260, -2006, 16206, -2404, 16142, -2801,
+ 16069, -3196, 15985, -3590, 15893, -3981, 15790, -4370,
+ 15678, -4756, 15557, -5139, 15426, -5519, 15286, -5896,
+ 15136, -6270, 14978, -6639, 14811, -7005, 14634, -7366,
+ 14449, -7723, 14255, -8075, 14053, -8423, 13842, -8765,
+ 13622, -9102, 13395, -9434, 13159, -9760, 12916, -10080,
+ 12665, -10394, 12406, -10701, 12139, -11002, 11866, -11297,
+ 11585, -11585, 11297, -11866, 11002, -12139, 10701, -12406,
+ 10394, -12665, 10080, -12916, 9760, -13159, 9434, -13395,
+ 9102, -13622, 8765, -13842, 8423, -14053, 8075, -14255,
+ 7723, -14449, 7366, -14634, 7005, -14811, 6639, -14978,
+ 6270, -15136, 5896, -15286, 5519, -15426, 5139, -15557,
+ 4756, -15678, 4370, -15790, 3981, -15893, 3590, -15985,
+ 3196, -16069, 2801, -16142, 2404, -16206, 2006, -16260,
+ 1606, -16305, 1205, -16339, 804, -16364, 402, -16379,
+ 0, -16384, -402, -16379, -804, -16364, -1205, -16339,
+ -1606, -16305, -2006, -16260, -2404, -16206, -2801, -16142,
+ -3196, -16069, -3590, -15985, -3981, -15893, -4370, -15790,
+ -4756, -15678, -5139, -15557, -5519, -15426, -5896, -15286,
+ -6270, -15136, -6639, -14978, -7005, -14811, -7366, -14634,
+ -7723, -14449, -8075, -14255, -8423, -14053, -8765, -13842,
+ -9102, -13622, -9434, -13395, -9760, -13159, -10080, -12916,
+ -10394, -12665, -10701, -12406, -11002, -12139, -11297, -11866,
+ -11585, -11585, -11866, -11297, -12139, -11002, -12406, -10701,
+ -12665, -10394, -12916, -10080, -13159, -9760, -13395, -9434,
+ -13622, -9102, -13842, -8765, -14053, -8423, -14255, -8075,
+ -14449, -7723, -14634, -7366, -14811, -7005, -14978, -6639,
+ -15136, -6270, -15286, -5896, -15426, -5519, -15557, -5139,
+ -15678, -4756, -15790, -4370, -15893, -3981, -15985, -3590,
+ -16069, -3196, -16142, -2801, -16206, -2404, -16260, -2006,
+ -16305, -1606, -16339, -1205, -16364, -804, -16379, -402,
+ /* part of table that is scaled by 2 (this save one operation in FFT inner loops) */
+ 32767, 0, 32758, -804, 32728, -1608, 32678, -2410,
+ 32610, -3212, 32520, -4012, 32412, -4808, 32284, -5602,
+ 32138, -6392, 31970, -7180, 31786, -7962, 31580, -8740,
+ 31356, -9512, 31114, -10278, 30852, -11038, 30572, -11792,
+ 30272, -12540, 29956, -13278, 29622, -14010, 29268, -14732,
+ 28898, -15446, 28510, -16150, 28106, -16846, 27684, -17530,
+ 27244, -18204, 26790, -18868, 26318, -19520, 25832, -20160,
+ 25330, -20788, 24812, -21402, 24278, -22004, 23732, -22594,
+ 23170, -23170, 22594, -23732, 22004, -24278, 21402, -24812,
+ 20788, -25330, 20160, -25832, 19520, -26318, 18868, -26790,
+ 18204, -27244, 17530, -27684, 16846, -28106, 16150, -28510,
+ 15446, -28898, 14732, -29268, 14010, -29622, 13278, -29956,
+ 12540, -30272, 11792, -30572, 11038, -30852, 10278, -31114,
+ 9512, -31356, 8740, -31580, 7962, -31786, 7180, -31970,
+ 6392, -32138, 5602, -32284, 4808, -32412, 4012, -32520,
+ 3212, -32610, 2410, -32678, 1608, -32728, 804, -32758,
+ 0, -32768, -804, -32758, -1608, -32728, -2410, -32678,
+ -3212, -32610, -4012, -32520, -4808, -32412, -5602, -32284,
+ -6392, -32138, -7180, -31970, -7962, -31786, -8740, -31580,
+ -9512, -31356, -10278, -31114, -11038, -30852, -11792, -30572,
+ -12540, -30272, -13278, -29956, -14010, -29622, -14732, -29268,
+ -15446, -28898, -16150, -28510, -16846, -28106, -17530, -27684,
+ -18204, -27244, -18868, -26790, -19520, -26318, -20160, -25832,
+ -20788, -25330, -21402, -24812, -22004, -24278, -22594, -23732,
+ -23170, -23170, -23732, -22594, -24278, -22004, -24812, -21402,
+ -25330, -20788, -25832, -20160, -26318, -19520, -26790, -18868,
+ -27244, -18204, -27684, -17530, -28106, -16846, -28510, -16150,
+ -28898, -15446, -29268, -14732, -29622, -14010, -29956, -13278,
+ -30272, -12540, -30572, -11792, -30852, -11038, -31114, -10278,
+ -31356, -9512, -31580, -8740, -31786, -7962, -31970, -7180,
+ -32138, -6392, -32284, -5602, -32412, -4808, -32520, -4012,
+ -32610, -3212, -32678, -2410, -32728, -1608, -32758, -804
+};
+
+const Word16 FFT_W256[( 256 * 2 ) * 2] = { // Q15
+ /* Each adjacent pair represents the real and imaginary part of a complex number: */
+ /* W = exp{-j*(PI*n/256)} = cos(PI*n/256)*16384 -j*sin(PI*n/256)*16384 for n=0, 1, ..., 255. */
+ 16384, 0, 16383, -201, 16379, -402, 16373, -603,
+ 16364, -804, 16353, -1005, 16340, -1205, 16324, -1406,
+ 16305, -1606, 16284, -1806, 16261, -2006, 16235, -2205,
+ 16207, -2404, 16176, -2603, 16143, -2801, 16107, -2999,
+ 16069, -3196, 16029, -3393, 15986, -3590, 15941, -3786,
+ 15893, -3981, 15843, -4176, 15791, -4370, 15736, -4563,
+ 15679, -4756, 15619, -4948, 15557, -5139, 15493, -5330,
+ 15426, -5520, 15357, -5708, 15286, -5897, 15213, -6084,
+ 15137, -6270, 15059, -6455, 14978, -6639, 14896, -6823,
+ 14811, -7005, 14724, -7186, 14635, -7366, 14543, -7545,
+ 14449, -7723, 14354, -7900, 14256, -8076, 14155, -8250,
+ 14053, -8423, 13949, -8595, 13842, -8765, 13733, -8935,
+ 13623, -9102, 13510, -9269, 13395, -9434, 13279, -9598,
+ 13160, -9760, 13039, -9921, 12916, -10080, 12792, -10238,
+ 12665, -10394, 12537, -10549, 12406, -10702, 12274, -10853,
+ 12140, -11003, 12004, -11151, 11866, -11297, 11727, -11442,
+ 11585, -11585, 11442, -11727, 11297, -11866, 11151, -12004,
+ 11003, -12140, 10853, -12274, 10702, -12406, 10549, -12537,
+ 10394, -12665, 10238, -12792, 10080, -12916, 9921, -13039,
+ 9760, -13160, 9598, -13279, 9434, -13395, 9269, -13510,
+ 9102, -13623, 8935, -13733, 8765, -13842, 8595, -13949,
+ 8423, -14053, 8250, -14155, 8076, -14256, 7900, -14354,
+ 7723, -14449, 7545, -14543, 7366, -14635, 7186, -14724,
+ 7005, -14811, 6823, -14896, 6639, -14978, 6455, -15059,
+ 6270, -15137, 6084, -15213, 5897, -15286, 5708, -15357,
+ 5520, -15426, 5330, -15493, 5139, -15557, 4948, -15619,
+ 4756, -15679, 4563, -15736, 4370, -15791, 4176, -15843,
+ 3981, -15893, 3786, -15941, 3590, -15986, 3393, -16029,
+ 3196, -16069, 2999, -16107, 2801, -16143, 2603, -16176,
+ 2404, -16207, 2205, -16235, 2006, -16261, 1806, -16284,
+ 1606, -16305, 1406, -16324, 1205, -16340, 1005, -16353,
+ 804, -16364, 603, -16373, 402, -16379, 201, -16383,
+ 0, -16384, -201, -16383, -402, -16379, -603, -16373,
+ -804, -16364, -1005, -16353, -1205, -16340, -1406, -16324,
+ -1606, -16305, -1806, -16284, -2006, -16261, -2205, -16235,
+ -2404, -16207, -2603, -16176, -2801, -16143, -2999, -16107,
+ -3196, -16069, -3393, -16029, -3590, -15986, -3786, -15941,
+ -3981, -15893, -4176, -15843, -4370, -15791, -4563, -15736,
+ -4756, -15679, -4948, -15619, -5139, -15557, -5330, -15493,
+ -5520, -15426, -5708, -15357, -5897, -15286, -6084, -15213,
+ -6270, -15137, -6455, -15059, -6639, -14978, -6823, -14896,
+ -7005, -14811, -7186, -14724, -7366, -14635, -7545, -14543,
+ -7723, -14449, -7900, -14354, -8076, -14256, -8250, -14155,
+ -8423, -14053, -8595, -13949, -8765, -13842, -8935, -13733,
+ -9102, -13623, -9269, -13510, -9434, -13395, -9598, -13279,
+ -9760, -13160, -9921, -13039, -10080, -12916, -10238, -12792,
+ -10394, -12665, -10549, -12537, -10702, -12406, -10853, -12274,
+ -11003, -12140, -11151, -12004, -11297, -11866, -11442, -11727,
+ -11585, -11585, -11727, -11442, -11866, -11297, -12004, -11151,
+ -12140, -11003, -12274, -10853, -12406, -10702, -12537, -10549,
+ -12665, -10394, -12792, -10238, -12916, -10080, -13039, -9921,
+ -13160, -9760, -13279, -9598, -13395, -9434, -13510, -9269,
+ -13623, -9102, -13733, -8935, -13842, -8765, -13949, -8595,
+ -14053, -8423, -14155, -8250, -14256, -8076, -14354, -7900,
+ -14449, -7723, -14543, -7545, -14635, -7366, -14724, -7186,
+ -14811, -7005, -14896, -6823, -14978, -6639, -15059, -6455,
+ -15137, -6270, -15213, -6084, -15286, -5897, -15357, -5708,
+ -15426, -5520, -15493, -5330, -15557, -5139, -15619, -4948,
+ -15679, -4756, -15736, -4563, -15791, -4370, -15843, -4176,
+ -15893, -3981, -15941, -3786, -15986, -3590, -16029, -3393,
+ -16069, -3196, -16107, -2999, -16143, -2801, -16176, -2603,
+ -16207, -2404, -16235, -2205, -16261, -2006, -16284, -1806,
+ -16305, -1606, -16324, -1406, -16340, -1205, -16353, -1005,
+ -16364, -804, -16373, -603, -16379, -402, -16383, -201,
+
+ /* The following is a duplication of the above but scaled up by a factor of 2.
+ * This save one operation in inverse FFT inner loops */
+ 32767, 0, 32766, -402, 32758, -804, 32746, -1206,
+ 32729, -1608, 32706, -2009, 32679, -2411, 32647, -2811,
+ 32610, -3212, 32568, -3612, 32522, -4011, 32470, -4410,
+ 32413, -4808, 32352, -5205, 32286, -5602, 32214, -5998,
+ 32138, -6393, 32058, -6787, 31972, -7180, 31881, -7571,
+ 31786, -7962, 31686, -8351, 31581, -8740, 31471, -9127,
+ 31357, -9512, 31238, -9896, 31114, -10279, 30986, -10660,
+ 30853, -11039, 30715, -11417, 30572, -11793, 30425, -12167,
+ 30274, -12540, 30118, -12910, 29957, -13279, 29792, -13646,
+ 29622, -14010, 29448, -14373, 29269, -14733, 29086, -15091,
+ 28899, -15447, 28707, -15800, 28511, -16151, 28311, -16500,
+ 28106, -16846, 27897, -17190, 27684, -17531, 27467, -17869,
+ 27246, -18205, 27020, -18538, 26791, -18868, 26557, -19195,
+ 26320, -19520, 26078, -19841, 25833, -20160, 25583, -20475,
+ 25330, -20788, 25073, -21097, 24812, -21403, 24548, -21706,
+ 24279, -22006, 24008, -22302, 23732, -22595, 23453, -22884,
+ 23170, -23170, 22884, -23453, 22595, -23732, 22302, -24008,
+ 22006, -24279, 21706, -24548, 21403, -24812, 21097, -25073,
+ 20788, -25330, 20475, -25583, 20160, -25833, 19841, -26078,
+ 19520, -26320, 19195, -26557, 18868, -26791, 18538, -27020,
+ 18205, -27246, 17869, -27467, 17531, -27684, 17190, -27897,
+ 16846, -28106, 16500, -28311, 16151, -28511, 15800, -28707,
+ 15447, -28899, 15091, -29086, 14733, -29269, 14373, -29448,
+ 14010, -29622, 13646, -29792, 13279, -29957, 12910, -30118,
+ 12540, -30274, 12167, -30425, 11793, -30572, 11417, -30715,
+ 11039, -30853, 10660, -30986, 10279, -31114, 9896, -31238,
+ 9512, -31357, 9127, -31471, 8740, -31581, 8351, -31686,
+ 7962, -31786, 7571, -31881, 7180, -31972, 6787, -32058,
+ 6393, -32138, 5998, -32214, 5602, -32286, 5205, -32352,
+ 4808, -32413, 4410, -32470, 4011, -32522, 3612, -32568,
+ 3212, -32610, 2811, -32647, 2411, -32679, 2009, -32706,
+ 1608, -32729, 1206, -32746, 804, -32758, 402, -32766,
+ 0, -32768, -402, -32766, -804, -32758, -1206, -32746,
+ -1608, -32729, -2009, -32706, -2411, -32679, -2811, -32647,
+ -3212, -32610, -3612, -32568, -4011, -32522, -4410, -32470,
+ -4808, -32413, -5205, -32352, -5602, -32286, -5998, -32214,
+ -6393, -32138, -6787, -32058, -7180, -31972, -7571, -31881,
+ -7962, -31786, -8351, -31686, -8740, -31581, -9127, -31471,
+ -9512, -31357, -9896, -31238, -10279, -31114, -10660, -30986,
+ -11039, -30853, -11417, -30715, -11793, -30572, -12167, -30425,
+ -12540, -30274, -12910, -30118, -13279, -29957, -13646, -29792,
+ -14010, -29622, -14373, -29448, -14733, -29269, -15091, -29086,
+ -15447, -28899, -15800, -28707, -16151, -28511, -16500, -28311,
+ -16846, -28106, -17190, -27897, -17531, -27684, -17869, -27467,
+ -18205, -27246, -18538, -27020, -18868, -26791, -19195, -26557,
+ -19520, -26320, -19841, -26078, -20160, -25833, -20475, -25583,
+ -20788, -25330, -21097, -25073, -21403, -24812, -21706, -24548,
+ -22006, -24279, -22302, -24008, -22595, -23732, -22884, -23453,
+ -23170, -23170, -23453, -22884, -23732, -22595, -24008, -22302,
+ -24279, -22006, -24548, -21706, -24812, -21403, -25073, -21097,
+ -25330, -20788, -25583, -20475, -25833, -20160, -26078, -19841,
+ -26320, -19520, -26557, -19195, -26791, -18868, -27020, -18538,
+ -27246, -18205, -27467, -17869, -27684, -17531, -27897, -17190,
+ -28106, -16846, -28311, -16500, -28511, -16151, -28707, -15800,
+ -28899, -15447, -29086, -15091, -29269, -14733, -29448, -14373,
+ -29622, -14010, -29792, -13646, -29957, -13279, -30118, -12910,
+ -30274, -12540, -30425, -12167, -30572, -11793, -30715, -11417,
+ -30853, -11039, -30986, -10660, -31114, -10279, -31238, -9896,
+ -31357, -9512, -31471, -9127, -31581, -8740, -31686, -8351,
+ -31786, -7962, -31881, -7571, -31972, -7180, -32058, -6787,
+ -32138, -6393, -32214, -5998, -32286, -5602, -32352, -5205,
+ -32413, -4808, -32470, -4410, -32522, -4011, -32568, -3612,
+ -32610, -3212, -32647, -2811, -32679, -2411, -32706, -2009,
+ -32729, -1608, -32746, -1206, -32758, -804, -32766, -402
+};
+
+const Word16 FFT_W512[( 512 * 2 ) * 2] = { // Q15
+ 16384, 0, 16384, -101, 16383, -201, 16381, -302,
+ 16379, -402, 16376, -503, 16373, -603, 16369, -704,
+ 16364, -804, 16359, -904, 16353, -1005, 16347, -1105,
+ 16340, -1205, 16332, -1306, 16324, -1406, 16315, -1506,
+ 16305, -1606, 16295, -1706, 16284, -1806, 16273, -1906,
+ 16261, -2006, 16248, -2105, 16235, -2205, 16221, -2305,
+ 16207, -2404, 16192, -2503, 16176, -2603, 16160, -2702,
+ 16143, -2801, 16125, -2900, 16107, -2999, 16088, -3098,
+ 16069, -3196, 16049, -3295, 16029, -3393, 16008, -3492,
+ 15986, -3590, 15964, -3688, 15941, -3786, 15917, -3883,
+ 15893, -3981, 15868, -4078, 15843, -4176, 15817, -4273,
+ 15791, -4370, 15763, -4467, 15736, -4563, 15707, -4660,
+ 15679, -4756, 15649, -4852, 15619, -4948, 15588, -5044,
+ 15557, -5139, 15525, -5235, 15493, -5330, 15460, -5425,
+ 15426, -5520, 15392, -5614, 15357, -5708, 15322, -5803,
+ 15286, -5897, 15250, -5990, 15213, -6084, 15175, -6177,
+ 15137, -6270, 15098, -6363, 15059, -6455, 15019, -6547,
+ 14978, -6639, 14937, -6731, 14896, -6823, 14854, -6914,
+ 14811, -7005, 14768, -7096, 14724, -7186, 14680, -7276,
+ 14635, -7366, 14589, -7456, 14543, -7545, 14497, -7635,
+ 14449, -7723, 14402, -7812, 14354, -7900, 14305, -7988,
+ 14256, -8076, 14206, -8163, 14155, -8250, 14104, -8337,
+ 14053, -8423, 14001, -8509, 13949, -8595, 13896, -8680,
+ 13842, -8765, 13788, -8850, 13733, -8935, 13678, -9019,
+ 13623, -9102, 13567, -9186, 13510, -9269, 13453, -9352,
+ 13395, -9434, 13337, -9516, 13279, -9598, 13219, -9679,
+ 13160, -9760, 13100, -9841, 13039, -9921, 12978, -10001,
+ 12916, -10080, 12854, -10159, 12792, -10238, 12729, -10316,
+ 12665, -10394, 12601, -10471, 12537, -10549, 12472, -10625,
+ 12406, -10702, 12340, -10778, 12274, -10853, 12207, -10928,
+ 12140, -11003, 12072, -11077, 12004, -11151, 11935, -11224,
+ 11866, -11297, 11797, -11370, 11727, -11442, 11656, -11514,
+ 11585, -11585, 11514, -11656, 11442, -11727, 11370, -11797,
+ 11297, -11866, 11224, -11935, 11151, -12004, 11077, -12072,
+ 11003, -12140, 10928, -12207, 10853, -12274, 10778, -12340,
+ 10702, -12406, 10625, -12472, 10549, -12537, 10471, -12601,
+ 10394, -12665, 10316, -12729, 10238, -12792, 10159, -12854,
+ 10080, -12916, 10001, -12978, 9921, -13039, 9841, -13100,
+ 9760, -13160, 9679, -13219, 9598, -13279, 9516, -13337,
+ 9434, -13395, 9352, -13453, 9269, -13510, 9186, -13567,
+ 9102, -13623, 9019, -13678, 8935, -13733, 8850, -13788,
+ 8765, -13842, 8680, -13896, 8595, -13949, 8509, -14001,
+ 8423, -14053, 8337, -14104, 8250, -14155, 8163, -14206,
+ 8076, -14256, 7988, -14305, 7900, -14354, 7812, -14402,
+ 7723, -14449, 7635, -14497, 7545, -14543, 7456, -14589,
+ 7366, -14635, 7276, -14680, 7186, -14724, 7096, -14768,
+ 7005, -14811, 6914, -14854, 6823, -14896, 6731, -14937,
+ 6639, -14978, 6547, -15019, 6455, -15059, 6363, -15098,
+ 6270, -15137, 6177, -15175, 6084, -15213, 5990, -15250,
+ 5897, -15286, 5803, -15322, 5708, -15357, 5614, -15392,
+ 5520, -15426, 5425, -15460, 5330, -15493, 5235, -15525,
+ 5139, -15557, 5044, -15588, 4948, -15619, 4852, -15649,
+ 4756, -15679, 4660, -15707, 4563, -15736, 4467, -15763,
+ 4370, -15791, 4273, -15817, 4176, -15843, 4078, -15868,
+ 3981, -15893, 3883, -15917, 3786, -15941, 3688, -15964,
+ 3590, -15986, 3492, -16008, 3393, -16029, 3295, -16049,
+ 3196, -16069, 3098, -16088, 2999, -16107, 2900, -16125,
+ 2801, -16143, 2702, -16160, 2603, -16176, 2503, -16192,
+ 2404, -16207, 2305, -16221, 2205, -16235, 2105, -16248,
+ 2006, -16261, 1906, -16273, 1806, -16284, 1706, -16295,
+ 1606, -16305, 1506, -16315, 1406, -16324, 1306, -16332,
+ 1205, -16340, 1105, -16347, 1005, -16353, 904, -16359,
+ 804, -16364, 703, -16369, 603, -16373, 503, -16376,
+ 402, -16379, 302, -16381, 201, -16383, 101, -16384,
+ 0, -16384, -101, -16384, -201, -16383, -302, -16381,
+ -402, -16379, -503, -16376, -603, -16373, -704, -16369,
+ -804, -16364, -904, -16359, -1005, -16353, -1105, -16347,
+ -1205, -16340, -1306, -16332, -1406, -16324, -1506, -16315,
+ -1606, -16305, -1706, -16295, -1806, -16284, -1906, -16273,
+ -2006, -16261, -2105, -16248, -2205, -16235, -2305, -16221,
+ -2404, -16207, -2503, -16192, -2603, -16176, -2702, -16160,
+ -2801, -16143, -2900, -16125, -2999, -16107, -3098, -16088,
+ -3196, -16069, -3295, -16049, -3393, -16029, -3492, -16008,
+ -3590, -15986, -3688, -15964, -3786, -15941, -3883, -15917,
+ -3981, -15893, -4078, -15868, -4176, -15843, -4273, -15817,
+ -4370, -15791, -4467, -15763, -4563, -15736, -4660, -15707,
+ -4756, -15679, -4852, -15649, -4948, -15619, -5044, -15588,
+ -5139, -15557, -5235, -15525, -5330, -15493, -5425, -15460,
+ -5520, -15426, -5614, -15392, -5708, -15357, -5803, -15322,
+ -5897, -15286, -5990, -15250, -6084, -15213, -6177, -15175,
+ -6270, -15137, -6363, -15098, -6455, -15059, -6547, -15019,
+ -6639, -14978, -6731, -14937, -6823, -14896, -6914, -14854,
+ -7005, -14811, -7096, -14768, -7186, -14724, -7276, -14680,
+ -7366, -14635, -7456, -14589, -7545, -14543, -7635, -14497,
+ -7723, -14449, -7812, -14402, -7900, -14354, -7988, -14305,
+ -8076, -14256, -8163, -14206, -8250, -14155, -8337, -14104,
+ -8423, -14053, -8509, -14001, -8595, -13949, -8680, -13896,
+ -8765, -13842, -8850, -13788, -8935, -13733, -9019, -13678,
+ -9102, -13623, -9186, -13567, -9269, -13510, -9352, -13453,
+ -9434, -13395, -9516, -13337, -9598, -13279, -9679, -13219,
+ -9760, -13160, -9841, -13100, -9921, -13039, -10001, -12978,
+ -10080, -12916, -10159, -12854, -10238, -12792, -10316, -12729,
+ -10394, -12665, -10471, -12601, -10549, -12537, -10625, -12472,
+ -10702, -12406, -10778, -12340, -10853, -12274, -10928, -12207,
+ -11003, -12140, -11077, -12072, -11151, -12004, -11224, -11935,
+ -11297, -11866, -11370, -11797, -11442, -11727, -11514, -11656,
+ -11585, -11585, -11656, -11514, -11727, -11442, -11797, -11370,
+ -11866, -11297, -11935, -11224, -12004, -11151, -12072, -11077,
+ -12140, -11003, -12207, -10928, -12274, -10853, -12340, -10778,
+ -12406, -10702, -12472, -10625, -12537, -10549, -12601, -10471,
+ -12665, -10394, -12729, -10316, -12792, -10238, -12854, -10159,
+ -12916, -10080, -12978, -10001, -13039, -9921, -13100, -9840,
+ -13160, -9760, -13219, -9679, -13279, -9598, -13337, -9516,
+ -13395, -9434, -13453, -9352, -13510, -9269, -13567, -9186,
+ -13623, -9102, -13678, -9019, -13733, -8935, -13788, -8850,
+ -13842, -8765, -13896, -8680, -13949, -8595, -14001, -8509,
+ -14053, -8423, -14104, -8337, -14155, -8250, -14206, -8163,
+ -14256, -8076, -14305, -7988, -14354, -7900, -14402, -7812,
+ -14449, -7723, -14497, -7635, -14543, -7545, -14589, -7456,
+ -14635, -7366, -14680, -7276, -14724, -7186, -14768, -7096,
+ -14811, -7005, -14854, -6914, -14896, -6823, -14937, -6731,
+ -14978, -6639, -15019, -6547, -15059, -6455, -15098, -6363,
+ -15137, -6270, -15175, -6177, -15213, -6084, -15250, -5990,
+ -15286, -5897, -15322, -5803, -15357, -5708, -15392, -5614,
+ -15426, -5520, -15460, -5425, -15493, -5330, -15525, -5235,
+ -15557, -5139, -15588, -5044, -15619, -4948, -15649, -4852,
+ -15679, -4756, -15707, -4660, -15736, -4563, -15763, -4467,
+ -15791, -4370, -15817, -4273, -15843, -4176, -15868, -4078,
+ -15893, -3981, -15917, -3883, -15941, -3786, -15964, -3688,
+ -15986, -3590, -16008, -3492, -16029, -3393, -16049, -3295,
+ -16069, -3196, -16088, -3098, -16107, -2999, -16125, -2900,
+ -16143, -2801, -16160, -2702, -16176, -2603, -16192, -2503,
+ -16207, -2404, -16221, -2305, -16235, -2205, -16248, -2105,
+ -16261, -2006, -16273, -1906, -16284, -1806, -16295, -1706,
+ -16305, -1606, -16315, -1506, -16324, -1406, -16332, -1306,
+ -16340, -1205, -16347, -1105, -16353, -1005, -16359, -904,
+ -16364, -804, -16369, -703, -16373, -603, -16376, -503,
+ -16379, -402, -16381, -302, -16383, -201, -16384, -101,
+ /* The following is a duplication of the above but scaled up by a factor of 2.
+ * This save one operation in inverse FFT inner loops */
+ 32767, 0, 32767, -201, 32766, -402, 32762, -603,
+ 32758, -804, 32753, -1005, 32746, -1206, 32738, -1407,
+ 32729, -1608, 32718, -1809, 32706, -2009, 32693, -2210,
+ 32679, -2411, 32664, -2611, 32647, -2811, 32629, -3012,
+ 32610, -3212, 32590, -3412, 32568, -3612, 32546, -3812,
+ 32522, -4011, 32496, -4211, 32470, -4410, 32442, -4609,
+ 32413, -4808, 32383, -5007, 32352, -5205, 32319, -5404,
+ 32286, -5602, 32251, -5800, 32214, -5998, 32177, -6195,
+ 32138, -6393, 32099, -6590, 32058, -6787, 32015, -6983,
+ 31972, -7180, 31927, -7376, 31881, -7571, 31834, -7767,
+ 31786, -7962, 31737, -8157, 31686, -8351, 31634, -8546,
+ 31581, -8740, 31527, -8933, 31471, -9127, 31415, -9319,
+ 31357, -9512, 31298, -9704, 31238, -9896, 31177, -10088,
+ 31114, -10279, 31050, -10469, 30986, -10660, 30920, -10850,
+ 30853, -11039, 30784, -11228, 30715, -11417, 30644, -11605,
+ 30572, -11793, 30499, -11980, 30425, -12167, 30350, -12354,
+ 30274, -12540, 30196, -12725, 30118, -12910, 30038, -13095,
+ 29957, -13279, 29875, -13463, 29792, -13646, 29707, -13828,
+ 29622, -14010, 29535, -14192, 29448, -14373, 29359, -14553,
+ 29269, -14733, 29178, -14912, 29086, -15091, 28993, -15269,
+ 28899, -15447, 28803, -15624, 28707, -15800, 28610, -15976,
+ 28511, -16151, 28411, -16326, 28311, -16500, 28209, -16673,
+ 28106, -16846, 28002, -17018, 27897, -17190, 27791, -17361,
+ 27684, -17531, 27576, -17700, 27467, -17869, 27357, -18037,
+ 27246, -18205, 27133, -18372, 27020, -18538, 26906, -18703,
+ 26791, -18868, 26674, -19032, 26557, -19195, 26439, -19358,
+ 26320, -19520, 26199, -19681, 26078, -19841, 25956, -20001,
+ 25833, -20160, 25708, -20318, 25583, -20475, 25457, -20632,
+ 25330, -20788, 25202, -20943, 25073, -21097, 24943, -21251,
+ 24812, -21403, 24680, -21555, 24548, -21706, 24414, -21856,
+ 24279, -22006, 24144, -22154, 24008, -22302, 23870, -22449,
+ 23732, -22595, 23593, -22740, 23453, -22884, 23312, -23028,
+ 23170, -23170, 23028, -23312, 22884, -23453, 22740, -23593,
+ 22595, -23732, 22449, -23870, 22302, -24008, 22154, -24144,
+ 22006, -24279, 21856, -24414, 21706, -24548, 21555, -24680,
+ 21403, -24812, 21251, -24943, 21097, -25073, 20943, -25202,
+ 20788, -25330, 20632, -25457, 20475, -25583, 20318, -25708,
+ 20160, -25833, 20001, -25956, 19841, -26078, 19681, -26199,
+ 19520, -26320, 19358, -26439, 19195, -26557, 19032, -26674,
+ 18868, -26791, 18703, -26906, 18538, -27020, 18372, -27133,
+ 18205, -27246, 18037, -27357, 17869, -27467, 17700, -27576,
+ 17531, -27684, 17361, -27791, 17190, -27897, 17018, -28002,
+ 16846, -28106, 16673, -28209, 16500, -28311, 16326, -28411,
+ 16151, -28511, 15976, -28610, 15800, -28707, 15624, -28803,
+ 15447, -28899, 15269, -28993, 15091, -29086, 14912, -29178,
+ 14733, -29269, 14553, -29359, 14373, -29448, 14192, -29535,
+ 14010, -29622, 13828, -29707, 13646, -29792, 13463, -29875,
+ 13279, -29957, 13095, -30038, 12910, -30118, 12725, -30196,
+ 12540, -30274, 12354, -30350, 12167, -30425, 11980, -30499,
+ 11793, -30572, 11605, -30644, 11417, -30715, 11228, -30784,
+ 11039, -30853, 10850, -30920, 10660, -30986, 10469, -31050,
+ 10279, -31114, 10088, -31177, 9896, -31238, 9704, -31298,
+ 9512, -31357, 9319, -31415, 9127, -31471, 8933, -31527,
+ 8740, -31581, 8546, -31634, 8351, -31686, 8157, -31737,
+ 7962, -31786, 7767, -31834, 7571, -31881, 7376, -31927,
+ 7180, -31972, 6983, -32015, 6787, -32058, 6590, -32099,
+ 6393, -32138, 6195, -32177, 5998, -32214, 5800, -32251,
+ 5602, -32286, 5404, -32319, 5205, -32352, 5007, -32383,
+ 4808, -32413, 4609, -32442, 4410, -32470, 4211, -32496,
+ 4011, -32522, 3812, -32546, 3612, -32568, 3412, -32590,
+ 3212, -32610, 3012, -32629, 2811, -32647, 2611, -32664,
+ 2411, -32679, 2210, -32693, 2009, -32706, 1809, -32718,
+ 1608, -32729, 1407, -32738, 1206, -32746, 1005, -32753,
+ 804, -32758, 603, -32762, 402, -32766, 201, -32767,
+ 0, -32768, -201, -32767, -402, -32766, -603, -32762,
+ -804, -32758, -1005, -32753, -1206, -32746, -1407, -32738,
+ -1608, -32729, -1809, -32718, -2009, -32706, -2210, -32693,
+ -2411, -32679, -2611, -32664, -2811, -32647, -3012, -32629,
+ -3212, -32610, -3412, -32590, -3612, -32568, -3812, -32546,
+ -4011, -32522, -4211, -32496, -4410, -32470, -4609, -32442,
+ -4808, -32413, -5007, -32383, -5205, -32352, -5404, -32319,
+ -5602, -32286, -5800, -32251, -5998, -32214, -6195, -32177,
+ -6393, -32138, -6590, -32099, -6787, -32058, -6983, -32015,
+ -7180, -31972, -7376, -31927, -7571, -31881, -7767, -31834,
+ -7962, -31786, -8157, -31737, -8351, -31686, -8546, -31634,
+ -8740, -31581, -8933, -31527, -9127, -31471, -9319, -31415,
+ -9512, -31357, -9704, -31298, -9896, -31238, -10088, -31177,
+ -10279, -31114, -10469, -31050, -10660, -30986, -10850, -30920,
+ -11039, -30853, -11228, -30784, -11417, -30715, -11605, -30644,
+ -11793, -30572, -11980, -30499, -12167, -30425, -12354, -30350,
+ -12540, -30274, -12725, -30196, -12910, -30118, -13095, -30038,
+ -13279, -29957, -13463, -29875, -13646, -29792, -13828, -29707,
+ -14010, -29622, -14192, -29535, -14373, -29448, -14553, -29359,
+ -14733, -29269, -14912, -29178, -15091, -29086, -15269, -28993,
+ -15447, -28899, -15624, -28803, -15800, -28707, -15976, -28610,
+ -16151, -28511, -16326, -28411, -16500, -28311, -16673, -28209,
+ -16846, -28106, -17018, -28002, -17190, -27897, -17361, -27791,
+ -17531, -27684, -17700, -27576, -17869, -27467, -18037, -27357,
+ -18205, -27246, -18372, -27133, -18538, -27020, -18703, -26906,
+ -18868, -26791, -19032, -26674, -19195, -26557, -19358, -26439,
+ -19520, -26320, -19681, -26199, -19841, -26078, -20001, -25956,
+ -20160, -25833, -20318, -25708, -20475, -25583, -20632, -25457,
+ -20788, -25330, -20943, -25202, -21097, -25073, -21251, -24943,
+ -21403, -24812, -21555, -24680, -21706, -24548, -21856, -24414,
+ -22006, -24279, -22154, -24144, -22302, -24008, -22449, -23870,
+ -22595, -23732, -22740, -23593, -22884, -23453, -23028, -23312,
+ -23170, -23170, -23312, -23028, -23453, -22884, -23593, -22740,
+ -23732, -22595, -23870, -22449, -24008, -22302, -24144, -22154,
+ -24279, -22006, -24414, -21856, -24548, -21706, -24680, -21555,
+ -24812, -21403, -24943, -21251, -25073, -21097, -25202, -20943,
+ -25330, -20788, -25457, -20632, -25583, -20475, -25708, -20318,
+ -25833, -20160, -25956, -20001, -26078, -19841, -26199, -19681,
+ -26320, -19520, -26439, -19358, -26557, -19195, -26674, -19032,
+ -26791, -18868, -26906, -18703, -27020, -18538, -27133, -18372,
+ -27246, -18205, -27357, -18037, -27467, -17869, -27576, -17700,
+ -27684, -17531, -27791, -17361, -27897, -17190, -28002, -17018,
+ -28106, -16846, -28209, -16673, -28311, -16500, -28411, -16326,
+ -28511, -16151, -28610, -15976, -28707, -15800, -28803, -15624,
+ -28899, -15447, -28993, -15269, -29086, -15091, -29178, -14912,
+ -29269, -14733, -29359, -14553, -29448, -14373, -29535, -14192,
+ -29622, -14010, -29707, -13828, -29792, -13646, -29875, -13463,
+ -29957, -13279, -30038, -13095, -30118, -12910, -30196, -12725,
+ -30274, -12540, -30350, -12354, -30425, -12167, -30499, -11980,
+ -30572, -11793, -30644, -11605, -30715, -11417, -30784, -11228,
+ -30853, -11039, -30920, -10850, -30986, -10660, -31050, -10469,
+ -31114, -10279, -31177, -10088, -31238, -9896, -31298, -9704,
+ -31357, -9512, -31415, -9319, -31471, -9127, -31527, -8933,
+ -31581, -8740, -31634, -8546, -31686, -8351, -31737, -8157,
+ -31786, -7962, -31834, -7767, -31881, -7571, -31927, -7376,
+ -31972, -7180, -32015, -6983, -32058, -6787, -32099, -6590,
+ -32138, -6393, -32177, -6195, -32214, -5998, -32251, -5800,
+ -32286, -5602, -32319, -5404, -32352, -5205, -32383, -5007,
+ -32413, -4808, -32442, -4609, -32470, -4410, -32496, -4211,
+ -32522, -4011, -32546, -3812, -32568, -3612, -32590, -3412,
+ -32610, -3212, -32629, -3012, -32647, -2811, -32664, -2611,
+ -32679, -2411, -32693, -2210, -32706, -2009, -32718, -1809,
+ -32729, -1608, -32738, -1407, -32746, -1206, -32753, -1005,
+ -32758, -804, -32762, -603, -32766, -402, -32767, -201
+};
+
+const Word16 FFT_REORDER_1024[512] = {
+ 0, 512, 256, 768, 128, 640, 384, 896,
+ 64, 576, 320, 832, 192, 704, 448, 960,
+ 32, 544, 288, 800, 160, 672, 416, 928,
+ 96, 608, 352, 864, 224, 736, 480, 992,
+ 16, 528, 272, 784, 144, 656, 400, 912,
+ 80, 592, 336, 848, 208, 720, 464, 976,
+ 48, 560, 304, 816, 176, 688, 432, 944,
+ 112, 624, 368, 880, 240, 752, 496, 1008,
+ 8, 520, 264, 776, 136, 648, 392, 904,
+ 72, 584, 328, 840, 200, 712, 456, 968,
+ 40, 552, 296, 808, 168, 680, 424, 936,
+ 104, 616, 360, 872, 232, 744, 488, 1000,
+ 24, 536, 280, 792, 152, 664, 408, 920,
+ 88, 600, 344, 856, 216, 728, 472, 984,
+ 56, 568, 312, 824, 184, 696, 440, 952,
+ 120, 632, 376, 888, 248, 760, 504, 1016,
+ 4, 516, 260, 772, 132, 644, 388, 900,
+ 68, 580, 324, 836, 196, 708, 452, 964,
+ 36, 548, 292, 804, 164, 676, 420, 932,
+ 100, 612, 356, 868, 228, 740, 484, 996,
+ 20, 532, 276, 788, 148, 660, 404, 916,
+ 84, 596, 340, 852, 212, 724, 468, 980,
+ 52, 564, 308, 820, 180, 692, 436, 948,
+ 116, 628, 372, 884, 244, 756, 500, 1012,
+ 12, 524, 268, 780, 140, 652, 396, 908,
+ 76, 588, 332, 844, 204, 716, 460, 972,
+ 44, 556, 300, 812, 172, 684, 428, 940,
+ 108, 620, 364, 876, 236, 748, 492, 1004,
+ 28, 540, 284, 796, 156, 668, 412, 924,
+ 92, 604, 348, 860, 220, 732, 476, 988,
+ 60, 572, 316, 828, 188, 700, 444, 956,
+ 124, 636, 380, 892, 252, 764, 508, 1020,
+ 2, 514, 258, 770, 130, 642, 386, 898,
+ 66, 578, 322, 834, 194, 706, 450, 962,
+ 34, 546, 290, 802, 162, 674, 418, 930,
+ 98, 610, 354, 866, 226, 738, 482, 994,
+ 18, 530, 274, 786, 146, 658, 402, 914,
+ 82, 594, 338, 850, 210, 722, 466, 978,
+ 50, 562, 306, 818, 178, 690, 434, 946,
+ 114, 626, 370, 882, 242, 754, 498, 1010,
+ 10, 522, 266, 778, 138, 650, 394, 906,
+ 74, 586, 330, 842, 202, 714, 458, 970,
+ 42, 554, 298, 810, 170, 682, 426, 938,
+ 106, 618, 362, 874, 234, 746, 490, 1002,
+ 26, 538, 282, 794, 154, 666, 410, 922,
+ 90, 602, 346, 858, 218, 730, 474, 986,
+ 58, 570, 314, 826, 186, 698, 442, 954,
+ 122, 634, 378, 890, 250, 762, 506, 1018,
+ 6, 518, 262, 774, 134, 646, 390, 902,
+ 70, 582, 326, 838, 198, 710, 454, 966,
+ 38, 550, 294, 806, 166, 678, 422, 934,
+ 102, 614, 358, 870, 230, 742, 486, 998,
+ 22, 534, 278, 790, 150, 662, 406, 918,
+ 86, 598, 342, 854, 214, 726, 470, 982,
+ 54, 566, 310, 822, 182, 694, 438, 950,
+ 118, 630, 374, 886, 246, 758, 502, 1014,
+ 14, 526, 270, 782, 142, 654, 398, 910,
+ 78, 590, 334, 846, 206, 718, 462, 974,
+ 46, 558, 302, 814, 174, 686, 430, 942,
+ 110, 622, 366, 878, 238, 750, 494, 1006,
+ 30, 542, 286, 798, 158, 670, 414, 926,
+ 94, 606, 350, 862, 222, 734, 478, 990,
+ 62, 574, 318, 830, 190, 702, 446, 958,
+ 126, 638, 382, 894, 254, 766, 510, 1022
+};
+
+const Word16 Gamma_19661_Tbl_fx[] = {
+ 19661, 11797, 7078, 4247, 2548, 1529, 917, 550, 330, 198, 119, 71, 43, 26, 16, 10
+}; /*Q15 */
+
+const Word16 Gamma_29491_Tbl[] = {
+ 29491, 26542, 23888, 21499, 19349, 17414, 15672, 14105,
+ 12694, 11425, 10282, 9254, 8329, 7496, 6746, 6071
+}; // Q15
+
+/*---------------------------------------------------------------------*
+ * NB post-filter tables
+ *---------------------------------------------------------------------*/
+
+const Word16 tab_hup_s_fx[SIZ_TAB_HUP_S] = { // Q15
+ -188, 2873, 31650, -1597, -484, 7041, 28469, -2147, -933, 12266,
+ 23705, -1992, -1492, 18050, 18050, -1492, -1992, 23705, 12266, -933,
+ -2147, 28469, 7041, -484, -1597, 31650, 2873, -188
+};
+
+const Word16 tab_hup_l_fx[SIZ_TAB_HUP_L] = { // Q15
+ -40, 72, -156, 315, -579, 1023, -1874, 4439,
+ 31915, -3390, 1595, -887, 501, -266, 130, -59,
+ -77, 147, -317, 631, -1150, 2030, -3773, 9639,
+ 29436, -5579, 2727, -1527, 859, -453, 218, -101,
+ -106, 212, -455, 892, -1614, 2850, -5392, 15206,
+ 25569, -6549, 3303, -1860, 1041, -543, 258, -122,
+ -123, 253, -538, 1044, -1876, 3319, -6414, 20676,
+ 20676, -6414, 3319, -1876, 1044, -538, 253, -123,
+ -122, 258, -543, 1041, -1860, 3303, -6549, 25569,
+ 15206, -5392, 2850, -1614, 892, -455, 212, -106,
+ -101, 218, -453, 859, -1527, 2727, -5579, 29436,
+ 9639, -3773, 2030, -1150, 631, -317, 147, -77,
+ -59, 130, -266, 501, -887, 1595, -3390, 31915,
+ 4439, -1874, 1023, -579, 315, -156, 72, -40
+};
+
+const Word16 mfreq_loc_Q2fx[] = { 700, 1500, 3100, 4700, 6300, 7900, 9500, 11100, 12700, 14300, 15900, 17500, 19100, 20700, 22300, 25500, 28700, 31900 }; // Q0
+const Word16 mfreq_loc_div_25[] = { 7, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 255, 287, 319 }; // Q0
+
+// low_rate_band_att_fx.c
+/* %* lowered Table ROM, call with band_len_idx[sfm_size>>3] */
+/* % sfms =[ 8, 16, 24, 32, 48, 64, 80, 96 ], */
+/* sfm/8= [ 1 2 3 4 6 8 10 12]; */
+/* % idx= 0 1 2 3 4 5 6 7; */
+/* call with band_len_idx[sfm_size>>3] */
+const Word16 band_len_idx[1 + ( MAX_SFM_LEN_FX / 8 )] = {
+ // Q0
+ /*sfm/8*/ /*1*/ /*2 */ /*3 */ /*4 */ /*6 */ /*8 */ /*10*/ /*12*/
+ -1, 0 /*8*/, 1 /*16*/, 2 /*24*/, 3 /*32*/, -1, 4 /*48 */, -1, 5 /*64 */, -1, 6 /*80*/, -1, 7 /*96*/
+};
+const Word16 band_len_ener_shift[8] = { 1, 2, 2, 2, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; /* 96 requires 1 bit more than 48 */ // Q0
+/*% sfms=[8,16,24,32,48,64,80,96], round(sqrt(sfms)*2^11) */
+const Word16 fine_gain_pred_sqrt_bw[8] = { 5793, 8192, 10033, 11585, 14189, 16384, 18318, 20066 }; /* (Q11) */
+const Word16 ivas_band_len_idx[1 + ( MAX_SFM_LEN_FX / 8 )] = {
+ /*sfm/8*/ /*1*/ /*2 */ /*3 */ /*4 */ /*6 */ /*8 */ /*10*/ /*12*/
+ -1, 0 /*8*/, 1 /*16*/, 2 /*24*/, 3 /*32*/, 4 /*40*/, 5 /*48 */, -1, 6 /*64 */, -1, 7 /*80*/, -1, 8 /*96*/
+}; // Q0
+const Word16 ivas_band_len_ener_shift[9] = { 1, 2, 2, 2, 3, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; // Q0 /* 96 requires 1 bit more than 48 */
+const Word16 ivas_fine_gain_pred_sqrt_bw[9] = { 5793, 8192, 10033, 11585, 12953, 14189, 16384, 18318, 20066 }; /* (Q11) */
+/*% sfms=[8,16,24,32,40,48,64,80,96], round(sqrt(sfms)*2^11) */
+/*----------------------------------------------------------------------------------*
+ * means of ISFs for WB active speech
+ *----------------------------------------------------------------------------------*/
+const Word16 Mean_isf_wb[M] = /* G722.2 active speech ISF's means Q2.56*/
+ {
+ 738, 1326, 2336, 3578, 4596, 5662, 6711, 7730,
+ 8750, 9753, 10705, 11728, 12833, 13971, 15043, 4037
+ };
+
+const Word16 lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = {
+ /*Q15 */
+ 0,
+ 1638,
+ 3277,
+ 4915,
+ 6554,
+ 8192,
+ 9830,
+ 11469,
+ 13107,
+ 14746
+};
+
+const Word16 lsp_shb_prev_tbl_swb_tbe_enc_fx[LPC_SHB_ORDER] = {
+ // Q15
+ 32767,
+ 31165,
+ 26509,
+ 19262,
+ 10123,
+ 0,
+ -10124,
+ -19261,
+ -26509,
+ -31166,
+};
+
+const Word16 ivas_lsp_shb_prev_tbl_fx[LPC_SHB_ORDER] = {
+ /* Q15 */
+ 1489,
+ 2979,
+ 4468,
+ 5958,
+ 7447,
+ 8937,
+ 10426,
+ 11916,
+ 13405,
+ 14895
+};
+
+/* These words are subtracted from high/low/value with a shift left by 1. */
+/* The value 0x0CCC should never be referenced, low is less/equal high */
+/* The value 0x0BBB should never be referenced, loop must break instead. */
+/* Refer to this table with indices: tab_ari_qnew[msb_high][msb_low] */
+const Word16 tab_ari_qnew[4][4] = { { 0x0000, 0x0CCC, 0x0CCC, 0x0CCC },
+ { 0x0000, 0x0000, 0x0CCC, 0x0CCC },
+ { 0x0BBB, 0x2000, 0x4000, 0x0CCC },
+ { 0x0BBB, 0x0BBB, 0x4000, 0x4000 } };
+
+const Word16 phs_tbl_dec[64 * 2] = { // Q15
+ /* part of table that is not scaled by 2 */
+ 16384, 0, 16305, -1606, 16069, -3196, 15678, -4756, 15136, -6270,
+ 14449, -7723, 13622, -9102, 12665, -10394, 11585, -11585, 10394, -12665,
+ 9102, -13622, 7723, -14449, 6270, -15136, 4756, -15678, 3196, -16069,
+ 1606, -16305, 0, -16384, -1606, -16305, -3196, -16069, -4756, -15678,
+ -6270, -15136, -7723, -14449, -9102, -13622, -10394, -12665, -11585, -11585,
+ -12665, -10394, -13622, -9102, -14449, -7723, -15136, -6270, -15678, -4756,
+ -16069, -3196, -16305, -1606,
+ /* part of table that is scaled by 2 (this save one operation in FFT inner loops) */
+ 32767, 0, 32610, -3212, 32138, -6392, 31356, -9512, 30272, -12540,
+ 28898, -15446, 27244, -18204, 25330, -20788, 23170, -23170, 20788, -25330,
+ 18204, -27244, 15446, -28898, 12540, -30272, 9512, -31356, 6392, -32138,
+ 3212, -32610, 0, -32768, -3212, -32610, -6392, -32138, -9512, -31356,
+ -12540, -30272, -15446, -28898, -18204, -27244, -20788, -25330, -23170, -23170,
+ -25330, -20788, -27244, -18204, -28898, -15446, -30272, -12540, -31356, -9512,
+ -32138, -6392, -32610, -3212
+};
+
+/* 2.0 - 6.4 kHz phase dispersion */
+const Word16 Low_H_phasedisp[L_SUBFR] = { // Q15
+ 16389, 16381, 16386, 16382, 16382, 16383, 16381, 16384, 16385, 10265,
+ 10154, 9894, 14052, 16343, -531, 13216, 16373, 15510, 9407, 15949,
+ 4726, 14593, 10404, 9796, -16336, -1815, -10623, 12647, 14556, -12683,
+ 11389, 8176, 16382, -14197, 11781, 10379, 7516, 10424, -12472, 16285,
+ -1200, -13137, 12659, -7446, 15684, -3763, -13418, -5280, 521, -9685,
+ -16375, -1219, 8436, -13059, -12861, -12775, 0, 3, 0, -2,
+ -1, -1, -1, 2
+};
+
+/* 3.2 - 6.4 kHz phase dispersion */
+const Word16 Mid_H_phasedisp[L_SUBFR] = { // Q15
+ 16382, 16382, 16384, 16385, 16386, 16388, 16387, 16383, 16387, 16383,
+ 16386, 16386, 16386, 16384, 16382, 16388, 14847, 9629, 13249, 14487,
+ 10995, 643, 13818, 13779, 6468, 8665, 11634, 9781, -14636, -982,
+ 11746, -722, 16386, -16365, -11422, 16354, 7363, 13148, -11538, -13903,
+ -15051, -8862, 8812, -16371, -12146, 7661, -9637, -13253, -6922, 4,
+ -4, -1, -5, 1, 7, 6, -7, -1, 4, -4,
+ 0, -1, -3, 3
+};
+
+// ACcontextMapping_dec_fx.c
+const Word16 Tab_esc_nb[4] = { 0 << ( NBITS_CONTEXT + NBITS_RATEQ ),
+ 1 << ( NBITS_CONTEXT + NBITS_RATEQ ),
+ 2 << ( NBITS_CONTEXT + NBITS_RATEQ ),
+ 3 << ( NBITS_CONTEXT + NBITS_RATEQ ) }; // Q0
+
+const Word16 pow2tab[15] = { 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; // Q0
+const Word32 pow2[] = { // Q0
+ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576
+};
+// d_gain2p.c
+const Word16 Es_pred_qua[8] = {
+ 1521 /* 5.9422f Q8*/,
+ 3909 /*15.2711f Q8*/,
+ 5987 /*23.3857f Q8*/,
+ 7816 /*30.5310f Q8*/,
+ 9477 /*37.0190f Q8*/,
+ 11124 /*43.4539f Q8*/,
+ 12863 /*50.2442f Q8*/,
+ 15031 /*58.7164f Q8*/
+};
+
+const Word16 Es_pred_qua_2[16] = {
+ -1280 /*-5.f Q8*/,
+ 0 /* 0.f Q8*/,
+ 1280 /* 5.f Q8*/,
+ 2560 /*10.f Q8*/,
+ 3840 /*15.f Q8*/,
+ 5120 /*20.f Q8*/,
+ 6400 /*25.f Q8*/,
+ 7680 /*30.f Q8*/,
+ 8960 /*35.f Q8*/,
+ 10240 /*40.f Q8*/,
+ 11520 /*45.f Q8*/,
+ 12800 /*50.f Q8*/,
+ 14080 /*55.f Q8*/,
+ 15360 /*60.f Q8*/,
+ 16640 /*65.f Q8*/,
+ 17920 /*70.f Q8*/
+};
+const Word16 T_DIV_L_Frame[] = /*0Q15 * 2^-7 */
+ {
+ 26214 /*160*/
+ ,
+ 16384 /*256*/
+ ,
+ 13107 /*320*/
+ ,
+ 8738 /*480*/
+ ,
+ 8192 /*512*/
+ ,
+ 6553 /*640*/
+ };
+
+/* order 8 LPF for nelp frames when non-native sampling freq inputs used with -max_band NB */
+/* used to suppress frequencies above 4kHz present at the output of filters in pre_proc() */
+
+const Word16 num_nelp_lp_fx[NELP_LP_ORDER + 1] = /*Q13*/
+ {
+ 727,
+ 3506,
+ 8988,
+ 15029,
+ 17732,
+ 15022,
+ 8979,
+ 3501,
+ 726
+ };
+
+const Word16 den_nelp_lp_fx[NELP_LP_ORDER + 1] = { // Q13
+ 8192,
+ 8819,
+ 21618,
+ 12167,
+ 15902,
+ 3553,
+ 3998,
+ -120,
+ 353
+};
+
+/*----------------------------------------------------------------------------------*
+ * AMR-WB IO WB BWE - band-pass 6-8kHz FIR filter, values in Q15:
+ *----------------------------------------------------------------------------------*/
+const Word16 fir_6k_8k_fx[31] = { // Q15
+ 44, -155, 323, -482, 563, -590, 726, -1180, 1986, -2818, 3028,
+ -1991, -423, 3583, -6281, 7342, -6281, 3583, -423, -1991, 3028,
+ -2818, 1986, -1180, 726, -590, 563, -482, 323, -155, 44
+};
+
+const Word16 pwf78_fx[17] = { 25559, 19936, 15550, 12129, 9460, 7379, 5755, 4489,
+ 3501, 2731, 2130, 1661, 1296, 1011, 788, 615,
+ 479 }; /* 0.78^i (i=1,...,17), Q15 */
+
+/*------------------------------------------------------------------------------*
+ * lag window for windowing the autocorrelations in LP analysis
+ * Used in lib_enc\analy_lp_fx.c
+ *------------------------------------------------------------------------------*/
+const Word16 hamcos_window_fx[L_LP_AMR_WB] = { // Q15
+ 2621, 2622, 2626, 2632, 2640, 2650, 2662, 2677,
+ 2694, 2714, 2735, 2759, 2785, 2814, 2844, 2877,
+ 2912, 2949, 2989, 3031, 3075, 3121, 3169, 3220,
+ 3273, 3328, 3385, 3444, 3506, 3569, 3635, 3703,
+ 3773, 3845, 3919, 3996, 4074, 4155, 4237, 4321,
+ 4408, 4496, 4587, 4680, 4774, 4870, 4969, 5069,
+ 5171, 5275, 5381, 5489, 5599, 5710, 5824, 5939,
+ 6056, 6174, 6295, 6417, 6541, 6666, 6793, 6922,
+ 7052, 7185, 7318, 7453, 7590, 7728, 7868, 8009,
+ 8152, 8296, 8442, 8589, 8737, 8887, 9038, 9191,
+ 9344, 9499, 9655, 9813, 9971, 10131, 10292, 10454,
+ 10617, 10781, 10946, 11113, 11280, 11448, 11617, 11787,
+ 11958, 12130, 12303, 12476, 12650, 12825, 13001, 13178,
+ 13355, 13533, 13711, 13890, 14070, 14250, 14431, 14612,
+ 14793, 14975, 15158, 15341, 15524, 15708, 15891, 16076,
+ 16260, 16445, 16629, 16814, 16999, 17185, 17370, 17555,
+ 17740, 17926, 18111, 18296, 18481, 18666, 18851, 19036,
+ 19221, 19405, 19589, 19773, 19956, 20139, 20322, 20504,
+ 20686, 20867, 21048, 21229, 21408, 21588, 21767, 21945,
+ 22122, 22299, 22475, 22651, 22825, 22999, 23172, 23344,
+ 23516, 23686, 23856, 24025, 24192, 24359, 24525, 24689,
+ 24853, 25016, 25177, 25337, 25496, 25654, 25811, 25967,
+ 26121, 26274, 26426, 26576, 26725, 26873, 27019, 27164,
+ 27308, 27450, 27590, 27729, 27867, 28003, 28137, 28270,
+ 28401, 28531, 28659, 28785, 28910, 29033, 29154, 29274,
+ 29391, 29507, 29622, 29734, 29845, 29953, 30060, 30165,
+ 30268, 30370, 30469, 30566, 30662, 30755, 30847, 30936,
+ 31024, 31109, 31193, 31274, 31354, 31431, 31506, 31579,
+ 31651, 31719, 31786, 31851, 31914, 31974, 32032, 32088,
+ 32142, 32194, 32243, 32291, 32336, 32379, 32419, 32458,
+ 32494, 32528, 32560, 32589, 32617, 32642, 32664, 32685,
+ 32703, 32719, 32733, 32744, 32753, 32760, 32764, 32767,
+ 32767, 32765, 32757, 32745, 32727, 32705, 32678, 32646,
+ 32609, 32567, 32520, 32468, 32411, 32349, 32283, 32211,
+ 32135, 32054, 31968, 31877, 31781, 31681, 31575, 31465,
+ 31351, 31231, 31107, 30978, 30844, 30706, 30563, 30415,
+ 30263, 30106, 29945, 29779, 29609, 29434, 29255, 29071,
+ 28883, 28691, 28494, 28293, 28087, 27878, 27664, 27446,
+ 27224, 26997, 26767, 26533, 26294, 26052, 25806, 25555,
+ 25301, 25043, 24782, 24516, 24247, 23974, 23698, 23418,
+ 23134, 22847, 22557, 22263, 21965, 21665, 21361, 21054,
+ 20743, 20430, 20113, 19794, 19471, 19146, 18817, 18486,
+ 18152, 17815, 17476, 17134, 16789, 16442, 16092, 15740,
+ 15385, 15028, 14669, 14308, 13944, 13579, 13211, 12841,
+ 12470, 12096, 11721, 11344, 10965, 10584, 10202, 9819,
+ 9433, 9047, 8659, 8270, 7879, 7488, 7095, 6701,
+ 6306, 5910, 5514, 5116, 4718, 4319, 3919, 3519,
+ 3118, 2716, 2315, 1913, 1510, 1108, 705, 302
+};
+
+
+const Word16 CNG_burst_att_fx[6][8] = { // Q15
+ { 30076, 27793, 25832, 24129, 22637, 21319, 20146, 19095 },
+ { 29714, 27181, 25046, 23222, 21646, 20270, 20205, 20205 },
+ { 29415, 26685, 24418, 22506, 22410, 22410, 22410, 22410 },
+ { 29310, 26512, 24201, 23198, 23198, 23198, 23198, 23198 },
+ { 29310, 26512, 24201, 23198, 23198, 23198, 23198, 23198 },
+ { 29789, 27307, 25206, 23406, 21845, 20480, 19661, 19661 }
+};
+
+const Word16 lpc_weights_fx[LPC_SHB_ORDER + 1] = { // Q15
+ 32767, 31948, 31150, 30371, 29612,
+ 28871, 28149, 27446, 26760, 26091, 25438
+};
+
+const Word16 SHBCB_SubGain5bit_12_fx[128] = {
+ /*Q12 */
+ -597,
+ -1952,
+ -1644,
+ -1506,
+ -1767,
+ -1357,
+ -1249,
+ -874,
+ -4181,
+ -3836,
+ -240,
+ -1985,
+ -6573,
+ -1480,
+ -1229,
+ -1094,
+ -381,
+ -1655,
+ -2119,
+ -2406,
+ -2012,
+ -1022,
+ -2235,
+ -761,
+ -908,
+ -1282,
+ -1241,
+ -1845,
+ -68,
+ -4666,
+ -6058,
+ -6355,
+ -2311,
+ -1888,
+ -1396,
+ -513,
+ -523,
+ -1155,
+ -2300,
+ -3657,
+ -1161,
+ -549,
+ -2564,
+ -2424,
+ -609,
+ -2346,
+ -2934,
+ -1142,
+ -3591,
+ -2859,
+ -2063,
+ -205,
+ -4048,
+ -4083,
+ -4261,
+ -56,
+ -1352,
+ -2147,
+ -1894,
+ -574,
+ -6577,
+ -5483,
+ -1881,
+ -628,
+ -815,
+ -1061,
+ -1987,
+ -1654,
+ -455,
+ -1380,
+ -3818,
+ -4941,
+ -926,
+ -934,
+ -1463,
+ -2630,
+ -2520,
+ -1013,
+ -1016,
+ -1250,
+ -977,
+ -2477,
+ -720,
+ -2401,
+ -130,
+ -2789,
+ -3155,
+ -3192,
+ -1135,
+ -1287,
+ -1552,
+ -1115,
+ -1217,
+ -1918,
+ -1059,
+ -1102,
+ -2291,
+ -3353,
+ -744,
+ -979,
+ -3067,
+ -1892,
+ -961,
+ -707,
+ -1795,
+ -1229,
+ -652,
+ -2348,
+ -1569,
+ -717,
+ -1490,
+ -1628,
+ -3240,
+ -258,
+ -2129,
+ -2748,
+ -2062,
+ -1902,
+ -625,
+ -1257,
+ -1453,
+ -1250,
+ -965,
+ -1445,
+ -4227,
+ -1494,
+ -1108,
+ -819,
+
+
+};
+
+
+const Word16 E_ROM_inter4_1_fx[UP_SAMP * L_INTERPOL1 + 1] = {
+ /* cut-off frequency at 0.9*fs/2 */
+ 14746 /*0.900000F Q14*/,
+ 13418 /*0.818959F Q14*/, 9910 /*0.604850F Q14*/, 5429 /*0.331379F Q14*/, 1376 /*0.083958F Q14*/,
+ -1242 /*-0.075795F Q14*/, -2142 /*-0.130717F Q14*/, -1732 /*-0.105685F Q14*/, -766 /*-0.046774F Q14*/,
+ 73 /*0.004467F Q14*/, 455 /*0.027789F Q14*/, 420 /*0.025642F Q14*/, 206 /*0.012571F Q14*/,
+ 32 /*0.001927F Q14*/, -26 /*-0.001571F Q14*/, -12 /*-0.000753F Q14*/, 0 /*0.000000f Q14*/
+};
+const Word16 E_ROM_inter6_1_fx[PIT_UP_SAMP6 * L_INTERPOL1 + 1] = {
+ 14759 /*0.900848F Q14*/,
+ 14158 /*0.864136F Q14*/,
+ 12453 /*0.760071F Q14*/,
+ 9919 /*0.605408F Q14*/,
+ 6948 /*0.424072F Q14*/,
+ 3972 /*0.242462F Q14*/,
+ 1377 /*0.0840759F Q14*/,
+ -563 /*-0.0343933F Q14*/,
+ -1729 /*-0.105560F Q14*/,
+ -2152 /*-0.131348F Q14*/,
+ -1984 /*-0.121124F Q14*/,
+ -1450 /*-0.0884705F Q14*/,
+ -780 /*-0.0476379F Q14*/,
+ -168 /*-0.0102539F Q14*/,
+ 267 /*0.0162964F Q14*/,
+ 485 /*0.0296021F Q14*/,
+ 512 /*0.0312195F Q14*/,
+ 412 /*0.0251160F Q14*/,
+ 258 /*0.0157471F Q14*/,
+ 110 /*0.00671387F Q14*/,
+ 0 /*0.000000F Q14*/,
+ -65 /*-0.00399780F Q14*/,
+ -97 /*-0.00592041F Q14*/,
+ -108 /*-0.00656128F Q14*/,
+ 0 /*0.000000F Q14*/
+};
+const Word16 kLog2TableFrac_x[256] = { // Q8
+ 0, 1, 3, 4, 6, 7, 9, 10,
+ 11, 13, 14, 16, 17, 18, 20, 21,
+ 22, 24, 25, 26, 28, 29, 30, 32,
+ 33, 34, 36, 37, 38, 40, 41, 42,
+ 44, 45, 46, 47, 49, 50, 51, 52,
+ 54, 55, 56, 57, 59, 60, 61, 62,
+ 63, 65, 66, 67, 68, 69, 71, 72,
+ 73, 74, 75, 77, 78, 79, 80, 81,
+ 82, 84, 85, 86, 87, 88, 89, 90,
+ 92, 93, 94, 95, 96, 97, 98, 99,
+ 100, 102, 103, 104, 105, 106, 107, 108,
+ 109, 110, 111, 112, 113, 114, 116, 117,
+ 118, 119, 120, 121, 122, 123, 124, 125,
+ 126, 127, 128, 129, 130, 131, 132, 133,
+ 134, 135, 136, 137, 138, 139, 140, 141,
+ 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 155, 155, 156,
+ 157, 158, 159, 160, 161, 162, 163, 164,
+ 165, 166, 167, 168, 169, 169, 170, 171,
+ 172, 173, 174, 175, 176, 177, 178, 178,
+ 179, 180, 181, 182, 183, 184, 185, 185,
+ 186, 187, 188, 189, 190, 191, 192, 192,
+ 193, 194, 195, 196, 197, 198, 198, 199,
+ 200, 201, 202, 203, 203, 204, 205, 206,
+ 207, 208, 208, 209, 210, 211, 212, 212,
+ 213, 214, 215, 216, 216, 217, 218, 219,
+ 220, 220, 221, 222, 223, 224, 224, 225,
+ 226, 227, 228, 228, 229, 230, 231, 231,
+ 232, 233, 234, 234, 235, 236, 237, 238,
+ 238, 239, 240, 241, 241, 242, 243, 244,
+ 244, 245, 246, 247, 247, 248, 249, 249,
+ 250, 251, 252, 252, 253, 254, 255, 255
+};
+
+const Word16 kExp2TableFrac_x[256] = /* Q15 */
+ {
+ 32767, 32678, 32590, 32502, 32414, 32326, 32239, 32152,
+ 32065, 31978, 31892, 31805, 31719, 31634, 31548, 31463,
+ 31378, 31293, 31208, 31124, 31040, 30956, 30872, 30789,
+ 30705, 30622, 30540, 30457, 30375, 30293, 30211, 30129,
+ 30047, 29966, 29885, 29804, 29724, 29643, 29563, 29483,
+ 29404, 29324, 29245, 29166, 29087, 29008, 28930, 28852,
+ 28774, 28696, 28618, 28541, 28464, 28387, 28310, 28233,
+ 28157, 28081, 28005, 27929, 27854, 27778, 27703, 27628,
+ 27554, 27479, 27405, 27331, 27257, 27183, 27110, 27036,
+ 26963, 26890, 26818, 26745, 26673, 26601, 26529, 26457,
+ 26385, 26314, 26243, 26172, 26101, 26031, 25960, 25890,
+ 25820, 25750, 25681, 25611, 25542, 25473, 25404, 25335,
+ 25267, 25198, 25130, 25062, 24995, 24927, 24860, 24792,
+ 24725, 24659, 24592, 24525, 24459, 24393, 24327, 24261,
+ 24196, 24130, 24065, 24000, 23935, 23870, 23806, 23741,
+ 23677, 23613, 23549, 23486, 23422, 23359, 23296, 23233,
+ 23170, 23107, 23045, 22982, 22920, 22858, 22796, 22735,
+ 22673, 22612, 22551, 22490, 22429, 22368, 22308, 22248,
+ 22187, 22127, 22068, 22008, 21948, 21889, 21830, 21771,
+ 21712, 21653, 21595, 21536, 21478, 21420, 21362, 21304,
+ 21247, 21189, 21132, 21075, 21018, 20961, 20904, 20848,
+ 20791, 20735, 20679, 20623, 20568, 20512, 20456, 20401,
+ 20346, 20291, 20236, 20181, 20127, 20072, 20018, 19964,
+ 19910, 19856, 19802, 19749, 19696, 19642, 19589, 19536,
+ 19483, 19431, 19378, 19326, 19274, 19221, 19169, 19118,
+ 19066, 19014, 18963, 18912, 18861, 18810, 18759, 18708,
+ 18657, 18607, 18557, 18506, 18456, 18406, 18357, 18307,
+ 18258, 18208, 18159, 18110, 18061, 18012, 17963, 17915,
+ 17866, 17818, 17770, 17722, 17674, 17626, 17578, 17531,
+ 17483, 17436, 17389, 17342, 17295, 17248, 17202, 17155,
+ 17109, 17063, 17016, 16970, 16925, 16879, 16833, 16788,
+ 16742, 16697, 16652, 16607, 16562, 16517, 16472, 16428
+ };
+
+/*-------------------------------------------------------------------*
+ * inverse (reciprocal) of integer, used in FEC_fx.c, pitch_extr and in pitchDoubling_det
+ * 1/n = One_div[n-1]
+ *-------------------------------------------------------------------*/
+const Word16 One_div_fx[] = /* in Q15 */
+ {
+ 32767, /* 1/1 */
+ 16384, /* 1/2 */
+ 10923, /* 1/3 */
+ 8192, /* 1/4 */
+ 6554, /* 1/5 */
+ 5461, /* 1/6 */
+ 4681, /* 1/7 */
+ 4096 /* 1/8 */
+ };
+
+const Word32 tbl_two_pow_shift_by_4[35] = { // Q30
+ 1073741824, 902905664, 759250112, 638450688, 536870912, 451452832, 379625056, 319225344,
+ 268435456, 225726416, 189812528, 159612672, 134217728, 112863208, 94906264, 79806336,
+ 67108864, 56431604, 47453132, 39903168, 33554432, 28215802, 23726566, 19951584,
+ 16777216, 14107901, 11863283, 9975792, 8388608, 7053950, 5931641, 4987896,
+ 4194304, 3526975, 2965820
+};
+
+
+const Word16 ivas_tan_panning_gain_tbl_fx[601] = { // Q15
+ SHC( 0x0000 ), SHC( 0x0042 ), SHC( 0x0084 ), SHC( 0x00c6 ), SHC( 0x0109 ), SHC( 0x014b ), SHC( 0x018e ), SHC( 0x01d1 ),
+ SHC( 0x0214 ), SHC( 0x0257 ), SHC( 0x029b ), SHC( 0x02de ), SHC( 0x0322 ), SHC( 0x0365 ), SHC( 0x03a9 ), SHC( 0x03ed ),
+ SHC( 0x0431 ), SHC( 0x0475 ), SHC( 0x04ba ), SHC( 0x04fe ), SHC( 0x0543 ), SHC( 0x0588 ), SHC( 0x05cd ), SHC( 0x0612 ),
+ SHC( 0x0657 ), SHC( 0x069c ), SHC( 0x06e1 ), SHC( 0x0727 ), SHC( 0x076d ), SHC( 0x07b2 ), SHC( 0x07f8 ), SHC( 0x083e ),
+ SHC( 0x0885 ), SHC( 0x08cb ), SHC( 0x0911 ), SHC( 0x0958 ), SHC( 0x099f ), SHC( 0x09e6 ), SHC( 0x0a2d ), SHC( 0x0a74 ),
+ SHC( 0x0abb ), SHC( 0x0b02 ), SHC( 0x0b4a ), SHC( 0x0b91 ), SHC( 0x0bd9 ), SHC( 0x0c21 ), SHC( 0x0c69 ), SHC( 0x0cb1 ),
+ SHC( 0x0cf9 ), SHC( 0x0d42 ), SHC( 0x0d8a ), SHC( 0x0dd3 ), SHC( 0x0e1c ), SHC( 0x0e65 ), SHC( 0x0eae ), SHC( 0x0ef7 ),
+ SHC( 0x0f40 ), SHC( 0x0f89 ), SHC( 0x0fd3 ), SHC( 0x101d ), SHC( 0x1066 ), SHC( 0x10b0 ), SHC( 0x10fa ), SHC( 0x1144 ),
+ SHC( 0x118f ), SHC( 0x11d9 ), SHC( 0x1223 ), SHC( 0x126e ), SHC( 0x12b9 ), SHC( 0x1304 ), SHC( 0x134f ), SHC( 0x139a ),
+ SHC( 0x13e5 ), SHC( 0x1430 ), SHC( 0x147c ), SHC( 0x14c7 ), SHC( 0x1513 ), SHC( 0x155f ), SHC( 0x15aa ), SHC( 0x15f6 ),
+ SHC( 0x1643 ), SHC( 0x168f ), SHC( 0x16db ), SHC( 0x1728 ), SHC( 0x1774 ), SHC( 0x17c1 ), SHC( 0x180e ), SHC( 0x185a ),
+ SHC( 0x18a7 ), SHC( 0x18f5 ), SHC( 0x1942 ), SHC( 0x198f ), SHC( 0x19dd ), SHC( 0x1a2a ), SHC( 0x1a78 ), SHC( 0x1ac5 ),
+ SHC( 0x1b13 ), SHC( 0x1b61 ), SHC( 0x1baf ), SHC( 0x1bfd ), SHC( 0x1c4c ), SHC( 0x1c9a ), SHC( 0x1ce8 ), SHC( 0x1d37 ),
+ SHC( 0x1d86 ), SHC( 0x1dd4 ), SHC( 0x1e23 ), SHC( 0x1e72 ), SHC( 0x1ec1 ), SHC( 0x1f10 ), SHC( 0x1f5f ), SHC( 0x1faf ),
+ SHC( 0x1ffe ), SHC( 0x204d ), SHC( 0x209d ), SHC( 0x20ed ), SHC( 0x213c ), SHC( 0x218c ), SHC( 0x21dc ), SHC( 0x222c ),
+ SHC( 0x227c ), SHC( 0x22cc ), SHC( 0x231c ), SHC( 0x236d ), SHC( 0x23bd ), SHC( 0x240e ), SHC( 0x245e ), SHC( 0x24af ),
+ SHC( 0x24ff ), SHC( 0x2550 ), SHC( 0x25a1 ), SHC( 0x25f2 ), SHC( 0x2643 ), SHC( 0x2694 ), SHC( 0x26e5 ), SHC( 0x2736 ),
+ SHC( 0x2787 ), SHC( 0x27d9 ), SHC( 0x282a ), SHC( 0x287b ), SHC( 0x28cd ), SHC( 0x291e ), SHC( 0x2970 ), SHC( 0x29c2 ),
+ SHC( 0x2a13 ), SHC( 0x2a65 ), SHC( 0x2ab7 ), SHC( 0x2b09 ), SHC( 0x2b5b ), SHC( 0x2bad ), SHC( 0x2bff ), SHC( 0x2c51 ),
+ SHC( 0x2ca3 ), SHC( 0x2cf5 ), SHC( 0x2d47 ), SHC( 0x2d99 ), SHC( 0x2dec ), SHC( 0x2e3e ), SHC( 0x2e90 ), SHC( 0x2ee3 ),
+ SHC( 0x2f35 ), SHC( 0x2f87 ), SHC( 0x2fda ), SHC( 0x302c ), SHC( 0x307f ), SHC( 0x30d2 ), SHC( 0x3124 ), SHC( 0x3177 ),
+ SHC( 0x31c9 ), SHC( 0x321c ), SHC( 0x326f ), SHC( 0x32c1 ), SHC( 0x3314 ), SHC( 0x3367 ), SHC( 0x33ba ), SHC( 0x340c ),
+ SHC( 0x345f ), SHC( 0x34b2 ), SHC( 0x3505 ), SHC( 0x3557 ), SHC( 0x35aa ), SHC( 0x35fd ), SHC( 0x3650 ), SHC( 0x36a2 ),
+ SHC( 0x36f5 ), SHC( 0x3748 ), SHC( 0x379b ), SHC( 0x37ed ), SHC( 0x3840 ), SHC( 0x3893 ), SHC( 0x38e6 ), SHC( 0x3938 ),
+ SHC( 0x398b ), SHC( 0x39de ), SHC( 0x3a30 ), SHC( 0x3a83 ), SHC( 0x3ad6 ), SHC( 0x3b28 ), SHC( 0x3b7b ), SHC( 0x3bcd ),
+ SHC( 0x3c20 ), SHC( 0x3c72 ), SHC( 0x3cc5 ), SHC( 0x3d17 ), SHC( 0x3d69 ), SHC( 0x3dbc ), SHC( 0x3e0e ), SHC( 0x3e60 ),
+ SHC( 0x3eb2 ), SHC( 0x3f04 ), SHC( 0x3f57 ), SHC( 0x3fa9 ), SHC( 0x3ffb ), SHC( 0x404c ), SHC( 0x409e ), SHC( 0x40f0 ),
+ SHC( 0x4142 ), SHC( 0x4194 ), SHC( 0x41e5 ), SHC( 0x4237 ), SHC( 0x4288 ), SHC( 0x42da ), SHC( 0x432b ), SHC( 0x437c ),
+ SHC( 0x43ce ), SHC( 0x441f ), SHC( 0x4470 ), SHC( 0x44c1 ), SHC( 0x4512 ), SHC( 0x4563 ), SHC( 0x45b3 ), SHC( 0x4604 ),
+ SHC( 0x4654 ), SHC( 0x46a5 ), SHC( 0x46f5 ), SHC( 0x4746 ), SHC( 0x4796 ), SHC( 0x47e6 ), SHC( 0x4836 ), SHC( 0x4886 ),
+ SHC( 0x48d5 ), SHC( 0x4925 ), SHC( 0x4975 ), SHC( 0x49c4 ), SHC( 0x4a13 ), SHC( 0x4a63 ), SHC( 0x4ab2 ), SHC( 0x4b01 ),
+ SHC( 0x4b50 ), SHC( 0x4b9e ), SHC( 0x4bed ), SHC( 0x4c3b ), SHC( 0x4c8a ), SHC( 0x4cd8 ), SHC( 0x4d26 ), SHC( 0x4d74 ),
+ SHC( 0x4dc2 ), SHC( 0x4e10 ), SHC( 0x4e5d ), SHC( 0x4eab ), SHC( 0x4ef8 ), SHC( 0x4f45 ), SHC( 0x4f92 ), SHC( 0x4fdf ),
+ SHC( 0x502c ), SHC( 0x5078 ), SHC( 0x50c4 ), SHC( 0x5111 ), SHC( 0x515d ), SHC( 0x51a9 ), SHC( 0x51f4 ), SHC( 0x5240 ),
+ SHC( 0x528b ), SHC( 0x52d7 ), SHC( 0x5322 ), SHC( 0x536d ), SHC( 0x53b8 ), SHC( 0x5402 ), SHC( 0x544d ), SHC( 0x5497 ),
+ SHC( 0x54e1 ), SHC( 0x552b ), SHC( 0x5574 ), SHC( 0x55be ), SHC( 0x5607 ), SHC( 0x5650 ), SHC( 0x5699 ), SHC( 0x56e2 ),
+ SHC( 0x572b ), SHC( 0x5773 ), SHC( 0x57bb ), SHC( 0x5803 ), SHC( 0x584b ), SHC( 0x5893 ), SHC( 0x58da ), SHC( 0x5921 ),
+ SHC( 0x5968 ), SHC( 0x59af ), SHC( 0x59f5 ), SHC( 0x5a3c ), SHC( 0x5a82 ), SHC( 0x5ac8 ), SHC( 0x5b0e ), SHC( 0x5b53 ),
+ SHC( 0x5b98 ), SHC( 0x5bde ), SHC( 0x5c22 ), SHC( 0x5c67 ), SHC( 0x5cab ), SHC( 0x5cf0 ), SHC( 0x5d34 ), SHC( 0x5d77 ),
+ SHC( 0x5dbb ), SHC( 0x5dfe ), SHC( 0x5e41 ), SHC( 0x5e84 ), SHC( 0x5ec7 ), SHC( 0x5f09 ), SHC( 0x5f4b ), SHC( 0x5f8d ),
+ SHC( 0x5fcf ), SHC( 0x6010 ), SHC( 0x6051 ), SHC( 0x6092 ), SHC( 0x60d3 ), SHC( 0x6113 ), SHC( 0x6153 ), SHC( 0x6193 ),
+ SHC( 0x61d3 ), SHC( 0x6213 ), SHC( 0x6252 ), SHC( 0x6291 ), SHC( 0x62cf ), SHC( 0x630e ), SHC( 0x634c ), SHC( 0x638a ),
+ SHC( 0x63c8 ), SHC( 0x6405 ), SHC( 0x6442 ), SHC( 0x647f ), SHC( 0x64bc ), SHC( 0x64f8 ), SHC( 0x6534 ), SHC( 0x6570 ),
+ SHC( 0x65ac ), SHC( 0x65e7 ), SHC( 0x6622 ), SHC( 0x665d ), SHC( 0x6698 ), SHC( 0x66d2 ), SHC( 0x670c ), SHC( 0x6746 ),
+ SHC( 0x677f ), SHC( 0x67b8 ), SHC( 0x67f1 ), SHC( 0x682a ), SHC( 0x6862 ), SHC( 0x689a ), SHC( 0x68d2 ), SHC( 0x690a ),
+ SHC( 0x6941 ), SHC( 0x6978 ), SHC( 0x69af ), SHC( 0x69e5 ), SHC( 0x6a1c ), SHC( 0x6a52 ), SHC( 0x6a87 ), SHC( 0x6abd ),
+ SHC( 0x6af2 ), SHC( 0x6b26 ), SHC( 0x6b5b ), SHC( 0x6b8f ), SHC( 0x6bc3 ), SHC( 0x6bf7 ), SHC( 0x6c2a ), SHC( 0x6c5d ),
+ SHC( 0x6c90 ), SHC( 0x6cc3 ), SHC( 0x6cf5 ), SHC( 0x6d27 ), SHC( 0x6d59 ), SHC( 0x6d8a ), SHC( 0x6dbb ), SHC( 0x6dec ),
+ SHC( 0x6e1d ), SHC( 0x6e4d ), SHC( 0x6e7d ), SHC( 0x6ead ), SHC( 0x6edc ), SHC( 0x6f0b ), SHC( 0x6f3a ), SHC( 0x6f69 ),
+ SHC( 0x6f97 ), SHC( 0x6fc5 ), SHC( 0x6ff3 ), SHC( 0x7020 ), SHC( 0x704e ), SHC( 0x707a ), SHC( 0x70a7 ), SHC( 0x70d3 ),
+ SHC( 0x70ff ), SHC( 0x712b ), SHC( 0x7157 ), SHC( 0x7182 ), SHC( 0x71ad ), SHC( 0x71d7 ), SHC( 0x7202 ), SHC( 0x722c ),
+ SHC( 0x7255 ), SHC( 0x727f ), SHC( 0x72a8 ), SHC( 0x72d1 ), SHC( 0x72fa ), SHC( 0x7322 ), SHC( 0x734a ), SHC( 0x7372 ),
+ SHC( 0x7399 ), SHC( 0x73c0 ), SHC( 0x73e7 ), SHC( 0x740e ), SHC( 0x7434 ), SHC( 0x745a ), SHC( 0x7480 ), SHC( 0x74a6 ),
+ SHC( 0x74cb ), SHC( 0x74f0 ), SHC( 0x7515 ), SHC( 0x7539 ), SHC( 0x755d ), SHC( 0x7581 ), SHC( 0x75a5 ), SHC( 0x75c8 ),
+ SHC( 0x75eb ), SHC( 0x760e ), SHC( 0x7630 ), SHC( 0x7652 ), SHC( 0x7674 ), SHC( 0x7696 ), SHC( 0x76b7 ), SHC( 0x76d9 ),
+ SHC( 0x76f9 ), SHC( 0x771a ), SHC( 0x773a ), SHC( 0x775a ), SHC( 0x777a ), SHC( 0x779a ), SHC( 0x77b9 ), SHC( 0x77d8 ),
+ SHC( 0x77f6 ), SHC( 0x7815 ), SHC( 0x7833 ), SHC( 0x7851 ), SHC( 0x786e ), SHC( 0x788c ), SHC( 0x78a9 ), SHC( 0x78c6 ),
+ SHC( 0x78e2 ), SHC( 0x78ff ), SHC( 0x791b ), SHC( 0x7937 ), SHC( 0x7952 ), SHC( 0x796d ), SHC( 0x7988 ), SHC( 0x79a3 ),
+ SHC( 0x79be ), SHC( 0x79d8 ), SHC( 0x79f2 ), SHC( 0x7a0c ), SHC( 0x7a25 ), SHC( 0x7a3e ), SHC( 0x7a57 ), SHC( 0x7a70 ),
+ SHC( 0x7a89 ), SHC( 0x7aa1 ), SHC( 0x7ab9 ), SHC( 0x7ad1 ), SHC( 0x7ae8 ), SHC( 0x7aff ), SHC( 0x7b16 ), SHC( 0x7b2d ),
+ SHC( 0x7b44 ), SHC( 0x7b5a ), SHC( 0x7b70 ), SHC( 0x7b86 ), SHC( 0x7b9b ), SHC( 0x7bb1 ), SHC( 0x7bc6 ), SHC( 0x7bdb ),
+ SHC( 0x7bef ), SHC( 0x7c04 ), SHC( 0x7c18 ), SHC( 0x7c2c ), SHC( 0x7c40 ), SHC( 0x7c53 ), SHC( 0x7c66 ), SHC( 0x7c79 ),
+ SHC( 0x7c8c ), SHC( 0x7c9e ), SHC( 0x7cb1 ), SHC( 0x7cc3 ), SHC( 0x7cd5 ), SHC( 0x7ce6 ), SHC( 0x7cf8 ), SHC( 0x7d09 ),
+ SHC( 0x7d1a ), SHC( 0x7d2b ), SHC( 0x7d3b ), SHC( 0x7d4c ), SHC( 0x7d5c ), SHC( 0x7d6b ), SHC( 0x7d7b ), SHC( 0x7d8b ),
+ SHC( 0x7d9a ), SHC( 0x7da9 ), SHC( 0x7db8 ), SHC( 0x7dc6 ), SHC( 0x7dd5 ), SHC( 0x7de3 ), SHC( 0x7df1 ), SHC( 0x7dff ),
+ SHC( 0x7e0c ), SHC( 0x7e19 ), SHC( 0x7e27 ), SHC( 0x7e34 ), SHC( 0x7e40 ), SHC( 0x7e4d ), SHC( 0x7e59 ), SHC( 0x7e65 ),
+ SHC( 0x7e71 ), SHC( 0x7e7d ), SHC( 0x7e89 ), SHC( 0x7e94 ), SHC( 0x7e9f ), SHC( 0x7eaa ), SHC( 0x7eb5 ), SHC( 0x7ebf ),
+ SHC( 0x7eca ), SHC( 0x7ed4 ), SHC( 0x7ede ), SHC( 0x7ee8 ), SHC( 0x7ef1 ), SHC( 0x7efb ), SHC( 0x7f04 ), SHC( 0x7f0d ),
+ SHC( 0x7f16 ), SHC( 0x7f1f ), SHC( 0x7f27 ), SHC( 0x7f30 ), SHC( 0x7f38 ), SHC( 0x7f40 ), SHC( 0x7f48 ), SHC( 0x7f4f ),
+ SHC( 0x7f57 ), SHC( 0x7f5e ), SHC( 0x7f65 ), SHC( 0x7f6c ), SHC( 0x7f73 ), SHC( 0x7f79 ), SHC( 0x7f80 ), SHC( 0x7f86 ),
+ SHC( 0x7f8c ), SHC( 0x7f92 ), SHC( 0x7f98 ), SHC( 0x7f9d ), SHC( 0x7fa3 ), SHC( 0x7fa8 ), SHC( 0x7fad ), SHC( 0x7fb2 ),
+ SHC( 0x7fb7 ), SHC( 0x7fbb ), SHC( 0x7fc0 ), SHC( 0x7fc4 ), SHC( 0x7fc8 ), SHC( 0x7fcc ), SHC( 0x7fd0 ), SHC( 0x7fd4 ),
+ SHC( 0x7fd7 ), SHC( 0x7fdb ), SHC( 0x7fde ), SHC( 0x7fe1 ), SHC( 0x7fe4 ), SHC( 0x7fe7 ), SHC( 0x7fe9 ), SHC( 0x7fec ),
+ SHC( 0x7fee ), SHC( 0x7ff0 ), SHC( 0x7ff2 ), SHC( 0x7ff4 ), SHC( 0x7ff6 ), SHC( 0x7ff7 ), SHC( 0x7ff9 ), SHC( 0x7ffa ),
+ SHC( 0x7ffb ), SHC( 0x7ffc ), SHC( 0x7ffd ), SHC( 0x7ffe ), SHC( 0x7ffe ), SHC( 0x7fff ), SHC( 0x7fff ), SHC( 0x7fff ),
+ SHC( 0x7fff )
+};
+
+const Word16 ivas_sine_panning_tbl_fx[601] = { // Q15
+ SHC( 0xc001 ), SHC( 0xc032 ), SHC( 0xc064 ), SHC( 0xc095 ), SHC( 0xc0c7 ), SHC( 0xc0f9 ), SHC( 0xc12b ), SHC( 0xc15c ),
+ SHC( 0xc18e ), SHC( 0xc1c0 ), SHC( 0xc1f2 ), SHC( 0xc224 ), SHC( 0xc256 ), SHC( 0xc289 ), SHC( 0xc2bb ), SHC( 0xc2ed ),
+ SHC( 0xc31f ), SHC( 0xc352 ), SHC( 0xc384 ), SHC( 0xc3b6 ), SHC( 0xc3e9 ), SHC( 0xc41b ), SHC( 0xc44e ), SHC( 0xc481 ),
+ SHC( 0xc4b3 ), SHC( 0xc4e6 ), SHC( 0xc519 ), SHC( 0xc54b ), SHC( 0xc57e ), SHC( 0xc5b1 ), SHC( 0xc5e4 ), SHC( 0xc617 ),
+ SHC( 0xc64a ), SHC( 0xc67d ), SHC( 0xc6b0 ), SHC( 0xc6e3 ), SHC( 0xc717 ), SHC( 0xc74a ), SHC( 0xc77d ), SHC( 0xc7b1 ),
+ SHC( 0xc7e4 ), SHC( 0xc817 ), SHC( 0xc84b ), SHC( 0xc87e ), SHC( 0xc8b2 ), SHC( 0xc8e6 ), SHC( 0xc919 ), SHC( 0xc94d ),
+ SHC( 0xc981 ), SHC( 0xc9b4 ), SHC( 0xc9e8 ), SHC( 0xca1c ), SHC( 0xca50 ), SHC( 0xca84 ), SHC( 0xcab8 ), SHC( 0xcaec ),
+ SHC( 0xcb20 ), SHC( 0xcb54 ), SHC( 0xcb88 ), SHC( 0xcbbc ), SHC( 0xcbf1 ), SHC( 0xcc25 ), SHC( 0xcc59 ), SHC( 0xcc8d ),
+ SHC( 0xccc2 ), SHC( 0xccf6 ), SHC( 0xcd2b ), SHC( 0xcd5f ), SHC( 0xcd94 ), SHC( 0xcdc8 ), SHC( 0xcdfd ), SHC( 0xce32 ),
+ SHC( 0xce66 ), SHC( 0xce9b ), SHC( 0xced0 ), SHC( 0xcf05 ), SHC( 0xcf3a ), SHC( 0xcf6e ), SHC( 0xcfa3 ), SHC( 0xcfd8 ),
+ SHC( 0xd00d ), SHC( 0xd042 ), SHC( 0xd078 ), SHC( 0xd0ad ), SHC( 0xd0e2 ), SHC( 0xd117 ), SHC( 0xd14c ), SHC( 0xd181 ),
+ SHC( 0xd1b7 ), SHC( 0xd1ec ), SHC( 0xd221 ), SHC( 0xd257 ), SHC( 0xd28c ), SHC( 0xd2c2 ), SHC( 0xd2f7 ), SHC( 0xd32d ),
+ SHC( 0xd362 ), SHC( 0xd398 ), SHC( 0xd3ce ), SHC( 0xd403 ), SHC( 0xd439 ), SHC( 0xd46f ), SHC( 0xd4a5 ), SHC( 0xd4db ),
+ SHC( 0xd510 ), SHC( 0xd546 ), SHC( 0xd57c ), SHC( 0xd5b2 ), SHC( 0xd5e8 ), SHC( 0xd61e ), SHC( 0xd654 ), SHC( 0xd68a ),
+ SHC( 0xd6c0 ), SHC( 0xd6f7 ), SHC( 0xd72d ), SHC( 0xd763 ), SHC( 0xd799 ), SHC( 0xd7d0 ), SHC( 0xd806 ), SHC( 0xd83c ),
+ SHC( 0xd873 ), SHC( 0xd8a9 ), SHC( 0xd8df ), SHC( 0xd916 ), SHC( 0xd94c ), SHC( 0xd983 ), SHC( 0xd9ba ), SHC( 0xd9f0 ),
+ SHC( 0xda27 ), SHC( 0xda5d ), SHC( 0xda94 ), SHC( 0xdacb ), SHC( 0xdb02 ), SHC( 0xdb38 ), SHC( 0xdb6f ), SHC( 0xdba6 ),
+ SHC( 0xdbdd ), SHC( 0xdc14 ), SHC( 0xdc4b ), SHC( 0xdc81 ), SHC( 0xdcb8 ), SHC( 0xdcef ), SHC( 0xdd26 ), SHC( 0xdd5d ),
+ SHC( 0xdd95 ), SHC( 0xddcc ), SHC( 0xde03 ), SHC( 0xde3a ), SHC( 0xde71 ), SHC( 0xdea8 ), SHC( 0xdee0 ), SHC( 0xdf17 ),
+ SHC( 0xdf4e ), SHC( 0xdf85 ), SHC( 0xdfbd ), SHC( 0xdff4 ), SHC( 0xe02b ), SHC( 0xe063 ), SHC( 0xe09a ), SHC( 0xe0d2 ),
+ SHC( 0xe109 ), SHC( 0xe141 ), SHC( 0xe178 ), SHC( 0xe1b0 ), SHC( 0xe1e7 ), SHC( 0xe21f ), SHC( 0xe257 ), SHC( 0xe28e ),
+ SHC( 0xe2c6 ), SHC( 0xe2fe ), SHC( 0xe335 ), SHC( 0xe36d ), SHC( 0xe3a5 ), SHC( 0xe3dd ), SHC( 0xe414 ), SHC( 0xe44c ),
+ SHC( 0xe484 ), SHC( 0xe4bc ), SHC( 0xe4f4 ), SHC( 0xe52c ), SHC( 0xe564 ), SHC( 0xe59c ), SHC( 0xe5d4 ), SHC( 0xe60c ),
+ SHC( 0xe644 ), SHC( 0xe67c ), SHC( 0xe6b4 ), SHC( 0xe6ec ), SHC( 0xe724 ), SHC( 0xe75c ), SHC( 0xe794 ), SHC( 0xe7cc ),
+ SHC( 0xe804 ), SHC( 0xe83d ), SHC( 0xe875 ), SHC( 0xe8ad ), SHC( 0xe8e5 ), SHC( 0xe91e ), SHC( 0xe956 ), SHC( 0xe98e ),
+ SHC( 0xe9c6 ), SHC( 0xe9ff ), SHC( 0xea37 ), SHC( 0xea6f ), SHC( 0xeaa8 ), SHC( 0xeae0 ), SHC( 0xeb19 ), SHC( 0xeb51 ),
+ SHC( 0xeb8a ), SHC( 0xebc2 ), SHC( 0xebfa ), SHC( 0xec33 ), SHC( 0xec6b ), SHC( 0xeca4 ), SHC( 0xecdd ), SHC( 0xed15 ),
+ SHC( 0xed4e ), SHC( 0xed86 ), SHC( 0xedbf ), SHC( 0xedf7 ), SHC( 0xee30 ), SHC( 0xee69 ), SHC( 0xeea1 ), SHC( 0xeeda ),
+ SHC( 0xef13 ), SHC( 0xef4b ), SHC( 0xef84 ), SHC( 0xefbd ), SHC( 0xeff6 ), SHC( 0xf02e ), SHC( 0xf067 ), SHC( 0xf0a0 ),
+ SHC( 0xf0d9 ), SHC( 0xf111 ), SHC( 0xf14a ), SHC( 0xf183 ), SHC( 0xf1bc ), SHC( 0xf1f5 ), SHC( 0xf22e ), SHC( 0xf266 ),
+ SHC( 0xf29f ), SHC( 0xf2d8 ), SHC( 0xf311 ), SHC( 0xf34a ), SHC( 0xf383 ), SHC( 0xf3bc ), SHC( 0xf3f5 ), SHC( 0xf42e ),
+ SHC( 0xf467 ), SHC( 0xf4a0 ), SHC( 0xf4d9 ), SHC( 0xf512 ), SHC( 0xf54b ), SHC( 0xf584 ), SHC( 0xf5bd ), SHC( 0xf5f6 ),
+ SHC( 0xf62f ), SHC( 0xf668 ), SHC( 0xf6a1 ), SHC( 0xf6da ), SHC( 0xf713 ), SHC( 0xf74c ), SHC( 0xf785 ), SHC( 0xf7be ),
+ SHC( 0xf7f7 ), SHC( 0xf830 ), SHC( 0xf869 ), SHC( 0xf8a2 ), SHC( 0xf8db ), SHC( 0xf914 ), SHC( 0xf94e ), SHC( 0xf987 ),
+ SHC( 0xf9c0 ), SHC( 0xf9f9 ), SHC( 0xfa32 ), SHC( 0xfa6b ), SHC( 0xfaa4 ), SHC( 0xfadd ), SHC( 0xfb17 ), SHC( 0xfb50 ),
+ SHC( 0xfb89 ), SHC( 0xfbc2 ), SHC( 0xfbfb ), SHC( 0xfc34 ), SHC( 0xfc6e ), SHC( 0xfca7 ), SHC( 0xfce0 ), SHC( 0xfd19 ),
+ SHC( 0xfd52 ), SHC( 0xfd8b ), SHC( 0xfdc5 ), SHC( 0xfdfe ), SHC( 0xfe37 ), SHC( 0xfe70 ), SHC( 0xfea9 ), SHC( 0xfee3 ),
+ SHC( 0xff1c ), SHC( 0xff55 ), SHC( 0xff8e ), SHC( 0xffc7 ), SHC( 0x0000 ), SHC( 0x0039 ), SHC( 0x0072 ), SHC( 0x00ab ),
+ SHC( 0x00e4 ), SHC( 0x011d ), SHC( 0x0157 ), SHC( 0x0190 ), SHC( 0x01c9 ), SHC( 0x0202 ), SHC( 0x023b ), SHC( 0x0275 ),
+ SHC( 0x02ae ), SHC( 0x02e7 ), SHC( 0x0320 ), SHC( 0x0359 ), SHC( 0x0392 ), SHC( 0x03cc ), SHC( 0x0405 ), SHC( 0x043e ),
+ SHC( 0x0477 ), SHC( 0x04b0 ), SHC( 0x04e9 ), SHC( 0x0523 ), SHC( 0x055c ), SHC( 0x0595 ), SHC( 0x05ce ), SHC( 0x0607 ),
+ SHC( 0x0640 ), SHC( 0x0679 ), SHC( 0x06b2 ), SHC( 0x06ec ), SHC( 0x0725 ), SHC( 0x075e ), SHC( 0x0797 ), SHC( 0x07d0 ),
+ SHC( 0x0809 ), SHC( 0x0842 ), SHC( 0x087b ), SHC( 0x08b4 ), SHC( 0x08ed ), SHC( 0x0926 ), SHC( 0x095f ), SHC( 0x0998 ),
+ SHC( 0x09d1 ), SHC( 0x0a0a ), SHC( 0x0a43 ), SHC( 0x0a7c ), SHC( 0x0ab5 ), SHC( 0x0aee ), SHC( 0x0b27 ), SHC( 0x0b60 ),
+ SHC( 0x0b99 ), SHC( 0x0bd2 ), SHC( 0x0c0b ), SHC( 0x0c44 ), SHC( 0x0c7d ), SHC( 0x0cb6 ), SHC( 0x0cef ), SHC( 0x0d28 ),
+ SHC( 0x0d61 ), SHC( 0x0d9a ), SHC( 0x0dd2 ), SHC( 0x0e0b ), SHC( 0x0e44 ), SHC( 0x0e7d ), SHC( 0x0eb6 ), SHC( 0x0eef ),
+ SHC( 0x0f27 ), SHC( 0x0f60 ), SHC( 0x0f99 ), SHC( 0x0fd2 ), SHC( 0x100a ), SHC( 0x1043 ), SHC( 0x107c ), SHC( 0x10b5 ),
+ SHC( 0x10ed ), SHC( 0x1126 ), SHC( 0x115f ), SHC( 0x1197 ), SHC( 0x11d0 ), SHC( 0x1209 ), SHC( 0x1241 ), SHC( 0x127a ),
+ SHC( 0x12b2 ), SHC( 0x12eb ), SHC( 0x1323 ), SHC( 0x135c ), SHC( 0x1395 ), SHC( 0x13cd ), SHC( 0x1406 ), SHC( 0x143e ),
+ SHC( 0x1476 ), SHC( 0x14af ), SHC( 0x14e7 ), SHC( 0x1520 ), SHC( 0x1558 ), SHC( 0x1591 ), SHC( 0x15c9 ), SHC( 0x1601 ),
+ SHC( 0x163a ), SHC( 0x1672 ), SHC( 0x16aa ), SHC( 0x16e2 ), SHC( 0x171b ), SHC( 0x1753 ), SHC( 0x178b ), SHC( 0x17c3 ),
+ SHC( 0x17fc ), SHC( 0x1834 ), SHC( 0x186c ), SHC( 0x18a4 ), SHC( 0x18dc ), SHC( 0x1914 ), SHC( 0x194c ), SHC( 0x1984 ),
+ SHC( 0x19bc ), SHC( 0x19f4 ), SHC( 0x1a2c ), SHC( 0x1a64 ), SHC( 0x1a9c ), SHC( 0x1ad4 ), SHC( 0x1b0c ), SHC( 0x1b44 ),
+ SHC( 0x1b7c ), SHC( 0x1bb4 ), SHC( 0x1bec ), SHC( 0x1c23 ), SHC( 0x1c5b ), SHC( 0x1c93 ), SHC( 0x1ccb ), SHC( 0x1d02 ),
+ SHC( 0x1d3a ), SHC( 0x1d72 ), SHC( 0x1da9 ), SHC( 0x1de1 ), SHC( 0x1e19 ), SHC( 0x1e50 ), SHC( 0x1e88 ), SHC( 0x1ebf ),
+ SHC( 0x1ef7 ), SHC( 0x1f2e ), SHC( 0x1f66 ), SHC( 0x1f9d ), SHC( 0x1fd5 ), SHC( 0x200c ), SHC( 0x2043 ), SHC( 0x207b ),
+ SHC( 0x20b2 ), SHC( 0x20e9 ), SHC( 0x2120 ), SHC( 0x2158 ), SHC( 0x218f ), SHC( 0x21c6 ), SHC( 0x21fd ), SHC( 0x2234 ),
+ SHC( 0x226b ), SHC( 0x22a3 ), SHC( 0x22da ), SHC( 0x2311 ), SHC( 0x2348 ), SHC( 0x237f ), SHC( 0x23b5 ), SHC( 0x23ec ),
+ SHC( 0x2423 ), SHC( 0x245a ), SHC( 0x2491 ), SHC( 0x24c8 ), SHC( 0x24fe ), SHC( 0x2535 ), SHC( 0x256c ), SHC( 0x25a3 ),
+ SHC( 0x25d9 ), SHC( 0x2610 ), SHC( 0x2646 ), SHC( 0x267d ), SHC( 0x26b4 ), SHC( 0x26ea ), SHC( 0x2721 ), SHC( 0x2757 ),
+ SHC( 0x278d ), SHC( 0x27c4 ), SHC( 0x27fa ), SHC( 0x2830 ), SHC( 0x2867 ), SHC( 0x289d ), SHC( 0x28d3 ), SHC( 0x2909 ),
+ SHC( 0x2940 ), SHC( 0x2976 ), SHC( 0x29ac ), SHC( 0x29e2 ), SHC( 0x2a18 ), SHC( 0x2a4e ), SHC( 0x2a84 ), SHC( 0x2aba ),
+ SHC( 0x2af0 ), SHC( 0x2b25 ), SHC( 0x2b5b ), SHC( 0x2b91 ), SHC( 0x2bc7 ), SHC( 0x2bfd ), SHC( 0x2c32 ), SHC( 0x2c68 ),
+ SHC( 0x2c9e ), SHC( 0x2cd3 ), SHC( 0x2d09 ), SHC( 0x2d3e ), SHC( 0x2d74 ), SHC( 0x2da9 ), SHC( 0x2ddf ), SHC( 0x2e14 ),
+ SHC( 0x2e49 ), SHC( 0x2e7f ), SHC( 0x2eb4 ), SHC( 0x2ee9 ), SHC( 0x2f1e ), SHC( 0x2f53 ), SHC( 0x2f88 ), SHC( 0x2fbe ),
+ SHC( 0x2ff3 ), SHC( 0x3028 ), SHC( 0x305d ), SHC( 0x3092 ), SHC( 0x30c6 ), SHC( 0x30fb ), SHC( 0x3130 ), SHC( 0x3165 ),
+ SHC( 0x319a ), SHC( 0x31ce ), SHC( 0x3203 ), SHC( 0x3238 ), SHC( 0x326c ), SHC( 0x32a1 ), SHC( 0x32d5 ), SHC( 0x330a ),
+ SHC( 0x333e ), SHC( 0x3373 ), SHC( 0x33a7 ), SHC( 0x33db ), SHC( 0x340f ), SHC( 0x3444 ), SHC( 0x3478 ), SHC( 0x34ac ),
+ SHC( 0x34e0 ), SHC( 0x3514 ), SHC( 0x3548 ), SHC( 0x357c ), SHC( 0x35b0 ), SHC( 0x35e4 ), SHC( 0x3618 ), SHC( 0x364c ),
+ SHC( 0x367f ), SHC( 0x36b3 ), SHC( 0x36e7 ), SHC( 0x371a ), SHC( 0x374e ), SHC( 0x3782 ), SHC( 0x37b5 ), SHC( 0x37e9 ),
+ SHC( 0x381c ), SHC( 0x384f ), SHC( 0x3883 ), SHC( 0x38b6 ), SHC( 0x38e9 ), SHC( 0x391d ), SHC( 0x3950 ), SHC( 0x3983 ),
+ SHC( 0x39b6 ), SHC( 0x39e9 ), SHC( 0x3a1c ), SHC( 0x3a4f ), SHC( 0x3a82 ), SHC( 0x3ab5 ), SHC( 0x3ae7 ), SHC( 0x3b1a ),
+ SHC( 0x3b4d ), SHC( 0x3b7f ), SHC( 0x3bb2 ), SHC( 0x3be5 ), SHC( 0x3c17 ), SHC( 0x3c4a ), SHC( 0x3c7c ), SHC( 0x3cae ),
+ SHC( 0x3ce1 ), SHC( 0x3d13 ), SHC( 0x3d45 ), SHC( 0x3d77 ), SHC( 0x3daa ), SHC( 0x3ddc ), SHC( 0x3e0e ), SHC( 0x3e40 ),
+ SHC( 0x3e72 ), SHC( 0x3ea4 ), SHC( 0x3ed5 ), SHC( 0x3f07 ), SHC( 0x3f39 ), SHC( 0x3f6b ), SHC( 0x3f9c ), SHC( 0x3fce ),
+ SHC( 0x3fff )
+};
+
+const Word16 ivas_sin_az_fx[361] = { // Q15
+ SHC( 0x0000 ), SHC( 0xfdc5 ), SHC( 0xfb89 ), SHC( 0xf94e ), SHC( 0xf713 ), SHC( 0xf4d9 ), SHC( 0xf29f ), SHC( 0xf067 ),
+ SHC( 0xee30 ), SHC( 0xebfa ), SHC( 0xe9c6 ), SHC( 0xe794 ), SHC( 0xe564 ), SHC( 0xe335 ), SHC( 0xe109 ), SHC( 0xdee0 ),
+ SHC( 0xdcb8 ), SHC( 0xda94 ), SHC( 0xd873 ), SHC( 0xd654 ), SHC( 0xd439 ), SHC( 0xd221 ), SHC( 0xd00d ), SHC( 0xcdfd ),
+ SHC( 0xcbf1 ), SHC( 0xc9e8 ), SHC( 0xc7e4 ), SHC( 0xc5e4 ), SHC( 0xc3e9 ), SHC( 0xc1f2 ), SHC( 0xc001 ), SHC( 0xbe14 ),
+ SHC( 0xbc2c ), SHC( 0xba4a ), SHC( 0xb86d ), SHC( 0xb696 ), SHC( 0xb4c4 ), SHC( 0xb2f8 ), SHC( 0xb133 ), SHC( 0xaf73 ),
+ SHC( 0xadba ), SHC( 0xac07 ), SHC( 0xaa5a ), SHC( 0xa8b5 ), SHC( 0xa716 ), SHC( 0xa57e ), SHC( 0xa3ed ), SHC( 0xa264 ),
+ SHC( 0xa0e1 ), SHC( 0x9f66 ), SHC( 0x9df3 ), SHC( 0x9c87 ), SHC( 0x9b23 ), SHC( 0x99c7 ), SHC( 0x9873 ), SHC( 0x9727 ),
+ SHC( 0x95e3 ), SHC( 0x94a7 ), SHC( 0x9374 ), SHC( 0x9249 ), SHC( 0x9127 ), SHC( 0x900d ), SHC( 0x8efc ), SHC( 0x8df4 ),
+ SHC( 0x8cf5 ), SHC( 0x8bff ), SHC( 0x8b11 ), SHC( 0x8a2d ), SHC( 0x8953 ), SHC( 0x8881 ), SHC( 0x87b9 ), SHC( 0x86fa ),
+ SHC( 0x8644 ), SHC( 0x8598 ), SHC( 0x84f6 ), SHC( 0x845d ), SHC( 0x83ce ), SHC( 0x8348 ), SHC( 0x82cd ), SHC( 0x825b ),
+ SHC( 0x81f2 ), SHC( 0x8194 ), SHC( 0x813f ), SHC( 0x80f5 ), SHC( 0x80b4 ), SHC( 0x807d ), SHC( 0x8050 ), SHC( 0x802d ),
+ SHC( 0x8014 ), SHC( 0x8005 ), SHC( 0x8000 ), SHC( 0x8005 ), SHC( 0x8014 ), SHC( 0x802d ), SHC( 0x8050 ), SHC( 0x807d ),
+ SHC( 0x80b4 ), SHC( 0x80f5 ), SHC( 0x813f ), SHC( 0x8194 ), SHC( 0x81f2 ), SHC( 0x825b ), SHC( 0x82cd ), SHC( 0x8348 ),
+ SHC( 0x83ce ), SHC( 0x845d ), SHC( 0x84f6 ), SHC( 0x8598 ), SHC( 0x8644 ), SHC( 0x86fa ), SHC( 0x87b9 ), SHC( 0x8881 ),
+ SHC( 0x8953 ), SHC( 0x8a2d ), SHC( 0x8b11 ), SHC( 0x8bff ), SHC( 0x8cf5 ), SHC( 0x8df4 ), SHC( 0x8efc ), SHC( 0x900d ),
+ SHC( 0x9127 ), SHC( 0x9249 ), SHC( 0x9374 ), SHC( 0x94a7 ), SHC( 0x95e3 ), SHC( 0x9727 ), SHC( 0x9873 ), SHC( 0x99c7 ),
+ SHC( 0x9b23 ), SHC( 0x9c87 ), SHC( 0x9df3 ), SHC( 0x9f66 ), SHC( 0xa0e1 ), SHC( 0xa264 ), SHC( 0xa3ed ), SHC( 0xa57e ),
+ SHC( 0xa716 ), SHC( 0xa8b5 ), SHC( 0xaa5a ), SHC( 0xac07 ), SHC( 0xadba ), SHC( 0xaf73 ), SHC( 0xb133 ), SHC( 0xb2f8 ),
+ SHC( 0xb4c4 ), SHC( 0xb696 ), SHC( 0xb86d ), SHC( 0xba4a ), SHC( 0xbc2c ), SHC( 0xbe14 ), SHC( 0xc001 ), SHC( 0xc1f2 ),
+ SHC( 0xc3e9 ), SHC( 0xc5e4 ), SHC( 0xc7e4 ), SHC( 0xc9e8 ), SHC( 0xcbf1 ), SHC( 0xcdfd ), SHC( 0xd00d ), SHC( 0xd221 ),
+ SHC( 0xd439 ), SHC( 0xd654 ), SHC( 0xd873 ), SHC( 0xda94 ), SHC( 0xdcb8 ), SHC( 0xdee0 ), SHC( 0xe109 ), SHC( 0xe335 ),
+ SHC( 0xe564 ), SHC( 0xe794 ), SHC( 0xe9c6 ), SHC( 0xebfa ), SHC( 0xee30 ), SHC( 0xf067 ), SHC( 0xf29f ), SHC( 0xf4d9 ),
+ SHC( 0xf713 ), SHC( 0xf94e ), SHC( 0xfb89 ), SHC( 0xfdc5 ), SHC( 0x0000 ), SHC( 0x023b ), SHC( 0x0477 ), SHC( 0x06b2 ),
+ SHC( 0x08ed ), SHC( 0x0b27 ), SHC( 0x0d61 ), SHC( 0x0f99 ), SHC( 0x11d0 ), SHC( 0x1406 ), SHC( 0x163a ), SHC( 0x186c ),
+ SHC( 0x1a9c ), SHC( 0x1ccb ), SHC( 0x1ef7 ), SHC( 0x2120 ), SHC( 0x2348 ), SHC( 0x256c ), SHC( 0x278d ), SHC( 0x29ac ),
+ SHC( 0x2bc7 ), SHC( 0x2ddf ), SHC( 0x2ff3 ), SHC( 0x3203 ), SHC( 0x340f ), SHC( 0x3618 ), SHC( 0x381c ), SHC( 0x3a1c ),
+ SHC( 0x3c17 ), SHC( 0x3e0e ), SHC( 0x3fff ), SHC( 0x41ec ), SHC( 0x43d4 ), SHC( 0x45b6 ), SHC( 0x4793 ), SHC( 0x496a ),
+ SHC( 0x4b3c ), SHC( 0x4d08 ), SHC( 0x4ecd ), SHC( 0x508d ), SHC( 0x5246 ), SHC( 0x53f9 ), SHC( 0x55a6 ), SHC( 0x574b ),
+ SHC( 0x58ea ), SHC( 0x5a82 ), SHC( 0x5c13 ), SHC( 0x5d9c ), SHC( 0x5f1f ), SHC( 0x609a ), SHC( 0x620d ), SHC( 0x6379 ),
+ SHC( 0x64dd ), SHC( 0x6639 ), SHC( 0x678d ), SHC( 0x68d9 ), SHC( 0x6a1d ), SHC( 0x6b59 ), SHC( 0x6c8c ), SHC( 0x6db7 ),
+ SHC( 0x6ed9 ), SHC( 0x6ff3 ), SHC( 0x7104 ), SHC( 0x720c ), SHC( 0x730b ), SHC( 0x7401 ), SHC( 0x74ef ), SHC( 0x75d3 ),
+ SHC( 0x76ad ), SHC( 0x777f ), SHC( 0x7847 ), SHC( 0x7906 ), SHC( 0x79bc ), SHC( 0x7a68 ), SHC( 0x7b0a ), SHC( 0x7ba3 ),
+ SHC( 0x7c32 ), SHC( 0x7cb8 ), SHC( 0x7d33 ), SHC( 0x7da5 ), SHC( 0x7e0e ), SHC( 0x7e6c ), SHC( 0x7ec1 ), SHC( 0x7f0b ),
+ SHC( 0x7f4c ), SHC( 0x7f83 ), SHC( 0x7fb0 ), SHC( 0x7fd3 ), SHC( 0x7fec ), SHC( 0x7ffb ), SHC( 0x7fff ), SHC( 0x7ffb ),
+ SHC( 0x7fec ), SHC( 0x7fd3 ), SHC( 0x7fb0 ), SHC( 0x7f83 ), SHC( 0x7f4c ), SHC( 0x7f0b ), SHC( 0x7ec1 ), SHC( 0x7e6c ),
+ SHC( 0x7e0e ), SHC( 0x7da5 ), SHC( 0x7d33 ), SHC( 0x7cb8 ), SHC( 0x7c32 ), SHC( 0x7ba3 ), SHC( 0x7b0a ), SHC( 0x7a68 ),
+ SHC( 0x79bc ), SHC( 0x7906 ), SHC( 0x7847 ), SHC( 0x777f ), SHC( 0x76ad ), SHC( 0x75d3 ), SHC( 0x74ef ), SHC( 0x7401 ),
+ SHC( 0x730b ), SHC( 0x720c ), SHC( 0x7104 ), SHC( 0x6ff3 ), SHC( 0x6ed9 ), SHC( 0x6db7 ), SHC( 0x6c8c ), SHC( 0x6b59 ),
+ SHC( 0x6a1d ), SHC( 0x68d9 ), SHC( 0x678d ), SHC( 0x6639 ), SHC( 0x64dd ), SHC( 0x6379 ), SHC( 0x620d ), SHC( 0x609a ),
+ SHC( 0x5f1f ), SHC( 0x5d9c ), SHC( 0x5c13 ), SHC( 0x5a82 ), SHC( 0x58ea ), SHC( 0x574b ), SHC( 0x55a6 ), SHC( 0x53f9 ),
+ SHC( 0x5246 ), SHC( 0x508d ), SHC( 0x4ecd ), SHC( 0x4d08 ), SHC( 0x4b3c ), SHC( 0x496a ), SHC( 0x4793 ), SHC( 0x45b6 ),
+ SHC( 0x43d4 ), SHC( 0x41ec ), SHC( 0x3fff ), SHC( 0x3e0e ), SHC( 0x3c17 ), SHC( 0x3a1c ), SHC( 0x381c ), SHC( 0x3618 ),
+ SHC( 0x340f ), SHC( 0x3203 ), SHC( 0x2ff3 ), SHC( 0x2ddf ), SHC( 0x2bc7 ), SHC( 0x29ac ), SHC( 0x278d ), SHC( 0x256c ),
+ SHC( 0x2348 ), SHC( 0x2120 ), SHC( 0x1ef7 ), SHC( 0x1ccb ), SHC( 0x1a9c ), SHC( 0x186c ), SHC( 0x163a ), SHC( 0x1406 ),
+ SHC( 0x11d0 ), SHC( 0x0f99 ), SHC( 0x0d61 ), SHC( 0x0b27 ), SHC( 0x08ed ), SHC( 0x06b2 ), SHC( 0x0477 ), SHC( 0x023b ),
+ SHC( 0x0000 )
+
+};
+
+/* Tables required in edxt_fx() */
+const Word16 sin_scale_tbl_960[960] = /* Q15 */
+ {
+ 0, 53, 107, 160, 214,
+ 268, 321, 375, 428, 482,
+ 536, 589, 643, 696, 750,
+ 804, 857, 911, 964, 1018,
+ 1072, 1125, 1179, 1232, 1286,
+ 1339, 1393, 1447, 1500, 1554,
+ 1607, 1661, 1714, 1768, 1821,
+ 1875, 1929, 1982, 2036, 2089,
+ 2143, 2196, 2250, 2303, 2357,
+ 2410, 2463, 2517, 2570, 2624,
+ 2677, 2731, 2784, 2838, 2891,
+ 2944, 2998, 3051, 3104, 3158,
+ 3211, 3265, 3318, 3371, 3425,
+ 3478, 3531, 3585, 3638, 3691,
+ 3744, 3798, 3851, 3904, 3957,
+ 4011, 4064, 4117, 4170, 4223,
+ 4276, 4330, 4383, 4436, 4489,
+ 4542, 4595, 4648, 4701, 4754,
+ 4807, 4860, 4913, 4966, 5019,
+ 5072, 5125, 5178, 5231, 5284,
+ 5337, 5390, 5443, 5496, 5549,
+ 5601, 5654, 5707, 5760, 5813,
+ 5865, 5918, 5971, 6024, 6076,
+ 6129, 6182, 6234, 6287, 6339,
+ 6392, 6445, 6497, 6550, 6602,
+ 6655, 6707, 6760, 6812, 6865,
+ 6917, 6969, 7022, 7074, 7126,
+ 7179, 7231, 7283, 7336, 7388,
+ 7440, 7492, 7544, 7597, 7649,
+ 7701, 7753, 7805, 7857, 7909,
+ 7961, 8013, 8065, 8117, 8169,
+ 8221, 8273, 8325, 8377, 8428,
+ 8480, 8532, 8584, 8635, 8687,
+ 8739, 8791, 8842, 8894, 8945,
+ 8997, 9048, 9100, 9151, 9203,
+ 9254, 9306, 9357, 9409, 9460,
+ 9511, 9563, 9614, 9665, 9716,
+ 9767, 9819, 9870, 9921, 9972,
+ 10023, 10074, 10125, 10176, 10227,
+ 10278, 10329, 10380, 10431, 10481,
+ 10532, 10583, 10634, 10684, 10735,
+ 10786, 10836, 10887, 10937, 10988,
+ 11038, 11089, 11139, 11190, 11240,
+ 11290, 11341, 11391, 11441, 11491,
+ 11542, 11592, 11642, 11692, 11742,
+ 11792, 11842, 11892, 11942, 11992,
+ 12042, 12092, 12142, 12191, 12241,
+ 12291, 12340, 12390, 12440, 12489,
+ 12539, 12588, 12638, 12687, 12737,
+ 12786, 12835, 12885, 12934, 12983,
+ 13033, 13082, 13131, 13180, 13229,
+ 13278, 13327, 13376, 13425, 13474,
+ 13523, 13571, 13620, 13669, 13718,
+ 13766, 13815, 13864, 13912, 13961,
+ 14009, 14058, 14106, 14154, 14203,
+ 14251, 14299, 14348, 14396, 14444,
+ 14492, 14540, 14588, 14636, 14684,
+ 14732, 14780, 14828, 14875, 14923,
+ 14971, 15019, 15066, 15114, 15161,
+ 15209, 15256, 15304, 15351, 15398,
+ 15446, 15493, 15540, 15587, 15635,
+ 15682, 15729, 15776, 15823, 15870,
+ 15917, 15963, 16010, 16057, 16104,
+ 16150, 16197, 16244, 16290, 16337,
+ 16383, 16429, 16476, 16522, 16568,
+ 16615, 16661, 16707, 16753, 16799,
+ 16845, 16891, 16937, 16983, 17029,
+ 17074, 17120, 17166, 17212, 17257,
+ 17303, 17348, 17394, 17439, 17484,
+ 17530, 17575, 17620, 17665, 17711,
+ 17756, 17801, 17846, 17891, 17936,
+ 17980, 18025, 18070, 18115, 18159,
+ 18204, 18248, 18293, 18337, 18382,
+ 18426, 18470, 18515, 18559, 18603,
+ 18647, 18691, 18735, 18779, 18823,
+ 18867, 18911, 18955, 18998, 19042,
+ 19086, 19129, 19173, 19216, 19259,
+ 19303, 19346, 19389, 19433, 19476,
+ 19519, 19562, 19605, 19648, 19691,
+ 19733, 19776, 19819, 19862, 19904,
+ 19947, 19989, 20032, 20074, 20116,
+ 20159, 20201, 20243, 20285, 20327,
+ 20369, 20411, 20453, 20495, 20537,
+ 20579, 20620, 20662, 20704, 20745,
+ 20787, 20828, 20869, 20911, 20952,
+ 20993, 21034, 21075, 21116, 21157,
+ 21198, 21239, 21280, 21321, 21361,
+ 21402, 21443, 21483, 21524, 21564,
+ 21604, 21645, 21685, 21725, 21765,
+ 21805, 21845, 21885, 21925, 21965,
+ 22004, 22044, 22084, 22123, 22163,
+ 22202, 22242, 22281, 22320, 22360,
+ 22399, 22438, 22477, 22516, 22555,
+ 22594, 22632, 22671, 22710, 22749,
+ 22787, 22826, 22864, 22902, 22941,
+ 22979, 23017, 23055, 23093, 23131,
+ 23169, 23207, 23245, 23283, 23320,
+ 23358, 23396, 23433, 23471, 23508,
+ 23545, 23583, 23620, 23657, 23694,
+ 23731, 23768, 23805, 23842, 23878,
+ 23915, 23952, 23988, 24025, 24061,
+ 24097, 24134, 24170, 24206, 24242,
+ 24278, 24314, 24350, 24386, 24422,
+ 24457, 24493, 24529, 24564, 24600,
+ 24635, 24670, 24706, 24741, 24776,
+ 24811, 24846, 24881, 24916, 24951,
+ 24985, 25020, 25054, 25089, 25123,
+ 25158, 25192, 25226, 25261, 25295,
+ 25329, 25363, 25397, 25430, 25464,
+ 25498, 25532, 25565, 25599, 25632,
+ 25665, 25699, 25732, 25765, 25798,
+ 25831, 25864, 25897, 25930, 25963,
+ 25995, 26028, 26060, 26093, 26125,
+ 26158, 26190, 26222, 26254, 26286,
+ 26318, 26350, 26382, 26414, 26445,
+ 26477, 26509, 26540, 26571, 26603,
+ 26634, 26665, 26696, 26727, 26758,
+ 26789, 26820, 26851, 26882, 26912,
+ 26943, 26973, 27004, 27034, 27064,
+ 27094, 27125, 27155, 27185, 27214,
+ 27244, 27274, 27304, 27333, 27363,
+ 27392, 27422, 27451, 27480, 27509,
+ 27538, 27567, 27596, 27625, 27654,
+ 27683, 27711, 27740, 27769, 27797,
+ 27825, 27854, 27882, 27910, 27938,
+ 27966, 27994, 28022, 28049, 28077,
+ 28105, 28132, 28160, 28187, 28214,
+ 28242, 28269, 28296, 28323, 28350,
+ 28377, 28403, 28430, 28457, 28483,
+ 28510, 28536, 28562, 28589, 28615,
+ 28641, 28667, 28693, 28719, 28744,
+ 28770, 28796, 28821, 28847, 28872,
+ 28897, 28923, 28948, 28973, 28998,
+ 29023, 29048, 29072, 29097, 29122,
+ 29146, 29171, 29195, 29219, 29244,
+ 29268, 29292, 29316, 29340, 29364,
+ 29387, 29411, 29435, 29458, 29482,
+ 29505, 29528, 29551, 29575, 29598,
+ 29621, 29643, 29666, 29689, 29712,
+ 29734, 29757, 29779, 29801, 29824,
+ 29846, 29868, 29890, 29912, 29934,
+ 29955, 29977, 29999, 30020, 30042,
+ 30063, 30084, 30106, 30127, 30148,
+ 30169, 30190, 30210, 30231, 30252,
+ 30272, 30293, 30313, 30333, 30354,
+ 30374, 30394, 30414, 30434, 30454,
+ 30473, 30493, 30513, 30532, 30552,
+ 30571, 30590, 30609, 30628, 30647,
+ 30666, 30685, 30704, 30723, 30741,
+ 30760, 30778, 30797, 30815, 30833,
+ 30851, 30869, 30887, 30905, 30923,
+ 30940, 30958, 30975, 30993, 31010,
+ 31028, 31045, 31062, 31079, 31096,
+ 31113, 31129, 31146, 31163, 31179,
+ 31196, 31212, 31228, 31245, 31261,
+ 31277, 31293, 31308, 31324, 31340,
+ 31356, 31371, 31387, 31402, 31417,
+ 31432, 31447, 31462, 31477, 31492,
+ 31507, 31522, 31536, 31551, 31565,
+ 31580, 31594, 31608, 31622, 31636,
+ 31650, 31664, 31678, 31691, 31705,
+ 31718, 31732, 31745, 31758, 31771,
+ 31785, 31797, 31810, 31823, 31836,
+ 31849, 31861, 31874, 31886, 31898,
+ 31911, 31923, 31935, 31947, 31959,
+ 31970, 31982, 31994, 32005, 32017,
+ 32028, 32039, 32050, 32062, 32073,
+ 32084, 32094, 32105, 32116, 32126,
+ 32137, 32147, 32158, 32168, 32178,
+ 32188, 32198, 32208, 32218, 32228,
+ 32237, 32247, 32256, 32266, 32275,
+ 32284, 32293, 32302, 32311, 32320,
+ 32329, 32338, 32346, 32355, 32363,
+ 32371, 32380, 32388, 32396, 32404,
+ 32412, 32420, 32427, 32435, 32443,
+ 32450, 32457, 32465, 32472, 32479,
+ 32486, 32493, 32500, 32507, 32513,
+ 32520, 32527, 32533, 32539, 32546,
+ 32552, 32558, 32564, 32570, 32576,
+ 32581, 32587, 32593, 32598, 32603,
+ 32609, 32614, 32619, 32624, 32629,
+ 32634, 32639, 32643, 32648, 32652,
+ 32657, 32661, 32665, 32670, 32674,
+ 32678, 32682, 32685, 32689, 32693,
+ 32696, 32700, 32703, 32706, 32710,
+ 32713, 32716, 32719, 32722, 32724,
+ 32727, 32730, 32732, 32735, 32737,
+ 32739, 32741, 32743, 32745, 32747,
+ 32749, 32751, 32752, 32754, 32755,
+ 32757, 32758, 32759, 32760, 32761,
+ 32762, 32763, 32764, 32764, 32765,
+ 32765, 32766, 32766, 32766, 32766
+ };
+
+const Word16 cos_scale_tbl_960[960] = /* Q15 */
+ {
+ 32767, 32766, 32766, 32766, 32766,
+ 32765, 32765, 32764, 32764, 32763,
+ 32762, 32761, 32760, 32759, 32758,
+ 32757, 32755, 32754, 32752, 32751,
+ 32749, 32747, 32745, 32743, 32741,
+ 32739, 32737, 32735, 32732, 32730,
+ 32727, 32724, 32722, 32719, 32716,
+ 32713, 32710, 32706, 32703, 32700,
+ 32696, 32693, 32689, 32685, 32682,
+ 32678, 32674, 32670, 32665, 32661,
+ 32657, 32652, 32648, 32643, 32639,
+ 32634, 32629, 32624, 32619, 32614,
+ 32609, 32603, 32598, 32593, 32587,
+ 32581, 32576, 32570, 32564, 32558,
+ 32552, 32546, 32539, 32533, 32527,
+ 32520, 32513, 32507, 32500, 32493,
+ 32486, 32479, 32472, 32465, 32457,
+ 32450, 32443, 32435, 32427, 32420,
+ 32412, 32404, 32396, 32388, 32380,
+ 32371, 32363, 32355, 32346, 32338,
+ 32329, 32320, 32311, 32302, 32293,
+ 32284, 32275, 32266, 32256, 32247,
+ 32237, 32228, 32218, 32208, 32198,
+ 32188, 32178, 32168, 32158, 32147,
+ 32137, 32126, 32116, 32105, 32094,
+ 32084, 32073, 32062, 32050, 32039,
+ 32028, 32017, 32005, 31994, 31982,
+ 31970, 31959, 31947, 31935, 31923,
+ 31911, 31898, 31886, 31874, 31861,
+ 31849, 31836, 31823, 31810, 31797,
+ 31785, 31771, 31758, 31745, 31732,
+ 31718, 31705, 31691, 31678, 31664,
+ 31650, 31636, 31622, 31608, 31594,
+ 31580, 31565, 31551, 31536, 31522,
+ 31507, 31492, 31477, 31462, 31447,
+ 31432, 31417, 31402, 31387, 31371,
+ 31356, 31340, 31324, 31308, 31293,
+ 31277, 31261, 31245, 31228, 31212,
+ 31196, 31179, 31163, 31146, 31129,
+ 31113, 31096, 31079, 31062, 31045,
+ 31028, 31010, 30993, 30975, 30958,
+ 30940, 30923, 30905, 30887, 30869,
+ 30851, 30833, 30815, 30797, 30778,
+ 30760, 30741, 30723, 30704, 30685,
+ 30666, 30647, 30628, 30609, 30590,
+ 30571, 30552, 30532, 30513, 30493,
+ 30473, 30454, 30434, 30414, 30394,
+ 30374, 30354, 30333, 30313, 30293,
+ 30272, 30252, 30231, 30210, 30190,
+ 30169, 30148, 30127, 30106, 30084,
+ 30063, 30042, 30020, 29999, 29977,
+ 29955, 29934, 29912, 29890, 29868,
+ 29846, 29824, 29801, 29779, 29757,
+ 29734, 29712, 29689, 29666, 29643,
+ 29621, 29598, 29575, 29551, 29528,
+ 29505, 29482, 29458, 29435, 29411,
+ 29387, 29364, 29340, 29316, 29292,
+ 29268, 29244, 29219, 29195, 29171,
+ 29146, 29122, 29097, 29072, 29048,
+ 29023, 28998, 28973, 28948, 28923,
+ 28897, 28872, 28847, 28821, 28796,
+ 28770, 28744, 28719, 28693, 28667,
+ 28641, 28615, 28589, 28562, 28536,
+ 28510, 28483, 28457, 28430, 28403,
+ 28377, 28350, 28323, 28296, 28269,
+ 28242, 28214, 28187, 28160, 28132,
+ 28105, 28077, 28049, 28022, 27994,
+ 27966, 27938, 27910, 27882, 27854,
+ 27825, 27797, 27769, 27740, 27711,
+ 27683, 27654, 27625, 27596, 27567,
+ 27538, 27509, 27480, 27451, 27422,
+ 27392, 27363, 27333, 27304, 27274,
+ 27244, 27214, 27185, 27155, 27125,
+ 27094, 27064, 27034, 27004, 26973,
+ 26943, 26912, 26882, 26851, 26820,
+ 26789, 26758, 26727, 26696, 26665,
+ 26634, 26603, 26571, 26540, 26509,
+ 26477, 26445, 26414, 26382, 26350,
+ 26318, 26286, 26254, 26222, 26190,
+ 26158, 26125, 26093, 26060, 26028,
+ 25995, 25963, 25930, 25897, 25864,
+ 25831, 25798, 25765, 25732, 25699,
+ 25665, 25632, 25599, 25565, 25532,
+ 25498, 25464, 25430, 25397, 25363,
+ 25329, 25295, 25261, 25226, 25192,
+ 25158, 25123, 25089, 25054, 25020,
+ 24985, 24951, 24916, 24881, 24846,
+ 24811, 24776, 24741, 24706, 24670,
+ 24635, 24600, 24564, 24529, 24493,
+ 24457, 24422, 24386, 24350, 24314,
+ 24278, 24242, 24206, 24170, 24134,
+ 24097, 24061, 24025, 23988, 23952,
+ 23915, 23878, 23842, 23805, 23768,
+ 23731, 23694, 23657, 23620, 23583,
+ 23545, 23508, 23471, 23433, 23396,
+ 23358, 23320, 23283, 23245, 23207,
+ 23169, 23131, 23093, 23055, 23017,
+ 22979, 22941, 22902, 22864, 22826,
+ 22787, 22749, 22710, 22671, 22632,
+ 22594, 22555, 22516, 22477, 22438,
+ 22399, 22360, 22320, 22281, 22242,
+ 22202, 22163, 22123, 22084, 22044,
+ 22004, 21965, 21925, 21885, 21845,
+ 21805, 21765, 21725, 21685, 21645,
+ 21604, 21564, 21524, 21483, 21443,
+ 21402, 21361, 21321, 21280, 21239,
+ 21198, 21157, 21116, 21075, 21034,
+ 20993, 20952, 20911, 20869, 20828,
+ 20787, 20745, 20704, 20662, 20620,
+ 20579, 20537, 20495, 20453, 20411,
+ 20369, 20327, 20285, 20243, 20201,
+ 20159, 20116, 20074, 20032, 19989,
+ 19947, 19904, 19862, 19819, 19776,
+ 19733, 19691, 19648, 19605, 19562,
+ 19519, 19476, 19433, 19389, 19346,
+ 19303, 19259, 19216, 19173, 19129,
+ 19086, 19042, 18998, 18955, 18911,
+ 18867, 18823, 18779, 18735, 18691,
+ 18647, 18603, 18559, 18515, 18470,
+ 18426, 18382, 18337, 18293, 18248,
+ 18204, 18159, 18115, 18070, 18025,
+ 17980, 17936, 17891, 17846, 17801,
+ 17756, 17711, 17665, 17620, 17575,
+ 17530, 17484, 17439, 17394, 17348,
+ 17303, 17257, 17212, 17166, 17120,
+ 17074, 17029, 16983, 16937, 16891,
+ 16845, 16799, 16753, 16707, 16661,
+ 16615, 16568, 16522, 16476, 16429,
+ 16383, 16337, 16290, 16244, 16197,
+ 16150, 16104, 16057, 16010, 15963,
+ 15917, 15870, 15823, 15776, 15729,
+ 15682, 15635, 15587, 15540, 15493,
+ 15446, 15398, 15351, 15304, 15256,
+ 15209, 15161, 15114, 15066, 15019,
+ 14971, 14923, 14875, 14828, 14780,
+ 14732, 14684, 14636, 14588, 14540,
+ 14492, 14444, 14396, 14348, 14299,
+ 14251, 14203, 14154, 14106, 14058,
+ 14009, 13961, 13912, 13864, 13815,
+ 13766, 13718, 13669, 13620, 13571,
+ 13523, 13474, 13425, 13376, 13327,
+ 13278, 13229, 13180, 13131, 13082,
+ 13033, 12983, 12934, 12885, 12835,
+ 12786, 12737, 12687, 12638, 12588,
+ 12539, 12489, 12440, 12390, 12340,
+ 12291, 12241, 12191, 12142, 12092,
+ 12042, 11992, 11942, 11892, 11842,
+ 11792, 11742, 11692, 11642, 11592,
+ 11542, 11491, 11441, 11391, 11341,
+ 11290, 11240, 11190, 11139, 11089,
+ 11038, 10988, 10937, 10887, 10836,
+ 10786, 10735, 10684, 10634, 10583,
+ 10532, 10481, 10431, 10380, 10329,
+ 10278, 10227, 10176, 10125, 10074,
+ 10023, 9972, 9921, 9870, 9819,
+ 9767, 9716, 9665, 9614, 9563,
+ 9511, 9460, 9409, 9357, 9306,
+ 9254, 9203, 9151, 9100, 9048,
+ 8997, 8945, 8894, 8842, 8791,
+ 8739, 8687, 8635, 8584, 8532,
+ 8480, 8428, 8377, 8325, 8273,
+ 8221, 8169, 8117, 8065, 8013,
+ 7961, 7909, 7857, 7805, 7753,
+ 7701, 7649, 7597, 7544, 7492,
+ 7440, 7388, 7336, 7283, 7231,
+ 7179, 7126, 7074, 7022, 6969,
+ 6917, 6865, 6812, 6760, 6707,
+ 6655, 6602, 6550, 6497, 6445,
+ 6392, 6339, 6287, 6234, 6182,
+ 6129, 6076, 6024, 5971, 5918,
+ 5865, 5813, 5760, 5707, 5654,
+ 5601, 5549, 5496, 5443, 5390,
+ 5337, 5284, 5231, 5178, 5125,
+ 5072, 5019, 4966, 4913, 4860,
+ 4807, 4754, 4701, 4648, 4595,
+ 4542, 4489, 4436, 4383, 4330,
+ 4276, 4223, 4170, 4117, 4064,
+ 4011, 3957, 3904, 3851, 3798,
+ 3744, 3691, 3638, 3585, 3531,
+ 3478, 3425, 3371, 3318, 3265,
+ 3211, 3158, 3104, 3051, 2998,
+ 2944, 2891, 2838, 2784, 2731,
+ 2677, 2624, 2570, 2517, 2463,
+ 2410, 2357, 2303, 2250, 2196,
+ 2143, 2089, 2036, 1982, 1929,
+ 1875, 1821, 1768, 1714, 1661,
+ 1607, 1554, 1500, 1447, 1393,
+ 1339, 1286, 1232, 1179, 1125,
+ 1072, 1018, 964, 911, 857,
+ 804, 750, 696, 643, 589,
+ 536, 482, 428, 375, 321,
+ 268, 214, 160, 107, 53
+ };
+
+const Word16 cos_scale_tbl_640[640] = /* Q15 */
+ {
+ 32767, 32766, 32766, 32766, 32765,
+ 32764, 32763, 32762, 32760, 32759,
+ 32757, 32755, 32752, 32750, 32747,
+ 32744, 32741, 32738, 32735, 32731,
+ 32727, 32723, 32719, 32714, 32710,
+ 32705, 32700, 32695, 32689, 32684,
+ 32678, 32672, 32665, 32659, 32652,
+ 32646, 32639, 32631, 32624, 32617,
+ 32609, 32601, 32593, 32584, 32576,
+ 32567, 32558, 32549, 32539, 32530,
+ 32520, 32510, 32500, 32490, 32479,
+ 32468, 32457, 32446, 32435, 32424,
+ 32412, 32400, 32388, 32376, 32363,
+ 32350, 32338, 32324, 32311, 32298,
+ 32284, 32270, 32256, 32242, 32228,
+ 32213, 32198, 32183, 32168, 32152,
+ 32137, 32121, 32105, 32089, 32073,
+ 32056, 32039, 32022, 32005, 31988,
+ 31970, 31953, 31935, 31917, 31898,
+ 31880, 31861, 31842, 31823, 31804,
+ 31785, 31765, 31745, 31725, 31705,
+ 31684, 31664, 31643, 31622, 31601,
+ 31580, 31558, 31536, 31514, 31492,
+ 31470, 31447, 31425, 31402, 31379,
+ 31356, 31332, 31308, 31285, 31261,
+ 31236, 31212, 31188, 31163, 31138,
+ 31113, 31087, 31062, 31036, 31010,
+ 30984, 30958, 30932, 30905, 30878,
+ 30851, 30824, 30797, 30769, 30741,
+ 30713, 30685, 30657, 30628, 30600,
+ 30571, 30542, 30513, 30483, 30454,
+ 30424, 30394, 30364, 30333, 30303,
+ 30272, 30241, 30210, 30179, 30148,
+ 30116, 30084, 30052, 30020, 29988,
+ 29955, 29923, 29890, 29857, 29824,
+ 29790, 29757, 29723, 29689, 29655,
+ 29621, 29586, 29551, 29517, 29482,
+ 29446, 29411, 29375, 29340, 29304,
+ 29268, 29232, 29195, 29159, 29122,
+ 29085, 29048, 29010, 28973, 28935,
+ 28897, 28859, 28821, 28783, 28744,
+ 28706, 28667, 28628, 28589, 28549,
+ 28510, 28470, 28430, 28390, 28350,
+ 28309, 28269, 28228, 28187, 28146,
+ 28105, 28063, 28022, 27980, 27938,
+ 27896, 27854, 27811, 27769, 27726,
+ 27683, 27640, 27596, 27553, 27509,
+ 27466, 27422, 27378, 27333, 27289,
+ 27244, 27200, 27155, 27109, 27064,
+ 27019, 26973, 26927, 26882, 26836,
+ 26789, 26743, 26696, 26650, 26603,
+ 26556, 26509, 26461, 26414, 26366,
+ 26318, 26270, 26222, 26174, 26125,
+ 26077, 26028, 25979, 25930, 25881,
+ 25831, 25782, 25732, 25682, 25632,
+ 25582, 25532, 25481, 25430, 25380,
+ 25329, 25278, 25226, 25175, 25123,
+ 25072, 25020, 24968, 24916, 24863,
+ 24811, 24758, 24706, 24653, 24600,
+ 24546, 24493, 24440, 24386, 24332,
+ 24278, 24224, 24170, 24116, 24061,
+ 24006, 23952, 23897, 23842, 23786,
+ 23731, 23675, 23620, 23564, 23508,
+ 23452, 23396, 23339, 23283, 23226,
+ 23169, 23112, 23055, 22998, 22941,
+ 22883, 22826, 22768, 22710, 22652,
+ 22594, 22535, 22477, 22418, 22360,
+ 22301, 22242, 22183, 22123, 22064,
+ 22004, 21945, 21885, 21825, 21765,
+ 21705, 21645, 21584, 21524, 21463,
+ 21402, 21341, 21280, 21219, 21157,
+ 21096, 21034, 20973, 20911, 20849,
+ 20787, 20724, 20662, 20600, 20537,
+ 20474, 20411, 20348, 20285, 20222,
+ 20159, 20095, 20032, 19968, 19904,
+ 19840, 19776, 19712, 19648, 19583,
+ 19519, 19454, 19389, 19324, 19259,
+ 19194, 19129, 19064, 18998, 18933,
+ 18867, 18801, 18735, 18669, 18603,
+ 18537, 18470, 18404, 18337, 18271,
+ 18204, 18137, 18070, 18003, 17936,
+ 17868, 17801, 17733, 17665, 17598,
+ 17530, 17462, 17394, 17325, 17257,
+ 17189, 17120, 17052, 16983, 16914,
+ 16845, 16776, 16707, 16638, 16568,
+ 16499, 16429, 16360, 16290, 16220,
+ 16150, 16080, 16010, 15940, 15870,
+ 15799, 15729, 15658, 15587, 15517,
+ 15446, 15375, 15304, 15233, 15161,
+ 15090, 15019, 14947, 14875, 14804,
+ 14732, 14660, 14588, 14516, 14444,
+ 14372, 14299, 14227, 14154, 14082,
+ 14009, 13936, 13864, 13791, 13718,
+ 13645, 13571, 13498, 13425, 13352,
+ 13278, 13204, 13131, 13057, 12983,
+ 12909, 12835, 12761, 12687, 12613,
+ 12539, 12465, 12390, 12316, 12241,
+ 12166, 12092, 12017, 11942, 11867,
+ 11792, 11717, 11642, 11567, 11491,
+ 11416, 11341, 11265, 11190, 11114,
+ 11038, 10963, 10887, 10811, 10735,
+ 10659, 10583, 10507, 10431, 10354,
+ 10278, 10202, 10125, 10049, 9972,
+ 9895, 9819, 9742, 9665, 9588,
+ 9511, 9434, 9357, 9280, 9203,
+ 9126, 9048, 8971, 8894, 8816,
+ 8739, 8661, 8584, 8506, 8428,
+ 8351, 8273, 8195, 8117, 8039,
+ 7961, 7883, 7805, 7727, 7649,
+ 7571, 7492, 7414, 7336, 7257,
+ 7179, 7100, 7022, 6943, 6865,
+ 6786, 6707, 6628, 6550, 6471,
+ 6392, 6313, 6234, 6155, 6076,
+ 5997, 5918, 5839, 5760, 5681,
+ 5601, 5522, 5443, 5364, 5284,
+ 5205, 5125, 5046, 4966, 4887,
+ 4807, 4728, 4648, 4569, 4489,
+ 4409, 4330, 4250, 4170, 4090,
+ 4011, 3931, 3851, 3771, 3691,
+ 3611, 3531, 3451, 3371, 3291,
+ 3211, 3131, 3051, 2971, 2891,
+ 2811, 2731, 2651, 2570, 2490,
+ 2410, 2330, 2250, 2169, 2089,
+ 2009, 1929, 1848, 1768, 1688,
+ 1607, 1527, 1447, 1366, 1286,
+ 1206, 1125, 1045, 964, 884,
+ 804, 723, 643, 562, 482,
+ 402, 321, 241, 160, 80
+ };
+
+const Word16 sin_scale_tbl_640[640] = /* Q15 */
+ {
+ 0, 80, 160, 241, 321,
+ 402, 482, 562, 643, 723,
+ 804, 884, 964, 1045, 1125,
+ 1206, 1286, 1366, 1447, 1527,
+ 1607, 1688, 1768, 1848, 1929,
+ 2009, 2089, 2169, 2250, 2330,
+ 2410, 2490, 2570, 2651, 2731,
+ 2811, 2891, 2971, 3051, 3131,
+ 3211, 3291, 3371, 3451, 3531,
+ 3611, 3691, 3771, 3851, 3931,
+ 4011, 4090, 4170, 4250, 4330,
+ 4409, 4489, 4569, 4648, 4728,
+ 4807, 4887, 4966, 5046, 5125,
+ 5205, 5284, 5364, 5443, 5522,
+ 5601, 5681, 5760, 5839, 5918,
+ 5997, 6076, 6155, 6234, 6313,
+ 6392, 6471, 6550, 6628, 6707,
+ 6786, 6865, 6943, 7022, 7100,
+ 7179, 7257, 7336, 7414, 7492,
+ 7571, 7649, 7727, 7805, 7883,
+ 7961, 8039, 8117, 8195, 8273,
+ 8351, 8428, 8506, 8584, 8661,
+ 8739, 8816, 8894, 8971, 9048,
+ 9126, 9203, 9280, 9357, 9434,
+ 9511, 9588, 9665, 9742, 9819,
+ 9895, 9972, 10049, 10125, 10202,
+ 10278, 10354, 10431, 10507, 10583,
+ 10659, 10735, 10811, 10887, 10963,
+ 11038, 11114, 11190, 11265, 11341,
+ 11416, 11491, 11567, 11642, 11717,
+ 11792, 11867, 11942, 12017, 12092,
+ 12166, 12241, 12316, 12390, 12465,
+ 12539, 12613, 12687, 12761, 12835,
+ 12909, 12983, 13057, 13131, 13204,
+ 13278, 13352, 13425, 13498, 13571,
+ 13645, 13718, 13791, 13864, 13936,
+ 14009, 14082, 14154, 14227, 14299,
+ 14372, 14444, 14516, 14588, 14660,
+ 14732, 14804, 14875, 14947, 15019,
+ 15090, 15161, 15233, 15304, 15375,
+ 15446, 15517, 15587, 15658, 15729,
+ 15799, 15870, 15940, 16010, 16080,
+ 16150, 16220, 16290, 16360, 16429,
+ 16499, 16568, 16638, 16707, 16776,
+ 16845, 16914, 16983, 17052, 17120,
+ 17189, 17257, 17325, 17394, 17462,
+ 17530, 17598, 17665, 17733, 17801,
+ 17868, 17936, 18003, 18070, 18137,
+ 18204, 18271, 18337, 18404, 18470,
+ 18537, 18603, 18669, 18735, 18801,
+ 18867, 18933, 18998, 19064, 19129,
+ 19194, 19259, 19324, 19389, 19454,
+ 19519, 19583, 19648, 19712, 19776,
+ 19840, 19904, 19968, 20032, 20095,
+ 20159, 20222, 20285, 20348, 20411,
+ 20474, 20537, 20600, 20662, 20724,
+ 20787, 20849, 20911, 20973, 21034,
+ 21096, 21157, 21219, 21280, 21341,
+ 21402, 21463, 21524, 21584, 21645,
+ 21705, 21765, 21825, 21885, 21945,
+ 22004, 22064, 22123, 22183, 22242,
+ 22301, 22360, 22418, 22477, 22535,
+ 22594, 22652, 22710, 22768, 22826,
+ 22883, 22941, 22998, 23055, 23112,
+ 23169, 23226, 23283, 23339, 23396,
+ 23452, 23508, 23564, 23620, 23675,
+ 23731, 23786, 23842, 23897, 23952,
+ 24006, 24061, 24116, 24170, 24224,
+ 24278, 24332, 24386, 24440, 24493,
+ 24546, 24600, 24653, 24706, 24758,
+ 24811, 24863, 24916, 24968, 25020,
+ 25072, 25123, 25175, 25226, 25278,
+ 25329, 25380, 25430, 25481, 25532,
+ 25582, 25632, 25682, 25732, 25782,
+ 25831, 25881, 25930, 25979, 26028,
+ 26077, 26125, 26174, 26222, 26270,
+ 26318, 26366, 26414, 26461, 26509,
+ 26556, 26603, 26650, 26696, 26743,
+ 26789, 26836, 26882, 26927, 26973,
+ 27019, 27064, 27109, 27155, 27200,
+ 27244, 27289, 27333, 27378, 27422,
+ 27466, 27509, 27553, 27596, 27640,
+ 27683, 27726, 27769, 27811, 27854,
+ 27896, 27938, 27980, 28022, 28063,
+ 28105, 28146, 28187, 28228, 28269,
+ 28309, 28350, 28390, 28430, 28470,
+ 28510, 28549, 28589, 28628, 28667,
+ 28706, 28744, 28783, 28821, 28859,
+ 28897, 28935, 28973, 29010, 29048,
+ 29085, 29122, 29159, 29195, 29232,
+ 29268, 29304, 29340, 29375, 29411,
+ 29446, 29482, 29517, 29551, 29586,
+ 29621, 29655, 29689, 29723, 29757,
+ 29790, 29824, 29857, 29890, 29923,
+ 29955, 29988, 30020, 30052, 30084,
+ 30116, 30148, 30179, 30210, 30241,
+ 30272, 30303, 30333, 30364, 30394,
+ 30424, 30454, 30483, 30513, 30542,
+ 30571, 30600, 30628, 30657, 30685,
+ 30713, 30741, 30769, 30797, 30824,
+ 30851, 30878, 30905, 30932, 30958,
+ 30984, 31010, 31036, 31062, 31087,
+ 31113, 31138, 31163, 31188, 31212,
+ 31236, 31261, 31285, 31308, 31332,
+ 31356, 31379, 31402, 31425, 31447,
+ 31470, 31492, 31514, 31536, 31558,
+ 31580, 31601, 31622, 31643, 31664,
+ 31684, 31705, 31725, 31745, 31765,
+ 31785, 31804, 31823, 31842, 31861,
+ 31880, 31898, 31917, 31935, 31953,
+ 31970, 31988, 32005, 32022, 32039,
+ 32056, 32073, 32089, 32105, 32121,
+ 32137, 32152, 32168, 32183, 32198,
+ 32213, 32228, 32242, 32256, 32270,
+ 32284, 32298, 32311, 32324, 32338,
+ 32350, 32363, 32376, 32388, 32400,
+ 32412, 32424, 32435, 32446, 32457,
+ 32468, 32479, 32490, 32500, 32510,
+ 32520, 32530, 32539, 32549, 32558,
+ 32567, 32576, 32584, 32593, 32601,
+ 32609, 32617, 32624, 32631, 32639,
+ 32646, 32652, 32659, 32665, 32672,
+ 32678, 32684, 32689, 32695, 32700,
+ 32705, 32710, 32714, 32719, 32723,
+ 32727, 32731, 32735, 32738, 32741,
+ 32744, 32747, 32750, 32752, 32755,
+ 32757, 32759, 32760, 32762, 32763,
+ 32764, 32765, 32766, 32766, 32766
+ };
+
+const Word16 sin_scale_tbl_512[512] = /* Q15 */
+ {
+ 0, 100, 201, 301, 402,
+ 502, 603, 703, 804, 904,
+ 1005, 1105, 1206, 1306, 1406,
+ 1507, 1607, 1708, 1808, 1908,
+ 2009, 2109, 2209, 2310, 2410,
+ 2510, 2610, 2711, 2811, 2911,
+ 3011, 3111, 3211, 3311, 3411,
+ 3511, 3611, 3711, 3811, 3911,
+ 4011, 4110, 4210, 4310, 4409,
+ 4509, 4608, 4708, 4807, 4907,
+ 5006, 5106, 5205, 5304, 5403,
+ 5502, 5601, 5700, 5799, 5898,
+ 5997, 6096, 6195, 6293, 6392,
+ 6491, 6589, 6688, 6786, 6884,
+ 6982, 7081, 7179, 7277, 7375,
+ 7473, 7571, 7668, 7766, 7864,
+ 7961, 8059, 8156, 8253, 8351,
+ 8448, 8545, 8642, 8739, 8836,
+ 8932, 9029, 9126, 9222, 9319,
+ 9415, 9511, 9607, 9703, 9799,
+ 9895, 9991, 10087, 10182, 10278,
+ 10373, 10469, 10564, 10659, 10754,
+ 10849, 10944, 11038, 11133, 11227,
+ 11322, 11416, 11510, 11604, 11698,
+ 11792, 11886, 11980, 12073, 12166,
+ 12260, 12353, 12446, 12539, 12632,
+ 12724, 12817, 12909, 13002, 13094,
+ 13186, 13278, 13370, 13462, 13553,
+ 13645, 13736, 13827, 13918, 14009,
+ 14100, 14191, 14281, 14372, 14462,
+ 14552, 14642, 14732, 14822, 14911,
+ 15001, 15090, 15179, 15268, 15357,
+ 15446, 15534, 15623, 15711, 15799,
+ 15887, 15975, 16063, 16150, 16238,
+ 16325, 16412, 16499, 16586, 16672,
+ 16759, 16845, 16931, 17017, 17103,
+ 17189, 17274, 17360, 17445, 17530,
+ 17615, 17699, 17784, 17868, 17952,
+ 18036, 18120, 18204, 18287, 18371,
+ 18454, 18537, 18620, 18702, 18785,
+ 18867, 18949, 19031, 19113, 19194,
+ 19276, 19357, 19438, 19519, 19599,
+ 19680, 19760, 19840, 19920, 20000,
+ 20079, 20159, 20238, 20317, 20396,
+ 20474, 20553, 20631, 20709, 20787,
+ 20864, 20942, 21019, 21096, 21173,
+ 21249, 21326, 21402, 21478, 21554,
+ 21629, 21705, 21780, 21855, 21930,
+ 22004, 22079, 22153, 22227, 22301,
+ 22374, 22448, 22521, 22594, 22666,
+ 22739, 22811, 22883, 22955, 23027,
+ 23098, 23169, 23240, 23311, 23382,
+ 23452, 23522, 23592, 23661, 23731,
+ 23800, 23869, 23938, 24006, 24075,
+ 24143, 24211, 24278, 24346, 24413,
+ 24480, 24546, 24613, 24679, 24745,
+ 24811, 24877, 24942, 25007, 25072,
+ 25136, 25201, 25265, 25329, 25392,
+ 25456, 25519, 25582, 25645, 25707,
+ 25769, 25831, 25893, 25954, 26016,
+ 26077, 26137, 26198, 26258, 26318,
+ 26378, 26437, 26497, 26556, 26615,
+ 26673, 26731, 26789, 26847, 26905,
+ 26962, 27019, 27076, 27132, 27188,
+ 27244, 27300, 27355, 27411, 27466,
+ 27520, 27575, 27629, 27683, 27736,
+ 27790, 27843, 27896, 27948, 28001,
+ 28053, 28105, 28156, 28208, 28259,
+ 28309, 28360, 28410, 28460, 28510,
+ 28559, 28608, 28657, 28706, 28754,
+ 28802, 28850, 28897, 28945, 28992,
+ 29038, 29085, 29131, 29177, 29222,
+ 29268, 29313, 29358, 29402, 29446,
+ 29490, 29534, 29577, 29621, 29663,
+ 29706, 29748, 29790, 29832, 29873,
+ 29915, 29955, 29996, 30036, 30076,
+ 30116, 30156, 30195, 30234, 30272,
+ 30311, 30349, 30386, 30424, 30461,
+ 30498, 30535, 30571, 30607, 30643,
+ 30678, 30713, 30748, 30783, 30817,
+ 30851, 30885, 30918, 30951, 30984,
+ 31017, 31049, 31081, 31113, 31144,
+ 31175, 31206, 31236, 31267, 31297,
+ 31326, 31356, 31385, 31413, 31442,
+ 31470, 31498, 31525, 31553, 31580,
+ 31606, 31633, 31659, 31684, 31710,
+ 31735, 31760, 31785, 31809, 31833,
+ 31856, 31880, 31903, 31926, 31948,
+ 31970, 31992, 32014, 32035, 32056,
+ 32077, 32097, 32117, 32137, 32156,
+ 32176, 32194, 32213, 32231, 32249,
+ 32267, 32284, 32301, 32318, 32334,
+ 32350, 32366, 32382, 32397, 32412,
+ 32426, 32441, 32455, 32468, 32482,
+ 32495, 32508, 32520, 32532, 32544,
+ 32556, 32567, 32578, 32588, 32599,
+ 32609, 32618, 32628, 32637, 32646,
+ 32654, 32662, 32670, 32678, 32685,
+ 32692, 32699, 32705, 32711, 32717,
+ 32722, 32727, 32732, 32736, 32740,
+ 32744, 32748, 32751, 32754, 32757,
+ 32759, 32761, 32763, 32764, 32765,
+ 32766, 32766
+ };
+
+const Word16 cos_scale_tbl_512[512] = /* Q15 */
+ {
+ 32767, 32766, 32766, 32765, 32764,
+ 32763, 32761, 32759, 32757, 32754,
+ 32751, 32748, 32744, 32740, 32736,
+ 32732, 32727, 32722, 32717, 32711,
+ 32705, 32699, 32692, 32685, 32678,
+ 32670, 32662, 32654, 32646, 32637,
+ 32628, 32618, 32609, 32599, 32588,
+ 32578, 32567, 32556, 32544, 32532,
+ 32520, 32508, 32495, 32482, 32468,
+ 32455, 32441, 32426, 32412, 32397,
+ 32382, 32366, 32350, 32334, 32318,
+ 32301, 32284, 32267, 32249, 32231,
+ 32213, 32194, 32176, 32156, 32137,
+ 32117, 32097, 32077, 32056, 32035,
+ 32014, 31992, 31970, 31948, 31926,
+ 31903, 31880, 31856, 31833, 31809,
+ 31785, 31760, 31735, 31710, 31684,
+ 31659, 31633, 31606, 31580, 31553,
+ 31525, 31498, 31470, 31442, 31413,
+ 31385, 31356, 31326, 31297, 31267,
+ 31236, 31206, 31175, 31144, 31113,
+ 31081, 31049, 31017, 30984, 30951,
+ 30918, 30885, 30851, 30817, 30783,
+ 30748, 30713, 30678, 30643, 30607,
+ 30571, 30535, 30498, 30461, 30424,
+ 30386, 30349, 30311, 30272, 30234,
+ 30195, 30156, 30116, 30076, 30036,
+ 29996, 29955, 29915, 29873, 29832,
+ 29790, 29748, 29706, 29663, 29621,
+ 29577, 29534, 29490, 29446, 29402,
+ 29358, 29313, 29268, 29222, 29177,
+ 29131, 29085, 29038, 28992, 28945,
+ 28897, 28850, 28802, 28754, 28706,
+ 28657, 28608, 28559, 28510, 28460,
+ 28410, 28360, 28309, 28259, 28208,
+ 28156, 28105, 28053, 28001, 27948,
+ 27896, 27843, 27790, 27736, 27683,
+ 27629, 27575, 27520, 27466, 27411,
+ 27355, 27300, 27244, 27188, 27132,
+ 27076, 27019, 26962, 26905, 26847,
+ 26789, 26731, 26673, 26615, 26556,
+ 26497, 26437, 26378, 26318, 26258,
+ 26198, 26137, 26077, 26016, 25954,
+ 25893, 25831, 25769, 25707, 25645,
+ 25582, 25519, 25456, 25392, 25329,
+ 25265, 25201, 25136, 25072, 25007,
+ 24942, 24877, 24811, 24745, 24679,
+ 24613, 24546, 24480, 24413, 24346,
+ 24278, 24211, 24143, 24075, 24006,
+ 23938, 23869, 23800, 23731, 23661,
+ 23592, 23522, 23452, 23382, 23311,
+ 23240, 23169, 23098, 23027, 22955,
+ 22883, 22811, 22739, 22666, 22594,
+ 22521, 22448, 22374, 22301, 22227,
+ 22153, 22079, 22004, 21930, 21855,
+ 21780, 21705, 21629, 21554, 21478,
+ 21402, 21326, 21249, 21173, 21096,
+ 21019, 20942, 20864, 20787, 20709,
+ 20631, 20553, 20474, 20396, 20317,
+ 20238, 20159, 20079, 20000, 19920,
+ 19840, 19760, 19680, 19599, 19519,
+ 19438, 19357, 19276, 19194, 19113,
+ 19031, 18949, 18867, 18785, 18702,
+ 18620, 18537, 18454, 18371, 18287,
+ 18204, 18120, 18036, 17952, 17868,
+ 17784, 17699, 17615, 17530, 17445,
+ 17360, 17274, 17189, 17103, 17017,
+ 16931, 16845, 16759, 16672, 16586,
+ 16499, 16412, 16325, 16238, 16150,
+ 16063, 15975, 15887, 15799, 15711,
+ 15623, 15534, 15446, 15357, 15268,
+ 15179, 15090, 15001, 14911, 14822,
+ 14732, 14642, 14552, 14462, 14372,
+ 14281, 14191, 14100, 14009, 13918,
+ 13827, 13736, 13645, 13553, 13462,
+ 13370, 13278, 13186, 13094, 13002,
+ 12909, 12817, 12724, 12632, 12539,
+ 12446, 12353, 12260, 12166, 12073,
+ 11980, 11886, 11792, 11698, 11604,
+ 11510, 11416, 11322, 11227, 11133,
+ 11038, 10944, 10849, 10754, 10659,
+ 10564, 10469, 10373, 10278, 10182,
+ 10087, 9991, 9895, 9799, 9703,
+ 9607, 9511, 9415, 9319, 9222,
+ 9126, 9029, 8932, 8836, 8739,
+ 8642, 8545, 8448, 8351, 8253,
+ 8156, 8059, 7961, 7864, 7766,
+ 7668, 7571, 7473, 7375, 7277,
+ 7179, 7081, 6982, 6884, 6786,
+ 6688, 6589, 6491, 6392, 6293,
+ 6195, 6096, 5997, 5898, 5799,
+ 5700, 5601, 5502, 5403, 5304,
+ 5205, 5106, 5006, 4907, 4807,
+ 4708, 4608, 4509, 4409, 4310,
+ 4210, 4110, 4011, 3911, 3811,
+ 3711, 3611, 3511, 3411, 3311,
+ 3211, 3111, 3011, 2911, 2811,
+ 2711, 2610, 2510, 2410, 2310,
+ 2209, 2109, 2009, 1908, 1808,
+ 1708, 1607, 1507, 1406, 1306,
+ 1206, 1105, 1005, 904, 804,
+ 703, 603, 502, 402, 301,
+ 201, 100
+ };
+
+const Word16 sin_scale_tbl_1200[1200] = { /* Q15 */
+ 0, 42, 85, 128, 171, 214, 257, 300,
+ 343, 386, 428, 471, 514, 557, 600, 643,
+ 686, 729, 771, 814, 857, 900, 943, 986,
+ 1029, 1072, 1114, 1157, 1200, 1243, 1286, 1329,
+ 1372, 1414, 1457, 1500, 1543, 1586, 1629, 1672,
+ 1714, 1757, 1800, 1843, 1886, 1929, 1971, 2014,
+ 2057, 2100, 2143, 2185, 2228, 2271, 2314, 2357,
+ 2399, 2442, 2485, 2528, 2570, 2613, 2656, 2699,
+ 2741, 2784, 2827, 2870, 2912, 2955, 2998, 3040,
+ 3083, 3126, 3169, 3211, 3254, 3297, 3339, 3382,
+ 3425, 3467, 3510, 3553, 3595, 3638, 3680, 3723,
+ 3766, 3808, 3851, 3893, 3936, 3979, 4021, 4064,
+ 4106, 4149, 4191, 4234, 4276, 4319, 4361, 4404,
+ 4446, 4489, 4531, 4574, 4616, 4659, 4701, 4744,
+ 4786, 4829, 4871, 4913, 4956, 4998, 5041, 5083,
+ 5125, 5168, 5210, 5252, 5295, 5337, 5379, 5422,
+ 5464, 5506, 5549, 5591, 5633, 5675, 5718, 5760,
+ 5802, 5844, 5886, 5929, 5971, 6013, 6055, 6097,
+ 6139, 6182, 6224, 6266, 6308, 6350, 6392, 6434,
+ 6476, 6518, 6560, 6602, 6644, 6686, 6728, 6770,
+ 6812, 6854, 6896, 6938, 6980, 7022, 7064, 7106,
+ 7147, 7189, 7231, 7273, 7315, 7357, 7398, 7440,
+ 7482, 7524, 7565, 7607, 7649, 7691, 7732, 7774,
+ 7816, 7857, 7899, 7940, 7982, 8024, 8065, 8107,
+ 8148, 8190, 8231, 8273, 8314, 8356, 8397, 8439,
+ 8480, 8522, 8563, 8604, 8646, 8687, 8729, 8770,
+ 8811, 8853, 8894, 8935, 8976, 9018, 9059, 9100,
+ 9141, 9182, 9224, 9265, 9306, 9347, 9388, 9429,
+ 9470, 9511, 9552, 9593, 9634, 9675, 9716, 9757,
+ 9798, 9839, 9880, 9921, 9962, 10003, 10043, 10084,
+ 10125, 10166, 10207, 10247, 10288, 10329, 10370, 10410,
+ 10451, 10491, 10532, 10573, 10613, 10654, 10694, 10735,
+ 10775, 10816, 10856, 10897, 10937, 10978, 11018, 11059,
+ 11099, 11139, 11180, 11220, 11260, 11300, 11341, 11381,
+ 11421, 11461, 11502, 11542, 11582, 11622, 11662, 11702,
+ 11742, 11782, 11822, 11862, 11902, 11942, 11982, 12022,
+ 12062, 12102, 12142, 12181, 12221, 12261, 12301, 12340,
+ 12380, 12420, 12460, 12499, 12539, 12579, 12618, 12658,
+ 12697, 12737, 12776, 12816, 12855, 12895, 12934, 12973,
+ 13013, 13052, 13092, 13131, 13170, 13209, 13249, 13288,
+ 13327, 13366, 13405, 13444, 13484, 13523, 13562, 13601,
+ 13640, 13679, 13718, 13757, 13796, 13834, 13873, 13912,
+ 13951, 13990, 14029, 14067, 14106, 14145, 14183, 14222,
+ 14261, 14299, 14338, 14376, 14415, 14453, 14492, 14530,
+ 14569, 14607, 14646, 14684, 14722, 14761, 14799, 14837,
+ 14875, 14914, 14952, 14990, 15028, 15066, 15104, 15142,
+ 15180, 15218, 15256, 15294, 15332, 15370, 15408, 15446,
+ 15484, 15521, 15559, 15597, 15635, 15672, 15710, 15748,
+ 15785, 15823, 15860, 15898, 15935, 15973, 16010, 16048,
+ 16085, 16122, 16160, 16197, 16234, 16271, 16309, 16346,
+ 16383, 16420, 16457, 16494, 16531, 16568, 16605, 16642,
+ 16679, 16716, 16753, 16790, 16827, 16863, 16900, 16937,
+ 16974, 17010, 17047, 17084, 17120, 17157, 17193, 17230,
+ 17266, 17303, 17339, 17375, 17412, 17448, 17484, 17521,
+ 17557, 17593, 17629, 17665, 17702, 17738, 17774, 17810,
+ 17846, 17882, 17918, 17953, 17989, 18025, 18061, 18097,
+ 18132, 18168, 18204, 18240, 18275, 18311, 18346, 18382,
+ 18417, 18453, 18488, 18524, 18559, 18594, 18630, 18665,
+ 18700, 18735, 18770, 18806, 18841, 18876, 18911, 18946,
+ 18981, 19016, 19051, 19086, 19120, 19155, 19190, 19225,
+ 19259, 19294, 19329, 19363, 19398, 19433, 19467, 19502,
+ 19536, 19570, 19605, 19639, 19673, 19708, 19742, 19776,
+ 19810, 19845, 19879, 19913, 19947, 19981, 20015, 20049,
+ 20083, 20117, 20150, 20184, 20218, 20252, 20285, 20319,
+ 20353, 20386, 20420, 20453, 20487, 20520, 20554, 20587,
+ 20620, 20654, 20687, 20720, 20753, 20787, 20820, 20853,
+ 20886, 20919, 20952, 20985, 21018, 21051, 21084, 21116,
+ 21149, 21182, 21215, 21247, 21280, 21313, 21345, 21378,
+ 21410, 21443, 21475, 21507, 21540, 21572, 21604, 21637,
+ 21669, 21701, 21733, 21765, 21797, 21829, 21861, 21893,
+ 21925, 21957, 21989, 22020, 22052, 22084, 22115, 22147,
+ 22179, 22210, 22242, 22273, 22305, 22336, 22367, 22399,
+ 22430, 22461, 22493, 22524, 22555, 22586, 22617, 22648,
+ 22679, 22710, 22741, 22772, 22802, 22833, 22864, 22895,
+ 22925, 22956, 22987, 23017, 23048, 23078, 23109, 23139,
+ 23169, 23200, 23230, 23260, 23290, 23320, 23351, 23381,
+ 23411, 23441, 23471, 23500, 23530, 23560, 23590, 23620,
+ 23649, 23679, 23709, 23738, 23768, 23797, 23827, 23856,
+ 23886, 23915, 23944, 23974, 24003, 24032, 24061, 24090,
+ 24119, 24148, 24177, 24206, 24235, 24264, 24293, 24321,
+ 24350, 24379, 24407, 24436, 24465, 24493, 24522, 24550,
+ 24578, 24607, 24635, 24663, 24692, 24720, 24748, 24776,
+ 24804, 24832, 24860, 24888, 24916, 24944, 24971, 24999,
+ 25027, 25054, 25082, 25110, 25137, 25165, 25192, 25220,
+ 25247, 25274, 25302, 25329, 25356, 25383, 25410, 25437,
+ 25464, 25491, 25518, 25545, 25572, 25599, 25625, 25652,
+ 25679, 25705, 25732, 25759, 25785, 25811, 25838, 25864,
+ 25891, 25917, 25943, 25969, 25995, 26021, 26047, 26073,
+ 26099, 26125, 26151, 26177, 26203, 26228, 26254, 26280,
+ 26305, 26331, 26356, 26382, 26407, 26433, 26458, 26483,
+ 26509, 26534, 26559, 26584, 26609, 26634, 26659, 26684,
+ 26709, 26734, 26758, 26783, 26808, 26832, 26857, 26882,
+ 26906, 26931, 26955, 26979, 27004, 27028, 27052, 27076,
+ 27100, 27125, 27149, 27173, 27197, 27220, 27244, 27268,
+ 27292, 27316, 27339, 27363, 27386, 27410, 27433, 27457,
+ 27480, 27504, 27527, 27550, 27573, 27596, 27620, 27643,
+ 27666, 27689, 27711, 27734, 27757, 27780, 27803, 27825,
+ 27848, 27871, 27893, 27916, 27938, 27960, 27983, 28005,
+ 28027, 28049, 28072, 28094, 28116, 28138, 28160, 28182,
+ 28203, 28225, 28247, 28269, 28290, 28312, 28334, 28355,
+ 28377, 28398, 28419, 28441, 28462, 28483, 28504, 28525,
+ 28547, 28568, 28589, 28610, 28630, 28651, 28672, 28693,
+ 28713, 28734, 28755, 28775, 28796, 28816, 28837, 28857,
+ 28877, 28897, 28918, 28938, 28958, 28978, 28998, 29018,
+ 29038, 29058, 29077, 29097, 29117, 29136, 29156, 29176,
+ 29195, 29215, 29234, 29253, 29273, 29292, 29311, 29330,
+ 29349, 29368, 29387, 29406, 29425, 29444, 29463, 29482,
+ 29500, 29519, 29537, 29556, 29575, 29593, 29611, 29630,
+ 29648, 29666, 29684, 29703, 29721, 29739, 29757, 29775,
+ 29792, 29810, 29828, 29846, 29863, 29881, 29899, 29916,
+ 29934, 29951, 29968, 29986, 30003, 30020, 30037, 30055,
+ 30072, 30089, 30106, 30122, 30139, 30156, 30173, 30190,
+ 30206, 30223, 30239, 30256, 30272, 30289, 30305, 30321,
+ 30338, 30354, 30370, 30386, 30402, 30418, 30434, 30450,
+ 30465, 30481, 30497, 30513, 30528, 30544, 30559, 30575,
+ 30590, 30605, 30621, 30636, 30651, 30666, 30681, 30696,
+ 30711, 30726, 30741, 30756, 30771, 30786, 30800, 30815,
+ 30829, 30844, 30858, 30873, 30887, 30901, 30916, 30930,
+ 30944, 30958, 30972, 30986, 31000, 31014, 31028, 31041,
+ 31055, 31069, 31082, 31096, 31109, 31123, 31136, 31149,
+ 31163, 31176, 31189, 31202, 31215, 31228, 31241, 31254,
+ 31267, 31280, 31293, 31305, 31318, 31331, 31343, 31356,
+ 31368, 31380, 31393, 31405, 31417, 31429, 31441, 31453,
+ 31465, 31477, 31489, 31501, 31513, 31525, 31536, 31548,
+ 31559, 31571, 31582, 31594, 31605, 31616, 31628, 31639,
+ 31650, 31661, 31672, 31683, 31694, 31705, 31716, 31726,
+ 31737, 31748, 31758, 31769, 31779, 31790, 31800, 31810,
+ 31821, 31831, 31841, 31851, 31861, 31871, 31881, 31891,
+ 31901, 31911, 31920, 31930, 31940, 31949, 31959, 31968,
+ 31977, 31987, 31996, 32005, 32014, 32023, 32033, 32042,
+ 32050, 32059, 32068, 32077, 32086, 32094, 32103, 32112,
+ 32120, 32128, 32137, 32145, 32154, 32162, 32170, 32178,
+ 32186, 32194, 32202, 32210, 32218, 32226, 32233, 32241,
+ 32249, 32256, 32264, 32271, 32279, 32286, 32293, 32300,
+ 32308, 32315, 32322, 32329, 32336, 32343, 32350, 32356,
+ 32363, 32370, 32376, 32383, 32389, 32396, 32402, 32409,
+ 32415, 32421, 32427, 32434, 32440, 32446, 32452, 32457,
+ 32463, 32469, 32475, 32481, 32486, 32492, 32497, 32503,
+ 32508, 32513, 32519, 32524, 32529, 32534, 32539, 32544,
+ 32549, 32554, 32559, 32564, 32569, 32573, 32578, 32582,
+ 32587, 32591, 32596, 32600, 32604, 32609, 32613, 32617,
+ 32621, 32625, 32629, 32633, 32637, 32641, 32644, 32648,
+ 32652, 32655, 32659, 32662, 32665, 32669, 32672, 32675,
+ 32679, 32682, 32685, 32688, 32691, 32694, 32696, 32699,
+ 32702, 32705, 32707, 32710, 32712, 32715, 32717, 32719,
+ 32722, 32724, 32726, 32728, 32730, 32732, 32734, 32736,
+ 32738, 32740, 32741, 32743, 32744, 32746, 32748, 32749,
+ 32750, 32752, 32753, 32754, 32755, 32756, 32757, 32758,
+ 32759, 32760, 32761, 32762, 32762, 32763, 32764, 32764,
+ 32765, 32765, 32765, 32766, 32766, 32766, 32766, 32766
+};
+
+const Word16 cos_scale_tbl_1200[1200] = { /* Q15 */
+ 0, 42, 85, 128, 171, 214, 257, 300,
+ 343, 386, 428, 471, 514, 557, 600, 643,
+ 686, 729, 771, 814, 857, 900, 943, 986,
+ 1029, 1072, 1114, 1157, 1200, 1243, 1286, 1329,
+ 1372, 1414, 1457, 1500, 1543, 1586, 1629, 1672,
+ 1714, 1757, 1800, 1843, 1886, 1929, 1971, 2014,
+ 2057, 2100, 2143, 2185, 2228, 2271, 2314, 2357,
+ 2399, 2442, 2485, 2528, 2570, 2613, 2656, 2699,
+ 2741, 2784, 2827, 2870, 2912, 2955, 2998, 3040,
+ 3083, 3126, 3169, 3211, 3254, 3297, 3339, 3382,
+ 3425, 3467, 3510, 3553, 3595, 3638, 3680, 3723,
+ 3766, 3808, 3851, 3893, 3936, 3979, 4021, 4064,
+ 4106, 4149, 4191, 4234, 4276, 4319, 4361, 4404,
+ 4446, 4489, 4531, 4574, 4616, 4659, 4701, 4744,
+ 4786, 4829, 4871, 4913, 4956, 4998, 5041, 5083,
+ 5125, 5168, 5210, 5252, 5295, 5337, 5379, 5422,
+ 5464, 5506, 5549, 5591, 5633, 5675, 5718, 5760,
+ 5802, 5844, 5886, 5929, 5971, 6013, 6055, 6097,
+ 6139, 6182, 6224, 6266, 6308, 6350, 6392, 6434,
+ 6476, 6518, 6560, 6602, 6644, 6686, 6728, 6770,
+ 6812, 6854, 6896, 6938, 6980, 7022, 7064, 7106,
+ 7147, 7189, 7231, 7273, 7315, 7357, 7398, 7440,
+ 7482, 7524, 7565, 7607, 7649, 7691, 7732, 7774,
+ 7816, 7857, 7899, 7940, 7982, 8024, 8065, 8107,
+ 8148, 8190, 8231, 8273, 8314, 8356, 8397, 8439,
+ 8480, 8522, 8563, 8604, 8646, 8687, 8729, 8770,
+ 8811, 8853, 8894, 8935, 8976, 9018, 9059, 9100,
+ 9141, 9182, 9224, 9265, 9306, 9347, 9388, 9429,
+ 9470, 9511, 9552, 9593, 9634, 9675, 9716, 9757,
+ 9798, 9839, 9880, 9921, 9962, 10003, 10043, 10084,
+ 10125, 10166, 10207, 10247, 10288, 10329, 10370, 10410,
+ 10451, 10491, 10532, 10573, 10613, 10654, 10694, 10735,
+ 10775, 10816, 10856, 10897, 10937, 10978, 11018, 11059,
+ 11099, 11139, 11180, 11220, 11260, 11300, 11341, 11381,
+ 11421, 11461, 11502, 11542, 11582, 11622, 11662, 11702,
+ 11742, 11782, 11822, 11862, 11902, 11942, 11982, 12022,
+ 12062, 12102, 12142, 12181, 12221, 12261, 12301, 12340,
+ 12380, 12420, 12460, 12499, 12539, 12579, 12618, 12658,
+ 12697, 12737, 12776, 12816, 12855, 12895, 12934, 12973,
+ 13013, 13052, 13092, 13131, 13170, 13209, 13249, 13288,
+ 13327, 13366, 13405, 13444, 13484, 13523, 13562, 13601,
+ 13640, 13679, 13718, 13757, 13796, 13834, 13873, 13912,
+ 13951, 13990, 14029, 14067, 14106, 14145, 14183, 14222,
+ 14261, 14299, 14338, 14376, 14415, 14453, 14492, 14530,
+ 14569, 14607, 14646, 14684, 14722, 14761, 14799, 14837,
+ 14875, 14914, 14952, 14990, 15028, 15066, 15104, 15142,
+ 15180, 15218, 15256, 15294, 15332, 15370, 15408, 15446,
+ 15484, 15521, 15559, 15597, 15635, 15672, 15710, 15748,
+ 15785, 15823, 15860, 15898, 15935, 15973, 16010, 16048,
+ 16085, 16122, 16160, 16197, 16234, 16271, 16309, 16346,
+ 16383, 16420, 16457, 16494, 16531, 16568, 16605, 16642,
+ 16679, 16716, 16753, 16790, 16827, 16863, 16900, 16937,
+ 16974, 17010, 17047, 17084, 17120, 17157, 17193, 17230,
+ 17266, 17303, 17339, 17375, 17412, 17448, 17484, 17521,
+ 17557, 17593, 17629, 17665, 17702, 17738, 17774, 17810,
+ 17846, 17882, 17918, 17953, 17989, 18025, 18061, 18097,
+ 18132, 18168, 18204, 18240, 18275, 18311, 18346, 18382,
+ 18417, 18453, 18488, 18524, 18559, 18594, 18630, 18665,
+ 18700, 18735, 18770, 18806, 18841, 18876, 18911, 18946,
+ 18981, 19016, 19051, 19086, 19120, 19155, 19190, 19225,
+ 19259, 19294, 19329, 19363, 19398, 19433, 19467, 19502,
+ 19536, 19570, 19605, 19639, 19673, 19708, 19742, 19776,
+ 19810, 19845, 19879, 19913, 19947, 19981, 20015, 20049,
+ 20083, 20117, 20150, 20184, 20218, 20252, 20285, 20319,
+ 20353, 20386, 20420, 20453, 20487, 20520, 20554, 20587,
+ 20620, 20654, 20687, 20720, 20753, 20787, 20820, 20853,
+ 20886, 20919, 20952, 20985, 21018, 21051, 21084, 21116,
+ 21149, 21182, 21215, 21247, 21280, 21313, 21345, 21378,
+ 21410, 21443, 21475, 21507, 21540, 21572, 21604, 21637,
+ 21669, 21701, 21733, 21765, 21797, 21829, 21861, 21893,
+ 21925, 21957, 21989, 22020, 22052, 22084, 22115, 22147,
+ 22179, 22210, 22242, 22273, 22305, 22336, 22367, 22399,
+ 22430, 22461, 22493, 22524, 22555, 22586, 22617, 22648,
+ 22679, 22710, 22741, 22772, 22802, 22833, 22864, 22895,
+ 22925, 22956, 22987, 23017, 23048, 23078, 23109, 23139,
+ 23169, 23200, 23230, 23260, 23290, 23320, 23351, 23381,
+ 23411, 23441, 23471, 23500, 23530, 23560, 23590, 23620,
+ 23649, 23679, 23709, 23738, 23768, 23797, 23827, 23856,
+ 23886, 23915, 23944, 23974, 24003, 24032, 24061, 24090,
+ 24119, 24148, 24177, 24206, 24235, 24264, 24293, 24321,
+ 24350, 24379, 24407, 24436, 24465, 24493, 24522, 24550,
+ 24578, 24607, 24635, 24663, 24692, 24720, 24748, 24776,
+ 24804, 24832, 24860, 24888, 24916, 24944, 24971, 24999,
+ 25027, 25054, 25082, 25110, 25137, 25165, 25192, 25220,
+ 25247, 25274, 25302, 25329, 25356, 25383, 25410, 25437,
+ 25464, 25491, 25518, 25545, 25572, 25599, 25625, 25652,
+ 25679, 25705, 25732, 25759, 25785, 25811, 25838, 25864,
+ 25891, 25917, 25943, 25969, 25995, 26021, 26047, 26073,
+ 26099, 26125, 26151, 26177, 26203, 26228, 26254, 26280,
+ 26305, 26331, 26356, 26382, 26407, 26433, 26458, 26483,
+ 26509, 26534, 26559, 26584, 26609, 26634, 26659, 26684,
+ 26709, 26734, 26758, 26783, 26808, 26832, 26857, 26882,
+ 26906, 26931, 26955, 26979, 27004, 27028, 27052, 27076,
+ 27100, 27125, 27149, 27173, 27197, 27220, 27244, 27268,
+ 27292, 27316, 27339, 27363, 27386, 27410, 27433, 27457,
+ 27480, 27504, 27527, 27550, 27573, 27596, 27620, 27643,
+ 27666, 27689, 27711, 27734, 27757, 27780, 27803, 27825,
+ 27848, 27871, 27893, 27916, 27938, 27960, 27983, 28005,
+ 28027, 28049, 28072, 28094, 28116, 28138, 28160, 28182,
+ 28203, 28225, 28247, 28269, 28290, 28312, 28334, 28355,
+ 28377, 28398, 28419, 28441, 28462, 28483, 28504, 28525,
+ 28547, 28568, 28589, 28610, 28630, 28651, 28672, 28693,
+ 28713, 28734, 28755, 28775, 28796, 28816, 28837, 28857,
+ 28877, 28897, 28918, 28938, 28958, 28978, 28998, 29018,
+ 29038, 29058, 29077, 29097, 29117, 29136, 29156, 29176,
+ 29195, 29215, 29234, 29253, 29273, 29292, 29311, 29330,
+ 29349, 29368, 29387, 29406, 29425, 29444, 29463, 29482,
+ 29500, 29519, 29537, 29556, 29575, 29593, 29611, 29630,
+ 29648, 29666, 29684, 29703, 29721, 29739, 29757, 29775,
+ 29792, 29810, 29828, 29846, 29863, 29881, 29899, 29916,
+ 29934, 29951, 29968, 29986, 30003, 30020, 30037, 30055,
+ 30072, 30089, 30106, 30122, 30139, 30156, 30173, 30190,
+ 30206, 30223, 30239, 30256, 30272, 30289, 30305, 30321,
+ 30338, 30354, 30370, 30386, 30402, 30418, 30434, 30450,
+ 30465, 30481, 30497, 30513, 30528, 30544, 30559, 30575,
+ 30590, 30605, 30621, 30636, 30651, 30666, 30681, 30696,
+ 30711, 30726, 30741, 30756, 30771, 30786, 30800, 30815,
+ 30829, 30844, 30858, 30873, 30887, 30901, 30916, 30930,
+ 30944, 30958, 30972, 30986, 31000, 31014, 31028, 31041,
+ 31055, 31069, 31082, 31096, 31109, 31123, 31136, 31149,
+ 31163, 31176, 31189, 31202, 31215, 31228, 31241, 31254,
+ 31267, 31280, 31293, 31305, 31318, 31331, 31343, 31356,
+ 31368, 31380, 31393, 31405, 31417, 31429, 31441, 31453,
+ 31465, 31477, 31489, 31501, 31513, 31525, 31536, 31548,
+ 31559, 31571, 31582, 31594, 31605, 31616, 31628, 31639,
+ 31650, 31661, 31672, 31683, 31694, 31705, 31716, 31726,
+ 31737, 31748, 31758, 31769, 31779, 31790, 31800, 31810,
+ 31821, 31831, 31841, 31851, 31861, 31871, 31881, 31891,
+ 31901, 31911, 31920, 31930, 31940, 31949, 31959, 31968,
+ 31977, 31987, 31996, 32005, 32014, 32023, 32033, 32042,
+ 32050, 32059, 32068, 32077, 32086, 32094, 32103, 32112,
+ 32120, 32128, 32137, 32145, 32154, 32162, 32170, 32178,
+ 32186, 32194, 32202, 32210, 32218, 32226, 32233, 32241,
+ 32249, 32256, 32264, 32271, 32279, 32286, 32293, 32300,
+ 32308, 32315, 32322, 32329, 32336, 32343, 32350, 32356,
+ 32363, 32370, 32376, 32383, 32389, 32396, 32402, 32409,
+ 32415, 32421, 32427, 32434, 32440, 32446, 32452, 32457,
+ 32463, 32469, 32475, 32481, 32486, 32492, 32497, 32503,
+ 32508, 32513, 32519, 32524, 32529, 32534, 32539, 32544,
+ 32549, 32554, 32559, 32564, 32569, 32573, 32578, 32582,
+ 32587, 32591, 32596, 32600, 32604, 32609, 32613, 32617,
+ 32621, 32625, 32629, 32633, 32637, 32641, 32644, 32648,
+ 32652, 32655, 32659, 32662, 32665, 32669, 32672, 32675,
+ 32679, 32682, 32685, 32688, 32691, 32694, 32696, 32699,
+ 32702, 32705, 32707, 32710, 32712, 32715, 32717, 32719,
+ 32722, 32724, 32726, 32728, 32730, 32732, 32734, 32736,
+ 32738, 32740, 32741, 32743, 32744, 32746, 32748, 32749,
+ 32750, 32752, 32753, 32754, 32755, 32756, 32757, 32758,
+ 32759, 32760, 32761, 32762, 32762, 32763, 32764, 32764,
+ 32765, 32765, 32765, 32766, 32766, 32766, 32766, 32766
+};
+
+const Word16 sin_scale_tbl_800[800] = { /* Q15 */
+ 0, 64, 128, 193, 257, 321, 386, 450,
+ 514, 579, 643, 707, 771, 836, 900, 964,
+ 1029, 1093, 1157, 1222, 1286, 1350, 1414, 1479,
+ 1543, 1607, 1672, 1736, 1800, 1864, 1929, 1993,
+ 2057, 2121, 2185, 2250, 2314, 2378, 2442, 2506,
+ 2570, 2635, 2699, 2763, 2827, 2891, 2955, 3019,
+ 3083, 3147, 3211, 3275, 3339, 3403, 3467, 3531,
+ 3595, 3659, 3723, 3787, 3851, 3915, 3979, 4042,
+ 4106, 4170, 4234, 4298, 4361, 4425, 4489, 4553,
+ 4616, 4680, 4744, 4807, 4871, 4935, 4998, 5062,
+ 5125, 5189, 5252, 5316, 5379, 5443, 5506, 5570,
+ 5633, 5696, 5760, 5823, 5886, 5950, 6013, 6076,
+ 6139, 6203, 6266, 6329, 6392, 6455, 6518, 6581,
+ 6644, 6707, 6770, 6833, 6896, 6959, 7022, 7085,
+ 7147, 7210, 7273, 7336, 7398, 7461, 7524, 7586,
+ 7649, 7711, 7774, 7836, 7899, 7961, 8024, 8086,
+ 8148, 8211, 8273, 8335, 8397, 8460, 8522, 8584,
+ 8646, 8708, 8770, 8832, 8894, 8956, 9018, 9079,
+ 9141, 9203, 9265, 9326, 9388, 9450, 9511, 9573,
+ 9634, 9696, 9757, 9819, 9880, 9941, 10003, 10064,
+ 10125, 10186, 10247, 10308, 10370, 10431, 10491, 10552,
+ 10613, 10674, 10735, 10796, 10856, 10917, 10978, 11038,
+ 11099, 11159, 11220, 11280, 11341, 11401, 11461, 11522,
+ 11582, 11642, 11702, 11762, 11822, 11882, 11942, 12002,
+ 12062, 12122, 12181, 12241, 12301, 12360, 12420, 12479,
+ 12539, 12598, 12658, 12717, 12776, 12835, 12895, 12954,
+ 13013, 13072, 13131, 13190, 13249, 13307, 13366, 13425,
+ 13484, 13542, 13601, 13659, 13718, 13776, 13834, 13893,
+ 13951, 14009, 14067, 14125, 14183, 14241, 14299, 14357,
+ 14415, 14473, 14530, 14588, 14646, 14703, 14761, 14818,
+ 14875, 14933, 14990, 15047, 15104, 15161, 15218, 15275,
+ 15332, 15389, 15446, 15502, 15559, 15616, 15672, 15729,
+ 15785, 15841, 15898, 15954, 16010, 16066, 16122, 16178,
+ 16234, 16290, 16346, 16402, 16457, 16513, 16568, 16624,
+ 16679, 16735, 16790, 16845, 16900, 16955, 17010, 17065,
+ 17120, 17175, 17230, 17284, 17339, 17394, 17448, 17503,
+ 17557, 17611, 17665, 17720, 17774, 17828, 17882, 17936,
+ 17989, 18043, 18097, 18150, 18204, 18257, 18311, 18364,
+ 18417, 18470, 18524, 18577, 18630, 18682, 18735, 18788,
+ 18841, 18893, 18946, 18998, 19051, 19103, 19155, 19207,
+ 19259, 19311, 19363, 19415, 19467, 19519, 19570, 19622,
+ 19673, 19725, 19776, 19827, 19879, 19930, 19981, 20032,
+ 20083, 20133, 20184, 20235, 20285, 20336, 20386, 20437,
+ 20487, 20537, 20587, 20637, 20687, 20737, 20787, 20836,
+ 20886, 20936, 20985, 21034, 21084, 21133, 21182, 21231,
+ 21280, 21329, 21378, 21426, 21475, 21524, 21572, 21620,
+ 21669, 21717, 21765, 21813, 21861, 21909, 21957, 22004,
+ 22052, 22100, 22147, 22194, 22242, 22289, 22336, 22383,
+ 22430, 22477, 22524, 22570, 22617, 22663, 22710, 22756,
+ 22802, 22849, 22895, 22941, 22987, 23032, 23078, 23124,
+ 23169, 23215, 23260, 23305, 23351, 23396, 23441, 23486,
+ 23530, 23575, 23620, 23664, 23709, 23753, 23797, 23842,
+ 23886, 23930, 23974, 24017, 24061, 24105, 24148, 24192,
+ 24235, 24278, 24321, 24364, 24407, 24450, 24493, 24536,
+ 24578, 24621, 24663, 24706, 24748, 24790, 24832, 24874,
+ 24916, 24957, 24999, 25041, 25082, 25123, 25165, 25206,
+ 25247, 25288, 25329, 25370, 25410, 25451, 25491, 25532,
+ 25572, 25612, 25652, 25692, 25732, 25772, 25811, 25851,
+ 25891, 25930, 25969, 26008, 26047, 26086, 26125, 26164,
+ 26203, 26241, 26280, 26318, 26356, 26395, 26433, 26471,
+ 26509, 26546, 26584, 26622, 26659, 26696, 26734, 26771,
+ 26808, 26845, 26882, 26918, 26955, 26991, 27028, 27064,
+ 27100, 27137, 27173, 27208, 27244, 27280, 27316, 27351,
+ 27386, 27422, 27457, 27492, 27527, 27562, 27596, 27631,
+ 27666, 27700, 27734, 27769, 27803, 27837, 27871, 27904,
+ 27938, 27972, 28005, 28038, 28072, 28105, 28138, 28171,
+ 28203, 28236, 28269, 28301, 28334, 28366, 28398, 28430,
+ 28462, 28494, 28525, 28557, 28589, 28620, 28651, 28682,
+ 28713, 28744, 28775, 28806, 28837, 28867, 28897, 28928,
+ 28958, 28988, 29018, 29048, 29077, 29107, 29136, 29166,
+ 29195, 29224, 29253, 29282, 29311, 29340, 29368, 29397,
+ 29425, 29453, 29482, 29510, 29537, 29565, 29593, 29621,
+ 29648, 29675, 29703, 29730, 29757, 29784, 29810, 29837,
+ 29863, 29890, 29916, 29942, 29968, 29994, 30020, 30046,
+ 30072, 30097, 30122, 30148, 30173, 30198, 30223, 30248,
+ 30272, 30297, 30321, 30346, 30370, 30394, 30418, 30442,
+ 30465, 30489, 30513, 30536, 30559, 30582, 30605, 30628,
+ 30651, 30674, 30696, 30719, 30741, 30763, 30786, 30807,
+ 30829, 30851, 30873, 30894, 30916, 30937, 30958, 30979,
+ 31000, 31021, 31041, 31062, 31082, 31103, 31123, 31143,
+ 31163, 31183, 31202, 31222, 31241, 31261, 31280, 31299,
+ 31318, 31337, 31356, 31374, 31393, 31411, 31429, 31447,
+ 31465, 31483, 31501, 31519, 31536, 31554, 31571, 31588,
+ 31605, 31622, 31639, 31656, 31672, 31689, 31705, 31721,
+ 31737, 31753, 31769, 31785, 31800, 31816, 31831, 31846,
+ 31861, 31876, 31891, 31906, 31920, 31935, 31949, 31963,
+ 31977, 31991, 32005, 32019, 32033, 32046, 32059, 32073,
+ 32086, 32099, 32112, 32124, 32137, 32149, 32162, 32174,
+ 32186, 32198, 32210, 32222, 32233, 32245, 32256, 32267,
+ 32279, 32290, 32300, 32311, 32322, 32332, 32343, 32353,
+ 32363, 32373, 32383, 32393, 32402, 32412, 32421, 32430,
+ 32440, 32449, 32457, 32466, 32475, 32483, 32492, 32500,
+ 32508, 32516, 32524, 32532, 32539, 32547, 32554, 32561,
+ 32569, 32576, 32582, 32589, 32596, 32602, 32609, 32615,
+ 32621, 32627, 32633, 32639, 32644, 32650, 32655, 32660,
+ 32665, 32670, 32675, 32680, 32685, 32689, 32694, 32698,
+ 32702, 32706, 32710, 32713, 32717, 32720, 32724, 32727,
+ 32730, 32733, 32736, 32739, 32741, 32744, 32746, 32748,
+ 32750, 32752, 32754, 32756, 32757, 32759, 32760, 32761,
+ 32762, 32763, 32764, 32765, 32765, 32766, 32766, 32766
+};
+
+const Word16 cos_scale_tbl_800[800] = { /* Q15 */
+ 0, 64, 128, 193, 257, 321, 386, 450,
+ 514, 579, 643, 707, 771, 836, 900, 964,
+ 1029, 1093, 1157, 1222, 1286, 1350, 1414, 1479,
+ 1543, 1607, 1672, 1736, 1800, 1864, 1929, 1993,
+ 2057, 2121, 2185, 2250, 2314, 2378, 2442, 2506,
+ 2570, 2635, 2699, 2763, 2827, 2891, 2955, 3019,
+ 3083, 3147, 3211, 3275, 3339, 3403, 3467, 3531,
+ 3595, 3659, 3723, 3787, 3851, 3915, 3979, 4042,
+ 4106, 4170, 4234, 4298, 4361, 4425, 4489, 4553,
+ 4616, 4680, 4744, 4807, 4871, 4935, 4998, 5062,
+ 5125, 5189, 5252, 5316, 5379, 5443, 5506, 5570,
+ 5633, 5696, 5760, 5823, 5886, 5950, 6013, 6076,
+ 6139, 6203, 6266, 6329, 6392, 6455, 6518, 6581,
+ 6644, 6707, 6770, 6833, 6896, 6959, 7022, 7085,
+ 7147, 7210, 7273, 7336, 7398, 7461, 7524, 7586,
+ 7649, 7711, 7774, 7836, 7899, 7961, 8024, 8086,
+ 8148, 8211, 8273, 8335, 8397, 8460, 8522, 8584,
+ 8646, 8708, 8770, 8832, 8894, 8956, 9018, 9079,
+ 9141, 9203, 9265, 9326, 9388, 9450, 9511, 9573,
+ 9634, 9696, 9757, 9819, 9880, 9941, 10003, 10064,
+ 10125, 10186, 10247, 10308, 10370, 10431, 10491, 10552,
+ 10613, 10674, 10735, 10796, 10856, 10917, 10978, 11038,
+ 11099, 11159, 11220, 11280, 11341, 11401, 11461, 11522,
+ 11582, 11642, 11702, 11762, 11822, 11882, 11942, 12002,
+ 12062, 12122, 12181, 12241, 12301, 12360, 12420, 12479,
+ 12539, 12598, 12658, 12717, 12776, 12835, 12895, 12954,
+ 13013, 13072, 13131, 13190, 13249, 13307, 13366, 13425,
+ 13484, 13542, 13601, 13659, 13718, 13776, 13834, 13893,
+ 13951, 14009, 14067, 14125, 14183, 14241, 14299, 14357,
+ 14415, 14473, 14530, 14588, 14646, 14703, 14761, 14818,
+ 14875, 14933, 14990, 15047, 15104, 15161, 15218, 15275,
+ 15332, 15389, 15446, 15502, 15559, 15616, 15672, 15729,
+ 15785, 15841, 15898, 15954, 16010, 16066, 16122, 16178,
+ 16234, 16290, 16346, 16402, 16457, 16513, 16568, 16624,
+ 16679, 16735, 16790, 16845, 16900, 16955, 17010, 17065,
+ 17120, 17175, 17230, 17284, 17339, 17394, 17448, 17503,
+ 17557, 17611, 17665, 17720, 17774, 17828, 17882, 17936,
+ 17989, 18043, 18097, 18150, 18204, 18257, 18311, 18364,
+ 18417, 18470, 18524, 18577, 18630, 18682, 18735, 18788,
+ 18841, 18893, 18946, 18998, 19051, 19103, 19155, 19207,
+ 19259, 19311, 19363, 19415, 19467, 19519, 19570, 19622,
+ 19673, 19725, 19776, 19827, 19879, 19930, 19981, 20032,
+ 20083, 20133, 20184, 20235, 20285, 20336, 20386, 20437,
+ 20487, 20537, 20587, 20637, 20687, 20737, 20787, 20836,
+ 20886, 20936, 20985, 21034, 21084, 21133, 21182, 21231,
+ 21280, 21329, 21378, 21426, 21475, 21524, 21572, 21620,
+ 21669, 21717, 21765, 21813, 21861, 21909, 21957, 22004,
+ 22052, 22100, 22147, 22194, 22242, 22289, 22336, 22383,
+ 22430, 22477, 22524, 22570, 22617, 22663, 22710, 22756,
+ 22802, 22849, 22895, 22941, 22987, 23032, 23078, 23124,
+ 23169, 23215, 23260, 23305, 23351, 23396, 23441, 23486,
+ 23530, 23575, 23620, 23664, 23709, 23753, 23797, 23842,
+ 23886, 23930, 23974, 24017, 24061, 24105, 24148, 24192,
+ 24235, 24278, 24321, 24364, 24407, 24450, 24493, 24536,
+ 24578, 24621, 24663, 24706, 24748, 24790, 24832, 24874,
+ 24916, 24957, 24999, 25041, 25082, 25123, 25165, 25206,
+ 25247, 25288, 25329, 25370, 25410, 25451, 25491, 25532,
+ 25572, 25612, 25652, 25692, 25732, 25772, 25811, 25851,
+ 25891, 25930, 25969, 26008, 26047, 26086, 26125, 26164,
+ 26203, 26241, 26280, 26318, 26356, 26395, 26433, 26471,
+ 26509, 26546, 26584, 26622, 26659, 26696, 26734, 26771,
+ 26808, 26845, 26882, 26918, 26955, 26991, 27028, 27064,
+ 27100, 27137, 27173, 27208, 27244, 27280, 27316, 27351,
+ 27386, 27422, 27457, 27492, 27527, 27562, 27596, 27631,
+ 27666, 27700, 27734, 27769, 27803, 27837, 27871, 27904,
+ 27938, 27972, 28005, 28038, 28072, 28105, 28138, 28171,
+ 28203, 28236, 28269, 28301, 28334, 28366, 28398, 28430,
+ 28462, 28494, 28525, 28557, 28589, 28620, 28651, 28682,
+ 28713, 28744, 28775, 28806, 28837, 28867, 28897, 28928,
+ 28958, 28988, 29018, 29048, 29077, 29107, 29136, 29166,
+ 29195, 29224, 29253, 29282, 29311, 29340, 29368, 29397,
+ 29425, 29453, 29482, 29510, 29537, 29565, 29593, 29621,
+ 29648, 29675, 29703, 29730, 29757, 29784, 29810, 29837,
+ 29863, 29890, 29916, 29942, 29968, 29994, 30020, 30046,
+ 30072, 30097, 30122, 30148, 30173, 30198, 30223, 30248,
+ 30272, 30297, 30321, 30346, 30370, 30394, 30418, 30442,
+ 30465, 30489, 30513, 30536, 30559, 30582, 30605, 30628,
+ 30651, 30674, 30696, 30719, 30741, 30763, 30786, 30807,
+ 30829, 30851, 30873, 30894, 30916, 30937, 30958, 30979,
+ 31000, 31021, 31041, 31062, 31082, 31103, 31123, 31143,
+ 31163, 31183, 31202, 31222, 31241, 31261, 31280, 31299,
+ 31318, 31337, 31356, 31374, 31393, 31411, 31429, 31447,
+ 31465, 31483, 31501, 31519, 31536, 31554, 31571, 31588,
+ 31605, 31622, 31639, 31656, 31672, 31689, 31705, 31721,
+ 31737, 31753, 31769, 31785, 31800, 31816, 31831, 31846,
+ 31861, 31876, 31891, 31906, 31920, 31935, 31949, 31963,
+ 31977, 31991, 32005, 32019, 32033, 32046, 32059, 32073,
+ 32086, 32099, 32112, 32124, 32137, 32149, 32162, 32174,
+ 32186, 32198, 32210, 32222, 32233, 32245, 32256, 32267,
+ 32279, 32290, 32300, 32311, 32322, 32332, 32343, 32353,
+ 32363, 32373, 32383, 32393, 32402, 32412, 32421, 32430,
+ 32440, 32449, 32457, 32466, 32475, 32483, 32492, 32500,
+ 32508, 32516, 32524, 32532, 32539, 32547, 32554, 32561,
+ 32569, 32576, 32582, 32589, 32596, 32602, 32609, 32615,
+ 32621, 32627, 32633, 32639, 32644, 32650, 32655, 32660,
+ 32665, 32670, 32675, 32680, 32685, 32689, 32694, 32698,
+ 32702, 32706, 32710, 32713, 32717, 32720, 32724, 32727,
+ 32730, 32733, 32736, 32739, 32741, 32744, 32746, 32748,
+ 32750, 32752, 32754, 32756, 32757, 32759, 32760, 32761,
+ 32762, 32763, 32764, 32765, 32765, 32766, 32766, 32766
+};
+
+const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2] = /* 2 subvectors Q11*/
+ {
+ {
+ 3129,
+ 0,
+ 0,
+ 3137,
+ 0,
+ 0,
+ },
+ {
+ 3287,
+ 0,
+ 0,
+ 3137,
+ 0,
+ 0,
+ },
+ {
+ 2611,
+ 5033,
+ 0,
+ 3137,
+ 0,
+ 0,
+ },
+ {
+ 2611,
+ 5033,
+ 0,
+ 3340,
+ 0,
+ 0,
+ },
+ {
+ 2164,
+ 3674,
+ 5931,
+ 2363,
+ 3809,
+ 6281,
+ },
+ {
+ 1898,
+ 2985,
+ 4745,
+ 2115,
+ 3667,
+ 7045,
+ },
+ {
+ 2629,
+ 5480,
+ 0,
+ 2971,
+ 0,
+ 0,
+ },
+ {
+ 2801,
+ 0,
+ 0,
+ 2869,
+ 5072,
+ 0,
+ },
+ {
+ 1763,
+ 2545,
+ 3723,
+ 2514,
+ 4558,
+ 21108,
+ },
+ {
+ 2195,
+ 3960,
+ 7440,
+ 2500,
+ 6017,
+ 21960,
+ },
+ {
+ 1841,
+ 2902,
+ 1386,
+ 2115,
+ 3762,
+ 22308,
+ },
+ {
+ 1699,
+ 2709,
+ 1288,
+ 1865,
+ 3246,
+ 20660,
+ },
+ {
+ 3221,
+ 0,
+ 0,
+ 3391,
+ 0,
+ 0,
+ },
+ {
+ 2537,
+ 4923,
+ 0,
+ 3186,
+ 0,
+ 0,
+ },
+ {
+ 2816,
+ 4229,
+ 6397,
+ 3676,
+ 0,
+ 0,
+ },
+ {
+ 2816,
+ 4229,
+ 6397,
+ 3893,
+ 0,
+ 0,
+ },
+ {
+ 2160,
+ 3481,
+ 9091,
+ 3391,
+ 0,
+ 0,
+ },
+ {
+ 2560,
+ 4923,
+ 8462,
+ 2775,
+ 4835,
+ 0,
+ },
+ {
+ 2551,
+ 3803,
+ 5619,
+ 3072,
+ 5537,
+ 0,
+ },
+ {
+ 2545,
+ 4206,
+ 7450,
+ 3229,
+ 0,
+ 0,
+ },
+ {
+ 2162,
+ 3655,
+ 9263,
+ 2699,
+ 5296,
+ 0,
+ },
+ {
+ 2039,
+ 3082,
+ 6871,
+ 2426,
+ 3637,
+ 5586,
+ },
+ {
+ 1902,
+ 2840,
+ 6875,
+ 2211,
+ 3483,
+ 5908,
+ },
+ {
+ 1888,
+ 3057,
+ 6899,
+ 2211,
+ 3483,
+ 5908,
+ },
+ {
+ 1888,
+ 3057,
+ 6899,
+ 2183,
+ 3469,
+ 6420,
+ },
+ {
+ 1888,
+ 3057,
+ 6899,
+ 1970,
+ 3174,
+ 8081,
+ },
+ {
+ 2633,
+ 1855,
+ 4960,
+ 2301,
+ 3477,
+ 5083,
+ },
+ {
+ 1527,
+ 2269,
+ 5875,
+ 1964,
+ 3033,
+ 8001,
+ },
+ {
+ 1576,
+ 2445,
+ 5781,
+ 1857,
+ 2871,
+ 4333,
+ },
+ {
+ 1531,
+ 2258,
+ 5869,
+ 2420,
+ 1660,
+ 6823,
+ },
+ {
+ 1566,
+ 2318,
+ 3776,
+ 2543,
+ 3876,
+ 1888,
+ },
+ {
+ 1568,
+ 2320,
+ 3780,
+ 2183,
+ 3360,
+ 1665,
+ },
+ {
+ 1386,
+ 1972,
+ 4356,
+ 1486,
+ 2215,
+ 4513,
+ },
+ {
+ 3356,
+ 0,
+ 0,
+ 2494,
+ 4425,
+ 0,
+ },
+ {
+ 2633,
+ 5009,
+ 0,
+ 2887,
+ 0,
+ 0,
+ },
+ {
+ 2224,
+ 3538,
+ 7696,
+ 2494,
+ 4425,
+ 0,
+ },
+ {
+ 2119,
+ 3225,
+ 9861,
+ 2494,
+ 4425,
+ 0,
+ },
+ {
+ 1974,
+ 3139,
+ 10121,
+ 2494,
+ 4425,
+ 0,
+ },
+ {
+ 1722,
+ 2453,
+ 4059,
+ 2494,
+ 4425,
+ 0,
+ },
+ {
+ 1839,
+ 2658,
+ 4472,
+ 2490,
+ 5455,
+ 0,
+ },
+ {
+ 1722,
+ 2533,
+ 4581,
+ 2037,
+ 3393,
+ 5808,
+ },
+ {
+ 1427,
+ 2009,
+ 4184,
+ 1914,
+ 3082,
+ 1349,
+ },
+ {
+ 1370,
+ 1861,
+ 2719,
+ 2017,
+ 1339,
+ 3913,
+ },
+ {
+ 2482,
+ 3885,
+ 0,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 2375,
+ 3827,
+ 6975,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 3395,
+ 0,
+ 0,
+ 3883,
+ 0,
+ 0,
+ },
+ {
+ 3563,
+ 0,
+ 0,
+ 3883,
+ 0,
+ 0,
+ },
+ {
+ 3346,
+ 0,
+ 0,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 3563,
+ 0,
+ 0,
+ 4128,
+ 0,
+ 0,
+ },
+ {
+ 2820,
+ 5218,
+ 0,
+ 3883,
+ 0,
+ 0,
+ },
+ {
+ 2637,
+ 4962,
+ 0,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 2482,
+ 3885,
+ 0,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 2217,
+ 3616,
+ 6502,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 2123,
+ 3295,
+ 8658,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 2242,
+ 3397,
+ 5562,
+ 2693,
+ 5132,
+ 0,
+ },
+ {
+ 2387,
+ 4024,
+ 7483,
+ 3452,
+ 0,
+ 0,
+ },
+ {
+ 1927,
+ 2838,
+ 4548,
+ 2693,
+ 5132,
+ 0,
+ },
+ {
+ 1859,
+ 2674,
+ 3893,
+ 2703,
+ 5371,
+ 0,
+ },
+ {
+ 2201,
+ 3618,
+ 1617,
+ 2703,
+ 5371,
+ 0,
+ },
+ {
+ 2093,
+ 3135,
+ 1554,
+ 2273,
+ 3594,
+ 5312,
+ },
+ {
+ 2201,
+ 3618,
+ 1617,
+ 2238,
+ 3895,
+ 6172,
+ },
+ {
+ 1828,
+ 3014,
+ 1382,
+ 2258,
+ 3624,
+ 5820,
+ },
+ {
+ 1863,
+ 3170,
+ 1402,
+ 2113,
+ 3381,
+ 5146,
+ },
+ {
+ 1691,
+ 2572,
+ 1294,
+ 2009,
+ 3158,
+ 4540,
+ },
+ {
+ 2424,
+ 3706,
+ 5654,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 3299,
+ 0,
+ 0,
+ 3313,
+ 0,
+ 0,
+ },
+ {
+ 2424,
+ 3706,
+ 5654,
+ 3174,
+ 0,
+ 0,
+ },
+ {
+ 2424,
+ 3706,
+ 5654,
+ 3313,
+ 0,
+ 0,
+ },
+ {
+ 2177,
+ 3557,
+ 6113,
+ 3313,
+ 0,
+ 0,
+ },
+ {
+ 2207,
+ 3737,
+ 6475,
+ 3008,
+ 4605,
+ 0,
+ },
+ {
+ 2816,
+ 1873,
+ 4263,
+ 3008,
+ 4605,
+ 0,
+ },
+ {
+ 1966,
+ 2914,
+ 1433,
+ 2682,
+ 4366,
+ 0,
+ },
+ {
+ 2301,
+ 1626,
+ 3895,
+ 2627,
+ 4714,
+ 0,
+ },
+ {
+ 2205,
+ 3536,
+ 1570,
+ 2560,
+ 3995,
+ 6105,
+ },
+ {
+ 1910,
+ 3012,
+ 1402,
+ 2560,
+ 3995,
+ 6105,
+ },
+ {
+ 1898,
+ 3276,
+ 1380,
+ 2363,
+ 3637,
+ 5844,
+ },
+ {
+ 2144,
+ 1478,
+ 3655,
+ 2162,
+ 3362,
+ 5531,
+ },
+ {
+ 1988,
+ 1409,
+ 3090,
+ 2136,
+ 3543,
+ 6002,
+ },
+ {
+ 1882,
+ 1355,
+ 2799,
+ 2164,
+ 3702,
+ 6285,
+ },
+ {
+ 3311,
+ 0,
+ 0,
+ 3393,
+ 0,
+ 0,
+ },
+ {
+ 2611,
+ 4706,
+ 0,
+ 3201,
+ 0,
+ 0,
+ },
+ {
+ 2820,
+ 5218,
+ 0,
+ 4128,
+ 0,
+ 0,
+ },
+ {
+ 2660,
+ 4134,
+ 0,
+ 4128,
+ 0,
+ 0,
+ },
+ {
+ 2678,
+ 4820,
+ 0,
+ 2840,
+ 0,
+ 0,
+ },
+ {
+ 2643,
+ 4952,
+ 0,
+ 2775,
+ 5003,
+ 0,
+ },
+ {
+ 2402,
+ 3618,
+ 5726,
+ 3252,
+ 6201,
+ 0,
+ },
+ {
+ 2209,
+ 3622,
+ 6168,
+ 2840,
+ 0,
+ 0,
+ },
+ {
+ 2209,
+ 3622,
+ 6168,
+ 2713,
+ 5232,
+ 0,
+ },
+ {
+ 1992,
+ 2850,
+ 4124,
+ 3262,
+ 6518,
+ 0,
+ },
+ {
+ 2353,
+ 3835,
+ 1736,
+ 3262,
+ 6518,
+ 0,
+ },
+ {
+ 1837,
+ 2744,
+ 5332,
+ 2191,
+ 3459,
+ 5175,
+ },
+ {
+ 2353,
+ 3835,
+ 1736,
+ 2701,
+ 4685,
+ 7550,
+ },
+ {
+ 1837,
+ 2744,
+ 5332,
+ 1923,
+ 2977,
+ 4265,
+ },
+ {
+ 1853,
+ 2717,
+ 5322,
+ 2271,
+ 1591,
+ 3491,
+ },
+ {
+ 1560,
+ 2254,
+ 4831,
+ 1923,
+ 2977,
+ 4265,
+ },
+ {
+ 1626,
+ 2510,
+ 6512,
+ 2271,
+ 1591,
+ 3491,
+ },
+ {
+ 3336,
+ 0,
+ 0,
+ 2439,
+ 4528,
+ 0,
+ },
+ {
+ 2615,
+ 5236,
+ 0,
+ 2799,
+ 0,
+ 0,
+ },
+ {
+ 2215,
+ 3606,
+ 8046,
+ 2439,
+ 4528,
+ 0,
+ },
+ {
+ 2084,
+ 3143,
+ 5750,
+ 2439,
+ 4528,
+ 0,
+ },
+ {
+ 1933,
+ 3024,
+ 5658,
+ 2439,
+ 4528,
+ 0,
+ },
+ {
+ 1863,
+ 3571,
+ 6793,
+ 2439,
+ 4528,
+ 0,
+ },
+ {
+ 1884,
+ 3375,
+ 6283,
+ 1984,
+ 3446,
+ 8095,
+ },
+ {
+ 1513,
+ 2275,
+ 5517,
+ 1800,
+ 2889,
+ 4720,
+ },
+ {
+ 1452,
+ 2113,
+ 5564,
+ 1658,
+ 2549,
+ 3735,
+ },
+ {
+ 1552,
+ 2285,
+ 4022,
+ 4139,
+ 1634,
+ 2496,
+ },
+ {
+ 1431,
+ 2117,
+ 4050,
+ 4139,
+ 1634,
+ 2496,
+ },
+ {
+ 1486,
+ 2150,
+ 3778,
+ 2775,
+ 1761,
+ 4515,
+ },
+ {
+ 1386,
+ 2041,
+ 3418,
+ 2775,
+ 1761,
+ 4515,
+ },
+ {
+ 3371,
+ 0,
+ 0,
+ 2568,
+ 5036,
+ 0,
+ },
+ {
+ 3031,
+ 6023,
+ 0,
+ 3733,
+ 0,
+ 0,
+ },
+ {
+ 2801,
+ 4704,
+ 0,
+ 3733,
+ 0,
+ 0,
+ },
+ {
+ 2801,
+ 4704,
+ 0,
+ 4065,
+ 0,
+ 0,
+ },
+ {
+ 2197,
+ 3815,
+ 6617,
+ 3436,
+ 0,
+ 0,
+ },
+ {
+ 2197,
+ 3815,
+ 6617,
+ 2568,
+ 5036,
+ 0,
+ },
+ {
+ 2162,
+ 3229,
+ 5052,
+ 3698,
+ 6123,
+ 0,
+ },
+ {
+ 2314,
+ 3723,
+ 1712,
+ 4065,
+ 0,
+ 0,
+ },
+ {
+ 1947,
+ 3055,
+ 5111,
+ 2570,
+ 6084,
+ 0,
+ },
+ {
+ 2351,
+ 3770,
+ 1665,
+ 2570,
+ 6084,
+ 0,
+ },
+ {
+ 2351,
+ 1656,
+ 3932,
+ 3133,
+ 5603,
+ 0,
+ },
+ {
+ 2469,
+ 1742,
+ 4464,
+ 3098,
+ 6504,
+ 0,
+ },
+ {
+ 1646,
+ 2457,
+ 4046,
+ 3080,
+ 6574,
+ 0,
+ },
+ {
+ 2336,
+ 1650,
+ 3921,
+ 4040,
+ 2387,
+ 7604,
+ },
+ {
+ 2289,
+ 1593,
+ 4149,
+ 2537,
+ 4380,
+ 7731,
+ },
+ {
+ 1576,
+ 2322,
+ 3921,
+ 2521,
+ 4706,
+ 7946,
+ },
+ {
+ 2099,
+ 1452,
+ 3545,
+ 2521,
+ 4706,
+ 7946,
+ },
+ {
+ 1980,
+ 1460,
+ 3385,
+ 3768,
+ 2252,
+ 5793,
+ },
+ {
+ 2025,
+ 1429,
+ 3278,
+ 2224,
+ 4022,
+ 5902,
+ },
+ {
+ 1232,
+ 1779,
+ 2904,
+ 2588,
+ 1564,
+ 4542,
+ },
+ {
+ 1746,
+ 3622,
+ 9062,
+ 2048,
+ 2048,
+ 2048,
+ },
+ {
+ 2070,
+ 3405,
+ 9017,
+ 3231,
+ 0,
+ 0,
+ },
+ {
+ 2070,
+ 3405,
+ 9017,
+ 2461,
+ 4964,
+ 0,
+ },
+ {
+ 1804,
+ 3313,
+ 8470,
+ 2461,
+ 4964,
+ 0,
+ },
+ {
+ 1734,
+ 3667,
+ 9146,
+ 2461,
+ 4964,
+ 0,
+ },
+ {
+ 1372,
+ 2277,
+ 4892,
+ 2461,
+ 4964,
+ 0,
+ },
+ {
+ 2316,
+ 3717,
+ 1630,
+ 2590,
+ 5722,
+ 0,
+ },
+ {
+ 1167,
+ 1646,
+ 2451,
+ 2379,
+ 3991,
+ 1490,
+ },
+ {
+ 2140,
+ 3248,
+ 7688,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 2252,
+ 3284,
+ 4700,
+ 2732,
+ 4962,
+ 0,
+ },
+ {
+ 2234,
+ 3588,
+ 6479,
+ 2881,
+ 0,
+ 0,
+ },
+ {
+ 2234,
+ 3588,
+ 6479,
+ 2756,
+ 5171,
+ 0,
+ },
+ {
+ 2234,
+ 3588,
+ 6479,
+ 2230,
+ 3448,
+ 5167,
+ },
+ {
+ 1925,
+ 2762,
+ 3897,
+ 2455,
+ 3665,
+ 5251,
+ },
+ {
+ 1802,
+ 2621,
+ 5783,
+ 2250,
+ 3553,
+ 0,
+ },
+ {
+ 1701,
+ 2488,
+ 5994,
+ 2230,
+ 3497,
+ 5076,
+ },
+ {
+ 1781,
+ 2717,
+ 5951,
+ 2183,
+ 3520,
+ 5480,
+ },
+ {
+ 1566,
+ 6379,
+ 3723,
+ 2299,
+ 4728,
+ 9779,
+ },
+ {
+ 1581,
+ 2297,
+ 4814,
+ 2961,
+ 1933,
+ 4243,
+ },
+ {
+ 1435,
+ 2000,
+ 3559,
+ 1939,
+ 2975,
+ 4263,
+ },
+ {
+ 1472,
+ 2091,
+ 3483,
+ 2291,
+ 1626,
+ 3473,
+ },
+ {
+ 1718,
+ 1310,
+ 3117,
+ 2289,
+ 3475,
+ 1630,
+ },
+ {
+ 1718,
+ 1310,
+ 3117,
+ 1968,
+ 3008,
+ 1447,
+ },
+ {
+ 1310,
+ 1810,
+ 3547,
+ 1546,
+ 2232,
+ 3170,
+ },
+ {
+ 2494,
+ 1630,
+ 4675,
+ 2641,
+ 6809,
+ 0,
+ },
+ {
+ 3256,
+ 1710,
+ 9084,
+ 2246,
+ 6287,
+ 0,
+ },
+ {
+ 2035,
+ 5359,
+ 0,
+ 2234,
+ 4573,
+ 7079,
+ },
+ {
+ 1816,
+ 3221,
+ 7256,
+ 2228,
+ 3741,
+ 6281,
+ },
+ {
+ 1714,
+ 2535,
+ 3897,
+ 2658,
+ 5728,
+ 0,
+ },
+ {
+ 2330,
+ 5787,
+ 0,
+ 2265,
+ 5726,
+ 8992,
+ },
+ {
+ 1927,
+ 3954,
+ 9160,
+ 1394,
+ 2592,
+ 4767,
+ },
+ {
+ 2768,
+ 8871,
+ 0,
+ 1679,
+ 3164,
+ 8550,
+ },
+ {
+ 2750,
+ 7387,
+ 0,
+ 1759,
+ 2975,
+ 5304,
+ },
+ {
+ 2473,
+ 5611,
+ 0,
+ 1554,
+ 2539,
+ 4468,
+ },
+ {
+ 2299,
+ 5603,
+ 0,
+ 1789,
+ 3067,
+ 5296,
+ },
+ {
+ 1882,
+ 5060,
+ 0,
+ 1259,
+ 2195,
+ 4292,
+ },
+ {
+ 3170,
+ 9232,
+ 0,
+ 1689,
+ 4460,
+ 8816,
+ },
+ {
+ 2492,
+ 5935,
+ 0,
+ 1509,
+ 2492,
+ 3952,
+ },
+ {
+ 1998,
+ 4485,
+ 11706,
+ 3084,
+ 1314,
+ 8624,
+ },
+ {
+ 2267,
+ 5314,
+ 0,
+ 2666,
+ 1236,
+ 1802,
+ }
+ };
+const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2] = /* 2 subvectors 20 modes Q11 */
+ {
+ {
+ 2998,
+ 4861,
+ 0,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 2629,
+ 4421,
+ 0,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 2549,
+ 5304,
+ 0,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 2338,
+ 3805,
+ 5994,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 2125,
+ 3762,
+ 6162,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 3102,
+ 0,
+ 0,
+ 3153,
+ 0,
+ 0,
+ },
+ {
+ 3244,
+ 0,
+ 0,
+ 3153,
+ 0,
+ 0,
+ },
+ {
+ 3244,
+ 0,
+ 0,
+ 3317,
+ 0,
+ 0,
+ },
+ {
+ 2629,
+ 4421,
+ 0,
+ 3317,
+ 0,
+ 0,
+ },
+ {
+ 2549,
+ 5304,
+ 0,
+ 3153,
+ 0,
+ 0,
+ },
+ {
+ 2590,
+ 5251,
+ 0,
+ 3354,
+ 0,
+ 0,
+ },
+ {
+ 2338,
+ 3805,
+ 5994,
+ 3317,
+ 0,
+ 0,
+ },
+ {
+ 2125,
+ 3762,
+ 6162,
+ 3317,
+ 0,
+ 0,
+ },
+ {
+ 2023,
+ 3401,
+ 5199,
+ 3317,
+ 0,
+ 0,
+ },
+ {
+ 2177,
+ 3487,
+ 5744,
+ 2650,
+ 4818,
+ 0,
+ },
+ {
+ 2177,
+ 3926,
+ 6273,
+ 2795,
+ 0,
+ 0,
+ },
+ {
+ 1871,
+ 2891,
+ 4552,
+ 2650,
+ 4818,
+ 0,
+ },
+ {
+ 1843,
+ 2887,
+ 4616,
+ 2658,
+ 4941,
+ 0,
+ },
+ {
+ 1806,
+ 2869,
+ 4919,
+ 2689,
+ 4999,
+ 0,
+ },
+ {
+ 2777,
+ 1775,
+ 4868,
+ 2191,
+ 3452,
+ 5214,
+ },
+ {
+ 1732,
+ 2760,
+ 5214,
+ 2203,
+ 3567,
+ 5443,
+ },
+ {
+ 1730,
+ 2824,
+ 5255,
+ 2086,
+ 3229,
+ 5003,
+ },
+ {
+ 1548,
+ 2435,
+ 5732,
+ 2220,
+ 3694,
+ 5648,
+ },
+ {
+ 1546,
+ 2494,
+ 5777,
+ 1933,
+ 2934,
+ 4040,
+ },
+ {
+ 1525,
+ 2451,
+ 5935,
+ 2543,
+ 1726,
+ 3997,
+ },
+ {
+ 1482,
+ 2529,
+ 6025,
+ 2570,
+ 1736,
+ 4096,
+ },
+ {
+ 1406,
+ 2279,
+ 4788,
+ 1746,
+ 2719,
+ 3981,
+ },
+ {
+ 1327,
+ 2107,
+ 3760,
+ 1748,
+ 2777,
+ 4016,
+ },
+ {
+ 1243,
+ 1912,
+ 3106,
+ 1603,
+ 2484,
+ 3141,
+ },
+ {
+ 1226,
+ 1853,
+ 3131,
+ 1497,
+ 2275,
+ 3072,
+ },
+ {
+ 1327,
+ 2107,
+ 3760,
+ 1406,
+ 2166,
+ 3891,
+ },
+ {
+ 3303,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 2594,
+ 5068,
+ 0,
+ 3315,
+ 0,
+ 0,
+ },
+ {
+ 2076,
+ 3338,
+ 5046,
+ 2631,
+ 4405,
+ 0,
+ },
+ {
+ 1828,
+ 2846,
+ 4739,
+ 3000,
+ 4708,
+ 0,
+ },
+ {
+ 1904,
+ 2869,
+ 4403,
+ 2621,
+ 4616,
+ 0,
+ },
+ {
+ 1828,
+ 2846,
+ 4739,
+ 2613,
+ 4517,
+ 6111,
+ },
+ {
+ 1828,
+ 2846,
+ 4739,
+ 2121,
+ 3371,
+ 5060,
+ },
+ {
+ 1755,
+ 2738,
+ 5046,
+ 2136,
+ 3543,
+ 5376,
+ },
+ {
+ 1566,
+ 2496,
+ 3180,
+ 2121,
+ 3371,
+ 5060,
+ },
+ {
+ 1615,
+ 2719,
+ 3383,
+ 2154,
+ 3653,
+ 5541,
+ },
+ {
+ 1564,
+ 2506,
+ 3184,
+ 1884,
+ 2955,
+ 4167,
+ },
+ {
+ 1357,
+ 2172,
+ 2535,
+ 2824,
+ 1839,
+ 3995,
+ },
+ {
+ 1378,
+ 2260,
+ 2674,
+ 2578,
+ 1695,
+ 4001,
+ },
+ {
+ 1363,
+ 2193,
+ 2557,
+ 1644,
+ 2541,
+ 3540,
+ },
+ {
+ 1347,
+ 2127,
+ 2486,
+ 1945,
+ 1333,
+ 2926,
+ },
+ {
+ 3276,
+ 0,
+ 0,
+ 3180,
+ 0,
+ 0,
+ },
+ {
+ 2674,
+ 4970,
+ 0,
+ 3235,
+ 0,
+ 0,
+ },
+ {
+ 2674,
+ 4970,
+ 0,
+ 3432,
+ 0,
+ 0,
+ },
+ {
+ 2560,
+ 5926,
+ 0,
+ 3235,
+ 0,
+ 0,
+ },
+ {
+ 2322,
+ 4067,
+ 6748,
+ 3180,
+ 0,
+ 0,
+ },
+ {
+ 2340,
+ 4202,
+ 6850,
+ 3432,
+ 0,
+ 0,
+ },
+ {
+ 2138,
+ 4159,
+ 7141,
+ 3432,
+ 0,
+ 0,
+ },
+ {
+ 2021,
+ 3661,
+ 5445,
+ 3373,
+ 0,
+ 0,
+ },
+ {
+ 1841,
+ 3280,
+ 5281,
+ 3373,
+ 0,
+ 0,
+ },
+ {
+ 1632,
+ 2650,
+ 4382,
+ 3373,
+ 0,
+ 0,
+ },
+ {
+ 1632,
+ 2650,
+ 4382,
+ 2734,
+ 4556,
+ 0,
+ },
+ {
+ 1517,
+ 2357,
+ 3719,
+ 2734,
+ 4556,
+ 0,
+ },
+ {
+ 2007,
+ 3485,
+ 1445,
+ 2697,
+ 5382,
+ 0,
+ },
+ {
+ 1632,
+ 2650,
+ 4382,
+ 2428,
+ 3956,
+ 0,
+ },
+ {
+ 1517,
+ 2357,
+ 3719,
+ 2383,
+ 3733,
+ 5670,
+ },
+ {
+ 1449,
+ 2306,
+ 3999,
+ 2203,
+ 3543,
+ 5687,
+ },
+ {
+ 1351,
+ 2148,
+ 3217,
+ 2203,
+ 3543,
+ 5687,
+ },
+ {
+ 1355,
+ 2101,
+ 3182,
+ 2199,
+ 3917,
+ 6189,
+ },
+ {
+ 1351,
+ 2148,
+ 3217,
+ 2947,
+ 1896,
+ 4364,
+ },
+ {
+ 1290,
+ 1978,
+ 3117,
+ 2686,
+ 1804,
+ 4519,
+ },
+ {
+ 1263,
+ 1886,
+ 2963,
+ 2113,
+ 3172,
+ 1548,
+ },
+ {
+ 3266,
+ 0,
+ 0,
+ 3076,
+ 0,
+ 0,
+ },
+ {
+ 2299,
+ 3985,
+ 7643,
+ 3076,
+ 0,
+ 0,
+ },
+ {
+ 2115,
+ 4249,
+ 8886,
+ 2906,
+ 5009,
+ 0,
+ },
+ {
+ 2017,
+ 3672,
+ 12216,
+ 2623,
+ 4759,
+ 0,
+ },
+ {
+ 1804,
+ 3289,
+ 14325,
+ 2906,
+ 5009,
+ 0,
+ },
+ {
+ 1728,
+ 3239,
+ 14376,
+ 2623,
+ 4759,
+ 0,
+ },
+ {
+ 1615,
+ 3112,
+ 14751,
+ 2623,
+ 4759,
+ 0,
+ },
+ {
+ 1779,
+ 3168,
+ 14325,
+ 2109,
+ 3592,
+ 6352,
+ },
+ {
+ 1673,
+ 3055,
+ 14581,
+ 2109,
+ 3592,
+ 6352,
+ },
+ {
+ 1546,
+ 2830,
+ 14608,
+ 2109,
+ 3592,
+ 6352,
+ },
+ {
+ 1445,
+ 2693,
+ 14796,
+ 2109,
+ 3592,
+ 6352,
+ },
+ {
+ 1411,
+ 2654,
+ 14929,
+ 2080,
+ 3840,
+ 6633,
+ },
+ {
+ 1429,
+ 2611,
+ 14764,
+ 1871,
+ 3170,
+ 4982,
+ },
+ {
+ 1390,
+ 2693,
+ 14929,
+ 2516,
+ 3778,
+ 1665,
+ },
+ {
+ 1390,
+ 2693,
+ 14929,
+ 2433,
+ 1581,
+ 4003,
+ },
+ {
+ 2070,
+ 3639,
+ 5652,
+ 3305,
+ 0,
+ 0,
+ },
+ {
+ 1974,
+ 3235,
+ 8183,
+ 3540,
+ 0,
+ 0,
+ },
+ {
+ 1798,
+ 2949,
+ 4687,
+ 3540,
+ 0,
+ 0,
+ },
+ {
+ 1744,
+ 3364,
+ 4974,
+ 3540,
+ 0,
+ 0,
+ },
+ {
+ 1746,
+ 2830,
+ 4231,
+ 2549,
+ 5486,
+ 0,
+ },
+ {
+ 2471,
+ 1593,
+ 4521,
+ 2549,
+ 5486,
+ 0,
+ },
+ {
+ 1646,
+ 2772,
+ 5421,
+ 2883,
+ 5355,
+ 0,
+ },
+ {
+ 1601,
+ 2568,
+ 5732,
+ 2822,
+ 5545,
+ 0,
+ },
+ {
+ 2471,
+ 1593,
+ 4521,
+ 2074,
+ 3751,
+ 6252,
+ },
+ {
+ 2471,
+ 1593,
+ 4521,
+ 2908,
+ 1785,
+ 4771,
+ },
+ {
+ 1398,
+ 2080,
+ 3661,
+ 2306,
+ 3862,
+ 5988,
+ },
+ {
+ 1284,
+ 1878,
+ 2965,
+ 2306,
+ 3862,
+ 5988,
+ },
+ {
+ 1347,
+ 2105,
+ 3188,
+ 3035,
+ 1996,
+ 4397,
+ },
+ {
+ 1626,
+ 1187,
+ 2725,
+ 3035,
+ 1996,
+ 4397,
+ },
+ {
+ 1685,
+ 1212,
+ 2709,
+ 2756,
+ 1832,
+ 4726,
+ },
+ {
+ 2248,
+ 1511,
+ 1136,
+ 1779,
+ 2641,
+ 3813,
+ },
+ {
+ 1552,
+ 2275,
+ 1126,
+ 1783,
+ 2799,
+ 3903,
+ },
+ {
+ 1128,
+ 1568,
+ 2285,
+ 1619,
+ 2459,
+ 3405,
+ },
+ {
+ 1128,
+ 1568,
+ 2285,
+ 1972,
+ 1427,
+ 2709,
+ },
+ {
+ 1075,
+ 1576,
+ 2197,
+ 1669,
+ 2533,
+ 1161,
+ },
+ {
+ 2191,
+ 3667,
+ 7993,
+ 3274,
+ 0,
+ 0,
+ },
+ {
+ 1679,
+ 2492,
+ 4278,
+ 2570,
+ 4689,
+ 0,
+ },
+ {
+ 1597,
+ 2394,
+ 5109,
+ 2570,
+ 4689,
+ 0,
+ },
+ {
+ 2201,
+ 1480,
+ 4835,
+ 2273,
+ 4016,
+ 7149,
+ },
+ {
+ 1415,
+ 2107,
+ 4786,
+ 2117,
+ 3667,
+ 8200,
+ },
+ {
+ 1374,
+ 2203,
+ 5337,
+ 1955,
+ 3168,
+ 5148,
+ },
+ {
+ 2424,
+ 1589,
+ 4335,
+ 2164,
+ 3420,
+ 1380,
+ },
+ {
+ 1937,
+ 2965,
+ 5576,
+ 2854,
+ 5416,
+ 9381,
+ },
+ {
+ 1941,
+ 2977,
+ 5576,
+ 4034,
+ 2404,
+ 7135,
+ },
+ {
+ 1812,
+ 2879,
+ 5658,
+ 4034,
+ 2404,
+ 7135,
+ },
+ {
+ 2549,
+ 1724,
+ 4870,
+ 4093,
+ 2392,
+ 7540,
+ },
+ {
+ 1781,
+ 2756,
+ 5763,
+ 3571,
+ 2166,
+ 5933,
+ },
+ {
+ 1693,
+ 2496,
+ 4456,
+ 3252,
+ 5324,
+ 2037,
+ },
+ {
+ 1673,
+ 2428,
+ 4079,
+ 3262,
+ 1994,
+ 5363,
+ },
+ {
+ 1683,
+ 2467,
+ 4298,
+ 2998,
+ 1851,
+ 4911,
+ },
+ {
+ 1683,
+ 2467,
+ 4298,
+ 4204,
+ 1714,
+ 2783,
+ },
+ {
+ 1067,
+ 1529,
+ 2115,
+ 1630,
+ 2729,
+ 1110,
+ },
+ {
+ 3438,
+ 0,
+ 0,
+ 2625,
+ 5060,
+ 0,
+ },
+ {
+ 2228,
+ 3786,
+ 6543,
+ 3454,
+ 0,
+ 0,
+ },
+ {
+ 2228,
+ 3786,
+ 6543,
+ 2625,
+ 5060,
+ 0,
+ },
+ {
+ 2306,
+ 3459,
+ 1617,
+ 2625,
+ 5060,
+ 0,
+ },
+ {
+ 1904,
+ 2830,
+ 1396,
+ 2625,
+ 5060,
+ 0,
+ },
+ {
+ 2283,
+ 1626,
+ 3792,
+ 2623,
+ 6211,
+ 0,
+ },
+ {
+ 1720,
+ 2818,
+ 1275,
+ 1638,
+ 2899,
+ 8724,
+ },
+ {
+ 1640,
+ 2351,
+ 3690,
+ 0,
+ 0,
+ 0,
+ },
+ {
+ 2752,
+ 5380,
+ 0,
+ 3223,
+ 0,
+ 0,
+ },
+ {
+ 2580,
+ 4188,
+ 0,
+ 3223,
+ 0,
+ 0,
+ },
+ {
+ 2580,
+ 4188,
+ 0,
+ 3430,
+ 0,
+ 0,
+ },
+ {
+ 2230,
+ 3710,
+ 6496,
+ 3434,
+ 0,
+ 0,
+ },
+ {
+ 2230,
+ 3899,
+ 6596,
+ 3115,
+ 5396,
+ 0,
+ },
+ {
+ 1972,
+ 2949,
+ 4335,
+ 3430,
+ 0,
+ 0,
+ },
+ {
+ 1972,
+ 2949,
+ 4335,
+ 2666,
+ 4935,
+ 0,
+ },
+ {
+ 1730,
+ 2482,
+ 3960,
+ 2689,
+ 4954,
+ 0,
+ },
+ {
+ 1595,
+ 2242,
+ 3481,
+ 2689,
+ 4954,
+ 0,
+ },
+ {
+ 1480,
+ 2078,
+ 3407,
+ 2689,
+ 4954,
+ 0,
+ },
+ {
+ 2066,
+ 3414,
+ 1540,
+ 2676,
+ 6187,
+ 0,
+ },
+ {
+ 2058,
+ 3373,
+ 1533,
+ 2179,
+ 3831,
+ 6856,
+ },
+ {
+ 1832,
+ 3051,
+ 1396,
+ 2179,
+ 3831,
+ 6856,
+ },
+ {
+ 1611,
+ 2605,
+ 1245,
+ 2179,
+ 3831,
+ 6856,
+ },
+ {
+ 1763,
+ 1327,
+ 2988,
+ 2179,
+ 3831,
+ 6856,
+ },
+ {
+ 1697,
+ 1292,
+ 2738,
+ 2168,
+ 4161,
+ 7020,
+ },
+ {
+ 1763,
+ 1327,
+ 2988,
+ 3155,
+ 1884,
+ 5142,
+ },
+ {
+ 1736,
+ 1296,
+ 2781,
+ 2883,
+ 1800,
+ 5552,
+ },
+ {
+ 1828,
+ 1335,
+ 2945,
+ 2203,
+ 1474,
+ 3674,
+ },
+ {
+ 2783,
+ 4722,
+ 0,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 2205,
+ 3946,
+ 7262,
+ 3418,
+ 0,
+ 0,
+ },
+ {
+ 2205,
+ 4161,
+ 7327,
+ 2926,
+ 5552,
+ 0,
+ },
+ {
+ 1705,
+ 2566,
+ 4311,
+ 2627,
+ 5234,
+ 0,
+ },
+ {
+ 1589,
+ 2359,
+ 3805,
+ 2627,
+ 5234,
+ 0,
+ },
+ {
+ 1472,
+ 2183,
+ 3547,
+ 2627,
+ 5234,
+ 0,
+ },
+ {
+ 1927,
+ 1333,
+ 3205,
+ 1478,
+ 2437,
+ 3973,
+ },
+ {
+ 2646,
+ 5076,
+ 0,
+ 3155,
+ 0,
+ 0,
+ },
+ {
+ 2461,
+ 3897,
+ 0,
+ 3155,
+ 0,
+ 0,
+ },
+ {
+ 2105,
+ 3360,
+ 5027,
+ 3375,
+ 0,
+ 0,
+ },
+ {
+ 2553,
+ 1798,
+ 4769,
+ 3375,
+ 0,
+ 0,
+ },
+ {
+ 1767,
+ 2781,
+ 5165,
+ 3375,
+ 0,
+ 0,
+ },
+ {
+ 1673,
+ 2502,
+ 4116,
+ 2199,
+ 3655,
+ 5597,
+ },
+ {
+ 1669,
+ 1253,
+ 2623,
+ 2160,
+ 3530,
+ 6045,
+ },
+ {
+ 3164,
+ 0,
+ 0,
+ 3170,
+ 0,
+ 0,
+ },
+ {
+ 3358,
+ 0,
+ 0,
+ 3170,
+ 0,
+ 0,
+ },
+ {
+ 2723,
+ 0,
+ 0,
+ 3270,
+ 0,
+ 0,
+ },
+ {
+ 2529,
+ 4743,
+ 0,
+ 3270,
+ 0,
+ 0,
+ },
+ {
+ 2635,
+ 5629,
+ 0,
+ 3170,
+ 0,
+ 0,
+ },
+ {
+ 2635,
+ 5629,
+ 0,
+ 3387,
+ 0,
+ 0,
+ },
+ {
+ 2437,
+ 4149,
+ 0,
+ 3387,
+ 0,
+ 0,
+ },
+ {
+ 1949,
+ 3428,
+ 5656,
+ 3270,
+ 0,
+ 0,
+ },
+ {
+ 1880,
+ 3217,
+ 6574,
+ 3270,
+ 0,
+ 0,
+ },
+ {
+ 2572,
+ 1622,
+ 4255,
+ 3270,
+ 0,
+ 0,
+ },
+ {
+ 1550,
+ 2463,
+ 3837,
+ 3270,
+ 0,
+ 0,
+ },
+ {
+ 1906,
+ 2985,
+ 5017,
+ 2650,
+ 5615,
+ 0,
+ },
+ {
+ 2287,
+ 1507,
+ 3840,
+ 2562,
+ 5257,
+ 0,
+ },
+ {
+ 1581,
+ 2531,
+ 3934,
+ 2562,
+ 5257,
+ 0,
+ },
+ {
+ 1796,
+ 2859,
+ 5605,
+ 2213,
+ 3719,
+ 6881,
+ },
+ {
+ 2316,
+ 3350,
+ 0,
+ 2807,
+ 0,
+ 0,
+ },
+ {
+ 1826,
+ 3260,
+ 7012,
+ 2658,
+ 6565,
+ 0,
+ },
+ {
+ 1792,
+ 3168,
+ 7084,
+ 2631,
+ 5937,
+ 8499,
+ },
+ {
+ 1732,
+ 3379,
+ 6772,
+ 2611,
+ 5009,
+ 8202,
+ },
+ {
+ 1654,
+ 6285,
+ 3514,
+ 2611,
+ 5009,
+ 8202,
+ },
+ {
+ 1566,
+ 6406,
+ 3733,
+ 2611,
+ 5009,
+ 8202,
+ },
+ {
+ 1912,
+ 2615,
+ 1490,
+ 2369,
+ 3475,
+ 0,
+ },
+ {
+ 1705,
+ 2379,
+ 1347,
+ 2357,
+ 3454,
+ 0,
+ },
+ {
+ 1538,
+ 2113,
+ 1224,
+ 2357,
+ 3454,
+ 0,
+ },
+ {
+ 1554,
+ 6426,
+ 3778,
+ 1888,
+ 3088,
+ 6369,
+ },
+ {
+ 1452,
+ 2058,
+ 1167,
+ 2170,
+ 3629,
+ 5568,
+ },
+ {
+ 1527,
+ 2050,
+ 1230,
+ 2056,
+ 3692,
+ 5922,
+ },
+ {
+ 1521,
+ 2048,
+ 1226,
+ 1916,
+ 3811,
+ 5885,
+ },
+ {
+ 1536,
+ 6492,
+ 3942,
+ 1509,
+ 2914,
+ 5502,
+ },
+ {
+ 1536,
+ 6492,
+ 3942,
+ 1349,
+ 2168,
+ 4044,
+ },
+ {
+ 1587,
+ 1257,
+ 2123,
+ 1630,
+ 2670,
+ 3901,
+ },
+ {
+ 1830,
+ 2742,
+ 5220,
+ 2678,
+ 5326,
+ 0,
+ },
+ {
+ 1703,
+ 2568,
+ 3966,
+ 2676,
+ 5353,
+ 0,
+ },
+ {
+ 1703,
+ 2523,
+ 3923,
+ 2371,
+ 4048,
+ 0,
+ },
+ {
+ 1689,
+ 2580,
+ 4081,
+ 2095,
+ 3561,
+ 5726,
+ },
+ {
+ 1536,
+ 2281,
+ 3201,
+ 2140,
+ 3690,
+ 5490,
+ },
+ {
+ 1417,
+ 2048,
+ 2930,
+ 2095,
+ 3561,
+ 5726,
+ },
+ {
+ 1474,
+ 2072,
+ 3272,
+ 3096,
+ 1896,
+ 4376,
+ },
+ {
+ 1394,
+ 1992,
+ 3377,
+ 2828,
+ 1794,
+ 4360,
+ },
+ {
+ 1400,
+ 1974,
+ 3358,
+ 2392,
+ 3637,
+ 1611,
+ },
+ {
+ 1368,
+ 1914,
+ 3176,
+ 2080,
+ 3108,
+ 1458,
+ },
+ {
+ 1349,
+ 1865,
+ 2918,
+ 2738,
+ 1820,
+ 1314,
+ },
+ {
+ 1349,
+ 1865,
+ 2918,
+ 1718,
+ 2635,
+ 1243,
+ },
+ {
+ 3344,
+ 0,
+ 0,
+ 3454,
+ 0,
+ 0,
+ },
+ {
+ 3463,
+ 0,
+ 0,
+ 3428,
+ 0,
+ 0,
+ },
+ {
+ 2719,
+ 5251,
+ 0,
+ 3180,
+ 0,
+ 0,
+ },
+ {
+ 2560,
+ 4079,
+ 0,
+ 3180,
+ 0,
+ 0,
+ },
+ {
+ 2560,
+ 4079,
+ 0,
+ 3428,
+ 0,
+ 0,
+ },
+ {
+ 2203,
+ 3665,
+ 6025,
+ 3454,
+ 0,
+ 0,
+ },
+ {
+ 2183,
+ 3446,
+ 8349,
+ 3428,
+ 0,
+ 0,
+ },
+ {
+ 2621,
+ 1865,
+ 5072,
+ 3428,
+ 0,
+ 0,
+ },
+ {
+ 1708,
+ 2516,
+ 3870,
+ 3454,
+ 0,
+ 0,
+ },
+ {
+ 1921,
+ 2875,
+ 4409,
+ 2674,
+ 5386,
+ 0,
+ },
+ {
+ 2744,
+ 1814,
+ 4751,
+ 2674,
+ 5386,
+ 0,
+ },
+ {
+ 1705,
+ 2560,
+ 3907,
+ 2674,
+ 5386,
+ 0,
+ },
+ {
+ 1705,
+ 2484,
+ 3835,
+ 2304,
+ 3766,
+ 5773,
+ },
+ {
+ 1748,
+ 2594,
+ 3743,
+ 2138,
+ 3604,
+ 5902,
+ },
+ {
+ 1566,
+ 2379,
+ 3461,
+ 2097,
+ 3559,
+ 5812,
+ },
+ {
+ 1484,
+ 2150,
+ 3667,
+ 3031,
+ 1888,
+ 6356,
+ },
+ {
+ 1458,
+ 2072,
+ 3172,
+ 3059,
+ 1849,
+ 6889,
+ },
+ {
+ 1349,
+ 1898,
+ 2779,
+ 3059,
+ 1849,
+ 6889,
+ },
+ {
+ 1683,
+ 1257,
+ 2637,
+ 1863,
+ 3090,
+ 4618,
+ },
+ {
+ 1722,
+ 1277,
+ 2617,
+ 2377,
+ 1560,
+ 3702,
+ },
+ {
+ 1716,
+ 1273,
+ 2592,
+ 2211,
+ 1456,
+ 3502,
+ },
+ {
+ 1703,
+ 1267,
+ 2611,
+ 1921,
+ 2928,
+ 1318,
+ },
+ {
+ 1810,
+ 2762,
+ 5263,
+ 2691,
+ 5343,
+ 0,
+ },
+ {
+ 2009,
+ 3016,
+ 5701,
+ 3461,
+ 6844,
+ 0,
+ },
+ {
+ 1976,
+ 3100,
+ 5500,
+ 2885,
+ 5089,
+ 8081,
+ },
+ {
+ 1998,
+ 2983,
+ 5453,
+ 4405,
+ 2603,
+ 8552,
+ },
+ {
+ 2029,
+ 3080,
+ 6320,
+ 5091,
+ 2693,
+ 9277,
+ },
+ {
+ 1937,
+ 2965,
+ 5576,
+ 2854,
+ 5416,
+ 9381,
+ },
+ {
+ 1456,
+ 2084,
+ 3307,
+ 3035,
+ 1886,
+ 7026,
+ },
+ {
+ 1390,
+ 1994,
+ 3397,
+ 1941,
+ 3172,
+ 7061,
+ },
+ {
+ 1701,
+ 1265,
+ 3033,
+ 1910,
+ 3100,
+ 4730,
+ },
+ {
+ 1671,
+ 1249,
+ 2871,
+ 2920,
+ 1796,
+ 4638,
+ },
+ {
+ 1611,
+ 2574,
+ 1220,
+ 1759,
+ 2963,
+ 4978,
+ },
+ {
+ 1611,
+ 2574,
+ 1220,
+ 2265,
+ 1505,
+ 3397,
+ }
+ };
+
+
+/*-----------------------------------------------------------------*
+ * FFT transform tables
+ *-----------------------------------------------------------------*/
const Word16 w_fft4_fx[2] = {
// Q15
@@ -6130,6 +37260,7 @@ const Word16 cos_twiddle_table_25_5_5[25] = {
SHC( 0x8103 ),
SHC( 0xae69 ),
};
+
const Word16 sin_twiddle_table_25_5_5[25] = {
// Q15
SHC( 0x0000 ),
@@ -6666,7 +37797,9 @@ const Word16 lsf_q_cb_3b_fx[8] = {
1739, 2011, 2365, 2953
};
-const Word16 *const lsf_q_cb_fx[NUM_Q_LSF] = { lsf_q_cb_4b_fx, lsf_q_cb_4b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx }; // Q15
+const Word16 *const lsf_q_cb_fx[NUM_Q_LSF] = {
+ lsf_q_cb_4b_fx, lsf_q_cb_4b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx
+}; // Q15
/*Q15*/
const Word16 lsf_grid_fx[4][5] = {
@@ -6701,4 +37834,6 @@ const Word16 lsf_grid_fx[4][5] = {
};
/*Q15*/
-const Word16 grid_smoothing_fx[5] = { 6554, 11469, 16384, 24576, 26214 };
+const Word16 grid_smoothing_fx[5] = {
+ 6554, 11469, 16384, 24576, 26214
+};
diff --git a/lib_com/rom_com_fx.h b/lib_com/rom_com_fx.h
deleted file mode 100644
index 3f35abb9f4b07fc42bf68150b49f2e0f14abe09d..0000000000000000000000000000000000000000
--- a/lib_com/rom_com_fx.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-/*====================================================================================
- 3GPP TS26.258 Aug 24, 2023. IVAS Codec Version IVAS-FL-1.0
- ====================================================================================*/
-
-/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
- ====================================================================================*/
-
-#ifndef ROM_COM_FX_H
-#define ROM_COM_FX_H
-
-#include "typedef.h"
-
-/*------------------------------------------------------------------------------*
- * FFT transform
- *------------------------------------------------------------------------------*/
-
-extern const Word16 w_fft64_fx[32]; // Q15
-extern const Word16 w_fft32_fx[16]; // Q15
-extern const Word16 w_fft16_fx[8]; // Q15
-extern const Word16 w_fft8_fx[8]; // Q15
-extern const Word16 w_fft128_fx[64]; // Q15
-extern const Word16 w_fft256_fx[128]; // Q15
-extern const Word16 w_fft512_fx[256]; // Q15
-extern const Word16 w_fft4_fx[2]; // Q15
-
-extern const Word16 FFT_RotVector_960_fx[1860]; // Q15
-extern const Word16 FFT_RotVector_640_fx[1240]; // Q15
-extern const Word16 FFT_RotVector_600_fx[1140]; // Q15
-extern const Word16 FFT_RotVector_400_fx[760]; // Q15
-extern const Word16 FFT_RotVector_256_fx[448]; // Q15
-extern const Word16 FFT_RotVector_32_fx[40]; // Q15
-
-extern const Word16 sincos_t_rad3_fx[T_SIN_PI_2 + 1]; // Q15
-
-extern const Word16 cos_twiddle_table_25_5_5[25]; // Q15
-extern const Word16 sin_twiddle_table_25_5_5[25]; // Q15
-extern const Word16 cos_twiddle_table_16_8_2[16]; // Q15
-extern const Word16 sin_twiddle_table_16_8_2[16]; // Q15
-
-
-extern const Word32 CLDFB80_10_fx[100]; // Q30
-extern const Word32 CLDFB80_16_fx[160]; // Q30
-extern const Word32 CLDFB80_20_fx[200]; // Q30
-extern const Word32 CLDFB80_30_fx[300]; // Q30
-extern const Word32 CLDFB80_32_fx[320]; // Q30
-extern const Word32 CLDFB80_40_fx[400]; // Q30
-extern const Word32 CLDFB80_60_fx[600]; // Q30
-
-/*5ms delay*/
-extern const Word32 LDQMF_10_fx[100]; // Q30
-extern const Word32 LDQMF_16_fx[160]; // Q30
-extern const Word32 LDQMF_20_fx[200]; // Q30
-extern const Word32 LDQMF_30_fx[300]; // Q30
-extern const Word32 LDQMF_32_fx[320]; // Q30
-extern const Word32 LDQMF_40_fx[400]; // Q30
-extern const Word32 LDQMF_60_fx[600]; // Q30
-/* Not used anywhere
-extern const Word16 LDQMF_10_enc_fx[100];
-extern const Word16 LDQMF_16_enc_fx[160];
-extern const Word16 LDQMF_20_enc_fx[200];
-extern const Word16 LDQMF_30_enc_fx[300];
-extern const Word16 LDQMF_32_enc_fx[320];
-extern const Word16 LDQMF_40_enc_fx[400];
-extern const Word16 LDQMF_60_enc_fx[600];
-*/
-extern const Word32 rot_vec_delay_re_LDQMF_fx[60]; // Q31
-extern const Word32 rot_vec_delay_im_LDQMF_fx[60]; // Q31
-
-extern const Word32 rot_vec_ana_re_L10_fx[5]; // Q29
-extern const Word32 rot_vec_ana_im_L10_fx[5]; // Q29
-extern const Word32 rot_vec_ana_re_L16_fx[8]; // Q29
-extern const Word32 rot_vec_ana_im_L16_fx[8]; // Q29
-extern const Word32 rot_vec_ana_re_L20_fx[10]; // Q29
-extern const Word32 rot_vec_ana_im_L20_fx[10]; // Q29
-extern const Word32 rot_vec_ana_re_L30_fx[15]; // Q29
-extern const Word32 rot_vec_ana_im_L30_fx[15]; // Q29
-extern const Word32 rot_vec_ana_re_L32_fx[16]; // Q29
-extern const Word32 rot_vec_ana_im_L32_fx[16]; // Q29
-extern const Word32 rot_vec_ana_re_L40_fx[20]; // Q29
-extern const Word32 rot_vec_ana_im_L40_fx[20]; // Q29
-extern const Word32 rot_vec_ana_re_L60_fx[30]; // Q29
-extern const Word32 rot_vec_ana_im_L60_fx[30]; // Q29
-
-extern const Word16 LP_assym_window_fx[]; /* Assymetric window for LP analysis @12.8kHz (Q15) */
-extern const Word16 LP_assym_window_16k_fx[]; /* Assymetric window for LP analysis @16kHz (Q15) */
-
-#endif
diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h
index ffac9308cbc82fb44e6d86c80d5bd117b4a91615..c50e99711624758634d8b9079aa60536f85a3db6 100644
--- a/lib_com/stat_com.h
+++ b/lib_com/stat_com.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c
index 8d1236b534091f8569a9a047f2a207a7573456d0..9b0bae1e5803d75d8a5baea5b8cbadbbfe320276 100644
--- a/lib_com/stat_noise_uv_mod_fx.c
+++ b/lib_com/stat_noise_uv_mod_fx.c
@@ -74,9 +74,11 @@ void stat_noise_uv_mod_fx(
Word16 En_shift, Tmp;
Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*---------------------------------------------------------*
@@ -109,7 +111,11 @@ void stat_noise_uv_mod_fx(
move16();
tmp_res = div_l( L_tmp_res, tmp_den );
move16();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ min_alpha = add_sat( tmp_res, 16384 );
+#else
min_alpha = add_o( tmp_res, 16384, &Overflow );
+#endif
move16();
/**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/
@@ -161,7 +167,7 @@ void stat_noise_uv_mod_fx(
FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR )
{
exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */
#else
exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */
@@ -190,7 +196,7 @@ void stat_noise_uv_mod_fx(
tmp_shift = norm_s( tmp_den );
tmp_den = shl( tmp_den, tmp_shift );
tmp_res = div_s( tmp_nom, tmp_den );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp_res = shl_sat( tmp_res, tmp_shift );
#else
tmp_res = shl_o( tmp_res, tmp_shift, &Overflow );
@@ -258,7 +264,11 @@ void stat_noise_uv_mod_fx(
L_tmp_res = Mult_32_16( *ge_sm, tmp_res ); /* Q_stat_noise_ge+45-Q_local-Q_ge-tmp_shift-15 */
L_tmp_res = Mult_32_16( L_tmp_res, sub( 32767, beta ) ); /*30-Q_local-tmp_shift+15-15 */
L_tmp_res = L_add_sat( L_shl_sat( L_tmp_res, sub( add( Q_local, tmp_shift ), 15 ) ), beta ); /* Q15 */
- tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp_res = extract_h( L_shl_sat( L_tmp_res, 15 ) ); /* 15+15-16=14 */
+#else
+ tmp_res = extract_h( L_shl_o( L_tmp_res, 15, &Overflow ) ); /* 15+15-16=14 */
+#endif
Noimix_fract = extract_l( Mult_32_16( L_tmp_res, Noimix_fract ) ); /*15+15-15 */
@@ -392,9 +402,11 @@ void stat_noise_uv_mod_ivas_fx(
Word16 En_shift, Tmp;
Word16 Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/
Word32 L_Exc2_local[L_FRAME]; /* local_copy in scaled Q_local*/
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*---------------------------------------------------------*
@@ -424,7 +436,11 @@ void stat_noise_uv_mod_ivas_fx(
L_tmp_res = L_shl( L_tmp_res, sub( tmp_shift, 1 ) );
tmp_den = shl( tmp_den, tmp_shift );
tmp_res = div_l( L_tmp_res, tmp_den );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ min_alpha = add_sat( tmp_res, 16384 );
+#else
min_alpha = add_o( tmp_res, 16384, &Overflow );
+#endif
/**st_min_alpha = sub(*st_min_alpha, 1638); move16();*/
min_alpha = s_max( min_alpha, sub( *st_min_alpha, 1638 ) );
@@ -475,7 +491,7 @@ void stat_noise_uv_mod_ivas_fx(
FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR )
{
exctilt = calc_tilt_fx( &Exc2_local[i_subfr], En_shift, L_SUBFR ); /*Q15 */
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
exctilt = mult( shl_sat( sub( TILT_COMP_LIM_FX, min_alpha ), 2 ), exctilt ); /*Q15 */
#else
exctilt = mult( shl_o( sub( TILT_COMP_LIM_FX, min_alpha ), 2, &Overflow ), exctilt ); /*Q15 */
@@ -504,7 +520,7 @@ void stat_noise_uv_mod_ivas_fx(
tmp_shift = norm_s( tmp_den );
tmp_den = shl( tmp_den, tmp_shift );
tmp_res = div_s( tmp_nom, tmp_den );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp_res = shl_sat( tmp_res, tmp_shift );
#else
tmp_res = shl_o( tmp_res, tmp_shift, &Overflow );
diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c
index 138fbd705dd25eca9a3b8d79254ad4a5e6fea359..0e618f7d9f2072231f0b1662e98753fa16869739 100644
--- a/lib_com/swb_bwe_com_fx.c
+++ b/lib_com/swb_bwe_com_fx.c
@@ -595,12 +595,8 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24
tmp1 = mult_ro( *ptr++, 8192 /*0.25 in Q15 */, &Overflow ); /* Divide by 4 */
L_ener = L_mac0_o( L_ener, tmp1, tmp1, &Overflow );
}
-#ifdef ISSUE_1799_replace_L_shr_o
/*Overflow will never happen because exp2 is always positive*/
L_ener = L_shr( L_ener, exp2 );
-#else
- L_ener = L_shr_o( L_ener, exp2, &Overflow );
-#endif
L_temp = L_add_o( L_ener_tot, L_ener, &Overflow );
IF( Overflow != 0 )
{
diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c
index 78422a2927e8ce284dd110ac32c7a51b0d98b656..0e6524ce8f3299dd2cb69a4f2bc1b9683986e1e0 100644
--- a/lib_com/swb_bwe_com_lr_fx.c
+++ b/lib_com/swb_bwe_com_lr_fx.c
@@ -2338,11 +2338,7 @@ void ton_ene_est_fx(
move16();
/* 0.06=15729(Q18) */
exp_shift = sub( 18, QE_r );
-#ifdef ISSUE_1796_replace_shl_o
E_r_shift_fx = shl_sat( E_r_fx, exp_shift );
-#else
- E_r_shift_fx = shl_o( E_r_fx, exp_shift, &Overflow );
-#endif
IF( LT_16( E_r_shift_fx, 15729 ) ) /* E_r < 0.06 */
{
/* avg_pe[k] = (float) sqrt(pow(2.0f,band_energy[i])/band_width[i]); */
@@ -3213,12 +3209,6 @@ void noiseinj_hf_fx(
Word16 exp_normn, exp_normd;
Word16 div_fx;
Word16 Qdiv;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
set16_fx( map_pulse_t_fx, 0, band_end_fx[BANDS_fx - 1] + 1 );
set16_fx( map_pulse_fx, 0, band_end_fx[BANDS_fx - 1] + 1 );
@@ -3252,11 +3242,7 @@ void noiseinj_hf_fx(
move32();
/**p_L_En = (float)sqrt(*p_En);*/
sqrt_32n_16_fx( *p_L_En, QbeL, p_sqrt_En_fx, &Qtemp );
-#ifdef ISSUE_1796_replace_shl_o
*p_sqrt_En_fx = shl_sat( *p_sqrt_En_fx, sub( QsEn, Qtemp ) ); /* -> Q2 */
-#else
- *p_sqrt_En_fx = shl_o( *p_sqrt_En_fx, sub( QsEn, Qtemp ), &Overflow ); /* -> Q2 */
-#endif
move16();
}
p_L_En++;
@@ -3326,11 +3312,7 @@ FOR( k = BANDS_fx - NB_SWB_SUBBANDS; k < BANDS_fx; k++ )
/* SQRT Part */
sqrt_32n_16_fx( L_deposit_h( div_fx ), add( Qdiv, 16 ), &ni_scale_fx, &Qtemp );
-#ifdef ISSUE_1796_replace_shl_o
ni_scale_fx = shl_sat( ni_scale_fx, sub( 14, Qtemp ) );
-#else
- ni_scale_fx = shl_o( ni_scale_fx, sub( 14, Qtemp ), &Overflow );
-#endif
ni_scale_fx = s_min( 20408, ni_scale_fx ); /* 1.25=20408.0(Q14) */
ni_scale_fx = s_max( 12288, ni_scale_fx ); /* 0.75=12288.0(Q14) */
diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c
index beaef461407840ade891b3580064e51b4709f5db..7aef5baa3a541cfc792300a8274bac56070279ad 100644
--- a/lib_com/swb_tbe_com_fx.c
+++ b/lib_com/swb_tbe_com_fx.c
@@ -2,7 +2,6 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
#include
#include "options.h"
#include "cnst.h" /* Common constants */
@@ -10,7 +9,11 @@
#include "prot_fx.h"
#include "basop_util.h"
#include "ivas_prot_fx.h"
-#include "options_warnings.h"
+
+
+/*-----------------------------------------------------------------*
+ * Local constants
+ *-----------------------------------------------------------------*/
#define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */
#define POW_EXC16k_WHTND_FX_INV_SQRT 6360 // Q31
@@ -996,11 +999,10 @@ static void filt_mu_fx(
Word16 mu, ga, temp;
const Word16 *ptrs;
Word16 tmp, exp;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
Flag Overflow = 0;
-#endif
move32();
-
+#endif
IF( EQ_16( SubFrameLength, L_SUBFR ) )
{
@@ -1040,7 +1042,7 @@ static void filt_mu_fx(
{
temp = mult_r( mu, ( *ptrs++ ) );
temp = add_sat( temp, *ptrs ); /*Q12 */
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
sig_out[n] = shl_sat( mult_r( ga, temp ), 1 );
#else
sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow );
@@ -1451,9 +1453,11 @@ void GenShapedWBExcitation_ivas_fx(
Word32 LepsP[LPC_WHTN_ORDER_WB + 1];
Word16 tmp_vfac;
Word16 avg_voice_fac;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
/*0.25f*sum_f(voice_factors, NB_SUBFR)*/
@@ -1543,8 +1547,8 @@ void GenShapedWBExcitation_ivas_fx(
n1 = norm_s( max_val );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
- excTmp2_frac[i] = shl_sat( excTmp2[i], n1 ); // Q_bwe_exc + n1
+#ifdef ISSUE_1836_replace_overflow_libcom
+ excTmp2_frac[i] = shl( excTmp2[i], n1 ); // Q_bwe_exc + n1 // saturation not possible
#else
excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow ); // Q_bwe_exc + n1
#endif
@@ -1553,16 +1557,28 @@ void GenShapedWBExcitation_ivas_fx(
n1 = sub( sub( 14, n1 ), Q_bwe_exc );
pow1 = 1;
move32();
+#ifdef ISSUE_1836_replace_overflow_libcom
+ FOR( i = 0; i < L_FRAME16k / 4; i++ )
+ {
+ L_tmp = L_mult( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */ // saturation not possible: excTmp2_frac[i] < MIN_16
+ pow1 = L_add_sat( pow1, L_shr( L_tmp, 10 ) ); /* Q22 */
+ }
+#else
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */
pow1 = L_add_o( pow1, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */
}
+#endif
}
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) ); // L_mult: sat not poosible, excTmp2 > 0
+#else
excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow );
+#endif
move32(); /* Q_bwe_exc+16 */
*mem_csfilt = Mult_32_16( excNoisyEnv[i], neg_csfilt_den2[1] );
move32(); /* Q_bwe_exc+16 */
@@ -1592,7 +1608,11 @@ void GenShapedWBExcitation_ivas_fx(
n2 = norm_l( Lmax );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
- exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */
+#else
+ exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */
+#endif
move16();
}
n2 = 30 - n2 - ( Q_bwe_exc + 6 );
@@ -1600,8 +1620,13 @@ void GenShapedWBExcitation_ivas_fx(
move32();
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
- L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */
- pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */
+ pow22 = L_add( pow22, L_shr( L_tmp, 10 ) ); /* Q22 */
+#else
+ L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */
+ pow22 = L_add_o( pow22, L_shr( L_tmp, 10 ), &Overflow ); /* Q22 */
+#endif
}
}
@@ -1610,11 +1635,19 @@ void GenShapedWBExcitation_ivas_fx(
IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /* 0.2 in Q15 */ ) ) )
{
L_tmp = root_a_over_b_fx( pow1, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp );
- scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */
+#else
+ scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */
+#endif
sc = sub( add( n2, Q_bwe_exc ), 14 );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult_sat( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */
+#else
exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */
+#endif
move16();
}
}
@@ -1630,7 +1663,7 @@ void GenShapedWBExcitation_ivas_fx(
{
/*tmp_vfac = 2*voice_factors[i];
tmp_vfac = min(1, tmp_vfac);*/
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp_vfac = shl_sat( voice_factors[i], 1 );
#else
tmp_vfac = shl_o( voice_factors[i], 1, &Overflow );
@@ -1643,6 +1676,20 @@ void GenShapedWBExcitation_ivas_fx(
}
Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */
+ L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/
+ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp );
+ temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */
+ FOR( j = 0; j < L_FRAME16k / 16; j++ )
+ {
+ L_tmp = L_mult_sat( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */
+ L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult_sat( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */
+ exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */
+ move16();
+ k++;
+ }
+#else
temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */
L_tmp = Mult_32_16( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/
Ltemp2 = root_a_over_b_fx( L_tmp, sub( 19, shl( n1, 1 ) ), pow22, sub( 19, shl( n2, 1 ) ), &exp );
@@ -1655,6 +1702,7 @@ void GenShapedWBExcitation_ivas_fx(
move16();
k++;
}
+#endif
}
}
}
@@ -1709,9 +1757,11 @@ void GenShapedWBExcitation_fx(
Word32 LepsP[LPC_WHTN_ORDER_WB + 1];
Word16 tmp_vfac;
Word16 avg_voice_fac;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
move16();
move16();
@@ -1803,8 +1853,8 @@ void GenShapedWBExcitation_fx(
n1 = norm_s( max_val );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
- excTmp2_frac[i] = shl_sat( excTmp2[i], n1 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ excTmp2_frac[i] = shl( excTmp2[i], n1 );
#else
excTmp2_frac[i] = shl_o( excTmp2[i], n1, &Overflow );
#endif
@@ -1815,14 +1865,23 @@ void GenShapedWBExcitation_fx(
move32();
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult_sat( excTmp2_frac[i], excTmp2_frac[i] ); /* Q29 */
+ pow1 = L_add_sat( pow1, L_shr( L_tmp, 7 ) ); /* Q22 */
+#else
L_tmp = L_mult_o( excTmp2_frac[i], excTmp2_frac[i], &Overflow ); /* Q29 */
pow1 = L_add_o( pow1, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */
+#endif
}
}
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ excNoisyEnv[i] = L_add_sat( *mem_csfilt, L_mult( csfilt_num2[0], excTmp2[i] ) );
+#else
excNoisyEnv[i] = L_add_o( *mem_csfilt, L_mult_o( csfilt_num2[0], excTmp2[i], &Overflow ), &Overflow );
+#endif
move32(); /* Q_bwe_exc+16 */
*mem_csfilt = Mpy_32_16_1( excNoisyEnv[i], neg_csfilt_den2[1] );
move32(); /* Q_bwe_exc+16 */
@@ -1853,7 +1912,11 @@ void GenShapedWBExcitation_fx(
n2 = norm_l( Lmax );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ exc4k_frac[i] = extract_h( L_shl( exc4k_32[i], n2 ) ); /* Q(14-n2) */
+#else
exc4k_frac[i] = extract_h( L_shl_o( exc4k_32[i], n2, &Overflow ) ); /* Q(14-n2) */
+#endif
move16();
}
n2 = sub( sub( 30, n2 ), add( Q_bwe_exc, 6 ) );
@@ -1861,8 +1924,13 @@ void GenShapedWBExcitation_fx(
move32();
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
- L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */
- pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult_sat( exc4k_frac[i], exc4k_frac[i] ); /* Q29 */
+ pow22 = L_add( pow22, L_shr( L_tmp, 7 ) ); /* Q22 */
+#else
+ L_tmp = L_mult_o( exc4k_frac[i], exc4k_frac[i], &Overflow ); /* Q29 */
+ pow22 = L_add_o( pow22, L_shr( L_tmp, 7 ), &Overflow ); /* Q22 */
+#endif
}
}
@@ -1871,13 +1939,23 @@ void GenShapedWBExcitation_fx(
IF( EQ_16( coder_type, UNVOICED ) || ( igf_flag != 0 && LT_16( avg_voice_fac, 6654 /*0.2 in Q15 */ ) ) )
{
L_tmp = root_a_over_b_fx( pow1, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp );
- scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */
+ sc = sub( add( n2, Q_bwe_exc ), 14 );
+ FOR( i = 0; i < L_FRAME16k / 4; i++ )
+ {
+ exc4kWhtnd[i] = round_fx_sat( L_shl_sat( L_mult_sat( exc4k_frac[i], scale ), sc ) ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */
+ move16();
+ }
+#else
+ scale = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow ); /*Q15 */
sc = sub( add( n2, Q_bwe_exc ), 14 );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
exc4kWhtnd[i] = round_fx_o( L_shl_o( L_mult_o( exc4k_frac[i], scale, &Overflow ), sc, &Overflow ), &Overflow ); /* Q_bwe_exc+n2-10+16+ Q_bwe_exc + n2 -14 -16 = //Q_bwe_exc */
move16();
}
+#endif
}
ELSE
{
@@ -1892,7 +1970,7 @@ void GenShapedWBExcitation_fx(
{
/*tmp_vfac = 2*voice_factors[i];
tmp_vfac = min(1, tmp_vfac);*/
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp_vfac = shl_sat( voice_factors[i], 1 );
#else
tmp_vfac = shl_o( voice_factors[i], 1, &Overflow );
@@ -1905,6 +1983,20 @@ void GenShapedWBExcitation_fx(
}
Ltemp1 = root_a_fx( L_deposit_h( tmp_vfac ), 31, &exp );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ temp1 = round_fx_sat( L_shl_sat( Ltemp1, exp ) ); /* Q15 */
+ L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/
+ Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp );
+ temp2 = round_fx_sat( L_shl_sat( Ltemp2, exp ) ); /* Q15 */
+ FOR( j = 0; j < L_FRAME16k / 16; j++ )
+ {
+ L_tmp = L_mult_sat( temp1, exc4kWhtnd[k] ); /* Q(16+Q_bwe_exc) */
+ L_tmp = L_add_sat( L_tmp, L_shl_sat( L_mult_sat( temp2, exc4k_frac[k] ), sc ) ); /* Q(16+Q_bwe_exc) */
+ exc4kWhtnd[k] = round_fx_sat( L_tmp ); /* Q_bwe_exc */
+ move16();
+ k = add( k, 1 );
+ }
+#else
temp1 = round_fx_o( L_shl_o( Ltemp1, exp, &Overflow ), &Overflow ); /* Q15 */
L_tmp = Mpy_32_16_1( pow1, sub( 32767, tmp_vfac ) ); /* Q22*/
Ltemp2 = root_a_over_b_fx( L_tmp, sub( 22, shl( n1, 1 ) ), pow22, sub( 22, shl( n2, 1 ) ), &exp );
@@ -1917,6 +2009,7 @@ void GenShapedWBExcitation_fx(
move16();
k = add( k, 1 );
}
+#endif
}
}
}
@@ -5691,10 +5784,12 @@ void non_linearity_fx(
Word16 nframes;
Word32 prev_scale;
Word16 length_half;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
IF( EQ_16( L_frame, L_FRAME16k ) )
@@ -5793,15 +5888,19 @@ void non_linearity_fx(
tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */
/* (log2(scale / prev_scale))/length */
- L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */
+#else
+ L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */
+#endif
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
scale_step = shl_sat( tmp, exp ); /* Q14 */
#else
- scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */
+ scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */
#endif
}
}
@@ -5825,8 +5924,12 @@ void non_linearity_fx(
IF( GT_16( max_val, shl( 1, Q_inp ) ) )
{
exp = norm_s( max_val );
- tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */
+ tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ scale = L_shl_sat( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */
+#else
scale = L_shl_o( L_mult( 21955 /* 0.67 in Q15 */, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */
+#endif
}
ELSE
{
@@ -5875,15 +5978,19 @@ void non_linearity_fx(
tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */
/* (log2(scale / prev_scale))/length */
- L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */
+#else
+ L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */
+#endif
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
scale_step = shl_sat( tmp, exp ); /*Q14 */
#else
- scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */
+ scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */
#endif
}
}
@@ -5951,11 +6058,15 @@ void non_linearity_ivas_fx(
Word16 nframes;
Word32 prev_scale;
Word16 length_half;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
-
+#endif
+#ifdef NONBE_1328_FIX_NON_LINEARITY
+ Word16 sc_factor;
+#endif
IF( EQ_16( L_frame, L_FRAME16k ) )
{
@@ -6016,8 +6127,26 @@ void non_linearity_ivas_fx(
move32(); /* Q31; 0.67 in Q31 */
}
+#ifdef NONBE_1328_FIX_NON_LINEARITY
+#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
+ sc_factor = s_max( sub( 13, norm_s( add( j, 1 ) ) ), 0 ); /* Adapt the scaling factor allowed depending of max position */
+ sc_factor = s_max( sc_factor, 1 ); /* Note: The sc_factor is the log2 of the sc_factor in the float code to simplify condition below */
+#else
+ /* sc_factor = 32; */ /* Here we divide prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */
+ /* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */
+ sc_factor = shl_sat( 1, sub( 16, max( 13 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */
+ sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 ); /* note: The thresholding is purposely different between float and BASOP implementations. */
+#endif
+ test();
+#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
+ IF( prev_scale <= 0 || GT_32( L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ), scale /*Q31*/ ) ) /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */
+#else
+ IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
+#endif
+#else
test();
IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
+#endif
{
scale_step = 16384;
move16(); /* Q14 */
@@ -6053,15 +6182,19 @@ void non_linearity_ivas_fx(
tmp = div_s( shl( 1, sub( 14, exp ) ), j ); /* Q(29-exp) */
/* (log2(scale / prev_scale))/length */
- L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /* Q(16+29-exp+1-16+exp-14)->Q16 */
+#else
+ L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /* Q(16+29-exp+1-16+exp-14)->Q16 */
+#endif
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
scale_step = shl_sat( tmp, exp ); /* Q14 */
#else
- scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */
+ scale_step = shl_o( tmp, exp, &Overflow ); /* Q14 */
#endif
}
}
@@ -6085,8 +6218,12 @@ void non_linearity_ivas_fx(
IF( GT_16( max_val, shl_sat( 1, Q_inp ) ) )
{
exp = norm_s( max_val );
- tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */
+ tmp = div_s( shl( 1, sub( 14, exp ) ), max_val ); /* Q(29-exp-Q_inp) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ scale = L_shl_sat( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ) ); /* Q31 */
+#else
scale = L_shl_o( L_mult( 21955, tmp ), add( exp, sub( Q_inp, 14 ) ), &Overflow ); /* Q31 */
+#endif
}
ELSE
{
@@ -6094,8 +6231,27 @@ void non_linearity_ivas_fx(
move32(); /* Q31; 0.67 in Q31 */
}
+#ifdef NONBE_1328_FIX_NON_LINEARITY
+#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
+ /* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */
+ sc_factor = s_max( sub( 12, norm_s( add( sub( j, length_half ), 1 ) ) ), 0 ); /* allowed intra frame jump is smaller */
+ sc_factor = s_max( sc_factor, 1 ); /* Note: The sc_factor is the log2 of the sc_factor in the float code to simplify condition below */
+#else
+ /* sc_factor = 32; */ /* Here we divide prev_scale, so 32 == 2 << (15-10) 1024.0 corresponds to 10 bits and 32 to 5 bits */
+ /* if ( element_mode > EVS_MONO ) */ /* element mode is not needed because the function is duplicated for IVAS */
+ sc_factor = shl_sat( 1, sub( 16, max( 12 - norm_s( add( j, 1 ) ), 0 ) ) ); /* Adapt the scaling factor allowed depending of max position */
+ sc_factor = s_max( s_min( sc_factor, 16384 ), 2 * 32 ); /* note: The thresholding is purposely different between float and BASOP implementations. */
+#endif
+
test();
+#ifdef FIX_2000_NON_LINEARITY_OVERSHOOT
+ IF( prev_scale <= 0 || GT_32( L_shr( prev_scale, sub( sc_factor, 1 ) /*Q30 -> Q31*/ ), scale /*Q31*/ ) ) /* Since the sc_factor is the log2 of sc_factor in float, we apply it using L_shr */
+#else
+ IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, sc_factor ) /*Q30 -> Q31*/, scale /*Q31*/ ) )
+#endif
+#else
IF( prev_scale <= 0 || GT_32( Mult_32_16( prev_scale, 64 ), scale ) )
+#endif
{
scale_step = 16384;
move16(); /*Q14 */
@@ -6135,15 +6291,19 @@ void non_linearity_ivas_fx(
tmp = div_s( shl( 1, sub( 14, exp ) ), tmp ); /* Q(29-exp) */
/* (log2(scale / prev_scale))/length */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ) ); /*Q(16+29-exp+1-16+exp-14)->Q16 */
+#else
L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( exp, 14 ), &Overflow ); /*Q(16+29-exp+1-16+exp-14)->Q16 */
+#endif
frac = L_Extract_lc( L_tmp, &exp ); /* Extract exponent of L_tmp */
tmp = extract_l( Pow2( 14, frac ) );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
scale_step = shl_sat( tmp, exp ); /*Q14 */
#else
- scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */
+ scale_step = shl_o( tmp, exp, &Overflow ); /*Q14 */
#endif
}
}
@@ -6785,7 +6945,7 @@ void synthesise_fb_high_band_fx(
Word64 W_temp;
t_Q = sub( shl( exp_tmp, 1 ), 8 );
- P_ONE = W_shl( P_ONE, sub( t_Q, 15 ) );
+ P_ONE = W_shl( P_ONE, s_min( 63, sub( t_Q, 15 ) ) );
W_temp = W_add( P_ONE, temp1 );
@@ -6879,9 +7039,11 @@ void Estimate_mix_factors_fx(
Word16 exp1, exp2, expa, expb, fraca, fracb, scale, num_flag, den_flag;
Word16 tmp, tmp1, sc1, sc2;
Word32 L_tmp1, L_tmp2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Copy( shb_res, shb_res_local, L_FRAME16k );
@@ -6940,7 +7102,11 @@ void Estimate_mix_factors_fx(
expa = sub( 30, expa );
expb = norm_l( temp_p1_p2 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ fracb = round_fx_sat( L_shl( temp_p1_p2, expb ) );
+#else
fracb = round_fx_o( L_shl_o( temp_p1_p2, expb, &Overflow ), &Overflow );
+#endif
expb = sub( 30, expb );
num_flag = 0;
@@ -7040,15 +7206,18 @@ void prep_tbe_exc_fx(
Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/
const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */
const Word16 code_preQ_fx[], /* i : prequantizer excitation */
- const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
- const Word16 T0, /* i : integer pitch variables Q0 */
- const Word16 T0_frac, /* i : Fractional pitch variables Q0*/
- const Word16 coder_type, /* i : coding type */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 element_mode, /* i : element mode */
- const Word16 idchan, /* i : channel ID */
- const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
- const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
+#ifdef FIX_2010_PREP_TBE_EXC
+ const Word16 Q_code_preQ, /* i : Q, prequantizer excitation */
+#endif
+ const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
+ const Word16 T0, /* i : integer pitch variables Q0 */
+ const Word16 T0_frac, /* i : Fractional pitch variables Q0*/
+ const Word16 coder_type, /* i : coding type */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 idchan, /* i : channel ID */
+ const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
+ const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
)
{
@@ -7064,9 +7233,11 @@ void prep_tbe_exc_fx(
Word32 L_tmp, Ltemp1, Ltemp2;
Word32 tempQ31;
Word16 tempQ15;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac;
@@ -7081,10 +7252,10 @@ void prep_tbe_exc_fx(
tmp = MAX_16;
move16();
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
pitch = shl_sat( add( shl_sat( T0, 2 ), T0_frac ), 5 ); /* Q7 */
#else
- pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */
+ pitch = shl_o( add( shl_o( T0, 2, &Overflow ), T0_frac ), 5, &Overflow ); /* Q7 */
#endif
test();
@@ -7114,7 +7285,19 @@ void prep_tbe_exc_fx(
IF( EQ_16( L_frame_fx, L_FRAME ) )
{
- interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */
+ interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ gain_code16 = round_fx_sat( L_shl_sat( gain_code_fx, Q_exc ) ); /*Q_exc */
+ FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ )
+ {
+ L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/
+ L_tmp = L_shl_sat( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/
+ L_tmp = L_mac_sat( L_tmp, gain_pit_fx, bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] ); /*Q15+Q_exc */
+ L_tmp = L_shl_sat( L_tmp, 1 ); /*16+Q_exc */ /* saturation can occur here */
+ bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_sat( L_tmp ); /*Q_exc */
+ move16();
+ }
+#else
gain_code16 = round_fx_o( L_shl_o( gain_code_fx, Q_exc, &Overflow ), &Overflow ); /*Q_exc */
FOR( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ )
{
@@ -7125,23 +7308,49 @@ void prep_tbe_exc_fx(
bwe_exc_fx[i + i_subfr_fx * HIBND_ACB_L_FAC] = round_fx_o( L_tmp, &Overflow ); /*Q_exc */
move16();
}
+#endif
}
ELSE
{
Word16 shift = 4;
+#ifdef FIX_2010_PREP_TBE_EXC
+ /* multrus 2025-09-15
+ TODO:
+ - leave shift = 4, since this is legacy code from EVS;
+ - check with vaillancourt, whether we really have a different scaling of code_preQ_fx[] for IVAS
+ - if the different scalings are confirmed, this condition could be simplified
+ */
+ IF( NE_16( element_mode, EVS_MONO ) )
+ {
+ /* shift of 4 assumes code_preQ_fx[] in Q10 - this is however not always given */
+ shift = add( 2 + 1 - 1, Q_code_preQ ); /* gain_preQ_fx in Q2, code_preQ_fx[] in Q_code_preQ, 1 additional left-shift by L_mult() - factor of 2 (from "2 * gain_preQ * code_preQ[i]") */
+ shift = sub( 16, shift );
+ }
+#endif
move16();
IF( gain_preQ_fx != 0 )
{
FOR( i = 0; i < L_subfr; i++ )
{
/*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */
- Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */
- Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */
+ Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */
+#ifdef FIX_2010_PREP_TBE_EXC
+ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /* Q2 + Q_code_preQ */
+#else
+ Ltemp2 = L_mult( gain_preQ_fx, code_preQ_fx[i] ); /*Q2 * Q10 -> Q12 */
+#endif
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */
+ Ltemp2 = L_shl_sat( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/ ); /*Q_exc+16 */
+
+ tmp_code_preInt_fx[i] = round_fx_sat( L_add_sat( Ltemp1, Ltemp2 ) ); /* Q_exc */
+#else
Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */
Ltemp2 = L_shl_o( Ltemp2, add( Q_exc, shift ) /*Q_exc+ 2 + 6 (or) 10 - 13*/, &Overflow ); /*Q_exc+16 */
- tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */
+ tmp_code_preInt_fx[i] = round_fx_o( L_add_o( Ltemp1, Ltemp2, &Overflow ), &Overflow ); /* Q_exc */
+#endif
move16();
}
}
@@ -7150,9 +7359,14 @@ void prep_tbe_exc_fx(
FOR( i = 0; i < L_subfr; i++ )
{
/*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */
- Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */
- Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */
- tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */
+ Ltemp1 = Mult_32_16( gain_code_fx, code_fx[i] ); /* Q16 + Q9 + 1 - 16 = Q10 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ Ltemp1 = L_shl_sat( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/ ); /*Q_exc+16 */
+ tmp_code_preInt_fx[i] = round_fx_sat( Ltemp1 ); /* Q_exc */
+#else
+ Ltemp1 = L_shl_o( Ltemp1, add( Q_exc, 6 ) /*Q_exc+16-19*/, &Overflow ); /*Q_exc+16 */
+ tmp_code_preInt_fx[i] = round_fx_o( Ltemp1, &Overflow ); /* Q_exc */
+#endif
move16();
}
}
@@ -7160,9 +7374,15 @@ void prep_tbe_exc_fx(
interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr ); /* o: tmp_code in Q_exc */
FOR( i = 0; i < shl( L_subfr, 1 ); i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + ( i_subfr_fx << 1 )] ); /*Q14+Q_exc+1 */
+ tmp = round_fx_sat( L_shl_sat( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ ) ); /* tmp in Q_exc */
+ bwe_exc_fx[i + ( i_subfr_fx << 1 )] = add_sat( tmp, tmp_code_fx[i] ); /*Q_exc */
+#else
L_tmp = L_mult( gain_pit_fx, bwe_exc_fx[i + shl( i_subfr_fx, 1 )] ); /*Q14+Q_exc+1 */
tmp = round_fx_o( L_shl_o( L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/, &Overflow ), &Overflow ); /* tmp in Q_exc */
bwe_exc_fx[i + shl( i_subfr_fx, 1 )] = add_o( tmp, tmp_code_fx[i], &Overflow ); /*Q_exc */
+#endif
move16();
}
}
@@ -7198,7 +7418,7 @@ Word16 swb_formant_fac_fx(
{
Word16 formant_fac;
Word16 tmp;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
@@ -7229,7 +7449,7 @@ Word16 swb_formant_fac_fx(
/* formant_fac = 1.0f - 0.5f*formant_fac */
tmp = mult_r( 16384, formant_fac ); /* 0.5 in Q15 */
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
formant_fac = shl_sat( sub( 4096 /* 1 in Q12 */, tmp ), 3 );
#else
formant_fac = shl_o( sub( 4096 /* 1 in Q12 */, tmp ), 3, &Overflow );
diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c
index e0315bbcb1c0c0a733b4f84404beaab10fab1bd3..891314fe216ecb025a0fd8f61e0ccca98ada73c1 100644
--- a/lib_com/syn_filt_fx.c
+++ b/lib_com/syn_filt_fx.c
@@ -11,11 +11,16 @@
static Word32 syn_kern_2( Word32 L_tmp, const Word16 a[], const Word16 y[] )
{
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
L_tmp = L_msu_o( L_tmp, y[-1], a[1], &Overflow );
return L_msu_o( L_tmp, y[-2], a[2], &Overflow );
+#else
+ L_tmp = L_msu_sat( L_tmp, y[-1], a[1] );
+ return L_msu_sat( L_tmp, y[-2], a[2] );
+#endif
}
static Word32 syn_kern_4( Word32 L_tmp, const Word16 a[], const Word16 y[] )
@@ -341,9 +346,11 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W
Word32 L_tmp;
Word16 q;
Word32 ( *syn_kern )( Word32 L_tmp, const Word16 a[], const Word16 y[] ) = NULL;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
if ( EQ_16( m, 6 ) )
@@ -377,8 +384,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W
*-----------------------------------------------------------------------*/
/* Filtering Only from Input + Memory */
L_tmp = syn_kern( L_mult( a0, *x++ ), a, mem );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( L_tmp, q );
+ *y++ = round_fx_sat( L_tmp );
+#else
L_tmp = L_shl_o( L_tmp, q, &Overflow );
*y++ = round_fx_o( L_tmp, &Overflow );
+#endif
move16();
/* Filtering from Input + Mix of Memory & Output Signal Past */
@@ -388,15 +400,24 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W
/* Process Output Signal Past */
FOR( j = 1; j <= i; j++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_msu_sat( L_tmp, a[j], y[-j] );
+#else
L_tmp = L_msu_o( L_tmp, a[j], y[-j], &Overflow );
+#endif
}
/* Process Memory */
FOR( ; j <= m; j++ )
{
L_tmp = L_msu_sat( L_tmp, a[j], mem[i - j] );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( L_tmp, q );
+ *y++ = round_fx_sat( L_tmp );
+#else
L_tmp = L_shl_o( L_tmp, q, &Overflow );
*y++ = round_fx_o( L_tmp, &Overflow );
+#endif
move16();
}
@@ -404,8 +425,13 @@ void E_UTIL_synthesis( const Word16 shift, const Word16 a[], const Word16 x[], W
FOR( ; i < lg; i++ )
{
L_tmp = syn_kern( L_mult( a0, *x++ ), a, y );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( L_tmp, q );
+ *y++ = round_fx_sat( L_tmp );
+#else
L_tmp = L_shl_o( L_tmp, q, &Overflow );
*y++ = round_fx_o( L_tmp, &Overflow );
+#endif
move16();
}
@@ -452,8 +478,10 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[]
Word32 L_tmp;
Word16 q;
Word32 ( *syn_kern )( Word32 L_tmp, const Word32 a[], const Word32 y[] ) = NULL;
+#ifndef ISSUE_1836_replace_overflow_libcom
Flag Overflow = 0;
move32();
+#endif
if ( EQ_16( m, 6 ) )
{
@@ -480,7 +508,7 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[]
*-----------------------------------------------------------------------*/
mem += m; /*move32();*/
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1836_replace_overflow_libcom
a0 = L_shr_sat( a[0], shift ); /* input / 2^shift */
#else
a0 = L_shr_o( a[0], shift, &Overflow ); /* input / 2^shift */
@@ -491,7 +519,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[]
*-----------------------------------------------------------------------*/
/* Filtering Only from Input + Memory */
L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, mem );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( L_tmp, q );
+#else
L_tmp = L_shl_o( L_tmp, q, &Overflow );
+#endif
*y++ = L_tmp;
move32();
@@ -509,7 +541,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[]
{
L_tmp = Msub_32_32_r( L_tmp, a[j], mem[i - j] );
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( L_tmp, q );
+#else
L_tmp = L_shl_o( L_tmp, q, &Overflow );
+#endif
*y++ = L_tmp;
move32();
}
@@ -518,7 +554,11 @@ void E_UTIL_synthesis_fx( const Word16 shift, const Word32 a[], const Word32 x[]
FOR( ; i < lg; i++ )
{
L_tmp = syn_kern( Mpy_32_32( a0, *x++ ), a, y );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( L_tmp, q );
+#else
L_tmp = L_shl_o( L_tmp, q, &Overflow );
+#endif
*y++ = L_tmp;
move32();
}
diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c
index 322549a6f0841e9d147075092d263ad85526b9da..d9112ffa04ec74421beef4149d3a44d369762dd1 100644
--- a/lib_com/tcx_ltp_fx.c
+++ b/lib_com/tcx_ltp_fx.c
@@ -389,9 +389,11 @@ void predict_signal(
Word16 j;
Word32 s;
const Word16 *x0, *win;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
x0 = &excI[-T0 - 1];
frac = negate( frac );
@@ -408,10 +410,17 @@ void predict_signal(
FOR( j = 0; j < L_subfr; j++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ s = L_mult_sat( win[0], x0[0] ); /* Qx + 16 */
+ s = L_mac_sat( s, win[1], x0[1] ); /* Qx + 16 */
+ s = L_mac_sat( s, win[2], x0[2] ); /* Qx + 16 */
+ excO[j] = mac_r_sat( s, win[3], x0[3] ); /* Qx + 16 */
+#else
s = L_mult_o( win[0], x0[0], &Overflow ); /* Qx + 16 */
s = L_mac_o( s, win[1], x0[1], &Overflow ); /* Qx + 16 */
s = L_mac_o( s, win[2], x0[2], &Overflow ); /* Qx + 16 */
excO[j] = mac_ro( s, win[3], x0[3], &Overflow ); /* Qx + 16 */
+#endif
move16();
x0++;
@@ -483,6 +492,155 @@ static void tcx_ltp_synth_filter(
step = negate( step );
}
+#ifdef OPT_TCXLTP_FILTER_LOOP
+ IF( zir != NULL )
+ {
+ IF( fade != 0 )
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); /* Qx */
+ s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ i = sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ); /* Qx */
+ k = mult_r( gain, i ); /* Qx */
+ k = mult_r( k, alpha ); /* Qx */
+ k = add_sat( synth[j], k ); /* Qx */
+ k = sub_sat( k, zir[j] ); /* Qx */
+
+ synth_ltp[j] = k; /* Qx */
+ move16();
+
+ BASOP_SATURATE_WARNING_OFF_EVS;
+ alpha = add_sat( alpha, step );
+ BASOP_SATURATE_WARNING_ON_EVS;
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ ELSE
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); /* Qx */
+ s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ i = sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ); /* Qx */
+ k = mult_r( gain, i ); /* Qx */
+ k = add_sat( synth[j], k ); /* Qx */
+ k = sub_sat( k, zir[j] ); /* Qx */
+
+ synth_ltp[j] = k; /* Qx */
+ move16();
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ }
+ ELSE
+ {
+ IF( fade != 0 )
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); /* Qx */
+ s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ i = sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ); /* Qx */
+ k = mult_r( gain, i ); /* Qx */
+ k = mult_r( k, alpha );
+ k = add_sat( synth[j], k ); /* Qx */
+
+ synth_ltp[j] = k; /* Qx */
+ move16();
+
+ BASOP_SATURATE_WARNING_OFF_EVS;
+ alpha = add_sat( alpha, step );
+ BASOP_SATURATE_WARNING_ON_EVS;
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ ELSE
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); /* Qx */
+ s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ i = sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ); /* Qx */
+ k = mult_r( gain, i ); /* Qx */
+ k = add_sat( synth[j], k ); /* Qx */
+
+ synth_ltp[j] = k; /* Qx */
+ move16();
+
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ }
+#else
FOR( j = 0; j < length; j++ )
{
s = L_deposit_l( 0 );
@@ -525,6 +683,7 @@ static void tcx_ltp_synth_filter(
y0++;
y1++;
}
+#endif
}
ELSE
{
@@ -570,7 +729,6 @@ static void tcx_ltp_synth_filter32(
L = tcxLtpFilters[filtIdx].length; /* Q0 */
move16();
-
alpha = 0;
move16();
IF( fade != 0 )
@@ -597,6 +755,154 @@ static void tcx_ltp_synth_filter32(
step = negate( step );
}
+#ifdef OPT_TCXLTP_FILTER_LOOP
+ IF( fade != 0 )
+ {
+ IF( zir != NULL )
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); /* Qx */
+ s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ L_tmp = L_sub_sat( s, Mpy_32_16_r( s2, ALPHA ) ); /* Qx */
+ L_tmp2 = Mpy_32_16_r( L_tmp, gain ); /* Qx */
+ L_tmp2 = Mpy_32_16_r( L_tmp2, alpha ); /* Qx */
+ L_tmp2 = L_sub_sat( L_tmp2, zir[j] ); /* Qx */
+ L_tmp2 = L_add_sat( synth[j], L_tmp2 ); /* Qx */
+
+ synth_ltp[j] = L_tmp2; /* Qx */
+ move16();
+
+ BASOP_SATURATE_WARNING_OFF_EVS;
+ alpha = add_sat( alpha, step );
+ BASOP_SATURATE_WARNING_ON_EVS;
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ ELSE
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); /* Qx */
+ s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ L_tmp = L_sub_sat( s, Mpy_32_16_r( s2, ALPHA ) ); /* Qx */
+ L_tmp2 = Mpy_32_16_r( L_tmp, gain ); /* Qx */
+ L_tmp2 = Mpy_32_16_r( L_tmp2, alpha ); /* Qx */
+ L_tmp2 = L_add_sat( synth[j], L_tmp2 ); /* Qx */
+
+ synth_ltp[j] = L_tmp2; /* Qx */
+ move16();
+
+ BASOP_SATURATE_WARNING_OFF_EVS;
+ alpha = add_sat( alpha, step );
+ BASOP_SATURATE_WARNING_ON_EVS;
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ }
+ ELSE
+ {
+ IF( zir != NULL )
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); /* Qx */
+ s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ L_tmp = L_sub_sat( s, Mpy_32_16_r( s2, ALPHA ) ); /* Qx */
+ L_tmp2 = Mpy_32_16_r( L_tmp, gain ); /* Qx */
+ L_tmp2 = L_sub_sat( L_tmp2, zir[j] ); /* Qx */
+ L_tmp2 = L_add_sat( synth[j], L_tmp2 ); /* Qx */
+
+ synth_ltp[j] = L_tmp2; /* Qx */
+ move16();
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ ELSE
+ {
+ FOR( j = 0; j < length; j++ )
+ {
+ s = L_deposit_l( 0 );
+ s2 = L_deposit_l( 0 );
+ k = 0;
+ move16();
+ FOR( i = 0; i < L; i++ )
+ {
+ s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); /* Qx */
+ s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); /* Qx */
+ k = k + pitch_res;
+ }
+
+ /* s2 *= ALPHA;
+ normal: synth_ltp[j] = synth[j] - gain * s2 + gain * s;
+ zir: synth_ltp[j] = synth[j] - gain * s2 + gain * s - zir[j];
+ fade-in/out: synth_ltp[j] = synth[j] - alpha * gain * s2 + alpha * gain * s; */
+ L_tmp = L_sub_sat( s, Mpy_32_16_r( s2, ALPHA ) ); /* Qx */
+ L_tmp2 = Mpy_32_16_r( L_tmp, gain ); /* Qx */
+ L_tmp2 = L_add_sat( synth[j], L_tmp2 ); /* Qx */
+
+ synth_ltp[j] = L_tmp2; /* Qx */
+ move16();
+
+ x0++;
+ x1++;
+ y0++;
+ y1++;
+ }
+ }
+ }
+#else
FOR( j = 0; j < length; j++ )
{
s = L_deposit_l( 0 );
@@ -639,6 +945,7 @@ static void tcx_ltp_synth_filter32(
y0++;
y1++;
}
+#endif
}
ELSE
{
diff --git a/lib_com/tcx_mdct_fx.c b/lib_com/tcx_mdct_fx.c
index b2cee32e67e81bb3cd4b8af746959d3d014edd81..29827b9356a4a659b723b083d3402555cfb6770e 100644
--- a/lib_com/tcx_mdct_fx.c
+++ b/lib_com/tcx_mdct_fx.c
@@ -107,9 +107,11 @@ void TCX_MDCT(
Word16 factor, neg_factor;
Word16 factor_e;
(void) element_mode;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e );
*y_e = add( *y_e, factor_e );
@@ -126,7 +128,11 @@ void TCX_MDCT(
}
FOR( i = 0; i < l / 2; i++ )
{
- y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], factor ), x[l - 1 - i], factor ); /* exp(y_e) */
+#else
+ y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */
+#endif
move32();
}
FOR( i = 0; i < m / 2; i++ )
@@ -136,7 +142,11 @@ void TCX_MDCT(
}
FOR( i = 0; i < r / 2; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_sat( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor ); /* exp(y_e) */
+#else
y[m / 2 + r / 2 - 1 - m / 2 - i] = L_mac_o( L_mult( x[l + m + i], neg_factor ), x[l + m + r - 1 - i], neg_factor, &Overflow ); /* exp(y_e) */
+#endif
move32();
}
@@ -163,9 +173,11 @@ void TCX_MDST(
Word16 factor, neg_factor;
Word16 factor_e;
(void) element_mode;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
factor = TCX_MDCT_GetScaleFactor( add( add( shr( l, 1 ), m ), shr( r, 1 ) ), &factor_e ); /* exp(factor_e) */
*y_e = add( *y_e, factor_e );
@@ -182,7 +194,11 @@ void TCX_MDST(
}
FOR( i = 0; i < l / 2; i++ )
{
- y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[m / 2 + r / 2 + m / 2 + i] = L_msu_sat( L_mult( x[i], neg_factor ), x[l - 1 - i], factor ); /* exp(y_e) */
+#else
+ y[m / 2 + r / 2 + m / 2 + i] = L_msu_o( L_mult( x[i], neg_factor ), x[l - 1 - i], factor, &Overflow ); /* exp(y_e) */
+#endif
move32();
}
FOR( i = 0; i < m / 2; i++ )
diff --git a/lib_com/tcx_mdct_window_fx.c b/lib_com/tcx_mdct_window_fx.c
index 0316ec5827ecd13a1d174b67fb89d18eacdf521b..285bbbf0a2a40d4eafaebd461083c5563c8fe440 100644
--- a/lib_com/tcx_mdct_window_fx.c
+++ b/lib_com/tcx_mdct_window_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c
index c5ff95e04e68c7904a93ddc7444440333131cded..326ec622160e3281067d2dc8c507261401dfd77a 100644
--- a/lib_com/tcx_utils_fx.c
+++ b/lib_com/tcx_utils_fx.c
@@ -991,8 +991,10 @@ void mdct_shaping(
Word32 *px = x; /*Qx*/
Word16 const *pgains = gains;
Word16 const *pgainsexp = gains_exp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/* FDNS_NPTS = 64 */
@@ -1044,7 +1046,11 @@ void mdct_shaping(
FOR( l = 0; l < k; l++ )
{
- *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/
+#else
+ *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/
+#endif
move32();
x++;
}
@@ -1063,7 +1069,11 @@ void mdct_shaping(
gains_exp = pgainsexp;
FOR( i = 0; i < FDNS_NPTS; i++ )
{
- *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/
+#ifdef ISSUE_1836_replace_overflow_libcom
+ *x = L_shl_sat( Mpy_32_16_r( *x, *gains ), *gains_exp ); /*Qx*/
+#else
+ *x = L_shl_o( Mpy_32_16_r( *x, *gains ), *gains_exp, &Overflow ); /*Qx*/
+#endif
move32();
x += k;
gains++;
@@ -1389,9 +1399,11 @@ void PsychAdaptLowFreqDeemph(
Word16 i;
Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
#endif
+#endif
assert( lpcGains[0] >= 0x4000 );
@@ -1433,13 +1445,21 @@ void PsychAdaptLowFreqDeemph(
/* fac = tmp = (float)pow(max_val / min, 0.0078125f); */
tmp_e = min_e;
move16();
- tmp = Inv16( min, &tmp_e ); /*Q15 - tmp_e*/
- L_tmp = L_shl( L_mult( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31 */
- L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */
- L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */
- L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */
- tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */
- fac = tmp; /* Q15 */
+ tmp = Inv16( min, &tmp_e ); /*Q15 - tmp_e*/
+#ifdef FIX_1984_SAT_IN_PSYCHAD
+ L_tmp = L_shl_sat( L_mult_sat( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31 */
+#else
+ L_tmp = L_shl( L_mult( tmp, max_val ), add( tmp_e, max_e ) ); /* Q31 */
+#endif
+ L_tmp = BASOP_Util_Log2( L_tmp ); /* Q25 */
+ L_tmp = L_shr( L_tmp, 7 ); /* 0.0078125f = 1.f/(1<<7) */
+ L_tmp = BASOP_Util_InvLog2( L_tmp ); /* Q31 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = round_fx_sat( L_tmp ); /* Q15 */
+#else
+ tmp = round_fx_o( L_tmp, &Overflow ); /* Q15 */
+#endif
+ fac = tmp; /* Q15 */
move16();
/* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */
@@ -2081,8 +2101,10 @@ void tcx_get_gain(
Word32 corr, ener;
Word16 sx, sy, corr_e, ener_e;
Word16 i, tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
maxX = L_deposit_l( 1 );
@@ -2129,7 +2151,11 @@ void tcx_get_gain(
ener = L_shl( ener, tmp ); /*Q31 - ener_e + tmp*/
ener_e = sub( ener_e, tmp );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = div_s( abs_s( round_fx_sat( corr ) ), round_fx_sat( ener ) ); /*Q15 - (corr_e - ener_e)*/
+#else
tmp = div_s( abs_s( round_fx_o( corr, &Overflow ) ), round_fx_o( ener, &Overflow ) ); /*Q15 - (corr_e - ener_e)*/
+#endif
if ( corr < 0 )
tmp = negate( tmp );
diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c
old mode 100644
new mode 100755
index aaf262786f2b56f03539e26998c112ae20795f6d..42c0db406dcaa7c5ecdd3341101526aaa4e4b716
--- a/lib_com/tns_base.c
+++ b/lib_com/tns_base.c
@@ -21,7 +21,6 @@
#define HLM_MIN_NRG_FX 32768 /*Q0*/
#define MAX_SUBDIVISIONS 3
-
/*----------------------------------------------------------------------------
* Local prototypes
*---------------------------------------------------------------------------*/
@@ -439,9 +438,11 @@ Word16 ITF_Detect_fx(
Word32 L_tmp, tmp32;
Word16 tmpbuf[325];
Word16 n, i;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
move16();
@@ -475,7 +476,11 @@ Word16 ITF_Detect_fx(
/* Check threshold HLM_MIN_NRG */
BASOP_SATURATE_WARNING_OFF_EVS;
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp32 = L_sub( L_shl_sat( L_tmp, sub( shift, sub( 24, Q ) ) ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/
+#else
tmp32 = L_sub( L_shl_o( L_tmp, sub( shift, sub( 24, Q ) ), &Overflow ), 4194304l /*HLM_MIN_NRG Q7*/ ); /*Q7*/
+#endif
BASOP_SATURATE_WARNING_ON_EVS;
/* get pre-shift for autocorrelation */
@@ -646,8 +651,7 @@ Word16 ITF_Detect_ivas_fx(
{
sum = W_mac_32_32( sum, temp_spectrum[i], temp_spectrum[i] ); // 2(Q+shift)+1
}
-
- IF( LE_64( sum, W_shl( 32768 * 2 /* HLM_MIN_NRG in Q1 */, shl( add( Q, shift ), 1 ) ) ) )
+ IF( LE_64( sum, W_shl( 32768 * 2 /* HLM_MIN_NRG in Q1 */, s_min( 63, shl( add( Q, shift ), 1 ) ) ) ) )
{
BREAK;
}
diff --git a/lib_com/tools.c b/lib_com/tools.c
deleted file mode 100644
index 909460c5df897f7d7e08987070d98a10ce91401a..0000000000000000000000000000000000000000
--- a/lib_com/tools.c
+++ /dev/null
@@ -1,901 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
- ====================================================================================*/
-
-#include
-#include "options.h"
-#include
-#include "prot_fx.h"
-#include "wmc_auto.h"
-
-/*------------------------------------------------------------------*
- * own_random()
- *
- * Random generator
- *------------------------------------------------------------------*/
-
-/*! r: output random value */
-Word16 own_random(
- Word16 *seed /* i/o: random seed */
-)
-{
- *seed = (Word16) ( *seed * 31821L + 13849L );
-
- return ( *seed );
-}
-
-/*---------------------------------------------------------------------
- * norm_ul_float()
- *
- *---------------------------------------------------------------------*/
-
-Word16 norm_ul_float( UWord32 UL_var1 )
-{
- Word16 var_out;
-
- if ( UL_var1 == 0 )
- {
- var_out = 0;
- }
- else
- {
- for ( var_out = 0; UL_var1 < (UWord32) 0x80000000U; var_out++ )
- {
- UL_var1 <<= 1;
- }
- }
- BASOP_CHECK();
-
- return ( var_out );
-}
-
-
-/*---------------------------------------------------------------------
- * sum_s()
- * sum_l()
- *
- *---------------------------------------------------------------------*/
-
-/*! r: sum of all vector elements */
-Word16 sum_s(
- const Word16 *vec, /* i : input vector */
- const Word16 lvec /* i : length of input vector */
-)
-{
- Word16 i;
- Word16 tmp;
-
- tmp = 0;
- for ( i = 0; i < lvec; i++ )
- {
- tmp += vec[i];
- }
-
- return tmp;
-}
-
-/*! r: sum of all vector elements */
-Word32 sum_l_fx(
- const Word32 *vec, /* i : input vector */
- const Word16 lvec /* i : length of input vector */
-)
-{
- Word16 i;
- Word32 tmpL;
-
- tmpL = 0;
- move32();
- FOR( i = 0; i < lvec; i++ )
- {
- tmpL = L_add( tmpL, vec[i] );
- }
-
- return tmpL;
-}
-
-/*----------------------------------------------------------------------
- * sum2_f()
- *
- *---------------------------------------------------------------------*/
-
-/*! r: sum of all squared vector elements */
-Word32 sum2_f_16_fx(
- const Word16 *vec, /* i : input vector */
- const Word16 lvec /* i : length of input vector */
-)
-{
- Word16 i;
- Word32 tmp;
-
- tmp = 0;
- move32();
- FOR( i = 0; i < lvec; i++ )
- {
- tmp = L_add( tmp, L_mult0( vec[i], vec[i] ) );
- }
-
- return tmp;
-}
-Word32 sum2_f_16_gb_fx(
- const Word16 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word16 gb )
-{
- Word16 i;
- Word32 tmp;
-
- tmp = 0;
- FOR( i = 0; i < lvec; i++ )
- {
- tmp = L_add( tmp, L_shr( L_mult0( vec[i], vec[i] ), gb ) );
- }
-
- return tmp;
-}
-
-Word32 sum2_16_exp_fx(
- const Word16 *vec, /* i : input vector Q(15 - exp) */
- const Word16 lvec, /* i : length of input vector */
- Word16 *exp, /* i/o: exponent of vector */
- Word16 gb /* i : guard bits */
-)
-{
- Word16 i, s;
- Word32 L_tmp, var_a;
-
- L_tmp = 0;
- move32();
- var_a = 0;
- move32();
- FOR( i = 0; i < lvec; i++ )
- {
- var_a = L_mult0( vec[i], vec[i] ); /* 2 * Q(15 - exp) */
- L_tmp = L_add( L_tmp, L_shr( var_a, gb ) ); /* 2 * Q(15 - exp) - gb */
- }
-
- s = norm_l( L_tmp );
- L_tmp = L_shl( L_tmp, s ); /* 2 * Q(15 - exp) - gb + s */
-
- *exp = add( sub( add( shl( *exp, 1 ), gb ), s ), 1 );
- move16();
-
- return L_tmp;
-}
-
-Word32 sum2_32_exp_fx(
- const Word32 *vec, /* i : input vector, Qx */
- const Word16 lvec, /* i : length of input vector */
- Word16 *exp, /* i/o: exponent of vector */
- Word16 gb /* i : guard bits */
-)
-{
- Word16 i, s, norm;
- Word64 W_tmp;
-
- W_tmp = 0;
- Word64 var_a = 0;
- move64();
- move64();
-
- norm = L_norm_arr( vec, lvec );
-
- gb = sub( gb, norm );
-
- FOR( i = 0; i < lvec; i++ )
- {
- var_a = W_mult0_32_32( vec[i], vec[i] ); // 2x
- W_tmp = W_add( W_tmp, W_shr( var_a, gb ) ); // 2x-gb
- }
-
- s = W_norm( W_tmp );
- W_tmp = W_shl( W_tmp, s ); // 2x - gb + s
-
- //*exp = 31 - (2*(31 - *exp) - gb + s) + 32;
- *exp = add( sub( add( shl( *exp, 1 ), gb ), s ), 1 );
- move16();
-
- return W_extract_h( W_tmp );
-}
-
-Word32 sum2_f_32_fx( /* o : Q(2x - 31 - gb) */
- const Word32 *vec, /* i : input vector, Qx */
- const Word16 lvec, /* i : length of input vector */
- Word16 gb /* i : guard bits */
-)
-{
- Word16 i;
- Word32 tmp;
-
- tmp = 0;
- Word32 var_a = 0;
- move32();
- move32();
- FOR( i = 0; i < lvec; i++ )
- {
- var_a = Mpy_32_32( vec[i], vec[i] ); // 2x-31
- tmp = L_add( tmp, L_shr( var_a, gb ) ); // 2x-31-gb
- }
-
- return tmp;
-}
-
-Word32 sum2_32_fx(
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word16 *e )
-{
- Word16 i;
- Word32 tmp;
-
- tmp = 0;
- Word32 var_a = 0;
- Word16 exp = 0, exp_tmp;
- move32();
- move32();
- move16();
- FOR( i = 0; i < lvec; i++ )
- {
- exp_tmp = norm_l( vec[i] );
- var_a = L_shl( vec[i], exp_tmp );
- var_a = Mpy_32_32( var_a, var_a );
- exp_tmp = shl( sub( *e, exp_tmp ), 1 );
- tmp = BASOP_Util_Add_Mant32Exp( tmp, exp, var_a, exp_tmp, &exp );
- }
- *e = exp;
- move16();
-
- return tmp;
-}
-
-/*-------------------------------------------------------------------*
- * set_c()
- * set_s()
- * set_l()
- * set_d()
- *
- * Set the vector elements to a value
- *-------------------------------------------------------------------*/
-
-void set_c(
- Word8 y[], /* i/o: Vector to set */
- const Word8 a, /* i : Value to set the vector to */
- const Word32 N /* i : Length of the vector */
-)
-{
- Word16 i;
-
- for ( i = 0; i < N; i++ )
- {
- y[i] = a;
- }
-
- return;
-}
-
-
-void set_s(
- Word16 y[], /* i/o: Vector to set */
- const Word16 a, /* i : Value to set the vector to */
- const Word16 N /* i : Length of the vector */
-)
-{
- Word16 i;
-
- for ( i = 0; i < N; i++ )
- {
- y[i] = a;
- }
-
- return;
-}
-
-
-void set_l(
- Word32 y[], /* i/o: Vector to set */
- const Word32 a, /* i : Value to set the vector to */
- const Word16 N /* i : Length of the vector */
-)
-{
- Word16 i;
-
- for ( i = 0; i < N; i++ )
- {
- y[i] = a;
- }
-
- return;
-}
-
-/*---------------------------------------------------------------------*
- * set_zero()
- *
- * Set a vector vec[] of dimension lvec to zero
- *---------------------------------------------------------------------*/
-
-void set_zero(
- float *vec, /* o : input vector */
- const Word16 lvec /* i : length of the vector */
-)
-{
- Word16 i;
-
- for ( i = 0; i < lvec; i++ )
- {
- *vec++ = 0.0f;
- }
-
- return;
-}
-
-
-/*---------------------------------------------------------------------*
- * mvr2r()
- * mvs2s()
- * mvr2d()
- * mvd2r()
- *
- * Transfer the contents of vector x[] to vector y[]
- *---------------------------------------------------------------------*/
-
-void mvr2r(
- const float x[], /* i : input vector */
- float y[], /* o : output vector */
- const Word16 n /* i : vector size */
-)
-{
- Word16 i;
-
- if ( n <= 0 )
- {
- /* cannot transfer vectors with size 0 */
- return;
- }
-
- if ( y < x )
- {
- for ( i = 0; i < n; i++ )
- {
- y[i] = x[i];
- }
- }
- else
- {
- for ( i = n - 1; i >= 0; i-- )
- {
- y[i] = x[i];
- }
- }
-
- return;
-}
-
-void mvs2s(
- const Word16 x[], /* i : input vector */
- Word16 y[], /* o : output vector */
- const Word16 n /* i : vector size */
-)
-{
- Word16 i;
-
- if ( n <= 0 )
- {
- /* cannot transfer vectors with size 0 */
- return;
- }
-
- if ( y < x )
- {
- for ( i = 0; i < n; i++ )
- {
- y[i] = x[i];
- }
- }
- else
- {
- for ( i = n - 1; i >= 0; i-- )
- {
- y[i] = x[i];
- }
- }
-
- return;
-}
-
-void mvl2l(
- const Word32 x[], /* i : input vector */
- Word32 y[], /* o : output vector */
- const Word16 n /* i : vector size */
-)
-{
- Word16 i;
-
- if ( n <= 0 )
- {
- /* no need to transfer vectors with size 0 */
- return;
- }
-
- if ( y < x )
- {
- for ( i = 0; i < n; i++ )
- {
- y[i] = x[i];
- }
- }
- else
- {
- for ( i = n - 1; i >= 0; i-- )
- {
- y[i] = x[i];
- }
- }
-
- return;
-}
-
-/*! r: index of the maximum value in the input vector */
-Word16 maximum_s(
- const Word16 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word16 *max /* o : maximum value in the input vector */
-)
-{
- Word16 i, ind;
- Word16 tmp;
-
- ind = 0;
- move16();
- tmp = vec[0];
- move16();
-
- FOR( i = 1; i < lvec; i++ )
- {
- IF( GT_16( vec[i], tmp ) )
- {
- ind = i;
- move16();
- tmp = vec[i];
- move16();
- }
- }
-
- if ( max != NULL )
- {
- *max = tmp;
- move16();
- }
-
- return ind;
-}
-
-/*! r: index of the maximum value in the input vector */
-Word16 maximum_l(
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word32 *max_val /* o : maximum value in the input vector */
-)
-{
- Word16 i, ind;
- Word32 tmp;
-
- ind = 0;
- tmp = vec[0];
- move16();
- move32();
- FOR( i = 1; i < lvec; i++ )
- {
- IF( GT_32( vec[i], tmp ) )
- {
- ind = i;
- tmp = vec[i];
- move16();
- move32();
- }
- }
-
- if ( max_val != NULL )
- {
- *max_val = tmp;
- move32();
- }
-
- return ind;
-}
-
-/*! r: index of the maximum value in the input vector */
-Word16 maximumAbs_l(
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word32 *max_val /* o : maximum value in the input vector */
-)
-{
- Word16 j, ind;
- Word32 tmp;
-
- ind = 0;
- move16();
- tmp = L_abs( vec[0] );
-
- FOR( j = 1; j < lvec; j++ )
- {
- IF( GT_32( L_abs( vec[j] ), tmp ) )
- {
- ind = j;
- move16();
- tmp = L_abs( vec[j] );
- }
- }
-
- IF( max_val != NULL )
- {
- *max_val = tmp;
- move32();
- }
-
- return ind;
-}
-
-/*-------------------------------------------------------------------*
- * minimum_s()
- *
- * Finds minimum 16-bit signed integer value in the array and returns it.
- *-------------------------------------------------------------------*/
-
-/*! r: index of the minimum value in the input vector */
-Word16 minimum_s(
- const Word16 *vec, /* i : Input vector */
- const Word16 lvec, /* i : Vector length */
- Word16 *min_val /* o : minimum value in the input vector */
-)
-{
- Word16 i, ind;
-
- ind = 0;
- move16();
-
- FOR( i = 1; i < lvec; i++ )
- {
- if ( LT_16( vec[i], vec[ind] ) )
- {
- ind = i;
- move16();
- }
- }
-
- if ( min_val != NULL )
- {
- *min_val = vec[ind];
- move16();
- }
-
- return ind;
-}
-
-/*-------------------------------------------------------------------*
- * minimum_l()
- *
- * Finds minimum 16-bit signed integer value in the array and returns it.
- *-------------------------------------------------------------------*/
-
-/*! r: index of the minimum value in the input vector */
-Word16 minimum_l(
- const Word32 *vec, /* i : Input vector */
- const Word16 lvec, /* i : Vector length */
- Word32 *min_val /* o : minimum value in the input vector */
-)
-{
- Word16 i, ind;
-
- ind = 0;
- move16();
-
- FOR( i = 1; i < lvec; i++ )
- {
- if ( LT_32( vec[i], vec[ind] ) )
- {
- ind = i;
- move16();
- }
- }
-
- if ( min_val != NULL )
- {
- *min_val = vec[ind];
- move32();
- }
-
- return ind;
-}
-
-/*---------------------------------------------------------------------*
- * dotp()
- *
- * Dot product of vector x[] and vector y[]
- *---------------------------------------------------------------------*/
-
-/*! r: dot product of x[] and y[] */
-Word32 dotp_fixed(
- const Word32 x[], /* i : vector x[] Qx */
- const Word32 y[], /* i : vector y[] Qy */
- const Word16 n /* i : vector length */
-)
-{
- Word16 i;
- Word32 suma;
-
- suma = Mpy_32_32( x[0], y[0] );
-
- FOR( i = 1; i < n; i++ )
- {
- suma = L_add( suma, Mpy_32_32( x[i], y[i] ) );
- }
-
- return suma;
-}
-
-/*To calculate dot product of two 32 bit arrays in case of overflow*/
-Word32 dotp_fixed_o(
- const Word32 x[], /* i : vector x[] */
- const Word32 y[], /* i : vector y[] */
- const Word16 n, /* i : vector length */
- const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */
- Word16 *res_q /*stores resultant Q*/
-)
-{
- Word16 i;
- Word64 suma; /*resultant q= q(x)+q(y)-9-x such that q<=31*/
-
- suma = W_shr( W_mult_32_32( x[0], y[0] ), log_len );
-
- FOR( i = 1; i < n; i++ )
- {
- suma = W_add( suma, W_shr( W_mult_32_32( x[i], y[i] ), log_len ) );
- }
- *res_q = add( sub( *res_q, log_len ), 1 );
- move16();
- test();
- test();
- FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); )
- {
- suma = W_shr( suma, 1 );
- *res_q = sub( *res_q, 1 );
- move16();
- }
- return W_extract_l( suma );
-}
-
-Word32 dotp_fixed_32(
- const Word32 x[], /* i : vector x[] */
- const Word32 y[], /* i : vector y[] */
- const Word16 n, /* i : vector length */
- const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */
- Word16 *res_q /*stores resultant Q*/
-)
-{
- Word16 i;
- Word64 suma; /*resultant q= q(x)+q(y)-9-x such that q<=31*/
-
- suma = W_shr( W_mult_32_32( x[0], y[0] ), log_len );
-
- FOR( i = 1; i < n; i++ )
- {
- suma = W_add( suma, W_shr( W_mult_32_32( x[i], y[i] ), log_len ) );
- }
- *res_q = add( *res_q, add( sub( *res_q, log_len ), 1 ) );
- move16();
- test();
- test();
- FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); )
- {
- suma = W_shr( suma, 1 );
- *res_q = sub( *res_q, 1 );
- move16();
- }
- return W_extract_l( suma );
-}
-
-/*-------------------------------------------------------------------*
- * v_add_w64()
- *
- * Subtraction of two vectors sample by sample
- *-------------------------------------------------------------------*/
-
-void v_add_w64(
- const Word64 x1[], /* i : Input vector 1 */
- const Word64 x2[], /* i : Input vector 2 */
- Word64 y[], /* o : Output vector that contains vector 1 - vector 2 */
- const Word16 N, /* i : Vector length */
- const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */
-)
-{
- Word16 i;
-
- FOR( i = 0; i < N; i++ )
- {
- y[i] = W_add( W_shr( x1[i], hdrm ), W_shr( x2[i], hdrm ) );
- move64();
- }
-
- return;
-}
-
-/*-------------------------------------------------------------------*
- * v_sub_fixed()
- *
- * Subtraction of two vectors sample by sample
- *-------------------------------------------------------------------*/
-
-void v_sub_fixed(
- const Word32 x1[], /* i : Input vector 1 */
- const Word32 x2[], /* i : Input vector 2 */
- Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */
- const Word16 N, /* i : Vector length */
- const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */
-)
-{
- Word16 i;
-
- FOR( i = 0; i < N; i++ )
- {
- y[i] = L_sub( L_shr( x1[i], hdrm ), L_shr( x2[i], hdrm ) );
- move32();
- }
-
- return;
-}
-
-void v_sub_fixed_no_hdrm(
- const Word32 x1[], /* i : Input vector 1 */
- const Word32 x2[], /* i : Input vector 2 */
- Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */
- const Word16 N /* i : Vector length */
-)
-{
- Word16 i;
-
- FOR( i = 0; i < N; i++ )
- {
- y[i] = L_sub( x1[i], x2[i] );
- move32();
- }
-
- return;
-}
-
-/*-------------------------------------------------------------------*
- * v_multc_fixed()
- *
- * Multiplication of vector by constant
- *-------------------------------------------------------------------*/
-
-void v_multc_fixed(
- const Word32 x[], /* i : Input vector */
- const Word32 c, /* i : Constant */
- Word32 y[], /* o : Output vector that contains c*x */
- const Word16 N /* i : Vector length */
-)
-{
- Word16 i;
-
- FOR( i = 0; i < N; i++ )
- {
- y[i] = Mpy_32_32( c, x[i] );
- move32();
- }
-
- return;
-}
-
-void v_multc_fixed_16(
- const Word32 x[], /* i : Input vector */
- const Word16 c, /* i : Constant */
- Word32 y[], /* o : Output vector that contains c*x */
- const Word16 N /* i : Vector length */
-)
-{
- Word16 i;
-
- FOR( i = 0; i < N; i++ )
- {
- y[i] = Mpy_32_16_1( x[i], c );
- move32();
- }
-
- return;
-}
-
-void v_multc_fixed_16_16(
- const Word16 x[], /* i : Input vector */
- const Word16 c, /* i : Constant */
- Word16 y[], /* o : Output vector that contains c*x */
- const Word16 N /* i : Vector length */
-)
-{
- Word16 i;
-
- FOR( i = 0; i < N; i++ )
- {
- y[i] = mult_r( x[i], c );
- move16();
- }
-
- return;
-}
-
-/*-------------------------------------------------------------------*
- * usdequant()
- *
- * Uniform scalar de-quantizer routine
- *
- * Applies de-quantization based on scale and round operations.
- *-------------------------------------------------------------------*/
-
-float usdequant(
- const Word16 idx, /* i : quantizer index */
- const float qlow, /* i : lowest codebook entry (index 0) */
- const float delta /* i : quantization step */
-)
-{
- float g;
-
- g = idx * delta + qlow;
-
- return ( g );
-}
-
-void sort(
- UWord16 *x, /* i/o: Vector to be sorted */
- UWord16 len /* i/o: vector length */
-)
-{
- Word16 i;
- UWord16 j, tempr;
-
- FOR( i = len - 2; i >= 0; i-- )
- {
- tempr = x[i];
- move16();
- FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ )
- {
- test();
- x[j - 1] = x[j];
- move16();
- }
- x[j - 1] = tempr;
- move16();
- }
-
- return;
-}
diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c
index 5e116a286b3e84a2a49b9d36f51595cffa065ff5..0d60446b361124bfa23f30695332afbbe1dad29d 100644
--- a/lib_com/tools_fx.c
+++ b/lib_com/tools_fx.c
@@ -31,33 +31,899 @@
*******************************************************************************************************/
/*====================================================================================
- 3GPP TS26.258 Aug 24, 2023. IVAS Codec Version IVAS-FL-1.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
- ====================================================================================*/
+#include
+#include
+#include
+#include "options.h"
+#include "stl.h"
+#include
+#include "cnst.h"
+#include "prot_fx.h"
+#include "basop_util.h"
+#include "basop32.h"
+#include "wmc_auto.h"
+#include "prot_fx_enc.h"
+#include "ivas_prot_fx.h"
+
+
+#define INV_BANDS10 3277 /* 1/10 in Q15 */
+#define INV_BANDS9 3641 /* 1/9 in Q15 */
+#define INV_BANDS3 10923 /* 1/9 in Q15 */
+static const Word16 b_hp400_fx[3] = { 3660, -7320, 3660 }; /* Q12 (/4) */
+static const Word16 a_hp400_fx[3] = { 16384, 29280, -14160 };
+static const Word16 a_hp400_ivas_fx[3] = { 4096, 7320, -3540 }; /*Q12*/
+
+/*------------------------------------------------------------------*
+ * own_random()
+ *
+ * Random generator
+ *------------------------------------------------------------------*/
+
+/*! r: output random value */
+Word16 own_random(
+ Word16 *seed /* i/o: random seed */
+)
+{
+ *seed = (Word16) ( *seed * 31821L + 13849L );
+
+ return ( *seed );
+}
+
+/*---------------------------------------------------------------------
+ * norm_ul_float()
+ *
+ *---------------------------------------------------------------------*/
+
+Word16 norm_ul_float( UWord32 UL_var1 )
+{
+ Word16 var_out;
+
+ if ( UL_var1 == 0 )
+ {
+ var_out = 0;
+ }
+ else
+ {
+ for ( var_out = 0; UL_var1 < (UWord32) 0x80000000U; var_out++ )
+ {
+ UL_var1 <<= 1;
+ }
+ }
+ BASOP_CHECK();
+
+ return ( var_out );
+}
+
+
+/*---------------------------------------------------------------------
+ * sum_s()
+ * sum_l()
+ *
+ *---------------------------------------------------------------------*/
+
+/*! r: sum of all vector elements */
+Word16 sum_s(
+ const Word16 *vec, /* i : input vector */
+ const Word16 lvec /* i : length of input vector */
+)
+{
+ Word16 i;
+ Word16 tmp;
+
+ tmp = 0;
+ for ( i = 0; i < lvec; i++ )
+ {
+ tmp += vec[i];
+ }
+
+ return tmp;
+}
+
+/*! r: sum of all vector elements */
+Word32 sum_l_fx(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec /* i : length of input vector */
+)
+{
+ Word16 i;
+ Word32 tmpL;
+
+ tmpL = 0;
+ move32();
+ FOR( i = 0; i < lvec; i++ )
+ {
+ tmpL = L_add( tmpL, vec[i] );
+ }
+
+ return tmpL;
+}
+
+/*----------------------------------------------------------------------
+ * sum2_f()
+ *
+ *---------------------------------------------------------------------*/
+
+/*! r: sum of all squared vector elements */
+Word32 sum2_f_16_fx(
+ const Word16 *vec, /* i : input vector */
+ const Word16 lvec /* i : length of input vector */
+)
+{
+ Word16 i;
+ Word32 tmp;
+
+ tmp = 0;
+ move32();
+ FOR( i = 0; i < lvec; i++ )
+ {
+ tmp = L_add( tmp, L_mult0( vec[i], vec[i] ) );
+ }
+
+ return tmp;
+}
+Word32 sum2_f_16_gb_fx(
+ const Word16 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 gb )
+{
+ Word16 i;
+ Word32 tmp;
+
+ tmp = 0;
+ FOR( i = 0; i < lvec; i++ )
+ {
+ tmp = L_add( tmp, L_shr( L_mult0( vec[i], vec[i] ), gb ) );
+ }
+
+ return tmp;
+}
+
+
+Word32 sum2_16_exp_fx(
+ const Word16 *vec, /* i : input vector Q(15 - exp) */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 *exp, /* i/o: exponent of vector */
+ Word16 gb /* i : guard bits */
+)
+{
+ Word16 i, s;
+ Word32 L_tmp, var_a;
+
+ L_tmp = 0;
+ move32();
+ var_a = 0;
+ move32();
+ FOR( i = 0; i < lvec; i++ )
+ {
+ var_a = L_mult0( vec[i], vec[i] ); /* 2 * Q(15 - exp) */
+ L_tmp = L_add( L_tmp, L_shr( var_a, gb ) ); /* 2 * Q(15 - exp) - gb */
+ }
+
+ s = norm_l( L_tmp );
+ L_tmp = L_shl( L_tmp, s ); /* 2 * Q(15 - exp) - gb + s */
+
+ *exp = add( sub( add( shl( *exp, 1 ), gb ), s ), 1 );
+ move16();
+
+ return L_tmp;
+}
+
+
+Word32 sum2_32_exp_fx(
+ const Word32 *vec, /* i : input vector, Qx */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 *exp, /* i/o: exponent of vector */
+ Word16 gb /* i : guard bits */
+)
+{
+ Word16 i, s, norm;
+ Word64 W_tmp;
+
+ W_tmp = 0;
+ Word64 var_a = 0;
+ move64();
+ move64();
+
+ norm = L_norm_arr( vec, lvec );
+
+ gb = sub( gb, norm );
+
+ FOR( i = 0; i < lvec; i++ )
+ {
+ var_a = W_mult0_32_32( vec[i], vec[i] ); // 2x
+ W_tmp = W_add( W_tmp, W_shr( var_a, gb ) ); // 2x-gb
+ }
+
+ s = W_norm( W_tmp );
+ W_tmp = W_shl( W_tmp, s ); // 2x - gb + s
+
+ //*exp = 31 - (2*(31 - *exp) - gb + s) + 32;
+ *exp = add( sub( add( shl( *exp, 1 ), gb ), s ), 1 );
+ move16();
+
+ return W_extract_h( W_tmp );
+}
+
+
+/* o : Q(2x - 31 - gb) */
+Word32 sum2_f_32_fx(
+ const Word32 *vec, /* i : input vector, Qx */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 gb /* i : guard bits */
+)
+{
+ Word16 i;
+ Word32 tmp;
+
+ tmp = 0;
+ Word32 var_a = 0;
+ move32();
+ move32();
+ FOR( i = 0; i < lvec; i++ )
+ {
+ var_a = Mpy_32_32( vec[i], vec[i] ); // 2x-31
+ tmp = L_add( tmp, L_shr( var_a, gb ) ); // 2x-31-gb
+ }
+
+ return tmp;
+}
+
+Word32 sum2_32_fx(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 *e )
+{
+ Word16 i;
+ Word32 tmp;
+
+ tmp = 0;
+ Word32 var_a = 0;
+ Word16 exp = 0, exp_tmp;
+ move32();
+ move32();
+ move16();
+ FOR( i = 0; i < lvec; i++ )
+ {
+ exp_tmp = norm_l( vec[i] );
+ var_a = L_shl( vec[i], exp_tmp );
+ var_a = Mpy_32_32( var_a, var_a );
+ exp_tmp = shl( sub( *e, exp_tmp ), 1 );
+ tmp = BASOP_Util_Add_Mant32Exp( tmp, exp, var_a, exp_tmp, &exp );
+ }
+ *e = exp;
+ move16();
+
+ return tmp;
+}
+
+
+/*-------------------------------------------------------------------*
+ * set_c()
+ * set_s()
+ * set_l()
+ * set_d()
+ *
+ * Set the vector elements to a value
+ *-------------------------------------------------------------------*/
+
+void set_c(
+ Word8 y[], /* i/o: Vector to set */
+ const Word8 a, /* i : Value to set the vector to */
+ const Word32 N /* i : Length of the vector */
+)
+{
+ Word16 i;
+
+ for ( i = 0; i < N; i++ )
+ {
+ y[i] = a;
+ }
+
+ return;
+}
+
+
+void set_s(
+ Word16 y[], /* i/o: Vector to set */
+ const Word16 a, /* i : Value to set the vector to */
+ const Word16 N /* i : Length of the vector */
+)
+{
+ Word16 i;
+
+ for ( i = 0; i < N; i++ )
+ {
+ y[i] = a;
+ }
+
+ return;
+}
+
+
+void set_l(
+ Word32 y[], /* i/o: Vector to set */
+ const Word32 a, /* i : Value to set the vector to */
+ const Word16 N /* i : Length of the vector */
+)
+{
+ Word16 i;
+
+ for ( i = 0; i < N; i++ )
+ {
+ y[i] = a;
+ }
+
+ return;
+}
+
+/*---------------------------------------------------------------------*
+ * set_zero()
+ *
+ * Set a vector vec[] of dimension lvec to zero
+ *---------------------------------------------------------------------*/
+
+void set_zero(
+ float *vec, /* o : input vector */
+ const Word16 lvec /* i : length of the vector */
+)
+{
+ Word16 i;
+
+ for ( i = 0; i < lvec; i++ )
+ {
+ *vec++ = 0.0f;
+ }
+
+ return;
+}
+
+
+/*---------------------------------------------------------------------*
+ * mvr2r()
+ * mvs2s()
+ * mvr2d()
+ * mvd2r()
+ *
+ * Transfer the contents of vector x[] to vector y[]
+ *---------------------------------------------------------------------*/
+
+void mvr2r(
+ const float x[], /* i : input vector */
+ float y[], /* o : output vector */
+ const Word16 n /* i : vector size */
+)
+{
+ Word16 i;
+
+ if ( n <= 0 )
+ {
+ /* cannot transfer vectors with size 0 */
+ return;
+ }
+
+ if ( y < x )
+ {
+ for ( i = 0; i < n; i++ )
+ {
+ y[i] = x[i];
+ }
+ }
+ else
+ {
+ for ( i = n - 1; i >= 0; i-- )
+ {
+ y[i] = x[i];
+ }
+ }
+
+ return;
+}
+
+void mvs2s(
+ const Word16 x[], /* i : input vector */
+ Word16 y[], /* o : output vector */
+ const Word16 n /* i : vector size */
+)
+{
+ Word16 i;
+
+ if ( n <= 0 )
+ {
+ /* cannot transfer vectors with size 0 */
+ return;
+ }
+
+ if ( y < x )
+ {
+ for ( i = 0; i < n; i++ )
+ {
+ y[i] = x[i];
+ }
+ }
+ else
+ {
+ for ( i = n - 1; i >= 0; i-- )
+ {
+ y[i] = x[i];
+ }
+ }
+
+ return;
+}
+
+void mvl2l(
+ const Word32 x[], /* i : input vector */
+ Word32 y[], /* o : output vector */
+ const Word16 n /* i : vector size */
+)
+{
+ Word16 i;
+
+ if ( n <= 0 )
+ {
+ /* no need to transfer vectors with size 0 */
+ return;
+ }
+
+ if ( y < x )
+ {
+ for ( i = 0; i < n; i++ )
+ {
+ y[i] = x[i];
+ }
+ }
+ else
+ {
+ for ( i = n - 1; i >= 0; i-- )
+ {
+ y[i] = x[i];
+ }
+ }
+
+ return;
+}
+
+/*! r: index of the maximum value in the input vector */
+Word16 maximum_s(
+ const Word16 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 *max /* o : maximum value in the input vector */
+)
+{
+ Word16 i, ind;
+ Word16 tmp;
+
+ ind = 0;
+ move16();
+ tmp = vec[0];
+ move16();
+
+ FOR( i = 1; i < lvec; i++ )
+ {
+ IF( GT_16( vec[i], tmp ) )
+ {
+ ind = i;
+ move16();
+ tmp = vec[i];
+ move16();
+ }
+ }
+
+ if ( max != NULL )
+ {
+ *max = tmp;
+ move16();
+ }
+
+ return ind;
+}
+
+/*! r: index of the maximum value in the input vector */
+Word16 maximum_l(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word32 *max_val /* o : maximum value in the input vector */
+)
+{
+ Word16 i, ind;
+ Word32 tmp;
+
+ ind = 0;
+ tmp = vec[0];
+ move16();
+ move32();
+ FOR( i = 1; i < lvec; i++ )
+ {
+ IF( GT_32( vec[i], tmp ) )
+ {
+ ind = i;
+ tmp = vec[i];
+ move16();
+ move32();
+ }
+ }
+
+ if ( max_val != NULL )
+ {
+ *max_val = tmp;
+ move32();
+ }
+
+ return ind;
+}
+
+/*! r: index of the maximum value in the input vector */
+Word16 maximumAbs_l(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word32 *max_val /* o : maximum value in the input vector */
+)
+{
+ Word16 j, ind;
+ Word32 tmp;
+
+ ind = 0;
+ move16();
+ tmp = L_abs( vec[0] );
+
+ FOR( j = 1; j < lvec; j++ )
+ {
+ IF( GT_32( L_abs( vec[j] ), tmp ) )
+ {
+ ind = j;
+ move16();
+ tmp = L_abs( vec[j] );
+ }
+ }
+
+ IF( max_val != NULL )
+ {
+ *max_val = tmp;
+ move32();
+ }
+
+ return ind;
+}
+
+/*-------------------------------------------------------------------*
+ * minimum_s()
+ *
+ * Finds minimum 16-bit signed integer value in the array and returns it.
+ *-------------------------------------------------------------------*/
+
+/*! r: index of the minimum value in the input vector */
+Word16 minimum_s(
+ const Word16 *vec, /* i : Input vector */
+ const Word16 lvec, /* i : Vector length */
+ Word16 *min_val /* o : minimum value in the input vector */
+)
+{
+ Word16 i, ind;
+
+ ind = 0;
+ move16();
+
+ FOR( i = 1; i < lvec; i++ )
+ {
+ if ( LT_16( vec[i], vec[ind] ) )
+ {
+ ind = i;
+ move16();
+ }
+ }
+
+ if ( min_val != NULL )
+ {
+ *min_val = vec[ind];
+ move16();
+ }
+
+ return ind;
+}
+
+/*-------------------------------------------------------------------*
+ * minimum_l()
+ *
+ * Finds minimum 16-bit signed integer value in the array and returns it.
+ *-------------------------------------------------------------------*/
+
+/*! r: index of the minimum value in the input vector */
+Word16 minimum_l(
+ const Word32 *vec, /* i : Input vector */
+ const Word16 lvec, /* i : Vector length */
+ Word32 *min_val /* o : minimum value in the input vector */
+)
+{
+ Word16 i, ind;
+
+ ind = 0;
+ move16();
+
+ FOR( i = 1; i < lvec; i++ )
+ {
+ if ( LT_32( vec[i], vec[ind] ) )
+ {
+ ind = i;
+ move16();
+ }
+ }
+
+ if ( min_val != NULL )
+ {
+ *min_val = vec[ind];
+ move32();
+ }
-#include
-#include
-#include
-#include "options.h"
-#include "stl.h"
-#include
-#include "cnst.h"
-#include "prot_fx.h"
-#include "basop_util.h"
-#include "basop32.h"
-#include "wmc_auto.h"
-#include "prot_fx_enc.h"
-#include "ivas_prot_fx.h"
+ return ind;
+}
+
+/*---------------------------------------------------------------------*
+ * dotp()
+ *
+ * Dot product of vector x[] and vector y[]
+ *---------------------------------------------------------------------*/
+
+/*! r: dot product of x[] and y[] */
+Word32 dotp_fixed(
+ const Word32 x[], /* i : vector x[] Qx */
+ const Word32 y[], /* i : vector y[] Qy */
+ const Word16 n /* i : vector length */
+)
+{
+ Word16 i;
+ Word32 suma;
+
+ suma = Mpy_32_32( x[0], y[0] );
+
+ FOR( i = 1; i < n; i++ )
+ {
+ suma = L_add( suma, Mpy_32_32( x[i], y[i] ) );
+ }
+
+ return suma;
+}
+
+/*To calculate dot product of two 32 bit arrays in case of overflow*/
+Word32 dotp_fixed_o(
+ const Word32 x[], /* i : vector x[] */
+ const Word32 y[], /* i : vector y[] */
+ const Word16 n, /* i : vector length */
+ const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */
+ Word16 *res_q /*stores resultant Q*/
+)
+{
+ Word16 i;
+ Word64 suma; /*resultant q= q(x)+q(y)-9-x such that q<=31*/
+
+ suma = W_shr( W_mult_32_32( x[0], y[0] ), log_len );
+
+ FOR( i = 1; i < n; i++ )
+ {
+ suma = W_add( suma, W_shr( W_mult_32_32( x[i], y[i] ), log_len ) );
+ }
+ *res_q = add( sub( *res_q, log_len ), 1 );
+ move16();
+ test();
+ test();
+ FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); )
+ {
+ suma = W_shr( suma, 1 );
+ *res_q = sub( *res_q, 1 );
+ move16();
+ }
+
+ return W_extract_l( suma );
+}
+
+
+Word32 dotp_fixed_32(
+ const Word32 x[], /* i : vector x[] */
+ const Word32 y[], /* i : vector y[] */
+ const Word16 n, /* i : vector length */
+ const Word16 log_len, /* i : max factor added to result q after dot product (equal to log2(n)) */
+ Word16 *res_q /*stores resultant Q*/
+)
+{
+ Word16 i;
+ Word64 suma; /*resultant q= q(x)+q(y)-9-x such that q<=31*/
+
+ suma = W_shr( W_mult_32_32( x[0], y[0] ), log_len );
+
+ FOR( i = 1; i < n; i++ )
+ {
+ suma = W_add( suma, W_shr( W_mult_32_32( x[i], y[i] ), log_len ) );
+ }
+ *res_q = add( *res_q, add( sub( *res_q, log_len ), 1 ) );
+ move16();
+ test();
+ test();
+ FOR( ; ( suma > MAX_32 ) || ( suma < MIN_32 ) || ( *res_q > 31 ); )
+ {
+ suma = W_shr( suma, 1 );
+ *res_q = sub( *res_q, 1 );
+ move16();
+ }
+ return W_extract_l( suma );
+}
+
+
+/*-------------------------------------------------------------------*
+ * v_add_w64()
+ *
+ * Subtraction of two vectors sample by sample
+ *-------------------------------------------------------------------*/
+
+void v_add_w64(
+ const Word64 x1[], /* i : Input vector 1 */
+ const Word64 x2[], /* i : Input vector 2 */
+ Word64 y[], /* o : Output vector that contains vector 1 - vector 2 */
+ const Word16 N, /* i : Vector length */
+ const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */
+)
+{
+ Word16 i;
+
+ FOR( i = 0; i < N; i++ )
+ {
+ y[i] = W_add( W_shr( x1[i], hdrm ), W_shr( x2[i], hdrm ) );
+ move64();
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * v_sub_fixed()
+ *
+ * Subtraction of two vectors sample by sample
+ *-------------------------------------------------------------------*/
+
+void v_sub_fixed(
+ const Word32 x1[], /* i : Input vector 1 */
+ const Word32 x2[], /* i : Input vector 2 */
+ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */
+ const Word16 N, /* i : Vector length */
+ const Word16 hdrm /* i : headroom for when subtraction result > 1 or < -1 */
+)
+{
+ Word16 i;
+
+ FOR( i = 0; i < N; i++ )
+ {
+ y[i] = L_sub( L_shr( x1[i], hdrm ), L_shr( x2[i], hdrm ) );
+ move32();
+ }
+
+ return;
+}
+
+void v_sub_fixed_no_hdrm(
+ const Word32 x1[], /* i : Input vector 1 */
+ const Word32 x2[], /* i : Input vector 2 */
+ Word32 y[], /* o : Output vector that contains vector 1 - vector 2 */
+ const Word16 N /* i : Vector length */
+)
+{
+ Word16 i;
+
+ FOR( i = 0; i < N; i++ )
+ {
+ y[i] = L_sub( x1[i], x2[i] );
+ move32();
+ }
+
+ return;
+}
+
+/*-------------------------------------------------------------------*
+ * v_multc_fixed()
+ *
+ * Multiplication of vector by constant
+ *-------------------------------------------------------------------*/
+
+void v_multc_fixed(
+ const Word32 x[], /* i : Input vector */
+ const Word32 c, /* i : Constant */
+ Word32 y[], /* o : Output vector that contains c*x */
+ const Word16 N /* i : Vector length */
+)
+{
+ Word16 i;
+
+ FOR( i = 0; i < N; i++ )
+ {
+ y[i] = Mpy_32_32( c, x[i] );
+ move32();
+ }
+
+ return;
+}
+
+void v_multc_fixed_16(
+ const Word32 x[], /* i : Input vector */
+ const Word16 c, /* i : Constant */
+ Word32 y[], /* o : Output vector that contains c*x */
+ const Word16 N /* i : Vector length */
+)
+{
+ Word16 i;
+
+ FOR( i = 0; i < N; i++ )
+ {
+ y[i] = Mpy_32_16_1( x[i], c );
+ move32();
+ }
+
+ return;
+}
+
+void v_multc_fixed_16_16(
+ const Word16 x[], /* i : Input vector */
+ const Word16 c, /* i : Constant */
+ Word16 y[], /* o : Output vector that contains c*x */
+ const Word16 N /* i : Vector length */
+)
+{
+ Word16 i;
+
+ FOR( i = 0; i < N; i++ )
+ {
+ y[i] = mult_r( x[i], c );
+ move16();
+ }
+
+ return;
+}
+
+/*-------------------------------------------------------------------*
+ * usdequant()
+ *
+ * Uniform scalar de-quantizer routine
+ *
+ * Applies de-quantization based on scale and round operations.
+ *-------------------------------------------------------------------*/
+
+float usdequant(
+ const Word16 idx, /* i : quantizer index */
+ const float qlow, /* i : lowest codebook entry (index 0) */
+ const float delta /* i : quantization step */
+)
+{
+ float g;
+
+ g = idx * delta + qlow;
+
+ return ( g );
+}
+
+void sort(
+ UWord16 *x, /* i/o: Vector to be sorted */
+ UWord16 len /* i/o: vector length */
+)
+{
+ Word16 i;
+ UWord16 j, tempr;
+
+ FOR( i = len - 2; i >= 0; i-- )
+ {
+ tempr = x[i];
+ move16();
+ FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ )
+ {
+ test();
+ x[j - 1] = x[j];
+ move16();
+ }
+ x[j - 1] = tempr;
+ move16();
+ }
-#define INV_BANDS10 3277 /* 1/10 in Q15 */
-#define INV_BANDS9 3641 /* 1/9 in Q15 */
-#define INV_BANDS3 10923 /* 1/9 in Q15 */
-const Word16 b_hp400_fx[3] = { 3660, -7320, 3660 }; /* Q12 (/4) */
-const Word16 a_hp400_fx[3] = { 16384, 29280, -14160 };
-const Word16 a_hp400_ivas_fx[3] = { 4096, 7320, -3540 }; /*Q12*/
+ return;
+}
#define WMC_TOOL_SKIP
@@ -78,14 +944,18 @@ Word32 float_to_fix( float number, Word32 Q )
return ret;
}
-float fix_to_float( Word32 number, Word32 Q )
+float fix_to_float(
+ Word32 number,
+ Word32 Q )
{
assert( Q >= 0 );
float ret = (float) number / ( (UWord32) 1 << Q );
return ret;
}
-Word16 float_to_fix16( float number, Word16 Q )
+Word16 float_to_fix16(
+ float number,
+ Word16 Q )
{
assert( Q >= 0 );
IF( isnan( number ) )
@@ -241,6 +1111,7 @@ void fix2f_16( Word16 *var_fix, float *var_flt, Word32 expo )
#undef WMC_TOOL_SKIP
+
/*-------------------------------------------------------------------*
* usdequant_fx()
*
@@ -248,10 +1119,12 @@ void fix2f_16( Word16 *var_fix, float *var_flt, Word32 expo )
*
* Applies de-quantization based on scale and round operations.
*-------------------------------------------------------------------*/
-Word16 usdequant_fx( /* Qx*/
- const Word16 idx, /* i: quantizer index Q0*/
- const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
- const Word16 delta /* i: quantization step Qx-1*/
+
+/* Qx*/
+Word16 usdequant_fx(
+ const Word16 idx, /* i: quantizer index Q0*/
+ const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
+ const Word16 delta /* i: quantization step Qx-1*/
)
{
Word16 g;
@@ -264,10 +1137,11 @@ Word16 usdequant_fx( /* Qx*/
return ( g );
}
-Word32 usdequant32_fx( /* Qx*/
- const Word16 idx, /* i: quantizer index Q0*/
- const Word32 qlow, /* i: lowest codebook entry (index 0) Qx*/
- const Word32 delta /* i: quantization step Qx-1*/
+/* Qx*/
+Word32 usdequant32_fx(
+ const Word16 idx, /* i: quantizer index Q0*/
+ const Word32 qlow, /* i: lowest codebook entry (index 0) Qx*/
+ const Word32 delta /* i: quantization step Qx-1*/
)
{
Word32 g;
@@ -288,6 +1162,7 @@ Word32 usdequant32_fx( /* Qx*/
return ( g );
}
+
/*-------------------------------------------------------------------*
* usquant()
*
@@ -297,29 +1172,34 @@ Word32 usdequant32_fx( /* Qx*/
* Applies quantization based on scale and round operations.
* Index of the winning codeword and the winning codeword itself are returned.
*-------------------------------------------------------------------*/
-Word16 usquant_fx( /* o: index of the winning codeword */
- const Word16 x, /* i: scalar value to quantize Qx*/
- Word16 *xq, /* o: quantized value Qx*/
- const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
- const Word16 delta, /* i: quantization step Qx-1*/
- const Word16 cbsize /* i: codebook size */
+
+/* o: index of the winning codeword */
+Word16 usquant_fx(
+ const Word16 x, /* i: scalar value to quantize Qx*/
+ Word16 *xq, /* o: quantized value Qx*/
+ const Word16 qlow, /* i: lowest codebook entry (index 0) Qx*/
+ const Word16 delta, /* i: quantization step Qx-1*/
+ const Word16 cbsize /* i: codebook size */
)
{
Word16 idx;
Word16 tmp, exp;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* idx = (short)( (x - qlow)/delta + 0.5f); */
exp = norm_s( delta );
- tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */
- L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */
-#ifdef ISSUE_1796_replace_shl_o
+ tmp = div_s( shl( 1, sub( 14, exp ) ), delta ); /*Q(29-exp-(Qx-1))->Q(30-exp-Qx) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mult( sub_sat( x, qlow ), tmp ); /*Q(31-exp) */
idx = extract_l( L_shr_r( L_add( L_tmp, shl_sat( 1, sub( 30, exp ) ) ), sub( 31, exp ) ) ); /*Q0 */
#else
+ L_tmp = L_mult( sub_o( x, qlow, &Overflow ), tmp ); /*Q(31-exp) */
idx = extract_l( L_shr_r( L_add( L_tmp, shl_o( 1, sub( 30, exp ), &Overflow ) ), sub( 31, exp ) ) ); /*Q0 */
#endif
@@ -327,21 +1207,28 @@ Word16 usquant_fx( /* o: index of the winning codeword */
idx = s_max( idx, 0 );
/* *xq = idx*delta + qlow; */
- L_tmp = L_deposit_l( qlow ); /*Qx */
- L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */
- *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */
+ L_tmp = L_deposit_l( qlow ); /*Qx */
+ L_tmp = L_mac( L_tmp, idx, delta ); /*Qx */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ *xq = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */
+#else
+ *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */
+#endif
return idx;
}
+
+
/*-------------------------------------------------------------------*
* Dot_product:
*
* Compute scalar product of using accumulator.
* Performs no normalization, as opposed to Dot_product12()
*-------------------------------------------------------------------*/
-Word32 Dot_product( /* o : Sum */
- const Word16 x[], /* i : 12bits: x vector */
- const Word16 y[], /* i : 12bits: y vector */
- const Word16 lg /* i : vector length */
+/* o : Sum */
+Word32 Dot_product(
+ const Word16 x[], /* i : 12bits: x vector */
+ const Word16 y[], /* i : 12bits: y vector */
+ const Word16 lg /* i : vector length */
)
{
Word16 i;
@@ -355,19 +1242,23 @@ Word32 Dot_product( /* o : Sum */
L64_sum = W_mac_16_16( L64_sum, x[i], y[i] );
}
L_sum = W_sat_l( L64_sum );
+
return L_sum;
}
+
+
/*---------------------------------------------------------------------*
* dotp_fx()
*
* Dot product of vector x[] and vector y[]
*---------------------------------------------------------------------*/
-Word32 dotp_fx( /* o : dot product of x[] and y[] */
- const Word16 x[], /* i : vector x[] */
- const Word16 y[], /* i : vector y[] */
- const Word16 n, /* i : vector length */
- Word16 *exp /* (o) : exponent of result (0..+30) */
+/* o : dot product of x[] and y[] */
+Word32 dotp_fx(
+ const Word16 x[], /* i : vector x[] */
+ const Word16 y[], /* i : vector y[] */
+ const Word16 n, /* i : vector length */
+ Word16 *exp /* o : exponent of result (0..+30) */
)
{
Word16 sft;
@@ -388,29 +1279,38 @@ Word32 dotp_fx( /* o : dot product of x[] and y[] */
return L_sum;
}
-Word32 sum2_fx( /* o : sum of all squared vector elements Q(2x+1)*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+/* o : sum of all squared vector elements Q(2x+1)*/
+Word32 sum2_fx(
+ const Word16 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
)
{
Word16 i;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
L_tmp = L_deposit_l( 0 );
FOR( i = 0; i < lvec; i++ )
{
- L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */
+#else
+ L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */
+#endif
}
return L_tmp;
}
-Word64 sum2_fx_no_sat( /* o : sum of all squared vector elements Q(2*Qx)*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+
+/* o : sum of all squared vector elements Q(2*Qx)*/
+Word64 sum2_fx_no_sat(
+ const Word16 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
)
{
Word16 i;
@@ -449,32 +1349,42 @@ Word32 sum_32_fx(
return ans;
}
-Word32 sum2_fx_mod( /* o : sum of all squared vector elements Q(2x+1 -5)*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+/* o : sum of all squared vector elements Q(2x+1 -5)*/
+Word32 sum2_fx_mod(
+ const Word16 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
)
{
Word16 i;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
L_tmp = L_deposit_l( 0 );
FOR( i = 0; i < lvec; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_add_sat( L_tmp, L_shr( L_mult_sat( vec[i], vec[i] ), 9 ) );
+#else
L_tmp = L_add_o( L_tmp, L_shr( L_mult_o( vec[i], vec[i], &Overflow ), 9 ), &Overflow );
+#endif
}
return L_tmp;
}
+
+
/*-------------------------------------------------------------------*
* Copy:
*
* Copy vector x[] to y[]
*
*-------------------------------------------------------------------*/
+
void Copy(
const Word16 x[], /* i : input vector */
Word16 y[], /* o : output vector */
@@ -503,11 +1413,14 @@ void Copy(
return;
}
+
+
/*-------------------------------------------------------------------*
* Copy64:
*
* Copy vector x[] to y[] (64 bits)
*-------------------------------------------------------------------*/
+
void Copy64(
const Word64 x[], /* i : input vector */
Word64 y[], /* o : output vector */
@@ -631,12 +1544,14 @@ void set8_fx(
return;
}
+
/*-------------------------------------------------------------------*
* set16_fx()
* set32_fx()
*
* Set the vector elements to a value
*-------------------------------------------------------------------*/
+
void set16_fx(
Word16 y[], /* i/o: Vector to set */
const Word16 a, /* i : Value to set the vector to */
@@ -670,11 +1585,14 @@ void set32_fx(
return;
}
+
+
/*-------------------------------------------------------------------*
* Copy_Scale_sig
*
* Up/down scale a 16 bits vector x and move it into y
*-------------------------------------------------------------------*/
+
void Copy_Scale_sig(
const Word16 x[], /* i : signal to scale input Qx */
Word16 y[], /* o : scaled signal output Qx */
@@ -684,7 +1602,7 @@ void Copy_Scale_sig(
{
Word16 i;
Word16 tmp;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -711,19 +1629,24 @@ void Copy_Scale_sig(
}
FOR( i = 0; i < lg; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
y[i] = shl_sat( x[i], exp0 );
#else
y[i] = shl_o( x[i], exp0, &Overflow );
#endif
move16(); /* saturation can occur here */
}
+
+ return;
}
+
+
/*-------------------------------------------------------------------*
* Copy_Scale_sig
*
* Up/down scale a 16 bits vector x and move it into y
*-------------------------------------------------------------------*/
+
void Copy_Scale_sig_16_32_DEPREC(
const Word16 x[], /* i : signal to scale input Qx */
Word32 y[], /* o : scaled signal output Qx */
@@ -733,7 +1656,7 @@ void Copy_Scale_sig_16_32_DEPREC(
{
Word16 i;
Word16 tmp;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -755,7 +1678,7 @@ void Copy_Scale_sig_16_32_DEPREC(
/*Should not happen */
FOR( i = 0; i < lg; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
y[i] = L_deposit_l( shl_sat( x[i], exp0 ) );
#else
y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) );
@@ -772,7 +1695,7 @@ void Copy_Scale_sig_16_32_DEPREC(
#else
assert( exp0 < 16 );
#endif
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
tmp = shl_sat( 1, exp0 );
#else
tmp = shl_o( 1, exp0, &Overflow );
@@ -782,7 +1705,25 @@ void Copy_Scale_sig_16_32_DEPREC(
y[i] = L_mult0( x[i], tmp );
move32(); /* saturation can occur here */
}
+
+ return;
+}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+void Copy_Scale_sig_16_32_r(
+ const Word16 x[], /* i : signal to scale input Qx */
+ Word32 y[], /* o : scaled signal output Qx */
+ const Word16 lg, /* i : size of x[] Q0 */
+ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
+)
+{
+ Word16 i;
+ for ( i = 0; i < lg; i++ )
+ {
+ y[i] = L_shl_r( L_deposit_l( x[i] ), exp0 );
+ }
}
+#endif
void Copy_Scale_sig_16_32_no_sat(
const Word16 x[], /* i : signal to scale input Qx */
@@ -793,10 +1734,12 @@ void Copy_Scale_sig_16_32_no_sat(
{
Word16 i;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
IF( exp0 == 0 )
@@ -813,7 +1756,7 @@ void Copy_Scale_sig_16_32_no_sat(
/*Should not happen */
FOR( i = 0; i < lg; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
y[i] = L_deposit_l( shl_sat( x[i], exp0 ) );
#else
y[i] = L_deposit_l( shl_o( x[i], exp0, &Overflow ) );
@@ -822,7 +1765,11 @@ void Copy_Scale_sig_16_32_no_sat(
}
return;
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( 1, exp0 - 1 );
+#else
L_tmp = L_shl_o( 1, exp0 - 1, &Overflow );
+#endif
IF( L_tmp >= 0x7FFF )
{
@@ -843,8 +1790,11 @@ void Copy_Scale_sig_16_32_no_sat(
move32();
}
}
+
+ return;
}
+
void Copy_Scale_sig_32_16(
const Word32 x[], /* i : signal to scale input Qx */
Word16 y[], /* o : scaled signal output Qx */
@@ -854,9 +1804,11 @@ void Copy_Scale_sig_32_16(
{
Word16 i;
Word16 tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
tmp = add( 16, exp0 );
@@ -864,7 +1816,11 @@ void Copy_Scale_sig_32_16(
{
FOR( i = 0; i < lg; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[i] = round_fx_sat( L_shl_sat( x[i], tmp ) );
+#else
y[i] = round_fx_o( L_shl_o( x[i], tmp, &Overflow ), &Overflow );
+#endif
move16();
}
}
@@ -872,17 +1828,25 @@ void Copy_Scale_sig_32_16(
{
FOR( i = 0; i < lg; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[i] = round_fx_sat( x[i] );
+#else
y[i] = round_fx_o( x[i], &Overflow );
+#endif
move16();
}
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* Scale_sig32
*
* Up/down scale a 32 bits vector
*-------------------------------------------------------------------*/
+
void Scale_sig32(
Word32 x[], /* i/o: signal to scale Qx */
const Word16 lg, /* i : size of x[] Q0 */
@@ -890,9 +1854,11 @@ void Scale_sig32(
)
{
Word16 i;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
IF( 0 == exp0 )
{
@@ -901,11 +1867,18 @@ void Scale_sig32(
FOR( i = 0; i < lg; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ x[i] = L_shl_sat( x[i], exp0 );
+#else
x[i] = L_shl_o( x[i], exp0, &Overflow );
+#endif
move32(); /* saturation can occur here */
}
+
+ return;
}
+
/*------------------------------------------------------------------*
* function Random_Fill
*
@@ -913,6 +1886,7 @@ void Scale_sig32(
* (Avoids Store of Seed to Memory for 'n' Random Values and
* Combines Scaling Operation.)
*------------------------------------------------------------------*/
+
void Random_Fill(
Word16 *seed, /* i/o: random seed */
Word16 n, /* i : number of values */
@@ -933,11 +1907,16 @@ void Random_Fill(
}
*seed = local_seed;
move16();
+
+ return;
}
+
+
/*-------------------------------------------------------------------*
* Scale_sig
* Up/down scale a 16 bits vector
*-------------------------------------------------------------------*/
+
void Scale_sig(
Word16 x[], /* i/o: signal to scale Qx */
const Word16 lg, /* i : size of x[] Q0 */
@@ -968,10 +1947,12 @@ void Scale_sig(
}
}
+
/*-------------------------------------------------------------------*
* scale_sig
* Up/down scale a 16 bits vector
*-------------------------------------------------------------------*/
+
void scale_sig(
Word16 x[], /* i/o: signal to scale Qx */
const Word16 lg, /* i : size of x[] Q0 */
@@ -994,9 +1975,11 @@ void scale_sig(
* mean_fx()
*
*---------------------------------------------------------------------*/
-Word16 mean_fx( /* o : mean of vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 lvec_fx /* i : length of input vector */
+
+/* o : mean of vector */
+Word16 mean_fx(
+ const Word16 *vec_fx, /* i : input vector */
+ const Word16 lvec_fx /* i : length of input vector */
)
{
Word16 tmp;
@@ -1007,9 +1990,10 @@ Word16 mean_fx( /* o : mean of vector
return tmp;
}
-Word16 mean_no_sat_fx( /* o : mean of vector Qx */
- const Word16 *vec_fx, /* i : input vector Qx */
- const Word16 lvec_fx /* i : length of input vector */
+/* o : mean of vector Qx */
+Word16 mean_no_sat_fx(
+ const Word16 *vec_fx, /* i : input vector Qx */
+ const Word16 lvec_fx /* i : length of input vector */
)
{
Word16 i;
@@ -1023,10 +2007,12 @@ Word16 mean_no_sat_fx( /* o : mean of vector Qx *
return extract_l( L_tmp );
}
-Word32 mean_no_sat_Word32_fx( /* o : mean of vector Qx */
- const Word32 *vec_fx, /* i : input vector Qx */
- const Word16 lvec_fx, /* i : length of input vector */
- const Word16 gb )
+
+/* o : mean of vector Qx */
+Word32 mean_no_sat_Word32_fx(
+ const Word32 *vec_fx, /* i : input vector Qx */
+ const Word16 lvec_fx, /* i : length of input vector */
+ const Word16 gb )
{
Word16 i;
Word32 L_tmp = 0;
@@ -1039,11 +2025,14 @@ Word32 mean_no_sat_Word32_fx( /* o : mean of vector
return L_tmp;
}
+
+
/*-------------------------------------------------------------------*
* Vr_add
*
* Add two Word16 vectors together integer by integer
*-------------------------------------------------------------------*/
+
void Vr_add(
const Word16 *in1, /* i : Input vector 1 */
const Word16 *in2, /* i : Input vector 2 */
@@ -1088,6 +2077,8 @@ void sort_fx(
r[j - 1] = tempr;
move16();
}
+
+ return;
}
void sort_32_fx(
@@ -1119,10 +2110,11 @@ void sort_32_fx(
return;
}
-Word16 minimum_fx( /* o : index of the minimum value in the input vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word16 *min_fx /* o : minimum value in the input vector */
+/* o : index of the minimum value in the input vector */
+Word16 minimum_fx(
+ const Word16 *vec_fx, /* i : input vector */
+ const Word16 lvec_fx, /* i : length of input vector */
+ Word16 *min_fx /* o : minimum value in the input vector */
)
{
Word16 j, ind;
@@ -1149,10 +2141,11 @@ Word16 minimum_fx( /* o : index of the minimum value in t
return ind;
}
-Word16 maximum_fx( /* o : index of the maximum value in the input vector */
- 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 */
+/* o : index of the maximum value in the input vector */
+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 */
)
{
Word16 j, ind;
@@ -1177,11 +2170,38 @@ Word16 maximum_fx( /* o : index of the maximum value in t
return ind;
}
-Word16 maximum_exp_fx( /* o : index of the maximum value in the input vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 *exp_vec, /* i : exponents of input vector */
- const Word16 lvec_fx /* i : length of input vector */
+/* o : index of the maximum value in the input vector */
+Word16 maximum_exp_fx(
+ const Word16 *vec_fx, /* i : input vector */
+ const Word16 *exp_vec, /* i : exponents of input vector */
+ const Word16 lvec_fx /* i : length of input vector */
)
+#ifdef FIX_1981_MAXIMUM_EXP_FX
+{
+ Word16 j, ind;
+ ind = 0;
+ move16();
+
+ FOR( j = 1; j < lvec_fx; j++ )
+ {
+ Word16 scale = sub( exp_vec[j], exp_vec[ind] );
+#ifdef FIX_1981_MAXIMUM_EXP_FX_ZEROMANTISSA
+ test();
+ if ( vec_fx[j] == 0 || vec_fx[ind] == 0 )
+ {
+ scale = 0;
+ move16();
+ }
+#endif
+ if ( L_mac0_sat( L_shl_sat( L_deposit_l( vec_fx[j] ), scale ), vec_fx[ind], -0x0001 ) > 0 )
+ {
+ ind = j;
+ move16();
+ }
+ }
+ return ind;
+}
+#else
{
Word16 j, ind;
Word16 tmp, exp;
@@ -1207,6 +2227,8 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
return ind;
}
+#endif
+
/*---------------------------------------------------------------------*
* maximum_abs_16_fx()
@@ -1214,10 +2236,11 @@ Word16 maximum_exp_fx( /* o : index of the maximum value
* Find index and value of the absolute maximum in a vector
*---------------------------------------------------------------------*/
-Word16 maximum_abs_16_fx( /* o : index of the maximum abs value in the input vector */
- const Word16 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word16 *max_val /* o : maximum value in the input vector */
+/* o : index of the maximum abs value in the input vector */
+Word16 maximum_abs_16_fx(
+ const Word16 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word16 *max_val /* o : maximum value in the input vector */
)
{
Word16 j, ind;
@@ -1246,10 +2269,12 @@ Word16 maximum_abs_16_fx( /* o : index of the maximum abs va
*
* Find index and value of the absolute minimum in a vector
*---------------------------------------------------------------------*/
-Word16 minimum_abs32_fx( /* o : index of the minimum value in the input vector */
- const Word32 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word32 *min_fx /* o : minimum value in the input vector */
+
+/* o : index of the minimum value in the input vector */
+Word16 minimum_abs32_fx(
+ const Word32 *vec_fx, /* i : input vector */
+ const Word16 lvec_fx, /* i : length of input vector */
+ Word32 *min_fx /* o : minimum value in the input vector */
)
{
Word16 j, ind;
@@ -1276,16 +2301,18 @@ Word16 minimum_abs32_fx( /* o : index of the minimum valu
return ind;
}
+
/*---------------------------------------------------------------------*
* minimum_32_fx()
*
* Find index and value of the minimum in a vector
*---------------------------------------------------------------------*/
-Word16 minimum_32_fx( /* o : index of the minimum value in the input vector */
- const Word32 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word32 *min_fx /* o : minimum value in the input vector */
+/* o : index of the minimum value in the input vector */
+Word16 minimum_32_fx(
+ const Word32 *vec_fx, /* i : input vector */
+ const Word16 lvec_fx, /* i : length of input vector */
+ Word32 *min_fx /* o : minimum value in the input vector */
)
{
Word16 j, ind;
@@ -1314,16 +2341,18 @@ Word16 minimum_32_fx( /* o : index of the minimum value i
return ind;
}
+
/*---------------------------------------------------------------------*
* maximum_32_fx()
*
* Find index and value of the maximum in a vector
*---------------------------------------------------------------------*/
-Word16 maximum_32_fx( /* o : index of the maximum value in the input vector */
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word32 *max_val /* o : maximum value in the input vector */
+/* o : index of the maximum value in the input vector */
+Word16 maximum_32_fx(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word32 *max_val /* o : maximum value in the input vector */
)
{
Word16 j, ind;
@@ -1351,10 +2380,11 @@ Word16 maximum_32_fx( /* o : index of the maximum value in t
return ind;
}
-Word16 maximum_abs_32_fx( /* o : index of the maximum abs value in the input vector */
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word32 *max_val /* o : maximum value in the input vector */
+/* o : index of the maximum abs value in the input vector */
+Word16 maximum_abs_32_fx(
+ const Word32 *vec, /* i : input vector */
+ const Word16 lvec, /* i : length of input vector */
+ Word32 *max_val /* o : maximum value in the input vector */
)
{
Word16 j, ind;
@@ -1385,6 +2415,7 @@ Word16 maximum_abs_32_fx( /* o : index of the maximum abs va
*Return value
*Number of shifts
*----------------------------------------------------------------*/
+
Word16 Exp16Array(
const Word16 n, /* (i): Array size */
const Word16 *sx /* (i): Data array */
@@ -1434,9 +2465,10 @@ Word16 Exp32Array(
return exp;
}
-Word32 sum16_32_fx( /* o : sum of all vector elements Qx*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+/* o : index of the maximum abs value in the input vector */
+Word32 sum16_32_fx(
+ const Word16 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
)
{
Word16 i;
@@ -1452,9 +2484,11 @@ Word32 sum16_32_fx( /* o : sum of all vector elements
return tmp;
}
-Word32 sum32_sat( /* o : sum of all vector elements Qx*/
- const Word32 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+
+/* o : sum of all vector elements Qx*/
+Word32 sum32_sat(
+ const Word32 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
)
{
Word16 i;
@@ -1469,10 +2503,11 @@ Word32 sum32_sat( /* o : sum of all vector elements
return tmp;
}
-Word32 var_fx_32( /* o: variance of vector Qx+16*/
- const Word16 *x, /* i: input vector Qx*/
- const Word16 Qx,
- const Word16 len /* i: length of inputvector */
+/* o: variance of vector Qx+16*/
+Word32 var_fx_32(
+ const Word16 *x, /* i: input vector Qx*/
+ const Word16 Qx,
+ const Word16 len /* i: length of inputvector */
)
{
Word16 m;
@@ -1481,7 +2516,6 @@ Word32 var_fx_32( /* o: variance of vector Q
Word16 tmp, exp, inv_len;
Word32 L_tmp;
-
L_tmp = L_add( x[0], 0 );
FOR( i = 1; i < len; i++ )
{
@@ -1504,11 +2538,12 @@ Word32 var_fx_32( /* o: variance of vector Q
return v;
}
-Word32 var_fx_32in_32out( /* o: variance of vector Qx*/
- const Word32 *x, /* i: input vector Qx*/
- Word16 *Qx, /*i/o:Q for input/output */
- const Word16 len, /* i: length of inputvector */
- const Word16 gb )
+/* o: variance of vector Qx*/
+Word32 var_fx_32in_32out(
+ const Word32 *x, /* i: input vector Qx*/
+ Word16 *Qx, /*i/o:Q for input/output */
+ const Word16 len, /* i: length of inputvector */
+ const Word16 gb )
{
Word16 i;
Word16 shift;
@@ -1527,8 +2562,11 @@ Word32 var_fx_32in_32out( /* o: variance of vector
*Qx = sub( add( shl( sub( *Qx, gb ), 1 ), shift ), 32 );
move16();
+
return L_tmp;
}
+
+
/*-------------------------------------------------------------------*
* conv()
*
@@ -1563,9 +2601,11 @@ Flag conv_fx(
y[n] = mac_ro( L_sum, x[i], h[0], &Overflow );
move16();
}
+
return Overflow;
}
+
/*-------------------------------------------------------------------*
* conv_fx_32()
*
@@ -1573,6 +2613,7 @@ Flag conv_fx(
* All vectors are of length L. Only the first L samples of the
* convolution are considered.
*-------------------------------------------------------------------*/
+
Flag conv_fx_32(
const Word16 x[], /* i : input vector Q_new*/
const Word16 h[], /* i : impulse response (or second input vector) Q(15)*/
@@ -1580,7 +2621,6 @@ Flag conv_fx_32(
const Word16 L /* i : vector size */
)
{
-
Word16 i, n;
Word32 L_sum;
Flag Overflow = 0;
@@ -1596,12 +2636,15 @@ Flag conv_fx_32(
y[n] = L_mac_o( L_sum, x[i], h[0], &Overflow );
move32();
}
+
return Overflow;
}
-Word16 var_fx( /* o: variance of vector Qx*/
- const Word16 *x, /* i: input vector Qx*/
- const Word16 Qx,
- const Word16 len /* i: length of inputvector */
+
+/* o: variance of vector Qx*/
+Word16 var_fx(
+ const Word16 *x, /* i: input vector Qx*/
+ const Word16 Qx,
+ const Word16 len /* i: length of inputvector */
)
{
Word16 m;
@@ -1634,15 +2677,17 @@ Word16 var_fx( /* o: variance of vector Qx*/
return v_16;
}
+
/*---------------------------------------------------------------------*
* std_fx()
*
* Calculate the standard deviation of a vector
*---------------------------------------------------------------------*/
-Word16 std_fx( /* o: standard deviation */
- const Word16 x[], /* i: input vector */
- const Word16 len /* i: length of the input vector */
+/* o: standard deviation */
+Word16 std_fx(
+ const Word16 x[], /* i: input vector */
+ const Word16 len /* i: length of the input vector */
)
{
Word16 i;
@@ -1669,14 +2714,14 @@ Word16 std_fx( /* o: standard deviation */
stdev = L_shl( stdev, sub( exp1, 1 ) ); /*30 */
}
-
return extract_h( stdev );
}
-Word32 dot_product_mat_fx( /* o : the dot product x'*A*x */
- const Word16 *x, /* i : vector x Q15 */
- const Word32 *A, /* i : matrix A Q0*/
- const Word16 m /* i : vector & matrix size */
+/* o : the dot product x'*A*x */
+Word32 dot_product_mat_fx(
+ const Word16 *x, /* i : vector x Q15 */
+ const Word32 *A, /* i : matrix A Q0*/
+ const Word16 m /* i : vector & matrix size */
)
{
@@ -1703,13 +2748,17 @@ Word32 dot_product_mat_fx( /* o : the dot product x'*A*x
tmp_sum = W_sat_m( tmp_sum_64 );
suma = Madd_32_16( suma, tmp_sum, x[i] ); /*Q0 */
}
+
return suma;
}
+
+
/*-------------------------------------------------------------------*
* Vr_subt
*
* Subtract two Word16 vectors integer by integer
*-------------------------------------------------------------------*/
+
void Vr_subt(
const Word16 x1[], /* i : Input vector 1 */
const Word16 x2[], /* i : Input vector 2 */
@@ -1724,7 +2773,11 @@ void Vr_subt(
y[i] = sub_sat( x1[i], x2[i] );
move16();
}
+
+ return;
}
+
+
/*-------------------------------------------------------------------*
* vquant()
*
@@ -1733,13 +2786,15 @@ void Vr_subt(
* Searches a given codebook to find the nearest neighbour in Euclidean space.
* Index of the winning codevector and the winning vector itself are returned.
*-------------------------------------------------------------------*/
-Word16 vquant_ivas_fx( /* o: index of the winning codevector */
- Word32 x[], /* i: vector to quantize Q25 */
- const Word32 x_mean[], /* i: vector mean to subtract (0 if none) Q25 */
- Word32 xq[], /* o: quantized vector Q25 */
- const Word32 cb[], /* i: codebook Q25 */
- const Word16 dim, /* i: dimension of codebook vectors */
- const Word16 cbsize /* i: codebook size */
+
+/* o: index of the winning codevector */
+Word16 vquant_ivas_fx(
+ Word32 x[], /* i: vector to quantize Q25 */
+ const Word32 x_mean[], /* i: vector mean to subtract (0 if none) Q25 */
+ Word32 xq[], /* o: quantized vector Q25 */
+ const Word32 cb[], /* i: codebook Q25 */
+ const Word16 dim, /* i: dimension of codebook vectors */
+ const Word16 cbsize /* i: codebook size */
)
{
Word16 c, d, idx, j;
@@ -1803,13 +2858,14 @@ Word16 vquant_ivas_fx( /* o: index of the winning codevec
return idx;
}
-Word16 vquant_fx( /* o: index of the winning codevector */
- Word16 x[], /* i: vector to quantize Q13 */
- const Word16 x_mean[], /* i: vector mean to subtract (0 if none) Q13 */
- Word16 xq[], /* o: quantized vector Q13 */
- const Word16 cb[], /* i: codebook Q13 */
- const Word16 dim, /* i: dimension of codebook vectors */
- const Word16 cbsize /* i: codebook size */
+/* o: index of the winning codevector */
+Word16 vquant_fx(
+ Word16 x[], /* i: vector to quantize Q13 */
+ const Word16 x_mean[], /* i: vector mean to subtract (0 if none) Q13 */
+ Word16 xq[], /* o: quantized vector Q13 */
+ const Word16 cb[], /* i: codebook Q13 */
+ const Word16 dim, /* i: dimension of codebook vectors */
+ const Word16 cbsize /* i: codebook size */
)
{
Word16 tmp;
@@ -1874,6 +2930,7 @@ Word16 vquant_fx( /* o: index of the winning codevector
return idx;
}
+
/*-------------------------------------------------------------------*
* w_vquant_fx()
*
@@ -1883,6 +2940,7 @@ Word16 vquant_fx( /* o: index of the winning codevector
* Weights are put on the error for each vector element.
* Index of the winning codevector and the winning vector itself are returned.
*-------------------------------------------------------------------*/
+
Word16 w_vquant_fx(
Word16 x[], /* i: vector to quantize in Q10 */
Word16 Qx,
@@ -1896,10 +2954,12 @@ Word16 w_vquant_fx(
Word16 tmp;
Word16 c, idx, j;
Word32 dist, minDist;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
idx = 0;
@@ -1916,6 +2976,28 @@ Word16 w_vquant_fx(
{
dist = L_deposit_l( 0 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = sub_sat( x[3], shr( cb[j++], Qx ) );
+ if ( weights[3] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+ tmp = sub_sat( x[2], shr( cb[j++], Qx ) );
+ if ( weights[2] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+ tmp = sub_sat( x[1], shr( cb[j++], Qx ) );
+ if ( weights[1] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+ tmp = sub_sat( x[0], shr( cb[j++], Qx ) );
+ if ( weights[0] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+#else
tmp = sub_o( x[3], shr( cb[j++], Qx ), &Overflow );
if ( weights[3] != 0 )
{
@@ -1936,6 +3018,7 @@ Word16 w_vquant_fx(
{
dist = L_mac0_o( dist, tmp, tmp, &Overflow );
}
+#endif
if ( LT_32( dist, minDist ) )
{
idx = c;
@@ -1965,6 +3048,28 @@ Word16 w_vquant_fx(
{
dist = L_deposit_l( 0 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = sub_sat( x[0], shr( cb[j++], Qx ) );
+ if ( weights[0] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+ tmp = sub_sat( x[1], shr( cb[j++], Qx ) );
+ if ( weights[1] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+ tmp = sub_sat( x[2], shr( cb[j++], Qx ) );
+ if ( weights[2] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+ tmp = sub_sat( x[3], shr( cb[j++], Qx ) );
+ if ( weights[3] != 0 )
+ {
+ dist = L_mac0_sat( dist, tmp, tmp );
+ }
+#else
tmp = sub_o( x[0], shr( cb[j++], Qx ), &Overflow );
if ( weights[0] != 0 )
{
@@ -1985,6 +3090,7 @@ Word16 w_vquant_fx(
{
dist = L_mac0_o( dist, tmp, tmp, &Overflow );
}
+#endif
if ( LT_32( dist, minDist ) )
{
idx = c;
@@ -2011,16 +3117,20 @@ Word16 w_vquant_fx(
return idx;
}
+
+
/*-------------------------------------------------------------------*
* Emaximum:
*
* Find index of a maximum energy in a vector
*-------------------------------------------------------------------*/
-Word16 emaximum_fx( /* o : return index with max energy value in vector Q0 */
- const Word16 Qvec, /* i : Q of input vector Q0 */
- const Word16 *vec, /* i : input vector Qx */
- const Word16 lvec, /* i : length of input vector Q0 */
- Word32 *ener_max /* o : maximum energy value Q0 */
+
+/* o : return index with max energy value in vector Q0 */
+Word16 emaximum_fx(
+ const Word16 Qvec, /* i : Q of input vector Q0 */
+ const Word16 *vec, /* i : input vector Qx */
+ const Word16 lvec, /* i : length of input vector Q0 */
+ Word32 *ener_max /* o : maximum energy value Q0 */
)
{
Word16 j, ind;
@@ -2049,11 +3159,12 @@ Word16 emaximum_fx( /* o : return index with max energy valu
return ind;
}
-Word16 emaximum_32fx( /* o : return index with max energy value in vector Q0 */
- const Word16 Qvec, /* i : Q of input vector Q0 */
- const Word32 *vec, /* i : input vector Qx */
- const Word16 lvec, /* i : length of input vector Q0 */
- Word32 *ener_max /* o : maximum energy value Q0 */
+/* o : return index with max energy value in vector Q0 */
+Word16 emaximum_32fx(
+ const Word16 Qvec, /* i : Q of input vector Q0 */
+ const Word32 *vec, /* i : input vector Qx */
+ const Word16 lvec, /* i : length of input vector Q0 */
+ Word32 *ener_max /* o : maximum energy value Q0 */
)
{
Word16 j, ind;
@@ -2086,14 +3197,16 @@ Word16 emaximum_32fx( /* o : return index with max energy va
return ind;
}
+
/*-------------------------------------------------------------------*
* mean32:
*
* Find the mean of a 32 bits vector
*-------------------------------------------------------------------*/
-Word32 Mean32( /* o : mean of the elements of the vector */
- const Word32 in[], /* i : input vector */
- const Word16 L /* i : length of input vector */
+/* o : mean of the elements of the vector */
+Word32 Mean32(
+ const Word32 in[], /* i : input vector */
+ const Word16 L /* i : length of input vector */
)
{
Word32 Ltmp;
@@ -2113,9 +3226,11 @@ Word32 Mean32( /* o : mean of the elements of the vector */
return Ltmp;
}
-Word32 sum32_fx( /* o : sum of all vector elements Qx*/
- const Word32 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+
+/* o : sum of all vector elements Qx*/
+Word32 sum32_fx(
+ const Word32 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
)
{
Word16 i;
@@ -2129,9 +3244,11 @@ Word32 sum32_fx( /* o : sum of all vector elements
return tmp;
}
-Word16 sum16_fx( /* o : sum of all vector elements Qx*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+
+/* o : sum of all vector elements Qx*/
+Word16 sum16_fx(
+ const Word16 *vec, /* i : input vector Qx*/
+ const Word16 lvec /* i : length of input vector */
)
{
Word16 i;
@@ -2145,25 +3262,32 @@ Word16 sum16_fx( /* o : sum of all vector elements
return tmp;
}
+
+
/*------------------------------------------------------------------*
* function Random
*
* Signed 16 bits random generator.
*------------------------------------------------------------------*/
-Word16 Random( /* o : output random value */
- Word16 *seed /* i/o: random seed */
+
+/* o : output random value */
+Word16 Random(
+ Word16 *seed /* i/o: random seed */
)
{
*seed = extract_l( L_mac0( 13849L, *seed, 31821 ) );
move16();
+
return *seed;
}
-Word16 own_random2_fx( Word16 seed )
+Word16 own_random2_fx(
+ Word16 seed )
{
return extract_l( L_mac0( 13849, seed, 31821 ) );
}
+
/*---------------------------------------------------------------------
* sign_fx()
*
@@ -2198,12 +3322,16 @@ Word16 sign16_fx(
}
}
+
/*------------------------------------------------------------------*
* function Div_32_optmz
*
* Performs 32 bits interger division
*------------------------------------------------------------------*/
-static Word32 Div_32_optmz( Word32 L_num, Word16 denom_hi )
+
+static Word32 Div_32_optmz(
+ Word32 L_num,
+ Word16 denom_hi )
{
Word16 approx, hi, lo, n_hi, n_lo;
Word32 L_32;
@@ -2227,12 +3355,15 @@ static Word32 Div_32_optmz( Word32 L_num, Word16 denom_hi )
return ( L_32 );
}
+
+
/*------------------------------------------------------------------*
* function iDiv_and_mod_32
*
* return the quotient and the modulo 32 bits numerator divided by a 16 bit denominator
* The denominator might be right shifted by 1
*------------------------------------------------------------------*/
+
void iDiv_and_mod_32(
const Word32 Numer, /* i : 32 bits numerator */
const Word16 Denom, /* i : 16 bits denominator */
@@ -2409,6 +3540,8 @@ void pz_filter_sp_fx(
y[i] = extract_h( Ltemp1 ); /* y[i] in Qn */
move16();
}
+
+ return;
}
@@ -2451,9 +3584,11 @@ Word32 root_a_over_b_fx(
Word16 tmp, num, den, scale;
Word16 exp, exp_num, exp_den;
Word32 L_tmp;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
test();
IF( ( a <= 0 ) || ( b <= 0 ) )
@@ -2464,15 +3599,23 @@ Word32 root_a_over_b_fx(
}
exp_num = norm_l( b );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ num = round_fx_sat( L_shl_sat( b, exp_num ) );
+#else
num = round_fx_o( L_shl_o( b, exp_num, &Overflow ), &Overflow );
+#endif
exp_num = sub( sub( 30, exp_num ), Q_b );
exp_den = norm_l( a );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ den = round_fx_sat( L_shl_sat( a, exp_den ) );
+#else
den = round_fx_o( L_shl_o( a, exp_den, &Overflow ), &Overflow );
+#endif
exp_den = sub( sub( 30, exp_den ), Q_a );
scale = shr( sub( den, num ), 15 );
-#ifdef ISSUE_1796_replace_shl_o
+#ifdef ISSUE_1836_replace_overflow_libcom
num = shl_sat( num, scale );
#else
num = shl_o( num, scale, &Overflow );
@@ -2491,6 +3634,7 @@ Word32 root_a_over_b_fx(
return L_tmp;
}
+
Word32 root_a_over_b_ivas_fx(
Word32 a, /* Q(Q_a) */
Word16 Q_a,
@@ -2594,6 +3738,7 @@ Word32 root_a_over_b_ivas_fx(
return approx;
}
+
/*===================================================================*/
/* FUNCTION : fir_fx () */
/*-------------------------------------------------------------------*/
@@ -2617,24 +3762,27 @@ Word32 root_a_over_b_ivas_fx(
/*-------------------------------------------------------------------*/
/* RETURN ARGUMENTS : _ None. */
/*===================================================================*/
-void fir_fx( const Word16 x[], /* i : input vector Qx*/
- const Word16 h[], /* i : impulse response of the FIR filter Q12*/
- Word16 y[], /* o : output vector (result of filtering) Qx*/
- Word16 mem[], /* i/o: memory of the input signal (L samples) Qx*/
- const Word16 L, /* i : input vector size */
- const Word16 K, /* i : order of the FIR filter (K+1 coefs.) */
- const Word16 upd /* i : 1 = update the memory, 0 = not */
- ,
- Word16 shift /* i : difference between Q15 and scaling of h[] */
+
+void fir_fx(
+ const Word16 x[], /* i : input vector Qx*/
+ const Word16 h[], /* i : impulse response of the FIR filter Q12*/
+ Word16 y[], /* o : output vector (result of filtering) Qx*/
+ Word16 mem[], /* i/o: memory of the input signal (L samples) Qx*/
+ const Word16 L, /* i : input vector size */
+ const Word16 K, /* i : order of the FIR filter (K+1 coefs.) */
+ const Word16 upd, /* i : 1 = update the memory, 0 = not */
+ Word16 shift /* i : difference between Q15 and scaling of h[] */
)
{
Word16 buf_in[L_FRAME32k + L_FILT_MAX];
Word16 i, j;
Word32 s;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* prepare the input buffer (copy and update memory) */
Copy( mem, buf_in, K );
@@ -2647,18 +3795,34 @@ void fir_fx( const Word16 x[], /* i : input vector
/* do the filtering */
FOR( i = 0; i < L; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ s = L_mult_sat( buf_in[K + i], h[0] );
+#else
s = L_mult_o( buf_in[K + i], h[0], &Overflow );
+#endif
FOR( j = 1; j <= K; j++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ s = L_mac_sat( s, h[j], buf_in[K + i - j] );
+#else
s = L_mac_o( s, h[j], buf_in[K + i - j], &Overflow );
+#endif
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ s = L_shl_sat( s, shift );
+ y[i] = round_fx_sat( s ); /*Qx */
+#else
s = L_shl_o( s, shift, &Overflow );
y[i] = round_fx_o( s, &Overflow ); /*Qx */
+#endif
move16();
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* v_add_32()
*
@@ -2780,18 +3944,22 @@ void v_sub_16(
/*--------------------------------------------------------------------------------*/
/* squant_fx() */
/*--------------------------------------------------------------------------------*/
-Word16 squant_fx( /* o: index of the winning codeword */
- const Word16 x, /* i: scalar value to quantize */
- Word16 *xq, /* o: quantized value */
- const Word16 cb[], /* i: codebook */
- const Word16 cbsize /* i: codebook size */
+
+/* o: index of the winning codeword */
+Word16 squant_fx(
+ const Word16 x, /* i: scalar value to quantize */
+ Word16 *xq, /* o: quantized value */
+ const Word16 cb[], /* i: codebook */
+ const Word16 cbsize /* i: codebook size */
)
{
Word16 tmp;
Word16 c, idx;
Word32 L_mindist, L_dist;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
idx = 0;
@@ -2802,10 +3970,18 @@ Word16 squant_fx( /* o: index of the winning codeword */
FOR( c = 0; c < cbsize; c++ )
{
L_dist = L_deposit_l( 0 );
+#ifdef ISSUE_1836_replace_overflow_libcom
+ tmp = sub_sat( x, cb[c] );
+#else
tmp = sub_o( x, cb[c], &Overflow );
+#endif
/*dist += tmp*tmp; */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_dist = L_mac_sat( L_dist, tmp, tmp );
+#else
L_dist = L_mac_o( L_dist, tmp, tmp, &Overflow );
+#endif
if ( LT_32( L_dist, L_mindist ) )
{
@@ -2874,7 +4050,7 @@ Word16 squant_int_fx(
/*-------------------------------------------------------------------*/
/* INPUT/OUTPUT ARGUMENTS : */
/* */
-/* _ (Word32 []) buf : filter memory (Qx+Qc) */
+/* _ (Word32 []) buf : filter memory (Qx+Qc) */
/*-------------------------------------------------------------------*/
/* RETURN ARGUMENTS : _ None. */
/*===================================================================*/
@@ -2926,26 +4102,32 @@ void pz_filter_dp_fx(
y[i] = extract_h( Ltemp1 ); /* y[i] in Qn */
move16();
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* Copy_Scale_sig
*
* Up/down scale a 16 bits vector x and move it into y
*-------------------------------------------------------------------*/
+
void Copy_Scale_sig32(
const Word32 x[], /* i : signal to scale input Qx */
Word32 y[], /* o : scaled signal output Qx */
const Word16 lg, /* i : size of x[] Q0 */
- const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
+ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
)
{
Word16 i;
Word32 L_tmp;
Word16 tmp = exp0;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
IF( exp0 == 0 )
{
@@ -2960,17 +4142,27 @@ void Copy_Scale_sig32(
{
FOR( i = 0; i < lg; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[i] = L_shl_sat( x[i], tmp );
+#else
y[i] = L_shl_o( x[i], tmp, &Overflow );
+#endif
move16();
}
return;
}
+#ifdef ISSUE_1836_replace_overflow_libcom
+ L_tmp = L_shl_sat( 1, exp0 - 1 );
+#else
L_tmp = L_shl_o( 1, exp0 - 1, &Overflow );
+#endif
FOR( i = 0; i < lg; i++ )
{
y[i] = W_extract_l( W_mult_32_32( L_tmp, x[i] ) );
move32(); /* saturation can occur here */
}
+
+ return;
}
@@ -3005,6 +4197,8 @@ void Copy_Scale_sig32_16(
*dst++ = round_fx_sat( L_temp );
move16();
}
+
+ return;
}
/*-------------------------------------------------------------------*
@@ -3029,11 +4223,16 @@ void v_multc_att(
move16();
}
}
-} /*-------------------------------------------------------------------*
- * v_multc_att32()
- *
- * Attenuation of a vector,, attenuation factor in Q15
- *-------------------------------------------------------------------*/
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * v_multc_att32()
+ *
+ * Attenuation of a vector,, attenuation factor in Q15
+ *-------------------------------------------------------------------*/
void v_multc_att32(
const Word32 x[], /* i : Input vector Qx */
@@ -3051,6 +4250,8 @@ void v_multc_att32(
move32();
}
}
+
+ return;
}
/*-------------------------------------------------------------------*
@@ -3075,6 +4276,8 @@ void v_multc_att3232(
move32();
}
}
+
+ return;
}
/*-------------------------------------------------------------------*
@@ -3142,9 +4345,11 @@ void add_vec_fx(
)
{
Word16 i, Qyx1, Qyx2;
+#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Qyx1 = sub( Qx1, Qy );
Qyx2 = sub( Qx2, Qy );
@@ -3152,7 +4357,11 @@ void add_vec_fx(
{
FOR( i = 0; i < N; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[i] = add_sat( x1[i], shr_r_sat( x2[i], Qyx2 ) );
+#else
y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow );
+#endif
move16();
}
}
@@ -3160,24 +4369,32 @@ void add_vec_fx(
{
FOR( i = 0; i < N; i++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ y[i] = add_sat( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ) ); //!!sat //!!sat
+#else
y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow );
+#endif
move16();
}
}
+
return;
}
+
/*-------------------------------------------------------------------*
* Add_flt32_flt32
*
* Add two Pseudo Float Value that are 32 Bits Mantisa and 16 Bits Exp
*-------------------------------------------------------------------*/
-Word32 Add_flt32_flt32( /* o: Result (Normalized) */
- Word32 a, /* i: 1st Value */
- Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
- Word32 b, /* i: 2nd Value */
- Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
- Word16 *exp_out /* o: Exponent of Result */
+
+/* o: Result (Normalized) */
+Word32 Add_flt32_flt32(
+ Word32 a, /* i: 1st Value */
+ Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
+ Word32 b, /* i: 2nd Value */
+ Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
+ Word16 *exp_out /* o: Exponent of Result */
)
{
Word16 temp, temp2;
@@ -3202,16 +4419,19 @@ Word32 Add_flt32_flt32( /* o: Result (Normalized)
return L_shl( L_temp, temp2 );
}
+
/*-------------------------------------------------------------------*
* Mul_flt32_Q15
*
* Multiply one Pseudo Float Value (32 Bits Mantisa and 16 Bits Exp)
* with a Q15 value
*-------------------------------------------------------------------*/
-Word32 Mul_flt32_Q15( /* o: Result (Normalized) */
- Word32 value, /* i: Pseudo_float Value */
- Word16 *exp_v, /*i/o: Exponent of Value (Q of Value) */
- Word16 frac /* i: Q15 value */
+
+/* o: Result (Normalized) */
+Word32 Mul_flt32_Q15(
+ Word32 value, /* i: Pseudo_float Value */
+ Word16 *exp_v, /*i/o: Exponent of Value (Q of Value) */
+ Word16 frac /* i: Q15 value */
)
{
Word16 temp;
@@ -3226,18 +4446,21 @@ Word32 Mul_flt32_Q15( /* o: Result (Normalized) */
return L_shl( L_temp, temp );
}
+
/*-------------------------------------------------------------------*
* Div_flt32_flt32
*
* Divide one Pseudo Float Value (32 Bits Mantisa and 16 Bits Exp)
* by another one
*-------------------------------------------------------------------*/
-Word32 Div_flt32_flt32( /* o: Result (Normalized) */
- Word32 a, /* i: 1st Value */
- Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
- Word32 b, /* i: 2nd Value */
- Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
- Word16 *exp_out /* o: Exponent of Result */
+
+/* o: Result (Normalized) */
+Word32 Div_flt32_flt32(
+ Word32 a, /* i: 1st Value */
+ Word16 exp_a, /* i: Exponent of 1st Value (Q of Value) */
+ Word32 b, /* i: 2nd Value */
+ Word16 exp_b, /* i: Exponent of 2nd Value (Q of Value) */
+ Word16 *exp_out /* o: Exponent of Result */
)
{
Word16 temp, temp2;
@@ -3262,11 +4485,13 @@ Word32 Div_flt32_flt32( /* o: Result (Normalized)
*
* Calculate Energy with overflow protection
*-------------------------------------------------------------------*/
-Word32 Calc_Energy_Autoscaled( /* o: Result (Energy) */
- const Word16 *signal, /* i: Signal */
- Word16 signal_exp, /* i: Exponent of Signal (Q of Signal) */
- Word16 len, /* i: Frame Length */
- Word16 *energy_exp /* o: Exponent of Energy (Q of Energy) */
+
+/* o: Result (Energy) */
+Word32 Calc_Energy_Autoscaled(
+ const Word16 *signal, /* i: Signal */
+ Word16 signal_exp, /* i: Exponent of Signal (Q of Signal) */
+ Word16 len, /* i: Frame Length */
+ Word16 *energy_exp /* o: Exponent of Energy (Q of Energy) */
)
{
Word16 temp, temp2;
@@ -3287,7 +4512,11 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy)
FOR( i = 0; i < j; i++ )
{
/* divide by 2 so energy will be divided by 4 */
+#ifdef ISSUE_1836_replace_overflow_libcom
+ temp = mult_r( *signal++, 16384 );
+#else
temp = mult_ro( *signal++, 16384, &Overflow );
+#endif
L_Energy = L_mac0_o( L_Energy, temp, temp, &Overflow );
}
FOR( i = j; i < len; i += 8 ) /* Process 8 Samples at a time */
@@ -3297,15 +4526,15 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy)
L_temp = L_mult0( temp, temp );
FOR( j = 1; j < 8; j++ )
{
+#ifdef ISSUE_1836_replace_overflow_libcom
+ temp = mult_r( *signal++, 16384 );
+#else
temp = mult_ro( *signal++, 16384, &Overflow );
+#endif
L_temp = L_mac0_o( L_temp, temp, temp, &Overflow );
}
-#ifdef ISSUE_1799_replace_L_shr_o
/*Overfloe will never happen because temp2 is always positive*/
L_temp = L_shr( L_temp, temp2 );
-#else
- L_temp = L_shr_o( L_temp, temp2, &Overflow );
-#endif
/* Here we try the addition just to check if we can sum
the energy of the small (8 Iterations) loop with the
total energy calculated so far without an overflow.
@@ -3333,7 +4562,9 @@ Word32 Calc_Energy_Autoscaled( /* o: Result (Energy)
return L_Energy;
}
-Word16 Find_Max_Norm16( const Word16 *src, Word16 len )
+Word16 Find_Max_Norm16(
+ const Word16 *src,
+ Word16 len )
{
Word16 i;
Word16 max16;
@@ -3351,7 +4582,9 @@ Word16 Find_Max_Norm16( const Word16 *src, Word16 len )
return norm_s( max16 );
}
-Word16 Find_Max_Norm32( const Word32 *src, Word16 len )
+Word16 Find_Max_Norm32(
+ const Word32 *src,
+ Word16 len )
{
Word16 i;
Word32 max32;
@@ -3366,17 +4599,20 @@ Word16 Find_Max_Norm32( const Word32 *src, Word16 len )
return norm_l( max32 );
}
+
/*-------------------------------------------------------------------*
* Sqrt_Ratio32
*
* Calculate Sqrt of Val1/Val2
*-------------------------------------------------------------------*/
-Word32 Sqrt_Ratio32( /* o: Result in Q31 */
- Word32 L_val1, /* i: Mantisa of Val1 */
- Word16 exp1, /* i: Exp of Val1 (>0: Val was Left Shifted, <0:Right Shifted) */
- Word32 L_val2, /* i: Mantisa of Val2 */
- Word16 exp2, /* i: Exp of Val2 (same as exp1) */
- Word16 *exp /* o: Exp of Result (# of 'L_shl' Req to get to Final Value) */
+
+/* o: Result in Q31 */
+Word32 Sqrt_Ratio32(
+ Word32 L_val1, /* i: Mantisa of Val1 */
+ Word16 exp1, /* i: Exp of Val1 (>0: Val was Left Shifted, <0:Right Shifted) */
+ Word32 L_val2, /* i: Mantisa of Val2 */
+ Word16 exp2, /* i: Exp of Val2 (same as exp1) */
+ Word16 *exp /* o: Exp of Result (# of 'L_shl' Req to get to Final Value) */
)
{
Word16 temp;
@@ -3417,9 +4653,10 @@ Word32 Sqrt_Ratio32( /* o: Result in Q31
return L_val1;
}
-Word16 Invert16( /* result in Q'15 + 'exp' */
- Word16 val,
- Word16 *exp )
+/* result in Q'15 + 'exp' */
+Word16 Invert16(
+ Word16 val,
+ Word16 *exp )
{
Word16 temp;
@@ -3437,7 +4674,10 @@ Word16 Invert16( /* result in Q'15 + 'exp' */
return temp;
}
-Word16 find_rem( Word16 n, Word16 m, Word16 *r )
+Word16 find_rem(
+ Word16 n,
+ Word16 m,
+ Word16 *r )
{
Word16 i, q1, q2, qd;
Word32 Ltemp2;
@@ -3479,11 +4719,15 @@ Word16 find_rem( Word16 n, Word16 m, Word16 *r )
Ltemp2 = L_shr( Lacc, q2 );
*r = extract_h( Ltemp2 );
move16();
+
return ( q1 );
}
-Word32 find_remd( Word32 n, Word32 m, Word32 *r )
+Word32 find_remd(
+ Word32 n,
+ Word32 m,
+ Word32 *r )
{
Word16 i, q1, q2, qd;
Word32 Ltemp2, qo;
@@ -3527,9 +4771,11 @@ Word32 find_remd( Word32 n, Word32 m, Word32 *r )
}
*r = L_shr( Lacc, q2 );
move16();
+
return ( qo );
}
+
Word16 rint_new_fx(
Word32 x /*Q16 */
)
@@ -3592,7 +4838,15 @@ Word16 rint_new_fx(
/* CALLED FROM : TX */
/*===================================================================*/
-Word16 erb_diff_search_fx( Word16 *prev_erb, const Word16 *curr_erb, Word16 *dif_erb, Word16 *pow_spec, const Word16 *cb_fx, Word16 cb_size, Word16 cb_dim, Word16 offset )
+Word16 erb_diff_search_fx(
+ Word16 *prev_erb,
+ const Word16 *curr_erb,
+ Word16 *dif_erb,
+ Word16 *pow_spec,
+ const Word16 *cb_fx,
+ Word16 cb_size,
+ Word16 cb_dim,
+ Word16 offset )
{
Word16 i, j, mmseindex;
Word16 dh, dl;
@@ -3677,6 +4931,8 @@ Word16 erb_diff_search_fx( Word16 *prev_erb, const Word16 *curr_erb, Word16 *dif
return ( mmseindex );
}
+
+
void Acelp_dec_total_exc(
Word16 *exc_fx, /* i/o: adapt. excitation exc */
Word16 *exc2_fx, /* i/o: adapt. excitation/total exc */
@@ -3699,14 +4955,20 @@ void Acelp_dec_total_exc(
move16();
move16();
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* UL_inverse
*
* Calculate inverse of UL_val. Output in Q_exp.
*-------------------------------------------------------------------*/
-UWord32 UL_inverse( const UWord32 UL_val, Word16 *exp )
+
+UWord32 UL_inverse(
+ const UWord32 UL_val,
+ Word16 *exp )
{
UWord32 UL_tmp;
@@ -3726,7 +4988,10 @@ UWord32 UL_inverse( const UWord32 UL_val, Word16 *exp )
* Calculate UL_num/UL_den. UL_num assumed to be Q31, UL_den assumed
* to be Q32, then result is in Q32.
*-------------------------------------------------------------------*/
-UWord32 UL_div( const UWord32 UL_num, const UWord32 UL_den )
+
+UWord32 UL_div(
+ const UWord32 UL_num,
+ const UWord32 UL_den )
{
UWord32 UL_e, UL_Q;
UWord32 UL_msb, UL_lsb;
@@ -3766,9 +5031,11 @@ Word16 ratio( const Word32 numer, const Word32 denom, Word16 *expo )
*expo = sub( expNumer, expDenom );
move16();
+
return quotient; /* Q14 */
}
+
/*-----------------------------------------------------------------------*
* Function hp400_12k8() *
* *
@@ -3789,6 +5056,7 @@ Word16 ratio( const Word32 numer, const Word32 denom, Word16 *expo )
* float --> b[3] = {0.893554687, -1.787109375, 0.893554687}; *
* a[3] = {1.000000000, 1.787109375, -0.864257812}; *
*-----------------------------------------------------------------------*/
+
void hp400_12k8_fx(
Word16 signal[], /* i/o: input signal / output is divided by 16 */
const Word16 lg, /* i : lenght of signal */
@@ -3866,6 +5134,7 @@ void hp400_12k8_fx(
return;
}
+
void hp400_12k8_ivas_fx(
Word16 signal[], /* i/o: input signal / output is divided by 16 */
const Word16 lg, /* i : lenght of signal */
@@ -3915,10 +5184,18 @@ void hp400_12k8_ivas_fx(
mem[5] = x1; /* Q_syn */
move16();
move16();
+
return;
}
-Word16 dot_prod_satcontr( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy, Word16 *qo, Word16 len )
+
+Word16 dot_prod_satcontr(
+ const Word16 *x,
+ const Word16 *y,
+ Word16 qx,
+ Word16 qy,
+ Word16 *qo,
+ Word16 len )
{
Word16 tmp_tab_x[L_FRAME16k];
Word16 tmp_tab_y[L_FRAME16k];
@@ -3930,7 +5207,6 @@ Word16 dot_prod_satcontr( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy
move32();
#endif
-
Copy( x, tmp_tab_x, len ); /* OPTIMIZE !!!!! the copy into local table is not necessary */
Copy( y, tmp_tab_y, len ); /* could be reworked to do a 1st iteration with the original x[] and y[] */
/* then check if there is an overflow and do a more complex 2nd, 3rd, ... processing */
@@ -3965,6 +5241,7 @@ Word16 dot_prod_satcontr( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy
q = add( q, add( qx, qy ) );
*qo = sub( q, add( shift, 16 ) );
move16();
+
return ener;
}
@@ -3986,7 +5263,11 @@ Word16 dot_prod_satcontr( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy
* Returns:
* void
*/
-void E_UTIL_f_convolve( const Word16 x[], const Word16 h[], Word16 y[], const Word16 size )
+void E_UTIL_f_convolve(
+ const Word16 x[],
+ const Word16 h[],
+ Word16 y[],
+ const Word16 size )
{
Word16 i, n;
Word32 L_sum;
@@ -4004,14 +5285,17 @@ void E_UTIL_f_convolve( const Word16 x[], const Word16 h[], Word16 y[], const Wo
y[n] = mac_r( L_sum, x[i], h[0] );
move16();
}
+
return;
}
+
/*-----------------------------------------------------------------------------
* floating_point_add:
*
* Add two floating point numbers: x <- x + y.
*----------------------------------------------------------------------------*/
+
void floating_point_add(
Word32 *mx, /* io: mantissa of the addend Q31 */
Word16 *ex, /* io: exponent of the addend Q0 */
@@ -4045,9 +5329,11 @@ void floating_point_add(
*ex = sub( add( *ex, expo ), 1 ); /* Subtract 1 due to 1-bit down-shift above ensuring 1 bit headroom before addition. */
move32();
move16();
+
return;
}
+
/*-------------------------------------------------------------------*
* delay_signal_fx()
*
@@ -4133,6 +5419,7 @@ void v_add_fx(
return;
}
+
Word16 floor_log_2( Word32 num )
{
@@ -4180,6 +5467,7 @@ void v_shr_16(
return;
}
+
/*---------------------------------------------------------------------*
* lin_interp_fx()
*
@@ -4260,6 +5548,7 @@ Word16 lin_interp_ivas_fx(
return add_sat( y1, round_fx( L_shl( L_mult( sub( x, x1 ), div_res ), div_res_e ) ) );
}
+
/*---------------------------------------------------------------------
* sign_l()
*
@@ -4319,6 +5608,7 @@ void set_zero_fx(
return;
}
+
void set_zero2_fx(
Word32 *vec, /* o : input vector */
const Word32 lvec /* i : length of the vector */
@@ -4490,6 +5780,7 @@ Word32 dotp_fixed_ivas_fx(
return suma;
}
+
/*-------------------------------------------------------------------*
* v_mult()
*
@@ -4515,11 +5806,13 @@ void v_mult_fixed(
return;
}
+
/*-------------------------------------------------------------------*
* anint_fixed()
*
* Round to the nearest integer.
*-------------------------------------------------------------------*/
+
Word32 anint_fixed( Word32 x, Word16 exp )
{
IF( x == 0 )
@@ -4536,20 +5829,26 @@ Word32 anint_fixed( Word32 x, Word16 exp )
}
}
+
/*-------------------------------------------------------------------*
* ceil_fixed()
*
* Ceil to the next multiple of (1 << exp).
*-------------------------------------------------------------------*/
-Word32 ceil_fixed( Word32 x, Word16 exp )
+
+Word32 ceil_fixed(
+ Word32 x,
+ Word16 exp )
{
Word32 step;
+
// step = x / L_shl( 1, exp );
step = L_shr( x, exp );
IF( ( x % L_shl( 1, exp ) ) > 0 )
{
step = L_add( step, 1 );
}
+
return L_shl( step, exp );
}
@@ -4577,6 +5876,7 @@ void sort_l(
return;
}
+
/*-------------------------------------------------------------------*
* v_add_fixed()
*
@@ -4647,7 +5947,8 @@ void v_add_fixed_me(
return;
}
-Word16 find_guarded_bits_fx( Word32 n )
+Word16 find_guarded_bits_fx(
+ Word32 n )
{
// return n <= 1 ? 0 : n <= 2 ? 1
// : n <= 4 ? 2
@@ -4682,10 +5983,14 @@ Word16 find_guarded_bits_fx( Word32 n )
}
}
-Word16 L_norm_arr( const Word32 *arr, Word16 size )
+
+Word16 L_norm_arr(
+ const Word32 *arr,
+ Word16 size )
{
Word16 q = 31;
move16();
+
FOR( Word16 i = 0; i < size; i++ )
{
Word16 q_tst;
@@ -4700,12 +6005,15 @@ Word16 L_norm_arr( const Word32 *arr, Word16 size )
return q;
}
-Word16 norm_arr( Word16 *arr, Word16 size )
+Word16 norm_arr(
+ Word16 *arr,
+ Word16 size )
{
Word16 q = 15;
Word16 exp = 0;
move16();
move16();
+
FOR( Word16 i = 0; i < size; i++ )
{
if ( arr[i] != 0 )
@@ -4717,15 +6025,19 @@ Word16 norm_arr( Word16 *arr, Word16 size )
q = s_min( q, exp );
}
}
+
return q;
}
-Word16 W_norm_arr( Word64 *arr, Word16 size )
+Word16 W_norm_arr(
+ Word64 *arr,
+ Word16 size )
{
Word16 q = 63;
Word16 exp = 0;
move16();
move16();
+
FOR( Word16 i = 0; i < size; i++ )
{
if ( arr[i] != 0 )
@@ -4737,10 +6049,13 @@ Word16 W_norm_arr( Word64 *arr, Word16 size )
q = s_min( q, exp );
}
}
+
return q;
}
-Word16 get_min_scalefactor( Word32 x, Word32 y )
+Word16 get_min_scalefactor(
+ Word32 x,
+ Word32 y )
{
Word16 scf_y;
Word16 scf = Q31;
@@ -4768,18 +6083,24 @@ Word16 get_min_scalefactor( Word32 x, Word32 y )
}
-Flag is_zero_arr( Word32 *arr, Word16 size )
+Flag is_zero_arr(
+ Word32 *arr,
+ Word16 size )
{
FOR( Word16 i = 0; i < size; i++ )
- IF( arr[i] != 0 )
{
- return 0;
+ IF( arr[i] != 0 )
+ {
+ return 0;
+ }
}
return 1;
}
-Flag is_zero_arr16( Word16 *arr, Word16 size )
+Flag is_zero_arr16(
+ Word16 *arr,
+ Word16 size )
{
FOR( Word16 i = 0; i < size; i++ )
IF( arr[i] != 0 )
@@ -4790,7 +6111,9 @@ Flag is_zero_arr16( Word16 *arr, Word16 size )
return 1;
}
-Flag is_zero_arr64( Word64 *arr, Word16 size )
+Flag is_zero_arr64(
+ Word64 *arr,
+ Word16 size )
{
FOR( Word16 i = 0; i < size; i++ )
{
@@ -4809,7 +6132,9 @@ void Scale_sig64(
)
{
Word16 i;
+
assert( exp <= 63 && exp >= -63 );
+
IF( exp == 0 )
{
return;
@@ -4821,4 +6146,6 @@ void Scale_sig64(
x[i] = W_shl( x[i], exp );
move64();
}
+
+ return;
}
diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c
index 7bea66ea0b0f2194210a0a06fdcc932f7660841c..8a6caf04ab365a3dd2661f9d425cf2d4da053ea7 100644
--- a/lib_com/weight_a_fx.c
+++ b/lib_com/weight_a_fx.c
@@ -100,11 +100,6 @@ void weight_a_fx(
Word16 i, fac;
Word32 Amax;
Word16 shift;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow;
- Overflow = 0;
- move32();
-#endif
fac = gamma; /* Q15 */
move16();
@@ -122,7 +117,7 @@ void weight_a_fx(
move16();
FOR( i = 1; i < m; i++ )
{
- ap[i] = round_fx_o( L_shl( L_mult0( a[i], fac ), shift ), &Overflow ); /* Q11 + shift */
+ ap[i] = round_fx_sat( L_shl( L_mult0( a[i], fac ), shift ) ); /* Q11 + shift */
move16();
fac = mult_r( fac, gamma ); /* Q15 */
}
diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c
index 5a8ad35c5bb311292fe2612b0b860dd4941c4016..58f1a813dbe3dbedee9c399945703c5e18605b79 100644
--- a/lib_com/wi_fx.c
+++ b/lib_com/wi_fx.c
@@ -264,10 +264,6 @@ static Word16 DTFS_alignment_weight_fx(
Word16 tmplpc_fx[M + 1];
Word16 exp, tmp;
Word32 L_tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
diff_fx = 0; /* to avoid compilation warnings */
move16();
@@ -320,8 +316,8 @@ static Word16 DTFS_alignment_weight_fx(
FOR( k = 0; k <= HalfLag; k++ )
{
- ab1[k] = round_fx_o( L_mac0_o( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k], &Overflow ), &Overflow ); /* Q(-15) */
- ab2[k] = round_fx_o( L_msu0_o( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k], &Overflow ), &Overflow ); /* Q(-15) */
+ ab1[k] = round_fx_sat( L_mac0_sat( L_mult0( X1.a_fx[k], X2.a_fx[k] ), X1.b_fx[k], X2.b_fx[k] ) ); /* Q(-15) */
+ ab2[k] = round_fx_sat( L_msu0_sat( L_mult0( X1.a_fx[k], X2.b_fx[k] ), X1.b_fx[k], X2.a_fx[k] ) ); /* Q(-15) */
move16();
move16();
}
@@ -344,8 +340,8 @@ static Word16 DTFS_alignment_weight_fx(
FOR( k = 0; k <= HalfLag; k++ )
{
- corr_fx = L_mac0_o( corr_fx, ab1[k], cos_table[s_and( temp, 511 )], &Overflow );
- corr_fx = L_mac0_o( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )], &Overflow );
+ corr_fx = L_mac0_sat( corr_fx, ab1[k], cos_table[s_and( temp, 511 )] );
+ corr_fx = L_mac0_sat( corr_fx, ab2[k], cos_table[s_and( add( temp, 128 ), 511 )] );
move32();
move32();
temp = add( temp, temp1 );
@@ -358,19 +354,15 @@ static Word16 DTFS_alignment_weight_fx(
move16();
}
- temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */
-#ifdef ISSUE_1796_replace_shl_o
- wcorr_fx = L_mult_o( temp1, shl_sat( temp, 2 ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */
-#else
- wcorr_fx = L_mult_o( temp1, shl_o( temp, 2, &Overflow ), &Overflow ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */
-#endif
+ temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */
+ wcorr_fx = L_mult_sat( temp1, shl_sat( temp, 2 ) ); /* Q(Qcorr-16+13+2+1)=Q(Qcorr) */ //!!sat
IF( GE_16( Qmaxcorr, Qcorr ) )
{
- diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */
+ diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */
}
ELSE
{
- diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */
+ diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */
}
IF( diff_corr > 0 )
@@ -421,10 +413,6 @@ Word16 DTFS_alignment_full_fx(
Word16 n, fshift_fx;
Word32 corr_fx, maxcorr_fx;
Word16 Eshift, Adiff_fx;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
/* Calculating the expected alignment shift */
Eshift = mult_r( ph_offset_fx, shl( X2_DTFS_fx.lag_fx, 7 ) ); /* confirmed I<2 by smv12.org, Q7 */
@@ -457,8 +445,8 @@ Word16 DTFS_alignment_full_fx(
FOR( k = 0; k <= HalfLag; k++ )
{
- ab1[k] = round_fx_o( L_mac_o( L_mult_o( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */
- ab2[k] = round_fx_o( L_msu_o( L_mult_o( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k], &Overflow ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k], &Overflow ), &Overflow ); /* Q(-15); */
+ ab1[k] = round_fx_sat( L_mac_sat( L_mult_sat( X1_DTFS_fx.a_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.b_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */
+ ab2[k] = round_fx_sat( L_msu_sat( L_mult_sat( X1_DTFS_fx.b_fx[k], X2_DTFS_fx.a_fx[k] ), X1_DTFS_fx.a_fx[k], X2_DTFS_fx.b_fx[k] ) ); /* Q(-15); */
}
IF( FR_flag == 0 )
{
@@ -488,9 +476,9 @@ Word16 DTFS_alignment_full_fx(
temp1 = add( n, shl( X2_DTFS_fx.lag_fx, 1 ) ); /* add lag_fx in Q1to make positive */
FOR( k = 0; k <= HalfLag; k++ )
{
- corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow );
- corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )], &Overflow );
- temp = add_o( temp, temp1, &Overflow );
+ corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] );
+ corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[( 2 * temp ) % ( 4 * X2_DTFS_fx.lag_fx )] );
+ temp = add_sat( temp, temp1 );
}
IF( GT_32( corr_fx, maxcorr_fx ) )
@@ -596,10 +584,6 @@ void Q2phaseShift_fx(
Word16 k;
Word16 temp, HalfLag;
Word32 temp2;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
temp2 = L_deposit_l( 0 );
HalfLag = s_min( shr( X_fx->lag_fx, 1 ), X_fx->nH_fx );
@@ -610,9 +594,9 @@ void Q2phaseShift_fx(
FOR( k = 0; k <= HalfLag; k++ )
{
temp = X_fx->a_fx[k];
- X_fx->a_fx[k] = round_fx_o( L_msu_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */
- X_fx->b_fx[k] = round_fx_o( L_mac_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow );
- temp2 = L_add_o( temp2, (Word32) ph, &Overflow );
+ X_fx->a_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */
+ X_fx->b_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) );
+ temp2 = L_add_sat( temp2, (Word32) ph );
move16();
move16();
}
@@ -624,9 +608,9 @@ void Q2phaseShift_fx(
FOR( k = 0; k <= HalfLag; k++ )
{
temp = X_fx->a_fx[k];
- X_fx->a_fx[k] = round_fx_o( L_mac_o( L_mult_o( temp, C_fx[temp2 % ( 4 * Lag )], &Overflow ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow ); /* X.Q */
- X_fx->b_fx[k] = round_fx_o( L_msu_o( L_mult_o( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )], &Overflow ), temp, S_fx[temp2 % ( 4 * Lag )], &Overflow ), &Overflow );
- temp2 = add_o( (Word16) temp2, negate( ph ), &Overflow );
+ X_fx->a_fx[k] = round_fx_sat( L_mac_sat( L_mult_sat( temp, C_fx[temp2 % ( 4 * Lag )] ), X_fx->b_fx[k], S_fx[temp2 % ( 4 * Lag )] ) ); /* X.Q */
+ X_fx->b_fx[k] = round_fx_sat( L_msu_sat( L_mult_sat( X_fx->b_fx[k], C_fx[temp2 % ( 4 * Lag )] ), temp, S_fx[temp2 % ( 4 * Lag )] ) );
+ temp2 = add_sat( (Word16) temp2, negate( ph ) );
move16();
move16();
}
@@ -730,10 +714,6 @@ void DTFS_to_fs_fx(
Word32 La[MAXLAG_WI], Lb[MAXLAG_WI], Labmax;
Word16 exp, tmp;
Word32 L_tmp1;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
IF( !FR_flag )
{
@@ -769,15 +749,15 @@ void DTFS_to_fs_fx(
move16();
exp = norm_s( X_fx->lag_fx );
- tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */
- L_tmp1 = L_mult_o( 12800, tmp, &Overflow ); /* Q(30-exp) */
- diff_fx = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */
+ tmp = div_s( shl( 1, sub( 14, exp ) ), X_fx->lag_fx ); /* Q29-exp */
+ L_tmp1 = L_mult( 12800, tmp ); /* Q(30-exp) */
+ diff_fx = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */
exp = norm_s( diff_fx );
- tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */
- L_tmp1 = L_mult_o( X_fx->upper_cut_off_freq_fx, tmp, &Overflow ); /* Q(30-exp) */
- nH_band = extract_h( L_shl_o( L_tmp1, sub( exp, 14 ), &Overflow ) ); /* Q0 */
- nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */
+ tmp = div_s( shl( 1, sub( 14, exp ) ), diff_fx ); /* Q29-exp */
+ L_tmp1 = L_mult_sat( X_fx->upper_cut_off_freq_fx, tmp ); /* Q(30-exp) */
+ nH_band = extract_h( L_shl_sat( L_tmp1, sub( exp, 14 ) ) ); /* Q0 */
+ nH_4kHz = mult( 10240, ( X_fx->lag_fx ) ); /* 4000/12800 in Q15 */
if ( GE_16( sub( X_fx->upper_cut_off_freq_fx, shr( (Word16) L_mult( diff_fx, nH_band ), 1 ) ), diff_fx ) )
{
@@ -800,8 +780,8 @@ void DTFS_to_fs_fx(
exp = norm_s( N );
tmp = div_s( shl( 1, ( sub( 14, exp ) ) ), N );
- L_tmp = L_shl_o( tmp, add( exp, 6 ), &Overflow );
- inv_lag = round_fx_o( L_tmp, &Overflow );
+ L_tmp = L_shl_sat( tmp, add( exp, 6 ) );
+ inv_lag = round_fx_sat( L_tmp );
Lx0 = L_deposit_h( x[0] );
Labmax = L_deposit_l( 0 );
FOR( k = 1; k <= nH; k++ )
@@ -815,8 +795,8 @@ void DTFS_to_fs_fx(
move16();
FOR( n = 1; n < N; n++ )
{
- L_a = L_mac0_o( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*cos(sum) */
- L_b = L_mac0_o( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )], &Overflow ); /* Q16 of x[n]*sin(sum) */
+ L_a = L_mac0_sat( L_a, x[n], C_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*cos(sum) */
+ L_b = L_mac0_sat( L_b, x[n], S_fx[( 4 * sum ) % ( 4 * N )] ); /* Q16 of x[n]*sin(sum) */
sum = add( sum, temp );
}
La[k] = L_shr( L_a, 6 ); /* Q8 of a[k]*2.0 */
@@ -853,13 +833,13 @@ void DTFS_to_fs_fx(
temp_neg = negate( temp );
FOR( n = 0; n < N - 1; n += 2 )
{
- L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */
- L_a = L_mac_o( L_a, x[n + 1], temp_neg, &Overflow );
+ L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */
+ L_a = L_mac_sat( L_a, x[n + 1], temp_neg );
/*temp= negate(temp); */
}
if ( s_and( N, 1 ) ) /*if N is odd we need to calculate last */
{
- L_a = L_mac_o( L_a, x[n], temp, &Overflow ); /* Q1 */
+ L_a = L_mac_sat( L_a, x[n], temp ); /* Q1 */
}
La[k] = L_shl( L_a, 7 );
@@ -886,21 +866,21 @@ void DTFS_to_fs_fx(
FOR( k = 1; k <= nH; k++ )
{
- X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */
+ X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */
move16();
- X_fx->a_fx[k] = mult_ro( X_fx->a_fx[k], inv_lag, &Overflow );
- move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */
- X_fx->b_fx[k] = round_fx_o( L_shl_o( Lb[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */
+ X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag );
+ move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*2.0/N */
+ X_fx->b_fx[k] = round_fx_sat( L_shl_sat( Lb[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */
move16();
- X_fx->b_fx[k] = mult_ro( X_fx->b_fx[k], inv_lag, &Overflow );
+ X_fx->b_fx[k] = mult_r_sat( X_fx->b_fx[k], inv_lag );
move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of b[k]*2.0/N */
}
/* IF ( N%2 == 0 ) */
IF( s_and( N, 1 ) == 0 )
{
- X_fx->a_fx[k] = round_fx_o( L_shl_o( La[k], temp, &Overflow ), &Overflow ); /* Q(8+temp-16)=Q(temp-8) */
- X_fx->a_fx[k] = mult_ro( X_fx->a_fx[k], inv_lag, &Overflow );
+ X_fx->a_fx[k] = round_fx_sat( L_shl_sat( La[k], temp ) ); /* Q(8+temp-16)=Q(temp-8) */
+ X_fx->a_fx[k] = mult_r_sat( X_fx->a_fx[k], inv_lag );
move16();
move16(); /* Q(temp-8+19+1-16)=Q(temp-4) of a[k]*1.0/N */
X_fx->b_fx[k] = 0;
@@ -1201,10 +1181,6 @@ void DTFS_zeroFilter_fx(
Word16 temp, temp1, temp2;
Word32 L_temp1, L_temp2;
Word16 Qmin, Qab[MAXLAG_WI], na, nb;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
Qmin = 32767;
move16();
HalfLag = s_min( shr( X_fx->lag_fx, 1 ), X_fx->nH_fx );
@@ -1221,19 +1197,20 @@ void DTFS_zeroFilter_fx(
FOR( n = 0; n < N; n++ )
{
- sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow ); /* Q(12+15+1) */
- sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )], &Overflow );
+ sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] ); /* Q(12+15+1) */
+ sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx->lag_fx )] );
temp2 = add( temp2, temp );
}
- temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */
- temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */
+ temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */
+ temp2 = round_fx_sat( sum2_fx ); /* Q(12) */
/* Calculate the circular convolution */
- L_temp1 = L_mult_o( temp1, X_fx->a_fx[k], &Overflow );
- L_temp1 = L_msu_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1) */
- L_temp2 = L_mult_o( temp1, X_fx->b_fx[k], &Overflow );
- L_temp2 = L_mac_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1) */
+ L_temp1 = L_mult( temp1, X_fx->a_fx[k] );
+ L_temp1 = L_msu_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1) */
+ L_temp2 = L_mult( temp1, X_fx->b_fx[k] );
+
+ L_temp2 = L_mac_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1) */
/* normalization */
na = norm_l( L_temp1 );
if ( L_temp1 == 0 )
@@ -1253,8 +1230,8 @@ void DTFS_zeroFilter_fx(
nb = na;
move16();
}
- X_fx->a_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp1, nb, &Overflow ), &Overflow ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */
- X_fx->b_fx[k] = round_fx_o( (Word32) L_shl_o( L_temp2, nb, &Overflow ), &Overflow ); /* Q(Q+nb-3) */
+ X_fx->a_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp1, nb ) ); /* Q(13+Q+nb-16)=Q(Q+nb-3) */
+ X_fx->b_fx[k] = round_fx_sat( (Word32) L_shl_sat( L_temp2, nb ) ); /* Q(Q+nb-3) */
move32();
move32();
@@ -1270,17 +1247,9 @@ void DTFS_zeroFilter_fx(
/* bring to the same Q */
FOR( k = 0; k <= HalfLag; k++ )
{
-#ifdef ISSUE_1796_replace_shl_o
X_fx->a_fx[k] = shl_sat( X_fx->a_fx[k], sub( Qmin, Qab[k] ) );
-#else
- X_fx->a_fx[k] = shl_o( X_fx->a_fx[k], sub( Qmin, Qab[k] ), &Overflow );
-#endif
move16(); /* Q(Q+Qab[k]+Qmin-Qab[k]=Q(Q+Qmin) */
-#ifdef ISSUE_1796_replace_shl_o
X_fx->b_fx[k] = shl_sat( X_fx->b_fx[k], sub( Qmin, Qab[k] ) );
-#else
- X_fx->b_fx[k] = shl_o( X_fx->b_fx[k], sub( Qmin, Qab[k] ), &Overflow );
-#endif
move16(); /* Q(Q+Qmin) */
}
@@ -1525,10 +1494,6 @@ Word32 DTFS_getEngy_fx(
Word32 en_fx = 0;
move32();
Word16 temp_a_fx, temp_b_fx;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 );
HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx );
FOR( k = 1; k <= HalfLag_fx; k++ )
@@ -1537,15 +1502,14 @@ Word32 DTFS_getEngy_fx(
move16();
temp_b_fx = X_fx->b_fx[k];
move16();
-
- en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow );
- en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow );
+ en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx );
+ en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx );
}
en_fx = L_shr( en_fx, 1 );
temp_a_fx = X_fx->a_fx[0];
move16();
- en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow );
+ en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx );
/* IF (X_fx->lag_fx%2 == 0) */
IF( s_and( X_fx->lag_fx, 1 ) == 0 )
{
@@ -1553,9 +1517,8 @@ Word32 DTFS_getEngy_fx(
move16();
temp_b_fx = X_fx->b_fx[k];
move16();
-
- en_fx = L_mac0_o( en_fx, temp_a_fx, temp_a_fx, &Overflow );
- en_fx = L_mac0_o( en_fx, temp_b_fx, temp_b_fx, &Overflow );
+ en_fx = L_mac0_sat( en_fx, temp_a_fx, temp_a_fx );
+ en_fx = L_mac0_sat( en_fx, temp_b_fx, temp_b_fx );
}
return en_fx; /* 2*X1.Q+1=Q13 */
@@ -1586,26 +1549,21 @@ Word32 DTFS_getEngy_P2A_fx(
Word16 k, HalfLag_fx;
Word32 en_fx = 0;
move32();
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
HalfLag_fx = shr( sub( X_fx->lag_fx, 1 ), 1 );
HalfLag_fx = s_min( HalfLag_fx, X_fx->nH_fx );
FOR( k = 1; k <= HalfLag_fx; k++ )
{
- en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow );
- en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow );
+ en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] );
+ en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] );
}
en_fx = L_shr( en_fx, 1 );
- en_fx = L_mac0_o( en_fx, X_fx->a_fx[0], X_fx->a_fx[0], &Overflow );
+ en_fx = L_mac0_sat( en_fx, X_fx->a_fx[0], X_fx->a_fx[0] );
/* IF (X_fx->lag_fx%2 == 0) */
IF( s_and( X_fx->lag_fx, 1 ) == 0 )
{
- en_fx = L_mac0_o( en_fx, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow );
- en_fx = L_mac0_o( en_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow );
+ en_fx = L_mac0_sat( en_fx, X_fx->a_fx[k], X_fx->a_fx[k] );
+ en_fx = L_mac0_sat( en_fx, X_fx->b_fx[k], X_fx->b_fx[k] );
}
-
return en_fx; /* 2*X1.Q */
}
@@ -1732,17 +1690,13 @@ void DTFS_car2pol_fx(
Word32 Ltemp_fx;
Word32 Lacc_fx;
Word16 exp, tmp, frac;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
HalfLag_fx = s_min( shr( sub( X_fx->lag_fx, 1 ), 1 ), X_fx->nH_fx );
FOR( k = 1; k <= HalfLag_fx; k++ )
{
- Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */
- Lacc_fx = L_mac_o( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k], &Overflow ); /* a[k]^2+b[k]^2, 2Q+1 */
- Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */
+ Lacc_fx = L_mult( X_fx->a_fx[k], X_fx->a_fx[k] ); /* a[k]^2, 2Q+1 */
+ Lacc_fx = L_mac_sat( Lacc_fx, X_fx->b_fx[k], X_fx->b_fx[k] ); /* a[k]^2+b[k]^2, 2Q+1 */
+ Lacc_fx = L_shr( Lacc_fx, 3 ); /* Lacc=(a[k]^2+b[k]^2)/4, 2Q */
IF( Lacc_fx )
{
@@ -1849,10 +1803,6 @@ Word32 DTFS_setEngyHarm_fx(
move32();
Word16 expp = 0;
move16();
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
f_low_fx = mult( f1_fx, X_fx->lag_fx ); /* Q0 */
@@ -1864,7 +1814,7 @@ Word32 DTFS_setEngyHarm_fx(
Lacc = L_deposit_l( 0 );
FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ )
{
- Lacc = L_mac0_o( Lacc, X_fx->a_fx[k], X_fx->a_fx[k], &Overflow ); /* 2*X1.Q */
+ Lacc = L_mac0_sat( Lacc, X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*X1.Q */
Lacc_max = L_max( Lacc_max, Lacc );
count = add( count, 1 );
@@ -1879,8 +1829,8 @@ Word32 DTFS_setEngyHarm_fx(
Lacc = L_deposit_l( 0 );
FOR( k = f_low_fx + 1; k <= HalfLag_fx; k++ )
{
- L_tmp = L_mult_o( X_fx->a_fx[k], X_fx->a_fx[k], &Overflow );
- Lacc = L_add_o( Lacc, L_shr( L_tmp, expp ), &Overflow ); /* 2*X1.Q-expp */
+ L_tmp = L_mult_sat( X_fx->a_fx[k], X_fx->a_fx[k] );
+ Lacc = L_add_sat( Lacc, L_shr( L_tmp, expp ) ); /* 2*X1.Q-expp */
count = add( count, 1 );
}
}
@@ -1893,7 +1843,7 @@ Word32 DTFS_setEngyHarm_fx(
exp = norm_s( count );
tmp = div_s( shl( 1, sub( 14, exp ) ), count ); /* 29 - exp */
- en1_fx = L_shl_o( Mult_32_16( Lacc, tmp ), sub( exp, 14 ), &Overflow );
+ en1_fx = L_shl_sat( Mult_32_16( Lacc, tmp ), sub( exp, 14 ) );
test();
IF( en1_fx > 0 && en2_fx > 0 )
{
@@ -1904,7 +1854,7 @@ Word32 DTFS_setEngyHarm_fx(
expb = norm_l( en1_fx );
- fracb = round_fx_o( L_shl_o( en1_fx, expb, &Overflow ), &Overflow );
+ fracb = round_fx_sat( L_shl( en1_fx, expb ) );
IF( GE_32( Lacc_max, 2147483647 /*1.Q31*/ ) )
{
expb = sub( 30, add( expb, sub( shl( X_fx->Q, 1 ), expp ) ) );
@@ -1942,7 +1892,7 @@ Word32 DTFS_setEngyHarm_fx(
{
/*L_temp_fx =(Word32)Mpy_32_16(extract_h(factor_fx),extract_l(factor_fx), X_fx->a_fx[k]); move32(); */ /* Q(temp+X1.Q-15) */
L_temp_fx = Mult_32_16( factor_fx, X_fx->a_fx[k] ); /* Q(temp+X1.Q-15) */
- X_fx->a_fx[k] = round_fx_o( L_temp_fx, &Overflow ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */
+ X_fx->a_fx[k] = round_fx_sat( L_temp_fx ); /* Q(temp+X1.Q-15-16)=Q(temp+X1.Q-31); */
move16();
}
@@ -2006,10 +1956,6 @@ static void cubicPhase_fx(
Word16 num_flag, den_flag;
Word32 N2;
Word16 dbgshft;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
num_flag = 0;
move16();
den_flag = 0;
@@ -2077,8 +2023,7 @@ static void cubicPhase_fx(
Ltemp3 = L_mult( N, c1 ); /* Q20 */
Ltemp3 = L_sub( Ltemp3, L_shl( Ltemp1, 1 ) ); /* Ltemp3=N*c1-2*Ltemp1, Q20 */
-
- IF( GE_32( L_abs( Ltemp3 ), L_shl_o( Ltemp2, 8, &Overflow ) ) )
+ IF( GE_32( L_abs( Ltemp3 ), L_shl_sat( Ltemp2, 8 ) ) )
{
Lacc = L_add( MIN_32, 0 );
if ( Ltemp3 > 0 )
@@ -2091,7 +2036,7 @@ static void cubicPhase_fx(
ELSE
{
expa = norm_l( Ltemp3 );
- fraca = extract_h( L_shl_o( Ltemp3, expa, &Overflow ) );
+ fraca = extract_h( L_shl( Ltemp3, expa ) );
expa = sub( 30, add( expa, 20 ) );
if ( fraca < 0 )
{
@@ -2100,7 +2045,7 @@ static void cubicPhase_fx(
}
expb = norm_l( Ltemp2 );
- fracb = extract_h( L_shl_o( Ltemp2, expb, &Overflow ) );
+ fracb = extract_h( L_shl( Ltemp2, expb ) );
expb = sub( 30, expb );
if ( fracb < 0 )
{
@@ -2117,11 +2062,7 @@ static void cubicPhase_fx(
fracb = negate( fracb );
}
scale = shr( sub( fracb, fraca ), 15 );
-#ifdef ISSUE_1796_replace_shl_o
fraca = shl_sat( fraca, scale );
-#else
- fraca = shl_o( fraca, scale, &Overflow );
-#endif
expa = sub( expa, scale );
tmp = div_s( fraca, fracb ); /* 15-exp */
@@ -2137,8 +2078,8 @@ static void cubicPhase_fx(
tmp = negate( tmp );
}
- Lacc = L_shl_o( tmp, add( exp, 34 ), &Overflow );
- Lacc = L_add_o( Lacc, 0x08000, &Overflow );
+ Lacc = L_shl_sat( tmp, add( exp, 34 ) );
+ Lacc = L_add_sat( Lacc, 0x08000 );
c0 = extract_h( Lacc ); /* c0 in Q33 */
}
@@ -2264,7 +2205,7 @@ static void cubicPhase_fx(
Ltemp3 = L_add( Ltemp3, 1 );
}
- Ltemp3 = L_shl_o( Mult_32_16( L_shl_o( Ltemp3, 7, &Overflow ), c0 ), 2, &Overflow ); /* Ltemp3=c0*n^3, Q27 */
+ Ltemp3 = L_shl_sat( Mult_32_16( L_shl_sat( Ltemp3, 7 ), c0 ), 2 ); /* Ltemp3=c0*n^3, Q27 */ //?sat
Ltemp2 = L_shl( Mult_32_16( N2, c1 ), 1 );
/* Ltemp2 = (Word32)L_mult_su(c1,(UNS_Word16)n2); : Ltemp2=c1*n^2, Q27 */
Ltemp1 = L_shl( L_mult( c2, n ), 7 ); /* Ltemp1=c2*n, Q27 */
@@ -2322,10 +2263,6 @@ void DTFS_to_erb_fx(
Word32 sum_a_fx[NUM_ERB_WB], Ltemp_fx, L_tmp, L_temp;
Word16 exp, tmp;
Word16 expa, expb, fraca, fracb, scale;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
const Word16 *erb_fx = NULL;
num_erb_fx = NUM_ERB_NB;
move16();
@@ -2390,7 +2327,7 @@ void DTFS_to_erb_fx(
FOR( i = 0; i < num_erb_fx; i++ )
{
- out_fx[i] = round_fx_o( L_shl_o( sum_a_fx[i], n, &Overflow ), &Overflow ); /* Q13 */
+ out_fx[i] = round_fx_sat( L_shl_sat( sum_a_fx[i], n ) ); /* Q13 */ //?�sat
move16();
IF( GT_16( count[i], 1 ) )
{
@@ -2462,10 +2399,6 @@ void erb_slot_fx(
Word16 exp, tmp;
Word32 L_tmp1, L_tmp;
Word16 fraca, fracb, expa, expb, scale;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
const Word16 *erb_fx = NULL; /*move16(); */
upper_cut_off_freq_fx = 4000;
@@ -2547,17 +2480,17 @@ void erb_slot_fx(
}
FOR( j = 0; j < num_erb_fx; j++ )
{
- mfreq_fx[j] = round_fx_o( L_shl_o( mf_fx[j], 11, &Overflow ), &Overflow ); /* Q15 */
+ mfreq_fx[j] = round_fx_sat( L_shl_sat( mf_fx[j], 11 ) ); /* Q15 */
move16();
IF( GT_16( out_fx[j], 1 ) )
{
expb = norm_l( mf_fx[j] );
- fracb = round_fx_o( L_shl_o( mf_fx[j], expb, &Overflow ), &Overflow );
+ fracb = round_fx_sat( L_shl_sat( mf_fx[j], expb ) );
expb = sub( 30, add( expb, 20 ) );
expa = norm_l( out_fx[j] );
- fraca = extract_h( L_shl_o( out_fx[j], expa, &Overflow ) );
+ fraca = extract_h( L_shl( out_fx[j], expa ) );
expa = sub( 30, expa );
scale = shr( sub( fraca, fracb ), 15 );
@@ -2566,9 +2499,9 @@ void erb_slot_fx(
tmp = div_s( fracb, fraca );
exp = sub( expb, expa );
- L_tmp = L_shl_o( tmp, add( exp, 16 ), &Overflow );
+ L_tmp = L_shl_sat( tmp, add( exp, 16 ) );
- mfreq_fx[j] = round_fx_o( L_tmp, &Overflow );
+ mfreq_fx[j] = round_fx_sat( L_tmp );
move16();
}
}
@@ -2620,10 +2553,6 @@ void DTFS_erb_inv_fx(
move16();
move16();
move16();
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
IF( EQ_16( num_erb_fx, NUM_ERB_NB ) )
{
@@ -2708,7 +2637,7 @@ void DTFS_erb_inv_fx(
d2h = 31;
move16();
}
- X_fx->a_fx[i] = round_fx_o( L_shl_o( Ltemp_fx, d2h, &Overflow ), &Overflow ); /* Q(28-n+d2h) */
+ X_fx->a_fx[i] = round_fx_sat( L_shl_sat( Ltemp_fx, d2h ) ); /* Q(28-n+d2h) */
move16();
q[i] = add( sub( 28, n ), d2h );
move16();
@@ -2752,7 +2681,6 @@ void DTFS_erb_inv_fx(
/*-------------------------------------------------------------------*/
/* CALLED FROM : TX/RX */
/*===================================================================*/
-
void erb_add_fx(
Word16 *curr_erb_fx, /* i/o: current ERB */
Word16 l_fx, /* i : current lag */
@@ -3450,10 +3378,6 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W
Word16 expa, expb, fraca, fracb, scale;
Word16 exp, tmp;
Word32 L_tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
L_sum = DTFS_getEngy_P2A_fx( &X_fx ); /* 2Q */
DTFS_fast_fs_inv_fx( &X_fx, time_fx, 256, 8 );
@@ -3497,21 +3421,18 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W
ELSE
{
expa = norm_l( maxPosEn_fx );
- fraca = extract_h( L_shl_o( maxPosEn_fx, expa, &Overflow ) );
+ fraca = extract_h( L_shl( maxPosEn_fx, expa ) );
expa = sub( 30, add( expa, 1 ) );
expb = norm_l( L_sum );
- fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow );
+ fracb = round_fx_sat( L_shl( L_sum, expb ) );
+
expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) );
scale = shr( sub( fraca, fracb ), 15 );
-#ifdef ISSUE_1796_replace_shl_o
fracb = shl_sat( fracb, scale );
-#else
- fracb = shl_o( fracb, scale, &Overflow );
-#endif
expb = sub( expb, scale );
tmp = div_s( fracb, fraca );
@@ -3535,21 +3456,17 @@ void DTFS_peaktoaverage_fx( DTFS_STRUCTURE X_fx, Word32 *pos_fx, Word16 *Qpos, W
{
expa = norm_l( maxNegEn_fx );
- fraca = extract_h( L_shl_o( maxNegEn_fx, expa, &Overflow ) );
+ fraca = extract_h( L_shl( maxNegEn_fx, expa ) );
expa = sub( Q29, expa ); // 30 - expa - 1;
expb = norm_l( L_sum );
- fracb = round_fx_o( L_shl_o( L_sum, expb, &Overflow ), &Overflow );
+ fracb = round_fx_sat( L_shl( L_sum, expb ) );
expb = sub( 30, add( expb, shl( X_fx.Q, 1 ) ) );
scale = shr( sub( fraca, fracb ), 15 );
-#ifdef ISSUE_1796_replace_shl_o
fracb = shl_sat( fracb, scale );
-#else
- fracb = shl_o( fracb, scale, &Overflow );
-#endif
expb = sub( expb, scale );
tmp = div_s( fracb, fraca );
@@ -4029,10 +3946,6 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE
Word32 Ltemp_fx, L_tmp;
Word32 Lacc_fx;
Word16 exp, tmp, exp1;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
retX_fx->lag_fx = X1_fx->lag_fx;
move16();
@@ -4042,8 +3955,8 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE
FOR( k = 1; k <= HalfLag; k++ )
{
- Lacc_fx = L_mult_o( X1_fx->a_fx[k], X1_fx->a_fx[k], &Overflow );
- Lacc_fx = L_mac_o( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k], &Overflow ); /* 2*Q+1 */
+ Lacc_fx = L_mult_sat( X1_fx->a_fx[k], X1_fx->a_fx[k] );
+ Lacc_fx = L_mac_sat( Lacc_fx, X1_fx->b_fx[k], X1_fx->b_fx[k] ); /* 2*Q+1 */
exp = norm_l( Lacc_fx );
tmp = extract_h( L_shl( Lacc_fx, exp ) );
@@ -4085,15 +3998,15 @@ void copy_phase_fx( DTFS_STRUCTURE *X1_fx, DTFS_STRUCTURE X2_fx, DTFS_STRUCTURE
d1h = extract_h( Ltemp_fx );
d1l = extract_l( Ltemp_fx );
Ltemp_fx = L_mult0( X1_fx->b_fx[k], d1l );
- Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->b_fx[k], d1h, &Overflow ), &Overflow ); /* sin(w) in Q(q+16+Q-15) */
- sn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */
- retX_fx->b_fx[k] = mult_ro( X2_fx.a_fx[k], sn, &Overflow ); /* X2_fx.Q */
+ Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult_sat( X1_fx->b_fx[k], d1h ) ); /* sin(w) in Q(q+16+Q-15) */
+ sn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */
+ retX_fx->b_fx[k] = mult_r_sat( X2_fx.a_fx[k], sn ); /* X2_fx.Q */
move16();
Ltemp_fx = L_mult0( X1_fx->a_fx[k], d1l );
- Ltemp_fx = L_add_o( L_shr( Ltemp_fx, 15 ), L_mult_o( X1_fx->a_fx[k], d1h, &Overflow ), &Overflow ); /* cos(w) in Q(q+Q+1) */
- cn = round_fx_o( L_shl_o( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ), &Overflow ), &Overflow ); /* Q15 */
- retX_fx->a_fx[k] = mult_ro( X2_fx.a_fx[k], cn, &Overflow ); /* X2_fx.Q */
+ Ltemp_fx = L_add_sat( L_shr( Ltemp_fx, 15 ), L_mult_sat( X1_fx->a_fx[k], d1h ) ); /* cos(w) in Q(q+Q+1) */
+ cn = round_fx_sat( L_shl_sat( Ltemp_fx, sub( 30, add( q, X1_fx->Q ) ) ) ); /* Q15 */
+ retX_fx->a_fx[k] = mult_r_sat( X2_fx.a_fx[k], cn ); /* X2_fx.Q */
move16();
}
k = sub( k, 1 );
@@ -4147,10 +4060,6 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband,
Word32 en;
Word16 exp, tmp, expa, fraca, expb, fracb, scale;
Word32 L_tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
en = L_deposit_l( 0 );
if ( EQ_16( hband, X_fx->upper_cut_off_freq_fx ) )
@@ -4185,8 +4094,8 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband,
FOR( i = 0; i < M + 1; i++ )
{
/* Compute Re */
- Lacc = L_mac_o( Lacc, curr_lpc[i], cos_tab[n % M_fx], &Overflow ); /* Q28 */
- n = add( n, k4 ); /* n=4*i*k */
+ Lacc = L_mac_sat( Lacc, curr_lpc[i], cos_tab[n % M_fx] ); /* Q28 */
+ n = add( n, k4 ); /* n=4*i*k */
}
Re = L_shr( Lacc, 1 ); /* Q27 */
@@ -4196,13 +4105,13 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband,
FOR( i = 0; i < M + 1; i++ )
{
/* Compute Im */
- Lacc = L_msu_o( Lacc, curr_lpc[i], sin_tab[n % M_fx], &Overflow ); /* Q28 */
- n = add( n, k4 ); /* n=4*i*k */
+ Lacc = L_msu_sat( Lacc, curr_lpc[i], sin_tab[n % M_fx] ); /* Q28 */
+ n = add( n, k4 ); /* n=4*i*k */
}
- Im = L_shr( Lacc, 1 ); /* Q27 */
- /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */
- Lacc = L_add_o( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ), &Overflow ); /* Lacc=Re^2+Im^2 in Q23 */
- Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */
+ Im = L_shr( Lacc, 1 ); /* Q27 */
+ /* Lacc=L_add(L_mult_ll(Re,Re),(Word32)L_mult_ll(Im,Im)); : Lacc=Re^2+Im^2 in Q23 */
+ Lacc = L_add_sat( Mult_32_32( Re, Re ), Mult_32_32( Im, Im ) ); /* Lacc=Re^2+Im^2 in Q23 */
+ Ltemp = L_mult0( X_fx->a_fx[k], X_fx->a_fx[k] ); /* 2*a[k]^2 in 2Q */
/* Ltemp=(Word32)L_sat32_40(divide_dp(Ltemp,Lacc,-19,1)); : Ltemp in Q(2Q-13) */
if ( Lacc < 0 )
@@ -4228,7 +4137,7 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband,
tmp = div_s( fracb, fraca ); /* 15-exp */
exp = sub( expb, expa );
- Ltemp = L_shl_o( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ), &Overflow );
+ Ltemp = L_shl_sat( tmp, sub( add( shl( X_fx->Q, 1 ), exp ), 27 ) );
}
ELSE
{
@@ -4268,7 +4177,6 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE *X_fx, Word16 lband, Word16 hband,
/*-------------------------------------------------------------------*/
/* CALLED FROM : TX/RX */
/*===================================================================*/
-
void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_fx, Word16 *C_fx )
{
Word16 temp, temp1, temp2, HalfLag;
@@ -4277,10 +4185,6 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_
Word16 k, n, na, nb;
Word16 Qmin, Qab[MAXLAG_WI];
Word16 exp, tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
Qmin = 32767;
move16();
HalfLag = s_min( shr( X_fx->lag_fx, 1 ), X_fx->nH_fx );
@@ -4294,21 +4198,20 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_
sum2_fx = L_deposit_l( 0 );
FOR( n = 0; n < N; n++ )
{
- sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */
- sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )], &Overflow ); /* Q(12+15+1) */
+ sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */
+ sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[shl( temp2, 2 ) % shl( X_fx->lag_fx, 2 )] ); /* Q(12+15+1) */
temp2 = add( temp2, k );
}
-
- temp1 = round_fx_o( sum1_fx, &Overflow ); /* Q(12+15+1-16)=Q(12) */
- temp2 = round_fx_o( sum2_fx, &Overflow ); /* Q(12) */
+ temp1 = round_fx_sat( sum1_fx ); /* Q(12+15+1-16)=Q(12) */
+ temp2 = round_fx_sat( sum2_fx ); /* Q(12) */
/* Calculate the circular convolution */
- sum = L_mac_o( L_mult_o( temp1, temp1, &Overflow ), temp2, temp2, &Overflow ); /* Q(12+12+1)=Q(25) */
+ sum = L_mac_sat( L_mult_sat( temp1, temp1 ), temp2, temp2 ); /* Q(12+12+1)=Q(25) */
L_temp1 = L_mult( temp1, X_fx->a_fx[k] );
- L_temp1 = L_mac_o( L_temp1, temp2, X_fx->b_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */
+ L_temp1 = L_mac_sat( L_temp1, temp2, X_fx->b_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */
L_temp2 = L_mult( temp1, X_fx->b_fx[k] );
- L_temp2 = L_msu_o( L_temp2, temp2, X_fx->a_fx[k], &Overflow ); /* Q(12+Q+1)=Q(13+Q) */
+ L_temp2 = L_msu_sat( L_temp2, temp2, X_fx->a_fx[k] ); /* Q(12+Q+1)=Q(13+Q) */
IF( sum )
{
exp = norm_l( sum );
@@ -4399,7 +4302,6 @@ void DTFS_poleFilter_fx( DTFS_STRUCTURE *X_fx, Word16 *LPC, Word16 N, Word16 *S_
/*-------------------------------------------------------------------*/
/* CALLED FROM : TX/RX */
/*===================================================================*/
-
void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word16 *S_fx, Word16 *C_fx, Word16 *pf_temp1, Word16 *pf_temp2, Word16 *pf_temp, Word16 *pf_n2_temp1 )
{
Word16 temp1, temp2, HalfLag;
@@ -4407,10 +4309,6 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word
Word32 sum;
Word16 k, n, n1, n2;
Word16 exp, tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
HalfLag = s_min( shr( X_fx.lag_fx, 1 ), X_fx.nH_fx );
FOR( k = 0; k <= HalfLag; k++ )
@@ -4423,8 +4321,8 @@ void poleFilter_setup_fx( const Word16 *LPC, Word16 N, DTFS_STRUCTURE X_fx, Word
sum2_fx = L_deposit_l( 0 );
FOR( n = 0; n < N; n++ )
{
- sum1_fx = L_mac_o( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */
- sum2_fx = L_mac_o( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )], &Overflow ); /* Q(12+15+1) */
+ sum1_fx = L_mac_sat( sum1_fx, LPC[n], C_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */
+ sum2_fx = L_mac_sat( sum2_fx, LPC[n], S_fx[( 4 * temp2 ) % ( 4 * X_fx.lag_fx )] ); /* Q(12+15+1) */
temp2 = add( temp2, k );
}
diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c
index 84302ff087347fa61f2ec06027406f5fea5cc556..8f8652543413f3f68b9aa1165cc921dbb9931a9d 100644
--- a/lib_com/window_fx.c
+++ b/lib_com/window_fx.c
@@ -20,7 +20,6 @@
#include "rom_basop_util.h"
#include "prot_fx.h"
-
void ham_cos_window(
Word16 *fh, /* o: 0Q15 */
const Word16 n1, /* i: */
@@ -29,10 +28,6 @@ void ham_cos_window(
{
Word16 i;
Word32 cte, cc;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
assert( n1 >= 102 ); /* if n1 is too low -> overflow in div_l */
@@ -46,7 +41,7 @@ void ham_cos_window(
{
/* fh_f[i] = 0.54f - 0.46f * (Float32)cos(cc); */
BASOP_SATURATE_WARNING_OFF_EVS
- fh[i] = sub_o( P54_0Q15, mult_r( getCosWord16( round_fx_o( L_shl_o( cc, 9, &Overflow ), &Overflow ) ), P92_0Q15 ), &Overflow ); /*0Q15*/
+ fh[i] = sub_sat( P54_0Q15, mult_r( getCosWord16( round_fx_sat( L_shl_sat( cc, 9 ) ) ), P92_0Q15 ) ); /*0Q15*/
move16();
BASOP_SATURATE_WARNING_ON_EVS
cc = L_add( cc, cte ); /*0Q15*/
@@ -63,11 +58,7 @@ void ham_cos_window(
FOR( i = n1; i < n1 + n2; i++ )
{
/* fh_f[i] = (Float32)cos(cc); */
-#ifdef ISSUE_1796_replace_shl_o
fh[i] = shl_sat( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1 ); /*0Q15*/
-#else
- fh[i] = shl_o( getCosWord16( round_fx( L_shl( cc, 10 ) ) ), 1, &Overflow ); /*0Q15*/
-#endif
move16();
cc = L_add( cc, cte );
}
diff --git a/lib_debug/wmc_auto.c b/lib_debug/wmc_auto.c
index 9a4b371fc5fa8cd7bb9147da17355d409ae0819b..5afd9de166568531c15df05978d588430d1cad77 100644
--- a/lib_debug/wmc_auto.c
+++ b/lib_debug/wmc_auto.c
@@ -2030,8 +2030,10 @@ void print_mem( ROM_Size_Lookup_Table Const_Data_PROM_Table[] )
{
fprintf( stdout, "Error: Cannot retrieve or calculate Table ROM size of (%s)!\n", Const_Data_PROM_Table[i].file_spec );
}
-
- fprintf( stdout, "Table ROM (const data) size (%s): %d %s\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].Get_Const_Data_Size_Func() >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size] );
+ else
+ {
+ fprintf( stdout, "Table ROM (const data) size (%s): %d %s\n", Const_Data_PROM_Table[i].file_spec, Const_Data_PROM_Table[i].Get_Const_Data_Size_Func() >> Stat_Cnt_Size, Count_Unit[Stat_Cnt_Size] );
+ }
}
}
else
diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c
index 1be7453ab9492386fa762903658b5ff6c66921bc..c90530d5dc23b5316d00bbf860197b4377ec78be 100644
--- a/lib_dec/FEC_HQ_core_fx.c
+++ b/lib_dec/FEC_HQ_core_fx.c
@@ -43,12 +43,6 @@ static void Regression_Anal_fx(
Word32 L_tmp1, L_tmp2;
Word16 aindex_fx[MAX_PGF + 1]; // Q0
Word32 b_p_fx[MAX_PGF + 1]; // Q10
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
/* Initialize */
FOR( i = 0; i < add( num_pgf, 1 ); i++ )
@@ -80,11 +74,7 @@ static void Regression_Anal_fx(
{
b_p_fx[0] = L_add( b_p_fx[0], L_shr( values_fx[i], 2 ) ); /*10 */
move32();
-#ifdef ISSUE_1796_replace_shl_o
b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_sat( sub( num_pgf, i ), 13 ) ) ); /*10 */
-#else
- b_p_fx[1] = L_add( b_p_fx[1], Mult_32_16( values_fx[i], shl_o( sub( num_pgf, i ), 13, &Overflow ) ) ); /*10 */
-#endif
move32();
}
@@ -168,12 +158,6 @@ void HQ_FEC_processing_fx(
Word16 energy_diff_fx; // Q10
HQ_NBFEC_HANDLE hHQ_nbfec;
HQ_DEC_HANDLE hHQ_core;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
hHQ_nbfec = st_fx->hHQ_nbfec;
hHQ_core = st_fx->hHQ_core;
@@ -390,11 +374,7 @@ void HQ_FEC_processing_fx(
FOR( j = 0; j < Num_bands_p[i]; j++ )
{
-#ifdef ISSUE_1796_replace_shl_o
hHQ_nbfec->Norm_gain_fx[k] = shl_sat( tmp_fx, 1 );
-#else
- hHQ_nbfec->Norm_gain_fx[k] = shl_o( tmp_fx, 1, &Overflow );
-#endif
move16();
k = add( k, 1 );
}
@@ -449,10 +429,6 @@ void ivas_HQ_FEC_Mem_update_fx(
HQ_DEC_HANDLE hHQ_core;
hHQ_nbfec = st_fx->hHQ_nbfec;
hHQ_core = st_fx->hHQ_core;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
move32(); // for tmp_energy_fx
IF( EQ_16( output_frame, L_FRAME8k ) )
{
@@ -530,12 +506,8 @@ void ivas_HQ_FEC_Mem_update_fx(
L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/
k = add( k, 1 );
}
-#ifdef ISSUE_1796_replace_shl_o
tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/
-#else
- tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/
-#endif
- norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/
+ norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/
move32();
tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/
}
@@ -654,7 +626,7 @@ void ivas_HQ_FEC_Mem_update_fx(
exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] );
tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) );
exp = add( 15, sub( exp1, exp2 ) );
- *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow );
+ *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) );
move16();
}
*mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] );
@@ -736,10 +708,6 @@ void HQ_FEC_Mem_update_fx(
HQ_DEC_HANDLE hHQ_core;
hHQ_nbfec = st_fx->hHQ_nbfec;
hHQ_core = st_fx->hHQ_core;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
move32(); // tmp_energy_fx
IF( EQ_16( output_frame, L_FRAME8k ) )
@@ -819,12 +787,8 @@ void HQ_FEC_Mem_update_fx(
L_tmp = L_add( L_tmp, L_shr( normq_fx[k], 3 ) ); /*11*/
k = add( k, 1 );
}
-#ifdef ISSUE_1796_replace_shl_o
tmp_fx = shl_sat( inv_tbl_fx[Num_bands_p[i]], 1 ); /*16*/
-#else
- tmp_fx = shl_o( inv_tbl_fx[Num_bands_p[i]], 1, &Overflow ); /*16*/
-#endif
- norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/
+ norm_values_fx[0] = Mult_32_16( L_tmp, tmp_fx ); /*11 + 16 - 15*/
move32();
tmp_energy_fx = L_add( tmp_energy_fx, L_shr( L_tmp, 3 ) ); /*8*/
}
@@ -944,7 +908,7 @@ void HQ_FEC_Mem_update_fx(
exp2 = norm_l( hHQ_nbfec->ynrm_values_fx[i][0] );
tmp_fx = div_s( extract_h( L_shl( en_high_fx[i], exp1 ) ), extract_h( L_shl( hHQ_nbfec->ynrm_values_fx[i][0], exp2 ) ) );
exp = add( 15, sub( exp1, exp2 ) );
- *mean_en_high_fx = add_o( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ), &Overflow );
+ *mean_en_high_fx = add_sat( *mean_en_high_fx, shr_sat( tmp_fx, sub( exp, 5 ) ) );
move16();
}
*mean_en_high_fx = mult( *mean_en_high_fx, inv_tbl_fx[sub( num_Sb, k )] );
@@ -1015,12 +979,6 @@ static Word16 find_best_delay_fx(
Word32 min_sq_cross_fx, min_corr_fx;
Word32 accA_fx, accB_fx;
Word32 Rxy_fx[MAXDELAY_FEC], Ryy_fx[MAXDELAY_FEC];
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
move16(); // d1m
@@ -1086,11 +1044,7 @@ static Word16 find_best_delay_fx(
L_tmp1 = L_shl( min_sq_cross_fx, exp1 );
L_tmp2 = L_shl( min_corr_fx, exp2 );
tmp = div_s( extract_h( L_tmp1 ), extract_h( L_tmp2 ) ); /*15 + exp1 - exp2 */
-#ifdef ISSUE_1796_replace_shl_o
- tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */
-#else
- tmp = shl_o( tmp, sub( exp2, add( exp1, 1 ) ), &Overflow ); /*14 */
-#endif
+ tmp = shl_sat( tmp, sub( exp2, add( exp1, 1 ) ) ); /*14 */
}
*false_flag = 0;
diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c
index 5cb2c99dc63be84a1a2f5c060d6206b5ef741c66..17fece8ec22471c714edab1f22ae3121116290b0 100644
--- a/lib_dec/FEC_HQ_phase_ecu_fx.c
+++ b/lib_dec/FEC_HQ_phase_ecu_fx.c
@@ -63,7 +63,11 @@ static Word16 sqrt2ndOrder( const Word16 );
static void windowing( const Word16 *, Word16 *, const Word16 *, const Word16, const Word16 );
static void windowing_ROM_optimized( const Word16 *, Word16 *, const Word16, const Word16, const Word16 );
static void fft_spec2_fx( const Word16[], Word32[], const Word16 );
+#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
+static void trans_ana_fx( const Word16 *, Word16 *, Word16 *, Word16 *, const Word16, const Word16, const Word16, const Word16, const Word16, Word16 *, Word16 *, Word16 *, Word16 * );
+#else
static void trans_ana_fx( const Word16 *, Word16 *, Word16 *, Word16 *, const Word16, const Word16, const Word16, const Word16, Word16 *, Word16 *, Word16 *, Word16 * );
+#endif
static void peakfinder_fx( const Word16 *, const Word16, Word16 *, Word16 *, const Word16 );
static Word16 imax_fx( const Word16 *, const Word16 );
static void spec_ana_fx( const Word16 *prevsynth, Word16 *plocs, Word32 *plocsi, Word16 *num_plocs, Word16 *X_sav, const Word16 output_frame, const Word16 bwidth_fx, Word16 *Q );
@@ -230,10 +234,13 @@ static void trans_ana_fx(
const Word16 time_offs, /* i : Time offset (integral multiple of output_frame) */
const Word16 est_mus_content, /* i : 0.0=speech_like ... 1.0=Music (==st->env_stab ) */
const Word16 last_fec, /* i : signal that previous frame was concealed with fec_alg */
- Word16 *alpha, /* o : Magnitude modification factors for fade to average */
- Word16 *beta, /* o : Magnitude modification factors for fade to average */
- Word16 *beta_mute, /* o : Factor for long-term mute Q15 */
- Word16 *Xavg /* o : Frequency group average gain to fade to */
+#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
+ const Word16 element_mode, /* i : element_mode req to handle EVS_MONO specific BE path */
+#endif
+ Word16 *alpha, /* o : Magnitude modification factors for fade to average */
+ Word16 *beta, /* o : Magnitude modification factors for fade to average */
+ Word16 *beta_mute, /* o : Factor for long-term mute Q15 */
+ Word16 *Xavg /* o : Frequency group average gain to fade to */
)
{
const Word16 *w_hamm, *pFftTbl;
@@ -555,11 +562,30 @@ static void trans_ana_fx(
mag_chg[k] = mult_r( mag_chg_1st[k], att_val ); /* Q15 */
move16();
+#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
+ IF( NE_16( element_mode, EVS_MONO ) )
+ {
+ IF( EQ_16( k, 0 ) && GT_16( burst_len, BETA_MUTE_THR ) ) /* beta_mute final long term attenuation adjusted only once per frame in the first sub-band, Ref Eq(184) in 26.447 */
+ {
+ *beta_mute = shr( *beta_mute, 1 );
+ move16();
+ }
+ }
+ ELSE
+ {
+ IF( GT_16( burst_len, BETA_MUTE_THR ) ) /* legacy incorrect(too fast) EVS_MONO operation, still kept for BE. To be updated after EVS CR, ref Eq (184) in 26.447 */
+ {
+ *beta_mute = shr( *beta_mute, 1 );
+ move16();
+ }
+ }
+#else
IF( GT_16( burst_len, BETA_MUTE_THR ) )
{
*beta_mute = shr( *beta_mute, 1 );
move16();
}
+#endif
alpha[k] = mag_chg[k];
move16();
/*beta[k] = sqrt(1.0f - SQR(alpha[k])) * *beta_mute;*/
@@ -2304,7 +2330,11 @@ static void subst_spec_fx(
move16();
tmp = add( tmp, sub( Lecu, shr( sub( Lecu, Lprot ), 1 ) ) );
tmp = sub( tmp, shr( output_frame, 1 ) );
+#ifdef FIX_1179_USAN_PHASEECU
+ tmp = add_sat( tmp, time_offs );
+#else
tmp = add( tmp, time_offs );
+#endif
tmp = round_fx( L_shl( L_mult0( tmp, Lprot_inv ), 4 ) ); /* 0+22+4-16=10 */
pPlocsi = plocsi;
@@ -2916,13 +2946,9 @@ static Word32 mult_32_32_q( const Word32 a, const Word32 b, const Word16 q )
{
Word32 hi;
UWord32 lo;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
Mpy_32_32_ss( a, b, &hi, &lo );
- return L_or( L_shl_o( hi, sub( 32 - 1, q ), &Overflow ), L_lshr( (Word32) lo, add( q, 1 ) ) );
+ return L_or( L_shl_sat( hi, sub( 32 - 1, q ) ), L_lshr( (Word32) lo, add( q, 1 ) ) );
}
static void fir_dwn_fx(
@@ -4503,23 +4529,40 @@ static void ivas_hq_phase_ecu_fx(
{
test();
test();
+#ifdef FIX_1179_USAN_PHASEECU
+ if ( !( prev_bfi != 0 && *last_fec != 0 && element_mode == EVS_MONO ) )
+ {
+ *time_offs = 0; /* IVAS reset of offset time counter, timeoffset variable later also used to calculate burst length */
+ move16();
+ }
+#else
// PMT("verify condition compared to float")
if ( !( prev_bfi != 0 && *last_fec != 0 && element_mode == EVS_MONO ) )
{
*time_offs = 0;
move16();
}
+#endif
offset = add( sub( sub( shl( output_frame, 1 ), lprot ), *time_offs ), ph_ecu_lookahead );
+#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
+ trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
+ *last_fec, element_mode, alpha, beta, beta_mute, Xavg );
+#else
trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
*last_fec, alpha, beta, beta_mute, Xavg );
+#endif
ivas_spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec, element_mode, &noise_fac, pcorr );
test();
IF( prev_bfi != 0 && *last_fec != 0 )
{
+#ifdef FIX_1179_USAN_PHASEECU
+ *time_offs = add_sat( *time_offs, output_frame ); /* when saturation is reached, this keeps the long term muting on */
+#else
*time_offs = add( *time_offs, output_frame );
+#endif
move16();
}
}
@@ -4528,8 +4571,13 @@ static void ivas_hq_phase_ecu_fx(
*time_offs = add_sat( *time_offs, output_frame );
move16();
offset = sub( shl( output_frame, 1 ), lprot );
+#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
+ trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
+ 0, element_mode, alpha, beta, beta_mute, Xavg );
+#else
trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
0, alpha, beta, beta_mute, Xavg );
+#endif
}
Copy( X_sav, X, lprot );
@@ -4608,7 +4656,9 @@ static void hq_phase_ecu_fx(
IF( prev_bfi == 0 || ( prev_bfi != 0 && *last_fec != 0 && ( EQ_16( *time_offs, output_frame ) ) ) )
{
test();
+#ifndef FIX_1179_USAN_PHASEECU
// PMT("verify condition compared to float")
+#endif
if ( !( prev_bfi != 0 && *last_fec != 0 ) )
{
*time_offs = 0;
@@ -4616,26 +4666,44 @@ static void hq_phase_ecu_fx(
}
offset = sub( sub( shl( output_frame, 1 ), lprot ), *time_offs );
+#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
+ trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
+ *last_fec, EVS_MONO, alpha, beta, beta_mute, Xavg );
+#else
trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
*last_fec, alpha, beta, beta_mute, Xavg );
+#endif
spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec );
test();
IF( prev_bfi != 0 && *last_fec != 0 )
{
+#ifdef FIX_1179_USAN_PHASEECU
+ *time_offs = add_sat( *time_offs, output_frame );
+#else
*time_offs = add( *time_offs, output_frame );
+#endif
move16();
}
}
ELSE
{
+#ifdef FIX_1179_USAN_PHASEECU
+ *time_offs = add_sat( *time_offs, output_frame );
+#else
*time_offs = add( *time_offs, output_frame );
+#endif
move16();
offset = sub( shl( output_frame, 1 ), lprot );
+#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
+ trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
+ 0, EVS_MONO, alpha, beta, beta_mute, Xavg );
+#else
trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
0, alpha, beta, beta_mute, Xavg );
+#endif
}
Copy( X_sav, X, lprot );
@@ -4645,7 +4713,11 @@ static void hq_phase_ecu_fx(
move16();
IF( *num_p > 0 )
{
+#ifdef FIX_1179_USAN_PHASEECU
+ seed = add_sat( seed, plocs[*num_p - 1] );
+#else
seed = add( seed, plocs[*num_p - 1] );
+#endif
}
subst_spec_fx( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed,
diff --git a/lib_dec/FEC_clas_estim_fx.c b/lib_dec/FEC_clas_estim_fx.c
index 2bd38153a3c533568ec9b21792b3d21df478853b..595e750f49e710ae9d93a00654cc8aed40850b8d 100644
--- a/lib_dec/FEC_clas_estim_fx.c
+++ b/lib_dec/FEC_clas_estim_fx.c
@@ -864,7 +864,7 @@ Word16 FEC_pos_dec_fx(
bit_pos_pitch_index = add( bit_pos_pitch_index, 1 );
}
/* retrieve the pitch index */
- pitch_index = (Word16) get_indice( st_fx, bit_pos_pitch_index, nBits );
+ pitch_index = (Word16) get_indice_fx( st_fx, bit_pos_pitch_index, nBits );
/* decode pitch period */
T0_min = PIT_MIN;
diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c
index 78594558b78dae073e4c787fe15fec99d45478cd..574e2e14f9e209a4cef2a1ea22b86bcbf3971dcd 100644
--- a/lib_dec/FEC_fx.c
+++ b/lib_dec/FEC_fx.c
@@ -95,10 +95,6 @@ void FEC_exc_estim_fx(
Word32 cond3;
Word32 predPitchLag;
GSC_DEC_HANDLE hGSCDec;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
hGSCDec = st_fx->hGSCDec;
AMRWB_IO_DEC_HANDLE hAmrwb_IO;
@@ -126,11 +122,7 @@ void FEC_exc_estim_fx(
gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */
}
-#ifdef ISSUE_1796_replace_shl_o
tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 );
-#else
- tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow );
-#endif
gainCNG = s_min( gainCNG, tmp1 );
set16_fx( exc_dct_in, 0, L_FRAME16k );
@@ -191,15 +183,9 @@ void FEC_exc_estim_fx(
{
test();
test();
-#ifdef ISSUE_1796_replace_shl_o
IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&
GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
-#else
- IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) &&
- GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
- GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
-#endif
{
/* take the pitch value of last subframe of the previous frame */
*tmp_tc = round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) );
@@ -210,15 +196,9 @@ void FEC_exc_estim_fx(
{
test();
test();
-#ifdef ISSUE_1796_replace_shl_o
IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&
GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
-#else
- IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_o( mult( 29491, st_fx->bfi_pitch_fx ), 1, &Overflow ) ) &&
- GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past */
- GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) ) /* or last update too far in the past */
-#endif
{
/* take the pitch value of last subframe of the previous frame */
@@ -313,7 +293,7 @@ void FEC_exc_estim_fx(
IF( LE_16( st_fx->nbLostCmpt, 1 ) )
{
/* if stable, do not decrease the energy, pitch_gain = 0 */
- alpha = mac_ro( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX, &Overflow ); /*st_fx->stab_fac_fx in Q15*/
+ alpha = mac_r_sat( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX ); /*st_fx->stab_fac_fx in Q15*/
}
ELSE IF( EQ_16( st_fx->nbLostCmpt, 2 ) )
{
@@ -362,7 +342,7 @@ void FEC_exc_estim_fx(
L_tmp = L_deposit_h( tmp );
L_tmp = Isqrt_lc( L_tmp, &exp );
- gain = extract_h( L_shl_o( L_tmp, exp, &Overflow ) );
+ gain = extract_h( L_shl_sat( L_tmp, exp ) );
gain = s_min( gain, 32113 ); /*0.98 */
gain = s_max( gain, 27853 ); /*0.85 */
@@ -768,12 +748,6 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1
{
Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e;
Word32 tmp_pit2;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
tmp_pit = BASOP_Util_Divide1616_Scale( new_pit /*Q0*/, Tc /*Q0*/, &tmp_pit_e ) /*Q15*/;
tmp_frame = add( extract_l( L_mult0( L_frame, 64 /*1.f/L_SUBFR Q12*/ ) /*Q12*/ ), 4096 /*1.f Q12*/ ); /*Q12*/
@@ -782,11 +756,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1
tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/
BASOP_SATURATE_WARNING_OFF_EVS
/*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/
-#ifdef ISSUE_1796_replace_shl_o
tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e );
-#else
- tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow );
-#endif
BASOP_SATURATE_WARNING_ON_EVS
*cond1 = sub( tmp_pit, negate( tmp_frame ) );
move16();
diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c
index 4c3fa372892f8ac06b81c987492a58e36e01eb4c..f07feac96a5a375ea4cec286dbce448833984e93 100644
--- a/lib_dec/LD_music_post_filter_fx.c
+++ b/lib_dec/LD_music_post_filter_fx.c
@@ -69,9 +69,6 @@ void LD_music_post_filter_fx(
Word16 mant, exp1, s_ave, tmp16, old_tmp16;
Word16 diff_sc;
Word16 old_tmp16_1;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
-#endif
move16();
move16();
move16();
@@ -186,7 +183,7 @@ void LD_music_post_filter_fx(
FOR( k = j; k < mfreq_bindiv_LD[i] + j; k++ )
{
/*m_ave += lf_E[k];*/
- Ltmp = L_add_o( lf_E[k], Ltmp, &Overflow ); /*2*Qdct+10*/
+ Ltmp = L_add_sat( lf_E[k], Ltmp ); /*2*Qdct+10*/
max_val = L_max( max_val, lf_E[k] );
}
Ltmp_max = L_max( Ltmp_max, max_val ); /*2*Qdct+10*/
@@ -442,9 +439,6 @@ static void spectrum_mod_dct_fx(
Word32 Lshift;
Word32 dot5_scaled;
const Word32 *Lpt2;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
-#endif
move16();
move32();
@@ -523,7 +517,7 @@ static void spectrum_mod_dct_fx(
IF( music_flag != 0 ) /* prevent subtraction on clean speech */
{
- IF( LE_32( maxNoise, L_shl_o( 10, scaling, &Overflow ) ) )
+ IF( LE_32( maxNoise, L_shl_sat( 10, scaling ) ) )
{
minE = 18432 / 2; /*Q14*/
move16();
@@ -599,16 +593,12 @@ static void spectrum_mod_dct_fx(
Ltmp = L_mult( tmpN, m_binE ); /*2*Qdct+e_binE+9*/
e_binE = sub( add( e_tmp, e_binE ), 15 );
-#ifdef ISSUE_1799_replace_L_shr_o
- Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/
-#else
- Ltmp = L_shr_o( Ltmp, e_binE, &Overflow ); /*2*Qdct+9*/
-#endif
- Lgain = L_add_o( Ltmp, Lshift, &Overflow ); /*Saturation can occure here result in Q30*/
+ Ltmp = L_shr_sat( Ltmp, e_binE ); /*2*Qdct+9*/
+ Lgain = L_add_sat( Ltmp, Lshift ); /*Saturation can occure here result in Q30*/
}
Lpt2++;
- gain = round_fx_o( Lgain, &Overflow ); /*gain in Q30-16 = Q14*/
+ gain = round_fx_sat( Lgain ); /*gain in Q30-16 = Q14*/
/*if (gain < minE)gain = minE;*/
gain = s_max( gain, minE ); /*Q14*/
/*if (gain > 1.0f+MAX_GN)gain = 1.0f+MAX_GN;*/
@@ -905,11 +895,6 @@ static Word16 norm_lfe(
{
Word32 Ltmp;
Word16 exp2, tmp16, exp3;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
-#endif
-#endif
move32();
@@ -929,11 +914,7 @@ static Word16 norm_lfe(
exp3 = sub( exp2, 12 + 16 - 3 ); /* if exp2 < 31, means that tmp >= 1.0 */
/* Need to shl by 3 to take into account the 3 multiplications */
}
-#ifdef ISSUE_1796_replace_shl_o
tmp16 = shl_sat( tmp16, exp3 ); /* Result in Q12 */
-#else
- tmp16 = shl_o( tmp16, exp3, &Overflow ); /* Result in Q12 */
-#endif
return tmp16;
}
diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c
index 2600605225057bfbda9307b0cb6e34d29b9fc554..cf32fdf5685c85d1ad738182bcf7bb4e3fc3dcf1 100644
--- a/lib_dec/acelp_core_dec_fx.c
+++ b/lib_dec/acelp_core_dec_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
#include
@@ -65,17 +65,14 @@ ivas_error acelp_core_dec_fx(
Word16 *unbits, /* o : number of unused bits */
Word16 *sid_bw, /* o : 0-NB/WB, 1-SWB SID */
STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle Qlog2(2.56)*/
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- const Word16 tdm_lspQ_PCh_fx[M], /* i : Q LSPs for primary channel Q15*/
-#endif
- const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */
- const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
- const Word16 last_element_mode, /* i : last element mode */
- const Word32 last_element_brate, /* i : last element bitrate */
- const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */
- const Word16 nchan_out, /* i : number of output channels */
- STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */
- const Word16 read_sid_info /* i : read SID info flag */
+ const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */
+ const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
+ const Word16 last_element_mode, /* i : last element mode */
+ const Word32 last_element_brate, /* i : last element bitrate */
+ const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */
+ const Word16 nchan_out, /* i : number of output channels */
+ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */
+ const Word16 read_sid_info /* i : read SID info flag */
)
{
Word32 synth_fx[960], save_hb_synth_fx[960] /*, bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]*/;
@@ -881,21 +878,13 @@ ivas_error acelp_core_dec_fx(
move16();
}
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#else
- config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, st->inactive_coder_type_flag, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#endif
test();
test();
IF( EQ_16( st->coder_type, TRANSITION ) && LT_16( tc_subfr, L_SUBFR ) && EQ_16( st->L_frame, L_FRAME ) )
{
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#else
- config_acelp1_fx( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, -1, &( st->acelp_cfg ), st->next_bit_pos, TRANSITION, -1, tc_subfr, 2, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#endif
}
}
@@ -939,22 +928,10 @@ ivas_error acelp_core_dec_fx(
ELSE
{
const Word16 *pt_interp_2_fx;
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- IF( NE_16( st->active_cnt, 1 ) )
- {
-#endif
- Word16 beta_index;
+ Word16 beta_index;
- beta_index = get_next_indice_fx( st, TDM_IC_LSF_PRED_BITS );
- tdm_SCh_lsf_reuse_fx( DEC, st->element_brate, lsf_new_fx, lsp_new_fx, tdm_lsfQ_PCh_fx, NULL, &beta_index );
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- }
- ELSE
- {
- Copy( tdm_lspQ_PCh_fx, lsp_new_fx, M );
- Copy( tdm_lsfQ_PCh_fx, lsf_new_fx, M );
- }
-#endif
+ beta_index = get_next_indice_fx( st, TDM_IC_LSF_PRED_BITS );
+ tdm_SCh_lsf_reuse_fx( DEC, st->element_brate, lsf_new_fx, lsp_new_fx, tdm_lsfQ_PCh_fx, NULL, &beta_index );
IF( st->rate_switching_reset )
{
@@ -992,7 +969,7 @@ ivas_error acelp_core_dec_fx(
tmpF_fx = *old_exc_s_fx;
st->mem_deemph_fx = shl_sat( old_exc_s_fx[st->L_frame - 1], st->Q_syn ); /* Q0 -> Q_syn */
move16();
- PREEMPH_FX( old_exc_s_fx, st->preemph_fac, L_FRAME16k, &tmpF_fx );
+ PREEMPH_FX( old_exc_s_fx, st->preemph_fac, st->L_frame, &tmpF_fx );
Copy( old_exc_s_fx + sub( st->L_frame, M ), st->mem_syn2_fx, M );
Scale_sig( st->mem_syn2_fx, M, st->Q_syn ); /* Q0 -> Q_syn */
Residu3_fx( Aq_fx, old_exc_s_fx, old_exc_fx + sub( L_EXC_MEM_DEC, st->L_frame ), st->L_frame, 0 );
@@ -1660,12 +1637,16 @@ ivas_error acelp_core_dec_fx(
IF( NE_16( st->element_mode, last_element_mode ) )
{
set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen );
+#ifdef FIX_1996_MASKING_NOISE
+ set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen );
+#endif
}
Word32 psyn_32_fx[L_FRAME16k];
- Copy_Scale_sig_16_32_no_sat( psyn_fx, psyn_32_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( Q6, st->Q_syn ) ); // Q6
+ Copy_Scale_sig_16_32_no_sat( psyn_fx, psyn_32_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( Q6, st->Q_syn ) ); // Q6
+#ifndef FIX_1996_MASKING_NOISE
Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), Q15 ); // Q15
-
+#endif
generate_masking_noise_ivas_fx( psyn_32_fx, &exp, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out );
Copy_Scale_sig_32_16( psyn_32_fx, psyn_fx, st->hFdCngDec->hFdCngCom->frameSize, sub( st->Q_syn, exp ) ); // Q = st->Q_syn
@@ -1757,6 +1738,9 @@ ivas_error acelp_core_dec_fx(
IF( st->idchan == 0 )
{
set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen );
+#ifdef FIX_1996_MASKING_NOISE
+ set32_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, st->hFdCngDec->hFdCngCom->fftlen );
+#endif
}
IF( hStereoCng != NULL && ( st->idchan == 0 ) )
{
diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c
index d166e433bce2bc2e1133fac3689acd16768aa11c..4b1e04e08b067331f0afb55cab6cb98ce8085391 100644
--- a/lib_dec/acelp_core_switch_dec_fx.c
+++ b/lib_dec/acelp_core_switch_dec_fx.c
@@ -128,11 +128,7 @@ ivas_error acelp_core_switch_dec_fx(
* Excitation decoding
*----------------------------------------------------------------*/
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, 0, 0, 0 );
-#else
- config_acelp1_fx( DEC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &decode_bwe /* dummy */, &i, st_fx->element_mode, &i /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, 0, 0 );
-#endif
decod_gen_voic_core_switch_fx( st_fx, L_frame_for_cs, 0, Aq, exc, cbrate, &st_fx->Q_exc );
@@ -876,12 +872,6 @@ static void decod_gen_voic_core_switch_fx(
Word16 *pt1;
GSC_DEC_HANDLE hGSCDec;
hGSCDec = st_fx->hGSCDec;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
-#endif
/*----------------------------------------------------------------------*
@@ -972,11 +962,7 @@ static void decod_gen_voic_core_switch_fx(
IF( st_fx->prev_bfi )
{
/*gain_code = min(gain_code, 0.5f*gain_code+0.5f*st->lp_gainc);*/
-#ifdef ISSUE_1796_replace_shl_o
gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_sat( 16384 >> 3, st_fx->Q_exc ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */
-#else
- gain_code16 = s_min( gain_code16, mac_r( L_mult( 16384, gain_code16 ), shl_o( 16384 >> 3, st_fx->Q_exc, &Overflow ), st_fx->lp_gainc_fx ) ); /* st_fx->lp_gainc_fx in Q3 >>3 to bring it to Q0 as gain_code16 */
-#endif
}
FOR( i = 0; i < L_SUBFR; i++ )
diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c
index 96ae82ddee71c1e6a9a0115bce5ce2e84dea8334..d5a3cf71a2f35b0b650407150d408758869ea412 100644
--- a/lib_dec/amr_wb_dec_fx.c
+++ b/lib_dec/amr_wb_dec_fx.c
@@ -463,7 +463,7 @@ ivas_error amr_wb_dec_fx(
* Extracts VAD information from the bitstream in AMR-WB IO mode
*------------------------------------------------------------*/
- vad_flag = (Word16) get_next_indice( st_fx, 1 );
+ vad_flag = (Word16) get_next_indice_fx( st_fx, 1 );
move16();
st_fx->coder_type = GENERIC;
diff --git a/lib_dec/ari_hm_dec_fx.c b/lib_dec/ari_hm_dec_fx.c
index ef4fb62d5579e0f89500a76227fbe459a7f1719e..51949328c550ed6428311ee6c78ec5efc42c53fd 100644
--- a/lib_dec/ari_hm_dec_fx.c
+++ b/lib_dec/ari_hm_dec_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c
index 60a59c4da469f113f7195179ed0521d2c343bc2d..77ae166b450b57fd108d9f0a948e902fb0772a3f 100644
--- a/lib_dec/arith_coder_dec_fx.c
+++ b/lib_dec/arith_coder_dec_fx.c
@@ -27,11 +27,16 @@ static Word16 tcx_arith_decode_fx(
Tastat as;
Word16 exp_k;
Word16 tmp;
- Word32 L_tmp, Q;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ Word32 L_tmp, Q;
Flag Overflow = 0;
move32();
Flag Carry = 0;
+#else
+ Word32 Q;
+ Word64 W_tmp;
+#endif
move32();
#endif
@@ -39,7 +44,11 @@ static Word16 tcx_arith_decode_fx(
bp = ari_start_decoding_14bits_prm_fx( prm, 0, &as );
tmp = sub( envelope_e, 1 + 15 );
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp = L_deposit_l( 0 );
+#else
+ W_tmp = 0;
+#endif
FOR( k = 0; k < L_frame; k++ )
{
IF( envelope[k] == 0 ) /* safety check in case of bit errors */
@@ -63,7 +72,11 @@ static Word16 tcx_arith_decode_fx(
{
bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as );
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp = L_macNs_co( L_tmp, q, k, &Carry, &Overflow );
+#else
+ W_tmp = W_mac_16_16( W_tmp, q, k );
+#endif
Q = L_mult( q, negate( shl( 1, sub( 30, SPEC_EXP_DEC ) ) ) );
IF( EQ_16( s, 0 ) )
@@ -88,7 +101,11 @@ static Word16 tcx_arith_decode_fx(
set32_fx( q_spectrum + k, 0, sub( L_frame, k ) );
/* noise filling seed */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
*nf_seed = extract_l( L_tmp );
+#else
+ *nf_seed = extract_l( W_extract_l( W_tmp ) );
+#endif
move16();
return bp;
diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c
index 4a5ef932892437f9d1ac7662c765c3aece88f343..599c3aa987e9d0bea88edef76cab6c89f2166a17 100644
--- a/lib_dec/bass_psfilter_fx.c
+++ b/lib_dec/bass_psfilter_fx.c
@@ -555,7 +555,11 @@ void bass_psfilter_fx(
FOR( i = 0; i < subfr_len; i++ )
{
/* err[i] = syn_fx[i] - gain*syn2_fx[i] */
+#ifdef FIX2007_BASSPSFILTER_OVERFLOW
+ err[i] = msu_r( L_shr_sat( L_mult0( gain, syn2_fx[i] ), exp2 ), syn_fx[i], 16384 ); /* Q15 */
+#else
err[i] = msu_r( L_shr( L_mult0( gain, syn2_fx[i] ), exp2 ), syn_fx[i], 16384 ); /* Q15 */
+#endif
move16();
/* the sign is inverted but it is not important because
we calculate energy with 'err[i]' x 'err[i]'
diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c
index fdb6488db8232ce7f77edebb2a5ea5fbb61a84b6..dec4a7adfc69062048f09c452fcfcff62b4baae2 100644
--- a/lib_dec/cng_dec_fx.c
+++ b/lib_dec/cng_dec_fx.c
@@ -74,10 +74,6 @@ void CNG_dec_fx(
Word16 enr_new, Aq_tmp[M + 1];
Word16 LSF_Q_prediction; /* o : LSF prediction mode - just temporary variable in CNG */
TD_CNG_DEC_HANDLE hTdCngDec;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
hTdCngDec = st_fx->hTdCngDec;
m = 0;
@@ -522,7 +518,7 @@ void CNG_dec_fx(
FOR( i = 0; i < M; i++ )
{
dev = abs_s( sub( lsp_tmp[i], lsp_new[i] ) ); /*Q15*/
- dist = add_o( dist, dev, &Overflow ); /*Q15*/
+ dist = add_sat( dist, dev ); /*Q15*/
if ( GT_16( dev, max_dev ) )
{
max_dev = dev;
diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c
index 9430f2ac5e861eeec050569cd17fad8ac96f01e5..aa86fc624108f4423398bb03bc4946f162b63375 100644
--- a/lib_dec/core_dec_init_fx.c
+++ b/lib_dec/core_dec_init_fx.c
@@ -55,9 +55,9 @@ void open_decoder_LPD_fx(
fscaleFB = sr2fscale_fx( st->output_Fs );
/* initializing variables for frame lengths etc. right in the beginning */
- st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) );
+ st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) );
move16();
- hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) );
+ hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) );
move16();
IF( st->ini_frame == 0 )
{
@@ -396,15 +396,11 @@ void open_decoder_LPD_fx(
move16();
Copy( hHQ_core->fer_samples_fx + delay_comp, hTcxDec->syn_OverlFB, shr( hTcxDec->L_frameTCX, 1 ) ); /* hHQ_core->Q_fer_samples*/
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hTcxDec->Q_syn_OverlFB = hHQ_core->Q_fer_samples;
move16();
-#endif
lerp( hHQ_core->fer_samples_fx + delay_comp, hTcxDec->syn_Overl, shr( st->L_frame, 1 ), shr( hTcxDec->L_frameTCX, 1 ) ); /*Q0: ACELP(bfi)->TCX(rect)*/
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hTcxDec->Q_syn_Overl = hHQ_core->Q_fer_samples;
move16();
-#endif
/*old_out needed for MODE1 routine and syn_Overl_TDAC for MODE2 routine*/
hHQ_core->Q_old_wtda = -1;
@@ -1077,15 +1073,11 @@ void acelp_plc_mdct_transition_fx(
move16(); /*CLDFB delay*/
Copy( st->hHQ_core->fer_samples_fx + delay_comp, st->hTcxDec->syn_OverlFB, shr( st->hTcxDec->L_frameTCX, 1 ) ); /* Q_fer_samples */
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hTcxDec->Q_syn_OverlFB = st->hHQ_core->Q_fer_samples;
move16();
-#endif
lerp( st->hHQ_core->fer_samples_fx + delay_comp, st->hTcxDec->syn_Overl, shr( st->L_frame, 1 ), shr( st->hTcxDec->L_frameTCX, 1 ) ); /*ACELP(bfi)->TCX(rect)*/
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hTcxDec->Q_syn_Overl = st->hHQ_core->Q_fer_samples;
move16();
-#endif
/*old_out needed for MODE1 routine and syn_Overl_TDAC for MODE2 routine*/
st->hHQ_core->Q_old_wtda = -1;
move16();
@@ -1167,7 +1159,7 @@ void open_decoder_LPD_ivas_fx(
move16();
/* initializing variables for frame lengths etc. right in the beginning */
- st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); /* 0.02 in Q15 */
+ st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) );
move16();
if ( st->ini_frame == 0 )
{
@@ -1177,7 +1169,7 @@ void open_decoder_LPD_ivas_fx(
}
IF( st->hTcxDec != NULL )
{
- st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); /* 0.02 in Q15 */
+ st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) );
move16();
st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */
move16();
@@ -2105,11 +2097,9 @@ void reset_tcx_overl_buf_fx(
set16_fx( hTcxDec->syn_Overl, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/
hTcxDec->Q_syn_Overl = 0;
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
set16_fx( hTcxDec->syn_OverlFB, 0, L_FRAME48k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/
hTcxDec->Q_syn_OverlFB = 0;
move16();
-#endif
set16_fx( hTcxDec->syn_Overl_TDACFB, 0, L_FRAME_MAX / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/
hTcxDec->Q_syn_Overl_TDACFB = 0;
move16();
diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c
index 94b6efb1bd051fd5f71bf9fab7d3a5c68025d7a2..90379c732ac7df169ca5a03eba2624a84d2eac84 100644
--- a/lib_dec/core_dec_switch_fx.c
+++ b/lib_dec/core_dec_switch_fx.c
@@ -99,10 +99,10 @@ void mode_switch_decoder_LPD_fx(
move16();
st->fscale = fscale;
move16();
- st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); /* Q0 */
+ st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); /* Q0 */
IF( hTcxDec != NULL )
{
- hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); /* Q0 */
+ hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); /* Q0 */
move16();
}
IF( st->hTcxCfg != NULL )
@@ -320,7 +320,7 @@ void mode_switch_decoder_LPD_ivas_fx(
test();
test();
- assert( (Word16) ( st->sr_core / FRAMES_PER_SEC ) == extract_l( Mult_32_16( st->sr_core, 0x0290 ) ) );
+ assert( (Word16) ( st->sr_core / FRAMES_PER_SEC ) == extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ) );
IF( NE_16( fscale, st->fscale ) || switchWB || bSwitchFromAmrwbIO || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset )
{
open_decoder_LPD_ivas_fx( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0, Q_syn_Overl_TDAC, Q_fer_samples, Q_syn_Overl, Q_syn_Overl_TDACFB, Q_syn_OverlFB, Q_old_out, Q_old_outLB, Q_old_Aq_12_8 );
@@ -332,11 +332,11 @@ void mode_switch_decoder_LPD_ivas_fx(
move16();
st->fscale = fscale;
move16();
- st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) );
+ st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) );
move16();
IF( st->hTcxDec != NULL )
{
- st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); /* Q0 */
+ st->hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); /* Q0 */
move16();
st->output_frame_fx = st->hTcxDec->L_frameTCX; /* Q0 */
move16();
diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c
index 106cb0e607d8e70d73cb89197d08eef43658344c..be95ebaf006cbfe800c81c7fa7be8a18403beb8f 100644
--- a/lib_dec/core_switching_dec_fx.c
+++ b/lib_dec/core_switching_dec_fx.c
@@ -181,10 +181,6 @@ void bw_switching_pre_proc_fx(
Word16 i;
Word16 syn_dct_fx[L_FRAME];
Word32 L_tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
IF( st_fx->element_mode > EVS_MONO )
{
@@ -198,7 +194,7 @@ void bw_switching_pre_proc_fx(
* Calculate tilt of the ACELP core synthesis
*----------------------------------------------------------------------*/
- st_fx->tilt_wb_fx = round_fx_o( L_shl_o( calc_tilt_bwe_fx( old_syn_12k8_16k_fx, -1, st_fx->L_frame ), 3, &Overflow ), &Overflow ); /* Q11 */
+ st_fx->tilt_wb_fx = round_fx_sat( L_shl_sat( calc_tilt_bwe_fx( old_syn_12k8_16k_fx, -1, st_fx->L_frame ), 3 ) ); /* Q11 */
move16();
/*-------------------------------------------------------------------------------*
* Calculate frequency energy of 0~3.2kHz and 3.2~6.4kHz the ACELP core synthesis
@@ -209,7 +205,7 @@ void bw_switching_pre_proc_fx(
L_tmp = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME / 2; i++ )
{
- L_tmp = L_mac0_o( L_tmp, syn_dct_fx[i], syn_dct_fx[i], &Overflow ); /* (2 * Q_syn2) */
+ L_tmp = L_mac0_sat( L_tmp, syn_dct_fx[i], syn_dct_fx[i] ); /* (2 * Q_syn2) */
}
L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */
st_fx->enerLL_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */
@@ -217,7 +213,7 @@ void bw_switching_pre_proc_fx(
L_tmp = L_deposit_l( 0 );
FOR( ; i < L_FRAME; i++ )
{
- L_tmp = L_mac0_o( L_tmp, syn_dct_fx[i], syn_dct_fx[i], &Overflow );
+ L_tmp = L_mac0_sat( L_tmp, syn_dct_fx[i], syn_dct_fx[i] );
}
L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */
st_fx->enerLH_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */
@@ -230,7 +226,7 @@ void bw_switching_pre_proc_fx(
L_tmp = L_deposit_l( 0 );
FOR( i = 0; i < 32; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */
+ L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */
}
L_tmp = L_shr( L_tmp, 5 ); /* 2 * Q_syn2 */
st_fx->enerLL_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */
@@ -238,7 +234,7 @@ void bw_switching_pre_proc_fx(
L_tmp = L_deposit_l( 0 );
FOR( ; i < 64; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */
+ L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */
}
L_tmp = L_shr( L_tmp, 5 ); /* 2 * Q_syn2 */
st_fx->enerLH_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */
@@ -249,7 +245,7 @@ void bw_switching_pre_proc_fx(
L_tmp = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME / 2; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */
+ L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */
}
L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */
st_fx->enerLL_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */
@@ -257,7 +253,7 @@ void bw_switching_pre_proc_fx(
L_tmp = L_deposit_l( 0 );
FOR( ; i < L_FRAME; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i], &Overflow ); /* 2 * Q_syn2 */
+ L_tmp = L_mac0_sat( L_tmp, st_fx->t_audio_q_fx[i], st_fx->t_audio_q_fx[i] ); /* 2 * Q_syn2 */
}
L_tmp = L_shr( L_tmp, 7 ); /* 2 * Q_syn2 */
st_fx->enerLH_fx = Calc_freq_ener_fx( L_tmp, shl( st_fx->Q_syn2, 1 ) ); /* Q_syn2 */
@@ -1634,14 +1630,26 @@ ivas_error core_switching_post_dec_ivas_fx(
test();
IF( EQ_16( st_fx->last_core, HQ_CORE ) || st_fx->last_core == TCX_20_CORE || st_fx->last_core == TCX_10_CORE ) /* MDCT to ACELP transition */
{
+#ifdef FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES
+ Word16 Q_old_postdec = 0;
+ move16();
+#endif
Qtmp = s_min( *Qsynth, 0 );
IF( hHQ_core != NULL )
{
Qtmp = s_min( s_min( *Qsynth, hHQ_core->Q_old_postdec ), hHQ_core->Q_old_wtda );
+#ifdef FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES
+ Q_old_postdec = hHQ_core->Q_old_postdec;
+ move16();
+#endif
}
Scale_sig( synth, output_frame, sub( Qtmp, *Qsynth ) ); /* Qtmp */
+#ifndef FIX_ISSUE_2013_MDCT_STEREO_DTX_DISCONTINUITIES
Scale_sig( st_fx->delay_buf_out_fx, delay_comp, Qtmp ); /*delay buff_out_fx is Q0*/
+#else
+ Scale_sig( st_fx->delay_buf_out_fx, delay_comp, sub( Qtmp, Q_old_postdec ) ); /* delay buff_out_fx is Qtmp */
+#endif
IF( hHQ_core != NULL )
{
Scale_sig( hHQ_core->old_out_fx, L_FRAME48k, sub( Qtmp, hHQ_core->Q_old_wtda ) ); /* Qtmp */
@@ -1699,6 +1707,9 @@ ivas_error core_switching_post_dec_ivas_fx(
move16();
ptmp1++;
ptmp2++;
+#ifdef FIX_ISSUE_2013_MDCT_STEREO_FER_DISCONTINUITIES
+ tmpF = add( tmpF, tmp ); /* Q15 */
+#endif
}
}
ELSE
@@ -2450,8 +2461,11 @@ ivas_error core_switching_pre_dec_ivas_fx(
test();
test();
test();
- IF( ( ( ( st->core == ACELP_CORE ) || EQ_16( st->core, AMR_WB_CORE ) ) && EQ_16( st->last_core, HQ_CORE ) ) || ( ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( nchan_out, 2 ) &&
- NE_32( st->core_brate, SID_2k40 ) && ( st->core_brate != FRAME_NO_DATA ) && ( ( last_core_brate_st0 == FRAME_NO_DATA ) || EQ_32( last_core_brate_st0, SID_2k40 ) ) ) )
+ test();
+ test();
+ IF( ( ( ( st->core == ACELP_CORE ) || EQ_16( st->core, AMR_WB_CORE ) ) && EQ_16( st->last_core, HQ_CORE ) ) ||
+ ( ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( nchan_out, 2 ) && NE_32( st->core_brate, SID_2k40 ) && ( st->core_brate != FRAME_NO_DATA ) && ( ( last_core_brate_st0 == FRAME_NO_DATA ) || EQ_32( last_core_brate_st0, SID_2k40 ) ) ) ||
+ ( st->core == ACELP_CORE && GT_16( st->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ )
{
test();
if ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) )
@@ -2981,9 +2995,6 @@ void ivas_bw_switching_pre_proc_fx(
Word32 syn_dct_fx[L_FRAME];
- Flag Overflow = 0;
- move32();
-
IF( st->element_mode > EVS_MONO )
{
test();
@@ -3065,7 +3076,7 @@ void ivas_bw_switching_pre_proc_fx(
move32();
FOR( i = 0; i < 32; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow );
+ L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] );
}
tmp = L_shr( L_tmp, 5 ); // divide by 32
tmp = getSqrtWord32( tmp );
@@ -3078,7 +3089,7 @@ void ivas_bw_switching_pre_proc_fx(
move32();
FOR( ; i < 64; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow );
+ L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] );
}
tmp = L_shr( L_tmp, 5 ); // divide by 32
@@ -3094,7 +3105,7 @@ void ivas_bw_switching_pre_proc_fx(
move32();
FOR( i = 0; i < L_FRAME / 2; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow );
+ L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] );
}
tmp = L_shr( L_tmp, 5 ); // divide by 32
tmp = getSqrtWord32( tmp );
@@ -3107,7 +3118,7 @@ void ivas_bw_switching_pre_proc_fx(
move32();
FOR( ; i < L_FRAME; i++ )
{
- L_tmp = L_mac0_o( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i], &Overflow );
+ L_tmp = L_mac0_sat( L_tmp, st->t_audio_q_fx[i], st->t_audio_q_fx[i] );
}
tmp = L_shr( L_tmp, 5 ); // divide by 32
tmp = getSqrtWord32( tmp );
diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c
index 5549cc809ad29574368e183f5c9d4d96a91604f3..6a06df2678b6e665c8bc76554d4def55120bf8da 100644
--- a/lib_dec/dec_LPD_fx.c
+++ b/lib_dec/dec_LPD_fx.c
@@ -36,7 +36,11 @@ void decoder_LPD_fx(
)
{
Word16 *param_lpc;
+#ifdef FIX_1320_STACK_CPE_DECODER
+ Word16 synth_buf[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M];
+#else
Word16 synth_buf[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
+#endif
Word16 *synth;
Word16 synth_bufFB[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
Word16 *synthFB;
@@ -114,7 +118,11 @@ void decoder_LPD_fx(
synth = synth_buf + hTcxDec->old_synth_len;
/*st->old_synth: Q_0*/
Copy( hTcxDec->old_synth, synth_buf, hTcxDec->old_synth_len );
+#ifdef FIX_1320_STACK_CPE_DECODER
+ set16_fx( synth, 0, L_FRAME_PLUS_INTERNAL + M );
+#else
set16_fx( synth, 0, L_FRAME_PLUS + M );
+#endif
synthFB = synth_bufFB + hTcxDec->old_synth_lenFB;
Copy( hTcxDec->old_synthFB_fx, synth_bufFB, hTcxDec->old_synth_lenFB );
diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c
index edc429459e1a613dacdfefa6a0bf8b55c16b276f..b6554e02c7343616afa751b98551660230abc8bf 100644
--- a/lib_dec/dec_ace_fx.c
+++ b/lib_dec/dec_ace_fx.c
@@ -532,8 +532,13 @@ void decoder_acelp_fx(
move16();
IF( st->igf != 0 )
{
+#ifdef FIX_2010_PREP_TBE_EXC
+ prep_tbe_exc_fx( st->L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc,
+ gain_preQ, code_preQ, Q10, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 );
+#else
prep_tbe_exc_fx( st->L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc,
gain_preQ, code_preQ, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 );
+#endif
}
/*---------------------------------------------------------*
@@ -690,10 +695,8 @@ void decoder_acelp_fx(
E_UTIL_deemph2( st->Q_syn, syn, st->preemph_fac, st->L_frame, &tmp_deemph ); /* tmp_deemph and syn in Q0 starting from here*/
bufferCopyFx( syn + shr( st->L_frame, 1 ), hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), 0 /*Qf_syn*/, -1 /*Qf_old_xnq*/, 0, 0 /*Q_old_xnq*/ );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hTcxDec->Q_old_syn_Overl = sub( st->Q_syn, 1 );
move16();
-#endif
Copy( syn + sub( st->L_frame, M + 1 ), st->syn, 1 + M ); /*Q0*/
diff --git a/lib_dec/dec_acelp_tcx_main_fx.c b/lib_dec/dec_acelp_tcx_main_fx.c
index eea558914c2af6701f3cca58975eaa6ed3a5a4d7..3ff22158846d47df64e98b4e00fcaf84eb034bd9 100644
--- a/lib_dec/dec_acelp_tcx_main_fx.c
+++ b/lib_dec/dec_acelp_tcx_main_fx.c
@@ -61,7 +61,7 @@ static void decode_frame_type_fx( Decoder_State *st )
/* SID frame */
ELSE IF( EQ_32( st->total_brate, SID_2k40 ) )
{
- st->cng_type = get_next_indice( st, 1 );
+ st->cng_type = get_next_indice_fx( st, 1 );
move16();
if ( NE_16( st->cng_type, FD_CNG ) )
{
@@ -72,10 +72,10 @@ static void decode_frame_type_fx( Decoder_State *st )
move16();
frame_size_index = 1;
move16();
- st->bwidth = get_next_indice( st, 2 );
+ st->bwidth = get_next_indice_fx( st, 2 );
move16();
- frame_len_indicator = get_next_indice( st, 1 );
+ frame_len_indicator = get_next_indice_fx( st, 1 );
IF( EQ_16( st->bwidth, NB ) )
{
if ( frame_len_indicator )
@@ -146,7 +146,7 @@ static void decode_frame_type_fx( Decoder_State *st )
{
/* Get bandwidth mode */
- st->bwidth = get_next_indice( st, FrameSizeConfig[frame_size_index].bandwidth_bits );
+ st->bwidth = get_next_indice_fx( st, FrameSizeConfig[frame_size_index].bandwidth_bits );
move16();
st->bwidth = add( st->bwidth, FrameSizeConfig[frame_size_index].bandwidth_min );
@@ -180,7 +180,7 @@ static void decode_frame_type_fx( Decoder_State *st )
IF( FrameSizeConfig[frame_size_index].reserved_bits && st->rf_flag == 0 )
{
Word16 dummyBit;
- dummyBit = (Word8) get_next_indice( st, 1 );
+ dummyBit = (Word8) get_next_indice_fx( st, 1 );
move16();
if ( dummyBit != 0 )
{
diff --git a/lib_dec/dec_amr_wb_fx.c b/lib_dec/dec_amr_wb_fx.c
index 500fe34bab921a2c385caf751d34616d63e0045f..c5b08a784c0f3fa6cd8fd63f925dbc23dc60c16e 100644
--- a/lib_dec/dec_amr_wb_fx.c
+++ b/lib_dec/dec_amr_wb_fx.c
@@ -127,7 +127,7 @@ void decod_amr_wb_fx(
IF( EQ_32( st_fx->core_brate, ACELP_23k85 ) )
{
- hf_gain_fx[i_subfr / 64] = (Word16) get_next_indice( st_fx, 4 );
+ hf_gain_fx[i_subfr / 64] = (Word16) get_next_indice_fx( st_fx, 4 );
move16();
}
diff --git a/lib_dec/dec_gen_voic_fx.c b/lib_dec/dec_gen_voic_fx.c
index ac1df74b23ec19152873c6464a294100f5ad86a0..39412a22e85a936a91905ce3689b58f7f82658ea 100644
--- a/lib_dec/dec_gen_voic_fx.c
+++ b/lib_dec/dec_gen_voic_fx.c
@@ -100,6 +100,10 @@ ivas_error decod_gen_voic_fx(
Word16 pf_temp[MAXLAG_WI];
Word16 pf_n2[MAXLAG_WI];
MUSIC_POSTFILT_HANDLE hMusicPF;
+#ifdef FIX_2010_PREP_TBE_EXC
+ Word16 Q_code_preQ;
+#endif
+
gain_pit_fx = 0;
gain_code_fx = 0;
norm_gain_code_fx = 0;
@@ -322,10 +326,33 @@ ivas_error decod_gen_voic_fx(
idx = idiv1616( i_subfr_fx, L_SUBFR );
}
+#ifdef FIX_2010_PREP_TBE_EXC
+ /*
+ 2025-09-15 multrus:
+ TODO:
+ check with vaillancourt
+ - where this difference between EVS and IVAS comes from
+ - where Q_code_preQ could be derived
+ - whether any of the above calculations need to be adjusted
+ */
+ Q_code_preQ = Q6;
+ move16();
+ if ( EQ_16( st_fx->element_mode, EVS_MONO ) )
+ {
+ Q_code_preQ = Q10;
+ move16();
+ }
+
+ prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
+ &voice_factors_fx[idx], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_code_preQ,
+ st_fx->Q_exc, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
+ st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
&voice_factors_fx[idx], bwe_exc_fx, gain_preQ_fx, code_preQ_fx,
st_fx->Q_exc, T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#endif
/*----------------------------------------------------------------*
diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c
index bc638b1a13e6c264bb17bb2eeb6fa32a74ad7a40..5687f3b79073903ff34970148ea2cdeab3520cc2 100644
--- a/lib_dec/dec_higher_acelp_fx.c
+++ b/lib_dec/dec_higher_acelp_fx.c
@@ -30,12 +30,6 @@ void transf_cdbk_dec_fx(
Word32 L_tmp;
Word32 dct_code32[L_SUBFR];
Word16 qdct;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
Word16 avq_bit_sFlag;
Word16 trgtSvPos;
Word16 Nsv;
@@ -144,11 +138,7 @@ void transf_cdbk_dec_fx(
}
FOR( i = 0; i < L_SUBFR; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
code_preQ[i] = shl_sat( code_preQ[i], q_Code_preQ );
-#else
- code_preQ[i] = shl_o( code_preQ[i], q_Code_preQ, &Overflow );
-#endif
move16(); /* code_preQ in Q6*/
}
diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c
index e82394fbbca1343d2f561f6f14b2ac09d1e11c21..ad80b53f8d27e3de7c0b4ee9a7c3201f3b6d14e4 100644
--- a/lib_dec/dec_pit_exc_fx.c
+++ b/lib_dec/dec_pit_exc_fx.c
@@ -73,12 +73,6 @@ void dec_pit_exc_fx(
Word16 use_fcb;
Word32 gc_mem[NB_SUBFR - 1]; /* gain_code from previous subframes */
Word16 gp_mem[NB_SUBFR - 1]; /* gain_pitch from previous subframes */
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
use_fcb = 0;
move16();
@@ -250,11 +244,7 @@ void dec_pit_exc_fx(
gain_pit_fx = st_fx->lp_gainp_fx;
move16();
}
-#ifdef ISSUE_1796_replace_shl_o
gain_code_fx = L_mult0( s_max( sub( 32767, shl_sat( gain_pit_fx, 1 ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/
-#else
- gain_code_fx = L_mult0( s_max( sub( 32767, shl_o( gain_pit_fx, 1, &Overflow ) ), 16384 /*0.5.Q15*/ ), st_fx->lp_gainc_fx ); /* Use gain pitch and past gain code as an indicator to help finding the best scaling value. gain_code_fx used a temp var*/
-#endif
}
/*----------------------------------------------------------------------*
diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c
index f11f851cbb6eb333caabc2d00fa28b3ddf127001..7c1e949cafbbe6f74bc782e2b6c27b78303719aa 100644
--- a/lib_dec/dec_post_fx.c
+++ b/lib_dec/dec_post_fx.c
@@ -493,20 +493,12 @@ static void modify_pst_param_fx(
Word16 tmp;
Word16 lp_noiseQ12;
Word32 L_tmp;
-#ifndef ISSUE_1796_replace_shl_o
- Flag Overflow = 0;
- move16();
-#endif
test();
IF( NE_16( coder_type, INACTIVE ) && LT_16( lp_noise, LP_NOISE_THR_FX ) )
{
-#ifdef ISSUE_1796_replace_shl_o
lp_noiseQ12 = shl_sat( lp_noise, 4 ); /* to go from Q8 to Q12 */
-#else
- lp_noiseQ12 = shl_o( lp_noise, 4, &Overflow ); /* to go from Q8 to Q12 */
-#endif
/* ftmp = lp_noise*BG1_FX + CG1_FX */
tmp = mac_r( CG1_FX * 65536L, lp_noiseQ12, BG1_FX * 8 ); /* x8 to go from Q12 to Q15 */
@@ -577,10 +569,6 @@ static void pst_ltp_fx(
Word16 gain_plt;
Word16 off_yup;
Word16 nb_sh_sig;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
/* i signal justified on 13 bits */
@@ -679,7 +667,7 @@ static void pst_ltp_fx(
/* decrease gain in noisy condition */
/* gain_plt += (1.0f-gain_plt) * gain_factor */
/* gain_plt = gain_plt + gain_factor - gain_plt*gain_factor */
- gain_plt = msu_ro( L_msu( L_deposit_h( gain_plt ), gain_plt, gain_factor ), -32768, gain_factor, &Overflow ); // Q15
+ gain_plt = msu_r_sat( L_msu( L_deposit_h( gain_plt ), gain_plt, gain_factor ), -32768, gain_factor ); // Q15
/** filtering by H0(z) = harmonic filter **/
filt_plt_fx( ptr_sig_in, ptr_y_up, ptr_sig_pst0, gain_plt );
@@ -1423,10 +1411,6 @@ void Filt_mu_fx(
Word16 n;
Word16 mu, mu2, ga, temp;
Word16 fact, sh_fact;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
IF( parcor0 > 0 )
@@ -1452,7 +1436,7 @@ void Filt_mu_fx(
temp = sub( 1, abs_s( mu ) );
BASOP_SATURATE_WARNING_OFF_EVS;
- mu2 = add_o( 32767, temp, &Overflow ); /* Q15 (1 - |mu|) */
+ mu2 = add_sat( 32767, temp ); /* Q15 (1 - |mu|) */
BASOP_SATURATE_WARNING_ON_EVS;
ga = div_s( fact, mu2 ); /* Q(sh_fact) / (1 - |mu|) */
@@ -1492,10 +1476,6 @@ void Filt_mu_ivas_fx(
Word16 n;
Word16 mu, mu2, ga, temp;
Word16 fact, sh_fact;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
IF( EQ_16( extl, SWB_TBE ) )
{
@@ -1546,7 +1526,7 @@ void Filt_mu_ivas_fx(
temp = sub( 1, abs_s( mu ) );
BASOP_SATURATE_WARNING_OFF_EVS;
- mu2 = add_o( 32767, temp, &Overflow ); /* Q15 (1 - |mu|) */
+ mu2 = add_sat( 32767, temp ); /* Q15 (1 - |mu|) */
BASOP_SATURATE_WARNING_ON_EVS;
ga = div_s( fact, mu2 ); /* Q(sh_fact) / (1 - |mu|) */
@@ -1688,18 +1668,14 @@ void blend_subfr2_fx(
Word16 fac2 = 0 + 512; // 0.Q15 + ( 1.Q15 / L_SUBFR );
Word16 step = 1024; // 1.Q15 / ( L_SUBFR / 2 );
Word16 i;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
move16();
move16();
move16();
FOR( i = 0; i < L_SUBFR / 2; i++ )
{
- sigOut[i] = mac_ro( L_mult_o( fac1, sigIn1[i], &Overflow ), fac2, sigIn2[i], &Overflow ); // Qx
- fac1 = sub_o( fac1, step, &Overflow );
- fac2 = add_o( fac2, step, &Overflow );
+ sigOut[i] = mac_r_sat( L_mult_sat( fac1, sigIn1[i] ), fac2, sigIn2[i] ); // Qx
+ fac1 = sub_sat( fac1, step );
+ fac2 = add_sat( fac2, step );
move16();
}
diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c
index d1d290b86f8fd35af06008949990ac1a6b9f90f9..68f7f02f39a92bc42b8f642461d8a87661dcf817 100644
--- a/lib_dec/dec_tcx_fx.c
+++ b/lib_dec/dec_tcx_fx.c
@@ -13,14 +13,16 @@
#include "ivas_prot_fx.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
+
+
extern const Word16 T_DIV_L_Frame[]; /*0Q15 * 2^-7 */
-static Word32 CalculateAbsEnergy_fx( /* o : normalized result Q31 */
- const Word32 L_off, /* i : initial sum value Qn */
- const Word16 x[], /* i : x vector Qn */
- const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */
- Word16 *exp /* o : exponent of result in [-32,31] Q0 */
+/* o : normalized result Q31 */
+static Word32 CalculateAbsEnergy_fx(
+ const Word32 L_off, /* i : initial sum value Qn */
+ const Word16 x[], /* i : x vector Qn */
+ const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */
+ Word16 *exp /* o : exponent of result in [-32,31] Q0 */
);
void decoder_tcx_fx(
@@ -547,7 +549,7 @@ void decoder_tcx_fx(
st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ );
move16();
tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e );
- st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow );
+ st->last_gain_syn_deemph = round_fx_sat( tmp32 );
move16();
/*for avoiding compiler warnings*/
hTcxDec->gainHelper = 32768 / 2;
@@ -1276,10 +1278,6 @@ void decoder_tcx_post_fx( Decoder_State *st_fx,
Word32 tmp32;
Word32 tmp32_1, tmp32_2;
TCX_DEC_HANDLE hTcxDec;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
hTcxDec = st_fx->hTcxDec;
@@ -1351,7 +1349,7 @@ void decoder_tcx_post_fx( Decoder_State *st_fx,
}
tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) );
tmp2 = norm_l( tmp32 );
- tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow );
+ tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) );
s = sub( sub( sub( 1, shl( s, 1 ) ), 6 /*table lookup for inverse framelength*/ ), tmp2 );
tmp1 = Sqrt16( tmp1, &s );
move16();
@@ -1444,18 +1442,18 @@ void decoder_tcx_post_fx( Decoder_State *st_fx,
&tmp1 );
tmp2 = BASOP_Util_Add_MantExp( hTcxDec->conceal_eof_gain, 15 - 14, negate( tmp1 ), tmp2, &tmp1 );
- step = L_shl_o( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ), &Overflow ); /*Q30*/
+ step = L_shl_sat( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ) ); /*Q30*/
{
Word32 stepFB;
UWord32 dmy;
conceal_eof_gainFB = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/
Mpy_32_32_ss( step, L_shl( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ), &stepFB, &dmy );
- stepFB = L_shl_o( stepFB, 3 - 1, &Overflow ); /*Q30*/
+ stepFB = L_shl_sat( stepFB, 3 - 1 ); /*Q30*/
FOR( i = 0; i < hTcxDec->L_frameTCX; i++ )
{
synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) );
move16();
- conceal_eof_gainFB = L_sub_o( conceal_eof_gainFB, stepFB, &Overflow );
+ conceal_eof_gainFB = L_sub_sat( conceal_eof_gainFB, stepFB );
}
}
conceal_eof_gain32 = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/
@@ -1463,17 +1461,18 @@ void decoder_tcx_post_fx( Decoder_State *st_fx,
{
xn_buf[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) );
move16();
- conceal_eof_gain32 = L_sub_o( conceal_eof_gain32, step, &Overflow );
+ conceal_eof_gain32 = L_sub_sat( conceal_eof_gain32, step );
}
- hTcxDec->conceal_eof_gain = round_fx_o( conceal_eof_gain32, &Overflow ); /*Q14*/
+ hTcxDec->conceal_eof_gain = round_fx_sat( conceal_eof_gain32 ); /*Q14*/
move16();
/* run lpc gain compensation not for waveform adjustment */
test();
IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) )
{
- st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB,
- st_fx->last_concealed_gain_syn_deemph ),
- st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/
+ st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB,
+ st_fx->last_concealed_gain_syn_deemph ),
+ st_fx->last_concealed_gain_syn_deemph_e ) );
+ /*Q30->Q14*/
move16();
}
ELSE
@@ -1543,10 +1542,6 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx,
Word32 tmp32;
Word32 tmp32_1, tmp32_2;
TCX_DEC_HANDLE hTcxDec;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
hTcxDec = st_fx->hTcxDec;
@@ -1629,7 +1624,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx,
}
tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) );
tmp2 = norm_l( tmp32 );
- tmp1 = round_fx_o( L_shl( tmp32, tmp2 ), &Overflow );
+ tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) );
// s = sub(sub(sub(1, shl(s, 1)), 6/*table lookup for inverse framelength*/), tmp2);
s = sub( 25, add( shl( add( Q_syn, s ), 1 ), tmp2 ) );
tmp1 = Sqrt16( tmp1, &s );
@@ -1802,7 +1797,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx,
test();
IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) )
{
- st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_o( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e, &Overflow ) ); /*Q30->Q14*/
+ st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, st_fx->last_concealed_gain_syn_deemph ), st_fx->last_concealed_gain_syn_deemph_e ) ); /*Q30->Q14*/
move16();
}
ELSE
@@ -1859,44 +1854,6 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul
const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */
Word16 *exp /* o : exponent of result in [-32,31] Q0 */
)
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
-{
- Word16 i;
- Word32 L_sum, L_c;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- Flag Carry;
- move32();
-#endif
- /* Clear carry flag and init sum */
- Carry = 0;
- move32();
- L_c = 0;
- move32();
- L_sum = L_macNs_co( L_off, 0, 0, &Carry, &Overflow );
- IF( L_sum > 0 )
- {
- L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
- }
- IF( L_sum < 0 )
- {
- L_c = L_msuNs_co( L_c, 0, 0, &Carry, &Overflow );
- }
- FOR( i = 0; i < lg; i += 2 )
- {
- Carry = 0;
- move32();
- BASOP_SATURATE_WARNING_OFF_EVS /*multiplication of -32768 * -32768 throws an overflow, but is not critical*/
- L_sum = L_macNs_co( L_sum, x[i], x[i], &Carry, &Overflow );
- BASOP_SATURATE_WARNING_ON_EVS
- Overflow = 0; /* to avoid useless warning in L_macNs calling L_mult */
- move32();
- L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
- }
- L_sum = norm_llQ31( L_c, L_sum, exp );
- return L_sum;
-}
-#else
{
Word16 i;
Word32 L_sum;
@@ -1911,7 +1868,6 @@ static Word32 CalculateAbsEnergy_fx( /* o : normalized resul
L_sum = w_norm_llQ31( L_sum64, exp ); /*Q31 - *exp */
return L_sum;
}
-#endif /* FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW */
void IMDCT_fx( Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_TDAC, Word16 *xn_buf, const Word16 *tcx_aldo_window_1, const PWord16 *tcx_aldo_window_1_trunc, const PWord16 *tcx_aldo_window_2, const PWord16 *tcx_mdct_window_half, const PWord16 *tcx_mdct_window_minimum, const PWord16 *tcx_mdct_window_trans, Word16 tcx_mdct_window_half_length, Word16 tcx_mdct_window_min_length, Word16 index, Word16 left_rect, Word16 tcx_offset, Word16 overlap, Word16 L_frame, Word16 L_frameTCX, Word16 L_spec_TCX5, Word16 L_frame_glob, Word16 frame_cnt, Word16 bfi, Word16 *old_out, Word16 *Q_old_wtda, Decoder_State *st, Word16 fullbandScale, Word16 *acelp_zir )
{
@@ -2588,7 +2544,6 @@ void IMDCT_fx( Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_T
}
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
static Word16 IMDCT_ivas_fx_calc_qwin(
Decoder_State *st,
@@ -2958,24 +2913,16 @@ static void TCX_MDXT_Inverse_qwin_fx(
return;
}
-#endif
void IMDCT_ivas_fx(
Word32 *x_fx, // Q(q_x)
Word16 q_x,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 *old_syn_overl_fx, // *Q_old_syn_overl_fx
Word16 *Q_old_syn_overl_fx,
Word16 *syn_Overl_TDAC_fx, // *Q_syn_Overl_TDAC_fx
Word16 *Q_syn_Overl_TDAC_fx,
-#else
- Word16 *old_syn_overl_fx, // Q(-2)
- Word16 *syn_Overl_TDAC_fx, // Q(-2)
-#endif
Word16 *xn_buf_fx, // Q(-2)
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 q_xn_buf_fx,
-#endif
const Word16 *tcx_aldo_window_1_fx, // Q(15)
const PWord16 *tcx_aldo_window_1_trunc_fx, // Q(15)
const PWord16 *tcx_aldo_window_2_fx, // Q(15)
@@ -2996,19 +2943,13 @@ void IMDCT_ivas_fx(
const Word16 frame_cnt,
const Word16 bfi,
Word16 *old_out_fx, // Q(-2)
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
Word16 *q_old_out_fx,
-#endif
const Word16 FB_flag,
Decoder_State *st,
const Word16 fullbandScale,
Word16 *acelp_zir_fx,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 *q_acelp_zir_fx,
Word16 *pq_win )
-#else
- Word16 q_win ) // Q(-2)
-#endif
{
Word16 i, nz, aldo, w, L_win, L_ola;
Word16 win_fx[( L_FRAME_PLUS + L_MDCT_OVLP_MAX ) / 2];
@@ -3017,7 +2958,6 @@ void IMDCT_ivas_fx(
Word16 x_e_hdrm;
Word32 c;
Word16 exp;
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 q_win = *pq_win;
Word16 allow_qwin_change = 1;
move16();
@@ -3035,9 +2975,6 @@ void IMDCT_ivas_fx(
q_win = IMDCT_ivas_fx_calc_qwin( st, syn_Overl_TDAC_fx, *Q_syn_Overl_TDAC_fx, old_syn_overl_fx, *Q_old_syn_overl_fx,
hTcxDec->old_syn_Overl, hTcxDec->Q_old_syn_Overl, old_out_fx, *q_old_out_fx, q_win, FB_flag );
}
-#else
- x_e_hdrm = add( q_win, sub( Q16, q_x ) );
-#endif
aldo = 0;
move16();
@@ -3112,7 +3049,6 @@ void IMDCT_ivas_fx(
Word16 L_spec_TCX5_tmp = 0;
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IF( allow_qwin_change )
{
/* Use fixed q_win to avoid the need to adapt scaling of two TCX5 blocks (less effort with maybe not ideal scaling) */
@@ -3121,14 +3057,12 @@ void IMDCT_ivas_fx(
allow_qwin_change = 0;
move16();
}
-#endif
FOR( w = 0; w < 2; w++ )
{
test();
test();
L_spec_TCX5_tmp = imult1616( w, L_spec_TCX5 );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
// Assume that xn_buf_fx has no headroom.
q_win = s_min( q_xn_buf_fx, q_win );
@@ -3146,20 +3080,6 @@ void IMDCT_ivas_fx(
}
IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag );
-#else
- IF( EQ_16( kernel_type, MDST_IV ) || s_and( kernel_type, w ) )
- {
- TCX_MDST_Inverse_fx( x_fx + L_spec_TCX5_tmp, x_e_hdrm, win_fx, L_ola, sub( L_win, L_ola ), L_ola );
- }
- ELSE IF( ( kernel_type != 0 ) && ( w == 0 ) ) /* type 1 or 2 */
- {
- TCX_MDXT_Inverse_fx( x_fx + L_spec_TCX5_tmp, x_e_hdrm, win_fx, L_ola, sub( L_win, L_ola ), L_ola, kernel_type );
- }
- ELSE
- {
- TCX_MDCT_Inverse( x_fx + L_spec_TCX5_tmp, x_e_hdrm, win_fx, L_ola, sub( L_win, L_ola ), L_ola, st->element_mode );
- }
-#endif
tcx_windowing_synthesis_current_frame( win_fx, tcx_aldo_window_2_fx, tcx_mdct_window_half_fx, tcx_mdct_window_minimum_fx, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, ( w > 0 ) ? 0 : left_rect, ( w > 0 ) || ( w == 0 && index == 2 ) ? MIN_OVERLAP : hTcxCfg->tcx_last_overlap_mode, acelp_zir_fx, hTcxDec->old_syn_Overl, syn_Overl_TDAC_fx, st->old_Aq_12_8_fx, tcx_mdct_window_trans_fx, L_win, tcx_offset < 0 ? -tcx_offset : 0, ( w > 0 ) || ( frame_cnt > 0 ) ? 1 : st->last_core, ( w > 0 ) || ( frame_cnt > 0 ) ? 0 : (Word8) st->last_is_cng, fullbandScale );
@@ -3198,14 +3118,12 @@ void IMDCT_ivas_fx(
set16_fx( win_fx, 0, shr( add( L_FRAME_PLUS, L_MDCT_OVLP_MAX ), 1 ) );
/* 1st TCX-5 window, special MDCT with minimum overlap on right side */
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 q_win_prev;
#if 0
// Assume that xn_buf_fx has no headroom.
q_win = s_min( q_xn_buf_fx, q_win );
#endif
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IF( allow_qwin_change )
{
/* Use fixed q_win to avoid the need to adapt scaling of two TCX5 blocks (less effort with maybe not ideal scaling) */
@@ -3214,7 +3132,6 @@ void IMDCT_ivas_fx(
allow_qwin_change = 0;
move16();
}
-#endif
IF( EQ_16( kernel_type, MDST_IV ) )
{
@@ -3229,27 +3146,12 @@ void IMDCT_ivas_fx(
TCX_MDCT_Inverse_qwin_fx( x_fx, x_e_hdrm, win_fx + L_win, 0, sub( L_win, shr( L_ola, 1 ) ), L_ola, st->element_mode, &q_win, allow_qwin_change );
}
q_win_prev = q_win;
-#else
- IF( EQ_16( kernel_type, MDST_IV ) )
- {
- TCX_MDST_Inverse_fx( x_fx, x_e_hdrm, win_fx + L_win, 0, sub( L_win, shr( L_ola, 1 ) ), L_ola );
- }
- ELSE IF( NE_16( kernel_type, MDCT_IV ) ) /* type 1 or 2 */
- {
- TCX_MDXT_Inverse_fx( x_fx, x_e_hdrm, win_fx + L_win, 0, sub( L_win, shr( L_ola, 1 ) ), L_ola, kernel_type );
- }
- ELSE
- {
- TCX_MDCT_Inverse( x_fx, x_e_hdrm, win_fx + L_win, 0, sub( L_win, shr( L_ola, 1 ) ), L_ola, st->element_mode );
- }
-#endif
set16_fx( xn_buf_fx, 0, shr( overlap, 1 ) );
/* copy new sub-window region not overlapping with previous window */
Copy( win_fx + L_win, xn_buf_fx + shr( overlap, 1 ), add( L_win, shr( L_ola, 1 ) ) );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
q_xn_buf_fx = q_win;
move16();
@@ -3266,17 +3168,6 @@ void IMDCT_ivas_fx(
assert( q_win_prev == q_win );
IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag );
-#else
- /* 2nd TCX-5 window, regular MDCT with minimum overlap on both sides */
- IF( s_and( kernel_type, 1 ) )
- {
- TCX_MDST_Inverse_fx( x_fx + L_spec_TCX5, x_e_hdrm, win_fx, L_ola, sub( L_win, L_ola ), L_ola );
- }
- ELSE
- {
- TCX_MDCT_Inverse( x_fx + L_spec_TCX5, x_e_hdrm, win_fx, L_ola, sub( L_win, L_ola ), L_ola, st->element_mode );
- }
-#endif
tcx_windowing_synthesis_current_frame( win_fx, tcx_aldo_window_2_fx, tcx_mdct_window_half_fx, tcx_mdct_window_minimum_fx, L_ola, tcx_mdct_window_half_length, tcx_mdct_window_min_length, 0,
/* left_rect */ MIN_OVERLAP, /* left_mode */ acelp_zir_fx, hTcxDec->old_syn_Overl, syn_Overl_TDAC_fx, st->old_Aq_12_8_fx, tcx_mdct_window_trans_fx, L_win, ( tcx_offset < 0 ) ? -tcx_offset : 0, 1, /* st->last_mode_bfi */ 0, /* st->last_is_cng */ fullbandScale );
@@ -3311,7 +3202,6 @@ void IMDCT_ivas_fx(
ELSE
{
/* default, i.e. maximum overlap, single transform, no grouping */
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IF( allow_qwin_change && fullbandScale )
{
q_win = s_min( q_win, norm_arr( acelp_zir_fx, shr( L_frame_glob, 1 ) ) + *q_acelp_zir_fx );
@@ -3334,22 +3224,7 @@ void IMDCT_ivas_fx(
move16();
IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag );
-#else
- IF( EQ_16( kernel_type, MDST_IV ) )
- {
- TCX_MDST_Inverse_fx( x_fx, x_e_hdrm, xn_buf_fx, overlap, sub( L_frame, overlap ), overlap );
- }
- ELSE IF( NE_16( kernel_type, MDCT_IV ) ) /* type 1 or 2 */
- {
- TCX_MDXT_Inverse_fx( x_fx, x_e_hdrm, xn_buf_fx, overlap, sub( L_frame, overlap ), overlap, kernel_type );
- }
- ELSE
- {
- TCX_MDCT_Inverse( x_fx, x_e_hdrm, xn_buf_fx, overlap, sub( L_frame, overlap ), overlap, st->element_mode );
- }
-#endif
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IF( !fullbandScale )
{
*q_acelp_zir_fx = q_xn_buf_fx;
@@ -3358,7 +3233,6 @@ void IMDCT_ivas_fx(
{
scale_sig( acelp_zir_fx, shr( L_frame_glob, 1 ), sub( q_xn_buf_fx, *q_acelp_zir_fx ) );
}
-#endif
tcx_windowing_synthesis_current_frame( xn_buf_fx, tcx_aldo_window_2_fx, tcx_mdct_window_half_fx, tcx_mdct_window_minimum_fx, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, left_rect, !bfi && ( frame_cnt > 0 ) && ( index == 0 ) && NE_16( st->last_core, ACELP_CORE ) ? MIN_OVERLAP : index, acelp_zir_fx, hTcxDec->old_syn_Overl, syn_Overl_TDAC_fx, st->old_Aq_12_8_fx, tcx_mdct_window_trans_fx, shr( L_frame_glob, 1 ), ( tcx_offset < 0 ) ? -tcx_offset : 0, ( frame_cnt > 0 /*|| (st->last_con_tcx )*/ ) ? 1 : st->last_core_bfi, ( frame_cnt > 0 ) ? 0 : (Word8) st->last_is_cng, fullbandScale );
} /* tcx_last_overlap_mode != FULL_OVERLAP */
@@ -3403,14 +3277,11 @@ void IMDCT_ivas_fx(
q_tmp_fx_32 = q_xn_buf_fx_32;
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
// q_win < norm + q_tmp_fx_32 - 16
q_win = s_min( q_win, L_norm_arr( tmp_fx_32, L_frame ) + q_tmp_fx_32 - 16 );
IMDCT_ivas_fx_rescale( NULL, NULL, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag );
-#endif
Word16 diff = sub( q_tmp_fx_32, q_win );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
Word16 q_old_out_diff = sub( q_tmp_fx_32, *q_old_out_fx );
IF( q_old_out_diff < 0 )
{
@@ -3418,15 +3289,10 @@ void IMDCT_ivas_fx(
*q_old_out_fx = add( *q_old_out_fx, q_old_out_diff );
q_old_out_diff = 0;
}
-#endif
FOR( Word16 ind = 0; ind < L_frame; ind++ )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
assert( L_shr( L_shl( old_out_fx[ind], q_old_out_diff ), q_old_out_diff ) == old_out_fx[ind] );
old_out_fx_32[ind] = L_shl( L_deposit_l( old_out_fx[ind] ), q_old_out_diff );
-#else
- old_out_fx_32[ind] = L_shl( old_out_fx[ind], diff );
-#endif
move32();
}
@@ -3434,13 +3300,8 @@ void IMDCT_ivas_fx(
FOR( Word16 ind = 0; ind < L_frame; ind++ )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
assert( extract_h( L_shr( old_out_fx_32[ind], q_old_out_diff ) ) == 0 || extract_h( L_shr( old_out_fx_32[ind], q_old_out_diff ) ) == -1 );
old_out_fx[ind] = extract_l( L_shr( old_out_fx_32[ind], q_old_out_diff ) );
-#else
- assert( extract_h( L_shr( old_out_fx_32[ind], diff ) ) == 0 || extract_h( L_shr( old_out_fx_32[ind], diff ) ) == -1 );
- old_out_fx[ind] = extract_l( L_shr( old_out_fx_32[ind], diff ) );
-#endif
assert( extract_h( L_shr( xn_buf_fx_32[ind], diff ) ) == 0 || extract_h( L_shr( xn_buf_fx_32[ind], diff ) ) == -1 );
xn_buf_fx[ind] = extract_l( L_shr( xn_buf_fx_32[ind], diff ) );
move16();
@@ -3449,10 +3310,6 @@ void IMDCT_ivas_fx(
}
ELSE
{
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
- Word16 q_old_out = q_win;
- move16();
-#endif
edct_ivas_fx( x_fx, xn_buf_fx_32 + add( shr( overlap, 1 ), nz ), L_frame, &q_xn_buf_fx_32 );
Word16 res_m, res_e;
res_e = 0;
@@ -3468,7 +3325,6 @@ void IMDCT_ivas_fx(
q_tmp_fx_32 = sub( q_xn_buf_fx_32, res_e );
// v_multc_fixed( xn_buf_fx_32 + overlap / 2 + nz, (float) sqrt( (float) L_frame / NORM_MDCT_FACTOR ), tmp_fx_32, L_frame );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
if ( allow_qwin_change )
{
// sub( q_xn_buf_fx_32, q_win ) == 16 - L_norm_arr( xn_buf_fx_32, L_frame )
@@ -3477,7 +3333,6 @@ void IMDCT_ivas_fx(
q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), sub( L_norm_arr( xn_buf_fx_32 + ( overlap / 2 ) + nz, L_frame ), 2 ) ) );
}
IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag );
-#endif
Word16 q_diff = sub( q_xn_buf_fx_32, q_win );
FOR( Word16 ind = 0; ind < L_frame; ind++ )
@@ -3487,14 +3342,7 @@ void IMDCT_ivas_fx(
move16();
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
window_ola_fx( tmp_fx_32, xn_buf_fx, &q_tmp_fx_32, old_out_fx, q_old_out_fx, L_frame, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL );
-#else
- window_ola_fx( tmp_fx_32, xn_buf_fx, &q_tmp_fx_32, old_out_fx, &q_old_out, L_frame, hTcxCfg->tcx_last_overlap_mode, hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL );
-
- q_diff = sub( q_old_out, q_win );
-#endif
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
if ( allow_qwin_change )
{
// sub( q_tmp_fx_32, q_win ) == -norm_arr( xn_buf_fx, L_frame )
@@ -3502,15 +3350,9 @@ void IMDCT_ivas_fx(
// q_win == q_tmp_fx_32 + norm_arr( xn_buf_fx, L_frame )
q_win = s_min( q_win, add( q_tmp_fx_32, norm_arr( xn_buf_fx, L_frame ) ) );
}
-#endif
Word16 diff = sub( q_tmp_fx_32, q_win );
FOR( Word16 ind = 0; ind < L_frame; ind++ )
{
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
-
- old_out_fx[ind] = shr_sat( old_out_fx[ind], q_diff );
- move16();
-#endif
xn_buf_fx[ind] = shr_sat( xn_buf_fx[ind], diff );
move16();
}
@@ -3533,7 +3375,6 @@ void IMDCT_ivas_fx(
move16();
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IF( allow_qwin_change && fullbandScale )
{
q_win = s_min( q_win, norm_arr( acelp_zir_fx, shr( L_frame_glob, 1 ) ) + *q_acelp_zir_fx );
@@ -3566,20 +3407,6 @@ void IMDCT_ivas_fx(
move16();
IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag );
-#else
- IF( EQ_16( kernel_type, MDST_IV ) )
- {
- TCX_MDST_Inverse_fx( x_fx, x_e_hdrm, xn_buf_fx, overlap, L_frame - overlap, overlap );
- }
- ELSE IF( NE_16( kernel_type, MDCT_IV ) ) /* type 1 or 2 */
- {
- TCX_MDXT_Inverse_fx( x_fx, x_e_hdrm, xn_buf_fx, overlap, L_frame - overlap, overlap, kernel_type );
- }
- ELSE
- {
- TCX_MDCT_Inverse( x_fx, x_e_hdrm, xn_buf_fx, overlap, L_frame - overlap, overlap, st->element_mode );
- }
-#endif
/*-----------------------------------------------------------*
* Windowing, overlap and add *
*-----------------------------------------------------------*/
@@ -3611,7 +3438,6 @@ void IMDCT_ivas_fx(
move16();
}
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IF( !fullbandScale )
{
*q_acelp_zir_fx = q_xn_buf_fx;
@@ -3620,7 +3446,6 @@ void IMDCT_ivas_fx(
{
scale_sig( acelp_zir_fx, shr( L_frame_glob, 1 ), sub( q_xn_buf_fx, *q_acelp_zir_fx ) );
}
-#endif
/* Window current frame */
tcx_windowing_synthesis_current_frame( xn_buf_fx, tcx_aldo_window_2_fx, tcx_mdct_window_half_fx, tcx_mdct_window_minimum_fx, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, left_rect, hTcxCfg->tcx_last_overlap_mode, acelp_zir_fx, hTcxDec->old_syn_Overl, syn_Overl_TDAC_fx, st->old_Aq_12_8_fx, tcx_mdct_window_trans_fx, shr( L_frame_glob, 1 ), acelp_mem_len, st->last_core_bfi, (Word8) st->last_is_cng, fullbandScale );
}
@@ -3645,18 +3470,9 @@ void IMDCT_ivas_fx(
IF( hTcxCfg->last_aldo != 0 )
{
-#if defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD ) && !defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN )
- Word16 tmp_old_out;
- Word16 q_diff = sub( *q_old_out_fx, q_win );
-#endif
FOR( i = 0; i < sub( overlap, tcx_mdct_window_min_length ); i++ )
{
-#if defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD ) && !defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN )
- tmp_old_out = shr_sat( old_out_fx[( i + nz )], q_diff );
- xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )] = add_sat( xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )], tmp_old_out ); // q_win
-#else
- xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )] = add_sat( xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )], old_out_fx[( i + nz )] ); // Q(-2)
-#endif
+ xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )] = add_sat( xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )], old_out_fx[( i + nz )] ); // Q(-2)
move16();
}
@@ -3669,32 +3485,17 @@ void IMDCT_ivas_fx(
// tested
FOR( ; i < overlap; i++ ) /* perfectly reconstructing ALDO shortening */
{
-#if defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD ) && !defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN )
- tmp_old_out = shr_sat( old_out_fx[( i + nz )], q_diff );
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tmp_old_out ); // q_win
-#else
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], old_out_fx[( i + nz )] ); // q_win
-#endif
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], old_out_fx[( i + nz )] ); // q_win
move16();
}
FOR( i = 0; i < ( tcx_mdct_window_min_length / 2 ); i++ )
{
-#if defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD ) && !defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN )
- tmp_old_out = shr_sat( old_out_fx[( ( i + nz ) + overlap )], q_diff );
- xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )] = add_sat( xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )], mult_r( tmp_old_out, tcx_mdct_window_minimum_fx[i].v.re ) ); // q_win
-#else
- xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )] = add_sat( xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )], mult_r( old_out_fx[( ( i + nz ) + overlap )], tcx_mdct_window_minimum_fx[i].v.re ) ); // q_win
-#endif
+ xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )] = add_sat( xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )], mult_r( old_out_fx[( ( i + nz ) + overlap )], tcx_mdct_window_minimum_fx[i].v.re ) ); // q_win
move16();
}
FOR( ; i < tcx_mdct_window_min_length; i++ )
{
-#if defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD ) && !defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN )
- tmp_old_out = shr_sat( old_out_fx[( ( i + nz ) + overlap )], q_diff );
- xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )] = add_sat( xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )], mult_r( tmp_old_out, tcx_mdct_window_minimum_fx[( tcx_mdct_window_min_length - ( 1 + i ) )].v.im ) ); // q_win
-#else
xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )] = add_sat( xn_buf_fx[( ( ( i + ( overlap / 2 ) ) - tcx_offset ) + overlap )], mult_r( old_out_fx[( ( i + nz ) + overlap )], tcx_mdct_window_minimum_fx[( tcx_mdct_window_min_length - ( 1 + i ) )].v.im ) ); // q_win
-#endif
move16();
}
}
@@ -3702,22 +3503,12 @@ void IMDCT_ivas_fx(
{
FOR( ; i < ( overlap - ( tcx_mdct_window_min_length / 2 ) ); i++ )
{
-#if defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD ) && !defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN )
- tmp_old_out = shr_sat( old_out_fx[( i + nz )], q_diff );
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( tmp_old_out, tcx_mdct_window_minimum_fx[( ( tcx_mdct_window_min_length - overlap ) + i )].v.re ) ); // Q(-2)
-#else
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( old_out_fx[( i + nz )], tcx_mdct_window_minimum_fx[( ( tcx_mdct_window_min_length - overlap ) + i )].v.re ) ); // Q(-2)
-#endif
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( old_out_fx[( i + nz )], tcx_mdct_window_minimum_fx[( ( tcx_mdct_window_min_length - overlap ) + i )].v.re ) ); // Q(-2)
move16();
}
FOR( ; i < overlap; i++ )
{
-#if defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD ) && !defined( FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN )
- tmp_old_out = shr_sat( old_out_fx[( i + nz )], q_diff );
- xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( tmp_old_out, tcx_mdct_window_minimum_fx[( overlap - ( 1 + i ) )].v.im ) ); // Q(-2)
-#else
- xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( old_out_fx[( i + nz )], tcx_mdct_window_minimum_fx[( overlap - ( 1 + i ) )].v.im ) ); // Q(-2)
-#endif
+ xn_buf_fx[( i + ( ( overlap / 2 ) - tcx_offset ) )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( old_out_fx[( i + nz )], tcx_mdct_window_minimum_fx[( overlap - ( 1 + i ) )].v.im ) ); // Q(-2)
move16();
}
}
@@ -3766,9 +3557,7 @@ void IMDCT_ivas_fx(
/* Compute windowed synthesis in case of switching to ALDO windows in next frame */
Copy( xn_buf_fx + sub( L_frame, nz ), old_out_fx, add( nz, overlap ) );
set16_fx( old_out_fx + add( nz, overlap ), 0, nz );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
*q_old_out_fx = q_win;
-#endif
tcx_windowing_synthesis_past_frame( old_out_fx + nz, tcx_aldo_window_1_trunc_fx, tcx_mdct_window_half_fx, tcx_mdct_window_minimum_fx, overlap, tcx_mdct_window_half_length, tcx_mdct_window_min_length, hTcxCfg->tcx_curr_overlap_mode );
/* If current overlap mode = FULL_OVERLAP -> ALDO_WINDOW */
@@ -3805,49 +3594,44 @@ void IMDCT_ivas_fx(
test();
test();
test();
- IF( ( left_rect != 0 ) && ( frame_cnt == 0 ) && st->last_core_bfi == ACELP_CORE && ( st->prev_bfi != 0 ) )
+ IF( ( left_rect != 0 ) && ( frame_cnt == 0 ) && st->last_core_bfi == ACELP_CORE && ( st->prev_bfi != 0 ) ){
+ IF( FB_flag != 0 ){
+ FOR( i = 0; i < ( tcx_mdct_window_half_length / 2 ); i++ ){
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[i].v.im ); // Q(-2)
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_OverlFB[i], tcx_mdct_window_half_fx[i].v.re ), tcx_mdct_window_half_fx[i].v.re ) ); // Q(-2)
+ move16();
+ move16();
+}
+FOR( ; i < tcx_mdct_window_half_length; i++ )
+{
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.re ); // Q(-2)
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_OverlFB[i], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ), tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ) ); // Q(-2)
+ move16();
+ move16();
+}
+}
+ELSE
+{
+ FOR( i = 0; i < ( tcx_mdct_window_half_length / 2 ); i++ )
{
- IF( FB_flag != 0 )
- {
- FOR( i = 0; i < ( tcx_mdct_window_half_length / 2 ); i++ )
- {
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[i].v.im ); // Q(-2)
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_OverlFB[i], tcx_mdct_window_half_fx[i].v.re ), tcx_mdct_window_half_fx[i].v.re ) ); // Q(-2)
- move16();
- move16();
- }
- FOR( ; i < tcx_mdct_window_half_length; i++ )
- {
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.re ); // Q(-2)
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_OverlFB[i], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ), tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ) ); // Q(-2)
- move16();
- move16();
- }
- }
- ELSE
- {
- FOR( i = 0; i < ( tcx_mdct_window_half_length / 2 ); i++ )
- {
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[i].v.im );
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_Overl[i], tcx_mdct_window_half_fx[i].v.re ), tcx_mdct_window_half_fx[i].v.re ) ); // Q(-2)
- move16();
- move16();
- }
- FOR( ; i < tcx_mdct_window_half_length; i++ )
- {
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.re );
- xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_Overl[i], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ), tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ) ); // Q(-2)
- move16();
- move16();
- }
- }
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[i].v.im );
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_Overl[i], tcx_mdct_window_half_fx[i].v.re ), tcx_mdct_window_half_fx[i].v.re ) ); // Q(-2)
+ move16();
+ move16();
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
- *pq_win = q_win;
- move16();
-#endif
+ FOR( ; i < tcx_mdct_window_half_length; i++ )
+ {
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = mult_r( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.re );
+ xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )] = add_sat( xn_buf_fx[( ( i + ( overlap / 2 ) ) - tcx_offset )], mult_r( mult_r( hTcxDec->syn_Overl[i], tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ), tcx_mdct_window_half_fx[( tcx_mdct_window_half_length - ( 1 + i ) )].v.im ) ); // Q(-2)
+ move16();
+ move16();
+ }
+}
+}
+*pq_win = q_win;
+move16();
- return;
+return;
}
void init_tcx_info_fx(
@@ -4265,7 +4049,6 @@ void decoder_tcx_ivas_fx(
decoder_tcx_tns_fx( st, L_frame_glob, L_spec, L_frame, L_frameTCX, x_fx, fUseTns, &tnsData, bfi, frame_cnt, 0, NULL );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Scale_sig32( x_fx, N_MAX, sub( x_e, 20 ) ); // Scaling x_fx to Q11
Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, sub( st->Q_syn, 14 ) ); // Scaling xn_buf_fx to Q_syn
x_e = sub( 31, 11 );
@@ -4301,58 +4084,6 @@ void decoder_tcx_ivas_fx(
Scale_sig( st->hTcxDec->old_syn_Overl, 320, ( -2 - st->hTcxDec->Q_old_syn_Overl ) ); // Scaling to Q-2
st->hTcxDec->Q_old_syn_Overl = -2;
-
-#else
- Scale_sig32( x_fx, N_MAX, sub( x_e, 20 ) ); // Scaling x_fx to Q11
- Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, sub( st->Q_syn, 14 ) ); // Scaling xn_buf_fx to Q_syn
- x_e = sub( 31, 11 );
-
- IF( st->igf != 0 )
- {
- Scale_sig32( st->hIGFDec->virtualSpec, ( N_MAX_TCX - IGF_START_MN ), ( sub( st->hIGFDec->virtualSpec_e, x_e ) ) );
- st->hIGFDec->virtualSpec_e = x_e;
- move16();
- }
-
- /* Scaling down buffers for decoder_tcx_imdct_fx*/
- Scale_sig( st->hTcxDec->syn_Overl_TDACFB, L_FRAME_MAX / 2, sub( st->Q_syn, st->hTcxDec->Q_syn_Overl_TDACFB ) ); // Scaling to Q_syn
- st->hTcxDec->Q_syn_Overl_TDACFB = st->Q_syn;
- move16();
- Scale_sig( st->hTcxDec->syn_Overl_TDAC, L_FRAME32k / 2, sub( st->Q_syn, st->hTcxDec->Q_syn_Overl_TDAC ) ); // Scaling to Q_syn
- st->hTcxDec->Q_syn_Overl_TDAC = st->Q_syn;
- move16();
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
- Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, negate( st->hHQ_core->Q_old_wtda ) ); // Scaling to Q0
- Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, negate( st->hHQ_core->Q_old_wtda_LB ) ); // Scaling to Q0
- st->hHQ_core->Q_old_wtda = 0;
- move16();
- st->hHQ_core->Q_old_wtda_LB = 0;
- move16();
-#endif
-
- Scale_sig( st->hTcxDec->old_syn_Overl, 320, st->Q_syn - st->hTcxDec->Q_old_syn_Overl ); // Scaling to Q_syn
- st->hTcxDec->Q_old_syn_Overl = st->Q_syn;
- Copy_Scale_sig_16_32_no_sat( st->old_Aq_12_8_fx, st->old_Aq_12_8_fx_32, M + 1, ( sub( 28, ( sub( 15, norm_s( sub( st->old_Aq_12_8_fx[0], 1 ) ) ) ) ) ) );
-
- Scale_sig( synth_fx, L_frame_glob, st->Q_syn ); // Scaling to Q_syn
- Scale_sig( synthFB_fx, L_frameTCX_glob, st->Q_syn ); // Scaling to Q_syn
-
- decoder_tcx_imdct_fx( st, L_frame_glob, L_frameTCX_glob, L_spec, tcx_offset, tcx_offsetFB, L_frame, L_frameTCX, left_rect, &x_fx[0], q_x, xn_buf_fx, st->Q_syn, MDCT_IV,
- fUseTns, &synth_fx[0], &synthFB_fx[0], bfi, frame_cnt, sba_dirac_stereo_flag );
-
- /* Scaling up again */
- Scale_sig( synth_fx, L_frame_glob, negate( st->Q_syn ) );
- Scale_sig( synthFB_fx, L_frameTCX_glob, negate( st->Q_syn ) );
- // Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, 1 );
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
- st->hHQ_core->Q_old_wtda = st->Q_syn;
- // Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, ( sub( st->hHQ_core->Q_old_wtda, st->Q_syn ) ) );
- st->hHQ_core->Q_old_wtda_LB = st->Q_syn;
- // Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, ( sub( st->hHQ_core->Q_old_wtda, st->Q_syn ) ) );
-#endif
- Scale_sig( st->hTcxDec->old_syn_Overl, 320, ( -2 - st->hTcxDec->Q_old_syn_Overl ) ); // Scaling to Q-2
- st->hTcxDec->Q_old_syn_Overl = -2;
-#endif
}
/*-------------------------------------------------------------------*
@@ -4410,10 +4141,6 @@ void decoder_tcx_invQ_fx(
move16();
move16();
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
tnsSize = 0;
move16();
@@ -4537,7 +4264,7 @@ void decoder_tcx_invQ_fx(
FOR( i = 0; i < noiseFillingSize; ++i )
{
tmp32 = L_shr( x[i], sub( 31, *x_e ) );
- *nf_seed = add_o( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ), &Overflow ); // abs( tmp32 ) * i * 2
+ *nf_seed = add_sat( *nf_seed, extract_l( L_shl( i_mult( (Word16) L_abs( tmp32 ), i ), 1 ) ) ); // abs( tmp32 ) * i * 2
move16();
}
}
@@ -4777,7 +4504,7 @@ void decoder_tcx_invQ_fx(
st->last_gain_syn_deemph_e = add( st->last_gain_syn_deemph_e, 10 /*scaling of h1[0] and E_UTIL_synthesis * 2*/ );
move16();
tmp32 = Sqrt32( tmp32, &st->last_gain_syn_deemph_e );
- st->last_gain_syn_deemph = round_fx_o( tmp32, &Overflow ); // Q15
+ st->last_gain_syn_deemph = round_fx_sat( tmp32 ); // Q15
move16();
}
@@ -5619,12 +5346,8 @@ void decoder_tcx_tns_fx(
test();
test();
test();
-#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT
test();
IF( ( NE_16( hTcxCfg->fIsTNSAllowed, 0 ) && NE_16( fUseTns, 0 ) && NE_16( bfi, 1 ) && whitenedDomain ) || GT_16( L_spec, L_frameTCX ) )
-#else
- IF( ( NE_16( hTcxCfg->fIsTNSAllowed, 0 ) && NE_16( fUseTns, 0 ) && NE_16( bfi, 1 ) ) || GT_16( L_spec, L_frameTCX ) )
-#endif
{
L = L_spec;
move16();
@@ -5678,12 +5401,8 @@ void decoder_tcx_tns_fx(
IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && st->tcxonly != 0 && isTCX5 != 0 )
{
test();
-#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT
test();
IF( st->element_mode == EVS_MONO || ( LT_16( L_spec, L_frameTCX ) && !whitenedDomain ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */
-#else
- IF( st->element_mode == EVS_MONO || LT_16( L_spec, L_frameTCX ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */
-#endif
{
tcx5TnsUngrouping_fx( shr( L_frameTCX, 1 ), shr( hTcxCfg->tnsConfig[0][0].iFilterBorders[0], 1 ), x_fx, DEC );
tmp = L_frameTCX;
@@ -5736,12 +5455,8 @@ void decoder_tcx_imdct_fx(
Word32 x_fx[N_MAX], // Q(11)
Word16 q_x,
Word16 xn_buf_fx[], // Q(-2)
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 *q_win,
Word16 *q_winFB,
-#else
- Word16 q_win,
-#endif
const UWord16 kernelType, /* i : TCX transform kernel type */
const Word16 fUseTns, /* i : flag that is set if TNS data is present */
Word16 synth_fx[], // Q(-2) /* i/o: synth[-M..L_frame] */
@@ -5767,12 +5482,8 @@ void decoder_tcx_imdct_fx(
Word16 q_a_itf = 15;
Word16 x_e = sub( 31, q_x );
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 q_acelp_zir_fx = 0;
set16_fx( acelp_zir_fx, 0, L_FRAME_MAX / 2 );
-#else
- Word16 shift_q = sub( q_x, q_win );
-#endif
/*-----------------------------------------------------------------*
* Initializations
@@ -5925,17 +5636,9 @@ void decoder_tcx_imdct_fx(
IF( NE_16( st->element_mode, IVAS_CPE_DFT ) && !sba_dirac_stereo_flag )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, &hTcxDec->Q_syn_Overl, hTcxDec->syn_Overl_TDAC, &hTcxDec->Q_syn_Overl_TDAC, xn_buf_fx, *q_win, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2,
-#else
- IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf_fx, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2,
-#endif
hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, &st->hHQ_core->Q_old_wtda_LB, 0, st, 0, acelp_zir_fx, &q_acelp_zir_fx, q_win );
-#else
- kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win );
-#endif
}
/* Generate additional comfort noise to mask potential coding artefacts */
@@ -5955,31 +5658,19 @@ void decoder_tcx_imdct_fx(
IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) || ( sba_dirac_stereo_flag != 0 ) )
{
Copy32( x_fx, xn_bufFB_fx, s_max( L_spec, s_max( L_frame, L_frameTCX ) ) ); // q_x
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, &hTcxDec->Q_syn_Overl, hTcxDec->syn_Overl_TDAC, &hTcxDec->Q_syn_Overl_TDAC, xn_buf_fx, *q_win, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index,
-#else
- IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf_fx, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index,
-#endif
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, &st->hHQ_core->Q_old_wtda_LB, 0, st, 0, acelp_zir_fx, &q_acelp_zir_fx, q_win );
-#else
- kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win );
-#endif
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 shift_q, q_x16;
shift_q = L_norm_arr( xn_bufFB_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX );
shift_q = sub( 16, shift_q );
q_x16 = sub( q_x, shift_q );
-#endif
FOR( Word16 ind = 0; ind < L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX; ind++ )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
assert( extract_h( L_shr( xn_bufFB_fx[ind], shift_q ) ) == 0 || extract_h( L_shr( xn_bufFB_fx[ind], shift_q ) ) == -1 );
-#endif
xn_bufFB_fx_16[ind] = extract_l( L_shr( xn_bufFB_fx[ind], shift_q ) ); // q_x16
move16();
}
@@ -5990,36 +5681,18 @@ void decoder_tcx_imdct_fx(
IF( st->element_mode != EVS_MONO )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IMDCT_ivas_fx( x_tmp_fx, q_x, hTcxDec->syn_OverlFB, &hTcxDec->Q_syn_OverlFB, hTcxDec->syn_Overl_TDACFB, &hTcxDec->Q_syn_Overl_TDACFB, xn_bufFB_fx_16, q_x16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB,
-#else
- IMDCT_ivas_fx( x_tmp_fx, q_x, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB_fx_16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB,
-#endif
hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index,
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, &st->hHQ_core->Q_old_wtda, 1, st, ratio, acelp_zir_fx, &q_acelp_zir_fx, q_winFB );
-#else
- kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, ratio, acelp_zir_fx, q_win );
-#endif
}
ELSE
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IMDCT_ivas_fx( x_fx, q_x, hTcxDec->syn_OverlFB, &hTcxDec->Q_syn_OverlFB, hTcxDec->syn_Overl_TDACFB, &hTcxDec->Q_syn_Overl_TDACFB, xn_bufFB_fx_16, q_x16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index,
-#else
- IMDCT_ivas_fx( x_fx, q_x, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB_fx_16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index,
-#endif
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, &st->hHQ_core->Q_old_wtda, 1, st, ratio, acelp_zir_fx, &q_acelp_zir_fx, q_winFB );
-#else
- kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, ratio, acelp_zir_fx, q_win );
-#endif
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
shift_q = 16;
move16();
-#endif
FOR( Word16 ind = 0; ind < L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX; ind++ )
{
diff --git a/lib_dec/dec_tran_fx.c b/lib_dec/dec_tran_fx.c
index de3a1ff3fb8f8521004f0d0cb1d3dd1260e57e19..b30b1a8c066576225a9db240ba71d830c1e00e21 100644
--- a/lib_dec/dec_tran_fx.c
+++ b/lib_dec/dec_tran_fx.c
@@ -71,6 +71,9 @@ void decod_tran_fx(
Word16 gain_code16;
Word32 L_tmp;
Word16 tmp16, tmp1_fx, tmp_fx;
+#ifdef FIX_2010_PREP_TBE_EXC
+ Word16 Q_code_preQ;
+#endif
GSC_DEC_HANDLE hGSCDec;
hGSCDec = st_fx->hGSCDec;
MUSIC_POSTFILT_HANDLE hMusicPF;
@@ -254,10 +257,33 @@ void decod_tran_fx(
tmp_idx_2 = idiv1616( i_subfr, L_SUBFR );
}
+#ifdef FIX_2010_PREP_TBE_EXC
+ /*
+ 2025-09-15 multrus:
+ TODO:
+ check with vaillancourt
+ - where this difference between EVS and IVAS comes from
+ - where Q_code_preQ could be derived
+ - whether any of the above calculations need to be adjusted
+ */
+ Q_code_preQ = Q6;
+ move16();
+ if ( EQ_16( st_fx->element_mode, EVS_MONO ) )
+ {
+ Q_code_preQ = Q10;
+ move16();
+ }
+
+ prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
+ &voice_factors_fx[tmp_idx_2], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_code_preQ,
+ st_fx->Q_exc, T0, T0_frac, st_fx->coder_type, st_fx->core_brate,
+ st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
&voice_factors_fx[tmp_idx_2], bwe_exc_fx, gain_preQ_fx, code_preQ_fx,
st_fx->Q_exc, T0, T0_frac, st_fx->coder_type, st_fx->core_brate,
st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#endif
/*----------------------------------------------------------------*
* Excitation enhancements (update of total excitation signal)
diff --git a/lib_dec/er_dec_acelp_fx.c b/lib_dec/er_dec_acelp_fx.c
index 470053c6a063550c32b07461961700494f8c4f44..20408c23c8f53d4d3e6ae6a1313d82885dcb97a7 100644
--- a/lib_dec/er_dec_acelp_fx.c
+++ b/lib_dec/er_dec_acelp_fx.c
@@ -1018,10 +1018,8 @@ void con_acelp_fx(
Copy( syn, synth, st->L_frame );
bufferCopyFx( syn + sub( st->L_frame, shr( st->L_frame, 1 ) ), hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), 0 /*Qf_syn*/, -1 /*Qf_old_xnq*/, 0, 0 /*Q_old_xnq*/ );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hTcxDec->Q_old_syn_Overl = sub( Qf_syn, 1 );
move16();
-#endif
/* save last half frame if next frame is TCX */
bufferCopyFx( syn + st->L_frame, hTcxDec->syn_Overl_TDAC, shr( st->L_frame, 1 ), 0 /*Qf_syn*/, -1 /*Qf_old_xnq*/, 0, 0 /*Q_old_xnq*/ );
@@ -1106,15 +1104,11 @@ void con_acelp_fx(
st->hTcxDec->Q_syn_Overl_TDACFB = st->hTcxDec->Q_syn_Overl_TDAC;
move16();
lerp( hTcxDec->syn_Overl, hTcxDec->syn_OverlFB, shr( hTcxDec->L_frameTCX, 1 ), shr( st->L_frame, 1 ) );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hTcxDec->Q_syn_OverlFB = hTcxDec->Q_syn_Overl;
move16();
-#endif
lerp( hHQ_core->old_out_LB_fx, hHQ_core->old_out_fx, hTcxDec->L_frameTCX, st->L_frame );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hHQ_core->Q_old_wtda = hHQ_core->Q_old_wtda_LB;
move16();
-#endif
/* copy total excitation exc2 as 16kHz for acelp mode1 decoding */
IF( st->hWIDec != NULL )
diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c
index aeb4c0783a0ff156761eef9263cbc451a1a354cf..2b112c00e752b8cfa234884ed4e9e4eec964bb9d 100644
--- a/lib_dec/er_dec_tcx_fx.c
+++ b/lib_dec/er_dec_tcx_fx.c
@@ -15,43 +15,64 @@
******************************************************/
static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/, Word16 L_subfr /*Q0*/, Word32 lp_gainp /*Q16*/, Word32 *lp_gainc /*Q16*/ )
{
- Word32 L_c;
Word16 tmp16, tmp16_2, tmp16_3, tmp_e, tmp2_e, tmp_loop, i;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ Word32 L_c;
Word32 L_acc, L_tmp;
+#else
+ Word64 W_acc;
+ Word32 L_tmp;
+#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
+#endif
move32();
move32();
#endif
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_acc = L_deposit_l( 0 );
L_c = L_deposit_l( 0 );
+#else
+ W_acc = 0;
+#endif
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Overflow = 0;
move16();
Carry = 0;
move16();
+#endif
tmp16 = round_fx( old_fpitch ); /*Q0*/
tmp_loop = shl( L_subfr, 1 );
BASOP_SATURATE_WARNING_OFF_EVS
- tmp16_2 = round_fx_o( L_shl_o( lp_gainp, 2, &Overflow ), &Overflow ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/
+ tmp16_2 = round_fx_sat( L_shl_sat( lp_gainp, 2 ) ); /*Q31->Q15, no severe saturation, because st->lp_gainp here is [0,1]*/
BASOP_SATURATE_WARNING_ON_EVS
FOR( i = 0; i < tmp_loop; i++ )
{
/*st->lp_gainc += ( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] ) *
( exc[i-2*L_subfr] - st->Mode2_lp_gainp * exc[i-2*L_subfr-(int)(st->old_fpitch+0.5f)] );*/
- tmp16_3 = sub_o( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/, &Overflow );
+ tmp16_3 = sub_sat( exc[( i - ( L_subfr * 2 ) )] /*Q1*/, mult_r( tmp16_2 /*Q15*/, exc[( ( i - ( L_subfr * 2 ) ) - tmp16 )] /*Q1*/ ) /*Q1*/ );
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_acc = L_macNs_co( L_acc, tmp16_3, tmp16_3, &Carry, &Overflow ); /*Q3*/
Overflow = 0;
move16();
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Accumulate Carrys Q-1*/
Carry = 0;
move16();
+#else
+ W_acc = W_mac_16_16( W_acc, tmp16_3, tmp16_3 ); /*Q3*/
+#endif
}
- L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/
+#else
+ L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/
+#endif
tmp_e = add( tmp_e, 31 - ( add( shl( Q_exc, 1 ), 1 ) ) ); /*L_tmp is Q31, now*/
tmp16 = BASOP_Util_Divide3216_Scale( L_tmp /*Q31,norm,tmp_e*/, shl( L_subfr, 1 ) /*Q15,15*/, &tmp2_e ) /*Q15,tmp2_e+tmp_e-15*/;
tmp_e = sub( add( tmp2_e, tmp_e ), 15 );
@@ -67,15 +88,23 @@ static void calcGainc_fx( Word16 *exc, Word16 Q_exc, Word32 old_fpitch /*Q16*/,
static void calcGainc2_fx( Word16 *exc, Word16 Q_exc, Word16 L_subfr /*Q0*/, Word32 *lp_gainc /*Q16*/ )
{
Word16 i, cnt, tmp16, tmp_e, tmp2_e;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_c, L_acc, L_tmp;
+#else
+ Word64 W_acc;
+ Word32 L_tmp;
+#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
+#endif
#endif
move16();
move16();
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Carry = 0;
move16();
Overflow = 0;
@@ -83,21 +112,32 @@ static void calcGainc2_fx( Word16 *exc, Word16 Q_exc, Word16 L_subfr /*Q0*/, Wor
L_c = L_deposit_l( 0 );
L_acc = L_deposit_l( 0 );
+#else
+ W_acc = 0;
+#endif
cnt = shl( L_subfr, 1 );
FOR( i = 0; i < cnt; i++ )
{
/* *gainc += ( exc[i-2*L_subfr] ) * ( exc[i-2*L_subfr]); */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_acc = L_macNs_co( L_acc, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, &Carry, &Overflow ); /*Q3*/
Overflow = 0;
move16();
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /* Accumulate Carrys Q-1*/
Carry = 0;
move16();
+#else
+ W_acc = W_mac_16_16( W_acc, exc[( i - ( L_subfr * 2 ) )] /*Q1*/, exc[( i - ( L_subfr * 2 ) )] /*Q1*/ ); /*Q3*/
+#endif
}
- L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ L_tmp = norm_llQ31( L_c, L_acc, &tmp_e ); /*Q3,norm,tmp_e*/
+#else
+ L_tmp = w_norm_llQ31( W_acc, &tmp_e ); /*Q3,norm,tmp_e*/
+#endif
tmp_e = add( tmp_e, sub( 31, ( add( shl( Q_exc, 1 ), 1 ) ) ) ); /*L_tmp is Q31, now*/
tmp16 = BASOP_Util_Divide3216_Scale( L_tmp /*Q31,norm,tmp_e*/, shl( L_subfr, 1 ) /*Q15,15*/, &tmp2_e ) /*Q15,tmp2_e+tmp_e-15*/;
tmp_e = sub( add( tmp2_e, tmp_e ), 15 );
@@ -843,10 +883,8 @@ void con_tcx_fx(
lerp( syn + sub( L_frame, shr( L_frame, 1 ) ), hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hTcxDec->Q_old_syn_Overl = Q_syn;
move16();
-#endif
Copy( syn + sub( L_frame, n ), hHQ_core->old_out_fx, sub( L_frame, n ) ); /*Q_syn*/
FOR( i = 0; i < W12; i++ )
@@ -871,13 +909,9 @@ void con_tcx_fx(
bufferCopyFx( syn, synth, L_frame, Q_syn, 0, 0, 0 ); /*Q_syn*/
BASOP_SATURATE_WARNING_ON_EVS
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( 0, Q_syn ) ); /*Q0*/
hTcxDec->Q_syn_OverlFB = 0;
move16();
-#else
- Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), negate( Q_syn ) ); /*Q0*/
-#endif
/* copy total excitation exc2 as 16kHz for acelp mode1 decoding */
IF( st->hWIDec != NULL )
@@ -939,23 +973,15 @@ void con_tcx_fx(
/* update memory for low band */
Scale_sig( hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), sub( -1, Q_syn ) ); /*Q_syn*/
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hTcxDec->Q_old_syn_Overl = -1;
move16();
-#endif
lerp( hTcxDec->syn_OverlFB, hTcxDec->syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hTcxDec->Q_syn_Overl = hTcxDec->Q_syn_OverlFB;
move16();
-#endif
lerp( hTcxDec->syn_Overl_TDACFB, hTcxDec->syn_Overl_TDAC, shr( st->L_frame, 1 ), shr( L_frame, 1 ) );
hTcxDec->Q_syn_Overl_TDAC = hTcxDec->Q_syn_Overl_TDACFB;
move16();
lerp( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_LB_fx, st->L_frame, L_frame );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_NO
- hHQ_core->Q_old_wtda_LB = hHQ_core->Q_old_wtda;
- move16();
-#endif
st->old_enr_LP = Enr_1_Az_fx( A_local, L_SUBFR ); /*Q3*/
move16();
@@ -981,7 +1007,11 @@ void con_tcx_ivas_fx(
Word16 pre_emph_buf;
Word16 hp_filt[L_FIR_FER2];
Word16 alpha;
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ Word16 tmp_deemph, gain, gainCNG, gain_inov, scf;
+#else
Word16 tmp_deemph, gain, gainCNG, gain_inov;
+#endif
Word16 *pt_exc, *pt1_exc;
Word16 Tc, tmpSeed;
Word16 fUseExtrapolatedPitch;
@@ -1056,18 +1086,33 @@ void con_tcx_ivas_fx(
/* set excitation memory*/
exc = buf + OLD_EXC_SIZE_DEC;
- tmp_deemph = synth[-1]; /*Q0*/
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ tmp_deemph = synth[-1]; /*st->Q_syn_factor*/
move16();
- pre_emph_buf = synth[-1]; /*Q0*/
+ pre_emph_buf = synth[-1]; /*st->Q_syn_factor*/
move16();
+#else
+ tmp_deemph = synth[-1]; /*Q0*/
+ move16();
+ pre_emph_buf = synth[-1]; /*Q0*/
+#endif
test();
IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc )
{
/* apply pre-emphasis to the signal */
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ mem = shl( synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )], st->Q_syn_factor );
+#else
mem = synth[( -( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + M + M ) - 1 )]; /*Q0*/
+#endif
move16();
Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), st->preemph_fac, add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), &mem, 1 );
+
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ scale_sig( &( synth[-( ( ( L_frame / 2 ) + hTcxDec->pit_max_TCX ) + 2 * M )] ), add( add( shr( L_frame, 1 ), hTcxDec->pit_max_TCX ), shl( M, 1 ) ), negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */
+#endif
+
st->Mode2_lp_gainc = L_deposit_l( 0 );
st->Mode2_lp_gainp = get_gain2( synth - shl( L_subfr, 1 ), synth - add( shl( L_subfr, 1 ), Tc ), shl( L_subfr, 1 ) );
@@ -1110,9 +1155,16 @@ void con_tcx_ivas_fx(
ELSE
{
/* apply pre-emphasis to the signal */
- mem = synth[( -L_frame - 1 )]; /*Q0*/
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ mem = shl( synth[( -L_frame - 1 )], st->Q_syn_factor ); /*hTcxDec->Q_synth_factor_old*/
+#else
+ mem = synth[( -L_frame - 1 )]; /*Q0*/
+#endif
move16();
Q_exc = E_UTIL_f_preemph3_ivas_fx( &( synth[-L_frame] ), st->preemph_fac, L_frame, &mem, 1 );
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ scale_sig( &synth[-L_frame], L_frame, negate( st->Q_syn_factor ) ); /*Q0, Setting back to Q0, as the following calculations are implemented assuming synth is in Q0 */
+#endif
Copy( st->old_Aq_12_8_fx, A_local, M + 1 ); /*Q14*/
offset = shr( L_frame, 1 );
@@ -1728,9 +1780,18 @@ void con_tcx_ivas_fx(
syn = buf + M; /*Q_syn*/
Copy( synth - M, buf, M ); /*Q_syn*/
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ scf = norm_s( tmp_deemph );
+ new_Q = sub( Q_exc, 4 ); // deemph_fx filter gain can be up to 10 (~2^3.32), so 4 bits of headroom are needed to avoid overflow
+#else
new_Q = sub( Q_exc, 3 );
+#endif
new_Q = s_max( new_Q, -1 );
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ new_Q = s_min( new_Q, scf );
+#else
new_Q = s_min( new_Q, norm_s( tmp_deemph ) );
+#endif
tmp16 = s_min( new_Q, st->prev_Q_syn );
st->prev_Q_syn = new_Q;
@@ -1741,8 +1802,15 @@ void con_tcx_ivas_fx(
move16();
Copy_Scale_sig( buf, mem_syn, M, exp_scale ); /* Q: tmp16 */
-
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ if ( GT_16( sub( Q_syn, st->Q_syn_factor ), scf ) )
+ {
+ Q_syn = add( scf, st->Q_syn_factor ); // so that (Q_syn - st->Q_syn_factor) = scf;
+ }
+ tmp_deemph = shl( tmp_deemph, sub( Q_syn, st->Q_syn_factor ) );
+#else
tmp_deemph = shl_sat( tmp_deemph, Q_syn );
+#endif
st->Q_syn = Q_syn;
move16();
@@ -1807,14 +1875,13 @@ void con_tcx_ivas_fx(
/* Deemphasis and output synth and ZIR */
deemph_fx( syn, st->preemph_fac, add( L_frame, shr( L_frame, 1 ) ), &tmp_deemph );
+#ifndef FIX_2003_CON_TCX_OVERFLOW
bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, 0, 0, 0 ); /*Q_syn*/
-
+#endif
lerp( syn + sub( L_frame, shr( L_frame, 1 ) ), hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hTcxDec->Q_old_syn_Overl = Q_syn;
move16();
-#endif
Copy( syn + sub( L_frame, n ), hHQ_core->old_out_fx, sub( L_frame, n ) ); /*Q_syn*/
FOR( i = 0; i < W12; i++ )
@@ -1833,18 +1900,33 @@ void con_tcx_ivas_fx(
hHQ_core->Q_old_wtda = Q_syn;
move16();
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ scf = add( getScaleFactor16( syn, L_frame ), Q_syn );
+ IF( LT_16( scf, 0 ) ) // Only avoid left shift in bufferCopyFX when overflow could occur
+ {
+ st->Q_syn_factor = scf;
+ }
+ ELSE
+ {
+ st->Q_syn_factor = 0;
+ move16();
+ }
+ bufferCopyFx( syn, synth, L_frame, Q_syn, st->Q_syn_factor, 0, 0 );
+
+ bufferCopyFx( syn + sub( L_frame, M + 1 ), st->syn, 1 + M, Q_syn, st->Q_syn_factor, 0, 0 );
+
+ Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( st->Q_syn_factor, Q_syn ) );
+ hTcxDec->Q_syn_OverlFB = st->Q_syn_factor;
+#else
/* As long as there is no synth scaling factor introduced, which
is given to the outside, there might occur overflows here */
BASOP_SATURATE_WARNING_OFF_EVS
bufferCopyFx( syn, synth, L_frame, Q_syn, 0, 0, 0 ); /*Q_syn*/
BASOP_SATURATE_WARNING_ON_EVS
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), sub( 0, Q_syn ) ); /*Q0*/
hTcxDec->Q_syn_OverlFB = 0;
move16();
-#else
- Copy_Scale_sig( syn + L_frame, hTcxDec->syn_OverlFB, shr( L_frame, 1 ), negate( Q_syn ) ); /*Q0*/
#endif
/* copy total excitation exc2 as 16kHz for acelp mode1 decoding */
@@ -1860,14 +1942,8 @@ void con_tcx_ivas_fx(
move16();
/* create aliasing and windowing need for transition to TCX10/5 */
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
Copy( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ) );
hTcxDec->Q_syn_Overl_TDACFB = Q_syn;
-#else
- // bufferCopyFx( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ), Q_syn, 0, -1, 0 );
- Copy_Scale_sig( syn + L_frame, hTcxDec->syn_Overl_TDACFB, shr( L_frame, 1 ), sub( Q_syn, 1 ) );
- hTcxDec->Q_syn_Overl_TDACFB = sub( Q_syn, 1 );
-#endif
move16();
FOR( i = 0; i < W12; i++ )
@@ -1914,15 +1990,9 @@ void con_tcx_ivas_fx(
/* update memory for low band */
st->Q_syn = Q_syn;
move16();
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
- Scale_sig( hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), sub( -1, Q_syn ) ); /*Q_syn*/
- st->hTcxDec->Q_old_syn_Overl = -1;
-#endif
lerp( hTcxDec->syn_OverlFB, hTcxDec->syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hTcxDec->Q_syn_Overl = hTcxDec->Q_syn_OverlFB;
move16();
-#endif
lerp( hTcxDec->syn_Overl_TDACFB, hTcxDec->syn_Overl_TDAC, shr( st->L_frame, 1 ), shr( L_frame, 1 ) );
hTcxDec->Q_syn_Overl_TDAC = hTcxDec->Q_syn_Overl_TDACFB;
move16();
diff --git a/lib_dec/er_scale_syn_fx.c b/lib_dec/er_scale_syn_fx.c
index 35ad826486d758fbbaa190df3afa1374320fc238..85cad33ee600fc8b6f629d43d1a6355a4987393a 100644
--- a/lib_dec/er_scale_syn_fx.c
+++ b/lib_dec/er_scale_syn_fx.c
@@ -33,10 +33,6 @@ Word16 Damping_fact_fx( /* o : damping factor
Word32 lp_tmp;
Word16 s_gainp;
Word32 gain32;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
IF( core == ACELP_CORE )
@@ -97,10 +93,10 @@ Word16 Damping_fact_fx( /* o : damping factor
move16();
gain32 = Sqrt32( lp_tmp, &s_gainp ); /*Q31-s_gainp*/
- gain = round_fx_o( L_shl_o( gain32, s_gainp, &Overflow ), &Overflow ); /* Q15*/
- gain = s_min( gain, 32113 /*0.98f Q15*/ ); /*Q15*/
- gain = s_max( gain, 27853 /*0.85f Q15*/ ); /*Q15*/
- alpha = mult_r( alpha, gain ); /*Q14*/
+ gain = round_fx_sat( L_shl_sat( gain32, s_gainp ) ); /* Q15*/
+ gain = s_min( gain, 32113 /*0.98f Q15*/ ); /*Q15*/
+ gain = s_max( gain, 27853 /*0.85f Q15*/ ); /*Q15*/
+ alpha = mult_r( alpha, gain ); /*Q14*/
}
ELSE IF( EQ_16( nbLostCmpt, 2 ) )
{
diff --git a/lib_dec/er_sync_exc_fx.c b/lib_dec/er_sync_exc_fx.c
index 48be80d43cecd12d70b57d6f2d4d8a47c93cbe3a..6fafb882af7de7721d889c8100c24690714fdad5 100644
--- a/lib_dec/er_sync_exc_fx.c
+++ b/lib_dec/er_sync_exc_fx.c
@@ -30,10 +30,6 @@ static Word16 GetMinimumPosition_fx(
Word16 iMinEnergyPos, center, i;
Word16 cnt, tmp_e, tmp16;
Word32 energy, energy_old, tmptest;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
filterLength = s_min( filterLength, length ); /*Q0*/
center = shr( filterLength, 1 ); /*Q0*/
@@ -60,8 +56,9 @@ static Word16 GetMinimumPosition_fx(
BASOP_SATURATE_WARNING_ON_EVS
/*if (energy == MAXVAL_WORD32)*/
- BASOP_SATURATE_WARNING_OFF_EVS /*saturates if energy < 0*/
- tmptest = L_sub_o( energy, MAXVAL_WORD32, &Overflow ); /*Q31*/
+ BASOP_SATURATE_WARNING_OFF_EVS /*saturates if energy < 0*/
+ tmptest = L_sub_sat( energy, MAXVAL_WORD32 );
+ /*Q31*/
BASOP_SATURATE_WARNING_ON_EVS
IF( tmptest == 0 )
{
@@ -227,10 +224,6 @@ void PulseResynchronization_fx(
Word16 /*int*/ roundedPitchStart, nSamplesDelta, nSamplesDeltaRemain, iMinPos1, iMinPos[NB_PULSES_MAX + 1], iDeltaSamples[NB_PULSES_MAX + 1], maxDeltaSamples, roundedCycleDelta;
Word16 tmp16, tmp16_a, freqStart_e /*exponent of freqStart*/, tmp_e, samplesDelta_e, perCycleDeltaDelta_e, cycleDelta_e, tmp2_e, tmp3_e;
Word32 /* pitchDelta, */ tmp32, tmp32_a, tmp32_b, samplesDelta, absPitchDiff, cycleDelta32;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
test();
@@ -295,7 +288,7 @@ void PulseResynchronization_fx(
tmp3_e = tmp2_e;
move16();
tmp32_a = L_negate( tmp32_a );
- tmp32_a = L_add( L_shl_o( 1, sub( 31, tmp3_e ), &Overflow ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/
+ tmp32_a = L_add( L_shl_sat( 1, sub( 31, tmp3_e ) ), tmp32_a ); /*Q31,tmp3_e*/ /*tmp32_a= 1.0f-pitchStart*freqStart*/
tmp2_e = norm_s( nFrameLength );
tmp16_a = shl( nFrameLength, tmp2_e ); /*Q0+tmp2_e*/
tmp32_a = Mpy_32_16_1( tmp32_a /*Q31,tmp3_e*/, tmp16_a /*Q0,-tmp2_e*/ ); /*Q16,tmp3_e-tmp2_e*/ /*tmp32_a= nFrameLength*(1.0f-pitchStart*freqStart)*/
@@ -360,8 +353,8 @@ void PulseResynchronization_fx(
fractionalLeft = lshr( extract_l( tmp32_a ), 1 ); /*Q15*/
tmp_e = sub( 15, norm_l( tmp32 ) );
cycleDelta_e = add( cycleDelta_e, tmp_e );
- tmp32 = L_shr( tmp32, sub( tmp_e, 15 ) ); /*Q31 frac, cycleDelta_e*/
- cycleDelta = round_fx_o( tmp32, &Overflow ); /*Q15, cycleDelta_e*/
+ tmp32 = L_shr( tmp32, sub( tmp_e, 15 ) ); /*Q31 frac, cycleDelta_e*/
+ cycleDelta = round_fx_sat( tmp32 ); /*Q15, cycleDelta_e*/
if ( cycleDelta == 0 )
{
cycleDelta_e = 0;
diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c
index 330cb5d4452ce4f80eda4d441ca7e3f0a4a931ce..9d9a273ac96c0b554aa710fc4c8f817b99f8c1a1 100644
--- a/lib_dec/er_util_fx.c
+++ b/lib_dec/er_util_fx.c
@@ -44,22 +44,12 @@ void minimumStatistics_fx(
Word16 f, p, i;
Word16 tmp, tmp2, tmp_e;
Word32 tmp32;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
-#endif
aOpt_e = 0;
move16();
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1796_replace_shl_o
IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) )
-#else
- IF( LT_16( shl_o( currentFrameLevel, currentFrameLevel_e, &Overflow ), PLC_MIN_CNG_LEV ) )
-#endif
{
BASOP_SATURATE_WARNING_ON_EVS
currentFrameLevel = PLC_MIN_CNG_LEV; /*Q15*/
diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c
index e411da152af54a0e1f8418a05a7759f0bb3746c7..d0231395bfe12568540c4073b5ab68db4475bd5a 100644
--- a/lib_dec/evs_dec_fx.c
+++ b/lib_dec/evs_dec_fx.c
@@ -62,10 +62,6 @@ ivas_error evs_dec_fx(
push_wmops( "evs_dec_fx" );
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
hBWE_TD = st_fx->hBWE_TD;
hHQ_core = st_fx->hHQ_core;
hTcxLtpDec = st_fx->hTcxLtpDec;
@@ -332,11 +328,7 @@ ivas_error evs_dec_fx(
IF( EQ_16( st_fx->core, ACELP_CORE ) )
{
/* ACELP core decoder */
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
IF( ( error = acelp_core_dec_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK )
-#else
- IF( ( error = acelp_core_dec_fx( st_fx, NULL, synth_fx, NULL, bwe_exc_extended_fx, voice_factors_fx, old_syn_12k8_16k_fx, sharpFlag, pitch_buf_fx, &unbits, &sid_bw, NULL, NULL, NULL, 0, EVS_MONO, 0, 0, 1, NULL, 1 ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
@@ -454,7 +446,7 @@ ivas_error evs_dec_fx(
/*hb_synth[i] *= (i*tmp);*/
hb_synth_fx[i] = mult_r( hb_synth_fx[i], tmp16_2 ); /*hb_synth_fx_exp*/
move16();
- tmp16_2 = add_o( tmp16_2, tmp16, &Overflow );
+ tmp16_2 = add_sat( tmp16_2, tmp16 );
}
}
diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c
index 1e78b792becb0373958b675bf9a4995e0e4fd819..d3b9634522e9c7e7ed83c4c2a6784a0ac57c2ca7 100644
--- a/lib_dec/fd_cng_dec_fx.c
+++ b/lib_dec/fd_cng_dec_fx.c
@@ -88,6 +88,9 @@ void initFdCngDec_ivas_fx(
hFdCngDec->hFdCngCom->olapBufferAna = hFdCngDec->olapBufferAna;
set16_fx( hFdCngDec->olapBufferSynth2, 0, FFTLEN );
hFdCngDec->hFdCngCom->olapBufferSynth2 = hFdCngDec->olapBufferSynth2;
+#ifdef FIX_1996_MASKING_NOISE
+ set32_fx( hFdCngDec->hFdCngCom->olapBufferSynth2_fx, 0, FFTLEN );
+#endif
/* Set some counters and flags */
@@ -576,17 +579,10 @@ Word16 ApplyFdCng_fx(
Word16 facTab[NPART];
Word16 facTabExp[NPART];
Word16 tmp_loop;
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
- Word32 L_c;
-#endif
Word16 lsp_cng[M];
HANDLE_FD_CNG_DEC hFdCngDec;
HANDLE_FD_CNG_COM hFdCngCom;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
- Flag Carry = 0;
-#endif
move16();
move16();
#endif
@@ -798,40 +794,6 @@ Word16 ApplyFdCng_fx(
{
tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand );
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
- L_tmp = L_deposit_h( 0 );
- L_c = L_deposit_h( 0 );
- FOR( j = 0; j < tmp_loop; j++ )
- {
-
- Carry = 0;
- move16();
- L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31*/
- Overflow = 0;
- move16();
-
- IF( *( cngNoiseLevel + j ) < 0 )
- {
- L_c = L_msuNs( L_c, 0, 0 ); /*Q-1*/
- }
- IF( *( cngNoiseLevel + j ) >= 0 )
- {
- L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/
- }
- }
- L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
- L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
-
- L_tmp = Mpy_32_16_1( L_tmp, 1 ); /*Q16 - L_tmp_exp*/
-
- L_tmp = Mpy_32_16_1( L_tmp, shr( T_DIV_L_Frame[L_shl( L_mac( -28000, NORM_MDCT_FACTOR, 95 ), 1 - 15 )], 1 ) ); /*Q16,exp -7*/
- L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */
- L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/
-
- st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/
- move16();
- L_tmp_exp = add( L_tmp_exp, 1 );
-#else
L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
@@ -843,7 +805,6 @@ Word16 ApplyFdCng_fx(
st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/
move16();
L_tmp_exp = add( L_tmp_exp, 1 );
-#endif
st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp;
move16();
}
@@ -851,38 +812,6 @@ Word16 ApplyFdCng_fx(
{
tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand );
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
- L_tmp = L_deposit_h( 0 );
- L_c = L_deposit_h( 0 );
- FOR( j = 0; j < tmp_loop; j++ )
- {
-
- Carry = 0;
- move16();
- L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31 - L_tmp_exp*/
- Overflow = 0;
- move16();
-
- IF( *( cngNoiseLevel + j ) < 0 )
- {
- L_c = L_msuNs( L_c, 0, 0 ); /*Q-1*/
- }
- IF( *( cngNoiseLevel + j ) >= 0 )
- {
- L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/
- }
- }
- L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
- L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
-
- L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/
-
- L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/
- L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */
- L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/
-
- st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/
-#else
L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp );
L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
@@ -893,47 +822,13 @@ Word16 ApplyFdCng_fx(
st->hTcxDec->conCngLevelBackgroundTrace = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/
-#endif
move16();
st->hTcxDec->conCngLevelBackgroundTrace_e = L_tmp_exp;
move16();
}
tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand );
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
- L_tmp = L_deposit_h( 0 );
- L_c = L_deposit_h( 0 );
- FOR( j = 0; j < tmp_loop; j++ )
- {
-
- Carry = 0;
- move16();
- L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31 - L_tmp_exp*/
- Overflow = 0;
- move16();
-
- IF( *( cngNoiseLevel + j ) < 0 )
- {
- L_c = L_msuNs( L_c, 0, 0 ); /*Q-1*/
- }
- IF( *( cngNoiseLevel + j ) >= 0 )
- {
- L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/
- }
- }
- L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
- L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
-
- L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/
-
- L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/
- L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */
- L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/
-
- st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/
- move16();
-#else
- L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
+ L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/
@@ -944,7 +839,6 @@ Word16 ApplyFdCng_fx(
st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/
move16();
-#endif
st->cngTDLevel_e = L_tmp_exp;
move16();
}
@@ -983,7 +877,7 @@ Word16 ApplyFdCng_fx(
}
L_tmp_exp = 0;
move16();
- IF( GT_32( L_shl_o( L_tmp, L_tmp_exp, &Overflow ), 21474836 ) /*0.01f Q31*/ )
+ IF( GT_32( L_tmp, 21474836 ) /*0.01f Q31*/ )
{
test();
test();
@@ -1063,39 +957,6 @@ Word16 ApplyFdCng_fx(
/*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/
tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand );
-#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
- L_tmp = L_deposit_h( 0 );
- L_c = L_deposit_h( 0 );
- FOR( j = 0; j < tmp_loop; j++ )
- {
-
- Carry = 0;
- move16();
- L_tmp = L_add_co( L_tmp, *( cngNoiseLevel + j ), &Carry, &Overflow ); /*Q31 - L_tmp_exp*/
- Overflow = 0;
- move16();
-
- IF( *( cngNoiseLevel + j ) < 0 )
- {
- L_c = L_msuNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/
- }
- IF( *( cngNoiseLevel + j ) >= 0 )
- {
- L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow ); /*Q-1*/
- }
- }
- L_tmp = norm_llQ31( L_c, L_tmp, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
- L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
-
- L_tmp = Mpy_32_16_1( L_tmp, hFdCngCom->fftlen ); /*Q16 - L_tmp_exp*/
-
- L_tmp = Mpy_32_16_1( L_tmp, T_DIV_L_Frame[L_shl( L_mac( -28000, st->L_frame, 95 ), 1 - 15 )] ); /*Q16,exp -7*/
- L_tmp_exp = add( L_tmp_exp, -7 ); /*->Q16, L_tmp_exp */
- L_tmp_exp = add( L_tmp_exp, 31 - 16 ); /*->Q31, L_tmp_exp*/
-
- st->cngTDLevel = round_fx_o( Sqrt32( L_tmp, &L_tmp_exp ), &Overflow ); /*Q15 - L_tmp_exp*/
- move16();
-#else
L_tmp = sum_array_norm( cngNoiseLevel, tmp_loop, &L_tmp_exp ); /*Q31 - L_tmp_exp*/
L_tmp_exp = sub( add( L_tmp_exp, *cngNoiseLevel_exp ), 1 );
@@ -1106,7 +967,6 @@ Word16 ApplyFdCng_fx(
st->cngTDLevel = round_fx( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/
move16();
-#endif
st->cngTDLevel_e = L_tmp_exp;
move16();
BREAK;
@@ -5136,17 +4996,29 @@ void generate_masking_noise_lb_dirac_fx(
overwriting it with the synthesis in case of shared tc and synth channel memory, i.e. non-TSM mode */
slot_size_cng = shr( hFdCngCom->frameSize, 4 /* DEFAULT_JBM_CLDFB_TIMESLOTS */ );
/* move start indices forward to the end of the last subframe */
+#ifdef FIX_2025_FDCNG_MULT
+ cur_subframe_start_outfs = i_mult( nCldfbTs, hSpatParamRendCom->slot_size );
+ cur_subframe_start_cngfs = i_mult( nCldfbTs, slot_size_cng );
+#else
cur_subframe_start_outfs = mult( nCldfbTs, hSpatParamRendCom->slot_size );
cur_subframe_start_cngfs = mult( nCldfbTs, slot_size_cng );
+#endif
/* go from the last subframe back and move the LB noise */
FOR( cur_subframe = sub( hSpatParamRendCom->nb_subframes, 1 ); cur_subframe >= 0; cur_subframe-- )
{
Word16 move_size, subframe_size_outfs;
+#ifdef FIX_2025_FDCNG_MULT
+ move_size = i_mult( slot_size_cng, hSpatParamRendCom->subframe_nbslots[cur_subframe] );
+ subframe_size_outfs = i_mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size );
+ cur_subframe_start_outfs = sub( cur_subframe_start_outfs, i_mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ) );
+ cur_subframe_start_cngfs = sub( cur_subframe_start_cngfs, i_mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], slot_size_cng ) );
+#else
move_size = mult( slot_size_cng, hSpatParamRendCom->subframe_nbslots[cur_subframe] );
subframe_size_outfs = mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size );
cur_subframe_start_outfs = sub( cur_subframe_start_outfs, mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], hSpatParamRendCom->slot_size ) );
cur_subframe_start_cngfs = sub( cur_subframe_start_cngfs, mult( hSpatParamRendCom->subframe_nbslots[cur_subframe], slot_size_cng ) );
+#endif
/* move cna */
Copy32( tdBuffer + cur_subframe_start_cngfs, tdBuffer + cur_subframe_start_outfs, move_size );
diff --git a/lib_dec/gain_dec_fx.c b/lib_dec/gain_dec_fx.c
index db325cd80b92a8be09722e96ce43d699613736e6..e001521bf8c87f4b57d4899b2a366b76f8f4667f 100644
--- a/lib_dec/gain_dec_fx.c
+++ b/lib_dec/gain_dec_fx.c
@@ -1409,10 +1409,6 @@ void gain_dec_amr_wb_fx(
Word16 tmp;
Word32 L_tmp;
Word16 expg, exp_gcode0, fracg;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
/**gain_inov = 1.0f/ (float)sqrt( ( dotp( code, code, L_SUBFR ) + 0.01f ) / L_SUBFR );*/
@@ -1496,7 +1492,7 @@ void gain_dec_amr_wb_fx(
/* adjust gain according to energy of code */
L_tmp = Mult_32_16( *gain_code, *gain_inov );
- *gain_code = L_shl_o( L_tmp, 3, &Overflow ); /* gcode_inov in Q12*/
+ *gain_code = L_shl_sat( L_tmp, 3 ); /* gcode_inov in Q12*/
move32();
/*-----------------------------------------------------------------*
diff --git a/lib_dec/gs_dec_fx.c b/lib_dec/gs_dec_fx.c
index 7ec991d48daaae21d257dd5856e27320555aa339..a17ca6febc6d7d9d75e208bbad1b35fe0d75aa29 100644
--- a/lib_dec/gs_dec_fx.c
+++ b/lib_dec/gs_dec_fx.c
@@ -104,11 +104,7 @@ void decod_audio_fx(
}
/* set bit-allocation */
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-#else
- config_acelp1_fx( DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), st_fx->next_bit_pos, st_fx->coder_type, st_fx->inactive_coder_type_flag, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-#endif
/*---------------------------------------------------------------*
* Decode energy dynamics
diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c
index 27d768f631bb7b007adeeae34f78ffe698833ad7..06ab1d95af82ccc90b7c1d8d3810c860bfc29606 100644
--- a/lib_dec/hf_synth_fx.c
+++ b/lib_dec/hf_synth_fx.c
@@ -136,10 +136,6 @@ static void hf_synthesis_fx(
Word16 tmp, ener, exp1, exp2, scale;
Word32 L_tmp;
Word16 Ap[M16k + 1];
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
/*-----------------------------------------------------------------*
* generate white noise vector
@@ -217,15 +213,14 @@ static void hf_synthesis_fx(
/*-----------------------------------------------------------------*
* modify energy of white noise according to synthesis tilt
*-----------------------------------------------------------------*/
-
/* tmp = 1.0 - fac */
- tmp = add_o( 1, sub( 32767 /* 1 in Q15 */, tmp ), &Overflow );
+ tmp = add_sat( 1, sub( 32767 /* 1 in Q15 */, tmp ) );
test();
if ( core_brate == FRAME_NO_DATA || EQ_32( core_brate, SID_2k40 ) )
{
/* emphasize HF noise in CNG */
/*fac *= 2.0f;*/
- tmp = add_o( tmp, tmp, &Overflow ); /* Q15 */
+ tmp = add_sat( tmp, tmp ); /* Q15 */
}
tmp = s_max( tmp, 3277 ); /* 0.1 in Q15 */
@@ -523,10 +518,6 @@ static void filt_6k_7k_scale_fx(
{
Word16 i, x[L_FRAME48k / NB_SUBFR + ( L_FIR - 1 )];
Word32 L_tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
Copy_Scale_sig( mem, x, L_FIR - 1, exp );
FOR( i = 0; i < lg; i++ )
@@ -542,10 +533,10 @@ static void filt_6k_7k_scale_fx(
move32();
FOR( j = 0; j < 31; j++ )
{
- L_tmp = L_mac_o( L_tmp, x[i + j], fir_6k_7k_fx[j], &Overflow ); /* Q16 */
+ L_tmp = L_mac_sat( L_tmp, x[i + j], fir_6k_7k_fx[j] ); /* Q16 */
}
- signal[i] = round_fx_o( L_tmp, &Overflow ); /* Q0 */
+ signal[i] = round_fx_sat( L_tmp ); /* Q0 */
move16();
}
Copy( x + lg, mem, L_FIR - 1 ); /* Qx - 2 */
@@ -1385,8 +1376,6 @@ static Word16 EnhanceClass_fx(
Word16 unvoicing_tmp_fx;
Word16 tmp, tmp1;
Word32 L_tmp;
- Flag Overflow;
-
/* Decide (*unvoicing_flag) to allow BWE enhancement when qq>pp */
/**voice_fac_fx = add(mult_r(*voice_fac_fx, 24576), mult_r(voice_factor_fx, 8192)); //Q15 */
@@ -1423,13 +1412,13 @@ static Word16 EnhanceClass_fx(
move16();
}
- if ( GT_16( sub_o( *unvoicing_fx, *unvoicing_sm_fx, &Overflow ), 3277 /* 0.1 in Q15 */ ) )
+ if ( GT_16( sub_sat( *unvoicing_fx, *unvoicing_sm_fx ), 3277 /* 0.1 in Q15 */ ) )
{
*unvoicing_flag = 1;
move16();
}
- if ( LT_16( sub_o( *unvoicing_fx, *unvoicing_sm_fx, &Overflow ), 1638 /* 0.05 in Q15 */ ) )
+ if ( LT_16( sub_sat( *unvoicing_fx, *unvoicing_sm_fx ), 1638 /* 0.05 in Q15 */ ) )
{
*unvoicing_flag = 0;
move16();
diff --git a/lib_dec/hq_classifier_dec_fx.c b/lib_dec/hq_classifier_dec_fx.c
index c8dac0a0bc934199a60e6bf05c50e91235d4e3fc..4bbe3c5bc06e392d746c60b807bdf084474cebed 100644
--- a/lib_dec/hq_classifier_dec_fx.c
+++ b/lib_dec/hq_classifier_dec_fx.c
@@ -105,7 +105,7 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits
test();
IF( ( EQ_16( length, L_SPEC32k ) || EQ_16( length, L_FRAME48k ) ) && LE_32( core_brate, max_brate ) )
{
- *hqswb_clas = get_next_indice( st_fx, 2 ); /* Q0 */
+ *hqswb_clas = get_next_indice_fx( st_fx, 2 ); /* Q0 */
move16();
bits = 2;
move16();
@@ -119,7 +119,7 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits
}
ELSE
{
- *hqswb_clas = get_next_indice( st_fx, 1 ); /* Q0 */
+ *hqswb_clas = get_next_indice_fx( st_fx, 1 ); /* Q0 */
move16();
bits = 1;
move16();
diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c
index 0161cbac0e1ad5b6f95c233ca22f1ba665229c56..5153215dbc021b5fe2ade623fbf2b8e0dea68933 100644
--- a/lib_dec/hq_core_dec_fx.c
+++ b/lib_dec/hq_core_dec_fx.c
@@ -103,7 +103,7 @@ void hq_core_dec_fx(
test();
IF( !( core_switching_flag ) && GT_32( st_fx->core_brate, MINIMUM_RATE_TO_ENCODE_VOICING_FLAG ) )
{
- hHQ_core->HqVoicing = get_next_indice( st_fx, 1 ); /* Q0 */
+ hHQ_core->HqVoicing = get_next_indice_fx( st_fx, 1 ); /* Q0 */
move16();
num_bits = sub( num_bits, 1 ); /* Q0 */
}
@@ -1094,10 +1094,8 @@ void HQ_core_dec_init_fx(
move16();
move16();
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hHQ_core->Q_old_out_fx32 = Q11;
move16();
-#endif
hHQ_core->last_hq_core_type = -1; /* Q0 */
move16();
diff --git a/lib_dec/hq_hr_dec_fx.c b/lib_dec/hq_hr_dec_fx.c
index 6423015bc4f8afe008e206801dc367770e8d32d8..27b352cd34e29cf546dd68ac15ff087d2f1a8311 100644
--- a/lib_dec/hq_hr_dec_fx.c
+++ b/lib_dec/hq_hr_dec_fx.c
@@ -477,7 +477,7 @@ void hq_hr_dec_fx(
test();
IF( !*is_transient && NE_16( *hqswb_clas, HQ_HVQ ) && !( EQ_16( length, L_FRAME16k ) && LE_32( st_fx->core_brate, HQ_32k ) ) )
{
- nf_idx = get_next_indice( st_fx, 2 ); /* Q0 */
+ nf_idx = get_next_indice_fx( st_fx, 2 ); /* Q0 */
}
/*------------------------------------------------------------------*
diff --git a/lib_dec/hq_lr_dec_fx.c b/lib_dec/hq_lr_dec_fx.c
index 7d5d6a34b907255f65e9d83ee0e0224c686ba7aa..e8c7b365ebe4c3b019c777cd716f0f594bf16a49 100644
--- a/lib_dec/hq_lr_dec_fx.c
+++ b/lib_dec/hq_lr_dec_fx.c
@@ -629,10 +629,29 @@ void hq_lr_dec_fx(
IF( GE_16( i, highband ) )
{
+
+ /* safety check in case of bit errors */
+ IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) )
+ {
+ st_fx->BER_detect = 1;
+ move16();
+ set32_fx( L_yout, 0, inner_frame );
+ return;
+ }
+
enerH_fx = L_add_sat( enerH_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */
}
ELSE IF( GE_16( i, lowband ) )
{
+ /* safety check in case of bit errors */
+ IF( GT_32( Ep_fx[i], 536788991 /* max(Q30) */ ) )
+ {
+ st_fx->BER_detect = 1;
+ move16();
+ set32_fx( L_yout, 0, inner_frame );
+ return;
+ }
+
enerL_fx = L_add_sat( enerL_fx, L_shl_sat( Ep_fx[i], 2 ) ); /*Q0 */
}
}
diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c
index 40b02c82315c383281a2b69656305999573e1ab0..ee462d7c550d1871a6ae948c118c270f310e556c 100644
--- a/lib_dec/igf_dec_fx.c
+++ b/lib_dec/igf_dec_fx.c
@@ -1482,11 +1482,15 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
Word16 dS[IGF_MAX_SFB];
Word16 dS_e[IGF_MAX_SFB];
Word32 energyTmp[24];
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_c;
+#endif
Word16 Hr;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
+#endif
move16();
move16();
#endif
@@ -1565,6 +1569,7 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
&dE_e,
negate( tmp ) );
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_c = 0;
move32();
FOR( tb = 0; tb < 24; tb++ )
@@ -1577,6 +1582,9 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
}
L_tmp = norm_llQ31( L_c, L_tmp, &shift ); // Q31
+#else
+ L_tmp = sum_array_norm( energyTmp, 24, &shift );
+#endif
/* float: dE = (float)sqrt(dE / 24.f); basop: */
shift = add( sub( shift, 4 ), dE_e ); /* x/24 = (x >> 4) * 1/1.5 */
dE = Sqrt16norm( extract_h( L_tmp ), &shift );
@@ -1884,8 +1892,8 @@ static void IGF_appl( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
sum = shl( sum, shift ); /* exponent of sum: sub(15, shift) */
/* divide E by sum */
- tmp = div_s( shr( round_fx_o( E, &Overflow ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */
- tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */
+ tmp = div_s( shr( round_fx_sat( E ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */
+ tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */
/* multiply the result by the hopsize */
L_tmp = L_mult( tmp, hopsize );
@@ -2168,15 +2176,19 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
Word16 dS[IGF_MAX_SFB];
Word16 dS_e[IGF_MAX_SFB];
Word32 energyTmp[24];
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_c;
+#endif
Word16 spec_e_arr[N_MAX];
Word16 vspec_e_arr[N_MAX_TCX - IGF_START_MN];
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
move16();
Flag Carry = 0;
move16();
#endif
+#endif
/* initialize variables */
@@ -2254,6 +2266,7 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
&dE_e,
negate( tmp ) );
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_c = 0;
move32();
FOR( tb = 0; tb < 24; tb++ )
@@ -2265,6 +2278,9 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
}
L_tmp = norm_llQ31( L_c, L_tmp, &shift ); // Q31
+#else
+ L_tmp = sum_array_norm( energyTmp, 24, &shift );
+#endif
/* float: dE = (float)sqrt(dE / 24.f); basop: */
shift = add( sub( shift, 4 ), dE_e ); /* x/24 = (x >> 4) * 1/1.5 */
dE = Sqrt16norm( extract_h( L_tmp ), &shift );
@@ -2571,8 +2587,8 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in
sum = shl( sum, shift ); /* exponent of sum: sub(15, shift) */
/* divide E by sum */
- tmp = div_s( shr( round_fx_o( E, &Overflow ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */
- tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */
+ tmp = div_s( shr( round_fx_sat( E ), 1 ), sum ); /* shift E 1 bit to the right in order to make it smaller than sum */
+ tmp_e = sub( add( E_e, 1 ), sub( 15, shift ) ); /* 15Q0 | sum is 15Q0 */
/* multiply the result by the hopsize */
L_tmp = L_mult( tmp, hopsize );
@@ -2975,12 +2991,6 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in
Word16 sfb;
Word16 tmp;
Word16 delta;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
-#endif
set16_fx( a, 0, IGF_MAX_SFB + 1 );
@@ -2994,11 +3004,7 @@ static void IGF_RefineGrid( H_IGF_GRID hGrid /**< in
move16();
tmp = add( tmp, 1 );
delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] );
-#ifdef ISSUE_1796_replace_shl_o
delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) );
-#else
- delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) );
-#endif
a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) );
move16();
IF( s_and( a[tmp], 1 ) != 0 )
@@ -3029,12 +3035,6 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han
Word16 sfb;
Word16 tmp;
Word16 delta;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
-#endif
set16_fx( a, 0, IGF_MAX_SFB + 1 );
@@ -3048,11 +3048,7 @@ static void IGF_RefineGrid_ivas_fx( H_IGF_GRID hGrid /**< in/out: | IGF grid han
move16();
tmp = add( tmp, 1 );
delta = sub( hGrid->swb_offset[sfb + 1], hGrid->swb_offset[sfb] );
-#ifdef ISSUE_1796_replace_shl_o
delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_sat( delta, 5 ) );
-#else
- delta = mac_r( 0x00195000, 29491 /*0.45f Q16*/, shl_o( delta, 5, &Overflow ) );
-#endif
a[tmp] = add( hGrid->swb_offset[sfb], shr( delta, 6 ) );
move16();
// Rounding off delta values >=t+0.5 to t+1
@@ -4296,6 +4292,10 @@ void init_igf_dec(
hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[0];
hIGFDec->infoTCXNoise_ptr = &hIGFDec->infoTCXNoise_evs[0];
hIGFDec->virtualSpec_fx = &hIGFDec->virtualSpec[0];
+#ifdef FIX_1385_INIT_IGF_STOP_FREQ
+ hIGFDec->infoIGFStopFreq = 0;
+ move16();
+#endif
return;
}
diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c
index 9f77d2913f94d53ae1c7e9d1ada01f4e0f0f2201..7a89118c3b041bd77316c322d945cd0f125aead9 100644
--- a/lib_dec/init_dec_fx.c
+++ b/lib_dec/init_dec_fx.c
@@ -1174,11 +1174,7 @@ ivas_error init_decoder_ivas_fx(
move16();
st_fx->last_vad_fx = 0;
move16();
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
st_fx->active_cnt = CNG_TYPE_HO;
-#else
- st_fx->active_cnt = 20;
-#endif
move16();
test();
diff --git a/lib_dec/ivas_binRenderer_internal_fx.c b/lib_dec/ivas_binRenderer_internal_fx.c
index 53f1c271a5df5422cd6c7e9fb14dcab26f9059d1..a92d8a3d58e67282c2d78929eae13697e613d3f5 100644
--- a/lib_dec/ivas_binRenderer_internal_fx.c
+++ b/lib_dec/ivas_binRenderer_internal_fx.c
@@ -43,18 +43,18 @@
#include "ivas_rom_binauralRenderer.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
#include "debug.h"
-#define NUM_TAPS_F0_6 ( Word16 )( 58 ) // (Word16) ceil( 0.6f * hBinRenConvModule->numTaps )
-#define NUM_TAPS_F0_5 ( Word16 )( 48 ) // (Word16) ceil( 0.5f * hBinRenConvModule->numTaps )
-#define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (Word16) ceil( 0.4f * hBinRenConvModule->numTaps )
-#define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (Word16) ceil( 0.3f * hBinRenConvModule->numTaps )
-#ifdef FIX_1053_REVERB_RECONFIGURATION
+
/*----------------------------------------------------------------------------------*
* Local constants
*----------------------------------------------------------------------------------*/
+#define NUM_TAPS_F0_6 ( Word16 )( 58 ) // (Word16) ceil( 0.6f * hBinRenConvModule->numTaps )
+#define NUM_TAPS_F0_5 ( Word16 )( 48 ) // (Word16) ceil( 0.5f * hBinRenConvModule->numTaps )
+#define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (Word16) ceil( 0.4f * hBinRenConvModule->numTaps )
+#define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (Word16) ceil( 0.3f * hBinRenConvModule->numTaps )
+
#define REVERB_INPUT_DOWNMIX_CHANNELS ( 11 )
/* Downmix table for sparse frequency domain reverberator*/
const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] = {
@@ -62,7 +62,7 @@ const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][REVERB_INPUT_DOWNMIX_CHANNELS] =
{ 0x7fffffff, 0, 1518485623, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0 },
{ 0, 0x7fffffff, 1518485623, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff },
};
-#endif
+
/*-------------------------------------------------------------------------
* ivas_binRenderer_filterModule_fx()
@@ -88,606 +88,613 @@ static void ivas_binRenderer_filterModule_fx(
Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx];
move16();
-#ifdef OPT_BIN_REND_V2_NBE
shift_q = add( sub( Q_filterStates, Q_curr ), 1 );
hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx] = Q_curr;
-#else /* OPT_BIN_REND_V2_NBE */
- Word64 Cldfb_RealBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES];
- Word64 Cldfb_ImagBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES];
-#endif /* OPT_BIN_REND_V2_NBE */
FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
{
-#ifndef OPT_BIN_REND_V2_NBE
- set64_fx( &Cldfb_RealBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES );
- set64_fx( &Cldfb_ImagBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES );
-
- FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
+ FOR( k = 0; k < numTimeSlots; k++ )
{
- filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx][0] );
- filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx][0] );
-
- filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29
- filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx]; // Q29
- filterTapsRightRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx]; // Q29
- filterTapsRightImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx]; // Q29
+ Word64 outRealLeft_fx = 0, outRealRight_fx = 0, outImagLeft_fx = 0, outImagRight_fx = 0;
+ move64();
+ move64();
+ move64();
+ move64();
+ Word64 outRealLeft = 0, outRealRight = 0, outImagLeft = 0, outImagRight = 0;
+ move64();
+ move64();
+ move64();
+ move64();
-#endif /* OPT_BIN_REND_V2_NBE */
- FOR( k = 0; k < numTimeSlots; k++ )
+ FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
{
- Word64 outRealLeft_fx = 0, outRealRight_fx = 0, outImagLeft_fx = 0, outImagRight_fx = 0;
- move64();
- move64();
- move64();
- move64();
-#ifdef OPT_BIN_REND_V2_NBE
- Word64 outRealLeft = 0, outRealRight = 0, outImagLeft = 0, outImagRight = 0;
- move64();
- move64();
- move64();
- move64();
-
- FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
- {
- filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx][0] );
- filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx][0] );
-
- filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29
- filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx]; // Q29
- filterTapsRightRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx]; // Q29
- filterTapsRightImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx]; // Q29
-#endif /* OPT_BIN_REND_V2_NBE */
+ filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx][0] );
+ filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx][0] );
- FOR( tapIdx = hBinRenderer->hBinRenConvModule->numTapsArray[bandIdx] - 1; tapIdx > 0; tapIdx-- )
- {
- filterStatesLeftRealPtr_fx[tapIdx] = filterStatesLeftRealPtr_fx[tapIdx - 1];
- move32();
- filterStatesLeftImagPtr_fx[tapIdx] = filterStatesLeftImagPtr_fx[tapIdx - 1];
- move32();
- Word32 neg_filterStatesLeftImagPtr_fx = L_negate( filterStatesLeftImagPtr_fx[tapIdx] );
+ filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx]; // Q29
+ filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx]; // Q29
+ filterTapsRightRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx]; // Q29
+ filterTapsRightImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx]; // Q29
+ FOR( tapIdx = hBinRenderer->hBinRenConvModule->numTapsArray[bandIdx] - 1; tapIdx > 0; tapIdx-- )
+ {
+ filterStatesLeftRealPtr_fx[tapIdx] = filterStatesLeftRealPtr_fx[tapIdx - 1];
+ move32();
+ filterStatesLeftImagPtr_fx[tapIdx] = filterStatesLeftImagPtr_fx[tapIdx - 1];
+ move32();
+ Word32 neg_filterStatesLeftImagPtr_fx = L_negate( filterStatesLeftImagPtr_fx[tapIdx] );
- outRealLeft_fx = W_mac_32_32( outRealLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- outRealLeft_fx = W_mac_32_32( outRealLeft_fx, neg_filterStatesLeftImagPtr_fx, filterTapsLeftImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- outImagLeft_fx = W_mac_32_32( outImagLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- outImagLeft_fx = W_mac_32_32( outImagLeft_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
+ outRealLeft_fx = W_mac_32_32( outRealLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
+ outRealLeft_fx = W_mac_32_32( outRealLeft_fx, neg_filterStatesLeftImagPtr_fx, filterTapsLeftImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- outRealRight_fx = W_mac_32_32( outRealRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- outRealRight_fx = W_mac_32_32( outRealRight_fx, neg_filterStatesLeftImagPtr_fx, filterTapsRightImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
+ outImagLeft_fx = W_mac_32_32( outImagLeft_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsLeftImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
+ outImagLeft_fx = W_mac_32_32( outImagLeft_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsLeftRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
- }
+ outRealRight_fx = W_mac_32_32( outRealRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
+ outRealRight_fx = W_mac_32_32( outRealRight_fx, neg_filterStatesLeftImagPtr_fx, filterTapsRightImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
-#ifndef OPT_BIN_REND_V2_NBE
- shift_q = add( sub( Q_filterStates, Q_curr ), 1 );
+ outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftRealPtr_fx[tapIdx], filterTapsRightImagPtr_fx[tapIdx] ); // Q30 + Q_filterStates
+ outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
+ }
- IF( shift_q != 0 )
- {
- outRealLeft_fx = W_shr( outRealLeft_fx, shift_q ); // Q_curr + Q29
- outImagLeft_fx = W_shr( outImagLeft_fx, shift_q ); // Q_curr + Q29
- outRealRight_fx = W_shr( outRealRight_fx, shift_q ); // Q_curr + Q29
- outImagRight_fx = W_shr( outImagRight_fx, shift_q ); // Q_curr + Q29
- hBinRenderer->hBinRenConvModule->Q_filterStates[pos_idx] = Q_curr;
- move16();
- }
-#endif /* OPT_BIN_REND_V2_NBE */
- filterStatesLeftRealPtr_fx[0] = CLDFB_real[chIdx][k][bandIdx];
- move32();
- filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx];
- move32();
+ filterStatesLeftRealPtr_fx[0] = CLDFB_real[chIdx][k][bandIdx];
+ move32();
+ filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx];
+ move32();
-#ifdef OPT_BIN_REND_V2_NBE
- /* Left Real and Imag */
- Word32 neg_temp2 = L_negate( filterStatesLeftImagPtr_fx[0] ); // Q_curr
+ /* Left Real and Imag */
+ Word32 neg_temp2 = L_negate( filterStatesLeftImagPtr_fx[0] ); // Q_curr
- outRealLeft = W_mac_32_32( W_mac_32_32( outRealLeft, filterStatesLeftRealPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), neg_temp2, filterTapsLeftImagPtr_fx[0] );
- outImagLeft = W_mac_32_32( W_mac_32_32( outImagLeft, filterStatesLeftImagPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsLeftImagPtr_fx[0] );
+ outRealLeft = W_mac_32_32( W_mac_32_32( outRealLeft, filterStatesLeftRealPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), neg_temp2, filterTapsLeftImagPtr_fx[0] );
+ outImagLeft = W_mac_32_32( W_mac_32_32( outImagLeft, filterStatesLeftImagPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsLeftImagPtr_fx[0] );
- /* Right Real and Imag */
- outRealRight = W_mac_32_32( W_mac_32_32( outRealRight, neg_temp2, filterTapsRightImagPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsRightRealPtr_fx[0] );
- outImagRight = W_mac_32_32( W_mac_32_32( outImagRight, filterStatesLeftImagPtr_fx[0], filterTapsRightRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsRightImagPtr_fx[0] );
- }
- out_Conv_CLDFB_real[0][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outRealLeft_fx, shift_q ), W_shr( outRealLeft, 1 ) ), shift_q6 );
- out_Conv_CLDFB_real[1][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outRealRight_fx, shift_q ), W_shr( outRealRight, 1 ) ), shift_q6 );
- out_Conv_CLDFB_imag[0][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outImagLeft_fx, shift_q ), W_shr( outImagLeft, 1 ) ), shift_q6 );
- out_Conv_CLDFB_imag[1][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outImagRight_fx, shift_q ), W_shr( outImagRight, 1 ) ), shift_q6 );
- move32();
- move32();
- move32();
- move32();
+ /* Right Real and Imag */
+ outRealRight = W_mac_32_32( W_mac_32_32( outRealRight, neg_temp2, filterTapsRightImagPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsRightRealPtr_fx[0] );
+ outImagRight = W_mac_32_32( W_mac_32_32( outImagRight, filterStatesLeftImagPtr_fx[0], filterTapsRightRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsRightImagPtr_fx[0] );
}
-#else /* OPT_BIN_REND_V2_NBE */
- /* Left Real and Imag */
+ out_Conv_CLDFB_real[0][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outRealLeft_fx, shift_q ), W_shr( outRealLeft, 1 ) ), shift_q6 );
+ out_Conv_CLDFB_real[1][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outRealRight_fx, shift_q ), W_shr( outRealRight, 1 ) ), shift_q6 );
+ out_Conv_CLDFB_imag[0][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outImagLeft_fx, shift_q ), W_shr( outImagLeft, 1 ) ), shift_q6 );
+ out_Conv_CLDFB_imag[1][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outImagRight_fx, shift_q ), W_shr( outImagRight, 1 ) ), shift_q6 );
+ move32();
+ move32();
+ move32();
+ move32();
+ }
+ }
- Word32 temp1 = L_shr( filterStatesLeftRealPtr_fx[0], 1 ); // Q_curr -1
- Word32 temp2 = L_shr( filterStatesLeftImagPtr_fx[0], 1 ); // Q_curr -1
- Word32 neg_temp2 = L_negate( temp2 ); // Q_curr -1
+ return;
+}
- outRealLeft_fx = W_mac_32_32( outRealLeft_fx, temp1, filterTapsLeftRealPtr_fx[0] );
- outRealLeft_fx = W_mac_32_32( outRealLeft_fx, neg_temp2, filterTapsLeftImagPtr_fx[0] );
- Cldfb_RealBuffer_64fx[0][k] = W_add( Cldfb_RealBuffer_64fx[0][k], outRealLeft_fx ); // Q29 + Q_curr
- move64();
+/*-------------------------------------------------------------------------
+ * ivas_binRenderer_convModuleOpen()
+ *
+ * Open convolution module handle of fastconv binaural renderer
+ *-------------------------------------------------------------------------*/
+static ivas_error ivas_binRenderer_convModuleOpen(
+ BINAURAL_RENDERER_HANDLE hBinRenderer,
+ const Word16 renderer_type,
+ const Word16 isLoudspeaker,
+ const AUDIO_CONFIG input_config,
+ const HRTFS_FASTCONV_HANDLE hHrtf,
+ const Word16 num_poses )
+{
+ Word16 bandIdx, chIdx;
+ Word16 pos_idx;
- outImagLeft_fx = W_mac_32_32( outImagLeft_fx, temp1, filterTapsLeftImagPtr_fx[0] );
- outImagLeft_fx = W_mac_32_32( outImagLeft_fx, temp2, filterTapsLeftRealPtr_fx[0] );
- Cldfb_ImagBuffer_64fx[0][k] = W_add( Cldfb_ImagBuffer_64fx[0][k], outImagLeft_fx ); // Q29 + Q_curr
- move64();
+ BINRENDERER_CONV_MODULE_HANDLE_FX hBinRenConvModule;
- /* Right Real and Imag */
- outRealRight_fx = W_mac_32_32( outRealRight_fx, temp1, filterTapsRightRealPtr_fx[0] );
- outRealRight_fx = W_mac_32_32( outRealRight_fx, neg_temp2, filterTapsRightImagPtr_fx[0] );
- Cldfb_RealBuffer_64fx[1][k] = W_add( Cldfb_RealBuffer_64fx[1][k], outRealRight_fx ); // Q29 + Q_curr
- move64();
+ /*-----------------------------------------------------------------*
+ * prepare library opening
+ *-----------------------------------------------------------------*/
- outImagRight_fx = W_mac_32_32( outImagRight_fx, temp1, filterTapsRightImagPtr_fx[0] );
- outImagRight_fx = W_mac_32_32( outImagRight_fx, temp2, filterTapsRightRealPtr_fx[0] );
- Cldfb_ImagBuffer_64fx[1][k] = W_add( Cldfb_ImagBuffer_64fx[1][k], outImagRight_fx ); // Q29 + Q_curr
- move64();
- }
- }
- FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
+ IF( ( hBinRenConvModule = (BINRENDERER_CONV_MODULE_HANDLE_FX) malloc( sizeof( BINRENDERER_CONV_MODULE_FX ) ) ) == NULL )
{
- FOR( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ )
- {
- out_Conv_CLDFB_real[chIdx][k][bandIdx] = W_shl_sat_l( Cldfb_RealBuffer_64fx[chIdx][k], shift_q6 ); // Q6
- move32();
- out_Conv_CLDFB_imag[chIdx][k][bandIdx] = W_shl_sat_l( Cldfb_ImagBuffer_64fx[chIdx][k], shift_q6 ); // Q6
- move32();
- }
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
-#endif /* OPT_BIN_REND_V2_NBE */
- }
-
- return;
+ IF( !isLoudspeaker )
+ {
+ hBinRenderer->nInChannels = audioCfg2channels( input_config );
+ move16();
}
-
- /*-------------------------------------------------------------------------
- * ivas_binRenderer_convModuleOpen()
- *
- * Open convolution module handle of fastconv binaural renderer
- *-------------------------------------------------------------------------*/
- static ivas_error ivas_binRenderer_convModuleOpen(
- BINAURAL_RENDERER_HANDLE hBinRenderer,
- const Word16 renderer_type,
- const Word16 isLoudspeaker,
- const AUDIO_CONFIG input_config,
- const HRTFS_FASTCONV_HANDLE hHrtf,
- const Word16 num_poses )
+ ELSE
{
- Word16 bandIdx, chIdx;
- Word16 pos_idx;
-
- BINRENDERER_CONV_MODULE_HANDLE_FX hBinRenConvModule;
+ /* Note: needs to be revisited if multiple LFE support is required */
+ hBinRenderer->nInChannels = sub( audioCfg2channels( input_config ), isLoudspeaker );
+ move16();
+ }
- /*-----------------------------------------------------------------*
- * prepare library opening
- *-----------------------------------------------------------------*/
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ hBinRenConvModule->numTaps = hHrtf->ntaps;
+ move16();
+#endif
- IF( ( hBinRenConvModule = (BINRENDERER_CONV_MODULE_HANDLE_FX) malloc( sizeof( BINRENDERER_CONV_MODULE_FX ) ) ) == NULL )
+ IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+ {
+#ifndef FIX_CREND_SIMPLIFY_CODE
+ hBinRenConvModule->numTaps = BINAURAL_NTAPS_MAX;
+ move16();
+#endif
+ /* Use variable order filtering */
+ bandIdx = 0;
+ move16();
+ FOR( ; bandIdx < 5; bandIdx++ )
{
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps;
+ move16();
}
-
- IF( !isLoudspeaker )
+ FOR( ; bandIdx < 10; bandIdx++ )
{
- hBinRenderer->nInChannels = audioCfg2channels( input_config );
+ hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_6;
move16();
}
- ELSE
+ FOR( ; bandIdx < 20; bandIdx++ )
{
- /* Note: needs to be revisited if multiple LFE support is required */
- hBinRenderer->nInChannels = sub( audioCfg2channels( input_config ), isLoudspeaker );
+ hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_5;
move16();
}
-
- IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+ FOR( ; bandIdx < 30; bandIdx++ )
{
- hBinRenConvModule->numTaps = BINAURAL_NTAPS_MAX;
+ hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_4;
move16();
-
- /* Use variable order filtering */
- bandIdx = 0;
+ }
+ FOR( ; bandIdx < hBinRenderer->conv_band; bandIdx++ )
+ {
+ hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_3;
+ move16();
+ }
+ }
+ ELSE
+ {
+#ifndef FIX_CREND_SIMPLIFY_CODE
+ IF( EQ_16( hBinRenderer->ivas_format, SBA_FORMAT ) )
+ {
+ hBinRenConvModule->numTaps = BINAURAL_NTAPS_SBA;
move16();
- FOR( ; bandIdx < 5; bandIdx++ )
- {
- hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps;
- move16();
- }
- FOR( ; bandIdx < 10; bandIdx++ )
- {
- hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_6;
- move16();
- }
- FOR( ; bandIdx < 20; bandIdx++ )
- {
- hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_5;
- move16();
- }
- FOR( ; bandIdx < 30; bandIdx++ )
- {
- hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_4;
- move16();
- }
- FOR( ; bandIdx < hBinRenderer->conv_band; bandIdx++ )
- {
- hBinRenConvModule->numTapsArray[bandIdx] = NUM_TAPS_F0_3;
- move16();
- }
}
ELSE
{
- IF( EQ_16( hBinRenderer->ivas_format, SBA_FORMAT ) )
- {
- hBinRenConvModule->numTaps = BINAURAL_NTAPS_SBA;
- move16();
- }
- ELSE
- {
- hBinRenConvModule->numTaps = BINAURAL_NTAPS;
- move16();
- }
-
- /* Use fixed order filtering */
- bandIdx = 0;
+ hBinRenConvModule->numTaps = BINAURAL_NTAPS;
move16();
- FOR( ; bandIdx < hBinRenderer->conv_band; bandIdx++ )
- {
- hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps;
- move16();
- }
}
-
- /* allocate memory for filter states */
- IF( ( hBinRenConvModule->filterTapsLeftReal_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+#endif
+ /* Use fixed order filtering */
+ bandIdx = 0;
+ move16();
+ FOR( ; bandIdx < hBinRenderer->conv_band; bandIdx++ )
{
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ hBinRenConvModule->numTapsArray[bandIdx] = hBinRenConvModule->numTaps;
+ move16();
}
+ }
- IF( ( hBinRenConvModule->filterTapsLeftImag_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ /* allocate memory for filter states */
+ IF( ( hBinRenConvModule->filterTapsLeftReal_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
+
+ IF( ( hBinRenConvModule->filterTapsLeftImag_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
+
+ IF( ( hBinRenConvModule->filterTapsRightReal_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
+
+ IF( ( hBinRenConvModule->filterTapsRightImag_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
+
+ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
+ {
+ IF( ( hBinRenConvModule->filterTapsLeftReal_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- IF( ( hBinRenConvModule->filterTapsRightReal_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ IF( ( hBinRenConvModule->filterTapsLeftImag_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- IF( ( hBinRenConvModule->filterTapsRightImag_fx = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ IF( ( hBinRenConvModule->filterTapsRightReal_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
+ IF( ( hBinRenConvModule->filterTapsRightImag_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
{
- IF( ( hBinRenConvModule->filterTapsLeftReal_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
- }
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
+ }
- IF( ( hBinRenConvModule->filterTapsLeftImag_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
- }
+ IF( ( hBinRenConvModule->filterStatesLeftReal_fx = (Word32 ****) malloc( num_poses * sizeof( Word32 *** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
- IF( ( hBinRenConvModule->filterTapsRightReal_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
- }
+ IF( ( hBinRenConvModule->filterStatesLeftImag_fx = (Word32 ****) malloc( num_poses * sizeof( Word32 *** ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
- IF( ( hBinRenConvModule->filterTapsRightImag_fx[bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
- }
- }
+ IF( ( hBinRenConvModule->Q_filterStates = (Word16 *) malloc( num_poses * sizeof( Word16 ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
+ }
- IF( ( hBinRenConvModule->filterStatesLeftReal_fx = (Word32 ****) malloc( num_poses * sizeof( Word32 *** ) ) ) == NULL )
+ FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
+ {
+ IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- IF( ( hBinRenConvModule->filterStatesLeftImag_fx = (Word32 ****) malloc( num_poses * sizeof( Word32 *** ) ) ) == NULL )
+ IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- IF( ( hBinRenConvModule->Q_filterStates = (Word16 *) malloc( num_poses * sizeof( Word16 ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
- }
- FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
+ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
{
- IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx] = (Word32 ***) malloc( hBinRenderer->conv_band * sizeof( Word32 ** ) ) ) == NULL )
+ IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
+ FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
{
- IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
+ IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
- IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx] = (Word32 **) malloc( hBinRenderer->nInChannels * sizeof( Word32 * ) ) ) == NULL )
+ IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
}
+ }
+ }
+ }
+ /* set memories */
+ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
+ {
+ FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
+ {
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ Word16 tmp;
+ tmp = chIdx;
+#else
+ Word16 tmp = 0;
+#endif
+ move16();
- FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
+ IF( isLoudspeaker )
+ {
+ IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_5_1 ) )
{
- IF( ( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
- }
-
- IF( ( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx] = (Word32 *) malloc( hBinRenConvModule->numTapsArray[bandIdx] * sizeof( Word32 ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Convolution Module \n" ) );
- }
+ tmp = channelIndex_CICP6[chIdx];
+ move16();
+ }
+ ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_7_1 ) )
+ {
+ tmp = channelIndex_CICP12[chIdx];
+ move16();
+ }
+ ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_5_1_2 ) )
+ {
+ tmp = channelIndex_CICP14[chIdx];
+ move16();
+ }
+ ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_5_1_4 ) )
+ {
+ tmp = channelIndex_CICP16[chIdx];
+ move16();
+ }
+ ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_7_1_4 ) )
+ {
+ tmp = channelIndex_CICP19[chIdx];
+ move16();
}
}
- }
- /* set memories */
- FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
- {
- FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftReal_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftImag_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightReal_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightImag_fx[bandIdx][tmp];
+#else
+ IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
{
- Word16 tmp = 0;
- move16();
-
+ /* set the memories to zero */
IF( isLoudspeaker )
{
- IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_5_1 ) )
- {
- tmp = channelIndex_CICP6[chIdx];
- move16();
- }
- ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_7_1 ) )
- {
- tmp = channelIndex_CICP12[chIdx];
- move16();
- }
- ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_5_1_2 ) )
- {
- tmp = channelIndex_CICP14[chIdx];
- move16();
- }
- ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_5_1_4 ) )
- {
- tmp = channelIndex_CICP16[chIdx];
- move16();
- }
- ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_7_1_4 ) )
- {
- tmp = channelIndex_CICP19[chIdx];
- move16();
- }
+ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftBRIRReal_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftBRIRImag_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightBRIRReal_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightBRIRImag_fx[bandIdx][tmp];
}
-
- IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+ }
+ ELSE
+ {
+ /* set the memories to zero */
+ IF( isLoudspeaker )
{
- /* set the memories to zero */
- IF( isLoudspeaker )
- {
- hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftBRIRReal_fx[bandIdx][tmp];
- hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftBRIRImag_fx[bandIdx][tmp];
- hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightBRIRReal_fx[bandIdx][tmp];
- hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightBRIRImag_fx[bandIdx][tmp];
- }
+ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_fx[bandIdx][tmp];
+ hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_fx[bandIdx][tmp];
}
ELSE
{
- /* set the memories to zero */
- IF( isLoudspeaker )
+ IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_HOA3 ) )
+ {
+ /* HOA3 filter coefficients */
+ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA3_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA3_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA3_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA3_fx[bandIdx][chIdx];
+ }
+ ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_HOA2 ) )
+ {
+ /* HOA2 filter coefficients */
+ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA2_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA2_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA2_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA2_fx[bandIdx][chIdx];
+ }
+ ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_FOA ) )
{
- hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_fx[bandIdx][tmp];
- hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_fx[bandIdx][tmp];
- hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_fx[bandIdx][tmp];
- hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_fx[bandIdx][tmp];
+ /* FOA filter coefficients */
+ hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_FOA_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_FOA_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_FOA_fx[bandIdx][chIdx];
+ hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_FOA_fx[bandIdx][chIdx];
}
ELSE
{
- IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_HOA3 ) )
- {
- /* HOA3 filter coefficients */
- hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA3_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA3_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA3_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA3_fx[bandIdx][chIdx];
- }
- ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_HOA2 ) )
- {
- /* HOA2 filter coefficients */
- hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_HOA2_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_HOA2_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_HOA2_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_HOA2_fx[bandIdx][chIdx];
- }
- ELSE IF( EQ_16( input_config, IVAS_AUDIO_CONFIG_FOA ) )
- {
- /* FOA filter coefficients */
- hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx] = hHrtf->leftHRIRReal_FOA_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx] = hHrtf->leftHRIRImag_FOA_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx] = hHrtf->rightHRIRReal_FOA_fx[bandIdx][chIdx];
- hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx] = hHrtf->rightHRIRImag_FOA_fx[bandIdx][chIdx];
- }
- ELSE
- {
- return IVAS_ERR_INVALID_INPUT_FORMAT;
- }
+ return IVAS_ERR_INVALID_INPUT_FORMAT;
}
}
}
+#endif
}
+ }
- IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+ IF( EQ_16( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+ {
+ FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
{
- FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
+ hBinRenConvModule->Q_filterStates[pos_idx] = 31;
+ move16();
+ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
{
- hBinRenConvModule->Q_filterStates[pos_idx] = 31;
- move16();
- FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
+ FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
{
- FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
- {
- /* set the memories to zero */
- set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] );
- set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] );
- }
+ /* set the memories to zero */
+ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] );
+ set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTapsArray[bandIdx] );
}
}
}
- ELSE
+ }
+ ELSE
+ {
+ FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
{
- FOR( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
+ hBinRenConvModule->Q_filterStates[pos_idx] = 31;
+ move16();
+ FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
{
- hBinRenConvModule->Q_filterStates[pos_idx] = 31;
- move16();
- FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
+ FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
{
- FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
- {
- /* set the memories to zero */
- set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps );
- set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps );
- }
+ /* set the memories to zero */
+ set32_fx( hBinRenConvModule->filterStatesLeftReal_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps );
+ set32_fx( hBinRenConvModule->filterStatesLeftImag_fx[pos_idx][bandIdx][chIdx], 0, hBinRenConvModule->numTaps );
}
}
}
+ }
- hBinRenderer->hBinRenConvModule = hBinRenConvModule;
+ hBinRenderer->hBinRenConvModule = hBinRenConvModule;
- return IVAS_ERR_OK;
- }
+ return IVAS_ERR_OK;
+}
- /*-------------------------------------------------------------------------*
- * ivas_init_binaural_hrtf()
- *
- * initialize memory for HrtfFastConv structure elements
- *-------------------------------------------------------------------------*/
- void ivas_init_binaural_hrtf_fx(
- HRTFS_FASTCONV * HrtfFastConv /* i/o: FASTCONV HRTF structure */
- )
- {
- Word16 i;
- HrtfFastConv->leftHRIRReal_HOA3_fx = NULL;
- HrtfFastConv->leftHRIRImag_HOA3_fx = NULL;
- HrtfFastConv->rightHRIRReal_HOA3_fx = NULL;
- HrtfFastConv->rightHRIRImag_HOA3_fx = NULL;
- HrtfFastConv->FASTCONV_HOA3_latency_s_fx = 0;
- move32();
+/*-------------------------------------------------------------------------*
+ * ivas_init_binaural_hrtf()
+ *
+ * initialize memory for HrtfFastConv structure elements
+ *-------------------------------------------------------------------------*/
- HrtfFastConv->leftHRIRReal_fx = NULL;
- HrtfFastConv->leftHRIRImag_fx = NULL;
- HrtfFastConv->rightHRIRReal_fx = NULL;
- HrtfFastConv->rightHRIRImag_fx = NULL;
- HrtfFastConv->FASTCONV_HRIR_latency_s_fx = 0;
- move32();
+void ivas_init_binaural_hrtf_fx(
+ HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */
+)
+{
+ Word16 i;
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->leftReal_fx = NULL;
+ HrtfFastConv->leftImag_fx = NULL;
+ HrtfFastConv->rightReal_fx = NULL;
+ HrtfFastConv->rightImag_fx = NULL;
+ HrtfFastConv->FASTCONV_latency_s_fx = 0x00;
+ move32();
+ HrtfFastConv->n_channels = 0;
+ move16();
+#else
+ HrtfFastConv->leftHRIRReal_HOA3_fx = NULL;
+ HrtfFastConv->leftHRIRImag_HOA3_fx = NULL;
+ HrtfFastConv->rightHRIRReal_HOA3_fx = NULL;
+ HrtfFastConv->rightHRIRImag_HOA3_fx = NULL;
+ HrtfFastConv->FASTCONV_HOA3_latency_s_fx = 0;
+ move32();
- HrtfFastConv->leftBRIRReal_fx = NULL;
- HrtfFastConv->leftBRIRImag_fx = NULL;
- HrtfFastConv->rightBRIRReal_fx = NULL;
- HrtfFastConv->rightBRIRImag_fx = NULL;
- HrtfFastConv->FASTCONV_BRIR_latency_s_fx = 0;
- move32();
+ HrtfFastConv->leftHRIRReal_fx = NULL;
+ HrtfFastConv->leftHRIRImag_fx = NULL;
+ HrtfFastConv->rightHRIRReal_fx = NULL;
+ HrtfFastConv->rightHRIRImag_fx = NULL;
+ HrtfFastConv->FASTCONV_HRIR_latency_s_fx = 0;
+ move32();
- HrtfFastConv->leftHRIRReal_HOA2_fx = NULL;
- HrtfFastConv->leftHRIRImag_HOA2_fx = NULL;
- HrtfFastConv->rightHRIRReal_HOA2_fx = NULL;
- HrtfFastConv->rightHRIRImag_HOA2_fx = NULL;
- HrtfFastConv->FASTCONV_HOA2_latency_s_fx = 0;
- move32();
+ HrtfFastConv->leftBRIRReal_fx = NULL;
+ HrtfFastConv->leftBRIRImag_fx = NULL;
+ HrtfFastConv->rightBRIRReal_fx = NULL;
+ HrtfFastConv->rightBRIRImag_fx = NULL;
+ HrtfFastConv->FASTCONV_BRIR_latency_s_fx = 0;
+ move32();
+
+ HrtfFastConv->leftHRIRReal_HOA2_fx = NULL;
+ HrtfFastConv->leftHRIRImag_HOA2_fx = NULL;
+ HrtfFastConv->rightHRIRReal_HOA2_fx = NULL;
+ HrtfFastConv->rightHRIRImag_HOA2_fx = NULL;
+ HrtfFastConv->FASTCONV_HOA2_latency_s_fx = 0;
+ move32();
- HrtfFastConv->leftHRIRReal_FOA_fx = NULL;
- HrtfFastConv->leftHRIRImag_FOA_fx = NULL;
- HrtfFastConv->rightHRIRReal_FOA_fx = NULL;
- HrtfFastConv->rightHRIRImag_FOA_fx = NULL;
- HrtfFastConv->FASTCONV_FOA_latency_s_fx = 0;
+ HrtfFastConv->leftHRIRReal_FOA_fx = NULL;
+ HrtfFastConv->leftHRIRImag_FOA_fx = NULL;
+ HrtfFastConv->rightHRIRReal_FOA_fx = NULL;
+ HrtfFastConv->rightHRIRImag_FOA_fx = NULL;
+ HrtfFastConv->FASTCONV_FOA_latency_s_fx = 0;
+ move32();
+#endif
+ HrtfFastConv->allocate_init_flag = 0;
+ move16();
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->ntaps = 0;
+ move16();
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ HrtfFastConv->FASTCONV_latency_s_Q_fx = 0;
+ move16();
+ HrtfFastConv->FASTCONV_taps_s_Q_fx = 0;
+ move16();
+ HrtfFastConv->FASTCONV_reverbTime_s_Q_fx = 0;
+ move16();
+ HrtfFastConv->FASTCONV_reverbEne_s_Q_fx = 0;
+ move16();
+#endif
+#endif
+
+ FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
+ {
+ HrtfFastConv->fastconvReverberationTimes_fx[i] = 0;
move32();
+ HrtfFastConv->fastconvReverberationEneCorrections_fx[i] = 0;
+ move32();
+ }
- HrtfFastConv->allocate_init_flag = 0;
- move16();
+ return;
+}
- FOR( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
- {
- HrtfFastConv->fastconvReverberationTimes_fx[i] = 0;
- move32();
- HrtfFastConv->fastconvReverberationEneCorrections_fx[i] = 0;
- move32();
- }
- return;
- }
+/*-------------------------------------------------------------------------*
+ * ivas_alloc_pppMem()
+ *
+ * Allocate memory for tripple pointer elements
+ *-------------------------------------------------------------------------*/
+
+static ivas_error ivas_alloc_pppMem_fx(
+ Word32 ****pppMem, /*Qx*/
+ const Word16 dim1,
+ const Word16 dim2,
+ const Word16 dim3,
+ const Word16 allocate_init_flag )
+{
+ Word16 i, j;
+ Word32 ***localMem = NULL;
- /*-------------------------------------------------------------------------*
- * ivas_alloc_pppMem()
- *
- * Allocate memory for tripple pointer elements
- *-------------------------------------------------------------------------*/
- static ivas_error ivas_alloc_pppMem_fx(
- Word32 * ***pppMem, /*Qx*/
- const Word16 dim1,
- const Word16 dim2,
- const Word16 dim3,
- const Word16 allocate_init_flag )
+ IF( ( localMem = (Word32 ***) malloc( dim1 * sizeof( Word32 ** ) ) ) == NULL )
{
- Word16 i, j;
- Word32 ***localMem = NULL;
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" );
+ }
- IF( ( localMem = (Word32 ***) malloc( dim1 * sizeof( Word32 ** ) ) ) == NULL )
- {
+ FOR( i = 0; i < dim1; i++ ){
+ IF( ( localMem[i] = (Word32 **) malloc( dim2 * sizeof( Word32 * ) ) ) == NULL ){
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" );
- }
-
- FOR( i = 0; i < dim1; i++ ){
- IF( ( localMem[i] = (Word32 **) malloc( dim2 * sizeof( Word32 * ) ) ) == NULL ){
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" );
- }
- IF( allocate_init_flag == 0 )
+}
+IF( allocate_init_flag == 0 )
+{
+ FOR( j = 0; j < dim2; j++ )
{
- FOR( j = 0; j < dim2; j++ )
+ IF( ( localMem[i][j] = (Word32 *) malloc( dim3 * sizeof( Word32 ) ) ) == NULL )
{
- IF( ( localMem[i][j] = (Word32 *) malloc( dim3 * sizeof( Word32 ) ) ) == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" );
- }
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF memory" );
}
}
}
+}
*pppMem = localMem;
return IVAS_ERR_OK;
}
+
/*-------------------------------------------------------------------------*
* ivas_allocate_binaural_hrtf()
*
* Allocate memory for HrtfFastConv structure elements
*-------------------------------------------------------------------------*/
+
ivas_error ivas_allocate_binaural_hrtf_fx(
- HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */
+ HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ const int16_t n_channels, /* i : number of input channels */
+#else
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 Word16 allocate_init_flag /* i : Memory allocation flag */
+#endif
+ const Word16 allocate_init_flag /* i : Memory allocation flag */
)
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->n_channels = n_channels;
+ move16();
+
+ test();
+ test();
+ test();
+ IF( ( HrtfFastConv->leftReal_fx != NULL ) && ( HrtfFastConv->leftImag_fx != NULL ) && ( HrtfFastConv->rightReal_fx != NULL ) && ( HrtfFastConv->rightImag_fx != NULL ) )
+ {
+ return IVAS_ERR_OK;
+ }
+ ELSE
+ {
+ IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->leftReal_fx, BINAURAL_CONVBANDS, n_channels, HrtfFastConv->ntaps, allocate_init_flag ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HrtfFastConv->leftReal" );
+ }
+ IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->leftImag_fx, BINAURAL_CONVBANDS, n_channels, HrtfFastConv->ntaps, allocate_init_flag ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HrtfFastConv->leftImag" );
+ }
+ IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->rightReal_fx, BINAURAL_CONVBANDS, n_channels, HrtfFastConv->ntaps, allocate_init_flag ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HrtfFastConv->rightReal" );
+ }
+ IF( IVAS_ERR_OK != ivas_alloc_pppMem_fx( &HrtfFastConv->rightImag_fx, BINAURAL_CONVBANDS, n_channels, HrtfFastConv->ntaps, allocate_init_flag ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HrtfFastConv->rightImag" );
+ }
+ }
+#else
test();
IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA3 ) || EQ_32( bin_input_config, BINAURAL_INPUT_AUDIO_CONFIG_HOA3 ) )
{
@@ -842,15 +849,17 @@ ivas_error ivas_allocate_binaural_hrtf_fx(
}
}
}
-
+#endif
return IVAS_ERR_OK;
}
+
/*-------------------------------------------------------------------------*
- * ivas_binaural_HRTF_open()
+ * ivas_binaural_hrtf_open()
*
*
*-------------------------------------------------------------------------*/
+
static ivas_error ivas_binaural_hrtf_open_fx(
HRTFS_FASTCONV_HANDLE *hHrtfFastConv, /* i : fastconv HRTF handle */
const AUDIO_CONFIG input_config, /* i : output configuration */
@@ -859,6 +868,9 @@ static ivas_error ivas_binaural_hrtf_open_fx(
{
Word16 i, j;
ivas_error error;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ Word16 n_channels;
+#endif
test();
IF( hHrtfFastConv != NULL && *hHrtfFastConv != NULL )
@@ -881,101 +893,316 @@ static ivas_error ivas_binaural_hrtf_open_fx(
test();
IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV ) )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->FASTCONV_latency_s_fx = FASTCONV_HRIR_latency_s_fx;
+ move32();
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ HrtfFastConv->FASTCONV_latency_s_Q_fx = Q31 - FASTCONV_factor_Q_HRIR_latency_s_fx;
+ move16();
+ HrtfFastConv->FASTCONV_taps_s_Q_fx = Q15 - FASTCONV_factor_Q_HRIR_fx;
+ move16();
+#endif
+ HrtfFastConv->ntaps = BINAURAL_NTAPS;
+ move16();
+#else
HrtfFastConv->FASTCONV_HRIR_latency_s_fx = FASTCONV_HRIR_latency_s_fx;
move32();
+#endif
}
- if ( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA2 ) )
+ IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA2 ) )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->FASTCONV_latency_s_fx = FASTCONV_HOA2_latency_s_fx;
+ move32();
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ HrtfFastConv->FASTCONV_latency_s_Q_fx = Q31 - FASTCONV_factor_Q_HOA2_latency_s_fx;
+ move16();
+ HrtfFastConv->FASTCONV_taps_s_Q_fx = Q15 - FASTCONV_factor_Q_HOA2_fx;
+ move16();
+#endif
+
+ HrtfFastConv->ntaps = BINAURAL_NTAPS_SBA;
+ move16();
+#else
HrtfFastConv->FASTCONV_HOA2_latency_s_fx = FASTCONV_HOA2_latency_s_fx;
move32();
+#endif
}
- if ( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA3 ) )
+ IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA3 ) )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->FASTCONV_latency_s_fx = FASTCONV_HOA3_latency_s_fx;
+ move32();
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ HrtfFastConv->FASTCONV_latency_s_Q_fx = Q31 - FASTCONV_factor_Q_HOA3_latency_s_fx;
+ move16();
+ HrtfFastConv->FASTCONV_taps_s_Q_fx = Q15 - FASTCONV_factor_Q_HOA3_fx;
+ move16();
+#endif
+ HrtfFastConv->ntaps = BINAURAL_NTAPS_SBA;
+ move16();
+#else
HrtfFastConv->FASTCONV_HOA3_latency_s_fx = FASTCONV_HOA3_latency_s_fx;
move32();
+#endif
}
- if ( EQ_32( input_config, IVAS_AUDIO_CONFIG_FOA ) )
+ IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_FOA ) )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->FASTCONV_latency_s_fx = FASTCONV_FOA_latency_s_fx;
+ move32();
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ HrtfFastConv->FASTCONV_latency_s_Q_fx = Q31 - FASTCONV_factor_Q_FOA_latency_s_fx;
+ move16();
+ HrtfFastConv->FASTCONV_taps_s_Q_fx = Q15 - FASTCONV_factor_Q_FOA_fx;
+ move16();
+#endif
+ HrtfFastConv->ntaps = BINAURAL_NTAPS_SBA;
+ move16();
+#else
HrtfFastConv->FASTCONV_FOA_latency_s_fx = FASTCONV_FOA_latency_s_fx;
move32();
+#endif
}
test();
IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HrtfFastConv->FASTCONV_latency_s_fx = FASTCONV_BRIR_latency_s_fx;
+ move32();
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ HrtfFastConv->FASTCONV_latency_s_Q_fx = Q31 - FASTCONV_factor_Q_BRIR_latency_s_fx;
+ move16();
+ HrtfFastConv->FASTCONV_taps_s_Q_fx = Q15 - FASTCONV_factor_Q_BRIR_fx;
+ move16();
+ HrtfFastConv->FASTCONV_reverbTime_s_Q_fx = Q15 - FASTCONV_factor_Q_reverberationTimes_fx;
+ move16();
+ HrtfFastConv->FASTCONV_reverbEne_s_Q_fx = Q15 - FASTCONV_factor_Q_reverberationEneCorrections_fx;
+ move16();
+#endif
+ HrtfFastConv->ntaps = BINAURAL_NTAPS_MAX;
+ move16();
+#else
HrtfFastConv->FASTCONV_BRIR_latency_s_fx = FASTCONV_BRIR_latency_s_fx;
move32();
+#endif
}
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ HrtfFastConv->allocate_init_flag = 0;
+#else
HrtfFastConv->allocate_init_flag = 1;
+#endif
move16();
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ n_channels = 0;
+ move16();
+
+ test();
+ test();
+ IF( ( EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) && NE_32( input_config, IVAS_AUDIO_CONFIG_INVALID ) )
+ {
+ n_channels = HRTF_LS_CHANNELS;
+ move16();
+ }
+
+ IF( EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV ) )
+ {
+ IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA3 ) )
+ {
+ n_channels = HOA3_CHANNELS;
+ move16();
+ }
+ ELSE IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA2 ) )
+ {
+ n_channels = HOA2_CHANNELS;
+ move16();
+ }
+ ELSE IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_FOA ) )
+ {
+ n_channels = FOA_CHANNELS;
+ move16();
+ }
+ }
+ IF( NE_32( ( error = ivas_allocate_binaural_hrtf_fx( HrtfFastConv, n_channels, HrtfFastConv->allocate_init_flag ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_allocate_binaural_hrtf_fx( HrtfFastConv, input_config, BINAURAL_INPUT_AUDIO_CONFIG_INVALID, renderer_type, HrtfFastConv->allocate_init_flag ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
FOR( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ test();
+ test();
+ IF( EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_32( HrtfFastConv->n_channels, HRTF_LS_CHANNELS ) )
+#else
IF( EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV ) )
+#endif
{
FOR( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ Copy_Scale_sig_16_32_r( leftHRIRReal_fx[i][j], HrtfFastConv->leftReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HRIR_fx );
+ Copy_Scale_sig_16_32_r( leftHRIRImag_fx[i][j], HrtfFastConv->leftImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HRIR_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRReal_fx[i][j], HrtfFastConv->rightReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HRIR_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRImag_fx[i][j], HrtfFastConv->rightImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HRIR_fx );
+#else
+ HrtfFastConv->leftReal_fx[i][j] = leftHRIRReal_fx[i][j];
+ HrtfFastConv->leftImag_fx[i][j] = leftHRIRImag_fx[i][j];
+ HrtfFastConv->rightReal_fx[i][j] = rightHRIRReal_fx[i][j];
+ HrtfFastConv->rightImag_fx[i][j] = rightHRIRImag_fx[i][j];
+#endif
+#else
HrtfFastConv->leftHRIRReal_fx[i][j] = leftHRIRReal_fx[i][j];
HrtfFastConv->leftHRIRImag_fx[i][j] = leftHRIRImag_fx[i][j];
HrtfFastConv->rightHRIRReal_fx[i][j] = rightHRIRReal_fx[i][j];
HrtfFastConv->rightHRIRImag_fx[i][j] = rightHRIRImag_fx[i][j];
+#endif
}
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ ELSE IF( EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) && EQ_32( HrtfFastConv->n_channels, HRTF_LS_CHANNELS ) )
+#else
ELSE IF( EQ_32( renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+#endif
{
FOR( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ Copy_Scale_sig_16_32_r( leftBRIRReal_fx[i][j], HrtfFastConv->leftReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_BRIR_fx );
+ Copy_Scale_sig_16_32_r( leftBRIRImag_fx[i][j], HrtfFastConv->leftImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_BRIR_fx );
+ Copy_Scale_sig_16_32_r( rightBRIRReal_fx[i][j], HrtfFastConv->rightReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_BRIR_fx );
+ Copy_Scale_sig_16_32_r( rightBRIRImag_fx[i][j], HrtfFastConv->rightImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_BRIR_fx );
+#else
+ HrtfFastConv->leftReal_fx[i][j] = leftBRIRReal_fx[i][j];
+ HrtfFastConv->leftImag_fx[i][j] = leftBRIRImag_fx[i][j];
+ HrtfFastConv->rightReal_fx[i][j] = rightBRIRReal_fx[i][j];
+ HrtfFastConv->rightImag_fx[i][j] = rightBRIRImag_fx[i][j];
+#endif
+#else
HrtfFastConv->leftBRIRReal_fx[i][j] = leftBRIRReal_fx[i][j];
HrtfFastConv->leftBRIRImag_fx[i][j] = leftBRIRImag_fx[i][j];
HrtfFastConv->rightBRIRReal_fx[i][j] = rightBRIRReal_fx[i][j];
HrtfFastConv->rightBRIRImag_fx[i][j] = rightBRIRImag_fx[i][j];
+#endif
}
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ test();
+ IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA3 ) && EQ_32( HrtfFastConv->n_channels, HOA3_CHANNELS ) )
+#else
IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA3 ) )
+#endif
{
FOR( j = 0; j < HOA3_CHANNELS; j++ )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ Copy_Scale_sig_16_32_r( leftHRIRReal_HOA3_fx[i][j], HrtfFastConv->leftReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA3_fx );
+ Copy_Scale_sig_16_32_r( leftHRIRImag_HOA3_fx[i][j], HrtfFastConv->leftImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA3_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRReal_HOA3_fx[i][j], HrtfFastConv->rightReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA3_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRImag_HOA3_fx[i][j], HrtfFastConv->rightImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA3_fx );
+#else
+ HrtfFastConv->leftReal_fx[i][j] = leftHRIRReal_HOA3_fx[i][j];
+ HrtfFastConv->leftImag_fx[i][j] = leftHRIRImag_HOA3_fx[i][j];
+ HrtfFastConv->rightReal_fx[i][j] = rightHRIRReal_HOA3_fx[i][j];
+ HrtfFastConv->rightImag_fx[i][j] = rightHRIRImag_HOA3_fx[i][j];
+#endif
+#else
HrtfFastConv->leftHRIRReal_HOA3_fx[i][j] = leftHRIRReal_HOA3_fx[i][j];
HrtfFastConv->leftHRIRImag_HOA3_fx[i][j] = leftHRIRImag_HOA3_fx[i][j];
HrtfFastConv->rightHRIRReal_HOA3_fx[i][j] = rightHRIRReal_HOA3_fx[i][j];
HrtfFastConv->rightHRIRImag_HOA3_fx[i][j] = rightHRIRImag_HOA3_fx[i][j];
+#endif
}
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ /* Note: IVAS_AUDIO_CONFIG_HOA2 and IVAS_AUDIO_CONFIG_FOA input configs. are not relevant in internal renderer
+ as SBA to binaural always synthesizes HOA3 output for binauralization. However, the external renderer can use them. */
+ test();
+ IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA2 ) && EQ_32( HrtfFastConv->n_channels, HOA2_CHANNELS ) )
+#else
IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_HOA2 ) )
+#endif
{
FOR( j = 0; j < HOA2_CHANNELS; j++ )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ Copy_Scale_sig_16_32_r( leftHRIRReal_HOA2_fx[i][j], HrtfFastConv->leftReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA2_fx );
+ Copy_Scale_sig_16_32_r( leftHRIRImag_HOA2_fx[i][j], HrtfFastConv->leftImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA2_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRReal_HOA2_fx[i][j], HrtfFastConv->rightReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA2_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRImag_HOA2_fx[i][j], HrtfFastConv->rightImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_HOA2_fx );
+#else
+ HrtfFastConv->leftReal_fx[i][j] = leftHRIRReal_HOA2_fx[i][j];
+ HrtfFastConv->leftImag_fx[i][j] = leftHRIRImag_HOA2_fx[i][j];
+ HrtfFastConv->rightReal_fx[i][j] = rightHRIRReal_HOA2_fx[i][j];
+ HrtfFastConv->rightImag_fx[i][j] = rightHRIRImag_HOA2_fx[i][j];
+#endif
+#else
HrtfFastConv->leftHRIRReal_HOA2_fx[i][j] = leftHRIRReal_HOA2_fx[i][j];
HrtfFastConv->leftHRIRImag_HOA2_fx[i][j] = leftHRIRImag_HOA2_fx[i][j];
HrtfFastConv->rightHRIRReal_HOA2_fx[i][j] = rightHRIRReal_HOA2_fx[i][j];
HrtfFastConv->rightHRIRImag_HOA2_fx[i][j] = rightHRIRImag_HOA2_fx[i][j];
+#endif
}
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ test();
+ IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_FOA ) && EQ_32( HrtfFastConv->n_channels, FOA_CHANNELS ) )
+#else
IF( EQ_32( input_config, IVAS_AUDIO_CONFIG_FOA ) )
+#endif
{
FOR( j = 0; j < FOA_CHANNELS; j++ )
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ Copy_Scale_sig_16_32_r( leftHRIRReal_FOA_fx[i][j], HrtfFastConv->leftReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_FOA_fx );
+ Copy_Scale_sig_16_32_r( leftHRIRImag_FOA_fx[i][j], HrtfFastConv->leftImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_FOA_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRReal_FOA_fx[i][j], HrtfFastConv->rightReal_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_FOA_fx );
+ Copy_Scale_sig_16_32_r( rightHRIRImag_FOA_fx[i][j], HrtfFastConv->rightImag_fx[i][j], HrtfFastConv->ntaps, Q29 - FASTCONV_factor_Q_FOA_fx );
+#else
+ HrtfFastConv->leftReal_fx[i][j] = leftHRIRReal_FOA_fx[i][j];
+ HrtfFastConv->leftImag_fx[i][j] = leftHRIRImag_FOA_fx[i][j];
+ HrtfFastConv->rightReal_fx[i][j] = rightHRIRReal_FOA_fx[i][j];
+ HrtfFastConv->rightImag_fx[i][j] = rightHRIRImag_FOA_fx[i][j];
+#endif
+#else
HrtfFastConv->leftHRIRReal_FOA_fx[i][j] = leftHRIRReal_FOA_fx[i][j];
HrtfFastConv->leftHRIRImag_FOA_fx[i][j] = leftHRIRImag_FOA_fx[i][j];
HrtfFastConv->rightHRIRReal_FOA_fx[i][j] = rightHRIRReal_FOA_fx[i][j];
HrtfFastConv->rightHRIRImag_FOA_fx[i][j] = rightHRIRImag_FOA_fx[i][j];
+#endif
}
}
}
+
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ Copy_Scale_sig_16_32_r( fastconvReverberationTimes_fx, HrtfFastConv->fastconvReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX, Q26 - FASTCONV_factor_Q_reverberationTimes_fx );
+ Copy_Scale_sig_16_32_r( fastconvReverberationEneCorrections_fx, HrtfFastConv->fastconvReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX, Q31 - FASTCONV_factor_Q_reverberationTimes_fx );
+#else
Copy32( fastconvReverberationTimes_fx, HrtfFastConv->fastconvReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX );
Copy32( fastconvReverberationEneCorrections_fx, HrtfFastConv->fastconvReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX );
+#endif
*hHrtfFastConv = HrtfFastConv;
- }
- return IVAS_ERR_OK;
+ return IVAS_ERR_OK;
+ }
}
+
+
/*-------------------------------------------------------------------------*
- * ivas_binaural_obtain_DMX_fx()
+ * ivas_binaural_obtain_DMX()
*
*
*-------------------------------------------------------------------------*/
@@ -983,10 +1210,11 @@ static ivas_error ivas_binaural_hrtf_open_fx(
static void ivas_binaural_obtain_DMX_fx(
const Word16 numTimeSlots,
BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */
- Word32 RealBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals Q_in */
- Word32 ImagBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals Q_in */
- Word32 realDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*Q_in-1*/
- Word32 imagDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] ) /*Q_in-1*/
+ Word32 RealBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals Q_in_out */
+ Word32 ImagBuffer[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Contains the LS signals Q_in_out */
+ Word32 realDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*Q_in_out*/
+ Word32 imagDMX[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*Q_in_out*/
+ Word16 *Q_in_out ) /*i/o: input and output Q*/
{
Word16 chIdx, bandIdx, k;
@@ -1014,24 +1242,19 @@ static void ivas_binaural_obtain_DMX_fx(
FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
{
-#ifdef FIX_1053_REVERB_RECONFIGURATION
Word32 dmxConst = dmxmtx_table_fx[chOutIdx][chIdx];
-#else
- Word32 dmxConst = hBinRenderer->hReverb->dmxmtx_fx[chOutIdx][chIdx];
- move32();
-#endif
FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
{
FOR( k = 0; k < numTimeSlots; k++ )
{
- temp1_fx = Mpy_32_32( RealBuffer[chIdx][k][bandIdx], dmxConst ); // Q_in
- temp2_fx = Mpy_32_32( ImagBuffer[chIdx][k][bandIdx], dmxConst ); // Q_in
- realDMX[chOutIdx][k][bandIdx] = L_add( realDMX[chOutIdx][k][bandIdx], temp1_fx ); // Q_in
+ temp1_fx = Mpy_32_32( RealBuffer[chIdx][k][bandIdx], dmxConst ); // Q_in_out
+ temp2_fx = Mpy_32_32( ImagBuffer[chIdx][k][bandIdx], dmxConst ); // Q_in_out
+ realDMX[chOutIdx][k][bandIdx] = L_add( realDMX[chOutIdx][k][bandIdx], temp1_fx ); // Q_in_out
move32();
- imagDMX[chOutIdx][k][bandIdx] = L_add( imagDMX[chOutIdx][k][bandIdx], temp2_fx ); // Q_in
+ imagDMX[chOutIdx][k][bandIdx] = L_add( imagDMX[chOutIdx][k][bandIdx], temp2_fx ); // Q_in_out
move32();
- P_in_fx[bandIdx] = L_add( P_in_fx[bandIdx], L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in
+ P_in_fx[bandIdx] = L_add( P_in_fx[bandIdx], L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in_out
move32();
}
}
@@ -1047,7 +1270,7 @@ static void ivas_binaural_obtain_DMX_fx(
move32();
temp2_fx = imagDMX[chOutIdx][k][bandIdx];
move32();
- P_out_fx = L_add( P_out_fx, L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in
+ P_out_fx = L_add( P_out_fx, L_add( Mpy_32_32( temp1_fx, temp1_fx ), Mpy_32_32( temp2_fx, temp2_fx ) ) ); // Q31-2*Q_in_out
}
test();
IF( ( P_in_fx[bandIdx] <= 0 ) || ( P_out_fx <= 0 ) )
@@ -1058,12 +1281,8 @@ static void ivas_binaural_obtain_DMX_fx(
ELSE
{
Word16 div = divide3232( P_in_fx[bandIdx], P_out_fx );
-#ifdef FIX_1835_REVERB_ACTIVATION
- Word16 exp = 0; // divide3232 returns Q15 + following Q16 shift
-#else
- Word16 exp = norm_l( div );
-#endif
- factEQ_fx = Sqrt32( L_shl( div, Q16 ), &exp );
+ Word16 exp = 16; // divide3232 returns Q15
+ factEQ_fx = Sqrt32( div, &exp );
factEQ_fx = L_shl( factEQ_fx, sub( exp, 1 ) ); // Q30
}
if ( factEQ_fx <= 0 )
@@ -1075,13 +1294,14 @@ static void ivas_binaural_obtain_DMX_fx(
factEQ_fx = L_max( L_min( factEQ_fx, 0x7fffffff ), 0x20000000 ); // Q30 , 0x7fffffff -> (1.0f in Q31)-1, 0x20000000 ->1.0f in Q29
FOR( k = 0; k < numTimeSlots; k++ )
{
- realDMX[chOutIdx][k][bandIdx] = Mpy_32_32( realDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in - 1
+ realDMX[chOutIdx][k][bandIdx] = Mpy_32_32( realDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in_out - 1
move32();
- imagDMX[chOutIdx][k][bandIdx] = Mpy_32_32( imagDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in - 1
+ imagDMX[chOutIdx][k][bandIdx] = Mpy_32_32( imagDMX[chOutIdx][k][bandIdx], factEQ_fx ); // Q_in_out - 1
move32();
}
}
}
+ *Q_in_out = sub( *Q_in_out, 1 );
}
ELSE IF( EQ_32( hBinRenderer->ivas_format, SBA_FORMAT ) || EQ_32( hBinRenderer->ivas_format, MASA_FORMAT ) )
{
@@ -1149,6 +1369,10 @@ static void ivas_binaural_obtain_DMX_fx(
}
}
}
+ IF( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) )
+ {
+ *Q_in_out = sub( *Q_in_out, 1 );
+ }
}
return;
@@ -1172,8 +1396,6 @@ ivas_error ivas_rend_openCldfbRend(
Word16 convBand;
ivas_error error;
- error = IVAS_ERR_OK;
-
/*-----------------------------------------------------------------*
* prepare library opening
*-----------------------------------------------------------------*/
@@ -1211,8 +1433,13 @@ ivas_error ivas_rend_openCldfbRend(
move16();
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ ivas_output_init( hBinRenderer->hInputSetup, inConfig );
+#else
hBinRenderer->hInputSetup->is_loudspeaker_setup = 0;
hBinRenderer->hInputSetup->output_config = inConfig;
+#endif
+
IF( ( error = getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE ) ) != IVAS_ERR_OK )
{
return error;
@@ -1246,7 +1473,15 @@ ivas_error ivas_rend_openCldfbRend(
return error;
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ pCldfbRend->binaural_latency_ns = L_shr_r( Mpy_32_32_r( pCldfbRend->hHrtfFastConv->FASTCONV_latency_s_fx, (Word32) 1000000000 ), pCldfbRend->hHrtfFastConv->FASTCONV_latency_s_Q_fx );
+#else
+ pCldfbRend->binaural_latency_ns = Mult_32_32( pCldfbRend->hHrtfFastConv->FASTCONV_latency_s_fx, (Word32) 1000000000 );
+#endif
+#else
pCldfbRend->binaural_latency_ns = (Word32) ( pCldfbRend->hHrtfFastConv->FASTCONV_HOA3_latency_s_fx * 1000000000 );
+#endif
move32();
hBinRenderer->hReverb = NULL;
move32();
@@ -1255,28 +1490,24 @@ ivas_error ivas_rend_openCldfbRend(
pCldfbRend->hCldfbRend = hBinRenderer;
move32();
- return error;
+ return IVAS_ERR_OK;
}
+
/*-------------------------------------------------------------------------
* ivas_binRenderer_open()
*
* Open fastconv binaural renderer handle
*-------------------------------------------------------------------------*/
+
ivas_error ivas_binRenderer_open_fx(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
)
{
BINAURAL_RENDERER_HANDLE hBinRenderer;
-#ifdef FIX_1053_REVERB_RECONFIGURATION
Word16 convBand, k;
-#else
- Word16 convBand, chIdx, k;
-#endif
ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
+ const IVAS_ROOM_ACOUSTICS_CONFIG_DATA *pRoomAcoustics;
/*-----------------------------------------------------------------*
* prepare library opening
@@ -1292,8 +1523,10 @@ ivas_error ivas_binRenderer_open_fx(
/* Define of head rotation has to be done in binRendeder in CLDFB*/
hBinRenderer->rotInCldfb = 0;
move16();
+
test();
- if ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
+ test();
+ IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
hBinRenderer->rotInCldfb = 1;
move16();
@@ -1304,7 +1537,7 @@ ivas_error ivas_binRenderer_open_fx(
hBinRenderer->numPoses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
move16();
}
- else
+ ELSE
{
hBinRenderer->numPoses = 1;
move16();
@@ -1353,6 +1586,14 @@ ivas_error ivas_binRenderer_open_fx(
move16();
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ test();
+ IF( st_ivas->hHrtfFastConv == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL, "HRTF binary file present but not used in FastConv renderer" );
+ }
+#endif
+
/* Load HRTF tables */
IF( NE_32( ( error = ivas_binaural_hrtf_open_fx( &st_ivas->hHrtfFastConv, st_ivas->hIntSetup.output_config, st_ivas->renderer_type ) ), IVAS_ERR_OK ) )
{
@@ -1380,7 +1621,16 @@ ivas_error ivas_binRenderer_open_fx(
}
hBinRenderer->hoa_dec_mtx = st_ivas->hoa_dec_mtx;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ st_ivas->binaural_latency_ns = L_shr_r( Mpy_32_32_r( st_ivas->hHrtfFastConv->FASTCONV_latency_s_fx, (Word32) 1000000000 ), st_ivas->hHrtfFastConv->FASTCONV_latency_s_Q_fx );
+#else
+ st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_latency_s_fx;
+ move32();
+#endif
+#else
st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s_fx;
+#endif
move32();
}
ELSE
@@ -1391,6 +1641,14 @@ ivas_error ivas_binRenderer_open_fx(
return error;
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef USE_FASTCONV_PARAMBIN_16BIT_ROM
+ st_ivas->binaural_latency_ns = L_shr_r( Mpy_32_32_r( st_ivas->hHrtfFastConv->FASTCONV_latency_s_fx, (Word32) 1000000000 ), st_ivas->hHrtfFastConv->FASTCONV_latency_s_Q_fx );
+#else
+ st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_latency_s_fx;
+ move32();
+#endif
+#else
IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) )
{
IF( EQ_32( hBinRenderer->ivas_format, MC_FORMAT ) )
@@ -1427,77 +1685,69 @@ ivas_error ivas_binRenderer_open_fx(
st_ivas->binaural_latency_ns = st_ivas->hHrtfFastConv->FASTCONV_BRIR_latency_s_fx;
move32();
}
+#endif
}
/* Allocate memories needed for reverb module */
test();
-#ifdef FIX_1835_REVERB_ACTIVATION
IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
-#else
- IF( ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ) && EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
-#endif
- {
- IF( NE_32( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) ){
- return error;
-}
-
-/* initialize the dmx matrix */
-#ifndef FIX_1053_REVERB_RECONFIGURATION
-IF( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) )
-{
- FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
{
- FOR( k = 0; k < hBinRenderer->nInChannels; k++ )
+ pRoomAcoustics = NULL;
+ IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
{
- hBinRenderer->hReverb->dmxmtx_fx[chIdx][k] = dmxmtx_table_fx[chIdx][k];
- move32();
+ pRoomAcoustics = &( st_ivas->hRenderConfig->roomAcoustics );
+ }
+ IF( NE_32( ( error = ivas_binaural_reverb_init_fx( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, pRoomAcoustics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx, NULL ) ), IVAS_ERR_OK ) )
+ {
+ return error;
}
+
+ /* initialize the dmx matrix */
+ }
+ ELSE
+ {
+ hBinRenderer->hReverb = NULL;
}
-}
-#endif
-}
-ELSE
-{
- hBinRenderer->hReverb = NULL;
-}
-hBinRenderer->hEFAPdata = NULL;
+ hBinRenderer->hEFAPdata = NULL;
-IF( hBinRenderer->hReverb != NULL && NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) )
-{
- test();
- test();
- IF( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 )
+ IF( hBinRenderer->hReverb != NULL && NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) )
{
- FOR( k = 0; k < 11; k++ )
+ test();
+ test();
+ IF( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 )
{
- ivas_dirac_dec_get_response_fx( extract_l( L_shr_r( ls_azimuth_CICP19_fx[k], 22 ) ), extract_l( L_shr_r( ls_elevation_CICP19_fx[k], 22 ) ), hBinRenderer->hReverb->foa_enc_fx[k], 1, Q29 );
- // Q29: hBinRenderer->hReverb->foa_enc_fx[k]
+ FOR( k = 0; k < 11; k++ )
+ {
+ ivas_dirac_dec_get_response_fx( extract_l( L_shr_r( ls_azimuth_CICP19_fx[k], 22 ) ), extract_l( L_shr_r( ls_elevation_CICP19_fx[k], 22 ) ), hBinRenderer->hReverb->foa_enc_fx[k], 1, Q29 );
+ // Q29: hBinRenderer->hReverb->foa_enc_fx[k]
+ }
}
- }
- ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
- {
- IF( NE_32( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) )
+ ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
{
- return error;
- }
+ IF( NE_32( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
- /* Copy handles to bin renderer handle*/
- hBinRenderer->hEFAPdata = st_ivas->hEFAPdata;
+ /* Copy handles to bin renderer handle*/
+ hBinRenderer->hEFAPdata = st_ivas->hEFAPdata;
+ }
}
-}
-/* Copy the handles to main handle */
-st_ivas->hBinRenderer = hBinRenderer;
+ /* Copy the handles to main handle */
+ st_ivas->hBinRenderer = hBinRenderer;
-return error;
+ return IVAS_ERR_OK;
}
+
/*-------------------------------------------------------------------------
* ivas_binRenderer_convModuleClose()
*
* Close convolution module handle of fastconv binaural renderer
*------------------------------------------------------------------------*/
+
static void ivas_binRenderer_convModuleClose_fx(
BINAURAL_RENDERER_HANDLE *hBinRenderer, /* i/o: fastconv binaural renderer handle */
const Word16 num_poses /* i : number of poses */
@@ -1573,10 +1823,8 @@ static void ivas_binRenderer_convModuleClose_fx(
free( hBinRenConvModule->filterStatesLeftImag_fx );
hBinRenConvModule->filterStatesLeftImag_fx = NULL;
-#ifdef FIX_1844_MISSING_FREE
free( hBinRenConvModule->Q_filterStates );
hBinRenConvModule->Q_filterStates = NULL;
-#endif
free( ( *hBinRenderer )->hBinRenConvModule );
( *hBinRenderer )->hBinRenConvModule = NULL;
@@ -1649,16 +1897,21 @@ static void ivas_free_pppHrtfMem_fx(
return;
}
+
/*-------------------------------------------------------------------------
* ivas_binaural_hrtf_close()
*
* Close fastconv binaural renderer hrtf memories
*------------------------------------------------------------------------*/
-void ivas_binaural_hrtf_close(
+
+void ivas_binaural_hrtf_close_fx(
HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i : fastconv HRTF handle */
)
{
Word16 allocate_init_flag;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ Word16 n_channels;
+#endif
test();
IF( hHrtfFastConv == NULL || *hHrtfFastConv == NULL )
@@ -1669,6 +1922,15 @@ void ivas_binaural_hrtf_close(
allocate_init_flag = ( *hHrtfFastConv )->allocate_init_flag;
move16();
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ n_channels = ( *hHrtfFastConv )->n_channels;
+ move16();
+
+ ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->leftReal_fx, n_channels, allocate_init_flag );
+ ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->leftImag_fx, n_channels, allocate_init_flag );
+ ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->rightReal_fx, n_channels, allocate_init_flag );
+ ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->rightImag_fx, n_channels, allocate_init_flag );
+#else
ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->leftHRIRReal_fx, HRTF_LS_CHANNELS, allocate_init_flag );
ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->leftHRIRImag_fx, HRTF_LS_CHANNELS, allocate_init_flag );
ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->rightHRIRReal_fx, HRTF_LS_CHANNELS, allocate_init_flag );
@@ -1693,7 +1955,7 @@ void ivas_binaural_hrtf_close(
ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->leftHRIRImag_FOA_fx, FOA_CHANNELS, allocate_init_flag );
ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->rightHRIRReal_FOA_fx, FOA_CHANNELS, allocate_init_flag );
ivas_free_pppHrtfMem_fx( &( *hHrtfFastConv )->rightHRIRImag_FOA_fx, FOA_CHANNELS, allocate_init_flag );
-
+#endif
return;
}
@@ -1836,7 +2098,14 @@ void ivas_binRenderer_fx(
/* HOA decoding to CICP19 if needed*/
test();
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ test();
+ test();
+ IF( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 &&
+ ( NE_16( hBinRenderer->nInChannels, HOA3_CHANNELS ) && NE_16( hBinRenderer->nInChannels, HOA2_CHANNELS ) && NE_16( hBinRenderer->nInChannels, FOA_CHANNELS ) ) )
+#else
IF( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && NE_16( hBinRenderer->nInChannels, 16 ) )
+#endif
{
ivas_sba2mc_cldfb_fixed( *( hBinRenderer->hInputSetup ), RealBuffer_fx, ImagBuffer_fx,
hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx );
@@ -1904,8 +2173,13 @@ void ivas_binRenderer_fx(
}
ELSE
{
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hBinRenderer->hInputSetup->ambisonics_order );
+#else
rotateFrame_shd_cldfb( RealBuffer_fx, ImagBuffer_fx, Rmat_local, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 );
+#endif
}
+
ivas_binRenderer_filterModule_fx( Cldfb_RealBuffer_Binaural_fx[pos_idx], Cldfb_ImagBuffer_Binaural_fx[pos_idx], RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, pos_idx, *Q_in );
}
}
@@ -1920,8 +2194,10 @@ void ivas_binRenderer_fx(
Word32 inRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
Word32 inIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
Word16 shift_q;
+ Word16 q_in_out;
+ q_in_out = *Q_in;
- ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx );
+ ivas_binaural_obtain_DMX_fx( numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx, &q_in_out );
FOR( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ )
{
@@ -1933,8 +2209,7 @@ void ivas_binRenderer_fx(
}
ivas_binaural_reverb_processSubframe_fx( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx );
-
- shift_q = sub( Q6, sub( *Q_in, 1 ) );
+ shift_q = sub( Q6, q_in_out );
FOR( i = 0; i < BINAURAL_CHANNELS; i++ )
{
FOR( j = 0; j < numTimeSlots; j++ )
diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c
index bc9adf34791b348a940a92b1b06f655352b2b1cd..de83e8a072fb3e427a731d888b2d1f7a899646b8 100644
--- a/lib_dec/ivas_core_dec_fx.c
+++ b/lib_dec/ivas_core_dec_fx.c
@@ -76,7 +76,12 @@ ivas_error ivas_core_dec_fx(
set16_fx( tmp_buffer_fx, 0, L_FRAME48k );
Word16 tmps, incr;
+#ifdef FIX_1320_STACK_CPE_DECODER
+ Word16 flag_bwe_bws, flaf_swb_tbe;
+ Word32 *bwe_exc_extended_fx[CPE_CHANNELS] = { NULL, NULL };
+#else
Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET];
+#endif
Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; // Q15
Word16 core_switching_flag[CPE_CHANNELS];
@@ -110,13 +115,8 @@ ivas_error ivas_core_dec_fx(
move16();
move16();
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
Word16 tdm_lsfQ_PCh_fx[M];
-#else
- Word16 tdm_lsfQ_PCh_fx[M], tdm_lspQ_PCh_fx[M];
-#endif
Word32 conceal_eof_gain32;
- Flag Overflow;
error = IVAS_ERR_OK;
move32();
@@ -296,6 +296,9 @@ ivas_error ivas_core_dec_fx(
set16_fx( voice_factors_fx[n], 0, NB_SUBFR16k );
set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k );
set16_fx( hb_synth_16_fx[n], 0, L_FRAME48k );
+#ifdef FIX_1320_STACK_CPE_DECODER
+ bwe_exc_extended_fx[n] = hb_synth_32_fx[n]; /* note: reuse the buffer */
+#endif
/*------------------------------------------------------------------*
* Decision matrix (selection of technologies)
@@ -341,10 +344,8 @@ ivas_error ivas_core_dec_fx(
Copy_Scale_sig_16_32_no_sat( sts[0]->hHQ_core->old_out_LB_fx, sts[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, sts[0]->hHQ_core->Q_old_wtda_LB ) ); // Q11
L_lerp_fx_q11( sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->L_frame, sts[0]->last_L_frame );
Copy_Scale_sig_32_16( sts[0]->hHQ_core->old_out_LB_fx32, sts[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( sts[0]->hHQ_core->Q_old_wtda_LB, Q11 ) ); // Q_old_wtda_LB
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
sts[0]->hHQ_core->Q_old_out_fx32 = Q11;
move16();
-#endif
}
IF( NE_16( sts[0]->L_frame, L_FRAME16k ) )
{
@@ -363,17 +364,14 @@ ivas_error ivas_core_dec_fx(
move16();
}
+ save_hb_synth_32_fx = NULL;
test();
test();
test();
- IF( sba_dirac_stereo_flag && hSCE && LE_32( sts[0]->total_brate, SID_2k40 ) && EQ_16( sts[0]->cng_type, FD_CNG ) )
+ if ( sba_dirac_stereo_flag && hSCE && LE_32( sts[0]->total_brate, SID_2k40 ) && EQ_16( sts[0]->cng_type, FD_CNG ) )
{
save_hb_synth_32_fx = hSCE->save_hb_synth_fx;
}
- ELSE
- {
- save_hb_synth_32_fx = NULL;
- }
/*------------------------------------------------------------------*
* Decode SID for MDCT-Stereo DTX mode
@@ -524,11 +522,7 @@ ivas_error ivas_core_dec_fx(
Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, add( M, 1 ), sub( norm_s( sub( st->hFdCngDec->hFdCngCom->A_cng[0], 1 ) ), 3 ) ); // Qx
}
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = acelp_core_dec_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hStereoCng, read_sid_info ) ), IVAS_ERR_OK ) )
-#endif
{
return error;
}
@@ -590,14 +584,6 @@ ivas_error ivas_core_dec_fx(
/* TCX decoder */
Scale_sig( st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp ); // Q0
Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp ); // Q0
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
- Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, -st->hHQ_core->Q_old_wtda_LB ); // Q0
- Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda ); // Q0
- st->hHQ_core->Q_old_wtda_LB = 0;
- move16();
- st->hHQ_core->Q_old_wtda = 0;
- move16();
-#endif
IF( st_ivas == NULL )
{
@@ -612,10 +598,6 @@ ivas_error ivas_core_dec_fx(
stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hStereoCng, nchan_out, ivas_format );
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
- st->hHQ_core->Q_old_wtda_LB = st->hHQ_core->Q_old_wtda;
- move16();
-#endif
Copy_Scale_sig_16_32_DEPREC( output_16_fx[n], output_32_fx[n], output_frame, Q11 ); // Q11
IF( st->hTcxDec )
@@ -657,12 +639,7 @@ ivas_error ivas_core_dec_fx(
{
Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), -Q10 ); // Q6
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc );
-#else
- td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr,
- tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc );
-#endif
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), Q10 ); // Q16
}
@@ -721,17 +698,6 @@ ivas_error ivas_core_dec_fx(
st->hHQ_core->Q_fer_samples = 0;
move16();
}
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
- IF( NE_16( st->core, st->last_core ) )
- {
- IF( st->hTcxDec )
- {
- Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, negate( st->Q_syn ) ); // Q0
- }
- st->Q_syn = 0;
- move16();
- }
-#endif
st->prev_Q_syn = st->Q_syn;
move16();
@@ -774,9 +740,13 @@ ivas_error ivas_core_dec_fx(
move16();
sts[1]->hHQ_core->Q_old_wtda = sub( 15, sts[1]->hHQ_core->exp_old_out );
move16();
-
+#ifdef FIX_1944_CRASH_FOR_STEREO
+ shift1 = getScaleFactor16( sts[0]->hHQ_core->old_out_fx, L_FRAME48k );
+ shift2 = getScaleFactor16( sts[1]->hHQ_core->old_out_fx, L_FRAME48k );
+#else
shift1 = norm_arr( sts[0]->hHQ_core->old_out_fx, L_FRAME48k );
shift2 = norm_arr( sts[1]->hHQ_core->old_out_fx, L_FRAME48k );
+#endif
scale_sig( sts[0]->hHQ_core->old_out_fx, L_FRAME48k, shift1 );
scale_sig( sts[1]->hHQ_core->old_out_fx, L_FRAME48k, shift2 );
sts[0]->hHQ_core->Q_old_wtda = add( sts[0]->hHQ_core->Q_old_wtda, shift1 );
@@ -1011,6 +981,24 @@ ivas_error ivas_core_dec_fx(
Word16 Q_input, Q_hb_synth_fx, Q_synth_fx;
Word16 Q_syn_hb, sf;
+#ifdef FIX_1320_STACK_CPE_DECODER
+ flaf_swb_tbe = 0;
+ move16();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ if ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) || ( NE_16( st->coder_type, AUDIO ) && NE_16( st->coder_type, INACTIVE ) && GE_32( st->core_brate, SID_2k40 ) && EQ_16( st->core, ACELP_CORE ) && !st->con_tcx && GE_32( output_Fs, 32000 ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 ) )
+ {
+ flaf_swb_tbe = 1;
+ move16();
+ }
+#endif
+
sf = getScaleFactor32( output_32_fx[n], L_FRAME48k );
Q_input = 0;
@@ -1035,7 +1023,6 @@ ivas_error ivas_core_dec_fx(
IF( EQ_16( st->extl, WB_TBE ) )
{
/* WB TBE decoder */
-
ivas_wb_tbe_dec_fx( st, st->coder_type, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], hb_synth_16_fx[n], &Q_hb_synth_fx );
}
ELSE IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( n, 1 ) && !tdm_LRTD_flag && NE_16( st->extl, -1 ) && st->bws_cnt == 0 && st->extl_brate == 0 )
@@ -1049,9 +1036,16 @@ ivas_error ivas_core_dec_fx(
}
/* Memories Re-Scaling */
- Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11
- Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 // Q_input can get value <= -5
- Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], output_frame, sub( Q11, Q_synth_fx ) ); // Q11
+#ifdef FIX_1320_STACK_CPE_DECODER
+ IF( !flaf_swb_tbe )
+ {
+#endif
+ Copy_Scale_sig_16_32_no_sat( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, sub( Q11, Q_hb_synth_fx ) ); // Q11
+#ifdef FIX_1320_STACK_CPE_DECODER
+ }
+#endif
+ Copy_Scale_sig_16_32_no_sat( output_16_fx[n], output_32_fx[n], L_FRAME48k, sub( Q11, Q_input ) ); // Q11 // Q_input can get value <= -5
+ Copy_Scale_sig_16_32_no_sat( synth_16_fx[n], synth_32_fx[n], output_frame, sub( Q11, Q_synth_fx ) ); // Q11
IF( hBWE_FD != NULL )
{
@@ -1067,9 +1061,23 @@ ivas_error ivas_core_dec_fx(
* SWB(FB) BWE decoding
*---------------------------------------------------------------------*/
+#ifdef FIX_1320_STACK_CPE_DECODER
+ test();
+ test();
+ test();
+ test();
+ flag_bwe_bws = ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && st->bfi == 0 );
+ move16();
+#endif
+
Q_white_exc = 0;
move16();
+#ifdef FIX_1320_STACK_CPE_DECODER
+ test();
+ test();
+ IF( flaf_swb_tbe )
+#else
test();
test();
test();
@@ -1088,6 +1096,7 @@ ivas_error ivas_core_dec_fx(
test();
test();
IF( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) || ( NE_16( st->coder_type, AUDIO ) && NE_16( st->coder_type, INACTIVE ) && GE_32( st->core_brate, SID_2k40 ) && EQ_16( st->core, ACELP_CORE ) && !st->con_tcx && GE_32( output_Fs, 32000 ) && GT_16( st->bwidth, NB ) && st->bws_cnt > 0 ) )
+#endif
{
/* SWB TBE decoder */
ivas_swb_tbe_dec_fx( st, hStereoICBWE, bwe_exc_extended_fx[n], st->Q_exc, voice_factors_fx[n], old_syn_12k8_16k_fx[n], tmp_buffer_fx /*fb_exc*/, hb_synth_32_fx[n], pitch_buf_fx[n], &Q_white_exc );
@@ -1108,7 +1117,11 @@ ivas_error ivas_core_dec_fx(
fb_tbe_dec_ivas_fx( st, tmp_buffer_fx /*fb_exc*/, Q_white_exc, hb_synth_32_fx[n], 0, tmp_buffer_fx /*fb_synth_ref*/, Q_white_exc, output_frame );
}
}
+#ifdef FIX_1320_STACK_CPE_DECODER
+ ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || flag_bwe_bws )
+#else
ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && st->core == ACELP_CORE && st->bwidth > NB && st->bws_cnt > 0 && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) )
+#endif
{
/* SWB BWE decoder */
Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], use_cldfb_for_dft, output_frame );
@@ -1118,6 +1131,16 @@ ivas_error ivas_core_dec_fx(
Copy_Scale_sig_32_16( hBWE_FD->L_old_wtda_swb_fx32, hBWE_FD->L_old_wtda_swb_fx, output_frame, sub( hBWE_FD->old_wtda_swb_fx_exp, Q11 ) ); // old_wtda_swb_fx_exp
}
+#ifdef FIX_1320_STACK_CPE_DECODER
+ test();
+ test();
+ test();
+ IF( ( st->core == ACELP_CORE && ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) ) ) && flag_bwe_bws == 0 )
+ {
+ set32_fx( hb_synth_32_fx[n], 0, L_FRAME48k );
+ }
+#endif
+
/*---------------------------------------------------------------------*
* FEC - recovery after lost HQ core (smoothing of the BWE component)
*---------------------------------------------------------------------*/
@@ -1141,7 +1164,7 @@ ivas_error ivas_core_dec_fx(
{
hb_synth_32_fx[n][i] = Mpy_32_16_1( hb_synth_32_fx[n][i], tmp16_2 ); /* Q11 */
move32();
- tmp16_2 = add_o( tmp16_2, tmp16, &Overflow ); /* Q15 */
+ tmp16_2 = add_sat( tmp16_2, tmp16 ); /* Q15 */
}
}
@@ -1208,6 +1231,7 @@ ivas_error ivas_core_dec_fx(
}
}
+#ifndef FIX_1320_STACK_CPE_DECODER
IF( EQ_16( st->element_mode, EVS_MONO ) )
{
/*----------------------------------------------------------------*
@@ -1238,7 +1262,7 @@ ivas_error ivas_core_dec_fx(
move16();
}
}
-
+#endif
/*----------------------------------------------------------------*
* Transition and synchronization of BWE components
*----------------------------------------------------------------*/
@@ -1257,6 +1281,7 @@ ivas_error ivas_core_dec_fx(
}
ELSE
{
+#ifndef FIX_1320_STACK_CPE_DECODER
test();
IF( EQ_16( st->extl, SWB_BWE_HIGHRATE ) || EQ_16( st->extl, FB_BWE_HIGHRATE ) )
{
@@ -1265,9 +1290,12 @@ ivas_error ivas_core_dec_fx(
}
ELSE
{
+#endif
/* TBE on top of ACELP@16kHz */
tmps = NS2SA_FX2( output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS );
+#ifndef FIX_1320_STACK_CPE_DECODER
}
+#endif
}
/* Smooth transitions when switching between different technologies */
@@ -1422,10 +1450,8 @@ ivas_error ivas_core_dec_fx(
{
Copy_Scale_sig_16_32_no_sat( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, st->hHQ_core->Q_old_wtda_LB ) ); // Q11
Copy_Scale_sig_16_32_no_sat( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_fx32, L_FRAME48k, sub( Q11, st->hHQ_core->Q_old_wtda ) ); // Q11
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hHQ_core->Q_old_out_fx32 = Q11;
move16();
-#endif
}
IF( NE_16( st->element_mode, IVAS_CPE_DFT ) )
@@ -1484,7 +1510,7 @@ ivas_error ivas_core_dec_fx(
*--------------------------------------------------------*/
Word16 exp_max;
- Word32 output_fx_loc[L_FRAME48k];
+ Word32 *output_fx_loc = synth_32_fx[0];
exp_max = 0;
move16();
@@ -1494,8 +1520,12 @@ ivas_error ivas_core_dec_fx(
test();
test();
test();
+#ifdef FIX_1320_STACK_CPE_DECODER
+ IF( st->hTcxDec != NULL && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) )
+#else
test();
IF( ( EQ_16( st->codec_mode, MODE1 ) && st->hTcxDec != NULL ) && ( ( ( st->core == ACELP_CORE ) && !( EQ_16( st->bfi, 1 ) && EQ_16( st->con_tcx, 1 ) ) ) || EQ_16( st->core, HQ_CORE ) ) )
+#endif
{
Word16 exp_prev_synth_buffer = 0, exp_old_out = 0, exp_delay_buf_out = 0, exp_ouput = 0, exp_synth_history = 0;
move16();
@@ -1540,24 +1570,20 @@ ivas_error ivas_core_dec_fx(
Scale_sig( st->delay_buf_out_fx, NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ), negate( exp_max ) ); // Q0
- } /* n_channels loop */
-
- FOR( n = 0; n < n_channels; n++ )
- {
- st = sts[n];
- IF( st->cldfbAna )
+ IF( st->cldfbAna != NULL )
{
scale_sig32( st->cldfbAna->cldfb_state_fx, st->cldfbAna->cldfb_size, ( Q11 - Q10 ) ); // Q11
st->cldfbAna->Q_cldfb_state = Q11;
move16();
}
- IF( st->cldfbSynHB )
+ IF( st->cldfbSynHB != NULL )
{
scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_size, ( Q11 - Q10 ) ); // Q11
st->cldfbSynHB->Q_cldfb_state = Q11;
move16();
}
- }
+
+ } /* n_channels loop */
pop_wmops();
return error;
diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c
index 5b4c7f4723804b658d3ec737472c83df984118eb..e91b7f8b019ea3870f92f3a80e9822050b2b6581 100644
--- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c
+++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c
@@ -342,11 +342,7 @@ ivas_error ivas_corecoder_dec_reconfig_fx(
}
ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) )
{
-#ifdef NONBE_FIX_ISM_XOVER_BR
IF( NE_32( ( error = mct_dec_reconfigure_fx( st_ivas, (UWord16) NE_16( nchan_transport_real, nchan_transport_old ) ) ), IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = mct_dec_reconfigure_fx( st_ivas, (UWord16) NE_16( st_ivas->nchan_transport, nchan_transport_old ) ) ), IVAS_ERR_OK ) )
-#endif
{
return error;
}
@@ -448,13 +444,9 @@ ivas_error ivas_corecoder_dec_reconfig_fx(
*-----------------------------------------------------------------*/
test();
-#ifdef NONBE_FIX_ISM_XOVER_BR
test();
test();
IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
-#else
- if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT )
-#endif
{
ivas_sba_set_cna_cng_flag( st_ivas );
}
diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c
index 18d3cdb062449e953fc74ae5c0095f1f4903efde..ac16c4a2d4d94abc8729404d6be2e33bbfff0bfe 100644
--- a/lib_dec/ivas_cpe_dec_fx.c
+++ b/lib_dec/ivas_cpe_dec_fx.c
@@ -51,6 +51,10 @@ static void read_stereo_mode_and_bwidth_fx( CPE_DEC_HANDLE hCPE, const Decoder_S
static void stereo_mode_combined_format_dec_fx( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE );
+#ifdef FIX_1320_STACK_CPE_DECODER
+static ivas_error stereo_dft_dec_main( CPE_DEC_HANDLE hCPE, const Word32 ivas_total_brate, const Word16 n_channels, Word32 *p_res_buf_fx, Word32 *output[], Word32 outputHB[][L_FRAME48k], const Word16 output_frame, const Word32 output_Fs );
+#endif
+
/*--------------------------------------------------------------------------*
* ivas_cpe_dec_fx()
@@ -71,20 +75,26 @@ ivas_error ivas_cpe_dec_fx(
Word16 last_bwidth;
Word16 tdm_ratio_idx;
Word32 outputHB_fx[CPE_CHANNELS][L_FRAME48k]; /* buffer for output HB synthesis, both channels */ /* Q11 */
+#ifdef FIX_1320_STACK_CPE_DECODER
+ Word32 *res_buf_fx = NULL; /* Q8 */
+#else
Word16 q_res_buf;
- Word32 res_buf_fx[STEREO_DFT_N_8k]; /* Q(q_res_buf) */
+ Word32 res_buf_fx[STEREO_DFT_N_8k]; /* Q(q_res_buf) */
+#endif
CPE_DEC_HANDLE hCPE;
+ STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft;
Decoder_State **sts;
Word32 ivas_total_brate;
ivas_error error;
Word32 cpe_brate;
Word32 element_brate_ref;
- Word32 quo, rem;
error = IVAS_ERR_OK;
move32();
+#ifndef FIX_1320_STACK_CPE_DECODER
q_res_buf = Q8;
move16();
+#endif
push_wmops( "ivas_cpe_dec" );
@@ -132,11 +142,7 @@ ivas_error ivas_cpe_dec_fx(
IF( hCPE->hCoreCoder[ind1]->hHQ_core )
{
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB ) ); // Q11
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_out_fx32 = Q11;
-#else
- hCPE->hCoreCoder[ind1]->hHQ_core->q_old_outLB_fx = Q11;
-#endif
move16();
}
}
@@ -163,6 +169,12 @@ ivas_error ivas_cpe_dec_fx(
}
}
+ hConfigDft = NULL;
+ if ( hCPE->hStereoDft != NULL )
+ {
+ hConfigDft = hCPE->hStereoDft->hConfig;
+ }
+
/*------------------------------------------------------------------*
* Initialization
*-----------------------------------------------------------------*/
@@ -226,25 +238,16 @@ ivas_error ivas_cpe_dec_fx(
test();
IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) && ( NE_32( hCPE->element_brate, hCPE->last_element_brate ) || NE_16( hCPE->last_element_mode, hCPE->element_mode ) || sts[0]->ini_frame == 0 || ( NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) ) )
{
- STEREO_DFT_CONFIG_DATA_HANDLE hConfig;
- IF( hCPE->hStereoDft == NULL )
- {
- hConfig = NULL;
- }
- ELSE
- {
- hConfig = hCPE->hStereoDft->hConfig;
- }
test();
IF( st_ivas->hQMetaData != NULL && GT_32( ivas_total_brate, IVAS_SID_5k2 ) )
{
IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
{
- stereo_dft_config_fx( hConfig, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, 35 /* 0.7f * FRAMES_PER_SEC */ ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, 35 /* 0.7f * FRAMES_PER_SEC */ ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
ELSE
{
- stereo_dft_config_fx( hConfig, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
}
ELSE
@@ -252,11 +255,11 @@ ivas_error ivas_cpe_dec_fx(
/* Note: This only works for stereo operation. If DTX would be applied for multiple CPEs a different bitrate signaling is needed */
IF( LE_32( ivas_total_brate, IVAS_SID_5k2 ) )
{
- stereo_dft_config_fx( hConfig, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
ELSE
{
- stereo_dft_config_fx( hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
}
}
@@ -265,9 +268,9 @@ ivas_error ivas_cpe_dec_fx(
{
IF( hCPE->hStereoTD->tdm_LRTD_flag )
{
- iDiv_and_mod_32( L_shr( hCPE->element_brate, 1 ), FRAMES_PER_SEC, &quo, &rem, 0 );
- sts[0]->bits_frame_nominal = extract_l( quo );
- sts[1]->bits_frame_nominal = extract_l( quo );
+ i = extract_l( Mpy_32_32_r( L_shr( hCPE->element_brate, 1 ), ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ sts[0]->bits_frame_nominal = i;
+ sts[1]->bits_frame_nominal = i;
move16();
move16();
}
@@ -312,23 +315,22 @@ ivas_error ivas_cpe_dec_fx(
move32();
IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
{
- iDiv_and_mod_32( cpe_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( extract_l( quo ), 1 ), nb_bits_metadata );
+ i = extract_l( Mpy_32_32_r( cpe_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( i, 1 ), nb_bits_metadata );
IF( hCPE->brate_surplus < 0 )
{
- iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
- quo = L_negate( quo );
+ i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
}
ELSE
{
- iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
+ i = extract_l( Mpy_32_32_r( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) );
}
- sts[1]->bit_stream = sts[1]->bit_stream + extract_l( quo );
+ sts[1]->bit_stream = sts[1]->bit_stream + i;
}
ELSE
{
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( extract_l( quo ), 1 ), nb_bits_metadata );
+ i = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ sts[1]->bit_stream = sts[0]->bit_stream + sub( sub( i, 1 ), nb_bits_metadata );
}
IF( EQ_32( ivas_total_brate, IVAS_SID_5k2 ) )
@@ -351,15 +353,18 @@ ivas_error ivas_cpe_dec_fx(
}
ELSE
{
+#ifdef FIX_1320_STACK_CPE_DECODER
+ res_buf_fx = outputHB_fx[0]; /* note: temporarily reused buffer */
+
+#endif
test();
IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
{
nb_bits = sub( nb_bits, nb_bits_metadata );
IF( hCPE->brate_surplus < 0 )
{
- iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
- quo = L_negate( quo );
- nb_bits = add( nb_bits, extract_l( quo ) );
+ i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
+ nb_bits = add( nb_bits, i );
}
}
@@ -391,19 +396,17 @@ ivas_error ivas_cpe_dec_fx(
/* signal bitrate for BW selection in the SCh */
sts[0]->bits_frame_channel = 0;
move16();
- iDiv_and_mod_32( hCPE->element_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- sts[1]->bits_frame_channel = extract_l( quo );
+ sts[1]->bits_frame_channel = extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
move16();
IF( hCPE->brate_surplus < 0 )
{
- iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
- quo = L_negate( quo );
+ i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
}
ELSE
{
- iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
+ i = extract_l( Mpy_32_32_r( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) );
}
- sts[1]->bits_frame_channel = add( sts[1]->bits_frame_channel, extract_l( quo ) );
+ sts[1]->bits_frame_channel = add( sts[1]->bits_frame_channel, i );
move16();
IF( st_ivas->hQMetaData != NULL )
{
@@ -421,14 +424,13 @@ ivas_error ivas_cpe_dec_fx(
{
IF( hCPE->brate_surplus < 0 )
{
- iDiv_and_mod_32( L_abs( hCPE->brate_surplus ), FRAMES_PER_SEC, &quo, &rem, 0 );
- quo = L_negate( quo );
+ i = negate( extract_l( Mpy_32_32_r( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
}
ELSE
{
- iDiv_and_mod_32( hCPE->brate_surplus, FRAMES_PER_SEC, &quo, &rem, 0 );
+ i = extract_l( Mpy_32_32_r( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) );
}
- brate_surplus[0] = L_shr( L_mult( extract_l( L_shr( quo, 1 ) ), FRAMES_PER_SEC ), 1 );
+ brate_surplus[0] = L_shr( L_mult( shr( i, 1 ), FRAMES_PER_SEC ), 1 );
move32();
brate_surplus[1] = L_sub( hCPE->brate_surplus, brate_surplus[0] );
move32();
@@ -459,10 +461,9 @@ ivas_error ivas_cpe_dec_fx(
sts[n]->total_brate = hCPE->element_brate;
move32();
}
- iDiv_and_mod_32( sts[n]->total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- sts[n]->bits_frame_nominal = extract_l( quo );
- iDiv_and_mod_32( hCPE->element_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- sts[n]->bits_frame_channel = extract_l( L_shr( quo, sub( n_channels, 1 ) ) );
+ sts[n]->bits_frame_nominal = extract_l( Mpy_32_32_r( sts[n]->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ i = extract_l( Mpy_32_32_r( hCPE->element_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ sts[n]->bits_frame_channel = shr( i, sub( n_channels, 1 ) );
move16();
move16();
@@ -473,14 +474,13 @@ ivas_error ivas_cpe_dec_fx(
{
IF( brate_surplus[n] < 0 )
{
- iDiv_and_mod_32( L_abs( brate_surplus[n] ), FRAMES_PER_SEC, &quo, &rem, 0 );
- quo = L_negate( quo );
+ i = negate( extract_l( Mpy_32_32_r( L_abs( brate_surplus[n] ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) );
}
ELSE
{
- iDiv_and_mod_32( brate_surplus[n], FRAMES_PER_SEC, &quo, &rem, 0 );
+ i = extract_l( Mpy_32_32_r( brate_surplus[n], ONE_BY_FRAMES_PER_SEC_Q31 ) );
}
- sts[n]->bits_frame_channel = add( sts[n]->bits_frame_channel, extract_l( quo ) );
+ sts[n]->bits_frame_channel = add( sts[n]->bits_frame_channel, i );
sts[n]->total_brate = L_add( sts[n]->total_brate, brate_surplus[n] );
move16();
move32();
@@ -539,13 +539,11 @@ ivas_error ivas_cpe_dec_fx(
{
sts[1]->active_cnt = 0;
move16();
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
if ( sts[1]->ini_frame == 0 )
{
sts[1]->active_cnt = CNG_TYPE_HO;
move16();
}
-#endif
}
}
ELSE
@@ -553,11 +551,7 @@ ivas_error ivas_cpe_dec_fx(
sts[n]->VAD = 1;
move16();
sts[n]->active_cnt = add( sts[n]->active_cnt, 1 );
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
sts[n]->active_cnt = s_min( sts[n]->active_cnt, 200 );
-#else
- sts[n]->active_cnt = s_min( sts[n]->active_cnt, 100 );
-#endif
move16();
move16();
}
@@ -584,8 +578,8 @@ ivas_error ivas_cpe_dec_fx(
{
tdm_configure_dec_fx( st_ivas->ivas_format, st_ivas->ism_mode, hCPE, &tdm_ratio_idx, nb_bits_metadata );
- iDiv_and_mod_32( sts[0]->total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- sts[1]->bit_stream = sts[0]->bit_stream + extract_l( quo );
+ i = extract_l( Mpy_32_32_r( sts[0]->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ sts[1]->bit_stream = sts[0]->bit_stream + i;
}
ELSE
{
@@ -602,7 +596,7 @@ ivas_error ivas_cpe_dec_fx(
test();
test();
- IF( NE_16( hCPE->element_mode, IVAS_CPE_DFT ) || ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
+ IF( NE_16( hCPE->element_mode, IVAS_CPE_DFT ) || ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hConfigDft->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
{
IF( NE_32( ( error = ivas_core_dec_fx( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB_fx, NULL, st_ivas->sba_dirac_stereo_flag ) ), IVAS_ERR_OK ) )
{
@@ -620,10 +614,17 @@ ivas_error ivas_cpe_dec_fx(
/*----------------------------------------------------------------*
* Stereo decoder & upmixing
*----------------------------------------------------------------*/
+
test();
test();
- IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && !( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
+ IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && !( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hConfigDft->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) )
{
+#ifdef FIX_1320_STACK_CPE_DECODER
+ IF( NE_32( ( error = stereo_dft_dec_main( hCPE, ivas_total_brate, n_channels, res_buf_fx, output, outputHB_fx, output_frame, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+#else
Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; // q_dft
set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX );
set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX );
@@ -663,7 +664,11 @@ ivas_error ivas_cpe_dec_fx(
IF( NE_16( shift, 31 ) )
{
+#ifdef FIX_1946_CRASH_JBM_PROCESSING
+ shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */
+#else
shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q16 ); /* Q16 for guard bits */
+#endif
IF( GT_16( shift, hCPE->hStereoDft->q_dft ) )
{
@@ -788,6 +793,7 @@ ivas_error ivas_cpe_dec_fx(
hCPE->q_output_mem_fx[n] = Q11;
move16();
}
+#endif
}
ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) )
{
@@ -827,7 +833,6 @@ ivas_error ivas_cpe_dec_fx(
* Update parameters for stereo CNA
*----------------------------------------------------------------*/
- // stereo_cna_update_params( hCPE, output_flt, output_frame, tdm_ratio_idx );
stereo_cna_update_params_fx( hCPE, output, output_frame, tdm_ratio_idx );
/*----------------------------------------------------------------*
@@ -861,7 +866,6 @@ ivas_error ivas_cpe_dec_fx(
stereo_tca_dec_fx( hCPE, output, output_frame );
-
/*----------------------------------------------------------------*
* Common Stereo updates
*----------------------------------------------------------------*/
@@ -893,6 +897,209 @@ ivas_error ivas_cpe_dec_fx(
return error;
}
+#ifdef FIX_1320_STACK_CPE_DECODER
+
+/*-------------------------------------------------------------------------
+ * stereo_dft_dec_main()
+ *
+ * DFT decoder main function
+ *-------------------------------------------------------------------------*/
+
+static ivas_error stereo_dft_dec_main(
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ const Word32 ivas_total_brate, /* i : IVAS total bitrate */
+ const Word16 n_channels, /* i : number of channels to be decoded */
+ Word32 *p_res_buf_fx, /* i : DFT stereo residual S signal */
+ Word32 *output[], /* o : output synthesis signal */
+ Word32 outputHB_fx[][L_FRAME48k], /* o : output HB synthesis signal */
+ const Word16 output_frame, /* i : output frame length per channel */
+ const Word32 output_Fs /* i : output sampling rate */
+)
+{
+ Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX];
+ Word32 res_buf_fx[STEREO_DFT_N_8k]; /* Q(q_res_buf) */
+ Word16 n;
+ Word16 q_res_buf, q_dft;
+ Decoder_State *st0;
+ ivas_error error;
+ Word16 shift;
+ Word32 tmp1, tmp2;
+ Word16 shift1, shift2;
+
+ st0 = hCPE->hCoreCoder[0];
+
+ q_res_buf = Q8;
+ move16();
+
+ set32_fx( DFT_fx[0], 0, STEREO_DFT_BUF_MAX );
+ set32_fx( DFT_fx[1], 0, STEREO_DFT_BUF_MAX );
+
+ /* copy from temporary buffer */
+ test();
+ IF( hCPE->hStereoDft->res_cod_band_max > 0 && !st0->bfi )
+ {
+ Copy32( p_res_buf_fx, res_buf_fx, STEREO_DFT_N_8k );
+ }
+
+ /* core decoder */
+ IF( NE_32( ( error = ivas_core_dec_fx( NULL, NULL, hCPE, NULL, n_channels, output, outputHB_fx, DFT_fx, 0 ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+
+ /* Scaling of DFT's */
+ maximum_abs_32_fx( DFT_fx[0], STEREO_DFT_BUF_MAX, &tmp1 );
+ maximum_abs_32_fx( DFT_fx[1], STEREO_DFT_BUF_MAX, &tmp2 );
+
+ IF( tmp1 == 0 )
+ {
+ shift1 = Q31;
+ move16();
+ }
+ ELSE
+ {
+ shift1 = norm_l( tmp1 );
+ }
+ IF( tmp2 == 0 )
+ {
+ shift2 = Q31;
+ move16();
+ }
+ ELSE
+ {
+ shift2 = norm_l( tmp2 );
+ }
+ shift = s_min( shift1, shift2 );
+
+ IF( NE_16( shift, 31 ) )
+ {
+#ifdef FIX_1946_CRASH_JBM_PROCESSING
+ shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q17 ); /* Q17 for guard bits */
+#else
+ shift = sub( add( hCPE->hStereoDft->q_dft, shift ), Q16 ); /* Q16 for guard bits */
+#endif
+
+ IF( GT_16( shift, hCPE->hStereoDft->q_dft ) )
+ {
+ Scale_sig32( DFT_fx[0], STEREO_DFT_BUF_MAX, sub( shift, hCPE->hStereoDft->q_dft ) ); // shift
+ Scale_sig32( DFT_fx[1], STEREO_DFT_BUF_MAX, sub( shift, hCPE->hStereoDft->q_dft ) ); // shift
+ hCPE->hStereoDft->q_dft = shift;
+ move16();
+ }
+ }
+ ELSE
+ {
+ hCPE->hStereoDft->q_dft = Q8;
+ move16();
+ }
+
+ /* DFT Stereo residual decoding */
+ test();
+ IF( hCPE->hStereoDft->res_cod_band_max > 0 && !st0->bfi )
+ {
+ Word16 q;
+ Word16 q_out_DFT[2];
+
+ q = Q11;
+ move16();
+
+ Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, ( ( 2 * NB_SUBFR16k ) + 2 ), -( Q10 ) ); // Q16->Q6
+
+ stereo_dft_dec_res_fx( hCPE, res_buf_fx, q_res_buf, output[1] );
+
+ Copy_Scale_sig_16_32_DEPREC( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, ( ( 2 * NB_SUBFR16k ) + 2 ), 10 ); // Q6->Q16
+
+ Scale_sig32( output[1], L_FRAME8k, ( Q11 - Q15 ) ); // Q15 -> Q11
+
+ q_out_DFT[0] = q_out_DFT[1] = hCPE->hStereoDft->q_dft;
+ move16();
+ move16();
+
+ stereo_dft_dec_analyze_fx( hCPE, output[1], DFT_fx, 1, L_FRAME8k, output_frame, DFT_STEREO_DEC_ANA_LB, 0, 0, &q, q_out_DFT );
+
+ Scale_sig32( DFT_fx[1], STEREO_DFT_BUF_MAX, sub( hCPE->hStereoDft->q_dft, q_out_DFT[1] ) ); // q_dft
+ }
+
+ /* DFT stereo CNG */
+ q_dft = hCPE->hStereoDft->q_dft;
+ move16();
+ stereo_dtf_cng_fx( hCPE, ivas_total_brate, DFT_fx, output_frame, q_dft );
+
+ /* decoding */
+ IF( EQ_16( hCPE->nchan_out, 1 ) )
+ {
+ IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) )
+ {
+ hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft;
+ move16();
+ FOR( Word16 ii = 0; ii < (Word16) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ) ); ii++ )
+ {
+ hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft;
+ move16();
+ }
+ hCPE->hStereoDft->first_frame = 0;
+ move16();
+ }
+
+ scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // q_dft
+ hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft;
+ move16();
+ stereo_dft_unify_dmx_fx( hCPE->hStereoDft, st0, DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng->prev_sid_nodata );
+ scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q15, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // Q15
+ hCPE->hStereoDft->q_res_cod_mem_fx = Q15;
+ move16();
+ }
+ ELSE
+ {
+ IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) )
+ {
+ hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft;
+ move16();
+ FOR( Word16 ii = 0; ii < (Word16) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ) ); ii++ )
+ {
+ hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft;
+ move16();
+ }
+ hCPE->hStereoDft->first_frame = 0;
+ move16();
+ }
+
+ scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( hCPE->hStereoDft->q_dft, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // q_dft
+ hCPE->hStereoDft->q_res_cod_mem_fx = hCPE->hStereoDft->q_dft;
+ move16();
+
+ stereo_dft_dec_fx( hCPE->hStereoDft, st0, DFT_fx, hCPE->input_mem_fx[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, MAX_PARAM_SPATIAL_SUBFRAMES );
+ scale_sig32( hCPE->hStereoDft->res_cod_mem_fx, STEREO_DFT_OVL_8k, sub( Q15, hCPE->hStereoDft->q_res_cod_mem_fx ) ); // Q15
+ hCPE->hStereoDft->q_res_cod_mem_fx = Q15;
+ move16();
+ }
+
+ FOR( n = 0; n < hCPE->nchan_out; n++ )
+ {
+ Scale_sig32( output[n], L_FRAME48k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft
+ scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft
+ hCPE->q_output_mem_fx[n] = hCPE->hStereoDft->q_dft;
+ move16();
+ }
+
+ /* synthesis iFFT */
+ FOR( n = 0; n < hCPE->nchan_out; n++ )
+ {
+ stereo_dft_dec_synthesize_fx( hCPE, DFT_fx, n, output[n], output_frame );
+ }
+
+ FOR( n = 0; n < hCPE->nchan_out; n++ )
+ {
+ Scale_sig32( output[n], L_FRAME48k, sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
+ scale_sig32( hCPE->output_mem_fx[n], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
+ hCPE->q_output_mem_fx[n] = Q11;
+ move16();
+ }
+
+ return IVAS_ERR_OK;
+}
+
+#endif
/*-------------------------------------------------------------------------
* create_cpe_dec_fx()
diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c
index be043d5b82224296288bdf4e1a46ea0ac69f0f41..6d36b342903b909194a52f873911e86a8ebbcc85 100644
--- a/lib_dec/ivas_dirac_dec_fx.c
+++ b/lib_dec/ivas_dirac_dec_fx.c
@@ -42,12 +42,13 @@
#include "ivas_rom_dec.h"
#include "ivas_rom_rend.h"
#include "wmc_auto.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
+
/*-----------------------------------------------------------------------*
* Local function prototypes
*-----------------------------------------------------------------------*/
+
static ivas_error ivas_dirac_dec_config_internal_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */
@@ -1065,7 +1066,7 @@ ivas_error ivas_dirac_dec_config_fx(
IF( !need_parambin )
{
- ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
+ ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
}
need_dirac_rend = 0;
@@ -1142,11 +1143,7 @@ ivas_error ivas_dirac_dec_config_fx(
IF( st_ivas->hDiracDecBin[0] == NULL )
{
-#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
-#endif
{
return error;
}
@@ -1246,15 +1243,12 @@ void ivas_dirac_dec_read_BS_fx(
Word16 *nb_bits, /* o : number of bits read */
const Word16 last_bit_pos, /* i : last read bitstream position */
const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */
-#ifdef NONBE_FIX_1052_SBA_EXT
- const Word16 nchan_transport, /* i : number of transport channels */
-#endif
- Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */
+ const Word16 nchan_transport, /* i : number of transport channels */
+ Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */
)
{
Word16 i, j, b, dir, orig_dirac_bands;
Word16 next_bit_pos_orig;
- Word32 quo, rem;
test();
test();
@@ -1262,8 +1256,7 @@ void ivas_dirac_dec_read_BS_fx(
{
next_bit_pos_orig = st->next_bit_pos;
move16();
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- st->next_bit_pos = extract_l( L_sub( quo, 1 ) );
+ st->next_bit_pos = sub( extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ), 1 );
move16();
if ( last_bit_pos > 0 )
{
@@ -1292,13 +1285,9 @@ void ivas_dirac_dec_read_BS_fx(
set32_fx( hQMetaData->q_direction[0].band_data[b].elevation_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES );
}
}
-#ifdef NONBE_FIX_1052_SBA_EXT
+
*nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT ) );
move16();
-#else
- *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ) );
- move16();
-#endif
FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth_fx[i] = hQMetaData->q_direction[0].band_data[1].azimuth_fx[0];
@@ -1357,12 +1346,8 @@ void ivas_dirac_dec_read_BS_fx(
move16();
/* subtract mode signaling bits, since bitstream was moved after mode reading */
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
-#ifdef NONBE_FIX_1052_SBA_EXT
- st->next_bit_pos = extract_l( L_sub( L_sub( quo, 1 ), SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS ) );
-#else
- st->next_bit_pos = extract_l( L_sub( L_sub( quo, 1 ), SID_FORMAT_NBITS ) );
-#endif
+ i = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ st->next_bit_pos = sub( sub( i, 1 ), SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS );
move16();
/* 1 bit flag for signaling metadata to read */
@@ -1386,13 +1371,9 @@ void ivas_dirac_dec_read_BS_fx(
}
}
}
-#ifdef NONBE_FIX_1052_SBA_EXT
*nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), nchan_transport, NULL, SBA_FORMAT ) );
move16();
-#else
- *nb_bits = add( *nb_bits, ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ) );
- move16();
-#endif
+
FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
{
hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth_fx[i] = hQMetaData->q_direction[0].band_data[1].azimuth_fx[0];
@@ -2144,6 +2125,8 @@ void ivas_dirac_dec_set_md_map_fx(
return;
}
+
+
/*-------------------------------------------------------------------------
* ivas_dirac_dec_render_fx()
*
@@ -2220,23 +2203,112 @@ void ivas_dirac_dec_render_fx(
}
}
- IF( EQ_16( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->num_slots ) ){
- IF( EQ_16( st_ivas->hDirAC->hConfig->dec_param_estim, 1 ) ){
+ /* clang-format off */
+ IF( EQ_16( hSpatParamRendCom->slots_rendered, hSpatParamRendCom->num_slots ) )
+ {
+ IF( EQ_16( st_ivas->hDirAC->hConfig->dec_param_estim, 1 ) )
+ {
temp = add( hSpatParamRendCom->dirac_read_idx, DEFAULT_JBM_CLDFB_TIMESLOTS );
- hSpatParamRendCom->dirac_read_idx = sub( temp, i_mult( idiv1616( temp, hSpatParamRendCom->dirac_md_buffer_length ), hSpatParamRendCom->dirac_md_buffer_length ) ); // Q0
+ hSpatParamRendCom->dirac_read_idx = sub( temp, i_mult( idiv1616( temp, hSpatParamRendCom->dirac_md_buffer_length ), hSpatParamRendCom->dirac_md_buffer_length ) ); // Q0
+ }
+ ELSE
+ {
+ temp = add( hSpatParamRendCom->dirac_read_idx, DEFAULT_JBM_SUBFRAMES_5MS );
+ hSpatParamRendCom->dirac_read_idx = sub( temp, i_mult( idiv1616( temp, hSpatParamRendCom->dirac_md_buffer_length ), hSpatParamRendCom->dirac_md_buffer_length ) ); // Q0
+ }
+ }
+
+ *nSamplesAvailableNext = i_mult( sub( hSpatParamRendCom->num_slots, hSpatParamRendCom->slots_rendered ), slot_size ); // Q0
+ move16();
+
+ return;
}
-ELSE
+/* clang-format on */
+
+
+#ifdef FIX_1319_STACK_SBA_DECODER
+/*-------------------------------------------------------------------------
+ * Local functions to perform binaural rendering with optimized stack
+ *------------------------------------------------------------------------*/
+
+static void binRenderer_split_fx(
+ BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */
+ ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend, /* i/o: ISAR split binaural rendering handle */
+ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */
+ const Word16 numTimeSlots, /* i : number of time slots to render */
+ Word32 Cldfb_RealBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */
+ Word32 Cldfb_ImagBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */
+ Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */
+ Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */
+ const Word16 slot_idx_start,
+ const Word16 num_freq_bands,
+ const Word16 nchan_out )
{
- temp = add( hSpatParamRendCom->dirac_read_idx, DEFAULT_JBM_SUBFRAMES_5MS );
- hSpatParamRendCom->dirac_read_idx = sub( temp, i_mult( idiv1616( temp, hSpatParamRendCom->dirac_md_buffer_length ), hSpatParamRendCom->dirac_md_buffer_length ) ); // Q0
-}
+ Word16 pos_idx, slot_idx, ch, input_q;
+ Word32 Cldfb_RealBuffer_Binaural_loc[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
+ Word32 Cldfb_ImagBuffer_Binaural_loc[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
+
+ input_q = Q6;
+ move16();
+
+ /* Perform binaural rendering */
+ ivas_binRenderer_fx( hBinRenderer, &hSplitBinRend->splitrend.multiBinPoseData, hCombinedOrientationData, numTimeSlots,
+#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
+ NULL,
+#endif
+ Cldfb_RealBuffer_Binaural_loc, Cldfb_ImagBuffer_Binaural_loc, RealBuffer_fx, ImagBuffer_fx, &input_q );
+
+ FOR( slot_idx = 0; slot_idx < numTimeSlots; slot_idx++ )
+ {
+ FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
+ {
+ Copy32( Cldfb_RealBuffer_Binaural_loc[0][ch][slot_idx], Cldfb_RealBuffer_Binaural_fx[0][ch][slot_idx], num_freq_bands );
+ Copy32( Cldfb_ImagBuffer_Binaural_loc[0][ch][slot_idx], Cldfb_ImagBuffer_Binaural_fx[0][ch][slot_idx], num_freq_bands );
+ }
+ }
+
+ FOR( pos_idx = 0; pos_idx < hBinRenderer->numPoses; pos_idx++ )
+ {
+ FOR( slot_idx = 0; slot_idx < numTimeSlots; slot_idx++ )
+ {
+ FOR( ch = 0; ch < nchan_out; ch++ )
+ {
+ Copy32( Cldfb_RealBuffer_Binaural_loc[pos_idx][ch][slot_idx], hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], num_freq_bands );
+ Copy32( Cldfb_ImagBuffer_Binaural_loc[pos_idx][ch][slot_idx], hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[( pos_idx * BINAURAL_CHANNELS ) + ch][slot_idx_start + slot_idx], num_freq_bands );
+ }
+ }
+ }
+
+ return;
}
-*nSamplesAvailableNext = i_mult( sub( hSpatParamRendCom->num_slots, hSpatParamRendCom->slots_rendered ), slot_size ); // Q0
-move16();
-return;
+static void binRenderer_fx(
+ BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */
+ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle */
+ const Word16 numTimeSlots, /* i : number of time slots to render */
+ Word32 Cldfb_RealBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */
+ Word32 Cldfb_ImagBuffer_Binaural_fx[][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Rotated Binaural signals */
+ Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */
+ Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */
+)
+{
+ Word16 input_q;
+
+ input_q = Q6;
+ move16();
+
+ /* Perform binaural rendering */
+ ivas_binRenderer_fx( hBinRenderer, NULL, hCombinedOrientationData, numTimeSlots,
+#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
+ NULL,
+#endif
+ Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, RealBuffer_fx, ImagBuffer_fx, &input_q );
+
+ return;
}
+#endif
+
/*-------------------------------------------------------------------------
* ivas_dirac_dec_render_sf_fx()
@@ -2245,11 +2317,16 @@ return;
*------------------------------------------------------------------------*/
void ivas_dirac_dec_render_sf_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- Word32 *output_buf_fx[], /* i/o: synthesized core-coder transport channels/DirAC output Q(6-1)*/
- const Word16 nchan_transport, /* i : number of transport channels */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Word32 *output_buf_fx[], /* i/o: synthesized core-coder transport channels/DirAC output Q(6-1)*/
+ const Word16 nchan_transport, /* i : number of transport channels */
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Word32 *pppQMfFrame_ts_re_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX],
+ Word32 *pppQMfFrame_ts_im_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX]
+#else
Word32 *pppQMfFrame_ts_re_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], /*Q6*/
Word32 *pppQMfFrame_ts_im_fx[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] /*Q6*/
+#endif
)
{
Word16 i, ch, idx_in, idx_lfe;
@@ -2261,24 +2338,21 @@ void ivas_dirac_dec_render_sf_fx(
Word16 slot_idx_start, slot_idx_start_cldfb_synth, md_idx;
/*CLDFB: last output channels reserved to LFT for CICPx*/
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
+ Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
+ Word32 Cldfb_RealBuffer_Binaural_fx[1][BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
+ Word32 Cldfb_ImagBuffer_Binaural_fx[1][BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
+#else
Word32 Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
Word32 Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
Word32 Cldfb_RealBuffer_Binaural_fx[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
Word32 Cldfb_ImagBuffer_Binaural_fx[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
+#endif
Word16 index = 0, num_freq_bands = 0;
move16();
move16();
-
- FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ )
- {
- FOR( Word16 j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ )
- {
- set32_fx( Cldfb_RealBuffer_fx[i][j], 0, CLDFB_NO_CHANNELS_MAX );
- set32_fx( Cldfb_ImagBuffer_fx[i][j], 0, CLDFB_NO_CHANNELS_MAX );
- }
- }
-
/* local copies of azi, ele, diffuseness */
Word16 azimuth[CLDFB_NO_CHANNELS_MAX];
Word16 elevation[CLDFB_NO_CHANNELS_MAX];
@@ -2291,8 +2365,10 @@ void ivas_dirac_dec_render_sf_fx(
Word16 surCohRatio_q_fx = 0, temp_q = 0;
move16();
move16();
+#ifndef FIX_1319_STACK_SBA_DECODER
Word32 Cldfb_RealBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
Word32 Cldfb_ImagBuffer_Temp_fx[2][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX];
+#endif
Word16 cldfb_buf_q;
Word16 offset = 0, buff_len = 0;
move16();
@@ -2325,7 +2401,6 @@ void ivas_dirac_dec_render_sf_fx(
push_wmops( "ivas_dirac_dec_render" );
/* Initialize aux buffers */
-
FOR( i = 0; i < MAX_OUTPUT_CHANNELS; i++ )
{
FOR( Word16 j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++ )
@@ -2788,11 +2863,19 @@ void ivas_dirac_dec_render_sf_fx(
{
q_temp_cldfb = Q11;
move16();
+#ifdef FIX_1319_STACK_SBA_DECODER
+ cldfbAnalysis_ts_fx_fixed_q( &( st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][hSpatParamRendCom->num_freq_bands * index_slot] ),
+ Cldfb_RealBuffer_Binaural_fx[0][ch][slot_idx], /* note: it is a tmp. buffer at this point */
+ Cldfb_ImagBuffer_Binaural_fx[0][ch][slot_idx], /* note: it is a tmp. buffer at this point */
+ hSpatParamRendCom->num_freq_bands,
+ st_ivas->cldfbAnaDec[ch], &q_temp_cldfb );
+#else
cldfbAnalysis_ts_fx_fixed_q( &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset],
Cldfb_RealBuffer_Temp_fx[ch][slot_idx],
Cldfb_ImagBuffer_Temp_fx[ch][slot_idx],
hSpatParamRendCom->num_freq_bands,
st_ivas->cldfbAnaDec[ch], &q_temp_cldfb );
+#endif
}
q_cldfb = q_temp_cldfb;
move16();
@@ -2801,7 +2884,11 @@ void ivas_dirac_dec_render_sf_fx(
test();
IF( ( NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && NE_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) )
{
+#ifdef FIX_1319_STACK_SBA_DECODER
+ ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( st_ivas, Cldfb_RealBuffer_Binaural_fx[0], Cldfb_ImagBuffer_Binaural_fx[0], &cldfb_buf_q, hSpatParamRendCom->num_freq_bands, subframe_idx );
+#else
ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( st_ivas, Cldfb_RealBuffer_Temp_fx, Cldfb_ImagBuffer_Temp_fx, &cldfb_buf_q, hSpatParamRendCom->num_freq_bands, subframe_idx );
+#endif
}
}
@@ -2834,8 +2921,13 @@ void ivas_dirac_dec_render_sf_fx(
{
FOR( ch = 0; ch < nchan_transport; ch++ )
{
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Copy32( Cldfb_RealBuffer_Binaural_fx[0][ch][slot_idx], Cldfb_RealBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands );
+ Copy32( Cldfb_ImagBuffer_Binaural_fx[0][ch][slot_idx], Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands );
+#else
Copy32( Cldfb_RealBuffer_Temp_fx[ch][slot_idx], Cldfb_RealBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands );
Copy32( Cldfb_ImagBuffer_Temp_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][0], hSpatParamRendCom->num_freq_bands );
+#endif
}
}
ELSE
@@ -3261,16 +3353,8 @@ void ivas_dirac_dec_render_sf_fx(
IF( hDirAC->hConfig->dec_param_estim )
{
Word16 fac;
-#ifndef ISSUE_1796_replace_shl_o
- Flag flag = 0;
- move32();
-#endif
fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp );
-#ifdef ISSUE_1796_replace_shl_o
fac = shl_sat( fac, exp );
-#else
- fac = shl_o( fac, exp, &flag );
-#endif
IF( LT_16( q_diffuseness_vector, hSpatParamRendCom->q_diffuseness_vector ) )
{
@@ -3715,118 +3799,100 @@ void ivas_dirac_dec_render_sf_fx(
test();
IF( ( ( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) )
{
- Word16 in_ch;
- FOR( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ )
- {
- Word16 j, k, j2, l;
- Word16 num_objects, nchan_out_woLFE, lfe_index;
- Word16 n_slots_to_render;
- Word16 n_samples_to_render;
- Word16 interp_offset;
+ Word16 j, k, l;
+ Word16 num_objects, nchan_out_woLFE;
+ Word16 n_slots_to_render;
+ Word16 n_samples_to_render;
+ Word32 gain_fx, prev_gain_fx;
- Word32 gain_fx, prev_gain_fx;
+ num_objects = st_ivas->nchan_ism;
+ move16();
+ nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
+ move16();
+ n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered];
+ move16();
+ n_samples_to_render = imult1616( hSpatParamRendCom->num_freq_bands, n_slots_to_render );
- num_objects = st_ivas->nchan_ism;
- move16();
- nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
- move16();
- n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered];
- move16();
- n_samples_to_render = imult1616( hSpatParamRendCom->num_freq_bands, n_slots_to_render );
- interp_offset = st_ivas->hTcBuffer->n_samples_rendered;
+ test();
+ IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] )
+ {
+ ivas_jbm_dec_get_adapted_linear_interpolator_fx( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx );
+ st_ivas->hIsmRendererData->interp_offset_fx = 0;
move16();
+ }
+ FOR( i = 0; i < num_objects; i++ )
+ {
+ /* Combined rotation: rotate the object positions depending the head and external orientations */
test();
- IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] )
+ IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) )
{
- ivas_jbm_dec_get_adapted_linear_interpolator_fx( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx );
- interp_offset = 0;
- move16();
+ Word16 az_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, Q22 ) );
+ Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) );
+ Word32 az1_32, el1_32;
+ rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup );
+
+ IF( st_ivas->hEFAPdata != NULL )
+ {
+ const Word32 azi_fx = L_shl( az1_32, Q22 - Q16 ); // Q16 -> Q22
+ const Word32 ele_fx = L_shl( el1_32, Q22 - Q16 ); // Q16 -> Q22
+ efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azi_fx, ele_fx, EFAP_MODE_EFAP );
+#ifdef OBJ_EDITING_API
+ // TODO: Enable gain editing feature
+ // v_multc_fixed( st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hIsmMetaData[i]->edited_gain_fx, st_ivas->hIsmRendererData->gains_fx[i], nchan_out_woLFE ); // Q30, Q30 --> Q30
+#endif
+ }
}
- FOR( i = 0; i < num_objects; i++ )
+
+ FOR( j = 0; j < nchan_out_woLFE; j++ )
{
- /* Combined rotation: rotate the object positions depending the head and external orientations */
+ gain_fx = st_ivas->hIsmRendererData->gains_fx[i][j];
+ move32();
+ prev_gain_fx = st_ivas->hIsmRendererData->prev_gains_fx[i][j];
+ move32();
test();
- IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) )
+ IF( ( L_abs( gain_fx ) > 0 || L_abs( prev_gain_fx ) > 0 ) )
{
- Word16 az_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, Q22 ) );
- Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) );
- Word32 az1_32, el1_32;
- rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup );
-
- IF( st_ivas->hEFAPdata != NULL )
- {
- const Word32 azi_fx = L_shl( az1_32, Q22 - Q16 ); // Q16 -> Q22
- const Word32 ele_fx = L_shl( el1_32, Q22 - Q16 ); // Q16 -> Q22
- efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azi_fx, ele_fx, EFAP_MODE_EFAP );
- }
- }
+ Word32 *tc_re_fx, *tc_im_fx;
+ Word16 *w1_fx, w2_fx;
- lfe_index = 0;
- move16();
- for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ )
- {
- test();
- IF( ( st_ivas->hIntSetup.num_lfe > 0 && ( EQ_16( st_ivas->hIntSetup.index_lfe[lfe_index], j ) ) ) )
- {
- IF( LT_16( lfe_index, sub( st_ivas->hIntSetup.num_lfe, 1 ) ) )
- {
- lfe_index = add( lfe_index, 1 );
- j2 = add( j2, 1 );
- }
- ELSE
- {
- j2 = add( j2, 1 );
- }
- }
- gain_fx = st_ivas->hIsmRendererData->gains_fx[i][j];
+ w1_fx = &st_ivas->hIsmRendererData->interpolator_fx[st_ivas->hIsmRendererData->interp_offset_fx];
+ tc_re_fx = pppQMfFrame_ts_re_fx[nchan_transport + i][0];
move32();
- prev_gain_fx = st_ivas->hIsmRendererData->prev_gains_fx[i][j];
+ tc_im_fx = pppQMfFrame_ts_im_fx[nchan_transport + i][0];
move32();
- test();
- IF( ( L_abs( gain_fx ) > 0 || L_abs( prev_gain_fx ) > 0 ) )
+ FOR( k = 0; k < n_slots_to_render; k++ )
{
- Word32 *tc_re_fx, *tc_im_fx;
- Word16 *w1_fx, w2_fx;
- w1_fx = &st_ivas->hIsmRendererData->interpolator_fx[interp_offset];
- tc_re_fx = pppQMfFrame_ts_re_fx[nchan_transport + i][0];
- move32();
- tc_im_fx = pppQMfFrame_ts_im_fx[nchan_transport + i][0];
- move32();
- FOR( k = 0; k < n_slots_to_render; k++ )
+ Word32 g_fx;
+ w2_fx = sub( MAX16B, *w1_fx );
+ g_fx = Madd_32_16( Mpy_32_16_1( gain_fx, *w1_fx ), prev_gain_fx, w2_fx ); // Q15
+ FOR( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
{
- Word32 g_fx;
- w2_fx = sub( MAX16B, *w1_fx );
- g_fx = Madd_32_16( Mpy_32_16_1( gain_fx, *w1_fx ), prev_gain_fx, w2_fx ); // Q15
- FOR( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
- {
- Cldfb_RealBuffer_fx[j2][k][l] = Madd_32_32( Cldfb_RealBuffer_fx[j2][k][l], g_fx, *tc_re_fx );
- move32();
- tc_re_fx++;
- Cldfb_ImagBuffer_fx[j2][k][l] = Madd_32_32( Cldfb_ImagBuffer_fx[j2][k][l], g_fx, *tc_im_fx );
- move32();
- tc_re_fx++;
- }
- w1_fx += hSpatParamRendCom->num_freq_bands;
+ Cldfb_RealBuffer_fx[j][k][l] = Madd_32_32( Cldfb_RealBuffer_fx[j][k][l], g_fx, L_shl( *tc_re_fx, 1 ) );
+ move32();
+ tc_re_fx++;
+ Cldfb_ImagBuffer_fx[j][k][l] = Madd_32_32( Cldfb_ImagBuffer_fx[j][k][l], g_fx, L_shl( *tc_im_fx, 1 ) );
+ move32();
+ tc_im_fx++;
}
- }
- /* update here only in case of head rotation */
- test();
- IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) )
- {
- st_ivas->hIsmRendererData->prev_gains_fx[i][j] = gain_fx;
- move32();
+ w1_fx += hSpatParamRendCom->num_freq_bands;
}
}
+ /* update here only in case of head rotation */
+ test();
+ IF( st_ivas->hCombinedOrientationData != NULL && EQ_16( st_ivas->hCombinedOrientationData->enableCombinedOrientation[0], 1 ) )
+ {
+ st_ivas->hIsmRendererData->prev_gains_fx[i][j] = gain_fx;
+ move32();
+ }
}
}
+ st_ivas->hIsmRendererData->interp_offset_fx = add( st_ivas->hIsmRendererData->interp_offset_fx, i_mult( hSpatParamRendCom->num_freq_bands, st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered] ) );
}
- /* Perform binaural rendering */
- Word16 input_q;
- input_q = Q6;
- move16();
-
+ /* Perform binaural rendering, output in Q6 format */
+#ifdef FIX_1319_STACK_SBA_DECODER
+ test();
IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
IF( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
@@ -3842,39 +3908,54 @@ void ivas_dirac_dec_render_sf_fx(
st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
move16();
}
- }
-
- /*Binaural output in Q6 format*/
- ivas_binRenderer_fx( st_ivas->hBinRenderer,
- ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
- st_ivas->hCombinedOrientationData,
- hSpatParamRendCom->subframe_nbslots[subframe_idx],
- Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx,
- Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q );
- Word16 pos_idx;
+ binRenderer_split_fx( st_ivas->hBinRenderer, st_ivas->hSplitBinRend, st_ivas->hCombinedOrientationData, hSpatParamRendCom->subframe_nbslots[subframe_idx],
+ Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, slot_idx_start, hSpatParamRendCom->num_freq_bands, st_ivas->hDecoderConfig->nchan_out );
+ }
+ ELSE
+ {
+ binRenderer_fx( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, hSpatParamRendCom->subframe_nbslots[subframe_idx],
+ Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx );
+ }
+#else
IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
- FOR( pos_idx = 0; pos_idx < st_ivas->hBinRenderer->numPoses; pos_idx++ )
+ IF( st_ivas->hSplitBinRend->hCldfbDataOut != NULL )
{
FOR( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ )
{
- FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
+ FOR( ch = 0; ch < st_ivas->hBinRenderer->nInChannels; ch++ )
{
- Copy32( Cldfb_RealBuffer_Binaural_fx[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[add( i_mult( pos_idx, BINAURAL_CHANNELS ), ch )][add( slot_idx_start, slot_idx )], hSpatParamRendCom->num_freq_bands ); // Q6
- Copy32( Cldfb_ImagBuffer_Binaural_fx[pos_idx][ch][slot_idx], st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[add( i_mult( pos_idx, BINAURAL_CHANNELS ), ch )][add( slot_idx_start, slot_idx )], hSpatParamRendCom->num_freq_bands ); // Q6
+ Copy32( Cldfb_RealBuffer_fx[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_RealBuffer_fx[ch][add( slot_idx_start, slot_idx )], hSpatParamRendCom->num_freq_bands );
+ Copy32( Cldfb_ImagBuffer_fx[ch][slot_idx], st_ivas->hSplitBinRend->hCldfbDataOut->Cldfb_ImagBuffer_fx[ch][add( slot_idx_start, slot_idx )], hSpatParamRendCom->num_freq_bands );
}
}
+ st_ivas->hSplitBinRend->hCldfbDataOut->config = st_ivas->hIntSetup.output_config;
+ move16();
}
}
+ /*Binaural output in Q6 format*/
+ ivas_binRenderer_fx( st_ivas->hBinRenderer,
+ ( st_ivas->hSplitBinRend == NULL ) ? NULL : &st_ivas->hSplitBinRend->splitrend.multiBinPoseData,
+ st_ivas->hCombinedOrientationData,
+ hSpatParamRendCom->subframe_nbslots[subframe_idx],
+ Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx,
+ Cldfb_RealBuffer_fx, Cldfb_ImagBuffer_fx, &input_q );
+#endif
+
/* Inverse CLDFB*/
FOR( ch = 0; ch < st_ivas->hDecoderConfig->nchan_out; ch++ )
{
/* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */
Word32 *synth_fx = &output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands];
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Word32 *RealBuffer_fx[CLDFB_SLOTS_PER_SUBFRAME];
+ Word32 *ImagBuffer_fx[CLDFB_SLOTS_PER_SUBFRAME];
+#else
Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES];
Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES];
+#endif
FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ )
{
RealBuffer_fx[i] = Cldfb_RealBuffer_Binaural_fx[0][ch][i];
@@ -3920,8 +4001,13 @@ void ivas_dirac_dec_render_sf_fx(
}
ELSE
{
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Word32 *RealBuffer_fx[CLDFB_SLOTS_PER_SUBFRAME];
+ Word32 *ImagBuffer_fx[CLDFB_SLOTS_PER_SUBFRAME];
+#else
Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES];
Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES];
+#endif
Word16 outchannels;
idx_in = 0;
@@ -3958,7 +4044,11 @@ void ivas_dirac_dec_render_sf_fx(
/* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */
Copy32( &( output_buf_fx[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated_fx, num_samples_subframe );
- Copy32( &( output_buf_fx[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe_fx, num_samples_subframe );
+ if ( hDirACRend->hOutSetup.num_lfe > 0 )
+ {
+ Copy32( &( output_buf_fx[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe_fx, num_samples_subframe );
+ }
+
FOR( ch = 0; ch < outchannels; ch++ )
{
diff --git a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c
index 758363bfbe9f1b33d753a98d24e39c2abd800376..954dd5f72e35211386a25ec3703f839b8944ea1e 100644
--- a/lib_dec/ivas_dirac_output_synthesis_cov_fx.c
+++ b/lib_dec/ivas_dirac_output_synthesis_cov_fx.c
@@ -52,13 +52,11 @@
#include "rom_dec.h"
#include "ivas_prot_fx.h"
-#ifdef NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS
/*-----------------------------------------------------------------------*
* Local constants
*-----------------------------------------------------------------------*/
#define SQRT_EPSILON_FX 68 /* Q31 square root of EPSILON */
-#endif
/*-------------------------------------------------------------------*
* ivas_dirac_dec_output_synthesis_cov_open()
@@ -887,7 +885,6 @@ Word16 computeMixingMatrices_fx(
}
limit_e = add( limit_e, reg_Sx_e );
-#ifdef NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS
limit_fx = Mpy_32_32( limit_fx, reg_Sx_fx );
IF( BASOP_Util_Cmp_Mant32Exp( limit_fx, limit_e, SQRT_EPSILON_FX /* Q31 */, 0 ) < 0 )
{
@@ -896,9 +893,6 @@ Word16 computeMixingMatrices_fx(
limit_e = 0;
move16();
}
-#else /* NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS */
- limit_fx = Madd_32_32( EPSILON_FX, limit_fx, reg_Sx_fx );
-#endif
FOR( i = 0; i < lengthCx; ++i )
{
diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c
index a2e9ad0a1224c9bb15bad76ef08f6e2c5f172981..21db1c479bb5e458150289e337ee0e25c307ab36 100644
--- a/lib_dec/ivas_init_dec_fx.c
+++ b/lib_dec/ivas_init_dec_fx.c
@@ -42,9 +42,6 @@
#include "prot_fx.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "lib_isar_pre_rend.h"
-#include "isar_prot.h"
-#include "isar_stat.h"
/*-------------------------------------------------------------------*
@@ -55,264 +52,503 @@ static ivas_error ivas_read_format( Decoder_Struct *st_ivas, Word16 *num_bits_re
static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas );
-#ifdef NONBE_FIX_1052_SBA_EXT
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
-static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( const int16_t sba_order );
-#else
-static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_order );
-#endif
-#endif
-
-static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
+static AUDIO_CONFIG ivas_set_audio_config_from_sba_order( const Word16 sba_order );
/*-------------------------------------------------------------------*
- * ivas_dec_reconfig_split_rend()
+ * ivas_set_audio_config_from_sba_order()
+ *
*
- * IVAS decoder split rend reconfig
*-------------------------------------------------------------------*/
-static ivas_error ivas_dec_reconfig_split_rend(
- Decoder_Struct *st_ivas /* i : IVAS decoder structure */
+/*! r: audio configuration */
+static AUDIO_CONFIG ivas_set_audio_config_from_sba_order(
+ const Word16 sba_order /* i : Ambisonic (SBA) order */
)
{
- ivas_error error;
- Word16 cldfb_in_flag, num_ch, ch, isCldfbNeeded, i, pcm_out_flag;
- SPLIT_REND_WRAPPER *hSplitRendWrapper;
+ AUDIO_CONFIG output_config;
- hSplitRendWrapper = &st_ivas->hSplitBinRend->splitrend;
- move16();
- pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
- move16();
- cldfb_in_flag = 0;
- move16();
+ output_config = IVAS_AUDIO_CONFIG_HOA3;
+ move32();
- IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
- EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
- EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
- EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
+ SWITCH( sba_order )
{
- cldfb_in_flag = 1;
- move16();
+ case SBA_FOA_ORDER:
+ output_config = IVAS_AUDIO_CONFIG_FOA;
+ move32();
+ BREAK;
+ case SBA_HOA2_ORDER:
+ output_config = IVAS_AUDIO_CONFIG_HOA2;
+ move32();
+ BREAK;
+ case SBA_HOA3_ORDER:
+ output_config = IVAS_AUDIO_CONFIG_HOA3;
+ move32();
+ BREAK;
+ default:
+ output_config = IVAS_AUDIO_CONFIG_INVALID;
+ move32();
+ BREAK;
}
- ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );
+ return output_config;
+}
+
+
+/*---------------------------------------------------------------------*
+ * ivas_dec_get_format( )
+ *
+ * Read main parameters from the bitstream to set-up the decoder:
+ * - IVAS format
+ * - IVAS format specific signaling
+ *---------------------------------------------------------------------*/
+
+ivas_error ivas_dec_get_format_fx(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+)
+{
+ Word16 k, idx, num_bits_read;
+ Word16 nchan_ism, element_mode_flag;
+ Word16 sba_order, sba_planar, sba_analysis_order;
+ Word32 ivas_total_brate;
+ UWord16 *bit_stream_orig;
+ AUDIO_CONFIG signaled_config;
+ ivas_error error;
- isCldfbNeeded = 0;
+ num_bits_read = 0;
+ move16();
+ element_mode_flag = 0;
move16();
- IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
- ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
+ ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
+ move32();
+ bit_stream_orig = st_ivas->bit_stream;
+
+ /*-------------------------------------------------------------------*
+ * Read IVAS format
+ *-------------------------------------------------------------------*/
+
+ IF( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK )
{
- cldfb_in_flag = 0;
- move16();
+ return error;
+ }
+
+ test();
+ test();
+ test();
+ test();
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_32( st_ivas->ivas_format, st_ivas->last_ivas_format ) &&
+ !( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_ISM_FORMAT ) ) &&
+ !( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_FORMAT ) ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" );
}
- IF( NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) )
+ /*-------------------------------------------------------------------*
+ * Read other signaling (ISM/MC mode, number of channels, etc.)
+ *-------------------------------------------------------------------*/
+#ifndef FIX_HRTF_LOAD
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+#endif
+
+ IF( is_DTXrate( ivas_total_brate ) == 0 )
{
- IF( EQ_16( cldfb_in_flag, 0 ) )
+ /*-------------------------------------------------------------------*
+ * Read IVAS format related signaling:
+ * - in ISM : read number of objects
+ * - in SBA : read SBA planar flag and SBA order
+ * - in MASA : read number of TC
+ * - in MC : read LS setup
+ *-------------------------------------------------------------------*/
+
+ IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
{
- isCldfbNeeded = 1;
+ element_mode_flag = 1;
move16();
}
- ELSE IF( EQ_16( st_ivas->hRenderConfig->split_rend_config.codec, ISAR_SPLIT_REND_CODEC_LC3PLUS ) && cldfb_in_flag )
+ ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
{
- isCldfbNeeded = 1;
+ /* read the number of objects */
+ nchan_ism = 1;
move16();
- }
- ELSE IF( pcm_out_flag && cldfb_in_flag )
- {
- isCldfbNeeded = 1;
+#ifdef FIX_HRTF_LOAD
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ k = sub( k, 1 );
+ WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) )
+#else
+ WHILE( st_ivas->bit_stream[k - 1] && nchan_ism < MAX_NUM_OBJECTS )
+#endif
+ {
+ nchan_ism = add( nchan_ism, 1 );
+ k = sub( k, 1 );
+ }
+
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" );
+ }
+
+ st_ivas->nchan_ism = nchan_ism;
move16();
- }
- }
- ELSE IF( st_ivas->hDecoderConfig->Opt_non_diegetic_pan )
- {
- isCldfbNeeded = 1;
- move16();
- }
+ st_ivas->ism_mode = ivas_ism_mode_select( nchan_ism, ivas_total_brate );
- IF( EQ_16( isCldfbNeeded, 1 ) && hSplitRendWrapper->hCldfbHandles == NULL )
- {
- IF( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) );
+ st_ivas->nchan_transport = nchan_ism;
+ move16();
+ if ( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
+ {
+ st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
+ move16();
+ }
}
-
- num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
- move16();
- FOR( ch = 0; ch < num_ch; ch++ )
+ ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
{
- hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
+ /* read Ambisonic (SBA) planar flag */
+ sba_planar = st_ivas->bit_stream[num_bits_read];
+ num_bits_read = add( num_bits_read, SBA_PLANAR_BITS );
+
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( sba_planar, st_ivas->sba_planar ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the SBA planar/3D layout is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA planar flag signalled!" );
+ }
+
+ /* read Ambisonic (SBA) order */
+ sba_order = st_ivas->bit_stream[num_bits_read + 1];
move16();
- }
+ sba_order = add( sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) );
- num_ch = i_mult( hSplitRendWrapper->multiBinPoseData.num_poses, BINAURAL_CHANNELS );
- move16();
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" );
+ }
- FOR( ch = 0; ch < num_ch; ch++ )
+ sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, sba_order );
+ st_ivas->nchan_transport = ivas_get_sba_num_TCs_fx( ivas_total_brate, sba_analysis_order );
+ }
+ ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) )
{
- IF( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK )
+ /* read number of MASA transport channels */
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ IF( st_ivas->bit_stream[k - 1] )
{
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) );
+ st_ivas->nchan_transport = 2;
+ move16();
+ element_mode_flag = 1;
+ move16();
+ }
+ ELSE
+ {
+ st_ivas->nchan_transport = 1;
+ move16();
}
- }
- FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
- {
- if ( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK )
+ /* this should be non-zero if original input format was MASA_ISM_FORMAT */
+ st_ivas->ism_mode = ISM_MODE_NONE;
+ move16();
+ nchan_ism = add( st_ivas->bit_stream[k - 3], shl( st_ivas->bit_stream[k - 2], 1 ) );
+
+ IF( nchan_ism > 0 )
{
- return error;
+ /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
+ /* info about the number of objects:
+ '00' - MASA format at the encoder
+ '01' - MASA_ISM_FORMAT at the encoder, with 4 objects
+ '10' - MASA_ISM_FORMAT at the encoder, with 3 objects
+ '11' - MASA_ISM_FORMAT at the encoder, with 1 or 2 objects
+ reading if 1 or 2 objects is performed later
+ */
+ nchan_ism = sub( 5, nchan_ism );
+ test();
+#ifdef FIX_HRTF_LOAD
+ IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( nchan_ism, 2 ) )
+ {
+ nchan_ism = 1;
+ move16();
+ }
+#else
+ IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( st_ivas->nchan_ism, 2 ) )
+ {
+ st_ivas->nchan_ism = 1;
+ move16();
+ }
+#endif
+
+ /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/
+ st_ivas->nchan_transport = 2;
+ move16();
+ element_mode_flag = 1;
+ move16();
}
+
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" );
+ }
+
+ st_ivas->nchan_ism = nchan_ism;
+ move16();
}
- }
- ELSE IF( EQ_16( isCldfbNeeded, 0 ) && hSplitRendWrapper->hCldfbHandles != NULL )
- {
- num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
- move16();
- FOR( ch = 0; ch < num_ch; ch++ )
+ ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
{
- IF( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] != NULL )
+ st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */
+ move16();
+
+ /* the number of objects are written at the end of the bitstream */
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 );
+ st_ivas->ism_mode = ivas_omasa_ism_mode_select_fx( ivas_total_brate, nchan_ism );
+
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) )
{
- deleteCldfb_ivas_fx( &hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] );
- hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
- move32();
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" );
}
- }
- FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
+ st_ivas->nchan_ism = nchan_ism;
+ move16();
+ }
+ ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
- IF( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] != NULL )
+ /* the number of objects is written at the end of the bitstream, in the SBA metadata */
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 );
+
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) )
{
- deleteCldfb_ivas_fx( &hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] );
- hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL;
- move32();
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" );
}
- }
- free( hSplitRendWrapper->hCldfbHandles );
- hSplitRendWrapper->hCldfbHandles = NULL;
- move32();
- }
+ st_ivas->nchan_ism = nchan_ism;
+ move16();
- IF( ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) &&
- ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) &&
- !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) /* td-rend not needed? */
- {
- FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
- {
- IF( st_ivas->hTdRendHandles[i] != NULL )
+ /* read Ambisonic (SBA) planar flag */
+ /*sba_planar = st_ivas->bit_stream[num_bits_read];*/
+ num_bits_read = add( num_bits_read, SBA_PLANAR_BITS );
+
+ /* read Ambisonic (SBA) order (0 for signaling OSBA format at low bitrates)*/
+ sba_order = st_ivas->bit_stream[num_bits_read + 1];
+ move16();
+#ifdef FIX_HRTF_LOAD
+ sba_order = add( sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) );
+#else
+ sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 );
+#endif
+ num_bits_read = add( num_bits_read, SBA_ORDER_BITS );
+
+ /* read the real Ambisonic order when the above bits are used to signal OSBA format */
+ IF( LT_32( ivas_total_brate, IVAS_24k4 ) )
{
- st_ivas->hTdRendHandles[i]->HrFiltSet_p = NULL;
- move32();
- ivas_td_binaural_close_fx( &st_ivas->hTdRendHandles[i] );
+ sba_order = st_ivas->bit_stream[num_bits_read + 1];
+ move16();
+#ifdef FIX_HRTF_LOAD
+ sba_order = add( sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) );
+#else
+ sba_order = shl( st_ivas->bit_stream[num_bits_read], 1 );
+#endif
+ num_bits_read = add( num_bits_read, SBA_ORDER_BITS );
}
- }
- }
- return IVAS_ERR_OK;
-}
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" );
+ }
+ st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism );
-/*-------------------------------------------------------------------*
- * ivas_dec_init_split_rend()
- *
- * IVAS decoder split rend init
- *-------------------------------------------------------------------*/
+ sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, sba_order );
+ st_ivas->nchan_transport = ivas_get_sba_num_TCs_fx( ivas_total_brate, sba_analysis_order );
+ }
+ ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
+ {
+ /* read MC configuration */
+ idx = 0;
+ move16();
+ FOR( k = 0; k < MC_LS_SETUP_BITS; k++ )
+ {
+ IF( st_ivas->bit_stream[num_bits_read + k] )
+ {
+ idx = add( idx, shl( 1, sub( ( MC_LS_SETUP_BITS - 1 ), k ) ) );
+ }
+ }
+ num_bits_read = add( num_bits_read, MC_LS_SETUP_BITS );
-static ivas_error ivas_dec_init_split_rend(
- Decoder_Struct *st_ivas /* i : IVAS decoder structure */
-)
-{
- ivas_error error;
- Word16 cldfb_in_flag, pcm_out_flag;
- Word16 mixed_td_cldfb_flag;
+ signaled_config = ivas_mc_map_ls_setup_to_output_config_fx( idx );
- pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
- cldfb_in_flag = 0;
- move16();
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_32( st_ivas->transport_config, signaled_config ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Switching of MC configurations is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" );
+ }
- IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
- EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
- EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
- EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
- {
- cldfb_in_flag = 1;
- move16();
- }
+ st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate );
+ st_ivas->transport_config = signaled_config;
+ move16();
+ }
- 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 );
+ /*-------------------------------------------------------------------*
+ * Read element mode
+ *-------------------------------------------------------------------*/
- IF( EQ_16( cldfb_in_flag, 1 ) && ( EQ_16( st_ivas->hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) )
- {
- IF( ( st_ivas->hSplitBinRend->hCldfbDataOut = (ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL )
+ test();
+ IF( st_ivas->ini_frame == 0 && element_mode_flag )
{
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) );
+ /* read stereo technology info */
+ if ( LT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) )
+ {
+ /* 1 bit */
+ IF( st_ivas->bit_stream[num_bits_read] )
+ {
+ st_ivas->element_mode_init = add( 1, IVAS_CPE_DFT );
+ }
+ ELSE
+ {
+ st_ivas->element_mode_init = add( 0, IVAS_CPE_DFT );
+ }
+ }
+ ELSE
+ {
+ st_ivas->element_mode_init = IVAS_CPE_MDCT;
+ move16();
+ }
}
}
-
- mixed_td_cldfb_flag = 0;
- move16();
- IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
- ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
+ ELSE IF( EQ_32( ivas_total_brate, IVAS_SID_5k2 ) )
{
- mixed_td_cldfb_flag = 1;
- move16();
- }
-
- error = ISAR_PRE_REND_open( &st_ivas->hSplitBinRend->splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->render_framesize, mixed_td_cldfb_flag );
- move16();
- return error;
-}
-
-#ifdef NONBE_FIX_1052_SBA_EXT
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
-/*-------------------------------------------------------------------*
- * ivas_set_audio_config_from_sba_order()
- *
- *
- *-------------------------------------------------------------------*/
+ SWITCH( st_ivas->sid_format )
+ {
+ case SID_DFT_STEREO:
+ st_ivas->element_mode_init = IVAS_CPE_DFT;
+ move16();
+ BREAK;
+ case SID_MDCT_STEREO:
+ st_ivas->element_mode_init = IVAS_CPE_MDCT;
+ move16();
+ BREAK;
+ case SID_ISM:
+ st_ivas->element_mode_init = IVAS_SCE;
+ move16();
+ BREAK;
+ case SID_MASA_1TC:
+ st_ivas->element_mode_init = IVAS_SCE;
+ move16();
+ st_ivas->nchan_transport = 1;
+ move16();
+ BREAK;
+ case SID_MASA_2TC:
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ IF( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] == 1 )
+ {
+ st_ivas->element_mode_init = IVAS_CPE_MDCT;
+ move16();
+ }
+ ELSE
+ {
+ st_ivas->element_mode_init = IVAS_CPE_DFT;
+ move16();
+ }
+ st_ivas->nchan_transport = 2;
+ move16();
+ BREAK;
+ case SID_SBA_1TC:
+ st_ivas->element_mode_init = IVAS_SCE;
+ move16();
+ BREAK;
+ case SID_SBA_2TC:
+ st_ivas->element_mode_init = IVAS_CPE_MDCT;
+ move16();
+ BREAK;
+ }
-/*! r: audio configuration */
-static AUDIO_CONFIG ivas_set_audio_config_from_sba_order(
- const int16_t sba_order /* i : Ambisonic (SBA) order */
-)
+ IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
+ {
+ /* read the number of objects */
+ nchan_ism = 1;
+ move16();
+#ifdef FIX_HRTF_LOAD
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ k = sub( sub( k, 1 ), SID_FORMAT_NBITS );
+ WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) )
#else
-static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_order )
+ WHILE( st_ivas->bit_stream[k - 1 - SID_FORMAT_NBITS] && nchan_ism < MAX_NUM_OBJECTS )
#endif
-{
- AUDIO_CONFIG output_config;
+ {
+ nchan_ism = add( nchan_ism, 1 );
+ k = sub( k, 1 );
+ }
+ k = sub( k, 1 );
- output_config = IVAS_AUDIO_CONFIG_HOA3;
- move32();
+ test();
+ IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) )
+ {
+#ifdef DEBUGGING
+ fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" );
+#endif
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" );
+ }
- SWITCH( sba_order )
- {
- case SBA_FOA_ORDER:
- output_config = IVAS_AUDIO_CONFIG_FOA;
- move32();
- BREAK;
- case SBA_HOA2_ORDER:
- output_config = IVAS_AUDIO_CONFIG_HOA2;
- move32();
- BREAK;
- case SBA_HOA3_ORDER:
- output_config = IVAS_AUDIO_CONFIG_HOA3;
- move32();
- BREAK;
- default:
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- output_config = IVAS_AUDIO_CONFIG_INVALID;
+ st_ivas->nchan_ism = nchan_ism;
+ move16();
+
+ /* read ism_mode */
+ st_ivas->ism_mode = ISM_MODE_DISC;
move32();
- BREAK;
-#else
- assert( 0 );
-#endif
+ IF( GT_16( nchan_ism, 2 ) )
+ {
+ k = sub( k, nchan_ism ); /* SID metadata flags */
+ idx = st_ivas->bit_stream[k];
+ move16();
+ st_ivas->ism_mode = (ISM_MODE) add( idx, 1 );
+ move32();
+ }
+
+ st_ivas->nchan_transport = nchan_ism;
+ move16();
+ if ( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
+ {
+ st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE;
+ move16();
+ }
+ }
}
- return output_config;
+ st_ivas->bit_stream = bit_stream_orig;
+
+ return IVAS_ERR_OK;
}
-#endif
+
/*-------------------------------------------------------------------*
* ivas_dec_setup()
@@ -321,9 +557,12 @@ static AUDIO_CONFIG ivas_set_output_config_from_sba_order( const Word16 sba_orde
*-------------------------------------------------------------------*/
ivas_error ivas_dec_setup(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
- Word16 *data /* o : output synthesis signal */
+ Word16 *data /* o : output synthesis signal */
+#endif
)
{
Word16 k, idx, num_bits_read;
@@ -331,6 +570,9 @@ ivas_error ivas_dec_setup(
Decoder_State *st;
Word32 ivas_total_brate;
ivas_error error;
+ Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
+ Word16 num_src = 0;
+ move16();
error = IVAS_ERR_OK;
move32();
@@ -346,11 +588,10 @@ ivas_error ivas_dec_setup(
* Read IVAS format
*-------------------------------------------------------------------*/
- ivas_read_format( st_ivas, &num_bits_read );
-
- Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
- Word16 num_src = 0;
- move16();
+ IF( ( error = ivas_read_format( st_ivas, &num_bits_read ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
/*-------------------------------------------------------------------*
* Read other signling (ISM/MC mode, number of channels, etc.)
@@ -378,10 +619,8 @@ ivas_error ivas_dec_setup(
move16();
nchan_ism = 1;
move16();
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- k = extract_l( L_sub( res_dec, 1 ) );
-
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ k = sub( k, 1 );
WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) )
{
nchan_ism = add( nchan_ism, 1 );
@@ -391,7 +630,11 @@ ivas_error ivas_dec_setup(
st_ivas->nchan_ism = nchan_ism;
move16();
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_ism_dec_config_fx( st_ivas, st_ivas->ism_mode ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_ism_dec_config_fx( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -408,24 +651,17 @@ ivas_error ivas_dec_setup(
move16();
st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) );
move16();
-#ifdef NONBE_FIX_1052_SBA_EXT
- IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
- {
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
-#else
- st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
-#endif
- st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
- }
-#endif
-
num_bits_read = add( num_bits_read, SBA_ORDER_BITS );
+
test();
test();
IF( st_ivas->ini_frame > 0 && NE_32( ivas_total_brate, st_ivas->last_active_ivas_total_brate ) && GT_32( ivas_total_brate, IVAS_SID_5k2 ) )
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_sba_dec_reconfigure_fx( st_ivas ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_sba_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -441,9 +677,8 @@ ivas_error ivas_dec_setup(
ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) )
{
/* read number of MASA transport channels */
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- IF( st_ivas->bit_stream[res_dec - 1] )
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ IF( st_ivas->bit_stream[k - 1] )
{
st_ivas->nchan_transport = 2;
move16();
@@ -455,13 +690,11 @@ ivas_error ivas_dec_setup(
st_ivas->nchan_transport = 1;
move16();
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
/* this should be non-zero if original input format was MASA_ISM_FORMAT */
- st_ivas->nchan_ism = add( st_ivas->bit_stream[L_sub( res_dec, 3 )], shl( st_ivas->bit_stream[L_sub( res_dec, 2 )], 1 ) );
+ st_ivas->nchan_ism = add( st_ivas->bit_stream[sub( k, 3 )], shl( st_ivas->bit_stream[sub( k, 2 )], 1 ) );
IF( GT_16( st_ivas->nchan_ism, 0 ) )
{
-#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
/* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
/* info about the number of objects:
'00' - MASA format at the encoder
@@ -478,23 +711,13 @@ ivas_error ivas_dec_setup(
st_ivas->nchan_ism = 1;
move16();
}
+
/* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 and the corresponding bit is not used here*/
-#else
- /* the input_ivas_format should be MASA_ISM_FORMAT, but we cannot initialize it now */
- test();
- IF( EQ_16( st_ivas->nchan_transport, 2 ) && EQ_16( st_ivas->nchan_ism, 3 ) )
- {
- st_ivas->nchan_ism = 4;
- move16();
- }
- /* for MASA_ISM_FORMAT at input the number of MASA transport channels is always 2 */
-#endif
st_ivas->nchan_transport = 2;
element_mode_flag = 1;
move16();
move16();
}
-#endif
IF( st_ivas->ini_frame > 0 )
{
@@ -515,7 +738,11 @@ ivas_error ivas_dec_setup(
}
ELSE
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_masa_dec_reconfigure_fx( st_ivas ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_masa_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -523,7 +750,11 @@ ivas_error ivas_dec_setup(
}
ELSE
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_omasa_dec_config_fx( st_ivas, &num_src, SrcInd ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_omasa_dec_config_fx( st_ivas, nSamplesRendered, &num_src, SrcInd, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -535,11 +766,10 @@ ivas_error ivas_dec_setup(
{
st_ivas->nchan_transport = 2; /* always 2 MASA transport channels */
move16();
- /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata */
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[res_dec - 1], 1 ), st_ivas->bit_stream[res_dec - 2] ), 1 );
+ /* for the DISC mode the number of objects are written at the end of the bitstream, in the MASA metadata */
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 );
move16();
st_ivas->ism_mode = ivas_omasa_ism_mode_select_fx( ivas_total_brate, st_ivas->nchan_ism );
move16();
@@ -550,7 +780,11 @@ ivas_error ivas_dec_setup(
test();
IF( ( GT_32( ivas_total_brate, IVAS_SID_5k2 ) && NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) || ( st_ivas->ini_active_frame == 0 ) )
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_omasa_dec_config_fx( st_ivas, &num_src, SrcInd ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_omasa_dec_config_fx( st_ivas, nSamplesRendered, &num_src, SrcInd, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -560,9 +794,8 @@ ivas_error ivas_dec_setup(
ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
/* the number of objects is written at the end of the bitstream, in the SBA metadata */
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[res_dec - 1], 1 ), st_ivas->bit_stream[res_dec - 2] ), 1 );
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ st_ivas->nchan_ism = add( add( shl( st_ivas->bit_stream[k - 1], 1 ), st_ivas->bit_stream[k - 2] ), 1 );
move16();
/* read Ambisonic (SBA) planar flag */
@@ -579,17 +812,22 @@ ivas_error ivas_dec_setup(
/* read Ambisonic (SBA) order */
/* read the real Ambisonic order when the above bits are used to signal OSBA format */
- if ( LT_32( ivas_total_brate, IVAS_24k4 ) )
+ IF( LT_32( ivas_total_brate, IVAS_24k4 ) )
{
st_ivas->sba_order = st_ivas->bit_stream[num_bits_read + 1];
- st_ivas->sba_order += 2 * st_ivas->bit_stream[num_bits_read];
- num_bits_read += SBA_ORDER_BITS;
+ move16();
+ st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[num_bits_read], 1 ) );
+ num_bits_read = add( num_bits_read, SBA_ORDER_BITS );
}
test();
IF( st_ivas->ini_frame > 0 && NE_32( ivas_total_brate, st_ivas->last_active_ivas_total_brate ) )
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_sba_dec_reconfigure_fx( st_ivas ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_sba_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -605,27 +843,15 @@ ivas_error ivas_dec_setup(
/*correct number of CPEs for discrete ISM coding*/
test();
IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
-
-#ifdef NONBE_FIX_ISM_XOVER_BR
{
Word16 n;
n = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
st_ivas->nCPE = shr_r( n, 1 );
}
-#else
- {
- st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) );
- move16();
- }
-#endif
}
-#ifdef NONBE_FIX_ISM_XOVER_BR
IF( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) )
-#else
- IF( GE_32( ivas_total_brate, IVAS_256k ) )
-#endif
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
move32();
@@ -651,7 +877,11 @@ ivas_error ivas_dec_setup(
num_bits_read = add( num_bits_read, MC_LS_SETUP_BITS );
/* select MC format mode; reconfigure the MC format decoder */
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_mc_dec_config_fx( st_ivas, idx ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_mc_dec_config_fx( st_ivas, idx, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -707,10 +937,9 @@ ivas_error ivas_dec_setup(
st_ivas->nchan_transport = 1;
move16();
BREAK;
- case SID_MASA_2TC:; // empyt statement for declaration
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- IF( EQ_16( st_ivas->bit_stream[( res_dec - 1 ) - SID_FORMAT_NBITS], 1 ) )
+ case SID_MASA_2TC:
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ IF( EQ_16( st_ivas->bit_stream[( k - 1 ) - SID_FORMAT_NBITS], 1 ) )
{
st_ivas->element_mode_init = IVAS_CPE_MDCT;
move16();
@@ -733,18 +962,6 @@ ivas_error ivas_dec_setup(
BREAK;
}
-#ifdef NONBE_FIX_1052_SBA_EXT
- IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
- {
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- st_ivas->hDecoderConfig->output_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
-#else
- st_ivas->hDecoderConfig->output_config = ivas_set_output_config_from_sba_order( st_ivas->sba_order );
-#endif
- st_ivas->hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->hDecoderConfig->output_config );
- }
-#endif
-
test();
IF( st_ivas->ini_frame > 0 && EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
{
@@ -775,7 +992,11 @@ ivas_error ivas_dec_setup(
move16();
}
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_sba_dec_reconfigure_fx( st_ivas ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_sba_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -796,11 +1017,8 @@ ivas_error ivas_dec_setup(
move16();
nchan_ism = 1;
move16();
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- k = extract_l( L_sub( L_sub( res_dec, 1 ), SID_FORMAT_NBITS ) );
- move16();
-
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ k = sub( sub( k, 1 ), SID_FORMAT_NBITS );
WHILE( st_ivas->bit_stream[k] && ( nchan_ism < MAX_NUM_OBJECTS ) )
{
nchan_ism = add( nchan_ism, 1 );
@@ -816,6 +1034,7 @@ ivas_error ivas_dec_setup(
st_ivas->nchan_ism = nchan_ism;
move16();
+
/* read ism_mode */
st_ivas->ism_mode = ISM_MODE_DISC;
move32();
@@ -834,7 +1053,11 @@ ivas_error ivas_dec_setup(
move32();
}
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_ism_dec_config_fx( st_ivas, last_ism_mode ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_ism_dec_config_fx( st_ivas, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -859,18 +1082,6 @@ ivas_error ivas_dec_setup(
}
}
- /*-----------------------------------------------------------------*
- * reconfig split rendering as renderer might change after bitrate switching
- *-----------------------------------------------------------------*/
-
- IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
- {
- if ( ( error = ivas_dec_reconfig_split_rend( st_ivas ) ) != IVAS_ERR_OK )
- {
- return error;
- }
- }
-
/*----------------------------------------------------------------*
* Reset bitstream pointers
*----------------------------------------------------------------*/
@@ -1000,10 +1211,19 @@ static ivas_error ivas_read_format(
move16();
st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[( *num_bits_read ) + 1 + SBA_PLANAR_BITS], 1 ) );
move16();
- if ( st_ivas->sba_order == 0 )
+ IF( st_ivas->sba_order == 0 )
{
st_ivas->ivas_format = SBA_ISM_FORMAT;
move32();
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ /* read the real Ambisonic order when the above bits are used to signal OSBA format */
+ IF( LE_32( ivas_total_brate, IVAS_24k4 ) )
+ {
+ st_ivas->sba_order = st_ivas->bit_stream[add( *num_bits_read, 2 + SBA_PLANAR_BITS + SBA_ORDER_BITS )];
+ st_ivas->sba_order = add( st_ivas->sba_order, shl( st_ivas->bit_stream[add( *num_bits_read, 1 + SBA_PLANAR_BITS + SBA_ORDER_BITS )], 1 ) );
+ }
+#endif
}
}
( *num_bits_read ) = add( ( *num_bits_read ), 1 );
@@ -1038,10 +1258,6 @@ static ivas_error ivas_read_format(
st_ivas->ivas_format = ISM_FORMAT;
move32();
BREAK;
- case SID_MULTICHANNEL:
- st_ivas->ivas_format = MC_FORMAT;
- move32();
- BREAK;
case SID_SBA_1TC:
st_ivas->ivas_format = SBA_FORMAT;
move32();
@@ -1063,9 +1279,8 @@ static ivas_error ivas_read_format(
case SID_MASA_2TC:
st_ivas->ivas_format = MASA_FORMAT;
move32();
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- IF( EQ_32( st_ivas->bit_stream[res_dec - 1], 1 ) )
+ k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ IF( EQ_32( st_ivas->bit_stream[k - 1], 1 ) )
{
st_ivas->element_mode_init = IVAS_CPE_MDCT;
move16();
@@ -1077,13 +1292,11 @@ static ivas_error ivas_read_format(
}
BREAK;
default:
- /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format );
}
IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
{
-#ifdef NONBE_FIX_1052_SBA_EXT
/* read Ambisonic (SBA) planar flag */
st_ivas->sba_planar = st_ivas->bit_stream[*num_bits_read];
move16();
@@ -1097,7 +1310,7 @@ static ivas_error ivas_read_format(
move16();
*num_bits_read = add( *num_bits_read, SBA_ORDER_BITS );
move16();
-#endif
+
if ( st_ivas->sba_analysis_order == 0 )
{
st_ivas->sba_analysis_order = SBA_FOA_ORDER;
@@ -1195,11 +1408,13 @@ void copy_decoder_config(
return;
}
+
/*-------------------------------------------------------------------*
* ivas_init_decoder_front()
*
* Set decoder parameters to initial values
*-------------------------------------------------------------------*/
+
ivas_error ivas_init_decoder_front(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
)
@@ -1216,6 +1431,8 @@ ivas_error ivas_init_decoder_front(
move16();
st_ivas->nCPE = 0;
move16();
+ st_ivas->nchan_ism = 0;
+ move16();
st_ivas->nCPE_old = 0;
move16();
st_ivas->nchan_transport = -1;
@@ -1264,6 +1481,7 @@ ivas_error ivas_init_decoder_front(
return error;
}
}
+
/*-------------------------------------------------------------------*
* Allocate and initialize external orientation handle
*--------------------------------------------------------------------*/
@@ -1279,6 +1497,7 @@ ivas_error ivas_init_decoder_front(
/*-------------------------------------------------------------------*
* Allocate and initialize combined orientation handle
*--------------------------------------------------------------------*/
+
test();
IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
{
@@ -1288,6 +1507,7 @@ ivas_error ivas_init_decoder_front(
}
}
+#ifndef FIX_CREND_SIMPLIFY_CODE
/*-------------------------------------------------------------------*
* Allocate HRTF binary handle
*--------------------------------------------------------------------*/
@@ -1298,7 +1518,6 @@ ivas_error ivas_init_decoder_front(
{
return error;
}
-
IF( NE_32( ( error = ivas_HRTF_CRend_binary_open_fx( &( st_ivas->hSetOfHRTF ) ) ), IVAS_ERR_OK ) )
{
return error;
@@ -1314,21 +1533,26 @@ ivas_error ivas_init_decoder_front(
return error;
}
- IF( NE_32( ( error = ivas_HRTF_statistics_binary_open( &st_ivas->hHrtfStatistics ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_HRTF_statistics_binary_open_fx( &st_ivas->hHrtfStatistics ) ), IVAS_ERR_OK ) )
{
return error;
}
}
-
+#endif
/*-------------------------------------------------------------------*
* Allocate and initialize Binaural Renderer configuration handle
*--------------------------------------------------------------------*/
+
+ test();
+ test();
+ test();
+ test();
test();
test();
IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ||
( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) )
{
- IF( NE_32( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_render_config_open_fx( &( st_ivas->hRenderConfig ) ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1356,12 +1580,8 @@ ivas_error ivas_init_decoder_fx(
Word16 sce_id, cpe_id;
Word16 numCldfbAnalyses, numCldfbSyntheses;
Word16 granularity, n_channels_transport_jbm;
- Word32 output_Fs, ivas_total_brate;
-#ifdef NONBE_FIX_MC_LFE_LPF
+ Word32 output_Fs, ivas_total_brate, tmp_br, tmp32;
Word32 delay_ns;
-#else
- Word32 binauralization_delay_ns;
-#endif
AUDIO_CONFIG output_config;
DECODER_CONFIG_HANDLE hDecoderConfig;
ivas_error error;
@@ -1379,16 +1599,16 @@ ivas_error ivas_init_decoder_fx(
move32();
st_ivas->last_active_ivas_total_brate = ivas_total_brate;
move32();
+
/*-----------------------------------------------------------------*
* Set number of output channels for EXTERNAL output config.
*-----------------------------------------------------------------*/
+ test();
+ test();
IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
test();
-#endif
-#ifdef FIX_1052_EXT_OUTPUT
IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
{
hDecoderConfig->nchan_out = CPE_CHANNELS;
@@ -1397,25 +1617,14 @@ ivas_error ivas_init_decoder_fx(
{
hDecoderConfig->nchan_out = audioCfg2channels( st_ivas->transport_config );
}
- ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
-#else
- IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
-#endif
+ ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
{
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
hDecoderConfig->nchan_out = audioCfg2channels( ivas_set_audio_config_from_sba_order( st_ivas->sba_order ) );
-#else
- hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
-#endif
move16();
hDecoderConfig->nchan_out = add( hDecoderConfig->nchan_out, st_ivas->nchan_ism );
move16();
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_FORMAT ) )
-#else
- ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
-#endif
{
hDecoderConfig->nchan_out = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
move16();
@@ -1437,27 +1646,23 @@ ivas_error ivas_init_decoder_fx(
st_ivas->intern_config = output_config;
move32();
-#ifdef FIX_1052_EXT_OUTPUT
+ test();
+ test();
IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
{
ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->transport_config );
st_ivas->intern_config = st_ivas->transport_config;
move32();
}
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
+ ELSE IF( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && ( st_ivas->ivas_format == SBA_ISM_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) )
{
st_ivas->intern_config = ivas_set_audio_config_from_sba_order( st_ivas->sba_order );
ivas_output_init( &( st_ivas->hOutSetup ), st_ivas->intern_config );
}
-#endif
ELSE
{
ivas_output_init( &( st_ivas->hOutSetup ), output_config );
}
-#else
- ivas_output_init( &( st_ivas->hOutSetup ), output_config );
-#endif
test();
IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
@@ -1471,20 +1676,6 @@ ivas_error ivas_init_decoder_fx(
st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config );
move16();
}
-#ifndef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- test();
- IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
- {
- st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER;
- move32();
- st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA3;
- move32();
- st_ivas->hOutSetup.output_config = IVAS_AUDIO_CONFIG_HOA3;
- move32();
- st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 );
- move16();
- }
-#endif
/* Only initialize transport setup if it is used */
IF( NE_32( st_ivas->transport_config, IVAS_AUDIO_CONFIG_INVALID ) )
@@ -1552,27 +1743,13 @@ ivas_error ivas_init_decoder_fx(
}
}
-
/*--------------------------------------------------------------------*
* Allocate and initialize HRTF Statistics handle
*--------------------------------------------------------------------*/
IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
{
- IF( NE_32( ( error = ivas_HRTF_statistics_init( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
-
- /*-----------------------------------------------------------------*
- * Initialize binuaral split rendering
- *-----------------------------------------------------------------*/
-
- IF( st_ivas->hSplitBinRend != NULL && ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ||
- ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hDecoderConfig->Opt_non_diegetic_pan && EQ_16( st_ivas->hRenderConfig->split_rend_config.dof, 0 ) ) ) )
- {
- IF( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK )
+ IF( NE_32( ( error = ivas_HRTF_statistics_init_fx( &st_ivas->hHrtfStatistics, output_Fs ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1713,14 +1890,6 @@ ivas_error ivas_init_decoder_fx(
return error;
}
set16_fx( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 0, CLDFB_NO_COL_MAX );
- test();
- IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup )
- {
- IF( NE_32( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
Word16 hodirac_flag = ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order );
IF( hodirac_flag )
@@ -1738,10 +1907,10 @@ ivas_error ivas_init_decoder_fx(
}
}
-
test();
test();
- IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) )
+ test();
+ IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) )
{
IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ), IVAS_ERR_OK ) )
{
@@ -1771,11 +1940,11 @@ ivas_error ivas_init_decoder_fx(
}
st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );
move16();
+
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, res_dec ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1783,11 +1952,11 @@ ivas_error ivas_init_decoder_fx(
reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] );
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, (res_dec) *CPE_CHANNELS ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1799,13 +1968,11 @@ ivas_error ivas_init_decoder_fx(
}
/* create CPE element for DFT Stereo like upmix */
+ iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
test();
IF( st_ivas->sba_dirac_stereo_flag && ( st_ivas->nCPE == 0 ) )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );
-
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1853,11 +2020,10 @@ ivas_error ivas_init_decoder_fx(
}
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, res_dec ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_sce_dec( st_ivas, sce_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1865,11 +2031,11 @@ ivas_error ivas_init_decoder_fx(
reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] );
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1903,15 +2069,6 @@ ivas_error ivas_init_decoder_fx(
return error;
}
- test();
- IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_DEC ) && st_ivas->hOutSetup.is_loudspeaker_setup )
- {
- IF( NE_32( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
-
Word16 hodirac_flag = ivas_get_hodirac_flag_fx( ivas_total_brate, st_ivas->sba_analysis_order );
IF( hodirac_flag )
{
@@ -1928,7 +2085,6 @@ ivas_error ivas_init_decoder_fx(
}
}
-
test();
test();
IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) )
@@ -1976,26 +2132,21 @@ ivas_error ivas_init_decoder_fx(
{
st_ivas->nCPE_old = st_ivas->nCPE;
move16();
-#ifdef NONBE_FIX_ISM_XOVER_BR
{
Word16 n_all;
n_all = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
st_ivas->nCPE = shr( add( n_all, 1 ), 1 );
}
-#else
- st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) );
- move16();
-#endif
st_ivas->element_mode_init = IVAS_CPE_MDCT;
move16();
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2007,12 +2158,11 @@ ivas_error ivas_init_decoder_fx(
}
/* create CPE element for DFT Stereo like upmix */
+ iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
test();
IF( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2066,6 +2216,7 @@ ivas_error ivas_init_decoder_fx(
{
k = add( k, 1 );
}
+
test();
IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
{
@@ -2176,11 +2327,12 @@ ivas_error ivas_init_decoder_fx(
move16();
st_ivas->element_mode_init = IVAS_CPE_MDCT;
move16();
+
+ iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2223,11 +2375,13 @@ ivas_error ivas_init_decoder_fx(
st_ivas->element_mode_init = IVAS_CPE_MDCT;
move16();
+
+ iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, sub( st_ivas->nchan_transport, 1 ), &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, L_shl( res_dec, 1 ) ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
+
{
return error;
}
@@ -2260,12 +2414,11 @@ ivas_error ivas_init_decoder_fx(
st_ivas->hParamMC->proto_matrix_int_e = 0;
move16();
+
+ iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );
-
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2344,7 +2497,6 @@ ivas_error ivas_init_decoder_fx(
}
}
-
ivas_mcmasa_split_brate_fx( st_ivas->hOutSetup.separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe );
FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
@@ -2373,11 +2525,10 @@ ivas_error ivas_init_decoder_fx(
}
/* create CPE element for DFT Stereo like upmix */
+ iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &tmp_br, &tmp32, 0 );
IF( st_ivas->sba_dirac_stereo_flag )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nSCE, st_ivas->nCPE ), &res_dec, &res_frac, 0 );
- IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = create_cpe_dec( st_ivas, cpe_id, tmp_br ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2399,7 +2550,6 @@ ivas_error ivas_init_decoder_fx(
}
}
-
/*-----------------------------------------------------------------*
* Allocate and initialize HP20 filter memories
*-----------------------------------------------------------------*/
@@ -2455,11 +2605,7 @@ ivas_error ivas_init_decoder_fx(
}
}
-#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
-#endif
{
return error;
}
@@ -2537,9 +2683,21 @@ ivas_error ivas_init_decoder_fx(
}
}
- IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config,
- st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ),
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ Word16 num_poses = 1;
+ move16();
+ if ( st_ivas->hSplitBinRend != NULL )
+ {
+ num_poses = st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses;
+ move16();
+ }
+
+ IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, num_poses ) ), IVAS_ERR_OK ) )
+#else
+ IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config,
+ st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ),
IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -2551,10 +2709,8 @@ ivas_error ivas_init_decoder_fx(
IF( ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) && ( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) )
{
granularity = NS2SA_FX2( output_Fs, CLDFB_SLOT_NS );
-
n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );
-
IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ), IVAS_ERR_OK ) )
{
return error;
@@ -2581,10 +2737,12 @@ ivas_error ivas_init_decoder_fx(
/* Allocate TD renderer for the objects in DISC mode */
Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
Word16 num_src;
+
IF( NE_32( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, &num_src ) ), IVAS_ERR_OK ) )
{
return error;
}
+
Word16 nchan_rend = num_src;
move16();
test();
@@ -2604,6 +2762,7 @@ ivas_error ivas_init_decoder_fx(
SrcSpatial_p->q_Pos_p = Q31;
move16();
}
+
IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
{
IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
@@ -2612,52 +2771,48 @@ ivas_error ivas_init_decoder_fx(
}
}
- /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
- IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) )
+ /* Allocate memory for delay buffer within 'hMasaIsmData' */
+ IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
- IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) )
+
+ test();
+ test();
+ test();
+ IF( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && ( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
{
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
- error = ivas_omasa_render_objects_from_mix_open_fx( st_ivas );
- move32();
-
- IF( NE_32( error, IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
- error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, DIRAC_OPEN, 0,
- st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, 0, 0 );
- move32();
-
- IF( NE_32( error, IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
}
- IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) )
+ IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) )
{
- /* Allocate 'hIsmRendererData' handle */
- error = ivas_omasa_combine_separate_ism_with_masa_open_fx( st_ivas );
- move32();
- IF( NE_32( error, IVAS_ERR_OK ) )
+ /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
+ IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+
+ IF( ( ( error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, DIRAC_OPEN, 0, st_ivas->ivas_format, st_ivas->mc_mode, output_Fs, 0, 0 ) ), IVAS_ERR_OK ) )
{
return error;
}
}
-#endif
- test();
- test();
- test();
- IF( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && ( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
+
+ IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) )
{
- /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
- IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) )
+ /* Allocate 'hIsmRendererData' handle */
+ IF( ( ( error = ivas_omasa_combine_separate_ism_with_masa_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2737,44 +2892,6 @@ ivas_error ivas_init_decoder_fx(
}
}
-
-#ifndef NONBE_FIX_MC_LFE_LPF
- /*-----------------------------------------------------------------*
- * LFE handles for rendering after rendering to adjust LFE delay to binaural filter delay
- * LFE handles for rendering after rendering to adjust LFE delay to filter delay
- *-----------------------------------------------------------------*/
- test();
- IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
- {
- binauralization_delay_ns = st_ivas->binaural_latency_ns;
- move32();
- IF( st_ivas->hBinRenderer != NULL )
- {
- IF( st_ivas->hBinRenderer->render_lfe )
- {
- IF( NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
- {
- /* Account for filterbank delay */
- binauralization_delay_ns = L_add( binauralization_delay_ns, IVAS_FB_DEC_DELAY_NS );
- }
- }
- ELSE
- {
- binauralization_delay_ns = 0;
- move32();
- }
- }
-
- IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, output_Fs, binauralization_delay_ns ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
-
- set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN );
- set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k );
- }
-#endif
-
/*-----------------------------------------------------------------*
* CLDFB handles for rendering
*-----------------------------------------------------------------*/
@@ -2831,14 +2948,21 @@ ivas_error ivas_init_decoder_fx(
move16();
}
-#ifdef NONBE_FIX_MC_LFE_LPF
/*-----------------------------------------------------------------*
* LFE handles for rendering after rendering to adjust LFE delay to filter delay
*-----------------------------------------------------------------*/
+
test();
IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
{
- delay_ns = st_ivas->binaural_latency_ns;
+ IF( NE_16( st_ivas->hIntSetup.index_lfe[0], -1 ) )
+ {
+ delay_ns = st_ivas->binaural_latency_ns;
+ }
+ ELSE
+ {
+ delay_ns = 0;
+ }
move32();
IF( st_ivas->hBinRenderer != NULL )
{
@@ -2872,7 +2996,6 @@ ivas_error ivas_init_decoder_fx(
set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN );
set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k );
}
-#endif
/*-----------------------------------------------------------------*
* Allocate and initialize limiter struct
@@ -2888,7 +3011,6 @@ ivas_error ivas_init_decoder_fx(
*-----------------------------------------------------------------*/
IF( st_ivas->hTcBuffer == NULL )
-
{
/* no module has yet open the TC buffer, open a default one */
n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );
@@ -2899,16 +3021,9 @@ ivas_error ivas_init_decoder_fx(
}
}
- IF( st_ivas->hTcBuffer == NULL )
- {
- /* we need the handle anyway, but without the buffer*/
- IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
test();
- IF( st_ivas->hJbmMetadata == NULL && st_ivas->hDecoderConfig->Opt_tsm )
+ test();
+ IF( ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && st_ivas->hDecoderConfig->Opt_tsm )
{
IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
@@ -2922,8 +3037,7 @@ ivas_error ivas_init_decoder_fx(
/*-----------------------------------------------------------------*
* Allocate floating-point output audio buffers
*-----------------------------------------------------------------*/
- st_ivas->p_out_len = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
- move16();
+
FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
{
/* note: these are intra-frame heap memories */
@@ -2933,14 +3047,15 @@ ivas_error ivas_init_decoder_fx(
}
set32_fx( st_ivas->p_output_fx[n], 0, 48000 / FRAMES_PER_SEC );
}
-
FOR( ; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ )
{
st_ivas->p_output_fx[n] = NULL;
}
+
return error;
}
+
/*-------------------------------------------------------------------------
* destroy_core_dec()
*
@@ -3160,7 +3275,11 @@ void ivas_initialize_handles_dec(
st_ivas->hMonoDmxRenderer = NULL;
st_ivas->hCrendWrapper = NULL;
st_ivas->hReverb = NULL;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ st_ivas->hHrtfCrend = NULL;
+#else
st_ivas->hSetOfHRTF = NULL;
+#endif
st_ivas->hHrtfFastConv = NULL;
st_ivas->hHrtfParambin = NULL;
st_ivas->hHrtfStatistics = NULL;
@@ -3291,8 +3410,8 @@ void ivas_destroy_dec_fx(
}
/* MASA decoder structure */
-
ivas_masa_dec_close_fx( &( st_ivas->hMasa ) );
+
/* Qmetadata handle */
ivas_qmetadata_close_fx( &st_ivas->hQMetaData );
@@ -3313,6 +3432,7 @@ void ivas_destroy_dec_fx(
/* VBAP handle */
vbap_free_data_fx( &( st_ivas->hVBAPdata ) );
+
/* Fastconv binaural renderer handle */
ivas_binRenderer_close_fx( &st_ivas->hBinRenderer );
@@ -3327,17 +3447,21 @@ void ivas_destroy_dec_fx(
}
/* Parametric binaural renderer handle */
- ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
+ ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
/* Crend handle */
- ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ) );
+#else
+ ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
+#endif
/* Reverb handle */
- ivas_reverb_close( &st_ivas->hReverb );
+ ivas_reverb_close_fx( &st_ivas->hReverb );
/* LS config converter handle */
-
ivas_ls_setup_conversion_close_fx( &st_ivas->hLsSetUpConversion );
+
/* Custom LS configuration handle */
IF( st_ivas->hLsSetupCustom != NULL )
{
@@ -3349,11 +3473,11 @@ void ivas_destroy_dec_fx(
ivas_mono_dmx_renderer_close( &st_ivas->hMonoDmxRenderer );
/* OSBA structure */
-
ivas_osba_data_close_fx( &st_ivas->hSbaIsmData );
/* OMASA structure */
ivas_omasa_data_close_fx( &st_ivas->hMasaIsmData );
+
/* Head track data handle */
ivas_headTrack_close_fx( &st_ivas->hHeadTrackData );
@@ -3368,17 +3492,27 @@ void ivas_destroy_dec_fx(
{
ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd );
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IF( st_ivas->hHrtfTD != NULL )
+#else
ELSE IF( st_ivas->hHrtfTD != NULL )
+#endif
{
BSplineModelEvalDealloc_fx( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval );
+
ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD );
}
/* CRend binaural renderer handle */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ ivas_HRTF_CRend_binary_close_fx( &st_ivas->hHrtfCrend );
+#else
ivas_HRTF_CRend_binary_close_fx( &st_ivas->hSetOfHRTF );
+#endif
/* Fastconv HRTF memories */
- ivas_binaural_hrtf_close( &st_ivas->hHrtfFastConv );
+ ivas_binaural_hrtf_close_fx( &st_ivas->hHrtfFastConv );
/* Fastconv HRTF filters */
ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv );
@@ -3387,10 +3521,10 @@ void ivas_destroy_dec_fx(
ivas_HRTF_parambin_binary_close_fx( &st_ivas->hHrtfParambin );
/* HRTF statistics */
- ivas_HRTF_statistics_close( &st_ivas->hHrtfStatistics );
+ ivas_HRTF_statistics_close_fx( &st_ivas->hHrtfStatistics );
/* Config. Renderer */
- ivas_render_config_close( &( st_ivas->hRenderConfig ) );
+ ivas_render_config_close_fx( &( st_ivas->hRenderConfig ) );
/* Limiter struct */
ivas_limiter_close_fx( &( st_ivas->hLimiter ) );
@@ -3673,7 +3807,6 @@ void ivas_init_dec_get_num_cldfb_instances_fx(
move16();
}
BREAK;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
case RENDERER_OMASA_OBJECT_EXT:
*numCldfbAnalyses = st_ivas->nchan_transport;
*numCldfbSyntheses = st_ivas->hDecoderConfig->nchan_out;
@@ -3685,7 +3818,6 @@ void ivas_init_dec_get_num_cldfb_instances_fx(
*numCldfbSyntheses = 0;
move16();
BREAK;
-#endif
default:
assert( 0 && "Renderer not handled for CLDFB reservation." );
}
@@ -3762,17 +3894,12 @@ static ivas_error doSanityChecks_IVAS(
test();
test();
test();
-#ifdef FIX_1052_EXT_OUTPUT
test();
IF( NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#else
- IF( NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
-#endif
{
return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Wrong output configuration specified for Stereo!" );
}
}
-#ifdef FIX_1052_EXT_OUTPUT
/* Verify output configuration for other formats */
ELSE
{
@@ -3781,40 +3908,6 @@ static ivas_error doSanityChecks_IVAS(
return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified!" );
}
}
-#else
- ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
- {
- /* Verify ISM output configuration */
- IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) )
- {
- return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for ISM" );
- }
- }
- ELSE IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
- {
- /* Verify SBA output coniguration */
- IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) )
- {
- return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for SBA" );
- }
- }
- ELSE IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) )
- {
- IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) )
- {
- return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for MASA!" );
- }
- }
- ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
- {
- /* Verify MC output configuration */
- test();
- IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_INVALID ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
- {
- return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for Multi-channel" );
- }
- }
-#endif
IF( ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) && NE_32( output_Fs, 48000 ) )
{
@@ -3858,17 +3951,5 @@ static ivas_error doSanityChecks_IVAS(
}
}
-#ifndef NONBE_FIX_984_OMASA_EXT_OUTPUT
- IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
- {
- test();
- IF( NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
- {
-
- return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" );
- }
- }
-#endif
-
return IVAS_ERR_OK;
}
diff --git a/lib_dec/ivas_ism_dec_fx.c b/lib_dec/ivas_ism_dec_fx.c
index a4588aadf78c953607bc9be9a7dd9d5b15eb80b3..63609317d01f7e41b5a51b96064e694003afe690 100644
--- a/lib_dec/ivas_ism_dec_fx.c
+++ b/lib_dec/ivas_ism_dec_fx.c
@@ -48,9 +48,12 @@
static ivas_error ivas_ism_bitrate_switching_dec_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
const Word16 nchan_transport_old, /* i : last number of transport channels */
- const ISM_MODE last_ism_mode, /* i : last ISM mode */
- UWord16 *nSamplesRendered, /* o : number of samples rendered */
- Word16 *data /* o : output synthesis signal Q0*/
+ const ISM_MODE last_ism_mode /* i : last ISM mode */
+#ifndef FIX_HRTF_LOAD
+ ,
+ UWord16 *nSamplesRendered, /* o : number of samples rendered */
+ Word16 *data /* o : output synthesis signal Q0*/
+#endif
)
{
ivas_error error;
@@ -62,12 +65,16 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
Word16 tc_nchan_allocate_new;
Word16 tc_granularity_new;
Word16 nchan_out_buff, nchan_out_buff_old;
+#ifndef FIX_HRTF_LOAD
AUDIO_CONFIG intern_config_old;
IVAS_OUTPUT_SETUP hIntSetupOld;
RENDERER_TYPE renderer_type_old;
+#endif
+#ifndef FIX_HRTF_LOAD
error = IVAS_ERR_OK;
move32();
+#endif
nCPE_old = st_ivas->nCPE;
move16();
nSCE_old = st_ivas->nSCE;
@@ -109,11 +116,14 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
/*-----------------------------------------------------------------*
* HP20 memories
*-----------------------------------------------------------------*/
+
IF( NE_32( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_transport_old ) ), IVAS_ERR_OK ) )
{
return error;
}
+
+#ifndef FIX_HRTF_LOAD
/* save old IntSetup, might be needed for JBM flushing...*/
intern_config_old = st_ivas->intern_config;
move32();
@@ -123,7 +133,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
move16();
renderer_type_old = st_ivas->renderer_type;
move32();
-
+#endif
/*-----------------------------------------------------------------*
* Initialize the needed renderer struct and destroy the unnecessary renderer struct
*-----------------------------------------------------------------*/
@@ -139,7 +149,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config );
}
+#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
{
+#endif
test();
test();
/* transfer subframe info from DirAC or ParamMC to central tc buffer */
@@ -163,10 +175,26 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
{
- IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
+#ifdef FIX_HRTF_LOAD
+ /* flush already done in IVAS_DEC_ReadFormat() */
+#else
+#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
+ /* write back info for correct rendering of the flushable samples */
+ int16_t nchan_transport_ref = st_ivas->nchan_transport;
+ st_ivas->nchan_transport = nchan_transport_old;
+ move16();
+
+#endif
+ IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
+
+ st_ivas->nchan_transport = nchan_transport_ref;
+ move16();
+#endif
+#endif
}
/* JBM: when granularity goes up set samples to discard at the beginning of the frame */
ELSE IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
@@ -176,7 +204,9 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
return error;
}
}
+#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
}
+#endif
IF( NE_16( st_ivas->ism_mode, last_ism_mode ) )
{
@@ -199,7 +229,8 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
/* close the parametric binaural renderer */
- ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
+ ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
+
/* Open the TD Binaural renderer */
test();
IF( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL )
@@ -232,10 +263,14 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
{
/* close the parametric binaural renderer */
- ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
+ ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
/* Open Crend Binaural renderer */
- IF( NE_32( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) )
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) )
+#else
+ IF( NE_32( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ), IVAS_ERR_OK ) )
+#endif
st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
move32();
@@ -261,11 +296,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
return error;
}
-#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
-#endif
{
return error;
}
@@ -275,7 +306,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
{
- ivas_reverb_close( &st_ivas->hReverb );
+ ivas_reverb_close_fx( &st_ivas->hReverb );
}
}
ELSE
@@ -292,17 +323,17 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
return error;
}
-#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
-#endif
{
return error;
}
/* close the crend binaural renderer */
- ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ) );
+#else
+ ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
+#endif
}
}
@@ -319,19 +350,26 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
* floating-point output audio buffers
*-----------------------------------------------------------------*/
+#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
{
+#endif
nchan_out_buff = ivas_get_nchan_buffers_dec_fx( st_ivas, -1, -1 );
IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) )
{
return error;
}
+#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
}
+#endif
/*-----------------------------------------------------------------*
* JBM TC buffers
*-----------------------------------------------------------------*/
+
+#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
{
+#endif
Word16 tc_nchan_full_new;
DECODER_TC_BUFFER_HANDLE hTcBuffer;
@@ -380,11 +418,18 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
}
+#ifndef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
}
+#endif
+#ifdef FIX_HRTF_LOAD
+ return IVAS_ERR_OK;
+#else
return error;
+#endif
}
+
/*-------------------------------------------------------------------------
* ivas_ism_dec_config()
*
@@ -393,18 +438,23 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
*-------------------------------------------------------------------------*/
ivas_error ivas_ism_dec_config_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const ISM_MODE last_ism_mode, /* i/o: last ISM mode */
- UWord16 *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */
- Word16 *data /* o : output synthesis signal Q0*/
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const ISM_MODE last_ism_mode /* i/o: last ISM mode */
+#ifndef FIX_HRTF_LOAD
+ ,
+ UWord16 *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */
+ Word16 *data /* o : output synthesis signal Q0*/
+#endif
)
{
Word32 ivas_total_brate;
ivas_error error;
Word16 nchan_transport_old;
+#ifndef FIX_HRTF_LOAD
error = IVAS_ERR_OK;
move32();
+#endif
ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
move32();
/* Assumes that num of input objects are constant */
@@ -443,9 +493,14 @@ ivas_error ivas_ism_dec_config_fx(
{
/* ISM bit-rate switching */
test();
- IF( ( NE_16( st_ivas->ism_mode, last_ism_mode ) ) || ( NE_32( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) )
+ IF( ( NE_16( st_ivas->ism_mode, last_ism_mode ) ) || ( NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) )
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode ) ), IVAS_ERR_OK ) )
+
+#else
IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -470,7 +525,11 @@ ivas_error ivas_ism_dec_config_fx(
/* ISM mode switching */
IF( NE_32( st_ivas->ism_mode, last_ism_mode ) )
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode ) ), IVAS_ERR_OK ) )
+#else
IF( NE_16( ( error = ivas_ism_bitrate_switching_dec_fx( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -500,5 +559,10 @@ ivas_error ivas_ism_dec_config_fx(
move32();
BREAK;
}
+
+#ifdef FIX_HRTF_LOAD
+ return IVAS_ERR_OK;
+#else
return error;
+#endif
}
diff --git a/lib_dec/ivas_ism_metadata_dec_fx.c b/lib_dec/ivas_ism_metadata_dec_fx.c
index 17bc36346f7f6efd58cdafdbbf5095f71e52c5cd..2c13e25c8a82c193a3011c50d6e41ca0da6fe483 100644
--- a/lib_dec/ivas_ism_metadata_dec_fx.c
+++ b/lib_dec/ivas_ism_metadata_dec_fx.c
@@ -35,7 +35,6 @@
#include "ivas_cnst.h"
#include "ivas_prot_fx.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "prot_fx.h"
#include "ivas_stat_enc.h"
#include
@@ -46,6 +45,7 @@
/*-----------------------------------------------------------------------*
* Local functions
*-----------------------------------------------------------------------*/
+
static void decode_angle_indices_fx( DEC_CORE_HANDLE st0, ISM_METADATA_ANGLE_HANDLE angle, const Word16 non_diegetic_flag, Word16 *flag_abs_azimuth );
static Word16 decode_radius_fx( DEC_CORE_HANDLE st0, Word16 *last_radius_idx, Word16 *flag_abs_radius );
@@ -176,7 +176,7 @@ ivas_error ivas_ism_metadata_dec_fx(
Word16 *ism_extmeta_cnt, /* i/o: Number of change frames observed */
DEC_CORE_HANDLE st0 ) /* i : core-coder handle */
{
- Word16 ch, nb_bits_start = 0, last_bit_pos;
+ Word16 k, ch, nb_bits_start = 0, last_bit_pos;
Word16 idx_radius;
Word32 element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS];
Word16 ism_extmeta_bitstream;
@@ -198,7 +198,6 @@ ivas_error ivas_ism_metadata_dec_fx(
Word16 nbands, nblocks;
Word16 md_diff_flag[MAX_NUM_OBJECTS];
ivas_error error;
- Word32 res_dec, res_frac;
move16();
push_wmops( "ism_meta_dec" );
@@ -208,8 +207,8 @@ ivas_error ivas_ism_metadata_dec_fx(
move16();
nchan_transport_prev = *nchan_transport;
move16();
- iDiv_and_mod_32( ism_total_brate, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- last_bit_pos = extract_l( L_sub( res_dec, 1 ) );
+ k = extract_l( Mpy_32_32_r( ism_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ last_bit_pos = sub( k, 1 );
bstr_orig = st0->bit_stream;
next_bit_pos_orig = st0->next_bit_pos;
move16();
@@ -1307,9 +1306,7 @@ void ivas_ism_metadata_sid_dec_fx(
}
/* take into account padding bits as metadata bits to keep later bitrate checks valid */
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( IVAS_SID_5k2 - SID_2k40, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- nb_bits_metadata[*sce_id_dtx] = (Word16) res_dec;
+ nb_bits_metadata[*sce_id_dtx] = extract_l( Mpy_32_32_r( IVAS_SID_5k2 - SID_2k40, ONE_BY_FRAMES_PER_SEC_Q31 ) );
move16();
/* set the bitstream pointer to its original position */
diff --git a/lib_dec/ivas_ism_param_dec_fx.c b/lib_dec/ivas_ism_param_dec_fx.c
index aa778fd2da0373b23f96dbc92030b9987b27a783..973d726b0b8a8f54d4236c3cec4d7842d0269f24 100644
--- a/lib_dec/ivas_ism_param_dec_fx.c
+++ b/lib_dec/ivas_ism_param_dec_fx.c
@@ -42,14 +42,14 @@
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#include "debug.h"
-#include "ivas_rom_com_fx.h"
+
/*-----------------------------------------------------------------------*
* Local function definitions
*-----------------------------------------------------------------------*/
static void ivas_param_ism_dec_dequant_DOA_fx(
- PARAM_ISM_DEC_HANDLE hParamIsmDec, /* i/o: decoder ParamISM handle */
+ PARAM_ISM_DEC_HANDLE hParamIsmDec, /* i/o: decoder ParamISM handle */
const Word16 nchan_ism /* i : number of ISM channels */
)
{
@@ -926,22 +926,25 @@ void ivas_ism_dec_digest_tc_fx(
EQ_32( st_ivas->renderer_type, RENDERER_OSBA_STEREO ) ||
( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) && st_ivas->hDecoderConfig->Opt_Headrotation == 0 ) )
{
- int16_t i;
+ Word16 i;
Word32 azimuth_fx, elevation_fx;
/* we have a full frame interpolator, adapt it */
/* for BE testing */
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- IF( EQ_32( extract_l( res_dec ), st_ivas->hTcBuffer->n_samples_available ) )
+ i = extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ IF( EQ_16( i, st_ivas->hTcBuffer->n_samples_available ) )
{
- Word16 interpolator_length = extract_l( res_dec );
+ Word16 interpolator_length = i;
+ test();
+ test();
+ test();
test();
test();
IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ||
EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) ||
- EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) )
+ EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
+ ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) )
{
st_ivas->hIsmRendererData->interpolator_fx[0] = 0;
move16();
@@ -966,6 +969,8 @@ void ivas_ism_dec_digest_tc_fx(
ivas_jbm_dec_get_adapted_linear_interpolator_fx( extract_l( Mpy_32_32( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), st_ivas->hTcBuffer->n_samples_available, st_ivas->hIsmRendererData->interpolator_fx );
move16();
}
+ st_ivas->hIsmRendererData->interp_offset_fx = 0;
+ move16();
/* also get the gains here */
FOR( i = 0; i < st_ivas->nchan_ism; i++ )
@@ -974,27 +979,47 @@ void ivas_ism_dec_digest_tc_fx(
IF( EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_STEREO ) )
{
+#ifdef OBJ_EDITING_API
Word16 gains_fx[2];
ivas_ism_get_stereo_gains_fx( (Word16) L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, 22 ), (Word16) L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, 22 ), &gains_fx[0], &gains_fx[1] );
st_ivas->hIsmRendererData->gains_fx[i][0] = L_shr( L_deposit_h( gains_fx[0] ), 1 ); // Q31 -> Q30
move32();
st_ivas->hIsmRendererData->gains_fx[i][1] = L_shr( L_deposit_h( gains_fx[1] ), 1 ); // Q31 -> Q30
move32();
+ // TODO: Enable gain editing feature
+ // v_multc_fixed( st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hIsmMetaData[i]->edited_gain_fx, st_ivas->hIsmRendererData->gains_fx[i], CPE_CHANNELS ); // Q30, Q30 --> Q30
+#else
+ Word16 gains_fx[2];
+ ivas_ism_get_stereo_gains_fx( (Word16) L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, 22 ), (Word16) L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, 22 ), &gains_fx[0], &gains_fx[1] );
+ st_ivas->hIsmRendererData->gains_fx[i][0] = L_shr( L_deposit_h( gains_fx[0] ), 1 ); // Q31 -> Q30
+ move32();
+ st_ivas->hIsmRendererData->gains_fx[i][1] = L_shr( L_deposit_h( gains_fx[1] ), 1 ); // Q31 -> Q30
+ move32();
+#endif
}
ELSE
{
// TODO tmu review when #215 is resolved
+#ifdef OBJ_EDITING_API
+ azimuth_fx = L_shr( L_add( st_ivas->hIsmMetaData[i]->edited_azimuth_fx, 2097152 ), Q22 ); // Q0 ,2097152 = .5f in Q22
+ elevation_fx = L_shr( L_add( st_ivas->hIsmMetaData[i]->edited_elevation_fx, 2097152 ), Q22 ); // Q0 ,2097152 = .5f in Q22
+#else
azimuth_fx = L_shr( L_add( st_ivas->hIsmMetaData[i]->azimuth_fx, 2097152 ), Q22 ); // Q0 ,2097152 = .5f in Q22
elevation_fx = L_shr( L_add( st_ivas->hIsmMetaData[i]->elevation_fx, 2097152 ), Q22 ); // Q0 ,2097152 = .5f in Q22
+#endif
test();
test();
test();
test();
test();
+ test();
+ test();
+ test();
IF( ( EQ_32( st_ivas->renderer_type, RENDERER_TD_PANNING ) ||
EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) ||
- EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) &&
+ EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ||
+ ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) ) &&
st_ivas->hCombinedOrientationData == NULL )
{
if ( st_ivas->hIntSetup.is_planar_setup )
@@ -1009,6 +1034,10 @@ void ivas_ism_dec_digest_tc_fx(
azimuth_fx = L_shl( azimuth_fx, Q22 ); // Q22
elevation_fx = L_shl( elevation_fx, Q22 ); // Q22
efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azimuth_fx, elevation_fx, EFAP_MODE_EFAP );
+#ifdef OBJ_EDITING_API
+ // TODO: Enable gain editing feature
+ // v_multc_fixed( st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hIsmMetaData[i]->edited_gain_fx, st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hEFAPdata->numSpk );
+#endif
}
}
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) ||
@@ -1019,6 +1048,10 @@ void ivas_ism_dec_digest_tc_fx(
Word16 azi = shr( extract_h( st_ivas->hIsmMetaData[i]->azimuth_fx ), 22 - 16 ); // Q0
Word16 ele = shr( extract_h( st_ivas->hIsmMetaData[i]->elevation_fx ), 22 - 16 ); // Q0
ivas_dirac_dec_get_response_fx( azi, ele, st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hIntSetup.ambisonics_order, Q30 );
+#ifdef OBJ_EDITING_API
+ // TODO: Enable gain editing feature
+ // v_multc_fixed( st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hIsmMetaData[i]->edited_gain_fx, st_ivas->hIsmRendererData->gains_fx[i], ivas_sba_get_nchan_fx( st_ivas->hIntSetup.ambisonics_order, 0 ) ); // Q30, Q30 --> Q30
+#endif
}
}
}
@@ -1038,28 +1071,40 @@ void ivas_param_ism_dec_digest_tc_fx(
Word32 *transport_channels[], /* i : synthesized core-coder transport channels/DirAC output q_tc_in*/
Word16 q_tc_in )
{
- Word16 exp_real_tmp = 0, exp_imag_tmp = 0;
move16();
move16();
move16();
move16();
+#ifndef OBJ_EDITING_API
Word32 cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX];
Word16 exp_cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX];
+ Word16 exp_real_tmp = 0, exp_imag_tmp = 0;
+#endif
Word16 q_tc = q_tc_in;
move16();
+#ifndef OBJ_EDITING_API
Word16 ch, nchan_transport, nchan_out, nchan_out_woLFE, i;
Word16 slot_idx, bin_idx;
Word32 ivas_total_brate;
+#else
+ Word16 ch, nchan_transport, i;
+ Word16 slot_idx;
+#endif
+
Word16 output_frame;
+#ifndef OBJ_EDITING_API
/* Direct Response/EFAP Gains */
Word32 direct_response_fx[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN];
+#endif
PARAM_ISM_DEC_HANDLE hParamIsmDec;
SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
Word16 fade_len;
/* Initialization */
+#ifndef OBJ_EDITING_API
set32_fx( &direct_response_fx[0][0], 0, MAX_NUM_OBJECTS * PARAM_ISM_MAX_CHAN );
+#endif
hParamIsmDec = st_ivas->hParamIsmDec;
assert( hParamIsmDec );
hSpatParamRendCom = st_ivas->hSpatParamRendCom;
@@ -1069,6 +1114,7 @@ void ivas_param_ism_dec_digest_tc_fx(
nchan_transport = st_ivas->nchan_transport;
move16();
+#ifndef OBJ_EDITING_API
ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
move32();
@@ -1091,9 +1137,11 @@ void ivas_param_ism_dec_digest_tc_fx(
nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
move16();
}
+#endif
push_wmops( "ivas_param_ism_dec" );
+#ifndef OBJ_EDITING_API
/* general setup */
ivas_jbm_dec_get_adapted_linear_interpolator_fx( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hParamIsmDec->hParamIsmRendering->interpolator_fx );
@@ -1176,6 +1224,7 @@ void ivas_param_ism_dec_digest_tc_fx(
}
}
}
+#endif
IF( st_ivas->hDecoderConfig->Opt_tsm )
{
@@ -1211,6 +1260,8 @@ void ivas_param_ism_dec_digest_tc_fx(
hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp = sub( 31, q_tc );
move16();
}
+
+#ifndef OBJ_EDITING_API
Word16 scale_factor_real, scale_factor_imag;
Word16 current_idx;
exp_real_tmp = hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp;
@@ -1236,8 +1287,11 @@ void ivas_param_ism_dec_digest_tc_fx(
exp_imag_tmp = add( exp_imag_tmp, scale_factor_imag );
scale_sig32( &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands, -scale_factor_real ); // Q(31-(exp_real_tmp))
scale_sig32( &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands, -scale_factor_imag ); // Q(31-(exp_imag_tmp))
+#endif
}
}
+
+#ifndef OBJ_EDITING_API
/* Obtain Mixing Matrix on a frame-level */
FOR( bin_idx = 0; bin_idx < CLDFB_NO_CHANNELS_MAX; bin_idx++ )
{
@@ -1248,12 +1302,231 @@ void ivas_param_ism_dec_digest_tc_fx(
ivas_param_ism_compute_mixing_matrix_fx( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response_fx, nchan_transport, nchan_out_woLFE, cx_diag_fx, exp_cx_diag,
hParamIsmDec->hParamIsmRendering->mixing_matrix_lin_fx, hParamIsmDec->hParamIsmRendering->exp_mixing_matrix_lin_fx );
+#endif
pop_wmops();
return;
}
+#ifdef OBJ_EDITING_API
+
+
+/*-------------------------------------------------------------------------*
+ * ivas_param_ism_dec_prepare_renderer_fx()
+ *
+ *
+ *-------------------------------------------------------------------------*/
+
+void ivas_param_ism_dec_dequant_md_fx(
+ Decoder_Struct *st_ivas )
+{
+ /* De-quantization */
+ IF( !( EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) || EQ_32( st_ivas->hDecoderConfig->ivas_total_brate, FRAME_NO_DATA ) ) )
+ {
+ ivas_param_ism_dec_dequant_DOA_fx( st_ivas->hParamIsmDec, st_ivas->nchan_ism );
+ ivas_param_ism_dec_dequant_powrat_fx( st_ivas->hParamIsmDec );
+ st_ivas->hISMDTX.dtx_flag = 0;
+ move16();
+ }
+ ELSE
+ {
+ st_ivas->hISMDTX.dtx_flag = 1;
+ move16();
+ }
+
+ return;
+}
+
+/*-------------------------------------------------------------------------*
+ * ivas_param_ism_dec_prepare_renderer_fx()
+ *
+ *
+ *-------------------------------------------------------------------------*/
+
+void ivas_param_ism_dec_prepare_renderer_fx(
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const Word16 nCldfbSlots /* i : number of CLFBS slots in the transport channels */
+)
+{
+ int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i;
+ int16_t slot_idx, bin_idx;
+ Word32 cx_diag_fx[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX];
+ Word16 exp_cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX];
+ Word16 exp_real_tmp = 0, exp_imag_tmp = 0;
+ Word32 ivas_total_brate;
+ /* Direct Response/EFAP Gains */
+ Word32 direct_response_fx[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN];
+ PARAM_ISM_DEC_HANDLE hParamIsmDec;
+ SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
+
+ /* Initialization */
+ hSpatParamRendCom = st_ivas->hSpatParamRendCom;
+ assert( hSpatParamRendCom );
+ move32();
+ hParamIsmDec = st_ivas->hParamIsmDec;
+ assert( hParamIsmDec );
+ move32();
+ nchan_transport = st_ivas->nchan_transport;
+ move16();
+ ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
+
+ /* Initialization */
+
+ hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_exp = 25;
+ move16();
+ hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp = 25;
+ move16();
+ IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
+ {
+ nchan_out = st_ivas->nchan_ism;
+ move16();
+ nchan_out_woLFE = nchan_out;
+ move16();
+ st_ivas->hDecoderConfig->nchan_out = nchan_out;
+ move16();
+ }
+ ELSE
+ {
+ nchan_out = add( st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hIntSetup.num_lfe );
+ nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
+ move16();
+ }
+ push_wmops( "ivas_param_ism_dec_digest_tc" );
+
+ /* general setup */
+ ivas_jbm_dec_get_adapted_linear_interpolator_fx( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hParamIsmDec->hParamIsmRendering->interpolator_fx );
+
+ ivas_dirac_dec_set_md_map_fx( st_ivas, nCldfbSlots );
+ /* set buffers to zero */
+
+ set_zero_fx( &cx_diag_fx[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX );
+ set16_zero_fx( &exp_cx_diag[0][0], CLDFB_NO_CHANNELS_MAX * PARAM_ISM_MAX_DMX );
+
+ /* Frame-level Processing */
+ /* De-quantization */
+ test();
+ IF( !( EQ_32( ivas_total_brate, IVAS_SID_5k2 ) || EQ_32( ivas_total_brate, FRAME_NO_DATA ) ) )
+ {
+ ivas_param_ism_dec_dequant_DOA_fx( hParamIsmDec, st_ivas->nchan_ism );
+ ivas_param_ism_dec_dequant_powrat_fx( hParamIsmDec );
+ st_ivas->hISMDTX.dtx_flag = 0;
+ move16();
+ }
+ ELSE
+ {
+ st_ivas->hISMDTX.dtx_flag = 1;
+ move16();
+ }
+
+ /* obtain the direct response using EFAP */
+ IF( !( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) )
+ {
+ FOR( i = 0; i < st_ivas->nchan_ism; i++ )
+ {
+ efap_determine_gains_fx( st_ivas->hEFAPdata, direct_response_fx[i], hParamIsmDec->azimuth_values_fx[i], hParamIsmDec->elevation_values_fx[i], EFAP_MODE_EFAP );
+ }
+ }
+ ELSE
+ {
+ Word16 j;
+
+ FOR( i = 0; i < st_ivas->nchan_ism; i++ )
+ {
+ FOR( j = 0; j < nchan_out_woLFE; j++ )
+ {
+ IF( EQ_16( i, j ) )
+ {
+ direct_response_fx[i][j] = ONE_IN_Q30;
+ move32();
+ }
+ ELSE
+ {
+ direct_response_fx[i][j] = 0;
+ move32();
+ }
+ }
+ }
+
+ FOR( j = 0; j < nchan_out_woLFE; j++ )
+ {
+ IF( hParamIsmDec->azimuth_values_fx[j] > 0 )
+ {
+ hParamIsmDec->hParamIsmRendering->proto_matrix_fx[j] = 32767; // (1.0f in Q15) - 1
+ move16();
+ hParamIsmDec->hParamIsmRendering->proto_matrix_fx[nchan_out_woLFE + j] = 0;
+ move16();
+ }
+ ELSE
+ {
+ IF( hParamIsmDec->azimuth_values_fx[j] < 0 )
+ {
+ hParamIsmDec->hParamIsmRendering->proto_matrix_fx[j] = 0;
+ move16();
+ hParamIsmDec->hParamIsmRendering->proto_matrix_fx[nchan_out_woLFE + j] = 32767; // (1.0f in Q15) - 1
+ move16();
+ }
+ ELSE /* == 0.0f */
+ {
+ hParamIsmDec->hParamIsmRendering->proto_matrix_fx[j] = ONE_IN_Q14; // Q15
+ move16();
+ hParamIsmDec->hParamIsmRendering->proto_matrix_fx[nchan_out_woLFE + j] = ONE_IN_Q14; // Q15
+ move16();
+ }
+ }
+ }
+ }
+
+ FOR( ch = 0; ch < nchan_transport; ch++ )
+ {
+ /* CLDFB Analysis */
+ FOR( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ )
+ {
+ Word16 scale_factor_real, scale_factor_imag;
+ Word16 current_idx;
+ exp_real_tmp = hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp;
+ move16();
+ exp_imag_tmp = hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_exp;
+ move16();
+ current_idx = add( imult1616( imult1616( slot_idx, hSpatParamRendCom->num_freq_bands ), nchan_transport ), imult1616( ch, hSpatParamRendCom->num_freq_bands ) );
+ scale_factor_real = getScaleFactor32( &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands );
+ scale_factor_imag = getScaleFactor32( &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands );
+ scale_sig32( &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands, scale_factor_real ); // Q(31-(exp_real_tmp-scale_factor_real))
+ scale_sig32( &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands, scale_factor_imag ); // Q(31-(exp_imag_tmp-scale_factor_imag))
+ exp_real_tmp = sub( exp_real_tmp, scale_factor_real );
+ exp_imag_tmp = sub( exp_imag_tmp, scale_factor_imag );
+ ivas_param_ism_collect_slot_fx( hParamIsmDec,
+ &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[current_idx],
+ exp_real_tmp,
+ &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx],
+ exp_imag_tmp,
+ ch,
+ cx_diag_fx, exp_cx_diag );
+
+ exp_real_tmp = add( exp_real_tmp, scale_factor_real );
+ exp_imag_tmp = add( exp_imag_tmp, scale_factor_imag );
+ scale_sig32( &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands, -scale_factor_real ); // Q(31-(exp_real_tmp))
+ scale_sig32( &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx[current_idx], hSpatParamRendCom->num_freq_bands, -scale_factor_imag ); // Q(31-(exp_imag_tmp))
+ }
+ }
+
+ /* Obtain Mixing Matrix on a frame-level */
+ FOR( bin_idx = 0; bin_idx < CLDFB_NO_CHANNELS_MAX; bin_idx++ )
+ {
+ set32_fx( hParamIsmDec->hParamIsmRendering->mixing_matrix_lin_fx[bin_idx], 0, PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX );
+ }
+
+ /* Compute mixing matrix */
+ ivas_param_ism_compute_mixing_matrix_fx( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response_fx, nchan_transport, nchan_out_woLFE, cx_diag_fx, exp_cx_diag,
+ hParamIsmDec->hParamIsmRendering->mixing_matrix_lin_fx, hParamIsmDec->hParamIsmRendering->exp_mixing_matrix_lin_fx );
+
+
+ pop_wmops();
+
+ return;
+}
+#endif
+
/*-------------------------------------------------------------------------*
* ivas_ism_param_dec_tc_gain_ajust()
*
@@ -1657,6 +1930,20 @@ void ivas_param_ism_dec_render_fx(
/* store MetaData parameters */
FOR( ch = 0; ch < st_ivas->nchan_ism; ch++ )
{
+#ifdef OBJ_EDITING_API
+ IF( GT_32( st_ivas->hParamIsmDec->azimuth_values_fx[ch], 754974720 ) /*180.f in Q22*/ )
+ {
+ st_ivas->hIsmMetaData[ch]->azimuth_fx = L_sub( st_ivas->hParamIsmDec->edited_azimuth_values_fx[ch], 1509949440 ) /*360.0F in Q22*/;
+ move32();
+ }
+ ELSE
+ {
+ st_ivas->hIsmMetaData[ch]->azimuth_fx = st_ivas->hParamIsmDec->edited_azimuth_values_fx[ch];
+ move32();
+ }
+ st_ivas->hIsmMetaData[ch]->elevation_fx = st_ivas->hParamIsmDec->edited_elevation_values_fx[ch];
+ move32();
+#else
IF( GT_32( st_ivas->hParamIsmDec->azimuth_values_fx[ch], 754974720 ) /*180.f in Q22*/ )
{
st_ivas->hIsmMetaData[ch]->azimuth_fx = L_sub( st_ivas->hParamIsmDec->azimuth_values_fx[ch], 1509949440 ) /*360.0F in Q22*/;
@@ -1667,6 +1954,7 @@ void ivas_param_ism_dec_render_fx(
st_ivas->hIsmMetaData[ch]->azimuth_fx = st_ivas->hParamIsmDec->azimuth_values_fx[ch];
move32();
}
+#endif
st_ivas->hIsmMetaData[ch]->elevation_fx = st_ivas->hParamIsmDec->elevation_values_fx[ch];
move32();
@@ -1696,12 +1984,16 @@ void ivas_param_ism_params_to_masa_param_mapping_fx(
Word16 azimuth[2];
Word16 elevation[2];
Word16 power_ratio_fx[2]; /* Q15 */
+#ifndef OBJ_EDITING_API
Word32 ivas_total_brate;
+#endif
+
hParamIsmDec = st_ivas->hParamIsmDec;
hSpatParamRendCom = st_ivas->hSpatParamRendCom;
nBins = hSpatParamRendCom->num_freq_bands;
move16();
+#ifndef OBJ_EDITING_API
ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
move32();
@@ -1718,6 +2010,7 @@ void ivas_param_ism_params_to_masa_param_mapping_fx(
st_ivas->hISMDTX.dtx_flag = 1;
move16();
}
+#endif
IF( GT_16( st_ivas->nchan_ism, 1 ) )
{
@@ -1758,6 +2051,15 @@ void ivas_param_ism_params_to_masa_param_mapping_fx(
{
brange[0] = hParamIsmDec->hParamIsm->band_grouping[band_idx];
move16();
+#ifdef OBJ_EDITING_API
+ brange[1] = hParamIsmDec->hParamIsm->band_grouping[band_idx + 1];
+ move16();
+
+ azimuth[0] = extract_l( L_shr( L_add( hParamIsmDec->edited_azimuth_values_fx[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][0]], ( 1 << 21 ) ), 22 ) ); // Q0
+ move16();
+ elevation[0] = extract_l( L_shr( L_add( hParamIsmDec->edited_elevation_values_fx[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][0]], ( 1 << 21 ) ), 22 ) ); // Q0
+ move16();
+#else
brange[1] = hParamIsmDec->hParamIsm->band_grouping[band_idx + 1];
move16();
@@ -1765,12 +2067,21 @@ void ivas_param_ism_params_to_masa_param_mapping_fx(
move16();
elevation[0] = extract_l( L_shr( L_add( hParamIsmDec->elevation_values_fx[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][0]], ( 1 << 21 ) ), 22 ) ); // Q0
move16();
+#endif
power_ratio_fx[0] = hParamIsmDec->power_ratios_fx[band_idx][0][0];
move16();
+
+#ifdef OBJ_EDITING_API
+ azimuth[1] = extract_l( L_shr( L_add( hParamIsmDec->edited_azimuth_values_fx[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]], ( 1 << 21 ) ), 22 ) ); // Q0
+ move16();
+ elevation[1] = extract_l( L_shr( L_add( hParamIsmDec->edited_elevation_values_fx[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]], ( 1 << 21 ) ), 22 ) ); // Q0
+ move16();
+#else
azimuth[1] = extract_l( L_shr( L_add( hParamIsmDec->azimuth_values_fx[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]], ( 1 << 21 ) ), 22 ) ); // Q0
move16();
elevation[1] = extract_l( L_shr( L_add( hParamIsmDec->elevation_values_fx[hParamIsmDec->hParamIsm->obj_indices[band_idx][0][1]], ( 1 << 21 ) ), 22 ) ); // Q0
move16();
+#endif
power_ratio_fx[1] = hParamIsmDec->power_ratios_fx[band_idx][0][1];
move16();
diff --git a/lib_dec/ivas_ism_renderer_fx.c b/lib_dec/ivas_ism_renderer_fx.c
index 8d141537dd112aaf8f1bd3eaf85314ed75f8f127..36234bf4713f711712cbb3f3b63a4b3a0c6b42b3 100644
--- a/lib_dec/ivas_ism_renderer_fx.c
+++ b/lib_dec/ivas_ism_renderer_fx.c
@@ -70,7 +70,11 @@ ivas_error ivas_ism_renderer_open_fx(
test();
test();
test();
- IF( st_ivas->hIntSetup.is_loudspeaker_setup && st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL && st_ivas->hEFAPdata == NULL )
+ test();
+ IF( st_ivas->hIntSetup.is_loudspeaker_setup &&
+ st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO &&
+ st_ivas->hIntSetup.ls_azimuth_fx != NULL && st_ivas->hIntSetup.ls_elevation_fx != NULL &&
+ st_ivas->hEFAPdata == NULL )
{
IF( NE_32( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth_fx, st_ivas->hIntSetup.ls_elevation_fx, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ), IVAS_ERR_OK ) )
{
@@ -86,22 +90,19 @@ ivas_error ivas_ism_renderer_open_fx(
IF( st_ivas->hDecoderConfig->Opt_tsm )
{
- Word32 res_dec, res_frac;
init_interpolator_length = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_CLDFB_TIMESLOTS * CLDFB_SLOT_NS );
move16();
- iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- interpolator_length = (UWord16) ( res_dec );
+ interpolator_length = (UWord16) extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
move16();
}
ELSE
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- init_interpolator_length = (UWord16) ( res_dec );
+ init_interpolator_length = (UWord16) extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
move16();
interpolator_length = init_interpolator_length;
move16();
}
+
IF( ( st_ivas->hIsmRendererData->interpolator_fx = (Word16 *) malloc( sizeof( Word16 ) * init_interpolator_length ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ISM renderer interpolator\n" ) );
@@ -258,16 +259,28 @@ void ivas_ism_render_sf_fx(
{
if ( GE_16( subframe_idx, ism_md_subframe_update_jbm ) )
{
+#ifdef OBJ_EDITING_API
+ rotateAziEle_fx( extract_l( L_shr( st_ivas->hIsmMetaData[i]->edited_azimuth_fx, 22 ) ), extract_l( L_shr( st_ivas->hIsmMetaData[i]->edited_elevation_fx, 22 ) ), &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx], st_ivas->hIntSetup.is_planar_setup );
+#else
rotateAziEle_fx( extract_l( L_shr( st_ivas->hIsmMetaData[i]->azimuth_fx, 22 ) ), extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, 22 ) ), &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx], st_ivas->hIntSetup.is_planar_setup );
+#endif
}
else
{
+#ifdef OBJ_EDITING_API
+ rotateAziEle_fx( extract_l( L_shr( st_ivas->hIsmMetaData[i]->edited_azimuth_fx, 22 ) ), extract_l( L_shr( st_ivas->hIsmMetaData[i]->edited_elevation_fx, 22 ) ), &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx], st_ivas->hIntSetup.is_planar_setup );
+#else
rotateAziEle_fx( extract_l( L_shr( st_ivas->hIsmMetaData[i]->last_azimuth_fx, 22 ) ), extract_l( L_shr( st_ivas->hIsmMetaData[i]->last_elevation_fx, 22 ) ), &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx], st_ivas->hIntSetup.is_planar_setup );
+#endif
}
IF( st_ivas->hEFAPdata != NULL )
{
efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], L_shl( azimuth, 22 ), L_shl( elevation, 22 ), EFAP_MODE_EFAP );
+#ifdef OBJ_EDITING_API
+ // TODO: Enable gain editing feature
+ // v_multc_fixed( st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hIsmMetaData[i]->edited_gain_fx, st_ivas->hIsmRendererData->gains_fx[i], nchan_out_woLFE ); // Q30, Q30 --> Q30
+#endif
}
}
@@ -403,7 +416,7 @@ void ivas_ism_get_stereo_gains_fx(
}
/*-------------------------------------------------------------------------*
- * ivas_masa_oism_separate_object_renderer_open()
+ * ivas_omasa_separate_object_renderer_open()
*
* Open structures, reserve memory, and init values.
*-------------------------------------------------------------------------*/
@@ -425,15 +438,17 @@ ivas_error ivas_omasa_separate_object_renderer_open(
{
set32_fx( st_ivas->hIsmRendererData->prev_gains_fx[i], 0, MAX_OUTPUT_CHANNELS );
}
- Word32 res_dec1, res_frac1;
- Word32 res_dec2, res_frac2;
- iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &res_dec1, &res_frac1, 0 );
- iDiv_and_mod_32( res_dec1, MAX_PARAM_SPATIAL_SUBFRAMES, &res_dec2, &res_frac2, 0 );
- init_interpolator_length = extract_l( res_dec2 );
+
+ i = extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ init_interpolator_length = shr( i, 2 ); // i / MAX_PARAM_SPATIAL_SUBFRAMES
interpolator_length = init_interpolator_length;
move16();
- st_ivas->hIsmRendererData->interpolator_fx = (Word16 *) malloc( sizeof( Word16 ) * init_interpolator_length );
+ IF( ( st_ivas->hIsmRendererData->interpolator_fx = (Word16 *) malloc( sizeof( Word16 ) * init_interpolator_length ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer interpolator \n" ) );
+ }
+
st_ivas->hIsmRendererData->interpolator_len = init_interpolator_length;
move16();
FOR( i = 0; i < interpolator_length; i++ )
@@ -444,34 +459,6 @@ ivas_error ivas_omasa_separate_object_renderer_open(
st_ivas->hIsmRendererData->interpolator_len = interpolator_length;
move16();
- st_ivas->hMasaIsmData->delayBuffer_size = extract_l( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES );
- move16();
-
- test();
- IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
- {
- st_ivas->hMasaIsmData->delayBuffer_nchan = 1;
- move16();
- }
- ELSE
- {
- st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism;
- move16();
- }
-
- IF( ( st_ivas->hMasaIsmData->delayBuffer_fx = (Word32 **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( Word32 * ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) );
- }
-
- FOR( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ )
- {
- IF( ( st_ivas->hMasaIsmData->delayBuffer_fx[i] = (Word32 *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( Word32 ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) );
- }
- set32_fx( st_ivas->hMasaIsmData->delayBuffer_fx[i], 0, st_ivas->hMasaIsmData->delayBuffer_size );
- }
return IVAS_ERR_OK;
}
diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c
index 1eaded3f883a321e2311c3eae487476ab6380f32..bdfe83a083e4155c0b9901fe64493b44013a18a5 100644
--- a/lib_dec/ivas_jbm_dec_fx.c
+++ b/lib_dec/ivas_jbm_dec_fx.c
@@ -82,7 +82,7 @@ ivas_error ivas_jbm_dec_tc_fx(
Word32 *data_fx /*Q11*/
)
{
- Word16 n, output_frame, nchan_out, i, ii;
+ Word16 ch, n, output_frame, nchan_out, i, ii;
Decoder_State *st; /* used for bitstream handling */
Word32 *p_output_fx[MAX_TRANSPORT_CHANNELS]; /* buffer for output synthesis */
Word16 nchan_remapped;
@@ -122,20 +122,6 @@ ivas_error ivas_jbm_dec_tc_fx(
}
}
- IF( st_ivas->hDecoderConfig->Opt_tsm == 0 )
- {
- FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
- {
- set_zero_fx( st_ivas->p_output_fx[n], L_FRAME48k );
- st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n];
- }
- st_ivas->hTcBuffer->no_channels = ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
- move16();
- }
-
- Word16 ch;
-
-
/*----------------------------------------------------------------*
* Decoding + pre-rendering
*----------------------------------------------------------------*/
@@ -173,7 +159,11 @@ ivas_error ivas_jbm_dec_tc_fx(
/* HP filtering */
FOR( n = 0; n < s_min( nchan_out, st_ivas->nchan_transport ); n++ )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
}
ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
@@ -208,6 +198,9 @@ ivas_error ivas_jbm_dec_tc_fx(
}
}
ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( st_ivas->hSCE, st_ivas->hISMDTX.sce_id_dtx, st_ivas->nchan_transport, Q_cngNoiseLevel );
+#ifdef OBJ_EDITING_API
+ ivas_param_ism_dec_dequant_md_fx( st_ivas );
+#endif
}
ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
{
@@ -215,6 +208,9 @@ ivas_error ivas_jbm_dec_tc_fx(
{
return error;
}
+#ifdef OBJ_EDITING_API
+ ivas_param_ism_dec_dequant_md_fx( st_ivas );
+#endif
}
ELSE /* ISM_MODE_DISC */
{
@@ -240,7 +236,11 @@ ivas_error ivas_jbm_dec_tc_fx(
}
/* HP filtering */
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
test();
@@ -418,11 +418,7 @@ ivas_error ivas_jbm_dec_tc_fx(
{
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q;
-#else
- hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q;
-#endif
move16();
}
IF( hCPE->hStereoDft != NULL )
@@ -595,7 +591,11 @@ ivas_error ivas_jbm_dec_tc_fx(
/* HP filtering */
FOR( n = 0; n < nchan_remapped; n++ )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
@@ -660,16 +660,16 @@ ivas_error ivas_jbm_dec_tc_fx(
{
Word16 q_shift = 0;
move16();
+
ivas_masa_prerender_fx( st_ivas, p_output_fx, &q_shift, output_frame, nchan_remapped );
FOR( i = 0; i < 2; i++ )
{
Scale_sig32( p_output_fx[i], output_frame, negate( q_shift ) );
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
test();
/* external output */
- IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) &&
- EQ_32( st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) )
+ IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) )
{
FOR( n = 0; n < st_ivas->nchan_ism; n++ )
{
@@ -678,7 +678,6 @@ ivas_error ivas_jbm_dec_tc_fx(
ivas_omasa_rearrange_channels_fx( p_output_fx, st_ivas->nchan_ism, output_frame );
}
-#endif
}
ELSE IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) )
{
@@ -789,7 +788,11 @@ ivas_error ivas_jbm_dec_tc_fx(
FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
Word16 output_q = 11;
@@ -803,7 +806,6 @@ ivas_error ivas_jbm_dec_tc_fx(
}
ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
ivas_omasa_rearrange_channels_fx( p_output_fx, nchan_transport_ism, output_frame );
@@ -818,15 +820,7 @@ ivas_error ivas_jbm_dec_tc_fx(
/* Extract objects from MASA, output MASA + all objects (i.e., extracted and separated objects) */
ivas_omasa_render_objects_from_mix_fx( st_ivas, p_output_fx, st_ivas->nchan_ism, output_frame, &output_q );
}
-#else
- /* sanity check in case of bitrate switching */
- IF( NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
- {
- return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Incorrect output configuration specified for combined MASA and ISM format" );
- }
- ivas_omasa_rearrange_channels_fx( p_output_fx, nchan_transport_ism, output_frame );
-#endif
IF( st_ivas->hDecoderConfig->Opt_tsm )
{
ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );
@@ -968,11 +962,7 @@ ivas_error ivas_jbm_dec_tc_fx(
{
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) ); // q
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q;
-#else
- hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q;
-#endif
move16();
}
IF( hCPE->hStereoDft != NULL )
@@ -1041,7 +1031,11 @@ ivas_error ivas_jbm_dec_tc_fx(
/* HP filtering */
FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
nchan_remapped = ivas_sba_remapTCs_fx( &p_output_fx[sba_ch_idx], st_ivas, output_frame );
@@ -1154,7 +1148,11 @@ ivas_error ivas_jbm_dec_tc_fx(
{
IF( NE_16( n, LFE_CHANNEL ) )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
}
@@ -1212,7 +1210,11 @@ ivas_error ivas_jbm_dec_tc_fx(
{
IF( NE_16( n, LFE_CHANNEL ) )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
}
@@ -1278,7 +1280,11 @@ ivas_error ivas_jbm_dec_tc_fx(
/* HP filtering */
FOR( n = 0; n < st_ivas->nchan_transport; n++ )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
/* Rendering */
@@ -1336,16 +1342,10 @@ ivas_error ivas_jbm_dec_tc_fx(
test();
test();
test();
-#ifdef FIX_1052_EXT_OUTPUT
test();
/* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */
IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) ||
EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe > 0 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#else
- /* Delay the separated channel to sync with CLDFB delay of the DirAC synthesis, and synthesize the LFE signal. */
- IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) ||
- EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) || ( EQ_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && st_ivas->hOutSetup.num_lfe > 0 ) )
-#endif
{
ivas_lfe_synth_with_filters_fx( st_ivas->hMasa->hMasaLfeSynth, p_output_fx, output_frame, n, LFE_CHANNEL );
}
@@ -1424,11 +1424,7 @@ ivas_error ivas_jbm_dec_tc_fx(
{
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q
Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q;
-#else
- hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q;
-#endif
move16();
}
IF( hCPE->hStereoDft != NULL )
@@ -1502,7 +1498,11 @@ ivas_error ivas_jbm_dec_tc_fx(
/* HP filtering */
FOR( n = 0; n < getNumChanSynthesis( st_ivas ); n++ )
{
+#ifdef HP20_FIX32_RECODING
+ hp20_fx_32_opt( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#else
hp20_fx_32( p_output_fx[n], output_frame, st_ivas->mem_hp20_out_fx[n], output_Fs );
+#endif
}
IF( EQ_32( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) )
@@ -1604,6 +1604,14 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
p_data_f_fx[n] = &data_f_fx[n][0];
}
+ IF( st_ivas->hDecoderConfig->Opt_tsm == 0 )
+ {
+ FOR( n = 0; n < ivas_get_nchan_buffers_dec_fx( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ )
+ {
+ st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; /* note: buffers needed in the TD decorellator */
+ }
+ }
+
IF( st_ivas->hDecoderConfig->Opt_tsm )
{
ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data_fx, p_data_f_fx, 11 );
@@ -1615,6 +1623,7 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
}
n_render_timeslots = idiv1616( st_ivas->hTcBuffer->n_samples_available, st_ivas->hTcBuffer->n_samples_granularity );
+#ifndef OBJ_EDITING_API
test();
IF( EQ_16( st_ivas->hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_BUFFER ) )
{
@@ -1632,12 +1641,15 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
{
ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
}
- ELSE IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) )
+ ELSE
+#endif
+ IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) )
{
/* Rendering */
IF( EQ_16( st_ivas->ism_mode, ISM_MODE_PARAM ) )
{
test();
+#ifndef OBJ_EDITING_API
test();
test();
IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) )
@@ -1646,17 +1658,22 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
ivas_param_ism_params_to_masa_param_mapping_fx( st_ivas );
}
- ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_PARAM_ISM ) || EQ_16( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) )
+ ELSE
+#endif
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_PARAM_ISM ) || EQ_16( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) )
{
ivas_param_ism_dec_digest_tc_fx( st_ivas, n_render_timeslots, p_data_f_fx, Q11 );
}
}
+#ifndef OBJ_EDITING_API
ELSE /* ISM_MODE_DISC */
{
ivas_ism_dec_digest_tc_fx( st_ivas );
}
+#endif
}
+#ifndef OBJ_EDITING_API
ELSE IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) )
{
IF( st_ivas->hSCE[0] )
@@ -1739,7 +1756,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
}
ELSE IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
test();
IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) )
{
@@ -1751,7 +1767,6 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
}
ELSE
{
-#endif
test();
IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
@@ -1775,27 +1790,33 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
{
ivas_ism_dec_digest_tc_fx( st_ivas );
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
}
-#endif
- if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_DIRAC )
+ test();
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_DIRAC ) )
{
- int16_t num_objects;
+ Word16 num_objects;
/* Delay the signal to match CLDFB delay. Delay the whole buffer. */
num_objects = 0;
- IF( ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC )
+ move16();
+
+ test();
+ test();
+ IF( ( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) )
{
num_objects = 1;
+ move16();
}
ELSE IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
num_objects = st_ivas->nchan_ism;
+ move16();
}
FOR( n = 0; n < num_objects; n++ )
{
- if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC )
+ test();
+ IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) )
{
v_multc_fixed_16( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN_FX, st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available );
}
@@ -1879,6 +1900,16 @@ void ivas_jbm_dec_feed_tc_to_renderer_fx(
ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
}
}
+#else
+ ELSE IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) )
+ {
+ test();
+ IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMMC ) && EQ_16( st_ivas->hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_RENDERER ) )
+ {
+ ivas_param_mc_dec_digest_tc_fx( st_ivas, (UWord8) n_render_timeslots, (Word32 **) p_data_f_fx, Q11 );
+ }
+ }
+#endif
pop_wmops();
return;
@@ -2115,7 +2146,7 @@ ivas_error ivas_jbm_dec_render_fx(
scale_sig32( p_output_fx[i], *nSamplesRendered, negate( sub( 11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q11
}
- IF( NE_32( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output_fx, p_output_fx, *nSamplesRendered, output_Fs, 0 ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output_fx, p_output_fx, *nSamplesRendered, output_Fs, 0 ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2159,9 +2190,7 @@ ivas_error ivas_jbm_dec_render_fx(
move16();
test();
test();
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
test();
-#endif
IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) )
{
test();
@@ -2181,14 +2210,11 @@ ivas_error ivas_jbm_dec_render_fx(
{
ivas_omasa_dirac_rend_jbm_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output_fx );
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
- ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ||
- EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) )
+ ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) )
{
ivas_jbm_dec_tc_buffer_playout_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output_fx );
ivas_omasa_rearrange_channels_fx( p_output_fx, st_ivas->nchan_ism, *nSamplesRendered );
}
-#endif
}
ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
@@ -2230,9 +2256,43 @@ ivas_error ivas_jbm_dec_render_fx(
ivas_ism_render_sf_fx( st_ivas, st_ivas->renderer_type, p_output_fx, *nSamplesRendered );
/* add already rendered SBA part */
- FOR( n = 0; n < nchan_out; n++ )
+#ifdef OBJ_EDITING_API
+ test();
+ IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
{
- v_add_fixed_no_hdrm( p_output_fx[n], p_tc_fx[n + st_ivas->nchan_ism], p_output_fx[n], *nSamplesRendered );
+ Word32 gain = st_ivas->hSbaIsmData->gain_bed_fx;
+ test();
+ // TODO: Enable gain editing feature (NE_32 ( gain, ONE_IN_Q_gain ) )
+ IF( NE_32( gain, ONE_IN_Q31 ) && GT_32( gain, 0 ) )
+ {
+ FOR( n = 0; n < nchan_out; n++ )
+ {
+ FOR( i = 0; i < *nSamplesRendered; i++ )
+ {
+ Word32 tmp1 = Mpy_32_32( p_tc_fx[n + st_ivas->nchan_ism][i], gain ); // Q11 + Q30 - 32 = Q9
+ tmp1 = L_shl( tmp1, 2 ); // Q9 --> Q11
+ p_output_fx[n][i] = L_add_sat( p_output_fx[n][i], tmp1 ); // Q11
+ }
+ }
+ }
+ ELSE
+ {
+ FOR( n = 0; n < nchan_out; n++ )
+ {
+ FOR( n = 0; n < nchan_out; n++ )
+ {
+ FOR( i = 0; i < *nSamplesRendered; i++ )
+ {
+ p_output_fx[n][i] = L_add_sat( p_output_fx[n][i], p_tc_fx[n + st_ivas->nchan_ism][i] ); // Q11
+ }
+ }
+ }
+ }
+ }
+ ELSE
+#endif
+ {
+ ivas_osba_stereo_add_channels_fx( p_tc_fx, p_output_fx, ONE_IN_Q11, nchan_out, st_ivas->nchan_ism, *nSamplesRendered );
}
}
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) || EQ_32( st_ivas->renderer_type, RENDERER_OSBA_LS ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
@@ -2265,6 +2325,10 @@ ivas_error ivas_jbm_dec_render_fx(
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
{
ivas_dirac_dec_binaural_render_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output_fx );
+ FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ )
+ {
+ scale_sig32( p_output_fx[n], *nSamplesRendered, 1 );
+ }
}
ELSE
{
@@ -2284,6 +2348,10 @@ ivas_error ivas_jbm_dec_render_fx(
set32_fx( p_output_fx[n], 0, *nSamplesRendered );
}
}
+ FOR( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ )
+ {
+ scale_sig32( p_output_fx[n], *nSamplesRendered, 1 );
+ }
}
}
ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
@@ -2355,8 +2423,8 @@ ivas_error ivas_jbm_dec_render_fx(
}
ELSE
{
- IF( NE_32( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
- &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : p_tc_fx, p_output_fx, *nSamplesRendered, output_Fs, 0 ) ),
+ IF( NE_32( ( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
+ &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : p_tc_fx, p_output_fx, *nSamplesRendered, output_Fs, 0 ) ),
IVAS_ERR_OK ) )
{
return error;
@@ -2426,7 +2494,7 @@ ivas_error ivas_jbm_dec_render_fx(
/* Rendering */
IF( ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) && !st_ivas->hDecoderConfig->Opt_Headrotation )
{
- /*handled in CLDFB domain already*/
+ /* handled in CLDFB domain already */
IF( NE_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_output_fx, p_output_fx );
@@ -2647,7 +2715,7 @@ ivas_error ivas_jbm_dec_render_fx(
nchan_out_syn_output = nchan_out;
move16();
- IF( st_ivas->hDecoderConfig->Opt_Limiter )
+ IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 )
{
IF( NE_32( st_ivas->ivas_format, MONO_FORMAT ) )
{
@@ -2667,7 +2735,7 @@ ivas_error ivas_jbm_dec_render_fx(
}
/*--------------------------------------------------------------------------*
- * ivas_jbm_dec_dec_flush_renderer()
+ * ivas_jbm_dec_flush_renderer()
*
* Flush samples if renderer granularity changes on a bitrate change
*--------------------------------------------------------------------------*/
@@ -2691,6 +2759,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
DECODER_TC_BUFFER_HANDLE hTcBuffer;
Word32 *p_output_fx[MAX_CICP_CHANNELS + MAX_NUM_OBJECTS];
Word16 nchan_in, nchan_out;
+
IF( !st_ivas->hDecoderConfig->Opt_tsm )
{
return IVAS_ERR_OK;
@@ -2779,8 +2848,8 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
*st_ivas->hCrendWrapper->p_io_qfactor = 11;
move16();
- IF( NE_32( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL,
- NULL, NULL, st_ivas->hTcBuffer, p_output_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ),
+ IF( NE_32( ( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL,
+ NULL, NULL, st_ivas->hTcBuffer, p_output_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ),
IVAS_ERR_OK ) )
{
return error;
@@ -2796,8 +2865,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
{
IF( EQ_16( mc_mode_old, MC_MODE_MCT ) )
{
-#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
- int16_t crendInPlaceRotation = FALSE;
+ Word16 crendInPlaceRotation = FALSE;
test();
test();
@@ -2811,7 +2879,6 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
ivas_mc2sba_fx( st_ivas->hTransSetup, hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, hIntSetupOld->ambisonics_order, GAIN_LFE_FX );
}
}
-#endif
test();
IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( renderer_type_old, RENDERER_BINAURAL_MIXER_CONV_ROOM ) )
@@ -2829,15 +2896,9 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
*st_ivas->hCrendWrapper->p_io_qfactor = 11;
move16();
-#ifdef NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT
- IF( NE_32( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
- hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ),
- IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
- hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ) ),
+ IF( NE_32( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
+ hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ),
IVAS_ERR_OK ) )
-#endif
{
return error;
}
@@ -2866,8 +2927,16 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
{
IF( EQ_16( ism_mode_old, ISM_MASA_MODE_DISC ) )
{
- Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS];
+ Word32 *tc_local_fx[MAX_NUM_OBJECTS];
+#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH
+ Word16 last_dirac_md_idx;
+ UWord16 nSamplesAvailableNext;
+ ISM_MODE ism_mode_orig;
+ RENDERER_TYPE renderer_type_orig;
+ Word32 ivas_total_brate;
+#endif
+ /* copy from ISM delay buffer to the correct place in TCs */
move16();
FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
{
@@ -2875,24 +2944,39 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
Copy32( st_ivas->hMasaIsmData->delayBuffer_fx[ch_idx], tc_local_fx[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size ); /*Q11*/
}
- IF( st_ivas->nchan_ism > 0 )
+#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH
+ /* to render flushed samples, use configuration from the last received frame */
+ ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
+ renderer_type_orig = st_ivas->renderer_type;
+ ism_mode_orig = st_ivas->ism_mode;
+ st_ivas->ism_mode = ism_mode_old;
+ st_ivas->renderer_type = renderer_type_old;
+ st_ivas->hDecoderConfig->ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;
+ last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1];
+
+ /* transfer adapted sf info from hTcBuffer to DirAC */
+ st_ivas->hSpatParamRendCom->nb_subframes = 1;
+ st_ivas->hSpatParamRendCom->subframes_rendered = 0;
+ st_ivas->hSpatParamRendCom->subframe_nbslots[0] = JBM_CLDFB_SLOTS_IN_SUBFRAME;
+ st_ivas->hSpatParamRendCom->slots_rendered = 0;
+ st_ivas->hSpatParamRendCom->num_slots = JBM_CLDFB_SLOTS_IN_SUBFRAME;
+ set16_fx( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available );
+
+ IF( ( error = ivas_omasa_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, CPE_CHANNELS, p_output_fx ) ) != IVAS_ERR_OK )
{
- IF( NE_32( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, hTcBuffer->n_samples_granularity ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
+ return error;
}
- ELSE
+
+ /* restore original configuration */
+ st_ivas->ism_mode = ism_mode_orig;
+ st_ivas->renderer_type = renderer_type_orig;
+ st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate;
+#else
+ IF( NE_32( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, hTcBuffer->n_samples_granularity ) ), IVAS_ERR_OK ) )
{
- FOR( ch_idx = 0; ch_idx < st_ivas->hDecoderConfig->nchan_out; ch_idx++ )
- {
- set_zero_fx( p_output_fx[ch_idx], (Word16) ( *nSamplesRendered ) );
- }
- st_ivas->hTcBuffer->slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, 1 );
- st_ivas->hTcBuffer->subframes_rendered = add( st_ivas->hTcBuffer->subframes_rendered, 1 );
- move16();
- move16();
+ return error;
}
+#endif
}
}
ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ){
@@ -2904,33 +2988,19 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
Word16 last_dirac_md_idx;
UWord16 nSamplesAvailableNext;
-#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN
- ISM_MODE ism_mode_orig;
- RENDERER_TYPE renderer_type_orig;
- Word32 ivas_total_brate;
- ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
- renderer_type_orig = st_ivas->renderer_type;
- ism_mode_orig = st_ivas->ism_mode;
- move32();
- st_ivas->ism_mode = ism_mode_old;
- st_ivas->renderer_type = renderer_type_old;
- st_ivas->hDecoderConfig->ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;
-#endif
+ /* to render flushed samples, use configuration from the last received frame */
- last_spar_md_idx = st_ivas->hSpar->render_to_md_map[st_ivas->hSpar->slots_rendered - 1];
- last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1];
- move16();
- move16();
- /* copy from ISM delay buffer to the correct place in tcs */
- FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
- {
-#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN
- tc_local_fx[ch_idx] = &st_ivas->hTcBuffer->tc_fx[ch_idx][hTcBuffer->n_samples_rendered];
-#else
- tc_local_fx[ch_idx] = &st_ivas->hTcBuffer->tc_fx[ch_idx + 2][hTcBuffer->n_samples_rendered];
-#endif
- Copy32( st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], tc_local_fx[ch_idx], st_ivas->hSbaIsmData->delayBuffer_size );
- }
+ last_spar_md_idx = st_ivas->hSpar->render_to_md_map[st_ivas->hSpar->slots_rendered - 1];
+ last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1];
+ move16();
+ move16();
+
+ /* copy from ISM delay buffer to the correct place in TCs */
+ FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
+ {
+ tc_local_fx[ch_idx] = &st_ivas->hTcBuffer->tc_fx[ch_idx + 2][hTcBuffer->n_samples_rendered];
+ Copy32( st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], tc_local_fx[ch_idx], st_ivas->hSbaIsmData->delayBuffer_size );
+ }
/* transfer adapted sf info from hTcBuffer to SPAR and DirAC */
st_ivas->hSpar->nb_subframes = 1;
@@ -2958,35 +3028,32 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
set16_fx( st_ivas->hSpar->render_to_md_map, last_spar_md_idx, n_slots_still_available );
set16_fx( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available );
- /* render the last subframe */
- IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) )
+ /* render the last subframe */
+ IF( NE_32( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, p_output_fx ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+
+ /* restore original configuration */
+ }
+ ELSE
{
- return error;
+ return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Wrong IVAS format in VoIP renderer flushing!" );
}
-#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN
- st_ivas->ism_mode = ism_mode_orig;
- st_ivas->renderer_type = renderer_type_orig;
- st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate;
+ hTcBuffer->n_samples_rendered = hTcBuffer->n_samples_granularity;
}
-#endif
-}
-ELSE
-{
- return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Wrong IVAS format in VoIP renderer flushing!" );
-}
-hTcBuffer->n_samples_rendered = hTcBuffer->n_samples_granularity;
-}
/* update global combined orientation start index */
ivas_combined_orientation_update_start_index( st_ivas->hCombinedOrientationData, *nSamplesRendered );
-*nSamplesRendered = n_samples_to_render;
-move16();
-/* Only write out the valid data*/
-IF( st_ivas->hDecoderConfig->Opt_Limiter )
-{
- IF( NE_16( st_ivas->ivas_format, MONO_FORMAT ) )
+ *nSamplesRendered = n_samples_to_render;
+ move16();
+
+ /* Only write out the valid data*/
+ IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 )
{
+ IF( NE_16( st_ivas->ivas_format, MONO_FORMAT ) )
+ {
#ifndef DISABLE_LIMITER
Word16 ch_idx, exp = 11;
move16();
@@ -3631,16 +3698,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx(
set16_fx( hTcBuffer->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS );
set16_fx( hTcBuffer->subframe_nbslots, nMaxSlotsPerSubframe, MAX_PARAM_SPATIAL_SUBFRAMES );
- IF( EQ_16( hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_NONE ) )
- {
- hTcBuffer->tc_buffer_fx = NULL;
-
- FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ )
- {
- hTcBuffer->tc_fx[ch_idx] = NULL;
- }
- }
- ELSE
{
Word16 n_samp_full, n_samp_residual;
Word32 offset;
@@ -4023,10 +4080,8 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode(
case RENDERER_PARAM_ISM:
case RENDERER_BINAURAL_MIXER_CONV:
case RENDERER_BINAURAL_MIXER_CONV_ROOM:
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
case RENDERER_OMASA_OBJECT_EXT:
case RENDERER_OMASA_MIX_EXT:
-#endif
case RENDERER_OSBA_AMBI:
case RENDERER_OSBA_LS:
buffer_mode = TC_BUFFER_MODE_RENDERER;
@@ -4112,7 +4167,6 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx(
)
{
Word16 Q_tc;
- Word16 n_ch_full_copy;
Word16 n_ch_cldfb;
Word16 ch_idx;
DECODER_TC_BUFFER_HANDLE hTcBuffer;
@@ -4122,22 +4176,14 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx(
hTcBuffer->n_samples_available = hTcBuffer->n_samples_buffered;
move16();
move16();
- n_ch_full_copy = s_min( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full );
n_ch_cldfb = sub( hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full );
Q_tc = 11; /*tc buffer is at Q11*/
move16();
- /* copy full tcs*/
- IF( st_ivas->hDecoderConfig->Opt_tsm )
- {
- FOR( ch_idx = 0; ch_idx < n_ch_full_copy; ch_idx++ )
- {
- Copy32( tc_fx[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], hTcBuffer->n_samples_buffered ); // keeping tc_fx in Q11
- }
- }
- ch_idx = 0;
- move16();
+#ifdef DEBUGGING
+ assert( st_ivas->hDecoderConfig->Opt_tsm == 0 );
+#endif
/* CLDFB ana for ParamMC/ParamISM */
IF( n_ch_cldfb > 0 )
{
@@ -4168,9 +4214,9 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx(
num_freq_bands = st_ivas->hParamMC->num_freq_bands;
move16();
}
- /* CLDFB Analysis*/
- FOR( cldfb_ch = 0; cldfb_ch < n_ch_cldfb; ( cldfb_ch++, ch_idx++ ) )
+ /* CLDFB Analysis*/
+ FOR( ( ch_idx = 0, cldfb_ch = 0 ); cldfb_ch < n_ch_cldfb; ( cldfb_ch++, ch_idx++ ) )
{
FOR( slot_idx = 0; slot_idx < DEFAULT_JBM_CLDFB_TIMESLOTS; slot_idx++ )
{
@@ -4405,3 +4451,293 @@ void ivas_jbm_masa_sf_to_sf_map(
return;
}
+
+#ifdef OBJ_EDITING_API
+/*--------------------------------------------------------------------------*
+ * ivas_jbm_dec_prepare_renderer()
+ *
+ * prepare IVAS JBM renderer routine
+ *--------------------------------------------------------------------------*/
+
+void ivas_jbm_dec_prepare_renderer(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+)
+{
+ Word16 n, n_render_timeslots, tmp, exp;
+
+ push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" );
+
+ /* n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; */
+ tmp = BASOP_Util_Divide1616_Scale( st_ivas->hTcBuffer->n_samples_available, st_ivas->hTcBuffer->n_samples_granularity, &exp );
+ n_render_timeslots = shr( tmp, sub( 15, exp ) ); // Q0
+
+
+ IF( EQ_16( st_ivas->hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_BUFFER ) )
+ {
+ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
+
+ test();
+ test();
+ test();
+ IF( ( EQ_16( st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && st_ivas->hDecoderConfig->Opt_tsm )
+ {
+ ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots );
+ }
+ }
+ ELSE IF( EQ_16( st_ivas->ivas_format, STEREO_FORMAT ) )
+ {
+ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
+ }
+ ELSE IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) )
+ {
+ /* Rendering */
+ IF( EQ_16( st_ivas->ism_mode, ISM_MODE_PARAM ) )
+ {
+ test();
+ test();
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) )
+ {
+ ivas_dirac_dec_set_md_map_fx( st_ivas, n_render_timeslots );
+
+ ivas_param_ism_params_to_masa_param_mapping_fx( st_ivas );
+ }
+ ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_PARAM_ISM ) || EQ_16( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) )
+ {
+ ivas_param_ism_dec_prepare_renderer_fx( st_ivas, n_render_timeslots );
+ }
+ }
+ ELSE /* ISM_MODE_DISC */
+ {
+ ivas_ism_dec_digest_tc_fx( st_ivas );
+ }
+ }
+ ELSE IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, MASA_FORMAT ) )
+ {
+ IF( st_ivas->hSCE[0] )
+ {
+ Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN );
+ IF( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) )
+ {
+ shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 );
+ }
+ scale_sig32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); // Q(31-cngNoiseLevelExp+shift)
+ st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift );
+ }
+ ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
+ }
+ ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
+ {
+
+ IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
+ {
+ ivas_ism_dec_digest_tc_fx( st_ivas );
+
+ test();
+ test();
+ test();
+ test();
+ /* delay the objects here for all renderers where it is needed */
+ IF(
+ (
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_OSBA_AMBI ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_OSBA_LS ) ||
+ EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) &&
+ ( NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) )
+ {
+ FOR( n = 0; n < st_ivas->nchan_ism; n++ )
+ {
+ delay_signal32_fx( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hSbaIsmData->delayBuffer_fx[n], st_ivas->hSbaIsmData->delayBuffer_size );
+ }
+ }
+
+ IF( !st_ivas->sba_dirac_stereo_flag )
+ {
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) )
+ {
+ Word16 temp, temp_e;
+ temp = BASOP_Util_Divide1616_Scale( st_ivas->hTcBuffer->n_samples_granularity, st_ivas->hSpatParamRendCom->slot_size, &temp_e );
+ n_render_timeslots = extract_l( L_shr( L_mult0( n_render_timeslots, temp ), sub( 15, temp_e ) ) );
+ }
+
+ IF( st_ivas->hSCE[0] )
+ {
+ Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN );
+ if ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) )
+ {
+ shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 );
+ }
+ scale_sig32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); // Q(31-cngNoiseLevelExp+shift)
+ st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift );
+ }
+ ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
+ }
+ }
+ ELSE
+ {
+ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
+
+ IF( st_ivas->hSCE[0] )
+ {
+ Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN );
+ if ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) )
+ {
+ shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 );
+ }
+ scale_sig32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); // Q(31-cngNoiseLevelExp+shift)
+ st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift );
+ }
+ ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
+ }
+ }
+ ELSE IF( EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
+ {
+ test();
+ IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) )
+ {
+ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
+ IF( st_ivas->hDecoderConfig->Opt_tsm )
+ {
+ ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots );
+ }
+ }
+ ELSE
+ {
+ test();
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
+ {
+ n_render_timeslots = i_mult( n_render_timeslots, idiv1616( st_ivas->hTcBuffer->n_samples_granularity, st_ivas->hSpatParamRendCom->slot_size ) );
+ }
+
+ IF( st_ivas->hSCE[0] )
+ {
+ Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN );
+ if ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) )
+ {
+ shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 );
+ }
+ scale_sig32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); // Q(31- (st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp - shift)
+ st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift );
+ move16();
+ }
+ ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
+
+ IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
+ {
+ ivas_ism_dec_digest_tc_fx( st_ivas );
+ }
+ }
+
+ test();
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_DIRAC ) )
+ {
+ Word16 num_objects;
+
+ /* Delay the signal to match CLDFB delay. Delay the whole buffer. */
+ num_objects = 0;
+ move16();
+
+ test();
+ test();
+ IF( ( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) )
+ {
+ num_objects = 1;
+ move16();
+ }
+ ELSE IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
+ {
+ num_objects = st_ivas->nchan_ism;
+ move16();
+ }
+ FOR( n = 0; n < num_objects; n++ )
+ {
+ test();
+ IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) )
+ {
+ v_multc_fixed_16( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], OMASA_TDREND_MATCHING_GAIN_FX, st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available );
+ }
+ delay_signal32_fx( st_ivas->hTcBuffer->tc_fx[CPE_CHANNELS + n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size );
+ }
+ }
+ }
+ ELSE IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) )
+ {
+ IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) )
+ {
+ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas );
+ }
+ ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) )
+ {
+ ivas_mc_paramupmix_dec_digest_tc( st_ivas, (UWord8) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
+ }
+ ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMMC ) )
+ {
+ Word16 nchan_transport = st_ivas->nchan_transport;
+ move16();
+ Word16 nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe );
+ Word16 nchan_out_cov;
+ test();
+ test();
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+ {
+ nchan_out_cov = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe );
+ }
+ ELSE IF( EQ_16( st_ivas->hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_CLDFB ) )
+ {
+ nchan_out_cov = nchan_out_transport;
+ move16();
+ }
+ ELSE IF( EQ_16( st_ivas->hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_16( st_ivas->hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) )
+ {
+ nchan_out_cov = add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe );
+ }
+ ELSE
+ {
+ nchan_out_cov = nchan_out_transport;
+ move16();
+ }
+
+ scale_sig32( st_ivas->hParamMC->proto_matrix_int_fx, st_ivas->hParamMC->proto_matrix_int_len, -1 ); // Q(31-1)
+ st_ivas->hParamMC->proto_matrix_int_e = 1;
+ move16();
+
+ ivas_param_mc_dec_prepare_renderer( st_ivas, (UWord8) n_render_timeslots );
+
+ scale_sig32( st_ivas->hParamMC->proto_matrix_int_fx, st_ivas->hParamMC->proto_matrix_int_len, 1 ); // Q(31-1+1)
+
+ Word16 shift;
+ FOR( Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++ )
+ {
+ shift = getScaleFactor32( st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], s_min( st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, nchan_transport * nchan_transport ) );
+ scale_sig32( st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx], s_min( st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_len, i_mult( nchan_transport, nchan_transport ) ), shift ); // Q(31-cx_old_e+shift)
+ st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx] = sub( st_ivas->hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], shift );
+ move16();
+
+ shift = getScaleFactor32( st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], nchan_out_cov * nchan_out_cov );
+ scale_sig32( st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], i_mult( nchan_out_cov, nchan_out_cov ), shift ); // Q(31-cy_old_e+shift)
+ st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = sub( st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], shift );
+ move16();
+ }
+ }
+ ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) )
+ {
+ IF( st_ivas->hSCE[0] )
+ {
+ Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN );
+ if ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) )
+ {
+ shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 );
+ }
+ scale_sig32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, shift ); // Q(31-cngNoiseLevelExp+shift)
+ st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift );
+ move16();
+ }
+ ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available );
+ }
+ }
+
+ pop_wmops();
+ return;
+}
+#endif
diff --git a/lib_dec/ivas_lfe_dec_fx.c b/lib_dec/ivas_lfe_dec_fx.c
index 45e72438a53b1cc34b1e8e0e41e0af6018bad315..29a64da58ad02646b6483d68a94acdc00cb2b2ed 100644
--- a/lib_dec/ivas_lfe_dec_fx.c
+++ b/lib_dec/ivas_lfe_dec_fx.c
@@ -295,7 +295,6 @@ static Word16 ivas_lfe_dec_dequant_fx(
}
-#ifdef NONBE_FIX_MC_LFE_LPF
/*-------------------------------------------------------------------------
* ivas_create_lfe_lpf_dec_fx()
*
@@ -315,7 +314,6 @@ static void ivas_create_lfe_lpf_dec_fx(
return;
}
-#endif
/*-----------------------------------------------------------------------------------------*
* Function ivas_lfe_dec_fx()
@@ -402,14 +400,11 @@ void ivas_lfe_dec_fx(
move32();
j = add( j, shr( output_frame, 5 ) );
}
-#ifdef NONBE_FIX_MC_LFE_LPF
q_out = Q9;
-#endif
}
IF( hLFE->filter_state.order > 0 )
{
- /* NOTE: this block is not getting hit by any stream present in pytest test suite */
/* Low Pass Filter */
ivas_filter_process_fx( &hLFE->filter_state, output_lfe_ch, output_frame, q_out );
}
@@ -433,19 +428,16 @@ void ivas_lfe_dec_fx(
ivas_error ivas_create_lfe_dec_fx(
LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */
const Word32 output_Fs, /* i : output sampling rate Q0*/
-#ifdef NONBE_FIX_MC_LFE_LPF
- const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */
-#else
- const Word32 binauralization_delay_ns /* i : additional LFE delay to sync with binaural renderer */
-#endif
+ const Word32 delay_ns /* i : additional LFE delay to sync other channel outputs */
)
{
Word16 low_pass_delay_dec_out, block_offset_s;
Word16 filt_order, output_frame;
LFE_DEC_HANDLE hLFE;
- Word16 lfe_addl_delay_s;
Word16 i, j;
- Word16 add_delay_sa;
+ Word16 lfe_block_delay_s_fx;
+ Word16 block_offset_samples, lfe_block_delay_samples;
+ Word16 lfe_addl_delay_samples;
Word32 output_fs_fx;
low_pass_delay_dec_out = 0;
@@ -486,7 +478,7 @@ ivas_error ivas_create_lfe_dec_fx(
hLFE->cum_freq_models[1][3] = &ivas_str_lfe_freq_models.entropy_coder_model_coarse_sg4;
/* delay calculation */
- hLFE->lfe_block_delay_s_fx = add( IVAS_LFE_FADE_S_Q15, ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3] ); // Q15
+ lfe_block_delay_s_fx = add( IVAS_LFE_FADE_S_Q15, ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3] ); // Q15
move16();
block_offset_s = BLOCK_OFFSET_S_Q15; // Q15
@@ -496,20 +488,17 @@ ivas_error ivas_create_lfe_dec_fx(
low_pass_delay_dec_out = 0; // Q15
move16();
-#ifdef NONBE_FIX_MC_LFE_LPF
if ( delay_ns > ivas_lfe_lpf_delay_ns[IVAS_FILTER_ORDER_4 - 3] )
{
filt_order = 4;
low_pass_delay_dec_out = ivas_lfe_lpf_delay_Q15[IVAS_FILTER_ORDER_4 - 3];
ivas_create_lfe_lpf_dec_fx( &( hLFE->filter_state ), output_Fs );
}
-#endif
hLFE->filter_state.order = filt_order;
move16();
- hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, low_pass_delay_dec_out ); // Q15
- move16();
- hLFE->lfe_prior_buf_len = NS2SA_FX2( output_Fs, IVAS_LFE_FADE_NS ); // Q0
+ lfe_block_delay_s_fx = add( lfe_block_delay_s_fx, low_pass_delay_dec_out ); // Q15
+ hLFE->lfe_prior_buf_len = NS2SA_FX2( output_Fs, IVAS_LFE_FADE_NS ); // Q0
move16();
hLFE->bfi_count = 0;
@@ -532,25 +521,15 @@ ivas_error ivas_create_lfe_dec_fx(
}
move32();
- lfe_addl_delay_s = sub( block_offset_s, hLFE->lfe_block_delay_s_fx ); // Q15
- lfe_addl_delay_s = s_max( 0, lfe_addl_delay_s );
-#ifdef NONBE_FIX_MC_LFE_LPF
- add_delay_sa = (Word16) W_round64_L( W_mult0_32_32( L_shl( delay_ns, 1 ), output_fs_fx ) ); // Q0
-#else
- add_delay_sa = (Word16) W_round64_L( W_mult0_32_32( L_shl( binauralization_delay_ns, 1 ), output_fs_fx ) ); // Q0
-#endif
- move16();
- hLFE->lfe_addl_delay = add( (Word16) L_shr( imult3216( output_Fs, lfe_addl_delay_s ), 15 ), add_delay_sa ); // Q0
- move16();
- IF( add_delay_sa == 0 )
- {
- hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, lfe_addl_delay_s );
- }
- ELSE
- {
- hLFE->lfe_block_delay_s_fx = add( hLFE->lfe_block_delay_s_fx, add( lfe_addl_delay_s, idiv1616( add_delay_sa, extract_l( output_Fs ) ) ) );
- }
+ block_offset_samples = (Word16) L_shr( imult3216( output_Fs, block_offset_s ), 15 ); // Q0
+ block_offset_samples = add( block_offset_samples, (Word16) W_round64_L( W_mult0_32_32( L_shl( delay_ns, 1 ), output_fs_fx ) ) ); // Q0
+ lfe_block_delay_samples = (Word16) L_shr( imult3216( output_Fs, lfe_block_delay_s_fx ), 15 ); // Q0
+ lfe_addl_delay_samples = sub( block_offset_samples, lfe_block_delay_samples );
+ lfe_addl_delay_samples = s_max( 0, lfe_addl_delay_samples );
+ hLFE->lfe_addl_delay = lfe_addl_delay_samples;
move16();
+ hLFE->delay_ns = delay_ns;
+ move32();
IF( hLFE->lfe_addl_delay > 0 )
{
diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c
old mode 100644
new mode 100755
index a480ce7bebdcb58eb606d72f4f76374b1747370a..ac6da67598a31774ff7531ede0ba5a9052886a02
--- a/lib_dec/ivas_lfe_plc_fx.c
+++ b/lib_dec/ivas_lfe_plc_fx.c
@@ -37,7 +37,6 @@
#include
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*------------------------------------------------------------------------------------------*
* Local constants
@@ -646,7 +645,7 @@ static void d_syn_filt_fx(
}
ELSE
{
- s_fx = W_sub( W_shr( s_fx, sub( s_q_fx, temp_q ) ), temp );
+ s_fx = W_sub( W_shr( s_fx, s_min( 63, sub( s_q_fx, temp_q ) ) ), temp );
s_q_fx = temp_q;
move16();
}
diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c
index 669a5da2fb302d71f2337b6eb6f22cfd313e7704..c333cc21ecea7c2b3634a9815b49e7943a9fb7aa 100644
--- a/lib_dec/ivas_masa_dec_fx.c
+++ b/lib_dec/ivas_masa_dec_fx.c
@@ -42,7 +42,6 @@
#include "prot_fx.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-----------------------------------------------------------------------*
@@ -57,7 +56,7 @@
* Local function prototypes
*-----------------------------------------------------------------------*/
-static Word16 rint_fx( Word32 num );
+static Word16 rint_fx( const Word32 num );
static void index_16bits_fx( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 );
@@ -184,15 +183,31 @@ ivas_error ivas_masa_decode_fx(
test();
IF( NE_32( ivas_format, MC_FORMAT ) || NE_16( st_ivas->mc_mode, MC_MODE_MCMASA ) )
{
-#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
Word16 bits_per_frame = extract_l( Mpy_32_32( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
IF( EQ_32( ivas_format, MASA_FORMAT ) )
{
/* re-read the number of objects, needed in case of bad frame */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ ch = sub( 5, add( st_ivas->bit_stream[sub( bits_per_frame, 3 )], shl( st_ivas->bit_stream[sub( bits_per_frame, 2 )], 1 ) ) );
+
+ if ( EQ_16( ch, 5 ) )
+ {
+ ch = 0;
+ move16();
+ }
+ st_ivas->nchan_ism = ch;
+ move16();
+#else
st_ivas->nchan_ism = sub( 5, add( st_ivas->bit_stream[bits_per_frame - 3], shl( st_ivas->bit_stream[bits_per_frame - 2], 1 ) ) );
+#endif
}
+
test();
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IF( EQ_32( ivas_format, MASA_FORMAT ) && GT_16( st_ivas->nchan_ism, 0 ) )
+#else
IF( EQ_32( ivas_format, MASA_FORMAT ) && NE_16( st_ivas->nchan_ism, 5 ) )
+#endif
{
/* there was OMASA in the input */
hMasa->config.input_ivas_format = MASA_ISM_FORMAT;
@@ -239,7 +254,6 @@ ivas_error ivas_masa_decode_fx(
}
ELSE
{
-#endif
IF( NE_32( ivas_format, MASA_ISM_FORMAT ) )
{
/* number of transport channels is always 2 for MASA_ISM format */
@@ -376,17 +390,7 @@ ivas_error ivas_masa_decode_fx(
}
}
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
-
-#ifndef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
- /* read 2 bits:
- '00' - MASA format at the encoder
- '01' - MASA_ISM_FORMAT at the encoder, with 1 object
- '10' - MASA_ISM_FORMAT at the encoder, with 2 objects
- '11' - MASA_ISM_FORMAT at the encoder, with 3 or 4 objects
- reading if 3 or 4 object is performed later
- */
-#endif
+
byteBuffer = st->bit_stream[st->next_bit_pos];
move16();
st->next_bit_pos = sub( st->next_bit_pos, 1 );
@@ -404,24 +408,6 @@ ivas_error ivas_masa_decode_fx(
hMasa->config.input_ivas_format = MASA_ISM_FORMAT;
move32();
}
-#else
- /* read the MASA_ISM_FORMAT bit */
- byteBuffer = st->bit_stream[( st->next_bit_pos )--];
- move16();
- IF( EQ_32( byteBuffer, 1 ) )
- {
- hMasa->config.input_ivas_format = MASA_ISM_FORMAT;
- }
- ELSE
- {
- hMasa->config.input_ivas_format = MASA_FORMAT;
- }
- move32();
-
- /* reserved bit */
- byteBuffer = st->bit_stream[( st->next_bit_pos )--];
- move16();
-#endif
*nb_bits_read = add( *nb_bits_read, MASA_HEADER_BITS );
/* read number of directions */
@@ -431,9 +417,7 @@ ivas_error ivas_masa_decode_fx(
move16();
hMasa->config.numberOfDirections = (UWord8) L_add( byteBuffer, 1 );
move16();
-#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
}
-#endif
}
ELSE
{
@@ -528,14 +512,12 @@ ivas_error ivas_masa_decode_fx(
}
}
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) )
{
*nb_bits_read = add( *nb_bits_read, ivas_decode_masaism_metadata_fx( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData,
st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos,
st_ivas->hMasaIsmData->idx_separated_ism, ism_imp, st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, st_ivas->hSpatParamRendCom->dirac_md_buffer_length ) );
}
-#endif
ELSE
{
*nb_bits_read = add( *nb_bits_read, ivas_decode_masaism_metadata_fx( hQMetaData, st_ivas->hMasa, st_ivas->hMasaIsmData, st_ivas->nchan_ism, st->bit_stream, &st->next_bit_pos,
@@ -593,13 +575,9 @@ ivas_error ivas_masa_decode_fx(
hMasa->config.coherencePresent = !hQMetaData->all_coherence_zero;
move16();
-#ifdef FIX_1052_EXT_OUTPUT
test();
test();
IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && ( EQ_32( ivas_format, MASA_FORMAT ) || EQ_32( ivas_format, MASA_ISM_FORMAT ) ) )
-#else
- IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#endif
{
index_16bits_fx( hQMetaData, hMasa->data.sph_grid16 );
}
@@ -690,7 +668,6 @@ ivas_error ivas_masa_decode_fx(
ivas_qmetadata_to_dirac_fx( hQMetaData, st_ivas->hDirAC, hMasa, st_ivas->hSpatParamRendCom, ivas_total_brate, ivas_format, 0, 0 );
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) )
{
Word16 index = add( st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx, MAX_PARAM_SPATIAL_SUBFRAMES );
@@ -702,12 +679,12 @@ ivas_error ivas_masa_decode_fx(
st_ivas->hSpatParamRendCom->dirac_bs_md_write_idx = index;
move16();
}
-#endif
+
IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
{
IF( hQMetaData->q_direction == NULL )
{
- if ( NE_32( ( error = ivas_masa_dec_config_fx( st_ivas ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_masa_dec_config_fx( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -858,18 +835,15 @@ ivas_error ivas_masa_dec_open_fx(
ism_total_brate = 0;
move32();
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
/* ISM metadata */
test();
test();
- if ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) &&
- st_ivas->hIsmMetaData[0] != NULL &&
- EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
+ IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && st_ivas->hIsmMetaData[0] != NULL && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
/* these are not needed -> clean. EXT metafile writer in OMASA needs only the number of ISMs and writes default null-data */
ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 );
}
-#endif
test();
test();
test();
@@ -892,13 +866,9 @@ ivas_error ivas_masa_dec_open_fx(
move16();
/* Create spherical grid only for external output */
-#ifdef FIX_1052_EXT_OUTPUT
test();
test();
IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) )
-#else
- IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#endif
{
IF( ( hMasa->data.sph_grid16 = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL )
{
@@ -958,10 +928,9 @@ ivas_error ivas_masa_dec_open_fx(
nchan_transport = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );
nchan_to_allocate = nchan_transport;
move16();
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
test();
test();
-#endif
test();
test();
IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) )
@@ -971,15 +940,11 @@ ivas_error ivas_masa_dec_open_fx(
nchan_to_allocate = 1;
move16();
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
- ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) &&
- ( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) ||
- EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) )
+ ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) )
{
nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
nchan_to_allocate = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
}
-#endif
ELSE IF( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) )
{
/* addtl channel for CNG */
@@ -1155,7 +1120,7 @@ static ivas_error ivas_masa_dec_config_fx(
}
ELSE
{
- st_ivas->hQMetaData->q_direction[i].cfg.nblocks = 4;
+ st_ivas->hQMetaData->q_direction[i].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES;
}
move16();
@@ -1439,7 +1404,6 @@ static ivas_error init_lfe_synth_data_fx(
test();
test();
test();
-#ifdef FIX_1052_EXT_OUTPUT
test();
IF( st_ivas->hOutSetup.separateChannelEnabled &&
( EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1 ) ||
@@ -1449,15 +1413,6 @@ static ivas_error init_lfe_synth_data_fx(
EQ_16( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA2 ) ||
EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ||
( EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && ( st_ivas->hOutSetup.num_lfe > 0 ) ) ) )
-#else
- IF( st_ivas->hOutSetup.separateChannelEnabled &&
- ( EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1 ) ||
- EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) ||
- EQ_16( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) ||
- EQ_16( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA2 ) ||
- EQ_16( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ||
- ( EQ_16( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && ( st_ivas->hOutSetup.num_lfe > 0 ) ) ) )
-#endif
{
Word16 bufferSize;
Word16 i;
@@ -1723,16 +1678,13 @@ static Word16 decode_lfe_to_total_energy_ratio_fx(
* Reconfigure IVAS MASA decoder
*-------------------------------------------------------------------*/
-/*-------------------------------------------------------------------*
- * ivas_masa_dec_reconfigure_fx()
- *
- * Reconfigure IVAS MASA decoder
- *-------------------------------------------------------------------*/
-
ivas_error ivas_masa_dec_reconfigure_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
Word16 *data /* o : output synthesis signal */
+#endif
)
{
Word16 n, tmp, num_bits;
@@ -1745,16 +1697,23 @@ ivas_error ivas_masa_dec_reconfigure_fx(
Word32 ism_total_brate;
Word16 pos_idx;
+#ifndef FIX_HRTF_LOAD
error = IVAS_ERR_OK;
move16();
-
+#endif
ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
move32();
last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;
move32();
test();
+#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
+ test();
+ /* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */
+ IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
+#else
IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) )
+#endif
{
Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes;
@@ -1774,26 +1733,40 @@ ivas_error ivas_masa_dec_reconfigure_fx(
test();
test();
test();
+#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
+ test();
+#endif
IF( ( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && st_ivas->hDirACRend == NULL ) ||
( ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) && st_ivas->hDiracDecBin[0] == NULL ) )
{
/* init a new DirAC dec */
- if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK )
+ IF( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK )
{
return error;
}
}
+#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
+ ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_DISABLE ) || EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) )
+ {
+ /* close all unnecessary parametric decoding and rendering */
+ ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
+ ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
+ ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
+ ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
+ }
+#else
ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_DISABLE ) || EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) )
{
IF( st_ivas->hDirAC != NULL )
{
/* close all unnecessary parametric decoding and rendering */
- ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
+ ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
}
}
+#endif
/* possible reconfigure is done later */
/*-----------------------------------------------------------------*
@@ -1819,7 +1792,6 @@ ivas_error ivas_masa_dec_reconfigure_fx(
FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
{
-
// st_ivas->hSCE[sce_id]->element_brate = ivas_total_brate / st_ivas->nchan_transport;
st_ivas->hSCE[sce_id]->element_brate = L_deposit_h( BASOP_Util_Divide3216_Scale( ivas_total_brate, st_ivas->nchan_transport, &tmp_e ) );
st_ivas->hSCE[sce_id]->element_brate = L_shr( st_ivas->hSCE[sce_id]->element_brate, sub( 15, tmp_e ) ); // Q0
@@ -1841,7 +1813,7 @@ ivas_error ivas_masa_dec_reconfigure_fx(
test();
IF( ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) && st_ivas->hDiracDecBin[0] != NULL )
{
- if ( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1884,8 +1856,16 @@ ivas_error ivas_masa_dec_reconfigure_fx(
test();
test();
test();
+#ifdef NONBE_FIX_1143_MASA_BRSW
+ test();
+ test();
+ IF( ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && GE_32( last_ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) ||
+ ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_32( last_ivas_total_brate, FRAME_NO_DATA ) ) ||
+ ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_32( last_ivas_total_brate, IVAS_SID_5k2 ) ) )
+#else
IF( ( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && GE_32( last_ivas_total_brate, MASA_STEREO_MIN_BITRATE ) ) ||
( LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_32( last_ivas_total_brate, FRAME_NO_DATA ) ) )
+#endif
{
st_ivas->hCPE[cpe_id]->nchan_out = 1;
move16();
@@ -1897,7 +1877,7 @@ ivas_error ivas_masa_dec_reconfigure_fx(
test();
IF( ( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && st_ivas->hDirACRend != NULL ) || ( ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) && st_ivas->hDiracDecBin[0] != NULL ) )
{
- if ( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1915,7 +1895,7 @@ ivas_error ivas_masa_dec_reconfigure_fx(
test();
IF( ( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && st_ivas->hDirACRend != NULL ) || ( ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) && st_ivas->hDiracDecBin[0] != NULL ) )
{
- if ( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK )
+ IF( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -1939,6 +1919,7 @@ ivas_error ivas_masa_dec_reconfigure_fx(
/*-----------------------------------------------------------------*
* TD Decorrelator
*-----------------------------------------------------------------*/
+
IF( st_ivas->hDiracDecBin[0] != NULL )
{
IF( NE_32( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ), IVAS_ERR_OK ) )
@@ -1950,6 +1931,7 @@ ivas_error ivas_masa_dec_reconfigure_fx(
/*-----------------------------------------------------------------*
* CLDFB instances
*-----------------------------------------------------------------*/
+
IF( st_ivas->hSpar )
{
Word16 Q_tmp = getScaleFactor16( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 16 );
@@ -1957,7 +1939,8 @@ ivas_error ivas_masa_dec_reconfigure_fx(
st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_tmp;
move16();
}
- if ( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) )
+
+ IF( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, st_ivas->nchan_transport, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -1986,7 +1969,6 @@ ivas_error ivas_masa_dec_reconfigure_fx(
IF( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) )
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
IF( NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
move16();
@@ -1994,10 +1976,6 @@ ivas_error ivas_masa_dec_reconfigure_fx(
with reading of the format: nchan_ism is needed in MASA format because for the EXT output in
MASA-only (pre-rendering mode of OMASA) the number of ISMs to output correct number of empty objects is needed */
}
-#else
- st_ivas->nchan_ism = 0;
- move16();
-#endif
st_ivas->ism_mode = ISM_MODE_NONE;
move16();
}
@@ -2020,19 +1998,13 @@ ivas_error ivas_masa_dec_reconfigure_fx(
test();
test();
test();
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
test();
test();
-#endif
IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) )
{
IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
{
-#ifdef FIX_1222_OMASA_DEC_CHANNEL_BUFFERS
tc_nchan_to_allocate = add( BINAURAL_CHANNELS, st_ivas->nchan_ism );
-#else
- tc_nchan_to_allocate = add( shl( BINAURAL_CHANNELS, 1 ), 2 );
-#endif
}
ELSE
{
@@ -2046,7 +2018,7 @@ ivas_error ivas_masa_dec_reconfigure_fx(
n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */
IF( GT_16( n_samples_granularity, st_ivas->hTcBuffer->n_samples_granularity ) )
{
- if ( NE_32( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2056,10 +2028,14 @@ ivas_error ivas_masa_dec_reconfigure_fx(
{
IF( LT_16( n_samples_granularity, st_ivas->hTcBuffer->n_samples_granularity ) )
{
+#ifdef FIX_HRTF_LOAD
+ /* flush already done in IVAS_DEC_ReadFormat() */
+#else
if ( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, n_samples_granularity, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, MC_MODE_NONE, ISM_MASA_MODE_DISC, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
{
return error;
}
+#endif
}
}
}
@@ -2068,20 +2044,16 @@ ivas_error ivas_masa_dec_reconfigure_fx(
/* addtl channel for CNG */
tc_nchan_to_allocate = add( tc_nchan_to_allocate, 1 );
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
- ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) &&
- ( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) ||
- EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) )
+ ELSE IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && ( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) )
{
tc_nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
tc_nchan_to_allocate = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
}
-#endif
test();
test();
IF( NE_16( tc_nchan_transport, st_ivas->hTcBuffer->nchan_transport_jbm ) || NE_16( tc_nchan_to_allocate, st_ivas->hTcBuffer->nchan_transport_internal ) || NE_16( buffer_mode_new, st_ivas->hTcBuffer->tc_buffer_mode ) )
{
- if ( NE_32( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, buffer_mode_new, tc_nchan_transport, tc_nchan_to_allocate, tc_nchan_to_allocate, n_samples_granularity ), IVAS_ERR_OK ) )
+ IF( NE_32( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, buffer_mode_new, tc_nchan_transport, tc_nchan_to_allocate, tc_nchan_to_allocate, n_samples_granularity ), IVAS_ERR_OK ) )
{
return error;
}
@@ -2110,7 +2082,11 @@ ivas_error ivas_masa_dec_reconfigure_fx(
}
}
+#ifdef FIX_HRTF_LOAD
+ return IVAS_ERR_OK;
+#else
return error;
+#endif
}
@@ -2698,21 +2674,12 @@ static void create_masa_ext_out_meta_fx(
IVAS_QMETADATA_HANDLE hQMetaData,
const Word16 nchan_transport )
{
- const UWord8 ivasmasaFormatDescriptor[8] = { 0x49, 0x56, 0x41, 0x53, 0x4D, 0x41, 0x53, 0x41 }; /* "IVASMASA" */
Word16 i, sf, b_old, b_new, dir;
MASA_DECRIPTIVE_META *descMeta;
Word16 *bandMap;
UWord8 numCodingBands;
UWord8 numDirections;
MASA_DECODER_EXT_OUT_META *extOutMeta;
- move16(); /*ivasmasaFormatDescriptor*/
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
numDirections = hMasa->config.numberOfDirections;
move16();
@@ -3514,14 +3481,13 @@ static Word16 ivas_decode_masaism_metadata_fx(
hMasaIsmData->energy_ratio_ism_fx[dir][meta_write_index][b] = energy_ratio_ism_fx[i][band][dir];
move32();
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
IF( hMasaIsmData->hExtData != NULL )
{
hMasaIsmData->hExtData->masa_render_masa_to_total[meta_write_index][b] =
hMasaIsmData->masa_to_total_energy_ratio_fx[i][band];
move32();
}
-#endif
}
}
}
@@ -3529,11 +3495,13 @@ static Word16 ivas_decode_masaism_metadata_fx(
return sub( nb_bits_read, *next_bit_pos );
}
+
/*
Fixed point implementation of rint().
*/
-static Word16 rint_fx( /* returns in Q0 */
- Word32 num /* num in Q0 */
+/* returns in Q0 */
+static Word16 rint_fx(
+ const Word32 num /* num in Q0 */
)
{
Word32 frac_part = L_and( L_abs( num ), 0x0000FFFF ); // Q15
diff --git a/lib_dec/ivas_mc_param_dec_fx.c b/lib_dec/ivas_mc_param_dec_fx.c
index 230c210b76eb405e184962180855d12fc95c1082..250b37675be3e1d0c4432fa5bc2863ddc064b91b 100644
--- a/lib_dec/ivas_mc_param_dec_fx.c
+++ b/lib_dec/ivas_mc_param_dec_fx.c
@@ -165,11 +165,7 @@ ivas_error ivas_param_mc_dec_open_fx(
test();
test();
test();
-#ifdef FIX_1052_EXT_OUTPUT
IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) || EQ_32( st_ivas->transport_config, output_config ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#else
- IF( EQ_32( st_ivas->renderer_type, RENDERER_SBA_LINEAR_ENC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) || EQ_32( st_ivas->transport_config, output_config ) )
-#endif
{
hParamMC->synthesis_conf = PARAM_MC_SYNTH_DIRECT;
move32();
@@ -252,12 +248,7 @@ ivas_error ivas_param_mc_dec_open_fx(
*-----------------------------------------------------------------*/
// hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX;
- Word16 temp_e;
- Word16 temp = BASOP_Util_Divide3232_Scale( output_Fs, FRAMES_PER_SEC, &temp_e );
- temp = shr( temp, sub( 15, temp_e ) ); // Going back to Q0
- temp = BASOP_Util_Divide1616_Scale( temp, CLDFB_NO_COL_MAX, &temp_e );
- temp = shr( temp, sub( 15, temp_e ) ); // Going back to Q0
- hParamMC->slot_size = temp;
+ hParamMC->slot_size = shr( extract_l( Mpy_32_32_r( output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), 4 );
move16();
set16_fx( hParamMC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS );
set16_fx( hParamMC->subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS );
@@ -1528,40 +1519,53 @@ void ivas_param_mc_dec_digest_tc_fx(
Word16 transport_f_e )
{
PARAM_MC_DEC_HANDLE hParamMC;
+#ifdef OBJ_EDITING_API
+ Word16 ch, slot_idx;
+ Word16 nchan_transport;
+#else
Word16 i, ch;
Word16 is_next_band, skip_next_band;
Word16 slot_idx, param_band_idx;
Word16 nchan_transport, nchan_out_transport, nchan_out_cldfb;
Word16 nchan_out_cov;
+#endif
/*CLDFB*/
- /* format converter */
- Word16 channel_active[MAX_OUTPUT_CHANNELS];
- IVAS_OUTPUT_SETUP *hSynthesisOutputSetup;
hParamMC = st_ivas->hParamMC;
assert( hParamMC );
+
+#ifndef OBJ_EDITING_API
Word32 *pCx, *pCx_imag;
Word32 cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_e)
Word32 cx_imag_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_imag_e)
Word32 cx_next_band_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_next_band_e)
Word32 cx_imag_next_band_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_imag_next_band_e)
+ Word32 real_part_fx, imag_part_fx, L_tmp1, L_tmp2;
Word16 cx_buff_e[2][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
Word16 cx_e;
Word16 cx_imag_e, tmp_e;
Word16 cx_imag_next_band_e, cx_next_band_e;
+
+ Word16 max_e;
+
+ /* format converter */
+ Word16 channel_active[MAX_OUTPUT_CHANNELS];
+ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup;
+#endif
Word16 qout = 0;
move16();
- Word32 real_part_fx, imag_part_fx, L_tmp1, L_tmp2;
-
- Word16 max_e;
push_wmops( "param_mc_dec_digest_tc" );
+#ifndef OBJ_EDITING_API
set16_fx( channel_active, 0, MAX_CICP_CHANNELS );
+#endif
nchan_transport = st_ivas->nchan_transport;
move16();
+
+#ifndef OBJ_EDITING_API
nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe );
test();
@@ -1638,13 +1642,17 @@ void ivas_param_mc_dec_digest_tc_fx(
move16();
cx_imag_next_band_e = 0;
move16();
+#endif
+
/* slot loop for gathering the input data */
FOR( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ )
{
IF( st_ivas->hDecoderConfig->Opt_tsm )
{
+#ifndef OBJ_EDITING_API
IF( param_band_idx == 0 ) /* only run cldfbAna once */
{
+#endif
Word32 RealBuffer_fx[CLDFB_NO_CHANNELS_MAX];
Word32 ImagBuffer_fx[CLDFB_NO_CHANNELS_MAX];
@@ -1661,8 +1669,12 @@ void ivas_param_mc_dec_digest_tc_fx(
hParamMC->Cldfb_ImagBuffer_tc_e = qout;
move16();
+#ifndef OBJ_EDITING_API
}
+#endif
}
+
+#ifndef OBJ_EDITING_API
IF( GE_16( slot_idx, shl( hParamMC->hMetadataPMC->attackIndex, 1 ) ) )
{
FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
@@ -1702,8 +1714,10 @@ void ivas_param_mc_dec_digest_tc_fx(
}
}
}
+#endif
}
+#ifndef OBJ_EDITING_API
Word16 tmp_cx_e, tmp_cx_imag_e;
/* map from complex input covariance to real values */
FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
@@ -1799,8 +1813,17 @@ void ivas_param_mc_dec_digest_tc_fx(
test();
IF( hParamMC->hMetadataPMC->bAttackPresent && ( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) )
{
- v_add_fx( cx_fx, cx_next_band_fx, cx_fx, imult1616( nchan_transport, nchan_transport ) );
- Copy32( cx_fx, cx_next_band_fx, imult1616( nchan_transport, nchan_transport ) );
+ Word16 len = imult1616( nchan_transport, nchan_transport );
+ Word16 sc = s_min( getScaleFactor32( cx_fx, len ), getScaleFactor32( cx_next_band_fx, len ) );
+ IF( EQ_16( sc, 0 ) )
+ {
+ Scale_sig32( cx_fx, len, -Q1 ); // add one bit head room
+ Scale_sig32( cx_next_band_fx, len, -Q1 ); // add one bit head room
+ cx_e = add( cx_e, Q1 );
+ cx_next_band_e = add( cx_e, Q1 );
+ }
+ v_add_fx( cx_fx, cx_next_band_fx, cx_fx, len );
+ Copy32( cx_fx, cx_next_band_fx, len );
}
FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
@@ -1826,12 +1849,312 @@ void ivas_param_mc_dec_digest_tc_fx(
}
}
}
+#endif
pop_wmops();
return;
}
+#ifdef OBJ_EDITING_API
+/*-------------------------------------------------------------------------
+ * ivas_param_mc_dec_prepare_renderer()
+ *
+ *
+ *------------------------------------------------------------------------*/
+
+void ivas_param_mc_dec_prepare_renderer(
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ const UWord8 nCldfbSlots /* i : number of CLFBS slots in the transport channels */
+)
+{
+ Word16 i;
+ Word16 is_next_band, skip_next_band;
+ Word16 slot_idx, param_band_idx;
+ Word16 nchan_transport, nchan_out_transport, nchan_out_cldfb;
+ Word16 nchan_out_cov;
+ PARAM_MC_DEC_HANDLE hParamMC;
+
+ Word32 *pCx, *pCx_imag;
+ Word32 cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_e)
+ Word32 cx_imag_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_imag_e)
+ Word32 cx_next_band_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_next_band_e)
+ Word32 cx_imag_next_band_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; // Q(31 - cx_imag_next_band_e)
+ Word32 real_part_fx, imag_part_fx, L_tmp1, L_tmp2;
+
+ Word16 cx_buff_e[2][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
+ Word16 cx_e;
+ Word16 cx_imag_e, tmp_e;
+ Word16 cx_imag_next_band_e, cx_next_band_e;
+
+ Word16 max_e;
+
+ /* format converter */
+ Word16 channel_active[MAX_OUTPUT_CHANNELS];
+ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup;
+
+ hParamMC = st_ivas->hParamMC;
+ assert( hParamMC );
+
+ set16_fx( channel_active, 0, MAX_CICP_CHANNELS );
+
+ nchan_transport = st_ivas->nchan_transport;
+ move16();
+
+ nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe );
+
+ test();
+ test();
+ IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
+ {
+ nchan_out_cldfb = BINAURAL_CHANNELS;
+ move16();
+ set16_fx( channel_active, 1, nchan_out_cldfb );
+ nchan_out_cov = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe );
+ hSynthesisOutputSetup = &st_ivas->hTransSetup;
+ }
+ ELSE IF( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_CLDFB ) )
+ {
+ nchan_out_cov = nchan_out_transport;
+ move16();
+ nchan_out_cldfb = add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe );
+ hSynthesisOutputSetup = &st_ivas->hTransSetup;
+ }
+ ELSE IF( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) )
+ {
+ nchan_out_cov = add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe );
+ nchan_out_cldfb = nchan_out_cov;
+ move16();
+ set16_fx( channel_active, 1, nchan_out_cov );
+ hSynthesisOutputSetup = &st_ivas->hOutSetup;
+ }
+ ELSE
+ {
+ nchan_out_cov = nchan_out_transport;
+ move16();
+ nchan_out_cldfb = nchan_out_transport;
+ move16();
+ set16_fx( channel_active, 1, nchan_out_cov );
+ hSynthesisOutputSetup = &st_ivas->hTransSetup;
+ }
+
+ /* adapt transient position */
+ IF( hParamMC->hMetadataPMC->bAttackPresent )
+ {
+ hParamMC->hMetadataPMC->attackIndex = s_max( 0, add( hParamMC->hMetadataPMC->attackIndex, shr( sub( nCldfbSlots, DEFAULT_JBM_CLDFB_TIMESLOTS ), 1 ) ) );
+ move16();
+ }
+ /* adapt subframes */
+ hParamMC->num_slots = nCldfbSlots;
+ move16();
+ hParamMC->slots_rendered = 0;
+ move16();
+ hParamMC->subframes_rendered = 0;
+ move16();
+ ivas_jbm_dec_get_adapted_subframes( nCldfbSlots, hParamMC->subframe_nbslots, &hParamMC->nb_subframes );
+ st_ivas->hTcBuffer->nb_subframes = hParamMC->nb_subframes;
+ move16();
+ Copy( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes );
+
+ ivas_param_mc_dec_compute_interpolator_fx( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator_fx );
+
+ /* loop over two bands at a time */
+ FOR( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
+ {
+ /* don't process next band if it exceeds the limit */
+ skip_next_band = ( ( param_band_idx + 1 ) == hParamMC->num_param_bands_synth ) ? 1 : 0;
+
+ set_zero_fx( cx_fx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
+ set_zero_fx( cx_imag_fx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
+ set_zero_fx( cx_next_band_fx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
+ set_zero_fx( cx_imag_next_band_fx, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
+
+ cx_e = 0;
+ move16();
+ cx_imag_e = 0;
+ move16();
+ cx_next_band_e = 0;
+ move16();
+ cx_imag_next_band_e = 0;
+ move16();
+
+ /* slot loop for gathering the input data */
+ FOR( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ )
+ {
+ IF( GE_16( slot_idx, shl( hParamMC->hMetadataPMC->attackIndex, 1 ) ) )
+ {
+ FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
+ {
+ test();
+ IF( is_next_band && skip_next_band )
+ {
+ CONTINUE;
+ }
+ IF( is_next_band )
+ {
+ ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport],
+ /*hParamMC->Cldfb_RealBuffer_tc_e*/ Q31 - Q6,
+ &hParamMC->Cldfb_ImagBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport],
+ /*hParamMC->Cldfb_ImagBuffer_tc_e*/ Q31 - Q6,
+ cx_next_band_fx,
+ &cx_next_band_e,
+ cx_imag_next_band_fx,
+ &cx_imag_next_band_e,
+ hParamMC,
+ add( param_band_idx, is_next_band ),
+ nchan_transport );
+ }
+ ELSE
+ {
+ ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport],
+ /*hParamMC->Cldfb_RealBuffer_tc_e*/ Q31 - Q6,
+ &hParamMC->Cldfb_ImagBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport],
+ /*hParamMC->Cldfb_ImagBuffer_tc_e*/ Q31 - Q6,
+ cx_fx,
+ &cx_e,
+ cx_imag_fx,
+ &cx_imag_e,
+ hParamMC,
+ add( param_band_idx, is_next_band ),
+ nchan_transport );
+ }
+ }
+ }
+ }
+ Word16 tmp_cx_e, tmp_cx_imag_e;
+ /* map from complex input covariance to real values */
+ FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
+ {
+ test();
+ IF( is_next_band && skip_next_band )
+ {
+ CONTINUE;
+ }
+ /* Cx for transport channels */
+ IF( is_next_band )
+ {
+ pCx = &cx_next_band_fx[0];
+ pCx_imag = &cx_imag_next_band_fx[0];
+ tmp_cx_e = cx_next_band_e;
+ tmp_cx_imag_e = cx_imag_next_band_e;
+ }
+ ELSE
+ {
+ pCx = &cx_fx[0];
+ pCx_imag = &cx_imag_fx[0];
+ tmp_cx_e = cx_e;
+ tmp_cx_imag_e = cx_imag_e;
+ }
+
+ FOR( i = 0; i < nchan_transport * nchan_transport; i++ )
+ {
+ real_part_fx = pCx[i]; // Q(31 - cx_buff_e)
+ imag_part_fx = pCx_imag[i];
+ move32();
+ move32();
+ cx_buff_e[is_next_band][i] = tmp_cx_e;
+ move16();
+ /* (a-ib)(c+id) = ac + bd + i(ad-bc) */
+ IF( LT_16( param_band_idx, hParamMC->max_param_band_abs_cov ) )
+ {
+ L_tmp1 = Mpy_32_32( real_part_fx, real_part_fx );
+ L_tmp2 = Mpy_32_32( imag_part_fx, imag_part_fx );
+ L_tmp1 = BASOP_Util_Add_Mant32Exp( L_tmp1, add( tmp_cx_e, tmp_cx_e ), L_tmp2, add( tmp_cx_imag_e, tmp_cx_imag_e ), &tmp_e );
+ pCx[i] = Sqrt32( L_tmp1, &tmp_e );
+ move32();
+ cx_buff_e[is_next_band][i] = tmp_e;
+ move16();
+ }
+ ELSE
+ {
+ pCx[i] = real_part_fx;
+ move32();
+ cx_buff_e[is_next_band][i] = tmp_cx_e;
+ move16();
+ }
+ }
+ }
+
+ max_e = cx_buff_e[0][0];
+ move16();
+
+ /* Cx for transport channels */
+ FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
+ {
+ FOR( i = 0; i < imult1616( nchan_transport, nchan_transport ); i++ )
+ {
+
+ IF( LT_16( max_e, cx_buff_e[is_next_band][i] ) )
+ {
+ max_e = cx_buff_e[is_next_band][i];
+ }
+ }
+ }
+ /* Cx for transport channels */
+ FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
+ {
+ FOR( i = 0; i < imult1616( nchan_transport, nchan_transport ); i++ )
+ {
+ if ( is_next_band == 0 )
+ {
+ cx_fx[i] = L_shr( cx_fx[i], sub( max_e, cx_buff_e[is_next_band][i] ) );
+ }
+ else
+ {
+ cx_next_band_fx[i] = L_shr( cx_next_band_fx[i], sub( max_e, cx_buff_e[is_next_band][i] ) );
+ }
+ move32();
+ }
+ }
+ cx_e = max_e;
+ move16();
+
+
+ /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/
+
+ test();
+ test();
+ IF( hParamMC->hMetadataPMC->bAttackPresent && ( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) )
+ {
+ Word16 len = imult1616( nchan_transport, nchan_transport );
+ Word16 sc = s_min( getScaleFactor32( cx_fx, len ), getScaleFactor32( cx_next_band_fx, len ) );
+ IF( EQ_16( sc, 0 ) )
+ {
+ Scale_sig32( cx_fx, len, -Q1 ); // add one bit head room
+ Scale_sig32( cx_next_band_fx, len, -Q1 ); // add one bit head room
+ cx_e = add( cx_e, Q1 );
+ cx_next_band_e = add( cx_e, Q1 );
+ }
+ v_add_fx( cx_fx, cx_next_band_fx, cx_fx, len );
+ Copy32( cx_fx, cx_next_band_fx, len );
+ }
+
+ FOR( is_next_band = 0; is_next_band < 2; is_next_band++ )
+ {
+ test();
+ IF( is_next_band && skip_next_band )
+ {
+ CONTINUE;
+ }
+
+ IF( NE_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) )
+ {
+ IF( is_next_band )
+ {
+
+ ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_next_band_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
+ }
+ ELSE
+ {
+
+ ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_fx, cx_e, add( param_band_idx, is_next_band ), hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov );
+ }
+ }
+ }
+ }
+}
+#endif
+
/*-------------------------------------------------------------------------
* ivas_param_mc_dec()
*
diff --git a/lib_dec/ivas_mc_paramupmix_dec_fx.c b/lib_dec/ivas_mc_paramupmix_dec_fx.c
index 7c3581c93addff59a68781ea773fd02ec2b9f018..fa36c4f34adb85aa4c40ac21d3ca6ea4caaf176c 100644
--- a/lib_dec/ivas_mc_paramupmix_dec_fx.c
+++ b/lib_dec/ivas_mc_paramupmix_dec_fx.c
@@ -44,16 +44,18 @@
#include "math.h"
#include "wmc_auto.h"
#include "rom_dec.h"
-#include "ivas_rom_com_fx.h"
+
/*-----------------------------------------------------------------------*
* Local arrays
*-----------------------------------------------------------------------*/
/* boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */
-const Word16 MC_PARAMUPMIX_CHIDX1[MC_PARAMUPMIX_COMBINATIONS] = { 0, 1, 4, 5 };
-const Word16 MC_PARAMUPMIX_CHIDX2[MC_PARAMUPMIX_COMBINATIONS] = { 2, 3, 6, 7 };
-const Word16 qmf_to_par_band[] = {
+static const Word16 MC_PARAMUPMIX_CHIDX1[MC_PARAMUPMIX_COMBINATIONS] = { 0, 1, 4, 5 };
+
+static const Word16 MC_PARAMUPMIX_CHIDX2[MC_PARAMUPMIX_COMBINATIONS] = { 2, 3, 6, 7 };
+
+static const Word16 qmf_to_par_band[] = {
0, 1, 2, 3, 4, 5, 5, 6, 6, 7,
7, 7, 8, 8, 8, 8, 9, 9, 9, 9,
9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
@@ -62,6 +64,7 @@ const Word16 qmf_to_par_band[] = {
11, 11, 11, 11, 11, 11, 11, 11, 11, 11
};
+
/*-----------------------------------------------------------------------*
* Local function prototypes
*-----------------------------------------------------------------------*/
@@ -960,22 +963,30 @@ static void ivas_mc_paramupmix_dec_sf(
{
FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
{
- Word32 tmp_buf_fx[L_SUBFRAME5MS_48k];
- Copy32( &output_fx[ch][n_samples_rendered - noparamupmix_delay], tmp_buf_fx, noparamupmix_delay );
- Copy32( output_fx[ch], &output_fx[ch][noparamupmix_delay], sub( n_samples_rendered, noparamupmix_delay ) );
- Copy32( hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], noparamupmix_delay );
- Copy32( tmp_buf_fx, hMCParamUpmix->pcm_delay_fx[ch], noparamupmix_delay );
+ /*delay is handled within LFE decoder*/
+ IF( NE_16( st_ivas->hIntSetup.index_lfe[0], ch ) )
+ {
+ Word32 tmp_buf_fx[L_SUBFRAME5MS_48k];
+ Copy32( &output_fx[ch][n_samples_rendered - noparamupmix_delay], tmp_buf_fx, noparamupmix_delay );
+ Copy32( output_fx[ch], &output_fx[ch][noparamupmix_delay], sub( n_samples_rendered, noparamupmix_delay ) );
+ Copy32( hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], noparamupmix_delay );
+ Copy32( tmp_buf_fx, hMCParamUpmix->pcm_delay_fx[ch], noparamupmix_delay );
+ }
}
}
ELSE
{
FOR( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ )
{
- Word32 tmp_buf_fx[L_SUBFRAME5MS_48k];
- Copy32( &output_fx[ch][0], tmp_buf_fx, n_samples_rendered );
- Copy32( hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], n_samples_rendered );
- Copy32( &hMCParamUpmix->pcm_delay_fx[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay_fx[ch][0], sub( noparamupmix_delay, n_samples_rendered ) );
- Copy32( tmp_buf_fx, &hMCParamUpmix->pcm_delay_fx[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered );
+ /*delay is handled within LFE decoder*/
+ IF( NE_16( st_ivas->hIntSetup.index_lfe[0], ch ) )
+ {
+ Word32 tmp_buf_fx[L_SUBFRAME5MS_48k];
+ Copy32( &output_fx[ch][0], tmp_buf_fx, n_samples_rendered );
+ Copy32( hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], n_samples_rendered );
+ Copy32( &hMCParamUpmix->pcm_delay_fx[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay_fx[ch][0], sub( noparamupmix_delay, n_samples_rendered ) );
+ Copy32( tmp_buf_fx, &hMCParamUpmix->pcm_delay_fx[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered );
+ }
}
}
}
diff --git a/lib_dec/ivas_mct_core_dec_fx.c b/lib_dec/ivas_mct_core_dec_fx.c
index 2762fc835de4fabc7fcfac06fdcafd3958054922..3a2cd3118ae5b7ababf7726087d91f5e0f2626dd 100644
--- a/lib_dec/ivas_mct_core_dec_fx.c
+++ b/lib_dec/ivas_mct_core_dec_fx.c
@@ -62,7 +62,7 @@ void ivas_mct_side_bits_fx(
{
Word16 ch, cpe_id, nChannels, i, k, nSubframes;
Word16 nf_side_bits, availableBits, next_bit_pos, nf_bits;
- Word16 chBitRatios[MCT_MAX_CHANNELS], tmp, scale;
+ Word16 chBitRatios[MCT_MAX_CHANNELS], tmp;
Decoder_State *st, *sts[MCT_MAX_CHANNELS];
nf_side_bits = 0;
@@ -75,9 +75,16 @@ void ivas_mct_side_bits_fx(
{
FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
{
- sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
- i = add( i, 1 );
- move16();
+#ifdef ADJUST_MCT_CHANNELS_MAX
+ IF( LT_16( i, MCT_MAX_CHANNELS ) )
+ {
+#endif
+ sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
+ i = add( i, 1 );
+ move16();
+#ifdef ADJUST_MCT_CHANNELS_MAX
+ }
+#endif
}
}
@@ -142,9 +149,7 @@ void ivas_mct_side_bits_fx(
}
}
- tmp = BASOP_Util_Divide3232_Scale( ivas_total_brate, FRAMES_PER_SEC, &scale );
- tmp = shr( tmp, sub( 15, scale ) );
-
+ tmp = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
availableBits = ( sub( sub( tmp, sts[0]->next_bit_pos ), nf_side_bits ) );
availableBits = sub( availableBits, nb_bits_metadata );
@@ -220,10 +225,19 @@ void ivas_mct_core_dec(
{
FOR( ch = 0; ch < CPE_CHANNELS; ( ch++, i++ ) )
{
- sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
+#ifdef ADJUST_MCT_CHANNELS_MAX
+ IF( LT_16( i, MCT_MAX_CHANNELS ) )
+ {
+#endif
+ sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
+#ifdef ADJUST_MCT_CHANNELS_MAX
+ }
+#endif
}
}
+#ifndef ADJUST_MCT_CHANNELS_MAX
+ /*seems like obsolete code*/
i = 0;
move16();
FOR( ch = 0; ch < nChannels; ch++ )
@@ -234,7 +248,7 @@ void ivas_mct_core_dec(
}
i = add( i, 1 );
}
-
+#endif
bfi = sts[0]->bfi;
move16();
diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c
index 8d6005ee5188c39dbf217585febd822651631602..cb533bb5a0328bcdaf20013c484d0184613e08ce 100644
--- a/lib_dec/ivas_mct_dec_fx.c
+++ b/lib_dec/ivas_mct_dec_fx.c
@@ -48,7 +48,11 @@
* Local function prototypes
*-----------------------------------------------------------------------*/
+#ifdef FIX_HRTF_LOAD
+static ivas_error ivas_mc_dec_reconfig_fx( Decoder_Struct *st_ivas );
+#else
static ivas_error ivas_mc_dec_reconfig_fx( Decoder_Struct *st_ivas, UWord16 *nSamplesRendered, Word16 *data );
+#endif
/*--------------------------------------------------------------------------*
@@ -816,10 +820,13 @@ void ivas_mct_dec_close(
/*! r : MC format mode */
ivas_error ivas_mc_dec_config_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
- const Word16 idx, /* i : LS config. index */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ const Word16 idx /* i : LS config. index */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesRendered, /* o : samples flushed from last frame (JBM) */
Word16 *data /* o : output synthesis signal */
+#endif
)
{
AUDIO_CONFIG signaled_config;
@@ -849,11 +856,7 @@ ivas_error ivas_mc_dec_config_fx(
IF( st_ivas->ini_frame != 0 )
{
test();
-#ifdef FIX_1052_EXT_OUTPUT
IF( NE_32( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->hDecoderConfig->ivas_total_brate ) || last_mc_mode != st_ivas->mc_mode )
-#else
- IF( NE_32( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->hDecoderConfig->ivas_total_brate ) || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode )
-#endif
{
IF( st_ivas->hRenderConfig )
{
@@ -863,10 +866,16 @@ ivas_error ivas_mc_dec_config_fx(
move16();
}
}
+
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_mc_dec_reconfig_fx( st_ivas ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_mc_dec_reconfig_fx( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
+
IF( st_ivas->hRenderConfig )
{
FOR( Word16 i = 0; i < 4; i++ )
@@ -893,9 +902,12 @@ ivas_error ivas_mc_dec_config_fx(
*-------------------------------------------------------------------------*/
static ivas_error ivas_mc_dec_reconfig_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */
Word16 *data /* o : output synthesis signal */
+#endif
)
{
Word16 nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old;
@@ -909,12 +921,17 @@ static ivas_error ivas_mc_dec_reconfig_fx(
Word16 tc_nchan_tc_new;
Word16 tc_nchan_allocate_new;
Word16 tc_granularity_new;
+#ifndef FIX_HRTF_LOAD
AUDIO_CONFIG intern_config_old;
IVAS_OUTPUT_SETUP hIntSetupOld;
+#endif
Word16 nchan_out_buff_old, nchan_out_buff;
+
+#ifndef FIX_HRTF_LOAD
error = IVAS_ERR_OK;
move32();
+#endif
ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
move32();
nchan_transport_old = st_ivas->nchan_transport;
@@ -953,13 +970,14 @@ static ivas_error ivas_mc_dec_reconfig_fx(
st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas );
move16();
+#ifndef FIX_HRTF_LOAD
/* save old IntSetup, might be needed for JBM flushing...*/
intern_config_old = st_ivas->intern_config;
move32();
hIntSetupOld = st_ivas->hIntSetup;
tc_granularity_new = 1;
move16();
-
+#endif
/* renderer might have changed, reselect */
renderer_type_old = st_ivas->renderer_type;
move32();
@@ -1003,15 +1021,18 @@ static ivas_error ivas_mc_dec_reconfig_fx(
render what still fits in the new granularity */
tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs );
move16();
- IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
- {
- IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
- {
+ IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ){
+#ifdef FIX_HRTF_LOAD
+ /* flush already done in IVAS_DEC_ReadFormat() */
+#else
+ IF( NE_32( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, last_mc_mode, ISM_MODE_NONE, nSamplesRendered, data ) ), IVAS_ERR_OK ) ){
return error;
- }
+}
+#endif
}
/* JBM: when granularity goes up set samples to discard at the beginning of the frame */
- ELSE IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
+ ELSE
+ IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
{
IF( NE_32( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ), IVAS_ERR_OK ) )
{
@@ -1048,13 +1069,17 @@ static ivas_error ivas_mc_dec_reconfig_fx(
ivas_masa_dec_close_fx( &( st_ivas->hMasa ) );
ivas_qmetadata_close_fx( &st_ivas->hQMetaData );
+#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
IF( st_ivas->hDirAC != NULL )
{
+#endif
ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
vbap_free_data_fx( &( st_ivas->hVBAPdata ) );
+#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
}
+#endif
/* init LS conversion if the renderer type asks for it */
test();
@@ -1134,13 +1159,17 @@ static ivas_error ivas_mc_dec_reconfig_fx(
ivas_masa_dec_close_fx( &( st_ivas->hMasa ) );
ivas_qmetadata_close_fx( &st_ivas->hQMetaData );
+#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
IF( st_ivas->hDirAC != NULL )
{
+#endif
ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) );
vbap_free_data_fx( &( st_ivas->hVBAPdata ) );
+#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
}
+#endif
IF( EQ_16( last_mc_mode, MC_MODE_MCT ) )
{
@@ -1332,63 +1361,7 @@ static ivas_error ivas_mc_dec_reconfig_fx(
{
return error;
}
- /*-----------------------------------------------------------------*
- * Allocate the LFE handle that is coded separately after the allocation of the core coders
- *-----------------------------------------------------------------*/
- test();
- test();
- IF( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) && st_ivas->hLFE == NULL )
- {
-#ifdef NONBE_FIX_MC_LFE_LPF
- Word32 delay_ns = st_ivas->binaural_latency_ns;
-#else
- Word32 binauralization_delay_ns = st_ivas->binaural_latency_ns;
-#endif
- move32();
- IF( st_ivas->hBinRenderer != NULL )
- {
- IF( st_ivas->hBinRenderer->render_lfe )
- {
- /* Account for filterbank delay */
-#ifdef NONBE_FIX_MC_LFE_LPF
- delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS );
-#else
- binauralization_delay_ns = L_add( binauralization_delay_ns, IVAS_FB_DEC_DELAY_NS );
-#endif
- }
- ELSE
- {
-#ifdef NONBE_FIX_MC_LFE_LPF
- delay_ns = 0;
-#else
- binauralization_delay_ns = 0;
-#endif
- move32();
- }
- }
-#ifdef NONBE_FIX_MC_LFE_LPF
- ELSE
- {
- IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) )
- {
- delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS );
- }
- }
-#endif
-
-#ifdef NONBE_FIX_MC_LFE_LPF
- IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ), IVAS_ERR_OK ) )
-#else
- IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, binauralization_delay_ns ) ), IVAS_ERR_OK ) )
-#endif
- {
- return error;
- }
-
- set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN );
- set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k );
- }
/*-----------------------------------------------------------------*
* Reconfigure renderers
@@ -1397,7 +1370,9 @@ static ivas_error ivas_mc_dec_reconfig_fx(
IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) )
{
test();
+#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
test();
+#endif
IF( ( NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) ) && ( NE_16( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) )
{
IF( st_ivas->hDirAC != NULL )
@@ -1417,7 +1392,11 @@ static ivas_error ivas_mc_dec_reconfig_fx(
}
}
}
- ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) && st_ivas->hDirAC != NULL )
+#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
+ ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) )
+#else
+ ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) && st_ivas->hDirAC != NULL )
+#endif
{
ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) );
ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) );
@@ -1450,13 +1429,11 @@ static ivas_error ivas_mc_dec_reconfig_fx(
IF( st_ivas->hBinRenderer != NULL && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) )
{
ivas_binRenderer_close_fx( &st_ivas->hBinRenderer );
-#ifdef FIX_1068_ASAN_IN_MC_2_BINAURAL_ROOM_IR
test();
IF( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) )
{
efap_free_data_fx( &st_ivas->hEFAPdata );
}
-#endif
}
test();
@@ -1466,7 +1443,11 @@ static ivas_error ivas_mc_dec_reconfig_fx(
test();
IF( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend[0] != NULL ) && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) || NE_16( st_ivas->hIntSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) )
{
- ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ) );
+#else
+ ivas_rend_closeCrend_fx( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses );
+#endif
}
test();
@@ -1481,7 +1462,7 @@ static ivas_error ivas_mc_dec_reconfig_fx(
test();
IF( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) && NE_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) )
{
- ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
+ ivas_dirac_dec_close_binaural_data_fx( st_ivas->hDiracDecBin );
}
}
@@ -1500,7 +1481,10 @@ static ivas_error ivas_mc_dec_reconfig_fx(
}
ELSE IF( st_ivas->hBinRendererTd == NULL && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) )
{
- IF( ( error = ivas_td_binaural_open_fx( st_ivas, &st_ivas->SrcInd[0], &st_ivas->num_src ) ) != IVAS_ERR_OK )
+ Word16 num_src;
+ Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
+
+ IF( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, &num_src ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -1513,7 +1497,7 @@ static ivas_error ivas_mc_dec_reconfig_fx(
}
IF( EQ_16( st_ivas->hIntSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
{
- IF( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper, 1 ) ) != IVAS_ERR_OK )
+ IF( ( error = ivas_rend_initCrendWrapper_fx( &st_ivas->hCrendWrapper, 1 ) ) != IVAS_ERR_OK )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" );
}
@@ -1528,7 +1512,11 @@ static ivas_error ivas_mc_dec_reconfig_fx(
}
ELSE IF( st_ivas->hCrendWrapper == NULL && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) )
{
- IF( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IF( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hHrtfCrend, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, 0, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
+#else
+ IF( ( error = ivas_rend_openCrend_fx( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hHrtfStatistics, st_ivas->hDecoderConfig->output_Fs, ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
+#endif
{
return error;
}
@@ -1546,6 +1534,63 @@ static ivas_error ivas_mc_dec_reconfig_fx(
return error;
}
+ /*-----------------------------------------------------------------*
+ * Allocate the LFE handle that is coded separately after the allocation of the core coders
+ *-----------------------------------------------------------------*/
+ test();
+ IF( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) || EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) )
+ {
+ Word32 delay_ns;
+ IF( NE_16( st_ivas->hIntSetup.index_lfe[0], -1 ) )
+ {
+ delay_ns = st_ivas->binaural_latency_ns;
+ }
+ ELSE
+ {
+ delay_ns = 0;
+ }
+ move32();
+ IF( st_ivas->hBinRenderer != NULL )
+ {
+ IF( st_ivas->hBinRenderer->render_lfe )
+ {
+ /* Account for filterbank delay */
+ delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS );
+ }
+ ELSE
+ {
+ delay_ns = 0;
+ move32();
+ }
+ }
+ ELSE
+ {
+ IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) )
+ {
+ delay_ns = L_add( delay_ns, IVAS_FB_DEC_DELAY_NS );
+ }
+ }
+
+ IF( st_ivas->hLFE != NULL )
+ {
+ IF( NE_32( st_ivas->hLFE->delay_ns, delay_ns ) )
+ {
+ ivas_lfe_dec_close_fx( &( st_ivas->hLFE ) );
+ }
+ }
+
+ IF( st_ivas->hLFE == NULL )
+ {
+ IF( NE_32( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+
+ set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN );
+ set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k );
+ }
+ }
+
/*-----------------------------------------------------------------*
* JBM TC buffers
*-----------------------------------------------------------------*/
@@ -1651,5 +1696,10 @@ static ivas_error ivas_mc_dec_reconfig_fx(
{
return error;
}
- return error;
+
+#ifdef FIX_HRTF_LOAD
+ return IVAS_ERR_OK;
+#else
+return error;
+#endif
}
diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c
index e63f910c539bacdfe469f033403b05700d8bee11..bfe81d4bb02aa31be6b9c853da71c5da1c944693 100644
--- a/lib_dec/ivas_mdct_core_dec_fx.c
+++ b/lib_dec/ivas_mdct_core_dec_fx.c
@@ -699,6 +699,9 @@ void ivas_mdct_core_invQ_fx(
set16_fx( bitsRead, 0, CPE_CHANNELS );
tmp_concealment_method = 0;
move16();
+#ifdef FIX_1387_INIT_PRM_SQQ
+ prm_sqQ = NULL; /* set prm_sqQ to NULL - in case of bfi == 1 it's not set or needed, but it triggers sanitizers */
+#endif
FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
{
@@ -1085,39 +1088,35 @@ void ivas_mdct_core_invQ_fx(
*-----------------------------------------------------------------*/
void ivas_mdct_core_reconstruct_fx(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
- Word32 *x_fx[][NB_DIV],
- /* i/o: synthesis @internal_FS */ // Q(q_x)
- Word16 signal_outFB_fx[CPE_CHANNELS][L_FRAME_PLUS],
- /* o : synthesis @output_FS */ // e_sig
- Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */
- const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ Word32 *x_fx[][NB_DIV], /* i/o: synthesis @internal_FS Q(q_x) */
+ Word16 signal_outFB_fx[CPE_CHANNELS][L_FRAME_PLUS], /* o : synthesis @output_FS e_sig */
+ Word16 fUseTns[CPE_CHANNELS][NB_DIV], /* i : flage TNS enabled */
+ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
Word16 q_x,
Word16 e_sig[CPE_CHANNELS] )
{
Word16 ch, k, bfi;
Decoder_State **sts, *st;
+
/* Framing */
Word16 L_frame[CPE_CHANNELS], L_frameTCX[CPE_CHANNELS], nSubframes[CPE_CHANNELS];
Word16 L_frame_global[CPE_CHANNELS], L_frame_globalTCX[CPE_CHANNELS];
+
/* Synth */
+#ifdef FIX_1320_STACK_CPE_DECODER
+ Word16 synth_buf_fx[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M];
+#else
Word16 synth_buf_fx[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
+#endif
Word16 *synth_fx;
Word16 synth_bufFB_fx[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
Word16 *synthFB_fx;
Word16 q_syn = 0;
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Word16 q_win = 0;
Word16 q_winFB = 0;
-#else
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
- Word16 q_win = -1;
-#else
- Word16 q_win = -2;
-#endif
- move16();
-#endif
+
/* TCX */
Word16 xn_buf_fx[L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX]; // Q(-2)
Word16 tcx_offset[CPE_CHANNELS];
@@ -1178,52 +1177,30 @@ void ivas_mdct_core_reconstruct_fx(
st->hTcxDec->q_old_synth = 0;
move16();
}
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
- Copy( st->hTcxDec->old_synth, synth_buf_fx, st->hTcxDec->old_synth_len ); // Q = st->hTcxDec->q_old_synth
- Copy_Scale_sig( st->hTcxDec->old_synthFB_fx, synth_bufFB_fx, st->hTcxDec->old_synth_lenFB, sub( st->hTcxDec->q_old_synth, st->Q_syn ) ); // Q = st->hTcxDec->q_old_synth
-#endif
q_syn = st->hTcxDec->q_old_synth;
move16();
+#ifdef FIX_1320_STACK_CPE_DECODER
+ set16_fx( synth_fx, 0, L_FRAME_PLUS_INTERNAL + M );
+#else
set16_fx( synth_fx, 0, L_FRAME_PLUS + M );
+#endif
set16_fx( synthFB_fx, 0, L_FRAME_PLUS + M );
IF( st->core != ACELP_CORE )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ st->Q_syn_factor = 0;
+ move16();
+#endif
Word16 q_win0 = Q15;
move16();
Word16 q_winFB0 = Q15;
move16();
-#else
- Scale_sig( st->hTcxDec->syn_Overl_TDACFB, L_FRAME_MAX / 2, sub( q_win, st->hTcxDec->Q_syn_Overl_TDACFB ) ); // st->hTcxDec->Q_syn_Overl_TDACFB -> q_win
- st->hTcxDec->Q_syn_Overl_TDACFB = q_win;
- move16();
- Scale_sig( st->hTcxDec->syn_Overl_TDAC, L_FRAME32k / 2, sub( q_win, st->hTcxDec->Q_syn_Overl_TDAC ) ); // st->hTcxDec->Q_syn_Overl_TDAC -> q_win
- st->hTcxDec->Q_syn_Overl_TDAC = q_win;
- move16();
- Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( q_win, st->hTcxDec->Q_old_syn_Overl ) ); // Q(-1 - st->Q_syn) -> q_win
- st->hTcxDec->Q_old_syn_Overl = q_win;
- move16();
- Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win
- Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( q_win, st->Q_syn ) ); // Q(st->Q_syn) -> q_win
- Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( q_win, st->hHQ_core->Q_old_wtda_LB ) ); // Q(st->hHQ_core->Q_old_wtda_LB) -> q_win
- Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( q_win, st->hHQ_core->Q_old_wtda ) ); // Q(st->hHQ_core->Q_old_wtda) -> q_win
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
- st->hHQ_core->Q_old_wtda = q_win;
- move16();
- st->hHQ_core->Q_old_wtda_LB = q_win;
- move16();
-#endif
- Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win
- Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_win, q_syn ) ); // q_syn -> q_win
- Scale_sig( st->syn, M + 1, sub( q_win, st->Q_syn ) ); // st->Q_syn -> q_win
-#endif
FOR( k = 0; k < nSubframes[ch]; k++ )
{
init_tcx_info_fx( st, L_frame_global[ch], L_frame_globalTCX[ch], k, bfi, &tcx_offset[ch],
&tcx_offsetFB[ch], &L_frame[ch], &L_frameTCX[ch], &left_rect[ch], &L_spec[ch] );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
assert( nSubframes[ch] <= 2 );
q_win0 = q_win;
move16();
@@ -1233,11 +1210,9 @@ void ivas_mdct_core_reconstruct_fx(
move16();
q_winFB = -2;
move16();
-#endif
IF( !skip_decoding )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
test();
test();
IF( ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( st->hTcxDec->kernel_type[k], MDST_IV ) ) || EQ_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) )
@@ -1250,45 +1225,26 @@ void ivas_mdct_core_reconstruct_fx(
decoder_tcx_imdct_fx( st, L_frame_global[ch], L_frame_globalTCX[ch], L_spec[ch], tcx_offset[ch], tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x_fx[ch][k], q_x, xn_buf_fx, &q_win, &q_winFB,
st->hTcxDec->kernel_type[k], fUseTns[ch][k], &synth_fx[k * L_frame[ch]], &synthFB_fx[k * L_frameTCX[ch]], bfi, k, 0 );
}
-#else
- test();
- test();
- IF( ( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( st->hTcxDec->kernel_type[k], MDST_IV ) ) || EQ_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) )
- {
- decoder_tcx_imdct_fx( st, L_frame_global[ch], L_frame_globalTCX[ch], L_spec[ch], tcx_offset[ch], tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x_fx[ch][k], q_x, xn_buf_fx, q_win,
- MDCT_IV, fUseTns[ch][k], &synth_fx[k * L_frame[ch]], &synthFB_fx[k * L_frameTCX[ch]], bfi, k, 0 );
- }
- ELSE
- {
- decoder_tcx_imdct_fx( st, L_frame_global[ch], L_frame_globalTCX[ch], L_spec[ch], tcx_offset[ch], tcx_offsetFB[ch], L_frame[ch], L_frameTCX[ch], left_rect[ch], x_fx[ch][k], q_x, xn_buf_fx, q_win,
- st->hTcxDec->kernel_type[k], fUseTns[ch][k], &synth_fx[k * L_frame[ch]], &synthFB_fx[k * L_frameTCX[ch]], bfi, k, 0 );
- }
-#endif
}
ELSE
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
q_win = Q15;
move16();
q_winFB = Q15;
move16();
-#endif
set16_fx( &synth_fx[k * L_frame[ch]], 0, L_frame[ch] );
set16_fx( &synthFB_fx[k * L_frame[ch]], 0, L_frameTCX[ch] );
/* Note: these buffers are not subframe-based, hence no indexing with k */
set16_fx( &st->hHQ_core->old_out_LB_fx[0], 0, L_frame[ch] );
set16_fx( &st->hHQ_core->old_out_fx[0], 0, L_frameTCX[ch] );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
st->hHQ_core->Q_old_wtda = Q15;
st->hHQ_core->Q_old_wtda_LB = Q15;
-#endif
set16_fx( &st->hTcxDec->syn_Overl[0], 0, shr( L_frame[ch], 1 ) );
set16_fx( &st->hTcxDec->syn_OverlFB[0], 0, shr( L_frameTCX[ch], 1 ) );
set16_fx( &st->hTcxDec->syn_Overl_TDAC[0], 0, shr( L_frame[ch], 1 ) );
set16_fx( &st->hTcxDec->syn_Overl_TDACFB[0], 0, shr( L_frameTCX[ch], 1 ) );
}
}
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
IF( nSubframes[ch] > 1 )
{
@@ -1319,7 +1275,11 @@ void ivas_mdct_core_reconstruct_fx(
// norm(synth_buf) >= q_syn - q_win
// norm(synth_buf) + q_win >= q_syn
+#ifdef FIX_1320_STACK_CPE_DECODER
+ sf = s_min( getScaleFactor16( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS_INTERNAL ), M ) ), getScaleFactor16( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ) ) );
+#else
sf = s_min( getScaleFactor16( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ) ), getScaleFactor16( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ) ) );
+#endif
q_syn = add( sub( sf, 1 ), s_min( q_win, q_winFB ) );
st->Q_syn = q_syn;
move16();
@@ -1329,7 +1289,11 @@ void ivas_mdct_core_reconstruct_fx(
sf = s_min( getScaleFactor16( st->hHQ_core->old_out_fx, L_FRAME48k ), getScaleFactor16( st->hHQ_core->old_out_LB_fx, L_FRAME32k ) );
st->Q_syn = add( sf, s_min( q_win, q_winFB ) );
- Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // st->hTcxDec->q_old_synth -> q_syn
+#ifdef FIX_1320_STACK_CPE_DECODER
+ Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS_INTERNAL ), M ), sub( q_syn, q_win ) ); // st->hTcxDec->q_old_synth -> q_syn
+#else
+ Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // st->hTcxDec->q_old_synth -> q_syn
+#endif
Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_syn, q_winFB ) ); // st->hTcxDec->q_old_synth -> q_syn
// Scale_sig( st->syn, M + 1, add( st->Q_syn, 2 ) );
Scale_sig( st->syn, M + 1, sub( st->Q_syn, q_win ) );
@@ -1342,66 +1306,12 @@ void ivas_mdct_core_reconstruct_fx(
{
Scale_sig( st->mem_syn2_fx, M, sub( st->Q_syn, add( q_win, 2 ) ) ); // q_win+2 -> st->Q_syn: in this case, E_UTIL_f_preemph2 shifts st->mem_syn2_fx by 2 bits
}
-#else
- test();
- IF( ( bfi == 0 ) && st->hTonalMDCTConc != NULL )
- {
- TonalMDCTConceal_SaveTimeSignal_ivas_fx( st->hTonalMDCTConc, synthFB_fx, q_win, L_frameTCX[ch] );
- }
- decoder_tcx_post_ivas_fx( st, synth_fx, synthFB_fx, q_win, NULL, bfi, MCT_flag );
-
- sf = s_min( getScaleFactor16( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ) ), getScaleFactor16( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ) ) );
- IF( LT_16( sf, 2 ) )
- {
- q_syn = sub( sf, 2 );
- st->Q_syn = q_syn;
- move16();
- }
- sf = s_min( getScaleFactor16( st->hHQ_core->old_out_fx, L_FRAME48k ), getScaleFactor16( st->hHQ_core->old_out_LB_fx, L_FRAME32k ) );
- IF( LT_16( sf, sub( st->Q_syn, q_win ) ) )
- {
- st->Q_syn = add( q_win, sf );
- }
-
- Scale_sig( st->hTcxDec->syn_Overl_TDACFB, L_FRAME_MAX / 2, sub( sub( -1, st->Q_syn ), q_win ) ); // q_win -> Q(-1 - st->Q_syn)
- st->hTcxDec->Q_syn_Overl_TDACFB = sub( -1, st->Q_syn );
- move16();
- Scale_sig( st->hTcxDec->syn_Overl_TDAC, L_FRAME32k / 2, sub( sub( -1, st->Q_syn ), q_win ) ); // q_win -> Q(-1 - st->Q_syn)
- st->hTcxDec->Q_syn_Overl_TDAC = sub( -1, st->Q_syn );
- move16();
- Scale_sig( st->hTcxDec->old_syn_Overl, L_FRAME32k / 2, sub( sub( -1, st->Q_syn ), st->hTcxDec->Q_old_syn_Overl ) ); // q_win -> Q(-1 - st->Q_syn)
- st->hTcxDec->Q_old_syn_Overl = sub( -1, st->Q_syn );
- Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // q_win -> q_syn
- Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( q_syn, q_win ) ); // q_win -> q_syn
- Scale_sig( st->syn, M + 1, add( st->Q_syn, 2 ) );
- Scale_sig( st->hTcxDec->syn_OverlFB, L_FRAME_MAX / 2, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn
- st->hTcxDec->Q_syn_OverlFB = st->Q_syn;
- Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn
- st->hTcxDec->Q_syn_Overl = st->Q_syn;
-#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
- Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn
- Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, sub( st->Q_syn, q_win ) ); // q_win -> st->Q_syn
- st->hHQ_core->Q_old_wtda = st->Q_syn;
- move16();
- st->hHQ_core->Q_old_wtda_LB = st->Q_syn;
- move16();
-#endif
-#endif
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD_NO
- Scale_sig( st->mem_syn2_fx, M, sub( st->Q_syn, q_win ) ); // q_win -> Q_syn
-#endif
}
ELSE /*ACELP core for ACELP-PLC */
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
Copy( st->hTcxDec->old_synth, synth_buf_fx, st->hTcxDec->old_synth_len ); // Q = st->hTcxDec->q_old_synth
Copy_Scale_sig( st->hTcxDec->old_synthFB_fx, synth_bufFB_fx, st->hTcxDec->old_synth_lenFB, sub( st->hTcxDec->q_old_synth, st->Q_syn ) ); // Q = st->hTcxDec->q_old_synth
- // Temporary workaround: con_tcx_ivas_fx() should be analyzed for potential issues.
- // Scale_sig( synth_bufFB_fx, st->hTcxDec->old_synth_lenFB, -2 );
- // Scale_sig( synth_bufFB_fx, st->hTcxDec->old_synth_lenFB, +2 );
- ///////////////////////////////////////////////////////////////////////////////////
-#endif
assert( EQ_16( st->bfi, 1 ) );
/* PLC: [TCX: TD PLC] */
IF( MCT_flag != 0 )
@@ -1431,12 +1341,10 @@ void ivas_mdct_core_reconstruct_fx(
move16();
st->hTcxDec->Q_old_syn_Overl = add( st->hTcxDec->Q_old_syn_Overl, q_syn );
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN
st->hTcxDec->Q_syn_OverlFB = add( st->hTcxDec->Q_syn_OverlFB, q_syn );
move16();
// st->hTcxDec->Q_syn_Overl = add( st->hTcxDec->Q_syn_Overl, q_syn ); // It is disabled because it increased the number of regressions.
// move16();
-#endif
IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || ( st->hTcxDec->tcxConceal_recalc_exc != 0 ) )
{
@@ -1515,12 +1423,21 @@ void ivas_mdct_core_reconstruct_fx(
{
Copy_Scale_sig_16_32_no_sat( st->p_bpf_noise_buf, st->p_bpf_noise_buf_32, st->L_frame, Q11 ); // Q0 -> Q11
}
+
+#ifndef FIX_938_COMPILER_WARNING
IF( signal_outFB_fx[ch] != NULL )
{
+#endif
Copy( synthFB_fx, signal_outFB_fx[ch], st->hTcxDec->L_frameTCX );
- e_sig[ch] = sub( 15, q_syn );
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ e_sig[ch] = sub( 15, q_syn + st->Q_syn_factor );
+#else
+ e_sig[ch] = sub( 15, q_syn );
+#endif
move16();
+#ifndef FIX_938_COMPILER_WARNING
}
+#endif
/* updates */
st->last_voice_factor_fx = 0;
@@ -1790,7 +1707,17 @@ void ivas_mdct_core_tns_ns_fx(
q_x = add( q_x, 1 );
}
+#ifdef NONBE_FIX_1376_MDCT_CONCEALMENT
+ /*
+ 2025-09-07, mul:
+ in case of PLC, applying SNS up to L_spec might not be enough: In case the transition frame from DTX after an inactive period is lost, L_spec is assumed to represent a regular TCX frame,
+ however, this frame is nevertheless acting as an transition frame as also visible in L_frameTCX; thus, the safer approach to prevent high frequency artifacts is to apply the SNS up to L_frameTCX;
+ in case this is not necessary, x[] is filled with zeros, and the multiplication is not causing any additional harm
+ */
+ v_multc_fixed( x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf_fx[FDNS_NPTS - 1], x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sub( s_max( L_spec[ch], L_frameTCX[ch] ), st->hTcxCfg->psychParamsCurrent->nBins ) );
+#else
v_multc_fixed( x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf_fx[FDNS_NPTS - 1], x_fx[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sub( L_spec[ch], st->hTcxCfg->psychParamsCurrent->nBins ) );
+#endif
q_2 = sub( add( q_x, q_sns_int_scf ), 31 );
Scale_sig32( &x_fx[ch][k][0], st->hTcxCfg->psychParamsCurrent->nBins, sub( q_2, q_x ) );
diff --git a/lib_dec/ivas_objectRenderer_internal_fx.c b/lib_dec/ivas_objectRenderer_internal_fx.c
index e64e9d2208082d85a1d7d1e44046ed94799d3eaf..a97567c198c8f2f9348370572adeb9081d996c4e 100644
--- a/lib_dec/ivas_objectRenderer_internal_fx.c
+++ b/lib_dec/ivas_objectRenderer_internal_fx.c
@@ -46,6 +46,7 @@
*
* Open and initialize TD Object binaural renderer
*---------------------------------------------------------------------*/
+
ivas_error ivas_td_binaural_open_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
Word16 *SrcInd, /*Temporarily used to store the updated value of SrcInd*/
@@ -53,17 +54,24 @@ ivas_error ivas_td_binaural_open_fx(
{
*num_src = st_ivas->nchan_transport;
move16();
+
test();
if ( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
{
*num_src = st_ivas->nchan_ism;
move16();
}
-#ifdef CONF_DISTATT
- return ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, *num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity_fx, st_ivas->hRenderConfig->distAtt_fx, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns, SrcInd );
-#else
- return ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, *num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity_fx, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns, SrcInd );
+
+#ifdef FIX_HRTF_LOAD
+ if ( st_ivas->hHrtfTD == NULL && st_ivas->hDecoderConfig->Opt_HRTF_binary &&
+ ( st_ivas->ivas_format != SBA_ISM_FORMAT ) // ToDo: temporary hack to avoid ASAN errors -> see issue #1202
+ )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL, "HRTF binary file present but not used in TD renderer" );
+ }
+
#endif
+ return ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD, st_ivas->hDecoderConfig->output_Fs, *num_src, st_ivas->ivas_format, st_ivas->transport_config, st_ivas->hRenderConfig->directivity_fx, st_ivas->hRenderConfig->distAtt_fx, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns, SrcInd );
}
@@ -97,7 +105,9 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
Word16 enableCombinedOrientation;
/* Set the number of ISMs */
- IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
+ test();
+ test();
+ IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && GT_16( st_ivas->nchan_ism, 0 ) ) )
{
nchan_ism_internal = st_ivas->nchan_ism;
move16();
@@ -200,9 +210,43 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
IF( EQ_16( subframe_idx, ism_md_subframe_update_jbm ) )
{
- IF( ( error = TDREND_Update_object_positions_fx( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ) ) != IVAS_ERR_OK )
+#ifdef OBJ_EDITING_API
+ test();
+ IF( EQ_16( st_ivas->ivas_format, ISM_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
- return error;
+ ISM_METADATA_FRAME ismMetaData[MAX_NUM_OBJECTS];
+ ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS];
+ FOR( nS = 0; nS < nchan_ism; nS++ )
+ {
+ ismMetaData[nS].azimuth_fx = st_ivas->hIsmMetaData[nS]->edited_azimuth_fx;
+ move32();
+ ismMetaData[nS].elevation_fx = st_ivas->hIsmMetaData[nS]->edited_elevation_fx;
+ move32();
+ ismMetaData[nS].radius_fx = st_ivas->hIsmMetaData[nS]->edited_radius_fx;
+ move16();
+ ismMetaData[nS].yaw_fx = st_ivas->hIsmMetaData[nS]->edited_yaw_fx;
+ move32();
+ ismMetaData[nS].pitch_fx = st_ivas->hIsmMetaData[nS]->edited_pitch_fx;
+ move32();
+ ismMetaData[nS].non_diegetic_flag = st_ivas->hIsmMetaData[nS]->non_diegetic_flag;
+ move16();
+ ismMetaData[nS].gain_fx = st_ivas->hIsmMetaData[nS]->edited_gain_fx;
+ move32();
+ hIsmMetaData[nS] = &ismMetaData[nS];
+ }
+
+ IF( NE_16( ( error = TDREND_Update_object_positions_fx( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, hIsmMetaData ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+ }
+ else
+#endif
+ {
+ IF( NE_16( error = TDREND_Update_object_positions_fx( st_ivas->hBinRendererTd, nchan_ism, st_ivas->ivas_format, st_ivas->hIsmMetaData ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
}
}
@@ -263,7 +307,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
/* Render subframe */
/* ism_md_subframe_update_jbm != subframe_idx: trigger update only for ism_md_subframe_update_jbm == subframe_idx,
where then the two TDREND_GetMix()-arguments subframe_idx and ism_md_subframe_update are equal, and we want to enforce the update inside TDREND_GetMix to use subframe_idx == 0 */
- IF( NE_32( ( error = TDREND_GetMix_fx( st_ivas->hBinRendererTd, output_fx_local, output_frame, 0, ism_md_subframe_update_jbm != subframe_idx ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = TDREND_GetMix_fx( st_ivas->hBinRendererTd, output_fx_local, output_frame, 0 ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -332,7 +376,6 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
{
continue;
}
-#ifdef CONF_DISTATT
IF( ( error = ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD,
st_ivas->hDecoderConfig->output_Fs,
st_ivas->nchan_transport,
@@ -344,18 +387,6 @@ ivas_error ivas_td_binaural_renderer_sf_splitBinaural(
&st_ivas->hTdRendHandles[i],
&st_ivas->binaural_latency_ns,
SrcInd ) ) != IVAS_ERR_OK )
-#else
- IF( ( error = ivas_td_binaural_open_unwrap_fx( &st_ivas->hHrtfTD,
- st_ivas->hDecoderConfig->output_Fs,
- st_ivas->nchan_transport,
- st_ivas->ivas_format,
- st_ivas->transport_config,
- st_ivas->hRenderConfig->directivity_fx,
- st_ivas->hTransSetup,
- &st_ivas->hTdRendHandles[i],
- &st_ivas->binaural_latency_ns,
- SrcInd ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c
index bde77e96893395dd0f62c8f6aae6d6c866f3625c..7278b9968fa35439ad267c76af69b8f34beef655 100644
--- a/lib_dec/ivas_omasa_dec_fx.c
+++ b/lib_dec/ivas_omasa_dec_fx.c
@@ -32,9 +32,7 @@
#include "options.h"
#include
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
#include
-#endif
#include "ivas_cnst.h"
#include "ivas_prot_fx.h"
#include "prot_fx.h"
@@ -48,7 +46,6 @@
* Local constants
*------------------------------------------------------------------------*/
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
#define EXT_RENDER_IIR_FAC 0.95f
#define MULT_17_DIV_20_Q15 ( Word16 )( ( 17.0 / 20.0f ) * pow( 2, 15 ) + 0.5f )
@@ -116,6 +113,11 @@ static Word16 interpolator_table_16k_q15[] = {
28672, 29082, 29491, 29901, 30310, 30720, 31130, 31539, 31949, 32358
};
+
+/*-------------------------------------------------------------------------
+ * Local functions
+ *------------------------------------------------------------------------*/
+
/**
* Calculate mantissa (Q31) * gain (Q31).
*
@@ -123,7 +125,12 @@ static Word16 interpolator_table_16k_q15[] = {
* Adjust the result so that accuracy of the mantissa multiplication is maximixed
* and the corresponding exponent is minimized.
*/
-static Word32 mult32_mantissa_fx( Word32 mantissa, Word32 gain, Word16 exp, Word16 *exp_result )
+
+static Word32 mult32_mantissa_fx(
+ const Word32 mantissa,
+ const Word32 gain,
+ const Word16 exp,
+ Word16 *exp_result )
{
Word64 mult = W_mult_32_32( mantissa, gain ); // Q31 * Q31 -> Q63
Word16 norm = W_norm( mult );
@@ -133,10 +140,16 @@ static Word32 mult32_mantissa_fx( Word32 mantissa, Word32 gain, Word16 exp, Word
return result;
}
+
/**
* Calculate re^2 + im^2 using exponent (Q0) and mantissa (Q31) format.
*/
-static Word32 sample_energy_fx( Word32 re_m, Word16 re_e, Word32 im_m, Word16 im_e, Word16 *exp_result )
+static Word32 sample_energy_fx(
+ const Word32 re_m,
+ const Word16 re_e,
+ const Word32 im_m,
+ const Word16 im_e,
+ Word16 *exp_result )
{
Word16 re_exp = add( re_e, re_e );
Word32 re_mult = mult32_mantissa_fx( re_m, re_m, re_exp, &re_exp );
@@ -149,10 +162,18 @@ static Word32 sample_energy_fx( Word32 re_m, Word16 re_e, Word32 im_m, Word16 im
return BASOP_Util_Add_Mant32Exp( re_mult, re_exp, im_mult, im_exp, exp_result );
}
+
/**
* Accumulate sum of re^2 + im^2 over the specified length using exponent (Q0) and mantissa (Q31) format.
*/
-static void sample_energy_acc_fx( Word32 *re_m, Word16 *re_e, Word32 *im_m, Word16 *im_e, Word32 *out_m, Word16 *out_e, Word16 len )
+static void sample_energy_acc_fx(
+ Word32 *re_m,
+ Word16 *re_e,
+ Word32 *im_m,
+ Word16 *im_e,
+ Word32 *out_m,
+ Word16 *out_e,
+ const Word16 len )
{
Word16 i;
@@ -168,16 +189,18 @@ static void sample_energy_acc_fx( Word32 *re_m, Word16 *re_e, Word32 *im_m, Word
*out_m = BASOP_Util_Add_Mant32Exp( *out_m, *out_e, mantissa, exp, out_e );
move32();
}
+
+ return;
}
// Multiplication of vector (comprising of exponent and mantissa parts) by constant value (Q31)
static void v_multc_exp_mantissa_fx(
const Word32 *in_mantissa,
const Word16 *in_exp,
- Word32 c,
+ const Word32 c,
Word32 *out_mantissa,
Word16 *out_exp,
- Word16 len )
+ const Word16 len )
{
Word16 i;
@@ -186,16 +209,18 @@ static void v_multc_exp_mantissa_fx(
out_mantissa[i] = mult32_mantissa_fx( in_mantissa[i], c, in_exp[i], &out_exp[i] );
move32();
}
+ return;
}
+
// Multiplication of vector (comprising of exponent and mantissa parts) by constant acumulate to the output
static void v_multc_acc_exp_mantissa_fx(
const Word32 *in_mantissa,
const Word16 *in_exp,
- Word32 c,
+ const Word32 c,
Word32 *out_mantissa,
Word16 *out_exp,
- Word16 len )
+ const Word16 len )
{
Word16 i;
@@ -205,15 +230,23 @@ static void v_multc_acc_exp_mantissa_fx(
Word32 mantissa = mult32_mantissa_fx( in_mantissa[i], c, in_exp[i], &exp );
move32();
- out_mantissa[i] = BASOP_Util_Add_Mant32Exp( out_mantissa[i], out_exp[i],
- mantissa, exp, &out_exp[i] );
+ out_mantissa[i] = BASOP_Util_Add_Mant32Exp( out_mantissa[i], out_exp[i], mantissa, exp, &out_exp[i] );
move32();
}
+
+ return;
}
+
// Calculate min( 4, sqrtf( target / proto ) )
// target and proto values are expressed using exponent and mantissa
-static Word32 get_processing_gain_fx( Word32 proto_m, Word16 proto_e, Word32 target_m, Word16 target_e, Word16 *exp )
+
+static Word32 get_processing_gain_fx(
+ const Word32 proto_m,
+ const Word16 proto_e,
+ const Word32 target_m,
+ const Word16 target_e,
+ Word16 *exp )
{
Word16 b = extract_h( proto_m );
IF( EQ_16( b, 0 ) )
@@ -244,7 +277,12 @@ static Word32 get_processing_gain_fx( Word32 proto_m, Word16 proto_e, Word32 tar
return sqrt_mantissa;
}
-static void mantissa_exp_to_qvalue( Word16 *exp, Word32 *output, Word16 target_exp, Word16 len )
+
+static void mantissa_exp_to_qvalue(
+ Word16 *exp,
+ Word32 *output,
+ const Word16 target_exp,
+ const Word16 len )
{
Word16 bin;
@@ -261,9 +299,9 @@ static void mantissa_exp_to_qvalue( Word16 *exp, Word32 *output, Word16 target_e
output[bin] = W_sat_l( W_shr( output[bin], shift ) );
}
}
-}
-#endif
+ return;
+}
/*-------------------------------------------------------------------*
@@ -330,7 +368,6 @@ ivas_error ivas_omasa_data_open_fx(
set16_fx( hMasaIsmData->azimuth_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
set16_fx( hMasaIsmData->elevation_separated_ism, 0, MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR );
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
hMasaIsmData->hExtData = NULL;
move32();
@@ -374,7 +411,7 @@ ivas_error ivas_omasa_data_open_fx(
hMasaIsmData->hExtData = hExtData;
move32();
}
-#endif
+
st_ivas->hMasaIsmData = hMasaIsmData;
return IVAS_ERR_OK;
@@ -408,14 +445,14 @@ void ivas_omasa_data_close_fx(
free( ( *hMasaIsmData )->delayBuffer_fx );
( *hMasaIsmData )->delayBuffer_fx = NULL;
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
IF( ( *hMasaIsmData )->hExtData != NULL )
{
free( ( *hMasaIsmData )->hExtData );
( *hMasaIsmData )->hExtData = NULL;
move32();
}
-#endif
+
free( *hMasaIsmData );
*hMasaIsmData = NULL;
@@ -430,11 +467,16 @@ void ivas_omasa_data_close_fx(
*--------------------------------------------------------------------------*/
ivas_error ivas_omasa_dec_config_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+#ifdef FIX_HRTF_LOAD
+ Word16 *num_src,
+ Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]
+#else
UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */
Word16 *num_src,
Word16 SrcInd[MAX_NUM_TDREND_CHANNELS],
Word16 *data /* o : output synthesis signal Qx*/
+#endif
)
{
Word16 k, sce_id, nSCE_old, nchan_hp20_old, numCldfbAnalyses_old, numCldfbSyntheses_old, n_MD;
@@ -498,7 +540,11 @@ ivas_error ivas_omasa_dec_config_fx(
}
ELSE
{
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = ivas_masa_dec_reconfigure_fx( st_ivas ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = ivas_masa_dec_reconfigure_fx( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
@@ -565,7 +611,7 @@ ivas_error ivas_omasa_dec_config_fx(
/* ISM MD reconfig. */
n_MD = 0;
move16();
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
/* the full number of hIsmMetaData are needed for EXT output */
@@ -621,36 +667,6 @@ ivas_error ivas_omasa_dec_config_fx(
ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD );
}
-#else
- test();
- IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
- {
- n_MD = 1;
- move16();
-
- IF( st_ivas->hIsmMetaData[0] == NULL )
- {
- IF( NE_32( ( error = ivas_ism_metadata_dec_create_fx( st_ivas, 1, NULL ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
- }
- ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
- {
- n_MD = st_ivas->nchan_ism;
- move16();
-
- ivas_ism_metadata_close( st_ivas->hIsmMetaData, 0 );
-
- IF( NE_32( ( error = ivas_ism_metadata_dec_create_fx( st_ivas, st_ivas->nchan_ism, NULL ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
- }
-
- ivas_ism_metadata_close( st_ivas->hIsmMetaData, n_MD );
-#endif
st_ivas->hCPE[0]->element_brate = L_sub( ivas_total_brate, ism_total_brate );
@@ -680,15 +696,10 @@ ivas_error ivas_omasa_dec_config_fx(
}
/* objects renderer reconfig. */
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
test();
IF( st_ivas->hMasaIsmData != NULL || st_ivas->hIsmRendererData != NULL )
{
/* this calls also ivas_ism_renderer_close() closing st_ivas->hIsmRendererData used by the EXT renderers. also cleans st_ivas->hMasaIsmData */
-#else
- IF( st_ivas->hMasaIsmData != NULL )
- {
-#endif
ivas_omasa_separate_object_renderer_close( st_ivas );
}
@@ -697,12 +708,13 @@ ivas_error ivas_omasa_dec_config_fx(
IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
/* Allocate TD renderer for the objects in DISC mode */
- IF( st_ivas->hBinRendererTd == NULL )
+ if ( st_ivas->hBinRendererTd == NULL )
{
IF( NE_32( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, num_src ) ), IVAS_ERR_OK ) )
{
return error;
}
+
IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
{
IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
@@ -713,7 +725,7 @@ ivas_error ivas_omasa_dec_config_fx(
}
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
- IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
@@ -725,6 +737,7 @@ ivas_error ivas_omasa_dec_config_fx(
/* TD renderer handle */
ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd );
}
+
/* ISM renderer handle + ISM data handle */
ivas_omasa_separate_object_renderer_close( st_ivas );
}
@@ -742,6 +755,11 @@ ivas_error ivas_omasa_dec_config_fx(
IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
+ IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+
IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
@@ -753,7 +771,7 @@ ivas_error ivas_omasa_dec_config_fx(
ivas_omasa_separate_object_renderer_close( st_ivas );
}
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) )
{
/* Allocate 'hIsmRendererData' handle */
@@ -779,23 +797,17 @@ ivas_error ivas_omasa_dec_config_fx(
move32();
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
- error = ivas_omasa_render_objects_from_mix_open_fx( st_ivas );
- move32();
- IF( NE_32( error, IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_omasa_objects_delay_open_fx( st_ivas ) ), IVAS_ERR_OK ) )
{
return error;
}
- error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom,
- common_rend_config_flag, 0,
- st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs, 0, 0 );
- move32();
- IF( NE_32( error, IVAS_ERR_OK ) )
+ IF( NE_32( ( error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, common_rend_config_flag, 0, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs, 0, 0 ) ), IVAS_ERR_OK ) )
{
return error;
}
}
-#endif
+
/*-----------------------------------------------------------------*
* TD Decorrelator
*-----------------------------------------------------------------*/
@@ -949,6 +961,7 @@ void ivas_set_surplus_brate_dec(
*
* decode ISM metadata in OMASA format
*--------------------------------------------------------------------------*/
+
ivas_error ivas_omasa_ism_metadata_dec_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
const Word32 ism_total_brate, /* i : ISM total bitrate */
@@ -967,6 +980,7 @@ ivas_error ivas_omasa_ism_metadata_dec_fx(
move16();
*nchan_transport_ism = st_ivas->nchan_ism;
move16();
+
IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) )
{
*nchan_ism = 1;
@@ -981,9 +995,8 @@ ivas_error ivas_omasa_ism_metadata_dec_fx(
*nchan_transport_ism = 1;
move16();
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
test();
-#endif
test();
IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) )
{
@@ -1049,9 +1062,7 @@ ivas_error ivas_omasa_ism_metadata_dec_fx(
}
}
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
- ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) &&
- EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
+ ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
azimuth_ism = extract_l( L_shr_r( L_abs( st_ivas->hIsmMetaData[0]->azimuth_fx ), 22 ) );
if ( st_ivas->hIsmMetaData[0]->azimuth_fx < 0 )
@@ -1079,7 +1090,6 @@ ivas_error ivas_omasa_ism_metadata_dec_fx(
move16();
}
}
-#endif
}
return IVAS_ERR_OK;
@@ -1106,7 +1116,7 @@ void ivas_omasa_dirac_rend_jbm_fx(
Word32 data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];
test();
- if ( !st_ivas->hDecoderConfig->Opt_tsm )
+ IF( !st_ivas->hDecoderConfig->Opt_tsm )
{
*nSamplesRendered = min( nSamplesAsked, st_ivas->hTcBuffer->n_samples_available );
@@ -1125,7 +1135,6 @@ void ivas_omasa_dirac_rend_jbm_fx(
}
}
-
subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered;
move16();
slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered;
@@ -1148,6 +1157,7 @@ void ivas_omasa_dirac_rend_jbm_fx(
return;
}
+
/*--------------------------------------------------------------------------*
* ivas_omasa_dirac_td_binaural_render()
*
@@ -1164,17 +1174,15 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
)
{
Word16 n;
- move16();
ivas_error error;
- Word32 *p_sepobj_fx[MAX_NUM_OBJECTS]; // Q11
- Word32 data_separated_objects_fx[MAX_NUM_OBJECTS][L_FRAME48k];
- move16();
+ Word32 *p_sepobj_fx[BINAURAL_CHANNELS]; // Q11
+ Word32 data_separated_objects_fx[BINAURAL_CHANNELS][L_FRAME48k];
Word16 slot_idx_start;
slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered;
move16();
- FOR( n = 0; n < MAX_NUM_OBJECTS; n++ )
+ FOR( n = 0; n < BINAURAL_CHANNELS; n++ )
{
p_sepobj_fx[n] = &data_separated_objects_fx[n][0];
}
@@ -1212,6 +1220,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
{
return error;
}
+
st_ivas->nchan_transport = nchan_transport_orig;
move16();
cldfb_slots = *nSamplesRendered / num_cldfb_bands;
@@ -1252,6 +1261,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
return IVAS_ERR_OK;
}
+
/*--------------------------------------------------------------------------*
* ivas_omasa_rearrange_channels()
*
@@ -1280,7 +1290,6 @@ void ivas_omasa_rearrange_channels_fx(
return;
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
/*-------------------------------------------------------------------------*
* ivas_omasa_combine_separate_ism_with_masa_open_fx()
@@ -1288,7 +1297,8 @@ void ivas_omasa_rearrange_channels_fx(
* Open structures, reserve memory, and init values.
*-------------------------------------------------------------------------*/
-ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
)
{
Word16 i;
@@ -1331,8 +1341,7 @@ ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx( Decoder_Struct *st
move16();
move32();
- st_ivas->hIsmRendererData->interpolator_fx =
- (Word16 *) malloc( sizeof( Word16 ) * st_ivas->hIsmRendererData->interpolator_len );
+ st_ivas->hIsmRendererData->interpolator_fx = (Word16 *) malloc( sizeof( Word16 ) * st_ivas->hIsmRendererData->interpolator_len );
IF( st_ivas->hIsmRendererData->interpolator_fx == NULL )
{
@@ -1353,6 +1362,7 @@ ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx( Decoder_Struct *st
return IVAS_ERR_OK;
}
+
/*--------------------------------------------------------------------------*
* ivas_omasa_combine_separate_ism_with_masa_fx()
*
@@ -1360,11 +1370,11 @@ ivas_error ivas_omasa_combine_separate_ism_with_masa_open_fx( Decoder_Struct *st
*--------------------------------------------------------------------------*/
void ivas_omasa_combine_separate_ism_with_masa_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
- Word32 *output[], /* i/o: output synthesis signal */
- Word16 *output_q, /* i/o: output Q value */
- const int16_t nchan_ism, /* i : number of ISMs */
- const int16_t output_frame /* i : output frame length per channel */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ Word32 *output[], /* i/o: output synthesis signal */
+ Word16 *output_q, /* i/o: output Q value */
+ const Word16 nchan_ism, /* i : number of ISMs */
+ const Word16 output_frame /* i : output frame length per channel */
)
{
Word16 n, sf, band, k;
@@ -1608,24 +1618,35 @@ void ivas_omasa_combine_separate_ism_with_masa_fx(
{
set_zero_fx( output[add( MASA_MAX_TRANSPORT_CHANNELS, n )], output_frame );
}
+
+ return;
}
/*-------------------------------------------------------------------------*
- * ivas_omasa_render_objects_from_mix_open_fx()
+ * ivas_omasa_objects_delay_open()
*
- * Open structures, reserve memory, and init values.
+ * Open structures, reserve memory, and init values for dela buffers of objects.
*-------------------------------------------------------------------------*/
-ivas_error ivas_omasa_render_objects_from_mix_open_fx(
+ivas_error ivas_omasa_objects_delay_open_fx(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
)
{
Word16 i;
Word32 size;
- st_ivas->hMasaIsmData->delayBuffer_nchan = 1;
- move16();
+ test();
+ IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
+ {
+ st_ivas->hMasaIsmData->delayBuffer_nchan = 1;
+ move16();
+ }
+ ELSE
+ {
+ st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism;
+ move16();
+ }
st_ivas->hMasaIsmData->delayBuffer_size = extract_l( Mult_32_16( st_ivas->hDecoderConfig->output_Fs,
OMASA_DELAYFRAMES_PER_SEC_Q15 ) );
@@ -1664,11 +1685,11 @@ ivas_error ivas_omasa_render_objects_from_mix_open_fx(
*--------------------------------------------------------------------------*/
void ivas_omasa_render_objects_from_mix_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
- Word32 *output[], /* o : output synthesis signal */
- const int16_t nchan_ism, /* i : number of ISMs */
- const int16_t output_frame, /* i : output frame length per channel */
- Word16 *output_q /* i/o: output Q value */
+ Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
+ Word32 *output[], /* o : output synthesis signal */
+ const Word16 nchan_ism, /* i : number of ISMs */
+ const Word16 output_frame, /* i : output frame length per channel */
+ Word16 *output_q /* i/o: output Q value */
)
{
Word16 n, m, i;
@@ -2120,5 +2141,6 @@ void ivas_omasa_render_objects_from_mix_fx(
hExtData->prev_idx_separated_ism = st_ivas->hMasaIsmData->idx_separated_ism;
move16();
+
+ return;
}
-#endif
diff --git a/lib_dec/ivas_osba_dec_fx.c b/lib_dec/ivas_osba_dec_fx.c
index c6c55299a17d7461d61a55ef0c819e5b563e0e25..3aae0517988ad88923af7e492d1a886e835662e3 100644
--- a/lib_dec/ivas_osba_dec_fx.c
+++ b/lib_dec/ivas_osba_dec_fx.c
@@ -160,9 +160,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
return error;
}
-#ifdef NONBE_FIX_ISM_XOVER_BR
ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData );
-#endif
IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
Word16 slot_idx, num_cldfb_bands, b, nchan_transport_orig;
@@ -203,13 +201,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
FOR( b = 0; b < num_cldfb_bands; b++ )
{
st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] =
- L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ),
- L_shr( Cldfb_RealBuffer[b], 1 ) );
+ L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_RealBuffer[b] );
move32();
st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][slot_idx_start + slot_idx][b] =
- L_add( L_shr( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], 1 ),
- L_shr( Cldfb_ImagBuffer[b], 1 ) );
+ L_add( st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural_fx[n][add( slot_idx_start, slot_idx )][b], Cldfb_ImagBuffer[b] );
move32();
}
}
@@ -227,7 +223,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm_fx(
Word16 i;
FOR( i = 0; i < nSamplesAsked; i++ )
{
- output_fx[n][i] = L_add( L_shr( output_fx[channel_offset + n][i], 1 ), L_shr( p_sepobj_fx[n][i], 1 ) );
+ output_fx[n][i] = L_add( output_fx[channel_offset + n][i], p_sepobj_fx[n][i] );
move32();
}
}
@@ -318,13 +314,56 @@ ivas_error ivas_osba_render_sf_fx(
{
IF( NE_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) )
{
- v_add_fixed( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered, 1 ); // takes care of downscaling by 0.5f
+ v_add_fixed_no_hdrm( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered );
}
- ELSE
+ }
+
+ return IVAS_ERR_OK;
+}
+
+
+/*-------------------------------------------------------------------------*
+ * ivas_osba_stereo_add_channels()
+ *
+ *
+ *-------------------------------------------------------------------------*/
+
+void ivas_osba_stereo_add_channels_fx(
+ Word32 *tc_fx[], /* i : transport channels */
+ Word32 *output_fx[], /* i/o: output channels */
+ const Word16 gain, /* i : gain bed value Q11 */
+ const Word16 nchan_out, /* i : number of output channels */
+ const Word16 nchan_ism, /* i : number of ISM channels */
+ const UWord16 n_samples_to_render /* i : output frame length per channel */
+)
+{
+ Word16 n;
+
+#if 0
+ IF ( ism_mode == ISM_SBA_MODE_DISC )
+ {
+#endif
+ IF( NE_16( gain, ONE_IN_Q11 ) )
+ {
+ assert( 0 && "Object editing is not implemented in the BASOP code!" );
+ }
+ ELSE
+ {
+ FOR( n = 0; n < nchan_out; n++ )
+ {
+ v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render );
+ }
+ }
+#if 0
+ }
+ ELSE
+ {
+ FOR( n = 0; n < nchan_out; n++ )
{
- scale_sig32( p_output[n], *nSamplesRendered, -1 );
+ v_add_fixed_no_hdrm( output_fx[n], tc_fx[n + nchan_ism], output_fx[n], n_samples_to_render );
}
}
+#endif
- return IVAS_ERR_OK;
+ return;
}
diff --git a/lib_dec/ivas_out_setup_conversion_fx.c b/lib_dec/ivas_out_setup_conversion_fx.c
index 05226af32dfa4811b67cdba46b585912c1e072e6..3842b0f6b608ec976a1187437f1c27b8e0603bcb 100644
--- a/lib_dec/ivas_out_setup_conversion_fx.c
+++ b/lib_dec/ivas_out_setup_conversion_fx.c
@@ -381,9 +381,7 @@ ivas_error ivas_ls_setup_conversion_open_fx(
Word16 output_frame;
Word32 output_Fs;
Word16 paramUpmixMonoStereo;
-#ifdef FIX_1052_EXT_OUTPUT
ivas_error error;
-#endif
test();
test();
@@ -510,37 +508,25 @@ ivas_error ivas_ls_setup_conversion_open_fx(
{
IF( EQ_16( paramUpmixMonoStereo, TRUE ) )
{
-#ifdef FIX_1052_EXT_OUTPUT
IF( ( error = get_ls_conversion_matrix_fx( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK )
{
return error;
}
-#else
- get_ls_conversion_matrix_fx( hLsSetUpConversion, IVAS_AUDIO_CONFIG_5_1_2, st_ivas->hDecoderConfig->output_config );
-#endif
}
ELSE
{
-#ifdef FIX_1052_EXT_OUTPUT
IF( ( error = get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK )
{
return error;
}
-#else
- get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->transport_config, st_ivas->hDecoderConfig->output_config );
-#endif
}
}
ELSE
{
-#ifdef FIX_1052_EXT_OUTPUT
IF( ( error = get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config ) ) != IVAS_ERR_OK )
{
return error;
}
-#else
- get_ls_conversion_matrix_fx( hLsSetUpConversion, st_ivas->intern_config, st_ivas->hDecoderConfig->output_config );
-#endif
}
}
@@ -676,8 +662,13 @@ void ivas_ls_setup_conversion_process_mdct_fx(
Word16 inChannels, outChannels, num_CPE;
Word16 transform_type[MAX_CICP_CHANNELS][2];
Word16 frameSize;
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ Word64 targetEnergy64[MAX_SFB + 2], dmxEnergy64[MAX_SFB + 2];
+ Word16 scf1, scf2;
+#else
Word32 targetEnergy[MAX_SFB + 2], dmxEnergy[MAX_SFB + 2];
Word16 dmxEnergy_exp[MAX_SFB + 2], dmxEnergy_exp_temp;
+#endif
Word32 dmxCoeff;
Word32 dmxSignalReal[L_FRAME48k], dmxSignalImag[L_FRAME48k];
Word32 eqGain;
@@ -762,12 +753,20 @@ void ivas_ls_setup_conversion_process_mdct_fx(
/* set overall frequency resolution of (sub)frame to maximum of (sub)frame, requires conversion if both channels are not the same */
frameSize = hLsSetUpConversion->sfbOffset[hLsSetUpConversion->sfbCnt];
move16();
-
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ set64_fx( targetEnergy64, 0, MAX_SFB + 2 );
+ set64_fx( dmxEnergy64, 0, MAX_SFB + 2 );
+ scf1 = 63;
+ scf2 = 63;
+ move16();
+ move16();
+#else
set32_fx( targetEnergy, 0, MAX_SFB + 2 );
set32_fx( dmxEnergy, 0, MAX_SFB + 2 );
set16_fx( dmxEnergy_exp, 0, MAX_SFB + 2 );
dmxEnergy_exp_temp = 0;
move16();
+#endif
FOR( chOutIdx = 0; chOutIdx < outChannels; chOutIdx++ )
{
@@ -786,8 +785,12 @@ void ivas_ls_setup_conversion_process_mdct_fx(
/* Step 1: Compute the target energy and DMX signal (possible since we have all signals in TCX20 resolution) */
IF( dmxCoeff )
{
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ Word64 targetEne64;
+ Word32 tmpDMXSig;
+#else
Word32 tmpDMXSig, targetEne;
-
+#endif
/* Convert the signal resolution to TCX20 */
/* initially, set pointers to input; if conversion occurs in (sub)frame, set to convertRes */
pTmp[0] = x[chInIdx][0]; // Q(q_output)
@@ -830,8 +833,13 @@ void ivas_ls_setup_conversion_process_mdct_fx(
stop = hLsSetUpConversion->sfbOffset[bandIdx + 1];
move16();
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ targetEne64 = 0;
+ move64();
+#else
targetEne = 0;
move32();
+#endif
/* Loop over all the bins in the band */
FOR( binIdx = start; binIdx < stop; binIdx++ )
@@ -839,15 +847,30 @@ void ivas_ls_setup_conversion_process_mdct_fx(
tmpDMXSig = Mpy_32_32( L_shl_sat( dmxCoeff, 1 ), sig[0][binIdx] );
dmxSignalReal[binIdx] = L_add( dmxSignalReal[binIdx], tmpDMXSig );
move32();
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ targetEne64 = W_mac_32_32( targetEne64, tmpDMXSig, tmpDMXSig );
+#else
targetEne = L_add( targetEne, Mpy_32_32( tmpDMXSig, tmpDMXSig ) );
-
+#endif
tmpDMXSig = Mpy_32_32( L_shl_sat( dmxCoeff, 1 ), mdst[binIdx] );
dmxSignalImag[binIdx] = L_add( dmxSignalImag[binIdx], tmpDMXSig );
move32();
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ targetEne64 = W_mac_32_32( targetEne64, tmpDMXSig, tmpDMXSig );
+#else
targetEne = L_add( targetEne, Mpy_32_32( tmpDMXSig, tmpDMXSig ) );
+#endif
}
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ targetEnergy64[bandIdx] = W_add( targetEnergy64[bandIdx], W_shr( targetEne64, 1 ) );
+ if ( NE_64( targetEnergy64[bandIdx], 0 ) )
+ {
+ scf1 = s_min( scf1, W_norm( targetEnergy64[bandIdx] ) );
+ }
+#else
targetEnergy[bandIdx] = L_add( targetEnergy[bandIdx], targetEne );
move32();
+#endif
} /* end of band loop */
}
}
@@ -855,52 +878,101 @@ void ivas_ls_setup_conversion_process_mdct_fx(
FOR( bandIdx = 0; bandIdx < hLsSetUpConversion->sfbCnt; bandIdx++ )
{
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ Word32 tmpReal, tmpImag;
+ Word64 DMXEne64;
+#else
Word32 tmpReal, tmpImag, DMXEne;
Word16 DMXEne_exp;
-
+#endif
start = hLsSetUpConversion->sfbOffset[bandIdx];
move16();
stop = hLsSetUpConversion->sfbOffset[bandIdx + 1];
move16();
/* Loop over all the bins in the band */
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ DMXEne64 = 0;
+ move64();
+#else
DMXEne = 0;
move32();
DMXEne_exp = 0;
move16();
+#endif
+
FOR( binIdx = start; binIdx < stop; binIdx++ )
{
tmpReal = dmxSignalReal[binIdx];
move32();
tmpImag = dmxSignalImag[binIdx];
move32();
-
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ DMXEne64 = W_mac_32_32( DMXEne64, tmpReal, tmpReal );
+ DMXEne64 = W_mac_32_32( DMXEne64, tmpImag, tmpImag );
+#else
DMXEne = BASOP_Util_Add_Mant32Exp( DMXEne, DMXEne_exp, L_add( Mpy_32_32( tmpReal, tmpReal ), Mpy_32_32( tmpImag, tmpImag ) ), sub( 40, shl( q_output, 1 ) ), &DMXEne_exp );
+#endif
+ }
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ dmxEnergy64[bandIdx] = W_add( dmxEnergy64[bandIdx], W_shr( DMXEne64, 1 ) );
+ if ( NE_64( dmxEnergy64[bandIdx], 0 ) )
+ {
+ scf2 = s_min( scf2, W_norm( dmxEnergy64[bandIdx] ) );
}
+#else
dmxEnergy[bandIdx] = BASOP_Util_Add_Mant32Exp( dmxEnergy[bandIdx], dmxEnergy_exp[bandIdx], DMXEne, DMXEne_exp, &dmxEnergy_exp[bandIdx] );
move32();
dmxEnergy_exp_temp = s_max( dmxEnergy_exp_temp, dmxEnergy_exp[bandIdx] );
+#endif
}
} /* end of out channel loop */
-
+#ifndef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
/* Scaling to common exponent */
FOR( bandIdx = 0; bandIdx < MAX_SFB + 2; bandIdx++ )
{
dmxEnergy[bandIdx] = L_shl( dmxEnergy[bandIdx], sub( dmxEnergy_exp[bandIdx], dmxEnergy_exp_temp ) );
move32();
}
+#endif
/* Step 3: Peform energy smoothing */
-
Word16 te_scale = getScaleFactor32( hLsSetUpConversion->targetEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt );
scale_sig32( hLsSetUpConversion->targetEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt, te_scale );
+
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ Word16 dmx_scale = getScaleFactor32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt );
+ scale_sig32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt, dmx_scale );
+
+ Word16 targetEnergy_e = sub( add( sub( 40, shl( q_output, 1 ) ), 1 ), scf1 );
+ Word16 te_max_e = s_max( targetEnergy_e, sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) );
+
+ Word16 dmxEnergy_e = sub( add( sub( 40, shl( q_output, 1 ) ), 1 ), scf2 );
+ Word16 dmx_max_e = s_max( dmxEnergy_e, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_scale ) );
+#else
Word16 dmx_sacle = getScaleFactor32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt );
scale_sig32( hLsSetUpConversion->dmxEnergyPrev_fx[0], hLsSetUpConversion->sfbCnt, dmx_sacle );
Word16 te_max_e = s_max( sub( 40, shl( q_output, 1 ) ), sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) );
Word16 dmx_max_e = s_max( dmxEnergy_exp_temp, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) );
+#endif
FOR( bandIdx = 0; bandIdx < hLsSetUpConversion->sfbCnt; bandIdx++ )
{
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ Word32 targetEnergy, dmxEnergy;
+
+ targetEnergy = W_extract_h( W_shl( targetEnergy64[bandIdx], scf1 ) );
+ targetEnergy = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( targetEnergy, sub( te_max_e, targetEnergy_e ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], sub( te_max_e, sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) ) ) ) );
+ move32();
+ hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx] = targetEnergy;
+ move32();
+
+ dmxEnergy = W_extract_h( W_shl( dmxEnergy64[bandIdx], scf2 ) );
+ dmxEnergy = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( dmxEnergy, sub( dmx_max_e, dmxEnergy_e ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], sub( dmx_max_e, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_scale ) ) ) ) );
+ move32();
+ hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx] = dmxEnergy;
+ move32();
+#else
targetEnergy[bandIdx] = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( targetEnergy[bandIdx], sub( te_max_e, sub( 40, shl( q_output, 1 ) ) ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], sub( te_max_e, sub( hLsSetUpConversion->te_prev_exp[0], te_scale ) ) ) ) );
move32();
dmxEnergy[bandIdx] = L_add( Mpy_32_32( LS_OUT_CONV_SMOOTHING_FACTOR_Q31, L_shr( dmxEnergy[bandIdx], sub( dmx_max_e, dmxEnergy_exp_temp ) ) ), Mpy_32_32( ( ONE_IN_Q31 - LS_OUT_CONV_SMOOTHING_FACTOR_Q31 ), L_shr( hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], sub( dmx_max_e, sub( hLsSetUpConversion->dmx_prev_exp[0], dmx_sacle ) ) ) ) );
@@ -909,6 +981,7 @@ void ivas_ls_setup_conversion_process_mdct_fx(
move32();
hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx] = dmxEnergy[bandIdx]; /* dmx_prev_exp = 40 - 2*q_output */
move32();
+#endif
}
hLsSetUpConversion->te_prev_exp[0] = te_max_e; /* te_prev_exp = 40 - 2*q_output */
@@ -942,7 +1015,13 @@ void ivas_ls_setup_conversion_process_mdct_fx(
move16();
/* Compute Eq gains */
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ ivas_lssetupconversion_computeEQFactor_fx( &hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->te_prev_exp[0],
+ &hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->dmx_prev_exp[0],
+ &eqGain ); // Q(eqGain) = 30
+#else
ivas_lssetupconversion_computeEQFactor_fx( &targetEnergy[bandIdx], hLsSetUpConversion->te_prev_exp[0], &dmxEnergy[bandIdx], hLsSetUpConversion->dmx_prev_exp[0], &eqGain ); // Q(eqGain) = 30
+#endif
FOR( binIdx = start; binIdx < stop; binIdx++ )
{
x[chInIdx][0][binIdx] = Mpy_32_32( L_shl( x[chInIdx][0][binIdx], 1 ), eqGain ); // Q - 1
@@ -962,8 +1041,13 @@ void ivas_ls_setup_conversion_process_mdct_fx(
move16();
/* Compute Eq gains */
+#ifdef FIX_1962_FORMAT_CONV_SPECTRAL_DIFF
+ ivas_lssetupconversion_computeEQFactor_fx( &hLsSetUpConversion->targetEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->te_prev_exp[0],
+ &hLsSetUpConversion->dmxEnergyPrev_fx[0][bandIdx], hLsSetUpConversion->dmx_prev_exp[0],
+ &eqGain );
+#else
ivas_lssetupconversion_computeEQFactor_fx( &targetEnergy[bandIdx], hLsSetUpConversion->te_prev_exp[0], &dmxEnergy[bandIdx], hLsSetUpConversion->dmx_prev_exp[0], &eqGain );
-
+#endif
FOR( subFrameIdx = 0; subFrameIdx < NB_DIV; subFrameIdx++ )
{
IF( EQ_16( transform_type[chInIdx][subFrameIdx], TCX_10 ) )
diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c
index bb604732fb3af3c78a4ed0b79f483acbe274c4fb..9832cd8a6f68df32c09d970955ba5ef7bc8e9451 100644
--- a/lib_dec/ivas_output_config_fx.c
+++ b/lib_dec/ivas_output_config_fx.c
@@ -142,7 +142,9 @@ void ivas_renderer_select(
move16();
test();
- IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ test();
+ test();
+ IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
*renderer_type = RENDERER_BINAURAL_FASTCONV;
move16();
@@ -163,7 +165,6 @@ void ivas_renderer_select(
test();
IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation )
{
-
nchan_internal = ivas_sba_get_nchan_metadata_fx( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate );
test();
test();
@@ -278,12 +279,8 @@ void ivas_renderer_select(
ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
{
test();
-#ifdef FIX_1052_EXT_OUTPUT
test();
IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#else
- IF( NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
-#endif
{
*renderer_type = RENDERER_MC;
move16();
@@ -391,27 +388,20 @@ void ivas_renderer_select(
test();
test();
test();
- test();
- test();
IF( EQ_32( ivas_format, SBA_FORMAT ) && ( NE_32( output_config, IVAS_AUDIO_CONFIG_5_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_2 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_5_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_7_1_4 ) && NE_32( output_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) && NE_32( output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) )
{
test();
test();
- IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) )
+ IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
- *internal_config = output_config;
- move16();
+ /* 'internal_config' was already set in ivas_set_audio_config_from_sba_order() */
}
- ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
+ ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) )
{
- *internal_config = IVAS_AUDIO_CONFIG_FOA;
+ *internal_config = output_config;
move16();
}
-#ifdef NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER
- ELSE IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#else
- IF( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#endif
+ ELSE
{
*internal_config = IVAS_AUDIO_CONFIG_HOA3;
move16();
@@ -440,11 +430,6 @@ void ivas_renderer_select(
*renderer_type = RENDERER_DISABLE;
move16();
}
- ELSE IF( EQ_32( ivas_format, SBA_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_MONO ) )
- {
- *renderer_type = RENDERER_SBA_LINEAR_DEC;
- move16();
- }
ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
{
*renderer_type = RENDERER_OSBA_STEREO;
@@ -488,7 +473,6 @@ void ivas_renderer_select(
}
ELSE IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
{
*renderer_type = RENDERER_OMASA_OBJECT_EXT;
@@ -504,10 +488,6 @@ void ivas_renderer_select(
*renderer_type = RENDERER_DISABLE;
move32();
}
-#else
- *renderer_type = RENDERER_DISABLE;
- move16();
-#endif
}
}
ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
@@ -516,12 +496,8 @@ void ivas_renderer_select(
move16();
test();
-#ifdef FIX_1052_EXT_OUTPUT
test();
IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#else
- IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) && NE_32( *internal_config, output_config ) )
-#endif
{
test();
test();
@@ -541,12 +517,8 @@ void ivas_renderer_select(
*internal_config = transport_config;
move16();
-#ifdef FIX_1052_EXT_OUTPUT
test();
IF( NE_32( *internal_config, output_config ) && NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
-#else
- IF( NE_32( *internal_config, output_config ) )
-#endif
{
test();
test();
@@ -578,16 +550,11 @@ void ivas_renderer_select(
}
ELSE IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCMASA ) )
{
-#ifdef FIX_1052_EXT_OUTPUT
if ( NE_32( output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
*internal_config = output_config;
move16();
}
-#else
- *internal_config = output_config;
- move16();
-#endif
/* No rendering for 1TC to Mono or Stereo and 2TC to Stereo */
test();
@@ -635,3 +602,41 @@ void ivas_renderer_select(
return;
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+/*-------------------------------------------------------------------------*
+ * ivas_renderer_secondary_select()
+ *
+ * Select IVAS secondary binaural renderer (used in combined formats)
+ *-------------------------------------------------------------------------*/
+
+/*! r: secondary binaural renderer type */
+RENDERER_TYPE ivas_renderer_secondary_select(
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+)
+{
+ RENDERER_TYPE renderer_type;
+ AUDIO_CONFIG output_config;
+
+ /* disabled by default */
+ renderer_type = RENDERER_DISABLE;
+ output_config = st_ivas->hDecoderConfig->output_config;
+ move32();
+ move32();
+
+ test();
+ test();
+ IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) )
+ {
+ renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
+ move32();
+ }
+ ELSE IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
+ {
+ renderer_type = RENDERER_BINAURAL_OBJECTS_TD;
+ move32();
+ }
+
+ return renderer_type;
+}
+#endif
diff --git a/lib_dec/ivas_post_proc_fx.c b/lib_dec/ivas_post_proc_fx.c
index 1b02b2b17fa81322d0581b49a56ebe28bc1532af..f3254c4a547fa0f2d626ae87fe07da8b67067c98 100644
--- a/lib_dec/ivas_post_proc_fx.c
+++ b/lib_dec/ivas_post_proc_fx.c
@@ -112,9 +112,7 @@ void ivas_post_proc_fx(
{
Word16 numZeros = (Word16) ( NS2SA_FX2( output_Fs, N_ZERO_MDCT_NS ) ); /*Q0*/
move16();
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
assert( sts[n]->hHQ_core->Q_old_out_fx32 == Q11 );
-#endif
Copy32( sts[n]->hHQ_core->old_out_fx32 + numZeros, sts[n]->hTcxDec->FBTCXdelayBuf_32, delay_comp ); /*Q11*/
}
@@ -591,11 +589,7 @@ void stereo_dft_dec_core_switching_fx(
Word32 tmp_fade_fx[max( STEREO_DFT_ALLPASS_FADELEN_12k8, STEREO_DFT_ALLPASS_FADELEN_16k )];
Copy32( st->hHQ_core->old_out_LB_fx32 + numZeros, hCPE->hStereoDft->ap_fade_mem_fx, ap_fade_len ); /*st->hHQ_core->q_old_outLB_fx*/
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
hCPE->hStereoDft->q_ap_fade_mem_fx = st->hHQ_core->Q_old_out_fx32;
-#else
- hCPE->hStereoDft->q_ap_fade_mem_fx = st->hHQ_core->q_old_outLB_fx;
-#endif
move16();
test();
diff --git a/lib_dec/ivas_qmetadata_dec_fx.c b/lib_dec/ivas_qmetadata_dec_fx.c
index bf0cbbd8e5bf391ca94de5b84806fac3dd9190bf..f71a40e1cd353b67a81860dd8d88457a6a77b458 100644
--- a/lib_dec/ivas_qmetadata_dec_fx.c
+++ b/lib_dec/ivas_qmetadata_dec_fx.c
@@ -39,13 +39,13 @@
#include "ivas_rom_dec.h"
#include "wmc_auto.h"
#include "prot_fx.h"
-
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+
/*-----------------------------------------------------------------------*
* Local function prototypes
*-----------------------------------------------------------------------*/
+
static Word16 ivas_qmetadata_entropy_decode_diffuseness( UWord16 *bitstream, Word16 *index, IVAS_QDIRECTION *q_direction, UWord16 *diffuseness_index_max_ec_frame );
static Word16 ivas_qmetadata_entropy_decode_df_ratio( UWord16 *bitstream, Word16 *index, IVAS_QDIRECTION *q_direction, Word16 *dfRatio_bits );
static Word16 ivas_qmetadata_raw_decode_dir_fx( IVAS_QDIRECTION *q_direction, UWord16 *bitstream, Word16 *index, const Word16 nbands, const Word16 start_band, const Word16 hrmasa_flag );
@@ -1185,20 +1185,13 @@ Word16 ivas_qmetadata_dec_sid_decode(
Word32 direction_vector_fx[3];
Word16 metadata_sid_bits; /* bits allocated to SID for metadata */
Word16 bits_delta, bits_dir;
-#ifdef NONBE_FIX_1052_SBA_EXT
Word16 sba_spar_bitlen;
-#endif
IF( EQ_16( ivas_format, SBA_FORMAT ) )
{
-#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( nchan_transport );
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/
metadata_sid_bits = sub( metadata_sid_bits, sba_spar_bitlen );
-#else
- metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/
- move16();
-#endif
}
ELSE
{
diff --git a/lib_dec/ivas_qspherical_dec_fx.c b/lib_dec/ivas_qspherical_dec_fx.c
index f6ac39a99f081d7fc2a3d63802bb9983abe5bc7c..f443cc81de370ba99f5e6d3f4d018a40ff96322a 100644
--- a/lib_dec/ivas_qspherical_dec_fx.c
+++ b/lib_dec/ivas_qspherical_dec_fx.c
@@ -37,7 +37,6 @@
#include "ivas_stat_dec.h"
#include "wmc_auto.h"
#include "prot_fx.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h
index b2df85c555c1ea5af07d26056ff5042a08999e2f..0b29588b2207de3cbb2cb1d3d2f7dd9839a940f6 100644
--- a/lib_dec/ivas_rom_dec.h
+++ b/lib_dec/ivas_rom_dec.h
@@ -64,7 +64,6 @@ extern const Word16 dft_win_8k_fx[70];
extern const Word16 cna_init_bands[CNA_INIT_NBANDS + 1];
-
extern const Word16 min_smooth_gains1_fx[SBA_DIRAC_STEREO_NUM_BANDS];
extern const Word16 max_smooth_gains1_fx[SBA_DIRAC_STEREO_NUM_BANDS];
extern const Word16 min_smooth_gains2_fx[SBA_DIRAC_STEREO_NUM_BANDS];
@@ -90,12 +89,6 @@ extern const UWord16 *const sym_freq_ECSQ_tab_abs_lsbs[1 + 4];
extern const Word16 dirac_dithering_azi_scale_fx[DIRAC_DIFFUSE_LEVELS];
extern const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS];
-#ifndef FIX_1053_REVERB_RECONFIGURATION
-/*----------------------------------------------------------------------------------*
- * FASTCONV and PARAMETRIC binaural renderer ROM tables
- *----------------------------------------------------------------------------------*/
-extern const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][11];
-#endif
/*----------------------------------------------------------------------*
* MC ParamUpmix ROM tables
diff --git a/lib_dec/ivas_rom_dec_fx.c b/lib_dec/ivas_rom_dec_fx.c
index 63b1cb6a8491c3297e7517a41f712c7b76bf00d6..8b2a2d27e30190397fede143c25f4d1ac07b923c 100644
--- a/lib_dec/ivas_rom_dec_fx.c
+++ b/lib_dec/ivas_rom_dec_fx.c
@@ -373,17 +373,6 @@ const Word16 dirac_dithering_ele_scale_fx[DIRAC_DIFFUSE_LEVELS] =
* FASTCONV and PARAMETRIC binaural renderer ROM tables
*----------------------------------------------------------------------------------*/
-#ifndef FIX_1053_REVERB_RECONFIGURATION
-/*----------------------------------------------------------------------------------*
- * FASTCONV and PARAMETRIC binaural renderer ROM tables
- *----------------------------------------------------------------------------------*/
-
-const Word32 dmxmtx_table_fx[BINAURAL_CHANNELS][11] =
-{ // Q31
- { 0x7fffffff, 0, 1518485623, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0 },
- { 0, 0x7fffffff, 1518485623, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff, 0, 0x7fffffff },
-};
-#endif
/*----------------------------------------------------------------------*
diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c
index 1189abd24d6ae8fc8843375c71c80655b2086b51..6a77c5c0ec6068c60b854d6489f8d0117521e487 100644
--- a/lib_dec/ivas_sba_dec_fx.c
+++ b/lib_dec/ivas_sba_dec_fx.c
@@ -59,9 +59,7 @@ void ivas_sba_set_cna_cng_flag(
test();
test();
test();
-#ifdef NONBE_FIX_ISM_XOVER_BR
test();
-#endif
IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) && EQ_16( st_ivas->nchan_transport, 1 ) )
{
/* skip as done in init function */
@@ -75,11 +73,7 @@ void ivas_sba_set_cna_cng_flag(
st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1;
move16();
}
-#ifdef NONBE_FIX_ISM_XOVER_BR
ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
-#else
- ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) )
-#endif
{
FOR( n = 0; n < CPE_CHANNELS; n++ )
{
@@ -113,9 +107,12 @@ void ivas_sba_set_cna_cng_flag(
*-------------------------------------------------------------------*/
ivas_error ivas_sba_dec_reconfigure_fx(
- Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */
+ Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
+#ifndef FIX_HRTF_LOAD
+ ,
UWord16 *nSamplesFlushed, /* o : number of samples flushed Q0*/
Word16 *data /* o : output synthesis signal Q0*/
+#endif
)
{
Word16 nchan_transport_old, nSCE_old, nCPE_old, nchan_hp20_old;
@@ -131,9 +128,7 @@ ivas_error ivas_sba_dec_reconfigure_fx(
ivas_error error;
ISM_MODE ism_mode_old;
Word16 granularity_new;
-#ifdef NONBE_FIX_ISM_XOVER_BR
Word16 nchan_transport;
-#endif
ism_mode_old = st_ivas->ism_mode;
hDecoderConfig = st_ivas->hDecoderConfig;
@@ -156,11 +151,7 @@ ivas_error ivas_sba_dec_reconfigure_fx(
IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
-#ifdef NONBE_FIX_ISM_XOVER_BR
IF( EQ_16( ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ), ISM_SBA_MODE_DISC ) )
-#else
- IF( GE_32( ivas_total_brate, IVAS_256k ) )
-#endif
{
st_ivas->ism_mode = ISM_SBA_MODE_DISC;
move16();
@@ -188,8 +179,10 @@ ivas_error ivas_sba_dec_reconfigure_fx(
st_ivas->sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, st_ivas->sba_order );
+#ifndef FIX_HRTF_LOAD
*nSamplesFlushed = 0;
move16();
+#endif
granularity_new = st_ivas->hTcBuffer->n_samples_granularity; /*Q0*/
move16();
@@ -248,6 +241,9 @@ ivas_error ivas_sba_dec_reconfigure_fx(
/* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */
IF( LT_16( granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
{
+#ifdef FIX_HRTF_LOAD
+ /* flush already done in IVAS_DEC_ReadFormat() */
+#else
/* write back info for correct rendering of the flushable samples */
st_ivas->sba_analysis_order = sba_analysis_order_old_flush; /*Q0*/
move16();
@@ -264,6 +260,7 @@ ivas_error ivas_sba_dec_reconfigure_fx(
move16();
st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; /*Q0*/
move32();
+#endif
}
ELSE IF( GT_16( granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
{
@@ -512,10 +509,8 @@ ivas_error ivas_sba_dec_reconfigure_fx(
* Allocate, initialize, and configure SCE/CPE/MCT handles
*-----------------------------------------------------------------*/
-#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = st_ivas->nchan_transport;
move16();
-#endif
IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
test();
@@ -597,12 +592,8 @@ ivas_error ivas_sba_dec_reconfigure_fx(
{
return error;
}
-#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = add( nchan_transport, st_ivas->nchan_ism );
st_ivas->nCPE = shr_r( nchan_transport, 1 );
-#else
- st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/
-#endif
move16();
}
ELSE IF( EQ_16( ism_mode_old, ISM_SBA_MODE_DISC ) && EQ_16( st_ivas->ism_mode, ISM_MODE_NONE ) )
@@ -617,29 +608,17 @@ ivas_error ivas_sba_dec_reconfigure_fx(
{
ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd );
}
-#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = st_ivas->nchan_transport;
move16();
-#endif
nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/
st_ivas->ism_mode = ISM_MODE_NONE;
move16();
}
ELSE IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
{
-#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = add( st_ivas->nchan_transport, st_ivas->nchan_ism );
st_ivas->nCPE = shr_r( nchan_transport, 1 );
nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism );
-#else
- st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->nchan_ism, 1 ), 1 ) ); /*Q0*/
- move16();
- nCPE_old = st_ivas->nCPE;
- move16();
- nchan_transport_old = st_ivas->nchan_transport;
- move16();
- nchan_transport_old = add( nchan_transport_old, st_ivas->nchan_ism ); /*Q0*/
-#endif
}
}
@@ -651,6 +630,7 @@ ivas_error ivas_sba_dec_reconfigure_fx(
/*-----------------------------------------------------------------*
* HP20 memories
*-----------------------------------------------------------------*/
+
IF( NE_32( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_hp20_old ) ), IVAS_ERR_OK ) )
{
return error;
@@ -671,6 +651,7 @@ ivas_error ivas_sba_dec_reconfigure_fx(
/*-----------------------------------------------------------------*
* CLDFB instances
*-----------------------------------------------------------------*/
+
IF( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) )
{
return error;
@@ -793,10 +774,20 @@ ivas_error ivas_sba_dec_reconfigure_fx(
return error;
}
+#ifdef FIX_HRTF_LOAD
+ return IVAS_ERR_OK;
+#else
return error;
+#endif
}
+/*-------------------------------------------------------------------*
+ * ivas_sba_dec_digest_tc()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
void ivas_sba_dec_digest_tc_fx(
Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */
const Word16 nCldfbSlots, /* i : number of CLDFB slots Q0*/
@@ -806,20 +797,18 @@ void ivas_sba_dec_digest_tc_fx(
Word16 ch_idx, nchan_transport;
/* set the md map */
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
test();
IF( st_ivas->hDirAC != NULL || EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) )
-#else
- IF( st_ivas->hDirAC )
-#endif
{
ivas_dirac_dec_set_md_map_fx( st_ivas, nCldfbSlots );
}
+
test();
IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
ivas_spar_dec_digest_tc_fx( st_ivas, st_ivas->nchan_transport, nCldfbSlots, nSamplesForRendering );
}
+
test();
IF( st_ivas->hDiracDecBin[0] != NULL && st_ivas->hDiracDecBin[0]->useTdDecorr )
{
diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
index e20e2df9ae0359478f56eb02f199311218e21177..cf22a4048ff6a45d7ca201e8b362a9de48d1181c 100644
--- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
+++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c
@@ -38,10 +38,10 @@
#include "ivas_prot_fx.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_rom_dec.h"
#include "wmc_auto.h"
+
#define SIN_NEG_30_DEGREES_Q15 ( (Word16) 0xC000 )
#define SIN_30_DEGREES_Q15 ( (Word16) 0x4000 )
@@ -622,6 +622,8 @@ static void map_params_dirac_to_stereo(
move32();
}
}
+ /* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */
+ /* In Q31, this clamping happens implicitly */
q_sqrt = 0;
move16();
side_gain[b] = Mpy_32_32( side_gain[b], Sqrt32( L_sub( MAX_32, diffuseness[b] ), &q_sqrt ) ); /*Q31 - q_sqrt*/
@@ -640,9 +642,10 @@ static void map_params_dirac_to_stereo(
q_sqrt = 0;
move16();
}
- res_pred_gain[b] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/
+ /* for residual prediction gain, allowed range is [0, 1]*/
+ res_pred_gain[b] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/
move32();
- res_pred_gain[b + STEREO_DFT_BAND_MAX] = Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ); /*Q31*/
+ res_pred_gain[b + STEREO_DFT_BAND_MAX] = L_max( Mpy_32_16_1( diffuseness[b], sub( MAX_16, surrCoh[b] ) ), 0 ); /*Q31*/
move32();
}
}
diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c
index 3bc6d337e9d57924af5fffa7957ceac12ecb2d4d..05bf47cb98fcd38164633d75a1c62cb1beb5c214 100644
--- a/lib_dec/ivas_sns_dec_fx.c
+++ b/lib_dec/ivas_sns_dec_fx.c
@@ -38,7 +38,6 @@
#include "ivas_cnst.h"
#include
#include "wmc_auto.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
/*-------------------------------------------------------------------
diff --git a/lib_dec/ivas_spar_decoder_fx.c b/lib_dec/ivas_spar_decoder_fx.c
index f96608d24f51caad7a89d7841abd5cd3c2115f29..d0c22e7b6c8f1e07df8a62282775d6e621f6a833 100644
--- a/lib_dec/ivas_spar_decoder_fx.c
+++ b/lib_dec/ivas_spar_decoder_fx.c
@@ -298,9 +298,8 @@ ivas_error ivas_spar_dec_open_fx(
IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
{
/* get correct granularity in case of binaural rendering of the discrete objects with the td obj renderer */
- Word32 quo, rem;
- iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES, &quo, &rem, 0 );
- granularity = extract_l( quo ); /*Q0*/
+ /* granularity = NS2SA( output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) */
+ granularity = shr( extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) ), 2 ); /*Q0*/
}
IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, granularity ) ), IVAS_ERR_OK ) )
@@ -379,7 +378,6 @@ ivas_error ivas_spar_dec_fx(
Word16 next_bit_pos_orig, last_bit_pos;
UWord16 bstr_meta[MAX_BITS_METADATA], *bit_stream_orig;
ivas_error error;
- Word32 quo, rem;
push_wmops( "ivas_spar_decode" );
error = IVAS_ERR_OK;
@@ -402,8 +400,8 @@ ivas_error ivas_spar_dec_fx(
IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
- iDiv_and_mod_32( hDecoderConfig->ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- last_bit_pos = sub( extract_l( L_sub( quo, 1 ) ), nb_bits_read[1] ); /*Q0*/
+ i = extract_l( Mpy_32_32_r( hDecoderConfig->ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ last_bit_pos = sub( sub( i, 1 ), nb_bits_read[1] ); /*Q0*/
}
ELSE
{
@@ -416,32 +414,24 @@ ivas_error ivas_spar_dec_fx(
/* read DirAC bitstream */
IF( st_ivas->hQMetaData != NULL )
{
-#ifdef NONBE_FIX_1052_SBA_EXT
ivas_dirac_dec_read_BS_fx( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag_fx( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->nchan_transport, st_ivas->hSpar->dirac_to_spar_md_bands );
-#else
- ivas_dirac_dec_read_BS_fx( hDecoderConfig->ivas_total_brate, st0, st_ivas->hDirAC, st_ivas->hSpatParamRendCom, st_ivas->hQMetaData, nb_bits_read, last_bit_pos, ivas_get_hodirac_flag_fx( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands );
-#endif
}
IF( EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
{
- iDiv_and_mod_32( hDecoderConfig->ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- last_bit_pos = sub( extract_l( L_sub( quo, 1 ) ), nb_bits_read[1] ); /*Q0*/
+ i = extract_l( Mpy_32_32_r( hDecoderConfig->ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ last_bit_pos = sub( sub( i, 1 ), nb_bits_read[1] ); /*Q0*/
}
ELSE
{
- iDiv_and_mod_32( hDecoderConfig->ivas_total_brate, FRAMES_PER_SEC, &quo, &rem, 0 );
- last_bit_pos = extract_l( L_sub( quo, 1 ) ); /*Q0*/
+ i = extract_l( Mpy_32_32_r( hDecoderConfig->ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+ last_bit_pos = sub( i, 1 ); /*Q0*/
}
test();
if ( !st0->bfi && EQ_32( hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) )
{
-#ifdef NONBE_FIX_1052_SBA_EXT
last_bit_pos = sub( last_bit_pos, ( SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS ) ); /*Q0*/
-#else
- last_bit_pos = sub( last_bit_pos, SID_FORMAT_NBITS ); /*Q0*/
-#endif
}
nb_bits_read_orig = *nb_bits_read; /*Q0*/
move16();
@@ -484,11 +474,7 @@ ivas_error ivas_spar_dec_fx(
IF( !st0->bfi && EQ_32( hDecoderConfig->ivas_total_brate, IVAS_SID_5k2 ) )
{
Word16 zero_pad_bits;
-#ifdef NONBE_FIX_1052_SBA_EXT
*nb_bits_read = add( *nb_bits_read, SID_FORMAT_NBITS + SBA_PLANAR_BITS + SBA_ORDER_BITS ); /*Q0*/
-#else
- *nb_bits_read = add( *nb_bits_read, SID_FORMAT_NBITS ); /*Q0*/
-#endif
move16();
zero_pad_bits = sub( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC, *nb_bits_read ); /*Q0*/
assert( zero_pad_bits <= 1 );
@@ -820,6 +806,7 @@ void ivas_spar_get_cldfb_gains_fx(
tgt_fx[sample] = L_shl( Mpy_32_32( tgt_fx[sample], L_add( T_fx[sample][0], L_add( T_fx[sample][1], T_fx[sample][2] ) ) ), 10 ); /*Q31*/
move32();
}
+
/* compute matrices */
FOR( slot_row = 0; slot_row < num_cf_slots; slot_row++ )
{
@@ -854,6 +841,7 @@ void ivas_spar_get_cldfb_gains_fx(
Word16 output_q = 27;
move16();
matrix_inverse_fx( Tt_T_fx, Tt_T_inv_fx, num_cf_slots, &output_q );
+
/* compute the optimal coefficients */
FOR( slot_row = 0; slot_row < num_cf_slots; slot_row++ )
{
@@ -874,6 +862,8 @@ void ivas_spar_get_cldfb_gains_fx(
return;
}
+
+
Word16 ivas_is_res_channel(
const Word16 ch, /* i : ch index in WYZX ordering Q0*/
const Word16 nchan_transport /* i : number of transport channels (1-4) Q0*/
@@ -1202,8 +1192,6 @@ void ivas_spar_get_parameters_fx(
}
ELSE
{
-
-
FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ )
{
FOR( in_ch = 0; in_ch < num_ch_in; in_ch++ )
@@ -1232,6 +1220,7 @@ void ivas_spar_get_parameters_fx(
}
}
}
+
return;
}
@@ -1328,8 +1317,10 @@ static void ivas_spar_calc_smooth_facs_fx(
Word32 smooth_short_avg_fx[IVAS_MAX_NUM_BANDS];
Word32 L_temp;
Word16 exp_tmp, q_tmp;
+
bin = 0;
move16();
+
FOR( b = 0; b < nbands_spar; b++ )
{
test();
@@ -1633,9 +1624,7 @@ void ivas_spar_dec_digest_tc_fx(
}
/* TD decorrelator */
- Word32 quo, rem;
- iDiv_and_mod_32( st_ivas->hDecoderConfig->output_Fs, FRAMES_PER_SEC, &quo, &rem, 0 );
- default_frame = extract_l( quo ); /*Q0*/
+ default_frame = extract_l( Mpy_32_32_r( st_ivas->hDecoderConfig->output_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
nSamplesLeftForTD = nSamplesForRendering; /*Q0*/
move16();
nchan_internal = ivas_sba_get_nchan_metadata_fx( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); /*Q0*/
@@ -1652,7 +1641,6 @@ void ivas_spar_dec_digest_tc_fx(
IF( hSpar->hTdDecorr )
{
-
ivas_td_decorr_process_fx( hSpar->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr );
st_ivas->hTcBuffer->q_tc_fx = s_min( st_ivas->hTcBuffer->q_tc_fx, q_format );
move16();
@@ -1703,15 +1691,25 @@ void ivas_spar_dec_upmixer_sf_fx(
)
{
Word16 cldfb_band, num_cldfb_bands, numch_in, numch_out;
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Word32 *cldfb_in_ts_re_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX];
+ Word32 *cldfb_in_ts_im_fx[HOA3_CHANNELS][CLDFB_NO_COL_MAX];
+#else
Word32 *cldfb_in_ts_re_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX];
Word32 *cldfb_in_ts_im_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][CLDFB_NO_COL_MAX];
+#endif
Word16 i, b, ts, out_ch, in_ch;
Word16 num_spar_bands, spar_band, nchan_transport;
Word16 num_in_ingest, split_band;
Word16 slot_size, slot_idx_start;
Word16 md_idx;
+#ifdef FIX_1319_STACK_SBA_DECODER
+ Word32 *p_tc_fx[HOA3_CHANNELS];
+ Word32 Pcm_tmp_fx[HOA3_CHANNELS][2 /* Re, Im*/ * L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES];
+#else
Word32 *p_tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS];
Word32 Pcm_tmp_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k];
+#endif
Word16 numch_out_dirac;
Word32 mixer_mat_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS];
Word16 b_skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
@@ -1721,6 +1719,7 @@ void ivas_spar_dec_upmixer_sf_fx(
Word16 q1 = 30;
Word16 prod;
move16();
+
push_wmops( "ivas_spar_dec_upmixer_sf_fx" );
hSpar = st_ivas->hSpar;
hDecoderConfig = st_ivas->hDecoderConfig;
@@ -1772,7 +1771,6 @@ void ivas_spar_dec_upmixer_sf_fx(
}
}
-
/*---------------------------------------------------------------------*
* TD Decorr and pcm ingest
*---------------------------------------------------------------------*/
@@ -1795,17 +1793,25 @@ void ivas_spar_dec_upmixer_sf_fx(
hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; /*Q0*/
move16();
-
/*---------------------------------------------------------------------*
* Prepare CLDFB buffers
*---------------------------------------------------------------------*/
+#ifdef FIX_1319_STACK_SBA_DECODER
+ set_zero_fx( &Pcm_tmp_fx[0][0], HOA3_CHANNELS * 2 * L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES );
+#else
set_zero_fx( &Pcm_tmp_fx[0][0], ( MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS ) * L_FRAME48k );
+#endif
+
/* set-up pointers */
IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) )
{
/* at this point, output channels are used as intermediate procesing buffers */
+#ifdef FIX_1319_STACK_SBA_DECODER
+ FOR( in_ch = 0; in_ch < HOA3_CHANNELS; in_ch++ )
+#else
FOR( in_ch = 0; in_ch < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; in_ch++ )
+#endif
{
FOR( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ )
{
@@ -1840,7 +1846,6 @@ void ivas_spar_dec_upmixer_sf_fx(
numch_out_dirac = hDecoderConfig->nchan_out;
move16();
-
/* CLDFB analysis of incoming frame */
FOR( in_ch = 0; in_ch < numch_in; in_ch++ )
{
@@ -1869,13 +1874,14 @@ void ivas_spar_dec_upmixer_sf_fx(
test();
test();
- IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) )
+ IF( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) && ( EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) )
{
Word16 q_cldfb = 6;
move16();
ivas_spar_calc_smooth_facs_fx( cldfb_in_ts_re_fx[0], cldfb_in_ts_im_fx[0], q_cldfb, num_spar_bands, hSpar->subframe_nbslots[hSpar->subframes_rendered],
hSpar->subframes_rendered == 0, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_buf_fx );
}
+
Word16 sh_l = sub( 31, q1 );
FOR( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ )
{
@@ -1888,7 +1894,7 @@ void ivas_spar_dec_upmixer_sf_fx(
test();
test();
- IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) )
+ IF( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) && ( EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_HOA3 ) ) )
{
FOR( spar_band = 0; spar_band < num_spar_bands; spar_band++ )
{
@@ -1905,6 +1911,7 @@ void ivas_spar_dec_upmixer_sf_fx(
}
}
}
+
/* Note: This version splits the cldfb band loop into 2 loops, removing some inner-loop IF_statements */
Word16 min_cldf_band = s_min( CLDFB_PAR_WEIGHT_START_BAND, num_cldfb_bands );
Word32 out_re_fx[IVAS_SPAR_MAX_CH];
@@ -1946,7 +1953,6 @@ void ivas_spar_dec_upmixer_sf_fx(
}
}
-
/* Second loop from min_cldf_band (CLDFB_PAR_WEIGHT_START_BAND) till num_cldfb_bands */
FOR( ; cldfb_band < num_cldfb_bands; cldfb_band++ )
{
@@ -1986,6 +1992,7 @@ void ivas_spar_dec_upmixer_sf_fx(
move32();
}
}
+
test();
IF( ( EQ_16( ( add( add( slot_idx_start, ts ), 1 ) ), hSpar->num_slots ) ) || ( NE_16( ( shr( md_idx, 2 ) /* md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME */ ), ( hSpar->render_to_md_map[( ( slot_idx_start + ts ) + 1 )] / JBM_CLDFB_SLOTS_IN_SUBFRAME /*It's value is 4*/ ) ) ) )
{
@@ -2031,11 +2038,15 @@ void ivas_spar_dec_upmixer_sf_fx(
test();
test();
- IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) )
+ test();
+ test();
+ IF( NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && NE_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && !( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) && EQ_32( st_ivas->intern_config, IVAS_AUDIO_CONFIG_FOA ) ) )
{
ivas_dirac_dec_render_sf_fx( st_ivas, output_fx, nchan_internal, cldfb_in_ts_re_fx, cldfb_in_ts_im_fx );
}
+
/*------------------------------------------------------------------ends*/
+
IF( st_ivas->hDirAC != NULL )
{
Word16 outchannels, idx_in, idx_lfe, ch;
diff --git a/lib_dec/ivas_spar_md_dec_fx.c b/lib_dec/ivas_spar_md_dec_fx.c
index 204840cc44dbab99b7840796d6b761260728c57f..248518134d1350dcc9022a80e7571d11a9c2033e 100644
--- a/lib_dec/ivas_spar_md_dec_fx.c
+++ b/lib_dec/ivas_spar_md_dec_fx.c
@@ -39,7 +39,7 @@
#include "wmc_auto.h"
#include "ivas_stat_dec.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+
/*------------------------------------------------------------------------------------------*
* Local constants
@@ -2646,9 +2646,7 @@ static void ivas_parse_parameter_bitstream_dtx(
Word32 pr_min_max_fx[2];
Word16 pr_q_lvls, pr, pd, pd_q_lvls, pr_pd_bits;
Word16 zero_pad_bits, sid_bits_len;
-#ifdef NONBE_FIX_1052_SBA_EXT
Word16 sba_spar_bitlen;
-#endif
sid_bits_len = st0->next_bit_pos; /*Q0*/
move16();
@@ -2734,12 +2732,8 @@ static void ivas_parse_parameter_bitstream_dtx(
}
sid_bits_len = sub( st0->next_bit_pos, sid_bits_len );
-#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( num_dmx_per_band[0] );
zero_pad_bits = sub( sba_spar_bitlen, sid_bits_len );
-#else
- zero_pad_bits = sub( ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ), sid_bits_len );
-#endif
assert( zero_pad_bits >= 0 );
if ( EQ_16( num_dmx_per_band[0], 2 ) )
{
diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h
index 05b403175fef616ef36cc9df9f9f248fb2e656a8..edf9729cedb15a3b209b976647ac2e468033fb1f 100644
--- a/lib_dec/ivas_stat_dec.h
+++ b/lib_dec/ivas_stat_dec.h
@@ -40,7 +40,6 @@
#include "stat_dec.h"
#include "ivas_stat_com.h"
#include "ivas_stat_rend.h"
-#include "isar_stat.h"
/*----------------------------------------------------------------------------------*
@@ -464,6 +463,11 @@ typedef struct ivas_param_ism_dec_data_structure
Word32 elevation_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS]; /* Q22 */
Word16 power_ratios_fx[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; /* Q15 */
+#ifdef OBJ_EDITING_API
+ Word32 edited_azimuth_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS];
+ Word32 edited_elevation_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS];
+#endif
+
/*sub-modules*/
PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM common handle */
PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; /* ParamISM rendering handle */
@@ -716,6 +720,10 @@ typedef struct ivas_osba_data
Word16 delayBuffer_size;
Word16 delayBuffer_nchan;
+#ifdef OBJ_EDITING_API
+ Word32 gain_bed_fx;
+#endif
+
} SBA_ISM_DATA, *SBA_ISM_DATA_HANDLE;
@@ -835,7 +843,7 @@ typedef struct ivas_lfe_dec_data_structure
LFE_WINDOW_HANDLE pWindow_state;
const UWord16 *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
Word16 lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS];
- Word16 lfe_block_delay_s_fx; /* Q15 */
+ Word32 delay_ns; /* Q0 */
Word16 lfe_prior_buf_len;
Word32 prior_out_buffer_fx[L_FRAME48k]; /* Q9 */
@@ -856,6 +864,7 @@ typedef struct renderer_struct
Word32 prev_gains_fx[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS]; /*Q30*/
Word16 *interpolator_fx; /*Q15*/
Word16 interpolator_len;
+ Word16 interp_offset_fx;
Word32 gains_fx[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS]; /*Q30*/
} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE;
@@ -926,7 +935,6 @@ typedef struct ivas_masa_decoder_struct
} MASA_DECODER, *MASA_DECODER_HANDLE;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
/* Data structure for MASA_ISM EXT rendering */
typedef struct ivas_masa_ism_ext_data_structure
{
@@ -943,7 +951,6 @@ typedef struct ivas_masa_ism_ext_data_structure
Word32 masa_render_masa_to_total[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR][CLDFB_NO_CHANNELS_MAX]; // Q30
} MASA_ISM_EXT_DATA, *MASA_ISM_EXT_DATA_HANDLE;
-#endif
/* Data structure for MASA_ISM rendering */
typedef struct ivas_masa_ism_data_structure
@@ -956,6 +963,10 @@ typedef struct ivas_masa_ism_data_structure
Word16 azimuth_ism_edited[MAX_NUM_OBJECTS];
Word16 elevation_ism_edited[MAX_NUM_OBJECTS];
UWord8 ism_is_edited[MAX_NUM_OBJECTS];
+#ifdef OBJ_EDITING_API
+ Word32 gain_ism[MAX_NUM_OBJECTS];
+ Word32 gain_masa;
+#endif
Word16 idx_separated_ism;
Word16 azimuth_separated_ism[MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR];
@@ -974,9 +985,9 @@ typedef struct ivas_masa_ism_data_structure
Word32 **delayBuffer_fx; /* Q11 */
Word16 delayBuffer_size;
Word16 delayBuffer_nchan;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
MASA_ISM_EXT_DATA_HANDLE hExtData;
-#endif
+
} MASA_ISM_DATA, *MASA_ISM_DATA_HANDLE;
@@ -1035,26 +1046,26 @@ typedef struct jbm_metadata_structure
typedef struct decoder_config_structure
{
- Word32 ivas_total_brate; /* IVAS total bitrate in bps */
- Word32 last_ivas_total_brate; /* last IVAS total bitrate in bps */
- Word32 output_Fs; /* output signal sampling frequency in Hz */
- Word16 nchan_out; /* number of output audio channels */
- AUDIO_CONFIG output_config; /* output audio configuration */
- Word16 Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */
- Word16 Opt_HRTF_binary; /* indicates whether HRTF binary file is used */
- Word16 Opt_Headrotation; /* indicates whether head-rotation is used */
- Word16 Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */
- IVAS_HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */
- Word16 Opt_non_diegetic_pan; /* indicates diegetic or not */
- Word16 non_diegetic_pan_gain_fx; /* non diegetic panning gain*/ /* Q15 */
- Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */
- Word16 Opt_ExternalOrientation; /* indiates whether external orientations are used */
- Word16 Opt_dpid_on; /* indicates whether Directivity pattern option is used */
- Word16 Opt_aeid_on; /* indicates whether Acoustic environment option is used */
- Word16 Opt_tsm; /* indicates whether time scaling modification is activated */
+ Word32 ivas_total_brate; /* IVAS total bitrate in bps */
+ Word32 last_ivas_total_brate; /* last IVAS total bitrate in bps */
+ Word32 output_Fs; /* output signal sampling frequency in Hz */
+ Word16 nchan_out; /* number of output audio channels */
+ AUDIO_CONFIG output_config; /* output audio configuration */
+ Word16 Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */
+ Word16 Opt_HRTF_binary; /* indicates whether HRTF binary file is used */
+ Word16 Opt_Headrotation; /* indicates whether head-rotation is used */
+ Word16 Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */
+ IVAS_HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */
+ Word16 Opt_non_diegetic_pan; /* indicates diegetic or not */
+ Word16 non_diegetic_pan_gain_fx; /* non diegetic panning gain, Q15 */
+ Word16 Opt_AMR_WB; /* flag indicating AMR-WB IO mode */
+ Word16 Opt_ExternalOrientation; /* indicates whether external orientations are used */
+ Word16 Opt_dpid_on; /* indicates whether Directivity pattern option is used */
+ Word16 Opt_aeid_on; /* indicates whether Acoustic environment option is used */
+ Word16 Opt_tsm; /* indicates whether time scaling modification is activated */
IVAS_RENDER_FRAMESIZE render_framesize;
Word16 Opt_delay_comp; /* flag indicating delay compensation active */
- int16_t Opt_Limiter;
+
} DECODER_CONFIG, *DECODER_CONFIG_HANDLE;
@@ -1072,8 +1083,8 @@ typedef struct Decoder_Struct
IVAS_FORMAT ivas_format; /* IVAS format */
IVAS_FORMAT last_ivas_format; /* last frame IVAS format */
- Word16 sid_format; /* IVAS format indicator from SID frame */
- Word16 nchan_transport; /* number of transport channels */
+ Word16 sid_format; /* IVAS format indicator from SID frame */
+ Word16 nchan_transport; /* number of transport channels */
IVAS_OUTPUT_SETUP hOutSetup; /* output setup structure */
AUDIO_CONFIG intern_config; /* internal audio configuration */
IVAS_OUTPUT_SETUP hIntSetup; /* internal setup structure */
@@ -1081,24 +1092,26 @@ typedef struct Decoder_Struct
AUDIO_CONFIG transport_config; /* transport audio configuration */
IVAS_OUTPUT_SETUP hTransSetup; /* transport setup structure */
- Word16 element_mode_init; /* element mode used at initialization */
- Word16 codec_mode; /* Mode 1 or 2 */
- Word16 ini_frame; /* initialization frames counter */
- Word16 ini_active_frame; /* initialization active frames counter */
+ Word16 element_mode_init; /* element mode used at initialization */
+ Word16 codec_mode; /* Mode 1 or 2 */
+ Word16 ini_frame; /* initialization frames counter */
+ Word16 ini_active_frame; /* initialization active frames counter */
- Word16 bfi; /* FEC - bad frame indicator */
- Word16 BER_detect; /* BER detect flag */
- Word16 num_bits; /* BER detect flag */
+ Word16 bfi; /* FEC - bad frame indicator */
+ Word16 BER_detect; /* BER detect flag */
- UWord16 *bit_stream; /* Pointer to bitstream buffer */
- Word16 writeFECoffset; /* parameter for debugging JBM stuff */
+ UWord16 *bit_stream; /* Pointer to bitstream buffer */
+ Word16 writeFECoffset; /* parameter for debugging JBM stuff */
+
+ Word32 **mem_hp20_out_fx; /* output signals HP filter memories */
IVAS_LIMITER_HANDLE hLimiter; /* Limiter handle */
+ Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* Word32-output audio buffers */
/* core-decoder modules */
- Word16 nSCE; /* number of total SCEs */
- Word16 nCPE; /* number of total CPEs */
- Word16 nCPE_old; /* number of total CPEs available in the last frame before bitrate switching */
+ Word16 nSCE; /* number of total SCEs */
+ Word16 nCPE; /* number of total CPEs */
+ Word16 nCPE_old; /* number of total CPEs available in the last frame before bitrate switching */
SCE_DEC_HANDLE hSCE[MAX_SCE]; /* SCE handles */
CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS]; /* CPE handles */
@@ -1117,12 +1130,12 @@ typedef struct Decoder_Struct
LFE_DEC_HANDLE hLFE; /* LFE handle */
ISM_MODE ism_mode; /* ISM format mode */
- Word16 nchan_ism; /* number of ISM channels */
+ Word16 nchan_ism; /* number of ISM channels */
MC_MODE mc_mode; /* MC format mode */
- Word16 sba_order; /* Ambisonic (SBA) order */
- Word16 sba_planar; /* Ambisonic (SBA) planar flag */
- Word16 sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */
- Word16 sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */
+ Word16 sba_order; /* Ambisonic (SBA) order */
+ Word16 sba_planar; /* Ambisonic (SBA) planar flag */
+ Word16 sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */
+ Word16 sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */
/* rendering modules */
RENDERER_TYPE renderer_type; /* renderer type */
@@ -1138,7 +1151,11 @@ typedef struct Decoder_Struct
MONO_DOWNMIX_RENDERER_HANDLE hMonoDmxRenderer; /* Mono downmix structure */
CREND_WRAPPER_HANDLE hCrendWrapper; /* Crend handle */
REVERB_HANDLE hReverb; /* Reverb handle */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ HRTFS_CREND_HANDLE hHrtfCrend; /* HRTF tables for CRend binaural renderer */
+#else
HRTFS_CREND_HANDLE hSetOfHRTF; /* Set of HRTFs handle (CRend) */
+#endif
HRTFS_FASTCONV_HANDLE hHrtfFastConv; /* FASTCONV HRTF tables for binaural rendering */
HRTFS_PARAMBIN_HANDLE hHrtfParambin; /* HRTF tables for parametric binauralizer */
HRTFS_STATISTICS_HANDLE hHrtfStatistics; /* HRTF statistics handle */
@@ -1146,7 +1163,7 @@ typedef struct Decoder_Struct
Word32 *hoa_dec_mtx; /* Pointer to decoder matrix for SBA */
HEAD_TRACK_DATA_HANDLE hHeadTrackData; /* Head tracking data structure */
RENDER_CONFIG_DATA *hRenderConfig; /* Renderer config pointer */
- Word32 binaural_latency_ns; /* Binauralization latency in ns */
+ Word32 binaural_latency_ns; /* Binauralization latency in ns */
EXTERNAL_ORIENTATION_HANDLE hExtOrientationData; /* External orientation data structure */
COMBINED_ORIENTATION_HANDLE hCombinedOrientationData; /* Combined external and head orientation data structure */
DIRAC_REND_HANDLE hDirACRend; /* DirAC renderer handle */
@@ -1157,7 +1174,7 @@ typedef struct Decoder_Struct
Word16 flag_omasa_brate;
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend; /* ISAR split binaural rendering handle */
- BINAURAL_TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1];
+ BINAURAL_TD_OBJECT_RENDERER_HANDLE hTdRendHandles[MAX_HEAD_ROT_POSES - 1]; /* TD object renderer handles */
/* JBM module */
DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */
@@ -1166,11 +1183,7 @@ typedef struct Decoder_Struct
Word32 last_active_ivas_total_brate;
Word16 ism_extmeta_active; /* Extended metadata active in decoder */
Word16 ism_extmeta_cnt; /* Change frame counter for extended metadata */
- Word32 **mem_hp20_out_fx;
- Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* Word32-output audio buffers */
- Word16 p_out_len;/*Stores the total no of channels for which memory is allocated to p_output_fx*/
- Word16 num_src;
- Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
+
} Decoder_Struct;
/* clang-format on */
diff --git a/lib_dec/ivas_stereo_cng_dec_fx.c b/lib_dec/ivas_stereo_cng_dec_fx.c
index 463032467ed8b90f0d9c942ea1e135f50617ea8a..b8336c928b752dbbae8c6745e4a550fd62825ba8 100644
--- a/lib_dec/ivas_stereo_cng_dec_fx.c
+++ b/lib_dec/ivas_stereo_cng_dec_fx.c
@@ -39,7 +39,7 @@
#include "ivas_rom_com.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+
/*-------------------------------------------------------------------
* Local constants
@@ -1373,6 +1373,7 @@ static void FindEmEs_fx(
/* long-term estimate */
*lt_es_em_fx = L_add( Mpy_32_32( 858993459, *lt_es_em_fx ), Mpy_32_32( 1288490188, es_em_fx ) ); /* Q24 */
move32();
+
return;
}
@@ -1422,13 +1423,15 @@ void stereo_cna_update_params_fx(
{
FindEmEs_fx( output_fx[0], output_fx[1], output_frame, &hCPE->lt_es_em_fx );
-
hCPE->hStereoCng->first_SID_after_TD = 1; /* Q0 */
move16();
stereo_cng_compute_LRcorr_fx( hCPE, output_fx, output_frame, tdm_ratio_idx );
}
ELSE
{
+ hFdCngDec->first_cna_noise_updated = 0;
+ move16();
+
return;
}
@@ -1568,7 +1571,6 @@ void stereo_cna_update_params_fx(
set16_fx( hFdCngDec->cna_cm_fx, hFdCngDec->cna_LR_LT_fx, hFdCngDec->cna_nbands );
}
-
/* Soft VAD for stereo CNA */
test();
IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) || EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) )
diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c
index 7d3bec07d2135d922a19fc6527c9cc8f8fe0b92f..789305f4884a24f2afdf2036a03d123077dfc2d9 100644
--- a/lib_dec/ivas_stereo_dft_dec_fx.c
+++ b/lib_dec/ivas_stereo_dft_dec_fx.c
@@ -41,7 +41,6 @@
#include "ivas_prot_fx.h"
#include "ivas_cnst.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_rom_dec.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
@@ -2750,9 +2749,6 @@ static void stereo_dft_compute_td_stefi_params_fx(
nbands = add( nbands, 1 );
wsum = L_add( wsum, dft_res_pred_weights_fx[bres][b - band0] );
-#ifdef DBG_TD_STEFI
- printf( "frame: %d\tband: %-2d\tpred_gain1: %f\tpred_gain2: %f\tppg1: %f\tppg2: %f\n", frame, b, hStereoDft->res_pred_gain[b + STEREO_DFT_BAND_MAX], hStereoDft->res_pred_gain[b + 2 * STEREO_DFT_BAND_MAX], hStereoDft->past_res_pred_gain[STEREO_DFT_TD_STEFI_SUBFR_DELAY - 2][b], hStereoDft->past_res_pred_gain[d_short - 1][b] );
-#endif
}
IF( nbands == 0 )
@@ -2824,12 +2820,6 @@ static void stereo_dft_compute_td_stefi_params_fx(
move32();
move16();
-#ifdef DBG_TD_STEFI
- printf( "frame: %d\tpred_gain: %f\tpred_gain_avg: %f\tg2_0: %f\tgain: %f\n", frame, pred_gain, pred_gain_avg, g2, hStereoDft->td_gain[0] );
- printf( "nrg_DMX: %f\tnrd_pred_DMX: %f\tnbands: %d\tbin0: %d\n", nrg_DMX, nrg_pred_DMX, hStereoDft->nbands, bin0 );
- /*printf( "td_gain: %f\n", hStereoDft->td_gain[0] );*/
-#endif
-
return;
}
@@ -3171,16 +3161,25 @@ void stereo_dft_generate_res_pred_fx(
move32();
DFT_PRED_RES[2 * i + 1] = L_add( L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_short_ind][2 * i + 1], g_short ), q_shift0 ), L_shl( Mpy_32_16_1( hStereoDft->DFT_past_DMX_fx[d_long_ind][2 * i + 1], g_long ), q_shift1 ) ); /* q_dft */
move32();
+#ifndef FIX_1946_CRASH_JBM_PROCESSING
past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i] ), DFT_PRED_RES[2 * i + 1], DFT_PRED_RES[2 * i + 1] ); /* q_dft */
+#endif
}
test();
IF( !bfi || GE_16( b, hStereoDft->res_cod_band_max ) )
{
Word16 q_div;
Word16 op;
+#ifdef FIX_1946_CRASH_JBM_PROCESSING
+ FOR( i = hStereoDft->band_limits[b]; i < len; i++ )
+ {
+ past_dmx_nrg = Madd_32_32( Madd_32_32( past_dmx_nrg, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i] ), DFT_PRED_RES[2 * i + 1], DFT_PRED_RES[2 * i + 1] ); /* q_dft */
+ }
+#endif
op = BASOP_Util_Divide3232_Scale( L_add( 1, dmx_nrg ), L_add( 1, past_dmx_nrg ), &q_div ); /* q_sqrt */
q_sqrt = q_div;
move16();
+
norm_fac = Sqrt16( op, &q_sqrt );
g2 = Mpy_32_16_1( pPredGain[b], norm_fac ); /* Q31 */
IF( LE_32( q_sqrt, norm_l( g2 ) ) )
diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c
index fa4e914c5c72ec2507258e7519fb36721ca57b4e..c29e1e4b54805a2b8dcfb596281740043c7d59b9 100644
--- a/lib_dec/ivas_stereo_dft_plc_fx.c
+++ b/lib_dec/ivas_stereo_dft_plc_fx.c
@@ -655,9 +655,6 @@ void stereo_dft_res_subst_spec_fx(
/* Apply phase adjustment of identified peaks, including Np=1 peak neighbors on each side */
FOR( i = *num_plocs - 1; i >= 0; i-- )
{
-#ifndef ISSUE_1796_replace_shl_o
- Flag flg_ov;
-#endif
IF( k == 0 )
{
Word32 op;
@@ -709,11 +706,7 @@ void stereo_dft_res_subst_spec_fx(
move32();
}
-#ifdef ISSUE_1796_replace_shl_o
cos_F = shl_sat( getCosWord16( extract_l( corr_phase ) ), 1 );
-#else
- cos_F = shl_o( getCosWord16( extract_l( corr_phase ) ), 1, &flg_ov );
-#endif
sin_F = getSinWord16( extract_l( corr_phase ) );
idx = s_max( 0, sub( plocs[i], Np ) ); /* Iterate over plocs[i]-1:plocs[i]+1, considering the edges of the spectrum */
diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c
index af31aea40ce19df09cd9d9dfba2162c9f9a1a301..8ef404ede324f9b8dab878f5eb378d42e56fd88f 100644
--- a/lib_dec/ivas_stereo_icbwe_dec_fx.c
+++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c
@@ -41,7 +41,6 @@
#include "wmc_auto.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#define Q_icBWE 16
diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c
index 8a1d339d427537c73ec2be05c7d8ff4b856aacf6..b2a894a34286b4c3a56972f9b2849ebc849c4d48 100644
--- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c
+++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c
@@ -176,7 +176,7 @@ void stereo_mdct_core_dec_fx(
Word16 x_len[CPE_CHANNELS][NB_DIV];
/*needed to allocate N_MAX to prevent stereo switching crash */
- Word32 x_0_buf_fx[CPE_CHANNELS][N_MAX];
+ Word32 x_0_buf_fx[CPE_CHANNELS][N_MAX]; /* note: in FLP, this buffer is shared with signal_outFB_tmp_fx[][] */
Word32 *x_0_fx[CPE_CHANNELS][NB_DIV];
/* Concealment */
@@ -229,6 +229,7 @@ void stereo_mdct_core_dec_fx(
set32_fx( x_0_buf_fx[ch], 0, N_MAX );
x_0_fx[ch][0] = &x_0_buf_fx[ch][0];
x_0_fx[ch][1] = &x_0_buf_fx[ch][0] + L_FRAME48k / 2;
+
nTnsBitsTCX10[ch][0] = 0;
move16();
nTnsBitsTCX10[ch][1] = 0;
diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c
index 57f631204777984c44b613c1b08fdffed3590fcf..2cd075478f6dc237099144841f8496d8ad00b639 100644
--- a/lib_dec/ivas_stereo_switching_dec_fx.c
+++ b/lib_dec/ivas_stereo_switching_dec_fx.c
@@ -41,13 +41,15 @@
#include "wmc_auto.h"
#include
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+
/*-------------------------------------------------------------------*
* Local constants
*-------------------------------------------------------------------*/
+
#define DFT2TD_CORR_THRESH_FX 1932735283
+
/*-------------------------------------------------------------------*
* Function allocate_CoreCoder_TCX()
*
@@ -68,10 +70,8 @@ static ivas_error allocate_CoreCoder_TCX_fx(
reset_tcx_overl_buf_fx( st->hTcxDec );
// st->hTcxDec->CngLevelBackgroundTrace_bfi = 0; //initializing to avoid garbage overflow;
set16_fx( st->hTcxDec->syn_OverlFB, 0, L_FRAME48k / 2 );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hTcxDec->Q_syn_OverlFB = 0;
move16();
-#endif
set16_fx( st->hTcxDec->old_synth, 0, OLD_SYNTH_INTERNAL_DEC );
st->hTcxDec->q_old_synth = 0;
move16();
@@ -363,6 +363,7 @@ static void cpy_tcx_ltp_data_fx(
*
* Dynamically allocate/deallocate data structures depending on the actual CPE mode
*-------------------------------------------------------------------*/
+
ivas_error stereo_memory_dec_fx(
const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/
CPE_DEC_HANDLE hCPE, /* i : CPE decoder structure */
@@ -422,9 +423,7 @@ ivas_error stereo_memory_dec_fx(
test();
IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) )
{
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
assert( hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 == hCPE->hCoreCoder[1]->hHQ_core->Q_old_out_fx32 );
-#endif
v_add_32( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[1]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); /* exp(exp_old_out) */
v_multc_fixed_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, 16384 /* 0.5 in Q15 */, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, extract_l( Mpy_32_16_1( output_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); /* exp(exp_old_out) */
@@ -1096,6 +1095,7 @@ ivas_error stereo_memory_dec_fx(
* Synchronize upmixed DFT/TD/MDCT stereo synthesis to match the overall delay of 32ms
* Handling of TD stereo <-> DFT stereo transitions
*-------------------------------------------------------------------*/
+
void synchro_synthesis_fx(
const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/
CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
@@ -1267,7 +1267,8 @@ void synchro_synthesis_fx(
test();
test();
test();
- IF( ( NE_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && !sba_dirac_stereo_flag && NE_16( dft_mono_brate_switch, -1 ) ) || EQ_16( dft_mono_brate_switch, 1 ) )
+ test();
+ IF( ( !use_cldfb_for_last_dft && NE_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && !sba_dirac_stereo_flag && NE_16( dft_mono_brate_switch, -1 ) ) || EQ_16( dft_mono_brate_switch, 1 ) )
{
Word32 *pPrev_synth_fx;
Word32 inv_fade_len_fx = 0;
@@ -1683,18 +1684,22 @@ void synchro_synthesis_fx(
return;
}
+
/*-------------------------------------------------------------------*
* Function stereo_switching_dec()
*
* Handling of memories in case of CPE modes switching
*-------------------------------------------------------------------*/
-Word32 side_gain_table[32 + 1] = { -ONE_IN_Q31, -2040109440, -1932735232, -1825361152, -1717986944,
- -1610612736, -1503238528, -1395864320, -1288490240, -1181115904, -1073741824,
- -966367616, -858993408, -751619200, -644245120, -536870912, -429496704,
- -322122496, -214748288, -107374208, 0, 107374336, 214748416,
- 322122496, 429496832, 536870912, 644245248, 751619328, 858993408,
- 966367744, 1073741824, 1181116160, 1288490240 };
+static Word32 side_gain_table[32 + 1] = {
+ -ONE_IN_Q31, -2040109440, -1932735232, -1825361152, -1717986944,
+ -1610612736, -1503238528, -1395864320, -1288490240, -1181115904, -1073741824,
+ -966367616, -858993408, -751619200, -644245120, -536870912, -429496704,
+ -322122496, -214748288, -107374208, 0, 107374336, 214748416,
+ 322122496, 429496832, 536870912, 644245248, 751619328, 858993408,
+ 966367744, 1073741824, 1181116160, 1288490240
+};
+
void stereo_switching_dec(
CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
const Word32 ivas_total_brate /* i : IVAS total bitrate Q0*/
@@ -1986,6 +1991,10 @@ void stereo_switching_dec(
Copy( sts[0]->lsf_old_fx, sts[1]->lsf_old_fx, M ); /* Q2.56 */
Copy( sts[0]->lsp_old_fx, sts[1]->lsp_old_fx, M ); /* Q15 */
+
+ sts[1]->last_core_brate = sts[0]->last_core_brate;
+ move16();
+
IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) )
{
sts[1]->last_core = sts[0]->last_core; /* Q0 */
@@ -1993,7 +2002,6 @@ void stereo_switching_dec(
sts[1]->last_coder_type = sts[0]->last_coder_type; /* Q0 */
move16();
-
// 32bit buffer
Copy32( sts[0]->hHQ_core->old_out_fx32, sts[1]->hHQ_core->old_out_fx32, L_FRAME48k ); /* exp(exp_old_out) */
Copy32( sts[0]->delay_buf_out32_fx, sts[1]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP ); /* Q11 */
@@ -2041,11 +2049,14 @@ void stereo_switching_dec(
return;
}
+
+
/*-------------------------------------------------------------------*
* Function stereo_td2dft_update()
*
* update OLA buffers - needed for switching from TD stereo to DFT stereo
*-------------------------------------------------------------------*/
+
void stereo_td2dft_update_fx(
CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
const Word16 n, /* i : channel number Q0*/
@@ -2156,9 +2167,7 @@ void stereo_td2dft_update_fx(
move16();
/* update buffers used for fading when switching to DFT Stereo */
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
assert( sts[0]->hHQ_core->Q_old_out_fx32 == sts[1]->hHQ_core->Q_old_out_fx32 );
-#endif
v_add_fx( sts[0]->hHQ_core->old_out_LB_fx32 + nsLB, sts[1]->hHQ_core->old_out_LB_fx32 + nsLB, hCPE->old_outLB_mdct_fx, old_outLB_len );
L_lerp_fx_q11( hCPE->old_outLB_mdct_fx, hCPE->old_outLB_mdct_fx, STEREO_MDCT2DFT_FADE_LEN_48k, old_outLB_len );
@@ -2191,13 +2200,16 @@ void stereo_td2dft_update_fx(
return;
}
+
+
/*-------------------------------------------------------------------*
* Function stereo_mdct2dft_update()
*
* update OLA buffers - needed for switching from MDCT stereo to DFT stereo
*-------------------------------------------------------------------*/
+
void stereo_mdct2dft_update_fx(
- CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
+ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */
Word32 output0_fx[], /* i/o: synthesis @internal Fs, ch0 Q11*/
Word32 synth0_fx[] /* i/o: synthesis @output Fs, ch0 Q11*/
)
@@ -2216,6 +2228,7 @@ void stereo_mdct2dft_update_fx(
fade_len = extract_l( Mpy_32_32( imult3216( st->output_Fs, STEREO_MDCT2DFT_FADE_LEN_48k ), 44740 ) ); // 1/48000 = 44740 (Q31) /* Q0 */
fade_len_LB = extract_l( Mpy_32_32( imult3216( 3 * STEREO_MDCT2DFT_FADE_LEN_48k * FRAMES_PER_SEC, st->L_frame ), 44740 ) ); // 1/48000 = 44740 (Q31) /* Q0 */
+
SWITCH( st->output_Fs )
{
case 16000:
@@ -2231,6 +2244,7 @@ void stereo_mdct2dft_update_fx(
move32();
BREAK;
}
+
FOR( i = 0; i < fade_len; i++ )
{
Word32 descen_gain;
@@ -2360,6 +2374,7 @@ static Word32 ncross_corr_self_fx(
quo_e = add( sub( sub( 40, q_cc ), q_prod ), quo_e );
c_c_fx_return = L_shl_sat( num, quo_e ); // Q31
}
+
return c_c_fx_return;
}
diff --git a/lib_dec/ivas_stereo_td_dec_fx.c b/lib_dec/ivas_stereo_td_dec_fx.c
index 6209d5684e8b991ae9ca45da1530efe632099225..7169e31e2042379f1a720f2460ea0189a92441c5 100644
--- a/lib_dec/ivas_stereo_td_dec_fx.c
+++ b/lib_dec/ivas_stereo_td_dec_fx.c
@@ -39,9 +39,13 @@
#include "ivas_rom_com.h"
#include "ivas_cnst.h"
#include "wmc_auto.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_prot_fx.h"
+/*-------------------------------------------------------------------*
+ * stereo_td_init_dec()
+ *
+ * Initialize TD stereo decoder
+ *-------------------------------------------------------------------*/
void stereo_td_init_dec_fx(
STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */
@@ -89,13 +93,15 @@ void stereo_td_init_dec_fx(
*
* Configure TD stereo decoder
*-------------------------------------------------------------------*/
-Word32 power_table[32 + 1] = {
+
+static Word32 power_table[32 + 1] = {
53687092, 60237908, 67588048, 75835024, 85088304, 95470648, 107119832, 120190432,
134855872, 151310800, 169773488, 190488992, 213732176, 239811440, 269072832, 301904704,
338742656, 380075520, 426451744, 478486688, 536870912, 602379200, 675880448, 758350272,
850883136, 954706496, 1071198464, 1201904384, 1348558720, 1513107968, 1697734912, 1904890240,
2137321728
}; // Q29
+
void tdm_configure_dec_fx(
const Word16 ivas_format, /* i : IVAS format Q0*/
const Word16 ism_mode, /* i : ISM mode in combined format Q0*/
diff --git a/lib_dec/ivas_svd_dec_fx.c b/lib_dec/ivas_svd_dec_fx.c
old mode 100644
new mode 100755
index 3d9d846a614a0d6d4e6933bae5eebfb5b65a8ba1..e904281b6ace1a7c00503e14c45e6e6d36a5c675
--- a/lib_dec/ivas_svd_dec_fx.c
+++ b/lib_dec/ivas_svd_dec_fx.c
@@ -29,7 +29,6 @@
the United Nations Convention on Contracts on the International Sales of Goods.
*******************************************************************************************************/
-
#include
#include "options.h"
#include "prot_fx.h"
@@ -67,32 +66,22 @@ static void HouseholderReduction_fx(
Word16 *eps_x_fx_e );
static void biDiagonalReductionLeft_fx(
- Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
- Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */
- Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */
- Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
- Word16 singularValues_e[MAX_OUTPUT_CHANNELS],
- Word16 *secDiag_e,
- const Word16 nChannelsL, /* Q0 */
+ Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
+ Word16 singularValues_e[][MAX_OUTPUT_CHANNELS], /* Q0 */
+ const Word16 nChannelsL,
const Word16 nChannelsC, /* Q0 */
const Word16 currChannel, /* Q0 */
- Word32 *sig_x, /* exp(sig_x_e) */
- Word16 *sig_x_e,
- Word32 *g /* Q31 */
-);
+ Word32 *g,
+ Word16 *g_e );
static void biDiagonalReductionRight_fx(
Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
- Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */
- Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
- Word16 *secDiag_e,
+ Word16 singularVectors_e[][MAX_OUTPUT_CHANNELS],
const Word16 nChannelsL, /* Q0 */
const Word16 nChannelsC, /* Q0 */
const Word16 currChannel, /* Q0 */
- Word32 *sig_x, /* exp(sig_x_e) */
- Word16 *sig_x_e,
- Word32 *g /* Q31 */
-); // Q31
+ Word32 *g,
+ Word16 *g_e );
static void singularVectorsAccumulationLeft_fx(
Word32 singularVectors_Left[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) as Input, Q31 as output */
@@ -822,29 +811,64 @@ static void HouseholderReduction_fx(
Word16 *eps_x_fx_e )
{
Word16 nCh;
- // float g = 0.0f, sig_x = 0.0f;// to be removed
- Word32 g_fx = 0, sig_x_fx = 0;
+
+ Word32 g_left_fx = 0;
+ Word16 g_left_e = 0;
move32();
+ move16();
+ Word32 g_right_fx = 0;
+ Word16 g_right_e = 0;
move32();
- Word16 sig_x_fx_e = 0;
move16();
+
Word16 iCh, jCh;
Word16 singularVectors_Left_fx_e[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS];
+
+ Word16 sc = 0;
+ move16();
+ sc = getScaleFactor32( singularVectors_Left_fx[0], nChannelsC );
+ FOR( jCh = 1; jCh < nChannelsL; jCh++ )
+ {
+ sc = s_min( sc, getScaleFactor32( singularVectors_Left_fx[jCh], nChannelsC ) );
+ }
FOR( jCh = 0; jCh < nChannelsL; jCh++ )
{
+ Scale_sig32( singularVectors_Left_fx[jCh], nChannelsC, sc );
FOR( iCh = 0; iCh < nChannelsC; iCh++ )
{
- singularVectors_Left_fx_e[jCh][iCh] = singularVectors_Left_e;
+ singularVectors_Left_fx_e[jCh][iCh] = singularVectors_Left_e - sc;
move16();
}
}
- /* Bidiagonal Reduction for every channel */
- FOR( nCh = 0; nCh < nChannelsC; nCh++ ) /* nChannelsC */
+ FOR( nCh = 0; nCh < nChannelsC; nCh++ )
{
- biDiagonalReductionLeft_fx( singularVectors_Left_fx, singularValues_fx, secDiag_fx, singularVectors_Left_fx_e, singularValues_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
- biDiagonalReductionRight_fx( singularVectors_Left_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsL, nChannelsC, nCh, &sig_x_fx, &sig_x_fx_e, &g_fx );
+ secDiag_fx[nCh] = g_right_fx; /* from the previous channel */
+ move32();
+ secDiag_fx_e[nCh] = g_right_e;
+
+ biDiagonalReductionLeft_fx(
+ singularVectors_Left_fx,
+ singularVectors_Left_fx_e,
+ nChannelsL,
+ nChannelsC,
+ nCh,
+ &g_left_fx,
+ &g_left_e );
+
+ singularValues_fx[nCh] = g_left_fx;
+ move32();
+ singularValues_fx_e[nCh] = g_left_e;
+
+ biDiagonalReductionRight_fx(
+ singularVectors_Left_fx,
+ singularVectors_Left_fx_e,
+ nChannelsL,
+ nChannelsC,
+ nCh,
+ &g_right_fx,
+ &g_right_e );
Word16 L_temp_e;
Word32 L_temp = BASOP_Util_Add_Mant32Exp( L_abs( singularValues_fx[nCh] ), singularValues_fx_e[nCh], L_abs( secDiag_fx[nCh] ), secDiag_fx_e[nCh], &L_temp_e ); /* exp(L_temp_e) */
@@ -857,6 +881,7 @@ static void HouseholderReduction_fx(
}
}
+
/* SingularVecotr Accumulation */
singularVectorsAccumulationRight_fx( singularVectors_Left_fx, singularVectors_Right_fx, secDiag_fx, singularVectors_Left_fx_e, secDiag_fx_e, nChannelsC );
@@ -871,101 +896,73 @@ static void HouseholderReduction_fx(
*
*
*-------------------------------------------------------------------------*/
-
static void biDiagonalReductionLeft_fx(
- Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
- Word32 singularValues[MAX_OUTPUT_CHANNELS], /* exp(singularValues_e) */
- Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_e) */
- Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
- Word16 singularValues_e[MAX_OUTPUT_CHANNELS],
- Word16 *secDiag_e,
- const Word16 nChannelsL, /* Q0 */
+ Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
+ Word16 singularVectors_e[][MAX_OUTPUT_CHANNELS], /* Q0 */
+ const Word16 nChannelsL,
const Word16 nChannelsC, /* Q0 */
const Word16 currChannel, /* Q0 */
- Word32 *sig_x, /* exp(sig_x_e) */
- Word16 *sig_x_e,
- Word32 *g /* Q31 */
-)
+ Word32 *g,
+ Word16 *g_e )
{
- Word16 iCh, jCh, idx;
+ Word16 iCh, jCh;
Word32 norm_x, f, r;
Word16 norm_x_e, f_e, r_e;
Word32 L_temp;
Word16 L_temp_e;
- secDiag[currChannel] = Mpy_32_32( *sig_x, *g ); /* exp(sig_x_e) */
- move32();
- secDiag_e[currChannel] = *sig_x_e;
- move16();
-
/* Setting values to 0 */
- ( *sig_x ) = 0;
- move32();
- ( *g ) = 0;
+ *g = 0;
+ *g_e = 0;
move32();
+ move16();
IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */
{
- idx = currChannel;
+ Word64 temp = 0;
+ move64();
+ norm_x = 0;
+ move32();
+ norm_x_e = 0;
+ move16();
+ Word16 max_e = MIN_16;
move16();
+ FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
+ {
+ max_e = s_max( max_e, singularVectors_e[jCh][currChannel] );
+ }
- FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
+ FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
{
- ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[jCh][currChannel] ), singularVectors2_e[jCh][currChannel], sig_x_e ); /* exp(sig_x_e) */
+ temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sub( max_e, singularVectors_e[jCh][currChannel] ), 1 ) ) );
}
- IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
+ Word16 nrm = W_norm( temp );
+ nrm = sub( nrm, 32 );
+ norm_x = W_shl_sat_l( temp, nrm );
+ norm_x_e = sub( add( max_e, max_e ), nrm );
+
+ IF( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
{
Word16 invVal_e;
Word32 invVal;
- invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e );
- Word64 temp = 0;
- move64();
- Word16 max_e = MIN_16;
- move16();
- FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
- {
- Word16 temp_e = norm_l( singularVectors[jCh][currChannel] );
- singularVectors[jCh][currChannel] = Mpy_32_32( L_shl( singularVectors[jCh][currChannel], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
- move32();
- singularVectors2_e[jCh][currChannel] = sub( add( invVal_e, sub( singularVectors2_e[jCh][currChannel], *sig_x_e ) ), temp_e );
- move16();
- max_e = s_max( max_e, singularVectors2_e[jCh][currChannel] );
- }
- FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
- {
- temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][currChannel] ), shl( sub( max_e, singularVectors2_e[jCh][currChannel] ), 1 ) ) );
- }
-
- Word16 nrm = W_norm( temp );
- nrm = sub( nrm, 32 );
- norm_x = W_shl_sat_l( temp, nrm );
- norm_x_e = sub( add( max_e, max_e ), nrm );
-
- IF( GT_16( norm_x_e, 0 ) )
- {
- norm_x = MAX_32;
- move32();
- norm_x_e = 0;
- move16();
- }
L_temp_e = norm_x_e;
move16();
L_temp = Sqrt32( norm_x, &L_temp_e );
- L_temp = L_shl_r( L_temp, L_temp_e ); // Q31
- //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) );
- if ( singularVectors[currChannel][idx] >= 0 )
+ //( *g ) = L_negate( GE_32( singularVectors[currChannel][idx], 0 ) ? L_temp : L_negate( L_temp ) );
+ if ( singularVectors[currChannel][currChannel] >= 0 )
{
L_temp = L_negate( L_temp );
+ move32();
}
- ( *g ) = L_temp;
- move32();
-
- r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */
- singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* sing_exp */
+ *g = L_temp;
move32();
+ *g_e = L_temp_e;
+ move16();
+ r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][currChannel] ), singularVectors_e[currChannel][currChannel] + ( *g_e ), -norm_x, norm_x_e, &r_e ); /* exp(r_e) */
+ singularVectors[currChannel][currChannel] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][currChannel], singularVectors_e[currChannel][currChannel], -( *g ), *g_e, &singularVectors_e[currChannel][currChannel] ); /* sing_exp */
invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e );
FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */
@@ -977,16 +974,16 @@ static void biDiagonalReductionLeft_fx(
temp = 0;
move64();
- FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
+ FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
{
- max_e = s_max( max_e, singularVectors2_e[jCh][currChannel] ); /* exp(norm_x_e) */
- max2_e = s_max( max2_e, singularVectors2_e[jCh][iCh] ); /* exp(norm_x_e) */
+ max_e = s_max( max_e, singularVectors_e[jCh][currChannel] ); /* exp(norm_x_e) */
+ max2_e = s_max( max2_e, singularVectors_e[jCh][iCh] ); /* exp(norm_x_e) */
}
max_e = add( max_e, max2_e );
- FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
+ FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
{
- temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), sub( max_e, add( singularVectors2_e[jCh][currChannel], singularVectors2_e[jCh][iCh] ) ) ) );
+ temp = W_add( temp, L_shr( Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), sub( max_e, add( singularVectors_e[jCh][currChannel], singularVectors_e[jCh][iCh] ) ) ) );
}
nrm = W_norm( temp );
nrm = sub( nrm, 32 );
@@ -996,51 +993,24 @@ static void biDiagonalReductionLeft_fx(
f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */
f_e = add( invVal_e, sub( norm_x_e, r_e ) );
- FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
+ FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
{
- singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] );
- move32();
+ singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors_e[jCh][currChannel] ), &singularVectors_e[jCh][iCh] );
}
}
-
-
- FOR( jCh = idx; jCh < nChannelsL; jCh++ ) /* nChannelsL */
- {
- singularVectors[jCh][currChannel] = Mpy_32_32( singularVectors[jCh][currChannel], ( *sig_x ) ); /* sing_exp + sig_x_e */
- move32();
- singularVectors2_e[jCh][currChannel] = add( singularVectors2_e[jCh][currChannel], *sig_x_e );
- move16();
- }
}
-
- // rescaling block
- singularValues[currChannel] = Mpy_32_32( ( *sig_x ), ( *g ) ); /* sig_x_e */
- move32();
- singularValues_e[currChannel] = *sig_x_e;
- move16();
}
-
return;
}
-/*-------------------------------------------------------------------------
- * biDiagonalReductionRight()
- *
- *
- *-------------------------------------------------------------------------*/
-
static void biDiagonalReductionRight_fx(
Word32 singularVectors[][MAX_OUTPUT_CHANNELS], /* exp(singularVectors_e) */
- Word32 secDiag[MAX_OUTPUT_CHANNELS], /* exp(secDiag_exp[]) */
- Word16 singularVectors2_e[][MAX_OUTPUT_CHANNELS],
- Word16 *secDiag_exp,
+ Word16 singularVectors_e[][MAX_OUTPUT_CHANNELS],
const Word16 nChannelsL, /* Q0 */
const Word16 nChannelsC, /* Q0 */
const Word16 currChannel, /* Q0 */
- Word32 *sig_x, /* exp(sig_x_e) */
- Word16 *sig_x_e,
- Word32 *g /* Q31 */
-)
+ Word32 *g,
+ Word16 *g_e )
{
Word16 iCh, jCh, idx;
Word32 norm_x, r;
@@ -1049,50 +1019,32 @@ static void biDiagonalReductionRight_fx(
Word16 L_temp_e;
/* Setting values to 0 */
- ( *sig_x ) = 0;
- move32();
- ( *g ) = 0;
+ *g = 0;
+ *g_e = 0;
move32();
-
+ move16();
IF( LT_16( currChannel, nChannelsL ) && NE_16( currChannel, sub( nChannelsC, 1 ) ) ) /* i <=m && i !=n */
{
idx = add( currChannel, 1 ); /* Q0 */
- FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
+ norm_x = 0;
+ move32();
+ norm_x_e = 0;
+ move16();
+ FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */
{
- ( *sig_x ) = BASOP_Util_Add_Mant32Exp( *sig_x, *sig_x_e, L_abs( singularVectors[currChannel][jCh] ), singularVectors2_e[currChannel][jCh], sig_x_e ); /* exp(sig_x_e) */
+ norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
}
- IF( ( *sig_x ) ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
+ IF( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
{
- norm_x = 0;
- move32();
- norm_x_e = 0;
- move16();
-
- Word16 invVal_e, temp_e;
+ Word16 invVal_e;
Word32 invVal;
- invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( *sig_x ), &invVal_e );
- FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */
- {
- temp_e = norm_l( singularVectors[currChannel][jCh] );
- singularVectors[currChannel][jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
- move32();
- singularVectors2_e[currChannel][jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], *sig_x_e ) );
- move16();
- norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[currChannel][jCh], singularVectors[currChannel][jCh] ), shl( singularVectors2_e[currChannel][jCh], 1 ), &norm_x_e ); /* exp(norm_x_e) */
- }
- IF( GT_16( norm_x_e, 0 ) )
- {
- norm_x = MAX_32;
- move32();
- norm_x_e = 0;
- move16();
- }
+
L_temp_e = norm_x_e;
move16();
L_temp = Sqrt32( norm_x, &L_temp_e );
- L_temp = L_shl_r( L_temp, L_temp_e ); // Q31
+ // L_temp = L_shl_r( L_temp, L_temp_e ); // Q31
IF( singularVectors[currChannel][idx] >= 0 )
{
( *g ) = L_negate( L_temp ); /* exp(L_temp_e) */
@@ -1100,25 +1052,17 @@ static void biDiagonalReductionRight_fx(
}
ELSE
{
- ( *g ) = L_negate( L_negate( L_temp ) ); /* exp(L_temp_e) */
+ ( *g ) = L_temp; /* exp(L_temp_e) */
move32();
}
+ *g_e = L_temp_e;
+ move16();
- r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors2_e[currChannel][idx], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */
- singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors2_e[currChannel][idx], -( *g ), 0, &singularVectors2_e[currChannel][idx] ); /* exp(sing_exp) */
- move32();
+ r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), singularVectors_e[currChannel][idx] + ( *g_e ), -norm_x, norm_x_e, &r_e ); /* exp(r_e) */
+ singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], singularVectors_e[currChannel][idx], -( *g ), *g_e, &singularVectors_e[currChannel][idx] ); /* exp(sing_exp) */
invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e );
- FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
- {
- temp_e = norm_l( singularVectors[currChannel][jCh] );
- secDiag[jCh] = Mpy_32_32( L_shl( singularVectors[currChannel][jCh], temp_e ), invVal ); /* exp(sing_exp + (singularVectors_e - sig_x_e) */
- move32();
- secDiag_exp[jCh] = add( sub( invVal_e, temp_e ), sub( singularVectors2_e[currChannel][jCh], r_e ) );
- move16();
- }
-
FOR( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /* nChannelsL */
{
norm_x = 0;
@@ -1127,23 +1071,17 @@ static void biDiagonalReductionRight_fx(
move16();
FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
{
- norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors2_e[iCh][jCh], singularVectors2_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */
+ norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[iCh][jCh], singularVectors[currChannel][jCh] ), add( singularVectors_e[iCh][jCh], singularVectors_e[currChannel][jCh] ), &norm_x_e ); /* exp(norm_x_e) */
}
+ norm_x = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */
+ norm_x_e = add( invVal_e, sub( norm_x_e, r_e ) );
+
FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
{
- singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors2_e[iCh][jCh], Mpy_32_32( norm_x, secDiag[jCh] ), add( norm_x_e, secDiag_exp[jCh] ), &singularVectors2_e[iCh][jCh] ); /* exp(sing_exp2) */
- move32();
+ singularVectors[iCh][jCh] = BASOP_Util_Add_Mant32Exp( singularVectors[iCh][jCh], singularVectors_e[iCh][jCh], Mpy_32_32( norm_x, singularVectors[currChannel][jCh] ), add( norm_x_e, singularVectors_e[currChannel][jCh] ), &singularVectors_e[iCh][jCh] ); /* exp(sing_exp2) */
}
}
-
- FOR( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
- {
- singularVectors[currChannel][jCh] = Mpy_32_32( singularVectors[currChannel][jCh], ( *sig_x ) ); /* exp(sing_exp + sig_x_e) */
- move32();
- singularVectors2_e[currChannel][jCh] = add( singularVectors2_e[currChannel][jCh], *sig_x_e );
- move16();
- }
}
}
@@ -1211,7 +1149,7 @@ static void singularVectorsAccumulationLeft_fx(
FOR( k = nCh + 1; k < nChannelsL; k++ ) /* nChannelsL */
{
- acc = W_add( acc, W_shr( prod[k], sub( max_e, prod_e[k] ) ) );
+ acc = W_add( acc, W_shr( prod[k], s_min( 63, sub( max_e, prod_e[k] ) ) ) );
}
Word16 acc_e = W_norm( acc );
acc = W_shl( acc, acc_e );
diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c
index 0be01f7b88612b359fb0b5b88b1fda3028fdeceb..afe1b71db8c37411bbb890c45b45399d118b6185 100644
--- a/lib_dec/ivas_tcx_core_dec_fx.c
+++ b/lib_dec/ivas_tcx_core_dec_fx.c
@@ -219,8 +219,6 @@ void stereo_tcx_core_dec_fx(
/*Concealment*/
Word16 bfi;
- Word32 L_tmp, mod;
-
/*LPC*/
Word16 lsf_fx[( NB_DIV + 1 ) * M], lsp_fx[( NB_DIV + 1 ) * M], lspmid_fx[M], lsfmid_fx[M], lsf_tmp_fx[( NB_DIV + 1 ) * M];
Word16 lspnew_uw_fx[NB_DIV * M], lsfnew_uw_fx[NB_DIV * M];
@@ -228,7 +226,11 @@ void stereo_tcx_core_dec_fx(
Word16 pit_gain_fx[NB_SUBFR16k];
/*Synth*/
+#ifdef FIX_1320_STACK_CPE_DECODER
+ Word16 synth_buf_fx[OLD_SYNTH_INTERNAL_DEC + L_FRAME_PLUS_INTERNAL + M];
+#else
Word16 synth_buf_fx[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
+#endif
Word16 *synth_fx;
Word16 synth_bufFB_fx[OLD_SYNTH_SIZE_DEC + L_FRAME_PLUS + M];
Word16 *synthFB_fx;
@@ -262,8 +264,7 @@ void stereo_tcx_core_dec_fx(
* Initializations
*--------------------------------------------------------------------------------*/
- iDiv_and_mod_32( st->total_brate, FRAMES_PER_SEC, &L_tmp, &mod, 0 );
- total_nbbits = extract_l( L_tmp ); /* Q0 */
+ total_nbbits = extract_l( Mpy_32_32_r( st->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
bitsRead = 0;
move16();
LSF_Q_prediction = -1; /* to avoid compilation warnings Q0*/
@@ -302,7 +303,11 @@ void stereo_tcx_core_dec_fx(
synthFB_fx = synth_bufFB_fx + hTcxDec->old_synth_lenFB;
Copy_Scale_sig( hTcxDec->old_synth, synth_buf_fx, hTcxDec->old_synth_len, negate( st->Q_syn ) ); /* q_old_synth - st->Q_syn */
Copy( hTcxDec->old_synthFB_fx, synth_bufFB_fx, hTcxDec->old_synth_lenFB ); /* q_old_synthFB */
+#ifdef FIX_1320_STACK_CPE_DECODER
+ set16_fx( synth_fx, 0, L_FRAME_PLUS_INTERNAL + M );
+#else
set16_fx( synth_fx, 0, L_FRAME_PLUS + M );
+#endif
set16_fx( synthFB_fx, 0, L_FRAME_PLUS + M );
/*--------------------------------------------------------------------------------*
@@ -332,7 +337,7 @@ void stereo_tcx_core_dec_fx(
}
/*--------------------------------------------------------------------------------*
- * LPC PARAMETERS
+ * LPC envelope decoding
*--------------------------------------------------------------------------------*/
st->acelp_cfg.midLpc = 0;
@@ -344,6 +349,10 @@ void stereo_tcx_core_dec_fx(
{
Word16 tcx_lpc_cdk;
+#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
+ tcx_lpc_cdk = tcxlpc_get_cdk( st->coder_type );
+ move16();
+#else
test();
test();
IF( bfi && st->use_partial_copy && EQ_16( st->rf_frame_type, RF_TCXFD ) )
@@ -356,6 +365,7 @@ void stereo_tcx_core_dec_fx(
tcx_lpc_cdk = tcxlpc_get_cdk( st->coder_type ); /* Q0 */
move16();
}
+#endif
Copy( st->lsf_old_fx, &lsf_fx[0], M ); /* Q2.56 */
Copy( st->lsp_old_fx, &lsp_fx[0], M ); /* Q15 */
@@ -480,13 +490,14 @@ void stereo_tcx_core_dec_fx(
E_LPC_f_lsp_a_conversion( st->lsp_old_fx, st->old_Aq_12_8_fx, M );
}
+#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
test();
if ( st->enablePlcWaveadjust && bfi )
{
st->hPlcInfo->nbLostCmpt = add( st->hPlcInfo->nbLostCmpt, 1 ); /* Q0 */
move16();
}
-
+#endif
/*--------------------------------------------------------------------------------*
* TD-TCX concealment
*--------------------------------------------------------------------------------*/
@@ -625,6 +636,7 @@ void stereo_tcx_core_dec_fx(
test();
IF( EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, TCX_20_CORE ) )
{
+#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
test();
test();
IF( st->enablePlcWaveadjust || /* bfi */
@@ -655,7 +667,7 @@ void stereo_tcx_core_dec_fx(
}
}
}
-
+#endif
IF( !bfi && st->hTonalMDCTConc != NULL )
{
TonalMDCTConceal_SaveTimeSignal_ivas_fx( st->hTonalMDCTConc, synthFB_fx, 0, hTcxDec->L_frameTCX );
@@ -823,12 +835,13 @@ void stereo_tcx_core_dec_fx(
IF( !bfi )
{
+#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
if ( st->enablePlcWaveadjust )
{
st->hPlcInfo->nbLostCmpt = 0;
move16();
}
-
+#endif
IF( param[1 + NOISE_FILL_RANGES] != 0 )
{
Word32 tcxltp_pitch_tmp = L_add( L_deposit_h( hTcxLtpDec->tcxltp_pitch_int ), L_shl( L_deposit_l( div_s( hTcxLtpDec->tcxltp_pitch_fr, st->pit_res_max ) ), 1 ) ); /*15Q16*/
@@ -905,7 +918,9 @@ void stereo_tcx_core_dec_fx(
Word32 signal_out_32_fx[L_FRAME48k];
Word16 exp;
Copy_Scale_sig_16_32_no_sat( signal_out_fx, signal_out_32_fx, st->hFdCngDec->hFdCngCom->frameSize, Q6 );
+#ifndef FIX_1996_MASKING_NOISE
Copy_Scale_sig_16_32_no_sat( st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), Q15 );
+#endif
generate_masking_noise_ivas_fx( signal_out_32_fx, &exp, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out );
Copy_Scale_sig_32_16( signal_out_32_fx, signal_out_fx, st->hFdCngDec->hFdCngCom->frameSize, negate( exp ) ); // Q0
Copy_Scale_sig_32_16( st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, st->hFdCngDec->hFdCngCom->olapBufferSynth2, shl( st->hFdCngDec->hFdCngCom->frameSize, 1 ), -Q15 ); // Q0
@@ -1010,8 +1025,12 @@ static void dec_prm_tcx_ivas_fx(
getTCXMode_ivas_fx( st, st, 0 /* <- MCT_flag */ );
/* last_core for error concealment */
+#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
+ IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
+#else
test();
IF( !st->use_partial_copy && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
+#endif
{
st->last_core_from_bs = get_next_indice_fx( st, 1 ); /* Store decoder memory of last_core Q0*/
move16();
@@ -1056,8 +1075,10 @@ static void dec_prm_tcx_ivas_fx(
}
}
+#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
IF( !st->use_partial_copy )
{
+#endif
IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) )
{
getTCXWindowing_ivas_fx( st->core, st->last_core, st->element_mode, st->hTcxCfg, st );
@@ -1070,8 +1091,9 @@ static void dec_prm_tcx_ivas_fx(
st->dec_glr_idx = -1;
move16();
}
+#ifndef FIX_1384_MSAN_stereo_tcx_core_enc
}
-
+#endif
/*--------------------------------------------------------------------------------*
* LPC parameters
@@ -1086,6 +1108,20 @@ static void dec_prm_tcx_ivas_fx(
* TCX20/10 parameters
*--------------------------------------------------------------------------------*/
+#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
+ getTCXparam_fx( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 );
+
+ IF( LT_16( sub( *total_nbbits, bitsRead[0] ), sub( st->next_bit_pos, start_bit_pos ) ) )
+ {
+ st->BER_detect = 1;
+ move16();
+ st->next_bit_pos = add( start_bit_pos, sub( *total_nbbits, bitsRead[0] ) ); /* Q0 */
+ move16();
+ }
+
+ bitsRead[0] = sub( st->next_bit_pos, start_bit_pos ); /* Q0 */
+ move16();
+#else
IF( st->use_partial_copy == 0 )
{
getTCXparam_fx( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 );
@@ -1104,6 +1140,7 @@ static void dec_prm_tcx_ivas_fx(
bitsRead[0] = sub( st->next_bit_pos, start_bit_pos ); /* Q0 */
move16();
}
+#endif
return;
}
diff --git a/lib_dec/ivas_td_low_rate_dec_fx.c b/lib_dec/ivas_td_low_rate_dec_fx.c
index fb984f11fc32947a3a8f9867e28386c7438d0a0e..385096ba6d6d860d73dc06b7895167afe855b42e 100644
--- a/lib_dec/ivas_td_low_rate_dec_fx.c
+++ b/lib_dec/ivas_td_low_rate_dec_fx.c
@@ -326,7 +326,11 @@ void decod_gen_2sbfr_fx(
* Prepare TBE excitation
*-----------------------------------------------------------------*/
+#ifdef FIX_2010_PREP_TBE_EXC
+ prep_tbe_exc_fx( L_frame, 2 * L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/], bwe_exc, 0, NULL, Q10, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame, 2 * L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/], bwe_exc, 0, NULL, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag );
+#endif
voice_factors[i_subfr / L_SUBFR + 1] = voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/]; /* Q15 */
move16();
diff --git a/lib_dec/jbm_jb4_circularbuffer.h b/lib_dec/jbm_jb4_circularbuffer.h
index 9e3102feba4dee6b3812f2aca4cdd5c6b7461c20..8d5bcb6d44d5b17eadaff2eec26c3649476e19b8 100644
--- a/lib_dec/jbm_jb4_circularbuffer.h
+++ b/lib_dec/jbm_jb4_circularbuffer.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef JBM_JB4_CIRCULARBUFFER_H
diff --git a/lib_dec/jbm_jb4_circularbuffer_fx.c b/lib_dec/jbm_jb4_circularbuffer_fx.c
index f9d6d1ca148c39a2c2891ace4451261d119a2458..0eeb1cb1f7cd4dc14409ac0bc9278e73f3a90b85 100644
--- a/lib_dec/jbm_jb4_circularbuffer_fx.c
+++ b/lib_dec/jbm_jb4_circularbuffer_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_dec/jbm_jb4_inputbuffer.h b/lib_dec/jbm_jb4_inputbuffer.h
index 769cccba68424358d328d32f01c540de96d5904d..76eb3512393b68b48ae22d6673dbd7725353227e 100644
--- a/lib_dec/jbm_jb4_inputbuffer.h
+++ b/lib_dec/jbm_jb4_inputbuffer.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/** \file jbm_jb4_inputbuffer.h RTP input buffer with fixed capacity. */
diff --git a/lib_dec/jbm_jb4_inputbuffer_fx.c b/lib_dec/jbm_jb4_inputbuffer_fx.c
index 5497a437126a701eccbc82e1aad6bf352a654f06..f8de8e76533ac614e74e6599a07bfed488de9459 100644
--- a/lib_dec/jbm_jb4_inputbuffer_fx.c
+++ b/lib_dec/jbm_jb4_inputbuffer_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/** \file jbm_jb4_inputbuffer.c RTP input buffer with fixed capacity. */
diff --git a/lib_dec/jbm_jb4_jmf.h b/lib_dec/jbm_jb4_jmf.h
index 6b5a004348d06f61385b761e1fc1e454d84041c8..e92c629a813a55855fbc72fdd88275c8a0f12543 100644
--- a/lib_dec/jbm_jb4_jmf.h
+++ b/lib_dec/jbm_jb4_jmf.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/** \file jbm_jb4_jmf.h jitter measure fifo - a fifo used for windowed measure of network status */
diff --git a/lib_dec/jbm_jb4_jmf_fx.c b/lib_dec/jbm_jb4_jmf_fx.c
index 5ab8242c75bbbd078d3fbc6ddc30ee102bf1b224..765de8ed31ef09f5027ad5b5816750775b00c2f2 100644
--- a/lib_dec/jbm_jb4_jmf_fx.c
+++ b/lib_dec/jbm_jb4_jmf_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/** \file jbm_jb4_jmf.c jitter measure fifo - a fifo used for windowed measure of network status */
diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h
index 5b5ff16c5f2a19c2e06b74cf8bd1e456feeb8545..acc44ad32611f646884873a9fab5b231165ffd80 100644
--- a/lib_dec/jbm_jb4sb.h
+++ b/lib_dec/jbm_jb4sb.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/** \file jbm_jb4sb.h EVS Jitter Buffer Management Interface */
@@ -86,6 +86,10 @@ void JB4_Destroy( JB4_HANDLE *ph );
ivas_error JB4_Init( JB4_HANDLE h, const Word16 safetyMargin );
+#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
+void JB4_TMP_SetEvsCompatFlag( JB4_HANDLE h );
+#endif
+
JB4_DATAUNIT_HANDLE JB4_AllocDataUnit( JB4_HANDLE h );
void JB4_FreeDataUnit( JB4_HANDLE h, JB4_DATAUNIT_HANDLE dataUnit );
diff --git a/lib_dec/jbm_jb4sb_fx.c b/lib_dec/jbm_jb4sb_fx.c
index 47cc52177bc451e41402ff47922c88b94d7d5a5e..6357c3a1bc70165220d678a281b327c663a0e179 100644
--- a/lib_dec/jbm_jb4sb_fx.c
+++ b/lib_dec/jbm_jb4sb_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*! \file jbm_jb4sb.c EVS Jitter Buffer Management Interface */
@@ -198,6 +198,9 @@ struct JB4
JB4_DATAUNIT_HANDLE freeMemorySlots[MAX_JBM_SLOTS];
UWord16 nFreeMemorySlots;
/*@} */
+#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
+ bool evsMode;
+#endif
}; /* JB4 */
@@ -323,6 +326,10 @@ ivas_error JB4_Create(
}
h->nFreeMemorySlots = MAX_JBM_SLOTS;
move16();
+#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
+ h->evsMode = false;
+ move16();
+#endif
*ph = h;
return IVAS_ERR_OK;
@@ -407,6 +414,13 @@ ivas_error JB4_Init(
return IVAS_ERR_OK;
}
+#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
+void JB4_TMP_SetEvsCompatFlag( JB4_HANDLE h )
+{
+ h->evsMode = true;
+ move16();
+}
+#endif
/* Returns a memory slot to store a new data unit */
JB4_DATAUNIT_HANDLE JB4_AllocDataUnit(
@@ -419,10 +433,12 @@ JB4_DATAUNIT_HANDLE JB4_AllocDataUnit(
JB4_dropFromBuffer( h );
}
+ /* LOCK JBM MEMORY SLOT BEGIN */
h->nFreeMemorySlots = (UWord16) L_sub( h->nFreeMemorySlots, 1 );
move16();
dataUnit = h->freeMemorySlots[h->nFreeMemorySlots];
h->freeMemorySlots[h->nFreeMemorySlots] = NULL;
+ /* LOCK JBM MEMORY SLOT END */
assert( dataUnit != NULL );
return dataUnit;
@@ -436,8 +452,10 @@ void JB4_FreeDataUnit(
{
assert( dataUnit != NULL );
assert( h->nFreeMemorySlots < MAX_JBM_SLOTS );
+ /* LOCK JBM MEMORY SLOT BEGIN */
h->freeMemorySlots[h->nFreeMemorySlots] = dataUnit;
h->nFreeMemorySlots = (UWord16) L_add( h->nFreeMemorySlots, 1 );
+ /* LOCK JBM MEMORY SLOT END */
move16();
return;
@@ -756,11 +774,25 @@ static void JB4_targetPlayoutDelay(
move32();
move32();
+#ifdef NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX
+#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
+ IF( !h->evsMode )
+ {
+#endif
+ *targetDtx = JB4_MAX( *targetDtx, (UWord32) h->safetyMargin );
+ move32();
+#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
+ }
+#endif
+ *targetStartUp = JB4_MAX( *targetStartUp, (UWord32) h->safetyMargin );
+ move32();
+#else
if ( LT_64( *targetStartUp, 60 ) )
{
*targetStartUp = 60;
move32();
}
+#endif
return;
}
@@ -922,15 +954,11 @@ static void JB4_adaptActivePlayout(
}
rate = (UWord32) W_add( temp3, dropRateMin );
*scale = idiv1616( sub( 1000, (Word16) rate ), 10 );
-#ifdef NONBE_1215_FIX_JBM_MAX_SCALING
/* Limit max scaling to the duration of one frame. APA will not exceed this limit
* anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting
* the value to a sensible range here avoids integer overflows at later stages when
* converting maxScaling from milliseconds to samples. */
*maxScaling = (UWord32) JB4_MIN( W_sub( currPlayoutDelay, targetMax ), 1000 / IVAS_NUM_FRAMES_PER_SEC );
-#else
- *maxScaling = (UWord32) W_sub( currPlayoutDelay, targetMax );
-#endif
move32();
move32();
}
@@ -951,15 +979,11 @@ static void JB4_adaptActivePlayout(
{
*scale = 120;
move32();
-#ifdef NONBE_1215_FIX_JBM_MAX_SCALING
/* Limit max scaling to the duration of one frame. APA will not exceed this limit
* anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting
* the value to a sensible range here avoids integer overflows at later stages when
* converting maxScaling from milliseconds to samples. */
*maxScaling = (UWord32) JB4_MIN( W_sub( targetMaxStretch, currPlayoutDelay ), 1000 / IVAS_NUM_FRAMES_PER_SEC );
-#else
- *maxScaling = (UWord32) W_sub( targetMaxStretch, currPlayoutDelay );
-#endif
move32();
}
}
diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h
index 7955d0ea6e1b86aa6be7d6dcab90b331ef7c463f..8daf3fc11c2f27e8c638ff4c68c721458c0338b5 100644
--- a/lib_dec/jbm_pcmdsp_apa.h
+++ b/lib_dec/jbm_pcmdsp_apa.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*! @file jbm_pcmdsp_apa.h Adaptive Playout for Audio (apa). */
diff --git a/lib_dec/jbm_pcmdsp_apa_fx.c b/lib_dec/jbm_pcmdsp_apa_fx.c
index 0321a6495e844d29287aad94af717284417e336c..94b4cb6bd2dfd1c680ce42e927414bd24934c6d3 100644
--- a/lib_dec/jbm_pcmdsp_apa_fx.c
+++ b/lib_dec/jbm_pcmdsp_apa_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*! @file jbm_pcmdsp_apa.c Adaptive Playout for Audio (apa). */
@@ -76,7 +76,10 @@ struct apa_state_t
bool evs_compat_mode;
Word16 *buf_out_fx;
- Word16 Q_buf_out;
+ Word16 Q_buf_out; /* stores the scaling of buf_out_fx */
+#ifdef FIX1998_APA_EXEC_SCALING
+ Word16 Q_a_out_init_old; /* stores initially determined max. scaling of data in buf_out_fx, before beeing adjusted to previous frame scaling */
+#endif
UWord16 buf_out_capacity;
UWord16 l_buf_out;
@@ -190,6 +193,10 @@ ivas_error apa_init(
}
memset( ps->buf_out_fx, 0, ( sizeof( Word16 ) * ps->buf_out_capacity ) );
ps->Q_buf_out = Q15;
+#ifdef FIX1998_APA_EXEC_SCALING
+ ps->Q_a_out_init_old = Q15;
+ move16();
+#endif
move16();
ps->evs_compat_mode = false;
@@ -272,6 +279,10 @@ UWord8 apa_reconfigure(
ps->buf_out_fx = (Word16 *) malloc( sizeof( Word16 ) * ps->buf_out_capacity );
memset( ps->buf_out_fx, 0, ( sizeof( Word16 ) * ps->buf_out_capacity ) );
ps->Q_buf_out = Q15;
+#ifdef FIX1998_APA_EXEC_SCALING
+ ps->Q_a_out_init_old = Q15;
+ move16();
+#endif
move16();
IF( !ps->buf_out_fx )
{
@@ -897,8 +908,15 @@ UWord8 apa_exec_ivas_fx(
Word32 expScaling, actScaling;
UWord32 statsResetThreshold, statsResetShift;
Word16 Q_a_out;
+#ifdef FIX1998_APA_EXEC_SCALING
+ Word16 Q_a_out_init_old;
+#endif
Q_a_out = add( getScaleFactor32_copy( a_in, L_mult0( ps->num_channels, APA_BUF_PER_CHANNEL ) ), Q11 - Q16 - Q1 );
+#ifdef FIX1998_APA_EXEC_SCALING
+ Q_a_out_init_old = Q_a_out; /* store the possible scaling of a_in, to be re-used in the next frame */
+ move16();
+#endif
statsResetThreshold = 1637;
move32();
statsResetShift = 2;
@@ -965,7 +983,15 @@ UWord8 apa_exec_ivas_fx(
Word16 a_tmp[APA_BUF];
Word16 *buf_out_ptr = &( ps->buf_out_fx[ps->l_buf_out - ps->l_frm] );
+#ifdef FIX1998_APA_EXEC_SCALING
+ /*
+ don't compare against actual scaling in ps->Q_buf_out, but possible scaling in ps->Q_a_out_init_old; otherwise we are constantly reducing the scaling over time, leading to precision issues
+ alternative approach: determine scaling of ps->buf_out_fx, but this is costly due to the sheer amount of samples stored there...
+ */
+ Q_a_out = s_min( Q_a_out, ps->Q_a_out_init_old );
+#else
Q_a_out = s_min( Q_a_out, ps->Q_buf_out );
+#endif
Scale_sig( ps->buf_out_fx, ps->buf_out_capacity, sub( Q_a_out, ps->Q_buf_out ) ); // Q_buf_out -> Q_a_out
IF( EQ_32( ps->scale, 100 ) )
{
@@ -1079,6 +1105,10 @@ UWord8 apa_exec_ivas_fx(
}
ps->l_buf_out = (UWord16) L_add( ps->l_buf_out, l_frm_out );
move16();
+#ifdef FIX1998_APA_EXEC_SCALING
+ ps->Q_a_out_init_old = Q_a_out_init_old;
+ move16();
+#endif
*l_out = l_frm_out;
move16();
@@ -1086,6 +1116,7 @@ UWord8 apa_exec_ivas_fx(
ps->l_in_total = UL_addNsD( ps->l_in_total, ps->l_frm );
move32();
+
test();
IF( LT_32( L_abs( ps->diffSinceSetScale ), L_sub( 0x7FFFFF, L_sub( l_frm_out, ps->l_frm ) ) ) &&
LT_64( ps->nFramesSinceSetScale, statsResetThreshold ) )
diff --git a/lib_dec/jbm_pcmdsp_fifo.h b/lib_dec/jbm_pcmdsp_fifo.h
index 1375c5713eba5c5cb67d29f43bfb546d59bc3527..45acb98beb77a35bcec234fe4f0363b321a85041 100644
--- a/lib_dec/jbm_pcmdsp_fifo.h
+++ b/lib_dec/jbm_pcmdsp_fifo.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*! @file jbm_pcmdsp_fifo.h Ringbuffer (FIFO) with fixed capacity for audio samples. */
diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.h b/lib_dec/jbm_pcmdsp_similarityestimation.h
index 086f881814e1583db970c97716bb09955f988e32..7adbcd65f697dda25e8bd76e672d84b00edf3c27 100644
--- a/lib_dec/jbm_pcmdsp_similarityestimation.h
+++ b/lib_dec/jbm_pcmdsp_similarityestimation.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*! @file jbm_pcmdsp_similarityestimation.h Algorithms for correlation and similarity estimation. */
diff --git a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c
index 1166cb1f75d71f5c7d50c1881e43dd86fa75f094..25d8d2d8b2a6cf5389566db6164d33ea4a71fac8 100644
--- a/lib_dec/jbm_pcmdsp_similarityestimation_fx.c
+++ b/lib_dec/jbm_pcmdsp_similarityestimation_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*! @file jbm_pcmdsp_similarityestimation.c Algorithms for correlation and similarity estimation. */
@@ -113,15 +113,9 @@ Word16 normalized_cross_correlation_self_fx( const Word16 *signal,
sumXX = L_shl( sumXX, normX );
normY = norm_l( sumYY );
sumYY = L_shl( sumYY, normY );
-#ifdef FIX_1824
product = L_shr( L_mult0( extract_h( sumXX ), extract_h( sumYY ) ), 1 );
normXY = add( normX, normY );
normXY = sub( normXY, 32 + 1 );
-#else
- product = L_mult0( extract_h( sumXX ), extract_h( sumYY ) );
- normXY = add( normX, normY );
- normXY = sub( normXY, 32 );
-#endif
/* change norm to factor of 2 */
IF( s_and( normXY, 0x1 ) != 0 )
diff --git a/lib_dec/jbm_pcmdsp_window.h b/lib_dec/jbm_pcmdsp_window.h
index 1d193433e7b90f55d7a22902932a7bdaf19f17c2..9c6f10408254cfed60dcb9ec51c633a4d6fcf688 100644
--- a/lib_dec/jbm_pcmdsp_window.h
+++ b/lib_dec/jbm_pcmdsp_window.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
/*! @file jbm_jbm_pcmdsp_window.h Window functions. */
diff --git a/lib_dec/jbm_pcmdsp_window_fx.c b/lib_dec/jbm_pcmdsp_window_fx.c
index eba40ec988241af9b0b4385df9b56e935053ab17..8572586c3b3edc085ca8796e08477c65cddb875c 100644
--- a/lib_dec/jbm_pcmdsp_window_fx.c
+++ b/lib_dec/jbm_pcmdsp_window_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h
index 3a6ea5b458ebdb5657878c7ef62ea98ab1693b00..dc95fe00e9aac3e958d53d16508693f2c79debe5 100644
--- a/lib_dec/lib_dec.h
+++ b/lib_dec/lib_dec.h
@@ -64,6 +64,14 @@ typedef enum _IVAS_DEC_COMPLEXITY_LEVEL
IVAS_DEC_COMPLEXITY_LEVEL_THREE = 3
} IVAS_DEC_COMPLEXITY_LEVEL;
+#ifdef FIX_CREND_SIMPLIFY_CODE
+typedef enum _IVAS_DEC_PCM_TYPE
+{
+ IVAS_DEC_PCM_INT16,
+ IVAS_DEC_PCM_FLOAT,
+ IVAS_DEC_PCM_INVALID
+} IVAS_DEC_PCM_TYPE;
+#endif
/* bitstream formats that can be consumed */
typedef enum _IVAS_DEC_BS_FORMAT
@@ -96,32 +104,32 @@ typedef ivas_error ( *JbmTraceFileWriterFn )( const void *data, void *writer );
/*! r: error code */
ivas_error IVAS_DEC_Open(
- IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */
- IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */
+ IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */
+ IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */
);
/*! r: error code */
ivas_error IVAS_DEC_Configure(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const UWord32 sampleRate, /* i : output sampling frequency */
- const IVAS_AUDIO_CONFIG outputConfig, /* i : audio configuration */
- const Word16 tsmEnabled, /* i : enable TSM */
- const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */
- const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
- const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */
- const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */
- const Word16 enableExternalOrientation, /* i : enable external orientations */
- const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */
- const Word16 renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
- const Word16 Opt_non_diegetic_pan, /* i : diegetic or not */
- const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain Q15 */
- const Word16 Opt_dpid_on, /* i : enable directivity pattern option */
- const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */
- const Word16 delayCompensationEnabled /* i : enable delay compensation */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const UWord32 sampleRate, /* i : output sampling frequency */
+ const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */
+ const bool tsmEnabled, /* i : enable time scale modification */
+ const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */
+ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
+ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */
+ const bool enableHeadRotation, /* i : enable head rotation for binaural output */
+ const bool enableExternalOrientation, /* i : enable external orientations */
+ const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */
+ const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
+ const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */
+ const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain */
+ const bool dpidEnabled, /* i : enable directivity pattern option */
+ const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */
+ const bool delayCompensationEnabled /* i : enable delay compensation */
);
void IVAS_DEC_Close(
- IVAS_DEC_HANDLE *phIvasDec /* i/o: pointer to IVAS decoder handle */
+ IVAS_DEC_HANDLE *phIvasDec /* i/o: pointer to IVAS decoder handle */
);
@@ -129,187 +137,235 @@ void IVAS_DEC_Close(
/*! r: error code */
ivas_error IVAS_DEC_FeedFrame_Serial(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- UWord16 *serial, /* i : buffer containing serial input bitstream. Each bit should be stored as a single UWord16 value */
- const UWord16 num_bits, /* i : number of bits in input bitstream */
- Word16 bfi /* i : bad frame indicator flag */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ UWord16 *serial, /* i : buffer containing serial input bitstream. Each bit should be stored as a single UWord16 value */
+ const UWord16 num_bits, /* i : number of bits in input bitstream */
+ Word16 bfi /* i : bad frame indicator flag */
+);
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ivas_error IVAS_DEC_ReadFormat(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_BIN_RENDERER_TYPE *binaural_renderer, /* o : binaural renderer type */
+ IVAS_BIN_RENDERER_TYPE *binaural_renderer_sec, /* o : secondary binaural renderer type */
+ IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg /* o : HRTF set audio config. */
);
+#ifdef FIX_HRTF_LOAD_API
+ivas_error IVAS_DEC_GetSamplesDecoder(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const int16_t isSplitRend, /* i : split rendering enabled flag */
+ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */
+);
+#endif
+#endif
+
/*! r: decoder error code */
ivas_error IVAS_DEC_GetSamples(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const Word16 nSamplesAsked, /* i : number of samples wanted by the caller */
- Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
- Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */
- bool *needNewFrame /* o : indication that the decoder needs a new frame */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const Word16 nSamplesAsked, /* i : number of samples wanted by the caller */
+ Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
+ Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */
+ bool *needNewFrame /* o : indication that the decoder needs a new frame */
+);
+
+#ifdef OBJ_EDITING_API
+ivas_error IVAS_DEC_GetEditableParameters(
+ IVAS_DEC_HANDLE hIvasDec,
+ IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters
+);
+
+ivas_error IVAS_DEC_SetEditableParameters(
+ IVAS_DEC_HANDLE hIvasDec,
+ IVAS_EDITABLE_PARAMETERS hIvasEditableParameters
+);
+
+ivas_error IVAS_DEC_PrepareRenderer(
+ IVAS_DEC_HANDLE hIvasDec
);
+#endif
ivas_error IVAS_DEC_GetSplitBinauralBitstream(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */
- ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */
- Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */
- bool *needNewFrame /* o : indication that the decoder needs a new frame */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */
+ ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */
+ Word16 *nOutSamples, /* o : number of samples per channel written to output buffer */
+ bool *needNewFrame /* o : indication that the decoder needs a new frame */
);
/*! r: decoder error code */
ivas_error IVAS_DEC_GetSplitRendBitstreamHeader(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- ISAR_SPLIT_REND_CODEC *pCodec, /* o: pointer to codec setting */
- ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o: pointer to pose correction mode */
- Word16 *pIsar_frame_size_ms, /* o: pointer to isar frame size setting */
- Word16 *pCodec_frame_size_ms /* o: pointer to codec frame size setting */
- ,
- Word16 *pLc3plusHighRes /* o: pointer to LC3plus High-Res setting */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ ISAR_SPLIT_REND_CODEC *pCodec, /* o : pointer to codec setting */
+ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o : pointer to pose correction mode */
+ Word16 *pIsar_frame_size_ms, /* o : pointer to ISAR frame size setting */
+ Word16 *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */
+ Word16 *pLc3plusHighRes /* o : pointer to LC3plus High-Res setting */
);
/*! r: decoder error code */
ivas_error IVAS_DEC_GetCldfbSamples(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word32 *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */
- Word32 *out_imag, /* o : buffer for decoded PCM imag output in CLDFB domain */
- IVAS_AUDIO_CONFIG *audio_config, /* o : audio configuration */
- Word16 *nOutSamples /* o : number of samples per channel written to output buffer */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word32 *out_real, /* o : buffer for decoded PCM real output in CLDFB domain */
+ Word32 *out_imag, /* o : buffer for decoded PCM imag output in CLDFB domain */
+ IVAS_AUDIO_CONFIG *audio_config, /* o : audio configuration */
+ Word16 *nOutSamples /* o : number of samples per channel written to output buffer */
);
int16_t IVAS_DEC_is_split_rendering_enabled(
- IVAS_DEC_HANDLE hIvasDec /* i: IVAS decoder handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */
+ int16_t *isSplitRend /* o : flag to indicate if split rendering is enabled */
);
+
int16_t IVAS_DEC_is_split_rendering_coded_out(
- IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ int16_t *isSplitCoded /* o : flag to indicate if split rendering is enabled */
);
/*! r: error code */
ivas_error IVAS_DEC_GetObjectMetadata(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */
- const UWord16 zero_flag, /* i : if this flag is enabled, this function outputs a zero-initialized metadata struct */
- const UWord16 objectIdx /* i : index of the queried object */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_ISM_METADATA *metadata, /* o : struct where metadata decoded in most recently decoded frame will be written */
+ const UWord16 zero_flag, /* i : if this flag is enabled, this function outputs a zero-initialized metadata struct */
+ const UWord16 objectIdx /* i : index of the queried object */
);
/*! r: error code */
ivas_error IVAS_DEC_GetMasaMetadata(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */
- const UWord8 getFromJbmBuffer /* i : get metadata from a JBM buffer */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_MASA_DECODER_EXT_OUT_META_HANDLE *hMasaExtOutMeta, /* o : pointer to handle, which will be set to point to metadata from the most recently decoded frame */
+ const UWord8 getFromJbmBuffer /* i : get metadata from a JBM buffer */
);
/*! r: error code */
ivas_error IVAS_DEC_FeedHeadTrackData(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */
- IVAS_VECTOR3 Pos, /* i : listener position */
- const Word16 subframe_idx, /* i : subframe index */
- const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */
+ IVAS_VECTOR3 Pos, /* i : listener position */
+ const Word16 subframe_idx, /* i : subframe index */
+ const ISAR_SPLIT_REND_ROT_AXIS rot_axis /* i : external control for rotation axis for split rendering */
);
/*! r: error code */
ivas_error IVAS_DEC_FeedRefRotData(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_QUATERNION rotation /* i : reference rotation data */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_QUATERNION rotation /* i : reference rotation data */
);
/*! r: error code */
ivas_error IVAS_DEC_FeedRefVectorData(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_VECTOR3 listenerPos, /* i : Listener position */
- IVAS_VECTOR3 refPos /* i : Reference position */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_VECTOR3 listenerPos, /* i : Listener position */
+ IVAS_VECTOR3 refPos /* i : Reference position */
);
/*! r: error code */
ivas_error IVAS_DEC_FeedExternalOrientationData(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_QUATERNION orientation, /* i : external orientation data */
- Word8 enableHeadRotation, /* i : flag to enable head rotation for this frame */
- Word8 enableExternalOrientation, /* i : flag to enable external orientation for this frame */
- Word8 enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */
- Word16 numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */
- const Word16 subframe_idx /* i : subframe index */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_QUATERNION orientation, /* i : external orientation data */
+ Word8 enableHeadRotation, /* i : flag to enable head rotation for this frame */
+ Word8 enableExternalOrientation, /* i : flag to enable external orientation for this frame */
+ Word8 enableRotationInterpolation, /* i : flag to interpolate rotations from current and previous frames */
+ Word16 numFramesToTargetOrientation, /* i : number of frames until target orientation is reached */
+ const Word16 subframe_idx /* i : subframe index */
);
/*! r: error code */
ivas_error IVAS_DEC_VoIP_FeedFrame(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- UWord8 *au, /* i : buffer containing input access unit */
- const UWord16 auSize, /* i : size of the access unit */
- const UWord16 rtpSequenceNumber, /* i : RTP sequence number (16 bits) */
- const UWord32 rtpTimeStamp, /* i : RTP timestamp (32 bits) */
- const UWord32 rcvTime_ms, /* i : receive time of the RTP packet in milliseconds */
- const bool qBit /* i : Q bit for AMR-WB IO */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ UWord8 *au, /* i : buffer containing input access unit */
+ const UWord16 auSize, /* i : size of the access unit */
+ const UWord16 rtpSequenceNumber, /* i : RTP sequence number (16 bits) */
+ const UWord32 rtpTimeStamp, /* i : RTP timestamp (32 bits) */
+ const UWord32 rcvTime_ms, /* i : receive time of the RTP packet in milliseconds */
+ const bool qBit /* i : Q bit for AMR-WB IO */
);
ivas_error IVAS_DEC_VoIP_SetScale(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const Word16 maxScaling, /* i : maximum allowed TSM scale */
- const Word16 scale /* i : TSM scale to set */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const Word16 maxScaling, /* i : maximum allowed TSM scale */
+ const Word16 scale /* i : TSM scale to set */
);
ivas_error IVAS_DEC_TSM_SetQuality(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const Word16 quality /* i : target TSM quality Q14 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const Word16 quality /* i : target TSM quality Q14 */
);
/*! r: error code */
ivas_error IVAS_DEC_VoIP_GetSamples(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */
- Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
- const UWord32 systemTimestamp_ms /* i : current system timestamp */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */
+ Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
+ const UWord32 systemTimestamp_ms, /* i : current system timestamp */
+#ifdef FIX_CREND_SIMPLIFY_CODE
#ifdef SUPPORT_JBM_TRACEFILE
- , JbmTraceFileWriterFn jbmWriterFn,
- void* jbmWriter
+ JbmTraceFileWriterFn jbmWriterFn,
+ void* jbmWriter,
+#endif
+ bool *bitstreamReadDone, /* o : flag indicating that bitstream was read */
+ UWord16 *nSamplesRendered /* o : number of samples rendered */
+#else
+ #ifdef SUPPORT_JBM_TRACEFILE
+ JbmTraceFileWriterFn jbmWriterFn,
+ void* jbmWriter
+#endif
+#endif
+#ifdef OBJ_EDITING_API
+ ,
+ bool *parametersAvailableForEditing
#endif
);
ivas_error IVAS_DEC_Flush(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const Word16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */
- Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
- Word16 *nSamplesFlushed /* o : number of samples flushed */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const Word16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */
+ Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
+ Word16 *nSamplesFlushed /* o : number of samples flushed */
);
/* Setter functions - apply changes to decoder configuration */
/*! r: error code */
ivas_error IVAS_DEC_EnableVoIP(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const Word16 jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */
- const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const Word16 jbmSafetyMargin, /* i : allowed delay reserve for JBM, in milliseconds */
+ const IVAS_DEC_INPUT_FORMAT inputFormat /* i : format of the input bitstream */
);
/*! r: error code */
ivas_error IVAS_DEC_EnableSplitRendering(
- IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */
+ IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */
);
ivas_error IVAS_DEC_SetRenderFramesize(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const IVAS_RENDER_FRAMESIZE render_framesize /* i : render framesize */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_RENDER_FRAMESIZE render_framesize /* i : render framesize */
);
ivas_error IVAS_DEC_GetRenderFramesize(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_RENDER_FRAMESIZE *render_framesize /* o : render framesize */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_RENDER_FRAMESIZE *render_framesize /* o : render framesize */
);
ivas_error IVAS_DEC_GetRenderFramesizeSamples(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *render_framesize /* o : render framesize in samples Q0 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *render_framesize /* o : render framesize in samples Q0 */
);
ivas_error IVAS_DEC_GetReferencesUpdateFrequency(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *update_frequency /* o : update frequency Q0 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *update_frequency /* o : update frequency Q0 */
);
ivas_error IVAS_DEC_GetNumOrientationSubframes(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *num_subframes /* o : render framesize */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *num_subframes /* o : render framesize */
);
ivas_error IVAS_DEC_GetRenderFramesizeMs(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- UWord32 *render_framesize /* o : render framesize in samples Q0 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ UWord32 *render_framesize /* o : render framesize in samples Q0 */
);
@@ -317,113 +373,129 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs(
/*! r: error code */
ivas_error IVAS_DEC_GetNumObjects(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- UWord16 *numObjects /* o : number of objects for which the decoder has been configured */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ UWord16 *numObjects /* o : number of objects for which the decoder has been configured */
);
/*! r: error code */
ivas_error IVAS_DEC_GetFormat(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_DEC_BS_FORMAT *format /* o : format detected from bitstream fed to the decoder */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_BS_FORMAT *format /* o : format detected from bitstream fed to the decoder */
);
/*! r: error code */
ivas_error IVAS_DEC_GetOutputBufferSize(
- const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */
- Word16 *outputBufferSize /* o : total number of samples expected in the output buffer for current decoder configuration */
+ const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */
+ Word16 *outputBufferSize /* o : total number of samples expected in the output buffer for current decoder configuration*/
);
/*! r: error code */
ivas_error IVAS_DEC_GetNumOutputChannels(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *numOutputChannels /* o : number of PCM output channels */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *numOutputChannels /* o : number of PCM output channels */
);
/*! r: error code */
ivas_error IVAS_DEC_FeedCustomLsData(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const IVAS_CUSTOM_LS_DATA hLsCustomData /* i : Custom loudspeaker setup data */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_CUSTOM_LS_DATA hLsCustomData /* i : Custom loudspeaker setup data */
);
/*! r: error code */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ivas_error IVAS_DEC_GetHrtfTDrendHandle(
+#else
ivas_error IVAS_DEC_GetHrtfHandle(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */
+#endif
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_HRTF_TD_HANDLE **hHrtfTD /* o : TD rend. HRTF handle */
);
/*! r: error code */
ivas_error IVAS_DEC_GetHrtfCRendHandle(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
-IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_HRTF_CREND_HANDLE **hHrtfCrend /* o : Crend HRTF handle */
);
ivas_error IVAS_DEC_GetHrtfFastConvHandle(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */
);
ivas_error IVAS_DEC_GetHrtfParamBinHandle(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */
);
ivas_error IVAS_DEC_GetHrtfStatisticsHandle(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */
+);
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ivas_error IVAS_DEC_HRTF_binary_open(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_BIN_RENDERER_TYPE binaural_renderer /* i : binaural renderer type */
);
+ivas_error IVAS_DEC_HRTF_binary_close(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_BIN_RENDERER_TYPE binaural_renderer_old /* i : previous binaural renderer type */
+);
+#endif
+
/*! r: error code*/
ivas_error IVAS_DEC_GetRenderConfig(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */
);
/*! r: error code*/
ivas_error IVAS_DEC_GetDefaultRenderConfig(
- IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */
+ IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */
);
/*! r: error code*/
ivas_error IVAS_DEC_FeedRenderConfig(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const IVAS_RENDER_CONFIG_DATA hRenderConfig /* i : Render config data structure */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_RENDER_CONFIG_DATA hRenderConfig /* i : Render config data structure */
);
/*! r: error code */
ivas_error IVAS_DEC_GetDelay(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *nSamples, /* o : decoder delay in samples */
- Word32 *timeScale /* o : time scale of the delay, equal to decoder output sampling rate */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *nSamples, /* o : decoder delay in samples */
+ Word32 *timeScale /* o : time scale of the delay, equal to decoder output sampling rate */
);
/*! r: error code */
ivas_error IVAS_DEC_HasDecodedFirstGoodFrame(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- bool *hasDecodedFirstGoodFrame /* o : flag indicating if the decoder has decoded a good frame since it was configured */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ bool *hasDecodedFirstGoodFrame /* o : flag indicating if the decoder has decoded a good frame since it was configured */
);
/*! r: error code */
ivas_error IVAS_DEC_GetPcmFrameSize(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word32 *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels Q0 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word32 *pcmFrameSize /* o : total size of the PCM output frame. This takes into account the number of output channels Q0 */
);
/*! r: true if decoder has no data in VoIP jitter buffer */
bool IVAS_DEC_VoIP_IsEmpty(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const Word16 nSamplesAsked
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const Word16 nSamplesAsked
);
ivas_error IVAS_DEC_VoIP_Get_CA_offset(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *optimum_offset, //Q0
- Word16 *FEC_hi //Q0
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *optimum_offset, //Q0
+ Word16 *FEC_hi //Q0
);
#ifdef SUPPORT_JBM_TRACEFILE
ivas_error IVAS_DEC_GetJbmData(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_JBM_TRACE_DATA *JbmTraceData /* o : JBM Trace data */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_JBM_TRACE_DATA *JbmTraceData /* o : JBM Trace data */
);
#endif
@@ -431,18 +503,17 @@ ivas_error IVAS_DEC_GetJbmData(
/*! r: pointer to an error message string */
const char *IVAS_DEC_GetErrorMessage(
- ivas_error error /* i : decoder error code enum */
+ ivas_error error /* i : decoder error code enum */
);
-void IVAS_DEC_PrintConfig(
- const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */
- const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */
- const bool voipMode
+ivas_error IVAS_DEC_PrintConfig(
+ const IVAS_DEC_HANDLE hIvasDec, /* i : IVAS decoder handle */
+ const bool quietModeEnabled, /* i : quiet mode flag: if true, reduces the amount of config info printed */
+ const bool voipMode
);
-
void IVAS_DEC_PrintDisclaimer(
- void
+ void
);
/* clang-format on */
diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c
index cc985f28883d2a9fbca2ef6f4692f62e838ceeb7..d824a19093f276f22a85e1a8d67223fa9378c48b 100644
--- a/lib_dec/lib_dec_fx.c
+++ b/lib_dec/lib_dec_fx.c
@@ -40,7 +40,6 @@
#include "isar_prot.h"
#include "lib_isar_pre_rend.h"
#include "ivas_prot_fx.h"
-
#include "jbm_jb4sb.h"
#include "jbm_pcmdsp_apa.h"
#include "jbm_pcmdsp_fifo.h"
@@ -53,6 +52,7 @@
/*---------------------------------------------------------------------*
* Local structs
*---------------------------------------------------------------------*/
+
struct IVAS_DEC_VOIP
{
UWord16 nSamplesFrame; /* Total number of samples in a frame (includes number of channels) */
@@ -60,9 +60,7 @@ struct IVAS_DEC_VOIP
UWord16 lastDecodedWasActive;
JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */
UWord16 *bs_conversion_buf; /* Buffer for bitstream conversion from packed to serial */
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
- Word16 nSamplesRendered20ms; /* how many samples have been rendered since the last 20ms render border*/
-#endif
+ Word16 nSamplesRendered20ms; /* how many samples have been rendered since the last 20ms render border*/
#ifdef SUPPORT_JBM_TRACEFILE
IVAS_JBM_TRACE_DATA JbmTraceData;
#endif
@@ -84,9 +82,7 @@ struct IVAS_DEC
bool Opt_VOIP; /* flag indicating VOIP mode with JBM */
Word16 tsm_scale; /* scale for TSM operation */
Word16 tsm_max_scaling;
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
- Word16 timeScalingDone; /* have we done already one TSM in a 20ms frame? */
-#endif
+ Word16 timeScalingDone; /* have we done already one TSM in a 20ms frame? */
Word16 tsm_quality; /*Q14*/
Word32 *apaExecBuffer_fx; /* Buffer for APA scaling */
PCMDSP_APA_HANDLE hTimeScaler;
@@ -100,6 +96,20 @@ struct IVAS_DEC
Word16 sdp_hf_only; /* RTP payload format parameter: only Header-Full format without zero padding for size collision avoidance */
Word16 prev_ft_speech; /* RXDTX handler: previous frametype flag for G.192 format AMRWB SID_FIRST detection */
Word16 CNG; /* RXDTX handler: CNG=1, nonCNG=0 */
+
+#ifdef FIX_HRTF_LOAD
+ UWord16 nSamplesFlushed;
+#ifdef FIX_HRTF_LOAD_API
+ Word16 *flushbuffer;
+#else
+ Word16 flushbuffer[20 * 960 / 4]; // temp. hack
+#endif
+#ifdef OBJ_EDITING_API
+ bool hasEditableParameters;
+ bool enableParameterEditing;
+#endif
+ bool hasBeenPreparedRendering;
+#endif
};
/*---------------------------------------------------------------------*
@@ -114,19 +124,24 @@ static ivas_error evs_dec_main_fx( Decoder_Struct *st_ivas, const Word16 nOutSam
static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, Word16 *bitstream_format_internal, Word16 *sdp_hf_only, const bool is_voip_enabled );
static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig );
static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const UWord16 nTransportChannels, const UWord16 l_ts );
+#ifdef FIX_HRTF_LOAD
+static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, UWord16 *nTcBufferGranularity, UWord8 *nTransportChannels );
+#else
static ivas_error IVAS_DEC_Setup( IVAS_DEC_HANDLE hIvasDec, UWord16 *nTcBufferGranularity, UWord8 *nTransportChannels, UWord8 *nOutChannels, UWord16 *nSamplesRendered, Word16 *data );
+#endif
static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, Word32 *pcmBuf_fx, Word16 *nOutSamples );
static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesForRendering, Word16 *nSamplesResidual, Word32 *pcmBuf );
static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const UWord16 nSamplesForRendering, UWord16 *nSamplesRendered, UWord16 *nSamplesAvailableNext, Word16 *pcmBuf );
static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, Word16 *nSamplesBuffered );
static Word16 get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize );
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const Word16 nSamplesRendered );
-#endif
static ivas_error isar_set_split_rend_setup( ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend, const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig, const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, ISAR_SPLIT_REND_BITS_DATA *splitRendBits );
+static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
+static ivas_error ivas_dec_init_split_rend( Decoder_Struct *st_ivas );
static ivas_error ivas_create_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
+
/*---------------------------------------------------------------------*
* IVAS_DEC_Open()
*
@@ -155,6 +170,7 @@ ivas_error IVAS_DEC_Open(
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS decoder handle" );
}
+
hIvasDec = *phIvasDec;
hIvasDec->hVoIP = NULL;
hIvasDec->apaExecBuffer_fx = NULL;
@@ -162,9 +178,7 @@ ivas_error IVAS_DEC_Open(
hIvasDec->tsm_scale = 100;
hIvasDec->tsm_max_scaling = 0;
hIvasDec->tsm_quality = ONE_IN_Q14; /*1.f Q14*/
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
hIvasDec->timeScalingDone = 0;
-#endif
hIvasDec->needNewFrame = false;
hIvasDec->nTransportChannelsOld = 0;
hIvasDec->nSamplesAvailableNext = 0;
@@ -187,8 +201,19 @@ ivas_error IVAS_DEC_Open(
move16();
move16();
move16();
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
move16();
+#ifdef FIX_HRTF_LOAD
+#ifdef OBJ_EDITING_API
+ hIvasDec->flushbuffer = NULL;
+#else
+ // hIvasDec->flushbuffer = NULL;
+#endif
+ hIvasDec->nSamplesFlushed = 0;
+#ifdef OBJ_EDITING_API
+ hIvasDec->hasEditableParameters = false;
+ hIvasDec->enableParameterEditing = false;
+#endif
+ hIvasDec->hasBeenPreparedRendering = false;
#endif
hIvasDec->mode = mode;
@@ -204,6 +229,7 @@ ivas_error IVAS_DEC_Open(
move16();
move16();
move16();
+
/*-----------------------------------------------------------------*
* Initialize IVAS-codec decoder state
*-----------------------------------------------------------------*/
@@ -299,7 +325,7 @@ static ivas_error isar_set_split_rend_setup(
ISAR_DEC_SPLIT_REND_WRAPPER *hSplitBinRend,
const ISAR_SPLIT_REND_CONFIG_DATA *hSplitBinConfig,
const COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,
- ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */
+ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */
)
{
splitRendBits->bits_read = 0;
@@ -311,10 +337,12 @@ static ivas_error isar_set_split_rend_setup(
splitRendBits->isar_frame_size_ms = 0;
splitRendBits->lc3plus_highres = 0;
+#ifndef TMP_FIX_SPLIT_REND
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 );
@@ -347,8 +375,6 @@ static void init_decoder_config(
hDecoderConfig->Opt_non_diegetic_pan = 0;
hDecoderConfig->non_diegetic_pan_gain_fx = 0; // Q15
hDecoderConfig->Opt_tsm = 0;
- hDecoderConfig->Opt_Limiter = 1;
- move16();
hDecoderConfig->Opt_delay_comp = 0;
hDecoderConfig->Opt_ExternalOrientation = 0;
hDecoderConfig->Opt_dpid_on = 0;
@@ -368,6 +394,7 @@ static void init_decoder_config(
move16();
move16();
move16();
+
return;
}
@@ -410,6 +437,12 @@ void IVAS_DEC_Close(
{
free( ( *phIvasDec )->apaExecBuffer_fx );
}
+#ifdef OBJ_EDITING_API
+ IF( ( *phIvasDec )->flushbuffer != NULL )
+ {
+ free( ( *phIvasDec )->flushbuffer );
+ }
+#endif
free( *phIvasDec );
*phIvasDec = NULL;
phIvasDec = NULL;
@@ -461,30 +494,28 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_Configure(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const UWord32 sampleRate, /* i : output sampling frequency */
- const AUDIO_CONFIG outputConfig, /* i : output configuration */
- const Word16 tsmEnabled, /* i : enable time scale modification */
- const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */
- const Word16 customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
- const Word16 hrtfReaderEnabled, /* i : enable HRTF binary file input */
- const Word16 enableHeadRotation, /* i : enable head rotation for binaural output */
- const Word16 enableExternalOrientation, /* i : enable external orientations */
- const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */
- const Word16 renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
- const Word16 Opt_non_diegetic_pan, /* i : diegetic or not */
- const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain Q15 */
- const Word16 Opt_dpid_on, /* i : enable directivity pattern option */
- const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */
- const Word16 delayCompensationEnabled /* i : enable delay compensation */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const UWord32 sampleRate, /* i : output sampling frequency */
+ const IVAS_AUDIO_CONFIG outputConfig, /* i : output configuration */
+ const bool tsmEnabled, /* i : enable time scale modification */
+ const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */
+ const bool customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */
+ const bool hrtfReaderEnabled, /* i : enable HRTF binary file input */
+ const bool enableHeadRotation, /* i : enable head rotation for binaural output */
+ const bool enableExternalOrientation, /* i : enable external orientations */
+ const IVAS_HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */
+ const bool renderConfigEnabled, /* i : enable Renderer config. file for binaural output */
+ const bool non_diegetic_pan_enabled, /* i : enabled diegetic panning */
+ const Word16 non_diegetic_pan_gain_fx, /* i : non diegetic panning gain */
+ const bool dpidEnabled, /* i : enable directivity pattern option */
+ const UWord16 acousticEnvironmentId, /* i : Acoustic environment ID */
+ const bool delayCompensationEnabled /* i : enable delay compensation */
)
{
Decoder_Struct *st_ivas;
DECODER_CONFIG_HANDLE hDecoderConfig;
ivas_error error;
- error = IVAS_ERR_OK;
- move32();
test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
@@ -503,18 +534,17 @@ ivas_error IVAS_DEC_Configure(
test();
test();
test();
- IF( EQ_16( hIvasDec->mode, IVAS_DEC_MODE_EVS ) && !( ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_MONO ) && Opt_non_diegetic_pan == 0 ) ||
- ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_STEREO ) && EQ_16( Opt_non_diegetic_pan, 1 ) ) ) )
+ IF( EQ_16( hIvasDec->mode, IVAS_DEC_MODE_EVS ) && !( ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_MONO ) && non_diegetic_pan_enabled == false ) ||
+ ( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_STEREO ) && non_diegetic_pan_enabled ) ) )
{
return IVAS_ERR_WRONG_MODE;
}
st_ivas = hIvasDec->st_ivas;
-
hDecoderConfig = st_ivas->hDecoderConfig;
-
hDecoderConfig->output_config = outputConfig;
move16();
+
IF( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_INVALID ) )
{
return IVAS_ERR_WRONG_PARAMS;
@@ -537,17 +567,17 @@ ivas_error IVAS_DEC_Configure(
move16();
}
- hDecoderConfig->Opt_tsm = tsmEnabled;
- hDecoderConfig->Opt_LsCustom = customLsOutputEnabled;
- hDecoderConfig->Opt_Headrotation = enableHeadRotation;
+ hDecoderConfig->Opt_tsm = (Word16) tsmEnabled;
+ hDecoderConfig->Opt_LsCustom = (Word16) customLsOutputEnabled;
+ hDecoderConfig->Opt_Headrotation = (Word16) enableHeadRotation;
hDecoderConfig->orientation_tracking = orientation_tracking;
- hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled;
- hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled;
- hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan;
+ hDecoderConfig->Opt_HRTF_binary = (Word16) hrtfReaderEnabled;
+ hDecoderConfig->Opt_RendConfigCustom = (Word16) renderConfigEnabled;
+ hDecoderConfig->Opt_non_diegetic_pan = (Word16) non_diegetic_pan_enabled;
hDecoderConfig->non_diegetic_pan_gain_fx = non_diegetic_pan_gain_fx; // Q15
- hDecoderConfig->Opt_delay_comp = delayCompensationEnabled;
+ hDecoderConfig->Opt_delay_comp = (Word16) delayCompensationEnabled;
hDecoderConfig->Opt_ExternalOrientation = enableExternalOrientation;
- hDecoderConfig->Opt_dpid_on = Opt_dpid_on;
+ hDecoderConfig->Opt_dpid_on = (Word16) dpidEnabled;
IF( NE_32( (Word32) acousticEnvironmentId, 65535 ) )
{
hDecoderConfig->Opt_aeid_on = TRUE;
@@ -572,6 +602,7 @@ ivas_error IVAS_DEC_Configure(
{
return IVAS_ERR_WRONG_PARAMS;
}
+
IF( EQ_16( outputConfig, IVAS_AUDIO_CONFIG_EXTERNAL ) )
{
hDecoderConfig->render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
@@ -580,15 +611,8 @@ ivas_error IVAS_DEC_Configure(
{
hDecoderConfig->render_framesize = renderFramesize;
}
-
move16();
- IF( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
- {
- hDecoderConfig->Opt_Headrotation = TRUE;
- move16();
- }
-
/* Set decoder parameters to initial values */
IF( NE_32( ( error = ivas_init_decoder_front( st_ivas ) ), IVAS_ERR_OK ) )
{
@@ -622,9 +646,24 @@ ivas_error IVAS_DEC_Configure(
move16();
move16();
- return error;
+#ifdef OBJ_EDITING_API
+ /* init flush buffer if necessary (only needed for binaural)*/
+ test();
+ test();
+ test();
+ test();
+ test();
+ IF( tsmEnabled && ( EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( outputConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
+ {
+ hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word16 ) );
+ set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
+ }
+#endif
+
+ return IVAS_ERR_OK;
}
+
/*---------------------------------------------------------------------*
* IVAS_DEC_EnableSplitRendering( )
*
@@ -632,16 +671,12 @@ ivas_error IVAS_DEC_Configure(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_EnableSplitRendering(
- IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */
+ IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */
)
{
DECODER_CONFIG_HANDLE hDecoderConfig;
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
+ test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -655,19 +690,17 @@ ivas_error IVAS_DEC_EnableSplitRendering(
hDecoderConfig->render_framesize = IVAS_RENDER_FRAMESIZE_20MS;
move32();
- hDecoderConfig->Opt_Limiter = 0;
- move16();
-
- return error;
+ return IVAS_ERR_OK;
}
+
/*---------------------------------------------------------------------*
* get_render_framesize_ms( )
*
* Get the 5ms flag
*---------------------------------------------------------------------*/
-Word16 get_render_frame_size_ms(
+static Word16 get_render_frame_size_ms(
const IVAS_RENDER_FRAMESIZE render_framesize )
{
IF( EQ_16( render_framesize, IVAS_RENDER_FRAMESIZE_5MS ) )
@@ -682,6 +715,7 @@ Word16 get_render_frame_size_ms(
{
return ( ( 1000 / ( FRAMES_PER_SEC * IVAS_MAX_PARAM_SPATIAL_SUBFRAMES ) ) << 2 );
}
+
return 0;
}
@@ -713,7 +747,6 @@ ivas_error IVAS_DEC_SetRenderFramesize(
hIvasDec->st_ivas->hCombinedOrientationData->num_subframes = (Word16) render_framesize;
}
-
hIvasDec->st_ivas->hDecoderConfig->render_framesize = render_framesize;
move16();
@@ -744,6 +777,7 @@ ivas_error IVAS_DEC_GetRenderFramesize(
return IVAS_ERR_OK;
}
+
/*---------------------------------------------------------------------*
* IVAS_DEC_GetGetRenderFramesizeSamples( )
*
@@ -751,11 +785,12 @@ ivas_error IVAS_DEC_GetRenderFramesize(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_GetRenderFramesizeSamples(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *render_framesize /* o : render framesize in samples Q0 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *render_framesize /* o : render framesize in samples Q0 */
)
{
Word16 tmp;
+
test();
test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || render_framesize == NULL )
@@ -793,8 +828,8 @@ ivas_error IVAS_DEC_GetRenderFramesizeSamples(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_GetRenderFramesizeMs(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- UWord32 *render_framesize /* o : render framesize in samples Q0 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ UWord32 *render_framesize /* o : render framesize in samples Q0 */
)
{
test();
@@ -817,8 +852,8 @@ ivas_error IVAS_DEC_GetRenderFramesizeMs(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_GetReferencesUpdateFrequency(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- Word16 *update_frequency /* o : update frequency Q0 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *update_frequency /* o : update frequency Q0 */
)
{
test();
@@ -889,9 +924,6 @@ ivas_error IVAS_DEC_EnableVoIP(
DECODER_CONFIG_HANDLE hDecoderConfig;
ivas_error error;
- error = IVAS_ERR_OK;
- move32();
-
test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
@@ -925,10 +957,8 @@ ivas_error IVAS_DEC_EnableVoIP(
hIvasDec->hVoIP->hCurrentDataUnit = NULL;
hIvasDec->hVoIP->nSamplesFrame = (UWord16) Mpy_32_16_1( hDecoderConfig->output_Fs, INV_FRAME_PER_SEC_Q15 );
move16();
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
hIvasDec->hVoIP->nSamplesRendered20ms = 0;
move16();
-#endif
#define WMC_TOOL_SKIP
/* Bitstream conversion is not counted towards complexity and memory usage */
@@ -951,7 +981,22 @@ ivas_error IVAS_DEC_EnableVoIP(
return IVAS_ERR_FAILED_ALLOC;
}
- return error;
+#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
+ if ( EQ_16( hIvasDec->mode, IVAS_DEC_MODE_EVS ) )
+ {
+ JB4_TMP_SetEvsCompatFlag( hIvasDec->hVoIP->hJBM );
+ }
+#endif
+
+#ifdef OBJ_EDITING_API
+ IF( hIvasDec->flushbuffer == NULL && ( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) || EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
+ {
+ hIvasDec->flushbuffer = (void *) malloc( CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( Word16 ) );
+ set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, CPE_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
+ }
+#endif
+
+ return IVAS_ERR_OK;
}
@@ -1094,17 +1139,26 @@ ivas_error IVAS_DEC_GetSamples(
)
{
ivas_error error;
+#ifdef OBJ_EDITING_API
+ Word16 nSamplesToRender;
+ UWord16 nSamplesRendered, nSamplesRendered_loop;
+ UWord16 nOutChannels;
+#else
Word16 nOutSamplesElse, nSamplesToRender;
UWord16 nSamplesRendered, nSamplesRendered_loop, l_ts, nTimeScalerOutSamples;
UWord8 nTransportChannels, nOutChannels;
+#endif
nSamplesRendered = 0;
nOutChannels = 0;
nSamplesRendered_loop = 0;
+#ifndef OBJ_EDITING_API
l_ts = 0;
nTransportChannels = 0;
move16();
move16();
+#endif
+
move16();
move16();
move16();
@@ -1114,6 +1168,13 @@ ivas_error IVAS_DEC_GetSamples(
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
+#ifdef OBJ_EDITING_API
+ /* the rendering needs to be prepared at this point */
+ if ( hIvasDec->hasBeenPreparedRendering == false )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+#endif
IF( hIvasDec->updateOrientation )
{
@@ -1178,136 +1239,157 @@ ivas_error IVAS_DEC_GetSamples(
}
ELSE
{
+#ifndef OBJ_EDITING_API
/* check if we need to run the setup function */
test();
- IF( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame ){
- /* setup */
-
- IF( NE_32( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ), IVAS_ERR_OK ) ){
- return error;
- }
-}
-{
- /* check if we need to run the setup function, tc decoding and feeding the renderer */
- test();
- IF( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame )
- {
- Word16 nResidualSamples, nSamplesTcsScaled;
- nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop );
-
- test();
- IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && NE_16( (Word16) nTransportChannels, hIvasDec->nTransportChannelsOld ) )
+ IF( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame )
{
- IF( NE_32( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ), IVAS_ERR_OK ) )
+ /* setup */
+#ifdef FIX_HRTF_LOAD
+ IF( NE_32( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels ) ), IVAS_ERR_OK ) )
+#else
+ IF( NE_32( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &nSamplesRendered_loop, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
}
-
- /* IVAS decoder */
- IF( NE_32( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer_fx, &nOutSamplesElse ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
-
- /* JBM */
- IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
+#endif
{
- IF( apa_set_scale_fx( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 )
+#ifndef OBJ_EDITING_API
+ /* check if we need to run the setup function, tc decoding and feeding the renderer */
+ test();
+ IF( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame )
{
- return IVAS_ERR_UNKNOWN;
- }
+ Word16 nResidualSamples, nSamplesTcsScaled;
+ nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop );
- // tmp apaExecBuffer
- IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) )
- {
- Word16 tmp_apaExecBuffer[APA_BUF];
- FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i )
+ test();
+ IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && NE_16( (Word16) nTransportChannels, hIvasDec->nTransportChannelsOld ) )
{
- tmp_apaExecBuffer[i] = extract_l( L_shr( hIvasDec->apaExecBuffer_fx[i], Q11 ) ); // Q0
+ IF( NE_32( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
}
- IF( apa_exec_fx( hIvasDec->hTimeScaler, tmp_apaExecBuffer, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, tmp_apaExecBuffer, &nTimeScalerOutSamples ) != 0 )
+
+ /* IVAS decoder */
+ IF( NE_32( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer_fx, &nOutSamplesElse ) ), IVAS_ERR_OK ) )
{
- return IVAS_ERR_UNKNOWN;
+ return error;
}
- FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i )
+
+ /* JBM */
+ IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
{
- hIvasDec->apaExecBuffer_fx[i] = L_shl( tmp_apaExecBuffer[i], Q11 ); // Q11
+ IF( apa_set_scale_fx( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+
+ // tmp apaExecBuffer
+ IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) )
+ {
+ Word16 tmp_apaExecBuffer[APA_BUF];
+ FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i )
+ {
+ tmp_apaExecBuffer[i] = extract_l( L_shr( hIvasDec->apaExecBuffer_fx[i], Q11 ) ); // Q0
+ }
+ IF( apa_exec_fx( hIvasDec->hTimeScaler, tmp_apaExecBuffer, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, tmp_apaExecBuffer, &nTimeScalerOutSamples ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+ FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i )
+ {
+ hIvasDec->apaExecBuffer_fx[i] = L_shl( tmp_apaExecBuffer[i], Q11 ); // Q11
+ }
+ }
+ ELSE
+ {
+ IF( apa_exec_ivas_fx( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer_fx, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer_fx, &nTimeScalerOutSamples ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+ }
+ assert( LE_32( (Word32) nTimeScalerOutSamples, APA_BUF ) );
+ nSamplesTcsScaled = idiv1616U( extract_l( nTimeScalerOutSamples ), nTransportChannels );
+ hIvasDec->timeScalingDone = 1;
+ move16();
}
- }
- ELSE
- {
- IF( apa_exec_ivas_fx( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer_fx, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer_fx, &nTimeScalerOutSamples ) != 0 )
+ ELSE
{
- return IVAS_ERR_UNKNOWN;
+ nSamplesTcsScaled = hIvasDec->nSamplesFrame;
+ move16();
}
- }
- assert( LE_32( (Word32) nTimeScalerOutSamples, APA_BUF ) );
- nSamplesTcsScaled = idiv1616U( extract_l( nTimeScalerOutSamples ), nTransportChannels );
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
- hIvasDec->timeScalingDone = 1;
- move16();
-#endif
- }
- ELSE
- {
- nSamplesTcsScaled = hIvasDec->nSamplesFrame;
- move16();
- }
#ifdef DEBUG_MODE_JBM
- dbgwrite( &nTimeScalerOutSamples, sizeof( uint16_t ), 1, 1, "./res/JBM_nTimeScaleOutSamples.dat" );
+ dbgwrite( &nTimeScalerOutSamples, sizeof( uint16_t ), 1, 1, "./res/JBM_nTimeScaleOutSamples.dat" );
#endif
- /* Feed decoded transport channels samples to the renderer */
- IF( NE_32( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer_fx ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
+ /* Feed decoded transport channels samples to the renderer */
+ IF( NE_32( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer_fx ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
#ifdef DEBUG_MODE_JBM
- dbgwrite( &nResidualSamples, sizeof( int16_t ), 1, 1, "./res/JBM_nResidualSamples.dat" );
+ dbgwrite( &nResidualSamples, sizeof( int16_t ), 1, 1, "./res/JBM_nResidualSamples.dat" );
#endif
- IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
- {
- /* feed residual samples to TSM for the next call */
- IF( apa_set_renderer_residual_samples( hIvasDec->hTimeScaler, (UWord16) nResidualSamples ) != 0 )
+ IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
+ {
+ /* feed residual samples to TSM for the next call */
+ IF( apa_set_renderer_residual_samples( hIvasDec->hTimeScaler, (UWord16) nResidualSamples ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+ }
+ hIvasDec->hasBeenFedFrame = false;
+ move16();
+ }
+#else
+ nOutChannels = (UWord8) hIvasDec->st_ivas->hDecoderConfig->nchan_out;
+ hIvasDec->hasBeenFedFrame = false;
+ /* check for possible flushed samples from a rate switch */
+ IF( GE_16( hIvasDec->nSamplesFlushed, 0 ) )
{
- return IVAS_ERR_UNKNOWN;
+ /* note: offset (rendered samples) is always 0 */
+ Copy( hIvasDec->flushbuffer, pcmBuf, imult1616( hIvasDec->nSamplesFlushed, nOutChannels ) );
+
+ nSamplesRendered = add( nSamplesRendered, hIvasDec->nSamplesFlushed );
+ hIvasDec->nSamplesFlushed = 0;
+ move16();
+ move16();
}
- }
- hIvasDec->hasBeenFedFrame = false;
- move16();
- }
+#endif
- /* render IVAS frames directly to the output buffer */
- nSamplesToRender = sub( nSamplesAsked, nSamplesRendered );
- IF( NE_32( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
+ /* render IVAS frames directly to the output buffer */
+ nSamplesToRender = sub( nSamplesAsked, nSamplesRendered );
+ IF( NE_32( ( error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesRendered_loop, &hIvasDec->nSamplesAvailableNext, pcmBuf + imult3216( nSamplesRendered, nOutChannels ) ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
- nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop );
- nSamplesToRender = sub( nSamplesToRender, nSamplesRendered_loop );
- IF( hIvasDec->nSamplesAvailableNext == 0 )
- {
- *needNewFrame = true;
- hIvasDec->needNewFrame = true;
- move16();
- move16();
- }
- ELSE
- {
- *needNewFrame = false;
- move16();
+ nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop );
+ nSamplesToRender = sub( nSamplesToRender, nSamplesRendered_loop );
+ IF( hIvasDec->nSamplesAvailableNext == 0 )
+ {
+ *needNewFrame = true;
+ hIvasDec->needNewFrame = true;
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ *needNewFrame = false;
+ move16();
+ }
+ }
}
-}
-}
-*nOutSamples = nSamplesRendered;
-move16();
+ *nOutSamples = nSamplesRendered;
+ move16();
-return IVAS_ERR_OK;
+ return IVAS_ERR_OK;
}
@@ -1317,8 +1399,7 @@ return IVAS_ERR_OK;
*
*---------------------------------------------------------------------*/
-ivas_error
-IVAS_DEC_GetSplitBinauralBitstream(
+ivas_error IVAS_DEC_GetSplitBinauralBitstream(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
Word16 *pcmBuf_out, /* o : output synthesis signal for BINAURAL_SPLIT_PCM */
ISAR_SPLIT_REND_BITS_DATA *splitRendBits, /* o : output split rendering bits */
@@ -1332,21 +1413,8 @@ IVAS_DEC_GetSplitBinauralBitstream(
Word32 *pOutput[BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES];
Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
- FOR( Word32 i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ )
- {
- FOR( Word32 j = 0; j < CLDFB_NO_COL_MAX; j++ )
- {
- FOR( Word32 k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ )
- {
- Cldfb_RealBuffer_Binaural[i][j][k] = 0;
- Cldfb_ImagBuffer_Binaural[i][j][k] = 0;
- move32();
- move32();
- }
- }
- }
Word16 numSamplesPerChannelToDecode;
- Word16 i, j;
+ Word16 i, j, k;
ivas_error error;
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;
Word16 max_band;
@@ -1357,7 +1425,12 @@ IVAS_DEC_GetSplitBinauralBitstream(
Word16 ro_md_flag;
IVAS_QUATERNION Quaternion;
- error = IVAS_ERR_OK;
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
st_ivas = hIvasDec->st_ivas;
output_config = st_ivas->hDecoderConfig->output_config;
output_Fs = st_ivas->hDecoderConfig->output_Fs;
@@ -1366,10 +1439,27 @@ IVAS_DEC_GetSplitBinauralBitstream(
*needNewFrame = false;
hSplitBinRend = st_ivas->hSplitBinRend;
- if ( ( error = isar_set_split_rend_setup( hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK )
+#ifndef OBJ_EDITING_API
+ IF( ( error = isar_set_split_rend_setup( hSplitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK )
{
return error;
}
+#endif
+
+ FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ )
+ {
+ FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ )
+ {
+ FOR( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ )
+ {
+ Cldfb_RealBuffer_Binaural[i][j][k] = 0;
+ Cldfb_ImagBuffer_Binaural[i][j][k] = 0;
+ move32();
+ move32();
+ }
+ }
+ }
+
FOR( i = 0; i < MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS; i++ )
{
FOR( j = 0; j < CLDFB_NO_COL_MAX; j++ )
@@ -1382,6 +1472,15 @@ IVAS_DEC_GetSplitBinauralBitstream(
numPoses = hSplitBinRend->splitrend.multiBinPoseData.num_poses;
move16();
+#ifdef OBJ_EDITING_API
+ /* init flush buffer for rate switch if not already initizalized */
+ IF( hIvasDec->flushbuffer == NULL )
+ {
+ hIvasDec->flushbuffer = (void *) malloc( numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( float ) );
+ set16_fx( (Word16 *) hIvasDec->flushbuffer, 0, numPoses * BINAURAL_CHANNELS * hIvasDec->nSamplesFrame / IVAS_MAX_PARAM_SPATIAL_SUBFRAMES );
+ }
+#endif
+
IF( NE_32( st_ivas->hDecoderConfig->render_framesize, IVAS_RENDER_FRAMESIZE_20MS ) &&
( EQ_32( hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ||
EQ_16( hIvasDec->st_ivas->hRenderConfig->split_rend_config.dof, 0 ) ) )
@@ -1393,11 +1492,12 @@ IVAS_DEC_GetSplitBinauralBitstream(
move16();
}
- IF( EQ_16( IVAS_DEC_is_split_rendering_enabled( hIvasDec ), 0 ) )
+ IF( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 )
{
return IVAS_ERR_WRONG_PARAMS;
}
+ test();
IF( st_ivas->hTcBuffer == NULL || hIvasDec->hasBeenFedFrame )
{
slots_rendered = 0;
@@ -1405,24 +1505,23 @@ IVAS_DEC_GetSplitBinauralBitstream(
ELSE
{
/* this is needed for OMASA-DISC, because the td-rend granularity is 240 samples at 48kHz, leading to wrong slot count. */
+ test();
IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); // TODO remove division
}
- else
+ ELSE
{
slots_rendered = st_ivas->hTcBuffer->n_samples_rendered / st_ivas->hTcBuffer->n_samples_granularity;
}
}
-
/* Decode and render */
- if ( ( error = IVAS_DEC_GetSamples( hIvasDec, numSamplesPerChannelToDecode, pcmBuf_out, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK )
+ IF( ( error = IVAS_DEC_GetSamples( hIvasDec, numSamplesPerChannelToDecode, pcmBuf_out, nOutSamples, needNewFrame ) ) != IVAS_ERR_OK )
{
return error;
}
-
FOR( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
{
pOutput[i] = hSplitBinRend->hMultiBinCldfbData->output_fx[i];
@@ -1527,22 +1626,20 @@ IVAS_DEC_GetSplitBinauralBitstream(
Q_out[1] = Q_out[0];
}
- if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( &hSplitBinRend->splitrend,
- Quaternion,
- st_ivas->hRenderConfig->split_rend_config.splitRendBitRate,
- st_ivas->hRenderConfig->split_rend_config.codec,
- st_ivas->hRenderConfig->split_rend_config.isar_frame_size_ms,
- st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms,
- splitRendBits,
- Cldfb_RealBuffer_Binaural,
- Cldfb_ImagBuffer_Binaural,
- max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK )
-
+ IF( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( &hSplitBinRend->splitrend,
+ Quaternion,
+ st_ivas->hRenderConfig->split_rend_config.splitRendBitRate,
+ st_ivas->hRenderConfig->split_rend_config.codec,
+ st_ivas->hRenderConfig->split_rend_config.isar_frame_size_ms,
+ st_ivas->hRenderConfig->split_rend_config.codec_frame_size_ms,
+ splitRendBits,
+ Cldfb_RealBuffer_Binaural,
+ Cldfb_ImagBuffer_Binaural,
+ max_band, pOutput, 1, !td_input, pcm_out_flag, ro_md_flag, Q_buff, &Q_out[0] ) ) != IVAS_ERR_OK )
{
return error;
}
-
/* convert to int16 with limiting for BINAURAL_SPLIT_PCM */
IF( pcm_out_flag )
{
@@ -1564,9 +1661,11 @@ IVAS_DEC_GetSplitBinauralBitstream(
ivas_syn_output_fx( pOutput, Q11, numSamplesPerChannelToDecode, st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf_out );
}
+#ifndef TMP_FIX_SPLIT_REND
free( st_ivas->hSplitBinRend->hMultiBinCldfbData );
+#endif
- return error;
+ return IVAS_ERR_OK;
}
@@ -1579,30 +1678,40 @@ IVAS_DEC_GetSplitBinauralBitstream(
static ivas_error IVAS_DEC_Setup(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
UWord16 *nTcBufferGranularity, /* o : granularity of the TC Buffer */
- UWord8 *nTransportChannels, /* o : number of decoded transport PCM channels */
- UWord8 *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */
- UWord16 *nSamplesRendered, /* o : number of samples flushed from the last frame */
- Word16 *data /* o : output synthesis signal Q0 */
+ UWord8 *nTransportChannels /* o : number of decoded transport PCM channels */
+#ifndef FIX_HRTF_LOAD
+ ,
+ UWord8 *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */
+ UWord16 *nSamplesRendered, /* o : number of samples flushed from the last frame */
+ Word16 *data /* o : output synthesis signal Q0 */
+#endif
)
{
ivas_error error;
+#ifndef FIX_HRTF_LOAD
*nSamplesRendered = 0;
move16();
-
+#endif
IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) )
{
IF( EQ_16( (Word16) hIvasDec->st_ivas->renderer_type, RENDERER_NON_DIEGETIC_DOWNMIX ) )
{
*nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN;
+#ifndef FIX_HRTF_LOAD
*nOutChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN;
+#endif
}
ELSE
{
*nTransportChannels = 1;
+#ifndef FIX_HRTF_LOAD
*nOutChannels = 1;
+#endif
}
+#ifndef FIX_HRTF_LOAD
move16();
+#endif
move16();
}
ELSE
@@ -1621,127 +1730,51 @@ static ivas_error IVAS_DEC_Setup(
IF( st_ivas->bfi == 0 )
{
- Word32 ivas_total_brate;
- ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
- Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
- Word16 num_src = 0;
- move16();
-
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- IF( is_DTXrate( ivas_total_brate ) == 0 && ( !( st_ivas->ini_active_frame == 0 && NE_32( ivas_total_brate, FRAME_NO_DATA ) && LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_16( st_ivas->nCPE, 1 ) ) ) && st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] && st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format != MASA_FORMAT && ( ( GT_32( ivas_total_brate, IVAS_SID_5k2 ) && NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) && st_ivas->ini_active_frame == 0 ) )
- {
- IF( st_ivas->hSpar )
- {
- Word16 Q_tmp = getScaleFactor16( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 16 );
- Scale_sig( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 16, sub( Q_tmp, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q ) );
- st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_tmp;
- }
- }
-
- test();
- test();
- test();
- test();
- test();
- IF( is_DTXrate( ivas_total_brate ) == 0 && EQ_16( (Word16) st_ivas->ivas_format, MASA_ISM_FORMAT ) && GT_16( st_ivas->ini_frame, 0 ) && ( GT_32( ivas_total_brate, IVAS_SID_5k2 ) && NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) && st_ivas->ini_active_frame == 0 )
- {
- IF( st_ivas->hSpar )
- {
- Word16 Q_tmp = getScaleFactor16( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 16 );
- Scale_sig( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, 16, sub( Q_tmp, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q ) );
- st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_tmp;
- move16();
- }
- }
-
- IF( NE_32( ( error = ivas_dec_setup( st_ivas, nSamplesRendered, data ) ), IVAS_ERR_OK ) )
+#ifdef FIX_HRTF_LOAD
+ IF( ( error = ivas_dec_setup( st_ivas ) ) != IVAS_ERR_OK )
+#else
+ IF( ( error = ivas_dec_setup( st_ivas, nSamplesRendered, data ) ) != IVAS_ERR_OK )
+#endif
{
return error;
}
- test();
- IF( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMMC ) )
- {
- MC_LS_SETUP mc_ls_setup;
- mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config );
- st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels_fx( ivas_total_brate, mc_ls_setup );
- }
-
- test();
- test();
- test();
- test();
- test();
- test();
- IF( is_DTXrate( ivas_total_brate ) == 0 && ( !( st_ivas->ini_active_frame == 0 && NE_32( ivas_total_brate, FRAME_NO_DATA ) && LT_32( ivas_total_brate, MASA_STEREO_MIN_BITRATE ) && EQ_16( st_ivas->nCPE, 1 ) ) ) && st_ivas->bit_stream[( ivas_total_brate / FRAMES_PER_SEC ) - 1] && st_ivas->ivas_format == MASA_FORMAT && ( ( GT_32( ivas_total_brate, IVAS_SID_5k2 ) && NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) || st_ivas->ini_active_frame == 0 ) )
- {
- IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
- {
- Word16 nchan_rend = num_src;
- IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
- {
- nchan_rend--; /* Skip LFE channel -- added to the others */
- }
- FOR( Word16 nS = 0; nS < nchan_rend; nS++ )
- {
- TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]];
- IF( Src_p->SrcSpatial_p != NULL )
- {
- Src_p->SrcSpatial_p->q_Pos_p = Q31;
- move16();
- }
- TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p;
- SrcSpatial_p->q_Pos_p = Q31;
- move16();
- }
- }
- }
-
-
- test();
- test();
- test();
- test();
- test();
- IF( is_DTXrate( ivas_total_brate ) == 0 && EQ_16( (Word16) st_ivas->ivas_format, MASA_ISM_FORMAT ) && st_ivas->ini_frame > 0 && ( GT_32( ivas_total_brate, IVAS_SID_5k2 ) && NE_32( ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate ) ) && st_ivas->ini_active_frame == 0 )
- {
- IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
- {
- Word16 nchan_rend = num_src;
- test();
- IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
- {
- nchan_rend--; /* Skip LFE channel -- added to the others */
- }
- FOR( Word16 nS = 0; nS < nchan_rend; nS++ )
- {
- TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]];
- IF( Src_p->SrcSpatial_p != NULL )
- {
- Src_p->SrcSpatial_p->q_Pos_p = Q31;
- move16();
- }
- TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p;
- SrcSpatial_p->q_Pos_p = Q31;
- move16();
- }
- }
- }
+#ifdef DEBUGGING
+ int16_t a = 0; // this is just to help the clang-formatting keep alignments correct
+#endif
}
*nTransportChannels = (UWord8) st_ivas->hTcBuffer->nchan_transport_jbm;
*nTcBufferGranularity = (UWord16) st_ivas->hTcBuffer->n_samples_granularity;
+#ifndef FIX_HRTF_LOAD
*nOutChannels = (UWord8) st_ivas->hDecoderConfig->nchan_out;
move16();
+#endif
move16();
move16();
+
+ /*-----------------------------------------------------------------*
+ * ISAR:
+ * - initialize ISAR handle at the first frame
+ * - reconfigure the ISAR handle in case of bitrate switching (renderer might change)
+ *-----------------------------------------------------------------*/
+
+ test();
+ IF( st_ivas->ini_frame == 0 && ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) ) )
+ {
+ IF( ( error = ivas_dec_init_split_rend( st_ivas ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
+ test();
+ IF( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+ {
+ IF( ( error = ivas_dec_reconfig_split_rend( st_ivas ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
}
return IVAS_ERR_OK;
@@ -1763,7 +1796,6 @@ static ivas_error IVAS_DEC_GetTcSamples(
Decoder_Struct *st_ivas;
ivas_error error;
-
test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
@@ -1922,7 +1954,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples(
const UWord16 nSamplesForRendering, /* i : number of TC samples wanted from the renderer */
UWord16 *nSamplesRendered, /* o : number of samples rendered */
UWord16 *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */
- Word16 *pcmBuf // Q0
+ Word16 *pcmBuf /* o : output synthesis signal Q0 */
)
{
Decoder_Struct *st_ivas;
@@ -1936,8 +1968,33 @@ static ivas_error IVAS_DEC_GetRenderedSamples(
st_ivas = hIvasDec->st_ivas;
+#ifdef FIX_HRTF_LOAD
+ // temp code to make HRTF changes working in the old API structure
+ UWord16 nSamplesRendered_loop = 0;
+ Word16 nOutChannels = st_ivas->hDecoderConfig->nchan_out;
+ move16();
+ hIvasDec->hasBeenFedFrame = false;
+
+ /* check for possible flushed samples from a rate switch */
+ IF( hIvasDec->nSamplesFlushed > 0 )
+ {
+ /* note: offset (rendered samples) is always 0 */
+ Copy( hIvasDec->flushbuffer, pcmBuf, hIvasDec->nSamplesFlushed * nOutChannels );
+
+ *nSamplesRendered = hIvasDec->nSamplesFlushed;
+ hIvasDec->nSamplesFlushed = 0;
+ move16();
+ move16();
+ }
+
+ /* run the main IVAS decoding routine */
+ error = ivas_jbm_dec_render_fx( st_ivas, nSamplesForRendering - *nSamplesRendered, &nSamplesRendered_loop, nSamplesAvailableNext, pcmBuf + ( *nSamplesRendered * nOutChannels ) );
+
+ *nSamplesRendered = add( *nSamplesRendered, nSamplesRendered_loop );
+#else
/* run the main IVAS decoding routine */
error = ivas_jbm_dec_render_fx( st_ivas, nSamplesForRendering, nSamplesRendered, nSamplesAvailableNext, pcmBuf );
+#endif
return error;
}
@@ -1956,6 +2013,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples(
{
*nSamplesBuffered = 0;
move16();
+
test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
@@ -1966,9 +2024,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples(
if ( hIvasDec->st_ivas->hTcBuffer != NULL )
{
*nSamplesBuffered = sub( hIvasDec->st_ivas->hTcBuffer->n_samples_buffered, hIvasDec->st_ivas->hTcBuffer->n_samples_rendered );
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
*nSamplesBuffered = add( *nSamplesBuffered, hIvasDec->hVoIP->nSamplesRendered20ms );
-#endif
move16();
}
@@ -1987,17 +2043,17 @@ ivas_error IVAS_DEC_GetNumObjects(
UWord16 *numObjects /* o : number of objects for which the decoder has been configured */
)
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
Word16 is_masa_ism;
+
is_masa_ism = 0;
move16();
-#endif
+
test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
IF( hIvasDec->st_ivas->hMasa != NULL )
{
IF( EQ_32( hIvasDec->st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) )
@@ -2006,6 +2062,7 @@ ivas_error IVAS_DEC_GetNumObjects(
move16();
}
}
+
test();
test();
test();
@@ -2013,11 +2070,6 @@ ivas_error IVAS_DEC_GetNumObjects(
EQ_32( hIvasDec->st_ivas->ivas_format, SBA_ISM_FORMAT ) ||
EQ_32( hIvasDec->st_ivas->ivas_format, MASA_ISM_FORMAT ) ||
EQ_16( is_masa_ism, 1 ) )
-#else
- test();
- test();
- IF( EQ_16( (Word16) hIvasDec->st_ivas->ivas_format, ISM_FORMAT ) || EQ_16( (Word16) hIvasDec->st_ivas->ivas_format, SBA_ISM_FORMAT ) || EQ_16( (Word16) hIvasDec->st_ivas->ivas_format, MASA_ISM_FORMAT ) )
-#endif
{
*numObjects = hIvasDec->st_ivas->nchan_ism;
}
@@ -2043,6 +2095,12 @@ ivas_error IVAS_DEC_GetFormat(
IVAS_DEC_BS_FORMAT *format /* o : format detected from bitstream fed to the decoder */
)
{
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
IF( hIvasDec->hasDecodedFirstGoodFrame )
{
*format = mapIvasFormat( hIvasDec->st_ivas->ivas_format );
@@ -2052,14 +2110,14 @@ ivas_error IVAS_DEC_GetFormat(
*format = IVAS_DEC_BS_UNKOWN;
}
move32();
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
test();
if ( EQ_32( *format, IVAS_DEC_BS_MASA ) && EQ_32( hIvasDec->st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) )
{
*format = IVAS_DEC_BS_MASA_ISM;
move32();
}
-#endif
+
return IVAS_ERR_OK;
}
@@ -2142,6 +2200,12 @@ ivas_error IVAS_DEC_GetNumOutputChannels(
Word16 *numOutputChannels /* o : number of PCM output channels */
)
{
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
IF( hIvasDec->hasDecodedFirstGoodFrame )
{
*numOutputChannels = hIvasDec->st_ivas->hDecoderConfig->nchan_out;
@@ -2170,11 +2234,11 @@ ivas_error IVAS_DEC_GetObjectMetadata(
{
Decoder_Struct *st_ivas;
ISM_METADATA_HANDLE hIsmMeta;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
Word16 is_masa_ism;
+
is_masa_ism = 0;
move16();
-#endif
+
test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
@@ -2182,7 +2246,7 @@ ivas_error IVAS_DEC_GetObjectMetadata(
}
st_ivas = hIvasDec->st_ivas;
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
IF( hIvasDec->st_ivas->hMasa != NULL )
{
IF( EQ_32( hIvasDec->st_ivas->hMasa->config.input_ivas_format, MASA_ISM_FORMAT ) )
@@ -2191,6 +2255,7 @@ ivas_error IVAS_DEC_GetObjectMetadata(
move16();
}
}
+
test();
test();
test();
@@ -2198,11 +2263,6 @@ ivas_error IVAS_DEC_GetObjectMetadata(
NE_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) &&
NE_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) &&
EQ_16( is_masa_ism, 0 ) )
-#else
- test();
- test();
- IF( NE_16( st_ivas->ivas_format, ISM_FORMAT ) && NE_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
-#endif
{
return IVAS_ERR_WRONG_MODE;
}
@@ -2213,16 +2273,13 @@ ivas_error IVAS_DEC_GetObjectMetadata(
}
hIsmMeta = st_ivas->hIsmMetaData[objectIdx];
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
+
test();
test();
test();
IF( hIsmMeta == NULL ||
EQ_16( zero_flag, 1 ) ||
( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) )
-#else
- IF( hIsmMeta == NULL || zero_flag )
-#endif
{
metadata->azimuth_fx = 0; // Q22
metadata->elevation_fx = 0; // Q22
@@ -2235,14 +2292,54 @@ ivas_error IVAS_DEC_GetObjectMetadata(
}
ELSE
{
- metadata->azimuth_fx = hIsmMeta->azimuth_fx; // Q22
- metadata->elevation_fx = hIsmMeta->elevation_fx; // Q22
- metadata->radius_fx = hIsmMeta->radius_fx; // Q9
- metadata->yaw_fx = hIsmMeta->yaw_fx; // Q22
- metadata->pitch_fx = hIsmMeta->pitch_fx; // Q22
- metadata->spread_fx = 0; // Q22
- metadata->gainFactor_fx = ONE_IN_Q31;
- metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag;
+#ifdef OBJ_EDITING_API
+ IF( EQ_32( st_ivas->ism_mode, ISM_MODE_DISC ) )
+ {
+ metadata->azimuth_fx = hIsmMeta->edited_azimuth_fx;
+ metadata->elevation_fx = hIsmMeta->edited_elevation_fx;
+ metadata->radius_fx = hIsmMeta->edited_radius_fx;
+
+ metadata->yaw_fx = hIsmMeta->edited_yaw_fx;
+ metadata->pitch_fx = hIsmMeta->edited_pitch_fx;
+ metadata->spread_fx = 0;
+
+ metadata->gainFactor_fx = hIsmMeta->edited_gain_fx;
+ metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag;
+ }
+ ELSE IF( EQ_32( st_ivas->ism_mode, ISM_MODE_PARAM ) )
+ {
+ metadata->azimuth_fx = st_ivas->hParamIsmDec->edited_azimuth_values_fx[objectIdx];
+ metadata->elevation_fx = st_ivas->hParamIsmDec->edited_elevation_values_fx[objectIdx];
+ metadata->radius_fx = hIsmMeta->radius_fx;
+ metadata->yaw_fx = hIsmMeta->yaw_fx;
+ metadata->pitch_fx = hIsmMeta->pitch_fx;
+ metadata->spread_fx = 0;
+ metadata->gainFactor_fx = ONE_IN_Q31;
+ metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag;
+ }
+ ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
+ {
+ metadata->azimuth_fx = st_ivas->hIsmMetaData[objectIdx]->edited_azimuth_fx;
+ metadata->elevation_fx = st_ivas->hIsmMetaData[objectIdx]->edited_elevation_fx;
+ metadata->radius_fx = st_ivas->hIsmMetaData[objectIdx]->edited_radius_fx;
+ metadata->yaw_fx = st_ivas->hIsmMetaData[objectIdx]->edited_yaw_fx;
+ metadata->pitch_fx = st_ivas->hIsmMetaData[objectIdx]->edited_pitch_fx;
+ metadata->spread_fx = 0;
+ metadata->gainFactor_fx = st_ivas->hIsmMetaData[objectIdx]->edited_gain_fx;
+ metadata->non_diegetic_flag = st_ivas->hIsmMetaData[objectIdx]->non_diegetic_flag;
+ }
+ ELSE
+#endif
+ {
+ metadata->azimuth_fx = hIsmMeta->azimuth_fx; // Q22
+ metadata->elevation_fx = hIsmMeta->elevation_fx; // Q22
+ metadata->radius_fx = hIsmMeta->radius_fx; // Q9
+ metadata->yaw_fx = hIsmMeta->yaw_fx; // Q22
+ metadata->pitch_fx = hIsmMeta->pitch_fx; // Q22
+ metadata->spread_fx = 0; // Q22
+ metadata->gainFactor_fx = ONE_IN_Q31;
+ metadata->non_diegetic_flag = hIsmMeta->non_diegetic_flag;
+ }
}
move32();
@@ -2480,8 +2577,10 @@ ivas_error IVAS_DEC_FeedExternalOrientationData(
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
+
orientation.q_fact = Q29;
move16();
+
/* Move external orientation data to the decoder handle (invert orientations) */
QuaternionInverse_fx( orientation, &hExternalOrientationData->Quaternions[subframe_idx] );
@@ -2561,6 +2660,15 @@ ivas_error IVAS_DEC_FeedCustomLsData(
return IVAS_ERR_OK;
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_GetHrtfTDrendHandle( )
+ *
+ *
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_GetHrtfTDrendHandle(
+#else
/*---------------------------------------------------------------------*
* IVAS_DEC_GetHrtfHandle( )
@@ -2569,8 +2677,9 @@ ivas_error IVAS_DEC_FeedCustomLsData(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_GetHrtfHandle(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */
+#endif
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_HRTF_TD_HANDLE **hHrtfTD /* o : TD rend. HRTF handle */
)
{
test();
@@ -2593,18 +2702,31 @@ ivas_error IVAS_DEC_GetHrtfHandle(
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_GetHrtfCRendHandle(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IVAS_DEC_HRTF_CREND_HANDLE **hHrtfCrend /* o : Crend HRTF handle */
+#else
IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */
+#endif
)
{
test();
test();
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hHrtfCrend == NULL )
+ {
+ return IVAS_ERR_WRONG_PARAMS;
+ }
+
+ *hHrtfCrend = &hIvasDec->st_ivas->hHrtfCrend;
+#else
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hSetOfHRTF == NULL )
{
return IVAS_ERR_WRONG_PARAMS;
}
*hSetOfHRTF = &hIvasDec->st_ivas->hSetOfHRTF;
+#endif
return IVAS_ERR_OK;
}
@@ -2657,6 +2779,7 @@ ivas_error IVAS_DEC_GetHrtfParamBinHandle(
return IVAS_ERR_OK;
}
+
/*---------------------------------------------------------------------*
* IVAS_DEC_GetHrtfStatisticsHandle( )
*
@@ -2678,64 +2801,192 @@ ivas_error IVAS_DEC_GetHrtfStatisticsHandle(
return IVAS_ERR_OK;
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
/*---------------------------------------------------------------------*
- * copyRendererConfigStruct( )
- *
+ * IVAS_DEC_HRTF_binary_open( )
*
+ * Allocate HRTF binary handles
*---------------------------------------------------------------------*/
-static ivas_error copyRendererConfigStruct(
- RENDER_CONFIG_HANDLE hRCin,
- IVAS_RENDER_CONFIG_HANDLE hRCout )
+ivas_error IVAS_DEC_HRTF_binary_open(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_BIN_RENDERER_TYPE binaural_renderer /* i : binaural renderer type */
+)
{
+ ivas_error error;
+ Decoder_Struct *st_ivas;
+
+ st_ivas = hIvasDec->st_ivas;
+
test();
- IF( hRCin == NULL || hRCout == NULL )
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
- hRCout->roomAcoustics.override = hRCin->roomAcoustics.override;
- hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands;
- hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx;
- hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx;
-
- Copy32( hRCin->roomAcoustics.pFc_input_fx, hRCout->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); // Q16
- Copy32( hRCin->roomAcoustics.pAcoustic_rt60_fx, hRCout->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); // Q26
- Copy32( hRCin->roomAcoustics.pAcoustic_dsr_fx, hRCout->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); // Q30
- Copy( hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS );
+ IF( st_ivas->hDecoderConfig->Opt_HRTF_binary )
+ {
+ /* TD binaural renderer */
+ test();
+ test();
+ IF( ( EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_TDREND ) || EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) && st_ivas->hHrtfTD == NULL )
+ {
+ IF( ( error = ivas_HRTF_binary_open_fx( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
- hRCout->split_rend_config.splitRendBitRate = SPLIT_REND_768k;
- hRCout->split_rend_config.dof = 3;
- hRCout->split_rend_config.hq_mode = 0;
- hRCout->split_rend_config.codec_delay_ms = 0;
- hRCout->split_rend_config.isar_frame_size_ms = 20;
- move16();
- hRCout->split_rend_config.codec_frame_size_ms = 0; /* 0 means "use default for selected codec" */
- hRCout->split_rend_config.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
- hRCout->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB;
- hRCout->split_rend_config.rendererSelection = hRCin->split_rend_config.rendererSelection;
- hRCout->split_rend_config.lc3plus_highres = hRCin->split_rend_config.lc3plus_highres;
- move16();
- move32();
- move16();
- move16();
- move16();
- move16();
- move32();
- move32();
- move32();
+ /* Crend binaural renderer */
+ test();
+ test();
+ IF( ( EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_CREND ) || EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) && st_ivas->hHrtfCrend == NULL )
+ {
+ IF( ( error = ivas_HRTF_CRend_binary_open_fx( &( st_ivas->hHrtfCrend ) ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
- hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er;
- hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity;
- move16();
- move16();
- move16();
- move32();
- move32();
- move32();
+ /* FastConv binaural renderer */
+ test();
+ test();
+ IF( ( EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_FASTCONV ) || EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) && st_ivas->hHrtfFastConv == NULL )
+ {
+ IF( ( error = ivas_HRTF_fastconv_binary_open_fx( &st_ivas->hHrtfFastConv ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
- return IVAS_ERR_OK;
-}
+ /* Parametric binaural renderer */
+ test();
+ test();
+ IF( ( EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_PARAMBIN ) || EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_DEFAULT ) ) && st_ivas->hHrtfParambin == NULL )
+ {
+ IF( ( error = ivas_HRTF_parambin_binary_open_fx( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
+ test();
+ test();
+ test();
+ IF( st_ivas->hHrtfStatistics == NULL && ( EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_FASTCONV ) || EQ_32( binaural_renderer, IVAS_BIN_RENDERER_TYPE_CREND ) ) && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
+ {
+ IF( ( error = ivas_HRTF_statistics_binary_open_fx( &st_ivas->hHrtfStatistics ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+ }
+
+ return IVAS_ERR_OK;
+}
+
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_HRTF_binary_close( )
+ *
+ * Deallocate HRTF binary handles
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_HRTF_binary_close(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const IVAS_BIN_RENDERER_TYPE binaural_renderer_old /* i : previous binaural renderer type */
+)
+{
+ Decoder_Struct *st_ivas;
+
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ st_ivas = hIvasDec->st_ivas;
+
+ test();
+ IF( st_ivas->hDecoderConfig->Opt_HRTF_binary && st_ivas->ini_frame > 0 )
+ {
+ test();
+ IF( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
+ {
+ ivas_HRTF_binary_close_fx( &st_ivas->hHrtfTD );
+ }
+
+ test();
+ IF( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_CREND || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
+ {
+ /* CRend binaural renderer handle */
+ ivas_HRTF_CRend_binary_close_fx( &st_ivas->hHrtfCrend );
+ }
+
+ test();
+ IF( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
+ {
+ /* Fastconv HRTF memories */
+ ivas_binaural_hrtf_close_fx( &st_ivas->hHrtfFastConv );
+
+ /* Fastconv HRTF filters */
+ ivas_HRTF_fastconv_binary_close_fx( &st_ivas->hHrtfFastConv );
+ }
+
+ test();
+ IF( !( binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_PARAMBIN || binaural_renderer_old == IVAS_BIN_RENDERER_TYPE_DEFAULT ) )
+ {
+
+ /* Parametric binauralizer HRTF filters */
+ ivas_HRTF_parambin_binary_close_fx( &st_ivas->hHrtfParambin );
+ }
+ }
+
+ return IVAS_ERR_OK;
+}
+#endif
+
+
+/*---------------------------------------------------------------------*
+ * copyRendererConfigStruct( )
+ *
+ *
+ *---------------------------------------------------------------------*/
+
+static ivas_error copyRendererConfigStruct(
+ RENDER_CONFIG_HANDLE hRCin,
+ IVAS_RENDER_CONFIG_HANDLE hRCout )
+{
+ test();
+ IF( hRCin == NULL || hRCout == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ hRCout->roomAcoustics.nBands = hRCin->roomAcoustics.nBands;
+ hRCout->roomAcoustics.acousticPreDelay_fx = hRCin->roomAcoustics.acousticPreDelay_fx;
+ hRCout->roomAcoustics.inputPreDelay_fx = hRCin->roomAcoustics.inputPreDelay_fx;
+
+ Copy32( hRCin->roomAcoustics.pFc_input_fx, hRCout->roomAcoustics.pFc_input_fx, CLDFB_NO_CHANNELS_MAX ); // Q16
+ Copy32( hRCin->roomAcoustics.pAcoustic_rt60_fx, hRCout->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); // Q26
+ Copy32( hRCin->roomAcoustics.pAcoustic_dsr_fx, hRCout->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); // Q30
+ Copy( hRCin->directivity_fx, hRCout->directivity_fx, 3 * MAX_NUM_OBJECTS );
+ Copy32( hRCin->distAtt_fx, hRCout->distAtt_fx, 3 );
+
+ hRCout->split_rend_config = hRCin->split_rend_config;
+
+ hRCout->roomAcoustics.use_er = hRCin->roomAcoustics.use_er;
+ hRCout->roomAcoustics.lowComplexity = hRCin->roomAcoustics.lowComplexity;
+ move16();
+ move16();
+ move16();
+ move32();
+ move32();
+ move32();
+
+ return IVAS_ERR_OK;
+}
/*---------------------------------------------------------------------*
@@ -2760,14 +3011,16 @@ ivas_error IVAS_DEC_GetRenderConfig(
return copyRendererConfigStruct( hIvasDec->st_ivas->hRenderConfig, hRCout );
}
+
/*! r: error code*/
ivas_error IVAS_DEC_GetDefaultRenderConfig(
- IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */
+ IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render config handle */
)
{
RENDER_CONFIG_DATA RCin;
RENDER_CONFIG_HANDLE hRCin = &RCin;
ivas_error error;
+
IF( NE_32( ( error = ivas_render_config_init_from_rom_fx( &hRCin ) ), IVAS_ERR_OK ) )
{
return error;
@@ -2799,7 +3052,6 @@ ivas_error IVAS_DEC_FeedRenderConfig(
}
hRenderConfig = hIvasDec->st_ivas->hRenderConfig;
- hRenderConfig->roomAcoustics.override = renderConfig.roomAcoustics.override;
hRenderConfig->roomAcoustics.nBands = renderConfig.roomAcoustics.nBands;
hRenderConfig->roomAcoustics.acousticPreDelay_fx = renderConfig.roomAcoustics.acousticPreDelay_fx;
hRenderConfig->roomAcoustics.inputPreDelay_fx = renderConfig.roomAcoustics.inputPreDelay_fx;
@@ -2826,10 +3078,52 @@ ivas_error IVAS_DEC_FeedRenderConfig(
Copy32( renderConfig.roomAcoustics.pAcoustic_rt60_fx, hRenderConfig->roomAcoustics.pAcoustic_rt60_fx, CLDFB_NO_CHANNELS_MAX ); // Q26
Copy32( renderConfig.roomAcoustics.pAcoustic_dsr_fx, hRenderConfig->roomAcoustics.pAcoustic_dsr_fx, CLDFB_NO_CHANNELS_MAX ); // Q30
+ /* Re-initialize reverb instance if already available */
+
+ /* TD renderer Jot reverberator */
+ IF( hIvasDec->st_ivas->hReverb != NULL )
+ {
+ IF( ( error = ivas_reverb_open_fx( &hIvasDec->st_ivas->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
+ /* CREND Jot reverberator */
+ test();
+ test();
+ IF( hIvasDec->st_ivas->hCrendWrapper != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0] != NULL && hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb != NULL )
+ {
+ IF( ( error = ivas_reverb_open_fx( &hIvasDec->st_ivas->hCrendWrapper->hCrend[0]->hReverb, hIvasDec->st_ivas->hHrtfStatistics, hRenderConfig, hIvasDec->st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
+ test();
+ /* FB reverberator */
+ IF( hIvasDec->st_ivas->hDiracDecBin[0] != NULL && hIvasDec->st_ivas->hDiracDecBin[0]->hReverb != NULL )
+ {
+ ivas_binaural_reverb_close_fx( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ) );
+ IF( ( error = ivas_binaural_reverb_init_fx( &( hIvasDec->st_ivas->hDiracDecBin[0]->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hSpatParamRendCom->num_freq_bands, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL, NULL ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
+ test();
+ /* Fastconv CLDFB reverberator */
+ IF( hIvasDec->st_ivas->hBinRenderer != NULL && hIvasDec->st_ivas->hBinRenderer->hReverb != NULL )
+ {
+ ivas_binaural_reverb_close_fx( &( hIvasDec->st_ivas->hBinRenderer->hReverb ) );
+ IF( ( error = ivas_binaural_reverb_init_fx( &( hIvasDec->st_ivas->hBinRenderer->hReverb ), hIvasDec->st_ivas->hHrtfStatistics, hIvasDec->st_ivas->hBinRenderer->conv_band, hIvasDec->st_ivas->hBinRenderer->timeSlots, &( hRenderConfig->roomAcoustics ), hIvasDec->st_ivas->hDecoderConfig->output_Fs, NULL, NULL, NULL ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
Copy( renderConfig.directivity_fx, hRenderConfig->directivity_fx, 3 * MAX_NUM_OBJECTS );
-#ifdef CONF_DISTATT
Copy32( renderConfig.distAtt_fx, hRenderConfig->distAtt_fx, 3 );
-#endif
hRenderConfig->split_rend_config = renderConfig.split_rend_config;
@@ -2839,9 +3133,12 @@ ivas_error IVAS_DEC_FeedRenderConfig(
hRenderConfig->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
}
- IF( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK )
+ IF( is_split_rendering_enabled( hIvasDec->st_ivas->hDecoderConfig, hRenderConfig ) )
{
- return error;
+ IF( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
}
return IVAS_ERR_OK;
@@ -2897,13 +3194,9 @@ ivas_error IVAS_DEC_GetDelay(
out_fs_fx = FS_48K_IN_NS_Q31;
}
move32();
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
- nSamples[1] = NS2SA_FX2( hDecoderConfig->output_Fs, get_delay_fx( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbSynDec[0], hDecoderConfig->output_config ) );
- move16();
-#else
- nSamples[1] = NS2SA_FX2( hDecoderConfig->output_Fs, get_delay_fx( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], hDecoderConfig->output_config ) );
+
+ nSamples[1] = NS2SA_FX2( hDecoderConfig->output_Fs, get_delay_fx( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbSynDec[0], (Word16) EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) );
move16();
-#endif
nSamples[2] = extract_l( W_round64_L( W_mult0_32_32( L_shl( st_ivas->binaural_latency_ns, 1 ), out_fs_fx ) ) );
move16();
nSamples[0] = add( nSamples[1], nSamples[2] );
@@ -3006,7 +3299,10 @@ static bool isSidFrame(
return false;
}
-static void bsCompactToSerial( const UWord8 *compact, UWord16 *serial, UWord16 num_bits )
+static void bsCompactToSerial(
+ const UWord8 *compact,
+ UWord16 *serial,
+ const UWord16 num_bits )
{
/* Bitstream conversion is not counted towards complexity and memory usage */
#define WMC_TOOL_SKIP
@@ -3060,16 +3356,23 @@ ivas_error IVAS_DEC_VoIP_FeedFrame(
Word16 partialCopyFrameType, partialCopyOffset;
Word16 result;
+ test();
+ test();
+ IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL || au == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
IF( auSize == 0 )
{
return IVAS_ERR_OK; /* ignore empty/NO_DATA frame - shouldn't be transmitted in RTP */
}
+
IF( GT_16( shr( add( auSize, 7 ), 3 ), (Word16) MAX_AU_SIZE ) )
{
return IVAS_ERR_INVALID_BITSTREAM;
}
-
partialCopyFrameType = 0;
move16();
partialCopyOffset = 0;
@@ -3149,6 +3452,7 @@ ivas_error IVAS_DEC_VoIP_FeedFrame(
return IVAS_ERR_OK;
}
+
/*---------------------------------------------------------------------*
* IVAS_DEC_VoIP_SetScale( )
*
@@ -3161,12 +3465,13 @@ ivas_error IVAS_DEC_VoIP_SetScale(
const Word16 scale /* i : TSM scale to set in percent of the default frame size */
)
{
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
- IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false )
+ IF( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
{
return IVAS_ERR_TSM_NOT_ENABLED;
}
@@ -3178,26 +3483,37 @@ ivas_error IVAS_DEC_VoIP_SetScale(
move16();
}
- return error;
+ return IVAS_ERR_OK;
}
+
/*---------------------------------------------------------------------*
- * 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(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- const Word16 quality /* i : target TSM quality Q14 */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const Word16 quality /* i : target TSM quality Q14 */
)
{
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
- IF( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm == false )
+ IF( !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
{
return IVAS_ERR_TSM_NOT_ENABLED;
}
@@ -3207,26 +3523,641 @@ ivas_error IVAS_DEC_TSM_SetQuality(
move16();
}
- return error;
+ return IVAS_ERR_OK;
}
+#ifdef FIX_CREND_SIMPLIFY_CODE
+
/*---------------------------------------------------------------------*
- * IVAS_DEC_VoIP_GetSamples( )
+ * renderer_type_to_mode()
*
- * Main function to decode one frame in VoIP
+ * Convert (codec library) renderer type to (API public) binaural renderer mode
*---------------------------------------------------------------------*/
-ivas_error IVAS_DEC_VoIP_GetSamples(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */
- Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
- const UWord32 systemTimestamp_ms /* i : current system timestamp */
+/*! r: binaural renderer mode (API type) */
+static IVAS_BIN_RENDERER_TYPE renderer_type_to_mode(
+ const RENDERER_TYPE renderer_type /* i : renderer type (codec library type) */
+)
+{
+ IVAS_BIN_RENDERER_TYPE binaural_renderer;
+
+ SWITCH( renderer_type )
+ {
+ case RENDERER_BINAURAL_OBJECTS_TD:
+ binaural_renderer = IVAS_BIN_RENDERER_TYPE_TDREND;
+ BREAK;
+ case RENDERER_BINAURAL_MIXER_CONV:
+ case RENDERER_BINAURAL_MIXER_CONV_ROOM:
+ binaural_renderer = IVAS_BIN_RENDERER_TYPE_CREND;
+ BREAK;
+ case RENDERER_BINAURAL_FASTCONV:
+ binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV;
+ BREAK;
+ case RENDERER_BINAURAL_FASTCONV_ROOM:
+ binaural_renderer = IVAS_BIN_RENDERER_TYPE_FASTCONV;
+ BREAK;
+ case RENDERER_BINAURAL_PARAMETRIC:
+ case RENDERER_BINAURAL_PARAMETRIC_ROOM:
+ binaural_renderer = IVAS_BIN_RENDERER_TYPE_PARAMBIN;
+ BREAK;
+ default:
+ binaural_renderer = IVAS_BIN_RENDERER_TYPE_NONE;
+ BREAK;
+ }
+ move32();
+
+ return binaural_renderer;
+}
+
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_ReadFormat( )
+ *
+ * Read main parameters from the bitstream to set-up the decoder:
+ * - IVAS format
+ * - IVAS format specific signaling
+ * - compensate for renderer granularity change in JBM
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_ReadFormat(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ IVAS_BIN_RENDERER_TYPE *binaural_renderer, /* o : binaural renderer type */
+ IVAS_BIN_RENDERER_TYPE *binaural_renderer_sec, /* o : secondary binaural renderer type */
+ IVAS_AUDIO_CONFIG *hrtf_set_audio_cfg /* o : HRTF set audio config. */
+)
+{
+ ivas_error error;
+ Decoder_Struct *st_ivas;
+ IVAS_FORMAT ivas_format_old;
+ ISM_MODE ism_mode_old;
+ MC_MODE mc_mode_old;
+ Word16 nchan_transport_old;
+ AUDIO_CONFIG intern_config_old, transport_config_old, output_config;
+ RENDERER_TYPE renderer_type_old, renderer_type_sec_new;
+
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ st_ivas = hIvasDec->st_ivas;
+ ivas_format_old = st_ivas->ivas_format;
+ ism_mode_old = st_ivas->ism_mode;
+ mc_mode_old = st_ivas->mc_mode;
+ nchan_transport_old = st_ivas->nchan_transport;
+ intern_config_old = st_ivas->intern_config;
+ transport_config_old = st_ivas->transport_config;
+ renderer_type_old = st_ivas->renderer_type;
+ move32();
+ move32();
+ move32();
+ move32();
+ move16();
+ move32();
+ move32();
+ move32();
+
+ output_config = st_ivas->hDecoderConfig->output_config;
+ move32();
+
+ IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) )
+ {
+ return IVAS_ERR_OK;
+ }
+
+ IF( st_ivas->bfi == 0 )
+ {
+ IF( NE_32( error = ivas_dec_get_format_fx( st_ivas ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+
+ test();
+ test();
+ test();
+ IF( NE_32( ivas_format_old, st_ivas->ivas_format ) && GT_16( st_ivas->ini_frame, 0 ) && ( NE_32( st_ivas->ivas_format, MASA_FORMAT ) && NE_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_INVALID_INPUT_FORMAT, "IVAS format switching is not allowed." ) );
+ }
+
+ /* Select binaural renderer */
+ ivas_renderer_select( st_ivas );
+ *binaural_renderer = renderer_type_to_mode( st_ivas->renderer_type );
+
+ /* Select secondary binaural renderer (used in combined formats) */
+ renderer_type_sec_new = ivas_renderer_secondary_select( st_ivas );
+ *binaural_renderer_sec = renderer_type_to_mode( renderer_type_sec_new );
+
+ /* select HRTF audio configuration to load the right HRTF set for the external binary file */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
+ move32();
+ IF( EQ_32( *binaural_renderer, IVAS_BIN_RENDERER_TYPE_FASTCONV ) )
+ {
+ IF( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
+ {
+ /* SHD HRIRs */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_HOA3;
+ move32();
+
+ IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
+ {
+ /* BRIRs */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
+ move32();
+ }
+ }
+ ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
+ {
+ /* HRIRs */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
+ move32();
+ test();
+ test();
+ IF( st_ivas->hDecoderConfig->Opt_Headrotation &&
+ ( NE_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) || NE_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) )
+ {
+ /* SHD HRIRs for low complexity rotation */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_HOA3;
+ move32();
+ }
+ }
+ }
+ ELSE IF( EQ_32( *binaural_renderer, IVAS_BIN_RENDERER_TYPE_CREND ) )
+ {
+ IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
+ {
+ /* BRIRs */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
+ move32();
+ }
+ ELSE IF( EQ_32( st_ivas->ivas_format, MC_FORMAT ) && EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) )
+ {
+ test();
+ /* BRIRs */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_7_1_4;
+ move32();
+ test();
+ test();
+ IF( st_ivas->hDecoderConfig->Opt_Headrotation && ( EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) )
+ {
+ /* SHD HRIRs for low complexity rotation */
+ *hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_HOA3;
+ move32();
+ }
+ }
+ }
+
+#ifdef FIX_HRTF_LOAD
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ IF( ( NE_32( renderer_type_old, st_ivas->renderer_type ) && NE_32( renderer_type_old, RENDERER_DISABLE ) ) ||
+ ( st_ivas->ini_active_frame > 0 && ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) ) && EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
+ {
+ /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
+ render what still fits in the new granularity */
+ Word16 tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs );
+
+#ifdef NONBE_1200_ISM_JBM_BRATE_SW_FLUSH
+ st_ivas->nchan_transport = nchan_transport_old;
+ move16();
+#else
+// st_ivas->nchan_transport = nchan_transport_old; // ToDo: temporarily deactivated to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1200
+#endif
+ if ( st_ivas->ivas_format == MASA_FORMAT )
+ {
+ st_ivas->nchan_ism = 0; // ToDo: temporary hack to keep FIX_HRTF_LOAD bit-exact but this is likely a bug in the main -> see issue #1199
+ }
+
+ IF( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
+ {
+ IF( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &st_ivas->hIntSetup, mc_mode_old, ism_mode_old, &hIvasDec->nSamplesFlushed, hIvasDec->flushbuffer ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+ }
+#endif
+ }
+
+ st_ivas->ism_mode = ism_mode_old;
+ st_ivas->mc_mode = mc_mode_old;
+ st_ivas->nchan_transport = nchan_transport_old;
+ st_ivas->intern_config = intern_config_old;
+ st_ivas->transport_config = transport_config_old;
+ st_ivas->renderer_type = renderer_type_old;
+ move32();
+ move32();
+ move16();
+ move32();
+ move32();
+
+ return IVAS_ERR_OK;
+}
+#endif
+
+#ifdef FIX_HRTF_LOAD_API
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_GetSamplesDecoder( )
+ *
+ * Main function to decode transport channels, do TSM and feed to renderer.
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_GetSamplesDecoder(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ const int16_t isSplitRend, /* i : split rendering enabled flag */
+ ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */
+)
+{
+
+ ivas_error error;
+
+ if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ /* If TSM is generally enabled, we have to wait for the first good frame.
+ Otherwise, we directly decode the first frame in any case. */
+#ifdef FIX_HRTF_LOAD
+ if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame )
+#else
+ if ( ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && hIvasDec->hasBeenFedFirstGoodFrame ) || !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
+#endif
+ {
+
+ UWord16 l_ts, nTimeScalerOutSamples;
+#ifdef FIX_HRTF_LOAD
+ UWord8 nTransportChannels;
+#else
+ UWord8 nTransportChannels, nOutChannels;
+#endif
+ Word16 nResidualSamples, nSamplesTcsScaled, nOutSamplesElse;
+
+ if ( isSplitRend )
+ {
+ IF( ( error = isar_set_split_rend_setup( hIvasDec->st_ivas->hSplitBinRend, &hIvasDec->st_ivas->hRenderConfig->split_rend_config, hIvasDec->st_ivas->hCombinedOrientationData, splitRendBits ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
+#ifdef FIX_HRTF_LOAD
+ if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels ) ) != IVAS_ERR_OK )
+#else
+ if ( ( error = IVAS_DEC_Setup( hIvasDec, &l_ts, &nTransportChannels, &nOutChannels, &hIvasDec->nSamplesFlushed, hIvasDec->pcmType, hIvasDec->flushbuffer ) ) != IVAS_ERR_OK )
+#endif
+ {
+ return error;
+ }
+
+ if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && nTransportChannels != hIvasDec->nTransportChannelsOld )
+ {
+ if ( ( error = IVAS_DEC_VoIP_reconfigure( hIvasDec, nTransportChannels, l_ts ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+
+ /* IVAS TC decoder */
+ if ( ( error = IVAS_DEC_GetTcSamples( hIvasDec, hIvasDec->apaExecBuffer_fx, &nOutSamplesElse ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ /* JBM */
+ if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
+ {
+ IF( apa_set_scale_fx( hIvasDec->hTimeScaler, hIvasDec->tsm_scale ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+
+ // tmp apaExecBuffer
+ IF( EQ_16( (Word16) hIvasDec->mode, IVAS_DEC_MODE_EVS ) )
+ {
+ Word16 tmp_apaExecBuffer[APA_BUF];
+ FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i )
+ {
+ tmp_apaExecBuffer[i] = extract_l( L_shr( hIvasDec->apaExecBuffer_fx[i], Q11 ) ); // Q0
+ }
+ IF( apa_exec_fx( hIvasDec->hTimeScaler, tmp_apaExecBuffer, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, tmp_apaExecBuffer, &nTimeScalerOutSamples ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+ FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i )
+ {
+ hIvasDec->apaExecBuffer_fx[i] = L_shl( tmp_apaExecBuffer[i], Q11 ); // Q11
+ }
+ }
+ ELSE
+ {
+ IF( apa_exec_ivas_fx( hIvasDec->hTimeScaler, hIvasDec->apaExecBuffer_fx, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, hIvasDec->apaExecBuffer_fx, &nTimeScalerOutSamples ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+ }
+ assert( LE_32( (Word32) nTimeScalerOutSamples, APA_BUF ) );
+ nSamplesTcsScaled = idiv1616U( extract_l( nTimeScalerOutSamples ), nTransportChannels );
+ hIvasDec->timeScalingDone = 1;
+ move16();
+ }
+ else
+ {
+ nSamplesTcsScaled = hIvasDec->nSamplesFrame;
+ }
+
+ /* Feed decoded transport channels samples to the renderer */
+ if ( ( error = IVAS_DEC_RendererFeedTcSamples( hIvasDec, nSamplesTcsScaled, &nResidualSamples, hIvasDec->apaExecBuffer_fx ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ if ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
+ {
+ /* feed residual samples to TSM for the next call */
+ if ( apa_set_renderer_residual_samples( hIvasDec->hTimeScaler, (uint16_t) nResidualSamples ) != 0 )
+ {
+ return IVAS_ERR_UNKNOWN;
+ }
+ }
+ hIvasDec->hasBeenFedFrame = false;
+ }
+ hIvasDec->hasBeenPreparedRendering = false;
+
+ IF( hIvasDec->st_ivas->hIsmMetaData[0] )
+ {
+ IF( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT )
+ {
+ IF( hIvasDec->st_ivas->ism_mode == ISM_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC )
+ {
+ Word16 obj;
+ ISM_METADATA_HANDLE *hIsmMetaData = hIvasDec->st_ivas->hIsmMetaData;
+ FOR( obj = 0; obj < hIvasDec->st_ivas->nchan_ism; obj++ )
+ {
+ hIsmMetaData[obj]->edited_azimuth_fx = hIsmMetaData[obj]->azimuth_fx;
+ hIsmMetaData[obj]->edited_elevation_fx = hIsmMetaData[obj]->elevation_fx;
+ hIsmMetaData[obj]->edited_yaw_fx = hIsmMetaData[obj]->yaw_fx;
+ hIsmMetaData[obj]->edited_pitch_fx = hIsmMetaData[obj]->pitch_fx;
+ hIsmMetaData[obj]->edited_radius_fx = hIsmMetaData[obj]->radius_fx;
+ hIsmMetaData[obj]->edited_gain_fx = ONE_IN_Q31;
+ }
+
+ IF( hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC )
+ {
+ hIvasDec->st_ivas->hSbaIsmData->gain_bed_fx = ONE_IN_Q31;
+ }
+ }
+ }
+ }
+
+ IF( hIvasDec->st_ivas->hParamIsmDec != NULL )
+ {
+ IF( hIvasDec->st_ivas->ism_mode == ISM_MODE_PARAM )
+ {
+ Word16 obj = 0;
+ PARAM_ISM_DEC_HANDLE hParamIsmDec = hIvasDec->st_ivas->hParamIsmDec;
+ for ( obj = 0; obj < hIvasDec->st_ivas->nchan_ism; obj++ )
+ {
+ hParamIsmDec->edited_azimuth_values_fx[obj] = hParamIsmDec->azimuth_values_fx[obj];
+ hParamIsmDec->edited_elevation_values_fx[obj] = hParamIsmDec->elevation_values_fx[obj];
+ }
+ }
+ }
+
+ return IVAS_ERR_OK;
+}
+#endif
+
+#ifdef OBJ_EDITING_API
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_GetEditableParameters( )
+ *
+ *
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_GetEditableParameters(
+ IVAS_DEC_HANDLE hIvasDec,
+ IVAS_EDITABLE_PARAMETERS *hIvasEditableParameters )
+{
+ ivas_error error;
+
+ test();
+ test();
+ test();
+ test();
+ test();
+ if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT ||
+ ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ||
+ ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." );
+ }
+
+ test();
+ test();
+ if ( hIvasEditableParameters == NULL || hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ hIvasEditableParameters->gain_bed_fx = ONE_IN_Q30;
+ move32();
+ hIvasEditableParameters->num_obj = hIvasDec->st_ivas->nchan_ism;
+ move16();
+ test();
+ test();
+ if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT )
+ {
+ if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC )
+ {
+ Word16 obj;
+ for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ )
+ {
+ hIvasEditableParameters->ism_metadata[obj].azimuth_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->azimuth_fx;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].elevation_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->elevation_fx;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].yaw_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->yaw_fx;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].pitch_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->pitch_fx;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].radius_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->radius_fx;
+ move16();
+ hIvasEditableParameters->ism_metadata[obj].gain_fx = hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain_fx;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag;
+ move16();
+ }
+ if ( hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC )
+ {
+ hIvasEditableParameters->gain_bed_fx = ONE_IN_Q30;
+ move32();
+ }
+ }
+ else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_PARAM )
+ {
+ Word16 obj;
+ for ( obj = 0; obj < hIvasEditableParameters->num_obj; obj++ )
+ {
+ hIvasEditableParameters->ism_metadata[obj].azimuth_fx = hIvasDec->st_ivas->hParamIsmDec->azimuth_values_fx[obj];
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].elevation_fx = hIvasDec->st_ivas->hParamIsmDec->elevation_values_fx[obj];
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].yaw_fx = 0;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].pitch_fx = 0;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].radius_fx = 0;
+ move16();
+ hIvasEditableParameters->ism_metadata[obj].gain_fx = ONE_IN_Q31;
+ move32();
+ hIvasEditableParameters->ism_metadata[obj].non_diegetic_flag = 0;
+ move16();
+ }
+ }
+ else
+ {
+ assert( 0 && "This should never happen!" );
+ }
+ }
+
+ error = IVAS_ERR_OK;
+
+ return error;
+}
+
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_SetEditableParameters( )
+ *
+ * Main function to decode to PCM data
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_SetEditableParameters(
+ IVAS_DEC_HANDLE hIvasDec,
+ IVAS_EDITABLE_PARAMETERS hIvasEditableParameters )
+{
+ ivas_error error;
+
+ if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT ||
+ ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ||
+ ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) ||
+ hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
+ {
+ return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Object editing no supported in this operation mode." );
+ }
+
+ if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ error = IVAS_ERR_OK;
+
+#ifdef DEBUGGING
+ assert( hIvasEditableParameters.num_obj == hIvasDec->st_ivas->nchan_ism );
+#endif
+
+ if ( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT )
+ {
+ if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_DISC || hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC )
+ {
+ int16_t obj;
+ for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ )
+ {
+ hIvasDec->st_ivas->hIsmMetaData[obj]->edited_azimuth_fx = hIvasEditableParameters.ism_metadata[obj].azimuth_fx;
+ hIvasDec->st_ivas->hIsmMetaData[obj]->edited_elevation_fx = hIvasEditableParameters.ism_metadata[obj].elevation_fx;
+ hIvasDec->st_ivas->hIsmMetaData[obj]->edited_radius_fx = hIvasEditableParameters.ism_metadata[obj].radius_fx;
+
+ hIvasDec->st_ivas->hIsmMetaData[obj]->edited_gain_fx = hIvasEditableParameters.ism_metadata[obj].gain_fx;
+
+ hIvasDec->st_ivas->hIsmMetaData[obj]->edited_yaw_fx = hIvasEditableParameters.ism_metadata[obj].yaw_fx;
+ hIvasDec->st_ivas->hIsmMetaData[obj]->edited_pitch_fx = hIvasEditableParameters.ism_metadata[obj].pitch_fx;
+
+ hIvasDec->st_ivas->hIsmMetaData[obj]->non_diegetic_flag = hIvasEditableParameters.ism_metadata[obj].non_diegetic_flag;
+ }
+
+ if ( hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC )
+ {
+ hIvasDec->st_ivas->hSbaIsmData->gain_bed_fx = hIvasEditableParameters.gain_bed_fx;
+ }
+ }
+ else if ( hIvasDec->st_ivas->ism_mode == ISM_MODE_PARAM )
+ {
+ int16_t obj;
+ for ( obj = 0; obj < hIvasEditableParameters.num_obj; obj++ )
+ {
+ }
+ }
+ else
+ {
+ assert( 0 && "This should never happen!" );
+ }
+ }
+
+ return error;
+}
+
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_PrepareRenderer( )
+ *
+ * Main function to decode to PCM data
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_PrepareRenderer(
+ IVAS_DEC_HANDLE hIvasDec )
+{
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+
+ if ( hIvasDec == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ ivas_jbm_dec_prepare_renderer( hIvasDec->st_ivas );
+ hIvasDec->hasBeenPreparedRendering = true;
+ return error;
+}
+#endif
+
+/*---------------------------------------------------------------------*
+ * IVAS_DEC_VoIP_GetSamples( )
+ *
+ * Main function to decode one frame in VoIP
+ *---------------------------------------------------------------------*/
+
+ivas_error IVAS_DEC_VoIP_GetSamples(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ UWord16 nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */
+ Word16 *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
+ const UWord32 systemTimestamp_ms, /* i : current system timestamp */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+#ifdef SUPPORT_JBM_TRACEFILE
+ JbmTraceFileWriterFn jbmWriterFn,
+ void *jbmWriter,
+#endif
+ bool *bitstreamReadDone, /* o : that bitstream was read */
+ UWord16 *nSamplesRendered /* o : number of samples rendered */
+#else
#ifdef SUPPORT_JBM_TRACEFILE
- ,
JbmTraceFileWriterFn jbmWriterFn,
void *jbmWriter
#endif
+#endif
+#ifdef OBJ_EDITING_API
+ ,
+ bool *parametersAvailableForEditing
+#endif
)
{
Decoder_Struct *st_ivas;
@@ -3235,24 +4166,33 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
UWord32 extBufferedTime_ms, scale, maxScaling;
JB4_DATAUNIT_HANDLE dataUnit;
UWord16 extBufferedSamples;
-#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
- Word16 timeScalingDone;
-#endif
Word16 result;
ivas_error error;
+#ifndef FIX_CREND_SIMPLIFY_CODE
Word16 nSamplesRendered;
+#endif
+#ifdef OBJ_EDITING_API
+ *parametersAvailableForEditing = false;
+#endif
+
UWord8 nOutChannels;
+ test();
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->hVoIP == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
st_ivas = hIvasDec->st_ivas;
hDecoderConfig = st_ivas->hDecoderConfig;
hVoIP = hIvasDec->hVoIP;
-#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
- timeScalingDone = 0;
-#endif
nOutChannels = (UWord8) st_ivas->hDecoderConfig->nchan_out;
+#ifndef FIX_CREND_SIMPLIFY_CODE
nSamplesRendered = 0;
move16();
move16();
+#endif
move16();
IF( nSamplesPerChannel == 0 )
@@ -3260,8 +4200,21 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
return IVAS_ERR_WRONG_PARAMS;
}
- /* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */
+#ifdef TMP_FIX_1119_SPLIT_RENDERING_VOIP
+ test();
+ IF( EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ||
+ EQ_32( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_NOT_IMPLEMENTED, "Split rendering is not integrated with VoIP mode" );
+ }
+#endif
+
+/* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ WHILE( LT_16( *nSamplesRendered, nSamplesPerChannel ) )
+#else
WHILE( LT_16( nSamplesRendered, nSamplesPerChannel ) )
+#endif
{
IF( hIvasDec->nSamplesAvailableNext == 0 )
{
@@ -3276,12 +4229,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
}
}
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
extBufferedSamples = nSamplesBuffered;
move16();
-#else
- extBufferedSamples = add( nSamplesRendered, nSamplesBuffered );
-#endif
Word16 exp;
extBufferedTime_ms = BASOP_Util_Divide3232_Scale( imult3216( extBufferedSamples, 1000 ), hDecoderConfig->output_Fs, &exp );
extBufferedTime_ms = (UWord32) W_shr( extBufferedTime_ms, sub( 15, exp ) ); // Q0
@@ -3313,24 +4262,12 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
/* avoid time scaling multiple times in one sound card slot */
IF( NE_64( scale, 100U ) )
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
{
IF( hIvasDec->timeScalingDone )
-#else
- {
- IF( timeScalingDone )
-#endif
{
scale = 100;
move32();
}
-#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
- ELSE
- {
- timeScalingDone = 1;
- move16();
- }
-#endif
}
/* limit scale to range supported by time scaler */
@@ -3362,6 +4299,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
{
return error;
}
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ *bitstreamReadDone = true;
+#endif
}
ELSE IF( hIvasDec->hasDecodedFirstGoodFrame )
{
@@ -3402,6 +4343,15 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
JB4_FreeDataUnit( hVoIP->hJBM, dataUnit );
}
+#ifdef FIX_HRTF_LOAD
+ test();
+ IF( hIvasDec->hasBeenFedFirstGoodFrame && *bitstreamReadDone == true )
+ {
+ /* new bitstream was feeded, return for reconfiguration */
+ return IVAS_ERR_OK;
+ }
+
+#endif
IF( !hIvasDec->hasBeenFedFirstGoodFrame )
{
hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame;
@@ -3409,6 +4359,15 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
move16();
move16();
}
+
+#ifdef OBJ_EDITING_API
+ /* :TODO: only return here if we really have editing initialized */
+ if ( hIvasDec->hasBeenFedFirstGoodFrame && hIvasDec->hasEditableParameters == true && hIvasDec->enableParameterEditing == true )
+ {
+ *parametersAvailableForEditing = true;
+ return IVAS_ERR_OK;
+ }
+#endif
}
/* decode */
@@ -3417,39 +4376,90 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
/* codec mode to use not known yet - simply output silence */
/* directly set output zero */
Word16 nSamplesToZero = s_min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext );
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ set16_fx( pcmBuf + imult1616( *nSamplesRendered, nOutChannels ), 0, imult1616( nSamplesToZero, nOutChannels ) );
+ *nSamplesRendered = add( *nSamplesRendered, nSamplesToZero );
+#else
set16_fx( pcmBuf + imult1616( nSamplesRendered, nOutChannels ), 0, imult1616( nSamplesToZero, nOutChannels ) );
nSamplesRendered = add( nSamplesRendered, nSamplesToZero );
+#endif
hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesToZero );
hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesToZero );
move16();
move16();
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
update_voip_rendered20ms( hIvasDec, nSamplesToZero );
-#endif
}
ELSE
{
Word16 nSamplesToRender, nSamplesRendered_loop;
bool tmp;
+
+#ifdef FIX_HRTF_LOAD_API
+ if ( !hIvasDec->isInitialized || hIvasDec->hasBeenFedFrame )
+ {
+ if ( hIvasDec->nSamplesAvailableNext == 0 || hIvasDec->nSamplesAvailableNext == hIvasDec->nSamplesFrame )
+ {
+ uint16_t nSamplesFlushed_ref = hIvasDec->nSamplesFlushed;
+
+ if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, 0, 0 ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+
+ hIvasDec->nSamplesFlushed = nSamplesFlushed_ref;
+
+ *bitstreamReadDone = false;
+ }
+ }
+#endif
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ nSamplesToRender = sub( nSamplesPerChannel, *nSamplesRendered );
+#else
nSamplesToRender = sub( nSamplesPerChannel, nSamplesRendered );
+#endif
+
+#ifdef OBJ_EDITING_API
+ /* check if we still need to prepare the renderer */
+ IF( hIvasDec->hasBeenPreparedRendering == false )
+ {
+
+ IF( NE_32( ( error = IVAS_DEC_PrepareRenderer( hIvasDec ) ), IVAS_ERR_OK ) )
+ {
+ return error;
+ }
+ }
+#endif
/* render IVAS frames directly to the output buffer */
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ IF( NE_32( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmBuf + imult1616( *nSamplesRendered, nOutChannels ), &nSamplesRendered_loop, &tmp ) ), IVAS_ERR_OK ) )
+#else
IF( NE_32( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmBuf + imult1616( nSamplesRendered, nOutChannels ), &nSamplesRendered_loop, &tmp ) ), IVAS_ERR_OK ) )
+#endif
{
return error;
}
+#ifndef FIX_HRTF_LOAD_API
+#ifdef FIX_HRTF_LOAD
+ *bitstreamReadDone = false; // temp hack until JBM API is reworked
+#endif
+#endif
+
+#ifdef FIX_CREND_SIMPLIFY_CODE
+ *nSamplesRendered = add( *nSamplesRendered, nSamplesRendered_loop );
+#else
nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop );
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
- update_voip_rendered20ms( hIvasDec, nSamplesRendered_loop );
#endif
+ update_voip_rendered20ms( hIvasDec, nSamplesRendered_loop );
}
}
return IVAS_ERR_OK;
}
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
+
/*---------------------------------------------------------------------*
* update_voip_rendered20ms( )
*
@@ -3461,7 +4471,9 @@ static void update_voip_rendered20ms(
const Word16 nSamplesRendered )
{
Word16 nSamplesRenderedTotal;
+
nSamplesRenderedTotal = add( hIvasDec->hVoIP->nSamplesRendered20ms, nSamplesRendered );
+
/* we have crossed a 20ms border, reset the time scaling done flag */
IF( GE_16( nSamplesRenderedTotal, hIvasDec->hVoIP->nSamplesFrame ) )
{
@@ -3476,9 +4488,10 @@ static void update_voip_rendered20ms(
{
hIvasDec->hVoIP->nSamplesRendered20ms = sub( hIvasDec->hVoIP->nSamplesRendered20ms, hIvasDec->hVoIP->nSamplesFrame );
}
+
+ return;
}
-#endif
/*---------------------------------------------------------------------*
* IVAS_DEC_VoIP_Flush( )
@@ -3496,6 +4509,15 @@ ivas_error IVAS_DEC_Flush(
ivas_error error;
UWord16 nSamplesToRender;
UWord16 nSamplesFlushedLocal;
+#ifdef FIX_HRTF_LOAD
+ nSamplesFlushedLocal = 0; // temp. hack
+#endif
+
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
*nSamplesFlushed = s_min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext );
move16();
@@ -3504,22 +4526,19 @@ ivas_error IVAS_DEC_Flush(
move16();
/* render IVAS frames */
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
error = IVAS_ERR_OK;
+ move16();
test();
IF( GT_16( nSamplesToRender, 0 ) && NE_16( (Word16) hIvasDec->st_ivas->ivas_format, (Word16) MONO_FORMAT ) )
{
-#endif
error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmBuf );
-#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
}
ELSE
{
*nSamplesFlushed = 0;
move16();
}
-#endif
return error;
}
@@ -3535,6 +4554,12 @@ bool IVAS_DEC_VoIP_IsEmpty(
IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
const Word16 nSamplesAsked )
{
+ test();
+ IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
test();
return ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 && LT_16( hIvasDec->nSamplesAvailableNext, nSamplesAsked ) );
}
@@ -3656,7 +4681,9 @@ ivas_error IVAS_DEC_GetJbmData(
)
{
- IF( hIvasDec->hVoIP == NULL )
+ test();
+ test();
+ IF( hIvasDec == NULL || hIvasDec->hVoIP == NULL || JbmTraceData == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
@@ -3886,14 +4913,20 @@ static ivas_error printConfigInfo_dec(
* Print decoder set-up info
*---------------------------------------------------------------------*/
-void IVAS_DEC_PrintConfig(
+ivas_error IVAS_DEC_PrintConfig(
const IVAS_DEC_HANDLE hIvasDec,
const bool quietModeEnabled,
const bool voipMode )
{
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
printConfigInfo_dec( hIvasDec->st_ivas, hIvasDec->bitstreamformat, voipMode, quietModeEnabled );
- return;
+ return IVAS_ERR_OK;
}
@@ -3933,11 +4966,10 @@ static ivas_error evs_dec_main_fx(
hCoreCoder = st_ivas->hSCE[0]->hCoreCoder;
hCoreCoder[0]->total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
- hCoreCoder[0]->total_num_bits = st_ivas->num_bits;
- move16();
move32();
- hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, 0x0290 /*Q0*/ ) ); // Q0
+ hCoreCoder[0]->output_frame_fx = extract_l( Mult_32_16( hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ); // Q0
move16();
+
mdct_switching_dec_fx( hCoreCoder[0] );
FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ )
@@ -4206,17 +5238,16 @@ static ivas_error IVAS_DEC_VoIP_reconfigure(
*
*---------------------------------------------------------------------*/
-ivas_error
-IVAS_DEC_GetSplitRendBitstreamHeader(
- IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
- ISAR_SPLIT_REND_CODEC *pCodec, /* o: pointer to codec setting */
- ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o: pointer to pose correction mode */
- Word16 *pIsar_frame_size_ms, /* o: pointer to isar frame size setting */
- Word16 *pCodec_frame_size_ms /* o: pointer to codec frame size setting */
- ,
+ivas_error IVAS_DEC_GetSplitRendBitstreamHeader(
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ ISAR_SPLIT_REND_CODEC *pCodec, /* o : pointer to codec setting */
+ ISAR_SPLIT_REND_POSE_CORRECTION_MODE *poseCorrection, /* o : pointer to pose correction mode */
+ Word16 *pIsar_frame_size_ms, /* o : pointer to ISAR frame size setting */
+ Word16 *pCodec_frame_size_ms, /* o : pointer to codec frame size setting */
Word16 *pLc3plusHighRes )
{
- if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
+ test();
+ IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
@@ -4226,6 +5257,7 @@ IVAS_DEC_GetSplitRendBitstreamHeader(
*poseCorrection = hIvasDec->st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode;
*pIsar_frame_size_ms = hIvasDec->st_ivas->hRenderConfig->split_rend_config.isar_frame_size_ms;
*pLc3plusHighRes = hIvasDec->st_ivas->hRenderConfig->split_rend_config.lc3plus_highres;
+
return IVAS_ERR_OK;
}
@@ -4247,6 +5279,8 @@ ivas_error IVAS_DEC_GetCldfbSamples(
ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE hSplitBinRend;
Word16 ch, b, slot_idx, num_chs, maxBand, num_samples;
+ test();
+ test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL || hIvasDec->st_ivas->hSplitBinRend == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
@@ -4329,6 +5363,11 @@ static void ivas_destroy_handle_isar(
{
IF( *hSplitBinRend != NULL )
{
+#ifdef TMP_FIX_SPLIT_REND
+ free( ( *hSplitBinRend )->hMultiBinCldfbData );
+ ( *hSplitBinRend )->hMultiBinCldfbData = NULL;
+
+#endif
ISAR_PRE_REND_close( &( *hSplitBinRend )->splitrend, NULL );
IF( ( *hSplitBinRend )->hCldfbDataOut != NULL )
@@ -4352,26 +5391,233 @@ static void ivas_destroy_handle_isar(
*---------------------------------------------------------------------*/
int16_t IVAS_DEC_is_split_rendering_enabled(
- IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ Word16 *isSplitRend /* o : flag to indicate if split rendering is enabled */
)
{
Decoder_Struct *st_ivas;
- Word16 isSplitRend;
+ test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
+
st_ivas = hIvasDec->st_ivas;
- isSplitRend = 0;
- IF( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ||
- ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan && st_ivas->hRenderConfig->split_rend_config.dof == 0 ) )
+ *isSplitRend = is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig );
+
+ return IVAS_ERR_OK;
+}
+
+
+/*-------------------------------------------------------------------*
+ * ivas_dec_reconfig_split_rend()
+ *
+ * IVAS decoder split rend reconfig
+ *-------------------------------------------------------------------*/
+
+static ivas_error ivas_dec_reconfig_split_rend(
+ Decoder_Struct *st_ivas /* i : IVAS decoder structure */
+)
+{
+ ivas_error error;
+ Word16 cldfb_in_flag, num_ch, ch, isCldfbNeeded, i, pcm_out_flag;
+ SPLIT_REND_WRAPPER *hSplitRendWrapper;
+
+ hSplitRendWrapper = &st_ivas->hSplitBinRend->splitrend;
+ move16();
+ pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
+ move16();
+ cldfb_in_flag = 0;
+ move16();
+
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
+ {
+ cldfb_in_flag = 1;
+ move16();
+ }
+
+ ISAR_PRE_REND_GetMultiBinPoseData( &st_ivas->hRenderConfig->split_rend_config, &hSplitRendWrapper->multiBinPoseData, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->sr_pose_pred_axis : DEFAULT_AXIS );
+
+ isCldfbNeeded = 0;
+ move16();
+
+ IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
+ ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
+ {
+ cldfb_in_flag = 0;
+ move16();
+ }
+
+ IF( NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) )
+ {
+ IF( EQ_16( cldfb_in_flag, 0 ) )
+ {
+ isCldfbNeeded = 1;
+ move16();
+ }
+ ELSE IF( EQ_16( st_ivas->hRenderConfig->split_rend_config.codec, ISAR_SPLIT_REND_CODEC_LC3PLUS ) && cldfb_in_flag )
+ {
+ isCldfbNeeded = 1;
+ move16();
+ }
+ ELSE IF( pcm_out_flag && cldfb_in_flag )
+ {
+ isCldfbNeeded = 1;
+ move16();
+ }
+ }
+ ELSE IF( st_ivas->hDecoderConfig->Opt_non_diegetic_pan )
+ {
+ isCldfbNeeded = 1;
+ move16();
+ }
+
+ test();
+ IF( EQ_16( isCldfbNeeded, 1 ) && hSplitRendWrapper->hCldfbHandles == NULL )
+ {
+ IF( ( hSplitRendWrapper->hCldfbHandles = (CLDFB_HANDLES_WRAPPER_HANDLE) malloc( sizeof( CLDFB_HANDLES_WRAPPER ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB handles\n" ) );
+ }
+
+ num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
+ move16();
+ FOR( ch = 0; ch < num_ch; ch++ )
+ {
+ hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
+ move16();
+ }
+
+ num_ch = i_mult( hSplitRendWrapper->multiBinPoseData.num_poses, BINAURAL_CHANNELS );
+ move16();
+
+ FOR( ch = 0; ch < num_ch; ch++ )
+ {
+ IF( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] ), CLDFB_ANALYSIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not open CLDFB handles\n" ) );
+ }
+ }
+
+ FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
+ {
+ if ( ( error = openCldfb_ivas_fx( &( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] ), CLDFB_SYNTHESIS, st_ivas->hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK )
+ {
+ return error;
+ }
+ }
+ }
+ ELSE IF( EQ_16( isCldfbNeeded, 0 ) && hSplitRendWrapper->hCldfbHandles != NULL )
+ {
+ num_ch = i_mult( MAX_HEAD_ROT_POSES, BINAURAL_CHANNELS );
+ move16();
+ FOR( ch = 0; ch < num_ch; ch++ )
+ {
+ IF( hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] != NULL )
+ {
+ deleteCldfb_ivas_fx( &hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] );
+ hSplitRendWrapper->hCldfbHandles->cldfbAna[ch] = NULL;
+ move32();
+ }
+ }
+
+ FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
+ {
+ IF( hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] != NULL )
+ {
+ deleteCldfb_ivas_fx( &hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] );
+ hSplitRendWrapper->hCldfbHandles->cldfbSyn[ch] = NULL;
+ move32();
+ }
+ }
+
+ free( hSplitRendWrapper->hCldfbHandles );
+ hSplitRendWrapper->hCldfbHandles = NULL;
+ move32();
+ }
+
+ IF( ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) &&
+ ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || NE_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) &&
+ !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) ) /* td-rend not needed? */
+ {
+ FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
+ {
+ IF( st_ivas->hTdRendHandles[i] != NULL )
+ {
+ st_ivas->hTdRendHandles[i]->HrFiltSet_p = NULL;
+ move32();
+ ivas_td_binaural_close_fx( &st_ivas->hTdRendHandles[i] );
+ }
+ }
+ }
+
+ return IVAS_ERR_OK;
+}
+
+
+/*-------------------------------------------------------------------*
+ * ivas_dec_init_split_rend()
+ *
+ * IVAS decoder split rendering initialization
+ *-------------------------------------------------------------------*/
+
+static ivas_error ivas_dec_init_split_rend(
+ Decoder_Struct *st_ivas /* i : IVAS decoder structure */
+)
+{
+ ivas_error error;
+ Word16 cldfb_in_flag, pcm_out_flag;
+ Word16 mixed_td_cldfb_flag;
+
+ pcm_out_flag = ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0;
+ cldfb_in_flag = 0;
+ move16();
+
+#ifdef TMP_FIX_SPLIT_REND
+ /* 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
+
+ IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) ||
+ EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
+ {
+ cldfb_in_flag = 1;
+ move16();
+ }
+
+ 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( EQ_16( cldfb_in_flag, 1 ) && ( EQ_16( st_ivas->hSplitBinRend->splitrend.multiBinPoseData.poseCorrectionMode, ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) ) )
+ {
+ IF( ( st_ivas->hSplitBinRend->hCldfbDataOut = (ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA_HANDLE) malloc( sizeof( ISAR_DEC_SPLIT_REND_CLDFB_OUT_DATA ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for cldfb data out buffer\n" ) );
+ }
+ }
+
+ mixed_td_cldfb_flag = 0;
+ move16();
+ IF( ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) && EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ||
+ ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) )
{
- isSplitRend = 1;
+ mixed_td_cldfb_flag = 1;
+ move16();
}
- return isSplitRend;
+ error = ISAR_PRE_REND_open( &st_ivas->hSplitBinRend->splitrend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hDecoderConfig->output_Fs, cldfb_in_flag, pcm_out_flag, st_ivas->hDecoderConfig->render_framesize, mixed_td_cldfb_flag );
+ move16();
+
+ return error;
}
@@ -4382,24 +5628,31 @@ int16_t IVAS_DEC_is_split_rendering_enabled(
*---------------------------------------------------------------------*/
Word16 IVAS_DEC_is_split_rendering_coded_out(
- IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */
+ IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */
+ int16_t *isSplitCoded /* o : flag to indicate if split rendering is enabled */
)
{
Decoder_Struct *st_ivas;
- Word16 isSplitCoded;
+ test();
IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL )
{
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
+
st_ivas = hIvasDec->st_ivas;
- isSplitCoded = 0;
+ *isSplitCoded = 0;
+ move16();
- IF( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
- ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->Opt_non_diegetic_pan && st_ivas->hRenderConfig->split_rend_config.dof == 0 ) )
+ test();
+ test();
+ test();
+ IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ||
+ ( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) && st_ivas->hDecoderConfig->Opt_non_diegetic_pan && st_ivas->hRenderConfig->split_rend_config.dof == 0 ) )
{
- isSplitCoded = 1;
+ *isSplitCoded = 1;
+ move16();
}
- return isSplitCoded;
+ return IVAS_ERR_OK;
}
diff --git a/lib_dec/pitch_extr_fx.c b/lib_dec/pitch_extr_fx.c
index 73e9623f5da99fc082caae28ff4ce9c12a27bd20..5cabc98b1009ce6c096943078c72b295235bceaf 100644
--- a/lib_dec/pitch_extr_fx.c
+++ b/lib_dec/pitch_extr_fx.c
@@ -157,7 +157,6 @@ void pitch_pred_linear_fit(
{
Word32 t1, t2, t3, t4, t5, t6, t7;
Word16 e1, e2, e3, e4, e5, e6, e7;
- Flag Overflow;
t1 = L_mult0( pg[4], pg[3] ); /*Q24*/ /* t1 = pg[4]*pg[3] */
e1 = 7;
move16();
@@ -180,8 +179,8 @@ void pitch_pred_linear_fit(
t6 = BASOP_Util_Add_Mant32Exp( t3, e3, t4, e4, &e6 );
t7 = BASOP_Util_Add_Mant32Exp( t5, e5, t6, e6, &e7 ); /*Q31,e7*/
sum0_q = norm_l( t7 );
- sum0 = round_fx_o( L_shl( t7, sum0_q ), &Overflow ); /*Q15,e7-sum0_q*/
- sum0_q = add( 15, sub( sum0_q, e7 ) ); /* sum0 is now Qsum0_q*/
+ sum0 = round_fx_sat( L_shl( t7, sum0_q ) ); /*Q15,e7-sum0_q*/
+ sum0_q = add( 15, sub( sum0_q, e7 ) ); /* sum0 is now Qsum0_q*/
}
pit = 0;
diff --git a/lib_dec/post_dec_fx.c b/lib_dec/post_dec_fx.c
index cbcb225bc1c845d937119028fb6fcc025a19cfeb..b593c99c57227b019d4d837b9dd5a82e70929298 100644
--- a/lib_dec/post_dec_fx.c
+++ b/lib_dec/post_dec_fx.c
@@ -606,10 +606,6 @@ void cldfb_synth_set_bandsToZero(
Word16 realQ1, imagQ1, flag, offset, WBcnt;
Word16 perc_detect, perc_miss;
Word16 i, k, tmp1, tmp2, tmp3, tmp, update_perc;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
realQ1 = 0;
@@ -656,8 +652,8 @@ void cldfb_synth_set_bandsToZero(
/* use 16-bit precision of real and imag buffers */
realQ1 = extract_l( L_shr( rAnalysis[k][i], sub( 31 + 3 - 15, scaleFactor.lb_scale ) ) ); /*31 - (15 + scaleFactor.lb_scale) + 3 )*/
imagQ1 = extract_l( L_shr( iAnalysis[k][i], sub( 31 + 3 - 15, scaleFactor.lb_scale ) ) ); /* Q(-3), headroom */
- nrgQ31 = L_mac0_o( nrgQ31, realQ1, realQ1, &Overflow );
- nrgQ31 = L_mac0_o( nrgQ31, imagQ1, imagQ1, &Overflow ); /* keep in Q(-6) */
+ nrgQ31 = L_mac0_sat( nrgQ31, realQ1, realQ1 );
+ nrgQ31 = L_mac0_sat( nrgQ31, imagQ1, imagQ1 ); /* keep in Q(-6) */
}
nrg_band[i] = ( nrgQ31 );
move16();
diff --git a/lib_dec/pvq_core_dec_fx.c b/lib_dec/pvq_core_dec_fx.c
index f9c2db757dffc1b7be48fdc5fb69d973b68c41d8..c507c134424edb72054d9510813c4169992a0748 100644
--- a/lib_dec/pvq_core_dec_fx.c
+++ b/lib_dec/pvq_core_dec_fx.c
@@ -477,12 +477,6 @@ static void densitySymbolIndexDecode_fx(
Word32 acc;
Word16 alpha = 0;
move16();
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
-#endif
IF( s_and( (Word16) 0xFFFE, density ) == 0 )
{
/* odd density exit */
@@ -494,11 +488,7 @@ static void densitySymbolIndexDecode_fx(
sym_freq = L_deposit_l( 1 );
angle = atan2_fx( SQRT_DIM_fx[opp_sz], SQRT_DIM_fx[near_sz] ); // Q13
-#ifdef ISSUE_1796_replace_shl_o
angle = shl_sat( angle, 1 );
-#else
- angle = shl_o( angle, 1, &Overflow );
-#endif
angle = mult_r( angle, 20861 );
c = mult_r( density, angle );
density_c = sub( density, c );
diff --git a/lib_dec/pvq_decode_fx.c b/lib_dec/pvq_decode_fx.c
index c9ed050a2c2c8f542636bc0822c76817e5e4975a..3bd3e12d1817d431a8b74f84105a5fe9da14963b 100644
--- a/lib_dec/pvq_decode_fx.c
+++ b/lib_dec/pvq_decode_fx.c
@@ -33,10 +33,6 @@ void pvq_decode_fx(
Word32 L_yy, L_isqrt, L_tmp;
UWord16 u16_tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
entry = get_size_mpvq_calc_offset_fx( dim, k_val, h_mem ); /* get size & prepare H(adaptive table for entry.size=N_MPVQ(dim,k_val) */
@@ -103,12 +99,8 @@ void pvq_decode_fx(
Mpy_32_16_ss( L_isqrt, shl( y[i], shift_num ), &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *2*/
Mpy_32_16_ss( L_tmp, neg_gain_norm, &L_tmp, &u16_tmp ); /* Q31*Q(0+x) *Q15 *2*/
-#ifdef ISSUE_1799_replace_L_shr_o
L_tmp = L_shr_sat( L_tmp, shift_tot );
-#else
- L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow );
-#endif
- xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15 , array move */
+ xq[i] = round_fx_sat( L_tmp ); /* Q15 , array move */
move16();
}
}
diff --git a/lib_dec/range_dec_fx.c b/lib_dec/range_dec_fx.c
index 7f62e0dd351583588e04b0e65efa6bcbefa3354c..e63435f5b5a96163243d3ca186d01c25f123c0f6 100644
--- a/lib_dec/range_dec_fx.c
+++ b/lib_dec/range_dec_fx.c
@@ -147,16 +147,16 @@ Word32 rc_dec_bits_fx( /* i : Decoded value */
{
hPVQ->rc_offset = sub( hPVQ->rc_offset, sub( bits, 16 ) );
move16();
- value = UL_lshl( UL_deposit_l( get_indice( st_fx, hPVQ->rc_offset, sub( bits, 16 ) ) ), 16 );
+ value = UL_lshl( UL_deposit_l( get_indice_fx( st_fx, hPVQ->rc_offset, sub( bits, 16 ) ) ), 16 );
hPVQ->rc_offset = sub( hPVQ->rc_offset, 16 );
move16();
- value = UL_or( value, UL_deposit_l( get_indice( st_fx, hPVQ->rc_offset, 16 ) ) );
+ value = UL_or( value, UL_deposit_l( get_indice_fx( st_fx, hPVQ->rc_offset, 16 ) ) );
}
ELSE
{
hPVQ->rc_offset = sub( hPVQ->rc_offset, bits );
move16();
- value = UL_deposit_l( get_indice( st_fx, hPVQ->rc_offset, bits ) );
+ value = UL_deposit_l( get_indice_fx( st_fx, hPVQ->rc_offset, bits ) );
}
return value;
diff --git a/lib_dec/rom_dec.h b/lib_dec/rom_dec.h
index 8c1021682a5494198dc376249596b674a7041475..0d1c8d4f5d2a301d175a982aae197a51005a20c8 100644
--- a/lib_dec/rom_dec.h
+++ b/lib_dec/rom_dec.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef ROM_DEC_H
diff --git a/lib_dec/rom_dec_fx.c b/lib_dec/rom_dec_fx.c
index 3f5243286c21707d6fc854775d9f0830af13d6b6..f5c0e4794845db03e52d35730b72c993e476a740 100644
--- a/lib_dec/rom_dec_fx.c
+++ b/lib_dec/rom_dec_fx.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h
index 3015b85e4a9b2386a20501e468a11d2c6597ccc9..a1e9af4289e4a1ffd656cb8e22540421ec65da85 100644
--- a/lib_dec/stat_dec.h
+++ b/lib_dec/stat_dec.h
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#ifndef STAT_DEC_H
@@ -704,11 +704,7 @@ typedef struct hq_dec_structure
Word16 exp_old_out;
Word16 old_out_LB_fx[L_FRAME32k]; /* HQ core - previous synthesis for OLA for Low Band. Q_old_wtda_LB */
Word32 old_out_LB_fx32[L_FRAME32k];
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
Word16 Q_old_out_fx32; /* Q for both old_out_fx32 and old_out_LB_fx32 */
-#else
- Word16 q_old_outLB_fx;
-#endif
Word16 Q_old_wtda_LB;
Word16 Q_old_wtda;
Word16 Q_old_postdec; /*scaling of the output of core_switching_post_dec_fx() */
@@ -1314,6 +1310,9 @@ typedef struct Decoder_State
Word16 Q_syn;
Word16 Q_syn2;
Word16 Q_syn_cng;
+#ifdef FIX_2003_CON_TCX_OVERFLOW
+ Word16 Q_syn_factor; // This q_factor is used to avoid using fixed Q0 for synth[] at the output of con_tcx_ivas_fx(). It is then used for two consecutive TCX concealment processes. It cannot be greater than 0.
+#endif
Word16 prev_Q_syn;
Word16 prev_Q_bwe_exc;
diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c
index 09f5eda03dd1dc8c9749aed10a34c460acd378b1..c3291bde24f95ec52e5fe52d111b5e27d64af6b0 100644
--- a/lib_dec/swb_tbe_dec_fx.c
+++ b/lib_dec/swb_tbe_dec_fx.c
@@ -634,10 +634,6 @@ void ivas_wb_tbe_dec_fx(
Word32 dummy2[HILBERT_MEM_SIZE];
Word16 f, inc;
Word64 W_tmp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
TD_BWE_DEC_HANDLE hBWE_TD;
hBWE_TD = st_fx->hBWE_TD;
set32_fx( &dummy2[0], 0, HILBERT_MEM_SIZE );
@@ -962,11 +958,7 @@ void ivas_wb_tbe_dec_fx(
n = norm_s( max );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/
-#else
- shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/
-#endif
move16();
}
n = sub( 14, n );
@@ -974,8 +966,8 @@ void ivas_wb_tbe_dec_fx(
move32();
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
- L_tmp = L_mult_o( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i], &Overflow ); /*Q29*/
- curr_frame_pow = L_add_o( curr_frame_pow, L_shr( L_tmp, 7 ), &Overflow ); /*Q22*/
+ L_tmp = L_mult_sat( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i] ); /*Q29*/
+ curr_frame_pow = L_add_sat( curr_frame_pow, L_shr( L_tmp, 7 ) ); /*Q22*/
}
}
curr_frame_pow_exp = add( n, n );
@@ -1169,7 +1161,7 @@ void ivas_wb_tbe_dec_fx(
L_tmp = Mult_32_16( Lacc, 102 ); /* Q22 */
exp = norm_l( L_tmp );
- tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow );
+ tmp = round_fx_sat( L_shl( L_tmp, exp ) );
exp = sub( add( exp, 22 ), 30 );
tmp = div_s( 16384, tmp );
L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /* Q(31-exp) */
@@ -1285,10 +1277,6 @@ void wb_tbe_dec_fx(
move16();
Word32 dummy2[HILBERT_MEM_SIZE];
Word16 f, inc;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
TD_BWE_DEC_HANDLE hBWE_TD;
hBWE_TD = st_fx->hBWE_TD;
set32_fx( &dummy2[0], 0, HILBERT_MEM_SIZE );
@@ -1609,11 +1597,7 @@ void wb_tbe_dec_fx(
n = norm_s( max );
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
shaped_wb_excitation_frac[i] = shl_sat( shaped_wb_excitation[i], n ); /*Q14*/
-#else
- shaped_wb_excitation_frac[i] = shl_o( shaped_wb_excitation[i], n, &Overflow ); /*Q14*/
-#endif
move16();
}
n = sub( 14, n );
@@ -1621,8 +1605,8 @@ void wb_tbe_dec_fx(
move32();
FOR( i = 0; i < L_FRAME16k / 4; i++ )
{
- L_tmp = L_mult_o( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i], &Overflow ); /*Q29*/
- curr_frame_pow = L_add_o( curr_frame_pow, L_shr( L_tmp, 7 ), &Overflow ); /*Q22*/
+ L_tmp = L_mult_sat( shaped_wb_excitation_frac[i], shaped_wb_excitation_frac[i] ); /*Q29*/
+ curr_frame_pow = L_add_sat( curr_frame_pow, L_shr( L_tmp, 7 ) ); /*Q22*/
}
}
curr_frame_pow_exp = add( n, n );
@@ -1818,7 +1802,7 @@ void wb_tbe_dec_fx(
L_tmp = Mult_32_16( Lacc, 102 ); /* Q22 */
exp = norm_l( L_tmp );
- tmp = round_fx_o( L_shl_o( L_tmp, exp, &Overflow ), &Overflow );
+ tmp = round_fx_sat( L_shl( L_tmp, exp ) );
exp = sub( add( exp, 22 ), 30 );
tmp = div_s( 16384, tmp );
L_tmp = Isqrt_lc( L_deposit_h( tmp ), &exp ); /* Q(31-exp) */
@@ -2721,8 +2705,12 @@ void swb_tbe_dec_fx(
FOR( i = 0; i < L_SHB_LAHEAD; i++ )
{
- L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */
- shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
+ L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */
+#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE
+ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
+#else
+ shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
+#endif
move16();
}
IF( exp < 0 )
@@ -2743,8 +2731,12 @@ void swb_tbe_dec_fx(
L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */
temp = sub( 32767 /*1.0f Q15*/, temp );
Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 );
- L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */
+ L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */
+#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE
+ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
+#else
shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
+#endif
move16();
}
}
@@ -2756,8 +2748,12 @@ void swb_tbe_dec_fx(
L_tmp1 = Mult_32_16( L_shl_sat( 1, sub( 31, exp ) ), temp ); /* Q31-exp */
temp = sub( 32767 /*1.0f Q15*/, temp );
Lscale = L_add( Mult_32_16( Lscale, temp ), L_tmp1 );
- L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */
+ L_tmp = Mult_32_16( Lscale, shaped_shb_excitation[i] ); /* Q_bwe_exc + (31-exp) - 15 */
+#ifdef FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE
+ shaped_shb_excitation[i] = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q_bwe_exc */
+#else
shaped_shb_excitation[i] = round_fx( L_shl( L_tmp, exp ) ); /* Q_bwe_exc */
+#endif
move16();
}
}
diff --git a/lib_dec/syn_outp_fx.c b/lib_dec/syn_outp_fx.c
index 95b98e8548b69d2c5f854bf40c1215f6bb2257ce..96ee58142430e2790f438dd817847e3566efc94f 100644
--- a/lib_dec/syn_outp_fx.c
+++ b/lib_dec/syn_outp_fx.c
@@ -67,12 +67,6 @@ void unscale_AGC(
{
Word16 i, fac, tmp, frame_fac, max_val;
Word32 L_tmp;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
/*----------------------------------------------------------------*
* calculate AGC factor to avoid saturation
@@ -84,11 +78,7 @@ void unscale_AGC(
max_val = s_max( max_val, abs_s( x[i] ) );
}
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( 30000, Qx ); /* saturation can occur here */
-#else
- tmp = shl_o( 30000, Qx, &Overflow ); /* saturation can occur here */
-#endif
BASOP_SATURATE_WARNING_ON_EVS
frame_fac = 0;
move16();
diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c
index 16d445b9161bffc043c4cec8108369159970cae2..82f741e5626ba2869dd18354962b597ff0c9842d 100644
--- a/lib_dec/tonalMDCTconcealment_fx.c
+++ b/lib_dec/tonalMDCTconcealment_fx.c
@@ -724,10 +724,6 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx(
Word16 invScaleFactors[FDNS_NPTS];
Word16 invScaleFactors_exp[FDNS_NPTS];
Word16 powerSpectrum_exp, tmp_exp, old_exp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
Word16 nBands;
Word32 invScaleFactors_fx[FDNS_NPTS];
@@ -857,7 +853,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx(
/* 16 bits are now enough for storing the power spectrum */
FOR( i = 0; i < nSamples; i++ )
{
- hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_o( powerSpectrum[i], &Overflow ); // Q31 - powerSpectrum_exp
+ hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_sat( powerSpectrum[i] ); // Q31 - powerSpectrum_exp
move32();
}
@@ -882,10 +878,6 @@ static void CalcPowerSpecAndDetectTonalComponents(
Word16 invScaleFactors[FDNS_NPTS];
Word16 invScaleFactors_exp[FDNS_NPTS];
Word16 powerSpectrum_exp, tmp_exp, old_exp;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
nSamples = hTonalMDCTConc->nNonZeroSamples;
@@ -975,7 +967,7 @@ static void CalcPowerSpecAndDetectTonalComponents(
/* 16 bits are now enough for storing the power spectrum */
FOR( i = 0; i < nSamples; i++ )
{
- hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_o( powerSpectrum[i], &Overflow ); // Q31-powerSpectrum_exp
+ hTonalMDCTConc->secondLastPowerSpectrum[i] = round_fx_sat( powerSpectrum[i] ); // Q31-powerSpectrum_exp
move32();
}
@@ -1314,8 +1306,11 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
{
Word16 i, l, ld, fac;
Word16 rnd;
-
+#ifdef FIX_1944_CRASH_FOR_STEREO
+ Word16 tmp, g, tilt, exp_last, exp_noise, tiltFactor, crossfadeGain, e_crossfadeGain, scaleFactor;
+#else
Word16 tmp, g, tilt, exp_last, exp_noise, tiltFactor, crossfadeGain, e_crossfadeGain;
+#endif
Word32 L_tmp, L_tmp1, L_tmp2, nrgNoiseInLastFrame, nrgWhiteNoise;
Word16 inv_exp, inv_samples, exp;
Word32 last_block_nrg_correct;
@@ -1493,9 +1488,10 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
}
mdctSpectrum[i] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp
move32();
-
+#ifndef FIX_1944_CRASH_FOR_STEREO
hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[i], mdctSpectrum[i] ) ); // Q31- faded_signal_nrg_exp
move32();
+#endif
}
FOR( i = crossOverFreq; i < hTonalMDCTConc->lastBlockData.nSamples; i++ )
{
@@ -1504,7 +1500,28 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
}
*mdctSpectrum_exp = sub( add( e_crossfadeGain, hTonalMDCTConc->lastBlockData.spectralData_exp ), exp );
move16();
+#ifdef FIX_1944_CRASH_FOR_STEREO
+ scaleFactor = getScaleFactor32( mdctSpectrum, crossOverFreq );
+ IF( scaleFactor > 8 )
+ {
+ scaleFactor = sub( scaleFactor, 8 ); // add headroom
+ }
+ ELSE
+ {
+ scaleFactor = 0;
+ move16();
+ }
+
+ FOR( i = 0; i < crossOverFreq; i++ )
+ {
+ Word32 mdctSpectrumScaled = L_shl( mdctSpectrum[i], scaleFactor );
+ hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrumScaled, mdctSpectrumScaled ) );
+ }
+ move32();
+ hTonalMDCTConc->faded_signal_nrg_exp = shl( sub( *mdctSpectrum_exp, scaleFactor ), 1 );
+#else
hTonalMDCTConc->faded_signal_nrg_exp = shl( *mdctSpectrum_exp, 1 );
+#endif
move16();
}
}
@@ -1668,9 +1685,10 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
}
mdctSpectrum[l] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp
move32();
-
+#ifndef FIX_1944_CRASH_FOR_STEREO
hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[l], mdctSpectrum[l] ) ); // Q31 - 2*mdctSpectrum_exp
move32();
+#endif
}
FOR( i = 1; i < hTonalMDCTConc->pTCI->numIndexes; i++ )
@@ -1690,8 +1708,9 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
}
mdctSpectrum[l] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp
move32();
-
+#ifndef FIX_1944_CRASH_FOR_STEREO
hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[l], mdctSpectrum[l] ) ); // Q31- 2*mdctSpectrum_exp
+#endif
}
}
@@ -1710,9 +1729,10 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
}
mdctSpectrum[l] = L_shl( L_tmp2, exp ); // Q15 - e_crossfadeGain + Q15 - spectralData_exp + exp
move32();
-
+#ifndef FIX_1944_CRASH_FOR_STEREO
hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrum[l], mdctSpectrum[l] ) ); // Q31- 2*mdctSpectrum_exp
move32();
+#endif
}
FOR( l = crossOverFreq; l < hTonalMDCTConc->lastBlockData.nSamples; l++ )
@@ -1720,8 +1740,28 @@ void TonalMDCTConceal_InsertNoise_ivas_fx(
mdctSpectrum[l] = L_deposit_h( 0 );
move32();
}
+#ifdef FIX_1944_CRASH_FOR_STEREO
+ scaleFactor = getScaleFactor32( mdctSpectrum, crossOverFreq );
+ IF( scaleFactor > 8 )
+ {
+ scaleFactor = sub( scaleFactor, 8 ); // add headroom
+ }
+ ELSE
+ {
+ scaleFactor = 0;
+ move16();
+ }
+ FOR( i = 0; i < crossOverFreq; i++ )
+ {
+ Word32 mdctSpectrumScaled = L_shl( mdctSpectrum[i], scaleFactor );
+ hTonalMDCTConc->faded_signal_nrg = L_add( hTonalMDCTConc->faded_signal_nrg, Mpy_32_32( mdctSpectrumScaled, mdctSpectrumScaled ) );
+ }
+ move32();
+ hTonalMDCTConc->faded_signal_nrg_exp = shl( sub( *mdctSpectrum_exp, scaleFactor ), 1 );
+#else
hTonalMDCTConc->faded_signal_nrg_exp = shl( *mdctSpectrum_exp, 1 );
+#endif
move16();
}
}
diff --git a/lib_dec/transition_dec_fx.c b/lib_dec/transition_dec_fx.c
index 102a81b9d25868024baec7bb8b0019127d3037c5..00d70785d74a4746fe648ac8c0477c447ff97693 100644
--- a/lib_dec/transition_dec_fx.c
+++ b/lib_dec/transition_dec_fx.c
@@ -676,10 +676,6 @@ static void tc_dec_fx(
Word16 j, sc;
Word16 tempS;
Word16 index;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
/*----------------------------------------------------------------*
* find the number of bits
*----------------------------------------------------------------*/
@@ -829,7 +825,7 @@ static void tc_dec_fx(
j = s_min( L_SUBFR, add( imp_pos, L_IMPULSE2 ) );
FOR( ; i <= j; i++ )
{
- exc[i + i_subfr] = round_fx_o( L_shl_o( L_mult_o( pt_shape[i], gain_trans, &Overflow ), sc, &Overflow ), &Overflow ); /* (Qx * Q14 ) */
+ exc[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult_sat( pt_shape[i], gain_trans ), sc ) ); /* (Qx * Q14 ) */
move16();
}
FOR( ; i < L_SUBFR; i++ )
diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c
index d1fe01b4290a9243e01b799fd041880386c4fb30..8704c2e078953ece7244675baad1c1e9af417161 100644
--- a/lib_dec/updt_dec_fx.c
+++ b/lib_dec/updt_dec_fx.c
@@ -1207,10 +1207,8 @@ void update_decoder_LPD_cng(
Copy( hTcxDec->old_synth + st->L_frame, hTcxDec->old_synth, sub( hTcxDec->old_synth_len, st->L_frame ) );
Copy( synth, hTcxDec->old_synth + sub( hTcxDec->old_synth_len, st->L_frame ), st->L_frame );
bufferCopyFx( synth + sub( st->L_frame, ( st->L_frame / 2 ) ), hTcxDec->old_syn_Overl, st->L_frame / 2, 0 /*Qf_syn*/, -1 /*Qf_old_xnq*/, 0, 0 /*Q_old_xnq*/ );
-#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
st->hTcxDec->Q_old_syn_Overl = sub( st->Q_syn, 1 );
move16();
-#endif
hTcxDec->tcxltp_last_gain_unmodified = 0;
move16();
diff --git a/lib_enc/FEC_enc_fx.c b/lib_enc/FEC_enc_fx.c
index 69b14eb9b65dcbc5422bd658464249a3967b882b..1a813b46205712a942ef65958c6e2c14d19e5e4f 100644
--- a/lib_enc/FEC_enc_fx.c
+++ b/lib_enc/FEC_enc_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-//#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
@@ -30,13 +29,14 @@
/*----------------------------------------------------------------------------*/
/* INPUT/OUTPUT ARGUMENTS : */
/* Word16 *last_pulse_pos i/o: Position of the last pulse */
-/* Encoder_State *st_fx i/o: state structure */
+/* Encoder_State *st_fx i/o: state structure */
/*----------------------------------------------------------------------------*/
/* RETURN ARGUMENTS : */
/* _ None */
/*----------------------------------------------------------------------------*/
/* */
/*============================================================================*/
+
void FEC_encode_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const ACELP_config acelp_cfg, /* i/o: configuration of the ACELP */
diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c
index c97fdce831893f05b9da001185d7b6cc6ca99bff..75df71db44e1a1b2517708c65c1a57f0e92bc2ea 100644
--- a/lib_enc/acelp_core_enc_fx.c
+++ b/lib_enc/acelp_core_enc_fx.c
@@ -10,7 +10,6 @@
#include "stat_enc.h"
#include "rom_com.h"
#include "rom_enc.h" /* Encoder static table prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "ivas_cnst.h"
#include "ivas_prot_fx.h"
@@ -391,14 +390,7 @@ ivas_error acelp_core_enc_fx(
test();
IF( !nelp_mode && !ppp_mode )
{
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-#else
- config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate,
- st_fx->L_frame, st_fx->GSC_noisy_speech, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag,
- tc_subfr_fx, 0, &nb_bits, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx,
- tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-#endif
}
/*-----------------------------------------------------------------*
@@ -463,14 +455,7 @@ ivas_error acelp_core_enc_fx(
{
tc_classif_enc_fx( Q_new, st_fx->L_frame, &tc_subfr_fx, &position, attack_flag, st_fx->pitch[0], res_fx );
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-
-#else
- config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame,
- -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr_fx, 1, NULL, unbits_fx, st_fx->element_mode, &uc_two_stage_flag,
- tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-#endif
}
/*---------------------------------------------------------------*
@@ -522,13 +507,7 @@ ivas_error acelp_core_enc_fx(
lsp_mid_bck_fx, mCb1_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen_fx );
/* Configure ACELP bit allocation */
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0, st_fx->idchan, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-#else
- config_acelp1_fx( ENC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl, st_fx->extl_brate, st_fx->L_frame,
- -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, st_fx->coder_type, st_fx->inactive_coder_type_flag, tc_subfr_fx, 0, &nb_bits, unbits_fx, 0, &uc_two_stage_flag, 0, 0,
- st_fx->idchan, st_fx->active_fr_cnt_fx, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode );
-#endif
/* redo LSF quantization */
lsf_enc_fx( st_fx, lsf_new_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, st_fx->Nb_ACELP_frames, tdm_low_rate_mode, st_fx->GSC_IVAS_mode, Q_new );
@@ -1186,11 +1165,7 @@ ivas_error acelp_core_enc_ivas_fx(
test();
IF( !nelp_mode && !ppp_mode )
{
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#else
- config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#endif
}
/*-----------------------------------------------------------------*
@@ -1238,21 +1213,14 @@ ivas_error acelp_core_enc_ivas_fx(
ELSE
{
const Word16 *pt_interp_2_fx;
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- IF( NE_16( st->active_cnt, 1 ) )
- {
-#endif
- Word16 beta_index;
- Word16 lsf_wgts_fx[M];
-
- /* intra_frame prediction for the LSFs */
- lsp2lsf_fx( lsp_new, lsf_new_fx, M, 12800 );
- Unified_weighting_fx( &st->Bin_E_fx[L_FFT / 2], add( Q_new, ( QSCALE - 2 ) ), lsf_new_fx, lsf_wgts_fx, st->bwidth == NB, (Word16) EQ_16( st->coder_type, UNVOICED ), st->sr_core, M );
- tdm_SCh_lsf_reuse_fx( ENC, st->element_brate, lsf_new_fx, lsp_new, tdm_lsfQ_PCh, lsf_wgts_fx, &beta_index );
- push_indice( hBstr, IND_IC_LSF_PRED, beta_index, TDM_IC_LSF_PRED_BITS );
-#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
- }
-#endif
+ Word16 beta_index;
+ Word16 lsf_wgts_fx[M];
+
+ /* intra_frame prediction for the LSFs */
+ lsp2lsf_fx( lsp_new, lsf_new_fx, M, 12800 );
+ Unified_weighting_fx( &st->Bin_E_fx[L_FFT / 2], add( Q_new, ( QSCALE - 2 ) ), lsf_new_fx, lsf_wgts_fx, st->bwidth == NB, (Word16) EQ_16( st->coder_type, UNVOICED ), st->sr_core, M );
+ tdm_SCh_lsf_reuse_fx( ENC, st->element_brate, lsf_new_fx, lsp_new, tdm_lsfQ_PCh, lsf_wgts_fx, &beta_index );
+ push_indice( hBstr, IND_IC_LSF_PRED, beta_index, TDM_IC_LSF_PRED_BITS );
pt_interp_2_fx = interpol_frac_12k8_fx;
@@ -1327,11 +1295,7 @@ ivas_error acelp_core_enc_ivas_fx(
{
tc_classif_enc_fx( Q_new, st->L_frame, &tc_subfr, &position, attack_flag, st->pitch[0], res_fx );
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#else
- config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, TRANSITION, -1, tc_subfr, 1, NULL, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#endif
}
/*---------------------------------------------------------------*
@@ -1390,11 +1354,7 @@ ivas_error acelp_core_enc_ivas_fx(
lsf_syn_mem_restore_ivas_fx( st, tilt_code_bck_fx, gc_threshold_bck_fx, clip_var_bck_fx, next_force_sf_bck, lsp_new, lsp_mid, clip_var_fx, mem_AR_fx, mem_MA_fx, lsp_new_bck_fx, lsp_mid_bck_fx, Bin_E_fx, Bin_E_old_fx, mem_syn_bck_fx, mem_w0_bck_fx, streaklimit_fx, pstreaklen );
/* Configure ACELP bit allocation */
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#else
- config_acelp1_fx( ENC, st->total_brate, st->core_brate, st->core, st->extl, st->extl_brate, st->L_frame, -1, &( st->acelp_cfg ), hBstr->nb_bits_tot, st->coder_type, st->inactive_coder_type_flag, tc_subfr, 0, &nb_bits, unbits, 0, &uc_two_stage_flag, 0, 0, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode );
-#endif
/* redo LSF quantization */
lsf_enc_ivas_fx( st, lsf_new_fx, lsp_new, lsp_mid, Aq, tdm_low_rate_mode, 0, NULL, Q_new );
diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c
index 2f2efef0fba2ef8f003b085baaa1f2b5d400756d..12af87d7cddb4d031d8dfd03ab169728ba815f6e 100644
--- a/lib_enc/acelp_core_switch_enc_fx.c
+++ b/lib_enc/acelp_core_switch_enc_fx.c
@@ -5,12 +5,12 @@
#include
#include "options.h"
#include "cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
+
/*---------------------------------------------------------------------*
* Local function prototypes
*---------------------------------------------------------------------*/
@@ -134,13 +134,8 @@ void acelp_core_switch_enc_fx(
* Excitation encoding
*----------------------------------------------------------------*/
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot,
GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
-#else
- config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot,
- GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
-#endif
encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new );
@@ -249,12 +244,7 @@ void acelp_core_switch_enc_ivas_fx(
* Excitation encoding
*----------------------------------------------------------------*/
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot, GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
-#else
- config_acelp1_fx( ENC, st_fx->total_brate, cbrate, st_fx->core, -1, -1, st_fx->last_L_frame, -1, &( st_fx->acelp_cfg ), hBstr->nb_bits_tot,
- GENERIC, st_fx->inactive_coder_type_flag, -1, -1, &j, &i, st_fx->element_mode, &i /*dummy*/, 0 /*tdm_lp_reuse_flag*/, 0 /*tdm_low_rate_mode*/, st_fx->idchan, st_fx->active_fr_cnt_fx, 0 /*tdm_Pitch_reuse_flag*/, 0, 0 /*GSC_IVAS_mode*/ );
-#endif
encod_gen_voic_core_switch_ivas_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new );
@@ -410,9 +400,9 @@ static void encod_gen_voic_core_switch_fx(
* Close-loop pitch search and quantization
* Adaptive exc. construction
*----------------------------------------------------------------*/
- set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */
- pitch = pit_encode_fx( hBstr,
- st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/ ); /* Q6 */
+
+ set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */
+ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */
/*-----------------------------------------------------------------*
* Find adaptive exitation
@@ -617,10 +607,9 @@ static void encod_gen_voic_core_switch_ivas_fx(
* Close-loop pitch search and quantization
* Adaptive exc. construction
*----------------------------------------------------------------*/
- set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */
- pitch = pit_encode_ivas_fx( hBstr,
- st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, Q_new ); /* Q6 */
+ set16_fx( dummyF, -1, NB_SUBFR16k ); /* hack to signal ACELP->HQ switching frame */
+ pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, core_bitrate, 0, L_frame, GENERIC, &pitch_limit_flag, 0, exc, L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, dummyF /*hStereoTD->tdm_Pri_pitch_buf*/, st_fx->element_mode, Q_new ); /* Q6 */
/*-----------------------------------------------------------------*
* Find adaptive exitation
@@ -638,10 +627,9 @@ static void encod_gen_voic_core_switch_ivas_fx(
/*-----------------------------------------------------------------*
* LP filtering of the adaptive excitation, codebook target computation
*-----------------------------------------------------------------*/
- lp_flag = st_fx->acelp_cfg.ltf_mode; /* Q0 */
- Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14+shift*/
- lp_select = lp_filt_exc_enc_ivas_fx( MODE1, GENERIC, 0, exc, h1, xn, y1, xn2, L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */
-
+ lp_flag = st_fx->acelp_cfg.ltf_mode; /* Q0 */
+ Scale_sig( h1, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14+shift*/
+ lp_select = lp_filt_exc_enc_fx( MODE1, GENERIC, 0, exc, h1, xn, y1, xn2, L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */
IF( EQ_16( lp_flag, NORMAL_OPERATION ) )
{
push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 );
@@ -659,15 +647,14 @@ static void encod_gen_voic_core_switch_ivas_fx(
*-----------------------------------------------------------------*/
IF( EQ_16( L_frame, L_FRAME ) )
{
- gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx,
- &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
+ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx,
+ &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
}
ELSE
{
- gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx,
- &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
+ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, 0, -1, xn, y1, shift_wsp, y2, code, st_fx->old_Es_pred_fx,
+ &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
}
-
gp_clip_test_gain_pit_fx( st_fx->element_mode, core_bitrate, gain_pit, st_fx->clip_var_fx );
Lgcode = L_shl( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/
@@ -713,7 +700,6 @@ static void encod_gen_voic_core_switch_ivas_fx(
return;
}
-
/*-------------------------------------------------------------------*
* bwe_switch_enc()
*
@@ -740,9 +726,11 @@ static void bwe_switch_enc_fx(
Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */
Word16 n, L;
BSTR_ENC_HANDLE hBstr;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
hBstr = st_fx->hBstr;
L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS );
@@ -859,7 +847,11 @@ static void bwe_switch_enc_fx(
L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */
q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */
L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) );
- gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */
+#else
+ gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */
+#endif
ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); /* Q0 */
push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 );
@@ -886,9 +878,11 @@ static void bwe_switch_enc_ivas_fx(
Word16 synth_subfr_bwe_fx[SWITCH_MAX_GAP]; /* synthesized bwe for core switching */
Word16 n, L;
BSTR_ENC_HANDLE hBstr;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
hBstr = st_fx->hBstr;
L = NS2SA_FX2( st_fx->input_Fs, FRAME_SIZE_NS );
@@ -1002,7 +996,11 @@ static void bwe_switch_enc_ivas_fx(
L_tmp1 = L_mult( tmp, E2_fx ); /*30-q_tmp1+q_tmp2 */
q_tmp2 = sub( q_tmp1, q_tmp2 ); /*30-q_tmp2 */
L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gain_fx = round_fx_sat( Isqrt( L_tmp1 ) ); /*Q12 */
+#else
gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */
+#endif
ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) );
push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 );
diff --git a/lib_enc/acelp_enc_util_fx.c b/lib_enc/acelp_enc_util_fx.c
index 7f57b55da9f685b3d5800308105bf66c623742fe..8787c46c87c3762f0f95217f11af3bdd63017130 100644
--- a/lib_enc/acelp_enc_util_fx.c
+++ b/lib_enc/acelp_enc_util_fx.c
@@ -13,7 +13,6 @@
#include "prot_fx_enc.h" /* Function prototypes */
#include "stat_enc.h"
#include "rom_com.h"
-#include "rom_com_fx.h"
#include "rom_enc.h"
@@ -161,8 +160,10 @@ void E_ACELP_conv(
{
Word16 i, k;
Word32 L_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
FOR( k = 0; k < L_SUBFR; k++ )
{
@@ -174,8 +175,12 @@ void E_ACELP_conv(
/*cn2[k]-=cn2[i]*h2[k-i];*/
L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*h2 4Q11*/
}
- L_tmp = W_sat_l( L_tmp_64 ); /* 4Q11 */
+ L_tmp = W_sat_l( L_tmp_64 ); /* 4Q11 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Q0 */
+#else
cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Q0 */
+#endif
}
}
@@ -187,8 +192,10 @@ void E_ACELP_conv_ivas_fx(
{
Word16 i, k;
Word32 L_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
FOR( k = 0; k < L_SUBFR; k++ )
{
@@ -200,8 +207,12 @@ void E_ACELP_conv_ivas_fx(
/*cn2[k]-=cn2[i]*h2[k-i];*/
L_tmp_64 = W_msu0_16_16( L_tmp_64, cn2[i], h2[k - i] ); /*Qnew + 11*/
}
- L_tmp = W_sat_l( L_tmp_64 ); /* Qnew + 11 */
+ L_tmp = W_sat_l( L_tmp_64 ); /* Qnew + 11 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cn2[k] = round_fx_sat( L_shl_sat( L_tmp, 5 ) ); /* Qnew*/
+#else
cn2[k] = round_fx_o( L_shl_o( L_tmp, 5, &Overflow ), &Overflow ); /* Qnew*/
+#endif
move16();
}
}
diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c
index 1580a78186f071f46a99e4bdb4e5154f1d1f9fa3..76c9930b68d67bb4fe9b5130ed14fee450a07a22 100644
--- a/lib_enc/amr_wb_enc_fx.c
+++ b/lib_enc/amr_wb_enc_fx.c
@@ -3,11 +3,9 @@
====================================================================================*/
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "rom_enc.h" /* Encoder static table prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
-//#include "prot_fx.h" /* Function prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "rom_enc.h" /* Encoder static table prototypes */
#include "basop_util.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
diff --git a/lib_enc/analy_lp_fx.c b/lib_enc/analy_lp_fx.c
index 9b6ff2108359dcb6242fd83232ab5972e2236e01..def862b8487fc0a4113e962ec36c919bb9299a1a 100644
--- a/lib_enc/analy_lp_fx.c
+++ b/lib_enc/analy_lp_fx.c
@@ -5,12 +5,12 @@
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "rom_enc.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* analy_lp_fx()
*
diff --git a/lib_enc/analy_sp_fx.c b/lib_enc/analy_sp_fx.c
index 8618c8fd7db15d8551c88b06eba9c3541e2668de..666d7865c8c7326d1a5c076690f59354cb12da24 100644
--- a/lib_enc/analy_sp_fx.c
+++ b/lib_enc/analy_sp_fx.c
@@ -719,9 +719,7 @@ static void ivas_find_enr(
Word32 min_ener;
Word16 shift = 0;
move16();
-#ifdef OPT_MCT_ENC_V3_BE
Word16 tmp_shift;
-#endif
ptR = &data[1]; /* first real */
ptI = &data[L_FFT - 1]; /* first imaginary */
@@ -751,20 +749,14 @@ static void ivas_find_enr(
freq = BIN_FREQ_FX;
move16();
-#ifdef OPT_MCT_ENC_V3_BE
- tmp_shift = sub( -Q16, shift ); // 16 - shift - 32
-#endif
+ tmp_shift = sub( -Q16, shift ); // 16 - shift - 32
FOR( i = 0; i < voic_band; i++ ) /* up to maximum allowed voiced critical band */
{
band_ener = 0;
move64();
start_freq = freq;
move16();
-#ifdef OPT_MCT_ENC_V3_BE
FOR( ; LE_32( freq, crit_bands_fx[i] ); )
-#else
- WHILE( LE_32( freq, crit_bands_fx[i] ) )
-#endif
{
/*
*ptE = *ptR * *ptR + *ptI * *ptI;
@@ -797,11 +789,7 @@ static void ivas_find_enr(
freq = add( freq, BIN_FREQ_FX );
}
-#ifdef OPT_MCT_ENC_V3_BE
band[i] = W_shl_sat_l( band_ener, tmp_shift ); // *q_band
-#else
- band[i] = W_extract_h( W_shl( band_ener, sub( Q16, shift ) ) ); // *q_band
-#endif
move32();
band_energies[i] = band[i]; /* per band energy without E_MIN */ // *q_band
@@ -826,11 +814,7 @@ static void ivas_find_enr(
move64();
start_freq = freq;
move16();
-#ifdef OPT_MCT_ENC_V3_BE
FOR( ; LE_32( freq, crit_bands_fx[i] ); )
-#else
- WHILE( LE_32( freq, crit_bands_fx[i] ) )
-#endif
{
/*
*Bin_E = *ptR * *ptR + *ptI * *ptI;
@@ -861,11 +845,7 @@ static void ivas_find_enr(
freq = add( freq, BIN_FREQ_FX );
}
-#ifdef OPT_MCT_ENC_V3_BE
band[i] = W_shl_sat_l( band_ener, tmp_shift ); // *q_band
-#else
- band[i] = W_extract_h( W_shl_nosat( band_ener, sub( Q16, shift ) ) ); // *q_band
-#endif
move32();
band_energies[i] = band[i]; /* per band energy without E_MIN */ // *q_band
@@ -918,10 +898,12 @@ static void find_enr(
Word32 etot;
Word16 exp_etot;
Word32 *tmpptr;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
ptR = &data[1]; /* first real */
@@ -968,9 +950,13 @@ static void find_enr(
/* *ptE *= 4.0 / (L_FFT*L_FFT) */
/* normalization - corresponds to FFT normalization by 2/L_FFT */
- BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */
- *ptE = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE - 2 */
- move32(); /* scaled by Q_new + QSCALE - 2 */
+ BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *ptE = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE - 2 */
+#else
+ *ptE = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE - 2 */
+#endif
+ move32(); /* scaled by Q_new + QSCALE - 2 */
BASOP_SATURATE_WARNING_ON_EVS;
/*band[i] += *ptE++;*/
*Bin_E = *ptE;
@@ -994,9 +980,13 @@ static void find_enr(
exp_band = sub( exp_band, shift_to_norm );
exp_band = sub( diff_scaleP1, exp_band );
- BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */
- band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); /* Q15 + exp_band */
- move32(); /* band scaled by Q_new + QSCALE */
+ BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ band[i] = L_shl_sat( Ltmp1, exp_band ); /* Q15 + exp_band */
+#else
+ band[i] = L_shl_o( Ltmp1, exp_band, &Overflow ); /* Q15 + exp_band */
+#endif
+ move32(); /* band scaled by Q_new + QSCALE */
BASOP_SATURATE_WARNING_ON_EVS;
test();
@@ -1045,9 +1035,13 @@ static void find_enr(
/* *ptE *= 4.0 / (L_FFT*L_FFT) */
/* normalization - corresponds to FFT normalization by 2/L_FFT */
- BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */
+ BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *Bin_E = L_shl_sat( Ltmp, diff_scaleM2 ); /* Q_new + QSCALE */
+#else
*Bin_E = L_shl_o( Ltmp, diff_scaleM2, &Overflow ); /* Q_new + QSCALE */
- move32(); /* scaled by Q_new + QSCALE - 2 */
+#endif
+ move32(); /* scaled by Q_new + QSCALE - 2 */
BASOP_SATURATE_WARNING_ON_EVS;
Bin_E++;
Ltmp1 = L_add( Ltmp1, Ltmp );
@@ -1068,7 +1062,11 @@ static void find_enr(
exp_band = sub( exp_band, shift_to_norm );
exp_band = sub( diff_scaleP1, exp_band );
BASOP_SATURATE_WARNING_OFF_EVS; /* saturation seems to have no effect (tested by simulation) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ band[i] = L_shl_sat( Ltmp1, exp_band );
+#else
band[i] = L_shl_o( Ltmp1, exp_band, &Overflow );
+#endif
move32(); /* band scaled by Q_new + QSCALE */
BASOP_SATURATE_WARNING_ON_EVS;
diff --git a/lib_enc/ari_hm_enc_fx.c b/lib_enc/ari_hm_enc_fx.c
index d62dcf141923e2ecdd303bf6abab6f2acd623843..4beac647d5a1d3c2d184b8467e4c45eecb265e2f 100644
--- a/lib_enc/ari_hm_enc_fx.c
+++ b/lib_enc/ari_hm_enc_fx.c
@@ -241,9 +241,11 @@ Word16 SearchPeriodicityIndex_fx(
Word32 Lag;
Word16 s, tmp, tmp2, tmp3;
Word32 tmp32;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Debug init (not instrumented) */
@@ -457,7 +459,11 @@ Word16 SearchPeriodicityIndex_fx(
tmp32 = L_mult0( Score, NumToConsider ); /* -> 16Q15 */
tmp = sub( norm_l( tmp32 ), 1 );
tmp2 = norm_l( AbsTotal );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp3 = div_s( round_fx_sat( L_shl( tmp32, tmp ) ), round_fx_sat( L_shl( AbsTotal, tmp2 ) ) );
+#else
tmp3 = div_s( round_fx_o( L_shl_o( tmp32, tmp, &Overflow ), &Overflow ), round_fx_o( L_shl_o( AbsTotal, tmp2, &Overflow ), &Overflow ) );
+#endif
*RelativeScore = shr_sat( tmp3, add( sub( tmp, tmp2 ), 2 ) ); /* -> 2Q13 */
move16();
}
diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c
index 2e88b1f00e95a70547bf733cd212fb8184e110a8..58125b81cafde7044d7fb0c02b05883a1d082edd 100644
--- a/lib_enc/arith_coder_enc_fx.c
+++ b/lib_enc/arith_coder_enc_fx.c
@@ -48,10 +48,12 @@ static Word16 tcx_arith_estimate_scale(
{
Word16 scale, tmp, k, s, s1;
Word32 L_tmp, accu;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
/* compute normalised standard deviation and determine approximate scale */
@@ -72,7 +74,11 @@ static Word16 tcx_arith_estimate_scale(
s1 = norm_l( abs_spectrum[k] );
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = mult_r( round_fx_sat( L_shl( abs_spectrum[k], s1 ) ), envelope[k] );
+#else
tmp = mult_r( round_fx_o( L_shl( abs_spectrum[k], s1 ), &Overflow ), envelope[k] );
+#endif
L_tmp = L_mult0( tmp, tmp );
tmp = sub( shl( s1, 1 ), 1 );
@@ -367,7 +373,7 @@ static Word16 tcx_arith_rateloop(
Word32 L_tmp;
Word16 tmp, tmp3;
Word32 tmp2;
-#ifndef ISSUE_1796_replace_shl_o
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
@@ -381,11 +387,7 @@ static Word16 tcx_arith_rateloop(
scale_max = tcx_arith_find_max_scale( abs_spectrum, abs_spectrum_e, L_frame, envelope, envelope_e, exps, deadzone, scale_e );
-#ifdef ISSUE_1796_replace_shl_o
scale = shl_sat( scale, sub( tmp, *scale_e ) );
-#else
- scale = shl_o( scale, sub( tmp, *scale_e ), &Overflow );
-#endif
scale = s_min( scale, scale_max );
scale_best = scale;
@@ -446,11 +448,7 @@ static Word16 tcx_arith_rateloop(
{
/* Update estimator temporal compensation factor */
tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 1 << 9 ), bits, &s );
-#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( mult_r( *target_bits_fac, tmp ), s );
-#else
- tmp = shl_o( mult_r( *target_bits_fac, tmp ), s, &Overflow );
-#endif
tmp = s_min( tmp, 20480 /*1.25f Q14*/ );
tmp = s_max( tmp, 12288 /*0.75f Q14*/ );
*target_bits_fac = tmp;
@@ -480,16 +478,8 @@ static Word16 tcx_arith_rateloop(
{
/* adjust = 1.25f * target_bits / (float)bits; */
tmp = BASOP_Util_Divide3232_Scale( L_mult0( target_bits, 0x280 ), bits, &s );
-#ifdef ISSUE_1796_replace_shl_o
adjust = shl_sat( tmp, sub( s, 1 ) ); /* Q14 */
-#else
- adjust = shl_o( tmp, sub( s, 1 ), &Overflow ); /* Q14 */
-#endif
-#ifdef ISSUE_1796_replace_shl_o
scale = shl_sat( mult_r( scale, adjust ), 1 );
-#else
- scale = shl_o( mult_r( scale, adjust ), 1, &Overflow );
-#endif
scale = s_min( scale, scale_max );
}
}
@@ -698,14 +688,21 @@ void tcx_arith_encode_envelope_fx(
const Word8 *deadzone_flags;
Word16 gamma_w, gamma_uw;
Word16 hm_bits;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_tmp, L_tmp2;
+#else
+ Word32 L_tmp;
+ Word64 W_tmp2;
+#endif
Word16 tmp;
TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
move32();
move32();
+#endif
#endif
assert( L_spec <= N_MAX_ARI );
@@ -790,10 +787,18 @@ void tcx_arith_encode_envelope_fx(
move16();
/* Multiply back the signs */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp2 = L_deposit_l( 0 );
+#else
+ W_tmp2 = 0;
+#endif
FOR( k = 0; k <= kMax; k++ )
{
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_tmp2 = L_macNs_co( L_tmp2, q_spectrum[k], k, &Carry, &Overflow );
+#else
+ W_tmp2 = W_mac_16_16( W_tmp2, q_spectrum[k], k );
+#endif
if ( signs[k] != 0 )
L_tmp = L_mult( q_spectrum[k], -( 1 << ( 30 - SPEC_EXP_DEC ) ) );
@@ -807,7 +812,11 @@ void tcx_arith_encode_envelope_fx(
set32_fx( spectrum + k, 0, sub( s_max( L_frame, L_spec ), k ) );
/* noise filling seed */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
*nf_seed = extract_l( L_tmp2 );
+#else
+ *nf_seed = extract_l( W_extract_l( W_tmp2 ) );
+#endif
move16();
}
diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c
index b3a49c59ef44f47907cd76b13c71eb34b8156521..8433e77abe610eb2841607b917fe2a1a47e3728d 100644
--- a/lib_enc/avq_cod_fx.c
+++ b/lib_enc/avq_cod_fx.c
@@ -14,8 +14,6 @@
* Local prototypes
*-------------------------------------------------------------------*/
static void wrte_cv( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits );
-static void wrte_cv_ivas_fx( BSTR_ENC_HANDLE hBstr, const Word16 nq, const Word16 i_ind, const Word16 kv_ind, UWord16 I, Word16 kv[], Word16 *bits );
-
/*-------------------------------------------------------------------*
* Function AVQ_cod() *
* *
@@ -35,8 +33,10 @@ void AVQ_cod_fx( /* o: comfort noise gain factor
Word16 ebits[NSV_MAX], e_ebits, f_ebits, e_tmp, f_tmp, tmp16, l_8;
Word32 Lener, Ltmp, Lgain, x1[8];
Word16 tot_est_bits, Q_in;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
Q_in = sub( Q_in_ref, 1 );
move16();
@@ -53,7 +53,11 @@ void AVQ_cod_fx( /* o: comfort noise gain factor
Lener = L_shl( 4, shl( Q_in, 1 ) ); /* to set ebits >= 0 */
FOR( i = 0; i < 8; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lener = L_mac_sat( Lener, xri[l * 8 + i], xri[l * 8 + i] );
+#else
Lener = L_mac_o( Lener, xri[l * 8 + i], xri[l * 8 + i], &Overflow );
+#endif
}
/* estimated bit consumption when gain=1 */
/* ebits[l] = 5.0 * FAC_LOG2 * (Word16)log10(ener * 0.5) */
@@ -172,404 +176,6 @@ void AVQ_encmux_fx(
Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */
Word16 trgtSvPos /* i : target SV for AVQ bit savings */
)
-{
- Word16 i, j = 0, bits, pos, pos_max, overflow, pos_tmp, bit_tmp;
- Word16 sort_idx[NSV_MAX], nq[NSV_MAX], kv[NSV_MAX * 8];
- Word16 *t;
- UWord16 I[NSV_MAX];
- Word16 nq_ind, i_ind, kv_ind;
- Word16 nq_est, unused_bits, unused_bits_idx;
- Word16 bitsMod, Nsvm1, Nsvm2;
- Word16 unusedbitsFlag;
- Word16 svOrder[NSV_MAX], k, nullVec, dummy_bits;
-
- test();
- IF( EQ_16( extl, SWB_BWE_HIGHRATE ) || EQ_16( extl, FB_BWE_HIGHRATE ) )
- {
- nq_ind = IND_NQ2;
- move16();
- i_ind = IND_I2;
- move16();
- kv_ind = IND_KV2;
- move16();
- }
- ELSE
- {
- nq_ind = IND_NQ;
- move16();
- i_ind = IND_I;
- move16();
- kv_ind = IND_KV;
- move16();
- }
-
- FOR( i = 0; i < NSV_MAX; i++ )
- {
- I[i] = (UWord16) -1;
- move16();
- }
- unusedbitsFlag = 0;
- bitsMod = 0;
- move16();
- move16();
- /*-----------------------------------------------------------------
- * Encode subvectors and fix possible overflows in total bit budget,
- * i.e. find for each subvector a codebook index nq (nq=0,2,3,4,...,NSV_MAX),
- * a base codebook index (I), and a Voronoi index (kv)
- *-----------------------------------------------------------------*/
-
- /* sort subvectors by estimated bit allocations in decreasing order */
- t = kv;
- /* reuse vector to save memory */
- /*ptr init*/
- FOR( i = 0; i < Nsv; i++ )
- {
- t[i] = xriq[8 * Nsv + i];
- move16();
- }
-
- FOR( i = 0; i < Nsv; i++ )
- {
- bits = t[0];
- move16();
- pos = 0;
- move16();
- FOR( j = 1; j < Nsv; j++ )
- {
- if ( GT_16( t[j], bits ) )
- {
- pos = j;
- move16();
- }
- bits = s_max( t[j], bits );
- }
- sort_idx[i] = pos;
- move16();
- t[pos] = -1;
- move16();
- }
-
- /* compute multi-rate indices and avoid bit budget overflow */
- pos_max = 0;
- move16();
- bits = 0;
- move16();
- FOR( i = 0; i < Nsv; i++ )
- {
- /* find vector to quantize (criteria: nb of estimated bits) */
- pos = sort_idx[i];
- move16();
-
- /* compute multi-rate index of rounded subvector (nq,I,kv[]) */
- re8_cod_fx( &xriq[pos * 8], &nq[pos], &I[pos], &kv[8 * pos] );
-
- IF( nq[pos] > 0 )
- {
- j = pos_max;
- move16();
- j = s_max( pos, j );
-
- /* compute (number of bits -1) to describe Q #nq */
- IF( GE_16( nq[pos], 2 ) )
- {
- overflow = sub( i_mult2( nq[pos], 5 ), 1 );
- }
- ELSE
- {
- overflow = 0;
- move16();
- }
-
- /* check for overflow and compute number of bits-1 (n) */
- IF( GT_16( add( bits, add( overflow, j ) ), *nb_bits ) )
- {
- /* if budget overflow */
- pos_tmp = add( shl( pos, 3 ), 8 ); /*(pos*8)+8*/
- FOR( j = pos * 8; j < pos_tmp; j++ )
- {
- xriq[j] = 0;
- move16();
- }
- nq[pos] = 0;
- move16(); /* force Q0 */
- }
- ELSE
- {
- bits = add( bits, overflow );
- pos_max = j;
- move16(); /* update index of the last described subvector */
- }
- }
- }
- nullVec = 0;
- Nsvm1 = sub( Nsv, 1 );
- Nsvm2 = sub( Nsvm1, 1 );
- dummy_bits = 0;
- svOrder[Nsvm1] = trgtSvPos;
- svOrder[0] = 0;
- svOrder[1] = 1;
- i = 2;
- j = i;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- if ( EQ_16( avq_bit_sFlag, 2 ) )
- {
- j = add( i, 1 );
- }
- WHILE( i < Nsvm1 )
- {
- svOrder[i] = j;
- move16();
- i++; /*ptr*/
- j = add( j, 1 );
- }
- /* write indexes to the bitstream */
- /* ============================== */
-
- bits = *nb_bits;
- move16();
- overflow = 0;
- move16();
- FOR( i = 0; i < Nsv; i++ )
- {
- k = svOrder[i];
- move16();
- test();
- test();
- test();
- test();
- test();
- IF( EQ_16( avq_bit_sFlag, 2 ) && EQ_16( s_and( bits, 4 ), 4 ) && GT_16( bits, 8 ) && LT_16( bits, 30 ) && GE_16( k, trgtSvPos ) && LT_16( i, Nsvm1 ) )
- {
- ordr_esti( sub( Nsv, i ), &trgtSvPos, &svOrder[i], Nsv );
- k = svOrder[i];
- move16();
- avq_bit_sFlag = 1;
- move16();
- }
-
- test();
- IF( EQ_16( k, trgtSvPos ) && avq_bit_sFlag > 0 )
- {
- test();
- test();
- IF( EQ_16( sub( *nb_bits, bits ), 7 ) || LT_16( bits, BIT_SAVING_LOW_THR ) || GE_16( bits, BIT_SAVING_HIGH_THR ) )
- {
- avq_bit_sFlag = 0;
- move16();
- }
- ELSE
- {
- BREAK;
- }
- }
-
- if ( EQ_16( sub( i_mult2( 5, nq[k] ), 1 ), bits ) ) /* check the overflow */
- {
- overflow = 1;
- move16();
- }
-
- IF( GT_16( bits, 8 ) )
- {
- /* write the unary code for nq[i] */
- j = sub( nq[k], 1 );
- IF( nq[k] > 0 )
- {
- /* write the unary code */
- FOR( ; j > 16; j -= 16 )
- {
- push_indice( hBstr, nq_ind, 65535, 16 );
- bits = sub( bits, 16 );
- }
-
- IF( j > 0 )
- {
- push_indice( hBstr, nq_ind, extract_l( L_sub( L_shl( 1L, j ), 1L ) ), j );
- bits = sub( bits, j );
- }
- }
- IF( !overflow )
- {
- /* write the stop bit */
- push_indice( hBstr, nq_ind, 0, 1 );
- bits = sub( bits, 1 );
- }
-
- wrte_cv( hBstr, nq[k], i_ind, kv_ind, I[k], &kv[k * 8], &bits );
- }
- } /* for */
- /* Bit Saving Solution */
- test();
- IF( avq_bit_sFlag > 0 && GT_16( bits, 8 ) )
- {
- // PMT("code not validated yet")
- bitsMod = s_and( bits, 4 /*bits%5*/ );
- i = svOrder[Nsvm1];
- move16();
- IF( NE_16( i, Nsvm1 ) )
- {
- nullVec = 0;
- move16();
- FOR( j = i; j < Nsv - 1; j++ )
- {
- if ( nq[svOrder[j]] == 0 )
- {
- nullVec = add( nullVec, 1 );
- }
- }
- /*nq_est = bits / 5;*/
- nq_est = mult( bits, 6554 );
- assert( nq_est == bits / 5 );
-
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- IF( ( bitsMod > 0 || ( EQ_16( nullVec, 4 ) && EQ_16( nq_est, 5 ) ) ) && NE_16( bitsMod, 4 ) && GE_16( add( bits, nullVec ), add( add( shl( nq_est, 2 ), nq_est ), 4 ) ) /*5 * nq_est + 4*/ && nq[svOrder[Nsvm2]] == 0 ) /* detect need for dummy bits */
- {
- dummy_bits = sub( 5, bitsMod );
- bits = add( bits, dummy_bits ); /* add dummy bits */
- bitsMod = 0;
- move16();
- }
- ELSE IF( nq_est > 4 && ( ( bitsMod == 0 && GT_16( nullVec, 3 ) && GT_16( nullVec, 6 ) ) || ( EQ_16( bitsMod, 4 ) && EQ_16( nullVec, 5 ) ) ) && nq[svOrder[Nsvm2]] == 0 ) /* wasted bits 4, 5 for nq 6,7..*/
- {
- overflow = 0;
- move16();
- if ( s_and( add( bitsMod, nullVec ), 4 ) != 0 )
- {
- overflow = 1;
- move16();
- }
- dummy_bits = add( nullVec, overflow );
- bits = add( bits, dummy_bits ); /* add dummy bits */
- bitsMod = 0;
- move16();
- }
- }
-
- overflow = 1;
- move16();
- IF( NE_16( bitsMod, 4 ) )
- {
- overflow = 0;
- move16();
- bits = sub( bits, bitsMod );
- }
- bits = add( bits, overflow ); /*add fake bit */
- unused_bits = sub( bits, add( shl( nq[i], 2 ), nq[i] ) );
- if ( nq[i] == 0 ) /*no bit savings*/
- {
- unused_bits = sub( unused_bits, 1 ); /*Stop Bit*/
- }
- /*unused_bits_idx = (int16_t)unused_bits / 5;*/
- unused_bits_idx = mult( unused_bits, 6554 );
- assert( unused_bits_idx == unused_bits / 5 );
- unusedbitsFlag = 0;
- move16();
- IF( dummy_bits == 0 )
- {
- test();
- test();
- IF( EQ_16( unused_bits_idx, 1 ) && GT_16( bits, BIT_SAVING_LOW_THR ) )
- {
- unused_bits_idx = 0;
- unusedbitsFlag = 1;
- move16();
- move16();
- }
- ELSE IF( unused_bits_idx == 0 && GT_16( bits, BIT_SAVING_LOW_THR ) )
- {
- unused_bits_idx = 1;
- unusedbitsFlag = -1;
- move16();
- move16();
- }
- }
-
- j = unused_bits_idx;
- move16();
- /*Encode Unused Bit Unary Codeword */
- IF( j > 0 )
- {
- /* write the unary code */
- push_indice( hBstr, nq_ind, sub( shl( 1, j ), 1 ), j );
- }
-
- IF( nq[i] != 0 )
- {
- /* write the stop bit */
- push_indice( hBstr, nq_ind, 0, 1 );
- }
-
- /*Compute AVQ code book number from unused Bits */
- bit_tmp = add( unusedbitsFlag, unused_bits_idx );
- /*nq_est = (int16_t)ceil(0.2f * (bits - 5 * (unusedbitsFlag + unused_bits_idx)));*/
- nq_est = mult( 6554, sub( bits, add( shl( bit_tmp, 2 ), bit_tmp ) ) );
- assert( (Word16) ceil( 0.2f * ( bits - 5 * ( unusedbitsFlag + unused_bits_idx ) ) ) == nq_est );
-
- if ( EQ_16( nq_est, 1 ) )
- {
- nq_est = 0;
- move16();
- }
- bits = sub( bits, overflow );
-
- bits = sub( bits, j );
-
- if ( nq_est != 0 )
- {
- bits = sub( bits, 1 );
- }
- nq[i] = nq_est;
- move16();
-
- /* write codebook indices (rank I and event. Voronoi index kv) */
- wrte_cv( hBstr, nq[i], i_ind, kv_ind, I[i], &kv[i * 8], &bits );
-
- bits = sub( bits, dummy_bits );
-
- if ( NE_16( bitsMod, 4 ) )
- {
- bits = add( bits, bitsMod );
- }
- }
- *nb_bits = bits;
- move16();
-
- FOR( i = 0; i < Nsv; i++ )
- {
- nq_out[i] = nq[i];
- move16();
- }
-
- return;
-}
-
-void AVQ_encmux_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
- const Word16 extl, /* i : extension layer */
- Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed
- by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */
- Word16 *nb_bits, /* i/o: number of allocated bits */
- const Word16 Nsv, /* i: number of subvectors */
- Word16 nq_out[], /* o : AVQ nq index */
- Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */
- Word16 trgtSvPos /* i : target SV for AVQ bit savings */
-)
{
Word16 i, j = 0, bits, pos, pos_max, overflow, pos_tmp, bit_tmp;
Word16 sort_idx[NSV_MAX], nq[NSV_MAX], kv[NSV_MAX * 8];
@@ -581,7 +187,6 @@ void AVQ_encmux_ivas_fx(
Word16 unusedbitsFlag;
Word16 svOrder[NSV_MAX], k, nullVec, dummy_bits;
Word16 tmp;
-
test();
IF( EQ_16( extl, SWB_BWE_HIGHRATE ) || EQ_16( extl, FB_BWE_HIGHRATE ) )
{
@@ -720,7 +325,7 @@ void AVQ_encmux_ivas_fx(
{
j = add( i, 1 );
}
- WHILE( LT_16( i, Nsvm1 ) )
+ WHILE( i < Nsvm1 )
{
svOrder[i] = j;
move16();
@@ -751,6 +356,7 @@ void AVQ_encmux_ivas_fx(
}
assert( tmp == bits % 5 );
IF( EQ_16( avq_bit_sFlag, 2 ) && EQ_16( tmp, 4 ) && GT_16( bits, 8 ) && LT_16( bits, 30 ) && GE_16( k, trgtSvPos ) && LT_16( i, Nsvm1 ) )
+
{
ordr_esti( sub( Nsv, i ), &trgtSvPos, &svOrder[i], Nsv );
k = svOrder[i];
@@ -807,15 +413,14 @@ void AVQ_encmux_ivas_fx(
bits = sub( bits, 1 );
}
- wrte_cv_ivas_fx( hBstr, nq[k], i_ind, kv_ind, I[k], &kv[k * 8], &bits );
+ wrte_cv( hBstr, nq[k], i_ind, kv_ind, I[k], &kv[k * 8], &bits );
}
} /* for */
/* Bit Saving Solution */
test();
IF( avq_bit_sFlag > 0 && GT_16( bits, 8 ) )
{
- // PMT("code not validated yet")
- // bitsMod = bits%5;
+ /* bitsMod = bits % 5;*/
bitsMod = bits;
move16();
WHILE( bitsMod >= 5 )
@@ -831,13 +436,13 @@ void AVQ_encmux_ivas_fx(
move16();
FOR( j = i; j < Nsv - 1; j++ )
{
- IF( nq[svOrder[j]] == 0 )
+ if ( nq[svOrder[j]] == 0 )
{
nullVec = add( nullVec, 1 );
}
}
/*nq_est = bits / 5;*/
- nq_est = mult( bits, 6554 /*1/5 in Q15*/ );
+ nq_est = mult( bits, 6554 );
assert( nq_est == bits / 5 );
test();
@@ -850,7 +455,7 @@ void AVQ_encmux_ivas_fx(
test();
test();
test();
-
+ test();
IF( ( bitsMod > 0 || ( EQ_16( nullVec, 4 ) && EQ_16( nq_est, 5 ) ) ) && NE_16( bitsMod, 4 ) && GE_16( add( bits, nullVec ), add( add( shl( nq_est, 2 ), nq_est ), 4 ) ) /*5 * nq_est + 4*/ && nq[svOrder[Nsvm2]] == 0 ) /* detect need for dummy bits */
{
dummy_bits = sub( 5, bitsMod );
@@ -890,7 +495,7 @@ void AVQ_encmux_ivas_fx(
}
bits = add( bits, overflow ); /*add fake bit */
unused_bits = sub( bits, add( shl( nq[i], 2 ), nq[i] ) );
- IF( nq[i] == 0 ) /*no bit savings*/
+ if ( nq[i] == 0 ) /*no bit savings*/
{
unused_bits = sub( unused_bits, 1 ); /*Stop Bit*/
}
@@ -933,7 +538,6 @@ void AVQ_encmux_ivas_fx(
{
/* write the unary code */
push_indice( hBstr, nq_ind, u_extract_l( L_sub( L_shl_sat( 1, j ), 1 ) ), j );
- assert( abs( ( 1 << j ) - 1 ) <= 65536 );
}
IF( nq[i] != 0 )
@@ -945,7 +549,7 @@ void AVQ_encmux_ivas_fx(
/*Compute AVQ code book number from unused Bits */
bit_tmp = add( unusedbitsFlag, unused_bits_idx );
/*nq_est = (int16_t)ceil(0.2f * (bits - 5 * (unusedbitsFlag + unused_bits_idx)));*/
- nq_est = mult( 6554 /*.2 in Q15*/, sub( bits, add( shl( bit_tmp, 2 ), bit_tmp ) ) );
+ nq_est = mult( 6554, sub( bits, add( shl( bit_tmp, 2 ), bit_tmp ) ) );
assert( (Word16) ceil( 0.2f * ( bits - 5 * ( unusedbitsFlag + unused_bits_idx ) ) ) == nq_est );
if ( EQ_16( nq_est, 1 ) )
@@ -957,7 +561,7 @@ void AVQ_encmux_ivas_fx(
bits = sub( bits, j );
- IF( nq_est != 0 )
+ if ( nq_est != 0 )
{
bits = sub( bits, 1 );
}
@@ -965,11 +569,11 @@ void AVQ_encmux_ivas_fx(
move16();
/* write codebook indices (rank I and event. Voronoi index kv) */
- wrte_cv_ivas_fx( hBstr, nq[i], i_ind, kv_ind, I[i], &kv[i * 8], &bits );
+ wrte_cv( hBstr, nq[i], i_ind, kv_ind, I[i], &kv[i * 8], &bits );
bits = sub( bits, dummy_bits );
- IF( NE_16( bitsMod, 4 ) )
+ if ( NE_16( bitsMod, 4 ) )
{
bits = add( bits, bitsMod );
}
@@ -985,7 +589,6 @@ void AVQ_encmux_ivas_fx(
return;
}
-
/*-------------------------------------------------------------------*
* Function AVQ_cod_lpc_fx() *
* *
@@ -1134,63 +737,3 @@ static void wrte_cv(
move16();
return;
}
-
-static void wrte_cv_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 nq, /* i : AVQ nq index */
- const Word16 i_ind, /* i : Base Bitstream index */
- const Word16 kv_ind, /* i : Vornoi Bitstream index */
- UWord16 I, /* o : rank I code book index */
- Word16 kv[], /* o : Vornoi index kv */
- Word16 *nbits /* i/o: bits */
-)
-{
- Word16 pos, j;
- Word16 bits, nq4;
-
- bits = *nbits;
- move16();
-
- /* write codebook indices (rank I and event. Voronoi index kv) */
- IF( nq == 0 ) /* Q0 */
- {
- /* nothing to write */
- }
- ELSE IF( LT_16( nq, 5 ) ) /* Q2, Q3, Q4 */
- {
- nq4 = shl( nq, 2 );
- push_indice( hBstr, i_ind, I, nq4 );
- bits = sub( bits, nq4 );
- }
- ELSE IF( EQ_16( s_and( nq, 1 ), 0 ) ) /* Q4 + Voronoi extensions r=1,2,3,... */
- {
- push_indice( hBstr, i_ind, I, 4 * 4 );
- bits = sub( bits, 4 * 4 );
- /*pos = (int16_t)(nq / 2 - 2);*/ /* Voronoi order determination */
- pos = sub( shr( nq, 1 ), 2 );
- FOR( j = 0; j < 8; j++ )
- {
- push_indice( hBstr, kv_ind, kv[j], pos );
- }
-
- bits = sub( bits, shl( pos, 3 ) );
- }
- ELSE /* Q3 + Voronoi extensions r=1,2,3,... */
- {
- push_indice( hBstr, i_ind, I, 4 * 3 );
- bits = sub( bits, 4 * 3 );
-
- /*pos = (int16_t)(nq / 2 - 1);*/ /* Voronoi order determination */
- pos = sub( shr( nq, 1 ), 1 );
- FOR( j = 0; j < 8; j++ )
- {
- push_indice( hBstr, kv_ind, kv[j], pos );
- }
-
- bits = sub( bits, shl( pos, 3 ) );
- }
-
- *nbits = bits;
- move16();
- return;
-}
diff --git a/lib_enc/bass_psfilter_enc_fx.c b/lib_enc/bass_psfilter_enc_fx.c
index f417a09048b6d84974166cece0c39ac3eb9ca33d..7a056dd132fe774997eb43f6b6bc1b4284b162f3 100644
--- a/lib_enc/bass_psfilter_enc_fx.c
+++ b/lib_enc/bass_psfilter_enc_fx.c
@@ -36,10 +36,12 @@ Word16 bass_pf_enc_fx(
Word32 cross_n_d, nrg_n;
const Word16 *pFilt;
Word32 ener2;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
IF( NE_16( l_frame, L_FRAME16k ) )
@@ -129,11 +131,7 @@ Word16 bass_pf_enc_fx(
/* gain = tmp/nrg; */
gain = BASOP_Util_Divide3232_Scale( tmp, nrg, &tmp16 );
BASOP_SATURATE_WARNING_OFF_EVS;
-#ifdef ISSUE_1796_replace_shl_o
gain = shl_sat( gain, tmp16 ); /* Q15 */
-#else
- gain = shl_o( gain, tmp16, &Overflow ); /* Q15 */
-#endif
BASOP_SATURATE_WARNING_ON_EVS;
if ( gain < 0 )
@@ -157,6 +155,16 @@ Word16 bass_pf_enc_fx(
FOR( i = 0; i < lg; i++ )
{
tmp32 = L_msu0( 0, gain, syn[i + i_subfr - T] );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp32 = L_msu0_sat( tmp32, gain, syn[i + i_subfr + T] );
+ tmp16 = mac_r_sat( tmp32, gain, syn[i + i_subfr] ); /* Q0 */
+
+ lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ );
+ lp_error = L_mac_sat( lp_error, tmp16, 0x1000 ); /* Q13 */
+
+ tmp16 = round_fx_sat( L_shl_sat( lp_error, s1 ) ); /* Q0+s1-3 */
+ ener2 = L_mac0_sat( ener2, tmp16, tmp16 ); /* Q0+(s1-3)*2 */
+#else
tmp32 = L_msu0_o( tmp32, gain, syn[i + i_subfr + T], &Overflow );
tmp16 = mac_ro( tmp32, gain, syn[i + i_subfr], &Overflow ); /* Q0 */
@@ -165,6 +173,7 @@ Word16 bass_pf_enc_fx(
tmp16 = round_fx_o( L_shl_o( lp_error, s1, &Overflow ), &Overflow ); /* Q0+s1-3 */
ener2 = L_mac0_o( ener2, tmp16, tmp16, &Overflow ); /* Q0+(s1-3)*2 */
+#endif
}
}
@@ -173,13 +182,23 @@ Word16 bass_pf_enc_fx(
FOR( i = lg; i < l_subfr; i++ )
{
tmp32 = L_mult0( gain, syn[i + i_subfr] );
- tmp32 = L_msu0_o( tmp32, gain, syn[i + i_subfr - T], &Overflow ); /* Q0 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp32 = L_msu0_sat( tmp32, gain, syn[i + i_subfr - T] ); /* Q0 */
+ tmp16 = round_fx_sat( tmp32 );
+ lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ );
+ lp_error = L_mac_sat( lp_error, tmp16, 0x1000 ); /* Q13 */
+
+ tmp16 = round_fx_sat( L_shl_sat( lp_error, s1 ) ); /* Q0+s1-3 */
+ ener2 = L_mac0_sat( ener2, tmp16, tmp16 ); /* Q0+(s1-3)*2 */
+#else
+ tmp32 = L_msu0_o( tmp32, gain, syn[i + i_subfr - T], &Overflow ); /* Q0 */
tmp16 = round_fx_o( tmp32, &Overflow );
lp_error = Mpy_32_16_1( lp_error, 29491 /*0.9f Q15*/ );
lp_error = L_mac_o( lp_error, tmp16, 0x1000, &Overflow ); /* Q13 */
- tmp16 = round_fx_o( L_shl_o( lp_error, s1, &Overflow ), &Overflow ); /* Q0+s1-3 */
- ener2 = L_mac0_o( ener2, tmp16, tmp16, &Overflow ); /* Q0+(s1-3)*2 */
+ tmp16 = round_fx_o( L_shl_o( lp_error, s1, &Overflow ), &Overflow ); /* Q0+s1-3 */
+ ener2 = L_mac0_o( ener2, tmp16, tmp16, &Overflow ); /* Q0+(s1-3)*2 */
+#endif
}
}
@@ -214,11 +233,7 @@ Word16 bass_pf_enc_fx(
tmp32 = L_deposit_l( 1 );
tmp16 = BASOP_Util_Divide3232_Scale( tmp, tmp32, &st );
BASOP_SATURATE_WARNING_OFF_EVS;
-#ifdef ISSUE_1796_replace_shl_o
tmp16 = shl_sat( tmp16, sub( st, 2 ) ); /* Q15 */
-#else
- tmp16 = shl_o( tmp16, sub( st, 2 ), &Overflow ); /* Q15 */
-#endif
if ( GT_16( tmp16, 16384 /*0.5f Q15*/ ) )
{
@@ -244,7 +259,11 @@ Word16 bass_pf_enc_fx(
tmp32 = L_mac( tmp32, tmp16, syn[i + i_subfr] );
noise_in[i] = round_fx( L_shl( tmp32, s2 ) ); /* Q0+s2 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ error_in[i] = sub_sat( orig[i + i_subfr], syn[i + i_subfr] ); /*Q0*/
+#else
error_in[i] = sub_o( orig[i + i_subfr], syn[i + i_subfr], &Overflow ); /*Q0*/
+#endif
move16();
}
}
@@ -258,7 +277,11 @@ Word16 bass_pf_enc_fx(
noise_in[i] = round_fx( L_shl( tmp32, s2 ) ); /* Q0+s2 */
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ error_in[i] = sub_sat( orig[i + i_subfr], syn[i + i_subfr] ); /*Q0*/
+#else
error_in[i] = sub_o( orig[i + i_subfr], syn[i + i_subfr], &Overflow ); /*Q0*/
+#endif
move16();
}
}
diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c
index eeaf56969dbba0b3388d2cf6e4dbae7ee979bd72..6ec7c626b3b1ef007d81f0983a26c60368d2e6db 100644
--- a/lib_enc/bw_detect_fx.c
+++ b/lib_enc/bw_detect_fx.c
@@ -67,9 +67,11 @@ void bw_detect_fx(
const Word32 *pt32;
Word32 max_NB32, max_WB32, max_SWB32, max_FB32, mean_NB32, mean_WB32, mean_SWB32, mean_FB32; /* Q11*/ /* we need Word32 for the new cldfb energy vectors */
Word16 bwd_count_wider_bw;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Word16 lp_noise_fx;
@@ -127,8 +129,12 @@ void bw_detect_fx(
cldfb_bin[i] = L_deposit_l( 1 );
move32();
}
- L_tmp = BASOP_Util_Log2( cldfb_bin[0] ); /*(log2(660423549*2^(-31))/64)*2^31*/
+ L_tmp = BASOP_Util_Log2( cldfb_bin[0] ); /*(log2(660423549*2^(-31))/64)*2^31*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_add_sat( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[0] ), 31 - LD_DATA_SCALE ) ); /* Q25 */
+#else
L_tmp = L_add_o( L_tmp, L_shl( L_deposit_l( cldfb_bin_Exp[0] ), 31 - LD_DATA_SCALE ), &Overflow ); /* Q25 */
+#endif
cldfb_bin[0] = Mpy_32_16_1( L_tmp, 9864 /*1.0f/3.3219280948873623478703194294894f Q15*/ );
move32(); /* 1/log2(10) */ /* Q25 */
@@ -297,8 +303,8 @@ void bw_detect_fx(
FOR( i = 0; i < BWD_TOTAL_WIDTH; i++ )
{
-#ifdef ISSUE_1799_replace_L_shr_o
- spect[i] = round_fx_o( L_shr_sat( spect32[i], Q_dct ), &Overflow );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ spect[i] = round_fx_sat( L_shr_sat( spect32[i], Q_dct ) );
#else
spect[i] = round_fx_o( L_shr_o( spect32[i], Q_dct, &Overflow ), &Overflow );
#endif
@@ -339,7 +345,11 @@ void bw_detect_fx(
pt1 = &spect[i_mult2( i, bin_width )];
FOR( j = 0; j < bin_width; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ sum32 = L_mac0_sat( sum32, *pt1, *pt1 );
+#else
sum32 = L_mac0_o( sum32, *pt1, *pt1, &Overflow );
+#endif
pt1++;
}
tmp_1 = BASOP_Util_Cmp_Mant32Exp( sum32, E_spect_bin, MAX_32, Q31 - 41 ); /* Any sum32 in Q_dct if it is less than MAX_32 in Q41 will be less than 0.001 */
diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c
index ed3663732c2f4317fcaf436f3094ed71e17c6351..37770ce9e66b8f920bbf12773b63745be9e8f409 100644
--- a/lib_enc/cng_enc_fx.c
+++ b/lib_enc/cng_enc_fx.c
@@ -108,9 +108,11 @@ void CNG_enc_fx(
st_lp_sp_enr = hTdCngEnc->lp_sp_enr_fx;
move16();
Word16 lp_ener_thr_scale;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Temp variables for floating point functions */
@@ -635,7 +637,11 @@ void CNG_enc_fx(
FOR( i = 0; i < M; i++ )
{
dev = abs_s( sub( lsp_tmp[i], lsp_new[i] ) ); /*Q15 */
- dist = add_o( dist, dev, &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ dist = add_sat( dist, dev ); /*Q15 */
+#else
+ dist = add_o( dist, dev, &Overflow ); /*Q15 */
+#endif
if ( GT_16( dev, max_dev ) )
{
max_dev = dev;
@@ -765,10 +771,16 @@ void CNG_enc_fx(
FOR( i = 0; i < NUM_ENV_CNG; i++ )
{
/* env[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_new+1 */
+ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_new+1 */
+ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_new+1 */
+#else
L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_new+1 */
L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_new+1 */
L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_new+1 */
- L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */
+#endif
+ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */
tmp1 = add( add( Q_new, Q_new ), 1 );
env[i] = L_shr( L_tmp, sub( tmp1, 6 ) );
move32(); /* Q6 */
@@ -1044,9 +1056,13 @@ void CNG_enc_fx(
/* d += (env[j] - CNG_details_codebook_fx[i][j]) * (env[j] - CNG_details_codebook_fx[i][j]);*/
L_tmp = L_sub( env[j], L_deposit_l( CNG_details_codebook_fx[i][j] ) ); /* Q6 */
exp = norm_l( L_tmp );
- L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/
- tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/
- L_tmp = L_mult_o( tmp1, tmp1, &Overflow ); /*Q(2*exp - 19)*/
+ L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/
+ tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mult_sat( tmp1, tmp1 ); /*Q(2*exp - 19)*/
+#else
+ L_tmp = L_mult_o( tmp1, tmp1, &Overflow ); /*Q(2*exp - 19)*/
+#endif
L_tmp = L_shr( L_tmp, sub( add( exp, exp ), 36 ) ); /* Q17 */
d = L_add( d, L_tmp );
}
@@ -1233,9 +1249,11 @@ void CNG_enc_ivas_fx(
Word64 w_temp;
Word32 inv_frame_len;
Word32 L_ener;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
step_inv = 0;
move16();
@@ -1939,10 +1957,16 @@ void CNG_enc_ivas_fx(
FOR( i = 0; i < NUM_ENV_CNG; i++ )
{
/* env[i] = 2.0f*(*ptR * *ptR + *ptI * *ptI)/L_FFT; */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mult_sat( *ptR, *ptR ); /* 2*Q_new+1 */
+ L_tmp = L_add_sat( L_tmp, L_mult_sat( *ptI, *ptI ) ); /* 2*Q_new+1 */
+ L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_new+1 */
+#else
L_tmp = L_mult_o( *ptR, *ptR, &Overflow ); /* 2*Q_new+1 */
L_tmp = L_add_o( L_tmp, L_mult_o( *ptI, *ptI, &Overflow ), &Overflow ); /* 2*Q_new+1 */
L_tmp = L_add_o( L_tmp, L_tmp, &Overflow ); /* 2*Q_new+1 */
- L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */
+#endif
+ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */
tmp1 = add( add( Q_new, Q_new ), 1 );
env[i] = L_shr( L_tmp, sub( tmp1, 6 ) );
move32(); /* Q6 */
@@ -2242,9 +2266,13 @@ void CNG_enc_ivas_fx(
/* d += (env[j] - CNG_details_codebook_fx[i][j]) * (env[j] - CNG_details_codebook_fx[i][j]);*/
L_tmp = L_sub( env[j], L_deposit_l( CNG_details_codebook_fx[i][j] ) ); /* Q6 */
exp = norm_l( L_tmp );
- L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/
- tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/
- L_tmp = L_mult_o( tmp1, tmp1, &Overflow ); /*Q(2*exp - 19)*/
+ L_tmp = L_shl( L_tmp, exp ); /*Q(exp+6)*/
+ tmp1 = extract_h( L_tmp ); /*Q(exp+6-16)=exp-10*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mult_sat( tmp1, tmp1 ); /*Q(2*exp - 19)*/
+#else
+ L_tmp = L_mult_o( tmp1, tmp1, &Overflow ); /*Q(2*exp - 19)*/
+#endif
L_tmp = L_shr( L_tmp, sub( add( exp, exp ), 36 ) ); /* Q17 */
d = L_add( d, L_tmp ); /* Q17 */
}
@@ -2511,9 +2539,11 @@ static Word16 shb_DTX_fx(
DTX_ENC_HANDLE hDtxEnc = st_fx->hDtxEnc;
TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc;
TD_BWE_ENC_HANDLE hBWE_TD = st_fx->hBWE_TD;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
shb_new_speech_fx = shb_old_speech_fx + ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4;
Copy( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4 );
@@ -2531,7 +2561,11 @@ static Word16 shb_DTX_fx(
wb_ener_fx = L_deposit_l( 0 );
FOR( i = 0; i < st_fx->L_frame; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ wb_ener_fx = L_mac_sat( wb_ener_fx, syn_12k8_16k[i], syn_12k8_16k[i] );
+#else
wb_ener_fx = L_mac_o( wb_ener_fx, syn_12k8_16k[i], syn_12k8_16k[i], &Overflow );
+#endif
}
wb_ener_fx = L_add( Mpy_32_16_1( wb_ener_fx, 128 ), 1 ); /* 128 in Q15, wb_ener_fx in Q1 */
@@ -2540,7 +2574,11 @@ static Word16 shb_DTX_fx(
fra = Log2_norm_lc( L_shl( wb_ener_fx, exp ) );
exp = sub( 30 - 1, exp );
wb_ener_fx = Mpy_32_16( exp, fra, LG10 );
- log_wb_ener_fx = round_fx_o( L_shl_o( wb_ener_fx, 10, &Overflow ), &Overflow ); /* log_wb_ener_fx in Q8 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ log_wb_ener_fx = round_fx_sat( L_shl_sat( wb_ener_fx, 10 ) ); /* log_wb_ener_fx in Q8 */
+#else
+ log_wb_ener_fx = round_fx_o( L_shl_o( wb_ener_fx, 10, &Overflow ), &Overflow ); /* log_wb_ener_fx in Q8 */
+#endif
exp = norm_l( shb_ener_fx );
fra = Log2_norm_lc( L_shl( shb_ener_fx, exp ) );
exp = sub( 30 - 1, exp );
@@ -2559,7 +2597,11 @@ static Word16 shb_DTX_fx(
move16();
}
- log_shb_ener_fx = sub_o( round_fx_o( L_shl_o( shb_ener_fx, 10, &Overflow ), &Overflow ), att, &Overflow ); /* log_shb_ener_fx in Q8 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ log_shb_ener_fx = sub_sat( round_fx_sat( L_shl_sat( shb_ener_fx, 10 ) ), att ); /* log_shb_ener_fx in Q8 */
+#else
+ log_shb_ener_fx = sub_o( round_fx_o( L_shl_o( shb_ener_fx, 10, &Overflow ), &Overflow ), att, &Overflow ); /* log_shb_ener_fx in Q8 */
+#endif
IF( hDtxEnc->first_CNG == 0 )
{
hTdCngEnc->mov_wb_cng_ener_fx = log_wb_ener_fx;
@@ -2968,10 +3010,11 @@ static Word16 shb_DTX_ivas_fx(
TD_CNG_ENC_HANDLE hTdCngEnc = st->hTdCngEnc;
TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD;
-
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
shb_new_speech_fx = shb_old_speech_fx + ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4;
@@ -2990,7 +3033,11 @@ static Word16 shb_DTX_ivas_fx(
wb_ener_fx = L_deposit_l( 0 );
FOR( i = 0; i < st->L_frame; i++ )
{
- wb_ener_fx = L_mac_o( wb_ener_fx, syn_12k8_16k_fx[i], syn_12k8_16k_fx[i], &Overflow ); // ( Q0 + Q0 + Q1 ) --> Q1 due to left shift in L_mac
+#ifdef ISSUE_1867_replace_overflow_libenc
+ wb_ener_fx = L_mac_sat( wb_ener_fx, syn_12k8_16k_fx[i], syn_12k8_16k_fx[i] ); // ( Q0 + Q0 + Q1 ) --> Q1 due to left shift in L_mac
+#else
+ wb_ener_fx = L_mac_o( wb_ener_fx, syn_12k8_16k_fx[i], syn_12k8_16k_fx[i], &Overflow ); // ( Q0 + Q0 + Q1 ) --> Q1 due to left shift in L_mac
+#endif
}
wb_ener_fx = L_add( Mpy_32_16_1( wb_ener_fx, 128 ), 1 ); /* 128 in Q15, wb_ener_fx in Q1 */
@@ -3000,7 +3047,11 @@ static Word16 shb_DTX_ivas_fx(
exp = sub( 30 - 1, exp );
wb_ener_fx = Mpy_32_16( exp, fra, LG10 );
- log_wb_ener_fx = round_fx_o( L_shl_o( wb_ener_fx, 10, &Overflow ), &Overflow ); /* log_wb_ener_fx in Q8 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ log_wb_ener_fx = round_fx_sat( L_shl_sat( wb_ener_fx, 10 ) ); /* log_wb_ener_fx in Q8 */
+#else
+ log_wb_ener_fx = round_fx_o( L_shl_o( wb_ener_fx, 10, &Overflow ), &Overflow ); /* log_wb_ener_fx in Q8 */
+#endif
exp = norm_l( shb_ener_fx );
fra = Log2_norm_lc( L_shl( shb_ener_fx, exp ) );
exp = sub( 30 - 1, exp );
@@ -3024,8 +3075,11 @@ static Word16 shb_DTX_ivas_fx(
move16();
}
-
+#ifdef ISSUE_1867_replace_overflow_libenc
+ log_shb_ener_fx = sub_sat( round_fx_sat( L_shl_sat( shb_ener_fx, 10 ) ), att_fx ); /* log_shb_ener_fx in Q8 */
+#else
log_shb_ener_fx = sub_o( round_fx_o( L_shl_o( shb_ener_fx, 10, &Overflow ), &Overflow ), att_fx, &Overflow ); /* log_shb_ener_fx in Q8 */
+#endif
IF( st->hDtxEnc->first_CNG == 0 )
{
diff --git a/lib_enc/cod2t32_fx.c b/lib_enc/cod2t32_fx.c
index dc967e656015c19b31d029321709cc01eef3608d..156b38ce491a042e737d03d6ee5a89d8bd9b3f04 100644
--- a/lib_enc/cod2t32_fx.c
+++ b/lib_enc/cod2t32_fx.c
@@ -47,9 +47,11 @@ void acelp_2t32_fx(
Word32 L_tmp;
Word16 rrixix[NB_TRACK_FCB_2T][NB_POS_FCB_2T];
Word16 rrixiy[MSIZE];
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*----------------------------------------------------------------*
* Compute rrixix[][] needed for the codebook search.
@@ -63,11 +65,19 @@ void acelp_2t32_fx(
L_cor = L_deposit_h( 1 );
FOR( i = 0; i < NB_POS_FCB_2T; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 );
+#else
L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
+#endif
ptr_h1++;
*p1-- = extract_h( L_cor );
move16(); /*Q9 Q7*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_cor = L_mac_sat( L_cor, *ptr_h1, *ptr_h1 );
+#else
L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
+#endif
ptr_h1++;
*p0-- = extract_h( L_cor );
move16(); /*Q9 Q7*/
@@ -108,17 +118,28 @@ void acelp_2t32_fx(
L_cor = L_mult( *ptr_h1++, *ptr_h2++ ); // Q(12+12+1)
FOR( i = k; i < NB_POS_FCB_2T - 1; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *p1 = round_fx_sat( L_cor ); // Q(25-16)
+ L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ );
+ *p0 = round_fx_sat( L_cor ); // Q(9)
+ L_cor = L_mac_sat( L_cor, *ptr_h1++, *ptr_h2++ );
+#else
*p1 = round_fx_o( L_cor, &Overflow ); // Q(25-16)
L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
*p0 = round_fx_o( L_cor, &Overflow ); // Q(9)
L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
+#endif
move16();
move16();
p1 -= ( NB_POS_FCB_2T + 1 );
p0 -= ( NB_POS_FCB_2T + 1 );
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *p1 = round_fx_sat( L_cor ); // Q9
+#else
*p1 = round_fx_o( L_cor, &Overflow ); // Q9
+#endif
pos -= NB_POS_FCB_2T;
move16();
pos2--;
@@ -221,281 +242,15 @@ void acelp_2t32_fx(
FOR( i1 = 1; i1 < L_SUBFR; i1 += STEP )
{
ps2 = add( ps1, dn_p[i1] );
- alp2 = add_o( alp1, add_o( *p1++, *p2++, &Overflow ), &Overflow );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp2 = add_sat( alp1, add_sat( *p1++, *p2++ ) );
sq = mult( ps2, ps2 );
- s = L_msu_o( L_mult( alpk, sq ), psk, alp2, &Overflow );
- IF( s > 0 )
- {
- psk = sq;
- move16();
- alpk = alp2;
- move16();
- pos = i1;
- move16();
- }
- }
- p1 -= NB_POS_FCB_2T;
-
- IF( pos >= 0 )
- {
- ix = i0;
- move16();
- iy = pos;
- move16();
- }
- }
-
- i0 = shr( ix, 1 );
- i1 = shr( iy, 1 );
-
- sign0 = shl( pol[ix], 9 ); // Q9
- sign1 = shl( pol[iy], 9 ); // Q9
-
- /*-------------------------------------------------------------------*
- * Build the codeword, the filtered codeword and index of codevector.
- *-------------------------------------------------------------------*/
-
- set16_fx( code, 0, L_SUBFR );
-
- code[ix] = sign0;
- move16();
- code[iy] = sign1;
- move16();
-
- index = add( shl( i0, 6 ), i1 );
-
-
- if ( sign0 < 0 )
- {
- index = add( index, 0x800 );
- }
- if ( sign1 < 0 )
- {
- index = add( index, 0x20 ); /* move16();*/
- }
-
- set16_fx( y, 0, L_SUBFR );
- /* y_Q9 = sign_Q9<<3 * h_Q12 */
-
- sign0 = shl( sign0, 3 );
- sign1 = shl( sign1, 3 );
-
- FOR( i = ix; i < L_SUBFR; i++ )
- {
- y[i] = mult_r( sign0, h[i - ix] ); // Q9
- move16();
- }
- FOR( i = iy; i < L_SUBFR; i++ )
- {
- y[i] = round_fx( L_mac( L_deposit_h( y[i] ), sign1, h[i - iy] ) ); // Q9
- move16();
- }
- {
- /* write index to array of indices */
- push_indice( hBstr, IND_ALG_CDBK_2T32, index, 12 );
- }
- return;
-}
-
-void acelp_2t32_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 dn[], /* i : corr. between target and h[]. Qx*/
- const Word16 h[], /* i : impulse response of weighted synthesis filter Q12*/
- Word16 code[], /* o : algebraic (fixed) codebook excitation Q9 */
- Word16 y[] /* o : filtered fixed codebook excitation Q9 */
-)
-{
- Word16 i, j, k, i0, i1, ix, iy, pos, pos2, sign0, sign1, index;
- Word16 ps1, ps2, alpk, alp1, alp2;
- Word16 sq, psk;
- Word16 pol[L_SUBFR], dn_p[L_SUBFR];
- Word16 ii, jj;
- Word16 *p0, *p1, *p2;
- const Word16 *ptr_h1, *ptr_h2, *ptr_hf;
-
- Word32 s, L_cor;
- Word32 L_tmp;
- Word16 rrixix[NB_TRACK_FCB_2T][NB_POS_FCB_2T];
- Word16 rrixiy[MSIZE];
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
- /*----------------------------------------------------------------*
- * Compute rrixix[][] needed for the codebook search.
- *----------------------------------------------------------------*/
-
- /* Init pointers to last position of rrixix[] */
- p0 = &rrixix[0][NB_POS_FCB_2T - 1];
- p1 = &rrixix[1][NB_POS_FCB_2T - 1];
-
- ptr_h1 = h;
- move16();
- L_cor = L_deposit_h( 1 );
- FOR( i = 0; i < NB_POS_FCB_2T; i++ )
- {
- L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
- ptr_h1++;
- *p1-- = extract_h( L_cor );
- move16(); /*Q9 Q7*/
- L_cor = L_mac_o( L_cor, *ptr_h1, *ptr_h1, &Overflow );
- ptr_h1++;
- *p0-- = extract_h( L_cor );
- move16(); /*Q9 Q7*/
- }
-
- p0 = rrixix[0];
- p1 = rrixix[1];
-
- FOR( i = 0; i < NB_POS_FCB_2T; i++ )
- {
- *p0 = shr( *p0, 1 );
- move16();
- p0++;
- *p1 = shr( *p1, 1 );
- move16();
- p1++;
- }
-
- /*------------------------------------------------------------*
- * Compute rrixiy[][] needed for the codebook search.
- *------------------------------------------------------------*/
-
- pos = MSIZE - 1;
- move16();
- pos2 = MSIZE - 2;
- move16();
- ptr_hf = h + 1;
-
- FOR( k = 0; k < NB_POS_FCB_2T; k++ )
- {
- /* Init pointers to last position of diagonals */
- p1 = &rrixiy[pos];
- p0 = &rrixiy[pos2];
-
- ptr_h1 = h;
- ptr_h2 = ptr_hf;
-
- L_cor = L_mult( *ptr_h1++, *ptr_h2++ ); // Q25
- FOR( i = k; i < NB_POS_FCB_2T - 1; i++ )
- {
- *p1 = round_fx_o( L_cor, &Overflow ); // Q9
- L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
- *p0 = round_fx_o( L_cor, &Overflow ); // Q9
- L_cor = L_mac_o( L_cor, *ptr_h1++, *ptr_h2++, &Overflow );
- move16();
- move16();
- p1 -= ( NB_POS_FCB_2T + 1 );
- p0 -= ( NB_POS_FCB_2T + 1 );
- }
-
- *p1 = round_fx_o( L_cor, &Overflow );
- pos -= NB_POS_FCB_2T;
- move16();
- pos2 = sub( pos2, 1 );
- ptr_hf += STEP;
- move16();
- }
-
- /*----------------------------------------------------------------*
- * computing reference vector and pre-selection of polarities
- *----------------------------------------------------------------*/
-
- L_tmp = L_deposit_h( dn[0] );
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- /* FIR high-pass filtering */
- IF( i == 0 )
- {
- L_tmp = L_msu( L_tmp, dn[1], 11469 /*.3f Q15*/ );
- }
- ELSE IF( EQ_16( i, L_SUBFR - 1 ) )
- {
- L_tmp = L_deposit_h( dn[i] );
- L_tmp = L_msu( L_tmp, dn[i - 1], 11469 /*.3f Q15*/ );
- }
- ELSE
- {
- L_tmp = L_deposit_h( dn[i] );
- L_tmp = L_msu( L_tmp, dn[i - 1], 11469 /*.3f Q15*/ );
- L_tmp = L_msu( L_tmp, dn[i + 1], 11469 /*.3f Q15*/ );
- }
-
- /* pre-selection of polarities */
- IF( L_tmp >= 0 )
- {
- pol[i] = 1;
- move16();
- dn_p[i] = dn[i];
- move16();
- }
- ELSE
- {
- pol[i] = -1;
- move16();
- dn_p[i] = negate( dn[i] );
- move16();
- }
- }
-
- /*----------------------------------------------------------------*
- * compute denominator ( multiplied by polarity )
- *----------------------------------------------------------------*/
-
- k = 0;
- ii = 0;
- move16();
- move16();
- FOR( i = 0; i < NB_POS_FCB_2T; i++ )
- {
- jj = 1;
- move16();
- FOR( j = 0; j < NB_POS_FCB_2T; j++ )
- {
- test();
- if ( EQ_16( s_and( pol[ii], pol[jj] ), 1 ) && EQ_16( s_or( pol[ii], pol[jj] ), -1 ) )
- {
- rrixiy[k + j] = negate( rrixiy[k + j] );
- move16();
- }
- jj = add( jj, 2 );
- }
- ii = add( ii, 2 );
- k = add( k, NB_POS_FCB_2T );
- }
-
- /*----------------------------------------------------------------*
- * search 2 pulses
- * All combinaisons are tested:
- * 32 pos x 32 pos x 2 signs = 2048 tests
- *----------------------------------------------------------------*/
-
- p0 = rrixix[0];
- p1 = rrixix[1];
- p2 = rrixiy;
- psk = -1;
- move16();
- alpk = 1;
- move16();
- ix = 0;
- move16();
- iy = 1;
- move16();
-
- FOR( i0 = 0; i0 < L_SUBFR; i0 += STEP )
- {
- ps1 = dn_p[i0];
- move16();
- alp1 = *p0++;
- move16();
- pos = -1;
- move16();
- FOR( i1 = 1; i1 < L_SUBFR; i1 += STEP )
- {
- ps2 = add( ps1, dn_p[i1] );
+ s = L_msu_sat( L_mult( alpk, sq ), psk, alp2 );
+#else
alp2 = add_o( alp1, add_o( *p1++, *p2++, &Overflow ), &Overflow );
sq = mult( ps2, ps2 );
s = L_msu_o( L_mult( alpk, sq ), psk, alp2, &Overflow );
+#endif
IF( s > 0 )
{
psk = sq;
@@ -645,72 +400,3 @@ void acelp_1t64_fx(
return;
}
-
-void acelp_1t64_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 dn[], /* i : corr. between target and h[]. Qx */
- const Word16 h[], /* i : impulse response of weighted synthesis filter Q12*/
- Word16 code[], /* o : algebraic (fixed) codebook excitation Q9*/
- Word16 y[], /* o : filtered fixed codebook excitation Q9*/
- const Word16 L_subfr /* i : subframe length */
-)
-{
- Word16 i, pos, sgn, index;
- Word32 L_tmp;
- /*-------------------------------------------------------------------*
- * Find position and sign of maximum impulse.
- *-------------------------------------------------------------------*/
- pos = emaximum_fx( 0, dn, L_subfr, &L_tmp );
-
- IF( dn[pos] < 0 )
- {
- sgn = -512; //-1 in Q9
- move16();
- }
- ELSE
- {
- sgn = 512; // 1 in Q9
- move16();
- }
-
- /*-------------------------------------------------------------------*
- * Build the codeword, the filtered codeword and index of codevector.
- *-------------------------------------------------------------------*/
-
- set16_fx( code, 0, L_subfr );
- code[pos] = sgn;
- move16();
-
- set16_fx( y, 0, L_subfr );
-
- FOR( i = pos; i < L_subfr; i++ )
- {
- IF( sgn > 0 )
- {
- y[i] = shr_r( h[i - pos], 3 ); // Q9
- move16();
- }
- ELSE
- {
- y[i] = negate( shr_r( h[i - pos], 3 ) ); // Q9
- move16();
- }
- }
-
- index = pos;
- move16();
- if ( sgn > 0 )
- {
- index = add( index, L_subfr );
- }
- IF( EQ_16( L_subfr, L_SUBFR ) )
- {
- push_indice( hBstr, IND_ALG_CDBK_1T64, index, 7 );
- }
- ELSE /* L_subfr == 2*L_SUBFR */
- {
- push_indice( hBstr, IND_ALG_CDBK_1T64, index, 8 );
- }
-
- return;
-}
diff --git a/lib_enc/cod4t64_fx.c b/lib_enc/cod4t64_fx.c
index 457a129b839cc96400674fb882c3fd05b6e07616..d0bb15cc7a8d07740b8bec88d1ab73d30bfe15be 100644
--- a/lib_enc/cod4t64_fx.c
+++ b/lib_enc/cod4t64_fx.c
@@ -1,12 +1,12 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* VMR-WB compilation switches */
#include "cnst.h" /* Common constants */
#include "rom_enc.h" /* Encoder static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
@@ -22,6 +22,7 @@
/*-------------------------------------------------------------------*
* Local function prototypes
*-------------------------------------------------------------------*/
+
static Word16 quant_1p_N1_fx( const Word16 pos, const Word16 N );
static Word16 quant_3p_3N1_fx( const Word16 pos1, const Word16 pos2, const Word16 pos3, const Word16 N );
static Word32 quant_4p_4N_fx( const Word16 pos[], const Word16 N );
@@ -66,7 +67,8 @@ Word16 acelp_4t64_fx(
Word16 nbbits, /* i : number of bits per codebook */
const Word16 cmpl_flag, /* i : complexity reduction flag */
const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
-)
+ ,
+ const Word16 element_mode )
{
Word16 i, k, index, track;
@@ -299,430 +301,13 @@ Word16 acelp_4t64_fx(
IF( acelpautoc )
{
- E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind );
-
+ E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind, element_mode );
/* Generate weighted code */
E_ACELP_weighted_code( code, H, 12, y );
}
ELSE
{
- E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y );
-
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- y[i] = shr( y[i], 3 );
- move16(); /*Q9 */
- }
- }
-
- /*-----------------------------------------------------------------*
- * Indexing
- *-----------------------------------------------------------------*/
-
- IF( !Opt_AMR_WB )
- {
- saved_bits = E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, indexing_indices );
-
- saved_bits = 0;
- move16();
-
- wordcnt = shr( nbbits, 4 );
- bitcnt = s_and( nbbits, 15 );
- FOR( i = 0; i < wordcnt; i++ )
- {
- push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], 16 );
- }
- IF( bitcnt )
- {
- push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], bitcnt );
- }
- }
- ELSE
- {
- /* AMR-WB pulse indexing */
-
- IF( EQ_16( nbbits, 20 ) )
- {
- FOR( track = 0; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- index = quant_1p_N1_fx( ind[k], 4 );
- push_indice( hBstr, IND_ALG_CDBK_4T64, index, 5 );
- }
- }
- ELSE IF( EQ_16( nbbits, 36 ) )
- {
- FOR( track = 0; track < NB_TRACK_FCB_4T; track++ )
- {
-
- k = i_mult2( track, NPMAXPT ); /* k = track * NPMAXPT;*/
- index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 );
- push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 );
- }
- }
- ELSE IF( EQ_16( nbbits, 44 ) ) /* AMR-WB pulse indexing */
- {
- FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ )
- {
- k = i_mult2( track, NPMAXPT );
- index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 );
- push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 );
- }
-
- FOR( track = 2; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 );
- push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 );
- }
- }
- ELSE IF( EQ_16( nbbits, 52 ) ) /* AMR-WB pulse indexing */
- {
- FOR( track = 0; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 );
- push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 );
- }
- }
- ELSE IF( EQ_16( nbbits, 64 ) ) /* AMR-WB pulse indexing */
- {
- FOR( track = 0; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_4p_4N_fx( &ind[k], 4 );
- index = extract_l( L_shr( L_index, 14 ) & 3 );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 );
- }
-
- FOR( track = 0; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_4p_4N_fx( &ind[k], 4 );
- index = extract_l( L_index & 0x3FFF );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 );
- }
- }
- ELSE IF( EQ_16( nbbits, 72 ) )
- {
- FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_5p_5N_fx( &ind[k], 4 );
- index = extract_l( L_shr( L_index, 10 ) & 0x03FF );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 10 );
- }
-
- FOR( track = 2; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_4p_4N_fx( &ind[k], 4 );
- index = extract_l( L_shr( L_index, 14 ) & 3 );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 );
- }
-
- FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_5p_5N_fx( &ind[k], 4 );
- index = extract_l( L_index & 0x03FF );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 10 );
- }
-
- FOR( track = 2; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_4p_4N_fx( &ind[k], 4 );
- index = extract_l( L_index & 0x3FFF );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 );
- }
- }
- ELSE IF( EQ_16( nbbits, 88 ) )
- {
- FOR( track = 0; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_6p_6N_2_fx( &ind[k], 4 );
- index = extract_l( L_shr( L_index, 11 ) & 0x07FF );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 11 );
- }
-
- FOR( track = 0; track < NB_TRACK_FCB_4T; track++ )
- {
- k = i_mult2( track, NPMAXPT );
- L_index = quant_6p_6N_2_fx( &ind[k], 4 );
- index = extract_l( L_index & 0x07FF );
- logic16();
- push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 11 );
- }
- }
- }
-
- return saved_bits;
-}
-
-
-Word16 acelp_4t64_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 dn[], /* i : corr. between target and h[]. */
- const Word16 cn[], /* i : residual after long term prediction Q_new*/
- const Word16 H[], /* i : impulse response of weighted synthesis filter Q12*/
- Word16 R[], /* i : autocorrelation values */
- const Word16 acelpautoc, /* i : autocorrealtion flag */
- Word16 code[], /* o : algebraic (fixed) codebook excitation Q9*/
- Word16 y[], /* o : filtered fixed codebook excitation Q9*/
- Word16 nbbits, /* i : number of bits per codebook */
- const Word16 cmpl_flag, /* i : complexity reduction flag */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- Word16 element_mode )
-{
-
- Word16 i, k, index, track;
- Word32 L_index;
- Word16 ind[NPMAXPT * NB_TRACK_FCB_4T + 32]; /* VE3: why +32 ???*/
- Word16 codvec[NB_PULSE_MAX + 4] = { 0 };
- Word16 saved_bits = 0;
-
- PulseConfig config;
- Word16 indexing_indices[6], wordcnt, bitcnt;
-
- set16_fx( codvec, 0, NB_PULSE_MAX + 4 );
- SWITCH( nbbits )
- {
-
- case 20: /* EVS/AMR-WB pulse indexing: 20 bits, 4 pulses, 4 tracks */
- config.nbiter = 4;
- move16(); /* 4x12x16=768 loop */
- config.alp = 16384;
- move16(); /* 2 in Q13*/
- config.nb_pulse = 4;
- move16();
- config.fixedpulses = 0;
- move16();
- config.nbpos[0] = 4;
- move16();
- config.nbpos[1] = 8;
- move16();
- BREAK;
-
- case 28: /* EVS pulse indexing: 28 bits, 6 pulses, 4 tracks */
- config.nbiter = 4;
- move16(); /* 4x20x16=1280 loops */
- config.alp = 8192; /*1 in Q13*/
- move16(); /* coeff FOR sign setting */
- config.nb_pulse = 6;
- move16();
- config.fixedpulses = 0;
- move16();
- config.nbpos[0] = 6;
- move16();
- config.nbpos[1] = 6;
- move16();
- config.nbpos[2] = 8;
- move16();
- BREAK;
-
- case 36: /* EVS/AMR-WB pulse indexing: 36 bits, 8 pulses, 4 tracks */
- config.nbiter = 4;
- move16(); /* 4x20x16=1280 loops */
- config.alp = 8192; /*1 in Q13*/
- move16(); /* coeff FOR sign setting */
- config.nb_pulse = 8;
- move16();
- config.fixedpulses = 2;
- move16();
- config.nbpos[0] = 4;
- move16();
- config.nbpos[1] = 8;
- move16();
- config.nbpos[2] = 8;
- move16();
- BREAK;
-
- case 43: /* EVS pulse indexing: 43 bits, 10 pulses, 4 tracks */
- case 44: /* AMR-WB pulse indexing: 44 bits, 10 pulses, 4 tracks */
- config.nbiter = 4;
- move16(); /* 4x26x16=1664 loops */
- config.alp = 8192; /*1 in Q13*/
- move16();
- config.nb_pulse = 10;
- move16();
- config.fixedpulses = 2;
- move16();
- config.nbpos[0] = 4;
- move16();
- config.nbpos[1] = 6;
- move16();
- config.nbpos[2] = 8;
- move16();
- config.nbpos[3] = 8;
- move16();
- BREAK;
-
- case 50: /* EVS pulse indexing: 50 bits, 12 pulses, 4 tracks */
- case 52: /* AMR-WB pulse indexing: 52 bits, 12 pulses, 4 tracks */
- config.nbiter = 4;
- move16(); /* 4x26x16=1664 loops */
- config.alp = 8192; /*1 in Q13*/
- move16();
- config.nb_pulse = 12;
- move16();
- config.fixedpulses = 4;
- move16();
- config.nbpos[0] = 4;
- move16();
- config.nbpos[1] = 6;
- move16();
- config.nbpos[2] = 8;
- move16();
- config.nbpos[3] = 8;
- move16();
- BREAK;
-
- case 62: /* EVS pulse indexing: 62 bits, 16 pulses, 4 tracks */
- case 64: /* AMR-WB pulse indexing: 64 bits, 16 pulses, 4 tracks */
- config.nbiter = 3;
- move16(); /* 3x36x16=1728 loops */
- config.alp = 6554; /*.8f in Q13*/
- move16();
- config.nb_pulse = 16;
- move16();
- config.fixedpulses = 4;
- move16();
- config.nbpos[0] = 4;
- move16();
- config.nbpos[1] = 4;
- move16();
- config.nbpos[2] = 6;
- move16();
- config.nbpos[3] = 6;
- move16();
- config.nbpos[4] = 8;
- move16();
- config.nbpos[5] = 8;
- move16();
- BREAK;
-
- case 72: /* AMR-WB pulse indexing: 72 bits, 18 pulses, 4 tracks */
- config.nbiter = 3;
- move16(); /* 3x35x16=1680 loops */
- config.alp = 6144; /*.75f in Q13*/
- move16();
- config.nb_pulse = 18;
- move16();
- config.fixedpulses = 4;
- move16();
- config.nbpos[0] = 2;
- move16();
- config.nbpos[1] = 3;
- move16();
- config.nbpos[2] = 4;
- move16();
- config.nbpos[3] = 5;
- move16();
- config.nbpos[4] = 6;
- move16();
- config.nbpos[5] = 7;
- move16();
- config.nbpos[6] = 8;
- move16();
- BREAK;
-
- case 88: /* AMR-WB pulse indexing: 88 bits, 24 pulses, 4 tracks */
- config.nbiter = 2;
- move16(); /* 2x53x16=1696 loop */
- config.alp = 4096; /*.5f in Q13*/
- move16();
- config.nb_pulse = 24;
- move16();
- config.fixedpulses = 4;
- move16();
- config.nbpos[0] = 2;
- move16();
- config.nbpos[1] = 2;
- move16();
- config.nbpos[2] = 3;
- move16();
- config.nbpos[3] = 4;
- move16();
- config.nbpos[4] = 5;
- move16();
- config.nbpos[5] = 6;
- move16();
- config.nbpos[6] = 7;
- move16();
- config.nbpos[7] = 8;
- move16();
- config.nbpos[8] = 8;
- move16();
- config.nbpos[9] = 8;
- move16();
- BREAK;
-
- case 87: /* EVS pulse indexing: 87 bits, 26 pulses, 4 tracks */
- config.nbiter = 1;
- move16();
- config.alp = 4096; /*.5f in Q13*/
- move16();
- config.nb_pulse = 26;
- move16();
- config.fixedpulses = 4;
- move16();
- config.nbpos[0] = 4;
- move16();
- config.nbpos[1] = 6;
- move16();
- config.nbpos[2] = 6;
- move16();
- config.nbpos[3] = 8;
- move16();
- config.nbpos[4] = 8;
- move16();
- config.nbpos[5] = 8;
- move16();
- config.nbpos[6] = 8;
- move16();
- config.nbpos[7] = 8;
- move16();
- config.nbpos[8] = 8;
- move16();
- config.nbpos[9] = 8;
- move16();
- config.nbpos[10] = 8;
- move16();
- BREAK;
- }
-
- /* reduce the number of iterations as a compromise between the performance and complexity */
- if ( cmpl_flag > 0 )
- {
- config.nbiter = cmpl_flag;
- move16();
- }
-
- config.codetrackpos = TRACKPOS_FIXED_FIRST;
- move32();
- config.bits = nbbits;
- move16();
-
- IF( acelpautoc )
- {
- E_ACELP_4tsearchx_ivas_fx( dn, cn, R, code, &config, ind, element_mode );
-
- /* Generate weighted code */
- E_ACELP_weighted_code( code, H, 12, y );
- }
- ELSE
- {
- E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y );
-
+ E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y, 0 );
FOR( i = 0; i < L_SUBFR; i++ )
{
y[i] = shr( y[i], 3 );
diff --git a/lib_enc/cod_ace_fx.c b/lib_enc/cod_ace_fx.c
index e1914aeb5bb7b2e51f123b8f0ca042512c174644..dc139873ad53da9cfcfcfdc1cb8851228ee454bc 100644
--- a/lib_enc/cod_ace_fx.c
+++ b/lib_enc/cod_ace_fx.c
@@ -75,9 +75,11 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision *
Word16 dummy = 0;
move16();
ACELP_config *acelp_cfg;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
acelp_cfg = &( st->acelp_cfg );
@@ -351,13 +353,22 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision *
Ltmp = Mpy_32_16_1( gain_code2, code2[i] );
Ltmp = L_shl( Ltmp, Q_new_p5 );
Ltmp = L_mac( Ltmp, gain_pit, exc[i + i_subfr] );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ exc2[i] = round_fx_sat( L_shl_sat( Ltmp, 1 ) );
+#else
exc2[i] = round_fx_sat( L_shl_o( Ltmp, 1, &Overflow ) );
+#endif
move16();
Ltmp2 = Mpy_32_16_1( gain_code, code[i] );
Ltmp2 = L_shl_sat( Ltmp2, Q_new_p5 );
Ltmp = L_add_sat( Ltmp, Ltmp2 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here */
+ exc[i + i_subfr] = round_fx_sat( Ltmp );
+#else
Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here */
exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow );
+#endif
move16();
}
/*-----------------------------------------------------------------*
@@ -366,9 +377,15 @@ Word16 coder_acelp_fx( /* o : SEGSNR for CL decision *
IF( st->igf != 0 )
{
+#ifdef FIX_2010_PREP_TBE_EXC
+ prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR],
+ bwe_exc, gain_preQ, code_preQ, Q10, Q_new, T0, T0_frac, st->coder_type, st->core_brate,
+ st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR],
bwe_exc, gain_preQ, code_preQ, Q_new, T0, T0_frac, st->coder_type, st->core_brate,
st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag );
+#endif
}
/*---------------------------------------------------------*
diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c
index c598af5385fc6fe8ea6816d91b00d636fa1520e3..a08a81c4afe7c10466b3556d59874ffbe3e96237 100644
--- a/lib_enc/cod_tcx_fx.c
+++ b/lib_enc/cod_tcx_fx.c
@@ -8,19 +8,18 @@
#include
#include "rom_com.h"
#include "stat_com.h"
-// #include "prot_fx.h"
#include "prot_fx.h"
#include "basop_util.h"
#include "stl.h"
-// #include "basop_mpy.h"
#include "prot_fx_enc.h"
#include
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+#include "ivas_rom_com.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
+
#define SIMILAR_TNS_THRESHOLD_FX_IN_Q15 ( 1311 )
#define TNS_GAIN_THRESHOLD_FOR_WHITE_FX_IN_Q7 ( 384 )
#define TNS_GAIN_THRESHOLD_FOR_WHITE_FX_IN_Q23 ( 25165824 )
@@ -1274,8 +1273,10 @@ void QuantizeSpectrum_fx(
CONTEXT_HM_CONFIG *phm_cfg;
TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
+#endif
#endif
/* Stack memory is split between encoder and internal decoder to reduce max
@@ -1657,11 +1658,7 @@ void QuantizeSpectrum_fx(
tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 );
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1796_replace_shl_o
hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 );
-#else
- hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow );
-#endif
move16();
BASOP_SATURATE_WARNING_ON_EVS
@@ -1781,11 +1778,7 @@ void QuantizeSpectrum_fx(
}
/* Limit low sqGain for avoiding saturation of the gain quantizer*/
-#ifdef ISSUE_1796_replace_shl_o
tmp1 = mult_r( shl_sat( L_spec, 5 ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ );
-#else
- tmp1 = mult_r( shl_o( L_spec, 5, &Overflow ), 26214 /*128.f/NORM_MDCT_FACTOR Q15*/ );
-#endif
s = 15 - 5 - 7;
IF( L_spec >= 1024 )
{
@@ -1847,17 +1840,30 @@ void QuantizeSpectrum_fx(
/* Save quantized Values */
tmp32 = L_deposit_l( 0 );
+ move16();
+#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ Word64 seed = 0;
+ move64();
+#endif
FOR( i = 0; i < L_spec; i++ )
{
spectrum[i] = L_mult( sqQ[i], 1 << ( 30 - SPEC_EXP_DEC ) );
move32();
/* noise filling seed */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
tmp32 = L_macNs_co( tmp32, abs_s( sqQ[i] ), i, &Carry, &Overflow );
+#else
+ seed = W_mac_16_16( seed, abs_s( sqQ[i] ), i );
+#endif
}
*spectrum_e = SPEC_EXP_DEC;
move16();
+#ifdef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
+ nf_seed = extract_l( W_extract_l( seed ) ); // Q0
+#else
nf_seed = extract_l( tmp32 );
+#endif
}
ELSE /* low rates: new arithmetic coder */
{
@@ -2745,11 +2751,7 @@ void QuantizeSpectrum_fx(
BASOP_SATURATE_WARNING_OFF_EVS;
FOR( i = 0; i < L_frame; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM );
-#else
- xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow );
-#endif
move16();
}
BASOP_SATURATE_WARNING_ON_EVS;
@@ -2912,10 +2914,12 @@ void QuantizeTCXSpectrum_fx(
Word16 att_fx = 0;
move16();
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
move16();
Flag Carry = 0;
move16();
+#endif
#endif
/*-----------------------------------------------------------*
* Init *
@@ -3256,11 +3260,7 @@ void QuantizeTCXSpectrum_fx(
tmp1 = BASOP_Util_Divide1616_Scale( sqTargetBits, tmp1, &tmp2 );
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1796_replace_shl_o
hTcxEnc->tcx_target_bits_fac = shl_sat( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2 );
-#else
- hTcxEnc->tcx_target_bits_fac = shl_o( mult( hTcxEnc->tcx_target_bits_fac, tmp1 ), tmp2, &Overflow );
-#endif
BASOP_SATURATE_WARNING_ON_EVS
if ( GT_16( hTcxEnc->tcx_target_bits_fac, 20480 /*1.25 in Q14*/ ) )
@@ -3537,18 +3537,31 @@ void QuantizeTCXSpectrum_fx(
move16();
}
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
tmp32 = L_deposit_l( 0 );
+#else
+ Word64 tmp64 = 0;
+#endif
FOR( i = 0; i < L_spec; i++ )
{
spectrum_fx[i] = L_mult( sqQ[i], 1 << ( 30 - SPEC_EXP_DEC ) );
move32();
/* noise filling seed */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
tmp32 = L_macNs_co( tmp32, abs_s( sqQ[i] ), i, &Carry, &Overflow );
+#else
+ tmp64 = W_mac_16_16( tmp64, abs_s( sqQ[i] ), i );
+#endif
}
*spectrum_e = SPEC_EXP_DEC;
move16();
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
*nf_seed = extract_l( tmp32 );
+#else
+ assert( W_extract_h( tmp64 ) == 0 );
+ *nf_seed = extract_l( W_extract_l( tmp64 ) );
+#endif
}
ELSE
{
@@ -4023,12 +4036,6 @@ void InternalTCXDecoder_fx(
Word16 Aq_old_fx[M + 1];
Word32 sns_interpolated_scalefactors_fx[FDNS_NPTS], A_fx32[M + 1];
Word16 *xn_buf16 = (Word16 *) xn_buf32;
-#if !defined( ISSUE_1796_replace_shl_o )
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-#endif
Copy32( x_quant_fx, spectrum_fx, s_max( L_frame, L_spec ) );
@@ -4677,11 +4684,7 @@ void InternalTCXDecoder_fx(
BASOP_SATURATE_WARNING_OFF_EVS;
FOR( i = 0; i < L_frame; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
xn_buf16[i] = shl_sat( xn_buf16[i], TCX_IMDCT_HEADROOM );
-#else
- xn_buf16[i] = shl_o( xn_buf16[i], TCX_IMDCT_HEADROOM, &Overflow );
-#endif
move16();
}
BASOP_SATURATE_WARNING_ON_EVS;
@@ -5125,6 +5128,19 @@ void TNSAnalysisStereo_fx(
move16();
move16();
}
+#ifdef FIX_1349_TNS_CRASH
+ ELSE
+ {
+ pFilter[0]->filterType = TNS_FILTER_OFF;
+ pFilter[1]->filterType = TNS_FILTER_OFF;
+ sts[0]->hTcxEnc->tnsData[k].nFilters = 0;
+ sts[1]->hTcxEnc->tnsData[k].nFilters = 0;
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+#endif
}
}
}
diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c
index 2f7870ab6e066e873ef432c68027ae6a763cffe3..a7ffcc229c5024799f61277b983e7cb7a9046c0f 100644
--- a/lib_enc/core_enc_init_fx.c
+++ b/lib_enc/core_enc_init_fx.c
@@ -3,13 +3,10 @@
====================================================================================*/
#include
-// #include "prot_fx.h"
-// #include "basop_mpy.h"
#include "options.h"
#include "cnst.h"
#include "stl.h"
#include "basop_util.h"
-#include "rom_com_fx.h"
#include "ivas_cnst.h"
#include
#include "rom_com.h" /* Common constants */
@@ -74,12 +71,12 @@ void init_coder_ace_plus_fx(
/* Core Framing */
L_frame_old = st->last_L_frame;
move16();
- st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 /* 1/FRAMES_PER_SEC in Q15*/ ) );
+ st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) );
st->L_frame_past = -1;
move16();
move16();
- hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 /* 1/FRAMES_PER_SEC in Q15*/ ) );
+ hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) );
move16();
st->nb_subfr = NB_SUBFR;
move16();
@@ -207,11 +204,6 @@ void init_coder_ace_plus_fx(
move16();
st->tfa_flag = 0;
move16();
- /* Initialize DTX */
- IF( st->ini_frame == 0 )
- {
- vad_init_fx( &st->vad_st );
- }
st->glr = 0;
move16();
@@ -968,14 +960,14 @@ void init_coder_ace_plus_ivas_fx(
/* Core Framing */
L_frame_old = st->last_L_frame;
move16();
- st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/
+ st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) );
move16();
st->L_frame_past = -1;
move16();
IF( hTcxEnc != NULL )
{
- hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/
+ hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) );
move16();
IF( st->ini_frame == 0 )
diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c
index 2f2682b8ee0ed035ee3a9c9d00879c99b3d122cd..2483fe95d7dfd61525827fcbe15d94cdb8d96aa9 100644
--- a/lib_enc/core_enc_ol_fx.c
+++ b/lib_enc/core_enc_ol_fx.c
@@ -6,9 +6,7 @@
#include
#include "options.h"
#include "cnst.h" /* Common constants */
-//#include "prot_fx.h"
#include "basop_util.h"
-#include "rom_com_fx.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
@@ -82,10 +80,13 @@ void core_encode_openloop_fx(
Word16 lsp_old_q_rf[M + 1], lsf_old_q_rf[M + 1];
(void) vad_hover_flag;
(void) vad_flag_dtx;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
+
TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
RF_ENC_HANDLE hRF = st->hRF;
@@ -552,10 +553,10 @@ void core_encode_openloop_fx(
/*v_sub(lsf_uq_rf, lsf_q_1st_rf, lsf_q_d_rf, M);*/
FOR( i = 0; i < M; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
- lsf_q_d_rf[i] = shl_sat( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ lsf_q_d_rf[i] = shl_sat( mult_r( sub_sat( lsf_uq_rf[i], lsf_q_1st_rf[i] ), 25600 ), 5 );
#else
- lsf_q_d_rf[i] = shl_o( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5, &Overflow );
+ lsf_q_d_rf[i] = shl_sat( mult_r( sub_o( lsf_uq_rf[i], lsf_q_1st_rf[i], &Overflow ), 25600 ), 5 );
#endif
move16();
/*input value is in Qx2.56, convert to Q6 to match table, quantizer table kept at Q6 to avoid losing precision */
@@ -697,7 +698,7 @@ void core_encode_openloop_fx(
test();
test();
IF( rf_PLC_Mode == 0 && hRF->rf_gain_tcx[1] != 0 &&
- ( ( st->transientDetection.transientDetector.bIsAttackPresent != 0 && LT_16( hRF->rf_gain_tcx[0], mult_r( hRF->rf_gain_tcx[1], 31785 /*0.97f Q15*/ ) ) ) ||
+ ( ( st->hTranDet->transientDetector.bIsAttackPresent != 0 && LT_16( hRF->rf_gain_tcx[0], mult_r( hRF->rf_gain_tcx[1], 31785 /*0.97f Q15*/ ) ) ) ||
LT_16( hRF->rf_gain_tcx[0], mult_r( hRF->rf_gain_tcx[1], 29491 /*0.90f Q15*/ ) ) ) )
{
TD_mode = 0;
@@ -757,9 +758,11 @@ static void closest_centroid_rf(
Word16 tmp, tmpL;
Word64 werr_64;
Word32 L_tmp, best_werr, werr;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
ind_vec[0] = 0;
@@ -775,8 +778,13 @@ static void closest_centroid_rf(
tmpL = i_mult2( i, length );
FOR( j = 0; j < length; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = sub_sat( data[j], quantizer[tmpL + j] );
+ L_tmp = L_mult_sat( tmp, tmp );
+#else
tmp = sub_o( data[j], quantizer[tmpL + j], &Overflow );
L_tmp = L_mult_o( tmp, tmp, &Overflow );
+#endif
werr_64 = W_mac_32_16( werr_64, L_tmp, weights[j] );
}
werr = W_sat_m( werr_64 );
@@ -828,9 +836,11 @@ void core_acelp_tcx20_switching_fx(
Word16 snr_tcx, snr_acelp, dsnr;
TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
SP_MUS_CLAS_HANDLE hSpMusClas = st->hSpMusClas;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Check minimum pitch for quantization */
@@ -888,7 +898,7 @@ void core_acelp_tcx20_switching_fx(
st->pit_fr2,
st->pit_max,
st->pit_res_max,
- &st->transientDetection,
+ st->hTranDet,
0,
A_q_tcx,
M );
@@ -1107,7 +1117,11 @@ void core_acelp_tcx20_switching_fx(
FOR( j = 0; j < L_SUBFR; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp32 = L_mac0_sat( tmp32, st->wspeech_enc[i + j], st->wspeech_enc[i + j] );
+#else
tmp32 = L_mac0_o( tmp32, st->wspeech_enc[i + j], st->wspeech_enc[i + j], &Overflow );
+#endif
}
tmp32 = L_shr( BASOP_Util_Log2( tmp32 ), 9 ); /* 15Q16 */
tmp32 = L_add( tmp32, L_sub( 0x1F0000, L_shl( L_deposit_h( add( Q_new, sub( shift, 1 ) ) ), 1 ) ) ); /* wspeech_enc scaling */
@@ -1125,7 +1139,11 @@ void core_acelp_tcx20_switching_fx(
tcx_snr = L_shl( Mpy_32_16_1( tcx_snr, 0x6054 ), 2 ); /* 0x6054 -> 10/log2(10) (2Q13) */
BASOP_SATURATE_WARNING_OFF_EVS
+#ifdef ISSUE_1867_replace_overflow_libenc
+ snr_tcx = round_fx_sat( L_shl_sat( tcx_snr, 8 ) ); /* 7Q8 */
+#else
snr_tcx = round_fx_o( L_shl_o( tcx_snr, 8, &Overflow ), &Overflow ); /* 7Q8 */
+#endif
BASOP_SATURATE_WARNING_ON_EVS
/*--------------------------------------------------------------*
@@ -1159,11 +1177,19 @@ void core_acelp_tcx20_switching_fx(
FOR( j = 0; j < L_SUBFR; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ signal = L_mac0_sat( signal, st->wspeech_enc[i + j], st->wspeech_enc[i + j] );
+
+ tmp16 = round_fx_sat( L_shl_sat( Mpy_32_16_r( gain, st->wspeech_enc[i + j - T0] ), 15 ) );
+ tmp16 = sub_sat( st->wspeech_enc[i + j], tmp16 );
+ noise = L_mac0_sat( noise, tmp16, tmp16 );
+#else
signal = L_mac0_o( signal, st->wspeech_enc[i + j], st->wspeech_enc[i + j], &Overflow );
tmp16 = round_fx_o( L_shl_o( Mpy_32_16_r( gain, st->wspeech_enc[i + j - T0] ), 15, &Overflow ), &Overflow );
tmp16 = sub_o( st->wspeech_enc[i + j], tmp16, &Overflow );
noise = L_mac0_o( noise, tmp16, tmp16, &Overflow );
+#endif
}
/* Assume always 4 sub frames. */
/*assert( (st->L_frame / L_SUBFR) == 4);*/
@@ -1216,7 +1242,11 @@ void core_acelp_tcx20_switching_fx(
test();
if ( ( GT_16( snr_acelp, snr_tcx ) ) &&
( LT_16( snr_acelp, add( snr_tcx, 512 /*2.0f Q8*/ ) ) ) &&
+#ifdef ISSUE_1867_replace_overflow_libenc
+ ( LT_16( add_sat( st->prevTempFlatness_fx, currFlatness ), 416 /*3.25f Q7*/ ) || EQ_16( stab_fac, 0x7fff /*1 Q15*/ ) ||
+#else
( LT_16( add_o( st->prevTempFlatness_fx, currFlatness, &Overflow ), 416 /*3.25f Q7*/ ) || EQ_16( stab_fac, 0x7fff /*1 Q15*/ ) ||
+#endif
( EQ_32( st->sr_core, INT_FS_12k8 ) && EQ_16( st->sp_aud_decision0, 1 ) && LT_16( add_sat( st->prevTempFlatness_fx, currFlatness ), 2560 /*20.f Q7*/ ) ) ) &&
( LE_16( st->acelpFramesCount, 6 ) ) )
{
diff --git a/lib_enc/core_enc_reconf_fx.c b/lib_enc/core_enc_reconf_fx.c
index 9e7380aaa8329662fb6ef5546e90a51b6a0f2c7b..5f01935c73450ea01243bd17fdec3e4114958e80 100644
--- a/lib_enc/core_enc_reconf_fx.c
+++ b/lib_enc/core_enc_reconf_fx.c
@@ -4,20 +4,20 @@
#include
#include "options.h"
-//#include "prot_fx.h"
-#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h"
+#include "cnst.h" /* Common constants */
#include "rom_enc.h" /* Encoder static table prototypes */
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
+
/*-----------------------------------------------------------------*
- * Funtion core_coder_reconfig_fx *
+ * Funtion core_coder_reconfig_fx *
* ~~~~~~~~~~~~~~~~~~~ *
* - reconfig core coder when switching to another frame type *
*-----------------------------------------------------------------*/
+
void core_coder_reconfig_fx(
Encoder_State *st,
const Word32 last_total_brate )
diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c
index fb5fd037a51694a3422381d0784d3368ed1f37e3..440c02d049d133739642b664faa1f4021c7eb079 100644
--- a/lib_enc/core_enc_switch_fx.c
+++ b/lib_enc/core_enc_switch_fx.c
@@ -1,13 +1,13 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include
#include "options.h"
#include "prot_fx.h"
#include "cnst.h" /* Common constants */
#include "ivas_cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
@@ -65,7 +65,7 @@ void core_coder_mode_switch_fx(
move32();
st->sr_core = sr_core;
move32();
- st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) );
+ st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) );
assert( st->L_frame == st->sr_core / 50 );
st->tcxonly = (Word8) getTcxonly( st->total_brate );
/* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale ) * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ; */
@@ -235,7 +235,6 @@ void core_coder_mode_switch_ivas_fx(
exp_res = 0;
move16();
-
if ( EQ_16( st->last_core, AMR_WB_CORE ) )
{
bSwitchFromAmrwbIO = 1;
@@ -266,9 +265,7 @@ void core_coder_mode_switch_ivas_fx(
{
st->sr_core = sr_core;
move16();
- Word16 tmp = BASOP_Util_Divide3232_Scale( sr_core, FRAMES_PER_SEC, &exp_res );
- st->L_frame = shr( tmp, sub( 15, exp_res ) ); // Q0
- move16();
+ st->L_frame = extract_l( Mpy_32_32_r( sr_core, ONE_BY_FRAMES_PER_SEC_Q31 ) );
st->tcxonly = getTcxonly_fx( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format );
move16();
@@ -382,7 +379,7 @@ void core_coder_mode_switch_ivas_fx(
move16();
IF( hTcxEnc != NULL )
{
- hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/
+ hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) );
move16();
}
st->currEnergyHF_fx = 0;
diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c
index 46e980f5a9912165e1fdbb538334f24900e07835..337e1200bc2e89648068ff2c00f556bfd7378c2a 100644
--- a/lib_enc/core_switching_enc_fx.c
+++ b/lib_enc/core_switching_enc_fx.c
@@ -1,13 +1,12 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "rom_enc.h" /* Encoder static table prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "rom_com.h" /* Static table prototypes */
-//#include "prot_fx.h" /* Function prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "rom_enc.h" /* Encoder static table prototypes */
+#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "ivas_prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
@@ -178,8 +177,16 @@ void core_switching_pre_enc_fx(
test();
test();
- IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) ||
- ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) )
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
+ IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) /* EVS and HQ -> ACELP */ ||
+ ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) ||
+ ( st_fx->core == ACELP_CORE && GT_16( st_fx->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ )
{
IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
{
@@ -793,8 +800,11 @@ void core_switching_pre_enc_ivas_fx(
test();
test();
test();
- IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) ||
- ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) )
+ test();
+ test();
+ IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) /* EVS and HQ -> ACELP */ ||
+ ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) ||
+ ( st_fx->core == ACELP_CORE && GT_16( st_fx->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ )
{
IF( EQ_16( st_fx->L_frame, L_FRAME16k ) )
{
diff --git a/lib_enc/corr_xh_fx.c b/lib_enc/corr_xh_fx.c
index 56b22c2069b96dd3ce2e6b283ebd2c5e7ccfb8ca..135d560d16fd5005c0ee426840836d377042b6b3 100644
--- a/lib_enc/corr_xh_fx.c
+++ b/lib_enc/corr_xh_fx.c
@@ -31,9 +31,11 @@ void corr_xh_fx(
{
Word16 i, j, k;
Word32 L_tmp, y32[L_SUBFR], L_maxloc, L_tot;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
/* first keep the result on 32 bits and find absolute maximum */
@@ -47,7 +49,11 @@ void corr_xh_fx(
L_tmp = L_mac( 1L, x[i], h[0] ); /* 1 -> to avoid null dn[] Qx+15*/
FOR( j = i; j < L_SUBFR - 1; j++ )
{
- L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); /*Qx+15*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, x[j + 1], h[j + 1 - i] ); /*Qx+15*/
+#else
+ L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); /*Qx+15*/
+#endif
}
y32[i] = L_tmp; /*Qx+15*/
@@ -57,8 +63,13 @@ void corr_xh_fx(
}
/* tot += 3*max / 8 */
L_maxloc = L_shr( L_maxloc, 2 );
- L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */
- L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tot = L_add_sat( L_tot, L_maxloc ); /* +max/4 */
+ L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */
+#else
+ L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */
+ L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
+#endif
}
/* Find the number of right shifts to do on y32[] so that */
@@ -82,9 +93,11 @@ void corr_hh_ivas_fx(
{
Word16 i, j, k;
Word32 L_tmp, y32[L_SUBFR * 2], L_maxloc, L_tot;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
/* first keep the result on 32 bits and find absolute maximum */
@@ -98,7 +111,11 @@ void corr_hh_ivas_fx(
L_tmp = L_mac( 1L, shr( h[i], 3 ), shr( h[0], 3 ) ); /* 1 -> to avoid null dn[] */ // 2*(15 - norm_s(h[0]) -3) - 1
FOR( j = i; j < L_subfr - 1; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, shr( h[j + 1], 3 ), shr( h[j + 1 - i], 3 ) ); // 2*(15 - norm_s(h[0]) -3) - 1 //?sat
+#else
L_tmp = L_mac_o( L_tmp, shr( h[j + 1], 3 ), shr( h[j + 1 - i], 3 ), &Overflow ); // 2*(15 - norm_s(h[0]) -3) - 1
+#endif
}
y32[i] = L_tmp; // 2*(15 - norm_s(h[0]) -3) - 1
@@ -108,8 +125,13 @@ void corr_hh_ivas_fx(
}
/* tot += 3*max / 8 */
L_maxloc = L_shr( L_maxloc, 2 );
- L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */
- L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tot = L_add_sat( L_tot, L_maxloc ); /* +max/4 */
+ L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */
+#else
+ L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */
+ L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
+#endif
}
/* Find the number of right shifts to do on y32[] so that */
@@ -139,9 +161,11 @@ void corr_xh_ivas_fx(
{
Word16 i, j, k;
Word32 L_tmp, y32[L_SUBFR * 2], L_maxloc, L_tot;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
/* first keep the result on 32 bits and find absolute maximum */
@@ -155,7 +179,11 @@ void corr_xh_ivas_fx(
L_tmp = L_mac( 0, x[i], h[0] ); // Qx+(14 - norm_s(h[0])) + 1
FOR( j = i; j < L_subfr - 1; j++ )
{
- L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); // Qx+(14 - norm_s(h[0])) + 1
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, x[j + 1], h[j + 1 - i] ); // Qx+(14 - norm_s(h[0])) + 1
+#else
+ L_tmp = L_mac_o( L_tmp, x[j + 1], h[j + 1 - i], &Overflow ); // Qx+(14 - norm_s(h[0])) + 1
+#endif
}
y32[i] = L_tmp; // Qx+(14 - norm_s(h[0])) + 1
@@ -165,8 +193,13 @@ void corr_xh_ivas_fx(
}
/* tot += 3*max / 8 */
L_maxloc = L_shr( L_maxloc, 2 );
- L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */
- L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tot = L_add_sat( L_tot, L_maxloc ); /* +max/4 */
+ L_tot = L_add_sat( L_tot, L_shr( L_maxloc, 1 ) ); /* +max/8 */
+#else
+ L_tot = L_add_o( L_tot, L_maxloc, &Overflow ); /* +max/4 */
+ L_tot = L_add_o( L_tot, L_shr( L_maxloc, 1 ), &Overflow ); /* +max/8 */
+#endif
}
/* Find the number of right shifts to do on y32[] so that */
diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c
index bc5feeb6be1d1e6855a7758070709130ae0d6f7b..6f20edc4f8ba93b90f9e37e9000b58298c404af8 100644
--- a/lib_enc/decision_matrix_enc_fx.c
+++ b/lib_enc/decision_matrix_enc_fx.c
@@ -6,9 +6,7 @@
#include
#include "options.h"
#include "cnst.h" /* Common constants */
-//#include "prot_fx.h"
#include "stat_enc.h"
-#include "rom_com_fx.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
diff --git a/lib_enc/detect_transient_fx.c b/lib_enc/detect_transient_fx.c
index 51f1cb47692fb74518524ee8f876adfb4082a58e..8a95627042e909e9ff6cc187e94c10e814fb1b62 100644
--- a/lib_enc/detect_transient_fx.c
+++ b/lib_enc/detect_transient_fx.c
@@ -62,22 +62,34 @@ static void hp_filter_fx(
{
Word16 i;
Word32 L_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
/*y[0] = 0.4931f * *oldy + 0.7466f*(x[0] - *oldx); */
- L_tmp = L_mult( sub_o( x[0], *oldx, &Overflow ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */
- L_tmp = L_mac_sat( L_tmp, *oldy, 16158 /*0.4931f in Q15*/ ); /*Q_new+16 */
- y[0] = round_fx_sat( L_tmp ); /*Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mult( sub_sat( x[0], *oldx ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */
+#else
+ L_tmp = L_mult( sub_o( x[0], *oldx, &Overflow ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */
+#endif
+ L_tmp = L_mac_sat( L_tmp, *oldy, 16158 /*0.4931f in Q15*/ ); /*Q_new+16 */
+ y[0] = round_fx_sat( L_tmp ); /*Q_new */
FOR( i = 1; i < L; i++ )
{
/*y[i] = 0.4931f*y[i-1] + 0.7466f*(x[i] - x[i-1]); */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mult( sub_sat( x[i], x[i - 1] ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */
+ L_tmp = L_mac_sat( L_tmp, y[i - 1], 16158 /*0.4931f in Q15*/ ); /*Q_new+16 */
+ y[i] = round_fx_sat( L_tmp ); /*Q_new */
+#else
L_tmp = L_mult( sub_o( x[i], x[i - 1], &Overflow ), 24465 /*0.7466f in Q15*/ ); /*Q_new+16 */
L_tmp = L_mac_o( L_tmp, y[i - 1], 16158 /*0.4931f in Q15*/, &Overflow ); /*Q_new+16 */
y[i] = round_fx_o( L_tmp, &Overflow ); /*Q_new */
+#endif
}
*oldx = x[L - 1];
@@ -117,9 +129,11 @@ Word16 detect_transient_fx(
Word32 E_low_fx, E_high_fx;
Word16 temp16, Thres_fx = 0;
Word16 exp;
+#ifdef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
shift = 0;
@@ -151,7 +165,11 @@ Word16 detect_transient_fx(
FOR( i = 0; i < L / 4; i++ )
{
/*EnergyLT += out_filt[i] * out_filt[i]; */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ EnergyLT = L_mac0_sat( EnergyLT, out_filt_fx[i], out_filt_fx[i] ); /*2Q_new */
+#else
EnergyLT = L_mac0_o( EnergyLT, out_filt_fx[i], out_filt_fx[i], &Overflow ); /*2Q_new */
+#endif
}
}
ELSE
@@ -170,14 +188,27 @@ Word16 detect_transient_fx(
FOR( i = 0; i < L / 4; i++ )
{
temp16 = extract_l( L_shr( out_filt_fx[i + blk * ( L / 4 )], 12 ) );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Energy_fx = L_add_sat( Energy_fx, L_mult0( temp16, temp16 ) );
+#else
Energy_fx = L_add_o( Energy_fx, L_mult0( temp16, temp16 ), &Overflow );
- temp16 = shr( in_fx[i + blk * ( L / 4 )], Q_new ); /*Q0*/
- Energy_in_fx[blk + 1] = L_add_o( Energy_in_fx[blk + 1], L_mult0( temp16, temp16 ), &Overflow ); /*Q0*/
+#endif
+ temp16 = shr( in_fx[i + blk * ( L / 4 )], Q_new ); /*Q0*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Energy_in_fx[blk + 1] = L_add_sat( Energy_in_fx[blk + 1], L_mult0( temp16, temp16 ) ); /*Q0*/
+#else
+ Energy_in_fx[blk + 1] = L_add_o( Energy_in_fx[blk + 1], L_mult0( temp16, temp16 ), &Overflow ); /*Q0*/
+#endif
move32();
}
- E_in_fx = L_add_o( E_in_fx, Energy_in_fx[blk + 1], &Overflow ); /*Q0*/
- E_out_fx = L_add_o( E_out_fx, Energy_fx, &Overflow ); /*Q0*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ E_in_fx = L_add_sat( E_in_fx, Energy_in_fx[blk + 1] ); /*Q0*/
+ E_out_fx = L_add_sat( E_out_fx, Energy_fx ); /*Q0*/
+#else
+ E_in_fx = L_add_o( E_in_fx, Energy_in_fx[blk + 1], &Overflow ); /*Q0*/
+ E_out_fx = L_add_o( E_out_fx, Energy_fx, &Overflow ); /*Q0*/
+#endif
Thres_fx = 2185; /*1 /15 Q15*/
move16();
@@ -201,13 +232,21 @@ Word16 detect_transient_fx(
FOR( i = 0; i < L / 8; i++ )
{
/*Energy += out_filt_fx[i + blk*(L/4)] * out_filt_fx[i + blk*(L/4)]; */
- L_tmp = L_mac0_o( L_tmp, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )], &Overflow ); /*2Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac0_sat( L_tmp, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )] ); /*2Q_new */
+#else
+ L_tmp = L_mac0_o( L_tmp, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )], &Overflow ); /*2Q_new */
+#endif
}
L_tmp2 = L_deposit_l( 0 );
FOR( ; i < L / 4; i++ )
{
/*Energy += out_filt_fx[i + blk*(L/4)] * out_filt_fx[i + blk*(L/4)]; */
- L_tmp2 = L_mac0_o( L_tmp2, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )], &Overflow ); /*2Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp2 = L_mac0_sat( L_tmp2, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )] ); /*2Q_new */
+#else
+ L_tmp2 = L_mac0_o( L_tmp2, out_filt_fx[i + blk * ( L / 4 )], out_filt_fx[i + blk * ( L / 4 )], &Overflow ); /*2Q_new */
+#endif
}
Overflow = 0;
move16();
@@ -218,10 +257,14 @@ Word16 detect_transient_fx(
shift = 1;
move16();
}
+#ifndef ISSUE_1867_replace_overflow_libenc
Overflow = 0;
move16();
Energy = L_add_o( L_shr( L_tmp, shift ), L_shr( L_tmp2, shift ), &Overflow ); /*2Q_new - shift*/
+#else
+ Energy = L_add_sat( L_shr( L_tmp, shift ), L_shr( L_tmp2, shift ) ); /*2Q_new - shift*/
+#endif
test();
IF( EQ_16( st_fx->extl, SWB_BWE ) || EQ_16( st_fx->extl, FB_BWE ) )
{
@@ -262,7 +305,11 @@ Word16 detect_transient_fx(
}
/*EnergyLT = 0.75f*EnergyLT + 0.25f*Energy; */
/*0.75f*EnergyLT in Q0 //0.25f*Energy in Q0 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ EnergyLT = L_add_sat( Mult_32_16( EnergyLT, 24576 /*0.75f in Q15*/ ), Mult_32_16( Energy, shl( 8192 /*0.25 in Q15*/, shift ) ) ); /*2Q_new */
+#else
EnergyLT = L_add_o( Mult_32_16( EnergyLT, 24576 /*0.75f in Q15*/ ), Mult_32_16( Energy, shl( 8192 /*0.25 in Q15*/, shift ) ), &Overflow ); /*2Q_new */
+#endif
}
}
st_fx->EnergyLT_fx = EnergyLT;
diff --git a/lib_enc/diffcod_fx.c b/lib_enc/diffcod_fx.c
index 51a31fa8ae82ba811147417ac2efaec44079eaa6..6a14a27eec3ade5551c7eebb02b38d1c8185dea9 100644
--- a/lib_enc/diffcod_fx.c
+++ b/lib_enc/diffcod_fx.c
@@ -1,14 +1,15 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Compilation switches */
-#include "rom_com_fx.h" /* Static table prototypes */
-//#include "prot_fx.h" /* Function Prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Compilation switches */
+#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*--------------------------------------------------------------------------*/
/* Function diffcod */
/* ~~~~~~~~~~~~~~~~~ */
diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c
index 247dcbda36417b85610b2bf4a28fd99fe26c9ae8..10ec0dd8bcb86f9468d70e8b96a4ef1744a22ed8 100644
--- a/lib_enc/dtx_fx.c
+++ b/lib_enc/dtx_fx.c
@@ -1,19 +1,20 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h"
#include "rom_com.h"
-// #include "basop_mpy.h"
#include
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* Local constants
*-------------------------------------------------------------------*/
+
#define ALPHA_ENER_FAST_FX 29491 /* Fast adaptation (noise down, speech up) */
#define ALPHA_ENER_SLOW_FX 32440 /* Fast adaptation (noise down, speech up) */
@@ -33,11 +34,14 @@
#define MAX_BRATE_DTX_EVS ACELP_24k40 /* maximum bitrate to which the default DTX is applied in EVS; otherwise DTX is applied only in silence */
#define MAX_BRATE_DTX_IVAS IVAS_80k /* maximum bitrate to which the default DTX is applied in IVAS; otherwise DTX is applied only in silence */
+
/*-------------------------------------------------------------------*
* Local function prototypes
*-------------------------------------------------------------------*/
static void update_SID_cnt_fx( DTX_ENC_HANDLE hDtxEnc, const Word32 core_brate, const Word16 Opt_AMR_WB );
+
+
/*==================================================================================*/
/* FUNCTION : dtx_ivas_fx() */
/*----------------------------------------------------------------------------------*/
@@ -74,9 +78,11 @@ void dtx_ivas_fx(
TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc;
Word16 last_br_cng_flag, last_br_flag, br_dtx_flag;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Word32 total_brate_ref;
@@ -461,7 +467,11 @@ void dtx_ivas_fx(
speech++;
FOR( i = 1; i < L_FRAME / 16; i++ )
{
- L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac0_sat( L_tmp, *speech, *speech ); /*2*Q_speech*/
+#else
+ L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/
+#endif
speech++;
}
hDtxEnc->frame_ener_fx = L_add( hDtxEnc->frame_ener_fx, L_shr( L_tmp, Q_speech2 ) ); /* Q(-7) */
@@ -631,9 +641,11 @@ void dtx_fx(
TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc;
Word16 last_br_cng_flag, last_br_flag, br_dtx_flag;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
IF( st_fx->dtx_sce_sba != 0 )
@@ -656,7 +668,7 @@ void dtx_fx(
/* Initialization */
IF( st_fx->ini_frame == 0 )
{
- st_fx->active_fr_cnt_fx = CNG_TYPE_HO;
+ st_fx->active_cnt = CNG_TYPE_HO;
move16();
st_fx->cng_type = FD_CNG;
@@ -756,7 +768,7 @@ void dtx_fx(
st_fx->fd_cng_reset_flag == 0 )
{
/* reset counter */
- st_fx->active_fr_cnt_fx = 0;
+ st_fx->active_cnt = 0;
move16();
IF( st_fx->Opt_AMR_WB )
@@ -878,7 +890,7 @@ void dtx_fx(
move16(); /* reset the counter of CNG frames for averaging */
}
test();
- IF( GE_16( st_fx->active_fr_cnt_fx, CNG_TYPE_HO ) && st_fx->Opt_AMR_WB == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
+ IF( GE_16( st_fx->active_cnt, CNG_TYPE_HO ) && st_fx->Opt_AMR_WB == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) )
{
IF( EQ_16( st_fx->element_mode, IVAS_SCE ) )
{
@@ -911,8 +923,8 @@ void dtx_fx(
st_fx->cng_type = LP_CNG;
move16();
}
- st_fx->active_fr_cnt_fx = add( st_fx->active_fr_cnt_fx, 1 );
- st_fx->active_fr_cnt_fx = s_min( st_fx->active_fr_cnt_fx, 200 );
+ st_fx->active_cnt = add( st_fx->active_cnt, 1 );
+ st_fx->active_cnt = s_min( st_fx->active_cnt, 200 );
}
/*------------------------------------------------------------------------*
@@ -931,7 +943,11 @@ void dtx_fx(
speech++;
FOR( i = 1; i < L_FRAME / 16; i++ )
{
- L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac0_sat( L_tmp, *speech, *speech ); /*2*Q_speech*/
+#else
+ L_tmp = L_mac0_o( L_tmp, *speech, *speech, &Overflow ); /*2*Q_speech*/
+#endif
speech++;
}
hDtxEnc->frame_ener_fx = L_add( hDtxEnc->frame_ener_fx, L_shr( L_tmp, Q_speech2 ) ); /*Q(-7) */
@@ -1236,8 +1252,10 @@ void dtx_hangover_control_fx(
VAD_HANDLE hVAD = st_fx->hVAD;
DTX_ENC_HANDLE hDtxEnc = st_fx->hDtxEnc;
TD_CNG_ENC_HANDLE hTdCngEnc = st_fx->hTdCngEnc;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/* get current frame exc energy in log2 */
@@ -1407,7 +1425,11 @@ void dtx_hangover_control_fx(
move16();
FOR( j = 0; j < m; j++ )
{
- lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ lsp_est[i] = add_sat( lsp_est[i], tmp[j * M + i] ); /*Q15 */
+#else
+ lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */
+#endif
}
lsp_est[i] = sub( lsp_est[i], tmp[max_idx[0] * M + i] ); /*Q15 */
@@ -1423,12 +1445,20 @@ void dtx_hangover_control_fx(
move16();
FOR( j = 0; j < m; j++ )
{
- lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ lsp_est[i] = add_sat( lsp_est[i], tmp[j * M + i] ); /*Q15 */
+#else
+ lsp_est[i] = add_o( lsp_est[i], tmp[j * M + i], &Overflow ); /*Q15 */
+#endif
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ lsp_est[i] = sub_sat( lsp_est[i], add_sat( tmp[max_idx[0] * M + i], tmp[max_idx[1] * M + i] ) ); /*Q15 */
+#else
lsp_est[i] = sub_o( lsp_est[i], add_o( tmp[max_idx[0] * M + i], tmp[max_idx[1] * M + i], &Overflow ), &Overflow ); /*Q15 */
- S_tmp = div_s( 1, sub( m, 2 ) ); /*Q15 */
- lsp_est[i] = mult_r( lsp_est[i], S_tmp ); /*Q15 */
+#endif
+ S_tmp = div_s( 1, sub( m, 2 ) ); /*Q15 */
+ lsp_est[i] = mult_r( lsp_est[i], S_tmp ); /*Q15 */
}
}
@@ -1436,8 +1466,12 @@ void dtx_hangover_control_fx(
move16();
FOR( i = 0; i < M; i++ )
{
- Dlsp_n2e = add_o( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ), &Overflow ); /*Q15 */
- lsp_est[i] = add( mult_r( 26214, lsp_est[i] ), mult_r( 6554, lsp_new_fx[i] ) ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Dlsp_n2e = add_sat( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ) ); /*Q15 */
+#else
+ Dlsp_n2e = add_o( Dlsp_n2e, abs_s( sub( lsp_new_fx[i], lsp_est[i] ) ), &Overflow ); /*Q15 */
+#endif
+ lsp_est[i] = add( mult_r( 26214, lsp_est[i] ), mult_r( 6554, lsp_new_fx[i] ) ); /*Q15 */
}
/* get deviation of CNG parameters between newly estimated and current state memory */
@@ -1449,7 +1483,11 @@ void dtx_hangover_control_fx(
FOR( i = 0; i < M; i++ )
{
S_tmp = abs_s( sub( hDtxEnc->lspCNG_fx[i], lsp_est[i] ) ); /*Q15 */
- Dlsp = add_o( Dlsp, S_tmp, &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Dlsp = add_sat( Dlsp, S_tmp ); /*Q15 */
+#else
+ Dlsp = add_o( Dlsp, S_tmp, &Overflow ); /*Q15 */
+#endif
IF( GT_16( S_tmp, S_max ) )
{
S_max = S_tmp; /*Q15 */
diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c
index f6a8e65b26ca963080b429dcf85e0661e0902f0c..16d4bd260abb1cbc99d22605221e3f9859f2e134 100644
--- a/lib_enc/enc_acelp_fx.c
+++ b/lib_enc/enc_acelp_fx.c
@@ -1,15 +1,14 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "typedef.h"
#include
#include
#include "options.h"
#include "cnst.h"
-//#include "prot_fx.h"
#include "basop_util.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "rom_enc.h"
#include "prot_fx.h" /* Function prototypes */
@@ -51,16 +50,26 @@ void E_ACELP_corrmatrix_fx( Word16 h[] /*Q12*/, Word16 sign[] /*Q0*/, Word16 vec
* Returns:
* void
*/
-void E_ACELP_h_vec_corr1_fx( Word16 h[] /*Qx*/, Word16 vec[] /*Qx*/, UWord8 track /*Q0*/, Word16 sign[] /*Q15*/, Word16 ( *rrixix )[16] /*Q9*/, Word16 cor[] /*Q9*/, Word16 dn2_pos[] /*Q0*/, Word16 nb_pulse /*Q0*/ )
+void E_ACELP_h_vec_corr1_fx(
+ Word16 h[] /*Qx*/,
+ Word16 vec[] /*Qx*/,
+ UWord8 track /*Q0*/,
+ Word16 sign[] /*Q15*/,
+ Word16 ( *rrixix )[16] /*Q9*/,
+ Word16 cor[] /*Q9*/,
+ Word16 dn2_pos[] /*Q0*/,
+ Word16 nb_pulse /*Q0*/ )
{
Word16 i, j;
Word16 dn, corr;
Word16 *dn2;
Word16 *p0, *p1, *p2;
Word32 L_sum;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
dn2 = &dn2_pos[( track * 8 )]; /*Q0*/
@@ -75,20 +84,36 @@ void E_ACELP_h_vec_corr1_fx( Word16 h[] /*Qx*/, Word16 vec[] /*Qx*/, UWord8 trac
p2 = &vec[dn]; /*Qx*/
FOR( j = dn; j < L_SUBFR - 1; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_sum = L_mac_sat( L_sum, *p1++, *p2++ ); /*2*Qx+1*/
+#else
L_sum = L_mac_o( L_sum, *p1++, *p2++, &Overflow ); /*2*Qx+1*/
+#endif
}
- corr = mac_ro( L_sum, *p1++, *p2++, &Overflow ); /*Q9*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ corr = mac_r_sat( L_sum, *p1++, *p2++ ); /*Q9*/
+#else
+ corr = mac_ro( L_sum, *p1++, *p2++, &Overflow ); /*Q9*/
+#endif
/*cor[dn >> 2] = sign[dn] * s + p0[dn >> 2];*/
j = shr( dn, 2 );
if ( sign[dn] > 0 )
{
- corr = add_o( p0[j], corr, &Overflow ); /*Q9*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ corr = add_sat( p0[j], corr ); /*Q9*/
+#else
+ corr = add_o( p0[j], corr, &Overflow ); /*Q9*/
+#endif
}
if ( sign[dn] < 0 )
{
- corr = sub_o( p0[j], corr, &Overflow ); /*Q9*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ corr = sub_sat( p0[j], corr ); /*Q9*/
+#else
+ corr = sub_o( p0[j], corr, &Overflow ); /*Q9*/
+#endif
}
cor[j] = corr; /*Q9*/
@@ -97,14 +122,23 @@ void E_ACELP_h_vec_corr1_fx( Word16 h[] /*Qx*/, Word16 vec[] /*Qx*/, UWord8 trac
return;
}
-void E_ACELP_h_vec_corr2_fx( Word16 h[] /*Qx*/, Word16 vec[] /*Qx*/, UWord8 track /*Q0*/, Word16 sign[] /*Q15*/, Word16 ( *rrixix )[16] /*Q9*/, Word16 cor[] /*Q9*/ )
+
+void E_ACELP_h_vec_corr2_fx(
+ Word16 h[] /*Qx*/,
+ Word16 vec[] /*Qx*/,
+ UWord8 track /*Q0*/,
+ Word16 sign[] /*Q15*/,
+ Word16 ( *rrixix )[16] /*Q9*/,
+ Word16 cor[] /*Q9*/ )
{
Word16 i, j, pos, corr;
Word16 *p0, *p1, *p2;
Word32 L_sum;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
p0 = rrixix[track]; /*Q9*/
@@ -118,12 +152,30 @@ void E_ACELP_h_vec_corr2_fx( Word16 h[] /*Qx*/, Word16 vec[] /*Qx*/, UWord8 trac
p2 = &vec[pos]; /*Qx*/
FOR( j = pos; j < L_SUBFR - 1; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_sum = L_mac_sat( L_sum, *p1++, *p2++ ); /* 2*Qx+1 */
+#else
L_sum = L_mac_o( L_sum, *p1++, *p2++, &Overflow ); /* 2*Qx+1 */
+#endif
}
- corr = mac_ro( L_sum, *p1++, *p2++, &Overflow ); /*Q9*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ corr = mac_r_sat( L_sum, *p1++, *p2++ ); /*Q9*/
+#else
+ corr = mac_ro( L_sum, *p1++, *p2++, &Overflow ); /*Q9*/
+#endif
/*cor[i] = s * sign[track] + p0[i];*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( sign[pos] > 0 )
+ {
+ corr = add_sat( *p0++, corr ); /*Q9*/
+ }
+ if ( sign[pos] < 0 )
+ {
+ corr = sub_sat( *p0++, corr ); /*Q9*/
+ }
+#else
if ( sign[pos] > 0 )
{
corr = add_o( *p0++, corr, &Overflow ); /*Q9*/
@@ -132,6 +184,7 @@ void E_ACELP_h_vec_corr2_fx( Word16 h[] /*Qx*/, Word16 vec[] /*Qx*/, UWord8 trac
{
corr = sub_o( *p0++, corr, &Overflow ); /*Q9*/
}
+#endif
cor[i] = corr; /*Q9*/
move16();
@@ -164,7 +217,19 @@ void E_ACELP_h_vec_corr2_fx( Word16 h[] /*Qx*/, Word16 vec[] /*Qx*/, UWord8 trac
* Returns:
* void
*/
-static void E_ACELP_2pulse_search( Word16 nb_pos_ix /*Q0*/, UWord8 track_x /*Q0*/, UWord8 track_y /*Q0*/, Word16 *ps /*Qdn*/, Word16 *alp /*Qx*/, Word16 *ix /*Q0*/, Word16 *iy /*Q0*/, Word16 dn[] /*Qdn*/, Word16 *dn2 /*Q0*/, Word16 cor_x[] /*Qx*/, Word16 cor_y[] /*Qx*/, Word16 ( *rrixiy )[256] /*Q9*/ )
+static void E_ACELP_2pulse_search(
+ Word16 nb_pos_ix /*Q0*/,
+ UWord8 track_x /*Q0*/,
+ UWord8 track_y /*Q0*/,
+ Word16 *ps /*Qdn*/,
+ Word16 *alp /*Qx*/,
+ Word16 *ix /*Q0*/,
+ Word16 *iy /*Q0*/,
+ Word16 dn[] /*Qdn*/,
+ Word16 *dn2 /*Q0*/,
+ Word16 cor_x[] /*Qx*/,
+ Word16 cor_y[] /*Qx*/,
+ Word16 ( *rrixiy )[256] /*Q9*/ )
{
Word16 x, x2, y, i, *pos_x;
Word16 ps0, ps1, alp2_16, ps2, sq;
@@ -174,10 +239,12 @@ static void E_ACELP_2pulse_search( Word16 nb_pos_ix /*Q0*/, UWord8 track_x /*Q0*
Word32 xy_save;
Word16 check = 0; /* debug code not instrumented */
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
/* eight dn2 max positions per track */
@@ -195,7 +262,11 @@ static void E_ACELP_2pulse_search( Word16 nb_pos_ix /*Q0*/, UWord8 track_x /*Q0*
sqk[0] = -1;
move16();
x2 = shr( pos_x[0], 2 ); /*Qdn*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( mac_r_sat( L_mac_sat( L_mac_sat( alp0, cor_x[x2], _1_ ), cor_y[0], _1_ ), rrixiy[track_x][( x2 * 16 )], _1_ ) < 0 )
+#else
if ( mac_ro( L_mac_o( L_mac_o( alp0, cor_x[x2], _1_, &Overflow ), cor_y[0], _1_, &Overflow ), rrixiy[track_x][( x2 * 16 )], _1_, &Overflow ) < 0 )
+#endif
{
sqk[0] = 1;
move16();
@@ -215,7 +286,11 @@ static void E_ACELP_2pulse_search( Word16 nb_pos_ix /*Q0*/, UWord8 track_x /*Q0*
ps1 = add( ps0, dn[x] ); /*Qdn*/
/*alp1 = alp0 + cor_x[x2];*/
- alp1 = L_mac_o( alp0, cor_x[x2], _1_, &Overflow ); /*Q22*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp1 = L_mac_sat( alp0, cor_x[x2], _1_ ); /*Q22*/
+#else
+ alp1 = L_mac_o( alp0, cor_x[x2], _1_, &Overflow ); /*Q22*/
+#endif
p1 = cor_y; /*Qx*/
p2 = &rrixiy[track_x][( x2 * 16 )]; /*Q9*/
@@ -227,9 +302,14 @@ static void E_ACELP_2pulse_search( Word16 nb_pos_ix /*Q0*/, UWord8 track_x /*Q0*
move16();
/*alp2 = alp1 + (*p1++) + (*p2++);*/
- alp2 = L_mac_o( alp1, *p1++, _1_, &Overflow ); /*Qx+12+1*/
- alp2_16 = mac_ro( alp2, *p2++, _1_, &Overflow ); /*Q6*/
- alpk[1 - ik] = alp2_16; /*Q6*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp2 = L_mac_sat( alp1, *p1++, _1_ ); /*Qx+12+1*/
+ alp2_16 = mac_r_sat( alp2, *p2++, _1_ ); /*Q6*/
+#else
+ alp2 = L_mac_o( alp1, *p1++, _1_, &Overflow ); /*Qx+12+1*/
+ alp2_16 = mac_ro( alp2, *p2++, _1_, &Overflow ); /*Q6*/
+#endif
+ alpk[1 - ik] = alp2_16; /*Q6*/
move16();
/*sq = ps2 * ps2;*/
@@ -291,13 +371,14 @@ static void E_ACELP_2pulse_search( Word16 nb_pos_ix /*Q0*/, UWord8 track_x /*Q0*
* Returns:
* void
*/
-static void E_ACELP_1pulse_search( UWord8 tracks[2],
- Word16 *ps, /*Qdn*/
- Word16 *alp, /*Qx*/
- Word16 *ix, /*Q0*/
- Word16 dn[], /*Qdn*/
- Word16 cor_x[], /*Q6*/
- Word16 cor_y[] /*Q6*/ )
+static void E_ACELP_1pulse_search(
+ UWord8 tracks[2],
+ Word16 *ps, /*Qdn*/
+ Word16 *alp, /*Qx*/
+ Word16 *ix, /*Q0*/
+ Word16 dn[], /*Qdn*/
+ Word16 cor_x[], /*Q6*/
+ Word16 cor_y[] /*Q6*/ )
{
Word16 x, x_save = 0;
Word16 ps0;
@@ -400,7 +481,11 @@ static void E_ACELP_1pulse_search( UWord8 tracks[2],
* Returns:
* void
*/
-static void E_ACELP_xh_corr( Word16 *x /*Qx*/, Word16 *y /*Qy*/, Word16 *h /*Q12*/, Word16 L_subfr /*Q0*/ )
+static void E_ACELP_xh_corr(
+ Word16 *x /*Qx*/,
+ Word16 *y /*Qy*/,
+ Word16 *h /*Q12*/,
+ Word16 L_subfr /*Q0*/ )
{
Word16 i, j, k;
Word32 L_tmp, y32[L_SUBFR16k], L_maxloc, L_tot;
@@ -452,7 +537,11 @@ static void E_ACELP_xh_corr( Word16 *x /*Qx*/, Word16 *y /*Qy*/, Word16 *h /*Q12
* \param bits amount of target headroom bits for y
* \return exponent of y
*/
-Word16 E_ACELP_hh_corr( Word16 *x /*Q11*/, Word16 *y /*Qy*/, Word16 L_subfr /*Q0*/, Word16 bits /*Q0*/ )
+Word16 E_ACELP_hh_corr(
+ Word16 *x /*Q11*/,
+ Word16 *y /*Qy*/,
+ Word16 L_subfr /*Q0*/,
+ Word16 bits /*Q0*/ )
{
Word16 i, j, k = 0; /* initialize just to avoid compiler warning */
Word32 L_tmp, L_sum;
@@ -518,24 +607,40 @@ Word16 E_ACELP_hh_corr( Word16 *x /*Q11*/, Word16 *y /*Qy*/, Word16 L_subfr /*Q0
* Returns:
* pitch gain (0 ... 1.2F) (Q14)
*/
-Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn*/, ACELP_CbkCorr *g_corr, Word16 norm_flag /*Q0*/, Word16 L_subfr /*Q0*/, Word16 exp_xn )
+Word16 E_ACELP_xy1_corr_fx(
+ Word16 xn[] /*Q15-exp_xn*/,
+ Word16 y1[] /*Q15-exp_xn*/,
+ ACELP_CbkCorr *g_corr,
+ Word16 norm_flag /*Q0*/,
+ Word16 L_subfr /*Q0*/,
+ Word16 exp_xn )
{
Word16 i, Q_xn;
Word16 xy, yy, exp_xy, exp_yy, gain;
Word32 L_off;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
L_off = L_shr( 10737418l /*0.01f/2.0f Q31*/, s_min( add( exp_xn, exp_xn ), 31 ) );
L_off = L_max( 1, L_off ); /* ensure at least a '1' */
/* Compute scalar product t1: */
- yy = round_fx_o( Dot_product15_offs( y1, y1, L_subfr, &exp_yy, L_off ), &Overflow ); /*Q15 - exp_yy*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ yy = round_fx_sat( Dot_product15_offs( y1, y1, L_subfr, &exp_yy, L_off ) ); /*Q15 - exp_yy*/
+#else
+ yy = round_fx_o( Dot_product15_offs( y1, y1, L_subfr, &exp_yy, L_off ), &Overflow ); /*Q15 - exp_yy*/
+#endif
/* Compute scalar product t0: */
- xy = round_fx_o( Dot_product12_offs( xn, y1, L_subfr, &exp_xy, L_off ), &Overflow ); /*Q15 - exp_xy*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ xy = round_fx_sat( Dot_product12_offs( xn, y1, L_subfr, &exp_xy, L_off ) ); /*Q15 - exp_xy*/
+#else
+ xy = round_fx_o( Dot_product12_offs( xn, y1, L_subfr, &exp_xy, L_off ), &Overflow ); /*Q15 - exp_xy*/
+#endif
/* Compute doubled format out of the exponent */
Q_xn = shl( sub( 15, exp_xn ), 1 );
g_corr->y1y1 = yy;
@@ -563,11 +668,7 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn
i = add( exp_xy, 1 - 1 ); /* -1 -> gain in Q14 */
i = sub( i, exp_yy );
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1796_replace_shl_o
gain = shl_sat( gain, i ); /* saturation can occur here */
-#else
- gain = shl_o( gain, i, &Overflow ); /* saturation can occur here */
-#endif
BASOP_SATURATE_WARNING_ON_EVS
/* gain = s_max(0, gain); */ /* see above xy < 0. */
@@ -581,7 +682,11 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn
Word16 tmp, exp_tmp, exp_div;
/* Compute scalar product */
- tmp = round_fx_o( Dot_product12_offs( xn, xn, L_subfr, &exp_tmp, 1 ), &Overflow ); /*Q15 - exp_tmp*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = round_fx_sat( Dot_product12_offs( xn, xn, L_subfr, &exp_tmp, 1 ) ); /*Q15 - exp_tmp*/
+#else
+ tmp = round_fx_o( Dot_product12_offs( xn, xn, L_subfr, &exp_tmp, 1 ), &Overflow ); /*Q15 - exp_tmp*/
+#endif
/* gain_p_snr = sqrt(/) */
tmp = BASOP_Util_Divide1616_Scale( tmp, yy, &exp_div );
exp_tmp = add( sub( exp_tmp, exp_yy ), exp_div );
@@ -591,7 +696,11 @@ Word16 E_ACELP_xy1_corr_fx( Word16 xn[] /*Q15-exp_xn*/, Word16 y1[] /*Q15-exp_xn
/* Note: shl works as shl or shr. */
exp_tmp = sub( exp_tmp, 1 );
BASOP_SATURATE_WARNING_OFF_EVS
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = round_fx_sat( L_shl_sat( Mpy_32_16_1( 1717986944l /*ACELP_GAINS_CONST Q31*/, tmp ), exp_tmp ) ); /*Q14*/
+#else
tmp = round_fx_o( L_shl_o( Mpy_32_16_1( 1717986944l /*ACELP_GAINS_CONST Q31*/, tmp ), exp_tmp, &Overflow ), &Overflow ); /*Q14*/
+#endif
BASOP_SATURATE_WARNING_ON_EVS
gain = s_min( gain, tmp ); /*Q14*/
@@ -622,7 +731,13 @@ bail:
* Returns:
* pitch gain (0 ... 1.2F)
*/
-void E_ACELP_xy2_corr( Word16 xn[] /*Q_xn*/, Word16 y1[] /*Q_xn*/, Word16 y2[] /*Q9*/, ACELP_CbkCorr *g_corr, Word16 L_subfr /*Q0*/, Word16 exp_xn )
+void E_ACELP_xy2_corr(
+ Word16 xn[] /*Q_xn*/,
+ Word16 y1[] /*Q_xn*/,
+ Word16 y2[] /*Q9*/,
+ ACELP_CbkCorr *g_corr,
+ Word16 L_subfr /*Q0*/,
+ Word16 exp_xn )
{
Word16 xny2, y2y2, y1y2, xx, exp_xny2, exp_y2y2, exp_y1y2, exp_xx;
Word32 L_off;
@@ -684,13 +799,20 @@ void E_ACELP_xy2_corr( Word16 xn[] /*Q_xn*/, Word16 y1[] /*Q_xn*/, Word16 y2[] /
* Returns:
* void
*/
-void E_ACELP_codebook_target_update_fx( Word16 *x /*Q_xn*/, Word16 *x2 /*Q_xn*/, Word16 *y /*Q_xn*/, Word16 gain /*Q14*/, Word16 L_subfr /*Q0*/ )
+void E_ACELP_codebook_target_update_fx(
+ Word16 *x /*Q_xn*/,
+ Word16 *x2 /*Q_xn*/,
+ Word16 *y /*Q_xn*/,
+ Word16 gain /*Q14*/,
+ Word16 L_subfr /*Q0*/ )
{
Word16 i, Q15_flag;
Word32 L_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
assert( gain >= 0 );
@@ -708,9 +830,17 @@ void E_ACELP_codebook_target_update_fx( Word16 *x /*Q_xn*/, Word16 *x2 /*Q_xn*/,
L_tmp = L_deposit_h( x[i] ); /*Q_xn+16*/
if ( Q15_flag == 0 )
{
- L_tmp = L_msu_o( L_tmp, y[i], gain, &Overflow ); /*Q_xn+15*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_msu_sat( L_tmp, y[i], gain ); /*Q_xn+15*/
+#else
+ L_tmp = L_msu_o( L_tmp, y[i], gain, &Overflow ); /*Q_xn+15*/
+#endif
}
- x2[i] = msu_ro( L_tmp, y[i], gain, &Overflow ); /*Q_xn*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ x2[i] = msu_r_sat( L_tmp, y[i], gain ); /*Q_xn*/
+#else
+ x2[i] = msu_ro( L_tmp, y[i], gain, &Overflow ); /*Q_xn*/
+#endif
move16();
}
}
@@ -736,7 +866,15 @@ void E_ACELP_codebook_target_update_fx( Word16 *x /*Q_xn*/, Word16 *x2 /*Q_xn*/,
* Returns:
* void
*/
-void E_ACELP_pulsesign( const Word16 cn[] /*Q_xn*/, Word16 dn[] /*Qdn*/, Word16 dn2[] /*Qdn2*/, Word16 sign[] /*Q13*/, Word16 vec[] /*Q15*/, const Word16 alp /*Q13*/, const Word16 sign_val /*Q15*/, const Word16 L_subfr /*Q0*/ )
+void E_ACELP_pulsesign(
+ const Word16 cn[] /*Q_xn*/,
+ Word16 dn[] /*Qdn*/,
+ Word16 dn2[] /*Qdn2*/,
+ Word16 sign[] /*Q13*/,
+ Word16 vec[] /*Q15*/,
+ const Word16 alp /*Q13*/,
+ const Word16 sign_val /*Q15*/,
+ const Word16 L_subfr /*Q0*/ )
{
Word16 i;
Word32 Lval, Lcor;
@@ -744,10 +882,12 @@ void E_ACELP_pulsesign( const Word16 cn[] /*Q_xn*/, Word16 dn[] /*Qdn*/, Word16
Word16 signs[3];
Word16 *ptr16;
Word16 val, index;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
/* calculate energy for normalization of cn[] and dn[] */
@@ -756,8 +896,12 @@ void E_ACELP_pulsesign( const Word16 cn[] /*Q_xn*/, Word16 dn[] /*Qdn*/, Word16
FOR( i = 1; i < L_subfr; i++ )
{
- Lval = L_mac0_o( Lval, cn[i], cn[i], &Overflow ); /*2*Q_xn*/
- Lcor = L_mac0( Lcor, dn[i], dn[i] ); /*2*Qdn*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lval = L_mac0_sat( Lval, cn[i], cn[i] ); /*2*Q_xn*/
+#else
+ Lval = L_mac0_o( Lval, cn[i], cn[i], &Overflow ); /*2*Q_xn*/
+#endif
+ Lcor = L_mac0( Lcor, dn[i], dn[i] ); /*2*Qdn*/
}
e_dn = 31;
@@ -773,8 +917,13 @@ void E_ACELP_pulsesign( const Word16 cn[] /*Q_xn*/, Word16 dn[] /*Qdn*/, Word16
if ( i > 0 )
Lcor = L_shr( Lcor, i );
- k_dn = round_fx_o( Lval, &Overflow ); /*Q15 - e_dn*/
- k_cn = round_fx_o( Lcor, &Overflow ); /*Q15 - e_cn*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ k_dn = round_fx_sat( Lval ); /*Q15 - e_dn*/
+ k_cn = round_fx_sat( Lcor ); /*Q15 - e_cn*/
+#else
+ k_dn = round_fx_o( Lval, &Overflow ); /*Q15 - e_dn*/
+ k_cn = round_fx_o( Lcor, &Overflow ); /*Q15 - e_cn*/
+#endif
k_cn = mult_r( 0x2000, k_cn ); /* 1 in Q13 */
k_dn = mult_r( alp, k_dn ); /* alp in Q13 */
@@ -792,9 +941,13 @@ void E_ACELP_pulsesign( const Word16 cn[] /*Q_xn*/, Word16 dn[] /*Qdn*/, Word16
FOR( i = 0; i < L_subfr; i++ )
{
/*cor = (s * cn[i]) + (alp * dn[i]); MULT(1);MAC(1);*/
- Lcor = L_mult( cn[i], k_cn ); /*Q_xn + Q15 - e_cn + 1*/
- Lcor = L_mac( Lcor, dn[i], k_dn ); /*Qdn + Q15 - e_dn + 1*/
- val = round_fx_o( L_shl_o( Lcor, 4, &Overflow ), &Overflow ); /*shifting by 4 may overflow but improves accuracy Qdn + 4 - e_dn*/
+ Lcor = L_mult( cn[i], k_cn ); /*Q_xn + Q15 - e_cn + 1*/
+ Lcor = L_mac( Lcor, dn[i], k_dn ); /*Qdn + Q15 - e_dn + 1*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ val = round_fx_sat( L_shl_sat( Lcor, 4 ) ); /*shifting by 4 may overflow but improves accuracy Qdn + 4 - e_dn*/
+#else
+ val = round_fx_o( L_shl_o( Lcor, 4, &Overflow ), &Overflow ); /*shifting by 4 may overflow but improves accuracy Qdn + 4 - e_dn*/
+#endif
index = shr( val, 15 );
sign[i] = ptr16[index]; /*Q15*/
@@ -813,7 +966,10 @@ void E_ACELP_pulsesign( const Word16 cn[] /*Q_xn*/, Word16 dn[] /*Qdn*/, Word16
}
-void E_ACELP_findcandidates( Word16 dn2[] /*Qx*/, Word16 dn2_pos[] /*Q0*/, Word16 pos_max[] /*Q0*/ )
+void E_ACELP_findcandidates(
+ Word16 dn2[] /*Qx*/,
+ Word16 dn2_pos[] /*Q0*/,
+ Word16 pos_max[] /*Q0*/ )
{
Word16 i, k, j, i8;
Word16 *ps_ptr;
@@ -845,7 +1001,9 @@ void E_ACELP_findcandidates( Word16 dn2[] /*Qx*/, Word16 dn2_pos[] /*Q0*/, Word1
}
-static void E_ACELP_apply_sign( Word16 *p0 /*Qx*/, Word16 *psign0 /*Q15*/ )
+static void E_ACELP_apply_sign(
+ Word16 *p0 /*Qx*/,
+ Word16 *psign0 /*Q15*/ )
{
p0[0] = mult_r( p0[0], psign0[0] ); /*Qx*/
move16();
@@ -879,9 +1037,14 @@ static void E_ACELP_apply_sign( Word16 *p0 /*Qx*/, Word16 *psign0 /*Q15*/ )
move16();
p0[15] = mult_r( p0[15], psign0[60] );
move16();
+
+ return;
}
-void E_ACELP_vec_neg_fx( Word16 h[] /*Qx*/, Word16 h_inv[] /*Qx*/, Word16 L_subfr /*Q0*/ )
+void E_ACELP_vec_neg_fx(
+ Word16 h[] /*Qx*/,
+ Word16 h_inv[] /*Qx*/,
+ Word16 L_subfr /*Q0*/ )
{
Word16 i;
@@ -890,10 +1053,17 @@ void E_ACELP_vec_neg_fx( Word16 h[] /*Qx*/, Word16 h_inv[] /*Qx*/, Word16 L_subf
h_inv[i] = negate( h[i] );
move16();
}
+
+ return;
}
-void E_ACELP_corrmatrix_fx( Word16 h[] /*Q12*/, Word16 sign[] /*Q0*/, Word16 vec[] /*Q15*/, Word16 rrixix[4][16] /*Q9*/, Word16 rrixiy[4][256] /*Q9*/ )
+void E_ACELP_corrmatrix_fx(
+ Word16 h[] /*Q12*/,
+ Word16 sign[] /*Q0*/,
+ Word16 vec[] /*Q15*/,
+ Word16 rrixix[4][16] /*Q9*/,
+ Word16 rrixiy[4][256] /*Q9*/ )
{
Word16 *p0, *p1, *p2, *p3, *psign0, *psign1, *psign2, *psign3;
@@ -931,7 +1101,6 @@ void E_ACELP_corrmatrix_fx( Word16 h[] /*Q12*/, Word16 sign[] /*Q0*/, Word16 vec
*p0-- = round_fx( L_shr( cor, 1 ) ); /* Q9 */
}
-
/*
* Compute rrixiy[][] needed for the codebook search.
*/
@@ -1068,10 +1237,19 @@ void E_ACELP_corrmatrix_fx( Word16 h[] /*Q12*/, Word16 sign[] /*Q0*/, Word16 vec
E_ACELP_apply_sign( p3, psign3 );
p3 += 16;
}
+
return;
}
-void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ )
+void E_ACELP_4tsearch_fx(
+ Word16 dn[] /*Qdn*/,
+ const Word16 cn[] /*Q_xn*/,
+ const Word16 H[] /*Q12*/,
+ Word16 code[] /*Q9*/,
+ const PulseConfig *config,
+ Word16 ind[] /*Q0*/,
+ Word16 y[] /*Qy*/,
+ const Word16 element_mode )
{
Word16 sign[L_SUBFR], vec[L_SUBFR];
Word16 cor_x[16], cor_y[16], h_buf[4 * L_SUBFR];
@@ -1090,11 +1268,12 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
Word32 s, L_tmp;
Word16 nb_pulse, nb_pulse_m2;
Word16 check = 0; /* debug code not instrumented */
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
-
+#endif
alp = config->alp; /* Q13 */ /* initial value for energy of all fixed pulses */
move16();
@@ -1132,7 +1311,11 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
BASOP_SATURATE_WARNING_OFF_EVS
FOR( i = 0; i < L_SUBFR; i++ )
{
- L_tmp = L_mac_o( L_tmp, H[i], H[i], &Overflow ); /*Q25*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, H[i], H[i] ); /*Q25*/
+#else
+ L_tmp = L_mac_o( L_tmp, H[i], H[i], &Overflow ); /*Q25*/
+#endif
}
val = extract_h( L_tmp ); /*Q9*/
BASOP_SATURATE_WARNING_ON_EVS
@@ -1147,18 +1330,21 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
scale = -2;
move16();
}
-
+ test();
+ if ( EQ_16( val, 32767 ) && element_mode > EVS_MONO )
+ {
+ scale = -3;
+ move16();
+ }
Copy_Scale_sig( H, h, L_SUBFR, scale ); /*Q12+scale*/
E_ACELP_vec_neg_fx( h, h_inv, L_SUBFR );
-
/*
* Compute correlation matrices needed for the codebook search.
*/
E_ACELP_corrmatrix_fx( h, sign, vec, rrixix, rrixiy );
-
/*
* Deep first search:
* ------------------
@@ -1277,7 +1463,11 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
L_tmp = L_mult( vec[0], vec[0] ); /*Q25+2*scale*/
FOR( i = 1; i < L_SUBFR; i++ )
- L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q25+2*scale*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, vec[i], vec[i] ); /*Q25+2*scale*/
+#else
+ L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q25+2*scale*/
+#endif
alp = round_fx( L_shr( L_tmp, 3 ) ); /*Q6+2*scale*/
@@ -1334,7 +1524,11 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
FOR( i = 0; i < L_SUBFR; i++ )
{
tmp = add( *p0++, *p1++ );
- vec[i] = add_o( vec[i], tmp, &Overflow ); /* can saturate here. */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ vec[i] = add_sat( vec[i], tmp ); /* can saturate here. */
+#else
+ vec[i] = add_o( vec[i], tmp, &Overflow ); /* can saturate here. */
+#endif
move16();
}
}
@@ -1384,338 +1578,16 @@ void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const
}
FOR( i = 0; i < L_SUBFR; i++ )
{
- y[i] = add_o( y[i], *p0++, &Overflow ); /*Q12+scale*/
- move16();
- }
- }
- return;
-}
-
-void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ )
-{
- Word16 sign[L_SUBFR], vec[L_SUBFR];
- Word16 cor_x[16], cor_y[16], h_buf[4 * L_SUBFR];
- Word16 rrixix[4][16];
- Word16 rrixiy[4][256];
- Word16 dn2[L_SUBFR];
- Word16 psk, ps, alpk, alp = 0;
- Word16 codvec[NB_PULSE_MAX];
- Word16 pos_max[4];
- Word16 dn2_pos[8 * 4];
- UWord8 ipos[NB_PULSE_MAX];
- Word16 *p0, *p1, *p2, *p3;
- Word16 *h, *h_inv;
- Word16 i, j, k, l, st, pos;
- Word16 val, tmp, scale;
- Word32 s, L_tmp;
- Word16 nb_pulse, nb_pulse_m2;
- Word16 check = 0; /* debug code not instrumented */
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ y[i] = add_sat( y[i], *p0++ ); /*Q12+scale*/
+#else
+ y[i] = add_o( y[i], *p0++, &Overflow ); /*Q12+scale*/
#endif
-
-
- alp = config->alp; /* Q13 */ /* initial value for energy of all fixed pulses */
- move16();
- nb_pulse = config->nb_pulse;
- move16();
- nb_pulse_m2 = sub( nb_pulse, 2 );
-
- set16_fx( codvec, 0, nb_pulse );
-
- /*
- * Find sign for each pulse position.
- */
-
- E_ACELP_pulsesign( cn, dn, dn2, sign, vec, alp, 0x7fff, L_SUBFR );
-
- /*
- * Select the most important 8 position per track according to dn2[].
- */
- E_ACELP_findcandidates( dn2, dn2_pos, pos_max );
-
- /*
- * Compute h_inv[i].
- */
- set16_fx( h_buf, 0, L_SUBFR );
-
- set16_fx( h_buf + ( 2 * L_SUBFR ), 0, L_SUBFR );
-
- h = h_buf + L_SUBFR;
- h_inv = h_buf + ( 3 * L_SUBFR );
-
- /*Check the energy if it is too high then scale to prevent an overflow*/
- scale = 0;
- move16();
- L_tmp = L_deposit_l( 0 );
- BASOP_SATURATE_WARNING_OFF_EVS
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- L_tmp = L_mac_o( L_tmp, H[i], H[i], &Overflow ); /*Q25*/
- }
- val = extract_h( L_tmp ); /*Q9*/
- BASOP_SATURATE_WARNING_ON_EVS
-
- if ( GT_16( val, 0x2000 ) )
- {
- scale = -1;
- move16();
- }
- if ( GT_16( val, 0x7000 ) )
- {
- scale = -2;
- move16();
- }
- if ( EQ_16( val, 32767 ) )
- {
- scale = -3;
- move16();
- }
-
- Copy_Scale_sig( H, h, L_SUBFR, scale ); /*Q12+scale*/
-
- E_ACELP_vec_neg_fx( h, h_inv, L_SUBFR );
-
-
- /*
- * Compute correlation matrices needed for the codebook search.
- */
- E_ACELP_corrmatrix_fx( h, sign, vec, rrixix, rrixiy );
-
-
- /*
- * Deep first search:
- * ------------------
- * 20 bits (4p): 4 iter x ((4x16)+(8x16)) = 768 tests
- * 36 bits (8p): 4 iter x ((1x1)+(4x16)+(8x16)+(8x16)) = 1280 tests
- * 52 bits (12p): 3 iter x ((1x1)+(1x1)+(4x16)+(6x16)
- * +(8x16)+(8x16)) = 1248 tests
- * 64 bits (16p): 2 iter x ((1x1)+(1x1)+(4x16)+(6x16)
- * +(6x16)+(8x16)+(8x16)+(8x16)) = 1280 tests
- */
- psk = -1;
- move16();
- alpk = 1;
- move16();
-
- /*Number of iterations*/
- FOR( k = 0; k < config->nbiter; k++ )
- {
- E_ACELP_setup_pulse_search_pos( config, k, ipos );
-
- /* format of alp changes to Q(15-ALP2_E) */
-
- pos = config->fixedpulses;
- move16();
-
- IF( config->fixedpulses == 0 ) /* 1100, 11, 1110, 1111, 2211 */
- {
- ps = 0;
- move16();
- alp = 0;
- move16();
- set16_fx( vec, 0, L_SUBFR );
- }
- ELSE IF( EQ_16( config->fixedpulses, 2 ) ) /* 2222 and 3322 */
- {
- /* first stage: fix 2 pulses */
- ind[0] = pos_max[ipos[0]];
- move16();
- ind[1] = pos_max[ipos[1]];
- move16();
- ps = add( dn[ind[0]], dn[ind[1]] );
-
- /*alp = rrixix[ipos[0]][ind[0] >> 2] + rrixix[ipos[1]][ind[1] >> 2] +
- rrixiy[ipos[0]][((ind[0] >> 2) << 4) + (ind[1] >> 2)];*/
-
- i = shr( ind[0], 2 );
- j = shr( ind[1], 2 );
- l = add( shl( i, 4 ), j );
- s = L_mult( rrixix[ipos[0]][i], _1_ ); /* Q9+Q12+1 */
- s = L_mac( s, rrixix[ipos[1]][j], _1_ ); /* Q9+Q12+1 */
- alp = mac_r( s, rrixiy[ipos[0]][l], _1_ ); /* Q9+Q12+1-16 */
-
- p0 = h - ind[0]; /*Q12+scale*/
- IF( sign[ind[0]] < 0 )
- {
- p0 = h_inv - ind[0]; /*Q12+scale*/
- }
-
- p1 = h - ind[1]; /*Q12+scale*/
- IF( sign[ind[1]] < 0 )
- {
- p1 = h_inv - ind[1]; /*Q12+scale*/
- }
-
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- vec[i] = add( *p0++, *p1++ ); /*Q12+scale*/
- move16();
- }
- }
- ELSE /* 3333 and above */
- {
- /* first stage: fix 4 pulses */
-
- ind[0] = pos_max[ipos[0]]; /*Q0*/
- move16();
- ind[1] = pos_max[ipos[1]]; /*Q0*/
- move16();
- ind[2] = pos_max[ipos[2]]; /*Q0*/
- move16();
- ind[3] = pos_max[ipos[3]]; /*Q0*/
- move16();
-
- /*ps = dn[ind[0]] + dn[ind[1]] + dn[ind[2]] + dn[ind[3]];*/
- ps = add( add( add( dn[ind[0]], dn[ind[1]] ), dn[ind[2]] ), dn[ind[3]] );
-
- p0 = h - ind[0]; /*Q12+scale*/
- IF( sign[ind[0]] < 0 )
- {
- p0 = h_inv - ind[0]; /*Q12+scale*/
- }
-
- p1 = h - ind[1]; /*Q12+scale*/
- IF( sign[ind[1]] < 0 )
- {
- p1 = h_inv - ind[1]; /*Q12+scale*/
- }
-
- p2 = h - ind[2]; /*Q12+scale*/
- IF( sign[ind[2]] < 0 )
- {
- p2 = h_inv - ind[2]; /*Q12+scale*/
- }
-
- p3 = h - ind[3]; /*Q12+scale*/
- IF( sign[ind[3]] < 0 )
- {
- p3 = h_inv - ind[3]; /*Q12+scale*/
- }
-
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- vec[i] = add( add( add( *p0++, *p1++ ), *p2++ ), *p3++ ); /*Q12+scale*/
- move16();
- }
-
- L_tmp = L_mult( vec[0], vec[0] ); /*Q25+2*scale*/
- FOR( i = 1; i < L_SUBFR; i++ )
- L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q25+2*scale*/
-
- alp = round_fx( L_shr( L_tmp, 3 ) ); /*Q6+2*scale*/
-
- /*alp *= 0.5F; */
- }
-
- /* other stages of 2 pulses */
- st = 0;
- move16();
- FOR( j = pos; j < nb_pulse; j += 2 )
- {
- IF( GE_16( nb_pulse_m2, j ) ) /* pair-wise search */
- {
- /*
- * Calculate correlation of all possible positions
- * of the next 2 pulses with previous fixed pulses.
- * Each pulse can have 16 possible positions.
- */
- E_ACELP_h_vec_corr1_fx( h, vec, ipos[j], sign, rrixix, cor_x, dn2_pos, config->nbpos[st] );
-
- E_ACELP_h_vec_corr2_fx( h, vec, ipos[j + 1], sign, rrixix, cor_y );
-
- /*
- * Find best positions of 2 pulses.
- */
- E_ACELP_2pulse_search( config->nbpos[st], ipos[j], ipos[j + 1], &ps, &alp,
- &ind[j], &ind[j + 1], dn, dn2_pos, cor_x, cor_y, rrixiy );
- }
- ELSE /* single pulse search */
- {
- E_ACELP_h_vec_corr2_fx( h, vec, ipos[j], sign, rrixix, cor_x );
-
- E_ACELP_h_vec_corr2_fx( h, vec, ipos[j + 1], sign, rrixix, cor_y );
-
- E_ACELP_1pulse_search( &ipos[j], &ps, &alp,
- &ind[j], dn, cor_x, cor_y );
- }
-
- IF( GT_16( nb_pulse_m2, j ) )
- {
- p0 = h - ind[j]; /*Q12+scale*/
- IF( sign[ind[j]] < 0 )
- {
- p0 = h_inv - ind[j]; /*Q12+scale*/
- }
-
- p1 = h - ind[j + 1]; /*Q12+scale*/
- IF( sign[ind[j + 1]] < 0 )
- {
- p1 = h_inv - ind[j + 1]; /*Q12+scale*/
- }
-
-
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- tmp = add( *p0++, *p1++ );
- vec[i] = add_o( vec[i], tmp, &Overflow ); /* can saturate here. */
- move16();
- }
- }
- st = add( st, 1 );
- }
-
- /* memorise the best codevector */
-
- /*ps = ps * ps; MULT(1);*/
- ps = mult( ps, ps );
- /*s = (alpk * ps) - (psk * alp); MULT(2);ADD(1);*/
- s = L_msu( L_mult( alpk, ps ), psk, alp ); /*Q9+Q6+1=Q16*/
-
- if ( psk < 0 )
- {
- s = 1;
- move32();
- }
- IF( s > 0 )
- {
- psk = ps;
- move16();
- alpk = alp;
- move16();
- Copy( ind, codvec, nb_pulse ); /*Q0*/
- check = 1; /* debug code not instrumented */
- }
- }
-
- assert( check ); /* debug code not instrumented */
-
- /*
- * Build the codeword, the filtered codeword and index of codevector, as well as store weighted correlations.
- */
-
- E_ACELP_build_code( nb_pulse, codvec, sign, code, ind );
-
- set16_fx( y, 0, L_SUBFR );
- FOR( k = 0; k < nb_pulse; ++k )
- {
- i = codvec[k]; /*Q0*/
- move16();
- p0 = h_inv - i; /*Q12+scale*/
- IF( sign[i] > 0 )
- {
- p0 -= 2 * L_SUBFR;
- }
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- y[i] = add_o( y[i], *p0++, &Overflow ); /*Q12+scale*/
move16();
}
}
return;
}
-
/*
* E_ACELP_4t_fx
*
@@ -1763,7 +1635,10 @@ void E_ACELP_4t_fx(
const Word16 last_L_frame, /*Q0*/
const Word32 total_brate, /*Q0*/
const Word16 i_subfr, /*Q0*/
- const Word16 cmpl_flag /*Q0*/ )
+ const Word16 cmpl_flag /*Q0*/
+ ,
+ const Word16 element_mode /*Q0*/
+)
{
PulseConfig config;
Word16 ind[NPMAXPT * 4];
@@ -1787,7 +1662,6 @@ void E_ACELP_4t_fx(
move16();
memcpy( &config, &PulseConfTable[cdk_index], sizeof( PulseConfTable[cdk_index] ) );
-
if ( cmpl_flag > 0 )
{
config.nbiter = cmpl_flag;
@@ -1803,80 +1677,18 @@ void E_ACELP_4t_fx(
IF( acelpautoc )
{
- E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind );
+ E_ACELP_4tsearchx_fx( dn, cn, R, code, &config, ind, element_mode );
}
ELSE
{
- E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y );
+ E_ACELP_4tsearch_fx( dn, cn, H, code, &config, ind, y, element_mode );
}
E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index );
- return;
-}
-
-void E_ACELP_4t_ivas_fx(
- Word16 dn[], /*Qdn*/
- Word16 cn[] /* Q_xn */,
- Word16 H[], /*Q12*/
- Word16 R[], /*Qx*/
- Word8 acelpautoc, /*Q0*/
- Word16 code[], /*Q9*/
- Word16 cdk_index, /*Q0*/
- Word16 _index[], /*Q0*/
- const Word16 L_frame, /*Q0*/
- const Word16 last_L_frame, /*Q0*/
- const Word32 total_brate, /*Q0*/
- const Word16 i_subfr, /*Q0*/
- const Word16 cmpl_flag, /*Q0*/
- Word16 element_mode /*Q0*/ )
-{
- PulseConfig config;
- Word16 ind[NPMAXPT * 4];
- Word16 y[L_SUBFR];
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- memcpy( &config, &PulseConfTable[cdk_index], sizeof( PulseConfTable[cdk_index] ) );
-
-
- if ( cmpl_flag > 0 )
- {
- config.nbiter = cmpl_flag;
- move16();
- }
- test();
- test();
- IF( NE_16( L_frame, last_L_frame ) && EQ_32( total_brate, ACELP_24k40 ) && LT_32( i_subfr, 5 * L_SUBFR ) )
- {
- config.nbiter = sub( config.nbiter, 1 );
- config.nbiter = s_max( config.nbiter, 1 );
- }
-
- IF( acelpautoc )
- {
- E_ACELP_4tsearchx_ivas_fx( dn, cn, R, code, &config, ind, element_mode );
- }
- ELSE
- {
- E_ACELP_4tsearch_ivas_fx( dn, cn, H, code, &config, ind, y );
- }
- E_ACELP_indexing_fx( code, &config, NB_TRACK_FCB_4T, _index );
return;
}
+
static void E_ACELP_indexing_shift(
Word16 wordcnt, /* i: 16-bit word count including the newly shifted-in bits Q0*/
Word16 shift_bits, /* i: number of bits to shift in from the lsb Q0*/
@@ -2025,11 +1837,13 @@ Word16 E_ACELP_indexing_fx(
return saved_bits;
}
+
/*--------------------------------------------------------------------------*
* E_ACELP_adaptive_codebook
*
* Find adaptive codebook.
*--------------------------------------------------------------------------*/
+
void E_ACELP_adaptive_codebook(
Word16 *exc, /* i/o: pointer to the excitation frame Q_new */
Word16 T0, /* i : integer pitch lag Q0 */
@@ -2228,6 +2042,7 @@ void E_ACELP_adaptive_codebook(
*
* Find innovative codebook.
*--------------------------------------------------------------------------*/
+
void E_ACELP_innovative_codebook_fx(
Word16 *exc, /* i : pointer to the excitation frame Q_new */
Word16 T0, /* i : integer pitch lag Q0 */
@@ -2256,7 +2071,6 @@ void E_ACELP_innovative_codebook_fx(
Word16 Rw2[L_SUBFR];
Word16 pitch, idx;
-
pitch = T0;
move16();
idx = shr( i_subfr, 6 );
@@ -2299,8 +2113,7 @@ void E_ACELP_innovative_codebook_fx(
/* Innovative codebook search */
assert( acelp_cfg->fixed_cdk_index[idx] < ACELP_FIXED_CDK_NB );
- E_ACELP_4t_fx( dn, cn2, h2, Rw2, acelpautoc, code, acelp_cfg->fixed_cdk_index[idx], *pt_indice, L_frame, last_L_frame, total_brate, i_subfr, 0 );
-
+ E_ACELP_4t_fx( dn, cn2, h2, Rw2, acelpautoc, code, acelp_cfg->fixed_cdk_index[idx], *pt_indice, L_frame, last_L_frame, total_brate, i_subfr, 0, 0 );
*pt_indice += 8;
/* Generate weighted code */
@@ -2327,14 +2140,25 @@ void E_ACELP_innovative_codebook_fx(
* n - (output) range of possible states (0...n-1)
* p - (output) number of pulses found
*--------------------------------------------------------------------------*/
-static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, UWord32 *ps /*Q0*/, Word16 *p /*Q0*/ )
+
+static void E_ACELP_codearithp_fx(
+ const Word16 v[] /*Q9*/,
+ UWord32 *n /*Q0*/,
+ UWord32 *ps /*Q0*/,
+ Word16 *p /*Q0*/ )
{
Word16 k, nb_pulse, i, t, pos[NPMAXPT], posno;
Word16 sign, m;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
UWord32 s;
+#else
+ UWord64 W_s;
+#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
+#endif
move32();
move32();
#endif
@@ -2360,7 +2184,11 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
}
/* Iterate over the different pulse positions */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
s = L_deposit_l( 0 );
+#else
+ W_s = 0;
+#endif
t = 0;
move16();
nb_pulse = 0;
@@ -2373,9 +2201,15 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
/* Code m-1 pulses */
FOR( i = 1; i < m; ++i )
{
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Carry = 0;
+#endif
move32();
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
s = L_add_co( s, pulsestostates[pos[k]][t], &Carry, &Overflow );
+#else
+ W_s = W_add( W_s, pulsestostates[pos[k]][t] );
+#endif
t = add( t, 1 );
if ( sub( t, NPMAXPT ) > 0 )
{
@@ -2386,22 +2220,42 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
/* Code sign */
/* We use L_add_c since we want to work with unsigned UWord32 */
/* Therefore, we have to clear carry */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Carry = 0;
+#endif
move32();
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
s = L_lshl( s, 1 );
+#else
+ W_s = W_lshl( W_s, 1 );
+#endif
if ( sign < 0 )
{
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
s = L_add_co( s, 1, &Carry, &Overflow );
+#else
+ W_s = W_add( W_s, 1 );
+#endif
}
/* Code last pulse */
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Carry = 0;
+#endif
move32();
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
s = L_add_co( s, pulsestostates[pos[k]][t], &Carry, &Overflow );
+#else
+ W_s = W_add( W_s, pulsestostates[pos[k]][t] );
+#endif
t = add( t, 1 );
}
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
*ps = s; /*Q0*/
+#else
+ *ps = (UWord32) W_s; /*Q0*/
+#endif
move32();
*n = L_deposit_l( 0 );
if ( nb_pulse )
@@ -2412,10 +2266,17 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
*p = nb_pulse; /*Q0*/
move16();
+
return;
}
-void fcb_pulse_track_joint_fx( UWord16 *idxs /*Q0*/, Word16 wordcnt /*Q0*/, UWord32 *index_n /*Q0*/, Word16 *pulse_num /*Q0*/, Word16 track_num /*Q0*/ )
+
+void fcb_pulse_track_joint_fx(
+ UWord16 *idxs /*Q0*/,
+ Word16 wordcnt /*Q0*/,
+ UWord32 *index_n /*Q0*/,
+ Word16 *pulse_num /*Q0*/,
+ Word16 track_num /*Q0*/ )
{
Word16 hi_to_low[10];
UWord32 index, index_mask;
@@ -2530,5 +2391,6 @@ void fcb_pulse_track_joint_fx( UWord16 *idxs /*Q0*/, Word16 wordcnt /*Q0*/, UWor
idxs[track] = extract_l( index );
index = L_lshr( index, 16 );
}
+
return;
}
diff --git a/lib_enc/enc_acelpx_fx.c b/lib_enc/enc_acelpx_fx.c
index 1a17a0f9c2a7b1974c63f5e9aca4204e0dd86c40..cd06a4d1570f0aa926351f869f2085a521de6167 100644
--- a/lib_enc/enc_acelpx_fx.c
+++ b/lib_enc/enc_acelpx_fx.c
@@ -139,9 +139,11 @@ static void E_ACELP_2pulse_searchx_fx(
Word32 alp0, alp1, alp2, s;
Word16 *pR, sgnx;
Word16 sqk[2], alpk[2], ik;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* eight dn2 max positions per track */
@@ -167,8 +169,11 @@ static void E_ACELP_2pulse_searchx_fx(
{
sgnx = negate( sgnx );
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( mac_r_sat( L_mac_sat( L_mac_sat( alp0, cor[x], sign[x] ), cor[track_y], sign[track_y] ), R[track_y - x], sgnx ) < 0 )
+#else
if ( mac_ro( L_mac_o( L_mac_o( alp0, cor[x], sign[x], &Overflow ), cor[track_y], sign[track_y], &Overflow ), R[track_y - x], sgnx, &Overflow ) < 0 )
-
+#endif
{
sqk[0] = 1;
move16();
@@ -188,9 +193,13 @@ static void E_ACELP_2pulse_searchx_fx(
/* dn[x] has only nb_pos_ix positions saved */
/*ps1 = ps0 + dn[x]; INDIRECT(1);ADD(1);*/
ps1 = add_sat( ps0, dn[x] ); /*Qdn*/
- /*alp1 = alp0 + 2*sgnx*cor[x]; INDIRECT(1);MULT(1); MAC(1);*/
- alp1 = L_mac_o( alp0, cor[x], sgnx, &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
- pR = R - x; /*Q9+scale*/
+ /*alp1 = alp0 + 2*sgnx*cor[x]; INDIRECT(1);MULT(1); MAC(1);*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp1 = L_mac_sat( alp0, cor[x], sgnx ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#else
+ alp1 = L_mac_o( alp0, cor[x], sgnx, &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#endif
+ pR = R - x; /*Q9+scale*/
FOR( y = track_y; y < L_SUBFR; y += 4 )
{
@@ -204,14 +213,26 @@ static void E_ACELP_2pulse_searchx_fx(
assert( sgnx != 0 );
alp2_16 = 0;
- alp2 = L_mac_o( alp1, cor[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp2 = L_mac_sat( alp1, cor[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#else
+ alp2 = L_mac_o( alp1, cor[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#endif
if ( sgnx > 0 )
{
- alp2_16 = mac_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp2_16 = mac_r_sat( alp2, pR[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#else
+ alp2_16 = mac_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#endif
}
if ( sgnx < 0 )
{
- alp2_16 = msu_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp2_16 = msu_r_sat( alp2, pR[y], sign[y] ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#else
+ alp2_16 = msu_ro( alp2, pR[y], sign[y], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#endif
}
alpk[1 - ik] = alp2_16; /* Qalp */
move16();
@@ -223,7 +244,11 @@ static void E_ACELP_2pulse_searchx_fx(
/*s = (alpk * sq) - (sqk * alp2); MULT(1);MAC(1);*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ s = L_msu_sat( L_mult( alpk[ik], sq ), sqk[ik], alp2_16 ); /* Q_sq = Q_sqk, Q_alpk = Q_alp */
+#else
s = L_msu_o( L_mult( alpk[ik], sq ), sqk[ik], alp2_16, &Overflow ); /* Q_sq = Q_sqk, Q_alpk = Q_alp */
+#endif
if ( s > 0 )
{
ik = sub( 1, ik );
@@ -281,9 +306,11 @@ static void E_ACELP_1pulse_searchx_fx(
Word16 ntracks, t;
Word16 sqk[2], alpk[2], ik;
move16();
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* save these to limit memory searches */
/*alp0 = *alp + R[0]; INDIRECT(1);*/
@@ -299,7 +326,11 @@ static void E_ACELP_1pulse_searchx_fx(
sqk[0] = -1;
ik = 0;
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( mac_r_sat( alp0, cor[tracks[0]], sign[tracks[0]] ) < 0 )
+#else
if ( mac_ro( alp0, cor[tracks[0]], sign[tracks[0]], &Overflow ) < 0 )
+#endif
{
sqk[0] = 1;
move16();
@@ -323,8 +354,12 @@ static void E_ACELP_1pulse_searchx_fx(
ps1 = add( ps0, dn[x] );
/* alp1 = alp0 + 2*sign[x]*cor[x]; MAC(1); MULT(1);*/
assert( sign[x] == sign_val_1 << 1 || sign[x] == -( sign_val_1 << 1 ) );
- alp1 = mac_ro( alp0, cor[x], sign[x], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
- alpk[1 - ik] = alp1; /* Qalp */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alp1 = mac_r_sat( alp0, cor[x], sign[x] ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#else
+ alp1 = mac_ro( alp0, cor[x], sign[x], &Overflow ); /* Qalp = (Q_R=Q_cor)*Q_signval */
+#endif
+ alpk[1 - ik] = alp1; /* Qalp */
move16();
@@ -334,7 +369,11 @@ static void E_ACELP_1pulse_searchx_fx(
move16();
/*s = (alpk[ik] * sq) - (sqk[ik] * alp1); MULT(1);MAC(1);*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ s = L_msu_sat( L_mult_sat( alpk[ik], sq ), sqk[ik], alp1 ); /* Q9+Qalp+1 */
+#else
s = L_msu_o( L_mult_o( alpk[ik], sq, &Overflow ), sqk[ik], alp1, &Overflow ); /* Q9+Qalp+1 */
+#endif
if ( s > 0 )
{
ik = sub( 1, ik );
@@ -367,7 +406,9 @@ void E_ACELP_4tsearchx_fx(
Word16 Rw[], /*Q9*/
Word16 code[], /*Q9*/
const PulseConfig *config,
- Word16 ind[] /*Q0*/ )
+ Word16 ind[] /*Q0*/
+ ,
+ const Word16 element_mode )
{
Word16 sign[L_SUBFR], vec[L_SUBFR];
Word16 cor[L_SUBFR];
@@ -383,6 +424,9 @@ void E_ACELP_4tsearchx_fx(
Word16 scale;
Word16 sign_val_1, sign_val_2;
Word16 nb_pulse, nb_pulse_m2;
+ Word16 psk = 0;
+ Word16 val, index, track;
+ move16();
move16();
move16();
@@ -398,241 +442,28 @@ void E_ACELP_4tsearchx_fx(
nb_pulse_m2 = sub( nb_pulse, 2 );
/* Init to avoid crash when the search does not find a solution */
- FOR( k = 0; k < nb_pulse; k++ )
- {
- codvec[k] = k;
- move16();
- }
-
- scale = 0;
- move16();
- s = L_mult0( Rw[0], Rw[0] ); /*Q18*/
- FOR( i = 1; i < L_SUBFR; i++ )
- {
- s = L_mac0( s, Rw[i], Rw[i] ); /*Q18*/
- }
- if ( s_and( (Word16) GE_16( nb_pulse, 9 ), (Word16) GT_32( s, 0x800000 ) ) )
- {
- scale = -1;
- move16();
- }
- if ( s_and( (Word16) GE_16( nb_pulse, 13 ), (Word16) GT_32( s, 0x4000000 ) ) )
- {
- scale = -2;
- move16();
- }
- IF( GE_16( nb_pulse, 18 ) )
+ IF( EQ_16( element_mode, EVS_MONO ) )
{
- if ( GT_32( s, 0x200000 ) )
+ FOR( k = 0; k < nb_pulse; k++ )
{
- scale = -1;
- move16();
- }
- if ( GT_32( s, 0x400000 ) )
- {
- scale = -2;
+ codvec[k] = k;
move16();
}
- if ( GT_32( s, 0x4000000 ) )
- {
- scale = -3;
- move16();
- }
- }
- if ( s_and( (Word16) GE_16( nb_pulse, 28 ), (Word16) GT_32( s, 0x800000 ) ) )
- {
- scale = -3;
- move16();
- }
- if ( s_and( (Word16) GE_16( nb_pulse, 36 ), (Word16) GT_32( s, 0x4000000 ) ) )
- {
- scale = -4;
- move16();
}
-
- /* Set up autocorrelation vector */
- R = R_buf + L_SUBFR - 1;
- Copy_Scale_sig( Rw, R, L_SUBFR, scale ); /*Q9+scale*/
- FOR( k = 1; k < L_SUBFR; k++ )
- {
- R[-k] = R[k];
- move16();
- }
-
- /* Sign value */
- sign_val_2 = 0x2000; /* Q15 */
- move16();
- if ( GE_16( nb_pulse, 24 ) )
- {
- sign_val_2 = shr( sign_val_2, 1 ); /* Q15 */
- }
- sign_val_1 = shr( sign_val_2, 1 ); /* Q15 */
-
- /*
- * Find sign for each pulse position.
- */
- E_ACELP_pulsesign( cn, dn, dn2, sign, vec, alp, sign_val_2, L_SUBFR );
-
- /*
- * Select the most important 8 position per track according to dn2[].
- */
- E_ACELP_findcandidates( dn2, dn2_pos, pos_max );
-
- /*
- * Deep first search:
- */
-
- /* Ensure that in the loop below s > 0 in the first iteration, the actual values do not matter. */
- ps2k = -1;
- move16();
- alpk = 1;
- move16();
-
- /* Number of iterations */
- FOR( k = 0; k < config->nbiter; k++ )
+ ELSE
{
- E_ACELP_setup_pulse_search_pos( config, k, ipos );
-
- /* index to first non-fixed position */
- pos = config->fixedpulses; /* Q0 */
- move16();
-
- IF( config->fixedpulses == 0 ) /* 1100, 11, 1110, 1111, 2211 */
- {
- ps = 0;
- move16();
- alp = 0;
- move16();
- set16_fx( cor, 0, L_SUBFR );
- }
- ELSE
+ FOR( k = 0; k < nb_pulse; k++ )
{
- assert( config->fixedpulses == 2 || config->fixedpulses == 4 );
-
- /* set fixed positions */
- FOR( i = 0; i < pos; ++i )
- {
- ind[i] = pos_max[ipos[i]]; /* Q0 */
- move16();
- }
-
- /* multiplication of autocorrelation with signed fixed pulses */
- E_ACELP_update_cor_fx( ind, config->fixedpulses, sign, R, NULL, cor );
-
- /* normalisation contribution of fixed part */
- s = L_mult0( cor[ind[0]], sign[ind[0]] ); /* Q22 */
- ps = dn[ind[0]]; /* Qdn */
- move16();
- FOR( i = 1; i < pos; ++i )
- {
- s = L_mac0( s, cor[ind[i]], sign[ind[i]] ); /*Q12+Q9+1=Q22 */
- ps = add( ps, dn[ind[i]] ); /* Qdn */
- }
- alp = round_fx( s ); /*mac0 >>1 sign = 2 Q6*/
- }
-
- /* other stages of 2 pulses */
- st = 0;
- move16();
- FOR( j = pos; j < nb_pulse; j += 2 )
- {
- IF( GE_16( nb_pulse_m2, j ) ) /* pair-wise search */
- {
- /*
- * Calculate correlation of all possible positions
- * of the next 2 pulses with previous fixed pulses.
- * Each pulse can have 16 possible positions.
- */
-
- E_ACELP_2pulse_searchx_fx( config->nbpos[st], ipos[j], ipos[j + 1], R, &ps, &alp,
- &ind[j], &ind[j + 1], dn, dn2_pos, cor, sign, sign_val_2 );
- }
- ELSE /* single pulse search */
- {
- E_ACELP_1pulse_searchx_fx( &ipos[j], R, &ps, &alp,
- &ind[j], dn, cor, sign, sign_val_1 );
- }
-
-
- st = add( st, 1 );
- }
-
- /* memorise the best codevector */
- /*ps2 = ps * ps; MULT(1);*/
- ps2 = mult( ps, ps ); /* 2*Qdn+1 */
-
- /*s = (alpk * ps2) - (ps2k * alp); MULT(2);ADD(1);*/
- s = L_msu( L_mult( alpk, ps2 ), ps2k, alp ); /* 2*Qdn+8 */
-
- IF( s > 0 )
- {
- ps2k = ps2;
- move16();
- alpk = alp;
+ codvec[k] = s_and( k, 3 );
move16();
- Copy( ind, codvec, nb_pulse ); /* Q0 */
}
}
-
-
- /*
- * Store weighted energy of code, build the codeword and index of codevector.
- */
- E_ACELP_build_code( nb_pulse, codvec, sign, code, ind );
-}
-
-void E_ACELP_4tsearchx_ivas_fx(
- Word16 dn[], /*Qdn*/
- const Word16 cn[], /*Q_new*/
- Word16 Rw[], /*Q9*/
- Word16 code[], /*Q9*/
- const PulseConfig *config,
- Word16 ind[], /*Q0*/
- Word16 element_mode )
-{
- Word16 sign[L_SUBFR], vec[L_SUBFR];
- Word16 cor[L_SUBFR];
- Word16 R_buf[2 * L_SUBFR - 1], *R;
- Word16 dn2[L_SUBFR];
- Word16 ps2k, ps /* same format as dn[] */, ps2, alpk, alp = 0 /* Q13 and later Q_Rw*Q_signval=Q_cor*Q_signval */;
- Word32 s;
- Word16 codvec[NB_PULSE_MAX];
- Word16 pos_max[4];
- Word16 dn2_pos[8 * 4];
- UWord8 ipos[NB_PULSE_MAX];
- Word16 i, j, k, st, pos = 0;
- Word16 scale;
- Word16 sign_val_1, sign_val_2;
- Word16 nb_pulse, nb_pulse_m2;
- Word16 psk;
- Word16 val, index, track;
- move16();
- move16();
-
- psk = ps = 0; /* to avoid compilation warnings */
- move16();
- move16();
-
-
- alp = config->alp; /* Q13 */
- move16();
- nb_pulse = config->nb_pulse;
- move16();
- nb_pulse_m2 = sub( nb_pulse, 2 );
-
- /* Init to avoid crash when the search does not find a solution */
- FOR( k = 0; k < nb_pulse; k++ )
- {
- codvec[k] = s_and( k, 3 );
- move16();
- }
-
scale = 0;
move16();
- s = L_mult0( Rw[0], Rw[0] ); /* Q18 */
+ s = L_mult0( Rw[0], Rw[0] ); /*Q18*/
FOR( i = 1; i < L_SUBFR; i++ )
{
- s = L_mac0( s, Rw[i], Rw[i] ); /* Q18 */
+ s = L_mac0( s, Rw[i], Rw[i] ); /*Q18*/
}
if ( s_and( (Word16) GE_16( nb_pulse, 9 ), (Word16) GT_32( s, 0x800000 ) ) )
{
@@ -675,7 +506,7 @@ void E_ACELP_4tsearchx_ivas_fx(
/* Set up autocorrelation vector */
R = R_buf + L_SUBFR - 1;
- Copy_Scale_sig( Rw, R, L_SUBFR, scale ); /* Q9 + scale */
+ Copy_Scale_sig( Rw, R, L_SUBFR, scale ); /*Q9+scale*/
FOR( k = 1; k < L_SUBFR; k++ )
{
R[-k] = R[k];
@@ -749,7 +580,7 @@ void E_ACELP_4tsearchx_ivas_fx(
FOR( i = 1; i < pos; ++i )
{
s = L_mac0( s, cor[ind[i]], sign[ind[i]] ); /*Q12+Q9+1=Q22 */
- ps = add( ps, dn[ind[i]] );
+ ps = add( ps, dn[ind[i]] ); /* Qdn */
}
alp = round_fx( s ); /*mac0 >>1 sign = 2 Q6*/
}
@@ -776,15 +607,14 @@ void E_ACELP_4tsearchx_ivas_fx(
&ind[j], dn, cor, sign, sign_val_1 );
}
- IF( GT_16( alp, ONE_IN_Q14 ) )
+ test();
+ IF( GT_16( alp, ONE_IN_Q14 ) && ( element_mode > EVS_MONO ) )
{
alp = shr( alp, 1 );
Scale_sig( cor, L_SUBFR, -1 ); /*Q8*/
Scale_sig( R_buf, 2 * L_SUBFR - 1, -1 ); /*Q8+scale*/
Scale_sig( dn, L_SUBFR, -1 ); /*Qdn-1*/
}
-
-
st = add( st, 1 );
}
@@ -803,7 +633,7 @@ void E_ACELP_4tsearchx_ivas_fx(
move16();
alpk = alp;
move16();
- Copy( ind, codvec, nb_pulse ); /*Q0*/
+ Copy( ind, codvec, nb_pulse ); /* Q0 */
}
}
diff --git a/lib_enc/enc_amr_wb_fx.c b/lib_enc/enc_amr_wb_fx.c
index 4c5268017f3c99d751c86272f368064d3209adc2..530eb4a40de114c5bfcba23654a64783cf280eb3 100644
--- a/lib_enc/enc_amr_wb_fx.c
+++ b/lib_enc/enc_amr_wb_fx.c
@@ -1,21 +1,22 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-//#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* encod_amr_wb()
*
* Encode excitation signal in AMR-WB IO mode
*-------------------------------------------------------------------*/
+
void encod_amr_wb_fx(
Encoder_State *st, /* i/o: state structure */
const Word16 speech[], /* i : input speech Q_new-1*/
@@ -64,9 +65,11 @@ void encod_amr_wb_fx(
AMRWB_IO_ENC_HANDLE hAmrwb_IO = st->hAmrwb_IO;
BSTR_ENC_HANDLE hBstr = st->hBstr;
LPD_state_HANDLE hLPDmem = st->hLPDmem;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*------------------------------------------------------------------*
@@ -129,6 +132,7 @@ void encod_amr_wb_fx(
* target in residual domain "cn"
* Compute impulse response, h1[], of weighted synthesis filter
*----------------------------------------------------------------*/
+
Copy( &res[i_subfr], &exc[i_subfr], L_SUBFR ); /*Q_new*/
find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq,
@@ -146,7 +150,7 @@ void encod_amr_wb_fx(
*----------------------------------------------------------------*/
*pt_pitch = pit_encode_fx( hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 1, L_FRAME, -1, &pitch_limit_flag, i_subfr, exc,
- L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/ );
+ L_SUBFR, T_op, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, 0 /*hStereoTD->tdm_Pitch_reuse_flag*/, NULL /*hStereoTD->tdm_Pri_pitch_buf*/, 0, Q_new );
/*-----------------------------------------------------------------*
* Find adaptive exitation
@@ -165,8 +169,7 @@ void encod_amr_wb_fx(
* LP filtering of the adaptive excitation, codebook target computation
*-----------------------------------------------------------------*/
- lp_select = lp_filt_exc_enc_fx( MODE1, -1, i_subfr, exc, h1,
- xn, y1, xn2, L_SUBFR, L_FRAME, g_corr, clip_gain, &gain_pit, &lp_flag );
+ lp_select = lp_filt_exc_enc_fx( MODE1, -1, i_subfr, exc, h1, xn, y1, xn2, L_SUBFR, L_FRAME, g_corr, clip_gain, &gain_pit, &lp_flag );
IF( EQ_16( lp_flag, NORMAL_OPERATION ) )
{
@@ -176,25 +179,37 @@ void encod_amr_wb_fx(
/*-----------------------------------------------------------------*
* Innovation encoding
*-----------------------------------------------------------------*/
+
inov_encode_fx( st, st->core_brate, 1, L_FRAME, st->last_L_frame, -1, -1, 0, i_subfr, -1, p_Aq, gain_pit, cn,
exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits, L_SUBFR, shift );
+
/*-----------------------------------------------------------------*
* Gain encoding
* Pitch gain clipping test
* Estimate spectrum tilt and voicing
*-----------------------------------------------------------------*/
+
gain_enc_amr_wb_fx( hBstr, xn, shift_wsp, y1, y2, code, st->core_brate, &gain_pit, &gain_code,
&gain_inov, &norm_gain_code, g_corr, clip_gain, hAmrwb_IO->past_qua_en_fx );
gp_clip_test_gain_pit_fx( st->element_mode, st->core_brate, gain_pit, st->clip_var_fx );
- Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/
- gcode16 = round_fx_o( Lgcode, &Overflow ); /*Q0*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/
+ gcode16 = round_fx_sat( Lgcode ); /*Q0*/
+#else
+ Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/
+ gcode16 = round_fx_o( Lgcode, &Overflow ); /*Q0*/
+#endif
hLPDmem->tilt_code = Est_tilt2( exc + i_subfr, gain_pit, code, Lgcode, &voice_fac, shift ); /*Q15*/
FOR( i = 0; i < L_SUBFR; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ exc2[i + i_subfr] = round_fx_sat( L_shl_sat( L_mult( gain_pit, exc[i + i_subfr] ), 1 ) ); /*Q_new*/
+#else
exc2[i + i_subfr] = round_fx_o( L_shl_o( L_mult( gain_pit, exc[i + i_subfr] ), 1, &Overflow ), &Overflow ); /*Q_new*/
+#endif
move16();
}
@@ -211,16 +226,23 @@ void encod_amr_wb_fx(
Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new+15 */
hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */
move16();
+
/*-----------------------------------------------------------------*
* Find the total excitation
*-----------------------------------------------------------------*/
+
FOR( i = 0; i < L_SUBFR; i++ )
{
L_tmp = L_mult( gcode16, code[i] ); /*Q10*/
L_tmp = L_shl_sat( L_tmp, 5 ); /*Q15*/
L_tmp = L_mac_sat( L_tmp, exc[i + i_subfr], gain_pit ); /* Q_new+15 */
- L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /* saturation can occur here Q_new+15*/
- exc[i + i_subfr] = round_fx_o( L_tmp, &Overflow ); /*Q_new*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q_new+15*/
+ exc[i + i_subfr] = round_fx_sat( L_tmp ); /*Q_new*/
+#else
+ L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /* saturation can occur here Q_new+15*/
+ exc[i + i_subfr] = round_fx_o( L_tmp, &Overflow ); /*Q_new*/
+#endif
move16();
}
@@ -228,6 +250,7 @@ void encod_amr_wb_fx(
* Synthesize speech to update mem_syn[]
* Update A(z) filters
*-----------------------------------------------------------------*/
+
Syn_filt_s( 1, p_Aq, M, &exc[i_subfr], &syn[i_subfr], L_SUBFR, hLPDmem->mem_syn, 1 );
/*-----------------------------------------------------------------*
diff --git a/lib_enc/enc_gain_fx.c b/lib_enc/enc_gain_fx.c
index 7c9606cfc24bcf592bfd1a0390ea625645414b50..1789813cc38fc8e085b44e88adef94e27333524d 100644
--- a/lib_enc/enc_gain_fx.c
+++ b/lib_enc/enc_gain_fx.c
@@ -6,15 +6,12 @@
#include
#include "options.h"
#include "cnst.h"
-//#include "prot_fx.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "rom_enc.h"
#include "basop_util.h"
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
-void E_GAIN_norm_corr_fx( Word16 exc[] /*Q_new*/, Word16 xn[] /*(Q_new+shift-1)*/, Word16 h[] /*(Q14+shift)*/, Word16 t_min, Word16 t_max, Word16 corr_norm[] /*(Q15+(Q_new+shift-1)+scale)*/, Word16 L_subfr );
/*
* E_GAIN_norm_corr
@@ -36,14 +33,21 @@ void E_GAIN_norm_corr_fx( Word16 exc[] /*Q_new*/, Word16 xn[] /*(Q_new+shift-1)*
* Returns:
* void
*/
-void E_GAIN_norm_corr_fx( Word16 exc[] /*Q_new*/, Word16 xn[] /*(Q_new+shift-1)*/, Word16 h[] /*(Q14+shift)*/, Word16 t_min, Word16 t_max, Word16 corr_norm[] /*(Q15+(Q_new+shift-1)+scale)*/, Word16 L_subfr )
+
+static void E_GAIN_norm_corr_fx(
+ Word16 exc[] /*Q_new*/,
+ Word16 xn[] /*(Q_new+shift-1)*/,
+ Word16 h[] /*(Q14+shift)*/,
+ Word16 t_min,
+ Word16 t_max,
+ Word16 corr_norm[] /*(Q15+(Q_new+shift-1)+scale)*/,
+ Word16 L_subfr )
{
Word16 excf[L_SUBFR]; /* filtered past excitation (Q_new+shift-1) */
Word16 ps, norm, exp_alp, exp_ps, scale, L_subfr2;
Word16 t, j, k;
Word32 L_tmp, L_tmp2;
-
k = negate( t_min );
L_subfr2 = shr( L_subfr, 1 );
diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c
index 4595dc2062b3dd27b39b6b6ad488546957e56f09..01f80cacb3dca21f6bb6cd59e9e1df0eb3bb0df9 100644
--- a/lib_enc/enc_gen_voic_fx.c
+++ b/lib_enc/enc_gen_voic_fx.c
@@ -1,17 +1,25 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
-#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE
-static void rem_offset( const Word16 *in, Word16 *out, Word16 l_subfr )
+/*-------------------------------------------------------------------*
+ * rem_offset()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void rem_offset(
+ const Word16 *in,
+ Word16 *out,
+ const Word16 l_subfr )
{
Word16 i;
Word16 tmp;
@@ -29,8 +37,10 @@ static void rem_offset( const Word16 *in, Word16 *out, Word16 l_subfr )
out[i] = sub( in[i], tmp );
move16();
}
+
+ return;
}
-#endif
+
/*======================================================================*/
/* FUNCTION : encod_gen_voic_fx() */
@@ -134,9 +144,11 @@ void encod_gen_voic_fx(
Word16 shift_wsp;
Word16 harm_flag_acelp;
Word16 lp_select, lp_flag, L_frame;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
@@ -192,6 +204,7 @@ void encod_gen_voic_fx(
/* set and write harmonicity flag */
harm_flag_acelp = 0;
move16();
+
test();
test();
IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && EQ_16( st_fx->coder_type, GENERIC ) )
@@ -229,8 +242,12 @@ void encod_gen_voic_fx(
/* scaling of xn[] to limit dynamic at 12 bits */
Scale_sig( xn_fx, L_SUBFR, shift );
+ /*----------------------------------------------------------------*
+ * Close-loop pitch search and quantization
+ *----------------------------------------------------------------*/
+
*pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx,
- L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf ); /* Q6 */
+ L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */
tbe_celp_exc( L_frame, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx );
@@ -266,7 +283,11 @@ void encod_gen_voic_fx(
}
/*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/
+#else
hSpMusClas->lowrate_pitchGain = round_fx_o( L_mac_o( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx, &Overflow ), &Overflow ); /*Q14*Q16(0.1) + Q15 -> Q15*/
+#endif
/*-----------------------------------------------------------------*
* Transform domain contribution encoding - active frames
@@ -294,7 +315,8 @@ void encod_gen_voic_fx(
IF( LE_32( st_fx->core_brate, ACELP_8k00 ) )
{
gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx,
- &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR );
+ &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR,
+ st_fx->element_mode );
}
ELSE IF( GT_32( st_fx->core_brate, ACELP_32k ) )
{
@@ -317,8 +339,13 @@ void encod_gen_voic_fx(
}
gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx );
- Lgcode = L_shl_o( gain_code_fx, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/
- gcode16 = round_fx_o( Lgcode, &Overflow ); /*Q0*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lgcode = L_shl_sat( gain_code_fx, Q_new ); /* scaled gain_code with Qnew -> Q16*/
+ gcode16 = round_fx_sat( Lgcode ); /*Q0*/
+#else
+ Lgcode = L_shl_o( gain_code_fx, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/
+ gcode16 = round_fx_o( Lgcode, &Overflow ); /*Q0*/
+#endif
hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, Lgcode, &voice_fac_fx, shift ); /* Q15 */
move16();
@@ -354,20 +381,35 @@ void encod_gen_voic_fx(
FOR( i = 0; i < L_SUBFR; i++ )
{
/* Contribution from AVQ layer */
- Ltmp1 = L_mult_o( gain_preQ_fx, code_preQ_fx[i], &Overflow ); /* Q2 + Q6 -> Q9*/
- Ltmp1 = L_shl_o( Ltmp1, tmp1_fx, &Overflow ); /* Q16 + Q_exc */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp1 = L_mult_sat( gain_preQ_fx, code_preQ_fx[i] ); /* Q2 + Q6 -> Q9*/
+ Ltmp1 = L_shl_sat( Ltmp1, tmp1_fx ); /* Q16 + Q_exc */
+#else
+ Ltmp1 = L_mult_o( gain_preQ_fx, code_preQ_fx[i], &Overflow ); /* Q2 + Q6 -> Q9*/
+ Ltmp1 = L_shl_o( Ltmp1, tmp1_fx, &Overflow ); /* Q16 + Q_exc */
+#endif
/* Compute exc2 */
- Ltmp = L_shl_o( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1, &Overflow ); /* Q16 */
- exc2_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1 ); /* Q16 */
+ exc2_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); /* Q0 */
+#else
+ Ltmp = L_shl_o( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1, &Overflow ); /* Q16 */
+ exc2_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */
+#endif
move16();
/* code in Q9, gain_pit in Q14 */
- Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */
- Ltmp = L_shl( Ltmp, 5 ); /* Q15 */
- Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */
- Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/
- exc_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */
+ Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */
+ Ltmp = L_shl( Ltmp, 5 ); /* Q15 */
+ Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/
+ exc_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) ); /* Q0 */
+#else
+ Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/
+ exc_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow ); /* Q0 */
+#endif
}
}
ELSE
@@ -376,14 +418,22 @@ void encod_gen_voic_fx(
* Construct adaptive part of the excitation
* Save the non-enhanced excitation for FEC_exc
*-----------------------------------------------------------------*/
+
FOR( i = 0; i < L_SUBFR; i++ )
{
/* code in Q9, gain_pit in Q14 */
- Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */
- Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 */
- Ltmp = L_mac_o( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx, &Overflow ); /* Q15 */
- Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/
- exc_fx[i + i_subfr_fx] = round_fx_o( Ltmp, &Overflow ); /* Q0 */
+ Ltmp = L_mult( gcode16, code_fx[i] ); /* Q10 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 */
+ Ltmp = L_mac_sat( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /* Q15 */
+ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16*/
+ exc_fx[i + i_subfr_fx] = round_fx_sat( Ltmp ); /* Q0 */
+#else
+ Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 */
+ Ltmp = L_mac_o( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx, &Overflow ); /* Q15 */
+ Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16*/
+ exc_fx[i + i_subfr_fx] = round_fx_o( Ltmp, &Overflow ); /* Q0 */
+#endif
}
}
@@ -391,10 +441,22 @@ void encod_gen_voic_fx(
* Prepare TBE excitation
*-----------------------------------------------------------------*/
+#ifdef FIX_2010_PREP_TBE_EXC
+ /* multrus 2025-09-15
+ TODO:
+ - check with vaillancourt, whether Q10 is the correct scaling - it contradicts comments above, where it's rather indicated as Q6
+ - comparing againt float, Q10 seems to be correct
+ */
+ prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
+ &voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q10, Q_new,
+ T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
+ st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
&voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_new,
T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#endif
/*-----------------------------------------------------------------*
* Synthesize speech to update mem_syn[].
@@ -492,9 +554,11 @@ void encod_gen_voic_ivas_fx(
Word16 harm_flag_acelp;
Word16 lp_select, lp_flag, L_frame;
Word16 q_h1;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
@@ -516,7 +580,6 @@ void encod_gen_voic_ivas_fx(
L_frame = st_fx->L_frame;
move16();
-
IF( EQ_16( L_frame, L_FRAME ) )
{
T0_max_fx = PIT_MAX;
@@ -549,9 +612,11 @@ void encod_gen_voic_ivas_fx(
{
shift_wsp = sub( shift_wsp, 1 );
}
+
/* set and write harmonicity flag */
harm_flag_acelp = 0;
move16();
+
test();
test();
IF( GE_32( st_fx->core_brate, MIN_BRATE_AVQ_EXC ) && LE_32( st_fx->core_brate, MAX_BRATE_AVQ_EXC_TD ) && EQ_16( st_fx->coder_type, GENERIC ) )
@@ -588,7 +653,6 @@ void encod_gen_voic_ivas_fx(
Scale_sig( h1_fx, L_SUBFR, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/
/* scaling of xn[] to limit dynamic at 12 bits */
Scale_sig( xn_fx, L_SUBFR, shift );
-#ifdef FIX_1766_TCX2ACELP_BWE_ISSUE
test();
test();
IF( Es_pred_fx < 0 && LE_16( i_subfr_fx, L_SUBFR ) && NE_16( st_fx->last_core, ACELP_CORE ) )
@@ -597,9 +661,13 @@ void encod_gen_voic_ivas_fx(
rem_offset( xn_fx, xn_fx, L_SUBFR );
rem_offset( cn_fx, cn_fx, L_SUBFR );
}
-#endif
- *pt_pitch_fx = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx,
- L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */
+
+ /*----------------------------------------------------------------*
+ * Close-loop pitch search and quantization
+ *----------------------------------------------------------------*/
+
+ *pt_pitch_fx = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, st_fx->core_brate, 0, L_frame, st_fx->coder_type, &pitch_limit_flag, i_subfr_fx, exc_fx,
+ L_SUBFR, st_fx->pitch, &T0_min_fx, &T0_max_fx, &T0_fx, &T0_frac_fx, h1_fx, xn_fx, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */
move16();
tbe_celp_exc_ivas( st_fx->element_mode, st_fx->idchan, L_frame, L_SUBFR, i_subfr_fx, T0_fx, T0_frac_fx, &error_fx, bwe_exc_fx, st_fx->tdm_LRTD_flag );
@@ -627,8 +695,8 @@ void encod_gen_voic_ivas_fx(
* LP filtering of the adaptive excitation, codebook target computation
*-----------------------------------------------------------------*/
- lp_select = lp_filt_exc_enc_ivas_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx,
- xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag );
+ lp_select = lp_filt_exc_enc_fx( MODE1, st_fx->coder_type, i_subfr_fx, exc_fx, h1_fx,
+ xn_fx, y1_fx, xn2_fx, L_SUBFR, L_frame, g_corr_fx, clip_gain_fx, &gain_pit_fx, &lp_flag );
IF( EQ_16( lp_flag, NORMAL_OPERATION ) )
{
@@ -660,18 +728,19 @@ void encod_gen_voic_ivas_fx(
IF( LE_32( st_fx->core_brate, ACELP_8k00 ) )
{
- gain_enc_lbr_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx,
- &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR );
+ gain_enc_lbr_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->coder_type, i_subfr_fx, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx,
+ &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, gc_mem, gp_mem, clip_gain_fx, L_SUBFR,
+ st_fx->element_mode );
}
ELSE IF( GT_32( st_fx->core_brate, ACELP_32k ) )
{
- gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx,
- &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp );
+ gain_enc_SQ_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr_fx, xn_fx, y1_fx, y2_fx, code_fx, Es_pred_fx,
+ &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx, shift_wsp );
}
ELSE
{
- gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx,
- &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx );
+ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame, i_subfr_fx, -1, xn_fx, y1_fx, shift_wsp, y2_fx, code_fx, Es_pred_fx,
+ &gain_pit_fx, &gain_code_fx, &gain_inov_fx, &norm_gain_code_fx, g_corr_fx, clip_gain_fx );
}
IF( st_fx->Opt_SC_VBR )
{
@@ -684,8 +753,13 @@ void encod_gen_voic_ivas_fx(
}
gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lgcode = L_shl_sat( gain_code_fx, Q_new ); /* scaled gain_code with Qnew -> Q16*/
+ gcode16 = round_fx_sat( Lgcode );
+#else
Lgcode = L_shl_o( gain_code_fx, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/
gcode16 = round_fx_o( Lgcode, &Overflow );
+#endif
hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr_fx], gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, Q_new, L_SUBFR, 0 ); /* Q15 */
move16();
@@ -705,7 +779,6 @@ void encod_gen_voic_ivas_fx(
* Update memory of the weighting filter
*-----------------------------------------------------------------*/
-
/*At this point
xn has to be in Qnew
yn has to be in Qnew
@@ -737,20 +810,35 @@ void encod_gen_voic_ivas_fx(
FOR( i = 0; i < L_SUBFR; i++ )
{
/* Contribution from AVQ layer */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp1 = L_mult_sat( gain_preQ_fx, code_preQ_fx[i] );
+ Ltmp1 = L_shl_sat( Ltmp1, tmp1_fx );
+#else
Ltmp1 = L_mult_o( gain_preQ_fx, code_preQ_fx[i], &Overflow );
Ltmp1 = L_shl_o( Ltmp1, tmp1_fx, &Overflow );
+#endif
/* Compute exc2 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1 );
+ exc2_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) );
+#else
Ltmp = L_shl_o( L_mult( gain_pit_fx, exc_fx[i + i_subfr_fx] ), 1, &Overflow );
exc2_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow );
+#endif
move16();
/* code in Q9, gain_pit in Q14 */
- Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */
- Ltmp = L_shl( Ltmp, 5 ); /*Qnew + 9+ 1+5 */
- Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /*Qnew + 14 + 1*/
+ Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */
+ Ltmp = L_shl( Ltmp, 5 ); /*Qnew + 9+ 1+5 */
+ Ltmp = L_mac( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /*Qnew + 14 + 1*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, 1 ); /*Qnew + 14 + 1 +1 */ /* saturation can occur here Q16*/
+ exc_fx[i + i_subfr_fx] = round_fx_sat( L_add_sat( Ltmp, Ltmp1 ) );
+#else
Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /*Qnew + 14 + 1 +1 */ /* saturation can occur here Q16*/
exc_fx[i + i_subfr_fx] = round_fx_o( L_add_o( Ltmp, Ltmp1, &Overflow ), &Overflow );
+#endif
move16();
}
}
@@ -760,25 +848,40 @@ void encod_gen_voic_ivas_fx(
* Construct adaptive part of the excitation
* Save the non-enhanced excitation for FEC_exc
*-----------------------------------------------------------------*/
+
FOR( i = 0; i < L_SUBFR; i++ )
{
/* code in Q9, gain_pit in Q14 */
/*gcode16 in Qnew*/
- Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */
+ Ltmp = L_mult( gcode16, code_fx[i] ); /*Qnew + 9 + 1 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, 5 ); /*Qnew + 9+ 1+5 */
+ Ltmp = L_mac_sat( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx ); /*Qnew + 14 + 1*/
+ Ltmp = L_shl_sat( Ltmp, 1 ); /*Qnew + 14 + 1 +1 */
+ exc_fx[i + i_subfr_fx] = round_fx_sat( Ltmp );
+#else
Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /*Qnew + 9+ 1+5 */
Ltmp = L_mac_o( Ltmp, exc_fx[i + i_subfr_fx], gain_pit_fx, &Overflow ); /*Qnew + 14 + 1*/
Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /*Qnew + 14 + 1 +1 */
exc_fx[i + i_subfr_fx] = round_fx_o( Ltmp, &Overflow );
+#endif
}
}
/*-----------------------------------------------------------------*
* Prepare TBE excitation
*-----------------------------------------------------------------*/
+#ifdef FIX_2010_PREP_TBE_EXC
+ prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
+ &voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_AVQ_OUT_DEC, Q_new,
+ T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
+ st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr_fx, gain_pit_fx, gain_code_fx, code_fx, voice_fac_fx,
&voice_factors_fx[i_subfr_fx / L_SUBFR], bwe_exc_fx, gain_preQ_fx, code_preQ_fx, Q_new,
T0_fx, T0_frac_fx, st_fx->coder_type, st_fx->core_brate,
st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#endif
/*-----------------------------------------------------------------*
* Synthesize speech to update mem_syn[].
diff --git a/lib_enc/enc_gen_voic_rf_fx.c b/lib_enc/enc_gen_voic_rf_fx.c
index 0e79baa5f9e95e0db27ac770b18f5b93fcd35c09..26a45bad9bc15b1f23dad9d5184e7fe71f40beb3 100644
--- a/lib_enc/enc_gen_voic_rf_fx.c
+++ b/lib_enc/enc_gen_voic_rf_fx.c
@@ -5,7 +5,6 @@
#include
#include "options.h"
#include "cnst.h"
-#include "rom_com_fx.h"
#include "stl.h"
#include "rom_basop_util.h"
#include "rom_com.h" /* Common constants */
@@ -165,9 +164,11 @@ void coder_acelp_rf_fx(
Word16 prev_gain_pit;
Word16 rf_coder_type;
Word16 lp_select;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
RF_ENC_HANDLE hRF = st->hRF;
@@ -440,7 +441,16 @@ void coder_acelp_rf_fx(
* Update memory of the weighting filter
*-----------------------------------------------------------------*/
/* st_fx->_rf_mem_w0 = xn[L_SUBFR-1] - (gain_pit*y1[L_SUBFR-1]) - (gain_code*y2[L_SUBFR-1]); */
- Ltmp = Mpy_32_16_1( gain_code, y2[L_SUBFR - 1] ); /* Q10 */
+ Ltmp = Mpy_32_16_1( gain_code, y2[L_SUBFR - 1] ); /* Q10 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, add( 5, Q_xn ) ); /* Q15 + Q_xn */
+ Ltmp = L_mac_sat( Ltmp, y1[L_SUBFR - 1], gain_pit ); /* Q15 + Q_xn */
+ /* Add Gaussian contribution*/
+ Ltmp2 = Mpy_32_16_1( gain_code2, y22[L_SUBFR - 1] ); /* Q10 */
+ Ltmp2 = L_shl_sat( Ltmp2, add( 5, Q_xn ) ); /* Q15 + Q_xn */
+ Ltmp = L_add_sat( Ltmp, Ltmp2 ); /* Q15 + Q_xn */
+ hRF->rf_mem_w0 = sub_sat( xn[L_SUBFR - 1], round_fx_sat( L_shl_sat( Ltmp, 1 ) ) ); /* Q_xn */
+#else
Ltmp = L_shl_o( Ltmp, add( 5, Q_xn ), &Overflow ); /* Q15 + Q_xn */
Ltmp = L_mac_o( Ltmp, y1[L_SUBFR - 1], gain_pit, &Overflow ); /* Q15 + Q_xn */
/* Add Gaussian contribution*/
@@ -448,6 +458,7 @@ void coder_acelp_rf_fx(
Ltmp2 = L_shl_o( Ltmp2, add( 5, Q_xn ), &Overflow ); /* Q15 + Q_xn */
Ltmp = L_add_o( Ltmp, Ltmp2, &Overflow ); /* Q15 + Q_xn */
hRF->rf_mem_w0 = sub_o( xn[L_SUBFR - 1], round_fx_o( L_shl_o( Ltmp, 1, &Overflow ), &Overflow ), &Overflow ); /* Q_xn */
+#endif
move16();
hRF->rf_mem_w0 = shr_sat( hRF->rf_mem_w0, shift ); /*Qnew-1*/
@@ -462,16 +473,28 @@ void coder_acelp_rf_fx(
FOR( i = sub( tmp2, shr( L_SUBFR, 1 ) ); i < tmp2; i++ )
{
/* code in Q9, gain_pit in Q14; exc Q_new */
- Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); /* Q10 */
- Ltmp = L_shl_o( Ltmp, Q_new_p5, &Overflow ); /* Q15 + Q_new */
- Ltmp = L_mac_o( Ltmp, gain_pit, exc_rf[i + i_subfr], &Overflow ); /* Q15 + Q_new */
- exc2[i] = round_fx_o( L_shl_o( Ltmp, 1, &Overflow ), &Overflow ); /* Q_new */
+ Ltmp = Mpy_32_16_1( gain_code2, code2[i] ); /* Q10 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, Q_new_p5 ); /* Q15 + Q_new */
+ Ltmp = L_mac_sat( Ltmp, gain_pit, exc_rf[i + i_subfr] ); /* Q15 + Q_new */
+ exc2[i] = round_fx_sat( L_shl_sat( Ltmp, 1 ) ); /* Q_new */
+ move16();
+ Ltmp2 = Mpy_32_16_1( gain_code_vect[j], code[i] ); /* Q10 */
+ Ltmp2 = L_shl_sat( Ltmp2, Q_new_p5 ); /* Q15 + Q_new */
+ Ltmp = L_add_sat( Ltmp, Ltmp2 ); /* Q15 + Q_new */
+ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16 + Q_new*/
+ exc_rf[i + i_subfr] = round_fx_sat( Ltmp ); /* Q_new */
+#else
+ Ltmp = L_shl_o( Ltmp, Q_new_p5, &Overflow ); /* Q15 + Q_new */
+ Ltmp = L_mac_o( Ltmp, gain_pit, exc_rf[i + i_subfr], &Overflow ); /* Q15 + Q_new */
+ exc2[i] = round_fx_o( L_shl_o( Ltmp, 1, &Overflow ), &Overflow ); /* Q_new */
move16();
Ltmp2 = Mpy_32_16_1( gain_code_vect[j], code[i] ); /* Q10 */
Ltmp2 = L_shl_o( Ltmp2, Q_new_p5, &Overflow ); /* Q15 + Q_new */
Ltmp = L_add_o( Ltmp, Ltmp2, &Overflow ); /* Q15 + Q_new */
Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new*/
exc_rf[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); /* Q_new */
+#endif
move16();
}
tmp2 = L_SUBFR;
diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c
index 00b18f79d21242c3b6a4392a3baf3520dda5eea3..dcbe87a8d2b3d1b8798fc205719165709765a6e5 100644
--- a/lib_enc/enc_higher_acelp_fx.c
+++ b/lib_enc/enc_higher_acelp_fx.c
@@ -1,22 +1,26 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "rom_com.h" /* Static table prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "prot_fx.h" /* Function prototypes */
+#include "rom_com.h" /* Static table prototypes */
#include "prot_fx_enc.h"
+
/*---------------------------------------------------------------------*
* Local function prototype
*---------------------------------------------------------------------*/
+
static void find_cn_fx( const Word16 xn[], const Word16 Ap[], const Word16 *p_Aq, Word16 cn[] );
+
/*-----------------------------------------------------------------*
* Transform domain contribution encoding
*-----------------------------------------------------------------*/
+
#define Q_MINUS 4
void transf_cdbk_enc_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
@@ -85,7 +89,11 @@ void transf_cdbk_enc_fx(
*--------------------------------------------------------------*/
IF( EQ_16( st_fx->coder_type, INACTIVE ) )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gcode16 = round_fx_sat( L_shl_sat( gain_code, Q_new ) );
+#else
gcode16 = round_fx_o( L_shl_o( gain_code, Q_new, &Overflow ), &Overflow );
+#endif
FOR( i = 0; i < L_SUBFR; i++ )
{
/*x_tran[i] = xn[i] - *gain_pit * y1[i] - gain_code * y2[i];*/
@@ -179,8 +187,12 @@ void transf_cdbk_enc_fx(
{
m_corr = div_s( 16384, m_den );
e_corr = sub( 14 + 4, e_den );
- Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /*Q12*/
+ Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /*Q12*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ stmp = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12 */
+#else
stmp = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12 */
+#endif
}
ELSE
{
@@ -287,11 +299,7 @@ void transf_cdbk_enc_fx(
FOR( i = 0; i < Nsv * WIDTH_BAND; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC );
-#else
- x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow );
-#endif
move16();
}
@@ -439,7 +447,11 @@ void transf_cdbk_enc_ivas_fx(
*--------------------------------------------------------------*/
IF( EQ_16( st_fx->coder_type, INACTIVE ) )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gcode16 = round_fx_sat( L_shl_sat( gain_code, Q_new ) );
+#else
gcode16 = round_fx_o( L_shl_o( gain_code, Q_new, &Overflow ), &Overflow );
+#endif
FOR( i = 0; i < L_SUBFR; i++ )
{
/*x_tran[i] = xn[i] - *gain_pit * y1[i] - gain_code * y2[i];*/
@@ -532,8 +544,12 @@ void transf_cdbk_enc_ivas_fx(
{
m_corr = div_s( 16384, m_den );
e_corr = sub( 14 + 4, e_den );
- Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /*Q12*/
+ Ltmp = L_shr( Mult_32_16( Ltmp, m_corr ), e_corr ); /*Q12*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ stmp = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12 */
+#else
stmp = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12 */
+#endif
}
ELSE
{
@@ -616,9 +632,7 @@ void transf_cdbk_enc_ivas_fx(
move16();
move16();
}
-
- AVQ_encmux_ivas_fx( st_fx->hBstr, -1, x_norm, &nBits, Nsv, nq, avq_bit_sFlag, trgtSvPos );
-
+ AVQ_encmux_fx( st_fx->hBstr, -1, x_norm, &nBits, Nsv, nq, avq_bit_sFlag, trgtSvPos );
/* save # of AVQ unused bits for next subframe */
*unbits = nBits;
move16();
@@ -643,11 +657,7 @@ void transf_cdbk_enc_ivas_fx(
FOR( i = 0; i < Nsv * WIDTH_BAND; i++ )
{
-#ifdef ISSUE_1796_replace_shl_o
x_tran[i] = shl_sat( x_norm[i], Q_AVQ_OUT_DEC );
-#else
- x_tran[i] = shl_o( x_norm[i], Q_AVQ_OUT_DEC, &Overflow );
-#endif
move16();
}
diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c
index 5f173cd7f5e6a9869e3597cef881f91201418885..532c0389801740b2a330b9440a743b4e14fe7a8e 100644
--- a/lib_enc/enc_pit_exc_fx.c
+++ b/lib_enc/enc_pit_exc_fx.c
@@ -1,14 +1,15 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*======================================================================*/
/* FUNCTION : enc_pit_exc_fx() */
/*----------------------------------------------------------------------*/
@@ -45,6 +46,7 @@
/* RETURN ARGUMENTS : */
/* _ None */
/*=======================================================================*/
+
void enc_pit_exc_fx(
Encoder_State *st_fx, /* i/o: State structure */
const Word16 *speech, /* i : Input speech Q_new-1*/
@@ -102,9 +104,11 @@ void enc_pit_exc_fx(
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
LPD_state_HANDLE hLPDmem = st_fx->hLPDmem;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*------------------------------------------------------------------*
@@ -157,7 +161,6 @@ void enc_pit_exc_fx(
}
ELSE
{
-
Local_BR = ACELP_7k20;
move32();
Pitch_BR = st_fx->core_brate; /* Q0 */
@@ -228,6 +231,7 @@ void enc_pit_exc_fx(
/*------------------------------------------------------------------*
* ACELP subframe loop
*------------------------------------------------------------------*/
+
cn = NULL;
if ( EQ_16( L_subfr, L_SUBFR ) )
{
@@ -239,6 +243,7 @@ void enc_pit_exc_fx(
p_Aq = Aq;
pt_pitch = pitch_buf; /* pointer to the pitch buffer */
shift_wsp = add( Q_new, shift );
+
FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_subfr )
{
@@ -248,6 +253,7 @@ void enc_pit_exc_fx(
* target in residual domain "cn"
* Compute impulse response, h1[], of weighted synthesis filter
*----------------------------------------------------------------*/
+
Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* Q_new */
/* condition on target (compared to float) has been put outside the loop */
find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq,
@@ -262,8 +268,10 @@ void enc_pit_exc_fx(
* Close-loop pitch search and quantization
* Adaptive exc. construction
*----------------------------------------------------------------*/
+
*pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc,
- L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf ); /* Q6 */
+ L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */
+
/*-----------------------------------------------------------------*
* Find adaptive exitation
*-----------------------------------------------------------------*/
@@ -281,8 +289,7 @@ void enc_pit_exc_fx(
* (No LP filtering of the adaptive excitation)
*-----------------------------------------------------------------*/
- lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1,
- xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */
+ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */
IF( EQ_16( lp_flag, NORMAL_OPERATION ) )
{
@@ -290,7 +297,11 @@ void enc_pit_exc_fx(
}
/*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit;*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/
+#else
hSpMusClas->lowrate_pitchGain = round_fx_o( L_mac_o( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit, &Overflow ), &Overflow ); /*Q14*Q16(0.1) + Q15 -> Q15*/
+#endif
gpit_tmp = gain_pit;
move16(); /*Q14*/
@@ -315,7 +326,7 @@ void enc_pit_exc_fx(
push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 );
}
}
- else if ( use_fcb == 2 )
+ ELSE IF( use_fcb == 2 )
{
/*-----------------------------------------------------------------*
* Innovation encoding
@@ -328,7 +339,8 @@ void enc_pit_exc_fx(
* Gain encoding
*-----------------------------------------------------------------*/
- gain_enc_lbr_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, shift_wsp, y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR );
+ gain_enc_lbr_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, shift_wsp, y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR,
+ st_fx->element_mode );
}
ELSE
{
@@ -338,9 +350,11 @@ void enc_pit_exc_fx(
inov_encode_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq,
gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift );
+
/*-----------------------------------------------------------------*
* Gain encoding
*-----------------------------------------------------------------*/
+
gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_FRAME, i_subfr, -1, xn, y1, shift_wsp, y2, code, Es_pred,
&gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
}
@@ -358,18 +372,29 @@ void enc_pit_exc_fx(
hLPDmem->tilt_code = 0;
move16();
}
+
/*-----------------------------------------------------------------*
* Update memory of the weighting filter
*-----------------------------------------------------------------*/
+
IF( use_fcb != 0 )
{
- Ltmp = L_mult( gcode16, y2[L_subfr - 1] ); /* Q10 + Q_new */
- Ltmp = L_shl_o( Ltmp, add( 5, shift ), &Overflow ); /* Q15 + Q_new + shift */
+ Ltmp = L_mult( gcode16, y2[L_subfr - 1] ); /* Q10 + Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, add( 5, shift ) ); /* Q15 + Q_new + shift */
Ltmp = L_negate( Ltmp );
- Ltmp = L_mac_o( Ltmp, xn[L_subfr - 1], 16384, &Overflow ); /* Q_new + Q15 + shift */
- Ltmp = L_msu_o( Ltmp, y1[L_subfr - 1], gain_pit, &Overflow ); /* Q_new + Q15 + shift */
- Ltmp = L_shl_o( Ltmp, sub( 1, shift ), &Overflow ); /* Q_new + 15 */
- hLPDmem->mem_w0 = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */
+ Ltmp = L_mac_sat( Ltmp, xn[L_subfr - 1], 16384 ); /* Q_new + Q15 + shift */
+ Ltmp = L_msu_sat( Ltmp, y1[L_subfr - 1], gain_pit ); /* Q_new + Q15 + shift */
+ Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new + 15 */
+ hLPDmem->mem_w0 = round_fx_sat( Ltmp ); /*Q_new-1 */
+#else
+ Ltmp = L_shl_o( Ltmp, add( 5, shift ), &Overflow ); /* Q15 + Q_new + shift */
+ Ltmp = L_negate( Ltmp );
+ Ltmp = L_mac_o( Ltmp, xn[L_subfr - 1], 16384, &Overflow ); /* Q_new + Q15 + shift */
+ Ltmp = L_msu_o( Ltmp, y1[L_subfr - 1], gain_pit, &Overflow ); /* Q_new + Q15 + shift */
+ Ltmp = L_shl_o( Ltmp, sub( 1, shift ), &Overflow ); /* Q_new + 15 */
+ hLPDmem->mem_w0 = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */
+#endif
move16();
}
ELSE
@@ -385,16 +410,24 @@ void enc_pit_exc_fx(
* Construct adaptive part of the excitation
* Save the non-enhanced excitation for FEC_exc
*-----------------------------------------------------------------*/
+
IF( use_fcb != 0 )
{
FOR( i = 0; i < L_subfr; i++ )
{
/* code in Q9, gain_pit in Q14 */
- Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+ Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 + Q_new */
+ Ltmp = L_mac_sat( Ltmp, exc[i + i_subfr], gain_pit ); /* Q15 + Q_new */
+ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q_new + Q16*/
+ exc[i + i_subfr] = round_fx_sat( Ltmp ); /* Q_new */
+#else
Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 + Q_new */
Ltmp = L_mac_o( Ltmp, exc[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */
Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q_new + Q16*/
exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); /* Q_new */
+#endif
move16();
}
}
@@ -517,14 +550,13 @@ void enc_pit_exc_fx(
}
}
-#ifdef ISSUE_1796_replace_shl_o
- cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/
-#else
- cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/
-#endif
+ cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/
*gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/
+
+ return;
}
+
void enc_pit_exc_ivas_fx(
Encoder_State *st_fx, /* i/o: State structure */
const Word16 *speech, /* i : Input speech Q_new-1*/
@@ -581,9 +613,11 @@ void enc_pit_exc_ivas_fx(
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
LPD_state_HANDLE hLPDmem = st_fx->hLPDmem;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*------------------------------------------------------------------*
@@ -708,11 +742,12 @@ void enc_pit_exc_ivas_fx(
/*------------------------------------------------------------------*
* ACELP subframe loop
*------------------------------------------------------------------*/
- p_Aw = Aw;
+ p_Aw = Aw;
p_Aq = Aq;
pt_pitch = pitch_buf; /* pointer to the pitch buffer */
shift_wsp = add( Q_new, shift );
+
FOR( i_subfr = 0; i_subfr < st_fx->L_frame; i_subfr += L_subfr )
{
@@ -739,9 +774,9 @@ void enc_pit_exc_ivas_fx(
* Adaptive exc. construction
*----------------------------------------------------------------*/
- *pt_pitch = pit_encode_ivas_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc,
- L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new ); /* Q6 */
- move16();
+ *pt_pitch = pit_encode_fx( hBstr, st_fx->acelp_cfg.pitch_bits, Pitch_BR, 0, st_fx->L_frame, Pitch_CT, &pitch_limit_flag, i_subfr, exc,
+ L_subfr, st_fx->pitch, &T0_min, &T0_max, T0, T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st_fx->element_mode, Q_new ); /* Q6 */
+
Scale_sig( h1, L_subfr, sub( 14, q_h1 ) ); /* set h1[] in Q14 with scaling for convolution Q14*/
/*-----------------------------------------------------------------*
@@ -749,6 +784,7 @@ void enc_pit_exc_ivas_fx(
*-----------------------------------------------------------------*/
pred_lt4_ivas_fx( &exc[i_subfr], &exc[i_subfr], *T0, *T0_frac, L_subfr + 1, L_pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP );
+
/*-----------------------------------------------------------------*
* Gain clipping test to avoid unstable synthesis on frame erasure
* or in case of floating point encoder & fixed p. decoder
@@ -760,8 +796,9 @@ void enc_pit_exc_ivas_fx(
* Codebook target computation
* (No LP filtering of the adaptive excitation)
*-----------------------------------------------------------------*/
- lp_select = lp_filt_exc_enc_ivas_fx( MODE1, AUDIO, i_subfr, exc, h1,
- xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */
+
+ lp_select = lp_filt_exc_enc_fx( MODE1, AUDIO, i_subfr, exc, h1, xn, y1, xn2, L_subfr, st_fx->L_frame, g_corr, clip_gain, &gain_pit, &lp_flag ); /* Q0 */
+
IF( EQ_16( lp_flag, NORMAL_OPERATION ) )
{
push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 );
@@ -792,7 +829,7 @@ void enc_pit_exc_ivas_fx(
push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 );
}
}
- else if ( use_fcb == 2 )
+ ELSE IF( use_fcb == 2 )
{
/*-----------------------------------------------------------------*
* Innovation encoding
@@ -805,7 +842,8 @@ void enc_pit_exc_ivas_fx(
* Gain encoding
*-----------------------------------------------------------------*/
- gain_enc_lbr_ivas_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, sub( shift_wsp, 1 ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR );
+ gain_enc_lbr_fx( st_fx->hBstr, st_fx->acelp_cfg.gains_mode, GENERIC, i_subfr, xn, y1, sub( shift_wsp, 1 ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR,
+ st_fx->element_mode );
}
ELSE
{
@@ -815,12 +853,15 @@ void enc_pit_exc_ivas_fx(
inov_encode_ivas_fx( st_fx, Local_BR, 0, st_fx->L_frame, st_fx->last_L_frame, LOCAL_CT, WB, 1, i_subfr, -1, p_Aq,
gain_pit, cn, exc, h2, hLPDmem->tilt_code, *pt_pitch, xn2, code, y2, &unbits_PI, L_SUBFR, shift, Q_new );
+
/*-----------------------------------------------------------------*
* Gain encoding
*-----------------------------------------------------------------*/
- gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, st_fx->L_frame, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred,
- &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
+
+ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, st_fx->L_frame, i_subfr, -1, xn, y1, sub( shift_wsp, 1 ), y2, code, Es_pred,
+ &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
}
+
gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx );
Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/
@@ -835,18 +876,29 @@ void enc_pit_exc_ivas_fx(
hLPDmem->tilt_code = 0;
move16();
}
+
/*-----------------------------------------------------------------*
* Update memory of the weighting filter
*-----------------------------------------------------------------*/
+
IF( use_fcb != 0 )
{
Ltmp = L_mult0( gcode16, y2[L_subfr - 1] );
- Ltmp = L_shl_o( Ltmp, add( 5, shift ), &Overflow ); // Q_new+14+shift
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, add( 5, shift ) ); // Q_new+14+shift
+ Ltmp = L_negate( Ltmp );
+ Ltmp = L_mac_sat( Ltmp, xn[L_subfr - 1], 16384 ); // Q_new-1+15+shift
+ Ltmp = L_msu_sat( Ltmp, y1[L_subfr - 1], gain_pit ); // Q_new-1+15+shift
+ Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); // Q_new+15
+ hGSCEnc->mem_w0_tmp_fx = round_fx_sat( Ltmp ); /*Q_new-1 */
+#else
+ Ltmp = L_shl_o( Ltmp, add( 5, shift ), &Overflow ); // Q_new+14+shift
Ltmp = L_negate( Ltmp );
- Ltmp = L_mac_o( Ltmp, xn[L_subfr - 1], 16384, &Overflow ); // Q_new-1+15+shift
- Ltmp = L_msu_o( Ltmp, y1[L_subfr - 1], gain_pit, &Overflow ); // Q_new-1+15+shift
- Ltmp = L_shl_o( Ltmp, sub( 1, shift ), &Overflow ); // Q_new+15
- hGSCEnc->mem_w0_tmp_fx = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */
+ Ltmp = L_mac_o( Ltmp, xn[L_subfr - 1], 16384, &Overflow ); // Q_new-1+15+shift
+ Ltmp = L_msu_o( Ltmp, y1[L_subfr - 1], gain_pit, &Overflow ); // Q_new-1+15+shift
+ Ltmp = L_shl_o( Ltmp, sub( 1, shift ), &Overflow ); // Q_new+15
+ hGSCEnc->mem_w0_tmp_fx = round_fx_o( Ltmp, &Overflow ); /*Q_new-1 */
+#endif
}
ELSE
{
@@ -860,16 +912,24 @@ void enc_pit_exc_ivas_fx(
* Construct adaptive part of the excitation
* Save the non-enhanced excitation for FEC_exc
*-----------------------------------------------------------------*/
+
IF( use_fcb != 0 )
{
FOR( i = 0; i < L_subfr; i++ )
{
/* code in Q9, gain_pit in Q14 */
- Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+ Ltmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( Ltmp, 5 ); /* Q15 + Q_new */
+ Ltmp = L_mac_sat( Ltmp, exc[i + i_subfr], gain_pit ); /* Q15 + Q_new */
+ Ltmp = L_shl_sat( Ltmp, 1 ); /* saturation can occur here Q16 + Q_new */
+ exc[i + i_subfr] = round_fx_sat( Ltmp ); /* Q_new */
+#else
Ltmp = L_shl_o( Ltmp, 5, &Overflow ); /* Q15 + Q_new */
Ltmp = L_mac_o( Ltmp, exc[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */
Ltmp = L_shl_o( Ltmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new */
exc[i + i_subfr] = round_fx_o( Ltmp, &Overflow ); /* Q_new */
+#endif
move16();
}
}
@@ -993,10 +1053,8 @@ void enc_pit_exc_ivas_fx(
}
}
-#ifdef ISSUE_1796_replace_shl_o
- cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/
-#else
- cum_gpit = shl_o( cum_gpit, 1, &Overflow ); /*Q15*/
-#endif
+ cum_gpit = shl_sat( cum_gpit, 1 ); /*Q15*/
*gpit = round_fx( L_mac( L_mult( 3277, *gpit ), 29491, cum_gpit ) ); /*Q15*/
+
+ return;
}
diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c
index 6d6a2d575ac9f262d0817f60ef4cfa4232a5b9d4..94d869a01c66a9b43a2edbb493330da64dccb8da 100644
--- a/lib_enc/enc_prm_fx.c
+++ b/lib_enc/enc_prm_fx.c
@@ -8,7 +8,6 @@
#include
#include "options.h"
#include "cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "stl.h"
#include "prot_fx.h"
diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c
index fb601aebad7dc48ac4fea83e31633876ad84ec0e..c95f07e418b13f014775e377afae11da17daea63 100644
--- a/lib_enc/enc_tran_fx.c
+++ b/lib_enc/enc_tran_fx.c
@@ -1,15 +1,15 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Compilation switches */
-// #include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Compilation switches */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*=================================================================================*/
/* FUNCTION : void encod_tran_fx () */
/*---------------------------------------------------------------------------------*/
@@ -93,9 +93,11 @@ Word16 encod_tran_fx(
Word16 L_frame_fx;
Word16 shift_wsp;
Word32 L_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
@@ -228,8 +230,13 @@ Word16 encod_tran_fx(
}
gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/
+ gcode16 = round_fx_sat( Lgcode );
+#else
Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/
gcode16 = round_fx_o( Lgcode, &Overflow );
+#endif
hLPDmem->tilt_code = Est_tilt2( &exc_fx[i_subfr], gain_pit, code, Lgcode, &voice_fac, shift ); /* Q15 */
/*-----------------------------------------------------------------*
* Update memory of the weighting filter
@@ -277,11 +284,18 @@ Word16 encod_tran_fx(
FOR( i = 0; i < L_SUBFR; i++ )
{
/* code in Q9, gain_pit in Q14 */
- L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+ L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, 5 ); /* Q15 + Q_new */
+ L_tmp = L_mac_sat( L_tmp, exc_fx[i + i_subfr], gain_pit ); /* Q15 + Q_new */
+ L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q16 + Q_new */
+ exc_fx[i + i_subfr] = round_fx_sat( L_tmp ); /* Q_new */
+#else
L_tmp = L_shl_o( L_tmp, 5, &Overflow ); /* Q15 + Q_new */
L_tmp = L_mac_o( L_tmp, exc_fx[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */
L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new */
exc_fx[i + i_subfr] = round_fx_o( L_tmp, &Overflow ); /* Q_new */
+#endif
}
/*-----------------------------------------------------------------*
@@ -293,14 +307,22 @@ Word16 encod_tran_fx(
tmp1_fx = add( 16 - ( 2 + Q_AVQ_OUT_DEC + 1 ), Q_new );
FOR( i = 0; i < L_SUBFR; i++ )
{
- L_tmp = L_mult( gain_preQ, code_preQ[i] ); /* Q2 + Q10 -> Q13*/
- L_tmp = L_shl_o( L_tmp, tmp1_fx, &Overflow ); /* Q16 + Q_exc */
+ L_tmp = L_mult( gain_preQ, code_preQ[i] ); /* Q2 + Q10 -> Q13*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, tmp1_fx ); /* Q16 + Q_exc */
+ tmp_fx = round_fx_sat( L_tmp );
+ exc2_fx[i + i_subfr] = add_sat( exc2_fx[i + i_subfr], tmp_fx ); /* Q_exc */
+ move16();
+ exc_fx[i + i_subfr] = add_sat( exc_fx[i + i_subfr], tmp_fx ); /* Q_exc */
+ move16();
+#else
+ L_tmp = L_shl_o( L_tmp, tmp1_fx, &Overflow ); /* Q16 + Q_exc */
tmp_fx = round_fx_o( L_tmp, &Overflow );
-
exc2_fx[i + i_subfr] = add_o( exc2_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */
move16();
exc_fx[i + i_subfr] = add_o( exc_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */
move16();
+#endif
}
}
@@ -308,8 +330,13 @@ Word16 encod_tran_fx(
* Prepare TBE excitation
*-----------------------------------------------------------------*/
+#ifdef FIX_2010_PREP_TBE_EXC
+ prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR],
+ bwe_exc_fx, gain_preQ, code_preQ, Q10, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR],
bwe_exc_fx, gain_preQ, code_preQ, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate, st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#endif
/*-----------------------------------------------------------------*
* Synthesize speech to update mem_syn[].
@@ -467,9 +494,11 @@ Word16 encod_tran_ivas_fx(
Word16 shift_wsp;
Word32 L_tmp;
Word16 q_h1;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
@@ -590,28 +619,33 @@ Word16 encod_tran_ivas_fx(
IF( Jopt_flag == 0 )
{
/* SQ gain_code */
- gain_enc_tc_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y2, code, Es_pred_fx,
- &gain_pit, &gain_code, &gain_inov, &norm_gain_code, shift_wsp );
+ gain_enc_tc_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y2, code, Es_pred_fx,
+ &gain_pit, &gain_code, &gain_inov, &norm_gain_code, shift_wsp );
}
ELSE
{
IF( GT_32( st_fx->core_brate, ACELP_32k ) )
{
/* SQ gain_pit and gain_code */
- gain_enc_SQ_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y1, y2, code, Es_pred_fx,
- &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, shift_wsp );
+ gain_enc_SQ_fx( hBstr, st_fx->acelp_cfg.gains_mode, i_subfr, xn, y1, y2, code, Es_pred_fx,
+ &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain, shift_wsp );
}
ELSE
{
/* VQ gain_pit and gain_code */
- gain_enc_mless_ivas_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame_fx, i_subfr, tc_subfr, xn, y1, shift_wsp, y2, code, Es_pred_fx,
- &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
+ gain_enc_mless_fx( hBstr, st_fx->acelp_cfg.gains_mode, st_fx->element_mode, L_frame_fx, i_subfr, tc_subfr, xn, y1, shift_wsp, y2, code, Es_pred_fx,
+ &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, clip_gain );
}
}
gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit, st_fx->clip_var_fx );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lgcode = L_shl_sat( gain_code, Q_new ); /* scaled gain_code with Qnew -> Q16*/
+ gcode16 = round_fx_sat( Lgcode );
+#else
Lgcode = L_shl_o( gain_code, Q_new, &Overflow ); /* scaled gain_code with Qnew -> Q16*/
gcode16 = round_fx_o( Lgcode, &Overflow );
+#endif
hLPDmem->tilt_code = est_tilt_ivas_fx( &exc_fx[i_subfr], gain_pit, code, gain_code, &voice_fac, Q_new, L_SUBFR, 0 ); // Q15
/*-----------------------------------------------------------------*
* Update memory of the weighting filter
@@ -659,11 +693,18 @@ Word16 encod_tran_ivas_fx(
FOR( i = 0; i < L_SUBFR; i++ )
{
/* code in Q9, gain_pit in Q14 */
- L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+ L_tmp = L_mult( gcode16, code[i] ); /* Q10 + Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, 5 ); /* Q15 + Q_new */
+ L_tmp = L_mac_sat( L_tmp, exc_fx[i + i_subfr], gain_pit ); /* Q15 + Q_new */
+ L_tmp = L_shl_sat( L_tmp, 1 ); /* saturation can occur here Q16 + Q_new */
+ exc_fx[i + i_subfr] = round_fx_sat( L_tmp ); /* Q_new */
+#else
L_tmp = L_shl_o( L_tmp, 5, &Overflow ); /* Q15 + Q_new */
L_tmp = L_mac_o( L_tmp, exc_fx[i + i_subfr], gain_pit, &Overflow ); /* Q15 + Q_new */
L_tmp = L_shl_o( L_tmp, 1, &Overflow ); /* saturation can occur here Q16 + Q_new */
exc_fx[i + i_subfr] = round_fx_o( L_tmp, &Overflow ); /* Q_new */
+#endif
}
/*-----------------------------------------------------------------*
@@ -675,13 +716,22 @@ Word16 encod_tran_ivas_fx(
tmp1_fx = add( 16 - ( 2 + Q_AVQ_OUT_DEC + 1 ), Q_new );
FOR( i = 0; i < L_SUBFR; i++ )
{
- L_tmp = L_mult( gain_preQ, code_preQ[i] ); /* Q2 + Q10 -> Q13*/
- L_tmp = L_shl_o( L_tmp, tmp1_fx, &Overflow ); /* Q16 + Q_exc */
+ L_tmp = L_mult( gain_preQ, code_preQ[i] ); /* Q2 + Q10 -> Q13*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, tmp1_fx ); /* Q16 + Q_exc */
+ tmp_fx = round_fx_sat( L_tmp );
+
+ exc2_fx[i + i_subfr] = add_sat( exc2_fx[i + i_subfr], tmp_fx ); /* Q_exc */
+ move16();
+ exc_fx[i + i_subfr] = add_sat( exc_fx[i + i_subfr], tmp_fx ); /* Q_exc */
+#else
+ L_tmp = L_shl_o( L_tmp, tmp1_fx, &Overflow ); /* Q16 + Q_exc */
tmp_fx = round_fx_o( L_tmp, &Overflow );
exc2_fx[i + i_subfr] = add_o( exc2_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */
move16();
exc_fx[i + i_subfr] = add_o( exc_fx[i + i_subfr], tmp_fx, &Overflow ); /* Q_exc */
+#endif
move16();
}
}
@@ -690,9 +740,15 @@ Word16 encod_tran_ivas_fx(
* Prepare TBE excitation
*-----------------------------------------------------------------*/
+#ifdef FIX_2010_PREP_TBE_EXC
+ prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR],
+ bwe_exc_fx, gain_preQ, code_preQ, Q10, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate,
+ st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame_fx, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR],
bwe_exc_fx, gain_preQ, code_preQ, Q_new, T0, T0_frac, st_fx->coder_type, st_fx->core_brate,
st_fx->element_mode, st_fx->idchan, st_fx->hBWE_TD != NULL, st_fx->tdm_LRTD_flag );
+#endif
/*-----------------------------------------------------------------*
* Synthesize speech to update mem_syn[].
diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c
index 887b4afb89415cb4b620ecf726a04924a72a21c9..28c79a9685515706fc1314278f47efd228229791 100644
--- a/lib_enc/enc_uv_fx.c
+++ b/lib_enc/enc_uv_fx.c
@@ -331,9 +331,9 @@ void encod_unvoiced_ivas_fx(
*----------------------------------------------------------------*/
IF( !uc_two_stage_flag )
{
- *pt_pitch_fx = gaus_encode_ivas_fx( st_fx, i_subfr, h1_fx, xn_fx, exc_fx, &hLPDmem->mem_w0, st_fx->clip_var_fx,
- &hLPDmem->tilt_code, code_fx, &L_gain_code_fx, y2_fx, &gain_inov_fx,
- &voice_fac_fx, &gain_pit_fx, Q_new, shift, &norm_gain_code_fx ); /* Q0 */
+ *pt_pitch_fx = gaus_encode_fx( st_fx, i_subfr, h1_fx, xn_fx, exc_fx, &hLPDmem->mem_w0, st_fx->clip_var_fx,
+ &hLPDmem->tilt_code, code_fx, &L_gain_code_fx, y2_fx, &gain_inov_fx,
+ &voice_fac_fx, &gain_pit_fx, Q_new, shift, &norm_gain_code_fx ); /* Q0 */
move16();
}
ELSE
diff --git a/lib_enc/energy_fx.c b/lib_enc/energy_fx.c
index cc0001d4a7a1684d0a3329f4fa577272a6151d04..308c7cc5d28cf513250c38881da33aa5e04e0194 100644
--- a/lib_enc/energy_fx.c
+++ b/lib_enc/energy_fx.c
@@ -42,11 +42,6 @@ void est_energy_fx(
const Word16 *Nregion_index;
Word32 *sb_power = enerBuffer;
Word32 Ltmp32 = 0;
-#ifndef ISSUE_1799_replace_L_shr_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
-#endif
-#endif
move32();
SNR_sb_num = SNR_SUB_BAND_NUM[bandwidth - CLDFBVAD_NB_ID];
move16();
@@ -127,11 +122,7 @@ void est_energy_fx(
tmpspec_amp = L_shl( sb_power[j], s16MaxCoefNorm ); /* sb_power_Q + s16MaxCoefNorm */
s32CopyPower = L_add( s32CopyPower, tmpspec_amp );
}
-#ifdef ISSUE_1799_replace_L_shr_o
frame_sb_energy[i] = L_shr_sat( s32CopyPower, s16MaxCoefNorm ); /* sb_power_Q */
-#else
- frame_sb_energy[i] = L_shr_o( s32CopyPower, s16MaxCoefNorm, &Overflow ); /* sb_power_Q */
-#endif
move32();
}
diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c
index ce7f05968128c6c31b9f24f99af344dc9f15c235..eafe13f5301876636a605a3c5b5f428abf2df51f 100644
--- a/lib_enc/eval_pit_contr_fx.c
+++ b/lib_enc/eval_pit_contr_fx.c
@@ -1,17 +1,19 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* Local constantes
*-------------------------------------------------------------------*/
+
#define NB_VOIC_FX 13
#define DIV_NB_VOIC_FX 2521
@@ -23,6 +25,7 @@
#define HANGOVER_DELAY 2
+
/*======================================================================*/
/* FUNCTION : Pit_exc_contribution_len_fx() */
/*----------------------------------------------------------------------*/
@@ -41,23 +44,21 @@
/* _ (Word16[]) dct_res : DCT of residual Qnew */
/* _ (Word16[]) dct_pitex : DCT of pitch contribution Qnew */
/*-----------------------------------------------------------------------*/
-
-
/*-----------------------------------------------------------------------*/
/* RETURN ARGUMENTS : */
/* _ None */
/*=======================================================================*/
-Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is significant */
- Encoder_State *st_fx, /* i/o: state structure */
- const Word16 *dct_res, /* i : DCT of residual Qnew*/
- Word16 *dct_pitex, /* i/o: DCT of pitch contribution Qnew*/
- Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/
- const Word16 nb_subfr, /* i : Number of subframe considered Q0*/
- Word16 *hangover, /* i : hangover for the time contribution switching Q0*/
- Word16 Qnew )
+/* o : bin where pitch contribution is significant */
+Word16 Pit_exc_contribution_len_fx(
+ Encoder_State *st_fx, /* i/o: state structure */
+ const Word16 *dct_res, /* i : DCT of residual Qnew*/
+ Word16 *dct_pitex, /* i/o: DCT of pitch contribution Qnew*/
+ Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/
+ const Word16 nb_subfr, /* i : Number of subframe considered Q0*/
+ Word16 *hangover, /* i : hangover for the time contribution switching Q0*/
+ Word16 Qnew )
{
-
Word16 corr_dct_pit[MBANDS_LOC];
Word32 corr_tmp, L_tmp;
Word16 av_corr, min_corr, ftmp, tmp_ex, tmp_res;
diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c
index 87fa6a451061c07e284666c6bd70cb22ac42ac79..42f6dc487b52d5df5c56c46676513741ff3d6f8e 100644
--- a/lib_enc/ext_sig_ana_fx.c
+++ b/lib_enc/ext_sig_ana_fx.c
@@ -118,7 +118,7 @@ void core_signal_analysis_high_bitrate_fx(
&hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &hTcxEnc->tcxltp_gain,
&hTcxEnc->tcxltp_pitch_int_past, &hTcxEnc->tcxltp_pitch_fr_past, &hTcxEnc->tcxltp_gain_past,
&hTcxEnc->tcxltp_norm_corr_past, st->last_core, st->pit_min, st->pit_fr1,
- st->pit_fr2, st->pit_max, st->pit_res_max, &st->transientDetection,
+ st->pit_fr2, st->pit_max, st->pit_res_max, st->hTranDet,
tmp8, NULL, M );
}
ELSE
@@ -130,7 +130,7 @@ void core_signal_analysis_high_bitrate_fx(
&hTcxEnc->tcxltp_pitch_int, &hTcxEnc->tcxltp_pitch_fr, &hTcxEnc->tcxltp_gain,
&hTcxEnc->tcxltp_pitch_int_past, &hTcxEnc->tcxltp_pitch_fr_past, &hTcxEnc->tcxltp_gain_past,
&hTcxEnc->tcxltp_norm_corr_past, st->last_core, st->pit_min, st->pit_fr1,
- st->pit_fr2, st->pit_max, st->pit_res_max, &st->transientDetection,
+ st->pit_fr2, st->pit_max, st->pit_res_max, st->hTranDet,
tmp8, NULL, M );
}
diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c
index 9298c863481ba068e9933d1d90336774fe3d47c6..8b41b4e7847b75e49f8d0bcee0f72a6eaa051f0d 100644
--- a/lib_enc/fd_cng_enc_fx.c
+++ b/lib_enc/fd_cng_enc_fx.c
@@ -2,13 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
#include
#include "stl.h"
#include "options.h"
#include "cnst.h"
#include "stl.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "rom_enc.h"
#include "prot_fx.h"
@@ -2469,7 +2467,11 @@ void FdCng_encodeSID_ivas_fx(
v_fx[i] = Mpy_32_32( 671088640 /*10 in Q26*/, BASOP_Util_Log10( E_fx[i], hFdCngEnc->msNoiseEst_fx_exp ) ); // Q20 = 26+25-31
move32();
}
- e_fx = L_add( e_fx, v_fx[i] ); // Q20
+#ifdef FIX_1980_CRASH_FDCNG_ENCODESID
+ e_fx = L_add( e_fx, L_shr( v_fx[i], 1 ) ); // Q19, add one bit headroom
+#else
+ e_fx = L_add( e_fx, v_fx[i] ); // Q20
+#endif
}
/* Normalize MSVQ input */
@@ -2538,8 +2540,11 @@ void FdCng_encodeSID_ivas_fx(
{
gain_fx = L_add( gain_fx, v_fx[i] ); // Q = 31 - v_e
}
-
- e_fx = L_shl( e_fx, sub( 11, v_e ) ); // Q = 31 - v_e
+#ifdef FIX_1980_CRASH_FDCNG_ENCODESID
+ e_fx = L_shl( e_fx, sub( 12, v_e ) ); // Q = 31 - v_e
+#else
+ e_fx = L_shl( e_fx, sub( 11, v_e ) ); // Q = 31 - v_e
+#endif
gain_fx = Mpy_32_16_1( L_sub( e_fx, gain_fx ), div_s( 1, N ) ); // Q = 31 - v_e
gain_fx = L_shl( gain_fx, sub( v_e, 8 ) ); // Q23
diff --git a/lib_enc/find_tar_fx.c b/lib_enc/find_tar_fx.c
index 989f309d2f2a5ee0305103ec476bc9ca9416ba80..0fec2c42479ea010499ffdacc4d400cc165f30bc 100644
--- a/lib_enc/find_tar_fx.c
+++ b/lib_enc/find_tar_fx.c
@@ -134,7 +134,11 @@ void find_targets_fx(
{
Ltmp = L_msu( Ltmp, Aqs[j], h1[i - j] ); /* Q27 */
}
- h1[i] = round_fx( L_shl_o( Ltmp, s, &Overflow ) ); /* Q11 + s */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ h1[i] = round_fx( L_shl_sat( Ltmp, s ) ); /* Q11 + s */
+#else
+ h1[i] = round_fx( L_shl_o( Ltmp, s, &Overflow ) ); /* Q11 + s */
+#endif
}
Ltmp = L_mult( Ap[i], s2 ); /* Q27 */
FOR( j = 1; j <= M; j++ )
@@ -181,9 +185,11 @@ void find_targets_ivas_fx(
Word32 h1_32[6 * L_SUBFR];
Word16 sf;
Word64 Ltmp64;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
/*------------------------------------------------------------------------*
* Find the target vector for excitation search:
@@ -250,14 +256,20 @@ void find_targets_ivas_fx(
}
set32_fx( h1_32, 0, L_subfr );
+#ifndef ISSUE_1867_replace_overflow_libenc
Overflow = 0;
move16();
+#endif
FOR( i = 0; i < M; i++ )
{
Ltmp64 = W_mult_16_16( Ap[i], s2 ); /* Q27 */
FOR( j = 1; j <= i; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_sat( h1_32[i - j], s ) ) ); /* Q27 */
+#else
Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */
+#endif
}
h1_32[i] = W_extract_l( Ltmp64 ); /* Q27 */
move32();
@@ -266,17 +278,29 @@ void find_targets_ivas_fx(
Ltmp64 = W_mult_16_16( Ap[i], s2 ); /* Q27 */
FOR( j = 1; j <= M; j++ )
{
- Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_sat( h1_32[i - j], s ) ) ); /* Q27 */
+#else
+ Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */
+#endif
}
h1_32[M] = W_extract_l( Ltmp64 ); /* Q27 */
move32();
FOR( i = M + 1; i < L_subfr; i++ )
{
- Ltmp64 = W_msu_16_16( 0, Aqs[1], extract_h( L_shl_o( h1_32[i - 1], s, &Overflow ) ) ); /* Q27 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp64 = W_msu_16_16( 0, Aqs[1], extract_h( L_shl_sat( h1_32[i - 1], s ) ) ); /* Q27 */
+#else
+ Ltmp64 = W_msu_16_16( 0, Aqs[1], extract_h( L_shl_o( h1_32[i - 1], s, &Overflow ) ) ); /* Q27 */
+#endif
FOR( j = 2; j <= M; j++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_sat( h1_32[i - j], s ) ) ); /* Q27 */
+#else
Ltmp64 = W_msu_16_16( Ltmp64, Aqs[j], extract_h( L_shl_o( h1_32[i - j], s, &Overflow ) ) ); /* Q27 */
+#endif
}
h1_32[i] = W_extract_l( Ltmp64 ); /* Q27 */
move32();
diff --git a/lib_enc/find_tilt_fx.c b/lib_enc/find_tilt_fx.c
index d2e946098eb7705583310860000b716b7485d424..56078ec1eaf8b25faf54ec72f4a98b254dd219ef 100644
--- a/lib_enc/find_tilt_fx.c
+++ b/lib_enc/find_tilt_fx.c
@@ -44,9 +44,11 @@ void find_tilt_fx(
Word16 scaling;
move32();
move32();
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*-----------------------------------------------------------------*
* Initializations
@@ -108,8 +110,13 @@ void find_tilt_fx(
/*mean_voi = 0.5f * (voicing[1] + voicing[2]) + corr_shift;*/
Ltmp = L_mult( voicing[1], 16384 /* 0.5 in Q15 */ ); /* Q31 */
Ltmp = L_mac( Ltmp, voicing[2], 16384 /* 0.5 in Q15 */ ); /* Q31 */
- Ltmp = L_mac_o( Ltmp, corr_shift, 32767, &Overflow ); /* Q31 */
- mean_voi = round_fx_o( Ltmp, &Overflow ); /* Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_mac_sat( Ltmp, corr_shift, 32767 ); /* Q31 */
+ mean_voi = round_fx_sat( Ltmp ); /* Q15 */
+#else
+ Ltmp = L_mac_o( Ltmp, corr_shift, 32767, &Overflow ); /* Q31 */
+ mean_voi = round_fx_o( Ltmp, &Overflow ); /* Q15 */
+#endif
/*f0 = INT_FS_FX / pitch[2];*/
e_tmp = norm_s( pitch[2] );
@@ -155,13 +162,22 @@ void find_tilt_fx(
tmp = sub( freq, f2 );
IF( L_mac0( -(Word32) TH_D_FX * TH_D_FX, tmp, tmp ) < 0 )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ lp_E = L_add_sat( *pt_E, lp_E ); /* Q_new + QSCALE - 2 */
+#else
lp_E = L_add_o( *pt_E, lp_E, &Overflow ); /* Q_new + QSCALE - 2 */
- m_cnt = add( m_cnt, 1 ); /* Q0 */
+#endif
+ m_cnt = add( m_cnt, 1 ); /* Q0 */
}
pt_E++;
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ f1 = add_sat( f1, f0 );
+ f2 = add_sat( f2, f0 );
+#else
f1 = add_o( f1, f0, &Overflow );
f2 = add_o( f2, f0, &Overflow );
+#endif
}
/*lp_E = lp_E / (float)cnt - lp_bckr;*/
e_tmp = sub( norm_l( lp_E ), 1 );
@@ -175,10 +191,10 @@ void find_tilt_fx(
m_tmp = div_s( m_tmp, m_cnt ); /* exp(e_tmp + e_cnt) */
e_tmp = sub( e_tmp, e_cnt );
-#ifdef ISSUE_1799_replace_L_shr_o
- lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ lp_E = L_sub_sat( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr ); /* Q_new + QSCALE */
#else
- lp_E = L_sub_o( L_shr_o( m_tmp, sub( e_tmp, 1 ), &Overflow ), lp_bckr, &Overflow ); /* Q_new + QSCALE */
+ lp_E = L_sub_o( L_shr_sat( m_tmp, sub( e_tmp, 1 ) ), lp_bckr, &Overflow ); /* Q_new + QSCALE */
#endif
pt_E = tmp_E + VOIC_BINS; /* Update for next half-frame */
@@ -207,11 +223,7 @@ void find_tilt_fx(
m_tmp = div_s( m_tmp, m_hpE ); /* exp(e_tmp + e_hpE) */
e_tmp = sub( e_tmp, e_hpE );
-#ifdef ISSUE_1799_replace_L_shr_o
ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */
-#else
- ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */
-#endif
}
ELSE IF( lp_E == 0 )
{
@@ -224,7 +236,11 @@ void find_tilt_fx(
IF( EQ_16( bwidth, NB ) ) /* For NB input, compensate for the missing bands */
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( ee[i], 3 );
+#else
Ltmp = L_shl_o( ee[i], 3, &Overflow );
+#endif
IF( EQ_32( Ltmp, MAX_32 ) ) /* if Overflow: Compute with less precision */
{
Ltmp = Mult_32_16( ee[i], 24576 /* 0.75 in Q15 */ ); /* 6/8 Q6*/
@@ -279,9 +295,11 @@ void find_tilt_ivas_fx(
Word64 sum;
Word16 inv_bands, q_lp_E;
Word32 Le_min_scaled, Ltmp2;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
move32();
move32();
@@ -352,10 +370,15 @@ void find_tilt_ivas_fx(
hp_bckr = L_add_sat( L_shl_sat( hp_bckr, 1 ), hp_bckr ); /* Q_new */
}
/*mean_voi = 0.5f * (voicing[1] + voicing[2]) + corr_shift;*/
- Ltmp = L_mult( voicing[1], 16384 /* 0.5 in Q15 */ ); // Q31
- Ltmp = L_mac( Ltmp, voicing[2], 16384 /* 0.5 in Q15 */ ); // Q31
+ Ltmp = L_mult( voicing[1], 16384 /* 0.5 in Q15 */ ); // Q31
+ Ltmp = L_mac( Ltmp, voicing[2], 16384 /* 0.5 in Q15 */ ); // Q31
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_mac_sat( Ltmp, corr_shift, 32767 /* 1.0f in Q15 */ ); // Q31
+ mean_voi = round_fx_sat( Ltmp ); // Q15
+#else
Ltmp = L_mac_o( Ltmp, corr_shift, 32767 /* 1.0f in Q15 */, &Overflow ); // Q31
mean_voi = round_fx_o( Ltmp, &Overflow ); // Q15
+#endif
/*f0 = INT_FS_FX / pitch[2];*/
e_tmp = norm_s( pitch[2] );
@@ -369,13 +392,9 @@ void find_tilt_ivas_fx(
FOR( i = 0; i < 2; i++ )
{
- /*hp_E[i] = 0.5f * (hf_bands[max_band-1] + hf_bands[max_band]) - hp_bckr; */ /* averaged E in last 2 critical bands */
-#ifndef FIX_1762_COMPILER_ISSUE_NEW
- Ltmp = W_extract_h( W_mac_32_32( W_mult_32_32( hf_bands[max_band - 1], ONE_IN_Q30 ), hf_bands[max_band], ONE_IN_Q30 ) ); // q_fr_bands
-#else
+ /*hp_E[i] = 0.5f * (hf_bands[max_band-1] + hf_bands[max_band]) - hp_bckr; */ /* averaged E in last 2 critical bands */
Ltmp = W_extract_h( W_shl( W_add( W_deposit32_l( hf_bands[max_band - 1] ), W_deposit32_l( hf_bands[max_band] ) ), 31 ) ); // q_fr_bands
-#endif
- Ltmp = L_sub( Ltmp, hp_bckr ); // q_fr_bands
+ Ltmp = L_sub( Ltmp, hp_bckr ); // q_fr_bands
Ltmp2 = L_max( Ltmp, L_shl_sat( 1, q_fr_bands ) ); // q_fr_bands, saturation is added because q_fr_bands is limited to 31
if ( Opt_vbr_mode == 0 )
@@ -411,8 +430,13 @@ void find_tilt_ivas_fx(
}
pt_E++;
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ f1 = add_sat( f1, f0 );
+ f2 = add_sat( f2, f0 );
+#else
f1 = add_o( f1, f0, &Overflow );
f2 = add_o( f2, f0, &Overflow );
+#endif
}
/*lp_E = lp_E / (float)cnt - lp_bckr;*/
e_tmp = sub( W_norm( sum ), 1 );
@@ -474,18 +498,18 @@ void find_tilt_ivas_fx(
m_hpE = extract_h( L_shl( hp_E[i], e_hpE ) ); // e_hpE+q_bckr-16
m_tmp = div_s( m_tmp, m_hpE ); // Q15+(e_tmp+q_lp_E)-(e_hpE+q_bckr)
e_tmp = sub( add( e_tmp, q_lp_E ), add( e_hpE, q_bckr ) );
-#ifdef ISSUE_1799_replace_L_shr_o
ee[i] = L_shr_sat( m_tmp, add( e_tmp, 15 - 6 ) ); /* ee in Q6 */
-#else
- ee[i] = L_shr_o( m_tmp, add( e_tmp, 15 - 6 ), &Overflow ); /* ee in Q6 */
-#endif
move32();
}
IF( bwidth == NB ) /* For NB input, compensate for the missing bands */
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_shl_sat( ee[i], 3 ); /* Q6 */
+#else
Ltmp = L_shl_o( ee[i], 3, &Overflow ); /* Q6 */
- IF( EQ_32( Ltmp, MAX_32 ) ) /* if Overflow: Compute with less precision */
+#endif
+ IF( EQ_32( Ltmp, MAX_32 ) ) /* if Overflow: Compute with less precision */
{
Ltmp = Mult_32_16( ee[i], 24576 /* 0.75 in Q15 */ ); /* 6/8 Q6*/
ee[i] = L_shl_sat( Ltmp, 3 ); /* Q6 */
diff --git a/lib_enc/find_uv_fx.c b/lib_enc/find_uv_fx.c
index 792ddf2657bb1179654586be941c73121a581717..401b64cb55346e5cd824b8d5c9d1e2c2d1034478 100644
--- a/lib_enc/find_uv_fx.c
+++ b/lib_enc/find_uv_fx.c
@@ -115,9 +115,11 @@ Word16 find_uv_fx( /* o : coding type */
Word16 ee0_th, ee1_th, voi_th, nb_cond, flag_low_relE;
NOISE_EST_HANDLE hNoiseEst = st_fx->hNoiseEst;
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Word16 Last_Resort;
@@ -178,11 +180,7 @@ Word16 find_uv_fx( /* o : coding type */
exp1 = sub( norm_l( *pt_enr_ssf1 ), 1 );
wtmp1 = extract_h( L_shl( *pt_enr_ssf1, exp1 ) );
fac = div_s( wtmp1, wtmp0 );
-#ifdef ISSUE_1799_replace_L_shr_o
fac_32 = L_shr_sat( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ) ); /* fac32 in Q13*/
-#else
- fac_32 = L_shr_o( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ), &Overflow ); /* fac32 in Q13*/
-#endif
if ( GT_32( fac_32, dE1 ) )
{
@@ -201,9 +199,13 @@ Word16 find_uv_fx( /* o : coding type */
* Average voicing (normalized correlation)
*-----------------------------------------------------------------*/
- /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */
- mean_ee = L_add_o( L_add_o( st_fx->ee_old_fx, ee[0], &Overflow ), ee[1], &Overflow ); /* Q6 */
- mean_ee = Mult_32_16( mean_ee, 10923 /* 1/3 in Q15 */ ); /*Q6*/
+ /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ mean_ee = L_add_sat( L_add_sat( st_fx->ee_old_fx, ee[0] ), ee[1] ); /* Q6 */
+#else
+ mean_ee = L_add_o( L_add_o( st_fx->ee_old_fx, ee[0], &Overflow ), ee[1], &Overflow ); /* Q6 */
+#endif
+ mean_ee = Mult_32_16( mean_ee, 10923 /* 1/3 in Q15 */ ); /*Q6*/
/* mean_voi3 = 1.0f/3.0f * (voicing[0] + voicing[1] + voicing[2]);*/
Ltmp0 = L_mult( st_fx->voicing_fx[0], 10923 /* 1/3 in Q15 */ ); /* Q31 */
@@ -228,7 +230,11 @@ Word16 find_uv_fx( /* o : coding type */
{
dE2_th = 21 << 10;
move32();
- if ( GE_16( add_o( mean_voi3, corr_shift, &Overflow ), 22282 /* 0.68 in Q15 */ ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( GE_16( add_sat( mean_voi3, corr_shift ), 22282 /* 0.68 in Q15 */ ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/
+#else
+ if ( GE_16( add_o( mean_voi3, corr_shift, &Overflow ), 22282 /* 0.68 in Q15 */ ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/
+#endif
{
nb_cond = 0;
move16();
@@ -307,7 +313,11 @@ Word16 find_uv_fx( /* o : coding type */
test();
if ( ( EQ_16( st_fx->last_coder_type_raw, UNVOICED ) ) || /* previous frame was unvoiced */
( ( LT_32( ee[0], ee0_th ) ) && ( GT_32( hp_E[0], L_shl( E_MIN_FX, Q_new ) ) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */
- ( LT_16( add_o( st_fx->voicing_fx[0], corr_shift, &Overflow ), voi_th ) ) ) ) /* normalized correlation is low */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ ( LT_16( add_sat( st_fx->voicing_fx[0], corr_shift ), voi_th ) ) ) ) /* normalized correlation is low */
+#else
+ ( LT_16( add_o( st_fx->voicing_fx[0], corr_shift, &Overflow ), voi_th ) ) ) ) /* normalized correlation is low */
+#endif
{
tmp_offset_flag = 0;
move16();
@@ -383,16 +393,21 @@ Word16 find_uv_fx( /* o : coding type */
test();
test();
test();
- if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
- ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
- ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
- ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
- ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
- /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */
- ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
- ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */
- ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
- flag_low_relE ) /* low relative frame energy (only for SC-VBR) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
+ ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
+#else
+ if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
+ ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
+#endif
+ ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
+ ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
+ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
+ /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */
+ ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
+ ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */
+ ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
+ flag_low_relE ) /* low relative frame energy (only for SC-VBR) */
{
coder_type = UNVOICED;
move16();
@@ -412,16 +427,20 @@ Word16 find_uv_fx( /* o : coding type */
test();
test();
test();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
+#else
if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
- ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.8 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
- ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
- ( LT_32( ee[1], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
- ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
- /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */
- ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
- ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */
- ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
- || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */
+#endif
+ ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.8 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
+ ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
+ ( LT_32( ee[1], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
+ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
+ /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */
+ ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
+ ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */
+ ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
+ || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */
{
coder_type = UNVOICED;
move16();
@@ -614,9 +633,11 @@ Word16 find_uv_ivas_fx( /* o : coding typ
Word16 ee0_th, ee1_th, voi_th, nb_cond, flag_low_relE;
NOISE_EST_HANDLE hNoiseEst = st_fx->hNoiseEst;
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Word16 Last_Resort;
Word16 vadnoise;
@@ -674,11 +695,7 @@ Word16 find_uv_ivas_fx( /* o : coding typ
exp1 = sub( norm_l( *pt_enr_ssf1 ), 1 );
wtmp1 = extract_h( L_shl( *pt_enr_ssf1, exp1 ) );
fac = div_s( wtmp1, wtmp0 );
-#ifdef ISSUE_1799_replace_L_shr_o
fac_32 = L_shr_sat( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ) ); /* fac32 in Q13*/
-#else
- fac_32 = L_shr_o( L_deposit_l( fac ), add( sub( exp1, exp0 ), 15 - 13 ), &Overflow ); /* fac32 in Q13*/
-#endif
if ( GT_32( fac_32, dE1 ) )
{
@@ -721,9 +738,13 @@ Word16 find_uv_ivas_fx( /* o : coding typ
* Average voicing (normalized correlation)
*-----------------------------------------------------------------*/
- /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */
- mean_ee = L_add_o( L_add_o( st_fx->ee_old_fx, ee[0], &Overflow ), ee[1], &Overflow ); /* Q6 */
- mean_ee = Mult_32_16( mean_ee, 10923 ); /*Q6*/
+ /*mean_ee = 1.0f/3.0f * (st->ee_old + ee[0] + ee[1]); */ /* coefficients take into account the position of the window */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ mean_ee = L_add_sat( L_add_sat( st_fx->ee_old_fx, ee[0] ), ee[1] ); /* Q6 */
+#else
+ mean_ee = L_add_o( L_add_o( st_fx->ee_old_fx, ee[0], &Overflow ), ee[1], &Overflow ); /* Q6 */
+#endif
+ mean_ee = Mult_32_16( mean_ee, 10923 ); /*Q6*/
/* mean_voi3 = 1.0f/3.0f * (voicing[0] + voicing[1] + voicing[2]);*/
Ltmp0 = L_mult( st_fx->voicing_fx[0], 10923 /* 1/3 in Q15 */ ); /* Q31 */
@@ -748,7 +769,11 @@ Word16 find_uv_ivas_fx( /* o : coding typ
{
dE2_th = 21 << 10;
move32();
- if ( GE_16( add_o( mean_voi3, corr_shift, &Overflow ), 22282 ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( GE_16( add_sat( mean_voi3, corr_shift ), 22282 ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/
+#else
+ if ( GE_16( add_o( mean_voi3, corr_shift, &Overflow ), 22282 ) ) /*( mean_voi3 + corr_shift ) >= 0.68f*/
+#endif
{
nb_cond = 0;
move16();
@@ -827,9 +852,16 @@ Word16 find_uv_ivas_fx( /* o : coding typ
test();
test();
test();
- IF( ( EQ_16( st_fx->last_coder_type_raw, UNVOICED ) ) || /* previous frame was unvoiced */
- ( ( LT_32( ee[0], ee0_th ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */
- ( LT_16( add_o( st_fx->voicing_fx[0], corr_shift, &Overflow ), voi_th ) ) ) ) /* normalized correlation is low */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ IF( ( EQ_16( st_fx->last_coder_type_raw, UNVOICED ) ) || /* previous frame was unvoiced */
+ ( ( LT_32( ee[0], ee0_th ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */
+ ( LT_16( add_sat( st_fx->voicing_fx[0], corr_shift ), voi_th ) ) ) )
+ /* normalized correlation is low */
+#else
+ IF( ( EQ_16( st_fx->last_coder_type_raw, UNVOICED ) ) || /* previous frame was unvoiced */
+ ( ( LT_32( ee[0], ee0_th ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy is concentrated in high frequencies provided that some energy is present in HF */
+ ( LT_16( add_o( st_fx->voicing_fx[0], corr_shift, &Overflow ), voi_th ) ) ) ) /* normalized correlation is low */
+#endif
{
tmp_offset_flag = 0;
move16();
@@ -905,16 +937,30 @@ Word16 find_uv_ivas_fx( /* o : coding typ
test();
test();
test();
- IF( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
- ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
- ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
- ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
- ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
- /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */
- ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
- ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */
- ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
- flag_low_relE ) /* low relative frame energy (only for SC-VBR) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ IF( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
+ ( LT_16( add_sat( st_fx->voicing_fx[2], corr_shift ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
+ ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
+ ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
+ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
+ /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */
+ ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
+ ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */
+ ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
+ flag_low_relE )
+#else
+ IF( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22282 /* 0.68 in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
+ ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 /* 0.79 in Q15 */ ) ) && /* normalized correlation low on look-ahead - onset detection */
+ ( LT_32( ee[0], 640 /* 10.0f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
+ ( LT_32( ee[1], ee1_th ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
+ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
+ /*( st_fx->music_hysteresis_fx == 0 ) &&*/ /* ... and in segment after AUDIO frames */
+ ( LE_32( dE1, 237568 /* 29.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
+ ( LE_32( st_fx->old_dE1_fx, 237568 /* 29.0f in Q13 */ ) ) && /* + one frame hysteresis */
+ ( st_fx->spike_hyst < 0 ) ) || /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
+ flag_low_relE )
+#endif
+ /* low relative frame energy (only for SC-VBR) */
{
coder_type = UNVOICED;
move16();
@@ -931,16 +977,20 @@ Word16 find_uv_ivas_fx( /* o : coding typ
test();
test();
test();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( ( ( LT_16( add_sat( mean_voi3, corr_shift ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
+#else
if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22774 /* 0.695f in Q15 */, mean_voi3_offset ) ) ) && /* normalized correlation low */
- /*( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 ) ) && */ /* normalized correlation low on look-ahead - onset detection */
- ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
- ( LT_32( ee[1], 397 /* 6.2f in Q16 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
- ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
- /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */
- ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
- ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */
- ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
- || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */
+#endif
+ /*( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 ) ) && */ /* normalized correlation low on look-ahead - onset detection */
+ ( LT_32( ee[0], 397 /* 6.2f in Q6 */ ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */
+ ( LT_32( ee[1], 397 /* 6.2f in Q16 */ ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */
+ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */
+ /*( st_fx->music_hysteresis_fx == 0 ) && */ /* ... and in segment after AUDIO frames */
+ ( LE_32( dE1, 245760 /* 30.0f in Q13 */ ) ) && /* Avoid on sharp energy spikes */
+ ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) && /* + one frame hysteresis */
+ ( st_fx->spike_hyst < 0 ) ) /* Avoid after sharp energy spikes followed by decay (e.g. castanets) */
+ || ( flag_low_relE && ( LE_32( st_fx->old_dE1_fx, 245760 /* 30.0f in Q13 */ ) ) ) ) /* low relative frame energy (only for SC-VBR) */
{
coder_type = UNVOICED;
move16();
diff --git a/lib_enc/gain_enc_fx.c b/lib_enc/gain_enc_fx.c
index 5e2a111693f72c8b8d5964b36708897b451935dd..1d3cecfc58addd80dfa0b746ed2f5bbe96bc542f 100644
--- a/lib_enc/gain_enc_fx.c
+++ b/lib_enc/gain_enc_fx.c
@@ -1,15 +1,15 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "rom_com.h" /* Static table prototypes */
-//#include "prot_fx.h" /* Function prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* Local constants
*-------------------------------------------------------------------*/
@@ -17,12 +17,14 @@
#define RANGE 64
#define NB_QUA_GAIN7B 128 /* Number of quantization levels */
+
/*-------------------------------------------------------------------*
* Local function prototype
*-------------------------------------------------------------------*/
static Word16 Find_Opt_gainQ_fx( Word16 *coeff, Word16 *exp_coeff, Word16 *gain_pit, Word32 *gain_code, Word16 gcode0, Word16 exp_gcode0, const Word16 *cdbk, const Word16 size );
+
/*==========================================================================*/
/* FUNCTION : Es_pred_enc_fx() */
/*--------------------------------------------------------------------------*/
@@ -64,9 +66,11 @@ void Es_pred_enc_fx(
Word16 s0, s1, ener_dB, mean_ener_code16;
const Word16 *qua_table;
Word32 ener_fx, Lmean_ener_code, Ltmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
Lmean_ener_code = L_deposit_l( 0 );
@@ -95,7 +99,11 @@ void Es_pred_enc_fx(
FOR( i = 1; i < L_SUBFR; i++ )
{
tmp16 = mult_r( res[i_subfr + i], 8192 /* 1 in Q13 */ ); /* remove 2bits Q_new - 2*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ ener_fx = L_mac_sat( ener_fx, tmp16, tmp16 );
+#else
ener_fx = L_mac_o( ener_fx, tmp16, tmp16, &Overflow );
+#endif
}
/* ener = 10 * (float)log10(ener / (float)L_SUBFR) */
@@ -177,7 +185,11 @@ void Es_pred_enc_fx(
FOR( i = 1; i < size; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp16_2 = abs_s( sub_sat( mean_ener_code16, qua_table[i] ) );
+#else
tmp16_2 = abs_s( sub_o( mean_ener_code16, qua_table[i], &Overflow ) );
+#endif
IF( LT_16( tmp16_2, tmp16 ) )
{
tmp16 = tmp16_2;
@@ -233,9 +245,11 @@ void gain_enc_mless_fx(
Word16 exp1, exp2;
Word16 exp_num, exp_den, exp_div, frac_den;
Word32 L_frac_num, L_frac_den, L_div;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*-----------------------------------------------------------------*
@@ -275,31 +289,42 @@ void gain_enc_mless_fx(
/* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code );
exp_inov = sub( exp_code, 18 + 6 );
- exp_code = sub( exp_code, 30 );
+ // To avoid crash in case code value is 0,
+ test();
+ IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) && element_mode > EVS_MONO )
+ {
+ // setting values to avoid extra computation
+ *gain_inov = 32767; /*8(max value gain_inov can hold) in Q12*/
+ Ei = -9743; /* -38 in Q8*/
+ move16();
+ move16();
+ }
+ ELSE
+ {
- /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
+ exp_code = sub( exp_code, 30 );
- /*----------------------------------------------------------------*
- * calculate the predicted gain code
- *----------------------------------------------------------------*/
- tmp = norm_l( L_tmp );
- frac = Log2_norm_lc( L_shl( L_tmp, tmp ) );
- tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
- L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */
- Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
+ /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
+ /*----------------------------------------------------------------*
+ * calculate the predicted gain code
+ *----------------------------------------------------------------*/
+ tmp = norm_l( L_tmp );
+ frac = Log2_norm_lc( L_shl( L_tmp, tmp ) );
+ tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
+ L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */
+ Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
+ /*---------------------------------------------------------------*
+ * Decode codebook gain and the adaptive excitation low-pass
+ * filtering factor (Finalize computation )
+ *---------------------------------------------------------------*/
+ /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
+ L_tmp = Isqrt_lc( L_tmp, &exp_inov );
+ *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
+ move16();
+ }
/* predicted codebook gain */
gcode0 = sub( Es_pred, Ei ); /* Q8 */
-
- /*---------------------------------------------------------------*
- * Decode codebook gain and the adaptive excitation low-pass
- * filtering factor (Finalize computation )
- *---------------------------------------------------------------*/
- /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
- L_tmp = Isqrt_lc( L_tmp, &exp_inov );
- *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
- move16();
-
/* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */
/*----------------------------------------------------------------*
* gcode0 = pow(10.0, gcode0/20)
@@ -339,10 +364,10 @@ void gain_enc_mless_fx(
= ((-0.5*g_corr[3]*g_corr[0]) - (-0.25*g_corr[1]*g_corr[4]))/tmp1;
= ((0.25*g_corr[1]*g_corr[4]) - (0.5*g_corr[0]*g_corr[3]))/tmp1; */
- L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/
+ L_tmp1 = L_mult_sat( coeff[0], coeff[2] ); /*Q31*/
exp1 = add( exp_coeff[0], exp_coeff[2] );
- L_tmp2 = L_shr( L_mult( coeff[4], coeff[4] ), 2 ); /*Q31*/
+ L_tmp2 = L_shr( L_mult_sat( coeff[4], coeff[4] ), 2 ); /*Q31*/
exp2 = add( exp_coeff[4], exp_coeff[4] );
IF( GT_16( exp1, exp2 ) )
@@ -388,7 +413,11 @@ void gain_enc_mless_fx(
L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
exp_div = sub( exp_num, exp_den );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *gain_pit = round_fx_sat( L_shl_sat( L_div, add( exp, exp_div ) ) ); /*Q14*/
+#else
*gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/
+#endif
L_tmp1 = L_shr( L_mult( coeff[1], coeff[4] ), 2 ); /*Q31*/
exp1 = add( exp_coeff[1], exp_coeff[4] );
@@ -413,7 +442,11 @@ void gain_enc_mless_fx(
L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
exp_div = sub( exp_num, exp_den );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *gain_code = L_shl_sat( L_div, sub( add( exp, exp_div ), 14 ) );
+#else
*gain_code = L_shl_o( L_div, sub( add( exp, exp_div ), 14 ), &Overflow );
+#endif
move32(); /*Q16*/
*gain_pit = s_max( G_PITCH_MIN_TC192_Q14, s_min( *gain_pit, G_PITCH_MAX_TC192_Q14 ) );
@@ -442,8 +475,12 @@ void gain_enc_mless_fx(
index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_TC192_Q14, LG10_G_CODE_MAX_TC192_Q13, nBits2, &expg );
push_indice( hBstr, IND_GAIN_CODE, index, nBits2 );
- L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/
- *gain_code = L_shl_o( L_tmp, add( add( expg, exp_gcode0 ), 15 ), &Overflow ); /*Q16*/
+ L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/
+#else
+ *gain_code = L_shl_o( L_tmp, add( add( expg, exp_gcode0 ), 15 ), &Overflow ); /*Q16*/
+#endif
}
ELSE
{
@@ -466,6 +503,7 @@ void gain_enc_mless_fx(
qua_table = gain_qua_mless_6b_fx;
if ( element_mode > EVS_MONO )
{
+ qua_table = gain_qua_mless_6b_stereo_fx;
}
move16();
if ( EQ_16( clip_gain, 1 ) )
@@ -521,17 +559,23 @@ void gain_enc_mless_fx(
return;
}
+/*---------------------------------------------------------------------*
+ * gain_enc_SQ()
+ *
+ * Scalar Quantization of pitch and codebook gains without prediction
+ * - an initial predicted gain, gcode0, is first determined based on
+ * the predicted scaled innovation energy
+ * - a correction factor gamma = g_code / gcode0 is then vector quantized
+ * along with gain_pit
+ * - the mean-squared weighted error criterion is used for codebook search
+ *---------------------------------------------------------------------*/
-void gain_enc_mless_ivas_fx(
+void gain_enc_SQ_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 element_mode, /* i : element mode Q0*/
- const Word16 L_frame, /* i : length of the frame Q0*/
const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 tc_subfr, /* i : TC subframe index Q0*/
const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 Q_xn, /* i : xn and y1 scaling */
+ const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/
const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
const Word16 *code, /* i : algebraic excitation Q9*/
const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/
@@ -539,101 +583,97 @@ void gain_enc_mless_ivas_fx(
Word32 *gain_code, /* o : quantized codebook gain Q16*/
Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 Qx*/
- const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/
+ Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/
+ const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
+ const Word16 Q_xn /* i : xn and y1 scaling */
)
{
-
- Word16 index, size, nBits, nBits2;
+ Word16 index, nBits_pitch, nBits_code;
Word16 gcode0, Ei, gain_code16;
- const Word16 *qua_table;
Word16 coeff[5], exp_coeff[5];
Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp;
+
Word32 L_tmp, L_tmp1, L_tmp2;
Word16 tmp1, expg;
Word16 exp1, exp2;
Word16 exp_num, exp_den, exp_div, frac_den;
Word32 L_frac_num, L_frac_den, L_div;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*-----------------------------------------------------------------*
* calculate the rest of the correlation coefficients
* c2 = , c3 = -2, c4 = 2
*-----------------------------------------------------------------*/
+ /*g_corr[1] *= -0.5;*/
+ /*g_corr[2] = dotp( y2, y2, L_SUBFR ) + 0.01f;*/
+ /*g_corr[3] = dotp( xn, y2, L_SUBFR ) - 0.02f;*/
+ /*g_corr[4] = dotp( yy1, y2, L_SUBFR ) + 0.02f;*/
coeff[0] = g_corr[0];
move16();
exp_coeff[0] = g_corr[1];
move16();
- coeff[1] = negate( g_corr[2] );
- move16(); /* coeff[1] = -2 xn yy1 */
- exp_coeff[1] = add( g_corr[3], 1 );
+ coeff[1] = g_corr[2];
+ move16(); /* coeff[1] = xn yy1 */
+ exp_coeff[1] = g_corr[3];
move16();
/* Compute scalar product */
coeff[2] = extract_h( Dot_product12( y2, y2, L_SUBFR, &exp ) );
+ move16();
exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) );
move16(); /* -18 (y2 Q9) */
- /* Compute scalar product -2* */
- coeff[3] = extract_h( L_negate( Dot_product12( xn, y2, L_SUBFR, &exp ) ) );
- exp_coeff[3] = add( sub( exp, 9 - 1 ), Q_xn );
- move16(); /* -9 (y2 Q9), +1 (2 xn y2) */
+ /* Compute scalar product */
+ coeff[3] = extract_h( Dot_product12( xn, y2, L_SUBFR, &exp ) );
+ move16();
+ exp_coeff[3] = add( sub( exp, 9 ), Q_xn );
+ move16(); /* -9 (y2 Q9), (xn y2) */
- /* Compute scalar product 2* */
- coeff[4] = extract_h( Dot_product12( y1, y2, L_SUBFR, &exp ) );
- exp_coeff[4] = add( sub( exp, 9 - 1 ), Q_xn );
- move16(); /* -9 (y2 Q9), +1 (2 y1 y2) */
+ /* Compute scalar product */
+ coeff[4] = extract_h( Dot_product12( yy1, y2, L_SUBFR, &exp ) );
+ move16();
+ exp_coeff[4] = add( sub( exp, 9 ), Q_xn );
+ move16(); /* -9 (y2 Q9), (y1 y2) */
/*-----------------------------------------------------------------*
* calculate the unscaled innovation energy
* calculate the predicted gain code
+ * calculate optimal gains
*-----------------------------------------------------------------*/
+ /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;*/
+ /**gain_inov = 1.0f / (float)sqrt( Ecode );*/
- /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code );
exp_inov = sub( exp_code, 18 + 6 );
+ exp_code = sub( exp_code, 30 );
- // To avoid crash in case code value is 0,
- IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( L_tmp, exp_inov, 21474836, 0 ), -1 ) )
- {
- // setting values to avoid extra computation
- *gain_inov = 32767; /*8(max value gain_inov can hold) in Q12*/
- Ei = -9743; /* -38 in Q8*/
- move16();
- move16();
- }
- ELSE
- {
- exp_code = sub( exp_code, 30 );
-
- /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
-
- /*----------------------------------------------------------------*
- * calculate the predicted gain code
- *----------------------------------------------------------------*/
- tmp = norm_l( L_tmp );
- frac = Log2_norm_lc( L_shl( L_tmp, tmp ) );
- tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
- L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */
- Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
-
- /*---------------------------------------------------------------*
- * Decode codebook gain and the adaptive excitation low-pass
- * filtering factor (Finalize computation )
- *---------------------------------------------------------------*/
- /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
- L_tmp = Isqrt_lc( L_tmp, &exp_inov );
- *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
- move16();
- }
+ /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
+ /*----------------------------------------------------------------*
+ * calculate the predicted gain code
+ *----------------------------------------------------------------*/
+ tmp = norm_l( L_tmp );
+ frac = Log2_norm_lc( L_shl( L_tmp, tmp ) );
+ tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
+ L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */
+ Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
/* predicted codebook gain */
gcode0 = sub( Es_pred, Ei ); /* Q8 */
+ /*---------------------------------------------------------------*
+ * Decode codebook gain and the adaptive excitation low-pass
+ * filtering factor (Finalize computation )
+ *---------------------------------------------------------------*/
+ /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
+ L_tmp = Isqrt_lc( L_tmp, &exp_inov );
+ *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
+
/* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */
/*----------------------------------------------------------------*
* gcode0 = pow(10.0, gcode0/20)
@@ -650,197 +690,175 @@ void gain_enc_mless_ivas_fx(
/* 16384 < Pow2() <= 32767 */
exp_gcode0 = sub( exp_gcode0, 14 );
- /*-----------------------------------------------------------------*
- * select the codebook, size and number of bits
- * set the gains searching range
- *-----------------------------------------------------------------*/
- nBits = gains_mode[i_subfr >> 6];
- move16();
- test();
- test();
- test();
- test();
- test();
- IF( ( EQ_16( tc_subfr, 3 * L_SUBFR ) && EQ_16( i_subfr, 3 * L_SUBFR ) && EQ_16( L_frame, L_FRAME ) ) ||
- ( EQ_16( tc_subfr, 4 * L_SUBFR ) && EQ_16( i_subfr, 4 * L_SUBFR ) && EQ_16( L_frame, L_FRAME16k ) ) )
- {
- /* *gain_pit = (g_corr[2]*tmp2) - (0.5f*g_corr[4]*tmp3);
- = ((-0.5f*g_corr[1]*g_corr[2]) - (-0.25*g_corr[3]*g_corr[4]))/tmp1;
- = ((0.25*g_corr[3]*g_corr[4]) - (0.5*g_corr[1]*g_corr[2]))/tmp1; */
+ /*tmp1 = (g_corr[0]*g_corr[2]) - (g_corr[4]*g_corr[4]);
+ tmp2 = g_corr[1]/tmp1;
+ tmp1 = g_corr[3]/tmp1;
- /* *gain_code = (g_corr[0]*tmp3) - (0.5f*g_corr[4]*tmp2);
- = ((-0.5*g_corr[3]*g_corr[0]) - (-0.25*g_corr[1]*g_corr[4]))/tmp1;
- = ((0.25*g_corr[1]*g_corr[4]) - (0.5*g_corr[0]*g_corr[3]))/tmp1; */
+ *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp1);
+ *gain_code = (g_corr[0]*tmp1) - (g_corr[4]*tmp2);*/
- L_tmp1 = L_mult_sat( coeff[0], coeff[2] ); /*Q31 added saturation for -32768*-32768*/
- exp1 = add( exp_coeff[0], exp_coeff[2] );
+ /* *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp3);
+ = ((g_corr[1]*g_corr[2]) - (g_corr[3]*g_corr[4]))/tmp1;*/
- L_tmp2 = L_shr( L_mult_sat( coeff[4], coeff[4] ), 2 ); /*Q31 added saturation for -32768*-32768*/
- exp2 = add( exp_coeff[4], exp_coeff[4] );
+ /* *gain_code = (g_corr[0]*tmp3) - (g_corr[4]*tmp2);
+ = ((g_corr[3]*g_corr[0]) - (g_corr[1]*g_corr[4]))/tmp1;*/
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_den = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_den = exp2;
- move16();
- }
- L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/
+ L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/
+ exp1 = add( exp_coeff[0], exp_coeff[2] );
- frac_den = extract_h( L_frac_den ); /* Q15 */
- frac_den = s_max( frac_den, 1 ); /* Q15 */
- L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */
- exp = norm_l( L_frac_den );
- tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp2 = L_mult_sat( coeff[4], coeff[4] ); /*Q31*/
+#else
+ L_tmp2 = L_mult_o( coeff[4], coeff[4], &Overflow ); /*Q31*/
+#endif
+ exp2 = add( exp_coeff[4], exp_coeff[4] );
- L_tmp1 = L_shr( L_mult( coeff[3], coeff[4] ), 2 ); /*Q31*/
- exp1 = add( exp_coeff[3], exp_coeff[4] );
+ IF( GT_16( exp1, exp2 ) )
+ {
+ L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
+ exp_den = exp1;
+ move16();
+ }
+ ELSE
+ {
+ L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
+ exp_den = exp2;
+ move16();
+ }
+ L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/
- L_tmp2 = L_shr( L_mult( coeff[1], coeff[2] ), 1 ); /*Q31*/
- exp2 = add( exp_coeff[1], exp_coeff[2] );
+ frac_den = extract_h( L_frac_den ); /* Q15 */
+ frac_den = s_max( frac_den, 1 ); /* Q15 */
+ L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */
+ exp = norm_l( L_frac_den );
+ tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_num = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_num = exp2;
- move16();
- }
- L_frac_num = L_sub( L_tmp1, L_tmp2 ); /*Q31*/
- L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
- exp_div = sub( exp_num, exp_den );
+ L_tmp1 = L_mult( coeff[3], coeff[4] ); /*Q31*/
+ exp1 = add( exp_coeff[3], exp_coeff[4] );
- *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/
+ L_tmp2 = L_mult( coeff[1], coeff[2] ); /*Q31*/
+ exp2 = add( exp_coeff[1], exp_coeff[2] );
- L_tmp1 = L_shr( L_mult( coeff[1], coeff[4] ), 2 ); /*Q31*/
- exp1 = add( exp_coeff[1], exp_coeff[4] );
+ IF( GT_16( exp1, exp2 ) )
+ {
+ L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
+ exp_num = exp1;
+ move16();
+ }
+ ELSE
+ {
+ L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
+ exp_num = exp2;
+ move16();
+ }
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_frac_num = L_sub_sat( L_tmp2, L_tmp1 ); /*Q31*/
+#else
+ L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/
+#endif
- L_tmp2 = L_shr( L_mult( coeff[0], coeff[3] ), 1 ); /*Q31*/
- exp2 = add( exp_coeff[0], exp_coeff[3] );
+ L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
+ exp_div = sub( exp_num, exp_den );
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_num = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_num = exp2;
- move16();
- }
- L_frac_num = L_sub( L_tmp1, L_tmp2 ); /*Q31*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *gain_pit = round_fx_sat( L_shl_sat( L_div, add( exp, exp_div ) ) ); /*Q14*/
+#else
+ *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/
+#endif
- L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
- exp_div = sub( exp_num, exp_den );
+#ifdef FIX_1978_SAT_MISSING_IN_GAIN_ENC
+ L_tmp1 = L_mult_sat( coeff[1], coeff[4] ); /*Q31*/
+#else
+ L_tmp1 = L_mult( coeff[1], coeff[4] ); /*Q31*/
+#endif
+ exp1 = add( exp_coeff[1], exp_coeff[4] );
- *gain_code = L_shl_o( L_div, sub( add( exp, exp_div ), 14 ), &Overflow );
- move32(); /*Q16*/
+#ifdef FIX_1978_SAT_MISSING_IN_GAIN_ENC
+ L_tmp2 = L_mult_sat( coeff[0], coeff[3] ); /*Q31*/
+#else
+ L_tmp2 = L_mult( coeff[0], coeff[3] ); /*Q31*/
+#endif
+ exp2 = add( exp_coeff[0], exp_coeff[3] );
- *gain_pit = s_max( G_PITCH_MIN_TC192_Q14, s_min( *gain_pit, G_PITCH_MAX_TC192_Q14 ) );
+ IF( GT_16( exp1, exp2 ) )
+ {
+ L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
+ exp_num = exp1;
+ move16();
+ }
+ ELSE
+ {
+ L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
+ exp_num = exp2;
+ move16();
+ }
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_frac_num = L_sub_sat( L_tmp2, L_tmp1 ); /*Q31*/
+#else
+ L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/
+#endif
- /* set number of bits for two SQs */
- nBits2 = shr( add( nBits, 1 ), 1 );
- nBits = shr( nBits, 1 );
+ L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
+ exp_div = sub( exp_num, exp_den );
- /* gain_pit Q */
+ *gain_code = L_shl_sat( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) );
+ move32(); /*Q16*/
- tmp1 = mult_r( G_PITCH_MAX_MINUS_MIN_TC192_Q13, div_s( 1, sub( shl( 1, nBits ), 1 ) ) ); /*Q13*/ /* set quantization step */
- index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_TC192_Q14, tmp1, shl( 1, nBits ) );
- move16();
- push_indice( hBstr, IND_GAIN_PIT, index, nBits );
+ *gain_pit = s_max( G_PITCH_MIN_Q14, s_min( *gain_pit, G_PITCH_MAX_Q14 ) );
- /* gain_code Q */
- /**gain_code /= gcode0;*/
- IF( gcode0 != 0 )
- {
- tmp = div_s( 16384, gcode0 ); /*Q15*/
- L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/
- *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/
- move32();
- }
+ /*-----------------------------------------------------------------*
+ * limit the pitch gain searching range (if indicated by clip_gain)
+ *-----------------------------------------------------------------*/
- index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_TC192_Q14, LG10_G_CODE_MAX_TC192_Q13, nBits2, &expg );
- push_indice( hBstr, IND_GAIN_CODE, index, nBits2 );
- L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/
- *gain_code = L_shl_o( L_tmp, add( add( expg, exp_gcode0 ), 15 ), &Overflow ); /*Q16*/
+ test();
+ test();
+ IF( EQ_16( clip_gain, 1 ) && GT_16( *gain_pit, 15565 /* 0.95 in Q14 */ ) )
+ {
+ *gain_pit = 15565; /* 0.95 in Q14 */
+ move16();
}
- ELSE
+ ELSE IF( EQ_16( clip_gain, 2 ) && GT_16( *gain_pit, 10650 /* 0.65 in Q14 */ ) )
{
- size = shl( 1, nBits );
+ *gain_pit = 10650; /* 0.65 in Q14 */
+ move16();
+ }
- SWITCH( nBits )
- {
- case 7:
- {
- qua_table = gain_qua_mless_7b_fx; // Q14
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 30 );
- }
- BREAK;
- }
- case 6:
- {
- qua_table = gain_qua_mless_6b_fx; // Q14
- if ( element_mode > EVS_MONO )
- {
- qua_table = gain_qua_mless_6b_stereo_fx;
- }
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 14 );
- }
- BREAK;
- }
- case 5:
- {
- qua_table = gain_qua_mless_5b_fx; // Q14
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 6 );
- }
- BREAK;
- }
- default:
- {
- qua_table = gain_qua_mless_6b_fx; // Q14
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 14 );
- }
- BREAK;
- }
- }
+ /*-----------------------------------------------------------------*
+ * search for the best quantized values
+ *-----------------------------------------------------------------*/
- /* in case of AVQ inactive, limit the gain_pit to 0.65 */
- test();
- IF( EQ_16( clip_gain, 2 ) && EQ_16( nBits, 6 ) )
- {
- size = sub( size, 36 );
- nBits = sub( nBits, 1 );
- }
+ nBits_pitch = gains_mode[i_subfr >> 6];
+ move16();
- /*-----------------------------------------------------------------*
- * search for the best quantizer
- *-----------------------------------------------------------------*/
- index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, qua_table, size );
- push_indice( hBstr, IND_GAIN, index, nBits );
+ /* set number of bits for two SQs */
+ nBits_code = shr( add( nBits_pitch, 1 ), 1 );
+ nBits_pitch = shr( nBits_pitch, 1 );
+
+ /* gain_pit Q */
+ /*tmp1 = (G_PITCH_MAX - G_PITCH_MIN) / ((1 << nBits_pitch) - 1);*/ /* set quantization step */
+ tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */
+
+ index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) ); // Q0
+ push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch );
+
+ /* gain_code Q */
+ /* *gain_code /= gcode0; */
+ IF( gcode0 != 0 )
+ {
+ tmp = div_s( 16384, gcode0 ); /*Q15*/
+ L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/
+ *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/
+ move32();
}
+ index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg );
+ push_indice( hBstr, IND_GAIN_CODE, index, nBits_code );
+ L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/
+ *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) );
+ move32(); /*Q16*/
+
/* *norm_gain_code = *gain_code / *gain_inov; */
exp = sub( norm_s( *gain_inov ), 1 );
exp = s_max( exp, 0 );
@@ -851,1599 +869,422 @@ void gain_enc_mless_ivas_fx(
return;
}
-
-/*---------------------------------------------------------------------*
- * gain_enc_SQ()
+/*-------------------------------------------------------------------*
+ * gain_enc_gaus()
*
- * Scalar Quantization of pitch and codebook gains without prediction
- * - an initial predicted gain, gcode0, is first determined based on
- * the predicted scaled innovation energy
- * - a correction factor gamma = g_code / gcode0 is then vector quantized
- * along with gain_pit
- * - the mean-squared weighted error criterion is used for codebook search
- *---------------------------------------------------------------------*/
-
-void gain_enc_SQ_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
- const Word16 *code, /* i : algebraic excitation Q9*/
- const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/
- Word16 *gain_pit, /* o : quantized pitch gain Q14*/
- Word32 *gain_code, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/
- const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
- const Word16 Q_xn /* i : xn and y1 scaling */
+ * Quantization of gain for Gaussian codebook
+ *-------------------------------------------------------------------*/
+Word16 gain_enc_gaus_fx( /* o : Return index of quantization */
+ Word32 *gain, /* i/o: Code gain to quantize Q16*/
+ const Word16 bits, /* i : number of bits to quantize Q0*/
+ const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/
+ const Word16 stepSize, /* i : Step size choice Q14*/
+ const Word16 inv_stepSize /* i : Step size choice Q15*/
)
{
- Word16 index, nBits_pitch, nBits_code;
- Word16 gcode0, Ei, gain_code16;
- Word16 coeff[5], exp_coeff[5];
- Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp;
-
- Word32 L_tmp, L_tmp1, L_tmp2;
- Word16 tmp1, expg;
- Word16 exp1, exp2;
- Word16 exp_num, exp_den, exp_div, frac_den;
- Word32 L_frac_num, L_frac_den, L_div;
+ Word16 index, exp_gain, frac_gain, wtmp;
+ Word16 enr_q, wenr;
+ Word32 Ltmp, enr;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
+ /*enr = 20.0 * log10(*gain + 0.001) codebook gain in dB */
+ exp_gain = norm_l( *gain );
+ frac_gain = Log2_norm_lc( L_shl( *gain, exp_gain ) );
+ exp_gain = sub( 30 - 16, exp_gain );
- /*-----------------------------------------------------------------*
- * calculate the rest of the correlation coefficients
- * c2 = , c3 = -2, c4 = 2
- *-----------------------------------------------------------------*/
- /*g_corr[1] *= -0.5;*/
- /*g_corr[2] = dotp( y2, y2, L_SUBFR ) + 0.01f;*/
- /*g_corr[3] = dotp( xn, y2, L_SUBFR ) - 0.02f;*/
- /*g_corr[4] = dotp( yy1, y2, L_SUBFR ) + 0.02f;*/
+ enr = Mpy_32_16( exp_gain, frac_gain, LG10 ); /* Output in Q13 */
+ wenr = extract_h( L_shl( enr, 8 + 3 ) );
- coeff[0] = g_corr[0];
- move16();
- exp_coeff[0] = g_corr[1];
- move16();
- coeff[1] = g_corr[2];
- move16(); /* coeff[1] = xn yy1 */
- exp_coeff[1] = g_corr[3];
- move16();
-
- /* Compute scalar product */
- coeff[2] = extract_h( Dot_product12( y2, y2, L_SUBFR, &exp ) );
- move16();
- exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) );
- move16(); /* -18 (y2 Q9) */
+ /*----------------------------------------------------------------*
+ * Quantize linearly the log E
+ *----------------------------------------------------------------*/
- /* Compute scalar product */
- coeff[3] = extract_h( Dot_product12( xn, y2, L_SUBFR, &exp ) );
- move16();
- exp_coeff[3] = add( sub( exp, 9 ), Q_xn );
- move16(); /* -9 (y2 Q9), (xn y2) */
+ wtmp = sub( wenr, lowBound ); /* Q8 */
- /* Compute scalar product */
- coeff[4] = extract_h( Dot_product12( yy1, y2, L_SUBFR, &exp ) );
- move16();
- exp_coeff[4] = add( sub( exp, 9 ), Q_xn );
- move16(); /* -9 (y2 Q9), (y1 y2) */
+ index = extract_l( L_shr( L_mac( 8388608, wtmp, inv_stepSize ), 16 + 8 ) ); // Q0
- /*-----------------------------------------------------------------*
- * calculate the unscaled innovation energy
- * calculate the predicted gain code
- * calculate optimal gains
- *-----------------------------------------------------------------*/
- /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;*/
- /**gain_inov = 1.0f / (float)sqrt( Ecode );*/
+ /* index [0 (1< Q26 */
+ enr = L_shr( enr, 10 ); /*Q26->Q16*/
+ frac_gain = L_Extract_lc( enr, &exp_gain );
- /* predicted codebook gain */
- gcode0 = sub( Es_pred, Ei ); /* Q8 */
+ Ltmp = Pow2( 14, frac_gain ); /* Put 14 as exponent */
+ exp_gain = sub( exp_gain, 14 ); /* Retreive exponent of wtmp */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *gain = L_shl_sat( Ltmp, add( 16, exp_gain ) );
+#else
+ *gain = L_shl_o( Ltmp, add( 16, exp_gain ), &Overflow );
+#endif
+ move32(); /*Q16*/
- /*---------------------------------------------------------------*
- * Decode codebook gain and the adaptive excitation low-pass
- * filtering factor (Finalize computation )
- *---------------------------------------------------------------*/
- /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
- L_tmp = Isqrt_lc( L_tmp, &exp_inov );
- *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
+ return index;
+}
+/*-----------------------------------------------------------------*
+ * gain_enc_tc()
+ *
+ * Search and quantization of gain_code for subframes (in the
+ * beginning of frame) without pulses in TC - 3b coding.
+ * In this case:
+ * - gain_pit = 0
+ * - gain_code - scalar quantization (no prediciton history used)
+ *-----------------------------------------------------------------*/
+void gain_enc_tc_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 gains_mode[], /* i : gain bits Q0*/
+ const Word16 i_subfr, /* i : subframe index Q0*/
+ const Word16 xn_fx[], /* i : target vector Q_xn*/
+ const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/
+ const Word16 code_fx[], /* i : algebraic excitation Q9*/
+ const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/
+ Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/
+ Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/
+ Word16 *gain_inov_fx, /* o : innovation gain Q12*/
+ Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q16*/
+ const Word16 Q_xn /* i : xn and y1 scaling */
+)
+{
+ Word16 i, index = 0, nBits, num, den, exp_num, exp_den;
+ Word16 Ei_fx, g_code_fx, gcode0_fx;
+ Word16 expg, expg2, e_tmp, f_tmp, exp_gcode0, tmp_fx, frac, tmp16;
+ Word32 L_tmp, L_tmp1;
+ Word16 wgain_code = 0, gain_code16;
+ *gain_pit_fx = 0;
+ move16();
+ move16();
+ move16();
- /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */
/*----------------------------------------------------------------*
- * gcode0 = pow(10.0, gcode0/20)
- * = pow(2, 3.321928*gcode0/20)
- * = pow(2, 0.166096*gcode0)
+ * get number of bits for gain quantization
*----------------------------------------------------------------*/
+ nBits = gains_mode[shr( i_subfr, 6 )];
- L_tmp = L_mult( gcode0, 21771 ); /* *0.166096 in Q17 -> Q26 */
- L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
+ /*----------------------------------------------------------------*
+ * find the code pitch (for current subframe)
+ *----------------------------------------------------------------*/
- gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
- exp_gcode0 = sub( exp_gcode0, 14 );
+ /**gain_code = dotp( xn, y2, L_SUBFR )/( dotp( y2, y2, L_SUBFR ) + 0.01f );*/
+ /* Compute scalar product */
+ L_tmp = Dot_product( y2_fx, y2_fx, L_SUBFR ); /* -18 (y2 Q9) */
+ exp_den = norm_l( L_tmp );
+ den = extract_h( L_shl( L_tmp, exp_den ) );
+ exp_den = sub( add( exp_den, 18 ), shl( Q_xn, 1 ) );
+ /* Compute scalar product */
+ L_tmp1 = Dot_product( xn_fx, y2_fx, L_SUBFR ); /* -9 (y2 Q9) */
+ exp_num = sub( norm_l( L_tmp1 ), 1 );
+ num = extract_h( L_shl( L_tmp1, exp_num ) );
+ exp_num = sub( add( exp_num, 8 ), Q_xn );
- /*tmp1 = (g_corr[0]*g_corr[2]) - (g_corr[4]*g_corr[4]);
- tmp2 = g_corr[1]/tmp1;
- tmp1 = g_corr[3]/tmp1;
+ tmp16 = s_or( shr( num, 16 ), 1 ); /* extract sign if num < 0 tmp16 = -1 else tmp16 = 1 */
+ num = abs_s( num );
- *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp1);
- *gain_code = (g_corr[0]*tmp1) - (g_corr[4]*tmp2);*/
+ /*----------------------------------------------------------------*
+ * compute gain = xy/yy
+ *----------------------------------------------------------------*/
+ g_code_fx = div_s( num, den );
- /* *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp3);
- = ((g_corr[1]*g_corr[2]) - (g_corr[3]*g_corr[4]))/tmp1;*/
+ i = sub( exp_num, exp_den ); /* Gain_trans in Q7 */
+ g_code_fx = i_mult2( g_code_fx, tmp16 ); /* apply sign */
+ *gain_code_fx = L_shr_sat( L_deposit_l( g_code_fx ), i );
+ move32();
- /* *gain_code = (g_corr[0]*tmp3) - (g_corr[4]*tmp2);
- = ((g_corr[3]*g_corr[0]) - (g_corr[1]*g_corr[4]))/tmp1;*/
+ /*----------------------------------------------------------------*
+ * calculate the predicted gain code
+ * decode codebook gain
+ *----------------------------------------------------------------*/
- L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/
- exp1 = add( exp_coeff[0], exp_coeff[2] );
+ *gain_pit_fx = 0;
+ move16();
- L_tmp2 = L_mult_o( coeff[4], coeff[4], &Overflow ); /*Q31*/
- exp2 = add( exp_coeff[4], exp_coeff[4] );
+ /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;
+ *gain_inov = 1.0f / (float)sqrt( Ecode );*/
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_den = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_den = exp2;
- move16();
- }
- L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/
+ L_tmp = Dot_product12( code_fx, code_fx, L_SUBFR, &expg );
+ expg = sub( expg, 18 + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
+ expg2 = expg;
+ move16();
+ L_tmp1 = L_tmp; /* sets to 'L_tmp' in 1 clock */
+ move32();
+ L_tmp = Isqrt_lc( L_tmp, &expg );
- frac_den = extract_h( L_frac_den ); /* Q15 */
- frac_den = s_max( frac_den, 1 ); /* Q15 */
- L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */
- exp = norm_l( L_frac_den );
- tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/
+ *gain_inov_fx = extract_h( L_shl( L_tmp, sub( expg, 3 ) ) );
+ move16(); /* gain_inov in Q12 */
+ /*Ei = 10 * (float)log10( Ecode );*/
+ e_tmp = norm_l( L_tmp1 );
+ f_tmp = Log2_norm_lc( L_shl( L_tmp1, e_tmp ) );
+ e_tmp = sub( expg2, add( 1, e_tmp ) );
+ L_tmp1 = Mpy_32_16( e_tmp, f_tmp, 12330 ); /* Q13 */ /* 10*log10(2) in Q12*/
+ Ei_fx = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
+ /*gcode0 = (float) pow(10, 0.05 * (Es_pred - Ei));*/
+ gcode0_fx = sub( Es_pred_fx, Ei_fx ); /* Q8 */
+ /*-----------------------------------------------------------------*
+ * gcode0 = pow(10.0, gcode0/20)
+ * = pow(2, 3.321928*gcode0/20)
+ * = pow(2, 0.166096*gcode0)
+ *-----------------------------------------------------------------*/
+ L_tmp = L_mult( gcode0_fx, 21771 ); /* *0.166096 in Q17 -> Q26 */
+ L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */
+ frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
+ gcode0_fx = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
+ exp_gcode0 = sub( exp_gcode0, 14 );
+ IF( GT_16( nBits, 3 ) )
+ {
+ /*g_code = *gain_code / gcode0;*/
+ IF( gcode0_fx != 0 )
+ {
+ tmp16 = div_s( 16384, gcode0_fx ); /*Q15*/
+ L_tmp = Mult_32_16( *gain_code_fx, tmp16 ); /*Q16*/
+ *gain_code_fx = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/
+ move32();
+ }
+ ELSE
+ {
+ *gain_code_fx = MAX_32;
+ move32();
+ }
- L_tmp1 = L_mult( coeff[3], coeff[4] ); /*Q31*/
- exp1 = add( exp_coeff[3], exp_coeff[4] );
+ /*index = gain_quant( &g_code, G_CODE_MIN, G_CODE_MAX, nBits );*/
+ index = gain_quant_fx( gain_code_fx, &gain_code16, LG10_G_CODE_MIN_TC_Q14, LG10_G_CODE_MAX_TC_Q13, nBits, &expg );
- L_tmp2 = L_mult( coeff[1], coeff[2] ); /*Q31*/
- exp2 = add( exp_coeff[1], exp_coeff[2] );
+ /**gain_code = g_code * gcode0;*/
+ L_tmp = L_mult( gain_code16, gcode0_fx ); /*Q0*Q0 -> Q1*/
+ *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/
+ move32();
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_num = exp1;
- move16();
+ push_indice( hBstr, IND_GAIN_CODE, index, nBits );
}
ELSE
{
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_num = exp2;
+ index = N_GAIN_CODE_TC - 1;
move16();
- }
- L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/
-
- L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
- exp_div = sub( exp_num, exp_den );
-
- *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/
-
- L_tmp1 = L_mult( coeff[1], coeff[4] ); /*Q31*/
- exp1 = add( exp_coeff[1], exp_coeff[4] );
-
- L_tmp2 = L_mult( coeff[0], coeff[3] ); /*Q31*/
- exp2 = add( exp_coeff[0], exp_coeff[3] );
+ FOR( i = 0; i < N_GAIN_CODE_TC - 1; i++ )
+ {
+ L_tmp = L_mult( tbl_gain_code_tc_quant_mean[i], gcode0_fx ); /* Q13*Q0 -> Q14 */
+ L_tmp = L_shl( L_tmp, add( exp_gcode0, 2 ) ); /* Q14 -> Q16 */
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_num = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_num = exp2;
- move16();
- }
- L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/
-
- L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
- exp_div = sub( exp_num, exp_den );
-
- *gain_code = L_shl_sat( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) );
- move32(); /*Q16*/
-
- *gain_pit = s_max( G_PITCH_MIN_Q14, s_min( *gain_pit, G_PITCH_MAX_Q14 ) );
-
- /*-----------------------------------------------------------------*
- * limit the pitch gain searching range (if indicated by clip_gain)
- *-----------------------------------------------------------------*/
-
- test();
- test();
- IF( EQ_16( clip_gain, 1 ) && GT_16( *gain_pit, 15565 /* 0.95 in Q14 */ ) )
- {
- *gain_pit = 15565; /* 0.95 in Q14 */
- move16();
- }
- ELSE IF( EQ_16( clip_gain, 2 ) && GT_16( *gain_pit, 10650 /* 0.65 in Q14 */ ) )
- {
- *gain_pit = 10650; /* 0.65 in Q14 */
- move16();
+ IF( LT_32( *gain_code_fx, L_tmp ) )
+ {
+ index = i;
+ move16();
+ BREAK;
+ }
+ }
+ /*----------------------------------------------------------------*
+ * 3-bit -> 2-bit encoding
+ *----------------------------------------------------------------*/
+ IF( EQ_16( nBits, 2 ) )
+ {
+ /* 2-bit -> 3-bit decoding */
+ index = shr( index, 1 );
+ wgain_code = tbl_gain_code_tc_fx[shl( index, 1 )];
+ move16();
+ /**gain_code *= gcode0;*/
+ L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */
+ *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) );
+ move32(); /* Q14 -> Q16 */
+ push_indice( hBstr, IND_GAIN_CODE, index, nBits );
+ }
+ ELSE /* nBits == 3 */
+ {
+ wgain_code = tbl_gain_code_tc_fx[index];
+ move16();
+ /**gain_code *= gcode0;*/
+ L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */
+ *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) );
+ move32(); /* Q14 -> Q16 */
+ push_indice( hBstr, IND_GAIN_CODE, index, nBits );
+ }
}
/*-----------------------------------------------------------------*
- * search for the best quantized values
+ * decode normalized codebook gain
*-----------------------------------------------------------------*/
+ /**norm_gain_code = *gain_code / *gain_inov;*/
+ expg = sub( norm_s( *gain_inov_fx ), 1 );
+ expg = s_max( expg, 0 );
- nBits_pitch = gains_mode[i_subfr >> 6];
- move16();
-
- /* set number of bits for two SQs */
- nBits_code = shr( add( nBits_pitch, 1 ), 1 );
- nBits_pitch = shr( nBits_pitch, 1 );
-
- /* gain_pit Q */
- /*tmp1 = (G_PITCH_MAX - G_PITCH_MIN) / ((1 << nBits_pitch) - 1);*/ /* set quantization step */
- tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */
-
- index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) ); // Q0
- push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch );
-
- /* gain_code Q */
- /* *gain_code /= gcode0; */
- IF( gcode0 != 0 )
- {
- tmp = div_s( 16384, gcode0 ); /*Q15*/
- L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/
- *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/
- move32();
- }
-
- index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg );
- push_indice( hBstr, IND_GAIN_CODE, index, nBits_code );
- L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/
- *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) );
- move32(); /*Q16*/
-
- /* *norm_gain_code = *gain_code / *gain_inov; */
- exp = sub( norm_s( *gain_inov ), 1 );
- exp = s_max( exp, 0 );
-
- tmp = div_s( shr( 8192, exp ), *gain_inov );
- *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16
+ tmp_fx = div_s( shr( 8192, expg ), *gain_inov_fx );
+ *norm_gain_code_fx = L_shr( Mult_32_16( *gain_code_fx, tmp_fx ), sub( 1, expg ) ); // Q16
move32();
-
return;
}
-
-void gain_enc_SQ_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
- const Word16 *code, /* i : algebraic excitation Q9*/
- const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/
- Word16 *gain_pit, /* o : quantized pitch gain Q14*/
- Word32 *gain_code, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , ,, -2 and 2 Qx*/
- const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
- const Word16 Q_xn /* i : xn and y1 scaling */
+/*-----------------------------------------------------------------*
+ * Find_Opt_gainQ_fx()
+ *
+ * Find the best quantizer
+ *-----------------------------------------------------------------*/
+static Word16 Find_Opt_gainQ_fx(
+ Word16 *coeff, /* exp(exp_coeff) */
+ Word16 *exp_coeff,
+ Word16 *gain_pit, /* Q14 */
+ Word32 *gain_code, /* Q16 */
+ Word16 gcode0, /* exp(exp_gcode0) */
+ Word16 exp_gcode0,
+ const Word16 *cdbk, /* i : Codebook used Q14*/
+ const Word16 size /* i : size of Codebook used Q0*/
)
{
- Word16 index, nBits_pitch, nBits_code;
- Word16 gcode0, Ei, gain_code16;
- Word16 coeff[5], exp_coeff[5];
- Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp;
-
- Word32 L_tmp, L_tmp1, L_tmp2;
- Word16 tmp1, expg;
- Word16 exp1, exp2;
- Word16 exp_num, exp_den, exp_div, frac_den;
- Word32 L_frac_num, L_frac_den, L_div;
+ Word16 index, i, j;
+ const Word16 *p;
+ Word16 g_pitch, g2_pitch, g_code, g_pit_cod, g2_code, g2_code_lo;
+ Word32 dist_min;
+ Word16 coeff_lo[5];
+ Word16 exp_max[5];
+ Word16 exp_code, e_max;
+ Word32 L_tmp, L_tmp1;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
- /*-----------------------------------------------------------------*
- * calculate the rest of the correlation coefficients
- * c2 = , c3 = -2, c4 = 2
- *-----------------------------------------------------------------*/
- /*g_corr[1] *= -0.5;*/
- /*g_corr[2] = dotp( y2, y2, L_SUBFR ) + 0.01f;*/
- /*g_corr[3] = dotp( xn, y2, L_SUBFR ) - 0.02f;*/
- /*g_corr[4] = dotp( yy1, y2, L_SUBFR ) + 0.02f;*/
-
- coeff[0] = g_corr[0];
- move16();
- exp_coeff[0] = g_corr[1];
- move16();
- coeff[1] = g_corr[2];
- move16(); /* coeff[1] = xn yy1 */
- exp_coeff[1] = g_corr[3];
- move16();
-
- /* Compute scalar product */
- coeff[2] = extract_h( Dot_product12( y2, y2, L_SUBFR, &exp ) );
- move16();
- exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) );
- move16(); /* -18 (y2 Q9) */
-
- /* Compute scalar product */
- coeff[3] = extract_h( Dot_product12( xn, y2, L_SUBFR, &exp ) );
- move16();
- exp_coeff[3] = add( sub( exp, 9 ), Q_xn );
- move16(); /* -9 (y2 Q9), (xn y2) */
-
- /* Compute scalar product */
- coeff[4] = extract_h( Dot_product12( yy1, y2, L_SUBFR, &exp ) );
- move16();
- exp_coeff[4] = add( sub( exp, 9 ), Q_xn );
- move16(); /* -9 (y2 Q9), (y1 y2) */
-
- /*-----------------------------------------------------------------*
- * calculate the unscaled innovation energy
- * calculate the predicted gain code
- * calculate optimal gains
- *-----------------------------------------------------------------*/
- /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;*/
- /**gain_inov = 1.0f / (float)sqrt( Ecode );*/
-
- L_tmp = Dot_product12( code, code, L_SUBFR, &exp_code );
- exp_inov = sub( exp_code, 18 + 6 );
- exp_code = sub( exp_code, 30 );
-
- /*Ei = 10 * log10((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
- /*----------------------------------------------------------------*
- * calculate the predicted gain code
- *----------------------------------------------------------------*/
- tmp = norm_l( L_tmp );
- frac = Log2_norm_lc( L_shl( L_tmp, tmp ) );
- tmp = add( 30 - 18 - 6 - 1, sub( exp_code, tmp ) ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
- L_tmp1 = Mpy_32_16( tmp, frac, 12330 ); /* Q13 */
- Ei = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
-
- /* predicted codebook gain */
- gcode0 = sub( Es_pred, Ei ); /* Q8 */
-
- /*---------------------------------------------------------------*
- * Decode codebook gain and the adaptive excitation low-pass
- * filtering factor (Finalize computation )
- *---------------------------------------------------------------*/
- /* gain_inov = 1.0f / sqrt((dot_product(code, code, L_SUBFR) + 0.01) / L_SUBFR) */
- L_tmp = Isqrt_lc( L_tmp, &exp_inov );
- *gain_inov = extract_h( L_shl( L_tmp, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
- /* gcode0 = pow(10, 0.05 * (Es_pred - Ei)) */
/*----------------------------------------------------------------*
- * gcode0 = pow(10.0, gcode0/20)
- * = pow(2, 3.321928*gcode0/20)
- * = pow(2, 0.166096*gcode0)
- *----------------------------------------------------------------*/
-
- L_tmp = L_mult( gcode0, 21771 ); /* *0.166096 in Q17 -> Q26 */
- L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
-
- gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
- exp_gcode0 = sub( exp_gcode0, 14 );
-
-
- /*tmp1 = (g_corr[0]*g_corr[2]) - (g_corr[4]*g_corr[4]);
- tmp2 = g_corr[1]/tmp1;
- tmp1 = g_corr[3]/tmp1;
-
- *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp1);
- *gain_code = (g_corr[0]*tmp1) - (g_corr[4]*tmp2);*/
-
- /* *gain_pit = (g_corr[2]*tmp2) - (g_corr[4]*tmp3);
- = ((g_corr[1]*g_corr[2]) - (g_corr[3]*g_corr[4]))/tmp1;*/
-
- /* *gain_code = (g_corr[0]*tmp3) - (g_corr[4]*tmp2);
- = ((g_corr[3]*g_corr[0]) - (g_corr[1]*g_corr[4]))/tmp1;*/
-
- L_tmp1 = L_mult( coeff[0], coeff[2] ); /*Q31*/
- exp1 = add( exp_coeff[0], exp_coeff[2] );
-
- L_tmp2 = L_mult_o( coeff[4], coeff[4], &Overflow ); /*Q31*/
- exp2 = add( exp_coeff[4], exp_coeff[4] );
-
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_den = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_den = exp2;
- move16();
- }
- L_frac_den = L_sub( L_tmp1, L_tmp2 ); /*Q31*/
-
- frac_den = extract_h( L_frac_den ); /* Q15 */
- frac_den = s_max( frac_den, 1 ); /* Q15 */
- L_frac_den = L_max( L_frac_den, 1 ); /* Q31 */
- exp = norm_l( L_frac_den );
- tmp = div_s( shl( 1, sub( 14, exp ) ), frac_den ); /*Q(14-exp)*/
-
-
- L_tmp1 = L_mult( coeff[3], coeff[4] ); /*Q31*/
- exp1 = add( exp_coeff[3], exp_coeff[4] );
-
- L_tmp2 = L_mult( coeff[1], coeff[2] ); /*Q31*/
- exp2 = add( exp_coeff[1], exp_coeff[2] );
-
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_num = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_num = exp2;
- move16();
- }
- L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/
-
- L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
- exp_div = sub( exp_num, exp_den );
-
- *gain_pit = round_fx_o( L_shl_o( L_div, add( exp, exp_div ), &Overflow ), &Overflow ); /*Q14*/
- move16();
-
- // To be checked
- L_tmp1 = L_mult_o( coeff[1], coeff[4], &Overflow ); /*Q31*/
- exp1 = add( exp_coeff[1], exp_coeff[4] );
-
- L_tmp2 = L_mult( coeff[0], coeff[3] ); /*Q31*/
- exp2 = add( exp_coeff[0], exp_coeff[3] );
-
- IF( GT_16( exp1, exp2 ) )
- {
- L_tmp2 = L_shr( L_tmp2, sub( exp1, exp2 ) ); /*Q31*/
- exp_num = exp1;
- move16();
- }
- ELSE
- {
- L_tmp1 = L_shr( L_tmp1, sub( exp2, exp1 ) ); /*Q31*/
- exp_num = exp2;
- move16();
- }
- L_frac_num = L_sub_o( L_tmp2, L_tmp1, &Overflow ); /*Q31*/
-
- L_div = Mult_32_16( L_frac_num, tmp ); /*Q(30-exp)*/
- exp_div = sub( exp_num, exp_den );
-
- *gain_code = L_shl_sat( L_div, s_max( -31, sub( add( exp, exp_div ), 14 ) ) );
- move32(); /*Q16*/
-
- *gain_pit = s_max( G_PITCH_MIN_Q14, s_min( *gain_pit, G_PITCH_MAX_Q14 ) );
-
- /*-----------------------------------------------------------------*
- * limit the pitch gain searching range (if indicated by clip_gain)
- *-----------------------------------------------------------------*/
-
- test();
- test();
- IF( EQ_16( clip_gain, 1 ) && GT_16( *gain_pit, 15565 /* 0.95 in Q14 */ ) )
- {
- *gain_pit = 15565; /* 0.95 in Q14 */
- move16();
- }
- ELSE IF( EQ_16( clip_gain, 2 ) && GT_16( *gain_pit, 10650 /* 0.65 in Q14 */ ) )
- {
- *gain_pit = 10650; /* 0.65 in Q14 */
- move16();
- }
-
- /*-----------------------------------------------------------------*
- * search for the best quantized values
- *-----------------------------------------------------------------*/
-
- nBits_pitch = gains_mode[i_subfr >> 6];
- move16();
-
- /* set number of bits for two SQs */
- nBits_code = shr( add( nBits_pitch, 1 ), 1 );
- nBits_pitch = shr( nBits_pitch, 1 );
-
- /* gain_pit Q */
- /*tmp1 = (G_PITCH_MAX - G_PITCH_MIN) / ((1 << nBits_pitch) - 1);*/ /* set quantization step */
- tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */
-
- index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) );
- push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch );
-
- /* gain_code Q */
- /* *gain_code /= gcode0; */
- IF( gcode0 != 0 )
- {
- tmp = div_s( 16384, gcode0 ); /*Q15*/
- L_tmp = Mult_32_16( *gain_code, tmp ); /*Q16*/
- *gain_code = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/
- move32();
- }
-
- index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg );
- push_indice( hBstr, IND_GAIN_CODE, index, nBits_code );
- L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/
- *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) );
- move32(); /*Q16*/
-
- /* *norm_gain_code = *gain_code / *gain_inov; */
- exp = sub( norm_s( *gain_inov ), 1 );
- exp = s_max( exp, 0 );
-
- tmp = div_s( shr( 8192, exp ), *gain_inov );
- *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16
- move32();
-
- return;
-}
-
-/*-------------------------------------------------------------------*
- * gain_enc_gaus()
- *
- * Quantization of gain for Gaussian codebook
- *-------------------------------------------------------------------*/
-Word16 gain_enc_gaus_fx( /* o : Return index of quantization */
- Word32 *gain, /* i/o: Code gain to quantize Q16*/
- const Word16 bits, /* i : number of bits to quantize Q0*/
- const Word16 lowBound, /* i : lower bound of quantizer (dB) Q8*/
- const Word16 stepSize, /* i : Step size choice Q14*/
- const Word16 inv_stepSize /* i : Step size choice Q15*/
-)
-{
- Word16 index, exp_gain, frac_gain, wtmp;
- Word16 enr_q, wenr;
- Word32 Ltmp, enr;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
- /*enr = 20.0 * log10(*gain + 0.001) codebook gain in dB */
- exp_gain = norm_l( *gain );
- frac_gain = Log2_norm_lc( L_shl( *gain, exp_gain ) );
- exp_gain = sub( 30 - 16, exp_gain );
-
- enr = Mpy_32_16( exp_gain, frac_gain, LG10 ); /* Output in Q13 */
- wenr = extract_h( L_shl( enr, 8 + 3 ) );
-
- /*----------------------------------------------------------------*
- * Quantize linearly the log E
- *----------------------------------------------------------------*/
-
- wtmp = sub( wenr, lowBound ); /* Q8 */
-
- index = extract_l( L_shr( L_mac( 8388608, wtmp, inv_stepSize ), 16 + 8 ) ); // Q0
-
- /* index [0 (1< Q26 */
- enr = L_shr( enr, 10 ); /*Q26->Q16*/
- frac_gain = L_Extract_lc( enr, &exp_gain );
-
- Ltmp = Pow2( 14, frac_gain ); /* Put 14 as exponent */
- exp_gain = sub( exp_gain, 14 ); /* Retreive exponent of wtmp */
- *gain = L_shl_o( Ltmp, add( 16, exp_gain ), &Overflow );
- move32(); /*Q16*/
-
- return index;
-}
-/*-----------------------------------------------------------------*
- * gain_enc_tc()
- *
- * Search and quantization of gain_code for subframes (in the
- * beginning of frame) without pulses in TC - 3b coding.
- * In this case:
- * - gain_pit = 0
- * - gain_code - scalar quantization (no prediciton history used)
- *-----------------------------------------------------------------*/
-void gain_enc_tc_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 xn_fx[], /* i : target vector Q_xn*/
- const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/
- const Word16 code_fx[], /* i : algebraic excitation Q9*/
- const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/
- Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/
- Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov_fx, /* o : innovation gain Q12*/
- Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q16*/
- const Word16 Q_xn /* i : xn and y1 scaling */
-)
-{
- Word16 i, index = 0, nBits, num, den, exp_num, exp_den;
- Word16 Ei_fx, g_code_fx, gcode0_fx;
- Word16 expg, expg2, e_tmp, f_tmp, exp_gcode0, tmp_fx, frac, tmp16;
- Word32 L_tmp, L_tmp1;
- Word16 wgain_code = 0, gain_code16;
- *gain_pit_fx = 0;
- move16();
- move16();
- move16();
-
- /*----------------------------------------------------------------*
- * get number of bits for gain quantization
- *----------------------------------------------------------------*/
- nBits = gains_mode[shr( i_subfr, 6 )];
-
- /*----------------------------------------------------------------*
- * find the code pitch (for current subframe)
- *----------------------------------------------------------------*/
-
- /**gain_code = dotp( xn, y2, L_SUBFR )/( dotp( y2, y2, L_SUBFR ) + 0.01f );*/
- /* Compute scalar product */
- L_tmp = Dot_product( y2_fx, y2_fx, L_SUBFR ); /* -18 (y2 Q9) */
- exp_den = norm_l( L_tmp );
- den = extract_h( L_shl( L_tmp, exp_den ) );
- exp_den = sub( add( exp_den, 18 ), shl( Q_xn, 1 ) );
-
- /* Compute scalar product */
- L_tmp1 = Dot_product( xn_fx, y2_fx, L_SUBFR ); /* -9 (y2 Q9) */
- exp_num = sub( norm_l( L_tmp1 ), 1 );
- num = extract_h( L_shl( L_tmp1, exp_num ) );
- exp_num = sub( add( exp_num, 8 ), Q_xn );
-
- tmp16 = s_or( shr( num, 16 ), 1 ); /* extract sign if num < 0 tmp16 = -1 else tmp16 = 1 */
- num = abs_s( num );
-
- /*----------------------------------------------------------------*
- * compute gain = xy/yy
- *----------------------------------------------------------------*/
- g_code_fx = div_s( num, den );
-
- i = sub( exp_num, exp_den ); /* Gain_trans in Q7 */
- g_code_fx = i_mult2( g_code_fx, tmp16 ); /* apply sign */
- *gain_code_fx = L_shr_sat( L_deposit_l( g_code_fx ), i );
- move32();
-
- /*----------------------------------------------------------------*
- * calculate the predicted gain code
- * decode codebook gain
- *----------------------------------------------------------------*/
-
- *gain_pit_fx = 0;
- move16();
-
- /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;
- *gain_inov = 1.0f / (float)sqrt( Ecode );*/
-
- L_tmp = Dot_product12( code_fx, code_fx, L_SUBFR, &expg );
- expg = sub( expg, 18 + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
- expg2 = expg;
- move16();
- L_tmp1 = L_tmp; /* sets to 'L_tmp' in 1 clock */
- move32();
- L_tmp = Isqrt_lc( L_tmp, &expg );
-
- *gain_inov_fx = extract_h( L_shl( L_tmp, sub( expg, 3 ) ) );
- move16(); /* gain_inov in Q12 */
-
- /*Ei = 10 * (float)log10( Ecode );*/
- e_tmp = norm_l( L_tmp1 );
- f_tmp = Log2_norm_lc( L_shl( L_tmp1, e_tmp ) );
- e_tmp = sub( expg2, add( 1, e_tmp ) );
- L_tmp1 = Mpy_32_16( e_tmp, f_tmp, 12330 ); /* Q13 */ /* 10*log10(2) in Q12*/
- Ei_fx = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
- /*gcode0 = (float) pow(10, 0.05 * (Es_pred - Ei));*/
- gcode0_fx = sub( Es_pred_fx, Ei_fx ); /* Q8 */
- /*-----------------------------------------------------------------*
- * gcode0 = pow(10.0, gcode0/20)
- * = pow(2, 3.321928*gcode0/20)
- * = pow(2, 0.166096*gcode0)
- *-----------------------------------------------------------------*/
- L_tmp = L_mult( gcode0_fx, 21771 ); /* *0.166096 in Q17 -> Q26 */
- L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
- gcode0_fx = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- exp_gcode0 = sub( exp_gcode0, 14 );
- IF( GT_16( nBits, 3 ) )
- {
- /*g_code = *gain_code / gcode0;*/
- IF( gcode0_fx != 0 )
- {
- tmp16 = div_s( 16384, gcode0_fx ); /*Q15*/
- L_tmp = Mult_32_16( *gain_code_fx, tmp16 ); /*Q16*/
- *gain_code_fx = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/
- move32();
- }
- ELSE
- {
- *gain_code_fx = MAX_32;
- move32();
- }
-
- /*index = gain_quant( &g_code, G_CODE_MIN, G_CODE_MAX, nBits );*/
- index = gain_quant_fx( gain_code_fx, &gain_code16, LG10_G_CODE_MIN_TC_Q14, LG10_G_CODE_MAX_TC_Q13, nBits, &expg );
-
- /**gain_code = g_code * gcode0;*/
- L_tmp = L_mult( gain_code16, gcode0_fx ); /*Q0*Q0 -> Q1*/
- *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/
- move32();
-
- push_indice( hBstr, IND_GAIN_CODE, index, nBits );
- }
- ELSE
- {
- index = N_GAIN_CODE_TC - 1;
- move16();
- FOR( i = 0; i < N_GAIN_CODE_TC - 1; i++ )
- {
- L_tmp = L_mult( tbl_gain_code_tc_quant_mean[i], gcode0_fx ); /* Q13*Q0 -> Q14 */
- L_tmp = L_shl( L_tmp, add( exp_gcode0, 2 ) ); /* Q14 -> Q16 */
-
- IF( LT_32( *gain_code_fx, L_tmp ) )
- {
- index = i;
- move16();
- BREAK;
- }
- }
- /*----------------------------------------------------------------*
- * 3-bit -> 2-bit encoding
- *----------------------------------------------------------------*/
- IF( EQ_16( nBits, 2 ) )
- {
- /* 2-bit -> 3-bit decoding */
- index = shr( index, 1 );
- wgain_code = tbl_gain_code_tc_fx[shl( index, 1 )];
- move16();
- /**gain_code *= gcode0;*/
- L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */
- *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) );
- move32(); /* Q14 -> Q16 */
- push_indice( hBstr, IND_GAIN_CODE, index, nBits );
- }
- ELSE /* nBits == 3 */
- {
- wgain_code = tbl_gain_code_tc_fx[index];
- move16();
- /**gain_code *= gcode0;*/
- L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */
- *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) );
- move32(); /* Q14 -> Q16 */
- push_indice( hBstr, IND_GAIN_CODE, index, nBits );
- }
- }
-
- /*-----------------------------------------------------------------*
- * decode normalized codebook gain
- *-----------------------------------------------------------------*/
- /**norm_gain_code = *gain_code / *gain_inov;*/
- expg = sub( norm_s( *gain_inov_fx ), 1 );
- expg = s_max( expg, 0 );
-
- tmp_fx = div_s( shr( 8192, expg ), *gain_inov_fx );
- *norm_gain_code_fx = L_shr( Mult_32_16( *gain_code_fx, tmp_fx ), sub( 1, expg ) ); // Q16
- move32();
- return;
-}
-
-void gain_enc_tc_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 xn_fx[], /* i : target vector Q_xn*/
- const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation Q_xn*/
- const Word16 code_fx[], /* i : algebraic excitation Q9*/
- const Word16 Es_pred_fx, /* i : predicted scaled innovation energy Q8*/
- Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain Q14*/
- Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov_fx, /* o : innovation gain Q12*/
- Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q6*/
- const Word16 Q_xn /* i : xn and y1 scaling */
-)
-{
- Word16 i, index = 0, nBits, num, den, exp_num, exp_den;
- Word16 Ei_fx, g_code_fx, gcode0_fx;
- Word16 expg, expg2, e_tmp, f_tmp, exp_gcode0, tmp_fx, frac, tmp16;
- Word32 L_tmp, L_tmp1;
- Word16 wgain_code = 0, gain_code16;
- *gain_pit_fx = 0;
- move16();
- move16();
- move16();
-
- /*----------------------------------------------------------------*
- * get number of bits for gain quantization
- *----------------------------------------------------------------*/
- nBits = gains_mode[i_subfr >> 6]; // Q0
- move16();
-
- /*----------------------------------------------------------------*
- * find the code pitch (for current subframe)
- *----------------------------------------------------------------*/
-
- /**gain_code = dotp( xn, y2, L_SUBFR )/( dotp( y2, y2, L_SUBFR ) + 0.01f );*/
- /* Compute scalar product */
- L_tmp = Dot_product( y2_fx, y2_fx, L_SUBFR ); /* -18 (y2 Q9) */
- exp_den = norm_l( L_tmp );
- den = extract_h( L_shl( L_tmp, exp_den ) );
- exp_den = sub( add( exp_den, 18 ), shl( Q_xn, 1 ) );
-
- /* Compute scalar product */
- L_tmp1 = Dot_product( xn_fx, y2_fx, L_SUBFR ); /* -9 (y2 Q9) */
- exp_num = sub( norm_l( L_tmp1 ), 1 );
- num = extract_h( L_shl( L_tmp1, exp_num ) );
- exp_num = sub( add( exp_num, 8 ), Q_xn );
-
- tmp16 = s_or( shr( num, 16 ), 1 ); /* extract sign if num < 0 tmp16 = -1 else tmp16 = 1 */
- num = abs_s( num );
-
- /*----------------------------------------------------------------*
- * compute gain = xy/yy
- *----------------------------------------------------------------*/
- g_code_fx = div_s( num, den );
-
- i = sub( exp_num, exp_den ); /* Gain_trans in Q7 */
- g_code_fx = i_mult2( g_code_fx, tmp16 ); /* apply sign */
- *gain_code_fx = L_shr_sat( L_deposit_l( g_code_fx ), i ); /* Q16 */
- move32();
-
- /*----------------------------------------------------------------*
- * calculate the predicted gain code
- * decode codebook gain
- *----------------------------------------------------------------*/
-
- *gain_pit_fx = 0;
- move16();
-
- /*Ecode = (dotp( code, code, L_SUBFR) + 0.01f) / L_SUBFR;
- *gain_inov = 1.0f / (float)sqrt( Ecode );*/
-
- L_tmp = Dot_product12( code_fx, code_fx, L_SUBFR, &expg );
- expg = sub( expg, 18 + 6 ); /* exp: -18 (code in Q9), -6 (/L_SUBFR) */
- expg2 = expg;
- move16();
- L_tmp1 = L_tmp; /* sets to 'L_tmp' in 1 clock */
- move32();
- L_tmp = Isqrt_lc( L_tmp, &expg );
-
- *gain_inov_fx = extract_h( L_shl( L_tmp, sub( expg, 3 ) ) );
- move16(); /* gain_inov in Q12 */
-
- /*Ei = 10 * (float)log10( Ecode );*/
- e_tmp = norm_l( L_tmp1 );
- f_tmp = Log2_norm_lc( L_shl( L_tmp1, e_tmp ) );
- e_tmp = sub( expg2, add( 1, e_tmp ) );
- L_tmp1 = Mpy_32_16( e_tmp, f_tmp, 12330 ); /* Q13 */ /* 10*log10(2) in Q12*/
- Ei_fx = round_fx( L_shl( L_tmp1, 11 ) ); /* Q8 */
- /*gcode0 = (float) pow(10, 0.05 * (Es_pred - Ei));*/
- gcode0_fx = sub( Es_pred_fx, Ei_fx ); /* Q8 */
- /*-----------------------------------------------------------------*
- * gcode0 = pow(10.0, gcode0/20)
- * = pow(2, 3.321928*gcode0/20)
- * = pow(2, 0.166096*gcode0)
- *-----------------------------------------------------------------*/
- L_tmp = L_mult( gcode0_fx, 21771 ); /* *0.166096 in Q17 -> Q26 */
- L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
- gcode0_fx = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- exp_gcode0 = sub( exp_gcode0, 14 );
- IF( GT_16( nBits, 3 ) )
- {
- /*g_code = *gain_code / gcode0;*/
- IF( gcode0_fx != 0 )
- {
- tmp16 = div_s( 16384, gcode0_fx ); /*Q15*/
- L_tmp = Mult_32_16( *gain_code_fx, tmp16 ); /*Q16*/
- *gain_code_fx = L_shr( L_tmp, add( 14, exp_gcode0 ) ); /*Q16*/
- move32();
- }
- ELSE
- {
- *gain_code_fx = MAX_32;
- move32();
- }
-
- /*index = gain_quant( &g_code, G_CODE_MIN, G_CODE_MAX, nBits );*/
- index = gain_quant_fx( gain_code_fx, &gain_code16, LG10_G_CODE_MIN_TC_Q14, LG10_G_CODE_MAX_TC_Q13, nBits, &expg );
-
- /**gain_code = g_code * gcode0;*/
- L_tmp = L_mult( gain_code16, gcode0_fx ); /*Q0*Q0 -> Q1*/
- *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/
- move32();
-
- push_indice( hBstr, IND_GAIN_CODE, index, nBits );
- }
- ELSE
- {
- index = N_GAIN_CODE_TC - 1;
- move16();
- FOR( i = 0; i < N_GAIN_CODE_TC - 1; i++ )
- {
- L_tmp = L_mult( tbl_gain_code_tc_quant_mean[i], gcode0_fx ); /* Q13*Q0 -> Q14 */
- L_tmp = L_shl( L_tmp, add( exp_gcode0, 2 ) ); /* Q14 -> Q16 */
-
- IF( LT_32( *gain_code_fx, L_tmp ) )
- {
- index = i;
- move16();
- BREAK;
- }
- }
- /*----------------------------------------------------------------*
- * 3-bit -> 2-bit encoding
- *----------------------------------------------------------------*/
- IF( EQ_16( nBits, 2 ) )
- {
- /* 2-bit -> 3-bit decoding */
- index = shr( index, 1 );
- wgain_code = tbl_gain_code_tc_fx[index * 2]; // Q13
- move16();
- /**gain_code *= gcode0;*/
- L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */
- *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) );
- move32(); /* Q14 -> Q16 */
- push_indice( hBstr, IND_GAIN_CODE, index, nBits );
- }
- ELSE /* nBits == 3 */
- {
- wgain_code = tbl_gain_code_tc_fx[index]; // Q13
- move16();
- /**gain_code *= gcode0;*/
- L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */
- *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) );
- move32(); /* Q14 -> Q16 */
- push_indice( hBstr, IND_GAIN_CODE, index, nBits );
- }
- }
-
- /*-----------------------------------------------------------------*
- * decode normalized codebook gain
- *-----------------------------------------------------------------*/
- /**norm_gain_code = *gain_code / *gain_inov;*/
- expg = sub( norm_s( *gain_inov_fx ), 1 );
- expg = s_max( expg, 0 );
-
- tmp_fx = div_s( shr( 8192, expg ), *gain_inov_fx );
- *norm_gain_code_fx = L_shr( Mult_32_16( *gain_code_fx, tmp_fx ), sub( 1, expg ) ); // Q6
- move32();
- return;
-}
-/*-----------------------------------------------------------------*
- * Find_Opt_gainQ_fx()
- *
- * Find the best quantizer
- *-----------------------------------------------------------------*/
-static Word16 Find_Opt_gainQ_fx(
- Word16 *coeff, /* exp(exp_coeff) */
- Word16 *exp_coeff,
- Word16 *gain_pit, /* Q14 */
- Word32 *gain_code, /* Q16 */
- Word16 gcode0, /* exp(exp_gcode0) */
- Word16 exp_gcode0,
- const Word16 *cdbk, /* i : Codebook used Q14*/
- const Word16 size /* i : size of Codebook used Q0*/
-)
-{
- Word16 index, i, j;
- const Word16 *p;
- Word16 g_pitch, g2_pitch, g_code, g_pit_cod, g2_code, g2_code_lo;
- Word32 dist_min;
- Word16 coeff_lo[5];
- Word16 exp_max[5];
- Word16 exp_code, e_max;
- Word32 L_tmp, L_tmp1;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-
-
- /*----------------------------------------------------------------*
- * Find the best quantizer
- * ~~~~~~~~~~~~~~~~~~~~~~~
- * Before doing the computation we need to align exponents of coeff[]
- * to be sure to have the maximum precision.
- *
- * In the table the pitch gains are in Q14, the code gains are in Q9 and
- * are multiply by gcode0 which have been multiply by 2^exp_gcode0.
- * Also when we compute g_pitch*g_pitch, g_code*g_code and g_pitch*g_code
- * we divide by 2^15.
- * Considering all the scaling above we have:
- *
- * exp_code = exp_gcode0-9+15 = exp_gcode0+6
- *
- * g_pitch*g_pitch = -14-14+15
- * g_pitch = -14
- * g_code*g_code = (2*exp_code)+15
- * g_code = exp_code
- * g_pitch*g_code = -14 + exp_code +15
- *
- * g_pitch*g_pitch * coeff[0] ;exp_max0 = exp_coeff[0] - 13
- * g_pitch * coeff[1] ;exp_max1 = exp_coeff[1] - 14
- * g_code*g_code * coeff[2] ;exp_max2 = exp_coeff[2] +15+(2*exp_code)
- * g_code * coeff[3] ;exp_max3 = exp_coeff[3] + exp_code
- * g_pitch*g_code * coeff[4] ;exp_max4 = exp_coeff[4] + 1 + exp_code
- *----------------------------------------------------------------*/
-
- exp_code = add( exp_gcode0, 6 );
-
- exp_max[0] = sub( exp_coeff[0], 13 );
- move16();
- exp_max[1] = sub( exp_coeff[1], 14 );
- move16();
- exp_max[2] = add( exp_coeff[2], add( 15, shl( exp_code, 1 ) ) );
- move16();
- exp_max[3] = add( exp_coeff[3], exp_code );
- move16();
- exp_max[4] = add( exp_coeff[4], add( 1, exp_code ) );
- move16();
-
- /* Find maximum exponant */
- e_max = exp_max[0];
- move16();
- FOR( i = 1; i < 5; i++ )
- {
- e_max = s_max( exp_max[i], e_max );
- }
-
- /* align coeff[] and save in special 32 bit double precision */
- FOR( i = 0; i < 5; i++ )
- {
- j = add( sub( e_max, exp_max[i] ), 2 ); /* /4 to avoid overflow */
- L_tmp = L_deposit_h( coeff[i] );
- L_tmp = L_shr( L_tmp, j );
- L_Extract( L_tmp, &coeff[i], &coeff_lo[i] );
- coeff_lo[i] = shr( coeff_lo[i], 3 ); /* lo >> 3 */
- move16();
- }
-
- /* searching of codebook */
- p = cdbk; // Q14
- move16();
- dist_min = L_deposit_h( MAX_16 );
- index = 0;
- move16();
- FOR( i = 0; i < size; i++ )
- {
- g_pitch = *p++;
- move16();
- g_code = *p++;
- move16();
-
- g_code = mult_r( g_code, gcode0 ); // exp_gcode - 1
- g2_pitch = mult_r( g_pitch, g_pitch ); // Q13
- g_pit_cod = mult_r( g_code, g_pitch );
- L_tmp = L_mult( g_code, g_code );
- g2_code_lo = L_Extract_lc( L_tmp, &g2_code );
-
- L_tmp = L_mult( coeff[2], g2_code_lo );
- L_tmp = L_shr( L_tmp, 3 );
- L_tmp = L_mac( L_tmp, coeff_lo[0], g2_pitch );
- L_tmp = L_mac( L_tmp, coeff_lo[1], g_pitch );
- L_tmp = L_mac( L_tmp, coeff_lo[2], g2_code );
- L_tmp = L_mac( L_tmp, coeff_lo[3], g_code );
- L_tmp = L_mac( L_tmp, coeff_lo[4], g_pit_cod );
- L_tmp = L_shr( L_tmp, 12 );
- L_tmp = L_mac( L_tmp, coeff[0], g2_pitch ); /* 15 - coeff_exp + 13 - 1 */
- L_tmp = L_mac( L_tmp, coeff[1], g_pitch ); /* 15 - coeff_exp + 13 - 1 */
- L_tmp = L_mac( L_tmp, coeff[2], g2_code ); /* 15 - coeff_exp + 13 - 1 */
- L_tmp = L_mac( L_tmp, coeff[3], g_code ); /* 15 - coeff_exp + 13 - 1 */
- L_tmp = L_mac( L_tmp, coeff[4], g_pit_cod ); /* 15 - coeff_exp + 13 - 1 */
-
- L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow );
- if ( L_tmp1 < 0 )
- {
- index = i;
- move16();
- }
- dist_min = L_min( L_tmp, dist_min );
- }
-
- p = &cdbk[add( index, index )]; // Q14
- move16();
-
- *gain_pit = *p++; /* selected pitch gain in Q14 */
- move16();
- g_code = *p++; /* selected code gain in Q9 */
- move16();
-
- L_tmp = L_mult( g_code, gcode0 ); /* Q9*Q0 -> Q10 */
- L_tmp = L_shl_sat( L_tmp, add( exp_gcode0, 6 ) ); /* Q10 -> Q16 */
- *gain_code = L_tmp; /* gain of code in Q16 */
- move16();
- return index;
-}
-/*---------------------------------------------------------------------*
- * gain_enc_lbr()
- *
- * Quantization of pitch and codebook gains without prediction (memory-less)
- * in ACELP at 6.6 and 7.5 kbps
- * - the gain codebooks and gain estimation constants are different in each subframe
- * - the estimated gain, gcode0, is first determined based on
- * classification and/or previous quantized gains (from previous subframes in the current frame)
- * - a correction factor gamma = g_code / gcode0 is then vector quantized
- * along with gain_pit
- * - the mean-squared error criterion is used for codebook search
- *---------------------------------------------------------------------*/
-
-void gain_enc_lbr_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 coder_type, /* i : coding type Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 Q_xn, /* i : xn and y1 format */
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
- const Word16 *code, /* i : algebraic excitation Q9*/
- Word16 *gain_pit, /* o : quantized pitch gain Q14*/
- Word32 *gain_code, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/
- Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/
- Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/
- const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
- const Word16 L_subfr /* i : subframe length Q0*/
-)
-{
-
- Word16 index = 0, size, nBits, n_pred, ctype;
- const Word16 *b, *cdbk = 0;
- Word16 gcode0, aux[10];
- Word16 coeff[5], exp_coeff[5];
- Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp, L_subfr_sf;
- Word32 L_tmp, L_tmp1, L_inov;
- move16();
- move16();
-
- L_subfr_sf = 6;
- move16();
- if ( GT_16( L_subfr, L_SUBFR ) )
- {
- L_subfr_sf = 7;
- move16();
- }
- /*-----------------------------------------------------------------*
- * calculate the rest of the correlation coefficients
- * c2 = , c3 = -2, c4 = 2, c5* =
- * c5* - not necessary to calculate
- *-----------------------------------------------------------------*/
-
- coeff[0] = g_corr[0];
- move16();
- exp_coeff[0] = g_corr[1];
- move16();
- coeff[1] = negate( g_corr[2] );
- move16(); /* coeff[1] = -2 xn yy1 */
- exp_coeff[1] = add( g_corr[3], 1 );
- move16();
-
- /* Compute scalar product */
- coeff[2] = extract_h( Dot_product12( y2, y2, L_subfr, &exp ) );
- move16();
- exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) ); /* -18 (y2 Q9) */
- move16();
-
- /* Compute scalar product -2* */
-
- coeff[3] = extract_h( L_negate( Dot_product12( xn, y2, L_subfr, &exp ) ) );
- move16();
- exp_coeff[3] = add( sub( exp, 9 - 1 ), Q_xn ); /* -9 (y2 Q9), +1 (2 xn y2) */
- move16();
-
- /* Compute scalar product 2* */
-
- coeff[4] = extract_h( Dot_product12( y1, y2, L_subfr, &exp ) );
- move16();
- exp_coeff[4] = add( sub( exp, 9 - 1 ), Q_xn ); /* -9 (y2 Q9), +1 (2 yy1 y2) */
- move16();
-
- /*g_corr[2] += 0.01F; g_corr[3] -= 0.02F; g_corr[4] += 0.02F;*/
-
- /*Ecode = ( dotp( code, code, L_SUBFR ) + 0.01f ) / L_SUBFR;
- *gain_inov = 1.0f / (float)sqrt(Ecode);*/
- L_tmp = Dot_product12( code, code, L_subfr, &exp_code );
- L_inov = L_tmp; /* sets to 'L_tmp' in 1 clock */
- move32();
- /* exp_code: -18 (code in Q9), -6 (/L_SUBFR), -31 (L_tmp Q31->Q0) */
- /* output gain_inov*/
- exp_inov = sub( exp_code, add( 18, L_subfr_sf ) );
- L_inov = Isqrt_lc( L_inov, &exp_inov );
- *gain_inov = extract_h( L_shl( L_inov, sub( exp_inov, 3 ) ) ); /* gain_inov in Q12 */
- move16();
-
-
- /*-----------------------------------------------------------------*
- * select the codebook, size and number of bits
- * set the gains searching range
- *-----------------------------------------------------------------*/
-
- nBits = gains_mode[shr( i_subfr, L_subfr_sf )];
- move16();
- size = shl( 1, nBits );
-
- ctype = shl( sub( coder_type, 1 ), 1 );
-
- /*-----------------------------------------------------------------*
- * calculate prediction of gcode
- * search for the best codeword
- *-----------------------------------------------------------------*/
- test();
- IF( i_subfr == 0 )
- {
- b = b_1sfr_fx; // Q12
- move16();
- n_pred = 2;
- move16();
-
- SWITCH( nBits )
- {
- case 8:
- {
- cdbk = gp_gamma_1sfr_8b_fx; /* Q14 / Q9 */
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 60 );
- }
- BREAK;
- }
- case 7:
- {
- cdbk = gp_gamma_1sfr_7b_fx; /* Q14 / Q9 */
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 27 );
- }
- BREAK;
- }
- case 6:
- {
- cdbk = gp_gamma_1sfr_6b_fx; /* Q14 / Q9 */
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 10 );
- }
- BREAK;
- }
- }
-
- /* calculate predicted gain */
- aux[0] = 4096; /* 1 in Q12 */
- move16();
- aux[1] = shl( ctype, 12 );
- move16();
-
- /* gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.5f * (float)log10(Ecode));
- gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.05f * 10 * (float)log10(Ecode));
- gcode0 = (float)pow(10, 0.05(20 * dotp(b, aux, n_pred) - 10 * (float)log10(Ecode))); */
-
- exp_code = sub( exp_code, 18 + 6 + 1 );
- exp = norm_l( L_tmp );
- frac = Log2_norm_lc( L_shl( L_tmp, exp ) );
- exp = sub( exp_code, exp );
- L_tmp1 = Mpy_32_16( exp, frac, 24660 ); /* Q14 */ /* 10*log10(2) in Q13*/
-
- L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/
- L_tmp = Mult_32_16( L_tmp, 320 ); /*Q14, 20 in Q4*/
- L_tmp = L_sub( L_tmp, L_tmp1 ); /*Q14*/
-
- gcode0 = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */
-
- /*-----------------------------------------------------------------*
- * gcode0 = pow(10.0, gcode0/20)
- * = pow(2, 3.321928*gcode0/20)
- * = pow(2, 0.166096*gcode0)
- *-----------------------------------------------------------------*/
-
- L_tmp = L_mult( gcode0, 21771 ); /* *0.166096 in Q17 -> Q26 */
- L_tmp = L_shr( L_tmp, 10 ); /* From Q26 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
-
- gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
- exp_gcode0 = sub( exp_gcode0, 14 );
- index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0
-
- gc_mem[0] = *gain_code;
- move16(); /*Q16*/
- gp_mem[0] = *gain_pit;
- move16(); /*Q14*/
- }
- ELSE IF( EQ_16( i_subfr, L_SUBFR ) || EQ_16( L_subfr, 2 * L_SUBFR ) )
- {
- b = b_2sfr_fx;
- move16();
- n_pred = 4;
- move16();
-
- switch ( nBits )
- {
- case 7:
- {
- cdbk = gp_gamma_2sfr_7b_fx; /* Q14/Q9 */
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 30 );
- }
- BREAK;
- }
- case 6:
- {
- cdbk = gp_gamma_2sfr_6b_fx; /* Q14/Q9 */
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 12 );
- }
- BREAK;
- }
- }
-
- /* calculate predicted gain */
- aux[0] = 4096; /* 1 in Q12 */
- move16();
- aux[1] = shl( ctype, 12 );
- move16();
-
- /*aux[2] = (float)log10(gc_mem[0]);
- = log2(gc_mem[0])*log10(2);*/
- exp = norm_l( gc_mem[0] );
- frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) );
- exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_1sfr_fx)=16*/
- L_tmp1 = Mpy_32_16( exp, frac, 9864 );
- move16(); /* Q16 */
- aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
- move16();
-
- aux[3] = shr( gp_mem[0], 2 );
- move16(); /*Q12*/
-
- /*-----------------------------------------------------------------*
- * gcode0 = pow(10.0, dotp(b, aux, n_pred)
- * = pow(2, 3.321928*dotp(b, aux, n_pred)
- *-----------------------------------------------------------------*/
- L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/
- L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */
- L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
-
- gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
- exp_gcode0 = sub( exp_gcode0, 14 );
-
- index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0
- gc_mem[1] = *gain_code; // Q16
- move32();
- gp_mem[1] = *gain_pit; // Q14
- move16();
- }
- ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) )
- {
- b = b_3sfr_fx; // Q12
- move16();
- n_pred = 6;
- move16();
- IF( EQ_16( nBits, 7 ) )
- {
- cdbk = gp_gamma_3sfr_7b_fx;
- if ( clip_gain == 1 )
- {
- size -= 28;
- }
- }
- ELSE
- {
- cdbk = gp_gamma_3sfr_6b_fx; /* Q14 / Q9 */
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 11 );
- }
- }
- /* calculate predicted gain */
- aux[0] = 4096; /* 1 in Q12 */
- move16();
- aux[1] = shl( ctype, 12 );
- move16();
-
- /*aux[2] = (float)log10(gc_mem[0]);
- = log2(gc_mem[0])*log10(2);*/
- exp = norm_l( gc_mem[0] );
- frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) );
- exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/
- L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */
- aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
- move16();
-
- /*aux[3] = (float)log10(gc_mem[1]);
- = log2(gc_mem[1])*log10(2);*/
- exp = norm_l( gc_mem[1] );
- frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) );
- exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/
- L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */
- aux[3] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
- move16();
-
- aux[4] = shr( gp_mem[0], 2 );
- move16(); /*Q12*/
- aux[5] = shr( gp_mem[1], 2 );
- move16(); /*Q12*/
-
- /*-----------------------------------------------------------------*
- * gcode0 = pow(10.0, dotp(b, aux, n_pred)
- * = pow(2, 3.321928*dotp(b, aux, n_pred)
- *-----------------------------------------------------------------*/
- L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/
- L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */
- L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
-
- gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
- exp_gcode0 = sub( exp_gcode0, 14 );
-
- /*----------------------------------------------------------------*
- * Find the best quantizer
- * ~~~~~~~~~~~~~~~~~~~~~~~
- * Before doing the computation we need to align exponents of coeff[]
- * to be sure to have the maximum precision.
- *
- * In the table the pitch gains are in Q14, the code gains are in Q9 and
- * are multiply by gcode0 which have been multiply by 2^exp_gcode0.
- * Also when we compute g_pitch*g_pitch, g_code*g_code and g_pitch*g_code
- * we divide by 2^15.
- * Considering all the scaling above we have:
- *
- * exp_code = exp_gcode0-9+15 = exp_gcode0+6
- *
- * g_pitch*g_pitch = -14-14+15
- * g_pitch = -14
- * g_code*g_code = (2*exp_code)+15
- * g_code = exp_code
- * g_pitch*g_code = -14 + exp_code +15
- *
- * g_pitch*g_pitch * coeff[0] ;exp_max0 = exp_coeff[0] - 13
- * g_pitch * coeff[1] ;exp_max1 = exp_coeff[1] - 14
- * g_code*g_code * coeff[2] ;exp_max2 = exp_coeff[2] +15+(2*exp_code)
- * g_code * coeff[3] ;exp_max3 = exp_coeff[3] + exp_code
- * g_pitch*g_code * coeff[4] ;exp_max4 = exp_coeff[4] + 1 + exp_code
- *----------------------------------------------------------------*/
+ * Find the best quantizer
+ * ~~~~~~~~~~~~~~~~~~~~~~~
+ * Before doing the computation we need to align exponents of coeff[]
+ * to be sure to have the maximum precision.
+ *
+ * In the table the pitch gains are in Q14, the code gains are in Q9 and
+ * are multiply by gcode0 which have been multiply by 2^exp_gcode0.
+ * Also when we compute g_pitch*g_pitch, g_code*g_code and g_pitch*g_code
+ * we divide by 2^15.
+ * Considering all the scaling above we have:
+ *
+ * exp_code = exp_gcode0-9+15 = exp_gcode0+6
+ *
+ * g_pitch*g_pitch = -14-14+15
+ * g_pitch = -14
+ * g_code*g_code = (2*exp_code)+15
+ * g_code = exp_code
+ * g_pitch*g_code = -14 + exp_code +15
+ *
+ * g_pitch*g_pitch * coeff[0] ;exp_max0 = exp_coeff[0] - 13
+ * g_pitch * coeff[1] ;exp_max1 = exp_coeff[1] - 14
+ * g_code*g_code * coeff[2] ;exp_max2 = exp_coeff[2] +15+(2*exp_code)
+ * g_code * coeff[3] ;exp_max3 = exp_coeff[3] + exp_code
+ * g_pitch*g_code * coeff[4] ;exp_max4 = exp_coeff[4] + 1 + exp_code
+ *----------------------------------------------------------------*/
- index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size );
+ exp_code = add( exp_gcode0, 6 );
- gc_mem[2] = *gain_code; // Q16
- move32();
- gp_mem[2] = *gain_pit; // Q14
- move16();
- }
- ELSE IF( EQ_16( i_subfr, 3 * L_SUBFR ) )
+ exp_max[0] = sub( exp_coeff[0], 13 );
+ move16();
+ exp_max[1] = sub( exp_coeff[1], 14 );
+ move16();
+ exp_max[2] = add( exp_coeff[2], add( 15, shl( exp_code, 1 ) ) );
+ move16();
+ exp_max[3] = add( exp_coeff[3], exp_code );
+ move16();
+ exp_max[4] = add( exp_coeff[4], add( 1, exp_code ) );
+ move16();
+
+ /* Find maximum exponant */
+ e_max = exp_max[0];
+ move16();
+ FOR( i = 1; i < 5; i++ )
{
- b = b_4sfr_fx; // Q12
- move16();
- n_pred = 8;
- move16();
- IF( EQ_16( nBits, 7 ) )
- {
- cdbk = gp_gamma_4sfr_7b_fx;
- if ( clip_gain == 1 )
- {
- size -= 25;
- }
- }
- ELSE
- {
- cdbk = gp_gamma_4sfr_6b_fx; /* Q14 / Q9 */
- if ( EQ_16( clip_gain, 1 ) )
- {
- size = sub( size, 11 );
- }
- }
- /* calculate predicted gain */
- aux[0] = 4096; /* 1 in Q12 */
- move16();
- aux[1] = shl( ctype, 12 );
- move16();
+ e_max = s_max( exp_max[i], e_max );
+ }
- /*aux[2] = (float)log10(gc_mem[0]);
- = log2(gc_mem[0])*log10(2);*/
- exp = norm_l( gc_mem[0] );
- frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) );
- exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/
- L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */
- aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
+ /* align coeff[] and save in special 32 bit double precision */
+ FOR( i = 0; i < 5; i++ )
+ {
+ j = add( sub( e_max, exp_max[i] ), 2 ); /* /4 to avoid overflow */
+ L_tmp = L_deposit_h( coeff[i] );
+ L_tmp = L_shr( L_tmp, j );
+ L_Extract( L_tmp, &coeff[i], &coeff_lo[i] );
+ coeff_lo[i] = shr( coeff_lo[i], 3 ); /* lo >> 3 */
move16();
+ }
- /*aux[3] = (float)log10(gc_mem[1]);
- = log2(gc_mem[1])*log10(2);*/
- exp = norm_l( gc_mem[1] );
- frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) );
- exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/
- L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */
- aux[3] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
+ /* searching of codebook */
+ p = cdbk; // Q14
+ move16();
+ dist_min = L_deposit_h( MAX_16 );
+ index = 0;
+ move16();
+ FOR( i = 0; i < size; i++ )
+ {
+ g_pitch = *p++;
move16();
-
-
- /*aux[4] = (float)log10(gc_mem[2]);
- = log2(gc_mem[2])*log10(2);*/
- exp = norm_l( gc_mem[2] );
- frac = Log2_norm_lc( L_shl( gc_mem[2], exp ) );
- exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[2])=16*/
- L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */
- aux[4] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
+ g_code = *p++;
move16();
- aux[5] = shr( gp_mem[0], 2 );
- move16(); /*Q12*/
- aux[6] = shr( gp_mem[1], 2 );
- move16(); /*Q12*/
- aux[7] = shr( gp_mem[2], 2 );
- move16(); /*Q12*/
- /*-----------------------------------------------------------------*
- * gcode0 = pow(10.0, dotp(b, aux, n_pred)
- * = pow(2, 3.321928*dotp(b, aux, n_pred)
- *-----------------------------------------------------------------*/
- L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/
- L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */
- L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */
- frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
+ g_code = mult_r( g_code, gcode0 ); // exp_gcode - 1
+ g2_pitch = mult_r( g_pitch, g_pitch ); // Q13
+ g_pit_cod = mult_r( g_code, g_pitch );
+ L_tmp = L_mult( g_code, g_code );
+ g2_code_lo = L_Extract_lc( L_tmp, &g2_code );
- gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
- exp_gcode0 = sub( exp_gcode0, 14 );
+ L_tmp = L_mult( coeff[2], g2_code_lo );
+ L_tmp = L_shr( L_tmp, 3 );
+ L_tmp = L_mac( L_tmp, coeff_lo[0], g2_pitch );
+ L_tmp = L_mac( L_tmp, coeff_lo[1], g_pitch );
+ L_tmp = L_mac( L_tmp, coeff_lo[2], g2_code );
+ L_tmp = L_mac( L_tmp, coeff_lo[3], g_code );
+ L_tmp = L_mac( L_tmp, coeff_lo[4], g_pit_cod );
+ L_tmp = L_shr( L_tmp, 12 );
+ L_tmp = L_mac( L_tmp, coeff[0], g2_pitch ); /* 15 - coeff_exp + 13 - 1 */
+ L_tmp = L_mac( L_tmp, coeff[1], g_pitch ); /* 15 - coeff_exp + 13 - 1 */
+ L_tmp = L_mac( L_tmp, coeff[2], g2_code ); /* 15 - coeff_exp + 13 - 1 */
+ L_tmp = L_mac( L_tmp, coeff[3], g_code ); /* 15 - coeff_exp + 13 - 1 */
+ L_tmp = L_mac( L_tmp, coeff[4], g_pit_cod ); /* 15 - coeff_exp + 13 - 1 */
- index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp1 = L_sub_sat( L_tmp, dist_min );
+#else
+ L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow );
+#endif
+ if ( L_tmp1 < 0 )
+ {
+ index = i;
+ move16();
+ }
+ dist_min = L_min( L_tmp, dist_min );
}
- /* *norm_gain_code = *gain_code / *gain_inov; */
- exp = sub( norm_s( *gain_inov ), 1 );
- exp = s_max( exp, 0 );
+ p = &cdbk[add( index, index )]; // Q14
+ move16();
- tmp = div_s( shr( 8192, exp ), *gain_inov );
- *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16
- move32();
- {
- push_indice( hBstr, IND_GAIN, index, nBits );
- }
- return;
+ *gain_pit = *p++; /* selected pitch gain in Q14 */
+ move16();
+ g_code = *p++; /* selected code gain in Q9 */
+ move16();
+
+ L_tmp = L_mult( g_code, gcode0 ); /* Q9*Q0 -> Q10 */
+ L_tmp = L_shl_sat( L_tmp, add( exp_gcode0, 6 ) ); /* Q10 -> Q16 */
+ *gain_code = L_tmp; /* gain of code in Q16 */
+ move16();
+ return index;
}
+/*---------------------------------------------------------------------*
+ * gain_enc_lbr()
+ *
+ * Quantization of pitch and codebook gains without prediction (memory-less)
+ * in ACELP at 6.6 and 7.5 kbps
+ * - the gain codebooks and gain estimation constants are different in each subframe
+ * - the estimated gain, gcode0, is first determined based on
+ * classification and/or previous quantized gains (from previous subframes in the current frame)
+ * - a correction factor gamma = g_code / gcode0 is then vector quantized
+ * along with gain_pit
+ * - the mean-squared error criterion is used for codebook search
+ *---------------------------------------------------------------------*/
-void gain_enc_lbr_ivas_fx(
+void gain_enc_lbr_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 gains_mode[], /* i : gain bits Q0*/
const Word16 coder_type, /* i : coding type Q0*/
@@ -2458,10 +1299,12 @@ void gain_enc_lbr_ivas_fx(
Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/
- Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/
- Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/
- const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
- const Word16 L_subfr /* i : subframe length Q0*/
+ Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/
+ Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/
+ const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
+ const Word16 L_subfr /* i : subframe length Q0*/
+ ,
+ const Word16 element_mode /* i : mode element Q0*/
)
{
@@ -2472,6 +1315,7 @@ void gain_enc_lbr_ivas_fx(
Word16 exp, exp_code, exp_inov, exp_gcode0, frac, tmp, L_subfr_sf;
Word32 L_tmp, L_tmp1, L_inov;
move16();
+ move16();
L_subfr_sf = 6;
move16();
@@ -2496,12 +1340,6 @@ void gain_enc_lbr_ivas_fx(
move16();
/* Compute scalar product */
-#ifdef DEBUG
- if ( L_subfr != L_SUBFR )
- {
- PMT( "Entire function needs review to accommode for L_subfr > L_SUBFR" );
- }
-#endif
coeff[2] = extract_h( Dot_product12( y2, y2, L_subfr, &exp ) );
move16();
exp_coeff[2] = add( sub( exp, 18 ), shl( Q_xn, 1 ) ); /* -18 (y2 Q9) */
@@ -2525,8 +1363,8 @@ void gain_enc_lbr_ivas_fx(
/*Ecode = ( dotp( code, code, L_SUBFR ) + 0.01f ) / L_SUBFR;
*gain_inov = 1.0f / (float)sqrt(Ecode);*/
- L_tmp = Dot_product12( code, code, L_subfr, &exp_code ); /* Q9 + Q9 + 1 + (30-exp_code)*/
- L_inov = L_tmp; /* sets to 'L_tmp' in 1 clock */
+ L_tmp = Dot_product12( code, code, L_subfr, &exp_code );
+ L_inov = L_tmp; /* sets to 'L_tmp' in 1 clock */
move32();
/* exp_code: -18 (code in Q9), -6 (/L_SUBFR), -31 (L_tmp Q31->Q0) */
/* output gain_inov*/
@@ -2597,18 +1435,29 @@ void gain_enc_lbr_ivas_fx(
move16();
/* gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.5f * (float)log10(Ecode));
- gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.05f * 10 * (float)log10(Ecode));
- gcode0 = (float)pow(10, 0.05(20 * dotp(b, aux, n_pred) - 10 * (float)log10(Ecode))); */
- // Ecode = (Ecode / L_subfr)
- L_tmp = L_shr( L_tmp, L_subfr_sf ); // Q19 + (Q30-exp_code)
- /* Calculation for log10(Ecode) exponent for applying log10 = Q31 - q = Q31 - Q19 - Q30 + exp_code = exp_code - Q18*/
- L_tmp = BASOP_Util_Log10( L_tmp, sub( exp_code, 18 ) ); // new q = Q25
- exp = norm_l( L_tmp );
- L_tmp = L_shl( L_tmp, exp ); // Q25 + exp
- // 10 in Q27 , ( 10 * log10( Ecode ) )
- L_tmp1 = Mpy_32_32( L_tmp, 1342177280 ); // Q25 + exp + 1 + Q27 - 32 = Q21 + exp
- L_tmp1 = L_shr( L_tmp1, add( 7, exp ) ); // Q21 + exp - 7 - exp = Q14
+ gcode0 = (float)pow(10, dotp(b, aux, n_pred) - 0.05f * 10 * (float)log10(Ecode));
+ gcode0 = (float)pow(10, 0.05(20 * dotp(b, aux, n_pred) - 10 * (float)log10(Ecode))); */
+ IF( element_mode > EVS_MONO )
+ {
+ // Ecode = (Ecode / L_subfr)
+ L_tmp = L_shr( L_tmp, L_subfr_sf ); // Q19 + (Q30-exp_code)
+ /* Calculation for log10(Ecode) exponent for applying log10 = Q31 - q = Q31 - Q19 - Q30 + exp_code = exp_code - Q18*/
+ L_tmp = BASOP_Util_Log10( L_tmp, sub( exp_code, 18 ) ); // new q = Q25
+ exp = norm_l( L_tmp );
+ L_tmp = L_shl( L_tmp, exp ); // Q25 + exp
+ // 10 in Q27 , ( 10 * log10( Ecode ) )
+ L_tmp1 = Mpy_32_32( L_tmp, 1342177280 ); // Q25 + exp + 1 + Q27 - 32 = Q21 + exp
+ L_tmp1 = L_shr( L_tmp1, add( 7, exp ) ); // Q21 + exp - 7 - exp = Q14
+ }
+ ELSE
+ {
+ exp_code = sub( exp_code, 18 + 6 + 1 );
+ exp = norm_l( L_tmp );
+ frac = Log2_norm_lc( L_shl( L_tmp, exp ) );
+ exp = sub( exp_code, exp );
+ L_tmp1 = Mpy_32_16( exp, frac, 24660 ); /* Q14 */ /* 10*log10(2) in Q13*/
+ }
L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/
L_tmp = Mult_32_16( L_tmp, 320 ); /*Q14, 20 in Q4*/
L_tmp = L_sub( L_tmp, L_tmp1 ); /*Q14*/
@@ -2626,10 +1475,10 @@ void gain_enc_lbr_ivas_fx(
frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
+ /* output of Pow2() will be: */
+ /* 16384 < Pow2() <= 32767 */
exp_gcode0 = sub( exp_gcode0, 14 );
- index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size );
+ index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0
gc_mem[0] = *gain_code;
move16(); /*Q16*/
@@ -2638,7 +1487,7 @@ void gain_enc_lbr_ivas_fx(
}
ELSE IF( EQ_16( i_subfr, L_SUBFR ) || EQ_16( L_subfr, 2 * L_SUBFR ) )
{
- b = b_2sfr_fx; // Q12
+ b = b_2sfr_fx;
move16();
n_pred = 4;
move16();
@@ -2647,7 +1496,7 @@ void gain_enc_lbr_ivas_fx(
{
case 7:
{
- cdbk = gp_gamma_2sfr_7b_fx; /* Q14 / Q9 */
+ cdbk = gp_gamma_2sfr_7b_fx; /* Q14/Q9 */
if ( EQ_16( clip_gain, 1 ) )
{
size = sub( size, 30 );
@@ -2656,7 +1505,7 @@ void gain_enc_lbr_ivas_fx(
}
case 6:
{
- cdbk = gp_gamma_2sfr_6b_fx; /* Q14 / Q9 */
+ cdbk = gp_gamma_2sfr_6b_fx; /* Q14/Q9 */
if ( EQ_16( clip_gain, 1 ) )
{
size = sub( size, 12 );
@@ -2672,11 +1521,12 @@ void gain_enc_lbr_ivas_fx(
move16();
/*aux[2] = (float)log10(gc_mem[0]);
- = log2(gc_mem[0])*log10(2);*/
+ = log2(gc_mem[0])*log10(2);*/
exp = norm_l( gc_mem[0] );
frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) );
- exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_1sfr_fx)=16*/
- L_tmp1 = Mpy_32_16( exp, frac, 9864 ); /* Q16 */
+ exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_1sfr_fx)=16*/
+ L_tmp1 = Mpy_32_16( exp, frac, 9864 );
+ move16(); /* Q16 */
aux[2] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
move16();
@@ -2693,8 +1543,8 @@ void gain_enc_lbr_ivas_fx(
frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
+ /* output of Pow2() will be: */
+ /* 16384 < Pow2() <= 32767 */
exp_gcode0 = sub( exp_gcode0, 14 );
index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0
@@ -2711,10 +1561,10 @@ void gain_enc_lbr_ivas_fx(
move16();
IF( EQ_16( nBits, 7 ) )
{
- cdbk = gp_gamma_3sfr_7b_fx; /* Q14 / Q9 */
- if ( EQ_16( clip_gain, 1 ) )
+ cdbk = gp_gamma_3sfr_7b_fx;
+ if ( clip_gain == 1 )
{
- size = sub( size, 28 );
+ size -= 28;
}
}
ELSE
@@ -2726,13 +1576,13 @@ void gain_enc_lbr_ivas_fx(
}
}
/* calculate predicted gain */
- aux[0] = 4096; // Q12
+ aux[0] = 4096; /* 1 in Q12 */
move16();
aux[1] = shl( ctype, 12 );
move16();
/*aux[2] = (float)log10(gc_mem[0]);
- = log2(gc_mem[0])*log10(2);*/
+ = log2(gc_mem[0])*log10(2);*/
exp = norm_l( gc_mem[0] );
frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) );
exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/
@@ -2741,7 +1591,7 @@ void gain_enc_lbr_ivas_fx(
move16();
/*aux[3] = (float)log10(gc_mem[1]);
- = log2(gc_mem[1])*log10(2);*/
+ = log2(gc_mem[1])*log10(2);*/
exp = norm_l( gc_mem[1] );
frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) );
exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/
@@ -2764,8 +1614,8 @@ void gain_enc_lbr_ivas_fx(
frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
+ /* output of Pow2() will be: */
+ /* 16384 < Pow2() <= 32767 */
exp_gcode0 = sub( exp_gcode0, 14 );
/*----------------------------------------------------------------*
@@ -2797,23 +1647,23 @@ void gain_enc_lbr_ivas_fx(
index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size );
- gc_mem[2] = *gain_code; /* Q16 */
+ gc_mem[2] = *gain_code; // Q16
move32();
- gp_mem[2] = *gain_pit; /* Q14 */
+ gp_mem[2] = *gain_pit; // Q14
move16();
}
ELSE IF( EQ_16( i_subfr, 3 * L_SUBFR ) )
{
- b = b_4sfr_fx; /* Q12 */
+ b = b_4sfr_fx; // Q12
move16();
n_pred = 8;
move16();
IF( EQ_16( nBits, 7 ) )
{
- cdbk = gp_gamma_4sfr_7b_fx; /* Q14 / Q9 */
- if ( EQ_16( clip_gain, 1 ) )
+ cdbk = gp_gamma_4sfr_7b_fx;
+ if ( clip_gain == 1 )
{
- size = sub( size, 25 );
+ size -= 25;
}
}
ELSE
@@ -2825,13 +1675,13 @@ void gain_enc_lbr_ivas_fx(
}
}
/* calculate predicted gain */
- aux[0] = 4096; // Q12
+ aux[0] = 4096; /* 1 in Q12 */
move16();
aux[1] = shl( ctype, 12 );
move16();
/*aux[2] = (float)log10(gc_mem[0]);
- = log2(gc_mem[0])*log10(2);*/
+ = log2(gc_mem[0])*log10(2);*/
exp = norm_l( gc_mem[0] );
frac = Log2_norm_lc( L_shl( gc_mem[0], exp ) );
exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[0])=16*/
@@ -2840,7 +1690,7 @@ void gain_enc_lbr_ivas_fx(
move16();
/*aux[3] = (float)log10(gc_mem[1]);
- = log2(gc_mem[1])*log10(2);*/
+ = log2(gc_mem[1])*log10(2);*/
exp = norm_l( gc_mem[1] );
frac = Log2_norm_lc( L_shl( gc_mem[1], exp ) );
exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[1])=16*/
@@ -2848,8 +1698,9 @@ void gain_enc_lbr_ivas_fx(
aux[3] = round_fx( L_shl( L_tmp1, 12 ) ); /* Q12 */
move16();
+
/*aux[4] = (float)log10(gc_mem[2]);
- = log2(gc_mem[2])*log10(2);*/
+ = log2(gc_mem[2])*log10(2);*/
exp = norm_l( gc_mem[2] );
frac = Log2_norm_lc( L_shl( gc_mem[2], exp ) );
exp = sub( sub( 30, exp ), 16 ); /*Q_format(gc_mem[2])=16*/
@@ -2862,19 +1713,19 @@ void gain_enc_lbr_ivas_fx(
aux[6] = shr( gp_mem[1], 2 );
move16(); /*Q12*/
aux[7] = shr( gp_mem[2], 2 );
- move16(); /*Q12*/
- /*-----------------------------------------------------------------*
- * gcode0 = pow(10.0, dotp(b, aux, n_pred)
- * = pow(2, 3.321928*dotp(b, aux, n_pred)
- *-----------------------------------------------------------------*/
+ move16(); /*Q12*/
+ /*-----------------------------------------------------------------*
+ * gcode0 = pow(10.0, dotp(b, aux, n_pred)
+ * = pow(2, 3.321928*dotp(b, aux, n_pred)
+ *-----------------------------------------------------------------*/
L_tmp = Dot_product( b, aux, n_pred ); /*Q25*/
L_tmp = Mult_32_16( L_tmp, 27213 ); /* *3.321928 in Q13 -> Q23 */
L_tmp = L_shr( L_tmp, 7 ); /* From Q23 to Q16 */
frac = L_Extract_lc( L_tmp, &exp_gcode0 ); /* Extract exponent of gcode0 */
gcode0 = extract_l( Pow2( 14, frac ) ); /* Put 14 as exponent so that */
- /* output of Pow2() will be: */
- /* 16384 < Pow2() <= 32767 */
+ /* output of Pow2() will be: */
+ /* 16384 < Pow2() <= 32767 */
exp_gcode0 = sub( exp_gcode0, 14 );
index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, cdbk, size ); // Q0
@@ -2930,9 +1781,11 @@ void gain_enc_amr_wb_fx(
Word16 exp_max[5], tmp, nBits;
Word32 L_tmp, dist_min, L_inov, L_tmp1;
const Word16 *t_qua_gain, *p;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*----------------------------------------------------------------*
@@ -3165,7 +2018,11 @@ void gain_enc_amr_wb_fx(
L_tmp = L_mac( L_tmp, coeff[3], g_code ); /* 15 - coeff_exp + 13 - 1 */
L_tmp = L_mac( L_tmp, coeff[4], g_pit_cod ); /* 15 - coeff_exp + 13 - 1 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp1 = L_sub_sat( L_tmp, dist_min );
+#else
L_tmp1 = L_sub_o( L_tmp, dist_min, &Overflow );
+#endif
/* splitting the if cost half the complexity of using IF macro */
if ( L_tmp1 < 0 )
{
@@ -3187,8 +2044,12 @@ void gain_enc_amr_wb_fx(
g_code = *p++; /* selected code gain in Q11 */
move16();
- L_tmp = L_mult( g_code, gcode0 ); /* Q11*Q0 -> Q12 */
+ L_tmp = L_mult( g_code, gcode0 ); /* Q11*Q0 -> Q12 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, add( exp_gcode0, 4 ) ); /* Q12 -> Q16 */
+#else
L_tmp = L_shl_o( L_tmp, add( exp_gcode0, 4 ), &Overflow ); /* Q12 -> Q16 */
+#endif
*gain_code = L_tmp; /* gain of code in Q16 */
move16();
diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c
index b6ef2d84f3e548124c644a3a6b281ff09eaf7b2a..8b822b7042325b417568ed4fd4b5a575af82d532 100644
--- a/lib_enc/gaus_enc_fx.c
+++ b/lib_enc/gaus_enc_fx.c
@@ -1,15 +1,15 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "rom_enc.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
-//#include "basop_mpy.h"
+
/*-------------------------------------------------------------------*
* Local constants
@@ -19,6 +19,7 @@
/* #define FAC_DELTA 16.0f */
#define SFAC_DELTA 11
+
/*-------------------------------------------------------------------*
* Local functions
*-------------------------------------------------------------------*/
@@ -27,7 +28,6 @@ static Word16 cod_2pos_fx( const Word16 ind1, const Word16 ind2, const Word16 si
static void gauss2v_fx( BSTR_ENC_HANDLE hBstr, const Word16 h[], const Word16 xn[], const Word16 dn[], Word16 code[], Word16 y1[], Word32 *gain, const Word16 lg, const Word16 shift, const Word16 Q_new, const Word16 nb_bits );
-static void gauss2v_ivas_fx( BSTR_ENC_HANDLE hBstr, const Word16 h[], const Word16 xn[], const Word16 dn[], Word16 code[], Word16 y1[], Word32 *gain, const Word16 lg, const Word16 shift, const Word16 Q_new, const Word16 nb_bits );
/*-------------------------------------------------------------------*
* Gaus_encode
@@ -63,9 +63,11 @@ Word16 gaus_encode_fx(
Word32 Ltmp;
Word16 dn[L_SUBFR], exp_code, gcode; /* Correlation between xn and h1 */
Word16 exp, tmp, tmp_idx;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*----------------------------------------------------------------*
@@ -101,105 +103,11 @@ Word16 gaus_encode_fx(
/*----------------------------------------------------------------*
* Total excitation for Unvoiced coders
*----------------------------------------------------------------*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gcode = round_fx_sat( L_shl_sat( *gain_code, Q_new ) ); /* scaled gain_code with Qnew */
+#else
gcode = round_fx_o( L_shl_o( *gain_code, Q_new, &Overflow ), &Overflow ); /* scaled gain_code with Qnew */
- FOR( i = 0; i < L_SUBFR; i++ )
- {
- exc[i + i_subfr] = round_fx( L_shl( L_mult( gcode, code[i] ), 15 - 9 ) ); /* Q_new */
- }
-
- /*----------------------------------------------------------------*
- * Updates: last value of new target is stored in mem_w0
- *----------------------------------------------------------------*/
-
- Ltmp = L_mult( gcode, y2[L_SUBFR - 1] ); /* Q_new + 10 */
- Ltmp = L_shl( Ltmp, add( 5, shift ) ); /* Q_new + 15 + shift */
- Ltmp = L_negate( Ltmp );
- Ltmp = L_mac( Ltmp, xn[L_SUBFR - 1], 16384 ); /* Q_new + 15 + shift */
- Ltmp = L_shl_sat( Ltmp, sub( 1, shift ) ); /* Q_new + 16 */
- *mem_w0 = round_fx_sat( Ltmp ); /* Q_new */
- move16();
- init_gp_clip_fx( clip_gain ); /* reset pitch clipping parameters */
-
- *gain_pit = 0;
- *tilt_code = 0;
- move16(); /* purely unvoiced */
- *voice_fac = -32768; /* -1 in Q31 */
- move16(); /* purely unvoiced */
- exp = sub( norm_s( *gain_inov ), 1 );
- exp = s_max( exp, 0 );
-
- tmp = div_s( shr( 8192, exp ), *gain_inov );
- *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); /* Q16 */
- move16();
-
- return ( L_SUBFR << 6 );
-}
-
-Word16 gaus_encode_ivas_fx(
- Encoder_State *st_fx, /* i/o: encoder state structure */
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 *h1, /* i : weighted filter input response Q14*/
- const Word16 *xn, /* i : target vector Q12*/
- Word16 *exc, /* o : pointer to excitation signal frame Q_new*/
- Word16 *mem_w0, /* o : weighting filter denominator memory Q_new*/
- Word16 *clip_gain, /* o : memory of gain of pitch clipping algorithm [2.56x,Q14,Q8,Q0,Q14,Q14]*/
- Word16 *tilt_code, /* o : synthesis excitation spectrum tilt Q15*/
- Word16 *code, /* o : algebraic excitation Q9*/
- Word32 *gain_code, /* o : Code gain. Q16*/
- Word16 *y2, /* o : zero-memory filtered adaptive excitation Q9*/
- Word16 *gain_inov, /* o : innovation gain Q12*/
- Word16 *voice_fac, /* o : voicing factor Q15*/
- Word16 *gain_pit, /* o : adaptive excitation gain Q14*/
- const Word16 Q_new, /* i : scaling factor */
- const Word16 shift, /* i : scaling factor */
- Word32 *norm_gain_code /* o : normalized innovative cb. gain Q16*/
-)
-{
- Word16 nb_bits, idx;
- Word16 i = 0;
- move16();
- Word32 Ltmp;
- Word16 dn[L_SUBFR], exp_code, gcode; /* Correlation between xn and h1 */
- Word16 exp, tmp, tmp_idx;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
#endif
-
- /*----------------------------------------------------------------*
- * Encode gaussian excitation
- *----------------------------------------------------------------*/
-
- /* Correlation between target xn2[] and impulse response h1[] */
- corr_xh_fx( xn, dn, h1 );
-
- tmp_idx = shr( i_subfr, 6 );
- nb_bits = st_fx->acelp_cfg.fixed_cdk_index[tmp_idx]; /* Q0 */
- move16();
-
- gauss2v_ivas_fx( st_fx->hBstr, h1, xn, dn, code, y2, gain_code, L_SUBFR, shift, Q_new, shr( nb_bits, 1 ) );
-
- /*----------------------------------------------------------------*
- * Encode gaussian gain
- *----------------------------------------------------------------*/
-
- /* codeword energy computation */
- Ltmp = Dot_product12( code, code, L_SUBFR, &exp_code );
-
- exp_code = sub( exp_code, 18 + 6 ); /* exp: -18 (code in Q9), -6 (L_subfr = 64) */
- Ltmp = Isqrt_lc( Ltmp, &exp_code );
- *gain_inov = extract_h( L_shl( Ltmp, sub( exp_code, 3 ) ) ); /* g_code_inov in Q12 */
-
- nb_bits = st_fx->acelp_cfg.gains_mode[tmp_idx]; /* Q0 */
- move16();
- /* low bound = -30; stepSize = 1.71875; inv_stepSize = 0.5818181 */
- idx = gain_enc_gaus_fx( gain_code, nb_bits, -7680, 28160, 19065 ); /* Q0 */
- push_indice( st_fx->hBstr, IND_GAIN, idx, nb_bits );
-
- /*----------------------------------------------------------------*
- * Total excitation for Unvoiced coders
- *----------------------------------------------------------------*/
- gcode = round_fx_o( L_shl_o( *gain_code, Q_new, &Overflow ), &Overflow ); /* scaled gain_code with Qnew */
FOR( i = 0; i < L_SUBFR; i++ )
{
exc[i + i_subfr] = round_fx( L_shl( L_mult( gcode, code[i] ), 15 - 9 ) ); /* Q_new */
@@ -221,7 +129,7 @@ Word16 gaus_encode_ivas_fx(
*gain_pit = 0;
*tilt_code = 0;
move16(); /* purely unvoiced */
- *voice_fac = -32768; /* -1 in Q15 */
+ *voice_fac = -32768; /* -1 in Q31 */
move16(); /* purely unvoiced */
exp = sub( norm_s( *gain_inov ), 1 );
exp = s_max( exp, 0 );
@@ -292,9 +200,11 @@ void gauss2v_fx(
Word16 gxx, gcc, index_delta, delta, m_sign, inv_delta;
Word16 hg[190], Gaus_dico2[190];
Word16 shiftP3;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*----------------------------------------------------------------*
@@ -525,8 +435,13 @@ void gauss2v_fx(
cor2_norm = norm_l( cor2 );
eneri_norm = norm_l( eneri );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor2_mantissa = round_fx_sat( L_shl_sat( cor2, cor2_norm ) );
+ eneri_mantissa = round_fx_sat( L_shl_sat( eneri, eneri_norm ) );
+#else
cor2_mantissa = round_fx_o( L_shl_o( cor2, cor2_norm, &Overflow ), &Overflow );
eneri_mantissa = round_fx_o( L_shl_o( eneri, eneri_norm, &Overflow ), &Overflow );
+#endif
difference_norm = sub( add( cor2_norm, enerw_norm ), add( cor2w_norm, eneri_norm ) );
update_best = 0;
@@ -695,473 +610,15 @@ void gauss2v_fx(
/* Gain must be output in a 32-bit variable as a Q16 */
/* Compensate for Q_new */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *gain = L_shl_sat( Portion, sub( 13, Q_new ) ); /* Q16 */
+#else
*gain = L_shl_o( Portion, sub( 13, Q_new ), &Overflow ); /* Q16 */
+#endif
move32();
return;
}
-
-void gauss2v_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
- const Word16 h[], /* i : weighted LP filter impulse response Q15 */
- const Word16 xn[], /* i : target signal Q12 */
- const Word16 dn[], /* i : backward filtered target Q12 */
- Word16 code[], /* o : gaussian excitation Q9 */
- Word16 y1[], /* o : zero-memory filtered gauss. excitation Q8 */
- Word32 *gain, /* o : excitation gain. 32-bit number in Q16 */
- const Word16 lg, /* i : subframe size Q0 */
- const Word16 shift, /* i : Scaling factor Q0 */
- const Word16 Q_new, /* i : Scaling factor Q0 */
- const Word16 nb_bits /* i : nb ob bits per track (max 6) */
-)
-{
- Word16 i, j, ind1, ind2;
- Word16 nvec, step;
- Word32 cor, cora, dotprod;
- Word16 enerw;
- Word32 eneri, cor2;
- Word32 enerw32, cor2w32;
- Word16 *cpt1;
- Word16 *pt1, *pt2;
- Word32 max_val[NMAX + 1];
- Word16 *pos[NMAX + 1];
- Word32 sign[NMAX + 1];
- Word32 ener[NMAX + 1], corr[NMAX + 1], ener1;
- Word16 dico2[L_SUBFR * NMAX];
- Word16 exp_num;
- Word16 exp_den;
- Word16 Num;
- Word16 Den;
- Word32 GainPortion1;
- Word32 GainPortion2;
- Word32 cor_abs;
- Word16 cor_neg;
- Word16 div_result;
- Word32 ener_sqrt;
- Word32 Portion;
- Word16 sign1, sign2;
- Word16 enerw_norm, enerw_mantissa;
- Word16 cor2w_norm, cor2w_mantissa;
- Word16 eneri_norm, eneri_mantissa;
- Word16 cor2_norm, cor2_mantissa;
- Word16 difference_norm;
- Word32 cor32; /* 32-bit intermediate value*/
- Word16 hi1, lo1;
- Word16 update_best;
- Word16 idx;
- Word32 Lc0, Lc1, Lnum, Lden;
- Word16 gxx, gcc, index_delta, delta, m_sign, inv_delta;
- Word16 hg[190], Gaus_dico2[190];
- Word16 shiftP3;
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move32();
-#endif
-
- /*----------------------------------------------------------------*
- * Encode the tilt of gaussian excitation
- *----------------------------------------------------------------*/
-
- /* Compute spectral tilt of target */
- Lc0 = L_mult( xn[1], xn[1] );
- Lc1 = L_mult( xn[1], xn[0] );
- FOR( i = 2; i < L_SUBFR; i++ )
- {
- /* fc0 += xn[i]*xn[i] */
- /* fc1 += xn[i]*xn[i-1] */
- Lc0 = L_mac_sat( Lc0, xn[i], xn[i] );
- Lc1 = L_mac_sat( Lc1, xn[i], xn[i - 1] );
- }
- /* fgxx = fc1/fc0 */
- exp_num = sub( norm_l( Lc1 ), 1 );
- Num = extract_h( L_shl( Lc1, exp_num ) );
- m_sign = s_or( shr( Num, 16 ), 1 ); /* Remove sign */
- Num = abs_s( Num );
- Lc0 = L_max( Lc0, 1 );
- exp_den = norm_l( Lc0 );
- Den = extract_h( L_shl( Lc0, exp_den ) );
- gxx = shr( div_s( Num, Den ), sub( exp_num, sub( exp_den, 2 ) ) ); /* Q13 */
- gxx = i_mult2( gxx, m_sign ); /* Apply sign */
-
- set16_fx( hg, 0, 190 ); /* Compute spectral tilt of filtered codebook */
- Copy( h, hg, L_SUBFR );
- conv_fx( gaus_dico_fx, hg, Gaus_dico2, 190 );
-
- Lc0 = L_mult( Gaus_dico2[1], Gaus_dico2[1] );
- Lc1 = L_mult( Gaus_dico2[1], Gaus_dico2[0] );
- FOR( i = 2; i < 190; i++ )
- {
- /* fc0 += fgaus_dico2[i]*fgaus_dico2[i] */
- /* fc1 += fgaus_dico2[i]*fgaus_dico2[i-1] */
- Lc0 = L_mac( Lc0, Gaus_dico2[i], Gaus_dico2[i] );
- Lc1 = L_mac( Lc1, Gaus_dico2[i], Gaus_dico2[i - 1] );
- }
-
- /* fgcc = fc1/fc0 */
-
- exp_num = sub( norm_l( Lc1 ), 1 );
- Num = extract_h( L_shl( Lc1, exp_num ) );
- m_sign = s_or( shr( Num, 16 ), 1 ); /* Remove sign */
- Num = abs_s( Num );
-
- Lc0 = L_max( Lc0, 1 );
- exp_den = norm_l( Lc0 );
- Den = extract_h( L_shl( Lc0, exp_den ) );
- gcc = shr( div_s( Num, Den ), sub( exp_num, sub( exp_den, 2 ) ) ); /* Q13 */
- gcc = i_mult2( gcc, m_sign ); /* Apply sign */
-
- /* fdelta = (1-fgcc*fgxx) / (2*fgcc+fgxx) Compute and quantize spectral tilt modification factor */
- Lnum = L_sub( 134217728L, L_mult( gcc, gxx ) ); /* Q30 */
- Lden = L_mac( L_mult( gxx, 8192 ), gcc, 16384 ); /* Q30 */
-
- exp_num = sub( norm_l( Lnum ), 1 );
- Num = extract_h( L_shl( Lnum, exp_num ) );
- m_sign = s_or( shr( Num, 16 ), 1 ); /* Remove sign */
- Num = abs_s( Num );
-
- Lden = L_max( Lden, 1 );
- exp_den = norm_l( Lden );
- Den = extract_h( L_shl( Lden, exp_den ) );
-
- delta = shr_sat( div_s( Num, Den ), sub( exp_num, exp_den ) ); /* Q15 */
- delta = i_mult2( delta, m_sign ); /* Apply sign */
- /* index_delta = (short)(FAC_DELTA * fdelta) */
- index_delta = shr( delta, SFAC_DELTA );
-
- /* index_delta [0,7] */
- index_delta = s_max( index_delta, 0 );
- index_delta = s_min( index_delta, 7 );
-
- /* fdelta = STEP_DELTA * (float)index_delta */
- delta = shl( index_delta, 11 ); /* delta in Q15 */
-
- IF( delta > 0 ) /* Adapt spectral tilt of initial codebook */
- {
- /* Computation of 1 / (1+fdelta*fdelta) */
- inv_delta = inv_delta_tab[sub( index_delta, 1 )];
- move16(); /* Q15 */
-
- /* fgaus_dico2[0] = gaus_dico[0] */
- Gaus_dico2[0] = gaus_dico_fx[0];
- move16();
- FOR( i = 1; i < 190; i++ )
- {
- /* fgaus_dico2[i] = (gaus_dico[i] - fdelta*gaus_dico[i-1]) / (1 + fdelta*fdelta) */
- Lnum = L_msu( L_deposit_h( gaus_dico_fx[i] ), delta, gaus_dico_fx[i - 1] );
- Gaus_dico2[i] = round_fx( Mpy_32_16_1( Lnum, inv_delta ) );
- move16();
- }
- }
- ELSE
- {
- FOR( i = 0; i < 190; i++ )
- {
- /* fgaus_dico2[i] = gaus_dico[i] */
- Gaus_dico2[i] = gaus_dico_fx[i];
- move16();
- }
- }
-
- /*----------------------------------------------------------------*
- * Initializations
- *----------------------------------------------------------------*/
-
- ind1 = 0;
- move16();
- ind2 = 0;
- move16();
-
- nvec = shl( 1, nb_bits );
- step = shr( 0x80, nb_bits );
-
- /*----------------------------------------------------------------*
- * dot product between dn and gaussian codevectors,
- * keep NMAX best vectors
- *----------------------------------------------------------------*/
-
- set32_fx( max_val, 0, NMAX + 1 );
- set32_fx( sign, 0, NMAX + 1 );
-
- FOR( i = 0; i < NMAX + 1; i++ )
- {
- pos[i] = (Word16 *) Gaus_dico2;
- }
-
- cpt1 = Gaus_dico2;
- move16();
-
- FOR( i = 0; i < nvec; i++ )
- {
- /* Dot product without normalization, because values are compared with each other afterwards. */
- cor = Dot_product( cpt1, dn, lg ); /* Q12 * Q12 * length of 64 + 1 left shift ==> Q31*/
- cora = L_abs( cor );
- j = NMAX - 1;
- move16();
-
- DO
- {
- IF( GE_32( cora, max_val[j] ) )
- {
- max_val[j + 1] = max_val[j];
- move32(); /*Q31*/
- pos[j + 1] = pos[j];
- move16(); /*Pointer*/
- sign[j + 1] = sign[j];
- move32(); /*Q31*/
- max_val[j] = cora;
- move32(); /*Q31*/
- pos[j] = cpt1;
- move16(); /*Pointer*/
- sign[j] = cor;
- move32(); /*Q31*/
- }
- j--;
- }
- WHILE( j >= 0 );
- cpt1 += step;
- }
-
- /*----------------------------------------------------------------*
- * filter selected vectors
- * put sign
- * compute energy
- *----------------------------------------------------------------*/
-
- pt1 = dico2;
- move16();
- FOR( i = 0; i < NMAX; i++ )
- {
- /* Input vector (pos) Q12, filter coefs in Q15, result in same format as input vector (Q12) */
- conv_fx( pos[i], h, pt1, lg );
-
- /* put sign and compute energy */
- IF( sign[i] < 0 )
- {
- FOR( j = 0; j < lg; j++ )
- {
- pt1[j] = negate( pt1[j] );
- move16(); /*Store into dico2*/
- }
- }
- ener[i] = Dot_product( pt1, pt1, lg ); /* pt1 points to filtered vector in dico2, in Q12 */
- move32(); /* Result is for Q12 * Q12 with length of 64 (6 bits) + 1 left shift => Q31 */
- corr[i] = Dot_product( pt1, xn, lg ); /* must be equal to sign[i] !! */
- move32(); /* pt1 points into dico2, in Q12. xn is in Q12 */
- /* Result is for Q12 * Q12 with length of 64 (6 bits) + 1 left shift => Q31 */
- pt1 += L_SUBFR;
- }
-
- /*------------------------------------------------------------------------*
- * try all combinations of NMAX best vectors
- *------------------------------------------------------------------------*/
-
- pt1 = dico2;
- move16();
-
- /* Initial values for search algorithm */
- enerw32 = L_deposit_h( 0x80 );
- cor2w32 = L_deposit_l( -2 );
- enerw_norm = norm_l( enerw32 );
- cor2w_norm = norm_l( cor2w32 );
- cor2w_mantissa = round_fx( L_shl( cor2w32, cor2w_norm ) );
- enerw_mantissa = round_fx( L_shl( enerw32, enerw_norm ) );
-
- FOR( i = 0; i < NMAX; i++ )
- {
- pt2 = pt1;
- move16();
- FOR( j = i; j < NMAX; j++ )
- {
- cor32 = L_add( corr[i], corr[j] ); /* Q31 */
-
- dotprod = Dot_product( pt1, pt2, lg ); /* Q12 * Q12 * length of 64 + 1 left shift ==> Q31 */
-
- /* eneri = round_fx(ener[i]) + round_fx(ener[j]) + 2*round_fx(dotprod) */
- /* Use ScalingShift to stay aligned with ener[] */
- eneri = L_shl( dotprod, 1 ); /* One left shift added for factor of 2 */
- eneri = L_add_sat( ener[i], eneri );
- eneri = L_add_sat( ener[j], eneri ); /* Q31 */
- lo1 = L_Extract_lc( cor32, &hi1 );
- cor2 = Sad_32( 0, hi1, lo1 ); /* Square + Add */
-
- cor2_norm = norm_l( cor2 );
- eneri_norm = norm_l( eneri );
- cor2_mantissa = round_fx_o( L_shl_o( cor2, cor2_norm, &Overflow ), &Overflow );
- eneri_mantissa = round_fx_o( L_shl_o( eneri, eneri_norm, &Overflow ), &Overflow );
- difference_norm = sub( add( cor2_norm, enerw_norm ), add( cor2w_norm, eneri_norm ) );
-
- update_best = 0;
- move16();
-
- IF( difference_norm > 0 )
- {
- if ( GT_32( L_shr( L_mult( cor2_mantissa, enerw_mantissa ), difference_norm ),
- L_mult( cor2w_mantissa, eneri_mantissa ) ) )
- {
- update_best = 1;
- move16();
- }
- }
- ELSE
- {
- if ( L_msu_sat( L_shl( L_mult( cor2w_mantissa, eneri_mantissa ), difference_norm ), cor2_mantissa, enerw_mantissa ) < 0 ) // Saturation to be revisited
- {
- update_best = 1;
- move16();
- }
- }
- IF( update_best != 0 )
- {
- cor2w_mantissa = cor2_mantissa;
- move16();
- cor2w_norm = cor2_norm;
- move16();
- enerw_mantissa = eneri_mantissa;
- move16();
- enerw_norm = eneri_norm;
- move16();
- ind1 = i;
- move16();
- ind2 = j;
- move16();
- }
- pt2 += L_SUBFR;
- }
- pt1 += L_SUBFR;
- }
-
- enerw = round_fx( L_shr( L_deposit_h( enerw_mantissa ), enerw_norm ) );
-
- /*----------------------------------------------------------------*
- * Compute zero-memory filtered gauss. excitation y
- *----------------------------------------------------------------*/
-
- pt1 = dico2 + ind1 * L_SUBFR;
- move16(); /*Pointer arithmetic*/
- pt2 = dico2 + ind2 * L_SUBFR;
- move16();
-
- shiftP3 = add( shift, 3 );
- FOR( i = 0; i < lg; i++ )
- {
- /* Sum of 2 Q12 values, must give a Q1.8 */
- y1[i] = shr( add( pt1[i], pt2[i] ), shiftP3 );
- move16(); /* Compensate for "shift" */
- }
-
- /*----------------------------------------------------------------*
- * signs of vectors
- *----------------------------------------------------------------*/
-
- sign1 = ( -32768 );
- move16();
- if ( sign[ind1] >= 0 )
- {
- sign1 = 32767;
- move16();
- }
-
- sign2 = ( -32768 );
- move16();
- if ( sign[ind2] >= 0 )
- {
- sign2 = 32767;
- move16();
- }
-
- /*----------------------------------------------------------------*
- * Compute code
- *----------------------------------------------------------------*/
-
- pt1 = pos[ind1];
- move16(); /* Points to gaussian vector (gaus_dico_fx) in Q12 */
- pt2 = pos[ind2];
- move16(); /* Points to gaussian vector (gaus_dico_fx) in Q12 */
-
- /* sign[ind1] and sign[ind2] */
- FOR( i = 0; i < lg; i++ )
- {
- /* code[i]=(pt1[i]*sign1 + pt2[i]*sign2) /8 */
- /* Division by 8 (shift by 3) is for scaling (Q12 to Q0.9 output) */
- code[i] = shr( add( mult( pt1[i], sign1 ), mult( pt2[i], sign2 ) ), 3 );
- move16();
- }
-
- cor = L_add( corr[ind1], corr[ind2] );
-
- /*----------------------------------------------------------------*
- * Compute index
- *----------------------------------------------------------------*/
-
- i = (Word16) ( ( pos[ind1] - Gaus_dico2 ) / step ); /* Division by step can be replaced by shift. Pointer arithmetic */
- j = (Word16) ( ( pos[ind2] - Gaus_dico2 ) / step ); /* Division by step can be replaced by shift. Pointer arithmetic */
-
- idx = cod_2pos_fx( i, j, sign1, sign2, nvec );
- move16();
-
- push_indice( hBstr, IND_GAUS_CDBK_INDEX, idx, 2 * nb_bits + 1 );
- push_indice( hBstr, IND_TILT_FACTOR, index_delta, 3 );
-
- /*----------------------------------------------------------------*
- * Find quantized gain
- *----------------------------------------------------------------*/
-
- /* Divide cor/enerw: intermediate result stored into GainPortion1 */
- cor_neg = 0;
- move16();
- if ( cor < 0 ) /* Make Num positive. */
- {
- cor_neg = 1;
- move16();
- }
- cor_abs = L_abs( cor );
-
- exp_num = sub( norm_l( cor_abs ), 1 );
- exp_den = norm_s( enerw );
- Num = round_fx( L_shl( cor_abs, exp_num ) );
- Den = shl( enerw, exp_den );
-
- GainPortion1 = L_deposit_l( 0 ); /* Unexpected division by zero. Eliminate this gain contribution */
- IF( Den != 0 ) /* Protection against division by zero */
- {
- div_result = div_s( Num, Den ); /* Q15 */
- IF( cor_neg != 0 )
- {
- div_result = negate( div_result ); /* Retrieve sign */
- }
- /* Re-scale to compensate for normalization*/
- GainPortion1 = L_shr( L_deposit_l( div_result ), sub( exp_num, exp_den ) );
- }
-
- ener1 = Dot_product( xn, xn, lg ); /* Q12 * Q12 * length of 64 + 1 left shift ==> Q31 */
-
- exp_num = sub( norm_s( enerw ), 1 );
- exp_den = norm_l( ener1 );
- Num = shl( enerw, exp_num );
- Den = round_fx_sat( L_shl_sat( ener1, exp_den ) );
- GainPortion2 = L_deposit_l( 0 ); /* Unexpected division by zero. Eliminate this gain contribution */
- IF( Den != 0 ) /* Protection against division by zero */
- {
- div_result = div_s( Num, Den ); /* Q15 */
-
- /* Re-scale to compensate for normalization*/
- GainPortion2 = L_shr_sat( L_deposit_l( div_result ), sub( exp_num, exp_den ) );
- }
-
- ener_sqrt = Isqrt( L_shl_sat( GainPortion2, 1 ) ); /* Make value a Q16 prior to division (align on power of 4) */
- ener_sqrt = L_shr( ener_sqrt, 8 ); /* Left-shift Q23 result to make a Q15 result */
-
- Portion = Mult_32_16( GainPortion1, 19661 ); /* Performs GainPortion1*.6 */
- Portion = Madd_32_16( Portion, ener_sqrt, 13107 ); /* Performs ener_sqrt*.4 */
-
- /* Gain must be output in a 32-bit variable as a Q16 */
- /* Compensate for Q_new */
- *gain = L_shl_o( Portion, sub( 13, Q_new ), &Overflow );
- move32();
-
- return;
-}
-
/*---------------------------------------------------------------------*
* Put selected codevector positions and signs into quantization index
*---------------------------------------------------------------------*/
diff --git a/lib_enc/gp_clip_fx.c b/lib_enc/gp_clip_fx.c
index d7614473b32a086f9d0171d2ae510f9d5f941316..05d385fe78de7ac707856b295e80ac12e50be42e 100644
--- a/lib_enc/gp_clip_fx.c
+++ b/lib_enc/gp_clip_fx.c
@@ -114,9 +114,11 @@ Word16 gp_clip_fx(
Word32 ener;
Word32 L_tmp;
Word16 thres;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
clip = 0;
@@ -142,10 +144,18 @@ Word16 gp_clip_fx(
}
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ ener = L_mac_sat( 1L, xn[0], xn[0] );
+#else
ener = L_mac_o( 1L, xn[0], xn[0], &Overflow );
+#endif
FOR( i = 1; i < L_SUBFR; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ ener = L_mac_sat( ener, xn[i], xn[i] );
+#else
ener = L_mac_o( ener, xn[i], xn[i], &Overflow );
+#endif
}
/* ener = 10.0f*(float)log10(ener) */
@@ -334,9 +344,11 @@ Word16 Mode2_gp_clip_fx(
Word16 clip, tmp, exp_xn;
Word16 i;
Word32 wener, Ltmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
move16();
clip = 0;
@@ -355,7 +367,11 @@ Word16 Mode2_gp_clip_fx(
FOR( i = 0; i < L_subfr; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ wener = L_mac0_sat( wener, xn[i], xn[i] );
+#else
wener = L_mac0_o( wener, xn[i], xn[i], &Overflow );
+#endif
}
/*wener = 10.0f*(float)log10(wener);*/
diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c
index 7bf52970d7ff5f02edcaa6417a2b8b3d89cdf2c4..e26d5abbf5320377e19d1ae7d404208fa46b034e 100644
--- a/lib_enc/gs_enc_fx.c
+++ b/lib_enc/gs_enc_fx.c
@@ -1,25 +1,28 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h"
#include "cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* Local function prototypes
*-------------------------------------------------------------------*/
static Word16 edyn_fx( const Word16 *vec, const Word16 lvec, Word16 Qnew );
+
/*-------------------------------------------------------------------*
* encod_audio()
*
* Encode audio (AC) frames
*-------------------------------------------------------------------*/
+
void encod_audio_fx(
Encoder_State *st_fx, /* i/o: State structure */
const Word16 speech[], /* i : input speech Q_new */
@@ -1329,9 +1332,11 @@ static Word16 edyn_fx( /* o : ratio of max to mean */
Word32 L_tmp, ener_max, ener_mean;
Word16 tmp, exp2, tmp2, tmp1, exp1, exp3;
Word16 scale;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
ener_mean = L_shl( 1, shl( Qnew, 1 ) ); /*2*Qnew*/
@@ -1341,7 +1346,11 @@ static Word16 edyn_fx( /* o : ratio of max to mean */
{
L_tmp = L_mult0( vec[j], vec[j] ); /*2*Qnew*/
ener_max = L_max( ener_max, L_tmp );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ ener_mean = L_add_sat( ener_mean, L_tmp );
+#else
ener_mean = L_add_o( ener_mean, L_tmp, &Overflow );
+#endif
}
/*dyn = 10.0f * (ener_max / ener_mean);*/
ener_mean = Mult_32_16( ener_mean, div_s( 1, lvec ) ); /*2*Qnew*/
@@ -1349,7 +1358,11 @@ static Word16 edyn_fx( /* o : ratio of max to mean */
IF( ener_mean > 0 )
{
exp1 = norm_l( ener_mean );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp1 = round_fx_sat( L_shl( ener_mean, exp1 ) );
+#else
tmp1 = round_fx_o( L_shl( ener_mean, exp1 ), &Overflow );
+#endif
exp1 = sub( 30, exp1 );
exp2 = norm_l( ener_max );
diff --git a/lib_enc/guided_plc_enc_fx.c b/lib_enc/guided_plc_enc_fx.c
index 81e50d099bc1149557b3ae1395749726e41d0ea5..50932734cedfb35226c981816594fe1999161ac5 100644
--- a/lib_enc/guided_plc_enc_fx.c
+++ b/lib_enc/guided_plc_enc_fx.c
@@ -43,10 +43,12 @@ static void coderLookAheadInnovation(
move32();
move16();
move16();
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
/* Debug init (not instrumented) */
@@ -165,7 +167,11 @@ static void coderLookAheadInnovation(
ps_e = add( alp_e, ps_e );
BASOP_SATURATE_WARNING_OFF_EVS
+#ifdef ISSUE_1867_replace_overflow_libenc
+ max_ps_tmp = L_shl_sat( max_ps, sub( max_ps_e, ps_e ) );
+#else
max_ps_tmp = L_shl_o( max_ps, sub( max_ps_e, ps_e ), &Overflow );
+#endif
BASOP_SATURATE_WARNING_ON_EVS
@@ -442,10 +448,12 @@ void updateSpecPowDiffuseIdx_fx(
{
Word16 min_gp;
Word16 k;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
move32();
@@ -455,14 +463,22 @@ void updateSpecPowDiffuseIdx_fx(
FOR( k = 1; k < 4; k++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ st->mean_gc[1] = L_add_sat( st->mean_gc[1], st->gain_code[k] );
+#else
st->mean_gc[1] = L_add_o( st->mean_gc[1], st->gain_code[k], &Overflow );
+#endif
move32();
min_gp = s_min( min_gp, st->bpf_gainT[k] );
}
/* Suppress saturation warning in threshold comparison. */
test();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ if ( LT_32( st->mean_gc[1], L_add_sat( st->mean_gc[0], Mpy_32_16_r( st->mean_gc[0], 3211 /*0.098 Q15*/ ) ) ) || GT_16( min_gp, 13435 /*0.82 Q14*/ ) )
+#else
if ( LT_32( st->mean_gc[1], L_add_o( st->mean_gc[0], Mpy_32_16_r( st->mean_gc[0], 3211 /*0.098 Q15*/ ), &Overflow ) ) || GT_16( min_gp, 13435 /*0.82 Q14*/ ) )
+#endif
{
move16();
st->glr_idx[0] = 0;
diff --git a/lib_enc/hf_cod_amrwb_fx.c b/lib_enc/hf_cod_amrwb_fx.c
index e21a8bd677e665f1e9d36c61d1311074ee56c165..860f5626bd9f16e20030708bbc8543b5157b90f7 100644
--- a/lib_enc/hf_cod_amrwb_fx.c
+++ b/lib_enc/hf_cod_amrwb_fx.c
@@ -1,22 +1,23 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-//#include "prot_fx.h"
-#include "rom_com_fx.h"
#include "cnst.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
+
/*---------------------------------------------------------------------*
* hf_cod_init()
*
*
*---------------------------------------------------------------------*/
+
void hf_cod_init_fx(
Word16 *mem_hp400_enc, /* o: memory of hp 400 Hz filter */
Word16 *mem_hf1_enc, /* o: HF band-pass filter memory */
@@ -86,8 +87,10 @@ void hf_cod_fx(
Word32 L_tmp;
Word16 *pt1;
const Word16 *pt2;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/* Original speech signal as reference for high band gain quantisation */
@@ -107,10 +110,14 @@ void hf_cod_fx(
ener_exc_fx = dot_prod_satcontr( exc_fx, exc_fx, Q_exc, Q_exc, &q1, L_SUBFR );
ener_hf_fx = dot_prod_satcontr( HF_fx, HF_fx, -3, -3, &q2, L_SUBFR16k );
- scale_fx = div_s( shl( 1, 14 ), ener_exc_fx ); /*Q(29-q1) */
- L_tmp = L_mult( ener_hf_fx, scale_fx ); /*30-q1+q2 */
- q2 = sub( q1, q2 ); /*30-q2 */
- scale_fx = round_fx( Isqrt( L_shl_o( L_tmp, sub( q2, 26 ), &Overflow ) ) ); /*Q13 */
+ scale_fx = div_s( shl( 1, 14 ), ener_exc_fx ); /*Q(29-q1) */
+ L_tmp = L_mult( ener_hf_fx, scale_fx ); /*30-q1+q2 */
+ q2 = sub( q1, q2 ); /*30-q2 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ scale_fx = round_fx( Isqrt( L_shl_sat( L_tmp, sub( q2, 26 ) ) ) ); /*Q13 */
+#else
+ scale_fx = round_fx( Isqrt( L_shl_o( L_tmp, sub( q2, 26 ), &Overflow ) ) ); /*Q13 */
+#endif
pt1 = HF_fx;
@@ -183,10 +190,14 @@ void hf_cod_fx(
ener_hf_fx = dot_prod_satcontr( HF_syn_fx, HF_syn_fx, 0, 0, &q2, L_SUBFR16k );
ener_input_fx = dot_prod_satcontr( HF_SP_fx, HF_SP_fx, 0, 0, &q1, L_SUBFR16k );
- HF_calc_gain_fx = div_s( shl( 1, 14 ), ener_input_fx ); /*Q(29-q1) */
- L_tmp = L_mult( ener_hf_fx, HF_calc_gain_fx ); /*30-q1+q2 */
- q2 = sub( q1, q2 ); /*30-q2 */
+ HF_calc_gain_fx = div_s( shl( 1, 14 ), ener_input_fx ); /*Q(29-q1) */
+ L_tmp = L_mult( ener_hf_fx, HF_calc_gain_fx ); /*30-q1+q2 */
+ q2 = sub( q1, q2 ); /*30-q2 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ HF_calc_gain_fx = round_fx_sat( Isqrt( L_shl_sat( L_tmp, sub( q2, 20 ) ) ) ); /*Q10 */
+#else
HF_calc_gain_fx = round_fx_o( Isqrt( L_shl_sat( L_tmp, sub( q2, 20 ) ) ), &Overflow ); /*Q10 */
+#endif
/* set energy of HF synthesis to energy of original HF:
diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c
index aa2c319f1e9a936c00473a70f6caae499410ee37..1f84c270aec9fec1e44cff439aec3217012f03ac 100644
--- a/lib_enc/hq_classifier_enc_fx.c
+++ b/lib_enc/hq_classifier_enc_fx.c
@@ -1,15 +1,15 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-//#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-----------------------------------------------------------------*
* Local constants
*-----------------------------------------------------------------*/
@@ -28,20 +28,20 @@
*-----------------------------------------------------------------*/
void hvq_classifier_fx( const Word32 *input /*Q12*/, Word16 *prev_Npeaks, Word16 *prev_peaks, Word16 *hqswb_clas, Word16 *Npeaks, Word16 *peaks, const Word32 L_core_brate, const Word16 last_core, Word32 *L_nf_gains /*Q12*/, Word16 *hvq_hangover, Word32 *L_pe_gains /*Q12*/ );
-static Word16 hf_spectrum_sparseness_fx(
- Encoder_State *st, /* i/o: encoder state structure */
- const Word32 *coefs_fx /* i : MDCT spectrum Q12*/
-);
+static Word16 hf_spectrum_sparseness_fx( Encoder_State *st, const Word32 *coefs_fx );
+
+
/*--------------------------------------------------------------------------*
* hf_spectrum_sparseness()
*
* Detection of sparse spectrum in high band for activation of harmonic
* modes HQ_HARMONIC and HQ_HVQ
*--------------------------------------------------------------------------*/
+
/*! r: Harmonic decision for high band */
static Word16 hf_spectrum_sparseness_fx(
Encoder_State *st, /* i/o: encoder state structure */
- const Word32 *coefs_fx /* i : MDCT spectrum (Q12) */
+ const Word32 *coefs_fx /* i : MDCT spectrum (Q12) */
)
{
Word16 i;
@@ -652,9 +652,11 @@ void hvq_classifier_ivas_fx(
Word16 num_peak_cands, high, low;
Word16 sharp[HVQ_NSUB_32k];
Word16 peak_cand_idx[HVQ_THRES_BIN_32k], avail_peaks[HVQ_NSUB_32k];
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
Word16 temp_e = 0;
move16();
@@ -808,7 +810,11 @@ void hvq_classifier_ivas_fx(
sharp[i] = extract_h( L_shl( L_tmp, shift ) ); /* 30-s+s-8-16 -> Q6 */
move16();
/*sharp_dist += (sharp[i]-HVQ_SHARP_THRES); */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ sharp_dist = add_sat( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ) ); /* Q6 */
+#else
sharp_dist = add_o( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ), &Overflow ); /* Q6 */
+#endif
if ( GT_16( sharp[i], HVQ_SHARP_THRES_FX ) )
{
num_sharp_bands = add( num_sharp_bands, 1 );
@@ -1085,9 +1091,11 @@ void hvq_classifier_fx(
Word16 num_peak_cands, high, low;
Word16 sharp[HVQ_NSUB_32k];
Word16 peak_cand_idx[HVQ_THRES_BIN_32k], avail_peaks[HVQ_NSUB_32k];
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
L_input_max = L_deposit_l( 0 );
set32_fx( L_thr, 0, L_FRAME16k );
@@ -1240,7 +1248,11 @@ void hvq_classifier_fx(
move16();
/*sharp_dist += (sharp[i]-HVQ_SHARP_THRES); */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ sharp_dist = add_sat( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ) );
+#else
sharp_dist = add_o( sharp_dist, sub( sharp[i], HVQ_SHARP_THRES_FX ), &Overflow );
+#endif
IF( GT_16( sharp[i], HVQ_SHARP_THRES_FX ) )
{
num_sharp_bands = add( num_sharp_bands, 1 );
diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c
index b5e1abbca2d5383df9a9a9538635b2e2cad57058..dd9f1f2b9a51e01c3a60498e4711aff5bf992e04 100644
--- a/lib_enc/hq_core_enc_fx.c
+++ b/lib_enc/hq_core_enc_fx.c
@@ -1,14 +1,15 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*--------------------------------------------------------------------------
* hq_core_enc()
*
@@ -17,11 +18,11 @@
void hq_core_enc_fx(
Encoder_State *st_fx,
- const Word16 *audio, /* i : input audio signal Q0 */
- const Word16 input_frame_orig, /* i : frame length Q0*/
- const Word16 hq_core_type, /* i : HQ core type Q0*/
- const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/
- const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/
+ const Word16 *audio, /* i : input audio signal Q0*/
+ const Word16 input_frame_orig, /* i : frame length Q0*/
+ const Word16 hq_core_type, /* i : HQ core type Q0*/
+ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection Q0*/
+ const Word16 vad_hover_flag /* i : VAD hangover flag Q0*/
)
{
Word16 i, is_transient, num_bits, extra_unused;
@@ -329,8 +330,7 @@ void hq_core_enc_ivas_fx(
* Write signaling information
*--------------------------------------------------------------------------*/
- num_bits = BASOP_Util_Divide3232_Scale( st->total_brate, FRAMES_PER_SEC, &exp ); /* Q15-exp */
- num_bits = shr( num_bits, sub( 15, exp ) ); /* Q0 */
+ num_bits = extract_l( Mpy_32_32_r( st->total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) );
extra_unused = 0;
move16();
diff --git a/lib_enc/hq_hr_enc_fx.c b/lib_enc/hq_hr_enc_fx.c
index 05654e775965c7471130beb49e398018b3df01ef..f462ca4dca7662c29fcb215e318cfe98e4c86013 100644
--- a/lib_enc/hq_hr_enc_fx.c
+++ b/lib_enc/hq_hr_enc_fx.c
@@ -1,20 +1,22 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-//#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "rom_com.h" /* Static table prototypes */
-#include "prot_fx.h" /* Function prototypes */
+#include "rom_com.h" /* Static table prototypes */
+#include "prot_fx.h" /* Function prototypes */
#include "ivas_prot_fx.h"
#include "prot_fx_enc.h" /* Function prototypes */
+
+
/*--------------------------------------------------------------------------*
* hq_hr_enc_fx()
*
* HQ High rate encoding routine
*--------------------------------------------------------------------------*/
+
void hq_hr_enc_fx(
Encoder_State *st_fx, /* i/o: encoder state structure fx */
Word32 *t_audio, /* i/o: transform-domain coefficients Q12 */
diff --git a/lib_enc/hq_lr_enc_fx.c b/lib_enc/hq_lr_enc_fx.c
index af27806820f6ba1cf295ffb130523b8cbaa3a377..645c952e4f551efd7b9019e31e7347ec1a518a4a 100644
--- a/lib_enc/hq_lr_enc_fx.c
+++ b/lib_enc/hq_lr_enc_fx.c
@@ -1,18 +1,17 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h"
#include "cnst.h"
-// #include "prot_fx.h"
-#include "rom_com_fx.h"
#include "rom_enc.h"
-// #include "basop_mpy.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
+
/*--------------------------------------------------------------------------*
* Local function prototypes
*--------------------------------------------------------------------------*/
@@ -272,10 +271,12 @@ void hq_lr_enc_fx(
Word16 beta_fx; /*Q14 1.05f; */
HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core;
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
+#endif
set32_fx( L_y2, 0x0L, L_FRAME48k );
@@ -606,9 +607,13 @@ void hq_lr_enc_fx(
exp = 0;
move16();
}
- L_tmp = Mult_32_16( Ep_vari_fx, 3277 ); /*13+15-15=13 */
- L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( 12, exp ), &Overflow ); /*Q(13+exp-15 +12-exp +4 = 14) */
- tmp2 = extract_h( Ep_avrg_fx ); /*Q13-16=-3 */
+ L_tmp = Mult_32_16( Ep_vari_fx, 3277 ); /*13+15-15=13 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( Mult_32_16( L_tmp, tmp ), sub( 12, exp ) ); /*Q(13+exp-15 +12-exp +4 = 14) */
+#else
+ L_tmp = L_shl_o( Mult_32_16( L_tmp, tmp ), sub( 12, exp ), &Overflow ); /*Q(13+exp-15 +12-exp +4 = 14) */
+#endif
+ tmp2 = extract_h( Ep_avrg_fx ); /*Q13-16=-3 */
IF( tmp2 != 0 )
{
exp = norm_s( tmp2 );
@@ -623,10 +628,14 @@ void hq_lr_enc_fx(
exp = 0;
move16();
}
- L_tmp2 = Mult_32_16( Ep_vari_fx, 6554 ); /*13+15-15=13 */
- L_tmp2 = L_shl_o( Mult_32_16( L_tmp2, tmp2 ), sub( 13, exp ), &Overflow ); /*Q(13+exp-15 +13-exp +3 = 14) */
- L_tmp = L_min( L_tmp, L_tmp2 ); /*Q14 */
- tmp = extract_l( L_min( L_tmp, 13107 ) ); /*Q14 */
+ L_tmp2 = Mult_32_16( Ep_vari_fx, 6554 ); /*13+15-15=13 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp2 = L_shl_sat( Mult_32_16( L_tmp2, tmp2 ), sub( 13, exp ) ); /*Q(13+exp-15 +13-exp +3 = 14) */
+#else
+ L_tmp2 = L_shl_o( Mult_32_16( L_tmp2, tmp2 ), sub( 13, exp ), &Overflow ); /*Q(13+exp-15 +13-exp +3 = 14) */
+#endif
+ L_tmp = L_min( L_tmp, L_tmp2 ); /*Q14 */
+ tmp = extract_l( L_min( L_tmp, 13107 ) ); /*Q14 */
alpha_fx = add( 16384, tmp );
}
IF( EQ_16( hHQ_core->last_bitalloc_max_band[j++], 1 ) )
@@ -647,10 +656,14 @@ void hq_lr_enc_fx(
exp = 0;
move16();
}
- L_tmp = L_shl_o( Mult_32_16( Ep_avrg_fx, tmp ), sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */
- L_tmp = L_max( L_tmp, 16384 ); /*Q14 */
- tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*Q14 */
- alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=Q14 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( Mult_32_16( Ep_avrg_fx, tmp ), sub( 14, exp ) ); /*Q(13+exp-15 +14-exp+2 = 14) */
+#else
+ L_tmp = L_shl_o( Mult_32_16( Ep_avrg_fx, tmp ), sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */
+#endif
+ L_tmp = L_max( L_tmp, 16384 ); /*Q14 */
+ tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*Q14 */
+ alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=Q14 */
}
ELSE
{
@@ -670,11 +683,15 @@ void hq_lr_enc_fx(
exp = 0;
move16();
}
- L_tmp = L_shl_o( Mult_32_16( Ep_tmp_fx[i], tmp2 ), sub( 19, exp ), &Overflow ); /*Q(13+exp-15 +19-exp +3 = 20) */
- L_tmp = Mult_32_16( L_tmp, shl( sub( bands_fx, lowband ), 9 ) ); /*20 +9 -15 =Q14 */
- L_tmp = L_max( L_tmp, 13926 ); /*Q14 */
- tmp2 = extract_l( L_min( L_tmp, 16384 ) ); /*Q14 */
- alpha_fx = shl( mult( alpha_fx, tmp2 ), 1 ); /*14+14-15+1 =Q14 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( Mult_32_16( Ep_tmp_fx[i], tmp2 ), sub( 19, exp ) ); /*Q(13+exp-15 +19-exp +3 = 20) */
+#else
+ L_tmp = L_shl_o( Mult_32_16( Ep_tmp_fx[i], tmp2 ), sub( 19, exp ), &Overflow ); /*Q(13+exp-15 +19-exp +3 = 20) */
+#endif
+ L_tmp = Mult_32_16( L_tmp, shl( sub( bands_fx, lowband ), 9 ) ); /*20 +9 -15 =Q14 */
+ L_tmp = L_max( L_tmp, 13926 ); /*Q14 */
+ tmp2 = extract_l( L_min( L_tmp, 16384 ) ); /*Q14 */
+ alpha_fx = shl( mult( alpha_fx, tmp2 ), 1 ); /*14+14-15+1 =Q14 */
}
L_band_energy_tmp[i] = L_shl( Mult_32_16( L_band_energy_tmp[i], alpha_fx ), 1 ); /*Q(Q_band_energy+14-15 +1= Q_band_energy) */
move32();
@@ -749,7 +766,11 @@ void hq_lr_enc_fx(
bit_budget_fx = sub( bit_budget_fx, 2 ); /* bits in high bands to indicate the last 2 subbands is allocated bits or not Q0*/
FOR( i = 0; i < bands_fx; i++ )
{
- Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); /* Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_tmp_fx[i] = L_shl_sat( Ep_tmp_fx[i], 2 ); /* Q15 */
+#else
+ Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); /* Q15 */
+#endif
move32();
}
IF( EQ_32( st_fx->core_brate, ACELP_13k20 ) )
@@ -781,7 +802,11 @@ void hq_lr_enc_fx(
IF( GE_16( i, lowband ) && add( sub( i, bands_fx ), p2a_bands_fx ) < 0 )
{
Ep_vari_fx = L_add_sat( Ep_vari_fx, L_abs( L_sub_sat( Ep_tmp_fx[i], Ep_tmp_fx[( i - 1 )] ) ) ); /*Q15 */
- Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
}
IF( GE_16( i, highband ) )
@@ -849,8 +874,12 @@ void hq_lr_enc_fx(
IF( EQ_16( hHQ_core->last_bitalloc_max_band[sub( i, add( tmp, 1 ) )], 1 ) )
{
tmp = sub( tmp, lowband );
- L_tmp = Mult_32_16( Ep_tmp_fx[i], tmp ); /*Q(15+0-15 = 0) */
- tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */
+ L_tmp = Mult_32_16( Ep_tmp_fx[i], tmp ); /*Q(15+0-15 = 0) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = extract_h( L_shl_sat( L_tmp, 16 ) ); /*Q0 */
+#else
+ tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */
+#endif
IF( tmp != 0 )
{
exp = norm_s( tmp );
@@ -911,11 +940,19 @@ void hq_lr_enc_fx(
{
IF( GE_16( i, lowband ) )
{
- Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
}
ELSE
{
- Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
IF( GT_32( Ep_tmp_fx[i], Ep_peak_fx ) )
{
Ep_peak_fx = L_add( Ep_tmp_fx[i], 0 ); /*Q15 */
@@ -1179,8 +1216,10 @@ void hq_lr_enc_ivas_fx(
Word32 L_band_energy_tmp[BANDS_MAX];
UWord16 lo;
Word16 Q_band_energy;
+#ifndef ISSUE_1867_replace_overflow_libenc
Flag Overflow;
move32();
+#endif
BSTR_ENC_HANDLE hBstr = st->hBstr;
HQ_ENC_HANDLE hHQ_core = st->hHQ_core;
@@ -1448,7 +1487,11 @@ void hq_lr_enc_ivas_fx(
}
ELSE
{
- Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 )
{
Ep_peak_fx = Ep_tmp_fx[i]; /*Q15 */
@@ -1572,10 +1615,14 @@ void hq_lr_enc_ivas_fx(
move16();
}
Mpy_32_16_ss( Ep_avrg_fx, tmp, &L_tmp, &lo );
- L_tmp = L_shl_o( L_tmp, sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */
- L_tmp = L_max( L_tmp, 16384 ); /*14 */
- tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*14 */
- alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=14 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, sub( 14, exp ) ); /*Q(13+exp-15 +14-exp+2 = 14) */
+#else
+ L_tmp = L_shl_o( L_tmp, sub( 14, exp ), &Overflow ); /*Q(13+exp-15 +14-exp+2 = 14) */
+#endif
+ L_tmp = L_max( L_tmp, 16384 ); /*14 */
+ tmp = extract_l( L_min( L_tmp, beta_fx ) ); /*14 */
+ alpha_fx = shl( mult( alpha_fx, tmp ), 1 ); /*14+14-15 +1=14 */
}
ELSE
{
@@ -1619,7 +1666,11 @@ void hq_lr_enc_ivas_fx(
{
IF( sub( i, lowband ) >= 0 )
{
- Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
}
ELSE
{
@@ -1661,8 +1712,12 @@ void hq_lr_enc_ivas_fx(
Mpy_32_16_ss( Ep_peak_fx, tmp, &L_tmp, &lo );
Mpy_32_16_ss( L_tmp, lowband, &L_tmp, &lo );
Mpy_32_16_ss( L_tmp, 18842, &L_tmp, &lo );
- L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */
- tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_shl_sat( L_tmp, sub( 27, exp ) ); /*Q14 0.5 */
+#else
+ L_tmp = L_shl_o( L_tmp, sub( 27, exp ), &Overflow ); /*Q14 0.5 */
+#endif
+ tmp2 = extract_l( L_min( L_tmp, 19661 ) ); /*14 */
Mpy_32_16_ss( L_band_energy_tmp[i], tmp2, &L_tmp, &lo );
L_band_energy_tmp[i] = L_shl( L_tmp, 1 ); /*Q_band_energy */
move32();
@@ -1685,7 +1740,11 @@ void hq_lr_enc_ivas_fx(
bit_budget = sub( bit_budget, 2 ); /* bits in high bands to indicate the last 2 subbands is allocated bits or not */
FOR( i = 0; i < bands; i++ )
{
- Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); /* Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_tmp_fx[i] = L_shl_sat( Ep_tmp_fx[i], 2 ); /* Q15 */
+#else
+ Ep_tmp_fx[i] = L_shl_o( Ep_tmp_fx[i], 2, &Overflow ); /* Q15 */
+#endif
move32();
}
IF( EQ_32( st->core_brate, ACELP_13k20 ) )
@@ -1721,7 +1780,11 @@ void hq_lr_enc_ivas_fx(
IF( sub( i, lowband ) >= 0 && add( sub( i, bands ), p2a_bands ) < 0 )
{
Ep_vari_fx = L_add( Ep_vari_fx, L_abs( L_sub( Ep_tmp_fx[i], Ep_tmp_fx[sub( i, 1 )] ) ) ); /*Q15 */
- Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
}
IF( sub( i, highband ) >= 0 )
@@ -1754,7 +1817,11 @@ void hq_lr_enc_ivas_fx(
tmp = sub( bands, p2a_bands );
tmp = sub( tmp, lowband ); /*Q0 */
- tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp1 = extract_h( L_shl_sat( Ep_avrg_fx, 1 ) ); /*Q0 */
+#else
+ tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */
+#endif
IF( tmp1 != 0 )
{
exp = norm_s( tmp1 );
@@ -1793,7 +1860,11 @@ void hq_lr_enc_ivas_fx(
{
tmp = sub( tmp, lowband );
Mpy_32_16_ss( Ep_tmp_fx[i], tmp, &L_tmp, &lo );
- tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = extract_h( L_shl_sat( L_tmp, 16 ) ); /*Q0 */
+#else
+ tmp = extract_h( L_shl_o( L_tmp, 16, &Overflow ) ); /*Q0 */
+#endif
IF( tmp != 0 )
{
exp = norm_s( tmp );
@@ -1818,7 +1889,11 @@ void hq_lr_enc_ivas_fx(
{
tmp = sub( tmp, lowband );
- tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp1 = extract_h( L_shl_sat( Ep_avrg_fx, 1 ) ); /*Q0 */
+#else
+ tmp1 = extract_h( L_shl_o( Ep_avrg_fx, 1, &Overflow ) ); /*Q0 */
+#endif
IF( tmp1 != 0 )
{
exp = norm_s( tmp1 );
@@ -1857,11 +1932,19 @@ void hq_lr_enc_ivas_fx(
{
IF( sub( i, lowband ) >= 0 )
{
- Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrg_fx = L_add_sat( Ep_avrg_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrg_fx = L_add_o( Ep_avrg_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
}
ELSE
{
- Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ep_avrgL_fx = L_add_sat( Ep_avrgL_fx, Ep_tmp_fx[i] ); /*Q15 */
+#else
+ Ep_avrgL_fx = L_add_o( Ep_avrgL_fx, Ep_tmp_fx[i], &Overflow ); /*Q15 */
+#endif
IF( L_sub( Ep_tmp_fx[i], Ep_peak_fx ) > 0 )
{
Ep_peak_fx = Ep_tmp_fx[i]; /* Q15 */
@@ -1886,7 +1969,11 @@ void hq_lr_enc_ivas_fx(
move16();
FOR( i = 0; i < lowband; i++ )
{
- tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = extract_h( L_shl_sat( Ep_avrgL_fx, 1 ) ); /*Q0 */
+#else
+ tmp = extract_h( L_shl_o( Ep_avrgL_fx, 1, &Overflow ) ); /*Q0 */
+#endif
IF( tmp != 0 )
{
exp = norm_s( tmp );
@@ -3394,9 +3481,11 @@ static Word16 p2a_threshold_quant_fx(
Word32 L_p2a;
Word16 p2a_fx;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
exp_safe = 4; /* never happen overflow. */
@@ -3464,7 +3553,11 @@ static Word16 p2a_threshold_quant_fx(
/* 10/( log(10)/log(2) ) = 3.01029995663981195211 24660(Q13) */
L_p2a = Mpy_32_16_1( L_tmp, 24660 ); /* 16+13-15 -> Q14 */
- p2a_fx = round_fx_o( L_shl_o( L_p2a, 13, &Overflow ), &Overflow ); /* 27 -16 -> 11 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ p2a_fx = round_fx_sat( L_shl_sat( L_p2a, 13 ) ); /* 27 -16 -> 11 */
+#else
+ p2a_fx = round_fx_o( L_shl_o( L_p2a, 13, &Overflow ), &Overflow ); /* 27 -16 -> 11 */
+#endif
}
IF( LE_16( p2a_fx, p2a_th_fx ) )
@@ -3514,9 +3607,11 @@ static Word16 p2a_threshold_quant_ivas_fx(
Word32 L_p2a;
Word16 p2a_fx;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
exp_safe = 4; /* never happen overflow. */
@@ -3583,7 +3678,11 @@ static Word16 p2a_threshold_quant_ivas_fx(
/* 10/( log(10)/log(2) ) = 3.01029995663981195211 24660(Q13) */
L_p2a = Mpy_32_16_1( L_tmp, 24660 ); /* 16+13-15 -> Q14 */
- p2a_fx = round_fx_o( L_shl_o( L_p2a, 13, &Overflow ), &Overflow ); /* 27 -16 -> 11 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ p2a_fx = round_fx_sat( L_shl_sat( L_p2a, 13 ) ); /* 27 -16 -> 11 */
+#else
+ p2a_fx = round_fx_o( L_shl_o( L_p2a, 13, &Overflow ), &Overflow ); /* 27 -16 -> 11 */
+#endif
}
IF( LE_16( p2a_fx, p2a_th_fx ) )
@@ -3650,9 +3749,11 @@ static void mdct_spectrum_fine_gain_enc_fx(
Word16 d_fx;
Word16 dmin_fx;
Word16 imin_fx;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Fine gain quantization on only the most significant energy bands */
@@ -3723,9 +3824,13 @@ static void mdct_spectrum_fine_gain_enc_fx(
exp_normn = norm_l( L_Exy );
exp_normn = sub( exp_normn, 1 );
exp_normd = norm_l( L_Eyy );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gamma_fx = div_l( L_shl( L_Exy, exp_normn ), round_fx_sat( L_shl( L_Eyy, exp_normd ) ) ); /* Qgamma */
+#else
gamma_fx = div_l( L_shl_o( L_Exy, exp_normn, &Overflow ), round_fx_o( L_shl_o( L_Eyy, exp_normd, &Overflow ), &Overflow ) ); /* Qgamma */
- Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */
- gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */
+#endif
+ Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */
+ gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */
dmin_fx = 32767;
move16();
@@ -3812,9 +3917,11 @@ static void mdct_spectrum_fine_gain_enc_ivas_fx(
Word16 d_fx;
Word16 dmin_fx;
Word16 imin_fx;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Fine gain quantization on only the most significant energy bands */
@@ -3885,9 +3992,13 @@ static void mdct_spectrum_fine_gain_enc_ivas_fx(
exp_normn = norm_l( L_Exy );
exp_normn = sub( exp_normn, 1 );
exp_normd = norm_l( L_Eyy );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gamma_fx = div_l( L_shl( L_Exy, exp_normn ), round_fx_sat( L_shl( L_Eyy, exp_normd ) ) ); /* Qgamma */
+#else
gamma_fx = div_l( L_shl_o( L_Exy, exp_normn, &Overflow ), round_fx_o( L_shl_o( L_Eyy, exp_normd, &Overflow ), &Overflow ) ); /* Qgamma */
- Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */
- gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */
+#endif
+ Qgamma = add( sub( exp_normn, exp_normd ), 15 ); /* exp_normn - (exp_normd-16) - 1; */
+ gamma_fx = shl( gamma_fx, sub( 14, Qgamma ) ); /* Qgamma -> Q14 */
dmin_fx = 32767;
move16();
diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c
index f6c45dab21681433a16b2a636f7f11b725a8e519..60cf0159a7cb65c07e85301813f0efa04a6f4bc1 100644
--- a/lib_enc/hvq_enc_fx.c
+++ b/lib_enc/hvq_enc_fx.c
@@ -49,9 +49,11 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits
Word16 expPeMean, expNfMean, expNfpe, expNfpe3, expo, expo3;
Word16 manPeMean, manNfMean, manNfpe, man;
Word16 tmp16, adjust;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
bits_used = 0;
move16();
@@ -118,7 +120,11 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits
nf_cnt = add( nf_cnt, 1 ); /* Q0 */
}
- pe_mean = L_add_o( pe_mean, pe, &Overflow ); /* in Q12 and always positive */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ pe_mean = L_add_sat( pe_mean, pe ); /* in Q12 and always positive */
+#else
+ pe_mean = L_add_o( pe_mean, pe, &Overflow ); /* in Q12 and always positive */
+#endif
}
IF( pe_mean > 0 )
@@ -146,10 +152,10 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits
expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */
/* Number of bits required to adjust to Q15 */
adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */
-#ifdef ISSUE_1799_replace_L_shr_o
+#ifdef ISSUE_1867_replace_overflow_libenc
noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */
#else
- noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */
+ noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */
#endif
move16();
q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] );
@@ -180,22 +186,14 @@ Word16 hvq_enc_ivas_fx( /*o : Consumed bits
acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */
expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */
/* Number of bits required to adjust to Q15 */
- adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */
-#ifdef ISSUE_1799_replace_L_shr_o
+ adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */
lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */
-#else
- lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */
-#endif
- IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */
+ IF( GT_16( lb_nfpe, 16384 ) ) /* in Q15 */
{
lb_nfpe = 16384;
move16();
}
-#ifdef ISSUE_1796_replace_shl_o
Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */
-#else
- Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */
-#endif
}
ELSE
{
@@ -238,9 +236,11 @@ Word16 hvq_enc_fx( /*o : Consumed bits
Word16 expPeMean, expNfMean, expNfpe, expNfpe3, expo, expo3;
Word16 manPeMean, manNfMean, manNfpe, man;
Word16 tmp16, adjust;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
bits_used = 0;
move16();
@@ -307,7 +307,11 @@ Word16 hvq_enc_fx( /*o : Consumed bits
nf_cnt = add( nf_cnt, 1 ); /* Q0 */
}
- pe_mean = L_add_o( pe_mean, pe, &Overflow ); /* in Q12 and always positive */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ pe_mean = L_add_sat( pe_mean, pe ); /* in Q12 and always positive */
+#else
+ pe_mean = L_add_o( pe_mean, pe, &Overflow ); /* in Q12 and always positive */
+#endif
}
IF( pe_mean > 0 )
@@ -334,12 +338,8 @@ Word16 hvq_enc_fx( /*o : Consumed bits
acc = L_mult( tmp16, HVQ_NFPE_FACTOR_CUBE_FX ); /* in Q(12+6+1) = Q19 */
expNfpe3 = extract_l( L_mult0( expNfpe, 3 ) ); /* Cube operation */
/* Number of bits required to adjust to Q15 */
- adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */
-#ifdef ISSUE_1799_replace_L_shr_o
+ adjust = add( 19 - ( 15 + 16 ), expNfpe3 ); /* +16 is due to the following extract_h(). */
noise_level[i] = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */
-#else
- noise_level[i] = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */
-#endif
move16();
q_noise_level_idx[i] = quant_lc_fx( noise_level[i], &q_noise_level[i] );
move16();
@@ -369,22 +369,14 @@ Word16 hvq_enc_fx( /*o : Consumed bits
acc = L_mult( tmp16, HVQ_LB_NFPE_FACTOR_CUBE_FX ); /* in Q(12+9+1) = Q22 */
expo3 = extract_l( L_mult0( expo, 3 ) ); /* Cube operation. */
/* Number of bits required to adjust to Q15 */
- adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */
-#ifdef ISSUE_1799_replace_L_shr_o
+ adjust = add( 22 - ( 15 + 16 ), expo3 ); /* +16 is due to the following extract_h(). */
lb_nfpe = extract_h( L_shr_sat( acc, adjust ) ); /* noise_level[] in Q15 */
-#else
- lb_nfpe = extract_h( L_shr_o( acc, adjust, &Overflow ) ); /* noise_level[] in Q15 */
-#endif
- IF( lb_nfpe > 16384 ) /* in Q15 */
+ IF( lb_nfpe > 16384 ) /* in Q15 */
{
lb_nfpe = 16384;
move16();
}
-#ifdef ISSUE_1796_replace_shl_o
Mpy_32_16_ss( nf_gains[i], shl_sat( lb_nfpe, 1 ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */
-#else
- Mpy_32_16_ss( nf_gains[i], shl_o( lb_nfpe, 1, &Overflow ), &nf_gains[i], &dontCare ); /* nf_gains[] in Q12 */
-#endif
}
ELSE
{
diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c
deleted file mode 100644
index 0a01dfe6667897772df2872ff2d6089504db72c5..0000000000000000000000000000000000000000
--- a/lib_enc/igf_enc.c
+++ /dev/null
@@ -1,2697 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
- ====================================================================================*/
-
-#include
-#include
-#include "options.h"
-#include
-#include "prot_fx.h"
-#include "cnst.h"
-#include "stat_enc.h"
-#include "wmc_auto.h"
-#include "prot_fx_enc.h"
-
-
-#define INV_Log2_10_Q15 9864 /*1/log2(10) in Q15*/
-#define INV_Log2_10_Q12 1233 /*1/log2(10) in Q12*/
-#define INV_Log2_e_Q15 22713 /*1/log2(e) in Q15*/
-/*-------------------------------------------------------------------*
- * IGF_write_bit_fx()
- *
- * write single bit to stream
- *-------------------------------------------------------------------*/
-static void IGF_write_bit_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *bitCount, /* i/o: bit counter */
- const Word16 value /* i : value */
-)
-{
- IF( hBstr )
- {
- push_next_indice( hBstr, value, 1 );
- }
-
- ( *bitCount ) = add( ( *bitCount ), 1 );
- move16();
-
- return;
-}
-
-/*-------------------------------------------------------------------*
- * IGF_write_bits()
- *
- * write bits to stream
- *-------------------------------------------------------------------*/
-static void IGF_write_bits(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *bitCount, /* i/o: bit counter */
- const Word16 value, /* i/o: value */
- Word16 bits /* i : number of bits */
-)
-{
- WHILE( bits-- )
- {
- IF( s_and( value, shl( 1, bits ) ) == 0 )
- {
- IGF_write_bit_fx( hBstr, bitCount, 0 );
- }
- ELSE
- {
- IGF_write_bit_fx( hBstr, bitCount, 1 );
- }
- }
-
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_getCrest_new()
- *
- * crest factor calculation
- *-------------------------------------------------------------------*/
-
-/*! r: crest factor */
-static Word16 IGF_getCrest_new_fx(
- const Word16 *logSpec, /* i : power spectrum */
- const Word16 start, /* i : start subband index */
- const Word16 stop, /* i : stop subband index */
- Word16 *crest_exp /*Stores the exponent of the result(return value)*/
-)
-{
- Word16 i;
- Word16 x;
- Word32 x_eff;
- Word16 x_max;
- Word16 exp;
- Word16 temp;
- Word16 temp_e;
- Word16 crest; /*1.0f in Q15*/
- x_eff = 0;
- x_max = 0;
- exp = 0;
- temp = 0;
- crest = 32767; /*1.0f in Q15*/
- move32();
- move16();
- move16();
- move16();
- move16();
-
- FOR( i = start; i < stop; i++ )
- {
- x = logSpec[i];
- move16();
-#ifdef OPT_MCT_ENC_V3_BE
- x_eff = L_mac0( x_eff, x, x );
-#else
- x_eff = L_add( x_eff, L_mult0( x, x ) );
-#endif
-
- if ( GT_16( x, x_max ) )
- {
- x_max = x;
- move16();
- }
- }
-
- x_eff = BASOP_Util_Divide3216_Scale( x_eff, sub( stop, start ), &temp_e );
- temp_e = add( temp_e, 16 ); /*exp += 31 - 15 + 16(because x_eff is word32)*/
- x_eff = L_shr( x_eff, sub( 15, temp_e ) );
- temp_e = 15;
- move16();
- temp = Sqrt16( extract_l( x_eff ), &temp_e );
-
- test();
- IF( x_eff > 0 && x_max > 0 )
- {
- temp = BASOP_Util_Divide1616_Scale( x_max, temp, &exp );
- exp = add( exp, sub( 15, temp_e ) );
- IF( exp < 0 )
- {
- temp = shl( temp, exp );
- exp = 0;
- move16();
- }
- crest = s_max( shl_sat( 1, sub( 15, exp ) ), temp );
- }
- *crest_exp = exp;
- move16();
- return crest;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_getSFM_new()
- *
- * calculates spectral flatness measurement
- *-------------------------------------------------------------------*/
-
-/*! r: SFM value */
-static Word16 IGF_getSFM_new_fx(
- const Word32 *powerSpectrum, /* i : power spectrum */
- const Word16 *logSpec, /* i : log of power spectrum */
- const Word16 start, /* i : start subband index */
- const Word16 stop, /* i : stop subband index */
- Word16 *e_ps /*Stores exp related to power spectrum*/
-)
-{
- Word16 n;
- Word16 i;
- Word16 num;
- Word32 denom;
- Word16 numf;
- Word32 tmp;
- Word16 sfm;
- Word16 sfm_e;
- Word16 denom_e;
- Word16 numf_e; /*stores exponent for numf*/
- Word16 tmp_e;
-
- num = 0;
- denom = ONE_IN_Q30;
- denom_e = 1;
- sfm = MAX16B; // Q15
- move16();
- move32();
- move16();
- move16();
-
- FOR( i = start; i < stop; i++ )
- {
- tmp = powerSpectrum[i];
- n = logSpec[i /*-start*/];
- move32();
- move16();
- num = add( num, n );
- denom = BASOP_Util_Add_Mant32Exp( tmp, e_ps[i], denom, denom_e, &denom_e );
- }
-
- numf = BASOP_Util_Divide1616_Scale( num, sub( stop, start ), &numf_e );
- denom = BASOP_Util_Divide3216_Scale( denom, sub( stop, start ), &tmp_e );
- denom_e = add( add( denom_e, tmp_e ), 1 ); /*denom_e+tmp_e-15 +16(because type of denom is word32)*/
-
- IF( denom != 0 )
- {
- tmp = BASOP_util_Pow2( L_add( numf, shl_sat( 1, sub( 14, numf_e ) ) ), add( 16, numf_e ), &tmp_e );
- sfm = BASOP_Util_Divide3232_Scale( tmp, denom, &sfm_e );
- sfm_e = add( sfm_e, sub( tmp_e, denom_e ) );
- sfm = shl_sat( extract_l( L_min( sfm, L_shl_sat( 1, sub( 15, sfm_e ) ) ) ), sfm_e );
- }
-
- return sfm;
-}
-/*-------------------------------------------------------------------*
- * IGF_getTilt()
- *
- * calculates spectral tilt
- *-------------------------------------------------------------------*/
-
-/*! r: spectral tilt value */
-
-/*-------------------------------------------------------------------*
- * IGF_getTNR()
- *
- * calculates tonal-to-noise ratio
- *-------------------------------------------------------------------*/
-
-/*! r: spectral tilt value */
-/* Returns value with exponent as 9 and Q as 22*/
-
-static Word32 IGF_getTNR_ivas_fx(
- const Word32 *powerSpectrum, /* i : energies */
- const Word16 start, /* i : start subband index */
- const Word16 stop, /* i : stop subband index */
- const Word16 adap, /* i : SFB width adaptation */
- Word16 *e_ps, /*Stores exponent for powerSpectrum*/
- Word16 e_adap /*Stores exponent for adap*/
-)
-{
- Word16 i;
- Word16 width;
- Word32 avg;
- Word32 tonal;
- Word16 tonal_e; /* holds exp for tonal*/
- Word32 noise;
- Word16 noise_e; /* holds exp for noise*/
- Word32 tonalToNoise;
- Word32 rootSpec[300];
- Word16 rootSpec_e[300]; /*rootSpec_e[i] holds exp for rootSpec[i]*/
- Word16 avg_e; /* holds exp for avg*/
- Word16 tmp_e;
- avg = 0;
- tonal = 0;
- noise = EPSILON_FX;
- tonal_e = 0;
- noise_e = 0;
- avg_e = 0;
- tmp_e = 0;
- move32();
- move32();
- move32();
- move16();
- move16();
- move16();
- move16();
-
- set32_fx( rootSpec, 0, 300 );
- set16_fx( rootSpec_e, 0, 300 );
-
- width = sub( stop, start );
- FOR( i = start; i < stop; i++ )
- {
- rootSpec_e[( i - start )] = e_ps[i];
- move16();
- rootSpec[( i - start )] = Sqrt32( powerSpectrum[i], &rootSpec_e[( i - start )] ); /*rootSpec[i - start] = sqrtf( powerSpectrum[i] );*/
- move32();
- avg = BASOP_Util_Add_Mant32Exp( avg, avg_e, rootSpec[( i - start )], rootSpec_e[( i - start )], &avg_e ); /*avg += rootSpec[i - start];resultant exponent is avg_e*/
- }
- avg = BASOP_Util_Divide3216_Scale( avg, width, &tmp_e ); /*avg /= width;*/
- avg_e = add( 16, sub( add( avg_e, tmp_e ), 15 ) );
-
- FOR( i = start; i < stop; i++ )
- {
- Word16 normSpec_e; /*stores resultant exponent for normSpec*/
- Word16 normSpec = BASOP_Util_Divide3232_Scale( rootSpec[i - start], avg, &normSpec_e ); /*rootSpec[i - start] / avg;*/
- normSpec_e = add( normSpec_e, sub( rootSpec_e[i - start], avg_e ) );
- IF( GT_32( normSpec, L_add_sat( L_shl_sat( 1, sub( 15, normSpec_e ) ), L_shl_sat( adap, sub( e_adap, normSpec_e ) ) ) ) )
- {
- tonal = BASOP_Util_Add_Mant32Exp( tonal, tonal_e, rootSpec[( i - start )], rootSpec_e[( i - start )], &tonal_e ); /*tonal += rootSpec[i - start];*/
- }
- ELSE IF( LT_32( normSpec, L_shl_sat( 1, sub( 15, normSpec_e ) ) ) )
- {
- noise = BASOP_Util_Add_Mant32Exp( noise, noise_e, rootSpec[( i - start )], rootSpec_e[( i - start )], &noise_e ); /*noise += rootSpec[i - start];*/
- }
- }
-
- /*tonalToNoise = 20.f * log10f( max( 1e-018f, tonal / noise ) )*/
- IF( noise == 0 ) // To handle condition if denom = 0
- {
- tonalToNoise = imult3216( L_shr( L_add( L_shl( 18 /* log10f(1e-018f) */, Q25 ), Mpy_32_16_1( L_add( BASOP_Util_Log2( tonal ), L_shl( tonal_e, Q25 ) ) /*Q25*/, INV_Log2_10_Q15 ) /*25+15-15*/ ), 3 ) /*Q22*/, 20 );
- }
- ELSE
- {
- Word16 temp = BASOP_Util_Divide3232_Scale( tonal, noise, &tmp_e ); /*tonal / noise*/
- tmp_e = add( tmp_e, sub( tonal_e, noise_e ) );
- IF( GE_16( temp, 1 ) )
- {
- tonalToNoise = imult3216( Mult_32_16( L_add( BASOP_Util_Log2( temp ), L_shl( add( 16, tmp_e ), Q25 ) ) /*Q25*/, INV_Log2_10_Q12 ) /*25+12-15*/, 20 ); /*Q22*/
- }
- ELSE
- {
- tonalToNoise = -1509949440; /*-360.f Q22*/
- move32();
- }
- }
-
- return tonalToNoise;
-}
-
-/*-------------------------------------------------------------------*
- * IGF_CalculateEnvelope()
- *
- * envelope estimation
- *-------------------------------------------------------------------*/
-
-static void IGF_CalculateEnvelope_ivas_fx(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
- Word32 *pMDCTSpectrum_fx, /* i : MDCT spectrum */
- Word16 e_mdct, /* i : exp of MDCT spectrum */
- Word32 *pPowerSpectrum_fx, /* i : MDCT^2 + MDST^2 spectrum, or estimate */
- Word16 *e_ps, /* i : exp of power spectrum */
- const Word16 igfGridIdx, /* i : IGF grid index */
- const Word16 isTransient, /* i : flag indicating if transient is detected */
- const Word16 last_core_acelp, /* i : indicator if last frame was ACELP core */
- const Word16 element_mode, /* i : IVAS element_mode */
- const Word16 att /* i : attenuation */
-)
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
- H_IGF_GRID hGrid;
- Word16 *swb_offset;
- Word16 sfb; /* this is the actual scalefactor band */
- Word16 width; /* this is width in subbands of the actual scalefactor band */
- Word16 tile_idx;
- Word16 strt_cpy;
- Word32 gain; /* the gain which has to be applied to the source tile to get the destination energy */
- Word16 sb;
- Word32 sfbEnergyR;
- Word32 sfbEnergyC; /* the energy of the destination region of the tile */
- Word32 sfbEnergyTileR;
- Word32 sfbEnergyTileC; /* the energy of the destination region of the tile */
- Word16 tmp, x, y;
- Word16 mean_x_fx, mean_y_fx;
- Word32 mean_xy_fx, mean_x2_fx;
- Word16 tmp_tb;
- Word16 tmp_sb;
- Word16 sfbCnt;
- Word16 sfm;
- Word16 crest;
- Word16 temp;
- Word16 mean_x_e, mean_y_e; /*Stores exponent for mean_x and mean_y respectively*/
- Word16 mean_xy_e, mean_x2_e; /*stores exponent for mean_xy and mean_x2 respectively*/
- Word16 sfbEnergyTileR_e; /*Exponent for sfbEnergyTileR*/
- Word16 sfbEnergyTileC_e; /*Exponent for sfbEnergyTileC*/
- Word16 sfbEnergyC_e; /*Exponent for sfbEnergyC*/
- Word16 sfbEnergyR_e;
- Word16 gain_e; /*exponent for gain*/
- Word16 tmp_tb_e; /*Stores exponent for tmp_tb*/
- Word16 tmp_sb_e; /*stores exponent for tmp_sb*/
- Word16 crest_exp; /*Stores the exponent of the result(return value)*/
- Word16 sfm_exp; /*stores exponent for ouput from sfm*/
- Word16 tmp_e;
-
- hPrivateData = &hIGFEnc->igfData;
- hGrid = &hPrivateData->igfInfo.grid[(Word16) igfGridIdx];
- swb_offset = hGrid->swb_offset;
-
- IF( element_mode > EVS_MONO )
- {
- IF( igfGridIdx != IGF_GRID_LB_NORM )
- {
- FOR( sfbCnt = 0; sfbCnt < sub( hGrid->sfbWrap[hGrid->nTiles], hGrid->sfbWrap[0] ); sfbCnt++ )
- {
- /* reset filter */
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_TB_e[sfbCnt]
- hPrivateData->prevSFB_FIR_TB_e[sfbCnt] = 0;
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_TB_e[sfbCnt]
- hPrivateData->prevSFB_IIR_TB_e[sfbCnt] = 0;
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_SB_e[sfbCnt]
- hPrivateData->prevSFB_FIR_SB_e[sfbCnt] = 0;
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_SB_e[sfbCnt]
- hPrivateData->prevSFB_IIR_SB_e[sfbCnt] = 0;
- hPrivateData->prevDampingFactor_IIR_fx[sfbCnt] = MIN16B; /* -1.f in Q15*/
- hPrivateData->prevDampingFactor_IIR_e[sfbCnt] = 0;
- hPrivateData->dampingFactorSmoothing[sfbCnt] = 2;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- }
- }
-
- IF( pPowerSpectrum_fx )
- {
- FOR( sb = hGrid->sbWrap[0]; sb < swb_offset[hGrid->sfbWrap[hGrid->nTiles]]; sb++ )
- {
- IF( LT_32( 1, pPowerSpectrum_fx[sb] ) )
- {
- hPrivateData->logSpec[sb] = s_max( 0, extract_l( W_extract_l( W_shr( W_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), W_shl( e_ps[sb], Q25 ) ), Q25 ) ) ) );
- move16();
- }
- ELSE
- {
- hPrivateData->logSpec[sb] = 0;
- move16();
- }
- }
- }
-
- FOR( tile_idx = 0; tile_idx < hGrid->nTiles; tile_idx++ )
- {
- strt_cpy = hGrid->sbWrap[tile_idx];
- move16();
-
- FOR( sfb = hGrid->sfbWrap[tile_idx]; sfb < hGrid->sfbWrap[tile_idx + 1]; sfb++ )
- {
- width = sub( swb_offset[sfb + 1], swb_offset[sfb] );
- sfbEnergyTileR = EPSILON_FIX;
- sfbEnergyTileC = EPSILON_FIX;
- sfbEnergyC = EPSILON_FX;
- sfbEnergyTileR_e = 0;
- sfbEnergyTileC_e = 0;
- sfbEnergyC_e = 0;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
-
- IF( pPowerSpectrum_fx != NULL )
- {
- tmp = strt_cpy;
- move16();
- FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
- {
- Word16 shift = norm_l( pPowerSpectrum_fx[sb] );
- sfbEnergyC = BASOP_Util_Add_Mant32Exp( sfbEnergyC, sfbEnergyC_e, L_shl( pPowerSpectrum_fx[sb], shift ), sub( e_ps[sb], shift ), &sfbEnergyC_e );
- // sfbEnergyTileR = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR, sfbEnergyTileR_e, Mult_32_32( pMDCTSpectrum_fx[strt_cpy], pMDCTSpectrum_fx[strt_cpy] ), shl( e_mdct, 1 ), &sfbEnergyTileR_e );
- Word64 tmp64 = W_mult_32_32( pMDCTSpectrum_fx[strt_cpy], pMDCTSpectrum_fx[strt_cpy] );
- Word16 tmp64_e = W_norm( tmp64 );
- tmp64 = W_shl( tmp64, tmp64_e );
-
- sfbEnergyTileR = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR, sfbEnergyTileR_e, W_extract_h( tmp64 ), shl( e_mdct, 1 ) - tmp64_e, &sfbEnergyTileR_e );
- shift = norm_l( pPowerSpectrum_fx[strt_cpy] );
- sfbEnergyTileC = BASOP_Util_Add_Mant32Exp( sfbEnergyTileC, sfbEnergyTileC_e, L_shl( pPowerSpectrum_fx[strt_cpy], shift ), sub( e_ps[strt_cpy], shift ), &sfbEnergyTileC_e );
-
- strt_cpy = add( strt_cpy, 1 );
- }
-
- sfbEnergyTileR = L_deposit_h( BASOP_Util_Divide3232_Scale( sfbEnergyTileR, width, &tmp_e ) );
- sfbEnergyTileR_e = add( sub( sfbEnergyTileR_e, Q31 ), tmp_e );
-
- IF( sfbEnergyTileR == 0 )
- {
- sfbEnergyTileR = EPSILON_FX;
- sfbEnergyTileR_e = 0;
- move32();
- move16();
- }
- IF( sfbEnergyC == 0 )
- {
- sfbEnergyC = EPSILON_FX;
- sfbEnergyC_e = 0;
- move32();
- move16();
- }
- IF( sfbEnergyTileC == 0 )
- {
- sfbEnergyTileC = EPSILON_FX;
- sfbEnergyTileC_e = 0;
- temp = BASOP_Util_Divide3232_Scale( sfbEnergyC, sfbEnergyTileC, &tmp_e );
- tmp_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) );
- move32();
- move16();
- }
- ELSE
- {
- /*gain = (float) ( sfbEnergyTileR * ( sfbEnergyC / sfbEnergyTileC ) );*/
- temp = BASOP_Util_Divide3232_Scale( sfbEnergyC, sfbEnergyTileC, &tmp_e );
- tmp_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) );
- }
-
- gain = Mult_32_16( sfbEnergyTileR, temp ); // gain_e
- gain_e = add( tmp_e, sfbEnergyTileR_e );
-
- IF( element_mode > EVS_MONO )
- {
- test();
- IF( !isTransient )
- {
- Word16 diffSFM;
- Word16 shiftedSFM = 0;
- Word16 shiftedSFM_e = 0;
- move16();
- move16();
-
- // tmp_tb = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] ) / IGF_getCrest_new( hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] );
- sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1], e_ps );
- sfm_exp = 0;
- move16();
- crest = IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1], &crest_exp );
- tmp_tb = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); // tmp_tb_e
- tmp_tb_e = add( tmp_e, sub( sfm_exp, crest_exp ) );
-
- // tmp_sb = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, tmp, strt_cpy ) / IGF_getCrest_new( hPrivateData->logSpec, tmp, strt_cpy );
- sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, tmp, strt_cpy, e_ps );
- crest = IGF_getCrest_new_fx( hPrivateData->logSpec, tmp, strt_cpy, &crest_exp );
- tmp_sb = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); // tmp_sb_e
- tmp_sb_e = add( tmp_e, sub( sfm_exp, crest_exp ) );
-
- test();
- IF( last_core_acelp || hPrivateData->wasTransient )
- {
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = tmp_tb; /*Exponent for hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] : hPrivateData->prevSFB_FIR_TB_e[sfb] and hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] : hPrivateData->prevSFB_IIR_TB_e[sfb] */
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = tmp_sb; /*Exponent for hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] : hPrivateData->prevSFB_FIR_SB_e[sfb] and hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] : hPrivateData->prevSFB_IIR_SB_e[sfb] */
- hPrivateData->prevSFB_FIR_TB_e[sfb] = hPrivateData->prevSFB_IIR_TB_e[sfb] = tmp_tb_e;
- hPrivateData->prevSFB_FIR_SB_e[sfb] = hPrivateData->prevSFB_IIR_SB_e[sfb] = tmp_sb_e;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
-
- tmp_tb = shr( tmp_tb, 2 ); /*taking 2 guard bits so it's exponent tmp_sb_e=+2*/
- tmp_sb = shr( tmp_sb, 2 ); /*taking 2 guard bits so it's exponent tmp_tb_e=+2 */
- tmp_sb_e = add( tmp_sb_e, 2 );
- tmp_tb_e = add( tmp_tb_e, 2 );
-
- Word16 tmp0, tmp2, tmp3, tmp4;
- Word16 tmp0_e, tmp2_e, tmp3_e, tmp4_e;
- tmp0 = shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], 2 );
- tmp0_e = add( hPrivateData->prevSFB_FIR_TB_e[sfb], 2 );
- move16();
- tmp2 = shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], 2 );
- tmp2_e = add( hPrivateData->prevSFB_IIR_TB_e[sfb], 2 );
- move16();
- tmp3 = shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], 2 );
- tmp3_e = add( hPrivateData->prevSFB_FIR_SB_e[sfb], 2 );
- move16();
- tmp4 = shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], 2 );
- tmp4_e = add( hPrivateData->prevSFB_IIR_SB_e[sfb], 2 );
- move16();
- Word16 x1, x2;
-
- Word16 x1_e = BASOP_Util_Add_MantExp( tmp0, tmp0_e, tmp2, tmp2_e - 1, &x1 );
- Word16 x2_e = BASOP_Util_Add_MantExp( tmp3, tmp3_e, tmp4, tmp4_e - 1, &x2 );
- hPrivateData->sfb_tb_e[sfb] = BASOP_Util_Add_MantExp( tmp_tb, tmp_tb_e, x1, x1_e, &hPrivateData->SFM_tb_fx[sfb] ); // hPrivateData->sfb_sb_e[sfb]
- move16();
- BASOP_Util_Add_MantExp( 22118, 2, negate( hPrivateData->SFM_tb_fx[sfb] ), hPrivateData->sfb_tb_e[sfb], &tmp );
-
- IF( tmp < 0 )
- {
- hPrivateData->sfb_tb_e[sfb] = 2;
- hPrivateData->SFM_tb_fx[sfb] = 22118;
- move16();
- move16();
- }
-
- hPrivateData->sfb_sb_e[sfb] = BASOP_Util_Add_MantExp( tmp_sb, tmp_sb_e, x2, x2_e, &hPrivateData->SFM_sb_fx[sfb] ); // hPrivateData->sfb_tb_e[sfb]
- move16();
- BASOP_Util_Add_MantExp( 22118, 2, negate( hPrivateData->SFM_sb_fx[sfb] ), hPrivateData->sfb_sb_e[sfb], &tmp );
-
- IF( tmp < 0 )
- {
- hPrivateData->sfb_sb_e[sfb] = 2;
- hPrivateData->SFM_sb_fx[sfb] = 22118;
- move16();
- move16();
- }
-
- BASOP_Util_Add_MantExp( hPrivateData->SFM_sb_fx[sfb], hPrivateData->sfb_sb_e[sfb], negate( hPrivateData->SFM_tb_fx[sfb] ), hPrivateData->sfb_tb_e[sfb], &diffSFM );
-
- test();
- IF( diffSFM > 0 && LT_32( hPrivateData->SFM_tb_fx[sfb], L_shr( 3277 /*0.1 Q15*/, hPrivateData->sfb_tb_e[sfb] ) ) ) /* check whether target SFB is more tonal than source SFB */
- {
- Word16 currDampingFactor, dampingFactor;
- Word16 slope, threshold;
- Word16 alpha;
- Word16 slope_e, threshold_e, currDampingFactor_e, dampingFactor_e, alpha_e;
-
- /* calculate spectral tilt to detect sudden drops (or increases) in energy in the current SFB */
- // slope = IGF_getTilt_fx( pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1], e_ps, &slope_e );
-
- x = 1;
- mean_x_fx = mean_y_fx = 0;
- Word32 mean_y_fx_tmp = 0;
- move32();
- mean_xy_fx = mean_x2_fx = 0;
- mean_x_e = 15;
- mean_xy_e = mean_y_e = mean_x2_e = 31;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
-
- FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
- {
- mean_x_fx = add( mean_x_fx, x ); /*Q0*/
- mean_x2_fx = L_add( mean_x2_fx, L_mult0( x, x ) ); /*Q0*/
-
- /*y = 20.f * log10f( max( 1.f, powerSpectrum[i] ) );*/
- IF( LE_64( W_deposit32_l( pPowerSpectrum_fx[sb] ), W_shl( 1, ( sub( 31, e_ps[sb] ) ) ) ) )
- {
- y = 0;
- move16();
- }
- ELSE
- {
- y = imult1616( 20, extract_l( L_shr( Mult_32_16( ( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( e_ps[sb], Q25 ) ) ), INV_Log2_10_Q15 ), Q25 ) ) ); /*Q0*/
- }
- mean_y_fx_tmp = L_mac0( mean_y_fx_tmp, y, 1 ); /*Q0*/
- mean_xy_fx = L_add( mean_xy_fx, L_mult0( y, x ) ); /*Q0*/
-
- x = add( x, 1 );
- }
- mean_y_fx = BASOP_Util_Divide3216_Scale( mean_y_fx_tmp, width, &tmp_e ); /* mean_y_e*/
-
- mean_y_e = add( mean_y_e, sub( tmp_e, 15 ) );
- mean_x_fx = BASOP_Util_Divide1616_Scale( mean_x_fx, width, &tmp_e ); /* mean_x_e*/
- mean_x_e = add( mean_x_e, sub( tmp_e, 15 ) );
- mean_xy_fx = BASOP_Util_Divide3216_Scale( mean_xy_fx, width, &tmp_e ); /* mean_xy_e*/
- mean_xy_e = add( mean_xy_e, sub( tmp_e, 15 ) );
- mean_x2_fx = BASOP_Util_Divide3216_Scale( mean_x2_fx, width, &tmp_e ); /* mean_x2_e*/
- mean_x2_e = add( mean_x2_e, sub( tmp_e, 15 ) );
-
- /*slope = ( mean_xy - mean_x * mean_y ) / ( mean_x2 - mean_x * mean_x );*/
- slope = BASOP_Util_Divide3232_Scale( ( L_sub( mean_xy_fx, L_shl( mult( mean_x_fx, mean_y_fx ), sub( add( mean_x_e, mean_y_e ), mean_xy_e ) ) ) ), ( L_sub( mean_x2_fx, L_shl( mult( mean_x_fx, mean_x_fx ), sub( add( mean_x_e, mean_x_e ), mean_x2_e ) ) ) ), &slope_e );
- slope_e = add( slope_e, sub( mean_xy_e, mean_x2_e ) );
-
- /* determine whether strong tilt is due to a step in the spectrum (e.g. band limitation, no damping)
- or a tonal component close the band border (apply damping) by calculating SFM for a shift of 1/2 SFB width*/
- threshold = BASOP_Util_Divide1616_Scale( 60, width, &threshold_e );
-
- test();
- IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope, add( slope_e, 16 ), negate( threshold ), add( threshold_e, 16 ) ), -1 ) )
- {
- Word16 shift = shr( width, 1 );
- sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift, e_ps );
- crest = IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift, &crest_exp );
- shiftedSFM = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
- }
- ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope, add( slope_e, 16 ), threshold, add( threshold_e, 16 ) ), 1 ) && ( NE_16( sfb, sub( hGrid->sfbWrap[hGrid->nTiles], 1 ) ) ) )
- {
- Word16 shift = shr( width, 1 );
- shiftedSFM = BASOP_Util_Divide1616_Scale( IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, e_ps ), IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, &crest_exp ), &tmp_e );
- sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, e_ps );
- crest = IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, &crest_exp );
- shiftedSFM = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
- }
- shiftedSFM_e = add( shiftedSFM_e, sub( sfm_exp, crest_exp ) );
-
- IF( GT_32( shiftedSFM, L_shl( 1311 /*0.04f Q15*/, negate( shiftedSFM_e ) ) ) )
- {
- currDampingFactor = 32767; /*1.f Q15*/
- currDampingFactor_e = 0;
- move16();
- move16();
- }
- ELSE
- {
- // alpha = min( 320.f / (float) swb_offset[sfb + 1], 1.25f );
- temp = BASOP_Util_Divide1616_Scale( 320, swb_offset[sfb + 1], &alpha_e );
- alpha = extract_l( L_min( temp, L_shl( 20480 /*1.25 Q14*/, sub( 1, alpha_e ) ) ) ); // alpha_e
-
- // currDampingFactor = expf( 1.25f * alpha * logf( hPrivateData->SFM_tb[sfb] / hPrivateData->SFM_sb[sfb] ) );
- temp = BASOP_Util_Divide1616_Scale( hPrivateData->SFM_tb_fx[sfb], hPrivateData->SFM_sb_fx[sfb], &tmp_e ); // tmp_e
- tmp_e = add( tmp_e, sub( hPrivateData->sfb_tb_e[sfb], hPrivateData->sfb_sb_e[sfb] ) );
- Word16 temp1 = mult( 20480 /* 1.25f in Q14 */, alpha );
- Word16 tmp1_e = add( 1, alpha_e );
- currDampingFactor = round_fx( BASOP_util_Pow2( Mpy_32_16_1( L_add( BASOP_Util_Log2( temp ), L_shl_sat( add( 16, tmp_e ), 25 ) ), temp1 ), add( tmp1_e, 6 ), &currDampingFactor_e ) ); // currDampingFactor_e
-
- /* calculate tonal-to-noise ratio and reduce damping for low values*/
-
- Word32 tonalToNoise;
- Word16 adap;
- Word16 adap_e; /*stores exp for adap*/
- Word16 tonalToNoise_e; /*stores exponent for tonalToNoise*/
- tonalToNoise_e = 9;
- move16();
- adap = BASOP_Util_Divide1616_Scale( width, 40, &adap_e );
- tonalToNoise = IGF_getTNR_ivas_fx( pPowerSpectrum_fx, swb_offset[sfb], swb_offset[sfb + 1], adap, e_ps, adap_e ); /*Q22*/
-
- IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( tonalToNoise, tonalToNoise_e, L_add( L_shl( 10, sub( 15, adap_e ) ), adap ), add( 16, adap_e ) ), -1 ) )
- {
- // currDampingFactor += 0.03f * ( ( 10 + adap ) - tonalToNoise );
- Word32 temp2 = BASOP_Util_Add_Mant32Exp( L_add( L_shl( 10, sub( 15, adap_e ) ) /*exp:adap_e*/, adap ), add( adap_e, 16 ), L_negate( tonalToNoise ), tonalToNoise_e, &tmp_e ); // tmp_e
- currDampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor, currDampingFactor_e, extract_l( Mult_32_32( 983 /*0.03f Q15*/, temp2 ) ), tmp_e, &currDampingFactor ); // currDampingFactor_e
- }
- }
-
- Word32 L_tmp = hPrivateData->prevDampingFactor_IIR_fx[sfb];
- move32();
- L_tmp = L_shl( L_tmp, hPrivateData->prevDampingFactor_IIR_e[sfb] );
- test();
- test();
- IF( last_core_acelp || hPrivateData->wasTransient || EQ_32( L_tmp, MIN16B ) )
- {
- tmp = BASOP_Util_Cmp_Mant32Exp( currDampingFactor, currDampingFactor_e, 3277 /* 0.1f in Q15 */, 0 );
- IF( tmp >= 0 )
- {
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = currDampingFactor;
- hPrivateData->prevDampingFactor_IIR_e[sfb] = currDampingFactor_e;
- move16();
- move16();
- }
- ELSE
- {
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = 3277; /* 0.1 in Q15 */
- hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
- move16();
- move16();
- }
- }
- IF( last_core_acelp )
- {
- hPrivateData->dampingFactorSmoothing[sfb] = 2;
- move16();
- }
-
- dampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor, currDampingFactor_e, hPrivateData->prevDampingFactor_IIR_fx[sfb], hPrivateData->prevDampingFactor_IIR_e[sfb], &dampingFactor ); // dampingFactor_e
- dampingFactor = shr( dampingFactor, 1 );
-
- gain = Mult_32_16( gain, shl_sat( extract_l( L_min( L_add( dampingFactor, Mult_32_16( L_shl( hPrivateData->dampingFactorSmoothing[sfb], sub( 15, dampingFactor_e ) ) /*Q:15-dampingFactor_e*/, 3277 /*0.1f Q15*/ ) /*Q:15-dampingFactor_e*/ ), shl_sat( 1, sub( 15, dampingFactor_e ) ) ) ), dampingFactor_e ) /*Q15*/ );
-
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = dampingFactor;
- move16();
- hPrivateData->prevDampingFactor_IIR_e[sfb] = dampingFactor_e;
- move16();
- if ( hPrivateData->dampingFactorSmoothing[sfb] > 0 )
- {
- hPrivateData->dampingFactorSmoothing[sfb] = sub( hPrivateData->dampingFactorSmoothing[sfb], 1 );
- move16();
- }
- }
- ELSE
- {
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = MIN16B; // exponent : hPrivateData->prevDampingFactor_IIR_e[sfb]
- hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
- hPrivateData->dampingFactorSmoothing[sfb] = 1;
- move16();
- move16();
- move16();
- }
-
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = tmp_tb; // hPrivateData->prevSFB_FIR_TB_e[sfb]
- hPrivateData->prevSFB_FIR_TB_e[sfb] = tmp_tb_e;
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = hPrivateData->SFM_tb_fx[sfb]; // hPrivateData->prevSFB_IIR_TB_e[sfb]
- hPrivateData->prevSFB_IIR_TB_e[sfb] = hPrivateData->sfb_tb_e[sfb];
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = tmp_sb; // hPrivateData->prevSFB_FIR_SB_e[sfb]
- hPrivateData->prevSFB_FIR_SB_e[sfb] = tmp_sb_e;
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = hPrivateData->SFM_sb_fx[sfb]; // hPrivateData->prevSFB_IIR_SB_e[sfb]
- hPrivateData->prevSFB_IIR_SB_e[sfb] = hPrivateData->sfb_sb_e[sfb];
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- ELSE
- {
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_FIR_TB_e[sfb]
- hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
- hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
- hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_SB_e[sfb]
- hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = MIN16B; /* hPrivateData->prevDampingFactor_IIR_e[sfb]*/
- hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
- hPrivateData->dampingFactorSmoothing[sfb] = 2;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- }
- }
- ELSE
- {
- tmp_e = e_mdct;
- move16();
- sfbEnergyR = add_sat( EPSILON_FX, BASOP_Util_Divide3216_Scale( sum2_32_fx( pMDCTSpectrum_fx + swb_offset[sfb], width, &tmp_e ) /*exp: tmp_e*/, width, &sfbEnergyR_e ) ); // sfbEnergyR_e
- sfbEnergyR_e = add( sfbEnergyR_e, add( tmp_e, -15 ) );
- gain = L_shl( sfbEnergyR, 16 ); // gain_e
- move32();
- gain_e = sfbEnergyR_e;
-
- IF( element_mode > EVS_MONO )
- {
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_FIR_TB_e[sfb]
- hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
- hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
- hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_SB_e[sfb]
- hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = MIN16B; /* hPrivateData->prevDampingFactor_IIR_e[sfb]*/
- hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
- hPrivateData->dampingFactorSmoothing[sfb] = 2;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- }
-
- gain = Mult_32_16( gain, att ); // gain_e
- gain_e = add( gain_e, 0 );
-
- /*gain=0.5f+log2f(gain)*2+16 becuase 2.885390081777927f=2*1/loge(2) so 2*1/loge(2)*loge(x) can be written as 2*log2(x)*/
- gain = L_add( ONE_IN_Q22, L_add( L_add( L_shr( BASOP_Util_Log2( gain ), 1 ), L_shl( gain_e, Q24 ) ), L_shl( 16, Q23 ) ) ); /*Q23*/
- test();
- test();
- IF( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) )
- {
- gain = L_add( gain, ONE_IN_Q21 ); /* better preservation of original HF band energy */
- }
- test();
- test();
- IF( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_64000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_64000_CPE ) ) )
- {
- gain = L_add( gain, ONE_IN_Q20 );
- }
- gain = L_min( gain, 91 << Q23 ); /* 13+15+63, see arithcode encode residual */
- gain = L_max( gain, 0 );
- gain_e = 8; /* stores exponent for gain_fx*/
- move16();
- hPrivateData->igfScfQuantized[sfb] = extract_l( L_shr( gain, Q23 ) ); /*Q0*/
- move16();
- }
- }
-
- return;
-}
-
-/*-------------------------------------------------------------------*
- * IGF_CalculateStereoEnvelope_fx()
- *
- * envelope estimation
-
- *-------------------------------------------------------------------*/
-static void IGF_CalculateStereoEnvelope_fx(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
- const Word32 *pMDCTSpectrum_fx, /* i : MDCT spectrum */
- Word16 pMDCTSpectrum_e, /* i : exponent for pMDCTSpectrum_fx */
- const Word32 *pMDCTSpectrumMsInv_fx, /* i : MDCT spectrum */
- Word16 pMDCTSpectrumMsInv_e, /* i : expontent for pMDCTSpectrumMsInv_fx */
- const Word32 *pPowerSpectrum_fx, /* i : MDCT^2 + MDST^2 spectrum, or estimate */
- Word16 *pPowerSpectrum_e, /* i : exponent for pPowerSpectrum_fx */
- const Word32 *pPowerSpectrumMsInv_fx, /* i : inverse power spectrum */
- Word16 *q_pPowerSpectrumMsInv, /* i : Q for pPowerSpectrumMsInv_fx */
- const Word16 igfGridIdx, /* i : IGF grid index */
- const Word16 coreMsMask[N_MAX], /* i : line wise ms Mask */
- const Word16 isTransient, /* i : flag indicating if transient is detected */
- const Word16 last_core_acelp, /* i : indicator if last frame was ACELP core */
- const Word16 mct_on )
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
- H_IGF_GRID hGrid;
- Word16 *swb_offset;
- Word16 sfb; /* this is the actual scalefactor band */
- Word16 width; /* this is width in subbands of the actual scalefactor band */
- Word16 tile_idx;
- Word16 strt_cpy;
- Word32 gain_fx; /* the gain which has to be applied to the source tile to get the destination energy */
- Word16 sb;
- Word16 sfbEnergyR_fx;
- Word32 sfbEnergyC_fx; /* the energy of the destination region of the tile */
- Word32 sfbEnergyTileR_fx;
- Word32 sfbEnergyTileC_fx; /* the energy of the destination region of the tile */
- Word16 tmp, x, y;
- Word16 mean_x_fx, mean_y_fx;
- Word32 mean_xy_fx, mean_x2_fx;
- Word16 slope_fx;
- Word16 tmp_tb_fx;
- Word16 tmp_sb_fx;
- Word16 sfbCnt;
- Word32 tileSrcSpec_fx[MAX_IGF_SFB_LEN];
- Word16 sfm;
- Word16 crest;
- Word16 temp;
- Word16 mean_x_e, mean_y_e; /*Stores exponent for mean_x and mean_y respectively*/
- Word16 mean_xy_e, mean_x2_e; /*stores exponent for mean_xy and mean_x2 respectively*/
- Word16 tileSrcSpec_e[MAX_IGF_SFB_LEN]; /*Exponent for tileSrcSpec_fx*/
- Word16 sfbEnergyTileR_e; /*Exponent for sfbEnergyTileR_fx*/
- Word16 sfbEnergyTileC_e; /*Exponent for sfbEnergyTileC_fx*/
- Word16 sfbEnergyC_e; /*Exponent for sfbEnergyC_fx*/
- Word16 gain_e; /*exponent for gain_fx*/
- Word16 crest_exp; /*stores exponent for output from crest*/
- Word16 sfm_exp; /*stores exponent for ouput from sfm*/
- Word16 tmp_tb_e; /*Stores exponent for tmp_tb_fx*/
- Word16 tmp_sb_e; /*stores exponent for tmp_sb_fx*/
- Word16 slope_e; /*stores exponent for slope_fx*/
- Word16 sfbEnergyR_e; /*stores exponent for sfbEnergyR*/
- Word16 tmp_e;
- Word32 temp_pPowerSpectrumMsInv[N_MAX], length;
- Word16 q_temp_pPowerSpectrumMsInv = Q31, i;
- move16();
-
- IF( pPowerSpectrumMsInv_fx != NULL )
- {
- length = N_MAX;
- move16();
- if ( mct_on )
- {
- length = L_FRAME48k;
- move16();
- }
- FOR( i = 0; i < length; i++ )
- {
- IF( pPowerSpectrumMsInv_fx[i] != 0 )
- {
- q_temp_pPowerSpectrumMsInv = s_min( q_temp_pPowerSpectrumMsInv, add( q_pPowerSpectrumMsInv[i], norm_l( pPowerSpectrumMsInv_fx[i] ) ) );
- }
- }
- FOR( i = 0; i < length; i++ )
- {
- temp_pPowerSpectrumMsInv[i] = L_shl( pPowerSpectrumMsInv_fx[i], sub( q_temp_pPowerSpectrumMsInv, q_pPowerSpectrumMsInv[i] ) );
- move32();
- }
- }
-
- hPrivateData = &hIGFEnc->igfData;
- hGrid = &hPrivateData->igfInfo.grid[(Word16) igfGridIdx];
- swb_offset = hGrid->swb_offset;
- move16();
-
- IF( igfGridIdx != IGF_GRID_LB_NORM )
- {
- FOR( sfbCnt = 0; sfbCnt < sub( hGrid->sfbWrap[hGrid->nTiles], hGrid->sfbWrap[0] ); sfbCnt++ )
- {
- /* reset filter */
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_TB_e[sfbCnt]
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_TB_e[sfbCnt]
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_SB_e[sfbCnt]
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_SB_e[sfbCnt]
- hPrivateData->prevSFB_FIR_TB_e[sfbCnt] = 0;
- hPrivateData->prevSFB_IIR_TB_e[sfbCnt] = 0;
- hPrivateData->prevSFB_FIR_SB_e[sfbCnt] = 0;
- hPrivateData->prevSFB_IIR_SB_e[sfbCnt] = 0;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- }
-
- IF( pPowerSpectrum_fx )
- {
- FOR( sb = hGrid->sbWrap[0]; sb < swb_offset[hGrid->sfbWrap[hGrid->nTiles]]; sb++ )
- {
- /*hPrivateData->logSpec[sb] = max( 0, (Word16) ( logf( max( FLT_MIN, pPowerSpectrum[sb] ) ) * INV_LOG_2 ) );*/
- IF( LE_32( 1, pPowerSpectrum_fx[sb] ) )
- {
- hPrivateData->logSpec[sb] = s_max( 0, (Word16) L_shr( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( pPowerSpectrum_e[sb], Q25 ) ), 25 ) );
- }
- ELSE
- {
- hPrivateData->logSpec[sb] = 0; /*max(0,-126) is always 0*/
- }
- move16();
- }
- }
-
- FOR( tile_idx = 0; tile_idx < hGrid->nTiles; tile_idx++ )
- {
- strt_cpy = hGrid->sbWrap[tile_idx];
- move16();
-
- FOR( sfb = hGrid->sfbWrap[tile_idx]; sfb < hGrid->sfbWrap[tile_idx + 1]; sfb++ )
- {
- width = sub( swb_offset[sfb + 1], swb_offset[sfb] );
- sfbEnergyTileR_fx = EPSILON_FX;
- sfbEnergyTileC_fx = EPSILON_FX;
- sfbEnergyC_fx = EPSILON_FX;
- sfbEnergyTileR_e = 0;
- sfbEnergyTileC_e = 0;
- sfbEnergyC_e = 0;
- move16();
- move16();
- move16();
- move32();
- move32();
- move32();
- IF( pPowerSpectrum_fx )
- {
- Word16 final_exp;
- Word16 norm_exp;
- Word32 scaled_value;
- tmp = strt_cpy;
- move16();
-
- FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
- {
- IF( NE_16( coreMsMask[sb], coreMsMask[strt_cpy] ) )
- {
- sfbEnergyC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyC_fx, sfbEnergyC_e, pPowerSpectrum_fx[sb], pPowerSpectrum_e[sb], &sfbEnergyC_e ); /*resultant exponent is stored in sfbEnergyC_e*/
- norm_exp = norm_l( pMDCTSpectrumMsInv_fx[strt_cpy] );
- final_exp = sub( pMDCTSpectrumMsInv_e, norm_exp );
- scaled_value = L_shl( pMDCTSpectrumMsInv_fx[strt_cpy], norm_exp );
- sfbEnergyTileR_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR_fx, sfbEnergyTileR_e, Mult_32_32( scaled_value, scaled_value ), shl( final_exp, 1 ), &sfbEnergyTileR_e ); /*resultant exponent is stored in sfbEnergyTileR_e*/
- sfbEnergyTileC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileC_fx, sfbEnergyTileC_e, pPowerSpectrumMsInv_fx[strt_cpy], sub( 31, q_pPowerSpectrumMsInv[strt_cpy] ), &sfbEnergyTileC_e ); /*resultant exponent is stored in sfbEnergyTileC_e*/
- tileSrcSpec_fx[strt_cpy - tmp] = temp_pPowerSpectrumMsInv[strt_cpy]; /*resultant exponent is stored in tileSrcSpec_e*/
- tileSrcSpec_e[strt_cpy - tmp] = sub( 31, q_temp_pPowerSpectrumMsInv );
- }
- ELSE
- {
- sfbEnergyC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyC_fx, sfbEnergyC_e, pPowerSpectrum_fx[sb], pPowerSpectrum_e[sb], &sfbEnergyC_e ); /*resultant exponent is stored in sfbEnergyC_e*/
- norm_exp = norm_l( pMDCTSpectrum_fx[strt_cpy] );
- final_exp = sub( pMDCTSpectrum_e, norm_exp );
- scaled_value = L_shl( pMDCTSpectrum_fx[strt_cpy], norm_exp );
- sfbEnergyTileR_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR_fx, sfbEnergyTileR_e, Mult_32_32( scaled_value, scaled_value ), shl( final_exp, 1 ), &sfbEnergyTileR_e ); /*resultant exponent is stored in sfbEnergyTileR_e*/
- sfbEnergyTileC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileC_fx, sfbEnergyTileC_e, pPowerSpectrum_fx[strt_cpy], pPowerSpectrum_e[strt_cpy], &sfbEnergyTileC_e ); /*resultant exponent is stored in sfbEnergyTileC_e*/
- tileSrcSpec_fx[strt_cpy - tmp] = pPowerSpectrum_fx[strt_cpy]; /*resultant exponent is stored in tileSrcSpec_e*/
- tileSrcSpec_e[strt_cpy - tmp] = pPowerSpectrum_e[strt_cpy];
- }
- move32();
- move16();
- strt_cpy = add( strt_cpy, 1 );
- }
-
- sfbEnergyTileR_fx = BASOP_Util_Divide3216_Scale( sfbEnergyTileR_fx, width, &tmp_e );
- sfbEnergyTileR_e = sub( add( sfbEnergyTileR_e, tmp_e ), 15 ); /*stores the resultant exponent for sfbEnergyTileR_fx*/
-
- /*gain = (float) ( sfbEnergyTileR * ( sfbEnergyC / sfbEnergyTileC ) );*/
- temp = BASOP_Util_Divide3232_Scale( sfbEnergyC_fx, L_add( sfbEnergyTileC_fx, EPSILON_FX ), &tmp_e );
- gain_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) );
- gain_fx = Mult_32_16( sfbEnergyTileR_fx, temp );
- gain_e = add( 16, add( gain_e, sfbEnergyTileR_e ) ); /*stores the resultant exponent for gain_fx*/
-
- IF( !isTransient )
- {
- Word16 diffSFM_fx;
- Word16 shiftedSFM_fx;
- Word16 shiftedSFM_e; /*stores the resultant exponent for shiftedSFM_fx*/
- shiftedSFM_fx = 0;
- shiftedSFM_e = 0;
- move16();
- move16();
-
- // tmp_tb = IGF_getSFM_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]) / IGF_getCrest_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]);
- sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] );
- crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] );
- tmp_tb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e );
- tmp_tb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_tb_fx*/
-
- // tmp_sb = IGF_getSFM_ivas(tileSrcSpec, 0, strt_cpy - tmp) / IGF_getCrest_ivas(tileSrcSpec, 0, strt_cpy - tmp);
- sfm = IGF_getSFM_ivas_fx( &sfm_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) );
- crest = IGF_getCrest_ivas( &crest_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) );
- tmp_sb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e );
- tmp_sb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_sb_fx*/
-
- IF( last_core_acelp || hPrivateData->wasTransient )
- {
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = tmp_tb_fx; /*Exponent for hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] values stored in hPrivateData->sfb_tb_e[sfb] */
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = tmp_sb_fx; /*Exponent for hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] values stored in hPrivateData->sfb_sb_e[sfb]*/
- hPrivateData->prevSFB_FIR_TB_e[sfb] = tmp_sb_e;
- hPrivateData->prevSFB_IIR_TB_e[sfb] = tmp_sb_e;
- hPrivateData->prevSFB_FIR_SB_e[sfb] = tmp_sb_e;
- hPrivateData->prevSFB_IIR_SB_e[sfb] = tmp_sb_e;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- ELSE
- {
- /* Purpose of this block:
- -to make the exponent of hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] equal to that of tmp_tb_fx
- -to make the exponent of hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] equal to that of tmp_sb_fx
- */
- Word16 diff_sb_e; /*stores the difference of exponents for sb*/
- Word16 diff_tb_e; /*stores the difference of exponents for tb*/
- diff_sb_e = sub( tmp_sb_e, hPrivateData->sfb_sb_e[sfb] );
- diff_tb_e = sub( tmp_tb_e, hPrivateData->sfb_tb_e[sfb] );
- IF( LE_16( tmp_tb_e, hPrivateData->sfb_tb_e[sfb] ) )
- {
- tmp_tb_fx = shl( tmp_tb_fx, diff_tb_e );
- tmp_tb_e = hPrivateData->sfb_tb_e[sfb];
- move16();
- }
- ELSE
- {
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], diff_tb_e );
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], diff_tb_e );
- move16();
- move16();
- hPrivateData->prevSFB_FIR_TB_e[sfb] = tmp_tb_e;
- hPrivateData->prevSFB_IIR_TB_e[sfb] = tmp_tb_e;
- move16();
- move16();
- }
- IF( LE_16( tmp_sb_e, hPrivateData->sfb_sb_e[sfb] ) )
- {
- tmp_sb_fx = shl( tmp_sb_fx, diff_sb_e );
- tmp_sb_e = hPrivateData->sfb_sb_e[sfb];
- move16();
- }
- ELSE
- {
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], diff_sb_e );
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], diff_sb_e );
- move16();
- move16();
- hPrivateData->prevSFB_FIR_SB_e[sfb] = tmp_sb_e;
- hPrivateData->prevSFB_IIR_SB_e[sfb] = tmp_sb_e;
- move16();
- move16();
- }
- }
- tmp_tb_fx = shr_sat( tmp_tb_fx, sub( 2, tmp_tb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
- tmp_sb_fx = shr_sat( tmp_sb_fx, sub( 2, tmp_sb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
- hPrivateData->SFM_tb_fx[sfb] = add_sat( tmp_tb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_TB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_TB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
- hPrivateData->SFM_tb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_tb_fx[sfb] ); /* resultant exponent stored in hPrivateData->sfb_sb_e[sfb]*/
- hPrivateData->SFM_sb_fx[sfb] = add_sat( tmp_sb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_SB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_SB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
- hPrivateData->SFM_sb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_sb_fx[sfb] ); /*resultant exponent stores in hPrivateData->sfb_tb_e[sfb]*/
- move16();
- move16();
- move16();
- move16();
- hPrivateData->sfb_sb_e[sfb] = 2;
- hPrivateData->sfb_tb_e[sfb] = 2;
- move16();
- move16();
-
- diffSFM_fx = sub( hPrivateData->SFM_sb_fx[sfb], hPrivateData->SFM_tb_fx[sfb] ); /*Q13*/
-
- test();
- IF( diffSFM_fx > 0 && LT_16( hPrivateData->SFM_tb_fx[sfb], 819 /*0.1 Q13*/ ) ) /* check whether target SFB is more tonal than source SFB */
- {
- Word16 currDampingFactor_fx, dampingFactor_fx, alpha_fx;
- Word16 threshold_e, threshold_fx, alpha_e, currDampingFactor_e, dampingFactor_e;
- /* calculate spectral tilt to detect sudden drops (or increases) in energy in the current SFB */
- x = 1;
- mean_x_fx = mean_y_fx = 0;
- mean_xy_fx = mean_x2_fx = 0;
- mean_x_e = mean_y_e = 15;
- mean_xy_e = mean_x2_e = 31;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
- {
- mean_x_fx = add( mean_x_fx, x ); /*Q0*/
- mean_x2_fx = L_add( mean_x2_fx, L_mult0( x, x ) ); /*Q0*/
-
- /*y = 20 * (Word16) log10f( max( 1e-018f, pPowerSpectrum[sb] ) );*/
- IF( LT_32( pPowerSpectrum_fx[sb], 1 ) )
- {
- y = 20 * ( -18 );
- move16();
- }
- ELSE
- {
- y = imult1616( 20, extract_l( L_shr( Mult_32_16( ( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( pPowerSpectrum_e[sb], Q25 ) ) ), INV_Log2_10_Q15 ), 25 ) ) ); /*Q0*/
- }
- mean_y_fx = add( mean_y_fx, y ); /*Q0*/
- mean_xy_fx = L_add( mean_xy_fx, L_mult0( y, x ) ); /*Q0*/
-
- x = add( x, 1 );
- }
- mean_y_fx = BASOP_Util_Divide1616_Scale( mean_y_fx, width, &tmp_e ); /* resultant exp stores in mean_y_e*/
- mean_y_e = add( mean_y_e, sub( tmp_e, 15 ) );
- mean_x_fx = BASOP_Util_Divide1616_Scale( mean_x_fx, width, &tmp_e ); /* resultant exp stores in mean_x_e*/
- mean_x_e = add( mean_x_e, sub( tmp_e, 15 ) );
- mean_xy_fx = BASOP_Util_Divide3216_Scale( mean_xy_fx, width, &tmp_e ); /* resultant exp stores in mean_xy_e*/
- mean_xy_e = add( mean_xy_e, sub( tmp_e, 15 ) );
- mean_x2_fx = BASOP_Util_Divide3216_Scale( mean_x2_fx, width, &tmp_e ); /* resultant exp stores in mean_x2_e*/
- mean_x2_e = add( mean_x2_e, sub( tmp_e, 15 ) );
-
- /*slope = ( mean_xy - mean_x * mean_y ) / ( mean_x2 - mean_x * mean_x );*/
- slope_fx = BASOP_Util_Divide3232_Scale( ( L_sub( mean_xy_fx, L_shl( mult( mean_x_fx, mean_y_fx ), sub( add( mean_x_e, mean_y_e ), mean_xy_e ) ) ) ), ( L_sub( mean_x2_fx, L_shl( mult( mean_x_fx, mean_x_fx ), sub( add( mean_x_e, mean_x_e ), mean_x2_e ) ) ) ), &slope_e );
- slope_e = add( slope_e, sub( mean_xy_e, mean_x2_e ) ); /*stores resultant exponent for slope_fx*/
-
- /* determine whether strong tilt is due to a step in the spectrum (e.g. band limitation, no damping)
- or a tonal component close the band border (apply damping) by calculating SFM for a shift of 1/2 SFB width*/
- threshold_fx = BASOP_Util_Divide1616_Scale( 60, width, &threshold_e ); /*stores resultant exponent for threshold_fx*/
- test();
- IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope_fx, add( slope_e, 16 ), negate( threshold_fx ), add( threshold_e, 16 ) ), -1 ) )
- {
- Word16 shift = shr( width, 1 );
- // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift );
- sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) );
- crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) );
- shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
- }
- ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope_fx, add( slope_e, 16 ), threshold_fx, add( threshold_e, 16 ) ), 1 ) && ( NE_16( sfb, sub( hGrid->sfbWrap[hGrid->nTiles], 1 ) ) ) )
- {
- Word16 shift;
- shift = shr( width, 1 );
- // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift );
- sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) );
- crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) );
- shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
- }
- IF( shiftedSFM_fx )
- {
- shiftedSFM_e = add( shiftedSFM_e, sub( sfm_exp, crest_exp ) ); /* stores resultant exponent for shiftedSFM_fx*/
- }
-
- // alpha = min( 320.f / (float) swb_offset[sfb + 1], 1.25f );
- temp = BASOP_Util_Divide1616_Scale( 320, swb_offset[sfb + 1], &alpha_e );
- alpha_fx = extract_l( L_min( temp, L_shl( 20480 /*1.25 Q14*/, sub( 1, alpha_e ) ) ) ); /* exponent is alpha_e*/
- temp = BASOP_Util_Divide1616_Scale( hPrivateData->SFM_tb_fx[sfb], hPrivateData->SFM_sb_fx[sfb], &tmp_e );
- tmp_e = add( tmp_e, sub( hPrivateData->sfb_tb_e[sfb], hPrivateData->sfb_sb_e[sfb] ) ); /* stores resultant exponent for temp */
-
- // currDampingFactor = expf( alpha * logf( hPrivateData->SFM_tb[sfb] / hPrivateData->SFM_sb[sfb] ) );
- currDampingFactor_fx = round_fx( BASOP_util_Pow2( Mpy_32_16_1( L_add( BASOP_Util_Log2( temp ), L_shl( add( 16, tmp_e ), 25 ) ), alpha_fx ), add( alpha_e, 6 ), &currDampingFactor_e ) ); /*exp is currDampingFactor_e*/
-
- IF( GT_32( shiftedSFM_fx, L_shl( 1311 /*0.04f Q15*/, negate( shiftedSFM_e ) ) ) )
- {
- currDampingFactor_fx = 32767; /*1.f Q15*/
- currDampingFactor_e = 0;
- move16();
- move16();
- }
- test();
- test();
- IF( last_core_acelp || hPrivateData->wasTransient || EQ_32( hPrivateData->prevDampingFactor_IIR_fx[sfb], L_shl( -1, sub( 15, hPrivateData->prevDampingFactor_IIR_e[sfb] ) ) ) )
- {
- tmp = BASOP_Util_Cmp_Mant32Exp( currDampingFactor_fx, currDampingFactor_e, 3277, 0 );
- IF( tmp >= 0 )
- {
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = currDampingFactor_fx;
- hPrivateData->prevDampingFactor_IIR_e[sfb] = currDampingFactor_e;
- }
- ELSE
- {
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = 3277; /* 0.1 in Q15 */
- hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
- }
-
- move16();
- move16();
- }
-
- {
- Word32 tonalToNoise;
- Word16 adap;
- Word16 adap_e; /*stores exp for adap*/
- Word16 tonalToNoise_e; /*stores exponent for tonalToNoise*/
- tonalToNoise_e = 9; /*stores exponent for tonalToNoise*/
- move16();
- adap = BASOP_Util_Divide1616_Scale( width, 30, &adap_e );
- tonalToNoise = IGF_getTNR_ivas_fx( pPowerSpectrum_fx, swb_offset[sfb], swb_offset[sfb + 1], adap, pPowerSpectrum_e, adap_e ); /*Q22*/
- IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( tonalToNoise, tonalToNoise_e, L_add( L_shl( 10, sub( 15, adap_e ) ), adap ), add( 16, adap_e ) ), -1 ) )
- {
- // currDampingFactor += 0.1f * ( ( 10 + adap ) - tonalToNoise );
- Word32 temp2 = BASOP_Util_Add_Mant32Exp( L_add( L_shl( 10, sub( 15, adap_e ) ) /*exp:adap_e*/, adap ), add( adap_e, 16 ), L_negate( tonalToNoise ), tonalToNoise_e, &tmp_e ); /* resultant exp is tmp_e*/
- currDampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor_fx, currDampingFactor_e, extract_l( Mult_32_16( temp2, 3277 /*0.1f Q15*/ ) ), tmp_e, &currDampingFactor_fx ); /*stores resultant exp for currDampingFactor_fx*/
- }
- }
-
- dampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor_fx, currDampingFactor_e, hPrivateData->prevDampingFactor_IIR_fx[sfb], hPrivateData->prevDampingFactor_IIR_e[sfb], &dampingFactor_fx );
- dampingFactor_fx = shr( dampingFactor_fx, 1 ); /* resultant exponent is dampingFactor_e*/
- IF( NE_16( BASOP_Util_Cmp_Mant32Exp( dampingFactor_fx, add( dampingFactor_e, 16 ), shr( hPrivateData->prevDampingFactor_IIR_fx[sfb], 1 ), add( hPrivateData->prevDampingFactor_IIR_e[sfb], 16 ) ), -1 ) )
- {
- // do nothing
- }
- ELSE
- {
- dampingFactor_fx = shr( hPrivateData->prevDampingFactor_IIR_fx[sfb], 1 ); /* resultant exponent is hPrivateData->prevDampingFactor_IIR_e[sfb]*/
- dampingFactor_e = hPrivateData->prevDampingFactor_IIR_e[sfb];
- move16();
- }
- IF( dampingFactor_e < 0 )
- {
- dampingFactor_fx = shl( dampingFactor_fx, dampingFactor_e );
- dampingFactor_e = 0;
- move16();
- }
- gain_fx = Mult_32_16( gain_fx, shl_sat( extract_l( L_min( L_add( dampingFactor_fx, Mult_32_16( L_shl( hPrivateData->dampingFactorSmoothing[sfb], sub( 15, dampingFactor_e ) ) /*Q:15-dampingFactor_e*/, 3277 /*0.1f Q15*/ ) /*Q:15-dampingFactor_e*/ ), shl_sat( 1, sub( 15, dampingFactor_e ) ) ) ), dampingFactor_e ) /*Q15*/ );
-
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = dampingFactor_fx;
- hPrivateData->prevDampingFactor_IIR_e[sfb] = dampingFactor_e;
- move16();
- move16();
- if ( hPrivateData->dampingFactorSmoothing[sfb] > 0 )
- {
- hPrivateData->dampingFactorSmoothing[sfb] = sub( hPrivateData->dampingFactorSmoothing[sfb], 1 );
- move16();
- }
- }
- ELSE
- {
- hPrivateData->prevDampingFactor_IIR_fx[sfb] = -( 1 << 15 ); /* resultant exp which is 0 stores in hPrivateData->prevDampingFactor_IIR_e[sfb]*/
- hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
- hPrivateData->dampingFactorSmoothing[sfb] = 1;
- move16();
- move16();
- move16();
- }
-
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = tmp_tb_fx;
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = hPrivateData->SFM_tb_fx[sfb];
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = tmp_sb_fx;
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = hPrivateData->SFM_sb_fx[sfb];
- hPrivateData->prevSFB_FIR_TB_e[sfb] = hPrivateData->sfb_tb_e[sfb];
- hPrivateData->prevSFB_IIR_TB_e[sfb] = hPrivateData->sfb_tb_e[sfb];
- hPrivateData->prevSFB_FIR_SB_e[sfb] = hPrivateData->sfb_sb_e[sfb];
- hPrivateData->prevSFB_IIR_SB_e[sfb] = hPrivateData->sfb_sb_e[sfb];
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- ELSE
- {
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0;
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0;
- hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
- hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
- hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
- hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
-
- hPrivateData->dampingFactorSmoothing[sfb] = 2;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- }
- ELSE
- {
- tmp_e = pMDCTSpectrum_e;
- sfbEnergyR_fx = add_sat( EPSILON_FX, BASOP_Util_Divide3216_Scale( sum2_32_fx( pMDCTSpectrum_fx + swb_offset[sfb], width, &tmp_e ) /*exp: tmp_e*/, width, &sfbEnergyR_e ) );
- sfbEnergyR_e = add( sfbEnergyR_e, add( tmp_e, -15 ) ); /* stores resultant exponent for sfbEnergyR_fx*/
- gain_fx = sfbEnergyR_fx; /*resultant exponent stored in gain_e=sfbEnergyR_e*/
- move32();
- gain_e = add( sfbEnergyR_e, 16 ); /* because gain_fx is word32;only after adding 16 q of gain_fx is 15-sfbEnergyR_e*/
-
- hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0;
- hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0;
- hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0;
- hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
- hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
- hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
- hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- }
- /*gain=0.5f+log2f(gain)*2+16 becuase 2.885390081777927f=2*1/loge(2) so 2*1/loge(2)*loge(x) can be written as 2*log2(x)*/
- gain_fx = L_add( ONE_IN_Q22, L_add( L_add( L_shr( BASOP_Util_Log2( gain_fx ), 1 ), L_shl( gain_e, Q24 ) ), L_shl( 16, Q23 ) ) ); /*Q23*/
- test();
- test();
- if ( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) )
- {
- gain_fx = L_add( gain_fx, ONE_IN_Q21 ); /* better preservation of original HF band energy */
- }
- test();
- test();
- if ( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_64000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_64000_CPE ) ) )
- {
- gain_fx = L_add( gain_fx, ONE_IN_Q20 );
- }
- gain_fx = L_min( gain_fx, 91 << Q23 ); /* 13+15+63, see arithcode encode residual */
- gain_fx = L_max( gain_fx, 0 );
- gain_e = 8; /* stores exponent for gain_fx*/
- move16();
- hPrivateData->igfScfQuantized[sfb] = (Word16) ( L_shr( gain_fx, 23 ) ); /*Q0*/
- move16();
- }
- }
-
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_WriteEnvelope()
- *
- * writes IGF SCF values
- *-------------------------------------------------------------------*/
-/*! r: number of bits writen */
-static Word16 IGF_WriteEnvelope(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /* i : ptr to bitOffset counter */
- const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
- const Word16 isIndepFlag, /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */
- Word16 *igfAllZero /* i : returns 1 if all IGF scfs are zero, else 0 */
-)
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
- H_IGF_GRID hGrid;
- Word16 sfb;
- Word16 totBitCount;
- Word16 startBitCount;
-
- startBitCount = *pBitOffset;
- totBitCount = 0;
- *igfAllZero = 1;
- move16();
- move16();
- move16();
- hPrivateData = &hIGFEnc->igfData;
- hGrid = &hPrivateData->igfInfo.grid[igfGridIdx];
-
- FOR( sfb = hGrid->startSfb; sfb < hGrid->stopSfb; sfb++ )
- {
- IF( hPrivateData->igfScfQuantized[sfb] != 0 )
- {
- *igfAllZero = 0;
- move16();
- BREAK;
- }
- }
-
- IF( *igfAllZero != 0 )
- {
- IGF_write_bit_fx( hBstr, pBitOffset, 1 );
-
- if ( NULL == hBstr )
- {
- IGFSCFEncoderSaveContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
- }
-
- IGFSCFEncoderReset_fx( &hPrivateData->hIGFSCFArithEnc );
-
- if ( NULL == hBstr )
- {
- IGFSCFEncoderRestoreContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
- }
- }
- ELSE
- {
- IGF_write_bit_fx( hBstr, pBitOffset, 0 );
-
- if ( NULL == hBstr )
- {
- IGFSCFEncoderSaveContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
- }
-
- *pBitOffset = IGFSCFEncoderEncode_ivas_fx( &hPrivateData->hIGFSCFArithEnc, hBstr, *pBitOffset, &hPrivateData->igfScfQuantized[hGrid->startSfb], igfGridIdx, isIndepFlag );
- move16();
-
- if ( NULL == hBstr )
- {
- IGFSCFEncoderRestoreContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
- }
- }
- totBitCount = sub( *pBitOffset, startBitCount );
-
- return totBitCount;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_Whitening()
- *
- * calculates the IGF whitening levels by SFM and crest
- *-------------------------------------------------------------------*/
-static void IGF_Whitening_ivas_fx(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : | instance handle of IGF Encoder */
- Word32 *powerSpectrum, /* i : Q31 | MDCT/MDST power spectrum */
- Word16 *powerSpectrum_e, /* i : Q31 | MDCT/MDST power spectrum */
- const Word16 igfGridIdx, /* i : Q0 | IGF grid index */
- const Word16 isTransient, /* i : Q0 | flag indicating if transient is detected */
- const Word16 last_core_acelp, /* i : Q0 | indicator if last frame was ACELP core */
- const Word16 isTNSActive, /* i : Q0 | indicator if TNS is active */
- const Word16 sp_aud_decision0, /* i : Q0 | first stage classifier decision */
- const Word32 brate, /* i : Q0 | bitrate */
- const Word16 element_mode /* i : Q0 | element mode */
-)
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
- H_IGF_GRID hGrid;
- Word16 p; /*Q0*/
- Word16 tmp;
- Word16 tmp_e;
- Word16 SFM_src;
- Word16 SFM_tar;
- Word16 SFM_src_e;
- Word16 SFM_tar_e;
- Word16 num_Tiles;
- Word16 SFM;
- Word16 crest_e;
-
- SFM = -ONE_IN_Q13; /*1.0f Q13*/
- move16();
-
- hPrivateData = &hIGFEnc->igfData;
- hGrid = &hPrivateData->igfInfo.grid[(Word16) igfGridIdx];
-
- IF( NE_16( igfGridIdx, IGF_GRID_LB_NORM ) )
- {
- FOR( p = 0; p < hGrid->nTiles; p++ )
- {
- /* reset filter */
- hPrivateData->prevSFM_FIR[p] = L_deposit_l( 0 );
- hPrivateData->prevSFM_IIR[p] = 0;
- move16();
-
- /* preset values: */
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
- move16();
- }
- }
-
- FOR( p = 0; p < IGF_MAX_TILES; p++ )
- {
- /* update prev data: */
- hPrivateData->igfPrevWhiteningLevel[p] = hPrivateData->igfCurrWhiteningLevel[p];
- /* preset values: */
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
- move16();
- move16();
- }
-
- test();
- IF( !( isTransient || hPrivateData->wasTransient ) )
- {
- IF( powerSpectrum )
- {
- FOR( p = 0; p < hGrid->nTiles; p++ )
- {
- Word16 sb;
-
- IF( isTNSActive )
- {
- FOR( sb = hGrid->tile[p]; sb < hGrid->tile[p + 1]; sb++ )
- {
- IF( LT_32( powerSpectrum[sb], 1 ) )
- hPrivateData->logSpec[sb] = 0; /* max(0,FLT_MIN_EXP )*/
- ELSE
- hPrivateData->logSpec[sb] = extract_l( L_max( 0, L_shr( L_add( BASOP_Util_Log2( powerSpectrum[sb] ), L_shl( powerSpectrum_e[sb], Q25 ) ), Q25 ) ) );
- move16();
- }
- }
-
- /* if current tile contains only a single SFB, reuse already computed SFM values */
- test();
- IF( element_mode > EVS_MONO && EQ_16( sub( hGrid->sfbWrap[p + 1], hGrid->sfbWrap[p] ), 1 ) )
- {
- tmp = hPrivateData->SFM_tb_fx[p];
- tmp_e = hPrivateData->sfb_tb_e[p];
- move16();
- move16();
- }
- ELSE
- {
- tmp = BASOP_Util_Divide1616_Scale( IGF_getSFM_new_fx( powerSpectrum, hPrivateData->logSpec, hGrid->tile[p], hGrid->tile[p + 1], powerSpectrum_e ), IGF_getCrest_new_fx( hPrivateData->logSpec, hGrid->tile[p], hGrid->tile[p + 1], &crest_e ), &tmp_e );
- tmp_e = sub( tmp_e, crest_e );
- }
-
- test();
- IF( last_core_acelp || hPrivateData->wasTransient )
- {
- hPrivateData->prevSFM_FIR[p] = L_shl( tmp, add( 1, tmp_e ) ); /*16-(15-exp)=>15Q16*/
- hPrivateData->prevSFM_IIR[p] = shl( tmp, sub( tmp_e, 2 ) ); /*13-(15-exp)=>2Q13*/
- move32();
- move16();
- }
-
- test();
- IF( LE_32( brate, IVAS_48k ) && EQ_16( element_mode, IVAS_CPE_MDCT ) )
- {
- Word16 temp;
- num_Tiles = 0;
- SFM_src = 0;
- SFM_tar = 0;
- SFM_src_e = 0;
- SFM_tar_e = 0;
- move16();
- move16();
- move16();
- move16();
- move16();
-
- FOR( sb = hGrid->sfbWrap[p]; sb < hGrid->sfbWrap[p + 1]; sb++ )
- {
- num_Tiles = add( num_Tiles, 1 );
- SFM_src_e = BASOP_Util_Add_MantExp( hPrivateData->SFM_sb_fx[sb], hPrivateData->sfb_sb_e[sb], SFM_src, SFM_src_e, &SFM_src );
- SFM_tar_e = BASOP_Util_Add_MantExp( hPrivateData->SFM_tb_fx[sb], hPrivateData->sfb_tb_e[sb], SFM_tar, SFM_tar_e, &SFM_tar );
- }
-
- /* compute the average */
- SFM_src = shr( BASOP_Util_Divide1616_Scale( SFM_src, num_Tiles, &temp ), 2 );
- SFM_src_e = add( SFM_src_e, sub( temp, 13 ) ); /*temp-15+2:because right shifted by 2 which are the guard bits*/
- SFM_tar = shr( BASOP_Util_Divide1616_Scale( SFM_tar, num_Tiles, &temp ), 2 );
- SFM_tar_e = add( SFM_tar_e, sub( temp, 13 ) ); /*temp-15+2:because right shifted by 2 which are the guard bits*/
-
- IF( LT_16( SFM_tar_e, SFM_src_e ) )
- {
- SFM_tar = shl( SFM_tar, sub( SFM_tar_e, SFM_src_e ) ); /*making the q for SFM_tar and SFM_src equal with 2 as guard bits*/
- SFM_tar_e = SFM_src_e;
- }
- ELSE
- {
- SFM_src = shr( SFM_src, sub( SFM_tar_e, SFM_src_e ) ); /*making the q for SFM_tar and SFM_src equal with 2 as guard bits*/
- SFM_src_e = SFM_tar_e;
- }
- move16();
-
- test();
- test();
- IF( ( p > 0 ) && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) )
- {
- test();
- if ( EQ_16( p, 1 ) && EQ_16( abs_s( sub( hPrivateData->igfCurrWhiteningLevel[0], hPrivateData->igfCurrWhiteningLevel[1] ) ), 2 ) ) /* OFF vs. STRONG */
- {
- hPrivateData->igfCurrWhiteningLevel[0] = IGF_WHITENING_MID;
- move16();
- }
- hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfCurrWhiteningLevel[p - 1];
- move16();
- }
- ELSE IF( sp_aud_decision0 )
- {
- /* Music */
- /* whitening Off: when tonality of target is more than source or tonality of target is close to that of source */
- test();
- if ( LE_16( SFM_tar, SFM_src ) || LE_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
- move16();
- }
-
- /* whitening mid: */
- test();
- if ( GT_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) && LE_32( SFM_tar, L_add( SFM_src, L_shl( 5, sub( 13, SFM_src_e ) ) /*1.25 with exponent SFM_src_e*/ ) ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
- move16();
- }
-
- /* whitening strong */
- if ( GT_32( SFM_tar, L_add( SFM_src, L_shl( 5, sub( 13, SFM_src_e ) ) /*1.25 with exponent SFM_src_e*/ ) ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_STRONG;
- move16();
- }
- }
- ELSE
- {
- /* Speech */
- /* whitening Off: when tonality of target is more than source or tonality of target is close to that of source */
- test();
- if ( LE_16( SFM_tar, SFM_src ) || LE_32( SFM_tar, L_add( SFM_src, L_shr( 3277 /*0.1 Q15*/, SFM_src_e ) ) ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
- move16();
- }
-
- /* whitening mid: */
- test();
- if ( GT_32( SFM_tar, L_add( SFM_src, L_shr( 3277 /*0.1 Q15*/, SFM_src_e ) ) ) && LE_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
- move16();
- }
-
- /* whitening strong */
- if ( GT_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_STRONG;
- move16();
- }
- }
-
- SFM = shl( SFM_tar, sub( SFM_tar_e, 2 ) ); /*2Q13*/
- }
- ELSE
- {
- test();
- IF( element_mode > EVS_MONO && EQ_16( sub( hGrid->sfbWrap[p + 1], hGrid->sfbWrap[p] ), 1 ) )
- {
- SFM = shl( tmp, sub( tmp_e, 2 ) ); /*2Q13*/
- }
- ELSE
- {
- Word32 temp;
- temp = L_add( L_shl( tmp, sub( tmp_e, 2 ) ), L_add( L_shr( hPrivateData->prevSFM_FIR[p], 3 ), L_shr( hPrivateData->prevSFM_IIR[p], 1 ) ) );
- SFM = extract_l( L_min( 22118 /*2.7*/, temp ) ); /*2Q13*/
- }
- hPrivateData->prevSFM_FIR[p] = L_shl( tmp, add( 1, tmp_e ) ); /*15Q16*/
- hPrivateData->prevSFM_IIR[p] = SFM;
- move32();
- move16();
-
- IF( GT_16( SFM, hGrid->whiteningThreshold[1][p] ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_STRONG;
- move16();
- }
- ELSE IF( GT_16( SFM, hGrid->whiteningThreshold[0][p] ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
- move16();
- }
- ELSE
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
- move16();
- }
- }
-
- IF( element_mode > EVS_MONO )
- {
- IF( last_core_acelp ) /* reset */
- {
- set16_fx( hPrivateData->igfPastSFM_fx[p], -ONE_IN_Q13, IGF_PAST_SFM_LEN );
- hPrivateData->igfWhiteningHangoverCnt[p] = 2;
- move16();
- }
- ELSE
- {
- test();
- test();
- test();
- test();
- /* check whether change in whitening level should be allowed or not (if SFM is inside a certain margin around thresholds) */
- IF( NE_16( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] ) &&
- ( ( GT_32( SFM, L_sub( hGrid->whiteningThreshold[0][p], 1229 /*0.15f Q13*/ ) ) && LT_32( SFM, L_add( hGrid->whiteningThreshold[0][p], 1229 ) ) ) ||
- ( GT_32( SFM, L_sub( hGrid->whiteningThreshold[1][p], 1229 ) ) && LT_32( SFM, L_add( hGrid->whiteningThreshold[1][p], 1229 ) ) ) ) )
- {
- Word16 mean_past_SFM;
- Word16 mean_past_SFM_e;
- Word16 countable;
- Word16 i;
- mean_past_SFM = 0;
- mean_past_SFM_e = 0;
- countable = 0;
- move16();
- move16();
- move16();
-
- /* compute mean of last (available) SFM values */
- FOR( i = 0; i < IGF_PAST_SFM_LEN; i++ )
- {
- IF( hPrivateData->igfPastSFM_fx[p][i] >= 0 )
- {
- mean_past_SFM_e = BASOP_Util_Add_MantExp( mean_past_SFM, mean_past_SFM_e, hPrivateData->igfPastSFM_fx[p][i], 2, &mean_past_SFM );
- countable = add( countable, 1 );
- }
- }
- IF( countable )
- {
- Word16 temp;
- mean_past_SFM = BASOP_Util_Divide1616_Scale( mean_past_SFM, countable, &temp );
- mean_past_SFM_e = add( mean_past_SFM_e, sub( temp, 15 ) );
- mean_past_SFM = shl( mean_past_SFM, sub( mean_past_SFM_e, 2 ) ); /*mean_past_SFM_e=2*/
- /* deny change in whitening level for small deviations from mean SFM */
- if ( LT_16( abs_s( sub( SFM, mean_past_SFM ) ), 1638 ) /*0.2 in Q13*/ )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfPrevWhiteningLevel[p];
- move16();
- }
- }
- }
- }
-
- hPrivateData->igfPastSFM_fx[p][hPrivateData->igfPastSFM_pos] = SFM; /*2Q13*/
- move16();
- }
- }
-
- SWITCH( hPrivateData->igfInfo.bitRateIndex )
- {
- case IGF_BITRATE_WB_9600:
- case IGF_BITRATE_RF_WB_13200:
- case IGF_BITRATE_WB_13200_CPE:
- case IGF_BITRATE_WB_16400_CPE:
- case IGF_BITRATE_RF_SWB_13200:
- case IGF_BITRATE_SWB_9600:
- case IGF_BITRATE_SWB_13200_CPE:
- case IGF_BITRATE_SWB_16400:
- case IGF_BITRATE_SWB_24400:
- case IGF_BITRATE_SWB_24400_CPE:
- case IGF_BITRATE_SWB_32000_CPE:
- case IGF_BITRATE_SWB_32000:
- case IGF_BITRATE_FB_16400:
- case IGF_BITRATE_FB_24400:
- case IGF_BITRATE_FB_24400_CPE:
- case IGF_BITRATE_FB_32000_CPE:
- case IGF_BITRATE_FB_32000:
- hPrivateData->igfCurrWhiteningLevel[hGrid->nTiles - 1] = hPrivateData->igfCurrWhiteningLevel[hGrid->nTiles - 2];
- move16();
- break;
- default:
- break;
- }
- }
- ELSE
- {
- FOR( p = 0; p < hGrid->nTiles; p++ )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
- move16();
- }
- }
- }
- ELSE
- {
- /* reset filter */
- FOR( p = 0; p < IGF_MAX_TILES; p++ )
- {
- hPrivateData->prevSFM_FIR[p] = L_deposit_l( 0 );
- hPrivateData->prevSFM_IIR[p] = 0;
- move32();
- move16();
- }
- }
-
- IF( element_mode > EVS_MONO )
- {
- IF( EQ_16( SFM, -ONE_IN_Q13 /*1.0f 2Q13*/ ) ) /* reset */
- {
- FOR( p = 0; p < hGrid->nTiles; p++ )
- {
- set16_fx( hPrivateData->igfPastSFM_fx[p], -ONE_IN_Q13, IGF_PAST_SFM_LEN );
- hPrivateData->igfWhiteningHangoverCnt[p] = 2;
- move16();
- }
- }
-
- /* vibrato handling */
- FOR( p = 0; p < hGrid->nTiles; p = p + 2 )
- {
- test();
- test();
- test();
- IF( ( hPrivateData->igfPrevWhiteningLevel[p] == IGF_WHITENING_OFF && hPrivateData->igfCurrWhiteningLevel[p] != IGF_WHITENING_OFF ) ||
- ( hPrivateData->igfPrevWhiteningLevel[p + 1] == IGF_WHITENING_OFF && hPrivateData->igfCurrWhiteningLevel[p + 1] != IGF_WHITENING_OFF ) )
- {
- Word16 i;
- Word16 pastSfm_a[4], pastSfm_b[4];
- Word16 pastSfmDiffSum_a, pastSfmDiffSum_b;
-
- FOR( i = 0; i < 4; i++ )
- {
- pastSfm_a[i] = hPrivateData->igfPastSFM_fx[p][add( hPrivateData->igfPastSFM_pos, sub( 4, i ) ) % IGF_PAST_SFM_LEN];
- pastSfm_b[i] = hPrivateData->igfPastSFM_fx[p + 1][add( hPrivateData->igfPastSFM_pos, sub( 4, i ) ) % IGF_PAST_SFM_LEN];
- move16();
- move16();
- }
- pastSfmDiffSum_a = pastSfmDiffSum_b = 0;
- move16();
- move16();
- FOR( i = 0; i < 3; i++ )
- {
- IF( NE_16( pastSfm_a[i + 1], -ONE_IN_Q13 ) )
- {
- pastSfmDiffSum_a = add( pastSfmDiffSum_a, sub( pastSfm_a[i], pastSfm_a[i + 1] ) );
- pastSfmDiffSum_b = add( pastSfmDiffSum_b, sub( pastSfm_b[i], pastSfm_b[i + 1] ) );
- }
- ELSE
- {
- break;
- }
- }
- test();
- test();
- test();
- test();
- /* if tonality oscillates between two tiles, turn whitening off in both */
- IF( ( ( pastSfmDiffSum_a > 0 && pastSfmDiffSum_b < 0 ) ||
- ( pastSfmDiffSum_a < 0 && pastSfmDiffSum_b > 0 ) ) &&
- ( GT_32( L_abs( L_sub( pastSfmDiffSum_a, pastSfmDiffSum_b ) ), ONE_IN_Q12 /* 0.5 in Q13 */ ) ) )
- {
- hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfCurrWhiteningLevel[p + 1] = IGF_WHITENING_OFF;
- move16();
- move16();
- }
- }
- }
-
- /* hangover */
- FOR( p = 0; p < hGrid->nTiles; p++ )
- {
- IF( NE_16( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] ) )
- {
- hPrivateData->igfWhiteningHangoverCnt[p] = add( hPrivateData->igfWhiteningHangoverCnt[p], 1 );
- IF( EQ_16( hPrivateData->igfWhiteningHangoverCnt[p], 3 ) )
- {
- hPrivateData->igfWhiteningHangoverCnt[p] = 0;
- }
- ELSE
- {
- hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfPrevWhiteningLevel[p];
- }
- move16();
- move16();
- }
- ELSE
- {
- hPrivateData->igfWhiteningHangoverCnt[p] = 0;
- move16();
- }
- }
-
- hPrivateData->igfPastSFM_pos = add( hPrivateData->igfPastSFM_pos, 1 ) % IGF_PAST_SFM_LEN;
- move16();
- }
-
- hPrivateData->wasTransient = isTransient;
- move16();
-
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_WriteWhiteningTile_fx()
- *
- * write whitening levels into bitstream
- *-------------------------------------------------------------------*/
-
-/*! r: number of bits written */
-static Word16 IGF_WriteWhiteningTile_fx( /**< out: Q0 | number of bits written */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
- Word16 whiteningLevel /**< in: Q0 | whitening levels to write */
-)
-{
- Word16 totBitCount;
- Word16 startBitCount;
-
- totBitCount = 0;
- startBitCount = *pBitOffset;
- move16();
- move16();
-
- IF( EQ_32( whiteningLevel, IGF_WHITENING_MID ) )
- {
- IGF_write_bits( hBstr, pBitOffset, 0, 1 );
- }
- ELSE
- {
- IGF_write_bits( hBstr, pBitOffset, 1, 1 );
- IF( whiteningLevel == IGF_WHITENING_OFF )
- {
- IGF_write_bits( hBstr, pBitOffset, 0, 1 );
- }
- ELSE
- {
- IGF_write_bits( hBstr, pBitOffset, 1, 1 );
- }
- }
- totBitCount = sub( *pBitOffset, startBitCount );
-
- return totBitCount;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_WriteWhiteningLevels_fx()
- *
- * writes the whitening levels
- *-------------------------------------------------------------------*/
-
-static Word16 IGF_WriteWhiteningLevels_fx( /**< out: Q0 | total number of bits written */
- const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF encoder */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
- const Word16 igfGridIdx, /**< in: Q0 | igf grid index see declaration of IGF_GRID_IDX for details */
- const Word16 isIndepFlag /**< in: Q0 | if 1 frame is independent, 0 = frame is coded with data from previous frame */
-)
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
- H_IGF_GRID hGrid;
- Word16 p;
- Word16 nTiles;
- Word16 isSame;
- Word32 tmp32;
- Word16 totBitCount;
- Word16 startBitCount;
-
- totBitCount = 0;
- move16();
- isSame = 1;
- move16();
- startBitCount = *pBitOffset;
- move16();
- hPrivateData = &hInstance->igfData;
- hGrid = &hPrivateData->igfInfo.grid[igfGridIdx];
- nTiles = hGrid->nTiles;
- move16();
-
- IF( isIndepFlag )
- {
- isSame = 0;
- move16();
- }
- ELSE
- {
- p = 0;
- move16();
- tmp32 = 0;
- move32();
- test();
- WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) )
- {
- test();
- tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] );
- if ( tmp32 != 0 )
- {
- isSame = 0;
- move16();
- }
- p++;
- }
- }
- IF( isSame )
- {
- IGF_write_bits( hBstr, pBitOffset, 1, 1 );
- }
- ELSE
- {
- IF( !isIndepFlag )
- {
- IGF_write_bits( hBstr, pBitOffset, 0, 1 );
- }
- IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[0] );
- p = 1;
- move16();
- tmp32 = 0;
- move32();
- test();
- IF( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) )
- {
- isSame = 1;
- move16();
- }
- ELSE
- {
- if ( LT_16( p, nTiles ) )
- {
- isSame = 1;
- move16();
- }
- test();
- WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) )
- {
- test();
- tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfCurrWhiteningLevel[p - 1] );
- if ( tmp32 != 0 )
- {
- isSame = 0;
- move16();
- }
- p++;
- }
- }
- test();
- IF( !isSame )
- {
- IGF_write_bits( hBstr, pBitOffset, 1, 1 );
- FOR( p = 1; p < nTiles; p++ )
- {
- IGF_WriteWhiteningTile_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[p] );
- }
- }
- ELSE IF( NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) && NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) )
- {
- IGF_write_bits( hBstr, pBitOffset, 0, 1 );
- }
- }
-
- totBitCount = sub( *pBitOffset, startBitCount );
-
- return totBitCount;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_WriteFlatteningTrigger_fx()
- *
- * write flattening trigger
- *-------------------------------------------------------------------*/
-
-/*! r: number of bits written */
-static Word16 IGF_WriteFlatteningTrigger_fx( /**< out: | number of bits written */
- const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset /**< in: | ptr to bitOffset counter */
-)
-{
- Word16 flatteningTrigger;
-
- Word16 totBitCount;
- Word16 startBitCount;
- totBitCount = 0;
- startBitCount = *pBitOffset;
- flatteningTrigger = hInstance->flatteningTrigger;
- move16();
- move16();
- move16();
-
- IGF_write_bits( hBstr, pBitOffset, flatteningTrigger, 1 );
- totBitCount = sub( *pBitOffset, startBitCount );
-
- return totBitCount;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGF_UpdateInfo()
- *
- * updates the start/stop frequency of IGF according to igfGridIdx
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * IGFEncWriteBitstream()
- *
- * IGF bitstream writer
- *-------------------------------------------------------------------*/
-
-/*! r: number of bits written per frame */
-Word16 IGFEncWriteBitstream_ivas_fx(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /* i : ptr to bitOffset counter */
- const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
- const Word16 isIndepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */
-)
-{
- Word16 igfAllZero;
- Word16 startBitCount;
-
- startBitCount = *pBitOffset;
- move16();
- hIGFEnc->infoTotalBitsPerFrameWritten = 0;
- move16();
-
- if ( isIndepFlag )
- {
- hIGFEnc->infoTotalBitsWritten = 0;
- move16();
- }
-
- IGF_WriteEnvelope( hIGFEnc, /* i: instance handle of IGF Encoder */
- hBstr, /* i: encoder state */
- pBitOffset, /* i: ptr to bitOffset counter */
- igfGridIdx, /* i: igf grid index see definition of IGF_GRID_IDX for details */
- isIndepFlag, /* i: if 1 frame is independent, 0 = frame is coded with data from previous frame */
- &igfAllZero ); /* o: *igfAllZero */
-
- IGF_WriteWhiteningLevels_fx( hIGFEnc, /* i: instance handle of IGF Encoder */
- hBstr, /* i: encoder state */
- pBitOffset, /* i: ptr to bitOffset counter */
- igfGridIdx, /* i: igf grid index see definition of IGF_GRID_IDX for details */
- isIndepFlag ); /* i: if 1 frame is independent, 0 = frame is coded with data from previous frame */
-
- IGF_WriteFlatteningTrigger_fx( hIGFEnc, /* i: instance handle of IGF Encoder */
- hBstr, /* i: encoder state */
- pBitOffset ); /* i: ptr to bitOffset counter */
-
- hIGFEnc->infoTotalBitsPerFrameWritten = sub( *pBitOffset, startBitCount );
- hIGFEnc->infoTotalBitsWritten = add( hIGFEnc->infoTotalBitsWritten, hIGFEnc->infoTotalBitsPerFrameWritten );
- move16();
- move16();
-
- return hIGFEnc->infoTotalBitsPerFrameWritten;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGFEncSetMode()
- *
- * sets the IGF mode according to given bitrate
- *-------------------------------------------------------------------*/
-void IGFEncSetMode_ivas_fx(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */
- const Word32 total_brate, /* i : encoder total bitrate */
- const Word16 bwidth, /* i : encoder audio bandwidth */
- const Word16 element_mode, /* i : IVAS element mode */
- const Word16 rf_mode /* i : flag to signal the RF mode */
-)
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
- Word16 i;
-
- hPrivateData = &hIGFEnc->igfData;
- hPrivateData->igfBitstreamBits = 0;
- move16();
- set16_fx( hPrivateData->igfScfQuantized, 0, IGF_MAX_SFB );
- set16_fx( hPrivateData->igfCurrWhiteningLevel, 0, IGF_MAX_TILES );
- set16_fx( hPrivateData->igfPrevWhiteningLevel, 0, IGF_MAX_TILES );
- set16_fx( hPrivateData->igfWhiteningHangoverCnt, 0, IGF_MAX_TILES );
- FOR( i = 0; i < IGF_MAX_TILES; i++ )
- {
- set16_fx( hPrivateData->igfPastSFM_fx[i], -( ONE_IN_Q13 ), IGF_PAST_SFM_LEN );
- }
-
- hPrivateData->igfPastSFM_pos = 0;
- move16();
-
- FOR( i = 0; i < IGF_BITBUFSIZE / 8; i++ )
- {
- hPrivateData->igfBitstream[i] = 0;
- move16();
- }
- hPrivateData->wasTransient = 0;
- move16();
- set32_fx( hPrivateData->prevSFM_FIR, 0, IGF_MAX_TILES );
- set16_fx( hPrivateData->prevSFM_IIR, 0, IGF_MAX_TILES );
- set16_fx( hPrivateData->dampingFactorSmoothing, 2, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFM_FIR_SFB_SB_fx, 0, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFB_FIR_TB_e, 15, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFB_FIR_SB_e, 15, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFM_IIR_SFB_SB_fx, 0, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFB_IIR_SB_e, 15, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFM_FIR_SFB_TB_fx, 0, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFB_IIR_TB_e, 15, IGF_MAX_SFB );
- set16_fx( hPrivateData->sfb_tb_e, 15, IGF_MAX_SFB );
- set16_fx( hPrivateData->sfb_sb_e, 15, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevSFM_IIR_SFB_TB_fx, 0, IGF_MAX_SFB );
- set16_fx( hPrivateData->prevDampingFactor_IIR_fx, -( ONE_IN_Q15 ), IGF_MAX_SFB );
- set16_fx( hPrivateData->prevDampingFactor_IIR_e, 0, IGF_MAX_SFB );
- set16_fx( hPrivateData->logSpec, 0, L_FRAME_PLUS );
- set16_fx( hPrivateData->SFM_sb_fx, 0, IGF_MAX_SFB );
- set16_fx( hPrivateData->SFM_tb_fx, 0, IGF_MAX_SFB );
-
- IF( IGFCommonFuncsIGFConfiguration_ivas_fx( total_brate, bwidth, element_mode, &hPrivateData->igfInfo, rf_mode ) != 0 )
- {
- IGFSCFEncoderOpen_fx( &hPrivateData->hIGFSCFArithEnc, &hPrivateData->igfInfo, total_brate, bwidth, element_mode, rf_mode );
-
- hIGFEnc->infoSamplingRate = hPrivateData->igfInfo.sampleRate;
- move32();
- hIGFEnc->infoStartFrequency = hPrivateData->igfInfo.grid[0].startFrequency;
- move16();
- hIGFEnc->infoStopFrequency = hPrivateData->igfInfo.grid[0].stopFrequency;
- move16();
- hIGFEnc->infoStartLine = hPrivateData->igfInfo.grid[0].startLine;
- move16();
- hIGFEnc->infoStopLine = hPrivateData->igfInfo.grid[0].stopLine;
- move16();
- }
- ELSE
- {
- /* IGF configuration failed -> error! */
- hIGFEnc->infoSamplingRate = 0;
- move32();
- hIGFEnc->infoStartFrequency = -1;
- move16();
- hIGFEnc->infoStopFrequency = -1;
- move16();
- hIGFEnc->infoStartLine = -1;
- move16();
- hIGFEnc->infoStopLine = -1;
- move16();
- fprintf( stderr, "IGFEncSetMode_fx: initialization error!\n" );
- }
-
- /* reset remaining variables */
- hIGFEnc->infoTotalBitsWritten = 0;
- move16();
- hIGFEnc->infoTotalBitsPerFrameWritten = 0;
- move16();
- hIGFEnc->flatteningTrigger = 0;
- move16();
- hIGFEnc->spec_be_igf_e = 0;
- move16();
- hIGFEnc->tns_predictionGain = 0;
- move16();
- set32_fx( hIGFEnc->spec_be_igf, 0, N_MAX_TCX - IGF_START_MN );
- return;
-}
-
-/*-------------------------------------------------------------------*
- * pack_bit_ivas()
- *
- * insert a bit into packed octet
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * IGFEncConcatenateBitstream()
- *
- * IGF bitstream concatenation for TCX10 modes
- *-------------------------------------------------------------------*/
-
-/*-------------------------------------------------------------------*
- * IGFEncResetTCX10BitCounter_ivas_fx()
- *
- * IGF reset bitstream bit counter for TCX10 modes
- *-------------------------------------------------------------------*/
-
-void IGFEncResetTCX10BitCounter_ivas_fx(
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc /* i : instance handle of IGF Encoder */
-)
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
-
- hPrivateData = &hIGFEnc->igfData;
- hPrivateData->igfBitstreamBits = 0;
- hIGFEnc->infoTotalBitsWritten = 0;
- move16();
- move16();
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGFEncApplyMono()
- *
- * apply the IGF encoder, main encoder interface
- *-------------------------------------------------------------------*/
-
-void IGFEncApplyMono_ivas_fx(
- Encoder_State *st, /* i : Encoder state */
- Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */
- const Word16 igfGridIdx, /* i : IGF grid index */
- Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */
- Word16 e_mdct, /* i : exponent of pMDCTspectrum */
- Word32 *pPowerSpectrum_fx, /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */
- Word16 *e_ps, /* i : exponent of pPowerSpectrum */
- const Word16 isTCX20, /* i : flag indicating if the input is TCX20 or TCX10/2xTCX5 */
- const Word8 isTNSActive, /* i : flag indicating if the TNS is active */
- const Word16 sp_aud_decision0, /* i : first stage switching decision */
- const Word16 vad_hover_flag /* i : VAD hangover flag */
-)
-{
- Word32 *pPowerSpectrumParameter_fx;
- Word16 *pPowerSpectrumParameter_exp;
- Word16 att_fx = MAX16B;
- Word16 last_core_acelp;
- move16();
-
- Word32 common_pPowerSpectrum_fx[N_MAX + L_MDCT_OVLP_MAX];
-
- set32_fx( common_pPowerSpectrum_fx, 0, N_MAX );
-
- Word16 common_pPowerSpectrum_exp = MIN16B;
- move16();
- IF( st->last_core == ACELP_CORE )
- {
- last_core_acelp = 1;
- move16();
- }
- ELSE
- {
- last_core_acelp = 0;
- move16();
- }
-
- test();
- IF( !isTNSActive && isTCX20 )
- {
- pPowerSpectrumParameter_fx = pPowerSpectrum_fx;
- pPowerSpectrumParameter_exp = e_ps;
- }
- ELSE
- {
- pPowerSpectrumParameter_fx = NULL;
- pPowerSpectrumParameter_exp = NULL;
- }
-
- IGF_UpdateInfo( st->hIGFEnc, igfGridIdx );
-
- test();
- IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) )
- {
- calculate_hangover_attenuation_gain_ivas_fx( st, &att_fx, vad_hover_flag );
- }
-
- IGF_CalculateEnvelope_ivas_fx( st->hIGFEnc, pMDCTSpectrum_fx, e_mdct, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, st->element_mode, att_fx );
-
- IF( isTCX20 )
- {
- pPowerSpectrumParameter_fx = pPowerSpectrum_fx;
- pPowerSpectrumParameter_exp = e_ps;
- }
- ELSE
- {
- pPowerSpectrumParameter_fx = NULL;
- pPowerSpectrumParameter_exp = NULL;
- }
-
- IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
- {
- IGF_Whitening_ivas_fx( st->hIGFEnc, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, isTNSActive, sp_aud_decision0, st->element_brate, st->element_mode );
- }
- ELSE
- {
- IGF_Whitening_ivas_fx( st->hIGFEnc, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, isTNSActive, sp_aud_decision0, st->total_brate, st->element_mode );
- }
-
- IF( pPowerSpectrumParameter_fx )
- {
- FOR( Word16 i = 0; i < powerSpectrum_len; i++ )
- {
- common_pPowerSpectrum_exp = s_max( common_pPowerSpectrum_exp, pPowerSpectrumParameter_exp[i] );
- }
-
- FOR( Word16 i = 0; i < powerSpectrum_len; i++ )
- {
- common_pPowerSpectrum_fx[i] = L_shl( pPowerSpectrumParameter_fx[i], sub( pPowerSpectrumParameter_exp[i], common_pPowerSpectrum_exp ) );
- move16();
- }
- pPowerSpectrumParameter_fx = common_pPowerSpectrum_fx;
- }
- IGF_ErodeSpectrum_ivas_fx( st->hIGFEnc, pMDCTSpectrum_fx, pPowerSpectrumParameter_fx, common_pPowerSpectrum_exp, igfGridIdx, 0 );
-}
-
-
-/*-------------------------------------------------------------------*
- * IGFEncApplyStereo()
- *
- * apply the IGF encoder, main encoder interface
- *-------------------------------------------------------------------*/
-
-void IGFEncApplyStereo_fx(
- STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo encoder structure */
- Word16 ms_mask[2][MAX_SFB], /* i : bandwise MS mask */
- const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i : instance handle of IGF Encoder */
- const Word16 igfGridIdx, /* i : IGF grid index */
- Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */
- Word32 *pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */
- Word16 *exp_pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrum_fx */
- Word32 *pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse power spectrum */
- Word16 *q_pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i/o: Q of pPowerSpectrumMsInv_fx */
- Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */
- Word16 exp_inv_spectrum_fx[CPE_CHANNELS], /* i : exp of inverse spectrum */
- const Word16 frameno, /* i : flag indicating index of current subfr. */
- const Word16 sp_aud_decision0, /* i : sp_aud_decision0 */
- const Word32 element_brate, /* i : element bitrate */
- const Word16 mct_on )
-{
- Word32 *pPowerSpectrumParameter_fx[NB_DIV]; /* If it is NULL it informs a function that specific handling is needed */
- Word16 *exp_pPowerSpectrumParameter_fx[NB_DIV]; /* If it is NULL it informs a function that specific handling is needed */
- Word32 *pPowerSpectrumParameterMsInv_fx[NB_DIV];
- Word16 *q_pPowerSpectrumParameterMsInv_fx[NB_DIV];
- Word16 coreMsMask[N_MAX];
- Word16 sfb, ch, last_core_acelp;
- STEREO_MDCT_BAND_PARAMETERS *sfbConf;
- Word32 common_pPowerSpectrum_fx[N_MAX];
-
- set32_fx( common_pPowerSpectrum_fx, 0, N_MAX );
-
- Word16 common_pPowerSpectrum_exp = MIN16B;
- move16();
-
- /* assumptions: stereo filling was already done on the flattened spectra
- * IGF region is always coded M/S, never L/R (to be done in the encoder)
- * for residual bands with stereo filling infoTcxNoise is set to zero
- * both channels have the same IGF configuration
- */
-
- /* sanity checks: check if both channels have the same configuration...*/
- assert( ( sts[0]->core == sts[1]->core ) );
-
- /* initialization */
- IF( EQ_16( sts[0]->core, TCX_20_CORE ) )
- {
- sfbConf = &hStereoMdct->stbParamsTCX20;
- }
- ELSE
- {
- sfbConf = &hStereoMdct->stbParamsTCX10;
- }
- if ( sts[0]->last_core == ACELP_CORE )
- {
- sfbConf = &hStereoMdct->stbParamsTCX20afterACELP;
- }
-
- /* create line wise ms mask for the core bands */
- set16_fx( coreMsMask, 0, N_MAX );
- FOR( sfb = 0; sfb < sfbConf->sfbCnt; sfb++ )
- {
- set16_fx( &coreMsMask[sfbConf->sfbOffset[sfb]], ms_mask[frameno][sfb], sub( sfbConf->sfbOffset[sfb + 1], sfbConf->sfbOffset[sfb] ) );
- }
-
- test();
- test();
- IF( EQ_16( sts[0]->core, TCX_20_CORE ) && !sts[0]->hTcxEnc->fUseTns[frameno] && !sts[1]->hTcxEnc->fUseTns[frameno] )
- {
- pPowerSpectrumParameter_fx[0] = &pPowerSpectrum_fx[0][0];
- exp_pPowerSpectrumParameter_fx[0] = &exp_pPowerSpectrum_fx[0][0];
- pPowerSpectrumParameter_fx[1] = &pPowerSpectrum_fx[1][0];
- exp_pPowerSpectrumParameter_fx[1] = &exp_pPowerSpectrum_fx[1][0];
- pPowerSpectrumParameterMsInv_fx[0] = pPowerSpectrumMsInv_fx[0][0];
- pPowerSpectrumParameterMsInv_fx[1] = pPowerSpectrumMsInv_fx[1][0];
- q_pPowerSpectrumParameterMsInv_fx[0] = q_pPowerSpectrumMsInv_fx[0][0];
- q_pPowerSpectrumParameterMsInv_fx[1] = q_pPowerSpectrumMsInv_fx[1][0];
- }
- ELSE
- {
- pPowerSpectrumParameter_fx[0] = NULL;
- pPowerSpectrumParameter_fx[1] = NULL;
- pPowerSpectrumParameterMsInv_fx[0] = NULL;
- pPowerSpectrumParameterMsInv_fx[1] = NULL;
- q_pPowerSpectrumParameterMsInv_fx[0] = NULL;
- q_pPowerSpectrumParameterMsInv_fx[1] = NULL;
- }
- FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
- {
- last_core_acelp = extract_l( EQ_16( sts[ch]->last_core, ACELP_CORE ) );
-
- IGF_UpdateInfo( hIGFEnc[ch], igfGridIdx );
- IGF_CalculateStereoEnvelope_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], sts[ch]->hTcxEnc->spectrum_e[frameno], inv_spectrum_fx[ch][frameno],
- exp_inv_spectrum_fx[ch], pPowerSpectrumParameter_fx[ch], exp_pPowerSpectrum_fx[ch], pPowerSpectrumParameterMsInv_fx[ch],
- q_pPowerSpectrumParameterMsInv_fx[ch], igfGridIdx, coreMsMask, sts[ch]->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, mct_on );
-
- IF( EQ_16( sts[ch]->core, TCX_20_CORE ) )
- {
- pPowerSpectrumParameter_fx[ch] = pPowerSpectrum_fx[ch];
- exp_pPowerSpectrumParameter_fx[ch] = exp_pPowerSpectrum_fx[ch];
- }
- ELSE
- {
- pPowerSpectrumParameter_fx[ch] = NULL;
- }
-
- IGF_Whitening_ivas_fx( hIGFEnc[ch], pPowerSpectrumParameter_fx[ch], exp_pPowerSpectrumParameter_fx[ch], igfGridIdx, sts[ch]->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, ( sts[0]->hTcxEnc->fUseTns[frameno] || sts[1]->hTcxEnc->fUseTns[frameno] ), sp_aud_decision0, element_brate, sts[ch]->element_mode );
-
- IF( pPowerSpectrumParameter_fx[ch] )
- {
- Word16 length = N_MAX;
- move16();
- if ( mct_on )
- {
- length = L_FRAME48k;
- move16();
- }
- FOR( Word16 i = 0; i < length; i++ )
- {
- common_pPowerSpectrum_exp = s_max( common_pPowerSpectrum_exp, exp_pPowerSpectrumParameter_fx[ch][i] );
- }
-
- FOR( Word16 i = 0; i < length; i++ )
- {
- common_pPowerSpectrum_fx[i] = L_shl( pPowerSpectrumParameter_fx[ch][i], sub( exp_pPowerSpectrumParameter_fx[ch][i], common_pPowerSpectrum_exp ) );
- move32();
- }
- pPowerSpectrumParameter_fx[ch] = common_pPowerSpectrum_fx;
- }
- IGF_ErodeSpectrum_ivas_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], pPowerSpectrumParameter_fx[ch], common_pPowerSpectrum_exp, igfGridIdx, mct_on );
- }
- return;
-}
-
-
-/*-------------------------------------------------------------------*
- * IGFSaveSpectrumForITF()
- *
- *
- *-------------------------------------------------------------------*/
-
-void IGFSaveSpectrumForITF_ivas_fx(
- IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */
- const Word16 igfGridIdx, /* i : IGF grid index */
- const Word32 *pITFSpectrum, /* i : MDCT spectrum */
- Word16 exp_pITFSpectrum )
-{
- IGF_UpdateInfo( hIGFEnc, igfGridIdx );
-
- Copy32( pITFSpectrum + IGF_START_MN, hIGFEnc->spec_be_igf, sub( hIGFEnc->infoStopLine, IGF_START_MN ) );
-
- scale_sig32( hIGFEnc->spec_be_igf, sub( hIGFEnc->infoStopLine, IGF_START_MN ), sub( exp_pITFSpectrum, s_max( exp_pITFSpectrum, hIGFEnc->spec_be_igf_e ) ) );
- scale_sig32( hIGFEnc->spec_be_igf + sub( hIGFEnc->infoStopLine, IGF_START_MN ), sub( N_MAX_TCX - IGF_START_MN, sub( hIGFEnc->infoStopLine, IGF_START_MN ) ), sub( hIGFEnc->spec_be_igf_e, s_max( exp_pITFSpectrum, hIGFEnc->spec_be_igf_e ) ) );
- hIGFEnc->spec_be_igf_e = s_max( exp_pITFSpectrum, hIGFEnc->spec_be_igf_e );
- move16();
-
- return;
-}
-
-ivas_error IGF_Reconfig(
- IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */
- const Word16 igf, /* i : IGF on/off */
- const Word16 reset, /* i : reset flag */
- const Word32 brate, /* i : bitrate for configuration */
- const Word16 bwidth, /* i : signal bandwidth */
- const Word16 element_mode, /* i : IVAS element mode */
- const Word16 rf_mode /* i : flag to signal the RF mode */
-)
-{
- ivas_error error;
-
- error = IVAS_ERR_OK;
- move32();
-
- test();
- test();
- test();
- IF( igf && *hIGFEnc == NULL )
- {
- IF( ( *hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) );
- }
- IGFEncSetMode_ivas_fx( *hIGFEnc, brate, bwidth, element_mode, rf_mode );
- }
- ELSE IF( igf && reset )
- {
- IGFEncSetMode_ivas_fx( *hIGFEnc, brate, bwidth, element_mode, rf_mode );
- }
- ELSE IF( !igf && *hIGFEnc != NULL )
- {
- free( *hIGFEnc );
- *hIGFEnc = NULL;
- }
-
- return error;
-}
diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c
old mode 100644
new mode 100755
index e0562467a93c60abef056c29d59cf5a67a193c8c..4225570dd03e3b584e87b8b63a6f95a3c1123260
--- a/lib_enc/igf_enc_fx.c
+++ b/lib_enc/igf_enc_fx.c
@@ -13,35 +13,46 @@
#include "stat_enc.h"
#include "basop_util.h"
-/**********************************************************************/ /*
-write single bit to stream
-**************************************************************************/
+
+/*-------------------------------------------------------------------*
+ * IGF_write_bit_fx()
+ *
+ * write single bit to stream
+ *-------------------------------------------------------------------*/
+
static void IGF_write_bit_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *bitCount, /**< in/out: | bit counter */
- Word16 bit /**< in: | value of bit */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *bitCount, /* i/o: bit counter */
+ const Word16 value /* i : value */
)
{
- IGFCommonFuncsWriteSerialBit( hBstr, bitCount, bit );
+ IF( hBstr )
+ {
+ push_next_indice( hBstr, value, 1 );
+ }
+
+ ( *bitCount ) = add( ( *bitCount ), 1 );
+ move16();
+
+ return;
}
-/**********************************************************************/ /*
-write bits to stream
-**************************************************************************/
+/*-------------------------------------------------------------------*
+ * IGF_write_bits()
+ *
+ * write bits to stream
+ *-------------------------------------------------------------------*/
+
static void IGF_write_bits(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *bitCount, /**< in/out: | bit counter */
- Word16 value, /**< in: | value to be written */
- Word16 bits /**< in: Q0 | number of bits */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *bitCount, /* i/o: bit counter */
+ const Word16 value, /* i/o: value */
+ Word16 bits /* i : number of bits */
)
{
- Word16 tmp;
-
- WHILE( bits )
+ WHILE( bits-- )
{
- bits = sub( bits, 1 );
- tmp = s_and( value, shl( 1, bits ) );
- IF( tmp == 0 )
+ IF( s_and( value, shl( 1, bits ) ) == 0 )
{
IGF_write_bit_fx( hBstr, bitCount, 0 );
}
@@ -55,15 +66,16 @@ static void IGF_write_bits(
}
-/**********************************************************************/ /*
+/**********************************************************************/ /*
envelope estimation
**************************************************************************/
-static void IGF_CalculateEnvelope( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
- Word32 *pMDCTSpectrum, /**< in: Q31 | MDCT spectrum */
- Word16 MDCTSpectrum_e, /**< in: | exponent of MDCT spectrum */
- Word32 *pPowerSpectrum, /**< in: Q31 | MDCT^2 + MDST^2 spectrum, or estimate */
- Word16 PowerSpectrum_e, /**< in: | exponent of MDCT^2 + MDST^2 spectrum, or estimate */
- const Word16 igfGridIdx /**< in: Q0 | IGF grid index */
+static void IGF_CalculateEnvelope(
+ const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
+ Word32 *pMDCTSpectrum, /**< in: Q31 | MDCT spectrum */
+ Word16 MDCTSpectrum_e, /**< in: | exponent of MDCT spectrum */
+ Word32 *pPowerSpectrum, /**< in: Q31 | MDCT^2 + MDST^2 spectrum, or estimate */
+ Word16 PowerSpectrum_e, /**< in: | exponent of MDCT^2 + MDST^2 spectrum, or estimate */
+ const Word16 igfGridIdx /**< in: Q0 | IGF grid index */
)
{
@@ -93,9 +105,11 @@ static void IGF_CalculateEnvelope( const IGF_ENC_INSTANCE_HANDLE hInstance, /**<
Word16 tmp_exp;
Word32 L_tmp;
Word16 shift;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* initialize variables */
@@ -218,8 +232,13 @@ static void IGF_CalculateEnvelope( const IGF_ENC_INSTANCE_HANDLE hInstance, /**<
move16();
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyTileR[sfb] ), sfbEnergyTileR_exp[sfb], width, 15, &gain, &gain_exp );
+ BASOP_Util_Divide_MantExp( round_fx_sat( sfbEnergyC[sfb] ), sfbEnergyC_exp[sfb], round_fx_sat( sfbEnergyTileC[sfb] ), sfbEnergyTileC_exp[sfb], &tmp, &tmp_exp );
+#else
BASOP_Util_Divide_MantExp( round_fx_o( sfbEnergyTileR[sfb], &Overflow ), sfbEnergyTileR_exp[sfb], width, 15, &gain, &gain_exp );
BASOP_Util_Divide_MantExp( round_fx_o( sfbEnergyC[sfb], &Overflow ), sfbEnergyC_exp[sfb], round_fx_o( sfbEnergyTileC[sfb], &Overflow ), sfbEnergyTileC_exp[sfb], &tmp, &tmp_exp );
+#endif
L_tmp = L_mult( gain, tmp );
gain_exp = add( gain_exp, tmp_exp );
}
@@ -247,7 +266,11 @@ static void IGF_CalculateEnvelope( const IGF_ENC_INSTANCE_HANDLE hInstance, /**<
L_tmp = BASOP_Util_Log2( L_tmp );
L_tmp = L_add( L_tmp, L_deposit_h( shl( gain_exp, 15 - 6 ) ) );
shift = norm_l( L_tmp );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ gain = round_fx_sat( L_shl( L_tmp, shift ) );
+#else
gain = round_fx_o( L_shl_o( L_tmp, shift, &Overflow ), &Overflow );
+#endif
gain_exp = sub( 7, shift );
gain_exp = BASOP_Util_Add_MantExp( gain, gain_exp, 32767 /*16 Q11*/, 4, &gain );
gain_exp = BASOP_Util_Add_MantExp( gain, gain_exp, 0x4000, 0, &gain );
@@ -277,16 +300,19 @@ static void IGF_CalculateEnvelope( const IGF_ENC_INSTANCE_HANDLE hInstance, /**<
return;
}
+
/**********************************************************************/ /*
writes IGF SCF values
**************************************************************************/
-static void IGF_WriteEnvelope( /**< out: Q0 | number of bits writen */
- const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
- const Word16 igfGridIdx, /**< in: Q0 | igf grid index see declaration of IGF_GRID_IDX for details */
- const Word16 isIndepFlag, /**< in: Q0 | if 1 frame is independent, 0 = frame is coded with data from previous frame */
- Word16 *igfAllZero /**< in: Q0 | returns 1 if all IGF scfs are zero, else 0 */
+
+/**< out: Q0 | number of bits writen */
+static void IGF_WriteEnvelope(
+ const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
+ const Word16 igfGridIdx, /**< in: Q0 | igf grid index see declaration of IGF_GRID_IDX for details */
+ const Word16 isIndepFlag, /**< in: Q0 | if 1 frame is independent, 0 = frame is coded with data from previous frame */
+ Word16 *igfAllZero /**< in: Q0 | returns 1 if all IGF scfs are zero, else 0 */
)
{
IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
@@ -358,7 +384,9 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou
Word32 highPassEner; /* Q31 */
Word32 lastLine;
Word32 nextLine;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_c;
+#endif
Word32 highPassEner_Ovfl;
Word16 s;
Word16 tmploop;
@@ -372,11 +400,15 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou
Word16 tmp;
Word32 L_tmp;
+#if !defined( FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW ) && !defined( ISSUE_1867_replace_overflow_libenc )
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Carry = 0;
+#endif
move32();
move32();
+#endif
#endif
hPrivateData = &hInstance->igfData;
@@ -409,19 +441,32 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou
IF( igfBgn > 0 )
{
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_c = 0;
move32();
+#else
+ Word64 W_highPassEner = 0;
+ move64();
+#endif
FOR( i = 0; i < igfBgn; i++ )
{
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Carry = 0;
move32();
highPassEner = L_add_co( highPassEner, Mpy_32_16_1( pPowerSpectrum[i], shl( i, 4 ) /*Q4*/ ) /*Q20, pPowerSpectrum_exp*/, &Carry, &Overflow );
Overflow = 0;
move32();
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
+#else
+ W_highPassEner = W_add( W_highPassEner, W_deposit32_l( Mpy_32_16_1( pPowerSpectrum[i], shl( i, 4 ) /*Q4*/ ) ) /*Q20, pPowerSpectrum_exp*/ );
+#endif
}
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
highPassEner = norm_llQ31( L_c, highPassEner, highPassEner_exp ); /*Q20, highPassEner_exp*/
+#else
+ highPassEner = w_norm_llQ31( W_highPassEner, highPassEner_exp ); /*Q20, highPassEner_exp*/
+#endif
*highPassEner_exp = add( *highPassEner_exp, pPowerSpectrum_exp );
move16();
test();
@@ -442,8 +487,13 @@ void IGF_ErodeSpectrum( Word16 *highPassEner_exp, /**< ou
/* May overflow - just for threshold comparison */
/* negate because the negated may be 1 larger in abs, */
/* so whenever compared to the negation of a maximum possible pPowerspectrum, it is still larger */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ highPassEner_Ovfl = L_shl_sat( L_negate( highPassEner ), sub( *highPassEner_exp, pPowerSpectrum_exp ) );
+ L_tmp = L_add_sat( pPowerSpectrum[i - 1], highPassEner_Ovfl );
+#else
highPassEner_Ovfl = L_shl_o( L_negate( highPassEner ), sub( *highPassEner_exp, pPowerSpectrum_exp ), &Overflow );
L_tmp = L_add_o( pPowerSpectrum[i - 1], highPassEner_Ovfl, &Overflow );
+#endif
if ( L_tmp >= 0 )
{
@@ -880,16 +930,22 @@ Word16 IGF_getSFM( /**< out: Q15| SFM value
Word16 invDenom_exp, numf_exp;
Word16 numf;
Word32 SFM32;
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Word32 L_c;
+#endif
Word16 invDenom, SFM;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Flag Overflow = 0;
Flag Carry = 0;
+#endif
move32();
move32();
#endif
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
L_c = 0;
+#endif
move32();
num = 0;
move32();
@@ -900,6 +956,7 @@ Word16 IGF_getSFM( /**< out: Q15| SFM value
SFM = 32767 /*1.0f Q15*/;
move16();
+ Word64 W_denom = W_deposit32_l( denom );
FOR( i = start; i < stop; i++ )
{
/*ln(x * 2^-Qx * 2^xExp) = ln(x) - Qx + xExp*/
@@ -919,15 +976,23 @@ Word16 IGF_getSFM( /**< out: Q15| SFM value
n = s_max( 0, n );
num = L_add( num, L_deposit_l( n ) ); /*Q0*/
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
Carry = 0;
move32();
denom = L_add_co( energy[i], denom, &Carry, &Overflow );
Overflow = 0;
move32();
L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
+#else
+ W_denom = W_add( W_deposit32_l( energy[i] ), W_denom );
+#endif
}
+#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
denom = norm_llQ31( L_c, denom, &denom_exp ); /*Q31*/
+#else
+ denom = w_norm_llQ31( W_denom, &denom_exp ); /*Q31*/
+#endif
denom_exp = add( denom_exp, *energy_exp );
/* calculate SFM only if signal is present */
@@ -1232,15 +1297,20 @@ static void IGF_Whitening( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in
}
hPrivateData->wasTransient = isTransient;
move16();
+
+ return;
}
+
/**********************************************************************/ /*
write whitening levels into bitstream
**************************************************************************/
-static void IGF_WriteWhiteningTile_fx( /**< out: Q0 | number of bits written */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
- Word16 whiteningLevel /**< in: Q0 | whitening levels to write */
+
+/**< out: Q0 | number of bits written */
+static void IGF_WriteWhiteningTile_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
+ Word16 whiteningLevel /**< in: Q0 | whitening levels to write */
)
{
IF( EQ_32( whiteningLevel, IGF_WHITENING_MID ) )
@@ -1259,6 +1329,8 @@ static void IGF_WriteWhiteningTile_fx( /**< ou
IGF_write_bits( hBstr, pBitOffset, 1, 1 );
}
}
+
+ return;
}
/**********************************************************************/ /*
@@ -1534,7 +1606,7 @@ void IGFEncSetMode_fx(
* insert a bit into packed octet
*-------------------------------------------------------------------*/
-static void pack_bit_ivas_fx(
+static void pack_bit_fx(
const Word16 bit, /* i : bit to be packed */
UWord8 **pt, /* i/o: pointer to octet array into which bit will be placed */
UWord8 *omask /* i/o: output mask to indicate where in the octet the bit is to be written */
@@ -1607,7 +1679,7 @@ void IGFEncConcatenateBitstream_ivas_fx( const IGF_ENC_INSTANCE_HANDLE hIGFEnc,
/* write bit by bit */
FOR( k = 0; k < ind_list[i].nb_bits; k++ )
{
- pack_bit_ivas_fx( extract_l( L_and( ind_list[i].value, imask ) ), &pFrame, &omask );
+ pack_bit_fx( extract_l( L_and( ind_list[i].value, imask ) ), &pFrame, &omask );
imask = L_shr( imask, 1 );
}
nb_bits_written = add( nb_bits_written, ind_list[i].nb_bits );
@@ -1627,29 +1699,16 @@ hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, nb_bits_written );
return;
}
-/**********************************************************************/ /*
- IGF reset bitsream bit counter for TCX10 modes
- **************************************************************************/
-void IGFEncResetTCX10BitCounter_fx( const IGF_ENC_INSTANCE_HANDLE hInstance /**< in: | instance handle of IGF Encoder */
-)
-{
- IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
- hPrivateData = &hInstance->igfData;
- hPrivateData->igfBitstreamBits = 0;
- move16();
- hInstance->infoTotalBitsWritten = 0;
- move16();
- return;
-}
+/**********************************************************************/ /*
+ IGF write concatenated bitsream for TCX10 modes
+**************************************************************************/
-/**********************************************************************/ /*
- IGF write concatenated bitsream for TCX10 modes
- **************************************************************************/
-Word16 IGFEncWriteConcatenatedBitstream_fx( /**< out: Q0 | total number of bits written */
- const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
- BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
+/**< out: Q0 | total number of bits written */
+Word16 IGFEncWriteConcatenatedBitstream_fx(
+ const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
+ BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
)
{
IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
@@ -1752,7 +1811,7 @@ void IGFEncApplyMono_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in
pPowerSpectrumParameterWhitening, /* i: MDCT^2 + MDST^2 spectrum, or estimate */
PowerSpectrum_e, /* i: exponent of powerSpectrum */
igfGridIdx, /* i: IGF grid index */
- ( st->transientDetection.transientDetector.bIsAttackPresent == 1 ),
+ ( st->hTranDet->transientDetector.bIsAttackPresent == 1 ),
last_core_acelp ); /* i: last frame was acelp indicator */
pPowerSpectrumParameter = NULL;
@@ -1809,3 +1868,2602 @@ ivas_error IGF_Reconfig_fx(
return error;
}
+
+
+#define INV_Log2_10_Q15 9864 /*1/log2(10) in Q15*/
+#define INV_Log2_10_Q12 1233 /*1/log2(10) in Q12*/
+#define INV_Log2_e_Q15 22713 /*1/log2(e) in Q15*/
+
+
+/*-------------------------------------------------------------------*
+ * IGF_getCrest_new()
+ *
+ * crest factor calculation
+ *-------------------------------------------------------------------*/
+
+/*! r: crest factor */
+static Word16 IGF_getCrest_new_fx(
+ const Word16 *logSpec, /* i : power spectrum */
+ const Word16 start, /* i : start subband index */
+ const Word16 stop, /* i : stop subband index */
+ Word16 *crest_exp /*Stores the exponent of the result(return value)*/
+)
+{
+ Word16 i;
+ Word16 x;
+ Word32 x_eff;
+ Word16 x_max;
+ Word16 exp;
+ Word16 temp;
+ Word16 temp_e;
+ Word16 crest; /*1.0f in Q15*/
+ x_eff = 0;
+ x_max = 0;
+ exp = 0;
+ temp = 0;
+ crest = 32767; /*1.0f in Q15*/
+ move32();
+ move16();
+ move16();
+ move16();
+ move16();
+
+ FOR( i = start; i < stop; i++ )
+ {
+ x = logSpec[i];
+ move16();
+ x_eff = L_mac0( x_eff, x, x );
+
+ if ( GT_16( x, x_max ) )
+ {
+ x_max = x;
+ move16();
+ }
+ }
+
+ x_eff = BASOP_Util_Divide3216_Scale( x_eff, sub( stop, start ), &temp_e );
+ temp_e = add( temp_e, 16 ); /*exp += 31 - 15 + 16(because x_eff is word32)*/
+ x_eff = L_shr( x_eff, sub( 15, temp_e ) );
+ temp_e = 15;
+ move16();
+ temp = Sqrt16( extract_l( x_eff ), &temp_e );
+
+ test();
+ IF( x_eff > 0 && x_max > 0 )
+ {
+ temp = BASOP_Util_Divide1616_Scale( x_max, temp, &exp );
+ exp = add( exp, sub( 15, temp_e ) );
+ IF( exp < 0 )
+ {
+ temp = shl( temp, exp );
+ exp = 0;
+ move16();
+ }
+ crest = s_max( shl_sat( 1, sub( 15, exp ) ), temp );
+ }
+ *crest_exp = exp;
+ move16();
+ return crest;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGF_getSFM_new()
+ *
+ * calculates spectral flatness measurement
+ *-------------------------------------------------------------------*/
+
+/*! r: SFM value */
+static Word16 IGF_getSFM_new_fx(
+ const Word32 *powerSpectrum, /* i : power spectrum */
+ const Word16 *logSpec, /* i : log of power spectrum */
+ const Word16 start, /* i : start subband index */
+ const Word16 stop, /* i : stop subband index */
+ Word16 *e_ps /*Stores exp related to power spectrum*/
+)
+{
+ Word16 n;
+ Word16 i;
+ Word16 num;
+ Word32 denom;
+ Word16 numf;
+ Word32 tmp;
+ Word16 sfm;
+ Word16 sfm_e;
+ Word16 denom_e;
+ Word16 numf_e; /*stores exponent for numf*/
+ Word16 tmp_e;
+
+ num = 0;
+ denom = ONE_IN_Q30;
+ denom_e = 1;
+ sfm = MAX16B; // Q15
+ move16();
+ move32();
+ move16();
+ move16();
+
+ FOR( i = start; i < stop; i++ )
+ {
+ tmp = powerSpectrum[i];
+ n = logSpec[i /*-start*/];
+ move32();
+ move16();
+ num = add( num, n );
+ denom = BASOP_Util_Add_Mant32Exp( tmp, e_ps[i], denom, denom_e, &denom_e );
+ }
+
+ numf = BASOP_Util_Divide1616_Scale( num, sub( stop, start ), &numf_e );
+ denom = BASOP_Util_Divide3216_Scale( denom, sub( stop, start ), &tmp_e );
+ denom_e = add( add( denom_e, tmp_e ), 1 ); /*denom_e+tmp_e-15 +16(because type of denom is word32)*/
+
+ IF( denom != 0 )
+ {
+ tmp = BASOP_util_Pow2( L_add( numf, shl_sat( 1, sub( 14, numf_e ) ) ), add( 16, numf_e ), &tmp_e );
+ sfm = BASOP_Util_Divide3232_Scale( tmp, denom, &sfm_e );
+ sfm_e = add( sfm_e, sub( tmp_e, denom_e ) );
+ sfm = shl_sat( extract_l( L_min( sfm, L_shl_sat( 1, sub( 15, sfm_e ) ) ) ), sfm_e );
+ }
+
+ return sfm;
+}
+/*-------------------------------------------------------------------*
+ * IGF_getTilt()
+ *
+ * calculates spectral tilt
+ *-------------------------------------------------------------------*/
+
+/*! r: spectral tilt value */
+
+/*-------------------------------------------------------------------*
+ * IGF_getTNR()
+ *
+ * calculates tonal-to-noise ratio
+ *-------------------------------------------------------------------*/
+
+/*! r: spectral tilt value */
+/* Returns value with exponent as 9 and Q as 22*/
+
+static Word32 IGF_getTNR_ivas_fx(
+ const Word32 *powerSpectrum, /* i : energies */
+ const Word16 start, /* i : start subband index */
+ const Word16 stop, /* i : stop subband index */
+ const Word16 adap, /* i : SFB width adaptation */
+ Word16 *e_ps, /*Stores exponent for powerSpectrum*/
+ Word16 e_adap /*Stores exponent for adap*/
+)
+{
+ Word16 i;
+ Word16 width;
+ Word32 avg;
+ Word32 tonal;
+ Word16 tonal_e; /* holds exp for tonal*/
+ Word32 noise;
+ Word16 noise_e; /* holds exp for noise*/
+ Word32 tonalToNoise;
+ Word32 rootSpec[300];
+ Word16 rootSpec_e[300]; /*rootSpec_e[i] holds exp for rootSpec[i]*/
+ Word16 avg_e; /* holds exp for avg*/
+ Word16 tmp_e;
+ avg = 0;
+ tonal = 0;
+ noise = EPSILON_FX;
+ tonal_e = 0;
+ noise_e = 0;
+ avg_e = 0;
+ tmp_e = 0;
+ move32();
+ move32();
+ move32();
+ move16();
+ move16();
+ move16();
+ move16();
+
+ set32_fx( rootSpec, 0, 300 );
+ set16_fx( rootSpec_e, 0, 300 );
+
+ width = sub( stop, start );
+ FOR( i = start; i < stop; i++ )
+ {
+ rootSpec_e[( i - start )] = e_ps[i];
+ move16();
+ rootSpec[( i - start )] = Sqrt32( powerSpectrum[i], &rootSpec_e[( i - start )] ); /*rootSpec[i - start] = sqrtf( powerSpectrum[i] );*/
+ move32();
+ avg = BASOP_Util_Add_Mant32Exp( avg, avg_e, rootSpec[( i - start )], rootSpec_e[( i - start )], &avg_e ); /*avg += rootSpec[i - start];resultant exponent is avg_e*/
+ }
+ avg = BASOP_Util_Divide3216_Scale( avg, width, &tmp_e ); /*avg /= width;*/
+ avg_e = add( 16, sub( add( avg_e, tmp_e ), 15 ) );
+
+ FOR( i = start; i < stop; i++ )
+ {
+ Word16 normSpec_e; /*stores resultant exponent for normSpec*/
+ Word16 normSpec = BASOP_Util_Divide3232_Scale( rootSpec[i - start], avg, &normSpec_e ); /*rootSpec[i - start] / avg;*/
+ normSpec_e = add( normSpec_e, sub( rootSpec_e[i - start], avg_e ) );
+ IF( GT_32( normSpec, L_add_sat( L_shl_sat( 1, sub( 15, normSpec_e ) ), L_shl_sat( adap, sub( e_adap, normSpec_e ) ) ) ) )
+ {
+ tonal = BASOP_Util_Add_Mant32Exp( tonal, tonal_e, rootSpec[( i - start )], rootSpec_e[( i - start )], &tonal_e ); /*tonal += rootSpec[i - start];*/
+ }
+ ELSE IF( LT_32( normSpec, L_shl_sat( 1, sub( 15, normSpec_e ) ) ) )
+ {
+ noise = BASOP_Util_Add_Mant32Exp( noise, noise_e, rootSpec[( i - start )], rootSpec_e[( i - start )], &noise_e ); /*noise += rootSpec[i - start];*/
+ }
+ }
+
+ /*tonalToNoise = 20.f * log10f( max( 1e-018f, tonal / noise ) )*/
+ IF( noise == 0 ) // To handle condition if denom = 0
+ {
+ tonalToNoise = imult3216( L_shr( L_add( L_shl( 18 /* log10f(1e-018f) */, Q25 ), Mpy_32_16_1( L_add( BASOP_Util_Log2( tonal ), L_shl( tonal_e, Q25 ) ) /*Q25*/, INV_Log2_10_Q15 ) /*25+15-15*/ ), 3 ) /*Q22*/, 20 );
+ }
+ ELSE
+ {
+ Word16 temp = BASOP_Util_Divide3232_Scale( tonal, noise, &tmp_e ); /*tonal / noise*/
+ tmp_e = add( tmp_e, sub( tonal_e, noise_e ) );
+ IF( GE_16( temp, 1 ) )
+ {
+ tonalToNoise = imult3216( Mult_32_16( L_add( BASOP_Util_Log2( temp ), L_shl( add( 16, tmp_e ), Q25 ) ) /*Q25*/, INV_Log2_10_Q12 ) /*25+12-15*/, 20 ); /*Q22*/
+ }
+ ELSE
+ {
+ tonalToNoise = -1509949440; /*-360.f Q22*/
+ move32();
+ }
+ }
+
+ return tonalToNoise;
+}
+
+/*-------------------------------------------------------------------*
+ * IGF_CalculateEnvelope()
+ *
+ * envelope estimation
+ *-------------------------------------------------------------------*/
+
+static void IGF_CalculateEnvelope_ivas_fx(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
+ Word32 *pMDCTSpectrum_fx, /* i : MDCT spectrum */
+ Word16 e_mdct, /* i : exp of MDCT spectrum */
+ Word32 *pPowerSpectrum_fx, /* i : MDCT^2 + MDST^2 spectrum, or estimate */
+ Word16 *e_ps, /* i : exp of power spectrum */
+ const Word16 igfGridIdx, /* i : IGF grid index */
+ const Word16 isTransient, /* i : flag indicating if transient is detected */
+ const Word16 last_core_acelp, /* i : indicator if last frame was ACELP core */
+ const Word16 element_mode, /* i : IVAS element_mode */
+ const Word16 att /* i : attenuation */
+)
+{
+ IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
+ H_IGF_GRID hGrid;
+ Word16 *swb_offset;
+ Word16 sfb; /* this is the actual scalefactor band */
+ Word16 width; /* this is width in subbands of the actual scalefactor band */
+ Word16 tile_idx;
+ Word16 strt_cpy;
+ Word32 gain; /* the gain which has to be applied to the source tile to get the destination energy */
+ Word16 sb;
+ Word32 sfbEnergyR;
+ Word32 sfbEnergyC; /* the energy of the destination region of the tile */
+ Word32 sfbEnergyTileR;
+ Word32 sfbEnergyTileC; /* the energy of the destination region of the tile */
+ Word16 tmp, x, y;
+ Word16 mean_x_fx, mean_y_fx;
+ Word32 mean_xy_fx, mean_x2_fx;
+ Word16 tmp_tb;
+ Word16 tmp_sb;
+ Word16 sfbCnt;
+ Word16 sfm;
+ Word16 crest;
+ Word16 temp;
+ Word16 mean_x_e, mean_y_e; /*Stores exponent for mean_x and mean_y respectively*/
+ Word16 mean_xy_e, mean_x2_e; /*stores exponent for mean_xy and mean_x2 respectively*/
+ Word16 sfbEnergyTileR_e; /*Exponent for sfbEnergyTileR*/
+ Word16 sfbEnergyTileC_e; /*Exponent for sfbEnergyTileC*/
+ Word16 sfbEnergyC_e; /*Exponent for sfbEnergyC*/
+ Word16 sfbEnergyR_e;
+ Word16 gain_e; /*exponent for gain*/
+ Word16 tmp_tb_e; /*Stores exponent for tmp_tb*/
+ Word16 tmp_sb_e; /*stores exponent for tmp_sb*/
+ Word16 crest_exp; /*Stores the exponent of the result(return value)*/
+ Word16 sfm_exp; /*stores exponent for ouput from sfm*/
+ Word16 tmp_e;
+
+ hPrivateData = &hIGFEnc->igfData;
+ hGrid = &hPrivateData->igfInfo.grid[(Word16) igfGridIdx];
+ swb_offset = hGrid->swb_offset;
+
+ IF( element_mode > EVS_MONO )
+ {
+ IF( igfGridIdx != IGF_GRID_LB_NORM )
+ {
+ FOR( sfbCnt = 0; sfbCnt < sub( hGrid->sfbWrap[hGrid->nTiles], hGrid->sfbWrap[0] ); sfbCnt++ )
+ {
+ /* reset filter */
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_TB_e[sfbCnt]
+ hPrivateData->prevSFB_FIR_TB_e[sfbCnt] = 0;
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_TB_e[sfbCnt]
+ hPrivateData->prevSFB_IIR_TB_e[sfbCnt] = 0;
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_SB_e[sfbCnt]
+ hPrivateData->prevSFB_FIR_SB_e[sfbCnt] = 0;
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_SB_e[sfbCnt]
+ hPrivateData->prevSFB_IIR_SB_e[sfbCnt] = 0;
+ hPrivateData->prevDampingFactor_IIR_fx[sfbCnt] = MIN16B; /* -1.f in Q15*/
+ hPrivateData->prevDampingFactor_IIR_e[sfbCnt] = 0;
+ hPrivateData->dampingFactorSmoothing[sfbCnt] = 2;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ }
+ }
+
+ IF( pPowerSpectrum_fx )
+ {
+ FOR( sb = hGrid->sbWrap[0]; sb < swb_offset[hGrid->sfbWrap[hGrid->nTiles]]; sb++ )
+ {
+ IF( LT_32( 1, pPowerSpectrum_fx[sb] ) )
+ {
+ hPrivateData->logSpec[sb] = s_max( 0, extract_l( W_extract_l( W_shr( W_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), W_shl( e_ps[sb], Q25 ) ), Q25 ) ) ) );
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->logSpec[sb] = 0;
+ move16();
+ }
+ }
+ }
+
+ FOR( tile_idx = 0; tile_idx < hGrid->nTiles; tile_idx++ )
+ {
+ strt_cpy = hGrid->sbWrap[tile_idx];
+ move16();
+
+ FOR( sfb = hGrid->sfbWrap[tile_idx]; sfb < hGrid->sfbWrap[tile_idx + 1]; sfb++ )
+ {
+ width = sub( swb_offset[sfb + 1], swb_offset[sfb] );
+ sfbEnergyTileR = EPSILON_FIX;
+ sfbEnergyTileC = EPSILON_FIX;
+ sfbEnergyC = EPSILON_FX;
+ sfbEnergyTileR_e = 0;
+ sfbEnergyTileC_e = 0;
+ sfbEnergyC_e = 0;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+
+ IF( pPowerSpectrum_fx != NULL )
+ {
+ tmp = strt_cpy;
+ move16();
+ FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
+ {
+ Word16 shift = norm_l( pPowerSpectrum_fx[sb] );
+ sfbEnergyC = BASOP_Util_Add_Mant32Exp( sfbEnergyC, sfbEnergyC_e, L_shl( pPowerSpectrum_fx[sb], shift ), sub( e_ps[sb], shift ), &sfbEnergyC_e );
+ // sfbEnergyTileR = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR, sfbEnergyTileR_e, Mult_32_32( pMDCTSpectrum_fx[strt_cpy], pMDCTSpectrum_fx[strt_cpy] ), shl( e_mdct, 1 ), &sfbEnergyTileR_e );
+ Word64 tmp64 = W_mult_32_32( pMDCTSpectrum_fx[strt_cpy], pMDCTSpectrum_fx[strt_cpy] );
+ Word16 tmp64_e = W_norm( tmp64 );
+ tmp64 = W_shl( tmp64, tmp64_e );
+
+ sfbEnergyTileR = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR, sfbEnergyTileR_e, W_extract_h( tmp64 ), shl( e_mdct, 1 ) - tmp64_e, &sfbEnergyTileR_e );
+ shift = norm_l( pPowerSpectrum_fx[strt_cpy] );
+ sfbEnergyTileC = BASOP_Util_Add_Mant32Exp( sfbEnergyTileC, sfbEnergyTileC_e, L_shl( pPowerSpectrum_fx[strt_cpy], shift ), sub( e_ps[strt_cpy], shift ), &sfbEnergyTileC_e );
+
+ strt_cpy = add( strt_cpy, 1 );
+ }
+
+ sfbEnergyTileR = L_deposit_h( BASOP_Util_Divide3232_Scale( sfbEnergyTileR, width, &tmp_e ) );
+ sfbEnergyTileR_e = add( sub( sfbEnergyTileR_e, Q31 ), tmp_e );
+
+ IF( sfbEnergyTileR == 0 )
+ {
+ sfbEnergyTileR = EPSILON_FX;
+ sfbEnergyTileR_e = 0;
+ move32();
+ move16();
+ }
+ IF( sfbEnergyC == 0 )
+ {
+ sfbEnergyC = EPSILON_FX;
+ sfbEnergyC_e = 0;
+ move32();
+ move16();
+ }
+ IF( sfbEnergyTileC == 0 )
+ {
+ sfbEnergyTileC = EPSILON_FX;
+ sfbEnergyTileC_e = 0;
+ temp = BASOP_Util_Divide3232_Scale( sfbEnergyC, sfbEnergyTileC, &tmp_e );
+ tmp_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) );
+ move32();
+ move16();
+ }
+ ELSE
+ {
+ /*gain = (float) ( sfbEnergyTileR * ( sfbEnergyC / sfbEnergyTileC ) );*/
+ temp = BASOP_Util_Divide3232_Scale( sfbEnergyC, sfbEnergyTileC, &tmp_e );
+ tmp_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) );
+ }
+
+ gain = Mult_32_16( sfbEnergyTileR, temp ); // gain_e
+ gain_e = add( tmp_e, sfbEnergyTileR_e );
+
+ IF( element_mode > EVS_MONO )
+ {
+ test();
+ IF( !isTransient )
+ {
+ Word16 diffSFM;
+ Word16 shiftedSFM = 0;
+ Word16 shiftedSFM_e = 0;
+ move16();
+ move16();
+
+ // tmp_tb = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] ) / IGF_getCrest_new( hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1] );
+ sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1], e_ps );
+ sfm_exp = 0;
+ move16();
+ crest = IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb], swb_offset[sfb + 1], &crest_exp );
+ tmp_tb = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); // tmp_tb_e
+ tmp_tb_e = add( tmp_e, sub( sfm_exp, crest_exp ) );
+
+ // tmp_sb = IGF_getSFM_new( pPowerSpectrum, hPrivateData->logSpec, tmp, strt_cpy ) / IGF_getCrest_new( hPrivateData->logSpec, tmp, strt_cpy );
+ sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, tmp, strt_cpy, e_ps );
+ crest = IGF_getCrest_new_fx( hPrivateData->logSpec, tmp, strt_cpy, &crest_exp );
+ tmp_sb = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e ); // tmp_sb_e
+ tmp_sb_e = add( tmp_e, sub( sfm_exp, crest_exp ) );
+
+ test();
+ IF( last_core_acelp || hPrivateData->wasTransient )
+ {
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = tmp_tb; /*Exponent for hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] : hPrivateData->prevSFB_FIR_TB_e[sfb] and hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] : hPrivateData->prevSFB_IIR_TB_e[sfb] */
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = tmp_sb; /*Exponent for hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] : hPrivateData->prevSFB_FIR_SB_e[sfb] and hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] : hPrivateData->prevSFB_IIR_SB_e[sfb] */
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = hPrivateData->prevSFB_IIR_TB_e[sfb] = tmp_tb_e;
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = hPrivateData->prevSFB_IIR_SB_e[sfb] = tmp_sb_e;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+
+ tmp_tb = shr( tmp_tb, 2 ); /*taking 2 guard bits so it's exponent tmp_sb_e=+2*/
+ tmp_sb = shr( tmp_sb, 2 ); /*taking 2 guard bits so it's exponent tmp_tb_e=+2 */
+ tmp_sb_e = add( tmp_sb_e, 2 );
+ tmp_tb_e = add( tmp_tb_e, 2 );
+
+ Word16 tmp0, tmp2, tmp3, tmp4;
+ Word16 tmp0_e, tmp2_e, tmp3_e, tmp4_e;
+ tmp0 = shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], 2 );
+ tmp0_e = add( hPrivateData->prevSFB_FIR_TB_e[sfb], 2 );
+ move16();
+ tmp2 = shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], 2 );
+ tmp2_e = add( hPrivateData->prevSFB_IIR_TB_e[sfb], 2 );
+ move16();
+ tmp3 = shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], 2 );
+ tmp3_e = add( hPrivateData->prevSFB_FIR_SB_e[sfb], 2 );
+ move16();
+ tmp4 = shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], 2 );
+ tmp4_e = add( hPrivateData->prevSFB_IIR_SB_e[sfb], 2 );
+ move16();
+ Word16 x1, x2;
+
+ Word16 x1_e = BASOP_Util_Add_MantExp( tmp0, tmp0_e, tmp2, tmp2_e - 1, &x1 );
+ Word16 x2_e = BASOP_Util_Add_MantExp( tmp3, tmp3_e, tmp4, tmp4_e - 1, &x2 );
+ hPrivateData->sfb_tb_e[sfb] = BASOP_Util_Add_MantExp( tmp_tb, tmp_tb_e, x1, x1_e, &hPrivateData->SFM_tb_fx[sfb] ); // hPrivateData->sfb_sb_e[sfb]
+ move16();
+ BASOP_Util_Add_MantExp( 22118, 2, negate( hPrivateData->SFM_tb_fx[sfb] ), hPrivateData->sfb_tb_e[sfb], &tmp );
+
+ IF( tmp < 0 )
+ {
+ hPrivateData->sfb_tb_e[sfb] = 2;
+ hPrivateData->SFM_tb_fx[sfb] = 22118;
+ move16();
+ move16();
+ }
+
+ hPrivateData->sfb_sb_e[sfb] = BASOP_Util_Add_MantExp( tmp_sb, tmp_sb_e, x2, x2_e, &hPrivateData->SFM_sb_fx[sfb] ); // hPrivateData->sfb_tb_e[sfb]
+ move16();
+ BASOP_Util_Add_MantExp( 22118, 2, negate( hPrivateData->SFM_sb_fx[sfb] ), hPrivateData->sfb_sb_e[sfb], &tmp );
+
+ IF( tmp < 0 )
+ {
+ hPrivateData->sfb_sb_e[sfb] = 2;
+ hPrivateData->SFM_sb_fx[sfb] = 22118;
+ move16();
+ move16();
+ }
+
+ BASOP_Util_Add_MantExp( hPrivateData->SFM_sb_fx[sfb], hPrivateData->sfb_sb_e[sfb], negate( hPrivateData->SFM_tb_fx[sfb] ), hPrivateData->sfb_tb_e[sfb], &diffSFM );
+
+ test();
+ IF( diffSFM > 0 && LT_32( hPrivateData->SFM_tb_fx[sfb], L_shr( 3277 /*0.1 Q15*/, hPrivateData->sfb_tb_e[sfb] ) ) ) /* check whether target SFB is more tonal than source SFB */
+ {
+ Word16 currDampingFactor, dampingFactor;
+ Word16 slope, threshold;
+ Word16 alpha;
+ Word16 slope_e, threshold_e, currDampingFactor_e, dampingFactor_e, alpha_e;
+
+ /* calculate spectral tilt to detect sudden drops (or increases) in energy in the current SFB */
+ // slope = IGF_getTilt_fx( pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1], e_ps, &slope_e );
+
+ x = 1;
+ mean_x_fx = mean_y_fx = 0;
+ Word32 mean_y_fx_tmp = 0;
+ move32();
+ mean_xy_fx = mean_x2_fx = 0;
+ mean_x_e = 15;
+ mean_xy_e = mean_y_e = mean_x2_e = 31;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+
+ FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
+ {
+ mean_x_fx = add( mean_x_fx, x ); /*Q0*/
+ mean_x2_fx = L_add( mean_x2_fx, L_mult0( x, x ) ); /*Q0*/
+
+ /*y = 20.f * log10f( max( 1.f, powerSpectrum[i] ) );*/
+ IF( LE_64( W_deposit32_l( pPowerSpectrum_fx[sb] ), W_shl( 1, ( sub( 31, e_ps[sb] ) ) ) ) )
+ {
+ y = 0;
+ move16();
+ }
+ ELSE
+ {
+ y = imult1616( 20, extract_l( L_shr( Mult_32_16( ( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( e_ps[sb], Q25 ) ) ), INV_Log2_10_Q15 ), Q25 ) ) ); /*Q0*/
+ }
+ mean_y_fx_tmp = L_mac0( mean_y_fx_tmp, y, 1 ); /*Q0*/
+ mean_xy_fx = L_add( mean_xy_fx, L_mult0( y, x ) ); /*Q0*/
+
+ x = add( x, 1 );
+ }
+ mean_y_fx = BASOP_Util_Divide3216_Scale( mean_y_fx_tmp, width, &tmp_e ); /* mean_y_e*/
+
+ mean_y_e = add( mean_y_e, sub( tmp_e, 15 ) );
+ mean_x_fx = BASOP_Util_Divide1616_Scale( mean_x_fx, width, &tmp_e ); /* mean_x_e*/
+ mean_x_e = add( mean_x_e, sub( tmp_e, 15 ) );
+ mean_xy_fx = BASOP_Util_Divide3216_Scale( mean_xy_fx, width, &tmp_e ); /* mean_xy_e*/
+ mean_xy_e = add( mean_xy_e, sub( tmp_e, 15 ) );
+ mean_x2_fx = BASOP_Util_Divide3216_Scale( mean_x2_fx, width, &tmp_e ); /* mean_x2_e*/
+ mean_x2_e = add( mean_x2_e, sub( tmp_e, 15 ) );
+
+ /*slope = ( mean_xy - mean_x * mean_y ) / ( mean_x2 - mean_x * mean_x );*/
+ slope = BASOP_Util_Divide3232_Scale( ( L_sub( mean_xy_fx, L_shl( mult( mean_x_fx, mean_y_fx ), sub( add( mean_x_e, mean_y_e ), mean_xy_e ) ) ) ), ( L_sub( mean_x2_fx, L_shl( mult( mean_x_fx, mean_x_fx ), sub( add( mean_x_e, mean_x_e ), mean_x2_e ) ) ) ), &slope_e );
+ slope_e = add( slope_e, sub( mean_xy_e, mean_x2_e ) );
+
+ /* determine whether strong tilt is due to a step in the spectrum (e.g. band limitation, no damping)
+ or a tonal component close the band border (apply damping) by calculating SFM for a shift of 1/2 SFB width*/
+ threshold = BASOP_Util_Divide1616_Scale( 60, width, &threshold_e );
+
+ test();
+ IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope, add( slope_e, 16 ), negate( threshold ), add( threshold_e, 16 ) ), -1 ) )
+ {
+ Word16 shift = shr( width, 1 );
+ sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift, e_ps );
+ crest = IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift, &crest_exp );
+ shiftedSFM = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
+ }
+ ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope, add( slope_e, 16 ), threshold, add( threshold_e, 16 ) ), 1 ) && ( NE_16( sfb, sub( hGrid->sfbWrap[hGrid->nTiles], 1 ) ) ) )
+ {
+ Word16 shift = shr( width, 1 );
+ shiftedSFM = BASOP_Util_Divide1616_Scale( IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, e_ps ), IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, &crest_exp ), &tmp_e );
+ sfm = IGF_getSFM_new_fx( pPowerSpectrum_fx, hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, e_ps );
+ crest = IGF_getCrest_new_fx( hPrivateData->logSpec, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift, &crest_exp );
+ shiftedSFM = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
+ }
+ shiftedSFM_e = add( shiftedSFM_e, sub( sfm_exp, crest_exp ) );
+
+ IF( GT_32( shiftedSFM, L_shl( 1311 /*0.04f Q15*/, negate( shiftedSFM_e ) ) ) )
+ {
+ currDampingFactor = 32767; /*1.f Q15*/
+ currDampingFactor_e = 0;
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ // alpha = min( 320.f / (float) swb_offset[sfb + 1], 1.25f );
+ temp = BASOP_Util_Divide1616_Scale( 320, swb_offset[sfb + 1], &alpha_e );
+ alpha = extract_l( L_min( temp, L_shl( 20480 /*1.25 Q14*/, sub( 1, alpha_e ) ) ) ); // alpha_e
+
+ // currDampingFactor = expf( 1.25f * alpha * logf( hPrivateData->SFM_tb[sfb] / hPrivateData->SFM_sb[sfb] ) );
+ temp = BASOP_Util_Divide1616_Scale( hPrivateData->SFM_tb_fx[sfb], hPrivateData->SFM_sb_fx[sfb], &tmp_e ); // tmp_e
+ tmp_e = add( tmp_e, sub( hPrivateData->sfb_tb_e[sfb], hPrivateData->sfb_sb_e[sfb] ) );
+ Word16 temp1 = mult( 20480 /* 1.25f in Q14 */, alpha );
+ Word16 tmp1_e = add( 1, alpha_e );
+ currDampingFactor = round_fx( BASOP_util_Pow2( Mpy_32_16_1( L_add( BASOP_Util_Log2( temp ), L_shl_sat( add( 16, tmp_e ), 25 ) ), temp1 ), add( tmp1_e, 6 ), &currDampingFactor_e ) ); // currDampingFactor_e
+
+ /* calculate tonal-to-noise ratio and reduce damping for low values*/
+
+ Word32 tonalToNoise;
+ Word16 adap;
+ Word16 adap_e; /*stores exp for adap*/
+ Word16 tonalToNoise_e; /*stores exponent for tonalToNoise*/
+ tonalToNoise_e = 9;
+ move16();
+ adap = BASOP_Util_Divide1616_Scale( width, 40, &adap_e );
+ tonalToNoise = IGF_getTNR_ivas_fx( pPowerSpectrum_fx, swb_offset[sfb], swb_offset[sfb + 1], adap, e_ps, adap_e ); /*Q22*/
+
+ IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( tonalToNoise, tonalToNoise_e, L_add( L_shl( 10, sub( 15, adap_e ) ), adap ), add( 16, adap_e ) ), -1 ) )
+ {
+ // currDampingFactor += 0.03f * ( ( 10 + adap ) - tonalToNoise );
+ Word32 temp2 = BASOP_Util_Add_Mant32Exp( L_add( L_shl( 10, sub( 15, adap_e ) ) /*exp:adap_e*/, adap ), add( adap_e, 16 ), L_negate( tonalToNoise ), tonalToNoise_e, &tmp_e ); // tmp_e
+ currDampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor, currDampingFactor_e, extract_l( Mult_32_32( 983 /*0.03f Q15*/, temp2 ) ), tmp_e, &currDampingFactor ); // currDampingFactor_e
+ }
+ }
+
+ Word32 L_tmp = hPrivateData->prevDampingFactor_IIR_fx[sfb];
+ move32();
+ L_tmp = L_shl( L_tmp, hPrivateData->prevDampingFactor_IIR_e[sfb] );
+ test();
+ test();
+ IF( last_core_acelp || hPrivateData->wasTransient || EQ_32( L_tmp, MIN16B ) )
+ {
+ tmp = BASOP_Util_Cmp_Mant32Exp( currDampingFactor, currDampingFactor_e, 3277 /* 0.1f in Q15 */, 0 );
+ IF( tmp >= 0 )
+ {
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = currDampingFactor;
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = currDampingFactor_e;
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = 3277; /* 0.1 in Q15 */
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
+ move16();
+ move16();
+ }
+ }
+ IF( last_core_acelp )
+ {
+ hPrivateData->dampingFactorSmoothing[sfb] = 2;
+ move16();
+ }
+
+ dampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor, currDampingFactor_e, hPrivateData->prevDampingFactor_IIR_fx[sfb], hPrivateData->prevDampingFactor_IIR_e[sfb], &dampingFactor ); // dampingFactor_e
+ dampingFactor = shr( dampingFactor, 1 );
+
+ gain = Mult_32_16( gain, shl_sat( extract_l( L_min( L_add( dampingFactor, Mult_32_16( L_shl( hPrivateData->dampingFactorSmoothing[sfb], sub( 15, dampingFactor_e ) ) /*Q:15-dampingFactor_e*/, 3277 /*0.1f Q15*/ ) /*Q:15-dampingFactor_e*/ ), shl_sat( 1, sub( 15, dampingFactor_e ) ) ) ), dampingFactor_e ) /*Q15*/ );
+
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = dampingFactor;
+ move16();
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = dampingFactor_e;
+ move16();
+ if ( hPrivateData->dampingFactorSmoothing[sfb] > 0 )
+ {
+ hPrivateData->dampingFactorSmoothing[sfb] = sub( hPrivateData->dampingFactorSmoothing[sfb], 1 );
+ move16();
+ }
+ }
+ ELSE
+ {
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = MIN16B; // exponent : hPrivateData->prevDampingFactor_IIR_e[sfb]
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
+ hPrivateData->dampingFactorSmoothing[sfb] = 1;
+ move16();
+ move16();
+ move16();
+ }
+
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = tmp_tb; // hPrivateData->prevSFB_FIR_TB_e[sfb]
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = tmp_tb_e;
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = hPrivateData->SFM_tb_fx[sfb]; // hPrivateData->prevSFB_IIR_TB_e[sfb]
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = hPrivateData->sfb_tb_e[sfb];
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = tmp_sb; // hPrivateData->prevSFB_FIR_SB_e[sfb]
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = tmp_sb_e;
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = hPrivateData->SFM_sb_fx[sfb]; // hPrivateData->prevSFB_IIR_SB_e[sfb]
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = hPrivateData->sfb_sb_e[sfb];
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_FIR_TB_e[sfb]
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_SB_e[sfb]
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = MIN16B; /* hPrivateData->prevDampingFactor_IIR_e[sfb]*/
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
+ hPrivateData->dampingFactorSmoothing[sfb] = 2;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ }
+ }
+ ELSE
+ {
+ tmp_e = e_mdct;
+ move16();
+ sfbEnergyR = add_sat( EPSILON_FX, BASOP_Util_Divide3216_Scale( sum2_32_fx( pMDCTSpectrum_fx + swb_offset[sfb], width, &tmp_e ) /*exp: tmp_e*/, width, &sfbEnergyR_e ) ); // sfbEnergyR_e
+ sfbEnergyR_e = add( sfbEnergyR_e, add( tmp_e, -15 ) );
+ gain = L_shl( sfbEnergyR, 16 ); // gain_e
+ move32();
+ gain_e = sfbEnergyR_e;
+
+ IF( element_mode > EVS_MONO )
+ {
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_FIR_TB_e[sfb]
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_TB_e[sfb]
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0; // hPrivateData->prevSFB_IIR_SB_e[sfb]
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = MIN16B; /* hPrivateData->prevDampingFactor_IIR_e[sfb]*/
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
+ hPrivateData->dampingFactorSmoothing[sfb] = 2;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ }
+
+ gain = Mult_32_16( gain, att ); // gain_e
+ gain_e = add( gain_e, 0 );
+
+ /*gain=0.5f+log2f(gain)*2+16 becuase 2.885390081777927f=2*1/loge(2) so 2*1/loge(2)*loge(x) can be written as 2*log2(x)*/
+ gain = L_add( ONE_IN_Q22, L_add( L_add( L_shr( BASOP_Util_Log2( gain ), 1 ), L_shl( gain_e, Q24 ) ), L_shl( 16, Q23 ) ) ); /*Q23*/
+ test();
+ test();
+ IF( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) )
+ {
+ gain = L_add( gain, ONE_IN_Q21 ); /* better preservation of original HF band energy */
+ }
+ test();
+ test();
+ IF( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_64000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_64000_CPE ) ) )
+ {
+ gain = L_add( gain, ONE_IN_Q20 );
+ }
+ gain = L_min( gain, 91 << Q23 ); /* 13+15+63, see arithcode encode residual */
+ gain = L_max( gain, 0 );
+ gain_e = 8; /* stores exponent for gain_fx*/
+ move16();
+ hPrivateData->igfScfQuantized[sfb] = extract_l( L_shr( gain, Q23 ) ); /*Q0*/
+ move16();
+ }
+ }
+
+ return;
+}
+
+/*-------------------------------------------------------------------*
+ * IGF_CalculateStereoEnvelope_fx()
+ *
+ * envelope estimation
+
+ *-------------------------------------------------------------------*/
+static void IGF_CalculateStereoEnvelope_fx(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
+ const Word32 *pMDCTSpectrum_fx, /* i : MDCT spectrum */
+ Word16 pMDCTSpectrum_e, /* i : exponent for pMDCTSpectrum_fx */
+ const Word32 *pMDCTSpectrumMsInv_fx, /* i : MDCT spectrum */
+ Word16 pMDCTSpectrumMsInv_e, /* i : expontent for pMDCTSpectrumMsInv_fx */
+ const Word32 *pPowerSpectrum_fx, /* i : MDCT^2 + MDST^2 spectrum, or estimate */
+ Word16 *pPowerSpectrum_e, /* i : exponent for pPowerSpectrum_fx */
+ const Word32 *pPowerSpectrumMsInv_fx, /* i : inverse power spectrum */
+ Word16 *q_pPowerSpectrumMsInv, /* i : Q for pPowerSpectrumMsInv_fx */
+ const Word16 igfGridIdx, /* i : IGF grid index */
+ const Word16 coreMsMask[N_MAX], /* i : line wise ms Mask */
+ const Word16 isTransient, /* i : flag indicating if transient is detected */
+ const Word16 last_core_acelp, /* i : indicator if last frame was ACELP core */
+ const Word16 mct_on )
+{
+ IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
+ H_IGF_GRID hGrid;
+ Word16 *swb_offset;
+ Word16 sfb; /* this is the actual scalefactor band */
+ Word16 width; /* this is width in subbands of the actual scalefactor band */
+ Word16 tile_idx;
+ Word16 strt_cpy;
+ Word32 gain_fx; /* the gain which has to be applied to the source tile to get the destination energy */
+ Word16 sb;
+ Word16 sfbEnergyR_fx;
+ Word32 sfbEnergyC_fx; /* the energy of the destination region of the tile */
+ Word32 sfbEnergyTileR_fx;
+ Word32 sfbEnergyTileC_fx; /* the energy of the destination region of the tile */
+ Word16 tmp, x, y;
+ Word16 mean_x_fx, mean_y_fx;
+ Word32 mean_xy_fx, mean_x2_fx;
+ Word16 slope_fx;
+ Word16 tmp_tb_fx;
+ Word16 tmp_sb_fx;
+ Word16 sfbCnt;
+ Word32 tileSrcSpec_fx[MAX_IGF_SFB_LEN];
+ Word16 sfm;
+ Word16 crest;
+ Word16 temp;
+ Word16 mean_x_e, mean_y_e; /*Stores exponent for mean_x and mean_y respectively*/
+ Word16 mean_xy_e, mean_x2_e; /*stores exponent for mean_xy and mean_x2 respectively*/
+ Word16 tileSrcSpec_e[MAX_IGF_SFB_LEN]; /*Exponent for tileSrcSpec_fx*/
+ Word16 sfbEnergyTileR_e; /*Exponent for sfbEnergyTileR_fx*/
+ Word16 sfbEnergyTileC_e; /*Exponent for sfbEnergyTileC_fx*/
+ Word16 sfbEnergyC_e; /*Exponent for sfbEnergyC_fx*/
+ Word16 gain_e; /*exponent for gain_fx*/
+ Word16 crest_exp; /*stores exponent for output from crest*/
+ Word16 sfm_exp; /*stores exponent for ouput from sfm*/
+ Word16 tmp_tb_e; /*Stores exponent for tmp_tb_fx*/
+ Word16 tmp_sb_e; /*stores exponent for tmp_sb_fx*/
+ Word16 slope_e; /*stores exponent for slope_fx*/
+ Word16 sfbEnergyR_e; /*stores exponent for sfbEnergyR*/
+ Word16 tmp_e;
+ Word32 temp_pPowerSpectrumMsInv[N_MAX], length;
+ Word16 q_temp_pPowerSpectrumMsInv = Q31, i;
+ move16();
+
+ IF( pPowerSpectrumMsInv_fx != NULL )
+ {
+ length = N_MAX;
+ move16();
+ if ( mct_on )
+ {
+ length = L_FRAME48k;
+ move16();
+ }
+ FOR( i = 0; i < length; i++ )
+ {
+ IF( pPowerSpectrumMsInv_fx[i] != 0 )
+ {
+ q_temp_pPowerSpectrumMsInv = s_min( q_temp_pPowerSpectrumMsInv, add( q_pPowerSpectrumMsInv[i], norm_l( pPowerSpectrumMsInv_fx[i] ) ) );
+ }
+ }
+ FOR( i = 0; i < length; i++ )
+ {
+ temp_pPowerSpectrumMsInv[i] = L_shl( pPowerSpectrumMsInv_fx[i], sub( q_temp_pPowerSpectrumMsInv, q_pPowerSpectrumMsInv[i] ) );
+ move32();
+ }
+ }
+
+ hPrivateData = &hIGFEnc->igfData;
+ hGrid = &hPrivateData->igfInfo.grid[(Word16) igfGridIdx];
+ swb_offset = hGrid->swb_offset;
+ move16();
+
+ IF( igfGridIdx != IGF_GRID_LB_NORM )
+ {
+ FOR( sfbCnt = 0; sfbCnt < sub( hGrid->sfbWrap[hGrid->nTiles], hGrid->sfbWrap[0] ); sfbCnt++ )
+ {
+ /* reset filter */
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_TB_e[sfbCnt]
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_TB_e[sfbCnt]
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_FIR_SB_e[sfbCnt]
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfbCnt] = 0; // exponent : hPrivateData->prevSFB_IIR_SB_e[sfbCnt]
+ hPrivateData->prevSFB_FIR_TB_e[sfbCnt] = 0;
+ hPrivateData->prevSFB_IIR_TB_e[sfbCnt] = 0;
+ hPrivateData->prevSFB_FIR_SB_e[sfbCnt] = 0;
+ hPrivateData->prevSFB_IIR_SB_e[sfbCnt] = 0;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ }
+
+ IF( pPowerSpectrum_fx )
+ {
+ FOR( sb = hGrid->sbWrap[0]; sb < swb_offset[hGrid->sfbWrap[hGrid->nTiles]]; sb++ )
+ {
+ /*hPrivateData->logSpec[sb] = max( 0, (Word16) ( logf( max( FLT_MIN, pPowerSpectrum[sb] ) ) * INV_LOG_2 ) );*/
+ IF( LE_32( 1, pPowerSpectrum_fx[sb] ) )
+ {
+ hPrivateData->logSpec[sb] = s_max( 0, (Word16) L_shr( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( pPowerSpectrum_e[sb], Q25 ) ), 25 ) );
+ }
+ ELSE
+ {
+ hPrivateData->logSpec[sb] = 0; /*max(0,-126) is always 0*/
+ }
+ move16();
+ }
+ }
+
+ FOR( tile_idx = 0; tile_idx < hGrid->nTiles; tile_idx++ )
+ {
+ strt_cpy = hGrid->sbWrap[tile_idx];
+ move16();
+
+ FOR( sfb = hGrid->sfbWrap[tile_idx]; sfb < hGrid->sfbWrap[tile_idx + 1]; sfb++ )
+ {
+ width = sub( swb_offset[sfb + 1], swb_offset[sfb] );
+ sfbEnergyTileR_fx = EPSILON_FX;
+ sfbEnergyTileC_fx = EPSILON_FX;
+ sfbEnergyC_fx = EPSILON_FX;
+ sfbEnergyTileR_e = 0;
+ sfbEnergyTileC_e = 0;
+ sfbEnergyC_e = 0;
+ move16();
+ move16();
+ move16();
+ move32();
+ move32();
+ move32();
+ IF( pPowerSpectrum_fx )
+ {
+ Word16 final_exp;
+ Word16 norm_exp;
+ Word32 scaled_value;
+ tmp = strt_cpy;
+ move16();
+
+ FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
+ {
+ IF( NE_16( coreMsMask[sb], coreMsMask[strt_cpy] ) )
+ {
+ sfbEnergyC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyC_fx, sfbEnergyC_e, pPowerSpectrum_fx[sb], pPowerSpectrum_e[sb], &sfbEnergyC_e ); /*resultant exponent is stored in sfbEnergyC_e*/
+ norm_exp = norm_l( pMDCTSpectrumMsInv_fx[strt_cpy] );
+ final_exp = sub( pMDCTSpectrumMsInv_e, norm_exp );
+ scaled_value = L_shl( pMDCTSpectrumMsInv_fx[strt_cpy], norm_exp );
+ sfbEnergyTileR_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR_fx, sfbEnergyTileR_e, Mult_32_32( scaled_value, scaled_value ), shl( final_exp, 1 ), &sfbEnergyTileR_e ); /*resultant exponent is stored in sfbEnergyTileR_e*/
+ sfbEnergyTileC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileC_fx, sfbEnergyTileC_e, pPowerSpectrumMsInv_fx[strt_cpy], sub( 31, q_pPowerSpectrumMsInv[strt_cpy] ), &sfbEnergyTileC_e ); /*resultant exponent is stored in sfbEnergyTileC_e*/
+ tileSrcSpec_fx[strt_cpy - tmp] = temp_pPowerSpectrumMsInv[strt_cpy]; /*resultant exponent is stored in tileSrcSpec_e*/
+ tileSrcSpec_e[strt_cpy - tmp] = sub( 31, q_temp_pPowerSpectrumMsInv );
+ }
+ ELSE
+ {
+ sfbEnergyC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyC_fx, sfbEnergyC_e, pPowerSpectrum_fx[sb], pPowerSpectrum_e[sb], &sfbEnergyC_e ); /*resultant exponent is stored in sfbEnergyC_e*/
+ norm_exp = norm_l( pMDCTSpectrum_fx[strt_cpy] );
+ final_exp = sub( pMDCTSpectrum_e, norm_exp );
+ scaled_value = L_shl( pMDCTSpectrum_fx[strt_cpy], norm_exp );
+ sfbEnergyTileR_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileR_fx, sfbEnergyTileR_e, Mult_32_32( scaled_value, scaled_value ), shl( final_exp, 1 ), &sfbEnergyTileR_e ); /*resultant exponent is stored in sfbEnergyTileR_e*/
+ sfbEnergyTileC_fx = BASOP_Util_Add_Mant32Exp( sfbEnergyTileC_fx, sfbEnergyTileC_e, pPowerSpectrum_fx[strt_cpy], pPowerSpectrum_e[strt_cpy], &sfbEnergyTileC_e ); /*resultant exponent is stored in sfbEnergyTileC_e*/
+ tileSrcSpec_fx[strt_cpy - tmp] = pPowerSpectrum_fx[strt_cpy]; /*resultant exponent is stored in tileSrcSpec_e*/
+ tileSrcSpec_e[strt_cpy - tmp] = pPowerSpectrum_e[strt_cpy];
+ }
+ move32();
+ move16();
+ strt_cpy = add( strt_cpy, 1 );
+ }
+
+ sfbEnergyTileR_fx = BASOP_Util_Divide3216_Scale( sfbEnergyTileR_fx, width, &tmp_e );
+ sfbEnergyTileR_e = sub( add( sfbEnergyTileR_e, tmp_e ), 15 ); /*stores the resultant exponent for sfbEnergyTileR_fx*/
+
+ /*gain = (float) ( sfbEnergyTileR * ( sfbEnergyC / sfbEnergyTileC ) );*/
+ temp = BASOP_Util_Divide3232_Scale( sfbEnergyC_fx, L_add( sfbEnergyTileC_fx, EPSILON_FX ), &tmp_e );
+ gain_e = add( tmp_e, sub( sfbEnergyC_e, sfbEnergyTileC_e ) );
+ gain_fx = Mult_32_16( sfbEnergyTileR_fx, temp );
+ gain_e = add( 16, add( gain_e, sfbEnergyTileR_e ) ); /*stores the resultant exponent for gain_fx*/
+
+ IF( !isTransient )
+ {
+ Word16 diffSFM_fx;
+ Word16 shiftedSFM_fx;
+ Word16 shiftedSFM_e; /*stores the resultant exponent for shiftedSFM_fx*/
+ shiftedSFM_fx = 0;
+ shiftedSFM_e = 0;
+ move16();
+ move16();
+
+ // tmp_tb = IGF_getSFM_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]) / IGF_getCrest_ivas(pPowerSpectrum, swb_offset[sfb], swb_offset[sfb + 1]);
+ sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] );
+ crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, swb_offset[sfb], swb_offset[sfb + 1] );
+ tmp_tb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e );
+ tmp_tb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_tb_fx*/
+
+ // tmp_sb = IGF_getSFM_ivas(tileSrcSpec, 0, strt_cpy - tmp) / IGF_getCrest_ivas(tileSrcSpec, 0, strt_cpy - tmp);
+ sfm = IGF_getSFM_ivas_fx( &sfm_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) );
+ crest = IGF_getCrest_ivas( &crest_exp, tileSrcSpec_fx, tileSrcSpec_e, 0, sub( strt_cpy, tmp ) );
+ tmp_sb_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &tmp_e );
+ tmp_sb_e = add( tmp_e, sub( sfm_exp, crest_exp ) ); /*stores the resultant exponent for tmp_sb_fx*/
+
+ IF( last_core_acelp || hPrivateData->wasTransient )
+ {
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = tmp_tb_fx; /*Exponent for hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] values stored in hPrivateData->sfb_tb_e[sfb] */
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = tmp_sb_fx; /*Exponent for hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] values stored in hPrivateData->sfb_sb_e[sfb]*/
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = tmp_sb_e;
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = tmp_sb_e;
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = tmp_sb_e;
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = tmp_sb_e;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ /* Purpose of this block:
+ -to make the exponent of hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] equal to that of tmp_tb_fx
+ -to make the exponent of hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] and hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] equal to that of tmp_sb_fx
+ */
+ Word16 diff_sb_e; /*stores the difference of exponents for sb*/
+ Word16 diff_tb_e; /*stores the difference of exponents for tb*/
+ diff_sb_e = sub( tmp_sb_e, hPrivateData->sfb_sb_e[sfb] );
+ diff_tb_e = sub( tmp_tb_e, hPrivateData->sfb_tb_e[sfb] );
+ IF( LE_16( tmp_tb_e, hPrivateData->sfb_tb_e[sfb] ) )
+ {
+ tmp_tb_fx = shl( tmp_tb_fx, diff_tb_e );
+ tmp_tb_e = hPrivateData->sfb_tb_e[sfb];
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], diff_tb_e );
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], diff_tb_e );
+ move16();
+ move16();
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = tmp_tb_e;
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = tmp_tb_e;
+ move16();
+ move16();
+ }
+ IF( LE_16( tmp_sb_e, hPrivateData->sfb_sb_e[sfb] ) )
+ {
+ tmp_sb_fx = shl( tmp_sb_fx, diff_sb_e );
+ tmp_sb_e = hPrivateData->sfb_sb_e[sfb];
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], diff_sb_e );
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], diff_sb_e );
+ move16();
+ move16();
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = tmp_sb_e;
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = tmp_sb_e;
+ move16();
+ move16();
+ }
+ }
+ tmp_tb_fx = shr_sat( tmp_tb_fx, sub( 2, tmp_tb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
+ tmp_sb_fx = shr_sat( tmp_sb_fx, sub( 2, tmp_sb_e ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
+ hPrivateData->SFM_tb_fx[sfb] = add_sat( tmp_tb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_TB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_TB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
+ hPrivateData->SFM_tb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_tb_fx[sfb] ); /* resultant exponent stored in hPrivateData->sfb_sb_e[sfb]*/
+ hPrivateData->SFM_sb_fx[sfb] = add_sat( tmp_sb_fx, add_sat( shr( hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb], sub( 2, hPrivateData->prevSFB_FIR_SB_e[sfb] ) ), shr( hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb], sub( 3, hPrivateData->prevSFB_IIR_SB_e[sfb] ) ) ) ); /* Since we're limiting max value to 2.7f we can saturate to Q13 */
+ hPrivateData->SFM_sb_fx[sfb] = s_min( 22118 /*2.7f Q13*/, hPrivateData->SFM_sb_fx[sfb] ); /*resultant exponent stores in hPrivateData->sfb_tb_e[sfb]*/
+ move16();
+ move16();
+ move16();
+ move16();
+ hPrivateData->sfb_sb_e[sfb] = 2;
+ hPrivateData->sfb_tb_e[sfb] = 2;
+ move16();
+ move16();
+
+ diffSFM_fx = sub( hPrivateData->SFM_sb_fx[sfb], hPrivateData->SFM_tb_fx[sfb] ); /*Q13*/
+
+ test();
+ IF( diffSFM_fx > 0 && LT_16( hPrivateData->SFM_tb_fx[sfb], 819 /*0.1 Q13*/ ) ) /* check whether target SFB is more tonal than source SFB */
+ {
+ Word16 currDampingFactor_fx, dampingFactor_fx, alpha_fx;
+ Word16 threshold_e, threshold_fx, alpha_e, currDampingFactor_e, dampingFactor_e;
+ /* calculate spectral tilt to detect sudden drops (or increases) in energy in the current SFB */
+ x = 1;
+ mean_x_fx = mean_y_fx = 0;
+ mean_xy_fx = mean_x2_fx = 0;
+ mean_x_e = mean_y_e = 15;
+ mean_xy_e = mean_x2_e = 31;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ FOR( sb = swb_offset[sfb]; sb < swb_offset[sfb + 1]; sb++ )
+ {
+ mean_x_fx = add( mean_x_fx, x ); /*Q0*/
+ mean_x2_fx = L_add( mean_x2_fx, L_mult0( x, x ) ); /*Q0*/
+
+ /*y = 20 * (Word16) log10f( max( 1e-018f, pPowerSpectrum[sb] ) );*/
+ IF( LT_32( pPowerSpectrum_fx[sb], 1 ) )
+ {
+ y = 20 * ( -18 );
+ move16();
+ }
+ ELSE
+ {
+ y = imult1616( 20, extract_l( L_shr( Mult_32_16( ( L_add( BASOP_Util_Log2( pPowerSpectrum_fx[sb] ), L_shl( pPowerSpectrum_e[sb], Q25 ) ) ), INV_Log2_10_Q15 ), 25 ) ) ); /*Q0*/
+ }
+ mean_y_fx = add( mean_y_fx, y ); /*Q0*/
+ mean_xy_fx = L_add( mean_xy_fx, L_mult0( y, x ) ); /*Q0*/
+
+ x = add( x, 1 );
+ }
+ mean_y_fx = BASOP_Util_Divide1616_Scale( mean_y_fx, width, &tmp_e ); /* resultant exp stores in mean_y_e*/
+ mean_y_e = add( mean_y_e, sub( tmp_e, 15 ) );
+ mean_x_fx = BASOP_Util_Divide1616_Scale( mean_x_fx, width, &tmp_e ); /* resultant exp stores in mean_x_e*/
+ mean_x_e = add( mean_x_e, sub( tmp_e, 15 ) );
+ mean_xy_fx = BASOP_Util_Divide3216_Scale( mean_xy_fx, width, &tmp_e ); /* resultant exp stores in mean_xy_e*/
+ mean_xy_e = add( mean_xy_e, sub( tmp_e, 15 ) );
+ mean_x2_fx = BASOP_Util_Divide3216_Scale( mean_x2_fx, width, &tmp_e ); /* resultant exp stores in mean_x2_e*/
+ mean_x2_e = add( mean_x2_e, sub( tmp_e, 15 ) );
+
+ /*slope = ( mean_xy - mean_x * mean_y ) / ( mean_x2 - mean_x * mean_x );*/
+ slope_fx = BASOP_Util_Divide3232_Scale( ( L_sub( mean_xy_fx, L_shl( mult( mean_x_fx, mean_y_fx ), sub( add( mean_x_e, mean_y_e ), mean_xy_e ) ) ) ), ( L_sub( mean_x2_fx, L_shl( mult( mean_x_fx, mean_x_fx ), sub( add( mean_x_e, mean_x_e ), mean_x2_e ) ) ) ), &slope_e );
+ slope_e = add( slope_e, sub( mean_xy_e, mean_x2_e ) ); /*stores resultant exponent for slope_fx*/
+
+ /* determine whether strong tilt is due to a step in the spectrum (e.g. band limitation, no damping)
+ or a tonal component close the band border (apply damping) by calculating SFM for a shift of 1/2 SFB width*/
+ threshold_fx = BASOP_Util_Divide1616_Scale( 60, width, &threshold_e ); /*stores resultant exponent for threshold_fx*/
+ test();
+ IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope_fx, add( slope_e, 16 ), negate( threshold_fx ), add( threshold_e, 16 ) ), -1 ) )
+ {
+ Word16 shift = shr( width, 1 );
+ // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] - shift, swb_offset[sfb + 1] - shift );
+ sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) );
+ crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, sub( swb_offset[sfb], shift ), sub( swb_offset[sfb + 1], shift ) );
+ shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
+ }
+ ELSE IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( slope_fx, add( slope_e, 16 ), threshold_fx, add( threshold_e, 16 ) ), 1 ) && ( NE_16( sfb, sub( hGrid->sfbWrap[hGrid->nTiles], 1 ) ) ) )
+ {
+ Word16 shift;
+ shift = shr( width, 1 );
+ // shiftedSFM = IGF_getSFM_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift ) / IGF_getCrest_ivas( pPowerSpectrum, swb_offset[sfb] + shift, swb_offset[sfb + 1] + shift );
+ sfm = IGF_getSFM_ivas_fx( &sfm_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) );
+ crest = IGF_getCrest_ivas( &crest_exp, pPowerSpectrum_fx, pPowerSpectrum_e, add( swb_offset[sfb], shift ), add( swb_offset[sfb + 1], shift ) );
+ shiftedSFM_fx = BASOP_Util_Divide1616_Scale( sfm, crest, &shiftedSFM_e );
+ }
+ IF( shiftedSFM_fx )
+ {
+ shiftedSFM_e = add( shiftedSFM_e, sub( sfm_exp, crest_exp ) ); /* stores resultant exponent for shiftedSFM_fx*/
+ }
+
+ // alpha = min( 320.f / (float) swb_offset[sfb + 1], 1.25f );
+ temp = BASOP_Util_Divide1616_Scale( 320, swb_offset[sfb + 1], &alpha_e );
+ alpha_fx = extract_l( L_min( temp, L_shl( 20480 /*1.25 Q14*/, sub( 1, alpha_e ) ) ) ); /* exponent is alpha_e*/
+ temp = BASOP_Util_Divide1616_Scale( hPrivateData->SFM_tb_fx[sfb], hPrivateData->SFM_sb_fx[sfb], &tmp_e );
+ tmp_e = add( tmp_e, sub( hPrivateData->sfb_tb_e[sfb], hPrivateData->sfb_sb_e[sfb] ) ); /* stores resultant exponent for temp */
+
+ // currDampingFactor = expf( alpha * logf( hPrivateData->SFM_tb[sfb] / hPrivateData->SFM_sb[sfb] ) );
+ currDampingFactor_fx = round_fx( BASOP_util_Pow2( Mpy_32_16_1( L_add( BASOP_Util_Log2( temp ), L_shl( add( 16, tmp_e ), 25 ) ), alpha_fx ), add( alpha_e, 6 ), &currDampingFactor_e ) ); /*exp is currDampingFactor_e*/
+
+ IF( GT_32( shiftedSFM_fx, L_shl( 1311 /*0.04f Q15*/, negate( shiftedSFM_e ) ) ) )
+ {
+ currDampingFactor_fx = 32767; /*1.f Q15*/
+ currDampingFactor_e = 0;
+ move16();
+ move16();
+ }
+ test();
+ test();
+ IF( last_core_acelp || hPrivateData->wasTransient || EQ_32( hPrivateData->prevDampingFactor_IIR_fx[sfb], L_shl( -1, sub( 15, hPrivateData->prevDampingFactor_IIR_e[sfb] ) ) ) )
+ {
+ tmp = BASOP_Util_Cmp_Mant32Exp( currDampingFactor_fx, currDampingFactor_e, 3277, 0 );
+ IF( tmp >= 0 )
+ {
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = currDampingFactor_fx;
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = currDampingFactor_e;
+ }
+ ELSE
+ {
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = 3277; /* 0.1 in Q15 */
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
+ }
+
+ move16();
+ move16();
+ }
+
+ {
+ Word32 tonalToNoise;
+ Word16 adap;
+ Word16 adap_e; /*stores exp for adap*/
+ Word16 tonalToNoise_e; /*stores exponent for tonalToNoise*/
+ tonalToNoise_e = 9; /*stores exponent for tonalToNoise*/
+ move16();
+ adap = BASOP_Util_Divide1616_Scale( width, 30, &adap_e );
+ tonalToNoise = IGF_getTNR_ivas_fx( pPowerSpectrum_fx, swb_offset[sfb], swb_offset[sfb + 1], adap, pPowerSpectrum_e, adap_e ); /*Q22*/
+ IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( tonalToNoise, tonalToNoise_e, L_add( L_shl( 10, sub( 15, adap_e ) ), adap ), add( 16, adap_e ) ), -1 ) )
+ {
+ // currDampingFactor += 0.1f * ( ( 10 + adap ) - tonalToNoise );
+ Word32 temp2 = BASOP_Util_Add_Mant32Exp( L_add( L_shl( 10, sub( 15, adap_e ) ) /*exp:adap_e*/, adap ), add( adap_e, 16 ), L_negate( tonalToNoise ), tonalToNoise_e, &tmp_e ); /* resultant exp is tmp_e*/
+ currDampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor_fx, currDampingFactor_e, extract_l( Mult_32_16( temp2, 3277 /*0.1f Q15*/ ) ), tmp_e, &currDampingFactor_fx ); /*stores resultant exp for currDampingFactor_fx*/
+ }
+ }
+
+ dampingFactor_e = BASOP_Util_Add_MantExp( currDampingFactor_fx, currDampingFactor_e, hPrivateData->prevDampingFactor_IIR_fx[sfb], hPrivateData->prevDampingFactor_IIR_e[sfb], &dampingFactor_fx );
+ dampingFactor_fx = shr( dampingFactor_fx, 1 ); /* resultant exponent is dampingFactor_e*/
+ IF( NE_16( BASOP_Util_Cmp_Mant32Exp( dampingFactor_fx, add( dampingFactor_e, 16 ), shr( hPrivateData->prevDampingFactor_IIR_fx[sfb], 1 ), add( hPrivateData->prevDampingFactor_IIR_e[sfb], 16 ) ), -1 ) )
+ {
+ // do nothing
+ }
+ ELSE
+ {
+ dampingFactor_fx = shr( hPrivateData->prevDampingFactor_IIR_fx[sfb], 1 ); /* resultant exponent is hPrivateData->prevDampingFactor_IIR_e[sfb]*/
+ dampingFactor_e = hPrivateData->prevDampingFactor_IIR_e[sfb];
+ move16();
+ }
+ IF( dampingFactor_e < 0 )
+ {
+ dampingFactor_fx = shl( dampingFactor_fx, dampingFactor_e );
+ dampingFactor_e = 0;
+ move16();
+ }
+ gain_fx = Mult_32_16( gain_fx, shl_sat( extract_l( L_min( L_add( dampingFactor_fx, Mult_32_16( L_shl( hPrivateData->dampingFactorSmoothing[sfb], sub( 15, dampingFactor_e ) ) /*Q:15-dampingFactor_e*/, 3277 /*0.1f Q15*/ ) /*Q:15-dampingFactor_e*/ ), shl_sat( 1, sub( 15, dampingFactor_e ) ) ) ), dampingFactor_e ) /*Q15*/ );
+
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = dampingFactor_fx;
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = dampingFactor_e;
+ move16();
+ move16();
+ if ( hPrivateData->dampingFactorSmoothing[sfb] > 0 )
+ {
+ hPrivateData->dampingFactorSmoothing[sfb] = sub( hPrivateData->dampingFactorSmoothing[sfb], 1 );
+ move16();
+ }
+ }
+ ELSE
+ {
+ hPrivateData->prevDampingFactor_IIR_fx[sfb] = -( 1 << 15 ); /* resultant exp which is 0 stores in hPrivateData->prevDampingFactor_IIR_e[sfb]*/
+ hPrivateData->prevDampingFactor_IIR_e[sfb] = 0;
+ hPrivateData->dampingFactorSmoothing[sfb] = 1;
+ move16();
+ move16();
+ move16();
+ }
+
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = tmp_tb_fx;
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = hPrivateData->SFM_tb_fx[sfb];
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = tmp_sb_fx;
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = hPrivateData->SFM_sb_fx[sfb];
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = hPrivateData->sfb_tb_e[sfb];
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = hPrivateData->sfb_tb_e[sfb];
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = hPrivateData->sfb_sb_e[sfb];
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = hPrivateData->sfb_sb_e[sfb];
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0;
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0;
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
+
+ hPrivateData->dampingFactorSmoothing[sfb] = 2;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ }
+ ELSE
+ {
+ tmp_e = pMDCTSpectrum_e;
+ sfbEnergyR_fx = add_sat( EPSILON_FX, BASOP_Util_Divide3216_Scale( sum2_32_fx( pMDCTSpectrum_fx + swb_offset[sfb], width, &tmp_e ) /*exp: tmp_e*/, width, &sfbEnergyR_e ) );
+ sfbEnergyR_e = add( sfbEnergyR_e, add( tmp_e, -15 ) ); /* stores resultant exponent for sfbEnergyR_fx*/
+ gain_fx = sfbEnergyR_fx; /*resultant exponent stored in gain_e=sfbEnergyR_e*/
+ move32();
+ gain_e = add( sfbEnergyR_e, 16 ); /* because gain_fx is word32;only after adding 16 q of gain_fx is 15-sfbEnergyR_e*/
+
+ hPrivateData->prevSFM_FIR_SFB_TB_fx[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_TB_fx[sfb] = 0;
+ hPrivateData->prevSFM_FIR_SFB_SB_fx[sfb] = 0;
+ hPrivateData->prevSFM_IIR_SFB_SB_fx[sfb] = 0;
+ hPrivateData->prevSFB_FIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFB_IIR_TB_e[sfb] = 0;
+ hPrivateData->prevSFB_FIR_SB_e[sfb] = 0;
+ hPrivateData->prevSFB_IIR_SB_e[sfb] = 0;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+ }
+ /*gain=0.5f+log2f(gain)*2+16 becuase 2.885390081777927f=2*1/loge(2) so 2*1/loge(2)*loge(x) can be written as 2*log2(x)*/
+ gain_fx = L_add( ONE_IN_Q22, L_add( L_add( L_shr( BASOP_Util_Log2( gain_fx ), 1 ), L_shl( gain_e, Q24 ) ), L_shl( 16, Q23 ) ) ); /*Q23*/
+ test();
+ test();
+ if ( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) )
+ {
+ gain_fx = L_add( gain_fx, ONE_IN_Q21 ); /* better preservation of original HF band energy */
+ }
+ test();
+ test();
+ if ( !isTransient && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_64000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_64000_CPE ) ) )
+ {
+ gain_fx = L_add( gain_fx, ONE_IN_Q20 );
+ }
+ gain_fx = L_min( gain_fx, 91 << Q23 ); /* 13+15+63, see arithcode encode residual */
+ gain_fx = L_max( gain_fx, 0 );
+ gain_e = 8; /* stores exponent for gain_fx*/
+ move16();
+ hPrivateData->igfScfQuantized[sfb] = (Word16) ( L_shr( gain_fx, 23 ) ); /*Q0*/
+ move16();
+ }
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGF_WriteEnvelope()
+ *
+ * writes IGF SCF values
+ *-------------------------------------------------------------------*/
+/*! r: number of bits writen */
+static Word16 IGF_WriteEnvelope_ivas(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset, /* i : ptr to bitOffset counter */
+ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
+ const Word16 isIndepFlag, /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */
+ Word16 *igfAllZero /* i : returns 1 if all IGF scfs are zero, else 0 */
+)
+{
+ IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
+ H_IGF_GRID hGrid;
+ Word16 sfb;
+ Word16 totBitCount;
+ Word16 startBitCount;
+
+ startBitCount = *pBitOffset;
+ totBitCount = 0;
+ *igfAllZero = 1;
+ move16();
+ move16();
+ move16();
+ hPrivateData = &hIGFEnc->igfData;
+ hGrid = &hPrivateData->igfInfo.grid[igfGridIdx];
+
+ FOR( sfb = hGrid->startSfb; sfb < hGrid->stopSfb; sfb++ )
+ {
+ IF( hPrivateData->igfScfQuantized[sfb] != 0 )
+ {
+ *igfAllZero = 0;
+ move16();
+ BREAK;
+ }
+ }
+
+ IF( *igfAllZero != 0 )
+ {
+ IGF_write_bit_fx( hBstr, pBitOffset, 1 );
+
+ if ( NULL == hBstr )
+ {
+ IGFSCFEncoderSaveContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
+ }
+
+ IGFSCFEncoderReset_fx( &hPrivateData->hIGFSCFArithEnc );
+
+ if ( NULL == hBstr )
+ {
+ IGFSCFEncoderRestoreContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
+ }
+ }
+ ELSE
+ {
+ IGF_write_bit_fx( hBstr, pBitOffset, 0 );
+
+ if ( NULL == hBstr )
+ {
+ IGFSCFEncoderSaveContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
+ }
+
+ *pBitOffset = IGFSCFEncoderEncode_ivas_fx( &hPrivateData->hIGFSCFArithEnc, hBstr, *pBitOffset, &hPrivateData->igfScfQuantized[hGrid->startSfb], igfGridIdx, isIndepFlag );
+ move16();
+
+ if ( NULL == hBstr )
+ {
+ IGFSCFEncoderRestoreContextState_fx( &hPrivateData->hIGFSCFArithEnc, igfGridIdx );
+ }
+ }
+ totBitCount = sub( *pBitOffset, startBitCount );
+
+ return totBitCount;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGF_Whitening()
+ *
+ * calculates the IGF whitening levels by SFM and crest
+ *-------------------------------------------------------------------*/
+
+static void IGF_Whitening_ivas_fx(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : | instance handle of IGF Encoder */
+ Word32 *powerSpectrum, /* i : Q31 | MDCT/MDST power spectrum */
+ Word16 *powerSpectrum_e, /* i : Q31 | MDCT/MDST power spectrum */
+ const Word16 igfGridIdx, /* i : Q0 | IGF grid index */
+ const Word16 isTransient, /* i : Q0 | flag indicating if transient is detected */
+ const Word16 last_core_acelp, /* i : Q0 | indicator if last frame was ACELP core */
+ const Word16 isTNSActive, /* i : Q0 | indicator if TNS is active */
+ const Word16 sp_aud_decision0, /* i : Q0 | first stage classifier decision */
+ const Word32 brate, /* i : Q0 | bitrate */
+ const Word16 element_mode /* i : Q0 | element mode */
+)
+{
+ IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
+ H_IGF_GRID hGrid;
+ Word16 p; /*Q0*/
+ Word16 tmp;
+ Word16 tmp_e;
+ Word16 SFM_src;
+ Word16 SFM_tar;
+ Word16 SFM_src_e;
+ Word16 SFM_tar_e;
+ Word16 num_Tiles;
+ Word16 SFM;
+ Word16 crest_e;
+
+ SFM = -ONE_IN_Q13; /*1.0f Q13*/
+ move16();
+
+ hPrivateData = &hIGFEnc->igfData;
+ hGrid = &hPrivateData->igfInfo.grid[(Word16) igfGridIdx];
+
+ IF( NE_16( igfGridIdx, IGF_GRID_LB_NORM ) )
+ {
+ FOR( p = 0; p < hGrid->nTiles; p++ )
+ {
+ /* reset filter */
+ hPrivateData->prevSFM_FIR[p] = L_deposit_l( 0 );
+ hPrivateData->prevSFM_IIR[p] = 0;
+ move16();
+
+ /* preset values: */
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
+ move16();
+ }
+ }
+
+ FOR( p = 0; p < IGF_MAX_TILES; p++ )
+ {
+ /* update prev data: */
+ hPrivateData->igfPrevWhiteningLevel[p] = hPrivateData->igfCurrWhiteningLevel[p];
+ /* preset values: */
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
+ move16();
+ move16();
+ }
+
+ test();
+ IF( !( isTransient || hPrivateData->wasTransient ) )
+ {
+ IF( powerSpectrum )
+ {
+ FOR( p = 0; p < hGrid->nTiles; p++ )
+ {
+ Word16 sb;
+
+ IF( isTNSActive )
+ {
+ FOR( sb = hGrid->tile[p]; sb < hGrid->tile[p + 1]; sb++ )
+ {
+ IF( LT_32( powerSpectrum[sb], 1 ) )
+ hPrivateData->logSpec[sb] = 0; /* max(0,FLT_MIN_EXP )*/
+ ELSE
+ hPrivateData->logSpec[sb] = extract_l( L_max( 0, L_shr( L_add( BASOP_Util_Log2( powerSpectrum[sb] ), L_shl( powerSpectrum_e[sb], Q25 ) ), Q25 ) ) );
+ move16();
+ }
+ }
+
+ /* if current tile contains only a single SFB, reuse already computed SFM values */
+ test();
+ IF( element_mode > EVS_MONO && EQ_16( sub( hGrid->sfbWrap[p + 1], hGrid->sfbWrap[p] ), 1 ) )
+ {
+ tmp = hPrivateData->SFM_tb_fx[p];
+ tmp_e = hPrivateData->sfb_tb_e[p];
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ tmp = BASOP_Util_Divide1616_Scale( IGF_getSFM_new_fx( powerSpectrum, hPrivateData->logSpec, hGrid->tile[p], hGrid->tile[p + 1], powerSpectrum_e ), IGF_getCrest_new_fx( hPrivateData->logSpec, hGrid->tile[p], hGrid->tile[p + 1], &crest_e ), &tmp_e );
+ tmp_e = sub( tmp_e, crest_e );
+ }
+
+ test();
+ IF( last_core_acelp || hPrivateData->wasTransient )
+ {
+ hPrivateData->prevSFM_FIR[p] = L_shl( tmp, add( 1, tmp_e ) ); /*16-(15-exp)=>15Q16*/
+ hPrivateData->prevSFM_IIR[p] = shl( tmp, sub( tmp_e, 2 ) ); /*13-(15-exp)=>2Q13*/
+ move32();
+ move16();
+ }
+
+ test();
+ IF( LE_32( brate, IVAS_48k ) && EQ_16( element_mode, IVAS_CPE_MDCT ) )
+ {
+ Word16 temp;
+ num_Tiles = 0;
+ SFM_src = 0;
+ SFM_tar = 0;
+ SFM_src_e = 0;
+ SFM_tar_e = 0;
+ move16();
+ move16();
+ move16();
+ move16();
+ move16();
+
+ FOR( sb = hGrid->sfbWrap[p]; sb < hGrid->sfbWrap[p + 1]; sb++ )
+ {
+ num_Tiles = add( num_Tiles, 1 );
+ SFM_src_e = BASOP_Util_Add_MantExp( hPrivateData->SFM_sb_fx[sb], hPrivateData->sfb_sb_e[sb], SFM_src, SFM_src_e, &SFM_src );
+ SFM_tar_e = BASOP_Util_Add_MantExp( hPrivateData->SFM_tb_fx[sb], hPrivateData->sfb_tb_e[sb], SFM_tar, SFM_tar_e, &SFM_tar );
+ }
+
+ /* compute the average */
+ SFM_src = shr( BASOP_Util_Divide1616_Scale( SFM_src, num_Tiles, &temp ), 2 );
+ SFM_src_e = add( SFM_src_e, sub( temp, 13 ) ); /*temp-15+2:because right shifted by 2 which are the guard bits*/
+ SFM_tar = shr( BASOP_Util_Divide1616_Scale( SFM_tar, num_Tiles, &temp ), 2 );
+ SFM_tar_e = add( SFM_tar_e, sub( temp, 13 ) ); /*temp-15+2:because right shifted by 2 which are the guard bits*/
+
+ IF( LT_16( SFM_tar_e, SFM_src_e ) )
+ {
+ SFM_tar = shl( SFM_tar, sub( SFM_tar_e, SFM_src_e ) ); /*making the q for SFM_tar and SFM_src equal with 2 as guard bits*/
+ SFM_tar_e = SFM_src_e;
+ }
+ ELSE
+ {
+ SFM_src = shr( SFM_src, sub( SFM_tar_e, SFM_src_e ) ); /*making the q for SFM_tar and SFM_src equal with 2 as guard bits*/
+ SFM_src_e = SFM_tar_e;
+ }
+ move16();
+
+ test();
+ test();
+ IF( ( p > 0 ) && ( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) ) )
+ {
+ test();
+ if ( EQ_16( p, 1 ) && EQ_16( abs_s( sub( hPrivateData->igfCurrWhiteningLevel[0], hPrivateData->igfCurrWhiteningLevel[1] ) ), 2 ) ) /* OFF vs. STRONG */
+ {
+ hPrivateData->igfCurrWhiteningLevel[0] = IGF_WHITENING_MID;
+ move16();
+ }
+ hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfCurrWhiteningLevel[p - 1];
+ move16();
+ }
+ ELSE IF( sp_aud_decision0 )
+ {
+ /* Music */
+ /* whitening Off: when tonality of target is more than source or tonality of target is close to that of source */
+ test();
+ if ( LE_16( SFM_tar, SFM_src ) || LE_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
+ move16();
+ }
+
+ /* whitening mid: */
+ test();
+ if ( GT_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) && LE_32( SFM_tar, L_add( SFM_src, L_shl( 5, sub( 13, SFM_src_e ) ) /*1.25 with exponent SFM_src_e*/ ) ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
+ move16();
+ }
+
+ /* whitening strong */
+ if ( GT_32( SFM_tar, L_add( SFM_src, L_shl( 5, sub( 13, SFM_src_e ) ) /*1.25 with exponent SFM_src_e*/ ) ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_STRONG;
+ move16();
+ }
+ }
+ ELSE
+ {
+ /* Speech */
+ /* whitening Off: when tonality of target is more than source or tonality of target is close to that of source */
+ test();
+ if ( LE_16( SFM_tar, SFM_src ) || LE_32( SFM_tar, L_add( SFM_src, L_shr( 3277 /*0.1 Q15*/, SFM_src_e ) ) ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
+ move16();
+ }
+
+ /* whitening mid: */
+ test();
+ if ( GT_32( SFM_tar, L_add( SFM_src, L_shr( 3277 /*0.1 Q15*/, SFM_src_e ) ) ) && LE_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
+ move16();
+ }
+
+ /* whitening strong */
+ if ( GT_32( SFM_tar, L_add( SFM_src, L_shl( 1, sub( 14, SFM_src_e /*0.5 with exponent SFM_src_e*/ ) ) ) ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_STRONG;
+ move16();
+ }
+ }
+
+ SFM = shl( SFM_tar, sub( SFM_tar_e, 2 ) ); /*2Q13*/
+ }
+ ELSE
+ {
+ test();
+ IF( element_mode > EVS_MONO && EQ_16( sub( hGrid->sfbWrap[p + 1], hGrid->sfbWrap[p] ), 1 ) )
+ {
+ SFM = shl( tmp, sub( tmp_e, 2 ) ); /*2Q13*/
+ }
+ ELSE
+ {
+ Word32 temp;
+ temp = L_add( L_shl( tmp, sub( tmp_e, 2 ) ), L_add( L_shr( hPrivateData->prevSFM_FIR[p], 3 ), L_shr( hPrivateData->prevSFM_IIR[p], 1 ) ) );
+ SFM = extract_l( L_min( 22118 /*2.7*/, temp ) ); /*2Q13*/
+ }
+ hPrivateData->prevSFM_FIR[p] = L_shl( tmp, add( 1, tmp_e ) ); /*15Q16*/
+ hPrivateData->prevSFM_IIR[p] = SFM;
+ move32();
+ move16();
+
+ IF( GT_16( SFM, hGrid->whiteningThreshold[1][p] ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_STRONG;
+ move16();
+ }
+ ELSE IF( GT_16( SFM, hGrid->whiteningThreshold[0][p] ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_OFF;
+ move16();
+ }
+ }
+
+ IF( element_mode > EVS_MONO )
+ {
+ IF( last_core_acelp ) /* reset */
+ {
+ set16_fx( hPrivateData->igfPastSFM_fx[p], -ONE_IN_Q13, IGF_PAST_SFM_LEN );
+ hPrivateData->igfWhiteningHangoverCnt[p] = 2;
+ move16();
+ }
+ ELSE
+ {
+ test();
+ test();
+ test();
+ test();
+ /* check whether change in whitening level should be allowed or not (if SFM is inside a certain margin around thresholds) */
+ IF( NE_16( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] ) &&
+ ( ( GT_32( SFM, L_sub( hGrid->whiteningThreshold[0][p], 1229 /*0.15f Q13*/ ) ) && LT_32( SFM, L_add( hGrid->whiteningThreshold[0][p], 1229 ) ) ) ||
+ ( GT_32( SFM, L_sub( hGrid->whiteningThreshold[1][p], 1229 ) ) && LT_32( SFM, L_add( hGrid->whiteningThreshold[1][p], 1229 ) ) ) ) )
+ {
+ Word16 mean_past_SFM;
+ Word16 mean_past_SFM_e;
+ Word16 countable;
+ Word16 i;
+ mean_past_SFM = 0;
+ mean_past_SFM_e = 0;
+ countable = 0;
+ move16();
+ move16();
+ move16();
+
+ /* compute mean of last (available) SFM values */
+ FOR( i = 0; i < IGF_PAST_SFM_LEN; i++ )
+ {
+ IF( hPrivateData->igfPastSFM_fx[p][i] >= 0 )
+ {
+ mean_past_SFM_e = BASOP_Util_Add_MantExp( mean_past_SFM, mean_past_SFM_e, hPrivateData->igfPastSFM_fx[p][i], 2, &mean_past_SFM );
+ countable = add( countable, 1 );
+ }
+ }
+ IF( countable )
+ {
+ Word16 temp;
+ mean_past_SFM = BASOP_Util_Divide1616_Scale( mean_past_SFM, countable, &temp );
+ mean_past_SFM_e = add( mean_past_SFM_e, sub( temp, 15 ) );
+ mean_past_SFM = shl( mean_past_SFM, sub( mean_past_SFM_e, 2 ) ); /*mean_past_SFM_e=2*/
+ /* deny change in whitening level for small deviations from mean SFM */
+ if ( LT_16( abs_s( sub( SFM, mean_past_SFM ) ), 1638 ) /*0.2 in Q13*/ )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfPrevWhiteningLevel[p];
+ move16();
+ }
+ }
+ }
+ }
+
+ hPrivateData->igfPastSFM_fx[p][hPrivateData->igfPastSFM_pos] = SFM; /*2Q13*/
+ move16();
+ }
+ }
+
+ SWITCH( hPrivateData->igfInfo.bitRateIndex )
+ {
+ case IGF_BITRATE_WB_9600:
+ case IGF_BITRATE_RF_WB_13200:
+ case IGF_BITRATE_WB_13200_CPE:
+ case IGF_BITRATE_WB_16400_CPE:
+ case IGF_BITRATE_RF_SWB_13200:
+ case IGF_BITRATE_SWB_9600:
+ case IGF_BITRATE_SWB_13200_CPE:
+ case IGF_BITRATE_SWB_16400:
+ case IGF_BITRATE_SWB_24400:
+ case IGF_BITRATE_SWB_24400_CPE:
+ case IGF_BITRATE_SWB_32000_CPE:
+ case IGF_BITRATE_SWB_32000:
+ case IGF_BITRATE_FB_16400:
+ case IGF_BITRATE_FB_24400:
+ case IGF_BITRATE_FB_24400_CPE:
+ case IGF_BITRATE_FB_32000_CPE:
+ case IGF_BITRATE_FB_32000:
+ hPrivateData->igfCurrWhiteningLevel[hGrid->nTiles - 1] = hPrivateData->igfCurrWhiteningLevel[hGrid->nTiles - 2];
+ move16();
+ break;
+ default:
+ break;
+ }
+ }
+ ELSE
+ {
+ FOR( p = 0; p < hGrid->nTiles; p++ )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = IGF_WHITENING_MID;
+ move16();
+ }
+ }
+ }
+ ELSE
+ {
+ /* reset filter */
+ FOR( p = 0; p < IGF_MAX_TILES; p++ )
+ {
+ hPrivateData->prevSFM_FIR[p] = L_deposit_l( 0 );
+ hPrivateData->prevSFM_IIR[p] = 0;
+ move32();
+ move16();
+ }
+ }
+
+ IF( element_mode > EVS_MONO )
+ {
+ IF( EQ_16( SFM, -ONE_IN_Q13 /*1.0f 2Q13*/ ) ) /* reset */
+ {
+ FOR( p = 0; p < hGrid->nTiles; p++ )
+ {
+ set16_fx( hPrivateData->igfPastSFM_fx[p], -ONE_IN_Q13, IGF_PAST_SFM_LEN );
+ hPrivateData->igfWhiteningHangoverCnt[p] = 2;
+ move16();
+ }
+ }
+
+ /* vibrato handling */
+ FOR( p = 0; p < hGrid->nTiles; p = p + 2 )
+ {
+ test();
+ test();
+ test();
+ IF( ( hPrivateData->igfPrevWhiteningLevel[p] == IGF_WHITENING_OFF && hPrivateData->igfCurrWhiteningLevel[p] != IGF_WHITENING_OFF ) ||
+ ( hPrivateData->igfPrevWhiteningLevel[p + 1] == IGF_WHITENING_OFF && hPrivateData->igfCurrWhiteningLevel[p + 1] != IGF_WHITENING_OFF ) )
+ {
+ Word16 i;
+ Word16 pastSfm_a[4], pastSfm_b[4];
+ Word16 pastSfmDiffSum_a, pastSfmDiffSum_b;
+
+ FOR( i = 0; i < 4; i++ )
+ {
+ pastSfm_a[i] = hPrivateData->igfPastSFM_fx[p][add( hPrivateData->igfPastSFM_pos, sub( 4, i ) ) % IGF_PAST_SFM_LEN];
+ pastSfm_b[i] = hPrivateData->igfPastSFM_fx[p + 1][add( hPrivateData->igfPastSFM_pos, sub( 4, i ) ) % IGF_PAST_SFM_LEN];
+ move16();
+ move16();
+ }
+ pastSfmDiffSum_a = pastSfmDiffSum_b = 0;
+ move16();
+ move16();
+ FOR( i = 0; i < 3; i++ )
+ {
+ IF( NE_16( pastSfm_a[i + 1], -ONE_IN_Q13 ) )
+ {
+ pastSfmDiffSum_a = add( pastSfmDiffSum_a, sub( pastSfm_a[i], pastSfm_a[i + 1] ) );
+ pastSfmDiffSum_b = add( pastSfmDiffSum_b, sub( pastSfm_b[i], pastSfm_b[i + 1] ) );
+ }
+ ELSE
+ {
+ break;
+ }
+ }
+ test();
+ test();
+ test();
+ test();
+ /* if tonality oscillates between two tiles, turn whitening off in both */
+ IF( ( ( pastSfmDiffSum_a > 0 && pastSfmDiffSum_b < 0 ) ||
+ ( pastSfmDiffSum_a < 0 && pastSfmDiffSum_b > 0 ) ) &&
+ ( GT_32( L_abs( L_sub( pastSfmDiffSum_a, pastSfmDiffSum_b ) ), ONE_IN_Q12 /* 0.5 in Q13 */ ) ) )
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfCurrWhiteningLevel[p + 1] = IGF_WHITENING_OFF;
+ move16();
+ move16();
+ }
+ }
+ }
+
+ /* hangover */
+ FOR( p = 0; p < hGrid->nTiles; p++ )
+ {
+ IF( NE_16( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] ) )
+ {
+ hPrivateData->igfWhiteningHangoverCnt[p] = add( hPrivateData->igfWhiteningHangoverCnt[p], 1 );
+ IF( EQ_16( hPrivateData->igfWhiteningHangoverCnt[p], 3 ) )
+ {
+ hPrivateData->igfWhiteningHangoverCnt[p] = 0;
+ }
+ ELSE
+ {
+ hPrivateData->igfCurrWhiteningLevel[p] = hPrivateData->igfPrevWhiteningLevel[p];
+ }
+ move16();
+ move16();
+ }
+ ELSE
+ {
+ hPrivateData->igfWhiteningHangoverCnt[p] = 0;
+ move16();
+ }
+ }
+
+ hPrivateData->igfPastSFM_pos = add( hPrivateData->igfPastSFM_pos, 1 ) % IGF_PAST_SFM_LEN;
+ move16();
+ }
+
+ hPrivateData->wasTransient = isTransient;
+ move16();
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGF_WriteWhiteningTile_fx()
+ *
+ * write whitening levels into bitstream
+ *-------------------------------------------------------------------*/
+
+/*! r: number of bits written */
+static Word16 IGF_WriteWhiteningTile_ivas_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
+ Word16 whiteningLevel /**< in: Q0 | whitening levels to write */
+)
+{
+ Word16 totBitCount;
+ Word16 startBitCount;
+
+ totBitCount = 0;
+ startBitCount = *pBitOffset;
+ move16();
+ move16();
+
+ IF( EQ_32( whiteningLevel, IGF_WHITENING_MID ) )
+ {
+ IGF_write_bits( hBstr, pBitOffset, 0, 1 );
+ }
+ ELSE
+ {
+ IGF_write_bits( hBstr, pBitOffset, 1, 1 );
+ IF( whiteningLevel == IGF_WHITENING_OFF )
+ {
+ IGF_write_bits( hBstr, pBitOffset, 0, 1 );
+ }
+ ELSE
+ {
+ IGF_write_bits( hBstr, pBitOffset, 1, 1 );
+ }
+ }
+ totBitCount = sub( *pBitOffset, startBitCount );
+
+ return totBitCount;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGF_WriteWhiteningLevels_fx()
+ *
+ * writes the whitening levels
+ *-------------------------------------------------------------------*/
+
+/**< out: Q0 | total number of bits written */
+static Word16 IGF_WriteWhiteningLevels_ivas_fx(
+ const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF encoder */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
+ const Word16 igfGridIdx, /**< in: Q0 | igf grid index see declaration of IGF_GRID_IDX for details */
+ const Word16 isIndepFlag /**< in: Q0 | if 1 frame is independent, 0 = frame is coded with data from previous frame */
+)
+{
+ IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
+ H_IGF_GRID hGrid;
+ Word16 p;
+ Word16 nTiles;
+ Word16 isSame;
+ Word32 tmp32;
+ Word16 totBitCount;
+ Word16 startBitCount;
+
+ totBitCount = 0;
+ move16();
+ isSame = 1;
+ move16();
+ startBitCount = *pBitOffset;
+ move16();
+ hPrivateData = &hInstance->igfData;
+ hGrid = &hPrivateData->igfInfo.grid[igfGridIdx];
+ nTiles = hGrid->nTiles;
+ move16();
+
+ IF( isIndepFlag )
+ {
+ isSame = 0;
+ move16();
+ }
+ ELSE
+ {
+ p = 0;
+ move16();
+ tmp32 = 0;
+ move32();
+ test();
+ WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) )
+ {
+ test();
+ tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfPrevWhiteningLevel[p] );
+ if ( tmp32 != 0 )
+ {
+ isSame = 0;
+ move16();
+ }
+ p++;
+ }
+ }
+ IF( isSame )
+ {
+ IGF_write_bits( hBstr, pBitOffset, 1, 1 );
+ }
+ ELSE
+ {
+ IF( !isIndepFlag )
+ {
+ IGF_write_bits( hBstr, pBitOffset, 0, 1 );
+ }
+ IGF_WriteWhiteningTile_ivas_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[0] );
+ p = 1;
+ move16();
+ tmp32 = 0;
+ move32();
+ test();
+ IF( EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) || EQ_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) )
+ {
+ isSame = 1;
+ move16();
+ }
+ ELSE
+ {
+ if ( LT_16( p, nTiles ) )
+ {
+ isSame = 1;
+ move16();
+ }
+ test();
+ WHILE( ( LT_16( p, nTiles ) ) && ( tmp32 == 0 ) )
+ {
+ test();
+ tmp32 = L_sub( hPrivateData->igfCurrWhiteningLevel[p], hPrivateData->igfCurrWhiteningLevel[p - 1] );
+ if ( tmp32 != 0 )
+ {
+ isSame = 0;
+ move16();
+ }
+ p++;
+ }
+ }
+ test();
+ IF( !isSame )
+ {
+ IGF_write_bits( hBstr, pBitOffset, 1, 1 );
+ FOR( p = 1; p < nTiles; p++ )
+ {
+ IGF_WriteWhiteningTile_ivas_fx( hBstr, pBitOffset, hPrivateData->igfCurrWhiteningLevel[p] );
+ }
+ }
+ ELSE IF( NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_SWB_48000_CPE ) && NE_16( hPrivateData->igfInfo.bitRateIndex, IGF_BITRATE_FB_48000_CPE ) )
+ {
+ IGF_write_bits( hBstr, pBitOffset, 0, 1 );
+ }
+ }
+
+ totBitCount = sub( *pBitOffset, startBitCount );
+
+ return totBitCount;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGF_WriteFlatteningTrigger_fx()
+ *
+ * write flattening trigger
+ *-------------------------------------------------------------------*/
+
+/*! r: number of bits written */
+static Word16 IGF_WriteFlatteningTrigger_ivas_fx(
+ const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset /**< in: | ptr to bitOffset counter */
+)
+{
+ Word16 flatteningTrigger;
+
+ Word16 totBitCount;
+ Word16 startBitCount;
+ totBitCount = 0;
+ startBitCount = *pBitOffset;
+ flatteningTrigger = hInstance->flatteningTrigger;
+ move16();
+ move16();
+ move16();
+
+ IGF_write_bits( hBstr, pBitOffset, flatteningTrigger, 1 );
+ totBitCount = sub( *pBitOffset, startBitCount );
+
+ return totBitCount;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGFEncWriteBitstream()
+ *
+ * IGF bitstream writer
+ *-------------------------------------------------------------------*/
+
+/*! r: number of bits written per frame */
+Word16 IGFEncWriteBitstream_ivas_fx(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset, /* i : ptr to bitOffset counter */
+ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
+ const Word16 isIndepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */
+)
+{
+ Word16 igfAllZero;
+ Word16 startBitCount;
+
+ startBitCount = *pBitOffset;
+ move16();
+ hIGFEnc->infoTotalBitsPerFrameWritten = 0;
+ move16();
+
+ if ( isIndepFlag )
+ {
+ hIGFEnc->infoTotalBitsWritten = 0;
+ move16();
+ }
+
+ IGF_WriteEnvelope_ivas( hIGFEnc, /* i: instance handle of IGF Encoder */
+ hBstr, /* i: encoder state */
+ pBitOffset, /* i: ptr to bitOffset counter */
+ igfGridIdx, /* i: igf grid index see definition of IGF_GRID_IDX for details */
+ isIndepFlag, /* i: if 1 frame is independent, 0 = frame is coded with data from previous frame */
+ &igfAllZero ); /* o: *igfAllZero */
+
+ IGF_WriteWhiteningLevels_ivas_fx( hIGFEnc, /* i: instance handle of IGF Encoder */
+ hBstr, /* i: encoder state */
+ pBitOffset, /* i: ptr to bitOffset counter */
+ igfGridIdx, /* i: igf grid index see definition of IGF_GRID_IDX for details */
+ isIndepFlag ); /* i: if 1 frame is independent, 0 = frame is coded with data from previous frame */
+
+ IGF_WriteFlatteningTrigger_ivas_fx( hIGFEnc, /* i: instance handle of IGF Encoder */
+ hBstr, /* i: encoder state */
+ pBitOffset ); /* i: ptr to bitOffset counter */
+
+ hIGFEnc->infoTotalBitsPerFrameWritten = sub( *pBitOffset, startBitCount );
+ hIGFEnc->infoTotalBitsWritten = add( hIGFEnc->infoTotalBitsWritten, hIGFEnc->infoTotalBitsPerFrameWritten );
+ move16();
+ move16();
+
+ return hIGFEnc->infoTotalBitsPerFrameWritten;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGFEncSetMode()
+ *
+ * sets the IGF mode according to given bitrate
+ *-------------------------------------------------------------------*/
+
+void IGFEncSetMode_ivas_fx(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */
+ const Word32 total_brate, /* i : encoder total bitrate */
+ const Word16 bwidth, /* i : encoder audio bandwidth */
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
+)
+{
+ IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
+ Word16 i;
+
+ hPrivateData = &hIGFEnc->igfData;
+ hPrivateData->igfBitstreamBits = 0;
+ move16();
+ set16_fx( hPrivateData->igfScfQuantized, 0, IGF_MAX_SFB );
+ set16_fx( hPrivateData->igfCurrWhiteningLevel, 0, IGF_MAX_TILES );
+ set16_fx( hPrivateData->igfPrevWhiteningLevel, 0, IGF_MAX_TILES );
+ set16_fx( hPrivateData->igfWhiteningHangoverCnt, 0, IGF_MAX_TILES );
+ FOR( i = 0; i < IGF_MAX_TILES; i++ )
+ {
+ set16_fx( hPrivateData->igfPastSFM_fx[i], -( ONE_IN_Q13 ), IGF_PAST_SFM_LEN );
+ }
+
+ hPrivateData->igfPastSFM_pos = 0;
+ move16();
+
+ FOR( i = 0; i < IGF_BITBUFSIZE / 8; i++ )
+ {
+ hPrivateData->igfBitstream[i] = 0;
+ move16();
+ }
+ hPrivateData->wasTransient = 0;
+ move16();
+ set32_fx( hPrivateData->prevSFM_FIR, 0, IGF_MAX_TILES );
+ set16_fx( hPrivateData->prevSFM_IIR, 0, IGF_MAX_TILES );
+ set16_fx( hPrivateData->dampingFactorSmoothing, 2, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFM_FIR_SFB_SB_fx, 0, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFB_FIR_TB_e, 15, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFB_FIR_SB_e, 15, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFM_IIR_SFB_SB_fx, 0, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFB_IIR_SB_e, 15, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFM_FIR_SFB_TB_fx, 0, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFB_IIR_TB_e, 15, IGF_MAX_SFB );
+ set16_fx( hPrivateData->sfb_tb_e, 15, IGF_MAX_SFB );
+ set16_fx( hPrivateData->sfb_sb_e, 15, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevSFM_IIR_SFB_TB_fx, 0, IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevDampingFactor_IIR_fx, -( ONE_IN_Q15 ), IGF_MAX_SFB );
+ set16_fx( hPrivateData->prevDampingFactor_IIR_e, 0, IGF_MAX_SFB );
+ set16_fx( hPrivateData->logSpec, 0, L_FRAME_PLUS );
+ set16_fx( hPrivateData->SFM_sb_fx, 0, IGF_MAX_SFB );
+ set16_fx( hPrivateData->SFM_tb_fx, 0, IGF_MAX_SFB );
+
+ IF( IGFCommonFuncsIGFConfiguration_ivas_fx( total_brate, bwidth, element_mode, &hPrivateData->igfInfo, rf_mode ) != 0 )
+ {
+ IGFSCFEncoderOpen_fx( &hPrivateData->hIGFSCFArithEnc, &hPrivateData->igfInfo, total_brate, bwidth, element_mode, rf_mode );
+
+ hIGFEnc->infoSamplingRate = hPrivateData->igfInfo.sampleRate;
+ move32();
+ hIGFEnc->infoStartFrequency = hPrivateData->igfInfo.grid[0].startFrequency;
+ move16();
+ hIGFEnc->infoStopFrequency = hPrivateData->igfInfo.grid[0].stopFrequency;
+ move16();
+ hIGFEnc->infoStartLine = hPrivateData->igfInfo.grid[0].startLine;
+ move16();
+ hIGFEnc->infoStopLine = hPrivateData->igfInfo.grid[0].stopLine;
+ move16();
+ }
+ ELSE
+ {
+ /* IGF configuration failed -> error! */
+ hIGFEnc->infoSamplingRate = 0;
+ move32();
+ hIGFEnc->infoStartFrequency = -1;
+ move16();
+ hIGFEnc->infoStopFrequency = -1;
+ move16();
+ hIGFEnc->infoStartLine = -1;
+ move16();
+ hIGFEnc->infoStopLine = -1;
+ move16();
+ fprintf( stderr, "IGFEncSetMode_fx: initialization error!\n" );
+ }
+
+ /* reset remaining variables */
+ hIGFEnc->infoTotalBitsWritten = 0;
+ move16();
+ hIGFEnc->infoTotalBitsPerFrameWritten = 0;
+ move16();
+ hIGFEnc->flatteningTrigger = 0;
+ move16();
+ hIGFEnc->spec_be_igf_e = 0;
+ move16();
+ hIGFEnc->tns_predictionGain = 0;
+ move16();
+ set32_fx( hIGFEnc->spec_be_igf, 0, N_MAX_TCX - IGF_START_MN );
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGFEncResetTCX10BitCounter_fx()
+ *
+ * IGF reset bitstream bit counter for TCX10 modes
+ *-------------------------------------------------------------------*/
+
+void IGFEncResetTCX10BitCounter_fx(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc /* i : instance handle of IGF Encoder */
+)
+{
+ IGF_ENC_PRIVATE_DATA_HANDLE hPrivateData;
+
+ hPrivateData = &hIGFEnc->igfData;
+ hPrivateData->igfBitstreamBits = 0;
+ hIGFEnc->infoTotalBitsWritten = 0;
+ move16();
+ move16();
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGFEncApplyMono()
+ *
+ * apply the IGF encoder, main encoder interface
+ *-------------------------------------------------------------------*/
+
+void IGFEncApplyMono_ivas_fx(
+ Encoder_State *st, /* i : Encoder state */
+ Word16 powerSpectrum_len, /* i: length of pPowerSpectrum_fx buffer */
+ const Word16 igfGridIdx, /* i : IGF grid index */
+ Word32 *pMDCTSpectrum_fx, /* i/o: MDCT spectrum */
+ Word16 e_mdct, /* i : exponent of pMDCTspectrum */
+ Word32 *pPowerSpectrum_fx, /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */
+ Word16 *e_ps, /* i : exponent of pPowerSpectrum */
+ const Word16 isTCX20, /* i : flag indicating if the input is TCX20 or TCX10/2xTCX5 */
+ const Word8 isTNSActive, /* i : flag indicating if the TNS is active */
+ const Word16 sp_aud_decision0, /* i : first stage switching decision */
+ const Word16 vad_hover_flag /* i : VAD hangover flag */
+)
+{
+ Word32 *pPowerSpectrumParameter_fx;
+ Word16 *pPowerSpectrumParameter_exp;
+ Word16 att_fx = MAX16B;
+ Word16 last_core_acelp;
+ move16();
+
+ Word32 common_pPowerSpectrum_fx[N_MAX + L_MDCT_OVLP_MAX];
+
+ set32_fx( common_pPowerSpectrum_fx, 0, N_MAX );
+
+ Word16 common_pPowerSpectrum_exp = MIN16B;
+ move16();
+ IF( st->last_core == ACELP_CORE )
+ {
+ last_core_acelp = 1;
+ move16();
+ }
+ ELSE
+ {
+ last_core_acelp = 0;
+ move16();
+ }
+
+ test();
+ IF( !isTNSActive && isTCX20 )
+ {
+ pPowerSpectrumParameter_fx = pPowerSpectrum_fx;
+ pPowerSpectrumParameter_exp = e_ps;
+ }
+ ELSE
+ {
+ pPowerSpectrumParameter_fx = NULL;
+ pPowerSpectrumParameter_exp = NULL;
+ }
+
+ IGF_UpdateInfo( st->hIGFEnc, igfGridIdx );
+
+ test();
+ IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) )
+ {
+ calculate_hangover_attenuation_gain_ivas_fx( st, &att_fx, vad_hover_flag );
+ }
+
+ IGF_CalculateEnvelope_ivas_fx( st->hIGFEnc, pMDCTSpectrum_fx, e_mdct, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, st->element_mode, att_fx );
+
+ IF( isTCX20 )
+ {
+ pPowerSpectrumParameter_fx = pPowerSpectrum_fx;
+ pPowerSpectrumParameter_exp = e_ps;
+ }
+ ELSE
+ {
+ pPowerSpectrumParameter_fx = NULL;
+ pPowerSpectrumParameter_exp = NULL;
+ }
+
+ IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) )
+ {
+ IGF_Whitening_ivas_fx( st->hIGFEnc, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, isTNSActive, sp_aud_decision0, st->element_brate, st->element_mode );
+ }
+ ELSE
+ {
+ IGF_Whitening_ivas_fx( st->hIGFEnc, pPowerSpectrumParameter_fx, pPowerSpectrumParameter_exp, igfGridIdx, st->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, isTNSActive, sp_aud_decision0, st->total_brate, st->element_mode );
+ }
+
+ IF( pPowerSpectrumParameter_fx )
+ {
+ FOR( Word16 i = 0; i < powerSpectrum_len; i++ )
+ {
+ common_pPowerSpectrum_exp = s_max( common_pPowerSpectrum_exp, pPowerSpectrumParameter_exp[i] );
+ }
+
+ FOR( Word16 i = 0; i < powerSpectrum_len; i++ )
+ {
+ common_pPowerSpectrum_fx[i] = L_shl( pPowerSpectrumParameter_fx[i], sub( pPowerSpectrumParameter_exp[i], common_pPowerSpectrum_exp ) );
+ move16();
+ }
+ pPowerSpectrumParameter_fx = common_pPowerSpectrum_fx;
+ }
+
+ IGF_ErodeSpectrum_ivas_fx( st->hIGFEnc, pMDCTSpectrum_fx, pPowerSpectrumParameter_fx, common_pPowerSpectrum_exp, igfGridIdx, 0 );
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGFEncApplyStereo()
+ *
+ * apply the IGF encoder, main encoder interface
+ *-------------------------------------------------------------------*/
+
+void IGFEncApplyStereo_fx(
+ STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT stereo encoder structure */
+ Word16 ms_mask[2][MAX_SFB], /* i : bandwise MS mask */
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i : instance handle of IGF Encoder */
+ const Word16 igfGridIdx, /* i : IGF grid index */
+ Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */
+ Word32 *pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */
+ Word16 *exp_pPowerSpectrum_fx[CPE_CHANNELS], /* i/o: exp of pPowerSpectrum_fx */
+ Word32 *pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse power spectrum */
+ Word16 *q_pPowerSpectrumMsInv_fx[CPE_CHANNELS][NB_DIV], /* i/o: Q of pPowerSpectrumMsInv_fx */
+ Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i : inverse spectrum */
+ Word16 exp_inv_spectrum_fx[CPE_CHANNELS], /* i : exp of inverse spectrum */
+ const Word16 frameno, /* i : flag indicating index of current subfr. */
+ const Word16 sp_aud_decision0, /* i : sp_aud_decision0 */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word16 mct_on )
+{
+ Word32 *pPowerSpectrumParameter_fx[NB_DIV]; /* If it is NULL it informs a function that specific handling is needed */
+ Word16 *exp_pPowerSpectrumParameter_fx[NB_DIV]; /* If it is NULL it informs a function that specific handling is needed */
+ Word32 *pPowerSpectrumParameterMsInv_fx[NB_DIV];
+ Word16 *q_pPowerSpectrumParameterMsInv_fx[NB_DIV];
+ Word16 coreMsMask[N_MAX];
+ Word16 sfb, ch, last_core_acelp;
+ STEREO_MDCT_BAND_PARAMETERS *sfbConf;
+ Word32 common_pPowerSpectrum_fx[N_MAX];
+
+ set32_fx( common_pPowerSpectrum_fx, 0, N_MAX );
+
+ Word16 common_pPowerSpectrum_exp = MIN16B;
+ move16();
+
+ /* assumptions: stereo filling was already done on the flattened spectra
+ * IGF region is always coded M/S, never L/R (to be done in the encoder)
+ * for residual bands with stereo filling infoTcxNoise is set to zero
+ * both channels have the same IGF configuration
+ */
+
+ /* sanity checks: check if both channels have the same configuration...*/
+ assert( ( sts[0]->core == sts[1]->core ) );
+
+ /* initialization */
+ IF( EQ_16( sts[0]->core, TCX_20_CORE ) )
+ {
+ sfbConf = &hStereoMdct->stbParamsTCX20;
+ }
+ ELSE
+ {
+ sfbConf = &hStereoMdct->stbParamsTCX10;
+ }
+ if ( sts[0]->last_core == ACELP_CORE )
+ {
+ sfbConf = &hStereoMdct->stbParamsTCX20afterACELP;
+ }
+
+ /* create line wise ms mask for the core bands */
+ set16_fx( coreMsMask, 0, N_MAX );
+ FOR( sfb = 0; sfb < sfbConf->sfbCnt; sfb++ )
+ {
+ set16_fx( &coreMsMask[sfbConf->sfbOffset[sfb]], ms_mask[frameno][sfb], sub( sfbConf->sfbOffset[sfb + 1], sfbConf->sfbOffset[sfb] ) );
+ }
+
+ test();
+ test();
+ IF( EQ_16( sts[0]->core, TCX_20_CORE ) && !sts[0]->hTcxEnc->fUseTns[frameno] && !sts[1]->hTcxEnc->fUseTns[frameno] )
+ {
+ pPowerSpectrumParameter_fx[0] = &pPowerSpectrum_fx[0][0];
+ exp_pPowerSpectrumParameter_fx[0] = &exp_pPowerSpectrum_fx[0][0];
+ pPowerSpectrumParameter_fx[1] = &pPowerSpectrum_fx[1][0];
+ exp_pPowerSpectrumParameter_fx[1] = &exp_pPowerSpectrum_fx[1][0];
+ pPowerSpectrumParameterMsInv_fx[0] = pPowerSpectrumMsInv_fx[0][0];
+ pPowerSpectrumParameterMsInv_fx[1] = pPowerSpectrumMsInv_fx[1][0];
+ q_pPowerSpectrumParameterMsInv_fx[0] = q_pPowerSpectrumMsInv_fx[0][0];
+ q_pPowerSpectrumParameterMsInv_fx[1] = q_pPowerSpectrumMsInv_fx[1][0];
+ }
+ ELSE
+ {
+ pPowerSpectrumParameter_fx[0] = NULL;
+ pPowerSpectrumParameter_fx[1] = NULL;
+ pPowerSpectrumParameterMsInv_fx[0] = NULL;
+ pPowerSpectrumParameterMsInv_fx[1] = NULL;
+ q_pPowerSpectrumParameterMsInv_fx[0] = NULL;
+ q_pPowerSpectrumParameterMsInv_fx[1] = NULL;
+ }
+ FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
+ {
+ last_core_acelp = extract_l( EQ_16( sts[ch]->last_core, ACELP_CORE ) );
+
+ IGF_UpdateInfo( hIGFEnc[ch], igfGridIdx );
+ IGF_CalculateStereoEnvelope_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], sts[ch]->hTcxEnc->spectrum_e[frameno], inv_spectrum_fx[ch][frameno],
+ exp_inv_spectrum_fx[ch], pPowerSpectrumParameter_fx[ch], exp_pPowerSpectrum_fx[ch], pPowerSpectrumParameterMsInv_fx[ch],
+ q_pPowerSpectrumParameterMsInv_fx[ch], igfGridIdx, coreMsMask, sts[ch]->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, mct_on );
+
+ IF( EQ_16( sts[ch]->core, TCX_20_CORE ) )
+ {
+ pPowerSpectrumParameter_fx[ch] = pPowerSpectrum_fx[ch];
+ exp_pPowerSpectrumParameter_fx[ch] = exp_pPowerSpectrum_fx[ch];
+ }
+ ELSE
+ {
+ pPowerSpectrumParameter_fx[ch] = NULL;
+ }
+
+ IGF_Whitening_ivas_fx( hIGFEnc[ch], pPowerSpectrumParameter_fx[ch], exp_pPowerSpectrumParameter_fx[ch], igfGridIdx, sts[ch]->hTranDet->transientDetector.bIsAttackPresent, last_core_acelp, ( sts[0]->hTcxEnc->fUseTns[frameno] || sts[1]->hTcxEnc->fUseTns[frameno] ), sp_aud_decision0, element_brate, sts[ch]->element_mode );
+
+ IF( pPowerSpectrumParameter_fx[ch] )
+ {
+ Word16 length = N_MAX;
+ move16();
+ if ( mct_on )
+ {
+ length = L_FRAME48k;
+ move16();
+ }
+ FOR( Word16 i = 0; i < length; i++ )
+ {
+ common_pPowerSpectrum_exp = s_max( common_pPowerSpectrum_exp, exp_pPowerSpectrumParameter_fx[ch][i] );
+ }
+
+ FOR( Word16 i = 0; i < length; i++ )
+ {
+ common_pPowerSpectrum_fx[i] = L_shl( pPowerSpectrumParameter_fx[ch][i], sub( exp_pPowerSpectrumParameter_fx[ch][i], common_pPowerSpectrum_exp ) );
+ move32();
+ }
+ pPowerSpectrumParameter_fx[ch] = common_pPowerSpectrum_fx;
+ }
+ IGF_ErodeSpectrum_ivas_fx( hIGFEnc[ch], sts[ch]->hTcxEnc->spectrum_fx[frameno], pPowerSpectrumParameter_fx[ch], common_pPowerSpectrum_exp, igfGridIdx, mct_on );
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGFSaveSpectrumForITF()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void IGFSaveSpectrumForITF_ivas_fx(
+ IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */
+ const Word16 igfGridIdx, /* i : IGF grid index */
+ const Word32 *pITFSpectrum, /* i : MDCT spectrum */
+ Word16 exp_pITFSpectrum )
+{
+ IGF_UpdateInfo( hIGFEnc, igfGridIdx );
+
+ Copy32( pITFSpectrum + IGF_START_MN, hIGFEnc->spec_be_igf, sub( hIGFEnc->infoStopLine, IGF_START_MN ) );
+
+ scale_sig32( hIGFEnc->spec_be_igf, sub( hIGFEnc->infoStopLine, IGF_START_MN ), sub( exp_pITFSpectrum, s_max( exp_pITFSpectrum, hIGFEnc->spec_be_igf_e ) ) );
+ scale_sig32( hIGFEnc->spec_be_igf + sub( hIGFEnc->infoStopLine, IGF_START_MN ), sub( N_MAX_TCX - IGF_START_MN, sub( hIGFEnc->infoStopLine, IGF_START_MN ) ), sub( hIGFEnc->spec_be_igf_e, s_max( exp_pITFSpectrum, hIGFEnc->spec_be_igf_e ) ) );
+ hIGFEnc->spec_be_igf_e = s_max( exp_pITFSpectrum, hIGFEnc->spec_be_igf_e );
+ move16();
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * IGF_Reconfig()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+ivas_error IGF_Reconfig(
+ IGF_ENC_INSTANCE_HANDLE *hIGFEnc, /* i/o: instance handle of IGF Encoder */
+ const Word16 igf, /* i : IGF on/off */
+ const Word16 reset, /* i : reset flag */
+ const Word32 brate, /* i : bitrate for configuration */
+ const Word16 bwidth, /* i : signal bandwidth */
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
+)
+{
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ move32();
+
+ test();
+ test();
+ test();
+ IF( igf && *hIGFEnc == NULL )
+ {
+ IF( ( *hIGFEnc = (IGF_ENC_INSTANCE_HANDLE) malloc( sizeof( IGF_ENC_INSTANCE ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hIGFEnc\n" ) );
+ }
+ IGFEncSetMode_ivas_fx( *hIGFEnc, brate, bwidth, element_mode, rf_mode );
+ }
+ ELSE IF( igf && reset )
+ {
+ IGFEncSetMode_ivas_fx( *hIGFEnc, brate, bwidth, element_mode, rf_mode );
+ }
+ ELSE IF( !igf && *hIGFEnc != NULL )
+ {
+ free( *hIGFEnc );
+ *hIGFEnc = NULL;
+ }
+
+ return error;
+}
diff --git a/lib_enc/igf_scf_enc.c b/lib_enc/igf_scf_enc.c
index 2921b58866c86fab78dcf3af0061fa68559cd4ec..d83841039876ae0ee371db6fb38771619a87b006 100644
--- a/lib_enc/igf_scf_enc.c
+++ b/lib_enc/igf_scf_enc.c
@@ -31,7 +31,7 @@
*******************************************************************************************************/
/*====================================================================================
- EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
#include
diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c
index 69cee425591e02ed5e9b17353c01c41b4c26def5..b3ddbf663f702cbd1db6b37f5bdc9dc3563b2b73 100644
--- a/lib_enc/init_enc_fx.c
+++ b/lib_enc/init_enc_fx.c
@@ -2,11 +2,9 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "rom_com.h" /* Static table prototypes */
-// #include "prot_fx.h" /* Function prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "rom_com.h" /* Static table prototypes */
#include "stl.h"
#include "ivas_cnst.h"
#include "ivas_error.h"
@@ -20,14 +18,15 @@
*
* Initialization of state variables
*-----------------------------------------------------------------------*/
+
ivas_error init_encoder_fx(
- Encoder_State *st_fx /* i/o: Encoder static variables structure */
+ Encoder_State *st_fx, /* i/o: Encoder static variables structure */
+ const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */
+ const int16_t interval_SID /* i : interval for SID update */
)
{
Word16 i;
Word32 L_tmp;
-
-
Word16 idchan = 0; /* i : channel ID */
Word16 vad_only_flag = 0; /* i : channel ID */
move16();
@@ -350,35 +349,6 @@ ivas_error init_encoder_fx(
}
wb_vad_init_fx( st_fx->hVAD );
- st_fx->hVAD->prim_act_quick_fx = 0;
- move16();
- st_fx->hVAD->prim_act_slow_fx = 0;
- move16();
- st_fx->hVAD->prim_act_fx = 0;
- move16();
- st_fx->hVAD->prim_act_quick_he_fx = 0;
- move16();
- st_fx->hVAD->prim_act_slow_he_fx = 0;
- move16();
- st_fx->hVAD->prim_act_he_fx = 0;
- move16();
- st_fx->hVAD->hangover_terminate_flag = 0;
- move16();
-
- st_fx->hVAD->consec_inactive = 0;
- move16();
- st_fx->hVAD->spectral_tilt_reset = 1;
- move16();
- st_fx->hVAD->running_avg_fx = 0;
- move16();
- st_fx->hVAD->ra_deltasum_fx = 0;
- move16();
- st_fx->hVAD->trigger_SID = 0;
- move16();
- st_fx->hVAD->L_snr_sum_vad_fx = 0;
- move32();
- st_fx->hVAD->q_L_snr_sum_vad = Q31;
- move16();
}
ELSE
{
@@ -387,12 +357,22 @@ ivas_error init_encoder_fx(
st_fx->Pos_relE_cnt = 5120;
move16(); /*20.0f*/
- st_fx->nb_active_frames_HE_SAD_fx = 0;
- move16();
- st_fx->lp_speech_fx = 11520;
- move16(); /*Q8 (45.0) */ /* Initialize the long-term active speech level in dB */
- /* avoid uninitialized memory access */
+ /* CLDFB-based VAD */
+ IF( st_fx->element_mode == EVS_MONO )
+ {
+ if ( ( st_fx->hVAD_CLDFB = (VAD_CLDFB_HANDLE) malloc( sizeof( T_CldfbVadState ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB VAD\n" ) );
+ }
+
+ vad_init_fx( st_fx->hVAD_CLDFB );
+ }
+ ELSE
+ {
+ st_fx->hVAD_CLDFB = NULL;
+ }
+
/*-----------------------------------------------------------------*
* Noise estimator
@@ -492,7 +472,12 @@ ivas_error init_encoder_fx(
st_fx->exc_pe_fx = 0;
move16();
- /* CNG and DTX */
+ /*-----------------------------------------------------------------*
+ * DTX
+ *-----------------------------------------------------------------*/
+
+ st_fx->lp_speech_fx = 11520;
+ move16(); /*Q8 (45.0) */ /* Initialize the long-term active speech level in dB */
st_fx->lp_noise_fx = 0;
move16();
@@ -504,7 +489,7 @@ ivas_error init_encoder_fx(
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTX variables\n" ) );
}
- dtx_enc_init_fx( st_fx, st_fx->var_SID_rate_flag_fx, st_fx->interval_SID_fx );
+ dtx_enc_init_fx( st_fx, var_SID_rate_flag, interval_SID );
}
ELSE
{
@@ -518,8 +503,7 @@ ivas_error init_encoder_fx(
{
move16();
}
- st_fx->active_fr_cnt_fx = 0;
- move16();
+
st_fx->cng_type = -1;
move16();
@@ -894,10 +878,15 @@ ivas_error init_encoder_fx(
st_fx->totalNoise_increase_len = 0;
move16();
init_coder_ace_plus_fx( st_fx, st_fx->last_total_brate, 0, -10 /*hack*/ );
- // PMT("Transient detector init needs review, handle hTranDet is missing")
- InitTransientDetection_fx( extract_l( Mult_32_16( st_fx->input_Fs, 0x0290 ) ),
+
+ IF( ( st_fx->hTranDet = (TRAN_DET_HANDLE) malloc( sizeof( TRAN_DET_DATA ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) );
+ }
+
+ InitTransientDetection_fx( extract_l( Mult_32_16( st_fx->input_Fs, INV_FRAME_PER_SEC_Q15 ) ),
NS2SA_FX2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ),
- &st_fx->transientDetection );
+ st_fx->hTranDet );
st_fx->Q_syn2 = 0;
move16();
@@ -1494,7 +1483,7 @@ ivas_error init_encoder_ivas_fx(
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VAD\n" ) );
}
- wb_vad_init_ivas_fx( st->hVAD );
+ wb_vad_init_fx( st->hVAD );
}
ELSE
{
@@ -1506,8 +1495,11 @@ ivas_error init_encoder_ivas_fx(
/* CLDFB-based VAD */
IF( st->element_mode == EVS_MONO )
{
- /* This is done to as in EVS T_CldfbVadState structure is present in Encoder State */
- st->hVAD_CLDFB = &st->vad_st;
+ if ( ( st->hVAD_CLDFB = (VAD_CLDFB_HANDLE) malloc( sizeof( T_CldfbVadState ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB VAD\n" ) );
+ }
+
vad_init_fx( st->hVAD_CLDFB );
}
ELSE
@@ -1675,7 +1667,7 @@ ivas_error init_encoder_ivas_fx(
IF( EQ_16( st->element_mode, EVS_MONO ) )
{
/* open analysis for input SR */
- st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) );
+ st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) );
if ( ( error = openCldfb( &st->cldfbAnaEnc, CLDFB_ANALYSIS, CLDFB_getNumChannels( st->input_Fs ), st->input_frame_fx ) ) != IVAS_ERR_OK )
{
@@ -2079,7 +2071,7 @@ ivas_error init_encoder_ivas_fx(
TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
IF( hTcxEnc != NULL )
{
- hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); /* 0x0290 is 1/FRAMES_PER_SEC in Q15*/
+ hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) );
move16();
}
st->currEnergyHF_fx = 0;
@@ -2153,9 +2145,8 @@ ivas_error init_encoder_ivas_fx(
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) );
}
- Word16 temp;
- Word16 frame_length = BASOP_Util_Divide3232_Scale( st->input_Fs, FRAMES_PER_SEC, &temp );
- frame_length = shr( frame_length, sub( 15, temp ) );
+
+ Word16 frame_length = extract_l( Mpy_32_32_r( st->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
IF( GT_16( st->element_mode, EVS_MONO ) )
{
@@ -2163,9 +2154,7 @@ ivas_error init_encoder_ivas_fx(
}
ELSE
{
- InitTransientDetection_fx( extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ),
- NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ),
- &st->transientDetection );
+ InitTransientDetection_fx( frame_length, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet );
}
/*-----------------------------------------------------------------*
diff --git a/lib_enc/inov_enc_fx.c b/lib_enc/inov_enc_fx.c
index 02ef250961a34f494fcf68dd187155763948c394..88f95864599a7aebc516b70f56e4f4790203ea48 100644
--- a/lib_enc/inov_enc_fx.c
+++ b/lib_enc/inov_enc_fx.c
@@ -1,12 +1,11 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-//#include "prot_fx.h" /* Function prototypes */
#include "basop_util.h"
-#include "rom_com_fx.h" /* Static table prototypes */
#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "ivas_prot_fx.h" /* Function prototypes */
@@ -289,7 +288,7 @@ Word16 inov_encode_fx(
}
ELSE
{
- *unbits = add( *unbits, acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB ) );
+ *unbits = add( *unbits, acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ) );
move16();
}
}
@@ -302,35 +301,35 @@ Word16 inov_encode_fx(
}
ELSE IF( ( EQ_32( core_brate, ACELP_8k85 ) ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_12k65 ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_14k25 ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_15k85 ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_18k25 ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_19k85 ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_23k05 ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_23k85 ) )
{
- acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB, st_fx->element_mode );
}
}
@@ -620,7 +619,7 @@ Word16 inov_encode_ivas_fx(
IF( EQ_16( nBits, 8 ) )
{
- acelp_1t64_ivas_fx( hBstr, dn, h2, code, y2, L_subfr );
+ acelp_1t64_fx( hBstr, dn, h2, code, y2, L_subfr );
}
ELSE
{
@@ -631,7 +630,7 @@ Word16 inov_encode_ivas_fx(
{
IF( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] == 0 )
{
- acelp_1t64_ivas_fx( hBstr, dn, h2, code, y2, L_subfr );
+ acelp_1t64_fx( hBstr, dn, h2, code, y2, L_subfr );
}
ELSE
{
@@ -640,8 +639,7 @@ Word16 inov_encode_ivas_fx(
}
ELSE
{
- E_ACELP_4t_ivas_fx( dn, cn, h2, Rw, (Word8) acelpautoc, code, st_fx->acelp_cfg.fixed_cdk_index[idx2], prm, L_frame, last_L_frame, st_fx->total_brate, i_subfr, cmpl_flag, st_fx->element_mode );
-
+ E_ACELP_4t_fx( dn, cn, h2, Rw, (Word8) acelpautoc, code, st_fx->acelp_cfg.fixed_cdk_index[idx2], prm, L_frame, last_L_frame, st_fx->total_brate, i_subfr, cmpl_flag, st_fx->element_mode );
wordcnt = shr( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[idx2] ), 4 );
bitcnt = s_and( ACELP_FIXED_CDK_BITS( st_fx->acelp_cfg.fixed_cdk_index[idx2] ), 15 );
@@ -692,15 +690,15 @@ Word16 inov_encode_ivas_fx(
IF( EQ_16( nBits, 7 ) )
{
- acelp_1t64_ivas_fx( hBstr, dn, h2, code, y2, L_SUBFR );
+ acelp_1t64_fx( hBstr, dn, h2, code, y2, L_SUBFR );
}
ELSE IF( EQ_16( nBits, 12 ) )
{
- acelp_2t32_ivas_fx( hBstr, dn, h2, code, y2 );
+ acelp_2t32_fx( hBstr, dn, h2, code, y2 );
}
ELSE
{
- *unbits = add( *unbits, acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ) );
+ *unbits = add( *unbits, acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, nBits, cmpl_flag, Opt_AMR_WB, st_fx->element_mode ) );
move16();
}
}
@@ -709,39 +707,39 @@ Word16 inov_encode_ivas_fx(
{
IF( EQ_32( core_brate, ACELP_6k60 ) )
{
- acelp_2t32_ivas_fx( hBstr, dn, h2, code, y2 );
+ acelp_2t32_fx( hBstr, dn, h2, code, y2 );
}
ELSE IF( ( EQ_32( core_brate, ACELP_8k85 ) ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 20, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_12k65 ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 36, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_14k25 ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 44, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_15k85 ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 52, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_18k25 ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 64, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_19k85 ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 72, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_23k05 ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, cmpl_flag, Opt_AMR_WB, st_fx->element_mode );
}
ELSE IF( EQ_32( core_brate, ACELP_23k85 ) )
{
- acelp_4t64_ivas_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB, st_fx->element_mode );
+ acelp_4t64_fx( hBstr, dn, cn, h2, Rw, acelpautoc, code, y2, 88, 1, Opt_AMR_WB, st_fx->element_mode );
}
}
diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c
index 05dcc5b8d327b4f5f392307a85743e6987f8dff3..dfca3d7ba9845e4c7a71ae4afd16e51c5d804c0c 100644
--- a/lib_enc/ivas_core_enc_fx.c
+++ b/lib_enc/ivas_core_enc_fx.c
@@ -51,37 +51,38 @@
*
* Principal IVAS core coder routine, where number of core channels is 1 or 2
*-------------------------------------------------------------------*/
+
ivas_error ivas_core_enc_fx(
- SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */
- CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
- MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
- const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/
- Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/
- Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/
- Word16 Q_new[],
- Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/
- Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/
- Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquantized for subframes Q12*/
- Word32 epsP_fx[][M + 1], /* i : LP prediction errors epsP_fx_q*/
- Word16 epsP_fx_q[], /* i : LP prediction errors */
- Word16 lsp_new_fx[][M], /* i : LSPs at the end of the frame Q15*/
- Word16 lsp_mid_fx[][M], /* i : LSPs in the middle of the frame Q15*/
- const Word16 vad_hover_flag[], /* i : VAD hanglover flag Q0*/
- Word16 attack_flag[], /* i : attack flag (GSC or TC) Q0*/
- Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer q_re_im_buf*/
- Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer q_re_im_buf*/
- Word16 *q_re_im_buf,
- Word16 old_wsp_fx[][L_WSP], /* i : weighted input signal buffer e_old_wsp*/
- Word16 e_old_wsp[],
- const Word16 loc_harm[], /* i : harmonicity flag Q0*/
- const Word16 cor_map_sum_fx[], /* i : speech/music clasif. parameter Q8*/
- const Word16 vad_flag_dtx[], /* i : HE-SAD flag with additional DTX HO Q0*/
- Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/
- Word16 enerBuffer_fx_exp[], /* o : energy buffer */
- Word16 fft_buff_fx[][2 * L_FFT], /* i : FFT buffer Qx*/
- const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag Q0*/
- const Word16 ivas_format, /* i : IVAS format Q0*/
- const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/
+ SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */
+ CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
+ MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */
+ const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/
+ Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/
+ Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/
+ Word16 Q_new[], /* i : Q factor of speech buffers */
+ Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/
+ Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/
+ Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquantized for subframes Q12*/
+ Word32 epsP_fx[][M + 1], /* i : LP prediction errors epsP_fx_q*/
+ Word16 epsP_fx_q[], /* i : LP prediction errors */
+ Word16 lsp_new_fx[][M], /* i : LSPs at the end of the frame Q15*/
+ Word16 lsp_mid_fx[][M], /* i : LSPs in the middle of the frame Q15*/
+ const Word16 vad_hover_flag[], /* i : VAD hanglover flag Q0*/
+ Word16 attack_flag[], /* i : attack flag (GSC or TC) Q0*/
+ Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer q_re_im_buf*/
+ Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer q_re_im_buf*/
+ Word16 *q_re_im_buf, /* i : Q factor of re/im CLDFB buffers */
+ Word16 old_wsp_fx[][L_WSP], /* i : weighted input signal buffer e_old_wsp*/
+ Word16 e_old_wsp[], /* i : Q factor of old_wsp buffer */
+ const Word16 loc_harm[], /* i : harmonicity flag Q0*/
+ const Word16 cor_map_sum_fx[], /* i : speech/music clasif. parameter Q8*/
+ const Word16 vad_flag_dtx[], /* i : HE-SAD flag with additional DTX HO Q0*/
+ Word32 enerBuffer_fx[][CLDFB_NO_CHANNELS_MAX], /* o : energy buffer enerBuffer_fx_exp*/
+ Word16 enerBuffer_fx_exp[], /* o : energy buffer */
+ Word16 fft_buff_fx[][2 * L_FFT], /* i : FFT buffer Qx*/
+ const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag Q0*/
+ const Word16 ivas_format, /* i : IVAS format Q0*/
+ const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz Q0*/
)
{
Word16 n, input_frame;
@@ -89,17 +90,15 @@ ivas_error ivas_core_enc_fx(
Encoder_State **sts, *st;
STEREO_ICBWE_ENC_HANDLE hStereoICBWE;
STEREO_TD_ENC_DATA_HANDLE hStereoTD;
- move16();
- move16();
Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; /* Q15 */
Word32 shb_speech_fx32[L_FRAME16k];
Word32 *new_swb_speech_fx;
Word16 *inp_fx[CPE_CHANNELS];
- Word16 shb_speech_fx[L_FRAME16k]; // Q_shb_spch
+ Word16 *shb_speech_fx;
Word16 Q_shb_spch;
Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX];
Word16 new_inp_resamp16k_fx[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */
- Word16 hb_speech_fx[L_FRAME16k / 4];
+ Word16 *hb_speech_fx;
Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; /* 2 * Q_new */
Word16 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */
Word16 *new_swb_speech_fx_16;
@@ -107,11 +106,7 @@ ivas_error ivas_core_enc_fx(
Word16 Voicing_flag[CPE_CHANNELS];
Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; /* Q6 */
Word16 unbits[CPE_CHANNELS];
-#ifdef FIX_1111_TDM_LSP_BUFFER
Word16 tdm_lsfQ_PCh_fx[M]; /* Q2.56 */
-#else
- Word16 tdm_lspQ_PCh_fx[M], tdm_lsfQ_PCh_fx[M]; /* 1 : Q15, 2 : Q2.56 */
-#endif
Word16 last_element_mode, tdm_Pitch_reuse_flag;
Word32 element_brate, last_element_brate, input_Fs;
Word16 diff_nBits;
@@ -120,14 +115,12 @@ ivas_error ivas_core_enc_fx(
Word16 i, shift, Q_min;
set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX );
- set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX );
FOR( i = 0; i < CPE_CHANNELS; i++ )
{
set_zero_fx( bwe_exc_extended_fx[i], L_FRAME32k + NL_BUFF_OFFSET );
set16_fx( old_syn_12k8_16k_fx[i], 0, L_FRAME16k );
}
- set16_fx( shb_speech_fx, 0, L_FRAME16k );
push_wmops( "ivas_core_enc" );
@@ -205,7 +198,6 @@ ivas_error ivas_core_enc_fx(
* Initializiation per core-coder channel
*-----------------------------------------------------------------*/
-
st->extl = -1;
move16();
unbits[n] = 0;
@@ -217,6 +209,7 @@ ivas_error ivas_core_enc_fx(
/*---------------------------------------------------------------------*
* Pre-processing, incl. Decision matrix
*---------------------------------------------------------------------*/
+
IF( st->cldfbAnaEnc )
{
Word16 tmp_shift = L_norm_arr( enerBuffer_fx[n], st->cldfbAnaEnc->no_channels );
@@ -231,7 +224,6 @@ ivas_error ivas_core_enc_fx(
Scale_sig( fft_buff_fx[n], ( 2 * L_FFT ), -1 ); // To create 1 headroom for addition of magnitude square spectrum
// fft_buff_fx_exp = add(fft_buff_fx_exp,1);
-
FOR( i = 0; i < st->nb_subfr; i++ )
{
Scale_sig( &A_fx[n][i * ( M + 1 )], M + 1, sub( norm_s( A_fx[n][i * ( M + 1 )] ), 2 ) ); // scaling to Q12
@@ -276,7 +268,7 @@ ivas_error ivas_core_enc_fx(
test();
IF( hCPE != NULL && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->brate_surplus > 0 )
{
- ivas_combined_format_brate_sanity_fx( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &diff_nBits );
+ ivas_combined_format_brate_sanity_fx( element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &diff_nBits );
}
/*---------------------------------------------------------------------*
@@ -317,6 +309,7 @@ ivas_error ivas_core_enc_fx(
/*---------------------------------------------------------------------*
* Preprocessing (preparing) for ACELP/HQ core switching
*---------------------------------------------------------------------*/
+
core_switching_pre_enc_ivas_fx( st, old_inp_12k8_fx[n], sub( Q_new[n], 1 ), old_inp_16k_fx[n], sub( Q_new[n], 1 ), sts[0]->active_cnt, last_element_mode );
/*---------------------------------------------------------------------*
@@ -356,6 +349,7 @@ ivas_error ivas_core_enc_fx(
move16();
Q_spec_old = hTcxEnc->spectrum_long_e;
move16();
+
/* TCX core encoder */
stereo_tcx_core_enc( st, old_inp_12k8_fx[n] + L_INP_MEM, old_inp_16k_fx[n] + L_INP_MEM, Aw_fx[n], lsp_new_fx[n], lsp_mid_fx[n], pitch_buf_fx[n], last_element_mode, vad_hover_flag[0], 0 );
@@ -419,15 +413,7 @@ ivas_error ivas_core_enc_fx(
test();
IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && n == 0 )
{
-#ifdef FIX_1111_TDM_LSP_BUFFER
-#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc );
-#else
- td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], NULL, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc );
-#endif
-#else
- td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, pitch_buf_fx[0], tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc );
-#endif
}
}
@@ -664,6 +650,7 @@ ivas_error ivas_core_enc_fx(
/*---------------------------------------------------------------------*
* Postprocessing for ACELP/HQ core switching
*---------------------------------------------------------------------*/
+
core_switching_post_enc_ivas_fx( st, old_inp_12k8_fx[n], old_inp_16k_fx[n], A_fx[n], Q_new[n] );
/*---------------------------------------------------------------------*
@@ -671,6 +658,8 @@ ivas_error ivas_core_enc_fx(
* WB BWE encoding
*---------------------------------------------------------------------*/
+ hb_speech_fx = new_swb_speech_buffer_fx_16; /* reuse existing buffer: hb_speech[L_FRAME16k/4]; */
+
test();
test();
IF( GE_32( input_Fs, 16000 ) && LT_16( st->bwidth, SWB ) && st->hBWE_TD != NULL )
@@ -692,7 +681,6 @@ ivas_error ivas_core_enc_fx(
wb_bwe_enc_ivas_fx( st, new_inp_resamp16k_fx[n] );
}
-
/*---------------------------------------------------------------------*
* SWB(FB) TBE encoding
* SWB(FB) BWE encoding
@@ -700,6 +688,8 @@ ivas_error ivas_core_enc_fx(
new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX;
new_swb_speech_fx_16 = new_swb_speech_buffer_fx_16 + STEREO_DFT_OVL_MAX;
+ set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX );
+ shb_speech_fx = new_inp_resamp16k_fx[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */
test();
test();
@@ -707,12 +697,40 @@ ivas_error ivas_core_enc_fx(
{
/* Common pre-processing for SWB(FB) TBE and SWB(FB) BWE */
/* Scaling cldfb_state_fx */
+#ifdef FIX_2021_BANDWIDTH_EXTENSION_PROBLEM
+ Word16 q_shift, scf_cldfb;
+ scf_cldfb = L_norm_arr( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length );
+
+ scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, scf_cldfb );
+ st->cldfbSynTd->Q_cldfb_state = add( st->cldfbSynTd->Q_cldfb_state, scf_cldfb );
+
+ q_shift = sub( sub( q_re_im_buf[n], 1 ), st->cldfbSynTd->Q_cldfb_state ); // cldfb_state_fx will be used in cldfbSynthesis_ivas_fx and has to be aligned with (q_re_im_buf[n] - 1)
+ IF( GT_32( q_shift, 0 ) )
+ {
+ FOR( Word16 ts = 0; ts < CLDFB_NO_COL_MAX; ts++ )
+ {
+ scale_sig32( realBuffer_fx[n][ts], CLDFB_NO_CHANNELS_MAX, negate( q_shift ) );
+ scale_sig32( imagBuffer_fx[n][ts], CLDFB_NO_CHANNELS_MAX, negate( q_shift ) );
+ }
+ q_re_im_buf[n] = add( st->cldfbSynTd->Q_cldfb_state, 1 );
+ }
+ ELSE
+ {
+ scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, q_shift ); // st->cldfbSynTd->Q_cldfb_state -> q_realImagBuffer
+ st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
+ }
+#else
scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, sub( q_re_im_buf[n], st->cldfbSynTd->Q_cldfb_state ) ); // st->cldfbSynTd->Q_cldfb_state -> q_realImagBuffer
+#endif
swb_pre_proc_ivas_fx( st, new_swb_speech_fx_16, new_swb_speech_fx, shb_speech_fx, &Q_shb_spch, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], hCPE );
+#ifdef FIX_2021_BANDWIDTH_EXTENSION_PROBLEM
+ st->cldfbSynTd->Q_cldfb_state = sub( q_re_im_buf[n], 1 );
+#else
/* Re-scaling cldfb_state_fx */
scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, negate( sub( q_re_im_buf[n], st->cldfbSynTd->Q_cldfb_state ) ) ); // q_realImagBuffer -> st->cldfbSynTd->Q_cldfb_state
+#endif
}
ELSE IF( GE_32( input_Fs, 32000 ) )
{
@@ -736,7 +754,6 @@ ivas_error ivas_core_enc_fx(
Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, shift ); // st->Q_old_wtda
}
-
/* SWB TBE encoder */
test();
test();
@@ -769,6 +786,7 @@ ivas_error ivas_core_enc_fx(
/*---------------------------------------------------------------------*
* SWB DTX/CNG encoding
*---------------------------------------------------------------------*/
+
test();
test();
test();
@@ -847,6 +865,7 @@ ivas_error ivas_core_enc_fx(
/*------------------------------------------------------------------*
* Write potentially unused bits in combined format coding
*-----------------------------------------------------------------*/
+
test();
test();
IF( hCPE != NULL && EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->brate_surplus > 0 )
diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c
index a121ed3c2d3856d7b22fcdfc6ae63199e721d26b..019361561b527f2a72eb22c1044df820d56e0067 100644
--- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c
+++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c
@@ -695,11 +695,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx(
}
ELSE IF( st_ivas->hMCT != NULL && GT_16( st_ivas->nCPE, 1 ) )
{
-#ifdef NONBE_FIX_ISM_XOVER_BR
- IF( ( error = mct_enc_reconfigure_fx( st_ivas, NE_16( nchan_transport_old_real, nchan_transport_real ) ) ) != IVAS_ERR_OK )
-#else
- IF( ( error = mct_enc_reconfigure_fx( st_ivas, st_ivas->nchan_transport != nchan_transport_old ) ) != IVAS_ERR_OK )
-#endif
+ IF( ( error = mct_enc_reconfigure_fx( st_ivas, (UWord16) NE_16( nchan_transport_old_real, nchan_transport_real ) ) ) != IVAS_ERR_OK )
{
return error;
}
diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c
index edc45174ecfeb49864c8951cc7d5c6bb73a2e87a..b73702d21a52ede899b97ae516e3bc94266c6c72 100644
--- a/lib_enc/ivas_cpe_enc_fx.c
+++ b/lib_enc/ivas_cpe_enc_fx.c
@@ -51,13 +51,16 @@
/*--------------------------------------------------------------------------*
* Local function prototypes
*--------------------------------------------------------------------------*/
+
static void stereo_mode_combined_format_enc_fx( const Encoder_Struct *st_ivas, CPE_ENC_HANDLE hCPE );
+
/*-------------------------------------------------------------------*
* ivas_cpe_enc()
*
* Channel Pair Element (CPE) encoding routine
*-------------------------------------------------------------------*/
+
ivas_error ivas_cpe_enc_fx(
Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
const Word16 cpe_id, /* i : CPE # identifier Q0*/
@@ -69,15 +72,15 @@ ivas_error ivas_cpe_enc_fx(
Word16 Q_new_out[] )
{
CPE_ENC_HANDLE hCPE;
+ STEREO_DFT_CONFIG_DATA_HANDLE hConfigDft;
Encoder_State **sts;
Word16 n, n_CoreChannels;
Word32 old_inp_12k8_fx[CPE_CHANNELS][L_INP_12k8]; /* buffer of input signal @ 12k8 Q15 */
Word16 old_inp_12k8_16fx[CPE_CHANNELS][L_INP_12k8]; /* buffer of input signal @ 12k8 Q_new-1 */
Word32 old_inp_16k_fx[CPE_CHANNELS][L_INP]; /* buffer of input signal @ 16kHz Q15 */
Word16 old_inp_16k_16fx[CPE_CHANNELS][L_INP]; /* buffer of input signal @ 16kHz Q_new-1 */
- Word16 Q_new[CPE_CHANNELS] = { 0 };
- Word16 fft_buff_fx[CPE_CHANNELS][2 * L_FFT]; /* FFT buffer */
- Word16 fft_buff_fx_q[CPE_CHANNELS]; /* FFT buffer */
+ Word16 fft_buff_fx[CPE_CHANNELS][2 * L_FFT]; /* FFT buffer */
+ Word16 fft_buff_fx_q[CPE_CHANNELS]; /* FFT buffer */
set16_fx( fft_buff_fx_q, 0, CPE_CHANNELS );
Word16 fft_buff_fx_final_q = MAX_16;
move16();
@@ -104,13 +107,12 @@ ivas_error ivas_cpe_enc_fx(
Word32 currFlatness_fx[CPE_CHANNELS]; /* flatness parameter Q21 */
Word16 tdm_ratio_idx, tdm_ratio_idx_SM; /* temp. TD stereo parameters */
Word16 tdm_SM_or_LRTD_Pri; /* temp. TD stereo parameters */
-
- Word16 nb_bits; /* number of DFT stereo side bits */
- Word32 fr_bands_fx[CPE_CHANNELS][2 * NB_BANDS]; /* energy in frequency bands (Q_buffer + QSCALE) */
- Word16 Etot_LR_fx[CPE_CHANNELS]; /* total energy Q8 */
- Word32 lf_E_fx[CPE_CHANNELS][2 * VOIC_BINS]; /* per bin spectrum energy in lf (Q_buffer + QSCALE - 2) */
- Word16 localVAD_HE_SAD[CPE_CHANNELS]; /* HE-SAD flag without hangover, LR channels */
- Word32 band_energies_LR_fx[2 * NB_BANDS]; /* energy in critical bands without minimum noise floor E_MIN (Q_buffer + QSCALE - band_ener_guardbits) */
+ Word16 nb_bits; /* number of DFT stereo side bits */
+ Word32 fr_bands_fx[CPE_CHANNELS][2 * NB_BANDS]; /* energy in frequency bands (Q_buffer + QSCALE) */
+ Word16 Etot_LR_fx[CPE_CHANNELS]; /* total energy Q8 */
+ Word32 lf_E_fx[CPE_CHANNELS][2 * VOIC_BINS]; /* per bin spectrum energy in lf (Q_buffer + QSCALE - 2) */
+ Word16 localVAD_HE_SAD[CPE_CHANNELS]; /* HE-SAD flag without hangover, LR channels */
+ Word32 band_energies_LR_fx[2 * NB_BANDS]; /* energy in critical bands without minimum noise floor E_MIN (Q_buffer + QSCALE - band_ener_guardbits) */
Word16 Q_buffer[2];
Word16 orig_input_fx[CPE_CHANNELS][L_FRAME48k];
Word32 orig_input_fx32[CPE_CHANNELS][L_FRAME48k];
@@ -127,8 +129,9 @@ ivas_error ivas_cpe_enc_fx(
Word16 last_bits_frame_nominal; /* last_bits_frame_nominal for M or PCh channel */
Word16 old_wsp_fx[CPE_CHANNELS][L_WSP];
Word16 e_old_wsp[CPE_CHANNELS], q_old_wsp;
- move16(); // Q_new
- move16(); // Q_new
+ Word16 Q_new[CPE_CHANNELS] = { 0 };
+ move16();
+ move16();
Word16 q_com, shift, q_min, gb;
error = IVAS_ERR_OK;
@@ -185,6 +188,7 @@ ivas_error ivas_cpe_enc_fx(
set16_zero_fx( old_inp_12k8_16fx[i], L_INP_12k8 );
set_zero_fx( old_inp_12k8_fx[i], L_INP_12k8 );
}
+
/*------------------------------------------------------------------*
* CPE initialization - core coder
*-----------------------------------------------------------------*/
@@ -263,6 +267,7 @@ ivas_error ivas_cpe_enc_fx(
* Stereo technology selection
* Front-VAD on input L and R channels
*----------------------------------------------------------------*/
+
test();
IF( sts[0]->ini_frame > 0 && st_ivas->hMCT == NULL )
{
@@ -367,11 +372,17 @@ ivas_error ivas_cpe_enc_fx(
/*----------------------------------------------------------------*
* dynamically allocate data structures depending on the actual stereo mode
*----------------------------------------------------------------*/
+
IF( ( error = stereo_memory_enc_fx( hCPE, input_Fs, max_bwidth, ivas_format, st_ivas->nchan_transport ) ) != IVAS_ERR_OK )
{
return error;
}
+ hConfigDft = NULL;
+ IF( hCPE->hStereoDft != NULL )
+ {
+ hConfigDft = hCPE->hStereoDft->hConfig;
+ }
/*----------------------------------------------------------------*
* Set TD stereo parameters
@@ -386,6 +397,7 @@ ivas_error ivas_cpe_enc_fx(
/*----------------------------------------------------------------*
* Resets/updates in case of stereo switching
*----------------------------------------------------------------*/
+
test();
IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) )
{
@@ -416,6 +428,7 @@ ivas_error ivas_cpe_enc_fx(
/*----------------------------------------------------------------*
* Temporal inter-channel alignment, stereo adjustment
*----------------------------------------------------------------*/
+
shift = s_min( L_norm_arr( sts[0]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ), L_norm_arr( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) ) );
q_min = add( sts[0]->q_inp32, sub( shift, find_guarded_bits_fx( input_frame ) ) );
scale_sig32( sts[1]->input_buff32_fx, L_FRAME48k + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ), sub( q_min, sts[1]->q_inp32 ) ); /* q_min */
@@ -438,6 +451,7 @@ ivas_error ivas_cpe_enc_fx(
move16();
move16();
move16();
+
/*----------------------------------------------------------------*
* Input signal buffering - needed in IC-BWE and TD ITD in MDCT stereo
*----------------------------------------------------------------*/
@@ -479,7 +493,7 @@ ivas_error ivas_cpe_enc_fx(
RunTransientDetection_ivas_fx( sts[n]->input_fx, input_frame, sts[n]->hTranDet, sts[n]->q_inp ); // Note q of sts[n]->input_fx changes inside function
}
- currFlatness_fx[n] = GetTCXAvgTemporalFlatnessMeasure_ivas_fx( (const TransientDetection *) sts[n]->hTranDet, NSUBBLOCKS, 0 ); // Q21
+ currFlatness_fx[n] = GetTCXAvgTemporalFlatnessMeasure_ivas_fx( sts[n]->hTranDet, NSUBBLOCKS, 0 ); // Q21
move32();
}
@@ -513,32 +527,23 @@ ivas_error ivas_cpe_enc_fx(
IF( NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) && ( NE_32( hCPE->element_brate, hCPE->last_element_brate ) || NE_16( hCPE->last_element_mode, hCPE->element_mode ) || sts[0]->ini_frame == 0 ||
( NE_32( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate ) ) || LE_32( sts[0]->last_core_brate, SID_2k40 ) ) ) /* If the last frame was SID or NO_DATA, we need to run stereo_dft_config here since VAD decision is not known yet */
{
- STEREO_DFT_CONFIG_DATA_HANDLE hConfig;
- IF( hCPE->hStereoDft == NULL )
- {
- hConfig = NULL;
- }
- ELSE
- {
- hConfig = hCPE->hStereoDft->hConfig;
- }
IF( st_ivas->hQMetaData != NULL )
{
test();
/* No Basop - st_ivas->ism_mode != ISM_MODE_NONE as comparison with 0 */
IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) && st_ivas->ism_mode != ISM_MODE_NONE )
{
- stereo_dft_config_fx( hConfig, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, 35 /* 0.70f * FRAMES_PER_SEC */ ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, 35 /* 0.70f * FRAMES_PER_SEC */ ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
ELSE
{
- stereo_dft_config_fx( hConfig, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, L_mult0( st_ivas->hQMetaData->bits_frame_nominal, FRAMES_PER_SEC ), &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
}
ELSE
{
/* note; "bits_frame_nominal" needed in TD stereo as well */
- stereo_dft_config_fx( hConfig, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, hCPE->element_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
}
@@ -631,6 +636,7 @@ ivas_error ivas_cpe_enc_fx(
* Stereo processing
* Stereo down-mix
*----------------------------------------------------------------*/
+
IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) )
{
test();
@@ -677,17 +683,18 @@ ivas_error ivas_cpe_enc_fx(
hCPE->q_input_mem[n] = q_com;
move16();
}
- stereo_dft_hybrid_ITD_flag_fx( hCPE->hStereoDft->hConfig, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max );
+
+ stereo_dft_hybrid_ITD_flag_fx( hConfigDft, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max );
/* Time Domain ITD compensation using extrapolation */
- stereo_td_itd_fx( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd_fx, hCPE->hStereoDft->q_input_mem_itd, hCPE->hStereoDft->hConfig->hybrid_itd_flag, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem );
+ stereo_td_itd_fx( hCPE->hStereoDft->hItd, hCPE->hStereoDft->input_mem_itd_fx, hCPE->hStereoDft->q_input_mem_itd, hConfigDft->hybrid_itd_flag, hCPE->hStereoDft->dft_ovl, sts, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem );
stereo_dft_enc_analyze_fx( sts, CPE_CHANNELS, input_frame, hCPE->hStereoDft, NULL, hCPE->hStereoDft->DFT_fx, hCPE->hStereoDft->DFT_fx_e, hCPE->input_mem_fx, hCPE->q_input_mem );
sts[0]->total_brate = L_mult0( add( sts[0]->bits_frame_nominal, 10 ), FRAMES_PER_SEC ); /* add small overhead; st[0]->total_brate used in coder_type_modif() Q0*/
/* Update DFT Stereo memories */
- stereo_dft_enc_update_fx( hCPE->hStereoDft, sts[0]->max_bwidth );
+ stereo_dft_enc_update_fx( hCPE->hStereoDft, max_bwidth );
/* DFT stereo processing */
stereo_dft_enc_process_fx( hCPE, vad_flag_dtx, vad_hover_flag, input_frame );
@@ -796,6 +803,7 @@ ivas_error ivas_cpe_enc_fx(
/*----------------------------------------------------------------*
* DFT stereo: iDFT and resampling on both channels
*----------------------------------------------------------------*/
+
IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) )
{
Word32 internal_Fs;
@@ -889,6 +897,7 @@ ivas_error ivas_cpe_enc_fx(
/*----------------------------------------------------------------*
* Front Pre-processing
*----------------------------------------------------------------*/
+
FOR( n = 0; n < n_CoreChannels; n++ )
{
set16_fx( old_wsp_fx[n], 0, L_WSP );
@@ -949,6 +958,7 @@ ivas_error ivas_cpe_enc_fx(
/*----------------------------------------------------------------*
* Stereo DTX updates
*----------------------------------------------------------------*/
+
test();
test();
IF( EQ_16( ivas_format, MASA_FORMAT ) && nb_bits_metadata > 0 && hCPE->hCoreCoder[0]->Opt_DTX_ON )
@@ -988,7 +998,7 @@ ivas_error ivas_cpe_enc_fx(
test();
test();
test();
- IF( sts[0]->bwidth != sts[0]->last_bwidth || ( ( hCPE->last_element_brate != hCPE->element_brate || hCPE->last_element_mode != hCPE->element_mode ) && sts[0]->bwidth != sts[0]->max_bwidth ) )
+ IF( sts[0]->bwidth != sts[0]->last_bwidth || ( ( hCPE->last_element_brate != hCPE->element_brate || hCPE->last_element_mode != hCPE->element_mode ) && sts[0]->bwidth != max_bwidth ) )
{
initMdctStereoEncData_fx( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, sts[0]->bwidth, 0, NULL, 0 );
@@ -1023,13 +1033,13 @@ ivas_error ivas_cpe_enc_fx(
Word16 bw;
/* float uses ternary operator for this: bw = ( hCPE->element_mode == IVAS_CPE_MDCT ) ? sts[n]->bwidth : sts[n]->max_bwidth; */
- bw = sts[n]->max_bwidth;
+ bw = max_bwidth;
IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) )
{
bw = sts[n]->bwidth;
}
igf = getIgfPresent_fx( sts[n]->element_mode, L_mult0( sts[n]->bits_frame_nominal, FRAMES_PER_SEC ), bw, sts[n]->rf_mode ); /* Q0 */
- IF( ( error = IGF_Reconfig_fx( &sts[n]->hIGFEnc, igf, 0, L_mult0( sts[n]->bits_frame_nominal, FRAMES_PER_SEC ), sts[n]->max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK )
+ IF( ( error = IGF_Reconfig_fx( &sts[n]->hIGFEnc, igf, 0, L_mult0( sts[n]->bits_frame_nominal, FRAMES_PER_SEC ), max_bwidth, sts[n]->element_mode, sts[n]->rf_mode ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -1083,17 +1093,7 @@ ivas_error ivas_cpe_enc_fx(
IF( EQ_32( sts[0]->core_brate, SID_2k40 ) )
{
- ivas_write_format_sid_fx( ivas_format, hCPE->element_mode, sts[0]->hBstr );
-#ifdef NONBE_FIX_1052_SBA_EXT
- IF( EQ_32( ivas_format, SBA_FORMAT ) )
- {
- /* Write SBA planar flag */
- push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS );
-
- /* Write SBA order */
- push_indice( sts[0]->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS );
- }
-#endif
+ ivas_write_format_sid_fx( ivas_format, hCPE->element_mode, sts[0]->hBstr, hEncoderConfig->sba_order, hEncoderConfig->sba_planar );
}
/*----------------------------------------------------------------*
@@ -1113,11 +1113,11 @@ ivas_error ivas_cpe_enc_fx(
/* Reconfigure DFT Stereo for inactive frames */
IF( EQ_32( sts[0]->core_brate, SID_2k40 ) )
{
- stereo_dft_config_fx( hCPE->hStereoDft->hConfig, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
ELSE
{
- stereo_dft_config_fx( hCPE->hStereoDft->hConfig, FRAME_NO_DATA, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
+ stereo_dft_config_fx( hConfigDft, FRAME_NO_DATA, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal );
}
stereo_dft_cng_side_gain_fx( hCPE->hStereoDft, hCPE->hStereoCng, sts[0]->core_brate, sts[0]->last_core_brate, sts[0]->bwidth );
@@ -1302,11 +1302,13 @@ ivas_error ivas_cpe_enc_fx(
return error;
}
+
/*-------------------------------------------------------------------------
* create_cpe_enc()
*
* Create, allocate and initialize IVAS encoder CPE handle
*-------------------------------------------------------------------------*/
+
ivas_error create_cpe_enc_fx(
Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */
const Word16 cpe_id, /* i : CPE # identifier Q0*/
@@ -1608,6 +1610,8 @@ ivas_error create_cpe_enc_fx(
return error;
}
+
+
/*-------------------------------------------------------------------------
* destroy_cpe_enc()
*
@@ -1763,5 +1767,6 @@ static void stereo_mode_combined_format_enc_fx(
}
}
}
+
return;
}
diff --git a/lib_enc/ivas_decision_matrix_enc_fx.c b/lib_enc/ivas_decision_matrix_enc_fx.c
index bd63553bd70f502ee2ad342de594d6ade28caf07..3d1084b1d4cd3909ce7dee575609d4768e9b3e98 100644
--- a/lib_enc/ivas_decision_matrix_enc_fx.c
+++ b/lib_enc/ivas_decision_matrix_enc_fx.c
@@ -197,14 +197,6 @@ void ivas_decision_matrix_enc_fx(
move16();
}
}
-
- test();
- test();
- test();
- test();
- test();
- test();
-
#ifdef DEBUG_FORCE_DIR
if ( st->force_dir[0] != '\0' )
{
@@ -217,14 +209,22 @@ void ivas_decision_matrix_enc_fx(
#endif
/* do not allow TD stereo ACELP core -> DFT stereo TCX core switching as it is on the WC complexity path */
+ test();
+ test();
+ test();
+ test();
+ test();
+ test();
if ( ( ( st->last_core == ACELP_CORE && EQ_16( last_element_mode, IVAS_CPE_TD ) && EQ_16( st->element_mode, IVAS_CPE_DFT ) ) || ( EQ_16( st->tdm_LRTD_flag, 1 ) && LE_32( st->total_brate, IVAS_16k4 ) ) ) && EQ_16( st->core, TCX_20_CORE ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) /* Override TCX in case of LRTD && primary channel has low bitrate*/
{
st->core = ACELP_CORE;
move16();
}
+ /* sanity check: highest bitrates in ISM */
+ test();
test();
- if ( st->is_ism_format && st->tcxonly )
+ if ( st->is_ism_format && st->tcxonly && GT_32( st->total_brate, MAX_ACELP_BRATE_ISM ) )
{
st->core = TCX_20_CORE;
move16();
diff --git a/lib_enc/ivas_dirac_enc_fx.c b/lib_enc/ivas_dirac_enc_fx.c
index b6b41b8478214cae2b3017abf60bbbfaa54bc91a..efd6129032cbf9f514d40cfaa97e0a960e82f55d 100644
--- a/lib_enc/ivas_dirac_enc_fx.c
+++ b/lib_enc/ivas_dirac_enc_fx.c
@@ -39,12 +39,13 @@
#include "ivas_prot_fx.h"
#include "ivas_cnst.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "wmc_auto.h"
+
/*-------------------------------------------------------------------------
* Local function prototypes
*------------------------------------------------------------------------*/
+
static void computeIntensityVector_enc_fx(
const DIRAC_ENC_HANDLE hDirAC,
Word32 Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],
@@ -55,6 +56,7 @@ static void computeIntensityVector_enc_fx(
Word16 q_cldfb,
Word16 q_intensity_real[DIRAC_MAX_NBANDS] );
+
/*-------------------------------------------------------------------------
* ivas_dirac_enc_open()
*
@@ -321,10 +323,8 @@ ivas_error ivas_dirac_enc_fx(
const Word16 input_frame, /* i : input frame length Q0*/
const Word16 dtx_vad, /* i : DTX vad flag Q0*/
const IVAS_FORMAT ivas_format, /* i : ivas format */
-#ifdef NONBE_FIX_1052_SBA_EXT
- const Word16 nchan_transport, /* i : number of transport channels */
-#endif
- const Word16 hodirac_flag, /* i : hodirac flag Q0*/
+ const Word16 nchan_transport, /* i : number of transport channels */
+ const Word16 hodirac_flag, /* i : hodirac flag Q0*/
const Word16 shift )
{
Word16 orig_dirac_bands;
@@ -464,11 +464,7 @@ ivas_error ivas_dirac_enc_fx(
push_next_indice( hMetaData, 1, 1 );
/* encode SID parameters */
-#ifdef NONBE_FIX_1052_SBA_EXT
ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, -1, nchan_transport, SBA_FORMAT );
-#else
- ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, -1, SBA_FORMAT );
-#endif
}
Word16 len = 0;
diff --git a/lib_enc/ivas_enc_fx.c b/lib_enc/ivas_enc_fx.c
index 11368cec8f39d7fb776803aa4529e5a570ad68ca..c4d7b75a7ec81a0cfa02fce7e2f9a5135aedf0cf 100644
--- a/lib_enc/ivas_enc_fx.c
+++ b/lib_enc/ivas_enc_fx.c
@@ -87,8 +87,7 @@ ivas_error ivas_enc_fx(
input_frame = extract_l( Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 ) );
IF( NE_16( nchan_inp, 1 ) )
{
- n_samples_chan = div_l( L_deposit_l( n_samples ), nchan_inp ); /* Q0 */
- n_samples_chan = shl( n_samples_chan, 1 ); /* Q0 */
+ n_samples_chan = extract_l( Mpy_32_32_r( n_samples, one_by_q_level[nchan_inp] ) ); /* Q0 */
}
ELSE
{
diff --git a/lib_enc/ivas_front_vad_fx.c b/lib_enc/ivas_front_vad_fx.c
index 1f62b6854b01955de104e106528d5c713a61ec4a..ce09abdbc0e3806675880b57ba31e6820fdad1c9 100644
--- a/lib_enc/ivas_front_vad_fx.c
+++ b/lib_enc/ivas_front_vad_fx.c
@@ -385,7 +385,7 @@ ivas_error front_vad_create_fx(
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VAD\n" ) );
}
- wb_vad_init_ivas_fx( hFrontVad->hVAD );
+ wb_vad_init_fx( hFrontVad->hVAD );
hFrontVad->lp_speech_fx = 11520; // 45.0f in Q8 /* Initialize the long-term active speech level in dB */
move16();
diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c
index 3f5b8f8636e8870bd1ba4c480dddd51adba9fc39..08cdfd044ecab931e1796de1f02f525b81972618 100644
--- a/lib_enc/ivas_init_enc_fx.c
+++ b/lib_enc/ivas_init_enc_fx.c
@@ -153,7 +153,9 @@ void ivas_write_format_fx(
void ivas_write_format_sid_fx(
const IVAS_FORMAT ivas_format, /* i : IVAS format */
const Word16 element_mode, /* i : element bitrate Q0*/
- BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 sba_order, /* i : Ambisonic (SBA) order */
+ const Word16 sba_planar /* i : SBA planar flag */
)
{
Word16 ind = 0; /* to avoid compilation warning */
@@ -181,10 +183,6 @@ void ivas_write_format_sid_fx(
ind = SID_ISM;
move16();
BREAK;
- case MC_FORMAT:
- ind = SID_MULTICHANNEL;
- move16();
- BREAK;
case SBA_FORMAT:
SWITCH( element_mode )
{
@@ -220,6 +218,15 @@ void ivas_write_format_sid_fx(
push_indice( hBstr, IND_IVAS_FORMAT, ind, SID_FORMAT_NBITS );
+ IF( EQ_32( ivas_format, SBA_FORMAT ) )
+ {
+ /* Write SBA planar flag */
+ push_indice( hBstr, IND_SMODE, sba_planar, SBA_PLANAR_BITS );
+
+ /* Write SBA order */
+ push_indice( hBstr, IND_SMODE, sba_order, SBA_ORDER_BITS );
+ }
+
return;
}
@@ -426,6 +433,7 @@ ivas_error ivas_init_encoder_fx(
Word32 element_brate_tmp[MAX_NUM_OBJECTS];
ENCODER_CONFIG_HANDLE hEncoderConfig;
ivas_error error;
+ Word32 tmp_br, tmp32;
error = IVAS_ERR_OK;
move32();
@@ -654,11 +662,10 @@ ivas_error ivas_init_encoder_fx(
}
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( ( error = create_sce_enc_fx( st_ivas, sce_id, res_dec ) ) != IVAS_ERR_OK )
+ IF( ( error = create_sce_enc_fx( st_ivas, sce_id, tmp_br ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -670,11 +677,11 @@ ivas_error ivas_init_encoder_fx(
}
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ) != IVAS_ERR_OK )
+ IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -769,15 +776,7 @@ ivas_error ivas_init_encoder_fx(
st_ivas->ism_mode = ISM_MODE_NONE;
move16();
-#ifdef NONBE_FIX_ISM_XOVER_BR
st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism );
-#else
- IF( GE_32( ivas_total_brate, IVAS_256k ) )
- {
- st_ivas->ism_mode = ISM_SBA_MODE_DISC;
- move16();
- }
-#endif
IF( ( error = ivas_ism_metadata_enc_create_fx( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK )
{
@@ -813,11 +812,11 @@ ivas_error ivas_init_encoder_fx(
}
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ) != IVAS_ERR_OK )
+ IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -834,22 +833,18 @@ ivas_error ivas_init_encoder_fx(
ELSE
{
/* allocate and initialize MCT core coder */
-#ifdef NONBE_FIX_ISM_XOVER_BR
{
int16_t n_all;
n_all = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism );
st_ivas->nCPE = shr_r( n_all, 1 );
}
-#else
- st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) ); /* Q0 */
-#endif
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 );
- IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ) != IVAS_ERR_OK )
+ IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -882,11 +877,11 @@ ivas_error ivas_init_encoder_fx(
st_ivas->nCPE = shr( hEncoderConfig->nchan_inp, CPE_CHANNELS_LOG2 ); /* Q0 */
move16();
+ iDiv_and_mod_32( ivas_total_brate, sub( hEncoderConfig->nchan_inp, 1 ), &tmp_br, &tmp32, 0 );
+ tmp_br = L_shl( tmp_br, CPE_CHANNELS_LOG2 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, sub( hEncoderConfig->nchan_inp, 1 ), &res_dec, &res_frac, 0 );
- IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ) != IVAS_ERR_OK )
+ IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -919,11 +914,10 @@ ivas_error ivas_init_encoder_fx(
return error;
}
+ iDiv_and_mod_32( ivas_total_brate, st_ivas->nCPE, &tmp_br, &tmp32, 0 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nCPE, &res_dec, &res_frac, 0 );
- IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, res_dec ) ) != IVAS_ERR_OK )
+ IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -946,11 +940,10 @@ ivas_error ivas_init_encoder_fx(
return error;
}
+ iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nCPE, st_ivas->nSCE ), &tmp_br, &tmp32, 0 );
FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ )
{
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nCPE, st_ivas->nSCE ), &res_dec, &res_frac, 0 );
- IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, res_dec ) ) != IVAS_ERR_OK )
+ IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, tmp_br ) ) != IVAS_ERR_OK )
{
return error;
}
@@ -1097,7 +1090,7 @@ void destroy_core_enc_fx(
IF( hCoreCoder->hVAD_CLDFB != NULL )
{
- /* This is not required as we are not allocating memory dynamically */
+ /* This is not required as this is only allocated in EVS mode */
// free( hCoreCoder->hVAD_CLDFB );
hCoreCoder->hVAD_CLDFB = NULL;
}
@@ -1249,8 +1242,7 @@ void destroy_evs_core_enc_fx(
IF( hCoreCoder->hVAD_CLDFB != NULL )
{
- /* This is not required as we are not allocating memory dynamically */
- // free( hCoreCoder->hVAD_CLDFB );
+ free( hCoreCoder->hVAD_CLDFB );
hCoreCoder->hVAD_CLDFB = NULL;
}
diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c
index 3e7d8afcd71851e989044b64fe03ef9c50d05bbd..6b75a6be7494dc6490eeb62381b0840438e4a4f5 100644
--- a/lib_enc/ivas_ism_enc_fx.c
+++ b/lib_enc/ivas_ism_enc_fx.c
@@ -217,7 +217,7 @@ ivas_error ivas_ism_enc_fx(
RunTransientDetection_ivas_fx( st->input_fx, input_frame, st->hTranDet, st->q_inp );
- currFlatness_fx[0] = GetTCXAvgTemporalFlatnessMeasure_ivas_fx( (const TransientDetection *) st->hTranDet, NSUBBLOCKS, 0 ); // Q21
+ currFlatness_fx[0] = GetTCXAvgTemporalFlatnessMeasure_ivas_fx( st->hTranDet, NSUBBLOCKS, 0 ); // Q21
move16();
/*----------------------------------------------------------------*
@@ -383,7 +383,8 @@ ivas_error ivas_ism_enc_fx(
IF( sid_flag )
{
- ivas_write_format_sid_fx( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr );
+
+ ivas_write_format_sid_fx( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr, -1, -1 );
}
/*only metadata encoding is needed for this case*/
diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c
index d35327de0cb0aacb322d1e8ab8b21a23eaddc481..32582f2db10e8e7dedae16d3796559b0727d65ce 100644
--- a/lib_enc/ivas_ism_metadata_enc_fx.c
+++ b/lib_enc/ivas_ism_metadata_enc_fx.c
@@ -41,7 +41,6 @@
#include
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-----------------------------------------------------------------------*
diff --git a/lib_enc/ivas_ism_param_enc_fx.c b/lib_enc/ivas_ism_param_enc_fx.c
index cda8cffd674b477b98ea0d5bc665a92cd1198792..47da31a1ab0c03b5be9d96ed9d931e6e55ee11c1 100644
--- a/lib_enc/ivas_ism_param_enc_fx.c
+++ b/lib_enc/ivas_ism_param_enc_fx.c
@@ -40,7 +40,6 @@
#include "ivas_cnst.h"
#include "ivas_rom_com.h"
#include "wmc_auto.h"
-#include "ivas_rom_com_fx.h"
/*-------------------------------------------------------------------------
* Local function definitions
@@ -310,7 +309,7 @@ void ivas_param_ism_stereo_dmx_fx(
cardioid_right[i] = sub( ONE_IN_Q14 /* 1.0f in Q14 */, cardioid_left[i] ); /* corresponds to: alpha + ( 1 - alpha ) * cosf( tmp + tmp_1 ); */
move16();
/* Loop over all samples */
- FOR( j = 0; j < input_frame >> 1; j++ )
+ FOR( j = 0; j < ( input_frame >> 1 ); j++ )
{
tmp = data[i][j];
move32();
@@ -387,7 +386,7 @@ void ivas_param_ism_stereo_dmx_fx(
tmp_1 = 15 + 1;
move16();
- FOR( i = 0; i < input_frame >> 1; i++ )
+ FOR( i = 0; i < ( input_frame >> 1 ); i++ )
{
stereo_dmx[0][i] = W_extract_l( W_shr( W_mult_32_32( stereo_dmx[0][i], L_add( tmp, mult0( i, grad ) ) ), tmp_1 ) ); // Qx
move32();
diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c
index 0c87faa4e5441a9ef0e1035723eb02723bdfa6d9..2905491e3c7d20697ac3c905f1b4ea77ab4f2f0b 100644
--- a/lib_enc/ivas_masa_enc_fx.c
+++ b/lib_enc/ivas_masa_enc_fx.c
@@ -40,7 +40,6 @@
#include "prot_fx.h"
#include "prot_fx_enc.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-----------------------------------------------------------------------*
@@ -116,6 +115,7 @@ static void masa_metadata_direction_alignment_fx( MASA_ENCODER_HANDLE hMasa );
*
* open and initialize MASA encoder
*-----------------------------------------------------------------------*/
+
ivas_error ivas_masa_enc_open_fx(
Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */
)
@@ -223,10 +223,22 @@ ivas_error ivas_masa_enc_open_fx(
hOmasaData->omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX;
move16();
- FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
+ IF( NE_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) )
{
- set_zero_fx( hOmasaData->energy_ism_fx[i], MASA_FREQUENCY_BANDS ); // hOmasaData->energy_ism_fx_e
- set16_fx( hOmasaData->energy_ism_fx_e[i], 0, MASA_FREQUENCY_BANDS );
+ IF( ( hOmasaData->hOmasaEnergy = (OMASA_ENCODER_ENERGY_HANDLE) malloc( sizeof( OMASA_ENCODER_ENERGY_STATE ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA energy handle\n" ) );
+ }
+
+ FOR( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ )
+ {
+ set_zero_fx( hOmasaData->hOmasaEnergy->energy_ism_fx[i], MASA_FREQUENCY_BANDS ); // hOmasaData->energy_ism_fx_e
+ set16_fx( hOmasaData->hOmasaEnergy->energy_ism_fx_e[i], 0, MASA_FREQUENCY_BANDS );
+ }
+ }
+ else
+ {
+ hOmasaData->hOmasaEnergy = NULL;
}
hMasa->data.hOmasaData = hOmasaData;
@@ -241,11 +253,13 @@ ivas_error ivas_masa_enc_open_fx(
return error;
}
+
/*-----------------------------------------------------------------------*
* ivas_masa_enc_close()
*
* close MASA encoder
*-----------------------------------------------------------------------*/
+
void ivas_masa_enc_close_fx(
MASA_ENCODER_HANDLE *hMasa /* i/o: MASA metadata structure */
)
@@ -265,6 +279,12 @@ void ivas_masa_enc_close_fx(
IF( ( *hMasa )->data.hOmasaData != NULL )
{
+ IF( ( *hMasa )->data.hOmasaData->hOmasaEnergy != NULL )
+ {
+ free( ( *hMasa )->data.hOmasaData->hOmasaEnergy );
+ ( *hMasa )->data.hOmasaData->hOmasaEnergy = NULL;
+ }
+
free( ( *hMasa )->data.hOmasaData );
( *hMasa )->data.hOmasaData = NULL;
}
@@ -275,6 +295,7 @@ void ivas_masa_enc_close_fx(
return;
}
+
/*-----------------------------------------------------------------------*
* ivas_masa_encode()
*
@@ -533,11 +554,9 @@ ivas_error ivas_masa_encode_fx(
}
ELSE
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
test();
IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) )
{
-#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
/* use the MASA number of transport channels bit to signal if there are 1 or 2 objects */
test();
IF( EQ_16( nchan_ism, 1 ) || EQ_16( nchan_ism, 2 ) )
@@ -549,26 +568,12 @@ ivas_error ivas_masa_encode_fx(
/* for 3 or 4 objects write already the number of MASA directions */
push_next_indice( hMetaData, sub( hQMetaData->no_directions, 1 ), MASA_TRANSP_BITS );
}
-#else
- /* use the MASA number of transport channels bit to signal if there are 3 or 4 objects */
- IF( EQ_16( nchan_ism, 4 ) )
- {
- push_next_indice( hMetaData, 1, MASA_TRANSP_BITS );
- }
- ELSE
- {
- push_next_indice( hMetaData, 0, MASA_TRANSP_BITS );
- }
-#endif
}
ELSE
{
-#endif
/* write the number of MASA transport channels */
push_next_indice( hMetaData, sub( nchan_transport, 1 ), MASA_TRANSP_BITS );
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
}
-#endif
hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_TRANSP_BITS );
move16();
}
@@ -576,8 +581,6 @@ ivas_error ivas_masa_encode_fx(
test();
IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) )
{
-#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
-#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
IF( GE_16( nchan_ism, 3 ) ) /* if 3 or 4 objects */
{
push_next_indice( hMetaData, sub( 5, nchan_ism ), MASA_HEADER_BITS );
@@ -586,26 +589,8 @@ ivas_error ivas_masa_encode_fx(
{
push_next_indice( hMetaData, 3, MASA_HEADER_BITS );
}
-#else
- IF( LE_16( nchan_ism, 3 ) )
- {
- push_next_indice( hMetaData, nchan_ism, MASA_HEADER_BITS );
- }
- ELSE
- {
- push_next_indice( hMetaData, sub( nchan_ism, 1 ), MASA_HEADER_BITS );
- }
-#endif
- hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS );
- move16();
-#else
- /* signal MASA_ISM_FORMAT to decoder */
- push_next_indice( hMetaData, 1, 1 );
- /* write reserved bit */
- push_next_indice( hMetaData, 0, MASA_HEADER_BITS - 1 );
hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS );
move16();
-#endif
}
ELSE
{
@@ -615,20 +600,16 @@ ivas_error ivas_masa_encode_fx(
hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, MASA_HEADER_BITS );
move16();
}
-#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
test();
test();
test();
IF( !( EQ_32( ivas_format, MASA_ISM_FORMAT ) && EQ_32( ism_mode, ISM_MODE_NONE ) && GT_16( nchan_ism, 2 ) ) )
{
-#endif
/* write number of directions */
push_next_indice( hMetaData, sub( hQMetaData->no_directions, 1 ), 1 );
hQMetaData->metadata_max_bits = sub( hQMetaData->metadata_max_bits, 1 );
move16();
-#ifdef NONBE_FIX_1074_NOBJ_SIGNAL_OMASA_LBR
}
-#endif
/* write subframe mode */
IF( EQ_16( hQMetaData->q_direction[0].cfg.nblocks, 1 ) )
@@ -811,11 +792,7 @@ ivas_error ivas_masa_encode_fx(
free( h_orig_metadata );
-#ifdef NONBE_FIX_1052_SBA_EXT
ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, masa_sid_descriptor, 0, ivas_format );
-#else
- ivas_qmetadata_enc_sid_encode_fx( hMetaData, hQMetaData, masa_sid_descriptor, ivas_format );
-#endif
/* restore old values */
hMasa->config.numCodingBands = numCodingBands;
@@ -834,6 +811,8 @@ ivas_error ivas_masa_encode_fx(
return IVAS_ERR_OK;
}
+
+
/*-----------------------------------------------------------------------*
* ivas_masa_estimate_energy_fx()
*
@@ -845,7 +824,7 @@ void ivas_masa_estimate_energy_fx(
Word32 *data_fx[], /* i : Input audio channels Q(q_data) */
const Word16 input_frame, /* i : frame length */
const Word16 nchan_transport, /* i : number of MASA input/transport channels */
- Word16 q_data /* i : q for data_fx */
+ Word16 q_data /* i : q for data_fx */
)
{
Word32 Input_RealBuffer[MASA_MAX_TRANSPORT_CHANNELS][CLDFB_NO_CHANNELS_MAX];
@@ -1018,7 +997,6 @@ ivas_error ivas_masa_enc_config_fx(
}
}
-
/* Inspect metadata for parameter changes that affect coding. */
detect_metadata_composition_fx( hMasa, &joinedSubframes, &coherencePresent, &isActualTwoDir );
@@ -1061,7 +1039,6 @@ ivas_error ivas_masa_enc_config_fx(
{
set32_fx( hMasa->data.importanceWeight_fx, ONE_IN_Q30 /*1.0f Q30*/, MASA_FREQUENCY_BANDS );
-
IF( EQ_16( hMasa->config.numCodingBands, 5 ) )
{
hMasa->data.importanceWeight_fx[4] = 751619277 /*0.7f q30*/;
@@ -1146,7 +1123,7 @@ ivas_error ivas_masa_enc_config_fx(
}
ELSE
{
- hQMetaData->q_direction[i].cfg.nblocks = 4;
+ hQMetaData->q_direction[i].cfg.nblocks = MAX_PARAM_SPATIAL_SUBFRAMES;
}
move16();
@@ -1230,10 +1207,8 @@ ivas_error ivas_masa_enc_config_fx(
}
}
-
masa_sample_rate_band_correction_fx( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, maxBand, (UWord8) GE_32( masa_total_brate, IVAS_384k ), NULL );
-
IF( GE_16( hMasa->config.numTwoDirBands, hMasa->config.numCodingBands ) )
{
hMasa->config.numTwoDirBands = hMasa->config.numCodingBands;
@@ -1276,13 +1251,17 @@ ivas_error ivas_masa_enc_config_fx(
}
move16();
}
+
return error;
}
+
+
/*-----------------------------------------------------------------------*
* ivas_masa_surrcoh_signicant()
*
* Determine if surrounding coherence is significant in this frame and should be encoded
*-----------------------------------------------------------------------*/
+
UWord8 ivas_masa_surrcoh_signicant_fx(
Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Surround coherence Q31 */
Word32 diffuse_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : Diffuse to total ratio Q31 */
@@ -1353,6 +1332,7 @@ UWord8 ivas_masa_surrcoh_signicant_fx(
return 0;
}
+
/*-----------------------------------------------------------------------*
* Local functions
*-----------------------------------------------------------------------*/
@@ -1679,6 +1659,7 @@ static void combine_freqbands_and_subframes_fx(
*
*
*-------------------------------------------------------------------*/
+
void ivas_masa_combine_directions_fx(
MASA_ENCODER_HANDLE hMasa )
{
@@ -2022,7 +2003,7 @@ static void move_metadata_to_qmetadata_fx(
move16();
move16();
move16();
- numSf = 4;
+ numSf = MAX_PARAM_SPATIAL_SUBFRAMES;
if ( EQ_16( hMasa->config.joinedSubframes, TRUE ) )
{
numSf = 1;
@@ -2357,6 +2338,7 @@ static void compensate_energy_ratios_fx(
return;
}
+
/* If the bit budget is very low, reduce metadata further to either 1 subframe and 5 bands, or 1 band and 4 subframes, based on which works better */
static void reduce_metadata_further_fx(
MASA_ENCODER_HANDLE hMasa,
@@ -2667,11 +2649,8 @@ static void reduce_metadata_further_fx(
/* Copy spread coherence to the rest of subframes for the coherence coding algorithm. */
FOR( sf = 1; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
{
- FOR( band = 0; band < numCodingBands; band++ )
- {
- hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[0]; // Q0
- move16();
- }
+ hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[sf] = hqmetadata->q_direction[0].coherence_band_data[band].spread_coherence[0]; // Q0
+ move16();
}
/* Surround coherence is already merged through time */
@@ -2959,6 +2938,7 @@ static Word16 encode_lfe_to_total_energy_ratio_fx(
*
* Reconfigure IVAS MASA encoder
*-------------------------------------------------------------------*/
+
void ivas_masa_enc_reconfigure_fx(
Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
)
@@ -2967,7 +2947,7 @@ void ivas_masa_enc_reconfigure_fx(
Word16 sce_id, cpe_id;
Word32 ivas_total_brate;
Word32 ism_total_brate;
- Word32 tmp_br, tmp_mod;
+ Word32 tmp_br;
ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate;
move32();
@@ -2988,7 +2968,7 @@ void ivas_masa_enc_reconfigure_fx(
IF( NE_32( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate ) )
{
- iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &tmp_br, &tmp_mod, 0 );
+ tmp_br = Mpy_32_32_r( ivas_total_brate, one_by_q_level[st_ivas->nchan_transport] );
FOR( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ )
{
copy_encoder_config_fx( st_ivas, st_ivas->hSCE[sce_id]->hCoreCoder[0], 0 );
@@ -3038,11 +3018,13 @@ void ivas_masa_enc_reconfigure_fx(
return;
}
+
/*-------------------------------------------------------------------*
* average_masa_metadata()
*
* Average MASA metadata frame subframe contents: applies aggregation over time
*-------------------------------------------------------------------*/
+
static void average_masa_metadata_fx(
MASA_METADATA_FRAME *hMeta,
Word32 energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /*i Q(31 - energy_e) */
@@ -3205,6 +3187,7 @@ static void average_masa_metadata_fx(
*
* Copy MASA metadata frame subframe contents
*-------------------------------------------------------------------*/
+
static void copy_masa_metadata_subframe_fx(
const MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metdata to be copied */
const UWord8 sfFrom, /* i : subframe index of the copy source */
@@ -3237,11 +3220,13 @@ static void copy_masa_metadata_subframe_fx(
return;
}
+
/*-------------------------------------------------------------------*
* copy_masa_metadata()
*
* Copy MASA metada frame contents
*-------------------------------------------------------------------*/
+
static void copy_masa_metadata_fx(
const MASA_METADATA_HANDLE hMetaFrom, /* i : MASA frame metadata to be copied */
MASA_METADATA_HANDLE hMetaTo /* o : MASA frame metadata copy destination */
@@ -3280,6 +3265,7 @@ static void copy_masa_metadata_fx(
return;
}
+
/*-------------------------------------------------------------------*
* are_masa_subframes_similar()
*
@@ -3395,6 +3381,7 @@ static UWord8 are_masa_subframes_similar_fx(
}
}
+
/*-------------------------------------------------------------------*
* detect_framing_async()
*
@@ -3402,6 +3389,7 @@ static UWord8 are_masa_subframes_similar_fx(
* Analysis result is stored in hMasa->data.sync_state, and
* potentially hMasa->masaMetadata is modified
*-------------------------------------------------------------------*/
+
static void detect_framing_async_fx(
MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder structure */
)
@@ -3547,12 +3535,14 @@ static void detect_framing_async_fx(
return;
}
+
/*-------------------------------------------------------------------*
* masa_metadata_direction_alignment()
*
* In 2dir MASA metadata, determine the ordering of the directional
* fields such that the azi/ele change across time is minimized.
*-------------------------------------------------------------------*/
+
static void masa_metadata_direction_alignment_fx(
MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */
)
@@ -3804,11 +3794,13 @@ static void masa_metadata_direction_alignment_fx(
return;
}
+
/*-------------------------------------------------------------------*
* ivas_merge_masa_metadata()
*
*
*-------------------------------------------------------------------*/
+
void ivas_merge_masa_metadata_fx(
MASA_ENCODER_HANDLE hMasa, /* i/o: MASA enc handle. source for MASA metadata and combined metadata will be here */
OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */
@@ -3829,6 +3821,7 @@ void ivas_merge_masa_metadata_fx(
Word32 eneBand_fx; /*eneBand_e*/
Word16 eneBand_e;
Word32 energyMerged_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /*energyMerged_e*/
+ OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hMasa->data.hOmasaData->hOmasaEnergy;
Word32 temp1 /*temp1_e*/, temp2 /*temp2_e*/;
Word16 temp1_e, temp2_e;
@@ -3840,7 +3833,7 @@ void ivas_merge_masa_metadata_fx(
}
ELSE
{
- numSf = 4;
+ numSf = MAX_PARAM_SPATIAL_SUBFRAMES;
}
move16();
move16();
@@ -3872,7 +3865,7 @@ void ivas_merge_masa_metadata_fx(
eneBand_e = hMasa->data.energy_e[sf][band];
move32();
move16();
- energyMerged_fx[sf][band] = BASOP_Util_Add_Mant32Exp( eneBand_fx, eneBand_e, hMasa->data.hOmasaData->energy_ism_fx[sf][band], hMasa->data.hOmasaData->energy_ism_fx_e[sf][band], &energyMerged_e[sf][band] );
+ energyMerged_fx[sf][band] = BASOP_Util_Add_Mant32Exp( eneBand_fx, eneBand_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energyMerged_e[sf][band] );
move32();
/* Compute weights */
@@ -3898,8 +3891,8 @@ void ivas_merge_masa_metadata_fx(
total_diff_nrg_e = add( eneBand_e, 1 );
/* criterion is mean of ISM ratio and new ratio */
- temp1 = BASOP_Util_Add_Mant32Exp( L_add( EPSILON_FX, eneBand_fx ), eneBand_e, hMasa->data.hOmasaData->energy_ism_fx[sf][band], hMasa->data.hOmasaData->energy_ism_fx_e[sf][band], &temp1_e ); /* EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band]*/
- temp2 = L_deposit_h( BASOP_Util_Divide3232_Scale( total_diff_nrg_fx, temp1, &temp2_e ) ); /*temp2_e*/ /*total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] )*/
+ temp1 = BASOP_Util_Add_Mant32Exp( L_add( EPSILON_FX, eneBand_fx ), eneBand_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &temp1_e ); /* EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band]*/
+ temp2 = L_deposit_h( BASOP_Util_Divide3232_Scale( total_diff_nrg_fx, temp1, &temp2_e ) ); /*temp2_e*/ /*total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] )*/
temp2_e = add( temp2_e, sub( total_diff_nrg_e, temp1_e ) );
IF( temp2_e < 0 )
{
@@ -3907,11 +3900,11 @@ void ivas_merge_masa_metadata_fx(
temp2_e = 0;
move16();
}
- temp2 = L_sub( L_shl_sat( 1, sub( 31, temp2_e ) ), temp2 ); /*( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] ) )*/
- temp2 = BASOP_Util_Add_Mant32Exp( hOMasaMeta->directional_meta[0].energy_ratio_fx[sf][band], 1, temp2, temp2_e, &temp2_e ); /*( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] ) )*/
- energyTimesRatioISM_fx = Mpy_32_32( L_shr( temp2, 1 ), hMasa->data.hOmasaData->energy_ism_fx[sf][band] ); /*energyTimesRatioISM_e*/
- energyTimesRatioISM_e = add( temp2_e, hMasa->data.hOmasaData->energy_ism_fx_e[sf][band] );
- /*energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] ) ) ) / 2.0f * hMasa->data.hOmasaData->energy_ism[sf][band];*/
+ temp2 = L_sub( L_shl_sat( 1, sub( 31, temp2_e ) ), temp2 ); /*( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ) )*/
+ temp2 = BASOP_Util_Add_Mant32Exp( hOMasaMeta->directional_meta[0].energy_ratio_fx[sf][band], 1, temp2, temp2_e, &temp2_e ); /*( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ) )*/
+ energyTimesRatioISM_fx = Mpy_32_32( L_shr( temp2, 1 ), hOmasaEnergy->energy_ism_fx[sf][band] ); /*energyTimesRatioISM_e*/
+ energyTimesRatioISM_e = add( temp2_e, hOmasaEnergy->energy_ism_fx_e[sf][band] );
+ /*energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ) ) ) / 2.0f * hOmasaEnergy->energy_ism[sf][band];*/
/* Determine combined metadata based on the weights */
merge_dest = -1;
@@ -3946,7 +3939,7 @@ void ivas_merge_masa_metadata_fx(
dir_sum_e = temp2_e;
move32();
move16();
- /*dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] )*/
+ /*dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] )*/
IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( dir_sum_fx, dir_sum_e, hOMasaMeta->directional_meta[0].energy_ratio_fx[sf][band], 1 ), -1 ) )
{
hMeta->directional_meta[merge_dest].energy_ratio_fx[sf][band] = L_shl( dir_sum_fx, sub( dir_sum_e, 1 ) ); /*scaling to Q30*/
@@ -4007,6 +4000,8 @@ void ivas_merge_masa_metadata_fx(
return;
}
+
+
static void quantize_ratio_ism_vector_ivas_fx(
const Word16 *ratio_ism, /* ratio_ism_e */
Word16 ratio_ism_e,
@@ -4192,6 +4187,8 @@ static void quantize_ratio_ism_vector_ivas_fx(
return;
}
+
+
static Word16 index_slice_enum_fx(
const Word16 *ratio_ism_idx,
const Word16 nchan_ism )
@@ -4257,6 +4254,8 @@ static void transform_difference_index_ivas_fx(
return;
}
+
+
static void transform_index_and_GR_encode_ivas_fx(
Word16 *diff_idx, /* i : differenc eindex to encode */
const Word16 len, /* i : input length */
@@ -4278,6 +4277,8 @@ static void transform_index_and_GR_encode_ivas_fx(
return;
}
+
+
static Word16 try_differential_fx(
const Word16 numCodingBands,
const Word32 *masa_to_total_energy_ratio, /* Q30 */
@@ -4333,6 +4334,7 @@ static Word16 try_differential_fx(
return nbits0;
}
+
static void differential_coding_first_subframe_ivas_fx(
BSTR_ENC_HANDLE hMetaData,
const Word32 *masa_to_total_energy_ratio, // Q30
@@ -4371,6 +4373,8 @@ static void differential_coding_first_subframe_ivas_fx(
return;
}
+
+
static void independent_coding_ratio_ism_idx_fx(
Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* i : ISM ratios */
const Word32 *masa_to_total_energy_ratio, /* i : MASA to total ratios, Q30 */
@@ -4394,6 +4398,7 @@ static void independent_coding_ratio_ism_idx_fx(
return;
}
+
static void remove_sep_obj_fx(
Word16 *diff_idx, /* i/o: array of difference of indexes */
const Word16 nchan_ism, /* i : number of objects */
@@ -4411,6 +4416,7 @@ static void remove_sep_obj_fx(
return;
}
+
static void estimate_bits_subband_ism_ratio_fx(
const Word16 *ratio_ism_idx,
const Word16 *ratio_ism_idx_ref, /* ( i/o ) */
@@ -4455,6 +4461,7 @@ static void estimate_bits_subband_ism_ratio_fx(
return;
}
+
static Word16 encode_ratio_ism_subframe_fx(
Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS],
const Word16 nchan_ism,
@@ -4721,6 +4728,8 @@ static Word16 encode_ratio_ism_subframe_fx(
return nbits;
}
+
+
static void ivas_encode_masaism_metadata_fx(
MASA_ENCODER_HANDLE hMasa,
IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */
@@ -4752,6 +4761,7 @@ static void ivas_encode_masaism_metadata_fx(
Word16 tmp, rotate, energy_ism_e, energy_ism_ind_e[MAX_NUM_OBJECTS];
Word16 n_ism_tmp, i;
OMASA_ENCODER_DATA_HANDLE hOmasaData = hMasa->data.hOmasaData;
+ OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy;
Word16 nbands_work;
Word32 L_tmp;
Word16 L_tmp_e;
@@ -4772,9 +4782,10 @@ static void ivas_encode_masaism_metadata_fx(
move16();
FOR( i = 0; i < omasa_nbands; i++ )
{
- L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, hOmasaData->energy_ism_fx[sf][i], hOmasaData->energy_ism_fx_e[sf][i], &L_tmp_e );
+ L_tmp = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, hOmasaEnergy->energy_ism_fx[sf][i], hOmasaEnergy->energy_ism_fx_e[sf][i], &L_tmp_e );
}
- /* if ( sum_f( hOmasaData->energy_ism[sf], omasa_nbands ) == 0.0f ) */
+
+ /* if ( sum_f( hOmasaEnergy->energy_ism[sf], omasa_nbands ) == 0.0f ) */
IF( L_tmp == 0 )
{
hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = ONE_IN_Q30; // 1.0f in Q30
@@ -4810,7 +4821,8 @@ static void ivas_encode_masaism_metadata_fx(
FOR( band = 0; band < omasa_nbands; band++ )
{
- energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &energy_ism_e );
+ energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energy_ism_e );
+
FOR( obj = 0; obj < nchan_ism; obj++ )
{
@@ -4821,11 +4833,11 @@ static void ivas_encode_masaism_metadata_fx(
FOR( obj = 0; obj < nchan_ism; obj++ )
{
- hOmasaData->energy_ratio_ism_fx[sf][0][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e );
+ hOmasaEnergy->energy_ratio_ism_fx[sf][0][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e );
move32();
L_tmp_e = add( L_tmp_e, sub( energy_ism_ind_e[obj], energy_ism_e ) );
/* Scaling to Q30 */
- hOmasaData->energy_ratio_ism_fx[sf][0][obj] = L_shl( hOmasaData->energy_ratio_ism_fx[sf][0][obj], sub( L_tmp_e, 1 ) ); // Q30
+ hOmasaEnergy->energy_ratio_ism_fx[sf][0][obj] = L_shl( hOmasaEnergy->energy_ratio_ism_fx[sf][0][obj], sub( L_tmp_e, 1 ) ); // Q30
move32();
}
L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, energy_ism, energy_ism_e, &L_tmp_e );
@@ -4863,11 +4875,12 @@ static void ivas_encode_masaism_metadata_fx(
}
FOR( sf = 0; sf < omasa_nblocks; sf++ )
{
- energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &energy_ism_e );
+ energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energy_ism_e );
+
FOR( obj = 0; obj < nchan_ism; obj++ )
{
- L_tmp = Mpy_32_32( hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ratio_ism_fx[sf][band][obj] ); // Q = (31 - hOmasaData->energy_ism_fx_e[sf][band]) + Q30 - 31
- L_tmp_e = add( 1, hOmasaData->energy_ism_fx_e[sf][band] );
+ L_tmp = Mpy_32_32( hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] ); // Q = (31 - hOmasaEnergy->energy_ism_fx_e[sf][band]) + Q30 - 31
+ L_tmp_e = add( 1, hOmasaEnergy->energy_ism_fx_e[sf][band] );
energy_ism_ind[obj] = BASOP_Util_Add_Mant32Exp( energy_ism_ind[obj], energy_ism_ind_e[obj], L_tmp, L_tmp_e, &energy_ism_ind_e[obj] );
move32();
}
@@ -4882,11 +4895,11 @@ static void ivas_encode_masaism_metadata_fx(
{
FOR( obj = 0; obj < nchan_ism; obj++ )
{
- hOmasaData->energy_ratio_ism_fx[0][band][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e );
+ hOmasaEnergy->energy_ratio_ism_fx[0][band][obj] = BASOP_Util_Divide3232_Scale_newton( energy_ism_ind[obj], energy_ism, &L_tmp_e );
move32();
L_tmp_e = add( L_tmp_e, sub( energy_ism_ind_e[obj], energy_ism_e ) );
/* Scaling to Q30 */
- hOmasaData->energy_ratio_ism_fx[0][band][obj] = L_shl( hOmasaData->energy_ratio_ism_fx[0][band][obj], sub( L_tmp_e, 1 ) ); // Q30
+ hOmasaEnergy->energy_ratio_ism_fx[0][band][obj] = L_shl( hOmasaEnergy->energy_ratio_ism_fx[0][band][obj], sub( L_tmp_e, 1 ) ); // Q30
move32();
}
brange[0] = hMasa->data.band_mapping[band];
@@ -4931,7 +4944,7 @@ static void ivas_encode_masaism_metadata_fx(
FOR( obj = 0; obj < nchan_ism; obj++ )
{
- hOmasaData->energy_ratio_ism_fx[0][band][obj] = hOmasaData->energy_ratio_ism_fx[0][nbands_work - 1][obj];
+ hOmasaEnergy->energy_ratio_ism_fx[0][band][obj] = hOmasaEnergy->energy_ratio_ism_fx[0][nbands_work - 1][obj];
move32();
}
}
@@ -4942,7 +4955,7 @@ static void ivas_encode_masaism_metadata_fx(
{
FOR( band = 0; band < nbands_work; band++ )
{
- IF( hOmasaData->energy_ism_fx[sf][band] == 0 )
+ IF( hOmasaEnergy->energy_ism_fx[sf][band] == 0 )
{
hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = ONE_IN_Q30;
move32();
@@ -4964,7 +4977,7 @@ static void ivas_encode_masaism_metadata_fx(
eneBand32 = W_extract_h( W_shl( eneBand, shift ) );
eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) );
- L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaData->energy_ism_fx[sf][band], hOmasaData->energy_ism_fx_e[sf][band], &L_tmp_e );
+ L_tmp = BASOP_Util_Add_Mant32Exp( eneBand32, eneBand_exp, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &L_tmp_e );
IF( L_tmp != 0 )
{
hOmasaData->masa_to_total_energy_ratio_fx[sf][band] = BASOP_Util_Divide3232_Scale_newton( eneBand32, L_tmp, &tmp );
@@ -4988,7 +5001,7 @@ static void ivas_encode_masaism_metadata_fx(
FOR( obj = 0; obj < nchan_ism; obj++ )
{
- hOmasaData->energy_ratio_ism_fx[sf][band][obj] = hOmasaData->energy_ratio_ism_fx[sf][nbands_work - 1][obj];
+ hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] = hOmasaEnergy->energy_ratio_ism_fx[sf][nbands_work - 1][obj];
move32();
}
}
@@ -5011,8 +5024,8 @@ static void ivas_encode_masaism_metadata_fx(
{
FOR( obj = 0; obj < nchan_ism; obj++ )
{
- assert( ( hOmasaData->energy_ratio_ism_fx[sf][band][obj] >= 0 ) && ( hOmasaData->energy_ratio_ism_fx[sf][band][obj] <= ONE_IN_Q30 ) );
- ratio_ism_fx[band][obj] = extract_h( hOmasaData->energy_ratio_ism_fx[sf][band][obj] ); // Q14
+ assert( ( hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] >= 0 ) && ( hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] <= ONE_IN_Q30 ) );
+ ratio_ism_fx[band][obj] = extract_h( hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] ); // Q14
move16();
}
@@ -5044,8 +5057,9 @@ static void ivas_encode_masaism_metadata_fx(
}
/* reconstructed values */
- reconstruct_ism_ratios_fx( ratio_ism_idx[band], nchan_ism, STEP_PARAM_ISM_POW_RATIO_NBITS_Q31, hMasa->data.hOmasaData->q_energy_ratio_ism_fx[sf][band] );
+ reconstruct_ism_ratios_fx( ratio_ism_idx[band], nchan_ism, STEP_PARAM_ISM_POW_RATIO_NBITS_Q31, hOmasaEnergy->q_energy_ratio_ism_fx[sf][band] );
}
+
test();
IF( GT_16( nchan_ism, 2 ) && EQ_16( idx_separated_object, sub( nchan_ism, 1 ) ) )
{
@@ -5129,7 +5143,7 @@ static void ivas_encode_masaism_metadata_fx(
}
}
- calculate_nbits_meta_fx( nchan_ism, hOmasaData->q_energy_ratio_ism_fx, hOmasaData->masa_to_total_energy_ratio_fx, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp );
+ calculate_nbits_meta_fx( nchan_ism, hOmasaEnergy->q_energy_ratio_ism_fx, hOmasaData->masa_to_total_energy_ratio_fx, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp );
/* quantize directions */
FOR( obj = 0; obj < nchan_ism; obj++ )
@@ -5168,11 +5182,13 @@ static void ivas_encode_masaism_metadata_fx(
return;
}
+
/*-------------------------------------------------------------------*
* ivas_merge_masa_transports()
*
* Merge MASA transport channels
*-------------------------------------------------------------------*/
+
void ivas_merge_masa_transports_fx(
Word32 data_in_f1_fx[][L_FRAME48k], // Qx
Word32 *data_in_f2_fx[], // Qx
diff --git a/lib_enc/ivas_mc_paramupmix_enc_fx.c b/lib_enc/ivas_mc_paramupmix_enc_fx.c
index c1f7357042c0eea950db02102160e179edb20407..0e8c845e145f04160a57bf7442cb56b6a4251643 100644
--- a/lib_enc/ivas_mc_paramupmix_enc_fx.c
+++ b/lib_enc/ivas_mc_paramupmix_enc_fx.c
@@ -39,7 +39,6 @@
#include "prot_fx.h"
#include "ivas_prot_fx.h"
#include "basop_util.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_cnst.h"
#include "ivas_rom_com.h"
#include "ivas_rom_enc.h"
diff --git a/lib_enc/ivas_mcmasa_enc_fx.c b/lib_enc/ivas_mcmasa_enc_fx.c
index 1a208d0cca88d6b2caf9a866713f80c513b6fdc8..5c8822919feef1571338decf22762ada6081021e 100644
--- a/lib_enc/ivas_mcmasa_enc_fx.c
+++ b/lib_enc/ivas_mcmasa_enc_fx.c
@@ -39,7 +39,6 @@
#include "options.h"
#include "prot_fx.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_rom_enc.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
diff --git a/lib_enc/ivas_mct_core_enc_fx.c b/lib_enc/ivas_mct_core_enc_fx.c
index 27d0a150152c83ca73119a9d62f6e4ac69dddee9..e42ee56d716ea63ea6e34bd259c3f08430bca1fc 100644
--- a/lib_enc/ivas_mct_core_enc_fx.c
+++ b/lib_enc/ivas_mct_core_enc_fx.c
@@ -233,19 +233,23 @@ void ivas_mct_core_enc_fx(
Word16 i, cpe_id, n, nAvailBits;
Word16 nCPE;
Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */
- Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k];
+ Word32 powerSpecMsInv_long_cpe0_fx[CPE_CHANNELS][L_FRAME_PLUS];
+ Word32 inv_spectrum_long_cpe0_fx[CPE_CHANNELS][L_FRAME_PLUS];
+ Word32 powerSpec_long_cpe0_fx[CPE_CHANNELS][L_FRAME_PLUS];
+ Word32 powerSpec_long_fx[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k];
+ Word32 inv_spectrum_long_fx[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */
+ Word32 powerSpecMsInv_long_fx[MCT_MAX_CHANNELS - CPE_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */
Word16 exp_powerSpec[MCT_MAX_CHANNELS][N_MAX + L_MDCT_OVLP_MAX];
Word32 mdst_fx;
- Word32 powerSpecMsInv_long_fx[MCT_MAX_CHANNELS][L_FRAME48k]; /* MS inv power spectrum, also inverse MDST spectrum */
+ Word32 *powerSpec_fx[MCT_MAX_CHANNELS];
Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][2];
Word32 *inv_mdst_spectrum_fx[MCT_MAX_CHANNELS][2];
Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][2];
Word32 *mdst_spectrum_fx[MCT_MAX_CHANNELS][2] = { { NULL } };
- Word32 inv_spectrum_long_fx[MCT_MAX_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */
Word16 total_side_bits;
Word16 chBitRatios[MCT_MAX_CHANNELS];
Word16 q_powSpec[MCT_MAX_CHANNELS], q_spec, q_origSpec, tmp_s;
- Word16 tmp_q_powSpec[L_FRAME48k], tmp_q_powSpecInv[MCT_MAX_CHANNELS][L_FRAME48k], *tmp_q_psi[MCT_MAX_CHANNELS][2];
+ Word16 tmp_q_powSpec[L_FRAME_PLUS], tmp_q_powSpecInv[MCT_MAX_CHANNELS][L_FRAME_PLUS], *tmp_q_psi[MCT_MAX_CHANNELS][2];
Word64 W_tmp;
Encoder_State *sts[MCT_MAX_CHANNELS];
Encoder_State *st;
@@ -270,37 +274,74 @@ void ivas_mct_core_enc_fx(
nCPE = add( nCPE, 1 );
}
- FOR( ch = 0; ch < MCT_MAX_CHANNELS; ch++ )
+ /* point first CPE channels to longer buffers where switching from ACELP to TCX may occur in SBA with DTX (total memory saving)*/
+ FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
+ {
+ set32_fx( inv_spectrum_long_cpe0_fx[ch], 0, L_FRAME_PLUS );
+ set32_fx( powerSpec_long_cpe0_fx[ch], 0, L_FRAME_PLUS ); // tmp_q_powSpec
+ set32_fx( powerSpecMsInv_long_cpe0_fx[ch], 0, L_FRAME_PLUS ); // tmp_q_powSpecInv
+
+ inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_cpe0_fx[ch];
+ inv_mdst_spectrum_fx[ch][1] = powerSpecMsInv_fx[ch][1] = powerSpecMsInv_long_cpe0_fx[ch] + N_TCX10_MAX;
+
+ set16_fx( tmp_q_powSpecInv[ch], 63, L_FRAME_PLUS );
+
+ tmp_q_psi[ch][0] = tmp_q_powSpecInv[ch];
+ tmp_q_psi[ch][1] = &tmp_q_powSpecInv[ch][N_TCX10_MAX];
+
+ inv_spectrum_fx[ch][0] = inv_spectrum_long_cpe0_fx[ch];
+ inv_spectrum_fx[ch][1] = inv_spectrum_long_cpe0_fx[ch] + N_TCX10_MAX;
+ powerSpec_fx[ch] = powerSpec_long_cpe0_fx[ch];
+ }
+
+ FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
{
- set32_fx( powerSpecMsInv_long_fx[ch], 0, L_FRAME48k );
q_powSpec[ch] = 0;
move16();
set16_fx( exp_powerSpec[ch], 0, N_MAX + L_MDCT_OVLP_MAX );
}
- FOR( ch = 0; ch < nChannels; ch++ )
+
+ FOR( ch = CPE_CHANNELS; ch < nChannels; ch++ )
{
- set32_fx( inv_spectrum_long_fx[ch], 0, L_FRAME48k );
- set32_fx( powerSpec_fx[ch], 0, L_FRAME48k ); // tmp_q_powSpec
- set32_fx( powerSpecMsInv_long_fx[ch], 0, L_FRAME48k ); // tmp_q_powSpecInv
+ set32_fx( inv_spectrum_long_fx[ch - CPE_CHANNELS], 0, L_FRAME48k );
+ set32_fx( powerSpec_long_fx[ch - CPE_CHANNELS], 0, L_FRAME48k ); // tmp_q_powSpec
+ set32_fx( powerSpecMsInv_long_fx[ch - CPE_CHANNELS], 0, L_FRAME48k ); // tmp_q_powSpecInv
+
+ inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch - CPE_CHANNELS];
+ inv_mdst_spectrum_fx[ch][1] = powerSpecMsInv_fx[ch][1] = powerSpecMsInv_long_fx[ch - CPE_CHANNELS] + N_TCX10_MAX;
- inv_mdst_spectrum_fx[ch][0] = powerSpecMsInv_fx[ch][0] = powerSpecMsInv_long_fx[ch];
- inv_mdst_spectrum_fx[ch][1] = powerSpecMsInv_fx[ch][1] = powerSpecMsInv_long_fx[ch] + N_TCX10_MAX;
set16_fx( tmp_q_powSpecInv[ch], 63, L_FRAME48k );
tmp_q_psi[ch][0] = tmp_q_powSpecInv[ch];
tmp_q_psi[ch][1] = &tmp_q_powSpecInv[ch][N_TCX10_MAX];
- inv_spectrum_fx[ch][0] = inv_spectrum_long_fx[ch];
- inv_spectrum_fx[ch][1] = inv_spectrum_long_fx[ch] + N_TCX10_MAX;
+ inv_spectrum_fx[ch][0] = inv_spectrum_long_fx[ch - CPE_CHANNELS];
+ inv_spectrum_fx[ch][1] = inv_spectrum_long_fx[ch - CPE_CHANNELS] + N_TCX10_MAX;
+ powerSpec_fx[ch] = powerSpec_long_fx[ch - CPE_CHANNELS];
+ }
+
+ FOR( ch = CPE_CHANNELS; ch < MCT_MAX_CHANNELS; ch++ )
+ {
+ q_powSpec[ch] = 0;
+ move16();
+ set16_fx( exp_powerSpec[ch], 0, N_MAX + L_MDCT_OVLP_MAX );
}
- set16_fx( tmp_q_powSpec, 63, L_FRAME48k );
+ set16_fx( tmp_q_powSpec, 63, L_FRAME_PLUS );
FOR( ( cpe_id = 0, i = 0 ); cpe_id < nCPE; cpe_id++ )
{
FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
{
- sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
+#ifdef ADJUST_MCT_CHANNELS_MAX
+ IF( LT_16( add( i_mult( cpe_id, CPE_CHANNELS ), ch ), nChannels ) )
+ {
+#endif
+ sts[i] = hCPE[cpe_id]->hCoreCoder[ch];
+#ifdef ADJUST_MCT_CHANNELS_MAX
+ }
+#endif
+
IF( EQ_32( hCPE[cpe_id]->hCoreCoder[ch]->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) )
{
i = add( i, 1 );
diff --git a/lib_enc/ivas_mct_enc_fx.c b/lib_enc/ivas_mct_enc_fx.c
index 735e7e191fbaad5242907fac0268daddd6fccb38..39735ad030624045c49913f5a43e4c28e5f070b0 100644
--- a/lib_enc/ivas_mct_enc_fx.c
+++ b/lib_enc/ivas_mct_enc_fx.c
@@ -1188,7 +1188,7 @@ static ivas_error ivas_mc_enc_reconfig_fx(
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Transient Detection\n" ) );
}
- InitTransientDetection_ivas_fx( shl( div_l( st->input_Fs, FRAMES_PER_SEC ), 1 ), NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 );
+ InitTransientDetection_ivas_fx( extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ), NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 );
}
IF( st->hIGFEnc == NULL )
diff --git a/lib_enc/ivas_mct_enc_mct_fx.c b/lib_enc/ivas_mct_enc_mct_fx.c
index f28adafa428cd09ad2c0eb3fbaa74e8d0ddf4214..0918c51d24cde78794b32dba5e23234010be407b 100644
--- a/lib_enc/ivas_mct_enc_mct_fx.c
+++ b/lib_enc/ivas_mct_enc_mct_fx.c
@@ -983,7 +983,7 @@ void mctStereoIGF_enc_fx(
Encoder_State **sts, /* i/o: encoder state structure */
Word32 *orig_spectrum_fx[MCT_MAX_CHANNELS][2], /* i : MDCT spectrum for ITF */
Word16 q_origSpec, /* i : Q for MDCT spectrum */
- Word32 powerSpec_fx[MCT_MAX_CHANNELS][L_FRAME48k], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */
+ Word32 *powerSpec_fx[MCT_MAX_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum,or estimate */
Word16 q_powerSpec[MCT_MAX_CHANNELS], /* i : Q for powSpec_fx */
Word32 *powerSpecMsInv_fx[MCT_MAX_CHANNELS][NB_DIV], /* i : same as powerSpec_fx but for inverse spect.*/
Word16 *q_powerSpecMsInv[MCT_MAX_CHANNELS][NB_DIV], /* i : Q for powSpecMsInv_fx */
diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c
index 4d8bc7b9979f5a8e60a9b8cbb79cc9c8e942020f..86ea8ebe919149397275a57349d1472ac931e4ca 100644
--- a/lib_enc/ivas_mdct_core_enc_fx.c
+++ b/lib_enc/ivas_mdct_core_enc_fx.c
@@ -1964,7 +1964,7 @@ void ivas_mdct_core_whitening_enc_fx(
move64();
FOR( i = 0; i < NB_DIV; i++ )
{
- chE_tot_fx = W_add( W_shr( chE_fx[i], sub( chE_q[i], q ) ), chE_tot_fx );
+ chE_tot_fx = W_add( W_shr( chE_fx[i], s_min( 63, sub( chE_q[i], q ) ) ), chE_tot_fx );
}
IF( GT_16( q, Q24 ) )
{
diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c
index 4e7bc83283187a4bf1e568a0ca4b2a1d62e02dc4..cbbbacf0988baa19a531b61698278e2acbf53bcf 100644
--- a/lib_enc/ivas_omasa_enc_fx.c
+++ b/lib_enc/ivas_omasa_enc_fx.c
@@ -51,9 +51,11 @@
#define OMASA_FEC_MAX 5
+
/*-------------------------------------------------------------------------
* Local function prototypes
*------------------------------------------------------------------------*/
+
static void ivas_omasa_param_est_enc_fx(
OMASA_ENC_HANDLE hOMasa,
OMASA_ENCODER_DATA_HANDLE hOmasaData,
@@ -99,6 +101,8 @@ void computeIntensityVector_enc_fx(
Word16 inp_q );
static void computeReferencePower_omasa_ivas_fx( const Word16 *band_grouping, Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_ImagBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], Word32 *reference_power, const Word16 enc_param_start_band, const Word16 num_freq_bands, Word16 q_Cldfb, Word16 q_reference_power[CLDFB_NO_CHANNELS_MAX] );
+
+
/*--------------------------------------------------------------------------*
* ivas_omasa_enc_open()
*
@@ -217,13 +221,13 @@ ivas_error ivas_omasa_enc_open_fx(
return error;
}
+
/*--------------------------------------------------------------------------*
* ivas_omasa_enc_close()
*
* Close OMASA handle
*--------------------------------------------------------------------------*/
-
void ivas_omasa_enc_close_fx(
OMASA_ENC_HANDLE *hOMasa /* i/o: encoder OMASA handle */
)
@@ -268,11 +272,13 @@ void ivas_omasa_enc_close_fx(
return;
}
+
/*--------------------------------------------------------------------------*
* ivas_omasa_enc_config()
*
* oMASA encoder configuration
*--------------------------------------------------------------------------*/
+
ivas_error ivas_omasa_enc_config_fx(
Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */
)
@@ -356,6 +362,7 @@ ivas_error ivas_omasa_enc_config_fx(
ivas_write_format_fx( st_ivas );
+ /* OMASA encoder handle */
test();
test();
IF( NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && st_ivas->hOMasa == NULL )
@@ -371,6 +378,22 @@ ivas_error ivas_omasa_enc_config_fx(
st_ivas->hOMasa = NULL;
}
+ /* OMASA energy handle */
+ test();
+ test();
+ IF( NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && st_ivas->hMasa->data.hOmasaData->hOmasaEnergy == NULL )
+ {
+ IF( ( st_ivas->hMasa->data.hOmasaData->hOmasaEnergy = (OMASA_ENCODER_ENERGY_HANDLE) malloc( sizeof( OMASA_ENCODER_ENERGY_STATE ) ) ) == NULL )
+ {
+ return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for OMASA energy handle\n" ) );
+ }
+ }
+ ELSE IF( EQ_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && st_ivas->hMasa->data.hOmasaData->hOmasaEnergy != NULL )
+ {
+ free( st_ivas->hMasa->data.hOmasaData->hOmasaEnergy );
+ st_ivas->hMasa->data.hOmasaData->hOmasaEnergy = NULL;
+ }
+
st_ivas->hCPE[0]->element_brate = L_sub( ivas_total_brate, ism_total_brate );
move32();
@@ -406,6 +429,7 @@ ivas_error ivas_omasa_enc_config_fx(
*
* Frame-by-frame config for oMASA
*--------------------------------------------------------------------------*/
+
void ivas_omasa_set_config_fx(
OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */
MASA_ENCODER_HANDLE hMasa, /* i : MASA encoder handle */
@@ -483,11 +507,12 @@ void ivas_omasa_set_config_fx(
*
* Main OMASA encoding function
*--------------------------------------------------------------------------*/
+
void ivas_omasa_enc_fx(
OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */
MASA_ENCODER_HANDLE hMasa, /* i/o: MASA encoder handle */
ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */
- Word32 *data_in[], /* i/o: Input / transport audio signals q_data*/
+ Word32 *data_in[], /* i/o: Input / transport audio signals q_data*/
Word16 q_data, /* i : Q0 Stores the q for data_in */
const Word16 input_frame, /* i : Input frame size */
const Word16 nchan_transport, /* i : Number of transport channels */
@@ -514,6 +539,7 @@ void ivas_omasa_enc_fx(
UWord8 fade_out_separate_object;
UWord8 fade_in_separate_object;
Word32 temp32; /*temp32_e*/
+
/* Estimate broadband energies */
nchan_all_inp = add( nchan_ism, nchan_transport );
set_zero_fx( broadband_energy_fx, nchan_all_inp );
@@ -878,6 +904,7 @@ void ivas_set_ism_importance_interformat_fx(
return;
}
+
/*--------------------------------------------------------------------------*
* ivas_set_surplus_brate_enc()
*
@@ -947,11 +974,11 @@ void ivas_set_surplus_brate_enc(
/*! r: OMASA energy bitrate flag */
Word16 ivas_omasa_ener_brate_fx(
- const Word16 nchan_ism, /* i : number of ISMs */
- const Word32 ivas_total_brate, /* i : IVAS total bitrate */
- Word32 *data_f[], /* i : Input / transport audio signals data_e*/
- const Word16 input_frame, /* i : Input frame size */
- Word16 data_e /*i:exponent for data_f */
+ const Word16 nchan_ism, /* i : number of ISMs */
+ const Word32 ivas_total_brate, /* i : IVAS total bitrate */
+ Word32 *data_f[], /* i : Input / transport audio signals data_e*/
+ const Word16 input_frame, /* i : Input frame size */
+ const Word16 data_e /* i : exponent for data_f */
)
{
Word16 i, flag_omasa_ener_brate;
@@ -959,6 +986,7 @@ Word16 ivas_omasa_ener_brate_fx(
Word16 energy_ism_e, energy_masa_e;
Word32 temp_32;
Word16 temp, temp_e;
+
flag_omasa_ener_brate = 0;
energy_ism_e = 0;
energy_masa_e = 0;
@@ -1017,6 +1045,7 @@ Word16 ivas_omasa_ener_brate_fx(
return flag_omasa_ener_brate;
}
+
/*--------------------------------------------------------------------------*
* Local functions
*--------------------------------------------------------------------------*/
@@ -1067,6 +1096,7 @@ static void ivas_omasa_param_est_enc_fx(
Word32 temp;
Word16 temp_e;
Word16 q_intensity_real_fx[MASA_FREQUENCY_BANDS], q_reference_power_fx[CLDFB_NO_CHANNELS_MAX];
+ OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy;
ref_exp = 0;
norm_buff = MAX16B;
@@ -1133,8 +1163,9 @@ static void ivas_omasa_param_est_enc_fx(
move16();
move16();
}
- set_zero_fx( hOmasaData->energy_ism_fx[block_m_idx], num_freq_bands );
- set16_fx( hOmasaData->energy_ism_fx_e[block_m_idx], 0, num_freq_bands );
+ set_zero_fx( hOmasaEnergy->energy_ism_fx[block_m_idx], num_freq_bands );
+ set16_fx( hOmasaEnergy->energy_ism_fx_e[block_m_idx], 0, num_freq_bands );
+
FOR( ts = mrange[0]; ts < mrange[1]; ts++ )
{
norm_buff = MAX16B;
@@ -1174,7 +1205,7 @@ static void ivas_omasa_param_est_enc_fx(
{
temp = L_add( Mpy_32_32( Chnl_RealBuffer_fx[k][j], Chnl_RealBuffer_fx[k][j] ), Mpy_32_32( Chnl_ImagBuffer_fx[k][j], Chnl_ImagBuffer_fx[k][j] ) );
temp_e = sub( 62, shl( q, 1 ) );
- hOmasaData->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ism_fx[block_m_idx][i], hOmasaData->energy_ism_fx_e[block_m_idx][i], temp, temp_e, &hOmasaData->energy_ism_fx_e[block_m_idx][i] ); /*2q-31*/
+ hOmasaEnergy->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaEnergy->energy_ism_fx[block_m_idx][i], hOmasaEnergy->energy_ism_fx_e[block_m_idx][i], temp, temp_e, &hOmasaEnergy->energy_ism_fx_e[block_m_idx][i] ); /*2q-31*/
move32();
}
}
@@ -1334,6 +1365,7 @@ static void ivas_omasa_param_est_enc_fx(
move32();
move32();
}
+
return;
}
@@ -1362,6 +1394,8 @@ static void ivas_omasa_energy_and_ratio_est_fx(
Word16 norm_Chnl;
Word16 temp_e; /* to store temporary exp*/
Word16 energy_ratio_ism_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; /*q30*/
+ OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy;
+
num_freq_bands = hOMasa->nbands;
l_ts = shr( input_frame, 4 ); /*input_frame / CLDFB_NO_COL_MAX*/
q_cldfb = q_data;
@@ -1369,6 +1403,7 @@ static void ivas_omasa_energy_and_ratio_est_fx(
move16(); /*q_cldfb*/
set_zero_fx( &Chnl_RealBuffer_fx[0][0], MAX_NUM_OBJECTS * CLDFB_NO_CHANNELS_MAX );
set_zero_fx( &Chnl_ImagBuffer_fx[0][0], MAX_NUM_OBJECTS * CLDFB_NO_CHANNELS_MAX );
+
/* do processing over all CLDFB time slots */
FOR( block_m_idx = 0; block_m_idx < hOMasa->nSubframes; block_m_idx++ )
{
@@ -1380,11 +1415,12 @@ static void ivas_omasa_energy_and_ratio_est_fx(
/* Reset variable */
FOR( i = 0; i < hOMasa->nbands; i++ )
{
- set_zero_fx( hOmasaData->energy_ratio_ism_fx[block_m_idx][i], nchan_ism );
+ set_zero_fx( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i], nchan_ism );
set16_fx( energy_ratio_ism_e[block_m_idx][i], 0, nchan_ism );
}
- set_zero_fx( hOmasaData->energy_ism_fx[block_m_idx], num_freq_bands );
- set16_fx( hOmasaData->energy_ism_fx_e[block_m_idx], 0, num_freq_bands );
+ set_zero_fx( hOmasaEnergy->energy_ism_fx[block_m_idx], num_freq_bands );
+ set16_fx( hOmasaEnergy->energy_ism_fx_e[block_m_idx], 0, num_freq_bands );
+
/* Compute CLDFB */
FOR( ts = mrange[0]; ts < mrange[1]; ts++ )
{
@@ -1394,10 +1430,14 @@ static void ivas_omasa_energy_and_ratio_est_fx(
{
q_cldfb = q_data;
move16();
+#ifdef FIX_1987_CRASH_OMASA_ENERGY
+ cldfbAnalysis_ts_fx_var_q( &( data_fx[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hOMasa->cldfbAnaEnc[i], &q_cldfb );
+#else
scale_sig32( hOMasa->cldfbAnaEnc[i]->cldfb_state_fx, hOMasa->cldfbAnaEnc[i]->cldfb_state_length, sub( q_cldfb, hOMasa->cldfbAnaEnc[i]->Q_cldfb_state ) );
hOMasa->cldfbAnaEnc[i]->Q_cldfb_state = q_cldfb;
move16();
cldfbAnalysis_ts_fx_fixed_q( &( data_fx[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hOMasa->cldfbAnaEnc[i], &q_cldfb );
+#endif
norm_Chnl = s_min( norm_Chnl, L_norm_arr( Chnl_ImagBuffer_fx[i], 60 ) );
norm_Chnl = s_min( norm_Chnl, L_norm_arr( Chnl_RealBuffer_fx[i], 60 ) );
}
@@ -1409,6 +1449,7 @@ static void ivas_omasa_energy_and_ratio_est_fx(
scale_sig32( Chnl_ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, norm_Chnl );
}
q_cldfb = add( q_cldfb, norm_Chnl );
+
/* Compute energy */
FOR( i = 0; i < num_freq_bands; i++ )
{
@@ -1428,8 +1469,8 @@ static void ivas_omasa_energy_and_ratio_est_fx(
tmp64 = W_shl( tmp64, tmpNorm );
tftile_energy_fx = W_extract_h( tmp64 );
tftile_energy_e = sub( tftile_energy_e, tmpNorm );
- hOmasaData->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ism_fx[block_m_idx][i], hOmasaData->energy_ism_fx_e[block_m_idx][i], tftile_energy_fx, tftile_energy_e, &hOmasaData->energy_ism_fx_e[block_m_idx][i] );
- hOmasaData->energy_ratio_ism_fx[block_m_idx][i][k] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][k], energy_ratio_ism_e[block_m_idx][i][k], tftile_energy_fx, tftile_energy_e, &energy_ratio_ism_e[block_m_idx][i][k] );
+ hOmasaEnergy->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaEnergy->energy_ism_fx[block_m_idx][i], hOmasaEnergy->energy_ism_fx_e[block_m_idx][i], tftile_energy_fx, tftile_energy_e, &hOmasaEnergy->energy_ism_fx_e[block_m_idx][i] );
+ hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][k] = BASOP_Util_Add_Mant32Exp( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][k], energy_ratio_ism_e[block_m_idx][i][k], tftile_energy_fx, tftile_energy_e, &energy_ratio_ism_e[block_m_idx][i][k] );
move32();
move32();
}
@@ -1444,20 +1485,20 @@ static void ivas_omasa_energy_and_ratio_est_fx(
move64();
FOR( j = 0; j < nchan_ism; j++ )
{
- hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_deposit_h( BASOP_Util_Divide3232_Scale( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], L_add( hOmasaData->energy_ism_fx[block_m_idx][i], EPSILON_FX ), &temp_e ) );
+ hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] = L_deposit_h( BASOP_Util_Divide3232_Scale( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j], L_add( hOmasaEnergy->energy_ism_fx[block_m_idx][i], EPSILON_FX ), &temp_e ) );
move32();
- temp_e = add( temp_e, sub( energy_ratio_ism_e[block_m_idx][i][j], hOmasaData->energy_ism_fx_e[block_m_idx][i] ) );
+ temp_e = add( temp_e, sub( energy_ratio_ism_e[block_m_idx][i][j], hOmasaEnergy->energy_ism_fx_e[block_m_idx][i] ) );
- hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], sub( temp_e, 1 ) ); /* scaling to q30 */
+ hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j], sub( temp_e, 1 ) ); /* scaling to q30 */
move32();
- ism_ratio_sum_fx = W_add( ism_ratio_sum_fx, hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] );
+ ism_ratio_sum_fx = W_add( ism_ratio_sum_fx, hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] );
}
IF( ism_ratio_sum_fx == 0 )
{
Word16 temp_ism_ratio = BASOP_Util_Divide1616_Scale( 1, nchan_ism, &temp_e );
FOR( j = 0; j < nchan_ism; j++ )
{
- hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( temp_ism_ratio, add( temp_e, 15 ) ); /*scaling to q30*/
+ hOmasaEnergy->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( temp_ism_ratio, add( temp_e, 15 ) ); /*scaling to q30*/
move32();
}
}
@@ -1572,6 +1613,7 @@ void computeIntensityVector_enc_fx(
}
norm = 63;
move16();
+
IF( intensity_real64[0][i] != 0 )
{
norm = s_min( norm, W_norm( intensity_real64[0][i] ) );
@@ -1597,6 +1639,7 @@ void computeIntensityVector_enc_fx(
return;
}
+
static void computeReferencePower_omasa_ivas_fx(
const Word16 *band_grouping, /* i : Band grouping for estimation */
Word32 Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal Q6*/
diff --git a/lib_enc/ivas_osba_enc_fx.c b/lib_enc/ivas_osba_enc_fx.c
index 66231d6f75b90d023302a2eb930eb1743f99e091..424e56e4d26131d02790cb5aaa22c67f863e9507 100644
--- a/lib_enc/ivas_osba_enc_fx.c
+++ b/lib_enc/ivas_osba_enc_fx.c
@@ -122,10 +122,11 @@ ivas_error ivas_osba_enc_open_fx(
{
hOSba->input_data_mem_fx[i] = NULL;
}
+
+ input_frame = extract_l( Mpy_32_32_r( st_ivas->hEncoderConfig->input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
+
Word16 tmp_e;
- Word32 tmp32 = L_deposit_h( BASOP_Util_Divide3216_Scale( st_ivas->hEncoderConfig->input_Fs, FRAMES_PER_SEC, &tmp_e ) );
- tmp32 = L_shr( tmp32, sub( 15, tmp_e ) );
- input_frame = extract_l( tmp32 );
+ Word32 tmp32;
FOR( i = 0; i < input_frame; i++ )
{
@@ -188,9 +189,7 @@ ivas_error ivas_osba_enc_reconfig(
hEncoderConfig = st_ivas->hEncoderConfig;
ivas_total_brate = hEncoderConfig->ivas_total_brate;
move32();
-#ifdef NONBE_FIX_ISM_XOVER_BR
Word16 nchan_transport;
-#endif
IF( NE_32( ivas_total_brate, hEncoderConfig->last_ivas_total_brate ) )
{
@@ -205,20 +204,7 @@ ivas_error ivas_osba_enc_reconfig(
move16();
old_ism_mode = st_ivas->ism_mode;
move32();
-#ifdef NONBE_FIX_ISM_XOVER_BR
st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->hEncoderConfig->nchan_ism );
-#else
- IF( GE_32( ivas_total_brate, IVAS_256k ) )
- {
- st_ivas->ism_mode = ISM_SBA_MODE_DISC;
- move32();
- }
- ELSE
- {
- st_ivas->ism_mode = ISM_MODE_NONE;
- move32();
- }
-#endif
nchan_transport_old = st_ivas->nchan_transport;
nCPE_old = st_ivas->nCPE;
nSCE_old = st_ivas->nSCE;
@@ -368,47 +354,28 @@ ivas_error ivas_osba_enc_reconfig(
/*-----------------------------------------------------------------*
* Allocate, initialize, and configure SCE/CPE/MCT handles
*-----------------------------------------------------------------*/
-#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = st_ivas->nchan_transport;
-#endif
test();
test();
IF( old_ism_mode == ISM_MODE_NONE && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
{
-#ifdef NONBE_FIX_ISM_XOVER_BR
{
nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism );
st_ivas->nCPE = shr_r( nchan_transport, 1 );
}
-#else
- st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) );
- move16();
-#endif
}
ELSE IF( EQ_32( old_ism_mode, ISM_SBA_MODE_DISC ) && st_ivas->ism_mode == ISM_MODE_NONE )
{
nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism );
-#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport = st_ivas->nchan_transport;
-#endif
}
ELSE IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
{
-#ifdef NONBE_FIX_ISM_XOVER_BR
nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism );
nchan_transport = add( st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_ism );
st_ivas->nCPE = shr_r( nchan_transport, 1 );
-#else
- st_ivas->nCPE = add( st_ivas->nCPE, shr( add( st_ivas->hEncoderConfig->nchan_ism, 1 ), 1 ) );
- move16();
- nCPE_old = st_ivas->nCPE;
- move16();
- nchan_transport_old = st_ivas->nchan_transport;
- move16();
- nchan_transport_old = add( nchan_transport_old, st_ivas->hEncoderConfig->nchan_ism );
-#endif
}
Word16 tmp_e;
Word32 bitrate_per_chan = L_deposit_h( BASOP_Util_Divide3216_Scale( ivas_total_brate, st_ivas->nchan_transport, &tmp_e ) );
diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c
index facbde22f370bd837c0144ad58b5517a34ef3c6d..f69127ff4ca8fb6dd175b0c337b95b509c7138a9 100644
--- a/lib_enc/ivas_qmetadata_enc_fx.c
+++ b/lib_enc/ivas_qmetadata_enc_fx.c
@@ -40,53 +40,29 @@
#include "ivas_rom_com.h"
#include "ivas_stat_enc.h"
#include "wmc_auto.h"
-
#include "basop_util.h"
-#include "ivas_rom_com_fx.h"
#if defined( DEBUGGING ) && defined( DBG_BITSTREAM_ANALYSIS )
#include
#endif
+
/*-----------------------------------------------------------------------*
* Local function prototypes
*-----------------------------------------------------------------------*/
static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, Word16 *needed_bits, Word16 *nbits_diff, Word16 *dfRatioBits, const Word16 hodirac_flag );
-static Word16 ivas_qmetadata_entropy_encode_diffuseness_fx(
- BSTR_ENC_HANDLE hMetaData,
- IVAS_QDIRECTION *q_direction,
- UWord16 *diffuseness_index_max_ec_frame );
+static Word16 ivas_qmetadata_entropy_encode_diffuseness_fx( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, UWord16 *diffuseness_index_max_ec_frame );
static void ivas_qmetadata_reorder_2dir_bands_fx( IVAS_QMETADATA_HANDLE hQMetaData );
-static Word16 ivas_qmetadata_entropy_encode_df_ratio_fx(
- BSTR_ENC_HANDLE hMetaData,
- IVAS_QDIRECTION *q_direction,
- Word16 *df_ratio_bits );
-
-static Word16 ivas_qmetadata_entropy_encode_dir_fx(
- BSTR_ENC_HANDLE hMetaData,
- IVAS_QDIRECTION *q_direction,
- const UWord16 diffuseness_index_max_ec_frame,
- const Word16 nbands,
- const Word16 start_band,
- const Word16 direction_bits_raw,
- Word16 max_bits,
- const Word16 hrmasa_flag );
+static Word16 ivas_qmetadata_entropy_encode_df_ratio_fx( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, Word16 *df_ratio_bits );
-static Word16 ivas_qmetadata_raw_encode_dir_fx(
- BSTR_ENC_HANDLE hMetaData,
- IVAS_QDIRECTION *q_direction,
- const Word16 nbands,
- const Word16 start_band );
+static Word16 ivas_qmetadata_entropy_encode_dir_fx( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const UWord16 diffuseness_index_max_ec_frame, const Word16 nbands, const Word16 start_band, const Word16 direction_bits_raw, Word16 max_bits, const Word16 hrmasa_flag );
+static Word16 ivas_qmetadata_raw_encode_dir_fx( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const Word16 nbands, const Word16 start_band );
-static Word16 ivas_qmetadata_get_optimal_gr_param_fx(
- UWord16 *unsigned_data,
- const Word16 count,
- const Word16 gr_param_count,
- Word16 *opt_gr_size );
+static Word16 ivas_qmetadata_get_optimal_gr_param_fx( UWord16 *unsigned_data, const Word16 count, const Word16 gr_param_count, Word16 *opt_gr_size );
Word16 ivas_qmetadata_encode_extended_gr_length_fx( const UWord16 value, const UWord16 alphabet_size, const Word16 gr_param );
@@ -94,17 +70,11 @@ static Word16 ivas_qmetadata_encode_quasi_uniform_length_fx( const UWord16 value
static void ivas_qmetadata_encode_quasi_uniform_fx( BSTR_ENC_HANDLE hMetaData, const UWord16 value, const UWord16 alphabet_size );
-static Word16 ivas_qmetadata_reorder_elevation_index_fx(
- const Word16 elevation_index,
- const Word16 avg_elevation_index,
- const Word16 elevation_alphabet );
+static Word16 ivas_qmetadata_reorder_elevation_index_fx( const Word16 elevation_index, const Word16 avg_elevation_index, const Word16 elevation_alphabet );
-static Word16 ivas_qmetadata_reorder_azimuth_index_fx(
- const Word16 azimuth_index,
- const Word16 avg_azimuth_index,
- const Word16 azimuth_alphabet );
-static ivas_error requantize_direction_EC_3_fx( Word16 *extra_bits, IVAS_QDIRECTION *q_direction, const Word16 coding_subbands, BSTR_ENC_HANDLE hMetaData, Word32 elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], Word32 azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], Word16 *ind_order );
+static Word16 ivas_qmetadata_reorder_azimuth_index_fx( const Word16 azimuth_index, const Word16 avg_azimuth_index, const Word16 azimuth_alphabet );
+static ivas_error requantize_direction_EC_3_fx( Word16 *extra_bits, IVAS_QDIRECTION *q_direction, const Word16 coding_subbands, BSTR_ENC_HANDLE hMetaData, Word32 elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], Word32 azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], Word16 *ind_order );
static void calculate_two_distances_fx(
Word32 *el_fx, /* i : elevation values */
@@ -119,7 +89,6 @@ static void joint_encoding_fx( IVAS_QDIRECTION *q_direction, const Word16 j, con
static ivas_error write_ec_direction_fx( Word16 *num_bits_written, BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const Word16 j_idx, const Word16 len, const Word16 GR_ord_elevation, const Word16 GR_ord_azimuth, const Word16 use_context, const Word16 same );
static Word16 write_fixed_rate_direction_fx( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const Word16 j_idx, const Word16 len );
-
static Word16 ivas_qmetadata_quantize_coherence_fx(
IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata */
const Word16 idx_d, /* i : current direction index */
@@ -168,31 +137,17 @@ static Word16 encode_surround_coherence_fx(
IVAS_QMETADATA *hQMetaData, /* i : quantized metadata */
BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */
);
-static Word16 common_direction_fx(
- IVAS_QDIRECTION *q_direction,
- const Word16 band_idx,
- const Word16 len,
- const Word16 bits_allowed,
- BSTR_ENC_HANDLE hMetaData,
- Word32 *elevation_orig_fx,
- Word32 *azimuth_orig_fx );
-static Word16 ivas_diffuseness_huff_ec_encode_fx(
- BSTR_ENC_HANDLE hMetaData,
- const UWord16 idx );
+static Word16 common_direction_fx( IVAS_QDIRECTION *q_direction, const Word16 band_idx, const Word16 len, const Word16 bits_allowed, BSTR_ENC_HANDLE hMetaData, Word32 *elevation_orig_fx, Word32 *azimuth_orig_fx );
-static void ivas_diffuseness_huff_ec_prepare_fx(
- IVAS_QDIRECTION *q_direction,
- Word16 *best_av,
- UWord16 *avr_idx,
- Word16 *diffuseness_bits_huff );
+static Word16 ivas_diffuseness_huff_ec_encode_fx( BSTR_ENC_HANDLE hMetaData, const UWord16 idx );
+
+static void ivas_diffuseness_huff_ec_prepare_fx( IVAS_QDIRECTION *q_direction, Word16 *best_av, UWord16 *avr_idx, Word16 *diffuseness_bits_huff );
static Word16 coherence_coding_length( const UWord16 *idx_sur_coh_shift, const UWord8 idx_shift_len, const Word16 coding_subbands, const Word16 *no_cv, UWord16 *mr_idx, Word16 *no_cv_shift, Word16 *p_min_idx, Word16 *GR_ord, Word16 *nbits_fr, Word16 *nbits_fr1 );
static Word16 write_2dir_info( BSTR_ENC_HANDLE hMetaData, UWord8 *twoDirBands, const Word16 n, const Word16 k );
-static void transform_azimuth_dir2_fx(
- IVAS_QMETADATA_HANDLE hQMetaData,
- Word16 *dir2_bands );
+static void transform_azimuth_dir2_fx( IVAS_QMETADATA_HANDLE hQMetaData, Word16 *dir2_bands );
static Word16 ivas_qmetadata_quantize_coherence_hr_512_fx( IVAS_QMETADATA *hQMetaData, const Word16 idx_d, const Word16 all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const Word16 bits_coh );
@@ -867,10 +822,8 @@ void ivas_qmetadata_enc_sid_encode_fx(
BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */
IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */
const Word16 masa_sid_descriptor, /* i : description of MASA SID coding structure */
-#ifdef NONBE_FIX_1052_SBA_EXT
- const Word16 nchan_transport, /* i : number of transport channels */
-#endif
- const Word16 ivas_format /* i : IVAS format */
+ const Word16 nchan_transport, /* i : number of transport channels */
+ const Word16 ivas_format /* i : IVAS format */
)
{
Word16 b, m;
@@ -883,21 +836,14 @@ void ivas_qmetadata_enc_sid_encode_fx(
Word32 avg_azimuth_fx[MASA_MAXIMUM_CODING_SUBBANDS];
Word16 bits_dir, bits_diff, bits_delta;
Word16 metadata_sid_bits; /* bits allocated to SID for metadata */
-#ifdef NONBE_FIX_1052_SBA_EXT
Word16 sba_spar_bitlen;
-#endif
IF( EQ_16( ivas_format, SBA_FORMAT ) )
{
-#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( nchan_transport );
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_ORDER_BITS - SBA_PLANAR_BITS - 1; /* -1 for inactive mode header bit*/
metadata_sid_bits = sub( metadata_sid_bits, sba_spar_bitlen );
-#else
- metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 2 - SID_FORMAT_NBITS; /* -1 for inactive mode header bit*/
- move16();
-#endif
}
ELSE
{
@@ -1175,12 +1121,7 @@ void reset_metadata_spatial_fx(
{
hMetaData->ind_list[0].value = 1;
move16();
-#ifdef NONBE_FIX_1052_SBA_EXT
metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - SBA_PLANAR_BITS - SBA_ORDER_BITS;
-#else
- metadata_sid_bits = (Word16) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS;
- move16();
-#endif
WHILE( ( hMetaData->nb_bits_tot < metadata_sid_bits ) )
{
diff --git a/lib_enc/ivas_qspherical_enc_fx.c b/lib_enc/ivas_qspherical_enc_fx.c
index 2e7a289f9d38d51dbe634700f0ff7dd66ee23b17..3f17a423e7025e5e4e34de78a2d49c3f5305a7e1 100644
--- a/lib_enc/ivas_qspherical_enc_fx.c
+++ b/lib_enc/ivas_qspherical_enc_fx.c
@@ -40,7 +40,6 @@
#include "wmc_auto.h"
#include "prot_fx.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-----------------------------------------------------------------------*
diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c
index 5ff9878b2d99f2f8e13df7bb32ef17cc53fed36f..8ad20a539678a179572b2d572f72e6da7ad6a578 100644
--- a/lib_enc/ivas_sce_enc_fx.c
+++ b/lib_enc/ivas_sce_enc_fx.c
@@ -184,7 +184,7 @@ ivas_error ivas_sce_enc_fx(
RunTransientDetection_ivas_fx( st->input_fx, input_frame, st->hTranDet, q_input );
}
- currFlatness_fx[0] = GetTCXAvgTemporalFlatnessMeasure_ivas_fx( (const TransientDetection *) st->hTranDet, NSUBBLOCKS, 0 ); // Q21
+ currFlatness_fx[0] = GetTCXAvgTemporalFlatnessMeasure_ivas_fx( st->hTranDet, NSUBBLOCKS, 0 ); // Q21
move32();
/*----------------------------------------------------------------*
@@ -309,17 +309,7 @@ ivas_error ivas_sce_enc_fx(
IF( EQ_32( st->core_brate, SID_2k40 ) )
{
- ivas_write_format_sid_fx( ivas_format, IVAS_SCE, st->hBstr );
-#ifdef NONBE_FIX_1052_SBA_EXT
- IF( EQ_32( ivas_format, SBA_FORMAT ) )
- {
- /* Write SBA planar flag */
- push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_planar, SBA_PLANAR_BITS );
-
- /* Write SBA order */
- push_indice( st->hBstr, IND_SMODE, st_ivas->hEncoderConfig->sba_order, SBA_ORDER_BITS );
- }
-#endif
+ ivas_write_format_sid_fx( ivas_format, IVAS_SCE, st->hBstr, st_ivas->hEncoderConfig->sba_order, st_ivas->hEncoderConfig->sba_planar );
}
/*----------------------------------------------------------------*
@@ -482,7 +472,7 @@ ivas_error create_sce_enc_fx(
move32();
st->max_bwidth = st_ivas->hEncoderConfig->max_bwidth;
st->input_Fs = st_ivas->hEncoderConfig->input_Fs;
- st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) );
+ st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) );
IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) )
{
@@ -557,70 +547,23 @@ ivas_error create_evs_sce_enc_fx(
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CoreCoder structure\n" ) );
}
memset( st_fx, 0, sizeof( Encoder_State ) );
- st_fx->input_Fs = 16000;
- move32();
- st_fx->total_brate = ACELP_12k65;
- move32();
- st_fx->Opt_AMR_WB = 0;
- move16();
- st_fx->Opt_RF_ON = 0;
- move16();
- st_fx->rf_fec_offset = 0;
- move16();
- st_fx->rf_fec_indicator = 1;
- move16();
- st_fx->max_bwidth = SWB;
- move16();
- st_fx->interval_SID_fx = FIXED_SID_RATE;
- move16();
- st_fx->var_SID_rate_flag_fx = 1;
- move16();
- st_fx->Opt_HE_SAD_ON_fx = 0;
- move16();
- st_fx->Opt_SC_VBR = 0;
- move16();
- st_fx->last_Opt_SC_VBR = 0;
- move16();
+ copy_encoder_config_fx( st_ivas, st_fx, 1 );
+
st_fx->bitstreamformat = G192;
move16();
- // copy_encoder_config_fx( st_ivas, st_fx, 1 );
- st_fx->max_bwidth = st_ivas->hEncoderConfig->max_bwidth;
- move16();
- st_fx->Opt_DTX_ON = st_ivas->hEncoderConfig->Opt_DTX_ON;
- move16();
- st_fx->var_SID_rate_flag_fx = st_ivas->hEncoderConfig->var_SID_rate_flag;
- move16();
- st_fx->interval_SID_fx = st_ivas->hEncoderConfig->interval_SID;
- move16();
- st_fx->Opt_RF_ON = st_ivas->hEncoderConfig->Opt_RF_ON;
- move16();
- st_fx->rf_fec_indicator = st_ivas->hEncoderConfig->rf_fec_indicator;
- move16();
- st_fx->rf_fec_offset = st_ivas->hEncoderConfig->rf_fec_offset;
- move16();
- // st_fx->bitstreamformat = st->bitstreamformat;
st_fx->total_brate = st_ivas->hEncoderConfig->ivas_total_brate;
move32();
- st_fx->Opt_SC_VBR = st_ivas->hEncoderConfig->Opt_SC_VBR;
- move16();
- st_fx->last_Opt_SC_VBR = st_ivas->hEncoderConfig->last_Opt_SC_VBR;
- move16();
- st_fx->Opt_AMR_WB = st_ivas->hEncoderConfig->Opt_AMR_WB;
- move16();
- st_fx->input_Fs = st_ivas->hEncoderConfig->input_Fs;
- move32();
- st_fx->codec_mode = st_ivas->codec_mode;
- move16();
- st_fx->last_codec_mode = st_ivas->last_codec_mode;
- move16();
- st_fx->input_frame_fx = extract_l( Mult_32_16( st_fx->input_Fs, 0x0290 ) );
+
+ st_fx->input_frame_fx = extract_l( Mult_32_16( st_fx->input_Fs, INV_FRAME_PER_SEC_Q15 ) );
move16();
- IF( NE_32( ( error = init_encoder_fx( st_fx ) ), IVAS_ERR_OK ) )
+
+ IF( NE_32( ( error = init_encoder_fx( st_fx, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID ) ), IVAS_ERR_OK ) )
{
return error;
}
+
/*-----------------------------------------------------------------*
* Bitstream
*-----------------------------------------------------------------*/
@@ -641,6 +584,7 @@ ivas_error create_evs_sce_enc_fx(
return error;
}
+
/*-------------------------------------------------------------------------
* destroy_sce_enc_fx()
*
diff --git a/lib_enc/ivas_sns_enc_fx.c b/lib_enc/ivas_sns_enc_fx.c
index 610f39b1b2f0610a24bd4764d3cfd61ee0dfa108..252637e73999bfd53a81b60a4640118f3db6cac1 100644
--- a/lib_enc/ivas_sns_enc_fx.c
+++ b/lib_enc/ivas_sns_enc_fx.c
@@ -39,11 +39,11 @@
#include "ivas_prot_fx.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_cnst.h"
#include "wmc_auto.h"
#include "prot_fx_enc.h"
+
/*-------------------------------------------------------------------
* sns_1st_cod()
*
diff --git a/lib_enc/ivas_spar_encoder_fx.c b/lib_enc/ivas_spar_encoder_fx.c
index 12e9d1510ebf7239aeffff498471235b86bf9f7a..481b969b70cc3e830d3fe8346613775ad9e90243 100644
--- a/lib_enc/ivas_spar_encoder_fx.c
+++ b/lib_enc/ivas_spar_encoder_fx.c
@@ -715,9 +715,7 @@ static ivas_error ivas_spar_enc_process_fx(
num_del_samples = hSpar->hFbMixer->fb_cfg->fb_latency;
move16();
- Word32 res_dec, res_frac;
- iDiv_and_mod_32( input_Fs, FRAMES_PER_SEC, &res_dec, &res_frac, 0 );
- input_frame = extract_l( res_dec );
+ input_frame = extract_l( Mpy_32_32_r( input_Fs, ONE_BY_FRAMES_PER_SEC_Q31 ) );
sba_order = s_min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER );
nchan_inp = ivas_sba_get_nchan_metadata_fx( sba_order, hEncoderConfig->ivas_total_brate );
@@ -864,17 +862,10 @@ static ivas_error ivas_spar_enc_process_fx(
}
pp_fr_q = add( FR_q, pp_fr_q );
-#ifdef NONBE_FIX_1052_SBA_EXT
IF( NE_32( ( error = ivas_dirac_enc_fx( st_ivas->hDirAC, hQMetaData, hMetaData, data_fx, ppIn_FR_real_fx, ppIn_FR_imag_fx, pp_fr_q, input_frame, dtx_vad, hEncoderConfig->ivas_format, nchan_transport, hodirac_flag, shift ) ), IVAS_ERR_OK ) )
{
return error;
}
-#else
- IF( NE_32( ( error = ivas_dirac_enc_fx( st_ivas->hDirAC, hQMetaData, hMetaData, data_fx, ppIn_FR_real_fx, ppIn_FR_imag_fx, pp_fr_q, input_frame, dtx_vad, hEncoderConfig->ivas_format, hodirac_flag, shift ) ), IVAS_ERR_OK ) )
- {
- return error;
- }
-#endif
/* Set Energy Ratio to 0.0 if the mono flag has been set */
IF( hQMetaData->dirac_mono_flag )
diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c
index 954ca5149c6485f78290defcd524144549a30374..be07b38cbc7a47018b4e88b3523129d0661bf154 100644
--- a/lib_enc/ivas_spar_md_enc_fx.c
+++ b/lib_enc/ivas_spar_md_enc_fx.c
@@ -37,7 +37,6 @@
#include "ivas_prot_fx.h"
#include "math.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include
#include "wmc_auto.h"
@@ -1712,9 +1711,8 @@ static void ivas_write_parameter_bitstream_dtx_fx(
Word16 idx;
Word32 pr_min_max[2];
Word16 zero_pad_bits, sid_bits_len;
-#ifdef NONBE_FIX_1052_SBA_EXT
Word16 sba_spar_bitlen;
-#endif
+
sid_bits_len = hMetaData->nb_bits_tot;
move16();
pr_min_max[0] = pSpar_md->min_max_fx[0];
@@ -1790,12 +1788,9 @@ static void ivas_write_parameter_bitstream_dtx_fx(
}
sid_bits_len = sub( hMetaData->nb_bits_tot, sid_bits_len );
-#ifdef NONBE_FIX_1052_SBA_EXT
sba_spar_bitlen = ivas_sba_spar_sid_bitlen_fx( num_dmx[0] );
zero_pad_bits = sub( sba_spar_bitlen, sid_bits_len );
-#else
- zero_pad_bits = sub( i_mult( SPAR_DTX_BANDS, SPAR_SID_BITS_TAR_PER_BAND ), sid_bits_len );
-#endif
+
assert( zero_pad_bits >= 0 );
IF( EQ_16( num_dmx[0], 2 ) )
{
diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h
index 126bc61f6e2898d1f08c4792c9c59e6033650a14..e3f40478e62734ddc9d4aa687999ef97080b18b0 100644
--- a/lib_enc/ivas_stat_enc.h
+++ b/lib_enc/ivas_stat_enc.h
@@ -877,15 +877,20 @@ typedef struct ivas_omasa_enc_state_structure
} OMASA_ENC_STATE, *OMASA_ENC_HANDLE;
-
-typedef struct ivas_omasa_encoder_one_data_struct
+typedef struct ivas_omasa_encoder_energy_struct
{
Word32 energy_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
Word16 energy_ism_fx_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
- Word32 energy_ratio_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; /*q30*/
+ Word32 energy_ratio_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS];
Word32 q_energy_ratio_ism_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS]; /* Q30 */
- Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q30 */
- Word16 lp_noise_CPE_fx; /* LP filtered total noise estimation Q8 */
+
+} OMASA_ENCODER_ENERGY_STATE, *OMASA_ENCODER_ENERGY_HANDLE;
+
+typedef struct ivas_omasa_encoder_data_struct
+{
+ OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy;
+ Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; /* Q30 */
+ Word16 lp_noise_CPE_fx; /* LP filtered total noise estimation Q8 */
Word16 omasa_stereo_sw_cnt;
diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c
index 80c4b5a21c8d67576543e593b880993231f2e9b9..1eb89a74af4cab0fbcf3994b059aa5dca5c23958 100644
--- a/lib_enc/ivas_stereo_dft_enc_fx.c
+++ b/lib_enc/ivas_stereo_dft_enc_fx.c
@@ -41,7 +41,6 @@
#include "ivas_prot_fx.h"
#include "ivas_cnst.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_rom_enc.h"
#include "wmc_auto.h"
diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c
index a0d49176f1426be0467bfb660b883abaf693bcb0..0e404a0de6fe6e81056f5767994d4d055674f3c7 100644
--- a/lib_enc/ivas_stereo_dft_td_itd_fx.c
+++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c
@@ -573,6 +573,10 @@ void stereo_td_itd_mdct_stereo_fx(
Word16 DFT_e[CPE_CHANNELS];
Word16 DFT_tmp_e[CPE_CHANNELS][STEREO_DFT_N_MAX_ENC];
STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct;
+#ifdef NONBE_1203_MDCT2DFT_SWITCHING
+ Word16 dft_ovl;
+ Word16 sf;
+#endif
test();
IF( hCPE->hStereoMdct != NULL && hCPE->hStereoMdct->hItd != NULL )
@@ -611,6 +615,21 @@ void stereo_td_itd_mdct_stereo_fx(
/* Time Domain ITD compensation using extrapolation */
stereo_td_itd_fx( hStereoMdct->hItd, NULL, NULL, 1, hStereoMdct->hDft_ana->dft_ovl, hCPE->hCoreCoder, input_frame, hCPE->input_mem_fx, hCPE->q_input_mem );
}
+#ifdef NONBE_1203_MDCT2DFT_SWITCHING
+ ELSE IF( hCPE->input_mem_fx[0] != NULL )
+ {
+ dft_ovl = extract_l( Mpy_32_32( imult3216( input_frame, STEREO_DFT_OVL_MAX ), 2236963 ) ); // 1/L_FRAME48k = 2236963 (Q31)
+
+ FOR( i = 0; i < CPE_CHANNELS; i++ )
+ {
+ sf = L_norm_arr( hCPE->hCoreCoder[i]->input32_fx + input_frame - dft_ovl, dft_ovl );
+ Copy_Scale_sig32_16( hCPE->hCoreCoder[i]->input32_fx + input_frame - dft_ovl, hCPE->input_mem_fx[i], dft_ovl, sf );
+ hCPE->q_input_mem[i] = sub( add( hCPE->hCoreCoder[i]->q_inp32, sf ), 16 );
+ move16();
+ }
+ }
+#endif
+
return;
}
diff --git a/lib_enc/ivas_stereo_dmx_evs_fx.c b/lib_enc/ivas_stereo_dmx_evs_fx.c
index 59f00bd9045d5dfbc52991bbffd00e949eb43afe..852be98fe7132d51bdd0c5c4dba5a892a779c27f 100644
--- a/lib_enc/ivas_stereo_dmx_evs_fx.c
+++ b/lib_enc/ivas_stereo_dmx_evs_fx.c
@@ -39,7 +39,6 @@
#include "prot_fx.h"
#include "ivas_prot_fx.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_rom_enc.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
@@ -98,13 +97,8 @@
#define STEREO_DMX_EVS_TRNS_EGY_FORGETTING_Q15 24576
-#ifdef FIX_ISSUE_1764
#define STEREO_DMX_EVS_POC_RENORM_TH 1048576 // 65536 * 16
#define STEREO_DMX_EVS_POC_RENORM_SHIFT 10
-#else
-#define STEREO_DMX_EVS_POC_RENORM_TH 33554432 // 65536 << 9
-#define STEREO_DMX_EVS_POC_RENORM_SHIFT 3
-#endif
#define STEREO_DMX_EVS_FAD_R 3
#define STEREO_DMX_EVS_FAD_IR 10923 /* 1/3 in Q15 */
@@ -232,12 +226,10 @@ static Word32 spectral_flatness_fx(
const Word16 *sig_fx_e, /* i : input signal (exponent) - can be NULL */
const Word16 sig_length /* i : input signal length */
);
-#ifdef FIX_ISSUE_1764
static void renorm_poc_fx(
Word32 *real, /* i/o real-part*/
Word32 *imag /* i/o imaginary-part */
);
-#endif
/*-------------------------------------------------------------------*
* estimate_itd_wnd_fft()
*
@@ -420,11 +412,7 @@ static void calc_poc_fx(
mult_angle = 2; /*****/
move16();
}
-#ifdef FIX_ISSUE_1764
ELSE IF( EQ_16( input_frame, L_FRAME32k ) )
-#else
- if ( EQ_16( input_frame, L_FRAME32k ) )
-#endif
{
mult_angle = 2;
move16();
@@ -452,21 +440,8 @@ static void calc_poc_fx(
Rr = L_add( L_add( specRr[i], Mpy_32_32_r( specLr[i], eps_cos ) ), Mpy_32_32_r( specLi[i], eps_sin ) );
Ri = L_add( L_sub( specRi[i], Mpy_32_32_r( specLr[i], eps_sin ) ), Mpy_32_32_r( specLi[i], eps_cos ) );
-#ifdef FIX_ISSUE_1764
renorm_poc_fx( &Lr, &Li );
renorm_poc_fx( &Rr, &Ri );
-#else
- IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
- {
- Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- }
-#endif
specPOr[i] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
move32();
@@ -480,21 +455,8 @@ static void calc_poc_fx(
Rr = L_add( L_sub( specRr[j], Mpy_32_32_r( specLr[j], eps_cos ) ), Mpy_32_32_r( specLi[j], eps_sin ) );
Ri = L_sub( L_sub( specRi[j], Mpy_32_32_r( specLr[j], eps_sin ) ), Mpy_32_32_r( specLi[j], eps_cos ) );
-#ifdef FIX_ISSUE_1764
renorm_poc_fx( &Lr, &Li );
renorm_poc_fx( &Rr, &Ri );
-#else
- IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
- {
- Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- }
-#endif
specPOr[j] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
move32();
@@ -517,21 +479,8 @@ static void calc_poc_fx(
Rr = L_add( L_add( specRr[i], Mpy_32_32_r( specLr[i], eps_cos ) ), Mpy_32_32_r( specLi[i], eps_sin ) );
Ri = L_add( L_sub( specRi[i], Mpy_32_32_r( specLr[i], eps_sin ) ), Mpy_32_32_r( specLi[i], eps_cos ) );
-#ifdef FIX_ISSUE_1764
renorm_poc_fx( &Lr, &Li );
renorm_poc_fx( &Rr, &Ri );
-#else
- IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
- {
- Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- }
-#endif
specPOr[i] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
move32();
@@ -544,21 +493,8 @@ static void calc_poc_fx(
Rr = L_add( L_sub( specRr[j], Mpy_32_32_r( specLr[j], eps_cos ) ), Mpy_32_32_r( specLi[j], eps_sin ) );
Ri = L_sub( L_sub( specRi[j], Mpy_32_32_r( specLr[j], eps_sin ) ), Mpy_32_32_r( specLi[j], eps_cos ) );
-#ifdef FIX_ISSUE_1764
renorm_poc_fx( &Lr, &Li );
renorm_poc_fx( &Rr, &Ri );
-#else
- IF( ( LT_32( L_abs( Lr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Li ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Rr ), STEREO_DMX_EVS_POC_RENORM_TH ) ) &&
- ( LT_32( L_abs( Ri ), STEREO_DMX_EVS_POC_RENORM_TH ) ) )
- {
- Lr = L_shl( Lr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Li = L_shl( Li, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Rr = L_shl( Rr, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- Ri = L_shl( Ri, STEREO_DMX_EVS_POC_RENORM_SHIFT );
- }
-#endif
specPOr[j] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) ); // 2*spec_e
move32();
@@ -573,10 +509,8 @@ static void calc_poc_fx(
Rr = L_add( specRr[i], Mpy_32_32_r( specLi[i], EPS ) );
Ri = L_sub( specRi[i], Mpy_32_32_r( specLr[i], EPS ) );
-#ifdef FIX_ISSUE_1764
renorm_poc_fx( &Lr, &Li );
renorm_poc_fx( &Rr, &Ri );
-#endif
specPOr[i] = L_add( Mpy_32_32_r( Lr, Rr ), Mpy_32_32_r( Li, Ri ) );
move32();
@@ -594,7 +528,7 @@ static void calc_poc_fx(
move32();
gamma = L_sub( gamma, igamma );
}
- FOR( ; i < n0 >> 4; i++ ) /*search from 4 angles */
+ FOR( ; i < ( n0 >> 4 ); i++ ) /*search from 4 angles */
{
tmp1 = Mpy_32_16_1( Mpy_32_32_r( wnd[i * step + bias], gamma ), 23170 /*0.7071f*/ );
@@ -605,15 +539,11 @@ static void calc_poc_fx(
gamma = L_sub( gamma, igamma );
}
- FOR( ; i < n0 >> 3; i++ ) /* binary search from 8 angles */
+ FOR( ; i < ( n0 >> 3 ); i++ ) /* binary search from 8 angles */
{
tmp1 = Mpy_32_32_r( wnd[i * step + bias], gamma ); // Q31
-#ifdef FIX_ISSUE_1764
IF( GT_32( L_abs( specPOr[i] ), L_abs( specPOi[i] ) ) )
-#else
- IF( W_mult0_32_32( L_sub( specPOr[i], specPOi[i] ), L_add( specPOr[i], specPOi[i] ) ) > 0 )
-#endif
{
specPOr[i] = Mpy_32_16_1( tmp1, imult1616( sign_fx( specPOr[i] ), /*0.923880f*/ s[120 * mult_angle] ) ); /* cos(PI/8) Q31*/
move32();
@@ -632,17 +562,9 @@ static void calc_poc_fx(
FOR( ; i < end; i++ ) /* binary search from 16 angles */
{
tmp1 = Mpy_32_32_r( wnd[i * step + bias], gamma ); // Q31
-#ifdef FIX_ISSUE_1764
IF( GT_32( L_abs( specPOr[i] ), L_abs( specPOi[i] ) ) )
-#else
- IF( W_mult0_32_32( L_sub( specPOr[i], specPOi[i] ), L_add( specPOr[i], specPOi[i] ) ) > 0 )
-#endif
{
-#ifdef FIX_ISSUE_1764
IF( GT_32( L_abs( Mpy_32_16_1( specPOr[i], 13573 /*0.414213f*/ ) ), L_abs( specPOi[i] ) ) ) /*tan(PI/8)*/
-#else
- IF( W_mult0_32_32( L_sub( Mpy_32_16_1( specPOr[i], 13573 /*0.414213f*/ ), specPOi[i] ), L_add( Mpy_32_16_1( specPOr[i], 13573 /*0.414213f*/ ), specPOi[i] ) ) > 0 ) /*tan(PI/8)*/
-#endif
{
specPOr[i] = Mpy_32_16_1( tmp1 /*0.980785f */, imult1616( sign_fx( specPOr[i] ), s[140 * mult_angle] ) ); /* cos(PI/16) Q31*/
move32();
@@ -659,11 +581,7 @@ static void calc_poc_fx(
}
ELSE
{
-#ifdef FIX_ISSUE_1764
IF( GT_32( L_abs( specPOr[i] ), L_abs( Mpy_32_16_1( specPOi[i], 13573 /*0.414213f*/ ) ) ) ) /*tan(PI/8)*/
-#else
- IF( W_mult0_32_32( L_sub( specPOr[i], Mpy_32_16_1( specPOi[i], 13573 /*0.414213f*/ ) ), L_add( specPOr[i], Mpy_32_16_1( specPOi[i], 13573 /*0.414213f*/ ) ) ) > 0 ) /*tan(PI/8)*/
-#endif
{
specPOr[i] = Mpy_32_16_1( tmp1 /** 0.555570f*/, imult1616( sign_fx( specPOr[i] ), s[60 * mult_angle] ) ); /*cos(PI*5/16) Q31*/
move32();
@@ -758,11 +676,7 @@ static void calc_poc_fx(
hPHA->pha_hys_cnt = 0;
move16();
}
-#ifdef FIX_ISSUE_1764
IF( GE_32( hPHA->pha_hys_cnt, STEREO_DMX_EVS_SWTCH_HYS_THRES ) )
-#else
- if ( GE_32( hPHA->pha_hys_cnt, STEREO_DMX_EVS_SWTCH_HYS_THRES ) )
-#endif
{
hPHA->curr_pha = STEREO_DMX_EVS_PHA_IPD;
move32();
@@ -786,11 +700,7 @@ static void calc_poc_fx(
hPHA->pha_hys_cnt = 0;
move16();
}
-#ifdef FIX_ISSUE_1764
IF( GE_16( hPHA->pha_hys_cnt, STEREO_DMX_EVS_SWTCH_HYS_THRES ) )
-#else
- if ( GE_16( hPHA->pha_hys_cnt, STEREO_DMX_EVS_SWTCH_HYS_THRES ) )
-#endif
{
hPHA->curr_pha = STEREO_DMX_EVS_PHA_IPD2;
move32();
@@ -1685,11 +1595,6 @@ static Word32 find_poc_peak_fx(
{
Q_fx[i] = L_shr( Q_fx[i], negate( Q_e[i] ) ); // Q31
move32();
-#ifndef FIX_ISSUE_1764
- }
- FOR( i = 0; i < CPE_CHANNELS; i++ )
- {
-#endif
peakQ_fx[i] = L_shr( peakQ_fx[i], sub( 15, peakQ_e[i] ) ); // Q16
move32();
}
@@ -1889,7 +1794,6 @@ static Word32 spectral_flatness_fx(
return L_shl_sat( L_deposit_h( sf ), L_tmp_e );
}
-#ifdef FIX_ISSUE_1764
/*-------------------------------------------------------------------*
* renorm_poc_fx()
*
@@ -1913,7 +1817,6 @@ static void renorm_poc_fx(
}
}
}
-#endif
/*-------------------------------------------------------------------*
* calc_energy()
@@ -2435,11 +2338,7 @@ void stereo_dmx_evs_enc_fx(
FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ )
{
// ftmp += p_data_mem[n - m] * p_prev_taps[m];
-#ifdef FIX_ISSUE_1764
fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_prev_taps[m] ) ); // Q25
-#else
- fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[sub( n, m )], p_prev_taps[m] ) ); // Q25
-#endif
}
fx_tmp = L_shl( fx_tmp, 1 ); // Q26
mem_prev[n] = L_add( mem_prev[n], Mpy_32_32( fx_tmp, INV_SQRT_2_Q31 ) );
@@ -2464,11 +2363,7 @@ void stereo_dmx_evs_enc_fx(
FOR( ( fx_tmp = 0, m = 0 ); m < pha_len; m++ )
{
// ftmp += p_data_mem[n - m] * p_curr_taps[m];
-#ifdef FIX_ISSUE_1764
fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[n - m], p_curr_taps[m] ) ); // Q25
-#else
- fx_tmp = L_add( fx_tmp, Mpy_32_32( p_data_mem[sub( n, m )], p_curr_taps[m] ) ); // Q25
-#endif
}
fx_tmp = L_shl( fx_tmp, 1 ); // Q26
// dmx_pha_data[n] += ftmp * INV_SQRT_2;
@@ -2514,11 +2409,7 @@ void stereo_dmx_evs_enc_fx(
hPHA->prc_hys_cnt = 0;
move16();
}
-#ifdef FIX_ISSUE_1764
IF( GE_16( hPHA->prc_hys_cnt, STEREO_DMX_EVS_SWTCH_PRC_HYS_THRES ) )
-#else
- if ( GE_16( hPHA->prc_hys_cnt, STEREO_DMX_EVS_SWTCH_PRC_HYS_THRES ) )
-#endif
{
hPHA->curr_prc = STEREO_DMX_EVS_PRC_POC;
move32();
@@ -2542,11 +2433,7 @@ void stereo_dmx_evs_enc_fx(
move16();
}
-#ifdef FIX_ISSUE_1764
IF( GE_16( hPHA->prc_hys_cnt, STEREO_DMX_EVS_SWTCH_PRC_HYS_THRES ) )
-#else
- if ( GE_16( hPHA->prc_hys_cnt, STEREO_DMX_EVS_SWTCH_PRC_HYS_THRES ) )
-#endif
{
hPHA->curr_prc = STEREO_DMX_EVS_PRC_PHA;
move32();
diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c
index d0252a1f154a32df2845bea6d5c3dc695368e2a0..e5c7af987416ee004fd5405e36a175643b479827 100644
--- a/lib_enc/ivas_stereo_ica_enc_fx.c
+++ b/lib_enc/ivas_stereo_ica_enc_fx.c
@@ -40,13 +40,13 @@
#include "wmc_auto.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
-
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
+
/*---------------------------------------------------------------
* Local function prototypes
* ---------------------------------------------------------------*/
+
static void unclr_calc_corr_features_fx(
STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier handle */
STEREO_TCA_ENC_HANDLE hStereoTCA, /* i/o: ICA Stereo Encoder handle */
@@ -78,6 +78,7 @@ static void unclr_calc_corr_features_fx(
*
* Temporal channel adjustment of LA samples in target channel
* ---------------------------------------------------------------*/
+
static void tcaTargetCh_LA_fx(
STEREO_TCA_ENC_HANDLE hStereoTCA,
Word32 *ptrChanL, /* q_com */
diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c
index 67ba071a055792d0c100a798df8fbe58a027160f..85c35ed50f80ab35a492daf9b536088e6573dffe 100644
--- a/lib_enc/ivas_stereo_icbwe_enc_fx.c
+++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c
@@ -39,15 +39,14 @@
#include "wmc_auto.h"
#include "rom_com.h"
#include "ivas_rom_com.h"
-
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-------------------------------------------------------------------*
* ic_bwe_enc_reset()
*
* core switching reset of IC BWE memory
*-------------------------------------------------------------------*/
+
static void ic_bwe_enc_reset_fx(
STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo ICBWE handle */
)
diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c
index db634379ac4a5701c22b99babd6ccf07c6d1f456..bcc4462a23f3d3574a5996509226e5e9174a0491 100644
--- a/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c
+++ b/lib_enc/ivas_stereo_mdct_stereo_enc_fx.c
@@ -39,7 +39,6 @@
#include "prot_fx.h"
#include "prot_fx_enc.h"
#include "ivas_rom_com.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_rom_enc.h"
#include "wmc_auto.h"
#include "stat_enc.h"
@@ -472,7 +471,6 @@ void stereo_coder_tcx_fx(
nAvailBitsMS[k] = idiv1616( nAvailBitsMS[k], nSubframes ); /* Q0 */
move16();
-#ifdef NONBE_1329_FIX_OSBA_CRASH
test();
IF( mct_on && LE_16( nAvailBitsMS[k], 0 ) ) /*Force M/S when bit-budget is low for MCT*/
{
@@ -484,7 +482,6 @@ void stereo_coder_tcx_fx(
}
ELSE
{
-#endif
MsStereoDecision_fx( sfbConf, sts[0]->hTcxEnc->spectrum_fx[k], sts[1]->hTcxEnc->spectrum_fx[k], inv_spectrum_fx[0][k], inv_spectrum_fx[1][k], sub( Q31, exp_spec ), &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] );
IF( sts[0]->igf )
@@ -497,9 +494,7 @@ void stereo_coder_tcx_fx(
hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k];
move16();
}
-#ifdef NONBE_1329_FIX_OSBA_CRASH
}
-#endif
IF( NE_16( hStereoMdct->mdct_stereo_mode[k], SMDCT_DUAL_MONO ) || NE_16( hStereoMdct->IGFStereoMode[k], SMDCT_DUAL_MONO ) )
{
diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c
index a54e56fb9a42651b8f8a61ea9c092cb971cd0b1d..24ff57217cb95b64d983a3f0ddf6f27312fab872 100644
--- a/lib_enc/ivas_stereo_switching_enc_fx.c
+++ b/lib_enc/ivas_stereo_switching_enc_fx.c
@@ -35,13 +35,13 @@
#include "cnst.h"
#include "rom_com.h"
#include "prot_fx.h"
-#include "ivas_rom_com_fx.h"
#include "ivas_rom_com.h"
#include "assert.h"
#include "wmc_auto.h"
#include "prot_fx_enc.h"
#include "ivas_prot_fx.h"
+
/*-------------------------------------------------------------------*
* Function allocate_CoreCoder_enc()
*
@@ -85,7 +85,7 @@ static ivas_error allocate_CoreCoder_enc_fx(
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for VAD\n" ) );
}
- wb_vad_init_ivas_fx( st->hVAD );
+ wb_vad_init_fx( st->hVAD );
}
IF( st->hSpMusClas == NULL )
@@ -649,15 +649,25 @@ void stereo_switching_enc_fx(
dft_ovl = extract_l( Mpy_32_32( imult3216( input_frame, STEREO_DFT_OVL_MAX ), 2236963 ) ); // 1/L_FRAME48k = 2236963 (Q31)
/* update DFT analysis overlap memory */
+#ifdef NONBE_1203_MDCT2DFT_SWITCHING
+ /* note: in MDCT stereo, the update is done in stereo_td_itd_mdct_stereo() */
+#endif
test();
test();
IF( GT_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->input_mem_fx[0] != NULL && NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) )
{
FOR( n = 0; n < CPE_CHANNELS; n++ )
{
- Copy_Scale_sig32_16( sts[n]->input32_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl, 0 ); /* sts[n]->q_inp32 - 16*/
+#ifdef NONBE_1203_MDCT2DFT_SWITCHING
+ Word16 sf = L_norm_arr( sts[n]->input32_fx + input_frame - dft_ovl, dft_ovl );
+ Copy_Scale_sig32_16( sts[n]->input32_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl, sf ); /* sts[n]->q_inp32 - 16 */
+ hCPE->q_input_mem[n] = sub( add( sts[n]->q_inp32, sf ), 16 );
+ move16();
+#else
+ Copy_Scale_sig32_16( sts[n]->input32_fx + input_frame - dft_ovl, hCPE->input_mem_fx[n], dft_ovl, 0 ); /* sts[n]->q_inp32 - 16 */
hCPE->q_input_mem[n] = sub( sts[n]->q_inp32, 16 );
move16();
+#endif
}
}
@@ -906,8 +916,12 @@ void stereo_switching_enc_fx(
Copy( sts[0]->lsf_old1_fx, sts[1]->lsf_old1_fx, M ); /* Qlog2(2.56) */
Copy( sts[0]->lsp_old1_fx, sts[1]->lsp_old1_fx, M ); /* Q15 */
+ sts[1]->last_core_brate = sts[0]->last_core_brate;
+ move16();
+
sts[1]->GSC_noisy_speech = 0;
move16();
+
IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) )
{
/* cross-fade overlap region of DFT Stereo downmix and original stereo channels */
diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c
index de47ea8e25afb906ebb9c9afe386c86c1f887e39..ab28f7f7e4e64c63a8d86c43f1751a5cbc9dd921 100644
--- a/lib_enc/ivas_stereo_td_analysis_fx.c
+++ b/lib_enc/ivas_stereo_td_analysis_fx.c
@@ -41,7 +41,6 @@
#include "rom_enc.h"
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-------------------------------------------------------------------*
diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c
index 8f1d2d9c9c46d088fd8d6375b55d48e2028fd660..e617e1a9ab707d744a1a3d6a97498694ba3d0812 100644
--- a/lib_enc/ivas_stereo_td_enc_fx.c
+++ b/lib_enc/ivas_stereo_td_enc_fx.c
@@ -43,7 +43,6 @@
#endif
#include "prot_fx_enc.h"
#include "ivas_prot_fx.h"
-#include "ivas_rom_com_fx.h"
/*-------------------------------------------------------------------*
@@ -51,6 +50,7 @@
*
* Initialize TD stereo encoder
*-------------------------------------------------------------------*/
+
void stereo_td_init_enc_fx(
STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */
const Word16 last_element_mode /* i : last element mode */
diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c
index da141f473432c7384c43abc984a1f67b800d5514..52cc9db8308401ab6eb97c7c01d2ff51d4e9bae0 100644
--- a/lib_enc/ivas_tcx_core_enc_fx.c
+++ b/lib_enc/ivas_tcx_core_enc_fx.c
@@ -41,7 +41,6 @@
#include "wmc_auto.h"
#include "ivas_prot_fx.h"
#include "prot_fx_enc.h"
-#include "rom_com_fx.h"
#include "ivas_prot_fx.h"
/*-------------------------------------------------------------------*
@@ -409,6 +408,10 @@ void stereo_tcx_core_enc(
st->hLPDmem->q_lpd_syn = st->Q_syn;
move16();
+ /*--------------------------------------------------------------*
+ * LPC Envelope Quantization and FDNS
+ *---------------------------------------------------------------*/
+
IF( !st->enableTcxLpc )
{
IF( st->envWeighted )
@@ -433,6 +436,10 @@ void stereo_tcx_core_enc(
}
}
+#ifdef FIX_1384_MSAN_stereo_tcx_core_enc
+ st->acelp_cfg.midLpc = 0;
+ move16();
+#endif
last_core_orig = st->last_core;
move16();
@@ -753,7 +760,9 @@ Word16 ivas_acelp_tcx20_switching_fx(
Word32 offset_tcx, target;
Word32 y_fx[N_MAX];
Word32 tcx_snr;
+#ifndef ISSUE_1867_replace_overflow_libenc
Flag Overflow;
+#endif
Word32 gain, noise;
Word16 noise_e = 0;
move16();
@@ -1241,7 +1250,11 @@ Word16 ivas_acelp_tcx20_switching_fx(
test();
if ( ( GT_32( snr_acelp, tcx_snr ) ) &&
( LT_32( snr_acelp, L_add( tcx_snr, 131072 /*2.0f Q16*/ ) ) ) &&
+#ifdef ISSUE_1867_replace_overflow_libenc
+ ( LT_32( L_add_sat( st->prevTempFlatness_32fx, currFlatness ), 6815744 /*3.25f Q21*/ ) || EQ_16( stab_fac, 0x7fff ) ||
+#else
( LT_32( L_add_o( st->prevTempFlatness_32fx, currFlatness, &Overflow ), 6815744 /*3.25f Q21*/ ) || EQ_16( stab_fac, 0x7fff ) ||
+#endif
( !flag_16k_smc && ( st->sp_aud_decision0 > 0 ) && LT_32( L_add_sat( st->prevTempFlatness_32fx, currFlatness ), 41943040 /*20.f Q21*/ ) ) ) &&
( LE_16( st->Nb_ACELP_frames, 6 ) ) )
{
diff --git a/lib_enc/ivas_td_low_rate_enc_fx.c b/lib_enc/ivas_td_low_rate_enc_fx.c
index e2c12076d416a8fb0787181cdb5b6fab2da2841e..8832af43c6514cd37d29c9b7b1c5336fff71cbb5 100644
--- a/lib_enc/ivas_td_low_rate_enc_fx.c
+++ b/lib_enc/ivas_td_low_rate_enc_fx.c
@@ -163,6 +163,7 @@ void tdm_low_rate_enc(
/*--------------------------------------------------------------------------------------*
* Updates
*--------------------------------------------------------------------------------------*/
+
Copy( exc_wo_nf_fx, exc_fx, L_FRAME ); /* Q_new */
return;
@@ -274,7 +275,8 @@ void encod_gen_2sbfr(
* Close-loop pitch search on the 1st and 3rd subfr only and quantization
* Adaptive exc. construction
*------------------------------------------------------------------------*/
- *pt_pitch = pit_encode_ivas_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, Q_new );
+
+ *pt_pitch = pit_encode_fx( st->hBstr, st->acelp_cfg.pitch_bits, st->core_brate, 0, L_frame, coder_type, &pitch_limit_flag, i_subfr, exc, 2 * L_SUBFR, st->pitch, &T0_min, &T0_max, &T0, &T0_frac, h1, xn, tdm_Pitch_reuse_flag, tdm_Pri_pitch_buf, st->element_mode, Q_new );
move16();
Scale_sig( h1, 2 * L_SUBFR, sub( 13, q_h1 ) ); // Q13
@@ -292,12 +294,15 @@ void encod_gen_2sbfr(
*-----------------------------------------------------------------*/
clip_gain = gp_clip_fx( st->element_mode, st->core_brate, st->voicing_fx, i_subfr, coder_type, xn, st->clip_var_fx, sub( Q_new, 1 ) ); // Q0
+
/*-----------------------------------------------------------------*
* LP filtering of the adaptive excitation, codebook target computation
*-----------------------------------------------------------------*/
+
Scale_sig( h1, 2 * L_SUBFR, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */
- lp_filt_exc_enc_ivas_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode );
+ lp_filt_exc_enc_fx( MODE1, coder_type, i_subfr, exc, h1, xn, y1, xn2, 2 * L_SUBFR, L_frame, g_corr, clip_gain, &gain_pit, &st->acelp_cfg.ltf_mode );
+
/* update long-term pitch gain for speech/music classifier */
st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14
move16();
@@ -312,7 +317,8 @@ void encod_gen_2sbfr(
* Gain encoding
*-----------------------------------------------------------------*/
- gain_enc_lbr_ivas_fx( st->hBstr, st->acelp_cfg.gains_mode, coder_type, i_subfr, xn, y1, add( sub( Q_new, 1 ), shift ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR );
+ gain_enc_lbr_fx( st->hBstr, st->acelp_cfg.gains_mode, coder_type, i_subfr, xn, y1, add( sub( Q_new, 1 ), shift ), y2, code, &gain_pit, &gain_code, &gain_inov, &norm_gain_code, g_corr, gc_mem, gp_mem, clip_gain, 2 * L_SUBFR,
+ st->element_mode );
IF( st->Opt_SC_VBR )
{
@@ -370,7 +376,11 @@ void encod_gen_2sbfr(
* Prepare TBE excitation
*-----------------------------------------------------------------*/
+#ifdef FIX_2010_PREP_TBE_EXC
+ prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, Q10, Q_new, T0, T0_frac, coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag );
+#else
prep_tbe_exc_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, Q_new, T0, T0_frac, coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag );
+#endif
voice_factors[i_subfr / L_SUBFR + 1] = voice_factors[i_subfr / L_SUBFR]; /* Q15 */
move16();
diff --git a/lib_enc/lead_indexing_fx.c b/lib_enc/lead_indexing_fx.c
index 70e0c4796ac2a53ea93ea8b1e7368999f4726e5c..c26c817f406acd1157f25b49a12974e4ac798703 100644
--- a/lib_enc/lead_indexing_fx.c
+++ b/lib_enc/lead_indexing_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include "options.h" /* Compilation switches */
#include "cnst.h"
-//#include "prot_fx.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
@@ -13,6 +12,7 @@
/*-------------------------------------------------------------------*
* Local function prototypes
*-------------------------------------------------------------------*/
+
static Word16 fcb_encode_pos_fx( const Word16 pos_vector[], const Word16 pulse_num, const Word16 pos_num );
/*-------------------------------------------------------------------*
@@ -20,6 +20,7 @@ static Word16 fcb_encode_pos_fx( const Word16 pos_vector[], const Word16 pulse_n
*
* Compute base index for RE8
*-------------------------------------------------------------------*/
+
void re8_compute_base_index_fx(
const Word16 *x, /* i : Elemen of Q2, Q3 or Q4 */
const Word16 ka, /* i : Identifier of the absolute leader related to x Q0*/
diff --git a/lib_enc/lib_enc_fx.c b/lib_enc/lib_enc_fx.c
index dece7ba26a5a9b771489163b89aac1d22baeb02f..295608d6fb902cc09274d92c175fc9668df4ddf9 100644
--- a/lib_enc/lib_enc_fx.c
+++ b/lib_enc/lib_enc_fx.c
@@ -1191,7 +1191,7 @@ ivas_error IVAS_ENC_GetDelay(
return IVAS_ERR_UNEXPECTED_NULL_POINTER;
}
- *delay = NS2SA_FX2( hEncoderConfig->input_Fs, get_delay_fx( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, IVAS_AUDIO_CONFIG_INVALID ) );
+ *delay = NS2SA_FX2( hEncoderConfig->input_Fs, get_delay_fx( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, 0 ) );
move16();
*delay = imult1616( *delay, hEncoderConfig->nchan_inp ); /*Q0*/
diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c
index 01005f6419fac1fdfb8a1c1dad6f30bdb96f60e1..3b77bf3cd4697c528d9248c1aadf575422f1cf9a 100644
--- a/lib_enc/lp_exc_e_fx.c
+++ b/lib_enc/lp_exc_e_fx.c
@@ -173,163 +173,6 @@ Word16 lp_filt_exc_enc_fx(
return select;
}
-
-Word16 lp_filt_exc_enc_ivas_fx(
- const Word16 codec_mode, /* i : MODE1 or MODE2 Q0 */
- const Word16 coder_type, /* i : coding type Q0 */
- const Word16 i_subfr, /* i : subframe index Q0 */
- Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */
- const Word16 *h1, /* i : weighted filter input response Q(15) */
- const Word16 *xn, /* i : target vector Q_new-1+shift */
- Word16 *y1, /* o : zero-memory filtered adaptive excitation Q_new-1+shift */
- Word16 *xn2, /* o : target vector for innovation search Q_new-1+shift */
- const Word16 L_subfr, /* i : length of vectors for gain quantization Q0 */
- const Word16 L_frame, /* i : frame size Q0 */
- Word16 *g_corr, /* o : ACELP correlation values mant/exp */
- const Word16 clip_gain, /* i : adaptive gain clipping flag Q0 */
- Word16 *gain_pit, /* o : adaptive excitation gain Q14 */
- Word16 *lp_flag /* i/o: mode selection Q0 */
-)
-{
- Word16 gain1, gain2, g_corr2[4], exc_tmp[5 * L_SUBFR], xn2_tmp[5 * L_SUBFR];
- Word16 y1_tmp[5 * L_SUBFR];
- Word16 select, i, exp_ener, exp_ener1;
- Word16 wtmp, wtmp1;
- Word32 Ltmp;
-
- Word16 use_prev_sf_pit_gain = 0; // Q0
- move16();
-
- gain1 = 0;
- move16();
- gain2 = 0;
- move16();
-
- /*----------------------------------------------------------------*
- * Find the target energy if the adaptive exc. is not filtered
- *----------------------------------------------------------------*/
- test();
- IF( EQ_16( codec_mode, MODE2 ) && EQ_16( coder_type, 100 ) )
- {
- use_prev_sf_pit_gain = 1; // Q0
- move16();
- }
- exp_ener = 0;
- move16();
- wtmp = 0;
- move16();
- test();
- IF( EQ_16( *lp_flag, FULL_BAND ) || EQ_16( *lp_flag, NORMAL_OPERATION ) )
- {
- IF( EQ_16( use_prev_sf_pit_gain, 1 ) )
- {
- wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, gain_pit, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); // exp_ener
- }
- ELSE
- {
- wtmp = adpt_enr_fx( codec_mode, &exc[i_subfr], h1, y1, L_subfr, &gain1, g_corr, clip_gain, xn, xn2, &exp_ener, use_prev_sf_pit_gain ); // exp_ener
- }
- }
-
- /*----------------------------------------------------------------*
- * Filter the adaptive excitation
- * Find the target energy if the adapt. exc. is filtered
- *----------------------------------------------------------------*/
-
- exp_ener1 = 0;
- move16();
- wtmp1 = 0;
- move16();
- test();
- IF( ( ( *lp_flag == LOW_PASS ) ) || ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) )
- {
- test();
- IF( EQ_16( codec_mode, MODE2 ) && EQ_16( L_frame, L_FRAME16k ) )
- {
- FOR( i = 0; i < L_subfr; i++ )
- {
- Ltmp = L_mult( 6881, exc[i - 1 + i_subfr] ); /* constants in Q15 */
- Ltmp = L_mac( Ltmp, 19005, exc[i + i_subfr] );
- Ltmp = L_mac( Ltmp, 6881, exc[i + 1 + i_subfr] );
- exc_tmp[i] = round_fx( Ltmp );
- move16();
- }
- }
- ELSE
- {
- FOR( i = 0; i < L_subfr; i++ )
- {
- Ltmp = L_mult( 5898, exc[i - 1 + i_subfr] ); /* constants in Q15 */
- Ltmp = L_mac( Ltmp, 20972, exc[i + i_subfr] );
- Ltmp = L_mac( Ltmp, 5898, exc[i + 1 + i_subfr] );
- exc_tmp[i] = round_fx( Ltmp );
- move16();
- }
- }
- IF( EQ_16( use_prev_sf_pit_gain, 1 ) )
- {
- wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, gain_pit, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); // exp_ener1
- }
- ELSE
- {
- wtmp1 = adpt_enr_fx( codec_mode, exc_tmp, h1, y1_tmp, L_subfr, &gain2, g_corr2, clip_gain, xn, xn2_tmp, &exp_ener1, use_prev_sf_pit_gain ); // exp_ener1
- }
- }
-
- if ( LT_16( exp_ener, exp_ener1 ) )
- {
- wtmp = shr( wtmp, 1 );
- }
-
- if ( GT_16( exp_ener, exp_ener1 ) )
- {
- wtmp1 = shr( wtmp1, 1 );
- }
-
- /*-----------------------------------------------------------------*
- * use the best prediction (minimize quadratic error)
- *-----------------------------------------------------------------*/
-
- test();
- test();
- IF( ( ( LT_16( wtmp1, wtmp ) ) && ( EQ_16( *lp_flag, NORMAL_OPERATION ) ) ) || ( ( *lp_flag == LOW_PASS ) ) )
- {
- /* use the LP filter for pitch excitation prediction */
- select = LOW_PASS;
- move16();
- Copy( exc_tmp, &exc[i_subfr], L_subfr ); // Q_new
- Copy( y1_tmp, y1, L_subfr ); // Q_new-1+shift
- Copy( xn2_tmp, xn2, L_subfr ); // Q_new-1+shift
-
- IF( use_prev_sf_pit_gain == 0 )
- {
- *gain_pit = gain2; // Q14
- move16();
- g_corr[0] = g_corr2[0];
- move16();
- g_corr[1] = g_corr2[1];
- move16();
- g_corr[2] = g_corr2[2];
- move16();
- g_corr[3] = g_corr2[3];
- move16();
- }
- }
- ELSE
- {
- /* no LP filter used for pitch excitation prediction */
- select = FULL_BAND;
- move16();
- IF( use_prev_sf_pit_gain == 0 )
- {
- *gain_pit = gain1; // Q14
- move16();
- }
- }
-
- return select;
-}
-
/*-------------------------------------------------------------------*
* adpt_enr_fx()
*
diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c
index 8db83c2b9c6cff417d8bdb6e4d298278c7d5fc4a..469b3baa2490497d27584bbd9a3c6513c295516a 100644
--- a/lib_enc/lsf_enc_fx.c
+++ b/lib_enc/lsf_enc_fx.c
@@ -5,9 +5,7 @@
#include
#include "options.h" /* Compilation switches */
#include "rom_enc.h"
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "rom_com.h" /* Static table prototypes */
-//#include "prot_fx.h" /* Function prototypes */
+#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "ivas_prot_fx.h" /* Function prototypes */
@@ -16,6 +14,7 @@
/*-----------------------------------------------------------------*
* Local constants
*-----------------------------------------------------------------*/
+
#define MIN_LOG_FX 0
#define MIN_LOG_VAL_FX -15360 /* -60.0f in Q8 */
#define MSVQ_MAXCNT 3000
@@ -35,6 +34,7 @@ static void lsf_mid_enc_fx( BSTR_ENC_HANDLE hBstr, Word16 nb_bits, const Word16
static void lsf_mid_enc_ivas_fx( BSTR_ENC_HANDLE hBstr, Word16 nb_bits, const Word32 int_fs, const Word16 qlsp0[], const Word16 qlsp1[], Word16 lsp[], const Word16 coder_type, const Word16 bwidth, Word32 Bin_Ener_old[], Word16 Q_ener, Word16 ppp_mode, Word16 nelp_mode );
+
/*===========================================================================*/
/* FUNCTION : lsf_enc_fx() */
/*---------------------------------------------------------------------------*/
@@ -766,8 +766,10 @@ static Word16 qlsf_Mode_Select_fx(
Word32 temp32, En = 0;
Word16 safety_net;
Word16 i, cs, cl;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/* calculate the prediction residual */
@@ -784,10 +786,10 @@ static Word16 qlsf_Mode_Select_fx(
{
pred_pow2[i] = shl( pred1[i], cs );
move16();
-#ifdef ISSUE_1796_replace_shl_o
- En = L_mac_o( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ En = L_mac_sat( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i] ); /* 2.56*2.56 at Q-4 */
#else
- En = L_mac_o( En, mult( pred_pow2[i], shl_o( w[i], 2, &Overflow ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */
+ En = L_mac_o( En, mult( pred_pow2[i], shl_sat( w[i], 2 ) ), pred_pow2[i], &Overflow ); /* 2.56*2.56 at Q-4 */
#endif
}
@@ -1968,8 +1970,10 @@ static void first_VQstages(
Word16 *pTmp_short, idx_buf[2 * LSFMBEST * MAX_VQ_STAGES], parents[LSFMBEST], counter = 0, j,
m, s, c, c2, p_max, *indices[2];
Word16 maxC = LSFMBEST;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/*float dd[16];*/
@@ -1996,9 +2000,13 @@ static void first_VQstages(
L_tmp = L_deposit_l( 0 );
FOR( j = 0; j < N; j++ )
{
- L_tmp1 = L_shl_o( L_mult0( u[j], w[j] ), 7, &Overflow ); /*x2.56 + Q8 + Q7 */
- L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */
- L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp1 = L_shl_sat( L_mult0( u[j], w[j] ), 7 ); /*x2.56 + Q8 + Q7 */
+#else
+ L_tmp1 = L_shl_o( L_mult0( u[j], w[j] ), 7, &Overflow ); /*x2.56 + Q8 + Q7 */
+#endif
+ L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */
+ L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */
}
set32_fx( dist[1], L_tmp, maxC );
@@ -2158,8 +2166,10 @@ static void first_VQstages_ivas_fx(
Word16 *pTmp_short, idx_buf[2 * LSFMBEST * MAX_VQ_STAGES], parents[LSFMBEST], counter = 0, j,
m, s, c, c2, p_max, *indices[2];
Word16 maxC = LSFMBEST;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/*float dd[16];*/
@@ -2186,9 +2196,13 @@ static void first_VQstages_ivas_fx(
L_tmp = L_deposit_l( 0 );
FOR( j = 0; j < N; j++ )
{
- L_tmp1 = L_shl_o( L_mult0( u[j], w[j] ), 7, &Overflow ); /*x2.56 + Q8 + Q7 */
- L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */
- L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp1 = L_shl_sat( L_mult0( u[j], w[j] ), 7 ); /*x2.56 + Q8 + Q7 */
+#else
+ L_tmp1 = L_shl_o( L_mult0( u[j], w[j] ), 7, &Overflow ); /*x2.56 + Q8 + Q7 */
+#endif
+ L_tmp1 = Mult_32_16( L_tmp1, u[j] ); /*x2.56 + Q15 + x2.56 -Q15 */
+ L_tmp = L_add( L_tmp, L_tmp1 ); /*Q0 + x2.56 +x2.56 */
}
set32_fx( dist[1], L_shr( L_tmp, 1 ), maxC ); /*Q-1 + x2.56 +x2.56 */
@@ -2369,11 +2383,6 @@ static Word32 vq_lvq_lsf_enc(
Word16 quant[LSFMBEST][M], diff[M], dd[M];
Word16 lat_cv[LSFMBEST][M];
Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2];
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
-#endif
-#endif
stagesVQ = sub( stages, 1 );
/* Codebook selection */
@@ -2424,25 +2433,13 @@ static Word32 vq_lvq_lsf_enc(
Vr_subt( cand[i], lsf, diff, M );
FOR( j = 0; j < M; j++ )
{
-#ifdef ISSUE_1796_replace_shl_o
diff[j] = shl_sat( diff[j], 4 );
-#else
- diff[j] = shl_o( diff[j], 4, &Overflow );
-#endif
move16();
}
-#ifdef ISSUE_1796_replace_shl_o
L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
-#else
- L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
-#endif
FOR( j = 1; j < M; j++ )
{
-#ifdef ISSUE_1796_replace_shl_o
L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
-#else
- L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
-#endif
}
e[i] = L_tmp; /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
move32();
@@ -2489,11 +2486,6 @@ static Word32 vq_lvq_lsf_enc_ivas_fx(
Word16 quant[LSFMBEST][M], diff[M], dd[M];
Word16 lat_cv[LSFMBEST][M];
Word16 idx_lead[LSFMBEST][2], idx_scale[LSFMBEST][2];
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
-#endif
-#endif
stagesVQ = sub( stages, 1 );
/* Codebook selection */
@@ -2561,24 +2553,16 @@ static Word32 vq_lvq_lsf_enc_ivas_fx(
Vr_subt( cand[i], lsf, diff, M );
FOR( j = 0; j < M; j++ )
{
-#ifdef ISSUE_1796_replace_shl_o
diff[j] = shl_sat( diff[j], 4 );
-#else
- diff[j] = shl_o( diff[j], 4, &Overflow );
-#endif
move16();
}
-#ifdef ISSUE_1796_replace_shl_o
L_tmp = L_mult( mult( diff[0], shl_sat( w[0], 1 ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
-#else
- L_tmp = L_mult( mult( diff[0], shl_o( w[0], 1, &Overflow ) ), diff[0] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
-#endif
FOR( j = 1; j < M; j++ )
{
-#ifdef ISSUE_1796_replace_shl_o
- L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
+#ifdef FIX_1979_SAT_MISSING_IN_LSF_ENC
+ L_tmp = L_mac_sat( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
#else
- L_tmp = L_mac( L_tmp, mult( diff[j], shl_o( w[j], 1, &Overflow ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
+ L_tmp = L_mac( L_tmp, mult( diff[j], shl_sat( w[j], 1 ) ), diff[j] ); /*(2.56+Q5+ Q10 -Q15) + 2.56+ Q5 + Q1 = 2.56 + 2.56 + Q6 */
#endif
}
e[i] = L_tmp;
@@ -3354,8 +3338,10 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx(
Word16 error_svq_fx[M], error_svq_q_fx[M];
Word16 cl, cs;
Word32 temp_l;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
IF( EQ_16( safety_net, 1 ) )
{
@@ -3428,10 +3414,10 @@ Word32 qlsf_ARSN_tcvq_Enc_16k_fx(
{
yy_fx[i] = shl( yy_fx[i], cs );
move16();
-#ifdef ISSUE_1796_replace_shl_o
- temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i], &Overflow );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ temp_l = L_mac_sat( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i] );
#else
- temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_o( w_fx[i], 2, &Overflow ) ), yy_fx[i], &Overflow );
+ temp_l = L_mac_o( temp_l, mult( yy_fx[i], shl_sat( w_fx[i], 2 ) ), yy_fx[i], &Overflow );
#endif
}
cs = shl( cs, 1 );
@@ -3451,14 +3437,20 @@ static void FFT_Mid_Interpol_16k_fx(
)
{
Word16 i;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
FOR( i = 0; i < L_FFT / 2; i++ )
{
/* Interpolation */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Bin_Ener_mid[i] = L_shr( L_add_sat( Bin_Ener_old[i], Bin_Ener[i] ), 1 );
+#else
Bin_Ener_mid[i] = L_shr( L_add_o( Bin_Ener_old[i], Bin_Ener[i], &Overflow ), 1 );
+#endif
/* Memory update */
Bin_Ener_old[i] = Bin_Ener[i];
@@ -3523,8 +3515,10 @@ static void lsf_mid_enc_fx(
Word32 L_tmp;
Word16 tmp, k1;
const Word16 *ratio = NULL;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/* convert LSPs to LSFs */
@@ -3636,16 +3630,13 @@ static void lsf_mid_enc_fx(
tmp = sub( lsf[j], qlsf[j] );
/* err += wghts[j] * ftemp * ftemp; */
/* tmp is usually very small, we can have some extra precision with very rare saturation */
-#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( tmp, 4 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = mult_r_sat( tmp, tmp );
+ err = L_mac_sat( err, tmp, shl_sat( wghts[j], 2 ) );
#else
- tmp = shl_o( tmp, 4, &Overflow );
-#endif
tmp = mult_ro( tmp, tmp, &Overflow );
-#ifdef ISSUE_1796_replace_shl_o
err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow );
-#else
- err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow );
#endif
}
/* err = L_shl(err,Wscale); */
@@ -3708,8 +3699,10 @@ static void lsf_mid_enc_ivas_fx(
Word32 L_tmp;
Word16 tmp, k1;
const Word16 *ratio = NULL;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/* convert LSPs to LSFs */
@@ -3830,16 +3823,13 @@ static void lsf_mid_enc_ivas_fx(
tmp = sub( lsf[j], qlsf[j] );
/* err += wghts[j] * ftemp * ftemp; */
/* tmp is usually very small, we can have some extra precision with very rare saturation */
-#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( tmp, 4 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = mult_r_sat( tmp, tmp );
+ err = L_mac_sat( err, tmp, shl_sat( wghts[j], 2 ) );
#else
- tmp = shl_o( tmp, 4, &Overflow );
-#endif
tmp = mult_ro( tmp, tmp, &Overflow );
-#ifdef ISSUE_1796_replace_shl_o
err = L_mac_o( err, tmp, shl_sat( wghts[j], 2 ), &Overflow );
-#else
- err = L_mac_o( err, tmp, shl_o( wghts[j], 2, &Overflow ), &Overflow );
#endif
}
/* err = L_shl(err,Wscale); */
diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c
index 981c7e51c06cac2b4b196761e84ada582f34549d..333ea97ff14438722073c9a9b7192a8d8ae49d8b 100644
--- a/lib_enc/lsf_msvq_ma_enc_fx.c
+++ b/lib_enc/lsf_msvq_ma_enc_fx.c
@@ -5,9 +5,7 @@
#include
#include
#include "options.h"
-//#include "prot_fx.h"
#include "cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "rom_enc.h"
#include "basop_util.h"
@@ -1578,8 +1576,10 @@ void midlsf_enc_fx(
Word32 err, err_min, L_tmp;
Word16 k, k1, j, tmp, size, qlsf[M], wghts[M];
const Word16 *ratio;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
IF( EQ_16( coder_type, UNVOICED ) )
@@ -1630,15 +1630,19 @@ void midlsf_enc_fx(
tmp = sub( lsf[j], qlsf[j] );
/* err += wghts[j] * ftemp * ftemp; */
/* tmp is usually very small, we can have some extra precision with very rare saturation */
-#ifdef ISSUE_1796_replace_shl_o
tmp = shl_sat( tmp, 4 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ tmp = mult_r_sat( tmp, tmp );
#else
- tmp = shl_o( tmp, 4, &Overflow );
-#endif
tmp = mult_ro( tmp, tmp, &Overflow );
+#endif
err = L_mac( err, tmp, wghts[j] );
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ err = L_shl_sat( err, 2 );
+#else
err = L_shl_o( err, 2, &Overflow );
+#endif
/* err = L_shl(err,Wscale); */
err = Mult_32_16( err, LSF_1_OVER_256SQ );
diff --git a/lib_enc/mdct_classifier_fx.c b/lib_enc/mdct_classifier_fx.c
index ea06878c12f389f63c66e199003cebe35938f4ad..790ec7aa8db0985304b0d493b99aace1fc44c3e6 100644
--- a/lib_enc/mdct_classifier_fx.c
+++ b/lib_enc/mdct_classifier_fx.c
@@ -118,8 +118,10 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision
Word16 exp, exp1, exp2, exp3;
Word32 L_tmp, L_tmp1;
TCX_ENC_HANDLE hTcxEnc = st_fx->hTcxEnc;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
test();
{
@@ -356,7 +358,11 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision
test();
test();
test();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_sat( avrg_H1, 1 ) ) ) || ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( L_tmp, exp ), L_shl( avrg_l, exp1 ) ) ) || GT_32( Mult_32_32( L_shl( L_tmp1, exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) )
+#else
IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_o( avrg_H1, 1, &Overflow ) ) ) || ( LT_32( Mult_32_32( L_shl_o( peak_l, exp, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( L_tmp, exp, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) || GT_32( Mult_32_32( L_shl_o( L_tmp1, exp2, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( peak_h, exp2, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) ) )
+#endif
{
condition3 = 1;
move16();
@@ -450,7 +456,11 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision
test();
test();
test();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_sat( gain1_tmp, 1 ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_sat( gain2_tmp, 1 ) ) ) ) )
+#else
IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_o( gain1_tmp, 1, &Overflow ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_o( gain2_tmp, 1, &Overflow ) ) ) ) )
+#endif
{
clas_final = hTcxEnc->clas_final_old;
move16();
@@ -543,8 +553,10 @@ Word16 mdct_classifier_ivas_fx(
Word16 exp, exp1, exp2, exp3;
Word32 gain1_tmp = 0, gain2_tmp = 0;
Word32 L_tmp, L_tmp1;
+#ifndef ISSUE_1867_replace_overflow_libenc
Flag Overflow = 0;
move16();
+#endif
move16();
move16();
@@ -888,7 +900,11 @@ Word16 mdct_classifier_ivas_fx(
test();
test();
test();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_sat( avrg_H1, 1 ) ) ) || ( LT_32( Mult_32_32( L_shl( peak_l, exp ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( L_tmp, exp ), L_shl( avrg_l, exp1 ) ) ) || GT_32( Mult_32_32( L_shl( L_tmp1, exp2 ), L_shl( avrg_h, exp1 ) ), Mult_32_32( L_shl( peak_h, exp2 ), L_shl( avrg_l, exp1 ) ) ) ) )
+#else
IF( GT_32( Mult_32_16( gain3, 27307 ), gain2 ) || ( GE_32( gain3, Mult_32_16( gain2, 26214 ) ) && GT_32( peak_H1, L_shl_o( avrg_H1, 1, &Overflow ) ) ) || ( LT_32( Mult_32_32( L_shl_o( peak_l, exp, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( L_tmp, exp, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) || GT_32( Mult_32_32( L_shl_o( L_tmp1, exp2, &Overflow ), L_shl_o( avrg_h, exp1, &Overflow ) ), Mult_32_32( L_shl_o( peak_h, exp2, &Overflow ), L_shl_o( avrg_l, exp1, &Overflow ) ) ) ) )
+#endif
{
condition3 = 1;
move16();
@@ -989,7 +1005,11 @@ Word16 mdct_classifier_ivas_fx(
test();
test();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_sat( gain1_tmp, 1 ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_sat( gain2_tmp, 1 ) ) ) ) )
+#else
IF( ( EQ_16( hTcxEnc->clas_final_old, HQ_CORE ) || EQ_16( hTcxEnc->clas_final_old, TCX_20_CORE ) ) && ( ( GT_32( hTcxEnc->last_gain1, L_shr( gain1_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain1, L_shl_o( gain1_tmp, 1, &Overflow ) ) ) && ( GT_32( hTcxEnc->last_gain2, L_shr( gain2_tmp, 1 ) ) && LT_32( hTcxEnc->last_gain2, L_shl_o( gain2_tmp, 1, &Overflow ) ) ) ) )
+#endif
{
clas_final = hTcxEnc->clas_final_old;
move16();
diff --git a/lib_enc/mdct_selector_fx.c b/lib_enc/mdct_selector_fx.c
index c4cc7d0db8bcca97c26af11090363cbb12dfc166..8799806e4c021daccb656d6ca4935a28c934327a 100644
--- a/lib_enc/mdct_selector_fx.c
+++ b/lib_enc/mdct_selector_fx.c
@@ -315,11 +315,11 @@ void MDCT_selector_fx(
test();
prefer_hq_core = ( LT_16( sub( Etot, sp_floor ), sig_lo_level_thr ) ) || /* noise floor is very high */
( LT_16( cor_map_sum, cor_thr2 ) && LT_16( frame_voicing, voicing_thr2 ) && LT_16( sparseness, sparseness_thr2 ) ) || /* too weak tonal components */
- ( EQ_16( st->mdct_sw_enable, MODE1 ) && prefer_tcx == 0 && EQ_16( st->transientDetection.transientDetector.bIsAttackPresent, 1 ) );
+ ( EQ_16( st->mdct_sw_enable, MODE1 ) && prefer_tcx == 0 && EQ_16( st->hTranDet->transientDetector.bIsAttackPresent, 1 ) );
/* Prefer HQ_CORE on transients */
test();
- IF( EQ_16( st->mdct_sw_enable, MODE2 ) && EQ_16( st->transientDetection.transientDetector.bIsAttackPresent, 1 ) )
+ IF( EQ_16( st->mdct_sw_enable, MODE2 ) && EQ_16( st->hTranDet->transientDetector.bIsAttackPresent, 1 ) )
{
prefer_tcx = 0;
move16();
diff --git a/lib_enc/mslvq_enc_fx.c b/lib_enc/mslvq_enc_fx.c
index 4955dede80a4a7e57d285bebf54ec13d0fda2508..05c379f3199b38da686b7ee4cd4040024e4c9e67 100644
--- a/lib_enc/mslvq_enc_fx.c
+++ b/lib_enc/mslvq_enc_fx.c
@@ -2,8 +2,9 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
+#include "options.h" /* Compilation switches */
#include "cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "stl.h"
#include "prot_fx.h" /* Function prototypes */
diff --git a/lib_enc/multi_harm_fx.c b/lib_enc/multi_harm_fx.c
index 665ee5edf2212f65e35f6b46db88e99745cdd034..ba68b685208adcafee3a7dfaf8ae74fead13a6f7 100644
--- a/lib_enc/multi_harm_fx.c
+++ b/lib_enc/multi_harm_fx.c
@@ -41,9 +41,11 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity
Word32 L_acc;
Word32 Lcorx2, Lcory2, Lcorxy, Lcor_map_LT_sum;
Word16 mean_dyn;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*------------------------------------------------------------------*
@@ -212,7 +214,11 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity
IF( EQ_16( i, ind_mins[k] ) )
{
/* include the last peak point (new minimum) to the corr. sum */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] );
+#else
Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow );
+#endif
/* calculation of the norm. peak correlation */
test();
@@ -263,9 +269,15 @@ Word16 multi_harm_fx( /* o : frame multi-harmonicity
k++;
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lcorx2 = L_mac_sat( Lcorx2, S[i], S[i] );
+ Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] );
+ Lcorxy = L_mac_sat( Lcorxy, S[i], old_S[i] );
+#else
Lcorx2 = L_mac_o( Lcorx2, S[i], S[i], &Overflow );
Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow );
Lcorxy = L_mac_o( Lcorxy, S[i], old_S[i], &Overflow );
+#endif
}
Copy( S, old_S, ind_mins[0] );
@@ -384,9 +396,11 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni
Word32 L_acc;
Word32 Lcorx2, Lcory2, Lcorxy, Lcor_map_LT_sum;
Word16 mean_dyn;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*------------------------------------------------------------------*
@@ -549,7 +563,11 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni
IF( EQ_16( i, ind_mins[k] ) )
{
/* include the last peak point (new minimum) to the corr. sum */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] );
+#else
Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow );
+#endif
/* calculation of the norm. peak correlation */
test();
@@ -600,9 +618,15 @@ Word16 multi_harm_ivas_fx( /* o : frame multi-harmoni
k++;
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lcorx2 = L_mac_sat( Lcorx2, S[i], S[i] );
+ Lcory2 = L_mac_sat( Lcory2, old_S[i], old_S[i] );
+ Lcorxy = L_mac_sat( Lcorxy, S[i], old_S[i] );
+#else
Lcorx2 = L_mac_o( Lcorx2, S[i], S[i], &Overflow );
Lcory2 = L_mac_o( Lcory2, old_S[i], old_S[i], &Overflow );
Lcorxy = L_mac_o( Lcorxy, S[i], old_S[i], &Overflow );
+#endif
}
Copy( S, old_S, ind_mins[0] );
diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c
index 39119117598387b0be7081d46dd47b4c72c5a87a..9d192500f9f83c415b6ad3031c9c9b99b9959163 100644
--- a/lib_enc/nelp_enc_fx.c
+++ b/lib_enc/nelp_enc_fx.c
@@ -354,9 +354,11 @@ void nelp_encoder_fx(
move32();
Word16 BP1_ORDER;
Word16 rf_flag;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
@@ -422,7 +424,11 @@ void nelp_encoder_fx(
E1_fx = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME; i++ )
{
- E1_fx = L_mac0_o( E1_fx, in_fx[i], in_fx[i], &Overflow ); /*Q(qE1+qE1) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ E1_fx = L_mac0_sat( E1_fx, in_fx[i], in_fx[i] ); /*Q(qE1+qE1) */
+#else
+ E1_fx = L_mac0_o( E1_fx, in_fx[i], in_fx[i], &Overflow ); /*Q(qE1+qE1) */
+#endif
}
qE1 = shl( qE1, 1 );
@@ -438,7 +444,11 @@ void nelp_encoder_fx(
EL1_fx = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ EL1_fx = L_mac0_sat( EL1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qIn) */
+#else
EL1_fx = L_mac0_o( EL1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qIn) */
+#endif
}
qEL1 = shl( qEL1, 1 );
@@ -454,7 +464,11 @@ void nelp_encoder_fx(
EH1_fx = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ EH1_fx = L_mac0_sat( EH1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qEH1) */
+#else
EH1_fx = L_mac0_o( EH1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qEH1) */
+#endif
}
qEH1 = 2 * qEH1;
move16();
@@ -470,7 +484,11 @@ void nelp_encoder_fx(
Ltemp = L_deposit_l( 0 );
FOR( j = (Word16) ( i * lag ); j < (Word16) ( ( i + 1 ) * lag ); j++ )
{
- Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */
+#else
+ Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#endif
}
/*Gains[i] = (float) sqrt(Gains[i]/lag); */
@@ -494,7 +512,11 @@ void nelp_encoder_fx(
Ltemp = L_deposit_l( 0 );
FOR( j = (Word16) ( i * lag ); j < L_FRAME; j++ )
{
- Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */
+#else
+ Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#endif
}
/*Gains[i] = (float) sqrt(Gains[i]/(L_FRAME-(lag*i))); */
@@ -1099,9 +1121,11 @@ void nelp_encoder_ivas_fx(
move32();
Word16 BP1_ORDER;
Word16 rf_flag;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
SC_VBR_ENC_HANDLE hSC_VBR = st_fx->hSC_VBR;
BSTR_ENC_HANDLE hBstr = st_fx->hBstr;
@@ -1169,7 +1193,11 @@ void nelp_encoder_ivas_fx(
E1_fx = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME; i++ )
{
- E1_fx = L_mac0_o( E1_fx, in_fx[i], in_fx[i], &Overflow ); /*Q(qE1+qE1) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ E1_fx = L_mac0_sat( E1_fx, in_fx[i], in_fx[i] ); /*Q(qE1+qE1) */
+#else
+ E1_fx = L_mac0_o( E1_fx, in_fx[i], in_fx[i], &Overflow ); /*Q(qE1+qE1) */
+#endif
}
qE1 = shl( qE1, 1 );
@@ -1184,7 +1212,11 @@ void nelp_encoder_ivas_fx(
EL1_fx = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ EL1_fx = L_mac0_sat( EL1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qIn) */
+#else
EL1_fx = L_mac0_o( EL1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qIn) */
+#endif
}
qEL1 = shl( qEL1, 1 );
@@ -1200,7 +1232,11 @@ void nelp_encoder_ivas_fx(
EH1_fx = L_deposit_l( 0 );
FOR( i = 0; i < L_FRAME; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ EH1_fx = L_mac0_sat( EH1_fx, filtRes_fx[i], filtRes_fx[i] ); /*Q(2*qEH1) */
+#else
EH1_fx = L_mac0_o( EH1_fx, filtRes_fx[i], filtRes_fx[i], &Overflow ); /*Q(2*qEH1) */
+#endif
}
qEH1 = shl( qEH1, 1 );
move16();
@@ -1215,7 +1251,11 @@ void nelp_encoder_ivas_fx(
Ltemp = L_deposit_l( 0 );
FOR( j = (Word16) ( i * lag ); j < (Word16) ( ( i + 1 ) * lag ); j++ )
{
- Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */
+#else
+ Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#endif
}
/*Gains[i] = (float) sqrt(Gains[i]/lag); */
@@ -1239,7 +1279,11 @@ void nelp_encoder_ivas_fx(
Ltemp = L_deposit_l( 0 );
FOR( j = i_mult( i, lag ); j < L_FRAME; j++ )
{
- Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltemp = L_mac0_sat( Ltemp, in_fx[j], in_fx[j] ); /*Q(2*qGain) */
+#else
+ Ltemp = L_mac0_o( Ltemp, in_fx[j], in_fx[j], &Overflow ); /*Q(2*qGain) */
+#endif
}
/*Gains[i] = (float) sqrt(Gains[i]/(L_FRAME-(lag*i))); */
diff --git a/lib_enc/nois_est_fx.c b/lib_enc/nois_est_fx.c
index 224e4dddbcdc9183b1749fe35f9c4aab8876d069..fb07df485a5f63e9f9df553bfc626e90bdcac6dd 100644
--- a/lib_enc/nois_est_fx.c
+++ b/lib_enc/nois_est_fx.c
@@ -102,12 +102,16 @@ static Word16 noise_est_ln_q8_fx(
{
Word16 e_ener, f_ener;
Word32 L_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
#endif
L_tmp = L_add_o( L_enr, L_shl( (Word32) 1L, q_new_plus_q_scale ), &Overflow ); /* +1.0f */
+#else
+ L_tmp = L_add_sat( L_enr, L_shl( (Word32) 1L, q_new_plus_q_scale ) ); /* +1.0f */
+#endif
if ( flag_add1p0 == 0 )
{
L_tmp = L_add( L_enr, 0 ); /* +0 , no offset */
@@ -664,8 +668,10 @@ void noise_est_down_fx(
Word16 scale;
Word32 totalNoise_temp;
Word32 L_Etot, L_Etot_last, L_Etot_v_h2, L_Etot_v;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
L_Etot = L_shl( Etot, 16 ); /*Q24 for later AR1 computations*/
@@ -681,7 +687,11 @@ void noise_est_down_fx(
totalNoise_temp = L_deposit_l( 0 );
FOR( i = min_band; i <= max_band; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ totalNoise_temp = L_add_sat( totalNoise_temp, bckr[i] ); /*Q_new+QSCALE*/
+#else
totalNoise_temp = L_add_o( totalNoise_temp, bckr[i], &Overflow ); /*Q_new+QSCALE*/
+#endif
}
totalNoise_temp = L_max( totalNoise_temp, L_shl( e_min, 4 ) );
@@ -705,7 +715,11 @@ void noise_est_down_fx(
FOR( i = 0; i < NB_BANDS; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_add_sat( L_shr_r( *pt1, 1 ), L_shr_r( *pt2, 1 ) );
+#else
Ltmp = L_add_o( L_shr_r( *pt1, 1 ), L_shr_r( *pt2, 1 ), &Overflow );
+#endif
/*Ltmp = L_shr_r(L_add(*pt1,*pt2),1);*/
enr[i] = Ltmp;
move32(); /*Q_new+QSCALE*/
@@ -1003,9 +1017,11 @@ void noise_est_fx(
}
GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*-----------------------------------------------------------------*
@@ -1101,8 +1117,13 @@ void noise_est_fx(
Ltmp = L_deposit_h( corr_shift );
Ltmp = L_mac( Ltmp, st_fx->voicing_fx[0], 10923 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_mac_sat( Ltmp, st_fx->voicing_fx[1], 10923 );
+ wtmp = mac_r_sat( Ltmp, st_fx->voicing_fx[2], 10923 );
+#else
Ltmp = L_mac_o( Ltmp, st_fx->voicing_fx[1], 10923, &Overflow );
wtmp = mac_ro( Ltmp, st_fx->voicing_fx[2], 10923, &Overflow );
+#endif
tmp_pc = pc;
move16();
@@ -1155,7 +1176,11 @@ void noise_est_fx(
FOR( i = 10; i <= st_fx->max_band; i++ )
{
Lnum = L_max( *pt1, *pt2 ); /* Don't need if anymore */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lsum_den = L_add_sat( Lsum_den, Lnum );
+#else
Lsum_den = L_add_o( Lsum_den, Lnum, &Overflow );
+#endif
Ltmpden = L_min( *pt1, *pt2 );
if ( Ltmpden == 0 )
{
@@ -1211,11 +1236,7 @@ void noise_est_fx(
/* calculation of energy in the rest of bands */
Ltmp2 = sum32_fx( &fr_bands[10], sub( st_fx->max_band, 9 ) );
-#ifdef ISSUE_1796_replace_shl_o
wtmp = shl_sat( 1, sub( add( Q_new, QSCALE ), 1 ) );
-#else
- wtmp = shl_o( 1, sub( add( Q_new, QSCALE ), 1 ), &Overflow );
-#endif
test();
IF( L_msu( Ltmp, 100, wtmp ) < 0 || L_msu( Ltmp2, 100, wtmp ) < 0 )
@@ -1232,11 +1253,7 @@ void noise_est_fx(
ExpDen = norm_l( Ltmp );
den = extract_h( L_shl( Ltmp, ExpDen ) );
num = div_s( num, den );
-#ifdef ISSUE_1799_replace_L_shr_o
noise_chartmp = extract_h( L_shr_sat( num, add( sub( ExpNum, ExpDen ), 4 - 16 ) ) ); /* Q11 */
-#else
- noise_chartmp = extract_h( L_shr_o( num, add( sub( ExpNum, ExpDen ), 4 - 16 ), &Overflow ) ); /* Q11 */
-#endif
}
noise_chartmp = s_min( noise_chartmp, (Word16) 10 << 11 ); /* Q11 */
@@ -1277,9 +1294,13 @@ void noise_est_fx(
tmp = s_max( relE, 0 ); /* Q8 */
/* alpha = 0.064f * ftemp + 0.75f; */
- Ltmp = Mult_32_16( (Word32) 137438953L, tmp ); /* Q31(.064)+Q8+1-16 --> Q24 */
- Ltmp = L_mac( Ltmp, 256, 24576 ); /* Q8+Q15(.75)+1 --> Q24 */
- alpha = round_fx_o( L_shl_o( Ltmp, 7, &Overflow ), &Overflow ); /*Q24 +7 --> Q31 Q15*/
+ Ltmp = Mult_32_16( (Word32) 137438953L, tmp ); /* Q31(.064)+Q8+1-16 --> Q24 */
+ Ltmp = L_mac( Ltmp, 256, 24576 ); /* Q8+Q15(.75)+1 --> Q24 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alpha = round_fx_sat( L_shl_sat( Ltmp, 7 ) ); /*Q24 +7 --> Q31 Q15*/
+#else
+ alpha = round_fx_o( L_shl_o( Ltmp, 7, &Overflow ), &Overflow ); /*Q24 +7 --> Q31 Q15*/
+#endif
/*if( alpha > 0.999f { alpha = 0.999f;} */
alpha = s_min( alpha, 32735 ); /*.999 in Q15*/
@@ -1314,9 +1335,14 @@ void noise_est_fx(
/* + 1.0f added to reduce sensitivity to non stationarity in low energies */
/* tmp_enr = enr[i] + 1.0f; */
tmp_Q = add( Q_new, Q_SCALE );
- Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */
- L_tmp_enr = L_add_o( enr[i], Ltmp, &Overflow ); /* enr scale dynamic */
- L_tmp_ave_enr = L_add_o( hNoiseEst->ave_enr_fx[i], Ltmp, &Overflow ); /* ave__enr scale dynamic */
+ Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp_enr = L_add_sat( enr[i], Ltmp ); /* enr scale dynamic */
+ L_tmp_ave_enr = L_add_sat( hNoiseEst->ave_enr_fx[i], Ltmp ); /* ave__enr scale dynamic */
+#else
+ L_tmp_enr = L_add_o( enr[i], Ltmp, &Overflow ); /* enr scale dynamic */
+ L_tmp_ave_enr = L_add_o( hNoiseEst->ave_enr_fx[i], Ltmp, &Overflow ); /* ave__enr scale dynamic */
+#endif
IF( LE_32( non_sta, th_sta ) ) /* Just to limit the saturation */
{
@@ -1335,11 +1361,7 @@ void noise_est_fx(
den = extract_h( L_shl( Lden, ExpDen ) );
num = div_s( num, den );
Ltmp = Mult_32_16( non_sta, num );
-#ifdef ISSUE_1799_replace_L_shr_o
non_sta = L_shr_sat( Ltmp, sub( ExpNum, ExpDen ) ); /* Q10 */
-#else
- non_sta = L_shr_o( Ltmp, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */
-#endif
}
/* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */
@@ -1359,10 +1381,14 @@ void noise_est_fx(
} */
/* ave_enr2:: calculation of another non-stationarity measure (following attacks) */
- Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */
- /*L_tmp_enr = L_add(enr[i] , Ltmp );*/ /* enr scale dynamic , done above */
+ Ltmp = L_shl( (Word32) 1L, tmp_Q ); /* 1.0 added in the right dynamic domain */
+ /*L_tmp_enr = L_add(enr[i] , Ltmp );*/ /* enr scale dynamic , done above */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp_ave_enr2 = L_add_sat( hNoiseEst->ave_enr2_fx[i], Ltmp ); /* ave__enr scale dynamic */
+#else
L_tmp_ave_enr2 = L_add_o( hNoiseEst->ave_enr2_fx[i], Ltmp, &Overflow ); /* ave__enr scale dynamic */
- IF( LE_32( Lnon_sta2, th_sta ) ) /* Just to limit the saturation */
+#endif
+ IF( LE_32( Lnon_sta2, th_sta ) ) /* Just to limit the saturation */
{
Lnum = L_max( L_tmp_enr, L_tmp_ave_enr2 );
Lden = L_min( L_tmp_enr, L_tmp_ave_enr2 );
@@ -1374,11 +1400,7 @@ void noise_est_fx(
den = extract_h( L_shl( Lden, ExpDen ) );
num = div_s( num, den );
Ltmp1 = Mult_32_16( Lnon_sta2, num );
-#ifdef ISSUE_1799_replace_L_shr_o
Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */
-#else
- Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */
-#endif
}
/* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i]
@@ -1397,7 +1419,11 @@ void noise_est_fx(
/* log_enr = (float)ln_fx(enr[i]); */
log_enr16 = noise_est_ln_q8_fx( enr[i], 0, tmp_Q );
wtmp = abs_s( sub( log_enr16, hSpMusClas->past_log_enr_fx[i - START_BAND_SPMUS] ) );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *non_staX = add_sat( *non_staX, wtmp );
+#else
*non_staX = add_o( *non_staX, wtmp, &Overflow );
+#endif
move16(); /* Q8 */
hSpMusClas->past_log_enr_fx[i - START_BAND_SPMUS] = log_enr16;
move16();
@@ -1413,7 +1439,11 @@ void noise_est_fx(
tmp_floor = LN_E_MIN_PLUS_ONE_FX;
move16(); /* non dynamic init constant in Q8 */
tmp_floor = noise_est_ln_q8_fx( hNoiseEst->bckr_fx[i], 1, tmp_Q );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ) ); /* Q8 */
+#else
non_staB = add_o( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ), &Overflow ); /* Q8 */
+#endif
}
ELSE /*ini_frame < 100*/
{
@@ -1422,7 +1452,11 @@ void noise_est_fx(
tmp_floor = LN_E_MIN_PLUS_ONE_FX;
move16(); /* non dynamic init constant in Q8 */
tmp_floor = noise_est_ln_q8_fx( E_MIN_FX, 1, tmp_Q );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ) ); /* Q8 */
+#else
non_staB = add_o( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ), &Overflow ); /* Q8 */
+#endif
}
}
@@ -1532,9 +1566,14 @@ void noise_est_fx(
/*epsP_0_2 = max(0 , min(8, epsP[0] / epsP[2])); */
Ltmp = eps_quota_fx( epsP_h[0], epsP_l[0],
- epsP_h[2], epsP_l[2], 12 ); /* Word32 Q12 */
- BASOP_SATURATE_WARNING_OFF_EVS /* may saturate*/
- epsP_0_2 = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12+16 -16 -> Q12 , NB saturation in Q12 sets max value to 7,999 */
+ epsP_h[2], epsP_l[2], 12 ); /* Word32 Q12 */
+ BASOP_SATURATE_WARNING_OFF_EVS /* may saturate*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ epsP_0_2 = round_fx_sat( L_shl_sat( Ltmp, 16 ) );
+ /* Q12+16 -16 -> Q12 , NB saturation in Q12 sets max value to 7,999 */
+#else
+ epsP_0_2 = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12+16 -16 -> Q12 , NB saturation in Q12 sets max value to 7,999 */
+#endif
BASOP_SATURATE_WARNING_ON_EVS
epsP_0_2 = s_max( 0, epsP_0_2 ); /* min value is 0 , Q12 */
@@ -1571,10 +1610,14 @@ void noise_est_fx(
/* epsP_2_16 = max(0 , min(8, epsP[2] / epsP[16])); */
Ltmp = eps_quota_fx( epsP_h[2], epsP_l[2],
- epsP_h[16], epsP_l[16], 12 ); /* Word32 Q12 */
- BASOP_SATURATE_WARNING_OFF_EVS /* may saturate*/
- epsP_2_16 = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12+16 -16 -> Q12 ,
- NB saturation in Q12 sets max value to 7,999 */
+ epsP_h[16], epsP_l[16], 12 ); /* Word32 Q12 */
+ BASOP_SATURATE_WARNING_OFF_EVS /* may saturate*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ epsP_2_16 = round_fx_sat( L_shl_sat( Ltmp, 16 ) ); /* Q12+16 -16 -> Q12 ,*/
+#else
+ epsP_2_16 = round_fx_o( L_shl_o( Ltmp, 16, &Overflow ), &Overflow ); /* Q12+16 -16 -> Q12 ,*/
+#endif
+ /*NB saturation in Q12 sets max value to 7,999 */
BASOP_SATURATE_WARNING_ON_EVS
epsP_2_16 = s_max( 0, epsP_2_16 ); /* min value is 0 , Q12 */
@@ -1696,7 +1739,11 @@ void noise_est_fx(
*-----------------------------------------------------------------*/
Ltmp = L_mult( st_fx->voicing_fx[0], 16384 );
Ltmp = L_mac( Ltmp, st_fx->voicing_fx[1], 16384 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor_tmp = mac_r_sat( Ltmp, corr_shift, MAX_16 );
+#else
cor_tmp = mac_ro( Ltmp, corr_shift, MAX_16, &Overflow );
+#endif
LepsP = eps_quota_fx( epsP_h[2], epsP_l[2],
epsP_h[16], epsP_l[16], 11 ); /* L_epsP in Q11 */
@@ -2299,9 +2346,11 @@ void noise_est_ivas_fx(
Le_min_scaled = L_shl( E_MIN_FXQ31, sub( q_fr_bands, Q31 ) ); // q_fr_bands
GSC_ENC_HANDLE hGSCEnc = st_fx->hGSCEnc;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* Check if LR-VAD */
@@ -2418,8 +2467,13 @@ void noise_est_ivas_fx(
Ltmp = L_deposit_h( corr_shift );
Ltmp = L_mac( Ltmp, st_fx->voicing_fx[0], 10923 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Ltmp = L_mac_sat( Ltmp, st_fx->voicing_fx[1], 10923 );
+ wtmp = mac_r_sat( Ltmp, st_fx->voicing_fx[2], 10923 );
+#else
Ltmp = L_mac_o( Ltmp, st_fx->voicing_fx[1], 10923, &Overflow );
wtmp = mac_ro( Ltmp, st_fx->voicing_fx[2], 10923, &Overflow );
+#endif
tmp_pc = pc;
move16();
@@ -2484,8 +2538,8 @@ void noise_est_ivas_fx(
ExpDen = sub( add( q_fr_bands, exp ), Q16 );
}
- num = div_s( num, den ); // Q15+ExpNum-ExpDen
- w_tmp = W_shl( num, sub( q_fr_bands, sub( ExpNum, ExpDen ) ) ); // q_fr_bands+15
+ num = div_s( num, den ); // Q15+ExpNum-ExpDen
+ w_tmp = W_shl( num, s_min( 63, sub( q_fr_bands, sub( ExpNum, ExpDen ) ) ) ); // q_fr_bands+15
w_sum_num = W_add( w_sum_num, w_tmp );
pt1++;
@@ -2564,12 +2618,8 @@ void noise_est_ivas_fx(
ELSE
{
/* ftemp2 /= ftemp */
- num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp
-#ifdef ISSUE_1796_replace_shl_o
+ num = div_s( extract_h( Ltmp2 ), extract_h( Ltmp ) ); // 15+exp2-exp
noise_chartmp = shl_sat( num, sub( sub( exp, exp2 ), 4 ) ); // 15+exp2-exp1 -> Q11
-#else
- noise_chartmp = shl_o( num, sub( sub( exp, exp2 ), 4 ), &Overflow ); // 15+exp2-exp1 -> Q11
-#endif
}
if ( ncharX != NULL )
@@ -2635,7 +2685,11 @@ void noise_est_ivas_fx(
/* alpha = 0.064f * ftemp + 0.75f; */
Ltmp = Madd_32_16( 12582912 /* 0.75 in Q24*/, 137438953, tmp ); // Q24
- alpha = round_fx_o( L_shl_o( Ltmp, 7, &Overflow ), &Overflow ); /*Q24 +7 --> Q31 Q15*/
+#ifdef ISSUE_1867_replace_overflow_libenc
+ alpha = round_fx_sat( L_shl_sat( Ltmp, 7 ) ); /*Q24 +7 --> Q31 Q15*/
+#else
+ alpha = round_fx_o( L_shl_o( Ltmp, 7, &Overflow ), &Overflow ); /*Q24 +7 --> Q31 Q15*/
+#endif
/*if( alpha > 0.999f { alpha = 0.999f;} */
alpha = s_min( alpha, 32735 ); /*.999 in Q15*/
@@ -2697,13 +2751,9 @@ void noise_est_ivas_fx(
ExpDen = norm_l( Lden );
den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16
- num = div_s( num, den ); // 15+ExpNum-ExpDen
- Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15
-#ifdef ISSUE_1799_replace_L_shr_o
+ num = div_s( num, den ); // 15+ExpNum-ExpDen
+ Ltmp1 = Mult_32_16( non_sta, num ); // 15+ExpNum-ExpDen+10-15
non_sta = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */
-#else
- non_sta = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */
-#endif
}
/* st->ave_enr[i] = alpha * st->ave_enr[i] + (1-alpha) * enr[i];*/ /* update long-term average */
@@ -2740,13 +2790,9 @@ void noise_est_ivas_fx(
ExpDen = norm_l( Lden );
den = extract_h( L_shl( Lden, ExpDen ) ); // q_enr+ExpDen-16
- num = div_s( num, den ); // 15+ExpNum-ExpDen
- Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15
-#ifdef ISSUE_1799_replace_L_shr_o
+ num = div_s( num, den ); // 15+ExpNum-ExpDen
+ Ltmp1 = Mult_32_16( Lnon_sta2, num ); // 15+ExpNum-ExpDen+10-15
Lnon_sta2 = L_shr_sat( Ltmp1, sub( ExpNum, ExpDen ) ); /* Q10 */
-#else
- Lnon_sta2 = L_shr_o( Ltmp1, sub( ExpNum, ExpDen ), &Overflow ); /* Q10 */
-#endif
}
/* st_ave_enr2[i] = (float)alpha2 * st_ave_enr2[i] + (1.0f - alpha2) * (enr[i]) */
@@ -2796,7 +2842,11 @@ void noise_est_ivas_fx(
IF( LT_16( ini_frame, 100 ) )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, LN_E_MIN_PLUS_ONE_FX ) ) ); /* Q8 */
+#else
non_staB = add_o( non_staB, abs_s( sub( tmp_enr, LN_E_MIN_PLUS_ONE_FX ) ), &Overflow ); /* Q8 */
+#endif
}
ELSE /*ini_frame < 100*/
{
@@ -2818,7 +2868,11 @@ void noise_est_ivas_fx(
Ltmp1 = Mpy_32_16_1( Ltmp1, 22713 ); // Q15
tmp_floor = round_fx( L_shl( Ltmp1, 9 ) ); /* Q8 */
}
- non_staB = add_o( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ), &Overflow ); /* Q8 */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ non_staB = add_sat( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ) ); /* Q8 */
+#else
+ non_staB = add_o( non_staB, abs_s( sub( tmp_enr, tmp_floor ) ), &Overflow ); /* Q8 */
+#endif
}
}
diff --git a/lib_enc/noise_adjust_fx.c b/lib_enc/noise_adjust_fx.c
index 1a2e204aea8c14b96a983c05f1eb02cd3a29c09f..2a6ffd22e4b5d6edf7d35d75d4f6f2b865e523cf 100644
--- a/lib_enc/noise_adjust_fx.c
+++ b/lib_enc/noise_adjust_fx.c
@@ -1,27 +1,29 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "rom_com_fx.h" /* Static table prototypes */
-//#include "prot_fx.h" /* Function prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "rom_com.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*--------------------------------------------------------------------------*
* noise_adjust_fx()
*
* Calculate attenuation
*--------------------------------------------------------------------------*/
-Word16 noise_adjust_fx( /* o : index of noise attenuation Q0 */
- const Word16 *coeffs_norm, /* i : normalized coefficients Qx */
- const Word16 qx, /* i : Q value of coeffs_norm */
- const Word16 *bitalloc, /* i : bit allocation Q0 */
- const Word16 *sfm_start, /* i : band start Q0 */
- const Word16 *sfm_end, /* i : band end Q0 */
- const Word16 core_sfm /* i : index of the end band for core Q0 */
+/* o : index of noise attenuation Q0 */
+Word16 noise_adjust_fx(
+ const Word16 *coeffs_norm, /* i : normalized coefficients Qx */
+ const Word16 qx, /* i : Q value of coeffs_norm */
+ const Word16 *bitalloc, /* i : bit allocation Q0 */
+ const Word16 *sfm_start, /* i : band start Q0 */
+ const Word16 *sfm_end, /* i : band end Q0 */
+ const Word16 core_sfm /* i : index of the end band for core Q0 */
)
{
Word16 nf_idx, sfm, bin, num_coeffs;
diff --git a/lib_enc/normalizecoefs_fx.c b/lib_enc/normalizecoefs_fx.c
index ea394f54bd29ca2e04f9320d4a5196335a727b69..1dcf6b6e2fc71319aa587875835a7adfcf5ecf0f 100644
--- a/lib_enc/normalizecoefs_fx.c
+++ b/lib_enc/normalizecoefs_fx.c
@@ -29,9 +29,11 @@ void normalizecoefs_fx(
Word16 *pcoefs16;
Word32 *pcoefs;
Word16 subvec_start, subvec_end, num_coefs;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
pcoefs = coefs;
pcoefs16 = coefs_norm;
@@ -55,7 +57,11 @@ void normalizecoefs_fx(
*pcoefs = Mpy_32_16_1( *pcoefs, INV2POWHALF );
move32();
}
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *pcoefs16++ = round_fx_sat( L_shl_sat( *pcoefs++, 16 - k ) ); /* Q12 */
+#else
*pcoefs16++ = round_fx_o( L_shl_o( *pcoefs++, 16 - k, &Overflow ), &Overflow ); /* Q12 */
+#endif
move16();
}
}
diff --git a/lib_enc/peak_vq_enc_fx.c b/lib_enc/peak_vq_enc_fx.c
index dffab490016b224c5abeea742c81d24cf7d79e0b..bd87efb23cec3986c22e08e44636e0a08029e160 100644
--- a/lib_enc/peak_vq_enc_fx.c
+++ b/lib_enc/peak_vq_enc_fx.c
@@ -6,13 +6,12 @@
#include
#include "options.h" /* Compilation switches */
#include "cnst.h" /* Common constants */
-//#include "prot_fx.h"
#include "rom_enc.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*--------------------------------------------------------------------------
* Local function prototypes
*--------------------------------------------------------------------------*/
@@ -23,7 +22,7 @@ static Word16 sparse_code_pos_fx( const Word16 *inp, const Word16 length, Word16
static Word16 hvq_code_pos_ivas_fx( BSTR_ENC_HANDLE hBstr, const Word16 *inp, const Word16 length, const Word16 num_peaks );
static void quant_peaks_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle*/
const Word32 *vect_in, /* i : Target vector in Q12 */
Word32 *vect_out, /* i/o: Quantized vector in Q12 */
const Word32 *peak_gain, /* i : Peak gain vector in Q12 */
@@ -32,11 +31,14 @@ static void quant_peaks_ivas_fx(
const Word32 core_brate, /* i : Core bitrate */
const Word16 Npeaks /* i : Number of peaks */
);
+
+
/*--------------------------------------------------------------------------
* peak_vq_enc_fx()
*
* Vector Quantization of MDCT peaks
*--------------------------------------------------------------------------*/
+
Word16 peak_vq_enc_ivas_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 bwidth, /* i : audio bandwidth */
diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c
index 8eea1b3d52b398655e3a8b03fc5a76262f006ed9..be35a5a1262b8e617f4adc3e0bbfb8ec2823e6d3 100644
--- a/lib_enc/pit_enc_fx.c
+++ b/lib_enc/pit_enc_fx.c
@@ -1,19 +1,19 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "rom_enc.h" /* Encoder static table prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "rom_com.h" /* Static table prototypes */
-//#include "prot_fx.h" /* Function prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "rom_enc.h" /* Encoder static table prototypes */
+#include "rom_com.h" /* Static table prototypes */
#include "rom_basop_util.h"
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
#define inv_T0_res InvIntTable
static void limit_T0_voiced2( Word16 res, const Word16 *T_op, Word16 *T0_min, Word16 *T0_min_frac, Word16 *T0_max, Word16 *T0_max_frac, Word16 pit_min, Word16 pit_max, Word16 i_subfr );
@@ -26,450 +26,63 @@ static void limit_T0_voiced2( Word16 res, const Word16 *T_op, Word16 *T0_min, Wo
/*------------------------------------------------------------------------------*/
/* INPUT ARGUMENTS : */
/* _ (Word16) core_brate: core bitrate Q0 */
-/* _ (Word16) Opt_AMR_WB: flag indicating AMR-WB IO mode Q0 */
-/* _ (Word16) bwidth : input signal bandwidth Q0 */
-/* _ (Word16[]) T_op : open loop pitch estimates in current frame Q0 */
-/* _ (Word16) T0_min : lower limit for close-loop search Q0 */
-/* _ (Word16) T0_max : higher limit for close-loop search Q0 */
-/* _ (Word16) T0 : close loop integer pitch Q0 */
-/* _ (Word16) T0_frac : close loop fractional part of the pitch Q0 */
-/* _ (Word16) L_frame_fx : length of the frame Q0 */
-/* _ (Word16[]) h1 : weighted filter input response Q15 */
-/* _ (Word16[]) xn : target vector Q_new */
-/* _ (Word16) coder_type : coding type Q0 */
-/* _ (Word16) i_subfr : current sub frame indicator Q0 */
-/* _ (Word16[]) exc_fx : pointer to excitation signal frame Q_new */
-/* _ (Word16[]) L_subfr : subframe length Q0 */
-/*------------------------------------------------------------------------------*/
-/* OUTPUT ARGUMENTS : */
-/* _ (Word16[]) exc_fx : adapt. excitation exc (Q0) */
-/* _ (Word16) T0_min : lower limit for close-loop search Q0 */
-/* _ (Word16) T0_max : higher limit for close-loop search Q0 */
-/* _ (Word16) T0 : close loop integer pitch Q0 */
-/* _ (Word16) T0_frac : close loop fractional part of the pitch Q0 */
-/*------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------*/
-/* RETURN ARGUMENTS : */
-/* _ None */
-/*==============================================================================*/
-
-Word16 pit_encode_fx( /* o : Fractional pitch for each subframe */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 pitch_bits[], /* i : pitch bits */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
- Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
- const Word16 i_subfr, /* i : subframe index */
- Word16 *exc, /* i/o: pointer to excitation signal frame */
- const Word16 L_subfr, /* i : subframe length */
- const Word16 *pitch, /* i : open loop pitch estimates in current frame */
- Word16 *T0_min, /* i/o: lower limit for close-loop search */
- Word16 *T0_max, /* i/o: higher limit for close-loop search */
- Word16 *T0, /* i/o: close loop integer pitch */
- Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */
- const Word16 *h1, /* i : weighted filter input response */
- const Word16 *xn, /* i : target vector */
- const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
- const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
-)
-{
- Word16 pitch_cl;
- Word16 pit_flag, delta, mult_Top, nBits;
- Word16 L_sufr_sft;
- Word16 T_op[2]; /* values for two half-frames */
- (void) tdm_Pitch_reuse_flag;
-
- L_sufr_sft = 6;
- move16();
- if ( EQ_16( L_subfr, 2 * L_SUBFR ) )
- {
- L_sufr_sft = 7;
- move16();
- }
-
- /*----------------------------------------------------------------*
- * convert pitch values to 16kHz domain
- *----------------------------------------------------------------*/
- test();
- test();
- IF( EQ_16( L_frame, L_FRAME ) || ( tdm_Pri_pitch_buf != NULL && tdm_Pri_pitch_buf[0] < 0 ) )
- {
- Copy( pitch, T_op, 2 );
- }
- ELSE /* L_frame == L_FRAME16k */
- {
- /*T_op[0] = (int16_t)(pitch[0] * 1.25f + 0.5f);
- T_op[1] = (int16_t)(pitch[1] * 1.25f + 0.5f);*/
- T_op[0] = shr( add( round_fx( L_shl( L_mult( 20480, pitch[0] ), 2 ) ), 1 ), 1 );
- move16();
- T_op[1] = shr( add( round_fx( L_shl( L_mult( 20480, pitch[1] ), 2 ) ), 1 ), 1 );
- move16();
- }
-
- /*----------------------------------------------------------------*
- * Set pit_flag to 0 for every subframe with absolute pitch search
- *----------------------------------------------------------------*/
- pit_flag = i_subfr;
- move16();
- if ( EQ_16( i_subfr, 2 * L_SUBFR ) )
- {
- pit_flag = 0;
- move16();
- }
-
- /*-----------------------------------------------------------------*
- * Limit range of pitch search
- * Fractional pitch search
- * Pitch quantization
- *-----------------------------------------------------------------*/
- mult_Top = 1;
- move16();
-
- IF( !Opt_AMR_WB )
- {
- /*----------------------------------------------------------------*
- * pitch Q: Set limit_flag to 0 for restrained limits, and 1 for extended limits
- *----------------------------------------------------------------*/
- test();
- test();
- IF( i_subfr == 0 )
- {
- *limit_flag = 1;
- move16();
- if ( EQ_16( coder_type, VOICED ) )
- {
- *limit_flag = 2;
- move16(); /* double-extended limits */
- }
- test();
- if ( EQ_16( coder_type, GENERIC ) && EQ_32( core_brate, ACELP_7k20 ) )
- {
- *limit_flag = 0;
- move16();
- }
- }
- ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) && EQ_16( coder_type, GENERIC ) && LE_32( core_brate, ACELP_13k20 ) )
- {
- /*if( *T0 > (PIT_FR1_EXTEND_8b + PIT_MIN)>>1 )*/
- if ( GT_16( *T0, shr( add( PIT_FR1_EXTEND_8b, PIT_MIN ), 1 ) ) )
- {
- *limit_flag = 0;
- move16();
- }
- }
-
- IF( *limit_flag == 0 )
- {
- test();
- test();
- IF( i_subfr == 0 && LT_16( T_op[0], PIT_MIN ) )
- {
- mult_Top = 2;
- move16();
- }
- ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) && LT_16( T_op[1], PIT_MIN ) )
- {
- mult_Top = 2;
- move16();
- }
- }
- /*-------------------------------------------------------*
- * Retrieve the number of Q bits
- *-------------------------------------------------------*/
- nBits = 0;
- move16();
- IF( NE_16( coder_type, AUDIO ) )
- {
- nBits = pitch_bits[i_subfr >> L_sufr_sft];
- move16();
- }
- IF( EQ_16( coder_type, AUDIO ) )
- {
- /*-------------------------------------------------------*
- * Pitch encoding in AUDIO coder type
- * (both ACELP@12k8 and ACELP@16k cores)
- *-------------------------------------------------------*/
-
- delta = 4;
- move16();
- test();
- test();
- if ( EQ_16( L_subfr, shr( L_frame, 1 ) ) && i_subfr != 0 && EQ_16( L_frame, L_FRAME ) )
- {
- pit_flag = L_SUBFR;
- move16();
- }
- IF( pit_flag == 0 )
- {
- nBits = 10;
- move16();
- }
- ELSE
- {
- nBits = 6;
- move16();
- }
-
- /* pitch lag search limitation */
- test();
- IF( i_subfr == 0 )
- {
- limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[0], 0, T0_min, T0_max );
- }
- ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) && pit_flag == 0 )
- {
- limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[1], 0, T0_min, T0_max );
- }
-
- /* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_subfr );
- move16();
- pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
- }
- ELSE IF( EQ_16( coder_type, VOICED ) )
- {
- /*-------------------------------------------------------*
- * Pitch encoding in VOICED code type (ACELP@12k8 core only)
- *-------------------------------------------------------*/
-
- delta = 4;
- move16();
- if ( EQ_16( i_subfr, 2 * L_SUBFR ) )
- {
- pit_flag = i_subfr;
- move16();
- }
-
- /* pitch lag search limitation */
- IF( i_subfr == 0 )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, mult_Top * T_op[0], 0, T0_min, T0_max );
- }
-
- /* search and encode the closed loop pitch period */
-
- test();
- IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 5 ) )
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_DOUBLEEXTEND_9b, PIT_FR1_DOUBLEEXTEND_9b, L_FRAME, L_SUBFR );
- move16();
- }
- ELSE IF( EQ_16( nBits, 10 ) )
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR );
- move16();
- }
-
- pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
- }
- ELSE
- {
- /*-------------------------------------------------------*
- * Pitch encoding in GENERIC coder type
- * (both ACELP@12k8 and ACELP@16k cores)
- *-------------------------------------------------------*/
-
- delta = 8;
- move16();
-
- /* pitch lag search limitation */
- IF( i_subfr == 0 )
- {
- limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[0], 0, T0_min, T0_max );
- }
- ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) )
- {
- limit_T0_fx( L_frame, delta, pit_flag, *limit_flag, mult_Top * T_op[1], 0, T0_min, T0_max );
- }
-
- /* search and encode the closed loop pitch period */
- IF( EQ_16( L_frame, L_FRAME ) )
- {
- test();
- test();
- IF( EQ_16( nBits, 8 ) || EQ_16( nBits, 5 ) )
- {
- IF( *limit_flag == 0 )
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR );
- move16();
- }
- ELSE
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN_EXTEND, PIT_FR1_EXTEND_8b, L_FRAME, L_SUBFR );
- move16();
- }
- }
- ELSE IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 6 ) )
- {
- IF( *limit_flag == 0 )
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR );
- move16();
- }
- ELSE
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_EXTEND_9b, PIT_FR1_EXTEND_9b, L_FRAME, L_SUBFR );
- move16();
- }
- }
- ELSE IF( EQ_16( nBits, 10 ) )
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR );
- move16();
- }
-
- pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
- }
- ELSE /* L_frame == L_FRAME16k */
- {
- test();
- IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 6 ) )
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, L_FRAME16k, L_SUBFR );
- move16();
- }
- ELSE IF( EQ_16( nBits, 10 ) )
- {
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR );
- move16();
- }
-
- pit16k_Q_enc_fx( hBstr, nBits, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
- }
- }
- }
-
- /*-------------------------------------------------------*
- * Pitch encoding in AMR-WB IO mode
- *-------------------------------------------------------*/
-
- ELSE
- {
- delta = 8;
- move16();
- *limit_flag = 0;
- move16();
-
- IF( EQ_32( core_brate, ACELP_6k60 ) )
- {
- nBits = 5;
- move16();
-
- /* pitch lag search limitation */
- IF( i_subfr == 0 )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[0] ), 0, T0_min, T0_max );
- nBits = 8;
- move16();
- }
-
- if ( EQ_16( i_subfr, 2 * L_SUBFR ) )
- {
- /* rewrite pit_flag - it must not be zero */
- pit_flag = i_subfr;
- move16();
- }
-
- /* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR );
- move16();
- }
- ELSE IF( EQ_32( core_brate, ACELP_8k85 ) )
- {
- nBits = 5;
- move16();
-
- /* pitch lag search limitation */
- IF( i_subfr == 0 )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[0] ), 0, T0_min, T0_max );
- nBits = 8;
- move16();
- }
- ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[1] ), 0, T0_min, T0_max );
- nBits = 8;
- move16();
- }
-
- /* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR );
- move16();
- }
- ELSE
- {
- nBits = 6;
- move16();
-
- /* pitch lag search limitation */
- IF( i_subfr == 0 )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[0] ), 0, T0_min, T0_max );
- nBits = 9;
- move16();
- }
- ELSE IF( EQ_16( i_subfr, 2 * L_SUBFR ) )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, i_mult2( mult_Top, T_op[1] ), 0, T0_min, T0_max );
- nBits = 9;
- move16();
- }
- ELSE
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, 0, *T0, 0, T0_min, T0_max ); /* T0_frac==0 to keep IO with AMR-WB */
- }
-
- /* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR );
- move16();
- }
-
- pit_Q_enc_fx( hBstr, 1, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
- }
-
- /*-------------------------------------------------------*
- * Compute floating pitch output
- *-------------------------------------------------------*/
-
- /*pitch = (float)(*T0) + (float)(*T0_frac)/4.0f;*/ /* save subframe pitch values */
- pitch_cl = shl( add( shl( *T0, 2 ), *T0_frac ), 4 ); /* save subframe pitch values Q6 */
+/* _ (Word16) Opt_AMR_WB: flag indicating AMR-WB IO mode Q0 */
+/* _ (Word16) bwidth : input signal bandwidth Q0 */
+/* _ (Word16[]) T_op : open loop pitch estimates in current frame Q0 */
+/* _ (Word16) T0_min : lower limit for close-loop search Q0 */
+/* _ (Word16) T0_max : higher limit for close-loop search Q0 */
+/* _ (Word16) T0 : close loop integer pitch Q0 */
+/* _ (Word16) T0_frac : close loop fractional part of the pitch Q0 */
+/* _ (Word16) L_frame_fx : length of the frame Q0 */
+/* _ (Word16[]) h1 : weighted filter input response Q15 */
+/* _ (Word16[]) xn : target vector Q_new */
+/* _ (Word16) coder_type : coding type Q0 */
+/* _ (Word16) i_subfr : current sub frame indicator Q0 */
+/* _ (Word16[]) exc_fx : pointer to excitation signal frame Q_new */
+/* _ (Word16[]) L_subfr : subframe length Q0 */
+/*------------------------------------------------------------------------------*/
+/* OUTPUT ARGUMENTS : */
+/* _ (Word16[]) exc_fx : adapt. excitation exc (Q0) */
+/* _ (Word16) T0_min : lower limit for close-loop search Q0 */
+/* _ (Word16) T0_max : higher limit for close-loop search Q0 */
+/* _ (Word16) T0 : close loop integer pitch Q0 */
+/* _ (Word16) T0_frac : close loop fractional part of the pitch Q0 */
+/*------------------------------------------------------------------------------*/
- return pitch_cl;
-}
+/*------------------------------------------------------------------------------*/
+/* RETURN ARGUMENTS : */
+/* _ None */
+/*==============================================================================*/
-Word16 pit_encode_ivas_fx( /* o : Fractional pitch for each subframe */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 pitch_bits[], /* i : pitch bits */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
- Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
- const Word16 i_subfr, /* i : subframe index */
- Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */
- const Word16 L_subfr, /* i : subframe length */
- const Word16 *pitch, /* i : open loop pitch estimates in current frame */
- Word16 *T0_min, /* i/o: lower limit for close-loop search */
- Word16 *T0_max, /* i/o: higher limit for close-loop search */
- Word16 *T0, /* i/o: close loop integer pitch */
- Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */
- const Word16 *h1, /* i : weighted filter input response Q(14 - norm_s(h1[0]) */
- const Word16 *xn, /* i : target vector Q_new */
- const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
- const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */
- Word16 Q_new /* i */
+/* o : Fractional pitch for each subframe */
+Word16 pit_encode_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 pitch_bits[], /* i : pitch bits */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 coder_type, /* i : coding type */
+ Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
+ const Word16 i_subfr, /* i : subframe index */
+ Word16 *exc, /* i/o: pointer to excitation signal frame */
+ const Word16 L_subfr, /* i : subframe length */
+ const Word16 *pitch, /* i : open loop pitch estimates in current frame */
+ Word16 *T0_min, /* i/o: lower limit for close-loop search */
+ Word16 *T0_max, /* i/o: higher limit for close-loop search */
+ Word16 *T0, /* i/o: close loop integer pitch */
+ Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */
+ const Word16 *h1, /* i : weighted filter input response */
+ const Word16 *xn, /* i : target vector */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */
+ const Word16 element_mode, /* i : mode element */
+ const Word16 Q_new /* i : scaling factor */
)
{
Word16 pitch_cl;
Word16 pit_flag, delta, mult_Top, nBits;
Word16 L_sufr_sft;
Word16 T_op[2]; /* values for two half-frames */
-
L_sufr_sft = 6;
move16();
if ( EQ_16( L_subfr, 2 * L_SUBFR ) )
@@ -500,6 +113,7 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
/*----------------------------------------------------------------*
* Set pit_flag to 0 for every subframe with absolute pitch search
*----------------------------------------------------------------*/
+
pit_flag = i_subfr;
move16();
if ( EQ_16( i_subfr, 2 * L_SUBFR ) )
@@ -513,6 +127,7 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
* Fractional pitch search
* Pitch quantization
*-----------------------------------------------------------------*/
+
mult_Top = 1;
move16();
@@ -564,16 +179,18 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
move16();
}
}
+
/*-------------------------------------------------------*
* Retrieve the number of Q bits
*-------------------------------------------------------*/
+
nBits = 0;
move16();
IF( NE_16( coder_type, AUDIO ) )
{
nBits = pitch_bits[i_subfr >> L_sufr_sft];
+ move16();
}
- test();
IF( EQ_16( coder_type, AUDIO ) )
{
/*-------------------------------------------------------*
@@ -613,9 +230,10 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
}
/* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_subfr, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_subfr, element_mode, Q_new );
move16();
- pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
+
+ pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
}
ELSE IF( EQ_16( coder_type, VOICED ) )
{
@@ -638,19 +256,20 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
}
/* search and encode the closed loop pitch period */
+
test();
IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 5 ) )
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_DOUBLEEXTEND_9b, PIT_FR1_DOUBLEEXTEND_9b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_DOUBLEEXTEND_9b, PIT_FR1_DOUBLEEXTEND_9b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
ELSE IF( EQ_16( nBits, 10 ) )
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
- pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
+ pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
}
ELSE IF( EQ_16( tdm_Pitch_reuse_flag, 1 ) || EQ_16( nBits, 4 ) )
{
@@ -683,17 +302,20 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
/* pitch lag search limitation */
limit_T0_fx( L_FRAME, delta, pit_flag, *limit_flag, loc_T0, loc_frac, T0_min, T0_max );
+
IF( nBits > 0 )
{
/* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
+
IF( EQ_16( delta, 8 ) )
{
*T0_frac = 0;
move16();
}
- pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
+
+ pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
}
ELSE
{
@@ -732,12 +354,12 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
{
IF( *limit_flag == 0 )
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
ELSE
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN_EXTEND, PIT_FR1_EXTEND_8b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN_EXTEND, PIT_FR1_EXTEND_8b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
}
@@ -745,37 +367,38 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
{
IF( *limit_flag == 0 )
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
ELSE
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_EXTEND_9b, PIT_FR1_EXTEND_9b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_EXTEND_9b, PIT_FR1_EXTEND_9b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
}
ELSE IF( EQ_16( nBits, 10 ) )
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MAX, PIT_MAX, L_FRAME, L_SUBFR, element_mode, Q_new );
+ move16();
}
- pit_Q_enc_ivas_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
+ pit_Q_enc_fx( hBstr, 0, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
}
ELSE /* L_frame == L_FRAME16k */
{
test();
IF( EQ_16( nBits, 9 ) || EQ_16( nBits, 6 ) )
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, L_FRAME16k, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_9b, PIT16k_FR1_EXTEND_9b, L_FRAME16k, L_SUBFR, element_mode, Q_new );
move16();
}
ELSE IF( EQ_16( nBits, 10 ) )
{
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT16k_FR2_EXTEND_10b, PIT16k_MAX, L_FRAME16k, L_SUBFR, element_mode, Q_new );
move16();
}
- pit16k_Q_enc_ivas_fx( hBstr, nBits, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
+ pit16k_Q_enc_fx( hBstr, nBits, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
}
}
}
@@ -812,7 +435,7 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
}
/* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
ELSE IF( EQ_32( core_brate, ACELP_8k85 ) )
@@ -835,7 +458,7 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
}
/* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
ELSE
@@ -862,11 +485,11 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
}
/* search and encode the closed loop pitch period */
- *T0 = pitch_fr4_ivas_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, Q_new );
+ *T0 = pitch_fr4_fx( &exc[i_subfr], xn, h1, *T0_min, *T0_max, T0_frac, pit_flag, *limit_flag, PIT_FR2_9b, PIT_FR1_9b, L_FRAME, L_SUBFR, element_mode, Q_new );
move16();
}
- pit_Q_enc_ivas_fx( hBstr, 1, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
+ pit_Q_enc_fx( hBstr, 1, nBits, delta, pit_flag, *limit_flag, *T0, *T0_frac, T0_min, T0_max );
}
/*-------------------------------------------------------*
@@ -879,6 +502,7 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
return pitch_cl;
}
+
/*-------------------------------------------------------------------*
* abs_pit_enc()
*
@@ -888,11 +512,12 @@ Word16 pit_encode_ivas_fx( /* o : Fractional
* fr_step = 4: pitch range encoded with 8 bits
*-------------------------------------------------------------------*/
-Word16 abs_pit_enc_fx( /* o : pitch index */
- const Word16 fr_steps, /* i : fractional resolution steps (2 or 4) for shortest pitches*/
- const Word16 limit_flag, /* i : restrained(0) or extended(1) limits */
- const Word16 T0, /* i : integer pitch lag */
- const Word16 T0_frac /* i : pitch fraction */
+/* o : pitch index */
+Word16 abs_pit_enc_fx(
+ const Word16 fr_steps, /* i : fractional resolution steps (2 or 4) for shortest pitches*/
+ const Word16 limit_flag, /* i : restrained(0) or extended(1) limits */
+ const Word16 T0, /* i : integer pitch lag */
+ const Word16 T0_frac /* i : pitch fraction */
)
{
Word16 pitch_index = 0;
@@ -1041,280 +666,93 @@ Word16 abs_pit_enc_fx( /* o : pitch index
IF( LT_16( T0, PIT_FR2_DOUBLEEXTEND_9b ) )
{
- /*pitch_index = T0*4 + T0_frac - (PIT_MIN_DOUBLEEXTEND*4);*/
- pitch_index = add( shl( T0, 2 ), sub( T0_frac, ( PIT_MIN_DOUBLEEXTEND * 4 ) ) );
- }
- ELSE IF( LT_16( T0, PIT_FR1_DOUBLEEXTEND_9b ) )
- {
- /*pitch_index = T0*2 + (T0_frac>>1) - (PIT_FR2_DOUBLEEXTEND_9b*2) + ((PIT_FR2_DOUBLEEXTEND_9b-PIT_MIN_DOUBLEEXTEND)*4);*/
- pitch_index = add( sub( add( shl( T0, 1 ), shr( T0_frac, 1 ) ), ( PIT_FR2_DOUBLEEXTEND_9b * 2 ) ), ( ( PIT_FR2_DOUBLEEXTEND_9b - PIT_MIN_DOUBLEEXTEND ) * 4 ) );
- }
- ELSE
- {
- /*pitch_index = T0 - PIT_FR1_DOUBLEEXTEND_9b + ((PIT_FR2_DOUBLEEXTEND_9b-PIT_MIN_DOUBLEEXTEND)*4) + ((PIT_FR1_DOUBLEEXTEND_9b-PIT_FR2_DOUBLEEXTEND_9b)*2);*/
- pitch_index = add( add( sub( T0, PIT_FR1_DOUBLEEXTEND_9b ), ( ( PIT_FR2_DOUBLEEXTEND_9b - PIT_MIN_DOUBLEEXTEND ) * 4 ) ), ( ( PIT_FR1_DOUBLEEXTEND_9b - PIT_FR2_DOUBLEEXTEND_9b ) * 2 ) );
- }
- }
- ELSE /* fr_step == 0 */
- {
- /* not used in the codec */
- pitch_index = 0;
- move16();
- }
- }
-
- return pitch_index;
-}
-
-
-/*-------------------------------------------------------------------*
- * delta_pit_enc:
- *
- * Encode pitch lag differentially from T0_min to T0_max
- * with resolution depending on parameter 'fr_step':
- * fr_step = 0: resolusion 1 (frac = 0), or
- * fr_step = 2: resolusion 1/2 (frac = 0 or 2), or
- * fr_step = 4: resolution 1/4 (frac = 0, 1, 2, or 3)
- *-------------------------------------------------------------------*/
-
-Word16 delta_pit_enc_fx( /* o : pitch index */
- const Word16 fr_steps, /* i : fractional resolution steps (2 or 4)*/
- const Word16 T0, /* i : integer pitch lag */
- const Word16 T0_frac, /* i : pitch fraction */
- const Word16 T0_min /* i : delta search min */
-)
-{
- Word16 pitch_index = 0;
- move16();
-
- IF( fr_steps == 0 )
- {
- pitch_index = sub( T0, T0_min );
- }
- ELSE IF( EQ_16( fr_steps, 2 ) )
- {
- /* pitch_index = (T0 - T0_min) * 2 + (T0_frac>>1);*/
- pitch_index = add( shl( sub( T0, T0_min ), 1 ), shr( T0_frac, 1 ) );
- }
- ELSE IF( EQ_16( fr_steps, 4 ) )
- {
- /*pitch_index = (T0 - T0_min) * 4 + T0_frac;*/
- pitch_index = add( shl( sub( T0, T0_min ), 2 ), T0_frac );
- }
-
- return pitch_index;
-}
-
-/*-------------------------------------------------------------------*
- * pitch_fr4()
- *
- * Find the closed loop pitch period with 1/4 subsample resolution.
- *-------------------------------------------------------------------*/
-Word16 pitch_fr4_ivas_fx( /* o : chosen integer pitch lag */
- const Word16 exc[], /* i : excitation buffer Q_new */
- const Word16 xn[], /* i : target signal Q_new-1 */
- const Word16 h[], /* i : weighted synthesis filter impulse response Q(14 - norm_s[h[0]) */
- const Word16 t0_min, /* i : minimum value in the searched range. Q0 */
- const Word16 t0_max, /* i : maximum value in the searched range. Q0 */
- Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */
- const Word16 i_subfr, /* i : flag to first subframe */
- const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */
- const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */
- const Word16 t0_fr1, /* i : minimum value for resolution 1 */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 L_subfr, /* i : size of subframe */
- Word16 Q_new /* i */
-)
-{
- Word16 i;
- Word16 t_min, t_max;
- Word16 max_val, t0, t1, fraction, step, temp;
- Word16 *corr;
- Word16 corr_v[15 + 2 * L_INTERPOL1 + 1]; /* Total length = t0_max-t0_min+1+2*L_inter */
- Word16 pit_min;
- Word16 cor_max;
-
- /* initialization */
- IF( limit_flag == 0 )
- {
- IF( EQ_16( L_frame, L_FRAME ) )
- {
- pit_min = PIT_MIN;
- move16();
- }
- ELSE /* L_frame == L_FRAME16k */
- {
- pit_min = PIT16k_MIN;
- move16();
- }
- }
- ELSE
- {
- IF( EQ_16( L_frame, L_FRAME ) )
- {
- pit_min = PIT_MIN_EXTEND;
- move16();
- IF( EQ_16( limit_flag, 2 ) )
- {
- pit_min = PIT_MIN_DOUBLEEXTEND;
- move16();
- }
- }
- ELSE /* L_frame == L_FRAME16k */
- {
- pit_min = PIT16k_MIN_EXTEND;
- move16();
- }
- }
-
- /*-----------------------------------------------------------------*
- * - Find interval to compute normalized correlation
- * - allocate memory to normalized correlation vector
- * - Compute normalized correlation between target and filtered
- * excitation
- *-----------------------------------------------------------------*/
-
- t_min = sub( t0_min, L_INTERPOL1 );
- t_max = add( t0_max, L_INTERPOL1 );
- corr = &corr_v[-t_min];
- move16();
- move16(); /* corr[t_min..t_max] */
-
- norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr, L_subfr, Q_new );
-
- /*-----------------------------------------------------------------*
- * Find integer pitch
- *-----------------------------------------------------------------*/
-
- max_val = corr[t0_min];
- move16();
- t0 = t0_min;
- move16();
-
- FOR( i = add( t0_min, 1 ); i <= t0_max; i++ )
- {
- if ( GE_16( corr[i], max_val ) )
- {
- t0 = i;
- move16();
- }
- max_val = s_max( corr[i], max_val );
- }
-
- IF( EQ_16( t0_fr1, pit_min ) )
- {
- /* don't search fraction (for 7b/4b quant) */
- test();
- IF( ( i_subfr == 0 ) && ( GE_16( t0, t0_fr2 ) ) )
- {
- i = shl( shr( t0, 1 ), 1 ); /* 2 samples resolution */
- if ( GT_16( add( i, 2 ), PIT_MAX ) )
- {
- i = sub( i, 2 );
- }
- IF( GT_16( corr[i], corr[i + 2] ) )
- {
- t0 = i;
- move16();
- }
- ELSE
- {
- t0 = add( i, 2 );
- }
- }
- *pit_frac = 0;
- move16();
-
- return ( t0 );
- }
-
- test();
- IF( ( i_subfr == 0 ) && ( GE_16( t0, t0_fr1 ) ) )
- {
- *pit_frac = 0;
- move16();
-
- return ( t0 );
- }
-
- /*------------------------------------------------------------------*
- * Search fractionnal pitch with 1/4 subsample resolution.
- * search the fractions around t0 and choose the one which maximizes
- * the interpolated normalized correlation.
- *-----------------------------------------------------------------*/
-
- t1 = t0;
- move16();
- step = 1;
- move16(); /* 1/4 subsample resolution */
- fraction = 1;
- move16();
- test();
- test();
- IF( ( ( i_subfr == 0 ) && ( GE_16( t0, t0_fr2 ) ) ) || ( EQ_16( t0_fr2, pit_min ) ) )
- {
- step = 2;
- move16(); /* 1/2 subsample resolution */
- fraction = 2;
- move16();
- }
-
- IF( EQ_16( t0, t0_min ) ) /* Limit case */
- {
- fraction = 0;
- move16();
- cor_max = Interpol_4( &corr[t0], fraction );
- }
- ELSE
- {
- t0 = sub( t0, 1 );
- cor_max = Interpol_4( &corr[t0], fraction );
- FOR( i = add( fraction, step ); i <= 3; i = (Word16) ( i + step ) )
- {
- temp = Interpol_4( &corr[t0], i );
- IF( GT_16( temp, cor_max ) )
+ /*pitch_index = T0*4 + T0_frac - (PIT_MIN_DOUBLEEXTEND*4);*/
+ pitch_index = add( shl( T0, 2 ), sub( T0_frac, ( PIT_MIN_DOUBLEEXTEND * 4 ) ) );
+ }
+ ELSE IF( LT_16( T0, PIT_FR1_DOUBLEEXTEND_9b ) )
{
- cor_max = temp;
- move16();
- fraction = i;
- move16();
+ /*pitch_index = T0*2 + (T0_frac>>1) - (PIT_FR2_DOUBLEEXTEND_9b*2) + ((PIT_FR2_DOUBLEEXTEND_9b-PIT_MIN_DOUBLEEXTEND)*4);*/
+ pitch_index = add( sub( add( shl( T0, 1 ), shr( T0_frac, 1 ) ), ( PIT_FR2_DOUBLEEXTEND_9b * 2 ) ), ( ( PIT_FR2_DOUBLEEXTEND_9b - PIT_MIN_DOUBLEEXTEND ) * 4 ) );
+ }
+ ELSE
+ {
+ /*pitch_index = T0 - PIT_FR1_DOUBLEEXTEND_9b + ((PIT_FR2_DOUBLEEXTEND_9b-PIT_MIN_DOUBLEEXTEND)*4) + ((PIT_FR1_DOUBLEEXTEND_9b-PIT_FR2_DOUBLEEXTEND_9b)*2);*/
+ pitch_index = add( add( sub( T0, PIT_FR1_DOUBLEEXTEND_9b ), ( ( PIT_FR2_DOUBLEEXTEND_9b - PIT_MIN_DOUBLEEXTEND ) * 4 ) ), ( ( PIT_FR1_DOUBLEEXTEND_9b - PIT_FR2_DOUBLEEXTEND_9b ) * 2 ) );
}
}
- }
-
- FOR( i = 0; i <= 3; i = (Word16) ( i + step ) )
- {
- temp = Interpol_4( &corr[t1], i );
- IF( GT_16( temp, cor_max ) )
+ ELSE /* fr_step == 0 */
{
- cor_max = temp;
- move16();
- fraction = i;
- move16();
- t0 = t1;
+ /* not used in the codec */
+ pitch_index = 0;
move16();
}
}
- *pit_frac = fraction;
+ return pitch_index;
+}
+
+
+/*-------------------------------------------------------------------*
+ * delta_pit_enc:
+ *
+ * Encode pitch lag differentially from T0_min to T0_max
+ * with resolution depending on parameter 'fr_step':
+ * fr_step = 0: resolusion 1 (frac = 0), or
+ * fr_step = 2: resolusion 1/2 (frac = 0 or 2), or
+ * fr_step = 4: resolution 1/4 (frac = 0, 1, 2, or 3)
+ *-------------------------------------------------------------------*/
+
+/* o : pitch index */
+Word16 delta_pit_enc_fx(
+ const Word16 fr_steps, /* i : fractional resolution steps (2 or 4)*/
+ const Word16 T0, /* i : integer pitch lag */
+ const Word16 T0_frac, /* i : pitch fraction */
+ const Word16 T0_min /* i : delta search min */
+)
+{
+ Word16 pitch_index = 0;
move16();
- return ( t0 );
+ IF( fr_steps == 0 )
+ {
+ pitch_index = sub( T0, T0_min );
+ }
+ ELSE IF( EQ_16( fr_steps, 2 ) )
+ {
+ /* pitch_index = (T0 - T0_min) * 2 + (T0_frac>>1);*/
+ pitch_index = add( shl( sub( T0, T0_min ), 1 ), shr( T0_frac, 1 ) );
+ }
+ ELSE IF( EQ_16( fr_steps, 4 ) )
+ {
+ /*pitch_index = (T0 - T0_min) * 4 + T0_frac;*/
+ pitch_index = add( shl( sub( T0, T0_min ), 2 ), T0_frac );
+ }
+
+ return pitch_index;
}
-Word16 pitch_fr4_fx( /* o : chosen integer pitch lag */
- const Word16 exc[], /* i : excitation buffer Q_new*/
- const Word16 xn[], /* i : target signal Q_new-1+shift*/
- const Word16 h[], /* i : weighted synthesis filter impulse response Q(14+shift)*/
- const Word16 t0_min, /* i : minimum value in the searched range. Q0*/
- const Word16 t0_max, /* i : maximum value in the searched range. Q0*/
- Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */
- const Word16 i_subfr, /* i : flag to first subframe */
- const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */
- const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */
- const Word16 t0_fr1, /* i : minimum value for resolution 1 */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 L_subfr /* i : size of subframe */
+/*-------------------------------------------------------------------*
+ * pitch_fr4()
+ *
+ * Find the closed loop pitch period with 1/4 subsample resolution.
+ *-------------------------------------------------------------------*/
+
+/* o : chosen integer pitch lag */
+Word16 pitch_fr4_fx(
+ const Word16 exc[], /* i : excitation buffer Q_new*/
+ const Word16 xn[], /* i : target signal Q_new-1+shift*/
+ const Word16 h[], /* i : weighted synthesis filter impulse response Q(14+shift)*/
+ const Word16 t0_min, /* i : minimum value in the searched range. Q0*/
+ const Word16 t0_max, /* i : maximum value in the searched range. Q0*/
+ Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */
+ const Word16 i_subfr, /* i : flag to first subframe */
+ const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */
+ const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */
+ const Word16 t0_fr1, /* i : minimum value for resolution 1 */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 L_subfr, /* i : size of subframe */
+ const Word16 element_mode, /* i : mode element */
+ const Word16 Q_new /* i : scaling factor */
)
{
Word16 i;
@@ -1369,8 +807,14 @@ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag
t_max = add( t0_max, L_INTERPOL1 );
corr = &corr_v[-t_min];
/* corr[t_min..t_max] */
-
- norm_corr_fx( exc, xn, h, t_min, t_max, corr, L_subfr );
+ if ( element_mode > EVS_MONO )
+ {
+ norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr, L_subfr, Q_new );
+ }
+ else
+ {
+ norm_corr_fx( exc, xn, h, t_min, t_max, corr, L_subfr );
+ }
/*-----------------------------------------------------------------*
* Find integer pitch
@@ -1492,6 +936,7 @@ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag
return ( t0 );
}
+
/*-------------------------------------------------------------------*
* norm_corr()
*
@@ -1500,6 +945,7 @@ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag
* excitation divided by the square root of energy of filtered
* excitation)
*---------------------------------------------------------------------*/
+
void norm_corr_ivas_fx(
const Word16 exc[], /* i : excitation buffer Q_new */
const Word16 xn[], /* i : target signal Q_new-1 */
@@ -1518,13 +964,16 @@ void norm_corr_ivas_fx(
Word16 h_e, e_max;
Word32 L_tmp;
Word64 W_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
k = negate( t_min );
h_e = add( 1, norm_s( h[0] ) ); // exponent of h
+
/*-----------------------------------------------------------------*
* compute the filtered excitation for the first delay t_min
*-----------------------------------------------------------------*/
@@ -1542,7 +991,11 @@ void norm_corr_ivas_fx(
L_tmp = L_mac( 0, xn[0], excf[0] );
FOR( i = 1; i < L_subfr; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, xn[i], excf[i] ); // (Q_new - 1) + (Q_new - h_e) + 1
+#else
L_tmp = L_mac_o( L_tmp, xn[i], excf[i], &Overflow ); // (Q_new - 1) + (Q_new - h_e) + 1
+#endif
}
exp = norm_l( L_tmp );
L_tmp = L_shl( L_tmp, exp );
@@ -1613,9 +1066,11 @@ void norm_corr_fx(
Word16 corr, exp_corr, norm, exp_norm, exp, scale;
Word16 excf[L_FRAME16k];
Word32 L_tmp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
k = negate( t_min );
@@ -1627,10 +1082,18 @@ void norm_corr_fx(
conv_fx( &exc[k], h, excf, L_subfr );
/* Compute rounded down 1/sqrt(energy of xn[]) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( 1, xn[0], xn[0] );
+#else
L_tmp = L_mac_o( 1, xn[0], xn[0], &Overflow );
+#endif
FOR( i = 1; i < L_subfr; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, xn[i], xn[i] );
+#else
L_tmp = L_mac_o( L_tmp, xn[i], xn[i], &Overflow );
+#endif
}
exp = norm_l( L_tmp );
exp = sub( 30, exp );
@@ -1649,7 +1112,11 @@ void norm_corr_fx(
L_tmp = L_mac( 1, xn[0], excf[0] );
FOR( i = 1; i < L_subfr; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, xn[i], excf[i] );
+#else
L_tmp = L_mac_o( L_tmp, xn[i], excf[i], &Overflow );
+#endif
}
exp = norm_l( L_tmp );
L_tmp = L_shl( L_tmp, exp );
@@ -1660,7 +1127,11 @@ void norm_corr_fx(
L_tmp = L_mac( 1, excf[0], excf[0] );
FOR( i = 1; i < L_subfr; i++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ L_tmp = L_mac_sat( L_tmp, excf[i], excf[i] );
+#else
L_tmp = L_mac_o( L_tmp, excf[i], excf[i], &Overflow );
+#endif
}
exp = norm_l( L_tmp );
@@ -1694,6 +1165,7 @@ void norm_corr_fx(
return;
}
+
/*-------------------------------------------------------------------*
* pit_Q_enc()
*
@@ -1710,7 +1182,7 @@ void pit_Q_enc_fx(
const Word16 T0, /* i : integer pitch lag */
const Word16 T0_frac, /* i : pitch fraction */
Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* o : delta search max_val */
+ Word16 *T0_max /* o : delta search max_val */
)
{
Word16 pitch_index;
@@ -1793,98 +1265,6 @@ void pit_Q_enc_fx(
return;
}
-void pit_Q_enc_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 nBits, /* i : # of Q bits */
- const Word16 delta, /* i : Half the CL searched interval */
- const Word16 pit_flag, /* i : absolute(0) or delta(1) pitch Q */
- const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */
- const Word16 T0, /* i : integer pitch lag */
- const Word16 T0_frac, /* i : pitch fraction */
- Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* o : delta search max_val */
-)
-{
- Word16 pitch_index;
-
- IF( EQ_16( nBits, 10 ) ) /* absolute encoding with 10 bits */
- {
- IF( limit_flag == 0 )
- {
- /* pitch_index = T0*4 + T0_frac - (PIT_MIN*4);*/
- pitch_index = sub( add( shl( T0, 2 ), T0_frac ), ( PIT_MIN * 4 ) );
- }
- ELSE IF( EQ_16( limit_flag, 1 ) )
- {
- /*pitch_index = T0*4 + T0_frac - (PIT_MIN_EXTEND*4);*/
- pitch_index = sub( add( shl( T0, 2 ), T0_frac ), ( PIT_MIN_EXTEND * 4 ) );
- }
- ELSE /* limit_flag == 2 */
- {
- /*pitch_index = T0*4 + T0_frac - (PIT_MIN_DOUBLEEXTEND*4);*/
- pitch_index = sub( add( shl( T0, 2 ), T0_frac ), ( PIT_MIN_DOUBLEEXTEND * 4 ) );
- }
- }
- ELSE IF( EQ_16( nBits, 9 ) ) /* absolute encoding with 9 bits */
- {
- pitch_index = abs_pit_enc_fx( 4, limit_flag, T0, T0_frac );
-
- /* find T0_min and T0_max for delta search */
- IF( Opt_AMR_WB )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, 0, T0, 0, T0_min, T0_max ); /* T0_frac==0 to keep IO with AMR-WB */
- }
- }
- ELSE IF( EQ_16( nBits, 8 ) ) /* absolute encoding with 8 bits */
- {
- pitch_index = abs_pit_enc_fx( 2, limit_flag, T0, T0_frac );
-
- /* find T0_min and T0_max for delta search */
- IF( Opt_AMR_WB )
- {
- limit_T0_fx( L_FRAME, delta, pit_flag, 0, T0, 0, T0_min, T0_max ); /* T0_frac==0 to keep IO with AMR-WB */
- }
- }
- ELSE IF( EQ_16( nBits, 6 ) ) /* relative encoding with 6 bits */
- {
- pitch_index = delta_pit_enc_fx( 4, T0, T0_frac, *T0_min );
- }
- ELSE IF( EQ_16( nBits, 5 ) ) /* relative encoding with 5 bits */
- {
- IF( EQ_16( delta, 8 ) )
- {
- pitch_index = delta_pit_enc_fx( 2, T0, T0_frac, *T0_min );
- }
- ELSE /* delta == 4 */
- {
- pitch_index = delta_pit_enc_fx( 4, T0, T0_frac, *T0_min );
- }
- }
- ELSE /* nBits == 4 ) */ /* relative encoding with 4 bits */
- {
- IF( EQ_16( delta, 8 ) )
- {
- pitch_index = delta_pit_enc_fx( 0, T0, T0_frac, *T0_min );
- }
- ELSE /* delta == 4 */
- {
- pitch_index = delta_pit_enc_fx( 2, T0, T0_frac, *T0_min );
- }
- }
-
- IF( !Opt_AMR_WB )
- {
- /* find T0_min and T0_max for delta search */
- limit_T0_fx( L_FRAME, delta, L_SUBFR, limit_flag, T0, T0_frac, T0_min, T0_max );
- }
-
- {
- push_indice( hBstr, IND_PITCH, pitch_index, nBits );
- }
-
- return;
-}
/*-------------------------------------------------------------------*
* pit16k_Q_enc()
@@ -1893,13 +1273,13 @@ void pit_Q_enc_ivas_fx(
*-------------------------------------------------------------------*/
void pit16k_Q_enc_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 nBits, /* i : # of Q bits */
const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */
const Word16 T0, /* i : integer pitch lag */
const Word16 T0_frac, /* i : pitch fraction */
Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* o : delta search max_val */
+ Word16 *T0_max /* o : delta search max_val */
)
{
Word16 pitch_index;
@@ -1964,77 +1344,6 @@ void pit16k_Q_enc_fx(
return;
}
-void pit16k_Q_enc_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 nBits, /* i : # of Q bits */
- const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */
- const Word16 T0, /* i : integer pitch lag */
- const Word16 T0_frac, /* i : pitch fraction */
- Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* o : delta search max_val */
-)
-{
- Word16 pitch_index;
-
- IF( EQ_16( nBits, 10 ) ) /* absolute encoding with 10 bits */
- {
- {
- IF( LT_16( T0, PIT16k_FR2_EXTEND_10b ) )
- {
- /*pitch_index = T0*4 + T0_frac - (PIT16k_MIN_EXTEND*4);*/
- pitch_index = add( shl( T0, 2 ), sub( T0_frac, ( PIT16k_MIN_EXTEND * 4 ) ) );
- }
- ELSE
- {
- /*pitch_index = T0*2 + (T0_frac>>1) - (PIT16k_FR2_EXTEND_10b*2) + ((PIT16k_FR2_EXTEND_10b-PIT16k_MIN_EXTEND)*4);*/
- pitch_index = add( sub( add( shl( T0, 1 ), shr( T0_frac, 1 ) ), ( PIT16k_FR2_EXTEND_10b * 2 ) ), ( ( PIT16k_FR2_EXTEND_10b - PIT16k_MIN_EXTEND ) * 4 ) );
- }
- }
-
- push_indice( hBstr, IND_PITCH, pitch_index, nBits );
- }
- ELSE IF( EQ_16( nBits, 9 ) ) /* absolute encoding with 9 bits */
- {
- {
- /*-------------------------------------------------------------------*
- * The pitch range is encoded absolutely with 9 bits
- * and is divided as follows:
- * PIT16k_EXTEND_MIN to PIT16k_FR2_EXTEND_9b-1 resolution 1/4 (frac = 0,1,2 or 3)
- * PIT16k_FR2_EXTEND_9b to PIT16k_FR1_EXTEND_9b-1 resolution 1/2 (frac = 0 or 2)
- * PIT16k_FR1_EXTEND_9b to PIT16k_MAX_EXTEND resolution 1 (frac = 0)
- *-------------------------------------------------------------------*/
-
- IF( LT_16( T0, PIT16k_FR2_EXTEND_9b ) )
- {
- /*pitch_index = T0*4 + T0_frac - (PIT16k_MIN_EXTEND*4);*/
- pitch_index = add( shl( T0, 2 ), sub( T0_frac, ( PIT16k_MIN_EXTEND * 4 ) ) );
- }
- ELSE IF( LT_16( T0, PIT16k_FR1_EXTEND_9b ) )
- {
- /*pitch_index = T0*2 + (T0_frac>>1) - (PIT16k_FR2_EXTEND_9b*2) + ((PIT16k_FR2_EXTEND_9b-PIT16k_MIN_EXTEND)*4);*/
- pitch_index = add( sub( add( shl( T0, 1 ), shr( T0_frac, 1 ) ), ( PIT16k_FR2_EXTEND_9b * 2 ) ), ( ( PIT16k_FR2_EXTEND_9b - PIT16k_MIN_EXTEND ) * 4 ) );
- }
- ELSE
- {
- /*pitch_index = T0 - PIT16k_FR1_EXTEND_9b + ((PIT16k_FR2_EXTEND_9b-PIT16k_MIN_EXTEND)*4) + ((PIT16k_FR1_EXTEND_9b-PIT16k_FR2_EXTEND_9b)*2);*/
- pitch_index = add( add( sub( T0, PIT16k_FR1_EXTEND_9b ), ( ( PIT16k_FR2_EXTEND_9b - PIT16k_MIN_EXTEND ) * 4 ) ), ( ( PIT16k_FR1_EXTEND_9b - PIT16k_FR2_EXTEND_9b ) * 2 ) );
- }
- }
-
- push_indice( hBstr, IND_PITCH, pitch_index, 9 );
- }
- ELSE /* nBits == 6 */ /* relative encoding with 6 bits */
- {
- /*pitch_index = (T0 - *T0_min) * 4 + T0_frac;*/
- pitch_index = add( shl( sub( T0, *T0_min ), 2 ), T0_frac );
-
- push_indice( hBstr, IND_PITCH, pitch_index, nBits );
- }
-
- limit_T0_fx( L_FRAME16k, 8, L_SUBFR, limit_flag, T0, T0_frac, T0_min, T0_max );
-
- return;
-}
/*------------------------------------------------------------------*
* pit_encode:
@@ -2042,6 +1351,7 @@ void pit16k_Q_enc_ivas_fx(
* Close-loop pitch lag search and pitch lag quantization
* Adaptive excitation construction
*------------------------------------------------------------------*/
+
void Mode2_pit_encode_fx(
const Word16 coder_type, /* i : coding model */
const Word16 i_subfr, /* i : subframe index */
@@ -2082,6 +1392,7 @@ void Mode2_pit_encode_fx(
* - Fractional pitch search
* - Pitch quantization
*-----------------------------------------------------------------*/
+
IF( coder_type == 0 ) /*Unvoiced Coding do nothing*/
{
*T0 = L_SUBFR;
@@ -2251,6 +1562,7 @@ void Mode2_pit_encode_fx(
return;
}
+
static void limit_T0_voiced2(
Word16 res,
const Word16 *T_op,
@@ -2365,8 +1677,11 @@ static void limit_T0_voiced2(
*T0_min_frac = sub( temp1, i_mult2( temp2, res ) );
move16();
}
+
+ return;
}
+
/*-------------------------------------------------------------------*
* abs_pit_enc:
*
@@ -2404,6 +1719,8 @@ void Mode2_abs_pit_enc_fx(
}
( *pt_indice )++;
+
+ return;
}
@@ -2423,8 +1740,9 @@ void Mode2_delta_pit_enc_fx(
)
{
/***pt_indice = (T0 - T0_min) * T0_res + T0_frac - T0_min_frac;*/
-
**pt_indice = add( i_mult2( sub( T0, T0_min ), T0_res ), sub( T0_frac, T0_min_frac ) );
move16();
( *pt_indice )++;
+
+ return;
}
diff --git a/lib_enc/pitch_ol2_fx.c b/lib_enc/pitch_ol2_fx.c
index de47d85afe5be7b606fe2356554c538c2b8f1105..3e2ef6c3151ce4faea8936c6312aa98ddcebf99a 100644
--- a/lib_enc/pitch_ol2_fx.c
+++ b/lib_enc/pitch_ol2_fx.c
@@ -1,17 +1,17 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+
#include
-#include "options.h" /* Compilation switches */
-#include "cnst.h" /* Common constants */
-#include "rom_enc.h" /* Encoder static table prototypes */
-#include "rom_com_fx.h" /* Encoder static table prototypes */
-#include "rom_com.h" /* Encoder static table prototypes */
+#include "options.h" /* Compilation switches */
+#include "cnst.h" /* Common constants */
+#include "rom_enc.h" /* Encoder static table prototypes */
+#include "rom_com.h" /* Encoder static table prototypes */
#include "rom_dec.h"
-//#include "prot_fx.h" /* Function prototypes */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* Local constants
*-------------------------------------------------------------------*/
@@ -50,9 +50,11 @@ void pitch_ol2_fx(
Word32 R1, R2;
Word16 R0, exp_R0, exp_R1, exp_R2, j;
Word16 pit_max;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/* initialization */
@@ -82,8 +84,13 @@ void pitch_ol2_fx(
pt_cor_fx = cor_fx;
FOR( t = t_min; t <= t_max; t++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ t0 = L_shl_sat( *pt_cor_32++, exp3 );
+ *pt_cor_fx++ = round_fx_sat( t0 );
+#else
t0 = L_shl_o( *pt_cor_32++, exp3, &Overflow );
*pt_cor_fx++ = round_fx_o( t0, &Overflow );
+#endif
move16();
}
@@ -189,7 +196,11 @@ void pitch_ol2_fx(
exp_R2 = norm_l( R2 );
R2 = L_shl( R2, exp_R2 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ R1 = L_mult_sat( round_fx_sat( R1 ), round_fx_sat( R2 ) );
+#else
R1 = L_mult_o( round_fx_o( R1, &Overflow ), round_fx_o( R2, &Overflow ), &Overflow );
+#endif
i = norm_l( R1 );
R1 = L_shl( R1, i );
@@ -199,11 +210,19 @@ void pitch_ol2_fx(
R1 = Isqrt_lc( R1, &exp_R1 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ R1 = L_mult( R0, round_fx_sat( R1 ) );
+#else
R1 = L_mult( R0, round_fx_o( R1, &Overflow ) );
+#endif
exp_R0 = sub( 31, exp_R0 );
exp_R0 = sub( add( exp_R0, exp_R1 ), exp3 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ *voicing_fr_fx = round_fx_sat( L_shl_sat( R1, exp_R0 ) ); /*Q15*/
+#else
*voicing_fr_fx = round_fx_o( L_shl_o( R1, exp_R0, &Overflow ), &Overflow ); /*Q15*/
+#endif
move16();
}
ELSE
@@ -243,9 +262,11 @@ void StableHighPitchDetect_fx(
Word16 tmp, tmp1, exp, diff16, cor_max16, exp1, exp2, pit_min_up;
Word32 L_tmp, L_tmp1;
Word16 Top;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*voicing = (voicing[0] + voicing[1] + voicing[2] )/3;*/
@@ -294,30 +315,36 @@ void StableHighPitchDetect_fx(
tmp = abs_s( tmp );
tmp = div_s( 16384, tmp ); /*Q(15+exp)*/
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1799_replace_L_shr_o
diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ BASOP_SATURATE_WARNING_ON_EVS
+ diff16 = round_fx_sat( diff );
#else
- diff = L_negate( L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ) );
-#endif
BASOP_SATURATE_WARNING_ON_EVS
diff16 = round_fx_o( diff, &Overflow );
+#endif
}
ELSE
{
tmp = div_s( 16384, tmp ); /*Q(15+exp)*/
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1799_replace_L_shr_o
diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ BASOP_SATURATE_WARNING_ON_EVS
+ diff16 = round_fx_sat( diff );
#else
- diff = L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow );
-#endif
BASOP_SATURATE_WARNING_ON_EVS
diff16 = round_fx_o( diff, &Overflow );
+#endif
}
}
ELSE
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ diff16 = round_fx_sat( L_shl_sat( diff, 25 ) );
+#else
diff16 = round_fx_o( L_shl_o( diff, 25, &Overflow ), &Overflow );
+#endif
}
test();
test();
@@ -394,7 +421,11 @@ void StableHighPitchDetect_fx(
L_tmp1 = Isqrt_lc( L_tmp1, &exp ); /*Q(31-exp)*/
cor_max = Mult_32_32( cor_max, L_tmp1 );
exp = 31 - ( shl( Q_new, 1 ) + 1 ) - ( 31 - exp ) + 31;
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor_max16 = round_fx_sat( L_shl_sat( cor_max, exp ) ); /*Q15*/
+#else
cor_max16 = round_fx_o( L_shl_o( cor_max, exp, &Overflow ), &Overflow ); /*Q15*/
+#endif
/**voicing0_sm = add(mult_r(24576 ,(*voicing0_sm)) , mult_r(8192 , cor_max16));*/
*voicing0_sm = round_fx( L_mac( L_mult( 24576 /*.75f Q15*/, *voicing0_sm ), 8192 /*.25f Q15*/, cor_max16 ) );
move16();
@@ -459,9 +490,11 @@ void StableHighPitchDetect_ivas_fx(
Word16 tmp, tmp1, exp, diff16, cor_max16, exp1, exp2, pit_min_up;
Word32 L_tmp, L_tmp1;
Word16 Top;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move32();
+#endif
#endif
/*voicing = (voicing[0] + voicing[1] + voicing[2] )/3;*/
@@ -517,30 +550,36 @@ void StableHighPitchDetect_ivas_fx(
tmp = abs_s( tmp );
tmp = div_s( 16384, tmp ); /*Q(15+exp)*/
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1799_replace_L_shr_o
diff = L_negate( L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) ) );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ BASOP_SATURATE_WARNING_ON_EVS
+ diff16 = round_fx_sat( diff );
#else
- diff = L_negate( L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow ) );
-#endif
BASOP_SATURATE_WARNING_ON_EVS
diff16 = round_fx_o( diff, &Overflow );
+#endif
}
ELSE
{
tmp = div_s( 16384, tmp ); /*Q(15+exp)*/
BASOP_SATURATE_WARNING_OFF_EVS
-#ifdef ISSUE_1799_replace_L_shr_o
diff = L_shr_sat( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ) );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ BASOP_SATURATE_WARNING_ON_EVS
+ diff16 = round_fx_sat( diff );
#else
- diff = L_shr_o( Mult_32_16( diff, tmp ), sub( exp + 7, 31 ), &Overflow );
-#endif
BASOP_SATURATE_WARNING_ON_EVS
diff16 = round_fx_o( diff, &Overflow );
+#endif
}
}
ELSE
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ diff16 = round_fx_sat( L_shl_sat( diff, 25 ) );
+#else
diff16 = round_fx_o( L_shl_o( diff, 25, &Overflow ), &Overflow );
+#endif
}
test();
test();
@@ -626,7 +665,11 @@ void StableHighPitchDetect_ivas_fx(
L_tmp1 = Isqrt_lc( L_tmp1, &exp ); /*Q(31-exp)*/
cor_max = Mult_32_32( cor_max, L_tmp1 );
exp = add( sub( sub( 31, add( shl( Q_new, 1 ), 1 ) ), sub( 31, exp ) ), 31 );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor_max16 = round_fx_sat( L_shl_sat( cor_max, exp ) ); /*Q15*/
+#else
cor_max16 = round_fx_o( L_shl_o( cor_max, exp, &Overflow ), &Overflow ); /*Q15*/
+#endif
/**voicing0_sm = add(mult_r(24576 ,(*voicing0_sm)) , mult_r(8192 , cor_max16));*/
*voicing0_sm = round_fx( L_mac( L_mult( 24576 /*.75f Q15*/, *voicing0_sm ), 8192 /*.25f Q15*/, cor_max16 ) );
move16();
diff --git a/lib_enc/pitch_ol_fx.c b/lib_enc/pitch_ol_fx.c
index d4e3284da0afbc81539e13ffe0dce04064d38642..8bf8065c8ae5da2f4dd3c1b5fea889099ae4faac 100644
--- a/lib_enc/pitch_ol_fx.c
+++ b/lib_enc/pitch_ol_fx.c
@@ -5,14 +5,13 @@
#include
#include "options.h"
#include "cnst.h"
-// #include "prot_fx.h"
#include "basop_util.h"
-#include "rom_com_fx.h"
#include "rom_com.h"
#include "rom_enc.h"
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
+
/*-----------------------------------------------------------------*
* Local Constants
*-----------------------------------------------------------------*/
@@ -183,8 +182,10 @@ void pitch_ol_fx(
const Word16 *len, *len1, *sublen, *sublen1, *pit_max, *sec_length, *sec_length1;
Word16 pit_min_coding;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
/*--------------------------------------------------------------*
@@ -737,7 +738,11 @@ void pitch_ol_fx(
enr1_exp = 0;
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ enr1 = add_sat( extract_h( dotp_fx( pt2, pt2, len[j], &enr1_exp ) ), 1 );
+#else
enr1 = add_o( extract_h( dotp_fx( pt2, pt2, len[j], &enr1_exp ) ), 1, &Overflow );
+#endif
enr2 = L_mult( enr0[j], enr1 );
enr2_exp = norm_l( enr2 );
@@ -751,11 +756,7 @@ void pitch_ol_fx(
Ltmp = L_mult0( cor_buf[ind], enr1 );
qCorX = add( sub( 15, enr1_exp ), sub( 14, pt_exp1[ind] ) );
-#ifdef ISSUE_1799_replace_L_shr_o
corX[i][j] = extract_h( L_shr_sat( Ltmp, sub( qCorX, 31 ) ) );
-#else
- corX[i][j] = extract_h( L_shr_o( Ltmp, sub( qCorX, 31 ), &Overflow ) );
-#endif
qCorX = 31;
move16();
@@ -777,7 +778,11 @@ void pitch_ol_fx(
move16(); /* selected moving vector */
enr1_exp = 0;
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ enr1 = add_sat( extract_h( dotp_fx( pt4, pt4, len1[j], &enr1_exp ) ), 1 );
+#else
enr1 = add_o( extract_h( dotp_fx( pt4, pt4, len1[j], &enr1_exp ) ), 1, &Overflow );
+#endif
enr2 = L_mult( enr0_1[j], enr1 );
enr2_exp = norm_l( enr2 );
@@ -792,11 +797,7 @@ void pitch_ol_fx(
Ltmp = L_mult0( cor_buf[ind1 + len_x], enr1 );
qCorX = add( sub( 15, enr1_exp ), sub( 14, pt_exp3[ind1] ) );
-#ifdef ISSUE_1799_replace_L_shr_o
corX[i][j + NSECT] = extract_h( L_shr_sat( Ltmp, qCorX - 31 ) );
-#else
- corX[i][j + NSECT] = extract_h( L_shr_o( Ltmp, qCorX - 31, &Overflow ) );
-#endif
qCorX = 31;
move16();
@@ -876,7 +877,11 @@ void pitch_ol_fx(
move16();
pitch_tmp[i] = pitchX[i][ind];
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor_tmp[i] = add_sat( corX[i][ind], corr_shift );
+#else
cor_tmp[i] = add_o( corX[i][ind], corr_shift, &Overflow );
+#endif
move16();
/* Higher is the neighbour's correlation, higher is the weighting */
@@ -890,7 +895,11 @@ void pitch_ol_fx(
move16();
pitch_tmp[i + NHFR] = pitchX[i][ind1];
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor_tmp[i + NHFR] = add_sat( corX[i][ind1], corr_shift );
+#else
cor_tmp[i + NHFR] = add_o( corX[i][ind1], corr_shift, &Overflow );
+#endif
move16();
/* Higher is the neighbour's correlation, higher is the weighting */
@@ -1111,8 +1120,10 @@ void pitch_ol_ivas_fx(
const Word16 *len, *len1, *sublen, *sublen1, *pit_max, *sec_length, *sec_length1;
Word16 pit_min_coding;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
+#endif
#endif
Word16 new_q;
new_q = sub( 63, shl( qwsp, 1 ) );
@@ -1715,7 +1726,12 @@ void pitch_ol_ivas_fx(
enr1 = ISqrt32( enr1, &enr1_exp ); /* 1/sqrt(energy) */ /*31-enr2_exp*/
Ltmp = Mpy_32_16_1( enr1, cor_buf[ind] );
- corX[i][j] = extract_h( L_shl_o( Ltmp, add( enr1_exp, cor_buf_exp[ind] ), &Overflow ) ); // Q15
+#ifdef ISSUE_1867_replace_overflow_libenc
+ corX[i][j] = extract_h( L_shl_sat( Ltmp, add( enr1_exp, cor_buf_exp[ind] ) ) ); // Q15
+#else
+
+ corX[i][j] = extract_h( L_shl_o( Ltmp, add( enr1_exp, cor_buf_exp[ind] ), &Overflow ) ); // Q15
+#endif
move16();
Ltmp = Mpy_32_16_1( enr1, pt_cor0[ind] );
@@ -1758,7 +1774,11 @@ void pitch_ol_ivas_fx(
enr1 = ISqrt32( enr1, &enr1_exp ); /* 1/sqrt(energy) */ /*31-enr1_exp*/
Ltmp = Mpy_32_16_1( enr1, cor_buf[ind1 + len_x] );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ corX[i][j + NSECT] = extract_h( L_shl_sat( Ltmp, add( enr1_exp, cor_buf_exp[ind1 + len_x] ) ) ); // Q15
+#else
corX[i][j + NSECT] = extract_h( L_shl_o( Ltmp, add( enr1_exp, cor_buf_exp[ind1 + len_x] ), &Overflow ) ); // Q15
+#endif
move16();
Ltmp = Mpy_32_16_1( enr1, pt_cor0[ind1 + ( DELTA_COH - 1 ) + len_x] );
@@ -1835,7 +1855,11 @@ void pitch_ol_ivas_fx(
move16();
pitch_tmp[i] = pitchX[i][ind];
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor_tmp[i] = add_sat( corX[i][ind], corr_shift );
+#else
cor_tmp[i] = add_o( corX[i][ind], corr_shift, &Overflow );
+#endif
move16();
/* Higher is the neighbour's correlation, higher is the weighting */
@@ -1849,7 +1873,11 @@ void pitch_ol_ivas_fx(
move16();
pitch_tmp[i + NHFR] = pitchX[i][ind1];
move16();
+#ifdef ISSUE_1867_replace_overflow_libenc
+ cor_tmp[i + NHFR] = add_sat( corX[i][ind1], corr_shift );
+#else
cor_tmp[i + NHFR] = add_o( corX[i][ind1], corr_shift, &Overflow );
+#endif
move16();
/* Higher is the neighbour's correlation, higher is the weighting */
diff --git a/lib_enc/ppp_enc_fx.c b/lib_enc/ppp_enc_fx.c
index d6dc8b6d68adcec9c2466e1069b658ce85791c7e..df422582d1970020214578bba0c74b9d99ef8c06 100644
--- a/lib_enc/ppp_enc_fx.c
+++ b/lib_enc/ppp_enc_fx.c
@@ -5,15 +5,16 @@
#include
#include "options.h"
#include "cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* Local constants
*-------------------------------------------------------------------*/
+
#define ERB_CBSIZE1 64
#define ERB_CBSIZE2 64
#define P_CBSIZE 64
@@ -21,6 +22,7 @@
/*-------------------------------------------------------------------*
* Local functions
*--------------------------------------------------------------------*/
+
static Word16 DTFS_quant_cw_fx( DTFS_STRUCTURE *X_fx, Word16 pl, const Word16 *curr_lpc_fx, Word16 *POWER_IDX, Word16 *AMP_IDX, Word16 *lastLgainE_fx, Word16 *lastHgainE_fx, Word16 *lasterbE_fx, Word16 *sin_tab, Word16 *cos_tab );
static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X2_fx, Word16 *S_fx, Word16 *C_fx );
static void erb_diff_fx( const Word16 *prev_erb, Word16 pl, const Word16 *curr_erb, Word16 l, const Word16 *curr_lsp, Word16 *index, Word16 num_erb );
@@ -622,9 +624,11 @@ static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X
Word16 n, fshift_fx, HalfLag, ab1[MAXLAG_WI], ab2[MAXLAG_WI];
Word32 corr_fx;
Word32 maxcorr_fx, wcorr_fx, diff_corr;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
IF( LT_16( X1_fx.lag_fx, X2_fx.lag_fx ) )
{
@@ -663,9 +667,15 @@ static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X
FOR( k = 0; k <= HalfLag; k++ )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ corr_fx = L_mac_sat( corr_fx, ab1[k], C_fx[temp % ( 4 * X2_fx.lag_fx )] );
+ corr_fx = L_mac_sat( corr_fx, ab2[k], S_fx[temp % ( 4 * X2_fx.lag_fx )] );
+ temp = add_sat( temp, temp1 );
+#else
corr_fx = L_mac_o( corr_fx, ab1[k], C_fx[temp % ( 4 * X2_fx.lag_fx )], &Overflow );
corr_fx = L_mac_o( corr_fx, ab2[k], S_fx[temp % ( 4 * X2_fx.lag_fx )], &Overflow );
temp = add_o( temp, temp1, &Overflow );
+#endif
}
temp = sub( 32767, extract_l( L_shr( L_mult( 82, abs_s( n ) ), 1 ) ) ); /* Q15 */
Qcorr = norm_l( corr_fx );
@@ -675,23 +685,40 @@ static Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE X1_fx, DTFS_STRUCTURE X
move16();
}
- temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */
- wcorr_fx = L_mult_o( temp1, temp, &Overflow ); /* Q(Qcorr-16+15+1)=Q(Qcorr) */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ temp1 = round_fx_sat( (Word32) L_shl_sat( corr_fx, Qcorr ) ); /* Q(Qcorr-16) */
+ wcorr_fx = L_mult_sat( temp1, temp ); /* Q(Qcorr-16+15+1)=Q(Qcorr) */
+#else
+ temp1 = round_fx_o( (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ), &Overflow ); /* Q(Qcorr-16) */
+ wcorr_fx = L_mult_o( temp1, temp, &Overflow ); /* Q(Qcorr-16+15+1)=Q(Qcorr) */
+#endif
IF( GE_16( Qmaxcorr, Qcorr ) )
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ diff_corr = L_sub_sat( wcorr_fx, L_shl_sat( maxcorr_fx, sub( Qcorr, Qmaxcorr ) ) ); /* Qcorr */
+#else
diff_corr = L_sub_o( wcorr_fx, L_shl_o( maxcorr_fx, sub( Qcorr, Qmaxcorr ), &Overflow ), &Overflow ); /* Qcorr */
+#endif
}
ELSE
{
+#ifdef ISSUE_1867_replace_overflow_libenc
+ diff_corr = L_sub_sat( L_shl_sat( wcorr_fx, sub( Qmaxcorr, Qcorr ) ), maxcorr_fx ); /* Qmaxcorr */
+#else
diff_corr = L_sub_o( L_shl_o( wcorr_fx, sub( Qmaxcorr, Qcorr ), &Overflow ), maxcorr_fx, &Overflow ); /* Qmaxcorr */
+#endif
}
if ( diff_corr > 0 )
{
fshift_fx = n;
move16();
- maxcorr_fx = (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ); /* Qcorr */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ maxcorr_fx = (Word32) L_shl_sat( corr_fx, Qcorr ); /* Qcorr */
+#else
+ maxcorr_fx = (Word32) L_shl_o( corr_fx, Qcorr, &Overflow ); /* Qcorr */
+#endif
Qmaxcorr = Qcorr;
move16();
}
@@ -739,9 +766,11 @@ static void LPCPowSpect_fx(
Word32 Ltemp, Lw;
Word32 Lacc;
Word16 tmp, exp;
+#ifndef ISSUE_1867_replace_overflow_libenc
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
Flag Overflow = 0;
move16();
+#endif
#endif
FOR( k = 0; k < Nf; k++ )
{
@@ -773,11 +802,17 @@ static void LPCPowSpect_fx(
t1 = add( t1, (Word16) L_shr( Ltemp, 16 ) ); /* t1 is interpolated cos(w) */
Ltemp = L_shr( L_mult( LPC[i], t1 ), 1 ); /* Ltemp in Q27 */
- Re = L_add_o( Re, Ltemp, &Overflow ); /* Re=1-sum(LPC[i]*cos(Lw)); */
- Ltemp = L_add_o( Lw, 0x6000, &Overflow ); /* add 0.75, which is 3pi/2 to convert sin to cos */
- Ltemp = L_shl_o( Ltemp, 10, &Overflow ); /* Q25 */
- w = extract_h( Ltemp ); /* w is equivalent cos index */
- dl = extract_l( Ltemp ); /* dl is 6 bit left-over for interpolation */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Re = L_add_sat( Re, Ltemp ); /* Re=1-sum(LPC[i]*cos(Lw)); */
+ Ltemp = L_add_sat( Lw, 0x6000 ); /* add 0.75, which is 3pi/2 to convert sin to cos */
+ Ltemp = L_shl_sat( Ltemp, 10 ); /* Q25 */
+#else
+ Re = L_add_o( Re, Ltemp, &Overflow ); /* Re=1-sum(LPC[i]*cos(Lw)); */
+ Ltemp = L_add_o( Lw, 0x6000, &Overflow ); /* add 0.75, which is 3pi/2 to convert sin to cos */
+ Ltemp = L_shl_o( Ltemp, 10, &Overflow ); /* Q25 */
+#endif
+ w = extract_h( Ltemp ); /* w is equivalent cos index */
+ dl = extract_l( Ltemp ); /* dl is 6 bit left-over for interpolation */
w = s_and( w, 511 );
t1 = cos_table[w];
/*t2=cos_table[s_and(add(w,1),511)]; */
@@ -797,8 +832,13 @@ static void LPCPowSpect_fx(
t1 = add( t1, (Word16) L_shr( Ltemp, 16 ) ); /* t1 is interpolated cos(w) */
Ltemp = L_shr( L_mult( LPC[i], t1 ), 1 ); /* Ltemp in Q27 */
- Im = L_sub_o( Im, Ltemp, &Overflow ); /* Im=sum(LPC[i]*sin(Lw)) */
- Lw = L_add_o( Lw, freq[k], &Overflow ); /* Lw=(i+1)*freq[k] */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Im = L_sub_sat( Im, Ltemp ); /* Im=sum(LPC[i]*sin(Lw)) */
+ Lw = L_add_sat( Lw, freq[k] ); /* Lw=(i+1)*freq[k] */
+#else
+ Im = L_sub_o( Im, Ltemp, &Overflow ); /* Im=sum(LPC[i]*sin(Lw)) */
+ Lw = L_add_o( Lw, freq[k], &Overflow ); /* Lw=(i+1)*freq[k] */
+#endif
}
/* If necessary, we can block-normalize Re and Im to improve precision */
dh = extract_h( Re );
@@ -813,7 +853,11 @@ static void LPCPowSpect_fx(
ELSE
Lacc = L_mult0( dh, dl );
- Lacc = L_add_o( L_shr( Lacc, 15 ), L_shr( L_mult_o( dh, dh, &Overflow ), 1 ), &Overflow ); /* Lacc=Re*Re */
+#ifdef ISSUE_1867_replace_overflow_libenc
+ Lacc = L_add_sat( L_shr( Lacc, 15 ), L_shr( L_mult_sat( dh, dh ), 1 ) ); /* Lacc=Re*Re */
+#else
+ Lacc = L_add_o( L_shr( Lacc, 15 ), L_shr( L_mult_o( dh, dh, &Overflow ), 1 ), &Overflow ); /* Lacc=Re*Re */
+#endif
dh = extract_h( Im );
dl = extract_l( Im );
@@ -844,7 +888,11 @@ static void LPCPowSpect_fx(
move16();
}
Ltemp = L_deposit_h( tmp );
+#ifdef ISSUE_1867_replace_overflow_libenc
+ out[k] = round_fx_sat( L_shl_sat( Ltemp, negate( add( exp, 8 ) ) ) );
+#else
out[k] = round_fx_o( L_shl_o( Ltemp, negate( add( exp, 8 ) ), &Overflow ), &Overflow );
+#endif
move16();
/* out[k] = shl(tmp,-exp-8); in Q7 */
diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c
index 8a3cf1a00a7e52dc4847517e176f0fdeba6d5495..29a0aa229357128eb352843d193f2dfc1e8d0c8e 100644
--- a/lib_enc/pre_proc_fx.c
+++ b/lib_enc/pre_proc_fx.c
@@ -5,12 +5,12 @@
#include
#include "options.h"
#include "cnst.h"
-#include "rom_com_fx.h"
#include "rom_com.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "prot_fx_enc.h" /* Function prototypes */
#include "basop_util.h" /* Function prototypes */
+
/*-------------------------------------------------------------------*
* pre_proc()
*
@@ -126,12 +126,6 @@ void pre_proc_fx(
LPD_state_HANDLE hLPDmem = st->hLPDmem;
FD_BWE_ENC_HANDLE hBWE_FD = st->hBWE_FD;
-#ifndef ISSUE_1796_replace_shl_o
-#ifdef BASOP_NOGLOB_DECLARE_LOCAL
- Flag Overflow = 0;
- move16();
-#endif
-#endif
/*------------------------------------------------------------------*
* Initializations
@@ -270,7 +264,7 @@ void pre_proc_fx(
st->vad_flag = wb_vad_fx( st, fr_bands, &noisy_speech_HO, &clean_speech_HO, &NB_speech_HO,
&snr_sum_he, &localVAD_HE_SAD, &( st->flag_noisy_speech_snr ), *Q_new, hVAD, hNoiseEst, st->lp_speech_fx, st->lp_noise_fx );
- vad_flag_cldfb = vad_proc_fx( &( st->vad_st ), realBuffer, imagBuffer, cldfbScale->lb_scale, &cldfb_addition,
+ vad_flag_cldfb = vad_proc_fx( st->hVAD_CLDFB, realBuffer, imagBuffer, cldfbScale->lb_scale, &cldfb_addition,
enerBuffer, enerBuffer_exp, st->cldfbAnaEnc->no_channels, st->vad_flag );
IF( LT_16( st->Pos_relE_cnt, 20 ) ) /* Ensure the level is high enough and cldfb decision is reliable */
@@ -399,8 +393,8 @@ void pre_proc_fx(
test();
IF( st->tcx10Enabled || st->tcx20Enabled )
{
- RunTransientDetection_fx( signal_in, input_frame, &st->transientDetection );
- currFlatness = GetTCXAvgTemporalFlatnessMeasure_fx( &st->transientDetection, NSUBBLOCKS, 0 );
+ RunTransientDetection_fx( signal_in, input_frame, st->hTranDet );
+ currFlatness = GetTCXAvgTemporalFlatnessMeasure_fx( st->hTranDet, NSUBBLOCKS, 0 );
}
/*----------------------------------------------------------------*
@@ -1048,11 +1042,7 @@ void pre_proc_fx(
test();
IF( ( ( st->tcxonly == 0 ) || ( EQ_16( st->codec_mode, MODE1 ) ) ) && GT_32( st->input_Fs, 8000 ) )
{
-#ifdef ISSUE_1796_replace_shl_o
st->mem_preemph_enc = shl_sat( new_inp_16k[sub( L_frame_tmp, 1 )], 1 );
-#else
- st->mem_preemph_enc = shl_o( new_inp_16k[sub( L_frame_tmp, 1 )], 1, &Overflow );
-#endif
move16();
}
@@ -1271,7 +1261,7 @@ void pre_proc_fx(
* TCX mode decision
*---------------------------------------------------------------*/
- SetTCXModeInfo_fx( st, &st->transientDetection, &st->hTcxCfg->tcx_curr_overlap_mode );
+ SetTCXModeInfo_fx( st, st->hTranDet, &st->hTcxCfg->tcx_curr_overlap_mode );
}
/*-----------------------------------------------------------------*
diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h
index 48af49619a2c184c9cda2c6239c3a7ac3824694b..e64c18468db76ef4f161075c927b97b44f1e13e2 100644
--- a/lib_enc/prot_fx_enc.h
+++ b/lib_enc/prot_fx_enc.h
@@ -62,9 +62,7 @@ ivas_error acelp_core_enc_fx(
Word16 *unbits_fx, /* o : number of unused bits Q0*/
STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */
const Word16 Q_new,
- const Word16 shift
-
-);
+ const Word16 shift );
void analy_lp_fx(
const Word16 speech[], /* i :(Q_new) pointer to the speech frame */
@@ -107,18 +105,6 @@ void AVQ_encmux_fx(
Word16 trgtSvPos /* i : target SV for AVQ bit savings */
);
-void AVQ_encmux_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
- const Word16 extl, /* i : extension layer */
- Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed
- by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */
- Word16 *nb_bits, /* i/o: number of allocated bits */
- const Word16 Nsv, /* i: number of subvectors */
- Word16 nq_out[], /* o : AVQ nq index */
- Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */
- Word16 trgtSvPos /* i : target SV for AVQ bit savings */
-);
-
void bw_detect_fx(
Encoder_State *st, /* i/o: Encoder State */
const Word16 signal_in[], /* i : input signal */
@@ -246,37 +232,39 @@ void find_tilt_fx(
Word16 Opt_vbr_mode /* Q0 */
);
-Word16 find_uv_ivas_fx( /* o : coding type */
- Encoder_State *st_fx, /* i/o: encoder state structure */
- const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/
- const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/
- const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/
- const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/
- Word32 *dE1X, /* o : sudden energy increase for S/M classifier Q13*/
- const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/
- const Word16 relE, /* i : relative frame energy Q8*/
- const Word16 Etot, /* i : total energy Q8*/
- const Word32 hp_E[], /* i : energy in HF q_hp_E*/
- Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation Q0*/
- const Word16 last_core_orig, /* i : original last core Q0*/
- STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */
- const Word16 Q_new,
- const Word16 q_hp_E );
-
-Word16 find_uv_fx( /* o : coding type */
- Encoder_State *st_fx, /* i/o: encoder state structure */
- const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/
- const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/
- const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/
- const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/
- const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/
- const Word16 relE, /* i : relative frame energy Q8*/
- const Word16 Etot, /* i : total energy Q8*/
- const Word32 hp_E[], /* i : energy in HF Q_new + Q_SCALE*/
- const Word16 Q_new,
- Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation Q0*/
- const Word16 shift,
- const Word16 last_core_orig /* i : original last core Q0*/
+/* o : coding type */
+Word16 find_uv_ivas_fx(
+ Encoder_State *st_fx, /* i/o: encoder state structure */
+ const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/
+ const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/
+ const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/
+ const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/
+ Word32 *dE1X, /* o : sudden energy increase for S/M classifier Q13*/
+ const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/
+ const Word16 relE, /* i : relative frame energy Q8*/
+ const Word16 Etot, /* i : total energy Q8*/
+ const Word32 hp_E[], /* i : energy in HF q_hp_E*/
+ Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation Q0*/
+ const Word16 last_core_orig, /* i : original last core Q0*/
+ STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */
+ const Word16 Q_new,
+ const Word16 q_hp_E );
+
+/* o : coding type */
+Word16 find_uv_fx(
+ Encoder_State *st_fx, /* i/o: encoder state structure */
+ const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/
+ const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15*/
+ const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/
+ const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6*/
+ const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/
+ const Word16 relE, /* i : relative frame energy Q8*/
+ const Word16 Etot, /* i : total energy Q8*/
+ const Word32 hp_E[], /* i : energy in HF Q_new + Q_SCALE*/
+ const Word16 Q_new,
+ Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation Q0*/
+ const Word16 shift,
+ const Word16 last_core_orig /* i : original last core Q0*/
);
void fine_gain_quant_fx(
@@ -302,6 +290,7 @@ void long_enr_fx(
const Word16 Etot, /* i : total channel E (see lib_enc\analy_sp.c) */
const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */
Word16 high_lpn_flag );
+
void ivas_long_enr_fx(
Encoder_State *st_fx, /* i/o: state structure */
const Word32 Etot, /* i : total channel E (see lib_enc\analy_sp.c) Q=24*/
@@ -313,12 +302,14 @@ void ivas_long_enr_fx(
const Word16 Etot_LR[] /* i : total channel energy LR channels Q=8*/
);
-Word16 mdct_classifier_fx( /* o: MDCT A/B decision */
- const Word16 *Y, /* i: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */
- Encoder_State *st_fx, /* i/o: Encoder state variable */
- Word32 *cldfbBuf_Ener,
- Word16 enerBuffer_exp,
- const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */
+
+/* o: MDCT A/B decision */
+Word16 mdct_classifier_fx(
+ const Word16 *Y, /* i: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */
+ Encoder_State *st_fx, /* i/o: Encoder state variable */
+ Word32 *cldfbBuf_Ener,
+ Word16 enerBuffer_exp,
+ const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */
);
void noise_est_down_fx(
@@ -382,6 +373,7 @@ void noise_est_fx(
Word16 S_map[], /* o : short-term correlation map Q7 */
const Word16 ini_frame /* i : Frame number (init) */
);
+
void noise_est_ivas_fx(
Encoder_State *st_fx, /* i/o: state structure */
const Word16 old_pitch1, /* i : previous frame OL pitch[1] */
@@ -414,6 +406,7 @@ void noise_est_ivas_fx(
FRONT_VAD_ENC_HANDLE hFrontVad, /* i/o: front-VAD handle */
const Word16 ini_frame /* i : Frame number (init) */
);
+
void noise_est_pre_fx(
const Word16 Etot, /* i : Energy of current frame */
const Word16 ini_frame_fx, /* i : Frame number (init) */
@@ -435,17 +428,14 @@ void noise_est_pre_32fx(
);
void pitch_ol2_fx(
- const Word16 pit_min, /* i : minimum pitch value (20 or 29) */
- const Word16 pitch_ol, /* i : pitch to be improved */
- Word16 *pitch_fr_fx,
- /* o : adjusted 1/4 fractional pitch */ /*Q7*/
- Word16 *voicing_fr_fx,
- /* o : adjusted 1/4 fractional voicing */ /*Q15*/
- const Word16 pos, /* i : position in frame where to calculate the improv. */
- const Word16 *wsp_fx,
- /* i : weighted speech for current frame and look-ahead */ /*Q_new-1+shift*/
- const Word16 delta, /* i : delta for pitch search (2 or 7) */
- const Word16 element_mode /* i : EVS or IVAS */
+ const Word16 pit_min, /* i : minimum pitch value (20 or 29) */
+ const Word16 pitch_ol, /* i : pitch to be improved */
+ Word16 *pitch_fr_fx, /* o : adjusted 1/4 fractional pitch Q7*/
+ Word16 *voicing_fr_fx, /* o : adjusted 1/4 fractional voicing Q15*/
+ const Word16 pos, /* i : position in frame where to calculate the improv. */
+ const Word16 *wsp_fx, /* i : weighted speech for current frame and look-ahead Q_new-1+shift*/
+ const Word16 delta, /* i : delta for pitch search (2 or 7) */
+ const Word16 element_mode /* i : EVS or IVAS */
);
void pitch_ol_ivas_fx(
@@ -516,19 +506,20 @@ void Scale_mem_enc(
Word16 *last_exc_dct_in,
Word16 *old_input_lp );
-Word32 Scale_mem_pre_proc( /* o : Min energy scaled */
- Word16 ini_frame_fx, /* i : Frame number Q0*/
- Word16 Q_exp, /* i : Diff scaling factor */
- Word16 *Q_new, /* i/o: Absolute scaling factor */
- Word16 *old_speech, /* i/o: Speech memory */
- Word16 *mem_wsp, /* i/o: wsp vector memory st->mem_wsp_q*/
- Word32 *enrO, /* i/o: Enr mem q_enrO*/
- Word32 *bckr, /* i/o: Back ground_fx ener mem q_bckr*/
- Word32 *ave_enr, /* i/o: Ave_enr mem Q_new + QSCALE*/
- Word32 *ave_enr2, /* i/o: Ave_enr2 mem Q_new + QSCALE*/
- Word32 *st_fr_bands1, /* i/o: spectrum per critical bands of the previous frame Q_new + QSCALE*/
- Word32 *st_fr_bands2, /* i/o: spectrum per critical bands 2 frames ago Q_new + QSCALE*/
- Word32 *st_Bin_E_old );
+/* o : Min energy scaled */
+Word32 Scale_mem_pre_proc(
+ Word16 ini_frame_fx, /* i : Frame number Q0*/
+ Word16 Q_exp, /* i : Diff scaling factor */
+ Word16 *Q_new, /* i/o: Absolute scaling factor */
+ Word16 *old_speech, /* i/o: Speech memory */
+ Word16 *mem_wsp, /* i/o: wsp vector memory st->mem_wsp_q*/
+ Word32 *enrO, /* i/o: Enr mem q_enrO*/
+ Word32 *bckr, /* i/o: Back ground_fx ener mem q_bckr*/
+ Word32 *ave_enr, /* i/o: Ave_enr mem Q_new + QSCALE*/
+ Word32 *ave_enr2, /* i/o: Ave_enr2 mem Q_new + QSCALE*/
+ Word32 *st_fr_bands1, /* i/o: spectrum per critical bands of the previous frame Q_new + QSCALE*/
+ Word32 *st_fr_bands2, /* i/o: spectrum per critical bands 2 frames ago Q_new + QSCALE*/
+ Word32 *st_Bin_E_old );
void Scale_wsp(
Word16 *wsp, /* i : Weigthed speech */
@@ -542,22 +533,24 @@ void Scale_wsp(
const Word16 Len_p_look /* i : L_frame + look ahead Q0*/
);
-Word16 signal_clas_fx( /* o : classification for current frames */
- Encoder_State *st, /* i/o: encoder state structure */
- const Word16 *speech, /* i : pointer to speech signal for E computation */
- const Word32 *ee, /* i : lf/hf E ration for 2 half-frames */
- const Word16 relE, /* i : frame relative E to the long term average */
- const Word16 L_look, /* i : look-ahead */
- Word16 *uc_clas /* o : temporary classification used in music/speech class*/
+/* o : classification for current frames */
+Word16 signal_clas_fx(
+ Encoder_State *st, /* i/o: encoder state structure */
+ const Word16 *speech, /* i : pointer to speech signal for E computation */
+ const Word32 *ee, /* i : lf/hf E ration for 2 half-frames */
+ const Word16 relE, /* i : frame relative E to the long term average */
+ const Word16 L_look, /* i : look-ahead */
+ Word16 *uc_clas /* o : temporary classification used in music/speech class*/
);
-Word16 signal_clas_ivas_fx( /* o : classification for current frames */
- Encoder_State *st, /* i/o: encoder state structure */
- const Word16 *speech, /* i : pointer to speech signal for E computation */
- const Word32 *ee, /* i : lf/hf E ration for 2 half-frames */
- const Word16 relE, /* i : frame relative E to the long term average */
- const Word16 L_look, /* i : look-ahead */
- Word16 *uc_clas /* o : temporary classification used in music/speech class*/
+/* o : classification for current frames */
+Word16 signal_clas_ivas_fx(
+ Encoder_State *st, /* i/o: encoder state structure */
+ const Word16 *speech, /* i : pointer to speech signal for E computation */
+ const Word32 *ee, /* i : lf/hf E ration for 2 half-frames */
+ const Word16 relE, /* i : frame relative E to the long term average */
+ const Word16 L_look, /* i : look-ahead */
+ Word16 *uc_clas /* o : temporary classification used in music/speech class*/
);
void speech_music_classif_fx(
@@ -647,17 +640,14 @@ void swb_CNG_enc_ivas_fx(
);
void swb_pre_proc_fx(
- Encoder_State *st_fx, /* i/o: encoder state structure */
- const Word16 *input_fx, /* i : original i signal */
- Word16 *new_swb_speech_fx, /* o : original i signal at 32kHz */
- Word16 *shb_speech_fx, /* o : SHB target signal (6-14kHz) at 16kHz */
- Word16 *Q_shb_spch /* o : shb target signal Q factor */
- ,
- Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] /* i : real buffer */
- ,
- Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] /* i : imag buffer */
- ,
- const CLDFB_SCALE_FACTOR *cldfbScale /* i : scale data of real and imag CLDFB buffers */
+ Encoder_State *st_fx, /* i/o: encoder state structure */
+ const Word16 *input_fx, /* i : original i signal */
+ Word16 *new_swb_speech_fx, /* o : original i signal at 32kHz */
+ Word16 *shb_speech_fx, /* o : SHB target signal (6-14kHz) at 16kHz */
+ Word16 *Q_shb_spch, /* o : shb target signal Q factor */
+ Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer */
+ Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer */
+ const CLDFB_SCALE_FACTOR *cldfbScale /* i : scale data of real and imag CLDFB buffers */
);
void InitSWBencBufferStates_fx(
@@ -704,20 +694,23 @@ Word16 tfaEnc_TBE_fx(
const Word16 *pitch_buf, /* Q6 */
const Word16 Q_enr );
-Word32 VAD_Log2( Word32 i_s32Val,
- Word16 i_s16Q );
+Word32 VAD_Log2(
+ Word32 i_s32Val,
+ Word16 i_s16Q );
-Word32 VAD_L_ADD( Word32 s32Mantissa1,
- Word16 i_tExp1,
- Word32 s32Mantissa2,
- Word16 i_tExp2,
- Word16 *s16Exp );
+Word32 VAD_L_ADD(
+ Word32 s32Mantissa1,
+ Word16 i_tExp1,
+ Word32 s32Mantissa2,
+ Word16 i_tExp2,
+ Word16 *s16Exp );
-Word32 VAD_L_div( Word32 L_var1,
- Word32 L_var2,
- Word16 Q_L_var1,
- Word16 Q_L_var2,
- Word16 *Q_OUT );
+Word32 VAD_L_div(
+ Word32 L_var1,
+ Word32 L_var2,
+ Word16 Q_L_var1,
+ Word16 Q_L_var2,
+ Word16 *Q_OUT );
void vad_param_updt_fx(
Encoder_State *st_fx, /* i/o: state structure */
@@ -773,7 +766,6 @@ void wb_tbe_enc_ivas_fx(
const Word16 pitch_buf[] /* i : pitch for each subframe Q6 */
);
-
Word16 wb_vad_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) Q_new+QSCALE*/
@@ -806,14 +798,15 @@ Word16 wb_vad_ivas_fx(
Word16 lp_noise /* i : long term noise energy */
);
-Word32 construct_snr_thresh_fx( Word16 sp_center[], /*(i) spectral center Q10*/
- Word32 snr_flux, /*(i) snr flux Q25*/
- Word32 lt_snr, /*(i) long time time domain snr Q25*/
- Word32 l_snr, /*(i) long time frequency domain snr Q25*/
- Word32 continuous_speech_num, /*(i) amount of continuous speech frames Q0*/
- Word16 continuous_noise_num, /*(i) amount of continuous noise frames Q0*/
- Word32 fg_energy_est_start, /*(i) whether if estimated energy Q0*/
- Word16 bw_index /*(i) band width index Q0*/
+Word32 construct_snr_thresh_fx(
+ Word16 sp_center[], /*(i) spectral center Q10*/
+ Word32 snr_flux, /*(i) snr flux Q25*/
+ Word32 lt_snr, /*(i) long time time domain snr Q25*/
+ Word32 l_snr, /*(i) long time frequency domain snr Q25*/
+ Word32 continuous_speech_num, /*(i) amount of continuous speech frames Q0*/
+ Word16 continuous_noise_num, /*(i) amount of continuous noise frames Q0*/
+ Word32 fg_energy_est_start, /*(i) whether if estimated energy Q0*/
+ Word16 bw_index /*(i) band width index Q0*/
);
void sc_vbr_enc_init_fx(
@@ -826,28 +819,42 @@ void updt_enc_common_fx(
const Word16 Q_new /* i : CUrrent frame scaling */
);
-void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum );
+void attenuateNbSpectrum_fx(
+ Word16 L_frame,
+ Word32 *spectrum );
-Word16 corr_xy1_fx( /* o : pitch gain (0..GAIN_PIT_MAX) */
- const Word16 xn_1[], /* i : target signal */
- const Word16 y1_1[], /* i : filtered adaptive codebook excitation */
- Word16 g_corr[], /* o : correlations and -2 */
- const Word16 L_subfr, /* i : vector length */
- const Word16 norm_flag /* i : flag for constraining pitch contribution */
- ,
- Flag *Overflow_out /* o : propagating the Overflow flag to upper level */
+/* o : pitch gain (0..GAIN_PIT_MAX) */
+Word16 corr_xy1_fx(
+ const Word16 xn_1[], /* i : target signal */
+ const Word16 y1_1[], /* i : filtered adaptive codebook excitation */
+ Word16 g_corr[], /* o : correlations and -2 */
+ const Word16 L_subfr, /* i : vector length */
+ const Word16 norm_flag, /* i : flag for constraining pitch contribution */
+ Flag *Overflow_out /* o : propagating the Overflow flag to upper level */
);
-Word16 E_ACELP_indexing_fx( const Word16 code[] /*Q9*/, const PulseConfig *config, Word16 num_tracks /*Q0*/, Word16 prm[] /*Q(shift_bits)*/ );
-void fcb_pulse_track_joint_fx( UWord16 *idxs /*Q0*/, Word16 wordcnt /*Q0*/, UWord32 *index_n /*Q0*/, Word16 *pulse_num /*Q0*/, Word16 track_num /*Q0*/ );
+Word16 E_ACELP_indexing_fx(
+ const Word16 code[] /*Q9*/,
+ const PulseConfig *config,
+ Word16 num_tracks /*Q0*/,
+ Word16 prm[] /*Q(shift_bits)*/ );
+
+void fcb_pulse_track_joint_fx(
+ UWord16 *idxs /*Q0*/,
+ Word16 wordcnt /*Q0*/,
+ UWord32 *index_n /*Q0*/,
+ Word16 *pulse_num /*Q0*/,
+ Word16 track_num /*Q0*/ );
+
+/* o: quantization index */
+Word16 gain_quant_fx(
+ Word32 *gain, /* i/o: quantized gain */
+ Word16 *gain16,
+ const Word16 c_min, /* i: log10 of lower limit in Q14 */
+ const Word16 c_max, /* i: log10 of upper limit in Q13 */
+ const Word16 bits, /* i: number of bits to quantize */
+ Word16 *expg );
-Word16 gain_quant_fx( /* o: quantization index */
- Word32 *gain, /* i/o: quantized gain */
- Word16 *gain16,
- const Word16 c_min, /* i: log10 of lower limit in Q14 */
- const Word16 c_max, /* i: log10 of upper limit in Q13 */
- const Word16 bits, /* i: number of bits to quantize */
- Word16 *expg );
void gsc_enc_fx(
Encoder_State *st_fx, /* i/o: State structure */
Word16 res_dct_in[], /* i : dct of residual signal */
@@ -984,46 +991,23 @@ void pit16k_Q_enc_fx(
Word16 *T0_min, /* i/o: delta search min */
Word16 *T0_max /* o : delta search max */
);
-
-void pit16k_Q_enc_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 nBits, /* i : # of Q bits */
- const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */
- const Word16 T0, /* i : integer pitch lag */
- const Word16 T0_frac, /* i : pitch fraction */
- Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* o : delta search max_val */
-);
-
-Word16 pitch_fr4_fx( /* o : chosen integer pitch lag */
- const Word16 exc[], /* i : excitation buffer Q_new*/
- const Word16 xn[], /* i : target signal Q_new-1+shift*/
- const Word16 h[], /* i : weighted synthesis filter impulse response Q(14+shift)*/
- const Word16 t0_min, /* i : minimum value in the searched range. Q0*/
- const Word16 t0_max, /* i : maximum value in the searched range. Q0*/
- Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */
- const Word16 i_subfr, /* i : flag to first subframe */
- const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */
- const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */
- const Word16 t0_fr1, /* i : minimum value for resolution 1 */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 L_subfr /* i : size of subframe */
-);
-
-Word16 pitch_fr4_ivas_fx( /* o : chosen integer pitch lag */
- const Word16 exc[], /* i : excitation buffer Q_new */
- const Word16 xn[], /* i : target signal Q_new-1 */
- const Word16 h[], /* i : weighted synthesis filter impulse response Q(14 - norm_s[h[0]) */
- const Word16 t0_min, /* i : minimum value in the searched range. Q0 */
- const Word16 t0_max, /* i : maximum value in the searched range. Q0 */
- Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */
- const Word16 i_subfr, /* i : flag to first subframe */
- const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */
- const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */
- const Word16 t0_fr1, /* i : minimum value for resolution 1 */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 L_subfr, /* i : size of subframe */
- Word16 Q_new /* i */
+/* o : chosen integer pitch lag */
+Word16 pitch_fr4_fx(
+ const Word16 exc[], /* i : excitation buffer Q_new*/
+ const Word16 xn[], /* i : target signal Q_new-1+shift*/
+ const Word16 h[], /* i : weighted synthesis filter impulse response Q(14+shift)*/
+ const Word16 t0_min, /* i : minimum value in the searched range. Q0*/
+ const Word16 t0_max, /* i : maximum value in the searched range. Q0*/
+ Word16 *pit_frac, /* o : chosen fraction (0, 1, 2 or 3) */
+ const Word16 i_subfr, /* i : flag to first subframe */
+ const Word16 limit_flag, /* i : flag for limits (0=restrained, 1=extended) */
+ const Word16 t0_fr2, /* i : minimum value for resolution 1/2 */
+ const Word16 t0_fr1, /* i : minimum value for resolution 1 */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 L_subfr /* i : size of subframe */
+ ,
+ const Word16 element_mode, /* i : mode element */
+ const Word16 Q_new /* i : scaling factor */
);
void pit_Q_enc_fx(
@@ -1039,22 +1023,11 @@ void pit_Q_enc_fx(
Word16 *T0_max /* o : delta search max */
);
-void pit_Q_enc_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 nBits, /* i : # of Q bits */
- const Word16 delta, /* i : Half the CL searched interval */
- const Word16 pit_flag, /* i : absolute(0) or delta(1) pitch Q */
- const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */
- const Word16 T0, /* i : integer pitch lag */
- const Word16 T0_frac, /* i : pitch fraction */
- Word16 *T0_min, /* i/o: delta search min */
- Word16 *T0_max /* o : delta search max_val */
-);
+void PsychAdaptLowFreqEmph_fx(
+ Word32 x[],
+ const Word16 lpcGains[],
+ const Word16 lpcGains_e[] );
-void PsychAdaptLowFreqEmph_fx( Word32 x[],
- const Word16 lpcGains[],
- const Word16 lpcGains_e[] );
void set_bw_fx(
const Word16 element_mode, /* i : element mode */
const Word32 element_brate, /* i : element bitrate */
@@ -1066,20 +1039,22 @@ void set_bw_stereo_fx(
CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structures */
);
-Word16 WB_BWE_encoding_fx( /* o : classification of wb signal */
- const Word16 coder_type, /* i : coder type */
- const Word16 *yos_fx, /* i : MDCT coefficients of weighted original */
- Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */
- Encoder_State *st_fx, /* i/o: Encoder structure */
- Word16 Q_synth,
- Word16 Q_synth_lf );
+/* o : classification of wb signal */
+Word16 WB_BWE_encoding_fx(
+ const Word16 coder_type, /* i : coder type */
+ const Word16 *yos_fx, /* i : MDCT coefficients of weighted original */
+ Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */
+ Encoder_State *st_fx, /* i/o: Encoder structure */
+ Word16 Q_synth,
+ Word16 Q_synth_lf );
-Word16 WB_BWE_encoding_ivas_fx( /* o : classification of wb signal */
- Encoder_State *st_fx, /* i/o: Encoder structure */
- const Word32 *yos_fx, /* i : MDCT coefficients of weighted original */
- Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */
- Word16 Q_synth,
- Word16 Q_synth_lf );
+/* o : classification of wb signal */
+Word16 WB_BWE_encoding_ivas_fx(
+ Encoder_State *st_fx, /* i/o: Encoder structure */
+ const Word32 *yos_fx, /* i : MDCT coefficients of weighted original */
+ Word16 *WB_fenv_fx, /* i/o: energy of WB envelope */
+ Word16 Q_synth,
+ Word16 Q_synth_lf );
void calculate_hangover_attenuation_gain_fx(
Encoder_State *st, /* i : encoder state structure */
@@ -1095,14 +1070,16 @@ void calculate_hangover_attenuation_gain_fx(
* Don't include the delay of the MDCT overlap.
* @param pTransientDetection Structure to be initialized. It contains all transient detectors to be used.
*/
-void InitTransientDetection_fx( Word16 nFrameLength,
- Word16 nTCXDelay,
- struct TransientDetection *pTransientDetection );
+void InitTransientDetection_fx(
+ const Word16 nFrameLength,
+ const Word16 nTCXDelay,
+ TRAN_DET_HANDLE hTranDet );
-void InitTransientDetection_ivas_fx( Word16 nFrameLength,
- Word16 nTCXDelay,
- TRAN_DET_HANDLE pTransientDetection,
- const Word16 ext_mem_flag );
+void InitTransientDetection_ivas_fx(
+ const Word16 nFrameLength,
+ const Word16 nTCXDelay,
+ TRAN_DET_HANDLE pTransientDetection,
+ const Word16 ext_mem_flag );
/** Runs transient detection.
* Runs all transient detectors defined in pTransientDetection
@@ -1111,7 +1088,10 @@ void InitTransientDetection_ivas_fx( Word16 nFrameLength,
* @param nSamplesAvailable Number of new i samples available.
* @param pTransientDetection Structure that contains transient detectors to be run.
*/
-void RunTransientDetection_fx( Word16 const *i, Word16 nSamplesAvailable, struct TransientDetection *pTransientDetection );
+void RunTransientDetection_fx(
+ Word16 const *i,
+ const Word16 nSamplesAvailable,
+ TRAN_DET_HANDLE hTranDet );
void RunTransientDetection_ivas_fx(
@@ -1128,8 +1108,15 @@ void RunTransientDetection_ivas_fx(
* @param nPrevSubblocks Number of subblocks from the previous frames to use for the calculation.
* @return average temporal flatness measure with exponent AVG_FLAT_E
*/
-Word16 GetTCXAvgTemporalFlatnessMeasure_fx( struct TransientDetection const *pTransientDetection, Word16 nCurrentSubblocks, Word16 nPrevSubblocks );
-Word32 GetTCXAvgTemporalFlatnessMeasure_ivas_fx( struct TransientDetection const *pTransientDetection, Word16 nCurrentSubblocks, Word16 nPrevSubblocks );
+Word16 GetTCXAvgTemporalFlatnessMeasure_fx(
+ TRAN_DET_HANDLE hTranDetn,
+ const Word16 nCurrentSubblocks,
+ const Word16 nPrevSubblocks );
+
+Word32 GetTCXAvgTemporalFlatnessMeasure_ivas_fx(
+ TRAN_DET_HANDLE hTranDet,
+ const Word16 nCurrentSubblocks,
+ const Word16 nPrevSubblocks );
/** Get the maximum energy change using subblock energies aligned with the TCX.
* @param pTransientDetection Structure that contains transient detectors to be run.
@@ -1138,16 +1125,18 @@ Word32 GetTCXAvgTemporalFlatnessMeasure_ivas_fx( struct TransientDetection const
* @param nPrevSubblocks Number of subblocks from the previous frames to use for the calculation.
* @param maximum energy change with exponent NRG_CHANGE_E
*/
-Word16 GetTCXMaxenergyChange_fx( struct TransientDetection const *pTransientDetection,
- const Word8 isTCX10,
- const Word16 nCurrentSubblocks,
- const Word16 nPrevSubblocks );
+Word16 GetTCXMaxenergyChange_fx(
+ TRAN_DET_HANDLE hTranDet,
+ const Word8 isTCX10,
+ const Word16 nCurrentSubblocks,
+ const Word16 nPrevSubblocks );
-Word16 GetTCXMaxenergyChange_ivas_fx( TRAN_DET_HANDLE hTranDet,
- const Word8 isTCX10,
- const Word16 nCurrentSubblocks,
- const Word16 nPrevSubblocks );
+Word16 GetTCXMaxenergyChange_ivas_fx(
+ TRAN_DET_HANDLE hTranDet,
+ const Word8 isTCX10,
+ const Word16 nCurrentSubblocks,
+ const Word16 nPrevSubblocks );
/** Set TCX window length and overlap configuration
* @param prevEnergyHF previous HF energy. Exponent must be the same as for currEnergyHF.
@@ -1163,13 +1152,15 @@ void SetTCXModeInfo_ivas_fx(
* @param prevEnergyHF previous HF energy. Exponent must be the same as for currEnergyHF.
* @param currEnergyHF current HF energy. Exponent must be the same as for prevEnergyHF.
*/
-void SetTCXModeInfo_fx( Encoder_State *st,
- struct TransientDetection const *pTransientDetection,
- Word16 *tcxModeOverlap );
+void SetTCXModeInfo_fx(
+ Encoder_State *st,
+ TRAN_DET_HANDLE hTranDet,
+ Word16 *tcxModeOverlap );
void GSC_enc_init_fx(
GSC_ENC_HANDLE hGSCEnc /* i/o: GSC data handle */
);
+
void td_cng_enc_init_fx(
TD_CNG_ENC_HANDLE hTdCngEnc, /* i/o: DTX/TD CNG data handle */
const Word16 Opt_DTX_ON, /* i : flag indicating DTX operation Q0*/
@@ -1187,6 +1178,7 @@ void dtx_enc_init_fx(
const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate Q0*/
const Word16 interval_SID /* i : interval for SID update Q0*/
);
+
void select_TC_fx(
const Word16 codec_mode, /* i : codec mode */
const Word16 tc_cnt, /* i : TC frame counter */
@@ -1216,6 +1208,7 @@ void pitchDoubling_det_fx(
Word16 *pitch_ol,
Word16 *T_op_fr,
Word16 *voicing_fr );
+
void fd_bwe_enc_init_fx(
FD_BWE_ENC_HANDLE hBWE_FD /* i/o: FD BWE data handle */
);
@@ -1258,6 +1251,7 @@ void ProcessIGF_fx(
Word16 isTransition, /**< in: flag indicating if the i is the transition from from ACELP to TCX20/TCX10 */
Word16 frameno /**< in: flag indicating index of current subframe */
);
+
void AnalyzePowerSpectrum_fx(
Encoder_State *st, /* i/o: encoder states */
Word16 L_frame, /* i : frame length */
@@ -1283,35 +1277,40 @@ void AnalyzePowerSpectrum_ivas_fx(
Word32 powerSpec[], /* o : Power spectrum. Can point to signal */
Word16 powerSpec_e[] );
-void AdaptLowFreqEmph_fx( Word32 x[],
- Word16 x_e,
- Word16 xq[],
- Word16 invGain,
- Word16 invGain_e,
- Word16 tcx_lpc_shaped_ari,
- Word16 lpcGains[],
- Word16 lpcGains_e[],
- const Word16 lg );
-Word16 SQ_gain_fx( /* o : SQ gain */
- Word32 x[], /* i : vector to quantize */
- Word16 x_e, /* i : exponent */
- Word16 nbitsSQ, /* i : number of bits targeted */
- Word16 lg, /* i : vector size (2048 max) */
- Word16 *gain_e ); /* o : SQ gain exponent */
-
-Word16 SQ_gain_ivas_fx( /* o : SQ gain */
- Word32 x[], /* i : vector to quantize */
- Word16 x_e, /* i : exponent */
- Word16 nbitsSQ, /* i : number of bits targeted */
- Word16 lg, /* i : vector size (2048 max) */
- Word16 *gain_e ); /* o : SQ gain exponent */
-
-Word16 SQ_gain_estimate_fx( /* o : SQ gain */
- Word32 x[], /* i : vector to quantize */
- Word16 x_e, /* i : exponent */
- Word16 nbitsSQ, /* i : number of bits targeted */
- Word16 lg, /* i : vector size (2048 max) */
- Word16 *gain_e ); /* o : SQ gain exponent */
+void AdaptLowFreqEmph_fx(
+ Word32 x[],
+ Word16 x_e,
+ Word16 xq[],
+ Word16 invGain,
+ Word16 invGain_e,
+ Word16 tcx_lpc_shaped_ari,
+ Word16 lpcGains[],
+ Word16 lpcGains_e[],
+ const Word16 lg );
+
+/* o : SQ gain */
+Word16 SQ_gain_fx(
+ Word32 x[], /* i : vector to quantize */
+ Word16 x_e, /* i : exponent */
+ Word16 nbitsSQ, /* i : number of bits targeted */
+ Word16 lg, /* i : vector size (2048 max) */
+ Word16 *gain_e ); /* o : SQ gain exponent */
+
+/* o : SQ gain */
+Word16 SQ_gain_ivas_fx(
+ Word32 x[], /* i : vector to quantize */
+ Word16 x_e, /* i : exponent */
+ Word16 nbitsSQ, /* i : number of bits targeted */
+ Word16 lg, /* i : vector size (2048 max) */
+ Word16 *gain_e ); /* o : SQ gain exponent */
+
+/* o : SQ gain */
+Word16 SQ_gain_estimate_fx(
+ Word32 x[], /* i : vector to quantize */
+ Word16 x_e, /* i : exponent */
+ Word16 nbitsSQ, /* i : number of bits targeted */
+ Word16 lg, /* i : vector size (2048 max) */
+ Word16 *gain_e ); /* o : SQ gain exponent */
void tcx_scalar_quantization_fx(
Word32 *x, /* i: i coefficients */
@@ -1489,19 +1488,21 @@ Word16 tcx_res_Q_spec_ivas_fx(
const Word16 lf_deemph_factors[] );
/* compute noise-measure flags for spectrum filling and quantization (0: tonal, 1: noise-like) */
-void ComputeSpectrumNoiseMeasure_fx( const Word32 *powerSpec,
- Word16 L_frame,
- Word16 startLine,
- Word8 resetMemory,
- Word8 *noiseFlags,
- Word16 lowpassLine );
+void ComputeSpectrumNoiseMeasure_fx(
+ const Word32 *powerSpec,
+ Word16 L_frame,
+ Word16 startLine,
+ Word8 resetMemory,
+ Word8 *noiseFlags,
+ Word16 lowpassLine );
-void ComputeSpectrumNoiseMeasure_ivas_fx( Word64 *powerSpec, /* Qx */
- Word16 L_frame, /* Q0 */
- Word16 startLine, /* Q0 */
- Word8 resetMemory, /* Q0 */
- Word8 *noiseFlags, /* Q0 */
- Word16 lowpassLine /* Q0 */
+void ComputeSpectrumNoiseMeasure_ivas_fx(
+ Word64 *powerSpec, /* Qx */
+ Word16 L_frame, /* Q0 */
+ Word16 startLine, /* Q0 */
+ Word8 resetMemory, /* Q0 */
+ Word8 *noiseFlags, /* Q0 */
+ Word16 lowpassLine /* Q0 */
);
void lpc_quantization_fx(
@@ -1557,26 +1558,16 @@ void Mode2_pit_encode_fx(
Word16 pit_fr2,
Word16 pit_max,
Word16 pit_res_max );
-void E_ACELP_4tsearch_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ );
-
-void E_ACELP_4tsearch_ivas_fx( Word16 dn[] /*Qdn*/, const Word16 cn[] /*Q_xn*/, const Word16 H[] /*Q12*/, Word16 code[] /*Q9*/, const PulseConfig *config, Word16 ind[] /*Q0*/, Word16 y[] /*Qy*/ );
-
+void E_ACELP_4tsearch_fx(
+ Word16 dn[] /*Qdn*/,
+ const Word16 cn[] /*Q_xn*/,
+ const Word16 H[] /*Q12*/,
+ Word16 code[] /*Q9*/,
+ const PulseConfig *config,
+ Word16 ind[] /*Q0*/,
+ Word16 y[] /*Qy*/,
+ const Word16 element_mode );
void E_ACELP_4t_fx(
- Word16 dn[], /* Qdn */
- Word16 cn[] /* Q_xn */,
- Word16 H[], /* Q12 */
- Word16 R[], /* Qx */
- Word8 acelpautoc,
- Word16 code[], /* Q9 */
- Word16 cdk_index,
- Word16 _index[],
- const Word16 L_frame,
- const Word16 last_L_frame,
- const Word32 total_brate,
- const Word16 i_subfr,
- const Word16 cmpl_flag );
-
-void E_ACELP_4t_ivas_fx(
Word16 dn[], /* Qdn */
Word16 cn[] /* Q_xn */,
Word16 H[], /* Q12 */
@@ -1590,7 +1581,8 @@ void E_ACELP_4t_ivas_fx(
const Word32 total_brate,
const Word16 i_subfr,
const Word16 cmpl_flag,
- Word16 element_mode );
+ const Word16 element_mode /*Q0*/
+);
void E_ACELP_innovative_codebook_fx(
Word16 *exc, /* i : pointer to the excitation frame Q_new */
@@ -1632,10 +1624,11 @@ void CalculateTnsFilt_fx(
* @param pTnsData TNS data is filled with sensible information.
* @return Returns 1 if Tns should be used, otherwise 0.
*/
-Word16 DetectTnsFilt_fx( STnsConfig const *pTnsConfig,
- Word32 const pSpectrum[],
- STnsData *pTnsData,
- Word16 *predictionGain );
+Word16 DetectTnsFilt_fx(
+ STnsConfig const *pTnsConfig,
+ Word32 const pSpectrum[],
+ STnsData *pTnsData,
+ Word16 *predictionGain );
/** Detect TNS parameters.
* Detects if TNS should be used and fills TNS data in pTnsData.
@@ -1646,13 +1639,14 @@ TNS is tested on the spectrum defined by pSpectrum.
* @param pTnsData TNS data is filled with sensible information.
* @return Returns 1 if Tns should be used, otherwise 0.
*/
-Word16 DetectTnsFilt_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */
- Word32 const pSpectrum[], /* i : MDCT spectrum Q=Qx */
- STnsData *pTnsData, /* o : TNS data struct */
- TRAN_DET_HANDLE hTranDet, /* i : transient detection handle */
- Word8 isTCX10, /* i : TCX10 or TCX20? */
- Word16 ltp_gain, /* i : LTP gain Q=15 */
- Word16 *predictionGain /* o : TNS prediction gain Q=7 */
+Word16 DetectTnsFilt_ivas_fx(
+ STnsConfig const *pTnsConfig, /* i : TNS Configuration struct */
+ Word32 const pSpectrum[], /* i : MDCT spectrum Q=Qx */
+ STnsData *pTnsData, /* o : TNS data struct */
+ TRAN_DET_HANDLE hTranDet, /* i : transient detection handle */
+ Word8 isTCX10, /* i : TCX10 or TCX20? */
+ Word16 ltp_gain, /* i : LTP gain Q=15 */
+ Word16 *predictionGain /* o : TNS prediction gain Q=7 */
);
@@ -1665,11 +1659,12 @@ Word16 DetectTnsFilt_ivas_fx( STnsConfig const *pTnsConfig, /* i : TNS Configur
* @param pnBits Set to the number of required.
* @return 0 on success, otherwise 1.
*/
-Word16 EncodeTnsData_fx( STnsConfig const *pTnsConfig,
- STnsData const *pTnsData,
- Word16 *stream,
- Word16 *pnSize,
- Word16 *pnBits );
+Word16 EncodeTnsData_fx(
+ STnsConfig const *pTnsConfig,
+ STnsData const *pTnsData,
+ Word16 *stream,
+ Word16 *pnSize,
+ Word16 *pnBits );
/** Write TNS data into a bitstream.
* Writes TNS data into a bitstream.
@@ -1680,17 +1675,19 @@ Word16 EncodeTnsData_fx( STnsConfig const *pTnsConfig,
* @param pnBits Set to the number of bits written.
* @return 0 on success, otherwise 1.
*/
-Word16 WriteTnsData_fx( STnsConfig const *pTnsConfig,
- Word16 const *stream,
- Word16 *pnSize,
- Encoder_State *st,
- Word16 *pnBits );
-
-Word16 WriteTnsData_ivas_fx( STnsConfig const *pTnsConfig,
- Word16 const *stream,
- Word16 *pnSize,
- BSTR_ENC_HANDLE hBstr,
- Word16 *pnBits );
+Word16 WriteTnsData_fx(
+ STnsConfig const *pTnsConfig,
+ Word16 const *stream,
+ Word16 *pnSize,
+ Encoder_State *st,
+ Word16 *pnBits );
+
+Word16 WriteTnsData_ivas_fx(
+ STnsConfig const *pTnsConfig,
+ Word16 const *stream,
+ Word16 *pnSize,
+ BSTR_ENC_HANDLE hBstr,
+ Word16 *pnBits );
void subband_FFT_fx(
Word32 **Sr, /*(i) real part of the CLDFB*/
@@ -1706,7 +1703,13 @@ Word16 E_ACELP_toeplitz_mul_fx(
const Word16 L_subfr, /* Q0 */
const Word16 highrate /* Q0 */
);
-Word16 E_ACELP_code43bit_fx( const Word16 code[], UWord32 *ps, Word16 *p, UWord16 idxs[] );
+
+Word16 E_ACELP_code43bit_fx(
+ const Word16 code[],
+ UWord32 *ps,
+ Word16 *p,
+ UWord16 idxs[] );
+
void tc_classif_enc_fx(
const Word16 Q_new, /* i : scaling factor */
const Word16 L_frame, /* i : length of the frame */
@@ -1731,6 +1734,7 @@ Word16 gain_enc_uv_fx(
Word16 *gain_inov, /*0=rel */
- const Word32 sr_core /* i : internal sampling rate */
+/* o : number of allocated bits */
+Word16 vlpc_2st_cod_fx(
+ const Word16 *lsf, /* i : normalized vector to quantize */
+ Word16 *lsfq, /* i/o: i:1st stage o:1st+2nd stage */
+ Word16 *indx, /* o : index[] (4 bits per words) */
+ const Word16 mode, /* i : 0=abs, >0=rel */
+ const Word32 sr_core /* i : internal sampling rate */
);
Word16 update_decision_fx(
@@ -3237,9 +3308,10 @@ void spec_center_fx(
const Word16 Q_sb_p /* i : the Scaling of sb_power*/
);
-void spec_flatness_fx( Word32 *spec_amp, /*(i) spectral amplitude*/
- Word32 smooth_spec_amp[], /*(i) smoothed spectral amplitude*/
- Word16 sSFM[SFM_NUM] /*(o) spectral flatness rate*/
+void spec_flatness_fx(
+ Word32 *spec_amp, /*(i) spectral amplitude*/
+ Word32 smooth_spec_amp[], /*(i) smoothed spectral amplitude*/
+ Word16 sSFM[SFM_NUM] /*(o) spectral flatness rate*/
);
void SetModeIndex_fx(
@@ -3260,6 +3332,7 @@ void MDCT_selector_fx(
void MDCT_selector_reset_fx(
TCX_ENC_HANDLE hTcxEnc );
+
void MDCT_classifier_reset_fx(
TCX_ENC_HANDLE hTcxEnc /* i/o: TCX Encoder Handle */
);
@@ -3271,6 +3344,7 @@ void ltd_stable_fx(
const Word16 frameloop, /* i : amount of frames*/
const Word16 Q_frames_power /* i : the Scaling of frames_power*/
);
+
/* IGFSCFEncoder.c */
void IGFSCFEncoderOpen_fx(
IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
@@ -3336,22 +3410,23 @@ void background_update_fx(
);
/* enc_gain.c */
-Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/
- Word16 xn[], /*Q_xn*/
- Word16 h[], /* Q14+shift */
- Word16 t0_min,
- Word16 t0_min_frac,
- Word16 t0_max,
- Word16 t0_max_frac,
- Word16 t0_min_max_res,
- Word16 *pit_frac,
- Word16 *pit_res,
- Word16 pit_res_max,
- Word16 i_subfr,
- Word16 pit_min,
- Word16 pit_fr2,
- Word16 pit_fr1,
- Word16 L_subfr );
+Word16 E_GAIN_closed_loop_search_fx(
+ Word16 exc[], /*Q_new*/
+ Word16 xn[], /*Q_xn*/
+ Word16 h[], /* Q14+shift */
+ Word16 t0_min,
+ Word16 t0_min_frac,
+ Word16 t0_max,
+ Word16 t0_max_frac,
+ Word16 t0_min_max_res,
+ Word16 *pit_frac,
+ Word16 *pit_res,
+ Word16 pit_res_max,
+ Word16 i_subfr,
+ Word16 pit_min,
+ Word16 pit_fr2,
+ Word16 pit_fr1,
+ Word16 L_subfr );
void core_acelp_tcx20_switching_fx(
Encoder_State *st, /* i/o: encoder state structure */
@@ -3377,6 +3452,7 @@ Word16 comvad_decision_fx(
const Word16 frame_energy_Q, /*(i) the Scaling of current frame energy*/
Word16 *cldfb_addition, /*(o) adjust the harmonized hangover */
const Word16 vada_flag );
+
void amr_wb_enc_init_fx(
AMRWB_IO_ENC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO encoder handle */
);
@@ -3389,6 +3465,7 @@ void snr_calc(
const Word32 frame_energy, /* i : current frame energy sacle_sbpower*/
const Word32 bwidth /* i : audio band width Q0*/
);
+
void FEC_encode_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const ACELP_config acelp_cfg, /* i/o: configuration of the ACELP */
@@ -3424,49 +3501,31 @@ void update_average_rate_fx(
SC_VBR_ENC_HANDLE hSC_VBR, /* i/o: SC-VBR state structure */
const Word32 core_brate_fx /* i : core bitrate */
);
-Word16 pit_encode_fx( /* o : Fractional pitch for each subframe */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 pitch_bits[], /* i : pitch bits */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
- Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
- const Word16 i_subfr, /* i : subframe index */
- Word16 *exc, /* i/o: pointer to excitation signal frame */
- const Word16 L_subfr, /* i : subframe length */
- const Word16 *T_op, /* i : open loop pitch estimates in current frame */
- Word16 *T0_min, /* i/o: lower limit for close-loop search */
- Word16 *T0_max, /* i/o: higher limit for close-loop search */
- Word16 *T0, /* i/o: close loop integer pitch */
- Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */
- const Word16 *h1, /* i : weighted filter i response */
- const Word16 *xn, /* i : target vector */
- const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
- const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
-);
-
-Word16 pit_encode_ivas_fx( /* o : Fractional pitch for each subframe */
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 pitch_bits[], /* i : pitch bits */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
- Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
- const Word16 i_subfr, /* i : subframe index */
- Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */
- const Word16 L_subfr, /* i : subframe length */
- const Word16 *pitch, /* i : open loop pitch estimates in current frame */
- Word16 *T0_min, /* i/o: lower limit for close-loop search */
- Word16 *T0_max, /* i/o: higher limit for close-loop search */
- Word16 *T0, /* i/o: close loop integer pitch */
- Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */
- const Word16 *h1, /* i : weighted filter input response Q(14 - norm_s(h1[0]) */
- const Word16 *xn, /* i : target vector Q_new */
- const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
- const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */
- Word16 Q_new /* i */
+
+/* o : Fractional pitch for each subframe */
+Word16 pit_encode_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 pitch_bits[], /* i : pitch bits */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 coder_type, /* i : coding type */
+ Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
+ const Word16 i_subfr, /* i : subframe index */
+ Word16 *exc, /* i/o: pointer to excitation signal frame */
+ const Word16 L_subfr, /* i : subframe length */
+ const Word16 *T_op, /* i : open loop pitch estimates in current frame */
+ Word16 *T0_min, /* i/o: lower limit for close-loop search */
+ Word16 *T0_max, /* i/o: higher limit for close-loop search */
+ Word16 *T0, /* i/o: close loop integer pitch */
+ Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */
+ const Word16 *h1, /* i : weighted filter i response */
+ const Word16 *xn, /* i : target vector */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
+ ,
+ const Word16 element_mode, /* i : mode element */
+ const Word16 Q_new /* i : scaling factor */
);
Word16 lp_filt_exc_enc_fx(
@@ -3486,23 +3545,6 @@ Word16 lp_filt_exc_enc_fx(
Word16 *lp_flag /* i/o: mode selection Q0 */
);
-Word16 lp_filt_exc_enc_ivas_fx(
- const Word16 codec_mode, /* i : MODE1 or MODE2 Q0 */
- const Word16 coder_type, /* i : coding type Q0 */
- const Word16 i_subfr, /* i : subframe index Q0 */
- Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */
- const Word16 *h1, /* i : weighted filter i response Q(15) */
- const Word16 *xn, /* i : target vector Q_new-1+shift */
- Word16 *y1, /* o : zero-memory filtered adaptive excitation Q_new-1+shift */
- Word16 *xn2, /* o : target vector for innovation search Q_new-1+shift */
- const Word16 L_subfr, /* i : length of vectors for gain quantization Q0 */
- const Word16 L_frame, /* i : frame size Q0 */
- Word16 *g_corr, /* o : ACELP correlation values mant/exp */
- const Word16 clip_gain, /* i : adaptive gain clipping flag Q0 */
- Word16 *gain_pit, /* o : adaptive excitation gain Q14 */
- Word16 *lp_flag /* i/o: mode selection Q0 */
-);
-
Word16 inov_encode_fx(
Encoder_State *st_fx, /* i/o: encoder state structure */
const Word32 core_brate, /* i : core bitrate */
@@ -3574,27 +3616,6 @@ void gain_enc_mless_fx(
Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 Qx*/
const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/
);
-
-void gain_enc_mless_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 element_mode, /* i : element mode Q0*/
- const Word16 L_frame, /* i : length of the frame Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 tc_subfr, /* i : TC subframe index Q0*/
- const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 Q_xn, /* i : xn and y1 scaling */
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
- const Word16 *code, /* i : algebraic excitation Q9*/
- const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/
- Word16 *gain_pit, /* o : quantized pitch gain Q14*/
- Word32 *gain_code, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 Qx*/
- const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) Q0*/
-);
void updt_IO_switch_enc_fx(
Encoder_State *st, /* i/o: state structure */
const Word16 input_frame /* i : i frame length */
@@ -3682,7 +3703,6 @@ void gain_enc_amr_wb_fx(
Word16 *past_qua_en /* i/o: gain quantization memory (4 words) Q10*/
);
-
void hf_cod_fx(
const Word32 core_brate_fx, /* i : core bitrate */
const Word16 *speech16k_fx, /* i : original speech at 16 kHz */
@@ -3769,29 +3789,9 @@ void gain_enc_lbr_fx(
Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/
const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
const Word16 L_subfr /* i : subframe length Q0*/
+ ,
+ const Word16 element_mode /* i : mode element Q0*/
);
-
-void gain_enc_lbr_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 coder_type, /* i : coding type Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 Q_xn, /* i : xn and y1 format */
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
- const Word16 *code, /* i : algebraic excitation Q9*/
- Word16 *gain_pit, /* o : quantized pitch gain Q14*/
- Word32 *gain_code, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/
- Word32 gc_mem[], /* i/o: gain_code from previous subframes Q16*/
- Word16 gp_mem[], /* i/o: gain_pitch from previous subframes Q14*/
- const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
- const Word16 L_subfr /* i : subframe length Q0*/
-);
-
void gain_enc_SQ_fx(
BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 gains_mode[], /* i : gain bits Q0*/
@@ -3809,25 +3809,6 @@ void gain_enc_SQ_fx(
const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) Q0*/
const Word16 Q_xn /* i : xn and y1 scaling */
);
-
-void gain_enc_SQ_ivas_fx(
- BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
- const Word16 gains_mode[], /* i : gain bits Q0*/
- const Word16 i_subfr, /* i : subframe index Q0*/
- const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
- const Word16 *code, /* i : algebraic excitation Q9*/
- const Word16 Es_pred, /* i : predicted scaled innovation energy Q8*/
- Word16 *gain_pit, /* o : quantized pitch gain Q14*/
- Word32 *gain_code, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , ,, -2