opus移植到freertos系統

硬件平臺:cortex-M4F 200MHZ平臺(RTL8721DM)

軟件系統:FREERTOS

編譯器:

Using built-in specs.
COLLECT_GCC=/home/kuili/sdk-amebad-beta_v5.3/project/realtek_amebaD_cm4_gcc_verification/asdk/../toolchain/linux/asdk-6.4.1/linux/newlib/bin/arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/home/kuili/sdk-amebad-beta_v5.3/project/realtek_amebaD_cm4_gcc_verification/toolchain/linux/asdk-6.4.1/linux/newlib/bin/../libexec/gcc/arm-none-eabi/6.4.1/lto-wrapper
Target: arm-none-eabi
Configured with: Realtek SDK Builder release 5
Thread model: single
gcc version 6.4.1 20180307 (Realtek ASDK-6.4.1 Build 2773)

OPUS下載地址(當前使用的是1.3-19的版本):

git clone https://github.com/xiph/opus.git

 OPUS需要編譯的源代碼:

CSRC =	$(DIR)/src/mapping_matrix.c \
		$(DIR)/src/repacketizer.c \
		$(DIR)/src/opus_projection_encoder.c \
		$(DIR)/src/analysis.c \
		$(DIR)/src/opus_projection_decoder.c \
		$(DIR)/src/opus_decoder.c \
		$(DIR)/src/mlp.c \
		$(DIR)/src/opus_multistream.c \
		$(DIR)/src/opus_encoder.c \
		$(DIR)/src/opus_multistream_decoder.c \
		$(DIR)/src/opus.c \
		$(DIR)/src/mlp_data.c \
		$(DIR)/src/opus_multistream_encoder.c \
		$(DIR)/silk/resampler_down2_3.c \
		$(DIR)/silk/stereo_decode_pred.c \
		$(DIR)/silk/process_NLSFs.c \
		$(DIR)/silk/init_encoder.c \
		$(DIR)/silk/resampler_private_AR2.c \
		$(DIR)/silk/stereo_find_predictor.c \
		$(DIR)/silk/biquad_alt.c \
		$(DIR)/silk/decoder_set_fs.c \
		$(DIR)/silk/PLC.c \
		$(DIR)/silk/decode_frame.c \
		$(DIR)/silk/resampler_down2.c \
		$(DIR)/silk/quant_LTP_gains.c \
		$(DIR)/silk/code_signs.c \
		$(DIR)/silk/VAD.c \
		$(DIR)/silk/HP_variable_cutoff.c \
		$(DIR)/silk/LPC_inv_pred_gain.c \
		$(DIR)/silk/decode_pulses.c \
		$(DIR)/silk/NLSF_stabilize.c \
		$(DIR)/silk/tables_gain.c \
		$(DIR)/silk/stereo_encode_pred.c \
		$(DIR)/silk/control_codec.c \
		$(DIR)/silk/ana_filt_bank_1.c \
		$(DIR)/silk/sort.c \
		$(DIR)/silk/NLSF_VQ.c \
		$(DIR)/silk/table_LSF_cos.c \
		$(DIR)/silk/enc_API.c \
		$(DIR)/silk/sum_sqr_shift.c \
		$(DIR)/silk/resampler_private_down_FIR.c \
		$(DIR)/silk/NLSF2A.c \
		$(DIR)/silk/resampler_rom.c \
		$(DIR)/silk/VQ_WMat_EC.c \
		$(DIR)/silk/init_decoder.c \
		$(DIR)/silk/dec_API.c \
		$(DIR)/silk/NLSF_decode.c \
		$(DIR)/silk/resampler.c \
		$(DIR)/silk/tables_NLSF_CB_WB.c \
		$(DIR)/silk/NSQ_del_dec.c \
		$(DIR)/silk/LP_variable_cutoff.c \
		$(DIR)/silk/NLSF_unpack.c \
		$(DIR)/silk/stereo_MS_to_LR.c \
		$(DIR)/silk/control_audio_bandwidth.c \
		$(DIR)/silk/control_SNR.c \
		$(DIR)/silk/NLSF_del_dec_quant.c \
		$(DIR)/silk/float/find_LPC_FLP.c \
		$(DIR)/silk/float/energy_FLP.c \
		$(DIR)/silk/float/residual_energy_FLP.c \
		$(DIR)/silk/float/schur_FLP.c \
		$(DIR)/silk/float/LTP_scale_ctrl_FLP.c \
		$(DIR)/silk/float/bwexpander_FLP.c \
		$(DIR)/silk/float/find_pred_coefs_FLP.c \
		$(DIR)/silk/float/scale_vector_FLP.c \
		$(DIR)/silk/float/apply_sine_window_FLP.c \
		$(DIR)/silk/float/k2a_FLP.c \
		$(DIR)/silk/float/encode_frame_FLP.c \
		$(DIR)/silk/float/scale_copy_vector_FLP.c \
		$(DIR)/silk/float/warped_autocorrelation_FLP.c \
		$(DIR)/silk/float/autocorrelation_FLP.c \
		$(DIR)/silk/float/LPC_inv_pred_gain_FLP.c \
		$(DIR)/silk/float/LPC_analysis_filter_FLP.c \
		$(DIR)/silk/float/find_LTP_FLP.c \
		$(DIR)/silk/float/wrappers_FLP.c \
		$(DIR)/silk/float/regularize_correlations_FLP.c \
		$(DIR)/silk/float/corrMatrix_FLP.c \
		$(DIR)/silk/float/find_pitch_lags_FLP.c \
		$(DIR)/silk/float/pitch_analysis_core_FLP.c \
		$(DIR)/silk/float/burg_modified_FLP.c \
		$(DIR)/silk/float/process_gains_FLP.c \
		$(DIR)/silk/float/sort_FLP.c \
		$(DIR)/silk/float/LTP_analysis_filter_FLP.c \
		$(DIR)/silk/float/noise_shape_analysis_FLP.c \
		$(DIR)/silk/float/inner_product_FLP.c \
		$(DIR)/silk/resampler_private_IIR_FIR.c \
		$(DIR)/silk/A2NLSF.c \
		$(DIR)/silk/encode_pulses.c \
		$(DIR)/silk/inner_prod_aligned.c \
		$(DIR)/silk/sigm_Q15.c \
		$(DIR)/silk/log2lin.c \
		$(DIR)/silk/arm/arm_silk_map.c \
		$(DIR)/silk/interpolate.c \
		$(DIR)/silk/bwexpander.c \
		$(DIR)/silk/decode_indices.c \
		$(DIR)/silk/bwexpander_32.c \
		$(DIR)/silk/gain_quant.c \
		$(DIR)/silk/decode_parameters.c \
		$(DIR)/silk/CNG.c \
		$(DIR)/silk/NLSF_VQ_weights_laroia.c \
		$(DIR)/silk/NLSF_encode.c \
		$(DIR)/silk/NSQ.c \
		$(DIR)/silk/lin2log.c \
		$(DIR)/silk/tables_pulses_per_block.c \
		$(DIR)/silk/stereo_LR_to_MS.c \
		$(DIR)/silk/tables_NLSF_CB_NB_MB.c \
		$(DIR)/silk/decode_pitch.c \
		$(DIR)/silk/debug.c \
		$(DIR)/silk/tables_pitch_lag.c \
		$(DIR)/silk/LPC_analysis_filter.c \
		$(DIR)/silk/LPC_fit.c \
		$(DIR)/silk/pitch_est_tables.c \
		$(DIR)/silk/encode_indices.c \
		$(DIR)/silk/stereo_quant_pred.c \
		$(DIR)/silk/decode_core.c \
		$(DIR)/silk/shell_coder.c \
		$(DIR)/silk/tables_other.c \
		$(DIR)/silk/resampler_private_up2_HQ.c \
		$(DIR)/silk/check_control_input.c \
		$(DIR)/silk/tables_LTP.c \
		$(DIR)/celt/mathops.c \
		$(DIR)/celt/mdct.c \
		$(DIR)/celt/rate.c \
		$(DIR)/celt/entcode.c \
		$(DIR)/celt/kiss_fft.c \
		$(DIR)/celt/laplace.c \
		$(DIR)/celt/cwrs.c \
		$(DIR)/celt/celt_decoder.c \
		$(DIR)/celt/celt.c \
		$(DIR)/celt/entenc.c \
		$(DIR)/celt/bands.c \
		$(DIR)/celt/celt_lpc.c \
		$(DIR)/celt/vq.c \
		$(DIR)/celt/celt_encoder.c \
		$(DIR)/celt/modes.c \
		$(DIR)/celt/pitch.c \
		$(DIR)/celt/arm/armcpu.c \
		$(DIR)/celt/arm/arm_celt_map.c \
		$(DIR)/celt/entdec.c \
		$(DIR)/celt/quant_bands.c

 opus的config配置如下:

/* config.h.  Generated from config.h.in by configure.  */
/* config.h.in.  Generated from configure.ac by autoheader.  */

/* Get CPU Info by asm method */
/* #undef CPU_INFO_BY_ASM */

/* Get CPU Info by c method */
/* #undef CPU_INFO_BY_C */

/* Custom modes */
/* #undef CUSTOM_MODES */

/* Do not build the float API */
/* #undef DISABLE_FLOAT_API */

/* Disable bitstream fixes from RFC 8251 */
/* #undef DISABLE_UPDATE_DRAFT */

/* Assertions */
/* #undef ENABLE_ASSERTIONS */

/* Hardening */
#define ENABLE_HARDENING 1

/* Debug fixed-point implementation */
/* #undef FIXED_DEBUG */

/* Compile as fixed-point (for machines without a fast enough FPU) */
/* #undef FIXED_POINT */
/* Float approximations */
/* #undef FLOAT_APPROX */

/* Fuzzing */
/* #undef FUZZING */

/* Define to 1 if you have the <alloca.h> header file. */
/* #undef HAVE_ALLOCA_H */

/* NE10 library is installed on host. Make sure it is on target! */
/* #undef HAVE_ARM_NE10 */

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the `lrint' function. */
#define HAVE_LRINT 1

/* Define to 1 if you have the `lrintf' function. */
#define HAVE_LRINTF 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if you have the `__malloc_hook' function. */
#define HAVE___MALLOC_HOOK 1

/* Define to the sub-directory in which libtool stores uninstalled libraries.
   */
#define LT_OBJDIR ".libs/"

/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */

/* Make use of ARM asm optimization */
/* #undef OPUS_ARM_ASM */

/* Use generic ARMv4 inline asm optimizations */
/* #undef OPUS_ARM_INLINE_ASM */

/* Use ARMv5E inline asm optimizations */
/* #undef OPUS_ARM_INLINE_EDSP */

/* Use ARMv6 inline asm optimizations */
/* #undef OPUS_ARM_INLINE_MEDIA */

/* Use ARM NEON inline asm optimizations */
/* #undef OPUS_ARM_INLINE_NEON */
#undef OPUS_ARM_INLINE_NEON

/* Define if assembler supports EDSP instructions */
/* #undef OPUS_ARM_MAY_HAVE_EDSP */

/* Define if assembler supports ARMv6 media instructions */
/* #undef OPUS_ARM_MAY_HAVE_MEDIA */

/* Define if compiler supports NEON instructions */
/* #undef OPUS_ARM_MAY_HAVE_NEON */

/* Compiler supports ARMv7/Aarch64 Neon Intrinsics */
//#define OPUS_ARM_MAY_HAVE_NEON_INTR 1

/* Define if binary requires Aarch64 Neon Intrinsics */
/* #undef OPUS_ARM_PRESUME_AARCH64_NEON_INTR */

/* Define if binary requires EDSP instruction support */
/* #undef OPUS_ARM_PRESUME_EDSP */

/* Define if binary requires ARMv6 media instruction support */
/* #undef OPUS_ARM_PRESUME_MEDIA */

/* Define if binary requires NEON instruction support */
/* #undef OPUS_ARM_PRESUME_NEON */

/* Define if binary requires NEON intrinsics support */
/* #undef OPUS_ARM_PRESUME_NEON_INTR */

/* This is a build of OPUS */
#define OPUS_BUILD	1/**/

/* Run bit-exactness checks between optimized and c implementations */
/* #undef OPUS_CHECK_ASM */

/* Use run-time CPU capabilities detection */
//#define OPUS_HAVE_RTCD 1

/* Compiler supports X86 AVX Intrinsics */
/* #undef OPUS_X86_MAY_HAVE_AVX */

/* Compiler supports X86 SSE Intrinsics */
/* #undef OPUS_X86_MAY_HAVE_SSE */

/* Compiler supports X86 SSE2 Intrinsics */
/* #undef OPUS_X86_MAY_HAVE_SSE2 */

/* Compiler supports X86 SSE4.1 Intrinsics */
/* #undef OPUS_X86_MAY_HAVE_SSE4_1 */

/* Define if binary requires AVX intrinsics support */
/* #undef OPUS_X86_PRESUME_AVX */

/* Define if binary requires SSE intrinsics support */
/* #undef OPUS_X86_PRESUME_SSE */

/* Define if binary requires SSE2 intrinsics support */
/* #undef OPUS_X86_PRESUME_SSE2 */

/* Define if binary requires SSE4.1 intrinsics support */
/* #undef OPUS_X86_PRESUME_SSE4_1 */

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "[email protected]"

/* Define to the full name of this package. */
#define PACKAGE_NAME "opus"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "opus 1.3-19-g3765a24-dirty"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "opus"

/* Define to the home page for this package. */
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "1.3-19-g3765a24-dirty"

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* Make use of alloca */
/* #undef USE_ALLOCA */

/* Use C99 variable-size arrays */
#define VAR_ARRAYS 1

/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */

/* Define to `__inline__' or `__inline' if that's what the C compiler
   calls it, or to nothing if 'inline' is not supported under any name.  */
#ifndef __cplusplus
/* #undef inline */
#endif

/* Define to the equivalent of the C99 'restrict' keyword, or to
   nothing if this is not supported.  Do not define if restrict is
   supported directly.  */
#define restrict __restrict
/* Work around a bug in Sun C++: it does not support _Restrict or
   __restrict__, even though the corresponding Sun C compiler ends up with
   "#define restrict _Restrict" or "#define restrict __restrict__" in the
   previous line.  Perhaps some future version of Sun C++ will work with
   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
#if defined __SUNPRO_CC && !defined __RESTRICT
# define _Restrict
# define __restrict__
#endif

另外修改說明:

  • 由於平臺的內置SRAM不夠使用,所以更改了opus_alloc和opus_free爲PSRAM的堆分配函數;
  • 由於opus_encode函數使用的棧比較大,所以task的size要設置大一點,1024*6按照目前使用的版本編碼雙通道基本夠用; 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章