source: 3DVCSoftware/trunk/source/Lib/TLibCommon/TComLoopFilter.h @ 737

Last change on this file since 737 was 608, checked in by tech, 11 years ago

Merged DEV-2.0-dev0@604.

  • Property svn:eol-style set to native
File size: 5.0 KB
RevLine 
[5]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
[56]4 * granted under this license. 
[5]5 *
[608]6 * Copyright (c) 2010-2013, ITU/ISO/IEC
[5]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.
[56]17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
[5]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 */
[2]33
34/** \file     TComLoopFilter.h
35    \brief    deblocking filter (header)
36*/
37
38#ifndef __TCOMLOOPFILTER__
39#define __TCOMLOOPFILTER__
40
41#include "CommonDef.h"
42#include "TComPic.h"
43
[56]44//! \ingroup TLibCommon
45//! \{
46
[2]47#define DEBLOCK_SMALLEST_BLOCK  8
48
49// ====================================================================================================================
50// Class definition
51// ====================================================================================================================
52
53/// deblocking filter class
54class TComLoopFilter
55{
56private:
57  UInt      m_uiNumPartitions;
[56]58  UChar*    m_aapucBS[2];              ///< Bs for [Ver/Hor][Y/U/V][Blk_Idx]
[608]59  Bool*     m_aapbEdgeFilter[2];
[2]60  LFCUParam m_stLFCUParam;                  ///< status structure
61 
[56]62  Bool      m_bLFCrossTileBoundary;
63
[2]64protected:
65  /// CU-level deblocking function
66  Void xDeblockCU                 ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int Edge );
67
68  // set / get functions
69  Void xSetLoopfilterParam        ( TComDataCU* pcCU, UInt uiAbsZorderIdx );
70  // filtering functions
[56]71  Void xSetEdgefilterTU           ( TComDataCU* pcCU, UInt absTUPartIdx, UInt uiAbsZorderIdx, UInt uiDepth );
[2]72  Void xSetEdgefilterPU           ( TComDataCU* pcCU, UInt uiAbsZorderIdx );
[608]73  Void xGetBoundaryStrengthSingle ( TComDataCU* pcCU, Int iDir, UInt uiPartIdx );
[2]74  UInt xCalcBsIdx                 ( TComDataCU* pcCU, UInt uiAbsZorderIdx, Int iDir, Int iEdgeIdx, Int iBaseUnitIdx )
75  {
76    TComPic* const pcPic = pcCU->getPic();
77    const UInt uiLCUWidthInBaseUnits = pcPic->getNumPartInWidth();
78    if( iDir == 0 )
[608]79    {
[2]80      return g_auiRasterToZscan[g_auiZscanToRaster[uiAbsZorderIdx] + iBaseUnitIdx * uiLCUWidthInBaseUnits + iEdgeIdx ];
[608]81    }
[2]82    else
[608]83    {
[2]84      return g_auiRasterToZscan[g_auiZscanToRaster[uiAbsZorderIdx] + iEdgeIdx * uiLCUWidthInBaseUnits + iBaseUnitIdx ];
[608]85    }
[56]86  } 
[2]87 
[608]88  Void xSetEdgefilterMultiple( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdgeIdx, Bool bValue ,UInt uiWidthInBaseUnits = 0, UInt uiHeightInBaseUnits = 0 );
[56]89 
[2]90  Void xEdgeFilterLuma            ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdge );
91  Void xEdgeFilterChroma          ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdge );
92 
[608]93  __inline Void xPelFilterLuma( Pel* piSrc, Int iOffset, Int tc, Bool sw, Bool bPartPNoFilter, Bool bPartQNoFilter, Int iThrCut, Bool bFilterSecondP, Bool bFilterSecondQ);
[56]94  __inline Void xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc, Bool bPartPNoFilter, Bool bPartQNoFilter);
95 
[2]96
[56]97  __inline Bool xUseStrongFiltering( Int offset, Int d, Int beta, Int tc, Pel* piSrc);
98  __inline Int xCalcDP( Pel* piSrc, Int iOffset);
99  __inline Int xCalcDQ( Pel* piSrc, Int iOffset);
[2]100 
[608]101  static const UChar sm_tcTable[54];
102  static const UChar sm_betaTable[52];
103
[2]104public:
105  TComLoopFilter();
106  virtual ~TComLoopFilter();
107 
108  Void  create                    ( UInt uiMaxCUDepth );
109  Void  destroy                   ();
110 
111  /// set configuration
[608]112  Void setCfg( Bool bLFCrossTileBoundary );
[2]113 
114  /// picture-level deblocking filter
115  Void loopFilterPic( TComPic* pcPic );
[608]116
117  static Int getBeta( Int qp )
118  {
119    Int indexB = Clip3( 0, MAX_QP, qp );
120    return sm_betaTable[ indexB ];
121  }
[2]122};
123
[56]124//! \}
125
[2]126#endif
Note: See TracBrowser for help on using the repository browser.