shithub: openh264

Download patch

ref: 614e898b6779e5e408c2bbbb7590ca4085049677
parent: b425450bc137d2c7998c27a200881eb280cc44ec
parent: 3885bd8f0e1017303bf717e38ad158773b491ed6
author: huili2 <[email protected]>
date: Fri Oct 10 13:24:36 EDT 2014

Merge pull request #1408 from HaiboZhu/Add_UT_Deblocking

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,10 +601,10 @@
   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;
@@ -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;