History

B-frame decoding support for Main and High Profile with two test cases.

xiaotianshi2 committed 8 years ago

Commit 657d2171 parent e3e838355 files · +17936 −13825Browse files

Showing the changes to codec/decoder/core/src/deblocking.cpp (1 of 55 files). Show all

Unified · Split

codec/decoder/core/src/deblocking.cpp+1383−1003
@@ -1,1003 +1,1383 @@
1/*!1/*!
2 * \copy2 * \copy
3 * Copyright (c) 2010-2013, Cisco Systems3 * Copyright (c) 2010-2013, Cisco Systems
4 * All rights reserved.4 * All rights reserved.
5 *5 *
6 * Redistribution and use in source and binary forms, with or without6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions7 * modification, are permitted provided that the following conditions
8 * are met:8 * are met:
9 *9 *
10 * * Redistributions of source code must retain the above copyright10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.11 * notice, this list of conditions and the following disclaimer.
12 *12 *
13 * * Redistributions in binary form must reproduce the above copyright13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the15 * the documentation and/or other materials provided with the
16 * distribution.16 * distribution.
17 *17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.29 * POSSIBILITY OF SUCH DAMAGE.
30 *30 *
31 *31 *
32 * \file deblocking.c32 * \file deblocking.c
33 *33 *
34 * \brief Interfaces introduced in frame deblocking filtering34 * \brief Interfaces introduced in frame deblocking filtering
35 *35 *
36 * \date 08/02/201036 * \date 08/02/2010
37 *37 *
38 *************************************************************************************38 *************************************************************************************
39 */39 */
40 40
41#include "deblocking.h"41#include "deblocking.h"
42#include "deblocking_common.h"42#include "deblocking_common.h"
43#include "cpu_core.h"43#include "cpu_core.h"
44 44
45namespace WelsDec {45namespace WelsDec {
46 46
47#define NO_SUPPORTED_FILTER_IDX (-1)47#define NO_SUPPORTED_FILTER_IDX (-1)
48#define LEFT_FLAG_BIT 048#define LEFT_FLAG_BIT 0
49#define TOP_FLAG_BIT 149#define TOP_FLAG_BIT 1
50#define LEFT_FLAG_MASK 0x0150#define LEFT_FLAG_MASK 0x01
51#define TOP_FLAG_MASK 0x0251#define TOP_FLAG_MASK 0x02
52 52
53#define SAME_MB_DIFF_REFIDX53#define SAME_MB_DIFF_REFIDX
54#define g_kuiAlphaTable(x) g_kuiAlphaTable[(x)+12]54#define g_kuiAlphaTable(x) g_kuiAlphaTable[(x)+12]
55#define g_kiBetaTable(x) g_kiBetaTable[(x)+12]55#define g_kiBetaTable(x) g_kiBetaTable[(x)+12]
56#define g_kiTc0Table(x) g_kiTc0Table[(x)+12]56#define g_kiTc0Table(x) g_kiTc0Table[(x)+12]
57 57
58#define MB_BS_MV(iRefIndex, iMotionVector, iMbXy, iMbBn, iIndex, iNeighIndex) \58#define MB_BS_MV(iRefIndex, iMotionVector, iMbXy, iMbBn, iIndex, iNeighIndex) \
59(\59(\
60 ( iRefIndex[iMbXy][iIndex] - iRefIndex[iMbBn][iNeighIndex] )||\60 ( iRefIndex[iMbXy][iIndex] - iRefIndex[iMbBn][iNeighIndex] )||\
61 ( WELS_ABS( iMotionVector[iMbXy][iIndex][0] - iMotionVector[iMbBn][iNeighIndex][0] ) >= 4 ) ||\61 ( WELS_ABS( iMotionVector[iMbXy][iIndex][0] - iMotionVector[iMbBn][iNeighIndex][0] ) >= 4 ) ||\
62 ( WELS_ABS( iMotionVector[iMbXy][iIndex][1] - iMotionVector[iMbBn][iNeighIndex][1] ) >= 4 )\62 ( WELS_ABS( iMotionVector[iMbXy][iIndex][1] - iMotionVector[iMbBn][iNeighIndex][1] ) >= 4 )\
63)63)
64 64
65#if defined(SAME_MB_DIFF_REFIDX)65#if defined(SAME_MB_DIFF_REFIDX)
66#define SMB_EDGE_MV(iRefIndex, iMotionVector, iIndex, iNeighIndex) \66#define SMB_EDGE_MV(iRefIndex, iMotionVector, iIndex, iNeighIndex) \
67(\67(\
68 ( iRefIndex[iIndex] - iRefIndex[iNeighIndex] )||(\68 ( iRefIndex[iIndex] - iRefIndex[iNeighIndex] )||(\
69 ( WELS_ABS( iMotionVector[iIndex][0] - iMotionVector[iNeighIndex][0] ) &(~3) ) |\69 ( WELS_ABS( iMotionVector[iIndex][0] - iMotionVector[iNeighIndex][0] ) &(~3) ) |\
70 ( WELS_ABS( iMotionVector[iIndex][1] - iMotionVector[iNeighIndex][1] ) &(~3) ))\70 ( WELS_ABS( iMotionVector[iIndex][1] - iMotionVector[iNeighIndex][1] ) &(~3) ))\
71)71)
72#else72#else
73#define SMB_EDGE_MV(iRefIndex, iMotionVector, iIndex, iNeighIndex) \73#define SMB_EDGE_MV(iRefIndex, iMotionVector, iIndex, iNeighIndex) \
74(\74(\
75 !!(( WELS_ABS( iMotionVector[iIndex][0] - iMotionVector[iNeighIndex][0] ) &(~3) ) |( WELS_ABS( iMotionVector[iIndex][1] - iMotionVector[iNeighIndex][1] ) &(~3) ))\75 !!(( WELS_ABS( iMotionVector[iIndex][0] - iMotionVector[iNeighIndex][0] ) &(~3) ) |( WELS_ABS( iMotionVector[iIndex][1] - iMotionVector[iNeighIndex][1] ) &(~3) ))\
76)76)
77#endif77#endif
78 78
79#define BS_EDGE(bsx1, iRefIndex, iMotionVector, iIndex, iNeighIndex) \79#define BS_EDGE(bsx1, iRefIndex, iMotionVector, iIndex, iNeighIndex) \
80( (bsx1|SMB_EDGE_MV(iRefIndex, iMotionVector, iIndex, iNeighIndex))<<((uint8_t)(!!bsx1)))80( (bsx1|SMB_EDGE_MV(iRefIndex, iMotionVector, iIndex, iNeighIndex))<<((uint8_t)(!!bsx1)))
81 81
82#define GET_ALPHA_BETA_FROM_QP(iQp, iAlphaOffset, iBetaOffset, iIndex, iAlpha, iBeta) \82#define GET_ALPHA_BETA_FROM_QP(iQp, iAlphaOffset, iBetaOffset, iIndex, iAlpha, iBeta) \
83{\83{\
84 iIndex = (iQp + iAlphaOffset);\84 iIndex = (iQp + iAlphaOffset);\
85 iAlpha = g_kuiAlphaTable(iIndex);\85 iAlpha = g_kuiAlphaTable(iIndex);\
86 iBeta = g_kiBetaTable((iQp + iBetaOffset));\86 iBeta = g_kiBetaTable((iQp + iBetaOffset));\
87}87}
88 88
89static const uint8_t g_kuiAlphaTable[52 + 24] = { //this table refers to Table 8-16 in H.264/AVC standard89static const uint8_t g_kuiAlphaTable[52 + 24] = { //this table refers to Table 8-16 in H.264/AVC standard
90 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,90 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
91 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,91 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92 0, 0, 0, 0, 0, 0, 4, 4, 5, 6,92 0, 0, 0, 0, 0, 0, 4, 4, 5, 6,
93 7, 8, 9, 10, 12, 13, 15, 17, 20, 22,93 7, 8, 9, 10, 12, 13, 15, 17, 20, 22,
94 25, 28, 32, 36, 40, 45, 50, 56, 63, 71,94 25, 28, 32, 36, 40, 45, 50, 56, 63, 71,
95 80, 90, 101, 113, 127, 144, 162, 182, 203, 226,95 80, 90, 101, 113, 127, 144, 162, 182, 203, 226,
96 255, 25596 255, 255
97 , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25597 , 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255
98};98};
99 99
100static const int8_t g_kiBetaTable[52 + 24] = { //this table refers to Table 8-16 in H.264/AVC standard100static const int8_t g_kiBetaTable[52 + 24] = { //this table refers to Table 8-16 in H.264/AVC standard
101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103 0, 0, 0, 0, 0, 0, 2, 2, 2, 3,103 0, 0, 0, 0, 0, 0, 2, 2, 2, 3,
104 3, 3, 3, 4, 4, 4, 6, 6, 7, 7,104 3, 3, 3, 4, 4, 4, 6, 6, 7, 7,
105 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,105 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
106 13, 13, 14, 14, 15, 15, 16, 16, 17, 17,106 13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
107 18, 18107 18, 18
108 , 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18108 , 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18
109};109};
110 110
111static const int8_t g_kiTc0Table[52 + 24][4] = { //this table refers Table 8-17 in H.264/AVC standard111static const int8_t g_kiTc0Table[52 + 24][4] = { //this table refers Table 8-17 in H.264/AVC standard
112 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },112 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
113 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },113 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
114 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },114 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
115 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },115 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 },
116 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 1 },116 { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 0 }, { -1, 0, 0, 1 },
117 { -1, 0, 0, 1 }, { -1, 0, 0, 1 }, { -1, 0, 0, 1 }, { -1, 0, 1, 1 }, { -1, 0, 1, 1 }, { -1, 1, 1, 1 },117 { -1, 0, 0, 1 }, { -1, 0, 0, 1 }, { -1, 0, 0, 1 }, { -1, 0, 1, 1 }, { -1, 0, 1, 1 }, { -1, 1, 1, 1 },
118 { -1, 1, 1, 1 }, { -1, 1, 1, 1 }, { -1, 1, 1, 1 }, { -1, 1, 1, 2 }, { -1, 1, 1, 2 }, { -1, 1, 1, 2 },118 { -1, 1, 1, 1 }, { -1, 1, 1, 1 }, { -1, 1, 1, 1 }, { -1, 1, 1, 2 }, { -1, 1, 1, 2 }, { -1, 1, 1, 2 },
119 { -1, 1, 1, 2 }, { -1, 1, 2, 3 }, { -1, 1, 2, 3 }, { -1, 2, 2, 3 }, { -1, 2, 2, 4 }, { -1, 2, 3, 4 },119 { -1, 1, 1, 2 }, { -1, 1, 2, 3 }, { -1, 1, 2, 3 }, { -1, 2, 2, 3 }, { -1, 2, 2, 4 }, { -1, 2, 3, 4 },
120 { -1, 2, 3, 4 }, { -1, 3, 3, 5 }, { -1, 3, 4, 6 }, { -1, 3, 4, 6 }, { -1, 4, 5, 7 }, { -1, 4, 5, 8 },120 { -1, 2, 3, 4 }, { -1, 3, 3, 5 }, { -1, 3, 4, 6 }, { -1, 3, 4, 6 }, { -1, 4, 5, 7 }, { -1, 4, 5, 8 },
121 { -1, 4, 6, 9 }, { -1, 5, 7, 10 }, { -1, 6, 8, 11 }, { -1, 6, 8, 13 }, { -1, 7, 10, 14 }, { -1, 8, 11, 16 },121 { -1, 4, 6, 9 }, { -1, 5, 7, 10 }, { -1, 6, 8, 11 }, { -1, 6, 8, 13 }, { -1, 7, 10, 14 }, { -1, 8, 11, 16 },
122 { -1, 9, 12, 18 }, { -1, 10, 13, 20 }, { -1, 11, 15, 23 }, { -1, 13, 17, 25 }122 { -1, 9, 12, 18 }, { -1, 10, 13, 20 }, { -1, 11, 15, 23 }, { -1, 13, 17, 25 }
123 , { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }123 , { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }
124 , { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }124 , { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }, { -1, 13, 17, 25 }
125};125};
126 126
127static const uint8_t g_kuiTableBIdx[2][8] = {127static const uint8_t g_kuiTableBIdx[2][8] = {
128 {128 {
129 0, 4, 8, 12,129 0, 4, 8, 12,
130 3, 7, 11, 15130 3, 7, 11, 15
131 },131 },
132 132
133 {133 {
134 0, 1, 2, 3,134 0, 1, 2, 3,
135 12, 13, 14, 15135 12, 13, 14, 15
136 },136 },
137};137};
138 138
139static const uint8_t g_kuiTableB8x8Idx[2][16] = {139static const uint8_t g_kuiTableB8x8Idx[2][16] = {
140 {140 {
141 0, 1, 4, 5, 8, 9, 12, 13, // 0 1 | 2 3141 0, 1, 4, 5, 8, 9, 12, 13, // 0 1 | 2 3
142 2, 3, 6, 7, 10, 11, 14, 15 // 4 5 | 6 7142 2, 3, 6, 7, 10, 11, 14, 15 // 4 5 | 6 7
143 }, // ------------143 }, // ------------
144 // 8 9 | 10 11144 // 8 9 | 10 11
145 {145 {
146 // 12 13 | 14 15146 // 12 13 | 14 15
147 0, 1, 4, 5, 2, 3, 6, 7,147 0, 1, 4, 5, 2, 3, 6, 7,
148 8, 9, 12, 13, 10, 11, 14, 15148 8, 9, 12, 13, 10, 11, 14, 15
149 },149 },
150};150};
151 151
152#define TC0_TBL_LOOKUP(tc, iIndexA, pBS, bChroma) \152#define TC0_TBL_LOOKUP(tc, iIndexA, pBS, bChroma) \
153{\153{\
154 tc[0] = g_kiTc0Table(iIndexA)[pBS[0]] + bChroma;\154 tc[0] = g_kiTc0Table(iIndexA)[pBS[0]] + bChroma;\
155 tc[1] = g_kiTc0Table(iIndexA)[pBS[1]] + bChroma;\155 tc[1] = g_kiTc0Table(iIndexA)[pBS[1]] + bChroma;\
156 tc[2] = g_kiTc0Table(iIndexA)[pBS[2]] + bChroma;\156 tc[2] = g_kiTc0Table(iIndexA)[pBS[2]] + bChroma;\
157 tc[3] = g_kiTc0Table(iIndexA)[pBS[3]] + bChroma;\157 tc[3] = g_kiTc0Table(iIndexA)[pBS[3]] + bChroma;\
158}158}
159 159
160void inline DeblockingBSInsideMBAvsbase (int8_t* pNnzTab, uint8_t nBS[2][4][4], int32_t iLShiftFactor) {160void inline DeblockingBSInsideMBAvsbase (int8_t* pNnzTab, uint8_t nBS[2][4][4], int32_t iLShiftFactor) {
161 uint32_t uiNnz32b0, uiNnz32b1, uiNnz32b2, uiNnz32b3;161 uint32_t uiNnz32b0, uiNnz32b1, uiNnz32b2, uiNnz32b3;
162 162
163 uiNnz32b0 = * (uint32_t*) (pNnzTab + 0);163 uiNnz32b0 = * (uint32_t*) (pNnzTab + 0);
164 uiNnz32b1 = * (uint32_t*) (pNnzTab + 4);164 uiNnz32b1 = * (uint32_t*) (pNnzTab + 4);
165 uiNnz32b2 = * (uint32_t*) (pNnzTab + 8);165 uiNnz32b2 = * (uint32_t*) (pNnzTab + 8);
166 uiNnz32b3 = * (uint32_t*) (pNnzTab + 12);166 uiNnz32b3 = * (uint32_t*) (pNnzTab + 12);
167 167
168 nBS[0][1][0] = (pNnzTab[0] | pNnzTab[1]) << iLShiftFactor;168 nBS[0][1][0] = (pNnzTab[0] | pNnzTab[1]) << iLShiftFactor;
169 nBS[0][2][0] = (pNnzTab[1] | pNnzTab[2]) << iLShiftFactor;169 nBS[0][2][0] = (pNnzTab[1] | pNnzTab[2]) << iLShiftFactor;
170 nBS[0][3][0] = (pNnzTab[2] | pNnzTab[3]) << iLShiftFactor;170 nBS[0][3][0] = (pNnzTab[2] | pNnzTab[3]) << iLShiftFactor;
171 171
172 nBS[0][1][1] = (pNnzTab[4] | pNnzTab[5]) << iLShiftFactor;172 nBS[0][1][1] = (pNnzTab[4] | pNnzTab[5]) << iLShiftFactor;
173 nBS[0][2][1] = (pNnzTab[5] | pNnzTab[6]) << iLShiftFactor;173 nBS[0][2][1] = (pNnzTab[5] | pNnzTab[6]) << iLShiftFactor;
174 nBS[0][3][1] = (pNnzTab[6] | pNnzTab[7]) << iLShiftFactor;174 nBS[0][3][1] = (pNnzTab[6] | pNnzTab[7]) << iLShiftFactor;
175 * (uint32_t*)nBS[1][1] = (uiNnz32b0 | uiNnz32b1) << iLShiftFactor;175 * (uint32_t*)nBS[1][1] = (uiNnz32b0 | uiNnz32b1) << iLShiftFactor;
176 176
177 nBS[0][1][2] = (pNnzTab[8] | pNnzTab[9]) << iLShiftFactor;177 nBS[0][1][2] = (pNnzTab[8] | pNnzTab[9]) << iLShiftFactor;
178 nBS[0][2][2] = (pNnzTab[9] | pNnzTab[10]) << iLShiftFactor;178 nBS[0][2][2] = (pNnzTab[9] | pNnzTab[10]) << iLShiftFactor;
179 nBS[0][3][2] = (pNnzTab[10] | pNnzTab[11]) << iLShiftFactor;179 nBS[0][3][2] = (pNnzTab[10] | pNnzTab[11]) << iLShiftFactor;
180 * (uint32_t*)nBS[1][2] = (uiNnz32b1 | uiNnz32b2) << iLShiftFactor;180 * (uint32_t*)nBS[1][2] = (uiNnz32b1 | uiNnz32b2) << iLShiftFactor;
181 181
182 nBS[0][1][3] = (pNnzTab[12] | pNnzTab[13]) << iLShiftFactor;182 nBS[0][1][3] = (pNnzTab[12] | pNnzTab[13]) << iLShiftFactor;
183 nBS[0][2][3] = (pNnzTab[13] | pNnzTab[14]) << iLShiftFactor;183 nBS[0][2][3] = (pNnzTab[13] | pNnzTab[14]) << iLShiftFactor;
184 nBS[0][3][3] = (pNnzTab[14] | pNnzTab[15]) << iLShiftFactor;184 nBS[0][3][3] = (pNnzTab[14] | pNnzTab[15]) << iLShiftFactor;
185 * (uint32_t*)nBS[1][3] = (uiNnz32b2 | uiNnz32b3) << iLShiftFactor;185 * (uint32_t*)nBS[1][3] = (uiNnz32b2 | uiNnz32b3) << iLShiftFactor;
186}186}
187 187
188void inline DeblockingBSInsideMBAvsbase8x8 (int8_t* pNnzTab, uint8_t nBS[2][4][4], int32_t iLShiftFactor) {188void inline DeblockingBSInsideMBAvsbase8x8 (int8_t* pNnzTab, uint8_t nBS[2][4][4], int32_t iLShiftFactor) {
189 int8_t i8x8NnzTab[4];189 int8_t i8x8NnzTab[4];
190 for (int32_t i = 0; i < 4; i++) {190 for (int32_t i = 0; i < 4; i++) {
191 int32_t iBlkIdx = i << 2;191 int32_t iBlkIdx = i << 2;
192 i8x8NnzTab[i] = (pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 1]] |192 i8x8NnzTab[i] = (pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 1]] |
193 pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 2]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 3]]);193 pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 2]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 3]]);
194 }194 }
195 195
196 //vertical196 //vertical
197 nBS[0][2][0] = nBS[0][2][1] = (i8x8NnzTab[0] | i8x8NnzTab[1]) << iLShiftFactor;197 nBS[0][2][0] = nBS[0][2][1] = (i8x8NnzTab[0] | i8x8NnzTab[1]) << iLShiftFactor;
198 nBS[0][2][2] = nBS[0][2][3] = (i8x8NnzTab[2] | i8x8NnzTab[3]) << iLShiftFactor;198 nBS[0][2][2] = nBS[0][2][3] = (i8x8NnzTab[2] | i8x8NnzTab[3]) << iLShiftFactor;
199 //horizontal199 //horizontal
200 nBS[1][2][0] = nBS[1][2][1] = (i8x8NnzTab[0] | i8x8NnzTab[2]) << iLShiftFactor;200 nBS[1][2][0] = nBS[1][2][1] = (i8x8NnzTab[0] | i8x8NnzTab[2]) << iLShiftFactor;
201 nBS[1][2][2] = nBS[1][2][3] = (i8x8NnzTab[1] | i8x8NnzTab[3]) << iLShiftFactor;201 nBS[1][2][2] = nBS[1][2][3] = (i8x8NnzTab[1] | i8x8NnzTab[3]) << iLShiftFactor;
202}202}
203 203
204void static inline DeblockingBSInsideMBNormal (PDqLayer pCurDqLayer, uint8_t nBS[2][4][4], int8_t* pNnzTab,204void static inline DeblockingBSInsideMBNormal (PDqLayer pCurDqLayer, uint8_t nBS[2][4][4], int8_t* pNnzTab,
205 int32_t iMbXy) {205 int32_t iMbXy) {
206 uint32_t uiNnz32b0, uiNnz32b1, uiNnz32b2, uiNnz32b3;206 uint32_t uiNnz32b0, uiNnz32b1, uiNnz32b2, uiNnz32b3;
207 int8_t* iRefIndex = pCurDqLayer->pRefIndex[LIST_0][iMbXy];207 int8_t* iRefIndex = pCurDqLayer->pRefIndex[LIST_0][iMbXy];
208 ENFORCE_STACK_ALIGN_1D (uint8_t, uiBsx4, 4, 4);208 ENFORCE_STACK_ALIGN_1D (uint8_t, uiBsx4, 4, 4);
209 209
210 int8_t i8x8NnzTab[4];210 int8_t i8x8NnzTab[4];
211 211
212 if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) {212 if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) {
213 for (int32_t i = 0; i < 4; i++) {213 for (int32_t i = 0; i < 4; i++) {
214 int32_t iBlkIdx = i << 2;214 int32_t iBlkIdx = i << 2;
215 i8x8NnzTab[i] = (pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 1]] |215 i8x8NnzTab[i] = (pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 1]] |
216 pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 2]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 3]]);216 pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 2]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 3]]);
217 }217 }
218 //vertical218 //vertical
219 nBS[0][2][0] = nBS[0][2][1] = BS_EDGE ((i8x8NnzTab[0] | i8x8NnzTab[1]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],219 nBS[0][2][0] = nBS[0][2][1] = BS_EDGE ((i8x8NnzTab[0] | i8x8NnzTab[1]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],
220 g_kuiMbCountScan4Idx[1 << 2], g_kuiMbCountScan4Idx[0]);220 g_kuiMbCountScan4Idx[1 << 2], g_kuiMbCountScan4Idx[0]);
221 nBS[0][2][2] = nBS[0][2][3] = BS_EDGE ((i8x8NnzTab[2] | i8x8NnzTab[3]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],221 nBS[0][2][2] = nBS[0][2][3] = BS_EDGE ((i8x8NnzTab[2] | i8x8NnzTab[3]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],
222 g_kuiMbCountScan4Idx[3 << 2], g_kuiMbCountScan4Idx[2 << 2]);222 g_kuiMbCountScan4Idx[3 << 2], g_kuiMbCountScan4Idx[2 << 2]);
223 223
224 //horizontal224 //horizontal
225 nBS[1][2][0] = nBS[1][2][1] = BS_EDGE ((i8x8NnzTab[0] | i8x8NnzTab[2]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],225 nBS[1][2][0] = nBS[1][2][1] = BS_EDGE ((i8x8NnzTab[0] | i8x8NnzTab[2]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],
226 g_kuiMbCountScan4Idx[2 << 2], g_kuiMbCountScan4Idx[0]);226 g_kuiMbCountScan4Idx[2 << 2], g_kuiMbCountScan4Idx[0]);
227 nBS[1][2][2] = nBS[1][2][3] = BS_EDGE ((i8x8NnzTab[1] | i8x8NnzTab[3]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],227 nBS[1][2][2] = nBS[1][2][3] = BS_EDGE ((i8x8NnzTab[1] | i8x8NnzTab[3]), iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy],
228 g_kuiMbCountScan4Idx[3 << 2], g_kuiMbCountScan4Idx[1 << 2]);228 g_kuiMbCountScan4Idx[3 << 2], g_kuiMbCountScan4Idx[1 << 2]);
229 } else {229 } else {
230 uiNnz32b0 = * (uint32_t*) (pNnzTab + 0);230 uiNnz32b0 = * (uint32_t*) (pNnzTab + 0);
231 uiNnz32b1 = * (uint32_t*) (pNnzTab + 4);231 uiNnz32b1 = * (uint32_t*) (pNnzTab + 4);
232 uiNnz32b2 = * (uint32_t*) (pNnzTab + 8);232 uiNnz32b2 = * (uint32_t*) (pNnzTab + 8);
233 uiNnz32b3 = * (uint32_t*) (pNnzTab + 12);233 uiNnz32b3 = * (uint32_t*) (pNnzTab + 12);
234 234
235 for (int i = 0; i < 3; i++)235 for (int i = 0; i < 3; i++)
236 uiBsx4[i] = pNnzTab[i] | pNnzTab[i + 1];236 uiBsx4[i] = pNnzTab[i] | pNnzTab[i + 1];
237 nBS[0][1][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 1, 0);237 nBS[0][1][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 1, 0);
238 nBS[0][2][0] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 2, 1);238 nBS[0][2][0] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 2, 1);
239 nBS[0][3][0] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 3, 2);239 nBS[0][3][0] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 3, 2);
240 240
241 for (int i = 0; i < 3; i++)241 for (int i = 0; i < 3; i++)
242 uiBsx4[i] = pNnzTab[4 + i] | pNnzTab[4 + i + 1];242 uiBsx4[i] = pNnzTab[4 + i] | pNnzTab[4 + i + 1];
243 nBS[0][1][1] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 5, 4);243 nBS[0][1][1] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 5, 4);
244 nBS[0][2][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 6, 5);244 nBS[0][2][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 6, 5);
245 nBS[0][3][1] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 7, 6);245 nBS[0][3][1] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 7, 6);
246 246
247 for (int i = 0; i < 3; i++)247 for (int i = 0; i < 3; i++)
248 uiBsx4[i] = pNnzTab[8 + i] | pNnzTab[8 + i + 1];248 uiBsx4[i] = pNnzTab[8 + i] | pNnzTab[8 + i + 1];
249 nBS[0][1][2] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 9, 8);249 nBS[0][1][2] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 9, 8);
250 nBS[0][2][2] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 10, 9);250 nBS[0][2][2] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 10, 9);
251 nBS[0][3][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 11, 10);251 nBS[0][3][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 11, 10);
252 252
253 for (int i = 0; i < 3; i++)253 for (int i = 0; i < 3; i++)
254 uiBsx4[i] = pNnzTab[12 + i] | pNnzTab[12 + i + 1];254 uiBsx4[i] = pNnzTab[12 + i] | pNnzTab[12 + i + 1];
255 nBS[0][1][3] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 13, 12);255 nBS[0][1][3] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 13, 12);
256 nBS[0][2][3] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 14, 13);256 nBS[0][2][3] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 14, 13);
257 nBS[0][3][3] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 15, 14);257 nBS[0][3][3] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 15, 14);
258 258
259 // horizontal259 // horizontal
260 * (uint32_t*)uiBsx4 = (uiNnz32b0 | uiNnz32b1);260 * (uint32_t*)uiBsx4 = (uiNnz32b0 | uiNnz32b1);
261 nBS[1][1][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 4, 0);261 nBS[1][1][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 4, 0);
262 nBS[1][1][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 5, 1);262 nBS[1][1][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 5, 1);
263 nBS[1][1][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 6, 2);263 nBS[1][1][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 6, 2);
264 nBS[1][1][3] = BS_EDGE (uiBsx4[3], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 7, 3);264 nBS[1][1][3] = BS_EDGE (uiBsx4[3], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 7, 3);
265 265
266 * (uint32_t*)uiBsx4 = (uiNnz32b1 | uiNnz32b2);266 * (uint32_t*)uiBsx4 = (uiNnz32b1 | uiNnz32b2);
267 nBS[1][2][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 8, 4);267 nBS[1][2][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 8, 4);
268 nBS[1][2][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 9, 5);268 nBS[1][2][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 9, 5);
269 nBS[1][2][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 10, 6);269 nBS[1][2][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 10, 6);
270 nBS[1][2][3] = BS_EDGE (uiBsx4[3], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 11, 7);270 nBS[1][2][3] = BS_EDGE (uiBsx4[3], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 11, 7);
271 271
272 * (uint32_t*)uiBsx4 = (uiNnz32b2 | uiNnz32b3);272 * (uint32_t*)uiBsx4 = (uiNnz32b2 | uiNnz32b3);
273 nBS[1][3][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 12, 8);273 nBS[1][3][0] = BS_EDGE (uiBsx4[0], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 12, 8);
274 nBS[1][3][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 13, 9);274 nBS[1][3][1] = BS_EDGE (uiBsx4[1], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 13, 9);
275 nBS[1][3][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 14, 10);275 nBS[1][3][2] = BS_EDGE (uiBsx4[2], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 14, 10);
276 nBS[1][3][3] = BS_EDGE (uiBsx4[3], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 15, 11);276 nBS[1][3][3] = BS_EDGE (uiBsx4[3], iRefIndex, pCurDqLayer->pMv[LIST_0][iMbXy], 15, 11);
277 }277 }
278}278}
279 279
280uint32_t DeblockingBsMarginalMBAvcbase (PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy) {280void static inline DeblockingBSliceBSInsideMBNormal (PDqLayer pCurDqLayer, uint8_t nBS[2][4][4], int8_t* pNnzTab,
281 int32_t i, j;281 int32_t iMbXy) {
282 uint32_t uiBSx4;282 uint32_t uiNnz32b0, uiNnz32b1, uiNnz32b2, uiNnz32b3;
283 uint8_t* pBS = (uint8_t*) (&uiBSx4);283 int8_t* iRefIndex[LIST_A];
284 const uint8_t* pBIdx = &g_kuiTableBIdx[iEdge][0];284 iRefIndex[LIST_0] = pCurDqLayer->pRefIndex[LIST_0][iMbXy];
285 const uint8_t* pBnIdx = &g_kuiTableBIdx[iEdge][4];285 iRefIndex[LIST_1] = pCurDqLayer->pRefIndex[LIST_1][iMbXy];
286 const uint8_t* pB8x8Idx = &g_kuiTableB8x8Idx[iEdge][0];286 ENFORCE_STACK_ALIGN_1D (uint8_t, uiBsx4, 4, 4);
287 const uint8_t* pBn8x8Idx = &g_kuiTableB8x8Idx[iEdge][8];287
288 288 int8_t i8x8NnzTab[4];
289 if (pCurDqLayer->pTransformSize8x8Flag[iMbXy] && pCurDqLayer->pTransformSize8x8Flag[iNeighMb]) {289
290 for (i = 0; i < 2; i++) {290 if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) {
291 uint8_t uiNzc = 0;291 for (int32_t i = 0; i < 4; i++) {
292 for (j = 0; uiNzc == 0 && j < 4; j++) {292 int32_t iBlkIdx = i << 2;
293 uiNzc |= (pCurDqLayer->pNzc[iMbXy][* (pB8x8Idx + j)] | pCurDqLayer->pNzc[iNeighMb][* (pBn8x8Idx + j)]);293 i8x8NnzTab[i] = (pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 1]] |
294 }294 pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 2]] | pNnzTab[g_kuiMbCountScan4Idx[iBlkIdx + 3]]);
295 if (uiNzc) {295 }
296 pBS[i << 1] = pBS[1 + (i << 1)] = 2;296 //vertical
297 } else {297 int8_t iIndex = g_kuiMbCountScan4Idx[1 << 2];
298 pBS[i << 1] = pBS[1 + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb,298 int8_t iNeigborIndex = g_kuiMbCountScan4Idx[0];
299 *pB8x8Idx, *pBn8x8Idx);299 nBS[0][2][0] = nBS[0][2][1] = 1;
300 }300 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
301 pB8x8Idx += 4;301 if (iRefIndex[listIdx][iIndex] > REF_NOT_IN_LIST && iRefIndex[listIdx][iNeigborIndex] > REF_NOT_IN_LIST) {
302 pBn8x8Idx += 4;302 nBS[0][2][0] = nBS[0][2][1] = BS_EDGE ((i8x8NnzTab[0] | i8x8NnzTab[1]), iRefIndex[listIdx],
303 }303 pCurDqLayer->pMv[listIdx][iMbXy],
304 } else if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) {304 iIndex, iNeigborIndex);
305 for (i = 0; i < 2; i++) {305 break;
306 uint8_t uiNzc = 0;306 }
307 for (j = 0; uiNzc == 0 && j < 4; j++) {307 }
308 uiNzc |= pCurDqLayer->pNzc[iMbXy][* (pB8x8Idx + j)];308 iIndex = g_kuiMbCountScan4Idx[3 << 2];
309 }309 iNeigborIndex = g_kuiMbCountScan4Idx[2 << 2];
310 for (j = 0; j < 2; j++) {310 nBS[0][2][2] = nBS[0][2][3] = 1;
311 if (uiNzc | pCurDqLayer->pNzc[iNeighMb][*pBnIdx]) {311 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
312 pBS[j + (i << 1)] = 2;312 if (iRefIndex[listIdx][iIndex] > REF_NOT_IN_LIST && iRefIndex[listIdx][iNeigborIndex] > REF_NOT_IN_LIST) {
313 } else {313 nBS[0][2][2] = nBS[0][2][3] = BS_EDGE ((i8x8NnzTab[2] | i8x8NnzTab[3]), iRefIndex[listIdx],
314 pBS[j + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb, *pB8x8Idx,314 pCurDqLayer->pMv[listIdx][iMbXy],
315 *pBnIdx);315 iIndex, iNeigborIndex);
316 }316 break;
317 pBnIdx++;317 }
318 }318 }
319 pB8x8Idx += 4;319
320 }320 //horizontal
321 } else if (pCurDqLayer->pTransformSize8x8Flag[iNeighMb]) {321 iIndex = g_kuiMbCountScan4Idx[2 << 2];
322 for (i = 0; i < 2; i++) {322 iNeigborIndex = g_kuiMbCountScan4Idx[0];
323 uint8_t uiNzc = 0;323 nBS[1][2][0] = nBS[1][2][1] = 1;
324 for (j = 0; uiNzc == 0 && j < 4; j++) {324 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
325 uiNzc |= pCurDqLayer->pNzc[iNeighMb][* (pBn8x8Idx + j)];325 if (iRefIndex[listIdx][iIndex] > REF_NOT_IN_LIST && iRefIndex[listIdx][iNeigborIndex] > REF_NOT_IN_LIST) {
326 }326 nBS[1][2][0] = nBS[1][2][1] = BS_EDGE ((i8x8NnzTab[0] | i8x8NnzTab[2]), iRefIndex[listIdx],
327 for (j = 0; j < 2; j++) {327 pCurDqLayer->pMv[listIdx][iMbXy],
328 if (uiNzc | pCurDqLayer->pNzc[iMbXy][*pBIdx]) {328 iIndex, iNeigborIndex);
329 pBS[j + (i << 1)] = 2;329 break;
330 } else {330 }
331 pBS[j + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb, *pBIdx,331 }
332 *pBn8x8Idx);332
333 }333 iIndex = g_kuiMbCountScan4Idx[3 << 2];
334 pBIdx++;334 iNeigborIndex = g_kuiMbCountScan4Idx[1 << 2];
335 }335 nBS[1][2][2] = nBS[1][2][3] = 1;
336 pBn8x8Idx += 4;336 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
337 }337 if (iRefIndex[listIdx][iIndex] > REF_NOT_IN_LIST && iRefIndex[listIdx][iNeigborIndex] > REF_NOT_IN_LIST) {
338 } else {338 nBS[1][2][2] = nBS[1][2][3] = BS_EDGE ((i8x8NnzTab[1] | i8x8NnzTab[3]), iRefIndex[listIdx],
339 // only 4x4 transform339 pCurDqLayer->pMv[listIdx][iMbXy],
340 for (i = 0; i < 4; i++) {340 iIndex, iNeigborIndex);
341 if (pCurDqLayer->pNzc[iMbXy][*pBIdx] | pCurDqLayer->pNzc[iNeighMb][*pBnIdx]) {341 break;
342 pBS[i] = 2;342 }
343 } else {343 }
344 pBS[i] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb, *pBIdx,344 } else {
345 *pBnIdx);345 uiNnz32b0 = * (uint32_t*) (pNnzTab + 0);
346 }346 uiNnz32b1 = * (uint32_t*) (pNnzTab + 4);
347 pBIdx++;347 uiNnz32b2 = * (uint32_t*) (pNnzTab + 8);
348 pBnIdx++;348 uiNnz32b3 = * (uint32_t*) (pNnzTab + 12);
349 }349
350 }350 for (int i = 0; i < 3; i++)
351 351 uiBsx4[i] = pNnzTab[i] | pNnzTab[i + 1];
352 return uiBSx4;352 nBS[0][1][0] = 1;
353}353 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
354int32_t DeblockingAvailableNoInterlayer (PDqLayer pCurDqLayer, int32_t iFilterIdc) {354 if (iRefIndex[listIdx][1] > REF_NOT_IN_LIST && iRefIndex[listIdx][0] > REF_NOT_IN_LIST) {
355 int32_t iMbY = pCurDqLayer->iMbY;355 nBS[0][1][0] = BS_EDGE (uiBsx4[0], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 1, 0);
356 int32_t iMbX = pCurDqLayer->iMbX;356 break;
357 int32_t iMbXy = pCurDqLayer->iMbXyIndex;357 }
358 bool bLeftFlag = false;358 }
359 bool bTopFlag = false;359 nBS[0][2][0] = 1;
360 360 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
361 if (2 == iFilterIdc) {361 if (iRefIndex[listIdx][2] > REF_NOT_IN_LIST && iRefIndex[listIdx][1] > REF_NOT_IN_LIST) {
362 bLeftFlag = (iMbX > 0) && (pCurDqLayer->pSliceIdc[iMbXy] == pCurDqLayer->pSliceIdc[iMbXy - 1]);362 nBS[0][2][0] = BS_EDGE (uiBsx4[1], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 2, 1);
363 bTopFlag = (iMbY > 0) && (pCurDqLayer->pSliceIdc[iMbXy] == pCurDqLayer->pSliceIdc[iMbXy - pCurDqLayer->iMbWidth]);363 break;
364 } else { //if ( 0 == iFilterIdc )364 }
365 bLeftFlag = (iMbX > 0);365 }
366 bTopFlag = (iMbY > 0);366 nBS[0][3][0] = 1;
367 }367 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
368 return (bLeftFlag << LEFT_FLAG_BIT) | (bTopFlag << TOP_FLAG_BIT);368 if (iRefIndex[listIdx][3] > REF_NOT_IN_LIST && iRefIndex[listIdx][2] > REF_NOT_IN_LIST) {
369}369 nBS[0][3][0] = BS_EDGE (uiBsx4[2], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 3, 2);
370 370 break;
371void FilteringEdgeLumaH (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {371 }
372 int32_t iIndexA;372 }
373 int32_t iAlpha;373
374 int32_t iBeta;374 for (int i = 0; i < 3; i++)
375 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);375 uiBsx4[i] = pNnzTab[4 + i] | pNnzTab[4 + i + 1];
376 376 nBS[0][1][1] = 1;
377 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,377 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
378 iBeta);378 if (iRefIndex[listIdx][5] > REF_NOT_IN_LIST && iRefIndex[listIdx][4] > REF_NOT_IN_LIST) {
379 379 nBS[0][1][1] = BS_EDGE (uiBsx4[0], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 5, 4);
380 if (iAlpha | iBeta) {380 break;
381 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 0);381 }
382 pFilter->pLoopf->pfLumaDeblockingLT4Ver (pPix, iStride, iAlpha, iBeta, tc);382 }
383 }383 nBS[0][2][1] = 1;
384 return;384 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
385}385 if (iRefIndex[listIdx][6] > REF_NOT_IN_LIST && iRefIndex[listIdx][5] > REF_NOT_IN_LIST) {
386 386 nBS[0][2][1] = BS_EDGE (uiBsx4[1], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 6, 5);
387 387 break;
388void FilteringEdgeLumaV (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {388 }
389 int32_t iIndexA;389 }
390 int32_t iAlpha;390 nBS[0][3][1] = 1;
391 int32_t iBeta;391 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
392 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);392 if (iRefIndex[listIdx][7] > REF_NOT_IN_LIST && iRefIndex[listIdx][6] > REF_NOT_IN_LIST) {
393 393 nBS[0][3][1] = BS_EDGE (uiBsx4[2], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 7, 6);
394 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,394 break;
395 iBeta);395 }
396 396 }
397 if (iAlpha | iBeta) {397
398 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 0);398 for (int i = 0; i < 3; i++)
399 pFilter->pLoopf->pfLumaDeblockingLT4Hor (pPix, iStride, iAlpha, iBeta, tc);399 uiBsx4[i] = pNnzTab[8 + i] | pNnzTab[8 + i + 1];
400 }400 nBS[0][1][2] = 1;
401 return;401 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
402}402 if (iRefIndex[listIdx][9] > REF_NOT_IN_LIST && iRefIndex[listIdx][8] > REF_NOT_IN_LIST) {
403 403 nBS[0][1][2] = BS_EDGE (uiBsx4[0], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 9, 8);
404 404 break;
405void FilteringEdgeLumaIntraH (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {405 }
406 int32_t iIndexA;406 }
407 int32_t iAlpha;407 nBS[0][2][2] = 1;
408 int32_t iBeta;408 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
409 409 if (iRefIndex[listIdx][10] > REF_NOT_IN_LIST && iRefIndex[listIdx][9] > REF_NOT_IN_LIST) {
410 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,410 nBS[0][2][2] = BS_EDGE (uiBsx4[1], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 10, 9);
411 iBeta);411 break;
412 412 }
413 if (iAlpha | iBeta) {413 }
414 pFilter->pLoopf->pfLumaDeblockingEQ4Ver (pPix, iStride, iAlpha, iBeta);414 nBS[0][3][2] = 1;
415 }415 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
416 return;416 if (iRefIndex[listIdx][11] > REF_NOT_IN_LIST && iRefIndex[listIdx][10] > REF_NOT_IN_LIST) {
417}417 nBS[0][3][2] = BS_EDGE (uiBsx4[2], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 11, 10);
418 418 break;
419void FilteringEdgeLumaIntraV (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {419 }
420 int32_t iIndexA;420 }
421 int32_t iAlpha;421
422 int32_t iBeta;422 for (int i = 0; i < 3; i++)
423 423 uiBsx4[i] = pNnzTab[12 + i] | pNnzTab[12 + i + 1];
424 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,424 nBS[0][1][3] = 1;
425 iBeta);425 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
426 426 if (iRefIndex[listIdx][13] > REF_NOT_IN_LIST && iRefIndex[listIdx][12] > REF_NOT_IN_LIST) {
427 if (iAlpha | iBeta) {427 nBS[0][1][3] = BS_EDGE (uiBsx4[0], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 13, 12);
428 pFilter->pLoopf->pfLumaDeblockingEQ4Hor (pPix, iStride, iAlpha, iBeta);428 break;
429 }429 }
430 return;430 }
431}431 nBS[0][2][3] = 1;
432void FilteringEdgeChromaH (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,432 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
433 uint8_t* pBS) {433 if (iRefIndex[listIdx][14] > REF_NOT_IN_LIST && iRefIndex[listIdx][13] > REF_NOT_IN_LIST) {
434 int32_t iIndexA;434 nBS[0][2][3] = BS_EDGE (uiBsx4[1], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 14, 13);
435 int32_t iAlpha;435 break;
436 int32_t iBeta;436 }
437 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);437 }
438 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {438 nBS[0][3][3] = 1;
439 439 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
440 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,440 if (iRefIndex[listIdx][15] > REF_NOT_IN_LIST && iRefIndex[listIdx][14] > REF_NOT_IN_LIST) {
441 iBeta);441 nBS[0][3][3] = BS_EDGE (uiBsx4[2], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 15, 14);
442 442 break;
443 if (iAlpha | iBeta) {443 }
444 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);444 }
445 pFilter->pLoopf->pfChromaDeblockingLT4Ver (pPixCb, pPixCr, iStride, iAlpha, iBeta, tc);445
446 }446 // horizontal
447 } else {447 * (uint32_t*)uiBsx4 = (uiNnz32b0 | uiNnz32b1);
448 448 nBS[1][1][0] = 1;
449 for (int i = 0; i < 2; i++) {449 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
450 450 if (iRefIndex[listIdx][4] > REF_NOT_IN_LIST && iRefIndex[listIdx][0] > REF_NOT_IN_LIST) {
451 451 nBS[1][1][0] = BS_EDGE (uiBsx4[0], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 4, 0);
452 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,452 break;
453 iBeta);453 }
454 454 }
455 if (iAlpha | iBeta) {455 nBS[1][1][1] = 1;
456 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;456 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
457 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);457 if (iRefIndex[listIdx][5] > REF_NOT_IN_LIST && iRefIndex[listIdx][1] > REF_NOT_IN_LIST) {
458 pFilter->pLoopf->pfChromaDeblockingLT4Ver2 (pPixCbCr, iStride, iAlpha, iBeta, tc);458 nBS[1][1][1] = BS_EDGE (uiBsx4[1], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 5, 1);
459 }459 break;
460 460 }
461 461 }
462 462 nBS[1][1][2] = 1;
463 }463 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
464 464 if (iRefIndex[listIdx][6] > REF_NOT_IN_LIST && iRefIndex[listIdx][2] > REF_NOT_IN_LIST) {
465 }465 nBS[1][1][2] = BS_EDGE (uiBsx4[2], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 6, 2);
466 return;466 break;
467}467 }
468void FilteringEdgeChromaV (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,468 }
469 uint8_t* pBS) {469 nBS[1][1][3] = 1;
470 int32_t iIndexA;470 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
471 int32_t iAlpha;471 if (iRefIndex[listIdx][7] > REF_NOT_IN_LIST && iRefIndex[listIdx][3] > REF_NOT_IN_LIST) {
472 int32_t iBeta;472 nBS[1][1][3] = BS_EDGE (uiBsx4[3], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 7, 3);
473 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);473 break;
474 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {474 }
475 475 }
476 476
477 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,477 * (uint32_t*)uiBsx4 = (uiNnz32b1 | uiNnz32b2);
478 iBeta);478 nBS[1][2][0] = 1;
479 479 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
480 if (iAlpha | iBeta) {480 if (iRefIndex[listIdx][8] > REF_NOT_IN_LIST && iRefIndex[listIdx][4] > REF_NOT_IN_LIST) {
481 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);481 nBS[1][2][0] = BS_EDGE (uiBsx4[0], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 8, 4);
482 pFilter->pLoopf->pfChromaDeblockingLT4Hor (pPixCb, pPixCr, iStride, iAlpha, iBeta, tc);482 break;
483 }483 }
484 484 }
485 485 nBS[1][2][1] = 1;
486 } else {486 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
487 487 if (iRefIndex[listIdx][9] > REF_NOT_IN_LIST && iRefIndex[listIdx][5] > REF_NOT_IN_LIST) {
488 for (int i = 0; i < 2; i++) {488 nBS[1][2][1] = BS_EDGE (uiBsx4[1], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 9, 5);
489 489 break;
490 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,490 }
491 iBeta);491 }
492 492 nBS[1][2][2] = 1;
493 if (iAlpha | iBeta) {493 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
494 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;494 if (iRefIndex[listIdx][10] > REF_NOT_IN_LIST && iRefIndex[listIdx][6] > REF_NOT_IN_LIST) {
495 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);495 nBS[1][2][2] = BS_EDGE (uiBsx4[2], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 10, 6);
496 pFilter->pLoopf->pfChromaDeblockingLT4Hor2 (pPixCbCr, iStride, iAlpha, iBeta, tc);496 break;
497 }497 }
498 498 }
499 499 nBS[1][2][3] = 1;
500 }500 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
501 }501 if (iRefIndex[listIdx][11] > REF_NOT_IN_LIST && iRefIndex[listIdx][7] > REF_NOT_IN_LIST) {
502 return;502 nBS[1][2][3] = BS_EDGE (uiBsx4[3], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 11, 7);
503}503 break;
504 504 }
505void FilteringEdgeChromaIntraH (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,505 }
506 uint8_t* pBS) {506
507 int32_t iIndexA;507 * (uint32_t*)uiBsx4 = (uiNnz32b2 | uiNnz32b3);
508 int32_t iAlpha;508 nBS[1][3][0] = 1;
509 int32_t iBeta;509 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
510 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {510 if (iRefIndex[listIdx][12] > REF_NOT_IN_LIST && iRefIndex[listIdx][8] > REF_NOT_IN_LIST) {
511 511 nBS[1][3][0] = BS_EDGE (uiBsx4[0], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 12, 8);
512 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,512 break;
513 iBeta);513 }
514 514 }
515 if (iAlpha | iBeta) {515 nBS[1][3][1] = 1;
516 pFilter->pLoopf->pfChromaDeblockingEQ4Ver (pPixCb, pPixCr, iStride, iAlpha, iBeta);516 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
517 }517 if (iRefIndex[listIdx][13] > REF_NOT_IN_LIST && iRefIndex[listIdx][9] > REF_NOT_IN_LIST) {
518 } else {518 nBS[1][3][1] = BS_EDGE (uiBsx4[1], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 13, 9);
519 519 break;
520 for (int i = 0; i < 2; i++) {520 }
521 521 }
522 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,522 nBS[1][3][2] = 1;
523 iBeta);523 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
524 524 if (iRefIndex[listIdx][14] > REF_NOT_IN_LIST && iRefIndex[listIdx][10] > REF_NOT_IN_LIST) {
525 if (iAlpha | iBeta) {525 nBS[1][3][2] = BS_EDGE (uiBsx4[2], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 14, 10);
526 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;526 break;
527 pFilter->pLoopf->pfChromaDeblockingEQ4Ver2 (pPixCbCr, iStride, iAlpha, iBeta);527 }
528 }528 }
529 529 nBS[1][3][3] = 1;
530 }530 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
531 }531 if (iRefIndex[listIdx][15] > REF_NOT_IN_LIST && iRefIndex[listIdx][11] > REF_NOT_IN_LIST) {
532 return;532 nBS[1][3][3] = BS_EDGE (uiBsx4[3], iRefIndex[listIdx], pCurDqLayer->pMv[listIdx][iMbXy], 15, 11);
533}533 break;
534 534 }
535void FilteringEdgeChromaIntraV (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,535 }
536 uint8_t* pBS) {536 }
537 int32_t iIndexA;537}
538 int32_t iAlpha;538
539 int32_t iBeta;539
540 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) { // QP of cb and cr are the same540uint32_t DeblockingBsMarginalMBAvcbase (PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy) {
541 541 int32_t i, j;
542 542 uint32_t uiBSx4;
543 543 uint8_t* pBS = (uint8_t*) (&uiBSx4);
544 544 const uint8_t* pBIdx = &g_kuiTableBIdx[iEdge][0];
545 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,545 const uint8_t* pBnIdx = &g_kuiTableBIdx[iEdge][4];
546 iBeta);546 const uint8_t* pB8x8Idx = &g_kuiTableB8x8Idx[iEdge][0];
547 if (iAlpha | iBeta) {547 const uint8_t* pBn8x8Idx = &g_kuiTableB8x8Idx[iEdge][8];
548 pFilter->pLoopf->pfChromaDeblockingEQ4Hor (pPixCb, pPixCr, iStride, iAlpha, iBeta);548
549 }549 if (pCurDqLayer->pTransformSize8x8Flag[iMbXy] && pCurDqLayer->pTransformSize8x8Flag[iNeighMb]) {
550 } else {550 for (i = 0; i < 2; i++) {
551 551 uint8_t uiNzc = 0;
552 for (int i = 0; i < 2; i++) {552 for (j = 0; uiNzc == 0 && j < 4; j++) {
553 553 uiNzc |= (pCurDqLayer->pNzc[iMbXy][* (pB8x8Idx + j)] | pCurDqLayer->pNzc[iNeighMb][* (pBn8x8Idx + j)]);
554 554 }
555 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,555 if (uiNzc) {
556 iBeta);556 pBS[i << 1] = pBS[1 + (i << 1)] = 2;
557 if (iAlpha | iBeta) {557 } else {
558 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;558 pBS[i << 1] = pBS[1 + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb,
559 pFilter->pLoopf->pfChromaDeblockingEQ4Hor2 (pPixCbCr, iStride, iAlpha, iBeta);559 *pB8x8Idx, *pBn8x8Idx);
560 }560 }
561 }561 pB8x8Idx += 4;
562 562 pBn8x8Idx += 4;
563 }563 }
564 return;564 } else if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) {
565}565 for (i = 0; i < 2; i++) {
566 566 uint8_t uiNzc = 0;
567 567 for (j = 0; uiNzc == 0 && j < 4; j++) {
568void DeblockingInterMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, uint8_t nBS[2][4][4],568 uiNzc |= pCurDqLayer->pNzc[iMbXy][* (pB8x8Idx + j)];
569 int32_t iBoundryFlag) {569 }
570 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;570 for (j = 0; j < 2; j++) {
571 int32_t iMbX = pCurDqLayer->iMbX;571 if (uiNzc | pCurDqLayer->pNzc[iNeighMb][*pBnIdx]) {
572 int32_t iMbY = pCurDqLayer->iMbY;572 pBS[j + (i << 1)] = 2;
573 573 } else {
574 int32_t iCurLumaQp = pCurDqLayer->pLumaQp[iMbXyIndex];574 pBS[j + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb, *pB8x8Idx,
575 //int32_t* iCurChromaQp = pCurDqLayer->pChromaQp[iMbXyIndex];575 *pBnIdx);
576 int8_t* pCurChromaQp = pCurDqLayer->pChromaQp[iMbXyIndex];576 }
577 int32_t iLineSize = pFilter->iCsStride[0];577 pBnIdx++;
578 int32_t iLineSizeUV = pFilter->iCsStride[1];578 }
579 579 pB8x8Idx += 4;
580 uint8_t* pDestY, * pDestCb, * pDestCr;580 }
581 pDestY = pFilter->pCsData[0] + ((iMbY * iLineSize + iMbX) << 4);581 } else if (pCurDqLayer->pTransformSize8x8Flag[iNeighMb]) {
582 pDestCb = pFilter->pCsData[1] + ((iMbY * iLineSizeUV + iMbX) << 3);582 for (i = 0; i < 2; i++) {
583 pDestCr = pFilter->pCsData[2] + ((iMbY * iLineSizeUV + iMbX) << 3);583 uint8_t uiNzc = 0;
584 584 for (j = 0; uiNzc == 0 && j < 4; j++) {
585//Vertical margrin585 uiNzc |= pCurDqLayer->pNzc[iNeighMb][* (pBn8x8Idx + j)];
586 if (iBoundryFlag & LEFT_FLAG_MASK) {586 }
587 int32_t iLeftXyIndex = iMbXyIndex - 1;587 for (j = 0; j < 2; j++) {
588 pFilter->iLumaQP = (iCurLumaQp + pCurDqLayer->pLumaQp[iLeftXyIndex] + 1) >> 1;588 if (uiNzc | pCurDqLayer->pNzc[iMbXy][*pBIdx]) {
589 for (int i = 0; i < 2; i++) {589 pBS[j + (i << 1)] = 2;
590 pFilter->iChromaQP[i] = (pCurChromaQp[i] + pCurDqLayer->pChromaQp[iLeftXyIndex][i] + 1) >> 1;590 } else {
591 }591 pBS[j + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb, *pBIdx,
592 if (nBS[0][0][0] == 0x04) {592 *pBn8x8Idx);
593 FilteringEdgeLumaIntraV (pFilter, pDestY, iLineSize, NULL);593 }
594 FilteringEdgeChromaIntraV (pFilter, pDestCb, pDestCr, iLineSizeUV, NULL);594 pBIdx++;
595 } else {595 }
596 if (* (uint32_t*)nBS[0][0] != 0) {596 pBn8x8Idx += 4;
597 FilteringEdgeLumaV (pFilter, pDestY, iLineSize, nBS[0][0]);597 }
598 FilteringEdgeChromaV (pFilter, pDestCb, pDestCr, iLineSizeUV, nBS[0][0]);598 } else {
599 }599 // only 4x4 transform
600 }600 for (i = 0; i < 4; i++) {
601 }601 if (pCurDqLayer->pNzc[iMbXy][*pBIdx] | pCurDqLayer->pNzc[iNeighMb][*pBnIdx]) {
602 602 pBS[i] = 2;
603 pFilter->iLumaQP = iCurLumaQp;603 } else {
604 pFilter->iChromaQP[0] = pCurChromaQp[0];604 pBS[i] = MB_BS_MV (pCurDqLayer->pRefIndex[LIST_0], pCurDqLayer->pMv[LIST_0], iMbXy, iNeighMb, *pBIdx,
605 pFilter->iChromaQP[1] = pCurChromaQp[1];605 *pBnIdx);
606 606 }
607 if (* (uint32_t*)nBS[0][1] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {607 pBIdx++;
608 FilteringEdgeLumaV (pFilter, &pDestY[1 << 2], iLineSize, nBS[0][1]);608 pBnIdx++;
609 }609 }
610 610 }
611 if (* (uint32_t*)nBS[0][2] != 0) {611
612 FilteringEdgeLumaV (pFilter, &pDestY[2 << 2], iLineSize, nBS[0][2]);612 return uiBSx4;
613 FilteringEdgeChromaV (pFilter, &pDestCb[2 << 1], &pDestCr[2 << 1], iLineSizeUV, nBS[0][2]);613}
614 }614uint32_t DeblockingBSliceBsMarginalMBAvcbase (PDqLayer pCurDqLayer, int32_t iEdge, int32_t iNeighMb, int32_t iMbXy) {
615 615 int32_t i, j;
616 if (* (uint32_t*)nBS[0][3] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {616 uint32_t uiBSx4;
617 FilteringEdgeLumaV (pFilter, &pDestY[3 << 2], iLineSize, nBS[0][3]);617 uint8_t* pBS = (uint8_t*) (&uiBSx4);
618 }618 const uint8_t* pBIdx = &g_kuiTableBIdx[iEdge][0];
619 619 const uint8_t* pBnIdx = &g_kuiTableBIdx[iEdge][4];
620 if (iBoundryFlag & TOP_FLAG_MASK) {620 const uint8_t* pB8x8Idx = &g_kuiTableB8x8Idx[iEdge][0];
621 int32_t iTopXyIndex = iMbXyIndex - pCurDqLayer->iMbWidth;621 const uint8_t* pBn8x8Idx = &g_kuiTableB8x8Idx[iEdge][8];
622 pFilter->iLumaQP = (iCurLumaQp + pCurDqLayer->pLumaQp[iTopXyIndex] + 1) >> 1;622
623 for (int i = 0; i < 2; i++) {623 if (pCurDqLayer->pTransformSize8x8Flag[iMbXy] && pCurDqLayer->pTransformSize8x8Flag[iNeighMb]) {
624 pFilter->iChromaQP[i] = (pCurChromaQp[i] + pCurDqLayer->pChromaQp[iTopXyIndex][i] + 1) >> 1;624 for (i = 0; i < 2; i++) {
625 }625 uint8_t uiNzc = 0;
626 626 for (j = 0; uiNzc == 0 && j < 4; j++) {
627 if (nBS[1][0][0] == 0x04) {627 uiNzc |= (pCurDqLayer->pNzc[iMbXy][* (pB8x8Idx + j)] | pCurDqLayer->pNzc[iNeighMb][* (pBn8x8Idx + j)]);
628 FilteringEdgeLumaIntraH (pFilter, pDestY, iLineSize, NULL);628 }
629 FilteringEdgeChromaIntraH (pFilter, pDestCb, pDestCr, iLineSizeUV, NULL);629 if (uiNzc) {
630 } else {630 pBS[i << 1] = pBS[1 + (i << 1)] = 2;
631 if (* (uint32_t*)nBS[1][0] != 0) {631 } else {
632 FilteringEdgeLumaH (pFilter, pDestY, iLineSize, nBS[1][0]);632 pBS[i << 1] = pBS[1 + (i << 1)] = 1;
633 FilteringEdgeChromaH (pFilter, pDestCb, pDestCr, iLineSizeUV, nBS[1][0]);633 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
634 }634 if (pCurDqLayer->pRefIndex[listIdx][iMbXy][*pB8x8Idx] > REF_NOT_IN_LIST
635 }635 && pCurDqLayer->pRefIndex[listIdx][iMbXy][*pBn8x8Idx] > REF_NOT_IN_LIST) {
636 }636 pBS[i << 1] = pBS[1 + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[listIdx], pCurDqLayer->pMv[listIdx], iMbXy, iNeighMb,
637 637 *pB8x8Idx, *pBn8x8Idx);
638 pFilter->iLumaQP = iCurLumaQp;638 break;
639 pFilter->iChromaQP[0] = pCurChromaQp[0];639 }
640 pFilter->iChromaQP[1] = pCurChromaQp[1];640 }
641 641 }
642 if (* (uint32_t*)nBS[1][1] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {642 pB8x8Idx += 4;
643 FilteringEdgeLumaH (pFilter, &pDestY[ (1 << 2)*iLineSize], iLineSize, nBS[1][1]);643 pBn8x8Idx += 4;
644 }644 }
645 645 } else if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) {
646 if (* (uint32_t*)nBS[1][2] != 0) {646 for (i = 0; i < 2; i++) {
647 FilteringEdgeLumaH (pFilter, &pDestY[ (2 << 2)*iLineSize], iLineSize, nBS[1][2]);647 uint8_t uiNzc = 0;
648 FilteringEdgeChromaH (pFilter, &pDestCb[ (2 << 1)*iLineSizeUV], &pDestCr[ (2 << 1)*iLineSizeUV], iLineSizeUV,648 for (j = 0; uiNzc == 0 && j < 4; j++) {
649 nBS[1][2]);649 uiNzc |= pCurDqLayer->pNzc[iMbXy][* (pB8x8Idx + j)];
650 }650 }
651 651 for (j = 0; j < 2; j++) {
652 if (* (uint32_t*)nBS[1][3] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {652 if (uiNzc | pCurDqLayer->pNzc[iNeighMb][*pBnIdx]) {
653 FilteringEdgeLumaH (pFilter, &pDestY[ (3 << 2)*iLineSize], iLineSize, nBS[1][3]);653 pBS[j + (i << 1)] = 2;
654 }654 } else {
655}655 pBS[j + (i << 1)] = 1;
656 656 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
657void FilteringEdgeLumaHV (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {657 if (pCurDqLayer->pRefIndex[listIdx][iMbXy][*pB8x8Idx] > REF_NOT_IN_LIST
658 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;658 && pCurDqLayer->pRefIndex[listIdx][iMbXy][*pBnIdx] > REF_NOT_IN_LIST) {
659 int32_t iMbX = pCurDqLayer->iMbX;659 pBS[j + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[listIdx], pCurDqLayer->pMv[listIdx], iMbXy, iNeighMb, *pB8x8Idx,
660 int32_t iMbY = pCurDqLayer->iMbY;660 *pBnIdx);
661 int32_t iMbWidth = pCurDqLayer->iMbWidth;661 break;
662 int32_t iLineSize = pFilter->iCsStride[0];662 }
663 663 }
664 uint8_t* pDestY;664 }
665 int32_t iCurQp;665 pBnIdx++;
666 int32_t iIndexA, iAlpha, iBeta;666 }
667 667 pB8x8Idx += 4;
668 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);668 }
669 ENFORCE_STACK_ALIGN_1D (uint8_t, uiBSx4, 4, 4);669 } else if (pCurDqLayer->pTransformSize8x8Flag[iNeighMb]) {
670 670 for (i = 0; i < 2; i++) {
671 pDestY = pFilter->pCsData[0] + ((iMbY * iLineSize + iMbX) << 4);671 uint8_t uiNzc = 0;
672 iCurQp = pCurDqLayer->pLumaQp[iMbXyIndex];672 for (j = 0; uiNzc == 0 && j < 4; j++) {
673 673 uiNzc |= pCurDqLayer->pNzc[iNeighMb][* (pBn8x8Idx + j)];
674 * (uint32_t*)uiBSx4 = 0x03030303;674 }
675 675 for (j = 0; j < 2; j++) {
676 // luma v676 if (uiNzc | pCurDqLayer->pNzc[iMbXy][*pBIdx]) {
677 if (iBoundryFlag & LEFT_FLAG_MASK) {677 pBS[j + (i << 1)] = 2;
678 pFilter->iLumaQP = (iCurQp + pCurDqLayer->pLumaQp[iMbXyIndex - 1] + 1) >> 1;678 } else {
679 FilteringEdgeLumaIntraV (pFilter, pDestY, iLineSize, NULL);679 pBS[j + (i << 1)] = 1;
680 }680 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
681 681 if (pCurDqLayer->pRefIndex[listIdx][iMbXy][*pBIdx] > REF_NOT_IN_LIST
682 pFilter->iLumaQP = iCurQp;682 && pCurDqLayer->pRefIndex[listIdx][iMbXy][*pBn8x8Idx] > REF_NOT_IN_LIST) {
683 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,683 pBS[j + (i << 1)] = MB_BS_MV (pCurDqLayer->pRefIndex[listIdx], pCurDqLayer->pMv[listIdx], iMbXy, iNeighMb, *pBIdx,
684 iBeta);684 *pBn8x8Idx);
685 if (iAlpha | iBeta) {685 break;
686 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 0);686 }
687 687 }
688 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {688 }
689 pFilter->pLoopf->pfLumaDeblockingLT4Hor (&pDestY[1 << 2], iLineSize, iAlpha, iBeta, iTc);689 pBIdx++;
690 }690 }
691 691 pBn8x8Idx += 4;
692 pFilter->pLoopf->pfLumaDeblockingLT4Hor (&pDestY[2 << 2], iLineSize, iAlpha, iBeta, iTc);692 }
693 693 } else {
694 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {694 // only 4x4 transform
695 pFilter->pLoopf->pfLumaDeblockingLT4Hor (&pDestY[3 << 2], iLineSize, iAlpha, iBeta, iTc);695 for (i = 0; i < 4; i++) {
696 }696 if (pCurDqLayer->pNzc[iMbXy][*pBIdx] | pCurDqLayer->pNzc[iNeighMb][*pBnIdx]) {
697 }697 pBS[i] = 2;
698 698 } else {
699 // luma h699 pBS[i] = 1;
700 if (iBoundryFlag & TOP_FLAG_MASK) {700 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
701 pFilter->iLumaQP = (iCurQp + pCurDqLayer->pLumaQp[iMbXyIndex - iMbWidth] + 1) >> 1;701 if (pCurDqLayer->pRefIndex[listIdx][iMbXy][*pBIdx] > REF_NOT_IN_LIST
702 FilteringEdgeLumaIntraH (pFilter, pDestY, iLineSize, NULL);702 && pCurDqLayer->pRefIndex[listIdx][iMbXy][*pBnIdx] > REF_NOT_IN_LIST) {
703 }703 pBS[i] = MB_BS_MV (pCurDqLayer->pRefIndex[listIdx], pCurDqLayer->pMv[listIdx], iMbXy, iNeighMb, *pBIdx, *pBnIdx);
704 704 break;
705 pFilter->iLumaQP = iCurQp;705 }
706 if (iAlpha | iBeta) {706 }
707 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {707 }
708 pFilter->pLoopf->pfLumaDeblockingLT4Ver (&pDestY[ (1 << 2)*iLineSize], iLineSize, iAlpha, iBeta, iTc);708 pBIdx++;
709 }709 pBnIdx++;
710 710 }
711 pFilter->pLoopf->pfLumaDeblockingLT4Ver (&pDestY[ (2 << 2)*iLineSize], iLineSize, iAlpha, iBeta, iTc);711 }
712 712
713 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {713 return uiBSx4;
714 pFilter->pLoopf->pfLumaDeblockingLT4Ver (&pDestY[ (3 << 2)*iLineSize], iLineSize, iAlpha, iBeta, iTc);714}
715 }715int32_t DeblockingAvailableNoInterlayer (PDqLayer pCurDqLayer, int32_t iFilterIdc) {
716 }716 int32_t iMbY = pCurDqLayer->iMbY;
717}717 int32_t iMbX = pCurDqLayer->iMbX;
718void FilteringEdgeChromaHV (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {718 int32_t iMbXy = pCurDqLayer->iMbXyIndex;
719 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;719 bool bLeftFlag = false;
720 int32_t iMbX = pCurDqLayer->iMbX;720 bool bTopFlag = false;
721 int32_t iMbY = pCurDqLayer->iMbY;721
722 int32_t iMbWidth = pCurDqLayer->iMbWidth;722 if (2 == iFilterIdc) {
723 int32_t iLineSize = pFilter->iCsStride[1];723 bLeftFlag = (iMbX > 0) && (pCurDqLayer->pSliceIdc[iMbXy] == pCurDqLayer->pSliceIdc[iMbXy - 1]);
724 724 bTopFlag = (iMbY > 0) && (pCurDqLayer->pSliceIdc[iMbXy] == pCurDqLayer->pSliceIdc[iMbXy - pCurDqLayer->iMbWidth]);
725 uint8_t* pDestCb;725 } else { //if ( 0 == iFilterIdc )
726 uint8_t* pDestCr;726 bLeftFlag = (iMbX > 0);
727 //int32_t iCurQp;727 bTopFlag = (iMbY > 0);
728 int8_t* pCurQp;728 }
729 int32_t iIndexA, iAlpha, iBeta;729 return (bLeftFlag << LEFT_FLAG_BIT) | (bTopFlag << TOP_FLAG_BIT);
730 730}
731 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);731
732 ENFORCE_STACK_ALIGN_1D (uint8_t, uiBSx4, 4, 4);732void FilteringEdgeLumaH (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {
733 733 int32_t iIndexA;
734 pDestCb = pFilter->pCsData[1] + ((iMbY * iLineSize + iMbX) << 3);734 int32_t iAlpha;
735 pDestCr = pFilter->pCsData[2] + ((iMbY * iLineSize + iMbX) << 3);735 int32_t iBeta;
736 pCurQp = pCurDqLayer->pChromaQp[iMbXyIndex];736 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);
737 737
738 * (uint32_t*)uiBSx4 = 0x03030303;738 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
739 739 iBeta);
740 740
741// chroma v741 if (iAlpha | iBeta) {
742 if (iBoundryFlag & LEFT_FLAG_MASK) {742 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 0);
743 743 pFilter->pLoopf->pfLumaDeblockingLT4Ver (pPix, iStride, iAlpha, iBeta, tc);
744 for (int i = 0; i < 2; i++) {744 }
745 pFilter->iChromaQP[i] = (pCurQp[i] + pCurDqLayer->pChromaQp[iMbXyIndex - 1][i] + 1) >> 1;745 return;
746 746}
747 }747
748 FilteringEdgeChromaIntraV (pFilter, pDestCb, pDestCr, iLineSize, NULL);748
749 }749void FilteringEdgeLumaV (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {
750 750 int32_t iIndexA;
751 pFilter->iChromaQP[0] = pCurQp[0];751 int32_t iAlpha;
752 pFilter->iChromaQP[1] = pCurQp[1];752 int32_t iBeta;
753 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {753 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);
754 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,754
755 iBeta);755 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
756 if (iAlpha | iBeta) {756 iBeta);
757 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);757
758 pFilter->pLoopf->pfChromaDeblockingLT4Hor (&pDestCb[2 << 1], &pDestCr[2 << 1], iLineSize, iAlpha, iBeta, iTc);758 if (iAlpha | iBeta) {
759 }759 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 0);
760 } else {760 pFilter->pLoopf->pfLumaDeblockingLT4Hor (pPix, iStride, iAlpha, iBeta, tc);
761 761 }
762 for (int i = 0; i < 2; i++) {762 return;
763 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,763}
764 iBeta);764
765 if (iAlpha | iBeta) {765
766 uint8_t* pDestCbCr = (i == 0) ? &pDestCb[2 << 1] : &pDestCr[2 << 1];766void FilteringEdgeLumaIntraH (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {
767 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);767 int32_t iIndexA;
768 pFilter->pLoopf->pfChromaDeblockingLT4Hor2 (pDestCbCr, iLineSize, iAlpha, iBeta, iTc);768 int32_t iAlpha;
769 }769 int32_t iBeta;
770 770
771 }771 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
772 }772 iBeta);
773 773
774 // chroma h774 if (iAlpha | iBeta) {
775 775 pFilter->pLoopf->pfLumaDeblockingEQ4Ver (pPix, iStride, iAlpha, iBeta);
776 if (iBoundryFlag & TOP_FLAG_MASK) {776 }
777 for (int i = 0; i < 2; i++) {777 return;
778 pFilter->iChromaQP[i] = (pCurQp[i] + pCurDqLayer->pChromaQp[iMbXyIndex - iMbWidth][i] + 1) >> 1;778}
779 }779
780 FilteringEdgeChromaIntraH (pFilter, pDestCb, pDestCr, iLineSize, NULL);780void FilteringEdgeLumaIntraV (SDeblockingFilter* pFilter, uint8_t* pPix, int32_t iStride, uint8_t* pBS) {
781 }781 int32_t iIndexA;
782 782 int32_t iAlpha;
783 pFilter->iChromaQP[0] = pCurQp[0];783 int32_t iBeta;
784 pFilter->iChromaQP[1] = pCurQp[1];784
785 785 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
786 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {786 iBeta);
787 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,787
788 iBeta);788 if (iAlpha | iBeta) {
789 if (iAlpha | iBeta) {789 pFilter->pLoopf->pfLumaDeblockingEQ4Hor (pPix, iStride, iAlpha, iBeta);
790 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);790 }
791 pFilter->pLoopf->pfChromaDeblockingLT4Ver (&pDestCb[ (2 << 1)*iLineSize], &pDestCr[ (2 << 1)*iLineSize], iLineSize,791 return;
792 iAlpha, iBeta, iTc);792}
793 }793void FilteringEdgeChromaH (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,
794 } else {794 uint8_t* pBS) {
795 for (int i = 0; i < 2; i++) {795 int32_t iIndexA;
796 796 int32_t iAlpha;
797 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,797 int32_t iBeta;
798 iBeta);798 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);
799 if (iAlpha | iBeta) {799 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {
800 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);800
801 uint8_t* pDestCbCr = (i == 0) ? &pDestCb[ (2 << 1) * iLineSize] : &pDestCr[ (2 << 1) * iLineSize];801 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
802 pFilter->pLoopf->pfChromaDeblockingLT4Ver2 (pDestCbCr, iLineSize,802 iBeta);
803 iAlpha, iBeta, iTc);803
804 }804 if (iAlpha | iBeta) {
805 }805 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);
806 806 pFilter->pLoopf->pfChromaDeblockingLT4Ver (pPixCb, pPixCr, iStride, iAlpha, iBeta, tc);
807 807 }
808 }808 } else {
809}809
810 810 for (int i = 0; i < 2; i++) {
811// merge h&v lookup table operation to save performance811
812void DeblockingIntraMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {812
813 FilteringEdgeLumaHV (pCurDqLayer, pFilter, iBoundryFlag);813 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
814 FilteringEdgeChromaHV (pCurDqLayer, pFilter, iBoundryFlag);814 iBeta);
815}815
816 816 if (iAlpha | iBeta) {
817void WelsDeblockingMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {817 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;
818 uint8_t nBS[2][4][4] = {{{ 0 }}};818 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);
819 819 pFilter->pLoopf->pfChromaDeblockingLT4Ver2 (pPixCbCr, iStride, iAlpha, iBeta, tc);
820 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;820 }
821 int32_t iCurMbType = pCurDqLayer->pMbType[iMbXyIndex];821
822 int32_t iMbNb;822
823 823
824 switch (iCurMbType) {824 }
825 case MB_TYPE_INTRA4x4:825
826 case MB_TYPE_INTRA8x8:826 }
827 case MB_TYPE_INTRA16x16:827 return;
828 case MB_TYPE_INTRA_PCM:828}
829 DeblockingIntraMb (pCurDqLayer, pFilter, iBoundryFlag);829void FilteringEdgeChromaV (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,
830 break;830 uint8_t* pBS) {
831 default:831 int32_t iIndexA;
832 832 int32_t iAlpha;
833 if (iBoundryFlag & LEFT_FLAG_MASK) {833 int32_t iBeta;
834 iMbNb = iMbXyIndex - 1;834 ENFORCE_STACK_ALIGN_1D (int8_t, tc, 4, 16);
835 * (uint32_t*)nBS[0][0] = IS_INTRA (pCurDqLayer->pMbType[iMbNb]) ? 0x04040404 : DeblockingBsMarginalMBAvcbase (835 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {
836 pCurDqLayer, 0, iMbNb, iMbXyIndex);836
837 } else {837
838 * (uint32_t*)nBS[0][0] = 0;838 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
839 }839 iBeta);
840 if (iBoundryFlag & TOP_FLAG_MASK) {840
841 iMbNb = iMbXyIndex - pCurDqLayer->iMbWidth;841 if (iAlpha | iBeta) {
842 * (uint32_t*)nBS[1][0] = IS_INTRA (pCurDqLayer->pMbType[iMbNb]) ? 0x04040404 : DeblockingBsMarginalMBAvcbase (842 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);
843 pCurDqLayer, 1, iMbNb, iMbXyIndex);843 pFilter->pLoopf->pfChromaDeblockingLT4Hor (pPixCb, pPixCr, iStride, iAlpha, iBeta, tc);
844 } else {844 }
845 * (uint32_t*)nBS[1][0] = 0;845
846 }846
847 //SKIP MB_16x16 or others847 } else {
848 if (iCurMbType != MB_TYPE_SKIP) {848
849 if (iCurMbType == MB_TYPE_16x16) {849 for (int i = 0; i < 2; i++) {
850 if (!pCurDqLayer->pTransformSize8x8Flag[pCurDqLayer->iMbXyIndex]) {850
851 DeblockingBSInsideMBAvsbase (pCurDqLayer->pNzc[iMbXyIndex], nBS, 1);851 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
852 } else {852 iBeta);
853 DeblockingBSInsideMBAvsbase8x8 (pCurDqLayer->pNzc[iMbXyIndex], nBS, 1);853
854 }854 if (iAlpha | iBeta) {
855 } else {855 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;
856 DeblockingBSInsideMBNormal (pCurDqLayer, nBS, pCurDqLayer->pNzc[iMbXyIndex], iMbXyIndex);856 TC0_TBL_LOOKUP (tc, iIndexA, pBS, 1);
857 }857 pFilter->pLoopf->pfChromaDeblockingLT4Hor2 (pPixCbCr, iStride, iAlpha, iBeta, tc);
858 } else {858 }
859 * (uint32_t*)nBS[0][1] = * (uint32_t*)nBS[0][2] = * (uint32_t*)nBS[0][3] =859
860 * (uint32_t*)nBS[1][1] = * (uint32_t*)nBS[1][2] = * (uint32_t*)nBS[1][3] = 0;860
861 }861 }
862 DeblockingInterMb (pCurDqLayer, pFilter, nBS, iBoundryFlag);862 }
863 break;863 return;
864 }864}
865}865
866 866void FilteringEdgeChromaIntraH (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,
867/*!867 uint8_t* pBS) {
868 * \brief AVC slice deblocking filtering target layer868 int32_t iIndexA;
869 *869 int32_t iAlpha;
870 * \param dec Wels avc decoder context870 int32_t iBeta;
871 *871 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {
872 * \return NONE872
873 */873 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
874void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFunc pDeblockMb) {874 iBeta);
875 PDqLayer pCurDqLayer = pCtx->pCurDqLayer;875
876 PSliceHeaderExt pSliceHeaderExt = &pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt;876 if (iAlpha | iBeta) {
877 int32_t iMbWidth = pCurDqLayer->iMbWidth;877 pFilter->pLoopf->pfChromaDeblockingEQ4Ver (pPixCb, pPixCr, iStride, iAlpha, iBeta);
878 int32_t iTotalMbCount = pSliceHeaderExt->sSliceHeader.pSps->uiTotalMbCount;878 }
879 879 } else {
880 SDeblockingFilter pFilter;880
881 memset (&pFilter, 0, sizeof (pFilter));881 for (int i = 0; i < 2; i++) {
882 PFmo pFmo = pCtx->pFmo;882
883 int32_t iNextMbXyIndex = 0;883 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
884 int32_t iTotalNumMb = pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice;884 iBeta);
885 int32_t iCountNumMb = 0;885
886 int32_t iBoundryFlag;886 if (iAlpha | iBeta) {
887 int32_t iFilterIdc = pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.uiDisableDeblockingFilterIdc;887 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;
888 888 pFilter->pLoopf->pfChromaDeblockingEQ4Ver2 (pPixCbCr, iStride, iAlpha, iBeta);
889 /* Step1: parameters set */889 }
890 pFilter.pCsData[0] = pCtx->pDec->pData[0];890
891 pFilter.pCsData[1] = pCtx->pDec->pData[1];891 }
892 pFilter.pCsData[2] = pCtx->pDec->pData[2];892 }
893 893 return;
894 pFilter.iCsStride[0] = pCtx->pDec->iLinesize[0];894}
895 pFilter.iCsStride[1] = pCtx->pDec->iLinesize[1];895
896 896void FilteringEdgeChromaIntraV (SDeblockingFilter* pFilter, uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride,
897 pFilter.eSliceType = (EWelsSliceType) pCurDqLayer->sLayerInfo.sSliceInLayer.eSliceType;897 uint8_t* pBS) {
898 898 int32_t iIndexA;
899 pFilter.iSliceAlphaC0Offset = pSliceHeaderExt->sSliceHeader.iSliceAlphaC0Offset;899 int32_t iAlpha;
900 pFilter.iSliceBetaOffset = pSliceHeaderExt->sSliceHeader.iSliceBetaOffset;900 int32_t iBeta;
901 901 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) { // QP of cb and cr are the same
902 pFilter.pLoopf = &pCtx->sDeblockingFunc;902
903 903
904 /* Step2: macroblock deblocking */904
905 if (0 == iFilterIdc || 2 == iFilterIdc) {905
906 iNextMbXyIndex = pSliceHeaderExt->sSliceHeader.iFirstMbInSlice;906 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
907 pCurDqLayer->iMbX = iNextMbXyIndex % iMbWidth;907 iBeta);
908 pCurDqLayer->iMbY = iNextMbXyIndex / iMbWidth;908 if (iAlpha | iBeta) {
909 pCurDqLayer->iMbXyIndex = iNextMbXyIndex;909 pFilter->pLoopf->pfChromaDeblockingEQ4Hor (pPixCb, pPixCr, iStride, iAlpha, iBeta);
910 910 }
911 do {911 } else {
912 iBoundryFlag = DeblockingAvailableNoInterlayer (pCurDqLayer, iFilterIdc);912
913 913 for (int i = 0; i < 2; i++) {
914 pDeblockMb (pCurDqLayer, &pFilter, iBoundryFlag);914
915 915
916 ++iCountNumMb;916 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
917 if (iCountNumMb >= iTotalNumMb) {917 iBeta);
918 break;918 if (iAlpha | iBeta) {
919 }919 uint8_t* pPixCbCr = (i == 0) ? pPixCb : pPixCr;
920 920 pFilter->pLoopf->pfChromaDeblockingEQ4Hor2 (pPixCbCr, iStride, iAlpha, iBeta);
921 if (pSliceHeaderExt->sSliceHeader.pPps->uiNumSliceGroups > 1) {921 }
922 iNextMbXyIndex = FmoNextMb (pFmo, iNextMbXyIndex);922 }
923 } else {923
924 ++iNextMbXyIndex;924 }
925 }925 return;
926 if (-1 == iNextMbXyIndex || iNextMbXyIndex >= iTotalMbCount) { // slice group boundary or end of a frame926}
927 break;927
928 }928
929 929void DeblockingInterMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, uint8_t nBS[2][4][4],
930 pCurDqLayer->iMbX = iNextMbXyIndex % iMbWidth;930 int32_t iBoundryFlag) {
931 pCurDqLayer->iMbY = iNextMbXyIndex / iMbWidth;931 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;
932 pCurDqLayer->iMbXyIndex = iNextMbXyIndex;932 int32_t iMbX = pCurDqLayer->iMbX;
933 } while (1);933 int32_t iMbY = pCurDqLayer->iMbY;
934 }934
935}935 int32_t iCurLumaQp = pCurDqLayer->pLumaQp[iMbXyIndex];
936/*!936 //int32_t* iCurChromaQp = pCurDqLayer->pChromaQp[iMbXyIndex];
937 * \brief deblocking module initialize937 int8_t* pCurChromaQp = pCurDqLayer->pChromaQp[iMbXyIndex];
938 *938 int32_t iLineSize = pFilter->iCsStride[0];
939 * \param pf939 int32_t iLineSizeUV = pFilter->iCsStride[1];
940 * cpu940
941 *941 uint8_t* pDestY, * pDestCb, * pDestCr;
942 * \return NONE942 pDestY = pFilter->pCsData[0] + ((iMbY * iLineSize + iMbX) << 4);
943 */943 pDestCb = pFilter->pCsData[1] + ((iMbY * iLineSizeUV + iMbX) << 3);
944 944 pDestCr = pFilter->pCsData[2] + ((iMbY * iLineSizeUV + iMbX) << 3);
945void DeblockingInit (SDeblockingFunc* pFunc, int32_t iCpu) {945
946 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_c;946//Vertical margrin
947 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_c;947 if (iBoundryFlag & LEFT_FLAG_MASK) {
948 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_c;948 int32_t iLeftXyIndex = iMbXyIndex - 1;
949 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_c;949 pFilter->iLumaQP = (iCurLumaQp + pCurDqLayer->pLumaQp[iLeftXyIndex] + 1) >> 1;
950 950 for (int i = 0; i < 2; i++) {
951 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_c;951 pFilter->iChromaQP[i] = (pCurChromaQp[i] + pCurDqLayer->pChromaQp[iLeftXyIndex][i] + 1) >> 1;
952 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_c;952 }
953 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_c;953 if (nBS[0][0][0] == 0x04) {
954 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_c;954 FilteringEdgeLumaIntraV (pFilter, pDestY, iLineSize, NULL);
955 955 FilteringEdgeChromaIntraV (pFilter, pDestCb, pDestCr, iLineSizeUV, NULL);
956 pFunc->pfChromaDeblockingLT4Ver2 = DeblockChromaLt4V2_c;956 } else {
957 pFunc->pfChromaDeblockingEQ4Ver2 = DeblockChromaEq4V2_c;957 if (* (uint32_t*)nBS[0][0] != 0) {
958 pFunc->pfChromaDeblockingLT4Hor2 = DeblockChromaLt4H2_c;958 FilteringEdgeLumaV (pFilter, pDestY, iLineSize, nBS[0][0]);
959 pFunc->pfChromaDeblockingEQ4Hor2 = DeblockChromaEq4H2_c;959 FilteringEdgeChromaV (pFilter, pDestCb, pDestCr, iLineSizeUV, nBS[0][0]);
960 960 }
961#ifdef X86_ASM961 }
962 if (iCpu & WELS_CPU_SSSE3) {962 }
963 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_ssse3;963
964 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_ssse3;964 pFilter->iLumaQP = iCurLumaQp;
965 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_ssse3;965 pFilter->iChromaQP[0] = pCurChromaQp[0];
966 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_ssse3;966 pFilter->iChromaQP[1] = pCurChromaQp[1];
967 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_ssse3;967
968 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_ssse3;968 if (* (uint32_t*)nBS[0][1] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
969 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_ssse3;969 FilteringEdgeLumaV (pFilter, &pDestY[1 << 2], iLineSize, nBS[0][1]);
970 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_ssse3;970 }
971 }971
972#endif972 if (* (uint32_t*)nBS[0][2] != 0) {
973 973 FilteringEdgeLumaV (pFilter, &pDestY[2 << 2], iLineSize, nBS[0][2]);
974#if defined(HAVE_NEON)974 FilteringEdgeChromaV (pFilter, &pDestCb[2 << 1], &pDestCr[2 << 1], iLineSizeUV, nBS[0][2]);
975 if (iCpu & WELS_CPU_NEON) {975 }
976 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_neon;976
977 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_neon;977 if (* (uint32_t*)nBS[0][3] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
978 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_neon;978 FilteringEdgeLumaV (pFilter, &pDestY[3 << 2], iLineSize, nBS[0][3]);
979 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_neon;979 }
980 980
981 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_neon;981 if (iBoundryFlag & TOP_FLAG_MASK) {
982 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_neon;982 int32_t iTopXyIndex = iMbXyIndex - pCurDqLayer->iMbWidth;
983 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_neon;983 pFilter->iLumaQP = (iCurLumaQp + pCurDqLayer->pLumaQp[iTopXyIndex] + 1) >> 1;
984 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_neon;984 for (int i = 0; i < 2; i++) {
985 }985 pFilter->iChromaQP[i] = (pCurChromaQp[i] + pCurDqLayer->pChromaQp[iTopXyIndex][i] + 1) >> 1;
986#endif986 }
987 987
988#if defined(HAVE_NEON_AARCH64)988 if (nBS[1][0][0] == 0x04) {
989 if (iCpu & WELS_CPU_NEON) {989 FilteringEdgeLumaIntraH (pFilter, pDestY, iLineSize, NULL);
990 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_AArch64_neon;990 FilteringEdgeChromaIntraH (pFilter, pDestCb, pDestCr, iLineSizeUV, NULL);
991 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_AArch64_neon;991 } else {
992 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_AArch64_neon;992 if (* (uint32_t*)nBS[1][0] != 0) {
993 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_AArch64_neon;993 FilteringEdgeLumaH (pFilter, pDestY, iLineSize, nBS[1][0]);
994 994 FilteringEdgeChromaH (pFilter, pDestCb, pDestCr, iLineSizeUV, nBS[1][0]);
995 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_AArch64_neon;995 }
996 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_AArch64_neon;996 }
997 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_AArch64_neon;997 }
998 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_AArch64_neon;998
999 }999 pFilter->iLumaQP = iCurLumaQp;
1000#endif1000 pFilter->iChromaQP[0] = pCurChromaQp[0];
1001}1001 pFilter->iChromaQP[1] = pCurChromaQp[1];
1002 1002
1003} // namespace WelsDec1003 if (* (uint32_t*)nBS[1][1] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
1004 FilteringEdgeLumaH (pFilter, &pDestY[ (1 << 2)*iLineSize], iLineSize, nBS[1][1]);
1005 }
1006
1007 if (* (uint32_t*)nBS[1][2] != 0) {
1008 FilteringEdgeLumaH (pFilter, &pDestY[ (2 << 2)*iLineSize], iLineSize, nBS[1][2]);
1009 FilteringEdgeChromaH (pFilter, &pDestCb[ (2 << 1)*iLineSizeUV], &pDestCr[ (2 << 1)*iLineSizeUV], iLineSizeUV,
1010 nBS[1][2]);
1011 }
1012
1013 if (* (uint32_t*)nBS[1][3] != 0 && !pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
1014 FilteringEdgeLumaH (pFilter, &pDestY[ (3 << 2)*iLineSize], iLineSize, nBS[1][3]);
1015 }
1016}
1017
1018void FilteringEdgeLumaHV (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {
1019 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;
1020 int32_t iMbX = pCurDqLayer->iMbX;
1021 int32_t iMbY = pCurDqLayer->iMbY;
1022 int32_t iMbWidth = pCurDqLayer->iMbWidth;
1023 int32_t iLineSize = pFilter->iCsStride[0];
1024
1025 uint8_t* pDestY;
1026 int32_t iCurQp;
1027 int32_t iIndexA, iAlpha, iBeta;
1028
1029 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);
1030 ENFORCE_STACK_ALIGN_1D (uint8_t, uiBSx4, 4, 4);
1031
1032 pDestY = pFilter->pCsData[0] + ((iMbY * iLineSize + iMbX) << 4);
1033 iCurQp = pCurDqLayer->pLumaQp[iMbXyIndex];
1034
1035 * (uint32_t*)uiBSx4 = 0x03030303;
1036
1037 // luma v
1038 if (iBoundryFlag & LEFT_FLAG_MASK) {
1039 pFilter->iLumaQP = (iCurQp + pCurDqLayer->pLumaQp[iMbXyIndex - 1] + 1) >> 1;
1040 FilteringEdgeLumaIntraV (pFilter, pDestY, iLineSize, NULL);
1041 }
1042
1043 pFilter->iLumaQP = iCurQp;
1044 GET_ALPHA_BETA_FROM_QP (pFilter->iLumaQP, pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
1045 iBeta);
1046 if (iAlpha | iBeta) {
1047 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 0);
1048
1049 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
1050 pFilter->pLoopf->pfLumaDeblockingLT4Hor (&pDestY[1 << 2], iLineSize, iAlpha, iBeta, iTc);
1051 }
1052
1053 pFilter->pLoopf->pfLumaDeblockingLT4Hor (&pDestY[2 << 2], iLineSize, iAlpha, iBeta, iTc);
1054
1055 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
1056 pFilter->pLoopf->pfLumaDeblockingLT4Hor (&pDestY[3 << 2], iLineSize, iAlpha, iBeta, iTc);
1057 }
1058 }
1059
1060 // luma h
1061 if (iBoundryFlag & TOP_FLAG_MASK) {
1062 pFilter->iLumaQP = (iCurQp + pCurDqLayer->pLumaQp[iMbXyIndex - iMbWidth] + 1) >> 1;
1063 FilteringEdgeLumaIntraH (pFilter, pDestY, iLineSize, NULL);
1064 }
1065
1066 pFilter->iLumaQP = iCurQp;
1067 if (iAlpha | iBeta) {
1068 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
1069 pFilter->pLoopf->pfLumaDeblockingLT4Ver (&pDestY[ (1 << 2)*iLineSize], iLineSize, iAlpha, iBeta, iTc);
1070 }
1071
1072 pFilter->pLoopf->pfLumaDeblockingLT4Ver (&pDestY[ (2 << 2)*iLineSize], iLineSize, iAlpha, iBeta, iTc);
1073
1074 if (!pCurDqLayer->pTransformSize8x8Flag[iMbXyIndex]) {
1075 pFilter->pLoopf->pfLumaDeblockingLT4Ver (&pDestY[ (3 << 2)*iLineSize], iLineSize, iAlpha, iBeta, iTc);
1076 }
1077 }
1078}
1079void FilteringEdgeChromaHV (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {
1080 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;
1081 int32_t iMbX = pCurDqLayer->iMbX;
1082 int32_t iMbY = pCurDqLayer->iMbY;
1083 int32_t iMbWidth = pCurDqLayer->iMbWidth;
1084 int32_t iLineSize = pFilter->iCsStride[1];
1085
1086 uint8_t* pDestCb;
1087 uint8_t* pDestCr;
1088 //int32_t iCurQp;
1089 int8_t* pCurQp;
1090 int32_t iIndexA, iAlpha, iBeta;
1091
1092 ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16);
1093 ENFORCE_STACK_ALIGN_1D (uint8_t, uiBSx4, 4, 4);
1094
1095 pDestCb = pFilter->pCsData[1] + ((iMbY * iLineSize + iMbX) << 3);
1096 pDestCr = pFilter->pCsData[2] + ((iMbY * iLineSize + iMbX) << 3);
1097 pCurQp = pCurDqLayer->pChromaQp[iMbXyIndex];
1098
1099 * (uint32_t*)uiBSx4 = 0x03030303;
1100
1101
1102// chroma v
1103 if (iBoundryFlag & LEFT_FLAG_MASK) {
1104
1105 for (int i = 0; i < 2; i++) {
1106 pFilter->iChromaQP[i] = (pCurQp[i] + pCurDqLayer->pChromaQp[iMbXyIndex - 1][i] + 1) >> 1;
1107
1108 }
1109 FilteringEdgeChromaIntraV (pFilter, pDestCb, pDestCr, iLineSize, NULL);
1110 }
1111
1112 pFilter->iChromaQP[0] = pCurQp[0];
1113 pFilter->iChromaQP[1] = pCurQp[1];
1114 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {
1115 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
1116 iBeta);
1117 if (iAlpha | iBeta) {
1118 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);
1119 pFilter->pLoopf->pfChromaDeblockingLT4Hor (&pDestCb[2 << 1], &pDestCr[2 << 1], iLineSize, iAlpha, iBeta, iTc);
1120 }
1121 } else {
1122
1123 for (int i = 0; i < 2; i++) {
1124 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
1125 iBeta);
1126 if (iAlpha | iBeta) {
1127 uint8_t* pDestCbCr = (i == 0) ? &pDestCb[2 << 1] : &pDestCr[2 << 1];
1128 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);
1129 pFilter->pLoopf->pfChromaDeblockingLT4Hor2 (pDestCbCr, iLineSize, iAlpha, iBeta, iTc);
1130 }
1131
1132 }
1133 }
1134
1135 // chroma h
1136
1137 if (iBoundryFlag & TOP_FLAG_MASK) {
1138 for (int i = 0; i < 2; i++) {
1139 pFilter->iChromaQP[i] = (pCurQp[i] + pCurDqLayer->pChromaQp[iMbXyIndex - iMbWidth][i] + 1) >> 1;
1140 }
1141 FilteringEdgeChromaIntraH (pFilter, pDestCb, pDestCr, iLineSize, NULL);
1142 }
1143
1144 pFilter->iChromaQP[0] = pCurQp[0];
1145 pFilter->iChromaQP[1] = pCurQp[1];
1146
1147 if (pFilter->iChromaQP[0] == pFilter->iChromaQP[1]) {
1148 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[0], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
1149 iBeta);
1150 if (iAlpha | iBeta) {
1151 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);
1152 pFilter->pLoopf->pfChromaDeblockingLT4Ver (&pDestCb[ (2 << 1)*iLineSize], &pDestCr[ (2 << 1)*iLineSize], iLineSize,
1153 iAlpha, iBeta, iTc);
1154 }
1155 } else {
1156 for (int i = 0; i < 2; i++) {
1157
1158 GET_ALPHA_BETA_FROM_QP (pFilter->iChromaQP[i], pFilter->iSliceAlphaC0Offset, pFilter->iSliceBetaOffset, iIndexA, iAlpha,
1159 iBeta);
1160 if (iAlpha | iBeta) {
1161 TC0_TBL_LOOKUP (iTc, iIndexA, uiBSx4, 1);
1162 uint8_t* pDestCbCr = (i == 0) ? &pDestCb[ (2 << 1) * iLineSize] : &pDestCr[ (2 << 1) * iLineSize];
1163 pFilter->pLoopf->pfChromaDeblockingLT4Ver2 (pDestCbCr, iLineSize,
1164 iAlpha, iBeta, iTc);
1165 }
1166 }
1167
1168
1169 }
1170}
1171
1172// merge h&v lookup table operation to save performance
1173void DeblockingIntraMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {
1174 FilteringEdgeLumaHV (pCurDqLayer, pFilter, iBoundryFlag);
1175 FilteringEdgeChromaHV (pCurDqLayer, pFilter, iBoundryFlag);
1176}
1177
1178void WelsDeblockingMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_t iBoundryFlag) {
1179 uint8_t nBS[2][4][4] = {{{ 0 }}};
1180
1181 int32_t iMbXyIndex = pCurDqLayer->iMbXyIndex;
1182 uint32_t iCurMbType = pCurDqLayer->pMbType[iMbXyIndex];
1183 int32_t iMbNb;
1184
1185 PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer;
1186 PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
1187 bool bBSlice = pSliceHeader->eSliceType == B_SLICE;
1188
1189 switch (iCurMbType) {
1190 case MB_TYPE_INTRA4x4:
1191 case MB_TYPE_INTRA8x8:
1192 case MB_TYPE_INTRA16x16:
1193 case MB_TYPE_INTRA_PCM:
1194 DeblockingIntraMb (pCurDqLayer, pFilter, iBoundryFlag);
1195 break;
1196 default:
1197
1198 if (iBoundryFlag & LEFT_FLAG_MASK) {
1199 iMbNb = iMbXyIndex - 1;
1200 if (bBSlice) {
1201 * (uint32_t*)nBS[0][0] = IS_INTRA (pCurDqLayer->pMbType[iMbNb]) ? 0x04040404 : DeblockingBSliceBsMarginalMBAvcbase (
1202 pCurDqLayer, 0, iMbNb, iMbXyIndex);
1203 } else {
1204 * (uint32_t*)nBS[0][0] = IS_INTRA (pCurDqLayer->pMbType[iMbNb]) ? 0x04040404 : DeblockingBsMarginalMBAvcbase (
1205 pCurDqLayer, 0, iMbNb, iMbXyIndex);
1206 }
1207 } else {
1208 * (uint32_t*)nBS[0][0] = 0;
1209 }
1210 if (iBoundryFlag & TOP_FLAG_MASK) {
1211 iMbNb = iMbXyIndex - pCurDqLayer->iMbWidth;
1212 if (bBSlice) {
1213 * (uint32_t*)nBS[1][0] = IS_INTRA (pCurDqLayer->pMbType[iMbNb]) ? 0x04040404 : DeblockingBSliceBsMarginalMBAvcbase (
1214 pCurDqLayer, 1, iMbNb, iMbXyIndex);
1215 } else {
1216 * (uint32_t*)nBS[1][0] = IS_INTRA (pCurDqLayer->pMbType[iMbNb]) ? 0x04040404 : DeblockingBsMarginalMBAvcbase (
1217 pCurDqLayer, 1, iMbNb, iMbXyIndex);
1218 }
1219 } else {
1220 * (uint32_t*)nBS[1][0] = 0;
1221 }
1222 //SKIP MB_16x16 or others
1223 if (IS_SKIP (iCurMbType)) {
1224 * (uint32_t*)nBS[0][1] = * (uint32_t*)nBS[0][2] = * (uint32_t*)nBS[0][3] =
1225 * (uint32_t*)nBS[1][1] = * (uint32_t*)nBS[1][2] = * (uint32_t*)nBS[1][3] = 0;
1226 } else {
1227 if (IS_INTER_16x16 (iCurMbType)) {
1228 if (!pCurDqLayer->pTransformSize8x8Flag[pCurDqLayer->iMbXyIndex]) {
1229 DeblockingBSInsideMBAvsbase (pCurDqLayer->pNzc[iMbXyIndex], nBS, 1);
1230 } else {
1231 DeblockingBSInsideMBAvsbase8x8 (pCurDqLayer->pNzc[iMbXyIndex], nBS, 1);
1232 }
1233 } else {
1234
1235 if (bBSlice) {
1236 DeblockingBSliceBSInsideMBNormal (pCurDqLayer, nBS, pCurDqLayer->pNzc[iMbXyIndex], iMbXyIndex);
1237 } else {
1238 DeblockingBSInsideMBNormal (pCurDqLayer, nBS, pCurDqLayer->pNzc[iMbXyIndex], iMbXyIndex);
1239 }
1240 }
1241 }
1242 DeblockingInterMb (pCurDqLayer, pFilter, nBS, iBoundryFlag);
1243 break;
1244 }
1245}
1246
1247/*!
1248 * \brief AVC slice deblocking filtering target layer
1249 *
1250 * \param dec Wels avc decoder context
1251 *
1252 * \return NONE
1253 */
1254void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFunc pDeblockMb) {
1255 PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
1256 PSliceHeaderExt pSliceHeaderExt = &pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt;
1257 int32_t iMbWidth = pCurDqLayer->iMbWidth;
1258 int32_t iTotalMbCount = pSliceHeaderExt->sSliceHeader.pSps->uiTotalMbCount;
1259
1260 SDeblockingFilter pFilter;
1261 memset (&pFilter, 0, sizeof (pFilter));
1262 PFmo pFmo = pCtx->pFmo;
1263 int32_t iNextMbXyIndex = 0;
1264 int32_t iTotalNumMb = pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice;
1265 int32_t iCountNumMb = 0;
1266 int32_t iBoundryFlag;
1267 int32_t iFilterIdc = pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.uiDisableDeblockingFilterIdc;
1268
1269 /* Step1: parameters set */
1270 pFilter.pCsData[0] = pCtx->pDec->pData[0];
1271 pFilter.pCsData[1] = pCtx->pDec->pData[1];
1272 pFilter.pCsData[2] = pCtx->pDec->pData[2];
1273
1274 pFilter.iCsStride[0] = pCtx->pDec->iLinesize[0];
1275 pFilter.iCsStride[1] = pCtx->pDec->iLinesize[1];
1276
1277 pFilter.eSliceType = (EWelsSliceType) pCurDqLayer->sLayerInfo.sSliceInLayer.eSliceType;
1278
1279 pFilter.iSliceAlphaC0Offset = pSliceHeaderExt->sSliceHeader.iSliceAlphaC0Offset;
1280 pFilter.iSliceBetaOffset = pSliceHeaderExt->sSliceHeader.iSliceBetaOffset;
1281
1282 pFilter.pLoopf = &pCtx->sDeblockingFunc;
1283
1284 /* Step2: macroblock deblocking */
1285 if (0 == iFilterIdc || 2 == iFilterIdc) {
1286 iNextMbXyIndex = pSliceHeaderExt->sSliceHeader.iFirstMbInSlice;
1287 pCurDqLayer->iMbX = iNextMbXyIndex % iMbWidth;
1288 pCurDqLayer->iMbY = iNextMbXyIndex / iMbWidth;
1289 pCurDqLayer->iMbXyIndex = iNextMbXyIndex;
1290
1291 do {
1292 iBoundryFlag = DeblockingAvailableNoInterlayer (pCurDqLayer, iFilterIdc);
1293
1294 pDeblockMb (pCurDqLayer, &pFilter, iBoundryFlag);
1295
1296 ++iCountNumMb;
1297 if (iCountNumMb >= iTotalNumMb) {
1298 break;
1299 }
1300
1301 if (pSliceHeaderExt->sSliceHeader.pPps->uiNumSliceGroups > 1) {
1302 iNextMbXyIndex = FmoNextMb (pFmo, iNextMbXyIndex);
1303 } else {
1304 ++iNextMbXyIndex;
1305 }
1306 if (-1 == iNextMbXyIndex || iNextMbXyIndex >= iTotalMbCount) { // slice group boundary or end of a frame
1307 break;
1308 }
1309
1310 pCurDqLayer->iMbX = iNextMbXyIndex % iMbWidth;
1311 pCurDqLayer->iMbY = iNextMbXyIndex / iMbWidth;
1312 pCurDqLayer->iMbXyIndex = iNextMbXyIndex;
1313 } while (1);
1314 }
1315}
1316/*!
1317 * \brief deblocking module initialize
1318 *
1319 * \param pf
1320 * cpu
1321 *
1322 * \return NONE
1323 */
1324
1325void DeblockingInit (SDeblockingFunc* pFunc, int32_t iCpu) {
1326 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_c;
1327 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_c;
1328 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_c;
1329 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_c;
1330
1331 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_c;
1332 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_c;
1333 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_c;
1334 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_c;
1335
1336 pFunc->pfChromaDeblockingLT4Ver2 = DeblockChromaLt4V2_c;
1337 pFunc->pfChromaDeblockingEQ4Ver2 = DeblockChromaEq4V2_c;
1338 pFunc->pfChromaDeblockingLT4Hor2 = DeblockChromaLt4H2_c;
1339 pFunc->pfChromaDeblockingEQ4Hor2 = DeblockChromaEq4H2_c;
1340
1341#ifdef X86_ASM
1342 if (iCpu & WELS_CPU_SSSE3) {
1343 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_ssse3;
1344 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_ssse3;
1345 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_ssse3;
1346 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_ssse3;
1347 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_ssse3;
1348 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_ssse3;
1349 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_ssse3;
1350 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_ssse3;
1351 }
1352#endif
1353
1354#if defined(HAVE_NEON)
1355 if (iCpu & WELS_CPU_NEON) {
1356 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_neon;
1357 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_neon;
1358 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_neon;
1359 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_neon;
1360
1361 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_neon;
1362 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_neon;
1363 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_neon;
1364 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_neon;
1365 }
1366#endif
1367
1368#if defined(HAVE_NEON_AARCH64)
1369 if (iCpu & WELS_CPU_NEON) {
1370 pFunc->pfLumaDeblockingLT4Ver = DeblockLumaLt4V_AArch64_neon;
1371 pFunc->pfLumaDeblockingEQ4Ver = DeblockLumaEq4V_AArch64_neon;
1372 pFunc->pfLumaDeblockingLT4Hor = DeblockLumaLt4H_AArch64_neon;
1373 pFunc->pfLumaDeblockingEQ4Hor = DeblockLumaEq4H_AArch64_neon;
1374
1375 pFunc->pfChromaDeblockingLT4Ver = DeblockChromaLt4V_AArch64_neon;
1376 pFunc->pfChromaDeblockingEQ4Ver = DeblockChromaEq4V_AArch64_neon;
1377 pFunc->pfChromaDeblockingLT4Hor = DeblockChromaLt4H_AArch64_neon;
1378 pFunc->pfChromaDeblockingEQ4Hor = DeblockChromaEq4H_AArch64_neon;
1379 }
1380#endif
1381}
1382
1383} // namespace WelsDec

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t