1 #include <gtest/gtest.h> 2 #include "utils/FileInputStream.h" 3 #include "svc_encode_slice.h" 4 5 //level 5.2, table A-6, Max frame rates setting 6 #define MAX_WIDTH (4096) 7 #define MAX_HEIGH (2304) 8 #define MAX_SAMPLES_PER_SECOND (530841600) 9 10 #define MAX_QP (51) 11 #define MIN_QP (0) 12 13 class CSliceBufferReallocatTest : public ::testing::Test { //WithParamInterface<EncodeFileParam>{ 14 public: SetUp()15 virtual void SetUp() { 16 m_pEncoder = NULL; 17 int32_t iRet = WelsCreateSVCEncoder (&m_pEncoder); 18 ASSERT_EQ (0, iRet); 19 ASSERT_TRUE (m_pEncoder != NULL); 20 21 int32_t iCacheLineSize = 16; 22 m_EncContext.pMemAlign = new CMemoryAlign (iCacheLineSize); 23 ASSERT_TRUE (NULL != m_EncContext.pMemAlign); 24 25 SWelsSvcCodingParam* pCodingParam = (SWelsSvcCodingParam*)m_EncContext.pMemAlign->WelsMalloc (sizeof ( 26 SWelsSvcCodingParam), 27 "SWelsSvcCodingParam"); 28 ASSERT_TRUE (NULL != pCodingParam); 29 m_EncContext.pSvcParam = pCodingParam; 30 31 iRet = m_pEncoder->GetDefaultParams (m_EncContext.pSvcParam); 32 ASSERT_EQ (0, iRet); 33 } 34 TearDown()35 virtual void TearDown() { 36 WelsDestroySVCEncoder (m_pEncoder); 37 m_pEncoder = NULL; 38 if (NULL != m_EncContext.pSvcParam) { 39 m_EncContext.pMemAlign->WelsFree (m_EncContext.pSvcParam, "SWelsSvcCodingParam"); 40 m_EncContext.pSvcParam = NULL; 41 } 42 43 if (m_EncContext.pMemAlign != NULL) { 44 delete m_EncContext.pMemAlign; 45 m_EncContext.pMemAlign = NULL; 46 } 47 } 48 49 void SimulateEncodedOneSlice (const int32_t kiSlcIdx, const int32_t kiThreadIdx); 50 void SimulateSliceInOnePartition (const int32_t kiPartNum, const int32_t kiPartIdx, const int32_t kiSlcNumInPart); 51 void SimulateSliceInOneLayer(); 52 53 int InitParamForTestCase (int32_t iLayerIdx); 54 int InitParamForSizeLimitSlcModeCase (int32_t iLayerIdx); 55 void UnInitParamForTestCase (int32_t iLayerIdx); 56 57 int InitParam(); 58 void UnInitParam(); 59 60 int InitFrameBsBuffer(); 61 void UnInitFrameBsBuffer(); 62 63 int InitLayerSliceBuffer (const int32_t iLayerIdx); 64 void UnInitLayerSliceBuffer (const int32_t iLayerIdx); 65 66 ISVCEncoder* m_pEncoder; 67 sWelsEncCtx m_EncContext; 68 69 private: 70 71 }; 72