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

📄 mrstrimagepalette.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 __MRSTRIMAGEPALETTE_H__#define __MRSTRIMAGEPALETTE_H__#include "mrstrimagedepth.h"#include "ippdefs.h"#include "fixedbuffer.h"#include "genalg.h"//// At the moment it's mostly inspired by JPEG 2000 palette//  becuse it's the most sophisticated palette definition.//class MRstrImagePalette{public:    MRstrImagePalette()    : m_nOfChannels          (0)    , m_nOfEntries           (0)    , m_nOfEnumChannelIndexes(0)    {}    MRstrImagePalette(const MRstrImagePalette &palette)    {        ReAlloc(palette.NOfChannels(), palette.NOfEnumChannelIndexes(), palette.NOfEntries());        unsigned int i;        for(i = 0; i < m_nOfChannels; i++)        {            m_component              [i] = palette.m_component              [i];            m_isChannelMappedDirectly[i] = palette.m_isChannelMappedDirectly[i];            m_enumChannelIndex       [i] = palette.m_enumChannelIndex       [i];        }        for(i = 0; i < m_nOfEnumChannelIndexes; i++)        {            m_depth[i] = palette.m_depth[i];            Copy(palette.m_data[i], m_data[i], m_nOfEntries);        }    }    MRstrImagePalette& operator=(const MRstrImagePalette& palette)    {        if(this != &palette)        {            ReAlloc(palette.NOfChannels(), palette.NOfEnumChannelIndexes(), palette.NOfEntries());            unsigned int i;            for(i = 0; i < m_nOfChannels; i++)            {                m_component              [i] = palette.m_component              [i];                m_isChannelMappedDirectly[i] = palette.m_isChannelMappedDirectly[i];                m_enumChannelIndex       [i] = palette.m_enumChannelIndex       [i];            }            for(i = 0; i < m_nOfEnumChannelIndexes; i++)            {                m_depth[i] = palette.m_depth[i];                Copy(palette.m_data[i], m_data[i], m_nOfEntries);            }        }        return *this;    }////    Access to read data by the most transparent way//    bool                   IsActual                  ()                                      const { return m_nOfChannels != 0; }    Ipp16u                 NOfChannels               ()                                      const { return m_nOfChannels;  }    bool                   IsChannelMappedDirectly   (Ipp16u channel)                        const { return m_isChannelMappedDirectly[channel]; }    const MRstrImageDepth &ChannelDepth              (Ipp16u channel)                        const { return m_depth[EnumChannelIndex(channel)];  }    Ipp16u                 ComponentIndex            (Ipp16u channel)                        const { return m_component[channel]; }    Ipp16u                 NOfEntries                ()                                      const { return m_nOfEntries; }    Ipp64s                 ChannelValue              (Ipp16u channel, Ipp32s componentValue) const    {        const Ipp64s *palette = m_data[EnumChannelIndex(channel)];        // there is some logic in decision to do something like saturation        if(componentValue > (Ipp32s)m_nOfEntries) return palette[m_nOfEntries - 1];        if(componentValue <                    0) return palette[               0];        return palette[componentValue];    }////  Initialize, reinitialize, free//    void ReAlloc(Ipp16u nOfChannels, Ipp8u nOfEnumChannelIndexes, Ipp16u nOfEntries)    {        m_component              .ReAlloc(nOfChannels);        m_isChannelMappedDirectly.ReAlloc(nOfChannels);        m_enumChannelIndex       .ReAlloc(nOfChannels);        m_data                   .ReAlloc(nOfEnumChannelIndexes, nOfEntries);        m_depth                  .ReAlloc(nOfEnumChannelIndexes);        m_nOfChannels           = nOfChannels;        m_nOfEntries            = nOfEntries;        m_nOfEnumChannelIndexes = nOfEnumChannelIndexes;    }    void Free()    {        m_component              .Free();        m_isChannelMappedDirectly.Free();        m_enumChannelIndex       .Free();        m_data                   .Free();        m_depth                  .Free();        m_nOfChannels           = 0;        m_nOfEntries            = 0;        m_nOfEnumChannelIndexes = 0;    }////    Access to read/write data in native internal representation//    Ipp8u                  EnumChannelIndex          (Ipp16u channel) const { return m_enumChannelIndex[channel]; }    const Ipp64s          *EnumChannelLUT            (Ipp8u  index)   const { return m_data            [index];   }    const MRstrImageDepth &EnumChannelDepth          (Ipp8u  index)   const { return m_depth           [index];   }    Ipp8u                  NOfEnumChannelIndexes     ()               const { return m_nOfEnumChannelIndexes; }    void                   SetIsChannelMappedDirectly(Ipp16u channel, bool  isChannelMappedDirectly) { m_isChannelMappedDirectly[channel] = isChannelMappedDirectly; }    void                   SetComponentIndex         (Ipp16u channel, Ipp16u component)              { m_component              [channel] = component; }    void                   SetEnumChannelIndex       (Ipp16u channel, Ipp8u index)                   { m_enumChannelIndex       [channel] = index; }    void                   SetEnumChannelDepth       (Ipp8u  index, const MRstrImageDepth &depth)    { m_depth                  [index]   = depth; }    Ipp64s                *EnumChannelLUT            (Ipp8u  index)                                  { return m_data            [index];   }protected:    FixedBuffer<Ipp16u>          m_component;    FixedBuffer<bool>            m_isChannelMappedDirectly;    FixedBuffer<Ipp8u>           m_enumChannelIndex;    Ipp16u                       m_nOfChannels;    Ipp16u                       m_nOfEntries;    FixedBuffer2D<Ipp64s>        m_data;    FixedBuffer<MRstrImageDepth> m_depth;    Ipp8u                        m_nOfEnumChannelIndexes;};#endif // __MRSTRIMAGEPALETTE_H__

⌨️ 快捷键说明

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