📄 wtfwd.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 __WTFWD_H__#define __WTFWD_H__//// Here is WT templates implementing general functionality of full 2D multi-level transforms.// (Both WT53 and WT97)//#include "pp.h"#include "wt53fwd.h"#include "wt97fwdrow16s.h"#include "wt97fwdrow32s.h"#ifndef XSCALE#include "wt97fwdrow32f.h"#endif //#ifndef XSCALE#include "wt97fwdrowgen.h"#include "wt97fwdcol16s.h"#include "wt97fwdcol32s.h"#ifndef XSCALE#include "wt97fwdcol32f.h"#endif //#ifndef XSCALE#include "wt97fwdcolgen.h"#include "sbtree.h"////////////////////////////////////////////////////////////////////////////// Auxiliary regularization to switch WT53/WT97 in argument of WTFwd<AGREGATE> template//template<class T> class WT53FwdAgregate{public: typedef T DataType; typedef WT53FwdColPipeline<T> WTColPipeline; static void FwdRow(const T *src, const UIntRange &range, T *low, T *high) { WT53FwdRow(src, range, low, high); }};template<class T> class WT97FwdAgregate{public: typedef T DataType; typedef WT97FwdColPipeline<T> WTColPipeline; static void FwdRow(const T *src, const UIntRange &range, T *low, T *high) { WT97FwdRow<T>(src, range, low, high); }};////////////////////////////////////////////////////////////////////////////// Here is template implementation for multi-level 2D WT//template <class AGREGATE>class WTFwd{protected: typedef typename AGREGATE::DataType T;public: WTFwd() {} void ReAlloc(const RectSize &maxSize) { unsigned int cmpSize = (maxSize.Width() >> 1) + 2; m_colLx.ReAlloc(cmpSize); m_colHx.ReAlloc(cmpSize); } void Transform( const ImageCoreC<T, 1> &src, const Rect &rect, const ImageCoreC<T, 1> &dstLxLy, const ImageCoreC<T, 1> &dstHxLy, const ImageCoreC<T, 1> &dstLxHy, const ImageCoreC<T, 1> &dstHxHy) { RowIterator<T> srcRow = src; m_colLx.InitAttach(ScaleLx(rect), dstLxLy, dstLxHy); m_colHx.InitAttach(ScaleHx(rect), dstHxLy, dstHxHy); for(unsigned int i = 0; i < rect.Height(); i++) { AGREGATE::FwdRow(srcRow, rect.RangeX(), m_colLx.CurrInputRow(), m_colHx.CurrInputRow()); m_colLx.NextStep(); m_colHx.NextStep(); ++srcRow; } } // multi-level transform static void Transform(const ImageCoreC<T, 1> &src, const Rect &rect, const SBTree<T> &dst) { if(dst.NOfWTLevels()==0) { Copy(src, dst.LxLy(), rect.Size()); return; } WTFwd<AGREGATE> fwd; fwd.ReAlloc(rect.Size()); ImageC<T, 1> LxLy(ScaleLxLy(rect).Size()); const ImageCoreC<T, 1> *parent = &src; int level = 0; for(; level < (int)dst.NOfWTLevels() - 1; level++) { fwd.Transform(*parent, ScaleLxLy(rect, level), LxLy, dst.HxLy(level), dst.LxHy(level), dst.HxHy(level)); parent = &LxLy.Core(); } fwd.Transform(*parent, ScaleLxLy(rect, level), dst.LxLy(), dst.HxLy(level), dst.LxHy(level), dst.HxHy(level)); }protected: typename AGREGATE::WTColPipeline m_colLx; typename AGREGATE::WTColPipeline m_colHx;};////////////////////////////////////////////////////////////////////////////// Auxiliary names to call multi-level 2D WT//template<class T>void WT53Fwd(const ImageCoreC<T, 1> &src, const Rect &rect, const SBTree<T> &dst){ WTFwd<WT53FwdAgregate<T> >::Transform(src, rect, dst);}template<class T>void WT97Fwd(const ImageCoreC<T, 1> &src, const Rect &rect, const SBTree<T> &dst){ WTFwd<WT97FwdAgregate<T> >::Transform(src, rect, dst);}/*template<class WTFWD, class T>void Fwd(const ImageCoreC<T, 1> &src, const Rect &rect, const SBTree<T> &dst){ if(dst.NOfWTLevels()==0) { Copy(src, dst.LxLy(), rect.Size()); return; } WTFWD fwd; fwd.ReAlloc(rect.Size()); ImageC<T, 1> LxLy(ScaleLxLy(rect).Size()); const ImageCoreC<T, 1> *parent = &src; int level = 0; for(; level < (int)dst.NOfWTLevels() - 1; level++) { fwd.Transform(*parent, ScaleLxLy(rect, level), LxLy, dst.HxLy(level), dst.LxHy(level), dst.HxHy(level)); parent = &LxLy.Core(); } fwd.Transform(*parent, ScaleLxLy(rect, level), dst.LxLy(), dst.HxLy(level), dst.LxHy(level), dst.HxHy(level));}*/#endif // __WTFWD_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -