forked from colin121/x264-dsp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
329 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
filter=-whitespace/indent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project( | ||
x264-dsp | ||
VERSION 0.0.0.0 | ||
DESCRIPTION x264-dsp | ||
HOMEPAGE_URL https://github.com/Freed-Wu/x264-dsp | ||
LANGUAGES C ASM) | ||
# https://discourse.cmake.org/t/how-to-compile-linear-assemble/8122/1 | ||
list(APPEND CMAKE_ASM_SOURCE_FILE_EXTENSIONS sa) | ||
file(GLOB SRC *.c common/*.c encoder/*.c) | ||
add_executable(x264 ${SRC} ${ASM_SRC}) | ||
install(TARGETS x264 RUNTIME) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
include(CheckLibraryExists) | ||
check_library_exists(m logf "" HAVE_LIB_M) | ||
if(HAVE_LIB_M) | ||
target_link_libraries(x264 PUBLIC m) | ||
endif() | ||
|
||
set(_DOC_INPUT_FILENAME | ||
"input filename" | ||
CACHE STRING "") | ||
set(INPUT_FILENAME | ||
"352x288.yuv" | ||
CACHE STRING ${_DOC_INPUT_FILENAME}) | ||
|
||
set(_DOC_BIN2C | ||
"use bin2c" | ||
CACHE STRING "") | ||
option(BIN2C ${_DOC_BIN2C}) | ||
if(BIN2C) | ||
find_program(bin2c REQUIRED NAMES bin2c) | ||
if(NOT EXISTS ${INPUT_FILENAME}) | ||
message(FATAL_ERROR "${INPUT_FILENAME} doesn't exist!") | ||
endif() | ||
add_custom_target(yuv.h ALL COMMAND bin2c yuv < ${INPUT_FILENAME} > | ||
${CMAKE_BINARY_DIR}/yuv.h) | ||
add_dependencies(x264 yuv.h) | ||
endif() | ||
|
||
set(_DOC_DRY_RUN | ||
"do not write any file" | ||
CACHE STRING "") | ||
option(DRY_RUN ${_DOC_DRY_RUN}) | ||
|
||
set(_DOC_HAVE_TIC6X | ||
"enable TI C6X asm" | ||
CACHE STRING "") | ||
option(HAVE_TIC6X ${_DOC_HAVE_TIC6X} ON) | ||
|
||
set(_DOC_DOWNSAMPLE | ||
"downsample from 720p to 360p, 1, 2 means bilinear, bicubic" | ||
CACHE STRING "") | ||
set(DOWNSAMPLE | ||
0 | ||
CACHE STRING ${_DOC_DOWNSAMPLE}) | ||
if(NOT (DOWNSAMPLE GREATER_EQUAL 0 AND DOWNSAMPLE LESS 3)) | ||
message(FATAL_ERROR "${DOWNSAMPLE} is an invalid DOWNSAMPLE!") | ||
endif() | ||
|
||
set(_DOC_PADDING | ||
"padding method, 1..3 means edge, reflect, symmetric" | ||
CACHE STRING "") | ||
set(PADDING | ||
3 | ||
CACHE STRING ${_DOC_PADDING}) | ||
if(NOT (PADDING GREATER 0 AND PADDING LESS 4)) | ||
message(FATAL_ERROR "${PADDING} is an invalid PADDING!") | ||
endif() | ||
|
||
set(_DOC_SCALE | ||
"SCALE scale, a positive number" | ||
CACHE STRING "") | ||
set(SCALE | ||
2 | ||
CACHE STRING ${_DOC_SCALE}) | ||
if(SCALE LESS_EQUAL 0) | ||
message(FATAL_ERROR "${SCALE} is an invalid SCALE!") | ||
endif() | ||
|
||
set(_DOC_X264_BIT_DEPTH | ||
"bit depth, can be 8 or 10" | ||
CACHE STRING "") | ||
set(X264_BIT_DEPTH | ||
8 | ||
CACHE STRING ${_DOC_X264_BIT_DEPTH}) | ||
set(_LIST_X264_BIT_DEPTH 8 10) | ||
if(NOT (X264_BIT_DEPTH IN_LIST _LIST_X264_BIT_DEPTH)) | ||
message(FATAL_ERROR "${X264_BIT_DEPTH} is an invalid X264_BIT_DEPTH!") | ||
endif() | ||
|
||
set(_DOC_X264_CHROMA_FORMAT | ||
"chroma format, 0..3 means 400, 420, 422, 444" | ||
CACHE STRING "") | ||
set(X264_CHROMA_FORMAT | ||
1 | ||
CACHE STRING ${_DOC_X264_CHROMA_FORMAT}) | ||
if(NOT (X264_CHROMA_FORMAT GREATER_EQUAL 0 AND X264_CHROMA_FORMAT LESS 4)) | ||
message(FATAL_ERROR "${X264_CHROMA_FORMAT} is an invalid X264_CHROMA_FORMAT!") | ||
endif() | ||
|
||
set(_DOC_X264_LOG_LEVEL | ||
"log level, 0..3 means error, warning, info, debug" | ||
CACHE STRING "") | ||
set(X264_LOG_LEVEL | ||
2 | ||
CACHE STRING ${_DOC_X264_LOG_LEVEL}) | ||
if(NOT (X264_LOG_LEVEL GREATER_EQUAL 0 AND X264_LOG_LEVEL LESS 4)) | ||
message(FATAL_ERROR "${X264_LOG_LEVEL} is an invalid X264_LOG_LEVEL!") | ||
endif() | ||
|
||
configure_file(configure.h.in config.h) | ||
|
||
include(CTest) | ||
add_subdirectory(tests EXCLUDE_FROM_ALL) | ||
|
||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") | ||
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") | ||
set(CPACK_ARCHIVE_THREADS 0) | ||
set(CPACK_THREADS 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set(CMAKE_SYSTEM_NAME Android) | ||
if(NOT DEFINED CMAKE_ANDROID_ARCH_ABI) | ||
set(CMAKE_ANDROID_ARCH_ABI arm64-v8a) | ||
endif() | ||
if(NOT DEFINED CMAKE_ANDROID_NDK) | ||
set(CMAKE_ANDROID_NDK /opt/android-ndk) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set(CMAKE_SYSTEM_NAME Windows) | ||
if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR) | ||
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR}) | ||
endif() | ||
set(TOOLCHAIN_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32) | ||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) | ||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) |
Oops, something went wrong.