summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libcamera/framebuffer.h2
-rw-r--r--include/libcamera/internal/framebuffer.h2
-rw-r--r--src/libcamera/framebuffer.cpp16
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp5
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp2
-rw-r--r--src/libcamera/pipeline/vimc/vimc.cpp3
-rw-r--r--src/libcamera/request.cpp2
7 files changed, 17 insertions, 15 deletions
diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h
index de172d97..3b1118d1 100644
--- a/include/libcamera/framebuffer.h
+++ b/include/libcamera/framebuffer.h
@@ -71,8 +71,6 @@ public:
std::unique_ptr<Fence> releaseFence();
- void cancel() { metadata_.status = FrameMetadata::FrameCancelled; }
-
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer)
diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h
index 97dca963..8a9cc98e 100644
--- a/include/libcamera/internal/framebuffer.h
+++ b/include/libcamera/internal/framebuffer.h
@@ -31,6 +31,8 @@ public:
Fence *fence() const { return fence_.get(); }
void setFence(std::unique_ptr<Fence> fence) { fence_ = std::move(fence); }
+ void cancel() { LIBCAMERA_O_PTR()->metadata_.status = FrameMetadata::FrameCancelled; }
+
private:
std::unique_ptr<Fence> fence_;
Request *request_;
diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp
index 142e2af7..7be18560 100644
--- a/src/libcamera/framebuffer.cpp
+++ b/src/libcamera/framebuffer.cpp
@@ -187,6 +187,14 @@ FrameBuffer::Private::~Private()
*/
/**
+ * \fn FrameBuffer::Private::cancel()
+ * \brief Marks the buffer as cancelled
+ *
+ * If a buffer is not used by a request, it shall be marked as cancelled to
+ * indicate that the metadata is invalid.
+ */
+
+/**
* \class FrameBuffer
* \brief Frame buffer data and its associated dynamic metadata
*
@@ -407,12 +415,4 @@ std::unique_ptr<Fence> FrameBuffer::releaseFence()
return std::move(_d()->fence_);
}
-/**
- * \fn FrameBuffer::cancel()
- * \brief Marks the buffer as cancelled
- *
- * If a buffer is not used by a request, it shall be marked as cancelled to
- * indicate that the metadata is invalid.
- */
-
} /* namespace libcamera */
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 9f113171..fd989e61 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -28,6 +28,7 @@
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/delayed_controls.h"
#include "libcamera/internal/device_enumerator.h"
+#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/pipeline_handler.h"
@@ -836,7 +837,7 @@ void IPU3CameraData::cancelPendingRequests()
for (auto it : request->buffers()) {
FrameBuffer *buffer = it.second;
- buffer->cancel();
+ buffer->_d()->cancel();
pipe()->completeBuffer(request, buffer);
}
@@ -1356,7 +1357,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
for (auto it : request->buffers()) {
FrameBuffer *b = it.second;
- b->cancel();
+ b->_d()->cancel();
pipe()->completeBuffer(request, b);
}
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index d6148724..acc0beca 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1907,7 +1907,7 @@ void RPiCameraData::clearIncompleteRequests()
* request? If not, do so now.
*/
if (buffer->request()) {
- buffer->cancel();
+ buffer->_d()->cancel();
pipe()->completeBuffer(request, buffer);
}
}
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index fff95a34..c3e33ecf 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -32,6 +32,7 @@
#include "libcamera/internal/camera.h"
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/device_enumerator.h"
+#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/pipeline_handler.h"
@@ -574,7 +575,7 @@ void VimcCameraData::bufferReady(FrameBuffer *buffer)
if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
for (auto it : request->buffers()) {
FrameBuffer *b = it.second;
- b->cancel();
+ b->_d()->cancel();
pipe->completeBuffer(request, b);
}
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 9c8da6ca..5704972d 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -129,7 +129,7 @@ void Request::Private::doCancelRequest()
Request *request = _o<Request>();
for (FrameBuffer *buffer : pending_) {
- buffer->cancel();
+ buffer->_d()->cancel();
camera_->bufferCompleted.emit(request, buffer);
}
"hl kwb">zip(params, vals)) json_output = get_config(args_dict, '-o', None, 'string') directory = get_config(args_dict, '-i', None, 'string') config = get_config(args_dict, '-c', None, 'string') log_path = get_config(args_dict, '-l', None, 'string') if directory is None: raise ArgError('\n\nERROR! No input directory given.') if json_output is None: raise ArgError('\n\nERROR! No output json given.') return json_output, directory, config, log_path """ custom arg and macbeth error class """ class ArgError(Exception): pass class MacbethError(Exception): pass """ correlation function to quantify match """ def correlate(im1, im2): f1 = im1.flatten() f2 = im2.flatten() cor = np.corrcoef(f1, f2) return cor[0][1] """ get list of files from directory """ def get_photos(directory='photos'): filename_list = [] for filename in os.listdir(directory): if 'jp' in filename or '.dng' in filename: filename_list.append(filename) return filename_list """ display image for debugging... read at your own risk... """ def represent(img, name='image'): # if type(img) == tuple or type(img) == list: # for i in range(len(img)): # name = 'image {}'.format(i) # cv2.imshow(name, img[i]) # else: # cv2.imshow(name, img) # cv2.waitKey(0) # cv2.destroyAllWindows() # return 0 """ code above displays using opencv, but this doesn't catch users pressing 'x' with their mouse to close the window.... therefore matplotlib is used.... (thanks a lot opencv) """ grid = plt.GridSpec(22, 1) plt.subplot(grid[:19, 0]) plt.imshow(img, cmap='gray') plt.axis('off') plt.subplot(grid[21, 0]) plt.title('press \'q\' to continue') plt.axis('off') plt.show() # f = plt.figure() # ax = f.add_subplot(211) # ax2 = f.add_subplot(122) # ax.imshow(img, cmap='gray') # ax.axis('off') # ax2.set_figheight(2) # ax2.title('press \'q\' to continue') # ax2.axis('off') # plt.show() """ reshape image to fixed width without distorting returns image and scale factor """ def reshape(img, width): factor = width/img.shape[0] return cv2.resize(img, None, fx=factor, fy=factor), factor