Skip to content

Commit 7bbebca

Browse files
committed
if verbose==GPUJEPG_LL_STATUS print codec img info
Print compressed/decompressed available image info if LL_STATU verbosity is used. Printed size + image properties - size, pixel format, color space. The values may have informative value because may be adjusted dynamically depending on the input.
1 parent c4ba02e commit 7bbebca

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/gpujpeg_common_internal.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,6 @@ gpujpeg_image_parameters_equals(const struct gpujpeg_image_parameters *p1 , cons
467467
float
468468
gpujpeg_custom_timer_get_duration(cudaEvent_t start, cudaEvent_t stop);
469469

470-
/// sets comp_count and sampling_factor from given pixel_format
471-
void
472-
gpujpeg_set_subsampling_from_pixel_format(enum gpujpeg_pixel_format pixel_format, int* comp_count,
473-
struct gpujpeg_component_sampling_factor* sampling_factor);
474-
475470
/**
476471
* @sa MK_SUBSAMPLING
477472
* This is mostly the same except but it zeroes unused coefficient (if comp_count < 4).

src/gpujpeg_decoder.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,11 @@ gpujpeg_decoder_decode(struct gpujpeg_decoder* decoder, uint8_t* image, size_t i
446446
}
447447

448448
coder_process_stats(coder);
449+
if ( coder->param.verbose >= GPUJPEG_LL_STATUS ) {
450+
printf("Decompressed Size: %10.zu bytes %dx%d %s %s\n", output->data_size, output->param_image.width,
451+
output->param_image.height, gpujpeg_pixel_format_get_name(output->param_image.pixel_format),
452+
gpujpeg_color_space_get_name(output->param_image.color_space));
453+
}
449454

450455
return 0;
451456
}

src/gpujpeg_encoder.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,13 @@ gpujpeg_encoder_encode(struct gpujpeg_encoder* encoder, const struct gpujpeg_par
625625
coder->d_data_raw = NULL;
626626

627627
coder_process_stats(coder);
628+
if (coder->param.verbose >= GPUJPEG_LL_STATUS ) {
629+
const char* interleaved =
630+
coder->param.comp_count == 1 ? "" : (coder->param.interleaved ? " interleaved" : " non-interleaved");
631+
printf("Compressed Size: %10.zu bytes %dx%d %s %s%s\n", *image_compressed_size, coder->param_image.width,
632+
coder->param_image.height, gpujpeg_color_space_get_name(coder->param.color_space_internal),
633+
gpujpeg_subsampling_get_name(coder->param.comp_count, coder->param.sampling_factor), interleaved);
634+
}
628635

629636
return 0;
630637
}

src/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ main(int argc, char *argv[])
585585

586586
duration = gpujpeg_get_time() - duration;
587587
printf("Save Image: %10.4f ms\n", duration * 1000.0);
588-
printf("Compressed Size: %10.zu bytes [%s]\n", image_compressed_size, output);
588+
printf("Image Name: %10s\n", output);
589589

590590
// Destroy image
591591
gpujpeg_image_destroy(image);
@@ -730,8 +730,7 @@ main(int argc, char *argv[])
730730

731731
duration = gpujpeg_get_time() - duration;
732732
printf("Save Image: %10.2f ms\n", duration * 1000.0);
733-
printf("Decompressed Size: %10.zu bytes [%s] ", decoder_output.data_size, output);
734-
print_gpujpeg_image_parameters(decoder_output.param_image, true, NULL);
733+
printf("Image Name: %10s\n", output);
735734

736735
if ( use_opengl ) {
737736
free(data);

0 commit comments

Comments
 (0)