📄 omxicjp_decodehuffmanspecinit_u8.c
字号:
/** * * * File Name: omxICJP_DecodeHuffmanSpecInit_U8.c * OpenMAX DL: v1.0.2 * Revision: 10586 * Date: Wednesday, March 5, 2008 * * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. * * * * Brief : Huffman table initialization function. * */#include "omxtypes.h"#include "armOMX.h"#include "omxIC.h"#include "armCOMM.h"#include "armIC.h"/** * Function: omxICJP_DecodeHuffmanSpecInit_U8 (5.1.3.5.2) * * Description: * Initializes the DC or AC Huffman decoder table specification. * * Input Arguments: * * pHuffBits - Pointer to the array of HUFFBITS, which contains the number * of Huffman codes for size 1-16 * pHuffValue - Pointer to the array of HUFFVAL, which contains the symbol * values to be associated with the Huffman codes ordering by size * * Output Arguments: * * pHuffTable - pointer to a OMXICJPHuffmanDecodeSpec data structure; must * be aligned on a 4 byte boundary. * * Return Value: * * OMX_Sts_NoErr - no error * OMX_Sts_BadArgErr - Bad arguments. Returned for any of the following * conditions: * - a pointer was NULL * */OMXResult omxICJP_DecodeHuffmanSpecInit_U8( const OMX_U8 *pHuffBits, const OMX_U8 *pHuffValue, OMXICJPHuffmanDecodeSpec *pHuffTable){ armICJP_DecHuffmanSpec *pHuffSpec_ref = (armICJP_DecHuffmanSpec *) pHuffTable; ARM_VLC32 *pHuffStruct = pHuffSpec_ref->pHuffStruct; OMX_INT i; OMX_U8 value, codesPerBitLength; OMX_U16 code; OMX_INT maxValue; armRetArgErrIf(!pHuffBits, OMX_Sts_BadArgErr); armRetArgErrIf(!pHuffValue, OMX_Sts_BadArgErr); armRetArgErrIf(!pHuffTable, OMX_Sts_BadArgErr); for(i = 0; i < ARM_ICJP_HUFFTABLE_SIZE; i++) { pHuffStruct[i].codeLen = 0; pHuffStruct[i].codeWord = 1; } code = 0; maxValue = -1; for(i = 1; i <= 16; i++) { codesPerBitLength = *pHuffBits++; for(; codesPerBitLength > 0; codesPerBitLength--) { value = *pHuffValue++; if(value > maxValue) maxValue = value; /* check this as otherwise it means 2 codes have same value * codeLen was initialized to 0 and it gets changed when * some code gets that value */ armAssert(pHuffStruct[value].codeLen == 0); pHuffStruct[value].codeLen = i; pHuffStruct[value].codeWord = code; code++; } code <<= 1; } /* mark end of search by encountering a {0, 0} (codeLen, codeWord) pair */ pHuffStruct[maxValue + 1].codeWord = 0; return OMX_Sts_NoErr;}/* End of file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -