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-2011, 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 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 | |
---|
35 | |
---|
36 | /** \file TComLoopFilter.h |
---|
37 | \brief deblocking filter (header) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __TCOMLOOPFILTER__ |
---|
41 | #define __TCOMLOOPFILTER__ |
---|
42 | |
---|
43 | #include "CommonDef.h" |
---|
44 | #include "TComPic.h" |
---|
45 | |
---|
46 | #define DEBLOCK_SMALLEST_BLOCK 8 |
---|
47 | |
---|
48 | // ==================================================================================================================== |
---|
49 | // Class definition |
---|
50 | // ==================================================================================================================== |
---|
51 | |
---|
52 | /// deblocking filter class |
---|
53 | class TComLoopFilter |
---|
54 | { |
---|
55 | private: |
---|
56 | UInt m_uiDisableDeblockingFilterIdc; ///< deblocking filter idc |
---|
57 | UInt m_uiNumPartitions; |
---|
58 | UChar* m_aapucBS[2][3]; ///< Bs for [Ver/Hor][Y/U/V][Blk_Idx] |
---|
59 | Bool* m_aapbEdgeFilter[2][3]; |
---|
60 | LFCUParam m_stLFCUParam; ///< status structure |
---|
61 | |
---|
62 | #if (PARALLEL_DEBLK_DECISION && !PARALLEL_MERGED_DEBLK) |
---|
63 | UInt m_decisions_D [MAX_CU_SIZE/DEBLOCK_SMALLEST_BLOCK][MAX_CU_SIZE/DEBLOCK_SMALLEST_BLOCK]; |
---|
64 | UInt m_decisions_Sample[MAX_CU_SIZE/DEBLOCK_SMALLEST_BLOCK][MAX_CU_SIZE]; |
---|
65 | #endif |
---|
66 | |
---|
67 | protected: |
---|
68 | /// CU-level deblocking function |
---|
69 | #if PARALLEL_MERGED_DEBLK |
---|
70 | Void xDeblockCU ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int Edge ); |
---|
71 | #else |
---|
72 | Void xDeblockCU ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth ); |
---|
73 | #endif |
---|
74 | |
---|
75 | // set / get functions |
---|
76 | Void xSetLoopfilterParam ( TComDataCU* pcCU, UInt uiAbsZorderIdx ); |
---|
77 | // filtering functions |
---|
78 | Void xSetEdgefilterTU ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth ); |
---|
79 | Void xSetEdgefilterPU ( TComDataCU* pcCU, UInt uiAbsZorderIdx ); |
---|
80 | Void xGetBoundaryStrengthSingle ( TComDataCU* pcCU, UInt uiAbsZorderIdx, Int iDir, UInt uiPartIdx ); |
---|
81 | UInt xCalcBsIdx ( TComDataCU* pcCU, UInt uiAbsZorderIdx, Int iDir, Int iEdgeIdx, Int iBaseUnitIdx ) |
---|
82 | { |
---|
83 | TComPic* const pcPic = pcCU->getPic(); |
---|
84 | const UInt uiLCUWidthInBaseUnits = pcPic->getNumPartInWidth(); |
---|
85 | if( iDir == 0 ) |
---|
86 | return g_auiRasterToZscan[g_auiZscanToRaster[uiAbsZorderIdx] + iBaseUnitIdx * uiLCUWidthInBaseUnits + iEdgeIdx ]; |
---|
87 | else |
---|
88 | return g_auiRasterToZscan[g_auiZscanToRaster[uiAbsZorderIdx] + iEdgeIdx * uiLCUWidthInBaseUnits + iBaseUnitIdx ]; |
---|
89 | } |
---|
90 | Void xSetEdgefilterMultiple( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdgeIdx, Bool bValue ); |
---|
91 | |
---|
92 | #if (PARALLEL_DEBLK_DECISION && !PARALLEL_MERGED_DEBLK) |
---|
93 | Void xEdgeFilterLuma ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdge, Int iDecideExecute); |
---|
94 | #else |
---|
95 | Void xEdgeFilterLuma ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdge ); |
---|
96 | #endif |
---|
97 | Void xEdgeFilterChroma ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, Int iDir, Int iEdge ); |
---|
98 | |
---|
99 | #if (PARALLEL_DEBLK_DECISION && !PARALLEL_MERGED_DEBLK) |
---|
100 | __inline Void xPelFilterLumaStrong ( Pel* piSrc, Int iOffset, Pel m0, Pel m1, Pel m2, Pel m3, Pel m4, Pel m5, Pel m6, Pel m7); |
---|
101 | __inline Void xPelFilterLumaWeak ( Pel* piSrc, Int iOffset, Int tc, Pel m1, Pel m2, Pel m3, Pel m4, Pel m5, Pel m6); |
---|
102 | __inline Void xPelFilterLumaExecution ( Pel* piSrc, Int iOffset, Int tc, Int strongFilter); |
---|
103 | __inline Int xPelFilterLumaDecision ( Pel* piSrc, Int iOffset, Int d, Int beta, Int tc); |
---|
104 | #endif |
---|
105 | |
---|
106 | #if PARALLEL_MERGED_DEBLK |
---|
107 | __inline Void xPelFilterLuma( Pel* piSrc, Int iOffset, Int d, Int beta, Int tc , Pel* piSrcJudge); |
---|
108 | #else |
---|
109 | __inline Void xPelFilterLuma( Pel* piSrc, Int iOffset, Int d, Int beta, Int tc ); |
---|
110 | #endif |
---|
111 | __inline Void xPelFilterChroma( Pel* piSrc, Int iOffset, Int tc ); |
---|
112 | __inline Int xCalcD( Pel* piSrc, Int iOffset); |
---|
113 | |
---|
114 | public: |
---|
115 | TComLoopFilter(); |
---|
116 | virtual ~TComLoopFilter(); |
---|
117 | |
---|
118 | Void create ( UInt uiMaxCUDepth ); |
---|
119 | Void destroy (); |
---|
120 | |
---|
121 | /// set configuration |
---|
122 | Void setCfg( UInt uiDisableDblkIdc, Int iAlphaOffset, Int iBetaOffset ); |
---|
123 | |
---|
124 | /// picture-level deblocking filter |
---|
125 | Void loopFilterPic( TComPic* pcPic ); |
---|
126 | }; |
---|
127 | |
---|
128 | #endif |
---|
129 | |
---|