[Armadeus-commitlog] armadeus branch, master, updated. armadeus-7.0-347-g3dab76a8a
Brought to you by:
sszy
|
From: Sébastien S. <ss...@us...> - 2022-10-17 15:14:32
|
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 3dab76a8a108c02fe40fe40f49b25e6da4813222 (commit)
from 22fdee23e3a09765ac4c704e1a312960bac3e7a4 (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 3dab76a8a108c02fe40fe40f49b25e6da4813222
Author: Julien BOIBESSOT <jul...@ar...>
Date: Mon Oct 17 17:14:11 2022 +0200
[DEMOS] Capture: fix RGB24 to RGB32 conversion and add RGB565 to RGB32
-----------------------------------------------------------------------
Summary of changes:
target/demos/camera/capture/capture.c | 45 ++++++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 9 deletions(-)
diff --git a/target/demos/camera/capture/capture.c b/target/demos/camera/capture/capture.c
index db46a930e..781caf481 100644
--- a/target/demos/camera/capture/capture.c
+++ b/target/demos/camera/capture/capture.c
@@ -356,21 +356,48 @@ static void yuv420_to_rgb(void *yuv, int size, void *rgb, int bpp)
}
}
-static void rgb_to_rgb(void *rgb_src, int size, void *rgb_dst, int bpp)
+static void rgb24_to_rgb(void *rgb_src, int size, void *rgb_dst, int bpp)
{
- Uint32 *dest32 = (Uint32*) rgb_dst;
+ Uint32 *dest32 = (Uint32*)rgb_dst;
Uint8 *src = (Uint8 *)rgb_src;
int i, pos = 0;
Uint8 R, G, B, A;
Uint32 color;
if (bpp == 32) {
- for (i=size/4; i; i--) {
+ for (i = size/4; i; i--) {
R = src[pos++];
G = src[pos++];
B = src[pos++];
- A = 0xff;
- *dest32++ = (A << 24) | (R << 16) | (G << 8) | B;
+ *dest32++ = (R << 16) | (G << 8) | B;
+ }
+ } else {
+ fprintf(stdout, "%s: unsupported screen bpp (%d)\n", __func__, bpp);
+ }
+}
+
+static void rgb565_to_rgb(void *rgb_src, int size, void *rgb_dst, int bpp)
+{
+ Uint32 *dest32 = (Uint32*)rgb_dst;
+ Uint16 *src = (Uint16 *)rgb_src;
+ int i, pos = 0;
+ Uint8 R, G, B, A;
+ Uint16 pixel;
+ static int first_time = 1;
+
+ if (first_time) {
+ fprintf(stdout, "%s: image size %d\n", __func__, size);
+ first_time = 0;
+ }
+
+ if (bpp == 32) {
+ for (i = size/2; i; i--) {
+ pixel = src[pos];
+ B = pixel >> 8;
+ G = (pixel & 0x07e0) >> 3;
+ R = (pixel & 0x1f) << 3;
+ *dest32++ = (R << 16) | (G << 8) | B;
+ pos++;
}
} else {
fprintf(stdout, "%s: unsupported screen bpp (%d)\n", __func__, bpp);
@@ -460,11 +487,11 @@ static void process_image(/*const */void *pCaptured, int size)
} else if (mycamera.pixelformat == V4L2_PIX_FMT_YUV420) {
yuv420_to_rgb(pCaptured, mycamera.sizeimage, image->pixels, screen->format->BitsPerPixel);
} else if (mycamera.pixelformat == V4L2_PIX_FMT_RGB24) {
- rgb_to_rgb(pCaptured, mycamera.sizeimage, image->pixels, screen->format->BitsPerPixel);
+ rgb24_to_rgb(pCaptured, mycamera.sizeimage, image->pixels, screen->format->BitsPerPixel);
+ } else if (mycamera.pixelformat == V4L2_PIX_FMT_RGB565) {
+ rgb565_to_rgb(pCaptured, mycamera.sizeimage, image->pixels, screen->format->BitsPerPixel);
} else {
- if ( (mycamera.pixelformat != V4L2_PIX_FMT_RGB565)
- && (mycamera.pixelformat != V4L2_PIX_FMT_RGB32) )
- {
+ if (mycamera.pixelformat != V4L2_PIX_FMT_RGB32) {
if (first_time) {
printf("Unknown camera image format (%c%c%c%c)!!\n", FOURCC_TO_STR(mycamera.pixelformat));
first_time = 0;
hooks/post-receive
--
armadeus
|