[opus] opus code optimization

Pedro Becerra pbecerr at gmail.com
Fri Sep 6 17:09:53 PDT 2013


Hello,
I have attached a makefile that will build the OPUS library for
a TI-c64+ core.
If you are targeting a FIXED_POINT architecture,
the file celt/fixed_c6x.h has an unbalanced '#if 0' statement -
just add a '#endif' to fix it so that the build completes.

Change the OP_FLAGS macro to suit your optimization needs.

give it a try, or modify if your target is a different C6000 core.
-- Pedro Becerra

On 09/04/2013 12:35 PM, olivani wrote:
> The opus code default compiles on -o2 optimization level. I would like
> to change it to -o3. I have tried doing the changes in makefile.unix .
> The change is not getting reflected. I am building the code in Code
> composer studio for TI processor C6000. Could anybody help me with this
>
>
>
> _______________________________________________
> opus mailing list
> opus at xiph.org
> http://lists.xiph.org/mailman/listinfo/opus
>

-------------- next part --------------
# -*- mode: makefile-gmake -*-
#
# pbecerr at gmail.com  06-09-2013  Initial version
#
# Build OPUS library for Texas Instruments C64x device.
# This makefile borrows ideas from opus/Makefile.unix

# This makefile can be anywhere.  The build will create a
# subdirectory called $(CORE) for storing all the build targets.
# The top_srcdir macro locates the OPUS src tree.
top_srcdir = ../opus

CORE      = c64plus
ENDIAN    = little
ABI       = coffabi
#ABI       = eabi

# HOST OS support cmds - cygwin provides these for Windows
RM = rm
MKDIR = mkdir

# Locate the cross compiler
TOOLCHAIN_DIR ?= /opt/tools/ti/compiler/c6000_7.4.2
AR = $(TOOLCHAIN_DIR)/bin/ar6x
CC = $(TOOLCHAIN_DIR)/bin/cl6x

# -mn (Reenables optimizations disabled with -g)  --abi=eabi
# -mo (put each function into separate section)
CC_FLAGS = --gcc -pden -pdr -pdv -mo --abi=$(ABI)
# OP_FLAGS = -g -mn -O2 -ms
OP_FLAGS = -O3 -ms

ifeq ($(CORE),c64plus)
CC_FLAGS += -mv6400+
else
CC_FLAGS += -mv6400
endif

# disable specific compiler warnings/remarks
#  warning #9-D: nested comment not allowed
#  warning #1173-D: attribute "visibility" ignored
#  remark #195-D: zero used for undefined preprocessing identifier
#    for example:
#    #undef EMBEDDED_ARM
#    #if EMBEDDED_ARM
#  remark #179-D: variable "foo" was declared but never referenced
#  remark #238-D: controlling expression is constant
#    for example:
#    while(1) {whatever;}
CC_FLAGS += -pds=9 -pds=1173 -pds=195 -pds=179 -pds=238
# --printf_support=[full | nofloat | minimal ]
CC_FLAGS +=	--printf_support=nofloat

CC_DEFS   = CONFIG_TI_C6X ENABLE_ASSERTIONS TI_C6X_ASM
# 
# VAR_ARRAYS: Use C99 variable-length arrays for stack allocation
# If not defined, then the fallback is a non-threadsafe global array
# CC_DEFS += VAR_ARRAYS
CC_DEFS += NONTHREADSAFE_PSEUDOSTACK
CC_DEFS += OPUS_BUILD
CC_DEFS += FIXED_POINT DISABLE_FLOAT_API

include $(top_srcdir)/package_version
include $(top_srcdir)/silk_sources.mk
include $(top_srcdir)/celt_sources.mk
include $(top_srcdir)/opus_sources.mk

SILK_SOURCES += $(SILK_SOURCES_FIXED)

CC_INCL := $(top_srcdir)/include $(top_srcdir)/silk $(top_srcdir)/silk/fixed \
	$(top_srcdir)/celt $(top_srcdir)/src
CC_INCL += $(TOOLCHAIN_DIR)/include
VPATH = src:\
	$(top_srcdir)/silk:\
	$(top_srcdir)/silk/fixed:\
	$(top_srcdir)/celt:\
	$(top_srcdir)/src:

OBJDIR := $(CORE)
# Construct the library name
LIB_M := $(subst c64,64,$(CORE))
ifeq ($(ENDIAN), big)
LIB_M := $(LIB_M)e
CC_FLAGS += -me
endif
ifeq ($(ABI), eabi)
LIB_M := $(LIB_M)_elf
endif
OPUS_LIB = opus$(LIB_M).lib

CC_SRCS := $(notdir $(SILK_SOURCES) $(CELT_SOURCES) $(OPUS_SOURCES))
CC_OBJS := $(addprefix $(OBJDIR)/, $(CC_SRCS:.c=.obj) )
CC_DEPS := $(addprefix $(OBJDIR)/, $(CC_SRCS:.c=.d) )

CC_FLAGS +=	$(addprefix -D, $(CC_DEFS)) $(addprefix -I, $(CC_INCL))

.SECONDARY:

# Create $(OBJDIR) before any $(OBJS) are built.

PHONY := default
default: $(OBJDIR)/$(OPUS_LIB)

PHONY += all
all: default

$(CC_DEPS): | $(OBJDIR)
$(OBJDIR):
	$(MKDIR) -p $@

$(OBJDIR)/$(OPUS_LIB): $(CC_OBJS)
	$(AR) -ruv $@ $(CC_OBJS)

$(top_srcdir)/package_version: FORCE
	@if [ -x $(top_srcdir)/update_version ]; then \
		$(top_srcdir)/update_version || true; \
	elif [ ! -e $(top_srcdir)/package_version ]; then \
		echo 'PACKAGE_VERSION="unknown"' > $(top_srcdir)/package_version; \
	fi

$(OBJDIR)/celt.obj: CC_FLAGS += -DPACKAGE_VERSION='$(PACKAGE_VERSION)'
$(OBJDIR)/celt.obj: $(top_srcdir)/package_version

$(OBJDIR)/%.obj : %.c
	$(CC) -c $< -fe $@ -ppd=$(basename $@).d -ppa $(CC_FLAGS) $(OP_FLAGS)

PHONY += clean superclean
clean: 
	$(RM) -f $(OBJDIR)/*.obj $(OBJDIR)/*.d $(OBJDIR)/$(OPUS_LIB)

superclean:
	$(RM) -rf $(OBJDIR)/

PHONY += FORCE
FORCE:
.PHONY: $(PHONY)

ifneq ($(MAKECMDGOALS),clean)
-include $(CC_DEPS)
endif



More information about the opus mailing list