Little code cleanup near "AacEncEncode", re #2

This commit is contained in:
tipok 2008-11-06 20:46:51 +00:00
parent 0b0e568cd7
commit ebee08d10e
2 changed files with 11 additions and 26 deletions

View File

@ -216,31 +216,18 @@ aacPlusEncoder :: write ( const void * buf,
} }
/* encode one AAC frame */ /* encode one AAC frame */
if (hEnvEnc && useParametricStereo) { reportEvent(10, "encode one AAC frame");
reportEvent(10, "Parametric Stereo encode one AAC frame"); AacEncEncode( aacEnc,
AacEncEncode( aacEnc, inBuf,
inBuf, useParametricStereo ? 1 : MAX_CHANNELS, /* stride (step) */
1, /* stride (step) */ ancDataBytes,
ancDataBytes, &numAncDataBytes,
&numAncDataBytes, (unsigned *) (outBuf+ADTS_HEADER_SIZE),
(unsigned *) (outBuf+ADTS_HEADER_SIZE), &numOutBytes);
&numOutBytes); if (useParametricStereo) {
if(hEnvEnc) memcpy( inBuf,inBuf+AACENC_BLOCKSIZE,CORE_INPUT_OFFSET_PS*sizeof(float));
memcpy( inBuf,inBuf+AACENC_BLOCKSIZE,CORE_INPUT_OFFSET_PS*sizeof(float));
} else { } else {
reportEvent(10, "encode one AAC frame"); memmove( inBuf,inBuf+AACENC_BLOCKSIZE*2*MAX_CHANNELS,writeOffset*sizeof(float));
AacEncEncode( aacEnc,
inBuf + coreReadOffset,
MAX_CHANNELS,
ancDataBytes,
&numAncDataBytes,
(unsigned *) (outBuf+ADTS_HEADER_SIZE),
&numOutBytes);
reportEvent(10, "done AAC=", numOutBytes);
if(hEnvEnc)
memmove( inBuf,inBuf+AACENC_BLOCKSIZE*2*MAX_CHANNELS,writeOffset*sizeof(float));
} }
/* Write one frame of encoded audio */ /* Write one frame of encoded audio */

View File

@ -118,7 +118,6 @@ class aacPlusEncoder : public AudioEncoder, public virtual Reporter
bool useParametricStereo; bool useParametricStereo;
int coreWriteOffset; int coreWriteOffset;
int coreReadOffset;
int envReadOffset; int envReadOffset;
int writeOffset; int writeOffset;
struct AAC_ENCODER *aacEnc; struct AAC_ENCODER *aacEnc;
@ -168,7 +167,6 @@ class aacPlusEncoder : public AudioEncoder, public virtual Reporter
useParametricStereo = 0; useParametricStereo = 0;
numAncDataBytes=0; numAncDataBytes=0;
coreWriteOffset = 0; coreWriteOffset = 0;
coreReadOffset = 0;
envReadOffset = 0; envReadOffset = 0;
writeOffset = INPUT_DELAY*MAX_CHANNELS; writeOffset = INPUT_DELAY*MAX_CHANNELS;
writtenSamples = 0; writtenSamples = 0;