├── include
├── Makefile.am
├── faac.h
└── faaccfg.h
├── G726ToPcm.cpp
├── EasyAACEncoderAPI.h
├── Doc
└── EasyAACEncoder.psd
├── testEasyAACEncoder
├── src.g711a
├── g711.g711a
├── encode_out_16.g726
├── encode_out_24.g726
├── encode_out_32.g726
├── encode_out_40.g726
├── nbproject
│ ├── project.xml
│ ├── Makefile-variables.mk
│ ├── Package-Debug.bash
│ ├── Package-Release.bash
│ ├── Makefile-Debug.mk
│ ├── Makefile-Release.mk
│ ├── configurations.xml
│ └── Makefile-impl.mk
├── Makefile
├── testEasyAACEncoder.vcxproj
└── main.cpp
├── libfaac
├── version.h
├── kiss_fft
│ ├── README.kiss_fft
│ ├── TIPS
│ ├── kiss_fftr.h
│ ├── COPYING
│ ├── CHANGELOG
│ ├── kiss_fft.h
│ ├── _kiss_fft_guts.h
│ ├── README
│ └── kiss_fftr.c
├── libfaacdrm.def
├── libfaac.def
├── Makefile.am
├── libfaac_dll.sln
├── libfaac_dll_drm.sln
├── midside.h
├── channels.h
├── ltp.h
├── backpred.h
├── fft.h
├── util.h
├── filtbank.h
├── tns.h
├── aacquant.h
├── psych.h
├── util.c
├── huffman.h
├── libfaac.vcxproj.filters
├── libfaac_dll_drm.vcxproj.filters
├── frame.h
├── midside.c
├── bitstream.h
├── channels.c
├── coder.h
├── libfaac.vcproj
└── libfaac.vcxproj
├── libEasyAACEncoder.vcxproj.user
├── condef.h
├── audio_buffer.h
├── .gitignore
├── G711AToPcm.h
├── G711AToPcm.cpp
├── G726ToPcm.h
├── g711.h
├── outDebug.h
├── audio_buffer.cpp
├── LICENSE
├── Buildit
├── PcmToAac.h
├── EasyAACEncoderAPI.cpp
├── nbproject
├── project.xml
├── Package-Debug.bash
├── Makefile-variables.mk
└── Makefile-impl.mk
├── EasyAACEncoder.sln
├── README.md
├── EasyAACEncoder.h
├── IDecodeToPcm.cpp
├── PcmToAac.cpp
├── IDecodeToPcm.h
├── EasyDSSBuffers.cpp
├── Makefile
├── libEasyAACEncoder.filters
├── EasyDSSBuffers.h
├── g726.h
├── libEasyAACEncoder.vcxproj.filters
└── EasyAACEncoder.cpp
/include/Makefile.am:
--------------------------------------------------------------------------------
1 | include_HEADERS = faac.h faaccfg.h
2 |
--------------------------------------------------------------------------------
/G726ToPcm.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/G726ToPcm.cpp
--------------------------------------------------------------------------------
/EasyAACEncoderAPI.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/EasyAACEncoderAPI.h
--------------------------------------------------------------------------------
/Doc/EasyAACEncoder.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/Doc/EasyAACEncoder.psd
--------------------------------------------------------------------------------
/testEasyAACEncoder/src.g711a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/testEasyAACEncoder/src.g711a
--------------------------------------------------------------------------------
/testEasyAACEncoder/g711.g711a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/testEasyAACEncoder/g711.g711a
--------------------------------------------------------------------------------
/testEasyAACEncoder/encode_out_16.g726:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/testEasyAACEncoder/encode_out_16.g726
--------------------------------------------------------------------------------
/testEasyAACEncoder/encode_out_24.g726:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/testEasyAACEncoder/encode_out_24.g726
--------------------------------------------------------------------------------
/testEasyAACEncoder/encode_out_32.g726:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/testEasyAACEncoder/encode_out_32.g726
--------------------------------------------------------------------------------
/testEasyAACEncoder/encode_out_40.g726:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RDFS/EasyAACEncoder/master/testEasyAACEncoder/encode_out_40.g726
--------------------------------------------------------------------------------
/libfaac/version.h:
--------------------------------------------------------------------------------
1 | #ifndef _VERSION_H_
2 | #define _VERSION_H_
3 |
4 | #define FAAC_RELEASE 1
5 |
6 | #define FAAC_VERSION "1.28"
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/libEasyAACEncoder.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/README.kiss_fft:
--------------------------------------------------------------------------------
1 | See README and COPYING files for author and copyright information.
2 |
3 | kiss_fft.c is modified in order to eliminate static variables.
4 |
5 | -- sur.
6 |
7 |
--------------------------------------------------------------------------------
/condef.h:
--------------------------------------------------------------------------------
1 | #ifndef _CONDEF_H
2 | #define _CONDEF_H
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #define SAFE_DELETE_OBJ(OBJ) {if(NULL!=OBJ){delete OBJ;OBJ=NULL;}}
9 | #define SAFE_FREE_BUF(OBJ) {if(NULL!=OBJ){free(OBJ);OBJ=NULL;}}
10 |
11 | #endif
--------------------------------------------------------------------------------
/libfaac/libfaacdrm.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | ;
3 | ; libfaac exports
4 | ;
5 | faacEncOpen @1
6 | faacEncGetCurrentConfiguration @2
7 | faacEncSetConfiguration @3
8 | faacEncEncode @4
9 | faacEncClose @5
10 | faacEncGetDecoderSpecificInfo @6
11 | faacEncGetVersion @7
12 |
--------------------------------------------------------------------------------
/libfaac/libfaac.def:
--------------------------------------------------------------------------------
1 | LIBRARY libfaac.dll
2 | EXPORTS
3 | ;
4 | ; libfaac exports
5 | ;
6 | faacEncOpen @1
7 | faacEncGetCurrentConfiguration @2
8 | faacEncSetConfiguration @3
9 | faacEncEncode @4
10 | faacEncClose @5
11 | faacEncGetDecoderSpecificInfo @6
12 | faacEncGetVersion @7
13 |
--------------------------------------------------------------------------------
/audio_buffer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class audio_buffer
4 | {
5 | public:
6 | audio_buffer(void);
7 | ~audio_buffer(void);
8 |
9 | int write_data(void *data, int len);
10 |
11 | int get_data(unsigned char *dest, int how_you_want);
12 |
13 | void update_data_len(int len);
14 |
15 | unsigned char *get_writable_ptr();
16 |
17 | private:
18 | unsigned char *data_;
19 | int len_;
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #ignore thumbnails created by windows
3 | Thumbs.db
4 | #Ignore files build by Visual Studio
5 | *.obj
6 | *.exe
7 | *.pdb
8 | *.user
9 | *.aps
10 | *.pch
11 | *.vspscc
12 | *_i.c
13 | *_p.c
14 | *.ncb
15 | *.suo
16 | *.tlb
17 | *.tlh
18 | *.bak
19 | *.cache
20 | *.ilk
21 | *.log
22 | *.aac
23 | [Dd]ebug*/
24 | *.lib
25 | *.sbr
26 | obj/
27 | [Rr]elease*/
28 | _ReSharper*/
29 | [Tt]est[Rr]esult*
30 | *.sdf
31 | *.sdp
32 | *.o
33 | *.exp
34 | [Ll]ogs*/
35 | [Pp]rivate*/
36 | ipch/
37 | *.opensdf
38 | /build/
--------------------------------------------------------------------------------
/libfaac/Makefile.am:
--------------------------------------------------------------------------------
1 | lib_LTLIBRARIES = libfaac.la
2 |
3 | main_SOURCES = aacquant.c bitstream.c fft.c frame.c midside.c psychkni.c util.c backpred.c channels.c filtbank.c huffman.c ltp.c tns.c
4 | if USE_DRM
5 | drm_SOURCES = kiss_fft/kiss_fftr.c kiss_fft/kiss_fft.c
6 | endif
7 | libfaac_la_SOURCES = $(main_SOURCES) $(drm_SOURCES)
8 | libfaac_la_INCLUDES = aacquant.h channels.h filtbank.h hufftab.h psych.h backpred.h coder.h frame.h midside.h tns.h bitstream.h fft.h huffman.h ltp.h util.h
9 | libfaac_la_LIBADD = -lm
10 |
11 | INCLUDES = -I$(top_srcdir)/include
12 |
13 |
14 |
--------------------------------------------------------------------------------
/G711AToPcm.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #pragma once
9 | #include "IDecodeToPcm.h"
10 |
11 | class G711AToPcm :
12 | public DecodeToPcmBase
13 | {
14 | public:
15 | G711AToPcm(void);
16 | virtual ~G711AToPcm(void);
17 | public:
18 | virtual unsigned short DecodeOneChar(unsigned char data);
19 | };
20 |
21 |
22 | class G711UToPcm :
23 | public DecodeToPcmBase
24 | {
25 | public:
26 | G711UToPcm(void);
27 | virtual ~G711UToPcm(void);
28 | public:
29 | virtual unsigned short DecodeOneChar(unsigned char data);
30 | };
31 |
--------------------------------------------------------------------------------
/G711AToPcm.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #include "G711AToPcm.h"
9 |
10 | #include "g711.h"
11 |
12 |
13 | G711AToPcm::G711AToPcm(void)
14 | {
15 | }
16 |
17 |
18 | G711AToPcm::~G711AToPcm(void)
19 | {
20 | }
21 | unsigned short G711AToPcm::DecodeOneChar(unsigned char data)
22 | {
23 | return (int16_t)alaw2linear(data);
24 | }
25 | //-------------------------------------------
26 | G711UToPcm::G711UToPcm(void)
27 | {
28 | }
29 |
30 |
31 | G711UToPcm::~G711UToPcm(void)
32 | {
33 | }
34 | unsigned short G711UToPcm::DecodeOneChar(unsigned char data)
35 | {
36 | return (int16_t)ulaw2linear(data);
37 | }
--------------------------------------------------------------------------------
/G726ToPcm.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #pragma once
9 | #include "IDecodeToPcm.h"
10 | #include "g726.h"
11 |
12 | class G726ToPcm:public IDecodeToPcm
13 | {
14 | public:
15 | G726ToPcm(void);
16 | virtual ~G726ToPcm(void);
17 |
18 | public:
19 | int Init(InAudioInfo info);
20 |
21 | public:
22 | virtual int Decode(unsigned char* outbuf, unsigned int* outlen , unsigned char* inbuf, unsigned int inlen);
23 | virtual int PCMSize();
24 | virtual int G7FrameSize();
25 |
26 | private:
27 | g726_state_t *m_state726;
28 | int m_bitRate;
29 |
30 | int m_g7FrameSize;
31 | int m_pcmSize;
32 | };
33 |
34 |
--------------------------------------------------------------------------------
/g711.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #ifndef __G_711_H_
9 | #define __G_711_H_
10 |
11 | #include
12 |
13 | enum _e_g711_tp
14 | {
15 | TP_ALAW, //G711A
16 | TP_ULAW //G711U
17 | };
18 |
19 | unsigned char linear2alaw(int pcm_val); /* 2's complement (16-bit range) */
20 | int alaw2linear(unsigned char a_val);
21 |
22 | unsigned char linear2ulaw(int pcm_val); /* 2's complement (16-bit range) */
23 | int ulaw2linear(unsigned char u_val);
24 |
25 | unsigned char alaw2ulaw(unsigned char aval);
26 | unsigned char ulaw2alaw(unsigned char uval);
27 |
28 | int g711_decode(void *pout_buf, int *pout_len, const void *pin_buf, const int in_len , int type);
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/libfaac/libfaac_dll.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 10.00
2 | # Visual Studio 2008
3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac_dll", "libfaac_dll.vcproj", "{856BB8CF-B944-4D7A-9D59-4945316229AA}"
4 | EndProject
5 | Global
6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
7 | Debug|Win32 = Debug|Win32
8 | Release|Win32 = Release|Win32
9 | EndGlobalSection
10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
11 | {856BB8CF-B944-4D7A-9D59-4945316229AA}.Debug|Win32.ActiveCfg = Debug|Win32
12 | {856BB8CF-B944-4D7A-9D59-4945316229AA}.Debug|Win32.Build.0 = Debug|Win32
13 | {856BB8CF-B944-4D7A-9D59-4945316229AA}.Release|Win32.ActiveCfg = Release|Win32
14 | {856BB8CF-B944-4D7A-9D59-4945316229AA}.Release|Win32.Build.0 = Release|Win32
15 | EndGlobalSection
16 | GlobalSection(SolutionProperties) = preSolution
17 | HideSolutionNode = FALSE
18 | EndGlobalSection
19 | EndGlobal
20 |
--------------------------------------------------------------------------------
/outDebug.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #ifndef _OUTDEBUG_H
9 | #define _OUTDEBUG_H
10 |
11 |
12 |
13 | #define DBG_MSG_BUFF_SIZE 3000
14 | #define FILE_NAME "-EasyAACEncoder-"
15 |
16 | #ifndef __linux__
17 | #include
18 | #include
19 | #include
20 |
21 | #define INFO_USE(fmt, ...) \
22 | { \
23 | TCHAR traceBuffer[DBG_MSG_BUFF_SIZE]; \
24 | _stprintf_s(traceBuffer, _T(FILE_NAME) _T(" :INFO: ") _T(__FUNCTION__) _T("<%d>: ") _T(fmt) _T("\n"), __LINE__, ##__VA_ARGS__); \
25 | OutputDebugString(traceBuffer); \
26 | }
27 |
28 |
29 | #define INFO_CHOOSEUSE(fmt, ...) {INFO_USE(fmt, ##__VA_ARGS__);}
30 |
31 | #define INFO_D(OUT,fmt, ...)\
32 | { \
33 | if(OUT)\
34 | {\
35 | INFO_CHOOSEUSE(fmt, ##__VA_ARGS__);\
36 | }\
37 | }
38 |
39 | #else
40 | #define INFO_D(OUT,fmt, ...)\
41 | { \
42 | if(OUT)\
43 | {\
44 | printf(fmt, ##__VA_ARGS__);\
45 | }\
46 | }
47 | #endif
48 |
49 |
50 | #define AAC_DEBUG 0
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/audio_buffer.cpp:
--------------------------------------------------------------------------------
1 | #include "audio_buffer.h"
2 | #include "EasyDSSBuffers.h"
3 | #include "outDebug.h"
4 |
5 |
6 | audio_buffer::audio_buffer()
7 | {
8 | data_ = new unsigned char[iBufLen];
9 | len_ = 0;
10 | }
11 |
12 | audio_buffer::~audio_buffer()
13 | {
14 | delete []data_;
15 | }
16 |
17 | int audio_buffer::write_data(void* data, int len)
18 | {
19 | if (iBufLen - len_ < len)
20 | {
21 | if(AAC_DEBUG) printf("audio_buffer full\n");
22 | return -1;
23 | }
24 | if (len > 0)
25 | {
26 | memcpy(data_ + len_, data, len);
27 | len_ += len;
28 | return len;
29 | }
30 | return 0;
31 | }
32 |
33 | int audio_buffer::get_data(unsigned char* dest, int how_you_want)
34 | {
35 | if (len_ == 0 || len_ < how_you_want)
36 | {
37 | return 0;
38 | }
39 | else
40 | {
41 | memcpy(dest, data_, how_you_want);
42 | memcpy(data_, data_ + how_you_want, len_ - how_you_want);
43 | len_ -= how_you_want;
44 | return how_you_want;
45 | }
46 | }
47 |
48 | unsigned char* audio_buffer::get_writable_ptr()
49 | {
50 | return data_ + len_;
51 | }
52 |
53 | void audio_buffer::update_data_len(int len)
54 | {
55 | len_ += len;
56 | }
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.cnd.makeproject
4 |
5 |
6 | testg7112aac
7 |
8 | cpp
9 |
10 | UTF-8
11 |
12 |
13 |
14 |
15 | Debug
16 | 1
17 |
18 |
19 | Release
20 | 1
21 |
22 |
23 |
24 | false
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 EasyDarwin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Buildit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | usage()
4 | {
5 | echo "0. clean up ./Buildit clean"
6 | echo "1. build 32bit program ./Buildit i386 [target in i386]"
7 | echo "2. build 64bit program ./Buildit x64 [target in x64]"
8 | #echo "3. build arm program for GM8126 ./Buildit arm [target in ARM]"
9 | #echo "4. build arm program for Hisilicon3518 ./Buildit 3518 [target in hisiv100]"
10 | }
11 |
12 | if [ "$*" = "clean" ] ; then
13 | #make -f nbproject/Makefile-ARM.mk QMAKE= SUBPROJECTS= .clean-conf
14 | make -f nbproject/Makefile-i386.mk QMAKE= SUBPROJECTS= .clean-conf
15 | #make -f nbproject/Makefile-hisiv100.mk QMAKE= SUBPROJECTS= .clean-conf
16 | make -f nbproject/Makefile-x64.mk QMAKE= SUBPROJECTS= .clean-conf
17 | elif [ "$*" = "i386" ] ; then
18 | make -f nbproject/Makefile-i386.mk QMAKE= SUBPROJECTS= .build-conf
19 | #elif [ "$*" = "arm" ] ; then
20 | #make -f nbproject/Makefile-ARM.mk QMAKE= SUBPROJECTS= .build-conf
21 | #elif [ "$*" = "3518" ] ; then
22 | #make -f nbproject/Makefile-hisiv100.mk QMAKE= SUBPROJECTS= .build-conf
23 | elif [ "$*" = "x64" ] ; then
24 | make -f nbproject/Makefile-x64.mk QMAKE= SUBPROJECTS= .build-conf
25 | else
26 | usage;
27 | fi
28 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/TIPS:
--------------------------------------------------------------------------------
1 | Speed:
2 | * experiment with compiler flags
3 | Special thanks to Oscar Lesta. He suggested some compiler flags
4 | for gcc that make a big difference. They shave 10-15% off
5 | execution time on some systems. Try some combination of:
6 | -march=pentiumpro
7 | -ffast-math
8 | -fomit-frame-pointer
9 |
10 | * If the input data has no imaginary component, use the kiss_fftr code under tools/.
11 | Real ffts are roughly twice as fast as complex.
12 |
13 | Reducing code size:
14 | * remove some of the butterflies. There are currently butterflies optimized for radices
15 | 2,3,4,5. It is worth mentioning that you can still use FFT sizes that contain
16 | these factors, they just won't be quite as fast. You can decide for yourself
17 | whether to keep radix 2 or 4. If you do some work in this area, let me
18 | know what you find.
19 |
20 | * For platforms where ROM/code space is more plentiful than RAM,
21 | consider creating a hardcoded kiss_fft_state. In other words, decide which
22 | FFT size(s) you want and make a structure with the correct factors and twiddles.
23 |
24 |
--------------------------------------------------------------------------------
/PcmToAac.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #pragma once
9 |
10 | #include
11 | #include
12 | #include
13 | #include "IDecodeToPcm.h"
14 |
15 | extern "C"
16 | {
17 | #include
18 | }
19 |
20 | class PcmToAac
21 | {
22 | public:
23 | PcmToAac(void);
24 | ~PcmToAac(void);
25 | public:
26 | bool Init(InAudioInfo* info);
27 | int Encode(int32_t * inputBuffer, unsigned int samplesInput, unsigned char *outputBuffer, unsigned int bufferSize);
28 | public:
29 | unsigned int GetPCMBitSize()
30 | {
31 | return m_nPCMBitSize;
32 | }
33 | unsigned int GetInputSamples()
34 | {
35 | return m_nInputSamples;
36 | }
37 | unsigned int GetMaxOutputBytes()
38 | {
39 | return m_nMaxOutputBytes;
40 | }
41 | unsigned int GetPCMBufferSize()
42 | {
43 | return (m_nInputSamples * (m_nPCMBitSize / 8));
44 | }
45 |
46 |
47 | private:
48 | faacEncHandle hEncoder;
49 | faacEncConfigurationPtr pConfiguration;
50 |
51 | unsigned int m_nPCMBitSize /*= 16*/;
52 |
53 | unsigned long m_nInputSamples /*= 0*/;
54 |
55 | unsigned long m_nMaxOutputBytes /*= 0*/;
56 | };
57 |
58 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/kiss_fftr.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 | #ifndef KISS_FTR_H
8 | #define KISS_FTR_H
9 |
10 | #include "kiss_fft.h"
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 |
16 | /*
17 |
18 | Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
19 |
20 |
21 |
22 | */
23 |
24 | typedef struct kiss_fftr_state *kiss_fftr_cfg;
25 |
26 |
27 | kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
28 | /*
29 | nfft must be even
30 |
31 | If you don't care to allocate space, use mem = lenmem = NULL
32 | */
33 |
34 |
35 | void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata);
36 | /*
37 | input timedata has nfft scalar points
38 | output freqdata has nfft/2+1 complex points
39 | */
40 |
41 | void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
42 | /*
43 | input freqdata has nfft/2+1 complex points
44 | output timedata has nfft scalar points
45 | */
46 |
47 | #define kiss_fftr_free free
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 | #endif
53 |
--------------------------------------------------------------------------------
/EasyAACEncoderAPI.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 | /*
8 | * File: libEasyAACEncoder.cpp
9 | * Author: Wellsen@easydarwin.org
10 | *
11 | * Created on 2015年4月11日, 上午10:57
12 | */
13 |
14 | #include "EasyAACEncoderAPI.h"
15 | #include "EasyAACEncoder.h"
16 | #include "condef.h"
17 |
18 | Easy_API EasyAACEncoder_Handle Easy_APICALL Easy_AACEncoder_Init(InitParam initPar)
19 | {
20 | G7ToAac *encoder = new G7ToAac();
21 | InAudioInfo info(initPar );
22 | bool ret = encoder->init(info);
23 | if (!ret)
24 | {
25 | SAFE_DELETE_OBJ(encoder);
26 | }
27 | return encoder;
28 | }
29 |
30 | Easy_API int Easy_APICALL Easy_AACEncoder_Encode(EasyAACEncoder_Handle handle, unsigned char* inbuf, unsigned int inlen, unsigned char* outbuf, unsigned int* outlen)
31 | {
32 | if(handle == NULL)
33 | {
34 | return -1;
35 | }
36 | return ((G7ToAac*)handle)->aac_encode(inbuf, inlen, outbuf, outlen);
37 | }
38 |
39 | Easy_API void Easy_APICALL Easy_AACEncoder_Release(EasyAACEncoder_Handle handle)
40 | {
41 | if(handle != NULL)
42 | {
43 | delete ((G7ToAac*)handle);
44 | }
45 | }
46 |
47 |
48 |
--------------------------------------------------------------------------------
/libfaac/libfaac_dll_drm.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 10.00
2 | # Visual Studio 2008
3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaac_dll", "libfaac_dll_drm.vcproj", "{AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}"
4 | EndProject
5 | Global
6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
7 | Debug DRM|Win32 = Debug DRM|Win32
8 | Debug|Win32 = Debug|Win32
9 | Release DRM|Win32 = Release DRM|Win32
10 | Release|Win32 = Release|Win32
11 | EndGlobalSection
12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
13 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug DRM|Win32.ActiveCfg = Debug DRM|Win32
14 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug DRM|Win32.Build.0 = Debug DRM|Win32
15 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug|Win32.ActiveCfg = Debug|Win32
16 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Debug|Win32.Build.0 = Debug|Win32
17 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release DRM|Win32.ActiveCfg = Release DRM|Win32
18 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release DRM|Win32.Build.0 = Release DRM|Win32
19 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release|Win32.ActiveCfg = Release|Win32
20 | {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F}.Release|Win32.Build.0 = Release|Win32
21 | EndGlobalSection
22 | GlobalSection(SolutionProperties) = preSolution
23 | HideSolutionNode = FALSE
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/Makefile-variables.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated - do not edit!
3 | #
4 | # NOCDDL
5 | #
6 | CND_BASEDIR=`pwd`
7 | CND_BUILDDIR=build
8 | CND_DISTDIR=dist
9 | # Debug configuration
10 | CND_PLATFORM_Debug=GNU-Linux-x86
11 | CND_ARTIFACT_DIR_Debug=Debug
12 | CND_ARTIFACT_NAME_Debug=testg7112aac
13 | CND_ARTIFACT_PATH_Debug=Debug/testg7112aac
14 | CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux-x86/package
15 | CND_PACKAGE_NAME_Debug=testg7112aac.tar
16 | CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux-x86/package/testg7112aac.tar
17 | # Release configuration
18 | CND_PLATFORM_Release=GNU-Linux-x86
19 | CND_ARTIFACT_DIR_Release=dist/Release/GNU-Linux-x86
20 | CND_ARTIFACT_NAME_Release=testg7112aac
21 | CND_ARTIFACT_PATH_Release=dist/Release/GNU-Linux-x86/testg7112aac
22 | CND_PACKAGE_DIR_Release=dist/Release/GNU-Linux-x86/package
23 | CND_PACKAGE_NAME_Release=testg7112aac.tar
24 | CND_PACKAGE_PATH_Release=dist/Release/GNU-Linux-x86/package/testg7112aac.tar
25 | #
26 | # include compiler specific variables
27 | #
28 | # dmake command
29 | ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \
30 | (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)
31 | #
32 | # gmake command
33 | .PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk))
34 | #
35 | include nbproject/private/Makefile-variables.mk
36 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.cnd.makeproject
4 |
5 |
6 | EasyAACEncoder
7 | c
8 | cpp
9 | h
10 | UTF-8
11 |
12 |
13 |
14 |
15 | Debug
16 | 2
17 |
18 |
19 | i386
20 | 3
21 |
22 |
23 | x64
24 | 3
25 |
26 |
27 | arm
28 | 3
29 |
30 |
31 |
32 | false
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/EasyAACEncoder.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libEasyAACEncoder", "libEasyAACEncoder.vcxproj", "{9D70B453-456D-47B7-8692-82D8BB6FBDF6}"
5 | EndProject
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testEasyAACEncoder", "testEasyAACEncoder\testEasyAACEncoder.vcxproj", "{812DF705-FDD7-4963-BAEB-ED531CAD3260}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Release|Win32 = Release|Win32
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {9D70B453-456D-47B7-8692-82D8BB6FBDF6}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {9D70B453-456D-47B7-8692-82D8BB6FBDF6}.Debug|Win32.Build.0 = Debug|Win32
16 | {9D70B453-456D-47B7-8692-82D8BB6FBDF6}.Release|Win32.ActiveCfg = Release|Win32
17 | {9D70B453-456D-47B7-8692-82D8BB6FBDF6}.Release|Win32.Build.0 = Release|Win32
18 | {812DF705-FDD7-4963-BAEB-ED531CAD3260}.Debug|Win32.ActiveCfg = Debug|Win32
19 | {812DF705-FDD7-4963-BAEB-ED531CAD3260}.Debug|Win32.Build.0 = Debug|Win32
20 | {812DF705-FDD7-4963-BAEB-ED531CAD3260}.Release|Win32.ActiveCfg = Release|Win32
21 | {812DF705-FDD7-4963-BAEB-ED531CAD3260}.Release|Win32.Build.0 = Release|Win32
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/COPYING:
--------------------------------------------------------------------------------
1 | Copyright (c) 2003-2004 Mark Borgerding
2 |
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 |
--------------------------------------------------------------------------------
/libfaac/midside.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2003 Krzysztof Nikiel
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: midside.h,v 1.1 2003/06/26 19:40:23 knik Exp $
20 | */
21 |
22 | #ifndef _MIDSIDE_H
23 | #define _MIDSIDE_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif /* __cplusplus */
28 |
29 | #include "coder.h"
30 |
31 |
32 | void MSEncode(CoderInfo *coderInfo, ChannelInfo *channelInfo, double *spectrum[MAX_CHANNELS],
33 | unsigned int numberOfChannels, unsigned int msenable);
34 | void MSReconstruct(CoderInfo *coderInfo, ChannelInfo *channelInfo, int numberOfChannels);
35 |
36 | #ifdef __cplusplus
37 | }
38 | #endif /* __cplusplus */
39 |
40 | #endif /* _MIDSIDE_H */
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## EasyAACEncoder ##
2 |
3 | **EasyAACEncoder** 是EasyDarwin开源流媒体服务团队整理、开发的一款音频转码到AAC的工具库,目前支持G711a/G711u/G726/PCM等音频格式的转码,跨平台,支持Windows/Linux/arm.
4 |
5 |
6 | ## 调用示例 ##
7 |
8 | - **testEasyAACEncoder**:通过EasyAACEncoderAPI对G711A/G711U/G726进行AAC转码;
9 |
10 | Windows编译方法,
11 |
12 | Visual Studio 2010 编译:./EasyAACEncoder-master/EasyAACEncoder.sln
13 |
14 | Linux编译方法,
15 |
16 | chmod +x ./Buildit
17 | ./Buildit
18 |
19 |
20 | - **ARM版本的EasyAACEncoder库可自行编译**;
21 |
22 | ## 调用过程 ##
23 | 
24 |
25 |
26 | ## 特殊说明 ##
27 | EasyAACEncoder目前支持的音视频格式:
28 |
29 | /* Audio Codec */
30 | enum Law
31 | {
32 | Law_ULaw = 0, /**< U law */
33 | Law_ALaw = 1, /**< A law */
34 | Law_PCM16 = 2, /**< 16 bit uniform PCM values. 原始 pcm 数据 */
35 | Law_G726 = 3 /**< G726 */
36 | };
37 |
38 | /* Rate Bits */
39 | enum Rate
40 | {
41 | Rate16kBits=2, /**< 16k bits per second (2 bits per ADPCM sample) */
42 | Rate24kBits=3, /**< 24k bits per second (3 bits per ADPCM sample) */
43 | Rate32kBits=4, /**< 32k bits per second (4 bits per ADPCM sample) */
44 | Rate40kBits=5 /**< 40k bits per second (5 bits per ADPCM sample) */
45 | };
46 |
47 | ## 获取更多信息 ##
48 |
49 | 邮件:[support@easydarwin.org](mailto:support@easydarwin.org)
50 |
51 | WEB:[www.EasyDarwin.org](http://www.easydarwin.org)
52 |
53 | Author:破/浪Leo,Arno,Wellsen
54 |
55 | Copyright © EasyDarwin.org 2013-2016
56 |
57 | 
58 |
--------------------------------------------------------------------------------
/libfaac/channels.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: channels.h,v 1.7 2003/06/26 19:19:41 knik Exp $
20 | */
21 |
22 | #ifndef CHANNEL_H
23 | #define CHANNEL_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif /* __cplusplus */
28 |
29 | #include "coder.h"
30 |
31 | typedef struct {
32 | int is_present;
33 | int ms_used[MAX_SCFAC_BANDS];
34 | } MSInfo;
35 |
36 | typedef struct {
37 | int tag;
38 | int present;
39 | int ch_is_left;
40 | int paired_ch;
41 | int common_window;
42 | int cpe;
43 | int sce;
44 | int lfe;
45 | MSInfo msInfo;
46 | } ChannelInfo;
47 |
48 | void GetChannelInfo(ChannelInfo *channelInfo, int numChannels, int useLfe);
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif /* __cplusplus */
53 |
54 | #endif /* CHANNEL_H */
55 |
--------------------------------------------------------------------------------
/EasyAACEncoder.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 | /*
8 | * File: EasyAACEncoder.h
9 | * Author: Wellsen@easydarwin.org
10 | *
11 | * Created on 2015年4月11日, 上午11:44
12 | */
13 |
14 | #ifndef EasyAACEncoder_H
15 | #define EasyAACEncoder_H
16 |
17 |
18 | #include "audio_buffer.h"
19 | #include "IDecodeToPcm.h"
20 | #include "PcmToAac.h"
21 |
22 | class G7ToAac
23 | {
24 | public:
25 | G7ToAac();
26 | virtual ~G7ToAac();
27 |
28 | bool init();
29 | bool init(InAudioInfo info);
30 |
31 | int aac_encode(unsigned char* inbuf, unsigned int inlen, unsigned char* outbuf, unsigned int* outlen);
32 |
33 | private:
34 | int aac_encode_obj(unsigned char* inbuf, unsigned int inlen, unsigned char* outbuf, unsigned int* outlen );
35 |
36 | bool CreateDecodePcm();
37 | bool CreateEncodeAac();
38 | bool CreateBuffer();
39 | private:
40 | int nRet;
41 | int nTmp;
42 | int nCount;
43 | int nStatus;
44 | int nPCMRead;
45 |
46 |
47 |
48 | int m_nPCMBufferSize;
49 | unsigned char *m_pbPCMBuffer;
50 |
51 | unsigned long m_nMaxOutputBytes;
52 | unsigned char *m_pbAACBuffer;
53 |
54 | int m_nPCMSize;
55 | unsigned char *m_pbPCMTmpBuffer;
56 |
57 | unsigned char *m_pbG7FrameBuffer;
58 | unsigned long m_nG7FrameBufferSize;
59 |
60 | audio_buffer *m_audio_buffer_;
61 | //------
62 | InAudioInfo m_inAudioInfo;
63 |
64 | IDecodeToPcm* m_pDecodeToPcm;
65 | PcmToAac* m_pPCMToAAC;
66 | };
67 |
68 | #endif /* EasyAACEncoder_H */
69 |
70 |
--------------------------------------------------------------------------------
/nbproject/Package-Debug.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 |
3 | #
4 | # Generated - do not edit!
5 | #
6 |
7 | # Macros
8 | TOP=`pwd`
9 | CND_PLATFORM=GNU-Linux
10 | CND_CONF=Debug
11 | CND_DISTDIR=dist
12 | CND_BUILDDIR=build
13 | CND_DLIB_EXT=so
14 | NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
15 | TMPDIRNAME=tmp-packaging
16 | OUTPUT_PATH=${AVS_ROOT}/lib/libg7112aac.${CND_DLIB_EXT}
17 | OUTPUT_BASENAME=libg7112aac.${CND_DLIB_EXT}
18 | PACKAGE_TOP_DIR=libEasyAACEncoder.so/
19 |
20 | # Functions
21 | function checkReturnCode
22 | {
23 | rc=$?
24 | if [ $rc != 0 ]
25 | then
26 | exit $rc
27 | fi
28 | }
29 | function makeDirectory
30 | # $1 directory path
31 | # $2 permission (optional)
32 | {
33 | mkdir -p "$1"
34 | checkReturnCode
35 | if [ "$2" != "" ]
36 | then
37 | chmod $2 "$1"
38 | checkReturnCode
39 | fi
40 | }
41 | function copyFileToTmpDir
42 | # $1 from-file path
43 | # $2 to-file path
44 | # $3 permission
45 | {
46 | cp "$1" "$2"
47 | checkReturnCode
48 | if [ "$3" != "" ]
49 | then
50 | chmod $3 "$2"
51 | checkReturnCode
52 | fi
53 | }
54 |
55 | # Setup
56 | cd "${TOP}"
57 | mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
58 | rm -rf ${NBTMPDIR}
59 | mkdir -p ${NBTMPDIR}
60 |
61 | # Copy files and create directories and links
62 | cd "${TOP}"
63 | makeDirectory "${NBTMPDIR}/libEasyAACEncoder.so/lib"
64 | copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}lib/${OUTPUT_BASENAME}" 0644
65 |
66 |
67 | # Generate tar file
68 | cd "${TOP}"
69 | rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libEasyAACEncoder.so.tar
70 | cd ${NBTMPDIR}
71 | tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/libEasyAACEncoder.so.tar *
72 | checkReturnCode
73 |
74 | # Cleanup
75 | cd "${TOP}"
76 | rm -rf ${NBTMPDIR}
77 |
--------------------------------------------------------------------------------
/libfaac/ltp.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 | /*
8 | * FAAC - Freeware Advanced Audio Coder
9 | * Copyright (C) 2001 Menno Bakker
10 | *
11 | * This library is free software; you can redistribute it and/or
12 | * modify it under the terms of the GNU Lesser General Public
13 | * License as published by the Free Software Foundation; either
14 | * version 2.1 of the License, or (at your option) any later version.
15 | *
16 | * This library is distributed in the hope that it will be useful,
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 | * Lesser General Public License for more details.
20 |
21 | * You should have received a copy of the GNU Lesser General Public
22 | * License along with this library; if not, write to the Free Software
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 | *
25 | * $Id: ltp.h,v 1.3 2001/06/08 18:01:09 menno Exp $
26 | */
27 |
28 | #ifndef LTP_H
29 | #define LTP_H
30 |
31 | #include "coder.h"
32 |
33 |
34 |
35 | void LtpInit(faacEncHandle hEncoder);
36 | void LtpEnd(faacEncHandle hEncoder);
37 | int LtpEncode(faacEncHandle hEncoder,
38 | CoderInfo *coderInfo,
39 | LtpInfo *ltpInfo,
40 | TnsInfo *tnsInfo,
41 | double *p_spectrum,
42 | double *p_time_signal);
43 | void LtpReconstruct(CoderInfo *coderInfo, LtpInfo *ltpInfo, double *p_spectrum);
44 | void LtpUpdate(LtpInfo *ltpInfo, double *time_signal,
45 | double *overlap_signal, int block_size_long);
46 |
47 | #endif /* not defined LTP_H */
48 |
49 |
--------------------------------------------------------------------------------
/libfaac/backpred.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: backpred.h,v 1.5 2001/06/08 18:01:09 menno Exp $
20 | */
21 |
22 | #ifndef _AAC_BACK_H_INCLUDED
23 | #define _AAC_BACK_H_INCLUDED
24 |
25 | #define PRED_ALPHA 0.90625
26 | #define PRED_A 0.953125
27 | #define PRED_B 0.953125
28 |
29 | #define ALPHA PRED_ALPHA
30 | #define A PRED_A
31 | #define B PRED_B
32 | #define MINVAR 1.e-10
33 |
34 | /* Reset every RESET_FRAME frames. */
35 | #define RESET_FRAME 8
36 |
37 | void PredCalcPrediction(double *act_spec,
38 | double *last_spec,
39 | int btype,
40 | int nsfb,
41 | int *isfb_width,
42 | CoderInfo *coderInfo,
43 | ChannelInfo *channelInfo,
44 | int chanNum);
45 |
46 | void PredInit(faacEncHandle hEncoder);
47 |
48 | void CopyPredInfo(CoderInfo *right, CoderInfo *left);
49 |
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/libfaac/fft.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * $Id: fft.h,v 1.6 2005/02/02 07:50:35 sur Exp $
4 | * Copyright (C) 2002 Krzysztof Nikiel
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 |
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | *
20 | */
21 |
22 | #ifndef _FFT_H_
23 | #define _FFT_H_
24 |
25 | typedef float fftfloat;
26 |
27 | #if defined DRM && !defined DRM_1024
28 |
29 | #define MAX_FFT 10
30 |
31 | typedef struct
32 | {
33 | /* cfg[Max FFT][FFT and inverse FFT] */
34 | void* cfg[MAX_FFT][2];
35 | } FFT_Tables;
36 |
37 | #else /* use own FFT */
38 |
39 | typedef struct
40 | {
41 | fftfloat **costbl;
42 | fftfloat **negsintbl;
43 | unsigned short **reordertbl;
44 | } FFT_Tables;
45 |
46 | #endif /* defined DRM && !defined DRM_1024 */
47 |
48 | void fft_initialize ( FFT_Tables *fft_tables );
49 | void fft_terminate ( FFT_Tables *fft_tables );
50 |
51 | void rfft ( FFT_Tables *fft_tables, double *x, int logm );
52 | void fft ( FFT_Tables *fft_tables, double *xr, double *xi, int logm );
53 | void ffti ( FFT_Tables *fft_tables, double *xr, double *xi, int logm );
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/Package-Debug.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 |
3 | #
4 | # Generated - do not edit!
5 | #
6 |
7 | # Macros
8 | TOP=`pwd`
9 | CND_PLATFORM=GNU-Linux-x86
10 | CND_CONF=Debug
11 | CND_DISTDIR=dist
12 | CND_BUILDDIR=build
13 | CND_DLIB_EXT=so
14 | NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
15 | TMPDIRNAME=tmp-packaging
16 | OUTPUT_PATH=${CND_CONF}/testg7112aac
17 | OUTPUT_BASENAME=testg7112aac
18 | PACKAGE_TOP_DIR=testg7112aac/
19 |
20 | # Functions
21 | function checkReturnCode
22 | {
23 | rc=$?
24 | if [ $rc != 0 ]
25 | then
26 | exit $rc
27 | fi
28 | }
29 | function makeDirectory
30 | # $1 directory path
31 | # $2 permission (optional)
32 | {
33 | mkdir -p "$1"
34 | checkReturnCode
35 | if [ "$2" != "" ]
36 | then
37 | chmod $2 "$1"
38 | checkReturnCode
39 | fi
40 | }
41 | function copyFileToTmpDir
42 | # $1 from-file path
43 | # $2 to-file path
44 | # $3 permission
45 | {
46 | cp "$1" "$2"
47 | checkReturnCode
48 | if [ "$3" != "" ]
49 | then
50 | chmod $3 "$2"
51 | checkReturnCode
52 | fi
53 | }
54 |
55 | # Setup
56 | cd "${TOP}"
57 | mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
58 | rm -rf ${NBTMPDIR}
59 | mkdir -p ${NBTMPDIR}
60 |
61 | # Copy files and create directories and links
62 | cd "${TOP}"
63 | makeDirectory "${NBTMPDIR}/testg7112aac/bin"
64 | copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
65 |
66 |
67 | # Generate tar file
68 | cd "${TOP}"
69 | rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testg7112aac.tar
70 | cd ${NBTMPDIR}
71 | tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testg7112aac.tar *
72 | checkReturnCode
73 |
74 | # Cleanup
75 | cd "${TOP}"
76 | rm -rf ${NBTMPDIR}
77 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/Package-Release.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash -x
2 |
3 | #
4 | # Generated - do not edit!
5 | #
6 |
7 | # Macros
8 | TOP=`pwd`
9 | CND_PLATFORM=GNU-Linux-x86
10 | CND_CONF=Release
11 | CND_DISTDIR=dist
12 | CND_BUILDDIR=build
13 | CND_DLIB_EXT=so
14 | NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
15 | TMPDIRNAME=tmp-packaging
16 | OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/testg7112aac
17 | OUTPUT_BASENAME=testg7112aac
18 | PACKAGE_TOP_DIR=testg7112aac/
19 |
20 | # Functions
21 | function checkReturnCode
22 | {
23 | rc=$?
24 | if [ $rc != 0 ]
25 | then
26 | exit $rc
27 | fi
28 | }
29 | function makeDirectory
30 | # $1 directory path
31 | # $2 permission (optional)
32 | {
33 | mkdir -p "$1"
34 | checkReturnCode
35 | if [ "$2" != "" ]
36 | then
37 | chmod $2 "$1"
38 | checkReturnCode
39 | fi
40 | }
41 | function copyFileToTmpDir
42 | # $1 from-file path
43 | # $2 to-file path
44 | # $3 permission
45 | {
46 | cp "$1" "$2"
47 | checkReturnCode
48 | if [ "$3" != "" ]
49 | then
50 | chmod $3 "$2"
51 | checkReturnCode
52 | fi
53 | }
54 |
55 | # Setup
56 | cd "${TOP}"
57 | mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
58 | rm -rf ${NBTMPDIR}
59 | mkdir -p ${NBTMPDIR}
60 |
61 | # Copy files and create directories and links
62 | cd "${TOP}"
63 | makeDirectory "${NBTMPDIR}/testg7112aac/bin"
64 | copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
65 |
66 |
67 | # Generate tar file
68 | cd "${TOP}"
69 | rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testg7112aac.tar
70 | cd ${NBTMPDIR}
71 | tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/testg7112aac.tar *
72 | checkReturnCode
73 |
74 | # Cleanup
75 | cd "${TOP}"
76 | rm -rf ${NBTMPDIR}
77 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/Makefile-Debug.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated Makefile - do not edit!
3 | #
4 | # Edit the Makefile in the project folder instead (../Makefile). Each target
5 | # has a -pre and a -post target defined where you can add customized code.
6 | #
7 | # This makefile implements configuration specific macros and targets.
8 |
9 |
10 | # Environment
11 | MKDIR=mkdir
12 | CP=cp
13 | GREP=grep
14 | NM=nm
15 | CCADMIN=CCadmin
16 | RANLIB=ranlib
17 | CC=gcc
18 | CCC=g++
19 | CXX=g++
20 | FC=gfortran
21 | AS=as
22 |
23 | # Macros
24 | CND_PLATFORM=GNU-Linux-x86
25 | CND_DLIB_EXT=so
26 | CND_CONF=Debug
27 | CND_DISTDIR=dist
28 | CND_BUILDDIR=build
29 |
30 | # Include project Makefile
31 | include Makefile
32 |
33 | # Object Directory
34 | OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
35 |
36 | # Object Files
37 | OBJECTFILES= \
38 | ${OBJECTDIR}/main.o
39 |
40 |
41 | # C Compiler Flags
42 | CFLAGS=
43 |
44 | # CC Compiler Flags
45 | CCFLAGS=
46 | CXXFLAGS=
47 |
48 | # Fortran Compiler Flags
49 | FFLAGS=
50 |
51 | # Assembler Flags
52 | ASFLAGS=
53 |
54 | # Link Libraries and Options
55 | LDLIBSOPTIONS=-L${AVS_ROOT}/lib
56 |
57 | # Build Targets
58 | .build-conf: ${BUILD_SUBPROJECTS}
59 | "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_CONF}/testg7112aac
60 |
61 | ${CND_CONF}/testg7112aac: ${OBJECTFILES}
62 | ${MKDIR} -p ${CND_CONF}
63 | ${LINK.cc} -o ${CND_CONF}/testg7112aac ${OBJECTFILES} ${LDLIBSOPTIONS} -lg7112aac
64 |
65 | ${OBJECTDIR}/main.o: main.cpp
66 | ${MKDIR} -p ${OBJECTDIR}
67 | ${RM} "$@.d"
68 | $(COMPILE.cc) -g -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp
69 |
70 | # Subprojects
71 | .build-subprojects:
72 |
73 | # Clean Targets
74 | .clean-conf: ${CLEAN_SUBPROJECTS}
75 | ${RM} -r ${CND_BUILDDIR}/${CND_CONF}
76 | ${RM} ${CND_CONF}/testg7112aac
77 |
78 | # Subprojects
79 | .clean-subprojects:
80 |
81 | # Enable dependency checking
82 | .dep.inc: .depcheck-impl
83 |
84 | include .dep.inc
85 |
--------------------------------------------------------------------------------
/libfaac/util.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: util.h,v 1.8 2003/12/20 04:32:48 stux Exp $
20 | */
21 |
22 | #ifndef UTIL_H
23 | #define UTIL_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif /* __cplusplus */
28 |
29 | #include
30 | #include
31 |
32 | #ifndef max
33 | #define max(a, b) (((a) > (b)) ? (a) : (b))
34 | #endif
35 | #ifndef min
36 | #define min(a, b) (((a) < (b)) ? (a) : (b))
37 | #endif
38 |
39 | #ifndef M_PI
40 | #define M_PI 3.14159265358979323846
41 | #endif
42 |
43 | /* Memory functions */
44 | #define AllocMemory(size) malloc(size)
45 | #define FreeMemory(block) free(block)
46 | #define SetMemory(block, value, size) memset(block, value, size)
47 |
48 | int GetSRIndex(unsigned int sampleRate);
49 | int GetMaxPredSfb(int samplingRateIdx);
50 | unsigned int MaxBitrate(unsigned long sampleRate);
51 | unsigned int MinBitrate();
52 | unsigned int MaxBitresSize(unsigned long bitRate, unsigned long sampleRate);
53 | unsigned int BitAllocation(double pe, int short_block);
54 |
55 | #ifdef __cplusplus
56 | }
57 | #endif /* __cplusplus */
58 |
59 | #endif /* UTIL_H */
60 |
--------------------------------------------------------------------------------
/nbproject/Makefile-variables.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated - do not edit!
3 | #
4 | # NOCDDL
5 | #
6 | CND_BASEDIR=`pwd`
7 | CND_BUILDDIR=build
8 | CND_DISTDIR=dist
9 | # Debug configuration
10 | CND_PLATFORM_Debug=GNU-Linux
11 | CND_ARTIFACT_DIR_Debug=${AVS_ROOT}/lib
12 | CND_ARTIFACT_NAME_Debug=libg7112aac.so
13 | CND_ARTIFACT_PATH_Debug=${AVS_ROOT}/lib/libg7112aac.so
14 | CND_PACKAGE_DIR_Debug=dist/Debug/GNU-Linux/package
15 | CND_PACKAGE_NAME_Debug=libEasyAACEncoder.so.tar
16 | CND_PACKAGE_PATH_Debug=dist/Debug/GNU-Linux/package/libEasyAACEncoder.so.tar
17 | # i386 configuration
18 | CND_PLATFORM_i386=GNU-Linux
19 | CND_ARTIFACT_DIR_i386=i386
20 | CND_ARTIFACT_NAME_i386=libEasyAACEncoder.a
21 | CND_ARTIFACT_PATH_i386=i386/libEasyAACEncoder.a
22 | CND_PACKAGE_DIR_i386=dist/i386/GNU-Linux/package
23 | CND_PACKAGE_NAME_i386=EasyAACEncoder.tar
24 | CND_PACKAGE_PATH_i386=dist/i386/GNU-Linux/package/EasyAACEncoder.tar
25 | # x64 configuration
26 | CND_PLATFORM_x64=GNU-Linux
27 | CND_ARTIFACT_DIR_x64=x64
28 | CND_ARTIFACT_NAME_x64=libEasyAACEncoder.a
29 | CND_ARTIFACT_PATH_x64=x64/libEasyAACEncoder.a
30 | CND_PACKAGE_DIR_x64=dist/x64/GNU-Linux/package
31 | CND_PACKAGE_NAME_x64=EasyAACEncoder.tar
32 | CND_PACKAGE_PATH_x64=dist/x64/GNU-Linux/package/EasyAACEncoder.tar
33 | # arm configuration
34 | CND_PLATFORM_arm=hisiv100-Linux
35 | CND_ARTIFACT_DIR_arm=arm
36 | CND_ARTIFACT_NAME_arm=libEasyAACEncoder.a
37 | CND_ARTIFACT_PATH_arm=arm/libEasyAACEncoder.a
38 | CND_PACKAGE_DIR_arm=dist/arm/hisiv100-Linux/package
39 | CND_PACKAGE_NAME_arm=EasyAACEncoder.tar
40 | CND_PACKAGE_PATH_arm=dist/arm/hisiv100-Linux/package/EasyAACEncoder.tar
41 | #
42 | # include compiler specific variables
43 | #
44 | # dmake command
45 | ROOT:sh = test -f nbproject/private/Makefile-variables.mk || \
46 | (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk)
47 | #
48 | # gmake command
49 | .PHONY: $(shell test -f nbproject/private/Makefile-variables.mk || (mkdir -p nbproject/private && touch nbproject/private/Makefile-variables.mk))
50 | #
51 | include nbproject/private/Makefile-variables.mk
52 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/Makefile-Release.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated Makefile - do not edit!
3 | #
4 | # Edit the Makefile in the project folder instead (../Makefile). Each target
5 | # has a -pre and a -post target defined where you can add customized code.
6 | #
7 | # This makefile implements configuration specific macros and targets.
8 |
9 |
10 | # Environment
11 | MKDIR=mkdir
12 | CP=cp
13 | GREP=grep
14 | NM=nm
15 | CCADMIN=CCadmin
16 | RANLIB=ranlib
17 | CC=gcc
18 | CCC=g++
19 | CXX=g++
20 | FC=gfortran
21 | AS=as
22 |
23 | # Macros
24 | CND_PLATFORM=GNU-Linux-x86
25 | CND_DLIB_EXT=so
26 | CND_CONF=Release
27 | CND_DISTDIR=dist
28 | CND_BUILDDIR=build
29 |
30 | # Include project Makefile
31 | include Makefile
32 |
33 | # Object Directory
34 | OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}
35 |
36 | # Object Files
37 | OBJECTFILES= \
38 | ${OBJECTDIR}/main.o
39 |
40 |
41 | # C Compiler Flags
42 | CFLAGS=
43 |
44 | # CC Compiler Flags
45 | CCFLAGS=
46 | CXXFLAGS=
47 |
48 | # Fortran Compiler Flags
49 | FFLAGS=
50 |
51 | # Assembler Flags
52 | ASFLAGS=
53 |
54 | # Link Libraries and Options
55 | LDLIBSOPTIONS=
56 |
57 | # Build Targets
58 | .build-conf: ${BUILD_SUBPROJECTS}
59 | "${MAKE}" -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/testg7112aac
60 |
61 | ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/testg7112aac: ${OBJECTFILES}
62 | ${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
63 | ${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/testg7112aac ${OBJECTFILES} ${LDLIBSOPTIONS}
64 |
65 | ${OBJECTDIR}/main.o: main.cpp
66 | ${MKDIR} -p ${OBJECTDIR}
67 | ${RM} "$@.d"
68 | $(COMPILE.cc) -O2 -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp
69 |
70 | # Subprojects
71 | .build-subprojects:
72 |
73 | # Clean Targets
74 | .clean-conf: ${CLEAN_SUBPROJECTS}
75 | ${RM} -r ${CND_BUILDDIR}/${CND_CONF}
76 | ${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/testg7112aac
77 |
78 | # Subprojects
79 | .clean-subprojects:
80 |
81 | # Enable dependency checking
82 | .dep.inc: .depcheck-impl
83 |
84 | include .dep.inc
85 |
--------------------------------------------------------------------------------
/libfaac/filtbank.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: filtbank.h,v 1.11 2005/02/02 07:51:49 sur Exp $
20 | */
21 |
22 | #ifndef FILTBANK_H
23 | #define FILTBANK_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif /* __cplusplus */
28 |
29 | #include "frame.h"
30 |
31 | #ifdef DRM
32 | #define NFLAT_LS (( BLOCK_LEN_LONG - BLOCK_LEN_SHORT ) / 2)
33 | #else
34 | #define NFLAT_LS 448
35 | #endif
36 |
37 | #define MOVERLAPPED 0
38 | #define MNON_OVERLAPPED 1
39 |
40 |
41 | #define SINE_WINDOW 0
42 | #define KBD_WINDOW 1
43 |
44 | void FilterBankInit ( faacEncHandle hEncoder );
45 |
46 | void FilterBankEnd ( faacEncHandle hEncoder );
47 |
48 | void FilterBank( faacEncHandle hEncoder,
49 | CoderInfo *coderInfo,
50 | double *p_in_data,
51 | double *p_out_mdct,
52 | double *p_overlap,
53 | int overlap_select );
54 |
55 | void IFilterBank( faacEncHandle hEncoder,
56 | CoderInfo *coderInfo,
57 | double *p_in_data,
58 | double *p_out_mdct,
59 | double *p_overlap,
60 | int overlap_select );
61 |
62 | void specFilter( double *freqBuff,
63 | int sampleRate,
64 | int lowpassFreq,
65 | int specLen );
66 |
67 | #ifdef __cplusplus
68 | }
69 | #endif /* __cplusplus */
70 |
71 | #endif /* FILTBANK_H */
72 |
--------------------------------------------------------------------------------
/IDecodeToPcm.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #include "IDecodeToPcm.h"
9 | #include "audio_buffer.h"
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 |
16 | IDecodeToPcm::IDecodeToPcm(void)
17 | {
18 | }
19 |
20 |
21 | IDecodeToPcm::~IDecodeToPcm(void)
22 | {
23 |
24 | }
25 | //------------------------------------------------------------------------------------------------------------------------
26 | InAudioInfo::InAudioInfo()
27 | {
28 | InitParam& initParam = m_initparam;
29 | initParam.u32AudioSamplerate=8000;
30 | initParam.ucAudioChannel=1;
31 | initParam.u32PCMBitSize=16;
32 | initParam.ucAudioCodec = Law_ALaw;
33 | }
34 | InAudioInfo::InAudioInfo(InitParam param):m_initparam(param)
35 | {
36 |
37 | }
38 | //------------------------------------------------------------------------------------------------------------------------
39 | //-------------------------------------------------------------------------------
40 | DecodeToPcmBase::DecodeToPcmBase(void)
41 | {
42 |
43 | }
44 |
45 |
46 | DecodeToPcmBase::~DecodeToPcmBase(void)
47 | {
48 |
49 | }
50 |
51 | int DecodeToPcmBase::Init(InAudioInfo info)
52 | {
53 | m_g7FrameSize = G711_ONE_LEN;
54 | return 0;
55 | }
56 | int DecodeToPcmBase::PCMSize()
57 | {
58 | return CON_PCM_SIZE;
59 | }
60 | int DecodeToPcmBase::G7FrameSize()
61 | {
62 | return m_g7FrameSize;
63 | }
64 | int DecodeToPcmBase::Decode(unsigned char* pout_buf, unsigned int* pout_len , unsigned char* pin_buf, unsigned int in_len)
65 | {
66 | int16_t *dst = (int16_t *) pout_buf;
67 | uint8_t *src = (uint8_t *) pin_buf;
68 | uint32_t i = 0;
69 | int Ret = 0;
70 |
71 | if ((NULL == pout_buf) || \
72 | (NULL == pout_len) || \
73 | (NULL == pin_buf) || \
74 | (0 == in_len))
75 | {
76 | return -1;
77 | }
78 |
79 | if (*pout_len < 2 * in_len)
80 | {
81 | return -2;
82 | }
83 | //---{{{
84 |
85 | for (i = 0; i < in_len; i++)
86 | {
87 | *(dst++) = (int16_t)DecodeOneChar(*(src++));
88 | }
89 |
90 | //---}}}
91 | *pout_len = 2 * in_len;
92 |
93 | Ret = 2 * in_len;
94 | return Ret;
95 | return 0;
96 | }
--------------------------------------------------------------------------------
/libfaac/tns.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************
2 |
3 | This software module was originally developed by
4 | and edited by Texas Instruments in the course of
5 | development of the MPEG-2 NBC/MPEG-4 Audio standard
6 | ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an
7 | implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools
8 | as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives
9 | users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this
10 | software module or modifications thereof for use in hardware or
11 | software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio
12 | standards. Those intending to use this software module in hardware or
13 | software products are advised that this use may infringe existing
14 | patents. The original developer of this software module and his/her
15 | company, the subsequent editors and their companies, and ISO/IEC have
16 | no liability for use of this software module or modifications thereof
17 | in an implementation. Copyright is not released for non MPEG-2
18 | NBC/MPEG-4 Audio conforming products. The original developer retains
19 | full right to use the code for his/her own purpose, assign or donate
20 | the code to a third party and to inhibit third party from using the
21 | code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This
22 | copyright notice must be included in all copies or derivative works.
23 |
24 | Copyright (c) 1997.
25 | **********************************************************************/
26 | /*
27 | * $Id: tns.h,v 1.5 2003/11/24 18:08:28 knik Exp $
28 | */
29 |
30 | #ifndef TNS_H
31 | #define TNS_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif /* __cplusplus */
36 |
37 |
38 | void TnsInit(faacEncHandle hEncoder);
39 | void TnsEncode(TnsInfo* tnsInfo, int numberOfBands,int maxSfb,enum WINDOW_TYPE blockType,
40 | int* sfbOffsetTable,double* spec);
41 | void TnsEncodeFilterOnly(TnsInfo* tnsInfo, int numberOfBands, int maxSfb,
42 | enum WINDOW_TYPE blockType, int *sfbOffsetTable, double *spec);
43 | void TnsDecodeFilterOnly(TnsInfo* tnsInfo, int numberOfBands, int maxSfb,
44 | enum WINDOW_TYPE blockType, int *sfbOffsetTable, double *spec);
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif /* __cplusplus */
49 |
50 | #endif /* TNS_H */
51 |
--------------------------------------------------------------------------------
/libfaac/aacquant.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: aacquant.h,v 1.9 2003/10/12 16:43:39 knik Exp $
20 | */
21 |
22 | #ifndef AACQUANT_H
23 | #define AACQUANT_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif /* __cplusplus */
28 |
29 | #include "coder.h"
30 | #include "psych.h"
31 |
32 | #define IXMAX_VAL 8191
33 | #define PRECALC_SIZE (IXMAX_VAL+2)
34 | #define LARGE_BITS 100000
35 | #define SF_OFFSET 100
36 |
37 | #define POW20(x) pow(2.0,((double)x)*.25)
38 | #define IPOW20(x) pow(2.0,-((double)x)*.1875)
39 |
40 | #pragma pack(push, 1)
41 | typedef struct
42 | {
43 | double *pow43;
44 | double *adj43;
45 | double quality;
46 | } AACQuantCfg;
47 | #pragma pack(pop)
48 |
49 | void AACQuantizeInit(CoderInfo *coderInfo, unsigned int numChannels,
50 | AACQuantCfg *aacquantCfg);
51 | void AACQuantizeEnd(CoderInfo *coderInfo, unsigned int numChannels,
52 | AACQuantCfg *aacquantCfg);
53 |
54 | int AACQuantize(CoderInfo *coderInfo,
55 | PsyInfo *psyInfo,
56 | ChannelInfo *channelInfo,
57 | int *cb_width,
58 | int num_cb,
59 | double *xr,
60 | AACQuantCfg *aacquantcfg);
61 |
62 | int SortForGrouping(CoderInfo* coderInfo,
63 | PsyInfo *psyInfo,
64 | ChannelInfo *channelInfo,
65 | int *sfb_width_table,
66 | double *xr);
67 | void CalcAvgEnrg(CoderInfo *coderInfo,
68 | const double *xr);
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif /* __cplusplus */
73 |
74 | #endif /* AACQUANT_H */
75 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/CHANGELOG:
--------------------------------------------------------------------------------
1 | 1.2.1 (April 4, 2004)
2 | compiles cleanly with just about every -W warning flag under the sun
3 |
4 | reorganized kiss_fft_state so it could be read-only/const. This may be useful for embedded systems
5 | that are willing to predeclare twiddle factors, factorization.
6 |
7 | Fixed C_MUL,S_MUL on 16-bit platforms.
8 |
9 | tmpbuf will only be allocated if input & output buffers are same
10 | scratchbuf will only be allocated for ffts that are not multiples of 2,3,5
11 |
12 | NOTE: The tmpbuf,scratchbuf changes may require synchronization code for multi-threaded apps.
13 |
14 |
15 | 1.2 (Feb 23, 2004)
16 | interface change -- cfg object is forward declaration of struct instead of void*
17 | This maintains type saftey and lets the compiler warn/error about stupid mistakes.
18 | (prompted by suggestion from Erik de Castro Lopo)
19 |
20 | small speed improvements
21 |
22 | added psdpng.c -- sample utility that will create png spectrum "waterfalls" from an input file
23 | ( not terribly useful yet)
24 |
25 | 1.1.1 (Feb 1, 2004 )
26 | minor bug fix -- only affects odd rank, in-place, multi-dimensional FFTs
27 |
28 | 1.1 : (Jan 30,2004)
29 | split sample_code/ into test/ and tools/
30 |
31 | Removed 2-D fft and added N-D fft (arbitrary)
32 |
33 | modified fftutil.c to allow multi-d FFTs
34 |
35 | Modified core fft routine to allow an input stride via kiss_fft_stride()
36 | (eased support of multi-D ffts)
37 |
38 | Added fast convolution filtering (FIR filtering using overlap-scrap method, with tail scrap)
39 |
40 | Add kfc.[ch]: the KISS FFT Cache. It takes care of allocs for you ( suggested by Oscar Lesta ).
41 |
42 | 1.0.1 (Dec 15, 2003)
43 | fixed bug that occurred when nfft==1
44 |
45 | 1.0 : (Dec 14, 2003)
46 | changed kiss_fft function from using a single buffer, to two buffers.
47 | If the same buffer pointer is supplied for both in and out, kiss will
48 | manage the buffer copies.
49 |
50 | added kiss_fft2d and kiss_fftr as separate source files (declarations in kiss_fft.h )
51 |
52 | 0.4 :(Nov 4,2003) optimized for radix 2,3,4,5
53 |
54 | 0.3 :(Oct 28, 2003) woops, version 2 didn't actually factor out any radices other than 2
55 |
56 | 0.2 :(Oct 27, 2003) added mixed radix, only radix 2,4 optimized versions
57 |
58 | 0.1 :(May 19 2003) initial release, radix 2 only
59 |
--------------------------------------------------------------------------------
/PcmToAac.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #include "PcmToAac.h"
9 |
10 | #include "outDebug.h"
11 |
12 | PcmToAac::PcmToAac(void)
13 | {
14 | m_nInputSamples=0;
15 | m_nMaxOutputBytes=0;
16 | m_nPCMBitSize = 16;
17 | }
18 |
19 |
20 | PcmToAac::~PcmToAac(void)
21 | {
22 | if (NULL != hEncoder)
23 | {
24 | /*Close FAAC engine*/
25 | faacEncClose(hEncoder);
26 | }
27 |
28 | }
29 |
30 | bool PcmToAac::Init(InAudioInfo* info)
31 | {
32 | unsigned int objectType = LOW;
33 | unsigned int mpegVersion = MPEG2;
34 | static unsigned int useTns = 0; //#define DEFAULT_TNS 0
35 |
36 | //TODO: config this
37 | unsigned int nChannels = /*1*/info->Channel();
38 |
39 | m_nPCMBitSize = /*16*/ info->PCMBitSize();
40 | unsigned long nInputSamples = 0;
41 | unsigned long nSampleRate = /*8000*/info->Samplerate();
42 | unsigned long nMaxOutputBytes = 0;
43 |
44 |
45 | /*open FAAC engine*/
46 | hEncoder = faacEncOpen(nSampleRate, nChannels, &nInputSamples, &nMaxOutputBytes);
47 | if (hEncoder == NULL)
48 | {
49 | if(AAC_DEBUG) printf("%s:[%d] failed to call faacEncOpen !\n", __FUNCTION__, __LINE__);
50 | //return -1;
51 | return false;
52 | }
53 | m_nInputSamples = nInputSamples;
54 | m_nMaxOutputBytes = nMaxOutputBytes;
55 |
56 |
57 | /*get current encoding configuration*/
58 | pConfiguration = faacEncGetCurrentConfiguration(hEncoder);
59 | pConfiguration->inputFormat = FAAC_INPUT_16BIT;
60 |
61 | /*0 - raw; 1 - ADTS*/
62 | pConfiguration->outputFormat = 1;
63 | pConfiguration->useTns = useTns;
64 | pConfiguration->aacObjectType = objectType;
65 | pConfiguration->mpegVersion = mpegVersion;
66 |
67 | /*set encoding configuretion*/
68 | faacEncSetConfiguration(hEncoder, pConfiguration);
69 |
70 | return true;
71 | }
72 |
73 | int PcmToAac::Encode(int32_t * pbPCMBuffer, unsigned int nPCMBufferSize, unsigned char * pbAACBuffer, unsigned int nMaxOutputBytes)
74 | {
75 | unsigned int nPCMBitSize = GetPCMBitSize();
76 |
77 |
78 | unsigned int nInputSamples = (nPCMBufferSize / (nPCMBitSize / 8));
79 | if(AAC_DEBUG) printf("%s:[%d] G711A -> PCM faacEncEncode....\n", __FUNCTION__, __LINE__);
80 | int nRet = faacEncEncode(hEncoder, (int*) pbPCMBuffer, nInputSamples, pbAACBuffer, nMaxOutputBytes);
81 | if(AAC_DEBUG) printf("%s:[%d] G711A -> PCM faacEncEncode\n", __FUNCTION__, __LINE__);
82 |
83 | return nRet;
84 | }
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/configurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | main.cpp
8 |
9 |
10 |
11 |
15 |
16 |
20 | Makefile
21 |
22 |
23 | Makefile
24 |
25 |
26 |
27 | default
28 | true
29 | false
30 |
31 |
32 |
33 |
34 |
35 | ${AVS_ROOT}/lib
36 |
37 | -lg7112aac
38 |
39 |
40 | -
41 |
42 |
43 |
44 |
45 | default
46 | true
47 | false
48 |
49 |
50 |
51 | 5
52 |
53 |
54 | 5
55 |
56 |
57 | 5
58 |
59 |
60 | 5
61 |
62 |
63 | -
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/libfaac/psych.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: psych.h,v 1.14 2005/04/24 19:16:14 rjamorim Exp $
20 | */
21 |
22 | #ifndef PSYCH_H
23 | #define PSYCH_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif /* __cplusplus */
28 |
29 | #ifndef M_PI
30 | #define M_PI 3.14159265358979323846
31 | #endif
32 |
33 | #include "coder.h"
34 | #include "channels.h"
35 | #include "fft.h"
36 |
37 | typedef struct {
38 | int size;
39 | int sizeS;
40 |
41 | /* Previous input samples */
42 | double *prevSamples;
43 | double *prevSamplesS;
44 |
45 | int block_type;
46 |
47 | void *data;
48 | } PsyInfo;
49 |
50 | typedef struct {
51 | double sampleRate;
52 |
53 | /* Hann window */
54 | double *hannWindow;
55 | double *hannWindowS;
56 |
57 | void *data;
58 | } GlobalPsyInfo;
59 |
60 | typedef struct
61 | {
62 | void (*PsyInit) (GlobalPsyInfo *gpsyInfo, PsyInfo *psyInfo,
63 | unsigned int numChannels, unsigned int sampleRate,
64 | int *cb_width_long, int num_cb_long,
65 | int *cb_width_short, int num_cb_short);
66 | void (*PsyEnd) (GlobalPsyInfo *gpsyInfo, PsyInfo *psyInfo,
67 | unsigned int numChannels);
68 | void (*PsyCalculate) (ChannelInfo *channelInfo, GlobalPsyInfo *gpsyInfo,
69 | PsyInfo *psyInfo, int *cb_width_long, int num_cb_long,
70 | int *cb_width_short, int num_cb_short,
71 | unsigned int numChannels);
72 | void (*PsyBufferUpdate) ( FFT_Tables *fft_tables, GlobalPsyInfo * gpsyInfo, PsyInfo * psyInfo,
73 | double *newSamples, unsigned int bandwidth,
74 | int *cb_width_short, int num_cb_short);
75 | void (*BlockSwitch) (CoderInfo *coderInfo, PsyInfo *psyInfo,
76 | unsigned int numChannels);
77 | } psymodel_t;
78 |
79 | extern psymodel_t psymodel2;
80 |
81 | #ifdef __cplusplus
82 | }
83 | #endif /* __cplusplus */
84 |
85 | #endif /* PSYCH_H */
--------------------------------------------------------------------------------
/IDecodeToPcm.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #pragma once
9 |
10 | #ifndef _IDECODETOPCM_H
11 | #define _IDECODETOPCM_H
12 |
13 | #include "EasyAACEncoderAPI.h"
14 |
15 | #define USE_SHOUT_G711PACK 1
16 |
17 | #if USE_SHOUT_G711PACK
18 | #define G711_ONE_LEN 160
19 | #define G711_ONE_OFFSET 0
20 |
21 | #else
22 | #define G711_ONE_LEN 164
23 | #define G711_ONE_OFFSET 4
24 | #endif
25 |
26 | const int CON_PCM_SIZE = 320;
27 |
28 | class audio_buffer;
29 |
30 | class InAudioInfo
31 | {
32 | public:
33 | InAudioInfo();
34 | InAudioInfo(InitParam param);
35 | ~InAudioInfo(){;}
36 |
37 | unsigned int CodecType()
38 | {
39 | return m_initparam.ucAudioCodec;
40 | //return m_u32AudioCodec;
41 | }
42 | unsigned int Samplerate()
43 | {
44 | return m_initparam.u32AudioSamplerate;
45 | //return m_u32AudioSamplerate;
46 | }
47 | unsigned int Channel()
48 | {
49 | return m_initparam.ucAudioChannel;
50 | //return m_u32AudioChannel;
51 | }
52 | unsigned int PCMBitSize()
53 | {
54 | return m_initparam.u32PCMBitSize;
55 | //return m_nPCMBitSize;
56 | }
57 | unsigned char G726RateBits()
58 | {
59 | return m_initparam.g726param.ucRateBits;
60 | }
61 | private:
62 | unsigned int m_u32AudioCodec;
63 | unsigned int m_u32AudioSamplerate;
64 | unsigned int m_u32AudioChannel;
65 |
66 | unsigned int m_nPCMBitSize;
67 |
68 | InitParam m_initparam;
69 | };
70 | //----------------------------------------------------------
71 | class IDecodeToPcm
72 | {
73 | public:
74 | IDecodeToPcm(void);
75 | virtual ~IDecodeToPcm(void);
76 |
77 | public:
78 | virtual int Init(InAudioInfo info)=0;
79 | virtual int Decode( unsigned char* outbuf, unsigned int* outlen , unsigned char* inbuf, unsigned int inlen)=0;
80 | virtual int PCMSize()=0;
81 | virtual int G7FrameSize()=0;
82 | };
83 | //----------------------------------------------------------------------------------------------------------------------
84 |
85 | //-------------------------------------------------------------------------------------------------------------------------
86 | class DecodeToPcmBase:public IDecodeToPcm
87 | {
88 | public:
89 | DecodeToPcmBase();
90 | virtual ~DecodeToPcmBase();
91 |
92 | int Init(InAudioInfo info);
93 |
94 | public:
95 | virtual int Decode(unsigned char* outbuf, unsigned int* outlen , unsigned char* inbuf, unsigned int inlen);
96 | virtual int PCMSize();
97 | virtual int G7FrameSize();
98 |
99 | virtual unsigned short DecodeOneChar(unsigned char data)=0;
100 |
101 | private:
102 | int m_g7FrameSize;
103 | };
104 |
105 | #endif
106 |
107 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/kiss_fft.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 | #ifndef KISS_FFT_H
8 | #define KISS_FFT_H
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | /*
20 | ATTENTION!
21 | If you would like a :
22 | -- a utility that will handle the caching of fft objects
23 | -- real-only FFT
24 | -- a multi-dimensional FFT
25 | -- a command-line utility to perform ffts
26 | -- a command-line utility to perform fast-convolution filtering
27 |
28 | then see tools/
29 | */
30 |
31 | #ifdef FIXED_POINT
32 | # define kiss_fft_scalar short
33 | #else
34 | # ifndef kiss_fft_scalar
35 | /* default is float */
36 | # define kiss_fft_scalar float
37 | # endif
38 | #endif
39 |
40 | typedef struct {
41 | kiss_fft_scalar r;
42 | kiss_fft_scalar i;
43 | }kiss_fft_cpx;
44 |
45 | typedef struct kiss_fft_state* kiss_fft_cfg;
46 |
47 | /*
48 | * kiss_fft_alloc
49 | *
50 | * Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
51 | *
52 | * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
53 | *
54 | * The return value from fft_alloc is a cfg buffer used internally
55 | * by the fft routine or NULL.
56 | *
57 | * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
58 | * The returned value should be free()d when done to avoid memory leaks.
59 | *
60 | * The state can be placed in a user supplied buffer 'mem':
61 | * If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
62 | * then the function places the cfg in mem and the size used in *lenmem
63 | * and returns mem.
64 | *
65 | * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
66 | * then the function returns NULL and places the minimum cfg
67 | * buffer size in *lenmem.
68 | * */
69 |
70 | kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
71 |
72 | /*
73 | * kiss_fft(cfg,in_out_buf)
74 | *
75 | * Perform an FFT on a complex input buffer.
76 | * for a forward FFT,
77 | * fin should be f[0] , f[1] , ... ,f[nfft-1]
78 | * fout will be F[0] , F[1] , ... ,F[nfft-1]
79 | * Note that each element is complex and can be accessed like
80 | f[k].r and f[k].i
81 | * */
82 | void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
83 |
84 | void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
85 |
86 | /* If kiss_fft_alloc allocated a buffer, it is one contiguous
87 | buffer and can be simply free()d when no longer needed*/
88 | #define kiss_fft_free free
89 |
90 | #ifdef __cplusplus
91 | }
92 | #endif
93 |
94 | #endif
95 |
--------------------------------------------------------------------------------
/include/faac.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: faac.h,v 1.36 2009/01/25 18:50:32 menno Exp $
20 | */
21 |
22 | #ifndef _FAAC_H_
23 | #define _FAAC_H_
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif /* __cplusplus */
28 |
29 | #if defined(_WIN32) && !defined(__MINGW32__)
30 | # ifndef FAACAPI
31 | # define FAACAPI __stdcall
32 | # endif
33 | #else
34 | # ifndef FAACAPI
35 | # define FAACAPI
36 | # endif
37 | #endif
38 |
39 | #pragma pack(push, 1)
40 |
41 | typedef struct {
42 | void *ptr;
43 | char *name;
44 | }
45 | psymodellist_t;
46 |
47 | #include "faaccfg.h"
48 |
49 |
50 | typedef void *faacEncHandle;
51 |
52 | #ifndef HAVE_INT32_T
53 | typedef signed int int32_t;
54 | #endif
55 |
56 | /*
57 | Allows an application to get FAAC version info. This is intended
58 | purely for informative purposes.
59 |
60 | Returns FAAC_CFG_VERSION.
61 | */
62 | int FAACAPI faacEncGetVersion(char **faac_id_string,
63 | char **faac_copyright_string);
64 |
65 |
66 | faacEncConfigurationPtr FAACAPI
67 | faacEncGetCurrentConfiguration(faacEncHandle hEncoder);
68 |
69 |
70 | int FAACAPI faacEncSetConfiguration(faacEncHandle hEncoder,
71 | faacEncConfigurationPtr config);
72 |
73 |
74 | faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate,
75 | unsigned int numChannels,
76 | unsigned long *inputSamples,
77 | unsigned long *maxOutputBytes);
78 |
79 |
80 | int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder, unsigned char **ppBuffer,
81 | unsigned long *pSizeOfDecoderSpecificInfo);
82 |
83 |
84 | int FAACAPI faacEncEncode(faacEncHandle hEncoder, int32_t * inputBuffer, unsigned int samplesInput,
85 | unsigned char *outputBuffer,
86 | unsigned int bufferSize);
87 |
88 |
89 | int FAACAPI faacEncClose(faacEncHandle hEncoder);
90 |
91 |
92 |
93 | #pragma pack(pop)
94 |
95 | #ifdef __cplusplus
96 | }
97 | #endif /* __cplusplus */
98 |
99 | #endif /* _FAAC_H_ */
100 |
--------------------------------------------------------------------------------
/libfaac/util.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: util.c,v 1.10 2005/02/02 07:56:33 sur Exp $
20 | */
21 |
22 | #include
23 |
24 | #include "util.h"
25 | #include "coder.h" // FRAME_LEN
26 |
27 | /* Returns the sample rate index */
28 | int GetSRIndex(unsigned int sampleRate)
29 | {
30 | if (92017 <= sampleRate) return 0;
31 | if (75132 <= sampleRate) return 1;
32 | if (55426 <= sampleRate) return 2;
33 | if (46009 <= sampleRate) return 3;
34 | if (37566 <= sampleRate) return 4;
35 | if (27713 <= sampleRate) return 5;
36 | if (23004 <= sampleRate) return 6;
37 | if (18783 <= sampleRate) return 7;
38 | if (13856 <= sampleRate) return 8;
39 | if (11502 <= sampleRate) return 9;
40 | if (9391 <= sampleRate) return 10;
41 |
42 | return 11;
43 | }
44 |
45 | /* Returns the maximum bitrate per channel for that sampling frequency */
46 | unsigned int MaxBitrate(unsigned long sampleRate)
47 | {
48 | /*
49 | * Maximum of 6144 bit for a channel
50 | */
51 | return (unsigned int)(6144.0 * (double)sampleRate/(double)FRAME_LEN + .5);
52 | }
53 |
54 | /* Returns the minimum bitrate per channel for that sampling frequency */
55 | unsigned int MinBitrate()
56 | {
57 | return 8000;
58 | }
59 |
60 |
61 | /* Max prediction band for backward predictionas function of fs index */
62 | const int MaxPredSfb[] = { 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 0 };
63 |
64 | int GetMaxPredSfb(int samplingRateIdx)
65 | {
66 | return MaxPredSfb[samplingRateIdx];
67 | }
68 |
69 |
70 |
71 | /* Calculate bit_allocation based on PE */
72 | unsigned int BitAllocation(double pe, int short_block)
73 | {
74 | double pew1;
75 | double pew2;
76 | double bit_allocation;
77 |
78 | if (short_block) {
79 | pew1 = 0.6;
80 | pew2 = 24.0;
81 | } else {
82 | pew1 = 0.3;
83 | pew2 = 6.0;
84 | }
85 | bit_allocation = pew1 * pe + pew2 * sqrt(pe);
86 | bit_allocation = min(max(0.0, bit_allocation), 6144.0);
87 |
88 | return (unsigned int)(bit_allocation+0.5);
89 | }
90 |
91 | /* Returns the maximum bit reservoir size */
92 | unsigned int MaxBitresSize(unsigned long bitRate, unsigned long sampleRate)
93 | {
94 | return 6144 - (unsigned int)((double)bitRate/(double)sampleRate*(double)FRAME_LEN);
95 | }
96 |
--------------------------------------------------------------------------------
/libfaac/huffman.h:
--------------------------------------------------------------------------------
1 | /***********
2 |
3 | This software module was originally developed by Dolby
4 | Laboratories in the course of development of the MPEG-2 AAC/MPEG-4
5 | Audio standard ISO/IEC13818-7, 14496-1, 2 and 3. This software module is an implementation of a part
6 | of one or more MPEG-2 AAC/MPEG-4 Audio tools as specified by the
7 | MPEG-2 aac/MPEG-4 Audio standard. ISO/IEC gives users of the
8 | MPEG-2aac/MPEG-4 Audio standards free license to this software module
9 | or modifications thereof for use in hardware or software products
10 | claiming conformance to the MPEG-2 aac/MPEG-4 Audio standards. Those
11 | intending to use this software module in hardware or software products
12 | are advised that this use may infringe existing patents. The original
13 | developer of this software module, the subsequent
14 | editors and their companies, and ISO/IEC have no liability for use of
15 | this software module or modifications thereof in an
16 | implementation. Copyright is not released for non MPEG-2 aac/MPEG-4
17 | Audio conforming products. The original developer retains full right to
18 | use the code for the developer's own purpose, assign or donate the code to a
19 | third party and to inhibit third party from using the code for non
20 | MPEG-2 aac/MPEG-4 Audio conforming products. This copyright notice
21 | must be included in all copies or derivative works. Copyright 1996.
22 |
23 | ***********/
24 | /*
25 | * $Id: huffman.h,v 1.6 2004/07/12 08:46:43 corrados Exp $
26 | */
27 |
28 | #ifndef HUFFMAN_H
29 | #define HUFFMAN_H
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif /* __cplusplus */
34 |
35 | #include "bitstream.h"
36 | #include "coder.h"
37 |
38 | /* Huffman tables */
39 | #define MAXINDEX 289
40 | #define NUMINTAB 2
41 | #define FIRSTINTAB 0
42 | #define LASTINTAB 1
43 |
44 | #define INTENSITY_HCB 15
45 | #define INTENSITY_HCB2 14
46 |
47 |
48 | #define ABS(A) ((A) < 0 ? (-A) : (A))
49 |
50 | #include "frame.h"
51 |
52 | void HuffmanInit(CoderInfo *coderInfo, unsigned int numChannels);
53 | void HuffmanEnd(CoderInfo *coderInfo, unsigned int numChannels);
54 |
55 | int BitSearch(CoderInfo *coderInfo,
56 | int *quant);
57 |
58 | int NoiselessBitCount(CoderInfo *coderInfo,
59 | int *quant,
60 | int hop,
61 | int min_book_choice[112][3]);
62 |
63 | static int CalculateEscSequence(int input, int *len_esc_sequence);
64 |
65 | int CalcBits(CoderInfo *coderInfo,
66 | int book,
67 | int *quant,
68 | int offset,
69 | int length);
70 |
71 | int OutputBits(CoderInfo *coderInfo,
72 | #ifdef DRM
73 | int *book, /* we need to change book for VCB11 */
74 | #else
75 | int book,
76 | #endif
77 | int *quant,
78 | int offset,
79 | int length);
80 |
81 | int SortBookNumbers(CoderInfo *coderInfo,
82 | BitStream *bitStream,
83 | int writeFlag);
84 |
85 | int WriteScalefactors(CoderInfo *coderInfo,
86 | BitStream *bitStream,
87 | int writeFlag);
88 |
89 | #ifdef __cplusplus
90 | }
91 | #endif /* __cplusplus */
92 |
93 | #endif /* HUFFMAN_H */
94 |
--------------------------------------------------------------------------------
/EasyDSSBuffers.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #include "EasyDSSBuffers.h"
9 |
10 | int init_buffers(buffers_t * bufs, int bufsize, int bufnum)
11 | {
12 | int i;
13 | bufs->rear = 0;
14 | bufs->front = 0;
15 | if(bufnum > MAX_BUF_NUM)
16 | {
17 | bufs->bufnum = MAX_BUF_NUM;
18 | }
19 | else
20 | {
21 | bufs->bufnum = bufnum;
22 | }
23 | for(i = 0; i < bufs->bufnum; i++)
24 | {
25 | bufs->buf[i].length = 0;
26 | bufs->buf[i].start = (char *) calloc(1, bufsize);
27 | bufs->buf[i].frame_type = -1;
28 | bufs->buf[i].channel = -1;
29 | bufs->buf[i].frame_index = 0;
30 | if(bufs->buf[i].start == NULL)
31 | return -1;
32 | }
33 | #ifdef WIN32
34 | InitializeCriticalSection(&(bufs->cs));
35 | #else
36 | InitializeCriticalSection(&(bufs->cs), NULL);
37 | #endif
38 | return 0;
39 | }
40 |
41 | int free_buffers(buffers_t* bufs)
42 | {
43 | for(int i = 0; i < bufs->bufnum; i++)
44 | {
45 | if(bufs->buf[i].start != NULL)
46 | free(bufs->buf[i].start);
47 | }
48 | bufs->pOnVideoData = NULL;
49 | DeleteCriticalSection(&(bufs->cs));
50 | return 0;
51 | }
52 |
53 | int buffers_get_data(void *data, unsigned int *length, buffers_t * bufs, int *type,
54 | int *channel, int *frame_index)
55 | {
56 | int res = -1;
57 | EnterCriticalSection(&(bufs->cs));
58 | if(bufs->front != bufs->rear)
59 | {
60 | res = *length = bufs->buf[bufs->front].length;
61 | memcpy(data, bufs->buf[bufs->front].start, *length);
62 | *type = bufs->buf[bufs->front].frame_type;
63 | *channel = bufs->buf[bufs->front].channel;
64 | *frame_index = bufs->buf[bufs->front].frame_index;
65 | bufs->front = (bufs->front + 1) % bufs->bufnum;
66 | //res = 1;
67 | }
68 | LeaveCriticalSection(&(bufs->cs));
69 | return res;
70 | }
71 |
72 | int buffers_put_data(void *data, unsigned int length, buffers_t * bufs, int type,
73 | int channel, int frame_index)
74 | {
75 | int res = 0;
76 | EnterCriticalSection(&(bufs->cs));
77 |
78 | if(((bufs->rear + 1) % bufs->bufnum) == bufs->front)
79 | {
80 | res = -1;
81 | }
82 | else
83 | {
84 | bufs->buf[bufs->rear].length = length;
85 | bufs->buf[bufs->rear].frame_type = type;
86 | bufs->buf[bufs->rear].channel = channel;
87 | bufs->buf[bufs->rear].frame_index = frame_index;
88 | if(length < iBufLen)
89 | {
90 | memcpy(bufs->buf[bufs->rear].start, data, length);
91 | }
92 | else
93 | {
94 | //WriteSystemLog("DataRecv.log", "Frame is too large");
95 | printf("Frame is too large, length=%d\r\n", length);
96 | }
97 | bufs->rear = (bufs->rear + 1) % bufs->bufnum;
98 | res = 1;
99 | }
100 |
101 | LeaveCriticalSection(&(bufs->cs));
102 | return res;
103 | }
104 |
105 | void buffers_clear_data(buffers_t * bufs)
106 | {
107 | EnterCriticalSection(&(bufs->cs));
108 | bufs->rear = 0;
109 | bufs->front = 0;
110 | LeaveCriticalSection(&(bufs->cs));
111 | }
112 |
113 |
114 |
--------------------------------------------------------------------------------
/libfaac/libfaac.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {b81f9b9e-5742-411b-80c3-c4808b31e14e}
6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
7 |
8 |
9 | {94077488-5090-4862-9948-f68879bd1579}
10 | h;hpp;hxx;hm;inl
11 |
12 |
13 |
14 |
15 | Source Files
16 |
17 |
18 | Source Files
19 |
20 |
21 | Source Files
22 |
23 |
24 | Source Files
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 | Source Files
40 |
41 |
42 | Source Files
43 |
44 |
45 | Source Files
46 |
47 |
48 | Source Files
49 |
50 |
51 | Source Files
52 |
53 |
54 |
55 |
56 | Header Files
57 |
58 |
59 | Header Files
60 |
61 |
62 | Header Files
63 |
64 |
65 | Header Files
66 |
67 |
68 | Header Files
69 |
70 |
71 | Header Files
72 |
73 |
74 | Header Files
75 |
76 |
77 | Header Files
78 |
79 |
80 | Header Files
81 |
82 |
83 | Header Files
84 |
85 |
86 | Header Files
87 |
88 |
89 | Header Files
90 |
91 |
92 | Header Files
93 |
94 |
95 | Header Files
96 |
97 |
98 | Header Files
99 |
100 |
101 |
--------------------------------------------------------------------------------
/include/faaccfg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: faaccfg.h,v 1.3 2004/07/04 12:12:05 corrados Exp $
20 | */
21 |
22 | #ifndef _FAACCFG_H_
23 | #define _FAACCFG_H_
24 |
25 | #define FAAC_CFG_VERSION 104
26 |
27 | /* MPEG ID's */
28 | #define MPEG2 1
29 | #define MPEG4 0
30 |
31 | /* AAC object types */
32 | #define MAIN 1
33 | #define LOW 2
34 | #define SSR 3
35 | #define LTP 4
36 |
37 | /* Input Formats */
38 | #define FAAC_INPUT_NULL 0
39 | #define FAAC_INPUT_16BIT 1
40 | #define FAAC_INPUT_24BIT 2
41 | #define FAAC_INPUT_32BIT 3
42 | #define FAAC_INPUT_FLOAT 4
43 |
44 | #define SHORTCTL_NORMAL 0
45 | #define SHORTCTL_NOSHORT 1
46 | #define SHORTCTL_NOLONG 2
47 |
48 | #pragma pack(push, 1)
49 | typedef struct faacEncConfiguration
50 | {
51 | /* config version */
52 | int version;
53 |
54 | /* library version */
55 | char *name;
56 |
57 | /* copyright string */
58 | char *copyright;
59 |
60 | /* MPEG version, 2 or 4 */
61 | unsigned int mpegVersion;
62 |
63 | /* AAC object type */
64 | unsigned int aacObjectType;
65 |
66 | /* Allow mid/side coding */
67 | unsigned int allowMidside;
68 |
69 | /* Use one of the channels as LFE channel */
70 | unsigned int useLfe;
71 |
72 | /* Use Temporal Noise Shaping */
73 | unsigned int useTns;
74 |
75 | /* bitrate / channel of AAC file */
76 | unsigned long bitRate;
77 |
78 | /* AAC file frequency bandwidth */
79 | unsigned int bandWidth;
80 |
81 | /* Quantizer quality */
82 | unsigned long quantqual;
83 |
84 | /* Bitstream output format (0 = Raw; 1 = ADTS) */
85 | unsigned int outputFormat;
86 |
87 | /* psychoacoustic model list */
88 | psymodellist_t *psymodellist;
89 |
90 | /* selected index in psymodellist */
91 | unsigned int psymodelidx;
92 |
93 | /*
94 | PCM Sample Input Format
95 | 0 FAAC_INPUT_NULL invalid, signifies a misconfigured config
96 | 1 FAAC_INPUT_16BIT native endian 16bit
97 | 2 FAAC_INPUT_24BIT native endian 24bit in 24 bits (not implemented)
98 | 3 FAAC_INPUT_32BIT native endian 24bit in 32 bits (DEFAULT)
99 | 4 FAAC_INPUT_FLOAT 32bit floating point
100 | */
101 | unsigned int inputFormat;
102 |
103 | /* block type enforcing (SHORTCTL_NORMAL/SHORTCTL_NOSHORT/SHORTCTL_NOLONG) */
104 | int shortctl;
105 |
106 | /*
107 | Channel Remapping
108 |
109 | Default 0, 1, 2, 3 ... 63 (64 is MAX_CHANNELS in coder.h)
110 |
111 | WAVE 4.0 2, 0, 1, 3
112 | WAVE 5.0 2, 0, 1, 3, 4
113 | WAVE 5.1 2, 0, 1, 4, 5, 3
114 | AIFF 5.1 2, 0, 3, 1, 4, 5
115 | */
116 | int channel_map[64];
117 |
118 | } faacEncConfiguration, *faacEncConfigurationPtr;
119 |
120 | #pragma pack(pop)
121 |
122 | #endif /* _FAACCFG_H_ */
123 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # There exist several targets which are by default empty and which can be
3 | # used for execution of your targets. These targets are usually executed
4 | # before and after some main targets. They are:
5 | #
6 | # .build-pre: called before 'build' target
7 | # .build-post: called after 'build' target
8 | # .clean-pre: called before 'clean' target
9 | # .clean-post: called after 'clean' target
10 | # .clobber-pre: called before 'clobber' target
11 | # .clobber-post: called after 'clobber' target
12 | # .all-pre: called before 'all' target
13 | # .all-post: called after 'all' target
14 | # .help-pre: called before 'help' target
15 | # .help-post: called after 'help' target
16 | #
17 | # Targets beginning with '.' are not intended to be called on their own.
18 | #
19 | # Main targets can be executed directly, and they are:
20 | #
21 | # build build a specific configuration
22 | # clean remove built files from a configuration
23 | # clobber remove all built files
24 | # all build all configurations
25 | # help print help mesage
26 | #
27 | # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
28 | # .help-impl are implemented in nbproject/makefile-impl.mk.
29 | #
30 | # Available make variables:
31 | #
32 | # CND_BASEDIR base directory for relative paths
33 | # CND_DISTDIR default top distribution directory (build artifacts)
34 | # CND_BUILDDIR default top build directory (object files, ...)
35 | # CONF name of current configuration
36 | # CND_PLATFORM_${CONF} platform name (current configuration)
37 | # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
38 | # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
39 | # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
40 | # CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
41 | # CND_PACKAGE_NAME_${CONF} name of package (current configuration)
42 | # CND_PACKAGE_PATH_${CONF} path to package (current configuration)
43 | #
44 | # NOCDDL
45 |
46 |
47 | # Environment
48 | MKDIR=mkdir
49 | CP=cp
50 | CCADMIN=CCadmin
51 |
52 |
53 | # build
54 | build: .build-post
55 |
56 | .build-pre:
57 | # Add your pre 'build' code here...
58 |
59 | .build-post: .build-impl
60 | # Add your post 'build' code here...
61 |
62 |
63 | # clean
64 | clean: .clean-post
65 |
66 | .clean-pre:
67 | # Add your pre 'clean' code here...
68 |
69 | .clean-post: .clean-impl
70 | # Add your post 'clean' code here...
71 |
72 |
73 | # clobber
74 | clobber: .clobber-post
75 |
76 | .clobber-pre:
77 | # Add your pre 'clobber' code here...
78 |
79 | .clobber-post: .clobber-impl
80 | # Add your post 'clobber' code here...
81 |
82 |
83 | # all
84 | all: .all-post
85 |
86 | .all-pre:
87 | # Add your pre 'all' code here...
88 |
89 | .all-post: .all-impl
90 | # Add your post 'all' code here...
91 |
92 |
93 | # build tests
94 | build-tests: .build-tests-post
95 |
96 | .build-tests-pre:
97 | # Add your pre 'build-tests' code here...
98 |
99 | .build-tests-post: .build-tests-impl
100 | # Add your post 'build-tests' code here...
101 |
102 |
103 | # run tests
104 | test: .test-post
105 |
106 | .test-pre: build-tests
107 | # Add your pre 'test' code here...
108 |
109 | .test-post: .test-impl
110 | # Add your post 'test' code here...
111 |
112 |
113 | # help
114 | help: .help-post
115 |
116 | .help-pre:
117 | # Add your pre 'help' code here...
118 |
119 | .help-post: .help-impl
120 | # Add your post 'help' code here...
121 |
122 |
123 |
124 | # include project implementation makefile
125 | include nbproject/Makefile-impl.mk
126 |
127 | # include project make variables
128 | include nbproject/Makefile-variables.mk
129 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # There exist several targets which are by default empty and which can be
3 | # used for execution of your targets. These targets are usually executed
4 | # before and after some main targets. They are:
5 | #
6 | # .build-pre: called before 'build' target
7 | # .build-post: called after 'build' target
8 | # .clean-pre: called before 'clean' target
9 | # .clean-post: called after 'clean' target
10 | # .clobber-pre: called before 'clobber' target
11 | # .clobber-post: called after 'clobber' target
12 | # .all-pre: called before 'all' target
13 | # .all-post: called after 'all' target
14 | # .help-pre: called before 'help' target
15 | # .help-post: called after 'help' target
16 | #
17 | # Targets beginning with '.' are not intended to be called on their own.
18 | #
19 | # Main targets can be executed directly, and they are:
20 | #
21 | # build build a specific configuration
22 | # clean remove built files from a configuration
23 | # clobber remove all built files
24 | # all build all configurations
25 | # help print help mesage
26 | #
27 | # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
28 | # .help-impl are implemented in nbproject/makefile-impl.mk.
29 | #
30 | # Available make variables:
31 | #
32 | # CND_BASEDIR base directory for relative paths
33 | # CND_DISTDIR default top distribution directory (build artifacts)
34 | # CND_BUILDDIR default top build directory (object files, ...)
35 | # CONF name of current configuration
36 | # CND_PLATFORM_${CONF} platform name (current configuration)
37 | # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
38 | # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
39 | # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
40 | # CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
41 | # CND_PACKAGE_NAME_${CONF} name of package (current configuration)
42 | # CND_PACKAGE_PATH_${CONF} path to package (current configuration)
43 | #
44 | # NOCDDL
45 |
46 |
47 | # Environment
48 | MKDIR=mkdir
49 | CP=cp
50 | CCADMIN=CCadmin
51 |
52 |
53 | # build
54 | build: .build-post
55 |
56 | .build-pre:
57 | # Add your pre 'build' code here...
58 |
59 | .build-post: .build-impl
60 | # Add your post 'build' code here...
61 |
62 |
63 | # clean
64 | clean: .clean-post
65 |
66 | .clean-pre:
67 | # Add your pre 'clean' code here...
68 |
69 | .clean-post: .clean-impl
70 | # Add your post 'clean' code here...
71 |
72 |
73 | # clobber
74 | clobber: .clobber-post
75 |
76 | .clobber-pre:
77 | # Add your pre 'clobber' code here...
78 |
79 | .clobber-post: .clobber-impl
80 | # Add your post 'clobber' code here...
81 |
82 |
83 | # all
84 | all: .all-post
85 |
86 | .all-pre:
87 | # Add your pre 'all' code here...
88 |
89 | .all-post: .all-impl
90 | # Add your post 'all' code here...
91 |
92 |
93 | # build tests
94 | build-tests: .build-tests-post
95 |
96 | .build-tests-pre:
97 | # Add your pre 'build-tests' code here...
98 |
99 | .build-tests-post: .build-tests-impl
100 | # Add your post 'build-tests' code here...
101 |
102 |
103 | # run tests
104 | test: .test-post
105 |
106 | .test-pre: build-tests
107 | # Add your pre 'test' code here...
108 |
109 | .test-post: .test-impl
110 | # Add your post 'test' code here...
111 |
112 |
113 | # help
114 | help: .help-post
115 |
116 | .help-pre:
117 | # Add your pre 'help' code here...
118 |
119 | .help-post: .help-impl
120 | # Add your post 'help' code here...
121 |
122 |
123 |
124 | # include project implementation makefile
125 | include nbproject/Makefile-impl.mk
126 |
127 | # include project make variables
128 | include nbproject/Makefile-variables.mk
129 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/_kiss_fft_guts.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2003-2004, Mark Borgerding
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 | * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 | */
14 |
15 | /* kiss_fft.h
16 | defines kiss_fft_scalar as either short or a float type
17 | and defines
18 | typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
19 | #include "kiss_fft.h"
20 |
21 |
22 | #define MAXFACTORS 32
23 | /* e.g. an fft of length 128 has 4 factors
24 | as far as kissfft is concerned
25 | 4*4*4*2
26 | */
27 |
28 | struct kiss_fft_state{
29 | int nfft;
30 | int inverse;
31 | int factors[2*MAXFACTORS];
32 | kiss_fft_cpx twiddles[1];
33 | };
34 |
35 | /*
36 | Explanation of macros dealing with complex math:
37 |
38 | C_MUL(m,a,b) : m = a*b
39 | C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
40 | C_SUB( res, a,b) : res = a - b
41 | C_SUBFROM( res , a) : res -= a
42 | C_ADDTO( res , a) : res += a
43 | * */
44 | #ifdef FIXED_POINT
45 |
46 | # define smul(a,b) ( (long)(a)*(b) )
47 | # define sround( x ) (short)( ( (x) + (1<<14) ) >>15 )
48 |
49 | # define S_MUL(a,b) sround( smul(a,b) )
50 |
51 | # define C_MUL(m,a,b) \
52 | do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
53 | (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
54 |
55 | # define C_FIXDIV(c,div) \
56 | do{ (c).r /= div; (c).i /=div; }while(0)
57 |
58 | # define C_MULBYSCALAR( c, s ) \
59 | do{ (c).r = sround( smul( (c).r , s ) ) ;\
60 | (c).i = sround( smul( (c).i , s ) ) ; }while(0)
61 |
62 | #else /* not FIXED_POINT*/
63 |
64 | # define S_MUL(a,b) ( (a)*(b) )
65 | #define C_MUL(m,a,b) \
66 | do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
67 | (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
68 | # define C_FIXDIV(c,div) /* NOOP */
69 | # define C_MULBYSCALAR( c, s ) \
70 | do{ (c).r *= (s);\
71 | (c).i *= (s); }while(0)
72 | #endif
73 |
74 | #define C_ADD( res, a,b)\
75 | do { (res).r=(a).r+(b).r; (res).i=(a).i+(b).i; }while(0)
76 | #define C_SUB( res, a,b)\
77 | do { (res).r=(a).r-(b).r; (res).i=(a).i-(b).i; }while(0)
78 | #define C_ADDTO( res , a)\
79 | do { (res).r += (a).r; (res).i += (a).i; }while(0)
80 | #define C_SUBFROM( res , a)\
81 | do { (res).r -= (a).r; (res).i -= (a).i; }while(0)
82 |
83 | static
84 | void kf_cexp(kiss_fft_cpx * x,double phase) /* returns e ** (j*phase) */
85 | {
86 | #ifdef FIXED_POINT
87 | x->r = (kiss_fft_scalar) (32767 * cos (phase));
88 | x->i = (kiss_fft_scalar) (32767 * sin (phase));
89 | #else
90 | x->r = cos (phase);
91 | x->i = sin (phase);
92 | #endif
93 | }
94 |
95 | /* a debugging function */
96 | #define pcpx(c)\
97 | fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
98 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/testEasyAACEncoder.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {812DF705-FDD7-4963-BAEB-ED531CAD3260}
15 | Win32Proj
16 | testg7112aac
17 | testEasyAACEncoder
18 |
19 |
20 |
21 | Application
22 | true
23 | MultiByte
24 |
25 |
26 | Application
27 | false
28 | true
29 | Unicode
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | true
43 | false
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
55 | MultiThreadedDebugDLL
56 |
57 |
58 | Console
59 | true
60 |
61 |
62 |
63 |
64 | Level3
65 |
66 |
67 | MaxSpeed
68 | true
69 | true
70 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
71 |
72 |
73 | Console
74 | true
75 | true
76 | true
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | {9d70b453-456d-47b7-8692-82d8bb6fbdf6}
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 | /*
8 | * File: main.cpp
9 | * Author: Wellsen@easydarwin.org
10 | *
11 | * Created on 2015年4月11日, 下午6:38
12 | */
13 |
14 | #include
15 | #include "../EasyAACEncoderAPI.h"
16 | #include
17 | #include
18 |
19 | using namespace std;
20 |
21 | //#define TEST_G711A_FILE "src.g711a" //私有
22 | #define TEST_G711A_FILE "g711.g711a" //标准
23 |
24 | #define TEST_AAC_FILE "dest.aac"
25 |
26 | int TestG711ToAAC_private();
27 | int TestG711ToAAC_standard();
28 | int TestG726ToAAC();
29 |
30 | int main(int argc, char** argv)
31 | {
32 | //TestG711ToAAC_private();
33 | //TestG711ToAAC_standard();
34 | TestG726ToAAC();
35 | return 0;
36 | }
37 |
38 | int TestG711ToAAC_standard()
39 | {
40 | InitParam initParam;
41 | initParam.u32AudioSamplerate=8000;
42 | initParam.ucAudioChannel=1;
43 | initParam.u32PCMBitSize=16;
44 | initParam.ucAudioCodec = Law_ALaw;
45 | //initParam.ucAudioCodec = Law_ULaw;
46 | EasyAACEncoder_Handle handle = Easy_AACEncoder_Init( initParam);
47 | char* infilename = "g711.g711a"; //标准
48 | char* outAacname = "g711.aac";
49 |
50 | FILE* fpIn = fopen(infilename, "rb");
51 | if(NULL == fpIn)
52 | {
53 | printf("%s:[%d] open %s file failed\n",__FUNCTION__,__LINE__,infilename);
54 | return -1;
55 | }
56 |
57 | FILE* fpOut = fopen(outAacname, "wb");
58 | if(NULL == fpOut)
59 | {
60 | printf("%s:[%d] open %s file failed\n",__FUNCTION__,__LINE__,outAacname);
61 | return -1;
62 | }
63 |
64 | int gBytesRead = 0;
65 | int bG711ABufferSize = 500;
66 | int bAACBufferSize = 4*bG711ABufferSize;//提供足够大的缓冲区
67 | unsigned char *pbG711ABuffer = (unsigned char *)malloc(bG711ABufferSize *sizeof(unsigned char));
68 | unsigned char *pbAACBuffer = (unsigned char*)malloc(bAACBufferSize * sizeof(unsigned char));
69 | unsigned int out_len = 0;
70 |
71 | while((gBytesRead = fread(pbG711ABuffer, 1, bG711ABufferSize, fpIn)) >0)
72 | {
73 | if(Easy_AACEncoder_Encode(handle, pbG711ABuffer, gBytesRead, pbAACBuffer, &out_len) > 0)
74 | {
75 | fwrite(pbAACBuffer, 1, out_len, fpOut);
76 | }
77 | }
78 |
79 | Easy_AACEncoder_Release(handle);
80 |
81 | free(pbG711ABuffer);
82 | free(pbAACBuffer);
83 | fclose(fpIn);
84 | fclose(fpOut);
85 |
86 | return 0;
87 | }
88 | int TestG726ToAAC()
89 | {
90 | InitParam initParam;
91 | initParam.u32AudioSamplerate=8000;
92 | initParam.ucAudioChannel=1;
93 | initParam.u32PCMBitSize=16;
94 | initParam.ucAudioCodec = Law_G726;
95 | //initParam.g726param.ucRateBits=Rate16kBits;
96 | //initParam.g726param.ucRateBits=Rate24kBits;
97 | //initParam.g726param.ucRateBits=Rate32kBits;
98 | initParam.g726param.ucRateBits=Rate40kBits;
99 |
100 | EasyAACEncoder_Handle handle = Easy_AACEncoder_Init(initParam);
101 | //char* infilename = "encode_out_16.g726";
102 | //char* outAacname = "encode_out_16.aac";
103 | //char* infilename = "encode_out_24.g726";
104 | //char* outAacname = "encode_out_24.aac";
105 | //char* infilename = "encode_out_32.g726";
106 | //char* outAacname = "encode_out_32.aac";
107 | char* infilename = "encode_out_40.g726";
108 | char* outAacname = "encode_out_40.aac";
109 |
110 | FILE* fpIn = fopen(infilename, "rb");
111 | if(NULL == fpIn)
112 | {
113 | printf("%s:[%d] open %s file failed\n",__FUNCTION__,__LINE__,infilename);
114 | return -1;
115 | }
116 |
117 | FILE* fpOut = fopen(outAacname, "wb");
118 | if(NULL == fpOut)
119 | {
120 | printf("%s:[%d] open %s file failed\n",__FUNCTION__,__LINE__,outAacname);
121 | return -1;
122 | }
123 |
124 | int gBytesRead = 0;
125 | int bG726BufferSize = 500;
126 | int bAACBufferSize = 4*bG726BufferSize;//提供足够大的缓冲区
127 | unsigned char *pbG726Buffer = (unsigned char *)malloc(bG726BufferSize *sizeof(unsigned char));
128 | unsigned char *pbAACBuffer = (unsigned char*)malloc(bAACBufferSize * sizeof(unsigned char));
129 | unsigned int out_len = 0;
130 |
131 | while((gBytesRead = fread(pbG726Buffer, 1, bG726BufferSize, fpIn)) >0)
132 | {
133 | if(Easy_AACEncoder_Encode(handle, pbG726Buffer, gBytesRead, pbAACBuffer, &out_len) > 0)
134 | {
135 | fwrite(pbAACBuffer, 1, out_len, fpOut);
136 | printf("%s:[%d] pbAACBuffer(%d) len=%d \n",__FUNCTION__,__LINE__,bAACBufferSize,out_len);
137 | }
138 | }
139 |
140 | Easy_AACEncoder_Release(handle);
141 |
142 | free(pbG726Buffer);
143 | free(pbAACBuffer);
144 | fclose(fpIn);
145 | fclose(fpOut);
146 |
147 | return 0;
148 | }
149 |
--------------------------------------------------------------------------------
/libfaac/libfaac_dll_drm.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {0031f6f0-b76c-458b-bd81-78126e9e5524}
6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat
7 |
8 |
9 | {06fb2218-9c86-43d8-8934-c43ab71fe655}
10 | h;hpp;hxx;hm;inl
11 |
12 |
13 | {a5264d84-4a56-46d7-a6eb-54444d34605b}
14 |
15 |
16 |
17 |
18 | Source Files
19 |
20 |
21 | Source Files
22 |
23 |
24 | Source Files
25 |
26 |
27 | Source Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 | Source Files
40 |
41 |
42 | Source Files
43 |
44 |
45 | Source Files
46 |
47 |
48 | Source Files
49 |
50 |
51 | Source Files
52 |
53 |
54 | Source Files
55 |
56 |
57 | kiss_fft
58 |
59 |
60 | kiss_fft
61 |
62 |
63 |
64 |
65 | Header Files
66 |
67 |
68 | Header Files
69 |
70 |
71 | Header Files
72 |
73 |
74 | Header Files
75 |
76 |
77 | Header Files
78 |
79 |
80 | Header Files
81 |
82 |
83 | Header Files
84 |
85 |
86 | Header Files
87 |
88 |
89 | Header Files
90 |
91 |
92 | Header Files
93 |
94 |
95 | Header Files
96 |
97 |
98 | Header Files
99 |
100 |
101 | Header Files
102 |
103 |
104 | Header Files
105 |
106 |
107 | Header Files
108 |
109 |
110 | Header Files
111 |
112 |
113 | kiss_fft
114 |
115 |
116 | kiss_fft
117 |
118 |
119 | kiss_fft
120 |
121 |
122 | Header Files
123 |
124 |
125 | Header Files
126 |
127 |
128 |
129 |
130 | Source Files
131 |
132 |
133 |
--------------------------------------------------------------------------------
/nbproject/Makefile-impl.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated Makefile - do not edit!
3 | #
4 | # Edit the Makefile in the project folder instead (../Makefile). Each target
5 | # has a pre- and a post- target defined where you can add customization code.
6 | #
7 | # This makefile implements macros and targets common to all configurations.
8 | #
9 | # NOCDDL
10 |
11 |
12 | # Building and Cleaning subprojects are done by default, but can be controlled with the SUB
13 | # macro. If SUB=no, subprojects will not be built or cleaned. The following macro
14 | # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
15 | # and .clean-reqprojects-conf unless SUB has the value 'no'
16 | SUB_no=NO
17 | SUBPROJECTS=${SUB_${SUB}}
18 | BUILD_SUBPROJECTS_=.build-subprojects
19 | BUILD_SUBPROJECTS_NO=
20 | BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
21 | CLEAN_SUBPROJECTS_=.clean-subprojects
22 | CLEAN_SUBPROJECTS_NO=
23 | CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
24 |
25 |
26 | # Project Name
27 | PROJECTNAME=EasyAACEncoder
28 |
29 | # Active Configuration
30 | DEFAULTCONF=Debug
31 | CONF=${DEFAULTCONF}
32 |
33 | # All Configurations
34 | ALLCONFS=Debug i386 x64 arm
35 |
36 |
37 | # build
38 | .build-impl: .build-pre .validate-impl .depcheck-impl
39 | @#echo "=> Running $@... Configuration=$(CONF)"
40 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf
41 |
42 |
43 | # clean
44 | .clean-impl: .clean-pre .validate-impl .depcheck-impl
45 | @#echo "=> Running $@... Configuration=$(CONF)"
46 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf
47 |
48 |
49 | # clobber
50 | .clobber-impl: .clobber-pre .depcheck-impl
51 | @#echo "=> Running $@..."
52 | for CONF in ${ALLCONFS}; \
53 | do \
54 | "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
55 | done
56 |
57 | # all
58 | .all-impl: .all-pre .depcheck-impl
59 | @#echo "=> Running $@..."
60 | for CONF in ${ALLCONFS}; \
61 | do \
62 | "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \
63 | done
64 |
65 | # build tests
66 | .build-tests-impl: .build-impl .build-tests-pre
67 | @#echo "=> Running $@... Configuration=$(CONF)"
68 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf
69 |
70 | # run tests
71 | .test-impl: .build-tests-impl .test-pre
72 | @#echo "=> Running $@... Configuration=$(CONF)"
73 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf
74 |
75 | # dependency checking support
76 | .depcheck-impl:
77 | @echo "# This code depends on make tool being used" >.dep.inc
78 | @if [ -n "${MAKE_VERSION}" ]; then \
79 | echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES} \$${TESTOBJECTFILES}))" >>.dep.inc; \
80 | echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
81 | echo "include \$${DEPFILES}" >>.dep.inc; \
82 | echo "endif" >>.dep.inc; \
83 | else \
84 | echo ".KEEP_STATE:" >>.dep.inc; \
85 | echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
86 | fi
87 |
88 | # configuration validation
89 | .validate-impl:
90 | @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
91 | then \
92 | echo ""; \
93 | echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
94 | echo "See 'make help' for details."; \
95 | echo "Current directory: " `pwd`; \
96 | echo ""; \
97 | fi
98 | @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
99 | then \
100 | exit 1; \
101 | fi
102 |
103 |
104 | # help
105 | .help-impl: .help-pre
106 | @echo "This makefile supports the following configurations:"
107 | @echo " ${ALLCONFS}"
108 | @echo ""
109 | @echo "and the following targets:"
110 | @echo " build (default target)"
111 | @echo " clean"
112 | @echo " clobber"
113 | @echo " all"
114 | @echo " help"
115 | @echo ""
116 | @echo "Makefile Usage:"
117 | @echo " make [CONF=] [SUB=no] build"
118 | @echo " make [CONF=] [SUB=no] clean"
119 | @echo " make [SUB=no] clobber"
120 | @echo " make [SUB=no] all"
121 | @echo " make help"
122 | @echo ""
123 | @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
124 | @echo " also build subprojects."
125 | @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
126 | @echo " also clean subprojects."
127 | @echo "Target 'clobber' will remove all built files from all configurations and,"
128 | @echo " unless 'SUB=no', also from subprojects."
129 | @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
130 | @echo " also build subprojects."
131 | @echo "Target 'help' prints this message."
132 | @echo ""
133 |
134 |
--------------------------------------------------------------------------------
/libfaac/kiss_fft/README:
--------------------------------------------------------------------------------
1 | KISS FFT - A mixed-radix Fast Fourier Transform based up on the principle,
2 | "Keep It Simple, Stupid."
3 |
4 | There are many great fft libraries already around. Kiss FFT is not trying
5 | to be better than any of them. It only attempts to be a reasonably efficient,
6 | moderately useful FFT that can use fixed or floating data types and can be
7 | incorporated into someone's C program in a few minutes with trivial licensing.
8 |
9 | USAGE:
10 |
11 | The basic usage for 1-d complex FFT is:
12 |
13 | #include "kiss_fft.h"
14 |
15 | kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,inverse_fft );
16 |
17 | while ...
18 |
19 | ... // put kth sample in cx_in[k].r and cx_in[k].i
20 |
21 | kiss_fft( cfg , cx_in , cx_out );
22 |
23 | ... // transformed. DC is in cx_out[0].r and cx_out[0].i
24 |
25 | free(cfg);
26 |
27 | Note: frequency-domain data is stored from dc up to 2pi.
28 | so cx_out[0] is the dc bin of the FFT
29 | and cx_out[nfft/2] is the Nyquist bin (if exists)
30 |
31 | Declarations are in "kiss_fft.h", along with a brief description of the
32 | functions you'll need to use.
33 |
34 | Code definitions for 1d complex FFTs are in kiss_fft.c.
35 |
36 | You can do other cool stuff with the extras you'll find in tools/
37 |
38 | * arbitrary dimension complex FFTs
39 | * 1-d real FFTs
40 | * fast convolution FIR filtering
41 | * spectrum image creation
42 |
43 | The core fft and most tools/ code can be compiled to use float, double
44 | or Q15 short samples. The default is float.
45 |
46 |
47 | BACKGROUND:
48 |
49 | I started coding this because I couldn't find a fixed point FFT that didn't
50 | use assembly code. I started with floating point numbers so I could get the
51 | theory straight before working on fixed point issues. In the end, I had a
52 | little bit of code that could be recompiled easily to do ffts with short, float
53 | or double (other types should be easy too).
54 |
55 | Once I got my FFT working, I was curious about the speed compared to
56 | a well respected and highly optimized fft library. I don't want to criticize
57 | this great library, so let's call it FFT_BRANDX.
58 | During this process, I learned:
59 |
60 | 1. FFT_BRANDX has more than 100K lines of code. The core of kiss_fft is about 500 lines (cpx 1-d).
61 | 2. It took me an embarrassingly long time to get FFT_BRANDX working.
62 | 3. A simple program using FFT_BRANDX is 522KB. A similar program using kiss_fft is 18KB.
63 | 4. FFT_BRANDX is roughly twice as fast as KISS FFT.
64 |
65 | It is wonderful that free, highly optimized libraries like FFT_BRANDX exist.
66 | But such libraries carry a huge burden of complexity necessary to extract every
67 | last bit of performance.
68 |
69 | Sometimes simpler is better, even if it's not better.
70 |
71 | PERFORMANCE:
72 | (on Athlon XP 2100+, with gcc 2.96, float data type)
73 |
74 | Kiss performed 10000 1024-pt cpx ffts in .63 s of cpu time.
75 | For comparison, it took md5sum twice as long to process the same amount of data.
76 |
77 | Transforming 5 minutes of CD quality audio takes less than a second (nfft=1024).
78 |
79 | DO NOT:
80 | ... use Kiss if you need the Fastest Fourier Transform in the World
81 | ... ask me to add features that will bloat the code
82 |
83 | UNDER THE HOOD:
84 |
85 | Kiss FFT uses a time decimation, mixed-radix, out-of-place FFT.
86 | No scaling is done. Optimized butterflies are used for factors 2,3,4, and 5.
87 |
88 | The real optimization code only works for even length ffts. It does two half-length
89 | FFTs in parallel (packed into real&imag), and then combines them via twiddling.
90 |
91 | The fast convolution filtering uses the overlap-scrap method, slightly
92 | modified to put the scrap at the tail.
93 |
94 | LICENSE:
95 | BSD, see COPYING for details. Basically, "free to use&change, give credit where due, no guarantees"
96 |
97 | TODO:
98 | *) Add real optimization for odd length FFTs (DST?)
99 | *) Add real optimization to the n-dimensional FFT
100 | *) Add simple windowing function, e.g. Hamming : w(i)=.54-.46*cos(2pi*i/(n-1))
101 | *) Make the fixed point scaling and bit shifts more easily configurable.
102 | *) Document/revisit the input/output fft scaling
103 | *) See if the fixed point code can be optimized a little without adding complexity.
104 | *) Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c
105 | *) Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others)
106 |
107 | AUTHOR:
108 | Mark Borgerding
109 | Mark@Borgerding.net
110 |
--------------------------------------------------------------------------------
/testEasyAACEncoder/nbproject/Makefile-impl.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Generated Makefile - do not edit!
3 | #
4 | # Edit the Makefile in the project folder instead (../Makefile). Each target
5 | # has a pre- and a post- target defined where you can add customization code.
6 | #
7 | # This makefile implements macros and targets common to all configurations.
8 | #
9 | # NOCDDL
10 |
11 |
12 | # Building and Cleaning subprojects are done by default, but can be controlled with the SUB
13 | # macro. If SUB=no, subprojects will not be built or cleaned. The following macro
14 | # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
15 | # and .clean-reqprojects-conf unless SUB has the value 'no'
16 | SUB_no=NO
17 | SUBPROJECTS=${SUB_${SUB}}
18 | BUILD_SUBPROJECTS_=.build-subprojects
19 | BUILD_SUBPROJECTS_NO=
20 | BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
21 | CLEAN_SUBPROJECTS_=.clean-subprojects
22 | CLEAN_SUBPROJECTS_NO=
23 | CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
24 |
25 |
26 | # Project Name
27 | PROJECTNAME=testg7112aac
28 |
29 | # Active Configuration
30 | DEFAULTCONF=Debug
31 | CONF=${DEFAULTCONF}
32 |
33 | # All Configurations
34 | ALLCONFS=Debug Release
35 |
36 |
37 | # build
38 | .build-impl: .build-pre .validate-impl .depcheck-impl
39 | @#echo "=> Running $@... Configuration=$(CONF)"
40 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf
41 |
42 |
43 | # clean
44 | .clean-impl: .clean-pre .validate-impl .depcheck-impl
45 | @#echo "=> Running $@... Configuration=$(CONF)"
46 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf
47 |
48 |
49 | # clobber
50 | .clobber-impl: .clobber-pre .depcheck-impl
51 | @#echo "=> Running $@..."
52 | for CONF in ${ALLCONFS}; \
53 | do \
54 | "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
55 | done
56 |
57 | # all
58 | .all-impl: .all-pre .depcheck-impl
59 | @#echo "=> Running $@..."
60 | for CONF in ${ALLCONFS}; \
61 | do \
62 | "${MAKE}" -f nbproject/Makefile-$${CONF}.mk QMAKE=${QMAKE} SUBPROJECTS=${SUBPROJECTS} .build-conf; \
63 | done
64 |
65 | # build tests
66 | .build-tests-impl: .build-impl .build-tests-pre
67 | @#echo "=> Running $@... Configuration=$(CONF)"
68 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-tests-conf
69 |
70 | # run tests
71 | .test-impl: .build-tests-impl .test-pre
72 | @#echo "=> Running $@... Configuration=$(CONF)"
73 | "${MAKE}" -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .test-conf
74 |
75 | # dependency checking support
76 | .depcheck-impl:
77 | @echo "# This code depends on make tool being used" >.dep.inc
78 | @if [ -n "${MAKE_VERSION}" ]; then \
79 | echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
80 | echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
81 | echo "include \$${DEPFILES}" >>.dep.inc; \
82 | echo "endif" >>.dep.inc; \
83 | else \
84 | echo ".KEEP_STATE:" >>.dep.inc; \
85 | echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
86 | fi
87 |
88 | # configuration validation
89 | .validate-impl:
90 | @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
91 | then \
92 | echo ""; \
93 | echo "Error: can not find the makefile for configuration '${CONF}' in project ${PROJECTNAME}"; \
94 | echo "See 'make help' for details."; \
95 | echo "Current directory: " `pwd`; \
96 | echo ""; \
97 | fi
98 | @if [ ! -f nbproject/Makefile-${CONF}.mk ]; \
99 | then \
100 | exit 1; \
101 | fi
102 |
103 |
104 | # help
105 | .help-impl: .help-pre
106 | @echo "This makefile supports the following configurations:"
107 | @echo " ${ALLCONFS}"
108 | @echo ""
109 | @echo "and the following targets:"
110 | @echo " build (default target)"
111 | @echo " clean"
112 | @echo " clobber"
113 | @echo " all"
114 | @echo " help"
115 | @echo ""
116 | @echo "Makefile Usage:"
117 | @echo " make [CONF=] [SUB=no] build"
118 | @echo " make [CONF=] [SUB=no] clean"
119 | @echo " make [SUB=no] clobber"
120 | @echo " make [SUB=no] all"
121 | @echo " make help"
122 | @echo ""
123 | @echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
124 | @echo " also build subprojects."
125 | @echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
126 | @echo " also clean subprojects."
127 | @echo "Target 'clobber' will remove all built files from all configurations and,"
128 | @echo " unless 'SUB=no', also from subprojects."
129 | @echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
130 | @echo " also build subprojects."
131 | @echo "Target 'help' prints this message."
132 | @echo ""
133 |
134 |
--------------------------------------------------------------------------------
/libfaac/frame.h:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2001 Menno Bakker
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: frame.h,v 1.30 2009/01/25 18:50:32 menno Exp $
20 | */
21 |
22 | #ifndef FRAME_H
23 | #define FRAME_H
24 |
25 | #ifdef HAVE_CONFIG_H
26 | #include "config.h"
27 | #endif
28 |
29 | #ifdef HAVE_SYS_TYPES_H
30 | # include
31 | #endif
32 | #ifdef HAVE_INTTYPES_H
33 | # include
34 | #endif
35 | #ifdef HAVE_STDINT_H
36 | # include
37 | #endif
38 |
39 | #ifndef HAVE_INT32_T
40 | typedef signed int int32_t;
41 | #endif
42 |
43 | #ifdef __cplusplus
44 | extern "C" {
45 | #endif /* __cplusplus */
46 |
47 | #include "coder.h"
48 | #include "channels.h"
49 | #include "psych.h"
50 | #include "aacquant.h"
51 | #include "fft.h"
52 |
53 | #if defined(_WIN32) && !defined(__MINGW32__)
54 | #ifndef FAACAPI
55 | #define FAACAPI __stdcall
56 | #endif
57 | #else
58 | #ifndef FAACAPI
59 | #define FAACAPI
60 | #endif
61 | #endif
62 |
63 | #pragma pack(push, 1)
64 |
65 | typedef struct {
66 | psymodel_t *model;
67 | char *name;
68 | } psymodellist_t;
69 |
70 | #include
71 |
72 | typedef struct {
73 | /* number of channels in AAC file */
74 | unsigned int numChannels;
75 |
76 | /* samplerate of AAC file */
77 | unsigned long sampleRate;
78 | unsigned int sampleRateIdx;
79 |
80 | unsigned int usedBytes;
81 |
82 | /* frame number */
83 | unsigned int frameNum;
84 | unsigned int flushFrame;
85 |
86 | /* Scalefactorband data */
87 | SR_INFO *srInfo;
88 |
89 | /* sample buffers of current next and next next frame*/
90 | double *sampleBuff[MAX_CHANNELS];
91 | double *nextSampleBuff[MAX_CHANNELS];
92 | double *next2SampleBuff[MAX_CHANNELS];
93 | double *next3SampleBuff[MAX_CHANNELS];
94 | double *ltpTimeBuff[MAX_CHANNELS];
95 |
96 | /* Filterbank buffers */
97 | double *sin_window_long;
98 | double *sin_window_short;
99 | double *kbd_window_long;
100 | double *kbd_window_short;
101 | double *freqBuff[MAX_CHANNELS];
102 | double *overlapBuff[MAX_CHANNELS];
103 |
104 | double *msSpectrum[MAX_CHANNELS];
105 |
106 | /* Channel and Coder data for all channels */
107 | CoderInfo coderInfo[MAX_CHANNELS];
108 | ChannelInfo channelInfo[MAX_CHANNELS];
109 |
110 | /* Psychoacoustics data */
111 | PsyInfo psyInfo[MAX_CHANNELS];
112 | GlobalPsyInfo gpsyInfo;
113 |
114 | /* Configuration data */
115 | faacEncConfiguration config;
116 |
117 | psymodel_t *psymodel;
118 |
119 | /* quantizer specific config */
120 | AACQuantCfg aacquantCfg;
121 |
122 | /* FFT Tables */
123 | FFT_Tables fft_tables;
124 |
125 | /* output bits difference in average bitrate mode */
126 | int bitDiff;
127 | } faacEncStruct, *faacEncHandle;
128 |
129 | int FAACAPI faacEncGetVersion(char **faac_id_string,
130 | char **faac_copyright_string);
131 |
132 | int FAACAPI faacEncGetDecoderSpecificInfo(faacEncHandle hEncoder,
133 | unsigned char** ppBuffer,
134 | unsigned long* pSizeOfDecoderSpecificInfo);
135 |
136 | faacEncConfigurationPtr FAACAPI faacEncGetCurrentConfiguration(faacEncHandle hEncoder);
137 | int FAACAPI faacEncSetConfiguration (faacEncHandle hEncoder, faacEncConfigurationPtr config);
138 |
139 | faacEncHandle FAACAPI faacEncOpen(unsigned long sampleRate,
140 | unsigned int numChannels,
141 | unsigned long *inputSamples,
142 | unsigned long *maxOutputBytes);
143 |
144 | int FAACAPI faacEncEncode(faacEncHandle hEncoder,
145 | int32_t *inputBuffer,
146 | unsigned int samplesInput,
147 | unsigned char *outputBuffer,
148 | unsigned int bufferSize
149 | );
150 |
151 | int FAACAPI faacEncClose(faacEncHandle hEncoder);
152 |
153 |
154 | #pragma pack(pop)
155 |
156 | #ifdef __cplusplus
157 | }
158 | #endif /* __cplusplus */
159 |
160 | #endif /* FRAME_H */
161 |
--------------------------------------------------------------------------------
/libEasyAACEncoder.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 | 源文件
23 |
24 |
25 | 源文件
26 |
27 |
28 | 源文件
29 |
30 |
31 | 源文件
32 |
33 |
34 | 源文件
35 |
36 |
37 | 源文件
38 |
39 |
40 | 源文件
41 |
42 |
43 | 源文件
44 |
45 |
46 | 源文件
47 |
48 |
49 | 源文件
50 |
51 |
52 | 源文件
53 |
54 |
55 | 源文件
56 |
57 |
58 | 源文件
59 |
60 |
61 | 源文件
62 |
63 |
64 | 源文件
65 |
66 |
67 | 源文件
68 |
69 |
70 | 源文件
71 |
72 |
73 |
74 |
75 | 头文件
76 |
77 |
78 | 头文件
79 |
80 |
81 | 头文件
82 |
83 |
84 | 头文件
85 |
86 |
87 | 头文件
88 |
89 |
90 | 头文件
91 |
92 |
93 | 头文件
94 |
95 |
96 | 头文件
97 |
98 |
99 | 头文件
100 |
101 |
102 | 头文件
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 | 头文件
130 |
131 |
132 | 头文件
133 |
134 |
135 | 头文件
136 |
137 |
138 | 头文件
139 |
140 |
141 |
--------------------------------------------------------------------------------
/libfaac/midside.c:
--------------------------------------------------------------------------------
1 | /*
2 | * FAAC - Freeware Advanced Audio Coder
3 | * Copyright (C) 2003 Krzysztof Nikiel
4 | *
5 | * This library is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU Lesser General Public
7 | * License as published by the Free Software Foundation; either
8 | * version 2.1 of the License, or (at your option) any later version.
9 | *
10 | * This library is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 | * Lesser General Public License for more details.
14 |
15 | * You should have received a copy of the GNU Lesser General Public
16 | * License along with this library; if not, write to the Free Software
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 | *
19 | * $Id: midside.c,v 1.1 2003/06/26 19:39:54 knik Exp $
20 | */
21 |
22 | #include
23 | #include "channels.h"
24 | #include "util.h"
25 |
26 |
27 | void MSEncode(CoderInfo *coderInfo,
28 | ChannelInfo *channelInfo,
29 | double *spectrum[MAX_CHANNELS],
30 | int maxchan,
31 | int allowms)
32 | {
33 | int chn;
34 |
35 | for (chn = 0; chn < maxchan; chn++)
36 | {
37 | if (channelInfo[chn].present)
38 | {
39 | if ((channelInfo[chn].cpe) && (channelInfo[chn].ch_is_left))
40 | {
41 | int rch = channelInfo[chn].paired_ch;
42 |
43 | channelInfo[chn].msInfo.is_present = 0;
44 | channelInfo[rch].msInfo.is_present = 0;
45 |
46 | /* Perform MS if block_types are the same */
47 | if ((coderInfo[chn].block_type == coderInfo[rch].block_type)
48 | && allowms)
49 | {
50 | int nsfb = coderInfo[chn].nr_of_sfb;
51 | MSInfo *msInfoL = &(channelInfo[chn].msInfo);
52 | MSInfo *msInfoR = &(channelInfo[rch].msInfo);
53 | int sfb;
54 |
55 | channelInfo[chn].common_window = 1; /* Use common window */
56 | channelInfo[chn].msInfo.is_present = 1;
57 | channelInfo[rch].msInfo.is_present = 1;
58 |
59 | // make the same reference energy in both channels
60 | coderInfo[chn].avgenrg = coderInfo[rch].avgenrg =
61 | 0.5 * (coderInfo[chn].avgenrg + coderInfo[rch].avgenrg);
62 |
63 | for (sfb = 0; sfb < nsfb; sfb++)
64 | {
65 | int ms = 0;
66 | int l, start, end;
67 | double sum, diff;
68 | double enrgs, enrgd, enrgl, enrgr;
69 | double maxs, maxd, maxl, maxr;
70 |
71 | start = coderInfo[chn].sfb_offset[sfb];
72 | end = coderInfo[chn].sfb_offset[sfb + 1];
73 |
74 | enrgs = enrgd = enrgl = enrgr = 0.0;
75 | maxs = maxd = maxl = maxr = 0.0;
76 | for (l = start; l < end; l++)
77 | {
78 | double lx = spectrum[chn][l];
79 | double rx = spectrum[rch][l];
80 |
81 | sum = 0.5 * (lx + rx);
82 | diff = 0.5 * (lx - rx);
83 |
84 | enrgs += sum * sum;
85 | maxs = max(maxs, fabs(sum));
86 |
87 | enrgd += diff * diff;
88 | maxd = max(maxd, fabs(diff));
89 |
90 | enrgl += lx * lx;
91 | enrgr += rx * rx;
92 |
93 | maxl = max(maxl, fabs(lx));
94 | maxr = max(maxr, fabs(rx));
95 | }
96 |
97 | #if 1
98 | if ((min(enrgs, enrgd) < min(enrgl, enrgr))
99 | && (min(maxs, maxd) < min(maxl, maxr)))
100 | ms = 1;
101 | #else
102 | if (min(enrgs, enrgd) < min(enrgl, enrgr))
103 | ms = 1;
104 | #endif
105 |
106 | //printf("%d:%d\n", sfb, ms);
107 |
108 | msInfoR->ms_used[sfb] = msInfoL->ms_used[sfb] = ms;
109 |
110 | if (ms)
111 | for (l = start; l < end; l++)
112 | {
113 | sum = spectrum[chn][l] + spectrum[rch][l];
114 | diff = spectrum[chn][l] - spectrum[rch][l];
115 | spectrum[chn][l] = 0.5 * sum;
116 | spectrum[rch][l] = 0.5 * diff;
117 | }
118 | }
119 | }
120 | }
121 | }
122 | }
123 | }
124 |
125 | void MSReconstruct(CoderInfo *coderInfo,
126 | ChannelInfo *channelInfo,
127 | int maxchan)
128 | {
129 | int chn;
130 |
131 | for (chn = 0; chn < maxchan; chn++)
132 | {
133 | if (channelInfo[chn].present)
134 | {
135 | if (channelInfo[chn].cpe && channelInfo[chn].ch_is_left)
136 | {
137 | int rch = channelInfo[chn].paired_ch;
138 |
139 | MSInfo *msInfoL = &(channelInfo[chn].msInfo);
140 |
141 | if (msInfoL->is_present) {
142 | int nsfb = coderInfo[chn].nr_of_sfb;
143 | int sfb;
144 |
145 | for (sfb = 0; sfb < nsfb; sfb++)
146 | {
147 | int l, start, end;
148 |
149 | start = coderInfo[chn].sfb_offset[sfb];
150 | end = coderInfo[chn].sfb_offset[sfb + 1];
151 |
152 | if (msInfoL->ms_used[sfb])
153 | {
154 | for (l = start; l < end; l++)
155 | {
156 | double sum, diff;
157 |
158 | sum = coderInfo[chn].requantFreq[l];
159 | diff = coderInfo[rch].requantFreq[l];
160 | coderInfo[chn].requantFreq[l] = sum + diff;
161 | coderInfo[rch].requantFreq[l] = sum - diff;
162 | }
163 | }
164 | }
165 | }
166 | }
167 | }
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/EasyDSSBuffers.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013-2016 EasyDarwin.ORG. All rights reserved.
3 | Github: https://github.com/EasyDarwin
4 | WEChat: EasyDarwin
5 | Website: http://www.easydarwin.org
6 | */
7 |
8 | #ifndef _TOOLS_H_
9 | #define _TOOLS_H_
10 |
11 | #define _CRT_SECURE_NO_WARNINGS
12 |
13 | #ifdef _WIN32
14 | #include
15 | #include
16 | #else
17 | #include
18 | #include
19 | #endif
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 | #if (defined(_WIN32)) //windows
27 | //#define WIN32
28 | #ifndef DLL_EXPORT
29 | #define JD_API extern "C"__declspec(dllimport)
30 | #else
31 | #define JD_API extern "C"__declspec(dllexport)
32 | #endif
33 | #elif defined(__linux__) //linux
34 | #define __stdcall
35 | #define CALLBACK
36 | #define JD_API extern "C"
37 | #define WINAPI
38 | typedef int HANDLE;
39 | typedef int HWND;
40 | #endif
41 |
42 | #ifdef _WIN32
43 | #include
44 | #endif
45 | #include
46 | #include
47 | #include