From 1d889b6a10c3d6ce5f03faae2126a0d143c2f7d0 Mon Sep 17 00:00:00 2001 From: zaki Date: Wed, 16 Aug 2023 16:41:25 +0530 Subject: [PATCH] uncommented tests --- base/test/h264Encodernvcodec_tests.cpp | 182 ++++++++++++------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/base/test/h264Encodernvcodec_tests.cpp b/base/test/h264Encodernvcodec_tests.cpp index 1a6df988e..beb644328 100644 --- a/base/test/h264Encodernvcodec_tests.cpp +++ b/base/test/h264Encodernvcodec_tests.cpp @@ -272,96 +272,96 @@ BOOST_AUTO_TEST_CASE(mono_1920x960, Test_Utils::saveOrCompare(fileComparePath.c_str(), (const unsigned char*)frameData, (size_t)frameSize, 0); } -//BOOST_AUTO_TEST_CASE(yuv420_640x360_pipeline, *boost::unit_test::disabled()) -//{ -// std::cout << "starting performance measurement" << std::endl; -// auto cuContext = apracucontext_sp(new ApraCUcontext()); -// // metadata is known -// auto width = 640; -// auto height = 360; -// -// auto fileReaderProps = FileReaderModuleProps("./data/Raw_YUV420_640x360/Image???_YUV420.raw"); -// fileReaderProps.fps = 10000; -// auto fileReader = boost::shared_ptr(new FileReaderModule(fileReaderProps)); -// auto metadata = framemetadata_sp(new RawImagePlanarMetadata(width, height, ImageMetadata::ImageType::YUV420, size_t(0), CV_8U)); -// -// auto rawImagePin = fileReader->addOutputPin(metadata); -// -// cudastream_sp cudaStream_ = boost::shared_ptr(new ApraCudaStream());; -// auto copyProps = CudaMemCopyProps(cudaMemcpyHostToDevice, cudaStream_); -// copyProps.sync = true; -// auto copy = boost::shared_ptr(new CudaMemCopy(copyProps)); -// fileReader->setNext(copy); -// -// H264EncoderNVCodecProps encoderProps(cuContext); -// encoderProps.logHealth = true; -// auto encoder = boost::shared_ptr(new H264EncoderNVCodec(encoderProps)); -// copy->setNext(encoder); -// -// auto sink = boost::shared_ptr(new StatSink()); -// encoder->setNext(sink); -// -// PipeLine p("test"); -// p.appendModule(fileReader); -// BOOST_TEST(p.init()); -// -// Logger::setLogLevel(boost::log::trivial::severity_level::info); -// p.run_all_threaded(); -// -// boost::this_thread::sleep_for(boost::chrono::seconds(20)); -// p.stop(); -// p.term(); -// -// p.wait_for_all(); -// -//} -// -//BOOST_AUTO_TEST_CASE(mono_1920x960_pipeline, *boost::unit_test::disabled()) -//{ -// auto cuContext = apracucontext_sp(new ApraCUcontext()); -// auto width = 1920; -// auto height = 960; -// -// auto fileReaderProps = FileReaderModuleProps("./data/mono_1920x960.raw"); -// fileReaderProps.fps = 10000; -// auto fileReader = boost::shared_ptr(new FileReaderModule(fileReaderProps)); -// auto metadata = framemetadata_sp(new RawImageMetadata(width, height, ImageMetadata::ImageType::MONO, CV_8UC1, 0, CV_8U, FrameMetadata::HOST, true)); -// -// auto rawImagePin = fileReader->addOutputPin(metadata); -// -// cudastream_sp cudaStream_ = boost::shared_ptr(new ApraCudaStream()); -// auto copyProps = CudaMemCopyProps(cudaMemcpyHostToDevice, cudaStream_); -// auto copy = boost::shared_ptr(new CudaMemCopy(copyProps)); -// fileReader->setNext(copy); -// -// auto cc = boost::shared_ptr(new CCNPPI(CCNPPIProps(ImageMetadata::YUV420, cudaStream_))); -// copy->setNext(cc); -// -// auto sync = boost::shared_ptr(new CudaStreamSynchronize(CudaStreamSynchronizeProps(cudaStream_))); -// cc->setNext(sync); -// -// H264EncoderNVCodecProps encoderProps(cuContext); -// encoderProps.logHealth = true; -// auto encoder = boost::shared_ptr(new H264EncoderNVCodec(encoderProps)); -// sync->setNext(encoder); -// -// auto sink = boost::shared_ptr(new StatSink()); -// encoder->setNext(sink); -// -// PipeLine p("test"); -// p.appendModule(fileReader); -// BOOST_TEST(p.init()); -// -// Logger::setLogLevel(boost::log::trivial::severity_level::info); -// p.run_all_threaded(); -// -// boost::this_thread::sleep_for(boost::chrono::seconds(20)); -// -// p.stop(); -// p.term(); -// -// p.wait_for_all(); -// -//} +BOOST_AUTO_TEST_CASE(yuv420_640x360_pipeline, *boost::unit_test::disabled()) +{ + std::cout << "starting performance measurement" << std::endl; + auto cuContext = apracucontext_sp(new ApraCUcontext()); + // metadata is known + auto width = 640; + auto height = 360; + + auto fileReaderProps = FileReaderModuleProps("./data/Raw_YUV420_640x360/Image???_YUV420.raw"); + fileReaderProps.fps = 10000; + auto fileReader = boost::shared_ptr(new FileReaderModule(fileReaderProps)); + auto metadata = framemetadata_sp(new RawImagePlanarMetadata(width, height, ImageMetadata::ImageType::YUV420, size_t(0), CV_8U)); + + auto rawImagePin = fileReader->addOutputPin(metadata); + + cudastream_sp cudaStream_ = boost::shared_ptr(new ApraCudaStream());; + auto copyProps = CudaMemCopyProps(cudaMemcpyHostToDevice, cudaStream_); + copyProps.sync = true; + auto copy = boost::shared_ptr(new CudaMemCopy(copyProps)); + fileReader->setNext(copy); + + H264EncoderNVCodecProps encoderProps(cuContext); + encoderProps.logHealth = true; + auto encoder = boost::shared_ptr(new H264EncoderNVCodec(encoderProps)); + copy->setNext(encoder); + + auto sink = boost::shared_ptr(new StatSink()); + encoder->setNext(sink); + + PipeLine p("test"); + p.appendModule(fileReader); + BOOST_TEST(p.init()); + + Logger::setLogLevel(boost::log::trivial::severity_level::info); + p.run_all_threaded(); + + boost::this_thread::sleep_for(boost::chrono::seconds(20)); + p.stop(); + p.term(); + + p.wait_for_all(); + +} + +BOOST_AUTO_TEST_CASE(mono_1920x960_pipeline, *boost::unit_test::disabled()) +{ + auto cuContext = apracucontext_sp(new ApraCUcontext()); + auto width = 1920; + auto height = 960; + + auto fileReaderProps = FileReaderModuleProps("./data/mono_1920x960.raw"); + fileReaderProps.fps = 10000; + auto fileReader = boost::shared_ptr(new FileReaderModule(fileReaderProps)); + auto metadata = framemetadata_sp(new RawImageMetadata(width, height, ImageMetadata::ImageType::MONO, CV_8UC1, 0, CV_8U, FrameMetadata::HOST, true)); + + auto rawImagePin = fileReader->addOutputPin(metadata); + + cudastream_sp cudaStream_ = boost::shared_ptr(new ApraCudaStream()); + auto copyProps = CudaMemCopyProps(cudaMemcpyHostToDevice, cudaStream_); + auto copy = boost::shared_ptr(new CudaMemCopy(copyProps)); + fileReader->setNext(copy); + + auto cc = boost::shared_ptr(new CCNPPI(CCNPPIProps(ImageMetadata::YUV420, cudaStream_))); + copy->setNext(cc); + + auto sync = boost::shared_ptr(new CudaStreamSynchronize(CudaStreamSynchronizeProps(cudaStream_))); + cc->setNext(sync); + + H264EncoderNVCodecProps encoderProps(cuContext); + encoderProps.logHealth = true; + auto encoder = boost::shared_ptr(new H264EncoderNVCodec(encoderProps)); + sync->setNext(encoder); + + auto sink = boost::shared_ptr(new StatSink()); + encoder->setNext(sink); + + PipeLine p("test"); + p.appendModule(fileReader); + BOOST_TEST(p.init()); + + Logger::setLogLevel(boost::log::trivial::severity_level::info); + p.run_all_threaded(); + + boost::this_thread::sleep_for(boost::chrono::seconds(20)); + + p.stop(); + p.term(); + + p.wait_for_all(); + +} BOOST_AUTO_TEST_SUITE_END()