Skip to content

Commit

Permalink
build yuzuki-chameleon package with hw jpg decoder (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui authored Mar 2, 2024
1 parent b79de2e commit 585cae2
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,16 @@ jobs:
export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain
export STAGING_DIR=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain
- name: yuzuki-chameleon
single-core: false
cmake-toolchain: arm-openwrt-linux-gnueabi.toolchain.cmake
setup-toolchain-cmd: |
wget -q https://github.com/YuzukiHD/sunxi-bsp-toolchains/releases/download/1.0.0/toolchain-sunxi-glibc-arm-gcc-830.tar.gz
tar -xf toolchain-sunxi-glibc-arm-gcc-830.tar.gz
setup-env-cmd: |
export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/toolchain-sunxi-glibc-gcc-830/toolchain
export STAGING_DIR=$GITHUB_WORKSPACE/toolchain-sunxi-glibc-gcc-830/toolchain
- name: purple-pi
single-core: false
cmake-toolchain: arm-linux-gnueabihf.toolchain.cmake
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ https://github.com/nihui/opencv-mobile/releases/latest
<img alt="opencv4-tinyvision" src="https://img.shields.io/badge/download-4.9.0-blue?style=for-the-badge">
</a>
</td>
<td>
<a href="https://yuzukihd.top">
<img alt="yuzuki-chameleon" src="https://github.com/YuzukiHD/YuzukiChameleon/blob/master/Bitmap/main.jpeg" width="auto" height="120">
<br /><b>yuzuki-chameleon</b>
</a>
<br />arm-openwrt-linux-gnueabi<br />
&#9989; HW JPG decoder<br />
<a href="https://github.com/nihui/opencv-mobile/releases/latest/download/opencv-mobile-4.9.0-yuzuki-chameleon.zip">
<img alt="opencv4-yuzuki-chameleon" src="https://img.shields.io/badge/download-4.9.0-blue?style=for-the-badge">
</a>
</td>
</tr>
<tr>
<td>
<a href="http://www.industio.cn/product-item-5.html">
<img alt="purple-pi" src="https://img01.71360.com/file/read/www2/M00/38/09/wKj2K2MMbSKAXKhHAAJMw0S-VfY400.jpg" width="auto" height="120">
Expand All @@ -348,8 +361,6 @@ https://github.com/nihui/opencv-mobile/releases/latest
<img alt="opencv4-purple-pi" src="https://img.shields.io/badge/download-4.9.0-blue?style=for-the-badge">
</a>
</td>
</tr>
<tr>
<td>
<a href="https://www.myir.cn/shows/118/66.html">
<img alt="myir-t113i" src="https://srcc.myir.cn/images/20230918/c70910f0cb705987ced19d6888ef4288.jpg" width="auto" height="120">
Expand Down
13 changes: 12 additions & 1 deletion highgui/src/jpeg_decoder_aw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace cv {
// 0 = unknown
// 1 = t113-i
// 2 = tinyvision
// 3 = yuzuki-chameleon
static int get_device_model()
{
static int device_model = -1;
Expand All @@ -67,6 +68,11 @@ static int get_device_model()
// tinyvision
device_model = 2;
}
if (strncmp(buf, "sun50iw9", 8) == 0)
{
// yuzuki-chameleon
device_model = 3;
}
}

return device_model;
Expand All @@ -86,6 +92,11 @@ static bool is_device_whitelisted()
// tinyvision
return true;
}
if (device_model == 3)
{
// yuzuki-chameleon
return true;
}

return false;
}
Expand Down Expand Up @@ -1111,7 +1122,7 @@ int jpeg_decoder_aw_impl::decode(const unsigned char* jpgdata, int jpgsize, unsi
vconfig_v85x.nRotateHoldingFrameBufferNum = 0;
vconfig_v85x.nDecodeSmoothFrameBufferNum = 1;

VConfig* p_vconfig = get_device_model() == 2 ? (VConfig*)&vconfig_v85x : &vconfig;
VConfig* p_vconfig = (get_device_model() == 2 || get_device_model() == 3) ? (VConfig*)&vconfig_v85x : &vconfig;

int ret = InitializeVideoDecoder(vdec, &videoInfo, p_vconfig);
if (ret != 0)
Expand Down
24 changes: 24 additions & 0 deletions toolchains/aarch64-openwrt-linux-gnu.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

if(DEFINED ENV{TOOLCHAIN_ROOT_PATH})
file(TO_CMAKE_PATH $ENV{TOOLCHAIN_ROOT_PATH} TOOLCHAIN_ROOT_PATH)
else()
message(FATAL_ERROR "TOOLCHAIN_ROOT_PATH env must be defined")
endif()

set(TOOLCHAIN_ROOT_PATH ${TOOLCHAIN_ROOT_PATH} CACHE STRING "root path to toolchain")

set(CMAKE_C_COMPILER "${TOOLCHAIN_ROOT_PATH}/bin/aarch64-openwrt-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN_ROOT_PATH}/bin/aarch64-openwrt-linux-gnu-g++")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_C_FLAGS "-march=armv8-a")
set(CMAKE_CXX_FLAGS "-march=armv8-a")

# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")
24 changes: 24 additions & 0 deletions toolchains/arm-openwrt-linux-gnueabi.toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

if(DEFINED ENV{TOOLCHAIN_ROOT_PATH})
file(TO_CMAKE_PATH $ENV{TOOLCHAIN_ROOT_PATH} TOOLCHAIN_ROOT_PATH)
else()
message(FATAL_ERROR "TOOLCHAIN_ROOT_PATH env must be defined")
endif()

set(TOOLCHAIN_ROOT_PATH ${TOOLCHAIN_ROOT_PATH} CACHE STRING "root path to toolchain")

set(CMAKE_C_COMPILER "${TOOLCHAIN_ROOT_PATH}/bin/arm-openwrt-linux-gnueabi-gcc")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN_ROOT_PATH}/bin/arm-openwrt-linux-gnueabi-g++")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon")
set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon")

# cache flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "c flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "c++ flags")

0 comments on commit 585cae2

Please sign in to comment.