Skip to content

Commit 8abee70

Browse files
committed
image_delegate: use ERROR_MSG for err printout
1 parent bf77fc5 commit 8abee70

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/utils/image_delegate.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ pampnm_probe_delegate(const char* filename, enum gpujpeg_image_file_format forma
177177
return GPUJPEG_ERROR;
178178
}
179179
if (info.maxval != MAXVAL_8B) {
180-
fprintf(stderr,
181-
"[GPUJPEG] [Error] PAM/PNM image %s reports %d levels but only 255 are "
180+
ERROR_MSG(
181+
"PAM/PNM image %s reports %d levels but only 255 are "
182182
"currently supported!\n",
183183
filename, info.maxval);
184184
return GPUJPEG_ERROR;
@@ -198,7 +198,7 @@ pampnm_probe_delegate(const char* filename, enum gpujpeg_image_file_format forma
198198
param_image->pixel_format = GPUJPEG_U8;
199199
break;
200200
default:
201-
fprintf(stderr, "Unsupported PAM/PNM component count %d!\n", info.ch_count);
201+
ERROR_MSG("Unsupported PAM/PNM component count %d!\n", info.ch_count);
202202
return GPUJPEG_ERROR;
203203
}
204204
return 0;
@@ -207,7 +207,7 @@ pampnm_probe_delegate(const char* filename, enum gpujpeg_image_file_format forma
207207
int pampnm_save_delegate(const char *filename, const struct gpujpeg_image_parameters *param_image, const char *data, bool pnm)
208208
{
209209
if (param_image->pixel_format != GPUJPEG_U8 && param_image->color_space != GPUJPEG_RGB) {
210-
fprintf(stderr, "Wrong color space %s for PAM!\n", gpujpeg_color_space_get_name(param_image->color_space));
210+
ERROR_MSG(stderr, "Wrong color space %s for PAM!\n", gpujpeg_color_space_get_name(param_image->color_space));
211211
return -1;
212212
}
213213
int depth;
@@ -222,7 +222,7 @@ int pampnm_save_delegate(const char *filename, const struct gpujpeg_image_parame
222222
depth = 4;
223223
break;
224224
default:
225-
fprintf(stderr,
225+
ERROR_MSG(
226226
"Wrong pixel format %s for PAM/PNM! Only packed formats "
227227
"without subsampling are supported.\n",
228228
gpujpeg_pixel_format_get_name(param_image->pixel_format));
@@ -261,8 +261,8 @@ y4m_probe_delegate(const char* filename, enum gpujpeg_image_file_format format,
261261
param_image->width = info.width;
262262
param_image->height = info.height;
263263
if (info.bitdepth != DEPTH_8B) {
264-
fprintf(stderr,
265-
"[GPUJPEG] [Error] Currently only 8-bit Y4M pictures are "
264+
ERROR_MSG(
265+
"Currently only 8-bit Y4M pictures are "
266266
"supported but %s has %d bits!\n",
267267
filename, info.bitdepth);
268268
return GPUJPEG_ERROR;
@@ -281,10 +281,10 @@ y4m_probe_delegate(const char* filename, enum gpujpeg_image_file_format format,
281281
param_image->pixel_format = GPUJPEG_444_U8_P0P1P2;
282282
break;
283283
case Y4M_SUBS_YUVA:
284-
fprintf(stderr, "Planar YCbCr with alpha is not currently supported!\n");
284+
ERROR_MSG("Planar YCbCr with alpha is not currently supported!\n");
285285
return -1;
286286
default:
287-
fprintf(stderr, "[GPUJPEG] [Error] Unknown subsamplig in Y4M!\n");
287+
ERROR_MSG("Unknown subsamplig in Y4M!\n");
288288
return GPUJPEG_ERROR;
289289
}
290290
param_image->color_space = info.limited ? GPUJPEG_YCBCR_BT601 : GPUJPEG_YCBCR_BT601_256LVLS;
@@ -302,7 +302,7 @@ static int y4m_load_delegate(const char *filename, size_t *image_size, void **im
302302
int y4m_save_delegate(const char *filename, const struct gpujpeg_image_parameters *param_image, const char *data)
303303
{
304304
if (param_image->color_space == GPUJPEG_RGB) {
305-
fprintf(stderr, "Y4M cannot use RGB colorspace!\n");
305+
ERROR_MSG("Y4M cannot use RGB colorspace!\n");
306306
return -1;
307307
}
308308
int subsampling = 0;
@@ -320,7 +320,8 @@ int y4m_save_delegate(const char *filename, const struct gpujpeg_image_parameter
320320
subsampling = Y4M_SUBS_444;
321321
break;
322322
default:
323-
fprintf(stderr, "Wrong pixel format %s for Y4M! Only planar formats are supported.\n", gpujpeg_pixel_format_get_name(param_image->pixel_format));
323+
ERROR_MSG("Wrong pixel format %s for Y4M! Only planar formats are supported.\n",
324+
gpujpeg_pixel_format_get_name(param_image->pixel_format));
324325
return -1;
325326
}
326327

@@ -407,14 +408,14 @@ tst_image_parse_filename(const char* filename, struct gpujpeg_image_parameters*
407408
if ( strstr(item, "c_") == item ) {
408409
param_image->color_space = gpujpeg_color_space_by_name(value);
409410
if ( param_image->color_space == GPUJPEG_NONE ) {
410-
fprintf(stderr, "Unknown color space: %s\n", value);
411+
ERROR_MSG("Unknown color space: %s\n", value);
411412
return -1;
412413
}
413414
}
414415
else if ( strstr(item, "p_") == item ) {
415416
param_image->pixel_format = gpujpeg_pixel_format_by_name(value);
416417
if ( param_image->pixel_format == GPUJPEG_PIXFMT_NONE ) {
417-
fprintf(stderr, "Unknown pixel format: %s\n", value);
418+
ERROR_MSG("Unknown pixel format: %s\n", value);
418419
return -1;
419420
}
420421
}
@@ -437,7 +438,7 @@ tst_image_parse_filename(const char* filename, struct gpujpeg_image_parameters*
437438
tst_params->pattern = TST_GRADIENT;
438439
}
439440
else {
440-
fprintf(stderr, "unknown test image option: %s!\n", item);
441+
ERROR_MSG("unknown test image option: %s!\n", item);
441442
return -1;
442443
}
443444
endptr = NULL;

0 commit comments

Comments
 (0)