📄 omxacaac_decodechanpairelt.c
字号:
/** * * File Name: omxACAAC_DecodeChanPairElt.c * OpenMAX DL: v1.0.2 * Revision: 10586 * Date: Wednesday, March 5, 2008 * * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. * * * * Description: * This file contains module for Parsing channel pair element information from AAC bitstream * */#include "omxtypes.h"#include "armOMX.h"#include "omxAC.h"#include "armAC.h"#include "armACAAC.h"#include "armCOMM.h"#include "armCOMM_Bitstream.h"/** * Function: omxACAAC_DecodeChanPairElt (3.2.3.1.4) * * Description: * Decodes the contents of a channel pair element (CPE) from the input * bitstream and copies the information into the output CPE data structure * *pChanPairElt, output individual channel stream side information structure * (ICS) *pIcsInfo, and output array of LTP information structures * *(pLtpInfo[0]), *(pLtpInfo[1]). Updates are conditional and depend on the * contents of the bitstream. The ICS information structure *pIcsInfo is * updated only if the flag parameter pChanPairElt->CommonWin== 1. The array * of LTP information structures *pLtpInfo is updated only if * (pChanPairElt >CommonWin == 1) && (audioObjectType==4). If * pChanPairElt->CommonWin == 0, then DecodeChanPairElt updates only the * structure member pChanPairElt->commonWin, and all other *pIcsInfo, * *pChanPairElt, and *pLtpInfo structure members/array elements remain * unchanged. * * Reference: [ISO14496-3], Table 4.5 * * Input Arguments: * * ppBitStream - double pointer to the current byte in the input bitstream * pOffset - pointer to the next available bit of the input bitstream byte * referenced by *ppBitStream. Valid in the range 0 to 7, where 0 * signifies the most significant bit and 7 signifies the least * significant bit * audioObjectType - index of the audio object type: 2=LC, 4=LTP * * Output Arguments: * * ppBitStream - double pointer to the current byte in the input bitstream, * updated after decoding the channel pair element. * pOffset - pointer to the next available bit of the input bitstream byte * referenced by *ppBitStream. Valid in the range 0 to 7, where 0 * signifies the most significant bit and 7 signifies the least * significant bit. * pIcsInfo - if pChanPairElt->CommonWin == 1, then pIcsInfo points to the * updated OMXAACIcsInfo structure. In this case, all structure * elements are updated unconditionally except as shown in Table * 3-9. Also in this case, only the first pIcsInfo->numWinGrp * elements in pIcsInfo-> pWinGrpLen are updated. Otherwise, if * pChanPairElt->CommonWin == 0 then none of the structure members * are modified; in this case the array pIcsInfo will be updated by * the function omxACAAC_NoiselessDecode. * pChanPairElt - pointer to the updated OMXAACChanPairElt structure. The * function modifies the commonWin structure member * unconditionally, but modifies the other members (msMaskPres and * ppMsMask array) only if (pChanPairElt->CommonWin == 1, as shown * in Table 3-10. * pLtpInfo - array containing two LTP information structure pointers. If * (pChanPairElt >CommonWin == 1) && (audioObjectType==4), then the * structures referenced by the pointers in this array are updated * to contain the LTP information associated with the individual * channels in the current CPE on which LTP has been enabled. Four * update scenarios are possible: i) no LTP information - if the * bit field predictor_data_present==0 within the ics_info syntax * element of the current CPE, then the array pLtpInfo is not * modified ii) LTP on the first CPE channel - if the elementary * stream bit field predictor_data_present==1 && the first * occurrence of the bit field ltp_data_present==1 then the * contents of *(pLtpInfo[0]) are updated; iii) LTP on the second * CPE channel - if predictor_data_present==1 && the second * occurrence of the bit field ltp_data_present==1 then the * contents of *(pLtpInfo[1]) are updated; iv) LTP on both CPE * channels - both cases ii) and iii) may occur simultaneously, in * which case both array elements are updated. Otherwise, if * (pChanPairElt->CommonWin == 0) || (audioObjectType!=4) then the * function omxACAAC_DecodeChanPairElt does not update the contents * of the structures referenced by the pointers in the array. * Under this condition, the array will be updated later in the * stream decoding process by the function * omxACAAC_NoiselessDecode. Reference: [ISO14496-3], sub-clause * 4.4.2.1 and Tables 4.5-4.6. Table 3-9: pIcsInfo Members Modified * Conditionally by DecodeChanPairElt Members Required Condition * SfGrouping pChanPairElt->CommonWin == 1 && pIcsInfo >winSequence * == 2 Members Required Condition predResetGroupNum Never * modified predReset Never modified pPredUsed[.] Never modified * Table 3-10: pChanPairElt Members Modified Conditionally by * DecodeChanPairElt Members Required Condition msMaskPres * pChanPairElt->CommonWin == 1 pMsMask[sfb] * pChanPairElg->CommonWin==1 && pChanPairElt >msMaskPres == 1 * * Return Value: * * OMX_Sts_NoErr - no error * OMX_Sts_BadArgErr - bad arguments * - at least one of the following pointers is NULL: ppBitStream, * pOffset, *ppBitStream, pIcsInfo or pChanPairElt. * - *pOffset exceeds [0, 7] * - audioObjectType!=2 && audioObjectType!=4 * OMX_Sts_InvalidBitstreamValErr - invalid bitstream parameter value * detected * - commonWin==1 and the decoded value of pIcsInfo->maxSfb is out of * range, i.e., exceeds [0,51] * */ OMXResult omxACAAC_DecodeChanPairElt( const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMXAACIcsInfo *pIcsInfo, OMXAACChanPairElt *pChanPairElt, OMX_INT audioObjectType, OMXAACLtpInfoPtr *pLtpInfo ){ OMX_INT i,j; OMXResult errorCode; /* Argument Check */ armRetArgErrIf( ppBitStream == NULL, OMX_Sts_BadArgErr); armRetArgErrIf( *ppBitStream == NULL, OMX_Sts_BadArgErr); armRetArgErrIf( pOffset == NULL, OMX_Sts_BadArgErr); armRetArgErrIf( pIcsInfo == NULL, OMX_Sts_BadArgErr); armRetArgErrIf( pLtpInfo == NULL, OMX_Sts_BadArgErr); armRetArgErrIf( pChanPairElt == NULL, OMX_Sts_BadArgErr); armRetArgErrIf( (*pOffset > 7) || (*pOffset < 0) , OMX_Sts_BadArgErr); armRetArgErrIf( (audioObjectType != 2) && (audioObjectType != 4), OMX_Sts_BadArgErr); /* Processing */ armSkipBits(ppBitStream,pOffset,4); /*element_instance_tag*/ pChanPairElt->commonWin = (OMX_INT)armGetBits(ppBitStream,pOffset,1); if(pChanPairElt->commonWin == 1) { errorCode = armACAAC_DecodeIcsInfoData(ppBitStream,pOffset, pChanPairElt->commonWin,audioObjectType, 0,NULL,pIcsInfo,pLtpInfo); armRetDataErrIf(errorCode != OMX_Sts_NoErr , errorCode); pChanPairElt->msMaskPres = (OMX_INT)armGetBits(ppBitStream,pOffset,2); if(pChanPairElt->msMaskPres == 1) { for(i = 0;i < pIcsInfo->numWinGrp;i++) { for(j = 0 ; j < pIcsInfo->maxSfb ; j++ ) { pChanPairElt->ppMsMask[i][j] = (OMX_INT)armGetBits(ppBitStream,pOffset,1); } } } }/*End if() */ return OMX_Sts_NoErr;} /* End of File */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -