History

refine decoder side intrapred unit test, test assembly routine only when the cpu feature can support it

Licai Guo committed 12 years ago

Commit c1cab641 parent 4ba216b1 file · +93 −70Browse files

Showing the changes to test/decoder/DecUT_IntraPrediction.cpp (1 of 1 file). Show all

Unified · Split

test/decoder/DecUT_IntraPrediction.cpp+93−70
@@ -1,15 +1,24 @@
1#include<gtest/gtest.h>1#include<gtest/gtest.h>
2#include <time.h>2#include <time.h>
3#include "cpu.h"
4#include "cpu_core.h"
3#include "get_intra_predictor.h"5#include "get_intra_predictor.h"
4#include "typedefs.h"6#include "typedefs.h"
5#include "ls_defines.h"7#include "ls_defines.h"
6using namespace WelsDec;8using namespace WelsDec;
7#define GENERATE_4x4_UT(pred, ref) \9#define GENERATE_4x4_UT(pred, ref, ASM, CPUFLAGS) \
8 TEST(DecoderIntraPredictionTest, pred) { \10 TEST(DecoderIntraPredictionTest, pred) { \
9 const int32_t kiStride = 32; \11 const int32_t kiStride = 32; \
10 int32_t iRunTimes = 1000; \12 int32_t iRunTimes = 1000; \
11 uint8_t pPredBuffer[9 * kiStride]; \13 uint8_t pPredBuffer[9 * kiStride]; \
12 uint8_t pRefBuffer[9 * kiStride]; \14 uint8_t pRefBuffer[9 * kiStride]; \
15if (ASM) {\
16 int32_t iNumberofCPUCore = 1; \
17 uint32_t uiCPUFlags = WelsCPUFeatureDetect( &iNumberofCPUCore); \
18 if ((uiCPUFlags & CPUFLAGS) == 0) {\
19 return; \
20 } \
21}\
13 srand((unsigned int)time(NULL)); \22 srand((unsigned int)time(NULL)); \
14 while(iRunTimes--) {\23 while(iRunTimes--) {\
15 for (int i = 0; i < 9; i++) {\24 for (int i = 0; i < 9; i++) {\
@@ -342,38 +351,45 @@ void WelsI4x4LumaPredHD_ref (uint8_t* pPred, const int32_t kiStride) { · 326 unmodified lines
342}351}
343// Unit test for Luma 4x4 cases352// Unit test for Luma 4x4 cases
344PREDV (4)353PREDV (4)
345GENERATE_4x4_UT (WelsI4x4LumaPredV_c, LumaI4x4PredV)354GENERATE_4x4_UT (WelsI4x4LumaPredV_c, LumaI4x4PredV, 0, 0)
346 355
347PREDH (4)356PREDH (4)
348GENERATE_4x4_UT (WelsI4x4LumaPredH_c, LumaI4x4PredH)357GENERATE_4x4_UT (WelsI4x4LumaPredH_c, LumaI4x4PredH, 0, 0)
349 358
350PREDDC (4, 2)359PREDDC (4, 2)
351GENERATE_4x4_UT (WelsI4x4LumaPredDc_c, LumaI4x4PredDC)360GENERATE_4x4_UT (WelsI4x4LumaPredDc_c, LumaI4x4PredDC, 0, 0)
352 361
353PREDDCLeft (4, 2)362PREDDCLeft (4, 2)
354GENERATE_4x4_UT (WelsI4x4LumaPredDcLeft_c, LumaI4x4PredDCLeft)363GENERATE_4x4_UT (WelsI4x4LumaPredDcLeft_c, LumaI4x4PredDCLeft, 0, 0)
355 364
356PREDDCTop (4, 2)365PREDDCTop (4, 2)
357GENERATE_4x4_UT (WelsI4x4LumaPredDcTop_c, LumaI4x4PredDCTop)366GENERATE_4x4_UT (WelsI4x4LumaPredDcTop_c, LumaI4x4PredDCTop, 0, 0)
358 367
359PREDDCNone (4, 2)368PREDDCNone (4, 2)
360GENERATE_4x4_UT (WelsI4x4LumaPredDcNA_c, LumaI4x4PredDCNone)369GENERATE_4x4_UT (WelsI4x4LumaPredDcNA_c, LumaI4x4PredDCNone, 0, 0)
361GENERATE_4x4_UT (WelsI4x4LumaPredDDL_c, WelsI4x4LumaPredDDL_ref)370GENERATE_4x4_UT (WelsI4x4LumaPredDDL_c, WelsI4x4LumaPredDDL_ref, 0, 0)
362GENERATE_4x4_UT (WelsI4x4LumaPredDDLTop_c, WelsI4x4LumaPredDDLTop_ref)371GENERATE_4x4_UT (WelsI4x4LumaPredDDLTop_c, WelsI4x4LumaPredDDLTop_ref, 0, 0)
363GENERATE_4x4_UT (WelsI4x4LumaPredDDR_c, WelsI4x4LumaPredDDR_ref)372GENERATE_4x4_UT (WelsI4x4LumaPredDDR_c, WelsI4x4LumaPredDDR_ref, 0, 0)
364GENERATE_4x4_UT (WelsI4x4LumaPredVR_c, WelsI4x4LumaPredVR_ref)373GENERATE_4x4_UT (WelsI4x4LumaPredVR_c, WelsI4x4LumaPredVR_ref, 0, 0)
365GENERATE_4x4_UT (WelsI4x4LumaPredVL_c, WelsI4x4LumaPredVL_ref)374GENERATE_4x4_UT (WelsI4x4LumaPredVL_c, WelsI4x4LumaPredVL_ref, 0, 0)
366GENERATE_4x4_UT (WelsI4x4LumaPredVLTop_c, WelsI4x4LumaPredVLTop_ref)375GENERATE_4x4_UT (WelsI4x4LumaPredVLTop_c, WelsI4x4LumaPredVLTop_ref, 0, 0)
367GENERATE_4x4_UT (WelsI4x4LumaPredHU_c, WelsI4x4LumaPredHU_ref)376GENERATE_4x4_UT (WelsI4x4LumaPredHU_c, WelsI4x4LumaPredHU_ref, 0, 0)
368GENERATE_4x4_UT (WelsI4x4LumaPredHD_c, WelsI4x4LumaPredHD_ref)377GENERATE_4x4_UT (WelsI4x4LumaPredHD_c, WelsI4x4LumaPredHD_ref, 0, 0)
369 378
370#define GENERATE_8x8_UT(pred, ref) \379#define GENERATE_8x8_UT(pred, ref, ASM, CPUFLAGS) \
371TEST(DecoderIntraPredictionTest, pred) {\380TEST(DecoderIntraPredictionTest, pred) {\
372const int32_t kiStride = 32; \381const int32_t kiStride = 32; \
373int iRunTimes = 1000; \382int iRunTimes = 1000; \
374uint8_t _pRefBuffer[18 * kiStride + 64]; \383uint8_t _pRefBuffer[18 * kiStride + 64]; \
375uint8_t _pPredBuffer[18 * kiStride + 64]; \384uint8_t _pPredBuffer[18 * kiStride + 64]; \
376uint8_t *pRefBuffer, *pPredBuffer; \385uint8_t *pRefBuffer, *pPredBuffer; \
386if (ASM) { \
387 int32_t iTmp = 1; \
388 uint32_t uiCPUFlags = WelsCPUFeatureDetect(&iTmp); \
389 if ((uiCPUFlags & CPUFLAGS) == 0) {\
390 return; \
391 } \
392} \
377pRefBuffer = (uint8_t*)((((intptr_t)(&_pRefBuffer[31])) >> 4) << 4); \393pRefBuffer = (uint8_t*)((((intptr_t)(&_pRefBuffer[31])) >> 4) << 4); \
378pPredBuffer = (uint8_t*)((((intptr_t)(&_pPredBuffer[31])) >> 4) << 4); \394pPredBuffer = (uint8_t*)((((intptr_t)(&_pPredBuffer[31])) >> 4) << 4); \
379srand((unsigned int)time(NULL)); \395srand((unsigned int)time(NULL)); \
@@ -494,20 +510,27 @@ void WelsIChromaPredDcTop_ref (uint8_t* pPred, const int32_t kiStride) { · 114 unmodified lines
494PREDV (8)510PREDV (8)
495PREDH (8)511PREDH (8)
496PREDDCNone (8, 3)512PREDDCNone (8, 3)
497GENERATE_8x8_UT (WelsIChromaPredDcNA_c, LumaI8x8PredDCNone)513GENERATE_8x8_UT (WelsIChromaPredDcNA_c, LumaI8x8PredDCNone, 0, 0)
498GENERATE_8x8_UT (WelsIChromaPredPlane_c, WelsIChromaPredPlane_ref)514GENERATE_8x8_UT (WelsIChromaPredPlane_c, WelsIChromaPredPlane_ref, 0, 0)
499GENERATE_8x8_UT (WelsIChromaPredDc_c, WelsIChromaPredDc_ref)515GENERATE_8x8_UT (WelsIChromaPredDc_c, WelsIChromaPredDc_ref, 0, 0)
500GENERATE_8x8_UT (WelsIChromaPredDcTop_c, WelsIChromaPredDcTop_ref)516GENERATE_8x8_UT (WelsIChromaPredDcTop_c, WelsIChromaPredDcTop_ref, 0, 0)
501GENERATE_8x8_UT (WelsIChromaPredDcLeft_c, WelsIChromaPredDcLeft_ref)517GENERATE_8x8_UT (WelsIChromaPredDcLeft_c, WelsIChromaPredDcLeft_ref, 0, 0)
502GENERATE_8x8_UT (WelsIChromaPredH_c, LumaI8x8PredH)518GENERATE_8x8_UT (WelsIChromaPredH_c, LumaI8x8PredH, 0, 0)
503GENERATE_8x8_UT (WelsIChromaPredV_c, LumaI8x8PredV)519GENERATE_8x8_UT (WelsIChromaPredV_c, LumaI8x8PredV, 0, 0)
504#define GENERATE_16x16_UT(pred, ref) \520#define GENERATE_16x16_UT(pred, ref, ASM, CPUFLAGS) \
505TEST(DecoderIntraPredictionTest, pred) {\521TEST(DecoderIntraPredictionTest, pred) {\
506const int32_t kiStride = 32; \522const int32_t kiStride = 32; \
507int32_t iRunTimes = 1000; \523int32_t iRunTimes = 1000; \
508uint8_t _pRefBuffer[18 * kiStride + 64]; \524uint8_t _pRefBuffer[18 * kiStride + 64]; \
509uint8_t _pPredBuffer[18 * kiStride + 64]; \525uint8_t _pPredBuffer[18 * kiStride + 64]; \
510uint8_t *pRefBuffer, *pPredBuffer; \526uint8_t *pRefBuffer, *pPredBuffer; \
527if (ASM) { \
528 int32_t iTmp = 1; \
529 uint32_t uiCPUFlags = WelsCPUFeatureDetect( &iTmp); \
530 if ((uiCPUFlags & CPUFLAGS) == 0) {\
531 return ; \
532 } \
533}\
511pRefBuffer = (uint8_t*)((((intptr_t)(&_pRefBuffer[31])) >> 4) << 4); \534pRefBuffer = (uint8_t*)((((intptr_t)(&_pRefBuffer[31])) >> 4) << 4); \
512pPredBuffer = (uint8_t*)((((intptr_t)(&_pPredBuffer[31])) >> 4) << 4); \535pPredBuffer = (uint8_t*)((((intptr_t)(&_pPredBuffer[31])) >> 4) << 4); \
513srand((unsigned int)time(NULL)); \536srand((unsigned int)time(NULL)); \
@@ -559,53 +582,53 @@ PREDDCTop (16, 4) · 45 unmodified lines
559PREDDCLeft (16, 4)582PREDDCLeft (16, 4)
560PREDDCNone (16, 4)583PREDDCNone (16, 4)
561 584
562GENERATE_16x16_UT (WelsI16x16LumaPredDcNA_c, LumaI16x16PredDCNone)585GENERATE_16x16_UT (WelsI16x16LumaPredDcNA_c, LumaI16x16PredDCNone, 0, 0)
563GENERATE_16x16_UT (WelsI16x16LumaPredPlane_c, WelsI16x16LumaPredPlane_ref)586GENERATE_16x16_UT (WelsI16x16LumaPredPlane_c, WelsI16x16LumaPredPlane_ref, 0, 0)
564GENERATE_16x16_UT (WelsI16x16LumaPredDcLeft_c, LumaI16x16PredDCLeft)587GENERATE_16x16_UT (WelsI16x16LumaPredDcLeft_c, LumaI16x16PredDCLeft, 0, 0)
565GENERATE_16x16_UT (WelsI16x16LumaPredDcTop_c, LumaI16x16PredDCTop)588GENERATE_16x16_UT (WelsI16x16LumaPredDcTop_c, LumaI16x16PredDCTop, 0, 0)
566GENERATE_16x16_UT (WelsI16x16LumaPredDc_c, LumaI16x16PredDC)589GENERATE_16x16_UT (WelsI16x16LumaPredDc_c, LumaI16x16PredDC, 0, 0)
567GENERATE_16x16_UT (WelsI16x16LumaPredH_c, LumaI16x16PredH)590GENERATE_16x16_UT (WelsI16x16LumaPredH_c, LumaI16x16PredH, 0, 0)
568GENERATE_16x16_UT (WelsI16x16LumaPredV_c, LumaI16x16PredV)591GENERATE_16x16_UT (WelsI16x16LumaPredV_c, LumaI16x16PredV, 0, 0)
569#if defined(X86_ASM)592#if defined(X86_ASM)
570GENERATE_4x4_UT (WelsDecoderI4x4LumaPredH_sse2, LumaI4x4PredH)593GENERATE_4x4_UT (WelsDecoderI4x4LumaPredH_sse2, LumaI4x4PredH, 1, WELS_CPU_SSE2)
571GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDR_mmx, WelsI4x4LumaPredDDR_ref)594GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDR_mmx, WelsI4x4LumaPredDDR_ref, 1, WELS_CPU_MMX)
572GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHD_mmx, WelsI4x4LumaPredHD_ref)595GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHD_mmx, WelsI4x4LumaPredHD_ref, 1, WELS_CPU_MMX)
573GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHU_mmx, WelsI4x4LumaPredHU_ref)596GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHU_mmx, WelsI4x4LumaPredHU_ref, 1, WELS_CPU_MMX)
574GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVR_mmx, WelsI4x4LumaPredVR_ref)597GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVR_mmx, WelsI4x4LumaPredVR_ref, 1, WELS_CPU_MMX)
575GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDL_mmx, WelsI4x4LumaPredDDL_ref)598GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDL_mmx, WelsI4x4LumaPredDDL_ref, 1, WELS_CPU_MMX)
576GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVL_mmx, WelsI4x4LumaPredVL_ref)599GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVL_mmx, WelsI4x4LumaPredVL_ref, 1, WELS_CPU_MMX)
577GENERATE_8x8_UT (WelsDecoderIChromaPredDcTop_sse2, WelsIChromaPredDcTop_ref)600GENERATE_8x8_UT (WelsDecoderIChromaPredDcTop_sse2, WelsIChromaPredDcTop_ref, 1, WELS_CPU_SSE2)
578GENERATE_8x8_UT (WelsDecoderIChromaPredDc_sse2, WelsIChromaPredDc_ref)601GENERATE_8x8_UT (WelsDecoderIChromaPredDc_sse2, WelsIChromaPredDc_ref, 1, WELS_CPU_SSE2)
579GENERATE_8x8_UT (WelsDecoderIChromaPredPlane_sse2, WelsIChromaPredPlane_ref)602GENERATE_8x8_UT (WelsDecoderIChromaPredPlane_sse2, WelsIChromaPredPlane_ref, 1, WELS_CPU_SSE2)
580GENERATE_8x8_UT (WelsDecoderIChromaPredH_mmx, LumaI8x8PredH)603GENERATE_8x8_UT (WelsDecoderIChromaPredH_mmx, LumaI8x8PredH, 1, WELS_CPU_MMX)
581GENERATE_8x8_UT (WelsDecoderIChromaPredV_mmx, LumaI8x8PredV)604GENERATE_8x8_UT (WelsDecoderIChromaPredV_mmx, LumaI8x8PredV, 1, WELS_CPU_MMX)
582GENERATE_8x8_UT (WelsDecoderIChromaPredDcLeft_mmx, WelsIChromaPredDcLeft_ref)605GENERATE_8x8_UT (WelsDecoderIChromaPredDcLeft_mmx, WelsIChromaPredDcLeft_ref, 1, WELS_CPU_MMX)
583GENERATE_8x8_UT (WelsDecoderIChromaPredDcNA_mmx, LumaI8x8PredDCNone)606GENERATE_8x8_UT (WelsDecoderIChromaPredDcNA_mmx, LumaI8x8PredDCNone, 1, WELS_CPU_MMX)
584GENERATE_16x16_UT (WelsDecoderI16x16LumaPredPlane_sse2, WelsI16x16LumaPredPlane_ref)607GENERATE_16x16_UT (WelsDecoderI16x16LumaPredPlane_sse2, WelsI16x16LumaPredPlane_ref, 1, WELS_CPU_SSE2)
585GENERATE_16x16_UT (WelsDecoderI16x16LumaPredH_sse2, LumaI16x16PredH)608GENERATE_16x16_UT (WelsDecoderI16x16LumaPredH_sse2, LumaI16x16PredH, 1, WELS_CPU_SSE2)
586GENERATE_16x16_UT (WelsDecoderI16x16LumaPredV_sse2, LumaI16x16PredV)609GENERATE_16x16_UT (WelsDecoderI16x16LumaPredV_sse2, LumaI16x16PredV, 1, WELS_CPU_SSE2)
587GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDc_sse2, LumaI16x16PredDC)610GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDc_sse2, LumaI16x16PredDC, 1, WELS_CPU_SSE2)
588GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDcTop_sse2, LumaI16x16PredDCTop)611GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDcTop_sse2, LumaI16x16PredDCTop, 1, WELS_CPU_SSE2)
589GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDcNA_sse2, LumaI16x16PredDCNone)612GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDcNA_sse2, LumaI16x16PredDCNone, 1, WELS_CPU_SSE2)
590#endif613#endif
591 614
592#if defined(HAVE_NEON)615#if defined(HAVE_NEON)
593GENERATE_16x16_UT (WelsDecoderI16x16LumaPredV_neon, LumaI16x16PredV)616GENERATE_16x16_UT (WelsDecoderI16x16LumaPredV_neon, LumaI16x16PredV, 1, WELS_CPU_NEON)
594GENERATE_16x16_UT (WelsDecoderI16x16LumaPredH_neon, LumaI16x16PredH)617GENERATE_16x16_UT (WelsDecoderI16x16LumaPredH_neon, LumaI16x16PredH, 1, WELS_CPU_NEON)
595GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDc_neon, LumaI16x16PredDC)618GENERATE_16x16_UT (WelsDecoderI16x16LumaPredDc_neon, LumaI16x16PredDC, 1, WELS_CPU_NEON)
596GENERATE_16x16_UT (WelsDecoderI16x16LumaPredPlane_neon, WelsI16x16LumaPredPlane_ref)619GENERATE_16x16_UT (WelsDecoderI16x16LumaPredPlane_neon, WelsI16x16LumaPredPlane_ref, 1, WELS_CPU_NEON)
597 620
598GENERATE_4x4_UT (WelsDecoderI4x4LumaPredV_neon, LumaI4x4PredV)621GENERATE_4x4_UT (WelsDecoderI4x4LumaPredV_neon, LumaI4x4PredV, 1, WELS_CPU_NEON)
599GENERATE_4x4_UT (WelsDecoderI4x4LumaPredH_neon, LumaI4x4PredH)622GENERATE_4x4_UT (WelsDecoderI4x4LumaPredH_neon, LumaI4x4PredH, 1, WELS_CPU_NEON)
600GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDL_neon, WelsI4x4LumaPredDDL_ref)623GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDL_neon, WelsI4x4LumaPredDDL_ref, 1, WELS_CPU_NEON)
601GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDR_neon, WelsI4x4LumaPredDDR_ref)624GENERATE_4x4_UT (WelsDecoderI4x4LumaPredDDR_neon, WelsI4x4LumaPredDDR_ref, 1, WELS_CPU_NEON)
602GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVL_neon, WelsI4x4LumaPredVL_ref)625GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVL_neon, WelsI4x4LumaPredVL_ref, 1, WELS_CPU_NEON)
603GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVR_neon, WelsI4x4LumaPredVR_ref)626GENERATE_4x4_UT (WelsDecoderI4x4LumaPredVR_neon, WelsI4x4LumaPredVR_ref, 1, WELS_CPU_NEON)
604GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHU_neon, WelsI4x4LumaPredHU_ref)627GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHU_neon, WelsI4x4LumaPredHU_ref, 1, WELS_CPU_NEON)
605GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHD_neon, WelsI4x4LumaPredHD_ref)628GENERATE_4x4_UT (WelsDecoderI4x4LumaPredHD_neon, WelsI4x4LumaPredHD_ref, 1, WELS_CPU_NEON)
606 629
607GENERATE_8x8_UT (WelsDecoderIChromaPredV_neon, LumaI8x8PredV)630GENERATE_8x8_UT (WelsDecoderIChromaPredV_neon, LumaI8x8PredV, 1, WELS_CPU_NEON)
608GENERATE_8x8_UT (WelsDecoderIChromaPredH_neon, LumaI8x8PredH)631GENERATE_8x8_UT (WelsDecoderIChromaPredH_neon, LumaI8x8PredH, 1, WELS_CPU_NEON)
609GENERATE_8x8_UT (WelsDecoderIChromaPredDc_neon, WelsIChromaPredDc_ref)632GENERATE_8x8_UT (WelsDecoderIChromaPredDc_neon, WelsIChromaPredDc_ref, 1, WELS_CPU_NEON)
610GENERATE_8x8_UT (WelsDecoderIChromaPredPlane_neon, WelsIChromaPredPlane_ref)633GENERATE_8x8_UT (WelsDecoderIChromaPredPlane_neon, WelsIChromaPredPlane_ref, 1, WELS_CPU_NEON)
611#endif634#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t