📄 omxacaac_unpackadtsframeheader.c
字号:
/** * * File Name: omxACAAC_UnpackADTSFrameHeader.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 ADTS header information from AAC bitstream * */ #include "omxtypes.h"#include "armOMX.h"#include "omxAC.h"#include "armCOMM.h"#include "armCOMM_Bitstream.h"/** * Function: omxACAAC_UnpackADTSFrameHeader (3.2.3.1.2) * * Description: * Unpacks the ADTS frame header from the input bit stream and copies the * contents into an ADTS header data structure. If the ADTS protection bit is * asserted (pADTSFrameHeader->protectionBit==0) then the 16-bit CRC word is * copied into pADTSFrameHeader->CRCWord. The first byte is stored in * pADTSFrameHeader->CRCWord[15:8], and the second byte is stored in * pADTSFrameHeader >CRCWord[7:0]. This function does not test for header * corruption. * * Reference: [ISO14496-3], Table 1.A.6 * * Input Arguments: * * ppBitStream - double pointer to the current byte in the input stream * pADTSFrameHeader - pointer an uninitialized OMXACCADTSHeader structure * * Output Arguments: * * ppBitStream - double pointer to the current byte after unpacking the * ADTS frame header. * pADTSFrameHeader - pointer to the updated OMXAACADTSFrameHeader * structure. All ADTS header structure members are updated by the * function to reflect the contents of the ADTS header in the input * stream. The structure member CRCWord is updated only if * protectionBit==1. * * Return Value: * * OMX_Sts_NoErr - no error * OMX_Sts_BadArgErr - bad arguments. * - At least one of the following pointers is NULL : * - ppBitStream, * - *ppBitStream, * - pADTSFrameHeader * */ OMXResult omxACAAC_UnpackADTSFrameHeader( const OMX_U8 **ppBitStream, OMXAACADTSFrameHeader *pADTSFrameHeader ){ OMX_INT offset = 0, *pOffset; /* Argument Check */ armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr); armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr); armRetArgErrIf(pADTSFrameHeader == NULL, OMX_Sts_BadArgErr); /* Processing */ pOffset = &offset; /* ADTS Fixed Header */ armByteAlign(ppBitStream, pOffset); armSkipBits(ppBitStream, pOffset, 12);/*Syncword*/ pADTSFrameHeader->id = (OMX_INT)armGetBits(ppBitStream, pOffset, 1); pADTSFrameHeader->layer = (OMX_INT)armGetBits(ppBitStream, pOffset, 2); pADTSFrameHeader->protectionBit = (OMX_INT)armGetBits(ppBitStream, pOffset, 1); pADTSFrameHeader->profile = (OMX_INT)armGetBits(ppBitStream, pOffset, 2); pADTSFrameHeader->samplingRateIndex = (OMX_INT)armGetBits(ppBitStream, pOffset, 4); pADTSFrameHeader->privateBit = (OMX_INT)armGetBits(ppBitStream, pOffset, 1); pADTSFrameHeader->chConfig = (OMX_INT)armGetBits(ppBitStream, pOffset, 3); pADTSFrameHeader->originalCopy = (OMX_INT)armGetBits(ppBitStream, pOffset, 1); pADTSFrameHeader->home = (OMX_INT)armGetBits(ppBitStream, pOffset, 1); /* ADTS Variable Header */ pADTSFrameHeader->cpRightIdBit = (OMX_INT)armGetBits(ppBitStream, pOffset, 1); pADTSFrameHeader->cpRightIdStart = (OMX_INT)armGetBits(ppBitStream, pOffset, 1); pADTSFrameHeader->frameLen = (OMX_INT)armGetBits(ppBitStream, pOffset, 13); pADTSFrameHeader->ADTSBufFullness = (OMX_INT)armGetBits(ppBitStream, pOffset, 11); pADTSFrameHeader->numRawBlock = (OMX_INT)armGetBits(ppBitStream, pOffset, 2); /* ADTS Error Check */ if(pADTSFrameHeader->protectionBit == 0) { /* Read CRC Word */ pADTSFrameHeader->CRCWord = (OMX_INT)armGetBits(ppBitStream, pOffset, 16); } return OMX_Sts_NoErr; }/* End of File */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -