Add -m command line option to enable horizontal mirror on the
camera sensor via VIDIOC_S_CTRL + V4L2_CID_HFLIP. This uses
the sensor hardware mirror (e.g. GC0308 register 0x14 bit[0])
with zero CPU overhead.
Also refactor parse_arguments to use a loop-based parser so
options can appear in any order.
Usage: camera 0 -m (mirror preview)
camera -jpg -m (mirror still capture)
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Some image sensors on 8-bit DVP buses (e.g. GC0308) produce RGB565X
(big-endian) pixel data — the high byte is clocked out first and
stored first in PSRAM by the ESP32-S3 CAM controller.
The V4L2 framework does not negotiate formats automatically, so try
RGB565 first and fall back to RGB565X if S_FMT fails.
When the sensor reports RGB565X:
- Invalidate D-Cache after DQBUF so the CPU reads fresh DMA data
- Byte-swap each pixel in place from BE to LE RGB565 for display
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Use MMAP buffer allocation by default so the driver can manage
DMA-capable memory with proper alignment and cache attributes.
Fall back to USERPTR if the driver does not support MMAP.
Also fix NX framebuffer stride calculation to use the actual
display width instead of hardcoded values.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Add missing #include <sys/boardctl.h> in camera_bkgd.c to fix
implicit declaration of boardctl() and undeclared BOARDIOC_NX_START.
Also fix capture_num check in camera_main.c to only apply still
capture size enumeration when capture_type is STILL_CAPTURE.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Fix some issues and update license to apache.
- Fails to open the video driver.
- Change format from YUV422 to RGB565,
and add captured image output to LCD.
- An application cannot exit by infinite loop.
- In video-only mode without capturing still images,
do not allocate capture memory for still images to
reduce the memory usage.
The camera example will take the specified number of pictures (default 10)
then will exit
To enable the example add the following line in your defconfig
EXAMPLES_CAMERA
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>