MCPcopy Create free account
hub / github.com/cisco/openh264 / DecodeParseAPI

Class DecodeParseAPI

test/api/decode_api_test.cpp:789–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787};
788
789class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase>, public EncodeDecodeTestBase {
790 public:
791 DecodeParseAPI() {
792 memset (&BsInfo_, 0, sizeof (SParserBsInfo));
793 fYuv_ = NULL;
794 iWidth_ = 0;
795 iHeight_ = 0;
796 memset (&ctx_, 0, sizeof (SHA1Context));
797 }
798 void SetUp() {
799 SHA1Reset (&ctx_);
800 EncodeDecodeTestBase::SetUp();
801
802 if (decoder_)
803 decoder_->Uninitialize();
804 SDecodingParam decParam;
805 memset (&decParam, 0, sizeof (SDecodingParam));
806 decParam.uiTargetDqLayer = UCHAR_MAX;
807 decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
808 decParam.bParseOnly = true;
809 decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
810
811 int rv = decoder_->Initialize (&decParam);
812 ASSERT_EQ (0, rv);
813 memset (&BsInfo_, 0, sizeof (SParserBsInfo));
814 const char* sFileName = "res/CiscoVT2people_160x96_6fps.yuv";
815#if defined(ANDROID_NDK)
816 std::string filename = std::string ("/sdcard/") + sFileName;
817 ASSERT_TRUE ((fYuv_ = fopen (filename.c_str(), "rb")) != NULL);
818#else
819 ASSERT_TRUE ((fYuv_ = fopen (sFileName, "rb")) != NULL);
820#endif
821 iWidth_ = kiWidth;
822 iHeight_ = kiHeight;
823 }
824 void TearDown() {
825 EncodeDecodeTestBase::TearDown();
826 if (fYuv_ != NULL) {
827 fclose (fYuv_);
828 fYuv_ = NULL;
829 }
830 }
831
832 bool prepareEncDecParam (const EncodeDecodeFileParamBase p) {
833 if (!EncodeDecodeTestBase::prepareEncDecParam (p))
834 return false;
835 unsigned char* pTmpPtr = BsInfo_.pDstBuff; //store for restore
836 memset (&BsInfo_, 0, sizeof (SParserBsInfo));
837 BsInfo_.pDstBuff = pTmpPtr;
838 return true;
839 }
840
841 void MockInputData (uint8_t* pData, int32_t iSize) {
842 int32_t iCurr = 0;
843 while (iCurr < iSize) {
844 * (pData + iCurr) = (* (pData + iCurr) + (rand() % 20) + 256) & 0x00ff;
845 iCurr++;
846 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected