Added the ability to capture a RAW8 capture by using the GREY FourCC format
through the dump pipe.
Without this patch you could get Grey RAW8 via the pipes 1 and 2 but
not through pipe 0 "dump" pipe. To use Pipe 0 you would have to pretend
the format is a bayer pattern with RAW_BAYER_UNPACKED(8).
Which would cause mismatches when you tried to actually use the buffer.
Signed-off-by: Brenden Adamczak <cerebralasylum1@gmail.com>
Add support for JPEG and PNG compressed formats to the video software
generator driver. This enables testing of compressed video formats
without requiring actual camera hardware.
The compressed frame buffers are included at compile time via
generated header files, with configurable file names to support
custom test patterns.
Signed-off-by: Kate Wang <yumeng.wang@nxp.com>
- PNG is treated similarly to JPEG with a rough worst-case estimate.
- Treat NV12/NV21 formats specially rather than fall into the default
condition. These 2-planar YUV formats have a pitch equal to width and
a total size of pitch * height * 2 (Y plane + interleaved UV plane).
Signed-off-by: Kate Wang <yumeng.wang@nxp.com>
The Arducam mega is a low power, rolling shutter camera, supports
connecting one or more cameras to any microcontroller. It provides
high-quality image capture and processing capabilities, making it
highly suitable for various application fields, including machine
vision, image recognition, and robotics, among others. In current
implementation connecting multiple instances of the same camera
system is problematic.
Co-authored-by: Lee Jackson <lee.jackson@arducam.com>
Signed-off-by: Krystian Balicki <kristos_b@wp.pl>
Add parameter checking of in functions video_closest_frmival
and video_closest_frmival_stepwise and return an error in
case of invalid parameter.
Previously ASSERT were used, but thoses are not always enabled,
leading to possibility to have invalid parameter being used.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
ASSERT are not always enabled, leading to not catching
invalid arguments in situation where it is not enabled.
Replace all ASSERT statement with argument check, properly
returning error instead of accessing invalid addresses.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
ASSERT aren't always enabled hence add return value in
video_auto_cluster_ctrl and video_cluster_ctrl functions
in order to avoid accessing invalid parameter and return
an error.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Add video_import_buffer() API and necessary changes to support buffers
allocated from outside, not from the video heap.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Currently, the video_enqueue() API enqueues the whole external video
buffer container structure from the application and the driver stores
this container in its FIFO queue.
While it works in simple applications where the enqueued video_buffer
container persists for the whole program lifecycle, it does not work in
situations where we cannot keep this container, e.g. enqueuing a buffer
inside a function, the local variable will be destroyed when the function
returns and hence the buffer is no longer valid.
Video buffers can be tracked via their indices in the buffer pool.
Set the index field when buffers are allocated and enqueue the internal
buffer rather than the external one to fix the issue.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Fix the representation of pixel formats with an X (unused) or A (alpha)
channel to make the four character match the order in the channels in
memory byte per byte.
These formats are imported from Linux but contain a naming inconsistency.
The four character codes still match the Linux formats from V4L2
include/uapi/linux/videodev2.h based on the byte content rather than the
name: this means that communicating with Linux systems will work, but
sharing source code with Linux will need to modify the variable names.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Make usage of the macro VIDEO_FMT_IS_YUV/RGB/BAYER in order to
check the colorspace of a format.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Add categories of pixel formats along with macros to detect
whether a pixel format is part of that category.
This can be used to detect multiple properties in a
maintainable way.
Signed-off-by: Josuah Demangeon <me@josuah.net>
The video shell uses a workaround to have different sub-commands use
different completions. Raise the limit of maximum completions from 10 up
to 20 to support more devices.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Add a "video tree <device>" command to show the topology of video devices.
This follows the chain of source devices as defined by
VIDEO_DEVICE_DEFINE() in the macros.
Signed-off-by: Josuah Demangeon <me@josuah.net>
The tab completion was not showing the valid devices after the failed
devices. Fix it by continuing to search for devices after a failed device.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Add padded formats as seen on Himax image sensors used with 8-bit
DVP receivers, where half of the pins are used, leading to empty
bits in memory. This replaces the Y4 format which is 8-bit despite
only giving 4-bit filled with data per byte.
Signed-off-by: Josuah Demangeon <me@josuah.net>
The buffer index is to track the buffers in the whole video buffer pool
which may be used for several video pipeline, each can use up to an
uint8 buffer. Extend the type to uint16 to account for this fact.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Expose the high framerates first so that it can be listed first and
chosen as the default frame rate in some applications.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Adapt all Espressif SoC and driver code to the updated
hal_espressif module synced with IDF master branch.
Main changes:
- clock control: delegate peripheral clock gating to HAL
layer using new clock/reset APIs
- SPI/GDMA: adapt to restructured DMA HAL with new channel
allocation and configuration interfaces
- ethernet: add RMII clock configuration and PHY management
- GPIO: simplify using direct HAL function calls
- flash: adapt to updated SPI flash HAL interfaces
- linker scripts: update IRAM/DRAM mappings for new HAL
object files
- DTS: fix ESP32-S2 PSRAM dcache1 address to match actual
MMU mapping region (0x3f800000 DRAM1 instead of 0x3f500000
DPORT which lacks 8-bit access capability)
- west.yml: update hal_espressif revision
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Add support for the Sony IMX219 CSI sensor.
This sensor supports resolution of 3280x2464 in RGGB bayer format
either 8 or 10 bits and using 2 or 4 CSI lanes.
Only 10 bits on 2 CSI lanes is currently supported, and only in
1920x1080 pixel resolution using cropping using the video_set_format(),
and will need to be converted to video_set_selection() instead.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Co-authored-by: Alan Shaju <alanshaju@rideltech.com>
Co-authored-by: Alain Volmat <alain.volmat@foss.st.com>
Switch to zephyr-keep-sorted-start/stop to keep checking the new
driver imports are always sorted, which reduces chances of git
conflict while adding new drivers from separate branches.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Only VIDEO_CID_ANALOGUE_GAIN and VIDEO_CID_GAIN were defined. Also add
the complementary VIDEO_CID_DIGITAL_GAIN.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Adding some of the missing pieces to the HM01b0 video class.
changed the VIDEO define to match all of the other video drivers
that I have tried:
That is CONFIG_VIDEO_HIMAX_HM01B0 to CONFIG_VIDEO_HM01B0
Added a few more format sizes: 324x324 to 324x244 164x122
match the spec.
Added BAYER format for the color camera (VIDEO_PIX_FMT_SBGGR8)
Only for Full, and QVGA, as cameras with BAYER filter do
not support the binning mode.
Added 4 data bit support, using new format: VIDEO_PIX_FMT_Y4
Support for hflip/vflip controls.
Added the frmival set/get/enum functions, to allow us better
control of how many frames are generated per second.
Used the reset register enumeration similar to other implementions,
such as Arduino library, Teensy Library, and OpenME
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
The current implementation of video_shell_set_ctrl() incorrectly
passes &arg_value as the endptr to strtoll(), while attempting
to validate the result using an uninitialized end_value pointer.
This causes the check (*end_value != '\0') to always trigger
shell_error.
Update the code to pass the address of end_value to strtoll()
correctly, ensuring it points to the first invalid character
within the input string for proper validation.
Signed-off-by: Chin-Yao Hung <cy.hung@guc-asic.com>
If the clock device (i.e., RCC) failed to initialize, we have bigger
problems than trying to call clock_control_{off,on,configure} on it.
Don't bother checking to save some footprint.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Move camera XCLK setup from DVP driver (POST_KERNEL) to esp_lcd_cam.c
(PRE_KERNEL_2) to ensure the image sensor receives clock before its
I2C initialization. This fixes a race condition where sensors like
ov2640 would fail to respond during probe because XCLK wasn't yet
configured.
Also adds timestamp to captured video buffers and removes a noisy
error log for set_selection when the source returns -ENOSYS.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
when pipe 1 or 2 is selected and parallel bus is chosen
HAL_DCMIPP_PARALLEL_SetConfig is failing, since it gets called twice
and driver is already in HAL_DCMIPP_STATE_READY state
Signed-off-by: Roman Pustobaiev <romanpustobayev@gmail.com>
Correct the behavior when printing interger menu values.
Current loop is not correct since it is waiting for a 0 value
to stop while for integer menu any value is possible.
Modify in order to loop until reaching the maximum number of
entries listed at the ctrl init time.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
"integer menu" ctrl type is longer than the 8 bytes long
typebuf hence rename the type into "int menu" and increase
the typebuf buffer in addition to increase alignment during
print of the ctrl values.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Set multiline on pixel pipes to 128 lines to limit slave IP hardware
handshakes and so reduce the number of interrupts received by slave IP.
Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Log number of interrupts, including fuse interrupts at each
key frame and at the end of encoding.
Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Fix wait of hardware encoding completion by using
interrupt signaling instead of polling on irq status.
Signed-off-by: Hugues Fruchet <hugues.fruchet@foss.st.com>
Only st,stm32-dcmipp is described and only st,stm32n6-dcmipp
was used within the driver to decide if CSI / PIXEL_PIPES
are available. Instead of this, look at HAL provided macros
to know if the selected soc has the functionalities or not.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Correct set_frmival in order to avoid having un-optimized
frmival selection due to rounded values.
Computation has been done in usec, leading to incorrect
frmival selection due to value being rounded internally.
As an example, code was selecting 1/60 from sensor then 4 time
frame drop by DCMI instead of selecting directly 1/15 from
sensor.
Use msec instead to hide those rounding issue and avoid
as well 64bit variables.
This also put the first video_frmival_nsec outside of the
loop to avoid having to do the processing everytime.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Adds support for video_set_frmival for the IMX335 sensor driver.
The available framerates depend on whether the binning mode is enabled.
Currently, 25Hz and 30Hz are always available and 50Hz/60Hz only with
binning.
Signed-off-by: Anton Puppe <anton-noel-flynn.puppe@zeiss.com>