⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 omxicjp_encodehuffmanspecinit_u8.c

📁 The OpenMAX DL (Development Layer) APIs contain a comprehensive set of audio, video, signal processi
💻 C
字号:
/** * *  * File Name:  omxICJP_EncodeHuffmanSpecInit_U8.c * OpenMAX DL: v1.0.2 * Revision:   10586 * Date:       Wednesday, March 5, 2008 *  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved. *  *  * * Description: Huffman table initialization function. * */#include "omxtypes.h"#include "armOMX.h"#include "omxIC.h"#include "armCOMM.h"#include "armIC.h"/** * Function:  omxICJP_EncodeHuffmanSpecInit_U8   (5.1.3.4.2) * * Description: * Initializes the DC or AC Huffman encoder table specification structure.   * The helper function omxICJP_EncodeHuffmanSpecGetBufSize_U8 may be used to  * obtain the minimum necessary size, in bytes, of the buffer that will be  * required to contain the initialized structure *pHuffTable.  * * 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.  *   pHuffTable - pointer to a buffer with sufficient free space to contain  *            the initialized OMXICJPHuffmanEncodeSpec output.  The buffer  *            size, in bytes, should be equal to the value of the parameter  *            *pSize returned by the function  *            omxICJP_EncodeHuffmanSpecGetBufSize_U8. Must be aligned on a  *            4-byte boundary.  * * Output Arguments: *    *   pHuffTable - pointer to an initialized OMXICJPHuffmanEncodeSpec 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_EncodeHuffmanSpecInit_U8(        const OMX_U8 *pHuffBits,        const OMX_U8 *pHuffValue,        OMXICJPHuffmanEncodeSpec *pHuffTable       ){    armICJP_EncHuffmanSpec *pHuffSpec_ref = (armICJP_EncHuffmanSpec *) 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);        /*    ---------------------------------------------------------------------    This function calls three subroutines to generate Huffman size table,    Huffman Code table and then to arrange them, so that Huffman code and    size are indexed by the input symbol.        All these functionalities are described in the JPEG Standard [ISO10918]     Annex C.2: Conversion of Huffman Tables Specified in Interchange Format    to Tables of Codes and Code Lengths.    ---------------------------------------------------------------------    */        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 + -