@@ -530,14 +530,14 @@ QImage LibCameraWorker::convertBufferToImage(
530530 qDebug () << " [DEBUG] YUV420: width=" << width << " height=" << height
531531 << " stride=" << stride << " num_planes=" << planes.size ();
532532
533- /* if (planes.size() >= 3) {
533+ if (planes.size () >= 3 ) {
534534 // Multi-plane format - map each plane separately and copy to contiguous buffer
535535 void *yMem = mmap (NULL , planes[0 ].length , PROT_READ, MAP_SHARED,
536- planes[0].fd.get(), planes[0].offset );
536+ planes[0 ].fd .get (), 0 );
537537 void *uMem = mmap (NULL , planes[1 ].length , PROT_READ, MAP_SHARED,
538- planes[1].fd.get(), planes[1].offset );
538+ planes[1 ].fd .get (), 0 );
539539 void *vMem = mmap (NULL , planes[2 ].length , PROT_READ, MAP_SHARED,
540- planes[2].fd.get(), planes[2].offset );
540+ planes[2 ].fd .get (), 0 );
541541
542542 if (yMem == MAP_FAILED || uMem == MAP_FAILED || vMem == MAP_FAILED) {
543543 qDebug () << " [ERROR] Failed to mmap YUV420 planes" ;
@@ -581,7 +581,7 @@ QImage LibCameraWorker::convertBufferToImage(
581581 munmap (uMem, planes[1 ].length );
582582 munmap (vMem, planes[2 ].length );
583583
584- } else {*/
584+ } else {
585585 // Single plane - all data contiguous, use OpenCV directly
586586 // The buffer contains Y, U, V planes contiguously
587587 cv::Mat yuv (height * 3 / 2 , stride, CV_8UC1,
@@ -598,7 +598,7 @@ QImage LibCameraWorker::convertBufferToImage(
598598 QImage::Format_RGB888).copy ();
599599
600600 qDebug () << " [DEBUG] YUV420 single-plane conversion complete (OpenCV)" ;
601- // }
601+ }
602602 } else {
603603 qDebug () << " [ERROR] Unsupported pixel format:"
604604 << QString::fromStdString (cfg.pixelFormat .toString ());
0 commit comments