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
This commit is contained in:
Ethan Hugg 2014-10-09 08:28:09 -07:00 committed by Haibo Zhu
commit 3885bd8f0e

View File

@ -583,7 +583,7 @@ TEST (DecoderDeblocking, WelsDeblockingFilterSlice) {
// (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,32 +591,32 @@ TEST (DecoderDeblocking, WelsDeblockingFilterSlice) {
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;
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
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,20 +796,20 @@ TEST (DecoderDeblocking, DeblockingBsMarginalMBAvcbase) {
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
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 @@ TEST (DecoderDeblocking, DeblockingBsMarginalMBAvcbase) {
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 @@ TEST (Deblocking, WelsDeblockingMb) {
iQP = rand() % 16;
sDqLayer.pMbType[1] = 0x04;
UT_DB_MACROBLOCK_TEST (0x03, iQP, 0, 0, 0, 0, 0, 0)
}
}