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

📄 mtf.c

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 C
字号:
/*//////////////////////////////// "mtf.c" /////////////////////////////////                  INTEL CORPORATION PROPRIETARY INFORMATION//     This software is supplied under the terms of a license agreement or//     nondisclosure agreement with Intel Corporation and may not be copied//     or disclosed except in accordance with the terms of that agreement.//          Copyright(c) 2005 Intel Corporation. All Rights Reserved.////     higher level functions of IPP DC ( data compression ) domain for//     Move-To-Front Transformation usage*/#include "mtf.h"/************************************************************************************************* * Function: * int ForwardMTF( Ipp8u * pSrc, int SrcLen, Ipp8u *pDst, int *pDstLen, IppMTFState_8u * pMTFState ) * * Function for relization of forward MTF * Gets the pSrc as a source vector of length SrcLen, does forward MTF and * writes result to pDst ( and length of pDst in pDstLen ) * * Main Parameters: *          pSrc         - pointer to Source buffer, *          pDst         - pointer to Destination buffer, *          SrcLen       - Length of source buffer, *          pDstLen      - Length of destination buffer *          pMTFState    - pointer to MTF encoding/decoding state structure * * Returns: *    ippStsNullPtrErr  If One or several pointer(s) is 0 *    ippStsSizeErr     Length of the source vector is less or equal zero *    ippStsNoErr       No errors * ************************************************************************************************/int ForwardMTF( Ipp8u *pSrc, int SrcLen, Ipp8u *pDst, int *pDstLen, IppMTFState_8u * pMTFState ) {    /* variables */    IppStatus  st = ippStsNoErr;    /* checks the pointer is not null */    if( pSrc == 0 || pDst == 0 )        return ippStsNullPtrErr;   /* allocates the memory needed for MTF transformation structure */    if( ippStsNoErr != ( st = ippsMTFInit_8u( pMTFState ) ) ) {        fprintf( stderr, "Error while trying to init the mtf state. Exiting.\n" );        return st;    }    /* does the forward MTF transformation */    if( ippStsNoErr != ( st = ippsMTFFwd_8u( pSrc, pDst, SrcLen, pMTFState) ) ) {        fprintf(stderr, "Error <%d> while trying do forward MTF. Exiting.\n", st);        return st;    }    *pDstLen = SrcLen;    return ippStsNoErr; /* No errors */}/************************************************************************************************* * Function: * IppStatus InverseMTF( Ipp8u * pSrc, int SrcLen, Ipp8u *pDst, int *pDstLen, IppMTFState_8u * pMTFState) * * Function for relization of backward MTF * Gets the pSrc as a source vector of length SrcLen, does backward MTF and * writes result to pDst ( and length of pDst in pDstLen ) * * Main Parameters: *          pSrc         - pointer to Source buffer, *          pDst         - pointer to Destination buffer, *          SrcLen       - Length of source buffer, *          pDstLen      - Length of destination buffer *          pMTFState    - pointer to MTF encoding/decoding state structure * * Returns: *    ippStsNullPtrErr  If One or several pointer(s) is 0 *    ippStsSizeErr     Length of the source vector is less or equal zero *    ippStsNoErr       No errors * ************************************************************************************************/int InverseMTF( Ipp8u *pSrc, int SrcLen, Ipp8u *pDst, int *pDstLen, IppMTFState_8u * pMTFState ) {    /* variables */    IppStatus  st = ippStsNoErr;    /* checks the pointer is not null */    if( pSrc == 0 || pDst == 0 )        return ippStsNullPtrErr;    /* allocates the memory needed for MTF transformation structure */    if( ippStsNoErr != ( st = ippsMTFInit_8u( pMTFState ) ) ) {        fprintf( stderr, "Error while trying to init the mtf state. Exiting.\n" );        return st;    }    /* does the backward MTF transformation */    if( ippStsNoErr != ( st = ippsMTFInv_8u( pSrc, pDst, SrcLen, pMTFState) ) ) {        fprintf(stderr, "Error <%d> while trying do backward MTF. Exiting.\n", st);        return st;    }    *pDstLen = SrcLen;    return ippStsNoErr; /* No errors */}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -