Skip to content

Commit

Permalink
合并kunpeng分支和主分支
Browse files Browse the repository at this point in the history
  • Loading branch information
dujiangpku committed Jun 29, 2022
1 parent cd29508 commit 38f4346
Show file tree
Hide file tree
Showing 26 changed files with 38,042 additions and 1,489 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
2) supports to compile for Windows/Linux systems.
3) optimized for SSE4/AVX2 chips.
4) 10bit encoding on all supported platforms (without SIMD).
5) The uavs3 codec has supported x86 and arm platforms, and has been tested and verified on the Kunpeng processor.
6) The ARM platform recommends the Kunpeng processor.

# license
Copyright reserved by “Peking University Shenzhen Graduate School”, “Peng Cheng Laboratory”, and “Guangdong Bohua UHD Innovation Corporation” <br><br>
Expand All @@ -13,7 +15,7 @@

# compile
The default configuration only support 8bit decoding. <br>
To support 10bit streams decoding, edit inc/com_api.h : #define BIT_DEPTH 10
To support 10bit streams decoding:cmake -DCOMPILE_10BIT=1

## windows
Prerequisites:
Expand All @@ -22,6 +24,8 @@ Prerequisites:
build:
1. ./version.bat (to generate version.h)
2. solution file: build/x86_windows/uavs3e.sln

To support 10bit streams decoding, edit inc/com_api.h : #define COMPILE_10BIT 1

## linux
Prerequisites:
Expand All @@ -30,9 +34,10 @@ Prerequisites:

Build:
1. mkdir build/linux
2. cd build/linux && cmake ../..
2. cd build/linux && cmake -DCOMPILE_10BIT=0 ../..
3. make && make install


To support 10bit streams decoding:cmake -DCOMPILE_10BIT=1
to build shared library, set BUILD_SHARED_LIBS=1 please.

# Run tests
Expand Down Expand Up @@ -79,4 +84,4 @@ This program is originally developed by the team of Prof.Ronggang Wang (rgwang@p
*This program also refers to the following fast algorithm:
* 陈焕浜, 杨海涛. SMVD编码加速. AVS技术提案, M5218. 2020年3月.
* 赵寅, 杨海涛. 块划分快速算法. AVS技术提案, M5137. 2020年3月.
* 张焕宸, 陈雅梅, 喻莉. 基于灰度共生矩阵与编码信息的帧内预测快速算法. AVS技术提案, M5327.
* 张焕宸, 陈雅梅, 喻莉. 基于灰度共生矩阵与编码信息的帧内预测快速算法. AVS技术提案, M5327.
21 changes: 17 additions & 4 deletions inc/com_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,25 @@ extern "C"
{
#endif

#define BIT_DEPTH 8
#if defined(__linux__)
#if COMPILE_10BIT
typedef unsigned short pel;
#define BIT_DEPTH 10
#else
typedef unsigned char pel;
#define BIT_DEPTH 8
#endif

#if (BIT_DEPTH == 8)
typedef unsigned char pel; /* pixel type */
#else
typedef unsigned short pel; /* pixel type */
#define COMPILE_10BIT 0
#if COMPILE_10BIT
typedef unsigned short pel;
#define BIT_DEPTH 10
#else
typedef unsigned char pel;
#define BIT_DEPTH 8
#endif

#endif

/*****************************************************************************
Expand Down
10 changes: 7 additions & 3 deletions inc/com_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ u8 com_tree_split(int w, int h, split_mode_t split, u8 slice_type);


/* function selection define based on platforms */
#if (defined(__ANDROID__) && defined(__aarch64__)) || (defined(__APPLE__) && defined(__arm64__))
#if (defined(__ANDROID__) && defined(__aarch64__)) || (defined(__APPLE__) && defined(__arm64__)) || (defined(__linux__) && defined(__aarch64__))
#define ENABLE_FUNCTION_C 1
#define ENABLE_FUNCTION_ARM64 1
#elif (defined(__ANDROID__) && defined(__arm__)) || (defined(__APPLE__) && defined(__ARM_NEON__))
Expand Down Expand Up @@ -373,6 +373,10 @@ void uavs3e_funs_init_sse();
void uavs3e_funs_init_avx2();
#endif

#if ENABLE_FUNCTION_ARM64
void uavs3e_funs_init_arm64();
#endif

void *uavs3e_align_malloc(int i_size);
void uavs3e_align_free(void *p);

Expand All @@ -383,7 +387,7 @@ static avs3_always_inline int uavs3e_get_log2(int v)
_BitScanReverse(&index, v);
return index;
#else
return 31 - __builtin_clz(v);
return 31 - __builtin_clz(v|1);
#endif
}

Expand Down Expand Up @@ -439,4 +443,4 @@ static int com_img_release(com_img_t *img)
}
}

#endif /* _COM_UTIL_H_ */
#endif /* _COM_UTIL_H_ */
23 changes: 23 additions & 0 deletions inc/uavs3e.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,29 @@ extern "C"

#define PIC_ALIGN_SIZE 8

#if defined(_WIN32) || defined(__linux__)
#include <sys/timeb.h>
#elif defined(__GNUC__)
#include <sys/time.h>
#endif

#include "stddef.h"

static __inline long long get_mdate(void)
{
#if defined(_WIN32) || defined(__linux__)
struct timeb tb;
ftime(&tb);
return ((long long)tb.time * 1000 + (long long)tb.millitm) * 1000;
#elif defined(__GNUC__)
struct timeval tv;
gettimeofday(&tv, NULL);
return (long long)tv.tv_sec * 1000000 + tv.tv_usec;
#else
return -1;
#endif
}

typedef struct uavs3e_enc_stat_t {
void *buf; // [out] bitstream buffer
int bytes; // [out] size of bitstream
Expand Down
38 changes: 33 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,41 @@ set(LIBNAME uavs3e)

# add source
aux_source_directory(. DIR_UAVS3E_SRC)
aux_source_directory(./sse DIR_X86_SRC)
aux_source_directory(./avx2 DIR_X86_256_SRC)

list(APPEND DIR_UAVS3E_SRC ${DIR_X86_CORE})
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64")
message("-- enable_armv8")
aux_source_directory(./armv8 DIR_ARM64_SRC)
list(APPEND DIR_ARM64_SRC "./armv8/arm64.c")
list(APPEND DIR_ARM64_SRC "./armv8/alf_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/deblock_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/def_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/inter_pred_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/intra_pred_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/trans_arm64.c")
list(APPEND DIR_ARM64_SRC "./armv8/trans_dct_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/cost_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/pixel_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/itrans_dct_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/sao_arm64.c")
list(APPEND DIR_ARM64_SRC "./armv8/sao_kernel_arm64.S")
list(APPEND DIR_ARM64_SRC "./armv8/itrans_arm64.c")
include_directories("./armv8")
enable_language(ASM)
else()
aux_source_directory(./sse DIR_X86_SRC)
aux_source_directory(./avx2 DIR_X86_256_SRC)
list(APPEND DIR_UAVS3E_SRC ${DIR_X86_CORE})
endif()

include_directories("../inc")

if(${COMPILE_10BIT})
add_definitions(-DCOMPILE_10BIT=1)
message("-- compile 10bit")
else()
add_definitions(-DCOMPILE_10BIT=0)
message("-- compile 8bit")
endif()

set_source_files_properties(${DIR_UAVS3E_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O3")
set_source_files_properties(${DIR_X86_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O3 -msse4.2")
set_source_files_properties(${DIR_X86_256_SRC} PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -fPIC -std=c99 -O3 -mavx2")
Expand Down Expand Up @@ -65,7 +93,7 @@ else()
MESSAGE(STATUS "BUILD_SHARED_LIBS \t\t: false")
endif()

add_library(uavs3e ${DIR_UAVS3E_SRC} ${DIR_X86_256_SRC} ${DIR_X86_SRC})
add_library(uavs3e ${DIR_UAVS3E_SRC} ${DIR_X86_256_SRC} ${DIR_X86_SRC} ${DIR_ARM64_SRC})

target_link_libraries(uavs3e m)
if(CMAKE_USE_PTHREADS_INIT)
Expand Down
Loading

0 comments on commit 38f4346

Please sign in to comment.