aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/aacdecoder_lib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libAACdec/src/aacdecoder_lib.cpp')
-rw-r--r--libAACdec/src/aacdecoder_lib.cpp333
1 files changed, 171 insertions, 162 deletions
diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp
index bcbd46c..5319b7c 100644
--- a/libAACdec/src/aacdecoder_lib.cpp
+++ b/libAACdec/src/aacdecoder_lib.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2023 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -385,21 +385,19 @@ static INT aacDecoder_SbrCallback(
return errTp;
}
-static INT aacDecoder_SscCallback(void *handle, HANDLE_FDK_BITSTREAM hBs,
- const AUDIO_OBJECT_TYPE coreCodec,
- const INT samplingRate, const INT frameSize,
- const INT stereoConfigIndex,
- const INT coreSbrFrameLengthIndex,
- const INT configBytes, const UCHAR configMode,
- UCHAR *configChanged) {
+static INT aacDecoder_SscCallback(
+ void *handle, HANDLE_FDK_BITSTREAM hBs, const AUDIO_OBJECT_TYPE coreCodec,
+ const INT samplingRate, const INT frameSize, const INT numChannels,
+ const INT stereoConfigIndex, const INT coreSbrFrameLengthIndex,
+ const INT configBytes, const UCHAR configMode, UCHAR *configChanged) {
SACDEC_ERROR err;
TRANSPORTDEC_ERROR errTp;
HANDLE_AACDECODER hAacDecoder = (HANDLE_AACDECODER)handle;
err = mpegSurroundDecoder_Config(
(CMpegSurroundDecoder *)hAacDecoder->pMpegSurroundDecoder, hBs, coreCodec,
- samplingRate, frameSize, stereoConfigIndex, coreSbrFrameLengthIndex,
- configBytes, configMode, configChanged);
+ samplingRate, frameSize, numChannels, stereoConfigIndex,
+ coreSbrFrameLengthIndex, configBytes, configMode, configChanged);
switch (err) {
case MPS_UNSUPPORTED_CONFIG:
@@ -443,12 +441,23 @@ static INT aacDecoder_UniDrcCallback(void *handle, HANDLE_FDK_BITSTREAM hBs,
TRANSPORTDEC_ERROR errTp;
HANDLE_AACDECODER hAacDecoder = (HANDLE_AACDECODER)handle;
DRC_DEC_CODEC_MODE drcDecCodecMode = DRC_DEC_CODEC_MODE_UNDEFINED;
+ UCHAR dummyBuffer[4] = {0};
+ FDK_BITSTREAM dummyBs;
+ HANDLE_FDK_BITSTREAM hReadBs;
if (subStreamIndex != 0) {
return TRANSPORTDEC_OK;
}
- else if (aot == AOT_USAC) {
+ if (hBs == NULL) {
+ /* use dummy zero payload to clear memory */
+ hReadBs = &dummyBs;
+ FDKinitBitStream(hReadBs, dummyBuffer, 4, 24);
+ } else {
+ hReadBs = hBs;
+ }
+
+ if (aot == AOT_USAC) {
drcDecCodecMode = DRC_DEC_MPEG_D_USAC;
}
@@ -457,10 +466,10 @@ static INT aacDecoder_UniDrcCallback(void *handle, HANDLE_FDK_BITSTREAM hBs,
if (payloadType == 0) /* uniDrcConfig */
{
- err = FDK_drcDec_ReadUniDrcConfig(hAacDecoder->hUniDrcDecoder, hBs);
+ err = FDK_drcDec_ReadUniDrcConfig(hAacDecoder->hUniDrcDecoder, hReadBs);
} else /* loudnessInfoSet */
{
- err = FDK_drcDec_ReadLoudnessInfoSet(hAacDecoder->hUniDrcDecoder, hBs);
+ err = FDK_drcDec_ReadLoudnessInfoSet(hAacDecoder->hUniDrcDecoder, hReadBs);
hAacDecoder->loudnessInfoSetPosition[1] = payloadStart;
hAacDecoder->loudnessInfoSetPosition[2] = fullPayloadLength;
}
@@ -822,6 +831,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam(
case AAC_DRC_ATTENUATION_FACTOR:
/* DRC compression factor (where 0 is no and 127 is max compression) */
+ if ((value < 0) || (value > 127)) {
+ return AAC_DEC_SET_PARAM_FAIL;
+ }
errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_CUT_SCALE, value);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_COMPRESS,
value * (FL2FXCONST_DBL(0.5f / 127.0f)));
@@ -829,6 +841,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam(
case AAC_DRC_BOOST_FACTOR:
/* DRC boost factor (where 0 is no and 127 is max boost) */
+ if ((value < 0) || (value > 127)) {
+ return AAC_DEC_SET_PARAM_FAIL;
+ }
errorStatus = aacDecoder_drcSetParam(hDrcInfo, DRC_BOOST_SCALE, value);
uniDrcErr = FDK_drcDec_SetParam(self->hUniDrcDecoder, DRC_DEC_BOOST,
value * (FL2FXCONST_DBL(0.5f / 127.0f)));
@@ -1153,6 +1168,8 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
int applyCrossfade = 1; /* flag indicates if flushing was possible */
PCM_DEC *pTimeData2;
PCM_AAC *pTimeData3;
+ INT pcmLimiterScale = 0;
+ INT interleaved = 0;
if (self == NULL) {
return AAC_DEC_INVALID_HANDLE;
@@ -1175,8 +1192,10 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
aacDecoder_FreeMemCallback(self, &asc);
self->streamInfo.numChannels = 0;
/* 3) restore AudioSpecificConfig */
- transportDec_OutOfBandConfig(self->hInput, asc.config,
- (asc.configBits + 7) >> 3, 0);
+ if (asc.configBits <= (TP_USAC_MAX_CONFIG_LEN << 3)) {
+ transportDec_OutOfBandConfig(self->hInput, asc.config,
+ (asc.configBits + 7) >> 3, 0);
+ }
}
}
@@ -1609,6 +1628,11 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
/* set params */
sbrDecoder_SetParam(self->hSbrDecoder, SBR_SYSTEM_BITSTREAM_DELAY,
self->sbrParams.bsDelay);
+ sbrDecoder_SetParam(
+ self->hSbrDecoder, SBR_FLUSH_DATA,
+ (flags & AACDEC_FLUSH) |
+ ((self->flushStatus && !(flags & AACDEC_CONCEAL)) ? AACDEC_FLUSH
+ : 0));
sbrDecoder_SetParam(self->hSbrDecoder, SBR_SKIP_QMF, 1);
@@ -1659,7 +1683,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
{
if ((FDK_drcDec_GetParam(self->hUniDrcDecoder, DRC_DEC_IS_ACTIVE)) &&
- !(self->flags[0] & AC_RSV603DA)) {
+ (self->flags[0] & AC_USAC)) {
/* Apply DRC gains*/
int ch, drcDelay = 0;
int needsDeinterleaving = 0;
@@ -1667,8 +1691,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
FIXP_DBL channelGain[(8)];
int reverseInChannelMap[(8)];
int reverseOutChannelMap[(8)];
- int numDrcOutChannels = FDK_drcDec_GetParam(
- self->hUniDrcDecoder, DRC_DEC_TARGET_CHANNEL_COUNT_SELECTED);
FDKmemclear(channelGain, sizeof(channelGain));
for (ch = 0; ch < (8); ch++) {
reverseInChannelMap[ch] = ch;
@@ -1691,17 +1713,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
drcDelay += CConcealment_GetDelay(&self->concealCommonData) *
self->streamInfo.frameSize;
- for (ch = 0; ch < self->streamInfo.numChannels; ch++) {
- UCHAR mapValue = FDK_chMapDescr_getMapValue(
- &self->mapDescr, (UCHAR)ch, self->chMapIndex);
- if (mapValue < (8)) reverseInChannelMap[mapValue] = ch;
- }
- for (ch = 0; ch < (int)numDrcOutChannels; ch++) {
- UCHAR mapValue = FDK_chMapDescr_getMapValue(
- &self->mapDescr, (UCHAR)ch, numDrcOutChannels);
- if (mapValue < (8)) reverseOutChannelMap[mapValue] = ch;
- }
-
/* The output of SBR and MPS is interleaved. Deinterleaving may be
* necessary for FDK_drcDec_ProcessTime, which accepts deinterleaved
* audio only. */
@@ -1736,11 +1747,9 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
FDK_drcDec_Preprocess(self->hUniDrcDecoder);
/* apply DRC1 gain sequence */
- for (ch = 0; ch < self->streamInfo.numChannels; ch++) {
- FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, DRC_DEC_DRC1,
- ch, reverseInChannelMap[ch] - ch, 1,
- drcWorkBuffer, self->streamInfo.frameSize);
- }
+ FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay, DRC_DEC_DRC1,
+ 0, 0, self->streamInfo.numChannels,
+ drcWorkBuffer, self->streamInfo.frameSize);
/* apply downmix */
FDK_drcDec_ApplyDownmix(
self->hUniDrcDecoder, reverseInChannelMap, reverseOutChannelMap,
@@ -1748,12 +1757,10 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
&self->streamInfo.numChannels); /* self->streamInfo.numChannels
may change here */
/* apply DRC2/3 gain sequence */
- for (ch = 0; ch < self->streamInfo.numChannels; ch++) {
- FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay,
- DRC_DEC_DRC2_DRC3, ch,
- reverseOutChannelMap[ch] - ch, 1,
- drcWorkBuffer, self->streamInfo.frameSize);
- }
+ FDK_drcDec_ProcessTime(self->hUniDrcDecoder, drcDelay,
+ DRC_DEC_DRC2_DRC3, 0, 0,
+ self->streamInfo.numChannels, drcWorkBuffer,
+ self->streamInfo.frameSize);
if (needsDeinterleaving) {
FDK_interleave(
@@ -1796,8 +1803,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
}
if (self->streamInfo.extAot != AOT_AAC_SLS) {
- INT pcmLimiterScale = 0;
- INT interleaved = 0;
+ interleaved = 0;
interleaved |= (self->sbrEnabled) ? 1 : 0;
interleaved |= (self->mpsEnableCurr) ? 1 : 0;
PCMDMX_ERROR dmxErr = PCMDMX_OK;
@@ -1828,145 +1834,38 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
* predictable behavior and thus maybe produce strange output. */
ErrorStatus = AAC_DEC_DECODE_FRAME_ERROR;
}
-
- pcmLimiterScale += PCM_OUT_HEADROOM;
-
- if (flags & AACDEC_CLRHIST) {
- if (!(self->flags[0] & AC_USAC)) {
- /* Reset DRC data */
- aacDecoder_drcReset(self->hDrcInfo);
- /* Delete the delayed signal. */
- pcmLimiter_Reset(self->hLimiter);
- }
- }
-
- /* Set applyExtGain if DRC processing is enabled and if
- progRefLevelPresent is present for the first time. Consequences: The
- headroom of the output signal can be set to AACDEC_DRC_GAIN_SCALING
- only for audio formats which support legacy DRC Level Normalization.
- For all other audio formats the headroom of the output
- signal is set to PCM_OUT_HEADROOM. */
- if (self->hDrcInfo->enable &&
- (self->hDrcInfo->progRefLevelPresent == 1)) {
- self->hDrcInfo->applyExtGain |= 1;
- }
-
- /* Check whether time data buffer is large enough. */
- if (timeDataSize <
- (self->streamInfo.numChannels * self->streamInfo.frameSize)) {
- ErrorStatus = AAC_DEC_OUTPUT_BUFFER_TOO_SMALL;
- goto bail;
- }
-
- if (self->limiterEnableCurr) {
- /* use workBufferCore2 buffer for interleaving */
- PCM_LIM *pInterleaveBuffer;
- int blockLength = self->streamInfo.frameSize;
-
- /* Set actual signal parameters */
- pcmLimiter_SetNChannels(self->hLimiter, self->streamInfo.numChannels);
- pcmLimiter_SetSampleRate(self->hLimiter, self->streamInfo.sampleRate);
-
- if ((self->streamInfo.numChannels == 1) || (self->sbrEnabled) ||
- (self->mpsEnableCurr)) {
- pInterleaveBuffer = (PCM_LIM *)pTimeData2;
- } else {
- pInterleaveBuffer = (PCM_LIM *)self->workBufferCore2;
-
- /* applyLimiter requests for interleaved data */
- /* Interleave ouput buffer */
- FDK_interleave(pTimeData2, pInterleaveBuffer,
- self->streamInfo.numChannels, blockLength,
- self->streamInfo.frameSize);
- }
-
- FIXP_DBL *pGainPerSample = NULL;
-
- if (self->hDrcInfo->enable && self->hDrcInfo->applyExtGain) {
- pGainPerSample = self->workBufferCore1;
-
- if ((INT)GetRequiredMemWorkBufferCore1() <
- (INT)(self->streamInfo.frameSize * sizeof(FIXP_DBL))) {
- ErrorStatus = AAC_DEC_UNKNOWN;
- goto bail;
- }
-
- pcmLimiterScale = applyDrcLevelNormalization(
- self->hDrcInfo, (PCM_DEC *)pInterleaveBuffer, self->extGain,
- pGainPerSample, pcmLimiterScale, self->extGainDelay,
- self->streamInfo.frameSize, self->streamInfo.numChannels, 1, 1);
- }
-
- pcmLimiter_Apply(self->hLimiter, pInterleaveBuffer, pTimeData,
- pGainPerSample, pcmLimiterScale,
- self->streamInfo.frameSize);
-
- {
- /* Announce the additional limiter output delay */
- self->streamInfo.outputDelay += pcmLimiter_GetDelay(self->hLimiter);
- }
- } else {
- if (self->hDrcInfo->enable && self->hDrcInfo->applyExtGain) {
- pcmLimiterScale = applyDrcLevelNormalization(
- self->hDrcInfo, pTimeData2, self->extGain, NULL,
- pcmLimiterScale, self->extGainDelay, self->streamInfo.frameSize,
- self->streamInfo.numChannels,
- (interleaved || (self->streamInfo.numChannels == 1))
- ? 1
- : self->streamInfo.frameSize,
- 0);
- }
-
- /* If numChannels = 1 we do not need interleaving. The same applies if
- SBR or MPS are used, since their output is interleaved already
- (resampled or not) */
- if ((self->streamInfo.numChannels == 1) || (self->sbrEnabled) ||
- (self->mpsEnableCurr)) {
- scaleValuesSaturate(
- pTimeData, pTimeData2,
- self->streamInfo.frameSize * self->streamInfo.numChannels,
- pcmLimiterScale);
-
- } else {
- scaleValuesSaturate(
- (INT_PCM *)self->workBufferCore2, pTimeData2,
- self->streamInfo.frameSize * self->streamInfo.numChannels,
- pcmLimiterScale);
- /* Interleave ouput buffer */
- FDK_interleave((INT_PCM *)self->workBufferCore2, pTimeData,
- self->streamInfo.numChannels,
- self->streamInfo.frameSize,
- self->streamInfo.frameSize);
- }
- }
- } /* if (self->streamInfo.extAot != AOT_AAC_SLS)*/
+ }
if (self->flags[0] & AC_USAC) {
if (self->flushStatus == AACDEC_USAC_DASH_IPF_FLUSH_ON &&
!(flags & AACDEC_CONCEAL)) {
- CAacDecoder_PrepareCrossFade(pTimeData, self->pTimeDataFlush,
+ CAacDecoder_PrepareCrossFade(pTimeData2, self->pTimeDataFlush,
self->streamInfo.numChannels,
- self->streamInfo.frameSize, 1);
+ self->streamInfo.frameSize, interleaved);
}
/* prepare crossfade buffer for fade in */
- if (!applyCrossfade && self->applyCrossfade &&
+ if (!applyCrossfade &&
+ (self->applyCrossfade != AACDEC_CROSSFADE_BITMASK_OFF) &&
!(flags & AACDEC_CONCEAL)) {
for (int ch = 0; ch < self->streamInfo.numChannels; ch++) {
for (int i = 0; i < TIME_DATA_FLUSH_SIZE; i++) {
- self->pTimeDataFlush[ch][i] = 0;
+ self->pTimeDataFlush[ch][i] = (PCM_DEC)0;
}
}
applyCrossfade = 1;
}
- if (applyCrossfade && self->applyCrossfade &&
+ if (applyCrossfade &&
+ (self->applyCrossfade != AACDEC_CROSSFADE_BITMASK_OFF) &&
!(accessUnit < numPrerollAU) &&
(self->buildUpStatus == AACDEC_USAC_BUILD_UP_ON)) {
- CAacDecoder_ApplyCrossFade(pTimeData, self->pTimeDataFlush,
+ CAacDecoder_ApplyCrossFade(pTimeData2, self->pTimeDataFlush,
self->streamInfo.numChannels,
- self->streamInfo.frameSize, 1);
- self->applyCrossfade = 0;
+ self->streamInfo.frameSize, interleaved);
+ self->applyCrossfade =
+ AACDEC_CROSSFADE_BITMASK_OFF; /* disable cross-fade between frames
+ at nect config change */
}
}
@@ -2008,6 +1907,116 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_DecodeFrame(HANDLE_AACDECODER self,
((self->flushStatus == AACDEC_USAC_DASH_IPF_FLUSH_ON) &&
!(flags & AACDEC_CONCEAL)));
+ if (self->streamInfo.extAot != AOT_AAC_SLS) {
+ pcmLimiterScale += PCM_OUT_HEADROOM;
+
+ if (flags & AACDEC_CLRHIST) {
+ if (!(self->flags[0] & AC_USAC)) {
+ /* Reset DRC data */
+ aacDecoder_drcReset(self->hDrcInfo);
+ /* Delete the delayed signal. */
+ pcmLimiter_Reset(self->hLimiter);
+ }
+ }
+
+ /* Set applyExtGain if DRC processing is enabled and if progRefLevelPresent
+ is present for the first time. Consequences: The headroom of the output
+ signal can be set to AACDEC_DRC_GAIN_SCALING only for audio formats which
+ support legacy DRC Level Normalization. For all other audio formats the
+ headroom of the output signal is set to PCM_OUT_HEADROOM. */
+ if (self->hDrcInfo->enable && (self->hDrcInfo->progRefLevelPresent == 1)) {
+ self->hDrcInfo->applyExtGain |= 1;
+ }
+
+ /* Check whether time data buffer is large enough. */
+ if (timeDataSize <
+ (self->streamInfo.numChannels * self->streamInfo.frameSize)) {
+ ErrorStatus = AAC_DEC_OUTPUT_BUFFER_TOO_SMALL;
+ goto bail;
+ }
+
+ if (self->limiterEnableCurr) {
+ /* use workBufferCore2 buffer for interleaving */
+ PCM_LIM *pInterleaveBuffer;
+ int blockLength = self->streamInfo.frameSize;
+
+ /* Set actual signal parameters */
+ pcmLimiter_SetNChannels(self->hLimiter, self->streamInfo.numChannels);
+ pcmLimiter_SetSampleRate(self->hLimiter, self->streamInfo.sampleRate);
+
+ if ((self->streamInfo.numChannels == 1) || (self->sbrEnabled) ||
+ (self->mpsEnableCurr)) {
+ pInterleaveBuffer = (PCM_LIM *)pTimeData2;
+ } else {
+ pInterleaveBuffer = (PCM_LIM *)self->workBufferCore2;
+
+ /* applyLimiter requests for interleaved data */
+ /* Interleave ouput buffer */
+ FDK_interleave(pTimeData2, pInterleaveBuffer,
+ self->streamInfo.numChannels, blockLength,
+ self->streamInfo.frameSize);
+ }
+
+ FIXP_DBL *pGainPerSample = NULL;
+
+ if (self->hDrcInfo->enable && self->hDrcInfo->applyExtGain) {
+ pGainPerSample = self->workBufferCore1;
+
+ if ((INT)GetRequiredMemWorkBufferCore1() <
+ (INT)(self->streamInfo.frameSize * sizeof(FIXP_DBL))) {
+ ErrorStatus = AAC_DEC_UNKNOWN;
+ goto bail;
+ }
+
+ pcmLimiterScale = applyDrcLevelNormalization(
+ self->hDrcInfo, (PCM_DEC *)pInterleaveBuffer, self->extGain,
+ pGainPerSample, pcmLimiterScale, self->extGainDelay,
+ self->streamInfo.frameSize, self->streamInfo.numChannels, 1, 1);
+ }
+
+ pcmLimiter_Apply(self->hLimiter, pInterleaveBuffer, pTimeData,
+ pGainPerSample, pcmLimiterScale,
+ self->streamInfo.frameSize);
+
+ {
+ /* Announce the additional limiter output delay */
+ self->streamInfo.outputDelay += pcmLimiter_GetDelay(self->hLimiter);
+ }
+ } else {
+ if (self->hDrcInfo->enable && self->hDrcInfo->applyExtGain) {
+ pcmLimiterScale = applyDrcLevelNormalization(
+ self->hDrcInfo, pTimeData2, self->extGain, NULL, pcmLimiterScale,
+ self->extGainDelay, self->streamInfo.frameSize,
+ self->streamInfo.numChannels,
+ (interleaved || (self->streamInfo.numChannels == 1))
+ ? 1
+ : self->streamInfo.frameSize,
+ 0);
+ }
+
+ /* If numChannels = 1 we do not need interleaving. The same applies if SBR
+ or MPS are used, since their output is interleaved already (resampled or
+ not) */
+ if ((self->streamInfo.numChannels == 1) || (self->sbrEnabled) ||
+ (self->mpsEnableCurr)) {
+ scaleValuesSaturate(
+ pTimeData, pTimeData2,
+ self->streamInfo.frameSize * self->streamInfo.numChannels,
+ pcmLimiterScale);
+
+ } else {
+ scaleValuesSaturate(
+ (INT_PCM *)self->workBufferCore2, pTimeData2,
+ self->streamInfo.frameSize * self->streamInfo.numChannels,
+ pcmLimiterScale);
+ /* Interleave ouput buffer */
+ FDK_interleave((INT_PCM *)self->workBufferCore2, pTimeData,
+ self->streamInfo.numChannels, self->streamInfo.frameSize,
+ self->streamInfo.frameSize);
+ }
+ }
+ } /* if (self->streamInfo.extAot != AOT_AAC_SLS)*/
+
bail:
/* error in renderer part occurred, ErrorStatus was set to invalid output */