mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
add_files
This commit is contained in:
parent
fb26085771
commit
c25d624cda
@ -11,20 +11,6 @@ int Arm2D_is_point_inside_region(PikaObj* self,
|
||||
return arm_2d_is_point_inside_region(_region, _location);
|
||||
}
|
||||
|
||||
int Arm2D_is_root_tile(PikaObj* self, PikaObj* tile) {
|
||||
arm_2d_tile_t* _tile = obj_getStruct(tile, "_self");
|
||||
return arm_2d_is_root_tile(_tile);
|
||||
}
|
||||
|
||||
PikaObj* Arm2D_get_absolute_location(PikaObj* self, PikaObj* tile) {
|
||||
arm_2d_tile_t* _tile = obj_getStruct(tile, "_self");
|
||||
arm_2d_location_t _location = {0};
|
||||
arm_2d_get_absolute_location(_tile, &_location);
|
||||
PikaObj* location = newNormalObj(New_Arm2D_Location);
|
||||
obj_setStruct(location, "_self", _location);
|
||||
return location;
|
||||
}
|
||||
|
||||
void Arm2D___init__(PikaObj* self) {
|
||||
int32_t __Arm2D_platform_Init();
|
||||
__Arm2D_platform_Init();
|
||||
@ -36,6 +22,12 @@ void Arm2D___init__(PikaObj* self) {
|
||||
obj_setInt(self, "CP_MODE_X_MIRROR", ARM_2D_CP_MODE_X_MIRROR);
|
||||
obj_setInt(self, "CP_MODE_XY_MIRROR", ARM_2D_CP_MODE_XY_MIRROR);
|
||||
|
||||
obj_setInt(self, "COLOR_WHITE", GLCD_COLOR_WHITE);
|
||||
obj_setInt(self, "COLOR_BLACK", GLCD_COLOR_BLACK);
|
||||
obj_setInt(self, "COLOR_RED", GLCD_COLOR_RED);
|
||||
obj_setInt(self, "COLOR_BLUE", GLCD_COLOR_BLUE);
|
||||
obj_setInt(self, "COLOR_GREEN", GLCD_COLOR_GREEN);
|
||||
|
||||
pika_arm2d_init();
|
||||
}
|
||||
|
||||
@ -50,7 +42,11 @@ int Arm2D_tile_copy(PikaObj* self,
|
||||
return arm_2d_tile_copy(_src, _des, _des_reg, mode);
|
||||
}
|
||||
|
||||
int Arm2D_alpha_blending(PikaObj *self, PikaObj* src, PikaObj* des, PikaObj* reg, int alp){
|
||||
int Arm2D_alpha_blending(PikaObj* self,
|
||||
PikaObj* src,
|
||||
PikaObj* des,
|
||||
PikaObj* reg,
|
||||
int alp) {
|
||||
arm_2d_tile_t* _src = obj_getStruct(src, "_self");
|
||||
arm_2d_tile_t* _des = obj_getStruct(des, "_self");
|
||||
arm_2d_region_t* _reg = obj_getStruct(reg, "_self");
|
||||
@ -68,3 +64,31 @@ void Arm2D_update(PikaObj* self) {
|
||||
while (arm_fsm_rt_cpl != arm_2d_helper_pfb_task(&s_tPFBHelper, NULL))
|
||||
;
|
||||
}
|
||||
|
||||
PikaObj* Arm2D_create_location(PikaObj* self, int x, int y) {
|
||||
PikaObj* location = newNormalObj(New_Arm2D_Location);
|
||||
arm_2d_location_t _location = {
|
||||
.iX = x,
|
||||
.iY = y,
|
||||
};
|
||||
obj_setStruct(location, "_self", _location);
|
||||
return location;
|
||||
}
|
||||
|
||||
PikaObj* Arm2D_create_region(PikaObj* self, int x, int y, int w, int h) {
|
||||
PikaObj* region = newNormalObj(New_Arm2D_Region);
|
||||
arm_2d_region_t _region = {
|
||||
.tLocation =
|
||||
{
|
||||
.iX = x,
|
||||
.iY = y,
|
||||
},
|
||||
.tSize =
|
||||
{
|
||||
.iWidth = w,
|
||||
.iHeight = h,
|
||||
},
|
||||
};
|
||||
obj_setStruct(region, "_self", _region);
|
||||
return region;
|
||||
}
|
||||
|
@ -1,11 +1,35 @@
|
||||
class Window:
|
||||
background = BackGround()
|
||||
elems = ElementList()
|
||||
def __init__(self): ...
|
||||
|
||||
def addCallBack(callback: any):
|
||||
"""
|
||||
Interface of callback:
|
||||
``` callback(frameBuff: Tile, isNewFrame:int) ```
|
||||
"""
|
||||
|
||||
# origin APIs
|
||||
|
||||
|
||||
CP_MODE_COPY: int
|
||||
CP_MODE_FILL: int
|
||||
CP_MODE_Y_MIRROR: int
|
||||
CP_MODE_X_MIRROR: int
|
||||
CP_MODE_XY_MIRROR: int
|
||||
|
||||
COLOR_WHITE: int
|
||||
COLOR_BLACK: int
|
||||
COLOR_RED: int
|
||||
COLOR_BLUE: int
|
||||
COLOR_GREEN: int
|
||||
|
||||
|
||||
def __init__(): ...
|
||||
def create_region(x: int, y: int, w: int, h: int) -> Region: ...
|
||||
def create_location(x: int, y: int) -> Location: ...
|
||||
def update(): ...
|
||||
|
||||
|
||||
class Tile:
|
||||
def __init__(self): ...
|
||||
@ -16,17 +40,16 @@ class Tile:
|
||||
def shape_compare(self, reference: Region) -> int: ...
|
||||
def region_diff(self, tile: Tile) -> Region: ...
|
||||
def transform(self, reg: Region, centre: Location) -> int: ...
|
||||
def rotate(self, reg: Region, centre: Location) -> int: ...
|
||||
def is_root_tile(self) -> int: ...
|
||||
def get_absolute_location(self) -> Location: ...
|
||||
def rotation(self, des: Tile, des_reg: Region, centre: Location, angle: float, mask_color: int) -> int: ...
|
||||
|
||||
|
||||
def __init__(): ...
|
||||
def is_point_inside_region(region: Region, location: Location) -> int: ...
|
||||
def get_absolute_location(tile: Tile) -> Location: ...
|
||||
def is_root_tile(tile: Tile) -> int: ...
|
||||
def tile_copy(src: Tile, des: Tile, des_reg: Region, mode: int) -> int: ...
|
||||
def alpha_blending(src: Tile, des: Tile, reg: Region, alp: int) -> int: ...
|
||||
def fill_colour(tile: Tile, reg: Region, colour: int) -> int: ...
|
||||
def update(): ...
|
||||
|
||||
|
||||
class Region:
|
||||
def __init__(self): ...
|
||||
@ -37,15 +60,12 @@ class Location:
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
class Corner(Tile):
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
class WhiteDotAlpha(Tile):
|
||||
class Star(Tile):
|
||||
def __init__(self): ...
|
||||
|
||||
# high level APIs
|
||||
|
||||
|
||||
class BackGround:
|
||||
def __init__(self): ...
|
||||
def setColor(self, color: str): ...
|
||||
@ -74,9 +94,3 @@ class Box(Element):
|
||||
def __init__(self): ...
|
||||
def setColor(self, color: str): ...
|
||||
def setSize(self, x: int, y: int): ...
|
||||
|
||||
|
||||
class Window:
|
||||
background = BackGround()
|
||||
elems = ElementList()
|
||||
def __init__(self): ...
|
||||
|
@ -9,7 +9,7 @@ char* Arm2D_BackGround_getColor(PikaObj* self) {
|
||||
}
|
||||
|
||||
void Arm2D_BackGround_update(PikaObj* self) {
|
||||
void* target_tile = pika_arm2d_window.pfb_tile_now;
|
||||
void* target_tile = pika_arm2d_globals.pfb_tile_now;
|
||||
|
||||
char* color = obj_getStr(self, "color");
|
||||
uint16_t backGroundColor = getColorCode(color);
|
||||
|
@ -23,8 +23,8 @@ int __max(int x, int y) {
|
||||
}
|
||||
|
||||
void Arm2D_Box_update(PikaObj* self) {
|
||||
void* target_tile = pika_arm2d_window.pfb_tile_now;
|
||||
bool bIsNewFrame = pika_arm2d_window.pfb_is_new_frame;
|
||||
void* target_tile = pika_arm2d_globals.pfb_tile_now;
|
||||
bool bIsNewFrame = pika_arm2d_globals.pfb_is_new_frame;
|
||||
|
||||
arm_2d_region_t arg2d_regin = {0};
|
||||
arg2d_regin.tSize.iHeight = obj_getInt(self, "height");
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "Arm2D_Tile.h"
|
||||
#include "Arm2D_Corner.h"
|
||||
#include "Arm2D_WhiteDotAlpha.h"
|
||||
#include "Arm2D_Location.h"
|
||||
#include "Arm2D_Star.h"
|
||||
#include "Arm2D_Region.h"
|
||||
#include "Arm2D_common.h"
|
||||
|
||||
@ -63,16 +63,6 @@ int Arm2D_Tile_width_compare(PikaObj* self, PikaObj* reference) {
|
||||
return arm_2d_tile_width_compare(_self, _reference);
|
||||
}
|
||||
|
||||
void Arm2D_Corner___init__(PikaObj *self){
|
||||
extern arm_2d_tile_t s_tCorner;
|
||||
obj_setStruct(self, "_self", s_tCorner);
|
||||
}
|
||||
|
||||
void Arm2D_WhiteDotAlpha___init__(PikaObj *self){
|
||||
extern arm_2d_tile_t c_tileWhiteDotAlphaQuarter;
|
||||
obj_setStruct(self, "_self", c_tileWhiteDotAlphaQuarter);
|
||||
}
|
||||
|
||||
int Arm2D_Tile_transform(PikaObj *self, PikaObj* reg, PikaObj* centre){
|
||||
arm_2d_tile_t* _self = obj_getStruct(self, "_self");
|
||||
arm_2d_region_t* _reg = obj_getStruct(reg, "_self");
|
||||
@ -80,10 +70,29 @@ int Arm2D_Tile_transform(PikaObj *self, PikaObj* reg, PikaObj* centre){
|
||||
return arm_2d_tile_transform(_self, _reg, _centre);
|
||||
}
|
||||
|
||||
|
||||
int Arm2D_Tile_rotate(PikaObj *self, PikaObj* reg, PikaObj* centre){
|
||||
int Arm2D_Tile_is_root_tile(PikaObj *self){
|
||||
arm_2d_tile_t* _self = obj_getStruct(self, "_self");
|
||||
arm_2d_region_t* _reg = obj_getStruct(reg, "_self");
|
||||
arm_2d_location_t* _centre = obj_getStruct(centre, "_self");
|
||||
return arm_2d_tile_rotate(_self, _reg, _centre);
|
||||
return arm_2d_is_root_tile(_self);
|
||||
}
|
||||
|
||||
PikaObj* Arm2D_Tile_get_absolute_location(PikaObj *self){
|
||||
arm_2d_tile_t* _self = obj_getStruct(self, "_self");
|
||||
arm_2d_location_t _location = {0};
|
||||
arm_2d_get_absolute_location(_self, &_location);
|
||||
PikaObj* location = newNormalObj(New_Arm2D_Location);
|
||||
obj_setStruct(location, "_self", _location);
|
||||
return location;
|
||||
}
|
||||
|
||||
void Arm2D_Star___init__(PikaObj *self){
|
||||
extern arm_2d_tile_t c_tilePictureSunRGB565;
|
||||
obj_setStruct(self, "_self", c_tilePictureSunRGB565);
|
||||
}
|
||||
|
||||
int Arm2D_Tile_rotation(PikaObj *self, PikaObj* des, PikaObj* des_reg, PikaObj* centre, double angle, int mask_color){
|
||||
arm_2d_tile_t* _self = obj_getStruct(self, "_self");
|
||||
arm_2d_tile_t* _des = obj_getStruct(des, "_self");
|
||||
arm_2d_region_t* _des_reg = obj_getStruct(des_reg, "_self");
|
||||
arm_2d_location_t* _centre = obj_getStruct(centre, "_self");
|
||||
return arm_2d_tile_rotation(_self, _des, _des_reg, *_centre, angle, mask_color);
|
||||
}
|
||||
|
@ -1,16 +1,25 @@
|
||||
#include "Arm2D_Window.h"
|
||||
#include "Arm2D_Background.h"
|
||||
#include "Arm2D_ElementList.h"
|
||||
#include "Arm2D_Tile.h"
|
||||
#include "Arm2D_common.h"
|
||||
|
||||
#include "arm_2d.h"
|
||||
#include "arm_2d_helper.h"
|
||||
#include "pikaScript.h"
|
||||
|
||||
pika_arm2d_window_t pika_arm2d_window;
|
||||
pika_arm2d_globals_t pika_arm2d_globals;
|
||||
arm_2d_helper_pfb_t s_tPFBHelper;
|
||||
|
||||
static IMPL_PFB_ON_LOW_LV_RENDERING(__pfb_render_handler) {
|
||||
int32_t __Arm2D_platform_drawRegin(uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
const uint8_t* bitmap);
|
||||
|
||||
static void __pfb_render_handler(void* pTarget,
|
||||
const arm_2d_pfb_t* ptPFB,
|
||||
bool bIsNewFrame) {
|
||||
const arm_2d_tile_t* pfb_tile = &(ptPFB->tTile);
|
||||
|
||||
ARM_2D_UNUSED(pTarget);
|
||||
@ -25,21 +34,52 @@ static IMPL_PFB_ON_LOW_LV_RENDERING(__pfb_render_handler) {
|
||||
(arm_2d_pfb_t*)ptPFB);
|
||||
}
|
||||
|
||||
static IMPL_PFB_ON_DRAW(pika_pfb_drow_window_hanlder) {
|
||||
ARM_2D_UNUSED(pTarget);
|
||||
ARM_2D_UNUSED(bIsNewFrame);
|
||||
static void Arm2D_callback_update(void) {
|
||||
PikaObj* self = pika_arm2d_globals.pika_windows_object;
|
||||
if (obj_getInt(self, "callback_exist") == 1) {
|
||||
PikaObj* __frameBuffer = obj_getPtr(self, "__frameBuffer");
|
||||
obj_setStruct(__frameBuffer, "_self", *pika_arm2d_globals.pfb_tile_now);
|
||||
obj_setInt(self, "__isNewFrame", pika_arm2d_globals.pfb_is_new_frame);
|
||||
/* clang-format off */
|
||||
PIKA_PYTHON(
|
||||
__callback(__frameBuffer, __isNewFrame)
|
||||
)
|
||||
/* clang-format on */
|
||||
const uint8_t bytes[] = {
|
||||
0x0c, 0x00, /* instruct array size */
|
||||
0x10, 0x81, 0x01, 0x00, 0x10, 0x01, 0x0f, 0x00, 0x00, 0x02, 0x1c,
|
||||
0x00,
|
||||
/* instruct array */
|
||||
0x27, 0x00, /* const pool size */
|
||||
0x00, 0x5f, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x42, 0x75, 0x66,
|
||||
0x66, 0x65, 0x72, 0x00, 0x5f, 0x5f, 0x69, 0x73, 0x4e, 0x65, 0x77,
|
||||
0x46, 0x72, 0x61, 0x6d, 0x65, 0x00, 0x5f, 0x5f, 0x63, 0x61, 0x6c,
|
||||
0x6c, 0x62, 0x61, 0x63, 0x6b, 0x00, /* const pool */
|
||||
};
|
||||
pikaVM_runByteCode(self, (uint8_t*)bytes);
|
||||
}
|
||||
}
|
||||
|
||||
pika_arm2d_window.pfb_tile_now = (arm_2d_tile_t*)ptTile;
|
||||
pika_arm2d_window.pfb_is_new_frame = bIsNewFrame;
|
||||
PikaObj* background = pika_arm2d_window.pika_background_object;
|
||||
PikaObj* elems = pika_arm2d_window.pika_elems_object;
|
||||
static arm_fsm_rt_t pika_pfb_drow_window_hanlder(
|
||||
void* pTarget,
|
||||
const arm_2d_tile_t* frameBuffer,
|
||||
bool isNewFrame) {
|
||||
ARM_2D_UNUSED(pTarget);
|
||||
|
||||
pika_arm2d_globals.pfb_tile_now = (arm_2d_tile_t*)frameBuffer;
|
||||
pika_arm2d_globals.pfb_is_new_frame = isNewFrame;
|
||||
PikaObj* background = pika_arm2d_globals.pika_background_object;
|
||||
PikaObj* elems = pika_arm2d_globals.pika_elems_object;
|
||||
Arm2D_BackGround_update(background);
|
||||
Arm2D_ElementList_update(elems);
|
||||
Arm2D_callback_update();
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
void pika_arm2d_init(void) {
|
||||
arm_irq_safe { arm_2d_init(); }
|
||||
arm_irq_safe {
|
||||
arm_2d_init();
|
||||
}
|
||||
//! initialise FPB helper
|
||||
if (ARM_2D_HELPER_PFB_INIT(
|
||||
&s_tPFBHelper, //!< FPB Helper object
|
||||
@ -67,9 +107,16 @@ void pika_arm2d_init(void) {
|
||||
}
|
||||
|
||||
void Arm2D_Window___init__(PikaObj* self) {
|
||||
pika_arm2d_window.pika_windows_object = self;
|
||||
pika_arm2d_window.pika_elems_object = obj_getObj(self, "elems");
|
||||
pika_arm2d_window.pika_background_object =
|
||||
obj_getObj(self, "background");
|
||||
pika_arm2d_window.dirty_region_list = NULL;
|
||||
obj_setInt(self, "callback_exist", 0);
|
||||
PikaObj* __frameBuffer = newNormalObj(New_Arm2D_Tile);
|
||||
obj_setPtr(self, "__frameBuffer", __frameBuffer);
|
||||
pika_arm2d_globals.pika_windows_object = self;
|
||||
pika_arm2d_globals.pika_elems_object = obj_getObj(self, "elems");
|
||||
pika_arm2d_globals.pika_background_object = obj_getObj(self, "background");
|
||||
pika_arm2d_globals.dirty_region_list = NULL;
|
||||
}
|
||||
|
||||
void Arm2D_Window_addCallBack(PikaObj* self, Arg* callback) {
|
||||
obj_setInt(self, "callback_exist", 1);
|
||||
obj_setArg(self, "__callback", callback);
|
||||
}
|
||||
|
@ -26,16 +26,16 @@ typedef struct __pika_arm2d_box_info_t {
|
||||
uint16_t color_code, color_code_last;
|
||||
} pika_arm2d_box_info_t;
|
||||
|
||||
typedef struct __pika_arm2d_window_t {
|
||||
typedef struct __pika_arm2d_globals_t {
|
||||
arm_2d_tile_t* pfb_tile_now;
|
||||
bool pfb_is_new_frame;
|
||||
arm_2d_region_list_item_t* dirty_region_list;
|
||||
PikaObj* pika_windows_object;
|
||||
PikaObj* pika_background_object;
|
||||
PikaObj* pika_elems_object;
|
||||
} pika_arm2d_window_t;
|
||||
} pika_arm2d_globals_t;
|
||||
|
||||
extern pika_arm2d_window_t pika_arm2d_window;
|
||||
extern pika_arm2d_globals_t pika_arm2d_globals;
|
||||
|
||||
/* GLCD RGB color definitions */
|
||||
#define GLCD_COLOR_BLACK 0x0000 /* 0, 0, 0 */
|
||||
@ -71,7 +71,7 @@ typedef struct {
|
||||
} rotate_tile_t;
|
||||
|
||||
#define __implement_tile(__NAME, __WIDTH, __HEIGHT, __TYPE, ...) \
|
||||
ARM_NOINIT static __TYPE \
|
||||
static __TYPE \
|
||||
__NAME##Buffer[(__WIDTH) * (__HEIGHT)]; \
|
||||
const arm_2d_tile_t __NAME = { \
|
||||
.tRegion = { \
|
||||
@ -149,6 +149,10 @@ typedef struct {
|
||||
arm_2dp_gray8_tile_rotation_with_src_mask_and_opacity
|
||||
# define arm_2dp_tile_rotation_with_src_mask \
|
||||
arm_2dp_gray8_tile_rotation_with_src_mask
|
||||
|
||||
# define arm_2d_tile_rotation \
|
||||
arm_2d_gray8_tile_rotation
|
||||
|
||||
#elif __GLCD_CFG_COLOUR_DEPTH__ == 16
|
||||
|
||||
# define __arm_2d_color_t arm_2d_color_rgb565_t
|
||||
@ -207,6 +211,10 @@ typedef struct {
|
||||
arm_2dp_rgb565_tile_rotation_with_src_mask_and_opacity
|
||||
# define arm_2dp_tile_rotation_with_src_mask \
|
||||
arm_2dp_rgb565_tile_rotation_with_src_mask
|
||||
|
||||
|
||||
# define arm_2d_tile_rotation \
|
||||
arm_2d_rgb565_tile_rotation
|
||||
#elif __GLCD_CFG_COLOUR_DEPTH__ == 32
|
||||
|
||||
# define __arm_2d_color_t arm_2d_color_cccn888_t
|
||||
@ -265,6 +273,10 @@ typedef struct {
|
||||
arm_2dp_cccn888_tile_rotation_with_src_mask_and_opacity
|
||||
# define arm_2dp_tile_rotation_with_src_mask \
|
||||
arm_2dp_cccn888_tile_rotation_with_src_mask
|
||||
|
||||
# define arm_2d_tile_rotation \
|
||||
arm_2d_cccn888_tile_rotation
|
||||
|
||||
#else
|
||||
# error Unsupported colour depth!
|
||||
#endif
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2022 Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d_dis_adapters.h"
|
||||
* Description: Public header file to include all display adapter header files
|
||||
*
|
||||
* $Date: 12. Aug 2022
|
||||
* $Revision: V.1.0.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_DISP_ADAPTERS_H__
|
||||
#define __ARM_2D_DISP_ADAPTERS_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER0__
|
||||
# include "arm_2d_disp_adapter_0.h"
|
||||
#endif
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER1__
|
||||
# include "arm_2d_disp_adapter_1.h"
|
||||
#endif
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER2__
|
||||
# include "arm_2d_disp_adapter_2.h"
|
||||
#endif
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER3__
|
||||
# include "arm_2d_disp_adapter_3.h"
|
||||
#endif
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER4__
|
||||
# include "arm_2d_disp_adapter_4.h"
|
||||
#endif
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER5__
|
||||
# include "arm_2d_disp_adapter_5.h"
|
||||
#endif
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER6__
|
||||
# include "arm_2d_disp_adapter_6.h"
|
||||
#endif
|
||||
|
||||
#ifdef __RTE_ACCELERATION_ARM_2D_HELPER_DISP_ADAPTER7__
|
||||
# include "arm_2d_disp_adapter_7.h"
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
|
||||
#endif
|
@ -1,187 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d_helper.h"
|
||||
* Description: Public header file for the all helper services
|
||||
*
|
||||
* $Date: 03. Sept 2022
|
||||
* $Revision: V.1.2.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_HELPER_H__
|
||||
#define __ARM_2D_HELPER_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d.h"
|
||||
#include "./arm_2d_helper_pfb.h"
|
||||
#include "./arm_2d_helper_scene.h"
|
||||
#include "./arm_2d_disp_adapters.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* \addtogroup gHelper 7 Helper Services
|
||||
* @{
|
||||
*/
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
#define __declare_tile(__name) \
|
||||
extern const arm_2d_tile_t __name;
|
||||
#define declare_tile(__name) __declare_tile(__name)
|
||||
|
||||
#define dcl_tile(__name) declare_tile(__name)
|
||||
#define dcl_fb(__name) declare_tile(__name)
|
||||
|
||||
|
||||
#define __impl_fb(__NAME, __WIDTH, __HEIGHT, __TYPE, ...) \
|
||||
ARM_NOINIT static __TYPE \
|
||||
__NAME##Buffer[(__WIDTH) * (__HEIGHT)]; \
|
||||
const arm_2d_tile_t __NAME = { \
|
||||
.tRegion = { \
|
||||
.tSize = {(__WIDTH), (__HEIGHT)}, \
|
||||
}, \
|
||||
.tInfo.bIsRoot = true, \
|
||||
.pchBuffer = (uint8_t *)__NAME##Buffer, \
|
||||
__VA_ARGS__ \
|
||||
};
|
||||
|
||||
#define impl_fb(__NAME, __WIDTH, __HEIGHT, __TYPE, ...) \
|
||||
__impl_fb(__NAME, __WIDTH, __HEIGHT, __TYPE, ##__VA_ARGS__)
|
||||
|
||||
#define get_tile_buffer_pixel_count(__NAME) \
|
||||
(uint32_t)( (__NAME.tRegion.tSize.iWidth) \
|
||||
* (__NAME.tRegion.tSize.iHeight))
|
||||
|
||||
#define get_tile_buffer_size(__NAME, __TYPE) \
|
||||
(get_2d_layer_buffer_pixel_count(__NAME) * sizeof(TYPE))
|
||||
|
||||
|
||||
#define impl_child_tile(__PARENT, __X, __Y, __WIDTH, __HEIGHT, ...) { \
|
||||
.tRegion = { \
|
||||
.tLocation = { \
|
||||
.iX = (__X), \
|
||||
.iY = (__Y), \
|
||||
}, \
|
||||
.tSize = { \
|
||||
.iWidth = (__WIDTH), \
|
||||
.iHeight = (__HEIGHT), \
|
||||
}, \
|
||||
}, \
|
||||
.tInfo.bIsRoot = false, \
|
||||
.tInfo.bDerivedResource = true, \
|
||||
.ptParent = (arm_2d_tile_t *)&(__PARENT), \
|
||||
__VA_ARGS__ \
|
||||
}
|
||||
|
||||
#define __arm_2d_align_centre2(__region, __size) \
|
||||
for (arm_2d_region_t __centre_region = { \
|
||||
.tSize = (__size), \
|
||||
.tLocation = { \
|
||||
.iX = ((__region).tSize.iWidth - (__size).iWidth) >> 1,\
|
||||
.iY = ((__region).tSize.iHeight - (__size).iHeight)>> 1,\
|
||||
}, \
|
||||
}, \
|
||||
*ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
|
||||
ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
|
||||
arm_2d_op_wait_async(NULL) \
|
||||
)
|
||||
|
||||
#define __arm_2d_align_centre3(__region, __width, __height) \
|
||||
for (arm_2d_region_t __centre_region = { \
|
||||
.tSize = { \
|
||||
.iWidth = (__width), \
|
||||
.iHeight = (__height), \
|
||||
}, \
|
||||
.tLocation = { \
|
||||
.iX = ((__region).tSize.iWidth - (__width)) >> 1, \
|
||||
.iY = ((__region).tSize.iHeight - (__height))>> 1, \
|
||||
}, \
|
||||
}, \
|
||||
*ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
|
||||
ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
|
||||
arm_2d_op_wait_async(NULL) \
|
||||
)
|
||||
|
||||
#define arm_2d_align_centre(...) \
|
||||
ARM_CONNECT2( __arm_2d_align_centre, \
|
||||
__ARM_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
|
||||
|
||||
/*!
|
||||
* \brief set an alarm with given period and check the status
|
||||
*
|
||||
* \param[in] wMS a time period in millisecond
|
||||
* \param[in] ... an optional timestamp holder
|
||||
*
|
||||
* \return bool whether it is timeout
|
||||
*/
|
||||
#define arm_2d_helper_is_time_out(__MS, ...) \
|
||||
__arm_2d_helper_is_time_out((__MS), (NULL, ##__VA_ARGS__))
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
__STATIC_INLINE bool __arm_2d_helper_is_time_out(uint32_t wMS, int64_t *plTimestamp)
|
||||
{
|
||||
int64_t lTimestamp = arm_2d_helper_get_system_timestamp();
|
||||
static int64_t s_lTimestamp = 0;
|
||||
if (NULL == plTimestamp) {
|
||||
plTimestamp = &s_lTimestamp;
|
||||
}
|
||||
|
||||
if (0 == *plTimestamp) {
|
||||
*plTimestamp = arm_2d_helper_convert_ms_to_ticks(wMS);
|
||||
*plTimestamp += lTimestamp;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lTimestamp >= *plTimestamp) {
|
||||
*plTimestamp = arm_2d_helper_convert_ms_to_ticks(wMS) + lTimestamp;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*! @} */
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,625 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d_helper_pfb.h"
|
||||
* Description: Public header file for the PFB helper service
|
||||
*
|
||||
* $Date: 29. Aug 2022
|
||||
* $Revision: V.1.2.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_HELPER_PFB_H__
|
||||
#define __ARM_2D_HELPER_PFB_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* \addtogroup gHelper 7 Helper Services
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
/*!
|
||||
* \brief a macro wrapper in uppercase to help initialising PFB service
|
||||
* \param[in] __CB_ADDR the address of the arm_2d_helper_pfb_t object
|
||||
* \param[in] __SCREEN_WIDTH the width of the screen
|
||||
* \param[in] __SCREEN_HEIGHT the hight of the screen
|
||||
* \param[in] __PIXEL_TYPE the integer type of the pixel, i.e. uint8_t, uint16_t,
|
||||
* uint32_t
|
||||
* \param[in] __WIDTH the width of the PFB block
|
||||
* \param[in] __HEIGHT the height of the PFB block
|
||||
* \note For the same number of pixels in a PFB block, please priority the width
|
||||
* over height, for example, 240 * 1 is better than 30 * 8
|
||||
* \param[in] __PFB_NUM the number of PFB blocks in the built-in PFB pool.
|
||||
* \param[in] ... a code block to add additional initializer, see example below:
|
||||
* \return arm_2d_err_t the result of the initialisation process
|
||||
*
|
||||
* \code {.c}
|
||||
|
||||
static ARM_NOINIT arm_2d_helper_pfb_t s_tExamplePFB;
|
||||
...
|
||||
// initialise FPB helper
|
||||
if (ARM_2D_HELPER_PFB_INIT(
|
||||
&s_tExamplePFB, // FPB Helper object
|
||||
__GLCD_CFG_SCEEN_WIDTH__, // screen width
|
||||
__GLCD_CFG_SCEEN_HEIGHT__, // screen height
|
||||
uint16_t, // colour date type
|
||||
240, // PFB block width
|
||||
1, // PFB block height
|
||||
1, // number of PFB in the PFB pool
|
||||
{
|
||||
.evtOnLowLevelRendering = {
|
||||
// callback for low level rendering
|
||||
.fnHandler = &__pfb_render_handler,
|
||||
},
|
||||
.evtOnDrawing = {
|
||||
// callback for drawing GUI
|
||||
.fnHandler = &__pfb_draw_background_handler,
|
||||
},
|
||||
},
|
||||
//.FrameBuffer.bSwapRGB16 = true,
|
||||
) < 0) {
|
||||
//! error detected
|
||||
assert(false);
|
||||
}
|
||||
* \endcode
|
||||
*
|
||||
*/
|
||||
#define ARM_2D_HELPER_PFB_INIT( __CB_ADDR, /* PFB Helper object address */ \
|
||||
__SCREEN_WIDTH, /* Screen width */ \
|
||||
__SCREEN_HEIGHT,/* Screen height */ \
|
||||
__PIXEL_TYPE, /* The type of the pixels */ \
|
||||
__WIDTH, /* The width of the PFB block */\
|
||||
__HEIGHT, /* The height of the PFB block*/\
|
||||
__PFB_NUM, /* Block count in the PFB pool*/\
|
||||
... /* Event Handler */ \
|
||||
) \
|
||||
({ \
|
||||
__attribute__((section(".bss.noinit.arm_2d_pfb_pool"))) \
|
||||
static struct { \
|
||||
arm_2d_pfb_t tFPB; \
|
||||
__ALIGNED(4) \
|
||||
__PIXEL_TYPE tBuffer[(__WIDTH) * (__HEIGHT)]; \
|
||||
} s_tPFBs[__PFB_NUM]; \
|
||||
\
|
||||
arm_2d_helper_pfb_cfg_t tCFG = { \
|
||||
.tDisplayArea.tSize = { \
|
||||
.iWidth = (__SCREEN_WIDTH), \
|
||||
.iHeight = (__SCREEN_HEIGHT), \
|
||||
}, \
|
||||
\
|
||||
.FrameBuffer.ptPFBs = (arm_2d_pfb_t *)s_tPFBs, \
|
||||
.FrameBuffer.tFrameSize = { \
|
||||
.iWidth = (__WIDTH), \
|
||||
.iHeight = (__HEIGHT), \
|
||||
}, \
|
||||
.FrameBuffer.wBufferSize = sizeof(s_tPFBs[0].tBuffer), \
|
||||
.FrameBuffer.hwPFBNum = dimof(s_tPFBs), \
|
||||
.Dependency = \
|
||||
__VA_ARGS__ \
|
||||
}; \
|
||||
\
|
||||
arm_2d_helper_pfb_init((__CB_ADDR), &tCFG); \
|
||||
})
|
||||
|
||||
/*!
|
||||
* \brief a macro wrapper to update the evtOnDrawring event handler
|
||||
* \param[in] __CB_ADDR the address of the arm_2d_helper_pfb_t object
|
||||
* \param[in] __HANDLER the new handler
|
||||
* \param[in] ... [Optional] an address (of user defined structure) passed to the
|
||||
* event handler.
|
||||
* \return arm_2d_err_t the process result
|
||||
*/
|
||||
#define ARM_2D_HELPER_PFB_UPDATE_ON_DRAW_HANDLER( \
|
||||
__CB_ADDR, /* PFB Helper object address */ \
|
||||
__HANDLER, /* new on-draw-handler function*/\
|
||||
...) /* An optional target address */ \
|
||||
arm_2d_helper_pfb_update_dependency((__CB_ADDR), \
|
||||
ARM_2D_PFB_DEPEND_ON_DRAWING, \
|
||||
(arm_2d_helper_pfb_dependency_t []) {{ \
|
||||
.evtOnDrawing = { \
|
||||
.fnHandler = (__HANDLER), \
|
||||
.pTarget = (NULL,##__VA_ARGS__),\
|
||||
}, \
|
||||
}})
|
||||
|
||||
|
||||
#define __IMPL_ARM_2D_REGION_LIST(__NAME, ...) \
|
||||
enum { \
|
||||
__NAME##_offset = __COUNTER__, \
|
||||
}; \
|
||||
__VA_ARGS__ \
|
||||
arm_2d_region_list_item_t __NAME[] = {
|
||||
|
||||
|
||||
#define IMPL_ARM_2D_REGION_LIST(__NAME, ...) \
|
||||
__IMPL_ARM_2D_REGION_LIST(__NAME,##__VA_ARGS__)
|
||||
|
||||
|
||||
#define END_IMPL_ARM_2D_REGION_LIST(...) \
|
||||
};
|
||||
|
||||
#define __ADD_REGION_TO_LIST(__NAME, ...) \
|
||||
{ \
|
||||
.ptNext = (arm_2d_region_list_item_t *) \
|
||||
&(__NAME[__COUNTER__ - __NAME##_offset]), \
|
||||
.tRegion = { \
|
||||
__VA_ARGS__ \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define ADD_REGION_TO_LIST(__NAME, ...) \
|
||||
__ADD_REGION_TO_LIST(__NAME, ##__VA_ARGS__)
|
||||
|
||||
|
||||
#define __ADD_LAST_REGION_TO_LIST(__NAME, ...) \
|
||||
{ \
|
||||
.ptNext = NULL, \
|
||||
.tRegion = { \
|
||||
__VA_ARGS__ \
|
||||
}, \
|
||||
}
|
||||
|
||||
#define ADD_LAST_REGION_TO_LIST(__NAME, ...) \
|
||||
__ADD_LAST_REGION_TO_LIST(__NAME, ##__VA_ARGS__)
|
||||
|
||||
#define IMPL_PFB_ON_DRAW(__NAME) \
|
||||
arm_fsm_rt_t __NAME(void *pTarget, \
|
||||
const arm_2d_tile_t *ptTile, \
|
||||
bool bIsNewFrame)
|
||||
|
||||
#define IMPL_PFB_ON_LOW_LV_RENDERING(__NAME) \
|
||||
void __NAME(void *pTarget, \
|
||||
const arm_2d_pfb_t *ptPFB, \
|
||||
bool bIsNewFrame)
|
||||
|
||||
|
||||
#define IMPL_PFB_ON_FRAME_SYNC_UP(__NAME) \
|
||||
bool __NAME(void *pTarget)
|
||||
|
||||
|
||||
/*!
|
||||
* \brief a macro wrapper in lowercase to help initialising PFB service
|
||||
* \param[in] __CB_ADDR the address of the arm_2d_helper_pfb_t object
|
||||
* \param[in] __SCREEN_WIDTH the width of the screen
|
||||
* \param[in] __SCREEN_HEIGHT the hight of the screen
|
||||
* \param[in] __PIXEL_TYPE the integer type of the pixel, i.e. uint8_t, uint16_t,
|
||||
* uint32_t
|
||||
* \param[in] __WIDTH the width of the PFB block
|
||||
* \param[in] __HEIGHT the height of the PFB block
|
||||
* \note For the same number of pixels in a PFB block, please priority the width
|
||||
* over height, for example, 240 * 1 is better than 30 * 8
|
||||
* \param[in] __PFB_NUM the number of PFB blocks in the built-in PFB pool.
|
||||
* \param[in] ... a code block to add additional initializer, see example below:
|
||||
* \return arm_2d_err_t the result of the initialisation process
|
||||
*
|
||||
* \code {.c}
|
||||
|
||||
static ARM_NOINIT arm_2d_helper_pfb_t s_tExamplePFB;
|
||||
...
|
||||
// initialise FPB helper
|
||||
if (init_arm_2d_helper_pfb(
|
||||
&s_tExamplePFB, // FPB Helper object
|
||||
__GLCD_CFG_SCEEN_WIDTH__, // screen width
|
||||
__GLCD_CFG_SCEEN_HEIGHT__, // screen height
|
||||
uint16_t, // colour date type
|
||||
240, // PFB block width
|
||||
1, // PFB block height
|
||||
1, // number of PFB in the PFB pool
|
||||
{
|
||||
.evtOnLowLevelRendering = {
|
||||
// callback for low level rendering
|
||||
.fnHandler = &__pfb_render_handler,
|
||||
},
|
||||
.evtOnDrawing = {
|
||||
// callback for drawing GUI
|
||||
.fnHandler = &__pfb_draw_background_handler,
|
||||
},
|
||||
},
|
||||
//.FrameBuffer.bSwapRGB16 = true,
|
||||
) < 0) {
|
||||
//! error detected
|
||||
assert(false);
|
||||
}
|
||||
* \endcode
|
||||
*
|
||||
*/
|
||||
#define init_arm_2d_helper_pfb( __CB_ADDR, \
|
||||
__SCREEN_WIDTH, \
|
||||
__SCREEN_HEIGHT, \
|
||||
__PIXEL_TYPE, \
|
||||
__WIDTH, \
|
||||
__HEIGHT, \
|
||||
__PFB_NUM, \
|
||||
... \
|
||||
) \
|
||||
ARM_2D_HELPER_PFB_INIT( \
|
||||
__CB_ADDR, \
|
||||
__SCREEN_WIDTH, \
|
||||
__SCREEN_HEIGHT, \
|
||||
__PIXEL_TYPE, \
|
||||
__WIDTH, \
|
||||
__HEIGHT, \
|
||||
__PFB_NUM, \
|
||||
##__VA_ARGS__ \
|
||||
)
|
||||
|
||||
/*!
|
||||
* \brief a macro wrapper to update the evtOnDrawring event handler
|
||||
* \param[in] __CB_ADDR the address of the arm_2d_helper_pfb_t object
|
||||
* \param[in] __HANDLER the new handler
|
||||
* \param[in] ... [Optional] an address (of user defined structure) passed to the
|
||||
* event handler.
|
||||
* \return arm_2d_err_t the process result
|
||||
*/
|
||||
#define update_arm_2d_helper_pfb_on_draw_handler( \
|
||||
__CB_ADDR, /* PFB Helper object address */ \
|
||||
__HANDLER, /* new on-draw-handler function*/\
|
||||
...) /* An optional target address */ \
|
||||
ARM_2D_HELPER_PFB_UPDATE_ON_DRAW_HANDLER( \
|
||||
(__CB_ADDR), \
|
||||
(__HANDLER),##__VA_ARGRS__)
|
||||
|
||||
#define impl_arm_2d_region_list(__NAME, ...) \
|
||||
IMPL_ARM_2D_REGION_LIST(__NAME,##__VA_ARGS__)
|
||||
#define add_region_to_list(__NAME, ...) \
|
||||
ADD_REGION_TO_LIST(__NAME, ##__VA_ARGS__)
|
||||
#define add_last_region_to_list(__NAME, ...) \
|
||||
ADD_LAST_REGION_TO_LIST(__NAME, ##__VA_ARGS__)
|
||||
#define end_impl_arm_2d_region_list(...) \
|
||||
END_IMPL_ARM_2D_REGION_LIST(__VA_ARGS__)
|
||||
|
||||
#define impl_pfb_on_draw(__NAME) IMPL_PFB_ON_DRAW(__NAME)
|
||||
#define impl_pfb_on_low_lv_rendering(__NAME) \
|
||||
IMPL_PFB_ON_LOW_LV_RENDERING(__NAME)
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
typedef struct arm_2d_helper_pfb_t arm_2d_helper_pfb_t;
|
||||
/*!
|
||||
* \brief the header of a PFB block
|
||||
*/
|
||||
typedef struct arm_2d_pfb_t {
|
||||
struct arm_2d_pfb_t *ptNext; //!< next pfb block
|
||||
arm_2d_helper_pfb_t *ptPFBHelper; //!< the pfb helper service current PFB block comes from
|
||||
arm_2d_tile_t tTile; //!< descriptor
|
||||
uint32_t u24Size : 24;
|
||||
uint32_t : 7;
|
||||
uint32_t bIsNewFrame : 1; //!< a flag to indicate the starting of a frame
|
||||
}arm_2d_pfb_t;
|
||||
|
||||
/*!
|
||||
* \brief the node of a region list
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_region_list_item_t {
|
||||
struct arm_2d_region_list_item_t *ptNext; //!< the next node
|
||||
arm_2d_region_t tRegion; //!< the region
|
||||
}arm_2d_region_list_item_t;
|
||||
|
||||
/*!
|
||||
* \brief the On-Drawing event handler for application layer
|
||||
*
|
||||
* \param[in] pTarget a user attached target address
|
||||
* \param[in] ptTile a tile for the virtual screen
|
||||
* \param[in] bIsNewFrame a flag indicate the starting of a new frame
|
||||
* \return arm_fsm_rt_t the status of the FSM.
|
||||
*/
|
||||
typedef arm_fsm_rt_t arm_2d_helper_draw_handler_t(
|
||||
void *pTarget,
|
||||
const arm_2d_tile_t *ptTile,
|
||||
bool bIsNewFrame);
|
||||
|
||||
/*!
|
||||
* \brief the On Low Level Rendering event handler for the low level (LCD Driver)
|
||||
*
|
||||
* \param[in] pTarget a user attached target address
|
||||
* \param[in] ptPFB the PFB block
|
||||
* \param[in] bIsNewFrame a flag indicate the starting of a new frame
|
||||
*/
|
||||
typedef void arm_2d_helper_render_handler_t(
|
||||
void *pTarget,
|
||||
const arm_2d_pfb_t *ptPFB,
|
||||
bool bIsNewFrame);
|
||||
|
||||
/*!
|
||||
* \brief on low level render event
|
||||
*/
|
||||
typedef struct arm_2d_helper_render_evt_t {
|
||||
arm_2d_helper_render_handler_t *fnHandler; //!< event handler function
|
||||
void *pTarget; //!< user attached target
|
||||
} arm_2d_helper_render_evt_t;
|
||||
|
||||
/*!
|
||||
* \brief on drawing event
|
||||
*/
|
||||
typedef struct arm_2d_helper_draw_evt_t {
|
||||
arm_2d_helper_draw_handler_t *fnHandler; //!< event handler function
|
||||
void *pTarget; //!< user attached target
|
||||
} arm_2d_helper_draw_evt_t;
|
||||
|
||||
/*!
|
||||
* \brief the enumeration for events
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
ARM_2D_PFB_DEPEND_ON_LOW_LEVEL_RENDERING = _BV(0), //!< On Low Level Rendering Event
|
||||
ARM_2D_PFB_DEPEND_ON_DRAWING = _BV(1), //!< On Drawing Event
|
||||
ARM_2D_PFB_DEPEND_ON_LOW_LEVEL_SYNC_UP = _BV(2), //!< On Low Level Sync-up Event
|
||||
ARM_2D_PFB_DEPEND_ON_FRAME_SYNC_UP = _BV(3), //!< On Frame Sync-up Event
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief The PFB Helper Service Dependency
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_helper_pfb_dependency_t {
|
||||
//! event handler for low level rendering
|
||||
arm_2d_helper_render_evt_t evtOnLowLevelRendering;
|
||||
|
||||
//! event handler for drawing GUI
|
||||
arm_2d_helper_draw_evt_t evtOnDrawing;
|
||||
|
||||
//! low level rendering handler wants to sync-up (return arm_fsm_rt_wait_for_obj)
|
||||
arm_2d_evt_t evtOnLowLevelSyncUp;
|
||||
|
||||
} arm_2d_helper_pfb_dependency_t;
|
||||
|
||||
/*!
|
||||
* \brief PFB Helper configuration
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_helper_pfb_cfg_t {
|
||||
|
||||
arm_2d_region_t tDisplayArea; //!< screen description
|
||||
|
||||
struct {
|
||||
arm_2d_pfb_t *ptPFBs; //!< current PFB block
|
||||
arm_2d_size_t tFrameSize; //!< the size of the frame
|
||||
uint32_t wBufferSize; //!< the buffer size
|
||||
uint16_t hwPFBNum; //!< the number of PFB
|
||||
uint16_t bDoNOTUpdateDefaultFrameBuffer : 1; //!< A flag to disable automatically default-framebuffer-registration
|
||||
uint16_t bDisableDynamicFPBSize : 1; //!< A flag to disable resize of the PFB block
|
||||
uint16_t bSwapRGB16 : 1; //!< A flag to enable swapping high and low bytes of an RGB16 pixel
|
||||
uint16_t : 9;
|
||||
uint16_t u4PoolReserve : 4; //!< reserve specific number of PFB for other helper services
|
||||
|
||||
} FrameBuffer; //!< frame buffer context
|
||||
|
||||
arm_2d_helper_pfb_dependency_t Dependency; //!< user registered dependency
|
||||
|
||||
} arm_2d_helper_pfb_cfg_t;
|
||||
|
||||
/*!
|
||||
* \brief the PFB helper control block
|
||||
*
|
||||
*/
|
||||
struct arm_2d_helper_pfb_t{
|
||||
|
||||
ARM_PRIVATE(
|
||||
arm_2d_helper_pfb_cfg_t tCFG; //!< user configuration
|
||||
|
||||
struct {
|
||||
arm_2d_region_t tDrawRegion;
|
||||
arm_2d_region_t tTargetRegion;
|
||||
arm_2d_region_list_item_t *ptDirtyRegion;
|
||||
arm_2d_tile_t tPFBTile;
|
||||
arm_2d_size_t tFrameSize;
|
||||
bool bFirstIteration;
|
||||
bool bIsRegionChanged;
|
||||
uint8_t chPT;
|
||||
struct {
|
||||
uint8_t bIsNewFrame : 1;
|
||||
uint8_t bIsFlushRequested :1;
|
||||
};
|
||||
uint16_t hwFreePFBCount;
|
||||
arm_2d_pfb_t *ptCurrent;
|
||||
arm_2d_pfb_t *ptFreeList;
|
||||
|
||||
struct {
|
||||
arm_2d_pfb_t *ptHead;
|
||||
arm_2d_pfb_t *ptTail;
|
||||
}FlushFIFO;
|
||||
arm_2d_tile_t *ptFrameBuffer;
|
||||
} Adapter;
|
||||
)
|
||||
|
||||
struct {
|
||||
int64_t lTimestamp; //!< PLEASE DO NOT USE
|
||||
int32_t nTotalCycle; //!< cycles used by drawing
|
||||
int32_t nRenderingCycle; //!< cycles used in LCD flushing
|
||||
} Statistics; //!< performance statistics
|
||||
|
||||
};
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*!
|
||||
* \brief initialize pfb helper service
|
||||
* \param[in] ptThis the pfb helper control block
|
||||
* \param[in] ptCFG the configuration
|
||||
* \return arm_2d_err_t the process result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1,2)
|
||||
arm_2d_err_t arm_2d_helper_pfb_init(arm_2d_helper_pfb_t *ptThis,
|
||||
arm_2d_helper_pfb_cfg_t *ptCFG);
|
||||
|
||||
/*!
|
||||
* \brief get the display (screen) region
|
||||
* \param[in] ptThis the pfb helper control block
|
||||
* \return arm_2d_region_t the screen region
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
arm_2d_region_t arm_2d_helper_pfb_get_display_area(arm_2d_helper_pfb_t *ptThis);
|
||||
|
||||
/*!
|
||||
* \brief the task function for pfb helper
|
||||
* \param[in] ptThis an initialised PFB control block
|
||||
* \param[in] ptDirtyRegions a region list pending for refresh, NULL means
|
||||
* refreshing the whole screen
|
||||
* \retval arm_fsm_rt_cpl complete refreshing one frame
|
||||
* \retval arm_fsm_rt_on_going the refreshing work is on-going
|
||||
* \retval arm_fsm_rt_wait_for_obj user's OnDrawing event handler wants to wait
|
||||
* for some objects, e.g. semaphore etc.
|
||||
* \retval <0 An error is detected
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
arm_fsm_rt_t arm_2d_helper_pfb_task(arm_2d_helper_pfb_t *ptThis,
|
||||
arm_2d_region_list_item_t *ptDirtyRegions);
|
||||
|
||||
/*!
|
||||
* \brief flush the FPB FIFO
|
||||
* \note This function is THREAD-SAFE
|
||||
* \note For normal usage, please DO NOT use this function unless you know what
|
||||
* you are doing.
|
||||
* \param[in] ptThis an initialised PFB control block
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
void arm_2d_helper_pfb_flush(arm_2d_helper_pfb_t *ptThis);
|
||||
|
||||
/*!
|
||||
* \brief update PFB dependency (event handlers)
|
||||
* \param[in] ptThis the PFB control block
|
||||
* \param[in] chMask the bit mask for event handlers
|
||||
* \param[in] ptDependency the new dependency description
|
||||
* \return arm_2d_err_t the process result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1,3)
|
||||
arm_2d_err_t arm_2d_helper_pfb_update_dependency(
|
||||
arm_2d_helper_pfb_t *ptThis,
|
||||
uint_fast8_t chMask,
|
||||
const arm_2d_helper_pfb_dependency_t *ptDependency);
|
||||
|
||||
/*!
|
||||
* \brief tell PFB helper that a low level LCD flushing work is complete
|
||||
* \note This function is THREAD-SAFE, You can call this function asynchronously,
|
||||
* e.g.
|
||||
* - A ISR to indicate DMA-transfer complete event or
|
||||
* - A different Thread
|
||||
* \param[in] ptThis the PFB control block
|
||||
* \param[in] ptPFB the used PFB block
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1,2)
|
||||
void arm_2d_helper_pfb_report_rendering_complete( arm_2d_helper_pfb_t *ptThis,
|
||||
arm_2d_pfb_t *ptPFB);
|
||||
|
||||
/*!
|
||||
* \brief swap the high and low bytes for each rgb16 pixel
|
||||
*
|
||||
* \params[in] phwBuffer the pixel buffer
|
||||
* \note the phwBuffer MUST aligned to half-word addresses
|
||||
*
|
||||
* \params[in] wSize the number of pixels
|
||||
*/
|
||||
extern
|
||||
void arm_2d_helper_swap_rgb16(uint16_t *phwBuffer, uint32_t wCount);
|
||||
|
||||
/*!
|
||||
* \brief convert ticks of a reference timer to millisecond
|
||||
*
|
||||
* \param[in] lTick the tick count
|
||||
* \return int64_t the millisecond
|
||||
*/
|
||||
extern
|
||||
int64_t arm_2d_helper_convert_ticks_to_ms(int64_t lTick);
|
||||
|
||||
/*!
|
||||
* \brief convert millisecond into ticks of the reference timer
|
||||
*
|
||||
* \param[in] wMS the target time in millisecond
|
||||
* \return int64_t the ticks
|
||||
*/
|
||||
extern
|
||||
int64_t arm_2d_helper_convert_ms_to_ticks(uint32_t wMS);
|
||||
|
||||
/*!
|
||||
* \brief get the reference clock frequency
|
||||
* \return uint32_t the frequency
|
||||
*/
|
||||
extern
|
||||
uint32_t arm_2d_helper_get_reference_clock_frequency(void);
|
||||
|
||||
/*!
|
||||
* \brief get the current system stamp from the reference clock
|
||||
*
|
||||
* \return int64_t the timestamp in ticks (no overflow issue)
|
||||
* \note you have to call arm_2d_helper_convert_ticks_to_ms() to convert the
|
||||
* the timestamp into milliseconds when required.
|
||||
*/
|
||||
extern
|
||||
int64_t arm_2d_helper_get_system_timestamp(void);
|
||||
|
||||
/*!
|
||||
* \brief try to get a PFB block from the pool
|
||||
* \param[in] ptThis the PFB control block
|
||||
* \retval NULL the pool is empty
|
||||
* \retval !NULL a valid pfb block
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
arm_2d_pfb_t *__arm_2d_helper_pfb_new(arm_2d_helper_pfb_t *ptThis);
|
||||
|
||||
/*!
|
||||
* \brief free a PFB block to the pool
|
||||
* \param[in] ptThis the PFB control block
|
||||
* \param[in] ptPFB the target PFB block
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
void __arm_2d_helper_pfb_free(arm_2d_helper_pfb_t *ptThis, arm_2d_pfb_t *ptPFB);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,292 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d_helper_scene.h"
|
||||
* Description: Public header file for the scene service
|
||||
*
|
||||
* $Date: 29. Aug 2022
|
||||
* $Revision: V.1.3.4
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_HELPER_SCENE_H__
|
||||
#define __ARM_2D_HELPER_SCENE_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d_helper_pfb.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \addtogroup gHelper 7 Helper Services
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
/*!
|
||||
* \brief scene switching mode
|
||||
*/
|
||||
typedef enum {
|
||||
|
||||
/* valid switching visual effects begin */
|
||||
ARM_2D_SCENE_SWITCH_MODE_NONE = 0, //!< no switching visual effect
|
||||
ARM_2D_SCENE_SWITCH_MODE_USER = 1, //!< user defined switching visual effect
|
||||
ARM_2D_SCENE_SWITCH_MODE_FADE_WHITE = 2, //!< fade in fade out (white)
|
||||
ARM_2D_SCENE_SWITCH_MODE_FADE_BLACK = 3, //!< fade in fade out (black)
|
||||
ARM_2D_SCENE_SWITCH_MODE_SLIDE_LEFT = 4, //!< slide left
|
||||
ARM_2D_SCENE_SWITCH_MODE_SLIDE_RIGHT, //!< slide right
|
||||
ARM_2D_SCENE_SWITCH_MODE_SLIDE_UP, //!< slide up
|
||||
ARM_2D_SCENE_SWITCH_MODE_SLIDE_DOWN, //!< slide down
|
||||
ARM_2D_SCENE_SWITCH_MODE_ERASE_LEFT = 8, //!< erase to the right
|
||||
ARM_2D_SCENE_SWITCH_MODE_ERASE_RIGHT, //!< erase to the left
|
||||
ARM_2D_SCENE_SWITCH_MODE_ERASE_UP, //!< erase to the top
|
||||
ARM_2D_SCENE_SWITCH_MODE_ERASE_DOWN, //!< erase to the bottom
|
||||
|
||||
/* valid switching visual effects end */
|
||||
__ARM_2D_SCENE_SWITCH_MODE_VALID, //!< For internal user only
|
||||
|
||||
|
||||
|
||||
ARM_2D_SCENE_SWITCH_MODE_IGNORE_OLD_BG = _BV(8), //!< ignore the background of the old scene
|
||||
ARM_2D_SCENE_SWITCH_MODE_IGNORE_OLD_SCEBE = _BV(9), //!< ignore the old scene
|
||||
ARM_2D_SCENE_SWITCH_MODE_IGNORE_NEW_BG = _BV(10), //!< ignore the background of the new scene
|
||||
ARM_2D_SCENE_SWITCH_MODE_IGNORE_NEW_SCEBE = _BV(11), //!< ignore the new scene
|
||||
|
||||
ARM_2D_SCENE_SWITCH_MODE_DEFAULT_BG_WHITE = 0 << 12, //!< use white as default background
|
||||
ARM_2D_SCENE_SWITCH_MODE_DEFAULT_BG_BLACK = 1 << 12, //!< use black as default background
|
||||
ARM_2D_SCENE_SWITCH_MODE_DEFAULT_BG_USER = 2 << 12, //!< use user defined default background
|
||||
|
||||
__ARM_2D_SCENE_SWTICH_MODE_IGNORE_msk = 0x0F << 8, //!< For internal user only
|
||||
__ARM_2D_SCENE_SWTICH_MODE_IGNORE_pos = 8, //!< For internal user only
|
||||
__ARM_2D_SCENE_SWTICH_MODE_DEFAULT_BG_msk = 3 << 12, //!< For internal user only
|
||||
__ARM_2D_SCENE_SWTICH_MODE_DEFAULT_BG_pos = 12, //!< For internal user only
|
||||
|
||||
} arm_2d_scene_player_switch_mode_t;
|
||||
|
||||
typedef union __arm_2d_helper_scene_switch_t {
|
||||
struct {
|
||||
uint8_t chMode; //!< the switch visual effect
|
||||
uint8_t bIgnoreOldSceneBG : 1; //!< when set, ignore the background of the old scene
|
||||
uint8_t bIgnoreOldScene : 1; //!< when set, ignore the old scene
|
||||
uint8_t bIgnoreNewSceneBG : 1; //!< when set, ignore the background of the new scene
|
||||
uint8_t bIgnoreNewScene : 1; //!< when set, ignore the new scene
|
||||
uint8_t u2DefaultBG : 2; //!< the default background
|
||||
uint8_t : 2;
|
||||
} Feature;
|
||||
uint16_t hwSetting; //!< the setting value
|
||||
}__arm_2d_helper_scene_switch_t;
|
||||
|
||||
|
||||
|
||||
typedef struct arm_2d_scene_player_t arm_2d_scene_player_t;
|
||||
|
||||
/*!
|
||||
* \brief a class for describing scenes which are the combination of a
|
||||
* background and a foreground with a dirty-region-list support
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_scene_t arm_2d_scene_t;
|
||||
struct arm_2d_scene_t {
|
||||
arm_2d_scene_t *ptNext; //!< next scene
|
||||
arm_2d_scene_player_t *ptPlayer; //!< points to the host scene player
|
||||
arm_2d_region_list_item_t *ptDirtyRegion; //!< dirty region list for the foreground
|
||||
arm_2d_helper_draw_handler_t *fnBackground; //!< the function pointer for the background
|
||||
arm_2d_helper_draw_handler_t *fnScene; //!< the function pointer for the foreground
|
||||
void (*fnOnBGStart)(arm_2d_scene_t *ptThis); //!< on-start-drawing-background event handler
|
||||
void (*fnOnBGComplete)(arm_2d_scene_t *ptThis); //!< on-complete-drawing-background event handler
|
||||
void (*fnOnFrameStart)(arm_2d_scene_t *ptThis); //!< on-frame-start event handler
|
||||
void (*fnOnFrameCPL)(arm_2d_scene_t *ptThis); //!< on-frame-complete event handler
|
||||
|
||||
/*!
|
||||
* \note We use fnDepose to free the resources
|
||||
*/
|
||||
void (*fnDepose)(arm_2d_scene_t *ptThis); //!< on-scene-depose event handler
|
||||
struct {
|
||||
uint8_t bOnSwitchingIgnoreBG : 1; //!< ignore background during switching period
|
||||
uint8_t bOnSwitchingIgnoreScene : 1; //!< ignore forground during switching period
|
||||
};
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief a class to manage scenes
|
||||
*
|
||||
*/
|
||||
struct arm_2d_scene_player_t {
|
||||
inherit(arm_2d_helper_pfb_t); //!< inherit from arm_2d_helper_pfb_t
|
||||
|
||||
ARM_PRIVATE(
|
||||
struct {
|
||||
arm_2d_scene_t *ptHead; //!< points to the head of the FIFO
|
||||
arm_2d_scene_t *ptTail; //!< points to the tail of the FIFO
|
||||
} SceneFIFO; //!< Scene FIFO
|
||||
|
||||
struct {
|
||||
uint8_t bNextSceneReq : 1; //!< a flag to request switching-to-the next-scene
|
||||
uint8_t bSwitchCPL : 1; //!< indication of scene switching completion
|
||||
uint8_t : 6;
|
||||
uint8_t chState; //!< the state of the FSM used by runtime.
|
||||
} Runtime; //!< scene player runtime
|
||||
|
||||
struct {
|
||||
union {
|
||||
uint8_t chState;
|
||||
struct {
|
||||
uint8_t chState;
|
||||
uint8_t chOpacity;
|
||||
bool bIsFadeBlack;
|
||||
}Fade;
|
||||
struct {
|
||||
uint8_t chState;
|
||||
arm_2d_tile_t tSceneWindow;
|
||||
arm_2d_tile_t tTemp;
|
||||
int16_t iOffset;
|
||||
}Erase;
|
||||
struct {
|
||||
uint8_t chState;
|
||||
arm_2d_tile_t tSceneWindow;
|
||||
int16_t iOffset;
|
||||
}Slide;
|
||||
};
|
||||
__arm_2d_helper_scene_switch_t tConfig; //!< the switching configuration
|
||||
uint16_t hwPeriod; //!< the switching should finish in specified millisecond
|
||||
int64_t lTimeStamp;
|
||||
}Switch;
|
||||
)
|
||||
};
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*!
|
||||
* \brief flush the scene FIFO
|
||||
*
|
||||
* \param[in] ptThis the target scene player
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
void arm_2d_scene_player_flush_fifo(arm_2d_scene_player_t *ptThis);
|
||||
|
||||
/*!
|
||||
* \brief append a set of scenes to a scene player
|
||||
*
|
||||
* \param[in] ptThis the target scene player
|
||||
* \param[in] ptScenes a scene array
|
||||
* \param[in] hwCount the number of scenes in the array
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
void arm_2d_scene_player_append_scenes(arm_2d_scene_player_t *ptThis,
|
||||
arm_2d_scene_t *ptScenes,
|
||||
int_fast16_t hwCount);
|
||||
|
||||
/*!
|
||||
* \brief request switching to the next scene safely
|
||||
*
|
||||
* \param[in] ptThis the target scene player
|
||||
*
|
||||
* \note Once received a request, the scene player will only switch to the
|
||||
* next scene at the end of a frame.
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
void arm_2d_scene_player_switch_to_next_scene(arm_2d_scene_player_t *ptThis);
|
||||
|
||||
/*!
|
||||
* \brief configure the scene switching mode
|
||||
*
|
||||
* \param[in] ptThis the target scene player
|
||||
* \param[in] hwSettings a combination of valid settings defined in
|
||||
* arm_2d_scene_player_switch_mode_t
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
void arm_2d_scene_player_set_switching_mode(arm_2d_scene_player_t *ptThis,
|
||||
uint_fast16_t hwSettings);
|
||||
|
||||
/*!
|
||||
* \brief read the current scene switching mode
|
||||
*
|
||||
* \param[in] ptThis the target scene player
|
||||
* \return uint16_t the current setting value for the scene switching mode
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
uint16_t arm_2d_scene_player_get_switching_mode(arm_2d_scene_player_t *ptThis);
|
||||
|
||||
/*!
|
||||
* \brief configure the scene switching period
|
||||
*
|
||||
* \param[in] ptThis the target scene player
|
||||
* \param[in] hwMS period in millisecond
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
void arm_2d_scene_player_set_switching_period( arm_2d_scene_player_t *ptThis,
|
||||
uint_fast16_t hwMS);
|
||||
|
||||
/*!
|
||||
* \brief the scene player task function
|
||||
*
|
||||
* \param[in] ptThis the target scene player
|
||||
*
|
||||
* \note the event sequence of a scene:
|
||||
* 1. when fnBackground is valid
|
||||
* - invoke fnOnBGStart when it is valid
|
||||
* - invoke fnBackground
|
||||
* - invoke fnOnBGComplete when it is valid
|
||||
* 2. invoke fnOnFrameStart when it is valid
|
||||
* 3. invoke fnScene
|
||||
* 4. invoke fnOnFrameCPL when it is valid
|
||||
* 5. Check bNextSceneReq
|
||||
* - false (0), go back to step 2
|
||||
* - true, invoke fnDepose when it is valid and switch to the next scene
|
||||
*
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
arm_fsm_rt_t arm_2d_scene_player_task(arm_2d_scene_player_t *ptThis);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,757 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2020 Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d_helper_pfb.c"
|
||||
* Description: the pfb helper service source code
|
||||
*
|
||||
* $Date: 29. Aug 2022
|
||||
* $Revision: V.1.2.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#define __ARM_2D_IMPL__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include "arm_2d_helper.h"
|
||||
|
||||
#if defined(__PERF_COUNTER__)
|
||||
# include "perf_counter.h"
|
||||
#else
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
|
||||
# pragma clang diagnostic ignored "-Wcast-qual"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
||||
# pragma clang diagnostic ignored "-Wundef"
|
||||
# pragma clang diagnostic ignored "-Wgnu-statement-expression"
|
||||
# pragma clang diagnostic ignored "-Wcast-align"
|
||||
# pragma clang diagnostic ignored "-Wconditional-uninitialized"
|
||||
#elif defined(__IS_COMPILER_GCC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
#undef this
|
||||
#define this (*ptThis)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* PT Operations *
|
||||
*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
Protothreads open source BSD-style license
|
||||
The protothreads library is released under an open source license that allows
|
||||
both commercial and non-commercial use without restrictions. The only
|
||||
requirement is that credits is given in the source code and in the documentation
|
||||
for your product.
|
||||
|
||||
The full license text follows.
|
||||
|
||||
Copyright (c) 2004-2005, Swedish Institute of Computer Science.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the Institute nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS `AS IS' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Author: Adam Dunkels
|
||||
*/
|
||||
|
||||
#define ARM_PT_BEGIN(__STATE) \
|
||||
enum { \
|
||||
count_offset = __COUNTER__ + 1, \
|
||||
}; \
|
||||
switch (__STATE) { \
|
||||
case __COUNTER__ - count_offset:
|
||||
|
||||
#define ARM_PT_ENTRY(__STATE, ...) \
|
||||
(__STATE) = (__COUNTER__ - count_offset + 1) >> 1; \
|
||||
__VA_ARGS__ \
|
||||
case (__COUNTER__ - count_offset) >> 1: (__STATE) = (__STATE);
|
||||
|
||||
#define ARM_PT_YIELD(__STATE) \
|
||||
ARM_PT_ENTRY(__STATE, return arm_fsm_rt_on_going;)
|
||||
|
||||
#define ARM_PT_END(__STATE) \
|
||||
__STATE = 0; \
|
||||
break;}
|
||||
|
||||
#define ARM_PT_GOTO_PREV_ENTRY() return arm_fsm_rt_on_going;
|
||||
|
||||
|
||||
#define ARM_PT_REPORT_STATUS(__STATE, __VAL) \
|
||||
ARM_PT_ENTRY(__STATE, \
|
||||
return (arm_fsm_rt_t)(__VAL); \
|
||||
)
|
||||
|
||||
#define ARM_PT_RETURN(__STATE, __VAL) \
|
||||
__STATE = 0; \
|
||||
return (arm_fsm_rt_t)(__VAL);
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
/*============================ IMPLEMENTATION ================================*/
|
||||
|
||||
ARM_NONNULL(1)
|
||||
arm_2d_pfb_t *__arm_2d_helper_pfb_new(arm_2d_helper_pfb_t *ptThis)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
|
||||
arm_2d_pfb_t *ptPFB = NULL;
|
||||
arm_irq_safe {
|
||||
this.Adapter.hwFreePFBCount--;
|
||||
ARM_LIST_STACK_POP(this.Adapter.ptFreeList, ptPFB);
|
||||
}
|
||||
|
||||
ptPFB->ptPFBHelper = ptThis;
|
||||
|
||||
return ptPFB;
|
||||
}
|
||||
|
||||
ARM_NONNULL(1)
|
||||
void __arm_2d_helper_pfb_free(arm_2d_helper_pfb_t *ptThis, arm_2d_pfb_t *ptPFB)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
|
||||
if (NULL == ptPFB) {
|
||||
return ;
|
||||
}
|
||||
|
||||
arm_irq_safe {
|
||||
ARM_LIST_STACK_PUSH(this.Adapter.ptFreeList, ptPFB);
|
||||
this.Adapter.hwFreePFBCount++;
|
||||
}
|
||||
}
|
||||
|
||||
ARM_NONNULL(1,2)
|
||||
arm_2d_err_t arm_2d_helper_pfb_init(arm_2d_helper_pfb_t *ptThis,
|
||||
arm_2d_helper_pfb_cfg_t *ptCFG)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
assert(NULL != ptCFG);
|
||||
|
||||
memset(ptThis, 0, sizeof(this));
|
||||
this.tCFG = *ptCFG;
|
||||
|
||||
if (NULL == this.tCFG.Dependency.evtOnLowLevelRendering.fnHandler) {
|
||||
return ARM_2D_ERR_MISSING_PARAM;
|
||||
}
|
||||
|
||||
// perform validation
|
||||
do {
|
||||
int_fast16_t n = this.tCFG.FrameBuffer.hwPFBNum;
|
||||
arm_2d_pfb_t *ptItem = this.tCFG.FrameBuffer.ptPFBs;
|
||||
uint32_t wBufferSize = this.tCFG.FrameBuffer.wBufferSize;
|
||||
|
||||
// handle alignments
|
||||
wBufferSize += __alignof__(arm_2d_pfb_t) - 1;
|
||||
wBufferSize &= ~(__alignof__(arm_2d_pfb_t) - 1);
|
||||
|
||||
if (0 == n || NULL == ptItem) {
|
||||
return ARM_2D_ERR_MISSING_PARAM;
|
||||
} else if ( (0 == this.tCFG.FrameBuffer.tFrameSize.iHeight)
|
||||
|| (0 == this.tCFG.FrameBuffer.tFrameSize.iWidth)
|
||||
|| (0 == this.tCFG.FrameBuffer.wBufferSize)) {
|
||||
return ARM_2D_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
this.Adapter.hwFreePFBCount = 0;
|
||||
// add PFBs to pool
|
||||
do {
|
||||
ptItem->tTile = (arm_2d_tile_t) {
|
||||
.tRegion = {
|
||||
.tSize = this.tCFG.FrameBuffer.tFrameSize,
|
||||
},
|
||||
.tInfo.bIsRoot = true,
|
||||
.pchBuffer = (uint8_t *)((uintptr_t)ptItem + sizeof(arm_2d_pfb_t)),
|
||||
};
|
||||
|
||||
// update buffer size
|
||||
ptItem->u24Size = wBufferSize;
|
||||
//ARM_LIST_STACK_PUSH(this.Adapter.ptFreeList, ptItem);
|
||||
__arm_2d_helper_pfb_free(ptThis, ptItem);
|
||||
|
||||
// update pointer
|
||||
ptItem = (arm_2d_pfb_t *)( (uintptr_t)ptItem
|
||||
+ wBufferSize
|
||||
+ sizeof(arm_2d_pfb_t));
|
||||
} while(--n);
|
||||
|
||||
} while(0);
|
||||
|
||||
this.Adapter.bFirstIteration = true;
|
||||
this.Adapter.bIsFlushRequested = true;
|
||||
|
||||
return ARM_2D_ERR_NONE;
|
||||
}
|
||||
|
||||
ARM_NONNULL(1)
|
||||
arm_2d_region_t arm_2d_helper_pfb_get_display_area(arm_2d_helper_pfb_t *ptThis)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
|
||||
return this.tCFG.tDisplayArea;
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void arm_2d_helper_swap_rgb16(uint16_t *phwBuffer, uint32_t wCount)
|
||||
{
|
||||
if (0 == wCount) {
|
||||
return ;
|
||||
}
|
||||
|
||||
// aligned (2)
|
||||
assert((((uintptr_t) phwBuffer) & 0x01) == 0);
|
||||
|
||||
// it is not aligned to 4
|
||||
if ((((uintptr_t) phwBuffer) & 0x03) == 0x02) {
|
||||
// handle the leading pixel
|
||||
uint32_t wTemp = *phwBuffer;
|
||||
*phwBuffer++ = (uint16_t)__REV16(wTemp);
|
||||
wCount--;
|
||||
}
|
||||
|
||||
|
||||
uint32_t wWords = wCount >> 1;
|
||||
uint32_t *pwBuffer = (uint32_t *)phwBuffer;
|
||||
wCount &= 0x01;
|
||||
|
||||
if (wWords > 0) {
|
||||
do {
|
||||
uint32_t wTemp = *pwBuffer;
|
||||
*pwBuffer++ = __REV16(wTemp);
|
||||
} while(--wWords);
|
||||
}
|
||||
|
||||
if (wCount) {
|
||||
uint32_t wTemp = *pwBuffer;
|
||||
(*(uint16_t *)pwBuffer) = (uint16_t)__REV16(wTemp);
|
||||
}
|
||||
}
|
||||
|
||||
ARM_NONNULL(1)
|
||||
void arm_2d_helper_pfb_flush(arm_2d_helper_pfb_t *ptThis)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
|
||||
arm_2d_pfb_t *ptPFB = NULL;
|
||||
|
||||
arm_irq_safe {
|
||||
ARM_LIST_QUEUE_DEQUEUE( this.Adapter.FlushFIFO.ptHead,
|
||||
this.Adapter.FlushFIFO.ptTail,
|
||||
ptPFB);
|
||||
this.Adapter.bIsFlushRequested = (NULL == ptPFB);
|
||||
}
|
||||
|
||||
if (NULL != ptPFB) {
|
||||
ptPFB->ptPFBHelper = ptThis;
|
||||
|
||||
// call handler
|
||||
(*this.tCFG.Dependency.evtOnLowLevelRendering.fnHandler)(
|
||||
this.tCFG.Dependency.evtOnLowLevelRendering.pTarget,
|
||||
ptPFB,
|
||||
ptPFB->bIsNewFrame);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void __arm_2d_helper_enqueue_pfb(arm_2d_helper_pfb_t *ptThis)
|
||||
{
|
||||
this.Adapter.ptCurrent->bIsNewFrame = this.Adapter.bFirstIteration;
|
||||
bool bIsFlushRequested;
|
||||
|
||||
arm_irq_safe {
|
||||
bIsFlushRequested = this.Adapter.bIsFlushRequested;
|
||||
ARM_LIST_QUEUE_ENQUEUE( this.Adapter.FlushFIFO.ptHead,
|
||||
this.Adapter.FlushFIFO.ptTail,
|
||||
this.Adapter.ptCurrent);
|
||||
}
|
||||
|
||||
if (bIsFlushRequested) {
|
||||
arm_2d_helper_pfb_flush(ptThis);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void __arm_2d_helper_low_level_rendering(arm_2d_helper_pfb_t *ptThis)
|
||||
{
|
||||
|
||||
assert(NULL != this.tCFG.Dependency.evtOnLowLevelRendering.fnHandler);
|
||||
assert(NULL != this.Adapter.ptCurrent);
|
||||
|
||||
// update location info
|
||||
this.Adapter.ptCurrent->tTile.tRegion.tLocation = (arm_2d_location_t) {
|
||||
.iX = this.Adapter.tDrawRegion.tLocation.iX
|
||||
+ this.Adapter.tTargetRegion.tLocation.iX,
|
||||
.iY = this.Adapter.tDrawRegion.tLocation.iY
|
||||
+ this.Adapter.tTargetRegion.tLocation.iY,
|
||||
};
|
||||
|
||||
if (this.tCFG.FrameBuffer.bSwapRGB16) {
|
||||
arm_2d_helper_swap_rgb16( this.Adapter.ptCurrent->tTile.phwBuffer,
|
||||
get_tile_buffer_pixel_count(
|
||||
this.Adapter.ptCurrent->tTile));
|
||||
}
|
||||
|
||||
__arm_2d_helper_enqueue_pfb(ptThis);
|
||||
|
||||
this.Adapter.bFirstIteration = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static bool __arm_2d_helper_pfb_get_next_dirty_region(arm_2d_helper_pfb_t *ptThis)
|
||||
{
|
||||
if (NULL == this.Adapter.ptDirtyRegion) {
|
||||
// no dirty region list
|
||||
this.Adapter.bFirstIteration = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
this.Adapter.ptDirtyRegion = this.Adapter.ptDirtyRegion->ptNext;
|
||||
|
||||
if (NULL == this.Adapter.ptDirtyRegion) {
|
||||
// reach last item in a chain
|
||||
this.Adapter.bFirstIteration = true;
|
||||
|
||||
return false;
|
||||
} else {
|
||||
this.Adapter.bIsRegionChanged = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief begin a iteration of drawing and request a frame buffer from
|
||||
* low level display driver.
|
||||
* \param[in] ptThis the PFB helper control block
|
||||
* \param[in] ptTargetRegion the address of the target region in the LCD
|
||||
* passing NULL means we want to draw the whole LCD.
|
||||
* \retval NULL the display driver is not ready
|
||||
* \retval (intptr_t)-1 the display driver want to ignore this drawing
|
||||
* (maybe because the target area is out of the LCD)
|
||||
* \retval non-null a tile which contains the (partial) frame buffer
|
||||
*/
|
||||
static
|
||||
arm_2d_tile_t * __arm_2d_helper_pfb_drawing_iteration_begin(
|
||||
arm_2d_helper_pfb_t *ptThis,
|
||||
arm_2d_region_list_item_t *ptDirtyRegions)
|
||||
{
|
||||
// arm_irq_safe {
|
||||
// ARM_LIST_STACK_POP(this.Adapter.ptFreeList, this.Adapter.ptCurrent);
|
||||
// }
|
||||
this.Adapter.ptCurrent = NULL;
|
||||
arm_irq_safe {
|
||||
/* allocating pfb only when the number of free PFB blocks is larger than
|
||||
* the reserved threashold
|
||||
*/
|
||||
if (this.Adapter.hwFreePFBCount > this.tCFG.FrameBuffer.u4PoolReserve) {
|
||||
this.Adapter.ptCurrent = __arm_2d_helper_pfb_new(ptThis);
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL == this.Adapter.ptCurrent) {
|
||||
// no resource left
|
||||
return NULL;
|
||||
}
|
||||
arm_2d_tile_t *ptPartialFrameBuffer = &(this.Adapter.ptCurrent->tTile);
|
||||
|
||||
if (this.Adapter.bFirstIteration) {
|
||||
this.Adapter.ptDirtyRegion = ptDirtyRegions;
|
||||
//this.Adapter.bFirstIteration = false;
|
||||
this.Adapter.bIsRegionChanged = true;
|
||||
}
|
||||
|
||||
do {
|
||||
if (this.Adapter.bIsRegionChanged) {
|
||||
|
||||
this.Adapter.bIsRegionChanged = false;
|
||||
|
||||
if (NULL != this.Adapter.ptDirtyRegion) {
|
||||
// calculate the valid region
|
||||
if (!arm_2d_region_intersect( &this.tCFG.tDisplayArea,
|
||||
&(this.Adapter.ptDirtyRegion->tRegion),
|
||||
&this.Adapter.tTargetRegion)) {
|
||||
|
||||
if (__arm_2d_helper_pfb_get_next_dirty_region(ptThis)) {
|
||||
// try next region
|
||||
continue;
|
||||
}
|
||||
// out of lcd
|
||||
return (arm_2d_tile_t *)-1;
|
||||
}
|
||||
} else {
|
||||
this.Adapter.tTargetRegion = this.tCFG.tDisplayArea;
|
||||
}
|
||||
|
||||
#if __ARM_ARCH == 6 || __TARGET_ARCH_THUMB == 3
|
||||
// reset adapter frame size
|
||||
this.Adapter.tFrameSize = this.tCFG.FrameBuffer.tFrameSize;
|
||||
#else
|
||||
if (this.tCFG.FrameBuffer.bDisableDynamicFPBSize) {
|
||||
// reset adapter frame size
|
||||
this.Adapter.tFrameSize = this.tCFG.FrameBuffer.tFrameSize;
|
||||
|
||||
} else { //!< update PFB size
|
||||
uint32_t wTargetPixelCount
|
||||
= this.Adapter.tTargetRegion.tSize.iWidth
|
||||
* this.Adapter.tTargetRegion.tSize.iHeight;
|
||||
|
||||
uint32_t wPFBPixelCount
|
||||
= this.tCFG.FrameBuffer.tFrameSize.iWidth
|
||||
* this.tCFG.FrameBuffer.tFrameSize.iHeight;
|
||||
|
||||
if ( (wTargetPixelCount <= wPFBPixelCount)
|
||||
|| ( this.Adapter.tTargetRegion.tSize.iWidth
|
||||
< this.tCFG.FrameBuffer.tFrameSize.iWidth)) {
|
||||
// redefine the shape of PFB
|
||||
|
||||
this.Adapter.tFrameSize.iWidth
|
||||
= this.Adapter.tTargetRegion.tSize.iWidth;
|
||||
|
||||
this.Adapter.tFrameSize.iHeight = (int16_t)(
|
||||
wPFBPixelCount
|
||||
/ (uint32_t)this.Adapter.tTargetRegion.tSize.iWidth);
|
||||
|
||||
} else {
|
||||
// reset adapter frame size
|
||||
this.Adapter.tFrameSize = this.tCFG.FrameBuffer.tFrameSize;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
} while(true);
|
||||
|
||||
|
||||
arm_2d_region_t tTempRegion = {
|
||||
.tSize = this.tCFG.tDisplayArea.tSize,
|
||||
.tLocation = {
|
||||
.iX = - ( this.Adapter.tTargetRegion.tLocation.iX
|
||||
+ this.Adapter.tDrawRegion.tLocation.iX),
|
||||
.iY = - ( this.Adapter.tTargetRegion.tLocation.iY
|
||||
+ this.Adapter.tDrawRegion.tLocation.iY),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
ptPartialFrameBuffer->tRegion.tSize.iWidth
|
||||
= MIN( this.Adapter.tFrameSize.iWidth,
|
||||
this.Adapter.tTargetRegion.tSize.iWidth
|
||||
- this.Adapter.tDrawRegion.tLocation.iX);
|
||||
ptPartialFrameBuffer->tRegion.tSize.iHeight
|
||||
= MIN( this.Adapter.tFrameSize.iHeight,
|
||||
this.Adapter.tTargetRegion.tSize.iHeight
|
||||
- this.Adapter.tDrawRegion.tLocation.iY);
|
||||
|
||||
arm_2d_tile_generate_child( ptPartialFrameBuffer,
|
||||
&tTempRegion,
|
||||
&this.Adapter.tPFBTile,
|
||||
false);
|
||||
|
||||
|
||||
if (!this.tCFG.FrameBuffer.bDoNOTUpdateDefaultFrameBuffer) {
|
||||
// update default frame buffer
|
||||
arm_2d_set_default_frame_buffer(&this.Adapter.tPFBTile);
|
||||
}
|
||||
|
||||
// uncomment this when necessary for debug purpose
|
||||
//arm_2d_rgb16_fill_colour(&this.Adapter.tPFBTile, NULL, 0);
|
||||
|
||||
return (arm_2d_tile_t *)&(this.Adapter.tPFBTile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*! \brief end a drawing iteration and decide wether a new iteration is required
|
||||
* or not based on the return value
|
||||
* \param[in] ptThis the PFB control block
|
||||
* \retval true a new iteration is required
|
||||
* \retval false no more iteration is required
|
||||
*/
|
||||
static
|
||||
bool __arm_2d_helper_pfb_drawing_iteration_end(arm_2d_helper_pfb_t *ptThis)
|
||||
{
|
||||
__arm_2d_helper_low_level_rendering(ptThis);
|
||||
|
||||
arm_2d_tile_t *ptPartialFrameBuffer = &(this.Adapter.ptCurrent->tTile);
|
||||
|
||||
if (!this.tCFG.FrameBuffer.bDoNOTUpdateDefaultFrameBuffer) {
|
||||
// update default frame buffer
|
||||
arm_2d_set_default_frame_buffer(NULL);
|
||||
}
|
||||
|
||||
this.Adapter.tDrawRegion.tLocation.iX
|
||||
+= ptPartialFrameBuffer->tRegion.tSize.iWidth;
|
||||
if ( this.Adapter.tDrawRegion.tLocation.iX
|
||||
>= this.Adapter.tTargetRegion.tSize.iWidth) {
|
||||
this.Adapter.tDrawRegion.tLocation.iY
|
||||
+= ptPartialFrameBuffer->tRegion.tSize.iHeight;
|
||||
this.Adapter.tDrawRegion.tLocation.iX = 0;
|
||||
|
||||
if ( this.Adapter.tDrawRegion.tLocation.iY
|
||||
>= this.Adapter.tTargetRegion.tSize.iHeight) {
|
||||
// finished
|
||||
this.Adapter.tDrawRegion.tLocation.iY = 0;
|
||||
|
||||
return __arm_2d_helper_pfb_get_next_dirty_region(ptThis);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
__WEAK int64_t arm_2d_helper_get_system_timestamp(void)
|
||||
{
|
||||
#if defined(__PERF_COUNTER__)
|
||||
return get_system_ticks();
|
||||
#else
|
||||
return (int64_t)clock();
|
||||
#endif
|
||||
}
|
||||
|
||||
__WEAK
|
||||
uint32_t arm_2d_helper_get_reference_clock_frequency(void)
|
||||
{
|
||||
extern uint32_t SystemCoreClock;
|
||||
return SystemCoreClock;
|
||||
}
|
||||
|
||||
|
||||
int64_t arm_2d_helper_convert_ticks_to_ms(int64_t lTick)
|
||||
{
|
||||
return (lTick * 1000) / (int64_t)arm_2d_helper_get_reference_clock_frequency();
|
||||
}
|
||||
|
||||
int64_t arm_2d_helper_convert_ms_to_ticks(uint32_t wMS)
|
||||
{
|
||||
int64_t lResult = arm_2d_helper_get_reference_clock_frequency()
|
||||
* (int64_t)wMS / 1000ul;
|
||||
return lResult ? lResult : 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
__WEAK void __arm_2d_helper_perf_counter_start(int64_t *plTimestamp)
|
||||
{
|
||||
assert(NULL != plTimestamp);
|
||||
*plTimestamp = arm_2d_helper_get_system_timestamp();
|
||||
}
|
||||
|
||||
__WEAK int32_t __arm_2d_helper_perf_counter_stop(int64_t *plTimestamp)
|
||||
{
|
||||
assert(NULL != plTimestamp);
|
||||
return (int32_t)( (int64_t)arm_2d_helper_get_system_timestamp()
|
||||
- (int64_t)*plTimestamp);
|
||||
}
|
||||
|
||||
|
||||
ARM_NONNULL(1,2)
|
||||
void arm_2d_helper_pfb_report_rendering_complete(arm_2d_helper_pfb_t *ptThis,
|
||||
arm_2d_pfb_t *ptPFB)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
assert(NULL != ptPFB);
|
||||
|
||||
ptPFB->tTile.tRegion.tLocation = (arm_2d_location_t) {0,0};
|
||||
|
||||
// arm_irq_safe {
|
||||
// ARM_LIST_STACK_PUSH(this.Adapter.ptFreeList, ptPFB);
|
||||
// }
|
||||
__arm_2d_helper_pfb_free(ptThis, ptPFB);
|
||||
|
||||
arm_2d_helper_pfb_flush(ptThis);
|
||||
}
|
||||
|
||||
|
||||
ARM_NONNULL(1,3)
|
||||
arm_2d_err_t arm_2d_helper_pfb_update_dependency(
|
||||
arm_2d_helper_pfb_t *ptThis,
|
||||
uint_fast8_t chMask,
|
||||
const arm_2d_helper_pfb_dependency_t *ptDependency)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
assert(NULL != ptDependency);
|
||||
|
||||
arm_irq_safe {
|
||||
if (chMask & ARM_2D_PFB_DEPEND_ON_LOW_LEVEL_RENDERING) {
|
||||
this.tCFG.Dependency.evtOnLowLevelRendering
|
||||
= ptDependency->evtOnLowLevelRendering;
|
||||
}
|
||||
|
||||
if (chMask & ARM_2D_PFB_DEPEND_ON_DRAWING) {
|
||||
this.tCFG.Dependency.evtOnDrawing
|
||||
= ptDependency->evtOnDrawing;
|
||||
}
|
||||
|
||||
if (chMask & ARM_2D_PFB_DEPEND_ON_LOW_LEVEL_SYNC_UP) {
|
||||
this.tCFG.Dependency.evtOnLowLevelSyncUp
|
||||
= ptDependency->evtOnLowLevelSyncUp;
|
||||
}
|
||||
}
|
||||
|
||||
return ARM_2D_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
arm_fsm_rt_t arm_2d_helper_pfb_task(arm_2d_helper_pfb_t *ptThis,
|
||||
arm_2d_region_list_item_t *ptDirtyRegions)
|
||||
{
|
||||
assert(NULL != ptThis);
|
||||
assert(NULL != this.tCFG.Dependency.evtOnDrawing.fnHandler);
|
||||
arm_fsm_rt_t tResult;
|
||||
|
||||
ARM_PT_BEGIN(this.Adapter.chPT)
|
||||
|
||||
this.Statistics.nTotalCycle = 0;
|
||||
this.Statistics.nRenderingCycle = 0;
|
||||
this.Adapter.bIsNewFrame = true;
|
||||
__arm_2d_helper_perf_counter_start(&this.Statistics.lTimestamp);
|
||||
do {
|
||||
this.Statistics.nRenderingCycle += __arm_2d_helper_perf_counter_stop(&this.Statistics.lTimestamp);
|
||||
|
||||
/* begin of the drawing iteration,
|
||||
* try to request the tile of frame buffer
|
||||
*/
|
||||
|
||||
do {
|
||||
|
||||
/*! \note In deep embedded applications, a LCD usually is connected
|
||||
* via a serial interface to save pins, hence the bandwidth
|
||||
* is limited and the FPS is low due to the bandwidth.
|
||||
* To overcome this issue, some partial-flushing schemes are
|
||||
* used, such as:
|
||||
* - Dirty Region based partial-flushing
|
||||
* - Flush the known and fixed small area that is updated
|
||||
* frequently based on the application scenarios.
|
||||
*
|
||||
* It is worth emphasizing that as we are using partial
|
||||
* flushing scheme, which means for a given frame, we only
|
||||
* update those changed area(s) but not the complete frame,
|
||||
* using the term frame per sec (FPS) might confuse people,
|
||||
* hence, we decide to introduce a NEW term called update per
|
||||
* sec (UPS) to avoid this confusion. It reflects what people
|
||||
* feel when looking at the LCD but not necessarily means
|
||||
* the rate that a complete frame is flushed into LCD.
|
||||
*
|
||||
* In Arm-2D:
|
||||
* - FPS is a sub-set of UPS.
|
||||
* - UPS forcus on how people feel and FPS is sticks to the
|
||||
* concept of (full) frame per sec.
|
||||
*/
|
||||
|
||||
// request to draw the whole LCD
|
||||
this.Adapter.ptFrameBuffer =
|
||||
__arm_2d_helper_pfb_drawing_iteration_begin(
|
||||
ptThis,
|
||||
ptDirtyRegions);
|
||||
if (NULL == this.Adapter.ptFrameBuffer) {
|
||||
if (NULL != this.tCFG.Dependency.evtOnLowLevelSyncUp.fnHandler){
|
||||
// wait until lcd is ready
|
||||
(*this.tCFG.Dependency.evtOnLowLevelSyncUp.fnHandler)(
|
||||
this.tCFG.Dependency.evtOnLowLevelSyncUp.pTarget
|
||||
);
|
||||
}
|
||||
continue;
|
||||
} else if (-1 == (intptr_t)this.Adapter.ptFrameBuffer) {
|
||||
/* display driver wants to end the drawing */
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
} while(NULL == this.Adapter.ptFrameBuffer);
|
||||
|
||||
ARM_PT_ENTRY(this.Adapter.chPT)
|
||||
|
||||
__arm_2d_helper_perf_counter_start(&this.Statistics.lTimestamp);
|
||||
// draw all the gui elements on target frame buffer
|
||||
tResult = this.tCFG.Dependency.evtOnDrawing.fnHandler(
|
||||
this.tCFG.Dependency.evtOnDrawing.pTarget,
|
||||
this.Adapter.ptFrameBuffer,
|
||||
this.Adapter.bIsNewFrame);
|
||||
// just in case some one forgot to do this...
|
||||
arm_2d_op_wait_async(NULL);
|
||||
|
||||
this.Adapter.bIsNewFrame = false;
|
||||
this.Statistics.nTotalCycle += __arm_2d_helper_perf_counter_stop(&this.Statistics.lTimestamp);
|
||||
|
||||
if (arm_fsm_rt_on_going == tResult) {
|
||||
ARM_PT_GOTO_PREV_ENTRY()
|
||||
} else if (tResult < 0) {
|
||||
// error was reported
|
||||
ARM_PT_RETURN(this.Adapter.chPT, tResult)
|
||||
} else if (arm_fsm_rt_wait_for_obj == tResult) {
|
||||
ARM_PT_REPORT_STATUS(this.Adapter.chPT, tResult)
|
||||
} else {
|
||||
ARM_PT_YIELD(this.Adapter.chPT)
|
||||
}
|
||||
|
||||
__arm_2d_helper_perf_counter_start(&this.Statistics.lTimestamp);
|
||||
} while(__arm_2d_helper_pfb_drawing_iteration_end(ptThis));
|
||||
|
||||
this.Statistics.nRenderingCycle += __arm_2d_helper_perf_counter_stop(&this.Statistics.lTimestamp);
|
||||
ARM_PT_END(this.Adapter.chPT)
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
|
@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2020 signalProcessing
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -1,64 +0,0 @@
|
||||
# Header Files Summary {#headers}
|
||||
|
||||
## 1 Overview
|
||||
|
||||
As an open-source project, arm-2d serves users with different purposes and background. In general, arm-2d is designed with two groups of users in mind:
|
||||
|
||||
- **Library Users** - who use arm-2d public APIs in their applications
|
||||
- **Professional Users** - all other users who are
|
||||
- Integrating arm-2d with GUI stacks
|
||||
- Accelerating arm-2d with some 2D HW accelerators
|
||||
- Hobbyists writing new GUIs and/or 2D game engines based on arm-2d.
|
||||
|
||||
For the Library Users, **Public Header Files** provide all the information required to use arm-2d services. For the Professional Users, additional information are provided in **Private Header Files** to help their design.
|
||||
|
||||
|
||||
|
||||
## 2 Public Header Files
|
||||
|
||||
In the `Library/Include` folder, all header files (*.h) **without** double-underscore-prefix, i.e. "__", are considered as **PUBLIC HEADER FILES**. They are listed in the **Table 2-1**.
|
||||
|
||||
**Table 2-1 Summary of Public Header Files**
|
||||
|
||||
| File Name | Description | Note |
|
||||
| ----------------------------- | ------------------------------------------------------------ | ---------------------------------------------------- |
|
||||
| ***arm_2d.h*** | **The main entry for all users.** To use any arm-2d services, you **must** include this header file first. It includes all other public header files list below. | |
|
||||
| ***arm_2d_types.h*** | This header file provides the definitions for the common and/or important data types, enumerations etc. | |
|
||||
| ***arm_2d_utils.h*** | This header file provides utilities used in arm-2d, such as macros for compiler-detection, OOPC, C language helpers etc. | |
|
||||
| ***arm_2d_features.h*** | This header file provides feature detection services for compiler and target processors. It also help to define, detect and validate macro-based-options for switching arm-2d features on and off. | **Do Not Modify** |
|
||||
| ***arm_2d_op.h*** | This header file list all the arm-2d OPCODE, i.e. ***ARM_2D_OP_xxxx*** | |
|
||||
| ***arm_2d_tile.h*** | The header file for all basic tile operations, e.g. tile-copy/filling with/without mirroring, with/without colour-keying etc. | [Doc](../../documentation/how_to_use_tile_operations.md) |
|
||||
| ***arm_2d_draw.h*** | The header file for all drawing related operations, e.g. filling rectangular area, drawing points, drawing bit-patterns etc. | |
|
||||
| ***arm_2d_conversion.h*** | The header file for colour-format conversion operations, e.g. conversion between RGB565 and RGB888 etc. | |
|
||||
| ***arm_2d_alpha_blending.h*** | The header file for alpha-blending centric operations, e.g. alpha-blending, copy with masks, colour-keying with opacity etc. | |
|
||||
| ***arm_2d_transform.h*** | The header file for transform operations, i.e. rotation and/or scaling (zooming). | |
|
||||
|
||||
|
||||
|
||||
## 3 Private Header Files
|
||||
|
||||
In the `Library/Include` folder, all header files (*.h) **with** double-underscore-prefix, i.e. "__", are considered as **PRIVATE HEADER FILES**. Only professional users should read them.
|
||||
|
||||
**Table 3-1 Summary of Private Header Files**
|
||||
|
||||
| File Name | Description | Note |
|
||||
| ------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| ***__arm_2d_impl.h*** | **The main entry for all professional users.** For advanced development (not for normal applications), you must include this header file that includes most of the private header files list below. | |
|
||||
| ***__arm_2d_direct.h*** | This file lists all the low level implementations for specific variants of 2D operations. It is useful when integrating arm-2d with a GUI stack. | This file is included by ***__arm_2d_impl.h***, please do NOT include it directly. |
|
||||
| ***__arm_2d_math.h*** | This file provides some math related utilities. | |
|
||||
| ***__arm_2d_math_helium.h*** | This file provides some math related utilities for helium only. It is **NOT** intended to be used outside of arm-2d. | **Do NOT Use.** |
|
||||
| ***__arm_2d_paving.h*** | This file lists some internal macro templates. It is **NOT** intended to be used outside of arm-2d. | **Do NOT Use.** |
|
||||
| ***__arm_2d_paving_helium.h*** | This file lists some internal macro templates for helium only. It is **NOT** intended to be used outside of arm-2d. | **Do NOT Use.** |
|
||||
| ***__arm_2d_utils_helium.h*** | This file lists some internal utils for helium only. It is **NOT** intended to be used outside of arm-2d. | **Do NOT Use.** |
|
||||
|
||||
|
||||
|
||||
## 4 Templates
|
||||
|
||||
In the `Library/Include/template` folder, there are some header files used as templates for purposes including but not limited to configuration etc.
|
||||
|
||||
**Table 4-1 Summary of Templates**
|
||||
|
||||
| File Name | Description | Note |
|
||||
| ------------------ | ------------------------------------------------------- | ---- |
|
||||
| ***arm_2d_cfg.h*** | A configuration template used in the arm-2d cmsis-pack. | |
|
File diff suppressed because it is too large
Load Diff
@ -1,823 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_impl.h
|
||||
* Description: header files for internal users or professional developers
|
||||
*
|
||||
* $Date: 09. Aug 2022
|
||||
* $Revision: V.1.2.2
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_ACCELERATION_H__
|
||||
# define __ARM_2D_ACCELERATION_H__ 1
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
#include "arm_2d.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wmissing-declarations"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
#elif __IS_COMPILER_ARM_COMPILER_5__
|
||||
# pragma diag_suppress 174,177,188,68,513,144,64
|
||||
#elif __IS_COMPILER_IAR__
|
||||
# pragma diag_suppress=Pe301
|
||||
#elif __IS_COMPILER_GCC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-value"
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
#undef this
|
||||
#define this (*ptThis)
|
||||
|
||||
#undef OP_CORE
|
||||
#define OP_CORE this.use_as__arm_2d_op_core_t
|
||||
|
||||
#define ARM_2D_IMPL(__TYPE, ...) \
|
||||
__TYPE *ptThis = (__TYPE *)(NULL,##__VA_ARGS__); \
|
||||
if (NULL == ptThis) { \
|
||||
ptThis = (__TYPE *)&ARM_2D_CTRL.DefaultOP; \
|
||||
}
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
#define ARM_2D_TRY_ACCELERATION(__ID, __FUNC_PROTOTYPE, ...) \
|
||||
if ( (NULL != OP_CORE.ptOp->Info.LowLevelIO.IO[__ID]->HW) \
|
||||
&& (NULL != OP_CORE.ptOp->Info.LowLevelIO.IO[__ID])) { \
|
||||
tResult = \
|
||||
(*(__FUNC_PROTOTYPE *)OP_CORE.ptOp->Info.LowLevelIO.IO[__ID]->HW)( \
|
||||
ptTask, \
|
||||
##__VA_ARGS__); \
|
||||
}
|
||||
|
||||
#define ARM_2D_RUN_DEFAULT(__ID, __FUNC_PROTOTYPE, ...) \
|
||||
if ( (NULL != OP_CORE.ptOp->Info.LowLevelIO.IO[__ID]->SW) \
|
||||
&& (NULL != OP_CORE.ptOp->Info.LowLevelIO.IO[__ID])) { \
|
||||
tResult = \
|
||||
(*(__FUNC_PROTOTYPE *)OP_CORE.ptOp->Info.LowLevelIO.IO[__ID]->SW)( \
|
||||
ptTask, \
|
||||
##__VA_ARGS__); \
|
||||
} else { \
|
||||
tResult = (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT; \
|
||||
}
|
||||
|
||||
#define __ARM_2D_PIXEL_BLENDING_GRAY8(__SRC_ADDR, __DES_ADDR, __TRANS) \
|
||||
do { \
|
||||
uint16_t hwOPA = 256 - (__TRANS); \
|
||||
const uint8_t *pchSrc = (uint8_t *)(__SRC_ADDR); \
|
||||
uint8_t *pchDes = (uint8_t *)(__DES_ADDR); \
|
||||
\
|
||||
*pchDes = ((uint16_t)( ((uint16_t)(*pchSrc++) * hwOPA) \
|
||||
+ ((uint16_t)(*pchDes) * (__TRANS)) \
|
||||
) >> 8); \
|
||||
} while(0)
|
||||
|
||||
#define __ARM_2D_PIXEL_BLENDING_RGB565(__SRC_ADDR, __DES_ADDR, __TRANS) \
|
||||
do { \
|
||||
uint16_t hwOPA = 256 - (__TRANS); \
|
||||
__arm_2d_color_fast_rgb_t tSrcPix, tTargetPix; \
|
||||
uint16_t *phwTargetPixel = (__DES_ADDR); \
|
||||
__arm_2d_rgb565_unpack(*(__SRC_ADDR), &tSrcPix); \
|
||||
__arm_2d_rgb565_unpack(*phwTargetPixel, &tTargetPix); \
|
||||
\
|
||||
for (int i = 0; i < 3; i++) { \
|
||||
uint16_t hwTemp = \
|
||||
(uint16_t) (tSrcPix.BGRA[i] * hwOPA) + \
|
||||
(tTargetPix.BGRA[i] * (__TRANS)); \
|
||||
tTargetPix.BGRA[i] = (uint16_t) (hwTemp >> 8); \
|
||||
} \
|
||||
\
|
||||
/* pack merged stream */ \
|
||||
*phwTargetPixel = __arm_2d_rgb565_pack(&tTargetPix); \
|
||||
} while(0)
|
||||
|
||||
#define __ARM_2D_PIXEL_BLENDING_CCCN888(__SRC_ADDR, __DES_ADDR, __TRANS) \
|
||||
do { \
|
||||
uint16_t hwOPA = 256 - (__TRANS); \
|
||||
/* do not change alpha */ \
|
||||
uint_fast8_t ARM_2D_SAFE_NAME(n) = sizeof(uint32_t) - 1; \
|
||||
const uint8_t *pchSrc = (uint8_t *)(__SRC_ADDR); \
|
||||
uint8_t *pchDes = (uint8_t *)(__DES_ADDR); \
|
||||
\
|
||||
do { \
|
||||
*pchDes = ( ((uint_fast16_t)(*pchSrc++) * hwOPA) \
|
||||
+ ((uint_fast16_t)(*pchDes) * (__TRANS)) \
|
||||
) >> 8; \
|
||||
pchDes++; \
|
||||
} while(--ARM_2D_SAFE_NAME(n)); \
|
||||
} while(0)
|
||||
|
||||
|
||||
|
||||
#define __ARM_2D_PIXEL_BLENDING_OPA_GRAY8(__SRC_ADDR, __DES_ADDR, __OPA) \
|
||||
do { \
|
||||
uint16_t hwTrans = 256 - (__OPA); \
|
||||
const uint8_t *pchSrc = (uint8_t *)(__SRC_ADDR); \
|
||||
uint8_t *pchDes = (uint8_t *)(__DES_ADDR); \
|
||||
\
|
||||
*pchDes = ((uint16_t)( ((uint16_t)(*pchSrc++) * (__OPA)) \
|
||||
+ ((uint16_t)(*pchDes) * hwTrans) \
|
||||
) >> 8); \
|
||||
} while(0)
|
||||
|
||||
#define __ARM_2D_PIXEL_BLENDING_OPA_RGB565(__SRC_ADDR, __DES_ADDR, __OPA) \
|
||||
do { \
|
||||
uint16_t hwTrans = 256 - (__OPA); \
|
||||
__arm_2d_color_fast_rgb_t tSrcPix, tTargetPix; \
|
||||
uint16_t *phwTargetPixel = (__DES_ADDR); \
|
||||
__arm_2d_rgb565_unpack(*(__SRC_ADDR), &tSrcPix); \
|
||||
__arm_2d_rgb565_unpack(*phwTargetPixel, &tTargetPix); \
|
||||
\
|
||||
for (int i = 0; i < 3; i++) { \
|
||||
uint16_t hwTemp = \
|
||||
(uint16_t) (tSrcPix.BGRA[i] * (__OPA)) + \
|
||||
(tTargetPix.BGRA[i] * hwTrans); \
|
||||
tTargetPix.BGRA[i] = (uint16_t) (hwTemp >> 8); \
|
||||
} \
|
||||
\
|
||||
/* pack merged stream */ \
|
||||
*phwTargetPixel = __arm_2d_rgb565_pack(&tTargetPix); \
|
||||
} while(0)
|
||||
|
||||
#define __ARM_2D_PIXEL_BLENDING_OPA_CCCN888(__SRC_ADDR, __DES_ADDR, __OPA) \
|
||||
do { \
|
||||
uint16_t hwTrans = 256 - (__OPA); \
|
||||
/* do not change alpha */ \
|
||||
uint_fast8_t ARM_2D_SAFE_NAME(n) = sizeof(uint32_t) - 1; \
|
||||
const uint8_t *pchSrc = (uint8_t *)(__SRC_ADDR); \
|
||||
uint8_t *pchDes = (uint8_t *)(__DES_ADDR); \
|
||||
\
|
||||
do { \
|
||||
*pchDes = ( ((uint_fast16_t)(*pchSrc++) * (__OPA)) \
|
||||
+ ((uint_fast16_t)(*pchDes) * hwTrans) \
|
||||
) >> 8; \
|
||||
pchDes++; \
|
||||
} while(--ARM_2D_SAFE_NAME(n)); \
|
||||
} while(0)
|
||||
|
||||
#define __ARM_2D_PIXEL_AVERAGE_RGB565(__PIXEL_IN, __ALPHA) \
|
||||
do { \
|
||||
__arm_2d_color_fast_rgb_t tTempColour; \
|
||||
__arm_2d_rgb565_unpack((__PIXEL_IN), &tTempColour); \
|
||||
tPixel.R += tTempColour.R * (__ALPHA); \
|
||||
tPixel.G += tTempColour.G * (__ALPHA); \
|
||||
tPixel.B += tTempColour.B * (__ALPHA); \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define __ARM_2D_PIXEL_AVERAGE_CCCN888(__PIXEL_IN, __ALPHA) \
|
||||
do { \
|
||||
arm_2d_color_rgb888_t tTempColour = {.tValue = (__PIXEL_IN)}; \
|
||||
tPixel.R += tTempColour.u8R * (__ALPHA); \
|
||||
tPixel.G += tTempColour.u8G * (__ALPHA); \
|
||||
tPixel.B += tTempColour.u8B * (__ALPHA); \
|
||||
} while(0)
|
||||
|
||||
#define __ARM_2D_PIXEL_AVERAGE_GRAY8(__PIXEL_IN, __ALPHA) \
|
||||
do { \
|
||||
tPixel += (uint16_t)(__PIXEL_IN) * (uint16_t)(__ALPHA); \
|
||||
} while(0)
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
typedef struct __arm_2d_point_adj_alpha_t{
|
||||
struct {
|
||||
arm_2d_location_t tOffset;
|
||||
uint_fast8_t chAlpha;
|
||||
}tMatrix[4];
|
||||
} __arm_2d_point_adj_alpha_t;
|
||||
|
||||
|
||||
|
||||
|
||||
//! \name Operation Index: used for logging and debugging purpose
|
||||
//! @{
|
||||
enum {
|
||||
/*------------ arm-2d operation idx begin --------------*/
|
||||
__ARM_2D_OP_IDX_BARRIER,
|
||||
__ARM_2D_OP_IDX_SYNC = __ARM_2D_OP_IDX_BARRIER,
|
||||
|
||||
__ARM_2D_OP_IDX_COPY,
|
||||
__ARM_2D_OP_IDX_COPY_ONLY,
|
||||
__ARM_2D_OP_IDX_COPY_WITH_X_MIRROR,
|
||||
__ARM_2D_OP_IDX_COPY_WITH_Y_MIRROR,
|
||||
__ARM_2D_OP_IDX_COPY_WITH_XY_MIRROR,
|
||||
|
||||
__ARM_2D_OP_IDX_FILL_ONLY,
|
||||
__ARM_2D_OP_IDX_FILL_WITH_X_MIRROR,
|
||||
__ARM_2D_OP_IDX_FILL_WITH_Y_MIRROR,
|
||||
__ARM_2D_OP_IDX_FILL_WITH_XY_MIRROR,
|
||||
|
||||
__ARM_2D_OP_IDX_COPY_WITH_COLOUR_KEYING,
|
||||
__ARM_2D_OP_IDX_COPY_WITH_MASKS,
|
||||
__ARM_2D_OP_IDX_COPY_WITH_SOURCE_MASK,
|
||||
__ARM_2D_OP_IDX_COPY_WITH_TARGET_MASK,
|
||||
__ARM_2D_OP_IDX_FILL_COLOUR,
|
||||
__ARM_2D_OP_IDX_FILL_COLOUR_WITH_COLOUR_KEYING,
|
||||
__ARM_2D_OP_IDX_FILL_COLOUR_WITH_MASK,
|
||||
__ARM_2D_OP_IDX_FILL_COLOUR_WITH_MASK_AND_OPACITY,
|
||||
|
||||
__ARM_2D_OP_IDX_ALPHA_BLENDING,
|
||||
__ARM_2D_OP_IDX_ALPHA_BLENDING_WITH_COLOUR_KEYING,
|
||||
__ARM_2D_OP_IDX_ALPHA_FILL_COLOUR,
|
||||
__ARM_2D_OP_IDX_ALPHA_FILL_COLOUR_WITH_COLOUR_KEYING,
|
||||
|
||||
__ARM_2D_OP_IDX_DRAW_POINT,
|
||||
__ARM_2D_OP_IDX_DRAW_PATTERN,
|
||||
|
||||
__ARM_2D_OP_IDX_COLOUR_FORMAT_CONVERSION,
|
||||
|
||||
__ARM_2D_OP_IDX_TRANSFORM,
|
||||
//__ARM_2D_OP_IDX_TRANSFORM_WITH_MASKS, //!< todo in v1.xx
|
||||
__ARM_2D_OP_IDX_TRANSFORM_WITH_SOURCE_MASK,
|
||||
//__ARM_2D_OP_IDX_TRANSFORM_WITH_TARGET_MASK, //!< todo in v1.xx
|
||||
|
||||
__ARM_2D_OP_IDX_TRANSFORM_WITH_OPACITY,
|
||||
//__ARM_2D_OP_IDX_TRANSFORM_WITH_MASKS_AND_OPACITY, //!< todo in v1.xx
|
||||
__ARM_2D_OP_IDX_TRANSFORM_WITH_SOURCE_MASK_AND_OPACITY,
|
||||
//__ARM_2D_OP_IDX_TRANSFORM_WITH_TARGET_MASK_AND_OPACITY, //!< todo in v1.xx
|
||||
/*------------ cmsisi-2d operation idx end --------------*/
|
||||
};
|
||||
//! @}
|
||||
|
||||
|
||||
typedef struct __arm_2d_sub_task_t __arm_2d_sub_task_t;
|
||||
|
||||
|
||||
typedef arm_fsm_rt_t __arm_2d_io_func_t(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
typedef struct __arm_2d_low_level_io_t {
|
||||
__arm_2d_io_func_t *SW;
|
||||
__arm_2d_io_func_t *HW;
|
||||
} __arm_2d_low_level_io_t;
|
||||
|
||||
|
||||
typedef struct __arm_2d_tile_param_t {
|
||||
void * pBuffer;
|
||||
int32_t nOffset;
|
||||
int16_t iStride;
|
||||
arm_2d_color_info_t tColour;
|
||||
|
||||
uint8_t bInvalid : 1;
|
||||
uint8_t bDerivedResource : 1;
|
||||
uint8_t : 6;
|
||||
|
||||
arm_2d_region_t tValidRegion;
|
||||
arm_2d_tile_t *ptDerivedResource;
|
||||
} __arm_2d_tile_param_t;
|
||||
|
||||
typedef struct __arm_2d_param_copy_t {
|
||||
__arm_2d_tile_param_t tSource;
|
||||
__arm_2d_tile_param_t tTarget;
|
||||
arm_2d_size_t tCopySize;
|
||||
} __arm_2d_param_copy_t;
|
||||
|
||||
typedef struct __arm_2d_param_copy_msk_t {
|
||||
implement(__arm_2d_param_copy_t);
|
||||
|
||||
__arm_2d_tile_param_t tSrcMask;
|
||||
__arm_2d_tile_param_t tDesMask;
|
||||
} __arm_2d_param_copy_msk_t;
|
||||
|
||||
typedef struct __arm_2d_param_copy_orig_t {
|
||||
implement(__arm_2d_param_copy_t);
|
||||
|
||||
__arm_2d_tile_param_t tOrigin;
|
||||
|
||||
} __arm_2d_param_copy_orig_t;
|
||||
|
||||
typedef struct __arm_2d_param_copy_orig_msk_t {
|
||||
implement(__arm_2d_param_copy_orig_t);
|
||||
|
||||
__arm_2d_tile_param_t tOrigMask;
|
||||
__arm_2d_tile_param_t tDesMask;
|
||||
|
||||
} __arm_2d_param_copy_orig_msk_t;
|
||||
|
||||
typedef struct __arm_2d_param_fill_t {
|
||||
__arm_2d_tile_param_t tSource;
|
||||
__arm_2d_tile_param_t tTarget;
|
||||
} __arm_2d_param_fill_t;
|
||||
|
||||
typedef struct __arm_2d_param_fill_msk_t {
|
||||
implement(__arm_2d_param_fill_t);
|
||||
|
||||
__arm_2d_tile_param_t tSrcMask;
|
||||
__arm_2d_tile_param_t tDesMask;
|
||||
} __arm_2d_param_fill_msk_t;
|
||||
|
||||
typedef struct __arm_2d_param_fill_orig_t {
|
||||
implement(__arm_2d_param_fill_t);
|
||||
|
||||
__arm_2d_tile_param_t tOrigin;
|
||||
|
||||
} __arm_2d_param_fill_orig_t;
|
||||
|
||||
struct __arm_2d_sub_task_t{
|
||||
ARM_PRIVATE(
|
||||
__arm_2d_sub_task_t *ptNext;
|
||||
|
||||
arm_2d_op_core_t *ptOP;
|
||||
|
||||
uint8_t chLowLeveIOIndex; //!< the type of IO interface
|
||||
uint8_t bIsCPL : 1;
|
||||
uint8_t : 7;
|
||||
uint16_t : 16;
|
||||
|
||||
union {
|
||||
__arm_2d_tile_param_t tTileProcess;
|
||||
|
||||
__arm_2d_param_copy_t tCopy;
|
||||
__arm_2d_param_copy_msk_t tCopyMask;
|
||||
__arm_2d_param_copy_orig_t tCopyOrig; //!< for transform
|
||||
__arm_2d_param_copy_orig_msk_t tCopyOrigMask; //!< for transform with masks
|
||||
|
||||
__arm_2d_param_fill_t tFill;
|
||||
__arm_2d_param_fill_msk_t tFillMask;
|
||||
__arm_2d_param_fill_orig_t tFillOrig;
|
||||
}Param;
|
||||
)};
|
||||
|
||||
|
||||
struct __arm_2d_op_control {
|
||||
ARM_PRIVATE(
|
||||
__arm_2d_sub_task_t *ptFreeList;
|
||||
struct {
|
||||
__arm_2d_sub_task_t *ptHead;
|
||||
__arm_2d_sub_task_t *ptTail;
|
||||
} TaskFIFO;
|
||||
|
||||
struct {
|
||||
arm_2d_op_core_t *ptHead;
|
||||
arm_2d_op_core_t *ptTail;
|
||||
} OPFIFO;
|
||||
|
||||
uint16_t hwFreeCount;
|
||||
uint16_t hwTaskCount;
|
||||
uint16_t hwBookCount;
|
||||
uint16_t : 16;
|
||||
|
||||
arm_2d_tile_t *ptDefaultFrameBuffer;
|
||||
|
||||
union {
|
||||
arm_2d_op_t tBasic;
|
||||
arm_2d_op_fill_cl_t tFillColour;
|
||||
arm_2d_op_fill_cl_msk_t tFillColourMask;
|
||||
arm_2d_op_fill_cl_opc_t tFillColourOpacity;
|
||||
arm_2d_op_src_t tWithSource;
|
||||
|
||||
arm_2d_op_alpha_t tAlpha;
|
||||
arm_2d_op_alpha_cl_key_t tAlphaColourKeying;
|
||||
arm_2d_op_alpha_fill_cl_msk_opc_t tAlphaFillColourMaskOpacity;
|
||||
arm_2d_op_cp_msk_t tCopyMasks;
|
||||
|
||||
arm_2d_op_drw_patn_t tDrawPattern;
|
||||
arm_2d_op_trans_t tTransform;
|
||||
arm_2d_op_trans_opa_t tRotateOpacity;
|
||||
|
||||
arm_2d_op_msk_t tBasicMask;
|
||||
arm_2d_op_src_msk_t tSourceMask;
|
||||
arm_2d_op_src_orig_msk_t tSourceOrigMask;
|
||||
} DefaultOP;
|
||||
)};
|
||||
|
||||
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
extern
|
||||
const struct __arm_2d_io_table __ARM_2D_IO_TABLE;
|
||||
|
||||
extern struct __arm_2d_op_control ARM_2D_CTRL;
|
||||
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Pipeline *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_op_invoke(arm_2d_op_core_t *ptOP);
|
||||
|
||||
extern
|
||||
/*! \brief sync up with operation
|
||||
*! \retval true operation is busy
|
||||
*! \retval false operation isn't busy
|
||||
*/
|
||||
bool __arm_2d_op_acquire(arm_2d_op_core_t *ptOP);
|
||||
|
||||
/*! \note This API should be called by both arm_2d_task and hardware
|
||||
*! accelerator to indicate the completion of a sub task
|
||||
*/
|
||||
extern
|
||||
void __arm_2d_notify_sub_task_cpl(__arm_2d_sub_task_t *ptTask,
|
||||
arm_fsm_rt_t tResult,
|
||||
bool bFromHW);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_op_frontend_op_decoder(arm_2d_op_core_t *ptThis);
|
||||
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_op_depose(arm_2d_op_core_t *ptThis,
|
||||
arm_fsm_rt_t tResult);
|
||||
|
||||
extern
|
||||
void __arm_2d_sub_task_depose(arm_2d_op_core_t *ptOP);
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Utilities *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
__arm_2d_point_adj_alpha_t
|
||||
__arm_2d_point_get_adjacent_alpha_fp(arm_2d_point_float_t *ptPoint);
|
||||
|
||||
extern
|
||||
__arm_2d_point_adj_alpha_t
|
||||
__arm_2d_point_get_adjacent_alpha_q16(arm_2d_point_fx_t *ptPoint);
|
||||
|
||||
extern
|
||||
arm_2d_err_t __arm_mask_validate( const arm_2d_tile_t *ptSource,
|
||||
const arm_2d_tile_t *ptSrcMask,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_tile_t *ptDesMask,
|
||||
uint32_t wMode);
|
||||
|
||||
extern
|
||||
ARM_NONNULL(1,2)
|
||||
const arm_2d_tile_t *__arm_2d_tile_get_root(const arm_2d_tile_t *ptTile,
|
||||
arm_2d_region_t *ptValidRegion,
|
||||
arm_2d_location_t *ptOffset,
|
||||
arm_2d_tile_t **ppFirstDerivedChild);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Default Software Implementations *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_sw_draw_point(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_draw_pattern( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_draw_pattern( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_draw_pattern( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_fill( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_fill( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_fill( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_copy( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_copy( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_copy( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_copy_only( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_copy_only( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_copy_only( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_copy_x_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_copy_x_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_copy_x_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_copy_y_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_copy_y_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_copy_y_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_copy_xy_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_copy_xy_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_copy_xy_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_fill_only( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_fill_only( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_fill_only( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_fill_x_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_fill_x_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_fill_x_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_fill_y_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_fill_y_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_fill_y_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_fill_xy_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_fill_xy_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_fill_xy_mirror( __arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_tile_copy_with_masks(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_tile_fill_with_masks(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_tile_copy_with_masks(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_tile_fill_with_masks(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_tile_copy_with_masks(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_tile_fill_with_masks(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_tile_copy_with_src_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_tile_fill_with_src_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_tile_copy_with_src_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_tile_fill_with_src_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_tile_copy_with_src_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_tile_fill_with_src_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_tile_copy_with_des_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_tile_fill_with_des_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_tile_copy_with_des_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_tile_fill_with_des_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_tile_copy_with_des_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_tile_fill_with_des_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_copy_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_copy_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_copy_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_tile_fill_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_tile_fill_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_tile_fill_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_colour_filling(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_colour_filling(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_colour_filling(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_colour_filling_with_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_colour_filling_with_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_colour_filling_with_mask(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_colour_filling_with_mask_and_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_colour_filling_with_mask_and_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_colour_filling_with_mask_and_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_alpha_blending(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_alpha_blending(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_alpha_blending(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_alpha_blending_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_alpha_blending_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_alpha_blending_with_colour_keying(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_colour_filling_with_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_colour_filling_with_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_colour_filling_with_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_sw_convert_colour_to_gray8(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_sw_convert_colour_to_rgb565(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_sw_convert_colour_to_rgb888(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_gray8_sw_transform(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_rgb565_sw_transform(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t __arm_2d_cccn888_sw_transform(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_gray8_sw_transform_with_alpha(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_rgb565_sw_transform_with_alpha(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_cccn888_sw_transform_with_alpha(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_gray8_sw_transform_with_src_mask(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_rgb565_sw_transform_with_src_mask(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_cccn888_sw_transform_with_src_mask(__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_gray8_sw_transform_with_src_mask_and_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_rgb565_sw_transform_with_src_mask_and_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
|
||||
extern
|
||||
arm_fsm_rt_t
|
||||
__arm_2d_cccn888_sw_transform_with_src_mask_and_opacity(
|
||||
__arm_2d_sub_task_t *ptTask);
|
||||
/*========================== POST INCLUDES ===================================*/
|
||||
#include "__arm_2d_direct.h"
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif __IS_COMPILER_ARM_COMPILER_5__
|
||||
# pragma diag_warning 174,177,188,68,513,144,64
|
||||
#elif __IS_COMPILER_IAR__
|
||||
# pragma diag_warning=pe111
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,189 +0,0 @@
|
||||
/******************************************************************************
|
||||
* @file arm_2d_math.h
|
||||
* @brief Public header file for Arm-2D Library
|
||||
* @version V1.0.0
|
||||
* @date 16. June 2021
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __ARM_2D_MATH_H__
|
||||
#define __ARM_2D_MATH_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
|
||||
/*! \note this header file is not standalone, and please always use it after
|
||||
*! #include "arm_2d_features.h"
|
||||
*! #include "arm_2d_utils.h"
|
||||
*! in your c source file if you insist to use it explicity.
|
||||
*/
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-conversion"
|
||||
# pragma clang diagnostic ignored "-Wundef"
|
||||
#elif __IS_COMPILER_GCC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
#if defined(__IS_COMPILER_ARM_COMPILER_5__) \
|
||||
&& defined(__ARM_2D_HAS_HELIUM__) && __ARM_2D_HAS_HELIUM__
|
||||
# warning 'Arm Compiler 5 doesn\'t support Armv8.1-M architecture, please use \
|
||||
Arm Compiler 5 instead. If you insist using Arm Compiler 5,\
|
||||
__ARM_2D_HAS_HELIUM__ is forced to 0.'
|
||||
# undef __ARM_2D_HAS_HELIUM__
|
||||
# define __ARM_2D_HAS_HELIUM__ 0
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__ARM_2D_HAS_HELIUM__) && __ARM_2D_HAS_HELIUM__
|
||||
#include <arm_mve.h>
|
||||
#else
|
||||
// if MVE is not defined, use float type for bilinear interpolation
|
||||
typedef float float16_t;
|
||||
#endif
|
||||
|
||||
#if __ARM_2D_HAS_DSP__
|
||||
|
||||
#if defined(__IS_COMPILER_ARM_COMPILER_5__)
|
||||
# include "armdsp.h"
|
||||
#else
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "arm_math.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Math *
|
||||
*----------------------------------------------------------------------------*/
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef _BV
|
||||
# define _BV(__BIT) (1 << (__BIT))
|
||||
#endif
|
||||
|
||||
#ifndef ABS
|
||||
# define ABS(x) ((x) > 0 ? (x) : -(x))
|
||||
#endif
|
||||
|
||||
#undef MULTFX
|
||||
/* 32 bit multiplication with high part extraction */
|
||||
#define MULTFX(x,y) (q31_t)((q63_t)((q63_t) (x) * (q63_t)(y)) >> 32)
|
||||
|
||||
/* Q16 multiplication */
|
||||
#undef MUL_Q16
|
||||
#define MUL_Q16(x,y) (q31_t)((q63_t)((q63_t) (x) * (q63_t)(y)) >> 16)
|
||||
|
||||
|
||||
#define ARM_PIX_SCLTYP(sz) ARM_CONNECT2(ARM_CONNECT2(uint, sz), _t)
|
||||
|
||||
#define ARM_2D_ANGLE(__ANGLE) ((float)((float)(__ANGLE) * 3.1415926f / 180.0f))
|
||||
|
||||
#if __ARM_2D_HAS_DSP__
|
||||
|
||||
#undef __QDADD
|
||||
#undef __QDSUB
|
||||
#define __QDADD(X, Y) __qadd(X, __qdbl(Y))
|
||||
#define __QDSUB(X, Y) __qsub(X, __qdbl(Y))
|
||||
|
||||
#define __LARGEINVF32 100.0f
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
#elif defined(__ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__)
|
||||
/*
|
||||
* @brief C custom defined QDADD
|
||||
*/
|
||||
__STATIC_FORCEINLINE int32_t __QDADD(
|
||||
int32_t x,
|
||||
int32_t y)
|
||||
{
|
||||
return x + y * 2;
|
||||
}
|
||||
/*
|
||||
* @brief C custom defined QDSUB
|
||||
*/
|
||||
__STATIC_FORCEINLINE int32_t __QDSUB(
|
||||
int32_t x,
|
||||
int32_t y)
|
||||
{
|
||||
return x - y * 2;
|
||||
}
|
||||
#else
|
||||
|
||||
/*
|
||||
* @brief C custom defined QDADD
|
||||
*/
|
||||
__STATIC_FORCEINLINE int32_t __QDADD(
|
||||
int32_t x,
|
||||
int32_t y)
|
||||
{
|
||||
return ((int32_t)(clip_q63_to_q31((q63_t)x + (q63_t)y*2)));
|
||||
}
|
||||
/*
|
||||
* @brief C custom defined QDSUB
|
||||
*/
|
||||
__STATIC_FORCEINLINE int32_t __QDSUB(
|
||||
int32_t x,
|
||||
int32_t y)
|
||||
{
|
||||
return ((int32_t)(clip_q63_to_q31((q63_t)x - (q63_t)2*y)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif __IS_COMPILER_ARM_COMPILER_5__
|
||||
#elif __IS_COMPILER_GCC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* end of __ARM_2D_MATH_H__ */
|
||||
|
@ -1,413 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm-2d_math_helium.h
|
||||
* Description: Provides helium math routines
|
||||
*
|
||||
* $Date: 29. Sep 2021
|
||||
* $Revision: V 0.0.2
|
||||
*
|
||||
* Target Processor: Cortex-M cores with Helium
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
#ifndef __ARM_2D_MATH_HELIUM_H__
|
||||
#define __ARM_2D_MATH_HELIUM_H__
|
||||
|
||||
|
||||
#if defined(__ARM_2D_HAS_HELIUM__) && __ARM_2D_HAS_HELIUM__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d.h"
|
||||
#include <arm_math.h>
|
||||
|
||||
#if __ARM_2D_HAS_HELIUM_FLOAT__
|
||||
#include <arm_math_f16.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define vec_rgb8_t uint8x16_t
|
||||
#define vec_rgb16_t uint16x8_t
|
||||
#define vec_rgb32_t uint32x4_t
|
||||
|
||||
#define ARM_PIX_SCLTYP(sz) ARM_CONNECT2(ARM_CONNECT2(uint, sz), _t)
|
||||
#define ARM_PIX_VECTYP(sz) ARM_CONNECT2(ARM_CONNECT2(vec_rgb,sz), _t)
|
||||
|
||||
#define vld8 vldrb
|
||||
#define vld16 vldrh
|
||||
#define vld32 vldrw
|
||||
#define vst8 vstrb
|
||||
#define vst16 vstrh
|
||||
#define vst32 vstrw
|
||||
|
||||
#define ARM_VLD_ASM(sz) ARM_CONNECT2(vld, sz)
|
||||
#define ARM_VST_ASM(sz) ARM_CONNECT2(vst, sz)
|
||||
|
||||
#define ARM_VLD1_ASM(sz) ARM_TO_STRING(ARM_VLD_ASM(sz).ARM_CONNECT2(u,sz))
|
||||
#define ARM_VST1_ASM(sz) ARM_TO_STRING(ARM_VST_ASM(sz).ARM_CONNECT2(u,sz))
|
||||
#define ARM_VLD1Z_ASM(sz) ARM_TO_STRING(ARM_VLD_ASM(sz)t.ARM_CONNECT2(u,sz))
|
||||
#define ARM_VST1P_ASM(sz) ARM_TO_STRING(ARM_VST_ASM(sz)t.ARM_CONNECT2(u,sz))
|
||||
#define ARM_VLDWID_ASM(sz, wid) ARM_TO_STRING(ARM_VLD_ASM(sz).ARM_CONNECT2(u,wid))
|
||||
#define ARM_VSTNRW_ASM(sz, nrw) ARM_TO_STRING(ARM_VLD_ASM(sz).ARM_CONNECT2(u,nrw))
|
||||
|
||||
|
||||
/* number of vector elements */
|
||||
#define ARM_PIX_VECELT(sz) (128/sz)
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
|
||||
|
||||
|
||||
#if __ARM_2D_HAS_HELIUM_FLOAT__
|
||||
|
||||
#define __PIF16 3.14159265358979F16
|
||||
#define __CALIBF16 0.009f16
|
||||
/* avoid 0 division */
|
||||
/* should not be too small as inverse could grows to F16 infinite 65e3 when */
|
||||
/* multiplied with numerator */
|
||||
#define __EPSF16 1e-03f16
|
||||
|
||||
#define __LARGEINVF32 100.0f
|
||||
|
||||
#define __PI_2_F16 (__PIF16/2.0f16)
|
||||
#define INV_NEWTON_INIT_F16 0x7773
|
||||
|
||||
#define INFINITY_F16 ((float16_t)__builtin_inf())
|
||||
|
||||
|
||||
#define ATANF_LUT \
|
||||
-0.0443265554792128, /*p7*/ \
|
||||
-0.3258083974640975, /*p3*/ \
|
||||
+0.1555786518463281, /*p5*/ \
|
||||
+0.9997878412794807 /*p1*/ \
|
||||
|
||||
extern const float16_t sinTable_f16[FAST_MATH_TABLE_SIZE + 1];
|
||||
extern const float16_t atanf_lut_f16[4];
|
||||
|
||||
#define INVSQRT_MAGIC_F16 0x59ba /* ( 0x1ba = 0x3759df >> 13) */
|
||||
|
||||
/* 2D point floating point vector types */
|
||||
typedef struct arm_2d_point_f32x4_t {
|
||||
float32x4_t X;
|
||||
float32x4_t Y;
|
||||
} arm_2d_point_f32x4_t;
|
||||
|
||||
typedef struct arm_2d_point_f16x8_t {
|
||||
float16x8_t X;
|
||||
float16x8_t Y;
|
||||
} arm_2d_point_f16x8_t;
|
||||
|
||||
#endif
|
||||
|
||||
/* 2D point integer point vector types */
|
||||
typedef struct arm_2d_point_s16x8_t {
|
||||
int16x8_t X;
|
||||
int16x8_t Y;
|
||||
} arm_2d_point_s16x8_t;
|
||||
|
||||
typedef struct arm_2d_point_s32x4_t {
|
||||
int32x4_t X;
|
||||
int32x4_t Y;
|
||||
} arm_2d_point_s32x4_t;
|
||||
|
||||
|
||||
|
||||
#if __ARM_2D_HAS_HELIUM_FLOAT__ == 1
|
||||
|
||||
__STATIC_FORCEINLINE float16x8_t vsin_f16(
|
||||
float16x8_t vecIn)
|
||||
{
|
||||
q15x8_t vecMask = vdupq_n_s16(0x1ff);
|
||||
float16x8_t vecOne = vdupq_n_f16(1.0f16);
|
||||
float16x8_t vecTmpFlt0, vecTmpFlt1;
|
||||
float16x8_t vecSin0, vecSin1;
|
||||
q15x8_t vecTmpFx;
|
||||
|
||||
|
||||
/*
|
||||
* input x is in radians
|
||||
* Scale the input to [0 1] range from [0 2*PI]
|
||||
* divide input by 2*pi (add 0.25 (pi/2) to read sine table)
|
||||
* in = x * 0.159154943092f + 0.25f
|
||||
*/
|
||||
vecTmpFlt0 = vmulq(vecIn, (float16_t) (1.0 / (2.0 * PI)));
|
||||
/*
|
||||
* Calculation of floor value of input
|
||||
*/
|
||||
vecTmpFx = vcvtmq_s16_f16(vecTmpFlt0);
|
||||
vecTmpFlt1 = vcvtq_f16_s16(vecTmpFx);
|
||||
/*
|
||||
* Map input value to [0 1]
|
||||
*/
|
||||
vecTmpFlt1 = vecTmpFlt0 - vecTmpFlt1;
|
||||
/*
|
||||
* Calculation of index of the table
|
||||
* findex = (float16_t) FAST_MATH_TABLE_SIZE * in;
|
||||
*/
|
||||
vecTmpFlt0 = vecTmpFlt1 * (float16_t) FAST_MATH_TABLE_SIZE;
|
||||
/*
|
||||
* index = ((uint16_t)findex) & 0x1ff;
|
||||
*/
|
||||
vecTmpFx = vcvtq_s16_f16(vecTmpFlt0);
|
||||
vecTmpFx = vandq(vecTmpFx, vecMask);
|
||||
/*
|
||||
* fractional value calculation
|
||||
* fract = findex - (float16_t) index;
|
||||
*/
|
||||
vecTmpFlt1 = vcvtq_f16_s16(vecTmpFx);
|
||||
vecTmpFlt0 = vecTmpFlt0 - vecTmpFlt1;
|
||||
/*
|
||||
* Read two nearest values of input value from the cos table
|
||||
* a = sinTable_f16[index];
|
||||
*/
|
||||
vecSin0 = vldrhq_gather_shifted_offset_f16(sinTable_f16, vecTmpFx);
|
||||
/*
|
||||
* b = sinTable_f16[index+1];
|
||||
*/
|
||||
vecTmpFx = vecTmpFx + 1;
|
||||
vecSin1 = vldrhq_gather_shifted_offset_f16(sinTable_f16, vecTmpFx);
|
||||
/*
|
||||
* 1.0f - fract
|
||||
*/
|
||||
vecTmpFlt1 = vecOne - vecTmpFlt0;
|
||||
/*
|
||||
* fract * b;
|
||||
*/
|
||||
vecTmpFlt0 = vecTmpFlt0 * vecSin1;
|
||||
/*
|
||||
* Linear interpolation process
|
||||
* cosVal = (1.0f-fract)*a + fract*b;
|
||||
*/
|
||||
vecTmpFlt0 = vfmaq(vecTmpFlt0, vecSin0, vecTmpFlt1);
|
||||
|
||||
// set 'tiny' values to x (F16 precision limit)
|
||||
vecTmpFlt0 = vpselq(vecIn, vecTmpFlt0, vcmpleq(vabsq(vecIn), 0.05f16));
|
||||
|
||||
return vecTmpFlt0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE float16x8_t vcos_f16(
|
||||
float16x8_t x)
|
||||
{
|
||||
return vsin_f16(x + __PI_2_F16);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* fast inverse approximation (4x newton) */
|
||||
__STATIC_INLINE float16x8_t vrecip_hiprec_f16(
|
||||
float16x8_t x)
|
||||
{
|
||||
q15x8_t m;
|
||||
float16x8_t b;
|
||||
any16x8_t xinv;
|
||||
float16x8_t ax = vabsq(x);
|
||||
|
||||
xinv.f = ax;
|
||||
|
||||
m = 0x03c00 - (xinv.i & 0x07c00);
|
||||
xinv.i = xinv.i + m;
|
||||
xinv.f = 1.41176471f16 - 0.47058824f16 * xinv.f;
|
||||
xinv.i = xinv.i + m;
|
||||
|
||||
b = 2.0f16 - xinv.f * ax;
|
||||
xinv.f = xinv.f * b;
|
||||
|
||||
b = 2.0f16 - xinv.f * ax;
|
||||
xinv.f = xinv.f * b;
|
||||
|
||||
b = 2.0f16 - xinv.f * ax;
|
||||
xinv.f = xinv.f * b;
|
||||
|
||||
b = 2.0f16 - xinv.f * ax;
|
||||
xinv.f = xinv.f * b;
|
||||
|
||||
xinv.f = vdupq_m(xinv.f, INFINITY_F16, vcmpeqq(x, 0.0f));
|
||||
/*
|
||||
* restore sign
|
||||
*/
|
||||
xinv.f = vnegq_m(xinv.f, xinv.f, vcmpltq(x, 0.0f));
|
||||
|
||||
return xinv.f;
|
||||
}
|
||||
|
||||
__STATIC_FORCEINLINE float16x8_t vrecip_lowprec_f16(float16x8_t vecIn)
|
||||
{
|
||||
float16x8_t vecSx, vecW;
|
||||
any16x8_t r;
|
||||
|
||||
vecSx = vabsq(vecIn);
|
||||
r.f = vecSx;
|
||||
|
||||
r.i = vdupq_n_u16(INV_NEWTON_INIT_F16) - r.i;
|
||||
|
||||
vecW = vmulq(vecSx, r.f);
|
||||
vecW = vsubq(vdupq_n_f16((float16_t)2), vecW);
|
||||
|
||||
r.f = vmulq(r.f, vecW);
|
||||
|
||||
r.f = vdupq_m(r.f, (float16_t)INFINITY, vcmpeqq(vecIn, (float16_t)0));
|
||||
/*
|
||||
* restore sign
|
||||
*/
|
||||
r.f = vnegq_m(r.f, r.f, vcmpltq_n_f16(vecIn, (float16_t)0));
|
||||
|
||||
return r.f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE float16x8_t vatan_f16(
|
||||
float16x8_t x)
|
||||
{
|
||||
float16x8_t a, b, r;
|
||||
float16x8_t xx;
|
||||
any16x8_t xinv , ax;
|
||||
|
||||
ax.f = vabsq(x);
|
||||
//fast inverse approximation (2x newton)
|
||||
xinv.f = vrecip_lowprec_f16( ax.f );
|
||||
|
||||
//if |x| > 1.0 -> ax = -1/ax, r = pi/2
|
||||
xinv.f = xinv.f + ax.f;
|
||||
|
||||
// a = (c > 1.0f);
|
||||
a = vdupq_n_f16(0.0f16);
|
||||
a = vdupq_m(a, 1.0f16, vcmpgtq(ax.f, 1.0f16));
|
||||
|
||||
ax.f = ax.f - a * xinv.f;
|
||||
r = a * (float16_t)__PI_2_F16;
|
||||
|
||||
//polynomial evaluation
|
||||
xx = ax.f * ax.f;
|
||||
a = (atanf_lut_f16[0] * ax.f) * xx + (atanf_lut_f16[2] * ax.f);
|
||||
b = (atanf_lut_f16[1] * ax.f) * xx + (atanf_lut_f16[3] * ax.f);
|
||||
xx = xx * xx;
|
||||
b = b + a * xx;
|
||||
r = r + b;
|
||||
|
||||
//if x < 0 -> r = -r
|
||||
r = vnegq_m(r, r, vcmpltq(x, 0.0f16));
|
||||
// set 'tiny' values to x (F16 precision limit)
|
||||
r = vpselq(x, r, vcmpleq(vabsq(x), 0.05f16));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
__STATIC_INLINE float16x8_t vdiv_f16(
|
||||
float16x8_t num, float16x8_t den)
|
||||
{
|
||||
return vmulq(num, vrecip_hiprec_f16(den));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE float16x8_t visqrtf_f16(
|
||||
float16x8_t vecIn)
|
||||
{
|
||||
int16x8_t vecNewtonInit = vdupq_n_s16(INVSQRT_MAGIC_F16);
|
||||
float16x8_t vecOneHandHalf = vdupq_n_f16(1.5f16);
|
||||
float16x8_t vecHalf;
|
||||
int16x8_t vecTmpInt;
|
||||
float16x8_t vecTmpFlt, vecTmpFlt1;
|
||||
|
||||
|
||||
vecHalf = vmulq(vecIn, (float16_t) 0.5f16);
|
||||
/*
|
||||
* cast input float vector to integer and right shift by 1
|
||||
*/
|
||||
vecTmpInt = vshrq((int16x8_t) vecIn, 1);
|
||||
/*
|
||||
* INVSQRT_MAGIC - ((vec_q16_t)vecIn >> 1)
|
||||
*/
|
||||
vecTmpInt = vsubq(vecNewtonInit, vecTmpInt);
|
||||
|
||||
/*
|
||||
*------------------------------
|
||||
* 1st iteration
|
||||
*------------------------------
|
||||
* (1.5f-xhalf*x*x)
|
||||
*/
|
||||
vecTmpFlt1 = vmulq((float16x8_t) vecTmpInt, (float16x8_t) vecTmpInt);
|
||||
vecTmpFlt1 = vmulq(vecTmpFlt1, vecHalf);
|
||||
vecTmpFlt1 = vsubq(vecOneHandHalf, vecTmpFlt1);
|
||||
/*
|
||||
* x = x*(1.5f-xhalf*x*x);
|
||||
*/
|
||||
vecTmpFlt = vmulq((float16x8_t) vecTmpInt, vecTmpFlt1);
|
||||
|
||||
/*
|
||||
*------------------------------
|
||||
* 2nd iteration
|
||||
*------------------------------
|
||||
*/
|
||||
vecTmpFlt1 = vmulq(vecTmpFlt, vecTmpFlt);
|
||||
vecTmpFlt1 = vmulq(vecTmpFlt1, vecHalf);
|
||||
vecTmpFlt1 = vsubq(vecOneHandHalf, vecTmpFlt1);
|
||||
vecTmpFlt = vmulq(vecTmpFlt, vecTmpFlt1);
|
||||
|
||||
/*
|
||||
* set negative values to nan
|
||||
*/
|
||||
vecTmpFlt = vdupq_m(vecTmpFlt, (float16_t) NAN, vcmpltq(vecIn, (float16_t) 0.0f16));
|
||||
vecTmpFlt =
|
||||
vdupq_m(vecTmpFlt, (float16_t) INFINITY, vcmpeqq(vecIn, (float16_t) 0.0f16));
|
||||
|
||||
return vecTmpFlt;
|
||||
}
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE float16x8_t vsqrtf_f16(
|
||||
float16x8_t vecIn)
|
||||
{
|
||||
float16x8_t vecDst;
|
||||
|
||||
/* inverse square root unsing 2 newton iterations */
|
||||
vecDst = visqrtf_f16(vecIn);
|
||||
vecDst = vdupq_m(vecDst, 0.0f, vcmpeqq(vecIn, 0.0f));
|
||||
vecDst = vecDst * vecIn;
|
||||
return vecDst;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // (ARM_MATH_HELIUM) || defined(ARM_MATH_MVEF) || defined(ARM_MATH_MVEI)
|
||||
|
||||
#endif // __ARM_2D_MATH_HELIUM_H__
|
||||
|
@ -1,818 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm-2d_paving.h
|
||||
* Description: Provides definitions and code templates for generic paving
|
||||
*
|
||||
* $Date: 20. Jan 2021
|
||||
* $Revision: V 0.5.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __ARM_2D_PAVING_H__
|
||||
#define __ARM_2D_PAVING_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
#include "arm_2d.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
#elif __IS_COMPILER_GCC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
#define SETUP_DIRECT_COPY_8(srcWidth) (void)srcWidth;
|
||||
#define SETUP_DIRECT_COPY_16(srcWidth) (void)srcWidth;
|
||||
#define SETUP_DIRECT_COPY_32(srcWidth) (void)srcWidth;
|
||||
|
||||
|
||||
/* scalar copy w/o mirroring */
|
||||
#define LOAD_SRC_DIRECT_8(pSource, offset) *pSource++;
|
||||
#define LOAD_SRC_DIRECT_16(pSource, offset) *pSource++;
|
||||
#define LOAD_SRC_DIRECT_32(pSource, offset) *pSource++;
|
||||
|
||||
#define LOAD_SRC_X_MIRROR_8(pSource, offset) pSource[offset]; offset -= 1;
|
||||
#define LOAD_SRC_X_MIRROR_16(pSource, offset) pSource[offset]; offset -= 1;
|
||||
#define LOAD_SRC_X_MIRROR_32(pSource, offset) pSource[offset]; offset -= 1;
|
||||
|
||||
#define SETUP_MIRROR_COPY_8(srcWidth) uint32_t offset = srcWidth - 1;
|
||||
#define SETUP_MIRROR_COPY_16(srcWidth) uint32_t offset = srcWidth - 1;
|
||||
#define SETUP_MIRROR_COPY_32(srcWidth) uint32_t offset = srcWidth - 1;
|
||||
|
||||
|
||||
#define INCR_Y_DIR 1
|
||||
#define DECR_Y_DIR -1
|
||||
#define BOTTOM_TO_TOP INCR_Y_DIR
|
||||
#define TOP_TO_BOTTOM DECR_Y_DIR
|
||||
|
||||
#ifndef PAVING_OP
|
||||
#define PAVING_OP(__DES_ADDR, __SRC) \
|
||||
do { \
|
||||
*(__DES_ADDR) = (__SRC); \
|
||||
}while(0)
|
||||
#endif
|
||||
|
||||
#define PAVING_DIRECT_START_OFFS(strd, heig) 0
|
||||
#define PAVING_DIRECT_READ_DIR BOTTOM_TO_TOP
|
||||
#define PAVING_DIRECT_SETUP_COPY(sz) ARM_CONNECT2(SETUP_DIRECT_COPY_,sz)
|
||||
#define PAVING_DIRECT_LOAD_PATTERN(sz) ARM_CONNECT2(LOAD_SRC_DIRECT_,sz)
|
||||
|
||||
#define PAVING_X_MIRROR_START_OFFS(strd, heig) PAVING_DIRECT_START_OFFS(strd, heig)
|
||||
#define PAVING_X_MIRROR_READ_DIR PAVING_DIRECT_READ_DIR
|
||||
#define PAVING_X_MIRROR_SETUP_COPY(sz) ARM_CONNECT2(SETUP_MIRROR_COPY_,sz)
|
||||
#define PAVING_X_MIRROR_LOAD_PATTERN(sz) ARM_CONNECT2(LOAD_SRC_X_MIRROR_,sz)
|
||||
|
||||
#define PAVING_Y_MIRROR_START_OFFS(strd, heig) (strd * (heig - 1))
|
||||
#define PAVING_Y_MIRROR_READ_DIR TOP_TO_BOTTOM
|
||||
#define PAVING_Y_MIRROR_SETUP_COPY(sz) PAVING_DIRECT_SETUP_COPY(sz)
|
||||
#define PAVING_Y_MIRROR_LOAD_PATTERN(sz) PAVING_DIRECT_LOAD_PATTERN(sz)
|
||||
|
||||
#define PAVING_XY_MIRROR_START_OFFS(strd, heig) PAVING_Y_MIRROR_START_OFFS(strd, heig)
|
||||
#define PAVING_XY_MIRROR_READ_DIR PAVING_Y_MIRROR_READ_DIR
|
||||
#define PAVING_XY_MIRROR_SETUP_COPY(sz) PAVING_X_MIRROR_SETUP_COPY(sz)
|
||||
#define PAVING_XY_MIRROR_LOAD_PATTERN(sz) PAVING_X_MIRROR_LOAD_PATTERN(sz)
|
||||
|
||||
|
||||
|
||||
#define __ARM_2D_MEM_FILL_GENERIC( pSourceBase, \
|
||||
iSourceStride, \
|
||||
ptSourceSize, \
|
||||
pTargetBase, \
|
||||
iTargetStride, \
|
||||
ptTargetSize, \
|
||||
pPavFct, \
|
||||
...) \
|
||||
{ \
|
||||
uint16_t targetIWidth = ptTargetSize->iWidth; \
|
||||
uint16_t sourceIWidth = ptSourceSize->iWidth; \
|
||||
uint16_t targetIHeight = ptTargetSize->iHeight; \
|
||||
uint16_t sourceIHeight = ptSourceSize->iHeight; \
|
||||
uint32_t tilePairRows = (targetIHeight / (2 * sourceIHeight)); \
|
||||
uint32_t tilePairCols = (targetIWidth / (2 * sourceIWidth)); \
|
||||
int32_t residueW = 0; \
|
||||
int32_t residueH = 0; \
|
||||
uint32_t targetOffsetRows = 0; \
|
||||
uint32_t targetOffsetCols = 0; \
|
||||
\
|
||||
\
|
||||
/* can we handle vertical pairs of image ? */ \
|
||||
if (tilePairRows >= 1) { \
|
||||
/* target row coordinate after paving */ \
|
||||
targetOffsetRows = tilePairRows * (2 * sourceIHeight); \
|
||||
residueW = targetIWidth; \
|
||||
\
|
||||
/* can we handle horizontal pairs of image ? */ \
|
||||
if (tilePairCols >= 1) { \
|
||||
/* target column coordinate after paving */ \
|
||||
targetOffsetCols = tilePairCols * (2 * sourceIWidth); \
|
||||
\
|
||||
/* run 2 x 2 image paving */ \
|
||||
/* \
|
||||
* +=======+=======+=======+=======+=======+=======++..... \
|
||||
* ||xxxxxx|xxxxxxx|| | || | || \
|
||||
* +-------+-------+-------+-------+-------+-------+-..... \
|
||||
* ||xxxxxx|xxxxxxx|| | || | || \
|
||||
* +=======+=======+=======+=======+=======+=======++..... \
|
||||
* || | || | || | || \
|
||||
* +-------+-------+-------+-------+-------+-------+-..... \
|
||||
* || | || | || | || \
|
||||
* +=======+=======+=======+=======+=======+=======++..... \
|
||||
*/ \
|
||||
pPavFct->pav_2x2(pSourceBase, iSourceStride, ptSourceSize, \
|
||||
pTargetBase, iTargetStride, \
|
||||
tilePairRows, tilePairCols \
|
||||
,##__VA_ARGS__); \
|
||||
\
|
||||
residueW = targetIWidth - targetOffsetCols; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
if (residueW > ptSourceSize->iWidth) { \
|
||||
/* run 1 x 2 image paving */ \
|
||||
/* \
|
||||
* ...+=======+=..... \
|
||||
* ...||xxxxxx|| \
|
||||
* ...+-------+-..... \
|
||||
* ...||xxxxxx|| \
|
||||
* ...+=======+=..... \
|
||||
*/ \
|
||||
pPavFct->pav_1x2( pSourceBase, \
|
||||
iSourceStride, \
|
||||
ptSourceSize, \
|
||||
pTargetBase + targetOffsetCols, \
|
||||
iTargetStride, \
|
||||
ptSourceSize->iWidth, \
|
||||
tilePairRows, ##__VA_ARGS__); \
|
||||
\
|
||||
targetOffsetCols += ptSourceSize->iWidth; \
|
||||
residueW = targetIWidth - targetOffsetCols; \
|
||||
} \
|
||||
if (residueW > 0) { \
|
||||
/* run residual 1 x 2 image paving */ \
|
||||
/* \
|
||||
* ...+===== \
|
||||
* ...||xxxx \
|
||||
* ...+----- \
|
||||
* ...||xxxx \
|
||||
* ...+===== \
|
||||
*/ \
|
||||
pPavFct->pav_1x2( pSourceBase, iSourceStride, ptSourceSize, \
|
||||
pTargetBase + targetOffsetCols, \
|
||||
iTargetStride, residueW, tilePairRows \
|
||||
, ##__VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
\
|
||||
/* less than 2 complete vertical images */ \
|
||||
targetOffsetCols = 0; \
|
||||
residueH = targetIHeight - targetOffsetRows; \
|
||||
if (residueH >= ptSourceSize->iHeight) { \
|
||||
residueW = targetIWidth; \
|
||||
\
|
||||
/* can we handle horizontal pair of image ? */ \
|
||||
if (tilePairCols >= 1) { \
|
||||
/* run 2 x 1 image paving */ \
|
||||
/* \
|
||||
* +=======+=======+=======+=======+=======+=======++..... \
|
||||
* ||xxxxxx|xxxxxxx|| | || | || \
|
||||
* +-------+-------+-------+-------+-------+-------+-..... \
|
||||
* .................................................. \
|
||||
*/ \
|
||||
pPavFct->pav_2x1( pSourceBase, \
|
||||
iSourceStride, \
|
||||
ptSourceSize, \
|
||||
pTargetBase + \
|
||||
targetOffsetRows * iTargetStride, \
|
||||
iTargetStride, \
|
||||
tilePairCols, \
|
||||
ptSourceSize->iHeight \
|
||||
, ##__VA_ARGS__); \
|
||||
\
|
||||
targetOffsetCols = tilePairCols * (2 * sourceIWidth); \
|
||||
residueW = targetIWidth - targetOffsetCols; \
|
||||
} \
|
||||
\
|
||||
if (residueW > ptSourceSize->iWidth) { \
|
||||
/* run single image paving */ \
|
||||
/* \
|
||||
* +=======+... \
|
||||
* ||xxxxx||... \
|
||||
* +-------+... \
|
||||
* ............ \
|
||||
*/ \
|
||||
pPavFct->pav_1x1(pSourceBase, \
|
||||
iSourceStride, \
|
||||
pTargetBase + targetOffsetRows * iTargetStride + \
|
||||
targetOffsetCols, \
|
||||
iTargetStride, \
|
||||
ptSourceSize, \
|
||||
ptSourceSize \
|
||||
, ##__VA_ARGS__); \
|
||||
\
|
||||
targetOffsetCols += ptSourceSize->iWidth; \
|
||||
residueW = targetIWidth - targetOffsetCols; \
|
||||
} \
|
||||
\
|
||||
if (residueW > 0) { \
|
||||
/* run residual single image paving (complete height, */ \
|
||||
/* but truncated width) */ \
|
||||
/* */ \
|
||||
/* +=====... */ \
|
||||
/* ||xxxx... */ \
|
||||
/* +-----... */ \
|
||||
/* ......... */ \
|
||||
/* */ \
|
||||
arm_2d_size_t tail; \
|
||||
tail.iWidth = residueW; \
|
||||
tail.iHeight = ptSourceSize->iHeight; \
|
||||
\
|
||||
pPavFct->pav_1x1( pSourceBase, \
|
||||
iSourceStride, \
|
||||
pTargetBase + targetOffsetRows * iTargetStride +\
|
||||
targetOffsetCols, \
|
||||
iTargetStride, \
|
||||
ptSourceSize, \
|
||||
&tail \
|
||||
, ##__VA_ARGS__); \
|
||||
\
|
||||
} \
|
||||
targetOffsetRows += ptSourceSize->iHeight; \
|
||||
} \
|
||||
\
|
||||
/* less than 1 complete vertical images */ \
|
||||
targetOffsetCols = 0; \
|
||||
residueH = ptTargetSize->iHeight - targetOffsetRows; \
|
||||
if (residueH) { \
|
||||
arm_2d_size_t tail; \
|
||||
tail.iWidth = ptSourceSize->iWidth; \
|
||||
tail.iHeight = residueH; \
|
||||
\
|
||||
if (tilePairCols >= 1) { \
|
||||
/* run vertical truncated 2 x 1 image paving */ \
|
||||
/* \
|
||||
* +=======+=======+=======+=======+=======+=======++..... \
|
||||
* ||xxxxxx|xxxxxxx|| | || | || \
|
||||
* .................................................. \
|
||||
*/ \
|
||||
pPavFct->pav_2x1( pSourceBase, \
|
||||
iSourceStride, \
|
||||
ptSourceSize, \
|
||||
pTargetBase + targetOffsetRows * iTargetStride, \
|
||||
iTargetStride, \
|
||||
tilePairCols, \
|
||||
residueH \
|
||||
, ##__VA_ARGS__); \
|
||||
\
|
||||
targetOffsetCols = tilePairCols * (2 * sourceIWidth); \
|
||||
} \
|
||||
\
|
||||
residueW = targetIWidth - targetOffsetCols; \
|
||||
if (residueW > ptSourceSize->iWidth) { \
|
||||
/* run vertical truncated single image copy */ \
|
||||
/* \
|
||||
* +=======+... \
|
||||
* ||xxxxx||... \
|
||||
* ............ \
|
||||
*/ \
|
||||
\
|
||||
pPavFct->pav_1x1( pSourceBase, \
|
||||
iSourceStride, \
|
||||
pTargetBase + targetOffsetRows * iTargetStride +\
|
||||
targetOffsetCols, \
|
||||
iTargetStride, \
|
||||
ptSourceSize, \
|
||||
&tail \
|
||||
, ##__VA_ARGS__); \
|
||||
\
|
||||
targetOffsetCols += ptSourceSize->iWidth; \
|
||||
residueW = targetIWidth - targetOffsetCols; \
|
||||
} \
|
||||
\
|
||||
if (residueW > 0) { \
|
||||
/* run horizontal & vertical truncated single image copy */ \
|
||||
/* \
|
||||
* +======.. \
|
||||
* ||xxxxx... \
|
||||
* .......... \
|
||||
*/ \
|
||||
tail.iWidth = residueW; \
|
||||
\
|
||||
pPavFct->pav_1x1( pSourceBase, \
|
||||
iSourceStride, \
|
||||
pTargetBase + targetOffsetRows * iTargetStride +\
|
||||
targetOffsetCols, \
|
||||
iTargetStride, \
|
||||
ptSourceSize, \
|
||||
&tail \
|
||||
, ##__VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define __ARM_2D_PAVING_2x2(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
uint32_t srcWidth = ptSourceSize->iWidth; \
|
||||
uint32_t srcHeight = ptSourceSize->iHeight; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pSourceBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pTargetBaseCur = pTargetBase; \
|
||||
\
|
||||
\
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
do { \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
pSourceBaseCur = (ARM_PIX_SCLTYP(sz) *)pSourceBase; \
|
||||
\
|
||||
/* single source row loop */ \
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst = pTargetBaseCur; \
|
||||
uint32_t tilePairColsCnt = tilePairCols; \
|
||||
\
|
||||
/* column loop */ \
|
||||
/* duplicate current source row into 2 x 2 destination across */ \
|
||||
/*destination columns */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* |xxxxxxx| \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* <---------------> \
|
||||
* \
|
||||
* || | || | || \
|
||||
* * +========+=======+========+=======+ \
|
||||
* | ||xxxxxxx|xxxxxxx||xxxxxxx|xxxxxxx||... \
|
||||
* | || | || | ||... \
|
||||
* | +--------+-------+--------+-------+-... \
|
||||
* | ||xxxxxxx|xxxxxxx||xxxxxxx|xxxxxxx||... \
|
||||
* | || | || | ||... \
|
||||
* * +========+=======+========+=======+ \
|
||||
* || | || | || \
|
||||
*/ \
|
||||
do { \
|
||||
int32_t dstColCnt = srcWidth; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pSource = pSourceBaseCur + SRC_OFFSET; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst00 = pDst; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst01 = pDst00 + srcWidth; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst10 = pDst + srcHeight * iTargetStride; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst11 = pDst10 + srcWidth; \
|
||||
\
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
/* duplicate current source line into 2x2 destinations tiles*/ \
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSource, offset); \
|
||||
if (true,##__VA_ARGS__) { \
|
||||
PAVING_OP(pDst00++, in); \
|
||||
PAVING_OP(pDst01++, in); \
|
||||
PAVING_OP(pDst10++, in); \
|
||||
PAVING_OP(pDst11++, in); \
|
||||
} else { \
|
||||
pDst00++;pDst01++;pDst10++;pDst11++; \
|
||||
} \
|
||||
\
|
||||
} while (--dstColCnt); \
|
||||
\
|
||||
pDst += 2 * srcWidth; \
|
||||
tilePairColsCnt--; \
|
||||
} \
|
||||
while (tilePairColsCnt != 0); \
|
||||
\
|
||||
rowCnt ++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < ptSourceSize->iHeight); \
|
||||
\
|
||||
pTargetBaseCur += srcHeight * iTargetStride; \
|
||||
tilePairRows--; \
|
||||
} \
|
||||
while (tilePairRows != 0); \
|
||||
}
|
||||
|
||||
#define __ARM_2D_PAVING_1x2(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
uint32_t srcWidth = ptSourceSize->iWidth; \
|
||||
uint32_t srcHeight = ptSourceSize->iHeight; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pSourceBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pTargetBaseCur = pTargetBase; \
|
||||
\
|
||||
\
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
do { \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
pSourceBaseCur = (ARM_PIX_SCLTYP(sz) *)pSourceBase; \
|
||||
\
|
||||
/* single source row loop */ \
|
||||
do { \
|
||||
int32_t dstColCnt = destWidth; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pSource = pSourceBaseCur + SRC_OFFSET; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst = pTargetBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst00 = pDst; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst10 = pDst + srcHeight * iTargetStride; \
|
||||
\
|
||||
/* column loop */ \
|
||||
/* duplicate current source row into 1 x 2 destination across */ \
|
||||
/* destination columns */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* |xxxxxxx| \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* ..|| || \
|
||||
* * ==+========+=... \
|
||||
* | ..||xxxxxxx||... \
|
||||
* | ..|| ||... \
|
||||
* | ..+--------+-... \
|
||||
* | ..||xxxxxxx||... \
|
||||
* | ..|| ||... \
|
||||
* * ==+========+=... \
|
||||
* ..|| ||... \
|
||||
*/ \
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
/* duplicate current source line into 2x2 destinations */ \
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSource, offset); \
|
||||
if (true,##__VA_ARGS__) { \
|
||||
PAVING_OP(pDst00++, in); \
|
||||
PAVING_OP(pDst10++, in); \
|
||||
} else { \
|
||||
pDst00 ++; \
|
||||
pDst10 ++; \
|
||||
} \
|
||||
} \
|
||||
while (--dstColCnt); \
|
||||
\
|
||||
rowCnt ++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < ptSourceSize->iHeight); \
|
||||
\
|
||||
pTargetBaseCur += srcHeight * iTargetStride; \
|
||||
tilePairRows--; \
|
||||
} \
|
||||
while (tilePairRows != 0); \
|
||||
}
|
||||
|
||||
|
||||
#define __ARM_2D_PAVING_2x1(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
uint32_t srcWidth = ptSourceSize->iWidth; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pSourceBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pTargetBaseCur = pTargetBase; \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
\
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* tilePairCols \
|
||||
* <---------------+--------........> \
|
||||
* \
|
||||
* +=======+=======++=======+=======++...... \
|
||||
* || | || | || \
|
||||
* +=======+=======++=======+=======++ \
|
||||
* ........ \
|
||||
*/ \
|
||||
\
|
||||
pSourceBaseCur = (ARM_PIX_SCLTYP(sz) *)pSourceBase; \
|
||||
\
|
||||
/* copy 2 x 2 source image block */ \
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst = pTargetBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) tilePairColsCnt = tilePairCols; \
|
||||
\
|
||||
do { \
|
||||
int srcColCnt = srcWidth; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pSource = pSourceBaseCur+SRC_OFFSET; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst00 = pDst; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst01 = pDst00 + srcColCnt; \
|
||||
\
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
/* duplicate current source line into 4 destinations */ \
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSource, offset); \
|
||||
if (true,##__VA_ARGS__) { \
|
||||
PAVING_OP(pDst00++, in); \
|
||||
PAVING_OP(pDst01++, in); \
|
||||
} else { \
|
||||
pDst00 ++; \
|
||||
pDst01 ++; \
|
||||
} \
|
||||
\
|
||||
srcColCnt -= 1; \
|
||||
} \
|
||||
while ((int32_t) srcColCnt > 0); \
|
||||
\
|
||||
pDst += 2 * srcWidth; \
|
||||
tilePairColsCnt--; \
|
||||
} \
|
||||
while (tilePairColsCnt != 0); \
|
||||
\
|
||||
rowCnt++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < destHeight); \
|
||||
}
|
||||
|
||||
|
||||
#define __ARM_2D_PAVING_1x1(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
pSource += SRC_OFFSET; \
|
||||
\
|
||||
for (int_fast16_t y = 0; y < ptDstCopySize->iHeight; y++) { \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pDst = pTarget; \
|
||||
ARM_PIX_SCLTYP(sz) *__RESTRICT pSrc = (ARM_PIX_SCLTYP(sz) *)pSource; \
|
||||
uint32_t srcWidth = ptSrcCopySize->iWidth; \
|
||||
uint32_t dstWidth = ptDstCopySize->iWidth; \
|
||||
\
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSrc, offset); \
|
||||
if (true,##__VA_ARGS__) { \
|
||||
PAVING_OP(pDst++,in); \
|
||||
} else { \
|
||||
pDst++; \
|
||||
} \
|
||||
\
|
||||
dstWidth -= 1; \
|
||||
} \
|
||||
while ((int32_t) dstWidth > 0); \
|
||||
\
|
||||
pSource += (iSourceStride * DIR); \
|
||||
pTarget += iTargetStride; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
typedef void (arm_2d_c8bit_paving_2x2) (const uint8_t *, int16_t, const arm_2d_size_t *,
|
||||
uint8_t *, int16_t, uint16_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_c8bit_paving_1x2) (const uint8_t *, int16_t, const arm_2d_size_t *,
|
||||
uint8_t *, int16_t, uint32_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_c8bit_paving_2x1) (const uint8_t *, int16_t,
|
||||
const arm_2d_size_t *, uint8_t *, int16_t, uint16_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_c8bit_paving_1x1) (const uint8_t *, int16_t, uint8_t *, int16_t,
|
||||
const arm_2d_size_t *, const arm_2d_size_t *);
|
||||
|
||||
|
||||
typedef struct arm_2d_c8bit_paving_fct_t {
|
||||
arm_2d_c8bit_paving_2x2 *pav_2x2;
|
||||
arm_2d_c8bit_paving_1x2 *pav_1x2;
|
||||
arm_2d_c8bit_paving_2x1 *pav_2x1;
|
||||
arm_2d_c8bit_paving_1x1 *pav_1x1;
|
||||
} arm_2d_c8bit_paving_fct_t;
|
||||
|
||||
|
||||
typedef void (arm_2d_rgb16_paving_2x2) (const uint16_t *, int16_t, const arm_2d_size_t *,
|
||||
uint16_t *, int16_t, uint16_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb16_paving_1x2) (const uint16_t *, int16_t, const arm_2d_size_t *,
|
||||
uint16_t *, int16_t, uint32_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb16_paving_2x1) (const uint16_t *, int16_t,
|
||||
const arm_2d_size_t *, uint16_t *, int16_t, uint16_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb16_paving_1x1) (const uint16_t *, int16_t, uint16_t *, int16_t,
|
||||
const arm_2d_size_t *, const arm_2d_size_t *);
|
||||
|
||||
|
||||
typedef struct arm_2d_rgb16_paving_fct_t {
|
||||
arm_2d_rgb16_paving_2x2 *pav_2x2;
|
||||
arm_2d_rgb16_paving_1x2 *pav_1x2;
|
||||
arm_2d_rgb16_paving_2x1 *pav_2x1;
|
||||
arm_2d_rgb16_paving_1x1 *pav_1x1;
|
||||
} arm_2d_rgb16_paving_fct_t;
|
||||
|
||||
typedef void (arm_2d_rgb32_paving_2x2) (const uint32_t *, int16_t, const arm_2d_size_t *,
|
||||
uint32_t *, int16_t, uint16_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb32_paving_1x2) (const uint32_t *, int16_t, const arm_2d_size_t *,
|
||||
uint32_t *, int16_t, uint32_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb32_paving_2x1) (const uint32_t *, int16_t,
|
||||
const arm_2d_size_t *, uint32_t *, int16_t, uint16_t, uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb32_paving_1x1) (const uint32_t *, int16_t, uint32_t *, int16_t,
|
||||
const arm_2d_size_t *, const arm_2d_size_t *);
|
||||
|
||||
|
||||
typedef struct arm_2d_rgb32_paving_fct_t {
|
||||
arm_2d_rgb32_paving_2x2 *pav_2x2;
|
||||
arm_2d_rgb32_paving_1x2 *pav_1x2;
|
||||
arm_2d_rgb32_paving_2x1 *pav_2x1;
|
||||
arm_2d_rgb32_paving_1x1 *pav_1x1;
|
||||
} arm_2d_rgb32_paving_fct_t;
|
||||
|
||||
|
||||
|
||||
typedef void (arm_2d_c8bit_cl_key_paving_2x2)( const uint8_t * __RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t * __RESTRICT,
|
||||
uint8_t * __RESTRICT,
|
||||
int16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint8_t);
|
||||
|
||||
typedef void (arm_2d_c8bit_cl_key_paving_1x2) ( const uint8_t *__RESTRICT ,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint8_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint32_t,
|
||||
uint16_t,
|
||||
uint8_t);
|
||||
|
||||
typedef void (arm_2d_c8bit_cl_key_paving_2x1) ( const uint8_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint8_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint8_t);
|
||||
|
||||
typedef void (arm_2d_c8bit_cl_key_paving_1x1) ( const uint8_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint8_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint8_t);
|
||||
|
||||
|
||||
typedef struct arm_2d_c8bit_cl_key_paving_fct_t {
|
||||
arm_2d_c8bit_cl_key_paving_2x2 *pav_2x2;
|
||||
arm_2d_c8bit_cl_key_paving_1x2 *pav_1x2;
|
||||
arm_2d_c8bit_cl_key_paving_2x1 *pav_2x1;
|
||||
arm_2d_c8bit_cl_key_paving_1x1 *pav_1x1;
|
||||
} arm_2d_c8bit_cl_key_paving_fct_t;
|
||||
|
||||
|
||||
typedef void (arm_2d_rgb16_cl_key_paving_2x2)( const uint16_t * __RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t * __RESTRICT,
|
||||
uint16_t * __RESTRICT,
|
||||
int16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb16_cl_key_paving_1x2) ( const uint16_t *__RESTRICT ,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint16_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint32_t,
|
||||
uint16_t,
|
||||
uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb16_cl_key_paving_2x1) ( const uint16_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint16_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint16_t);
|
||||
|
||||
typedef void (arm_2d_rgb16_cl_key_paving_1x1) ( const uint16_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint16_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint16_t);
|
||||
|
||||
|
||||
typedef struct arm_2d_rgb16_cl_key_paving_fct_t {
|
||||
arm_2d_rgb16_cl_key_paving_2x2 *pav_2x2;
|
||||
arm_2d_rgb16_cl_key_paving_1x2 *pav_1x2;
|
||||
arm_2d_rgb16_cl_key_paving_2x1 *pav_2x1;
|
||||
arm_2d_rgb16_cl_key_paving_1x1 *pav_1x1;
|
||||
} arm_2d_rgb16_cl_key_paving_fct_t;
|
||||
|
||||
|
||||
|
||||
typedef void (arm_2d_rgb32_cl_key_paving_2x2)( const uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint32_t);
|
||||
|
||||
typedef void (arm_2d_rgb32_cl_key_paving_1x2) ( const uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint32_t,
|
||||
uint16_t,
|
||||
uint32_t);
|
||||
|
||||
typedef void (arm_2d_rgb32_cl_key_paving_2x1) ( const uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint32_t);
|
||||
|
||||
typedef void (arm_2d_rgb32_cl_key_paving_1x1) ( const uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
uint32_t *__RESTRICT,
|
||||
int16_t,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
const arm_2d_size_t *__RESTRICT,
|
||||
uint32_t);
|
||||
|
||||
|
||||
typedef struct arm_2d_rgb32_cl_key_paving_fct_t {
|
||||
arm_2d_rgb32_cl_key_paving_2x2 *pav_2x2;
|
||||
arm_2d_rgb32_cl_key_paving_1x2 *pav_1x2;
|
||||
arm_2d_rgb32_cl_key_paving_2x1 *pav_2x1;
|
||||
arm_2d_rgb32_cl_key_paving_1x1 *pav_1x1;
|
||||
} arm_2d_rgb32_cl_key_paving_fct_t;
|
||||
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif __IS_COMPILER_GCC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,704 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm-2d_paving_helium.h
|
||||
* Description: Provides definitions and code templates for generic paving
|
||||
*
|
||||
* $Date: 17. Sep 2021
|
||||
* $Revision: V 0.6.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __ARM_2D_PAVING_HELIUM_H__
|
||||
#define __ARM_2D_PAVING_HELIUM_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d.h"
|
||||
#include "__arm_2d_paving.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
|
||||
#undef LOAD_SRC_DIRECT_16
|
||||
#undef LOAD_SRC_DIRECT_32
|
||||
#undef LOAD_SRC_X_MIRROR_16
|
||||
#undef LOAD_SRC_X_MIRROR_32
|
||||
#undef SETUP_MIRROR_COPY_16
|
||||
#undef SETUP_MIRROR_COPY_32
|
||||
#undef __ARM_2D_PAVING_2x2
|
||||
#undef __ARM_2D_PAVING_1x2
|
||||
#undef __ARM_2D_PAVING_2x1
|
||||
#undef __ARM_2D_PAVING_1x1
|
||||
|
||||
|
||||
|
||||
/* Set predicate to true if vector different than color mask */
|
||||
#define CMP_CL_MSK(sz, colour) p = vcmpneq_m(in, colour, p)
|
||||
|
||||
|
||||
#undef LOAD_SRC_DIRECT_8
|
||||
#undef LOAD_SRC_DIRECT_16
|
||||
#undef LOAD_SRC_DIRECT_32
|
||||
#undef LOAD_SRC_X_MIRROR_8
|
||||
#undef LOAD_SRC_X_MIRROR_16
|
||||
#undef LOAD_SRC_X_MIRROR_32
|
||||
#undef SETUP_MIRROR_COPY_8
|
||||
#undef SETUP_MIRROR_COPY_16
|
||||
#undef SETUP_MIRROR_COPY_32
|
||||
|
||||
|
||||
#define LOAD_SRC_DIRECT_8(pSource, offset) \
|
||||
vld1q_z(pSource, p); \
|
||||
pSource += 16;
|
||||
|
||||
#define LOAD_SRC_DIRECT_16(pSource, offset) \
|
||||
vld1q_z(pSource, p); \
|
||||
pSource += 8;
|
||||
|
||||
#define LOAD_SRC_DIRECT_32(pSource, offset) \
|
||||
vld1q_z(pSource, p); \
|
||||
pSource += 4;
|
||||
|
||||
#define LOAD_SRC_X_MIRROR_8(pSource, offset) \
|
||||
vldrbq_gather_offset_z(pSource, offset, p); \
|
||||
offset = vddupq_x_wb_u8(&curOffsetIdx, 1, p);
|
||||
|
||||
#define LOAD_SRC_X_MIRROR_16(pSource, offset) \
|
||||
vldrhq_gather_shifted_offset_z(pSource, offset, p); \
|
||||
offset = vddupq_x_wb_u16(&curOffsetIdx, 1, p);
|
||||
|
||||
#define LOAD_SRC_X_MIRROR_32(pSource, offset) \
|
||||
vldrwq_gather_shifted_offset_z(pSource, offset, p); \
|
||||
offset = vddupq_x_wb_u32(&curOffsetIdx, 1, p);
|
||||
|
||||
/* prepare Helium gather load offset */
|
||||
#define SETUP_MIRROR_COPY_8(srcWidth) \
|
||||
uint32_t curOffsetIdx = srcWidth - 1; \
|
||||
uint8x16_t offset = vddupq_wb_u8(&curOffsetIdx, 1);
|
||||
|
||||
#define SETUP_MIRROR_COPY_16(srcWidth) \
|
||||
uint32_t curOffsetIdx = srcWidth - 1; \
|
||||
uint16x8_t offset = vddupq_wb_u16(&curOffsetIdx, 1);
|
||||
|
||||
#define SETUP_MIRROR_COPY_32(srcWidth) \
|
||||
uint32_t curOffsetIdx = srcWidth - 1; \
|
||||
uint32x4_t offset = vddupq_wb_u32(&curOffsetIdx, 1);
|
||||
|
||||
|
||||
/* Macros intercepting X or XY mirroring */
|
||||
#define IS_PAVING_DIRECT_LOAD_PATTERN(sz) (0)
|
||||
#define IS_PAVING_X_MIRROR_LOAD_PATTERN(sz) ((sz == 8)? 1: 0)
|
||||
#define IS_PAVING_Y_MIRROR_LOAD_PATTERN(sz) (0)
|
||||
#define IS_PAVING_XY_MIRROR_LOAD_PATTERN(sz) ((sz == 8)? 1: 0)
|
||||
|
||||
|
||||
/* handle c8bit X or XY 2x2 mirroring when tile width > 256 */
|
||||
/* uses 8-bit widened load allowing width up to 65K */
|
||||
#define __ARM_2D_PAVING_2x2_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
do { \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
pSourceBaseCur = pSourceBase; \
|
||||
\
|
||||
/* single source row loop */ \
|
||||
do { \
|
||||
uint8_t *pDst = (uint8_t*)pTargetBaseCur; \
|
||||
uint32_t tilePairColsCnt = tilePairCols; \
|
||||
\
|
||||
/* column loop */ \
|
||||
/* duplicate current source row into 2 x 2 destination across */ \
|
||||
/*destination columns */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* |xxxxxxx| \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* <---------------> \
|
||||
* \
|
||||
* || | || | || \
|
||||
* * +========+=======+========+=======+ \
|
||||
* | ||xxxxxxx|xxxxxxx||xxxxxxx|xxxxxxx||... \
|
||||
* | || | || | ||... \
|
||||
* | +--------+-------+--------+-------+-... \
|
||||
* | ||xxxxxxx|xxxxxxx||xxxxxxx|xxxxxxx||... \
|
||||
* | || | || | ||... \
|
||||
* * +========+=======+========+=======+ \
|
||||
* || | || | || \
|
||||
*/ \
|
||||
do { \
|
||||
int32_t dstColCnt = srcWidth; \
|
||||
const uint8_t *pSource = (const uint8_t*)pSourceBaseCur \
|
||||
+ SRC_OFFSET; \
|
||||
uint8_t *pDst00 = (uint8_t*)pDst; \
|
||||
uint8_t *pDst01 = (uint8_t*)pDst00 + srcWidth; \
|
||||
uint8_t *pDst10 = (uint8_t*)pDst + srcHeight * \
|
||||
iTargetStride; \
|
||||
uint8_t *pDst11 = (uint8_t*)pDst10 + srcWidth; \
|
||||
\
|
||||
uint32_t curOffsetIdx = srcWidth - 1; \
|
||||
uint16x8_t offset = vddupq_wb_u16(&curOffsetIdx, 1); \
|
||||
\
|
||||
/* duplicate current source line into 2x2 destinations */ \
|
||||
do { \
|
||||
mve_pred16_t p = vctp16q(dstColCnt); \
|
||||
uint8x16_t in; \
|
||||
in = vldrbq_gather_offset_z_u16(pSource, offset, p); \
|
||||
offset = vddupq_x_wb_u16(&curOffsetIdx, 1, p); \
|
||||
\
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vstrbq_p_u16(pDst00, in, p); \
|
||||
vstrbq_p_u16(pDst01, in, p); \
|
||||
vstrbq_p_u16(pDst10, in, p); \
|
||||
vstrbq_p_u16(pDst11, in, p); \
|
||||
\
|
||||
pDst00 += 8; \
|
||||
pDst01 += 8; \
|
||||
pDst10 += 8; \
|
||||
pDst11 += 8; \
|
||||
dstColCnt -= 8; \
|
||||
} \
|
||||
while (dstColCnt > 0); \
|
||||
\
|
||||
pDst += 2 * srcWidth; \
|
||||
tilePairColsCnt--; \
|
||||
} \
|
||||
while (tilePairColsCnt != 0); \
|
||||
\
|
||||
rowCnt ++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < ptSourceSize->iHeight); \
|
||||
\
|
||||
pTargetBaseCur += srcHeight * iTargetStride; \
|
||||
tilePairRows--; \
|
||||
} \
|
||||
while (tilePairRows != 0); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define __ARM_2D_PAVING_2x2(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
uint32_t srcWidth = ptSourceSize->iWidth; \
|
||||
uint32_t srcHeight = ptSourceSize->iHeight; \
|
||||
const ARM_PIX_SCLTYP(sz) *pSourceBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *pTargetBaseCur = pTargetBase; \
|
||||
\
|
||||
if ((sz == 8) && (srcWidth >= 256) && IS_##LOAD) { \
|
||||
/* special case for 8-bit and X & XY mirror */ \
|
||||
/* width does not fit in 8-bit, need widening */ \
|
||||
/* will be optimized away for all other cases */ \
|
||||
/* not executed unconditionally as slower */ \
|
||||
__ARM_2D_PAVING_2x2_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, __VA_ARGS__) \
|
||||
} else \
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
do { \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
pSourceBaseCur = pSourceBase; \
|
||||
\
|
||||
/* single source row loop */ \
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) *pDst = pTargetBaseCur; \
|
||||
uint32_t tilePairColsCnt = tilePairCols; \
|
||||
\
|
||||
/* column loop */ \
|
||||
/* duplicate current source row into 2 x 2 destination across */ \
|
||||
/*destination columns */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* |xxxxxxx| \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* <---------------> \
|
||||
* \
|
||||
* || | || | || \
|
||||
* * +========+=======+========+=======+ \
|
||||
* | ||xxxxxxx|xxxxxxx||xxxxxxx|xxxxxxx||... \
|
||||
* | || | || | ||... \
|
||||
* | +--------+-------+--------+-------+-... \
|
||||
* | ||xxxxxxx|xxxxxxx||xxxxxxx|xxxxxxx||... \
|
||||
* | || | || | ||... \
|
||||
* * +========+=======+========+=======+ \
|
||||
* || | || | || \
|
||||
*/ \
|
||||
do { \
|
||||
int32_t dstColCnt = srcWidth; \
|
||||
const ARM_PIX_SCLTYP(sz) *pSource = pSourceBaseCur \
|
||||
+ SRC_OFFSET; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst00 = pDst; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst01 = pDst00 + srcWidth; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst10 = pDst + srcHeight * iTargetStride; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst11 = pDst10 + srcWidth; \
|
||||
\
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
/* duplicate current source line into 2x2 destinations */ \
|
||||
do { \
|
||||
mve_pred16_t p = \
|
||||
ARM_CONNECT2(ARM_CONNECT2(vctp, sz),q)(dstColCnt); \
|
||||
ARM_PIX_VECTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSource, offset); \
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vst1q_p(pDst00, in, p); \
|
||||
vst1q_p(pDst01, in, p); \
|
||||
vst1q_p(pDst10, in, p); \
|
||||
vst1q_p(pDst11, in, p); \
|
||||
\
|
||||
pDst00 += ARM_PIX_VECELT(sz); \
|
||||
pDst01 += ARM_PIX_VECELT(sz); \
|
||||
pDst10 += ARM_PIX_VECELT(sz); \
|
||||
pDst11 += ARM_PIX_VECELT(sz); \
|
||||
dstColCnt -= ARM_PIX_VECELT(sz); \
|
||||
} \
|
||||
while (dstColCnt > 0); \
|
||||
\
|
||||
pDst += 2 * srcWidth; \
|
||||
tilePairColsCnt--; \
|
||||
} \
|
||||
while (tilePairColsCnt != 0); \
|
||||
\
|
||||
rowCnt ++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < ptSourceSize->iHeight); \
|
||||
\
|
||||
pTargetBaseCur += srcHeight * iTargetStride; \
|
||||
tilePairRows--; \
|
||||
} \
|
||||
while (tilePairRows != 0); \
|
||||
}
|
||||
|
||||
|
||||
/* handle c8bit X or XY 1x2 mirroring when tile width > 256 */
|
||||
/* uses 8-bit widened load allowing width up to 65K */
|
||||
#define __ARM_2D_PAVING_1x2_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
do { \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
pSourceBaseCur = pSourceBase; \
|
||||
\
|
||||
/* single source row loop */ \
|
||||
do { \
|
||||
int32_t dstColCnt = destWidth; \
|
||||
const uint8_t *pSource = (const uint8_t*)pSourceBaseCur \
|
||||
+ SRC_OFFSET; \
|
||||
uint8_t *pDst = (uint8_t*)pTargetBaseCur; \
|
||||
uint8_t *pDst00 = pDst; \
|
||||
uint8_t *pDst10 = pDst + srcHeight * iTargetStride; \
|
||||
\
|
||||
/* column loop */ \
|
||||
/* duplicate current source row into 1 x 2 destination across */ \
|
||||
/* destination columns */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* |xxxxxxx| \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* ..|| || \
|
||||
* * ==+========+=... \
|
||||
* | ..||xxxxxxx||... \
|
||||
* | ..|| ||... \
|
||||
* | ..+--------+-... \
|
||||
* | ..||xxxxxxx||... \
|
||||
* | ..|| ||... \
|
||||
* * ==+========+=... \
|
||||
* ..|| ||... \
|
||||
*/ \
|
||||
uint32_t curOffsetIdx = srcWidth - 1; \
|
||||
uint16x8_t offset = vddupq_wb_u16(&curOffsetIdx, 1); \
|
||||
\
|
||||
/* duplicate current source line into 2x2 destinations */ \
|
||||
do { \
|
||||
mve_pred16_t p = vctp16q(dstColCnt); \
|
||||
uint8x16_t in; \
|
||||
in = vldrbq_gather_offset_z_u16(pSource, offset, p); \
|
||||
offset = vddupq_x_wb_u16(&curOffsetIdx, 1, p); \
|
||||
\
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vstrbq_p_u16(pDst00, in, p); \
|
||||
vstrbq_p_u16(pDst10, in, p); \
|
||||
\
|
||||
pDst00 += 8; \
|
||||
pDst10 += 8; \
|
||||
dstColCnt -= 8; \
|
||||
} \
|
||||
while (dstColCnt > 0); \
|
||||
\
|
||||
rowCnt ++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < ptSourceSize->iHeight); \
|
||||
\
|
||||
pTargetBaseCur += srcHeight * iTargetStride; \
|
||||
tilePairRows--; \
|
||||
} \
|
||||
while (tilePairRows != 0); \
|
||||
}
|
||||
|
||||
|
||||
#define __ARM_2D_PAVING_1x2(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
uint32_t srcWidth = ptSourceSize->iWidth; \
|
||||
uint32_t srcHeight = ptSourceSize->iHeight; \
|
||||
const ARM_PIX_SCLTYP(sz) *pSourceBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *pTargetBaseCur = pTargetBase; \
|
||||
\
|
||||
if ((sz == 8) && (srcWidth >= 256) && IS_##LOAD) { \
|
||||
/* special case for 8-bit and X & XY mirror */ \
|
||||
/* width does not fit in 8-bit, need widening */ \
|
||||
/* will be optimized away for all other cases */ \
|
||||
/* not executed unconditionally as slower */ \
|
||||
__ARM_2D_PAVING_1x2_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, __VA_ARGS__) \
|
||||
} else \
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
do { \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
pSourceBaseCur = pSourceBase; \
|
||||
\
|
||||
/* single source row loop */ \
|
||||
do { \
|
||||
int32_t dstColCnt = destWidth; \
|
||||
const ARM_PIX_SCLTYP(sz) *pSource = pSourceBaseCur + SRC_OFFSET; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst = pTargetBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst00 = pDst; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst10 = pDst + srcHeight * iTargetStride; \
|
||||
\
|
||||
/* column loop */ \
|
||||
/* duplicate current source row into 1 x 2 destination across */ \
|
||||
/* destination columns */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* |xxxxxxx| \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* ..|| || \
|
||||
* * ==+========+=... \
|
||||
* | ..||xxxxxxx||... \
|
||||
* | ..|| ||... \
|
||||
* | ..+--------+-... \
|
||||
* | ..||xxxxxxx||... \
|
||||
* | ..|| ||... \
|
||||
* * ==+========+=... \
|
||||
* ..|| ||... \
|
||||
*/ \
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
/* duplicate current source line into 2x2 destinations */ \
|
||||
do { \
|
||||
mve_pred16_t p = \
|
||||
ARM_CONNECT2(ARM_CONNECT2(vctp, sz),q)(dstColCnt); \
|
||||
ARM_PIX_VECTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSource, offset); \
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vst1q_p(pDst00, in, p); \
|
||||
vst1q_p(pDst10, in, p); \
|
||||
\
|
||||
pDst00 += ARM_PIX_VECELT(sz); \
|
||||
pDst10 += ARM_PIX_VECELT(sz); \
|
||||
dstColCnt -= ARM_PIX_VECELT(sz); \
|
||||
} \
|
||||
while (dstColCnt > 0); \
|
||||
\
|
||||
rowCnt ++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < ptSourceSize->iHeight); \
|
||||
\
|
||||
pTargetBaseCur += srcHeight * iTargetStride; \
|
||||
tilePairRows--; \
|
||||
} \
|
||||
while (tilePairRows != 0); \
|
||||
}
|
||||
|
||||
/* handle c8bit X or XY 2x1 mirroring when tile width > 256 */
|
||||
/* uses 8-bit widened load allowing width up to 65K */
|
||||
#define __ARM_2D_PAVING_2x1_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
\
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* tilePairCols \
|
||||
* <---------------+--------........> \
|
||||
* \
|
||||
* +=======+=======++=======+=======++...... \
|
||||
* || | || | || \
|
||||
* +=======+=======++=======+=======++ \
|
||||
* ........ \
|
||||
*/ \
|
||||
\
|
||||
pSourceBaseCur = pSourceBase; \
|
||||
\
|
||||
/* copy 2 x 2 source image block */ \
|
||||
do { \
|
||||
uint8_t *pDst = (uint8_t*)pTargetBaseCur; \
|
||||
int16_t tilePairColsCnt = tilePairCols; \
|
||||
\
|
||||
do { \
|
||||
int srcColCnt = srcWidth; \
|
||||
const uint8_t *pSource = (const uint8_t*)pSourceBaseCur \
|
||||
+ SRC_OFFSET; \
|
||||
uint8_t *pDst00 = pDst; \
|
||||
uint8_t *pDst01 = pDst00 + srcColCnt; \
|
||||
\
|
||||
uint32_t curOffsetIdx = srcWidth - 1; \
|
||||
uint16x8_t offset = vddupq_wb_u16(&curOffsetIdx, 1); \
|
||||
\
|
||||
/* duplicate current source line into 4 destinations */ \
|
||||
do { \
|
||||
mve_pred16_t p = vctp16q(srcColCnt); \
|
||||
uint8x16_t in; \
|
||||
in = vldrbq_gather_offset_z_u16(pSource, offset, p); \
|
||||
offset = vddupq_x_wb_u16(&curOffsetIdx, 1, p); \
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vstrbq_p_u16(pDst00, in, p); \
|
||||
vstrbq_p_u16(pDst01, in, p); \
|
||||
\
|
||||
pDst00 += 8; \
|
||||
pDst01 += 8; \
|
||||
srcColCnt -= 8; \
|
||||
} \
|
||||
while ((int32_t) srcColCnt > 0); \
|
||||
\
|
||||
pDst += 2 * srcWidth; \
|
||||
tilePairColsCnt--; \
|
||||
} \
|
||||
while (tilePairColsCnt != 0); \
|
||||
\
|
||||
rowCnt++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < destHeight); \
|
||||
}
|
||||
|
||||
|
||||
#define __ARM_2D_PAVING_2x1(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
uint32_t srcWidth = ptSourceSize->iWidth; \
|
||||
const ARM_PIX_SCLTYP(sz) *pSourceBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) *pTargetBaseCur = pTargetBase; \
|
||||
uint32_t rowCnt = 0; \
|
||||
\
|
||||
if ((sz == 8) && (srcWidth >= 256) && IS_##LOAD) { \
|
||||
/* special case for 8-bit and X & XY mirror */ \
|
||||
/* width does not fit in 8-bit, need widening */ \
|
||||
/* will be optimized away for all other cases */ \
|
||||
/* not executed unconditionally as slower */ \
|
||||
__ARM_2D_PAVING_2x1_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, __VA_ARGS__) \
|
||||
} else { \
|
||||
/* row iteration */ \
|
||||
/* handle pair of source image row and fill in the column direction */ \
|
||||
/* \
|
||||
* +-------+ \
|
||||
* | src | \
|
||||
* +-------+ \
|
||||
* \
|
||||
* tilePairCols \
|
||||
* <---------------+--------........> \
|
||||
* \
|
||||
* +=======+=======++=======+=======++...... \
|
||||
* || | || | || \
|
||||
* +=======+=======++=======+=======++ \
|
||||
* ........ \
|
||||
*/ \
|
||||
\
|
||||
pSourceBaseCur = pSourceBase; \
|
||||
\
|
||||
/* copy 2 x 2 source image block */ \
|
||||
do { \
|
||||
ARM_PIX_SCLTYP(sz) *pDst = pTargetBaseCur; \
|
||||
ARM_PIX_SCLTYP(sz) tilePairColsCnt = tilePairCols; \
|
||||
\
|
||||
do { \
|
||||
int srcColCnt = srcWidth; \
|
||||
const ARM_PIX_SCLTYP(sz) *pSource = pSourceBaseCur + SRC_OFFSET; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst00 = pDst; \
|
||||
ARM_PIX_SCLTYP(sz) *pDst01 = pDst00 + srcColCnt; \
|
||||
\
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
/* duplicate current source line into 4 destinations */ \
|
||||
do { \
|
||||
mve_pred16_t p = \
|
||||
ARM_CONNECT2(ARM_CONNECT2(vctp, sz),q)(srcColCnt); \
|
||||
ARM_PIX_VECTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSource, offset); \
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vst1q_p(pDst00, in, p); \
|
||||
vst1q_p(pDst01, in, p); \
|
||||
\
|
||||
pDst00 += ARM_PIX_VECELT(sz); \
|
||||
pDst01 += ARM_PIX_VECELT(sz); \
|
||||
srcColCnt -= ARM_PIX_VECELT(sz); \
|
||||
} \
|
||||
while ((int32_t) srcColCnt > 0); \
|
||||
\
|
||||
pDst += 2 * srcWidth; \
|
||||
tilePairColsCnt--; \
|
||||
} \
|
||||
while (tilePairColsCnt != 0); \
|
||||
\
|
||||
rowCnt++; \
|
||||
pTargetBaseCur += iTargetStride; \
|
||||
pSourceBaseCur += (iSourceStride * DIR); \
|
||||
} \
|
||||
while (rowCnt < destHeight); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/* handle c8bit X or XY 1x1 mirroring when tile width > 256 */
|
||||
/* uses 8-bit widened load allowing width up to 65K */
|
||||
#define __ARM_2D_PAVING_1x1_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
pSource += SRC_OFFSET; \
|
||||
\
|
||||
for (int_fast16_t y = 0; y < ptDstCopySize->iHeight; y++) { \
|
||||
uint8_t *pDst = (uint8_t *)pTarget; \
|
||||
const uint8_t *pSrc = (const uint8_t*)pSource; \
|
||||
uint32_t dstWidth = ptDstCopySize->iWidth; \
|
||||
uint32_t curOffsetIdx = srcWidth - 1; \
|
||||
uint16x8_t offset = vddupq_wb_u16(&curOffsetIdx, 1); \
|
||||
\
|
||||
do { \
|
||||
mve_pred16_t p = vctp16q(dstWidth); \
|
||||
uint8x16_t in; \
|
||||
in = vldrbq_gather_offset_z_u16(pSrc, offset, p); \
|
||||
offset = vddupq_x_wb_u16(&curOffsetIdx, 1, p); \
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vstrbq_p_u16(pDst, in, p); \
|
||||
\
|
||||
pDst += 8; \
|
||||
dstWidth -= 8; \
|
||||
} \
|
||||
while ((int32_t) dstWidth > 0); \
|
||||
\
|
||||
pSource += (iSourceStride * DIR); \
|
||||
pTarget += iTargetStride; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define __ARM_2D_PAVING_1x1(sz, SRC_OFFSET, DIR, SETUP_MIRROR, LOAD, ...) \
|
||||
{ \
|
||||
uint32_t srcWidth = ptSrcCopySize->iWidth; \
|
||||
if ((sz == 8) && (srcWidth >= 256) && IS_##LOAD) { \
|
||||
/* special case for 8-bit and X & XY mirror */ \
|
||||
/* width does not fit in 8-bit, need widening */ \
|
||||
/* will be optimized away for all other cases */ \
|
||||
/* not executed unconditionally as slower */ \
|
||||
__ARM_2D_PAVING_1x1_8BIT_X_MIRROR_FIXUP(SRC_OFFSET, DIR, \
|
||||
SETUP_MIRROR, LOAD, __VA_ARGS__) \
|
||||
} else { \
|
||||
pSource += SRC_OFFSET; \
|
||||
\
|
||||
for (int_fast16_t y = 0; y < ptDstCopySize->iHeight; y++) { \
|
||||
ARM_PIX_SCLTYP(sz) *pDst = pTarget; \
|
||||
ARM_PIX_SCLTYP(sz) *pSrc = pSource; \
|
||||
uint32_t dstWidth = ptDstCopySize->iWidth; \
|
||||
\
|
||||
SETUP_MIRROR(srcWidth); \
|
||||
\
|
||||
do { \
|
||||
mve_pred16_t p = \
|
||||
ARM_CONNECT2(ARM_CONNECT2(vctp, sz), q) (dstWidth); \
|
||||
ARM_PIX_VECTYP(sz) in; \
|
||||
\
|
||||
in = LOAD(pSrc, offset); \
|
||||
/* placeholder for color masking */ \
|
||||
__VA_ARGS__; \
|
||||
\
|
||||
vst1q_p(pDst, in, p); \
|
||||
\
|
||||
pDst += ARM_PIX_VECELT(sz); \
|
||||
dstWidth -= ARM_PIX_VECELT(sz); \
|
||||
} \
|
||||
while ((int32_t) dstWidth > 0); \
|
||||
\
|
||||
pSource += (iSourceStride * DIR); \
|
||||
pTarget += iTargetStride; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,300 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm-2d_utils_helium.h
|
||||
* Description: Provides helium utility routines
|
||||
*
|
||||
* $Date: 20. May 2022
|
||||
* $Revision: V 0.0.2
|
||||
*
|
||||
* Target Processor: Cortex-M cores with Helium
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
#ifndef __ARM_2D_UTILS_HELIUM_H__
|
||||
#define __ARM_2D_UTILS_HELIUM_H__
|
||||
|
||||
|
||||
#if __ARM_2D_HAS_HELIUM_INTEGER__ == 1
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d.h"
|
||||
#include <arm_math.h>
|
||||
|
||||
#if defined(__ARM_2D_HAS_CDE__) && __ARM_2D_HAS_CDE__
|
||||
#include "__arm_2d_cde.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
|
||||
#if defined(__MVE_DEBUG__) && __MVE_DEBUG__
|
||||
# define ____MVE_WRAPPER(__FUNC) __FUNC##_mve
|
||||
#else
|
||||
# define ____MVE_WRAPPER(__FUNC) __FUNC
|
||||
#endif
|
||||
|
||||
#define __MVE_WRAPPER(__FUNC) ____MVE_WRAPPER(__FUNC)
|
||||
|
||||
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
/* set vecAlpha value to 0 when equal to the compensated value */
|
||||
/* (=1 or 2 when involving 2 alpha = 255 multiplications) */
|
||||
|
||||
/* 16-bit vector */
|
||||
#define ALPHA_255_COMP_VEC16(vecAlpha, compVal) vecAlpha = \
|
||||
vpselq(vdupq_n_u16(256), vecAlpha, vcmpeqq_n_u16(vecAlpha, compVal))
|
||||
|
||||
/* 32-bit vector */
|
||||
#define ALPHA_255_COMP_VEC32(vecAlpha, compVal) vecAlpha = \
|
||||
vpselq(vdupq_n_u32(256), vecAlpha, vcmpeqq_n_u32(vecAlpha, compVal))
|
||||
|
||||
#else
|
||||
#define ALPHA_255_COMP_VEC16(vecAlpha, compVal)
|
||||
#define ALPHA_255_COMP_VEC32(vecAlpha, compVal)
|
||||
#endif
|
||||
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
void __arm_2d_rgb565_unpack_single_vec(uint16x8_t in,
|
||||
uint16x8_t * R, uint16x8_t * G, uint16x8_t * B)
|
||||
{
|
||||
uint16x8_t vecMaskR = vdupq_n_u16(0x001f);
|
||||
uint16x8_t vecMaskG = vdupq_n_u16(0x003f);
|
||||
|
||||
*R = (in & vecMaskR) * 8;
|
||||
*B = ((in >> 11)) * 8;
|
||||
*G = ((in >> 5) & vecMaskG) * 4;
|
||||
}
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
uint16x8_t __arm_2d_rgb565_pack_single_vec(uint16x8_t R, uint16x8_t G, uint16x8_t B)
|
||||
{
|
||||
uint16x8_t vecMaskBpck = vdupq_n_u16(0x00f8);
|
||||
uint16x8_t vecMaskGpck = vdupq_n_u16(0x00fc);
|
||||
|
||||
uint16x8_t vOut = vorrq(vshrq(R, 3),
|
||||
vmulq(vandq(G, vecMaskGpck), 8));
|
||||
|
||||
vOut = vorrq(vOut, vmulq(vandq(B, vecMaskBpck), 256));
|
||||
|
||||
return vOut;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__ARM_2D_HAS_CDE__) || __ARM_2D_HAS_CDE__ == 0
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
uint16x8_t __arm_2d_rgb565_blending_scal_opacity_single_vec(
|
||||
uint16x8_t Source1,
|
||||
uint16x8_t Source2,
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
/* scalar ratio allows extra optimization */
|
||||
uint16_t ratio1x8 = (256 - hwRatio) * 8;
|
||||
uint16_t ratio1x4 = (256 - hwRatio) * 4;
|
||||
uint16_t ratio2x8 = (hwRatio) * 8;
|
||||
uint16_t ratio2x4 = (hwRatio) * 4;
|
||||
uint16x8_t vecMaskR = vdupq_n_u16(0x001f);
|
||||
uint16x8_t vecMaskG = vdupq_n_u16(0x003f);
|
||||
uint16x8_t vecMaskBpck = vdupq_n_u16(0x00f8);
|
||||
uint16x8_t vecMaskGpck = vdupq_n_u16(0x00fc);
|
||||
uint16x8_t vecR0, vecB0, vecG0;
|
||||
uint16x8_t vecR1, vecB1, vecG1;
|
||||
|
||||
/* unpack 1st stream */
|
||||
vecR0 = Source1 & vecMaskR;
|
||||
vecB0 = Source1 >> 11;
|
||||
vecG0 = Source1 >> 5;
|
||||
vecG0 = vecG0 & vecMaskG;
|
||||
|
||||
|
||||
/* unpack 2nd stream */
|
||||
vecR1 = Source2 & vecMaskR;
|
||||
vecB1 = Source2 >> 11;
|
||||
vecG1 = Source2 >> 5;
|
||||
vecG1 = vecG1 & vecMaskG;
|
||||
|
||||
|
||||
/* merge */
|
||||
vecR0 = vecR0 * ratio1x8 + vecR1 * ratio2x8;
|
||||
vecR0 = vecR0 >> 8;
|
||||
|
||||
vecG0 = vecG0 * ratio1x4 + vecG1 * ratio2x4;
|
||||
vecG0 = vecG0 >> 8;
|
||||
|
||||
vecB0 = vecB0 * ratio1x8 + vecB1 * ratio2x8;
|
||||
vecB0 = vecB0 >> 8;
|
||||
|
||||
|
||||
/* pack */
|
||||
return vecR0 >> 3 | vmulq((vecG0 & vecMaskGpck), 8)
|
||||
| vmulq((vecB0 & vecMaskBpck), 256);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
uint16x8_t __arm_2d_rgb565_blending_opacity_single_vec(
|
||||
uint16x8_t Source1,
|
||||
uint16x8_t Source2,
|
||||
uint16x8_t vecHwOpacity)
|
||||
{
|
||||
uint16x8_t vecAlpha = vsubq(vdupq_n_u16(256), vecHwOpacity);
|
||||
uint16x8_t vecR, vecG, vecB;
|
||||
uint16x8_t vecSrcR, vecSrcG, vecSrcB;
|
||||
|
||||
/* unpack sources */
|
||||
__arm_2d_rgb565_unpack_single_vec(Source1, &vecR, &vecG, &vecB);
|
||||
__arm_2d_rgb565_unpack_single_vec(Source2, &vecSrcR, &vecSrcG, &vecSrcB);
|
||||
|
||||
/* merge */
|
||||
vecR = vecR * vecHwOpacity + vecSrcR * vecAlpha;
|
||||
vecR = vecR >> 8;
|
||||
|
||||
vecG = vecG * vecHwOpacity + vecSrcG * vecAlpha;
|
||||
vecG = vecG >> 8;
|
||||
|
||||
vecB = vecB * vecHwOpacity + vecSrcB * vecAlpha;
|
||||
vecB = vecB >> 8;
|
||||
|
||||
/* pack */
|
||||
return __arm_2d_rgb565_pack_single_vec(vecR, vecG, vecB);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
uint16x8_t __arm_2d_gray8_blending_opacity_single_vec(
|
||||
uint16x8_t Source1,
|
||||
uint16x8_t Source2,
|
||||
uint16x8_t vecHwOpacity)
|
||||
{
|
||||
uint16x8_t vecAlpha = vsubq(vdupq_n_u16(256), vecHwOpacity);
|
||||
|
||||
return vaddq(
|
||||
vmulq(Source1, vecHwOpacity),
|
||||
vmulq(Source2, vecAlpha)) >> 8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
uint32x4_t __arm_2d_cccn888_blending_opacity_single_vec_alt(
|
||||
uint32x4_t Source1,
|
||||
uint32x4_t Source2,
|
||||
uint32x4_t vecHwOpacity)
|
||||
{
|
||||
uint32x4_t vecAlpha = vsubq(vdupq_n_u32(256), vecHwOpacity);
|
||||
uint32x4_t acc;
|
||||
|
||||
acc = ((Source1 & 0xff) * vecHwOpacity + (Source2 & 0xff) * vecAlpha) >> 8;
|
||||
acc |=
|
||||
((((Source1 >> 8) & 0xff) * vecHwOpacity +
|
||||
((Source2 >> 8) & 0xff) * vecAlpha) >> 8) << 8;
|
||||
acc |=
|
||||
((((Source1 >> 16) & 0xff) * vecHwOpacity +
|
||||
((Source2 >> 16) & 0xff) * vecAlpha) >> 8) << 16;
|
||||
/* preserve Source1 alpha */
|
||||
acc |= Source1 & 0xff000000;
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
uint32x4_t __arm_2d_cccn888_blending_opacity_single_vec(
|
||||
uint32x4_t Source1,
|
||||
uint32x4_t Source2,
|
||||
uint32x4_t vecHwOpacity)
|
||||
{
|
||||
uint32x4_t vecAlpha = vsubq(vdupq_n_u32(256), vecHwOpacity);
|
||||
|
||||
/* expand opacity / alpha from byte to packed 32-bit*/
|
||||
/* {0x000000a0 0x000000a1 0x000000a2 0x000000a3}
|
||||
=> {0x00a0a0a0 0x00a1a1a1 0x00a2a2a2 0x00a3a3a3}
|
||||
*/
|
||||
uint32x4_t vecAlphaExp = (vecAlpha & 0xff) * 0x00010101;
|
||||
uint32x4_t vecHwOpacityExp = (vecHwOpacity & 0xff) * 0x00010101;
|
||||
|
||||
|
||||
uint32x4_t blendB = vaddq_u16(vmullbq_int_u8((uint8x16_t) Source1,
|
||||
(uint8x16_t) vecHwOpacityExp),
|
||||
vmullbq_int_u8((uint8x16_t) Source2,
|
||||
(uint8x16_t) vecAlphaExp));
|
||||
uint32x4_t blendT = vaddq_u16(vmulltq_int_u8((uint8x16_t) Source1,
|
||||
(uint8x16_t) vecHwOpacityExp),
|
||||
vmulltq_int_u8((uint8x16_t) Source2,
|
||||
(uint8x16_t) vecAlphaExp));
|
||||
|
||||
int8x16_t target = vshrnbq_n_s16(vuninitializedq_u8(), blendB, 8);
|
||||
target = vshrntq_n_s16(target, blendT, 8);
|
||||
|
||||
target = vpselq_u32(Source1, target, vcmpeqq_n_u32(vecHwOpacity, 0x100));
|
||||
target = vpselq_u32(Source2, target, vcmpeqq_n_u32(vecHwOpacity, 0));
|
||||
|
||||
/* preserve Source1 alpha */
|
||||
target = (int8x16_t) ((Source1 & 0xff000000) | ((uint32x4_t) target & 0x00ffffff));
|
||||
return target;
|
||||
}
|
||||
|
||||
__STATIC_FORCEINLINE
|
||||
uint16x8_t __rgb888_alpha_blending_direct_single_vec(
|
||||
uint16x8_t wSource1, /* widened input bytes */
|
||||
uint16x8_t wSource2, /* widened input bytes */
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
uint16_t transp = 256 - (uint16_t) hwRatio;
|
||||
uint16x8_t vecOut;
|
||||
|
||||
vecOut = vmulq_n_u16(wSource1, (uint16_t) hwRatio);
|
||||
vecOut = vmlaq_n_u16(vecOut, wSource2, transp);
|
||||
|
||||
/* widened output */
|
||||
return vecOut >> 8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // (ARM_MATH_HELIUM) || defined(ARM_MATH_MVEF) || defined(ARM_MATH_MVEI)
|
||||
|
||||
#endif // __ARM_2D_UTILS_HELIUM_H__
|
||||
|
@ -1,214 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d.h"
|
||||
* Description: Public header file to contain the all avaialble Arm-2D
|
||||
* interface header files
|
||||
*
|
||||
* $Date: 05. Sept 2022
|
||||
* $Revision: V.1.0.7
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_H__
|
||||
#define __ARM_2D_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d_types.h"
|
||||
#include "arm_2d_op.h"
|
||||
#include "arm_2d_tile.h"
|
||||
#include "arm_2d_draw.h"
|
||||
#include "arm_2d_conversion.h"
|
||||
#include "arm_2d_alpha_blending.h"
|
||||
#include "arm_2d_transform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* suppress some warnings for user applications when using arm-2d.
|
||||
*/
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
#elif defined(__IS_COMPILER_ARM_COMPILER_5__)
|
||||
# pragma diag_suppress 1296,174
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \addtogroup gKernel 1 Kernel
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
/* arm-2d version */
|
||||
#define ARM_2D_VERSION_MAJOR 1 //!< Major version
|
||||
#define ARM_2D_VERSION_MINOR 1 //!< Minor version
|
||||
#define ARM_2D_VERSION_PATCH 0 //!< Patch number
|
||||
#define ARM_2D_VERSION_STR "preview1" //!< tag
|
||||
|
||||
/*!
|
||||
* \brief arm-2d version number in decimal
|
||||
*
|
||||
*/
|
||||
#define ARM_2D_VERISON ( ARM_2D_VERSION_MAJOR * 10000ul \
|
||||
+ ARM_2D_VERSION_MINOR * 100ul \
|
||||
ARM_2D_VERSION_PATCH)
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
/*!
|
||||
* \brief a type for arm-2d runtime configuration
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
/*! if the target region is out of the target tile, return arm_fsm_rt_cpl */
|
||||
uint8_t TREAT_OUT_OF_RANGE_AS_COMPLETE : 1;
|
||||
|
||||
/*! indicate that there is a dedicated thread to run arm_2d_task() in RTOS env */
|
||||
uint8_t HAS_DEDICATED_THREAD_FOR_2D_TASK : 1;
|
||||
uint8_t : 6;
|
||||
} arm_2d_runtime_feature_t;
|
||||
|
||||
/*!
|
||||
* \brief a type for arm-2d version
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t Major; //!< major version
|
||||
uint8_t Minor; //!< minor version
|
||||
uint8_t Patch; //!< patch number
|
||||
uint8_t : 8;
|
||||
} arm_2d_version_t;
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
|
||||
/*!
|
||||
* \brief arm-2d runtime feature configuration
|
||||
*
|
||||
*/
|
||||
extern
|
||||
arm_2d_runtime_feature_t ARM_2D_RUNTIME_FEATURE;
|
||||
|
||||
/*!
|
||||
* \brief arm-2d version
|
||||
*
|
||||
*/
|
||||
extern
|
||||
const arm_2d_version_t ARM_2D_VERSION;
|
||||
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*!
|
||||
* \brief initialise arm-2d
|
||||
*/
|
||||
extern
|
||||
void arm_2d_init(void);
|
||||
|
||||
/*!
|
||||
* \brief set the default frame buffer
|
||||
* \param ptFrameBuffer the new frame buffer,
|
||||
* \note Passing NULL means using no default framebuffer
|
||||
* \return arm_2d_tile_t* the address of the old frame buffer
|
||||
*/
|
||||
extern
|
||||
arm_2d_tile_t *arm_2d_set_default_frame_buffer(
|
||||
const arm_2d_tile_t *ptFrameBuffer);
|
||||
|
||||
/*!
|
||||
* \brief get the default frame buffer
|
||||
* \return arm_2d_tile_t* the address of the default frame buffer
|
||||
*/
|
||||
extern
|
||||
arm_2d_tile_t *arm_2d_get_default_frame_buffer(void);
|
||||
|
||||
/*!
|
||||
* \brief attach a user param (which could be a pointer) to specified OP
|
||||
*
|
||||
* \param ptOP the address of the target OP (NULL means using the default OP)
|
||||
*
|
||||
* \param pUserParam a user parameter (it can be used as a pointer)
|
||||
*/
|
||||
extern
|
||||
void arm_2d_set_user_param(arm_2d_op_core_t *ptOP, uintptr_t pUserParam);
|
||||
|
||||
/*!
|
||||
* \brief wait asynchronous operation complete
|
||||
* \param[in] ptOP the address of the target OP (NULL means using the default OP)
|
||||
* \retval true sync up with operation
|
||||
* \retval false operation is busy
|
||||
*/
|
||||
extern
|
||||
bool arm_2d_op_wait_async(arm_2d_op_core_t *ptOP);
|
||||
|
||||
/*!
|
||||
\brief get the status of a specified OP,
|
||||
\details usually, it is used after calling arm_2d_op_wait_async().
|
||||
E.g.
|
||||
\code
|
||||
//! wait for previous operation complete
|
||||
do {
|
||||
arm_2d_op_wait_async();
|
||||
arm_2d_op_status_t tStatus = arm_2d_get_op_status();
|
||||
if (tStatus.bIOError) {
|
||||
//! error detected
|
||||
...
|
||||
} else if (tStatus.bOpCpl) {
|
||||
break;
|
||||
}
|
||||
} while(true);
|
||||
\endcode
|
||||
\param ptOP the address of the target OP (NULL means using the default OP)
|
||||
\return arm_2d_op_status_t the operation status
|
||||
*/
|
||||
extern
|
||||
arm_2d_op_status_t arm_2d_get_op_status(arm_2d_op_core_t *ptOP);
|
||||
|
||||
/*!
|
||||
* \brief arm-2d pixel pipeline task entery
|
||||
* \note This function is *TRHEAD-SAFE*
|
||||
* \param ptTask the address of an arm-2d task control block
|
||||
* \retval arm_fsm_rt_cpl The sub-task FIFO is empty, the caller can wait for a
|
||||
* semaphore set by arm_2d_notif_sub_task_fifo_task_arrive()
|
||||
* \retval arm_fsm_rt_on_going The arm_2d_task yields
|
||||
* \retval arm_fsm_rt_async You shouldn't see this value
|
||||
* \retval arm_fsm_rt_wait_for_obj hardware accelerator wants to sync-up with applications.
|
||||
* \retval (<0) Serious error is detected.
|
||||
*/
|
||||
extern
|
||||
arm_fsm_rt_t arm_2d_task(arm_2d_task_t *ptTask);
|
||||
|
||||
/*! @} */
|
||||
|
||||
/*! \note delibrately comment out */
|
||||
//#if defined(__clang__)
|
||||
//# pragma clang diagnostic pop
|
||||
//#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,213 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d.h"
|
||||
* Description: Public header file to contain the APIs for colour space
|
||||
* conversions
|
||||
*
|
||||
* $Date: 09. Aug 2022
|
||||
* $Revision: V.1.0.3
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_CONVERSION_H__
|
||||
#define __ARM_2D_CONVERSION_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
#include "arm_2d_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
# pragma clang diagnostic ignored "-Wnarrowing"
|
||||
#elif defined(__IS_COMPILER_IAR__)
|
||||
# pragma diag_suppress=Go029
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \addtogroup gConversion 6 Conversion Operations
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
#define arm_2d_convert_colour_to_rgb888(__SRC_ADDR, /* source tile address */ \
|
||||
__DES_ADDR /* target tile address */) \
|
||||
arm_2dp_convert_colour_to_rgb888( NULL, \
|
||||
(__SRC_ADDR), \
|
||||
(__DES_ADDR))
|
||||
|
||||
#define arm_2d_convert_colour_to_rgb565(__SRC_ADDR, /* source tile address */ \
|
||||
__DES_ADDR /* target tile address */) \
|
||||
arm_2dp_convert_colour_to_rgb565( NULL, \
|
||||
(__SRC_ADDR), \
|
||||
(__DES_ADDR))
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
typedef arm_2d_op_src_t arm_2d_op_cl_convt_t;
|
||||
|
||||
/*! \brief 3x16-bit packed RGB color
|
||||
* autovectorizer friendly format
|
||||
*/
|
||||
typedef union {
|
||||
uint16_t BGRA[4];
|
||||
struct {
|
||||
uint16_t B;
|
||||
uint16_t G;
|
||||
uint16_t R;
|
||||
uint16_t A;
|
||||
};
|
||||
} __arm_2d_color_fast_rgb_t;
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* RGB565 channels extraction/packing *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief unpack a rgb565 colour into a given __arm_2d_color_fast_rgb_t object
|
||||
* \param[in] hwColour the target rgb565 colour
|
||||
* \param[out] ptRGB a __arm_2d_color_fast_rgb_t object
|
||||
*/
|
||||
ARM_NONNULL(2)
|
||||
__STATIC_INLINE void __arm_2d_rgb565_unpack(uint16_t hwColor,
|
||||
__arm_2d_color_fast_rgb_t * ptRGB)
|
||||
{
|
||||
assert(NULL != ptRGB);
|
||||
|
||||
/* uses explicit extraction, leading to a more efficient autovectorized code */
|
||||
uint16_t maskRunpk = 0x001f, maskGunpk = 0x003f;
|
||||
|
||||
ptRGB->B = (uint16_t) ((hwColor & maskRunpk) << 3);
|
||||
ptRGB->R = (uint16_t) ((hwColor >> 11) << 3);
|
||||
ptRGB->G = (uint16_t) (((hwColor >> 5) & maskGunpk) << 2);
|
||||
|
||||
ptRGB->A = 0xFF;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief generate a rgb565 colour from a __arm_2d_color_fast_rgb_t object
|
||||
* \param[in] ptRGB the target __arm_2d_color_fast_rgb_t object
|
||||
* \return uint16_t a rgb565 colour
|
||||
*/
|
||||
ARM_NONNULL(1)
|
||||
__STATIC_INLINE uint16_t __arm_2d_rgb565_pack(__arm_2d_color_fast_rgb_t * ptRGB)
|
||||
{
|
||||
assert(NULL != ptRGB);
|
||||
|
||||
arm_2d_color_rgb565_t tOutput = {
|
||||
.u5R = (uint16_t) ptRGB->R >> 3,
|
||||
.u6G = (uint16_t) ptRGB->G >> 2,
|
||||
.u5B = (uint16_t) ptRGB->B >> 3,
|
||||
};
|
||||
return tOutput.tValue;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief generate a cccn888 colour from a __arm_2d_color_fast_rgb_t object
|
||||
* \param[in] ptRGB the target __arm_2d_color_fast_rgb_t object
|
||||
* \return uint32_t a cccn888 colour
|
||||
* \note the alpha channel will be kept in the output value
|
||||
*/
|
||||
ARM_NONNULL(1)
|
||||
__STATIC_INLINE uint32_t __arm_2d_cccn888_pack(__arm_2d_color_fast_rgb_t * ptRGB)
|
||||
{
|
||||
assert(NULL != ptRGB);
|
||||
|
||||
arm_2d_color_bgra8888_t tOutput = {
|
||||
.u8R = (uint16_t) ptRGB->R,
|
||||
.u8G = (uint16_t) ptRGB->G,
|
||||
.u8B = (uint16_t) ptRGB->B,
|
||||
.u8A = (uint16_t) ptRGB->A,
|
||||
};
|
||||
return tOutput.tValue;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Colour Conversion *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief convert the colour format of a given tile to gray8
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptSource the source tile
|
||||
* \param[out] ptTarget the output tile (holding a buffer)
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_convert_colour_to_gray8( arm_2d_op_cl_convt_t *ptOP,
|
||||
const arm_2d_tile_t *ptSource,
|
||||
const arm_2d_tile_t *ptTarget);
|
||||
|
||||
/*!
|
||||
* \brief convert the colour format of a given tile to rgb888
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptSource the source tile
|
||||
* \param[out] ptTarget the output tile (holding a buffer)
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_convert_colour_to_rgb888( arm_2d_op_cl_convt_t *ptOP,
|
||||
const arm_2d_tile_t *ptSource,
|
||||
const arm_2d_tile_t *ptTarget);
|
||||
/*!
|
||||
* \brief convert the colour format of a given tile to rgb565
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptSource the source tile
|
||||
* \param[out] ptTarget the output tile (holding a buffer)
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_convert_colour_to_rgb565( arm_2d_op_cl_convt_t *ptOP,
|
||||
const arm_2d_tile_t *ptSource,
|
||||
const arm_2d_tile_t *ptTarget);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif defined(__IS_COMPILER_IAR__)
|
||||
# pragma diag_warning=Go029
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,501 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d.h"
|
||||
* Description: Public header file to contain the APIs for colour space
|
||||
* conversions
|
||||
*
|
||||
* $Date: 17. June 2022
|
||||
* $Revision: V.1.0.2
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_DRAW_H__
|
||||
#define __ARM_2D_DRAW_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
#include "arm_2d_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \addtogroup Drawing 3 Drawing Operations
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
|
||||
#define arm_2d_c8bit_draw_point(__TARGET_ADDR, /* target tile address */ \
|
||||
__LOCATION, /* point coordinate */ \
|
||||
__COLOUR) /* target colour */ \
|
||||
arm_2dp_c8bit_draw_point(NULL, \
|
||||
(__TARGET_ADDR), \
|
||||
(__LOCATION), \
|
||||
(__COLOUR))
|
||||
|
||||
#define arm_2d_rgb16_draw_point(__TARGET_ADDR, /* target tile address */ \
|
||||
__LOCATION, /* point coordinate */ \
|
||||
__COLOUR) /* target colour */ \
|
||||
arm_2dp_rgb16_draw_point(NULL, \
|
||||
(__TARGET_ADDR), \
|
||||
(__LOCATION), \
|
||||
(__COLOUR))
|
||||
|
||||
#define arm_2d_rgb32_draw_point(__TARGET_ADDR, /* target tile address */ \
|
||||
__LOCATION, /* point coordinate */ \
|
||||
__COLOUR) /* target colour */ \
|
||||
arm_2dp_rgb32_draw_point(NULL, \
|
||||
(__TARGET_ADDR), \
|
||||
(__LOCATION), \
|
||||
(__COLOUR))
|
||||
|
||||
|
||||
#define arm_2d_c8bit_draw_pattern( __PATTERN_ADDR, /* pattern tile address */ \
|
||||
__TARGET_ADDR, /* target tile address*/ \
|
||||
__REGION_ADDR, /* target region address*/ \
|
||||
__MODE, /* draw mode */ \
|
||||
__FG_COLOUR, /* foreground colour */ \
|
||||
__BG_COLOUR) /* background colour */ \
|
||||
arm_2dp_c8bit_draw_pattern(NULL, \
|
||||
(__PATTERN_ADDR), \
|
||||
(__TARGET_ADDR), \
|
||||
(__REGION_ADDR), \
|
||||
(__MODE), \
|
||||
(__FG_COLOUR), \
|
||||
(__BG_COLOUR))
|
||||
|
||||
#define arm_2d_rgb16_draw_pattern( __PATTERN_ADDR, /* pattern tile address */ \
|
||||
__TARGET_ADDR, /* target tile address*/ \
|
||||
__REGION_ADDR, /* target region address*/ \
|
||||
__MODE, /* draw mode */ \
|
||||
__FG_COLOUR, /* foreground colour */ \
|
||||
__BG_COLOUR) /* background colour */ \
|
||||
arm_2dp_rgb16_draw_pattern(NULL, \
|
||||
(__PATTERN_ADDR), \
|
||||
(__TARGET_ADDR), \
|
||||
(__REGION_ADDR), \
|
||||
(__MODE), \
|
||||
(__FG_COLOUR), \
|
||||
(__BG_COLOUR))
|
||||
|
||||
#define arm_2d_rgb32_draw_pattern( __PATTERN_ADDR, /* pattern tile address */ \
|
||||
__TARGET_ADDR, /* target tile address*/ \
|
||||
__REGION_ADDR, /* target region address*/ \
|
||||
__MODE, /* draw mode */ \
|
||||
__FG_COLOUR, /* foreground colour */ \
|
||||
__BG_COLOUR) /* background colour */ \
|
||||
arm_2dp_rgb32_draw_pattern(NULL, \
|
||||
(__PATTERN_ADDR), \
|
||||
(__TARGET_ADDR), \
|
||||
(__REGION_ADDR), \
|
||||
(__MODE), \
|
||||
(__FG_COLOUR), \
|
||||
(__BG_COLOUR))
|
||||
|
||||
#define arm_2d_c8bit_fill_colour( __TARGET_ADDR, /* target tile address*/ \
|
||||
__REGION_ADDR, /* target region address*/ \
|
||||
__COLOUR) /* colour */ \
|
||||
arm_2dp_c8bit_fill_colour(NULL, \
|
||||
(__TARGET_ADDR), \
|
||||
(__REGION_ADDR), \
|
||||
(__COLOUR))
|
||||
|
||||
#define arm_2d_rgb16_fill_colour( __TARGET_ADDR, /* target tile address*/ \
|
||||
__REGION_ADDR, /* target region address*/ \
|
||||
__COLOUR) /* colour */ \
|
||||
arm_2dp_rgb16_fill_colour(NULL, \
|
||||
(__TARGET_ADDR), \
|
||||
(__REGION_ADDR), \
|
||||
(__COLOUR))
|
||||
|
||||
#define arm_2d_rgb32_fill_colour( __TARGET_ADDR, /* target tile address*/ \
|
||||
__REGION_ADDR, /* target region address*/ \
|
||||
__COLOUR) /* colour */ \
|
||||
arm_2dp_rgb32_fill_colour(NULL, \
|
||||
(__TARGET_ADDR), \
|
||||
(__REGION_ADDR), \
|
||||
(__COLOUR))
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
/*!
|
||||
* \brief the control block for colour-filling-operations
|
||||
* \note arm_2d_op_fill_cl_t inherits from arm_2d_op_t explicitly
|
||||
*/
|
||||
typedef struct arm_2d_op_fill_cl_t {
|
||||
inherit(arm_2d_op_core_t); //!< base
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
union {
|
||||
uint8_t chColour; //!< 8bit colour
|
||||
uint16_t hwColour; //!< 16bit colour
|
||||
uint32_t wColour; //!< 32bit colour
|
||||
};
|
||||
} arm_2d_op_fill_cl_t;
|
||||
|
||||
/*! \note arm_2d_op_fill_cl_t inherits from arm_2d_op_t explicitly
|
||||
*/
|
||||
typedef arm_2d_op_fill_cl_t arm_2d_op_drw_pt_t;
|
||||
|
||||
/*!
|
||||
* \brief the control block for draw-bit-pattern operations
|
||||
* \note arm_2d_op_drw_patn_t inherits from arm_2d_op_src_t explicitly
|
||||
*/
|
||||
typedef struct arm_2d_op_drw_patn_t {
|
||||
inherit(arm_2d_op_core_t); //!< base
|
||||
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< source tile
|
||||
}Source;
|
||||
uint32_t wMode; //!< mode of the operation
|
||||
union {
|
||||
uint8_t chColour; //!< 8bit colour
|
||||
uint16_t hwColour; //!< 16bit colour
|
||||
uint32_t wColour; //!< 32bit colour
|
||||
}Foreground; //!< forground colour
|
||||
union {
|
||||
uint8_t chColour; //!< 8bit colour
|
||||
uint16_t hwColour; //!< 16bit colour
|
||||
uint32_t wColour; //!< 32bit colour
|
||||
}Background; //!< background colour
|
||||
|
||||
} arm_2d_op_drw_patn_t;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief modes for copying bit-patterns
|
||||
*/
|
||||
enum {
|
||||
ARM_2D_DRW_PATN_MODE_COPY = 0, //!< copy bit pattern
|
||||
//ARM_2D_DRW_PATN_MODE_FILL = _BV(0), //!< not support yet
|
||||
//ARM_2D_DRW_PATN_MODE_Y_MIRROR = _BV(2), //!< not support yet
|
||||
//ARM_2D_DRW_PATN_MODE_X_MIRROR = _BV(3), //!< not support yet
|
||||
ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR = _BV(4), //!< use user specified backgound colour
|
||||
ARM_2D_DRW_PATN_MODE_NO_FG_COLOR = _BV(5), //!< no forground
|
||||
|
||||
/*! use complementary colour as foreground colour
|
||||
*
|
||||
* \note this option is only avaialble when ARM_2D_DRW_PATN_MODE_NO_FG_COLOR
|
||||
* is used together.
|
||||
*/
|
||||
ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR = _BV(6),
|
||||
};
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Draw a point with specified colour *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief draw a point on a root tile with a given 8bit colour
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \note the point must be inside the region of the target tile
|
||||
* \param[in] chColour an 8bit colour
|
||||
*/
|
||||
ARM_NONNULL(1)
|
||||
__STATIC_INLINE void arm_2d_c8bit_draw_point_fast( const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint_fast8_t chColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
assert(ptTarget->bIsRoot); // must be root tile
|
||||
assert(tLocation.iX < ptTarget->tRegion.tSize.iWidth);
|
||||
assert(tLocation.iY < ptTarget->tRegion.tSize.iHeight);
|
||||
|
||||
uint8_t *pchPoint = ptTarget->pchBuffer
|
||||
+ tLocation.iY * ptTarget->tRegion.tSize.iWidth
|
||||
+ tLocation.iX;
|
||||
*pchPoint = (uint8_t)chColour;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief draw a point on a root tile with a given 16bit colour
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \note the point must be inside the region of the target tile
|
||||
* \param[in] hwColour an 16bit colour
|
||||
*/
|
||||
ARM_NONNULL(1)
|
||||
__STATIC_INLINE void arm_2d_rgb16_draw_point_fast(
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint_fast16_t hwColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
assert(ptTarget->bIsRoot); // must be root tile
|
||||
assert(tLocation.iX < ptTarget->tRegion.tSize.iWidth);
|
||||
assert(tLocation.iY < ptTarget->tRegion.tSize.iHeight);
|
||||
|
||||
uint16_t *phwPoint = ptTarget->phwBuffer
|
||||
+ tLocation.iY * ptTarget->tRegion.tSize.iWidth
|
||||
+ tLocation.iX;
|
||||
*phwPoint = (uint16_t)hwColour;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief draw a point on a root tile with a given 32bit colour
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \note the point must be inside the region of the target tile
|
||||
* \param[in] wColour an 32bit colour
|
||||
*/
|
||||
ARM_NONNULL(1)
|
||||
__STATIC_INLINE void arm_2d_rgb32_draw_point_fast(
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint32_t wColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
assert(ptTarget->bIsRoot); // must be root tile
|
||||
assert(tLocation.iX < ptTarget->tRegion.tSize.iWidth);
|
||||
assert(tLocation.iY < ptTarget->tRegion.tSize.iHeight);
|
||||
|
||||
uint32_t *pwPoint = ptTarget->pwBuffer
|
||||
+ tLocation.iY * ptTarget->tRegion.tSize.iWidth
|
||||
+ tLocation.iX;
|
||||
*pwPoint = wColour;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief draw a point with a given 8bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \param[in] chColour an 8bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*
|
||||
* \note As those draw point APIs involve the region calculation
|
||||
* which is only useful when partial framebuffer is used, it is slow.
|
||||
* For gettting better performance, if the target tile is root and the
|
||||
* target location is inside the target region, please use the
|
||||
* functions with "_fast" posfix.
|
||||
*
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_c8bit_draw_point( arm_2d_op_drw_pt_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint_fast8_t chColour);
|
||||
|
||||
/*!
|
||||
* \brief draw a point with a given 16bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \param[in] hwColour an 16bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*
|
||||
* \note As those draw point APIs involve the region calculation
|
||||
* which is only useful when partial framebuffer is used, it is slow.
|
||||
* For gettting better performance, if the target tile is root and the
|
||||
* target location is inside the target region, please use the
|
||||
* functions with "_fast" posfix.
|
||||
*
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb16_draw_point( arm_2d_op_drw_pt_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint_fast16_t hwColour);
|
||||
|
||||
/*!
|
||||
* \brief draw a point with a given 32bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \param[in] wColour an 32bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*
|
||||
* \note As those draw point APIs involve the region calculation
|
||||
* which is only useful when partial framebuffer is used, it is slow.
|
||||
* For gettting better performance, if the target tile is root and the
|
||||
* target location is inside the target region, please use the
|
||||
* functions with "_fast" posfix.
|
||||
*
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb32_draw_point( arm_2d_op_drw_pt_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint32_t wColour);
|
||||
|
||||
|
||||
#if 0 // todo: draw point with alpha
|
||||
extern
|
||||
ARM_NONNULL(1)
|
||||
arm_fsm_rt_t arm_2d_rgba8888_draw_point(const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
arm_2d_color_bgra8888_t tColour);
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Draw a bit patterns *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief copy a bit-pattern with given 8bit colours
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptPattern the source bit pattern
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wMode the copy mode
|
||||
* \param[in] chForeColour the foreground colour
|
||||
* \param[in] chBackColour the background colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_c8bit_draw_pattern( arm_2d_op_drw_patn_t *ptOP,
|
||||
const arm_2d_tile_t *ptPattern,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wMode,
|
||||
uint8_t chForeColour,
|
||||
uint8_t chBackColour);
|
||||
|
||||
/*!
|
||||
* \brief copy a bit-pattern with given 16bit colours
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptPattern the source bit pattern
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wMode the copy mode
|
||||
* \param[in] hwForeColour the foreground colour
|
||||
* \param[in] hwBackColour the background colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_rgb16_draw_pattern( arm_2d_op_drw_patn_t *ptOP,
|
||||
const arm_2d_tile_t *ptPattern,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wMode,
|
||||
uint16_t hwForeColour,
|
||||
uint16_t hwBackColour);
|
||||
|
||||
/*!
|
||||
* \brief copy a bit-pattern with given 32bit colours
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptPattern the source bit pattern
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wMode the copy mode
|
||||
* \param[in] wForeColour the foreground colour
|
||||
* \param[in] wBackColour the background colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_rgb32_draw_pattern( arm_2d_op_drw_patn_t *ptOP,
|
||||
const arm_2d_tile_t *ptPattern,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wMode,
|
||||
uint32_t wForeColour,
|
||||
uint32_t wBackColour);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Fill tile with a specified colour *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief fill the target region with a given 8bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] chColour a 8bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_c8bit_fill_colour( arm_2d_op_fill_cl_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint_fast8_t chColour);
|
||||
|
||||
/*!
|
||||
* \brief fill the target region with a given 16bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] hwColour a 16bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb16_fill_colour( arm_2d_op_fill_cl_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint_fast16_t hwColour);
|
||||
|
||||
/*!
|
||||
* \brief fill the target region with a given 32bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wColour a 32bit colour
|
||||
* \return arm_fsm_rt_t the operations result
|
||||
*/
|
||||
extern
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb32_fill_colour( arm_2d_op_fill_cl_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wColour);
|
||||
|
||||
|
||||
/*! @} */
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,233 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d_features.h"
|
||||
* Description: Public header file to indicate features avaialble for this
|
||||
* arm-2d library variant.
|
||||
*
|
||||
* $Date: 18. July 2022
|
||||
* $Revision: V.1.0.3
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_FEATURES_H__
|
||||
#define __ARM_2D_FEATURES_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \addtogroup gKernel 1 Kernel
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __ARM_2D_SKIP_CFG_HEADER__
|
||||
# ifndef __ARM_2D_USER_CFG_HEADER__
|
||||
# include "arm_2d_cfg.h"
|
||||
# else
|
||||
# include __ARM_2D_USER_CFG_HEADER__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
#undef __ARM_2D_HAS_HELIUM__
|
||||
#undef __ARM_2D_HAS_HELIUM_INTEGER__
|
||||
#undef __ARM_2D_HAS_HELIUM_FLOAT__
|
||||
|
||||
#if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
|
||||
# define __ARM_2D_HAS_HELIUM__ 1
|
||||
# define __ARM_2D_HAS_HELIUM_INTEGER__ 1
|
||||
# if (__ARM_FEATURE_MVE & 2)
|
||||
# define __ARM_2D_HAS_HELIUM_FLOAT__ 1
|
||||
# else
|
||||
# define __ARM_2D_HAS_HELIUM_FLOAT__ 0
|
||||
# endif
|
||||
#else
|
||||
# define __ARM_2D_HAS_HELIUM__ 0
|
||||
# define __ARM_2D_HAS_HELIUM_INTEGER__ 0
|
||||
# define __ARM_2D_HAS_HELIUM_FLOAT__ 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __ARM_2D_HAS_CDE__
|
||||
# define __ARM_2D_HAS_CDE__ 0
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_2D_HAS_HW_ACC__
|
||||
# define __ARM_2D_HAS_HW_ACC__ 0
|
||||
#endif
|
||||
#if defined(__ARM_2D_HAS_HW_ACC__) && __ARM_2D_HAS_HW_ACC__
|
||||
# if defined(__ARM_2D_HAS_ASYNC__) && !__ARM_2D_HAS_ASYNC__
|
||||
# warning As long as __ARM_2D_HAS_HW_ACC__ is set to 1,\
|
||||
__ARM_2D_HAS_ASYNC__ is forced to 1. Since you set __ARM_2D_HAS_ASYNC__ to\
|
||||
0, please remove your macro definition for __ARM_2D_HAS_ASYNC__ to avoid this\
|
||||
warning.
|
||||
# endif
|
||||
# undef __ARM_2D_HAS_ASYNC__
|
||||
# define __ARM_2D_HAS_ASYNC__ 1
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_2D_HAS_ASYNC__
|
||||
# define __ARM_2D_HAS_ASYNC__ 1
|
||||
#endif
|
||||
#if defined(__ARM_2D_HAS_ASYNC__) && __ARM_2D_HAS_ASYNC__
|
||||
# if !defined(__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__) || \
|
||||
__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ < 4
|
||||
# define __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ 4
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#undef __ARM_2D_HAS_FPU__
|
||||
#if defined(__ARM_FP)
|
||||
#define __ARM_2D_HAS_FPU__ 1
|
||||
#else
|
||||
#define __ARM_2D_HAS_FPU__ 0
|
||||
#endif
|
||||
|
||||
#undef __ARM_2D_HAS_DSP__
|
||||
#if defined(__ARM_FEATURE_DSP) && __ARM_FEATURE_DSP
|
||||
#define __ARM_2D_HAS_DSP__ 1
|
||||
#else
|
||||
#define __ARM_2D_HAS_DSP__ 0
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
|
||||
# ifdef __ARM_2D_HAS_INTERPOLATION_ROTATION__
|
||||
# warning __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated, please use __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ instead.
|
||||
/*! \brief __ARM_2D_HAS_INTERPOLATION_ROTATION__ is deprecated
|
||||
*! add this for backward compatible
|
||||
*/
|
||||
# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ \
|
||||
__ARM_2D_HAS_INTERPOLATION_ROTATION__
|
||||
# else
|
||||
# define __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__ 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*! \note DO NOT define macro __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ unless
|
||||
*! you sure about what you are doing.
|
||||
*/
|
||||
#if !__ARM_2D_HAS_FPU__
|
||||
# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
|
||||
#elif !__ARM_2D_HAS_HELIUM__ \
|
||||
&& !defined(__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__)
|
||||
/*! \note For Armv7-m processors and Armv8-m processors that have no Helium
|
||||
*! extension but only FPU, fixed point rotation is faster than the
|
||||
*! float point rotation even if FPU can accelerate float point
|
||||
*! operations.
|
||||
*/
|
||||
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
|
||||
#endif
|
||||
|
||||
#if __ARM_2D_HAS_HELIUM_INTEGER__ && !__ARM_2D_HAS_HELIUM_FLOAT__
|
||||
# undef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
# define __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ 1
|
||||
#endif
|
||||
|
||||
/*! \note In your application, if you do need to use RGBA8888 for some resources
|
||||
*! and you want to use colour channels (e.g. the alpha channel) in mask
|
||||
*! related APIs, please set this macro to 1 in your project.
|
||||
*/
|
||||
#ifndef __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
|
||||
# define __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__ 1
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Unsafe configurations *
|
||||
*----------------------------------------------------------------------------*
|
||||
* Following macro switches are used to improve performance with aggressive *
|
||||
* methods which might cause errors or distortions in some cases. *
|
||||
* Those macros are undefined by defaults. Please use with cautions. *
|
||||
*----------------------------------------------------------------------------*
|
||||
* *
|
||||
* 1. __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ *
|
||||
* This option is used to remove calibration in angle computations to gain *
|
||||
* a better performance, small error might be noticible for angles like *
|
||||
* 90, 180, 270 etc. *
|
||||
* *
|
||||
* 2. __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ *
|
||||
* This option is used to speed up M-cores without DSP support *
|
||||
* It skips saturation in the QADD/QDADD/QDSUB involved in the rotation. *
|
||||
* The chances of overflow remain low as elements involved are using *
|
||||
* non-accumulating Q15.16 format and integer parts are in the range of *
|
||||
* the screen size providing enough margin. *
|
||||
* *
|
||||
* 3. __ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__ *
|
||||
* When define this macro, alpha value 0xFF will not be treated as opaque *
|
||||
* in mask related operations you can barely see the background. Defining *
|
||||
* this macro can get a big performance uplift. *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*! \note __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__ is
|
||||
* deprecated.
|
||||
* Please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ instead.
|
||||
*/
|
||||
#ifndef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__
|
||||
# ifdef __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
|
||||
|
||||
# warning __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__\
|
||||
is deprecated, please use __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__\
|
||||
instead.
|
||||
|
||||
# define __ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__ \
|
||||
__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*! \note __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__ is
|
||||
* deprecated.
|
||||
* Please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ instead.
|
||||
*/
|
||||
#ifndef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__
|
||||
# ifdef __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
|
||||
# warning __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__\
|
||||
is deprecated, please use __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__\
|
||||
instead.
|
||||
|
||||
# define __ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT__ \
|
||||
__ARM_2D_CFG_UNSAFE_NO_SATURATION_IN_FIXED_POINT_FOR_PERFROMANCE__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,312 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: #include "arm_2d.h"
|
||||
* Description: Public header file to contain the all avaialble Arm-2D
|
||||
* interface header files
|
||||
*
|
||||
* $Date: 17. May 2022
|
||||
* $Revision: V.1.2.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_OP_H__
|
||||
#define __ARM_2D_OP_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include "arm_2d_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
#define LOW_LEVEL_IO__ARM_2D_IO_NONE (*(void *)NULL)
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Misc *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_BARRIER;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Basic Tile Operation (Core) *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_ONLY_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_ONLY_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_ONLY_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_X_MIRROR_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_X_MIRROR_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_X_MIRROR_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_Y_MIRROR_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_Y_MIRROR_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_Y_MIRROR_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_XY_MIRROR_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_XY_MIRROR_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_XY_MIRROR_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_ONLY_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_ONLY_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_ONLY_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_X_MIRROR_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_X_MIRROR_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_X_MIRROR_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_Y_MIRROR_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_Y_MIRROR_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_Y_MIRROR_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_XY_MIRROR_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_XY_MIRROR_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_FILL_XY_MIRROR_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_COLOUR_KEYING_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_COLOUR_KEYING_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_COLOUR_KEYING_RGB32;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Alpha-Blending and Masks *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_WITH_MASK_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_WITH_MASK_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_WITH_MASK_CCCN888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_WITH_MASK_AND_OPACITY_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_WITH_MASK_AND_OPACITY_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_WITH_MASK_AND_OPACITY_CCCN888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_BLENDING_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_BLENDING_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_BLENDING_RGB888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_BLENDING_WITH_COLOUR_KEYING_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_BLENDING_WITH_COLOUR_KEYING_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_BLENDING_WITH_COLOUR_KEYING_RGB888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_COLOUR_FILL_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_COLOUR_FILL_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_ALPHA_COLOUR_FILL_RGB888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_MASK_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_MASK_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_MASK_CCCN888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_SRC_MASK_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_SRC_MASK_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_SRC_MASK_CCCN888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_DES_MASK_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_DES_MASK_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TILE_COPY_WITH_DES_MASK_CCCN888;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Basic Drawing *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_POINT_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_POINT_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_POINT_RGB32;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_PATTERN_C8BIT;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_PATTERN_RGB16;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_PATTERN_RGB32;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Colour Conversion *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_CONVERT_TO_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_CONVERT_TO_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_CONVERT_TO_RGB888;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Transform *
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_CCCN888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_OPACITY_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_OPACITY_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_OPACITY_CCCN888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_SRC_MSK_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_SRC_MSK_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_SRC_MSK_CCCN888;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_SRC_MSK_AND_OPACITY_GRAY8;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_SRC_MSK_AND_OPACITY_RGB565;
|
||||
|
||||
extern
|
||||
const __arm_2d_op_info_t ARM_2D_OP_TRANSFORM_WITH_SRC_MSK_AND_OPACITY_CCCN888;
|
||||
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,903 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: cmsis_nn_typs.h
|
||||
* Description: Public header file to contain the Arm-2D structs
|
||||
*
|
||||
* $Date: 09. Aug 2022
|
||||
* $Revision: V.1.0.4
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __ARM_2D_TYPES_H__
|
||||
#define __ARM_2D_TYPES_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "arm_2d_features.h"
|
||||
#include "arm_2d_utils.h"
|
||||
#include "__arm_2d_math.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wmissing-declarations"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wc11-extensions"
|
||||
#elif __IS_COMPILER_ARM_COMPILER_5__
|
||||
# pragma diag_suppress 64
|
||||
#elif __IS_COMPILER_GCC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
# pragma GCC diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \addtogroup gKernel 1 Kernel
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Infrastructure *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief finite-state-machine status return (Compatible with arm_status, minimal integer: int8_t)
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
arm_fsm_rt_err = -1, //!< fsm error
|
||||
arm_fsm_rt_cpl = 0, //!< fsm complete
|
||||
arm_fsm_rt_on_going = 1, //!< fsm on-going
|
||||
arm_fsm_rt_wait_for_obj = 2, //!< fsm wait for IPC object
|
||||
arm_fsm_rt_async = 3, //!< fsm work asynchronously, please check it later.
|
||||
arm_fsm_rt_wait_for_res = 4, //!< wait for resource
|
||||
} arm_fsm_rt_t;
|
||||
|
||||
/*!
|
||||
* \brief the error code for arm-2d (minimal integer: int8_t)
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
ARM_2D_ERR_UNSUPPORTED_COLOUR = -11, //!< the specified colour is not supported
|
||||
ARM_2D_ERR_BUSY = -10, //!< service is busy
|
||||
ARM_2D_ERR_INSUFFICIENT_RESOURCE = -9, //!< insufficient resource
|
||||
ARM_2D_ERR_IO_BUSY = -8, //!< HW accelerator is busy
|
||||
ARM_2D_ERR_IO_ERROR = -7, //!< Generic HW error
|
||||
ARM_2D_ERR_MISSING_PARAM = -6, //!< missing mandatory parameter
|
||||
ARM_2D_ERR_INVALID_OP = -5, //!< unsupported / invalid operation
|
||||
ARM_2D_ERR_NOT_SUPPORT = -4, //!< feature/service/operation is not supported
|
||||
ARM_2D_ERR_OUT_OF_REGION = -3, //!< the operation is out of target area
|
||||
ARM_2D_ERR_INVALID_PARAM = -2, //!< invalid parameter
|
||||
ARM_2D_ERR_UNKNOWN = -1, //!< generic or unknown errors
|
||||
ARM_2D_ERR_NONE = 0, //!< no error
|
||||
} arm_2d_err_t;
|
||||
|
||||
/*!
|
||||
* \brief comparison result
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
ARM_2D_CMP_SMALLER = -1, //!< the target is smaller than the reference
|
||||
ARM_2D_CMP_EQUALS = 0, //!< the target is equal to the reference
|
||||
ARM_2D_CMP_LARGER = 1, //!< the target is larger than the reference
|
||||
} arm_2d_cmp_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Colour definitions *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief the colour type for gray8 (8bit gray scale)
|
||||
*
|
||||
*/
|
||||
typedef union arm_2d_color_gray8_t {
|
||||
uint8_t tValue;
|
||||
} arm_2d_color_gray8_t;
|
||||
|
||||
/*!
|
||||
* \brief the colour type for rgb565
|
||||
*
|
||||
*/
|
||||
typedef union arm_2d_color_rgb565_t {
|
||||
uint16_t tValue;
|
||||
struct {
|
||||
uint16_t u5B : 5;
|
||||
uint16_t u6G : 6;
|
||||
uint16_t u5R : 5;
|
||||
};
|
||||
} arm_2d_color_rgb565_t;
|
||||
|
||||
/*!
|
||||
* \brief the colour type for brga8888
|
||||
*
|
||||
* \details In most cases four equal-sized pieces of adjacent memory are used,
|
||||
* one for each channel, and a 0 in a channel indicates black color or
|
||||
* transparent alpha, while all-1 bits indicates white or fully opaque
|
||||
* alpha. By far the most common format is to store 8 bits (one byte)
|
||||
* for each channel, which is 32 bits for each pixel.
|
||||
*
|
||||
* (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
|
||||
*/
|
||||
typedef union arm_2d_color_bgra8888_t {
|
||||
uint32_t tValue;
|
||||
struct {
|
||||
uint32_t u8B : 8;
|
||||
uint32_t u8G : 8;
|
||||
uint32_t u8R : 8;
|
||||
uint32_t u8A : 8;
|
||||
};
|
||||
} arm_2d_color_bgra8888_t;
|
||||
|
||||
/*!
|
||||
* \brief the colour type for rgb888 (compliant with ccca888 and bgra8888)
|
||||
*
|
||||
* \details In most cases four equal-sized pieces of adjacent memory are used,
|
||||
* one for each channel, and a 0 in a channel indicates black color or
|
||||
* transparent alpha, while all-1 bits indicates white or fully opaque
|
||||
* alpha. By far the most common format is to store 8 bits (one byte)
|
||||
* for each channel, which is 32 bits for each pixel.
|
||||
*
|
||||
* (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
|
||||
*/
|
||||
typedef union arm_2d_color_rgb888_t {
|
||||
uint32_t tValue;
|
||||
struct {
|
||||
uint32_t u8B : 8;
|
||||
uint32_t u8G : 8;
|
||||
uint32_t u8R : 8;
|
||||
uint32_t : 8;
|
||||
};
|
||||
} arm_2d_color_rgb888_t;
|
||||
|
||||
/*!
|
||||
* \brief the colour type for any 32bit colour formats which has an alpha channel on its 3rd byte.
|
||||
*
|
||||
* \details In most cases four equal-sized pieces of adjacent memory are used,
|
||||
* one for each channel, and a 0 in a channel indicates black color or
|
||||
* transparent alpha, while all-1 bits indicates white or fully opaque
|
||||
* alpha. By far the most common format is to store 8 bits (one byte)
|
||||
* for each channel, which is 32 bits for each pixel.
|
||||
*
|
||||
* (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
|
||||
*/
|
||||
typedef union arm_2d_color_ccca8888_t {
|
||||
uint32_t tValue;
|
||||
struct {
|
||||
uint8_t u8C[3];
|
||||
uint8_t u8A;
|
||||
};
|
||||
} arm_2d_color_ccca8888_t;
|
||||
|
||||
/*!
|
||||
* \brief the colour type for any 32bit colour formats which has an alpha channel on its first byte.
|
||||
*
|
||||
* \details In most cases four equal-sized pieces of adjacent memory are used,
|
||||
* one for each channel, and a 0 in a channel indicates black color or
|
||||
* transparent alpha, while all-1 bits indicates white or fully opaque
|
||||
* alpha. By far the most common format is to store 8 bits (one byte)
|
||||
* for each channel, which is 32 bits for each pixel.
|
||||
*
|
||||
* (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
|
||||
*/
|
||||
typedef union arm_2d_color_accc8888_t {
|
||||
uint32_t tValue;
|
||||
struct {
|
||||
uint8_t u8A;
|
||||
uint8_t u8C[3];
|
||||
};
|
||||
} arm_2d_color_accc8888_t;
|
||||
|
||||
/*!
|
||||
* \brief the colour type for any 32bit colour formats which has an unused-alpha channel on its 3rd byte.
|
||||
*
|
||||
* \details In most cases four equal-sized pieces of adjacent memory are used,
|
||||
* one for each channel, and a 0 in a channel indicates black color or
|
||||
* transparent alpha, while all-1 bits indicates white or fully opaque
|
||||
* alpha. By far the most common format is to store 8 bits (one byte)
|
||||
* for each channel, which is 32 bits for each pixel.
|
||||
*
|
||||
* (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
|
||||
*/
|
||||
typedef union arm_2d_color_cccn888_t {
|
||||
uint32_t tValue;
|
||||
struct {
|
||||
uint8_t u8C[3];
|
||||
uint8_t : 8;
|
||||
};
|
||||
} arm_2d_color_cccn888_t;
|
||||
|
||||
/*!
|
||||
* \brief the colour type for any 32bit colour formats which has an unused-alpha channel on its first byte.
|
||||
*
|
||||
* \details In most cases four equal-sized pieces of adjacent memory are used,
|
||||
* one for each channel, and a 0 in a channel indicates black color or
|
||||
* transparent alpha, while all-1 bits indicates white or fully opaque
|
||||
* alpha. By far the most common format is to store 8 bits (one byte)
|
||||
* for each channel, which is 32 bits for each pixel.
|
||||
*
|
||||
* (source: https://en.wikipedia.org/wiki/RGBA_color_model#ARGB32)
|
||||
*/
|
||||
typedef union arm_2d_color_nccc888_t {
|
||||
uint32_t tValue;
|
||||
struct {
|
||||
uint8_t : 8;
|
||||
uint8_t u8C[3];
|
||||
};
|
||||
} arm_2d_color_nccc888_t;
|
||||
|
||||
/*!
|
||||
* \brief enumerations for colour attributes
|
||||
*/
|
||||
enum {
|
||||
ARM_2D_COLOUR_SZ_1BIT = 0, //!< 1 bit:black and white
|
||||
ARM_2D_COLOUR_SZ_2BIT = 1, //!< 4 colours or 4 gray-levels
|
||||
ARM_2D_COLOUR_SZ_4BIT = 2, //!< 16 colours or 16 gray-levels
|
||||
ARM_2D_COLOUR_SZ_8BIT = 3, //!< 256 colours
|
||||
ARM_2D_COLOUR_SZ_16BIT = 4, //!< 16bits
|
||||
ARM_2D_COLOUR_SZ_32BIT = 5, //!< true colour
|
||||
|
||||
ARM_2D_COLOUR_SZ_1BIT_msk = ARM_2D_COLOUR_SZ_1BIT << 1,
|
||||
ARM_2D_COLOUR_SZ_2BIT_msk = ARM_2D_COLOUR_SZ_2BIT << 1,
|
||||
ARM_2D_COLOUR_SZ_4BIT_msk = ARM_2D_COLOUR_SZ_4BIT << 1,
|
||||
ARM_2D_COLOUR_SZ_8BIT_msk = ARM_2D_COLOUR_SZ_8BIT << 1,
|
||||
ARM_2D_COLOUR_SZ_16BIT_msk = ARM_2D_COLOUR_SZ_16BIT<< 1,
|
||||
ARM_2D_COLOUR_SZ_32BIT_msk = ARM_2D_COLOUR_SZ_32BIT<< 1,
|
||||
ARM_2D_COLOUR_SZ_msk = (0x07 << 1),
|
||||
|
||||
ARM_2D_COLOUR_LITTLE_ENDIAN = 0,
|
||||
ARM_2D_COLOUR_BIG_ENDIAN = 1,
|
||||
|
||||
ARM_2D_COLOUR_LITTLE_ENDIAN_msk = ARM_2D_COLOUR_LITTLE_ENDIAN << 4,
|
||||
ARM_2D_COLOUR_BIG_ENDIAN_msk = ARM_2D_COLOUR_BIG_ENDIAN << 4,
|
||||
|
||||
ARM_2D_COLOUR_NO_ALPHA = 0,
|
||||
ARM_2D_COLOUR_HAS_ALPHA = 1,
|
||||
|
||||
ARM_2D_COLOUR_NO_ALPHA_msk = ARM_2D_COLOUR_NO_ALPHA << 0,
|
||||
ARM_2D_COLOUR_HAS_ALPHA_msk = ARM_2D_COLOUR_HAS_ALPHA << 0,
|
||||
|
||||
ARM_2D_COLOUR_VARIANT_pos = 5,
|
||||
ARM_2D_COLOUR_VARIANT_msk = 0x07 << ARM_2D_COLOUR_VARIANT_pos,
|
||||
};
|
||||
|
||||
/* macros for colour attributes */
|
||||
#define ARM_2D_M_COLOUR_SZ_1BIT 0 //!< 1 bit:black and white
|
||||
#define ARM_2D_M_COLOUR_SZ_2BIT 1 //!< 4 colours or 4 gray-levels
|
||||
#define ARM_2D_M_COLOUR_SZ_4BIT 2 //!< 16 colours or 16 gray-levels
|
||||
#define ARM_2D_M_COLOUR_SZ_8BIT 3 //!< 256 colours
|
||||
#define ARM_2D_M_COLOUR_SZ_16BIT 4 //!< 16bits
|
||||
#define ARM_2D_M_COLOUR_SZ_32BIT 5 //!< true colour
|
||||
|
||||
#define ARM_2D_M_COLOUR_SZ_1BIT_msk (ARM_2D_M_COLOUR_SZ_1BIT << 1)
|
||||
#define ARM_2D_M_COLOUR_SZ_2BIT_msk (ARM_2D_M_COLOUR_SZ_2BIT << 1)
|
||||
#define ARM_2D_M_COLOUR_SZ_4BIT_msk (ARM_2D_M_COLOUR_SZ_4BIT << 1)
|
||||
#define ARM_2D_M_COLOUR_SZ_8BIT_msk (ARM_2D_M_COLOUR_SZ_8BIT << 1)
|
||||
#define ARM_2D_M_COLOUR_SZ_16BIT_msk (ARM_2D_M_COLOUR_SZ_16BIT<< 1)
|
||||
#define ARM_2D_M_COLOUR_SZ_32BIT_msk (ARM_2D_M_COLOUR_SZ_32BIT<< 1)
|
||||
#define ARM_2D_M_COLOUR_SZ_msk (0x07 << 1),
|
||||
|
||||
#define ARM_2D_M_COLOUR_LITTLE_ENDIAN 0
|
||||
#define ARM_2D_M_COLOUR_BIG_ENDIAN 1
|
||||
|
||||
#define ARM_2D_M_COLOUR_LITTLE_ENDIAN_msk (ARM_2D_M_COLOUR_LITTLE_ENDIAN << 4)
|
||||
#define ARM_2D_M_COLOUR_BIG_ENDIAN_msk (ARM_2D_M_COLOUR_BIG_ENDIAN << 4)
|
||||
|
||||
#define ARM_2D_M_COLOUR_NO_ALPHA 0
|
||||
#define ARM_2D_M_COLOUR_HAS_ALPHA 1
|
||||
|
||||
#define ARM_2D_M_COLOUR_NO_ALPHA_msk (ARM_2D_M_COLOUR_NO_ALPHA << 0)
|
||||
#define ARM_2D_M_COLOUR_HAS_ALPHA_msk (ARM_2D_M_COLOUR_HAS_ALPHA << 0)
|
||||
|
||||
#define ARM_2D_M_COLOUR_VARIANT_pos 5
|
||||
#define ARM_2D_M_COLOUR_VARIANT_msk (0x07 << ARM_2D_M_COLOUR_VARIANT_pos)
|
||||
|
||||
/*!
|
||||
* \brief enumerations for colour types
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
ARM_2D_COLOUR_BIN = ARM_2D_COLOUR_SZ_1BIT_msk,
|
||||
ARM_2D_COLOUR_1BIT = ARM_2D_COLOUR_SZ_1BIT_msk,
|
||||
|
||||
ARM_2D_COLOUR_8BIT = ARM_2D_COLOUR_SZ_8BIT_msk,
|
||||
ARM_2D_COLOUR_GRAY8 = ARM_2D_COLOUR_SZ_8BIT_msk,
|
||||
|
||||
ARM_2D_COLOUR_16BIT = ARM_2D_COLOUR_SZ_16BIT_msk,
|
||||
ARM_2D_COLOUR_RGB16 = ARM_2D_COLOUR_SZ_16BIT_msk,
|
||||
ARM_2D_COLOUR_RGB565 = ARM_2D_COLOUR_RGB16,
|
||||
|
||||
/* won't support
|
||||
ARM_2D_COLOUR_RGB565_BE = ARM_2D_COLOUR_SZ_16BIT_msk |
|
||||
ARM_2D_COLOUR_BIG_ENDIAN_msk ,
|
||||
*/
|
||||
|
||||
ARM_2D_COLOUR_32BIT = ARM_2D_COLOUR_SZ_32BIT_msk ,
|
||||
ARM_2D_COLOUR_RGB32 = ARM_2D_COLOUR_SZ_32BIT_msk ,
|
||||
|
||||
ARM_2D_COLOUR_CCCN888 = ARM_2D_COLOUR_RGB32 ,
|
||||
ARM_2D_COLOUR_CCCA8888 = ARM_2D_COLOUR_SZ_32BIT_msk |
|
||||
ARM_2D_COLOUR_HAS_ALPHA_msk ,
|
||||
|
||||
ARM_2D_COLOUR_RGB888 = ARM_2D_COLOUR_CCCN888 ,
|
||||
ARM_2D_COLOUR_BGRA8888 = ARM_2D_COLOUR_CCCA8888 ,
|
||||
|
||||
/* not supported yet
|
||||
ARM_2D_COLOUR_NCCC888 = ARM_2D_COLOUR_RGB32 |
|
||||
ARM_2D_COLOUR_BIG_ENDIAN_msk ,
|
||||
ARM_2D_COLOUR_ACCC8888 = ARM_2D_COLOUR_SZ_32BIT_msk |
|
||||
ARM_2D_COLOUR_HAS_ALPHA_msk |
|
||||
ARM_2D_COLOUR_BIG_ENDIAN_msk ,
|
||||
*/
|
||||
ARM_2D_CHANNEL_8in32 = ARM_2D_COLOUR_SZ_32BIT_msk |
|
||||
ARM_2D_COLOUR_HAS_ALPHA_msk |
|
||||
ARM_2D_COLOUR_VARIANT_msk ,
|
||||
};
|
||||
|
||||
/* macros for colour formats */
|
||||
#define ARM_2D_M_COLOUR_BIN ARM_2D_M_COLOUR_SZ_1BIT_msk
|
||||
#define ARM_2D_M_COLOUR_1BIT ARM_2D_M_COLOUR_SZ_1BIT_msk
|
||||
|
||||
#define ARM_2D_M_COLOUR_8BIT ARM_2D_M_COLOUR_SZ_8BIT_msk
|
||||
#define ARM_2D_M_COLOUR_GRAY8 ARM_2D_M_COLOUR_SZ_8BIT_msk
|
||||
|
||||
#define ARM_2D_M_COLOUR_16BIT ARM_2D_M_COLOUR_SZ_16BIT_msk
|
||||
#define ARM_2D_M_COLOUR_RGB16 ARM_2D_M_COLOUR_SZ_16BIT_msk
|
||||
#define ARM_2D_M_COLOUR_RGB565 ARM_2D_M_COLOUR_RGB16
|
||||
|
||||
/* won't support
|
||||
#define ARM_2D_M_COLOUR_RGB565_BE ( ARM_2D_M_COLOUR_SZ_16BIT_msk \
|
||||
| ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
|
||||
*/
|
||||
|
||||
#define ARM_2D_M_COLOUR_32BIT ARM_2D_M_COLOUR_SZ_32BIT_msk
|
||||
#define ARM_2D_M_COLOUR_RGB32 ARM_2D_M_COLOUR_SZ_32BIT_msk
|
||||
|
||||
#define ARM_2D_M_COLOUR_CCCN888 ARM_2D_M_COLOUR_RGB32
|
||||
#define ARM_2D_M_COLOUR_CCCA8888 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
|
||||
| ARM_2D_M_COLOUR_HAS_ALPHA_msk)
|
||||
|
||||
#define ARM_2D_M_COLOUR_RGB888 ARM_2D_M_COLOUR_CCCN888
|
||||
#define ARM_2D_M_COLOUR_RGBA8888 ARM_2D_M_COLOUR_CCCA8888
|
||||
|
||||
/* not supported yet
|
||||
#define ARM_2D_M_COLOUR_NCCC888 ( ARM_2D_M_COLOUR_RGB32 \
|
||||
| ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
|
||||
#define ARM_2D_M_COLOUR_ACCC8888 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
|
||||
| ARM_2D_M_COLOUR_HAS_ALPHA_msk \
|
||||
| ARM_2D_M_COLOUR_BIG_ENDIAN_msk )
|
||||
*/
|
||||
#define ARM_2D_M_CHANNEL_8in32 ( ARM_2D_M_COLOUR_SZ_32BIT_msk \
|
||||
| ARM_2D_M_COLOUR_HAS_ALPHA_msk) \
|
||||
| ARM_2D_M_COLOUR_VARIANT_msk )
|
||||
|
||||
/*!
|
||||
* \brief a type used as colour descriptor
|
||||
*
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t bHasAlpha : 1; //!< whether the target colour has alpha channel
|
||||
uint8_t u3ColourSZ : 3; //!< the size of the colour
|
||||
uint8_t bBigEndian : 1; //!< whether the colour is stored in big endian
|
||||
uint8_t u3Variant : 3;
|
||||
};
|
||||
uint8_t chScheme;
|
||||
} arm_2d_color_info_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Tile and Regions *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief a type for coordinates (integer)
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_location_t {
|
||||
int16_t iX; //!< x in Cartesian coordinate system
|
||||
int16_t iY; //!< y in Cartesian coordinate system
|
||||
} arm_2d_location_t;
|
||||
|
||||
/*!
|
||||
* \brief a type for coordinates in floating point
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_point_float_t {
|
||||
float fX; //!< x in Cartesian coordinate system
|
||||
float fY; //!< y in Cartesian coordinate system
|
||||
} arm_2d_point_float_t;
|
||||
|
||||
/*!
|
||||
* \brief a type for coordinates in fixed point
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_point_fx_t {
|
||||
int32_t X; //!< x in Cartesian coordinate system
|
||||
int32_t Y; //!< y in Cartesian coordinate system
|
||||
} arm_2d_point_fx_t;
|
||||
|
||||
/*!
|
||||
* \brief a type for the size of an rectangular area
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_size_t {
|
||||
int16_t iWidth; //!< width of an rectangular area
|
||||
int16_t iHeight; //!< height of an rectangular area
|
||||
} arm_2d_size_t;
|
||||
|
||||
/*!
|
||||
* \brief a type for an rectangular area
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_region_t {
|
||||
implement_ex(arm_2d_location_t, tLocation); //!< the location (top-left corner)
|
||||
implement_ex(arm_2d_size_t, tSize); //!< the size
|
||||
} arm_2d_region_t;
|
||||
|
||||
/*!
|
||||
* \brief a type for tile
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_tile_t arm_2d_tile_t;
|
||||
struct arm_2d_tile_t {
|
||||
implement_ex(struct {
|
||||
uint8_t bIsRoot : 1; //!< is this tile a root tile
|
||||
uint8_t bHasEnforcedColour : 1; //!< does this tile contains enforced colour info
|
||||
uint8_t bDerivedResource : 1; //!< indicate whether this is a derived resources (when bIsRoot == 0)
|
||||
uint8_t bVirtualResource : 1; //!< indicate whether the resource should be loaded on-demand
|
||||
uint8_t : 4;
|
||||
uint8_t : 8;
|
||||
uint8_t : 8;
|
||||
arm_2d_color_info_t tColourInfo; //!< enforced colour
|
||||
}, tInfo);
|
||||
|
||||
implement_ex(arm_2d_region_t, tRegion); //!< the region of the tile
|
||||
|
||||
union {
|
||||
/* when bIsRoot is true, phwBuffer is available,
|
||||
* otherwise ptParent is available
|
||||
*/
|
||||
arm_2d_tile_t *ptParent; //!< a pointer points to the parent tile
|
||||
uint8_t *pchBuffer; //!< a pointer points to a buffer in a 8bit colour type
|
||||
uint16_t *phwBuffer; //!< a pointer points to a buffer in a 16bit colour type
|
||||
uint32_t *pwBuffer; //!< a pointer points to a buffer in a 32bit colour type
|
||||
|
||||
intptr_t nAddress; //!< a pointer in integer
|
||||
};
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief a type for virtual resource
|
||||
*
|
||||
* \note the flag tTile.tInfo.bVirtualResource must be true (1)
|
||||
*/
|
||||
typedef struct arm_2d_vres_t arm_2d_vres_t;
|
||||
struct arm_2d_vres_t {
|
||||
|
||||
/*! base class: tTile */
|
||||
implement_ex( arm_2d_tile_t, tTile);
|
||||
|
||||
/*! a reference of an user object */
|
||||
uintptr_t pTarget;
|
||||
|
||||
/*!
|
||||
* \brief a method to load a specific part of an image
|
||||
* \param[in] pTarget a reference of an user object
|
||||
* \param[in] ptVRES a reference of this virtual resource
|
||||
* \param[in] ptRegion the target region of the image
|
||||
* \return intptr_t the address of a resource buffer which holds the content
|
||||
*/
|
||||
intptr_t (*Load) ( uintptr_t pTarget,
|
||||
arm_2d_vres_t *ptVRES,
|
||||
arm_2d_region_t *ptRegion);
|
||||
|
||||
/*!
|
||||
* \brief a method to despose the buffer
|
||||
* \param[in] pTarget a reference of an user object
|
||||
* \param[in] ptVRES a reference of this virtual resource
|
||||
* \param[in] pBuffer the target buffer
|
||||
*/
|
||||
void (*Depose) ( uintptr_t pTarget,
|
||||
arm_2d_vres_t *ptVRES,
|
||||
intptr_t pBuffer );
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Task *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief arm-2d application level task control block
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_task_t {
|
||||
ARM_PRIVATE(
|
||||
arm_fsm_rt_t tResult; //!< the temporary result of the task
|
||||
uint8_t chState; //!< the state of the FSM
|
||||
|
||||
void *ptTask; //!< a pointer for an internal object
|
||||
)
|
||||
} arm_2d_task_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Operation and Events Handling *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
typedef struct arm_2d_op_core_t arm_2d_op_core_t;
|
||||
|
||||
/*!
|
||||
* \brief a prototype of event handlers for 2D operations
|
||||
*
|
||||
* \param[in] ptThisOP the target 2D operation descriptor
|
||||
* \param[in] tResult the operation result
|
||||
* \param[in] pTarget A user attached object
|
||||
* \return bool a boolean value to indicate whether the event has been handled
|
||||
*/
|
||||
typedef bool arm_2d_op_evt_handler_t( arm_2d_op_core_t *ptThisOP,
|
||||
arm_fsm_rt_t tResult,
|
||||
void *pTarget);
|
||||
|
||||
/*!
|
||||
* \brief a type for 2D operation event handling
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_op_evt_t {
|
||||
arm_2d_op_evt_handler_t *fnHandler; //!< event handler
|
||||
void *pTarget; //!< user attached target
|
||||
} arm_2d_op_evt_t;
|
||||
|
||||
/*!
|
||||
* \brief a prototype for generic event handlers
|
||||
*
|
||||
* \param pTarget A user attached object
|
||||
* \return bool a boolean value to indicate whether the event has been handled
|
||||
*/
|
||||
typedef bool arm_2d_evt_handler_t(void *pTarget);
|
||||
|
||||
/*!
|
||||
* \brief a type for generic event handling
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_evt_t {
|
||||
arm_2d_evt_handler_t *fnHandler; //!< event handler
|
||||
void *pTarget; //!< user attached target
|
||||
} arm_2d_evt_t;
|
||||
|
||||
|
||||
#define ARM_2D_OP_INFO_PARAM_HAS_SOURCE _BV(0)
|
||||
#define ARM_2D_OP_INFO_PARAM_HAS_TARGET _BV(1)
|
||||
#define ARM_2D_OP_INFO_PARAM_HAS_SOURCE_MASK _BV(2)
|
||||
#define ARM_2D_OP_INFO_PARAM_HAS_TARGET_MASK _BV(3)
|
||||
#define ARM_2D_OP_INFO_PARAM_HAS_ORIGIN _BV(4)
|
||||
|
||||
#define ARM_2D_OP_INFO_PARAM_TILES_MASK ( \
|
||||
ARM_2D_OP_INFO_PARAM_HAS_SOURCE | \
|
||||
ARM_2D_OP_INFO_PARAM_HAS_TARGET | \
|
||||
ARM_2D_OP_INFO_PARAM_HAS_SOURCE_MASK | \
|
||||
ARM_2D_OP_INFO_PARAM_HAS_TARGET_MASK | \
|
||||
ARM_2D_OP_INFO_PARAM_HAS_ORIGIN )
|
||||
|
||||
|
||||
//! \brief an incomplete defintion which is only used for defining pointers
|
||||
typedef struct __arm_2d_low_level_io_t __arm_2d_low_level_io_t;
|
||||
|
||||
/*!
|
||||
* \brief A descriptive header for 2D operations
|
||||
*/
|
||||
typedef union __arm_2d_op_info_t {
|
||||
struct {
|
||||
arm_2d_color_info_t Colour; //!< the colour used in thie operation
|
||||
union {
|
||||
struct {
|
||||
uint8_t bHasSource : 1; //!< whether this operation contains source tile
|
||||
uint8_t bHasTarget : 1; //!< whether this operation contains target tile
|
||||
uint8_t bHasSrcMask : 1; //!< whether this operation has Mask layer for source tile
|
||||
uint8_t bHasDesMask : 1; //!< whether this operation has Mask layer for target tile
|
||||
uint8_t bHasOrigin : 1; //!< whether the Source has an origin tile
|
||||
uint8_t : 2;
|
||||
uint8_t bAllowEnforcedColour : 1; //!< whether this operation allow enforced colours in tiles
|
||||
};
|
||||
uint8_t chValue; //!< feature value
|
||||
}Param; //!< operation feature set
|
||||
|
||||
uint8_t chInClassOffset; //!< some operation uses this as the offset of the key member in the class
|
||||
uint8_t chOpIndex; //!< __ARM_2D_OP_IDX_XXXXXX
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint8_t CopyLike; //!< A copy-like interface contains the target tile, the source tile and the copy size
|
||||
uint8_t FillLike; //!< A copy-like interface contains the target tile and the source tile
|
||||
};
|
||||
struct {
|
||||
uint8_t CopyOrigLike; //!< A copy-like interface contains the target tile, the dummy tile, the reference to the original source tile and the copy size
|
||||
uint8_t FillOrigLike; //!< A copy-like interface contains the target tile, the dummy tile and the reference to the original source tile
|
||||
};
|
||||
struct {
|
||||
uint8_t TileProcessLike; //!< A simple interface contains only the target tile
|
||||
};
|
||||
}LowLevelInterfaceIndex; //!< Low level interface index
|
||||
|
||||
union {
|
||||
const __arm_2d_low_level_io_t *IO[2]; //!< array of IOs
|
||||
|
||||
struct {
|
||||
const __arm_2d_low_level_io_t *ptCopyLike; //!< the function pointer for a copy-like implementation
|
||||
const __arm_2d_low_level_io_t *ptFillLike; //!< the function pointer for a fill-like implementation
|
||||
};
|
||||
struct {
|
||||
const __arm_2d_low_level_io_t *ptCopyOrigLike; //!< the function pointer for a copy-orig-like implementation
|
||||
const __arm_2d_low_level_io_t *ptFillOrigLike; //!< the function pointer for a fill-orig-like implementation
|
||||
};
|
||||
struct {
|
||||
const __arm_2d_low_level_io_t *ptTileProcessLike; //!< the function pointer for the tile-process-like implementation
|
||||
};
|
||||
}LowLevelIO; //!< low level IO definition
|
||||
|
||||
}Info; //!< operation description
|
||||
uint32_t wID; //!< Operation ID
|
||||
} __arm_2d_op_info_t;
|
||||
|
||||
/*!
|
||||
* \brief how would you want to accelerate the 2d-operation
|
||||
*/
|
||||
enum {
|
||||
//! Use hardware acceleration if possible, even if there is a long queue to wait
|
||||
ARM_2D_PREF_ACC_USE_HW_IF_POSSIBLE = 0,
|
||||
|
||||
//! Only use Hardware Acceleration, if it is not supported, IO error will be issued
|
||||
ARM_2D_PREF_ACC_HW_ONLY = 1,
|
||||
|
||||
//! Only use software algorithm
|
||||
ARM_2D_PREF_ACC_SW_ONLY = 2,
|
||||
|
||||
//!< don't care, let the arm-2d library decide
|
||||
ARM_2D_PREF_ACC_DONT_CARE = 3,
|
||||
};
|
||||
|
||||
#define __ARM_2D_OP_STATUS_BUSY_msk (1 << 4)
|
||||
#define __ARM_2D_OP_STATUS_IO_ERROR_msk (1 << 5)
|
||||
#define __ARM_2D_OP_STATUS_CPL_msk (1 << 6)
|
||||
|
||||
/*!
|
||||
* \brief a type for 2D operation status
|
||||
*
|
||||
*/
|
||||
typedef union arm_2d_op_status_t {
|
||||
struct {
|
||||
uint16_t u4SubTaskCount : 4; //!< sub task count
|
||||
uint16_t bIsBusy : 1; //!< busy flag
|
||||
uint16_t bIOError : 1; //!< HW IO Error
|
||||
uint16_t bOpCpl : 1; //!< the whole operation complete
|
||||
uint16_t : 9; //!< reserved
|
||||
};
|
||||
uint16_t tValue; //!< the host integer
|
||||
} arm_2d_op_status_t;
|
||||
|
||||
/*!
|
||||
* \brief the abstract class of 2D operations
|
||||
*
|
||||
*/
|
||||
struct arm_2d_op_core_t {
|
||||
ARM_PRIVATE(
|
||||
arm_2d_op_core_t *ptNext; //!< a pointer for a single list
|
||||
|
||||
const __arm_2d_op_info_t *ptOp; //!< the pointer for the corresponding 2D operation description
|
||||
|
||||
struct {
|
||||
uint8_t u2ACCMethods : 2; //!< acceleration Methods
|
||||
uint8_t : 6; //!< reserved
|
||||
}Preference;
|
||||
|
||||
int8_t tResult; //!< operation result
|
||||
volatile arm_2d_op_status_t Status; //!< operation status
|
||||
|
||||
arm_2d_op_evt_t evt2DOpCpl; //!< operation-complete event
|
||||
|
||||
)
|
||||
uintptr_t pUserParam; //!< user attached object
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief the base class for operations with only a target tile
|
||||
* \note arm_2d_op_msk_t inherits from arm_2d_op_core_t
|
||||
*/
|
||||
typedef struct arm_2d_op_t {
|
||||
inherit(arm_2d_op_core_t);
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
} arm_2d_op_t;
|
||||
|
||||
/*!
|
||||
* \brief the base class for operations with a target tile and a target mask
|
||||
* \note arm_2d_op_msk_t inherits from arm_2d_op_t
|
||||
*/
|
||||
typedef struct arm_2d_op_msk_t {
|
||||
inherit(arm_2d_op_core_t);
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
|
||||
/* derived part */
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
} Mask;
|
||||
} arm_2d_op_msk_t;
|
||||
|
||||
/*!
|
||||
* \brief the base class for operations with a target tile and a source tile
|
||||
* \note arm_2d_op_src_t inherits from arm_2d_op_t
|
||||
*/
|
||||
typedef struct arm_2d_op_src_t {
|
||||
inherit(arm_2d_op_core_t);
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
|
||||
/* derived part */
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< source tile
|
||||
}Source;
|
||||
uint32_t wMode;
|
||||
} arm_2d_op_src_t;
|
||||
|
||||
/*!
|
||||
* \brief the base class for operations with a target tile, a source tile and masks
|
||||
* \note arm_2d_op_src_msk_t inherits from arm_2d_op_src_t
|
||||
*/
|
||||
typedef struct arm_2d_op_src_msk_t {
|
||||
inherit(arm_2d_op_core_t);
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< source tile
|
||||
}Source;
|
||||
uint32_t wMode;
|
||||
|
||||
/* derived part */
|
||||
struct {
|
||||
const arm_2d_tile_t *ptSourceSide; //!< source side mask
|
||||
const arm_2d_tile_t *ptTargetSide; //!< target side mask
|
||||
} Mask;
|
||||
} arm_2d_op_src_msk_t;
|
||||
|
||||
/*!
|
||||
* \brief the base class for operations with a target tile, a dummy tile and a reference to the original source tile
|
||||
* \note arm_2d_op_src_orig_t inherits from arm_2d_op_src_t
|
||||
*/
|
||||
typedef struct arm_2d_op_src_orig_t {
|
||||
inherit(arm_2d_op_core_t);
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< the dummy source tile
|
||||
}Source;
|
||||
uint32_t wMode;
|
||||
|
||||
/* derived part */
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< the origin tile
|
||||
arm_2d_tile_t tDummySource; //!< the buffer for the source
|
||||
}Origin;
|
||||
|
||||
} arm_2d_op_src_orig_t;
|
||||
|
||||
/*!
|
||||
* \brief the base class for operations with a target tile, a dummy tile, a reference to the original source tile and masks
|
||||
* \note arm_2d_op_src_orig_msk_t inherits from arm_2d_op_src_orig_t
|
||||
*/
|
||||
typedef struct arm_2d_op_src_orig_msk_t {
|
||||
inherit(arm_2d_op_core_t);
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< target tile
|
||||
const arm_2d_region_t *ptRegion; //!< target region
|
||||
} Target;
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< the dummy source tile
|
||||
}Source;
|
||||
uint32_t wMode;
|
||||
struct {
|
||||
const arm_2d_tile_t *ptTile; //!< the origin tile
|
||||
arm_2d_tile_t tDummySource; //!< the buffer for the source
|
||||
}Origin;
|
||||
|
||||
/* derived part */
|
||||
struct {
|
||||
const arm_2d_tile_t *ptOriginSide; //!< origin side mask
|
||||
const arm_2d_tile_t *ptTargetSide; //!< target side mask
|
||||
} Mask;
|
||||
} arm_2d_op_src_orig_msk_t;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Fast Rotation linear regression structure
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#if (__ARM_2D_HAS_HELIUM_FLOAT__ || __ARM_2D_HAS_FPU__) \
|
||||
&& !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
/*!
|
||||
* \brief a type for parameters of linear interpolation (in floating point)
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_rot_linear_regr_t {
|
||||
float slopeY;
|
||||
float interceptY;
|
||||
float slopeX;
|
||||
float interceptX;
|
||||
} arm_2d_rot_linear_regr_t;
|
||||
|
||||
#else
|
||||
/*!
|
||||
* \brief a type for parameters of linear interpolation (in fixed point)
|
||||
*
|
||||
*/
|
||||
typedef struct arm_2d_rot_linear_regr_t {
|
||||
int32_t slopeY;
|
||||
int32_t interceptY;
|
||||
int32_t slopeX;
|
||||
int32_t interceptX;
|
||||
} arm_2d_rot_linear_regr_t;
|
||||
|
||||
#endif
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
/*! @} */
|
||||
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#elif __IS_COMPILER_ARM_COMPILER_5__
|
||||
#pragma diag_warning 64
|
||||
#elif __IS_COMPILER_GCC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __ARM_2D_TYPES_H__
|
||||
|
||||
|
@ -1,571 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm_2d_utils.h
|
||||
* Description: Public header file for Arm-2D Library
|
||||
*
|
||||
* $Date: 18. July 2022
|
||||
* $Revision: V.1.0.3
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __ARM_2D_UTILS_H__
|
||||
#define __ARM_2D_UTILS_H__
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-conversion"
|
||||
# pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
|
||||
# pragma clang diagnostic ignored "-Wundef"
|
||||
#elif defined(__IS_COMPILER_GCC__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
# pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif
|
||||
|
||||
#ifdef __ARM_2D_HAS_USER_HEADER__
|
||||
# include __ARM_2D_HAS_USER_HEADER__
|
||||
#endif
|
||||
|
||||
/*! \note arm-2d relies on CMSIS 5.4.0 and above.
|
||||
*/
|
||||
#include "cmsis_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \addtogroup gKernel 1 Kernel
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Environment Detection *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/* The macros to identify compilers */
|
||||
|
||||
/*!
|
||||
* \brief to detect IAR
|
||||
*/
|
||||
#undef __IS_COMPILER_IAR__
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
# define __IS_COMPILER_IAR__ 1
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief to detect arm compiler 5
|
||||
*
|
||||
*/
|
||||
#undef __IS_COMPILER_ARM_COMPILER_5__
|
||||
#if ((__ARMCC_VERSION >= 5000000) && (__ARMCC_VERSION < 6000000))
|
||||
# define __IS_COMPILER_ARM_COMPILER_5__ 1
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* \brief to detect arm compiler 6
|
||||
*
|
||||
*/
|
||||
#undef __IS_COMPILER_ARM_COMPILER_6__
|
||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
# define __IS_COMPILER_ARM_COMPILER_6__ 1
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief to detect arm compilers
|
||||
*
|
||||
*/
|
||||
#undef __IS_COMPILER_ARM_COMPILER__
|
||||
#if defined(__IS_COMPILER_ARM_COMPILER_5__) && __IS_COMPILER_ARM_COMPILER_5__ \
|
||||
|| defined(__IS_COMPILER_ARM_COMPILER_6__) && __IS_COMPILER_ARM_COMPILER_6__
|
||||
# define __IS_COMPILER_ARM_COMPILER__ 1
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief to detect clang (llvm)
|
||||
*
|
||||
*/
|
||||
#undef __IS_COMPILER_LLVM__
|
||||
#if defined(__clang__) && !__IS_COMPILER_ARM_COMPILER_6__
|
||||
# define __IS_COMPILER_LLVM__ 1
|
||||
#else
|
||||
|
||||
/*!
|
||||
* \brief to detect gcc
|
||||
*
|
||||
*/
|
||||
# undef __IS_COMPILER_GCC__
|
||||
# if defined(__GNUC__) && !( defined(__IS_COMPILER_ARM_COMPILER__) \
|
||||
|| defined(__IS_COMPILER_LLVM__) \
|
||||
|| defined(__IS_COMPILER_IAR__))
|
||||
# define __IS_COMPILER_GCC__ 1
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* OOC and Private Protection *
|
||||
*----------------------------------------------------------------------------*/
|
||||
/* minimal support for OOPC */
|
||||
#undef __implement_ex
|
||||
#undef __implement
|
||||
#undef implement
|
||||
#undef implement_ex
|
||||
#undef inherit
|
||||
#undef inherit_ex
|
||||
|
||||
#define __implement_ex(__type, __name) \
|
||||
union { \
|
||||
__type __name; \
|
||||
__type; \
|
||||
}
|
||||
|
||||
#define __inherit_ex(__type, __name) \
|
||||
__type __name \
|
||||
|
||||
#define __implement(__type) __implement_ex( __type, \
|
||||
use_as__##__type)
|
||||
|
||||
#define __inherit(__type) __inherit_ex(__type,use_as__##__type)
|
||||
|
||||
#define implement(__type) __implement(__type)
|
||||
#define implement_ex(__type, __name) __implement_ex(__type, __name)
|
||||
|
||||
#define inherit(__type) __inherit(__type)
|
||||
#define inherit_ex(__type, __name) __inherit_ex(__type, __name)
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Misc *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ARM_2D_UNUSED
|
||||
# define ARM_2D_UNUSED(__VAR) (void)(__VAR)
|
||||
#endif
|
||||
|
||||
#ifndef ARM_TEST_BITS
|
||||
# define ARM_TEST_BITS(__VALUE, __BITS) ((__BITS) == ((__VALUE) & (__BITS)))
|
||||
#endif
|
||||
|
||||
#ifndef dimof
|
||||
# define dimof(__array) (sizeof(__array)/sizeof(__array[0]))
|
||||
#endif
|
||||
|
||||
#ifndef offsetof
|
||||
# define offsetof(__type, __member) \
|
||||
((uintptr_t)&(((__type *)NULL)->__member))
|
||||
#endif
|
||||
|
||||
#define __ARM_TO_STRING(__STR) #__STR
|
||||
#define ARM_TO_STRING(__STR) __ARM_TO_STRING(__STR)
|
||||
|
||||
#define __ARM_VA_NUM_ARGS_IMPL( _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, \
|
||||
_13,_14,_15,_16,__N,...) __N
|
||||
|
||||
/*!
|
||||
* \brief A macro to count the number of parameters
|
||||
*
|
||||
* \note if GNU extension is not supported or enabled, the following express will
|
||||
* be false: (__ARM_VA_NUM_ARGS() != 0)
|
||||
* This might cause problems when in this library.
|
||||
*/
|
||||
#define __ARM_VA_NUM_ARGS(...) \
|
||||
__ARM_VA_NUM_ARGS_IMPL( 0,##__VA_ARGS__,16,15,14,13,12,11,10,9, \
|
||||
8,7,6,5,4,3,2,1,0)
|
||||
|
||||
/*!
|
||||
* \brief detect whether GNU extension is enabled in compilation or not
|
||||
*/
|
||||
#if __ARM_VA_NUM_ARGS() != 0
|
||||
# warning Please enable GNU extensions, it is required by the Arm-2D.
|
||||
#endif
|
||||
|
||||
#ifndef ARM_2D_INVOKE
|
||||
/*!
|
||||
* \brief A macro to safely invode a function pointer
|
||||
*
|
||||
* \param[in] __FUNC_PTR the target function pointer
|
||||
* \param[in] ... an optional parameter list
|
||||
*/
|
||||
# define ARM_2D_INVOKE(__FUNC_PTR, ...) \
|
||||
do { \
|
||||
if (NULL != (__FUNC_PTR)) { \
|
||||
(*(__FUNC_PTR))(__VA_ARGS__); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#define __ARM_CONNECT2(__A, __B) __A##__B
|
||||
#define __ARM_CONNECT2_ALT(__A, __B) __A##__B
|
||||
#define __ARM_CONNECT3(__A, __B, __C) __A##__B##__C
|
||||
#define __ARM_CONNECT4(__A, __B, __C, __D) __A##__B##__C##__D
|
||||
#define __ARM_CONNECT5(__A, __B, __C, __D, __E) __A##__B##__C##__D##__E
|
||||
#define __ARM_CONNECT6(__A, __B, __C, __D, __E, __F) \
|
||||
__A##__B##__C##__D##__E##__F
|
||||
#define __ARM_CONNECT7(__A, __B, __C, __D, __E, __F, __G) \
|
||||
__A##__B##__C##__D##__E##__F##__G
|
||||
#define __ARM_CONNECT8(__A, __B, __C, __D, __E, __F, __G, __H) \
|
||||
__A##__B##__C##__D##__E##__F##__G##__H
|
||||
#define __ARM_CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I) \
|
||||
__A##__B##__C##__D##__E##__F##__G##__H##__I
|
||||
|
||||
#define ARM_CONNECT2(__A, __B) __ARM_CONNECT2(__A, __B)
|
||||
#define ARM_CONNECT2_ALT(__A, __B) __ARM_CONNECT2_ALT(__A, __B)
|
||||
#define ARM_CONNECT3(__A, __B, __C) __ARM_CONNECT3(__A, __B, __C)
|
||||
#define ARM_CONNECT4(__A, __B, __C, __D) __ARM_CONNECT4(__A, __B, __C, __D)
|
||||
#define ARM_CONNECT5(__A, __B, __C, __D, __E) \
|
||||
__ARM_CONNECT5(__A, __B, __C, __D, __E)
|
||||
#define ARM_CONNECT6(__A, __B, __C, __D, __E, __F) \
|
||||
__ARM_CONNECT6(__A, __B, __C, __D, __E, __F)
|
||||
#define ARM_CONNECT7(__A, __B, __C, __D, __E, __F, __G) \
|
||||
__ARM_CONNECT7(__A, __B, __C, __D, __E, __F, __G)
|
||||
#define ARM_CONNECT8(__A, __B, __C, __D, __E, __F, __G, __H) \
|
||||
__ARM_CONNECT8(__A, __B, __C, __D, __E, __F, __G, __H)
|
||||
#define ARM_CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I) \
|
||||
__ARM_CONNECT9(__A, __B, __C, __D, __E, __F, __G, __H, __I)
|
||||
|
||||
#define arm_connect(...) \
|
||||
ARM_CONNECT2_ALT(ARM_CONNECT, __ARM_VA_NUM_ARGS(__VA_ARGS__)) \
|
||||
(__VA_ARGS__)
|
||||
|
||||
#define ARM_CONNECT(...) arm_connect(__VA_ARGS__)
|
||||
|
||||
#define __ARM_USING1(__declare) \
|
||||
for (__declare, *ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
|
||||
ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
|
||||
)
|
||||
|
||||
#define __ARM_USING2(__declare, __on_leave_expr) \
|
||||
for (__declare, *ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
|
||||
ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL; \
|
||||
__on_leave_expr \
|
||||
)
|
||||
|
||||
#define __ARM_USING3(__declare, __on_enter_expr, __on_leave_expr) \
|
||||
for (__declare, *ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr) = NULL; \
|
||||
ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL ? \
|
||||
((__on_enter_expr),1) : 0; \
|
||||
__on_leave_expr \
|
||||
)
|
||||
|
||||
#define __ARM_USING4(__dcl1, __dcl2, __on_enter_expr, __on_leave_expr) \
|
||||
for (__dcl1,__dcl2,*ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)= NULL;\
|
||||
ARM_CONNECT3(__ARM_USING_, __LINE__,_ptr)++ == NULL ? \
|
||||
((__on_enter_expr),1) : 0; \
|
||||
__on_leave_expr \
|
||||
)
|
||||
|
||||
#define arm_using(...) \
|
||||
ARM_CONNECT2(__ARM_USING, __ARM_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
|
||||
|
||||
|
||||
#define __ARM_WITH2(__type, __addr) \
|
||||
ARM_USING(__type *_p=(__addr))
|
||||
#define __ARM_WITH3(__type, __addr, __item) \
|
||||
ARM_USING(__type *_p=(__addr), *__item = _p, _p=_p, )
|
||||
|
||||
#define arm_with(...) \
|
||||
ARM_CONNECT2(__ARM_WITH, __ARM_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
|
||||
|
||||
#define ARM_FOREACH2(__type, __array) \
|
||||
arm_using(__type *_ = __array) \
|
||||
for ( uint_fast32_t ARM_CONNECT2(count,__LINE__) = dimof(__array);\
|
||||
ARM_CONNECT2(count,__LINE__) > 0; \
|
||||
_++, ARM_CONNECT2(count,__LINE__)-- \
|
||||
)
|
||||
|
||||
#define ARM_FOREACH3(__type, __array, __item) \
|
||||
arm_using(__type *_ = __array, *__item = _, _ = _, ) \
|
||||
for ( uint_fast32_t ARM_CONNECT2(count,__LINE__) = dimof(__array);\
|
||||
ARM_CONNECT2(count,__LINE__) > 0; \
|
||||
_++, __item = _, ARM_CONNECT2(count,__LINE__)-- \
|
||||
)
|
||||
|
||||
#define ARM_FOREACH4(__type, __array, __count, __item) \
|
||||
arm_using(__type *_ = __array, *__item = _, _ = _, ) \
|
||||
for ( uint_fast32_t ARM_CONNECT2(count,__LINE__) = (__count); \
|
||||
ARM_CONNECT2(count,__LINE__) > 0; \
|
||||
_++, __item = _, ARM_CONNECT2(count,__LINE__)-- \
|
||||
)
|
||||
|
||||
#define arm_foreach(...) \
|
||||
ARM_CONNECT2(ARM_FOREACH, __ARM_VA_NUM_ARGS(__VA_ARGS__))(__VA_ARGS__)
|
||||
|
||||
|
||||
#ifndef ARM_NONNULL
|
||||
# if defined(__IS_COMPILER_ARM_COMPILER_5__) ||\
|
||||
defined(__IS_COMPILER_ARM_COMPILER_6__) ||\
|
||||
defined(__IS_COMPILER_GCC__) ||\
|
||||
defined(__IS_COMPILER_LLVM__)
|
||||
# define ARM_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
# else
|
||||
# define ARM_NONNULL(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ARM_NOINIT
|
||||
# if defined(__IS_COMPILER_ARM_COMPILER_5__)
|
||||
# define ARM_NOINIT __attribute__(( section( ".bss.noinit"),zero_init))
|
||||
# elif defined(__IS_COMPILER_ARM_COMPILER_6__)
|
||||
# define ARM_NOINIT __attribute__(( section( ".bss.noinit")))
|
||||
# elif defined(__IS_COMPILER_IAR__)
|
||||
# define ARM_NOINIT __no_init
|
||||
# elif defined(__IS_COMPILER_GCC__) || defined(__IS_COMPILER_LLVM__)
|
||||
# define ARM_NOINIT __attribute__(( section( ".bss.noinit")))
|
||||
# else
|
||||
# define ARM_NOINIT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ARM_ALIGN
|
||||
# define __ARM_ALIGN(__N) __attribute__((aligned(__N)))
|
||||
# define ARM_ALIGN(__N) __ARM_ALIGN(__N)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __RESTRICT
|
||||
# define __RESTRICT __restrict
|
||||
#endif
|
||||
|
||||
#ifndef __OVERRIDE_WEAK
|
||||
# define __OVERRIDE_WEAK
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief A macro to generate a safe name, usually used in macro template as the
|
||||
* name of local variables
|
||||
*
|
||||
*/
|
||||
#define ARM_2D_SAFE_NAME(...) ARM_CONNECT(__,__LINE__,##__VA_ARGS__)
|
||||
#define arm_2d_safe_name(...) ARM_2D_SAFE_NAME(__VA_ARGS__)
|
||||
|
||||
#undef arm_irq_safe
|
||||
|
||||
/*!
|
||||
* \brief a decoration to make the immediate following code irq-safe
|
||||
*
|
||||
* \code
|
||||
arm_irq_safe {
|
||||
// code inside the brackets are IRQ safe
|
||||
...
|
||||
}
|
||||
|
||||
// the printf is IRQ safe
|
||||
arm_irq_safe printf("IRQ safe printf\n");
|
||||
|
||||
\endcode
|
||||
*/
|
||||
#define arm_irq_safe \
|
||||
arm_using( uint32_t ARM_2D_SAFE_NAME(temp) = \
|
||||
({uint32_t temp=__get_PRIMASK();__disable_irq();temp;}),\
|
||||
__set_PRIMASK(ARM_2D_SAFE_NAME(temp)))
|
||||
|
||||
|
||||
#undef ARM_2D_WRAP_FUNC
|
||||
#undef __ARM_2D_WRAP_FUNC
|
||||
#undef ARM_2D_ORIG_FUNC
|
||||
#undef __ARM_2D_ORIG_FUNC
|
||||
|
||||
#if defined(__IS_COMPILER_ARM_COMPILER_6__)
|
||||
# define __ARM_2D_WRAP_FUNC(__FUNC) $Sub$$##__FUNC
|
||||
# define __ARM_2D_ORIG_FUNC(__FUNC) $Super$$## __FUNC
|
||||
#else
|
||||
# define __ARM_2D_WRAP_FUNC(x) __wrap_ ## x
|
||||
# define __ARM_2D_ORIG_FUNC(x) __real_ ## x
|
||||
#endif
|
||||
|
||||
#define ARM_2D_WRAP_FUNC(__FUNC) __ARM_2D_WRAP_FUNC(__FUNC)
|
||||
#define ARM_2D_ORIG_FUNC(__FUNC) __ARM_2D_ORIG_FUNC(__FUNC)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* List Operations *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/* ALL the parameters passed to following macros must be pointer variables. */
|
||||
|
||||
#define __ARM_LIST_STACK_PUSH(__P_TOP, __P_NODE) \
|
||||
do { \
|
||||
((__arm_slist_node_t *)(__P_NODE))->ptNext = \
|
||||
(__arm_slist_node_t *)(__P_TOP); \
|
||||
(*(__arm_slist_node_t **)&(__P_TOP)) = \
|
||||
(__arm_slist_node_t *)(__P_NODE); \
|
||||
} while(0)
|
||||
#define ARM_LIST_STACK_PUSH(__P_TOP, __P_NODE) \
|
||||
__ARM_LIST_STACK_PUSH((__P_TOP), (__P_NODE))
|
||||
#define ARM_LIST_INSERT_AFTER(__P_TARGET, __P_NODE) \
|
||||
__ARM_LIST_STACK_PUSH((__P_TARGET), (__P_NODE))
|
||||
|
||||
#define __ARM_LIST_STACK_POP(__P_TOP, __P_NODE) \
|
||||
do { \
|
||||
(*(__arm_slist_node_t **)&(__P_NODE)) = \
|
||||
(__arm_slist_node_t *)(__P_TOP); \
|
||||
if (NULL != (__P_TOP)) { \
|
||||
(*(__arm_slist_node_t **)&(__P_TOP)) = \
|
||||
((__arm_slist_node_t *)(__P_NODE))->ptNext; \
|
||||
((__arm_slist_node_t *)(__P_NODE))->ptNext = NULL; \
|
||||
} \
|
||||
} while(0)
|
||||
#define ARM_LIST_STACK_POP(__P_TOP, __P_NODE) \
|
||||
__ARM_LIST_STACK_POP((__P_TOP), (__P_NODE))
|
||||
#define ARM_LIST_REMOVE_AFTER(__P_TARGET, __P_NODE) \
|
||||
ARM_LIST_STACK_POP((__P_TARGET), (__P_NODE))
|
||||
|
||||
|
||||
#define __ARM_LIST_QUEUE_ENQUEUE(__HEAD, __TAIL, __ITEM) \
|
||||
do { \
|
||||
if (NULL == (__TAIL)) { \
|
||||
(*((__arm_slist_node_t **)&(__TAIL))) = \
|
||||
(__arm_slist_node_t *)(__ITEM); \
|
||||
(*((__arm_slist_node_t **)&(__HEAD))) = \
|
||||
(__arm_slist_node_t *)(__ITEM); \
|
||||
} else { \
|
||||
((__arm_slist_node_t *)(__TAIL))->ptNext = \
|
||||
(__arm_slist_node_t *)(__ITEM); \
|
||||
(*(__arm_slist_node_t **)&(__TAIL)) = \
|
||||
(__arm_slist_node_t *)(__ITEM); \
|
||||
} \
|
||||
((__arm_slist_node_t *)(__ITEM))->ptNext = NULL; \
|
||||
} while(0)
|
||||
#define ARM_LIST_QUEUE_ENQUEUE(__HEAD, __TAIL, __ITEM) \
|
||||
__ARM_LIST_QUEUE_ENQUEUE((__HEAD), (__TAIL), (__ITEM))
|
||||
|
||||
#define __ARM_LIST_QUEUE_DEQUEUE(__HEAD, __TAIL, __ITEM) \
|
||||
do { \
|
||||
(*(__arm_slist_node_t **)&(__ITEM)) = (__arm_slist_node_t *)(__HEAD); \
|
||||
if (NULL != (__HEAD)) { \
|
||||
(*(__arm_slist_node_t **)&(__HEAD)) = \
|
||||
((__arm_slist_node_t *)(__HEAD))->ptNext; \
|
||||
if (NULL == (__HEAD)) { \
|
||||
(__TAIL) = NULL; \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define ARM_LIST_QUEUE_DEQUEUE(__HEAD, __TAIL, __ITEM) \
|
||||
__ARM_LIST_QUEUE_DEQUEUE((__HEAD), (__TAIL), (__ITEM))
|
||||
|
||||
#define __ARM_LIST_QUEUE_PEEK(__HEAD, __TAIL, __ITEM) \
|
||||
do { \
|
||||
(*(__arm_slist_node_t **)&(__ITEM)) = (__arm_slist_node_t *)(__HEAD); \
|
||||
} while(0)
|
||||
#define ARM_LIST_QUEUE_PEEK(__HEAD, __TAIL, __ITEM) \
|
||||
__ARM_LIST_QUEUE_PEEK((__HEAD), (__TAIL), (__ITEM)) \
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Definition Template *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#define __def_low_lv_io(__NAME, __SW, ...) \
|
||||
const __arm_2d_low_level_io_t LOW_LEVEL_IO##__NAME = { \
|
||||
.SW = (__arm_2d_io_func_t *)&(__SW), \
|
||||
.HW = (NULL, ##__VA_ARGS__) \
|
||||
}
|
||||
#define def_low_lv_io(__NAME, __SW, ...) \
|
||||
__def_low_lv_io(__NAME, __SW, ##__VA_ARGS__)
|
||||
|
||||
|
||||
#define __ref_low_lv_io(__NAME) &LOW_LEVEL_IO##__NAME
|
||||
#define ref_low_lv_io(__NAME) __ref_low_lv_io(__NAME)
|
||||
|
||||
/*============================ TYPES =========================================*/
|
||||
|
||||
/*!
|
||||
* \brief a type for generic list
|
||||
*
|
||||
* \note to avoid using container_of() operand, please put __arm_slist_node_t
|
||||
* at the beginning of a class/structure
|
||||
*/
|
||||
typedef struct __arm_slist_node_t __arm_slist_node_t;
|
||||
struct __arm_slist_node_t {
|
||||
__arm_slist_node_t *ptNext; //!< the next node
|
||||
};
|
||||
|
||||
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic pop
|
||||
#elif __IS_COMPILER_ARM_COMPILER_5__
|
||||
#elif __IS_COMPILER_GCC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* end of __ARM_2D_UTILS_H__ */
|
||||
|
||||
|
||||
/*! @} */
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Reentrant Macros *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/* un-define macros */
|
||||
#undef ARM_PRIVATE
|
||||
|
||||
|
||||
/* redefine macros */
|
||||
#if defined(__cplusplus)
|
||||
# define ARM_PRIVATE(...) \
|
||||
struct { \
|
||||
__VA_ARGS__ \
|
||||
};
|
||||
|
||||
#elif defined(__ARM_2D_IMPL__) || defined(__IS_COMPILER_IAR__)
|
||||
|
||||
# define ARM_PRIVATE(...) \
|
||||
struct { \
|
||||
__VA_ARGS__ \
|
||||
} __ALIGNED(__alignof__(struct {__VA_ARGS__}));
|
||||
|
||||
#else
|
||||
# define ARM_PRIVATE(...) \
|
||||
uint8_t ARM_CONNECT3(chMask,__LINE__,__COUNTER__) \
|
||||
[sizeof(struct {__VA_ARGS__})] \
|
||||
__ALIGNED(__alignof__(struct {__VA_ARGS__}));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* post un-define macros */
|
||||
|
||||
#undef __ARM_2D_IMPL__
|
||||
|
@ -1,354 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_alpha_blending.inc
|
||||
* Description: c code template for drawing pattern
|
||||
*
|
||||
* $Date: 08. Sept 2021
|
||||
* $Revision: V.1.1.0
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __API_COLOUR
|
||||
# error You have to define __API_COLOUR before using this c template
|
||||
#endif
|
||||
#ifndef __API_INT_TYPE
|
||||
# error You have to define the __API_INT_TYPE before using this c template
|
||||
#endif
|
||||
#ifndef __API_PIXEL_BLENDING
|
||||
# error You have to define __API_PIXEL_BLENDING before using this c template
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#define ____ARM_2D_FUNC(__NAME, __COLOUR) __arm_2d_impl_##__COLOUR##_##__NAME
|
||||
#define ___ARM_2D_FUNC(__NAME, __COLOUR) ____ARM_2D_FUNC(__NAME, __COLOUR)
|
||||
#define __ARM_2D_FUNC(__NAME) ___ARM_2D_FUNC(__NAME, __API_COLOUR)
|
||||
|
||||
#ifndef __PATCH_ALPHA_BLENDING
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(alpha_blending) (__API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
int_fast16_t iHeight = ptCopySize->iHeight;
|
||||
int_fast16_t iWidth = ptCopySize->iWidth;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwRatio += (hwRatio == 255);
|
||||
#endif
|
||||
|
||||
uint16_t hwRatioCompl = 256 - hwRatio;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
__API_PIXEL_BLENDING(pSourceBase++, pTargetBase++, hwRatioCompl);
|
||||
}
|
||||
|
||||
pSourceBase += (iSourceStride - iWidth);
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
extern
|
||||
void __ARM_2D_FUNC(alpha_blending) (__API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
uint_fast16_t hwRatio);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef __PATCH_ALPHA_BLENDING_COLOUR_MASKING
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(alpha_blending_colour_keying)(
|
||||
__API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize,
|
||||
uint_fast16_t hwRatio,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
int_fast16_t iHeight = ptCopySize->iHeight;
|
||||
int_fast16_t iWidth = ptCopySize->iWidth;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwRatio += (hwRatio == 255);
|
||||
#endif
|
||||
|
||||
uint16_t hwRatioCompl = 256 - hwRatio;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
|
||||
if (*pSourceBase != Colour) {
|
||||
__API_PIXEL_BLENDING( pSourceBase, pTargetBase, hwRatioCompl);
|
||||
}
|
||||
pSourceBase++;
|
||||
pTargetBase++;
|
||||
}
|
||||
pSourceBase += (iSourceStride - iWidth);
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
#else
|
||||
extern
|
||||
void __ARM_2D_FUNC(alpha_blending_colour_keying)(
|
||||
__API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize,
|
||||
uint_fast16_t hwRatio,
|
||||
__API_INT_TYPE Colour);
|
||||
#endif
|
||||
|
||||
#ifndef __PATCH_COLOUR_FILLING_WITH_ALPHA
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(colour_filling_with_opacity)(
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour,
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
int_fast16_t iWidth = ptCopySize->iWidth;
|
||||
int_fast16_t iHeight = ptCopySize->iHeight;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwRatio += (hwRatio == 255);
|
||||
#endif
|
||||
|
||||
uint16_t hwRatioCompl = 256 - hwRatio;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++){
|
||||
__API_PIXEL_BLENDING( &Colour, pTargetBase++, hwRatioCompl);
|
||||
}
|
||||
|
||||
pTargetBase += iTargetStride - iWidth;
|
||||
}
|
||||
}
|
||||
#else
|
||||
extern
|
||||
void __ARM_2D_FUNC(colour_filling_with_opacity)(
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour,
|
||||
uint_fast16_t hwRatio);
|
||||
#endif
|
||||
|
||||
#ifndef __PATCH_COLOUR_FILLING_ALPHA_MASK
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(colour_filling_mask)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint8_t *__RESTRICT pchAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
int_fast16_t iHeight = ptCopySize->iHeight;
|
||||
int_fast16_t iWidth = ptCopySize->iWidth;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
uint16_t hwAlpha = 256 - (*pchAlpha++);
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwAlpha -= (hwAlpha == 1);
|
||||
#endif
|
||||
__API_PIXEL_BLENDING(&Colour, pTarget++, hwAlpha);
|
||||
}
|
||||
|
||||
pchAlpha += (iAlphaStride - iWidth);
|
||||
pTarget += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
#else
|
||||
extern
|
||||
void __ARM_2D_FUNC(colour_filling_mask)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint8_t *__RESTRICT pchAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef __PATCH_COLOUR_FILLING_ALPHA_MASK_OPACITY
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(colour_filling_mask_opacity)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint8_t *__RESTRICT pchAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour,
|
||||
uint_fast16_t hwOpacity)
|
||||
{
|
||||
int_fast16_t iHeight = ptCopySize->iHeight;
|
||||
int_fast16_t iWidth = ptCopySize->iWidth;
|
||||
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
uint16_t hwAlpha = 256 - ((*pchAlpha++) * hwOpacity >> 8);
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwAlpha -= (hwAlpha == 2) * 2;
|
||||
#endif
|
||||
|
||||
__API_PIXEL_BLENDING(&Colour, pTarget++, hwAlpha);
|
||||
}
|
||||
|
||||
pchAlpha += (iAlphaStride - iWidth);
|
||||
pTarget += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
#else
|
||||
extern
|
||||
void __ARM_2D_FUNC(colour_filling_mask_opacity)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint8_t *__RESTRICT pchAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour,
|
||||
uint_fast16_t hwOpacity);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef __PATCH_COLOUR_FILLING_CHANNEL_MASK
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(colour_filling_channel_mask)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint32_t *__RESTRICT pwAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
int_fast16_t iHeight = ptCopySize->iHeight;
|
||||
int_fast16_t iWidth = ptCopySize->iWidth;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
uint16_t hwAlpha = 256 - *(uint8_t *)(pwAlpha++);
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwAlpha -= (hwAlpha == 1);
|
||||
#endif
|
||||
|
||||
__API_PIXEL_BLENDING(&Colour, pTarget++, hwAlpha);
|
||||
}
|
||||
|
||||
pwAlpha += (iAlphaStride - iWidth);
|
||||
pTarget += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
#else
|
||||
extern
|
||||
void __ARM_2D_FUNC(colour_filling_channel_mask)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint32_t *__RESTRICT pwAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __PATCH_COLOUR_FILLING_CHANNEL_MASK_OPACITY
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(colour_filling_channel_mask_opacity)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint32_t *__RESTRICT pwAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour,
|
||||
uint_fast16_t hwOpacity)
|
||||
{
|
||||
int_fast16_t iHeight = ptCopySize->iHeight;
|
||||
int_fast16_t iWidth = ptCopySize->iWidth;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
uint16_t hwAlpha = 256 - (*(uint8_t *)(pwAlpha++) * hwOpacity >> 8);
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwAlpha -= (hwAlpha == 2) * 2;
|
||||
#endif
|
||||
|
||||
__API_PIXEL_BLENDING(&Colour, pTarget++, hwAlpha);
|
||||
}
|
||||
|
||||
pwAlpha += (iAlphaStride - iWidth);
|
||||
pTarget += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
#else
|
||||
extern
|
||||
void __ARM_2D_FUNC(colour_filling_channel_mask_opacity)(
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
uint32_t *__RESTRICT pwAlpha,
|
||||
int16_t iAlphaStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour,
|
||||
uint_fast16_t hwOpacity);
|
||||
#endif
|
||||
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#undef __API_COLOUR
|
||||
#undef __API_INT_TYPE
|
||||
#undef __API_PIXEL_BLENDING
|
||||
#undef __PATCH_ALPHA_BLENDING
|
||||
#undef __PATCH_ALPHA_BLENDING_COLOUR_MASKING
|
||||
#undef __PATCH_COLOUR_FILLING_WITH_ALPHA
|
||||
#undef __PATCH_COLOUR_FILLING_CHANNEL_MASK
|
||||
#undef __PATCH_COLOUR_FILLING_ALPHA_MASK
|
||||
#undef __PATCH_COLOUR_FILLING_ALPHA_MASK_OPACITY
|
||||
#undef __PATCH_COLOUR_FILLING_CHANNEL_MASK_OPACITY
|
||||
|
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
@ -1,702 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm-2d_conversion_helium.c
|
||||
* Description: APIs for colour format conversion with Helium acceleration
|
||||
*
|
||||
* $Date: 08. Aug 2022
|
||||
* $Revision: V.0.2.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores with Helium
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#define __ARM_2D_IMPL__
|
||||
|
||||
#include "arm_2d.h"
|
||||
#include "__arm_2d_impl.h"
|
||||
|
||||
#ifdef __ARM_2D_COMPILATION_UNIT
|
||||
#undef __ARM_2D_COMPILATION_UNIT
|
||||
|
||||
#if defined(__ARM_2D_HAS_HELIUM__) && __ARM_2D_HAS_HELIUM__
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
|
||||
# pragma clang diagnostic ignored "-Wcast-qual"
|
||||
# pragma clang diagnostic ignored "-Wcast-align"
|
||||
# pragma clang diagnostic ignored "-Wextra-semi-stmt"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
|
||||
# pragma clang diagnostic ignored "-Wdouble-promotion"
|
||||
# pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-float-conversion"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-conversion"
|
||||
# pragma clang diagnostic ignored "-Wtautological-pointer-compare"
|
||||
# pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma clang diagnostic ignored "-Wsign-compare"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wvector-conversion"
|
||||
# pragma clang diagnostic ignored "-Wundef"
|
||||
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
|
||||
#endif
|
||||
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
|
||||
#include "__arm_2d_utils_helium.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ IMPLEMENTATION ================================*/
|
||||
|
||||
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __MVE_WRAPPER( __arm_2d_impl_cccn888_to_rgb565)(uint32_t *__RESTRICT pwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint16_t *__RESTRICT phwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
int32_t blkCnt;
|
||||
uint32x4_t maskR = vdupq_n_u32(0x001f);
|
||||
uint32x4_t maskG = vdupq_n_u32(0x07e0);
|
||||
uint32x4_t maskB = vdupq_n_u32(0xf800);
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
const uint32_t *pSource = pwSourceBase;
|
||||
uint16_t *pTarget = phwTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
#ifdef USE_MVE_INTRINSICS
|
||||
do {
|
||||
mve_pred16_t tailPred = vctp32q(blkCnt);
|
||||
|
||||
/* load a vector of 4 cccn888 pixels */
|
||||
uint32x4_t vecIn = vld1q_z(pSource, tailPred);
|
||||
/* extract individual channels and place them according */
|
||||
/* to their relative position inside rgb565 */
|
||||
uint32x4_t vecR = (vecIn >> 3) & maskR;
|
||||
uint32x4_t vecG = (vecIn >> 5) & maskG;
|
||||
uint32x4_t vecB = (vecIn >> 8) & maskB;
|
||||
/* merge */
|
||||
uint32x4_t vOut = vecR | vecG | vecB;
|
||||
|
||||
/* store a vector of 4 rgb565 pixels */
|
||||
vstrhq_p_u32(pTarget, vOut, tailPred);
|
||||
|
||||
pSource += 4;
|
||||
pTarget += 4;
|
||||
blkCnt -= 4;
|
||||
}
|
||||
while (blkCnt > 0);
|
||||
#else
|
||||
/* constants allowing to replace right shifts with fixed-point multiplications */
|
||||
/* enabling more beat overlap oportunities and reduce stalls */
|
||||
const int32_t inv_2pow3 = 1 << (31-3); /*1/2^3 in Q.31 */
|
||||
const int32_t inv_2pow5 = 1 << (31-5); /*1/2^5 in Q.31 */
|
||||
const int32_t inv_2pow8 = 1 << (31-8); /*1/2^8 in Q.31 */
|
||||
|
||||
__asm volatile(
|
||||
" wlstp.32 lr, %[loopCnt], 1f \n"
|
||||
/* precompute for allowing filling stalls in the inner loop */
|
||||
/* use vqdmulh to replace shifts to allow overlap with 'AND' */
|
||||
|
||||
/* load a vector of 4 cccn888 pixels */
|
||||
" vldrw.u32 q0, [%[pSource]], #16 \n"
|
||||
/* mimic right shift by 3 */
|
||||
" vqdmulh.s32 q1, q0, %[inv_2pow3] \n"
|
||||
|
||||
".p2align 2 \n"
|
||||
"2: \n"
|
||||
" vand q1, q1, %[maskR] \n"
|
||||
/* mimic right shift by 5 */
|
||||
" vqdmulh.s32 q2, q0, %[inv_2pow5] \n"
|
||||
" vand q2, q2, %[maskG] \n"
|
||||
/* mimic right shift by 8 */
|
||||
" vqdmulh.s32 q3, q0, %[inv_2pow8] \n"
|
||||
/* accumulate R & G */
|
||||
" vorr q2, q1, q2 \n"
|
||||
/* load next vector of 4 cccn888 pixels */
|
||||
" vldrw.u32 q0, [%[pSource]], #16 \n"
|
||||
" vand q3, q3, %[maskB] \n"
|
||||
/* mimic right shift by 3 */
|
||||
" vqdmulh.s32 q1, q0, %[inv_2pow3] \n"
|
||||
/* accumulate B */
|
||||
" vorr q2, q2, q3 \n"
|
||||
/* store a vector of 4 rgb565 pixels */
|
||||
" vstrh.32 q2, [%[pTarget]], #8 \n"
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
: [pSource] "+r"(pSource), [pTarget] "+r" (pTarget)
|
||||
: [loopCnt] "r"(blkCnt), [inv_2pow3] "r" (inv_2pow3),
|
||||
[inv_2pow5] "r" (inv_2pow5), [inv_2pow8] "r" (inv_2pow8),
|
||||
[maskR] "t" (maskR),[maskG] "t" (maskG),[maskB] "t" (maskB)
|
||||
: "q0", "q1", "q2", "q3", "memory", "r14" );
|
||||
#endif
|
||||
|
||||
pwSourceBase += iSourceStride;
|
||||
phwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __MVE_WRAPPER( __arm_2d_impl_rgb565_to_cccn888)(uint16_t *__RESTRICT phwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint32_t *__RESTRICT pwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
int32_t blkCnt;
|
||||
uint32x4_t maskRB = vdupq_n_u32(0xf8);
|
||||
uint32x4_t maskG = vdupq_n_u32(0xfc00);
|
||||
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint16_t *__RESTRICT phwSource = phwSourceBase;
|
||||
uint32_t *__RESTRICT pwTarget = pwTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
#ifdef USE_MVE_INTRINSICS
|
||||
do {
|
||||
mve_pred16_t tailPred = vctp32q(blkCnt);
|
||||
|
||||
/* load a vector of 4 rgb565 pixels */
|
||||
uint32x4_t vecIn = vldrhq_z_u32(phwSource, tailPred);
|
||||
/* extract individual channels and place them according position */
|
||||
uint32x4_t vecR = (vecIn << 3) & maskRB;
|
||||
uint32x4_t vecG = (vecIn << 5) & maskG;
|
||||
uint32x4_t vecB = ((vecIn >> 8) & maskRB) << 16;
|
||||
/* merge and set n channel to 0xff */
|
||||
uint32x4_t vOut = 0xff000000 | vecR | vecG | vecB;
|
||||
|
||||
/* store a vector of 4 cccn888 pixels */
|
||||
vst1q_p(pwTarget, vOut, tailPred);
|
||||
|
||||
phwSource += 4;
|
||||
pwTarget += 4;
|
||||
blkCnt -= 4;
|
||||
}
|
||||
while (blkCnt > 0);
|
||||
|
||||
#else
|
||||
__asm volatile(
|
||||
" wlstp.32 lr, %[loopCnt], 1f \n"
|
||||
/* preload & precompute for allowing filling stalls in the inner loop */
|
||||
/* use vqdmulh & vmul to replace shifts to allow overlap with 'AND' */
|
||||
|
||||
/* load a vector of 4 rgb565 pixels */
|
||||
" vldrh.u32 q0, [%[pSource]], #8 \n"
|
||||
/* mimic left shift by 3 */
|
||||
" vmul.u32 q1, q0, %[two_pow3] \n"
|
||||
".p2align 2 \n"
|
||||
"2: \n"
|
||||
/* mimic left shift by 5 */
|
||||
" vmul.u32 q2, q0, %[two_pow5] \n"
|
||||
" vand q1, q1, %[maskRB] \n"
|
||||
/* mimic right shift by 8 */
|
||||
" vqdmulh.s32 q3, q0, %[inv_2pow8] \n"
|
||||
" vand q2, q2, %[maskG] \n"
|
||||
/* accumulate G & R, use vmla instead of vorr for best overlap */
|
||||
" vmla.u32 q2, q1, %[one] \n"
|
||||
" vand q3, q3, %[maskRB] \n"
|
||||
/* accumulate B + left shift by 16 */
|
||||
" vmla.u32 q2, q3, %[two_pow16] \n"
|
||||
/* load next vector of 4 rgb565 pixels */
|
||||
" vldrh.u32 q0, [%[pSource]], #8 \n"
|
||||
/* merge and set n channel to 0xff */
|
||||
" vorr.i32 q2, #0xff000000 \n"
|
||||
/* mimic left shift by 3 */
|
||||
" vmul.u32 q1, q0, %[two_pow3] \n"
|
||||
/* store a vector of 4 cccn888 pixels */
|
||||
" vstrw.32 q2, [%[pTarget]], #16 \n"
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
: [pSource] "+r"(phwSource), [pTarget] "+r" (pwTarget)
|
||||
: [loopCnt] "r"(blkCnt),[two_pow3] "r" (1<<3), [two_pow5] "r" (1<<5),
|
||||
[two_pow16] "r" (1<<16),[inv_2pow8] "r" (1 << (31-8)),
|
||||
[maskRB] "t" (maskRB),[maskG] "t" (maskG), [one] "r" (1)
|
||||
: "q0", "q1", "q2", "q3", "memory", "r14" );
|
||||
#endif
|
||||
|
||||
phwSourceBase += iSourceStride;
|
||||
pwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __MVE_WRAPPER(__arm_2d_impl_cccn888_to_gray8)(uint32_t *__RESTRICT pwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint8_t *__RESTRICT pchTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
int32_t blkCnt;
|
||||
|
||||
#define ONE_THIRD_Q8 85
|
||||
|
||||
#ifdef USE_MVE_INTRINSICS
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
const uint32_t *pSource = pwSourceBase;
|
||||
uint8_t *pTarget = pchTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
uint8x16_t vone_third = vdupq_n_u8(ONE_THIRD_Q8);
|
||||
|
||||
do {
|
||||
mve_pred16_t tailPred = vctp8q(blkCnt);
|
||||
|
||||
/* load and de-interleave channels from 16 cccn888 pixels */
|
||||
uint8x16x4_t vecIn = vld4q_u8((const uint8_t *) pSource);
|
||||
|
||||
/* Average R,G,B chans : scale by 1/3 and sum */
|
||||
vecIn.val[0] = vrmulhq(vecIn.val[0], vone_third);
|
||||
vecIn.val[0] = vecIn.val[0] + vrmulhq(vecIn.val[1], vone_third);
|
||||
vecIn.val[0] = vecIn.val[0] + vrmulhq(vecIn.val[2], vone_third);
|
||||
|
||||
/* store a vector of 16 gray8 pixels */
|
||||
vstrbq_p_u8(pTarget, vecIn.val[0], tailPred);
|
||||
|
||||
pSource += 16;
|
||||
pTarget += 16;
|
||||
blkCnt -= 16;
|
||||
}
|
||||
while (blkCnt > 0);
|
||||
|
||||
pwSourceBase += iSourceStride;
|
||||
pchTargetBase += iTargetStride;
|
||||
}
|
||||
|
||||
#else
|
||||
if (ptCopySize->iWidth >= 32) {
|
||||
/* use unrolled core loop for image with larger widths */
|
||||
/* because of helium sequence optimization opportunities */
|
||||
|
||||
/* residual size < 32 */
|
||||
int tailCnt = ptCopySize->iWidth & 0x1f;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
const uint32_t *pSource = pwSourceBase;
|
||||
uint8_t *pTarget = pchTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
|
||||
/* de-interleave RGBA channels */
|
||||
/* Core is unrolled to enable overlap between load and scale/accumulate operations */
|
||||
/* handles block of 32-pixels line */
|
||||
__asm volatile(
|
||||
" vld40.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld41.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld42.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld43.8 {q0, q1, q2, q3}, [%[pSource]]! \n"
|
||||
".p2align 2 \n"
|
||||
" wls lr, %[loopCnt], 1f \n"
|
||||
"2: \n"
|
||||
/* overwrite unused Alpha channel */
|
||||
" vmov.i8 q3, %[one_third] \n"
|
||||
/* de-interleave next 16 pixels block */
|
||||
/* load operations interleaved with scale of previously loaded channels */
|
||||
" vld40.8 {q4, q5, q6, q7}, [%[pSource]] \n"
|
||||
" vrmulh.u8 q0, q0, q3 \n"
|
||||
" vld41.8 {q4, q5, q6, q7}, [%[pSource]] \n"
|
||||
" vrmulh.u8 q1, q1, q3 \n"
|
||||
" vld42.8 {q4, q5, q6, q7}, [%[pSource]] \n"
|
||||
" vadd.i8 q0, q0, q1 \n"
|
||||
" vrmulh.u8 q2, q2, q3 \n"
|
||||
" vld43.8 {q4, q5, q6, q7}, [%[pSource]]! \n"
|
||||
" vadd.i8 q0, q0, q2 \n"
|
||||
/* store 16 Gray8 pixels */
|
||||
" vstrb.8 q0, [%[pTarget]], #16 \n"
|
||||
" vmov.i8 q7, %[one_third] \n"
|
||||
" vrmulh.u8 q4, q4, q7 \n"
|
||||
/* de-interleave next 16 pixels block */
|
||||
" vld40.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vrmulh.u8 q5, q5, q7 \n"
|
||||
" vld41.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vadd.i8 q4, q4, q5 \n"
|
||||
" vld42.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vrmulh.u8 q6, q6, q7 \n"
|
||||
" vld43.8 {q0, q1, q2, q3}, [%[pSource]]! \n"
|
||||
" vadd.i8 q4, q4, q6 \n"
|
||||
/* store 16 Gray8 pixels */
|
||||
" vstrb.8 q4, [%[pTarget]], #16 \n"
|
||||
" le lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
/* tail handling for [0-31] pixels residual */
|
||||
/* 1/3 vector constant is in q7 and q0-q3 are already loaded */
|
||||
" wlstp.8 lr, %[tailCnt], 1f \n"
|
||||
"2: \n"
|
||||
" vrmulh.u8 q0, q0, q7 \n"
|
||||
" vrmulh.u8 q1, q1, q7 \n"
|
||||
" vrmulh.u8 q2, q2, q7 \n"
|
||||
" vadd.i8 q0, q0, q1 \n"
|
||||
" vadd.i8 q0, q0, q2 \n"
|
||||
" vstrb.8 q0, [%[pTarget]], #16 \n"
|
||||
" vld40.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld41.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld42.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld43.8 {q0, q1, q2, q3}, [%[pSource]]! \n"
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
:[pSource] "+r"(pSource),[pTarget] "+r"(pTarget)
|
||||
:[loopCnt] "r" (blkCnt / 32),[one_third] "i"(ONE_THIRD_Q8),
|
||||
[tailCnt] "r"(tailCnt)
|
||||
:"q0", "q1", "q2", "q3",
|
||||
"q4", "q5", "q6", "q7",
|
||||
"memory", "r14");
|
||||
|
||||
pwSourceBase += iSourceStride;
|
||||
pchTargetBase += iTargetStride;
|
||||
}
|
||||
} else {
|
||||
/* iWidth lower than 32 */
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
const uint32_t *pSource = pwSourceBase;
|
||||
uint8_t *pTarget = pchTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
|
||||
__asm volatile(
|
||||
" vmov.i8 q4, %[one_third] \n"
|
||||
".p2align 2 \n"
|
||||
" wlstp.8 lr, %[loopCnt], 1f \n"
|
||||
"2: \n"
|
||||
/* de-interleave RGBA channels */
|
||||
" vld40.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld41.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld42.8 {q0, q1, q2, q3}, [%[pSource]] \n"
|
||||
" vld43.8 {q0, q1, q2, q3}, [%[pSource]]! \n"
|
||||
/* scale and sum R,G,B chan */
|
||||
" vrmulh.u8 q0, q0, q4 \n"
|
||||
" vrmulh.u8 q1, q1, q4 \n"
|
||||
" vrmulh.u8 q2, q2, q4 \n"
|
||||
" vadd.i8 q0, q0, q1 \n"
|
||||
" vadd.i8 q0, q0, q2 \n"
|
||||
/* store 16 Gray8 pixels */
|
||||
" vstrb.8 q0, [%[pTarget]], #16 \n"
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
:[pSource] "+r"(pSource),[pTarget] "+r"(pTarget)
|
||||
:[loopCnt] "r" (blkCnt),[one_third] "i"(ONE_THIRD_Q8)
|
||||
:"q0", "q1", "q2", "q3",
|
||||
"q4", "memory", "r14");
|
||||
|
||||
pwSourceBase += iSourceStride;
|
||||
pchTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __MVE_WRAPPER(__arm_2d_impl_rgb565_to_gray8)( uint16_t *__RESTRICT phwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint8_t *__RESTRICT pchTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
#define ONE_THIRD_Q16 21845
|
||||
|
||||
uint16x8_t vone_third = vdupq_n_u16(ONE_THIRD_Q16);
|
||||
int32_t blkCnt;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint16_t *__RESTRICT phwSource = phwSourceBase;
|
||||
uint8_t *__RESTRICT pTarget = pchTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
#ifdef USE_MVE_INTRINSICS
|
||||
|
||||
do {
|
||||
mve_pred16_t tailPred = vctp16q(blkCnt);
|
||||
uint16x8_t R, G, B, vecGray8;
|
||||
|
||||
/* load a vector of 8 rgb565 pixels */
|
||||
uint16x8_t vecIn = vld1q_z_u16(phwSource, tailPred);
|
||||
|
||||
__arm_2d_rgb565_unpack_single_vec(vecIn, &R, &G, &B);
|
||||
|
||||
/* sum R,G,B contributions */
|
||||
vecGray8 = R + G + B;
|
||||
/* average */
|
||||
vecGray8 = vrmulhq(vecGray8, vone_third);
|
||||
|
||||
/* store a vector of 8 x gray8 pixels */
|
||||
vstrbq_p_u16(pTarget, vecGray8, tailPred);
|
||||
|
||||
phwSource += 8;
|
||||
pTarget += 8;
|
||||
blkCnt -= 8;
|
||||
}
|
||||
while (blkCnt > 0);
|
||||
|
||||
#else
|
||||
uint16x8_t vecMaskR = vdupq_n_u16(0x001f);
|
||||
uint16x8_t vecMaskG = vdupq_n_u16(0x003f);
|
||||
|
||||
__asm volatile(
|
||||
/* preload pixel vector + mask R allowing more efficient pipelining */
|
||||
" vldrh.u16 q0, [%[pSource]], #16 \n"
|
||||
/* R ch */
|
||||
" vand q1, q0, %[maskR] \n"
|
||||
|
||||
|
||||
".p2align 2 \n"
|
||||
" wlstp.16 lr, %[loopCnt], 1f \n"
|
||||
"2: \n"
|
||||
/* G ch */
|
||||
" vshr.u16 q3, q0, #5 \n"
|
||||
/* use vmul to replace left shift and allow overlap with vshr */
|
||||
" vmul.u16 q1, q1, %[two_pow3] \n"
|
||||
/* B ch */
|
||||
" vshr.u16 q2, q0, #11 \n"
|
||||
" vmul.u16 q2, q2, %[two_pow3] \n"
|
||||
" vand q0, q3, %[maskG] \n"
|
||||
|
||||
/* summing */
|
||||
" vmla.u16 q2, q0, %[four] \n"
|
||||
" vadd.i16 q2, q1, q2 \n"
|
||||
|
||||
/* load next RGB565 pixel vector */
|
||||
" vldrh.u16 q0, [%[pSource]], #16 \n"
|
||||
/* averaging */
|
||||
" vrmulh.u16 q2, q2, %[vone_third] \n"
|
||||
/* R */
|
||||
" vand q1, q0, %[maskR] \n"
|
||||
/* store 8 Gray8 pixels */
|
||||
" vstrb.16 q2, [%[pTarget]], #8 \n"
|
||||
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
: [pSource] "+r"(phwSource), [pTarget] "+r" (pTarget)
|
||||
: [loopCnt] "r"(blkCnt),[two_pow3] "r" (1<<3),
|
||||
[four] "r" (4),
|
||||
[maskR] "t" (vecMaskR),[maskG] "t" (vecMaskG),
|
||||
[vone_third] "t" (vone_third)
|
||||
: "q0", "q1", "q2", "q3", "memory", "r14" );
|
||||
|
||||
#endif
|
||||
|
||||
phwSourceBase += iSourceStride;
|
||||
pchTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __MVE_WRAPPER(__arm_2d_impl_gray8_to_rgb565)( uint8_t *__RESTRICT pchSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint16_t *__RESTRICT phwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
int32_t blkCnt;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint8_t *__RESTRICT pchSource = pchSourceBase;
|
||||
uint16_t *__RESTRICT pTarget = phwTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
#ifdef USE_MVE_INTRINSICS
|
||||
|
||||
do {
|
||||
mve_pred16_t tailPred = vctp16q(blkCnt);
|
||||
uint16x8_t vecRgb565;
|
||||
|
||||
/* load a vector of 8 gray pixels */
|
||||
uint16x8_t vecGray8 = vldrbq_z_u16(pchSource, tailPred);
|
||||
|
||||
/* replication in all RGB565 components */
|
||||
vecRgb565 =__arm_2d_rgb565_pack_single_vec(vecGray8, vecGray8, vecGray8);
|
||||
|
||||
/* store a vector of 8 x RGB565 pixels */
|
||||
vst1q_p(pTarget, vecRgb565, tailPred);
|
||||
|
||||
pchSource += 8;
|
||||
pTarget += 8;
|
||||
blkCnt -= 8;
|
||||
}
|
||||
while (blkCnt > 0);
|
||||
|
||||
#else
|
||||
|
||||
uint16x8_t vecMaskBpck = vdupq_n_u16(0x00f8);
|
||||
uint16x8_t vecMaskGpck = vdupq_n_u16(0x00fc);
|
||||
|
||||
__asm volatile(
|
||||
".p2align 2 \n"
|
||||
|
||||
/* preload pixel vector + mask G allowing more efficient pipelining */
|
||||
" vldrb.u16 q0, [%[pSource]], #8 \n"
|
||||
/* G ch */
|
||||
" vand q2, q0, %[maskG] \n"
|
||||
|
||||
" wlstp.16 lr, %[loopCnt], 1f \n"
|
||||
"2: \n"
|
||||
/* R ch */
|
||||
" vshr.u16 q1, q0, #3 \n"
|
||||
/* use VMLA to mimick left shift combined with OR */
|
||||
" vmla.u16 q1, q2, %[eight] \n"
|
||||
/* B ch */
|
||||
" vand q2, q0, %[maskB] \n"
|
||||
" vmla.u16 q1, q2, %[twofiftysix] \n"
|
||||
|
||||
/* load next Gray pixel vector */
|
||||
" vldrb.u16 q0, [%[pSource]], #8 \n"
|
||||
/* G ch */
|
||||
" vand q2, q0, %[maskG] \n"
|
||||
/* store 8 RGB565 pixels */
|
||||
" vstrh.16 q1, [%[pTarget]], #16 \n"
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
: [pSource] "+r"(pchSource), [pTarget] "+r" (pTarget)
|
||||
: [loopCnt] "r"(blkCnt),[twofiftysix] "r" (256),
|
||||
[eight] "r" (8),
|
||||
[maskG] "t" (vecMaskGpck),[maskB] "t" (vecMaskBpck)
|
||||
: "q0", "q1", "q2", "q3", "memory", "r14" );
|
||||
#endif
|
||||
|
||||
pchSourceBase += iSourceStride;
|
||||
phwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __MVE_WRAPPER(__arm_2d_impl_gray8_to_cccn888)(uint8_t *__RESTRICT pchSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint32_t *__RESTRICT pwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
int32_t blkCnt;
|
||||
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint8_t *__RESTRICT pchSource = pchSourceBase;
|
||||
uint32_t *__RESTRICT pTarget = pwTargetBase;
|
||||
|
||||
blkCnt = ptCopySize->iWidth;
|
||||
#ifdef USE_MVE_INTRINSICS
|
||||
|
||||
do {
|
||||
mve_pred16_t tailPred = vctp32q(blkCnt);
|
||||
uint32x4_t vecCcn888;
|
||||
|
||||
/* load a vector of 4 gray8 pixels */
|
||||
uint32x4_t vecGray8 = vldrbq_z_u32(pchSource, tailPred);
|
||||
|
||||
/* byte duplication inside 32-bit elements */
|
||||
/* and set alpha chan to 0xff */
|
||||
vecCcn888 = (vecGray8 * 0x00010101) | 0xff000000;
|
||||
|
||||
/* store a vector of 4 x ccc888 pixels */
|
||||
vst1q_p(pTarget, vecCcn888, tailPred);
|
||||
|
||||
pchSource += 4;
|
||||
pTarget += 4;
|
||||
blkCnt -= 4;
|
||||
}
|
||||
while (blkCnt > 0);
|
||||
|
||||
#else
|
||||
int tailCnt = ptCopySize->iWidth & 7;
|
||||
|
||||
__asm volatile(
|
||||
".p2align 2 \n"
|
||||
|
||||
/* preload pixel vector allowing more efficient pipelining */
|
||||
" vldrb.u32 q0, [%[pSource]], #4 \n"
|
||||
|
||||
" wls lr, %[loopCnt], 1f \n"
|
||||
"2: \n"
|
||||
|
||||
" vmul.i32 q0, q0, %[byte_dup_cst] \n"
|
||||
" vldrb.u32 q1, [%[pSource]], #4 \n"
|
||||
" vorr.i32 q0, #0xff000000 \n"
|
||||
/* store 4 CCN888 Gray8 pixels */
|
||||
" vstrw.32 q0, [%[pTarget]], #16 \n"
|
||||
|
||||
" vmul.i32 q1, q1, %[byte_dup_cst] \n"
|
||||
" vldrb.u32 q0, [%[pSource]], #4 \n"
|
||||
" vorr.i32 q1, #0xff000000 \n"
|
||||
/* store 4 CCN888 Gray8 pixels */
|
||||
" vstrw.32 q1, [%[pTarget]], #16 \n"
|
||||
|
||||
" le lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
/* tail handling for [0-7] pixel residual */
|
||||
/* q0 is already loaded */
|
||||
" wlstp.32 lr, %[tailCnt], 1f \n"
|
||||
"2: \n"
|
||||
" vmul.i32 q0, q0, %[byte_dup_cst] \n"
|
||||
" vorr.i32 q0, #0xff000000 \n"
|
||||
/* store 4 CCN888 Gray8 pixels */
|
||||
" vstrw.32 q0, [%[pTarget]], #16 \n"
|
||||
" vldrb.u32 q0, [%[pSource]], #4 \n"
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
: [pSource] "+r"(pchSource), [pTarget] "+r" (pTarget)
|
||||
: [loopCnt] "r"(blkCnt/8),[byte_dup_cst] "r" (0x00010101),
|
||||
[tailCnt] "r" (tailCnt)
|
||||
: "q0", "memory", "r14" );
|
||||
#endif
|
||||
|
||||
pchSourceBase += iSourceStride;
|
||||
pwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __ARM_2D_HAS_HELIUM__
|
||||
|
||||
#endif // __ARM_2D_COMPILATION_UNIT
|
File diff suppressed because it is too large
Load Diff
@ -1,809 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_copy_helium.inc
|
||||
* Description: c code template for copy like operations
|
||||
*
|
||||
* $Date: 12 July 2022
|
||||
* $Revision: v1.0.0
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __API_COLOUR
|
||||
# error You have to define __API_COLOUR before using this c template
|
||||
#endif
|
||||
#ifndef __API_INT_TYPE
|
||||
# error You have to define the __API_INT_TYPE before using this c template
|
||||
#endif
|
||||
#ifndef __API_INT_TYPE_BIT_NUM
|
||||
# error You have to define the __API_INT_TYPE_BIT_NUM before using this c template
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#define ____ARM_2D_FUNC(__NAME, __COLOUR) __MVE_WRAPPER(__arm_2d_impl_##__COLOUR##_##__NAME)
|
||||
#define ___ARM_2D_FUNC(__NAME, __COLOUR) ____ARM_2D_FUNC(__NAME, __COLOUR)
|
||||
#define __ARM_2D_FUNC(__NAME) ___ARM_2D_FUNC(__NAME, __API_COLOUR)
|
||||
|
||||
|
||||
#undef ____ARM_2D_TYPE
|
||||
#undef ___ARM_2D_TYPE
|
||||
#undef __ARM_2D_TYPE
|
||||
#define ____ARM_2D_TYPE(__NAME, __COLOUR) arm_2d_##__COLOUR##_##__NAME
|
||||
#define ___ARM_2D_TYPE(__NAME, __COLOUR) ____ARM_2D_TYPE(__NAME, __COLOUR)
|
||||
#define __ARM_2D_TYPE(__NAME) ___ARM_2D_TYPE(__NAME, __API_COLOUR)
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Paving *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(2x2_paving)(const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(2x2_paving_x_mirror)(const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR,
|
||||
PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(2x2_paving_y_mirror)(const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(2x2_paving_xy_mirror)(const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
|
||||
void __ARM_2D_FUNC(1x2_paving)( const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(1x2_paving_x_mirror)(const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR,
|
||||
PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(1x2_paving_y_mirror)(const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(1x2_paving_xy_mirror)(const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
|
||||
void __ARM_2D_FUNC(2x1_paving)( const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(2x1_paving_x_mirror)(const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR,
|
||||
PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(2x1_paving_y_mirror)(const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(2x1_paving_xy_mirror)(const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
|
||||
void __ARM_2D_FUNC(1x1_paving)(const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(1x1_paving_x_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR, PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(1x1_paving_y_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSrcCopySize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(1x1_paving_xy_mirror)(const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSrcCopySize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM));
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Paving with colour masking *
|
||||
*----------------------------------------------------------------------------*/
|
||||
__OVERRIDE_WEAK
|
||||
|
||||
void __ARM_2D_FUNC(cl_key_2x2_paving)(const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_2x2_paving_x_mirror)(
|
||||
const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR,
|
||||
PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_2x2_paving_y_mirror)(
|
||||
const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_2x2_paving_xy_mirror)(
|
||||
const __API_INT_TYPE *__RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairRows,
|
||||
uint16_t tilePairCols,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
|
||||
void __ARM_2D_FUNC(cl_key_1x2_paving)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_1x2_paving_x_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR,
|
||||
PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_1x2_paving_y_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_1x2_paving_xy_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint32_t destWidth,
|
||||
uint16_t tilePairRows,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x2(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
|
||||
void __ARM_2D_FUNC(cl_key_2x1_paving)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_2x1_paving_x_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR,
|
||||
PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_2x1_paving_y_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_2x1_paving_xy_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSourceSize,
|
||||
__API_INT_TYPE * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
uint16_t tilePairCols,
|
||||
uint16_t destHeight,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_2x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSourceSize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
|
||||
void __ARM_2D_FUNC(cl_key_1x1_paving)(
|
||||
const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_DIRECT_START_OFFS(_, _),
|
||||
PAVING_DIRECT_READ_DIR,
|
||||
PAVING_DIRECT_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_DIRECT_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_1x1_paving_x_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_X_MIRROR_START_OFFS(_, _),
|
||||
PAVING_X_MIRROR_READ_DIR,
|
||||
PAVING_X_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_X_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_1x1_paving_y_mirror)(
|
||||
const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_Y_MIRROR_START_OFFS(iSourceStride, ptSrcCopySize->iHeight),
|
||||
PAVING_Y_MIRROR_READ_DIR,
|
||||
PAVING_Y_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_Y_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_1x1_paving_xy_mirror)(const __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
const arm_2d_size_t * __RESTRICT ptSrcCopySize,
|
||||
const arm_2d_size_t * __RESTRICT ptDstCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_PAVING_1x1(__API_INT_TYPE_BIT_NUM,
|
||||
PAVING_XY_MIRROR_START_OFFS(iSourceStride, ptSrcCopySize->iHeight),
|
||||
PAVING_XY_MIRROR_READ_DIR,
|
||||
PAVING_XY_MIRROR_SETUP_COPY(__API_INT_TYPE_BIT_NUM),
|
||||
PAVING_XY_MIRROR_LOAD_PATTERN(__API_INT_TYPE_BIT_NUM),
|
||||
CMP_CL_MSK(__API_INT_TYPE_BIT_NUM, Colour));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Copy with colour masking *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_copy)(
|
||||
__API_INT_TYPE *__RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_FUNC(cl_key_1x1_paving)( pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize,
|
||||
Colour);
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_copy_y_mirror)(
|
||||
__API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_FUNC(cl_key_1x1_paving_y_mirror)( pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize,
|
||||
Colour);
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_copy_x_mirror)(
|
||||
__API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_FUNC(cl_key_1x1_paving_x_mirror)( pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize,
|
||||
Colour);
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(cl_key_copy_xy_mirror)(
|
||||
__API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
__ARM_2D_FUNC(cl_key_1x1_paving_xy_mirror)( pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize,
|
||||
Colour);
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Copy *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#if __API_INT_TYPE_BIT_NUM == 8
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(copy)( __API_INT_TYPE *__RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
__ARM_2D_FUNC(1x1_paving)( pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Copy with mirroring *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(copy_y_mirror)( __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize)
|
||||
{
|
||||
__ARM_2D_FUNC(1x1_paving_y_mirror)( pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize);
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(copy_x_mirror)(__API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize)
|
||||
{
|
||||
__ARM_2D_FUNC(1x1_paving_x_mirror)( pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize);
|
||||
}
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(copy_xy_mirror)( __API_INT_TYPE * __RESTRICT pSource,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE * __RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize)
|
||||
{
|
||||
__ARM_2D_FUNC(1x1_paving_xy_mirror)(pSource,
|
||||
iSourceStride,
|
||||
pTarget,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ptCopySize);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#undef __API_COLOUR
|
||||
#undef __API_INT_TYPE
|
||||
#undef __API_INT_TYPE_BIT_NUM
|
||||
#undef ____ARM_2D_TYPE
|
||||
#undef ___ARM_2D_TYPE
|
||||
#undef __ARM_2D_TYPE
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,336 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_draw_pattern.inc
|
||||
* Description: c code template for drawing pattern
|
||||
*
|
||||
* $Date: 14. April 2020
|
||||
* $Revision: V.1.0.0
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __API_COLOUR
|
||||
# error You have to define __API_COLOUR before using this c template
|
||||
#endif
|
||||
#ifndef __API_INT_TYPE
|
||||
# error You have to define the __API_INT_TYPE before using this c template
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#define ____ARM_2D_FUNC(__NAME, __COLOUR) __arm_2d_impl_##__COLOUR##_##__NAME
|
||||
#define ___ARM_2D_FUNC(__NAME, __COLOUR) ____ARM_2D_FUNC(__NAME, __COLOUR)
|
||||
#define __ARM_2D_FUNC(__NAME) ___ARM_2D_FUNC(__NAME, __API_COLOUR)
|
||||
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(draw_pattern_fg_only)(uint8_t *__RESTRICT pchSourceBase,
|
||||
int32_t iOffset,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE ForeColour)
|
||||
{
|
||||
//! get in byte offset
|
||||
iOffset &= 0x07;
|
||||
iSourceStride = (iSourceStride + 7) & ~0x07;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
uint8_t *__RESTRICT pchSrc = pchSourceBase;
|
||||
__API_INT_TYPE * __RESTRICT pTarget = pTargetBase;
|
||||
uint8_t chBitMask = _BV(iOffset);
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
|
||||
if ((*pchSrc) & chBitMask) {
|
||||
*pTarget = ForeColour;
|
||||
}
|
||||
|
||||
pTarget++;
|
||||
chBitMask <<= 1;
|
||||
if (!chBitMask) {
|
||||
chBitMask = 1;
|
||||
pchSrc++;
|
||||
}
|
||||
}
|
||||
//chBitMask = 1;
|
||||
|
||||
pchSourceBase += (iSourceStride >> 3);
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(draw_pattern_no_bg_comp)(
|
||||
uint8_t *__RESTRICT pchSourceBase,
|
||||
int32_t iOffset,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
//! get in byte offset
|
||||
iOffset &= 0x07;
|
||||
iSourceStride = (iSourceStride + 7) & ~0x07;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
uint8_t *__RESTRICT pchSrc = pchSourceBase;
|
||||
__API_INT_TYPE * __RESTRICT pTarget = pTargetBase;
|
||||
uint8_t chBitMask = _BV(iOffset);
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
|
||||
if ((*pchSrc) & chBitMask) {
|
||||
*pTarget = ~(*pTarget);
|
||||
}
|
||||
|
||||
pTarget++;
|
||||
chBitMask <<= 1;
|
||||
if (!chBitMask) {
|
||||
chBitMask = 1;
|
||||
pchSrc++;
|
||||
}
|
||||
}
|
||||
chBitMask = 1;
|
||||
|
||||
pchSourceBase += (iSourceStride >> 3);
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(draw_pattern_bg_only)( uint8_t *__RESTRICT pchSourceBase,
|
||||
int32_t iOffset,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE BackColour)
|
||||
{
|
||||
//! get in byte offset
|
||||
iOffset &= 0x07;
|
||||
iSourceStride = (iSourceStride + 7) & ~0x07;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
uint8_t *__RESTRICT pchSrc = pchSourceBase;
|
||||
__API_INT_TYPE * __RESTRICT pTarget = pTargetBase;
|
||||
uint8_t chBitMask = _BV(iOffset);
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
|
||||
if (!((*pchSrc) & chBitMask)) {
|
||||
*pTarget = BackColour;
|
||||
}
|
||||
|
||||
pTarget++;
|
||||
chBitMask <<= 1;
|
||||
if (!chBitMask) {
|
||||
chBitMask = 1;
|
||||
pchSrc++;
|
||||
}
|
||||
}
|
||||
chBitMask = 1;
|
||||
|
||||
pchSourceBase += (iSourceStride >> 3);
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(draw_pattern_bg_fg)( uint8_t *__RESTRICT pchSourceBase,
|
||||
int32_t iOffset,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE ForeColour,
|
||||
__API_INT_TYPE BackColour)
|
||||
{
|
||||
//! get in byte offset
|
||||
iOffset &= 0x07;
|
||||
iSourceStride = (iSourceStride + 7) & ~0x07;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
uint8_t *__RESTRICT pchSrc = pchSourceBase;
|
||||
__API_INT_TYPE * __RESTRICT pTarget = pTargetBase;
|
||||
uint8_t chBitMask = _BV(iOffset);
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
|
||||
if ((*pchSrc) & chBitMask) {
|
||||
*pTarget++ = ForeColour;
|
||||
} else {
|
||||
*pTarget++ = BackColour;
|
||||
}
|
||||
|
||||
chBitMask <<= 1;
|
||||
if (!chBitMask) {
|
||||
chBitMask = 1;
|
||||
pchSrc++;
|
||||
}
|
||||
}
|
||||
chBitMask = 1;
|
||||
|
||||
pchSourceBase += (iSourceStride >> 3);
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(draw_pattern_bg_comp)( uint8_t *__RESTRICT pchSourceBase,
|
||||
int32_t iOffset,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE BackColour)
|
||||
{
|
||||
//! get in byte offset
|
||||
iOffset &= 0x07;
|
||||
iSourceStride = (iSourceStride + 7) & ~0x07;
|
||||
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
uint8_t *__RESTRICT pchSrc = pchSourceBase;
|
||||
__API_INT_TYPE * __RESTRICT pTarget = pTargetBase;
|
||||
uint8_t chBitMask = _BV(iOffset);
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
|
||||
if ((*pchSrc) & chBitMask) {
|
||||
*pTarget = ~(*pTarget);
|
||||
} else {
|
||||
*pTarget = BackColour;
|
||||
}
|
||||
|
||||
pTarget++;
|
||||
chBitMask <<= 1;
|
||||
if (!chBitMask) {
|
||||
chBitMask = 1;
|
||||
pchSrc++;
|
||||
}
|
||||
}
|
||||
chBitMask = 1;
|
||||
|
||||
pchSourceBase += (iSourceStride >> 3);
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(draw_pattern)( uint8_t *__RESTRICT pchSourceBase,
|
||||
int32_t iOffset,
|
||||
int16_t iSourceStride,
|
||||
__API_INT_TYPE *__RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
uint8_t chMode,
|
||||
__API_INT_TYPE ForeColour,
|
||||
__API_INT_TYPE BackColour)
|
||||
{
|
||||
|
||||
switch (chMode & (ARM_2D_DRW_PATN_MODE_NO_FG_COLOR |
|
||||
ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR |
|
||||
ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR)) {
|
||||
|
||||
case 0:
|
||||
//! foreground only
|
||||
__ARM_2D_FUNC(draw_pattern_fg_only)(pchSourceBase,
|
||||
iOffset,
|
||||
iSourceStride,
|
||||
pTargetBase,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ForeColour);
|
||||
break;
|
||||
|
||||
case ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR:
|
||||
//! background + foreground
|
||||
__ARM_2D_FUNC(draw_pattern_bg_fg)( pchSourceBase,
|
||||
iOffset,
|
||||
iSourceStride,
|
||||
pTargetBase,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
ForeColour,
|
||||
BackColour);
|
||||
|
||||
break;
|
||||
|
||||
case ARM_2D_DRW_PATN_MODE_NO_FG_COLOR:
|
||||
//! no foreground, no background, nothing to do
|
||||
break;
|
||||
|
||||
case ARM_2D_DRW_PATN_MODE_NO_FG_COLOR |
|
||||
ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR :
|
||||
//! background only
|
||||
__ARM_2D_FUNC(draw_pattern_bg_only)(pchSourceBase,
|
||||
iOffset,
|
||||
iSourceStride,
|
||||
pTargetBase,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
BackColour);
|
||||
break;
|
||||
|
||||
case ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR:
|
||||
case ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR |
|
||||
ARM_2D_DRW_PATN_MODE_NO_FG_COLOR :
|
||||
//! no background, use complement colour as foreground
|
||||
__ARM_2D_FUNC(draw_pattern_no_bg_comp)( pchSourceBase,
|
||||
iOffset,
|
||||
iSourceStride,
|
||||
pTargetBase,
|
||||
iTargetStride,
|
||||
ptCopySize);
|
||||
break;
|
||||
|
||||
case ARM_2D_DRW_PATN_MODE_NO_FG_COLOR |
|
||||
ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR |
|
||||
ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR :
|
||||
//! background, use complement colour as foreground
|
||||
__ARM_2D_FUNC(draw_pattern_bg_comp)(pchSourceBase,
|
||||
iOffset,
|
||||
iSourceStride,
|
||||
pTargetBase,
|
||||
iTargetStride,
|
||||
ptCopySize,
|
||||
BackColour);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#undef __API_COLOUR
|
||||
#undef __API_INT_TYPE
|
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_fill_colour.inc
|
||||
* Description: c code template for drawing pattern
|
||||
*
|
||||
* $Date: 14. April 2020
|
||||
* $Revision: V.1.0.0
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __API_COLOUR
|
||||
# error You have to define __API_COLOUR before using this c template
|
||||
#endif
|
||||
#ifndef __API_INT_TYPE
|
||||
# error You have to define the __API_INT_TYPE before using this c template
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#define ____ARM_2D_FUNC(__NAME, __COLOUR) __arm_2d_impl_##__COLOUR##_##__NAME
|
||||
#define ___ARM_2D_FUNC(__NAME, __COLOUR) ____ARM_2D_FUNC(__NAME, __COLOUR)
|
||||
#define __ARM_2D_FUNC(__NAME) ___ARM_2D_FUNC(__NAME, __API_COLOUR)
|
||||
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(colour_filling)( __API_INT_TYPE *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
__API_INT_TYPE Colour)
|
||||
{
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++){
|
||||
pTarget[x] = Colour;
|
||||
}
|
||||
pTarget += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#undef __API_COLOUR
|
||||
#undef __API_INT_TYPE
|
@ -1,99 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_fill_colour_helium.inc
|
||||
* Description: Helium code template for drawing pattern
|
||||
*
|
||||
* $Date: 20. Sept 2021
|
||||
* $Revision: V.0.0.1
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __API_COLOUR
|
||||
# error You have to define __API_COLOUR before using this c template
|
||||
#endif
|
||||
|
||||
#ifndef __API_ELT_SZ
|
||||
# error You have to define the __API_ELT_SZ before using this c template
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#define ____ARM_2D_FUNC(__NAME, __COLOUR) __arm_2d_impl_##__COLOUR##_##__NAME
|
||||
#define ___ARM_2D_FUNC(__NAME, __COLOUR) ____ARM_2D_FUNC(__NAME, __COLOUR)
|
||||
#define __ARM_2D_FUNC(__NAME) ___ARM_2D_FUNC(__NAME, __API_COLOUR)
|
||||
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(colour_filling)( ARM_PIX_SCLTYP(__API_ELT_SZ) *__RESTRICT pTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize,
|
||||
ARM_PIX_SCLTYP(__API_ELT_SZ) Colour)
|
||||
{
|
||||
ARM_PIX_VECTYP(__API_ELT_SZ) vColor = ARM_CONNECT2(vdupq_n_u, __API_ELT_SZ)(Colour);
|
||||
|
||||
#ifdef USE_MVE_INTRINSICS
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
int32_t blkCnt = ptCopySize->iWidth;
|
||||
ARM_PIX_SCLTYP(__API_ELT_SZ) *pTargetCur = pTarget;
|
||||
|
||||
while (blkCnt > 0) {
|
||||
mve_pred16_t tailPred = ARM_CONNECT2(ARM_CONNECT2(vctp, __API_ELT_SZ), q)(blkCnt);
|
||||
|
||||
vst1q_p(pTargetCur, vColor, tailPred);
|
||||
|
||||
pTargetCur += ARM_PIX_VECELT(__API_ELT_SZ);
|
||||
blkCnt -= ARM_PIX_VECELT(__API_ELT_SZ);
|
||||
}
|
||||
|
||||
pTarget += iTargetStride;
|
||||
}
|
||||
|
||||
#else
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
int32_t blkCnt = ptCopySize->iWidth;
|
||||
ARM_PIX_SCLTYP(__API_ELT_SZ) *pTargetCur = pTarget;
|
||||
|
||||
__asm volatile(
|
||||
".p2align 2 \n"
|
||||
" wlstp." ARM_TO_STRING(__API_ELT_SZ) " lr, %[loopCnt], 1f \n"
|
||||
"2: \n"
|
||||
" vstrb.u8 %[vColor], [%[pTarget]], #16 \n"
|
||||
" letp lr, 2b \n"
|
||||
"1: \n"
|
||||
|
||||
: [pTarget] "+r" (pTargetCur)
|
||||
: [loopCnt] "r" (blkCnt), [vColor] "t" (vColor)
|
||||
:"memory", "lr");
|
||||
|
||||
pTarget += iTargetStride;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#undef __API_COLOUR
|
||||
#undef __API_ELT_SZ
|
||||
|
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
@ -1,692 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_meta_trans_with_masks.inc
|
||||
* Description: c code template for copy and fill like operations
|
||||
*
|
||||
* $Date: 24. May 2022
|
||||
* $Revision: V.1.1.1
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __API_MTWM_COLOUR
|
||||
# error You have to define __API_MTWM_COLOUR before using this c template
|
||||
#endif
|
||||
#ifndef __API_MTWM_INT_TYPE
|
||||
# error You have to define the __API_MTWM_INT_TYPE before using this c template
|
||||
#endif
|
||||
#ifndef __API_MTWM_INT_TYPE_BIT_NUM
|
||||
# error You have to define the __API_MTWM_INT_TYPE_BIT_NUM before using this c template
|
||||
#endif
|
||||
#ifndef __API_MTWM_PIXEL_BLENDING
|
||||
# error You have to define __API_MTWM_PIXEL_BLENDING before using this c template
|
||||
#endif
|
||||
#ifndef __API_MTWM_PIXEL_AVERAGE
|
||||
# error You have to define __API_MTWM_PIXEL_AVERAGE before using this c template
|
||||
#endif
|
||||
#ifndef __API_MTWM_PIXEL_AVERAGE_RESULT
|
||||
# error You have to define __API_MTWM_PIXEL_AVERAGE_RESULT before using this c template
|
||||
#endif
|
||||
#ifndef __API_MTWM_PIXEL_AVERAGE_INIT
|
||||
# define __API_MTWM_PIXEL_AVERAGE_INIT() __arm_2d_color_fast_rgb_t tPixel = {0};
|
||||
#endif
|
||||
|
||||
|
||||
/*! disable this feature by default */
|
||||
#ifndef __API_MTWM_CFG_SUPPORT_SRC_MSK_WRAPING
|
||||
# define __API_MTWM_CFG_SUPPORT_SRC_MSK_WRAPING 0
|
||||
#endif
|
||||
|
||||
//#ifndef __API_MTWM_CFG_1_HORIZONTAL_LINE
|
||||
//# define __API_MTWM_CFG_1_HORIZONTAL_LINE 0
|
||||
//#endif
|
||||
|
||||
//#ifndef __API_MTWM_CFG_CHANNEL_8in32_SUPPORT
|
||||
//# define __API_MTWM_CFG_CHANNEL_8in32_SUPPORT 0
|
||||
//#endif
|
||||
|
||||
#ifndef __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
# define __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE 0
|
||||
#endif
|
||||
|
||||
//#ifndef __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_TARGET_SIDE
|
||||
//# define __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_TARGET_SIDE 0
|
||||
//#endif
|
||||
|
||||
#ifndef __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
# define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 0
|
||||
#endif
|
||||
|
||||
//#ifndef __API_MTWM_CFG_SUPPORT_TARGET_MASK
|
||||
//# define __API_MTWM_CFG_SUPPORT_TARGET_MASK 0
|
||||
//#endif
|
||||
|
||||
#ifndef __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
# define __API_MTWM_CFG_SUPPORT_OPACITY 0
|
||||
#endif
|
||||
|
||||
#undef ____MTWM_FUNC
|
||||
#undef ___MTWM_FUNC
|
||||
#undef __MTWM_FUNC
|
||||
|
||||
|
||||
|
||||
#ifndef __API_MTWM_OP_NAME
|
||||
# define ____MTWM_FUNC(__NAME, __COLOUR) \
|
||||
__arm_2d_impl_##__COLOUR##_##__NAME
|
||||
# define ___MTWM_FUNC(__NAME, __COLOUR) ____MTWM_FUNC(__NAME, __COLOUR)
|
||||
#else
|
||||
# define _____MTWM_FUNC(__OP_NAME, __NAME, __COLOUR) \
|
||||
__arm_2d_impl_##__COLOUR##_##__OP_NAME##_##__NAME
|
||||
# define ____MTWM_FUNC(__OP_NAME, __NAME, __COLOUR) \
|
||||
_____MTWM_FUNC(__OP_NAME, __NAME, __COLOUR)
|
||||
# define ___MTWM_FUNC(__NAME, __COLOUR) \
|
||||
____MTWM_FUNC(__API_MTWM_OP_NAME, __NAME, __COLOUR)
|
||||
#endif
|
||||
|
||||
#define __MTWM_FUNC(__NAME) ___MTWM_FUNC(__NAME, __API_MTWM_COLOUR)
|
||||
|
||||
|
||||
#undef ____MTWM_TYPE
|
||||
#undef ___MTWM_TYPE
|
||||
#undef __MTWM_TYPE
|
||||
|
||||
#ifndef __API_MTWM_OP_NAME
|
||||
# define ____MTWM_TYPE(__NAME, __COLOUR) arm_2d_##__COLOUR##_##__NAME
|
||||
# define ___MTWM_TYPE(__NAME, __COLOUR) ____MTWM_TYPE(__NAME, __COLOUR)
|
||||
#else
|
||||
# define _____MTWM_TYPE(__OP_NAME, __NAME, __COLOUR) \
|
||||
arm_2d_##__COLOUR##_##__OP_NAME##_##__NAME
|
||||
# define ____MTWM_TYPE(__OP_NAME, __NAME, __COLOUR) \
|
||||
_____MTWM_TYPE(__OP_NAME, __NAME, __COLOUR)
|
||||
# define ___MTWM_TYPE(__NAME, __COLOUR) \
|
||||
____MTWM_TYPE(__API_MTWM_OP_NAME, __NAME, __COLOUR)
|
||||
#endif
|
||||
|
||||
|
||||
#define __MTWM_TYPE(__NAME) ___MTWM_TYPE(__NAME, __API_MTWM_COLOUR)
|
||||
|
||||
#define MASK_COLOR(sz) (sz == 8) ? ptInfo->Mask.chColour : ((sz == 16) ? ptInfo->Mask.hwColour : ptInfo->Mask.wColour)
|
||||
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
extern
|
||||
void __MTWM_FUNC(transform_with_mask)(
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK \
|
||||
|| __API_MTWM_CFG_SUPPORT_TARGET_MASK
|
||||
__arm_2d_param_copy_orig_msk_t *ptThis,
|
||||
#else
|
||||
__arm_2d_param_copy_orig_t *ptParam,
|
||||
#endif
|
||||
__arm_2d_transform_info_t *ptInfo
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
,uint_fast16_t hwOpacity
|
||||
#endif
|
||||
);
|
||||
|
||||
/*============================ IMPLEMENTATION ================================*/
|
||||
|
||||
#if !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
|
||||
static
|
||||
void __MTWM_FUNC(get_pixel_colour_mask)(arm_2d_point_float_t *ptPoint,
|
||||
arm_2d_region_t *ptOrigValidRegion,
|
||||
__API_INT_TYPE *pOrigin,
|
||||
int16_t iOrigStride,
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
uint8_t *pchOrigMask,
|
||||
int16_t iOrigMaskStride,
|
||||
#else
|
||||
__API_INT_TYPE MaskColour,
|
||||
#endif
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
uint16_t hwOpacity,
|
||||
#endif
|
||||
__API_INT_TYPE *pTarget)
|
||||
{
|
||||
#if __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
iOrigMaskStride *= 4;
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__) \
|
||||
&& __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
|
||||
|
||||
arm_2d_location_t tOriginLocation;
|
||||
|
||||
tOriginLocation.iX = ptPoint->fX;
|
||||
tOriginLocation.iY = ptPoint->fY;
|
||||
|
||||
__arm_2d_point_adj_alpha_t tAdjacentArray
|
||||
= __arm_2d_point_get_adjacent_alpha_fp(ptPoint);
|
||||
|
||||
__API_PIXEL_AVERAGE_INIT();
|
||||
|
||||
//__API_INT_TYPE TempPixel;
|
||||
bool bIsInside = false;
|
||||
uint16_t hwTransparency = 0;
|
||||
|
||||
for (int_fast8_t n = 0; n < 4; n++) {
|
||||
uint16_t hwAlpha = tAdjacentArray.tMatrix[n].chAlpha;
|
||||
|
||||
arm_2d_location_t tTemp = {
|
||||
.iX = tOriginLocation.iX + tAdjacentArray.tMatrix[n].tOffset.iX,
|
||||
.iY = tOriginLocation.iY + tAdjacentArray.tMatrix[n].tOffset.iY,
|
||||
};
|
||||
|
||||
uint16_t hwPixelAlpha = 0;
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
__API_INT_TYPE Temp = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
|
||||
#if __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX * 4];
|
||||
#else
|
||||
hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX];
|
||||
#endif
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwPixelAlpha = hwPixelAlpha * hwOpacity >> 8;
|
||||
assert(hwOpacity != 255);
|
||||
#endif
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwPixelAlpha += (hwPixelAlpha == 255);
|
||||
#endif
|
||||
|
||||
hwPixelAlpha = hwPixelAlpha * hwAlpha >> 8;
|
||||
|
||||
__API_MTWM_PIXEL_AVERAGE(Temp, hwPixelAlpha);
|
||||
|
||||
bIsInside = true;
|
||||
#else
|
||||
if (Temp != MaskColour) {
|
||||
bIsInside = true;
|
||||
hwPixelAlpha = hwAlpha;
|
||||
__API_MTWM_PIXEL_AVERAGE(Temp, hwAlpha);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
hwTransparency += hwAlpha - hwPixelAlpha;
|
||||
|
||||
}
|
||||
|
||||
if (bIsInside) {
|
||||
__API_MTWM_PIXEL_AVERAGE(*pTarget, hwTransparency);
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY && !__API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
__API_INT_TYPE tSourcPixel = __API_PIXEL_AVERAGE_RESULT();
|
||||
__API_MTWM_PIXEL_BLENDING( &tSourcPixel, pTarget, hwOpacity);
|
||||
#else
|
||||
*pTarget = __API_PIXEL_AVERAGE_RESULT();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
arm_2d_location_t tTemp;
|
||||
|
||||
tTemp.iX = ptPoint->fX;
|
||||
tTemp.iY = ptPoint->fY;
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
__API_INT_TYPE Temp = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
#if __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
uint16_t hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX * 4];
|
||||
#else
|
||||
uint16_t hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX];
|
||||
#endif
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwPixelAlpha = hwPixelAlpha * hwOpacity >> 8;
|
||||
assert(hwOpacity != 255);
|
||||
#endif
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwPixelAlpha += (hwPixelAlpha == 255);
|
||||
#endif
|
||||
|
||||
__API_MTWM_PIXEL_BLENDING( &Temp, pTarget, hwPixelAlpha);
|
||||
#else
|
||||
|
||||
if (Temp != MaskColour) {
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
__API_MTWM_PIXEL_BLENDING( &Temp, pTarget, hwOpacity);
|
||||
#else
|
||||
*pTarget = Temp;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __MTWM_FUNC(transform_with_mask)(
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK \
|
||||
|| __API_MTWM_CFG_SUPPORT_TARGET_MASK
|
||||
__arm_2d_param_copy_orig_msk_t *ptThis,
|
||||
#else
|
||||
__arm_2d_param_copy_orig_t *ptParam,
|
||||
#endif
|
||||
__arm_2d_transform_info_t *ptInfo
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
,uint_fast16_t hwOpacity
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK \
|
||||
|| __API_MTWM_CFG_SUPPORT_TARGET_MASK
|
||||
__arm_2d_param_copy_orig_t *ptParam =
|
||||
&(ptThis->use_as____arm_2d_param_copy_orig_t);
|
||||
#endif
|
||||
|
||||
int_fast16_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int_fast16_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int_fast16_t iTargetStride = ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
|
||||
int_fast16_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
uint8_t *pOriginMask = this.tOrigMask.pBuffer;
|
||||
int_fast16_t iOrigMaskStride = this.tOrigMask.iStride;
|
||||
#else
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_MTWM_INT_TYPE_BIT_NUM);
|
||||
#endif
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwOpacity += (hwOpacity == 255);
|
||||
#endif
|
||||
|
||||
float fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset = ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
float invIWidth = iWidth > 1 ? 1.0f / (float) (iWidth - 1) : __LARGEINVF32;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
&(ptInfo->tCenter),
|
||||
regrCoefs);
|
||||
|
||||
/* slopes between 1st and last cols */
|
||||
float slopeY, slopeX;
|
||||
|
||||
slopeY = (regrCoefs[1].interceptY - regrCoefs[0].interceptY) * invIWidth;
|
||||
slopeX = (regrCoefs[1].interceptX - regrCoefs[0].interceptX) * invIWidth;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates (intercepts for regression in X direction */
|
||||
float colFirstY = regrCoefs[0].slopeY * y + regrCoefs[0].interceptY;
|
||||
float colFirstX = regrCoefs[0].slopeX * y + regrCoefs[0].interceptX;
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
arm_2d_point_float_t tPoint;
|
||||
|
||||
/* linear interpolation thru first & last cols */
|
||||
tPoint.fX = colFirstX + slopeX * x;
|
||||
tPoint.fY = colFirstY + slopeY * x;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__)
|
||||
if (tPoint.fX > 0) {
|
||||
tPoint.fX += __CALIB;
|
||||
} else {
|
||||
tPoint.fX -= __CALIB;
|
||||
}
|
||||
if (tPoint.fY > 0) {
|
||||
tPoint.fY += __CALIB;
|
||||
} else {
|
||||
tPoint.fY -= __CALIB;
|
||||
}
|
||||
#endif
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour_mask)(
|
||||
&tPoint,
|
||||
&ptParam->tOrigin.tValidRegion,
|
||||
ptParam->tOrigin.pBuffer,
|
||||
iOrigStride,
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
pOriginMask,
|
||||
iOrigMaskStride,
|
||||
#else
|
||||
MaskColour,
|
||||
#endif
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwOpacity,
|
||||
#endif
|
||||
pTargetBase
|
||||
);
|
||||
pTargetBase++;
|
||||
}
|
||||
//phwSourceBase += (iSourceStride - iWidth);
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ */
|
||||
|
||||
static
|
||||
void __MTWM_FUNC(get_pixel_colour_mask)(arm_2d_point_fx_t *ptFxPoint,
|
||||
arm_2d_region_t *ptOrigValidRegion,
|
||||
__API_INT_TYPE *pOrigin,
|
||||
int16_t iOrigStride,
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
uint8_t *pchOrigMask,
|
||||
int16_t iOrigMaskStride,
|
||||
#else
|
||||
__API_INT_TYPE MaskColour,
|
||||
#endif
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
uint16_t hwOpacity,
|
||||
#endif
|
||||
__API_INT_TYPE *pTarget
|
||||
)
|
||||
{
|
||||
#if __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
iOrigMaskStride *= 4;
|
||||
#endif
|
||||
#if defined(__ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__) \
|
||||
&& __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
|
||||
|
||||
arm_2d_location_t tOriginLocation = {
|
||||
.iX = ptFxPoint->X >> 16,
|
||||
.iY = ptFxPoint->Y >> 16,
|
||||
};
|
||||
|
||||
__arm_2d_point_adj_alpha_t tAdjacentArray
|
||||
= __arm_2d_point_get_adjacent_alpha_q16(ptFxPoint);
|
||||
|
||||
__API_PIXEL_AVERAGE_INIT();
|
||||
|
||||
//__API_INT_TYPE TempPixel;
|
||||
bool bIsInside = false;
|
||||
uint16_t hwTransparency = 0;
|
||||
|
||||
for (int_fast8_t n = 0; n < 4; n++) {
|
||||
uint16_t hwAlpha = tAdjacentArray.tMatrix[n].chAlpha;
|
||||
|
||||
arm_2d_location_t tTemp = {
|
||||
.iX = tOriginLocation.iX + tAdjacentArray.tMatrix[n].tOffset.iX,
|
||||
.iY = tOriginLocation.iY + tAdjacentArray.tMatrix[n].tOffset.iY,
|
||||
};
|
||||
//TempPixel = (*pTarget);
|
||||
uint16_t hwPixelAlpha = 0;
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
|
||||
__API_INT_TYPE Temp = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
|
||||
#if __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX * 4];
|
||||
#else
|
||||
hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX];
|
||||
#endif
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwPixelAlpha = hwPixelAlpha * hwOpacity >> 8;
|
||||
assert(hwOpacity != 255);
|
||||
#endif
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwPixelAlpha += (hwPixelAlpha == 255);
|
||||
#endif
|
||||
|
||||
hwPixelAlpha = hwPixelAlpha * hwAlpha >> 8;
|
||||
|
||||
__API_MTWM_PIXEL_AVERAGE(Temp, hwPixelAlpha);
|
||||
|
||||
bIsInside = true;
|
||||
#else
|
||||
if (Temp != MaskColour) {
|
||||
bIsInside = true;
|
||||
hwPixelAlpha = hwAlpha;
|
||||
__API_MTWM_PIXEL_AVERAGE(Temp, hwAlpha);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
hwTransparency += hwAlpha - hwPixelAlpha;
|
||||
}
|
||||
|
||||
if (bIsInside) {
|
||||
__API_MTWM_PIXEL_AVERAGE(*pTarget, hwTransparency);
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY && !__API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
__API_INT_TYPE tSourcPixel = __API_PIXEL_AVERAGE_RESULT();
|
||||
__API_MTWM_PIXEL_BLENDING( &tSourcPixel, pTarget, hwOpacity);
|
||||
#else
|
||||
*pTarget = __API_PIXEL_AVERAGE_RESULT();
|
||||
#endif
|
||||
|
||||
}
|
||||
#else
|
||||
|
||||
arm_2d_location_t tTemp;
|
||||
|
||||
tTemp.iX = ptFxPoint->X >> 16;
|
||||
tTemp.iY = ptFxPoint->Y >> 16;
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
__API_INT_TYPE Temp = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
#if __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
uint16_t hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX * 4];
|
||||
#else
|
||||
uint16_t hwPixelAlpha = pchOrigMask[tTemp.iY * iOrigMaskStride
|
||||
+ tTemp.iX];
|
||||
#endif
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwPixelAlpha = hwPixelAlpha * hwOpacity >> 8;
|
||||
assert(hwOpacity != 255);
|
||||
#endif
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwPixelAlpha += (hwPixelAlpha == 255);
|
||||
#endif
|
||||
|
||||
__API_MTWM_PIXEL_BLENDING( &Temp, pTarget, hwPixelAlpha);
|
||||
#else
|
||||
|
||||
if (Temp != MaskColour) {
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
__API_MTWM_PIXEL_BLENDING( &Temp, pTarget, hwOpacity);
|
||||
#else
|
||||
*pTarget = Temp;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
__WEAK
|
||||
__WEAK
|
||||
void __MTWM_FUNC(transform_with_mask)(
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK \
|
||||
|| __API_MTWM_CFG_SUPPORT_TARGET_MASK
|
||||
__arm_2d_param_copy_orig_msk_t *ptThis,
|
||||
#else
|
||||
__arm_2d_param_copy_orig_t *ptParam,
|
||||
#endif
|
||||
__arm_2d_transform_info_t *ptInfo
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
,uint_fast16_t hwOpacity
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK \
|
||||
|| __API_MTWM_CFG_SUPPORT_TARGET_MASK
|
||||
__arm_2d_param_copy_orig_t *ptParam =
|
||||
&(ptThis->use_as____arm_2d_param_copy_orig_t);
|
||||
#endif
|
||||
|
||||
int_fast16_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int_fast16_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int_fast16_t iTargetStride = ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int_fast16_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
uint8_t *pOriginMask = this.tOrigMask.pBuffer;
|
||||
int_fast16_t iOrigMaskStride = this.tOrigMask.iStride;
|
||||
#else
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_MTWM_INT_TYPE_BIT_NUM);
|
||||
#endif
|
||||
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwOpacity += (hwOpacity == 255);
|
||||
#endif
|
||||
|
||||
float fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset = ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
q31_t invIWidth = iWidth > 1 ? 0x7fffffff / (iWidth - 1) : 0x7fffffff;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
&(ptInfo->tCenter),
|
||||
regrCoefs);
|
||||
|
||||
/* slopes between 1st and last cols */
|
||||
int32_t slopeY, slopeX;
|
||||
|
||||
slopeY =
|
||||
MULTFX((regrCoefs[1].interceptY - regrCoefs[0].interceptY), invIWidth);
|
||||
slopeX =
|
||||
MULTFX((regrCoefs[1].interceptX - regrCoefs[0].interceptX), invIWidth);
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates */
|
||||
int32_t colFirstY =
|
||||
__QADD((regrCoefs[0].slopeY * y), regrCoefs[0].interceptY);
|
||||
int32_t colFirstX =
|
||||
__QADD((regrCoefs[0].slopeX * y), regrCoefs[0].interceptX);
|
||||
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
arm_2d_point_fx_t tPointFast;
|
||||
|
||||
tPointFast.X = __QDADD(colFirstX, slopeX * x);
|
||||
tPointFast.Y = __QDADD(colFirstY, slopeY * x);
|
||||
|
||||
#define __CALIBFX 590
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__)
|
||||
if (tPointFast.X > 0) {
|
||||
tPointFast.X += __CALIBFX;
|
||||
} else {
|
||||
tPointFast.X -= __CALIBFX;
|
||||
}
|
||||
if (tPointFast.Y > 0) {
|
||||
tPointFast.Y += __CALIBFX;
|
||||
} else {
|
||||
tPointFast.Y -= __CALIBFX;
|
||||
}
|
||||
#endif
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour_mask)(
|
||||
&tPointFast,
|
||||
&ptParam->tOrigin.tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
#if __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
pOriginMask,
|
||||
iOrigMaskStride,
|
||||
#else
|
||||
MaskColour,
|
||||
#endif
|
||||
#if __API_MTWM_CFG_SUPPORT_OPACITY
|
||||
hwOpacity,
|
||||
#endif
|
||||
pTargetBase
|
||||
);
|
||||
pTargetBase++;
|
||||
}
|
||||
//phwSourceBase += (iSourceStride - iWidth);
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ */
|
||||
|
||||
|
||||
|
||||
|
||||
#undef get_pixel_colour_mask
|
||||
#undef transform_with_mask
|
||||
|
||||
|
||||
#undef __API_MTWM_COPY_LIKE_OP_NAME
|
||||
#undef __API_MTWM_OP_NAME
|
||||
#undef __API_MTWM_PIXEL_BLENDING
|
||||
#undef ____MTWM_FUNC
|
||||
#undef ___MTWM_FUNC
|
||||
#undef __MTWM_FUNC
|
||||
#undef __API_MTWM_COLOUR
|
||||
#undef __API_MTWM_INT_TYPE
|
||||
#undef __API_MTWM_INT_TYPE_BIT_NUM
|
||||
#undef ____MTWM_TYPE
|
||||
#undef ___MTWM_TYPE
|
||||
#undef __MTWM_TYPE
|
||||
#undef __API_MTWM_CFG_SUPPORT_SRC_MSK_WRAPING
|
||||
#undef __API_MTWM_CFG_1_HORIZONTAL_LINE
|
||||
#undef __API_MTWM_CFG_CHANNEL_8in32_SUPPORT
|
||||
#undef __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE
|
||||
#undef __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_TARGET_SIDE
|
||||
#undef __API_MTWM_PIXEL_AVERAGE
|
||||
#undef __API_MTWM_PIXEL_AVERAGE_RESULT
|
||||
#undef __API_MTWM_PIXEL_AVERAGE_INIT
|
||||
#undef __API_MTWM_CFG_SUPPORT_SOURCE_MASK
|
||||
#undef __API_MTWM_CFG_SUPPORT_TARGET_MASK
|
||||
#undef __API_MTWM_CFG_SUPPORT_OPACITY
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,820 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_fill_colour.inc
|
||||
* Description: c code template for drawing pattern
|
||||
*
|
||||
* $Date: 20. May 2022
|
||||
* $Revision: V.1.1.1
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef __API_COLOUR
|
||||
# error You have to define __API_COLOUR before using this c template
|
||||
#endif
|
||||
#ifndef __API_INT_TYPE
|
||||
# error You have to define the __API_INT_TYPE before using this c template
|
||||
#endif
|
||||
#ifndef __API_INT_TYPE_BIT_NUM
|
||||
# error You have to define the __API_INT_TYPE_BIT_NUM before using this c template
|
||||
#endif
|
||||
#ifndef __API_PIXEL_BLENDING
|
||||
# error You have to define __API_PIXEL_BLENDING before using this c template
|
||||
#endif
|
||||
#ifndef __API_PIXEL_AVERAGE
|
||||
# error You have to define __API_PIXEL_AVERAGE before using this c template
|
||||
#endif
|
||||
#ifndef __API_PIXEL_AVERAGE_RESULT
|
||||
# error You have to define __API_PIXEL_AVERAGE_RESULT before using this c template
|
||||
#endif
|
||||
#ifndef __API_PIXEL_AVERAGE_INIT
|
||||
# define __API_PIXEL_AVERAGE_INIT() __arm_2d_color_fast_rgb_t tPixel = {0};
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#define ____ARM_2D_FUNC(__NAME, __COLOUR) __arm_2d_impl_##__COLOUR##_##__NAME
|
||||
#define ___ARM_2D_FUNC(__NAME, __COLOUR) ____ARM_2D_FUNC(__NAME, __COLOUR)
|
||||
#define __ARM_2D_FUNC(__NAME) ___ARM_2D_FUNC(__NAME, __API_COLOUR)
|
||||
|
||||
#define MASK_COLOR(sz) (sz == 8) ? ptInfo->Mask.chColour : ((sz == 16) ? ptInfo->Mask.hwColour : ptInfo->Mask.wColour)
|
||||
|
||||
static
|
||||
arm_2d_point_float_t *__arm_2d_transform_point(
|
||||
const arm_2d_location_t *ptLocation,
|
||||
const arm_2d_location_t *ptCenter,
|
||||
float fAngle,
|
||||
float fScale,
|
||||
arm_2d_point_float_t *ptOutBuffer);
|
||||
|
||||
static
|
||||
void __arm_2d_transform_regression( arm_2d_size_t * __RESTRICT ptCopySize,
|
||||
arm_2d_location_t * pSrcPoint,
|
||||
float fAngle,
|
||||
float fScale,
|
||||
arm_2d_location_t * tOffset,
|
||||
arm_2d_location_t * ptCenter,
|
||||
arm_2d_rot_linear_regr_t regrCoefs[]);
|
||||
|
||||
|
||||
/*! \note Please only set this to zero for function correctness verification of
|
||||
*! __arm_2d_meta_trans_with_masks.inc
|
||||
*/
|
||||
#if 1
|
||||
|
||||
extern
|
||||
void __ARM_2D_FUNC(transform)( __arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo);
|
||||
|
||||
extern
|
||||
void __ARM_2D_FUNC(transform_with_opacity)(__arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo,
|
||||
uint_fast16_t hwRatio);
|
||||
|
||||
#if !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
|
||||
static
|
||||
void __ARM_2D_FUNC(get_pixel_colour)( arm_2d_point_float_t *ptPoint,
|
||||
arm_2d_region_t *ptOrigValidRegion,
|
||||
__API_INT_TYPE *pOrigin,
|
||||
int16_t iOrigStride,
|
||||
//arm_2d_location_t *ptTargetPoint,
|
||||
//arm_2d_region_t *ptTargetValidRegion,
|
||||
__API_INT_TYPE *pTarget,
|
||||
//int16_t iTargetSride,
|
||||
__API_INT_TYPE MaskColour)
|
||||
{
|
||||
#if defined(__ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__) \
|
||||
&& __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
|
||||
|
||||
arm_2d_location_t tOriginLocation;
|
||||
|
||||
tOriginLocation.iX = ptPoint->fX;
|
||||
tOriginLocation.iY = ptPoint->fY;
|
||||
|
||||
__arm_2d_point_adj_alpha_t tAdjacentArray
|
||||
= __arm_2d_point_get_adjacent_alpha_fp(ptPoint);
|
||||
|
||||
__API_PIXEL_AVERAGE_INIT();
|
||||
|
||||
__API_INT_TYPE TempPixel;
|
||||
bool bIsInside = false;
|
||||
|
||||
for (int_fast8_t n = 0; n < 4; n++) {
|
||||
uint16_t hwAlpha = tAdjacentArray.tMatrix[n].chAlpha;
|
||||
|
||||
arm_2d_location_t tTemp = {
|
||||
.iX = tOriginLocation.iX + tAdjacentArray.tMatrix[n].tOffset.iX,
|
||||
.iY = tOriginLocation.iY + tAdjacentArray.tMatrix[n].tOffset.iY,
|
||||
};
|
||||
TempPixel = (*pTarget);
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
|
||||
__API_INT_TYPE OriginPixel = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
if (OriginPixel != MaskColour) {
|
||||
bIsInside = true;
|
||||
TempPixel = OriginPixel;
|
||||
}
|
||||
}
|
||||
|
||||
__API_PIXEL_AVERAGE(TempPixel, hwAlpha);
|
||||
}
|
||||
|
||||
if (bIsInside) {
|
||||
(*pTarget) = __API_PIXEL_AVERAGE_RESULT();
|
||||
}
|
||||
|
||||
#else
|
||||
arm_2d_location_t tOriginLocation;
|
||||
|
||||
tOriginLocation.iX = ptPoint->fX;
|
||||
tOriginLocation.iY = ptPoint->fY;
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tOriginLocation)) {
|
||||
__API_INT_TYPE Temp = pOrigin[ tOriginLocation.iY * iOrigStride
|
||||
+ tOriginLocation.iX];
|
||||
if (Temp != MaskColour) {
|
||||
*pTarget = Temp;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(transform)( __arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo)
|
||||
{
|
||||
int_fast16_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int_fast16_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int_fast16_t iTargetStride = ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
int_fast16_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
|
||||
float fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset = ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
float invIWidth = iWidth > 1 ? 1.0f / (float) (iWidth - 1) : __LARGEINVF32;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
&(ptInfo->tCenter),
|
||||
regrCoefs);
|
||||
|
||||
/* slopes between 1st and last cols */
|
||||
float slopeY, slopeX;
|
||||
|
||||
slopeY = (regrCoefs[1].interceptY - regrCoefs[0].interceptY) * invIWidth;
|
||||
slopeX = (regrCoefs[1].interceptX - regrCoefs[0].interceptX) * invIWidth;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates (intercepts for regression in X direction */
|
||||
float colFirstY = regrCoefs[0].slopeY * y + regrCoefs[0].interceptY;
|
||||
float colFirstX = regrCoefs[0].slopeX * y + regrCoefs[0].interceptX;
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
arm_2d_point_float_t tPoint;
|
||||
|
||||
/* linear interpolation thru first & last cols */
|
||||
tPoint.fX = colFirstX + slopeX * x;
|
||||
tPoint.fY = colFirstY + slopeY * x;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__)
|
||||
if (tPoint.fX > 0) {
|
||||
tPoint.fX += __CALIB;
|
||||
} else {
|
||||
tPoint.fX -= __CALIB;
|
||||
}
|
||||
if (tPoint.fY > 0) {
|
||||
tPoint.fY += __CALIB;
|
||||
} else {
|
||||
tPoint.fY -= __CALIB;
|
||||
}
|
||||
#endif
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour)(
|
||||
&tPoint,
|
||||
&ptParam->tOrigin.tValidRegion,
|
||||
ptParam->tOrigin.pBuffer,
|
||||
iOrigStride,
|
||||
|
||||
pTargetBase,
|
||||
//iTargetStride,
|
||||
MaskColour
|
||||
);
|
||||
pTargetBase++;
|
||||
}
|
||||
//phwSourceBase += (iSourceStride - iWidth);
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ */
|
||||
|
||||
static
|
||||
void __ARM_2D_FUNC(get_pixel_colour)( arm_2d_point_fx_t *ptFxPoint,
|
||||
arm_2d_region_t *ptOrigValidRegion,
|
||||
__API_INT_TYPE *pOrigin,
|
||||
int16_t iOrigStride,
|
||||
__API_INT_TYPE *pTarget,
|
||||
//int16_t iTargetSride,
|
||||
__API_INT_TYPE MaskColour)
|
||||
{
|
||||
#if defined(__ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__) \
|
||||
&& __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
|
||||
|
||||
arm_2d_location_t tOriginLocation = {
|
||||
.iX = ptFxPoint->X >> 16,
|
||||
.iY = ptFxPoint->Y >> 16,
|
||||
};
|
||||
|
||||
__arm_2d_point_adj_alpha_t tAdjacentArray
|
||||
= __arm_2d_point_get_adjacent_alpha_q16(ptFxPoint);
|
||||
|
||||
__API_PIXEL_AVERAGE_INIT();
|
||||
|
||||
__API_INT_TYPE TempPixel;
|
||||
bool bIsInside = false;
|
||||
|
||||
for (int_fast8_t n = 0; n < 4; n++) {
|
||||
uint16_t hwAlpha = tAdjacentArray.tMatrix[n].chAlpha;
|
||||
|
||||
arm_2d_location_t tTemp = {
|
||||
.iX = tOriginLocation.iX + tAdjacentArray.tMatrix[n].tOffset.iX,
|
||||
.iY = tOriginLocation.iY + tAdjacentArray.tMatrix[n].tOffset.iY,
|
||||
};
|
||||
TempPixel = (*pTarget);
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
|
||||
__API_INT_TYPE Temp = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
if (Temp != MaskColour) {
|
||||
bIsInside = true;
|
||||
TempPixel = Temp;
|
||||
}
|
||||
}
|
||||
|
||||
__API_PIXEL_AVERAGE(TempPixel, hwAlpha);
|
||||
}
|
||||
|
||||
if (bIsInside) {
|
||||
*pTarget = __API_PIXEL_AVERAGE_RESULT();
|
||||
}
|
||||
#else
|
||||
arm_2d_location_t tPoint = {
|
||||
.iX = ptFxPoint->X >> 16,
|
||||
.iY = ptFxPoint->Y >> 16,
|
||||
};
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tPoint)) {
|
||||
__API_INT_TYPE Temp = pOrigin[ tPoint.iY * iOrigStride
|
||||
+ tPoint.iX];
|
||||
if (Temp != MaskColour) {
|
||||
*pTarget = Temp;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(transform)( __arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo)
|
||||
{
|
||||
int_fast16_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int_fast16_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int_fast16_t iTargetStride = ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int_fast16_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
float fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset = ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
q31_t invIWidth = iWidth > 1 ? 0x7fffffff / (iWidth - 1) : 0x7fffffff;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
&(ptInfo->tCenter),
|
||||
regrCoefs);
|
||||
|
||||
/* slopes between 1st and last cols */
|
||||
int32_t slopeY, slopeX;
|
||||
|
||||
slopeY =
|
||||
MULTFX((regrCoefs[1].interceptY - regrCoefs[0].interceptY), invIWidth);
|
||||
slopeX =
|
||||
MULTFX((regrCoefs[1].interceptX - regrCoefs[0].interceptX), invIWidth);
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates */
|
||||
int32_t colFirstY =
|
||||
__QADD((regrCoefs[0].slopeY * y), regrCoefs[0].interceptY);
|
||||
int32_t colFirstX =
|
||||
__QADD((regrCoefs[0].slopeX * y), regrCoefs[0].interceptX);
|
||||
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
arm_2d_point_fx_t tPointFast;
|
||||
|
||||
tPointFast.X = __QDADD(colFirstX, slopeX * x);
|
||||
tPointFast.Y = __QDADD(colFirstY, slopeY * x);
|
||||
|
||||
#define __CALIBFX 590
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__)
|
||||
if (tPointFast.X > 0) {
|
||||
tPointFast.X += __CALIBFX;
|
||||
} else {
|
||||
tPointFast.X -= __CALIBFX;
|
||||
}
|
||||
if (tPointFast.Y > 0) {
|
||||
tPointFast.Y += __CALIBFX;
|
||||
} else {
|
||||
tPointFast.Y -= __CALIBFX;
|
||||
}
|
||||
#endif
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour)(
|
||||
&tPointFast,
|
||||
&ptParam->tOrigin.tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBase,
|
||||
//iTargetStride,
|
||||
MaskColour
|
||||
);
|
||||
pTargetBase++;
|
||||
}
|
||||
//phwSourceBase += (iSourceStride - iWidth);
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
static
|
||||
void __ARM_2D_FUNC(get_pixel_colour_with_alpha)(
|
||||
arm_2d_point_float_t *ptPoint,
|
||||
arm_2d_region_t *ptOrigValidRegion,
|
||||
__API_INT_TYPE *pOrigin,
|
||||
int16_t iOrigStride,
|
||||
__API_INT_TYPE *pTarget,
|
||||
//int16_t iTargetSride,
|
||||
__API_INT_TYPE MaskColour,
|
||||
uint_fast16_t hwOpacity)
|
||||
{
|
||||
#if defined(__ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__) \
|
||||
&& __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
|
||||
arm_2d_location_t tOriginLocation;
|
||||
|
||||
tOriginLocation.iX = ptPoint->fX;
|
||||
tOriginLocation.iY = ptPoint->fY;
|
||||
|
||||
__arm_2d_point_adj_alpha_t tAdjacentArray
|
||||
= __arm_2d_point_get_adjacent_alpha_fp(ptPoint);
|
||||
|
||||
__API_PIXEL_AVERAGE_INIT();
|
||||
|
||||
__API_INT_TYPE TempPixel;
|
||||
bool bIsInside = false;
|
||||
|
||||
for (int_fast8_t n = 0; n < 4; n++) {
|
||||
uint16_t hwAlpha = tAdjacentArray.tMatrix[n].chAlpha;
|
||||
|
||||
arm_2d_location_t tTemp = {
|
||||
.iX = tOriginLocation.iX + tAdjacentArray.tMatrix[n].tOffset.iX,
|
||||
.iY = tOriginLocation.iY + tAdjacentArray.tMatrix[n].tOffset.iY,
|
||||
};
|
||||
TempPixel = (*pTarget);
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
|
||||
__API_INT_TYPE OriginPixel = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
if (OriginPixel != MaskColour) {
|
||||
bIsInside = true;
|
||||
TempPixel = OriginPixel;
|
||||
}
|
||||
}
|
||||
|
||||
__API_PIXEL_AVERAGE(TempPixel, hwAlpha);
|
||||
}
|
||||
|
||||
if (bIsInside) {
|
||||
__API_INT_TYPE tSourcPixel = __API_PIXEL_AVERAGE_RESULT();
|
||||
|
||||
__API_PIXEL_BLENDING( &tSourcPixel, pTarget, hwOpacity);
|
||||
}
|
||||
|
||||
#else
|
||||
arm_2d_location_t tOriginLocation;
|
||||
|
||||
tOriginLocation.iX = ptPoint->fX;
|
||||
tOriginLocation.iY = ptPoint->fY;
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tOriginLocation)) {
|
||||
__API_INT_TYPE Temp = pOrigin[ tOriginLocation.iY * iOrigStride
|
||||
+ tOriginLocation.iX];
|
||||
if (Temp != MaskColour) {
|
||||
//Pixel = Temp;
|
||||
|
||||
__API_PIXEL_BLENDING( &Temp, pTarget, hwOpacity);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(get_pixel_colour_with_alpha)(
|
||||
arm_2d_point_fx_t *ptFxPoint,
|
||||
arm_2d_region_t *ptOrigValidRegion,
|
||||
__API_INT_TYPE *pOrigin,
|
||||
int16_t iOrigStride,
|
||||
__API_INT_TYPE *pTarget,
|
||||
//int16_t iTargetSride,
|
||||
__API_INT_TYPE MaskColour,
|
||||
uint_fast16_t hwOpacity)
|
||||
{
|
||||
#if defined(__ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__) \
|
||||
&& __ARM_2D_HAS_ANTI_ALIAS_TRANSFORM__
|
||||
arm_2d_location_t tOriginLocation = {
|
||||
.iX = ptFxPoint->X >> 16,
|
||||
.iY = ptFxPoint->Y >> 16,
|
||||
};
|
||||
|
||||
__arm_2d_point_adj_alpha_t tAdjacentArray
|
||||
= __arm_2d_point_get_adjacent_alpha_q16(ptFxPoint);
|
||||
|
||||
__API_PIXEL_AVERAGE_INIT();
|
||||
|
||||
__API_INT_TYPE TempPixel;
|
||||
bool bIsInside = false;
|
||||
|
||||
for (int_fast8_t n = 0; n < 4; n++) {
|
||||
uint16_t hwAlpha = tAdjacentArray.tMatrix[n].chAlpha;
|
||||
|
||||
arm_2d_location_t tTemp = {
|
||||
.iX = tOriginLocation.iX + tAdjacentArray.tMatrix[n].tOffset.iX,
|
||||
.iY = tOriginLocation.iY + tAdjacentArray.tMatrix[n].tOffset.iY,
|
||||
};
|
||||
TempPixel = (*pTarget);
|
||||
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tTemp)) {
|
||||
|
||||
__API_INT_TYPE Temp = pOrigin[ tTemp.iY * iOrigStride
|
||||
+ tTemp.iX];
|
||||
|
||||
if (Temp != MaskColour) {
|
||||
bIsInside = true;
|
||||
TempPixel = Temp;
|
||||
}
|
||||
}
|
||||
|
||||
__API_PIXEL_AVERAGE(TempPixel, hwAlpha);
|
||||
}
|
||||
|
||||
if (bIsInside) {
|
||||
__API_INT_TYPE tSourcPixel = __API_PIXEL_AVERAGE_RESULT();
|
||||
|
||||
__API_PIXEL_BLENDING( &tSourcPixel, pTarget, hwOpacity);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
arm_2d_location_t tPoint = {
|
||||
.iX = ptFxPoint->X >> 16,
|
||||
.iY = ptFxPoint->Y >> 16,
|
||||
};
|
||||
if (arm_2d_is_point_inside_region(ptOrigValidRegion, &tPoint)) {
|
||||
__API_INT_TYPE Temp = pOrigin[ tPoint.iY * iOrigStride
|
||||
+ tPoint.iX];
|
||||
if (Temp != MaskColour) {
|
||||
__API_PIXEL_BLENDING( &Temp, pTarget, hwOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(transform_with_opacity)(__arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo,
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
int_fast16_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int_fast16_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int_fast16_t iTargetStride =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int_fast16_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
float fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwRatio += (hwRatio == 255);
|
||||
#endif
|
||||
|
||||
float invIWidth = iWidth > 1 ? 1.0f / (float) (iWidth - 1) : __LARGEINVF32;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
&(ptInfo->tCenter),
|
||||
regrCoefs);
|
||||
|
||||
/* slopes between 1st and last cols */
|
||||
float slopeY, slopeX;
|
||||
|
||||
slopeY = (regrCoefs[1].interceptY - regrCoefs[0].interceptY) * invIWidth;
|
||||
slopeX = (regrCoefs[1].interceptX - regrCoefs[0].interceptX) * invIWidth;
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates (intercepts for regression in X direction */
|
||||
float colFirstY = regrCoefs[0].slopeY * y + regrCoefs[0].interceptY;
|
||||
float colFirstX = regrCoefs[0].slopeX * y + regrCoefs[0].interceptX;
|
||||
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
arm_2d_point_float_t tPoint;
|
||||
|
||||
/* linear interpolation thru first & last cols */
|
||||
tPoint.fX = colFirstX + slopeX * x;
|
||||
tPoint.fY = colFirstY + slopeY * x;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__)
|
||||
if (tPoint.fX > 0) {
|
||||
tPoint.fX += __CALIB;
|
||||
} else {
|
||||
tPoint.fX -= __CALIB;
|
||||
}
|
||||
if (tPoint.fY > 0) {
|
||||
tPoint.fY += __CALIB;
|
||||
} else {
|
||||
tPoint.fY -= __CALIB;
|
||||
}
|
||||
#endif
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour_with_alpha) (
|
||||
&tPoint,
|
||||
&ptParam->tOrigin.
|
||||
tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBase,
|
||||
MaskColour,
|
||||
hwRatio);
|
||||
pTargetBase++;
|
||||
}
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ */
|
||||
|
||||
__WEAK
|
||||
void __ARM_2D_FUNC(transform_with_opacity)(__arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo,
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
int_fast16_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int_fast16_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int_fast16_t iTargetStride =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int_fast16_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
float fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwRatio += (hwRatio == 255);
|
||||
#endif
|
||||
|
||||
q31_t invIWidth = iWidth > 1 ? 0x7fffffff / (iWidth - 1) : 0x7fffffff;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
&(ptInfo->tCenter),
|
||||
regrCoefs);
|
||||
|
||||
/* slopes between 1st and last cols */
|
||||
int32_t slopeY, slopeX;
|
||||
|
||||
slopeY =
|
||||
MULTFX((regrCoefs[1].interceptY - regrCoefs[0].interceptY), invIWidth);
|
||||
slopeX =
|
||||
MULTFX((regrCoefs[1].interceptX - regrCoefs[0].interceptX), invIWidth);
|
||||
|
||||
for (int_fast16_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates */
|
||||
int32_t colFirstY =
|
||||
__QADD((regrCoefs[0].slopeY * y), regrCoefs[0].interceptY);
|
||||
int32_t colFirstX =
|
||||
__QADD((regrCoefs[0].slopeX * y), regrCoefs[0].interceptX);
|
||||
|
||||
|
||||
for (int_fast16_t x = 0; x < iWidth; x++) {
|
||||
arm_2d_point_fx_t tPointFast;
|
||||
|
||||
tPointFast.X = __QDADD(colFirstX, slopeX * x);
|
||||
tPointFast.Y = __QDADD(colFirstY, slopeY * x);
|
||||
|
||||
#define __CALIBFX 590
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_TRANSFORM__)
|
||||
if (tPointFast.X > 0) {
|
||||
tPointFast.X += __CALIBFX;
|
||||
} else {
|
||||
tPointFast.X -= __CALIBFX;
|
||||
}
|
||||
if (tPointFast.Y > 0) {
|
||||
tPointFast.Y += __CALIBFX;
|
||||
} else {
|
||||
tPointFast.Y -= __CALIBFX;
|
||||
}
|
||||
#endif
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour_with_alpha) (
|
||||
&tPointFast,
|
||||
&ptParam->tOrigin.
|
||||
tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBase,
|
||||
MaskColour,
|
||||
hwRatio);
|
||||
pTargetBase++;
|
||||
}
|
||||
pTargetBase += (iTargetStride - iWidth);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ */
|
||||
#else
|
||||
|
||||
|
||||
# define __API_MTWM_COLOUR __API_COLOUR
|
||||
# define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
# define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
# define __API_MTWM_PIXEL_BLENDING __API_PIXEL_BLENDING
|
||||
# define __API_MTWM_PIXEL_AVERAGE __API_PIXEL_AVERAGE
|
||||
# define __API_MTWM_PIXEL_AVERAGE_RESULT __API_PIXEL_AVERAGE_RESULT
|
||||
# define __API_MTWM_PIXEL_AVERAGE_INIT __API_PIXEL_AVERAGE_INIT
|
||||
|
||||
# define get_pixel_colour_mask get_pixel_colour
|
||||
# define transform_with_mask transform
|
||||
|
||||
# include "__arm_2d_meta_trans_with_masks.inc"
|
||||
|
||||
# define __API_MTWM_COLOUR __API_COLOUR
|
||||
# define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
# define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
# define __API_MTWM_PIXEL_BLENDING __API_PIXEL_BLENDING
|
||||
# define __API_MTWM_PIXEL_AVERAGE __API_PIXEL_AVERAGE
|
||||
# define __API_MTWM_PIXEL_AVERAGE_RESULT __API_PIXEL_AVERAGE_RESULT
|
||||
# define __API_MTWM_PIXEL_AVERAGE_INIT __API_PIXEL_AVERAGE_INIT
|
||||
# define __API_MTWM_CFG_SUPPORT_OPACITY 1
|
||||
|
||||
# define get_pixel_colour_mask get_pixel_colour_with_opacity
|
||||
# define transform_with_mask transform_with_opacity
|
||||
|
||||
# include "__arm_2d_meta_trans_with_masks.inc"
|
||||
#endif
|
||||
|
||||
#define __API_MTWM_COLOUR __API_COLOUR
|
||||
#define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
#define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
#define __API_MTWM_PIXEL_BLENDING __API_PIXEL_BLENDING
|
||||
#define __API_MTWM_PIXEL_AVERAGE __API_PIXEL_AVERAGE
|
||||
#define __API_MTWM_PIXEL_AVERAGE_RESULT __API_PIXEL_AVERAGE_RESULT
|
||||
#define __API_MTWM_PIXEL_AVERAGE_INIT __API_PIXEL_AVERAGE_INIT
|
||||
#define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
|
||||
#define get_pixel_colour_mask get_pixel_colour_src_mask
|
||||
#define transform_with_mask transform_with_src_mask
|
||||
|
||||
#include "__arm_2d_meta_trans_with_masks.inc"
|
||||
|
||||
#if __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
|
||||
# define __API_MTWM_COLOUR __API_COLOUR
|
||||
# define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
# define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
# define __API_MTWM_PIXEL_BLENDING __API_PIXEL_BLENDING
|
||||
# define __API_MTWM_PIXEL_AVERAGE __API_PIXEL_AVERAGE
|
||||
# define __API_MTWM_PIXEL_AVERAGE_RESULT __API_PIXEL_AVERAGE_RESULT
|
||||
# define __API_MTWM_PIXEL_AVERAGE_INIT __API_PIXEL_AVERAGE_INIT
|
||||
# define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
# define __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE 1
|
||||
# define get_pixel_colour_mask get_pixel_colour_src_chn_mask
|
||||
# define transform_with_mask transform_with_src_chn_mask
|
||||
|
||||
# include "__arm_2d_meta_trans_with_masks.inc"
|
||||
#endif
|
||||
|
||||
#define __API_MTWM_COLOUR __API_COLOUR
|
||||
#define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
#define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
#define __API_MTWM_PIXEL_BLENDING __API_PIXEL_BLENDING
|
||||
#define __API_MTWM_PIXEL_AVERAGE __API_PIXEL_AVERAGE
|
||||
#define __API_MTWM_PIXEL_AVERAGE_RESULT __API_PIXEL_AVERAGE_RESULT
|
||||
#define __API_MTWM_PIXEL_AVERAGE_INIT __API_PIXEL_AVERAGE_INIT
|
||||
#define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
#define __API_MTWM_CFG_SUPPORT_OPACITY 1
|
||||
|
||||
#define get_pixel_colour_mask get_pixel_colour_src_mask_opa
|
||||
#define transform_with_mask transform_with_src_mask_and_opacity
|
||||
|
||||
#include "__arm_2d_meta_trans_with_masks.inc"
|
||||
|
||||
#if __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
|
||||
# define __API_MTWM_COLOUR __API_COLOUR
|
||||
# define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
# define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
# define __API_MTWM_PIXEL_BLENDING __API_PIXEL_BLENDING
|
||||
# define __API_MTWM_PIXEL_AVERAGE __API_PIXEL_AVERAGE
|
||||
# define __API_MTWM_PIXEL_AVERAGE_RESULT __API_PIXEL_AVERAGE_RESULT
|
||||
# define __API_MTWM_PIXEL_AVERAGE_INIT __API_PIXEL_AVERAGE_INIT
|
||||
# define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
# define __API_MTWM_CFG_SUPPORT_OPACITY 1
|
||||
# define __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE 1
|
||||
# define get_pixel_colour_mask get_pixel_colour_src_chn_mask_opa
|
||||
# define transform_with_mask transform_with_src_chn_mask_and_opacity
|
||||
|
||||
# include "__arm_2d_meta_trans_with_masks.inc"
|
||||
#endif
|
||||
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#undef __API_COLOUR
|
||||
#undef __API_INT_TYPE
|
||||
#undef __API_INT_TYPE_BIT_NUM
|
||||
#undef __API_PIXEL_BLENDING
|
||||
#undef __API_PIXEL_AVERAGE
|
||||
#undef __API_PIXEL_AVERAGE_RESULT
|
||||
#undef __API_PIXEL_AVERAGE_INIT
|
File diff suppressed because it is too large
Load Diff
@ -1,701 +0,0 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2021 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: __arm_2d_transform_helium.inc
|
||||
* Description: c code template for transform
|
||||
*
|
||||
* $Date: 12. July 2022
|
||||
* $Revision: V.1.0.4
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
#ifndef __API_INT_TYPE_BIT_NUM
|
||||
# error You have to define __API_INT_TYPE_BIT_NUM before using this c template
|
||||
#endif
|
||||
#ifndef __API_COLOUR
|
||||
# error You have to define __API_COLOUR before using this c template
|
||||
#endif
|
||||
#ifndef __API_COLOUR_NAME
|
||||
# error You have to define __API_COLOUR_NAME before using this c template
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#define ____ARM_2D_FUNC(__NAME, __COLOUR) __MVE_WRAPPER(__arm_2d_impl_##__COLOUR##_##__NAME)
|
||||
#define ___ARM_2D_FUNC(__NAME, __COLOUR) ____ARM_2D_FUNC(__NAME, __COLOUR)
|
||||
#define __ARM_2D_FUNC(__NAME) ___ARM_2D_FUNC(__NAME, __API_COLOUR_NAME)
|
||||
|
||||
|
||||
|
||||
#define __API_INT_TYPE ARM_PIX_SCLTYP(__API_INT_TYPE_BIT_NUM)
|
||||
|
||||
#define MASK_COLOR(sz) (sz == 8) ? ptInfo->Mask.chColour : ((sz == 16) ? ptInfo->Mask.hwColour : ptInfo->Mask.wColour)
|
||||
|
||||
|
||||
#if !__ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(transform)( __arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo)
|
||||
{
|
||||
int32_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int32_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int32_t iTargetStride =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int32_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
float32_t fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
arm_2d_location_t *pCenter = &(ptInfo->tCenter);
|
||||
|
||||
float32_t invIWidth = iWidth > 1 ? 1.0f / (float32_t) (iWidth - 1) : __LARGEINVF32;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
bool gatherLoadIdxOverflow;
|
||||
gatherLoadIdxOverflow =
|
||||
#endif
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
pCenter,
|
||||
iOrigStride,
|
||||
regrCoefs);
|
||||
|
||||
|
||||
/* slopes between 1st and last columns */
|
||||
float32_t slopeY, slopeX;
|
||||
|
||||
slopeY = (float32_t) (regrCoefs[1].interceptY - regrCoefs[0].interceptY) * invIWidth;
|
||||
slopeX = (float32_t) (regrCoefs[1].interceptX - regrCoefs[0].interceptX) * invIWidth;
|
||||
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
if (!gatherLoadIdxOverflow) {
|
||||
#endif
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
|
||||
/* 1st column estimates (intercepts for regression in X direction */
|
||||
float32_t colFirstY = regrCoefs[0].slopeY * y + regrCoefs[0].interceptY;
|
||||
float32_t colFirstX = regrCoefs[0].slopeX * y + regrCoefs[0].interceptX;
|
||||
|
||||
int32_t nbVecElts = iWidth;
|
||||
float16x8_t vX = vcvtq_f16_s16((int16x8_t) vidupq_n_u16(0, 1));
|
||||
__API_INT_TYPE *pTargetBaseCur = pTargetBase;
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
arm_2d_point_f16x8_t tPointV;
|
||||
|
||||
tPointV.X =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstX), vX, slopeX);
|
||||
tPointV.Y =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstY), vX, slopeY);
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__)
|
||||
tPointV.X = vaddq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpgtq(tPointV.X, 0));
|
||||
tPointV.X = vsubq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpleq(tPointV.X, 0));
|
||||
|
||||
tPointV.Y = vaddq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpgtq(tPointV.Y, 0));
|
||||
tPointV.Y = vsubq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpleq(tPointV.Y, 0));
|
||||
#endif
|
||||
__ARM_2D_FUNC(get_pixel_colour)(&tPointV,
|
||||
&ptParam->tOrigin.tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBaseCur, MaskColour,
|
||||
nbVecElts);
|
||||
|
||||
pTargetBaseCur += 8;
|
||||
vX += 8.0f16;
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
} else {
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
|
||||
/* 1st column estimates (intercepts for regression in X direction */
|
||||
float32_t colFirstY = regrCoefs[0].slopeY * y + regrCoefs[0].interceptY;
|
||||
float32_t colFirstX = regrCoefs[0].slopeX * y + regrCoefs[0].interceptX;
|
||||
int32_t nbVecElts = iWidth;
|
||||
float16x8_t vX = vcvtq_f16_s16((int16x8_t) vidupq_n_u16(0, 1));
|
||||
uint16_t *pTargetBaseCur = pTargetBase;
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
arm_2d_point_f16x8_t tPointV;
|
||||
|
||||
tPointV.X =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstX), vX, slopeX);
|
||||
tPointV.Y =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstY), vX, slopeY);
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__)
|
||||
tPointV.X = vaddq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpgtq(tPointV.X, 0));
|
||||
tPointV.X = vsubq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpleq(tPointV.X, 0));
|
||||
|
||||
tPointV.Y = vaddq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpgtq(tPointV.Y, 0));
|
||||
tPointV.Y = vsubq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpleq(tPointV.Y, 0));
|
||||
#endif
|
||||
__MVE_WRAPPER(__arm_2d_impl_rgb565_get_pixel_colour_offs_compensated)(&tPointV,
|
||||
&ptParam->tOrigin.
|
||||
tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBaseCur,
|
||||
MaskColour,
|
||||
nbVecElts);
|
||||
|
||||
pTargetBaseCur += 8;
|
||||
vX += 8.0f16;
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(transform_with_opacity)(__arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo,
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
int32_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int32_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int32_t iTargetStride =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int32_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
float32_t fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
arm_2d_location_t *pCenter = &(ptInfo->tCenter);
|
||||
float32_t invIWidth = iWidth > 1 ? 1.0f / (float32_t) (iWidth - 1) : __LARGEINVF32;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwRatio += (hwRatio == 255);
|
||||
#endif
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
bool gatherLoadIdxOverflow;
|
||||
gatherLoadIdxOverflow =
|
||||
#endif
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
pCenter,
|
||||
iOrigStride,
|
||||
regrCoefs);
|
||||
|
||||
/* slopes between 1st and last columns */
|
||||
float32_t slopeY, slopeX;
|
||||
|
||||
slopeY = (float32_t) (regrCoefs[1].interceptY - regrCoefs[0].interceptY) * invIWidth;
|
||||
slopeX = (float32_t) (regrCoefs[1].interceptX - regrCoefs[0].interceptX) * invIWidth;
|
||||
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
if (!gatherLoadIdxOverflow) {
|
||||
#endif
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates (intercepts for regression in X direction */
|
||||
float32_t colFirstY =
|
||||
(regrCoefs[0].slopeY * y + regrCoefs[0].interceptY);
|
||||
float32_t colFirstX =
|
||||
(regrCoefs[0].slopeX * y + regrCoefs[0].interceptX);
|
||||
|
||||
int32_t nbVecElts = iWidth;
|
||||
float16x8_t vX = vcvtq_f16_s16((int16x8_t) vidupq_n_u16(0, 1));
|
||||
__API_INT_TYPE *pTargetBaseCur = pTargetBase;
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
arm_2d_point_f16x8_t tPointV;
|
||||
|
||||
/* linear interpolation thru first & last columns */
|
||||
tPointV.X =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstX), vX, slopeX);
|
||||
tPointV.Y =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstY), vX, slopeY);
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__)
|
||||
tPointV.X = vaddq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpgtq(tPointV.X, 0));
|
||||
tPointV.X = vsubq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpleq(tPointV.X, 0));
|
||||
|
||||
tPointV.Y = vaddq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpgtq(tPointV.Y, 0));
|
||||
tPointV.Y = vsubq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpleq(tPointV.Y, 0));
|
||||
#endif
|
||||
__ARM_2D_FUNC(get_pixel_colour_with_alpha)(&tPointV,
|
||||
&ptParam->tOrigin.
|
||||
tValidRegion,
|
||||
pOrigin, iOrigStride,
|
||||
pTargetBaseCur,
|
||||
MaskColour,
|
||||
hwRatio,
|
||||
nbVecElts);
|
||||
pTargetBaseCur += 8;
|
||||
vX += 8.0f16;
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
} else {
|
||||
|
||||
/*
|
||||
Large image / Large origin offsets
|
||||
Gather load 16-bit could overflow
|
||||
- Y offset needs to be shifted down to avoid overflow
|
||||
- 16-bit gather loads base address is incremented
|
||||
|
||||
Needs to be done in the inner loop.
|
||||
In the case of steep slopes, taking the minimum between the Y extrema could still generate overflows
|
||||
*/
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates (intercepts for regression in X direction */
|
||||
float32_t colFirstY =
|
||||
(regrCoefs[0].slopeY * y + regrCoefs[0].interceptY);
|
||||
float32_t colFirstX =
|
||||
(regrCoefs[0].slopeX * y + regrCoefs[0].interceptX);
|
||||
|
||||
int32_t nbVecElts = iWidth;
|
||||
float16x8_t vX = vcvtq_f16_s16((int16x8_t) vidupq_n_u16(0, 1));
|
||||
uint16_t *pTargetBaseCur = pTargetBase;
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
arm_2d_point_f16x8_t tPointV;
|
||||
|
||||
/* linear interpolation thru first & last columns */
|
||||
tPointV.X =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstX), vX, slopeX);
|
||||
tPointV.Y =
|
||||
vfmaq_n_f16(vdupq_n_f16(colFirstY), vX, slopeY);
|
||||
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_CALIB_IN_ROTATION_FOR_PERFORMANCE__)
|
||||
tPointV.X = vaddq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpgtq(tPointV.X, 0));
|
||||
tPointV.X = vsubq_m_n_f16(tPointV.X, tPointV.X, __CALIB, vcmpleq(tPointV.X, 0));
|
||||
|
||||
tPointV.Y = vaddq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpgtq(tPointV.Y, 0));
|
||||
tPointV.Y = vsubq_m_n_f16(tPointV.Y, tPointV.Y, __CALIB, vcmpleq(tPointV.Y, 0));
|
||||
#endif
|
||||
__MVE_WRAPPER(__arm_2d_impl_rgb565_get_pixel_colour_with_alpha_offs_compensated)(&tPointV,
|
||||
&ptParam->tOrigin.
|
||||
tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBaseCur,
|
||||
MaskColour,
|
||||
hwRatio,
|
||||
nbVecElts);
|
||||
pTargetBaseCur += 8;
|
||||
vX += 8.0f16;
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#else /* __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ */
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(transform)( __arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo)
|
||||
{
|
||||
int32_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int32_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
int32_t iTargetStride =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int32_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
float32_t fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
arm_2d_location_t *pCenter = &(ptInfo->tCenter);
|
||||
q31_t invIWidth = (iWidth > 1) ? 0x7fffffff / (iWidth - 1) : 0x7fffffff;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
bool gatherLoadIdxOverflow;
|
||||
|
||||
gatherLoadIdxOverflow =
|
||||
#endif
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
pCenter,
|
||||
iOrigStride,
|
||||
regrCoefs);
|
||||
|
||||
|
||||
/* slopes between 1st and last columns */
|
||||
int32_t slopeY, slopeX;
|
||||
|
||||
slopeY =
|
||||
MULTFX((regrCoefs[1].interceptY - regrCoefs[0].interceptY), invIWidth);
|
||||
slopeX =
|
||||
MULTFX((regrCoefs[1].interceptX - regrCoefs[0].interceptX), invIWidth);
|
||||
|
||||
int32_t nrmSlopeX = 17 - __CLZ(ABS(slopeX));
|
||||
int32_t nrmSlopeY = 17 - __CLZ(ABS(slopeY));
|
||||
|
||||
slopeX = ARSHIFT(slopeX, nrmSlopeX);
|
||||
slopeY = ARSHIFT(slopeY, nrmSlopeY);
|
||||
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
if (!gatherLoadIdxOverflow) {
|
||||
|
||||
#endif
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
|
||||
/* 1st column estimates */
|
||||
int32_t colFirstY =
|
||||
__QADD((regrCoefs[0].slopeY * y), regrCoefs[0].interceptY);
|
||||
int32_t colFirstX =
|
||||
__QADD((regrCoefs[0].slopeX * y), regrCoefs[0].interceptX);
|
||||
|
||||
/* Q6 conversion */
|
||||
colFirstX = colFirstX >> 10;
|
||||
colFirstY = colFirstY >> 10;
|
||||
|
||||
int32_t nbVecElts = iWidth;
|
||||
int16x8_t vX = (int16x8_t) vidupq_n_u16(0, 1);
|
||||
__API_INT_TYPE *pTargetBaseCur = pTargetBase;
|
||||
|
||||
/* Q9.6 coversion */
|
||||
vX = SET_Q6INT(vX);
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
arm_2d_point_s16x8_t tPointV;
|
||||
|
||||
tPointV.X = vqdmulhq_n_s16(vX, slopeX);
|
||||
tPointV.X = vaddq_n_s16(vqrshlq_n_s16(tPointV.X, nrmSlopeX), colFirstX);
|
||||
|
||||
tPointV.Y = vqdmulhq_n_s16(vX, slopeY);
|
||||
tPointV.Y = vaddq_n_s16(vqrshlq_n_s16(tPointV.Y, nrmSlopeY), colFirstY);
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour)(&tPointV,
|
||||
&ptParam->tOrigin.tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBaseCur, MaskColour,
|
||||
nbVecElts);
|
||||
|
||||
pTargetBaseCur += 8;
|
||||
vX += ((1<<6) * 8);
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
/* RGB565 specific */
|
||||
} else {
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
|
||||
/* 1st column estimates */
|
||||
int32_t colFirstY =
|
||||
__QADD((regrCoefs[0].slopeY * y), regrCoefs[0].interceptY);
|
||||
int32_t colFirstX =
|
||||
__QADD((regrCoefs[0].slopeX * y), regrCoefs[0].interceptX);
|
||||
|
||||
/* Q6 conversion */
|
||||
colFirstX = colFirstX >> 10;
|
||||
colFirstY = colFirstY >> 10;
|
||||
|
||||
int32_t nbVecElts = iWidth;
|
||||
int16x8_t vX = (int16x8_t) vidupq_n_u16(0, 1);
|
||||
__API_INT_TYPE *pTargetBaseCur = pTargetBase;
|
||||
|
||||
/* Q9.6 coversion */
|
||||
vX = SET_Q6INT(vX);
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
arm_2d_point_s16x8_t tPointV;
|
||||
|
||||
tPointV.X = vqdmulhq_n_s16(vX, slopeX);
|
||||
tPointV.X = vaddq_n_s16(vqrshlq_n_s16(tPointV.X, nrmSlopeX), colFirstX);
|
||||
|
||||
tPointV.Y = vqdmulhq_n_s16(vX, slopeY);
|
||||
tPointV.Y = vaddq_n_s16(vqrshlq_n_s16(tPointV.Y, nrmSlopeY), colFirstY);
|
||||
|
||||
__MVE_WRAPPER(__arm_2d_impl_rgb565_get_pixel_colour_offs_compensated)(&tPointV,
|
||||
&ptParam->tOrigin.
|
||||
tValidRegion,
|
||||
pOrigin,
|
||||
iOrigStride,
|
||||
pTargetBaseCur,
|
||||
MaskColour,
|
||||
nbVecElts);
|
||||
|
||||
pTargetBaseCur += 8;
|
||||
vX += SET_Q6INT(8);
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
__OVERRIDE_WEAK
|
||||
void __ARM_2D_FUNC(transform_with_opacity)( __arm_2d_param_copy_orig_t *ptParam,
|
||||
__arm_2d_transform_info_t *ptInfo,
|
||||
uint_fast16_t hwRatio)
|
||||
{
|
||||
int32_t iHeight = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iHeight;
|
||||
int32_t iWidth = ptParam->use_as____arm_2d_param_copy_t.tCopySize.iWidth;
|
||||
|
||||
int32_t iTargetStride =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tTarget.iStride;
|
||||
__API_INT_TYPE *pTargetBase = ptParam->use_as____arm_2d_param_copy_t.tTarget.pBuffer;
|
||||
__API_INT_TYPE *pOrigin = ptParam->tOrigin.pBuffer;
|
||||
int32_t iOrigStride = ptParam->tOrigin.iStride;
|
||||
__API_INT_TYPE MaskColour = MASK_COLOR(__API_INT_TYPE_BIT_NUM);
|
||||
float fAngle = -ptInfo->fAngle;
|
||||
arm_2d_location_t tOffset =
|
||||
ptParam->use_as____arm_2d_param_copy_t.tSource.tValidRegion.tLocation;
|
||||
arm_2d_location_t *pCenter = &(ptInfo->tCenter);
|
||||
|
||||
q31_t invIWidth = iWidth > 1 ? 0x7fffffff / (iWidth - 1) : 0x7fffffff;
|
||||
arm_2d_rot_linear_regr_t regrCoefs[2];
|
||||
arm_2d_location_t SrcPt = ptInfo->tDummySourceOffset;
|
||||
#if !defined(__ARM_2D_CFG_UNSAFE_IGNORE_ALPHA_255_COMPENSATION__)
|
||||
hwRatio += (hwRatio == 255);
|
||||
#endif
|
||||
|
||||
/* get regression parameters over 1st and last column */
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
bool gatherLoadIdxOverflow;
|
||||
gatherLoadIdxOverflow =
|
||||
#endif
|
||||
__arm_2d_transform_regression(
|
||||
&ptParam->use_as____arm_2d_param_copy_t.tCopySize,
|
||||
&SrcPt,
|
||||
fAngle,
|
||||
ptInfo->fScale,
|
||||
&tOffset,
|
||||
pCenter,
|
||||
iOrigStride,
|
||||
regrCoefs);
|
||||
|
||||
|
||||
/* slopes between 1st and last columns */
|
||||
int32_t slopeY, slopeX;
|
||||
|
||||
slopeY = MULTFX((regrCoefs[1].interceptY - regrCoefs[0].interceptY), invIWidth);
|
||||
slopeX = MULTFX((regrCoefs[1].interceptX - regrCoefs[0].interceptX), invIWidth);
|
||||
|
||||
int32_t nrmSlopeX = 17 - __CLZ(ABS(slopeX));
|
||||
int32_t nrmSlopeY = 17 - __CLZ(ABS(slopeY));
|
||||
|
||||
slopeX = ARSHIFT(slopeX, nrmSlopeX);
|
||||
slopeY = ARSHIFT(slopeY, nrmSlopeY);
|
||||
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
if (!gatherLoadIdxOverflow) {
|
||||
#endif
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates */
|
||||
int32_t colFirstY =
|
||||
__QADD((regrCoefs[0].slopeY * y), regrCoefs[0].interceptY);
|
||||
int32_t colFirstX =
|
||||
__QADD((regrCoefs[0].slopeX * y), regrCoefs[0].interceptX);
|
||||
|
||||
/* Q6 conversion */
|
||||
colFirstX = colFirstX >> 10;
|
||||
colFirstY = colFirstY >> 10;
|
||||
|
||||
int32_t nbVecElts = iWidth;
|
||||
int16x8_t vX = (int16x8_t) vidupq_n_u16(0, 1);
|
||||
__API_INT_TYPE *pTargetBaseCur = pTargetBase;
|
||||
|
||||
/* Q9.6 coversion */
|
||||
vX = SET_Q6INT(vX);
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
/* interpolation */
|
||||
arm_2d_point_s16x8_t tPointV;
|
||||
|
||||
tPointV.X = vqdmulhq_n_s16(vX, slopeX);
|
||||
tPointV.X = vaddq_n_s16(vqrshlq_n_s16(tPointV.X, nrmSlopeX), colFirstX);
|
||||
|
||||
tPointV.Y = vqdmulhq_n_s16(vX, slopeY);
|
||||
tPointV.Y = vaddq_n_s16(vqrshlq_n_s16(tPointV.Y, nrmSlopeY), colFirstY);
|
||||
|
||||
__ARM_2D_FUNC(get_pixel_colour_with_alpha)(&tPointV,
|
||||
&ptParam->tOrigin.tValidRegion,
|
||||
pOrigin, iOrigStride,
|
||||
pTargetBaseCur,
|
||||
MaskColour, hwRatio,
|
||||
nbVecElts);
|
||||
pTargetBaseCur += 8;
|
||||
vX += SET_Q6INT(8);
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
#if __API_COLOUR == ARM_2D_M_COLOUR_RGB565
|
||||
} else {
|
||||
/*
|
||||
Large image / Large origin offsets
|
||||
Gather load 16-bit could overflow
|
||||
- Y offset needs to be shifted down to avoid overflow
|
||||
- 16-bit gather loads base address is incremented
|
||||
|
||||
Needs to be done in the inner loop.
|
||||
In the case of steep slopes, taking the minimum between the Y extrema could still generate overflows
|
||||
*/
|
||||
for (int32_t y = 0; y < iHeight; y++) {
|
||||
/* 1st column estimates */
|
||||
int32_t colFirstY =
|
||||
__QADD((regrCoefs[0].slopeY * y), regrCoefs[0].interceptY);
|
||||
int32_t colFirstX =
|
||||
__QADD((regrCoefs[0].slopeX * y), regrCoefs[0].interceptX);
|
||||
|
||||
/* Q6 conversion */
|
||||
colFirstX = colFirstX >> 10;
|
||||
colFirstY = colFirstY >> 10;
|
||||
|
||||
int32_t nbVecElts = iWidth;
|
||||
int16x8_t vX = (int16x8_t) vidupq_n_u16(0, 1);
|
||||
uint16_t *pTargetBaseCur = pTargetBase;
|
||||
|
||||
/* Q9.6 coversion */
|
||||
vX = SET_Q6INT(vX);
|
||||
|
||||
while (nbVecElts > 0) {
|
||||
/* interpolation */
|
||||
arm_2d_point_s16x8_t tPointV;
|
||||
|
||||
tPointV.X = vqdmulhq_n_s16(vX, slopeX);
|
||||
tPointV.X = vaddq_n_s16(vqrshlq_n_s16(tPointV.X, nrmSlopeX), colFirstX);
|
||||
|
||||
tPointV.Y = vqdmulhq_n_s16(vX, slopeY);
|
||||
tPointV.Y = vaddq_n_s16(vqrshlq_n_s16(tPointV.Y, nrmSlopeY), colFirstY);
|
||||
|
||||
__MVE_WRAPPER(__arm_2d_impl_rgb565_get_pixel_colour_with_alpha_offs_compensated)
|
||||
(&tPointV, &ptParam->tOrigin.tValidRegion, pOrigin, iOrigStride,
|
||||
pTargetBaseCur, MaskColour, hwRatio, nbVecElts);
|
||||
|
||||
pTargetBaseCur += 8;
|
||||
vX += SET_Q6INT(8);
|
||||
nbVecElts -= 8;
|
||||
}
|
||||
pTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif /* __ARM_2D_CFG_FORCED_FIXED_POINT_TRANSFORM__ */
|
||||
|
||||
|
||||
#define __API_MTWM_COLOUR __API_COLOUR
|
||||
#define __API_MTWM_COLOUR_NAME __API_COLOUR_NAME
|
||||
#define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
#define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
#define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
|
||||
#define get_pixel_colour_mask get_pixel_colour_src_mask
|
||||
#define transform_with_mask transform_with_src_mask
|
||||
|
||||
#include "__arm_2d_meta_trans_with_masks_helium.inc"
|
||||
|
||||
#if __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
|
||||
# define __API_MTWM_COLOUR __API_COLOUR
|
||||
# define __API_MTWM_COLOUR_NAME __API_COLOUR_NAME
|
||||
# define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
# define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
# define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
# define __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE 1
|
||||
# define get_pixel_colour_mask get_pixel_colour_src_chn_mask
|
||||
# define transform_with_mask transform_with_src_chn_mask
|
||||
|
||||
# include "__arm_2d_meta_trans_with_masks_helium.inc"
|
||||
#endif
|
||||
|
||||
#define __API_MTWM_COLOUR __API_COLOUR
|
||||
#define __API_MTWM_COLOUR_NAME __API_COLOUR_NAME
|
||||
#define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
#define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
#define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
#define __API_MTWM_CFG_SUPPORT_OPACITY 1
|
||||
|
||||
#define get_pixel_colour_mask get_pixel_colour_src_mask_opa
|
||||
#define transform_with_mask transform_with_src_mask_and_opacity
|
||||
|
||||
#include "__arm_2d_meta_trans_with_masks_helium.inc"
|
||||
|
||||
|
||||
#if __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
|
||||
# define __API_MTWM_COLOUR __API_COLOUR
|
||||
# define __API_MTWM_COLOUR_NAME __API_COLOUR_NAME
|
||||
# define __API_MTWM_INT_TYPE __API_INT_TYPE
|
||||
# define __API_MTWM_INT_TYPE_BIT_NUM __API_INT_TYPE_BIT_NUM
|
||||
# define __API_MTWM_CFG_SUPPORT_SOURCE_MASK 1
|
||||
# define __API_MTWM_CFG_SUPPORT_OPACITY 1
|
||||
# define __API_MTWM_CFG_CHANNEL_8in32_SUPPORT_ON_SOURCE_SIDE 1
|
||||
|
||||
# define get_pixel_colour_mask get_pixel_colour_src_chn_mask_opa
|
||||
# define transform_with_mask transform_with_src_chn_mask_and_opacity
|
||||
|
||||
# include "__arm_2d_meta_trans_with_masks_helium.inc"
|
||||
#endif
|
||||
|
||||
#undef ____ARM_2D_FUNC
|
||||
#undef ___ARM_2D_FUNC
|
||||
#undef __ARM_2D_FUNC
|
||||
#undef __API_COLOUR
|
||||
#undef __API_COLOUR_NAME
|
||||
#undef __API_INT_TYPE
|
||||
#undef __API_INT_TYPE_BIT_NUM
|
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm-2d.c
|
||||
* Description: Tables for pixel pipeline OPs
|
||||
*
|
||||
* $Date: 11. Aug 2022
|
||||
* $Revision: V.1.0.2
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#define __ARM_2D_IMPL__
|
||||
|
||||
#include "arm_2d.h"
|
||||
#include "__arm_2d_impl.h"
|
||||
|
||||
|
||||
#define __ARM_2D_COMPILATION_UNIT
|
||||
#include "../Source/__arm_2d_core.c"
|
||||
|
||||
#define __ARM_2D_COMPILATION_UNIT
|
||||
#include "../Source/__arm_2d_tile.c"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
|
||||
#if defined(__ARM_2D_HAS_CDE__) && !__ARM_2D_HAS_CDE__
|
||||
# define __arm_2d_cde_init()
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_2D_HAS_HELIUM__) && !__ARM_2D_HAS_HELIUM__
|
||||
# define __arm_2d_helium_init()
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_2D_HAS_HW_ACC__) && !__ARM_2D_HAS_HW_ACC__
|
||||
# define __arm_2d_acc_init()
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_2D_HAS_ASYNC__) && !__ARM_2D_HAS_ASYNC__
|
||||
# define __arm_2d_async_init(...)
|
||||
#endif
|
||||
|
||||
#ifndef __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__
|
||||
# define __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ 4
|
||||
#endif
|
||||
#if __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ < 4
|
||||
# warning The __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ should be larger than or\
|
||||
equal to 4, set it to the default value 4.
|
||||
# undef __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__
|
||||
# define __ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__ 4
|
||||
#endif
|
||||
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
#if defined(__ARM_2D_HAS_ASYNC__) && __ARM_2D_HAS_ASYNC__
|
||||
/*!
|
||||
* \brief initialise the arm-2d pipeline
|
||||
* \param ptSubTasks an array of __arm_2d_sub_task_t objects
|
||||
* \param hwCount the number of items in the array
|
||||
* \return arm_2d_err_t error code
|
||||
*/
|
||||
extern
|
||||
arm_2d_err_t __arm_2d_async_init( __arm_2d_sub_task_t *ptSubTasks,
|
||||
uint_fast16_t hwCount);
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_2D_HAS_HELIUM__) && __ARM_2D_HAS_HELIUM__
|
||||
/*!
|
||||
* \brief initialise the helium acceleration
|
||||
*/
|
||||
extern
|
||||
void __arm_2d_helium_init(void);
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_2D_HAS_CDE__) && __ARM_2D_HAS_CDE__
|
||||
/*!
|
||||
* \brief initialise the cde service
|
||||
*/
|
||||
extern
|
||||
void __arm_2d_cde_init(void);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(__ARM_2D_HAS_HW_ACC__) && __ARM_2D_HAS_HW_ACC__
|
||||
/*!
|
||||
* \brief initialise the hardware accelerator adapter
|
||||
*/
|
||||
extern
|
||||
void __arm_2d_acc_init(void);
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* \brief initialise the arm-2d core service
|
||||
*/
|
||||
extern
|
||||
void __arm_2d_init(void);
|
||||
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ IMPLEMENTATION ================================*/
|
||||
|
||||
/*!
|
||||
* \brief initialise arm-2d
|
||||
*/
|
||||
void arm_2d_init(void)
|
||||
{
|
||||
__arm_2d_init();
|
||||
|
||||
do {
|
||||
static __arm_2d_sub_task_t
|
||||
s_tDefaultTaskPool[__ARM_2D_CFG_DEFAULT_SUB_TASK_POOL_SIZE__];
|
||||
|
||||
ARM_2D_UNUSED(s_tDefaultTaskPool);
|
||||
|
||||
__arm_2d_async_init(s_tDefaultTaskPool, dimof(s_tDefaultTaskPool));
|
||||
} while(0);
|
||||
|
||||
__arm_2d_helium_init();
|
||||
__arm_2d_cde_init();
|
||||
__arm_2d_acc_init();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,570 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm-2d_draw.c
|
||||
* Description: APIs for colour format conversion
|
||||
*
|
||||
* $Date: 08. Aug 2022
|
||||
* $Revision: V.1.0.2
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#define __ARM_2D_IMPL__
|
||||
|
||||
#include "arm_2d.h"
|
||||
#include "__arm_2d_impl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
|
||||
# pragma clang diagnostic ignored "-Wmissing-variable-declarations"
|
||||
# pragma clang diagnostic ignored "-Wcast-qual"
|
||||
# pragma clang diagnostic ignored "-Wcast-align"
|
||||
# pragma clang diagnostic ignored "-Wextra-semi-stmt"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
|
||||
# pragma clang diagnostic ignored "-Wdouble-promotion"
|
||||
# pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-float-conversion"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-conversion"
|
||||
# pragma clang diagnostic ignored "-Wtautological-pointer-compare"
|
||||
# pragma clang diagnostic ignored "-Wsign-compare"
|
||||
# pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wswitch-enum"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
|
||||
#elif defined(__IS_COMPILER_ARM_COMPILER_5__)
|
||||
# pragma diag_suppress 174,177,188,68,513,144
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
|
||||
void __arm_2d_impl_gray8_to_rgb565( uint8_t *__RESTRICT pchSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint16_t *__RESTRICT phwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize);
|
||||
|
||||
void __arm_2d_impl_cccn888_to_rgb565(uint32_t *__RESTRICT pwSource,
|
||||
int16_t iSourceStride,
|
||||
uint16_t *__RESTRICT phwTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize);
|
||||
|
||||
void __arm_2d_impl_rgb565_to_cccn888(uint16_t *__RESTRICT phwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint32_t *__RESTRICT pwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize);
|
||||
|
||||
void __arm_2d_impl_gray8_to_cccn888(uint8_t *__RESTRICT pchSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint32_t *__RESTRICT pwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize);
|
||||
|
||||
void __arm_2d_impl_rgb565_to_gray8( uint16_t *__RESTRICT phwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint8_t *__RESTRICT pchTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize);
|
||||
|
||||
void __arm_2d_impl_cccn888_to_gray8(uint32_t *__RESTRICT pwSource,
|
||||
int16_t iSourceStride,
|
||||
uint8_t *__RESTRICT pchwTarget,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize);
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ IMPLEMENTATION ================================*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Convert Colour format *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief convert the colour format of a given tile to rgb888
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptSource the source tile
|
||||
* \param[out] ptTarget the output tile (holding a buffer)
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_convert_colour_to_rgb888( arm_2d_op_cl_convt_t *ptOP,
|
||||
const arm_2d_tile_t *ptSource,
|
||||
const arm_2d_tile_t *ptTarget)
|
||||
{
|
||||
assert(NULL != ptSource);
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_cl_convt_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_CONVERT_TO_RGB888;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = NULL;
|
||||
this.Source.ptTile = ptSource;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief convert the colour format of a given tile to rgb565
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptSource the source tile
|
||||
* \param[out] ptTarget the output tile (holding a buffer)
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_convert_colour_to_rgb565( arm_2d_op_cl_convt_t *ptOP,
|
||||
const arm_2d_tile_t *ptSource,
|
||||
const arm_2d_tile_t *ptTarget)
|
||||
{
|
||||
assert(NULL != ptSource);
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_cl_convt_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_CONVERT_TO_RGB565;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = NULL;
|
||||
this.Source.ptTile = ptSource;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief convert the colour format of a given tile to gray8
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptSource the source tile
|
||||
* \param[out] ptTarget the output tile (holding a buffer)
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_convert_colour_to_gray8( arm_2d_op_cl_convt_t *ptOP,
|
||||
const arm_2d_tile_t *ptSource,
|
||||
const arm_2d_tile_t *ptTarget)
|
||||
{
|
||||
assert(NULL != ptSource);
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_cl_convt_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_CONVERT_TO_GRAY8;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = NULL;
|
||||
this.Source.ptTile = ptSource;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_sw_convert_colour_to_gray8(__arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_cl_convt_t, ptTask->ptOP);
|
||||
|
||||
if (!this.Source.ptTile->bHasEnforcedColour) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_MISSING_PARAM;
|
||||
}
|
||||
|
||||
|
||||
switch ( this.Source.ptTile->tInfo.tColourInfo.u3ColourSZ) {
|
||||
case ARM_2D_COLOUR_8BIT:
|
||||
/* no need to convert, return cpl directly */
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_16BIT:
|
||||
__arm_2d_impl_rgb565_to_gray8( ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&(ptTask->Param.tCopy.tCopySize));
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_32BIT:
|
||||
__arm_2d_impl_cccn888_to_gray8( ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&(ptTask->Param.tCopy.tCopySize));
|
||||
break;
|
||||
default:
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_UNSUPPORTED_COLOUR;
|
||||
}
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
|
||||
arm_fsm_rt_t __arm_2d_sw_convert_colour_to_rgb565(__arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_cl_convt_t, ptTask->ptOP);
|
||||
|
||||
if (!this.Source.ptTile->bHasEnforcedColour) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_MISSING_PARAM;
|
||||
}
|
||||
|
||||
|
||||
switch ( this.Source.ptTile->tInfo.tColourInfo.u3ColourSZ) {
|
||||
case ARM_2D_COLOUR_8BIT:
|
||||
__arm_2d_impl_gray8_to_rgb565( ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&(ptTask->Param.tCopy.tCopySize));
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_16BIT:
|
||||
/* no need to convert, return cpl directly */
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_32BIT:
|
||||
__arm_2d_impl_cccn888_to_rgb565( ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&(ptTask->Param.tCopy.tCopySize));
|
||||
break;
|
||||
default:
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_UNSUPPORTED_COLOUR;
|
||||
}
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_sw_convert_colour_to_rgb888(__arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_cl_convt_t, ptTask->ptOP);
|
||||
|
||||
if (!this.Source.ptTile->bHasEnforcedColour) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_MISSING_PARAM;
|
||||
}
|
||||
|
||||
|
||||
switch ( this.Source.ptTile->tInfo.tColourInfo.u3ColourSZ) {
|
||||
case ARM_2D_COLOUR_8BIT:
|
||||
__arm_2d_impl_gray8_to_cccn888( ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&(ptTask->Param.tCopy.tCopySize));
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_16BIT:
|
||||
__arm_2d_impl_rgb565_to_cccn888( ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&(ptTask->Param.tCopy.tCopySize));
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_32BIT:
|
||||
/* no need to convert, return cpl directly */
|
||||
break;
|
||||
default:
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_UNSUPPORTED_COLOUR;
|
||||
}
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Accelerable Low Level APIs *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
__WEAK
|
||||
void __arm_2d_impl_gray8_to_rgb565( uint8_t *__RESTRICT pchSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint16_t *__RESTRICT phwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint8_t *__RESTRICT pchSource = pchSourceBase;
|
||||
uint16_t *__RESTRICT phwTarget = phwTargetBase;
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
__arm_2d_color_fast_rgb_t hwTargetPixel;
|
||||
|
||||
uint_fast8_t chColour = *pchSource++;
|
||||
|
||||
hwTargetPixel.R = chColour;
|
||||
hwTargetPixel.G = chColour;
|
||||
hwTargetPixel.B = chColour;
|
||||
|
||||
*phwTarget++ = __arm_2d_rgb565_pack(&hwTargetPixel);
|
||||
}
|
||||
|
||||
pchSourceBase += iSourceStride;
|
||||
phwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __arm_2d_impl_cccn888_to_rgb565(uint32_t *__RESTRICT pwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint16_t *__RESTRICT phwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint32_t *__RESTRICT pwSource = pwSourceBase;
|
||||
uint16_t *__RESTRICT phwTarget = phwTargetBase;
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
arm_2d_color_bgra8888_t wSrcPixel;
|
||||
__arm_2d_color_fast_rgb_t hwTargetPixel;
|
||||
|
||||
wSrcPixel.tValue = *pwSource++;
|
||||
hwTargetPixel.R = wSrcPixel.u8R;
|
||||
hwTargetPixel.G = wSrcPixel.u8G;
|
||||
hwTargetPixel.B = wSrcPixel.u8B;
|
||||
|
||||
*phwTarget++ = __arm_2d_rgb565_pack(&hwTargetPixel);
|
||||
}
|
||||
|
||||
pwSourceBase += iSourceStride;
|
||||
phwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __arm_2d_impl_gray8_to_cccn888(uint8_t *__RESTRICT pchSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint32_t *__RESTRICT pwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint8_t *__RESTRICT pchSource = pchSourceBase;
|
||||
uint32_t *__RESTRICT pwTarget = pwTargetBase;
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
|
||||
uint_fast8_t chPixel = *pchSource++;
|
||||
arm_2d_color_bgra8888_t wTargetPixel;
|
||||
|
||||
wTargetPixel.u8R = chPixel;
|
||||
wTargetPixel.u8G = chPixel;
|
||||
wTargetPixel.u8B = chPixel;
|
||||
wTargetPixel.u8A = 0xFF;
|
||||
*pwTarget++ = wTargetPixel.tValue;
|
||||
}
|
||||
|
||||
pchSourceBase += iSourceStride;
|
||||
pwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __arm_2d_impl_rgb565_to_cccn888(uint16_t *__RESTRICT phwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint32_t *__RESTRICT pwTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint16_t *__RESTRICT phwSource = phwSourceBase;
|
||||
uint32_t *__RESTRICT pwTarget = pwTargetBase;
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
__arm_2d_color_fast_rgb_t hwSrcPixel;
|
||||
arm_2d_color_bgra8888_t wTargetPixel;
|
||||
|
||||
__arm_2d_rgb565_unpack(*phwSource++, &hwSrcPixel);
|
||||
wTargetPixel.u8R = hwSrcPixel.R;
|
||||
wTargetPixel.u8G = hwSrcPixel.G;
|
||||
wTargetPixel.u8B = hwSrcPixel.B;
|
||||
wTargetPixel.u8A = 0xFF;
|
||||
*pwTarget++ = wTargetPixel.tValue;
|
||||
}
|
||||
|
||||
phwSourceBase += iSourceStride;
|
||||
pwTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
__WEAK
|
||||
void __arm_2d_impl_rgb565_to_gray8( uint16_t *__RESTRICT phwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint8_t *__RESTRICT pchTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint16_t *__RESTRICT phwSource = phwSourceBase;
|
||||
uint8_t *__RESTRICT pchTarget = pchTargetBase;
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
__arm_2d_color_fast_rgb_t hwSrcPixel;
|
||||
uint_fast16_t hwPixel = 0;
|
||||
|
||||
__arm_2d_rgb565_unpack(*phwSource++, &hwSrcPixel);
|
||||
hwPixel += hwSrcPixel.R;
|
||||
hwPixel += hwSrcPixel.G;
|
||||
hwPixel += hwSrcPixel.B;
|
||||
|
||||
*pchTarget++ = hwPixel / 3;
|
||||
}
|
||||
|
||||
phwSourceBase += iSourceStride;
|
||||
pchTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
__WEAK
|
||||
void __arm_2d_impl_cccn888_to_gray8(uint32_t *__RESTRICT pwSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint8_t *__RESTRICT pchTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t *__RESTRICT ptCopySize)
|
||||
{
|
||||
for (int_fast16_t y = 0; y < ptCopySize->iHeight; y++) {
|
||||
|
||||
const uint32_t *__RESTRICT pwSource = pwSourceBase;
|
||||
uint8_t *__RESTRICT pchTarget = pchTargetBase;
|
||||
|
||||
for (int_fast16_t x = 0; x < ptCopySize->iWidth; x++) {
|
||||
arm_2d_color_bgra8888_t wSrcPixel;
|
||||
uint_fast16_t hwPixel = 0;
|
||||
|
||||
wSrcPixel.tValue = *pwSource++;
|
||||
hwPixel += wSrcPixel.u8R;
|
||||
hwPixel += wSrcPixel.u8G;
|
||||
hwPixel += wSrcPixel.u8B;
|
||||
|
||||
*pchTarget++ = hwPixel / 3;
|
||||
}
|
||||
|
||||
pwSourceBase += iSourceStride;
|
||||
pchTargetBase += iTargetStride;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Low Level IO Interfaces *
|
||||
*----------------------------------------------------------------------------*/
|
||||
__WEAK
|
||||
def_low_lv_io( __ARM_2D_IO_COLOUR_CONVERT_TO_GRAY8,
|
||||
__arm_2d_sw_convert_colour_to_gray8);
|
||||
__WEAK
|
||||
def_low_lv_io( __ARM_2D_IO_COLOUR_CONVERT_TO_RGB565,
|
||||
__arm_2d_sw_convert_colour_to_rgb565);
|
||||
__WEAK
|
||||
def_low_lv_io( __ARM_2D_IO_COLOUR_CONVERT_TO_RGB888,
|
||||
__arm_2d_sw_convert_colour_to_rgb888);
|
||||
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_CONVERT_TO_GRAY8 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_GRAY8,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = true,
|
||||
.bHasTarget = true,
|
||||
.bAllowEnforcedColour = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_COLOUR_FORMAT_CONVERSION,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptCopyLike = ref_low_lv_io(__ARM_2D_IO_COLOUR_CONVERT_TO_GRAY8),
|
||||
.ptFillLike = NULL,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_CONVERT_TO_RGB565 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_RGB565,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = true,
|
||||
.bHasTarget = true,
|
||||
.bAllowEnforcedColour = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_COLOUR_FORMAT_CONVERSION,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptCopyLike = ref_low_lv_io(__ARM_2D_IO_COLOUR_CONVERT_TO_RGB565),
|
||||
.ptFillLike = NULL,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_CONVERT_TO_RGB888 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_CCCN888,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = true,
|
||||
.bHasTarget = true,
|
||||
.bAllowEnforcedColour = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_COLOUR_FORMAT_CONVERSION,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptCopyLike = ref_low_lv_io(__ARM_2D_IO_COLOUR_CONVERT_TO_RGB888),
|
||||
.ptFillLike = NULL,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,913 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2022 Arm Limited or its affiliates. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Project: Arm-2D Library
|
||||
* Title: arm-2d_draw.c
|
||||
* Description: APIs for basic drawing
|
||||
*
|
||||
* $Date: 21. April 2022
|
||||
* $Revision: V.1.0.0
|
||||
*
|
||||
* Target Processor: Cortex-M cores
|
||||
*
|
||||
* -------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/*============================ INCLUDES ======================================*/
|
||||
#define __ARM_2D_IMPL__
|
||||
|
||||
#include "arm_2d.h"
|
||||
#include "__arm_2d_impl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic ignored "-Wunknown-warning-option"
|
||||
# pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||
# pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
|
||||
# pragma clang diagnostic ignored "-Wmissing-variable-declarations"
|
||||
# pragma clang diagnostic ignored "-Wcast-qual"
|
||||
# pragma clang diagnostic ignored "-Wcast-align"
|
||||
# pragma clang diagnostic ignored "-Wextra-semi-stmt"
|
||||
# pragma clang diagnostic ignored "-Wsign-conversion"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
|
||||
# pragma clang diagnostic ignored "-Wdouble-promotion"
|
||||
# pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-float-conversion"
|
||||
# pragma clang diagnostic ignored "-Wimplicit-int-conversion"
|
||||
# pragma clang diagnostic ignored "-Wtautological-pointer-compare"
|
||||
# pragma clang diagnostic ignored "-Wsign-compare"
|
||||
# pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
# pragma clang diagnostic ignored "-Wswitch-enum"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wdeclaration-after-statement"
|
||||
#elif defined(__IS_COMPILER_ARM_COMPILER_5__)
|
||||
# pragma diag_suppress 174,177,188,68,513,144
|
||||
#endif
|
||||
|
||||
/*============================ MACROS ========================================*/
|
||||
/*============================ MACROFIED FUNCTIONS ===========================*/
|
||||
/*============================ TYPES =========================================*/
|
||||
/*============================ GLOBAL VARIABLES ==============================*/
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
/*============================ IMPLEMENTATION ================================*/
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Accelerable Low Level APIs *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*! adding support with c code template */
|
||||
|
||||
#define __API_COLOUR c8bit
|
||||
#define __API_INT_TYPE uint8_t
|
||||
|
||||
#include "__arm_2d_fill_colour.inc"
|
||||
|
||||
#define __API_COLOUR rgb16
|
||||
#define __API_INT_TYPE uint16_t
|
||||
|
||||
#include "__arm_2d_fill_colour.inc"
|
||||
|
||||
|
||||
#define __API_COLOUR rgb32
|
||||
#define __API_INT_TYPE uint32_t
|
||||
|
||||
#include "__arm_2d_fill_colour.inc"
|
||||
|
||||
|
||||
/*! adding support with c code template */
|
||||
#define __API_COLOUR c8bit
|
||||
#define __API_INT_TYPE uint8_t
|
||||
#include "__arm_2d_draw_pattern.inc"
|
||||
|
||||
#define __API_COLOUR rgb16
|
||||
#define __API_INT_TYPE uint16_t
|
||||
#include "__arm_2d_draw_pattern.inc"
|
||||
|
||||
|
||||
#define __API_COLOUR rgb32
|
||||
#define __API_INT_TYPE uint32_t
|
||||
#include "__arm_2d_draw_pattern.inc"
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Draw a point with specified colour *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief draw a point with a given 8bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \param[in] chColour an 8bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*
|
||||
* \note As those draw point APIs involve the region calculation
|
||||
* which is only useful when partial framebuffer is used, it is slow.
|
||||
* For gettting better performance, if the target tile is root and the
|
||||
* target location is inside the target region, please use the
|
||||
* functions with "_fast" posfix.
|
||||
*
|
||||
*/
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_c8bit_draw_point( arm_2d_op_drw_pt_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint_fast8_t chColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_drw_pt_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
arm_2d_region_t tPointRegion = {
|
||||
.tLocation = tLocation,
|
||||
.tSize = {1,1},
|
||||
};
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_DRAW_POINT_C8BIT;
|
||||
OP_CORE.Preference.u2ACCMethods = ARM_2D_PREF_ACC_SW_ONLY;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = &tPointRegion;
|
||||
this.chColour = chColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief draw a point with a given 16bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \param[in] hwColour an 16bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*
|
||||
* \note As those draw point APIs involve the region calculation
|
||||
* which is only useful when partial framebuffer is used, it is slow.
|
||||
* For gettting better performance, if the target tile is root and the
|
||||
* target location is inside the target region, please use the
|
||||
* functions with "_fast" posfix.
|
||||
*
|
||||
*/
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb16_draw_point( arm_2d_op_drw_pt_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint_fast16_t hwColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_drw_pt_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
arm_2d_region_t tPointRegion = {
|
||||
.tLocation = tLocation,
|
||||
.tSize = {1,1},
|
||||
};
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_DRAW_POINT_RGB16;
|
||||
OP_CORE.Preference.u2ACCMethods = ARM_2D_PREF_ACC_SW_ONLY;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = &tPointRegion;
|
||||
this.hwColour = hwColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief draw a point with a given 32bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target root tile
|
||||
* \param[in] tLocation the target location
|
||||
* \param[in] wColour an 32bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*
|
||||
* \note As those draw point APIs involve the region calculation
|
||||
* which is only useful when partial framebuffer is used, it is slow.
|
||||
* For gettting better performance, if the target tile is root and the
|
||||
* target location is inside the target region, please use the
|
||||
* functions with "_fast" posfix.
|
||||
*
|
||||
*/
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb32_draw_point( arm_2d_op_drw_pt_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_location_t tLocation,
|
||||
uint32_t wColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_drw_pt_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
arm_2d_region_t tPointRegion = {
|
||||
.tLocation = tLocation,
|
||||
.tSize = {1,1},
|
||||
};
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_DRAW_POINT_RGB32;
|
||||
OP_CORE.Preference.u2ACCMethods = ARM_2D_PREF_ACC_SW_ONLY;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = &tPointRegion;
|
||||
this.wColour = wColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_sw_draw_point(__arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_drw_pt_t, ptTask->ptOP)
|
||||
|
||||
switch (OP_CORE.ptOp->Info.Colour.u3ColourSZ) {
|
||||
case ARM_2D_COLOUR_SZ_8BIT:
|
||||
(*(uint8_t *)ptTask->Param.tTileProcess.pBuffer) = this.chColour;
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_16BIT:
|
||||
(*(uint16_t *)ptTask->Param.tTileProcess.pBuffer) = this.hwColour;
|
||||
break;
|
||||
case ARM_2D_COLOUR_SZ_32BIT:
|
||||
(*(uint32_t *)ptTask->Param.tTileProcess.pBuffer) = this.wColour;
|
||||
break;
|
||||
default:
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Fill tile with a specified colour *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief fill the target region with a given 8bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] chColour a 8bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_c8bit_fill_colour( arm_2d_op_fill_cl_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint_fast8_t chColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_fill_cl_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_FILL_COLOUR_C8BIT;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = ptRegion;
|
||||
this.chColour = chColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief fill the target region with a given 16bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] hwColour a 16bit colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb16_fill_colour( arm_2d_op_fill_cl_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint_fast16_t hwColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_fill_cl_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_FILL_COLOUR_RGB16;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = ptRegion;
|
||||
this.hwColour = hwColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief fill the target region with a given 32bit colour
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wColour a 32bit colour
|
||||
* \return arm_fsm_rt_t the operations result
|
||||
*/
|
||||
ARM_NONNULL(2)
|
||||
arm_fsm_rt_t arm_2dp_rgb32_fill_colour( arm_2d_op_fill_cl_t *ptOP,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wColour)
|
||||
{
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_fill_cl_t, ptOP);
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_FILL_COLOUR_RGB32;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = ptRegion;
|
||||
this.wColour = wColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_colour_filling(__arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_fill_cl_t, ptTask->ptOP)
|
||||
assert(ARM_2D_COLOUR_SZ_8BIT == OP_CORE.ptOp->Info.Colour.u3ColourSZ);
|
||||
|
||||
__arm_2d_impl_c8bit_colour_filling(
|
||||
ptTask->Param.tTileProcess.pBuffer,
|
||||
ptTask->Param.tTileProcess.iStride,
|
||||
&(ptTask->Param.tTileProcess.tValidRegion.tSize),
|
||||
this.chColour);
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_colour_filling(__arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_fill_cl_t, ptTask->ptOP)
|
||||
assert(ARM_2D_COLOUR_SZ_16BIT == OP_CORE.ptOp->Info.Colour.u3ColourSZ);
|
||||
|
||||
__arm_2d_impl_rgb16_colour_filling(
|
||||
ptTask->Param.tTileProcess.pBuffer,
|
||||
ptTask->Param.tTileProcess.iStride,
|
||||
&(ptTask->Param.tTileProcess.tValidRegion.tSize),
|
||||
this.hwColour);
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_colour_filling(__arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_fill_cl_t, ptTask->ptOP)
|
||||
assert(ARM_2D_COLOUR_SZ_32BIT == OP_CORE.ptOp->Info.Colour.u3ColourSZ);
|
||||
|
||||
__arm_2d_impl_rgb32_colour_filling(
|
||||
ptTask->Param.tTileProcess.pBuffer,
|
||||
ptTask->Param.tTileProcess.iStride,
|
||||
&(ptTask->Param.tTileProcess.tValidRegion.tSize),
|
||||
this.wColour);
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Draw a bit patterns *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*!
|
||||
* \brief copy a bit-pattern with given 8bit colours
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptPattern the source bit pattern
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wMode the copy mode
|
||||
* \param[in] chForeColour the foreground colour
|
||||
* \param[in] chBackColour the background colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_c8bit_draw_pattern( arm_2d_op_drw_patn_t *ptOP,
|
||||
const arm_2d_tile_t *ptPattern,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wMode,
|
||||
uint8_t chForeColour,
|
||||
uint8_t chBackColour)
|
||||
{
|
||||
assert(NULL != ptPattern);
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_drw_patn_t, ptOP);
|
||||
|
||||
|
||||
if ( (wMode & (ARM_2D_DRW_PATN_MODE_NO_FG_COLOR |
|
||||
ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR |
|
||||
ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR ))
|
||||
== (ARM_2D_DRW_PATN_MODE_NO_FG_COLOR)) {
|
||||
|
||||
//! nothing todo
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_DRAW_PATTERN_C8BIT;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = ptRegion;
|
||||
this.Source.ptTile = ptPattern;
|
||||
this.wMode = wMode;
|
||||
this.Foreground.chColour = chForeColour;
|
||||
this.Background.chColour = chBackColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief copy a bit-pattern with given 16bit colours
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptPattern the source bit pattern
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wMode the copy mode
|
||||
* \param[in] hwForeColour the foreground colour
|
||||
* \param[in] hwBackColour the background colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_rgb16_draw_pattern( arm_2d_op_drw_patn_t *ptOP,
|
||||
const arm_2d_tile_t *ptPattern,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wMode,
|
||||
uint16_t hwForeColour,
|
||||
uint16_t hwBackColour)
|
||||
{
|
||||
assert(NULL != ptPattern);
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_drw_patn_t, ptOP);
|
||||
|
||||
if ( (wMode & (ARM_2D_DRW_PATN_MODE_NO_FG_COLOR |
|
||||
ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR |
|
||||
ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR ))
|
||||
== (ARM_2D_DRW_PATN_MODE_NO_FG_COLOR)) {
|
||||
|
||||
//! nothing todo
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_DRAW_PATTERN_RGB16;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = ptRegion;
|
||||
this.Source.ptTile = ptPattern;
|
||||
this.wMode = wMode;
|
||||
this.Foreground.hwColour = hwForeColour;
|
||||
this.Background.hwColour = hwBackColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief copy a bit-pattern with given 32bit colours
|
||||
* \param[in] ptOP the control block, NULL means using the default control block
|
||||
* \param[in] ptPattern the source bit pattern
|
||||
* \param[in] ptTarget the target tile
|
||||
* \param[in] ptRegion the target region
|
||||
* \param[in] wMode the copy mode
|
||||
* \param[in] wForeColour the foreground colour
|
||||
* \param[in] wBackColour the background colour
|
||||
* \return arm_fsm_rt_t the operation result
|
||||
*/
|
||||
ARM_NONNULL(2,3)
|
||||
arm_fsm_rt_t arm_2dp_rgb32_draw_pattern(arm_2d_op_drw_patn_t *ptOP,
|
||||
const arm_2d_tile_t *ptPattern,
|
||||
const arm_2d_tile_t *ptTarget,
|
||||
const arm_2d_region_t *ptRegion,
|
||||
uint32_t wMode,
|
||||
uint32_t wForeColour,
|
||||
uint32_t wBackColour)
|
||||
{
|
||||
|
||||
assert(NULL != ptPattern);
|
||||
assert(NULL != ptTarget);
|
||||
|
||||
ARM_2D_IMPL(arm_2d_op_drw_patn_t, ptOP);
|
||||
|
||||
|
||||
if ( (wMode & (ARM_2D_DRW_PATN_MODE_NO_FG_COLOR |
|
||||
ARM_2D_DRW_PATH_MODE_COMP_FG_COLOUR |
|
||||
ARM_2D_DRW_PATN_MODE_WITH_BG_COLOR ))
|
||||
== (ARM_2D_DRW_PATN_MODE_NO_FG_COLOR)) {
|
||||
|
||||
//! nothing todo
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
if (!__arm_2d_op_acquire((arm_2d_op_core_t *)ptThis)) {
|
||||
return arm_fsm_rt_on_going;
|
||||
}
|
||||
|
||||
//memset(ptThis, 0, sizeof(*ptThis));
|
||||
|
||||
|
||||
OP_CORE.ptOp = &ARM_2D_OP_DRAW_PATTERN_RGB32;
|
||||
|
||||
this.Target.ptTile = ptTarget;
|
||||
this.Target.ptRegion = ptRegion;
|
||||
this.Source.ptTile = ptPattern;
|
||||
this.wMode = wMode;
|
||||
this.Foreground.wColour = wForeColour;
|
||||
this.Background.wColour = wBackColour;
|
||||
|
||||
return __arm_2d_op_invoke((arm_2d_op_core_t *)ptThis);
|
||||
}
|
||||
|
||||
|
||||
arm_fsm_rt_t __arm_2d_c8bit_sw_draw_pattern( __arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_drw_patn_t, ptTask->ptOP);
|
||||
assert(ARM_2D_COLOUR_SZ_8BIT == OP_CORE.ptOp->Info.Colour.u3ColourSZ);
|
||||
uint32_t wMode = this.wMode;
|
||||
|
||||
#if 0
|
||||
if (!this.Source.ptTile->bHasEnforcedColour) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
if (ARM_2D_COLOUR_SZ_1BIT != this.Source.ptTile->tColourInfo.u3ColourSZ) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (wMode & (ARM_2D_CP_MODE_Y_MIRROR | ARM_2D_CP_MODE_X_MIRROR)) {
|
||||
#if 0
|
||||
//! todo: add support for mirror
|
||||
__arm_2d_impl_c8bit_draw_pattern_with_mirror(
|
||||
ptTask->Param.tCopy.pSource ,
|
||||
ptTask->Param.tCopy.iSourceStride,
|
||||
ptTask->Param.tCopy.pTarget,
|
||||
ptTask->Param.tCopy.iTargetStride,
|
||||
&ptTask->Param.tCopy.tCopySize,
|
||||
wMode);
|
||||
break;
|
||||
#else
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
#endif
|
||||
} else {
|
||||
//! draw bit-pattern
|
||||
__arm_2d_impl_c8bit_draw_pattern(
|
||||
ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.nOffset,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&ptTask->Param.tCopy.tCopySize,
|
||||
wMode,
|
||||
this.Foreground.hwColour,
|
||||
this.Background.hwColour);
|
||||
}
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_rgb16_sw_draw_pattern( __arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_drw_patn_t, ptTask->ptOP);
|
||||
assert(ARM_2D_COLOUR_SZ_16BIT == OP_CORE.ptOp->Info.Colour.u3ColourSZ);
|
||||
uint32_t wMode = this.wMode;
|
||||
|
||||
#if 0
|
||||
if (!this.Source.ptTile->bHasEnforcedColour) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
if (ARM_2D_COLOUR_SZ_1BIT != this.Source.ptTile->tColourInfo.u3ColourSZ) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (wMode & (ARM_2D_CP_MODE_Y_MIRROR | ARM_2D_CP_MODE_X_MIRROR)) {
|
||||
#if 0
|
||||
//! todo: add support for mirror
|
||||
__arm_2d_impl_rgb16_draw_pattern_with_mirror(
|
||||
ptTask->Param.tCopy.pSource ,
|
||||
ptTask->Param.tCopy.iSourceStride,
|
||||
ptTask->Param.tCopy.pTarget,
|
||||
ptTask->Param.tCopy.iTargetStride,
|
||||
&ptTask->Param.tCopy.tCopySize,
|
||||
wMode);
|
||||
break;
|
||||
#else
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
#endif
|
||||
} else {
|
||||
//! draw bit-pattern
|
||||
__arm_2d_impl_rgb16_draw_pattern(
|
||||
ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.nOffset,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&ptTask->Param.tCopy.tCopySize,
|
||||
wMode,
|
||||
this.Foreground.hwColour,
|
||||
this.Background.hwColour);
|
||||
}
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
arm_fsm_rt_t __arm_2d_rgb32_sw_draw_pattern( __arm_2d_sub_task_t *ptTask)
|
||||
{
|
||||
ARM_2D_IMPL(arm_2d_op_drw_patn_t, ptTask->ptOP);
|
||||
assert(ARM_2D_COLOUR_SZ_32BIT == OP_CORE.ptOp->Info.Colour.u3ColourSZ);
|
||||
uint32_t wMode = this.wMode;
|
||||
|
||||
#if 0
|
||||
if (!this.Source.ptTile->bHasEnforcedColour) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
if (ARM_2D_COLOUR_SZ_1BIT != this.Source.ptTile->tColourInfo.u3ColourSZ) {
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (wMode & (ARM_2D_CP_MODE_Y_MIRROR | ARM_2D_CP_MODE_X_MIRROR)) {
|
||||
#if 0
|
||||
//! todo: add support for mirror
|
||||
__arm_2d_impl_rgb32_draw_pattern_with_mirror(
|
||||
ptTask->Param.tCopy.pSource ,
|
||||
ptTask->Param.tCopy.iSourceStride,
|
||||
ptTask->Param.tCopy.pTarget,
|
||||
ptTask->Param.tCopy.iTargetStride,
|
||||
&ptTask->Param.tCopy.tCopySize,
|
||||
wMode);
|
||||
#else
|
||||
return (arm_fsm_rt_t)ARM_2D_ERR_NOT_SUPPORT;
|
||||
#endif
|
||||
} else {
|
||||
__arm_2d_impl_rgb32_draw_pattern(
|
||||
ptTask->Param.tCopy.tSource.pBuffer,
|
||||
ptTask->Param.tCopy.tSource.nOffset,
|
||||
ptTask->Param.tCopy.tSource.iStride,
|
||||
ptTask->Param.tCopy.tTarget.pBuffer,
|
||||
ptTask->Param.tCopy.tTarget.iStride,
|
||||
&ptTask->Param.tCopy.tCopySize,
|
||||
wMode,
|
||||
this.Foreground.wColour,
|
||||
this.Background.wColour);
|
||||
}
|
||||
|
||||
return arm_fsm_rt_cpl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Low Level IO Interfaces *
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
__WEAK
|
||||
def_low_lv_io(__ARM_2D_IO_DRAW_POINT, __arm_2d_sw_draw_point);
|
||||
|
||||
__WEAK
|
||||
def_low_lv_io(__ARM_2D_IO_DRAW_PATTERN_C8BIT, __arm_2d_c8bit_sw_draw_pattern);
|
||||
__WEAK
|
||||
def_low_lv_io(__ARM_2D_IO_DRAW_PATTERN_RGB16, __arm_2d_rgb16_sw_draw_pattern);
|
||||
__WEAK
|
||||
def_low_lv_io(__ARM_2D_IO_DRAW_PATTERN_RGB32, __arm_2d_rgb32_sw_draw_pattern);
|
||||
|
||||
__WEAK
|
||||
def_low_lv_io(__ARM_2D_IO_FILL_COLOUR_C8BIT, __arm_2d_c8bit_sw_colour_filling);
|
||||
__WEAK
|
||||
def_low_lv_io(__ARM_2D_IO_FILL_COLOUR_RGB16, __arm_2d_rgb16_sw_colour_filling);
|
||||
__WEAK
|
||||
def_low_lv_io(__ARM_2D_IO_FILL_COLOUR_RGB32, __arm_2d_rgb32_sw_colour_filling);
|
||||
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_POINT_C8BIT = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_8BIT,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = false,
|
||||
.bHasTarget = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_DRAW_POINT,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptTileProcessLike = ref_low_lv_io(__ARM_2D_IO_DRAW_POINT),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_POINT_RGB16 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_RGB16,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = false,
|
||||
.bHasTarget = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_DRAW_POINT,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptTileProcessLike = ref_low_lv_io(__ARM_2D_IO_DRAW_POINT),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_POINT_RGB32 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_RGB32,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = false,
|
||||
.bHasTarget = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_DRAW_POINT,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptTileProcessLike = ref_low_lv_io(__ARM_2D_IO_DRAW_POINT),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_PATTERN_C8BIT = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_8BIT,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = true,
|
||||
.bHasTarget = true,
|
||||
.bAllowEnforcedColour = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_DRAW_PATTERN,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptCopyLike = ref_low_lv_io(__ARM_2D_IO_DRAW_PATTERN_C8BIT),
|
||||
.ptFillLike = NULL,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_PATTERN_RGB16 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_RGB16,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = true,
|
||||
.bHasTarget = true,
|
||||
.bAllowEnforcedColour = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_DRAW_PATTERN,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptCopyLike = ref_low_lv_io(__ARM_2D_IO_DRAW_PATTERN_RGB16),
|
||||
.ptFillLike = NULL,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_DRAW_PATTERN_RGB32 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_RGB32,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = true,
|
||||
.bHasTarget = true,
|
||||
.bAllowEnforcedColour = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_DRAW_PATTERN,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptCopyLike = ref_low_lv_io(__ARM_2D_IO_DRAW_PATTERN_RGB32),
|
||||
.ptFillLike = NULL,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_C8BIT = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_8BIT,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = false,
|
||||
.bHasTarget = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_FILL_COLOUR,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptTileProcessLike = ref_low_lv_io(__ARM_2D_IO_FILL_COLOUR_C8BIT),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_RGB16 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_RGB16,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = false,
|
||||
.bHasTarget = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_FILL_COLOUR,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptTileProcessLike = ref_low_lv_io(__ARM_2D_IO_FILL_COLOUR_RGB16),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const __arm_2d_op_info_t ARM_2D_OP_FILL_COLOUR_RGB32 = {
|
||||
.Info = {
|
||||
.Colour = {
|
||||
.chScheme = ARM_2D_COLOUR_RGB32,
|
||||
},
|
||||
.Param = {
|
||||
.bHasSource = false,
|
||||
.bHasTarget = true,
|
||||
},
|
||||
.chOpIndex = __ARM_2D_OP_IDX_FILL_COLOUR,
|
||||
|
||||
.LowLevelIO = {
|
||||
.ptTileProcessLike = ref_low_lv_io(__ARM_2D_IO_FILL_COLOUR_RGB32),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -47,12 +47,10 @@ extern
|
||||
const arm_2d_tile_t c_tileWhiteDotAlphaQuarter;
|
||||
|
||||
/*============================ PROTOTYPES ====================================*/
|
||||
__attribute__((nothrow))
|
||||
|
||||
/*============================ LOCAL VARIABLES ===============================*/
|
||||
|
||||
declare_tile(s_tCorner)
|
||||
implement_tile(s_tCorner, 7, 7, uint8_t,
|
||||
impl_fb(s_tCorner, 7, 7, uint8_t,
|
||||
.tInfo = {
|
||||
.bIsRoot = true,
|
||||
.bHasEnforcedColour = true,
|
||||
|
1182
package/Arm2D/asset_small_icon_sun.c
Normal file
1182
package/Arm2D/asset_small_icon_sun.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user