diff options
Diffstat (limited to 'media/libstagefright/codecs/aacenc/src/qc_main.c')
-rw-r--r-- | media/libstagefright/codecs/aacenc/src/qc_main.c | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/media/libstagefright/codecs/aacenc/src/qc_main.c b/media/libstagefright/codecs/aacenc/src/qc_main.c index a568020..e8c39e4 100644 --- a/media/libstagefright/codecs/aacenc/src/qc_main.c +++ b/media/libstagefright/codecs/aacenc/src/qc_main.c @@ -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; |