Imported Upstream version 1.4+222+hg5f9f7194267b
[deb_x265.git] / source / common / deblock.h
1 /*****************************************************************************
2 * Copyright (C) 2013 x265 project
3 *
4 * Author: Gopu Govindaswamy <gopu@multicorewareinc.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
19 *
20 * This program is also available under a commercial proprietary license.
21 * For more information, contact us at license @ x265.com.
22 *****************************************************************************/
23
24 #ifndef X265_DEBLOCK_H
25 #define X265_DEBLOCK_H
26
27 #include "common.h"
28
29 namespace x265 {
30 // private namespace
31
32 class CUData;
33
34 class Deblock
35 {
36 public:
37 enum { EDGE_VER, EDGE_HOR };
38
39 uint32_t m_numPartitions;
40
41 Deblock() : m_numPartitions(0) {}
42
43 void init() { m_numPartitions = 1 << (g_maxFullDepth * 2); }
44
45 void deblockCTU(const CUData* ctu, int32_t dir);
46
47 protected:
48
49 // CU-level deblocking function
50 void deblockCU(const CUData* cu, uint32_t absPartIdx, uint32_t depth, const int32_t dir, uint8_t blockStrength[]);
51
52 // set filtering functions
53 void setEdgefilterTU(const CUData* cu, uint32_t absPartIdx, uint32_t depth, int32_t dir, uint8_t blockStrength[]);
54 void setEdgefilterPU(const CUData* cu, uint32_t absPartIdx, int32_t dir, uint8_t blockStrength[], uint32_t numUnits);
55 void setEdgefilterMultiple(const CUData* cu, uint32_t absPartIdx, int32_t dir, int32_t edgeIdx, uint8_t value, uint8_t blockStrength[], uint32_t numUnits);
56
57 // get filtering functions
58 uint8_t getBoundaryStrength(const CUData* cuQ, int32_t dir, uint32_t partQ, const uint8_t blockStrength[]);
59
60 // filter luma/chroma functions
61 void edgeFilterLuma(const CUData* cuQ, uint32_t absPartIdx, uint32_t depth, int32_t dir, int32_t edge, const uint8_t blockStrength[]);
62 void edgeFilterChroma(const CUData* cuQ, uint32_t absPartIdx, uint32_t depth, int32_t dir, int32_t edge, const uint8_t blockStrength[]);
63
64 static const uint8_t s_tcTable[54];
65 static const uint8_t s_betaTable[52];
66 };
67 }
68 #endif // ifndef X265_DEBLOCK_H