Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build-linux-amd64:
Expand Down Expand Up @@ -68,6 +69,25 @@ jobs:
cmake -S ${{github.workspace}} -B ${{github.workspace}}/build-arm -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/arm64_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build-arm

build-linux-s390x:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up CMake
uses: jwlawson/actions-setup-cmake@v2

- name: Install s390x toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu binutils-s390x-linux-gnu libc6-s390x-cross

- name: Build (crosscompile) PC Linux s390x
run: |
cmake -S ${{github.workspace}} -B ${{github.workspace}}/build-s390x -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=s390x -DCMAKE_C_COMPILER=s390x-linux-gnu-gcc -DCMAKE_CXX_COMPILER=s390x-linux-gnu-g++ -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build-s390x

build-darwin-arm64:
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -124,3 +144,29 @@ jobs:
with:
name: LastTest.log
path: ${{github.workspace}}/build/Testing/Temporary/LastTest.log

test-linux-s390x:
runs-on: ubuntu-latest
env:
QEMU_LD_PREFIX: /usr/s390x-linux-gnu
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up CMake
uses: jwlawson/actions-setup-cmake@v2

- name: Install s390x toolchain and emulator
run: |
sudo apt-get update
sudo apt-get install -y gcc-s390x-linux-gnu g++-s390x-linux-gnu binutils-s390x-linux-gnu libc6-s390x-cross qemu-user qemu-user-static

- name: Build (crosscompile) PC Linux s390x for tests
run: |
cmake -S ${{github.workspace}} -B ${{github.workspace}}/build-s390x -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=s390x -DCMAKE_C_COMPILER=s390x-linux-gnu-gcc -DCMAKE_CXX_COMPILER=s390x-linux-gnu-g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CROSSCOMPILING_EMULATOR="qemu-s390x;-L;/usr/s390x-linux-gnu"
cmake --build ${{github.workspace}}/build-s390x

- name: Run tests for s390x
run: |
cd build-s390x
ctest --output-on-failure --timeout 15
26 changes: 13 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ set_tests_properties(encode PROPERTIES
# Test - decode
add_test(NAME decode COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i out.oapv)
set_tests_properties(decode PROPERTIES
TIMEOUT 10
TIMEOUT 20
DEPENDS encode
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 125"
Expand All @@ -282,7 +282,7 @@ set_tests_properties(decode PROPERTIES
# Test - decode qp_A.apv
add_test(NAME decode_qp_A COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/qp_A.apv -v 3 --hash)
set_tests_properties(decode_qp_A PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -291,7 +291,7 @@ set_tests_properties(decode_qp_A PROPERTIES
# Test - decode qp_B.apv
add_test(NAME decode_qp_B COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/qp_B.apv -v 3 --hash)
set_tests_properties(decode_qp_B PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -300,7 +300,7 @@ set_tests_properties(decode_qp_B PROPERTIES
# Test - decode qp_C.apv
add_test(NAME decode_qp_C COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/qp_C.apv -v 3 --hash)
set_tests_properties(decode_qp_C PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -309,7 +309,7 @@ set_tests_properties(decode_qp_C PROPERTIES
# Test - decode qp_D.apv
add_test(NAME decode_qp_D COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/qp_D.apv -v 3 --hash)
set_tests_properties(decode_qp_D PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -318,7 +318,7 @@ set_tests_properties(decode_qp_D PROPERTIES
# Test - decode qp_E.apv
add_test(NAME decode_qp_E COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/qp_E.apv -v 3 --hash)
set_tests_properties(decode_qp_E PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -327,7 +327,7 @@ set_tests_properties(decode_qp_E PROPERTIES
# Test - decode syn_A.apv
add_test(NAME decode_syn_A COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/syn_A.apv -v 3 --hash)
set_tests_properties(decode_syn_A PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -336,7 +336,7 @@ set_tests_properties(decode_syn_A PROPERTIES
# Test - decode syn_B.apv
add_test(NAME decode_syn_B COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/syn_B.apv -v 3 --hash)
set_tests_properties(decode_syn_B PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -345,7 +345,7 @@ set_tests_properties(decode_syn_B PROPERTIES
# Test - decode tile_A.apv
add_test(NAME decode_tile_A COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/tile_A.apv -v 3 --hash)
set_tests_properties(decode_tile_A PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -354,7 +354,7 @@ set_tests_properties(decode_tile_A PROPERTIES
# Test - decode tile_B.apv
add_test(NAME decode_tile_B COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/tile_B.apv -v 3 --hash)
set_tests_properties(decode_tile_B PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -363,7 +363,7 @@ set_tests_properties(decode_tile_B PROPERTIES
# Test - decode tile_C.apv
add_test(NAME decode_tile_C COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/tile_C.apv -v 3 --hash)
set_tests_properties(decode_tile_C PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -372,7 +372,7 @@ set_tests_properties(decode_tile_C PROPERTIES
# Test - decode tile_D.apv
add_test(NAME decode_tile_D COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/tile_D.apv -v 3 --hash)
set_tests_properties(decode_tile_D PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand All @@ -381,7 +381,7 @@ set_tests_properties(decode_tile_D PROPERTIES
# Test - decode tile_E.apv
add_test(NAME decode_tile_E COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bin/oapv_app_dec -i ${CMAKE_CURRENT_SOURCE_DIR}/test/bitstream/tile_E.apv -v 3 --hash)
set_tests_properties(decode_tile_E PROPERTIES
TIMEOUT 10
TIMEOUT 20
FAIL_REGULAR_EXPRESSION "Decoded frame count = 0"
PASS_REGULAR_EXPRESSION "Decoded frame count = 3"
PASS_REGULAR_EXPRESSION ".*hash:match.*"
Expand Down
46 changes: 46 additions & 0 deletions src/oapv_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,51 @@ static __inline void oapv_mset_16b(s16 *dst, s16 v, int cnt)
/* CPU information */
int oapv_get_num_cpu_cores(void);

/* Endianness handling */
#if defined(__GNUC__) || defined(__clang__)
#define OAPV_SWAP16(x) __builtin_bswap16(x)
#define OAPV_SWAP32(x) __builtin_bswap32(x)
#define OAPV_SWAP64(x) __builtin_bswap64(x)
#elif defined(_MSC_VER)
#define OAPV_SWAP16(x) _byteswap_ushort(x)
#define OAPV_SWAP32(x) _byteswap_ulong(x)
#define OAPV_SWAP64(x) _byteswap_uint64(x)
#else
#define OAPV_SWAP16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
#define OAPV_SWAP32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#define OAPV_SWAP64(x) ((((x) & 0xff00000000000000ull) >> 56) | \
(((x) & 0x00ff000000000000ull) >> 40) | \
(((x) & 0x0000ff0000000000ull) >> 24) | \
(((x) & 0x000000ff00000000ull) >> 8) | \
(((x) & 0x00000000ff000000ull) << 8) | \
(((x) & 0x0000000000ff0000ull) << 24) | \
(((x) & 0x000000000000ff00ull) << 40) | \
(((x) & 0x00000000000000ffull) << 56))
#endif

#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define OAPV_BIG_ENDIAN 1
#define OAPV_CPU_TO_LE32(x) OAPV_SWAP32(x)
#define OAPV_CPU_TO_LE64(x) OAPV_SWAP64(x)
#define OAPV_LE32_TO_CPU(x) OAPV_SWAP32(x)
#define OAPV_LE64_TO_CPU(x) OAPV_SWAP64(x)
#define OAPV_CPU_TO_BE32(x) (x)
#define OAPV_CPU_TO_BE64(x) (x)
#define OAPV_BE32_TO_CPU(x) (x)
#define OAPV_BE64_TO_CPU(x) (x)
#else
// Little Endian (Default for x86/ARM)
#define OAPV_LITTLE_ENDIAN 1
#define OAPV_CPU_TO_LE32(x) (x)
#define OAPV_CPU_TO_LE64(x) (x)
#define OAPV_LE32_TO_CPU(x) (x)
#define OAPV_LE64_TO_CPU(x) (x)
#define OAPV_CPU_TO_BE32(x) OAPV_SWAP32(x)
#define OAPV_CPU_TO_BE64(x) OAPV_SWAP64(x)
#define OAPV_BE32_TO_CPU(x) OAPV_SWAP32(x)
#define OAPV_BE64_TO_CPU(x) OAPV_SWAP64(x)
#endif

#endif /* _OAPV_PORT_H_ */

Loading