Showing the changes to test/decoder/DecUT_DeblockCommon.cpp (1 of 1 file). Show all
Unified · Split
| @@ -0,0 +1,396 @@ | ||
| 1 | +#include <gtest/gtest.h> | |
| 2 | + | |
| 3 | +#include "../../codec/decoder/core/inc/deblocking.h" | |
| 4 | +#include "../../codec/common/inc/deblocking_common.h" | |
| 5 | + | |
| 6 | +#define CLIP3(VALUE, MIN, MAX) ((VALUE) < (MIN) ? (MIN) : ((VALUE) > (MAX) ? (MAX) : (VALUE))) | |
| 7 | + | |
| 8 | +using namespace WelsDec; | |
| 9 | + | |
| 10 | +/* extern pure C functions */ | |
| 11 | +extern void DeblockLumaLt4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta, | |
| 12 | + int8_t* pTc); | |
| 13 | +extern void DeblockLumaEq4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta); | |
| 14 | +extern void DeblockChromaLt4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, | |
| 15 | + int32_t iBeta, int8_t* pTc); | |
| 16 | +extern void DeblockChromaEq4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, | |
| 17 | + int32_t iBeta); | |
| 18 | + | |
| 19 | +/* Macros body */ | |
| 20 | +#define GENERATE_DATA_DEBLOCKING(pBase, pRef, iWidth) \ | |
| 21 | +if (iNum==0) { \ | |
| 22 | + iAlpha = 255; \ | |
| 23 | + iBeta = 18; \ | |
| 24 | + iTc[0] = iTc[1] = iTc[2] = iTc[3] = 25; \ | |
| 25 | + pBase[0] = pRef[0] = 128; \ | |
| 26 | + for (int i = 1; i < iWidth*iWidth; i++) { \ | |
| 27 | + pBase[i] = pRef[i] = CLIP3(0, 255, pBase[i-1] -16 + rand()%32); \ | |
| 28 | + } \ | |
| 29 | +} else if (iNum==1) { \ | |
| 30 | + iAlpha = 4; \ | |
| 31 | + iBeta = 2; \ | |
| 32 | + iTc[0] = iTc[1] = iTc[2] = iTc[3] = 9; \ | |
| 33 | + pBase[0] = pRef[0] = 128; \ | |
| 34 | + for (int i = 1; i < iWidth*iWidth; i++) { \ | |
| 35 | + pBase[i] = pRef[i] = CLIP3(0, 255, pBase[i-1] -4 + rand()%8); \ | |
| 36 | + } \ | |
| 37 | +} else { \ | |
| 38 | + iAlpha = rand() % 256; \ | |
| 39 | + iBeta = rand() % 19; \ | |
| 40 | + for (int i=0; i<4; i++) { \ | |
| 41 | + iTc[i] = rand() % 26; \ | |
| 42 | + } \ | |
| 43 | + for (int i = 0; i < iWidth*iWidth; i++) { \ | |
| 44 | + pBase[i] = pRef[i] = rand() % 256; \ | |
| 45 | + } \ | |
| 46 | +} | |
| 47 | + | |
| 48 | +/* Anchor functions body, some directly from the current code */ | |
| 49 | +void anchor_DeblockingLumaNormal (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta, | |
| 50 | + int8_t* pTc) { | |
| 51 | + // void DeblockLumaLt4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta, int8_t* pTc) | |
| 52 | + // bS<4, Section 8.7.2.3 | |
| 53 | + | |
| 54 | + int32_t p[3]; | |
| 55 | + int32_t q[3]; | |
| 56 | + int32_t iTc; | |
| 57 | + int32_t iDelta; | |
| 58 | + int32_t iIndexTc; | |
| 59 | + for (int iLine = 0; iLine < 16; iLine++) { | |
| 60 | + iIndexTc = iLine >> 2; | |
| 61 | + | |
| 62 | + iTc = pTc[iIndexTc]; | |
| 63 | + for (int m = 0; m < 3; m++) { | |
| 64 | + p[m] = pPix[iStrideX * -1 * (m + 1)]; | |
| 65 | + q[m] = pPix[iStrideX * m]; | |
| 66 | + }// for | |
| 67 | + | |
| 68 | + // filterSampleFlag, 8-460 | |
| 69 | + if (abs (p[0] - q[0]) < iAlpha && abs (p[1] - p[0]) < iBeta && abs (q[1] - q[0]) < iBeta) { | |
| 70 | + // 8-470 | |
| 71 | + if (abs (p[2] - p[0]) < iBeta) { | |
| 72 | + pPix[iStrideX * -2] = p[1] + CLIP3 (((p[2] + ((p[0] + q[0] + 1) >> 1) - (p[1] << 1)) >> 1), -1 * pTc[iIndexTc], | |
| 73 | + pTc[iIndexTc]); | |
| 74 | + iTc++; | |
| 75 | + } | |
| 76 | + // 8-472 | |
| 77 | + if (abs (q[2] - q[0]) < iBeta) { | |
| 78 | + pPix[iStrideX * 1] = q[1] + CLIP3 (((q[2] + ((p[0] + q[0] + 1) >> 1) - (q[1] << 1)) >> 1), -1 * pTc[iIndexTc], | |
| 79 | + pTc[iIndexTc]); | |
| 80 | + iTc++; | |
| 81 | + } | |
| 82 | + // 8-467,468,469 | |
| 83 | + iDelta = CLIP3 (((((q[0] - p[0]) << 2) + (p[1] - q[1]) + 4) >> 3), -1 * iTc, iTc); | |
| 84 | + pPix[iStrideX * -1] = CLIP3 ((p[0] + iDelta), 0, 255); | |
| 85 | + pPix[0] = CLIP3 ((q[0] - iDelta), 0, 255); | |
| 86 | + } | |
| 87 | + | |
| 88 | + // Next line | |
| 89 | + pPix += iStrideY; | |
| 90 | + } | |
| 91 | +} | |
| 92 | + | |
| 93 | +void anchor_DeblockingLumaIntra (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta) { | |
| 94 | + // void DeblockLumaEq4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta) | |
| 95 | + // bS==4, Section 8.7.2.4 | |
| 96 | + | |
| 97 | + int32_t p[4], q[4]; | |
| 98 | + for (int iLine = 0; iLine < 16; iLine++) { | |
| 99 | + | |
| 100 | + for (int m = 0; m < 4; m++) { | |
| 101 | + p[m] = pPix[iStrideX * -1 * (m + 1)]; | |
| 102 | + q[m] = pPix[iStrideX * m]; | |
| 103 | + } | |
| 104 | + | |
| 105 | + // filterSampleFlag, 8-460 | |
| 106 | + if (abs (p[0] - q[0]) < iAlpha && abs (p[1] - p[0]) < iBeta && abs (q[1] - q[0]) < iBeta) { | |
| 107 | + | |
| 108 | + // 8-476 | |
| 109 | + if (abs (p[2] - p[0]) < iBeta && abs (p[0] - q[0]) < ((iAlpha >> 2) + 2)) { | |
| 110 | + // 8-477,478, 479 | |
| 111 | + pPix[iStrideX * -1] = (p[2] + 2 * p[1] + 2 * p[0] + 2 * q[0] + q[1] + 4) >> 3; | |
| 112 | + pPix[iStrideX * -2] = (p[2] + p[1] + p[0] + q[0] + 2) >> 2; | |
| 113 | + pPix[iStrideX * -3] = (2 * p[3] + 3 * p[2] + p[1] + p[0] + q[0] + 4) >> 3; | |
| 114 | + } else { | |
| 115 | + // 8-480 | |
| 116 | + pPix[iStrideX * -1] = (2 * p[1] + p[0] + q[1] + 2) >> 2; | |
| 117 | + } | |
| 118 | + | |
| 119 | + // 8-483 | |
| 120 | + if (abs (q[2] - q[0]) < iBeta && abs (p[0] - q[0]) < ((iAlpha >> 2) + 2)) { | |
| 121 | + // 8-484,485,486 | |
| 122 | + pPix[ 0 ] = (p[1] + 2 * p[0] + 2 * q[0] + 2 * q[1] + q[2] + 4) >> 3; | |
| 123 | + pPix[1 * iStrideX ] = (p[0] + q[0] + q[1] + q[2] + 2) >> 2; | |
| 124 | + pPix[2 * iStrideX ] = (2 * q[3] + 3 * q[2] + q[1] + q[0] + p[0] + 4) >> 3; | |
| 125 | + } else { | |
| 126 | + // 8-487 | |
| 127 | + pPix[0 * iStrideX ] = (2 * q[1] + q[0] + p[1] + 2) >> 2; | |
| 128 | + } | |
| 129 | + } | |
| 130 | + // Next line | |
| 131 | + pPix += iStrideY; | |
| 132 | + } | |
| 133 | +} | |
| 134 | + | |
| 135 | +void anchor_DeblockingChromaNormal (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, | |
| 136 | + int32_t iAlpha, int32_t iBeta, int8_t* pTc) { | |
| 137 | + // void DeblockChromaLt4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta, int8_t* pTc) | |
| 138 | + // Section 8.7.2.3 | |
| 139 | + int32_t p[2], q[2]; | |
| 140 | + int32_t iIndexTc; | |
| 141 | + int32_t iDelta; | |
| 142 | + int32_t iTc; | |
| 143 | + for (int iLine = 0; iLine < 8; iLine++) { | |
| 144 | + iIndexTc = iLine >> 1; | |
| 145 | + iTc = pTc[iIndexTc]; | |
| 146 | + /* for Cb */ | |
| 147 | + for (int m = 0; m < 2; m++) { | |
| 148 | + p[m] = pPixCb[iStrideX * -1 * (m + 1)]; | |
| 149 | + q[m] = pPixCb[iStrideX * m]; | |
| 150 | + } | |
| 151 | + | |
| 152 | + // filterSampleFlag, 8-460 | |
| 153 | + if (abs (p[0] - q[0]) < iAlpha && abs (p[1] - p[0]) < iBeta && abs (q[1] - q[0]) < iBeta) { | |
| 154 | + // 8-467, 468, 469 | |
| 155 | + iDelta = CLIP3 (((((q[0] - p[0]) << 2) + (p[1] - q[1]) + 4) >> 3), -1 * iTc, iTc); | |
| 156 | + pPixCb[iStrideX * -1] = CLIP3 ((p[0] + iDelta), 0, 255); | |
| 157 | + pPixCb[iStrideX * 0 ] = CLIP3 ((q[0] - iDelta), 0, 255); | |
| 158 | + } | |
| 159 | + pPixCb += iStrideY; | |
| 160 | + | |
| 161 | + /* for Cr */ | |
| 162 | + for (int m = 0; m < 2; m++) { | |
| 163 | + p[m] = pPixCr[iStrideX * -1 * (m + 1)]; | |
| 164 | + q[m] = pPixCr[iStrideX * m]; | |
| 165 | + } | |
| 166 | + | |
| 167 | + // filterSampleFlag, 8-460 | |
| 168 | + if (abs (p[0] - q[0]) < iAlpha && abs (p[1] - p[0]) < iBeta && abs (q[1] - q[0]) < iBeta) { | |
| 169 | + // 8-467, 468, 469 | |
| 170 | + iDelta = CLIP3 (((((q[0] - p[0]) << 2) + (p[1] - q[1]) + 4) >> 3), -1 * iTc, iTc); | |
| 171 | + pPixCr[iStrideX * -1] = CLIP3 ((p[0] + iDelta), 0, 255); | |
| 172 | + pPixCr[iStrideX * 0 ] = CLIP3 ((q[0] - iDelta), 0, 255); | |
| 173 | + } | |
| 174 | + pPixCr += iStrideY; | |
| 175 | + } | |
| 176 | +} | |
| 177 | + | |
| 178 | +void anchor_DeblockingChromaIntra (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, | |
| 179 | + int32_t iBeta) { | |
| 180 | + //void DeblockChromaEq4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta) | |
| 181 | + // Section 8.7.2.4 | |
| 182 | + int32_t p[2], q[2]; | |
| 183 | + | |
| 184 | + for (int iLine = 0; iLine < 8; iLine++) { | |
| 185 | + /* for Cb */ | |
| 186 | + for (int m = 0; m < 2; m++) { | |
| 187 | + p[m] = pPixCb[iStrideX * -1 * (m + 1)]; | |
| 188 | + q[m] = pPixCb[iStrideX * m]; | |
| 189 | + } | |
| 190 | + | |
| 191 | + // filterSampleFlag, 8-460 | |
| 192 | + if (abs (p[0] - q[0]) < iAlpha && abs (p[1] - p[0]) < iBeta && abs (q[1] - q[0]) < iBeta) { | |
| 193 | + // 8-480, 487 | |
| 194 | + pPixCb[iStrideX * -1] = CLIP3 ((2 * p[1] + p[0] + q[1] + 2) >> 2, 0, 255); | |
| 195 | + pPixCb[iStrideX * 0 ] = CLIP3 ((2 * q[1] + q[0] + p[1] + 2) >> 2, 0, 255); | |
| 196 | + } | |
| 197 | + pPixCb += iStrideY; | |
| 198 | + | |
| 199 | + /* for Cr */ | |
| 200 | + for (int m = 0; m < 2; m++) { | |
| 201 | + p[m] = pPixCr[iStrideX * -1 * (m + 1)]; | |
| 202 | + q[m] = pPixCr[iStrideX * m]; | |
| 203 | + } | |
| 204 | + | |
| 205 | + // filterSampleFlag, 8-460 | |
| 206 | + if (abs (p[0] - q[0]) < iAlpha && abs (p[1] - p[0]) < iBeta && abs (q[1] - q[0]) < iBeta) { | |
| 207 | + // 8-480, 487 | |
| 208 | + pPixCr[iStrideX * -1] = CLIP3 ((2 * p[1] + p[0] + q[1] + 2) >> 2, 0, 255); | |
| 209 | + pPixCr[iStrideX * 0 ] = CLIP3 ((2 * q[1] + q[0] + p[1] + 2) >> 2, 0, 255); | |
| 210 | + } | |
| 211 | + pPixCr += iStrideY; | |
| 212 | + } | |
| 213 | +} | |
| 214 | + | |
| 215 | +/* Unit test functions body */ | |
| 216 | +TEST (DeblockingCommon, DeblockLumaLt4_c) { | |
| 217 | + // void DeblockLumaLt4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta, int8_t* pTc) | |
| 218 | + | |
| 219 | +#define TEST_CYCLE 1000 | |
| 220 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixBase, 16 * 16, 16); | |
| 221 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixRef, 16 * 16, 16); | |
| 222 | + | |
| 223 | + int32_t iAlpha, iBeta; | |
| 224 | + | |
| 225 | + ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16); | |
| 226 | + | |
| 227 | + bool bEqual = true; | |
| 228 | + | |
| 229 | + for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) { | |
| 230 | + /* Horizontal */ | |
| 231 | + GENERATE_DATA_DEBLOCKING (iPixBase, iPixRef, 16) | |
| 232 | + | |
| 233 | + anchor_DeblockingLumaNormal (&iPixBase[8 * 1], 1, 16, iAlpha, iBeta, iTc); | |
| 234 | + DeblockLumaLt4_c (&iPixRef[8 * 1], 1, 16, iAlpha, iBeta, iTc); | |
| 235 | + | |
| 236 | + for (int i = 0; i < 16 * 16; i++) { | |
| 237 | + if (iPixBase[i] != iPixRef[i]) { | |
| 238 | + bEqual = false; | |
| 239 | + break; | |
| 240 | + } | |
| 241 | + } | |
| 242 | + | |
| 243 | + /* Vertical */ | |
| 244 | + GENERATE_DATA_DEBLOCKING (iPixBase, iPixRef, 16) | |
| 245 | + | |
| 246 | + anchor_DeblockingLumaNormal (&iPixBase[8 * 16], 16, 1, iAlpha, iBeta, iTc); | |
| 247 | + DeblockLumaLt4_c (&iPixRef[8 * 16], 16, 1, iAlpha, iBeta, iTc); | |
| 248 | + | |
| 249 | + for (int i = 0; i < 16 * 16; i++) { | |
| 250 | + if (iPixBase[i] != iPixRef[i]) { | |
| 251 | + bEqual = false; | |
| 252 | + break; | |
| 253 | + } | |
| 254 | + } | |
| 255 | + } | |
| 256 | + | |
| 257 | + EXPECT_TRUE (bEqual); | |
| 258 | +} | |
| 259 | +TEST (DeblockingCommon, DeblockLumaEq4_c) { | |
| 260 | + //void DeblockLumaEq4_c (uint8_t* pPix, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta) | |
| 261 | +#define TEST_CYCLE 1000 | |
| 262 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixBase, 16 * 16, 16); | |
| 263 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixRef, 16 * 16, 16); | |
| 264 | + | |
| 265 | + int32_t iAlpha, iBeta; | |
| 266 | + | |
| 267 | + /* NOT used here */ | |
| 268 | + ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16); | |
| 269 | + | |
| 270 | + bool bEqual = true; | |
| 271 | + | |
| 272 | + for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) { | |
| 273 | + /* Horizontal */ | |
| 274 | + GENERATE_DATA_DEBLOCKING (iPixBase, iPixRef, 16) | |
| 275 | + | |
| 276 | + anchor_DeblockingLumaIntra (&iPixBase[8 * 1], 1, 16, iAlpha, iBeta); | |
| 277 | + DeblockLumaEq4_c (&iPixRef[8 * 1], 1, 16, iAlpha, iBeta); | |
| 278 | + | |
| 279 | + for (int i = 0; i < 16 * 16; i++) { | |
| 280 | + if (iPixBase[i] != iPixRef[i]) { | |
| 281 | + bEqual = false; | |
| 282 | + break; | |
| 283 | + } | |
| 284 | + } | |
| 285 | + | |
| 286 | + /* Vertical */ | |
| 287 | + GENERATE_DATA_DEBLOCKING (iPixBase, iPixRef, 16) | |
| 288 | + | |
| 289 | + anchor_DeblockingLumaIntra (&iPixBase[8 * 16], 16, 1, iAlpha, iBeta); | |
| 290 | + DeblockLumaEq4_c (&iPixRef[8 * 16], 16, 1, iAlpha, iBeta); | |
| 291 | + | |
| 292 | + for (int i = 0; i < 16 * 16; i++) { | |
| 293 | + if (iPixBase[i] != iPixRef[i]) { | |
| 294 | + bEqual = false; | |
| 295 | + break; | |
| 296 | + } | |
| 297 | + } | |
| 298 | + } | |
| 299 | + | |
| 300 | + EXPECT_TRUE (bEqual); | |
| 301 | +} | |
| 302 | + | |
| 303 | +TEST (DeblockingCommon, DeblockChromaLt4_c) { | |
| 304 | + // void DeblockChromaLt4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta, int8_t* pTc) | |
| 305 | +#define TEST_CYCLE 1000 | |
| 306 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCbBase, 8 * 8, 16); | |
| 307 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCrBase, 8 * 8, 16); | |
| 308 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCbRef, 8 * 8, 16); | |
| 309 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCrRef, 8 * 8, 16); | |
| 310 | + | |
| 311 | + int32_t iAlpha, iBeta; | |
| 312 | + | |
| 313 | + ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16); | |
| 314 | + | |
| 315 | + bool bEqual = true; | |
| 316 | + | |
| 317 | + for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) { | |
| 318 | + /* Horizontal */ | |
| 319 | + GENERATE_DATA_DEBLOCKING (iPixCbBase, iPixCbRef, 8) | |
| 320 | + GENERATE_DATA_DEBLOCKING (iPixCrBase, iPixCrRef, 8) | |
| 321 | + | |
| 322 | + anchor_DeblockingChromaNormal (&iPixCbBase[4 * 1], &iPixCrBase[4 * 1], 1, 8, iAlpha, iBeta, iTc); | |
| 323 | + DeblockChromaLt4_c (&iPixCbRef[4 * 1], &iPixCrRef[4 * 1], 1, 8, iAlpha, iBeta, iTc); | |
| 324 | + | |
| 325 | + for (int i = 0; i < 8 * 8; i++) { | |
| 326 | + if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) { | |
| 327 | + bEqual = false; | |
| 328 | + break; | |
| 329 | + } | |
| 330 | + } | |
| 331 | + | |
| 332 | + /* Vertical */ | |
| 333 | + GENERATE_DATA_DEBLOCKING (iPixCbBase, iPixCbRef, 8) | |
| 334 | + GENERATE_DATA_DEBLOCKING (iPixCrBase, iPixCrRef, 8) | |
| 335 | + | |
| 336 | + anchor_DeblockingChromaNormal (&iPixCbBase[4 * 8], &iPixCrBase[4 * 8], 8, 1, iAlpha, iBeta, iTc); | |
| 337 | + DeblockChromaLt4_c (&iPixCbRef[4 * 8], &iPixCrRef[4 * 8], 8, 1, iAlpha, iBeta, iTc); | |
| 338 | + | |
| 339 | + for (int i = 0; i < 8 * 8; i++) { | |
| 340 | + if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) { | |
| 341 | + bEqual = false; | |
| 342 | + break; | |
| 343 | + } | |
| 344 | + } | |
| 345 | + } | |
| 346 | + | |
| 347 | + EXPECT_TRUE (bEqual); | |
| 348 | +} | |
| 349 | + | |
| 350 | +TEST (DeblockingCommon, DeblockChromaEq4_c) { | |
| 351 | + // void DeblockChromaEq4_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStrideX, int32_t iStrideY, int32_t iAlpha, int32_t iBeta) | |
| 352 | +#define TEST_CYCLE 1000 | |
| 353 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCbBase, 8 * 8, 16); | |
| 354 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCrBase, 8 * 8, 16); | |
| 355 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCbRef, 8 * 8, 16); | |
| 356 | + ENFORCE_STACK_ALIGN_1D (uint8_t, iPixCrRef, 8 * 8, 16); | |
| 357 | + | |
| 358 | + int32_t iAlpha, iBeta; | |
| 359 | + | |
| 360 | + /* NOT used here*/ | |
| 361 | + ENFORCE_STACK_ALIGN_1D (int8_t, iTc, 4, 16); | |
| 362 | + | |
| 363 | + bool bEqual = true; | |
| 364 | + | |
| 365 | + for (int iNum = 0; bEqual && iNum < TEST_CYCLE; iNum++) { | |
| 366 | + /* Horizontal */ | |
| 367 | + GENERATE_DATA_DEBLOCKING (iPixCbBase, iPixCbRef, 8) | |
| 368 | + GENERATE_DATA_DEBLOCKING (iPixCrBase, iPixCrRef, 8) | |
| 369 | + | |
| 370 | + anchor_DeblockingChromaIntra (&iPixCbBase[4 * 1], &iPixCrBase[4 * 1], 1, 8, iAlpha, iBeta); | |
| 371 | + DeblockChromaEq4_c (&iPixCbRef[4 * 1], &iPixCrRef[4 * 1], 1, 8, iAlpha, iBeta); | |
| 372 | + | |
| 373 | + for (int i = 0; i < 8 * 8; i++) { | |
| 374 | + if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) { | |
| 375 | + bEqual = false; | |
| 376 | + break; | |
| 377 | + } | |
| 378 | + } | |
| 379 | + | |
| 380 | + /* Vertical */ | |
| 381 | + GENERATE_DATA_DEBLOCKING (iPixCbBase, iPixCbRef, 8) | |
| 382 | + GENERATE_DATA_DEBLOCKING (iPixCrBase, iPixCrRef, 8) | |
| 383 | + | |
| 384 | + anchor_DeblockingChromaIntra (&iPixCbBase[4 * 8], &iPixCrBase[4 * 8], 8, 1, iAlpha, iBeta); | |
| 385 | + DeblockChromaEq4_c (&iPixCbRef[4 * 8], &iPixCrRef[4 * 8], 8, 1, iAlpha, iBeta); | |
| 386 | + | |
| 387 | + for (int i = 0; i < 8 * 8; i++) { | |
| 388 | + if (iPixCbBase[i] != iPixCbRef[i] || iPixCrBase[i] != iPixCrRef[i]) { | |
| 389 | + bEqual = false; | |
| 390 | + break; | |
| 391 | + } | |
| 392 | + } | |
| 393 | + } | |
| 394 | + | |
| 395 | + EXPECT_TRUE (bEqual); | |
| 396 | +} | |