Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/osamu620/OpenJPH
Browse files Browse the repository at this point in the history
  • Loading branch information
osamu620 committed Nov 13, 2024
2 parents 81757e8 + 811f3a2 commit 6c567bd
Show file tree
Hide file tree
Showing 65 changed files with 12,039 additions and 1,160 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ccp-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# taken from https://github.com/onqtam/doctest/blob/master/.github/workflows/main.yml

name: C/C++ CI
on: push
on:
push:
pull_request:
types: [opened, reopened]


jobs:
build:
strategy:
fail-fast: false
matrix:
include: [
{ system: MacOS, runner: macos-latest },
Expand All @@ -25,6 +30,7 @@ jobs:

build_windows:
strategy:
fail-fast: false
matrix:
include: [
{ system: Windows, runner: windows-latest },
Expand All @@ -42,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 @@ -63,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}}"
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Open source implementation of High-throughput JPEG2000 (HTJ2K), also known as JPH, JPEG2000 Part 15, ISO/IEC 15444-15, and ITU-T T.814. Here, we are interested in implementing the HTJ2K only, supporting features that are defined in JPEG2000 Part 1 (for example, for wavelet transform, only reversible 5/3 and irreversible 9/7 are supported).

The interested reader is referred to the [short HTJ2K white paper](http://ds.jpeg.org/whitepapers/jpeg-htj2k-whitepaper.pdf), or the [extended HTJ2K white paper](https://htj2k.com/wp-content/uploads/white-paper.pdf) for more details on HTJ2K. [This](https://kakadusoftware.com/wp-content/uploads/icip2019.pdf) paper explores the attainable performance on CPU, while [this](https://kakadusoftware.com/wp-content/uploads/ICIP2019_GPU.pdf) and [this](https://webapps.unsworks.library.unsw.edu.au/fapi/datastream/unsworks:75139/bin990339e4-8805-4456-ae30-223d85f9b1c1) explores performance on the GPU.
The interested reader is referred to the [short HTJ2K white paper](http://ds.jpeg.org/whitepapers/jpeg-htj2k-whitepaper.pdf), or the [extended HTJ2K white paper](https://htj2k.com/wp-content/uploads/white-paper.pdf) for more details on HTJ2K. [This](https://kakadusoftware.com/wp-content/uploads/icip2019.pdf) paper explores the attainable performance on CPU, while [this](https://kakadusoftware.com/wp-content/uploads/ICIP2019_GPU.pdf) and [this](http://hdl.handle.net/1959.4/unsworks_75139) explores performance on the GPU.

# The standard #

Expand All @@ -17,4 +17,8 @@ The standard is available free of charge from [ITU website](https://www.itu.int/
* [Compiling and Running in Docker](./docs/docker.md)
* [Usage Example](./docs/usage_examples.md)
* [Web-based Demos](./docs/web_demos.md)
* [Doxygen Documentation Style](./docs/doxygen_style.md)
* [Doxygen Documentation Style](./docs/doxygen_style.md)

# Repositories #
[![Packaging status](https://repology.org/badge/vertical-allrepos/openjph.svg)](https://repology.org/project/openjph/versions)

121 changes: 116 additions & 5 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 @@ -135,7 +135,7 @@ namespace ojph {

ui32 cur_line;
si64 start_of_data;
int planar;
bool planar;
ui32 bit_depth[3];
bool is_signed[3];
point subsampling[3];
Expand Down Expand Up @@ -446,6 +446,68 @@ namespace ojph {
size_t buffer_size;
};

////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////
class pfm_in : public image_in_base
{
public:
pfm_in(mem_fixed_allocator *p = NULL)
{
fh = 0;
fname = NULL;
alloc_p = p;
temp_buf = NULL;
temp_buf_byte_size = 0;
bit_depth[0] = bit_depth[1] = bit_depth[2] = 32;
scale = 0.0f;
little_endian = true;
width = height = num_comps = 0;

cur_line = 0;
start_of_data = 0;
}
virtual ~pfm_in()
{
close();
if (alloc_p == NULL && temp_buf)
free(temp_buf);
}

void open(const char* filename);
void finalize_alloc();
void configure(ui32* bit_depth) {
assert(num_comps != 0);
for (ui32 c = 0; c < num_comps; ++c)
this->bit_depth[c] = bit_depth[c];
}
virtual ui32 read(const line_buf* line, ui32 comp_num);
void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }

size get_size() { assert(fh); return size(width, height); }
ui32 get_width() { assert(fh); return width; }
ui32 get_height() { assert(fh); return height; }
ui32 get_num_components() { assert(fh); return num_comps; }

private:
FILE *fh;
const char *fname;
mem_fixed_allocator *alloc_p;
float *temp_buf;
size_t temp_buf_byte_size;
ui32 bit_depth[3]; // this truncates data to bit_depth in the LSB
float scale;
bool little_endian;
ui32 width, height, num_comps;
ui32 cur_line;
si64 start_of_data;
};


////////////////////////////////////////////////////////////////////////////
// Accelerators (defined in ojph_img_io_*)
typedef void (*conversion_fun)(const line_buf *ln0, const line_buf *ln1,
Expand Down Expand Up @@ -559,7 +621,7 @@ namespace ojph {
ui32 width, height, num_components;
ui32 bit_depth, bytes_per_sample;
ui8* buffer;
ui32 buffer_size;
size_t buffer_size;
ui32 cur_line, samples_per_line, bytes_per_line;
conversion_fun converter;
const line_buf *lptr[3];
Expand Down Expand Up @@ -621,7 +683,7 @@ namespace ojph {
ui32 bit_depth_of_data[4];
ui32 bytes_per_sample;
ui8* buffer;
ui32 buffer_size;
size_t buffer_size;
ui32 cur_line, samples_per_line;
};
#endif /* OJPH_ENABLE_TIFF_SUPPORT */
Expand Down Expand Up @@ -698,11 +760,60 @@ 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;
};

////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////
class pfm_out : public image_out_base
{
public:
pfm_out()
{
fh = NULL;
fname = NULL;
buffer = NULL;
buffer_size = 0;
width = height = num_components = 0;
scale = -1.0f;
bit_depth[0] = bit_depth[1] = bit_depth[2] = 32;
cur_line = 0;
start_of_data = 0;
}
virtual ~pfm_out()
{
close();
if (buffer)
free(buffer);
}

void open(char* filename);
void configure(ui32 width, ui32 height, ui32 num_components,
float scale, ui32* bit_depth);
virtual ui32 write(const line_buf* line, ui32 comp_num);
virtual void close() { if(fh) { fclose(fh); fh = NULL; } fname = NULL; }

private:
FILE *fh;
const char *fname;
float* buffer;
size_t buffer_size;
ui32 width, height, num_components;
float scale;
ui32 bit_depth[3];
ui32 cur_line;
si64 start_of_data;
};


}

#endif // !OJPH_IMG_IO_H
Loading

0 comments on commit 6c567bd

Please sign in to comment.