am 644f36ea: am d8b027b1: Merge "stagefright aacenc/amrwbenc: Convert line breaks to Unix style"

* commit '644f36eab4eb9911ad897c9caae68b9c5a72388f':
  stagefright aacenc/amrwbenc: Convert line breaks to Unix style
This commit is contained in:
Conley Owens
2011-06-09 12:21:05 -07:00
committed by Android Git Automerger
185 changed files with 30084 additions and 30084 deletions

View File

@@ -1,283 +1,283 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: AAC_E_SAMPLES.h
Content: sample code for AAC encoder
*******************************************************************************/
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "voAAC.h"
#include "cmnMemory.h"
#define VO_AAC_E_OUTPUT 1
#define READ_SIZE (1024*8)
unsigned char outBuf[1024*8];
unsigned char inBuf[READ_SIZE];
const char* HelpString =
"VisualOn AAC encoder Usage:\n"
"voAACEncTest -if <inputfile.pcm> -of <outputfile.aac> -sr <samplerate> -ch <channel> -br <bitrate> -adts <adts> \n"
"-if input file name \n"
"-of output file name \n"
"-sr input pcm samplerate, default 44100 \n"
"-ch input pcm channel, default 2 channel \n"
"-br encoded aac bitrate, default 64000 * (samplerate/100)*channel/441(480)\n"
"-adts add or no adts header, default add adts header\n"
"For example: \n"
"./voAACEncTest -if raw.pcm -of raw.aac -sr 44100 -ch 2 -br 128000\n";
static int parsecmdline(int argc, char **argv,char **input_filename, char **output_filename, AACENC_PARAM *param)
{
// notice that:
// bitRate/nChannels > 8000
// bitRate/nChannels < 160000
// bitRate/nChannels < sampleRate*6
param->adtsUsed = 1;
param->bitRate = 0;
param->nChannels = 2;
param->sampleRate = 44100;
if(argc < 5 || argc > 13)
{
return -1;
}
argc--;
argv++;
while (argc > 0)
{
if (!strcmp(*argv, "-if"))
{
argv++;
argc--;
*input_filename = *argv;
}
else if (!strcmp(*argv, "-of"))
{
argv++;
argc--;
*output_filename = *argv;
}
else if (!strcmp(*argv, "-sr"))
{
argv++;
argc--;
param->sampleRate = atoi(*argv);
}
else if (!strcmp(*argv, "-ch"))
{
argv++;
argc--;
param->nChannels = atoi(*argv);
}
else if (!strcmp(*argv, "-br"))
{
argv++;
argc--;
param->bitRate = atoi(*argv);
}
else if(!strcmp(*argv, "-adts"))
{
argv++;
argc--;
param->adtsUsed = atoi(*argv);
}
else
{
return -1;
}
argv++;
argc--;
}
if(param->bitRate == 0)
{
int scale = 441;
if(param->sampleRate%8000 == 0)
scale = 480;
param->bitRate = 640*param->nChannels*param->sampleRate/scale;
}
return 0;
}
int ReadFile2Buf(FILE* infile,unsigned char* dest,int readSize)
{
int readBytes = 0;
readBytes = fread(dest, 1, readSize, infile);
return readBytes;
}
typedef int (VO_API * VOGETAUDIODECAPI) (VO_AUDIO_CODECAPI * pDecHandle);
int main(int argc, char **argv)
{
FILE *infile, *outfile;
int t1, t2;
VO_AUDIO_CODECAPI AudioAPI;
VO_MEM_OPERATOR moper;
VO_CODEC_INIT_USERDATA useData;
VO_HANDLE hCodec;
VO_CODECBUFFER inData;
VO_CODECBUFFER outData;
VO_AUDIO_OUTPUTINFO outInfo;
int firstWrite = 1;
int eofFile = 0;
int *info=(int*)inBuf;
int bytesLeft, nRead;
int EncoderdFrame = 0;
int total = 0;
int isOutput = 1;
int returnCode;
AACENC_PARAM aacpara;
void *handle;
void *pfunc;
VOGETAUDIODECAPI pGetAPI;
const char *infileName = NULL;
const char *outfileName = NULL;
returnCode = parsecmdline(argc,argv, &infileName, &outfileName, &aacpara);
if(returnCode)
{
printf("%s", HelpString);
return 0;
}
/* open input file */
infile = fopen(infileName, "rb");
if (!infile) {
printf("Open input file fail...");
return -1;
}
/* open output file */
if(isOutput)
{
outfile = fopen(outfileName, "wb");
if (!outfile) {
printf("Open output file fail...");
return -1;
}
}
// set memory operators;
moper.Alloc = cmnMemAlloc;
moper.Copy = cmnMemCopy;
moper.Free = cmnMemFree;
moper.Set = cmnMemSet;
moper.Check = cmnMemCheck;
useData.memflag = VO_IMF_USERMEMOPERATOR;
useData.memData = (VO_PTR)(&moper);
// open encoder dll;
handle = dlopen("/data/local/tmp/libvoAACEncv7.so", RTLD_NOW);
if(handle == 0)
{
printf("open dll error......");
return -1;
}
// Get API;
pfunc = dlsym(handle, "voGetAACEncAPI");
if(pfunc == 0)
{
printf("open function error......");
return -1;
}
pGetAPI = (VOGETAUDIODECAPI)pfunc;
returnCode = pGetAPI(&AudioAPI);
if(returnCode)
return -1;
//####################################### Init Encoding Section #########################################
returnCode = AudioAPI.Init(&hCodec, VO_AUDIO_CodingAAC, &useData);
if(returnCode < 0)
{
printf("#### VOI_Error2:fail to initialize the Encoderr###\n");
return -1;
}
returnCode = AudioAPI.SetParam(hCodec, VO_PID_AAC_ENCPARAM, &aacpara);
inData.Buffer = inBuf;
bytesLeft = ReadFile2Buf(infile,inData.Buffer,READ_SIZE);
//####################################### Encoding Section #########################################
do {
inData.Length = bytesLeft;
outData.Buffer = outBuf;
outData.Length = 1024*8;
t1 = clock();
returnCode = AudioAPI.SetInputData(hCodec,&inData);
do {
outData.Buffer = outBuf;
outData.Length = 1024*8;
returnCode = AudioAPI.GetOutputData(hCodec,&outData, &outInfo);
if(returnCode == 0)
EncoderdFrame++;
if(returnCode == VO_ERR_LICENSE_ERROR)
break;
#if VO_AAC_E_OUTPUT
if (isOutput && returnCode == 0)
{
fwrite(outData.Buffer, 1, outData.Length, outfile);
}
#endif
} while(returnCode != (VO_ERR_INPUT_BUFFER_SMALL));
if(returnCode == VO_ERR_LICENSE_ERROR)
break;
t2 = clock();
total += t2 - t1;
if (!eofFile) {
nRead = ReadFile2Buf(infile, inBuf,READ_SIZE);
bytesLeft = nRead;
inData.Buffer = inBuf;
if (feof(infile))
eofFile = 1;
}
} while (!eofFile && returnCode);
//################################################ End Encoding Section #######################################################
returnCode = AudioAPI.Uninit(hCodec);
fclose(infile);
if (outfile)
{
fclose(outfile);
}
dlclose(handle);
return 0;
}
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: AAC_E_SAMPLES.h
Content: sample code for AAC encoder
*******************************************************************************/
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "voAAC.h"
#include "cmnMemory.h"
#define VO_AAC_E_OUTPUT 1
#define READ_SIZE (1024*8)
unsigned char outBuf[1024*8];
unsigned char inBuf[READ_SIZE];
const char* HelpString =
"VisualOn AAC encoder Usage:\n"
"voAACEncTest -if <inputfile.pcm> -of <outputfile.aac> -sr <samplerate> -ch <channel> -br <bitrate> -adts <adts> \n"
"-if input file name \n"
"-of output file name \n"
"-sr input pcm samplerate, default 44100 \n"
"-ch input pcm channel, default 2 channel \n"
"-br encoded aac bitrate, default 64000 * (samplerate/100)*channel/441(480)\n"
"-adts add or no adts header, default add adts header\n"
"For example: \n"
"./voAACEncTest -if raw.pcm -of raw.aac -sr 44100 -ch 2 -br 128000\n";
static int parsecmdline(int argc, char **argv,char **input_filename, char **output_filename, AACENC_PARAM *param)
{
// notice that:
// bitRate/nChannels > 8000
// bitRate/nChannels < 160000
// bitRate/nChannels < sampleRate*6
param->adtsUsed = 1;
param->bitRate = 0;
param->nChannels = 2;
param->sampleRate = 44100;
if(argc < 5 || argc > 13)
{
return -1;
}
argc--;
argv++;
while (argc > 0)
{
if (!strcmp(*argv, "-if"))
{
argv++;
argc--;
*input_filename = *argv;
}
else if (!strcmp(*argv, "-of"))
{
argv++;
argc--;
*output_filename = *argv;
}
else if (!strcmp(*argv, "-sr"))
{
argv++;
argc--;
param->sampleRate = atoi(*argv);
}
else if (!strcmp(*argv, "-ch"))
{
argv++;
argc--;
param->nChannels = atoi(*argv);
}
else if (!strcmp(*argv, "-br"))
{
argv++;
argc--;
param->bitRate = atoi(*argv);
}
else if(!strcmp(*argv, "-adts"))
{
argv++;
argc--;
param->adtsUsed = atoi(*argv);
}
else
{
return -1;
}
argv++;
argc--;
}
if(param->bitRate == 0)
{
int scale = 441;
if(param->sampleRate%8000 == 0)
scale = 480;
param->bitRate = 640*param->nChannels*param->sampleRate/scale;
}
return 0;
}
int ReadFile2Buf(FILE* infile,unsigned char* dest,int readSize)
{
int readBytes = 0;
readBytes = fread(dest, 1, readSize, infile);
return readBytes;
}
typedef int (VO_API * VOGETAUDIODECAPI) (VO_AUDIO_CODECAPI * pDecHandle);
int main(int argc, char **argv)
{
FILE *infile, *outfile;
int t1, t2;
VO_AUDIO_CODECAPI AudioAPI;
VO_MEM_OPERATOR moper;
VO_CODEC_INIT_USERDATA useData;
VO_HANDLE hCodec;
VO_CODECBUFFER inData;
VO_CODECBUFFER outData;
VO_AUDIO_OUTPUTINFO outInfo;
int firstWrite = 1;
int eofFile = 0;
int *info=(int*)inBuf;
int bytesLeft, nRead;
int EncoderdFrame = 0;
int total = 0;
int isOutput = 1;
int returnCode;
AACENC_PARAM aacpara;
void *handle;
void *pfunc;
VOGETAUDIODECAPI pGetAPI;
const char *infileName = NULL;
const char *outfileName = NULL;
returnCode = parsecmdline(argc,argv, &infileName, &outfileName, &aacpara);
if(returnCode)
{
printf("%s", HelpString);
return 0;
}
/* open input file */
infile = fopen(infileName, "rb");
if (!infile) {
printf("Open input file fail...");
return -1;
}
/* open output file */
if(isOutput)
{
outfile = fopen(outfileName, "wb");
if (!outfile) {
printf("Open output file fail...");
return -1;
}
}
// set memory operators;
moper.Alloc = cmnMemAlloc;
moper.Copy = cmnMemCopy;
moper.Free = cmnMemFree;
moper.Set = cmnMemSet;
moper.Check = cmnMemCheck;
useData.memflag = VO_IMF_USERMEMOPERATOR;
useData.memData = (VO_PTR)(&moper);
// open encoder dll;
handle = dlopen("/data/local/tmp/libvoAACEncv7.so", RTLD_NOW);
if(handle == 0)
{
printf("open dll error......");
return -1;
}
// Get API;
pfunc = dlsym(handle, "voGetAACEncAPI");
if(pfunc == 0)
{
printf("open function error......");
return -1;
}
pGetAPI = (VOGETAUDIODECAPI)pfunc;
returnCode = pGetAPI(&AudioAPI);
if(returnCode)
return -1;
//####################################### Init Encoding Section #########################################
returnCode = AudioAPI.Init(&hCodec, VO_AUDIO_CodingAAC, &useData);
if(returnCode < 0)
{
printf("#### VOI_Error2:fail to initialize the Encoderr###\n");
return -1;
}
returnCode = AudioAPI.SetParam(hCodec, VO_PID_AAC_ENCPARAM, &aacpara);
inData.Buffer = inBuf;
bytesLeft = ReadFile2Buf(infile,inData.Buffer,READ_SIZE);
//####################################### Encoding Section #########################################
do {
inData.Length = bytesLeft;
outData.Buffer = outBuf;
outData.Length = 1024*8;
t1 = clock();
returnCode = AudioAPI.SetInputData(hCodec,&inData);
do {
outData.Buffer = outBuf;
outData.Length = 1024*8;
returnCode = AudioAPI.GetOutputData(hCodec,&outData, &outInfo);
if(returnCode == 0)
EncoderdFrame++;
if(returnCode == VO_ERR_LICENSE_ERROR)
break;
#if VO_AAC_E_OUTPUT
if (isOutput && returnCode == 0)
{
fwrite(outData.Buffer, 1, outData.Length, outfile);
}
#endif
} while(returnCode != (VO_ERR_INPUT_BUFFER_SMALL));
if(returnCode == VO_ERR_LICENSE_ERROR)
break;
t2 = clock();
total += t2 - t1;
if (!eofFile) {
nRead = ReadFile2Buf(infile, inBuf,READ_SIZE);
bytesLeft = nRead;
inData.Buffer = inBuf;
if (feof(infile))
eofFile = 1;
}
} while (!eofFile && returnCode);
//################################################ End Encoding Section #######################################################
returnCode = AudioAPI.Uninit(hCodec);
fclose(infile);
if (outfile)
{
fclose(outfile);
}
dlclose(handle);
return 0;
}

View File

@@ -1,55 +1,55 @@
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v7
# module type
# please specify the type of your module: lib or exe
VOMT:= exe
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= #ARMV5E
# please specify the name of your module
VOTARGET:= voAACEncTestv7
# please modify here to be sure to see the g1.mk
include ../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../Release/
# please modify here to be sure to see the doit.mk
include ../../../../Tools/doit.mk
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v7
# module type
# please specify the type of your module: lib or exe
VOMT:= exe
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= #ARMV5E
# please specify the name of your module
VOTARGET:= voAACEncTestv7
# please modify here to be sure to see the g1.mk
include ../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../Release/
# please modify here to be sure to see the doit.mk
include ../../../../Tools/doit.mk

View File

@@ -1,23 +1,23 @@
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# please list all objects needed by your target here
OBJS:=AAC_E_SAMPLES.o cmnMemory.o
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../ ../../../../include ../../../../Common
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# please list all objects needed by your target here
OBJS:=AAC_E_SAMPLES.o cmnMemory.o
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../ ../../../../include ../../../../Common

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: oper_32b.c
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: oper_32b.c
Content: This file contains operations in double precision.
*******************************************************************************/
#include "typedef.h"
@@ -198,164 +198,164 @@ Word32 Div_32 (Word32 L_num, Word32 denom)
return (L_32);
}
/*!
\brief calculates the log dualis times 4 of argument
iLog4(x) = (Word32)(4 * log(value)/log(2.0))
\return ilog4 value
*/
Word16 iLog4(Word32 value)
{
Word16 iLog4;
if(value != 0){
Word32 tmp;
Word16 tmp16;
iLog4 = norm_l(value);
tmp = (value << iLog4);
tmp16 = round16(tmp);
tmp = L_mult(tmp16, tmp16);
tmp16 = round16(tmp);
tmp = L_mult(tmp16, tmp16);
tmp16 = round16(tmp);
iLog4 = (-(iLog4 << 2) - norm_s(tmp16)) - 1;
}
else {
iLog4 = -128; /* -(INT_BITS*4); */
}
return iLog4;
}
#define step(shift) \
if ((0x40000000l >> shift) + root <= value) \
{ \
value -= (0x40000000l >> shift) + root; \
root = (root >> 1) | (0x40000000l >> shift); \
} else { \
root = root >> 1; \
}
Word32 rsqrt(Word32 value, /*!< Operand to square root (0.0 ... 1) */
Word32 accuracy) /*!< Number of valid bits that will be calculated */
{
Word32 root = 0;
Word32 scale;
if(value < 0)
return 0;
scale = norm_l(value);
if(scale & 1) scale--;
value <<= scale;
step( 0); step( 2); step( 4); step( 6);
step( 8); step(10); step(12); step(14);
step(16); step(18); step(20); step(22);
step(24); step(26); step(28); step(30);
scale >>= 1;
if (root < value)
++root;
root >>= scale;
return root* 46334;
}
static const Word32 pow2Table[POW2_TABLE_SIZE] = {
0x7fffffff, 0x7fa765ad, 0x7f4f08ae, 0x7ef6e8da,
0x7e9f0606, 0x7e476009, 0x7deff6b6, 0x7d98c9e6,
0x7d41d96e, 0x7ceb2523, 0x7c94acde, 0x7c3e7073,
0x7be86fb9, 0x7b92aa88, 0x7b3d20b6, 0x7ae7d21a,
0x7a92be8b, 0x7a3de5df, 0x79e947ef, 0x7994e492,
0x7940bb9e, 0x78ecccec, 0x78991854, 0x78459dac,
0x77f25cce, 0x779f5591, 0x774c87cc, 0x76f9f359,
0x76a7980f, 0x765575c8, 0x76038c5b, 0x75b1dba2,
0x75606374, 0x750f23ab, 0x74be1c20, 0x746d4cac,
0x741cb528, 0x73cc556d, 0x737c2d55, 0x732c3cba,
0x72dc8374, 0x728d015d, 0x723db650, 0x71eea226,
0x719fc4b9, 0x71511de4, 0x7102ad80, 0x70b47368,
0x70666f76, 0x7018a185, 0x6fcb096f, 0x6f7da710,
0x6f307a41, 0x6ee382de, 0x6e96c0c3, 0x6e4a33c9,
0x6dfddbcc, 0x6db1b8a8, 0x6d65ca38, 0x6d1a1057,
0x6cce8ae1, 0x6c8339b2, 0x6c381ca6, 0x6bed3398,
0x6ba27e66, 0x6b57fce9, 0x6b0daeff, 0x6ac39485,
0x6a79ad56, 0x6a2ff94f, 0x69e6784d, 0x699d2a2c,
0x69540ec9, 0x690b2601, 0x68c26fb1, 0x6879ebb6,
0x683199ed, 0x67e97a34, 0x67a18c68, 0x6759d065,
0x6712460b, 0x66caed35, 0x6683c5c3, 0x663ccf92,
0x65f60a80, 0x65af766a, 0x6569132f, 0x6522e0ad,
0x64dcdec3, 0x64970d4f, 0x64516c2e, 0x640bfb41,
0x63c6ba64, 0x6381a978, 0x633cc85b, 0x62f816eb,
0x62b39509, 0x626f4292, 0x622b1f66, 0x61e72b65,
0x61a3666d, 0x615fd05f, 0x611c6919, 0x60d9307b,
0x60962665, 0x60534ab7, 0x60109d51, 0x5fce1e12,
0x5f8bccdb, 0x5f49a98c, 0x5f07b405, 0x5ec5ec26,
0x5e8451d0, 0x5e42e4e3, 0x5e01a540, 0x5dc092c7,
0x5d7fad59, 0x5d3ef4d7, 0x5cfe6923, 0x5cbe0a1c,
0x5c7dd7a4, 0x5c3dd19c, 0x5bfdf7e5, 0x5bbe4a61,
0x5b7ec8f2, 0x5b3f7377, 0x5b0049d4, 0x5ac14bea,
0x5a82799a, 0x5a43d2c6, 0x5a055751, 0x59c7071c,
0x5988e209, 0x594ae7fb, 0x590d18d3, 0x58cf7474,
0x5891fac1, 0x5854ab9b, 0x581786e6, 0x57da8c83,
0x579dbc57, 0x57611642, 0x57249a29, 0x56e847ef,
0x56ac1f75, 0x567020a0, 0x56344b52, 0x55f89f70,
0x55bd1cdb, 0x5581c378, 0x55469329, 0x550b8bd4,
0x54d0ad5b, 0x5495f7a1, 0x545b6a8b, 0x542105fd,
0x53e6c9db, 0x53acb607, 0x5372ca68, 0x533906e0,
0x52ff6b55, 0x52c5f7aa, 0x528cabc3, 0x52538786,
0x521a8ad7, 0x51e1b59a, 0x51a907b4, 0x5170810b,
0x51382182, 0x50ffe8fe, 0x50c7d765, 0x508fec9c,
0x50582888, 0x50208b0e, 0x4fe91413, 0x4fb1c37c,
0x4f7a9930, 0x4f439514, 0x4f0cb70c, 0x4ed5ff00,
0x4e9f6cd4, 0x4e69006e, 0x4e32b9b4, 0x4dfc988c,
0x4dc69cdd, 0x4d90c68b, 0x4d5b157e, 0x4d25899c,
0x4cf022ca, 0x4cbae0ef, 0x4c85c3f1, 0x4c50cbb8,
0x4c1bf829, 0x4be7492b, 0x4bb2bea5, 0x4b7e587d,
0x4b4a169c, 0x4b15f8e6, 0x4ae1ff43, 0x4aae299b,
0x4a7a77d5, 0x4a46e9d6, 0x4a137f88, 0x49e038d0,
0x49ad1598, 0x497a15c4, 0x4947393f, 0x49147fee,
0x48e1e9ba, 0x48af768a, 0x487d2646, 0x484af8d6,
0x4818ee22, 0x47e70611, 0x47b5408c, 0x47839d7b,
0x47521cc6, 0x4720be55, 0x46ef8210, 0x46be67e0,
0x468d6fae, 0x465c9961, 0x462be4e2, 0x45fb521a,
0x45cae0f2, 0x459a9152, 0x456a6323, 0x453a564d,
0x450a6abb, 0x44daa054, 0x44aaf702, 0x447b6ead,
0x444c0740, 0x441cc0a3, 0x43ed9ac0, 0x43be9580,
0x438fb0cb, 0x4360ec8d, 0x433248ae, 0x4303c517,
0x42d561b4, 0x42a71e6c, 0x4278fb2b, 0x424af7da,
0x421d1462, 0x41ef50ae, 0x41c1aca8, 0x41942839,
0x4166c34c, 0x41397dcc, 0x410c57a2, 0x40df50b8,
0x40b268fa, 0x4085a051, 0x4058f6a8, 0x402c6be9
};
/*!
\brief calculates 2 ^ (x/y) for x<=0, y > 0, x <= 32768 * y
avoids integer division
\return
*/
Word32 pow2_xy(Word32 x, Word32 y)
{
Word32 iPart;
Word32 fPart;
Word32 res;
Word32 tmp, tmp2;
Word32 shift, shift2;
tmp2 = -x;
iPart = tmp2 / y;
fPart = tmp2 - iPart*y;
iPart = min(iPart,INT_BITS-1);
res = pow2Table[(POW2_TABLE_SIZE*fPart)/y] >> iPart;
return(res);
/*!
\brief calculates the log dualis times 4 of argument
iLog4(x) = (Word32)(4 * log(value)/log(2.0))
\return ilog4 value
*/
Word16 iLog4(Word32 value)
{
Word16 iLog4;
if(value != 0){
Word32 tmp;
Word16 tmp16;
iLog4 = norm_l(value);
tmp = (value << iLog4);
tmp16 = round16(tmp);
tmp = L_mult(tmp16, tmp16);
tmp16 = round16(tmp);
tmp = L_mult(tmp16, tmp16);
tmp16 = round16(tmp);
iLog4 = (-(iLog4 << 2) - norm_s(tmp16)) - 1;
}
else {
iLog4 = -128; /* -(INT_BITS*4); */
}
return iLog4;
}
#define step(shift) \
if ((0x40000000l >> shift) + root <= value) \
{ \
value -= (0x40000000l >> shift) + root; \
root = (root >> 1) | (0x40000000l >> shift); \
} else { \
root = root >> 1; \
}
Word32 rsqrt(Word32 value, /*!< Operand to square root (0.0 ... 1) */
Word32 accuracy) /*!< Number of valid bits that will be calculated */
{
Word32 root = 0;
Word32 scale;
if(value < 0)
return 0;
scale = norm_l(value);
if(scale & 1) scale--;
value <<= scale;
step( 0); step( 2); step( 4); step( 6);
step( 8); step(10); step(12); step(14);
step(16); step(18); step(20); step(22);
step(24); step(26); step(28); step(30);
scale >>= 1;
if (root < value)
++root;
root >>= scale;
return root* 46334;
}
static const Word32 pow2Table[POW2_TABLE_SIZE] = {
0x7fffffff, 0x7fa765ad, 0x7f4f08ae, 0x7ef6e8da,
0x7e9f0606, 0x7e476009, 0x7deff6b6, 0x7d98c9e6,
0x7d41d96e, 0x7ceb2523, 0x7c94acde, 0x7c3e7073,
0x7be86fb9, 0x7b92aa88, 0x7b3d20b6, 0x7ae7d21a,
0x7a92be8b, 0x7a3de5df, 0x79e947ef, 0x7994e492,
0x7940bb9e, 0x78ecccec, 0x78991854, 0x78459dac,
0x77f25cce, 0x779f5591, 0x774c87cc, 0x76f9f359,
0x76a7980f, 0x765575c8, 0x76038c5b, 0x75b1dba2,
0x75606374, 0x750f23ab, 0x74be1c20, 0x746d4cac,
0x741cb528, 0x73cc556d, 0x737c2d55, 0x732c3cba,
0x72dc8374, 0x728d015d, 0x723db650, 0x71eea226,
0x719fc4b9, 0x71511de4, 0x7102ad80, 0x70b47368,
0x70666f76, 0x7018a185, 0x6fcb096f, 0x6f7da710,
0x6f307a41, 0x6ee382de, 0x6e96c0c3, 0x6e4a33c9,
0x6dfddbcc, 0x6db1b8a8, 0x6d65ca38, 0x6d1a1057,
0x6cce8ae1, 0x6c8339b2, 0x6c381ca6, 0x6bed3398,
0x6ba27e66, 0x6b57fce9, 0x6b0daeff, 0x6ac39485,
0x6a79ad56, 0x6a2ff94f, 0x69e6784d, 0x699d2a2c,
0x69540ec9, 0x690b2601, 0x68c26fb1, 0x6879ebb6,
0x683199ed, 0x67e97a34, 0x67a18c68, 0x6759d065,
0x6712460b, 0x66caed35, 0x6683c5c3, 0x663ccf92,
0x65f60a80, 0x65af766a, 0x6569132f, 0x6522e0ad,
0x64dcdec3, 0x64970d4f, 0x64516c2e, 0x640bfb41,
0x63c6ba64, 0x6381a978, 0x633cc85b, 0x62f816eb,
0x62b39509, 0x626f4292, 0x622b1f66, 0x61e72b65,
0x61a3666d, 0x615fd05f, 0x611c6919, 0x60d9307b,
0x60962665, 0x60534ab7, 0x60109d51, 0x5fce1e12,
0x5f8bccdb, 0x5f49a98c, 0x5f07b405, 0x5ec5ec26,
0x5e8451d0, 0x5e42e4e3, 0x5e01a540, 0x5dc092c7,
0x5d7fad59, 0x5d3ef4d7, 0x5cfe6923, 0x5cbe0a1c,
0x5c7dd7a4, 0x5c3dd19c, 0x5bfdf7e5, 0x5bbe4a61,
0x5b7ec8f2, 0x5b3f7377, 0x5b0049d4, 0x5ac14bea,
0x5a82799a, 0x5a43d2c6, 0x5a055751, 0x59c7071c,
0x5988e209, 0x594ae7fb, 0x590d18d3, 0x58cf7474,
0x5891fac1, 0x5854ab9b, 0x581786e6, 0x57da8c83,
0x579dbc57, 0x57611642, 0x57249a29, 0x56e847ef,
0x56ac1f75, 0x567020a0, 0x56344b52, 0x55f89f70,
0x55bd1cdb, 0x5581c378, 0x55469329, 0x550b8bd4,
0x54d0ad5b, 0x5495f7a1, 0x545b6a8b, 0x542105fd,
0x53e6c9db, 0x53acb607, 0x5372ca68, 0x533906e0,
0x52ff6b55, 0x52c5f7aa, 0x528cabc3, 0x52538786,
0x521a8ad7, 0x51e1b59a, 0x51a907b4, 0x5170810b,
0x51382182, 0x50ffe8fe, 0x50c7d765, 0x508fec9c,
0x50582888, 0x50208b0e, 0x4fe91413, 0x4fb1c37c,
0x4f7a9930, 0x4f439514, 0x4f0cb70c, 0x4ed5ff00,
0x4e9f6cd4, 0x4e69006e, 0x4e32b9b4, 0x4dfc988c,
0x4dc69cdd, 0x4d90c68b, 0x4d5b157e, 0x4d25899c,
0x4cf022ca, 0x4cbae0ef, 0x4c85c3f1, 0x4c50cbb8,
0x4c1bf829, 0x4be7492b, 0x4bb2bea5, 0x4b7e587d,
0x4b4a169c, 0x4b15f8e6, 0x4ae1ff43, 0x4aae299b,
0x4a7a77d5, 0x4a46e9d6, 0x4a137f88, 0x49e038d0,
0x49ad1598, 0x497a15c4, 0x4947393f, 0x49147fee,
0x48e1e9ba, 0x48af768a, 0x487d2646, 0x484af8d6,
0x4818ee22, 0x47e70611, 0x47b5408c, 0x47839d7b,
0x47521cc6, 0x4720be55, 0x46ef8210, 0x46be67e0,
0x468d6fae, 0x465c9961, 0x462be4e2, 0x45fb521a,
0x45cae0f2, 0x459a9152, 0x456a6323, 0x453a564d,
0x450a6abb, 0x44daa054, 0x44aaf702, 0x447b6ead,
0x444c0740, 0x441cc0a3, 0x43ed9ac0, 0x43be9580,
0x438fb0cb, 0x4360ec8d, 0x433248ae, 0x4303c517,
0x42d561b4, 0x42a71e6c, 0x4278fb2b, 0x424af7da,
0x421d1462, 0x41ef50ae, 0x41c1aca8, 0x41942839,
0x4166c34c, 0x41397dcc, 0x410c57a2, 0x40df50b8,
0x40b268fa, 0x4085a051, 0x4058f6a8, 0x402c6be9
};
/*!
\brief calculates 2 ^ (x/y) for x<=0, y > 0, x <= 32768 * y
avoids integer division
\return
*/
Word32 pow2_xy(Word32 x, Word32 y)
{
Word32 iPart;
Word32 fPart;
Word32 res;
Word32 tmp, tmp2;
Word32 shift, shift2;
tmp2 = -x;
iPart = tmp2 / y;
fPart = tmp2 - iPart*y;
iPart = min(iPart,INT_BITS-1);
res = pow2Table[(POW2_TABLE_SIZE*fPart)/y] >> iPart;
return(res);
}

View File

@@ -1,86 +1,86 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: oper_32b.h
Content: Double precision operations
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: oper_32b.h
Content: Double precision operations
*******************************************************************************/
#ifndef __OPER_32b_H
#define __OPER_32b_H
#include "typedef.h"
#include "typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
#define POW2_TABLE_BITS 8
#define POW2_TABLE_SIZE (1<<POW2_TABLE_BITS)
#define POW2_TABLE_BITS 8
#define POW2_TABLE_SIZE (1<<POW2_TABLE_BITS)
void L_Extract (Word32 L_32, Word16 *hi, Word16 *lo);
Word32 L_Comp (Word16 hi, Word16 lo);
Word32 Mpy_32 (Word16 hi1, Word16 lo1, Word16 hi2, Word16 lo2);
Word32 Mpy_32_16 (Word16 hi, Word16 lo, Word16 n);
Word32 Div_32 (Word32 L_num, Word32 denom);
Word16 iLog4(Word32 value);
Word32 rsqrt(Word32 value, Word32 accuracy);
Word32 pow2_xy(Word32 x, Word32 y);
__inline Word32 L_mpy_ls(Word32 L_var2, Word16 var1)
{
unsigned short swLow1;
Word16 swHigh1;
Word32 l_var_out;
swLow1 = (unsigned short)(L_var2);
swHigh1 = (Word16)(L_var2 >> 16);
l_var_out = (long)swLow1 * (long)var1 >> 15;
l_var_out += swHigh1 * var1 << 1;
return(l_var_out);
}
__inline Word32 L_mpy_wx(Word32 L_var2, Word16 var1)
{
#if ARMV5TE_L_MPY_LS
Word32 result;
asm volatile(
"SMULWB %[result], %[L_var2], %[var1] \n"
:[result]"+r"(result)
:[L_var2]"r"(L_var2), [var1]"r"(var1)
);
return result;
#else
unsigned short swLow1;
Word16 swHigh1;
Word32 l_var_out;
swLow1 = (unsigned short)(L_var2);
swHigh1 = (Word16)(L_var2 >> 16);
l_var_out = (long)swLow1 * (long)var1 >> 16;
l_var_out += swHigh1 * var1;
return(l_var_out);
#endif
}
Word16 iLog4(Word32 value);
Word32 rsqrt(Word32 value, Word32 accuracy);
Word32 pow2_xy(Word32 x, Word32 y);
__inline Word32 L_mpy_ls(Word32 L_var2, Word16 var1)
{
unsigned short swLow1;
Word16 swHigh1;
Word32 l_var_out;
swLow1 = (unsigned short)(L_var2);
swHigh1 = (Word16)(L_var2 >> 16);
l_var_out = (long)swLow1 * (long)var1 >> 15;
l_var_out += swHigh1 * var1 << 1;
return(l_var_out);
}
__inline Word32 L_mpy_wx(Word32 L_var2, Word16 var1)
{
#if ARMV5TE_L_MPY_LS
Word32 result;
asm volatile(
"SMULWB %[result], %[L_var2], %[var1] \n"
:[result]"+r"(result)
:[L_var2]"r"(L_var2), [var1]"r"(var1)
);
return result;
#else
unsigned short swLow1;
Word16 swHigh1;
Word32 l_var_out;
swLow1 = (unsigned short)(L_var2);
swHigh1 = (Word16)(L_var2 >> 16);
l_var_out = (long)swLow1 * (long)var1 >> 16;
l_var_out += swHigh1 * var1;
return(l_var_out);
#endif
}
#ifdef __cplusplus
}

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: typedef.h
Content: type defined for defferent paltform
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: typedef.h
Content: type defined for defferent paltform
*******************************************************************************/
#ifndef typedef_h
@@ -54,7 +54,7 @@ typedef int Flag;
/*
* use (improved) type definition file typdefs.h and add a "Flag" type
*/
*/
#include "typedefs.h"
typedef int Flag;

View File

@@ -1,56 +1,56 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: typedefs.h
Content: type defined or const defined
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: typedefs.h
Content: type defined or const defined
*******************************************************************************/
#ifndef typedefs_h
#define typedefs_h "$Id $"
#ifndef CHAR_BIT
#define CHAR_BIT 8 /* number of bits in a char */
#endif
#ifndef VOAAC_SHRT_MAX
#define VOAAC_SHRT_MAX (32767) /* maximum (signed) short value */
#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8 /* number of bits in a char */
#endif
#ifndef VOAAC_SHRT_MIN
#define VOAAC_SHRT_MIN (-32768) /* minimum (signed) short value */
#endif
#ifndef VOAAC_SHRT_MAX
#define VOAAC_SHRT_MAX (32767) /* maximum (signed) short value */
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#ifndef VOAAC_SHRT_MIN
#define VOAAC_SHRT_MIN (-32768) /* minimum (signed) short value */
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#ifndef assert
#define assert(_Expression) ((void)0)
#endif
#ifdef LINUX
#define __inline static __inline__
#endif
#ifdef LINUX
#define __inline static __inline__
#endif
#define INT_BITS 32
/*
@@ -80,100 +80,100 @@ typedef unsigned short UWord16;
typedef long Word32;
typedef unsigned long UWord32;
#ifdef LINUX
typedef long long Word64;
typedef unsigned long long UWord64;
#else
typedef __int64 Word64;
typedef __int64 Word64;
typedef unsigned __int64 UWord64;
#endif
#ifndef min
#define min(a,b) ( a < b ? a : b)
#endif
#ifndef max
#define max(a,b) ( a > b ? a : b)
#endif
#ifdef ARM_INASM
#ifdef ARMV5_INASM
#define ARMV5E_INASM 1
#endif
#define ARMV4_INASM 1
#endif
#ifndef min
#define min(a,b) ( a < b ? a : b)
#endif
#if ARMV4_INASM
#define ARMV5TE_SAT 1
#define ARMV5TE_ADD 1
#define ARMV5TE_SUB 1
#define ARMV5TE_SHL 1
#define ARMV5TE_SHR 1
#define ARMV5TE_L_SHL 1
#define ARMV5TE_L_SHR 1
#endif//ARMV4
#if ARMV5E_INASM
#define ARMV5TE_L_ADD 1
#define ARMV5TE_L_SUB 1
#define ARMV5TE_L_MULT 1
#define ARMV5TE_L_MAC 1
#define ARMV5TE_L_MSU 1
#define ARMV5TE_DIV_S 1
#define ARMV5TE_ROUND 1
#define ARMV5TE_MULT 1
#define ARMV5TE_NORM_S 1
#define ARMV5TE_NORM_L 1
#define ARMV5TE_L_MPY_LS 1
#ifndef max
#define max(a,b) ( a > b ? a : b)
#endif
//basic operation functions optimization flags
#define SATRUATE_IS_INLINE 1 //define saturate as inline function
#define SHL_IS_INLINE 1 //define shl as inline function
#define SHR_IS_INLINE 1 //define shr as inline function
#define L_MULT_IS_INLINE 1 //define L_mult as inline function
#define L_MSU_IS_INLINE 1 //define L_msu as inline function
#define L_SUB_IS_INLINE 1 //define L_sub as inline function
#define L_SHL_IS_INLINE 1 //define L_shl as inline function
#define L_SHR_IS_INLINE 1 //define L_shr as inline function
#define ADD_IS_INLINE 1 //define add as inline function //add, inline is the best
#define SUB_IS_INLINE 1 //define sub as inline function //sub, inline is the best
#define DIV_S_IS_INLINE 1 //define div_s as inline function
#define MULT_IS_INLINE 1 //define mult as inline function
#define NORM_S_IS_INLINE 1 //define norm_s as inline function
#define NORM_L_IS_INLINE 1 //define norm_l as inline function
#define ROUND_IS_INLINE 1 //define round as inline function
#define L_MAC_IS_INLINE 1 //define L_mac as inline function
#define L_ADD_IS_INLINE 1 //define L_add as inline function
#define EXTRACT_H_IS_INLINE 1 //define extract_h as inline function
#define EXTRACT_L_IS_INLINE 1 //define extract_l as inline function //???
#define MULT_R_IS_INLINE 1 //define mult_r as inline function
#define SHR_R_IS_INLINE 1 //define shr_r as inline function
#define MAC_R_IS_INLINE 1 //define mac_r as inline function
#define MSU_R_IS_INLINE 1 //define msu_r as inline function
#define L_SHR_R_IS_INLINE 1 //define L_shr_r as inline function
#define PREFIX voAACEnc
#define LINK0(x, y, z) LINK1(x,y,z)
#define LINK1(x,y,z) x##y##z
#define ADD_PREFIX(func) LINK0(PREFIX, _, func)
#define L_Extract ADD_PREFIX(L_Extract)
#define L_Comp ADD_PREFIX(L_Comp)
#define Mpy_32 ADD_PREFIX(Mpy_32)
#define Mpy_32_16 ADD_PREFIX(Mpy_32_16)
#define Div_32 ADD_PREFIX(Div_32)
#define iLog4 ADD_PREFIX(iLog4)
#define rsqrt ADD_PREFIX(rsqrt)
#define pow2_xy ADD_PREFIX(pow2_xy)
#define L_mpy_ls ADD_PREFIX(L_mpy_ls)
#define L_mpy_wx ADD_PREFIX(L_mpy_wx)
#define mem_malloc ADD_PREFIX(mem_malloc)
#define mem_free ADD_PREFIX(mem_free)
#ifdef ARM_INASM
#ifdef ARMV5_INASM
#define ARMV5E_INASM 1
#endif
#define ARMV4_INASM 1
#endif
#if ARMV4_INASM
#define ARMV5TE_SAT 1
#define ARMV5TE_ADD 1
#define ARMV5TE_SUB 1
#define ARMV5TE_SHL 1
#define ARMV5TE_SHR 1
#define ARMV5TE_L_SHL 1
#define ARMV5TE_L_SHR 1
#endif//ARMV4
#if ARMV5E_INASM
#define ARMV5TE_L_ADD 1
#define ARMV5TE_L_SUB 1
#define ARMV5TE_L_MULT 1
#define ARMV5TE_L_MAC 1
#define ARMV5TE_L_MSU 1
#define ARMV5TE_DIV_S 1
#define ARMV5TE_ROUND 1
#define ARMV5TE_MULT 1
#define ARMV5TE_NORM_S 1
#define ARMV5TE_NORM_L 1
#define ARMV5TE_L_MPY_LS 1
#endif
//basic operation functions optimization flags
#define SATRUATE_IS_INLINE 1 //define saturate as inline function
#define SHL_IS_INLINE 1 //define shl as inline function
#define SHR_IS_INLINE 1 //define shr as inline function
#define L_MULT_IS_INLINE 1 //define L_mult as inline function
#define L_MSU_IS_INLINE 1 //define L_msu as inline function
#define L_SUB_IS_INLINE 1 //define L_sub as inline function
#define L_SHL_IS_INLINE 1 //define L_shl as inline function
#define L_SHR_IS_INLINE 1 //define L_shr as inline function
#define ADD_IS_INLINE 1 //define add as inline function //add, inline is the best
#define SUB_IS_INLINE 1 //define sub as inline function //sub, inline is the best
#define DIV_S_IS_INLINE 1 //define div_s as inline function
#define MULT_IS_INLINE 1 //define mult as inline function
#define NORM_S_IS_INLINE 1 //define norm_s as inline function
#define NORM_L_IS_INLINE 1 //define norm_l as inline function
#define ROUND_IS_INLINE 1 //define round as inline function
#define L_MAC_IS_INLINE 1 //define L_mac as inline function
#define L_ADD_IS_INLINE 1 //define L_add as inline function
#define EXTRACT_H_IS_INLINE 1 //define extract_h as inline function
#define EXTRACT_L_IS_INLINE 1 //define extract_l as inline function //???
#define MULT_R_IS_INLINE 1 //define mult_r as inline function
#define SHR_R_IS_INLINE 1 //define shr_r as inline function
#define MAC_R_IS_INLINE 1 //define mac_r as inline function
#define MSU_R_IS_INLINE 1 //define msu_r as inline function
#define L_SHR_R_IS_INLINE 1 //define L_shr_r as inline function
#define PREFIX voAACEnc
#define LINK0(x, y, z) LINK1(x,y,z)
#define LINK1(x,y,z) x##y##z
#define ADD_PREFIX(func) LINK0(PREFIX, _, func)
#define L_Extract ADD_PREFIX(L_Extract)
#define L_Comp ADD_PREFIX(L_Comp)
#define Mpy_32 ADD_PREFIX(Mpy_32)
#define Mpy_32_16 ADD_PREFIX(Mpy_32_16)
#define Div_32 ADD_PREFIX(Div_32)
#define iLog4 ADD_PREFIX(iLog4)
#define rsqrt ADD_PREFIX(rsqrt)
#define pow2_xy ADD_PREFIX(pow2_xy)
#define L_mpy_ls ADD_PREFIX(L_mpy_ls)
#define L_mpy_wx ADD_PREFIX(L_mpy_wx)
#define mem_malloc ADD_PREFIX(mem_malloc)
#define mem_free ADD_PREFIX(mem_free)
#endif

View File

@@ -1,55 +1,55 @@
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v5
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= -DARMV5E -DARM_INASM -DARMV5_INASM
# please specify the name of your module
VOTARGET:=libvoAACEncv5
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=#-ldl -lstdc++
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v5
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= -DARMV5E -DARM_INASM -DARMV5_INASM
# please specify the name of your module
VOTARGET:=libvoAACEncv5
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=#-ldl -lstdc++
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk

View File

@@ -1,55 +1,55 @@
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v7
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM
# please specify the name of your module
VOTARGET:=libvoAACEncv7
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=#-ldl -lstdc++
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v7
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= -DARMV5E -DARMV7Neon -DARM_INASM -DARMV5_INASM
# please specify the name of your module
VOTARGET:=libvoAACEncv7
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=#-ldl -lstdc++
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk

View File

@@ -1,42 +1,42 @@
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# please list all objects needed by your target here
OBJS:=basicop2.o oper_32b.o aac_rom.o aacenc.o aacenc_core.o adj_thr.o \
band_nrg.o bit_cnt.o bitbuffer.o bitenc.o block_switch.o channel_map.o \
dyn_bits.o grp_data.o interface.o line_pe.o memalign.o ms_stereo.o \
pre_echo_control.o psy_configuration.o psy_main.o qc_main.o quantize.o sf_estim.o \
spreading.o stat_bits.o tns.o transform.o
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../../../src \
../../../inc \
../../../basic_op\
../../../../../Include
ifeq ($(VOTT), v5)
OBJS+= AutoCorrelation_v5.o band_nrg_v5.o CalcWindowEnergy_v5.o \
PrePostMDCT_v5.o R4R8First_v5.o Radix4FFT_v5.o
VOSRCDIR+= ../../../src/asm/ARMV5E/
endif
ifeq ($(VOTT), v7)
OBJS+= AutoCorrelation_v5.o band_nrg_v5.o CalcWindowEnergy_v5.o \
PrePostMDCT_v7.o R4R8First_v7.o Radix4FFT_v7.o
VOSRCDIR+= ../../../src/asm/ARMV5E/
VOSRCDIR+= ../../../src/asm/ARMV7/
#/*
#** Copyright 2003-2010, VisualOn, Inc.
#**
#** Licensed under the Apache License, Version 2.0 (the "License");
#** you may not use this file except in compliance with the License.
#** You may obtain a copy of the License at
#**
#** http://www.apache.org/licenses/LICENSE-2.0
#**
#** Unless required by applicable law or agreed to in writing, software
#** distributed under the License is distributed on an "AS IS" BASIS,
#** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#** See the License for the specific language governing permissions and
#** limitations under the License.
#*/
# please list all objects needed by your target here
OBJS:=basicop2.o oper_32b.o aac_rom.o aacenc.o aacenc_core.o adj_thr.o \
band_nrg.o bit_cnt.o bitbuffer.o bitenc.o block_switch.o channel_map.o \
dyn_bits.o grp_data.o interface.o line_pe.o memalign.o ms_stereo.o \
pre_echo_control.o psy_configuration.o psy_main.o qc_main.o quantize.o sf_estim.o \
spreading.o stat_bits.o tns.o transform.o
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../../../src \
../../../inc \
../../../basic_op\
../../../../../Include
ifeq ($(VOTT), v5)
OBJS+= AutoCorrelation_v5.o band_nrg_v5.o CalcWindowEnergy_v5.o \
PrePostMDCT_v5.o R4R8First_v5.o Radix4FFT_v5.o
VOSRCDIR+= ../../../src/asm/ARMV5E/
endif
ifeq ($(VOTT), v7)
OBJS+= AutoCorrelation_v5.o band_nrg_v5.o CalcWindowEnergy_v5.o \
PrePostMDCT_v7.o R4R8First_v7.o Radix4FFT_v7.o
VOSRCDIR+= ../../../src/asm/ARMV5E/
VOSRCDIR+= ../../../src/asm/ARMV7/
endif

View File

@@ -1,28 +1,28 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aac_rom.h
Content: constant tables
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aac_rom.h
Content: constant tables
*******************************************************************************/
#ifndef ROM_H
#define ROM_H
#include "config.h"
#include "psy_const.h"
#include "tns_param.h"
@@ -31,16 +31,16 @@
mdct
*/
extern const int ShortWindowSine[FRAME_LEN_SHORT/2];
extern const int LongWindowKBD[FRAME_LEN_LONG/2];
extern const unsigned char bitrevTab[17 + 129];
extern const int cossintab[128 + 1024];
#if defined (ARMV5E) && !defined (ARMV7Neon)
extern const int twidTab64[(4*6 + 16*6)/2];
extern const int twidTab512[(8*6 + 32*6 + 128*6)/2];
#else
extern const int twidTab64[4*6 + 16*6];
extern const int LongWindowKBD[FRAME_LEN_LONG/2];
extern const unsigned char bitrevTab[17 + 129];
extern const int cossintab[128 + 1024];
#if defined (ARMV5E) && !defined (ARMV7Neon)
extern const int twidTab64[(4*6 + 16*6)/2];
extern const int twidTab512[(8*6 + 32*6 + 128*6)/2];
#else
extern const int twidTab64[4*6 + 16*6];
extern const int twidTab512[8*6 + 32*6 + 128*6];
#endif
@@ -61,7 +61,7 @@ extern Word32 specExpMantTableComb_enc[4][14];
extern const UWord8 specExpTableComb_enc[4][14];
extern const Word16 quantBorders[4][4];
//extern const Word16 quantRecon[3][4];
//extern const Word16 quantRecon[3][4];
extern const Word16 quantRecon[4][3];
/*
@@ -92,26 +92,26 @@ extern const UWord32 huff_ctabscf[121];
/*
misc
*/
extern const int sampRateTab[NUM_SAMPLE_RATES];
extern const int BandwithCoefTab[8][NUM_SAMPLE_RATES];
extern const int rates[8];
extern const UWord8 sfBandTotalShort[NUM_SAMPLE_RATES];
extern const UWord8 sfBandTotalLong[NUM_SAMPLE_RATES];
extern const int sfBandTabShortOffset[NUM_SAMPLE_RATES];
extern const short sfBandTabShort[76];
extern const int sfBandTabLongOffset[NUM_SAMPLE_RATES];
extern const short sfBandTabLong[325];
extern const int sampRateTab[NUM_SAMPLE_RATES];
extern const int BandwithCoefTab[8][NUM_SAMPLE_RATES];
extern const int rates[8];
extern const UWord8 sfBandTotalShort[NUM_SAMPLE_RATES];
extern const UWord8 sfBandTotalLong[NUM_SAMPLE_RATES];
extern const int sfBandTabShortOffset[NUM_SAMPLE_RATES];
extern const short sfBandTabShort[76];
extern const int sfBandTabLongOffset[NUM_SAMPLE_RATES];
extern const short sfBandTabLong[325];
extern const Word32 m_log2_table[INT_BITS];
/*
TNS
*/
extern const Word32 tnsCoeff3[8];
extern const Word32 tnsCoeff3Borders[8];
extern const Word32 tnsCoeff4[16];
extern const Word32 tnsCoeff4Borders[16];
extern const Word32 invSBF[24];
extern const Word16 sideInfoTabLong[MAX_SFB_LONG + 1];
extern const Word32 tnsCoeff3[8];
extern const Word32 tnsCoeff3Borders[8];
extern const Word32 tnsCoeff4[16];
extern const Word32 tnsCoeff4Borders[16];
extern const Word32 invSBF[24];
extern const Word16 sideInfoTabLong[MAX_SFB_LONG + 1];
extern const Word16 sideInfoTabShort[MAX_SFB_SHORT + 1];
#endif

View File

@@ -1,37 +1,37 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aacenc_core.h
Content: aac encoder interface functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aacenc_core.h
Content: aac encoder interface functions
*******************************************************************************/
#ifndef _aacenc_core_h_
#define _aacenc_core_h_
#include "typedef.h"
#include "config.h"
#include "bitenc.h"
#include "psy_configuration.h"
#include "psy_main.h"
#include "qc_main.h"
#include "psy_main.h"
#include "config.h"
#include "bitenc.h"
#include "psy_configuration.h"
#include "psy_main.h"
#include "qc_main.h"
#include "psy_main.h"
/*-------------------------- defines --------------------------------------*/
@@ -41,42 +41,42 @@ typedef struct {
Word32 bitRate; /* encoder bit rate in bits/sec */
Word16 nChannelsIn; /* number of channels on input (1,2) */
Word16 nChannelsOut; /* number of channels on output (1,2) */
Word16 bandWidth; /* targeted audio bandwidth in Hz */
Word16 bandWidth; /* targeted audio bandwidth in Hz */
Word16 adtsUsed; /* whether write adts header */
} AACENC_CONFIG;
typedef struct {
AACENC_CONFIG config; /* Word16 size: 8 */
ELEMENT_INFO elInfo; /* Word16 size: 4 */
QC_STATE qcKernel; /* Word16 size: 6 + 5(PADDING) + 7(ELEMENT_BITS) + 54(ADJ_THR_STATE) = 72 */
QC_OUT qcOut; /* Word16 size: MAX_CHANNELS*920(QC_OUT_CHANNEL) + 5(QC_OUT_ELEMENT) + 7 = 932 / 1852 */
PSY_OUT psyOut; /* Word16 size: MAX_CHANNELS*186 + 2 = 188 / 374 */
PSY_KERNEL psyKernel; /* Word16 size: 2587 / 4491 */
struct BITSTREAMENCODER_INIT bseInit; /* Word16 size: 6 */
struct BIT_BUF bitStream; /* Word16 size: 8 */
HANDLE_BIT_BUF hBitStream;
int initOK;
short *intbuf;
short *encbuf;
short *inbuf;
int enclen;
int inlen;
int intlen;
int uselength;
void *hCheck;
VO_MEM_OPERATOR *voMemop;
VO_MEM_OPERATOR voMemoprator;
}AAC_ENCODER; /* Word16 size: 3809 / 6851 */
typedef struct {
AACENC_CONFIG config; /* Word16 size: 8 */
ELEMENT_INFO elInfo; /* Word16 size: 4 */
QC_STATE qcKernel; /* Word16 size: 6 + 5(PADDING) + 7(ELEMENT_BITS) + 54(ADJ_THR_STATE) = 72 */
QC_OUT qcOut; /* Word16 size: MAX_CHANNELS*920(QC_OUT_CHANNEL) + 5(QC_OUT_ELEMENT) + 7 = 932 / 1852 */
PSY_OUT psyOut; /* Word16 size: MAX_CHANNELS*186 + 2 = 188 / 374 */
PSY_KERNEL psyKernel; /* Word16 size: 2587 / 4491 */
struct BITSTREAMENCODER_INIT bseInit; /* Word16 size: 6 */
struct BIT_BUF bitStream; /* Word16 size: 8 */
HANDLE_BIT_BUF hBitStream;
int initOK;
short *intbuf;
short *encbuf;
short *inbuf;
int enclen;
int inlen;
int intlen;
int uselength;
void *hCheck;
VO_MEM_OPERATOR *voMemop;
VO_MEM_OPERATOR voMemoprator;
}AAC_ENCODER; /* Word16 size: 3809 / 6851 */
/*-----------------------------------------------------------------------------
functionname: AacInitDefaultConfig

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: adj_thr.h
Content: Threshold compensation function
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: adj_thr.h
Content: Threshold compensation function
*******************************************************************************/
#ifndef __ADJ_THR_H

View File

@@ -1,29 +1,29 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: adj_thr_data.h
Content: Threshold compensation parameter
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: adj_thr_data.h
Content: Threshold compensation parameter
*******************************************************************************/
#ifndef __ADJ_THR_DATA_H
#define __ADJ_THR_DATA_H
#include "typedef.h"
#include "typedef.h"
#include "psy_const.h"
#include "line_pe.h"

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: band_nrg.h
Content: Band/Line energy calculations functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: band_nrg.h
Content: Band/Line energy calculations functions
*******************************************************************************/

View File

@@ -1,29 +1,29 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bit_cnt.h
Content: Huffman Bitcounter & coder structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bit_cnt.h
Content: Huffman Bitcounter & coder structure and functions
*******************************************************************************/
#ifndef __BITCOUNT_H
#define __BITCOUNT_H
#include "bitbuffer.h"
#include "bitbuffer.h"
#include "basic_op.h"
#define INVALID_BITCOUNT (MAX_16/4)

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitbuffer.h
Content: Bit Buffer Management structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitbuffer.h
Content: Bit Buffer Management structure and functions
*******************************************************************************/
#ifndef BITBUFFER_H

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitenc.h
Content: Bitstream encoder structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitenc.h
Content: Bitstream encoder structure and functions
*******************************************************************************/
#ifndef _BITENC_H
@@ -42,8 +42,8 @@ Word16 WriteBitstream (HANDLE_BIT_BUF hBitstream,
ELEMENT_INFO elInfo,
QC_OUT *qcOut,
PSY_OUT *psyOut,
Word16 *globUsedBits,
const UWord8 *ancBytes,
Word16 *globUsedBits,
const UWord8 *ancBytes,
Word16 samplerate
);

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: block_switch.h
Content: Block switching structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: block_switch.h
Content: Block switching structure and functions
*******************************************************************************/
#ifndef _BLOCK_SWITCH_H

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: channel_map.h
Content: channel mapping functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: channel_map.h
Content: channel mapping functions
*******************************************************************************/
#ifndef _CHANNEL_MAP_H

View File

@@ -1,36 +1,36 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: config.h
Content: aac encoder parameter
*******************************************************************************/
#ifndef _AACENC_CONFIG_H_
#define _AACENC_CONFIG_H_
#define MAX_CHANNELS 2
#define AACENC_BLOCKSIZE 1024 /*! encoder only takes BLOCKSIZE samples at a time */
#define AACENC_TRANS_FAC 8 /*! encoder short long ratio */
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: config.h
Content: aac encoder parameter
*******************************************************************************/
#ifndef _AACENC_CONFIG_H_
#define _AACENC_CONFIG_H_
#define MAX_CHANNELS 2
#define AACENC_BLOCKSIZE 1024 /*! encoder only takes BLOCKSIZE samples at a time */
#define AACENC_TRANS_FAC 8 /*! encoder short long ratio */
#define MAXBITS_COEF 6144
#define MINBITS_COEF 744
#define MINBITS_COEF 744
#endif

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: dyn_bits.h
Content: Noiseless coder module structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: dyn_bits.h
Content: Noiseless coder module structure and functions
*******************************************************************************/
#ifndef __DYN_BITS_H

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: grp_data.h
Content: Short block grouping function
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: grp_data.h
Content: Short block grouping function
*******************************************************************************/
#ifndef __GRP_DATA_H__

View File

@@ -1,29 +1,29 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: interface.h
Content: psychoaccoustic/quantizer structures and interface
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: interface.h
Content: psychoaccoustic/quantizer structures and interface
*******************************************************************************/
#ifndef _INTERFACE_H
#define _INTERFACE_H
#include "config.h"
#include "config.h"
#include "psy_const.h"
#include "psy_data.h"
#include "typedefs.h"

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: line_pe.h
Content: Perceptual entropie module structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: line_pe.h
Content: Perceptual entropie module structure and functions
*******************************************************************************/
#ifndef __LINE_PE_H

View File

@@ -1,35 +1,35 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: memalign.h
Content: Memory alloc alignments functions
*******************************************************************************/
#ifndef __VO_AACENC_MEM_ALIGN_H__
#define __VO_AACENC_MEM_ALIGN_H__
#include "voMem.h"
#include "typedef.h"
extern void *mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment, unsigned int CodecID);
extern void mem_free(VO_MEM_OPERATOR *pMemop, void *mem_ptr, unsigned int CodecID);
#endif /* __VO_MEM_ALIGN_H__ */
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: memalign.h
Content: Memory alloc alignments functions
*******************************************************************************/
#ifndef __VO_AACENC_MEM_ALIGN_H__
#define __VO_AACENC_MEM_ALIGN_H__
#include "voMem.h"
#include "typedef.h"
extern void *mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment, unsigned int CodecID);
extern void mem_free(VO_MEM_OPERATOR *pMemop, void *mem_ptr, unsigned int CodecID);
#endif /* __VO_MEM_ALIGN_H__ */

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: ms_stereo.h
Content: Declaration MS stereo processing structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: ms_stereo.h
Content: Declaration MS stereo processing structure and functions
*******************************************************************************/
#ifndef __MS_STEREO_H__

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: pre_echo_control.h
Content: Pre echo control functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: pre_echo_control.h
Content: Pre echo control functions
*******************************************************************************/
#ifndef __PRE_ECHO_CONTROL_H

View File

@@ -1,28 +1,28 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_configuration.h
Content: Psychoaccoustic configuration structure and functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_configuration.h
Content: Psychoaccoustic configuration structure and functions
*******************************************************************************/
#ifndef _PSY_CONFIGURATION_H
#define _PSY_CONFIGURATION_H
#include "typedefs.h"
#include "psy_const.h"
#include "tns.h"
@@ -38,7 +38,7 @@ typedef struct{
Word16 maxAllowedIncreaseFactor; /* preecho control */
Word16 minRemainingThresholdFactor;
Word16 lowpassLine;
Word16 lowpassLine;
Word16 sampRateIdx;
Word32 clipEnergy; /* for level dependend tmn */
@@ -68,7 +68,7 @@ typedef struct{
Word16 maxAllowedIncreaseFactor; /* preecho control */
Word16 minRemainingThresholdFactor;
Word16 lowpassLine;
Word16 lowpassLine;
Word16 sampRateIdx;
Word32 clipEnergy; /* for level dependend tmn */
@@ -85,10 +85,10 @@ typedef struct{
TNS_CONFIG tnsConf;
}PSY_CONFIGURATION_SHORT; /*Word16 size: 8 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 47 = 167 */
/* Returns the sample rate index */
Word32 GetSRIndex(Word32 sampleRate);
/* Returns the sample rate index */
Word32 GetSRIndex(Word32 sampleRate);
Word16 InitPsyConfigurationLong(Word32 bitrate,

View File

@@ -1,37 +1,37 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_const.h
Content: Global psychoacoustic constants structures
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_const.h
Content: Global psychoacoustic constants structures
*******************************************************************************/
#ifndef _PSYCONST_H
#define _PSYCONST_H
#include "config.h"
#include "config.h"
#define TRUE 1
#define FALSE 0
#define FRAME_LEN_LONG AACENC_BLOCKSIZE
#define TRANS_FAC 8
#define FRAME_LEN_SHORT (FRAME_LEN_LONG/TRANS_FAC)
#define FRAME_LEN_SHORT (FRAME_LEN_LONG/TRANS_FAC)
/* Block types */
@@ -74,7 +74,7 @@ enum
#define TRANSFORM_OFFSET_SHORT 448
#define LOG_NORM_PCM -15
#define NUM_SAMPLE_RATES 12
#endif /* _PSYCONST_H */

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_data.h
Content: Psychoacoustic data and structures
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_data.h
Content: Psychoacoustic data and structures
*******************************************************************************/
#ifndef _PSY_DATA_H

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_main.h
Content: Psychoacoustic major function block
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_main.h
Content: Psychoacoustic major function block
*******************************************************************************/
#ifndef _PSYMAIN_H
@@ -35,7 +35,7 @@ typedef struct {
PSY_CONFIGURATION_SHORT psyConfShort; /* Word16 size: 167 */
PSY_DATA psyData[MAX_CHANNELS]; /* Word16 size: MAX_CHANNELS*1669*/
TNS_DATA tnsData[MAX_CHANNELS]; /* Word16 size: MAX_CHANNELS*235 */
Word32* pScratchTns;
Word32* pScratchTns;
Word16 sampleRateIdx;
}PSY_KERNEL; /* Word16 size: 2587 / 4491 */

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: qc_data.h
Content: Quantizing & coding structures
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: qc_data.h
Content: Quantizing & coding structures
*******************************************************************************/
#ifndef _QC_DATA_H
@@ -89,7 +89,7 @@ typedef struct
typedef struct
{
Word16 adtsUsed;
Word16 adtsUsed;
Word16 staticBitsUsed; /* for verification purposes */
Word16 dynBitsUsed; /* for verification purposes */
Word16 pe;

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: qc_main.h
Content: Quantizing & coding functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: qc_main.h
Content: Quantizing & coding functions
*******************************************************************************/
#ifndef _QC_MAIN_H

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: quantize.h
Content: Quantization functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: quantize.h
Content: Quantization functions
*******************************************************************************/
#ifndef _QUANTIZE_H_

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: sf_estim.h
Content: Scale factor estimation functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: sf_estim.h
Content: Scale factor estimation functions
*******************************************************************************/
#ifndef __SF_ESTIM_H__

View File

@@ -1,29 +1,29 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: spreading.h
Content: Spreading of energy functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: spreading.h
Content: Spreading of energy functions
*******************************************************************************/
#ifndef _SPREADING_H
#define _SPREADING_H
#include "typedefs.h"
void SpreadingMax(const Word16 pbCnt,
const Word16 *maskLowFactor,

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: stat_bits.h
Content: Static bit counter functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: stat_bits.h
Content: Static bit counter functions
*******************************************************************************/
#ifndef __STAT_BITS_H
@@ -28,7 +28,7 @@
Word16 countStaticBitdemand(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
PSY_OUT_ELEMENT *psyOutElement,
Word16 nChannels,
Word16 nChannels,
Word16 adtsUsed);
#endif /* __STAT_BITS_H */

View File

@@ -1,28 +1,28 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns.h
Content: TNS structures
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns.h
Content: TNS structures
*******************************************************************************/
#ifndef _TNS_H
#define _TNS_H
#include "typedef.h"
#include "psy_const.h"

View File

@@ -1,30 +1,30 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns_func.h
Content: TNS functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns_func.h
Content: TNS functions
*******************************************************************************/
/*
Temporal noise shaping
*/
#ifndef _TNS_FUNC_H
#define _TNS_FUNC_H
#define _TNS_FUNC_H
#include "typedef.h"
#include "psy_configuration.h"

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns_param.h
Content: TNS parameters
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns_param.h
Content: TNS parameters
*******************************************************************************/
/*

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: transform.h
Content: MDCT Transform functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: transform.h
Content: MDCT Transform functions
*******************************************************************************/
#ifndef __TRANSFORM_H__

File diff suppressed because it is too large Load Diff

View File

@@ -1,105 +1,105 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aacenc.c
Content: aac encoder interface functions
*******************************************************************************/
#include "voAAC.h"
#include "typedef.h"
#include "aacenc_core.h"
#include "aac_rom.h"
#include "cmnMemory.h"
#include "memalign.h"
/**
* Init the audio codec module and return codec handle
* \param phCodec [OUT] Return the video codec handle
* \param vType [IN] The codec type if the module support multi codec.
* \param pUserData [IN] The init param. It is memory operator or alloced memory
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncInit(VO_HANDLE * phCodec,VO_AUDIO_CODINGTYPE vType, VO_CODEC_INIT_USERDATA *pUserData)
{
AAC_ENCODER*hAacEnc;
AACENC_CONFIG config;
int error;
#ifdef USE_DEAULT_MEM
VO_MEM_OPERATOR voMemoprator;
#endif
VO_MEM_OPERATOR *pMemOP;
int interMem;
interMem = 0;
error = 0;
/* init the memory operator */
if(pUserData == NULL || pUserData->memflag != VO_IMF_USERMEMOPERATOR || pUserData->memData == NULL )
{
#ifdef USE_DEAULT_MEM
voMemoprator.Alloc = cmnMemAlloc;
voMemoprator.Copy = cmnMemCopy;
voMemoprator.Free = cmnMemFree;
voMemoprator.Set = cmnMemSet;
voMemoprator.Check = cmnMemCheck;
interMem = 1;
pMemOP = &voMemoprator;
#else
*phCodec = NULL;
return VO_ERR_INVALID_ARG;
#endif
}
else
{
pMemOP = (VO_MEM_OPERATOR *)pUserData->memData;
}
/* init the aac encoder handle */
hAacEnc = (AAC_ENCODER*)mem_malloc(pMemOP, sizeof(AAC_ENCODER), 32, VO_INDEX_ENC_AAC);
if(NULL == hAacEnc)
{
error = 1;
}
if(!error)
{
/* init the aac encoder intra memory */
hAacEnc->intbuf = (short *)mem_malloc(pMemOP, AACENC_BLOCKSIZE*MAX_CHANNELS*sizeof(short), 32, VO_INDEX_ENC_AAC);
if(NULL == hAacEnc->intbuf)
{
error = 1;
}
}
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aacenc.c
Content: aac encoder interface functions
*******************************************************************************/
#include "voAAC.h"
#include "typedef.h"
#include "aacenc_core.h"
#include "aac_rom.h"
#include "cmnMemory.h"
#include "memalign.h"
/**
* Init the audio codec module and return codec handle
* \param phCodec [OUT] Return the video codec handle
* \param vType [IN] The codec type if the module support multi codec.
* \param pUserData [IN] The init param. It is memory operator or alloced memory
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncInit(VO_HANDLE * phCodec,VO_AUDIO_CODINGTYPE vType, VO_CODEC_INIT_USERDATA *pUserData)
{
AAC_ENCODER*hAacEnc;
AACENC_CONFIG config;
int error;
#ifdef USE_DEAULT_MEM
VO_MEM_OPERATOR voMemoprator;
#endif
VO_MEM_OPERATOR *pMemOP;
int interMem;
interMem = 0;
error = 0;
/* init the memory operator */
if(pUserData == NULL || pUserData->memflag != VO_IMF_USERMEMOPERATOR || pUserData->memData == NULL )
{
#ifdef USE_DEAULT_MEM
voMemoprator.Alloc = cmnMemAlloc;
voMemoprator.Copy = cmnMemCopy;
voMemoprator.Free = cmnMemFree;
voMemoprator.Set = cmnMemSet;
voMemoprator.Check = cmnMemCheck;
interMem = 1;
pMemOP = &voMemoprator;
#else
*phCodec = NULL;
return VO_ERR_INVALID_ARG;
#endif
}
else
{
pMemOP = (VO_MEM_OPERATOR *)pUserData->memData;
}
/* init the aac encoder handle */
hAacEnc = (AAC_ENCODER*)mem_malloc(pMemOP, sizeof(AAC_ENCODER), 32, VO_INDEX_ENC_AAC);
if(NULL == hAacEnc)
{
error = 1;
}
if(!error)
{
/* init the aac encoder intra memory */
hAacEnc->intbuf = (short *)mem_malloc(pMemOP, AACENC_BLOCKSIZE*MAX_CHANNELS*sizeof(short), 32, VO_INDEX_ENC_AAC);
if(NULL == hAacEnc->intbuf)
{
error = 1;
}
}
if (!error) {
/* init the aac encoder psychoacoustic */
error = (PsyNew(&hAacEnc->psyKernel, MAX_CHANNELS, pMemOP) ||
PsyOutNew(&hAacEnc->psyOut, pMemOP));
}
}
if (!error) {
/* init the aac encoder quantization elements */
error = QCOutNew(&hAacEnc->qcOut,MAX_CHANNELS, pMemOP);
}
}
if (!error) {
/* init the aac encoder quantization state */
error = QCNew(&hAacEnc->qcKernel, pMemOP);
@@ -116,380 +116,380 @@ VO_U32 VO_API voAACEncInit(VO_HANDLE * phCodec,VO_AUDIO_CODINGTYPE vType, VO_COD
}
*phCodec = NULL;
return VO_ERR_OUTOF_MEMORY;
}
/* init the aac encoder memory operator */
#ifdef USE_DEAULT_MEM
if(interMem)
{
hAacEnc->voMemoprator.Alloc = cmnMemAlloc;
hAacEnc->voMemoprator.Copy = cmnMemCopy;
hAacEnc->voMemoprator.Free = cmnMemFree;
hAacEnc->voMemoprator.Set = cmnMemSet;
hAacEnc->voMemoprator.Check = cmnMemCheck;
pMemOP = &hAacEnc->voMemoprator;
}
#endif
/* init the aac encoder default parameter */
if(hAacEnc->initOK == 0)
{
AACENC_CONFIG config;
config.adtsUsed = 1;
config.bitRate = 128000;
config.nChannelsIn = 2;
config.nChannelsOut = 2;
config.sampleRate = 44100;
config.bandWidth = 20000;
AacEncOpen(hAacEnc, config);
}
hAacEnc->voMemop = pMemOP;
*phCodec = hAacEnc;
return VO_ERR_NONE;
}
/**
* Set input audio data.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param pInput [IN] The input buffer param.
* \param pOutBuffer [OUT] The output buffer info.
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncSetInputData(VO_HANDLE hCodec, VO_CODECBUFFER * pInput)
{
AAC_ENCODER *hAacEnc;
int length;
if(NULL == hCodec || NULL == pInput || NULL == pInput->Buffer)
{
return VO_ERR_INVALID_ARG;
}
hAacEnc = (AAC_ENCODER *)hCodec;
/* init input pcm buffer and length*/
hAacEnc->inbuf = (short *)pInput->Buffer;
hAacEnc->inlen = pInput->Length / sizeof(short);
hAacEnc->uselength = 0;
hAacEnc->encbuf = hAacEnc->inbuf;
hAacEnc->enclen = hAacEnc->inlen;
/* rebuild intra pcm buffer and length*/
if(hAacEnc->intlen)
{
length = min(hAacEnc->config.nChannelsIn*AACENC_BLOCKSIZE - hAacEnc->intlen, hAacEnc->inlen);
hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf + hAacEnc->intlen,
hAacEnc->inbuf, length*sizeof(short));
hAacEnc->encbuf = hAacEnc->intbuf;
hAacEnc->enclen = hAacEnc->intlen + length;
hAacEnc->inbuf += length;
hAacEnc->inlen -= length;
}
return VO_ERR_NONE;
}
/**
* Get the outut audio data
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param pOutBuffer [OUT] The output audio data
* \param pOutInfo [OUT] The dec module filled audio format and used the input size.
* pOutInfo->InputUsed is total used the input size.
* \retval VO_ERR_NONE Succeeded.
* VO_ERR_INPUT_BUFFER_SMALL. The input was finished or the input data was not enought.
*/
VO_U32 VO_API voAACEncGetOutputData(VO_HANDLE hCodec, VO_CODECBUFFER * pOutput, VO_AUDIO_OUTPUTINFO * pOutInfo)
{
AAC_ENCODER* hAacEnc = (AAC_ENCODER*)hCodec;
Word16 numAncDataBytes=0;
Word32 inbuflen;
int ret, length;
if(NULL == hAacEnc)
return VO_ERR_INVALID_ARG;
inbuflen = AACENC_BLOCKSIZE*hAacEnc->config.nChannelsIn;
/* check the input pcm buffer and length*/
if(NULL == hAacEnc->encbuf || hAacEnc->enclen < inbuflen)
{
length = hAacEnc->enclen;
if(hAacEnc->intlen == 0)
{
hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf,
hAacEnc->encbuf, length*sizeof(short));
hAacEnc->uselength += length*sizeof(short);
}
else
{
hAacEnc->uselength += (length - hAacEnc->intlen)*sizeof(short);
}
hAacEnc->intlen = length;
pOutput->Length = 0;
if(pOutInfo)
pOutInfo->InputUsed = hAacEnc->uselength;
return VO_ERR_INPUT_BUFFER_SMALL;
}
/* check the output aac buffer and length*/
if(NULL == pOutput || NULL == pOutput->Buffer || pOutput->Length < (6144/8)*hAacEnc->config.nChannelsOut/(sizeof(Word32)))
return VO_ERR_OUTPUT_BUFFER_SMALL;
/* aac encoder core function */
AacEncEncode( hAacEnc,
(Word16*)hAacEnc->encbuf,
NULL,
&numAncDataBytes,
pOutput->Buffer,
&pOutput->Length);
/* update the input pcm buffer and length*/
if(hAacEnc->intlen)
{
length = inbuflen - hAacEnc->intlen;
hAacEnc->encbuf = hAacEnc->inbuf;
hAacEnc->enclen = hAacEnc->inlen;
hAacEnc->uselength += length*sizeof(short);
hAacEnc->intlen = 0;
}
else
{
hAacEnc->encbuf = hAacEnc->encbuf + inbuflen;
hAacEnc->enclen = hAacEnc->enclen - inbuflen;
hAacEnc->uselength += inbuflen*sizeof(short);
}
/* update the output aac information */
if(pOutInfo)
{
pOutInfo->Format.Channels = hAacEnc->config.nChannelsOut;
pOutInfo->Format.SampleRate = hAacEnc->config.sampleRate;
pOutInfo->Format.SampleBits = 16;
pOutInfo->InputUsed = hAacEnc->uselength;
}
return VO_ERR_NONE;
}
/**
* Uninit the Codec.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncUninit(VO_HANDLE hCodec)
{
AAC_ENCODER* hAacEnc = (AAC_ENCODER*)hCodec;
if(NULL != hAacEnc)
{
/* close the aac encoder */
AacEncClose(hAacEnc, hAacEnc->voMemop);
/* free the aac encoder handle*/
mem_free(hAacEnc->voMemop, hAacEnc, VO_INDEX_ENC_AAC);
hAacEnc = NULL;
}
return VO_ERR_NONE;
}
/**
* Set the param for special target.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param uParamID [IN] The param ID.
* \param pData [IN] The param value depend on the ID>
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncSetParam(VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData)
{
AACENC_CONFIG config;
AACENC_PARAM* pAAC_param;
VO_AUDIO_FORMAT *pWAV_Format;
AAC_ENCODER* hAacEnc = (AAC_ENCODER*)hCodec;
int ret, i, bitrate, tmp;
int SampleRateIdx;
if(NULL == hAacEnc)
return VO_ERR_INVALID_ARG;
switch(uParamID)
{
case VO_PID_AAC_ENCPARAM: /* init aac encoder parameter*/
AacInitDefaultConfig(&config);
if(pData == NULL)
return VO_ERR_INVALID_ARG;
pAAC_param = (AACENC_PARAM*)pData;
config.adtsUsed = pAAC_param->adtsUsed;
config.bitRate = pAAC_param->bitRate;
config.nChannelsIn = pAAC_param->nChannels;
config.nChannelsOut = pAAC_param->nChannels;
config.sampleRate = pAAC_param->sampleRate;
/* check the channel */
if(config.nChannelsIn< 1 || config.nChannelsIn > MAX_CHANNELS ||
config.nChannelsOut < 1 || config.nChannelsOut > MAX_CHANNELS || config.nChannelsIn < config.nChannelsOut)
return VO_ERR_AUDIO_UNSCHANNEL;
/* check the samplerate */
ret = -1;
for(i = 0; i < NUM_SAMPLE_RATES; i++)
{
if(config.sampleRate == sampRateTab[i])
{
ret = 0;
break;
}
}
if(ret < 0)
return VO_ERR_AUDIO_UNSSAMPLERATE;
SampleRateIdx = i;
tmp = 441;
if(config.sampleRate%8000 == 0)
tmp =480;
/* check the bitrate */
if(config.bitRate!=0 && (config.bitRate/config.nChannelsOut < 4000) ||
(config.bitRate/config.nChannelsOut > 160000) ||
(config.bitRate > config.sampleRate*6*config.nChannelsOut))
{
config.bitRate = 640*config.sampleRate/tmp*config.nChannelsOut;
if(config.bitRate/config.nChannelsOut < 4000)
config.bitRate = 4000 * config.nChannelsOut;
else if(config.bitRate > config.sampleRate*6*config.nChannelsOut)
config.bitRate = config.sampleRate*6*config.nChannelsOut;
else if(config.bitRate/config.nChannelsOut > 160000)
config.bitRate = config.nChannelsOut*160000;
}
/* check the bandwidth */
bitrate = config.bitRate / config.nChannelsOut;
bitrate = bitrate * tmp / config.sampleRate;
for (i = 0; rates[i]; i++)
{
if (rates[i] >= bitrate)
break;
}
config.bandWidth = BandwithCoefTab[i][SampleRateIdx];
/* init aac encoder core */
ret = AacEncOpen(hAacEnc, config);
if(ret)
return VO_ERR_AUDIO_UNSFEATURE;
break;
case VO_PID_AUDIO_FORMAT: /* init pcm channel and samplerate*/
AacInitDefaultConfig(&config);
if(pData == NULL)
return VO_ERR_INVALID_ARG;
pWAV_Format = (VO_AUDIO_FORMAT*)pData;
config.adtsUsed = 1;
config.nChannelsIn = pWAV_Format->Channels;
config.nChannelsOut = pWAV_Format->Channels;
config.sampleRate = pWAV_Format->SampleRate;
/* check the channel */
if(config.nChannelsIn< 1 || config.nChannelsIn > MAX_CHANNELS ||
config.nChannelsOut < 1 || config.nChannelsOut > MAX_CHANNELS || config.nChannelsIn < config.nChannelsOut)
return VO_ERR_AUDIO_UNSCHANNEL;
/* check the samplebits */
if(pWAV_Format->SampleBits != 16)
{
return VO_ERR_AUDIO_UNSFEATURE;
}
/* check the samplerate */
ret = -1;
for(i = 0; i < NUM_SAMPLE_RATES; i++)
{
if(config.sampleRate == sampRateTab[i])
{
ret = 0;
break;
}
}
if(ret < 0)
return VO_ERR_AUDIO_UNSSAMPLERATE;
SampleRateIdx = i;
/* update the bitrates */
tmp = 441;
if(config.sampleRate%8000 == 0)
tmp =480;
config.bitRate = 640*config.sampleRate/tmp*config.nChannelsOut;
if(config.bitRate/config.nChannelsOut < 4000)
config.bitRate = 4000 * config.nChannelsOut;
else if(config.bitRate > config.sampleRate*6*config.nChannelsOut)
config.bitRate = config.sampleRate*6*config.nChannelsOut;
else if(config.bitRate/config.nChannelsOut > 160000)
config.bitRate = config.nChannelsOut*160000;
/* check the bandwidth */
bitrate = config.bitRate / config.nChannelsOut;
bitrate = bitrate * tmp / config.sampleRate;
for (i = 0; rates[i]; i++)
{
if (rates[i] >= bitrate)
break;
}
config.bandWidth = BandwithCoefTab[i][SampleRateIdx];
/* init aac encoder core */
ret = AacEncOpen(hAacEnc, config);
if(ret)
return VO_ERR_AUDIO_UNSFEATURE;
break;
default:
return VO_ERR_WRONG_PARAM_ID;
}
return VO_ERR_NONE;
}
/**
* Get the param for special target.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param uParamID [IN] The param ID.
* \param pData [IN] The param value depend on the ID>
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncGetParam(VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData)
{
return VO_ERR_NONE;
}
/**
* Get audio codec API interface
* \param pEncHandle [out] Return the AAC Encoder handle.
* \retval VO_ERR_OK Succeeded.
*/
VO_S32 VO_API voGetAACEncAPI(VO_AUDIO_CODECAPI * pDecHandle)
{
if(pDecHandle == NULL)
return VO_ERR_INVALID_ARG;
pDecHandle->Init = voAACEncInit;
pDecHandle->SetInputData = voAACEncSetInputData;
pDecHandle->GetOutputData = voAACEncGetOutputData;
pDecHandle->SetParam = voAACEncSetParam;
pDecHandle->GetParam = voAACEncGetParam;
pDecHandle->Uninit = voAACEncUninit;
return VO_ERR_NONE;
}
/* init the aac encoder memory operator */
#ifdef USE_DEAULT_MEM
if(interMem)
{
hAacEnc->voMemoprator.Alloc = cmnMemAlloc;
hAacEnc->voMemoprator.Copy = cmnMemCopy;
hAacEnc->voMemoprator.Free = cmnMemFree;
hAacEnc->voMemoprator.Set = cmnMemSet;
hAacEnc->voMemoprator.Check = cmnMemCheck;
pMemOP = &hAacEnc->voMemoprator;
}
#endif
/* init the aac encoder default parameter */
if(hAacEnc->initOK == 0)
{
AACENC_CONFIG config;
config.adtsUsed = 1;
config.bitRate = 128000;
config.nChannelsIn = 2;
config.nChannelsOut = 2;
config.sampleRate = 44100;
config.bandWidth = 20000;
AacEncOpen(hAacEnc, config);
}
hAacEnc->voMemop = pMemOP;
*phCodec = hAacEnc;
return VO_ERR_NONE;
}
/**
* Set input audio data.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param pInput [IN] The input buffer param.
* \param pOutBuffer [OUT] The output buffer info.
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncSetInputData(VO_HANDLE hCodec, VO_CODECBUFFER * pInput)
{
AAC_ENCODER *hAacEnc;
int length;
if(NULL == hCodec || NULL == pInput || NULL == pInput->Buffer)
{
return VO_ERR_INVALID_ARG;
}
hAacEnc = (AAC_ENCODER *)hCodec;
/* init input pcm buffer and length*/
hAacEnc->inbuf = (short *)pInput->Buffer;
hAacEnc->inlen = pInput->Length / sizeof(short);
hAacEnc->uselength = 0;
hAacEnc->encbuf = hAacEnc->inbuf;
hAacEnc->enclen = hAacEnc->inlen;
/* rebuild intra pcm buffer and length*/
if(hAacEnc->intlen)
{
length = min(hAacEnc->config.nChannelsIn*AACENC_BLOCKSIZE - hAacEnc->intlen, hAacEnc->inlen);
hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf + hAacEnc->intlen,
hAacEnc->inbuf, length*sizeof(short));
hAacEnc->encbuf = hAacEnc->intbuf;
hAacEnc->enclen = hAacEnc->intlen + length;
hAacEnc->inbuf += length;
hAacEnc->inlen -= length;
}
return VO_ERR_NONE;
}
/**
* Get the outut audio data
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param pOutBuffer [OUT] The output audio data
* \param pOutInfo [OUT] The dec module filled audio format and used the input size.
* pOutInfo->InputUsed is total used the input size.
* \retval VO_ERR_NONE Succeeded.
* VO_ERR_INPUT_BUFFER_SMALL. The input was finished or the input data was not enought.
*/
VO_U32 VO_API voAACEncGetOutputData(VO_HANDLE hCodec, VO_CODECBUFFER * pOutput, VO_AUDIO_OUTPUTINFO * pOutInfo)
{
AAC_ENCODER* hAacEnc = (AAC_ENCODER*)hCodec;
Word16 numAncDataBytes=0;
Word32 inbuflen;
int ret, length;
if(NULL == hAacEnc)
return VO_ERR_INVALID_ARG;
inbuflen = AACENC_BLOCKSIZE*hAacEnc->config.nChannelsIn;
/* check the input pcm buffer and length*/
if(NULL == hAacEnc->encbuf || hAacEnc->enclen < inbuflen)
{
length = hAacEnc->enclen;
if(hAacEnc->intlen == 0)
{
hAacEnc->voMemop->Copy(VO_INDEX_ENC_AAC, hAacEnc->intbuf,
hAacEnc->encbuf, length*sizeof(short));
hAacEnc->uselength += length*sizeof(short);
}
else
{
hAacEnc->uselength += (length - hAacEnc->intlen)*sizeof(short);
}
hAacEnc->intlen = length;
pOutput->Length = 0;
if(pOutInfo)
pOutInfo->InputUsed = hAacEnc->uselength;
return VO_ERR_INPUT_BUFFER_SMALL;
}
/* check the output aac buffer and length*/
if(NULL == pOutput || NULL == pOutput->Buffer || pOutput->Length < (6144/8)*hAacEnc->config.nChannelsOut/(sizeof(Word32)))
return VO_ERR_OUTPUT_BUFFER_SMALL;
/* aac encoder core function */
AacEncEncode( hAacEnc,
(Word16*)hAacEnc->encbuf,
NULL,
&numAncDataBytes,
pOutput->Buffer,
&pOutput->Length);
/* update the input pcm buffer and length*/
if(hAacEnc->intlen)
{
length = inbuflen - hAacEnc->intlen;
hAacEnc->encbuf = hAacEnc->inbuf;
hAacEnc->enclen = hAacEnc->inlen;
hAacEnc->uselength += length*sizeof(short);
hAacEnc->intlen = 0;
}
else
{
hAacEnc->encbuf = hAacEnc->encbuf + inbuflen;
hAacEnc->enclen = hAacEnc->enclen - inbuflen;
hAacEnc->uselength += inbuflen*sizeof(short);
}
/* update the output aac information */
if(pOutInfo)
{
pOutInfo->Format.Channels = hAacEnc->config.nChannelsOut;
pOutInfo->Format.SampleRate = hAacEnc->config.sampleRate;
pOutInfo->Format.SampleBits = 16;
pOutInfo->InputUsed = hAacEnc->uselength;
}
return VO_ERR_NONE;
}
/**
* Uninit the Codec.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncUninit(VO_HANDLE hCodec)
{
AAC_ENCODER* hAacEnc = (AAC_ENCODER*)hCodec;
if(NULL != hAacEnc)
{
/* close the aac encoder */
AacEncClose(hAacEnc, hAacEnc->voMemop);
/* free the aac encoder handle*/
mem_free(hAacEnc->voMemop, hAacEnc, VO_INDEX_ENC_AAC);
hAacEnc = NULL;
}
return VO_ERR_NONE;
}
/**
* Set the param for special target.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param uParamID [IN] The param ID.
* \param pData [IN] The param value depend on the ID>
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncSetParam(VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData)
{
AACENC_CONFIG config;
AACENC_PARAM* pAAC_param;
VO_AUDIO_FORMAT *pWAV_Format;
AAC_ENCODER* hAacEnc = (AAC_ENCODER*)hCodec;
int ret, i, bitrate, tmp;
int SampleRateIdx;
if(NULL == hAacEnc)
return VO_ERR_INVALID_ARG;
switch(uParamID)
{
case VO_PID_AAC_ENCPARAM: /* init aac encoder parameter*/
AacInitDefaultConfig(&config);
if(pData == NULL)
return VO_ERR_INVALID_ARG;
pAAC_param = (AACENC_PARAM*)pData;
config.adtsUsed = pAAC_param->adtsUsed;
config.bitRate = pAAC_param->bitRate;
config.nChannelsIn = pAAC_param->nChannels;
config.nChannelsOut = pAAC_param->nChannels;
config.sampleRate = pAAC_param->sampleRate;
/* check the channel */
if(config.nChannelsIn< 1 || config.nChannelsIn > MAX_CHANNELS ||
config.nChannelsOut < 1 || config.nChannelsOut > MAX_CHANNELS || config.nChannelsIn < config.nChannelsOut)
return VO_ERR_AUDIO_UNSCHANNEL;
/* check the samplerate */
ret = -1;
for(i = 0; i < NUM_SAMPLE_RATES; i++)
{
if(config.sampleRate == sampRateTab[i])
{
ret = 0;
break;
}
}
if(ret < 0)
return VO_ERR_AUDIO_UNSSAMPLERATE;
SampleRateIdx = i;
tmp = 441;
if(config.sampleRate%8000 == 0)
tmp =480;
/* check the bitrate */
if(config.bitRate!=0 && (config.bitRate/config.nChannelsOut < 4000) ||
(config.bitRate/config.nChannelsOut > 160000) ||
(config.bitRate > config.sampleRate*6*config.nChannelsOut))
{
config.bitRate = 640*config.sampleRate/tmp*config.nChannelsOut;
if(config.bitRate/config.nChannelsOut < 4000)
config.bitRate = 4000 * config.nChannelsOut;
else if(config.bitRate > config.sampleRate*6*config.nChannelsOut)
config.bitRate = config.sampleRate*6*config.nChannelsOut;
else if(config.bitRate/config.nChannelsOut > 160000)
config.bitRate = config.nChannelsOut*160000;
}
/* check the bandwidth */
bitrate = config.bitRate / config.nChannelsOut;
bitrate = bitrate * tmp / config.sampleRate;
for (i = 0; rates[i]; i++)
{
if (rates[i] >= bitrate)
break;
}
config.bandWidth = BandwithCoefTab[i][SampleRateIdx];
/* init aac encoder core */
ret = AacEncOpen(hAacEnc, config);
if(ret)
return VO_ERR_AUDIO_UNSFEATURE;
break;
case VO_PID_AUDIO_FORMAT: /* init pcm channel and samplerate*/
AacInitDefaultConfig(&config);
if(pData == NULL)
return VO_ERR_INVALID_ARG;
pWAV_Format = (VO_AUDIO_FORMAT*)pData;
config.adtsUsed = 1;
config.nChannelsIn = pWAV_Format->Channels;
config.nChannelsOut = pWAV_Format->Channels;
config.sampleRate = pWAV_Format->SampleRate;
/* check the channel */
if(config.nChannelsIn< 1 || config.nChannelsIn > MAX_CHANNELS ||
config.nChannelsOut < 1 || config.nChannelsOut > MAX_CHANNELS || config.nChannelsIn < config.nChannelsOut)
return VO_ERR_AUDIO_UNSCHANNEL;
/* check the samplebits */
if(pWAV_Format->SampleBits != 16)
{
return VO_ERR_AUDIO_UNSFEATURE;
}
/* check the samplerate */
ret = -1;
for(i = 0; i < NUM_SAMPLE_RATES; i++)
{
if(config.sampleRate == sampRateTab[i])
{
ret = 0;
break;
}
}
if(ret < 0)
return VO_ERR_AUDIO_UNSSAMPLERATE;
SampleRateIdx = i;
/* update the bitrates */
tmp = 441;
if(config.sampleRate%8000 == 0)
tmp =480;
config.bitRate = 640*config.sampleRate/tmp*config.nChannelsOut;
if(config.bitRate/config.nChannelsOut < 4000)
config.bitRate = 4000 * config.nChannelsOut;
else if(config.bitRate > config.sampleRate*6*config.nChannelsOut)
config.bitRate = config.sampleRate*6*config.nChannelsOut;
else if(config.bitRate/config.nChannelsOut > 160000)
config.bitRate = config.nChannelsOut*160000;
/* check the bandwidth */
bitrate = config.bitRate / config.nChannelsOut;
bitrate = bitrate * tmp / config.sampleRate;
for (i = 0; rates[i]; i++)
{
if (rates[i] >= bitrate)
break;
}
config.bandWidth = BandwithCoefTab[i][SampleRateIdx];
/* init aac encoder core */
ret = AacEncOpen(hAacEnc, config);
if(ret)
return VO_ERR_AUDIO_UNSFEATURE;
break;
default:
return VO_ERR_WRONG_PARAM_ID;
}
return VO_ERR_NONE;
}
/**
* Get the param for special target.
* \param hCodec [IN]] The Codec Handle which was created by Init function.
* \param uParamID [IN] The param ID.
* \param pData [IN] The param value depend on the ID>
* \retval VO_ERR_NONE Succeeded.
*/
VO_U32 VO_API voAACEncGetParam(VO_HANDLE hCodec, VO_S32 uParamID, VO_PTR pData)
{
return VO_ERR_NONE;
}
/**
* Get audio codec API interface
* \param pEncHandle [out] Return the AAC Encoder handle.
* \retval VO_ERR_OK Succeeded.
*/
VO_S32 VO_API voGetAACEncAPI(VO_AUDIO_CODECAPI * pDecHandle)
{
if(pDecHandle == NULL)
return VO_ERR_INVALID_ARG;
pDecHandle->Init = voAACEncInit;
pDecHandle->SetInputData = voAACEncSetInputData;
pDecHandle->GetOutputData = voAACEncGetOutputData;
pDecHandle->SetParam = voAACEncSetParam;
pDecHandle->GetParam = voAACEncGetParam;
pDecHandle->Uninit = voAACEncUninit;
return VO_ERR_NONE;
}

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aacenc_core.c
Content: aac encoder core functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: aacenc_core.c
Content: aac encoder core functions
*******************************************************************************/
#include "typedef.h"
@@ -58,9 +58,9 @@ Word16 AacEncOpen( AAC_ENCODER* hAacEnc, /* pointer to an encoder
const AACENC_CONFIG config /* pre-initialized config struct */
)
{
Word32 i;
Word32 i;
Word32 error = 0;
Word16 profile = 1;
Word16 profile = 1;
ELEMENT_INFO *elInfo = NULL;
@@ -76,7 +76,7 @@ Word16 AacEncOpen( AAC_ENCODER* hAacEnc, /* pointer to an encoder
error = InitElementInfo (config.nChannelsOut,
&hAacEnc->elInfo);
}
if (!error) {
elInfo = &hAacEnc->elInfo;
}
@@ -95,8 +95,8 @@ Word16 AacEncOpen( AAC_ENCODER* hAacEnc, /* pointer to an encoder
}
/* use or not adts header */
if(!error) {
hAacEnc->qcOut.qcElement.adtsUsed = config.adtsUsed;
if(!error) {
hAacEnc->qcOut.qcElement.adtsUsed = config.adtsUsed;
}
/* init encoder quantization */
@@ -198,14 +198,14 @@ Word16 AacEncEncode(AAC_ENCODER *aacEnc, /*!< an encoder handle */
&aacEnc->qcOut,
&aacEnc->psyOut,
&globUsedBits,
ancBytes,
ancBytes,
aacEnc->psyKernel.sampleRateIdx);
updateBitres(&aacEnc->qcKernel,
&aacEnc->qcOut);
/* write out the bitstream */
*numOutBytes = GetBitsAvail(aacEnc->hBitStream) >> 3;
*numOutBytes = GetBitsAvail(aacEnc->hBitStream) >> 3;
return 0;
}

View File

@@ -1,26 +1,26 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: adj_thr.c
Content: Threshold compensation functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: adj_thr.c
Content: Threshold compensation functions
*******************************************************************************/
#include "basic_op.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "adj_thr_data.h"
#include "adj_thr.h"
@@ -29,14 +29,14 @@
#define minSnrLimit 0x6666 /* 1 dB */
#define PEBITS_COEF 0x170a /* 0.18*(1 << 15)*/
#define HOLE_THR_LONG 0x2873 /* 0.316*(1 << 15) */
#define HOLE_THR_SHORT 0x4000 /* 0.5 *(1 << 15) */
#define MS_THRSPREAD_COEF 0x7333 /* 0.9 * (1 << 15) */
#define MIN_SNR_COEF 0x651f /* 3.16* (1 << (15 - 2)) */
#define PEBITS_COEF 0x170a /* 0.18*(1 << 15)*/
#define HOLE_THR_LONG 0x2873 /* 0.316*(1 << 15) */
#define HOLE_THR_SHORT 0x4000 /* 0.5 *(1 << 15) */
#define MS_THRSPREAD_COEF 0x7333 /* 0.9 * (1 << 15) */
#define MIN_SNR_COEF 0x651f /* 3.16* (1 << (15 - 2)) */
/* values for avoid hole flag */
enum _avoid_hole_state {
@@ -67,15 +67,15 @@ static void calcThreshExp(Word32 thrExp[MAX_CHANNELS][MAX_GROUPED_SFB],
PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
const Word16 nChannels)
{
Word16 ch, sfb, sfbGrp;
Word16 ch, sfb, sfbGrp;
Word32 *pthrExp, *psfbThre;
for (ch=0; ch<nChannels; ch++) {
PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
for(sfbGrp = 0; sfbGrp < psyOutChan->sfbCnt; sfbGrp+= psyOutChan->sfbPerGroup)
pthrExp = &(thrExp[ch][sfbGrp]);
psfbThre = psyOutChan->sfbThreshold + sfbGrp;
PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
for(sfbGrp = 0; sfbGrp < psyOutChan->sfbCnt; sfbGrp+= psyOutChan->sfbPerGroup)
pthrExp = &(thrExp[ch][sfbGrp]);
psfbThre = psyOutChan->sfbThreshold + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
*pthrExp = rsqrt(rsqrt(*psfbThre,INT_BITS),INT_BITS);
*pthrExp = rsqrt(rsqrt(*psfbThre,INT_BITS),INT_BITS);
pthrExp++; psfbThre++;
}
}
@@ -112,7 +112,7 @@ static void adaptMinSnr(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
}
if (nSfb > 0) {
avgEn = avgEn / nSfb;
avgEn = avgEn / nSfb;
log_avgEn = iLog4(avgEn);
startRatio_x_avgEn = fixmul(msaParam->startRatio, avgEn);
@@ -172,18 +172,18 @@ static void initAvoidHoleFlag(Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
if (psyOutChan->windowSequence != SHORT_WINDOW) {
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
psfbSpreadEn = psyOutChan->sfbSpreadedEnergy + sfbGrp;
psfbSpreadEn = psyOutChan->sfbSpreadedEnergy + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
*psfbSpreadEn = *psfbSpreadEn >> 1; /* 0.5 */
*psfbSpreadEn = *psfbSpreadEn >> 1; /* 0.5 */
++psfbSpreadEn;
}
}
}
else {
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
psfbSpreadEn = psyOutChan->sfbSpreadedEnergy + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
*psfbSpreadEn = (*psfbSpreadEn >> 1) + (*psfbSpreadEn >> 3); /* 0.63 */
*psfbSpreadEn = (*psfbSpreadEn >> 1) + (*psfbSpreadEn >> 3); /* 0.63 */
++psfbSpreadEn;
}
}
@@ -201,7 +201,7 @@ static void initAvoidHoleFlag(Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
threshold = HOLE_THR_SHORT;
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
Word16 *psfbMinSnr = psyOutChan->sfbMinSnr + sfbGrp;
Word16 *psfbMinSnr = psyOutChan->sfbMinSnr + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
Word32 sfbEn, sfbEnm1, sfbEnp1, avgEn;
@@ -219,7 +219,7 @@ static void initAvoidHoleFlag(Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
if (sfbEn > avgEn && avgEn > 0) {
Word32 tmpMinSnr;
shift = norm_l(sfbEn);
shift = norm_l(sfbEn);
tmpMinSnr = Div_32(L_mpy_ls(avgEn, minSnrLimit) << shift, sfbEn << shift );
tmpMinSnr = max(tmpMinSnr, HOLE_THR_LONG);
tmpMinSnr = max(tmpMinSnr, threshold);
@@ -231,7 +231,7 @@ static void initAvoidHoleFlag(Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
Word32 tmpMinSnr;
Word32 minSnrEn = L_mpy_wx(avgEn, *psfbMinSnr);
if(minSnrEn < sfbEn) {
if(minSnrEn < sfbEn) {
shift = norm_l(sfbEn);
tmpMinSnr = Div_32( minSnrEn << shift, sfbEn<<shift);
}
@@ -242,7 +242,7 @@ static void initAvoidHoleFlag(Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
*psfbMinSnr =
(min((tmpMinSnr >> 2), mult(*psfbMinSnr, MIN_SNR_COEF)) << 2);
}
}
psfbMinSnr++;
}
}
@@ -266,17 +266,17 @@ static void initAvoidHoleFlag(Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
psyOutChanM->sfbMinSnr[sfb] = MAX_16;
}
else {
shift = norm_l(sfbEnM);
psyOutChanM->sfbMinSnr[sfb] = min(max(psyOutChanM->sfbMinSnr[sfb],
shift = norm_l(sfbEnM);
psyOutChanM->sfbMinSnr[sfb] = min(max(psyOutChanM->sfbMinSnr[sfb],
round16(Div_32(maxThr<<shift, sfbEnM << shift))), minSnrLimit);
}
if(maxThr >= sfbEnS) {
psyOutChanS->sfbMinSnr[sfb] = MAX_16;
}
else {
else {
shift = norm_l(sfbEnS);
psyOutChanS->sfbMinSnr[sfb] = min(max(psyOutChanS->sfbMinSnr[sfb],
psyOutChanS->sfbMinSnr[sfb] = min(max(psyOutChanS->sfbMinSnr[sfb],
round16(Div_32(maxThr << shift, sfbEnS << shift))), minSnrLimit);
}
@@ -295,7 +295,7 @@ static void initAvoidHoleFlag(Word16 ahFlag[MAX_CHANNELS][MAX_GROUPED_SFB],
for(ch=0; ch<nChannels; ch++) {
PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
Word16 *pahFlag = ahFlag[ch] + sfbGrp;
Word16 *pahFlag = ahFlag[ch] + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
if ((psyOutChan->sfbSpreadedEnergy[sfbGrp+sfb] > psyOutChan->sfbEnergy[sfbGrp+sfb]) ||
@@ -328,7 +328,7 @@ static void calcPeNoAH(Word16 *pe,
PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
const Word16 nChannels)
{
Word16 ch, sfb, sfbGrp;
Word16 ch, sfb, sfbGrp;
int ipe, iconstPart, inActiveLines;
ipe = 0;
@@ -347,7 +347,7 @@ static void calcPeNoAH(Word16 *pe,
}
}
}
}
}
*pe = saturate(ipe);
*constPart = saturate(iconstPart);
@@ -367,14 +367,14 @@ static void reduceThresholds(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
const Word32 redVal)
{
Word32 sfbThrReduced;
Word32 *psfbEn, *psfbThr;
Word16 ch, sfb, sfbGrp;
Word32 *psfbEn, *psfbThr;
Word16 ch, sfb, sfbGrp;
for(ch=0; ch<nChannels; ch++) {
PSY_OUT_CHANNEL *psyOutChan = &psyOutChannel[ch];
for(sfbGrp=0; sfbGrp<psyOutChan->sfbCnt; sfbGrp+=psyOutChan->sfbPerGroup) {
psfbEn = psyOutChan->sfbEnergy + sfbGrp;
psfbThr = psyOutChan->sfbThreshold + sfbGrp;
psfbEn = psyOutChan->sfbEnergy + sfbGrp;
psfbThr = psyOutChan->sfbThreshold + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
if (*psfbEn > *psfbThr) {
@@ -391,8 +391,8 @@ static void reduceThresholds(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
ahFlag[ch][sfbGrp+sfb] = AH_ACTIVE;
}
*psfbThr = sfbThrReduced;
}
}
psfbEn++; psfbThr++;
}
}
@@ -419,8 +419,8 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
PSY_OUT_CHANNEL *psyOutChan;
PE_CHANNEL_DATA *peChanData;
Word32 deltaSfbPe;
Word32 normFactor;
Word32 *psfbPeFactors;
Word32 normFactor;
Word32 *psfbPeFactors;
Word16 *psfbNActiveLines, *pahFlag;
Word32 sfbEn, sfbThr;
Word32 sfbThrReduced;
@@ -431,9 +431,9 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
psyOutChan = &psyOutChannel[ch];
peChanData = &peData->peChannelData[ch];
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
psfbPeFactors = peData->sfbPeFactors[ch] + sfbGrp;
psfbNActiveLines = peChanData->sfbNActiveLines + sfbGrp;
pahFlag = ahFlag[ch] + sfbGrp;
psfbPeFactors = peData->sfbPeFactors[ch] + sfbGrp;
psfbNActiveLines = peChanData->sfbNActiveLines + sfbGrp;
pahFlag = ahFlag[ch] + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
Word32 redThrExp = thrExp[ch][sfbGrp+sfb] + redVal;
@@ -444,8 +444,8 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
}
else {
*psfbPeFactors = 0;
}
psfbPeFactors++;
}
psfbPeFactors++;
pahFlag++; psfbNActiveLines++;
}
}
@@ -457,9 +457,9 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
psyOutChan = &psyOutChannel[ch];
peChanData = &peData->peChannelData[ch];
for(sfbGrp = 0;sfbGrp < psyOutChan->sfbCnt;sfbGrp+= psyOutChan->sfbPerGroup){
psfbPeFactors = peData->sfbPeFactors[ch] + sfbGrp;
psfbNActiveLines = peChanData->sfbNActiveLines + sfbGrp;
pahFlag = ahFlag[ch] + sfbGrp;
psfbPeFactors = peData->sfbPeFactors[ch] + sfbGrp;
psfbNActiveLines = peChanData->sfbNActiveLines + sfbGrp;
pahFlag = ahFlag[ch] + sfbGrp;
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
/* pe difference for this sfb */
deltaSfbPe = *psfbPeFactors * deltaPe;
@@ -487,7 +487,7 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
if(thrFactor > sfbThr) {
shift = norm_l(thrFactor);
shift = norm_l(thrFactor);
sfbThrReduced = Div_32( sfbThr << shift, thrFactor<<shift );
}
else {
@@ -506,8 +506,8 @@ static void correctThresh(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
}
psyOutChan->sfbThreshold[sfbGrp+sfb] = sfbThrReduced;
}
}
pahFlag++; psfbNActiveLines++; psfbPeFactors++;
}
}
@@ -539,8 +539,8 @@ static void reduceMinSnr(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
for (sfb=sfbSubWin; sfb<psyOutChannel[0].sfbCnt;
sfb+=psyOutChannel[0].sfbPerGroup) {
/* loop over all channels */
PE_CHANNEL_DATA* peChan = peData->peChannelData;
PSY_OUT_CHANNEL* psyOutCh = psyOutChannel;
PE_CHANNEL_DATA* peChan = peData->peChannelData;
PSY_OUT_CHANNEL* psyOutCh = psyOutChannel;
for (ch=0; ch<nChannels; ch++) {
if (ahFlag[ch][sfb] != NO_AH &&
psyOutCh->sfbMinSnr[sfb] < minSnrLimit) {
@@ -553,7 +553,7 @@ static void reduceMinSnr(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
peChan->sfbPe[sfb];
peData->pe = peData->pe + deltaPe;
peChan->pe = peChan->pe + deltaPe;
}
}
peChan += 1; psyOutCh += 1;
}
/* stop if enough has been saved */
@@ -659,7 +659,7 @@ static void allowMoreHoles(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
if(ahCnt) {
Word32 iahCnt;
shift = norm_l(ahCnt);
shift = norm_l(ahCnt);
iahCnt = Div_32( 1 << shift, ahCnt << shift );
avgEn = fixmul(avgEn, iahCnt);
}
@@ -831,7 +831,7 @@ static Word16 calcBitSave(Word16 fillLevel,
fillLevel = max(fillLevel, clipLow);
fillLevel = min(fillLevel, clipHigh);
if(clipHigh-clipLow)
if(clipHigh-clipLow)
bitsave = (maxBitSave - (((maxBitSave-minBitSave)*(fillLevel-clipLow))/
(clipHigh-clipLow)));
@@ -860,7 +860,7 @@ static Word16 calcBitSpend(Word16 fillLevel,
fillLevel = max(fillLevel, clipLow);
fillLevel = min(fillLevel, clipHigh);
if(clipHigh-clipLow)
if(clipHigh-clipLow)
bitspend = (minBitSpend + ((maxBitSpend - minBitSpend)*(fillLevel - clipLow) /
(clipHigh-clipLow)));
@@ -964,7 +964,7 @@ static Word16 bitresCalcBitFac( const Word16 bitresBits,
bresParam->clipSpendLow, bresParam->clipSpendHigh,
bresParam->minBitSpend, bresParam->maxBitSpend);
if(adjThrChan->peMax != adjThrChan->peMin)
if(adjThrChan->peMax != adjThrChan->peMin)
bitresFac = (100 - bitSave) + extract_l(((bitSpend + bitSave) * (pex - adjThrChan->peMin)) /
(adjThrChan->peMax - adjThrChan->peMin));
else
@@ -1196,7 +1196,7 @@ void AdjustThresholds(ADJ_THR_STATE *adjThrState,
if (peOffsDiff > 0) {
Word32 temp = 1000 - (nChannels * 200);
chBitDistribution[ch] = chBitDistribution[ch] +
chBitDistribution[ch] = chBitDistribution[ch] +
(temp * peData.peChannelData[ch].pe) / peOffsDiff;
}
}

View File

@@ -1,167 +1,167 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: AutoCorrelation_v5.s
@
@ Content: AutoCorrelation function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global AutoCorrelation
AutoCorrelation:
stmdb sp!, {r4 - r11, lr}
sub r13, r13, #20
mov r5, r0
mov r7, r1
mov r9, r3
mov r2, r2, lsl #16
mov r0, #0
mov r4, r2, asr #16
mov r8, #0
cmp r4, #0
ble L136
cmp r4, #8
mov r2, #0
blt L133
sub r12, r4, #8
L132:
ldr r6, [r5, r2]
add r2, r2, #4
smulbb r3, r6, r6
ldr r1, [r5, r2]
smultt r10, r6, r6
mov r3, r3, asr #9
smulbb r6, r1, r1
mov r10, r10, asr #9
qadd r0, r0, r3
smultt r11, r1, r1
add r2, r2, #4
qadd r0, r0, r10
mov r6, r6, asr #9
mov r11, r11, asr #9
ldr r1, [r5, r2]
qadd r0, r0, r6
smulbb r10, r1, r1
smultt r6, r1, r1
qadd r0, r0, r11
mov r10, r10, asr #9
mov r6, r6, asr #9
qadd r0, r0, r10
add r2, r2, #4
add r8, r8, #6
qadd r0, r0, r6
cmp r8, r12
blt L132
L133:
ldrsh r6, [r5, r2]
mul r10, r6, r6
add r2, r2, #2
mov r1, r10, asr #9
qadd r0, r0, r1
L134:
add r8, r8, #1
cmp r8, r4
blt L133
L135:
L136:
str r0, [r7, #0]
cmp r0, #0
beq L1320
L137:
mov r2, r9, lsl #16
mov r8, #1
mov r2, r2, asr #16
cmp r2, #1
ble L1319
L138:
L139:
sub r4, r4, #1
mov r14, #0
mov r3, #0
cmp r4, #0
ble L1317
L1310:
cmp r4, #6
addlt r6, r5, r8, lsl #1
blt L1314
L1311:
add r6, r5, r8, lsl #1
sub r12, r4, #6
str r8, [r13, #8]
str r7, [r13, #4]
L1312:
mov r1, r3, lsl #1
ldrsh r7, [r6, r1]
ldrsh r10, [r5, r1]
add r8, r1, r6
add r9, r5, r1
mul r7, r10, r7
ldrsh r1, [r8, #2]
ldrsh r10, [r8, #4]
add r7, r14, r7, asr #9
ldrsh r0, [r9, #2]
ldrsh r11, [r9, #4]
mul r1, r0, r1
ldrsh r14, [r8, #6]
mul r10, r11, r10
add r7, r7, r1, asr #9
ldrsh r8, [r8, #8]
add r3, r3, #5
ldrsh r11, [r9, #6]
ldrsh r1, [r9, #8]
mul r14, r11, r14
add r7, r7, r10, asr #9
mul r1, r1, r8
add r14, r7, r14, asr #9
cmp r3, r12
add r14, r14, r1, asr #9
ble L1312
L1313:
ldr r8, [r13, #8]
ldr r7, [r13, #4]
L1314:
L1315:
mov r12, r3, lsl #1
ldrsh r9, [r6, r12]
ldrsh r12, [r5, r12]
add r3, r3, #1
cmp r3, r4
mul r12, r12, r9
add r14, r14, r12, asr #9
blt L1315
L1316:
L1317:
str r14, [r7, +r8, lsl #2]
add r8, r8, #1
cmp r8, r2
blt L139
L1319:
L1320:
add r13, r13, #20
ldmia sp!, {r4 - r11, pc}
@ENDP @ |AutoCorrelation|
.end
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: AutoCorrelation_v5.s
@
@ Content: AutoCorrelation function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global AutoCorrelation
AutoCorrelation:
stmdb sp!, {r4 - r11, lr}
sub r13, r13, #20
mov r5, r0
mov r7, r1
mov r9, r3
mov r2, r2, lsl #16
mov r0, #0
mov r4, r2, asr #16
mov r8, #0
cmp r4, #0
ble L136
cmp r4, #8
mov r2, #0
blt L133
sub r12, r4, #8
L132:
ldr r6, [r5, r2]
add r2, r2, #4
smulbb r3, r6, r6
ldr r1, [r5, r2]
smultt r10, r6, r6
mov r3, r3, asr #9
smulbb r6, r1, r1
mov r10, r10, asr #9
qadd r0, r0, r3
smultt r11, r1, r1
add r2, r2, #4
qadd r0, r0, r10
mov r6, r6, asr #9
mov r11, r11, asr #9
ldr r1, [r5, r2]
qadd r0, r0, r6
smulbb r10, r1, r1
smultt r6, r1, r1
qadd r0, r0, r11
mov r10, r10, asr #9
mov r6, r6, asr #9
qadd r0, r0, r10
add r2, r2, #4
add r8, r8, #6
qadd r0, r0, r6
cmp r8, r12
blt L132
L133:
ldrsh r6, [r5, r2]
mul r10, r6, r6
add r2, r2, #2
mov r1, r10, asr #9
qadd r0, r0, r1
L134:
add r8, r8, #1
cmp r8, r4
blt L133
L135:
L136:
str r0, [r7, #0]
cmp r0, #0
beq L1320
L137:
mov r2, r9, lsl #16
mov r8, #1
mov r2, r2, asr #16
cmp r2, #1
ble L1319
L138:
L139:
sub r4, r4, #1
mov r14, #0
mov r3, #0
cmp r4, #0
ble L1317
L1310:
cmp r4, #6
addlt r6, r5, r8, lsl #1
blt L1314
L1311:
add r6, r5, r8, lsl #1
sub r12, r4, #6
str r8, [r13, #8]
str r7, [r13, #4]
L1312:
mov r1, r3, lsl #1
ldrsh r7, [r6, r1]
ldrsh r10, [r5, r1]
add r8, r1, r6
add r9, r5, r1
mul r7, r10, r7
ldrsh r1, [r8, #2]
ldrsh r10, [r8, #4]
add r7, r14, r7, asr #9
ldrsh r0, [r9, #2]
ldrsh r11, [r9, #4]
mul r1, r0, r1
ldrsh r14, [r8, #6]
mul r10, r11, r10
add r7, r7, r1, asr #9
ldrsh r8, [r8, #8]
add r3, r3, #5
ldrsh r11, [r9, #6]
ldrsh r1, [r9, #8]
mul r14, r11, r14
add r7, r7, r10, asr #9
mul r1, r1, r8
add r14, r7, r14, asr #9
cmp r3, r12
add r14, r14, r1, asr #9
ble L1312
L1313:
ldr r8, [r13, #8]
ldr r7, [r13, #4]
L1314:
L1315:
mov r12, r3, lsl #1
ldrsh r9, [r6, r12]
ldrsh r12, [r5, r12]
add r3, r3, #1
cmp r3, r4
mul r12, r12, r9
add r14, r14, r12, asr #9
blt L1315
L1316:
L1317:
str r14, [r7, +r8, lsl #2]
add r8, r8, #1
cmp r8, r2
blt L139
L1319:
L1320:
add r13, r13, #20
ldmia sp!, {r4 - r11, pc}
@ENDP @ |AutoCorrelation|
.end

View File

@@ -1,112 +1,112 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: CalcWindowEnergy_v5.s
@
@ Content: CalcWindowEnergy function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global CalcWindowEnergy
CalcWindowEnergy:
stmdb sp!, {r4 - r11, lr}
sub r13, r13, #20
mov r3, r3, lsl #16
ldr r10, [r0, #168] @ states0 = blockSwitchingControl->iirStates[0];
mov r3, r3, asr #16
ldr r11, [r0, #172] @ states1 = blockSwitchingControl->iirStates[1];
mov r2, r2, lsl #16
ldr r12, hiPassCoeff @ Coeff0 = hiPassCoeff[0];
mov r2, r2, asr #16
ldr r14, hiPassCoeff + 4 @ Coeff1 = hiPassCoeff[1];
mov r8, #0 @ w=0
mov r5, #0 @ wOffset = 0;
BLOCK_BEGIN:
mov r6, #0 @ accuUE = 0;
mov r7, #0 @ accuFE = 0;
mov r4, #0 @ i=0
str r8, [r13, #4]
str r0, [r13, #8]
str r3, [r13, #12]
ENERGY_BEG:
mov r9, r5, lsl #1
ldrsh r9, [r1, r9] @ tempUnfiltered = timeSignal[tidx];
add r5, r5, r2 @ tidx = tidx + chIncrement;
smulwb r3, r14, r9 @ accu1 = L_mpy_ls(Coeff1, tempUnfiltered);
smull r0, r8, r12, r11 @ accu2 = fixmul( Coeff0, states1 );
mov r3, r3, lsl #1
mov r8, r8, lsl #1
sub r0, r3, r10 @ accu3 = accu1 - states0;
sub r8, r0, r8 @ out = accu3 - accu2;
mov r10, r3 @ states0 = accu1;
mov r11, r8 @ states1 = out;
mul r3, r9, r9
mov r8, r8, asr #16
add r4, r4, #1
add r6, r6, r3, asr #7
mul r9, r8, r8
ldr r3, [r13, #12]
add r7, r7, r9, asr #7
cmp r4, r3
blt ENERGY_BEG
ldr r0, [r13, #8]
ldr r8, [r13, #4]
ENERGY_END:
add r4, r0, r8, lsl #2
str r6, [r4, #72]
add r8, r8, #1
str r7, [r4, #136]
cmp r8, #8
blt BLOCK_BEGIN
BLOCK_END:
str r10, [r0, #168]
str r11, [r0, #172]
mov r0, #1
add r13, r13, #20
ldmia sp!, {r4 - r11, pc}
hiPassCoeff:
.word 0xbec8b439
.word 0x609d4952
@ENDP
.end
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: CalcWindowEnergy_v5.s
@
@ Content: CalcWindowEnergy function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global CalcWindowEnergy
CalcWindowEnergy:
stmdb sp!, {r4 - r11, lr}
sub r13, r13, #20
mov r3, r3, lsl #16
ldr r10, [r0, #168] @ states0 = blockSwitchingControl->iirStates[0];
mov r3, r3, asr #16
ldr r11, [r0, #172] @ states1 = blockSwitchingControl->iirStates[1];
mov r2, r2, lsl #16
ldr r12, hiPassCoeff @ Coeff0 = hiPassCoeff[0];
mov r2, r2, asr #16
ldr r14, hiPassCoeff + 4 @ Coeff1 = hiPassCoeff[1];
mov r8, #0 @ w=0
mov r5, #0 @ wOffset = 0;
BLOCK_BEGIN:
mov r6, #0 @ accuUE = 0;
mov r7, #0 @ accuFE = 0;
mov r4, #0 @ i=0
str r8, [r13, #4]
str r0, [r13, #8]
str r3, [r13, #12]
ENERGY_BEG:
mov r9, r5, lsl #1
ldrsh r9, [r1, r9] @ tempUnfiltered = timeSignal[tidx];
add r5, r5, r2 @ tidx = tidx + chIncrement;
smulwb r3, r14, r9 @ accu1 = L_mpy_ls(Coeff1, tempUnfiltered);
smull r0, r8, r12, r11 @ accu2 = fixmul( Coeff0, states1 );
mov r3, r3, lsl #1
mov r8, r8, lsl #1
sub r0, r3, r10 @ accu3 = accu1 - states0;
sub r8, r0, r8 @ out = accu3 - accu2;
mov r10, r3 @ states0 = accu1;
mov r11, r8 @ states1 = out;
mul r3, r9, r9
mov r8, r8, asr #16
add r4, r4, #1
add r6, r6, r3, asr #7
mul r9, r8, r8
ldr r3, [r13, #12]
add r7, r7, r9, asr #7
cmp r4, r3
blt ENERGY_BEG
ldr r0, [r13, #8]
ldr r8, [r13, #4]
ENERGY_END:
add r4, r0, r8, lsl #2
str r6, [r4, #72]
add r8, r8, #1
str r7, [r4, #136]
cmp r8, #8
blt BLOCK_BEGIN
BLOCK_END:
str r10, [r0, #168]
str r11, [r0, #172]
mov r0, #1
add r13, r13, #20
ldmia sp!, {r4 - r11, pc}
hiPassCoeff:
.word 0xbec8b439
.word 0x609d4952
@ENDP
.end

View File

@@ -1,131 +1,131 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: PrePostMDCT_v5.s
@
@ Content: premdct and postmdct function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global PreMDCT
PreMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #8
movs r1, r1, asr #2
beq PreMDCT_END
PreMDCT_LOOP:
ldr r8, [r2], #4
ldr r9, [r2], #4
ldrd r4, [r0]
ldrd r6, [r3]
smull r14, r11, r4, r8 @ MULHIGH(tr1, cosa)
smull r10, r12, r7, r8 @ MULHIGH(ti1, cosa)
smull r14, r8, r7, r9 @ MULHIGH(ti1, sina)
smull r7, r10, r4, r9 @ MULHIGH(tr1, sina)
add r11, r11, r8 @ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
sub r7, r12, r10 @ MULHIGH(ti1, cosa) - MULHIGH(tr1, sina)
ldr r8, [r2], #4
ldr r9, [r2], #4
smull r14, r4, r6, r8 @ MULHIGH(tr2, cosa)
smull r10, r12, r5, r8 @ MULHIGH(ti2, cosa)
smull r14, r8, r5, r9 @ MULHIGH(ti2, sina)
smull r5, r10, r6, r9 @ MULHIGH(tr2, sina)
add r8, r8, r4
sub r9, r12, r10
mov r6, r11
strd r6, [r0]
strd r8, [r3]
subs r1, r1, #1
sub r3, r3, #8
add r0, r0, #8
bne PreMDCT_LOOP
PreMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PreMDCT|
.section .text
.global PostMDCT
PostMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #8
movs r1, r1, asr #2
beq PostMDCT_END
PostMDCT_LOOP:
ldr r8, [r2], #4
ldr r9, [r2], #4
ldrd r4, [r0]
ldrd r6, [r3]
smull r14, r11, r4, r8 @ MULHIGH(tr1, cosa)
smull r10, r12, r5, r8 @ MULHIGH(ti1, cosa)
smull r14, r8, r5, r9 @ MULHIGH(ti1, sina)
smull r5, r10, r4, r9 @ MULHIGH(tr1, sina)
add r4, r11, r8 @ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
sub r11, r10, r12 @ MULHIGH(ti1, cosa) - MULHIGH(tr1, sina)@
ldr r8, [r2], #4 @
ldr r9, [r2], #4
smull r14, r5, r6, r8 @ MULHIGH(tr2, cosa)
smull r10, r12, r7, r8 @ MULHIGH(ti2, cosa)
smull r14, r8, r7, r9 @ MULHIGH(ti2, sina)
smull r7, r10, r6, r9 @ MULHIGH(tr2, sina)
add r6, r8, r5 @ MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2)@
sub r5, r10, r12 @ MULHIGH(sinb, tr2) - MULHIGH(cosb, ti2)@
mov r7, r11
strd r4, [r0]
strd r6, [r3]
subs r1, r1, #1
sub r3, r3, #8
add r0, r0, #8
bne PostMDCT_LOOP
PostMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PostMDCT|
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: PrePostMDCT_v5.s
@
@ Content: premdct and postmdct function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global PreMDCT
PreMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #8
movs r1, r1, asr #2
beq PreMDCT_END
PreMDCT_LOOP:
ldr r8, [r2], #4
ldr r9, [r2], #4
ldrd r4, [r0]
ldrd r6, [r3]
smull r14, r11, r4, r8 @ MULHIGH(tr1, cosa)
smull r10, r12, r7, r8 @ MULHIGH(ti1, cosa)
smull r14, r8, r7, r9 @ MULHIGH(ti1, sina)
smull r7, r10, r4, r9 @ MULHIGH(tr1, sina)
add r11, r11, r8 @ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
sub r7, r12, r10 @ MULHIGH(ti1, cosa) - MULHIGH(tr1, sina)
ldr r8, [r2], #4
ldr r9, [r2], #4
smull r14, r4, r6, r8 @ MULHIGH(tr2, cosa)
smull r10, r12, r5, r8 @ MULHIGH(ti2, cosa)
smull r14, r8, r5, r9 @ MULHIGH(ti2, sina)
smull r5, r10, r6, r9 @ MULHIGH(tr2, sina)
add r8, r8, r4
sub r9, r12, r10
mov r6, r11
strd r6, [r0]
strd r8, [r3]
subs r1, r1, #1
sub r3, r3, #8
add r0, r0, #8
bne PreMDCT_LOOP
PreMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PreMDCT|
.section .text
.global PostMDCT
PostMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #8
movs r1, r1, asr #2
beq PostMDCT_END
PostMDCT_LOOP:
ldr r8, [r2], #4
ldr r9, [r2], #4
ldrd r4, [r0]
ldrd r6, [r3]
smull r14, r11, r4, r8 @ MULHIGH(tr1, cosa)
smull r10, r12, r5, r8 @ MULHIGH(ti1, cosa)
smull r14, r8, r5, r9 @ MULHIGH(ti1, sina)
smull r5, r10, r4, r9 @ MULHIGH(tr1, sina)
add r4, r11, r8 @ MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
sub r11, r10, r12 @ MULHIGH(ti1, cosa) - MULHIGH(tr1, sina)@
ldr r8, [r2], #4 @
ldr r9, [r2], #4
smull r14, r5, r6, r8 @ MULHIGH(tr2, cosa)
smull r10, r12, r7, r8 @ MULHIGH(ti2, cosa)
smull r14, r8, r7, r9 @ MULHIGH(ti2, sina)
smull r7, r10, r6, r9 @ MULHIGH(tr2, sina)
add r6, r8, r5 @ MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2)@
sub r5, r10, r12 @ MULHIGH(sinb, tr2) - MULHIGH(cosb, ti2)@
mov r7, r11
strd r4, [r0]
strd r6, [r3]
subs r1, r1, #1
sub r3, r3, #8
add r0, r0, #8
bne PostMDCT_LOOP
PostMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PostMDCT|
.end

View File

@@ -1,252 +1,252 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: R4R8First_v5.s
@
@ Content: Radix8First and Radix4First function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix4First
Radix4First:
stmdb sp!, {r4 - r11, lr}
movs r10, r1
mov r11, r0
beq Radix4First_END
Radix4First_LOOP:
ldrd r0, [r11]
ldrd r2, [r11, #8]
ldrd r4, [r11, #16]
ldrd r6, [r11, #24]
add r8, r0, r2
add r9, r1, r3
sub r0, r0, r2
sub r1, r1, r3
add r2, r4, r6
add r3, r5, r7
sub r4, r4, r6
sub r5, r5, r7
add r6, r8, r2
add r7, r9, r3
sub r8, r8, r2
sub r9, r9, r3
add r2, r0, r5
sub r3, r1, r4
sub r0, r0, r5
add r1, r1, r4
strd r6, [r11]
strd r2, [r11, #8]
strd r8, [r11, #16]
strd r0, [r11, #24]
subs r10, r10, #1
add r11, r11, #32
bne Radix4First_LOOP
Radix4First_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4First|
.section .text
.global Radix8First
Radix8First:
stmdb sp!, {r4 - r11, lr}
sub sp, sp, #0x24
mov r12, r1
mov r14, r0
cmp r12, #0
beq Radix8First_END
Radix8First_LOOP:
ldrd r0, [r14]
ldrd r2, [r14, #8]
ldrd r4, [r14, #16]
ldrd r6, [r14, #24]
add r8, r0, r2 @ r0 = buf[0] + buf[2]@
add r9, r1, r3 @ i0 = buf[1] + buf[3]@
sub r0, r0, r2 @ r1 = buf[0] - buf[2]@
sub r1, r1, r3 @ i1 = buf[1] - buf[3]@
add r2, r4, r6 @ r2 = buf[4] + buf[6]@
add r3, r5, r7 @ i2 = buf[5] + buf[7]@
sub r4, r4, r6 @ r3 = buf[4] - buf[6]@
sub r5, r5, r7 @ i3 = buf[5] - buf[7]@
add r6, r8, r2 @ r4 = (r0 + r2) >> 1@
add r7, r9, r3 @ i4 = (i0 + i2) >> 1@
sub r8, r8, r2 @ r5 = (r0 - r2) >> 1@
sub r9, r9, r3 @ i5 = (i0 - i2) >> 1@
sub r2, r0, r5 @ r6 = (r1 - i3) >> 1@
add r3, r1, r4 @ i6 = (i1 + r3) >> 1@
add r0, r0, r5 @ r7 = (r1 + i3) >> 1@
sub r1, r1, r4 @ i7 = (i1 - r3) >> 1@
mov r6, r6, asr #1 @
mov r7, r7, asr #1 @
mov r8, r8, asr #1
mov r9, r9, asr #1
mov r2, r2, asr #1
mov r3, r3, asr #1
mov r0, r0, asr #1
mov r1, r1, asr #1
str r6, [sp]
str r7, [sp, #4]
str r8, [sp, #8]
str r9, [sp, #12]
str r2, [sp, #16]
str r3, [sp, #20]
str r0, [sp, #24]
str r1, [sp, #28]
ldrd r2, [r14, #32]
ldrd r4, [r14, #40]
ldrd r6, [r14, #48]
ldrd r8, [r14, #56]
add r0, r2, r4 @ r0 = buf[ 8] + buf[10]@
add r1, r3, r5 @ i0 = buf[ 9] + buf[11]@
sub r2, r2, r4 @ r1 = buf[ 8] - buf[10]@
sub r3, r3, r5 @ i1 = buf[ 9] - buf[11]@
add r4, r6, r8 @ r2 = buf[12] + buf[14]@
add r5, r7, r9 @ i2 = buf[13] + buf[15]@
sub r6, r6, r8 @ r3 = buf[12] - buf[14]@
sub r7, r7, r9 @ i3 = buf[13] - buf[15]@
add r8, r0, r4 @ t0 = (r0 + r2)
add r9, r1, r5 @ t1 = (i0 + i2)
sub r0, r0, r4 @ t2 = (r0 - r2)
sub r1, r1, r5 @ t3 = (i0 - i2)
mov r8, r8, asr #1
ldr r4, [sp]
mov r9, r9, asr #1
ldr r5, [sp, #4]
mov r0, r0, asr #1
mov r1, r1, asr #1
add r10, r4, r8 @ buf[ 0] = r4 + t0@
add r11, r5, r9 @ buf[ 1] = i4 + t1@
sub r4, r4, r8 @ buf[ 8] = r4 - t0@
sub r5, r5, r9 @ buf[ 9] = i4 - t1@
strd r10, [r14]
strd r4, [r14, #32]
ldr r10, [sp, #8]
ldr r11, [sp, #12]
add r4, r10, r1 @ buf[ 4] = r5 + t3@
sub r5, r11, r0 @ buf[ 5] = i5 - t2@
sub r10, r10, r1 @ buf[12] = r5 - t3@
add r11, r11, r0 @ buf[13] = i5 + t2@
strd r4, [r14, #16]
strd r10, [r14, #48]
sub r0, r2, r7 @ r0 = r1 - i3@
add r1, r3, r6 @ i0 = i1 + r3@
ldr r11, DATATab
add r2, r2, r7 @ r2 = r1 + i3@
sub r3, r3, r6 @ i2 = i1 - r3@
sub r4, r0, r1 @ r0 - i0
add r5, r0, r1 @ r0 + i0
sub r0, r2, r3 @ r2 - i2
add r1, r2, r3 @ r2 + i2
smull r8, r6, r4, r11
smull r9, r7, r5, r11
ldr r2, [sp, #16]
ldr r3, [sp, #20]
smull r8, r4, r0, r11
smull r9, r5, r1, r11
ldr r10, [sp, #24]
ldr r11, [sp, #28]
sub r8, r2, r6
sub r9, r3, r7
add r2, r2, r6
add r3, r3, r7
add r6, r10, r5
sub r7, r11, r4
sub r0, r10, r5
add r1, r11, r4
strd r6, [r14, #8]
strd r8, [r14, #24]
strd r0, [r14, #40]
strd r2, [r14, #56]
subs r12, r12, #1
add r14, r14, #64
bne Radix8First_LOOP
Radix8First_END:
add sp, sp, #0x24
ldmia sp!, {r4 - r11, pc}
DATATab:
.word 0x5a82799a
@ENDP @ |Radix8First|
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: R4R8First_v5.s
@
@ Content: Radix8First and Radix4First function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix4First
Radix4First:
stmdb sp!, {r4 - r11, lr}
movs r10, r1
mov r11, r0
beq Radix4First_END
Radix4First_LOOP:
ldrd r0, [r11]
ldrd r2, [r11, #8]
ldrd r4, [r11, #16]
ldrd r6, [r11, #24]
add r8, r0, r2
add r9, r1, r3
sub r0, r0, r2
sub r1, r1, r3
add r2, r4, r6
add r3, r5, r7
sub r4, r4, r6
sub r5, r5, r7
add r6, r8, r2
add r7, r9, r3
sub r8, r8, r2
sub r9, r9, r3
add r2, r0, r5
sub r3, r1, r4
sub r0, r0, r5
add r1, r1, r4
strd r6, [r11]
strd r2, [r11, #8]
strd r8, [r11, #16]
strd r0, [r11, #24]
subs r10, r10, #1
add r11, r11, #32
bne Radix4First_LOOP
Radix4First_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4First|
.section .text
.global Radix8First
Radix8First:
stmdb sp!, {r4 - r11, lr}
sub sp, sp, #0x24
mov r12, r1
mov r14, r0
cmp r12, #0
beq Radix8First_END
Radix8First_LOOP:
ldrd r0, [r14]
ldrd r2, [r14, #8]
ldrd r4, [r14, #16]
ldrd r6, [r14, #24]
add r8, r0, r2 @ r0 = buf[0] + buf[2]@
add r9, r1, r3 @ i0 = buf[1] + buf[3]@
sub r0, r0, r2 @ r1 = buf[0] - buf[2]@
sub r1, r1, r3 @ i1 = buf[1] - buf[3]@
add r2, r4, r6 @ r2 = buf[4] + buf[6]@
add r3, r5, r7 @ i2 = buf[5] + buf[7]@
sub r4, r4, r6 @ r3 = buf[4] - buf[6]@
sub r5, r5, r7 @ i3 = buf[5] - buf[7]@
add r6, r8, r2 @ r4 = (r0 + r2) >> 1@
add r7, r9, r3 @ i4 = (i0 + i2) >> 1@
sub r8, r8, r2 @ r5 = (r0 - r2) >> 1@
sub r9, r9, r3 @ i5 = (i0 - i2) >> 1@
sub r2, r0, r5 @ r6 = (r1 - i3) >> 1@
add r3, r1, r4 @ i6 = (i1 + r3) >> 1@
add r0, r0, r5 @ r7 = (r1 + i3) >> 1@
sub r1, r1, r4 @ i7 = (i1 - r3) >> 1@
mov r6, r6, asr #1 @
mov r7, r7, asr #1 @
mov r8, r8, asr #1
mov r9, r9, asr #1
mov r2, r2, asr #1
mov r3, r3, asr #1
mov r0, r0, asr #1
mov r1, r1, asr #1
str r6, [sp]
str r7, [sp, #4]
str r8, [sp, #8]
str r9, [sp, #12]
str r2, [sp, #16]
str r3, [sp, #20]
str r0, [sp, #24]
str r1, [sp, #28]
ldrd r2, [r14, #32]
ldrd r4, [r14, #40]
ldrd r6, [r14, #48]
ldrd r8, [r14, #56]
add r0, r2, r4 @ r0 = buf[ 8] + buf[10]@
add r1, r3, r5 @ i0 = buf[ 9] + buf[11]@
sub r2, r2, r4 @ r1 = buf[ 8] - buf[10]@
sub r3, r3, r5 @ i1 = buf[ 9] - buf[11]@
add r4, r6, r8 @ r2 = buf[12] + buf[14]@
add r5, r7, r9 @ i2 = buf[13] + buf[15]@
sub r6, r6, r8 @ r3 = buf[12] - buf[14]@
sub r7, r7, r9 @ i3 = buf[13] - buf[15]@
add r8, r0, r4 @ t0 = (r0 + r2)
add r9, r1, r5 @ t1 = (i0 + i2)
sub r0, r0, r4 @ t2 = (r0 - r2)
sub r1, r1, r5 @ t3 = (i0 - i2)
mov r8, r8, asr #1
ldr r4, [sp]
mov r9, r9, asr #1
ldr r5, [sp, #4]
mov r0, r0, asr #1
mov r1, r1, asr #1
add r10, r4, r8 @ buf[ 0] = r4 + t0@
add r11, r5, r9 @ buf[ 1] = i4 + t1@
sub r4, r4, r8 @ buf[ 8] = r4 - t0@
sub r5, r5, r9 @ buf[ 9] = i4 - t1@
strd r10, [r14]
strd r4, [r14, #32]
ldr r10, [sp, #8]
ldr r11, [sp, #12]
add r4, r10, r1 @ buf[ 4] = r5 + t3@
sub r5, r11, r0 @ buf[ 5] = i5 - t2@
sub r10, r10, r1 @ buf[12] = r5 - t3@
add r11, r11, r0 @ buf[13] = i5 + t2@
strd r4, [r14, #16]
strd r10, [r14, #48]
sub r0, r2, r7 @ r0 = r1 - i3@
add r1, r3, r6 @ i0 = i1 + r3@
ldr r11, DATATab
add r2, r2, r7 @ r2 = r1 + i3@
sub r3, r3, r6 @ i2 = i1 - r3@
sub r4, r0, r1 @ r0 - i0
add r5, r0, r1 @ r0 + i0
sub r0, r2, r3 @ r2 - i2
add r1, r2, r3 @ r2 + i2
smull r8, r6, r4, r11
smull r9, r7, r5, r11
ldr r2, [sp, #16]
ldr r3, [sp, #20]
smull r8, r4, r0, r11
smull r9, r5, r1, r11
ldr r10, [sp, #24]
ldr r11, [sp, #28]
sub r8, r2, r6
sub r9, r3, r7
add r2, r2, r6
add r3, r3, r7
add r6, r10, r5
sub r7, r11, r4
sub r0, r10, r5
add r1, r11, r4
strd r6, [r14, #8]
strd r8, [r14, #24]
strd r0, [r14, #40]
strd r2, [r14, #56]
subs r12, r12, #1
add r14, r14, #64
bne Radix8First_LOOP
Radix8First_END:
add sp, sp, #0x24
ldmia sp!, {r4 - r11, pc}
DATATab:
.word 0x5a82799a
@ENDP @ |Radix8First|
.end

View File

@@ -1,169 +1,169 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: Radix4FFT_v5.s
@
@ Content: Radix4FFT armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix4FFT
Radix4FFT:
stmdb sp!, {r4 - r11, lr}
sub sp, sp, #32
mov r1, r1, asr #2
cmp r1, #0
beq Radix4FFT_END
Radix4FFT_LOOP1:
mov r14, r0 @ xptr = buf@
mov r10, r1 @ i = num@
mov r9, r2, lsl #3 @ step = 2*bgn@
cmp r10, #0
str r0, [sp]
str r1, [sp, #4]
str r2, [sp, #8]
str r3, [sp, #12]
beq Radix4FFT_LOOP1_END
Radix4FFT_LOOP2:
mov r12, r3 @ csptr = twidTab@
mov r11, r2 @ j = bgn
cmp r11, #0
str r10, [sp, #16]
beq Radix4FFT_LOOP2_END
Radix4FFT_LOOP3:
str r11, [sp, #20]
ldrd r0, [r14, #0] @ r0 = xptr[0]@ r1 = xptr[1]@
add r14, r14, r9 @ xptr += step@
ldrd r10, [r14, #0] @ r2 = xptr[0]@ r3 = xptr[1]@
ldr r8, [r12], #4 @ cosxsinx = csptr[0]@
smulwt r4, r10, r8 @ L_mpy_wx(cosx, t0)
smulwt r3, r11, r8 @ L_mpy_wx(cosx, t1)
smlawb r2, r11, r8, r4 @ r2 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
smulwb r5, r10, r8 @ L_mpy_wx(sinx, t0)
mov r10, r0, asr #2 @ t0 = r0 >> 2@
mov r11, r1, asr #2 @ t1 = r1 >> 2@
sub r3, r3, r5 @ r3 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
add r14, r14, r9 @ xptr += step@
sub r0, r10, r2 @ r0 = t0 - r2@
sub r1, r11, r3 @ r1 = t1 - r3@
add r2, r10, r2 @ r2 = t0 + r2@
add r3, r11, r3 @ r3 = t1 + r3@
str r2, [sp, #24]
str r3, [sp, #28]
ldrd r10, [r14, #0] @ r4 = xptr[0]@ r5 = xptr[1]@
ldr r8, [r12], #4 @ cosxsinx = csptr[1]@
smulwt r6, r10, r8 @ L_mpy_wx(cosx, t0)
smulwt r5, r11, r8 @ L_mpy_wx(cosx, t1)
smlawb r4, r11, r8, r6 @ r4 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
smulwb r7, r10, r8 @ L_mpy_wx(sinx, t0)
add r14, r14, r9 @ xptr += step@
sub r5, r5, r7 @ r5 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
ldrd r10, [r14] @ r6 = xptr[0]@ r7 = xptr[1]@
ldr r8, [r12], #4 @ cosxsinx = csptr[1]@
smulwt r2, r10, r8 @ L_mpy_wx(cosx, t0)
smulwt r7, r11, r8 @ L_mpy_wx(cosx, t1)
smlawb r6, r11, r8, r2 @ r4 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
smulwb r3, r10, r8 @ L_mpy_wx(sinx, t0)
mov r10, r4 @ t0 = r4@
mov r11, r5 @ t1 = r5@
sub r7, r7, r3 @ r5 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
add r4, r10, r6 @ r4 = t0 + r6@
sub r5, r7, r11 @ r5 = r7 - t1@
sub r6, r10, r6 @ r6 = t0 - r6@
add r7, r7, r11 @ r7 = r7 + t1@
ldr r2, [sp, #24]
ldr r3, [sp, #28]
add r10, r0, r5 @ xptr[0] = r0 + r5@
add r11, r1, r6 @ xptr[0] = r1 + r6
strd r10, [r14]
sub r14, r14, r9 @ xptr -= step@
sub r10, r2, r4 @ xptr[0] = r2 - r4@
sub r11, r3, r7 @ xptr[1] = r3 - r7@
strd r10, [r14]
sub r14, r14, r9 @ xptr -= step@
sub r10, r0, r5 @ xptr[0] = r0 - r5@
sub r11, r1, r6 @ xptr[0] = r1 - r6
strd r10, [r14]
sub r14, r14, r9 @ xptr -= step@
add r10, r2, r4 @ xptr[0] = r2 - r4@
add r11, r3, r7 @ xptr[1] = r3 - r7@
strd r10, [r14]
add r14, r14, #8 @ xptr += 2@
ldr r11, [sp, #20]
subs r11, r11, #1
bne Radix4FFT_LOOP3
Radix4FFT_LOOP2_END:
ldr r10, [sp, #16]
ldr r3, [sp, #12]
ldr r2, [sp, #8]
rsb r8, r9, r9, lsl #2
sub r10, r10, #1
add r14, r14, r8
cmp r10, #0
bhi Radix4FFT_LOOP2
Radix4FFT_LOOP1_END:
ldr r0, [sp]
ldr r1, [sp, #4]
add r3, r3, r8, asr #1
mov r2, r2, lsl #2
movs r1, r1, asr #2
bne Radix4FFT_LOOP1
Radix4FFT_END:
add sp, sp, #32
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4FFT|
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: Radix4FFT_v5.s
@
@ Content: Radix4FFT armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix4FFT
Radix4FFT:
stmdb sp!, {r4 - r11, lr}
sub sp, sp, #32
mov r1, r1, asr #2
cmp r1, #0
beq Radix4FFT_END
Radix4FFT_LOOP1:
mov r14, r0 @ xptr = buf@
mov r10, r1 @ i = num@
mov r9, r2, lsl #3 @ step = 2*bgn@
cmp r10, #0
str r0, [sp]
str r1, [sp, #4]
str r2, [sp, #8]
str r3, [sp, #12]
beq Radix4FFT_LOOP1_END
Radix4FFT_LOOP2:
mov r12, r3 @ csptr = twidTab@
mov r11, r2 @ j = bgn
cmp r11, #0
str r10, [sp, #16]
beq Radix4FFT_LOOP2_END
Radix4FFT_LOOP3:
str r11, [sp, #20]
ldrd r0, [r14, #0] @ r0 = xptr[0]@ r1 = xptr[1]@
add r14, r14, r9 @ xptr += step@
ldrd r10, [r14, #0] @ r2 = xptr[0]@ r3 = xptr[1]@
ldr r8, [r12], #4 @ cosxsinx = csptr[0]@
smulwt r4, r10, r8 @ L_mpy_wx(cosx, t0)
smulwt r3, r11, r8 @ L_mpy_wx(cosx, t1)
smlawb r2, r11, r8, r4 @ r2 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
smulwb r5, r10, r8 @ L_mpy_wx(sinx, t0)
mov r10, r0, asr #2 @ t0 = r0 >> 2@
mov r11, r1, asr #2 @ t1 = r1 >> 2@
sub r3, r3, r5 @ r3 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
add r14, r14, r9 @ xptr += step@
sub r0, r10, r2 @ r0 = t0 - r2@
sub r1, r11, r3 @ r1 = t1 - r3@
add r2, r10, r2 @ r2 = t0 + r2@
add r3, r11, r3 @ r3 = t1 + r3@
str r2, [sp, #24]
str r3, [sp, #28]
ldrd r10, [r14, #0] @ r4 = xptr[0]@ r5 = xptr[1]@
ldr r8, [r12], #4 @ cosxsinx = csptr[1]@
smulwt r6, r10, r8 @ L_mpy_wx(cosx, t0)
smulwt r5, r11, r8 @ L_mpy_wx(cosx, t1)
smlawb r4, r11, r8, r6 @ r4 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
smulwb r7, r10, r8 @ L_mpy_wx(sinx, t0)
add r14, r14, r9 @ xptr += step@
sub r5, r5, r7 @ r5 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
ldrd r10, [r14] @ r6 = xptr[0]@ r7 = xptr[1]@
ldr r8, [r12], #4 @ cosxsinx = csptr[1]@
smulwt r2, r10, r8 @ L_mpy_wx(cosx, t0)
smulwt r7, r11, r8 @ L_mpy_wx(cosx, t1)
smlawb r6, r11, r8, r2 @ r4 = L_mpy_wx(cosx, t0) + L_mpy_wx(sinx, t1)@
smulwb r3, r10, r8 @ L_mpy_wx(sinx, t0)
mov r10, r4 @ t0 = r4@
mov r11, r5 @ t1 = r5@
sub r7, r7, r3 @ r5 = L_mpy_wx(cosx, t1) - L_mpy_wx(sinx, t0)@
add r4, r10, r6 @ r4 = t0 + r6@
sub r5, r7, r11 @ r5 = r7 - t1@
sub r6, r10, r6 @ r6 = t0 - r6@
add r7, r7, r11 @ r7 = r7 + t1@
ldr r2, [sp, #24]
ldr r3, [sp, #28]
add r10, r0, r5 @ xptr[0] = r0 + r5@
add r11, r1, r6 @ xptr[0] = r1 + r6
strd r10, [r14]
sub r14, r14, r9 @ xptr -= step@
sub r10, r2, r4 @ xptr[0] = r2 - r4@
sub r11, r3, r7 @ xptr[1] = r3 - r7@
strd r10, [r14]
sub r14, r14, r9 @ xptr -= step@
sub r10, r0, r5 @ xptr[0] = r0 - r5@
sub r11, r1, r6 @ xptr[0] = r1 - r6
strd r10, [r14]
sub r14, r14, r9 @ xptr -= step@
add r10, r2, r4 @ xptr[0] = r2 - r4@
add r11, r3, r7 @ xptr[1] = r3 - r7@
strd r10, [r14]
add r14, r14, #8 @ xptr += 2@
ldr r11, [sp, #20]
subs r11, r11, #1
bne Radix4FFT_LOOP3
Radix4FFT_LOOP2_END:
ldr r10, [sp, #16]
ldr r3, [sp, #12]
ldr r2, [sp, #8]
rsb r8, r9, r9, lsl #2
sub r10, r10, #1
add r14, r14, r8
cmp r10, #0
bhi Radix4FFT_LOOP2
Radix4FFT_LOOP1_END:
ldr r0, [sp]
ldr r1, [sp, #4]
add r3, r3, r8, asr #1
mov r2, r2, lsl #2
movs r1, r1, asr #2
bne Radix4FFT_LOOP1
Radix4FFT_END:
add sp, sp, #32
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4FFT|
.end

View File

@@ -1,204 +1,204 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: band_nrg_v5.s
@
@ Content: CalcBandEnergy and CalcBandEnergyMS function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global CalcBandEnergy
CalcBandEnergy:
stmdb sp!, {r4 - r11, lr}
mov r2, r2, lsl #16
ldr r12, [r13, #36]
mov r9, #0
mov r5, r2, asr #16
mov r4, #0
cmp r5, #0
ble L212
L22:
mov r2, r4, lsl #1
ldrsh r10, [r1, r2]
add r11, r1, r2
ldrsh r2, [r11, #2]
mov r14, #0
cmp r10, r2
bge L28
L23:
ldr r11, [r0, +r10, lsl #2]
add r10, r10, #1
ldr r6, [r0, +r10, lsl #2]
smull r11, r7, r11, r11
add r10, r10, #1
smull r6, r8, r6, r6
ldr r11, [r0, +r10, lsl #2]
qadd r14, r14, r7
add r10, r10, #1
smull r11, r7, r11, r11
ldr r6, [r0, +r10, lsl #2]
qadd r14, r14, r8
smull r6, r8, r6, r6
add r10, r10, #1
qadd r14, r14, r7
cmp r10, r2
qadd r14, r14, r8
blt L23
L28:
qadd r14, r14, r14
str r14, [r3, +r4, lsl #2]
add r4, r4, #1
qadd r9, r9, r14
cmp r4, r5
blt L22
L212:
str r9, [r12, #0]
ldmia sp!, {r4 - r11, pc}
@ENDP ; |CalcBandEnergy|
.global CalcBandEnergyMS
CalcBandEnergyMS:
stmdb sp!, {r4 - r11, lr}
sub r13, r13, #24
mov r12, #0
mov r3, r3, lsl #16
mov r14, #0
mov r3, r3, asr #16
cmp r3, #0
mov r4, #0
ble L315
L32:
mov r5, r4, lsl #1
mov r6, #0
ldrsh r10, [r2, r5]
add r5, r2, r5
mov r7, #0
ldrsh r11, [r5, #2]
cmp r10, r11
bge L39
str r3, [r13, #4]
str r4, [r13, #8]
str r12, [r13, #12]
str r14, [r13, #16]
L33:
ldr r8, [r0, +r10, lsl #2]
ldr r9, [r1, +r10, lsl #2]
mov r8, r8, asr #1
add r10, r10, #1
mov r9, r9, asr #1
ldr r12, [r0, +r10, lsl #2]
add r5, r8, r9
ldr r14, [r1, +r10, lsl #2]
sub r8, r8, r9
smull r5, r3, r5, r5
mov r12, r12, asr #1
smull r8, r4, r8, r8
mov r14, r14, asr #1
qadd r6, r6, r3
add r5, r12, r14
qadd r7, r7, r4
sub r8, r12, r14
smull r5, r3, r5, r5
add r10, r10, #1
smull r8, r4, r8, r8
qadd r6, r6, r3
qadd r7, r7, r4
ldr r8, [r0, +r10, lsl #2]
ldr r9, [r1, +r10, lsl #2]
mov r8, r8, asr #1
add r10, r10, #1
mov r9, r9, asr #1
ldr r12, [r0, +r10, lsl #2]
add r5, r8, r9
ldr r14, [r1, +r10, lsl #2]
sub r8, r8, r9
smull r5, r3, r5, r5
mov r12, r12, asr #1
smull r8, r4, r8, r8
mov r14, r14, asr #1
qadd r6, r6, r3
add r5, r12, r14
qadd r7, r7, r4
sub r8, r12, r14
smull r5, r3, r5, r5
add r10, r10, #1
smull r8, r4, r8, r8
qadd r6, r6, r3
qadd r7, r7, r4
cmp r10, r11
blt L33
ldr r3, [r13, #4]
ldr r4, [r13, #8]
ldr r12, [r13, #12]
ldr r14, [r13, #16]
L39:
qadd r6, r6, r6
qadd r7, r7, r7
ldr r8, [r13, #60]
ldr r9, [r13, #68]
qadd r12, r12, r6
qadd r14, r14, r7
str r6, [r8, +r4, lsl #2]
str r7, [r9, +r4, lsl #2]
add r4, r4, #1
cmp r4, r3
blt L32
L315:
ldr r8, [r13, #64]
ldr r9, [r13, #72]
str r12, [r8, #0]
str r14, [r9, #0]
add r13, r13, #24
ldmia sp!, {r4 - r11, pc}
@ENDP ; |CalcBandEnergyMS|
.end
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: band_nrg_v5.s
@
@ Content: CalcBandEnergy and CalcBandEnergyMS function armv5 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global CalcBandEnergy
CalcBandEnergy:
stmdb sp!, {r4 - r11, lr}
mov r2, r2, lsl #16
ldr r12, [r13, #36]
mov r9, #0
mov r5, r2, asr #16
mov r4, #0
cmp r5, #0
ble L212
L22:
mov r2, r4, lsl #1
ldrsh r10, [r1, r2]
add r11, r1, r2
ldrsh r2, [r11, #2]
mov r14, #0
cmp r10, r2
bge L28
L23:
ldr r11, [r0, +r10, lsl #2]
add r10, r10, #1
ldr r6, [r0, +r10, lsl #2]
smull r11, r7, r11, r11
add r10, r10, #1
smull r6, r8, r6, r6
ldr r11, [r0, +r10, lsl #2]
qadd r14, r14, r7
add r10, r10, #1
smull r11, r7, r11, r11
ldr r6, [r0, +r10, lsl #2]
qadd r14, r14, r8
smull r6, r8, r6, r6
add r10, r10, #1
qadd r14, r14, r7
cmp r10, r2
qadd r14, r14, r8
blt L23
L28:
qadd r14, r14, r14
str r14, [r3, +r4, lsl #2]
add r4, r4, #1
qadd r9, r9, r14
cmp r4, r5
blt L22
L212:
str r9, [r12, #0]
ldmia sp!, {r4 - r11, pc}
@ENDP ; |CalcBandEnergy|
.global CalcBandEnergyMS
CalcBandEnergyMS:
stmdb sp!, {r4 - r11, lr}
sub r13, r13, #24
mov r12, #0
mov r3, r3, lsl #16
mov r14, #0
mov r3, r3, asr #16
cmp r3, #0
mov r4, #0
ble L315
L32:
mov r5, r4, lsl #1
mov r6, #0
ldrsh r10, [r2, r5]
add r5, r2, r5
mov r7, #0
ldrsh r11, [r5, #2]
cmp r10, r11
bge L39
str r3, [r13, #4]
str r4, [r13, #8]
str r12, [r13, #12]
str r14, [r13, #16]
L33:
ldr r8, [r0, +r10, lsl #2]
ldr r9, [r1, +r10, lsl #2]
mov r8, r8, asr #1
add r10, r10, #1
mov r9, r9, asr #1
ldr r12, [r0, +r10, lsl #2]
add r5, r8, r9
ldr r14, [r1, +r10, lsl #2]
sub r8, r8, r9
smull r5, r3, r5, r5
mov r12, r12, asr #1
smull r8, r4, r8, r8
mov r14, r14, asr #1
qadd r6, r6, r3
add r5, r12, r14
qadd r7, r7, r4
sub r8, r12, r14
smull r5, r3, r5, r5
add r10, r10, #1
smull r8, r4, r8, r8
qadd r6, r6, r3
qadd r7, r7, r4
ldr r8, [r0, +r10, lsl #2]
ldr r9, [r1, +r10, lsl #2]
mov r8, r8, asr #1
add r10, r10, #1
mov r9, r9, asr #1
ldr r12, [r0, +r10, lsl #2]
add r5, r8, r9
ldr r14, [r1, +r10, lsl #2]
sub r8, r8, r9
smull r5, r3, r5, r5
mov r12, r12, asr #1
smull r8, r4, r8, r8
mov r14, r14, asr #1
qadd r6, r6, r3
add r5, r12, r14
qadd r7, r7, r4
sub r8, r12, r14
smull r5, r3, r5, r5
add r10, r10, #1
smull r8, r4, r8, r8
qadd r6, r6, r3
qadd r7, r7, r4
cmp r10, r11
blt L33
ldr r3, [r13, #4]
ldr r4, [r13, #8]
ldr r12, [r13, #12]
ldr r14, [r13, #16]
L39:
qadd r6, r6, r6
qadd r7, r7, r7
ldr r8, [r13, #60]
ldr r9, [r13, #68]
qadd r12, r12, r6
qadd r14, r14, r7
str r6, [r8, +r4, lsl #2]
str r7, [r9, +r4, lsl #2]
add r4, r4, #1
cmp r4, r3
blt L32
L315:
ldr r8, [r13, #64]
ldr r9, [r13, #72]
str r12, [r8, #0]
str r14, [r9, #0]
add r13, r13, #24
ldmia sp!, {r4 - r11, pc}
@ENDP ; |CalcBandEnergyMS|
.end

View File

@@ -1,135 +1,135 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: PrePostMDCT_v7.s
@
@ Content: premdct and postmdct function armv7 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global PreMDCT
PreMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #32
movs r1, r1, asr #2
beq PreMDCT_END
PreMDCT_LOOP:
VLD4.I32 {d0, d2, d4, d6}, [r2]! @ cosa = *csptr++@ sina = *csptr++@
VLD4.I32 {d1, d3, d5, d7}, [r2]! @ cosb = *csptr++@ sinb = *csptr++@
VLD2.I32 {d8, d9, d10, d11}, [r0] @ tr1 = *(buf0 + 0)@ ti2 = *(buf0 + 1)@
VLD2.I32 {d13, d15}, [r3]! @ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
VLD2.I32 {d12, d14}, [r3]! @ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
VREV64.32 Q8, Q7
VREV64.32 Q9, Q6
VQDMULH.S32 Q10, Q0, Q4 @ MULHIGH(cosa, tr1)
VQDMULH.S32 Q11, Q1, Q8 @ MULHIGH(sina, ti1)
VQDMULH.S32 Q12, Q0, Q8 @ MULHIGH(cosa, ti1)
VQDMULH.S32 Q13, Q1, Q4 @ MULHIGH(sina, tr1)
VADD.S32 Q0, Q10, Q11 @ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
VSUB.S32 Q1, Q12, Q13 @ *buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1)@
VST2.I32 {d0, d1, d2, d3}, [r0]!
sub r3, r3, #32
VQDMULH.S32 Q10, Q2, Q9 @ MULHIGH(cosb, tr2)
VQDMULH.S32 Q11, Q3, Q5 @ MULHIGH(sinb, ti2)
VQDMULH.S32 Q12, Q2, Q5 @ MULHIGH(cosb, ti2)
VQDMULH.S32 Q13, Q3, Q9 @ MULHIGH(sinb, tr2)
VADD.S32 Q0, Q10, Q11 @ MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
VSUB.S32 Q1, Q12, Q13 @ MULHIGH(cosa, ti2) - MULHIGH(sina, tr2)@
VREV64.32 Q3, Q1
VREV64.32 Q2, Q0
VST2.I32 {d5, d7}, [r3]!
VST2.I32 {d4, d6}, [r3]!
subs r1, r1, #4
sub r3, r3, #64
bne PreMDCT_LOOP
PreMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PreMDCT|
.section .text
.global PostMDCT
PostMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #32
movs r1, r1, asr #2
beq PostMDCT_END
PostMDCT_LOOP:
VLD4.I32 {d0, d2, d4, d6}, [r2]! @ cosa = *csptr++@ sina = *csptr++@
VLD4.I32 {d1, d3, d5, d7}, [r2]! @ cosb = *csptr++@ sinb = *csptr++@
VLD2.I32 {d8, d9, d10, d11}, [r0] @ tr1 = *(zbuf1 + 0)@ ti1 = *(zbuf1 + 1)@
VLD2.I32 {d13, d15}, [r3]! @ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
VLD2.I32 {d12, d14}, [r3]! @ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
VREV64.32 Q8, Q6
VREV64.32 Q9, Q7
VQDMULH.S32 Q10, Q0, Q4 @ MULHIGH(cosa, tr1)
VQDMULH.S32 Q11, Q1, Q5 @ MULHIGH(sina, ti1)
VQDMULH.S32 Q12, Q0, Q5 @ MULHIGH(cosa, ti1)
VQDMULH.S32 Q13, Q1, Q4 @ MULHIGH(sina, tr1)
VADD.S32 Q0, Q10, Q11 @ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
VSUB.S32 Q5, Q13, Q12 @ *buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1)@
VQDMULH.S32 Q10, Q2, Q8 @ MULHIGH(cosb, tr2)
VQDMULH.S32 Q11, Q3, Q9 @ MULHIGH(sinb, ti2)
VQDMULH.S32 Q12, Q2, Q9 @ MULHIGH(cosb, ti2)
VQDMULH.S32 Q13, Q3, Q8 @ MULHIGH(sinb, tr2)
VADD.S32 Q4, Q10, Q11 @ *buf1-- = MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
VSUB.S32 Q1, Q13, Q12 @ *buf0++ = MULHIGH(sina, tr2) - MULHIGH(cosa, ti2)@
VREV64.32 Q2, Q4
VREV64.32 Q3, Q5
sub r3, r3, #32
VST2.I32 {d0, d1, d2, d3}, [r0]!
VST2.I32 {d5, d7}, [r3]!
VST2.I32 {d4, d6}, [r3]!
subs r1, r1, #4
sub r3, r3, #64
bne PostMDCT_LOOP
PostMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PostMDCT|
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: PrePostMDCT_v7.s
@
@ Content: premdct and postmdct function armv7 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global PreMDCT
PreMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #32
movs r1, r1, asr #2
beq PreMDCT_END
PreMDCT_LOOP:
VLD4.I32 {d0, d2, d4, d6}, [r2]! @ cosa = *csptr++@ sina = *csptr++@
VLD4.I32 {d1, d3, d5, d7}, [r2]! @ cosb = *csptr++@ sinb = *csptr++@
VLD2.I32 {d8, d9, d10, d11}, [r0] @ tr1 = *(buf0 + 0)@ ti2 = *(buf0 + 1)@
VLD2.I32 {d13, d15}, [r3]! @ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
VLD2.I32 {d12, d14}, [r3]! @ tr2 = *(buf1 - 1)@ ti1 = *(buf1 + 0)@
VREV64.32 Q8, Q7
VREV64.32 Q9, Q6
VQDMULH.S32 Q10, Q0, Q4 @ MULHIGH(cosa, tr1)
VQDMULH.S32 Q11, Q1, Q8 @ MULHIGH(sina, ti1)
VQDMULH.S32 Q12, Q0, Q8 @ MULHIGH(cosa, ti1)
VQDMULH.S32 Q13, Q1, Q4 @ MULHIGH(sina, tr1)
VADD.S32 Q0, Q10, Q11 @ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
VSUB.S32 Q1, Q12, Q13 @ *buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1)@
VST2.I32 {d0, d1, d2, d3}, [r0]!
sub r3, r3, #32
VQDMULH.S32 Q10, Q2, Q9 @ MULHIGH(cosb, tr2)
VQDMULH.S32 Q11, Q3, Q5 @ MULHIGH(sinb, ti2)
VQDMULH.S32 Q12, Q2, Q5 @ MULHIGH(cosb, ti2)
VQDMULH.S32 Q13, Q3, Q9 @ MULHIGH(sinb, tr2)
VADD.S32 Q0, Q10, Q11 @ MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
VSUB.S32 Q1, Q12, Q13 @ MULHIGH(cosa, ti2) - MULHIGH(sina, tr2)@
VREV64.32 Q3, Q1
VREV64.32 Q2, Q0
VST2.I32 {d5, d7}, [r3]!
VST2.I32 {d4, d6}, [r3]!
subs r1, r1, #4
sub r3, r3, #64
bne PreMDCT_LOOP
PreMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PreMDCT|
.section .text
.global PostMDCT
PostMDCT:
stmdb sp!, {r4 - r11, lr}
add r9, r0, r1, lsl #2
sub r3, r9, #32
movs r1, r1, asr #2
beq PostMDCT_END
PostMDCT_LOOP:
VLD4.I32 {d0, d2, d4, d6}, [r2]! @ cosa = *csptr++@ sina = *csptr++@
VLD4.I32 {d1, d3, d5, d7}, [r2]! @ cosb = *csptr++@ sinb = *csptr++@
VLD2.I32 {d8, d9, d10, d11}, [r0] @ tr1 = *(zbuf1 + 0)@ ti1 = *(zbuf1 + 1)@
VLD2.I32 {d13, d15}, [r3]! @ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
VLD2.I32 {d12, d14}, [r3]! @ tr2 = *(zbuf2 - 1)@ ti2 = *(zbuf2 + 0)@
VREV64.32 Q8, Q6
VREV64.32 Q9, Q7
VQDMULH.S32 Q10, Q0, Q4 @ MULHIGH(cosa, tr1)
VQDMULH.S32 Q11, Q1, Q5 @ MULHIGH(sina, ti1)
VQDMULH.S32 Q12, Q0, Q5 @ MULHIGH(cosa, ti1)
VQDMULH.S32 Q13, Q1, Q4 @ MULHIGH(sina, tr1)
VADD.S32 Q0, Q10, Q11 @ *buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1)@
VSUB.S32 Q5, Q13, Q12 @ *buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1)@
VQDMULH.S32 Q10, Q2, Q8 @ MULHIGH(cosb, tr2)
VQDMULH.S32 Q11, Q3, Q9 @ MULHIGH(sinb, ti2)
VQDMULH.S32 Q12, Q2, Q9 @ MULHIGH(cosb, ti2)
VQDMULH.S32 Q13, Q3, Q8 @ MULHIGH(sinb, tr2)
VADD.S32 Q4, Q10, Q11 @ *buf1-- = MULHIGH(cosa, tr2) + MULHIGH(sina, ti2)@
VSUB.S32 Q1, Q13, Q12 @ *buf0++ = MULHIGH(sina, tr2) - MULHIGH(cosa, ti2)@
VREV64.32 Q2, Q4
VREV64.32 Q3, Q5
sub r3, r3, #32
VST2.I32 {d0, d1, d2, d3}, [r0]!
VST2.I32 {d5, d7}, [r3]!
VST2.I32 {d4, d6}, [r3]!
subs r1, r1, #4
sub r3, r3, #64
bne PostMDCT_LOOP
PostMDCT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |PostMDCT|
.end

View File

@@ -1,146 +1,146 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: R4R8First_v7.s
@
@ Content: Radix8First and Radix4First function armv7 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix8First
Radix8First:
stmdb sp!, {r4 - r11, lr}
ldr r3, SQRT1_2
cmp r1, #0
VDUP.I32 Q15, r3
beq Radix8First_END
Radix8First_LOOP:
VLD1.I32 {d0, d1, d2, d3}, [r0]!
VLD1.I32 {d8, d9, d10, d11}, [r0]!
VADD.S32 d4, d0, d1 @ r0 = buf[0] + buf[2]@i0 = buf[1] + buf[3]@
VSUB.S32 d5, d0, d1 @ r1 = buf[0] - buf[2]@i1 = buf[1] - buf[3]@
VSUB.S32 d7, d2, d3 @ r2 = buf[4] - buf[6]@i2 = buf[5] - buf[7]@
VADD.S32 d6, d2, d3 @ r3 = buf[4] + buf[6]@i3 = buf[5] + buf[7]@
VREV64.I32 d7, d7
VADD.S32 Q0, Q2, Q3 @ r4 = (r0 + r2)@i4 = (i0 + i2)@i6 = (i1 + r3)@r7 = (r1 + i3)
VSUB.S32 Q1, Q2, Q3 @ r5 = (r0 - r2)@i5 = (i0 - i2)@r6 = (r1 - i3)@i7 = (i1 - r3)@
VREV64.I32 d3, d3
VADD.S32 d4, d8, d9 @ r0 = buf[ 8] + buf[10]@i0 = buf[ 9] + buf[11]@
VSUB.S32 d7, d10, d11 @ r1 = buf[12] - buf[14]@i1 = buf[13] - buf[15]@
VADD.S32 d6, d10, d11 @ r2 = buf[12] + buf[14]@i2 = buf[13] + buf[15]@
VREV64.I32 d7, d7
VSUB.S32 d5, d8, d9 @ r3 = buf[ 8] - buf[10]@i3 = buf[ 9] - buf[11]@
VTRN.32 d1, d3
VADD.S32 Q4, Q2, Q3 @ t0 = (r0 + r2) >> 1@t1 = (i0 + i2) >> 1@i0 = i1 + r3@r2 = r1 + i3@
VSUB.S32 Q5, Q2, Q3 @ t2 = (r0 - r2) >> 1@t3 = (i0 - i2) >> 1@r0 = r1 - i3@i2 = i1 - r3@
VREV64.I32 d3, d3
VSHR.S32 d8, d8, #1
VSHR.S32 Q0, Q0, #1
VREV64.I32 d10, d10
VTRN.32 d11, d9
VSHR.S32 Q1, Q1, #1
VSHR.S32 d10, d10, #1
VREV64.I32 d9, d9
sub r0, r0, #0x40
VADD.S32 d12, d0, d8
VSUB.S32 d16, d0, d8
VADD.S32 d14, d2, d10
VSUB.S32 d18, d2, d10
VSUB.S32 d4, d11, d9
VADD.S32 d5, d11, d9
VREV64.I32 d18, d18
VQDMULH.S32 Q3, Q2, Q15
VTRN.32 d14, d18
VTRN.32 d6, d7
VREV64.I32 d18, d18
VSUB.S32 d15, d3, d6
VREV64.I32 d7, d7
VADD.S32 d19, d3, d6
VADD.S32 d13, d1, d7
VSUB.S32 d17, d1, d7
VREV64.I32 d17, d17
VTRN.32 d13, d17
VREV64.I32 d17, d17
subs r1, r1, #1
VST1.I32 {d12, d13, d14, d15}, [r0]!
VST1.I32 {d16, d17, d18, d19}, [r0]!
bne Radix8First_LOOP
Radix8First_END:
ldmia sp!, {r4 - r11, pc}
SQRT1_2:
.word 0x2d413ccd
@ENDP @ |Radix8First|
.section .text
.global Radix4First
Radix4First:
stmdb sp!, {r4 - r11, lr}
cmp r1, #0
beq Radix4First_END
Radix4First_LOOP:
VLD1.I32 {d0, d1, d2, d3}, [r0]
VADD.S32 d4, d0, d1 @ r0 = buf[0] + buf[2]@ r1 = buf[1] + buf[3]@
VSUB.S32 d5, d0, d1 @ r2 = buf[0] - buf[2]@ r3 = buf[1] - buf[3]@
VSUB.S32 d7, d2, d3 @ r4 = buf[4] + buf[6]@ r5 = buf[5] + buf[7]@
VADD.S32 d6, d2, d3 @ r6 = buf[4] - buf[6]@ r7 = buf[5] - buf[7]@
VREV64.I32 d7, d7 @
VADD.S32 Q4, Q2, Q3
VSUB.S32 Q5, Q2, Q3
VREV64.I32 d11, d11
VTRN.32 d9, d11
subs r1, r1, #1
VREV64.I32 d11, d11
VST1.I32 {d8, d9, d10, d11}, [r0]!
bne Radix4First_LOOP
Radix4First_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4First|
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: R4R8First_v7.s
@
@ Content: Radix8First and Radix4First function armv7 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix8First
Radix8First:
stmdb sp!, {r4 - r11, lr}
ldr r3, SQRT1_2
cmp r1, #0
VDUP.I32 Q15, r3
beq Radix8First_END
Radix8First_LOOP:
VLD1.I32 {d0, d1, d2, d3}, [r0]!
VLD1.I32 {d8, d9, d10, d11}, [r0]!
VADD.S32 d4, d0, d1 @ r0 = buf[0] + buf[2]@i0 = buf[1] + buf[3]@
VSUB.S32 d5, d0, d1 @ r1 = buf[0] - buf[2]@i1 = buf[1] - buf[3]@
VSUB.S32 d7, d2, d3 @ r2 = buf[4] - buf[6]@i2 = buf[5] - buf[7]@
VADD.S32 d6, d2, d3 @ r3 = buf[4] + buf[6]@i3 = buf[5] + buf[7]@
VREV64.I32 d7, d7
VADD.S32 Q0, Q2, Q3 @ r4 = (r0 + r2)@i4 = (i0 + i2)@i6 = (i1 + r3)@r7 = (r1 + i3)
VSUB.S32 Q1, Q2, Q3 @ r5 = (r0 - r2)@i5 = (i0 - i2)@r6 = (r1 - i3)@i7 = (i1 - r3)@
VREV64.I32 d3, d3
VADD.S32 d4, d8, d9 @ r0 = buf[ 8] + buf[10]@i0 = buf[ 9] + buf[11]@
VSUB.S32 d7, d10, d11 @ r1 = buf[12] - buf[14]@i1 = buf[13] - buf[15]@
VADD.S32 d6, d10, d11 @ r2 = buf[12] + buf[14]@i2 = buf[13] + buf[15]@
VREV64.I32 d7, d7
VSUB.S32 d5, d8, d9 @ r3 = buf[ 8] - buf[10]@i3 = buf[ 9] - buf[11]@
VTRN.32 d1, d3
VADD.S32 Q4, Q2, Q3 @ t0 = (r0 + r2) >> 1@t1 = (i0 + i2) >> 1@i0 = i1 + r3@r2 = r1 + i3@
VSUB.S32 Q5, Q2, Q3 @ t2 = (r0 - r2) >> 1@t3 = (i0 - i2) >> 1@r0 = r1 - i3@i2 = i1 - r3@
VREV64.I32 d3, d3
VSHR.S32 d8, d8, #1
VSHR.S32 Q0, Q0, #1
VREV64.I32 d10, d10
VTRN.32 d11, d9
VSHR.S32 Q1, Q1, #1
VSHR.S32 d10, d10, #1
VREV64.I32 d9, d9
sub r0, r0, #0x40
VADD.S32 d12, d0, d8
VSUB.S32 d16, d0, d8
VADD.S32 d14, d2, d10
VSUB.S32 d18, d2, d10
VSUB.S32 d4, d11, d9
VADD.S32 d5, d11, d9
VREV64.I32 d18, d18
VQDMULH.S32 Q3, Q2, Q15
VTRN.32 d14, d18
VTRN.32 d6, d7
VREV64.I32 d18, d18
VSUB.S32 d15, d3, d6
VREV64.I32 d7, d7
VADD.S32 d19, d3, d6
VADD.S32 d13, d1, d7
VSUB.S32 d17, d1, d7
VREV64.I32 d17, d17
VTRN.32 d13, d17
VREV64.I32 d17, d17
subs r1, r1, #1
VST1.I32 {d12, d13, d14, d15}, [r0]!
VST1.I32 {d16, d17, d18, d19}, [r0]!
bne Radix8First_LOOP
Radix8First_END:
ldmia sp!, {r4 - r11, pc}
SQRT1_2:
.word 0x2d413ccd
@ENDP @ |Radix8First|
.section .text
.global Radix4First
Radix4First:
stmdb sp!, {r4 - r11, lr}
cmp r1, #0
beq Radix4First_END
Radix4First_LOOP:
VLD1.I32 {d0, d1, d2, d3}, [r0]
VADD.S32 d4, d0, d1 @ r0 = buf[0] + buf[2]@ r1 = buf[1] + buf[3]@
VSUB.S32 d5, d0, d1 @ r2 = buf[0] - buf[2]@ r3 = buf[1] - buf[3]@
VSUB.S32 d7, d2, d3 @ r4 = buf[4] + buf[6]@ r5 = buf[5] + buf[7]@
VADD.S32 d6, d2, d3 @ r6 = buf[4] - buf[6]@ r7 = buf[5] - buf[7]@
VREV64.I32 d7, d7 @
VADD.S32 Q4, Q2, Q3
VSUB.S32 Q5, Q2, Q3
VREV64.I32 d11, d11
VTRN.32 d9, d11
subs r1, r1, #1
VREV64.I32 d11, d11
VST1.I32 {d8, d9, d10, d11}, [r0]!
bne Radix4First_LOOP
Radix4First_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4First|
.end

View File

@@ -1,143 +1,143 @@
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: Radix4FFT_v7.s
@
@ Content: Radix4FFT armv7 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix4FFT
Radix4FFT:
stmdb sp!, {r4 - r11, lr}
mov r1, r1, asr #2
cmp r1, #0
beq Radix4FFT_END
Radix4FFT_LOOP1:
mov r5, r2, lsl #1
mov r8, r0
mov r7, r1
mov r5, r5, lsl #2
cmp r1, #0
rsbeq r12, r5, r5, lsl #2
beq Radix4FFT_LOOP1_END
rsb r12, r5, r5, lsl #2
Radix4FFT_LOOP2:
mov r6, r3
mov r4, r2
cmp r2, #0
beq Radix4FFT_LOOP2_END
Radix4FFT_LOOP3:
@r0 = xptr[0]@
@r1 = xptr[1]@
VLD2.I32 {D0, D1, D2, D3}, [r8]
VLD2.I32 {D28, D29, D30, D31}, [r6]! @ cosx = csptr[0]@ sinx = csptr[1]@
add r8, r8, r5 @ xptr += step@
VLD2.I32 {D4, D5, D6,D7}, [r8] @ r2 = xptr[0]@ r3 = xptr[1]@
VQDMULH.S32 Q10, Q2, Q14 @ MULHIGH(cosx, t0)
VQDMULH.S32 Q11, Q3, Q15 @ MULHIGH(sinx, t1)
VQDMULH.S32 Q12, Q3, Q14 @ MULHIGH(cosx, t1)
VQDMULH.S32 Q13, Q2, Q15 @ MULHIGH(sinx, t0)
VADD.S32 Q2, Q10, Q11 @ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
VSUB.S32 Q3, Q12, Q13 @ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
add r8, r8, r5 @ xptr += step@
VSHR.S32 Q10, Q0, #2 @ t0 = r0 >> 2@
VSHR.S32 Q11, Q1, #2 @ t1 = r1 >> 2@
VSUB.S32 Q0, Q10, Q2 @ r0 = t0 - r2@
VSUB.S32 Q1, Q11, Q3 @ r1 = t1 - r3@
VADD.S32 Q2, Q10, Q2 @ r2 = t0 + r2@
VADD.S32 Q3, Q11, Q3 @ r3 = t1 + r3@
VLD2.I32 {D8, D9, D10, D11}, [r8]
VLD2.I32 {D28, D29, D30, D31}, [r6]!
add r8, r8, r5
VQDMULH.S32 Q10, Q4, Q14 @ MULHIGH(cosx, t0)
VQDMULH.S32 Q11, Q5, Q15 @ MULHIGH(sinx, t1)
VQDMULH.S32 Q12, Q5, Q14 @ MULHIGH(cosx, t1)
VQDMULH.S32 Q13, Q4, Q15 @ MULHIGH(sinx, t0)
VADD.S32 Q8, Q10, Q11 @ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
VSUB.S32 Q9, Q12, Q13 @ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
VLD2.I32 {D12, D13, D14, D15}, [r8]
VLD2.I32 {D28, D29, D30, D31}, [r6]!
VQDMULH.S32 Q10, Q6, Q14 @ MULHIGH(cosx, t0)
VQDMULH.S32 Q11, Q7, Q15 @ MULHIGH(sinx, t1)
VQDMULH.S32 Q12, Q7, Q14 @ MULHIGH(cosx, t1)
VQDMULH.S32 Q13, Q6, Q15 @ MULHIGH(sinx, t0)
VADD.S32 Q6, Q10, Q11 @ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
VSUB.S32 Q7, Q12, Q13 @ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
VADD.S32 Q4, Q8, Q6 @ r4 = t0 + r6@
VSUB.S32 Q5, Q7, Q9 @ r5 = r7 - t1@
VSUB.S32 Q6, Q8, Q6 @ r6 = t0 - r6@
VADD.S32 Q7, Q7, Q9 @ r7 = r7 + t1@
VADD.S32 Q8, Q0, Q5 @ xptr[0] = r0 + r5@
VADD.S32 Q9, Q1, Q6 @ xptr[1] = r1 + r6@
VST2.I32 {D16, D17, D18, D19}, [r8]
VSUB.S32 Q10, Q2, Q4 @ xptr[0] = r2 - r4@
sub r8, r8, r5 @ xptr -= step@
VSUB.S32 Q11, Q3, Q7 @ xptr[1] = r3 - r7@
VST2.I32 {D20, D21, D22, D23}, [r8]
VSUB.S32 Q8, Q0, Q5 @ xptr[0] = r0 - r5@
sub r8, r8, r5 @ xptr -= step@
VSUB.S32 Q9, Q1, Q6 @ xptr[1] = r1 - r6@
VST2.I32 {D16, D17, D18, D19}, [r8]
VADD.S32 Q10, Q2, Q4 @ xptr[0] = r2 + r4@
sub r8, r8, r5 @ xptr -= step@
VADD.S32 Q11, Q3, Q7 @ xptr[1] = r3 + r7@
VST2.I32 {D20, D21, D22, D23}, [r8]!
subs r4, r4, #4
bne Radix4FFT_LOOP3
Radix4FFT_LOOP2_END:
add r8, r8, r12
sub r7, r7, #1
cmp r7, #0
bhi Radix4FFT_LOOP2
Radix4FFT_LOOP1_END:
add r3, r12, r3
mov r2, r2, lsl #2
movs r1, r1, asr #2
bne Radix4FFT_LOOP1
Radix4FFT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4FFT|
@/*
@ ** Copyright 2003-2010, VisualOn, Inc.
@ **
@ ** Licensed under the Apache License, Version 2.0 (the "License");
@ ** you may not use this file except in compliance with the License.
@ ** You may obtain a copy of the License at
@ **
@ ** http://www.apache.org/licenses/LICENSE-2.0
@ **
@ ** Unless required by applicable law or agreed to in writing, software
@ ** distributed under the License is distributed on an "AS IS" BASIS,
@ ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ ** See the License for the specific language governing permissions and
@ ** limitations under the License.
@ */
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ File: Radix4FFT_v7.s
@
@ Content: Radix4FFT armv7 assemble
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.section .text
.global Radix4FFT
Radix4FFT:
stmdb sp!, {r4 - r11, lr}
mov r1, r1, asr #2
cmp r1, #0
beq Radix4FFT_END
Radix4FFT_LOOP1:
mov r5, r2, lsl #1
mov r8, r0
mov r7, r1
mov r5, r5, lsl #2
cmp r1, #0
rsbeq r12, r5, r5, lsl #2
beq Radix4FFT_LOOP1_END
rsb r12, r5, r5, lsl #2
Radix4FFT_LOOP2:
mov r6, r3
mov r4, r2
cmp r2, #0
beq Radix4FFT_LOOP2_END
Radix4FFT_LOOP3:
@r0 = xptr[0]@
@r1 = xptr[1]@
VLD2.I32 {D0, D1, D2, D3}, [r8]
VLD2.I32 {D28, D29, D30, D31}, [r6]! @ cosx = csptr[0]@ sinx = csptr[1]@
add r8, r8, r5 @ xptr += step@
VLD2.I32 {D4, D5, D6,D7}, [r8] @ r2 = xptr[0]@ r3 = xptr[1]@
VQDMULH.S32 Q10, Q2, Q14 @ MULHIGH(cosx, t0)
VQDMULH.S32 Q11, Q3, Q15 @ MULHIGH(sinx, t1)
VQDMULH.S32 Q12, Q3, Q14 @ MULHIGH(cosx, t1)
VQDMULH.S32 Q13, Q2, Q15 @ MULHIGH(sinx, t0)
VADD.S32 Q2, Q10, Q11 @ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
VSUB.S32 Q3, Q12, Q13 @ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
add r8, r8, r5 @ xptr += step@
VSHR.S32 Q10, Q0, #2 @ t0 = r0 >> 2@
VSHR.S32 Q11, Q1, #2 @ t1 = r1 >> 2@
VSUB.S32 Q0, Q10, Q2 @ r0 = t0 - r2@
VSUB.S32 Q1, Q11, Q3 @ r1 = t1 - r3@
VADD.S32 Q2, Q10, Q2 @ r2 = t0 + r2@
VADD.S32 Q3, Q11, Q3 @ r3 = t1 + r3@
VLD2.I32 {D8, D9, D10, D11}, [r8]
VLD2.I32 {D28, D29, D30, D31}, [r6]!
add r8, r8, r5
VQDMULH.S32 Q10, Q4, Q14 @ MULHIGH(cosx, t0)
VQDMULH.S32 Q11, Q5, Q15 @ MULHIGH(sinx, t1)
VQDMULH.S32 Q12, Q5, Q14 @ MULHIGH(cosx, t1)
VQDMULH.S32 Q13, Q4, Q15 @ MULHIGH(sinx, t0)
VADD.S32 Q8, Q10, Q11 @ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
VSUB.S32 Q9, Q12, Q13 @ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
VLD2.I32 {D12, D13, D14, D15}, [r8]
VLD2.I32 {D28, D29, D30, D31}, [r6]!
VQDMULH.S32 Q10, Q6, Q14 @ MULHIGH(cosx, t0)
VQDMULH.S32 Q11, Q7, Q15 @ MULHIGH(sinx, t1)
VQDMULH.S32 Q12, Q7, Q14 @ MULHIGH(cosx, t1)
VQDMULH.S32 Q13, Q6, Q15 @ MULHIGH(sinx, t0)
VADD.S32 Q6, Q10, Q11 @ MULHIGH(cosx, t0) + MULHIGH(sinx, t1)
VSUB.S32 Q7, Q12, Q13 @ MULHIGH(cosx, t1) - MULHIGH(sinx, t0)
VADD.S32 Q4, Q8, Q6 @ r4 = t0 + r6@
VSUB.S32 Q5, Q7, Q9 @ r5 = r7 - t1@
VSUB.S32 Q6, Q8, Q6 @ r6 = t0 - r6@
VADD.S32 Q7, Q7, Q9 @ r7 = r7 + t1@
VADD.S32 Q8, Q0, Q5 @ xptr[0] = r0 + r5@
VADD.S32 Q9, Q1, Q6 @ xptr[1] = r1 + r6@
VST2.I32 {D16, D17, D18, D19}, [r8]
VSUB.S32 Q10, Q2, Q4 @ xptr[0] = r2 - r4@
sub r8, r8, r5 @ xptr -= step@
VSUB.S32 Q11, Q3, Q7 @ xptr[1] = r3 - r7@
VST2.I32 {D20, D21, D22, D23}, [r8]
VSUB.S32 Q8, Q0, Q5 @ xptr[0] = r0 - r5@
sub r8, r8, r5 @ xptr -= step@
VSUB.S32 Q9, Q1, Q6 @ xptr[1] = r1 - r6@
VST2.I32 {D16, D17, D18, D19}, [r8]
VADD.S32 Q10, Q2, Q4 @ xptr[0] = r2 + r4@
sub r8, r8, r5 @ xptr -= step@
VADD.S32 Q11, Q3, Q7 @ xptr[1] = r3 + r7@
VST2.I32 {D20, D21, D22, D23}, [r8]!
subs r4, r4, #4
bne Radix4FFT_LOOP3
Radix4FFT_LOOP2_END:
add r8, r8, r12
sub r7, r7, #1
cmp r7, #0
bhi Radix4FFT_LOOP2
Radix4FFT_LOOP1_END:
add r3, r12, r3
mov r2, r2, lsl #2
movs r1, r1, asr #2
bne Radix4FFT_LOOP1
Radix4FFT_END:
ldmia sp!, {r4 - r11, pc}
@ENDP @ |Radix4FFT|
.end

View File

@@ -1,35 +1,35 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: band_nrg.c
Content: Band/Line energy calculations functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: band_nrg.c
Content: Band/Line energy calculations functions
*******************************************************************************/
#include "basic_op.h"
#include "basic_op.h"
#include "band_nrg.h"
#ifndef ARMV5E
#ifndef ARMV5E
/********************************************************************************
*
* function name: CalcBandEnergy
* description: Calc sfb-bandwise mdct-energies for left and right channel
*
**********************************************************************************/
**********************************************************************************/
void CalcBandEnergy(const Word32 *mdctSpectrum,
const Word16 *bandOffset,
const Word16 numBands,
@@ -42,8 +42,8 @@ void CalcBandEnergy(const Word32 *mdctSpectrum,
for (i=0; i<numBands; i++) {
Word32 accu = 0;
for (j=bandOffset[i]; j<bandOffset[i+1]; j++)
accu = L_add(accu, MULHIGH(mdctSpectrum[j], mdctSpectrum[j]));
accu = L_add(accu, MULHIGH(mdctSpectrum[j], mdctSpectrum[j]));
accu = L_add(accu, accu);
accuSum = L_add(accuSum, accu);
bandEnergy[i] = accu;
@@ -86,9 +86,9 @@ void CalcBandEnergyMS(const Word32 *mdctSpectrumLeft,
accuMid = L_add(accuMid, MULHIGH(specm, specm));
accuSide = L_add(accuSide, MULHIGH(specs, specs));
}
accuMid = L_add(accuMid, accuMid);
accuSide = L_add(accuSide, accuSide);
accuMid = L_add(accuMid, accuMid);
accuSide = L_add(accuSide, accuSide);
bandEnergyMid[i] = accuMid;
accuMidSum = L_add(accuMidSum, accuMid);
bandEnergySide[i] = accuSide;

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitbuffer.c
Content: Bit Buffer Management functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitbuffer.c
Content: Bit Buffer Management functions
*******************************************************************************/
#include "bitbuffer.h"
@@ -81,7 +81,7 @@ HANDLE_BIT_BUF CreateBitBuffer(HANDLE_BIT_BUF hBitBuf,
*****************************************************************************/
void DeleteBitBuffer(HANDLE_BIT_BUF *hBitBuf)
{
if(*hBitBuf)
if(*hBitBuf)
(*hBitBuf)->isValid = 0;
*hBitBuf = NULL;
}

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitenc.c
Content: Bitstream encoder functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: bitenc.c
Content: Bitstream encoder functions
*******************************************************************************/
#include "bitenc.h"
@@ -49,7 +49,7 @@ static Word32 encodeSpectralData(Word16 *sfbOffset,
dbgVal = GetBitsAvail(hBitStream);
for(i=0; i<sectionData->noOfSections; i++) {
psectioninfo = &(sectionData->sectionInfo[i]);
psectioninfo = &(sectionData->sectionInfo[i]);
/*
huffencode spectral data for this section
*/
@@ -564,7 +564,7 @@ static void writeFillElement( const UWord8 *ancBytes,
}
}
}
/*****************************************************************************
*
* function name: WriteBitStream
@@ -577,39 +577,39 @@ Word16 WriteBitstream (HANDLE_BIT_BUF hBitStream,
QC_OUT *qcOut,
PSY_OUT *psyOut,
Word16 *globUsedBits,
const UWord8 *ancBytes,
const UWord8 *ancBytes,
Word16 sampindex
) /* returns error code */
{
Word16 bitMarkUp;
Word16 elementUsedBits;
Word16 frameBits=0;
/* struct bitbuffer bsWriteCopy; */
bitMarkUp = GetBitsAvail(hBitStream);
if(qcOut->qcElement.adtsUsed) /* write adts header*/
{
WriteBits(hBitStream, 0xFFF, 12); /* 12 bit Syncword */
WriteBits(hBitStream, 1, 1); /* ID == 0 for MPEG4 AAC, 1 for MPEG2 AAC */
WriteBits(hBitStream, 0, 2); /* layer == 0 */
WriteBits(hBitStream, 1, 1); /* protection absent */
WriteBits(hBitStream, 1, 2); /* profile */
WriteBits(hBitStream, sampindex, 4); /* sampling rate */
WriteBits(hBitStream, 0, 1); /* private bit */
WriteBits(hBitStream, elInfo.nChannelsInEl, 3); /* ch. config (must be > 0) */
/* simply using numChannels only works for
6 channels or less, else a channel
configuration should be written */
WriteBits(hBitStream, 0, 1); /* original/copy */
WriteBits(hBitStream, 0, 1); /* home */
/* Variable ADTS header */
WriteBits(hBitStream, 0, 1); /* copyr. id. bit */
WriteBits(hBitStream, 0, 1); /* copyr. id. start */
WriteBits(hBitStream, *globUsedBits >> 3, 13);
WriteBits(hBitStream, 0x7FF, 11); /* buffer fullness (0x7FF for VBR) */
WriteBits(hBitStream, 0, 2); /* raw data blocks (0+1=1) */
}
Word16 frameBits=0;
/* struct bitbuffer bsWriteCopy; */
bitMarkUp = GetBitsAvail(hBitStream);
if(qcOut->qcElement.adtsUsed) /* write adts header*/
{
WriteBits(hBitStream, 0xFFF, 12); /* 12 bit Syncword */
WriteBits(hBitStream, 1, 1); /* ID == 0 for MPEG4 AAC, 1 for MPEG2 AAC */
WriteBits(hBitStream, 0, 2); /* layer == 0 */
WriteBits(hBitStream, 1, 1); /* protection absent */
WriteBits(hBitStream, 1, 2); /* profile */
WriteBits(hBitStream, sampindex, 4); /* sampling rate */
WriteBits(hBitStream, 0, 1); /* private bit */
WriteBits(hBitStream, elInfo.nChannelsInEl, 3); /* ch. config (must be > 0) */
/* simply using numChannels only works for
6 channels or less, else a channel
configuration should be written */
WriteBits(hBitStream, 0, 1); /* original/copy */
WriteBits(hBitStream, 0, 1); /* home */
/* Variable ADTS header */
WriteBits(hBitStream, 0, 1); /* copyr. id. bit */
WriteBits(hBitStream, 0, 1); /* copyr. id. start */
WriteBits(hBitStream, *globUsedBits >> 3, 13);
WriteBits(hBitStream, 0x7FF, 11); /* buffer fullness (0x7FF for VBR) */
WriteBits(hBitStream, 0, 2); /* raw data blocks (0+1=1) */
}
*globUsedBits=0;

View File

@@ -1,27 +1,27 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: block_switch.c
Content: Block switching functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: block_switch.c
Content: Block switching functions
*******************************************************************************/
#include "typedef.h"
#include "basic_op.h"
#include "typedef.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "psy_const.h"
#include "block_switch.h"
@@ -132,7 +132,7 @@ Word16 BlockSwitching(BLOCK_SWITCHING_CONTROL *blockSwitchingControl,
for (i=0; i<MAX_NO_OF_GROUPS; i++) {
blockSwitchingControl->groupLen[i] = suggestedGroupingTable[blockSwitchingControl->attackIndex][i];
}
}
/* if the samplerate is less than 16000, it should be all the short block, avoid pre&post echo */
if(sampleRate >= 16000) {
@@ -274,7 +274,7 @@ static Word32 SrchMaxWithIndex(const Word32 in[], Word16 *index, Word16 n)
* returns: TRUE if success
*
**********************************************************************************/
#ifndef ARMV5E
#ifndef ARMV5E
Word32 CalcWindowEnergy(BLOCK_SWITCHING_CONTROL *blockSwitchingControl,
Word16 *timeSignal,
Word16 chIncrement,
@@ -283,14 +283,14 @@ Word32 CalcWindowEnergy(BLOCK_SWITCHING_CONTROL *blockSwitchingControl,
Word32 w, i, wOffset, tidx, ch;
Word32 accuUE, accuFE;
Word32 tempUnfiltered;
Word32 tempFiltered;
Word32 states0, states1;
Word32 Coeff0, Coeff1;
Word32 tempFiltered;
Word32 states0, states1;
Word32 Coeff0, Coeff1;
states0 = blockSwitchingControl->iirStates[0];
states1 = blockSwitchingControl->iirStates[1];
Coeff0 = hiPassCoeff[0];
states0 = blockSwitchingControl->iirStates[0];
states1 = blockSwitchingControl->iirStates[1];
Coeff0 = hiPassCoeff[0];
Coeff1 = hiPassCoeff[1];
tidx = 0;
for (w=0; w < BLOCK_SWITCH_WINDOWS; w++) {
@@ -299,19 +299,19 @@ Word32 CalcWindowEnergy(BLOCK_SWITCHING_CONTROL *blockSwitchingControl,
accuFE = 0;
for(i=0; i<windowLen; i++) {
Word32 accu1, accu2, accu3;
Word32 out;
Word32 accu1, accu2, accu3;
Word32 out;
tempUnfiltered = timeSignal[tidx];
tidx = tidx + chIncrement;
accu1 = L_mpy_ls(Coeff1, tempUnfiltered);
accu2 = fixmul( Coeff0, states1 );
accu3 = accu1 - states0;
out = accu3 - accu2;
states0 = accu1;
states1 = out;
accu1 = L_mpy_ls(Coeff1, tempUnfiltered);
accu2 = fixmul( Coeff0, states1 );
accu3 = accu1 - states0;
out = accu3 - accu2;
states0 = accu1;
states1 = out;
tempFiltered = extract_h(out);
accuUE += (tempUnfiltered * tempUnfiltered) >> ENERGY_SHIFT;
accuFE += (tempFiltered * tempFiltered) >> ENERGY_SHIFT;
@@ -320,9 +320,9 @@ Word32 CalcWindowEnergy(BLOCK_SWITCHING_CONTROL *blockSwitchingControl,
blockSwitchingControl->windowNrg[1][w] = accuUE;
blockSwitchingControl->windowNrgF[1][w] = accuFE;
}
blockSwitchingControl->iirStates[0] = states0;
}
blockSwitchingControl->iirStates[0] = states0;
blockSwitchingControl->iirStates[1] = states1;
return(TRUE);

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: channel_map.c
Content: channel mapping functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: channel_map.c
Content: channel mapping functions
*******************************************************************************/
#include "channel_map.h"

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: dyn_bits.c
Content: Noiseless coder module functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: dyn_bits.c
Content: Noiseless coder module functions
*******************************************************************************/
#include "aac_rom.h"
@@ -177,14 +177,14 @@ gmStage1(SECTION_INFO * sectionInfo,
const Word16 maxSfb,
const Word16 *sideInfoTab)
{
SECTION_INFO * sectionInfo_s;
SECTION_INFO * sectionInfo_e;
SECTION_INFO * sectionInfo_s;
SECTION_INFO * sectionInfo_e;
Word32 mergeStart, mergeEnd;
mergeStart = 0;
do {
sectionInfo_s = sectionInfo + mergeStart;
sectionInfo_s = sectionInfo + mergeStart;
for (mergeEnd=mergeStart+1; mergeEnd<maxSfb; mergeEnd++) {
sectionInfo_e = sectionInfo + mergeEnd;
if (sectionInfo_s->codeBook != sectionInfo_e->codeBook)
@@ -372,9 +372,9 @@ static void scfCount(const Word16 *scalefacGain,
SECTION_DATA * sectionData)
{
SECTION_INFO *psectionInfo;
SECTION_INFO *psectionInfom;
SECTION_INFO *psectionInfo;
SECTION_INFO *psectionInfom;
/* counter */
Word32 i = 0; /* section counter */
Word32 j = 0; /* sfb counter */
@@ -397,7 +397,7 @@ static void scfCount(const Word16 *scalefacGain,
}
lastValScf = 0;
sectionData->firstScf = 0;
sectionData->firstScf = 0;
psectionInfo = sectionData->sectionInfo;
for (i=0; i<sectionData->noOfSections; i++) {
@@ -406,9 +406,9 @@ static void scfCount(const Word16 *scalefacGain,
sectionData->firstScf = psectionInfo->sfbStart;
lastValScf = scalefacGain[sectionData->firstScf];
break;
}
}
psectionInfo += 1;
}
}
psectionInfo = sectionData->sectionInfo;
for (i=0; i<sectionData->noOfSections; i++, psectionInfo += 1) {
@@ -451,7 +451,7 @@ static void scfCount(const Word16 *scalefacGain,
scfSkipCounter = scfSkipCounter + 1;
}
}
psectionInfom = psectionInfo + 1;
/* search for the next maxValueInSfb[] != 0 in all other sections */
for (m = i + 1; (m < sectionData->noOfSections) && (found == 0); m++) {
@@ -477,8 +477,8 @@ static void scfCount(const Word16 *scalefacGain,
/* count scalefactor skip */
scfSkipCounter = scfSkipCounter + 1;
}
}
}
psectionInfom += 1;
}
@@ -490,7 +490,7 @@ static void scfCount(const Word16 *scalefacGain,
else {
deltaScf = 0;
scfSkipCounter = scfSkipCounter - 1;
}
}
}
else {
deltaScf = lastValScf - scalefacGain[j];
@@ -539,7 +539,7 @@ dynBitCount(const Word16 *quantSpectrum,
sectionData);
return (sectionData->huffmanBits + sectionData->sideInfoBits +
return (sectionData->huffmanBits + sectionData->sideInfoBits +
sectionData->scalefacBits);
}

View File

@@ -1,26 +1,26 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: grp_data.c
Content: Short block grouping function
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: grp_data.c
Content: Short block grouping function
*******************************************************************************/
#include "basic_op.h"
#include "basic_op.h"
#include "psy_const.h"
#include "interface.h"
#include "grp_data.h"
@@ -179,9 +179,9 @@ groupShortData(Word32 *mdctSpectrum,
}
for(i=0;i<FRAME_LEN_LONG;i+=4) {
mdctSpectrum[i] = tmpSpectrum[i];
mdctSpectrum[i+1] = tmpSpectrum[i+1];
mdctSpectrum[i+2] = tmpSpectrum[i+2];
mdctSpectrum[i] = tmpSpectrum[i];
mdctSpectrum[i+1] = tmpSpectrum[i+1];
mdctSpectrum[i+2] = tmpSpectrum[i+2];
mdctSpectrum[i+3] = tmpSpectrum[i+3];
}
}

View File

@@ -1,27 +1,27 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: interface.c
Content: Interface psychoaccoustic/quantizer functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: interface.c
Content: Interface psychoaccoustic/quantizer functions
*******************************************************************************/
#include "basic_op.h"
#include "oper_32b.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "psy_const.h"
#include "interface.h"
@@ -50,7 +50,7 @@ void BuildInterface(Word32 *groupedMdctSpectrum,
{
Word32 j;
Word32 grp;
Word32 mask;
Word32 mask;
Word16 *tmpV;
/*
@@ -70,11 +70,11 @@ void BuildInterface(Word32 *groupedMdctSpectrum,
psyOutCh->sfbThreshold = groupedSfbThreshold->sfbLong;
psyOutCh->sfbSpreadedEnergy = groupedSfbSpreadedEnergy->sfbLong;
tmpV = psyOutCh->sfbOffsets;
tmpV = psyOutCh->sfbOffsets;
for(j=0; j<groupedSfbCnt + 1; j++) {
*tmpV++ = groupedSfbOffset[j];
}
tmpV = psyOutCh->sfbMinSnr;
for(j=0;j<groupedSfbCnt; j++) {
*tmpV++ = groupedSfbMinSnr[j];
@@ -98,8 +98,8 @@ void BuildInterface(Word32 *groupedMdctSpectrum,
else {
Word32 i;
Word32 accuSumMS=0;
Word32 accuSumLR=0;
Word32 *pSumMS = sfbEnergySumMS.sfbShort;
Word32 accuSumLR=0;
Word32 *pSumMS = sfbEnergySumMS.sfbShort;
Word32 *pSumLR = sfbEnergySumLR.sfbShort;
for (i=TRANS_FAC; i; i--) {

View File

@@ -1,26 +1,26 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: line_pe.c
Content: Perceptual entropie module functions
*******************************************************************************/
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: line_pe.c
#include "basic_op.h"
Content: Perceptual entropie module functions
*******************************************************************************/
#include "basic_op.h"
#include "oper_32b.h"
#include "typedef.h"
#include "line_pe.h"
@@ -75,7 +75,7 @@ void calcSfbPe(PE_DATA *peData,
Word32 ch;
Word32 sfbGrp, sfb;
Word32 nLines4;
Word32 ldThr, ldRatio;
Word32 ldThr, ldRatio;
Word32 pe, constPart, nActiveLines;
peData->pe = peData->offset;
@@ -95,7 +95,7 @@ void calcSfbPe(PE_DATA *peData,
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
Word32 nrg = sfbEnergy[sfbGrp+sfb];
Word32 thres = sfbThreshold[sfbGrp+sfb];
Word32 sfbLDEn = peChanData->sfbLdEnergy[sfbGrp+sfb];
Word32 sfbLDEn = peChanData->sfbLdEnergy[sfbGrp+sfb];
if (nrg > thres) {
ldThr = iLog4(thres);
@@ -111,10 +111,10 @@ void calcSfbPe(PE_DATA *peData,
}
else {
/* sfbPe = nl*(c2 + c3*log2(en/thr))*/
peChanData->sfbPe[sfbGrp+sfb] = extract_l((L_mpy_wx(
(C2_I + C3_I * ldRatio * 2) << 4, nLines4) + 4) >> 3);
peChanData->sfbConstPart[sfbGrp+sfb] = extract_l(( L_mpy_wx(
(C2_I + C3_I * sfbLDEn * 2) << 4, nLines4) + 4) >> 3);
peChanData->sfbPe[sfbGrp+sfb] = extract_l((L_mpy_wx(
(C2_I + C3_I * ldRatio * 2) << 4, nLines4) + 4) >> 3);
peChanData->sfbConstPart[sfbGrp+sfb] = extract_l(( L_mpy_wx(
(C2_I + C3_I * sfbLDEn * 2) << 4, nLines4) + 4) >> 3);
nLines4 = (nLines4 * C3_I + (1024<<1)) >> 10;
}
peChanData->sfbNActiveLines[sfbGrp+sfb] = nLines4 >> 2;
@@ -129,10 +129,10 @@ void calcSfbPe(PE_DATA *peData,
nActiveLines = nActiveLines + peChanData->sfbNActiveLines[sfbGrp+sfb];
}
}
peChanData->pe = saturate(pe);
peChanData->constPart = saturate(constPart);
peChanData->nActiveLines = saturate(nActiveLines);
peChanData->pe = saturate(pe);
peChanData->constPart = saturate(constPart);
peChanData->nActiveLines = saturate(nActiveLines);
pe += peData->pe;

View File

@@ -1,26 +1,26 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: ms_stereo.c
Content: MS stereo processing function
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: ms_stereo.c
Content: MS stereo processing function
*******************************************************************************/
#include "basic_op.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "psy_const.h"
#include "ms_stereo.h"
@@ -74,10 +74,10 @@ void MsStereoProcessing(Word32 *sfbEnergyLeft,
minThreshold = min(thrL, thrR);
nrgL = max(nrgL,thrL) + 1;
shift = norm_l(nrgL);
shift = norm_l(nrgL);
nrgL = Div_32(thrL << shift, nrgL << shift);
nrgR = max(nrgR,thrR) + 1;
shift = norm_l(nrgR);
shift = norm_l(nrgR);
nrgR = Div_32(thrR << shift, nrgR << shift);
pnlr = fixmul(nrgL, nrgR);
@@ -86,11 +86,11 @@ void MsStereoProcessing(Word32 *sfbEnergyLeft,
nrgR = sfbEnergySide[idx];
nrgL = max(nrgL,minThreshold) + 1;
shift = norm_l(nrgL);
shift = norm_l(nrgL);
nrgL = Div_32(minThreshold << shift, nrgL << shift);
nrgR = max(nrgR,minThreshold) + 1;
shift = norm_l(nrgR);
shift = norm_l(nrgR);
nrgR = Div_32(minThreshold << shift, nrgR << shift);
pnms = fixmul(nrgL, nrgR);

View File

@@ -1,27 +1,27 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: pre_echo_control.c
Content: Pre echo control functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: pre_echo_control.c
Content: Pre echo control functions
*******************************************************************************/
#include "basic_op.h"
#include "oper_32b.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "oper_32b.h"
#include "pre_echo_control.h"

View File

@@ -1,26 +1,26 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_configuration.c
Content: Psychoaccoustic configuration functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_configuration.c
Content: Psychoaccoustic configuration functions
*******************************************************************************/
#include "basic_op.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "psy_configuration.h"
#include "adj_thr.h"
@@ -29,10 +29,10 @@
#define BARC_SCALE 100 /* integer barc values are scaled with 100 */
#define LOG2_1000 301 /* log2*1000 */
#define PI2_1000 1571 /* pi/2*1000*/
#define ATAN_COEF1 3560 /* 1000/0.280872f*/
#define ATAN_COEF2 281 /* 1000*0.280872f*/
#define LOG2_1000 301 /* log2*1000 */
#define PI2_1000 1571 /* pi/2*1000*/
#define ATAN_COEF1 3560 /* 1000/0.280872f*/
#define ATAN_COEF2 281 /* 1000*0.280872f*/
typedef struct{
@@ -57,30 +57,30 @@ static const Word16 maskLowSprEnLong = 30; /* in 1dB/bark */
static const Word16 maskHighSprEnLong = 20; /* in 1dB/bark */
static const Word16 maskHighSprEnLongLowBr = 15; /* in 1dB/bark */
static const Word16 maskLowSprEnShort = 20; /* in 1dB/bark */
static const Word16 maskHighSprEnShort = 15; /* in 1dB/bark */
static const Word16 c_minRemainingThresholdFactor = 0x0148; /* 0.01 *(1 << 15)*/
static const Word32 c_maxsnr = 0x66666666; /* upper limit is -1 dB */
static const Word32 c_minsnr = 0x00624dd3; /* lower limit is -25 dB */
static const Word32 c_maxClipEnergyLong = 0x77359400; /* 2.0e9f*/
static const Word32 c_maxClipEnergyShort = 0x01dcd650; /* 2.0e9f/(AACENC_TRANS_FAC*AACENC_TRANS_FAC)*/
Word32 GetSRIndex(Word32 sampleRate)
{
if (92017 <= sampleRate) return 0;
if (75132 <= sampleRate) return 1;
if (55426 <= sampleRate) return 2;
if (46009 <= sampleRate) return 3;
if (37566 <= sampleRate) return 4;
if (27713 <= sampleRate) return 5;
if (23004 <= sampleRate) return 6;
if (18783 <= sampleRate) return 7;
if (13856 <= sampleRate) return 8;
if (11502 <= sampleRate) return 9;
if (9391 <= sampleRate) return 10;
return 11;
static const Word16 maskHighSprEnShort = 15; /* in 1dB/bark */
static const Word16 c_minRemainingThresholdFactor = 0x0148; /* 0.01 *(1 << 15)*/
static const Word32 c_maxsnr = 0x66666666; /* upper limit is -1 dB */
static const Word32 c_minsnr = 0x00624dd3; /* lower limit is -25 dB */
static const Word32 c_maxClipEnergyLong = 0x77359400; /* 2.0e9f*/
static const Word32 c_maxClipEnergyShort = 0x01dcd650; /* 2.0e9f/(AACENC_TRANS_FAC*AACENC_TRANS_FAC)*/
Word32 GetSRIndex(Word32 sampleRate)
{
if (92017 <= sampleRate) return 0;
if (75132 <= sampleRate) return 1;
if (55426 <= sampleRate) return 2;
if (46009 <= sampleRate) return 3;
if (37566 <= sampleRate) return 4;
if (27713 <= sampleRate) return 5;
if (23004 <= sampleRate) return 6;
if (18783 <= sampleRate) return 7;
if (13856 <= sampleRate) return 8;
if (11502 <= sampleRate) return 9;
if (9391 <= sampleRate) return 10;
return 11;
}
@@ -89,8 +89,8 @@ Word32 GetSRIndex(Word32 sampleRate)
* function name: atan_1000
* description: calculates 1000*atan(x/1000)
* based on atan approx for x > 0
* atan(x) = x/((float)1.0f+(float)0.280872f*x*x) if x < 1
* = pi/2 - x/((float)0.280872f +x*x) if x >= 1
* atan(x) = x/((float)1.0f+(float)0.280872f*x*x) if x < 1
* = pi/2 - x/((float)0.280872f +x*x) if x >= 1
* return: 1000*atan(x/1000)
*
**********************************************************************************/
@@ -272,7 +272,7 @@ static void initBarcValues(Word16 numPb,
*
* function name: initMinSnr
* description: calculate min snr parameter
* minSnr(n) = 1/(2^sfbPemin(n)/w(n) - 1.5)
* minSnr(n) = 1/(2^sfbPemin(n)/w(n) - 1.5)
*
*****************************************************************************/
static void initMinSnr(const Word32 bitrate,
@@ -303,7 +303,7 @@ static void initMinSnr(const Word32 bitrate,
barcWidth = pbVal1 - pbVal0;
pbVal0 = pbVal1;
/* allow at least 2.4% of pe for each active barc */
/* allow at least 2.4% of pe for each active barc */
pePart = ((pePerWindow * 24) * (max_bark * barcWidth)) /
(pbBarcVal[sfbActive-1] * (sfbOffset[sfb+1] - sfbOffset[sfb]));
@@ -311,15 +311,15 @@ static void initMinSnr(const Word32 bitrate,
pePart = min(pePart, 8400);
pePart = max(pePart, 1400);
/* minSnr(n) = 1/(2^sfbPemin(n)/w(n) - 1.5)*/
/* minSnr(n) = 1/(2^sfbPemin(n)/w(n) - 1.5)*/
/* we add an offset of 2^16 to the pow functions */
/* 0xc000 = 1.5*(1 << 15)*/
/* 0xc000 = 1.5*(1 << 15)*/
snr = pow2_xy((pePart - 16*1000),1000) - 0x0000c000;
if(snr > 0x00008000)
{
shift = norm_l(snr);
if(snr > 0x00008000)
{
shift = norm_l(snr);
snr = Div_32(0x00008000 << shift, snr << shift);
}
else
@@ -347,16 +347,16 @@ Word16 InitPsyConfigurationLong(Word32 bitrate,
Word16 bandwidth,
PSY_CONFIGURATION_LONG *psyConf)
{
Word32 samplerateindex;
Word16 sfbBarcVal[MAX_SFB_LONG];
Word32 samplerateindex;
Word16 sfbBarcVal[MAX_SFB_LONG];
Word16 sfb;
/*
init sfb table
*/
samplerateindex = GetSRIndex(samplerate);
psyConf->sfbCnt = sfBandTotalLong[samplerateindex];
psyConf->sfbOffset = sfBandTabLong + sfBandTabLongOffset[samplerateindex];
*/
samplerateindex = GetSRIndex(samplerate);
psyConf->sfbCnt = sfBandTotalLong[samplerateindex];
psyConf->sfbOffset = sfBandTabLong + sfBandTabLongOffset[samplerateindex];
psyConf->sampRateIdx = samplerateindex;
/*
@@ -429,7 +429,7 @@ Word16 InitPsyConfigurationLong(Word32 bitrate,
Word16 InitPsyConfigurationShort(Word32 bitrate,
Word32 samplerate,
Word16 bandwidth,
PSY_CONFIGURATION_SHORT *psyConf)
PSY_CONFIGURATION_SHORT *psyConf)
{
Word32 samplerateindex;
Word16 sfbBarcVal[MAX_SFB_SHORT];
@@ -437,8 +437,8 @@ Word16 InitPsyConfigurationShort(Word32 bitrate,
/*
init sfb table
*/
samplerateindex = GetSRIndex(samplerate);
psyConf->sfbCnt = sfBandTotalShort[samplerateindex];
samplerateindex = GetSRIndex(samplerate);
psyConf->sfbCnt = sfBandTotalShort[samplerateindex];
psyConf->sfbOffset = sfBandTabShort + sfBandTabShortOffset[samplerateindex];
psyConf->sampRateIdx = samplerateindex;
/*

View File

@@ -1,27 +1,27 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_main.c
Content: Psychoacoustic major functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: psy_main.c
Content: Psychoacoustic major functions
*******************************************************************************/
#include "typedef.h"
#include "basic_op.h"
#include "typedef.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "psy_const.h"
#include "block_switch.h"
@@ -77,27 +77,27 @@ static Word16 advancePsychShortMS (PSY_DATA psyData[MAX_CHANNELS],
*****************************************************************************/
Word16 PsyNew(PSY_KERNEL *hPsy, Word32 nChan, VO_MEM_OPERATOR *pMemOP)
{
Word16 i;
Word32 *mdctSpectrum;
Word32 *scratchTNS;
Word16 *mdctDelayBuffer;
mdctSpectrum = (Word32 *)mem_malloc(pMemOP, nChan * FRAME_LEN_LONG * sizeof(Word32), 32, VO_INDEX_ENC_AAC);
if(NULL == mdctSpectrum)
return 1;
scratchTNS = (Word32 *)mem_malloc(pMemOP, nChan * FRAME_LEN_LONG * sizeof(Word32), 32, VO_INDEX_ENC_AAC);
if(NULL == scratchTNS)
{
return 1;
}
mdctDelayBuffer = (Word16 *)mem_malloc(pMemOP, nChan * BLOCK_SWITCHING_OFFSET * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
if(NULL == mdctDelayBuffer)
{
Word16 i;
Word32 *mdctSpectrum;
Word32 *scratchTNS;
Word16 *mdctDelayBuffer;
mdctSpectrum = (Word32 *)mem_malloc(pMemOP, nChan * FRAME_LEN_LONG * sizeof(Word32), 32, VO_INDEX_ENC_AAC);
if(NULL == mdctSpectrum)
return 1;
}
scratchTNS = (Word32 *)mem_malloc(pMemOP, nChan * FRAME_LEN_LONG * sizeof(Word32), 32, VO_INDEX_ENC_AAC);
if(NULL == scratchTNS)
{
return 1;
}
mdctDelayBuffer = (Word16 *)mem_malloc(pMemOP, nChan * BLOCK_SWITCHING_OFFSET * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
if(NULL == mdctDelayBuffer)
{
return 1;
}
for (i=0; i<nChan; i++){
hPsy->psyData[i].mdctDelayBuffer = mdctDelayBuffer + i*BLOCK_SWITCHING_OFFSET;
hPsy->psyData[i].mdctSpectrum = mdctSpectrum + i*FRAME_LEN_LONG;
@@ -118,27 +118,27 @@ Word16 PsyNew(PSY_KERNEL *hPsy, Word32 nChan, VO_MEM_OPERATOR *pMemOP)
*****************************************************************************/
Word16 PsyDelete(PSY_KERNEL *hPsy, VO_MEM_OPERATOR *pMemOP)
{
Word32 nch;
if(hPsy)
{
if(hPsy->psyData[0].mdctDelayBuffer)
mem_free(pMemOP, hPsy->psyData[0].mdctDelayBuffer, VO_INDEX_ENC_AAC);
if(hPsy->psyData[0].mdctSpectrum)
mem_free(pMemOP, hPsy->psyData[0].mdctSpectrum, VO_INDEX_ENC_AAC);
for (nch=0; nch<MAX_CHANNELS; nch++){
hPsy->psyData[nch].mdctDelayBuffer = NULL;
hPsy->psyData[nch].mdctSpectrum = NULL;
}
if(hPsy->pScratchTns)
{
mem_free(pMemOP, hPsy->pScratchTns, VO_INDEX_ENC_AAC);
hPsy->pScratchTns = NULL;
}
}
Word32 nch;
if(hPsy)
{
if(hPsy->psyData[0].mdctDelayBuffer)
mem_free(pMemOP, hPsy->psyData[0].mdctDelayBuffer, VO_INDEX_ENC_AAC);
if(hPsy->psyData[0].mdctSpectrum)
mem_free(pMemOP, hPsy->psyData[0].mdctSpectrum, VO_INDEX_ENC_AAC);
for (nch=0; nch<MAX_CHANNELS; nch++){
hPsy->psyData[nch].mdctDelayBuffer = NULL;
hPsy->psyData[nch].mdctSpectrum = NULL;
}
if(hPsy->pScratchTns)
{
mem_free(pMemOP, hPsy->pScratchTns, VO_INDEX_ENC_AAC);
hPsy->pScratchTns = NULL;
}
}
return 0;
}
@@ -196,10 +196,10 @@ Word16 psyMainInit(PSY_KERNEL *hPsy,
err = InitPsyConfigurationLong(channelBitRate,
sampleRate,
bandwidth,
&(hPsy->psyConfLong));
&(hPsy->psyConfLong));
if (!err) {
hPsy->sampleRateIdx = hPsy->psyConfLong.sampRateIdx;
hPsy->sampleRateIdx = hPsy->psyConfLong.sampRateIdx;
err = InitTnsConfigurationLong(bitRate, sampleRate, channels,
&hPsy->psyConfLong.tnsConf, &hPsy->psyConfLong, tnsMask&2);
}
@@ -263,7 +263,7 @@ Word16 psyMain(Word16 nChannels,
channels = elemInfo->nChannelsInEl;
maxScale = 0;
/* block switching */
/* block switching */
for(ch = 0; ch < channels; ch++) {
BlockSwitching(&psyData[ch].blockSwitchingControl,
timeSignal+elemInfo->ChannelIndex[ch],
@@ -477,11 +477,11 @@ static Word16 advancePsychLong(PSY_DATA* psyData,
{
Word32 i;
Word32 normEnergyShift = (psyData->mdctScale + 1) << 1; /* in reference code, mdct spectrum must be multipied with 2, so +1 */
Word32 clipEnergy = hPsyConfLong->clipEnergy >> normEnergyShift;
Word32 clipEnergy = hPsyConfLong->clipEnergy >> normEnergyShift;
Word32 *data0, *data1, tdata;
/* low pass */
data0 = psyData->mdctSpectrum + hPsyConfLong->lowpassLine;
data0 = psyData->mdctSpectrum + hPsyConfLong->lowpassLine;
for(i=hPsyConfLong->lowpassLine; i<FRAME_LEN_LONG; i++) {
*data0++ = 0;
}
@@ -525,11 +525,11 @@ static Word16 advancePsychLong(PSY_DATA* psyData,
psyData->blockSwitchingControl.windowSequence);
/* first part of threshold calculation */
data0 = psyData->sfbEnergy.sfbLong;
data1 = psyData->sfbThreshold.sfbLong;
data0 = psyData->sfbEnergy.sfbLong;
data1 = psyData->sfbThreshold.sfbLong;
for (i=hPsyConfLong->sfbCnt; i; i--) {
tdata = L_mpy_ls(*data0++, hPsyConfLong->ratio);
*data1++ = min(tdata, clipEnergy);
*data1++ = min(tdata, clipEnergy);
}
/* Calc sfb-bandwise mdct-energies for left and right channel again */
@@ -540,12 +540,12 @@ static Word16 advancePsychLong(PSY_DATA* psyData,
hPsyConfLong->sfbActive - tnsStartBand,
psyData->sfbEnergy.sfbLong+tnsStartBand,
&psyData->sfbEnergySum.sfbLong);
data0 = psyData->sfbEnergy.sfbLong;
tdata = psyData->sfbEnergySum.sfbLong;
data0 = psyData->sfbEnergy.sfbLong;
tdata = psyData->sfbEnergySum.sfbLong;
for (i=0; i<tnsStartBand; i++)
tdata += *data0++;
tdata += *data0++;
psyData->sfbEnergySum.sfbLong = tdata;
}
@@ -557,20 +557,20 @@ static Word16 advancePsychLong(PSY_DATA* psyData,
psyData->sfbThreshold.sfbLong);
/* threshold in quiet */
data0 = psyData->sfbThreshold.sfbLong;
data1 = hPsyConfLong->sfbThresholdQuiet;
data0 = psyData->sfbThreshold.sfbLong;
data1 = hPsyConfLong->sfbThresholdQuiet;
for (i=hPsyConfLong->sfbCnt; i; i--)
{
*data0 = max(*data0, (*data1 >> normEnergyShift));
data0++; data1++;
{
*data0 = max(*data0, (*data1 >> normEnergyShift));
data0++; data1++;
}
/* preecho control */
if (psyData->blockSwitchingControl.windowSequence == STOP_WINDOW) {
data0 = psyData->sfbThresholdnm1;
for (i=hPsyConfLong->sfbCnt; i; i--) {
*data0++ = MAX_32;
}
data0 = psyData->sfbThresholdnm1;
for (i=hPsyConfLong->sfbCnt; i; i--) {
*data0++ = MAX_32;
}
psyData->mdctScalenm1 = 0;
}
@@ -585,7 +585,7 @@ static Word16 advancePsychLong(PSY_DATA* psyData,
if (psyData->blockSwitchingControl.windowSequence== START_WINDOW) {
data0 = psyData->sfbThresholdnm1;
data0 = psyData->sfbThresholdnm1;
for (i=hPsyConfLong->sfbCnt; i; i--) {
*data0++ = MAX_32;
}
@@ -600,10 +600,10 @@ static Word16 advancePsychLong(PSY_DATA* psyData,
/* spreaded energy */
data0 = psyData->sfbSpreadedEnergy.sfbLong;
data1 = psyData->sfbEnergy.sfbLong;
data0 = psyData->sfbSpreadedEnergy.sfbLong;
data1 = psyData->sfbEnergy.sfbLong;
for (i=hPsyConfLong->sfbCnt; i; i--) {
//psyData->sfbSpreadedEnergy.sfbLong[i] = psyData->sfbEnergy.sfbLong[i];
//psyData->sfbSpreadedEnergy.sfbLong[i] = psyData->sfbEnergy.sfbLong[i];
*data0++ = *data1++;
}
@@ -657,14 +657,14 @@ static Word16 advancePsychShort(PSY_DATA* psyData,
Word32 w;
Word32 normEnergyShift = (psyData->mdctScale + 1) << 1; /* in reference code, mdct spectrum must be multipied with 2, so +1 */
Word32 clipEnergy = hPsyConfShort->clipEnergy >> normEnergyShift;
Word32 wOffset = 0;
Word32 wOffset = 0;
Word32 *data0, *data1;
for(w = 0; w < TRANS_FAC; w++) {
Word32 i, tdata;
/* low pass */
data0 = psyData->mdctSpectrum + wOffset + hPsyConfShort->lowpassLine;
data0 = psyData->mdctSpectrum + wOffset + hPsyConfShort->lowpassLine;
for(i=hPsyConfShort->lowpassLine; i<FRAME_LEN_SHORT; i++){
*data0++ = 0;
}
@@ -706,11 +706,11 @@ static Word16 advancePsychShort(PSY_DATA* psyData,
psyData->blockSwitchingControl.windowSequence);
/* first part of threshold calculation */
data0 = psyData->sfbThreshold.sfbShort[w];
data1 = psyData->sfbEnergy.sfbShort[w];
data0 = psyData->sfbThreshold.sfbShort[w];
data1 = psyData->sfbEnergy.sfbShort[w];
for (i=hPsyConfShort->sfbCnt; i; i--) {
tdata = L_mpy_ls(*data1++, hPsyConfShort->ratio);
*data0++ = min(tdata, clipEnergy);
*data0++ = min(tdata, clipEnergy);
}
/* Calc sfb-bandwise mdct-energies for left and right channel again */
@@ -720,13 +720,13 @@ static Word16 advancePsychShort(PSY_DATA* psyData,
hPsyConfShort->sfbOffset+tnsStartBand,
(hPsyConfShort->sfbActive - tnsStartBand),
psyData->sfbEnergy.sfbShort[w]+tnsStartBand,
&psyData->sfbEnergySum.sfbShort[w]);
&psyData->sfbEnergySum.sfbShort[w]);
tdata = psyData->sfbEnergySum.sfbShort[w];
data0 = psyData->sfbEnergy.sfbShort[w];
tdata = psyData->sfbEnergySum.sfbShort[w];
data0 = psyData->sfbEnergy.sfbShort[w];
for (i=tnsStartBand; i; i--)
tdata += *data0++;
tdata += *data0++;
psyData->sfbEnergySum.sfbShort[w] = tdata;
}
@@ -738,14 +738,14 @@ static Word16 advancePsychShort(PSY_DATA* psyData,
/* threshold in quiet */
data0 = psyData->sfbThreshold.sfbShort[w];
data1 = hPsyConfShort->sfbThresholdQuiet;
data0 = psyData->sfbThreshold.sfbShort[w];
data1 = hPsyConfShort->sfbThresholdQuiet;
for (i=hPsyConfShort->sfbCnt; i; i--)
{
*data0 = max(*data0, (*data1 >> normEnergyShift));
data0++; data1++;
}
{
*data0 = max(*data0, (*data1 >> normEnergyShift));
data0++; data1++;
}
/* preecho */
@@ -764,8 +764,8 @@ static Word16 advancePsychShort(PSY_DATA* psyData,
psyData->sfbThreshold.sfbShort[w]);
/* spreaded energy */
data0 = psyData->sfbSpreadedEnergy.sfbShort[w];
data1 = psyData->sfbEnergy.sfbShort[w];
data0 = psyData->sfbSpreadedEnergy.sfbShort[w];
data1 = psyData->sfbEnergy.sfbShort[w];
for (i=hPsyConfShort->sfbCnt; i; i--) {
*data0++ = *data1++;
}

View File

@@ -1,27 +1,27 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: qc_main.c
Content: Quantizing & coding functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: qc_main.c
Content: Quantizing & coding functions
*******************************************************************************/
#include "basic_op.h"
#include "oper_32b.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "qc_main.h"
#include "quantize.h"
#include "interface.h"
@@ -120,25 +120,25 @@ static Word16 framePadding(Word32 bitRate,
Word16 QCOutNew(QC_OUT *hQC, Word16 nChannels, VO_MEM_OPERATOR *pMemOP)
{
Word32 i;
Word16 *quantSpec;
Word16 *scf;
Word32 i;
Word16 *quantSpec;
Word16 *scf;
UWord16 *maxValueInSfb;
quantSpec = (Word16 *)mem_malloc(pMemOP, nChannels * FRAME_LEN_LONG * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
if(NULL == quantSpec)
quantSpec = (Word16 *)mem_malloc(pMemOP, nChannels * FRAME_LEN_LONG * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
if(NULL == quantSpec)
return 1;
scf = (Word16 *)mem_malloc(pMemOP, nChannels * MAX_GROUPED_SFB * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
if(NULL == scf)
{
return 1;
scf = (Word16 *)mem_malloc(pMemOP, nChannels * MAX_GROUPED_SFB * sizeof(Word16), 32, VO_INDEX_ENC_AAC);
if(NULL == scf)
{
return 1;
}
maxValueInSfb = (UWord16 *)mem_malloc(pMemOP, nChannels * MAX_GROUPED_SFB * sizeof(UWord16), 32, VO_INDEX_ENC_AAC);
if(NULL == maxValueInSfb)
{
return 1;
}
maxValueInSfb = (UWord16 *)mem_malloc(pMemOP, nChannels * MAX_GROUPED_SFB * sizeof(UWord16), 32, VO_INDEX_ENC_AAC);
if(NULL == maxValueInSfb)
{
return 1;
}
for (i=0; i<nChannels; i++) {
hQC->qcChannel[i].quantSpec = quantSpec + i*FRAME_LEN_LONG;
@@ -160,25 +160,25 @@ Word16 QCOutNew(QC_OUT *hQC, Word16 nChannels, VO_MEM_OPERATOR *pMemOP)
**********************************************************************************/
void QCOutDelete(QC_OUT* hQC, VO_MEM_OPERATOR *pMemOP)
{
Word32 i;
if(hQC)
{
if(hQC->qcChannel[0].quantSpec);
mem_free(pMemOP, hQC->qcChannel[0].quantSpec, VO_INDEX_ENC_AAC);
if(hQC->qcChannel[0].maxValueInSfb)
mem_free(pMemOP, hQC->qcChannel[0].maxValueInSfb, VO_INDEX_ENC_AAC);
if(hQC->qcChannel[0].scf)
mem_free(pMemOP, hQC->qcChannel[0].scf, VO_INDEX_ENC_AAC);
for (i=0; i<MAX_CHANNELS; i++) {
hQC->qcChannel[i].quantSpec = NULL;
hQC->qcChannel[i].maxValueInSfb = NULL;
hQC->qcChannel[i].scf = NULL;
}
Word32 i;
if(hQC)
{
if(hQC->qcChannel[0].quantSpec);
mem_free(pMemOP, hQC->qcChannel[0].quantSpec, VO_INDEX_ENC_AAC);
if(hQC->qcChannel[0].maxValueInSfb)
mem_free(pMemOP, hQC->qcChannel[0].maxValueInSfb, VO_INDEX_ENC_AAC);
if(hQC->qcChannel[0].scf)
mem_free(pMemOP, hQC->qcChannel[0].scf, VO_INDEX_ENC_AAC);
for (i=0; i<MAX_CHANNELS; i++) {
hQC->qcChannel[i].quantSpec = NULL;
hQC->qcChannel[i].maxValueInSfb = NULL;
hQC->qcChannel[i].scf = NULL;
}
}
}
@@ -278,7 +278,7 @@ Word16 QCMain(QC_STATE* hQC,
qcOutElement->staticBitsUsed = countStaticBitdemand(psyOutChannel,
psyOutElement,
nChannels,
nChannels,
qcOutElement->adtsUsed);
@@ -474,8 +474,8 @@ void updateBitres(QC_STATE* qcKernel,
Word16 FinalizeBitConsumption(QC_STATE *qcKernel,
QC_OUT* qcOut)
{
Word32 nFullFillElem;
Word32 totFillBits;
Word32 nFullFillElem;
Word32 totFillBits;
Word16 diffBits;
Word16 bitsUsed;
@@ -491,7 +491,7 @@ Word16 FinalizeBitConsumption(QC_STATE *qcKernel,
totFillBits += qcOut->qcElement.fillBits;
}
nFullFillElem = (max((qcOut->totFillBits - 1), 0) / maxFillElemBits) * maxFillElemBits;
nFullFillElem = (max((qcOut->totFillBits - 1), 0) / maxFillElemBits) * maxFillElemBits;
qcOut->totFillBits = qcOut->totFillBits - nFullFillElem;

View File

@@ -1,27 +1,27 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: quantize.c
Content: quantization functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: quantize.c
Content: quantization functions
*******************************************************************************/
#include "typedef.h"
#include "basic_op.h"
#include "typedef.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "quantize.h"
#include "aac_rom.h"
@@ -77,14 +77,14 @@ static Word16 quantizeSingleLine(const Word16 gain, const Word32 absSpectrum)
x += XROUND >> (INT_BITS - finalShift);
/* shift and quantize */
finalShift--;
if(finalShift >= 0)
x >>= finalShift;
else
x <<= (-finalShift);
/* shift and quantize */
finalShift--;
if(finalShift >= 0)
x >>= finalShift;
else
x <<= (-finalShift);
qua = saturate(x);
}
}
@@ -108,29 +108,29 @@ static void quantizeLines(const Word16 gain,
{
Word32 line;
Word32 m = gain&3;
Word32 g = (gain >> 2) + 4;
Word32 mdctSpeL;
Word32 g = (gain >> 2) + 4;
Word32 mdctSpeL;
Word16 *pquat;
/* gain&3 */
pquat = quantBorders[m];
g += 16;
if(g >= 0)
{
/* gain&3 */
pquat = quantBorders[m];
g += 16;
if(g >= 0)
{
for (line=0; line<noOfLines; line++) {
Word32 qua;
qua = 0;
mdctSpeL = mdctSpectrum[line];
mdctSpeL = mdctSpectrum[line];
if (mdctSpeL) {
Word32 sa;
Word32 saShft;
sa = L_abs(mdctSpeL);
//saShft = L_shr(sa, 16 + g);
//saShft = L_shr(sa, 16 + g);
saShft = sa >> g;
if (saShft > pquat[0]) {
@@ -163,54 +163,54 @@ static void quantizeLines(const Word16 gain,
}
}
quaSpectrum[line] = qua ;
}
}
else
{
for (line=0; line<noOfLines; line++) {
Word32 qua;
qua = 0;
mdctSpeL = mdctSpectrum[line];
if (mdctSpeL) {
Word32 sa;
Word32 saShft;
sa = L_abs(mdctSpeL);
saShft = sa << g;
if (saShft > pquat[0]) {
if (saShft < pquat[1]) {
qua = mdctSpeL>0 ? 1 : -1;
}
else {
if (saShft < pquat[2]) {
qua = mdctSpeL>0 ? 2 : -2;
}
else {
if (saShft < pquat[3]) {
qua = mdctSpeL>0 ? 3 : -3;
}
else {
qua = quantizeSingleLine(gain, sa);
/* adjust the sign. Since 0 < qua < 1, this cannot overflow. */
if (mdctSpeL < 0)
qua = -qua;
}
}
}
}
}
quaSpectrum[line] = qua ;
}
}
}
else
{
for (line=0; line<noOfLines; line++) {
Word32 qua;
qua = 0;
mdctSpeL = mdctSpectrum[line];
if (mdctSpeL) {
Word32 sa;
Word32 saShft;
sa = L_abs(mdctSpeL);
saShft = sa << g;
if (saShft > pquat[0]) {
if (saShft < pquat[1]) {
qua = mdctSpeL>0 ? 1 : -1;
}
else {
if (saShft < pquat[2]) {
qua = mdctSpeL>0 ? 2 : -2;
}
else {
if (saShft < pquat[3]) {
qua = mdctSpeL>0 ? 3 : -3;
}
else {
qua = quantizeSingleLine(gain, sa);
/* adjust the sign. Since 0 < qua < 1, this cannot overflow. */
if (mdctSpeL < 0)
qua = -qua;
}
}
}
}
}
quaSpectrum[line] = qua ;
}
}
}
@@ -266,10 +266,10 @@ static void iquantizeLines(const Word16 gain,
/* get approperiate exponent shifter */
specExp = specExpTableComb_enc[iquantizermod][specExp];
specExp += iquantizershift + 1;
if(specExp >= 0)
mdctSpectrum[line] = accu << specExp;
else
specExp += iquantizershift + 1;
if(specExp >= 0)
mdctSpectrum[line] = accu << specExp;
else
mdctSpectrum[line] = accu >> (-specExp);
}
else {
@@ -331,19 +331,19 @@ Word32 calcSfbDist(const Word32 *spec,
Word32 line;
Word32 dist;
Word32 m = gain&3;
Word32 g = (gain >> 2) + 4;
Word32 g2 = (g << 1) + 1;
Word16 *pquat, *repquat;
Word32 g = (gain >> 2) + 4;
Word32 g2 = (g << 1) + 1;
Word16 *pquat, *repquat;
/* gain&3 */
pquat = quantBorders[m];
pquat = quantBorders[m];
repquat = quantRecon[m];
dist = 0;
g += 16;
if(g2 < 0 && g >= 0)
dist = 0;
g += 16;
if(g2 < 0 && g >= 0)
{
g2 = -g2;
g2 = -g2;
for(line=0; line<sfbWidth; line++) {
if (spec[line]) {
Word32 diff;
@@ -352,93 +352,93 @@ Word32 calcSfbDist(const Word32 *spec,
Word32 saShft;
sa = L_abs(spec[line]);
//saShft = round16(L_shr(sa, g));
//saShft = L_shr(sa, 16+g);
saShft = sa >> g;
//saShft = L_shr(sa, 16+g);
saShft = sa >> g;
if (saShft < pquat[0]) {
distSingle = (saShft * saShft) >> g2;
}
else {
if (saShft < pquat[1]) {
diff = saShft - repquat[0];
distSingle = (diff * diff) >> g2;
}
else {
if (saShft < pquat[2]) {
diff = saShft - repquat[1];
distSingle = (diff * diff) >> g2;
}
else {
if (saShft < pquat[3]) {
diff = saShft - repquat[2];
distSingle = (diff * diff) >> g2;
}
else {
Word16 qua = quantizeSingleLine(gain, sa);
Word32 iqval, diff32;
/* now that we have quantized x, re-quantize it. */
iquantizeLines(gain, 1, &qua, &iqval);
diff32 = sa - iqval;
distSingle = fixmul(diff32, diff32);
}
}
}
}
dist = L_add(dist, distSingle);
if (saShft < pquat[0]) {
distSingle = (saShft * saShft) >> g2;
}
else {
if (saShft < pquat[1]) {
diff = saShft - repquat[0];
distSingle = (diff * diff) >> g2;
}
else {
if (saShft < pquat[2]) {
diff = saShft - repquat[1];
distSingle = (diff * diff) >> g2;
}
else {
if (saShft < pquat[3]) {
diff = saShft - repquat[2];
distSingle = (diff * diff) >> g2;
}
else {
Word16 qua = quantizeSingleLine(gain, sa);
Word32 iqval, diff32;
/* now that we have quantized x, re-quantize it. */
iquantizeLines(gain, 1, &qua, &iqval);
diff32 = sa - iqval;
distSingle = fixmul(diff32, diff32);
}
}
}
}
dist = L_add(dist, distSingle);
}
}
}
else
{
for(line=0; line<sfbWidth; line++) {
if (spec[line]) {
Word32 diff;
Word32 distSingle;
Word32 sa;
Word32 saShft;
sa = L_abs(spec[line]);
//saShft = round16(L_shr(sa, g));
saShft = L_shr(sa, g);
if (saShft < pquat[0]) {
distSingle = L_shl((saShft * saShft), g2);
}
else {
if (saShft < pquat[1]) {
diff = saShft - repquat[0];
distSingle = L_shl((diff * diff), g2);
}
else {
if (saShft < pquat[2]) {
diff = saShft - repquat[1];
distSingle = L_shl((diff * diff), g2);
}
else {
if (saShft < pquat[3]) {
diff = saShft - repquat[2];
distSingle = L_shl((diff * diff), g2);
}
else {
Word16 qua = quantizeSingleLine(gain, sa);
Word32 iqval, diff32;
/* now that we have quantized x, re-quantize it. */
iquantizeLines(gain, 1, &qua, &iqval);
diff32 = sa - iqval;
distSingle = fixmul(diff32, diff32);
}
}
}
}
dist = L_add(dist, distSingle);
}
}
}
}
else
{
for(line=0; line<sfbWidth; line++) {
if (spec[line]) {
Word32 diff;
Word32 distSingle;
Word32 sa;
Word32 saShft;
sa = L_abs(spec[line]);
//saShft = round16(L_shr(sa, g));
saShft = L_shr(sa, g);
if (saShft < pquat[0]) {
distSingle = L_shl((saShft * saShft), g2);
}
else {
if (saShft < pquat[1]) {
diff = saShft - repquat[0];
distSingle = L_shl((diff * diff), g2);
}
else {
if (saShft < pquat[2]) {
diff = saShft - repquat[1];
distSingle = L_shl((diff * diff), g2);
}
else {
if (saShft < pquat[3]) {
diff = saShft - repquat[2];
distSingle = L_shl((diff * diff), g2);
}
else {
Word16 qua = quantizeSingleLine(gain, sa);
Word32 iqval, diff32;
/* now that we have quantized x, re-quantize it. */
iquantizeLines(gain, 1, &qua, &iqval);
diff32 = sa - iqval;
distSingle = fixmul(diff32, diff32);
}
}
}
}
dist = L_add(dist, distSingle);
}
}
}
return dist;

View File

@@ -1,26 +1,26 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: sf_estim.c
Content: Scale factor estimation functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: sf_estim.c
Content: Scale factor estimation functions
*******************************************************************************/
#include "basic_op.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "sf_estim.h"
#include "quantize.h"
@@ -45,12 +45,12 @@ constants reference in comments
#define FF_SQRT_BITS 7
#define FF_SQRT_TABLE_SIZE (1<<FF_SQRT_BITS - 1<<(FF_SQRT_BITS-2))
#define COEF08_31 0x66666666 /* 0.8*(1 << 31) */
#define PE_C1_8 24 /* PE_C1*8 */
#define PE_C2_16 21 /* PE_C2*8/PE_C3 */
#define PE_SCALE 0x059a /* 0.7 * (1 << (15 - 1 - 3))*/
#define SCALE_ESTIMATE_COEF 0x5555 /* (8.8585/(4*log2(10))) * (1 << 15)*/
#define COEF08_31 0x66666666 /* 0.8*(1 << 31) */
#define PE_C1_8 24 /* PE_C1*8 */
#define PE_C2_16 21 /* PE_C2*8/PE_C3 */
#define PE_SCALE 0x059a /* 0.7 * (1 << (15 - 1 - 3))*/
#define SCALE_ESTIMATE_COEF 0x5555 /* (8.8585/(4*log2(10))) * (1 << 15)*/
/*********************************************************************************
*
@@ -69,17 +69,17 @@ __inline Word32 formfac_sqrt(Word32 x)
postshift = preshift >> 1;
preshift = postshift << 1;
postshift = postshift + 8; /* sqrt/256 */
if(preshift >= 0)
y = x << preshift; /* now 1/4 <= y < 1 */
else
y = x >> (-preshift);
y = formfac_sqrttable[y-32];
if(postshift >= 0)
y = y >> postshift;
else
y = y << (-postshift);
if(preshift >= 0)
y = x << preshift; /* now 1/4 <= y < 1 */
else
y = x >> (-preshift);
y = formfac_sqrttable[y-32];
if(postshift >= 0)
y = y >> postshift;
else
y = y << (-postshift);
return y;
}
@@ -97,25 +97,25 @@ CalcFormFactorChannel(Word16 *logSfbFormFactor,
Word16 *logSfbEnergy,
PSY_OUT_CHANNEL *psyOutChan)
{
Word32 sfbw, sfbw1;
Word32 sfbw, sfbw1;
Word32 i, j;
Word32 sfbOffs, sfb, shift;
sfbw = sfbw1 = 0;
sfbw = sfbw1 = 0;
for (sfbOffs=0; sfbOffs<psyOutChan->sfbCnt; sfbOffs+=psyOutChan->sfbPerGroup){
for (sfb=0; sfb<psyOutChan->maxSfbPerGroup; sfb++) {
i = sfbOffs+sfb;
if (psyOutChan->sfbEnergy[i] > psyOutChan->sfbThreshold[i]) {
Word32 accu, avgFormFactor,iSfbWidth;
Word32 accu, avgFormFactor,iSfbWidth;
Word32 *mdctSpec;
sfbw = psyOutChan->sfbOffsets[i+1] - psyOutChan->sfbOffsets[i];
iSfbWidth = invSBF[(sfbw >> 2) - 1];
sfbw = psyOutChan->sfbOffsets[i+1] - psyOutChan->sfbOffsets[i];
iSfbWidth = invSBF[(sfbw >> 2) - 1];
mdctSpec = psyOutChan->mdctSpectrum + psyOutChan->sfbOffsets[i];
accu = 0;
/* calc sum of sqrt(spec) */
for (j=sfbw; j; j--) {
accu += formfac_sqrt(L_abs(*mdctSpec)); mdctSpec++;
for (j=sfbw; j; j--) {
accu += formfac_sqrt(L_abs(*mdctSpec)); mdctSpec++;
}
logSfbFormFactor[i] = iLog4(accu);
logSfbEnergy[i] = iLog4(psyOutChan->sfbEnergy[i]);
@@ -158,8 +158,8 @@ static Word16 improveScf(Word32 *spec,
/* calc real distortion */
sfbDist = calcSfbDist(spec, sfbWidth, scf);
*minScfCalculated = scf;
if(!sfbDist)
*minScfCalculated = scf;
if(!sfbDist)
return scfBest;
if (sfbDist > thresh125) {
@@ -194,7 +194,7 @@ static Word16 improveScf(Word32 *spec,
}
*minScfCalculated = scf;
cnt = cnt + 1;
}
}
*dist = sfbDistBest;
}
else {
@@ -419,7 +419,7 @@ static void assimilateSingleScf(PSY_OUT_CHANNEL *psyOutChan,
prevScfLast[j] = MAX_16;
prevScfNext[j] = MAX_16;
deltaPeLast[j] = MAX_16;
}
}
sfbLast = -1;
sfbAct = -1;
@@ -713,20 +713,20 @@ EstimateScaleFactorsChannel(PSY_OUT_CHANNEL *psyOutChan,
for (i=0; i<psyOutChan->sfbCnt; i++) {
Word32 sbfwith, sbfStart;
Word32 sbfwith, sbfStart;
Word32 *mdctSpec;
thresh = psyOutChan->sfbThreshold[i];
energy = psyOutChan->sfbEnergy[i];
sbfStart = psyOutChan->sfbOffsets[i];
sbfwith = psyOutChan->sfbOffsets[i+1] - sbfStart;
mdctSpec = psyOutChan->mdctSpectrum+sbfStart;
sbfStart = psyOutChan->sfbOffsets[i];
sbfwith = psyOutChan->sfbOffsets[i+1] - sbfStart;
mdctSpec = psyOutChan->mdctSpectrum+sbfStart;
maxSpec = 0;
/* maximum of spectrum */
for (j=sbfwith; j; j-- ) {
Word32 absSpec = L_abs(*mdctSpec); mdctSpec++;
maxSpec |= absSpec;
for (j=sbfwith; j; j-- ) {
Word32 absSpec = L_abs(*mdctSpec); mdctSpec++;
maxSpec |= absSpec;
}
/* scfs without energy or with thresh>energy are marked with MIN_16 */
@@ -737,7 +737,7 @@ EstimateScaleFactorsChannel(PSY_OUT_CHANNEL *psyOutChan,
energyPart = logSfbFormFactor[i];
thresholdPart = iLog4(thresh);
/* -20 = 4*log2(6.75) - 32 */
/* -20 = 4*log2(6.75) - 32 */
scfInt = ((thresholdPart - energyPart - 20) * SCALE_ESTIMATE_COEF) >> 15;
minSfMaxQuant[i] = iLog4(maxSpec) - 68; /* 68 -16/3*log(MAX_QUANT+0.5-logCon)/log(2) + 1 */
@@ -748,9 +748,9 @@ EstimateScaleFactorsChannel(PSY_OUT_CHANNEL *psyOutChan,
}
/* find better scalefactor with analysis by synthesis */
scfInt = improveScf(psyOutChan->mdctSpectrum+sbfStart,
sbfwith,
thresh, scfInt, minSfMaxQuant[i],
scfInt = improveScf(psyOutChan->mdctSpectrum+sbfStart,
sbfwith,
thresh, scfInt, minSfMaxQuant[i],
&sfbDist[i], &minScfCalculated[i]);
scf[i] = scfInt;

View File

@@ -1,29 +1,29 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: spreading.c
Content: Spreading of energy function
*******************************************************************************/
#include "basic_op.h"
#include "oper_32b.h"
#include "spreading.h"
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: spreading.c
Content: Spreading of energy function
*******************************************************************************/
#include "basic_op.h"
#include "oper_32b.h"
#include "spreading.h"
/*********************************************************************************
*
* function name: SpreadingMax
@@ -31,22 +31,22 @@
* higher frequencies thr(n) = max(thr(n), sh(n)*thr(n-1))
* lower frequencies thr(n) = max(thr(n), sl(n)*thr(n+1))
*
**********************************************************************************/
void SpreadingMax(const Word16 pbCnt,
const Word16 *maskLowFactor,
const Word16 *maskHighFactor,
Word32 *pbSpreadedEnergy)
{
Word32 i;
/* slope to higher frequencies */
for (i=1; i<pbCnt; i++) {
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
L_mpy_ls(pbSpreadedEnergy[i-1], maskHighFactor[i]));
}
/* slope to lower frequencies */
for (i=pbCnt - 2; i>=0; i--) {
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
L_mpy_ls(pbSpreadedEnergy[i+1], maskLowFactor[i]));
}
}
**********************************************************************************/
void SpreadingMax(const Word16 pbCnt,
const Word16 *maskLowFactor,
const Word16 *maskHighFactor,
Word32 *pbSpreadedEnergy)
{
Word32 i;
/* slope to higher frequencies */
for (i=1; i<pbCnt; i++) {
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
L_mpy_ls(pbSpreadedEnergy[i-1], maskHighFactor[i]));
}
/* slope to lower frequencies */
for (i=pbCnt - 2; i>=0; i--) {
pbSpreadedEnergy[i] = max(pbSpreadedEnergy[i],
L_mpy_ls(pbSpreadedEnergy[i+1], maskLowFactor[i]));
}
}

View File

@@ -1,23 +1,23 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: stat_bits.c
Content: Static bit counter functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: stat_bits.c
Content: Static bit counter functions
*******************************************************************************/
#include "stat_bits.h"
@@ -82,10 +82,10 @@ static Word16 tnsCount(TNS_INFO *tnsInfo, Word16 blockType)
Flag tnsPresent;
Word32 numOfWindows;
Word32 count;
Word32 coefBits;
Word32 coefBits;
Word16 *ptcoef;
count = 0;
count = 0;
if (blockType == 2)
numOfWindows = 8;
@@ -127,7 +127,7 @@ static Word16 tnsCount(TNS_INFO *tnsInfo, Word16 blockType)
count += 1; /*coef_compression */
if (tnsInfo->coefRes[i] == 4) {
ptcoef = tnsInfo->coef + i*TNS_MAX_ORDER_SHORT;
ptcoef = tnsInfo->coef + i*TNS_MAX_ORDER_SHORT;
coefBits = 3;
for(k=0; k<tnsInfo->order[i]; k++) {
@@ -139,7 +139,7 @@ static Word16 tnsCount(TNS_INFO *tnsInfo, Word16 blockType)
}
else {
coefBits = 2;
ptcoef = tnsInfo->coef + i*TNS_MAX_ORDER_SHORT;
ptcoef = tnsInfo->coef + i*TNS_MAX_ORDER_SHORT;
for(k=0; k<tnsInfo->order[i]; k++) {
if ((ptcoef[k] > 1) || (ptcoef[k] < -2)) {
@@ -154,7 +154,7 @@ static Word16 tnsCount(TNS_INFO *tnsInfo, Word16 blockType)
}
}
}
}
}
return count;
}
@@ -178,14 +178,14 @@ static Word16 countTnsBits(TNS_INFO *tnsInfo,Word16 blockType)
**********************************************************************************/
Word16 countStaticBitdemand(PSY_OUT_CHANNEL psyOutChannel[MAX_CHANNELS],
PSY_OUT_ELEMENT *psyOutElement,
Word16 channels,
Word16 channels,
Word16 adtsUsed)
{
Word32 statBits;
Word32 ch;
statBits = 0;
statBits = 0;
/* if adts used, add 56 bits */
if(adtsUsed) statBits += 56;

View File

@@ -1,27 +1,27 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns.c
Content: Definition TNS tools functions
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: tns.c
Content: Definition TNS tools functions
*******************************************************************************/
#include "basic_op.h"
#include "oper_32b.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "assert.h"
#include "aac_rom.h"
#include "psy_const.h"
@@ -32,23 +32,23 @@
#define TNS_MODIFY_BEGIN 2600 /* Hz */
#define RATIO_PATCH_LOWER_BORDER 380 /* Hz */
#define TNS_GAIN_THRESH 141 /* 1.41*100 */
#define NORM_COEF 0x028f5c28
#define TNS_GAIN_THRESH 141 /* 1.41*100 */
#define NORM_COEF 0x028f5c28
static const Word32 TNS_PARCOR_THRESH = 0x0ccccccd; /* 0.1*(1 << 31) */
/* Limit bands to > 2.0 kHz */
static unsigned short tnsMinBandNumberLong[12] =
{ 11, 12, 15, 16, 17, 20, 25, 26, 24, 28, 30, 31 };
static unsigned short tnsMinBandNumberShort[12] =
{ 2, 2, 2, 3, 3, 4, 6, 6, 8, 10, 10, 12 };
/**************************************/
/* Main/Low Profile TNS Parameters */
/**************************************/
static unsigned short tnsMaxBandsLongMainLow[12] =
{ 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39 };
static unsigned short tnsMaxBandsShortMainLow[12] =
static const Word32 TNS_PARCOR_THRESH = 0x0ccccccd; /* 0.1*(1 << 31) */
/* Limit bands to > 2.0 kHz */
static unsigned short tnsMinBandNumberLong[12] =
{ 11, 12, 15, 16, 17, 20, 25, 26, 24, 28, 30, 31 };
static unsigned short tnsMinBandNumberShort[12] =
{ 2, 2, 2, 3, 3, 4, 6, 6, 8, 10, 10, 12 };
/**************************************/
/* Main/Low Profile TNS Parameters */
/**************************************/
static unsigned short tnsMaxBandsLongMainLow[12] =
{ 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39 };
static unsigned short tnsMaxBandsShortMainLow[12] =
{ 9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14 };
@@ -178,8 +178,8 @@ Word16 InitTnsConfigurationLong(Word32 bitRate, /*!< bitrate */
tC->lpcStopBand = tnsMaxBandsLongMainLow[pC->sampRateIdx];
tC->lpcStopBand = min(tC->lpcStopBand, pC->sfbActive);
tC->lpcStopLine = pC->sfbOffset[tC->lpcStopBand];
tC->lpcStopLine = pC->sfbOffset[tC->lpcStopBand];
tC->lpcStartBand = tnsMinBandNumberLong[pC->sampRateIdx];
tC->lpcStartLine = pC->sfbOffset[tC->lpcStartBand];
@@ -241,13 +241,13 @@ Word16 InitTnsConfigurationShort(Word32 bitRate, /*!< bitrate */
tC->tnsStartLine = pC->sfbOffset[tC->tnsStartBand];
tC->lpcStopBand = tnsMaxBandsShortMainLow[pC->sampRateIdx];
tC->lpcStopBand = tnsMaxBandsShortMainLow[pC->sampRateIdx];
tC->lpcStopBand = min(tC->lpcStopBand, pC->sfbActive);
tC->lpcStopLine = pC->sfbOffset[tC->lpcStopBand];
tC->lpcStartBand = tnsMinBandNumberShort[pC->sampRateIdx];
tC->lpcStartBand = tnsMinBandNumberShort[pC->sampRateIdx];
tC->lpcStartLine = pC->sfbOffset[tC->lpcStartBand];
@@ -399,12 +399,12 @@ Word16 TnsEncode(TNS_INFO* tnsInfo, /*!< tns info structure (modified) */
{
Word32 i;
Word32 temp_s;
Word32 temp;
Word32 temp;
TNS_SUBBLOCK_INFO *psubBlockInfo;
temp_s = blockType - SHORT_WINDOW;
if ( temp_s != 0) {
psubBlockInfo = &tnsData->dataRaw.tnsLong.subBlockInfo;
psubBlockInfo = &tnsData->dataRaw.tnsLong.subBlockInfo;
if (psubBlockInfo->tnsActive == 0) {
tnsInfo->tnsActive[subBlockNumber] = 0;
return(0);
@@ -449,7 +449,7 @@ Word16 TnsEncode(TNS_INFO* tnsInfo, /*!< tns info structure (modified) */
}
} /* if (blockType!=SHORT_WINDOW) */
else /*short block*/ {
psubBlockInfo = &tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber];
psubBlockInfo = &tnsData->dataRaw.tnsShort.subBlockInfo[subBlockNumber];
if (psubBlockInfo->tnsActive == 0) {
tnsInfo->tnsActive[subBlockNumber] = 0;
return(0);
@@ -556,9 +556,9 @@ static void CalcWeightedSpectrum(const Word32 spectrum[], /*!< input sp
tmp2 = sfbEnergy[sfb] - 2;
if( tmp2 > 0) {
tmp = rsqrt(sfbEnergy[sfb], INT_BITS);
if(tmp > INT_BITS_SCAL)
{
shift = norm_l(tmp);
if(tmp > INT_BITS_SCAL)
{
shift = norm_l(tmp);
tmp = Div_32( INT_BITS_SCAL << shift, tmp << shift );
}
else
@@ -601,20 +601,20 @@ static void CalcWeightedSpectrum(const Word32 spectrum[], /*!< input sp
maxWS |= L_abs(pWork32[i]);
}
maxShift = norm_l(maxWS);
maxShift = 16 - maxShift;
if(maxShift >= 0)
{
for (i=lpcStartLine; i<lpcStopLine; i++){
weightedSpectrum[i] = pWork32[i] >> maxShift;
}
}
else
{
maxShift = -maxShift;
for (i=lpcStartLine; i<lpcStopLine; i++){
weightedSpectrum[i] = saturate(pWork32[i] << maxShift);
}
maxShift = 16 - maxShift;
if(maxShift >= 0)
{
for (i=lpcStartLine; i<lpcStopLine; i++){
weightedSpectrum[i] = pWork32[i] >> maxShift;
}
}
else
{
maxShift = -maxShift;
for (i=lpcStartLine; i<lpcStopLine; i++){
weightedSpectrum[i] = saturate(pWork32[i] << maxShift);
}
}
}
@@ -669,7 +669,7 @@ static Word16 CalcTnsFilter(const Word16 *signal,
* output: acf values
*
*****************************************************************************/
#ifndef ARMV5E
#ifndef ARMV5E
void AutoCorrelation(const Word16 input[],
Word32 corr[],
Word16 samples,
@@ -679,12 +679,12 @@ void AutoCorrelation(const Word16 input[],
Word32 scf;
scf = 10 - 1;
isamples = samples;
/* calc first corrCoef: R[0] = sum { t[i] * t[i] } ; i = 0..N-1 */
accu = 0;
for(j=0; j<isamples; j++) {
accu = L_add(accu, ((input[j] * input[j]) >> scf));
accu = L_add(accu, ((input[j] * input[j]) >> scf));
}
corr[0] = accu;
@@ -696,7 +696,7 @@ void AutoCorrelation(const Word16 input[],
isamples = isamples - 1;
accu = 0;
for(j=0; j<isamples; j++) {
accu = L_add(accu, ((input[j] * input[j+i]) >> scf));
accu = L_add(accu, ((input[j] * input[j+i]) >> scf));
}
corr[i] = accu;
}
@@ -737,7 +737,7 @@ static Word16 AutoToParcor(Word32 workBuffer[], Word32 reflCoeff[], Word16 numOf
if (workBuffer[0] < L_abs(workBuffer[i + numOfCoeff])) {
return 0 ;
}
shift = norm_l(workBuffer[0]);
shift = norm_l(workBuffer[0]);
workBuffer0 = Div_32(1 << shift, workBuffer[0] << shift);
/* calculate refc = -workBuffer[numOfCoeff+i] / workBuffer[0]; -1 <= refc < 1 */
refc = L_negate(fixmul(workBuffer[numOfCoeff + i], workBuffer0));
@@ -758,8 +758,8 @@ static Word16 AutoToParcor(Word32 workBuffer[], Word32 reflCoeff[], Word16 numOf
denom = MULHIGH(workBuffer[0], NORM_COEF);
if (denom != 0) {
Word32 temp;
shift = norm_l(denom);
Word32 temp;
shift = norm_l(denom);
temp = Div_32(1 << shift, denom << shift);
predictionGain = fixmul(num, temp);
}

View File

@@ -1,37 +1,37 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: transform.c
Content: MDCT Transform functionss
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: transform.c
Content: MDCT Transform functionss
*******************************************************************************/
#include "basic_op.h"
#include "basic_op.h"
#include "psy_const.h"
#include "transform.h"
#include "aac_rom.h"
#define LS_TRANS ((FRAME_LEN_LONG-FRAME_LEN_SHORT)/2) /* 448 */
#define SQRT1_2 0x5a82799a /* sqrt(1/2) in Q31 */
#define swap2(p0,p1) \
t = p0; t1 = *(&(p0)+1); \
p0 = p1; *(&(p0)+1) = *(&(p1)+1); \
p1 = t; *(&(p1)+1) = t1
#define LS_TRANS ((FRAME_LEN_LONG-FRAME_LEN_SHORT)/2) /* 448 */
#define SQRT1_2 0x5a82799a /* sqrt(1/2) in Q31 */
#define swap2(p0,p1) \
t = p0; t1 = *(&(p0)+1); \
p0 = p1; *(&(p0)+1) = *(&(p1)+1); \
p1 = t; *(&(p1)+1) = t1
/*********************************************************************************
*
@@ -39,343 +39,343 @@
* description: Shuffle points prepared function for fft
*
**********************************************************************************/
static void Shuffle(int *buf, int num, const unsigned char* bitTab)
{
int *part0, *part1;
int i, j;
int t, t1;
part0 = buf;
part1 = buf + num;
while ((i = *bitTab++) != 0) {
j = *bitTab++;
swap2(part0[4*i+0], part0[4*j+0]);
swap2(part0[4*i+2], part1[4*j+0]);
swap2(part1[4*i+0], part0[4*j+2]);
swap2(part1[4*i+2], part1[4*j+2]);
}
do {
swap2(part0[4*i+2], part1[4*i+0]);
} while ((i = *bitTab++) != 0);
}
#if !defined(ARMV5E) && !defined(ARMV7Neon)
static void Shuffle(int *buf, int num, const unsigned char* bitTab)
{
int *part0, *part1;
int i, j;
int t, t1;
part0 = buf;
part1 = buf + num;
while ((i = *bitTab++) != 0) {
j = *bitTab++;
swap2(part0[4*i+0], part0[4*j+0]);
swap2(part0[4*i+2], part1[4*j+0]);
swap2(part1[4*i+0], part0[4*j+2]);
swap2(part1[4*i+2], part1[4*j+2]);
}
do {
swap2(part0[4*i+2], part1[4*i+0]);
} while ((i = *bitTab++) != 0);
}
#if !defined(ARMV5E) && !defined(ARMV7Neon)
/*****************************************************************************
*
* function name: Radix4First
* description: Radix 4 point prepared function for fft
*
**********************************************************************************/
static void Radix4First(int *buf, int num)
{
int r0, r1, r2, r3;
int r4, r5, r6, r7;
for (; num != 0; num--)
{
r0 = buf[0] + buf[2];
r1 = buf[1] + buf[3];
r2 = buf[0] - buf[2];
r3 = buf[1] - buf[3];
r4 = buf[4] + buf[6];
r5 = buf[5] + buf[7];
r6 = buf[4] - buf[6];
r7 = buf[5] - buf[7];
buf[0] = r0 + r4;
buf[1] = r1 + r5;
buf[4] = r0 - r4;
buf[5] = r1 - r5;
buf[2] = r2 + r7;
buf[3] = r3 - r6;
buf[6] = r2 - r7;
buf[7] = r3 + r6;
buf += 8;
}
}
**********************************************************************************/
static void Radix4First(int *buf, int num)
{
int r0, r1, r2, r3;
int r4, r5, r6, r7;
for (; num != 0; num--)
{
r0 = buf[0] + buf[2];
r1 = buf[1] + buf[3];
r2 = buf[0] - buf[2];
r3 = buf[1] - buf[3];
r4 = buf[4] + buf[6];
r5 = buf[5] + buf[7];
r6 = buf[4] - buf[6];
r7 = buf[5] - buf[7];
buf[0] = r0 + r4;
buf[1] = r1 + r5;
buf[4] = r0 - r4;
buf[5] = r1 - r5;
buf[2] = r2 + r7;
buf[3] = r3 - r6;
buf[6] = r2 - r7;
buf[7] = r3 + r6;
buf += 8;
}
}
/*****************************************************************************
*
* function name: Radix8First
* description: Radix 8 point prepared function for fft
*
**********************************************************************************/
static void Radix8First(int *buf, int num)
{
int r0, r1, r2, r3;
int i0, i1, i2, i3;
int r4, r5, r6, r7;
int i4, i5, i6, i7;
int t0, t1, t2, t3;
for ( ; num != 0; num--)
{
r0 = buf[0] + buf[2];
i0 = buf[1] + buf[3];
r1 = buf[0] - buf[2];
i1 = buf[1] - buf[3];
r2 = buf[4] + buf[6];
i2 = buf[5] + buf[7];
r3 = buf[4] - buf[6];
i3 = buf[5] - buf[7];
r4 = (r0 + r2) >> 1;
i4 = (i0 + i2) >> 1;
r5 = (r0 - r2) >> 1;
i5 = (i0 - i2) >> 1;
r6 = (r1 - i3) >> 1;
i6 = (i1 + r3) >> 1;
r7 = (r1 + i3) >> 1;
i7 = (i1 - r3) >> 1;
r0 = buf[ 8] + buf[10];
i0 = buf[ 9] + buf[11];
r1 = buf[ 8] - buf[10];
i1 = buf[ 9] - buf[11];
r2 = buf[12] + buf[14];
i2 = buf[13] + buf[15];
r3 = buf[12] - buf[14];
i3 = buf[13] - buf[15];
t0 = (r0 + r2) >> 1;
t1 = (i0 + i2) >> 1;
t2 = (r0 - r2) >> 1;
t3 = (i0 - i2) >> 1;
buf[ 0] = r4 + t0;
buf[ 1] = i4 + t1;
buf[ 8] = r4 - t0;
buf[ 9] = i4 - t1;
buf[ 4] = r5 + t3;
buf[ 5] = i5 - t2;
buf[12] = r5 - t3;
buf[13] = i5 + t2;
r0 = r1 - i3;
i0 = i1 + r3;
r2 = r1 + i3;
i2 = i1 - r3;
t0 = MULHIGH(SQRT1_2, r0 - i0);
t1 = MULHIGH(SQRT1_2, r0 + i0);
t2 = MULHIGH(SQRT1_2, r2 - i2);
t3 = MULHIGH(SQRT1_2, r2 + i2);
buf[ 6] = r6 - t0;
buf[ 7] = i6 - t1;
buf[14] = r6 + t0;
buf[15] = i6 + t1;
buf[ 2] = r7 + t3;
buf[ 3] = i7 - t2;
buf[10] = r7 - t3;
buf[11] = i7 + t2;
buf += 16;
}
}
**********************************************************************************/
static void Radix8First(int *buf, int num)
{
int r0, r1, r2, r3;
int i0, i1, i2, i3;
int r4, r5, r6, r7;
int i4, i5, i6, i7;
int t0, t1, t2, t3;
for ( ; num != 0; num--)
{
r0 = buf[0] + buf[2];
i0 = buf[1] + buf[3];
r1 = buf[0] - buf[2];
i1 = buf[1] - buf[3];
r2 = buf[4] + buf[6];
i2 = buf[5] + buf[7];
r3 = buf[4] - buf[6];
i3 = buf[5] - buf[7];
r4 = (r0 + r2) >> 1;
i4 = (i0 + i2) >> 1;
r5 = (r0 - r2) >> 1;
i5 = (i0 - i2) >> 1;
r6 = (r1 - i3) >> 1;
i6 = (i1 + r3) >> 1;
r7 = (r1 + i3) >> 1;
i7 = (i1 - r3) >> 1;
r0 = buf[ 8] + buf[10];
i0 = buf[ 9] + buf[11];
r1 = buf[ 8] - buf[10];
i1 = buf[ 9] - buf[11];
r2 = buf[12] + buf[14];
i2 = buf[13] + buf[15];
r3 = buf[12] - buf[14];
i3 = buf[13] - buf[15];
t0 = (r0 + r2) >> 1;
t1 = (i0 + i2) >> 1;
t2 = (r0 - r2) >> 1;
t3 = (i0 - i2) >> 1;
buf[ 0] = r4 + t0;
buf[ 1] = i4 + t1;
buf[ 8] = r4 - t0;
buf[ 9] = i4 - t1;
buf[ 4] = r5 + t3;
buf[ 5] = i5 - t2;
buf[12] = r5 - t3;
buf[13] = i5 + t2;
r0 = r1 - i3;
i0 = i1 + r3;
r2 = r1 + i3;
i2 = i1 - r3;
t0 = MULHIGH(SQRT1_2, r0 - i0);
t1 = MULHIGH(SQRT1_2, r0 + i0);
t2 = MULHIGH(SQRT1_2, r2 - i2);
t3 = MULHIGH(SQRT1_2, r2 + i2);
buf[ 6] = r6 - t0;
buf[ 7] = i6 - t1;
buf[14] = r6 + t0;
buf[15] = i6 + t1;
buf[ 2] = r7 + t3;
buf[ 3] = i7 - t2;
buf[10] = r7 - t3;
buf[11] = i7 + t2;
buf += 16;
}
}
/*****************************************************************************
*
* function name: Radix4FFT
* description: Radix 4 point fft core function
*
**********************************************************************************/
static void Radix4FFT(int *buf, int num, int bgn, int *twidTab)
{
int r0, r1, r2, r3;
int r4, r5, r6, r7;
int t0, t1;
int sinx, cosx;
int i, j, step;
int *xptr, *csptr;
for (num >>= 2; num != 0; num >>= 2)
{
step = 2*bgn;
xptr = buf;
for (i = num; i != 0; i--)
{
csptr = twidTab;
for (j = bgn; j != 0; j--)
{
r0 = xptr[0];
r1 = xptr[1];
xptr += step;
t0 = xptr[0];
t1 = xptr[1];
cosx = csptr[0];
sinx = csptr[1];
r2 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1); /* cos*br + sin*bi */
r3 = MULHIGH(cosx, t1) - MULHIGH(sinx, t0); /* cos*bi - sin*br */
xptr += step;
t0 = r0 >> 2;
t1 = r1 >> 2;
r0 = t0 - r2;
r1 = t1 - r3;
r2 = t0 + r2;
r3 = t1 + r3;
t0 = xptr[0];
t1 = xptr[1];
cosx = csptr[2];
sinx = csptr[3];
r4 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1); /* cos*cr + sin*ci */
r5 = MULHIGH(cosx, t1) - MULHIGH(sinx, t0); /* cos*ci - sin*cr */
xptr += step;
t0 = xptr[0];
t1 = xptr[1];
cosx = csptr[4];
sinx = csptr[5];
r6 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1); /* cos*cr + sin*ci */
r7 = MULHIGH(cosx, t1) - MULHIGH(sinx, t0); /* cos*ci - sin*cr */
csptr += 6;
t0 = r4;
t1 = r5;
r4 = t0 + r6;
r5 = r7 - t1;
r6 = t0 - r6;
r7 = r7 + t1;
xptr[0] = r0 + r5;
xptr[1] = r1 + r6;
xptr -= step;
xptr[0] = r2 - r4;
xptr[1] = r3 - r7;
xptr -= step;
xptr[0] = r0 - r5;
xptr[1] = r1 - r6;
xptr -= step;
xptr[0] = r2 + r4;
xptr[1] = r3 + r7;
xptr += 2;
}
xptr += 3*step;
}
twidTab += 3*step;
bgn <<= 2;
}
}
**********************************************************************************/
static void Radix4FFT(int *buf, int num, int bgn, int *twidTab)
{
int r0, r1, r2, r3;
int r4, r5, r6, r7;
int t0, t1;
int sinx, cosx;
int i, j, step;
int *xptr, *csptr;
for (num >>= 2; num != 0; num >>= 2)
{
step = 2*bgn;
xptr = buf;
for (i = num; i != 0; i--)
{
csptr = twidTab;
for (j = bgn; j != 0; j--)
{
r0 = xptr[0];
r1 = xptr[1];
xptr += step;
t0 = xptr[0];
t1 = xptr[1];
cosx = csptr[0];
sinx = csptr[1];
r2 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1); /* cos*br + sin*bi */
r3 = MULHIGH(cosx, t1) - MULHIGH(sinx, t0); /* cos*bi - sin*br */
xptr += step;
t0 = r0 >> 2;
t1 = r1 >> 2;
r0 = t0 - r2;
r1 = t1 - r3;
r2 = t0 + r2;
r3 = t1 + r3;
t0 = xptr[0];
t1 = xptr[1];
cosx = csptr[2];
sinx = csptr[3];
r4 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1); /* cos*cr + sin*ci */
r5 = MULHIGH(cosx, t1) - MULHIGH(sinx, t0); /* cos*ci - sin*cr */
xptr += step;
t0 = xptr[0];
t1 = xptr[1];
cosx = csptr[4];
sinx = csptr[5];
r6 = MULHIGH(cosx, t0) + MULHIGH(sinx, t1); /* cos*cr + sin*ci */
r7 = MULHIGH(cosx, t1) - MULHIGH(sinx, t0); /* cos*ci - sin*cr */
csptr += 6;
t0 = r4;
t1 = r5;
r4 = t0 + r6;
r5 = r7 - t1;
r6 = t0 - r6;
r7 = r7 + t1;
xptr[0] = r0 + r5;
xptr[1] = r1 + r6;
xptr -= step;
xptr[0] = r2 - r4;
xptr[1] = r3 - r7;
xptr -= step;
xptr[0] = r0 - r5;
xptr[1] = r1 - r6;
xptr -= step;
xptr[0] = r2 + r4;
xptr[1] = r3 + r7;
xptr += 2;
}
xptr += 3*step;
}
twidTab += 3*step;
bgn <<= 2;
}
}
/*********************************************************************************
*
* function name: PreMDCT
* description: prepare MDCT process for next FFT compute
*
**********************************************************************************/
static void PreMDCT(int *buf0, int num, const int *csptr)
{
int i;
int tr1, ti1, tr2, ti2;
int cosa, sina, cosb, sinb;
int *buf1;
buf1 = buf0 + num - 1;
for(i = num >> 2; i != 0; i--)
{
cosa = *csptr++;
sina = *csptr++;
cosb = *csptr++;
sinb = *csptr++;
tr1 = *(buf0 + 0);
ti2 = *(buf0 + 1);
tr2 = *(buf1 - 1);
ti1 = *(buf1 + 0);
*buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1);
*buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1);
*buf1-- = MULHIGH(cosb, ti2) - MULHIGH(sinb, tr2);
*buf1-- = MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2);
}
}
**********************************************************************************/
static void PreMDCT(int *buf0, int num, const int *csptr)
{
int i;
int tr1, ti1, tr2, ti2;
int cosa, sina, cosb, sinb;
int *buf1;
buf1 = buf0 + num - 1;
for(i = num >> 2; i != 0; i--)
{
cosa = *csptr++;
sina = *csptr++;
cosb = *csptr++;
sinb = *csptr++;
tr1 = *(buf0 + 0);
ti2 = *(buf0 + 1);
tr2 = *(buf1 - 1);
ti1 = *(buf1 + 0);
*buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1);
*buf0++ = MULHIGH(cosa, ti1) - MULHIGH(sina, tr1);
*buf1-- = MULHIGH(cosb, ti2) - MULHIGH(sinb, tr2);
*buf1-- = MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2);
}
}
/*********************************************************************************
*
* function name: PostMDCT
* description: post MDCT process after next FFT for MDCT
*
**********************************************************************************/
static void PostMDCT(int *buf0, int num, const int *csptr)
{
int i;
int tr1, ti1, tr2, ti2;
int cosa, sina, cosb, sinb;
int *buf1;
buf1 = buf0 + num - 1;
for(i = num >> 2; i != 0; i--)
{
cosa = *csptr++;
sina = *csptr++;
cosb = *csptr++;
sinb = *csptr++;
tr1 = *(buf0 + 0);
ti1 = *(buf0 + 1);
ti2 = *(buf1 + 0);
tr2 = *(buf1 - 1);
*buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1);
*buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1);
*buf0++ = MULHIGH(sinb, tr2) - MULHIGH(cosb, ti2);
*buf1-- = MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2);
}
}
#endif
**********************************************************************************/
static void PostMDCT(int *buf0, int num, const int *csptr)
{
int i;
int tr1, ti1, tr2, ti2;
int cosa, sina, cosb, sinb;
int *buf1;
buf1 = buf0 + num - 1;
for(i = num >> 2; i != 0; i--)
{
cosa = *csptr++;
sina = *csptr++;
cosb = *csptr++;
sinb = *csptr++;
tr1 = *(buf0 + 0);
ti1 = *(buf0 + 1);
ti2 = *(buf1 + 0);
tr2 = *(buf1 - 1);
*buf0++ = MULHIGH(cosa, tr1) + MULHIGH(sina, ti1);
*buf1-- = MULHIGH(sina, tr1) - MULHIGH(cosa, ti1);
*buf0++ = MULHIGH(sinb, tr2) - MULHIGH(cosb, ti2);
*buf1-- = MULHIGH(cosb, tr2) + MULHIGH(sinb, ti2);
}
}
#endif
/**********************************************************************************
*
* function name: Mdct_Long
* description: the long block mdct, include long_start block, end_long block
*
**********************************************************************************/
void Mdct_Long(int *buf)
{
PreMDCT(buf, 1024, cossintab + 128);
Shuffle(buf, 512, bitrevTab + 17);
Radix8First(buf, 512 >> 3);
Radix4FFT(buf, 512 >> 3, 8, (int *)twidTab512);
PostMDCT(buf, 1024, cossintab + 128);
}
**********************************************************************************/
void Mdct_Long(int *buf)
{
PreMDCT(buf, 1024, cossintab + 128);
Shuffle(buf, 512, bitrevTab + 17);
Radix8First(buf, 512 >> 3);
Radix4FFT(buf, 512 >> 3, 8, (int *)twidTab512);
PostMDCT(buf, 1024, cossintab + 128);
}
/**********************************************************************************
*
* function name: Mdct_Short
* description: the short block mdct
*
**********************************************************************************/
void Mdct_Short(int *buf)
{
PreMDCT(buf, 128, cossintab);
Shuffle(buf, 64, bitrevTab);
Radix4First(buf, 64 >> 2);
Radix4FFT(buf, 64 >> 2, 4, (int *)twidTab64);
PostMDCT(buf, 128, cossintab);
}
**********************************************************************************/
void Mdct_Short(int *buf)
{
PreMDCT(buf, 128, cossintab);
Shuffle(buf, 64, bitrevTab);
Radix4First(buf, 64 >> 2);
Radix4FFT(buf, 64 >> 2, 4, (int *)twidTab64);
PostMDCT(buf, 128, cossintab);
}
/*****************************************************************************
@@ -419,31 +419,31 @@ static void shiftMdctDelayBuffer(Word16 *mdctDelayBuffer, /*! start of mdct dela
*srBuf++ = *dsBuf; dsBuf += chIncrement;
*srBuf++ = *dsBuf; dsBuf += chIncrement;
}
}
}
/*****************************************************************************
*
* function name: getScalefactorOfShortVectorStride
* description: Calculate max possible scale factor for input vector of shorts
* returns: Maximum scale factor
*
**********************************************************************************/
static Word16 getScalefactorOfShortVectorStride(const Word16 *vector, /*!< Pointer to input vector */
Word16 len, /*!< Length of input vector */
Word16 stride) /*!< Stride of input vector */
{
Word16 maxVal = 0;
Word16 absVal;
Word16 i;
for(i=0; i<len; i++){
absVal = abs_s(vector[i*stride]);
maxVal |= absVal;
}
return( maxVal ? norm_s(maxVal) : 15);
}
**********************************************************************************/
static Word16 getScalefactorOfShortVectorStride(const Word16 *vector, /*!< Pointer to input vector */
Word16 len, /*!< Length of input vector */
Word16 stride) /*!< Stride of input vector */
{
Word16 maxVal = 0;
Word16 absVal;
Word16 i;
for(i=0; i<len; i++){
absVal = abs_s(vector[i*stride]);
maxVal |= absVal;
}
return( maxVal ? norm_s(maxVal) : 15);
}
/*****************************************************************************
@@ -464,8 +464,8 @@ void Transform_Real(Word16 *mdctDelayBuffer,
Word32 i,w;
Word32 timeSignalSample;
Word32 ws1,ws2;
Word16 *dctIn0, *dctIn1;
Word32 *outData0, *outData1;
Word16 *dctIn0, *dctIn1;
Word32 *outData0, *outData1;
Word32 *winPtr;
Word32 delayBufferSf,timeSignalSf,minSf;
@@ -517,8 +517,8 @@ void Transform_Real(Word16 *mdctDelayBuffer,
*outData0-- = -((ws1 >> 2) + (ws2 >> 2));
}
Mdct_Long(realOut);
/* update scale factor */
Mdct_Long(realOut);
/* update scale factor */
minSf = 14 - minSf;
*mdctScale=minSf;
break;
@@ -543,7 +543,7 @@ void Transform_Real(Word16 *mdctDelayBuffer,
timeSignalSample = (*dctIn1--) << minSf;
ws2 = timeSignalSample * (*winPtr & 0xffff);
winPtr ++;
*outData0++ = (ws1 >> 2) - (ws2 >> 2); /* shift 2 to avoid overflow next */
*outData0++ = (ws1 >> 2) - (ws2 >> 2); /* shift 2 to avoid overflow next */
}
shiftMdctDelayBuffer(mdctDelayBuffer,timeSignal,chIncrement);
@@ -564,7 +564,7 @@ void Transform_Real(Word16 *mdctDelayBuffer,
timeSignalSample= (*dctIn1--) << minSf;
ws2 = timeSignalSample * (*winPtr >> 16);
winPtr++;
*outData0-- = -((ws1 >> 2) + (ws2 >> 2)); /* shift 2 to avoid overflow next */
*outData0-- = -((ws1 >> 2) + (ws2 >> 2)); /* shift 2 to avoid overflow next */
}
Mdct_Long(realOut);
@@ -600,7 +600,7 @@ void Transform_Real(Word16 *mdctDelayBuffer,
timeSignalSample= (*dctIn1--) << minSf;
ws2 = timeSignalSample * (*winPtr & 0xffff);
winPtr++;
*outData0++ = (ws1 >> 2) - (ws2 >> 2); /* shift 2 to avoid overflow next */
*outData0++ = (ws1 >> 2) - (ws2 >> 2); /* shift 2 to avoid overflow next */
}
shiftMdctDelayBuffer(mdctDelayBuffer,timeSignal,chIncrement);
@@ -615,8 +615,8 @@ void Transform_Real(Word16 *mdctDelayBuffer,
ws1 = timeSignalSample *(*winPtr & 0xffff);
timeSignalSample= (*dctIn1--) << minSf;
ws2 = timeSignalSample * (*winPtr >> 16);
*outData0-- = -((ws1 >> 2) + (ws2 >> 2)); /* shift 2 to avoid overflow next */
winPtr++;
*outData0-- = -((ws1 >> 2) + (ws2 >> 2)); /* shift 2 to avoid overflow next */
winPtr++;
}
Mdct_Long(realOut);
@@ -645,23 +645,23 @@ void Transform_Real(Word16 *mdctDelayBuffer,
ws1 = timeSignalSample * (*winPtr >> 16);
timeSignalSample= *dctIn1 << minSf;
ws2 = timeSignalSample * (*winPtr & 0xffff);
*outData0++ = (ws1 >> 2) - (ws2 >> 2); /* shift 2 to avoid overflow next */
*outData0++ = (ws1 >> 2) - (ws2 >> 2); /* shift 2 to avoid overflow next */
timeSignalSample= *(dctIn0 + FRAME_LEN_SHORT) << minSf;
ws1 = timeSignalSample * (*winPtr & 0xffff);
timeSignalSample= *(dctIn1 + FRAME_LEN_SHORT) << minSf;
ws2 = timeSignalSample * (*winPtr >> 16);
*outData1-- = -((ws1 >> 2) + (ws2 >> 2)); /* shift 2 to avoid overflow next */
winPtr++;
dctIn0++;
dctIn1--;
*outData1-- = -((ws1 >> 2) + (ws2 >> 2)); /* shift 2 to avoid overflow next */
winPtr++;
dctIn0++;
dctIn1--;
}
Mdct_Short(realOut);
realOut += FRAME_LEN_SHORT;
}
minSf = 11 - minSf;
*mdctScale = minSf; /* update scale factor */

View File

@@ -1,364 +1,364 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#ifdef LINUX
#include <dlfcn.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "voAMRWB.h"
#include "cmnMemory.h"
#define VOAMRWB_RFC3267_HEADER_INFO "#!AMR-WB\n"
#define INPUT_SIZE 640
#define OUTPUT_SIZE 1024
unsigned char InputBuf[INPUT_SIZE];
unsigned char OutputBuf[OUTPUT_SIZE];
void usage (void) {
printf ("AMR_WB Encoder HELP Displays this text\n");
printf ("\n");
printf ("Usage:\n");
printf ("AMRWBEnc [options] Input_file output_file \n");
printf ("\n");
printf ("Options +M* +F* +DTX \n");
printf ("Support \n");
printf ("Options +M* for seting compression bitrate mode, default is 23.85kbps\n");
printf (" +M0 = 6.6kbps \n");
printf (" +M1 = 8.85kbps \n");
printf (" +M2 = 12.65kbps \n");
printf (" +M3 = 14.25kbps \n");
printf (" +M4 = 15.58kbps \n");
printf (" +M5 = 18.25kbps \n");
printf (" +M6 = 19.85kbps \n");
printf (" +M7 = 23.05kbps \n");
printf (" +M8 = 23.85kbps \n");
printf ("\n");
printf ("Options +F* for setting output frame Type, default is RFC3267 \n");
printf ("+F0 for AMR_WB Defualt bit extern short data frame type \n");
printf ("+F1 for AMR_WB_ITU bit extern short data frame type \n");
printf ("+F2 for RFC3267\n ");
printf ("\n");
printf ("Options +DTX enable DTX mode, default is disable.\n");
printf ("File names, input raw PCM data, and output is AMR_WB bit-stream file.\n");
printf ("\n");
}
int GetNextBuf(FILE* inFile,unsigned char* dst,int size)
{
int size2 = (int)fread(dst, sizeof(signed char), size,inFile);
return size2;
}
typedef int (VO_API * VOGETAUDIOENCAPI) (VO_AUDIO_CODECAPI * pEncHandle);
int encode(
int mode,
short allow_dtx,
VOAMRWBFRAMETYPE frameType,
const char* srcfile,
const char* dstfile
)
{
int ret = 0;
int returnCode;
FILE *fsrc = NULL;
FILE *fdst = NULL;
int framenum = 0;
int eofFile = 0;
int size1 = 0;
int Relens;
VO_AUDIO_CODECAPI AudioAPI;
VO_MEM_OPERATOR moper;
VO_CODEC_INIT_USERDATA useData;
VO_HANDLE hCodec;
VO_CODECBUFFER inData;
VO_CODECBUFFER outData;
VO_AUDIO_OUTPUTINFO outFormat;
unsigned char *inBuf = InputBuf;
unsigned char *outBuf = OutputBuf;
#ifdef LINUX
void *handle = NULL;
void *pfunc;
VOGETAUDIOENCAPI pGetAPI;
#endif
clock_t start, finish;
double duration = 0.0;
if ((fsrc = fopen (srcfile, "rb")) == NULL)
{
ret = -1;
goto safe_exit;
}
if ((fdst = fopen (dstfile, "wb")) == NULL)
{
ret = -1;
goto safe_exit;
}
moper.Alloc = cmnMemAlloc;
moper.Copy = cmnMemCopy;
moper.Free = cmnMemFree;
moper.Set = cmnMemSet;
moper.Check = cmnMemCheck;
useData.memflag = VO_IMF_USERMEMOPERATOR;
useData.memData = (VO_PTR)(&moper);
#ifdef LINUX
handle = dlopen("/data/local/tmp/voAMRWBEnc.so", RTLD_NOW);
if(handle == 0)
{
printf("open dll error......");
return -1;
}
pfunc = dlsym(handle, "voGetAMRWBEncAPI");
if(pfunc == 0)
{
printf("open function error......");
return -1;
}
pGetAPI = (VOGETAUDIOENCAPI)pfunc;
returnCode = pGetAPI(&AudioAPI);
if(returnCode)
{
printf("get APIs error......");
return -1;
}
#else
ret = voGetAMRWBEncAPI(&AudioAPI);
if(ret)
{
ret = -1;
printf("get APIs error......");
goto safe_exit;
}
#endif
//####################################### Init Encoding Section #########################################
ret = AudioAPI.Init(&hCodec, VO_AUDIO_CodingAMRWB, &useData);
if(ret)
{
ret = -1;
printf("APIs init error......");
goto safe_exit;
}
Relens = GetNextBuf(fsrc,InputBuf,INPUT_SIZE);
if(Relens!=INPUT_SIZE && !feof(fsrc))
{
ret = -1; //Invalid magic number
printf("get next buffer error......");
goto safe_exit;
}
//###################################### set encode Mode ##################################################
ret = AudioAPI.SetParam(hCodec, VO_PID_AMRWB_FRAMETYPE, &frameType);
ret = AudioAPI.SetParam(hCodec, VO_PID_AMRWB_MODE, &mode);
ret = AudioAPI.SetParam(hCodec, VO_PID_AMRWB_DTX, &allow_dtx);
if(frameType == VOAMRWB_RFC3267)
{
/* write RFC3267 Header info to indicate single channel AMR file storage format */
size1 = (int)strlen(VOAMRWB_RFC3267_HEADER_INFO);
memcpy(outBuf, VOAMRWB_RFC3267_HEADER_INFO, size1);
outBuf += size1;
}
//####################################### Encoding Section #########################################
printf(" \n ---------------- Running -------------------------\n ");
do{
inData.Buffer = (unsigned char *)inBuf;
inData.Length = Relens;
outData.Buffer = outBuf;
start = clock();
/* decode one amr block */
returnCode = AudioAPI.SetInputData(hCodec,&inData);
do {
returnCode = AudioAPI.GetOutputData(hCodec,&outData, &outFormat);
if(returnCode == 0)
{
framenum++;
printf(" Frames processed: %hd\r", framenum);
if(framenum == 1)
{
fwrite(OutputBuf, 1, outData.Length + size1, fdst);
fflush(fdst);
}
else
{
fwrite(outData.Buffer, 1, outData.Length, fdst);
fflush(fdst);
}
}
else if(returnCode == VO_ERR_LICENSE_ERROR)
{
printf("Encoder time reach upper limit......");
goto safe_exit;
}
} while(returnCode != VO_ERR_INPUT_BUFFER_SMALL);
finish = clock();
duration += finish - start;
if (!eofFile) {
Relens = GetNextBuf(fsrc, InputBuf, INPUT_SIZE);
inBuf = InputBuf;
if (feof(fsrc) && Relens == 0)
eofFile = 1;
}
} while (!eofFile && returnCode);
//####################################### End Encoding Section #########################################
safe_exit:
returnCode = AudioAPI.Uninit(hCodec);
printf( "\n%2.5f seconds\n", (double)duration/CLOCKS_PER_SEC);
if (fsrc)
fclose(fsrc);
if (fdst)
fclose(fdst);
#ifdef LINUX
dlclose(handle);
#endif
return ret;
}
int main(int argc, char **argv) // for gcc compiler;
{
int mode, r;
int arg, filename=0;
char *inFileName = NULL;
char *outFileName = NULL;
short allow_dtx;
VOAMRWBFRAMETYPE frameType;
printf("\n");
printf("************************Adaptive Multi-Rate Wide Band Encoder (AMR-WB)*******************************\n");
printf("***********************************DEFINITIONS:*******************************************************\n");
printf("AMR-WB encoder scheme is based on the principle of Algebraic Code Excited Linear Prediction algorithm\n");
printf("The AMR-WB encoder compression MONO liner PCM speech input data at 16kHz sampling rate\n");
printf("to one of nine data rate modes-6.60, 8.85, 12.65, 14.25, 15.85, 18.25, 19.25, 23.05 and 23.85kbps.\n");
printf("The encoder supports output format AMRWB ITU, AMRWB RFC3267.\n");
printf("\n");
/*Encoder Default setting */
mode = VOAMRWB_MD2385;
allow_dtx = 0;
frameType = VOAMRWB_RFC3267;
if(argc < 3){
usage();
return 0;
}else{
for (arg = 1; arg < argc; arg++) {
if (argv [arg] [0] == '+') {
if(argv[arg][1] == 'M')
{
switch(argv[arg][2])
{
case '0': mode = VOAMRWB_MD66;
break;
case '1': mode = VOAMRWB_MD885;
break;
case '2': mode = VOAMRWB_MD1265;
break;
case '3': mode = VOAMRWB_MD1425;
break;
case '4': mode = VOAMRWB_MD1585;
break;
case '5': mode = VOAMRWB_MD1825;
break;
case '6': mode = VOAMRWB_MD1985;
break;
case '7': mode = VOAMRWB_MD2305;
break;
case '8': mode = VOAMRWB_MD2385;
break;
default:
usage();
printf ("Invalid parameter '%s'.\n", argv [arg]);
break;
}
}else if(argv[arg][1] == 'F')
{
switch(argv[arg][2])
{
case '0': frameType = VOAMRWB_DEFAULT;
break;
case '1': frameType = VOAMRWB_ITU;
break;
case '2': frameType = VOAMRWB_RFC3267 ;
break;
default:
usage();
printf ("Invalid parameter '%s'.\n", argv [arg]);
break;
}
}else if(strcmp (argv[arg], "+DTX") == 0)
{
allow_dtx = 1;
}
} else {
switch (filename) {
case 0:
inFileName = argv[arg];
break;
case 1:
outFileName = argv[arg];
break;
default:
usage ();
fprintf (stderr, "Invalid parameter '%s'.\n", argv [arg]);
return 0;
}
filename++;
}
}
}
r = encode(mode, allow_dtx, frameType, inFileName, outFileName);
if(r)
{
fprintf(stderr, "error: %d\n", r);
}
return r;
}
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#ifdef LINUX
#include <dlfcn.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "voAMRWB.h"
#include "cmnMemory.h"
#define VOAMRWB_RFC3267_HEADER_INFO "#!AMR-WB\n"
#define INPUT_SIZE 640
#define OUTPUT_SIZE 1024
unsigned char InputBuf[INPUT_SIZE];
unsigned char OutputBuf[OUTPUT_SIZE];
void usage (void) {
printf ("AMR_WB Encoder HELP Displays this text\n");
printf ("\n");
printf ("Usage:\n");
printf ("AMRWBEnc [options] Input_file output_file \n");
printf ("\n");
printf ("Options +M* +F* +DTX \n");
printf ("Support \n");
printf ("Options +M* for seting compression bitrate mode, default is 23.85kbps\n");
printf (" +M0 = 6.6kbps \n");
printf (" +M1 = 8.85kbps \n");
printf (" +M2 = 12.65kbps \n");
printf (" +M3 = 14.25kbps \n");
printf (" +M4 = 15.58kbps \n");
printf (" +M5 = 18.25kbps \n");
printf (" +M6 = 19.85kbps \n");
printf (" +M7 = 23.05kbps \n");
printf (" +M8 = 23.85kbps \n");
printf ("\n");
printf ("Options +F* for setting output frame Type, default is RFC3267 \n");
printf ("+F0 for AMR_WB Defualt bit extern short data frame type \n");
printf ("+F1 for AMR_WB_ITU bit extern short data frame type \n");
printf ("+F2 for RFC3267\n ");
printf ("\n");
printf ("Options +DTX enable DTX mode, default is disable.\n");
printf ("File names, input raw PCM data, and output is AMR_WB bit-stream file.\n");
printf ("\n");
}
int GetNextBuf(FILE* inFile,unsigned char* dst,int size)
{
int size2 = (int)fread(dst, sizeof(signed char), size,inFile);
return size2;
}
typedef int (VO_API * VOGETAUDIOENCAPI) (VO_AUDIO_CODECAPI * pEncHandle);
int encode(
int mode,
short allow_dtx,
VOAMRWBFRAMETYPE frameType,
const char* srcfile,
const char* dstfile
)
{
int ret = 0;
int returnCode;
FILE *fsrc = NULL;
FILE *fdst = NULL;
int framenum = 0;
int eofFile = 0;
int size1 = 0;
int Relens;
VO_AUDIO_CODECAPI AudioAPI;
VO_MEM_OPERATOR moper;
VO_CODEC_INIT_USERDATA useData;
VO_HANDLE hCodec;
VO_CODECBUFFER inData;
VO_CODECBUFFER outData;
VO_AUDIO_OUTPUTINFO outFormat;
unsigned char *inBuf = InputBuf;
unsigned char *outBuf = OutputBuf;
#ifdef LINUX
void *handle = NULL;
void *pfunc;
VOGETAUDIOENCAPI pGetAPI;
#endif
clock_t start, finish;
double duration = 0.0;
if ((fsrc = fopen (srcfile, "rb")) == NULL)
{
ret = -1;
goto safe_exit;
}
if ((fdst = fopen (dstfile, "wb")) == NULL)
{
ret = -1;
goto safe_exit;
}
moper.Alloc = cmnMemAlloc;
moper.Copy = cmnMemCopy;
moper.Free = cmnMemFree;
moper.Set = cmnMemSet;
moper.Check = cmnMemCheck;
useData.memflag = VO_IMF_USERMEMOPERATOR;
useData.memData = (VO_PTR)(&moper);
#ifdef LINUX
handle = dlopen("/data/local/tmp/voAMRWBEnc.so", RTLD_NOW);
if(handle == 0)
{
printf("open dll error......");
return -1;
}
pfunc = dlsym(handle, "voGetAMRWBEncAPI");
if(pfunc == 0)
{
printf("open function error......");
return -1;
}
pGetAPI = (VOGETAUDIOENCAPI)pfunc;
returnCode = pGetAPI(&AudioAPI);
if(returnCode)
{
printf("get APIs error......");
return -1;
}
#else
ret = voGetAMRWBEncAPI(&AudioAPI);
if(ret)
{
ret = -1;
printf("get APIs error......");
goto safe_exit;
}
#endif
//####################################### Init Encoding Section #########################################
ret = AudioAPI.Init(&hCodec, VO_AUDIO_CodingAMRWB, &useData);
if(ret)
{
ret = -1;
printf("APIs init error......");
goto safe_exit;
}
Relens = GetNextBuf(fsrc,InputBuf,INPUT_SIZE);
if(Relens!=INPUT_SIZE && !feof(fsrc))
{
ret = -1; //Invalid magic number
printf("get next buffer error......");
goto safe_exit;
}
//###################################### set encode Mode ##################################################
ret = AudioAPI.SetParam(hCodec, VO_PID_AMRWB_FRAMETYPE, &frameType);
ret = AudioAPI.SetParam(hCodec, VO_PID_AMRWB_MODE, &mode);
ret = AudioAPI.SetParam(hCodec, VO_PID_AMRWB_DTX, &allow_dtx);
if(frameType == VOAMRWB_RFC3267)
{
/* write RFC3267 Header info to indicate single channel AMR file storage format */
size1 = (int)strlen(VOAMRWB_RFC3267_HEADER_INFO);
memcpy(outBuf, VOAMRWB_RFC3267_HEADER_INFO, size1);
outBuf += size1;
}
//####################################### Encoding Section #########################################
printf(" \n ---------------- Running -------------------------\n ");
do{
inData.Buffer = (unsigned char *)inBuf;
inData.Length = Relens;
outData.Buffer = outBuf;
start = clock();
/* decode one amr block */
returnCode = AudioAPI.SetInputData(hCodec,&inData);
do {
returnCode = AudioAPI.GetOutputData(hCodec,&outData, &outFormat);
if(returnCode == 0)
{
framenum++;
printf(" Frames processed: %hd\r", framenum);
if(framenum == 1)
{
fwrite(OutputBuf, 1, outData.Length + size1, fdst);
fflush(fdst);
}
else
{
fwrite(outData.Buffer, 1, outData.Length, fdst);
fflush(fdst);
}
}
else if(returnCode == VO_ERR_LICENSE_ERROR)
{
printf("Encoder time reach upper limit......");
goto safe_exit;
}
} while(returnCode != VO_ERR_INPUT_BUFFER_SMALL);
finish = clock();
duration += finish - start;
if (!eofFile) {
Relens = GetNextBuf(fsrc, InputBuf, INPUT_SIZE);
inBuf = InputBuf;
if (feof(fsrc) && Relens == 0)
eofFile = 1;
}
} while (!eofFile && returnCode);
//####################################### End Encoding Section #########################################
safe_exit:
returnCode = AudioAPI.Uninit(hCodec);
printf( "\n%2.5f seconds\n", (double)duration/CLOCKS_PER_SEC);
if (fsrc)
fclose(fsrc);
if (fdst)
fclose(fdst);
#ifdef LINUX
dlclose(handle);
#endif
return ret;
}
int main(int argc, char **argv) // for gcc compiler;
{
int mode, r;
int arg, filename=0;
char *inFileName = NULL;
char *outFileName = NULL;
short allow_dtx;
VOAMRWBFRAMETYPE frameType;
printf("\n");
printf("************************Adaptive Multi-Rate Wide Band Encoder (AMR-WB)*******************************\n");
printf("***********************************DEFINITIONS:*******************************************************\n");
printf("AMR-WB encoder scheme is based on the principle of Algebraic Code Excited Linear Prediction algorithm\n");
printf("The AMR-WB encoder compression MONO liner PCM speech input data at 16kHz sampling rate\n");
printf("to one of nine data rate modes-6.60, 8.85, 12.65, 14.25, 15.85, 18.25, 19.25, 23.05 and 23.85kbps.\n");
printf("The encoder supports output format AMRWB ITU, AMRWB RFC3267.\n");
printf("\n");
/*Encoder Default setting */
mode = VOAMRWB_MD2385;
allow_dtx = 0;
frameType = VOAMRWB_RFC3267;
if(argc < 3){
usage();
return 0;
}else{
for (arg = 1; arg < argc; arg++) {
if (argv [arg] [0] == '+') {
if(argv[arg][1] == 'M')
{
switch(argv[arg][2])
{
case '0': mode = VOAMRWB_MD66;
break;
case '1': mode = VOAMRWB_MD885;
break;
case '2': mode = VOAMRWB_MD1265;
break;
case '3': mode = VOAMRWB_MD1425;
break;
case '4': mode = VOAMRWB_MD1585;
break;
case '5': mode = VOAMRWB_MD1825;
break;
case '6': mode = VOAMRWB_MD1985;
break;
case '7': mode = VOAMRWB_MD2305;
break;
case '8': mode = VOAMRWB_MD2385;
break;
default:
usage();
printf ("Invalid parameter '%s'.\n", argv [arg]);
break;
}
}else if(argv[arg][1] == 'F')
{
switch(argv[arg][2])
{
case '0': frameType = VOAMRWB_DEFAULT;
break;
case '1': frameType = VOAMRWB_ITU;
break;
case '2': frameType = VOAMRWB_RFC3267 ;
break;
default:
usage();
printf ("Invalid parameter '%s'.\n", argv [arg]);
break;
}
}else if(strcmp (argv[arg], "+DTX") == 0)
{
allow_dtx = 1;
}
} else {
switch (filename) {
case 0:
inFileName = argv[arg];
break;
case 1:
outFileName = argv[arg];
break;
default:
usage ();
fprintf (stderr, "Invalid parameter '%s'.\n", argv [arg]);
return 0;
}
filename++;
}
}
}
r = encode(mode, allow_dtx, frameType, inFileName, outFileName);
if(r)
{
fprintf(stderr, "error: %d\n", r);
}
return r;
}

View File

@@ -1,56 +1,56 @@
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v6
# module type
# please specify the type of your module: lib or exe
VOMT:= exe
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= #ARMV5E
# please specify the name of your module
VOTARGET:= voAMRWBEnc_Test
# please modify here to be sure to see the g1.mk
include ../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../
# please modify here to be sure to see the doit.mk
include ../../../../Tools/doit.mk
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# target6
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v6
# module type
# please specify the type of your module: lib or exe
VOMT:= exe
# module macros
# please append the additional macro definitions here for your module if necessary.
# e.g. -DVISUALON, macro VISUALON defined for your module
VOMM:= #ARMV5E
# please specify the name of your module
VOTARGET:= voAMRWBEnc_Test
# please modify here to be sure to see the g1.mk
include ../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../
# please modify here to be sure to see the doit.mk
include ../../../../Tools/doit.mk

View File

@@ -1,24 +1,24 @@
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# please list all objects needed by your target here
OBJS:=AMRWB_E_SAMPLE.o cmnMemory.o
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../ \
../../../../Common \
../../../../Include
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# please list all objects needed by your target here
OBJS:=AMRWB_E_SAMPLE.o cmnMemory.o
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../ \
../../../../Common \
../../../../Include

View File

@@ -1,53 +1,53 @@
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# target type
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v5
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
ifeq ($(VOTT), v5)
VOMM:=-DARM -DASM_OPT
endif
# please specify the name of your module
VOTARGET:= libvoAMRWBEncv5
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl -lstdc++ -lcutils
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# target type
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v5
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
ifeq ($(VOTT), v5)
VOMM:=-DARM -DASM_OPT
endif
# please specify the name of your module
VOTARGET:= libvoAMRWBEncv5
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl -lstdc++ -lcutils
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk

View File

@@ -1,53 +1,53 @@
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# target type
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v7
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
ifeq ($(VOTT), v7)
VOMM:=-DARM -DARMV7 -DASM_OPT
endif
# please specify the name of your module
VOTARGET:= libvoAMRWBEncv7
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl -lstdc++ -lcutils
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# target type
# available: pc, v4(armv4), v5(armv5), v5x(armv5 xscale), v6(armv6), v7(cortex-a8 neon)
VOTT:= v7
# module type
# please specify the type of your module: lib or exe
VOMT:= lib
# module macros
# please append the additional macro definitions here for your module if necessary.
ifeq ($(VOTT), v7)
VOMM:=-DARM -DARMV7 -DASM_OPT
endif
# please specify the name of your module
VOTARGET:= libvoAMRWBEncv7
# please modify here to be sure to see the g1.mk
include ../../../../../Tools/eclair.mk
# dependent libraries.
VODEPLIBS:=-ldl -lstdc++ -lcutils
# module source
# please modify here to be sure to see the ms.mk which specifies all source info of your module
include ../ms.mk
# please specify where is the voRelease on your PC, relative path is suggested
VORELDIR:=../../../../../../Release
# please modify here to be sure to see the doit.mk
include ../../../../../Tools/doit.mk

View File

@@ -1,43 +1,43 @@
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../../../inc \
../../../src \
../../../../../Include
# please list all objects needed by your target here
OBJS:= autocorr.o az_isp.o bits.o c2t64fx.o c4t64fx.o convolve.o cor_h_x.o decim54.o \
deemph.o dtx.o g_pitch.o gpclip.o homing.o hp400.o hp50.o hp6k.o hp_wsp.o \
int_lpc.o isp_az.o isp_isf.o lag_wind.o levinson.o log2.o lp_dec2.o math_op.o mem_align.o \
oper_32b.o p_med_ol.o pit_shrp.o pitch_f4.o pred_lt4.o preemph.o q_gain2.o q_pulse.o \
qisf_ns.o qpisf_2s.o random.o residu.o scale.o stream.o syn_filt.o updt_tar.o util.o \
voAMRWBEnc.o voicefac.o wb_vad.o weight_a.o
ifeq ($(VOTT), v5)
OBJS += cor_h_vec_opt.o Deemph_32_opt.o Dot_p_opt.o Filt_6k_7k_opt.o residu_asm_opt.o \
scale_sig_opt.o Syn_filt_32_opt.o syn_filt_opt.o pred_lt4_1_opt.o convolve_opt.o \
Norm_Corr_opt.o
VOSRCDIR+= ../../../src/asm/ARMV5E
endif
ifeq ($(VOTT), v7)
OBJS+= cor_h_vec_neon.o Deemph_32_neon.o Dot_p_neon.o Filt_6k_7k_neon.o residu_asm_neon.o \
scale_sig_neon.o Syn_filt_32_neon.o syn_filt_neon.o pred_lt4_1_neon.o convolve_neon.o \
Norm_Corr_neon.o
VOSRCDIR+= ../../../src/asm/ARMV7
endif
#/*
# ** Copyright 2003-2010, VisualOn, Inc.
# **
# ** Licensed under the Apache License, Version 2.0 (the "License");
# ** you may not use this file except in compliance with the License.
# ** You may obtain a copy of the License at
# **
# ** http://www.apache.org/licenses/LICENSE-2.0
# **
# ** Unless required by applicable law or agreed to in writing, software
# ** distributed under the License is distributed on an "AS IS" BASIS,
# ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# ** See the License for the specific language governing permissions and
# ** limitations under the License.
# */
# please list all directories that all source files relative with your module(.h .c .cpp) locate
VOSRCDIR:=../../../inc \
../../../src \
../../../../../Include
# please list all objects needed by your target here
OBJS:= autocorr.o az_isp.o bits.o c2t64fx.o c4t64fx.o convolve.o cor_h_x.o decim54.o \
deemph.o dtx.o g_pitch.o gpclip.o homing.o hp400.o hp50.o hp6k.o hp_wsp.o \
int_lpc.o isp_az.o isp_isf.o lag_wind.o levinson.o log2.o lp_dec2.o math_op.o mem_align.o \
oper_32b.o p_med_ol.o pit_shrp.o pitch_f4.o pred_lt4.o preemph.o q_gain2.o q_pulse.o \
qisf_ns.o qpisf_2s.o random.o residu.o scale.o stream.o syn_filt.o updt_tar.o util.o \
voAMRWBEnc.o voicefac.o wb_vad.o weight_a.o
ifeq ($(VOTT), v5)
OBJS += cor_h_vec_opt.o Deemph_32_opt.o Dot_p_opt.o Filt_6k_7k_opt.o residu_asm_opt.o \
scale_sig_opt.o Syn_filt_32_opt.o syn_filt_opt.o pred_lt4_1_opt.o convolve_opt.o \
Norm_Corr_opt.o
VOSRCDIR+= ../../../src/asm/ARMV5E
endif
ifeq ($(VOTT), v7)
OBJS+= cor_h_vec_neon.o Deemph_32_neon.o Dot_p_neon.o Filt_6k_7k_neon.o residu_asm_neon.o \
scale_sig_neon.o Syn_filt_32_neon.o syn_filt_neon.o pred_lt4_1_neon.o convolve_neon.o \
Norm_Corr_neon.o
VOSRCDIR+= ../../../src/asm/ARMV7
endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,92 +1,92 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* BITS.H *
*--------------------------------------------------------------------------*
* Number of bits for different modes *
*--------------------------------------------------------------------------*/
#ifndef __BITS_H__
#define __BITS_H__
#include <stdio.h>
#include "typedef.h"
#include "cnst.h"
#include "cod_main.h"
#define NBBITS_7k 132 /* 6.60k */
#define NBBITS_9k 177 /* 8.85k */
#define NBBITS_12k 253 /* 12.65k */
#define NBBITS_14k 285 /* 14.25k */
#define NBBITS_16k 317 /* 15.85k */
#define NBBITS_18k 365 /* 18.25k */
#define NBBITS_20k 397 /* 19.85k */
#define NBBITS_23k 461 /* 23.05k */
#define NBBITS_24k 477 /* 23.85k */
#define NBBITS_SID 35
#define NB_BITS_MAX NBBITS_24k
#define BIT_0 (Word16)-127
#define BIT_1 (Word16)127
#define BIT_0_ITU (Word16)0x007F
#define BIT_1_ITU (Word16)0x0081
#define SIZE_MAX1 (3+NB_BITS_MAX) /* serial size max */
#define TX_FRAME_TYPE (Word16)0x6b21
#define RX_FRAME_TYPE (Word16)0x6b20
static const Word16 nb_of_bits[NUM_OF_MODES] = {
NBBITS_7k,
NBBITS_9k,
NBBITS_12k,
NBBITS_14k,
NBBITS_16k,
NBBITS_18k,
NBBITS_20k,
NBBITS_23k,
NBBITS_24k,
NBBITS_SID
};
/*typedef struct
{
Word16 sid_update_counter;
Word16 sid_handover_debt;
Word16 prev_ft;
} TX_State;
*/
//typedef struct
//{
// Word16 prev_ft;
// Word16 prev_mode;
//} RX_State;
int PackBits(Word16 prms[], Word16 coding_mode, Word16 mode, Coder_State *st);
void Parm_serial(
Word16 value, /* input : parameter value */
Word16 no_of_bits, /* input : number of bits */
Word16 ** prms
);
#endif //__BITS_H__
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* BITS.H *
*--------------------------------------------------------------------------*
* Number of bits for different modes *
*--------------------------------------------------------------------------*/
#ifndef __BITS_H__
#define __BITS_H__
#include <stdio.h>
#include "typedef.h"
#include "cnst.h"
#include "cod_main.h"
#define NBBITS_7k 132 /* 6.60k */
#define NBBITS_9k 177 /* 8.85k */
#define NBBITS_12k 253 /* 12.65k */
#define NBBITS_14k 285 /* 14.25k */
#define NBBITS_16k 317 /* 15.85k */
#define NBBITS_18k 365 /* 18.25k */
#define NBBITS_20k 397 /* 19.85k */
#define NBBITS_23k 461 /* 23.05k */
#define NBBITS_24k 477 /* 23.85k */
#define NBBITS_SID 35
#define NB_BITS_MAX NBBITS_24k
#define BIT_0 (Word16)-127
#define BIT_1 (Word16)127
#define BIT_0_ITU (Word16)0x007F
#define BIT_1_ITU (Word16)0x0081
#define SIZE_MAX1 (3+NB_BITS_MAX) /* serial size max */
#define TX_FRAME_TYPE (Word16)0x6b21
#define RX_FRAME_TYPE (Word16)0x6b20
static const Word16 nb_of_bits[NUM_OF_MODES] = {
NBBITS_7k,
NBBITS_9k,
NBBITS_12k,
NBBITS_14k,
NBBITS_16k,
NBBITS_18k,
NBBITS_20k,
NBBITS_23k,
NBBITS_24k,
NBBITS_SID
};
/*typedef struct
{
Word16 sid_update_counter;
Word16 sid_handover_debt;
Word16 prev_ft;
} TX_State;
*/
//typedef struct
//{
// Word16 prev_ft;
// Word16 prev_mode;
//} RX_State;
int PackBits(Word16 prms[], Word16 coding_mode, Word16 mode, Coder_State *st);
void Parm_serial(
Word16 value, /* input : parameter value */
Word16 no_of_bits, /* input : number of bits */
Word16 ** prms
);
#endif //__BITS_H__

View File

@@ -1,81 +1,81 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* CNST.H *
*--------------------------------------------------------------------------*
* Codec constant parameters (coder and decoder) *
*--------------------------------------------------------------------------*/
#ifndef __CNST_H__
#define __CNST_H__
#define L_FRAME16k 320 /* Frame size at 16kHz */
#define L_FRAME 256 /* Frame size */
#define L_SUBFR16k 80 /* Subframe size at 16kHz */
#define L_SUBFR 64 /* Subframe size */
#define NB_SUBFR 4 /* Number of subframe per frame */
#define L_NEXT 64 /* Overhead in LP analysis */
#define L_WINDOW 384 /* window size in LP analysis */
#define L_TOTAL 384 /* Total size of speech buffer. */
#define M 16 /* Order of LP filter */
#define M16k 20
#define L_FILT16k 15 /* Delay of down-sampling filter */
#define L_FILT 12 /* Delay of up-sampling filter */
#define GP_CLIP 15565 /* Pitch gain clipping = 0.95 Q14 */
#define PIT_SHARP 27853 /* pitch sharpening factor = 0.85 Q15 */
#define PIT_MIN 34 /* Minimum pitch lag with resolution 1/4 */
#define PIT_FR2 128 /* Minimum pitch lag with resolution 1/2 */
#define PIT_FR1_9b 160 /* Minimum pitch lag with resolution 1 */
#define PIT_FR1_8b 92 /* Minimum pitch lag with resolution 1 */
#define PIT_MAX 231 /* Maximum pitch lag */
#define L_INTERPOL (16+1) /* Length of filter for interpolation */
#define OPL_DECIM 2 /* Decimation in open-loop pitch analysis */
#define PREEMPH_FAC 22282 /* preemphasis factor (0.68 in Q15) */
#define GAMMA1 30147 /* Weighting factor (numerator) (0.92 in Q15) */
#define TILT_FAC 22282 /* tilt factor (denominator) (0.68 in Q15) */
#define Q_MAX 8 /* scaling max for signal (see syn_filt_32) */
#define RANDOM_INITSEED 21845 /* own random init value */
#define L_MEANBUF 3
#define ONE_PER_MEANBUF 10923
#define MODE_7k 0
#define MODE_9k 1
#define MODE_12k 2
#define MODE_14k 3
#define MODE_16k 4
#define MODE_18k 5
#define MODE_20k 6
#define MODE_23k 7
#define MODE_24k 8
#define MRDTX 9
#define NUM_OF_MODES 10 /* see bits.h for bits definition */
#define EHF_MASK (Word16)0x0008 /* homing frame pattern */
#endif //__CNST_H__
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* CNST.H *
*--------------------------------------------------------------------------*
* Codec constant parameters (coder and decoder) *
*--------------------------------------------------------------------------*/
#ifndef __CNST_H__
#define __CNST_H__
#define L_FRAME16k 320 /* Frame size at 16kHz */
#define L_FRAME 256 /* Frame size */
#define L_SUBFR16k 80 /* Subframe size at 16kHz */
#define L_SUBFR 64 /* Subframe size */
#define NB_SUBFR 4 /* Number of subframe per frame */
#define L_NEXT 64 /* Overhead in LP analysis */
#define L_WINDOW 384 /* window size in LP analysis */
#define L_TOTAL 384 /* Total size of speech buffer. */
#define M 16 /* Order of LP filter */
#define M16k 20
#define L_FILT16k 15 /* Delay of down-sampling filter */
#define L_FILT 12 /* Delay of up-sampling filter */
#define GP_CLIP 15565 /* Pitch gain clipping = 0.95 Q14 */
#define PIT_SHARP 27853 /* pitch sharpening factor = 0.85 Q15 */
#define PIT_MIN 34 /* Minimum pitch lag with resolution 1/4 */
#define PIT_FR2 128 /* Minimum pitch lag with resolution 1/2 */
#define PIT_FR1_9b 160 /* Minimum pitch lag with resolution 1 */
#define PIT_FR1_8b 92 /* Minimum pitch lag with resolution 1 */
#define PIT_MAX 231 /* Maximum pitch lag */
#define L_INTERPOL (16+1) /* Length of filter for interpolation */
#define OPL_DECIM 2 /* Decimation in open-loop pitch analysis */
#define PREEMPH_FAC 22282 /* preemphasis factor (0.68 in Q15) */
#define GAMMA1 30147 /* Weighting factor (numerator) (0.92 in Q15) */
#define TILT_FAC 22282 /* tilt factor (denominator) (0.68 in Q15) */
#define Q_MAX 8 /* scaling max for signal (see syn_filt_32) */
#define RANDOM_INITSEED 21845 /* own random init value */
#define L_MEANBUF 3
#define ONE_PER_MEANBUF 10923
#define MODE_7k 0
#define MODE_9k 1
#define MODE_12k 2
#define MODE_14k 3
#define MODE_16k 4
#define MODE_18k 5
#define MODE_20k 6
#define MODE_23k 7
#define MODE_24k 8
#define MRDTX 9
#define NUM_OF_MODES 10 /* see bits.h for bits definition */
#define EHF_MASK (Word16)0x0008 /* homing frame pattern */
#endif //__CNST_H__

View File

@@ -1,103 +1,103 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* COD_MAIN.H *
*--------------------------------------------------------------------------*
* Static memory in the encoder *
*--------------------------------------------------------------------------*/
#ifndef __COD_MAIN_H__
#define __COD_MAIN_H__
#include "cnst.h" /* coder constant parameters */
#include "wb_vad.h"
#include "dtx.h"
#include "stream.h"
#include "voAMRWB.h"
typedef struct
{
Word16 mem_decim[2 * L_FILT16k]; /* speech decimated filter memory */
Word16 mem_sig_in[6]; /* hp50 filter memory */
Word16 mem_preemph; /* speech preemph filter memory */
Word16 old_speech[L_TOTAL - L_FRAME]; /* old speech vector at 12.8kHz */
Word16 old_wsp[PIT_MAX / OPL_DECIM]; /* old decimated weighted speech vector */
Word16 old_exc[PIT_MAX + L_INTERPOL]; /* old excitation vector */
Word16 mem_levinson[M + 2]; /* levinson routine memory */
Word16 ispold[M]; /* old isp (immittance spectral pairs) */
Word16 ispold_q[M]; /* quantized old isp */
Word16 past_isfq[M]; /* past isf quantizer */
Word16 mem_wsp; /* wsp vector memory */
Word16 mem_decim2[3]; /* wsp decimation filter memory */
Word16 mem_w0; /* target vector memory */
Word16 mem_syn[M]; /* synthesis memory */
Word16 tilt_code; /* tilt of code */
Word16 old_wsp_max; /* old wsp maximum value */
Word16 old_wsp_shift; /* old wsp shift */
Word16 Q_old; /* old scaling factor */
Word16 Q_max[2]; /* old maximum scaling factor */
Word16 gp_clip[2]; /* gain of pitch clipping memory */
Word16 qua_gain[4]; /* gain quantizer memory */
Word16 old_T0_med;
Word16 ol_gain;
Word16 ada_w;
Word16 ol_wght_flg;
Word16 old_ol_lag[5];
Word16 hp_wsp_mem[9];
Word16 old_hp_wsp[L_FRAME / OPL_DECIM + (PIT_MAX / OPL_DECIM)];
VadVars *vadSt;
dtx_encState *dtx_encSt;
Word16 first_frame;
Word16 isfold[M]; /* old isf (frequency domain) */
Word32 L_gc_thres; /* threshold for noise enhancer */
Word16 mem_syn_hi[M]; /* modified synthesis memory (MSB) */
Word16 mem_syn_lo[M]; /* modified synthesis memory (LSB) */
Word16 mem_deemph; /* speech deemph filter memory */
Word16 mem_sig_out[6]; /* hp50 filter memory for synthesis */
Word16 mem_hp400[6]; /* hp400 filter memory for synthesis */
Word16 mem_oversamp[2 * L_FILT]; /* synthesis oversampled filter memory */
Word16 mem_syn_hf[M]; /* HF synthesis memory */
Word16 mem_hf[2 * L_FILT16k]; /* HF band-pass filter memory */
Word16 mem_hf2[2 * L_FILT16k]; /* HF band-pass filter memory */
Word16 seed2; /* random memory for HF generation */
Word16 vad_hist;
Word16 gain_alpha;
/* TX_State structure */
Word16 sid_update_counter;
Word16 sid_handover_debt;
Word16 prev_ft;
Word16 allow_dtx;
/*some input/output buffer parameters */
unsigned char *inputStream;
int inputSize;
VOAMRWBMODE mode;
VOAMRWBFRAMETYPE frameType;
unsigned short *outputStream;
int outputSize;
FrameStream *stream;
VO_MEM_OPERATOR *pvoMemop;
VO_MEM_OPERATOR voMemoprator;
VO_PTR hCheck;
} Coder_State;
typedef void* HAMRENC;
#endif //__COD_MAIN_H__
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* COD_MAIN.H *
*--------------------------------------------------------------------------*
* Static memory in the encoder *
*--------------------------------------------------------------------------*/
#ifndef __COD_MAIN_H__
#define __COD_MAIN_H__
#include "cnst.h" /* coder constant parameters */
#include "wb_vad.h"
#include "dtx.h"
#include "stream.h"
#include "voAMRWB.h"
typedef struct
{
Word16 mem_decim[2 * L_FILT16k]; /* speech decimated filter memory */
Word16 mem_sig_in[6]; /* hp50 filter memory */
Word16 mem_preemph; /* speech preemph filter memory */
Word16 old_speech[L_TOTAL - L_FRAME]; /* old speech vector at 12.8kHz */
Word16 old_wsp[PIT_MAX / OPL_DECIM]; /* old decimated weighted speech vector */
Word16 old_exc[PIT_MAX + L_INTERPOL]; /* old excitation vector */
Word16 mem_levinson[M + 2]; /* levinson routine memory */
Word16 ispold[M]; /* old isp (immittance spectral pairs) */
Word16 ispold_q[M]; /* quantized old isp */
Word16 past_isfq[M]; /* past isf quantizer */
Word16 mem_wsp; /* wsp vector memory */
Word16 mem_decim2[3]; /* wsp decimation filter memory */
Word16 mem_w0; /* target vector memory */
Word16 mem_syn[M]; /* synthesis memory */
Word16 tilt_code; /* tilt of code */
Word16 old_wsp_max; /* old wsp maximum value */
Word16 old_wsp_shift; /* old wsp shift */
Word16 Q_old; /* old scaling factor */
Word16 Q_max[2]; /* old maximum scaling factor */
Word16 gp_clip[2]; /* gain of pitch clipping memory */
Word16 qua_gain[4]; /* gain quantizer memory */
Word16 old_T0_med;
Word16 ol_gain;
Word16 ada_w;
Word16 ol_wght_flg;
Word16 old_ol_lag[5];
Word16 hp_wsp_mem[9];
Word16 old_hp_wsp[L_FRAME / OPL_DECIM + (PIT_MAX / OPL_DECIM)];
VadVars *vadSt;
dtx_encState *dtx_encSt;
Word16 first_frame;
Word16 isfold[M]; /* old isf (frequency domain) */
Word32 L_gc_thres; /* threshold for noise enhancer */
Word16 mem_syn_hi[M]; /* modified synthesis memory (MSB) */
Word16 mem_syn_lo[M]; /* modified synthesis memory (LSB) */
Word16 mem_deemph; /* speech deemph filter memory */
Word16 mem_sig_out[6]; /* hp50 filter memory for synthesis */
Word16 mem_hp400[6]; /* hp400 filter memory for synthesis */
Word16 mem_oversamp[2 * L_FILT]; /* synthesis oversampled filter memory */
Word16 mem_syn_hf[M]; /* HF synthesis memory */
Word16 mem_hf[2 * L_FILT16k]; /* HF band-pass filter memory */
Word16 mem_hf2[2 * L_FILT16k]; /* HF band-pass filter memory */
Word16 seed2; /* random memory for HF generation */
Word16 vad_hist;
Word16 gain_alpha;
/* TX_State structure */
Word16 sid_update_counter;
Word16 sid_handover_debt;
Word16 prev_ft;
Word16 allow_dtx;
/*some input/output buffer parameters */
unsigned char *inputStream;
int inputSize;
VOAMRWBMODE mode;
VOAMRWBFRAMETYPE frameType;
unsigned short *outputStream;
int outputSize;
FrameStream *stream;
VO_MEM_OPERATOR *pvoMemop;
VO_MEM_OPERATOR voMemoprator;
VO_PTR hCheck;
} Coder_State;
typedef void* HAMRENC;
#endif //__COD_MAIN_H__

View File

@@ -1,115 +1,115 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* DTX.H *
*--------------------------------------------------------------------------*
* Static memory, constants and frametypes for the DTX *
*--------------------------------------------------------------------------*/
#ifndef __DTX_H__
#define __DTX_H__
#define DTX_MAX_EMPTY_THRESH 50
#define DTX_HIST_SIZE 8
#define DTX_HIST_SIZE_MIN_ONE 7
#define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
#define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
#define INV_MED_THRESH 14564
#define ISF_GAP 128 /* 50 */
#define ONE_MINUS_ISF_GAP 16384 - ISF_GAP
#define ISF_GAP 128
#define ISF_DITH_GAP 448
#define ISF_FACTOR_LOW 256
#define ISF_FACTOR_STEP 2
#define GAIN_THR 180
#define GAIN_FACTOR 75
typedef struct
{
Word16 isf_hist[M * DTX_HIST_SIZE];
Word16 log_en_hist[DTX_HIST_SIZE];
Word16 hist_ptr;
Word16 log_en_index;
Word16 cng_seed;
/* DTX handler stuff */
Word16 dtxHangoverCount;
Word16 decAnaElapsedCount;
Word32 D[28];
Word32 sumD[DTX_HIST_SIZE];
} dtx_encState;
#define SPEECH 0
#define DTX 1
#define DTX_MUTE 2
#define TX_SPEECH 0
#define TX_SID_FIRST 1
#define TX_SID_UPDATE 2
#define TX_NO_DATA 3
#define RX_SPEECH_GOOD 0
#define RX_SPEECH_PROBABLY_DEGRADED 1
#define RX_SPEECH_LOST 2
#define RX_SPEECH_BAD 3
#define RX_SID_FIRST 4
#define RX_SID_UPDATE 5
#define RX_SID_BAD 6
#define RX_NO_DATA 7
/*****************************************************************************
*
* DEFINITION OF DATA TYPES
*****************************************************************************/
Word16 dtx_enc_init(dtx_encState ** st, Word16 isf_init[], VO_MEM_OPERATOR *pMemOP);
Word16 dtx_enc_reset(dtx_encState * st, Word16 isf_init[]);
void dtx_enc_exit(dtx_encState ** st, VO_MEM_OPERATOR *pMemOP);
Word16 dtx_enc(
dtx_encState * st, /* i/o : State struct */
Word16 isf[M], /* o : CN ISF vector */
Word16 * exc2, /* o : CN excitation */
Word16 ** prms
);
Word16 dtx_buffer(
dtx_encState * st, /* i/o : State struct */
Word16 isf_new[], /* i : isf vector */
Word32 enr, /* i : residual energy (in L_FRAME) */
Word16 codec_mode
);
void tx_dtx_handler(dtx_encState * st, /* i/o : State struct */
Word16 vad_flag, /* i : vad decision */
Word16 * usedMode /* i/o : mode changed or not */
);
void Qisf_ns(
Word16 * isf1, /* input : ISF in the frequency domain (0..0.5) */
Word16 * isf_q, /* output: quantized ISF */
Word16 * indice /* output: quantization indices */
);
void Disf_ns(
Word16 * indice, /* input: quantization indices */
Word16 * isf_q /* input : ISF in the frequency domain (0..0.5) */
);
#endif //__DTX_H__
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* DTX.H *
*--------------------------------------------------------------------------*
* Static memory, constants and frametypes for the DTX *
*--------------------------------------------------------------------------*/
#ifndef __DTX_H__
#define __DTX_H__
#define DTX_MAX_EMPTY_THRESH 50
#define DTX_HIST_SIZE 8
#define DTX_HIST_SIZE_MIN_ONE 7
#define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
#define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
#define INV_MED_THRESH 14564
#define ISF_GAP 128 /* 50 */
#define ONE_MINUS_ISF_GAP 16384 - ISF_GAP
#define ISF_GAP 128
#define ISF_DITH_GAP 448
#define ISF_FACTOR_LOW 256
#define ISF_FACTOR_STEP 2
#define GAIN_THR 180
#define GAIN_FACTOR 75
typedef struct
{
Word16 isf_hist[M * DTX_HIST_SIZE];
Word16 log_en_hist[DTX_HIST_SIZE];
Word16 hist_ptr;
Word16 log_en_index;
Word16 cng_seed;
/* DTX handler stuff */
Word16 dtxHangoverCount;
Word16 decAnaElapsedCount;
Word32 D[28];
Word32 sumD[DTX_HIST_SIZE];
} dtx_encState;
#define SPEECH 0
#define DTX 1
#define DTX_MUTE 2
#define TX_SPEECH 0
#define TX_SID_FIRST 1
#define TX_SID_UPDATE 2
#define TX_NO_DATA 3
#define RX_SPEECH_GOOD 0
#define RX_SPEECH_PROBABLY_DEGRADED 1
#define RX_SPEECH_LOST 2
#define RX_SPEECH_BAD 3
#define RX_SID_FIRST 4
#define RX_SID_UPDATE 5
#define RX_SID_BAD 6
#define RX_NO_DATA 7
/*****************************************************************************
*
* DEFINITION OF DATA TYPES
*****************************************************************************/
Word16 dtx_enc_init(dtx_encState ** st, Word16 isf_init[], VO_MEM_OPERATOR *pMemOP);
Word16 dtx_enc_reset(dtx_encState * st, Word16 isf_init[]);
void dtx_enc_exit(dtx_encState ** st, VO_MEM_OPERATOR *pMemOP);
Word16 dtx_enc(
dtx_encState * st, /* i/o : State struct */
Word16 isf[M], /* o : CN ISF vector */
Word16 * exc2, /* o : CN excitation */
Word16 ** prms
);
Word16 dtx_buffer(
dtx_encState * st, /* i/o : State struct */
Word16 isf_new[], /* i : isf vector */
Word32 enr, /* i : residual energy (in L_FRAME) */
Word16 codec_mode
);
void tx_dtx_handler(dtx_encState * st, /* i/o : State struct */
Word16 vad_flag, /* i : vad decision */
Word16 * usedMode /* i/o : mode changed or not */
);
void Qisf_ns(
Word16 * isf1, /* input : ISF in the frequency domain (0..0.5) */
Word16 * isf_q, /* output: quantized ISF */
Word16 * indice /* output: quantization indices */
);
void Disf_ns(
Word16 * indice, /* input: quantization indices */
Word16 * isf_q /* input : ISF in the frequency domain (0..0.5) */
);
#endif //__DTX_H__

View File

@@ -1,53 +1,53 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*-------------------------------------------------------------*
* Table for az_isp() *
* *
* Vector grid[] is in Q15 *
* *
* grid[0] = 1.0; *
* grid[grid_points+1] = -1.0; *
* for (i = 1; i < grid_points; i++) *
* grid[i] = cos((6.283185307*i)/(2.0*grid_points)); *
* *
*-------------------------------------------------------------*/
/* Version 101 points */
#define GRID_POINTS 100
const Word16 vogrid[GRID_POINTS+1] ={
32767, 32751, 32703, 32622, 32509, 32364,
32187, 31978, 31738, 31466, 31164, 30830,
30466, 30072, 29649, 29196, 28714, 28204,
27666, 27101, 26509, 25891, 25248, 24579,
23886, 23170, 22431, 21669, 20887, 20083,
19260, 18418, 17557, 16680, 15786, 14876,
13951, 13013, 12062, 11099, 10125, 9141,
8149, 7148, 6140, 5126, 4106, 3083,
2057, 1029, 0, -1029, -2057, -3083,
-4106, -5126, -6140, -7148, -8149, -9141,
-10125, -11099, -12062, -13013, -13951, -14876,
-15786, -16680, -17557, -18418, -19260, -20083,
-20887, -21669, -22431, -23170, -23886, -24579,
-25248, -25891, -26509, -27101, -27666, -28204,
-28714, -29196, -29649, -30072, -30466, -30830,
-31164, -31466, -31738, -31978, -32187, -32364,
-32509, -32622, -32703, -32751, -32760};
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*-------------------------------------------------------------*
* Table for az_isp() *
* *
* Vector grid[] is in Q15 *
* *
* grid[0] = 1.0; *
* grid[grid_points+1] = -1.0; *
* for (i = 1; i < grid_points; i++) *
* grid[i] = cos((6.283185307*i)/(2.0*grid_points)); *
* *
*-------------------------------------------------------------*/
/* Version 101 points */
#define GRID_POINTS 100
const Word16 vogrid[GRID_POINTS+1] ={
32767, 32751, 32703, 32622, 32509, 32364,
32187, 31978, 31738, 31466, 31164, 30830,
30466, 30072, 29649, 29196, 28714, 28204,
27666, 27101, 26509, 25891, 25248, 24579,
23886, 23170, 22431, 21669, 20887, 20083,
19260, 18418, 17557, 16680, 15786, 14876,
13951, 13013, 12062, 11099, 10125, 9141,
8149, 7148, 6140, 5126, 4106, 3083,
2057, 1029, 0, -1029, -2057, -3083,
-4106, -5126, -6140, -7148, -8149, -9141,
-10125, -11099, -12062, -13013, -13951, -14876,
-15786, -16680, -17557, -18418, -19260, -20083,
-20887, -21669, -22431, -23170, -23886, -24579,
-25248, -25891, -26509, -27101, -27666, -28204,
-28714, -29196, -29649, -30072, -30466, -30830,
-31164, -31466, -31738, -31978, -32187, -32364,
-32509, -32622, -32703, -32751, -32760};

View File

@@ -1,73 +1,73 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/* Hamming_cos window for LPC analysis. */
/* Create with function hamm_cos(window,384-128,128) */
#define L_WINDOW 384
const Word16 vo_window[L_WINDOW] = {
2621, 2622, 2626, 2632, 2640, 2650, 2662, 2677,
2694, 2714, 2735, 2759, 2785, 2814, 2844, 2877,
2912, 2949, 2989, 3031, 3075, 3121, 3169, 3220,
3273, 3328, 3385, 3444, 3506, 3569, 3635, 3703,
3773, 3845, 3919, 3996, 4074, 4155, 4237, 4321,
4408, 4496, 4587, 4680, 4774, 4870, 4969, 5069,
5171, 5275, 5381, 5489, 5599, 5710, 5824, 5939,
6056, 6174, 6295, 6417, 6541, 6666, 6793, 6922,
7052, 7185, 7318, 7453, 7590, 7728, 7868, 8009,
8152, 8296, 8442, 8589, 8737, 8887, 9038, 9191,
9344, 9499, 9655, 9813, 9971, 10131, 10292, 10454,
10617, 10781, 10946, 11113, 11280, 11448, 11617, 11787,
11958, 12130, 12303, 12476, 12650, 12825, 13001, 13178,
13355, 13533, 13711, 13890, 14070, 14250, 14431, 14612,
14793, 14975, 15158, 15341, 15524, 15708, 15891, 16076,
16260, 16445, 16629, 16814, 16999, 17185, 17370, 17555,
17740, 17926, 18111, 18296, 18481, 18666, 18851, 19036,
19221, 19405, 19589, 19773, 19956, 20139, 20322, 20504,
20686, 20867, 21048, 21229, 21408, 21588, 21767, 21945,
22122, 22299, 22475, 22651, 22825, 22999, 23172, 23344,
23516, 23686, 23856, 24025, 24192, 24359, 24525, 24689,
24853, 25016, 25177, 25337, 25496, 25654, 25811, 25967,
26121, 26274, 26426, 26576, 26725, 26873, 27019, 27164,
27308, 27450, 27590, 27729, 27867, 28003, 28137, 28270,
28401, 28531, 28659, 28785, 28910, 29033, 29154, 29274,
29391, 29507, 29622, 29734, 29845, 29953, 30060, 30165,
30268, 30370, 30469, 30566, 30662, 30755, 30847, 30936,
31024, 31109, 31193, 31274, 31354, 31431, 31506, 31579,
31651, 31719, 31786, 31851, 31914, 31974, 32032, 32088,
32142, 32194, 32243, 32291, 32336, 32379, 32419, 32458,
32494, 32528, 32560, 32589, 32617, 32642, 32664, 32685,
32703, 32719, 32733, 32744, 32753, 32760, 32764, 32767,
32767, 32765, 32757, 32745, 32727, 32705, 32678, 32646,
32609, 32567, 32520, 32468, 32411, 32349, 32283, 32211,
32135, 32054, 31968, 31877, 31781, 31681, 31575, 31465,
31351, 31231, 31107, 30978, 30844, 30706, 30563, 30415,
30263, 30106, 29945, 29779, 29609, 29434, 29255, 29071,
28883, 28691, 28494, 28293, 28087, 27878, 27664, 27446,
27224, 26997, 26767, 26533, 26294, 26052, 25806, 25555,
25301, 25043, 24782, 24516, 24247, 23974, 23698, 23418,
23134, 22847, 22557, 22263, 21965, 21665, 21361, 21054,
20743, 20430, 20113, 19794, 19471, 19146, 18817, 18486,
18152, 17815, 17476, 17134, 16789, 16442, 16092, 15740,
15385, 15028, 14669, 14308, 13944, 13579, 13211, 12841,
12470, 12096, 11721, 11344, 10965, 10584, 10202, 9819,
9433, 9047, 8659, 8270, 7879, 7488, 7095, 6701,
6306, 5910, 5514, 5116, 4718, 4319, 3919, 3519,
3118, 2716, 2315, 1913, 1510, 1108, 705, 302};
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/* Hamming_cos window for LPC analysis. */
/* Create with function hamm_cos(window,384-128,128) */
#define L_WINDOW 384
const Word16 vo_window[L_WINDOW] = {
2621, 2622, 2626, 2632, 2640, 2650, 2662, 2677,
2694, 2714, 2735, 2759, 2785, 2814, 2844, 2877,
2912, 2949, 2989, 3031, 3075, 3121, 3169, 3220,
3273, 3328, 3385, 3444, 3506, 3569, 3635, 3703,
3773, 3845, 3919, 3996, 4074, 4155, 4237, 4321,
4408, 4496, 4587, 4680, 4774, 4870, 4969, 5069,
5171, 5275, 5381, 5489, 5599, 5710, 5824, 5939,
6056, 6174, 6295, 6417, 6541, 6666, 6793, 6922,
7052, 7185, 7318, 7453, 7590, 7728, 7868, 8009,
8152, 8296, 8442, 8589, 8737, 8887, 9038, 9191,
9344, 9499, 9655, 9813, 9971, 10131, 10292, 10454,
10617, 10781, 10946, 11113, 11280, 11448, 11617, 11787,
11958, 12130, 12303, 12476, 12650, 12825, 13001, 13178,
13355, 13533, 13711, 13890, 14070, 14250, 14431, 14612,
14793, 14975, 15158, 15341, 15524, 15708, 15891, 16076,
16260, 16445, 16629, 16814, 16999, 17185, 17370, 17555,
17740, 17926, 18111, 18296, 18481, 18666, 18851, 19036,
19221, 19405, 19589, 19773, 19956, 20139, 20322, 20504,
20686, 20867, 21048, 21229, 21408, 21588, 21767, 21945,
22122, 22299, 22475, 22651, 22825, 22999, 23172, 23344,
23516, 23686, 23856, 24025, 24192, 24359, 24525, 24689,
24853, 25016, 25177, 25337, 25496, 25654, 25811, 25967,
26121, 26274, 26426, 26576, 26725, 26873, 27019, 27164,
27308, 27450, 27590, 27729, 27867, 28003, 28137, 28270,
28401, 28531, 28659, 28785, 28910, 29033, 29154, 29274,
29391, 29507, 29622, 29734, 29845, 29953, 30060, 30165,
30268, 30370, 30469, 30566, 30662, 30755, 30847, 30936,
31024, 31109, 31193, 31274, 31354, 31431, 31506, 31579,
31651, 31719, 31786, 31851, 31914, 31974, 32032, 32088,
32142, 32194, 32243, 32291, 32336, 32379, 32419, 32458,
32494, 32528, 32560, 32589, 32617, 32642, 32664, 32685,
32703, 32719, 32733, 32744, 32753, 32760, 32764, 32767,
32767, 32765, 32757, 32745, 32727, 32705, 32678, 32646,
32609, 32567, 32520, 32468, 32411, 32349, 32283, 32211,
32135, 32054, 31968, 31877, 31781, 31681, 31575, 31465,
31351, 31231, 31107, 30978, 30844, 30706, 30563, 30415,
30263, 30106, 29945, 29779, 29609, 29434, 29255, 29071,
28883, 28691, 28494, 28293, 28087, 27878, 27664, 27446,
27224, 26997, 26767, 26533, 26294, 26052, 25806, 25555,
25301, 25043, 24782, 24516, 24247, 23974, 23698, 23418,
23134, 22847, 22557, 22263, 21965, 21665, 21361, 21054,
20743, 20430, 20113, 19794, 19471, 19146, 18817, 18486,
18152, 17815, 17476, 17134, 16789, 16442, 16092, 15740,
15385, 15028, 14669, 14308, 13944, 13579, 13211, 12841,
12470, 12096, 11721, 11344, 10965, 10584, 10202, 9819,
9433, 9047, 8659, 8270, 7879, 7488, 7095, 6701,
6306, 5910, 5514, 5116, 4718, 4319, 3919, 3519,
3118, 2716, 2315, 1913, 1510, 1108, 705, 302};

View File

@@ -1,123 +1,123 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#define DHF_PARMS_MAX 32 /* homing frame pattern */
#define NUM_OF_SPMODES 9
#define PRML 15
#define PRMN_7k NBBITS_7k/PRML + 1
#define PRMN_9k NBBITS_9k/PRML + 1
#define PRMN_12k NBBITS_12k/PRML + 1
#define PRMN_14k NBBITS_14k/PRML + 1
#define PRMN_16k NBBITS_16k/PRML + 1
#define PRMN_18k NBBITS_18k/PRML + 1
#define PRMN_20k NBBITS_20k/PRML + 1
#define PRMN_23k NBBITS_23k/PRML + 1
#define PRMN_24k NBBITS_24k/PRML + 1
static const Word16 dfh_M7k[PRMN_7k] =
{
3168, 29954, 29213, 16121,
64, 13440, 30624, 16430,
19008
};
static const Word16 dfh_M9k[PRMN_9k] =
{
3168, 31665, 9943, 9123,
15599, 4358, 20248, 2048,
17040, 27787, 16816, 13888
};
static const Word16 dfh_M12k[PRMN_12k] =
{
3168, 31665, 9943, 9128,
3647, 8129, 30930, 27926,
18880, 12319, 496, 1042,
4061, 20446, 25629, 28069,
13948
};
static const Word16 dfh_M14k[PRMN_14k] =
{
3168, 31665, 9943, 9131,
24815, 655, 26616, 26764,
7238, 19136, 6144, 88,
4158, 25733, 30567, 30494,
221, 20321, 17823
};
static const Word16 dfh_M16k[PRMN_16k] =
{
3168, 31665, 9943, 9131,
24815, 700, 3824, 7271,
26400, 9528, 6594, 26112,
108, 2068, 12867, 16317,
23035, 24632, 7528, 1752,
6759, 24576
};
static const Word16 dfh_M18k[PRMN_18k] =
{
3168, 31665, 9943, 9135,
14787, 14423, 30477, 24927,
25345, 30154, 916, 5728,
18978, 2048, 528, 16449,
2436, 3581, 23527, 29479,
8237, 16810, 27091, 19052,
0
};
static const Word16 dfh_M20k[PRMN_20k] =
{
3168, 31665, 9943, 9129,
8637, 31807, 24646, 736,
28643, 2977, 2566, 25564,
12930, 13960, 2048, 834,
3270, 4100, 26920, 16237,
31227, 17667, 15059, 20589,
30249, 29123, 0
};
static const Word16 dfh_M23k[PRMN_23k] =
{
3168, 31665, 9943, 9132,
16748, 3202, 28179, 16317,
30590, 15857, 19960, 8818,
21711, 21538, 4260, 16690,
20224, 3666, 4194, 9497,
16320, 15388, 5755, 31551,
14080, 3574, 15932, 50,
23392, 26053, 31216
};
static const Word16 dfh_M24k[PRMN_24k] =
{
3168, 31665, 9943, 9134,
24776, 5857, 18475, 28535,
29662, 14321, 16725, 4396,
29353, 10003, 17068, 20504,
720, 0, 8465, 12581,
28863, 24774, 9709, 26043,
7941, 27649, 13965, 15236,
18026, 22047, 16681, 3968
};
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#define DHF_PARMS_MAX 32 /* homing frame pattern */
#define NUM_OF_SPMODES 9
#define PRML 15
#define PRMN_7k NBBITS_7k/PRML + 1
#define PRMN_9k NBBITS_9k/PRML + 1
#define PRMN_12k NBBITS_12k/PRML + 1
#define PRMN_14k NBBITS_14k/PRML + 1
#define PRMN_16k NBBITS_16k/PRML + 1
#define PRMN_18k NBBITS_18k/PRML + 1
#define PRMN_20k NBBITS_20k/PRML + 1
#define PRMN_23k NBBITS_23k/PRML + 1
#define PRMN_24k NBBITS_24k/PRML + 1
static const Word16 dfh_M7k[PRMN_7k] =
{
3168, 29954, 29213, 16121,
64, 13440, 30624, 16430,
19008
};
static const Word16 dfh_M9k[PRMN_9k] =
{
3168, 31665, 9943, 9123,
15599, 4358, 20248, 2048,
17040, 27787, 16816, 13888
};
static const Word16 dfh_M12k[PRMN_12k] =
{
3168, 31665, 9943, 9128,
3647, 8129, 30930, 27926,
18880, 12319, 496, 1042,
4061, 20446, 25629, 28069,
13948
};
static const Word16 dfh_M14k[PRMN_14k] =
{
3168, 31665, 9943, 9131,
24815, 655, 26616, 26764,
7238, 19136, 6144, 88,
4158, 25733, 30567, 30494,
221, 20321, 17823
};
static const Word16 dfh_M16k[PRMN_16k] =
{
3168, 31665, 9943, 9131,
24815, 700, 3824, 7271,
26400, 9528, 6594, 26112,
108, 2068, 12867, 16317,
23035, 24632, 7528, 1752,
6759, 24576
};
static const Word16 dfh_M18k[PRMN_18k] =
{
3168, 31665, 9943, 9135,
14787, 14423, 30477, 24927,
25345, 30154, 916, 5728,
18978, 2048, 528, 16449,
2436, 3581, 23527, 29479,
8237, 16810, 27091, 19052,
0
};
static const Word16 dfh_M20k[PRMN_20k] =
{
3168, 31665, 9943, 9129,
8637, 31807, 24646, 736,
28643, 2977, 2566, 25564,
12930, 13960, 2048, 834,
3270, 4100, 26920, 16237,
31227, 17667, 15059, 20589,
30249, 29123, 0
};
static const Word16 dfh_M23k[PRMN_23k] =
{
3168, 31665, 9943, 9132,
16748, 3202, 28179, 16317,
30590, 15857, 19960, 8818,
21711, 21538, 4260, 16690,
20224, 3666, 4194, 9497,
16320, 15388, 5755, 31551,
14080, 3574, 15932, 50,
23392, 26053, 31216
};
static const Word16 dfh_M24k[PRMN_24k] =
{
3168, 31665, 9943, 9134,
24776, 5857, 18475, 28535,
29662, 14321, 16725, 4396,
29353, 10003, 17068, 20504,
720, 0, 8465, 12581,
28863, 24774, 9709, 26043,
7941, 27649, 13965, 15236,
18026, 22047, 16681, 3968
};

View File

@@ -1,62 +1,62 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*-----------------------------------------------------*
| Tables for function Isf_isp() and Isp_isf() |
*-----------------------------------------------------*/
/* table of cos(x) in Q15 */
const static Word16 table[129] = {
32767,
32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138,
31972, 31786, 31581, 31357, 31114, 30853, 30572, 30274,
29957, 29622, 29269, 28899, 28511, 28106, 27684, 27246,
26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170,
22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205,
17531, 16846, 16151, 15447, 14733, 14010, 13279, 12540,
11793, 11039, 10279, 9512, 8740, 7962, 7180, 6393,
5602, 4808, 4011, 3212, 2411, 1608, 804, 0,
-804, -1608, -2411, -3212, -4011, -4808, -5602, -6393,
-7180, -7962, -8740, -9512, -10279, -11039, -11793, -12540,
-13279, -14010, -14733, -15447, -16151, -16846, -17531, -18205,
-18868, -19520, -20160, -20788, -21403, -22006, -22595, -23170,
-23732, -24279, -24812, -25330, -25833, -26320, -26791, -27246,
-27684, -28106, -28511, -28899, -29269, -29622, -29957, -30274,
-30572, -30853, -31114, -31357, -31581, -31786, -31972, -32138,
-32286, -32413, -32522, -32610, -32679, -32729, -32758, -32768};
/* slope in Q11 used to compute y = acos(x) */
const static Word16 slope[128] = {
-26214, -9039, -5243, -3799, -2979, -2405, -2064, -1771,
-1579, -1409, -1279, -1170, -1079, -1004, -933, -880,
-827, -783, -743, -708, -676, -647, -621, -599,
-576, -557, -538, -521, -506, -492, -479, -466,
-456, -445, -435, -426, -417, -410, -402, -395,
-389, -383, -377, -372, -367, -363, -359, -355,
-351, -348, -345, -342, -340, -337, -335, -333,
-331, -330, -329, -328, -327, -326, -326, -326,
-326, -326, -326, -327, -328, -329, -330, -331,
-333, -335, -337, -340, -342, -345, -348, -351,
-355, -359, -363, -367, -372, -377, -383, -389,
-395, -402, -410, -417, -426, -435, -445, -456,
-466, -479, -492, -506, -521, -538, -557, -576,
-599, -621, -647, -676, -708, -743, -783, -827,
-880, -933, -1004, -1079, -1170, -1279, -1409, -1579,
-1771, -2064, -2405, -2979, -3799, -5243, -9039, -26214};
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*-----------------------------------------------------*
| Tables for function Isf_isp() and Isp_isf() |
*-----------------------------------------------------*/
/* table of cos(x) in Q15 */
const static Word16 table[129] = {
32767,
32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138,
31972, 31786, 31581, 31357, 31114, 30853, 30572, 30274,
29957, 29622, 29269, 28899, 28511, 28106, 27684, 27246,
26791, 26320, 25833, 25330, 24812, 24279, 23732, 23170,
22595, 22006, 21403, 20788, 20160, 19520, 18868, 18205,
17531, 16846, 16151, 15447, 14733, 14010, 13279, 12540,
11793, 11039, 10279, 9512, 8740, 7962, 7180, 6393,
5602, 4808, 4011, 3212, 2411, 1608, 804, 0,
-804, -1608, -2411, -3212, -4011, -4808, -5602, -6393,
-7180, -7962, -8740, -9512, -10279, -11039, -11793, -12540,
-13279, -14010, -14733, -15447, -16151, -16846, -17531, -18205,
-18868, -19520, -20160, -20788, -21403, -22006, -22595, -23170,
-23732, -24279, -24812, -25330, -25833, -26320, -26791, -27246,
-27684, -28106, -28511, -28899, -29269, -29622, -29957, -30274,
-30572, -30853, -31114, -31357, -31581, -31786, -31972, -32138,
-32286, -32413, -32522, -32610, -32679, -32729, -32758, -32768};
/* slope in Q11 used to compute y = acos(x) */
const static Word16 slope[128] = {
-26214, -9039, -5243, -3799, -2979, -2405, -2064, -1771,
-1579, -1409, -1279, -1170, -1079, -1004, -933, -880,
-827, -783, -743, -708, -676, -647, -621, -599,
-576, -557, -538, -521, -506, -492, -479, -466,
-456, -445, -435, -426, -417, -410, -402, -395,
-389, -383, -377, -372, -367, -363, -359, -355,
-351, -348, -345, -342, -340, -337, -335, -333,
-331, -330, -329, -328, -327, -326, -326, -326,
-326, -326, -326, -327, -328, -329, -330, -331,
-333, -335, -337, -340, -342, -345, -348, -351,
-355, -359, -363, -367, -372, -377, -383, -389,
-395, -402, -410, -417, -426, -435, -445, -456,
-466, -479, -492, -506, -521, -538, -557, -576,
-599, -621, -647, -676, -708, -743, -783, -827,
-880, -933, -1004, -1079, -1170, -1279, -1409, -1579,
-1771, -2064, -2405, -2979, -3799, -5243, -9039, -26214};

View File

@@ -1,81 +1,81 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*-----------------------------------------------------*
| Table of lag_window for autocorrelation. |
| noise floor = 1.0001 = (0.9999 on r[1] ..r[16]) |
| Bandwidth expansion = 60 Hz |
| Sampling frequency = 12800 Hz |
| |
| Special double precision format. See "math_op.c" |
| |
| lag_wind[0] = 1.00000000 (not stored) |
| lag_wind[1] = 0.99946642 |
| lag_wind[2] = 0.99816680 |
| lag_wind[3] = 0.99600452 |
| lag_wind[4] = 0.99298513 |
| lag_wind[5] = 0.98911655 |
| lag_wind[6] = 0.98440880 |
| lag_wind[7] = 0.97887397 |
| lag_wind[8] = 0.97252619 |
| lag_wind[9] = 0.96538186 |
| lag_wind[10]= 0.95745903 |
| lag_wind[11]= 0.94877797 |
| lag_wind[12]= 0.93936038 |
| lag_wind[13]= 0.92922986 |
| lag_wind[14]= 0.91841155 |
| lag_wind[15]= 0.90693212 |
| lag_wind[16]= 0.89481968 |
------------------------------------------------------*/
#define M 16
static Word16 volag_h[M] = {
32750,
32707,
32637,
32538,
32411,
32257,
32075,
31867,
31633,
31374,
31089,
30780,
30449,
30094,
29718,
29321};
static Word16 volag_l[M] = {
16896,
30464,
2496,
4480,
12160,
3520,
24320,
24192,
20736,
576,
18240,
31488,
128,
16704,
11520,
14784};
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*-----------------------------------------------------*
| Table of lag_window for autocorrelation. |
| noise floor = 1.0001 = (0.9999 on r[1] ..r[16]) |
| Bandwidth expansion = 60 Hz |
| Sampling frequency = 12800 Hz |
| |
| Special double precision format. See "math_op.c" |
| |
| lag_wind[0] = 1.00000000 (not stored) |
| lag_wind[1] = 0.99946642 |
| lag_wind[2] = 0.99816680 |
| lag_wind[3] = 0.99600452 |
| lag_wind[4] = 0.99298513 |
| lag_wind[5] = 0.98911655 |
| lag_wind[6] = 0.98440880 |
| lag_wind[7] = 0.97887397 |
| lag_wind[8] = 0.97252619 |
| lag_wind[9] = 0.96538186 |
| lag_wind[10]= 0.95745903 |
| lag_wind[11]= 0.94877797 |
| lag_wind[12]= 0.93936038 |
| lag_wind[13]= 0.92922986 |
| lag_wind[14]= 0.91841155 |
| lag_wind[15]= 0.90693212 |
| lag_wind[16]= 0.89481968 |
------------------------------------------------------*/
#define M 16
static Word16 volag_h[M] = {
32750,
32707,
32637,
32538,
32411,
32257,
32075,
31867,
31633,
31374,
31089,
30780,
30449,
30094,
29718,
29321};
static Word16 volag_l[M] = {
16896,
30464,
2496,
4480,
12160,
3520,
24320,
24192,
20736,
576,
18240,
31488,
128,
16704,
11520,
14784};

View File

@@ -1,62 +1,62 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/********************************************************************************
*
* File : log2.h
* Purpose : Computes log2(L_x)
*
********************************************************************************
*/
#ifndef __LOG2_H__
#define __LOG2_H__
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
/*
********************************************************************************
* DECLARATION OF PROTOTYPES
********************************************************************************
*/
void Log2 (
Word32 L_x, /* (i) : input value */
Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */
Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1)*/
);
void Log2_norm (
Word32 L_x, /* (i) : input value (normalized) */
Word16 exp, /* (i) : norm_l (L_x) */
Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */
Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */
);
#endif //__LOG2_H__
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/********************************************************************************
*
* File : log2.h
* Purpose : Computes log2(L_x)
*
********************************************************************************
*/
#ifndef __LOG2_H__
#define __LOG2_H__
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
/*
********************************************************************************
* DECLARATION OF PROTOTYPES
********************************************************************************
*/
void Log2 (
Word32 L_x, /* (i) : input value */
Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */
Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1)*/
);
void Log2_norm (
Word32 L_x, /* (i) : input value (normalized) */
Word16 exp, /* (i) : norm_l (L_x) */
Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */
Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */
);
#endif //__LOG2_H__

View File

@@ -1,35 +1,35 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
*
* File : log2.tab
* Purpose : Table for routine Log2().
* $Id $
*
********************************************************************************
*/
static const Word16 table[33] =
{
0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716,
12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033,
22951, 23852, 24735, 25603, 26455, 27291, 28113, 28922, 29716, 30497,
31266, 32023, 32767
};
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
*
* File : log2.tab
* Purpose : Table for routine Log2().
* $Id $
*
********************************************************************************
*/
static const Word16 table[33] =
{
0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716,
12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033,
22951, 23852, 24735, 25603, 26455, 27291, 28113, 28922, 29716, 30497,
31266, 32023, 32767
};

View File

@@ -1,45 +1,45 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* MAIN.H *
*--------------------------------------------------------------------------*
* Main functions *
*--------------------------------------------------------------------------*/
#ifndef __MAIN_H__
#define __MAIN_H__
void coder(
Word16 * mode, /* input : used mode */
Word16 speech16k[], /* input : 320 new speech samples (at 16 kHz) */
Word16 prms[], /* output: output parameters */
Word16 * ser_size, /* output: bit rate of the used mode */
void *spe_state, /* i/o : State structure */
Word16 allow_dtx /* input : DTX ON/OFF */
);
void Reset_encoder(void *st, Word16 reset_all);
Word16 encoder_homing_frame_test(Word16 input_frame[]);
#endif //__MAIN_H__
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* MAIN.H *
*--------------------------------------------------------------------------*
* Main functions *
*--------------------------------------------------------------------------*/
#ifndef __MAIN_H__
#define __MAIN_H__
void coder(
Word16 * mode, /* input : used mode */
Word16 speech16k[], /* input : 320 new speech samples (at 16 kHz) */
Word16 prms[], /* output: output parameters */
Word16 * ser_size, /* output: bit rate of the used mode */
void *spe_state, /* i/o : State structure */
Word16 allow_dtx /* input : DTX ON/OFF */
);
void Reset_encoder(void *st, Word16 reset_all);
Word16 encoder_homing_frame_test(Word16 input_frame[]);
#endif //__MAIN_H__

View File

@@ -1,55 +1,55 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* MATH_OP.H *
*--------------------------------------------------------------------------*
* Mathematical operations *
*--------------------------------------------------------------------------*/
#ifndef __MATH_OP_H__
#define __MATH_OP_H__
Word32 Isqrt( /* (o) Q31 : output value (range: 0<=val<1) */
Word32 L_x /* (i) Q0 : input value (range: 0<=val<=7fffffff) */
);
void Isqrt_n(
Word32 * frac, /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */
Word16 * exp /* (i/o) : exponent (value = frac x 2^exponent) */
);
Word32 Pow2( /* (o) Q0 : result (range: 0<=val<=0x7fffffff) */
Word16 exponant, /* (i) Q0 : Integer part. (range: 0<=val<=30) */
Word16 fraction /* (i) Q15 : Fractionnal part. (range: 0.0<=val<1.0) */
);
Word32 Dot_product12( /* (o) Q31: normalized result (1 < val <= -1) */
Word16 x[], /* (i) 12bits: x vector */
Word16 y[], /* (i) 12bits: y vector */
Word16 lg, /* (i) : vector length */
Word16 * exp /* (o) : exponent of result (0..+30) */
);
Word32 Dot_product12_asm( /* (o) Q31: normalized result (1 < val <= -1) */
Word16 x[], /* (i) 12bits: x vector */
Word16 y[], /* (i) 12bits: y vector */
Word16 lg, /* (i) : vector length */
Word16 * exp /* (o) : exponent of result (0..+30) */
);
#endif //__MATH_OP_H__
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*--------------------------------------------------------------------------*
* MATH_OP.H *
*--------------------------------------------------------------------------*
* Mathematical operations *
*--------------------------------------------------------------------------*/
#ifndef __MATH_OP_H__
#define __MATH_OP_H__
Word32 Isqrt( /* (o) Q31 : output value (range: 0<=val<1) */
Word32 L_x /* (i) Q0 : input value (range: 0<=val<=7fffffff) */
);
void Isqrt_n(
Word32 * frac, /* (i/o) Q31: normalized value (1.0 < frac <= 0.5) */
Word16 * exp /* (i/o) : exponent (value = frac x 2^exponent) */
);
Word32 Pow2( /* (o) Q0 : result (range: 0<=val<=0x7fffffff) */
Word16 exponant, /* (i) Q0 : Integer part. (range: 0<=val<=30) */
Word16 fraction /* (i) Q15 : Fractionnal part. (range: 0.0<=val<1.0) */
);
Word32 Dot_product12( /* (o) Q31: normalized result (1 < val <= -1) */
Word16 x[], /* (i) 12bits: x vector */
Word16 y[], /* (i) 12bits: y vector */
Word16 lg, /* (i) : vector length */
Word16 * exp /* (o) : exponent of result (0..+30) */
);
Word32 Dot_product12_asm( /* (o) Q31: normalized result (1 < val <= -1) */
Word16 x[], /* (i) 12bits: x vector */
Word16 y[], /* (i) 12bits: y vector */
Word16 lg, /* (i) : vector length */
Word16 * exp /* (o) : exponent of result (0..+30) */
);
#endif //__MATH_OP_H__

View File

@@ -1,35 +1,35 @@
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: mem_align.h
Content: Memory alloc alignments functions
*******************************************************************************/
#ifndef __VO_MEM_ALIGN_H__
#define __VO_MEM_ALIGN_H__
#include "voMem.h"
#include "typedef.h"
extern void *mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment, unsigned int CodecID);
extern void mem_free(VO_MEM_OPERATOR *pMemop, void *mem_ptr, unsigned int CodecID);
#endif /* __VO_MEM_ALIGN_H__ */
/*
** Copyright 2003-2010, VisualOn, Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
/*******************************************************************************
File: mem_align.h
Content: Memory alloc alignments functions
*******************************************************************************/
#ifndef __VO_MEM_ALIGN_H__
#define __VO_MEM_ALIGN_H__
#include "voMem.h"
#include "typedef.h"
extern void *mem_malloc(VO_MEM_OPERATOR *pMemop, unsigned int size, unsigned char alignment, unsigned int CodecID);
extern void mem_free(VO_MEM_OPERATOR *pMemop, void *mem_ptr, unsigned int CodecID);
#endif /* __VO_MEM_ALIGN_H__ */

Some files were not shown because too many files have changed in this diff Show More