Unified · Split
| @@ -55,10 +55,10 @@ void WelsHadamardT4Dc_c (int16_t* pLumaDc, int16_t* pDct); · 54 unmodified lines | |||
| 55 | int32_t WelsHadamardQuant2x2_c (int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct, int16_t* pBlock); | 55 | int32_t WelsHadamardQuant2x2_c (int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct, int16_t* pBlock); |
| 56 | int32_t WelsHadamardQuant2x2Skip_c (int16_t* pRes, int16_t iFF, int16_t iMF); | 56 | int32_t WelsHadamardQuant2x2Skip_c (int16_t* pRes, int16_t iFF, int16_t iMF); |
| 57 | 57 | ||
| 58 | void WelsQuant4x4_c (int16_t* pDct, int16_t* pFF, int16_t* pMF); | 58 | void WelsQuant4x4_c (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); |
| 59 | void WelsQuant4x4Dc_c (int16_t* pDct, int16_t iFF, int16_t iMF); | 59 | void WelsQuant4x4Dc_c (int16_t* pDct, int16_t iFF, int16_t iMF); |
| 60 | void WelsQuantFour4x4_c (int16_t* pDct, int16_t* pFF, int16_t* pQpTable); | 60 | void WelsQuantFour4x4_c (int16_t* pDct, const int16_t* pFF, const int16_t* pQpTable); |
| 61 | void WelsQuantFour4x4Max_c (int16_t* pDct, int16_t* pF, int16_t* pQpTable, int16_t* pMax); | 61 | void WelsQuantFour4x4Max_c (int16_t* pDct, const int16_t* pF, const int16_t* pQpTable, int16_t* pMax); |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | /**************************************************************************** | 64 | /**************************************************************************** |
| @@ -44,9 +44,10 @@ bool YUVPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, · 43 unmodified lines | |||
| 44 | return false; | 44 | return false; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void RandomPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride ) | 47 | void RandomPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride, int32_t iIdx ) |
| 48 | { | 48 | { |
| 49 | uint8_t* pLocalPointer = pPointer; | 49 | uint8_t* pLocalPointer = pPointer; |
| 50 | srand((uint32_t)(time(NULL)+iIdx)); | ||
| 50 | for (int32_t j=0;j<iHeight;j++) { | 51 | for (int32_t j=0;j<iHeight;j++) { |
| 51 | for (int32_t i=0;i<iWidth;i++) { | 52 | for (int32_t i=0;i<iWidth;i++) { |
| 52 | pLocalPointer[i] = rand()%256; | 53 | pLocalPointer[i] = rand()%256; |
| @@ -0,0 +1,200 @@ | |||
| 1 | #include <gtest/gtest.h> | ||
| 2 | |||
| 3 | #include "memory_align.h" | ||
| 4 | #include "utils/DataGenerator.h" | ||
| 5 | |||
| 6 | using namespace WelsSVCEnc; | ||
| 7 | #include "encode_mb_aux.h" | ||
| 8 | |||
| 9 | __align16( const int16_t, g_kiQuantInterFFCompare[104][8] ) = { | ||
| 10 | /* 0*/ { 0, 1, 0, 1, 1, 1, 1, 1 }, | ||
| 11 | /* 1*/ { 0, 1, 0, 1, 1, 1, 1, 1 }, | ||
| 12 | /* 2*/ { 1, 1, 1, 1, 1, 1, 1, 1 }, | ||
| 13 | /* 3*/ { 1, 1, 1, 1, 1, 2, 1, 2 }, | ||
| 14 | /* 4*/ { 1, 1, 1, 1, 1, 2, 1, 2 }, | ||
| 15 | /* 5*/ { 1, 1, 1, 1, 1, 2, 1, 2 }, | ||
| 16 | /* 6*/ { 1, 1, 1, 1, 1, 2, 1, 2 }, | ||
| 17 | /* 7*/ { 1, 2, 1, 2, 2, 2, 2, 2 }, | ||
| 18 | /* 8*/ { 1, 2, 1, 2, 2, 3, 2, 3 }, | ||
| 19 | /* 9*/ { 1, 2, 1, 2, 2, 3, 2, 3 }, | ||
| 20 | /*10*/ { 1, 2, 1, 2, 2, 3, 2, 3 }, | ||
| 21 | /*11*/ { 2, 2, 2, 2, 2, 4, 2, 4 }, | ||
| 22 | /*12*/ { 2, 3, 2, 3, 3, 4, 3, 4 }, | ||
| 23 | /*13*/ { 2, 3, 2, 3, 3, 5, 3, 5 }, | ||
| 24 | /*14*/ { 2, 3, 2, 3, 3, 5, 3, 5 }, | ||
| 25 | /*15*/ { 2, 4, 2, 4, 4, 6, 4, 6 }, | ||
| 26 | /*16*/ { 3, 4, 3, 4, 4, 7, 4, 7 }, | ||
| 27 | /*17*/ { 3, 5, 3, 5, 5, 8, 5, 8 }, | ||
| 28 | /*18*/ { 3, 6, 3, 6, 6, 9, 6, 9 }, | ||
| 29 | /*19*/ { 4, 6, 4, 6, 6, 10, 6, 10 }, | ||
| 30 | /*20*/ { 4, 7, 4, 7, 7, 11, 7, 11 }, | ||
| 31 | /*21*/ { 5, 8, 5, 8, 8, 12, 8, 12 }, | ||
| 32 | /*22*/ { 6, 9, 6, 9, 9, 13, 9, 13 }, | ||
| 33 | /*23*/ { 6, 10, 6, 10, 10, 16, 10, 16 }, | ||
| 34 | /*24*/ { 7, 11, 7, 11, 11, 17, 11, 17 }, | ||
| 35 | /*25*/ { 8, 12, 8, 12, 12, 19, 12, 19 }, | ||
| 36 | /*26*/ { 9, 14, 9, 14, 14, 21, 14, 21 }, | ||
| 37 | /*27*/ { 10, 15, 10, 15, 15, 25, 15, 25 }, | ||
| 38 | /*28*/ { 11, 17, 11, 17, 17, 27, 17, 27 }, | ||
| 39 | /*29*/ { 12, 20, 12, 20, 20, 31, 20, 31 }, | ||
| 40 | /*30*/ { 14, 22, 14, 22, 22, 34, 22, 34 }, | ||
| 41 | /*31*/ { 15, 24, 15, 24, 24, 39, 24, 39 }, | ||
| 42 | /*32*/ { 18, 27, 18, 27, 27, 43, 27, 43 }, | ||
| 43 | /*33*/ { 19, 31, 19, 31, 31, 49, 31, 49 }, | ||
| 44 | /*34*/ { 22, 34, 22, 34, 34, 54, 34, 54 }, | ||
| 45 | /*35*/ { 25, 40, 25, 40, 40, 62, 40, 62 }, | ||
| 46 | /*36*/ { 27, 45, 27, 45, 45, 69, 45, 69 }, | ||
| 47 | /*37*/ { 30, 48, 30, 48, 48, 77, 48, 77 }, | ||
| 48 | /*38*/ { 36, 55, 36, 55, 55, 86, 55, 86 }, | ||
| 49 | /*39*/ { 38, 62, 38, 62, 62, 99, 62, 99 }, | ||
| 50 | /*40*/ { 44, 69, 44, 69, 69, 107, 69, 107 }, | ||
| 51 | /*41*/ { 49, 79, 49, 79, 79, 125, 79, 125 }, | ||
| 52 | /*42*/ { 55, 89, 55, 89, 89, 137, 89, 137 }, | ||
| 53 | /*43*/ { 61, 96, 61, 96, 96, 154, 96, 154 }, | ||
| 54 | /*44*/ { 71, 110, 71, 110, 110, 171, 110, 171 }, | ||
| 55 | /*45*/ { 77, 124, 77, 124, 124, 198, 124, 198 }, | ||
| 56 | /*46*/ { 88, 137, 88, 137, 137, 217, 137, 217 }, | ||
| 57 | /*47*/ { 99, 159, 99, 159, 159, 250, 159, 250 }, | ||
| 58 | /*48*/ { 110, 179, 110, 179, 179, 275, 179, 275 }, | ||
| 59 | /*49*/ { 121, 191, 121, 191, 191, 313, 191, 313 }, | ||
| 60 | /*50*/ { 143, 221, 143, 221, 221, 341, 221, 341 }, | ||
| 61 | /*51*/ { 154, 245, 154, 245, 245, 402, 245, 402 }, | ||
| 62 | //from here below is intra | ||
| 63 | /* 0*/ { 1, 1, 1, 1, 1, 2, 1, 2 }, | ||
| 64 | /* 1*/ { 1, 1, 1, 1, 1, 2, 1, 2 }, | ||
| 65 | /* 2*/ { 1, 2, 1, 2, 2, 3, 2, 3 }, | ||
| 66 | /* 3*/ { 1, 2, 1, 2, 2, 3, 2, 3 }, | ||
| 67 | /* 4*/ { 1, 2, 1, 2, 2, 3, 2, 3 }, | ||
| 68 | /* 5*/ { 1, 2, 1, 2, 2, 4, 2, 4 }, | ||
| 69 | /* 6*/ { 2, 3, 2, 3, 3, 4, 3, 4 }, | ||
| 70 | /* 7*/ { 2, 3, 2, 3, 3, 5, 3, 5 }, | ||
| 71 | /* 8*/ { 2, 3, 2, 3, 3, 5, 3, 5 }, | ||
| 72 | /* 9*/ { 2, 4, 2, 4, 4, 6, 4, 6 }, | ||
| 73 | /*10*/ { 3, 4, 3, 4, 4, 6, 4, 6 }, | ||
| 74 | /*11*/ { 3, 5, 3, 5, 5, 7, 5, 7 }, | ||
| 75 | /*12*/ { 3, 5, 3, 5, 5, 8, 5, 8 }, | ||
| 76 | /*13*/ { 4, 6, 4, 6, 6, 9, 6, 9 }, | ||
| 77 | /*14*/ { 4, 7, 4, 7, 7, 10, 7, 10 }, | ||
| 78 | /*15*/ { 5, 7, 5, 7, 7, 12, 7, 12 }, | ||
| 79 | /*16*/ { 5, 8, 5, 8, 8, 13, 8, 13 }, | ||
| 80 | /*17*/ { 6, 9, 6, 9, 9, 15, 9, 15 }, | ||
| 81 | /*18*/ { 7, 11, 7, 11, 11, 16, 11, 16 }, | ||
| 82 | /*19*/ { 7, 11, 7, 11, 11, 18, 11, 18 }, | ||
| 83 | /*20*/ { 9, 13, 9, 13, 13, 20, 13, 20 }, | ||
| 84 | /*21*/ { 9, 15, 9, 15, 15, 24, 15, 24 }, | ||
| 85 | /*22*/ { 11, 16, 11, 16, 16, 26, 16, 26 }, | ||
| 86 | /*23*/ { 12, 19, 12, 19, 19, 30, 19, 30 }, | ||
| 87 | /*24*/ { 13, 21, 13, 21, 21, 33, 21, 33 }, | ||
| 88 | /*25*/ { 14, 23, 14, 23, 23, 37, 23, 37 }, | ||
| 89 | /*26*/ { 17, 26, 17, 26, 26, 41, 26, 41 }, | ||
| 90 | /*27*/ { 18, 30, 18, 30, 30, 47, 30, 47 }, | ||
| 91 | /*28*/ { 21, 33, 21, 33, 33, 51, 33, 51 }, | ||
| 92 | /*29*/ { 24, 38, 24, 38, 38, 59, 38, 59 }, | ||
| 93 | /*30*/ { 26, 43, 26, 43, 43, 66, 43, 66 }, | ||
| 94 | /*31*/ { 29, 46, 29, 46, 46, 74, 46, 74 }, | ||
| 95 | /*32*/ { 34, 52, 34, 52, 52, 82, 52, 82 }, | ||
| 96 | /*33*/ { 37, 59, 37, 59, 59, 94, 59, 94 }, | ||
| 97 | /*34*/ { 42, 66, 42, 66, 66, 102, 66, 102 }, | ||
| 98 | /*35*/ { 47, 75, 47, 75, 75, 119, 75, 119 }, | ||
| 99 | /*36*/ { 52, 85, 52, 85, 85, 131, 85, 131 }, | ||
| 100 | /*37*/ { 58, 92, 58, 92, 92, 147, 92, 147 }, | ||
| 101 | /*38*/ { 68, 105, 68, 105, 105, 164, 105, 164 }, | ||
| 102 | /*39*/ { 73, 118, 73, 118, 118, 189, 118, 189 }, | ||
| 103 | /*40*/ { 84, 131, 84, 131, 131, 205, 131, 205 }, | ||
| 104 | /*41*/ { 94, 151, 94, 151, 151, 239, 151, 239 }, | ||
| 105 | /*42*/ { 105, 171, 105, 171, 171, 262, 171, 262 }, | ||
| 106 | /*43*/ { 116, 184, 116, 184, 184, 295, 184, 295 }, | ||
| 107 | /*44*/ { 136, 211, 136, 211, 211, 326, 211, 326 }, | ||
| 108 | /*45*/ { 147, 236, 147, 236, 236, 377, 236, 377 }, | ||
| 109 | /*46*/ { 168, 262, 168, 262, 262, 414, 262, 414 }, | ||
| 110 | /*47*/ { 189, 303, 189, 303, 303, 478, 303, 478 }, | ||
| 111 | /*48*/ { 211, 341, 211, 341, 341, 524, 341, 524 }, | ||
| 112 | /*49*/ { 231, 364, 231, 364, 364, 597, 364, 597 }, | ||
| 113 | /*50*/ { 272, 422, 272, 422, 422, 652, 422, 652 }, | ||
| 114 | /*51*/ { 295, 467, 295, 467, 467, 768, 467, 768 } | ||
| 115 | }; | ||
| 116 | |||
| 117 | #define ThValue 2 | ||
| 118 | |||
| 119 | void TestQuant(uint32_t qp,uint8_t *pSrc,uint8_t *pPred,int16_t *pDct, | ||
| 120 | int16_t *pDctCompare,int16_t iWidth,int16_t iHeight) { | ||
| 121 | const int16_t *pMf = g_kiQuantMF[qp]; | ||
| 122 | const int16_t *pFfCompareI = g_kiQuantInterFFCompare[52 + qp]; | ||
| 123 | const int16_t *pFfCompareP = g_kiQuantInterFFCompare[qp]; | ||
| 124 | const int16_t *pFfI = g_kiQuantInterFF[6 + qp]; | ||
| 125 | const int16_t *pFfP = g_kiQuantInterFF[qp]; | ||
| 126 | //quant4x4 Intra MB | ||
| 127 | RandomPixelDataGenerator(pSrc,iWidth,iHeight,iWidth,0); | ||
| 128 | RandomPixelDataGenerator(pPred,iWidth,iHeight,iWidth,rand()); | ||
| 129 | |||
| 130 | for (int16_t i = 0; i<16; i++) { | ||
| 131 | pDct[i] = pSrc[i] - pPred[i]; | ||
| 132 | pDctCompare[i] = pSrc[i] - pPred[i]; | ||
| 133 | } | ||
| 134 | |||
| 135 | WelsQuant4x4_c(pDct,pFfI,pMf); | ||
| 136 | WelsQuant4x4_c(pDctCompare,pFfCompareI,pMf); | ||
| 137 | |||
| 138 | for (int16_t i = 0;i<16;i++) { | ||
| 139 | int16_t iDeta =WELS_ABS(pDct[i] - pDctCompare[i]); | ||
| 140 | iDeta = (iDeta < ThValue) ? 0 : iDeta; | ||
| 141 | EXPECT_EQ(iDeta,0); | ||
| 142 | } | ||
| 143 | |||
| 144 | //quant4x4 DC | ||
| 145 | RandomPixelDataGenerator(pSrc,iWidth,iHeight,iWidth,0); | ||
| 146 | RandomPixelDataGenerator(pPred,iWidth,iHeight,iWidth,rand()); | ||
| 147 | |||
| 148 | for (int16_t i = 0;i<16;i++) { | ||
| 149 | pDct[i] = pSrc[i] - pPred[i]; | ||
| 150 | pDctCompare[i] = pSrc[i] - pPred[i]; | ||
| 151 | } | ||
| 152 | |||
| 153 | WelsQuant4x4Dc_c(pDct,pFfI[0]<<1,pMf[0]>>1); | ||
| 154 | WelsQuant4x4Dc_c(pDctCompare,pFfCompareI[0]<<1,pMf[0]>>1); | ||
| 155 | |||
| 156 | for (int16_t i = 0;i<16;i++) { | ||
| 157 | int16_t iDeta =WELS_ABS(pDct[i] - pDctCompare[i]); | ||
| 158 | iDeta = (iDeta < ThValue) ? 0 : iDeta; | ||
| 159 | EXPECT_EQ(iDeta,0); | ||
| 160 | } | ||
| 161 | |||
| 162 | //quant4x4 Inter MB | ||
| 163 | RandomPixelDataGenerator(pSrc,iWidth,iHeight,iWidth,0); | ||
| 164 | RandomPixelDataGenerator(pPred,iWidth,iHeight,iWidth,rand()); | ||
| 165 | |||
| 166 | for (int16_t i = 0; i<64; i++) { | ||
| 167 | pDct[i] = pSrc[i] - pPred[i]; | ||
| 168 | pDctCompare[i] = pSrc[i] - pPred[i]; | ||
| 169 | } | ||
| 170 | |||
| 171 | WelsQuantFour4x4_c(pDct,pFfP,pMf); | ||
| 172 | WelsQuantFour4x4_c(pDctCompare,pFfCompareP,pMf); | ||
| 173 | |||
| 174 | for (int16_t i = 0; i<64; i++) { | ||
| 175 | int16_t iDeta =WELS_ABS(pDct[i] - pDctCompare[i]); | ||
| 176 | iDeta = (iDeta <ThValue)?0:iDeta; | ||
| 177 | EXPECT_EQ(iDeta,0); | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | TEST(EncoderMbTest, TestQuantTable) { | ||
| 182 | CMemoryAlign cMemoryAlign(0); | ||
| 183 | |||
| 184 | int16_t iWidth = 16; | ||
| 185 | int16_t iHeight = 16; | ||
| 186 | |||
| 187 | uint8_t *pSrc = (uint8_t *)cMemoryAlign.WelsMalloc(iWidth*iHeight,"quant_src"); | ||
| 188 | uint8_t *pPred = (uint8_t *)cMemoryAlign.WelsMalloc(iWidth*iHeight,"quant_pred"); | ||
| 189 | int16_t *pDct = (int16_t *)cMemoryAlign.WelsMalloc(64*sizeof(int16_t),"Dct Buffer"); | ||
| 190 | int16_t *pDctCompare = (int16_t *)cMemoryAlign.WelsMalloc(64*sizeof(int16_t),"DctCompare Buffer"); | ||
| 191 | |||
| 192 | for (int32_t iQP = 0; iQP<51; iQP++) { | ||
| 193 | TestQuant(iQP,pSrc,pPred,pDct,pDctCompare,iWidth,iHeight); | ||
| 194 | } | ||
| 195 | |||
| 196 | cMemoryAlign.WelsFree(pSrc,"quant_src"); | ||
| 197 | cMemoryAlign.WelsFree(pPred,"quant_pred"); | ||
| 198 | cMemoryAlign.WelsFree(pDct,"Dct Buffer"); | ||
| 199 | cMemoryAlign.WelsFree(pDctCompare,"DctCompare Buffer"); | ||
| 200 | } | ||
| @@ -6,8 +6,7 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | using namespace WelsSVCEnc; | 7 | using namespace WelsSVCEnc; |
| 8 | 8 | ||
| 9 | TEST(ExpandPicTest, TestExpand_picture_luma_c) | 9 | TEST(ExpandPicTest, TestExpand_picture_luma_c) { |
| 10 | { | ||
| 11 | SWelsFuncPtrList sFuncList; | 10 | SWelsFuncPtrList sFuncList; |
| 12 | InitExpandPictureFunc( &sFuncList, 0 ); | 11 | InitExpandPictureFunc( &sFuncList, 0 ); |
| 13 | 12 | ||
| @@ -78,8 +77,7 @@ TEST(ExpandPicTest, TestExpand_picture_luma_c) · 64 unmodified lines | |||
| 78 | delete []pRef; | 77 | delete []pRef; |
| 79 | } | 78 | } |
| 80 | 79 | ||
| 81 | TEST(ExpandPicTest, TestExpand_picture_chroma_c) | 80 | TEST(ExpandPicTest, TestExpand_picture_chroma_c) { |
| 82 | { | ||
| 83 | SWelsFuncPtrList sFuncList; | 81 | SWelsFuncPtrList sFuncList; |
| 84 | InitExpandPictureFunc( &sFuncList, 0 ); | 82 | InitExpandPictureFunc( &sFuncList, 0 ); |
| 85 | 83 | ||
| @@ -6,8 +6,7 @@ · 5 unmodified lines | |||
| 6 | using namespace WelsSVCEnc; | 6 | using namespace WelsSVCEnc; |
| 7 | 7 | ||
| 8 | //Tests of WelsGetCacheLineSize Begin | 8 | //Tests of WelsGetCacheLineSize Begin |
| 9 | TEST(MemoryAlignTest, GetCacheLineSize_LoopWithin16K) | 9 | TEST(MemoryAlignTest, GetCacheLineSize_LoopWithin16K) { |
| 10 | { | ||
| 11 | const unsigned int kuiTestBoundary16K = 16 * 1024; | 10 | const unsigned int kuiTestBoundary16K = 16 * 1024; |
| 12 | unsigned int uiTargetAlign = 1; | 11 | unsigned int uiTargetAlign = 1; |
| 13 | while (uiTargetAlign < kuiTestBoundary16K) { | 12 | while (uiTargetAlign < kuiTestBoundary16K) { |
| @@ -17,20 +16,17 @@ TEST(MemoryAlignTest, GetCacheLineSize_LoopWithin16K) · 3 unmodified lines | |||
| 17 | } | 16 | } |
| 18 | } | 17 | } |
| 19 | 18 | ||
| 20 | TEST(MemoryAlignTest, GetCacheLineSize_Zero) | 19 | TEST(MemoryAlignTest, GetCacheLineSize_Zero) { |
| 21 | { | ||
| 22 | CMemoryAlign cTestMa(0); | 20 | CMemoryAlign cTestMa(0); |
| 23 | ASSERT_EQ( 16, cTestMa.WelsGetCacheLineSize() ); | 21 | ASSERT_EQ( 16, cTestMa.WelsGetCacheLineSize() ); |
| 24 | } | 22 | } |
| 25 | TEST(MemoryAlignTest, GetCacheLineSize_MaxUINT) | 23 | TEST(MemoryAlignTest, GetCacheLineSize_MaxUINT) { |
| 26 | { | ||
| 27 | CMemoryAlign cTestMa(0xFFFFFFFF); | 24 | CMemoryAlign cTestMa(0xFFFFFFFF); |
| 28 | ASSERT_EQ( 16, cTestMa.WelsGetCacheLineSize() ); | 25 | ASSERT_EQ( 16, cTestMa.WelsGetCacheLineSize() ); |
| 29 | } | 26 | } |
| 30 | //Tests of WelsGetCacheLineSize End | 27 | //Tests of WelsGetCacheLineSize End |
| 31 | //Tests of WelsMallocAndFree Begin | 28 | //Tests of WelsMallocAndFree Begin |
| 32 | TEST(MemoryAlignTest, WelsMallocAndFreeOnceFunctionVerify) | 29 | TEST(MemoryAlignTest, WelsMallocAndFreeOnceFunctionVerify) { |
| 33 | { | ||
| 34 | const uint32_t kuiTargetAlignSize[4] = {32, 16, 64, 8}; | 30 | const uint32_t kuiTargetAlignSize[4] = {32, 16, 64, 8}; |
| 35 | srand((uint32_t)time(NULL)); | 31 | srand((uint32_t)time(NULL)); |
| 36 | 32 | ||
| @@ -59,5 +55,3 @@ TEST(MemoryAlignTest, WelsMallocAndFreeOnceFunctionVerify) · 22 unmodified lines | |||
| 59 | } | 55 | } |
| 60 | } | 56 | } |
| 61 | } | 57 | } |
| 62 | |||
| 63 | |||
| @@ -10,8 +10,7 @@ · 9 unmodified lines | |||
| 10 | using namespace WelsSVCEnc; | 10 | using namespace WelsSVCEnc; |
| 11 | 11 | ||
| 12 | void CopyTargetBlock( uint8_t* pSrcBlock, const int32_t kiBlockSize, SMVUnitXY sTargetMv, const int32_t kiRefPicStride, | 12 | void CopyTargetBlock( uint8_t* pSrcBlock, const int32_t kiBlockSize, SMVUnitXY sTargetMv, const int32_t kiRefPicStride, |
| 13 | uint8_t* pRefPic) | 13 | uint8_t* pRefPic) { |
| 14 | { | ||
| 15 | uint8_t* pTargetPos = pRefPic+sTargetMv.iMvY*kiRefPicStride+sTargetMv.iMvX; | 14 | uint8_t* pTargetPos = pRefPic+sTargetMv.iMvY*kiRefPicStride+sTargetMv.iMvX; |
| 16 | uint8_t* pSourcePos = pSrcBlock; | 15 | uint8_t* pSourcePos = pSrcBlock; |
| 17 | 16 | ||
| @@ -24,8 +23,7 @@ void CopyTargetBlock( uint8_t* pSrcBlock, const int32_t kiBlockSize, SMVUnitXY s · 6 unmodified lines | |||
| 24 | 23 | ||
| 25 | 24 | ||
| 26 | void InitMe( const uint8_t kuiQp, const uint32_t kuiMvdTableMiddle, const uint32_t kuiMvdTableStride, | 25 | void InitMe( const uint8_t kuiQp, const uint32_t kuiMvdTableMiddle, const uint32_t kuiMvdTableStride, |
| 27 | uint16_t* pMvdCostTable, SWelsME* pMe) | 26 | uint16_t* pMvdCostTable, SWelsME* pMe) { |
| 28 | { | ||
| 29 | MvdCostInit( pMvdCostTable, kuiMvdTableStride ); | 27 | MvdCostInit( pMvdCostTable, kuiMvdTableStride ); |
| 30 | pMe->pMvdCost = &pMvdCostTable[kuiQp*kuiMvdTableStride + kuiMvdTableMiddle]; | 28 | pMe->pMvdCost = &pMvdCostTable[kuiQp*kuiMvdTableStride + kuiMvdTableMiddle]; |
| 31 | pMe->sMvp.iMvX = pMe->sMvp.iMvY = 0; | 29 | pMe->sMvp.iMvX = pMe->sMvp.iMvY = 0; |
| @@ -71,8 +69,7 @@ public: · 39 unmodified lines | |||
| 71 | }; | 69 | }; |
| 72 | 70 | ||
| 73 | 71 | ||
| 74 | TEST_F(MotionEstimateTest, TestDiamondSearch) | 72 | TEST_F(MotionEstimateTest, TestDiamondSearch) { |
| 75 | { | ||
| 76 | #define TEST_POS (5) | 73 | #define TEST_POS (5) |
| 77 | const int32_t kiPositionToCheck[TEST_POS][2] = {{0,0}, {0,1}, {1,0}, {0,-1}, {-1,0}}; | 74 | const int32_t kiPositionToCheck[TEST_POS][2] = {{0,0}, {0,1}, {1,0}, {0,-1}, {-1,0}}; |
| 78 | const int32_t kiMaxBlock16Sad = 72000;//a rough number | 75 | const int32_t kiMaxBlock16Sad = 72000;//a rough number |
| @@ -125,8 +122,7 @@ TEST_F(MotionEstimateTest, TestDiamondSearch) · 46 unmodified lines | |||
| 125 | } | 122 | } |
| 126 | 123 | ||
| 127 | 124 | ||
| 128 | TEST_F(MotionEstimateTest, TestVerticalSearch) | 125 | TEST_F(MotionEstimateTest, TestVerticalSearch) { |
| 129 | { | ||
| 130 | const int32_t kiMaxBlock16Sad = 72000;//a rough number | 126 | const int32_t kiMaxBlock16Sad = 72000;//a rough number |
| 131 | SWelsFuncPtrList sFuncList; | 127 | SWelsFuncPtrList sFuncList; |
| 132 | SWelsME sMe; | 128 | SWelsME sMe; |
| @@ -187,8 +183,7 @@ TEST_F(MotionEstimateTest, TestVerticalSearch) · 54 unmodified lines | |||
| 187 | //it is possible that ref at differnt position is identical, but that should be under a low probability | 183 | //it is possible that ref at differnt position is identical, but that should be under a low probability |
| 188 | } | 184 | } |
| 189 | } | 185 | } |
| 190 | TEST_F(MotionEstimateTest, TestHorizontalSearch) | 186 | TEST_F(MotionEstimateTest, TestHorizontalSearch) { |
| 191 | { | ||
| 192 | const int32_t kiMaxBlock16Sad = 72000;//a rough number | 187 | const int32_t kiMaxBlock16Sad = 72000;//a rough number |
| 193 | SWelsFuncPtrList sFuncList; | 188 | SWelsFuncPtrList sFuncList; |
| 194 | SWelsME sMe; | 189 | SWelsME sMe; |
| @@ -1,5 +1,6 @@ | |||
| 1 | ENCODER_UNITTEST_SRCDIR=test/encoder | 1 | ENCODER_UNITTEST_SRCDIR=test/encoder |
| 2 | ENCODER_UNITTEST_CPP_SRCS=\ | 2 | ENCODER_UNITTEST_CPP_SRCS=\ |
| 3 | $(ENCODER_UNITTEST_SRCDIR)/EncUT_EncoderMbTest.cpp\ | ||
| 3 | $(ENCODER_UNITTEST_SRCDIR)/EncUT_ExpandPic.cpp\ | 4 | $(ENCODER_UNITTEST_SRCDIR)/EncUT_ExpandPic.cpp\ |
| 4 | $(ENCODER_UNITTEST_SRCDIR)/EncUT_MemoryAlloc.cpp\ | 5 | $(ENCODER_UNITTEST_SRCDIR)/EncUT_MemoryAlloc.cpp\ |
| 5 | $(ENCODER_UNITTEST_SRCDIR)/EncUT_MotionEstimate.cpp\ | 6 | $(ENCODER_UNITTEST_SRCDIR)/EncUT_MotionEstimate.cpp\ |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | |||
| 5 | 5 | ||
| 6 | bool YUVPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride ); | 6 | bool YUVPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride ); |
| 7 | 7 | ||
| 8 | void RandomPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride ); | 8 | void RandomPixelDataGenerator( uint8_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride, int32_t iIdx ); |
| 9 | 9 | ||
| 10 | void RandomResidueDataGenerator( uint16_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride ); | 10 | void RandomResidueDataGenerator( uint16_t* pPointer, int32_t iWidth, int32_t iHeight, int32_t iStride ); |
| 11 | 11 | ||