Skip to content

Commit 5640888

Browse files
committed
image_delegate msgs: add identifier of the delegate
Where the delegate name (stbi/y4m/tst...) are not in the string, print as the prefix.
1 parent 8abee70 commit 5640888

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/utils/image_delegate.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ stbi_load_delegate(const char* filename, size_t* image_size, void** image_data,
123123
*image_data = out;
124124
return 0;
125125
}
126-
WARN_MSG("Allocator is not gpujpeg_cuda_malloc_host. Will memcpy, which will be slower, please report!\n");
126+
WARN_MSG("[stbi] Allocator is not gpujpeg_cuda_malloc_host. Will memcpy, which will be slower, please report!\n");
127127
*image_data = alloc(*image_size);
128128
if (*image_data != NULL) {
129129
memcpy(*image_data, out, *image_size);
130130
}
131131
else {
132-
ERROR_MSG("Cannot allocate output buffer!\n");
132+
ERROR_MSG("[stbi] Cannot allocate output buffer!\n");
133133
return -1;
134134
}
135135
gpujpeg_cuda_free_host(out);
@@ -177,8 +177,7 @@ pampnm_probe_delegate(const char* filename, enum gpujpeg_image_file_format forma
177177
return GPUJPEG_ERROR;
178178
}
179179
if (info.maxval != MAXVAL_8B) {
180-
ERROR_MSG(
181-
"PAM/PNM image %s reports %d levels but only 255 are "
180+
ERROR_MSG("PAM/PNM image %s reports %d levels but only 255 are "
182181
"currently supported!\n",
183182
filename, info.maxval);
184183
return GPUJPEG_ERROR;
@@ -207,7 +206,7 @@ pampnm_probe_delegate(const char* filename, enum gpujpeg_image_file_format forma
207206
int pampnm_save_delegate(const char *filename, const struct gpujpeg_image_parameters *param_image, const char *data, bool pnm)
208207
{
209208
if (param_image->pixel_format != GPUJPEG_U8 && param_image->color_space != GPUJPEG_RGB) {
210-
ERROR_MSG(stderr, "Wrong color space %s for PAM!\n", gpujpeg_color_space_get_name(param_image->color_space));
209+
ERROR_MSG("Wrong color space %s for PAM!\n", gpujpeg_color_space_get_name(param_image->color_space));
211210
return -1;
212211
}
213212
int depth;
@@ -261,8 +260,7 @@ y4m_probe_delegate(const char* filename, enum gpujpeg_image_file_format format,
261260
param_image->width = info.width;
262261
param_image->height = info.height;
263262
if (info.bitdepth != DEPTH_8B) {
264-
ERROR_MSG(
265-
"Currently only 8-bit Y4M pictures are "
263+
ERROR_MSG("Currently only 8-bit Y4M pictures are "
266264
"supported but %s has %d bits!\n",
267265
filename, info.bitdepth);
268266
return GPUJPEG_ERROR;
@@ -281,7 +279,7 @@ y4m_probe_delegate(const char* filename, enum gpujpeg_image_file_format format,
281279
param_image->pixel_format = GPUJPEG_444_U8_P0P1P2;
282280
break;
283281
case Y4M_SUBS_YUVA:
284-
ERROR_MSG("Planar YCbCr with alpha is not currently supported!\n");
282+
ERROR_MSG("[y4m] Planar YCbCr with alpha is not currently supported!\n");
285283
return -1;
286284
default:
287285
ERROR_MSG("Unknown subsamplig in Y4M!\n");
@@ -408,14 +406,14 @@ tst_image_parse_filename(const char* filename, struct gpujpeg_image_parameters*
408406
if ( strstr(item, "c_") == item ) {
409407
param_image->color_space = gpujpeg_color_space_by_name(value);
410408
if ( param_image->color_space == GPUJPEG_NONE ) {
411-
ERROR_MSG("Unknown color space: %s\n", value);
409+
ERROR_MSG("[tst] Unknown color space: %s\n", value);
412410
return -1;
413411
}
414412
}
415413
else if ( strstr(item, "p_") == item ) {
416414
param_image->pixel_format = gpujpeg_pixel_format_by_name(value);
417415
if ( param_image->pixel_format == GPUJPEG_PIXFMT_NONE ) {
418-
ERROR_MSG("Unknown pixel format: %s\n", value);
416+
ERROR_MSG("[tst] Unknown pixel format: %s\n", value);
419417
return -1;
420418
}
421419
}
@@ -438,7 +436,7 @@ tst_image_parse_filename(const char* filename, struct gpujpeg_image_parameters*
438436
tst_params->pattern = TST_GRADIENT;
439437
}
440438
else {
441-
ERROR_MSG("unknown test image option: %s!\n", item);
439+
ERROR_MSG("[tst] unknown test image option: %s!\n", item);
442440
return -1;
443441
}
444442
endptr = NULL;

0 commit comments

Comments
 (0)