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

📄 pnminfo.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
字号:
/* ////////////////////////////////////////////////////////////////////////////                  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) 2004-2005 Intel Corporation. All Rights Reserved.//////*/#ifndef __PNMINFO_H__#define __PNMINFO_H__#include "pnm.h"#include "geometry2d.h"#include "stralg.h"#include "auxmath.h"class PNMInfo{public:    PNMInfo() {}    void SetMagicNumber(PNMMagicNumber  magicNumber) { m_magicNumber  = magicNumber; }    void SetMaxValue   (unsigned int    maxValue)    { m_maxValue     = maxValue;    }    void SetSize       (const RectSize &size)        { m_size         = size;        }    PNMMagicNumber  MagicNumber           () const { return m_magicNumber;  }    unsigned int    MaxValue              () const { return m_maxValue;       }    const RectSize &Size                  () const { return m_size;         }    template<class T>        unsigned int EstimateImageDataNOfBytes(const ImageCoreC<T,1> *channel) const    {        return ( (NumericFormat(MagicNumber()) == PNM_TXT) ?            EstimateImageDataTxtFmtNOfBytes(channel)          : EstimateImageDataBinFmtNOfBytes()          );    }protected:    static unsigned int BinFmtLineNOfBytes(unsigned int bitDepth, PNMColorFormat clrFmt, unsigned int width)    {        unsigned int lineStep;        switch(clrFmt)        {        case PNM_BLACKNWHITE: lineStep = (width + 7) >> 3; break;        case PNM_GRAYSCALE:   lineStep = width;            break;        case PNM_COLOR:       lineStep = width * 3;        break;        default :             lineStep = 0;        }        return (bitDepth < 8) ? lineStep : (bitDepth < 16) ? lineStep * 2 : lineStep * 4;    }    unsigned int EstimateImageDataBinFmtNOfBytes() const    {        return m_size.Height() * BinFmtLineNOfBytes(BitDepth(MaxValue()), ColorFormat(MagicNumber()), m_size.Width());    }    template<class T>        unsigned int EstimateImageDataTxtFmtNOfBytes(const ImageCoreC<T,1> *channel) const    {        const RectSize &size   = m_size;        PNMColorFormat  clrFmt = ColorFormat(MagicNumber());        unsigned int    width  = size.Width();        unsigned int    height = size.Height();        if(clrFmt == PNM_BLACKNWHITE) return 2 * width * height;        unsigned int length      = 0;        unsigned int nOfChannels = NOfChannels(clrFmt);        char buffer[INT_TO_STR_MAX_SIZE];        const T *src;        int lineStep;        for(unsigned int component = 0; component < nOfChannels; component++)        {            src = channel[component].Data();            lineStep = (int)channel[component].LineStep();            for(unsigned int y = 0; y < height; y++)            {                for(unsigned int x = 0; x < width; x++)                {                    IntToStrR10((unsigned int)src[x], buffer);                    length += StrSize(buffer);                }                addrInc(src, lineStep);            }        }        length += nOfChannels * width * height;        return length;    }    PNMMagicNumber m_magicNumber;    unsigned int   m_maxValue;    RectSize       m_size;};#endif // __PNMINFO_H__

⌨️ 快捷键说明

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