📄 wt97invcolgen.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 __WT97INVCOLGEN_H__#define __WT97INVCOLGEN_H__#include "ringstripe.h"#include "rowtracker.h"#include "pp.h"template<class T>class WT97InvColPipeline{public: WT97InvColPipeline() : m_width(0) {} void ReAlloc(unsigned int maxWidth) { m_stripe.ReAlloc(maxWidth, 5); m_rowL.ReAlloc(1); m_rowH.ReAlloc(2); } void InitAttach( const Rect &rect, const ImageCoreC<T, 1> &srcL, const ImageCoreC<T, 1> &srcH) { m_rowL.InitAttach(srcL); m_rowH.InitAttach(srcH); m_width = rect.Width(); m_height = rect.Height(); m_heightOrgParity = rect.Y() & 1; m_row = 0; m_i = 0; m_iend = ( (m_height - m_heightOrgParity) >> 1 ) - 2; m_isFullStep = true; m_isLastStepFull = m_heightOrgParity ? ( !(m_height & 1) ) : (m_height & 1); } const T* CurrOutputRow() const { return m_stripe.CurrRow(); } bool NextStep() { switch(m_height) { case 1: return StepForHeight1(); case 2: return StepForHeight2(); case 3: return StepForHeight3(); case 4: return StepForHeight4(); default: return StepForHeight5nMore(); } }protected: bool StepForHeight1() { m_row++; if(m_heightOrgParity) { ProcessOdd_1(); } else { Copy <T*>(DlyRowL(1), DlyRowDst(0), m_width); } return false; } bool StepForHeight2() { m_row++; if(m_row > 1) { NextDst(); return false; } if(m_heightOrgParity) ProcessOdd_2(); else ProcessEven_2(); NextDst(); return true; } bool StepForHeight3() { m_row++; if(m_row > 2) { NextDst(); return false; } if(m_row > 1) { NextDst(); return true; } if(m_heightOrgParity) ProcessOdd_3(); else ProcessEven_3(); NextDst(); return true; } bool StepForHeight4() { if(!m_heightOrgParity) return StepForHeight5nMore(); m_row++; if(m_row > 3) { NextDst(); return false; } if(m_row > 1) { NextDst(); return true; } LiftDELTA(1, 2, 1, 3); LiftDELTAx2(0, 1, 1); LiftGAMMA(1, 3, 1, 2); LiftGAMMAx2(2, 3, 4); LiftBETAx2(2, 1); LiftBETA(4, 2, 3); LiftALPHA(3, 1, 2); LiftALPHAx2(3, 4); NextDst(); return true; } bool StepForHeight5nMore() { m_row++; if(m_row >= m_height) { NextDst(); return false; } if(m_row >= (m_height-2- (m_isLastStepFull&1))) { NextDst(); return true; } if(m_row == 1) { if(m_heightOrgParity) { FirtStepBig(); NextDst(); NextL(); NextL(); NextH(); NextH(); return true; } else { FirtStepSmall(); NextL(); NextL(); NextH(); } } if(m_i < m_iend) { if(m_isFullStep) { WT97InvColLift( DlyRowL(1), DlyRowH(2), DlyRowH(1), DlyRowDst(4), DlyRowDst(3), DlyRowDst(2), DlyRowDst(1), DlyRowDst(0), m_width); NextL(); NextH(); m_isFullStep = false; } else { m_isFullStep = true; m_i++; } NextDst(); return true; } if(m_isLastStepFull) { LastStepBig(); } else { LastStepSmall(); } NextDst(); return true; } void ProcessOdd_1(); void ProcessOdd_2(); void ProcessEven_2(); void ProcessOdd_3(); void ProcessEven_3(); void LiftDELTA(unsigned int dlyL, unsigned int dlyH1, unsigned int dlyH2, unsigned int dlyDst); void LiftDELTAx2(unsigned int dlyL, unsigned int dlyH1, unsigned int dlyDst); void LiftGAMMA(unsigned int dlyH, unsigned int dlySrc1, unsigned int dlySrc2, unsigned int dlyDst); void LiftGAMMAx2(unsigned int dlyH, unsigned int dlySrc1, unsigned int dlyDst); void LiftBETA(unsigned int dlySrc1, unsigned int dlySrc2, unsigned int dlyDst); void LiftBETAx2(unsigned int dlySrc1, unsigned int dlyDst); void LiftALPHA(unsigned int dlySrc1, unsigned int dlySrc2, unsigned int dlyDst); void LiftALPHAx2(unsigned int dlySrc1, unsigned int dlyDst); void FirtStepSmall() { LiftDELTAx2(1, 2, 4); LiftDELTA(0, 2, 1, 2); LiftGAMMA(2, 4, 2, 3); LiftBETAx2(3, 4); } void FirtStepBig() { LiftDELTA(1, 2, 1, 3); LiftGAMMAx2(2, 3, 4); LiftDELTA(0, 1, 0, 1); LiftGAMMA(1, 3, 1, 2); LiftBETA(4, 2, 3); LiftALPHAx2(3, 4); } void LastStepSmall() { LiftGAMMAx2(2, 2, 1); LiftBETA(3, 1, 2); LiftALPHAx2(2, 1); LiftALPHA(2, 4, 3); } void LastStepBig() { LiftDELTAx2(1, 2, 0); LiftGAMMA(2, 2, 0, 1); LiftBETAx2(1, 0); LiftBETA(3, 1, 2); LiftALPHA(4, 2, 3); LiftALPHA(2, 0, 1); } void NextH () { ++m_rowH; } void NextL () { ++m_rowL; } void NextDst() { ++m_stripe; } T* DlyRowL(unsigned int delay) { return m_rowL.Delayed(delay); } T* DlyRowH(unsigned int delay) { return m_rowH.Delayed(delay); } T* DlyRowDst(unsigned int delay) { switch(delay) { case 0: return m_stripe[0]; case 1: return m_stripe[4]; case 2: return m_stripe[3]; case 3: return m_stripe[2]; } return m_stripe[1]; } RingStripe<T> m_stripe; RowTracker<T> m_rowL; RowTracker<T> m_rowH; unsigned int m_width; unsigned int m_height; unsigned int m_heightOrgParity; unsigned int m_row; T *m_highPrev; unsigned int m_i; unsigned int m_iend; bool m_isLastStepFull; bool m_isFullStep;};#endif // __WT97INVCOLGEN_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -