From ebee08d10e8bfba90ebfab448d23683c16f2441e Mon Sep 17 00:00:00 2001 From: tipok Date: Thu, 6 Nov 2008 20:46:51 +0000 Subject: [PATCH] Little code cleanup near "AacEncEncode", re #2 --- .../darkice-aacp/src/aacPlusEncoder.cpp | 35 ++++++------------- .../darkice-aacp/src/aacPlusEncoder.h | 2 -- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/darkice/branches/darkice-aacp/src/aacPlusEncoder.cpp b/darkice/branches/darkice-aacp/src/aacPlusEncoder.cpp index 53eb143..2ce24a7 100644 --- a/darkice/branches/darkice-aacp/src/aacPlusEncoder.cpp +++ b/darkice/branches/darkice-aacp/src/aacPlusEncoder.cpp @@ -216,31 +216,18 @@ aacPlusEncoder :: write ( const void * buf, } /* encode one AAC frame */ - if (hEnvEnc && useParametricStereo) { - reportEvent(10, "Parametric Stereo encode one AAC frame"); - AacEncEncode( aacEnc, - inBuf, - 1, /* stride (step) */ - ancDataBytes, - &numAncDataBytes, - (unsigned *) (outBuf+ADTS_HEADER_SIZE), - &numOutBytes); - if(hEnvEnc) - memcpy( inBuf,inBuf+AACENC_BLOCKSIZE,CORE_INPUT_OFFSET_PS*sizeof(float)); - + reportEvent(10, "encode one AAC frame"); + AacEncEncode( aacEnc, + inBuf, + useParametricStereo ? 1 : MAX_CHANNELS, /* stride (step) */ + ancDataBytes, + &numAncDataBytes, + (unsigned *) (outBuf+ADTS_HEADER_SIZE), + &numOutBytes); + if (useParametricStereo) { + memcpy( inBuf,inBuf+AACENC_BLOCKSIZE,CORE_INPUT_OFFSET_PS*sizeof(float)); } else { - reportEvent(10, "encode one AAC frame"); - 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)); + memmove( inBuf,inBuf+AACENC_BLOCKSIZE*2*MAX_CHANNELS,writeOffset*sizeof(float)); } /* Write one frame of encoded audio */ diff --git a/darkice/branches/darkice-aacp/src/aacPlusEncoder.h b/darkice/branches/darkice-aacp/src/aacPlusEncoder.h index afe51d2..397830b 100644 --- a/darkice/branches/darkice-aacp/src/aacPlusEncoder.h +++ b/darkice/branches/darkice-aacp/src/aacPlusEncoder.h @@ -118,7 +118,6 @@ class aacPlusEncoder : public AudioEncoder, public virtual Reporter bool useParametricStereo; int coreWriteOffset; - int coreReadOffset; int envReadOffset; int writeOffset; struct AAC_ENCODER *aacEnc; @@ -168,7 +167,6 @@ class aacPlusEncoder : public AudioEncoder, public virtual Reporter useParametricStereo = 0; numAncDataBytes=0; coreWriteOffset = 0; - coreReadOffset = 0; envReadOffset = 0; writeOffset = INPUT_DELAY*MAX_CHANNELS; writtenSamples = 0;