Skip to content

Commit c96eb31

Browse files
committed
gpujpeg_decoder_get_image_info(): fill interleaved
+ print with gpujpegtool
1 parent 3bfe7c4 commit c96eb31

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
22
# change version also in configure.ac
3-
project(gpujpeg VERSION 0.25.5 LANGUAGES C CUDA)
3+
project(gpujpeg VERSION 0.25.6 LANGUAGES C CUDA)
44

55
# options
66
set(BUILD_OPENGL OFF CACHE STRING "Build with OpenGL support, options are: AUTO ON OFF")

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2024-11-11 - 0.25.6
2+
----------
3+
- gpujpeg_decoder_get_image_info(): fill also interleaved (+ print
4+
with gpujpegtool)
5+
16
2024-10-08 - 0.25.5
27
----------
38
- added gpujpeg_decoder_create_with_params() (+ struct

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AC_PREREQ([2.65])
22
# change version also in CMakeLists.txt
3-
AC_INIT([libgpujpeg],[0.25.4],[https://github.com/CESNET/GPUJPEG/issues],[libgpujpeg],[https://github.com/CESNET/GPUJPEG])
3+
AC_INIT([libgpujpeg],[0.25.6],[https://github.com/CESNET/GPUJPEG/issues],[libgpujpeg],[https://github.com/CESNET/GPUJPEG])
44
AC_CONFIG_MACRO_DIR([m4])
55
AC_CONFIG_SRCDIR([src/main.c])
66
AC_CONFIG_AUX_DIR([.])

src/gpujpeg_reader.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,12 +1535,12 @@ int
15351535
gpujpeg_reader_get_image_info(uint8_t *image, size_t image_size, struct gpujpeg_image_parameters *param_image, struct gpujpeg_parameters *param, int *segment_count)
15361536
{
15371537
int segments = 0;
1538-
int interleaved = 0;
15391538
int unused[4];
15401539
uint8_t unused2[4];
15411540
enum gpujpeg_color_space header_color_space = GPUJPEG_NONE;
15421541
uint8_t *image_end = image + image_size;
15431542

1543+
param->interleaved = 0;
15441544
param->restart_interval = 0;
15451545

15461546
// Check first SOI marker
@@ -1602,7 +1602,7 @@ gpujpeg_reader_get_image_info(uint8_t *image, size_t image_size, struct gpujpeg_
16021602
assert(length > 3);
16031603
int comp_count = (int) gpujpeg_reader_read_byte(image); // comp count in the segment
16041604
if (comp_count > 1) {
1605-
interleaved = 1;
1605+
param->interleaved = 1;
16061606
}
16071607
if (segment_count == NULL) { // if not counting segments, we can skip the rest
16081608
eoi_presented = 1;
@@ -1675,7 +1675,8 @@ gpujpeg_reader_get_image_info(uint8_t *image, size_t image_size, struct gpujpeg_
16751675

16761676
if (param->sampling_factor[1].horizontal == 1 && param->sampling_factor[1].vertical == 1
16771677
&& param->sampling_factor[2].horizontal == 1 && param->sampling_factor[2].vertical == 1) {
1678-
int sum = interleaved << 16 | param->sampling_factor[0].horizontal << 8 | param->sampling_factor[0].vertical; // NOLINT
1678+
int sum = param->interleaved << 16 | param->sampling_factor[0].horizontal << 8 |
1679+
param->sampling_factor[0].vertical; // NOLINT
16791680
switch (sum) {
16801681
case 1<<16 | 1<<8 | 1: param_image->pixel_format = GPUJPEG_444_U8_P012; break; // NOLINT
16811682
case 0<<16 | 1<<8 | 1: param_image->pixel_format = GPUJPEG_444_U8_P0P1P2; break; // NOLINT

src/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ static int print_image_info_jpeg(const char *filename, int verbose) {
134134
if (gpujpeg_decoder_get_image_info(jpeg, len, &params_image, &params, &segment_count) == 0) {
135135
print_gpujpeg_image_parameters(params_image, false,
136136
gpujpeg_subsampling_get_name(params.comp_count, params.sampling_factor));
137+
printf("interleaved: %d\n", params.interleaved);
137138
if ( segment_count ) {
138139
printf("segment count: %d (DRI = %d)\n", segment_count, params.restart_interval);
139140
}

0 commit comments

Comments
 (0)