Skip to content

Commit

Permalink
Merge pull request #158 from aous72/Adding_32bit_lossless
Browse files Browse the repository at this point in the history
Adding 32bit lossless support.
  • Loading branch information
aous72 authored Nov 10, 2024
2 parents 00d2335 + 6541f2c commit bca572f
Show file tree
Hide file tree
Showing 57 changed files with 7,656 additions and 1,127 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ccp-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
jobs:
build:
strategy:
fail-fast: false
matrix:
include: [
{ system: MacOS, runner: macos-latest },
Expand All @@ -29,6 +30,7 @@ jobs:

build_windows:
strategy:
fail-fast: false
matrix:
include: [
{ system: Windows, runner: windows-latest },
Expand All @@ -46,9 +48,11 @@ jobs:

test:
strategy:
fail-fast: false
matrix:
include: [
{ system: MacOS, runner: macos-latest },
{ system: MacOS-13, runner: macos-13 },
{ system: MacOS-latest, runner: macos-latest },
{ system: Ubuntu-latest, runner: ubuntu-latest },
]
name: ${{ matrix.system }} Test
Expand All @@ -67,6 +71,7 @@ jobs:

test_windows:
strategy:
fail-fast: false
matrix:
include: [
{ system: Windows, runner: windows-latest },
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

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

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

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
4 changes: 2 additions & 2 deletions src/apps/common/ojph_img_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace ojph {
////////////////////////////////////////////////////////////////////////////
// defined elsewhere
class mem_fixed_allocator;
struct line_buf;
class line_buf;

////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -760,7 +760,7 @@ namespace ojph {
const char* fname;
bool is_signed;
ui32 bit_depth, bytes_per_sample;
si32 lower_val, upper_val;
si64 lower_val, upper_val;
ui32 width;
ui8* buffer;
ui32 buffer_size;
Expand Down
34 changes: 16 additions & 18 deletions src/apps/ojph_compress/ojph_compress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,20 +592,25 @@ int main(int argc, char * argv[]) {
".pfm files receive special treatment. Currently, lossy compression\n"
"with these files is not supported, only lossless. When these files are\n"
"used, the NLT segment marker is automatically inserted into the\n"
"codestream. For these files the following arguments can be useful\n"
" -signed a comma - separated list of true or false parameters, one\n"
"codestream when needed, as explained shortly. The following arguments\n"
"can be useful for this file type.\n"
" -signed a comma-separated list of true or false parameters, one\n"
" for each component; for example: true,false,false.\n"
" The sign only affects how values are treated; for negative\n"
" values the standard requires a special non-linear\n"
" transformation. When signed is false, no transformation\n"
" is employed, as we assume all values are 0 or positive.\n"
" When signed is true, the aforementioned transformation is\n"
" employed on negative values only.\n"
" If you are sure that all sample values are positive or 0,\n"
" set the corresponding entry to false; otherwise set it to\n"
" true.\n"
" When a component entry is set to true, an NLT segment\n"
" marker segment is inserted into the codestream.\n"
" The NLT segment specifies a non-linear transform that\n"
" changes only negative values, producing better coding\n"
" efficiency.\n"
" The NLT segment marker might be less supported in other\n"
" encoders.\n"
" -bit_depth a comma-separated list of bit depth values, one per \n"
" component; for example: 12,10,10.\n"
" Floating value numbers are treated as integers, and they\n"
" are shifted to the right, keeping only the specified\n"
" number of bits. Note that a bit depth of 28 upwards is not\n"
" number of bits. Up to 32 bits (which is the default) are\n"
" supported.\n"

"\n";
Expand Down Expand Up @@ -768,10 +773,6 @@ int main(int argc, char * argv[]) {
assert(num_comps == 1 || num_comps == 3);
siz.set_num_components(num_comps);

if (bit_depth[0] == 0)
OJPH_ERROR(0x01000091,
"-bit_depth must be specified (this is temporary only).\n");

if (bit_depth[0] != 0) // one was set
if (num_bit_depths < num_comps) // but if not enough, repeat
for (ojph::ui32 c = num_bit_depths; c < num_comps; ++c)
Expand Down Expand Up @@ -840,11 +841,8 @@ int main(int argc, char * argv[]) {
nlt.set_type3_transformation(c, true);
}
else
OJPH_ERROR(0x01000093, "The support for pfm image is not "
"complete; I need to figure how to modify the interface "
"to better support the exchange of floating point data. "
"Feeding float point data is not supported yet, unless it "
"is for lossless compression.");
OJPH_ERROR(0x01000093, "We currently support lossless only for "
"pfm images; this may change in the future.");

codestream.set_planar(false);
if (profile_string[0] != '\0')
Expand Down
Loading

0 comments on commit bca572f

Please sign in to comment.