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

📄 wtinv.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) 2002-2005 Intel Corporation. All Rights Reserved.//////*/#ifndef __WTINV_H__#define __WTINV_H__//// Here is WT templates implementing general functionality of full 2D multi-level transforms.// (Both WT53 and WT97)//#include "pp.h"#include "wt53inv.h"#include "wt97invrow16s.h"#include "wt97invrow32s.h"#ifndef XSCALE#include "wt97invrow32f.h"#endif //#ifndef XSCALE#include "wt97invcol16s.h"#include "wt97invcol32s.h"#ifndef XSCALE#include "wt97invcol32f.h"#endif //#ifndef XSCALE#include "wt97invrowgen.h"#include "wt97invcolgen.h"#include "sbtree.h"////////////////////////////////////////////////////////////////////////////// Auxiliary regularization to switch WT53/WT97 in argument of WTInv<AGREGATE> template//template<class T> class WT53InvAgregate{public:    typedef T DataType;    typedef WT53InvColPipeline<T> WTColPipeline;    static void InvRow(const T *low, const T *high, T *dst, const UIntRange &range)    {        WT53InvRow(low, high, dst, range);    }};template<class T> class WT97InvAgregate{public:    typedef T DataType;    typedef WT97InvColPipeline<T> WTColPipeline;    static void InvRow(const T *low, const T *high, T *dst, const UIntRange &range)    {        WT97InvRow<T>(low, high, dst, range);    }};////////////////////////////////////////////////////////////////////////////// Here is template implementation for multi-level 2D WT//template <class AGREGATE>class WTInv{protected:    typedef typename AGREGATE::DataType T;public:    WTInv() {}    void ReAlloc(const RectSize &maxSize)    {        unsigned int cmpSize =  (maxSize.Width() >> 1) + 2;        m_colLx.ReAlloc(cmpSize);        m_colHx.ReAlloc(cmpSize);    }    // one-level transform    void Transform(        const ImageCoreC<T, 1> &srcLxLy,        const ImageCoreC<T, 1> &srcHxLy,        const ImageCoreC<T, 1> &srcLxHy,        const ImageCoreC<T, 1> &srcHxHy,        const ImageCoreC<T, 1> &dst, const Rect &rect)    {        RowIterator<T> dstRow = dst;        m_colLx.InitAttach(ScaleLx(rect), srcLxLy, srcLxHy);        m_colHx.InitAttach(ScaleHx(rect), srcHxLy, srcHxHy);        for(unsigned int i = 0; i < rect.Height(); i++)        {            m_colLx.NextStep();            m_colHx.NextStep();            AGREGATE::InvRow(m_colLx.CurrOutputRow(), m_colHx.CurrOutputRow(), dstRow, rect.RangeX());            ++dstRow;        }    }    // multi-level transform    static void Transform(const SBTree<T> &src, const ImageCoreC<T, 1> &dst, const Rect &rect)    {        if(src.NOfWTLevels()==0)        {            Copy(src.LxLy(), dst, rect.Size());            return;        }        WTInv<AGREGATE> inv;        inv.ReAlloc(rect.Size());        int level = src.NOfWTLevels() - 1;        if(src.NOfWTLevels()==1)        {            inv.Transform(                src.LxLy(),                src.HxLy(level),                src.LxHy(level),                src.HxHy(level),                dst, ScaleLxLy(rect, level));            return;        }        ImageC<T, 1> tmp(ScaleLxLy(rect).Width(), ScaleLxLy(rect).Height());        if(src.NOfWTLevels() & 1)        {            inv.Transform(                src.LxLy(),                src.HxLy(level),                src.LxHy(level),                src.HxHy(level),                dst, ScaleLxLy(rect, level));            level--;            for(; level >= 0; )            {                inv.Transform(                    dst,                    src.HxLy(level),                    src.LxHy(level),                    src.HxHy(level),                    tmp.Core(), ScaleLxLy(rect, level));                level--;                inv.Transform(                    tmp.Core(),                    src.HxLy(level),                    src.LxHy(level),                    src.HxHy(level),                    dst, ScaleLxLy(rect, level));                level--;            }        }        else        {            inv.Transform(                src.LxLy(),                src.HxLy(level),                src.LxHy(level),                src.HxHy(level),                tmp.Core(), ScaleLxLy(rect, level));            level--;            for(; level >= 1; )            {                inv.Transform(                    tmp.Core(),                    src.HxLy(level),                    src.LxHy(level),                    src.HxHy(level),                    dst, ScaleLxLy(rect, level));                level--;                inv.Transform(                    dst,                    src.HxLy(level),                    src.LxHy(level),                    src.HxHy(level),                    tmp.Core(), ScaleLxLy(rect, level));                level--;            }            inv.Transform(                tmp.Core(),                src.HxLy(level),                src.LxHy(level),                src.HxHy(level),                dst, ScaleLxLy(rect, level));        }    }protected:    typename AGREGATE::WTColPipeline m_colLx;    typename AGREGATE::WTColPipeline m_colHx;};////////////////////////////////////////////////////////////////////////////// Auxiliary names to call multi-level 2D WT//template<class T>void WT53Inv(const SBTree<T> &src, const ImageCoreC<T, 1> &dst, const Rect &rect){    WTInv<WT53InvAgregate<T> >::Transform(src, dst, rect);}template<class T>void WT97Inv(const SBTree<T> &src, const ImageCoreC<T, 1> &dst, const Rect &rect){    WTInv<WT97InvAgregate<T> >::Transform(src, dst, rect);}#endif // __WTINV_H__

⌨️ 快捷键说明

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