Hi,
my setup is Agx Devkit 32gb, JP4.6.1, 6x imx577 with hardware sync, framerate 10FPS, ssd SAMSUNG EVO 970 nvme.
Without “parallel for” writing jpeg takes about 33ms per camera, total ~6*33ms.
With “parallel for” it takes same time, so multithreading not works for writeJpeg.
How to speedup writing jpegs?
I need <90ms for all 6 cameras.
Here my code to write jpegs from all cameras.
size_t cameraId{};
#pragma omp parallel for schedule(static) num_threads(6)
for( cameraId = 0; cameraId < m_camerasNum; ++ cameraId )
{
const auto result{ m_iCaptureSessions.at( cameraId )->capture( m_requests.at( cameraId ).get() ) };
if( result == 0 )
REPORT_ERROR( "Capture failed!" );
Argus::UniqueObj< EGLStream::Frame > frame{ m_iFrameConsumers.at( cameraId )->acquireFrame() };
EGLStream::IFrame * iFrame{ Argus::interface_cast< EGLStream::IFrame >( frame ) };
if( not iFrame )
{
std::cout << "Failed to acquire frame! " << cameraId << std::endl;
} else
{
// std::cout << cameraId << " " << iFrame->getNumber() << " " << iFrame->getTime() << std::endl;
// record
{
EGLStream::IImageJPEG * iJPEG{ Argus::interface_cast< EGLStream::IImageJPEG >( iFrame->getImage() ) };
if( iJPEG )
{
const auto file{ m_recordPath + "/" + std::to_string( cameraId ) + "/" + std::to_string( m_framesCounter ) + ".jpg" };
if( iJPEG->writeJPEG( file.c_str() ) != Argus::STATUS_OK )
{
std::cout << "Failed to write JPEG: " << file << std::endl;
}
}
m_doCapture = false;
}
}
} // pragma
Thanks.