source: 3DVCSoftware/trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h @ 56

Last change on this file since 56 was 56, checked in by hschwarz, 12 years ago

updated trunk (move to HM6.1)

File size: 5.3 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     TEncAdaptiveLoopFilter.h
35 \brief    estimation part of sample adaptive offset class (header)
36 */
37
38#ifndef __TENCSAMPLEADAPTIVEOFFSET__
39#define __TENCSAMPLEADAPTIVEOFFSET__
40
41#include "TLibCommon/TComSampleAdaptiveOffset.h"
42#include "TLibCommon/TComPic.h"
43
44#include "TEncEntropy.h"
45#include "TEncSbac.h"
46#include "TLibCommon/TComBitCounter.h"
47
48//! \ingroup TLibEncoder
49//! \{
50
51// ====================================================================================================================
52// Class definition
53// ====================================================================================================================
54
55class TEncSampleAdaptiveOffset : public TComSampleAdaptiveOffset
56{
57private:
58  Double            m_dLambdaLuma;
59  Double            m_dLambdaChroma;
60
61  TEncEntropy*      m_pcEntropyCoder;
62  TEncSbac***       m_pppcRDSbacCoder;              ///< for CABAC
63  TEncSbac*         m_pcRDGoOnSbacCoder;
64#if FAST_BIT_EST
65  TEncBinCABACCounter*** m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
66#else
67  TEncBinCABAC***   m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
68#endif
69 
70  Int64  ***m_iCount;      //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE][MAX_NUM_SAO_CLASS];
71  Int64  ***m_iOffset;     //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE][MAX_NUM_SAO_CLASS];
72  Int64  ***m_iOffsetOrg;  //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE];
73  Int64  **m_iRate;        //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE];
74  Int64  **m_iDist;        //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE];
75  Double **m_dCost;        //[MAX_NUM_SAO_PART][MAX_NUM_SAO_TYPE];
76  Double *m_dCostPartBest; //[MAX_NUM_SAO_PART];
77  Int64  *m_iDistOrg;      //[MAX_NUM_SAO_PART];
78  Int    *m_iTypePartBest; //[MAX_NUM_SAO_PART];
79  Int     m_iOffsetTh;
80  Bool    m_bUseSBACRD;
81
82public:
83  TEncSampleAdaptiveOffset         ();
84  virtual ~TEncSampleAdaptiveOffset();
85
86  Void startSaoEnc( TComPic* pcPic, TEncEntropy* pcEntropyCoder, TEncSbac*** pppcRDSbacCoder, TEncSbac* pcRDGoOnSbacCoder);
87  Void endSaoEnc();
88  Void resetStats();
89#if SAO_CHROMA_LAMBDA
90  Void SAOProcess(SAOParam *pcSaoParam, Double dLambda, Double dLambdaChroma);
91#else
92  Void SAOProcess(SAOParam *pcSaoParam, Double dLambda);
93#endif
94  Void runQuadTreeDecision(SAOQTPart *psQTPart, Int iPartIdx, Double &dCostFinal, Int iMaxLevel, Double dLambda);
95  Void rdoSaoOnePart(SAOQTPart *psQTPart, Int iPartIdx, Double dLambda);
96  Void disablePartTree(SAOQTPart *psQTPart, Int iPartIdx);
97  Void getSaoStats(SAOQTPart *psQTPart, Int iYCbCr);
98  Void calcSaoStatsCu(Int iAddr, Int iPartIdx, Int iYCbCr);
99  Void calcSaoStatsBlock( Pel* pRecStart, Pel* pOrgStart, Int stride, Int64** ppStats, Int64** ppCount, UInt width, UInt height, Bool* pbBorderAvail);
100  Void calcSaoStatsCuOrg(Int iAddr, Int iPartIdx, Int iYCbCr);
101  Void destroyEncBuffer();
102  Void createEncBuffer();
103#if SAO_UNIT_INTERLEAVING
104  Void assignSaoUnitSyntax(SaoLcuParam* saoLcuParam,  SAOQTPart* saoPart, Bool &oneUnitFlag, Int yCbCr);
105  Void checkMerge(SaoLcuParam * lcuParamCurr,SaoLcuParam * lcuParamCheck, Int dir);
106  Void rdoSaoUnitAll(SAOParam *saoParam, Double lambda, Double lambdaChroma);
107  Void rdoSaoUnit(SAOParam *saoParam, Int addr, Int addrUp, Int addrLeft, Int yCbCr, Double lambda);
108  Void setMaxNumOffsetsPerPic(Int iVal) {m_maxNumOffsetsPerPic = iVal; }
109  Int  getMaxNumOffsetsPerPic() {return m_maxNumOffsetsPerPic; }
110#endif
111};
112
113//! \}
114
115#endif
Note: See TracBrowser for help on using the repository browser.