Skip to content

Commit c4ba02e

Browse files
committed
added GPUJPEG_LL_STATUS for stats
replaces original perf_stats=1+verbose=1 + renumbered GPUJPEG_LL_VERBOSE and above
1 parent 57bc798 commit c4ba02e

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

libgpujpeg/gpujpeg_common.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ enum restart_int {
158158
enum verbosity {
159159
GPUJPEG_LL_QUIET = -1, ///< suppress informative messages (but not warnings and errors)
160160
GPUJPEG_LL_INFO = 0, ///< normal verbosity
161-
GPUJPEG_LL_VERBOSE = 1, ///< print additional information
162-
GPUJPEG_LL_DEBUG = 2, ///< print more information, including internal ones
163-
GPUJPEG_LL_DEBUG2 = 3, ///< print maximum of information, including JPEG file internal structure
161+
GPUJPEG_LL_STATUS = 1, ///< print summary (image size, duration)
162+
GPUJPEG_LL_VERBOSE = 2, ///< print additional information
163+
GPUJPEG_LL_DEBUG = 3, ///< print more information, including internal ones
164+
GPUJPEG_LL_DEBUG2 = 4, ///< print maximum of information, including JPEG file internal structure
164165
};
165166

166167
/**

src/gpujpeg_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ coder_process_stats(struct gpujpeg_coder* coder)
20992099
coder->aggregate_duration += duration_ms;
21002100
coder->frames += 1;
21012101

2102-
if ( coder->param.verbose <= GPUJPEG_LL_QUIET ) {
2102+
if ( coder->param.verbose < GPUJPEG_LL_STATUS ) {
21032103
return;
21042104
}
21052105

src/gpujpeg_decoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ gpujpeg_decoder_init(struct gpujpeg_decoder* decoder, const struct gpujpeg_param
186186
struct gpujpeg_coder* coder = &decoder->coder;
187187

188188
coder->param.verbose = param->verbose;
189-
coder->param.perf_stats = param->perf_stats;
189+
coder->param.perf_stats = param->perf_stats || param->verbose >= GPUJPEG_LL_STATUS;
190190
if (param_image->width * param_image->height * param->comp_count == 0) {
191191
return 0;
192192
}

src/gpujpeg_encoder.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,11 @@ gpujpeg_encoder_encode(struct gpujpeg_encoder* encoder, const struct gpujpeg_par
356356
struct gpujpeg_coder* coder = &encoder->coder;
357357
int rc;
358358

359-
coder->start_time = param->perf_stats ? gpujpeg_get_time() : 0;
360-
361359
const bool img_changed = !gpujpeg_image_parameters_equals(&coder->param_image, param_image);
362360
struct gpujpeg_parameters param_adjusted = adjust_params(coder, param, param_image, img_changed);
361+
param_adjusted.perf_stats = param->perf_stats || param->verbose >= GPUJPEG_LL_STATUS;
362+
363+
coder->start_time = param_adjusted.perf_stats ? gpujpeg_get_time() : 0;
363364

364365
// (Re)initialize encoder
365366
if (coder->param.quality != param->quality) {
@@ -389,7 +390,7 @@ gpujpeg_encoder_encode(struct gpujpeg_encoder* encoder, const struct gpujpeg_par
389390
return -1;
390391
}
391392
}
392-
coder->init_end_time = param->perf_stats ? gpujpeg_get_time() : 0;
393+
coder->init_end_time = param_adjusted.perf_stats ? gpujpeg_get_time() : 0;
393394

394395
// Load input image
395396
if ( input->type == GPUJPEG_ENCODER_INPUT_IMAGE ) {

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ main(int argc, char *argv[])
237237
// Default coder parameters
238238
struct gpujpeg_parameters param;
239239
gpujpeg_set_default_parameters(&param);
240-
param.perf_stats = 1;
240+
param.verbose = GPUJPEG_LL_STATUS;
241241

242242
// Default image parameters
243243
struct gpujpeg_image_parameters param_image;

0 commit comments

Comments
 (0)