source: 3DVCSoftware/branches/HTM-6.2-dev1-Qualcomm/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h @ 352

Last change on this file since 352 was 296, checked in by tech, 12 years ago

Reintegrated branch 5.1-dev0 rev. 295.

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-2012, 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 UInt m_uiMaxDepth;
67  static const Int m_aiNumPartsInRow[5];
68  static const Int m_aiNumPartsLevel[5];
69  static const Int m_aiNumCulPartsLevel[5];
70  static const UInt m_auiEoTable[9];
71  static const UInt m_auiEoTable2D[9];
72  static const UInt m_iWeightSao[MAX_NUM_SAO_TYPE];
73  Int *m_iOffsetBo;
74  Int m_iOffsetEo[LUMA_GROUP_NUM];
75
76  Int  m_iPicWidth;
77  Int  m_iPicHeight;
78  UInt m_uiMaxSplitLevel;
79  UInt m_uiMaxCUWidth;
80  UInt m_uiMaxCUHeight;
81  Int  m_iNumCuInWidth;
82  Int  m_iNumCuInHeight;
83  Int  m_iNumTotalParts;
84  static Int m_iNumClass[MAX_NUM_SAO_TYPE];
85  SliceType  m_eSliceType;
86  Int        m_iPicNalReferenceIdc;
87
88  UInt m_uiSaoBitIncrease;
89  UInt m_uiQP;
90
91  Pel   *m_pClipTable;
92  Pel   *m_pClipTableBase;
93  Pel   *m_lumaTableBo;
94  Int   *m_iUpBuff1;
95  Int   *m_iUpBuff2;
96  Int   *m_iUpBufft;
97  Int   *ipSwap;
98  Bool  m_bUseNIF;       //!< true for performing non-cross slice boundary ALF
99  UInt  m_uiNumSlicesInPic;      //!< number of slices in picture
100  Int   m_iSGDepth;              //!< slice granularity depth
101  TComPicYuv* m_pcYuvTmp;    //!< temporary picture buffer pointer when non-across slice/tile boundary SAO is enabled
102
103  Pel* m_pTmpU1;
104  Pel* m_pTmpU2;
105  Pel* m_pTmpL1;
106  Pel* m_pTmpL2;
107  Int* m_iLcuPartIdx;
108  Int     m_maxNumOffsetsPerPic;
109  Bool    m_saoInterleavingFlag;
110public:
111  TComSampleAdaptiveOffset         ();
112  virtual ~TComSampleAdaptiveOffset();
113
114  Void create( UInt uiSourceWidth, UInt uiSourceHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
115  Void destroy ();
116
117  Int  convertLevelRowCol2Idx(int level, int row, int col);
118  void convertIdx2LevelRowCol(int idx, 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  Void freeSaoParam   (SAOParam *pcSaoParam);
124
125  Void SAOProcess(TComPic* pcPic, SAOParam* pcSaoParam);
126  Void processSaoCu(Int iAddr, Int iSaoType, Int iYCbCr);
127  Void processSaoOnePart(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr);
128  Void processSaoQuadTree(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr);
129  Pel* getPicYuvAddr(TComPicYuv* pcPicYuv, Int iYCbCr,Int iAddr = 0);
130
131  Void processSaoCuOrg(Int iAddr, Int iPartIdx, Int iYCbCr);  //!< LCU-basd SAO process without slice granularity
132  Void createPicSaoInfo(TComPic* pcPic, Int numSlicesInPic = 1);
133  Void destroyPicSaoInfo();
134  Void processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int iSaoType, UInt xPos, UInt yPos, UInt width, UInt height, Bool* pbBorderAvail);
135
136  Void resetLcuPart(SaoLcuParam* saoLcuParam);
137  Void convertQT2SaoUnit(SAOParam* saoParam, UInt partIdx, Int yCbCr);
138  Void convertOnePart2SaoUnit(SAOParam *saoParam, UInt partIdx, Int yCbCr);
139  Void processSaoUnitAll(SaoLcuParam* saoLcuParam, Bool oneUnitFlag, Int yCbCr);
140  Void setSaoInterleavingFlag (Bool bVal)  {m_saoInterleavingFlag = bVal;}
141  Bool getSaoInterleavingFlag ()           {return m_saoInterleavingFlag;}
142};
143
144//! \}
145#endif
146
Note: See TracBrowser for help on using the repository browser.