component/bt: add conditional compilation direvatives to control the source code building of SBC codec

This commit is contained in:
wangmengyang 2017-03-17 15:57:30 +08:00
parent fda2e89a1e
commit 66fd3b9768
25 changed files with 131 additions and 34 deletions

View File

@ -16,10 +16,12 @@
* limitations under the License.
*
******************************************************************************/
#include "bt_target.h"
#include <stdlib.h>
#include <oi_codec_sbc_private.h>
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
@ -76,3 +78,5 @@ PRIVATE OI_STATUS OI_CODEC_SBC_Alloc(OI_CODEC_SBC_COMMON_CONTEXT *common,
return OI_OK;
}
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -27,9 +27,11 @@
/**@addgroup codec_internal*/
/**@{*/
#include "bt_target.h"
#include <oi_codec_sbc_private.h>
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
static void dualBitAllocation(OI_CODEC_SBC_COMMON_CONTEXT *common)
{
OI_UINT bitcountL;
@ -163,3 +165,4 @@ OI_UINT16 OI_CODEC_SBC_CalculateFramelen(OI_CODEC_SBC_FRAME_INFO *frame)
}
/**@}*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -36,9 +36,12 @@ frame length and bitrate.
@{
*/
#include "bt_target.h"
#include "oi_utils.h"
#include <oi_codec_sbc_private.h>
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
OI_UINT32 OI_SBC_MaxBitpool(OI_CODEC_SBC_FRAME_INFO *frame)
{
switch (frame->mode) {
@ -398,3 +401,5 @@ void monoBitAllocation(OI_CODEC_SBC_COMMON_CONTEXT *common)
/**
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -33,10 +33,13 @@ Functions for manipulating input bitstreams.
@{
*/
#include "bt_target.h"
#include "oi_stddefs.h"
#include "oi_bitstream.h"
#include "oi_assert.h"
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
PRIVATE void OI_BITSTREAM_ReadInit(OI_BITSTREAM *bs,
const OI_BYTE *buffer)
{
@ -89,4 +92,4 @@ PRIVATE OI_UINT8 OI_BITSTREAM_ReadUINT8Aligned(OI_BITSTREAM *bs)
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -33,9 +33,11 @@ This file exposes OINA-specific interfaces to decoder functions.
@{
*/
#include "bt_target.h"
#include <oi_codec_sbc_private.h>
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
OI_STATUS OI_CODEC_SBC_DecoderConfigureRaw(OI_CODEC_SBC_DECODER_CONTEXT *context,
OI_BOOL enhanced,
OI_UINT8 frequency,
@ -135,3 +137,5 @@ OI_STATUS OI_CODEC_SBC_DecoderLimit(OI_CODEC_SBC_DECODER_CONTEXT *context,
/**
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -33,10 +33,13 @@ This file drives SBC decoding.
@{
*/
#include "bt_target.h"
#include "oi_codec_sbc_private.h"
#include "oi_bitstream.h"
#include <stdio.h>
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
OI_CHAR *const OI_Codec_Copyright = "Copyright 2002-2007 Open Interface North America, Inc. All rights reserved";
INLINE OI_STATUS internal_DecoderReset(OI_CODEC_SBC_DECODER_CONTEXT *context,
@ -220,8 +223,7 @@ PRIVATE void OI_SBC_ReadSamples(OI_CODEC_SBC_DECODER_CONTEXT *context, OI_BITSTR
} while (--nrof_blocks);
}
/**
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -28,9 +28,12 @@
/**@addtogroup codec_internal */
/**@{*/
#include "bt_target.h"
#include "oi_codec_sbc_private.h"
#include "oi_bitstream.h"
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
#define SPECIALIZE_READ_SAMPLES_JOINT
/**
@ -463,3 +466,4 @@ PRIVATE void OI_SBC_ReadSamplesJoint(OI_CODEC_SBC_DECODER_CONTEXT *context, OI_B
/**@}*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -95,8 +95,11 @@
*/
#include "bt_target.h"
#include <oi_codec_sbc_private.h>
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
#ifndef SBC_DEQUANT_LONG_SCALED_OFFSET
#define SBC_DEQUANT_LONG_SCALED_OFFSET 1555931970
#endif
@ -208,3 +211,5 @@ INLINE OI_INT32 OI_SBC_Dequant_Unscaled(OI_UINT32 raw, OI_UINT scale_factor, OI_
/**
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -28,8 +28,11 @@
/**@addgroup codec_internal*/
/**@{*/
#include "bt_target.h"
#include "oi_codec_sbc_private.h"
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
const OI_CHAR *const OI_CODEC_SBC_FreqText[] = { "SBC_FREQ_16000", "SBC_FREQ_32000", "SBC_FREQ_44100", "SBC_FREQ_48000" };
const OI_CHAR *const OI_CODEC_SBC_ModeText[] = { "SBC_MONO", "SBC_DUAL_CHANNEL", "SBC_STEREO", "SBC_JOINT_STEREO" };
const OI_CHAR *const OI_CODEC_SBC_SubbandsText[] = { "SBC_SUBBANDS_4", "SBC_SUBBANDS_8" };
@ -52,3 +55,5 @@ void OI_CODEC_SBC_DumpConfig(OI_CODEC_SBC_FRAME_INFO *frameInfo)
#endif /* OI_DEBUG */
/**@}*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -33,9 +33,11 @@ Checksum and header-related functions.
@{
*/
#include "bt_target.h"
#include "oi_codec_sbc_private.h"
#include "oi_assert.h"
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
/* asdasd */
@ -247,3 +249,5 @@ PRIVATE void shift_buffer(SBC_BUFFER_T *dest, SBC_BUFFER_T *src, OI_UINT wordCou
/**
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -33,10 +33,11 @@ version number of the eSBC codec
/**********************************************************************************
$Revision: #1 $
***********************************************************************************/
#include "bt_target.h"
#include "oi_stddefs.h"
#include "oi_codec_sbc_private.h"
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
/** Version string for the BLUEmagic 3.0 protocol stack and profiles */
PRIVATE OI_CHAR *const codecVersion = "v1.5"
#ifdef OI_SBC_EVAL
@ -56,3 +57,5 @@ OI_CHAR *OI_CODEC_Version(void)
/**
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -30,9 +30,11 @@
*/
#include "bt_target.h"
#include <oi_codec_sbc_private.h>
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
#ifndef CLIP_INT16
#define CLIP_INT16(x) do { if (x > OI_INT16_MAX) { x = OI_INT16_MAX; } else if (x < OI_INT16_MIN) { x = OI_INT16_MIN; } } while (0)
#endif
@ -133,3 +135,5 @@ PRIVATE void SynthWindow80_generated(OI_INT16 *pcm, SBC_BUFFER_T const *RESTRICT
/* 1 - stage 4 */ pcm_a += (MUL_16S_16S(9539, buffer[ 72])) >> 4;
/* 1 - stage 4 */ pcm_a /= 32768; CLIP_INT16(pcm_a); pcm[4 << strideShift] = (OI_INT16)pcm_a;
}
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -33,9 +33,11 @@
* factorization. The scaling factors are folded into the windowing
* constants. 29 adds and 5 16x32 multiplies per 8 samples.
*/
#include "bt_target.h"
#include "oi_codec_sbc_private.h"
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
#define AAN_C4_FIX (759250125)/* S1.30 759250125 0.707107*/
#define AAN_C6_FIX (410903207)/* S1.30 410903207 0.382683*/
@ -303,3 +305,4 @@ PRIVATE void dct2_8(SBC_BUFFER_T *RESTRICT out, OI_INT32 const *RESTRICT in)
}
/**@}*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -158,9 +158,11 @@ The output samples X[0..7] are defined as sums of W:
@addtogroup codec_internal
@{
*/
#include "bt_target.h"
#include "oi_codec_sbc_private.h"
#if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE)
const OI_INT32 dec_window_4[21] = {
0, /* +0.00000000E+00 */
97, /* +5.36548976E-04 */
@ -503,8 +505,7 @@ PRIVATE void cosineModulateSynth4(SBC_BUFFER_T *RESTRICT out, OI_INT32 const *RE
out[7] = (OI_INT16)y1;
}
/**
@}
*/
#endif /* #if (defined(SBC_DEC_INCLUDED) && SBC_DEC_INCLUDED == TRUE) */

View File

@ -22,6 +22,7 @@
* stream.
*
******************************************************************************/
#include "bt_target.h"
#include <string.h>
#include "sbc_encoder.h"
#include "sbc_enc_func_declare.h"
@ -1077,3 +1078,5 @@ void SbcAnalysisInit (void)
memset(s16X, 0, ENC_VX_BUFFER_SIZE * sizeof(SINT16));
ShiftCounter = 0;
}
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -21,12 +21,13 @@
* source file for fast dct operations
*
******************************************************************************/
#include "bt_target.h"
#include "sbc_encoder.h"
#include "sbc_enc_func_declare.h"
#include "sbc_dct.h"
#if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE)
/*******************************************************************************
**
@ -239,3 +240,5 @@ void SBC_FastIDCT4(SINT32 *pInVect, SINT32 *pOutVect)
}
#endif
}
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -22,8 +22,11 @@
* analysis.
*
******************************************************************************/
#include "bt_target.h"
#include "sbc_encoder.h"
#if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE)
/*DCT coeff for 4 sub-band case.*/
#if (SBC_FAST_DCT == FALSE)
const SINT16 gas16AnalDCTcoeff4[] = {
@ -196,3 +199,5 @@ const SINT16 gas16AnalDCTcoeff8[] = {
(SINT16)(0.5556 * 32768)
};
#endif
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -24,9 +24,12 @@
******************************************************************************/
/*Includes*/
#include "bt_target.h"
#include "sbc_encoder.h"
#include "sbc_enc_func_declare.h"
#if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE)
/*global arrays*/
const SINT16 sbc_enc_as16Offset4[4][4] = { { -1, 0, 0, 0}, { -2, 0, 0, 1},
{ -2, 0, 0, 1}, { -2, 0, 0, 1}
@ -181,3 +184,5 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
}
}
/*End of BitAlloc() function*/
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -24,9 +24,12 @@
******************************************************************************/
/*Includes*/
#include "bt_target.h"
#include "sbc_encoder.h"
#include "sbc_enc_func_declare.h"
#if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE)
/*global arrays*/
extern const SINT16 sbc_enc_as16Offset4[4][4];
extern const SINT16 sbc_enc_as16Offset8[4][8];
@ -186,3 +189,4 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
/*End of BitAlloc() function*/
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -21,9 +21,11 @@
* This file contains the Windowing coeffs for synthesis filter
*
******************************************************************************/
#include "bt_target.h"
#include "sbc_encoder.h"
#if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE)
#if (SBC_ARM_ASM_OPT==FALSE && SBC_IPAQ_OPT==FALSE)
#if (SBC_IS_64_MULT_IN_WINDOW_ACCU == FALSE)
/*Window coeff for 4 sub band case*/
@ -313,3 +315,4 @@ const SINT32 gas32CoeffFor8SBs[] = {
#endif
#endif
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -27,6 +27,8 @@
#include "sbc_encoder.h"
#include "sbc_enc_func_declare.h"
#if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE)
SINT16 EncMaxShiftCounter;
/*************************************************************************************************
@ -397,3 +399,5 @@ void SBC_Encoder_Init(SBC_ENC_PARAMS *pstrEncParams)
memset(&sbc_prtc_cb, 0, sizeof(tSBC_PRTC_CB));
sbc_prtc_cb.base = 6 + pstrEncParams->s16NumOfChannels * pstrEncParams->s16NumOfSubBands / 2;
}
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -21,10 +21,12 @@
* This file contains code for packing the Encoded data into bit streams.
*
******************************************************************************/
#include "bt_target.h"
#include "sbc_encoder.h"
#include "sbc_enc_func_declare.h"
#if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE)
#if (SBC_ARM_ASM_OPT==TRUE)
#define Mult32(s32In1,s32In2,s32OutLow) \
{ \
@ -251,3 +253,4 @@ void EncPacking(SBC_ENC_PARAMS *pstrEncParams)
pstrEncParams->pu8NextPacket += pstrEncParams->u16PacketLength; /* move the pointer to the end in case there is more than one frame to encode */
}
#endif /* #if (defined(SBC_ENC_INCLUDED) && SBC_ENC_INCLUDED == TRUE) */

View File

@ -57,6 +57,8 @@
#define A2D_INCLUDED TRUE
#define AVCT_INCLUDED TRUE
#define AVRC_INCLUDED TRUE
#define SBC_DEC_INCLUDED TRUE
#define SBC_ENC_INCLUDED FALSE
#define MCA_INCLUDED FALSE
#define BTC_SM_INCLUDED TRUE
#define BTC_PRF_QUEUE_INCLUDED TRUE
@ -79,6 +81,8 @@
#define A2D_INCLUDED FALSE
#define AVCT_INCLUDED FALSE
#define AVRC_INCLUDED FALSE
#define SBC_DEC_INCLUDED FALSE
#define SBC_ENC_INCLUDED FALSE
#define MCA_INCLUDED FALSE
#define BTC_SM_INCLUDED FALSE
#define BTC_PRF_QUEUE_INCLUDED FALSE

View File

@ -1,20 +1,16 @@
/******************************************************************************
*
* Copyright (C) 2014 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#define LOG_TAG "bt_osi_config"
#include "esp_system.h"

View File

@ -1,4 +1,19 @@
#pragma once
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef __CONFIG_H__
#define __CONFIG_H__
// This module implements a configuration parser. Clients can query the
// contents of a configuration file through the interface provided here.
@ -125,3 +140,5 @@ const char *config_section_name(const config_section_node_t *iter);
// and special formatting in the original file will be lost. Neither |config| nor
// |filename| may be NULL.
bool config_save(const config_t *config, const char *filename);
#endif /* #ifndef __CONFIG_H__ */