Skip to content

Commit b90e43f

Browse files
committed
Merge branch 'master' into common2openjph
2 parents 6cfd213 + a1d29da commit b90e43f

File tree

15 files changed

+363
-185
lines changed

15 files changed

+363
-185
lines changed

.github/workflows/ccp-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
fail-fast: false
3434
matrix:
3535
include: [
36-
{ system: MacOS, runner: macos-latest },
36+
{ system: MacOS Dual Build, runner: macos-latest },
3737
]
3838
name: ${{ matrix.system }} Build
3939
runs-on: ${{ matrix.runner }}
@@ -113,7 +113,7 @@ jobs:
113113
fail-fast: false
114114
matrix:
115115
include: [
116-
{ system: MacOS-13, runner: macos-13 },
116+
{ system: MacOS-Intel, runner: macos-15-intel },
117117
{ system: MacOS-latest, runner: macos-latest },
118118
{ system: Ubuntu-latest, runner: ubuntu-latest },
119119
]

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
# Initializes the CodeQL tools for scanning.
5252
- name: Initialize CodeQL
53-
uses: github/codeql-action/init@v3
53+
uses: github/codeql-action/init@v4
5454
with:
5555
languages: ${{ matrix.language }}
5656
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -64,7 +64,7 @@ jobs:
6464
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
6565
# If this step fails, then you should remove it and run the build manually (see below)
6666
- name: Autobuild
67-
uses: github/codeql-action/autobuild@v3
67+
uses: github/codeql-action/autobuild@v4
6868

6969
# ℹ️ Command-line programs to run using the OS shell.
7070
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -77,6 +77,6 @@ jobs:
7777
# ./location_of_script_within_repo/buildscript.sh
7878

7979
- name: Perform CodeQL Analysis
80-
uses: github/codeql-action/analyze@v3
80+
uses: github/codeql-action/analyze@v4
8181
with:
8282
category: "/language:${{matrix.language}}"

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.12.0)
44
include(ojph_version.cmake)
55

66
## project
7-
project (openjph VERSION ${OPENJPH_VERSION} DESCRIPTION "Open source implementation of JPH" LANGUAGES CXX)
7+
project (openjph VERSION ${OPENJPH_VERSION} DESCRIPTION "Open source implementation of JPH" LANGUAGES C CXX)
88
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
99

1010
################################################################################################
@@ -118,6 +118,11 @@ endif()
118118
message(STATUS "Building ${CMAKE_BUILD_TYPE}")
119119

120120
## C++ version and flags
121+
# C11 is needed for aligned_alloc
122+
if (NOT CMAKE_C_STANDARD)
123+
set(CMAKE_C_STANDARD 11)
124+
endif()
125+
message(STATUS "C Standard is set to ${CMAKE_C_STANDARD}")
121126
# C++14 is needed for gtest, otherwise, C++11 is sufficient for the library
122127
if (NOT CMAKE_CXX_STANDARD)
123128
set(CMAKE_CXX_STANDARD 14)
@@ -127,7 +132,7 @@ message(STATUS "C++ Standard is set to ${CMAKE_CXX_STANDARD}")
127132
if (MSVC)
128133
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
129134
endif()
130-
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
135+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU" AND NOT MSVC)
131136
add_compile_options(
132137
-fexceptions
133138
-Wall

src/apps/others/ojph_sockets.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,16 @@ namespace ojph
165165
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
166166
buf, max_buf_size, NULL);
167167
buf[max_buf_size - 1] = 0;
168-
#elif (defined OJPH_OS_APPLE) || \
169-
((_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE)
168+
#elif (defined __GLIBC__) && \
169+
((defined _GNU_SOURCE) || (_POSIX_C_SOURCE < 200112L))
170+
v = strerror_r(errnum, (char*)buf, max_buf_size);
171+
#else
170172
// it is not clear if the returned value is in buf or in v
171173
int t = strerror_r(errnum, (char*)buf, max_buf_size);
172174
if (t != 0)
173175
OJPH_ERROR(0x00080002, "Error retrieving a text message for "
174176
"socket error number %d\n", errnum);
175177
buf[max_buf_size - 1] = 0;
176-
#else
177-
v = strerror_r(errnum, (char*)buf, max_buf_size);
178178
#endif
179179
std::string str;
180180
str = v;

src/core/CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ file(GLOB CODING_WASM "coding/*_wasm.cpp")
1111
file(GLOB CODING_AVX2 "coding/*_avx2.cpp")
1212
file(GLOB CODING_AVX512 "coding/*_avx512.cpp")
1313
file(GLOB COMMON "openjph/*.h")
14-
file(GLOB OTHERS "others/*.cpp")
14+
file(GLOB OTHERS "others/*.cpp" "others/*.c")
1515
file(GLOB TRANSFORM "transform/*.cpp" "transform/*.h")
1616
file(GLOB TRANSFORM_SSE "transform/*_sse.cpp")
1717
file(GLOB TRANSFORM_SSE2 "transform/*_sse2.cpp")
@@ -139,6 +139,23 @@ set_target_properties(openjph PROPERTIES POSITION_INDEPENDENT_CODE ON)
139139
target_compile_definitions(openjph PUBLIC _FILE_OFFSET_BITS=64)
140140
target_include_directories(openjph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/openjph> $<INSTALL_INTERFACE:include>)
141141

142+
## This is to check if aligned_alloc or posix_memalign is available
143+
# We want the code to compile for C11 and C++11.
144+
# std::aligned_alloc is only availabe in C++17.
145+
# So here we try to see which API is available and adapt the code to use it
146+
if (NOT MSVC)
147+
include(CheckSymbolExists)
148+
check_symbol_exists(aligned_alloc "stdlib.h" OJPH_ALIGNED_ALLOC_EXISTS)
149+
if (OJPH_ALIGNED_ALLOC_EXISTS)
150+
target_compile_definitions(openjph PRIVATE OJPH_ALIGNED_ALLOC_EXISTS)
151+
else()
152+
check_symbol_exists(posix_memalign "stdlib.h" OJPH_POSIX_MEMALIGN_EXISTS)
153+
if (OJPH_POSIX_MEMALIGN_EXISTS)
154+
target_compile_definitions(openjph PRIVATE OJPH_POSIX_MEMALIGN_EXISTS)
155+
endif()
156+
endif()
157+
endif()
158+
142159
if (MSVC)
143160
set(OJPH_LIB_NAME_STRING "openjph.${OPENJPH_VERSION_MAJOR}.${OPENJPH_VERSION_MINOR}")
144161
set_target_properties(openjph

src/core/codestream/ojph_codestream_local.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -716,17 +716,17 @@ namespace ojph {
716716
}
717717
com_len = swap_byte(com_len);
718718
file->seek(com_len - 2, infile_base::OJPH_SEEK_CUR);
719-
if (msg != NULL && msg_level != OJPH_MSG_LEVEL::NO_MSG)
719+
if (msg != NULL && msg_level != OJPH_MSG_NO_MSG)
720720
{
721-
if (msg_level == OJPH_MSG_LEVEL::INFO)
721+
if (msg_level == OJPH_MSG_INFO)
722722
{
723723
OJPH_INFO(0x00030001, "%s", msg);
724724
}
725-
else if (msg_level == OJPH_MSG_LEVEL::WARN)
725+
else if (msg_level == OJPH_MSG_WARN)
726726
{
727727
OJPH_WARN(0x00030001, "%s", msg);
728728
}
729-
else if (msg_level == OJPH_MSG_LEVEL::ERROR)
729+
else if (msg_level == OJPH_MSG_ERROR)
730730
{
731731
OJPH_ERROR(0x00030001, "%s", msg);
732732
}
@@ -753,10 +753,10 @@ namespace ojph {
753753
cap.read(file);
754754
else if (marker_idx == 1)
755755
//Skipping PRF marker segment; this should not cause any issues
756-
skip_marker(file, "PRF", NULL, OJPH_MSG_LEVEL::NO_MSG, false);
756+
skip_marker(file, "PRF", NULL, OJPH_MSG_NO_MSG, false);
757757
else if (marker_idx == 2)
758758
//Skipping CPF marker segment; this should not cause any issues
759-
skip_marker(file, "CPF", NULL, OJPH_MSG_LEVEL::NO_MSG, false);
759+
skip_marker(file, "CPF", NULL, OJPH_MSG_NO_MSG, false);
760760
else if (marker_idx == 3)
761761
{
762762
cod.read(file);
@@ -803,29 +803,29 @@ namespace ojph {
803803
}
804804
else if (marker_idx == 7)
805805
skip_marker(file, "RGN", "RGN is not supported yet",
806-
OJPH_MSG_LEVEL::WARN, false);
806+
OJPH_MSG_WARN, false);
807807
else if (marker_idx == 8)
808808
skip_marker(file, "POC", "POC is not supported yet",
809-
OJPH_MSG_LEVEL::WARN, false);
809+
OJPH_MSG_WARN, false);
810810
else if (marker_idx == 9)
811811
skip_marker(file, "PPM", "PPM is not supported yet",
812-
OJPH_MSG_LEVEL::WARN, false);
812+
OJPH_MSG_WARN, false);
813813
else if (marker_idx == 10)
814814
//Skipping TLM marker segment; this should not cause any issues
815-
skip_marker(file, "TLM", NULL, OJPH_MSG_LEVEL::NO_MSG, false);
815+
skip_marker(file, "TLM", NULL, OJPH_MSG_NO_MSG, false);
816816
else if (marker_idx == 11)
817817
//Skipping PLM marker segment; this should not cause any issues
818-
skip_marker(file, "PLM", NULL, OJPH_MSG_LEVEL::NO_MSG, false);
818+
skip_marker(file, "PLM", NULL, OJPH_MSG_NO_MSG, false);
819819
else if (marker_idx == 12)
820820
//Skipping CRG marker segment;
821821
skip_marker(file, "CRG", "CRG has been ignored; CRG is related to"
822822
" where the Cb and Cr colour components are co-sited or located"
823823
" with respect to the Y' luma component. Perhaps, it is better"
824824
" to get the individual components and assemble the samples"
825825
" according to your needs",
826-
OJPH_MSG_LEVEL::INFO, false);
826+
OJPH_MSG_INFO, false);
827827
else if (marker_idx == 13)
828-
skip_marker(file, "COM", NULL, OJPH_MSG_LEVEL::NO_MSG, false);
828+
skip_marker(file, "COM", NULL, OJPH_MSG_NO_MSG, false);
829829
else if (marker_idx == 14)
830830
dfs.read(file);
831831
else if (marker_idx == 15)
@@ -926,22 +926,22 @@ namespace ojph {
926926
if (marker_idx == 0)
927927
result = skip_marker(infile, "POC",
928928
"POC marker segment in a tile is not supported yet",
929-
OJPH_MSG_LEVEL::WARN, resilient);
929+
OJPH_MSG_WARN, resilient);
930930
else if (marker_idx == 1)
931931
result = skip_marker(infile, "PPT",
932932
"PPT marker segment in a tile is not supported yet",
933-
OJPH_MSG_LEVEL::WARN, resilient);
933+
OJPH_MSG_WARN, resilient);
934934
else if (marker_idx == 2)
935935
//Skipping PLT marker segment;this should not cause any issues
936936
result = skip_marker(infile, "PLT", NULL,
937-
OJPH_MSG_LEVEL::NO_MSG, resilient);
937+
OJPH_MSG_NO_MSG, resilient);
938938
else if (marker_idx == 3)
939939
result = skip_marker(infile, "COM", NULL,
940-
OJPH_MSG_LEVEL::NO_MSG, resilient);
940+
OJPH_MSG_NO_MSG, resilient);
941941
else if (marker_idx == 4)
942942
result = skip_marker(infile, "NLT",
943943
"NLT marker in tile is not supported yet",
944-
OJPH_MSG_LEVEL::WARN, resilient);
944+
OJPH_MSG_WARN, resilient);
945945
else if (marker_idx == 5)
946946
{
947947
sod_found = true;
@@ -990,42 +990,42 @@ namespace ojph {
990990
if (marker_idx == 0)
991991
result = skip_marker(infile, "COD",
992992
"COD marker segment in a tile is not supported yet",
993-
OJPH_MSG_LEVEL::WARN, resilient);
993+
OJPH_MSG_WARN, resilient);
994994
else if (marker_idx == 1)
995995
result = skip_marker(infile, "COC",
996996
"COC marker segment in a tile is not supported yet",
997-
OJPH_MSG_LEVEL::WARN, resilient);
997+
OJPH_MSG_WARN, resilient);
998998
else if (marker_idx == 2)
999999
result = skip_marker(infile, "QCD",
10001000
"QCD marker segment in a tile is not supported yet",
1001-
OJPH_MSG_LEVEL::WARN, resilient);
1001+
OJPH_MSG_WARN, resilient);
10021002
else if (marker_idx == 3)
10031003
result = skip_marker(infile, "QCC",
10041004
"QCC marker segment in a tile is not supported yet",
1005-
OJPH_MSG_LEVEL::WARN, resilient);
1005+
OJPH_MSG_WARN, resilient);
10061006
else if (marker_idx == 4)
10071007
result = skip_marker(infile, "RGN",
10081008
"RGN marker segment in a tile is not supported yet",
1009-
OJPH_MSG_LEVEL::WARN, resilient);
1009+
OJPH_MSG_WARN, resilient);
10101010
else if (marker_idx == 5)
10111011
result = skip_marker(infile, "POC",
10121012
"POC marker segment in a tile is not supported yet",
1013-
OJPH_MSG_LEVEL::WARN, resilient);
1013+
OJPH_MSG_WARN, resilient);
10141014
else if (marker_idx == 6)
10151015
result = skip_marker(infile, "PPT",
10161016
"PPT marker segment in a tile is not supported yet",
1017-
OJPH_MSG_LEVEL::WARN, resilient);
1017+
OJPH_MSG_WARN, resilient);
10181018
else if (marker_idx == 7)
10191019
//Skipping PLT marker segment;this should not cause any issues
10201020
result = skip_marker(infile, "PLT", NULL,
1021-
OJPH_MSG_LEVEL::NO_MSG, resilient);
1021+
OJPH_MSG_NO_MSG, resilient);
10221022
else if (marker_idx == 8)
10231023
result = skip_marker(infile, "COM", NULL,
1024-
OJPH_MSG_LEVEL::NO_MSG, resilient);
1024+
OJPH_MSG_NO_MSG, resilient);
10251025
else if (marker_idx == 9)
10261026
result = skip_marker(infile, "NLT",
10271027
"PPT marker segment in a tile is not supported yet",
1028-
OJPH_MSG_LEVEL::WARN, resilient);
1028+
OJPH_MSG_WARN, resilient);
10291029
else if (marker_idx == 10)
10301030
{
10311031
sod_found = true;

0 commit comments

Comments
 (0)