feat(draw): add unified NEON acceleration (#4860)

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Peter Bee
2023-11-27 05:32:55 -06:00
committed by GitHub
parent 767a44bdaa
commit a51beb9051
11 changed files with 2046 additions and 1660 deletions
+2
View File
@@ -17,7 +17,9 @@
#ifndef LV_CONF_H
#define LV_CONF_H
#ifndef __ASSEMBLY__
#include <stdint.h>
#endif
/*====================
COLOR SETTINGS
+6 -2
View File
@@ -1,8 +1,12 @@
LVGL_PATH ?= ${shell pwd}/lvgl
ASRCS += $(shell find $(LVGL_PATH)/src -type f -name '*.S')
CSRCS += $(shell find $(LVGL_PATH)/src -type f -name '*.c')
CSRCS += $(shell find $(LVGL_PATH)/demos -type f -name '*.c')
CSRCS += $(shell find $(LVGL_PATH)/examples -type f -name '*.c')
CXXSRCS += $(shell find $(LVGL_PATH)/src/libs/thorvg -type f -name '*.cpp')
CFLAGS += "-I$(LVGL_PATH)"
CXXEXT := .cpp
CXXSRCS += $(shell find $(LVGL_PATH)/src/libs/thorvg -type f -name '*${CXXEXT}')
AFLAGS += "-I$(LVGL_PATH)"
CFLAGS += "-I$(LVGL_PATH)"
CXXFLAGS += "-I$(LVGL_PATH)"
+4
View File
@@ -150,15 +150,19 @@ fout.write(
* End of parsing lv_conf_template.h
-----------------------------------*/
#ifndef __ASSEMBLY__
LV_EXPORT_CONST_INT(LV_DPI_DEF);
#endif
#undef _LV_KCONFIG_PRESENT
#ifndef __ASSEMBLY__
#if LV_USE_FLOAT
typedef float lv_value_precise_t;
#else
typedef int32_t lv_value_precise_t;
#endif
#endif
/*Set some defines if a dependency is disabled*/
#if LV_USE_LOG == 0
@@ -16,6 +16,12 @@
#include "../../../misc/lv_color.h"
#include "../../../stdlib/lv_string.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON
#include "neon/lv_blend_neon.h"
#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM
#include LV_DRAW_SW_ASM_CUSTOM_INCLUDE
#endif
/*********************
* DEFINES
*********************/
@@ -78,8 +84,20 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
int32_t x;
int32_t y;
LV_UNUSED(w);
LV_UNUSED(h);
LV_UNUSED(x);
LV_UNUSED(y);
LV_UNUSED(opa);
LV_UNUSED(mask);
LV_UNUSED(mask_stride);
LV_UNUSED(dest_stride);
/*Simple fill*/
if(mask == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888
LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888(dsc);
#else
uint32_t color32 = lv_color_to_u32(dsc->color);
uint32_t * dest_buf = dsc->dest_buf;
for(y = 0; y < h; y++) {
@@ -110,9 +128,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
dest_buf = drawbuf_next_row(dest_buf, dest_stride);
}
#endif
}
/*Opacity only*/
else if(mask == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA
LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA(dsc);
#else
lv_color32_t color_argb = lv_color_to_32(dsc->color, opa);
lv_color32_t * dest_buf = dsc->dest_buf;
@@ -122,9 +144,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
}
dest_buf = drawbuf_next_row(dest_buf, dest_stride);
}
#endif
}
/*Masked with full opacity*/
else if(mask && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK
LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK(dsc);
#else
lv_color32_t color_argb = lv_color_to_32(dsc->color, 0xff);
lv_color32_t * dest_buf = dsc->dest_buf;
for(y = 0; y < h; y++) {
@@ -136,9 +162,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
dest_buf = drawbuf_next_row(dest_buf, dest_stride);
mask += mask_stride;
}
#endif
}
/*Masked with opacity*/
else {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA
LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(dsc);
#else
lv_color32_t color_argb = lv_color_to_32(dsc->color, opa);
lv_color32_t * dest_buf = dsc->dest_buf;
for(y = 0; y < h; y++) {
@@ -149,6 +179,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
dest_buf = drawbuf_next_row(dest_buf, dest_stride);
mask += mask_stride;
}
#endif
}
}
@@ -196,8 +227,18 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
int32_t x;
int32_t y;
LV_UNUSED(color_argb);
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
if(mask_buf == NULL) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888
if(opa >= LV_OPA_MAX) {
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(dsc);
}
else {
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc);
}
#else
color_argb.alpha = opa;
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
@@ -209,8 +250,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride);
}
#endif
}
else if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
color_argb.alpha = mask_buf[x];
@@ -223,8 +268,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride);
mask_buf += mask_stride;
}
#endif
}
else {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
color_argb.alpha = LV_OPA_MIX2(mask_buf[x], opa);
@@ -237,6 +286,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride);
mask_buf += mask_stride;
}
#endif
}
}
else {
@@ -278,9 +328,14 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
int32_t src_x;
int32_t y;
LV_UNUSED(color_argb);
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
/*Special case*/
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888(dsc, src_px_size);
#else
if(src_px_size == 4) {
uint32_t line_in_bytes = w * 4;
for(y = 0; y < h; y++) {
@@ -301,8 +356,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf = drawbuf_next_row(src_buf, src_stride);
}
}
#endif
}
if(mask_buf == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc, src_px_size);
#else
color_argb.alpha = opa;
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
@@ -314,8 +373,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
src_buf = drawbuf_next_row(src_buf, src_stride);
}
#endif
}
if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc, src_px_size);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
color_argb.alpha = mask_buf[dest_x];
@@ -328,8 +391,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf = drawbuf_next_row(src_buf, src_stride);
mask_buf += mask_stride;
}
#endif
}
if(mask_buf && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc, src_px_size);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
color_argb.alpha = (opa * mask_buf[dest_x]) >> 8;
@@ -342,6 +409,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf = drawbuf_next_row(src_buf, src_stride);
mask_buf += mask_stride;
}
#endif
}
}
else {
@@ -384,6 +452,9 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
dest_buf_c32[x] = lv_color_32_32_mix(src_buf_c32[x], dest_buf_c32[x], &cache);
@@ -391,8 +462,12 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
}
#endif
}
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
color_argb = src_buf_c32[x];
@@ -402,8 +477,12 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
}
#endif
}
else if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
color_argb = src_buf_c32[x];
@@ -414,8 +493,12 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
mask_buf += mask_stride;
}
#endif
}
else if(mask_buf && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
color_argb = src_buf_c32[x];
@@ -426,6 +509,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
mask_buf += mask_stride;
}
#endif
}
}
else {
+82 -1
View File
@@ -1,5 +1,5 @@
/**
* @file lv_draw_sw_blend.c
* @file lv_draw_sw_blend_to_rgb565.c
*
*/
@@ -16,6 +16,12 @@
#include "../../../misc/lv_color.h"
#include "../../../stdlib/lv_string.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON
#include "neon/lv_blend_neon.h"
#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM
#include LV_DRAW_SW_ASM_CUSTOM_INCLUDE
#endif
/*********************
* DEFINES
*********************/
@@ -77,8 +83,22 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
int32_t x;
int32_t y;
LV_UNUSED(w);
LV_UNUSED(h);
LV_UNUSED(x);
LV_UNUSED(y);
LV_UNUSED(opa);
LV_UNUSED(mask);
LV_UNUSED(color16);
LV_UNUSED(mask_stride);
LV_UNUSED(dest_stride);
LV_UNUSED(dest_buf_u16);
/*Simple fill*/
if(mask == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565
LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc);
#else
for(y = 0; y < h; y++) {
uint16_t * dest_end_final = dest_buf_u16 + w;
uint32_t * dest_end_mid = (uint32_t *)((uint16_t *) dest_buf_u16 + ((w - 1) & ~(0xF)));
@@ -111,9 +131,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
dest_buf_u16 -= w;
}
#endif
}
/*Opacity only*/
else if(mask == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA
LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc);
#else
uint32_t last_dest32_color = dest_buf_u16[0] + 1; /*Set to value which is not equal to the first pixel*/
uint32_t last_res32_color = 0;
@@ -150,10 +174,14 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
}
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
}
#endif
}
/*Masked with full opacity*/
else if(mask && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK
LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc);
#else
uint32_t c32 = color16 + ((uint32_t)color16 << 16);
for(y = 0; y < h; y++) {
for(x = 0; x < w && ((lv_uintptr_t)(mask) & 0x3); x++) {
@@ -189,9 +217,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
mask += mask_stride;
}
#endif
}
/*Masked with opacity*/
else if(mask && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA
LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], LV_OPA_MIX2(mask[x], opa));
@@ -199,6 +231,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
mask += mask_stride;
}
#endif
}
}
@@ -244,14 +277,21 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc);
#else
uint32_t line_in_bytes = w * 2;
for(y = 0; y < h; y++) {
lv_memcpy(dest_buf_u16, src_buf_u16, line_in_bytes);
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
}
#endif
}
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], opa);
@@ -259,8 +299,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
}
#endif
}
else if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], mask_buf[x]);
@@ -269,8 +313,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
mask_buf += mask_stride;
}
#endif
}
else {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++) {
dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], LV_OPA_MIX2(mask_buf[x], opa));
@@ -279,6 +327,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride);
mask_buf += mask_stride;
}
#endif
}
}
else {
@@ -345,6 +394,9 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
dest_buf_u16[dest_x] = ((src_buf_u8[src_x + 2] & 0xF8) << 8) +
@@ -354,8 +406,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
src_buf_u8 += src_stride;
}
#endif
}
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], opa);
@@ -363,8 +419,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
src_buf_u8 += src_stride;
}
#endif
}
if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], mask_buf[dest_x]);
@@ -373,8 +433,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
#endif
}
if(mask_buf && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(mask_buf[dest_x], opa));
@@ -383,6 +447,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
#endif
}
}
else {
@@ -445,6 +510,9 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], src_buf_u8[src_x + 3]);
@@ -452,8 +520,12 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
src_buf_u8 += src_stride;
}
#endif
}
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(src_buf_u8[src_x + 3],
@@ -462,8 +534,12 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride);
src_buf_u8 += src_stride;
}
#endif
}
else if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x],
@@ -473,8 +549,12 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
#endif
}
else if(mask_buf && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) {
dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x],
@@ -484,6 +564,7 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d
src_buf_u8 += src_stride;
mask_buf += mask_stride;
}
#endif
}
}
else {
+34 -2
View File
@@ -1,5 +1,5 @@
/**
* @file lv_draw_sw_blend_rgb888.c
* @file lv_draw_sw_blend_to_rgb888.c
*
*/
@@ -17,7 +17,7 @@
#include "../../../stdlib/lv_string.h"
#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON
#include "neon/lv_blend_to_rgb888_neon.h"
#include "neon/lv_blend_neon.h"
#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM
#include LV_DRAW_SW_ASM_CUSTOM_INCLUDE
#endif
@@ -237,6 +237,9 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size);
#else
for(y = 0; y < h; y++) {
for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) {
dest_buf_u8[dest_x + 2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/
@@ -246,8 +249,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_u8 += dest_stride;
src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride);
}
#endif
}
else if(mask_buf == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size);
#else
uint8_t res[3];
for(y = 0; y < h; y++) {
for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) {
@@ -259,8 +266,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf_u8 += dest_stride;
src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride);
}
#endif
}
else if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size);
#else
uint8_t res[3];
for(y = 0; y < h; y++) {
for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) {
@@ -273,8 +284,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride);
mask_buf += mask_stride;
}
#endif
}
else {
#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size);
#else
uint8_t res[3];
for(y = 0; y < h; y++) {
for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) {
@@ -287,6 +302,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc
src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride);
mask_buf += mask_stride;
}
#endif
}
}
else {
@@ -327,6 +343,9 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
/*Special case*/
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size, src_px_size);
#else
if(src_px_size == dest_px_size) {
for(y = 0; y < h; y++) {
lv_memcpy(dest_buf, src_buf, w);
@@ -345,8 +364,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf += src_stride;
}
}
#endif
}
if(mask_buf == NULL && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size, src_px_size);
#else
for(y = 0; y < h; y++) {
for(dest_x = 0, src_x = 0; dest_x < w; dest_x += dest_px_size, src_x += src_px_size) {
lv_color_24_24_mix(&src_buf[src_x], &dest_buf[dest_x], opa);
@@ -354,8 +377,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
dest_buf += dest_stride;
src_buf += src_stride;
}
#endif
}
if(mask_buf && opa >= LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size, src_px_size);
#else
uint32_t mask_x;
for(y = 0; y < h; y++) {
for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x += dest_px_size, src_x += src_px_size) {
@@ -365,8 +392,12 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf += src_stride;
mask_buf += mask_stride;
}
#endif
}
if(mask_buf && opa < LV_OPA_MAX) {
#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size, src_px_size);
#else
uint32_t mask_x;
for(y = 0; y < h; y++) {
for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x += dest_px_size, src_x += src_px_size) {
@@ -376,6 +407,7 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc
src_buf += src_stride;
mask_buf += mask_stride;
}
#endif
}
}
else {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6
View File
@@ -55,7 +55,9 @@
* Start parsing lv_conf_template.h
-----------------------------------*/
#ifndef __ASSEMBLY__
#include <stdint.h>
#endif
/*====================
COLOR SETTINGS
@@ -2890,15 +2892,19 @@
* End of parsing lv_conf_template.h
-----------------------------------*/
#ifndef __ASSEMBLY__
LV_EXPORT_CONST_INT(LV_DPI_DEF);
#endif
#undef _LV_KCONFIG_PRESENT
#ifndef __ASSEMBLY__
#if LV_USE_FLOAT
typedef float lv_value_precise_t;
#else
typedef int32_t lv_value_precise_t;
#endif
#endif
/*Set some defines if a dependency is disabled*/
#if LV_USE_LOG == 0
+8
View File
@@ -13,7 +13,10 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#ifndef __ASSEMBLY__
#include <stdint.h>
#endif
/*********************
* DEFINES
@@ -55,6 +58,9 @@ extern "C" {
* TYPEDEFS
**********************/
/* Exclude C enum and struct definitions when included by assembly code */
#ifndef __ASSEMBLY__
/**
* LVGL error codes.
*/
@@ -88,6 +94,8 @@ typedef int32_t lv_intptr_t;
#endif
#endif /*__ASSEMBLY__*/
/**********************
* GLOBAL PROTOTYPES
**********************/