source: SHVCSoftware/branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h @ 757

Last change on this file since 757 was 313, checked in by suehring, 11 years ago

set svn:eol-style=native property on all source files to do proper
automatic line break conversion on check-out and check-in

  • Property svn:eol-style set to native
File size: 6.0 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
6 * Copyright (c) 2010-2013, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34/** \file     TComSampleAdaptiveOffset.h
35    \brief    sample adaptive offset class (header)
36*/
37
38#ifndef __TCOMSAMPLEADAPTIVEOFFSET__
39#define __TCOMSAMPLEADAPTIVEOFFSET__
40
41#include "CommonDef.h"
42#include "TComPic.h"
43
44//! \ingroup TLibCommon
45//! \{
46
47// ====================================================================================================================
48// Constants
49// ====================================================================================================================
50
51#define SAO_MAX_DEPTH                 4
52#define SAO_BO_BITS                   5
53#define LUMA_GROUP_NUM                (1<<SAO_BO_BITS)
54#define MAX_NUM_SAO_OFFSETS           4
55#define MAX_NUM_SAO_CLASS             33
56// ====================================================================================================================
57// Class definition
58// ====================================================================================================================
59
60/// Sample Adaptive Offset class
61class TComSampleAdaptiveOffset
62{
63protected:
64  TComPic*          m_pcPic;
65
66  static const UInt m_uiMaxDepth;
67  static const Int m_aiNumCulPartsLevel[5];
68  static const UInt m_auiEoTable[9];
69  Int *m_iOffsetBo;
70  Int *m_iChromaOffsetBo;
71  Int m_iOffsetEo[LUMA_GROUP_NUM];
72
73  Int  m_iPicWidth;
74  Int  m_iPicHeight;
75  UInt m_uiMaxSplitLevel;
76  UInt m_uiMaxCUWidth;
77  UInt m_uiMaxCUHeight;
78  Int  m_iNumCuInWidth;
79  Int  m_iNumCuInHeight;
80  Int  m_iNumTotalParts;
81  static const Int m_iNumClass[MAX_NUM_SAO_TYPE];
82
83  UInt m_uiSaoBitIncreaseY;
84  UInt m_uiSaoBitIncreaseC;  //for chroma
85  UInt m_uiQP;
86
87  Pel   *m_pClipTable;
88  Pel   *m_pClipTableBase;
89  Pel   *m_lumaTableBo;
90  Pel   *m_pChromaClipTable;
91  Pel   *m_pChromaClipTableBase;
92  Pel   *m_chromaTableBo;
93  Int   *m_iUpBuff1;
94  Int   *m_iUpBuff2;
95  Int   *m_iUpBufft;
96  Int   *ipSwap;
97  Bool  m_bUseNIF;       //!< true for performing non-cross slice boundary ALF
98  TComPicYuv* m_pcYuvTmp;    //!< temporary picture buffer pointer when non-across slice/tile boundary SAO is enabled
99
100  Pel* m_pTmpU1;
101  Pel* m_pTmpU2;
102  Pel* m_pTmpL1;
103  Pel* m_pTmpL2;
104  Int     m_maxNumOffsetsPerPic;
105  Bool    m_saoLcuBoundary;
106  Bool    m_saoLcuBasedOptimization;
107
108  Void xPCMRestoration        (TComPic* pcPic);
109  Void xPCMCURestoration      (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth);
110  Void xPCMSampleRestoration  (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, TextType ttText);
111public:
112  TComSampleAdaptiveOffset         ();
113  virtual ~TComSampleAdaptiveOffset();
114
115  Void create( UInt uiSourceWidth, UInt uiSourceHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight );
116  Void destroy ();
117
118  Int  convertLevelRowCol2Idx(Int level, Int row, Int col);
119
120  Void initSAOParam   (SAOParam *pcSaoParam, Int iPartLevel, Int iPartRow, Int iPartCol, Int iParentPartIdx, Int StartCUX, Int EndCUX, Int StartCUY, Int EndCUY, Int iYCbCr);
121  Void allocSaoParam  (SAOParam* pcSaoParam);
122  Void resetSAOParam  (SAOParam *pcSaoParam);
123  static Void freeSaoParam   (SAOParam *pcSaoParam);
124 
125  Void SAOProcess(SAOParam* pcSaoParam);
126  Void processSaoCu(Int iAddr, Int iSaoType, Int iYCbCr);
127  Pel* getPicYuvAddr(TComPicYuv* pcPicYuv, Int iYCbCr,Int iAddr = 0);
128
129  Void processSaoCuOrg(Int iAddr, Int iPartIdx, Int iYCbCr);  //!< LCU-basd SAO process without slice granularity
130  Void createPicSaoInfo(TComPic* pcPic);
131  Void destroyPicSaoInfo();
132  Void processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int iSaoType, UInt width, UInt height, Bool* pbBorderAvail, Int iYCbCr);
133
134  Void resetLcuPart(SaoLcuParam* saoLcuParam);
135  Void convertQT2SaoUnit(SAOParam* saoParam, UInt partIdx, Int yCbCr);
136  Void convertOnePart2SaoUnit(SAOParam *saoParam, UInt partIdx, Int yCbCr);
137  Void processSaoUnitAll(SaoLcuParam* saoLcuParam, Bool oneUnitFlag, Int yCbCr);
138  Void setSaoLcuBoundary (Bool bVal)  {m_saoLcuBoundary = bVal;}
139  Bool getSaoLcuBoundary ()           {return m_saoLcuBoundary;}
140  Void setSaoLcuBasedOptimization (Bool bVal)  {m_saoLcuBasedOptimization = bVal;}
141  Bool getSaoLcuBasedOptimization ()           {return m_saoLcuBasedOptimization;}
142  Void resetSaoUnit(SaoLcuParam* saoUnit);
143  Void copySaoUnit(SaoLcuParam* saoUnitDst, SaoLcuParam* saoUnitSrc );
144  Void PCMLFDisableProcess    ( TComPic* pcPic);                        ///< interface function for ALF process
145};
146
147//! \}
148#endif
149
Note: See TracBrowser for help on using the repository browser.