diff options
Diffstat (limited to 'media/libstagefright/codecs/aacenc/src/bitenc.c')
-rw-r--r-- | media/libstagefright/codecs/aacenc/src/bitenc.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/media/libstagefright/codecs/aacenc/src/bitenc.c b/media/libstagefright/codecs/aacenc/src/bitenc.c index 588c2da..ea34407 100644 --- a/media/libstagefright/codecs/aacenc/src/bitenc.c +++ b/media/libstagefright/codecs/aacenc/src/bitenc.c @@ -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; |