Skip to content

Commit

Permalink
decoder: return complete image info
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Mar 18, 2024
1 parent 3d79985 commit 84a3c5e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
# change version also in configure.ac
project(gpujpeg VERSION 0.21.0 LANGUAGES C CUDA)
project(gpujpeg VERSION 0.22.0 LANGUAGES C CUDA)

# options
set(BUILD_OPENGL OFF CACHE STRING "Build with OpenGL support, options are: AUTO ON OFF")
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2024-03-15 - 0.22.0
----------
- support for ZLUDA
- updated API - provide more information about the decompressed image in
gpujpeg_decoder_output, namely the image size

2023-06-02 - 0.21.0
----------
- support for larger images - until now, only pictures up to approx. 85 MP were
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AC_PREREQ([2.65])
# change version also in CMakeLists.txt
AC_INIT([libgpujpeg],[0.21.0],[https://github.com/CESNET/GPUJPEG/issues],[libgpujpeg],[https://github.com/CESNET/GPUJPEG])
AC_INIT([libgpujpeg],[0.22.0],[https://github.com/CESNET/GPUJPEG/issues],[libgpujpeg],[https://github.com/CESNET/GPUJPEG])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_AUX_DIR([.])
Expand Down
7 changes: 2 additions & 5 deletions libgpujpeg/gpujpeg_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,8 @@ struct gpujpeg_decoder_output
/// Decompressed data size
size_t data_size;

/// Decoded color space
enum gpujpeg_color_space color_space;

/// Decoded pixel format
enum gpujpeg_pixel_format pixel_format;
/// Decoded image parameters
struct gpujpeg_image_parameters param_image;

/// OpenGL texture
struct gpujpeg_opengl_texture* texture;
Expand Down
6 changes: 4 additions & 2 deletions src/gpujpeg_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,10 @@ gpujpeg_decoder_decode(struct gpujpeg_decoder* decoder, uint8_t* image, size_t i

// Set decompressed image size
output->data_size = coder->data_raw_size * sizeof(uint8_t);
output->color_space = decoder->coder.param_image.color_space != GPUJPEG_NONE ? decoder->coder.param_image.color_space : decoder->coder.param.color_space_internal;
output->pixel_format = decoder->coder.param_image.pixel_format;
output->param_image = decoder->coder.param_image;
if (output->param_image.color_space == GPUJPEG_NONE) {
output->param_image.color_space = decoder->coder.param.color_space_internal;
}

// Set decompressed image
if (output->type == GPUJPEG_DECODER_OUTPUT_INTERNAL_BUFFER) {
Expand Down
7 changes: 1 addition & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,7 @@ main(int argc, char *argv[])
duration = gpujpeg_get_time();

// Save image
struct gpujpeg_image_parameters decoded_param_image = { 0 };
struct gpujpeg_parameters decoded_param = { .verbose = param.verbose };
gpujpeg_decoder_get_image_info(image, image_size, &decoded_param_image, &decoded_param, NULL);
decoded_param_image.color_space = decoder_output.color_space;
decoded_param_image.pixel_format = decoder_output.pixel_format;
if ( gpujpeg_image_save_to_file(output, data, data_size, &decoded_param_image) != 0 ) {
if ( gpujpeg_image_save_to_file(output, data, data_size, &decoder_output.param_image) != 0 ) {
fprintf(stderr, "Failed to save image [%s]!\n", output);
ret = EXIT_FAILURE; continue;
}
Expand Down

0 comments on commit 84a3c5e

Please sign in to comment.