@@ -468,10 +468,7 @@ void LibCameraWorker::queueViewfinderRequestLocked() {
468468}
469469
470470void LibCameraWorker::processCompletedRequest (Request *request) {
471- qDebug () << " [DEBUG] processCompletedRequest called, mCaptureInProgress:" << mCaptureInProgress ;
472-
473471 if (mCaptureInProgress ) {
474- qDebug () << " [DEBUG] Ignoring completed request during capture" ;
475472 // Still need to return buffer to free list!
476473 const std::map<const Stream *, FrameBuffer *> &buffers = request->buffers ();
477474 {
@@ -534,13 +531,7 @@ QImage LibCameraWorker::convertBufferToImage(
534531 const StreamConfiguration &cfg = stream->configuration ();
535532 Span<const FrameBuffer::Plane> planes = buffer->planes ();
536533
537- // Log buffer metadata for debugging
538534 const FrameMetadata &metadata = buffer->metadata ();
539- qDebug () << " [DEBUG] convertBufferToImage: format=" << QString::fromStdString (cfg.pixelFormat .toString ())
540- << " size=" << cfg.size .width << " x" << cfg.size .height
541- << " stride=" << cfg.stride
542- << " num_planes=" << planes.size ()
543- << " metadata_status=" << metadata.status ;
544535
545536 // Check frame status - 0=Success, 1=Error, 2=Cancelled
546537 if (metadata.status != 0 ) {
@@ -549,13 +540,6 @@ QImage LibCameraWorker::convertBufferToImage(
549540 // Continue anyway to see what we get, but the data may be corrupted
550541 }
551542
552- for (size_t i = 0 ; i < planes.size () && i < metadata.planes ().size (); i++) {
553- qDebug () << " [DEBUG] Plane" << i << " : fd=" << planes[i].fd .get ()
554- << " offset=" << planes[i].offset
555- << " length=" << planes[i].length
556- << " bytesused=" << metadata.planes ()[i].bytesused ;
557- }
558-
559543 // Check if buffer has data
560544 if (metadata.planes ().empty () || metadata.planes ()[0 ].bytesused == 0 ) {
561545 qDebug () << " [ERROR] Buffer is empty - bytesused=0" ;
@@ -583,20 +567,17 @@ QImage LibCameraWorker::convertBufferToImage(
583567 cfg.size .height ,
584568 cfg.stride ,
585569 QImage::Format_BGR888);
586- qDebug () << " [DEBUG] RGB888 conversion complete, image size:" << temp.size ();
587570 image = temp.copy ();
588571 } else if (cfg.pixelFormat == libcamera::formats::BGR888) {
589572 QImage temp (static_cast <const uchar *>(memory),
590573 cfg.size .width ,
591574 cfg.size .height ,
592575 cfg.stride ,
593576 QImage::Format_BGR888);
594- qDebug () << " [DEBUG] BGR888 conversion complete, image size:" << temp.size ();
595577 image = temp.copy ();
596578 } else if (cfg.pixelFormat == libcamera::formats::MJPEG) {
597579 size_t size = metadata.planes ()[0 ].bytesused ;
598580 image.loadFromData (static_cast <const uchar *>(memory), static_cast <int >(size), " JPEG" );
599- qDebug () << " [DEBUG] MJPEG conversion complete, image size:" << image.size ();
600581 } else if (cfg.pixelFormat == libcamera::formats::YUYV) {
601582 cv::Mat yuyv (cfg.size .height , cfg.size .width , CV_8UC2,
602583 const_cast <void *>(memory), cfg.stride );
@@ -605,7 +586,6 @@ QImage LibCameraWorker::convertBufferToImage(
605586
606587 image = QImage (rgb.data , rgb.cols , rgb.rows , rgb.step ,
607588 QImage::Format_RGB888).copy ();
608- qDebug () << " [DEBUG] YUYV conversion complete (OpenCV), image size:" << image.size ();
609589 }
610590
611591 munmap (memory, plane.length );
@@ -616,9 +596,6 @@ QImage LibCameraWorker::convertBufferToImage(
616596 unsigned int height = cfg.size .height ;
617597 unsigned int stride = cfg.stride ;
618598
619- qDebug () << " [DEBUG] YUV420: width=" << width << " height=" << height
620- << " stride=" << stride << " num_planes=" << planes.size ();
621-
622599 // Check if all planes share the same fd (contiguous buffer with offsets)
623600 bool samefd = true ;
624601 if (planes.size () >= 3 ) {
@@ -630,7 +607,6 @@ QImage LibCameraWorker::convertBufferToImage(
630607 }
631608 }
632609 }
633- qDebug () << " [DEBUG] YUV420: planes share same fd:" << samefd;
634610
635611 if (planes.size () >= 3 && samefd) {
636612 // All planes share same fd - map once with the total size
@@ -641,8 +617,6 @@ QImage LibCameraWorker::convertBufferToImage(
641617 if (endOffset > totalSize) totalSize = endOffset;
642618 }
643619
644- qDebug () << " [DEBUG] YUV420 same-fd: totalSize=" << totalSize;
645-
646620 void *memory = mmap (NULL , totalSize, PROT_READ, MAP_SHARED,
647621 planes[0 ].fd .get (), 0 );
648622
@@ -656,11 +630,6 @@ QImage LibCameraWorker::convertBufferToImage(
656630 const uint8_t *uData = static_cast <const uint8_t *>(memory) + planes[1 ].offset ;
657631 const uint8_t *vData = static_cast <const uint8_t *>(memory) + planes[2 ].offset ;
658632
659- // Debug: Check first bytes of each plane
660- qDebug () << " [DEBUG] Y plane first byte:" << (int )yData[0 ];
661- qDebug () << " [DEBUG] U plane first byte:" << (int )uData[0 ];
662- qDebug () << " [DEBUG] V plane first byte:" << (int )vData[0 ];
663-
664633 // Create contiguous I420 buffer for OpenCV
665634 size_t ySize = stride * height;
666635 size_t uvStride = stride / 2 ;
@@ -682,8 +651,6 @@ QImage LibCameraWorker::convertBufferToImage(
682651 image = QImage (rgb.data , rgb.cols , rgb.rows , rgb.step ,
683652 QImage::Format_RGB888).copy ();
684653
685- qDebug () << " [DEBUG] YUV420 same-fd conversion complete, image size:" << image.size ();
686-
687654 munmap (memory, totalSize);
688655
689656 } else if (planes.size () >= 3 ) {
@@ -723,8 +690,6 @@ QImage LibCameraWorker::convertBufferToImage(
723690 image = QImage (rgb.data , rgb.cols , rgb.rows , rgb.step ,
724691 QImage::Format_RGB888).copy ();
725692
726- qDebug () << " [DEBUG] YUV420 multi-fd conversion complete, image size:" << image.size ();
727-
728693 munmap (yMem, planes[0 ].length );
729694 munmap (uMem, planes[1 ].length );
730695 munmap (vMem, planes[2 ].length );
@@ -751,8 +716,6 @@ QImage LibCameraWorker::convertBufferToImage(
751716 image = QImage (rgb.data , rgb.cols , rgb.rows , rgb.step ,
752717 QImage::Format_RGB888).copy ();
753718
754- qDebug () << " [DEBUG] YUV420 single-plane conversion complete, image size:" << image.size ();
755-
756719 munmap (memory, plane.length );
757720 }
758721 } else {
0 commit comments