Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for high throughput (HTJ2K) decoding. #1381

Merged
merged 3 commits into from
Sep 25, 2021
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install Requirements
run: |
sudo apt update
sudo apt install -y gcc g++
sudo apt install -y gcc g++ libtiff-dev libwebp-dev libzstd-dev

- name: Build and run tests
run: |
Expand Down
8 changes: 3 additions & 5 deletions scripts/verify-indentation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ ASTYLEDIFF=/tmp/astyle.diff
if [ ! -z $GITHUB_BASE_REF ] && [ ! -z $GITHUB_HEAD_REF ]; then
# on a PR
echo "GitHub PR COMMIT RANGE: ${GITHUB_BASE_REF}..${GITHUB_HEAD_REF}"
git branch ${GITHUB_BASE_REF} origin/${GITHUB_BASE_REF}
git branch ${GITHUB_HEAD_REF} origin/${GITHUB_HEAD_REF}
BASE_SHA1=$(git rev-parse ${GITHUB_BASE_REF})
HEAD_SHA1=$(git rev-parse ${GITHUB_HEAD_REF})
FILES=$(git diff --diff-filter=AMR --name-only ${BASE_SHA1}..${HEAD_SHA1} | tr '\n' ' ' )
git branch tmp_${GITHUB_BASE_REF} origin/${GITHUB_BASE_REF}
BASE_SHA1=$(git rev-parse tmp_${GITHUB_BASE_REF})
FILES=$(git diff --diff-filter=AMR --name-only ${BASE_SHA1}..${GITHUB_SHA} | tr '\n' ' ' )
elif [ ! -z $GITHUB_SHA ]; then
echo "GitHub push COMMIT $GITHUB_SHA"
FILES=$(git diff --diff-filter=AMR --name-only ${GITHUB_SHA}~1..${GITHUB_SHA} | tr '\n' ' ' )
Expand Down
24 changes: 20 additions & 4 deletions src/bin/jp2/opj_decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,24 @@ int load_images(dircnt_t *dirptr, char *imgdirpath)
int get_file_format(const char *filename)
{
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp", "tif", "tiff", "raw", "yuv", "rawl", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, TIF_DFMT, RAW_DFMT, RAW_DFMT, RAWL_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
static const char * const extension[] = {
"pgx", "pnm", "pgm", "ppm", "bmp",
"tif", "tiff",
"raw", "yuv", "rawl",
"tga", "png",
"j2k", "jp2", "jpt", "j2c", "jpc",
"jph", /* HTJ2K with JP2 boxes */
"jhc" /* HTJ2K codestream */
};
static const int format[] = {
PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT,
TIF_DFMT, TIF_DFMT,
RAW_DFMT, RAW_DFMT, RAWL_DFMT,
TGA_DFMT, PNG_DFMT,
J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT,
JP2_CFMT, /* HTJ2K with JP2 boxes */
J2K_CFMT /* HTJ2K codestream */
};
const char * ext = strrchr(filename, '.');
if (ext == NULL) {
return -1;
Expand Down Expand Up @@ -538,10 +554,10 @@ static int infile_format(const char *fname)

if (memcmp(buf, JP2_RFC3745_MAGIC, 12) == 0 || memcmp(buf, JP2_MAGIC, 4) == 0) {
magic_format = JP2_CFMT;
magic_s = ".jp2";
magic_s = ".jp2 or .jph";
} else if (memcmp(buf, J2K_CODESTREAM_MAGIC, 4) == 0) {
magic_format = J2K_CFMT;
magic_s = ".j2k or .jpc or .j2c";
magic_s = ".j2k or .jpc or .j2c or .jhc";
} else {
return -1;
}
Expand Down
24 changes: 20 additions & 4 deletions src/bin/jp2/opj_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,24 @@ static int load_images(dircnt_t *dirptr, char *imgdirpath)
static int get_file_format(const char *filename)
{
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp", "tif", "tiff", "raw", "yuv", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, TIF_DFMT, RAW_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
static const char * const extension[] = {
"pgx", "pnm", "pgm", "ppm", "bmp",
"tif", "tiff",
"raw", "yuv", "rawl",
"tga", "png",
"j2k", "jp2", "jpt", "j2c", "jpc",
"jph", /* HTJ2K with JP2 boxes */
"jhc" /* HTJ2K codestream */
};
static const int format[] = {
PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT,
TIF_DFMT, TIF_DFMT,
RAW_DFMT, RAW_DFMT, RAWL_DFMT,
TGA_DFMT, PNG_DFMT,
J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT,
JP2_CFMT, /* HTJ2K with JP2 boxes */
J2K_CFMT /* HTJ2K codestream */
};
const char *ext = strrchr(filename, '.');
if (ext == NULL) {
return -1;
Expand Down Expand Up @@ -271,10 +287,10 @@ static int infile_format(const char *fname)

if (memcmp(buf, JP2_RFC3745_MAGIC, 12) == 0 || memcmp(buf, JP2_MAGIC, 4) == 0) {
magic_format = JP2_CFMT;
magic_s = ".jp2";
magic_s = ".jp2 or .jph";
} else if (memcmp(buf, J2K_CODESTREAM_MAGIC, 4) == 0) {
magic_format = J2K_CFMT;
magic_s = ".j2k or .jpc or .j2c";
magic_s = ".j2k or .jpc or .j2c or .jhc";
} else {
return -1;
}
Expand Down
5 changes: 3 additions & 2 deletions src/lib/openjp2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set(OPENJPEG_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/dwt.h
${CMAKE_CURRENT_SOURCE_DIR}/event.c
${CMAKE_CURRENT_SOURCE_DIR}/event.h
${CMAKE_CURRENT_SOURCE_DIR}/ht_dec.c
${CMAKE_CURRENT_SOURCE_DIR}/image.c
${CMAKE_CURRENT_SOURCE_DIR}/image.h
${CMAKE_CURRENT_SOURCE_DIR}/invert.c
Expand Down Expand Up @@ -134,9 +135,9 @@ install(
endif()

if(BUILD_LUTS_GENERATOR)
# internal utility to generate t1_luts.h (part of the jp2 lib)
# internal utility to generate t1_luts.h and t1_ht_luts.h (part of the jp2 lib)
# no need to install:
add_executable(t1_generate_luts t1_generate_luts.c)
add_executable(t1_generate_luts t1_generate_luts.c t1_ht_generate_luts.c)
if(UNIX)
target_link_libraries(t1_generate_luts m)
endif()
Expand Down
Loading