ref: 3885bd8f0e1017303bf717e38ad158773b491ed6
parent: f9bab05b3a1e42386b26dde082ae84cba4fd83de
parent: ad247a9a4a605fe9f1c203fdb1490339035214ec
author: Ethan Hugg <ethanhugg@gmail.com>
date: Thu Oct 9 04:28:09 EDT 2014
Merge pull request #1406 from mstorsjo/fix-warnings Fix compiler warnings about comparison between signed and unsigned Fix bugs WelsDeblockingFilterSlice UT when random value is 0
--- a/test/decoder/DecUT_DeblockCommon.cpp
+++ b/test/decoder/DecUT_DeblockCommon.cpp
@@ -583,7 +583,7 @@
// (1) Normal case, the iTotalMbInCurSlice == pSps->uiTotalMbCount
sDqLayer.iMbX = sDqLayer.iMbY = 0;
sDqLayer.iMbXyIndex = 0;
- sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice = rand() % 256;
+ sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice = 1 + rand() % 256; // at least one MB
sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->uiTotalMbCount =
sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice;
sDqLayer.iMbWidth = 1 + rand() % 128;
@@ -591,10 +591,10 @@
EXPECT_TRUE ((sDqLayer.iMbXyIndex + 1) == sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice) << sDqLayer.iMbXyIndex
<< " " << sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice;
- // (2) Normal case, multi slices, iTotalMbInCurSlice < pSps->uiTotalMbCount
+ // (2) Normal case, multi slices, iTotalMbInCurSlice <= pSps->uiTotalMbCount
sDqLayer.iMbX = sDqLayer.iMbY = 0;
sDqLayer.iMbXyIndex = 0;
- sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice = rand() % 256;
+ sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice = 1 + rand() % 256;
sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->uiTotalMbCount =
sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice + rand() % 256;
sDqLayer.iMbWidth = 1 + rand() % 128;
@@ -601,15 +601,15 @@
WelsDeblockingFilterSlice (&sCtx, pDeblockMb);
EXPECT_TRUE ((sDqLayer.iMbXyIndex + 1) == sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice);
- // (3) Special case, iTotalMbInCurSlice > pSps->uiTotalMbCount, JUST FOR TEST
+ // (3) Special case, iTotalMbInCurSlice >= pSps->uiTotalMbCount, JUST FOR TEST
sDqLayer.iMbX = sDqLayer.iMbY = 0;
sDqLayer.iMbXyIndex = 0;
- sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->uiTotalMbCount = rand() % 256;
+ sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->uiTotalMbCount = 1 + rand() % 256;
sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice =
sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->uiTotalMbCount + rand() % 256;
sDqLayer.iMbWidth = 1 + rand() % 128;
WelsDeblockingFilterSlice (&sCtx, pDeblockMb);
- EXPECT_TRUE ((sDqLayer.iMbXyIndex + 1) ==
+ EXPECT_TRUE ((uint32_t) (sDqLayer.iMbXyIndex + 1) ==
sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->uiTotalMbCount);
// (4) Special case, uiDisableDeblockingFilterIdc==1, disable deblocking
@@ -616,7 +616,7 @@
sDqLayer.iMbX = sDqLayer.iMbY = 0;
sDqLayer.iMbXyIndex = 0;
sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.uiDisableDeblockingFilterIdc = 1;
- sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice = rand() % 256;
+ sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice = 1 + rand() % 256;
sDqLayer.sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->uiTotalMbCount =
sDqLayer.sLayerInfo.sSliceInLayer.iTotalMbInCurSlice;
sDqLayer.iMbWidth = 1 + rand() % 128;
@@ -796,13 +796,13 @@
UT_DB_CLEAN_STATUS
iNoZeroCount[0 * 24 + iCurrBlock] = 1; // Current MB_block position
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (2 << (iPos * 8))) << iEdge << " " << iPos << " NoZeroCount!=0";
+ 0) == (2u << (iPos * 8))) << iEdge << " " << iPos << " NoZeroCount!=0";
// (2) iEdge == 0, neighbor block NoZeroCount != 0
UT_DB_CLEAN_STATUS
iNoZeroCount[1 * 24 + iNeighborBlock ] = 1; // Neighbor MB_block position
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (2 << (iPos * 8))) << iEdge << " " << iPos << " NoZeroCount!=0";
+ 0) == (2u << (iPos * 8))) << iEdge << " " << iPos << " NoZeroCount!=0";
// (3) iEdge == 0, reference idx diff
UT_DB_CLEAN_STATUS
@@ -809,7 +809,7 @@
iLayerRefIndex[0][0 * 16 + iCurrBlock] = 0;
iLayerRefIndex[0][1 * 16 + iNeighborBlock] = 1;
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (1 << (iPos * 8))) << iEdge << " " << iPos << " Ref idx diff";
+ 0) == (1u << (iPos * 8))) << iEdge << " " << iPos << " Ref idx diff";
// (4) iEdge == 0, abs(mv diff) < 4
UT_DB_CLEAN_STATUS
@@ -832,34 +832,34 @@
UT_DB_CLEAN_STATUS
iLayerMv[0][0 * 16 + iCurrBlock][0] = 4;
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (1 << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
+ 0) == (1u << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
UT_DB_CLEAN_STATUS
iLayerMv[0][0 * 16 + iCurrBlock][1] = 4;
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (1 << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
+ 0) == (1u << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
UT_DB_CLEAN_STATUS
iLayerMv[0][1 * 16 + iNeighborBlock][0] = 4;
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (1 << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
+ 0) == (1u << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
UT_DB_CLEAN_STATUS
iLayerMv[0][1 * 16 + iNeighborBlock][1] = 4;
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (1 << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
+ 0) == (1u << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == 4";
UT_DB_CLEAN_STATUS
iLayerMv[0][0 * 16 + iCurrBlock][0] = -2048;
iLayerMv[0][1 * 16 + iNeighborBlock][0] = 2047;
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (1 << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == maximum";
+ 0) == (1u << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == maximum";
UT_DB_CLEAN_STATUS
iLayerMv[0][0 * 16 + iCurrBlock][1] = -2048;
iLayerMv[0][1 * 16 + iNeighborBlock][1] = 2047;
EXPECT_TRUE (DeblockingBsMarginalMBAvcbase (&sDqLayer, iEdge, 1,
- 0) == (1 << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == maximum";
+ 0) == (1u << (iPos * 8))) << iEdge << " " << iPos << " diff_mv == maximum";
}
}
}
@@ -951,4 +951,4 @@
iQP = rand() % 16;
sDqLayer.pMbType[1] = 0x04;
UT_DB_MACROBLOCK_TEST (0x03, iQP, 0, 0, 0, 0, 0, 0)
-}
\ No newline at end of file
+}