Imported Upstream version 1.4
[deb_x265.git] / source / common / deblock.h
CommitLineData
72b9787e
JB
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
29namespace x265 {
30// private namespace
31
32class CUData;
33
34class Deblock
35{
36public:
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(CUData* cu, int32_t dir);
46
47protected:
48
49 // CU-level deblocking function
50 void deblockCU(CUData* cu, uint32_t absZOrderIdx, uint32_t depth, const int32_t Edge, uint8_t blockingStrength[]);
51
52 struct Param
53 {
54 uint8_t leftEdge;
55 uint8_t topEdge;
56 };
57
58 // set filtering functions
59 void setLoopfilterParam(CUData* cu, uint32_t absZOrderIdx, Param *params);
60 void setEdgefilterTU(CUData* cu, uint32_t absZOrderIdx, uint32_t depth, int32_t dir, uint8_t blockingStrength[]);
61 void setEdgefilterPU(CUData* cu, uint32_t absZOrderIdx, int32_t dir, uint8_t blockingStrength[], uint32_t widthInBaseUnits);
62 void setEdgefilterMultiple(CUData* cu, uint32_t absZOrderIdx, int32_t dir, int32_t edgeIdx, uint8_t value, uint8_t blockingStrength[], uint32_t widthInBaseUnits);
63
64 // get filtering functions
65 void getBoundaryStrengthSingle(CUData* cu, int32_t dir, uint32_t partIdx, uint8_t blockingStrength[]);
66
67 // filter luma/chroma functions
68 void edgeFilterLuma(CUData* cu, uint32_t absZOrderIdx, uint32_t depth, int32_t dir, int32_t edge, const uint8_t blockingStrength[]);
69 void edgeFilterChroma(CUData* cu, uint32_t absZOrderIdx, uint32_t depth, int32_t dir, int32_t edge, const uint8_t blockingStrength[]);
70
71 static const uint8_t s_tcTable[54];
72 static const uint8_t s_betaTable[52];
73};
74}
75#endif // ifndef X265_DEBLOCK_H