[Armadeus-commitlog] armadeus branch, master, updated. armadeus-7.0-398-ge891faf97
Brought to you by:
sszy
|
From: sszy <ss...@us...> - 2024-02-28 21:18:59
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via e891faf9746089c7b8e2dcd2c009b567682d40f6 (commit)
from e23e21d2a8157993bd66fdd21c7cf75ca0a4340c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e891faf9746089c7b8e2dcd2c009b567682d40f6
Author: Julien BOIBESSOT <jul...@ar...>
Date: Wed Feb 28 22:17:44 2024 +0100
[DEMOS] capture: add support for NEON usage in BAYER to RGB conversion
-----------------------------------------------------------------------
Summary of changes:
buildroot/package/armadeus/demos/Config.in | 7 ++++
buildroot/package/armadeus/demos/demos.mk | 4 +++
target/demos/camera/capture/Makefile | 8 +++--
target/demos/camera/capture/capture.c | 52 ++++++++++++++++++++++++++++++
4 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/buildroot/package/armadeus/demos/Config.in b/buildroot/package/armadeus/demos/Config.in
index da6aeda41..c731bd30d 100644
--- a/buildroot/package/armadeus/demos/Config.in
+++ b/buildroot/package/armadeus/demos/Config.in
@@ -54,6 +54,13 @@ config BR2_PACKAGE_ARMADEUS_DEMOS_CAPTURE_VPU
help
Use i.MX27/i.MX51 VPU to encode stream in H.264
+config BR2_PACKAGE_ARMADEUS_DEMOS_CAPTURE_USE_NEON
+ bool "use NEON"
+ depends on BR2_PACKAGE_ARMADEUS_DEMOS_CAPTURE
+ select BR2_PACKAGE_BAYER2RGB_NEON
+ help
+ Use NEON (if present) to perform CSC (currently only Bayer -> RGB)
+
config BR2_PACKAGE_ARMADEUS_DEMOS_OSCILLO
bool "Oscilloscope"
depends on BR2_PACKAGE_AS_DEVICES
diff --git a/buildroot/package/armadeus/demos/demos.mk b/buildroot/package/armadeus/demos/demos.mk
index ac6d32b26..458d36db0 100644
--- a/buildroot/package/armadeus/demos/demos.mk
+++ b/buildroot/package/armadeus/demos/demos.mk
@@ -38,6 +38,10 @@ DEMOS_DEPENDENCIES += sdl jpeg-turbo
DEMOS_DEPENDENCIES += freescale-tools
endif
endif
+ ifeq ($(BR2_PACKAGE_ARMADEUS_DEMOS_CAPTURE_USE_NEON),y)
+ DEMOS_DEPENDENCIES += bayer2rgb-neon
+ ARMADEUS-DEMOS_PARAMS = "NEON=yes"
+ endif
endif
ifeq ($(BR2_PACKAGE_ARMADEUS_DEMOS_GPS),y)
diff --git a/target/demos/camera/capture/Makefile b/target/demos/camera/capture/Makefile
index 506b0e712..4f6c56d8b 100644
--- a/target/demos/camera/capture/Makefile
+++ b/target/demos/camera/capture/Makefile
@@ -9,11 +9,15 @@ STRIP:=$(ARMADEUS_TOOLCHAIN_PATH)/$(ARMADEUS_TOOLCHAIN_PREFIX)sstrip
CFLAGS=$(shell STAGING_DIR=$(STAGING_DIR) sh $(STAGING_DIR)/usr/bin/sdl-config --cflags)
#CFLAGS+=-Wall -g
-LDFLAGS= -lSDL -lpthread -lturbojpeg
+LDFLAGS = -lSDL -lpthread -lturbojpeg
ifeq ($(VPU),yes)
CFLAGS += -I$(STAGING_DIR)/usr/include/ -DUSE_VPU
LDFLAGS += -L$(STAGING_DIR)/usr/lib/ -lvpu
endif
+ifeq ($(NEON),yes)
+CFLAGS += -DUSE_NEON
+LDFLAGS += -lbayer2rgb3
+endif
EXEC= capture
SRC= capture.c csc.c
@@ -33,7 +37,7 @@ Q=@
all: $(EXEC)
$(EXEC): $(OBJ)
- @echo " LD $@"
+ @echo " LD $@ ($(LDFLAGS))"
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
capture.o: capture.c vpu_codec.h
diff --git a/target/demos/camera/capture/capture.c b/target/demos/camera/capture/capture.c
index 94d1004b3..04aafb397 100644
--- a/target/demos/camera/capture/capture.c
+++ b/target/demos/camera/capture/capture.c
@@ -37,6 +37,10 @@
#include <linux/videodev2.h>
#include <SDL/SDL.h> /* TODO: make it compatible with Framebuffer only */
+#ifdef USE_NEON
+#include <bayer2rgb/bayer2rgb.h>
+#endif
+
#ifdef USE_VPU
#include "vpu_codec.h"
#endif
@@ -544,7 +548,51 @@ static void simple_bayer_to_rgb(void *bayer_src, int size, int line_size, int im
//fprintf(stdout, "%s: %d x %d\n", __func__, i, j);
}
+#ifdef USE_NEON
+struct x_image_in {
+ struct image_in image;
+ void const *memory;
+ size_t total_size;
+};
+struct x_image_out {
+ struct image_out image;
+ void const *memory;
+ size_t total_size;
+};
+
+static void neon_bayer_to_rgb(void *bayer_src, int size, int line_size, int img_pix_height, void *rgb_dst, int dst_bpp)
+{
+ struct image_in src;
+ struct image_out dst;
+
+ src = (struct image_in) {
+ .data = (uint8_t *)bayer_src,
+ .info = {
+ .bpp = 8,
+ .endian = BAYER_E_LITTLE,
+ .w = 640,
+ .h = 480,
+ .stride = line_size,
+ },
+ };
+ src.type = BAYER_BGGR;
+
+ dst = (struct image_out) {
+ .data = rgb_dst,
+ .quality = 0,
+ .info = {
+ .bpp = 32,
+ .w = 640,
+ .h = 480,
+ .stride = 640*4,
+ },
+ };
+ dst.quality = ~0ul;
+
+ bayer2rgb_convert_neon(&src, &dst, NULL);
+}
+#endif
static void simple_copy(void *yuv, int size, void* rgb)
{
@@ -572,7 +620,11 @@ static void process_image(/*const */void *pCaptured, int size)
} else if (mycamera.pixelformat == V4L2_PIX_FMT_JPEG) {
jpeg_to_rgb(mycamera.width, mycamera.height, image->pixels, (char *)pCaptured, size);
} else if (mycamera.pixelformat == V4L2_PIX_FMT_SRGGB8) {
+#ifdef USE_NEON
+ neon_bayer_to_rgb(pCaptured, mycamera.sizeimage, mycamera.width, mycamera.height, image->pixels, screen->format->BitsPerPixel);
+#else
simple_bayer_to_rgb(pCaptured, mycamera.sizeimage, mycamera.width, mycamera.height, image->pixels, screen->format->BitsPerPixel);
+#endif
} else if (mycamera.pixelformat == V4L2_PIX_FMT_SGRBG8) {
BAYERToRGB(&_GR8, &_BRG32,
(char *)pCaptured, image->pixels, mycamera.width, mycamera.height,
hooks/post-receive
--
armadeus
|