Age | Commit message (Collapse) | Author |
|
A subsequent change to the Rectangle will require the definition of the
Size to be available. Define Rectangle after Size to ease review of that
change. No code change is included.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Size has a default constructor, there's no need to default-initialize
instances explicitly. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Prior to N4387 ([1]), the std::tuple::tuple(const Types&...) constructor
was unconditionally explicit. gcc 5 doesn't implement N4387, leading to
a compilation error in the simple pipeline handler. Use
std::make_tuple() to fix it.
[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4387.html
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Pipeline handlers commonly have to calculate the minimum or maximum of
multiple sizes, or align a size's width and height. Add helper functions
to the Size class to perform those tasks.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Use std::numerical_limits to initialise the best score instead of an
arbitrary value. This fixes a failure in v4l2-conformance when using
the Raspberry Pi pipeline handler and v4l2-compatibility libcamera
layer.
Reported-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
For handling try_fmt, the values should be filled in by validating the
stream configuration, and not by recalculating them or manually checking
against the cached list of formats and sizes. Add a new
V4L2Camera::validateConfiguration() function to validate a configuration
and use it to obtain size, format, stride, and frameSize values.
If the format negotiation fails, return error from try_fmt and s_fmt.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The stride and frameSize should be obtained through StreamConfiguration
rather than PixelFormatInfo, as pipeline handlers might have different
values (eg. for alignment). Get the stride and frameSize values from
StreamConfiguration instead of from PixelFormatInfo.
This removes the need for V4L2CameraProxy's calculation helper functions
(bplMultiplier, imageSize, v4l2ToDrm, drmToV4L2, calculateSizeImage) and
formats, so remove them.
This also removes the need for V4L2CameraProxy::calculateSizeImage, so
remove it,.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The buffer operations in V4L2Camera were getting the stream from the
wrong place. Fix it.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Now that all the pipeline handlers fill in the stride information at
validation time, update the documentation accordingly.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Unsupported formats should not be added to the configuration when
generating the configuration. Filter them out.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Unsupported formats should not be added to the configuration when
generating the configuration. Filter them out.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Pipeline handlers must acquire media devices via
PipelineHander::acquireMediaDevice so that the media devices can be
registered with the pipeline handler, so that they can be automatically
added to the devnum map for the v4l2 compatibility layer to use. Die
fatally if any camera trying to be registered has not acquired any media
devices via acquireMediaDevice.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Media devices should be acquired by pipeline handlers via
PipelineHandler::acquireMediaDevice so that the media devices can be
registered in the pipeline handler so that they can be automatically
added to the devnum map for the v4l2 compatibility layer to use. Make
the raspberrypi pipeline handler do this.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Simplify code for looking up PixelFormatInfo using a V4L2 format by
using the new PixelFormatInfo lookup function based on V4L2 format.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add member functions to PixelFormatInfo for calculating stride and frame
size. This will simplify existing code that calculates these things.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In addition to the stride field, we want the pipeline handler to be able
to declare the frame size for the configuration. Add a frameSize field
to StreamConfiguration for this purpose.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a lookup function for PixelFormatInfo that takes a V4L2PixelFormat.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add tryFormat and its variations (meta, single-plane, multi-plane) to
V4L2VideoDevice.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Packed formats make it difficult to calculate stride as well as
frame size with the fields that PixelFormatInfo currently has.
bitsPerPixel is defined as the average number of bits per pixel, and
only counts effective bits, so it is not useful for calculating
stride and frame size.
To fix this, we introduce a concept of a "pixel group". The size of this
group is defined as the minimum number of pixels (including padding)
necessary in a row when the image has only one column of effective
pixels. The pixel group has one more attribute, that is the "bytes per
group". This determines how many bytes one pixel group consumes. These
are the fields pixelsPerGroup and bytesPerGroup that are defined in this
patch. Defining these two values makes it really simple to calculate
bytes-per-line, as ceil(width / pixelsPerGroup) * bytesPerGroup, where
width is measured in number of pixels. The ceiling accounts for padding.
The pixel group has another contraint, which is that the pixel group
(bytesPerGroup and pixelsPerGroup) is the smallest repeatable unit. What
this means is that, for example, in the IPU3 formats, if there is only
one column of effective pixels, it looks like it could be fit in 5 bytes
with 3 padding pixels (for a total of 4 pixels over 5 bytes). However,
this unit is not repeatable, as at the 7th group in the same row, the
pattern is broken. Therefore, the pixel group for IPU3 formats must be
25 pixels over 32 bytes.
Clearly, pixelsPerGroup must be constant for all planes in the format.
The bytesPerGroup then, must be a per-plane attribute. There is one more
field, verticalSubSampling, that is per-plane. This is simply a divider,
to divide the number of rows of pixels by the sub-sampling value, to
obtain the number of rows of pixels for the subsampled plane.
For example, for something simple like BGR888, it is self-explanatory:
the pixel group size is 1, and the bytes necessary is 3, and there is
only one plane with no (= 1) vertical subsampling. For YUYV, the
CbCr pair is shared between two pixels, so even if you have only one
pixel, you would still need a padded second Y, therefore the pixel
group size is 2, and bytes necessary is 4 (as opposed to 1 and 2). YUYV
also has no vertical subsampling. NV12 has a pixel group size of 2
pixels, due to the CbCr plane. The bytes per group then, for both
planes, is 2. The first plane has no vertical subsampling, but the
second plane is subsampled by a factor of 2.
The IPU3 formats are also self-explanatory, as they are single-planar,
and have a pixel group size of 25, consuming 32 bytes. Although a
comment in the driver suggests that it should be 50 and 64,
respectively, this is an attribute of the driver, and not the format, so
this shall be set by the ipu3 pipeline handler.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add formats for NV24 and NV42. While at it, reorder the NV formats so
that NV12 and NV21 come first, followed by NV16, NV61, NV24, and NV42.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Use a helper instead of local code to retrieve all keys from a map.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a map_keys() function to the utils namespace to extract keys from a
map.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Niklas: change return type to std::vector instead of std::set]
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Use the new Size::isNull() function through the code base to replace
manual checks. While the new code isn't equivalent, as isNull() checks
that both width and height are zero, it catches the same conditions in
practice.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
A capture request is no longer limited to a single output buffer.
Remove the limitation, but (for now) keep the check to ensure that
at least one buffer is always provided.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Construct a FrameBuffer for every buffer given in the camera3Request
and add it to the libcamera Request on the appropriate stream.
The correct stream is obtained from the private data of the camera3_stream
associated with the camera3_buffer.
Comments regarding supporting only one buffer are now removed, and
FrameBuffers have their lifetime tracked in the Camera3RequestDescriptor
to ensure they are released when the Request is completed.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Introduce a vector storing a CameraStream to track and maintain
state between an Android stream (camera3_stream_t) and a libcamera
Stream.
Only the index of the libcamera stream is stored, to facilitate identifying
the correct index for both the StreamConfiguration and Stream vectors.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Move the construction of the Request higher in the code flow so that
multiple buffers and streams can be added where required.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Move the code which constructs a FrameBuffer from the Android buffer handle
to it's own function to simplify the code flow and readability.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Create an initial Camera Configuration using an empty role set, and
populate the StreamConfigurations manually from each of the streams
given by the Android camera3_stream_configuration_t stream_list.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Rather than converting pixelformats through the map, and then
dereferencing the iterator later, create a helper to explicitly return a
PixelFormat type.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Switch FocusStatus::num to unsigned int for convenience.
Fill in libcamera::controls::FocusFoM with the average of the middle two
regions (across a 4x3 grid) FoM statistics from the ISP.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
For control algorithms like focus, this is needed to return out the
the current frame focus statistics. For other algorithms, there is no
functional change.
Signed-off-By: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Provide a control to allow the IPA to return a FoM to indicate how
in-focus a scene is. Note, this is not to be used as a means to
implement a focus algorithm by the application, rather an indication of
how in-focus a scene is.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Previously, output of the focus measure could not be enabled without
recompiling (because of the RPI_LOGGING_ENABLE macro). This uses the
libcamera logging mechanism instead, so can be enabled/disabled at
runtime.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Do not proxy the signal in the CI2Device when there is no need for it,
remove it.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
It's confusing to read the code and understand that a request is only
completed before being processed by the ImgU if it only contains a
single RAW buffer. Add a boolean variable with a explanatory name to
make this clearer, no functional change.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Sharing a pointer with the IPA is fragile as it will not work with all
IPC mechanisms. Document that it's a temporary workaround that should be
reworked.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Fix a typo in the word "unknown".
Suggested-by: IOhannes m zmölnig <umlaeute@debian.org>
Signed-off-by: Andrej Shadura <andrewsh@debian.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Use the Size::isNull() helper instead of using local code.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
It's common for code to check if a size is null. Add a helper function
to do so.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When an unsupported stream roles is requested to
generateConfiguration(), the function shall fail instead of simply
ignoring the request.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The generateConfiguration() implementation does not check if the
requested list of roles can actually be satisfied. The camera API
documentation prescribes the function shall fail in that case, instead
of silently adjust the returned configuration.
Fix this by implementing the same logic as the validate() function
implements, as the pipeline handler supports one raw stream and up to
two output streams.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Fix wrong parameter indent in generateConfiguration() function
implementation.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The IPU3 pipeline handler that does not support receiving an empty list
of roles at generateConfiguration() time. This contradicts the camera
API which allows application to generate empty CameraConfiguration to
be later manually filled.
Fix this by returning an empty CameraConfiguration if the list of
requested roles is empty. While at it, align the style with the other
pipeline handlers.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|